Ejemplo n.º 1
0
        public WarsongGulchProfile(WowInterface wowInterface, BattlegroundEngine battlegroundEngine)
        {
            WowInterface       = wowInterface;
            IsAlliance         = wowInterface.ObjectManager.Player.IsAlliance();
            BattlegroundEngine = battlegroundEngine;
            IsMeFlagCarrier    = false;

            if (IsAlliance)
            {
                WsgDataset = new AllianceWsgDataset();
            }
            else
            {
                WsgDataset = new HordeWsgDataset();
            }

            States = new Dictionary <BattlegroundState, BasicBattlegroundState>()
            {
                { BattlegroundState.WaitingForStart, new WaitingForStartBgState(battlegroundEngine) },
                { BattlegroundState.MoveToEnemyBase, new MoveToEnemyBaseBgState(battlegroundEngine, WowInterface, WsgDataset.EnemyFlagPosition) },
                { BattlegroundState.MoveToOwnBase, new MoveToOwnBaseBgState(battlegroundEngine, WowInterface, WsgDataset.OwnFlagPosition) },
                { BattlegroundState.MoveToEnemyFlagCarrier, new MoveToEnemyFlagCarrierBgState(battlegroundEngine, WowInterface) },
                { BattlegroundState.AssistOwnFlagCarrier, new AssistOwnFlagCarrierBgState(battlegroundEngine, WowInterface) },
                { BattlegroundState.DefendMyself, new DefendMyselfBgState(battlegroundEngine, WowInterface) },
                { BattlegroundState.PickupEnemyFlag, new PickupEnemyFlagBgState(battlegroundEngine, WowInterface) },
                { BattlegroundState.PickupOwnFlag, new PickupOwnFlagBgState(battlegroundEngine, WowInterface) },
                { BattlegroundState.PickupBuff, new PickupBuffBgState(battlegroundEngine) },
                { BattlegroundState.ExitBattleground, new ExitBattlegroundBgState(battlegroundEngine) }
            };
        }
Ejemplo n.º 2
0
 public override void Execute()
 {
     if (BattlegroundEngine.BattlegroundProfile.BattlegroundType == BattlegroundType.CaptureTheFlag)
     {
         IEnumerable <WowGameobject> flags = BattlegroundEngine.GetBattlegroundFlags(false);
         if (flags.Count() > 0)
         {
             if (!((ICtfBattlegroundProfile)BattlegroundEngine.BattlegroundProfile).IsMeFlagCarrier)
             {
                 WowGameobject flagObject = flags.First();
                 if (flagObject != null && flagObject.Position.GetDistance(WowInterface.ObjectManager.Player.Position) < 8)
                 {
                     WowInterface.HookManager.WowObjectOnRightClick(flagObject);
                 }
                 else
                 {
                     WowInterface.MovementEngine.SetState(MovementEngineState.Moving, flagObject.Position);
                     WowInterface.MovementEngine.Execute();
                 }
             }
             else
             {
                 BattlegroundEngine.SetState(BattlegroundState.MoveToOwnBase);
             }
         }
         else
         {
             BattlegroundEngine.SetState(BattlegroundState.DefendMyself);
         }
     }
 }
Ejemplo n.º 3
0
        public override void Execute()
        {
            if (BattlegroundEngine.BattlegroundProfile.BattlegroundType == BattlegroundType.CaptureTheFlag)
            {
                if (BattlegroundEngine.BattlegroundProfile.HanldeInterruptStates())
                {
                    return;
                }

                if (BattlegroundEngine.AttackNearEnemies())
                {
                    BattlegroundEngine.ForceCombat = true;
                    return;
                }

                if (WowInterface.ObjectManager.Player.Position.GetDistance(OwnBasePosition) > 5)
                {
                    WowInterface.MovementEngine.SetState(MovementEngineState.Moving, OwnBasePosition);
                    WowInterface.MovementEngine.Execute();
                    return;
                }
                else
                {
                    BattlegroundEngine.SetState(BattlegroundState.DefendMyself);
                    return;
                }
            }
        }
Ejemplo n.º 4
0
 public override void Execute()
 {
     // TODO: recognize wether the BG is running or not
     // Horde door id 6391
     if (true)
     {
         BattlegroundEngine.SetState(BattlegroundState.DefendMyself);
     }
 }
