Jump to content

Checking if Spell is Launched


Brian
 Share

Recommended Posts

 

if (Corruption.IsSpellUsable && Corruption.IsDistanceGood && Corruption.KnownSpell)
         {

             if (CorrAura.SpellId == )
             {
                Logging.Write("herea");
                Corruption.Launch();
                 return;
             }else if(corr20 == false && corr60 == false && ObjectManager.Me.HaveBuff("Eradication") && !ObjectManager.Me.HaveBuff("Bloodlust") && !ObjectManager.Me.HaveBuff("Heroism"))
            {
                Logging.Write("hereb");
                Corruption.Launch();
                corr0 = false;
                corr20 = true;
                corr60 = false;
                return;
            }else if(corr60 == false && ObjectManager.Me.HaveBuff("Eradication"))
            {
                if(ObjectManager.Me.HaveBuff("Bloodlust") || ObjectManager.Me.HaveBuff("Heroism"))
                {
                    Logging.Write("herec");
                    Corruption.Launch();
                    corr0 = false;
                    corr20 = false;
                    corr60 = true;
                    return;
                }
            }

         }

So, my issue is that it changes the variables (corr0/corr20/corr60) without actually Launching the spell. Because it loops through this while casting previous spell / on GCD.  Is it possible to do something like

Corruption.Launch();
//pseudo code
if(launch is successful){
	corr0 = false;
	corr20 = false;
	corr60 = true;
}

How would I check if the launch is successful? Its an instant spell, so I cant check current spell casting.  Also, I don't want to do something like 

 

if(Not ON GCD || Not Casting) {

}

I do not want to do this because I will slow down the routine script way to much.  How else to fix issue?

Link to comment
Share on other sites

Hello, this code is not 100% reliable but you can try:

        Spell Corruption = new Spell("Corruption");
        //...
        var errorCount = wManager.Wow.Helpers.EventsLua.UsedCountByLuaEventsId(wManager.Wow.Enums.LuaEventsId.UI_ERROR_MESSAGE);
        Corruption.Launch();
        bool failled = wManager.Wow.Helpers.EventsLua.UsedCountByLuaEventsId(wManager.Wow.Enums.LuaEventsId.UI_ERROR_MESSAGE) > errorCount;

 

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
 Share

×
×
  • Create New...