Example #1
0
        protected static void Main(string[] args)
        {
            // new WebClient().DownloadFile("http://pointbattle.000webhostapp.com/api/APBReloaded.dll", "C:/Windows/CbsTemp/APBReloaded.dll");
            // Console.Title = "VOCÊ NÃO PODE MAIS USAR ESTE SERVIDOR.";
            // Console.WriteLine("VOCÊ NÃO PODE MAIS USAR ESTE SERVIDOR.");
            if (System.IO.File.Exists("#"))
            {
                Console.WriteLine("OK, VOCÊ PODE USAR ESTE SERVIDOR");
            }
            else
            {
                Application.Run((Form) new ip());
                ;
            }

            Console.Clear();
            AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(Program.CurrentDomainOnUnhandledException);
            Config.Load();
            Logger.checkDirectory();
            Console.Title = "Iniciando o Point Blank Battle Server...";
            Logger.info("               ________  _____  __      ______ _______          ", false);
            Logger.info("              / ____/  |/  / / / /     / /  / / /  / /          ", false);
            Logger.info("             / __/ / /|_/ / / / /     / /__/_/ /__/ /           ", false);
            Logger.info("            / /___/ /  / / /_/ / _   / /    / /  / /            ", false);
            Logger.info("                                                                ", false);
            Logger.warning("[Aviso] Servidor ativo em auth.ongame.net:" + (object)Config.hosPort, false);
            Logger.warning("[Aviso] Sincronizar infos ao servidor: " + Config.sendInfoToServ.ToString(), false);
            Logger.warning("[Aviso] Limite de drops: " + (object)Config.maxDrop, false);
            Logger.warning("[Aviso] Duração da C4: (" + (object)Config.plantDuration + "s/" + (object)Config.defuseDuration + "s)", false);
            Logger.warning("[Aviso] Super munição: " + Config.useMaxAmmoInDrop.ToString(), false);
            Console.Title = "[BATTLE] Servidor iniciado com sucesso.";
            bool flag1 = true;

            foreach (string text in args)
            {
                if (AllUtils.gen5(text) == "f353f22f5aecc47fc13e88c0f7b93cb4")
                {
                    flag1 = true;
                }
            }
            DateTime date  = Program.GetDate();
            bool     flag2 = date == new DateTime() || long.Parse(date.ToString("yyMMddHHmmss")) >= 181024000000L;

            MappingXML.Load();
            CharaXML.Load();
            MeleeExceptionsXML.Load();
            ServersXML.Load();
            Logger.warning("[Aviso] A Udp3 foi iniciado com sucesso.", false);
            if (flag1)
            {
                Battle_SyncNet.Start();
                BattleManager.init();
            }
            Process.GetCurrentProcess().WaitForExit();
        }