Ejemplo n.º 5
0
        private void DoCtfLogic(int enemyCount, int friendCount)
        {
            bool isMeFlagCarrier = ((ICtfBattlegroundProfile)BattlegroundEngine.BattlegroundProfile).IsMeFlagCarrier;

            // CTF flag priority
            if (BattlegroundEngine.BattlegroundProfile.BattlegroundType == BattlegroundType.CaptureTheFlag)
            {
                if (BattlegroundEngine.BattlegroundProfile.HanldeInterruptStates())
                {
                    return;
                }

                if (enemyCount > friendCount + 2 || isMeFlagCarrier)
                {
                    // flee to base
                    BattlegroundEngine.SetState(BattlegroundState.MoveToOwnBase);
                }
                else if (enemyCount == 0)
                {
                    WowPlayer enemyFlagCarrier = ((ICtfBattlegroundProfile)BattlegroundEngine.BattlegroundProfile).EnemyFlagCarrierPlayer;
                    WowPlayer ownFlagCarrier   = ((ICtfBattlegroundProfile)BattlegroundEngine.BattlegroundProfile).OwnFlagCarrierPlayer;

                    if (enemyFlagCarrier != null && ownFlagCarrier != null)
                    {
                        // move to enemy flag carrier
                        BattlegroundEngine.SetState(BattlegroundState.MoveToEnemyFlagCarrier);
                    }
                    else if (enemyFlagCarrier != null && ownFlagCarrier == null)
                    {
                        // get the enemies flag
                        BattlegroundEngine.SetState(BattlegroundState.MoveToEnemyBase);
                    }
                    else
                    {
                        if (ownFlagCarrier != null)
                        {
                            // help our flag carrier to get the flag to the base
                            BattlegroundEngine.SetState(BattlegroundState.AssistOwnFlagCarrier);
                        }
                        else
                        {
                            // try to get the enemies flag
                            BattlegroundEngine.SetState(BattlegroundState.MoveToEnemyBase);
                        }
                        return;
                    }
                }
            }
        }
        public override void Execute()
        {
            if (BattlegroundEngine.BattlegroundProfile.BattlegroundType == BattlegroundType.CaptureTheFlag)
            {
                if (BattlegroundEngine.BattlegroundProfile.HanldeInterruptStates())
                {
                    return;
                }

                if (((ICtfBattlegroundProfile)BattlegroundEngine.BattlegroundProfile).OwnFlagCarrierPlayer != null)
                {
                    ulong     ownFlagCarrierGuid        = ((ICtfBattlegroundProfile)BattlegroundEngine.BattlegroundProfile).OwnFlagCarrierPlayer.Guid;
                    WowPlayer ownFlagCarrier            = WowInterface.ObjectManager.GetWowObjectByGuid <WowPlayer>(ownFlagCarrierGuid);
                    IEnumerable <WowPlayer> nearEnemies = WowInterface.ObjectManager.GetNearEnemies <WowPlayer>(ownFlagCarrier.Position, 25);

                    if (WowInterface.ObjectManager.Player.Position.GetDistance(ownFlagCarrier.Position) > 10)
                    {
                        WowInterface.MovementEngine.SetState(MovementEngineState.Moving, ownFlagCarrier.Position);
                        WowInterface.MovementEngine.Execute();
                    }
                    else
                    {
                        WowPlayer target = nearEnemies.FirstOrDefault();
                        if (target != null)
                        {
                            WowInterface.HookManager.TargetGuid(target.Guid);
                            WowInterface.HookManager.StartAutoAttack();
                            WowInterface.HookManager.FacePosition(WowInterface.ObjectManager.Player, target.Position);
                            BattlegroundEngine.ForceCombat = true;
                        }
                    }
                }
                else
                {
                    // there is no friendly flag carrier
                    BattlegroundEngine.SetState(BattlegroundState.DefendMyself);
                    return;
                }
            }
        }
        public override void Execute()
        {
            if (BattlegroundEngine.BattlegroundProfile.BattlegroundType == BattlegroundType.CaptureTheFlag)
            {
                if (BattlegroundEngine.BattlegroundProfile.HanldeInterruptStates())
                {
                    return;
                }

                if (((ICtfBattlegroundProfile)BattlegroundEngine.BattlegroundProfile).EnemyFlagCarrierPlayer != null)
                {
                    ulong     enemyFlagCarrierGuid = ((ICtfBattlegroundProfile)BattlegroundEngine.BattlegroundProfile).EnemyFlagCarrierPlayer.Guid;
                    WowPlayer enemyFlagCarrier     = WowInterface.ObjectManager.GetWowObjectByGuid <WowPlayer>(enemyFlagCarrierGuid);

                    if (WowInterface.ObjectManager.Player.Position.GetDistance(enemyFlagCarrier.Position) > 10)
                    {
                        WowInterface.MovementEngine.SetState(MovementEngineState.Moving, enemyFlagCarrier.Position);
                        WowInterface.MovementEngine.Execute();
                    }
                    else
                    {
                        if (enemyFlagCarrier != null)
                        {
                            WowInterface.HookManager.TargetGuid(enemyFlagCarrier.Guid);
                            WowInterface.HookManager.StartAutoAttack();
                            WowInterface.HookManager.FacePosition(WowInterface.ObjectManager.Player, enemyFlagCarrier.Position);
                            BattlegroundEngine.ForceCombat = true;
                        }
                    }
                }
                else
                {
                    // there is no enemy flag carrier
                    BattlegroundEngine.SetState(BattlegroundState.DefendMyself);
                    return;
                }
            }
        }
