本文整理汇总了C++中USER::AddGoodFriend方法的典型用法代码示例。如果您正苦于以下问题:C++ USER::AddGoodFriend方法的具体用法?C++ USER::AddGoodFriend怎么用?C++ USER::AddGoodFriend使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类USER
的用法示例。
在下文中一共展示了USER::AddGoodFriend方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Execute
//.........这里部分代码省略.........
}
RETURN_ADD_RELATION& Relation = Msg.GetRelation()->m_AddRelation;
Relation.CleanUp();
Relation.SetRelationType( ReqRelation.GetRelationType() );
pRelationData = Relation.GetRelationData();
// pRelationData 的数据在 switch 之后填充
Log::SaveLog( WORLD_LOGFILE, "GWRelationHandler...User Name=%s added to black list!",
ReqRelation.GetTargetName() );
}
break;
case REQ_DELFRIEND:
case REQ_DELFROMBLACKLIST:
pUser->DelRelation( pRelationPacket->m_RelationGUID.GetTargetGUID() );
return PACKET_EXE_CONTINUE;
case REQ_TRANSITION:
{
RELATION_GUID_UCHAR& Relation = pRelationPacket->m_TransitionRelation;
pUser->DelRelation( Relation.GetTargetGUID() );
_RELATION_USER RUser;
RUser.m_UserGUID = Relation.GetTargetGUID();
RUser.m_RelationType = (RELATION_TYPE)Relation.GetRelationType();
RUser.m_nFriendPoint = 0;
pUser->AddRelation( Relation.GetTargetGUID(), &RUser );
return PACKET_EXE_CONTINUE;
}
break;
case REQ_NEWGOODFRIEND:
{ // 加入一个亲密好友
pUser->AddGoodFriend( pRelationPacket->m_RelationGUID.GetTargetGUID() );
return PACKET_EXE_CONTINUE;
}
break;
case REQ_RELATIONONLINE:
{ // 获取密友的在线列表
Msg.GetRelation()->m_Type = RET_ONLINELIST;
RETURN_ONLINE_LIST* pSend = &(Msg.GetRelation()->m_RelationOnline);
pSend->CleanUp();
pUser->FillOnlineList(pSend);
}
break;
case REQ_MODIFYMOOD:
{
pUser->SetMood( pRelationPacket->m_ModifyMood.GetMood() );
return PACKET_EXE_CONTINUE;
}
break;
case REQ_MODIFYSETTINGS:
{
pUser->SetSettings( pRelationPacket->m_Settings.GetSettings() );
return PACKET_EXE_CONTINUE;
}
break;
case REQ_NOTIFY_ADDTEMPFRIEND:
{
REQUEST_VIEW_PLAYER& Recv = pRelationPacket->m_ViewPlayer;
if ( strlen(Recv.GetTargetName()) > 0 )
{
pTargetUser = g_pOnlineUser->FindUser( Recv.GetTargetName() );
}
示例2: Execute
//.........这里部分代码省略.........
//这里执行的是从别的组移动到相应的组(对方有可能不在线),如果是移动到黑名单,则返回一个信息,在这不用考虑
if( Relation.GetRelationType() == RELATION_TYPE_BLACKNAME )
{// 向客户端发回该玩家已经移动到黑名单消息
WGRelation BlackListMsg;
BlackListMsg.GetRelation()->CleanUp();
BlackListMsg.GetRelation()->SetPlayerID( pUser->GetPlayerID() );
BlackListMsg.GetRelation()->m_Type = RET_ASKADDTOBLACKLIST;
BlackListMsg.GetRelation()->m_NotifyFriend.CleanUp();
BlackListMsg.GetRelation()->m_NotifyFriend.SetGUID( Relation.GetTargetGUID() );
//BlackListMsg.GetRelation()->m_NotifyFriend.SetName( pUser->GetName() );
pServerPlayer->SendPacket( &BlackListMsg );
}
else if ( Relation.GetRelationType() == RELATION_TYPE_FRIEND )
{// 向客户端发回该玩家已经移动到好友消息
WGRelation FriendListMsg;
FriendListMsg.GetRelation()->CleanUp();
FriendListMsg.GetRelation()->SetPlayerID( pUser->GetPlayerID() );
FriendListMsg.GetRelation()->m_Type = RET_ASKTHROWTOFRIENDLIST;
FriendListMsg.GetRelation()->m_NotifyFriend.CleanUp();
FriendListMsg.GetRelation()->m_NotifyFriend.SetGUID( Relation.GetTargetGUID() );
pServerPlayer->SendPacket( &FriendListMsg );
}
return PACKET_EXE_CONTINUE;
}
break;
case REQ_NEWGOODFRIEND:
{ // 加入一个亲密好友
pUser->AddGoodFriend( pRelationPacket->m_RelationGUID.GetTargetGUID() );
return PACKET_EXE_CONTINUE;
}
break;
case REQ_RELATIONONLINE:
{ // 获取好友的在线列表
Msg.GetRelation()->m_Type = RET_ONLINELIST;
RETURN_ONLINE_LIST* pSend = &(Msg.GetRelation()->m_RelationOnline);
pSend->CleanUp();
pUser->FillOnlineList(pSend);
}
break;
case REQ_MODIFYMOOD:
{
pUser->SetMood( pRelationPacket->m_ModifyMood.GetMood() );
return PACKET_EXE_CONTINUE;
}
break;
case REQ_MODIFYSETTINGS:
{
pUser->SetSettings( pRelationPacket->m_Settings.GetSettings() );
return PACKET_EXE_CONTINUE;
}
break;
case REQ_NOTIFY_ADDTEMPFRIEND:
{
REQUEST_VIEW_PLAYER& Recv = pRelationPacket->m_ViewPlayer;
if ( strlen(Recv.GetTargetName()) > 0 )
{
pTargetUser = g_pOnlineUser->FindUser( Recv.GetTargetName() );
}