Jump to content

Recommended Posts

I feel like I'm writing my rotations the completely wrong way, they feel super clunky and I think it's mainly because I'm just writing lines that are unnecessary.

I'd like to use Explosive shot and Multi-Shot as priority, arcane shot as 1'st filler and Steady shot as a last resort if everything else is on cooldown but what I'm finding is that even if the spells are off CD it'll still use steady shot even though I've outlined it to only use the spell if the others are unusable.

There has to be a much simpler way of me doing this like a check if on CD or whatever.

I'd really appreciate some help with this since it effects a couple of the rotations I've written but this one it effects the most as explosive shot and multi-shot are my main sources of damage.

using System;
using System.Collections.Generic;
using System.Threading;
using robotManager.Helpful;
using robotManager.Products;
using wManager.Wow.Class;
using wManager.Wow.Enums;
using wManager.Wow.Helpers;
using wManager.Wow.ObjectManager;

public class Main : ICustomClass
{
    public string name = "dRotation (Multishot Hunter)";
    public float Range { get { return 5.0f; } }

    private bool _isRunning;

    /*
    * Initialize()
    * When product started, initialize and launch Fightclass
    */
    public void Initialize()
    {
        _isRunning = true;
        Logging.Write(name + " Is initialized.");
        CreateStatusFrame();
        Rotation();
    }

    /*
    * Dispose()
    * When product stopped
    */

    public void Dispose()
    {
        _isRunning = false;
        Logging.Write(name + " Stop in progress.");
        Lua.LuaDoString(@"dRotationFrame.text:SetText(""dRotation Stopped!"")");
    }

    /*
    * ShowConfiguration()
    * When use click on Fightclass settings
    */
    public void ShowConfiguration()
    {
        Logging.Write(name + " No settings for this Fightclass.");
    }

