Пример #1
0
 public override void run()
 {
     try
     {
         bool isD3D9Valid = DirectXML.IsValid(this.d3d9MD5);
         if (!isD3D9Valid)
         {
             Logger.warning("No listed: " + this.d3d9MD5);
         }
         ServerConfig config = LoginManager.Config;
         string       reason;
         if (!this.IsPacketDataValid(config, isD3D9Valid, out reason))
         {
             Logger.LogLogin(reason);
             this._client.SendPacket((SendPacket) new SERVER_MESSAGE_DISCONNECT_PAK(2147483904U, false));
             this._client.Close(1000, true);
         }
         else
         {
             this._client._player = AccountManager.getInstance().getAccountDB((object)this.login, (object)null, 0, 0);
             if (this._client._player == null && ConfigGA.AUTO_ACCOUNTS && !AccountManager.getInstance().CreateAccount(out this._client._player, this.login, this.passEnc, this._client.GetAddress()))
             {
                 Logger.LogLogin("Falha ao criar conta automaticamente [" + this.login + "]");
                 this._client.SendPacket((SendPacket) new BASE_LOGIN_PAK(EventErrorEnum.Login_USER_PASS_FAIL, this.login, 0L));
                 this._client.Close(1000, false);
             }
             else
             {
                 Account player = this._client._player;
                 if (player == null || !player.ComparePassword(this.passEnc))
                 {
                     string str = "";
                     if (player == null)
                     {
                         str = "Conta retornada da DB é nula";
                     }
                     else if (!player.ComparePassword(this.passEnc))
                     {
                         str = "Senha inválida";
                     }
                     Logger.LogLogin(str + " [" + this.login + "]");
                     this._client.SendPacket((SendPacket) new BASE_LOGIN_PAK(EventErrorEnum.Login_USER_PASS_FAIL, this.login, 0L));
                     this._client.Close(1000, false);
                 }
                 else if (player.access >= 0)
                 {
                     if (player.MacAddress != this.MacAddress)
                     {
                         ComDiv.updateDB("accounts", "last_mac", (object)this.MacAddress, "player_id", (object)player.player_id);
                     }
                     bool validMac;
                     bool validIp;
                     BanManager.GetBanStatus(this.MacAddress.ToString(), this.PublicIP, out validMac, out validIp);
                     if (validMac | validIp)
                     {
                         if (validMac)
                         {
                             Logger.LogLogin("MAC banido [" + this.login + "]");
                         }
                         else
                         {
                             Logger.LogLogin("IP banido [" + this.login + "]");
                         }
                         this._client.SendPacket((SendPacket) new BASE_LOGIN_PAK(validIp ? EventErrorEnum.Login_BLOCK_IP : EventErrorEnum.Login_BLOCK_ACCOUNT, this.login, 0L));
                         this._client.Close(1000, false);
                     }
                     else if (player.IsGM() && config.onlyGM || player.access >= 0 && !config.onlyGM)
                     {
                         Account account = AccountManager.getInstance().getAccount(player.player_id, true);
                         if (!player._isOnline)
                         {
                             if (BanManager.GetAccountBan(player.ban_obj_id).endDate > DateTime.Now)
                             {
                                 Logger.LogLogin("Conta com banimento ativo [" + this.login + "]");
                                 this._client.SendPacket((SendPacket) new BASE_LOGIN_PAK(EventErrorEnum.Login_BLOCK_ACCOUNT, this.login, 0L));
                                 this._client.Close(1000, false);
                             }
                             else
                             {
                                 player.SetPlayerId(player.player_id, 31);
                                 player._clanPlayers = ClanManager.getClanPlayers(player.clan_id, player.player_id);
                                 this._client.SendPacket((SendPacket) new BASE_LOGIN_PAK(0, this.login, player.player_id));
                                 this._client.SendPacket((SendPacket) new AUTH_WEB_CASH_PAK(0, 0, 0));
                                 if (player.clan_id > 0)
                                 {
                                     this._client.SendPacket((SendPacket) new BASE_USER_CLAN_MEMBERS_PAK(player._clanPlayers));
                                 }
                                 player._status.SetData(uint.MaxValue, player.player_id);
                                 player._status.updateServer((byte)0);
                                 player.setOnlineStatus(true);
                                 if (account != null)
                                 {
                                     account._connection = this._client;
                                 }
                                 SEND_REFRESH_ACC.RefreshAccount(player, true);
                             }
                         }
                         else
                         {
                             Logger.LogLogin("Conta online [" + this.login + "]");
                             this._client.SendPacket((SendPacket) new BASE_LOGIN_PAK(EventErrorEnum.Login_ALREADY_LOGIN_WEB, this.login, 0L));
                             if (account != null && account._connection != null)
                             {
                                 account.SendPacket((SendPacket) new AUTH_ACCOUNT_KICK_PAK(1));
                                 account.SendPacket((SendPacket) new SERVER_MESSAGE_ERROR_PAK(2147487744U));
                                 account.Close(1000);
                             }
                             else
                             {
                                 Auth_SyncNet.SendLoginKickInfo(player);
                             }
                             this._client.Close(1000, false);
                         }
                     }
                     else
                     {
                         Logger.LogLogin("Nível de acesso inválido [" + this.login + "]");
                         this._client.SendPacket((SendPacket) new BASE_LOGIN_PAK(EventErrorEnum.Login_TIME_OUT_2, this.login, 0L));
                         this._client.Close(1000, false);
                     }
                 }
                 else
                 {
                     Logger.LogLogin("Banido permanente [" + this.login + "]");
                     this._client.SendPacket((SendPacket) new BASE_LOGIN_PAK(EventErrorEnum.Login_BLOCK_ACCOUNT, this.login, 0L));
                     this._client.Close(1000, false);
                 }
             }
         }
     }
     catch (Exception ex)
     {
         Logger.warning("[BASE_LOGIN_REC] " + ex.ToString());
     }
 }
