Пример #1
0
        private static void Handle_AccountInfoReceived(LoginConnection net, PacketReader reader)
        {
            //Set Account Info
            Account account = new Account();
            account.AccountId = reader.ReadInt32();
            account.AccessLevel = reader.ReadByte();
            account.Membership = reader.ReadByte();
            account.Name = reader.ReadDynamicString();
            //account.Password = reader.ReadDynamicString();
            account.Session = reader.ReadInt32();
            account.LastEnteredTime = reader.ReadInt64();
            account.LastIp = reader.ReadDynamicString();

            Console.WriteLine(account.Session);
            if (ClientConnection.CurrentAccounts.ContainsKey(account.Session))
            {
                //Already
                Account acc = ClientConnection.CurrentAccounts[account.Session];
                if (acc.Connection != null)
                {
                    acc.Connection.Dispose(); //Disconenct
                    Logger.Trace("Account " + acc.Name + " Was Forcibly Disconnected");
                }
                else
                {
                    ClientConnection.CurrentAccounts.Remove(account.Session);
                }
            }
            else
            {
                Logger.Trace("Account {0}: Authorized", account.Name);
                ClientConnection.CurrentAccounts.Add(account.Session, account);
            }
        }
Пример #2
0
        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));
        }
Пример #3
0
        public override void HandleReceived(byte[] data)
        {
            PacketReader reader = new PacketReader(data, 0);
            reader.Offset += 1; //Undefined Random Byte
            byte level = reader.ReadByte(); //Packet Level
            short opcode = reader.ReadLEInt16(); //Packet Opcode

            if (!DelegateList.ClientHandlers.ContainsKey(level))
            {
                Logger.Trace("Received Undefined Level {0} - Opcode 0x{1:X2}", level, opcode);
                return;
            }

            PacketHandler<ClientConnection> handler = DelegateList.ClientHandlers[level][opcode];
            if (handler != null)
                handler.OnReceive(this, reader);
            else
                Logger.Trace("Received Undefined Packet Level - {0} Op - 0x{1:X2}", level, opcode);
        }
Пример #4
0
 private static void Handle_ServerSelected(ArcheAgeConnection net, PacketReader reader)
 {
     reader.Offset += 8; //00 00 00 00 00 00 00 00  Undefined Data
     byte serverId = reader.ReadByte();
     GameServer server = GameServerController.CurrentGameServers.FirstOrDefault(n => n.Value.Id == serverId).Value;
     if (server.CurrentConnection != null)
     {
         if (GameServerController.AuthorizedAccounts.ContainsKey(net.CurrentAccount.AccountId))
         {
             net.movedToGame = true;
             GameServerController.AuthorizedAccounts.Remove(net.CurrentAccount.AccountId);
             server.CurrentConnection.SendAsync(new NET_AccountInfo(net.CurrentAccount));
             net.SendAsync(new NP_SendGameAuthorization(server, net.CurrentAccount.AccountId));
             server.CurrentAuthorized.Add(net.CurrentAccount.AccountId);
         }
     }
     else
         net.Dispose();
 }