So I am playing a class with all instants and 400 ping, so I would like my fightclass to spam the next button until it is pressed. How would I do that? Maybe not a full out spam, but start looking for next button to press a couple hundred milliseconds early. I tried :
cooldownc = Lua.LuaDoString<int>("start, duration, enabled = GetSpellCooldown('Black Arrow'); return start;");
if (cooldownc == 0 && BlackArrow.IsDistanceGood && BlackArrow.KnownSpell)
{
BlackArrow.Launch();
return;
}
Instead of :
if (BlackArrow.IsSpellUsable && BlackArrow.IsDistanceGood && BlackArrow.KnownSpell)
{
BlackArrow.Launch();
return;
}
But it breaks the rotation and gets out of order because there is so much spamming it backs up. I tried adding sleeps but they didn't help much, rotation was suboptimal.
using System;
using System.Threading;
using robotManager.Helpful;
using robotManager.Products;
using wManager.Wow.Class;
using wManager.Wow.Helpers;
using wManager.Wow.ObjectManager;
public class Main : ICustomClass
{
public float Range { get { return 30f; } }
private bool _isLaunched;
private WoWUnit _lastTarget;
public void Initialize()
{
_isLaunched = true;
Logging.Write("Lock1.0 Started");
Rotation();
}
public void Dispose()
{
_isLaunched = false;
Logging.Write("Lock1.0 Stop in progress.");
}
public void ShowConfiguration()
{
Logging.Write("Lock1.0 No setting for this Fight Class.");
//MessageBox.Show("[My fightclass] No setting for this Fight Class.");
}
public Spell BlackArrow = new Spell("Black Arrow");
public Spell KillCommand = new Spell("Kill Command");
public Spell ChimShot = new Spell("Chimera Shot");
public Spell MultiShot = new Spell("Multi-Shot");
public Spell AimedShot = new Spell("Aimed Shot");
public Spell ExpShot = new Spell("Explosive Shot");
public Spell SteadyShot = new Spell("Steady Shot");
public Spell KillShot = new Spell("Kill Shot");
public Spell HunterMark = new Spell("Hunter's Mark");
public Spell SerpSting = new Spell("Serpent Sting");
public Spell BeastWrath = new Spell("Bestial Wrath");
public Spell RapidFire = new Spell("Rapid Fire");
public Spell Readiness = new Spell(23989);
public Spell CallPet = new Spell("Call Pet");
public int SerpID = 49001;
public int HuntID = 19423;
internal void Rotation()
{
Logging.Write("Lock1.0 Is started.");
while (_isLaunched)
{
try
{
if (!Products.InPause)
{
if (!ObjectManager.Me.IsDeadMe)
{
//buffRotation();
if (Fight.InFight && ObjectManager.Me.Target > 0 && ObjectManager.Me.SpeedMoving == 0 && !ObjectManager.Me.GetMove)
{
CombatRotation();
}
else if (ObjectManager.Me.Target == 0)
{
}
}
}
}
catch (Exception e)
{
Logging.WriteError("[My fightclass] ERROR: " + e);
}
Thread.Sleep(10); // Pause 10 ms to reduce the CPU usage.
}
Logging.Write("[My fightclass] Is now stopped.");
}
Aura GetAuraByPlayer(int ID)
{
Aura final = new Aura(0);
Aura[] TargetAuras = ObjectManager.Target.GetAllBuff().ToArray();
foreach (Aura i in TargetAuras)
{
if (i.IsValid() && i.Owner == wManager.Wow.ObjectManager.ObjectManager.Me.Guid && i.SpellId == ID)
{
final = i;
return i;
}
}
return final;
}
internal void CombatRotation()
{
Aura SerpAura = GetAuraByPlayer(SerpID);
Aura HuntAura = GetAuraByPlayer(HuntID);
int cooldown;
int cooldownb;
int cooldownc;
int cooldownd;
int cooldowne;
int cooldownf;
int cooldowng;
int cooldownh;
int cooldowni;
int cooldownj;
if (!ObjectManager.Pet.IsValid)
{
CallPet.Launch();
return;
}
if (HunterMark.IsSpellUsable && HunterMark.IsDistanceGood && HunterMark.KnownSpell)
{
if (!ObjectManager.Target.HaveBuff("Hunter's Mark"))
{
HunterMark.Launch();
return;
}
}
cooldown = Lua.LuaDoString<int>("start, duration, enabled = GetSpellCooldown('Bestial Wrath'); return start;");
if (BeastWrath.IsSpellUsable && BeastWrath.IsDistanceGood && BeastWrath.KnownSpell)
{
BeastWrath.Launch();
return;
}
if (RapidFire.IsSpellUsable && RapidFire.KnownSpell)
{
if (!ObjectManager.Me.HaveBuff("Rapid Fire"))
{
RapidFire.Launch();
return;
}
}
if (SerpSting.IsDistanceGood && SerpSting.KnownSpell)
{
if (SerpAura.SpellId == 0)
{
SerpSting.Launch();
return;
}
}
cooldownc = Lua.LuaDoString<int>("start, duration, enabled = GetSpellCooldown('Black Arrow'); return start;");
if (BlackArrow.IsSpellUsable && BlackArrow.IsDistanceGood && BlackArrow.KnownSpell)
{
BlackArrow.Launch();
return;
}
cooldowni = Lua.LuaDoString<int>("start, duration, enabled = GetSpellCooldown('Explosive Shot'); return start;");
if (ExpShot.IsSpellUsable && ExpShot.IsDistanceGood && ExpShot.KnownSpell)
{
ExpShot.Launch();
return;
}
cooldownd = Lua.LuaDoString<int>("start, duration, enabled = GetSpellCooldown('Chimera Shot'); return start;");
if (ChimShot.IsSpellUsable && ChimShot.IsDistanceGood && ChimShot.KnownSpell)
{
ChimShot.Launch();
return;
}
cooldowne = Lua.LuaDoString<int>("start, duration, enabled = GetSpellCooldown('Kill Command'); return start;");
if (KillCommand.IsSpellUsable && KillCommand.IsDistanceGood && KillCommand.KnownSpell)
{
KillCommand.Launch();
return;
}
cooldownf = Lua.LuaDoString<int>("start, duration, enabled = GetSpellCooldown('Multi-Shot'); return start;");
if (MultiShot.IsSpellUsable && MultiShot.IsDistanceGood && MultiShot.KnownSpell)
{
MultiShot.Launch();
return;
}
cooldowng = Lua.LuaDoString<int>("start, duration, enabled = GetSpellCooldown('Aimed Shot'); return start;");
if (AimedShot.IsSpellUsable && AimedShot.IsDistanceGood && AimedShot.KnownSpell)
{
AimedShot.Launch();
return;
}
cooldownh = Lua.LuaDoString<int>("start, duration, enabled = GetSpellCooldown('Kill Shot'); return start;");
if (KillShot.IsSpellUsable && KillShot.IsDistanceGood && KillShot.KnownSpell && ObjectManager.Target.HealthPercent < 20)
{
KillShot.Launch();
return;
}
cooldownj = Lua.LuaDoString<int>("start, duration, enabled = GetSpellCooldown('Readiness'); return start;");
Logging.WriteDebug(cooldownj.ToString());
if (Readiness.IsSpellUsable && Readiness.KnownSpell)
{
Readiness.Launch();
return;
}
if (SteadyShot.IsSpellUsable && SteadyShot.IsDistanceGood && SteadyShot.KnownSpell)
{
SteadyShot.Launch();
return;
}
}
}
that is what my rotation looks like, a bunch of those if statements