I'm currently working on a universal rotationbot(only rotation), and currently i've made quite some methods i find very usefull for CC developing:
Get your /Focus as a WoWUnit:
Check if a WoWUnit have a buff casts by yourself:
Get buff/debuff of spells which is casts by you, usefull for timing of spellcasts for dot classes:
And last but not least, i toyed around with this new Composite, "DecoratorContinue", and found a pretty nice use for it!:
it will try to use soulburn if everything is true, and then afterwards use drainlife, if it cant use soulburn it will just use drainlife, without having to use multiple methods for the same thing like having 1 named "NormalDrainLife" and another named "SoulBurnDrainLife" etc
Enjoy, Thacai out
Get your /Focus as a WoWUnit:
Code:
public WoWUnit GetFocus()
{
string name = Lua.GetReturnVal<string>("return GetUnitName(\"" + "focus" + "\");", 0);
var units = ObjectManager.GetObjectsOfType<WoWUnit>(true, true).First((unit) => unit.Name == name && name != null && name != string.Empty && name.ToLower() != "nil");
if (units != null)
{
return units;
}
return null;
}
Check if a WoWUnit have a buff casts by yourself:
Code:
public bool HasBuff(WoWUnit unit, WoWSpell buff)
{
if(unit.GetAllAuras().First((aura) => aura.SpellId == buff.Id &&
aura.CreatorGuid==Me.Guid) != null && unit != null)
{
return true;
}
return false;
}
Get buff/debuff of spells which is casts by you, usefull for timing of spellcasts for dot classes:
Code:
public double BuffDurationLeft(WoWUnit who, WoWSpell whatspell)
{
var matchingAura = who.GetAllAuras().First((aura) => aura.SpellId == whatspell.Id && aura.CreatorGuid == Me.Guid);
if(matchingAura != null && who != null)
{
return matchingAura.TimeLeft.TotalMilliseconds;
}
return 0;
}
And last but not least, i toyed around with this new Composite, "DecoratorContinue", and found a pretty nice use for it!:
Code:
private Composite DrainLife()
{
return new Decorator(ret => !Me.IsMoving && Core.CanCast(WarlockSpells.DrainLife) && Me.CurrentTarget.HealthPercent > 25,
new Sequence(
new DecoratorContinue(ret => Core.CanCast(WarlockSpells.Soulburn) && Settings.SoulBurnDrainLife && !Core.CheckBloodlust(),
new Action(ret => SpellManager.Cast(WarlockSpells.Soulburn))),
new Action(ret => SpellManager.Cast(WarlockSpells.DrainLife))));
}
it will try to use soulburn if everything is true, and then afterwards use drainlife, if it cant use soulburn it will just use drainlife, without having to use multiple methods for the same thing like having 1 named "NormalDrainLife" and another named "SoulBurnDrainLife" etc
Enjoy, Thacai out
