Jump to content

CanInterruptCasting working?


Recommended Posts

Hi there,

I've tried the following on a WOTLK 3.3.5a private server:

        // Interrupt with Wind Shear
        if (WindShear.KnownSpell && WindShear.IsSpellUsable && ObjectManager.Target.CanInterruptCasting)
        {
            WindShear.Launch();
            return;
        }

But it doesn't use Wind Shear on interruptible spells. If I log a check of ObjectManager.Target.CanInterruptCasting it says "false" - am I using it correctly?

I even wrote my own check which returns false as well!

    private bool SpellIsInterruptible()
    {
        return Lua.LuaDoString<bool>(
            @"isinterruptible = false;
            local name, _, _, _, _, _, _, notInterruptible = UnitCastingInfo(""target"");
            if not name then
                local name, _, _, _, _, _, notInterruptible = UnitChannelInfo(""target"");
            end
            if name and not notInterruptible then
                isinterruptible = true;
            end
            ", "isinterruptible");
    }

Regards

Ofrex35

Link to comment
Share on other sites

Your Lua is wrong. The second local shouldn't be there. You're just creating a second local variable called name in that conditional block instead of overwriting the one outside of it.

Instead of searching for a variable that will constantly be overwritten, just return what you need like so:

private bool SpellIsInterruptible()
    {
        return Lua.LuaDoString<bool>(
            @"
            local name, _, _, _, _, _, _, notInterruptible = UnitCastingInfo(""target"");
            if not name then
                name, _, _, _, _, _, notInterruptible = UnitChannelInfo(""target"");
            end
            if name then
            	return not notInterruptible;
            end
          
            return false;
            ");
    }

 

Link to comment
Share on other sites

Thank you for the quick reply - neither ObjectManager.Target.CanInterruptCasting nor your new function return true for interruptibles.

I will leave this for the moment though in case its a peculiarity of the one spell I have tried it on - Blackwood Windtalkers Gust of Wind in Darkshore.

I will find other mobs first.

Thanks

Ofrex35

Link to comment
Share on other sites

Either your parameters aren't correct for 3.3.5a or the server isn't giving your client the correct info. Or even worse, your client is modified.

local name, nameSubtext, text, texture, startTime, endTime, isTradeSkill, castID, notInterruptible = UnitCastingInfo(unit);

This is taken from 3.3.5a interface files. notInterruptable probably returns nil, so you may have to double check what actually is returned.

Here's the source:
https://github.com/wowgaming/3.3.5-interface-files/blob/main/CastingBarFrame.lua

Link to comment
Share on other sites

Thanks Matenia - sorted now - I had missed the fact that Wowpedia's API stated there was a change between TBC and Retail, and nameSubtext was removed.

Once I corrected that it works great!

Thanks for the prompt!

Ofrex35

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...