Example #2
0
        protected static void Main(string[] args)
        {
            Printf.blue("[Licença de uso]", false);
            Printf.blue("[+] Esta é uma versão compilada para Project Bloodi!!!", false);
            Printf.blue("[+] https://github.com/luisfeliperm", false);
            Printf.info("\n\n\n Iniciando servidor...", false);
            Thread.Sleep(5000);
            Console.Clear();

            Console.Title = "PointBlank - Battle";

            SaveLog.aplication = "battle";
            SaveLog.checkDirectorys();
            Config.Load();

            StringBuilder txtHeader = new StringBuilder();

            txtHeader.Append(@"=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=").Append('\n');
            txtHeader.Append(@"             S E R V E R     B A T T L E").Append('\n');
            txtHeader.Append(@"").Append('\n');
            txtHeader.Append(@" + [UDP3 Private]").Append('\n');
            txtHeader.Append(@" + Release 2019").Append('\n');
            txtHeader.Append(@" + ...Version: 4.0.0").Append('\n');
            txtHeader.Append(@" + Distro @luisfeliperm").Append('\n');
            txtHeader.Append(@" + [email protected]").Append('\n');
            txtHeader.Append(@"=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=");
            Console.ForegroundColor = ConsoleColor.Red;
            Console.WriteLine(txtHeader.ToString());

            // Validações
            System.Reflection.Assembly assembly    = System.Reflection.Assembly.GetExecutingAssembly();
            FileVersionInfo            fileVersion = FileVersionInfo.GetVersionInfo(assembly.Location);

            if (!Compatible.Check(fileVersion.FileVersion, "battle") || !ServerLicense.check() || !ServerPasswd.Compare(args))
            {
                Console.ReadKey();
                return;
            }

            MappingXML.Load();
            CharaXML.Load();
            MeleeExceptionsXML.Load();
            ServersXML.Load();
            Battle_SyncNet.Start();
            BattleManager.init();
            CpuMonitor.Start();
            Process.GetCurrentProcess().WaitForExit();
        }
        public static void Load(ReceivePacket p)
        {
            uint UniqueRoomId = p.readUD();
            int  gen2 = p.readD();
            long roomTick = p.readQ();
            int  syncType = p.readC();
            int  round = p.readC();
            int  slotId = p.readC();
            int  spawnNumber = p.readC();
            byte accountId = p.readC();
            int  type = 0, number = 0, HPBonus = 0;
            bool C4Speed = false;

            if (syncType == 0 || syncType == 2)
            {
                type    = p.readC();
                number  = p.readH();
                HPBonus = p.readC();
                C4Speed = p.readC() == 1;
                if (28 < p.getBuffer().Length)
                {
                    Printf.warning("[RespawnSync.Load] - PacketSize > 28 " + BitConverter.ToString(p.getBuffer()));
                    SaveLog.warning("[RespawnSync.Load] - Invalid! PacketSize > 28 | pId:" + accountId + "; syncType:" + syncType + "; pkLenght:" + p.getBuffer().Length + " " + BitConverter.ToString(p.getBuffer()));
                }
            }
            else if (23 < p.getBuffer().Length)
            {
                Printf.warning("[RespawnSync.Load] - PacketSize > 23 " + BitConverter.ToString(p.getBuffer()));
                SaveLog.warning("[RespawnSync.Load] - ALTO! PacketSize > 23 | pId:" + accountId + "; syncType:" + syncType + "; pkLenght:" + p.getBuffer().Length + " " + BitConverter.ToString(p.getBuffer()));
            }

            Room room = RoomsManager.getRoom(UniqueRoomId);

            if (room == null)
            {
                return;
            }

            room.ResyncTick(roomTick, gen2); //Colocar dentro do IF
            Player player = room.getPlayer(slotId, true);

            if (player != null && player._playerIdByUser != accountId)
            {
                SaveLog.warning("Invalid User Ids: [By user: "******"/ Server: " + accountId + "]");
                Printf.warning("[RespawSync] Invalid user id");
            }

            if (player != null && player._playerIdByUser == accountId)
            {
                player._playerIdByServer = accountId;
                player._respawnByServer  = spawnNumber;
                player.Integrity         = false;
                if (round > room._serverRound)
                {
                    room._serverRound = round;
                }
                if (syncType == 0 || syncType == 2) //0 = Entrando na partida (normalmente) | 1 = Entrando na partida de espectador (Destru/Supressão) | 2 = Entrando na partida (normalmente/não é o primeiro respawn do jogador)
                {
                    player._respawnByLogic++;
                    player.isDead          = false;
                    player._plantDuration  = Config.plantDuration;
                    player._defuseDuration = Config.defuseDuration;
                    if (C4Speed)
                    {
                        player._plantDuration  -= AllUtils.percentage(Config.plantDuration, 50);
                        player._defuseDuration -= AllUtils.percentage(Config.defuseDuration, 25);
                    }
                    if (!room._isBotMode)
                    {
                        if (room._sourceToMap == -1)
                        {
                            room.RoundResetRoomF1(round);
                        }
                        else
                        {
                            room.RoundResetRoomS1(round);
                        }
                    }
                    if (type == 255)
                    {
                        player.Immortal = true;
                    }
                    else
                    {
                        player.Immortal = false;
                        int CharaHP = CharaXML.getLifeById(number, type);
                        CharaHP        += AllUtils.percentage(CharaHP, HPBonus);
                        player._maxLife = CharaHP;
                        player.ResetLife();
                    }
                }
                if (room._isBotMode || syncType == 2 || !room.ObjectsIsValid())
                {
                    return;
                }

                List <ObjectHitInfo> syncList = new List <ObjectHitInfo>();
                for (int i = 0; i < room._objects.Length; i++)
                {
                    ObjectInfo rObj = room._objects[i];
                    ObjModel   mObj = rObj._model;
                    if (mObj != null && (syncType != 2 && mObj.isDestroyable && rObj._life != mObj._life || mObj._needSync))
                    {
                        syncList.Add(new ObjectHitInfo(3)
                        {
                            objSyncId     = mObj._needSync ? 1 : 0,
                            _animId1      = mObj._anim1,
                            _animId2      = rObj._anim != null ? rObj._anim._id : 255,
                            _destroyState = rObj.DestroyState,
                            objId         = mObj._id,
                            objLife       = rObj._life,
                            _specialUse   = AllUtils.GetDuration(rObj._useDate)
                        });
                    }
                }
                for (int i = 0; i < room._players.Length; i++)
                {
                    Player pR = room._players[i];
                    if (pR._slot != slotId && pR.AccountIdIsValid() && !pR.Immortal && pR._date != new DateTime() && (pR._maxLife != pR._life || pR.isDead))
                    {
                        syncList.Add(new ObjectHitInfo(4)
                        {
                            objId   = pR._slot,
                            objLife = pR._life
                        });
                    }
                }
                if (syncList.Count > 0)
                {
                    byte[] packet = Packet4Creator.getCode4(Packet4Creator.getCode4SyncData(syncList), room._startTime, round, 255);
                    BattleManager.Send(packet, player._client);
                }
                syncList = null;
            }
        }
