Esempio n. 1
0
        public bool PlaceFireTotem()
        {
            WoW.Classes.Frames.WowFrame totemFrame = new WoW.Classes.Frames.WowFrame(0);

            List<WoW.Classes.WowActionBarSlot> fireTotemsSpells = WoW.Internals.ActionBar.GetFilledSlots().Where(x => x.IsSpell && Enum.IsDefined(typeof(FireTotems), x.ActionId)).ToList();

            if (fireTotemsSpells.Count > 0)
            {
                WoW.Internals.ActionBar.PressSlot(fireTotemsSpells.First().BarIndex, fireTotemsSpells.First().SlotIndex);

                totemFrame = WoW.Internals.UIFrame.GetFrameByName("TotemFrameTotem1");

                if (totemFrame.IsValid && totemFrame.IsVisible)
                    return true;
            }

            //actionId ?
            List<WoW.Classes.WowActionBarSlot> fireTotemsFlyouts = WoW.Internals.ActionBar.GetFilledSlots().Where(x => x.IsFlyout && x.ActionId == 80 ).ToList();

            if (fireTotemsFlyouts.Count > 0)
            {
                WoW.Classes.WowActionBarSlot actionSlot = fireTotemsFlyouts.First();

                WoW.Internals.ActionBar.PressSlot(actionSlot.BarIndex, actionSlot.SlotIndex);
                System.Threading.Thread.Sleep(500);

                WoW.Classes.Frames.WowFrame FireElementalTotemButton = WoW.Internals.UIFrame.GetFrameByName("SpellFlyoutButton3");
                WoW.Classes.Frames.WowFrame MagmaTotemButton = WoW.Internals.UIFrame.GetFrameByName("SpellFlyoutButton2");
                WoW.Classes.Frames.WowFrame SearingTotemButton = WoW.Internals.UIFrame.GetFrameByName("SpellFlyoutButton1");

                if (FireElementalTotemButton.IsValid &&
                   FireElementalTotemButton.IsVisible)
                {
                    FireElementalTotemButton.LeftClick();
                }
                else if (MagmaTotemButton.IsValid &&
                   MagmaTotemButton.IsVisible)
                {
                    MagmaTotemButton.LeftClick();
                }
                else if (SearingTotemButton.IsValid &&
                   SearingTotemButton.IsVisible)
                {
                    SearingTotemButton.LeftClick();
                }

                totemFrame = WoW.Internals.UIFrame.GetFrameByName("TotemFrameTotem1");
            }

            return totemFrame.IsVisible && totemFrame.IsValid;
        }
Esempio n. 2
0
        public bool CallPet()
        {
            /*
             *  Attempt to use "Call Pet" spells.
             */

            List <WoW.Classes.WowActionBarSlot> callPetSpells = WoW.Internals.ActionBar.GetFilledSlots().Where(x => x.IsSpell && Enum.IsDefined(typeof(CallPetSpells), x.ActionId)).ToList();

            if (callPetSpells.Count > 0)
            {
                WoW.Internals.ActionBar.PressSlot(callPetSpells.First().BarIndex, callPetSpells.First().SlotIndex);

                int startWaitPetTick = Environment.TickCount;

                while (!WoW.Internals.ObjectManager.Pet.IsValid ||
                       !WoW.Internals.ObjectManager.Pet.IsAlive)
                {
                    if (Environment.TickCount - startWaitPetTick > 3000)
                    {
                        break;
                    }

                    System.Threading.Thread.Sleep(100);
                }

                return(WoW.Internals.ObjectManager.Pet.IsValid && WoW.Internals.ObjectManager.Pet.IsAlive);
            }

            /*
             *  Attempt to use "Call Pet" flyout.
             */

            List <WoW.Classes.WowActionBarSlot> callPetFlyouts = WoW.Internals.ActionBar.GetFilledSlots().Where(x => x.IsFlyout && x.ActionId == 9).ToList();

            if (callPetFlyouts.Count > 0)
            {
                WoW.Classes.WowActionBarSlot actionSlot = callPetFlyouts.First();

                WoW.Internals.ActionBar.PressSlot(actionSlot.BarIndex, actionSlot.SlotIndex);

                System.Threading.Thread.Sleep(1000);

                WoW.Classes.Frames.WowFrame SpellFlyoutButton = WoW.Internals.UIFrame.GetFrameByName("SpellFlyoutButton1");

                if (SpellFlyoutButton.IsValid &&
                    SpellFlyoutButton.IsVisible)
                {
                    SpellFlyoutButton.LeftClick();

                    int startWaitPetTick = Environment.TickCount;

                    while (!WoW.Internals.ObjectManager.Pet.IsValid ||
                           !WoW.Internals.ObjectManager.Pet.IsAlive)
                    {
                        if (Environment.TickCount - startWaitPetTick > 3000)
                        {
                            break;
                        }

                        System.Threading.Thread.Sleep(100);
                    }
                }
            }

            return(WoW.Internals.ObjectManager.Pet.IsValid && WoW.Internals.ObjectManager.Pet.IsAlive);
        }