本文整理汇总了C++中USER::GetSex方法的典型用法代码示例。如果您正苦于以下问题:C++ USER::GetSex方法的具体用法?C++ USER::GetSex怎么用?C++ USER::GetSex使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类USER
的用法示例。
在下文中一共展示了USER::GetSex方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Execute
//.........这里部分代码省略.........
pLeaderServerPlayer->SendPacket( &Msg );
}
Log::SaveLog( WORLD_LOGFILE, "GWTeamRetInviteHandler...DestInTeam SourGUID=%X DestGUID=%X",
sGuid, dGuid );
}
else if( pSourUser->GetTeamID()==INVALID_ID )
{//邀请人和被邀请人都无队伍
TeamID_t tid = g_pTeamList->CreateTeam( );
Assert( tid!=INVALID_ID );
Team* pTeam = g_pTeamList->GetTeam( tid );
Assert( pTeam );
if ( pSourUser->GetGUID() == pDestUser->GetGUID() )
{
//将玩家加入队伍中
TEAMMEMBER Member;
Member.m_Member = sGuid;
pTeam->AddMember( &Member );
//设置玩家队伍数据
pSourUser->SetTeamID( tid );
//返回结果
WGTeamResult Msg;
Msg.SetPlayerID( pSourUser->GetPlayerID() );
Msg.SetReturn( TEAM_RESULT_MEMBERENTERTEAM );
Msg.SetGUID( sGuid );
Msg.SetTeamID( tid );
Msg.SetGUIDEx( pSourUser->GetPlayerID() ); // 将玩家的 PlayerID 传回
Msg.SetIcon( pSourUser->GetPortrait() );
Msg.SetSceneID( pSourUser->GetSceneID() );
Msg.SetDataID( pSourUser->GetSex() );
pSourServerPlayer->SendPacket( &Msg );
Log::SaveLog( WORLD_LOGFILE, "GWTeamRetInviteHandler...CreateTeam GUID=%X TeamID=%d",
sGuid, tid );
}
else
{
//将玩家加入队伍中
TEAMMEMBER sMember;
sMember.m_Member = sGuid;
pTeam->AddMember( &sMember );
TEAMMEMBER dMember;
dMember.m_Member = dGuid;
pTeam->AddMember( &dMember );
//设置玩家队伍数据
pSourUser->SetTeamID( tid );
pDestUser->SetTeamID( tid );
//返回结果
WGTeamResult sMsg1;
sMsg1.SetPlayerID( pSourUser->GetPlayerID() );
sMsg1.SetReturn( TEAM_RESULT_TEAMREFRESH );
sMsg1.SetGUID( sGuid );
sMsg1.SetTeamID( tid );
sMsg1.SetGUIDEx( pSourUser->GetPlayerID() ); // 将玩家的 PlayerID 传回
sMsg1.SetSceneID( pSourUser->GetSceneID() );
pSourServerPlayer->SendPacket( &sMsg1 );
WGTeamResult sMsg2;
示例2: Execute
//.........这里部分代码省略.........
Log::SaveLog( WORLD_LOGFILE, "GWTeamRetApplyHandler...Team Full sGUID=%X lGUID=%X",
sGuid, lGuid );
}
else if( pTeam->Leader()->m_Member != lGuid )
{ //队长GUID和队伍中记录的队长GUID不符
WGTeamError sMsg;
sMsg.SetPlayerID( pSourUser->GetPlayerID() );
sMsg.SetGUID( pLeaderUser->GetGUID() );
sMsg.SetErrorCode( TEAM_ERROR_APPLYLEADERGUIDERROR );
pSourServerPlayer->SendPacket( &sMsg );
WGTeamError lMsg;
lMsg.SetPlayerID( pLeaderUser->GetPlayerID() );
lMsg.SetGUID( pLeaderUser->GetGUID() );
lMsg.SetErrorCode( TEAM_ERROR_APPLYLEADERGUIDERROR );
pLeaderServerPlayer->SendPacket( &lMsg );
Log::SaveLog( WORLD_LOGFILE, "GWTeamRetApplyHandler...Team Full sGUID=%X lGUID=%X",
sGuid, lGuid );
}
else
{ //加入
//将玩家加入队伍
TEAMMEMBER Member;
Member.m_Member = sGuid;
pTeam->AddMember( &Member );
//设置玩家队伍信息
pSourUser->SetTeamID( pTeam->GetTeamID() );
WGTeamResult Msg1; // 发给新队员的
Msg1.SetPlayerID( pSourUser->GetPlayerID() );
Msg1.SetTeamID( tid );
WGTeamResult Msg2; // 发给每个队员的
Msg2.SetReturn( TEAM_RESULT_MEMBERENTERTEAM );
Msg2.SetTeamID( tid );
Msg2.SetGUID( sGuid );
Msg2.SetGUIDEx( pSourUser->GetPlayerID() ); // 将玩家的 PlayerID 传回
Msg2.SetSceneID( pSourUser->GetSceneID() );
Msg2.SetName( pSourUser->GetName() );
Msg2.SetIcon( pSourUser->GetPortrait() );
Msg2.SetDataID( pSourUser->GetSex() );
//通知所有组内的玩家
for( int i=0; i<pTeam->MemberCount(); i++ )
{
TEAMMEMBER* pMember = pTeam->Member( i );
if( pMember==NULL )
{
Assert(FALSE);
continue;
}
USER* pUser = g_pOnlineUser->FindUser( pMember->m_Member );
if( pUser==NULL )
{
Assert(FALSE);
continue;
}
ID_t ServerID = pUser->GetServerID();
ServerPlayer* pServerPlayer = g_pServerManager->GetServerPlayer( ServerID );
if( pServerPlayer==NULL )
{
Assert(FALSE);
continue;
}
Msg2.SetPlayerID( pUser->GetPlayerID() );
pServerPlayer->SendPacket( &Msg2 );
if( pMember->m_Member != sGuid )
{ // 将自己以外的玩家传给新玩家
Msg1.SetReturn( TEAM_RESULT_TEAMREFRESH );
Msg1.SetName( pUser->GetName() );
Msg1.SetIcon( pUser->GetPortrait() );
Msg1.SetDataID( pUser->GetSex() );
Msg1.SetGUID( pMember->m_Member );
Msg1.SetGUIDEx( pUser->GetPlayerID() ); // 将玩家的 PlayerID 传回
Msg1.SetSceneID( pUser->GetSceneID() );
pSourServerPlayer->SendPacket( &Msg1 );
}
}//end for
Log::SaveLog( WORLD_LOGFILE, "GWTeamRetApplyHandler...Success! sGUID=%X lGUID=%X",
sGuid, lGuid );
}
}
return PACKET_EXE_CONTINUE;
__LEAVE_FUNCTION
return PACKET_EXE_ERROR;
}
示例3: Execute
uint GWTeamKickHandler::Execute( GWTeamKick* pPacket, Player* pPlayer )
{
__ENTER_FUNCTION
ServerPlayer* pSourServerPlayer = (ServerPlayer*)pPlayer;
GUID_t sGuid = pPacket->GetSourGUID(); // 队长
GUID_t dGuid = pPacket->GetDestGUID(); // 倒霉蛋
USER* pSourUser = g_pOnlineUser->FindUser( sGuid );
if( pSourUser==NULL )
{
Log::SaveLog( WORLD_LOGFILE, "GWTeamKickHandler...User Sour GUID=%X not find!",
sGuid );
return PACKET_EXE_CONTINUE;
}
TeamID_t tid = pSourUser->GetTeamID();
Team* pTeam = g_pTeamList->GetTeam( tid );
if( pTeam==NULL )
{
Log::SaveLog( WORLD_LOGFILE, "GWTeamKickHandler...User sGUID=%X TeamID=%d not find team!",
sGuid, tid );
return PACKET_EXE_CONTINUE;
}
INT nMemberCount = pTeam->MemberCount();
INT i;
for( i=0; i<nMemberCount; ++i )
{
if ( pTeam->Member(i)->m_Member == dGuid )
{
break;
}
}
if( i >= nMemberCount )
{ // 被踢者不在队伍里
Log::SaveLog( WORLD_LOGFILE, "GWTeamKickHandler...User dGUID=%X not in sTeamID=%d(sGUID=%X)!",
dGuid, tid, sGuid );
return PACKET_EXE_CONTINUE;
}
if( pTeam->Leader()->m_Member != sGuid )
{ // 踢人者不是队长
WGTeamError Msg;
Msg.SetPlayerID( pSourUser->GetPlayerID() );
Msg.SetErrorCode( TEAM_ERROR_KICKNOTLEADER );
pSourServerPlayer->SendPacket( &Msg );
Log::SaveLog( WORLD_LOGFILE, "GWTeamKickHandler...User sGUID=%X TeamID=%d not leader!",
sGuid, tid );
return PACKET_EXE_CONTINUE;
}
WGTeamResult Msg;
Msg.SetReturn( TEAM_RESULT_TEAMKICK );
Msg.SetGUID( dGuid );
Msg.SetTeamID( tid );
Msg.SetFamily( pSourUser->GetMenpai() );
Msg.SetDataID( pSourUser->GetSex() );
Msg.SetIcon( pSourUser->GetPortrait() );
Msg.SetLevel( pSourUser->GetLevel() );
//通知所有组内的玩家
for( int i=0; i<pTeam->MemberCount(); i++ )
{
TEAMMEMBER* pMember = pTeam->Member( i );
if( pMember==NULL )
{
Assert(FALSE);
continue;
}
USER* pUser = g_pOnlineUser->FindUser( pMember->m_Member );
if( pUser==NULL )
{//如果队员离线,则用户数据是空
continue;
}
ID_t ServerID = pUser->GetServerID();
ServerPlayer* pServerPlayer = g_pServerManager->GetServerPlayer( ServerID );
if( pServerPlayer==NULL )
{
Assert(FALSE);
continue;
}
Msg.SetPlayerID( pUser->GetPlayerID() );
pServerPlayer->SendPacket( &Msg );
}
//剔除队员
TEAMMEMBER Member;
//.........这里部分代码省略.........
示例4: Execute
uint GWTeamInviteHandler::Execute( GWTeamInvite* pPacket, Player* pPlayer )
{
__ENTER_FUNCTION
ServerPlayer* pSourServerPlayer = (ServerPlayer*)pPlayer;
GUID_t sGuid = pPacket->GetSourGUID();
USER* pSourUser = g_pOnlineUser->FindUser( sGuid );
if( pSourUser==NULL )
{
Log::SaveLog( WORLD_LOGFILE, "GWTeamInviteHandler...User Sour GUID=%X not find!",
sGuid );
return PACKET_EXE_CONTINUE;
}
USER* pDestUser = g_pOnlineUser->FindUser( pPacket->GetDestName() );
if( pDestUser==NULL )
{
Log::SaveLog( WORLD_LOGFILE, "GWTeamInviteHandler...User Dest Name=%s not find!",
pPacket->GetDestName() );
return PACKET_EXE_CONTINUE;
}
GUID_t dGuid = pDestUser->GetGUID();
if( pSourUser->IsEnemy( pDestUser->GetUserCampData() ) )
{
Log::SaveLog( WORLD_LOGFILE, "GWTeamInviteHandler...Sour Name=%s, Dest Name=%s are enemy!",
pSourUser->GetName(), pDestUser->GetName() );
return PACKET_EXE_CONTINUE;
}
// 设置了拒绝被邀请
if( pDestUser->IsRefuseTeamInvite() )
{
WGTeamError Msg;
Msg.SetPlayerID( pSourUser->GetPlayerID() );
Msg.SetGUID(sGuid);
Msg.SetErrorCode(TEAM_ERROR_REFUSEINVITESETTING);
pSourServerPlayer->SendPacket( &Msg );
Log::SaveLog( WORLD_LOGFILE, "GWTeamInviteHandler...DestGUID=%X refuse to be invited. ",
dGuid );
return PACKET_EXE_CONTINUE;
}
if( pDestUser->GetTeamID() != INVALID_ID )
{//被邀请人已经属于某个队伍了
WGTeamError Msg;
Msg.SetPlayerID( pSourUser->GetPlayerID() );
Msg.SetGUID(sGuid);
Msg.SetErrorCode(TEAM_ERROR_INVITEDESTHASTEAM);
pSourServerPlayer->SendPacket( &Msg );
Log::SaveLog( WORLD_LOGFILE, "GWTeamInviteHandler...DestInTeam SourGUID=%X DestGUID=%X",
sGuid, dGuid );
}
else if( sGuid==dGuid && pSourUser->GetTeamID()==INVALID_ID )
{//邀请人和被邀请人属于同一个人, 且不属于某个队伍
//自建队伍
TeamID_t tid = g_pTeamList->CreateTeam( );
Assert( tid!=INVALID_ID );
Team* pTeam = g_pTeamList->GetTeam( tid );
Assert( pTeam );
//将玩家加入队伍中
TEAMMEMBER Member;
Member.m_Member = sGuid;
pTeam->AddMember( &Member );
//设置玩家队伍数据
pSourUser->SetTeamID( tid );
//返回结果
WGTeamResult Msg;
Msg.SetPlayerID( pSourUser->GetPlayerID() );
Msg.SetReturn( TEAM_RESULT_MEMBERENTERTEAM );
Msg.SetGUID( sGuid );
Msg.SetTeamID( tid );
Msg.SetGUIDEx( pSourUser->GetPlayerID() ); // 将玩家的 PlayerID 传回
Msg.SetSceneID( pSourUser->GetSceneID() );
Msg.SetDataID( pSourUser->GetSex() );
Msg.SetIcon( pSourUser->GetPortrait() );
pSourServerPlayer->SendPacket( &Msg );
Log::SaveLog( WORLD_LOGFILE, "GWTeamInviteHandler...CreateTeam GUID=%X TeamID=%d",
sGuid, tid );
}
else
{
if ( pSourUser->GetTeamID() != INVALID_ID )
{
//邀请人已经有一个队伍
Team* pTeam = g_pTeamList->GetTeam( pSourUser->GetTeamID() );
Assert( pTeam );
//.........这里部分代码省略.........
示例5: Execute
uint GWTeamMemberEnterSceneHandler::Execute( GWTeamMemberEnterScene* pPacket, Player* pPlayer )
{
__ENTER_FUNCTION
ServerPlayer* pServerPlayer = (ServerPlayer*)pPlayer;
GUID_t guid = pPacket->GetGUID(); // 被请求信息的玩家的 GUID
USER* pUser = g_pOnlineUser->FindUser( guid );
if( pUser == NULL )
{
Log::SaveLog( WORLD_LOGFILE, "GWTeamMemberEnterScene...User GUID=%X not find!",
guid ) ;
return PACKET_EXE_CONTINUE;
}
if( pUser->GetTeamID() == INVALID_ID )
{ // 这里以后要加上回馈信息,删除服务器端错误的队伍信息
Assert( FALSE && "该玩家没有队伍!" );
return PACKET_EXE_CONTINUE;
}
Team* pTeam = g_pTeamList->GetTeam( pUser->GetTeamID() );
if( pTeam==NULL )
{
Assert(FALSE) ;
return PACKET_EXE_CONTINUE ;
}
WGTeamResult Msg;
Msg.SetReturn( TEAM_RESULT_ENTERSCENE );
Msg.SetTeamID( pUser->GetTeamID() );
Msg.SetGUID( pPacket->GetGUID() );
Msg.SetSceneID( pPacket->GetSceneID() );
Msg.SetGUIDEx( pPacket->GetPlayerID() );
Msg.SetIcon( pUser->GetPortrait() );
Msg.SetFamily( pUser->GetMenpai() );
Msg.SetDataID( pUser->GetSex() );
Msg.SetLevel( pUser->GetLevel() );
for(int i=0; i<pTeam->MemberCount(); ++i)
{
TEAMMEMBER* pMember = pTeam->Member( i );
if( pMember==NULL )
{
Assert(FALSE);
continue;
}
USER* pUser = g_pOnlineUser->FindUser( pMember->m_Member );
if( pUser==NULL )
{
Assert(FALSE);
continue;
}
pServerPlayer = g_pServerManager->GetServerPlayer( pUser->GetServerID() );
if( pServerPlayer == NULL )
{
Assert(FALSE);
continue;
}
Msg.SetPlayerID( pUser->GetServerID() );
pServerPlayer->SendPacket( &Msg );
}
Log::SaveLog( WORLD_LOGFILE, "GWTeamMemberEnterScene...Success! GUID=%X", guid );
return PACKET_EXE_CONTINUE;
__LEAVE_FUNCTION
return PACKET_EXE_ERROR;
}
示例6: Execute
uint GWAskTeamInfoHandler::Execute( GWAskTeamInfo* pPacket, Player* pPlayer )
{
__ENTER_FUNCTION
ServerPlayer* pServerPlayer = (ServerPlayer*)pPlayer;
GUID_t guid = pPacket->GetGUID(); // 被请求信息的玩家的 GUID
USER* pUser = g_pOnlineUser->FindUser( guid );
if( pUser == NULL )
{
Log::SaveLog( WORLD_LOGFILE, "GWAskTeamInfoHandler...User GUID=%X not find!",
guid );
return PACKET_EXE_CONTINUE;
}
if( pUser->GetTeamID() == INVALID_ID )
{
return PACKET_EXE_CONTINUE;
}
Team* pTeam = g_pTeamList->GetTeam( pUser->GetTeamID() );
if( pTeam==NULL )
{
Assert(FALSE) ;
return PACKET_EXE_CONTINUE ;
}
else
{
TEAMMEMBER Member;
Member.m_Member = pUser->GetGUID();
if ( pTeam->IsMember( &Member ) == FALSE )
{ // 某些情况下,玩家保存了过期的队伍号
AssertEx( FALSE, "过期队伍号,忽略。" );
return PACKET_EXE_CONTINUE;
}
}
WGTeamList Msg;
Msg.SetPlayerID(pPacket->GetPlayerID());
Msg.SetTeamID( pUser->GetTeamID() );
Msg.SetGUID( guid );
WGTeamResult MsgtoEveryMember; // 通知其他队员某人进入新场景了
MsgtoEveryMember.SetReturn( TEAM_RESULT_ENTERSCENE );
MsgtoEveryMember.SetTeamID( pTeam->GetTeamID() );
MsgtoEveryMember.SetGUID( pUser->GetGUID() );
MsgtoEveryMember.SetGUIDEx( pUser->GetPlayerID() );
MsgtoEveryMember.SetIcon( pUser->GetPortrait() );
MsgtoEveryMember.SetSceneID( pUser->GetSceneID() );
for(int i=0; i<pTeam->MemberCount(); ++i)
{
TEAMMEMBER* pMember = pTeam->Member( i );
if( pMember==NULL )
{
Assert(FALSE);
continue;
}
USER* pDestUser = g_pOnlineUser->FindUser( pMember->m_Member );
if( pDestUser==NULL )
{
Assert(FALSE);
continue;
}
ID_t ServerID = pDestUser->GetServerID() ;
ServerPlayer* pDestServerPlayer = g_pServerManager->GetServerPlayer( ServerID ) ;
if( pDestServerPlayer==NULL )
{
Assert(FALSE) ;
continue ;
}
if( pUser->GetGUID() != pDestUser->GetGUID() )
{
MsgtoEveryMember.SetPlayerID( pDestUser->GetPlayerID() ) ;
pDestServerPlayer->SendPacket( &MsgtoEveryMember );
}
TEAM_LIST_ENTRY entry;
entry.SetGUID( pDestUser->GetGUID() );
entry.SetSceneID( pDestUser->GetSceneID() );
entry.SetExtraID( pDestUser->GetPlayerID() );
entry.SetName( pDestUser->GetName() );
entry.SetIcon( pDestUser->GetPortrait() );
entry.SetDataID( pDestUser->GetSex() );
Msg.AddTeamMember( entry );
}
pServerPlayer->SendPacket( &Msg );
if ( pTeam->GetFollowedmemberCount()>0 )
{
GUID_t* FollowedMembers = pTeam->GetFollowedMembers();
BOOL flag;
//.........这里部分代码省略.........