Jump to content

Recommended Posts

I've modified a fight class to suit my needs, however the combat rotation is too slow, a few weeks ago I remember every fight class to execute everything pretty much instantly, now there is a random delay between actions that makes my warrior miss Overpower and Execute oppurtunities, it is really wierd since all of the spells are instant except Heroic Strike.
(It does use all abilities, but with said delay that ruins potential DPS)

Here is the combat part of the fight class I've been working on:
 

    internal void CombatRotation()
    {
        if (Lua.LuaDoString<bool>(@"return (UnitIsTapped(""target"")) and (not UnitIsTappedByPlayer(""target""));"))
        {
            Fight.StopFight();
            Lua.LuaDoString("ClearTarget();");
            System.Threading.Thread.Sleep(400);
        }
		
		if (Charge.KnownSpell && SpellManager.SpellUsableLUA("Charge") && ObjectManager.Target.GetDistance >= 8 && ObjectManager.Target.GetDistance <= 25)
        {
            Charge.Launch();
        }
		
		if (ShieldBash.KnownSpell && SpellManager.SpellUsableLUA("Shield Bash") && ObjectManager.Target.IsCast && ObjectManager.Me.GetPowerByPowerType(wManager.Wow.Enums.PowerType.Rage) >= 10)
        {
            ShieldBash.Launch();
        }
		
		if (Hamstring.KnownSpell && SpellManager.SpellUsableLUA("Hamstring") && ObjectManager.Target.Fleeing && ObjectManager.Me.GetPowerByPowerType(wManager.Wow.Enums.PowerType.Rage) >= 10)
        {
            Hamstring.Launch();
        }
		
		if (Overpower.KnownSpell && SpellManager.SpellUsableLUA("Overpower") && ObjectManager.Me.GetPowerByPowerType(wManager.Wow.Enums.PowerType.Rage) >= 5)
        {
            Overpower.Launch();
        }
		
		if (Execute.KnownSpell && SpellManager.SpellUsableLUA("Execute") && ObjectManager.Target.HealthPercent <= 20 && ObjectManager.Me.GetPowerByPowerType(wManager.Wow.Enums.PowerType.Rage) >= 15)
        {
            Execute.Launch();
        }
		
		if (Rend.KnownSpell && SpellManager.SpellUsableLUA("Rend") && ObjectManager.Me.GetPowerByPowerType(wManager.Wow.Enums.PowerType.Rage) >= 10 && !ObjectManager.Target.HaveBuff("Rend"))
        {
            Rend.Launch();
        }
		
		// Heroic Strike spam
		else if (HeroicStrike.KnownSpell && SpellManager.SpellUsableLUA("Heroic Strike") && ObjectManager.Me.GetPowerByPowerType(wManager.Wow.Enums.PowerType.Rage) >= 15)
        {
            HeroicStrike.Launch();
        }
    }

If anyone know how to fix it, I would really appreciate it. (Basically I want the rotation to use all the abilities when they're available, when none of them are then it should spam Heroic Strike)

Thanks in advance!

Link to comment
https://wrobot.eu/forums/topic/10370-slow-fight-class-rotation/
Share on other sites

Your thread is probably waiting for the ObjectManager to update (which happens on a different thread and is synchronized, therefore a locked operation).

Either create a deep copy of the current ObjectManager and use that instead of yours, cache which spells you already know or make your fightclass thread sleep until just after global cooldown ends so that "waiting periods" for ObjecManager updates during your rotation have less of an impact.

If you don't understand what I'm saying, this is too advanced for you and I recommend either buying a fightclass or trying to only run a single bot with both WoW and the bot having high process priority so all actions are executed faster overall.

    internal void CombatRotation()
    {
        try
        {
            wManager.Wow.Memory.WowMemory.LockFrame();
            if (Lua.LuaDoString<bool>(@"return (UnitIsTapped(""target"")) and (not UnitIsTappedByPlayer(""target""));"))
            {
                Fight.StopFight();
                Lua.LuaDoString("ClearTarget();");
                wManager.Wow.Memory.WowMemory.UnlockFrame();
                System.Threading.Thread.Sleep(400);
            }
            else if (Charge.KnownSpell && SpellManager.SpellUsableLUA("Charge") &&
                     ObjectManager.Target.GetDistance >= 8 && ObjectManager.Target.GetDistance <= 25)
            {
                wManager.Wow.Memory.WowMemory.UnlockFrame();
                Charge.Launch();
            }
            else if (ShieldBash.KnownSpell && SpellManager.SpellUsableLUA("Shield Bash") &&
                     ObjectManager.Target.IsCast &&
                     ObjectManager.Me.GetPowerByPowerType(wManager.Wow.Enums.PowerType.Rage) >= 10)
            {
                wManager.Wow.Memory.WowMemory.UnlockFrame();
                ShieldBash.Launch();
            }
            else if (Hamstring.KnownSpell && SpellManager.SpellUsableLUA("Hamstring") && ObjectManager.Target.Fleeing &&
                     ObjectManager.Me.GetPowerByPowerType(wManager.Wow.Enums.PowerType.Rage) >= 10)
            {
                wManager.Wow.Memory.WowMemory.UnlockFrame();
                Hamstring.Launch();
            }
            else if (Overpower.KnownSpell && SpellManager.SpellUsableLUA("Overpower") &&
                     ObjectManager.Me.GetPowerByPowerType(wManager.Wow.Enums.PowerType.Rage) >= 5)
            {
                wManager.Wow.Memory.WowMemory.UnlockFrame();
                Overpower.Launch();
            }
            else if (Execute.KnownSpell && SpellManager.SpellUsableLUA("Execute") &&
                     ObjectManager.Target.HealthPercent <= 20 &&
                     ObjectManager.Me.GetPowerByPowerType(wManager.Wow.Enums.PowerType.Rage) >= 15)
            {
                wManager.Wow.Memory.WowMemory.UnlockFrame();
                Execute.Launch();
            }
            else if (Rend.KnownSpell && SpellManager.SpellUsableLUA("Rend") &&
                     ObjectManager.Me.GetPowerByPowerType(wManager.Wow.Enums.PowerType.Rage) >= 10 &&
                     !ObjectManager.Target.HaveBuff("Rend"))
            {
                wManager.Wow.Memory.WowMemory.UnlockFrame();
                Rend.Launch();
            }
            else if (HeroicStrike.KnownSpell && SpellManager.SpellUsableLUA("Heroic Strike") &&
                     ObjectManager.Me.GetPowerByPowerType(wManager.Wow.Enums.PowerType.Rage) >= 15)
            {
                wManager.Wow.Memory.WowMemory.UnlockFrame();
                HeroicStrike.Launch();
            }
            else
                wManager.Wow.Memory.WowMemory.UnlockFrame();
        }
        catch
        {
            wManager.Wow.Memory.WowMemory.UnlockFrame();
        }
    }

try to lock frame, and try to call your method more often

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...