    /*
    * Spells for Rotation 
    */
    public Spell ExplosiveShot = new Spell("Explosive Shot");
    public Spell MultiShot = new Spell("Multi-Shot");
    public Spell ArcaneShot = new Spell("Arcane Shot");
    public Spell SliceAndDice = new Spell("Slice and Dice"); 
    public Spell BlackArrow = new Spell("Black Arrow"); 
	public Spell SteadyShot = new Spell("Steady Shot");
	
	
    /* Rotation() */
    public void Rotation()
    {
        Logging.Write(name + ": Started.");

        while (_isRunning)
        {
            try
            {
                if (Products.InPause)
                {
                    Lua.LuaDoString(@"dRotationFrame.text:SetText(""dRotation Paused!"")");
                }

                if (!Products.InPause)
                {
                    if (!ObjectManager.Me.IsDeadMe)
                    {
                        if (!ObjectManager.Me.InCombatFlagOnly)
                        {
                            Lua.LuaDoString(@"dRotationFrame.text:SetText(""dRotation Active!"")");
                        }
                        else if (ObjectManager.Me.InCombatFlagOnly && ObjectManager.Me.Target > 0)
                        {
                            CombatRotation();
                        }
                    }
                }
            }
            catch (Exception e)
            {
                Logging.WriteError(name + " ERROR: " + e);
            }

            Thread.Sleep(10); // Pause 10 ms to reduce the CPU usage.
        }
        Logging.Write(name + ": Stopped.");
    }
    /*
    * CreateStatusFrame()
    * InGame Status frame to see which spells casting next
    */
    public void CreateStatusFrame()
    {
        Lua.LuaDoString(@"
        if not dRotationFrame then
            dRotationFrame = CreateFrame(""Frame"")
            dRotationFrame:ClearAllPoints()
            dRotationFrame:SetBackdrop(StaticPopup1:GetBackdrop())
            dRotationFrame:SetHeight(70)
            dRotationFrame:SetWidth(210)

            dRotationFrame.text = dRotationFrame:CreateFontString(nil, ""BACKGROUND"", ""GameFontNormal"")
            dRotationFrame.text:SetAllPoints()
            dRotationFrame.text:SetText(""dRotation by Dreamful, Ready!"")
            dRotationFrame.text:SetTextColor(1, 1, 1, 6)
            dRotationFrame:SetPoint(""CENTER"", 0, -240)
            dRotationFrame:SetBackdropBorderColor(0, 0, 0, 0)

            dRotationFrame:SetMovable(true)
            dRotationFrame:EnableMouse(true)
            dRotationFrame:SetScript(""OnMouseDown"",function() dRotationFrame:StartMoving() end)
            dRotationFrame:SetScript(""OnMouseUp"",function() dRotationFrame:StopMovingOrSizing() end)

            dRotationFrame.Close = CreateFrame(""BUTTON"", nil, dRotationFrame, ""UIPanelCloseButton"")
            dRotationFrame.Close:SetWidth(15)
            dRotationFrame.Close:SetHeight(15)
            dRotationFrame.Close:SetPoint(""TOPRIGHT"", dRotationFrame, -8, -8)
            dRotationFrame.Close:SetScript(""OnClick"", function()
                dRotationFrame:Hide()
                DEFAULT_CHAT_FRAME:AddMessage(""dRotationStatusFrame |cffC41F3Bclosed |cffFFFFFFWrite /dRotation to enable again."") 	
            end)

            SLASH_WHATEVERYOURFRAMESARECALLED1=""/dRotation""
            SlashCmdList.WHATEVERYOURFRAMESARECALLED = function()
                if dRotationFrame:IsShown() then
                    dRotationFrame:Hide()
                else
                    dRotationFrame:Show()
                end
            end
        end");
    }

    /*
    * CombatRotation()
    */
    public void CombatRotation()
    {

        // Slice and Dice
        if (SliceAndDice.KnownSpell && SliceAndDice.IsSpellUsable && SliceAndDice.IsDistanceGood && !ObjectManager.Me.HaveBuff(6774) && ObjectManager.Me.ComboPoint >= 5)
        {
            SliceAndDice.Launch();
            Lua.LuaDoString(@"dRotationFrame.text:SetText(""Casting Slice and Dice"")");
            return;
        }
		
        // BlackArrow
        if (BlackArrow.KnownSpell && BlackArrow.IsSpellUsable && BlackArrow.IsDistanceGood)
        {
            BlackArrow.Launch();
            Lua.LuaDoString(@"dRotationFrame.text:SetText(""Casting Slice and Dice"")");
            return;
        }
		
        // ExplosiveShot
        if (ExplosiveShot.KnownSpell && ExplosiveShot.IsSpellUsable && ExplosiveShot.IsDistanceGood && ObjectManager.Me.ComboPoint <= 4)
        {
            ExplosiveShot.Launch();
            Lua.LuaDoString(@"dRotationFrame.text:SetText(""Casting ExplosiveShot"")");
            return;
        }
		
        // MultiShot
        if (MultiShot.KnownSpell && MultiShot.IsSpellUsable && !ExplosiveShot.IsSpellUsable && MultiShot.IsDistanceGood && ObjectManager.Me.ComboPoint <= 4)
        {
            MultiShot.Launch();
            Lua.LuaDoString(@"dRotationFrame.text:SetText(""Casting MultiShot"")");
            return;
        }			
		
        // ArcaneShot
        if (ArcaneShot.KnownSpell && ArcaneShot.IsSpellUsable && !MultiShot.IsSpellUsable && !ExplosiveShot.IsSpellUsable && ArcaneShot.IsDistanceGood && ObjectManager.Me.ComboPoint <= 4)
        {
            ArcaneShot.Launch();
            Lua.LuaDoString(@"dRotationFrame.text:SetText(""Casting ArcaneShot"")");
            return;
        }			
		
        // SteadyShot
        if (SteadyShot.KnownSpell && SteadyShot.IsSpellUsable && !ArcaneShot.IsSpellUsable && !MultiShot.IsSpellUsable && !ExplosiveShot.IsSpellUsable && SteadyShot.IsDistanceGood && ObjectManager.Me.ComboPoint <= 4)
        {
            SteadyShot.Launch();
            Lua.LuaDoString(@"dRotationFrame.text:SetText(""Casting SteadyShot"")");
            return;
        }
		
        // CompoundShot
        if (ObjectManager.Me.ComboPoint >= 5 && ObjectManager.Me.HaveBuff(6774))
        {			
			wManager.Wow.Helpers.SpellManager.CastSpellByIdLUA(826679);
            Lua.LuaDoString(@"dRotationFrame.text:SetText(""Casting CompoundShot"")");
            return;
        }




    }
}

 

Link to comment
https://wrobot.eu/forums/topic/13069-proper-rotation-priority/
Share on other sites

I only can recommend to use less LUA, as  Matenia said, LUA can slow down your Rotation a lot if you don´t use it correct or unneeded.

Let the Debug Output stay in wrobot like Logging.Write().

I can recommend to take a look how Matenia handled Stuff in his free Framework for Developers which he posted on Wrobot.

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