Ejemplo n.º 8
0
        public bool HanldeInterruptStates()
        {
            IEnumerable <WowGameobject> enemyflags = BattlegroundEngine.GetBattlegroundFlags();

            if (enemyflags.Count() > 0 &&
                !((ICtfBattlegroundProfile)BattlegroundEngine.BattlegroundProfile).IsMeFlagCarrier)
            {
                BattlegroundEngine.SetState(BattlegroundState.PickupEnemyFlag);
                return(true);
            }

            IEnumerable <WowGameobject> ownFlags = BattlegroundEngine.GetBattlegroundFlags(false);

            if (ownFlags.Count() > 0 &&
                !((ICtfBattlegroundProfile)BattlegroundEngine.BattlegroundProfile).IsMeFlagCarrier &&
                ownFlags.FirstOrDefault()?.Position.GetDistance(WsgDataset.OwnFlagPosition) > 4)
            {
                BattlegroundEngine.SetState(BattlegroundState.PickupOwnFlag);
                return(true);
            }

            return(false);
        }
 public AssistOwnFlagCarrierBgState(BattlegroundEngine battlegroundEngine, WowInterface wowInterface) : base(battlegroundEngine)
 {
     WowInterface = wowInterface;
 }
Ejemplo n.º 10
0
 public PickupOwnFlagBgState(BattlegroundEngine battlegroundEngine, WowInterface wowInterface) : base(battlegroundEngine)
 {
     WowInterface = wowInterface;
 }
Ejemplo n.º 11
0
 public WaitingForStartBgState(BattlegroundEngine battlegroundEngine) : base(battlegroundEngine)
 {
 }
Ejemplo n.º 12
0
 public DefendMyselfBgState(BattlegroundEngine battlegroundEngine, WowInterface wowInterface) : base(battlegroundEngine)
 {
     WowInterface = wowInterface;
 }
 public MoveToEnemyFlagCarrierBgState(BattlegroundEngine battlegroundEngine, WowInterface wowInterface) : base(battlegroundEngine)
 {
     WowInterface = wowInterface;
 }
Ejemplo n.º 14
0
 public MoveToOwnBaseBgState(BattlegroundEngine battlegroundEngine, WowInterface wowInterface, Vector3 ownBasePosition) : base(battlegroundEngine)
 {
     WowInterface    = wowInterface;
     OwnBasePosition = ownBasePosition;
 }
Ejemplo n.º 15
0
 public PickupBuffBgState(BattlegroundEngine battlegroundEngine) : base(battlegroundEngine)
 {
 }
Ejemplo n.º 16
0
 public MoveToEnemyBaseBgState(BattlegroundEngine battlegroundEngine, WowInterface wowInterface, Vector3 enemyBasePosition) : base(battlegroundEngine)
 {
     WowInterface      = wowInterface;
     EnemyBasePosition = enemyBasePosition;
 }
Ejemplo n.º 17
0
 public ExitBattlegroundBgState(BattlegroundEngine battlegroundEngine) : base(battlegroundEngine)
 {
 }
Ejemplo n.º 18
0
 public BasicBattlegroundState(BattlegroundEngine battlegroundEngine)
 {
     BattlegroundEngine = battlegroundEngine;
 }