public static void GuildOperation(GameServerConnection con, PacketReader packet) { int cid = packet.ReadInt(); int gid = packet.ReadInt(); var guild = Database.GetGuild(gid); con.mSession.SendPacket(CenterServerPacketDefinitions.GuildOperation(cid, guild)); }
public static void ClientCount(GameServerConnection con, PacketReader packet) { byte serverid = packet.ReadByte(); int count = packet.ReadInt(); foreach (GameServer serv in Program.mServer.gameServers.Values) if (serv.ID == serverid) serv.ClientCount = count; }
public static void Identify(GameServerConnection con, PacketReader packet) { byte serverType = packet.ReadByte(); byte[] key = packet.ReadBytes(128); con.Verified = true; for (int i = 0; i < 128; i++) if (key[i] != Config.CenterServerKey[i]) { Console.WriteLine("byte{0} != {1} position: {2}", key[i], Config.CenterServerKey[i], i); con.Verified = false; } if (con.Verified == false) { Logger.Write(Logger.LogTypes.오류, "Server at " + con.mSession.Socket.RemoteEndPoint.ToString() + " failed hash check."); return; } con.ServerType = serverType; con.Verified = true; switch (serverType) { case 0x01: foreach (GameServer serv in Program.mServer.gameServers.Values) if (serv.Connection == null && serv.ServerType == GameServerType.Login) { con.mGameServer = serv; serv.Connection = con; } break; case 0x02: foreach (GameServer serv in Program.mServer.gameServers.Values) if (serv.Connection == null && serv.ServerType == GameServerType.Game) { con.mGameServer = serv; serv.Connection = con; break; } break; } con.mSession.SendPacket(CenterServerPacketDefinitions.IdentifySuccess(con.mGameServer.ID)); }
public static void ChannelLoad(GameServerConnection con, PacketReader packet) { con.mSession.SendPacket(CenterServerPacketDefinitions.ChannelLoad()); }
public static void Migrate(GameServerConnection con, PacketReader packet) { int accountid = packet.ReadInt(); int cid = packet.ReadInt(); int channel = packet.ReadInt(); GameServer serv = Program.mServer.GetGameServerById(channel); if (serv == null) con.mSession.SendPacket(CenterServerPacketDefinitions.Migrate(accountid, cid, new byte[4], 0)); else con.mSession.SendPacket(CenterServerPacketDefinitions.Migrate(accountid, cid, System.Net.IPAddress.Parse(serv.PublicIP).GetAddressBytes(), serv.port)); }
void _Acceptor_OnClientConnected(Session session) { Logger.Write(Logger.LogTypes.연결, "opened connection with {0}", session.Socket.RemoteEndPoint.ToString()); session.RIV = new MapleCrypto(new byte[4], Common.Config.MajorVersion); session.SIV = new MapleCrypto(new byte[4], Common.Config.MajorVersion); PacketWriter packet = new PacketWriter(); packet.WriteShort(0); packet.WriteShort(Common.Config.MajorVersion); packet.WriteShort(1); packet.WriteByte(0x31); packet.WriteInt(0); packet.WriteInt(0); packet.WriteByte(0x08); packet.SetShort(0, packet.Length - 2); session.SendRawPacket(packet.ToArray()); GameServerConnection con = new GameServerConnection(session); _ConnectedClients.Add(con); }