Jump to content

Shaman Offhand weapon buff.


Recommended Posts

  • 11 months later...

I use these to detect shaman buffs and they work well

    internal static class EnhancementHelper
    {
        public static bool HasTwoHandEquipped =>
            Lua.LuaDoString<int>("result = IsEquippedItemType('Two-Hand')", "result") == 1;
        public static bool HasShieldEquipped =>
            Lua.LuaDoString<int>("result = IsEquippedItemType('Shields')", "result") == 1;
        public static bool HasMainHandEnhancement =>
            Lua.LuaDoString<int>("result = GetWeaponEnchantInfo()", "result") == 1;
        public static bool HasOffHandEnhancement =>
            Lua.LuaDoString<int>("_, _, _, result = GetWeaponEnchantInfo()", "result") == 1;
    }

my implementation looks like this

    internal class Imbue : TTask
    {
        readonly ISpellService spellService;

        public Imbue(
            ISpellService spellService)
        {
            this.spellService = spellService;
        }

        public override int Priority => 999;

        public override bool Activate()
        {
            return (spellService.RockbiterWeapon.KnownSpell
                || spellService.WindfuryWeapon.KnownSpell
                || spellService.FlametongueWeapon.KnownSpell)
                && (spellService.RockbiterWeapon.IsSpellUsable
                || spellService.WindfuryWeapon.IsSpellUsable
                || spellService.FlametongueWeapon.IsSpellUsable)
                &&  (!EnhancementHelper.HasMainHandEnhancement
                    || (!EnhancementHelper.HasShieldEquipped
                    && !EnhancementHelper.HasTwoHandEquipped
                    && !EnhancementHelper.HasOffHandEnhancement));
        }

        public override void Execute()
        {
            if (spellService.WindfuryWeapon.KnownSpell && !EnhancementHelper.HasMainHandEnhancement)
                spellService.WindfuryWeapon.Launch();
            else if (spellService.FlametongueWeapon.KnownSpell && EnhancementHelper.HasMainHandEnhancement && !EnhancementHelper.HasOffHandEnhancement)
                spellService.FlametongueWeapon.Launch();
            else
                spellService.RockbiterWeapon.Launch();
        }
    }

 

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...