public static void HandleEnterServerReq(CharacterSession session, ClientEnterServerReq enterServerReq) { void SendError(byte result) { session.SendMessage(new ServerEnterServerRes { Result = result }); } AccountModel account = DatabaseManager.Instance.AuthDatabase.GetAccount(enterServerReq.AccountId, enterServerReq.SessionKey); if (account == null) { SendError(1); return; } session.Authenticate(account); session.SendMessage(new ServerEnterServerRes { Result = 0, AccountId = account.Id }); }
public static void HandleSelectCharacterReq(CharacterSession session, ClientSelectCharacterReq selectCharacterReq) { CharacterModel character = session.GetCharacterById(selectCharacterReq.CharacterId); if (character == null) { return; } ServerClusterModel node = ServerManager.Instance.GetServerNode( ConfigurationManager <CharacterServerConfig> .Instance.Model.Server.Id); if (node == null) { return; } session.SendMessage(new ServerSelectCharacterRes { Unknown0 = new ServerSelectCharacterRes.UnknownStructure { CharacterId = character.Id, AccountId = session.Account.Id, Host = node.Host, Port = node.Port, Position = new WorldPosition { MapId = character.MapId, Origin = new Vector3(character.X, character.Y, character.Z), Orientation = character.O } } }); }