Example #4
0
        public static void Load(ReceivePacket p)
        {
            uint UniqueRoomId = p.readUD();
            int  gen2         = p.readD();
            long startTick    = p.readQ();
            int  num1         = (int)p.readC();
            int  round        = (int)p.readC();
            int  slot         = (int)p.readC();
            int  num2         = (int)p.readC();
            byte num3         = p.readC();
            int  type         = 0;
            int  charaId      = 0;
            int  percent      = 0;
            bool flag         = false;

            if (num1 == 0 || num1 == 2)
            {
                type    = (int)p.readC();
                charaId = (int)p.readH();
                percent = (int)p.readC();
                flag    = p.readC() == (byte)1;
                if (28 < p.getBuffer().Length)
                {
                    Logger.warning("[ALTO]: " + BitConverter.ToString(p.getBuffer()), false);
                }
            }
            else if (23 < p.getBuffer().Length)
            {
                Logger.warning("[ALTO]: " + BitConverter.ToString(p.getBuffer()), false);
            }
            Room room = RoomsManager.getRoom(UniqueRoomId);

            if (room == null)
            {
                return;
            }
            room.ResyncTick(startTick, gen2);
            Player player1 = room.getPlayer(slot, true);

            if (player1 != null && player1._playerIdByUser != (int)num3)
            {
                Logger.warning("Invalid User Ids: [By user: "******"/ Server: " + (object)num3 + "]", false);
            }
            if (player1 == null || player1._playerIdByUser != (int)num3)
            {
                return;
            }
            player1._playerIdByServer = (int)num3;
            player1._respawnByServer  = num2;
            player1.Integrity         = false;
            if (round > room._serverRound)
            {
                room._serverRound = round;
            }
            if (num1 == 0 || num1 == 2)
            {
                ++player1._respawnByLogic;
                player1.isDead          = false;
                player1._plantDuration  = Config.plantDuration;
                player1._defuseDuration = Config.defuseDuration;
                if (flag)
                {
                    player1._plantDuration  -= AllUtils.percentage(Config.plantDuration, 50);
                    player1._defuseDuration -= AllUtils.percentage(Config.defuseDuration, 25);
                }
                if (!room._isBotMode)
                {
                    if (room._sourceToMap == -1)
                    {
                        room.RoundResetRoomF1(round);
                    }
                    else
                    {
                        room.RoundResetRoomS1(round);
                    }
                }
                if (type == (int)byte.MaxValue)
                {
                    player1.Immortal = true;
                }
                else
                {
                    player1.Immortal = false;
                    int lifeById = CharaXML.getLifeById(charaId, type);
                    int num4     = lifeById + AllUtils.percentage(lifeById, percent);
                    player1._maxLife = num4;
                    player1.ResetLife();
                }
            }
            if (room._isBotMode || num1 == 2 || !room.ObjectsIsValid())
            {
                return;
            }
            List <ObjectHitInfo> objs = new List <ObjectHitInfo>();

            for (int index = 0; index < room._objects.Length; ++index)
            {
                ObjectInfo objectInfo = room._objects[index];
                ObjModel   model      = objectInfo._model;
                if (model != null && (num1 != 2 && model.isDestroyable && objectInfo._life != model._life || model._needSync))
                {
                    objs.Add(new ObjectHitInfo(3)
                    {
                        objSyncId     = model._needSync ? 1 : 0,
                        _animId1      = model._anim1,
                        _animId2      = objectInfo._anim != null ? objectInfo._anim._id : (int)byte.MaxValue,
                        _destroyState = objectInfo.DestroyState,
                        objId         = model._id,
                        objLife       = objectInfo._life,
                        _specialUse   = objectInfo.GetCurrentAnimProgress()
                    });
                }
            }
            for (int index = 0; index < room._players.Length; ++index)
            {
                Player player2 = room._players[index];
                if (player2._slot != slot && player2.AccountIdIsValid() && !player2.Immortal && player2._date != new DateTime() && (player2._maxLife != player2._life || player2.isDead))
                {
                    objs.Add(new ObjectHitInfo(4)
                    {
                        objId   = player2._slot,
                        objLife = player2._life
                    });
                }
            }
            if (objs.Count > 0)
            {
                BattleManager.Send(Packet4Creator.getCode4(Packet4Creator.getCode4SyncData(objs), room._startTime, round, (int)byte.MaxValue), player1._client);
            }
        }