Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //the CALL
- Spell.CastSelfSpellByID(18540, ret => Me.CurrentTarget != null && Unit.IsTargetWorthy(Me.CurrentTarget), "Summon Terrorguard"))),
- //The Method
- public static Composite CastSpellByID(int spellid, CLU.UnitSelection onUnit, CanRunDecoratorDelegate cond, string label)
- {
- var spell = WoWSpell.FromId(spellid);
- return new Decorator
- (context =>
- {
- if (!cond(context))
- {
- return false;
- }
- if (spell == null)
- {
- CLU.TroubleshootLog("SpellID not found: {0}", spellid);
- return false;
- }
- var target = onUnit(context);
- if (target == null)
- {
- CLU.TroubleshootLog("Target not found.");
- return false;
- }
- var canCast = CanCast(spell, target);
- if (!canCast)
- {
- return false;
- }
- return true;
- },
- new Sequence
- (new Action(a => CLU.Log(" [Casting] {0} on {1}", label, CLU.SafeName(onUnit(a)))),
- new Action(a => SpellManager.Cast(spell, onUnit(a)))));
- }
Add Comment
Please, Sign In to add comment