private static void Handle_RegisterGameServer(GameConnection net, PacketReader reader) { byte id = reader.ReadByte(); short port = reader.ReadInt16(); string ip = reader.ReadDynamicString(); string password = reader.ReadDynamicString(); bool success = GameServerController.RegisterGameServer(id, password, net, port, ip); net.SendAsync(new NET_GameRegistrationResult(success)); }
public static bool RegisterGameServer(byte id, string password, GameConnection con, short port, string ip) { if (!gameservers.ContainsKey(id)) { Logger.Trace("Undefined Game Server Id {0}", id); return false; } GameServer template = gameservers[id]; //Checking Containing By Packet if (con.CurrentInfo != null) //Fully Checking. { con.CurrentInfo = null; } if (template.password != password) //Checking Password { Logger.Trace("Received GameServer {0} Have Wrong Password.", id); return false; } GameServer server = gameservers[id]; server.CurrentConnection = con; server.IPAddress = ip; server.Port = port; con.CurrentInfo = server; //Update gameservers.Remove(id); gameservers.Add(id, server); Logger.Trace("Registered {0} - World Server", id); return true; }
private static void Handle_UpdateCharacters(GameConnection net, PacketReader reader) { int accountId = reader.ReadInt32(); int characters = reader.ReadInt32(); Account currentAc = AccountHolder.AccountList.FirstOrDefault(n => n.AccountId == accountId); currentAc.Characters = characters; }