本文整理汇总了C++中USER::SetAccount方法的典型用法代码示例。如果您正苦于以下问题:C++ USER::SetAccount方法的具体用法?C++ USER::SetAccount怎么用?C++ USER::SetAccount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类USER
的用法示例。
在下文中一共展示了USER::SetAccount方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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);
//.........这里部分代码省略.........