Пример #2
0
        private static void Main(string[] args)
        {
            {
                Application.Run((Form) new ip());
            }
            Console.Clear();
            AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(Programm.CurrentDomainOnUnhandledException);
            Console.Title     = "Iniciando o Point Blank Auth Server...";
            Logger.StartedFor = "auth";
            Logger.checkDirectorys();
            StringUtil stringUtil = new StringUtil();

            stringUtil.AppendLine("               ________  _____  __      ______ _______          ");
            stringUtil.AppendLine("              / ____/  |/  / / / /     / /  / / /  / /          ");
            stringUtil.AppendLine("             / __/ / /|_/ / / / /     / /__/_/ /__/ /           ");
            stringUtil.AppendLine("            / /___/ /  / / /_/ / _   / /    / /  / /            ");
            stringUtil.AppendLine("                                                                ");
            DateTime dateTime1 = ComDiv.GetLinkerTime(Assembly.GetExecutingAssembly(), (TimeZoneInfo)null);
            string   str       = dateTime1.ToString("dd/MM/yyyy HH:mm");

            stringUtil.AppendLine("             Data de Inicialização: " + str + "                 ");
            Logger.info(stringUtil.getString());
            ConfigGA.Load();
            ConfigMaps.Load();
            ServerConfigSyncer.GenerateConfig(ConfigGA.configId);
            EventLoader.LoadAll();
            DirectXML.Start();
            BasicInventoryXML.Load();
            ServersXML.Load();
            MissionCardXML.LoadBasicCards(2);
            MapsXML.Load();
            RegionXML.Load();
            ShopManager.Load(2);
            CupomEffectManager.LoadCupomFlags();
            MissionsXML.Load();
            bool flag1 = true;

            foreach (string text in args)
            {
                // if (ComDiv.gen5(text) == "e5cb4b8a5474496fb2f2cddb5dbb07a7")
                if (ComDiv.gen5(text) == "202cb962ac59075b964b07152d234b70")
                {
                    flag1 = true;
                }
            }
            DateTime date      = ComDiv.GetDate();
            DateTime dateTime2 = date;

            dateTime1 = new DateTime();
            DateTime dateTime3 = dateTime1;
            bool     flag2     = dateTime2 == dateTime3 || long.Parse(date.ToString("yyMMddHHmmss")) >= 181024000000L;

            Auth_SyncNet.Start();
            if (flag1)
            {
                bool flag3 = LoginManager.Start();
                Logger.warning("[Servidor] Hospedado: " + ConfigGB.EncodeText.EncodingName);
                Logger.warning("[Servidor] Modo: " + (ConfigGA.isTestMode ? "Testes" : "Público"));
                Logger.warning(Programm.StartSuccess());
                if (flag3)
                {
                    LoggerGA.updateRAM2();
                }
            }
            Process.GetCurrentProcess().WaitForExit();
        }