예제 #1
0
        private static bool HandleMatchUp(Entities.GameClient Player, Entities.GameClient Opponent)
        {
            if (Player.ArenaMatch != null)
            {
                return(true);
            }
            if (Opponent == null)
            {
                return(false);
            }

            ArenaMatch match = ArenaMatch.CreateMatch(Player, Opponent);

            Player.ArenaMatch.BeginTimeOutQueue();

            Player.Arena.Status = Enums.ArenaStatus.WaitingInactive;
            using (var wait = Player.Arena.Build())
                Player.Send(wait);

            Opponent.Arena.Status = Enums.ArenaStatus.WaitingInactive;
            using (var wait = Opponent.Arena.Build())
                Opponent.Send(wait);

            Player.ArenaMatch   = match;
            Opponent.ArenaMatch = match;

            using (var request = new Packets.ArenaActionPacket())
            {
                request.Name        = Player.Name;
                request.Level       = (uint)Player.Level;
                request.ArenaPoints = Player.Arena.ArenaPoints;
                request.Class       = (uint)Player.Class;
                request.DialogID    = Packets.ArenaActionPacket.StartCountDown;
                request.Rank        = Player.Arena.ArenaRanking;
                request.EntityUID   = Player.EntityUID;
                request.Unknown40   = 1;
                Player.Send(request);
            }
            using (var request = new Packets.ArenaActionPacket())
            {
                request.Name        = Opponent.Name;
                request.Level       = (uint)Opponent.Level;
                request.ArenaPoints = Opponent.Arena.ArenaPoints;
                request.Class       = (uint)Opponent.Class;
                request.DialogID    = Packets.ArenaActionPacket.StartCountDown;
                request.Rank        = Opponent.Arena.ArenaRanking;
                request.EntityUID   = Opponent.EntityUID;
                request.Unknown40   = 1;
                Opponent.Send(request);
            }

            return(true);
        }
예제 #2
0
        public static void OpenBattle(Entities.GameClient Opponent, int PetID, int BattleID)
        {
            //if (!Trainers.ContainsKey(BattleID))
            //	return;
            //Entities.Trainer Trainer = Trainers[BattleID];

            ArenaMatch Match = ArenaMatch.CreateMatch(Opponent, null);

            Match.FightingMatch      = false;
            Match.Started            = true;
            Match.Player1            = Opponent;
            Opponent.Battle          = Match;
            Opponent.PetBattle       = new PetBattle();
            Opponent.PetBattle.Match = Match;

            Entities.BattlePet pet1 = new ProjectX_V3_Game.Entities.BattlePet();
            pet1.EntityUID          = Core.UIDGenerators.GetMonsterUID();
            pet1.Mesh               = 332;
            pet1.Name               = "Zapdos";
            pet1.MaxHP              = 1000;
            pet1.HP                 = 1000;
            Opponent.PetBattle.Pet1 = pet1;

            Entities.BattlePet pet2 = new ProjectX_V3_Game.Entities.BattlePet();
            pet2.EntityUID          = Core.UIDGenerators.GetMonsterUID();
            pet2.Mesh               = 332;
            pet2.Name               = "Articuno";
            pet2.MaxHP              = 1000;
            pet2.HP                 = 1000;
            Opponent.PetBattle.Pet2 = pet2;

            /*Opponent.PetBattle.Pet1 = Opponent.Pets[PetID];
             * Opponent.PetBattle.Pet2 = Trainer.Pet;*/
            // JailGuard = 150001

            Entities.NPC Trainer = Core.Kernel.NPCs[150001];

            Match.ArenaMap = Core.Kernel.Maps[700].CreateDynamic(out Match.DynamicID);
            Opponent.TeleportDynamic(Match.DynamicID, 51, 58);

            Match.SendMatch();
            Match.SendCountDown(Trainer.Name, Trainer.Level, 15, 0, Trainer.EntityUID, Opponent);
            Match.SendPacket(pet1.EntityUID, pet1.Name, pet1.HP, pet2.EntityUID, pet2.Name, pet2.HP);

            Trainer.X = 51;
            Trainer.Y = 44;

            Match.ArenaMap.EnterMap(Trainer);

            Opponent.PetBattle.ShowOpponent();
            Opponent.PetBattle.SendDialog();
        }