示例#1
0
        public TargetManager(ITargetSelectionLogic targetSelectionLogic, TimeSpan minTargetSwitchTime)
        {
            TargetSelectionLogic = targetSelectionLogic;

            TargetSwitchEvent = new TimegatedEvent(minTargetSwitchTime);

            PriorityTargets = new List <string>();
        }
示例#2
0
        protected BasicCombatClass(WowInterface wowInterface, AmeisenBotStateMachine stateMachine)
        {
            WowInterface = wowInterface;
            StateMachine = stateMachine;

            CooldownManager      = new CooldownManager(WowInterface.CharacterManager.SpellBook.Spells);
            RessurrectionTargets = new Dictionary <string, DateTime>();

            ITargetSelectionLogic targetSelectionLogic = Role switch
            {
                CombatClassRole.Dps => targetSelectionLogic  = new DpsTargetSelectionLogic(wowInterface),
                CombatClassRole.Heal => targetSelectionLogic = new HealTargetSelectionLogic(wowInterface),
                CombatClassRole.Tank => targetSelectionLogic = new TankTargetSelectionLogic(wowInterface),
                _ => null,
            };

            TargetManager = new TargetManager(targetSelectionLogic, TimeSpan.FromMilliseconds(250));

            Spells = new Dictionary <string, Spell>();
            WowInterface.CharacterManager.SpellBook.OnSpellBookUpdate += () =>
            {
                Spells.Clear();
                foreach (Spell spell in WowInterface.CharacterManager.SpellBook.Spells.OrderBy(e => e.Rank).GroupBy(e => e.Name).Select(e => e.First()))
                {
                    if (!Spells.ContainsKey(spell.Name))
                    {
                        Spells.Add(spell.Name, spell);
                    }
                }
            };

            MyAuraManager = new AuraManager
                            (
                null,
                null,
                TimeSpan.FromSeconds(1),
                () => { if (WowInterface.ObjectManager.Player != null)
                        {
                            return(WowInterface.ObjectManager.Player.Auras.Select(e => e.Name).ToList());
                        }
                        else
                        {
                            return(null);
                        } },
                () => { if (WowInterface.ObjectManager.Player != null)
                        {
                            return(WowInterface.ObjectManager.Player.Auras.Select(e => e.Name).ToList());
                        }
                        else
                        {
                            return(null);
                        } },
                null,
                DispellDebuffsFunction
                            );

            TargetAuraManager = new AuraManager
                                (
                null,
                null,
                TimeSpan.FromSeconds(1),
                () => { if (WowInterface.ObjectManager.Target != null)
                        {
                            return(WowInterface.ObjectManager.Target.Auras.Select(e => e.Name).ToList());
                        }
                        else
                        {
                            return(null);
                        } },
                () => { if (WowInterface.ObjectManager.Target != null)
                        {
                            return(WowInterface.ObjectManager.Target.Auras.Select(e => e.Name).ToList());
                        }
                        else
                        {
                            return(null);
                        } },
                DispellBuffsFunction,
                null
                                );

            GroupAuraManager = new GroupAuraManager(WowInterface);

            TargetInterruptManager = new InterruptManager(new List <WowUnit>()
            {
                WowInterface.ObjectManager.Target
            }, null);

            ActionEvent             = new TimegatedEvent(TimeSpan.FromMilliseconds(50));
            NearInterruptUnitsEvent = new TimegatedEvent(TimeSpan.FromMilliseconds(250));
            UpdatePriorityUnits     = new TimegatedEvent(TimeSpan.FromMilliseconds(1000));

            WalkBehindEnemy = false;
        }