本文整理汇总了C++中USER::GetLevel方法的典型用法代码示例。如果您正苦于以下问题:C++ USER::GetLevel方法的具体用法?C++ USER::GetLevel怎么用?C++ USER::GetLevel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类USER
的用法示例。
在下文中一共展示了USER::GetLevel方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Execute
uint GWAskTeamMemberInfoHandler::Execute( GWAskTeamMemberInfo* pPacket, Player* pPlayer )
{
__ENTER_FUNCTION
ServerPlayer* pServerPlayer = (ServerPlayer*)pPlayer;
GUID_t guid = pPacket->GetGUID(); // 被请求信息的玩家的 GUID
WGTeamMemberInfo Msg;
Msg.SetPlayerID( pPacket->GetObjID() );
Msg.SetGUID( 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;
}
Msg.SetFamily( pUser->GetMenpai() );
Msg.SetLevel( pUser->GetLevel() );
if( pUser->UserStatus() != US_NORMAL )
{
Msg.SetDeadLinkFlag( TRUE );
}
else
{
Msg.SetDeadLinkFlag( FALSE );
}
pServerPlayer->SendPacket( &Msg );
Log::SaveLog( WORLD_LOGFILE, "GWAskTeamInfoHandler...User GUID=%X was find!", guid );
return PACKET_EXE_CONTINUE;
__LEAVE_FUNCTION
return PACKET_EXE_ERROR;
}
示例2: Execute
//.........这里部分代码省略.........
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() );
}
if ( pTargetUser == NULL )
{ // 玩家可能不存在也可能不在线,由 Server 来判断
Log::SaveLog( WORLD_LOGFILE, "GWRelationHandler...User GUID=%s not find!",
Recv.GetTargetName() );
return PACKET_EXE_CONTINUE;
}
Msg.GetRelation()->m_Type = RET_NOTIFY_ADDTEMPFRIEND;
REQUEST_VIEW_PLAYER* pSend = &(Msg.GetRelation()->m_PlayerName);
pSend->CleanUp();
pSend->SetTargetName( pUser->GetName() );
}
break;
default :
{
Assert(FALSE);
return PACKET_EXE_CONTINUE;
}
}
if ( uErr > 0 )
{
Msg.GetRelation()->m_Type = uErr;
}
if ( pRelationData != NULL && pTargetUser != NULL )
{
pRelationData->SetGUID( pTargetUser->GetGUID() );
pRelationData->SetName( pTargetUser->GetName() );
pRelationData->SetLevel( pTargetUser->GetLevel() );
pRelationData->SetMenPai( pTargetUser->GetMenpai() );
pRelationData->SetPortrait( pTargetUser->GetPortrait() );
pRelationData->SetGuildID( pTargetUser->GetGuildID() );
pRelationData->SetGuildName( g_pGuildManager->GetGuildName(pTargetUser->GetGuildID()) );
if ( pTargetUser->UserStatus() == US_NORMAL )
{ // 只有在线才发剩余信息
pRelationData->SetOnlineFlag(1);
pRelationData->SetMood( pTargetUser->GetMood() );
pRelationData->SetTitle( pTargetUser->GetTitle() );
pRelationData->SetSceneID( pTargetUser->GetSceneID() );
if ( pTargetUser->GetTeamID() != INVALID_ID )
{
Team* pTeam = g_pTeamList->GetTeam( pTargetUser->GetTeamID() );
if ( pTeam != NULL )
{
pRelationData->SetTeamSize( pTeam->MemberCount() );
}
}
}
}
pServerPlayer->SendPacket( &Msg );
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 GWRegisterTeamRecruitHandler::Execute( GWRegisterTeamRecruit* 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, "GWRegisterTeamRecruit...User GUID=%X not find!",
guid ) ;
return PACKET_EXE_CONTINUE;
}
if ( pPacket->GetType() == LEADER_RECRUIT )
{ //队长发布征兵请示
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 ;
}
if ( pTeam->Leader()->m_Member != guid )
{
//Assert(FALSE&&"不是队长不可以申请招收队员!") ;
return PACKET_EXE_CONTINUE ;
}
LEADER_RECRUIT_ATTRIB* pRecruit = pPacket->GetLeaderRecruit();
LEADER_INFO_NODE *pData = g_pTeamRecruitManager->GetLeaderNullNode();
pData->m_OwnerInfo.m_Level = pUser->GetLevel() ;
pData->m_OwnerInfo.m_ManPai = pUser->GetMenpai();
pData->m_OwnerInfo.m_Country = pUser->GetCountry();
pData->m_OwnerInfo.m_NameLen = (UCHAR)strlen( pUser->GetName() );
strncpy((char*)pData->m_OwnerInfo.m_szUserName,(char*)pUser->GetName(),pData->m_OwnerInfo.m_NameLen) ;
pData->SetRecruitData(*pRecruit);
g_pTeamRecruitManager->Remove(guid,LEADER_RECRUIT);
g_pTeamRecruitManager->Add(guid,pData,LEADER_RECRUIT);
}
else if ( pPacket->GetType() == MEMBER_RECRUIT )
{ //队员发布征兵请示
MEMBER_RECRUIT_ATTRIB* pRecruit = pPacket->GetMemberRecruit();
MEMBER_INFO_NODE *pData = g_pTeamRecruitManager->GetMemberNullNode();
pData->m_OwnerInfo.m_Level = pUser->GetLevel() ;
pData->m_OwnerInfo.m_ManPai = pUser->GetMenpai();
pData->m_OwnerInfo.m_Country = pUser->GetCountry();
pData->m_OwnerInfo.m_NameLen = (UCHAR)strlen( pUser->GetName() );
strncpy((char*)pData->m_OwnerInfo.m_szUserName,(char*)pUser->GetName(),pData->m_OwnerInfo.m_NameLen) ;
pData->SetRecruitData(*pRecruit);
g_pTeamRecruitManager->Remove(guid,MEMBER_RECRUIT);
g_pTeamRecruitManager->Add(guid,pData,MEMBER_RECRUIT);
}
else
{
//Assert(FALSE&&"组队征兵时类型错误");
}
Log::SaveLog( WORLD_LOGFILE, "GWRegisterTeamRecruit...Success! GUID=%X", guid );
return PACKET_EXE_CONTINUE;
__LEAVE_FUNCTION
return PACKET_EXE_ERROR;
}
示例5: Execute
//.........这里部分代码省略.........
ID_t LeaderServerID = pLeaderUser->GetServerID();
ServerPlayer* pLeaderServerPlayer = g_pServerManager->GetServerPlayer( LeaderServerID );
if( pLeaderServerPlayer==NULL )
{
Assert(FALSE);
}
WGTeamLeaderAskInvite Msg;
Msg.SetPlayerID( pLeaderUser->GetPlayerID() );//队长的Player_t
Msg.SetSourGUID( sGuid ); //邀请人
Msg.SetDestGUID( dGuid ); //被要请人
Msg.SetSourName( pSourUser->GetName() );
Msg.SetDestName( pDestUser->GetName() );
Msg.SetGUID(tlGUID);
pLeaderServerPlayer->SendPacket( &Msg );
Log::SaveLog( WORLD_LOGFILE, "GWTeamInviteHandler...TeamLeaderAskInvite SourGUID=%X DestGUID=%X",
sGuid, dGuid );
return PACKET_EXE_CONTINUE;
}
}
ID_t DestServerID = pDestUser->GetServerID();
ServerPlayer* pDestServerPlayer = g_pServerManager->GetServerPlayer( DestServerID );
if( pDestServerPlayer )
{//向被邀请人发送邀请消息
WGTeamAskInvite Msg;
Msg.SetPlayerID( pDestUser->GetPlayerID() );
Msg.SetdGUID( dGuid );
Msg.SetsGUID( sGuid );
if ( pSourUser->GetTeamID() != INVALID_ID )
{
Team* pTeam = g_pTeamList->GetTeam( pSourUser->GetTeamID() );
Assert( pTeam );
// Msg.SetMemberCount( pTeam->MemberCount() );
for( INT i=0; i<pTeam->MemberCount(); ++i )
{
WGTeamAskInvite::InviterInfo info;
TEAMMEMBER* pMember = pTeam->Member( i );
if( pMember == NULL )
{
Assert(FALSE);
continue ;
}
USER* pUser = g_pOnlineUser->FindUser( pMember->m_Member );
if( pUser == NULL )
{//如果队员离线,则用户数据是空
continue ;
}
info.m_PlayerID = pUser->GetPlayerID();
info.m_NickSize = (UCHAR)strlen(pUser->GetName());
strncpy( (CHAR*)info.m_szNick, pUser->GetName(), info.m_NickSize );
info.m_uFamily = pUser->GetMenpai();
info.m_Scene = pUser->GetSceneID();
info.m_Level = pUser->GetLevel();
info.m_uDataID = pUser->GetSex();
Msg.AddInviterInfo( info );
}
}
else
{
// Msg.SetMemberCount( 1 );
WGTeamAskInvite::InviterInfo info;
info.m_PlayerID = pSourUser->GetPlayerID();
info.m_NickSize = (UCHAR)strlen(pSourUser->GetName());
strncpy( (CHAR*)info.m_szNick, pSourUser->GetName(), info.m_NickSize );
info.m_uFamily = pSourUser->GetMenpai();
info.m_Scene = pSourUser->GetSceneID();
info.m_Level = pSourUser->GetLevel();
info.m_uDataID = pSourUser->GetSex();
Msg.AddInviterInfo( info );
}
pDestServerPlayer->SendPacket( &Msg );
}
else
{
Assert(FALSE);
}
Log::SaveLog( WORLD_LOGFILE, "GWTeamInviteHandler...AskInvite SourGUID=%X DestGUID=%X",
sGuid, dGuid );
}
return PACKET_EXE_CONTINUE;
__LEAVE_FUNCTION
return PACKET_EXE_ERROR;
}
示例6: 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;
}