本文整理汇总了C++中USER::UserStatus方法的典型用法代码示例。如果您正苦于以下问题:C++ USER::UserStatus方法的具体用法?C++ USER::UserStatus怎么用?C++ USER::UserStatus使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类USER
的用法示例。
在下文中一共展示了USER::UserStatus方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Execute
uint GWHeartBeatHandler::Execute( GWHeartBeat* pPacket, Player* pPlayer )
{
__ENTER_FUNCTION
ServerPlayer* pServerPlayer = (ServerPlayer*)pPlayer ;
GUID_t sGUID = pPacket->GetGUID() ;
USER* pUser = g_pOnlineUser->FindUser( sGUID ) ;
if( pUser==NULL )
{
WGNotifyUser Msg ;
Msg.SetGUID( sGUID ) ;
Msg.SetStatus( WGNotifyUser::NUS_REMOVE ) ;
pServerPlayer->SendPacket( &Msg ) ;
Log::SaveLog( WORLD_LOGFILE, "GWHeartBeatHandler...User GUID=%X not find! Notify server!",
sGUID ) ;
return PACKET_EXE_CONTINUE ;
}
pUser->ResetKickTime() ;
Log::SaveLog( WORLD_LOGFILE, "GWHeartBeatHandler...User GUID=%X Status=%d!",
sGUID, pUser->UserStatus() ) ;
return PACKET_EXE_CONTINUE ;
__LEAVE_FUNCTION
return PACKET_EXE_ERROR ;
}
示例2: Execute
uint GWMailHandler::Execute( GWMail* pPacket, Player* pPlayer )
{
__ENTER_FUNCTION
USER* pUser = g_pOnlineUser->FindUser( pPacket->GetMail()->m_szDestName );
if( pUser && (pUser->UserStatus() != US_OFFLINE) )
{//当前用户在线
if( pUser->RecvMail( pPacket->GetMail() ) == FALSE )
{
Log::SaveLog( WORLD_LOGFILE, "GWMailHandler...dName=%s refuse sName=%s's mail.",
pUser->GetName(), pPacket->GetMail()->m_szSourName );
return PACKET_EXE_CONTINUE;
}
}
else
{
g_pMailCenter->MailTo( pPacket->GetMail() );
}
Log::SaveLog( WORLD_LOGFILE, "GWMailHandler...sName=%s dName=%s",
(pPacket->GetMail()->m_SourSize > 0)?pPacket->GetMail()->m_szSourName:"",
pPacket->GetMail()->m_szDestName );
return PACKET_EXE_CONTINUE;
__LEAVE_FUNCTION
return PACKET_EXE_ERROR;
}
示例3: 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;
}
示例4: Execute
uint GWAskUserDataHandler::Execute( GWAskUserData* pPacket, Player* pPlayer )
{
__ENTER_FUNCTION
ServerPlayer* pServerPlayer = (ServerPlayer*)pPlayer ;
USER* pUser = g_pOnlineUser->FindUser( pPacket->GetGUID() ) ;
WGRetUserData Msg ;
if( pUser==NULL )
{//没有发现在“在线用户列表”里对应此GUID的用户
Log::SaveLog( WORLD_LOGFILE, "GWAskUserDataHandler...User GUID=%X not find!",
pPacket->GetGUID() ) ;
//如果是完整的Login 模式
if( g_Config.m_WorldInfo.m_EnableShareMem )
{
Msg.SetPlayerID( pPacket->GetPlayerID() ) ;
Msg.SetReturn( UDR_NOTFINDUSERDATA ) ;
pServerPlayer->SendPacket( &Msg ) ;
return PACKET_EXE_CONTINUE ;
}
//不是完整的login 模式
//测试数据
pUser = g_pOnlineUser->LoadUser( pPacket->GetGUID(), pPacket->GetCountry(), pPacket->GetProfession(),pPacket->GetAccount()) ;
if( pUser )
{
_HUMAN_DB_LOAD* pDBHuman = &(pUser->GetFullUserData()->m_Human);
pUser->SetTeamID( pUser->GetFullUserData()->m_Human.m_TeamID );
//临时测试数据
strncpy( pDBHuman->m_Name, pPacket->GetAccount(), MAX_CHARACTER_NAME-1 ) ;
pDBHuman->m_Sex = (BOOL)(pPacket->GetGender()) ;
pDBHuman->m_nCountry = pPacket->GetCountry();
pDBHuman->m_MenPai = pPacket->GetProfession();
pDBHuman->m_FaceModel = pPacket->GetFaceModel();
pUser->SetKey( pPacket->GetKey() );
//临时测试数据
g_pOnlineUser->OnUserLogin( pUser ) ;
g_pCountryManager->AddCountryUser((COUNTRY_ATTRIBUTE)pUser->GetCountry(), pUser->GetGUID());
Msg.SetPlayerID( pPacket->GetPlayerID() ) ;
Msg.SetReturn( UDR_USERDATA ) ;
Msg.SetUserData( pUser->GetFullUserData() ) ;
//回收数据块, 设置用户状态
g_pOnlineUser->DelData( pUser->GetFullUserData() ) ; //modified by wuwenbin
pUser->SetFullUserData( NULL ); //为什么置空,随后FindUser时造成FULLUSERDATA结构为空
pUser->SetUserStatus( US_NORMAL );
pUser->ResetKickTime();
//将用户所在服务器的PlayerID记录到用户数据里
pUser->SetPlayerID( pPacket->GetPlayerID() );
pServerPlayer->SendPacket( &Msg ) ;
Log::SaveLog( WORLD_LOGFILE, "GWAskUserDataHandler...Load GUID=%X OK!",
pPacket->GetGUID() ) ;
}
else
{
Log::SaveLog( WORLD_LOGFILE, "ERROR:GWAskUserDataHandler...Load GUID=%X false!",
pPacket->GetGUID() ) ;
}
//测试数据
//
return PACKET_EXE_CONTINUE ;
}
int iUserStatus = pUser->UserStatus() ;
if( pUser->GetKey() != pPacket->GetKey() )
{//验证码错误,警报,也许受到攻击
Msg.SetPlayerID( pPacket->GetPlayerID() ) ;
Msg.SetReturn( UDR_KEYERROR ) ;
pServerPlayer->SendPacket( &Msg ) ;
Log::SaveLog( WORLD_LOGFILE, "GWAskUserDataHandler.Key Error..User GUID=%X Status=%d",
pPacket->GetGUID(), iUserStatus ) ;
return PACKET_EXE_CONTINUE ;
}
//将用户所在服务器的PlayerID记录到用户数据里
pUser->SetPlayerID( pPacket->GetPlayerID() );
switch( iUserStatus )
{
case US_NONE:
{
Msg.SetPlayerID( pPacket->GetPlayerID() ) ;
Msg.SetReturn( UDR_NOTFINDUSERDATA ) ;
//.........这里部分代码省略.........
示例5: Execute
//.........这里部分代码省略.........
ReqRelation.GetTargetName() );
break;
}
// 加入好友名单
_RELATION_USER RUser;
RUser.m_UserGUID = pTargetUser->GetGUID();
RUser.m_RelationType = RELATION_TYPE_FRIEND;
RUser.m_nFriendPoint = 0;
pUser->AddRelation( pTargetUser->GetGUID(), &RUser );
// 传回去在线信息
if ( pRelationPacket->m_Type == REQ_ADDFRIEND )
{
Msg.GetRelation()->m_Type = RET_ADDFRIEND;
}
else if ( pRelationPacket->m_Type == REQ_TEMPFRIEND_TO_FRIEND )
{
Msg.GetRelation()->m_Type = RET_TEMPFRIEND_TO_FRIEND;
}
RETURN_ADD_RELATION& Relation = Msg.GetRelation()->m_AddRelation;
Relation.CleanUp();
Relation.SetRelationType( ReqRelation.GetRelationType() );
Relation.SetGroup( ReqRelation.GetGroup() );
pRelationData = Relation.GetRelationData();
// pRelationData 的数据在 switch 之后填充
Log::SaveLog( WORLD_LOGFILE, "GWRelationHandler...User Name=%s added to friend list!",
ReqRelation.GetTargetName() );
if ( pTargetUser->UserStatus() == US_NORMAL )
{ // 通知被加的人
WGRelation NotifyMsg;
NotifyMsg.GetRelation()->CleanUp();
NotifyMsg.GetRelation()->SetPlayerID( pTargetUser->GetPlayerID() );
NotifyMsg.GetRelation()->m_Type = RET_ADDFRIENDNOTIFY;
RETURN_NOTIFY_FRIEND& NotifyFriend = NotifyMsg.GetRelation()->m_NotifyFriend;
NotifyFriend.CleanUp();
NotifyFriend.SetGUID( pUser->GetGUID() );
NotifyFriend.SetName( pUser->GetName() );
ServerPlayer* pTServerPlayer = g_pServerManager->GetServerPlayer( pTargetUser->GetServerID() );
if( pTServerPlayer==NULL )
{
Assert(FALSE);
break;
}
pTServerPlayer->SendPacket( &NotifyMsg );
}
}
break;
case REQ_ADDTOBLACKLIST:
case REQ_TEMPFRIEND_ADDTO_BLACKLIST:
{ // 检查需要添加的是否在线,并发回详细信息,这里不做合法性判断
REQUEST_ADD_RELATION& ReqRelation = pRelationPacket->m_AddRelation;
if ( ReqRelation.GetTargetGUID() != INVALID_ID )
{
pTargetUser = g_pOnlineUser->FindUser( ReqRelation.GetTargetGUID() );
}
示例6: Execute
uint GWAskUserDataHandler::Execute( GWAskUserData* pPacket, Player* pPlayer )
{
__ENTER_FUNCTION
ServerPlayer* pServerPlayer = (ServerPlayer*)pPlayer ;
USER* pUser = g_pOnlineUser->FindUser( pPacket->GetGUID() ) ;
PlayerID_t OldPlayerID = INVALID_ID;
USER* pOldUser = g_pOnlineUser->FindUserByAccountName( pPacket->GetAccount() ) ;
if( pOldUser && pOldUser != pUser )
{
OldPlayerID = pOldUser->GetPlayerID();
}
if( pUser==NULL )
{//没有发现在“在线用户列表”里对应此GUID的用户
Log::SaveLog( WORLD_LOGFILE, "GWAskUserDataHandler...User GUID=%X not find!",
pPacket->GetGUID() ) ;
if( g_Config.m_WorldInfo.m_EnableShareMem )
{
WGRetUserData Msg ;
Msg.SetPlayerID( pPacket->GetPlayerID() ) ;
Msg.SetReturn( UDR_NOTFINDUSERDATA ) ;
pServerPlayer->SendPacket( &Msg ) ;
return PACKET_EXE_CONTINUE ;
}
//
//测试数据
pUser = g_pOnlineUser->LoadUser( pPacket->GetGUID() ) ;
if( pUser )
{
_HUMAN_DB_LOAD* pDBHuman = &(pUser->GetFullUserData()->m_Human);
//临时测试数据
strncpy( pDBHuman->m_Name, pPacket->GetAccount(), MAX_ACCOUNT ) ;
pDBHuman->m_Sex = (BOOL)(pPacket->GetGender()) ;
pUser->SetKey( pPacket->GetKey() );
//临时测试数据
g_pOnlineUser->OnUserLogin( pUser ) ;
WGRetUserData Msg ;
Msg.SetPlayerID( pPacket->GetPlayerID() ) ;
Msg.SetReturn( UDR_USERDATA ) ;
Msg.SetUserData( pUser->GetFullUserData() ) ;
Msg.SetPlayerAge( pUser->GetUserAge() );
//回收数据块, 设置用户状态
g_pOnlineUser->DelData( pUser->GetFullUserData() ) ;
pUser->SetFullUserData( NULL );
pUser->SetUserStatus( US_NORMAL );
pUser->ResetKickTime();
//将用户所在服务器的PlayerID记录到用户数据里
pUser->SetPlayerID( pPacket->GetPlayerID() );
pServerPlayer->SendPacket( &Msg ) ;
Log::SaveLog( WORLD_LOGFILE, "GWAskUserDataHandler...Load GUID=%X OK!",
pPacket->GetGUID() ) ;
}
else
{
Log::SaveLog( WORLD_LOGFILE, "ERROR:GWAskUserDataHandler...Load GUID=%X false!",
pPacket->GetGUID() ) ;
}
//测试数据
//
return PACKET_EXE_CONTINUE ;
}
int iUserStatus = pUser->UserStatus() ;
if( pUser->GetKey() != pPacket->GetKey() )
{//验证码错误,警报,也许受到攻击
WGRetUserData Msg ;
Msg.SetPlayerID( pPacket->GetPlayerID() ) ;
Msg.SetReturn( UDR_KEYERROR ) ;
pServerPlayer->SendPacket( &Msg ) ;
Log::SaveLog( WORLD_LOGFILE, "GWAskUserDataHandler.Key Error..User GUID=%X Status=%d",
pPacket->GetGUID(), iUserStatus ) ;
return PACKET_EXE_CONTINUE ;
}
//将用户所在服务器的PlayerID记录到用户数据里
pUser->SetPlayerID( pPacket->GetPlayerID() );
//.........这里部分代码省略.........
示例7: Execute
UINT LWAskCharLoginHandler::Execute(LWAskCharLogin* pPacket, Player* pPlayer )
{
__ENTER_FUNCTION
Assert(pPacket);
ASK_LOGINSTATUS AskStatus = pPacket->GetAskStatus();
ServerPlayer* pServerPlayer = (ServerPlayer*)pPlayer ;
Assert(pServerPlayer);
USER* pUser;
GUID_t CharGuid = pPacket->GetPlayerGUID();
if(AskStatus == ALS_ASKSTATUS)
{
WLRetCharLogin Msg;
pUser = g_pOnlineUser->FindUser( CharGuid ) ;
if(pUser) //用户存在,直接返回成功消息
{
UINT uUserStatus = pUser->UserStatus();
switch (uUserStatus)
{
case US_CRASH_DOWN:
case US_WAIT_SHUTDOWN://服务器Crash
{
Msg.SetResult(ASKCHARLOGIN_SERVER_STOP);
Msg.SetAccount(pPacket->GetAccount());
Msg.SetPlayerID(pPacket->GetPlayerID());
Msg.SetPlayerGUID(CharGuid);
Msg.SetHoldStatus(TRUE);
Msg.SetPlayerServerID(pUser->GetServerID());
pServerPlayer->SendPacket(&Msg);
Log::SaveLog( WORLD_LOGFILE, "LWAskCharLoginHandler...User Hold,CharGUID = %X",CharGuid) ;
return PACKET_EXE_CONTINUE;
}
break;
case US_NONE:
case US_NORMAL:
case US_OFFLINE:
case US_CHANGESCENE:
case US_HOLDUSERDATA:
{
pUser->SetKey( pPacket->GetUserKey() );
Msg.SetResult(ASKCHARLOGIN_SUCCESS);
Msg.SetAccount(pPacket->GetAccount());
Msg.SetPlayerID(pPacket->GetPlayerID());
Msg.SetPlayerGUID(CharGuid);
Msg.SetHoldStatus(TRUE);
Msg.SetPlayerServerID(pUser->GetServerID());
pServerPlayer->SendPacket(&Msg);
Log::SaveLog( WORLD_LOGFILE, "LWAskCharLoginHandler...User Hold,CharGUID = %X",CharGuid) ;
return PACKET_EXE_CONTINUE;
}
break;
default:
{
Log::SaveLog( WORLD_LOGFILE, "LWAskCharLoginHandler...UNKNOW ERROR,CharGUID = %X, Status=%d",CharGuid,uUserStatus) ;
return PACKET_EXE_ERROR;
}
break;
}
}
else //用户不存在
{
Msg.SetResult(ASKCHARLOGIN_LOADDB_ERROR);
Msg.SetAccount(pPacket->GetAccount());
Msg.SetPlayerID(pPacket->GetPlayerID());
Msg.SetPlayerGUID(CharGuid);
Msg.SetHoldStatus(FALSE);
pServerPlayer->SendPacket(&Msg);
Log::SaveLog( WORLD_LOGFILE, "LWAskCharLoginHandler...No User,CharGUID = %X",CharGuid) ;
return PACKET_EXE_CONTINUE;
}
}
else if(AskStatus == ALS_SENDDATA)
{
pUser = g_pOnlineUser->FindUser( CharGuid ) ;
if( pUser )
{//如果此用户存在
Log::SaveLog( WORLD_LOGFILE, "LWAskCharLoginHandler...Char Exist! CharGUID = %X",CharGuid) ;
return PACKET_EXE_CONTINUE;
}
ID_t ServerID = g_Config.SceneID2ServerID(pPacket->GetUserData()->m_Human.m_StartScene);
ServerPlayer* pFindPlayer = g_pServerManager->GetServerPlayer( ServerID ) ;
if( pFindPlayer==NULL ) //服务器维护
{
WLRetCharLogin Msg;
Msg.SetResult(ASKCHARLOGIN_SERVER_STOP);
Msg.SetAccount(pPacket->GetAccount());
Msg.SetPlayerID(pPacket->GetPlayerID());
Msg.SetPlayerGUID(CharGuid);
Msg.SetHoldStatus(FALSE);
//.........这里部分代码省略.........