Example #1
0
 public static void PlayerLoginRequestLS(IRealmClient client, RealmPacketIn packet)
 {
     if (!client.IsConnected || client.AuthAccount == null || client.Account == null)
     {
         client.Disconnect(false);
     }
     else
     {
         if (client.ActiveCharacter != null && client.ActiveCharacter.IsConnected)
         {
             return;
         }
         packet.Position += 5;
         byte num1 = packet.ReadByte();
         if (num1 < (byte)10 || num1 > (byte)12)
         {
             client.Disconnect(false);
         }
         else
         {
             uint num2 = (uint)(client.Account.AccountId + 1000000 * (int)num1);
             if (client.Account.GetCharacterRecord(num2) == null)
             {
                 client.Disconnect(false);
             }
             else
             {
                 Asda2LoginHandler.PreLoginCharacter(client, num2, true);
             }
         }
     }
 }
Example #2
0
        public static void CharacterInitOnChanelChangeRequest(IRealmClient client, RealmPacketIn packet)
        {
            if (client == null || client.ClientAddress == null)
            {
                return;
            }
            int     num     = packet.ReadInt32();
            Account account = AccountMgr.GetAccount((long)num);

            if (account == null || account.LastIPStr != client.ClientAddress.ToString())
            {
                if (account != null)
                {
                    Log.Create(Log.Types.AccountOperations, LogSourceType.Account, (uint)num)
                    .AddAttribute("operation", 1.0, "login_on_map_change_bad_ip")
                    .AddAttribute("name", 0.0, account.Name)
                    .AddAttribute("ip", 0.0, client.ClientAddress.ToString())
                    .AddAttribute("old_ip", 0.0, account.LastIPStr).Write();
                }
                client.Disconnect(false);
            }
            else
            {
                RealmAccount loggedInAccount =
                    ServerApp <WCell.RealmServer.RealmServer> .Instance.GetLoggedInAccount(account.Name);

                if (loggedInAccount == null || loggedInAccount.ActiveCharacter == null)
                {
                    client.Disconnect(false);
                }
                else
                {
                    client.IsGameServerConnection = true;
                    client.Account = loggedInAccount;
                    LogHelperEntry lgDelete = Log.Create(Log.Types.AccountOperations, LogSourceType.Account, (uint)num)
                                              .AddAttribute("operation", 1.0, "login_on_map_change").AddAttribute("name", 0.0, account.Name)
                                              .AddAttribute("chr", (double)loggedInAccount.ActiveCharacter.EntryId,
                                                            loggedInAccount.ActiveCharacter.Name)
                                              .AddAttribute("ip", 0.0, client.ClientAddress.ToString()).Write();
                    Log.Create(Log.Types.AccountOperations, LogSourceType.Character,
                               loggedInAccount.ActiveCharacter.EntityId.Low)
                    .AddAttribute("operation", 1.0, "login_on_map_change")
                    .AddAttribute("ip", 0.0, client.ClientAddress.ToString()).AddAttribute("chr",
                                                                                           (double)loggedInAccount.ActiveCharacter.EntryId, loggedInAccount.ActiveCharacter.Name)
                    .AddReference(lgDelete).Write();
                    Asda2LoginHandler.PreLoginCharacter(client, loggedInAccount.ActiveCharacter.EntityId.Low, false);
                }
            }
        }
Example #3
0
        public static void PreLoginCharacter(IRealmClient client, uint charLowId, bool isLoginStep)
        {
            try
            {
                Character chr = World.GetCharacter(charLowId);
                client.Info = new ClientInformation();
                if (chr != null)
                {
                    chr.Client.Disconnect(false);
                    client.ActiveCharacter = chr;
                    chr.Map.AddMessage((IMessage) new Message((Action)(() =>
                    {
                        if (!chr.IsInContext)
                        {
                            ServerApp <WCell.RealmServer.RealmServer> .IOQueue.AddMessage(
                                (IMessage) new Message((Action)(() =>
                                                                Asda2LoginHandler.LoginCharacter(client, charLowId, isLoginStep))));
                        }
                        else
                        {
                            if (isLoginStep)
                            {
                                chr.IsLoginServerStep = true;
                                chr.IsFirstGameConnection = true;
                            }

                            chr.ReconnectCharacter(client);
                            if (!isLoginStep)
                            {
                                return;
                            }
                            chr.Client.Disconnect(true);
                        }
                    })));
                }
                else
                {
                    Asda2LoginHandler.LoginCharacter(client, charLowId, isLoginStep);
                }
            }
            catch (Exception ex)
            {
                Asda2LoginHandler.log.Error((object)ex);
                Asda2LoginHandler.SendCharacterLoginFail((IPacketReceiver)client, LoginErrorCode.CHAR_LOGIN_FAILED);
            }
        }
Example #4
0
        public static void CharacterInitOnLoginRequest(IRealmClient client, RealmPacketIn packet)
        {
            int num1 = packet.ReadInt32();

            packet.Position += 2;
            short num2 = packet.ReadInt16();

            if (num2 < (short)10 || num2 > (short)12)
            {
                client.TcpSocket.Close();
            }
            else
            {
                packet.Position += 4;
                uint    num3    = (uint)(num1 + (int)num2 * 1000000);
                string  str     = client.ClientAddress.ToString();
                Account account = AccountMgr.GetAccount((long)num1);
                if (account == null || account.LastIPStr != str)
                {
                    if (account != null)
                    {
                        Log.Create(Log.Types.AccountOperations, LogSourceType.Account, (uint)num1)
                        .AddAttribute("operation", 1.0, "login_game_server_bad_ip")
                        .AddAttribute("name", 0.0, account.Name)
                        .AddAttribute("ip", 0.0, client.ClientAddress.ToString())
                        .AddAttribute("old_ip", 0.0, account.LastIPStr).Write();
                    }
                    client.Disconnect(false);
                }
                else
                {
                    RealmAccount loggedInAccount =
                        ServerApp <WCell.RealmServer.RealmServer> .Instance.GetLoggedInAccount(account.Name);

                    if (loggedInAccount == null || loggedInAccount.ActiveCharacter == null)
                    {
                        Log.Create(Log.Types.AccountOperations, LogSourceType.Account, (uint)num1)
                        .AddAttribute("operation", 1.0, "login_game_server_no_character_selected")
                        .AddAttribute("name", 0.0, account.Name)
                        .AddAttribute("ip", 0.0, client.ClientAddress.ToString())
                        .AddAttribute("old_ip", 0.0, account.LastIPStr).Write();
                        client.Disconnect(false);
                    }
                    else
                    {
                        client.IsGameServerConnection = true;
                        client.Account = loggedInAccount;
                        Log.Create(Log.Types.AccountOperations, LogSourceType.Account, (uint)num1)
                        .AddAttribute("operation", 1.0, "login_game_server").AddAttribute("name", 0.0, account.Name)
                        .AddAttribute("ip", 0.0, client.ClientAddress.ToString())
                        .AddAttribute("character", (double)client.Account.ActiveCharacter.EntryId,
                                      client.Account.ActiveCharacter.Name).AddAttribute("chrLowId", (double)num3, "")
                        .Write();
                        Log.Create(Log.Types.AccountOperations, LogSourceType.Character, num3)
                        .AddAttribute("operation", 1.0, "login_game_server")
                        .AddAttribute("ip", 0.0, client.ClientAddress.ToString()).Write();
                        Asda2LoginHandler.PreLoginCharacter(client, num3, false);
                    }
                }
            }
        }