예제 #1
0
 public static void SendAssigned(WorldConnection wc)
 {
     using (var p = new InterPacket(InterHeader.ASSIGNED))
     {
         wc.SendPacket(p);
     }
 }
예제 #2
0
        public static void HandleServerAssignement(WorldConnection wc, InterPacket packet)
        {
            byte wid;
            string name, ip;
            ushort port;
            if (!packet.TryReadByte(out wid) || !packet.TryReadString(out name) || !packet.TryReadString(out ip) || !packet.TryReadUShort(out port))
            {
                Log.WriteLine(LogLevel.Error, "Could not read World ID in inter server packet.");
                wc.Disconnect();
                return;
            }

            if (WorldManager.Instance.Worlds.ContainsKey(wid))
            {
                Log.WriteLine(LogLevel.Error, "Already loaded this world?");
                wc.Disconnect();
                return;
            }

            wc.Name = name;
            wc.ID = wid;
            wc.IP = ip;
            wc.Port = port;
            wc.IsAWorld = true;

            if (WorldManager.Instance.Worlds.TryAdd(wc.ID, wc))
            {
                Log.WriteLine(LogLevel.Info, "Assigned world {0}!", wc.ID);
                SendAssigned(wc);
            }
            else
            {
                Log.WriteLine(LogLevel.Error, "Couldn't assign world {0}..", wc.ID);
            }
        }
예제 #3
0
 public static void SendAssigned(WorldConnection wc)
 {
     using (var p = new InterPacket(InterHeader.ASSIGNED))
     {
         wc.SendPacket(p);
     }
 }
예제 #4
0
 public static void Banaccount(WorldConnection wc, InterPacket packet)
 {
     int acountid;
     if (packet.TryReadInt(out acountid))
     {
         Program.DatabaseManager.GetClient().ExecuteQuery("UPDATE Accounts Set Blocked='1' WHERE ID="+acountid+"");
     }
 }
예제 #5
0
        public static void HandleServerAssignement(WorldConnection wc, InterPacket packet)
        {
            byte   wid;
            string name, ip;
            ushort port;

            if (!packet.TryReadByte(out wid) || !packet.TryReadString(out name) || !packet.TryReadString(out ip) || !packet.TryReadUShort(out port))
            {
                Log.WriteLine(LogLevel.Error, "Could not read World ID in inter server packet.");
                wc.Disconnect();
                return;
            }

            if (WorldManager.Instance.Worlds.ContainsKey(wid))
            {
                Log.WriteLine(LogLevel.Error, "Already loaded this world?");
                wc.Disconnect();
                return;
            }

            wc.Name     = name;
            wc.ID       = wid;
            wc.IP       = ip;
            wc.Port     = port;
            wc.IsAWorld = true;

            if (WorldManager.Instance.Worlds.TryAdd(wc.ID, wc))
            {
                Log.WriteLine(LogLevel.Info, "Assigned world {0}!", wc.ID);
                SendAssigned(wc);
            }
            else
            {
                Log.WriteLine(LogLevel.Error, "Couldn't assign world {0}..", wc.ID);
            }
        }
예제 #6
0
 private void WorldAcceptor_OnIncommingConnection(Socket session)
 {
     // So something with it X:
     Log.WriteLine(LogLevel.Info, "Incomming connection from {0}", session.RemoteEndPoint);
     WorldConnection wc = new WorldConnection(session);
 }
예제 #7
0
 private void WorldAcceptor_OnIncommingConnection(Socket session)
 {
     // So something with it X:
     Log.WriteLine(LogLevel.Info, "Incomming connection from {0}", session.RemoteEndPoint);
     WorldConnection wc = new WorldConnection(session);
 }
예제 #8
0
        private static void SendWorldServerIP(LoginClient pClient, WorldConnection wc, string hash)
        {
            using (var pack = new Packet(SH3Type.WorldServerIP))
            {
                pack.WriteByte((byte)wc.Status);

                string ip = pClient.Host == "127.0.0.1" ? "127.0.0.1" : wc.IP;
                pack.WriteString(wc.IP, 16);

                pack.WriteUShort(wc.Port);
                pack.WriteString(hash, 32);
                pack.Fill(32, 0);
                pClient.SendPacket(pack);
            }
        }