Thank Millz, I think I need restructure my CR to work more nicely with framelock... it a bit outdated
Need your help too.
More precise on the lag on rooted, I can't just stop rotation there because while rooted, I can still Throw and kill nasty totem, shiv, kick nearby units or doing something else
Maybe just stop rotation when I got CCed and no trinket up.
Just having a quick look at the code, there's so much unnecessary stuff.. You need to combine things !
For instance..
Code:
private static bool AmbushCheck()
{
if (!SpellManager.HasSpell("Ambush"))
{
return false;
}
if (!IsStealthed(Me))
{
return false;
}
if (Me.CurrentTarget == null)
{
return false;
}
if (!Me.IsBehind(Me.CurrentTarget))
{
return false;
}
if (PlayerEnergy > THSettings.Instance.ShadowDanceEnergy)
{
return false;
}
return true;
}
Can be done..
Code:
private static bool AmbushCheck()
{
if (Me.CurrentTarget == null || !SpellManager.HasSpell("Ambush") || !IsStealthed(Me) || !Me.IsBehind(Me.CurrentTarget) || PlayerEnergy > THSettings.Instance.ShadowDanceEnergy)
{
return false;
}
return true;
}
Or searching for units... You're using Where(u => conditions).FirstOrDefault() which means you're scanning all units which are valid, then selecting the first in the list..
I.e. We have units A/B/C/D/E
A - Invalid
B - Valid
C - Valid
D - Invalid
E - Valid
Your code will check the conditions on all 5 units, find the 3 which are valid, then pick the first (B).
If you change it to just a straight FirstOrDefault(u => conditions), it does..
A - Invalid
B - Valid -> Stop scanning, we have one..
If there's 40 units near you, and your scanning a full list of units each traverse, it'll have some serious lag implications.
It's also spamming out null exceptions on mass, it's probably the worst lag inducing problem with routines. This error in particular is causing the routine some serious issues.
[16:10:40.717 D] System.NullReferenceException: Object reference not set to an instance of an object.
at Styx.WoWInternals.WoWObjects.LocalPlayer.IsBehind(WoWUnit unit)
at TuanHARogue.Classname.AmbushShadowDanceCheck() in c:\<snip>\Routines\TuanHARogueOpenBeta\
THCommon.cs:line 85
Which is this code..
Code:
private static bool AmbushShadowDanceCheck()
{
if (!Me.HasAura("Shadow Dance"))
{
return false;
}
if (!Me.IsBehind(Me.CurrentTarget))
{
return false;
}
return true;
}
It's causing an error because you're checking parameters/conditions on a unit which can be (and is in this case) null.
Calls like that should be done..
Code:
if(Me.CurrentTarget != null && !Me.IsBehind(Me.CurrentTarget)) { return false; }
[16:21:47.170 D] System.NullReferenceException: Object reference not set to an instance of an object.
at TuanHARogue.Classname.CurrentTargetCheck() in c:\<snip>\Routines\TuanHARogueOpenBeta\THHelpers.cs:line 810
Code:
if (CurrentTargetCheckIsWithinMeleeRange)
{
CurrentTargetCheckInLineOfSpellSight = true;
}
else if (Me.CurrentTarget.InLineOfSpellSight)
{
CurrentTargetCheckInLineOfSpellSight = true;
}
You're over-complicating things..
Code:
if(Me.CurrentTarget != null && (Me.CurrentTarget.IsWithinMeleeRange || Me.CurrentTarget.InLineOfSpellSight))
{
CurrentTargetCheckInLineOfSpellSight = true;
}
The compiler will check each condition in the order you list them, and since InLineOfSpellSight is probably one of the most intensive calls the HB API has (since it does a full game world trace line between you and the target checking if objects are in the way and whether they'll block LoS) you need to have that call last.
Anyway, just some pointers...
*Edit*
Attaching your combat log is causing lua errors too.
*Edit 2*
Really need to use blind too..
[GetUnitsCall].FirstOrDefault(u => u != Me.CurrentTarget && (u.IsTargetingMeOrPet || u.IsCastingHealingSpell/*something like that?*/) && u.Distance <= 15)
I'll PM you my bill for a consultancy fee
*Edit 3*
Sap isn't aggressive enough when out of combat
Need to add smoke bomb defensively
Targeting friendly players when out of combat (not in a BG when noticing this...)
Stealthing when picked up an orb (causing me to drop it) -> Aura = "Orb of Power"