Example #1
0
bool CUserMgr::_HandlePacket_UserDisplace(Packet* pack)
{
	if( !pack )
		return false;

	Message::UserDisplace msg;
	PROTOBUF_CMD_PARSER( pack, msg );

	CUser* user = GetUserByUID(msg.uid());
	if( user )
		Displace( user );

	return true;
}
Example #2
0
bool CUserMgr::_HandlePacket_PlayerLogin(Packet* pack)
{
	if( !pack )
		return false;

	Message::PlayerLogin msg;
	PROTOBUF_CMD_PARSER( pack, msg );

	CUser* user = GetUserByUID( msg.uid() );
	if( !user )
		return false;

	user->m_LogonPlayer = msg.pid();

	LOGGER_NOTICE("[Login] Login Sucess, User:"******" Player:"INT64_FMT" Socket:%d", user->m_id, user->m_LogonPlayer, user->m_ClientSock);

	return true;
}
Example #3
0
bool CUserMgr::_HandlePacket_PlayerCount(Packet* pack)
{
	if( !pack )
		return false;

	Message::PlayerCount msg;
	PROTOBUF_CMD_PARSER( pack, msg );

	CUser* user = GetUserByUID( msg.uid() );
	if( !user )
		return false;

	if( msg.player().size() <= 0 )
		user->m_CanCreate = true;

	GETCLIENTNET(&GateServer)->sendMsg(user->m_ClientSock, pack);

	return true;
}
Example #4
0
bool CUserMgr::_HandlePacket_PlayerCreate(Packet* pack)
{
	if( !pack )
		return false;

	Message::CreatePlayer msg;
	PROTOBUF_CMD_PARSER( pack, msg );

	CUser* user = GetUserByUID( msg.uid() );
	if( !user )
		return false;

	if( !user->m_CanCreate )
		return false;

	GETSERVERNET(&GateServer)->sendMsg( user->m_GameSock, pack );

	return true;
}
Example #5
0
bool CUserMgr::_HandlePacket_UserLogin(Packet* pack)
{
	Message::ClientLogin msg;
	PROTOBUF_CMD_PARSER(pack, msg);

	CLinker* server = GateServer.getServerByType(CBaseServer::Linker_Server_Game);
	if (!server) {
		LOGGER_ERROR("User login failed. Cannot find gameserver: user %lld", msg.uid());
		GETCLIENTNET(&GateServer)->shutdown(pack->GetNetID());
		return false;
	}

	CUser* user = UserMgr.Create(pack->GetNetID());
	if (!user) {
		LOGGER_ERROR("User login failed. Cannot create user: %lld", msg.uid());
		GETCLIENTNET(&GateServer)->shutdown(pack->GetNetID());
		return false;
	}

	CUser* oldUser = GetUserByUID(msg.uid());
	if (oldUser) {
		Displace(oldUser);
		LOGGER_WARN("user %lld relogin, displace the older.", msg.uid());
	}

	TMV t = time(NULL);
	user->m_id = msg.uid();
	user->m_worldID = server->m_worldID;
	user->m_svrID = server->m_nID;
	user->m_ClientSock = pack->GetNetID();
	user->m_GameSock = server->m_Socket;
	user->m_HeartTime = t;
	user->m_CanCreate = false;
	user->m_PackCount = 0;
	user->m_PackTime = t;
	user->m_AccessToken = msg.accesstoken();

	ThreadLib::CreateByPool(httpCheckUserThread, user);

	return true;
}
Example #6
0
static int
GetEffectiveUser(AG_User *u)
{
	return GetUserByUID(u, 0);
}
Example #7
0
static int
GetRealUser(AG_User *u)
{
	return GetUserByUID(u, 0);
}
Example #8
0
static int
GetUserByName(AG_User *u, const char *name)
{
	return GetUserByUID(u, 0);
}