本文整理汇总了C++中WorldSession::ClusterTryPlayerLogin方法的典型用法代码示例。如果您正苦于以下问题:C++ WorldSession::ClusterTryPlayerLogin方法的具体用法?C++ WorldSession::ClusterTryPlayerLogin怎么用?C++ WorldSession::ClusterTryPlayerLogin使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WorldSession
的用法示例。
在下文中一共展示了WorldSession::ClusterTryPlayerLogin方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: HandlePlayerLogin
void ClusterInterface::HandlePlayerLogin(WorldPacket & pck)
{
/* player x logging into instance y */
uint32 Guid, InstanceId, MapId;
uint32 AccountId, Account_Flags, sessionid, ClientBuild;
string GMPermissions, accountname;
pck >> Guid >> MapId >> InstanceId >> AccountId >> Account_Flags >> sessionid >> GMPermissions >> accountname >> ClientBuild;
/* find the instance */
Map* ma = sInstanceMgr.GetMap(MapId);
ASSERT(ma);
MapMgr* mm = sInstanceMgr.GetInstance(MapId, InstanceId);
ASSERT(mm);
/* create the session */
WorldSession * s = sWorld.FindSession(AccountId);
/* create the socket */
WorldSocket * so = new WorldSocket(sessionid);
if (s == NULL)
s = new WorldSession(AccountId, accountname, so);
_sessions[sessionid] = s;
sWorld.AddSession(s);
bool login_result = s->ClusterTryPlayerLogin(Guid, ClientBuild, GMPermissions, Account_Flags);
if(login_result)
{
/* login was ok. send a message to the realm server telling him to distribute our info to all other realm server */
WorldPacket data(ICMSG_PLAYER_LOGIN_RESULT, 5);
data << Guid << sessionid << uint8(1);
SendPacket(&data);
}
else
{
/* for some reason the login failed */
WorldPacket data(ICMSG_PLAYER_LOGIN_RESULT, 5);
data << Guid << sessionid << uint8(0);
SendPacket(&data);
/* tell the client his login failed before deleting the session */
data.Initialize(SMSG_CHARACTER_LOGIN_FAILED);
data << uint8(62);
so->SendPacket(&data);
/* destroy the session */
DestroySession(sessionid);
}
}