Exemplo n.º 1
0
 public static void SendAssigned(WorldConnection wc)
 {
     using (var p = new InterPacket(InterHeader.Assigned))
     {
         wc.SendPacket(p);
     }
 }
Exemplo n.º 2
0
        public static void HandleServerAssignement(WorldConnection wc, InterPacket packet)
        {
            if (!packet.TryReadByte(out var wid) || !packet.TryReadString(out var name) || !packet.TryReadString(out var ip) ||
                !packet.TryReadUShort(out var 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);
            }
        }
Exemplo n.º 3
0
 public static void SendAssigned(WorldConnection wc)
 {
     using (var p = new InterPacket(InterHeader.Assigned))
     {
         wc.SendPacket(p);
     }
 }
Exemplo n.º 4
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);
            }
        }
Exemplo n.º 5
0
 public static void Banaccount(WorldConnection wc, InterPacket packet)
 {
     if (packet.TryReadInt(out var accountId))
     {
         Program.DatabaseManager.GetClient()
         .ExecuteQuery("UPDATE Accounts Set Blocked='1' WHERE ID=" + accountId + "");
     }
 }
Exemplo n.º 6
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+"");
     }
 }
Exemplo n.º 7
0
        private static void SendWorldServerIP(LoginClient pClient, WorldConnection wc, string hash)
        {
            using (var pack = new Packet(SH3Type.WorldServerIP)) {
            pack.WriteByte((byte)wc.Status);

            pack.WriteString(wc.IP, 16);
            Log.WriteLine(LogLevel.Warn, "{0} - IP", wc.IP);
            pack.WriteUShort(wc.Port);
            pack.WriteString(hash, 32);
            pack.Fill(32, 0);
            pClient.SendPacket(pack);
            }
        }
Exemplo n.º 8
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);
 }
Exemplo n.º 9
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);
 }