Sub CastSpell(string WhatSpell,int WhatID,string sentFrom)
/if (${Debug}) /echo CastSpell Enter Line#: ${WhatSpell} ${WhatID} ${sentFrom} ${Me.GemTimer[${WhatSpell}]} ${Macro.CurLine}
/declare MaxTryNum int local 2
/if (${sentFrom.Equal[Pull]}) /varset MaxTryNum 1
/if (${IAmABard}) {
/call CastBard "${WhatSpell}" ${WhatID} CastSpell
/return ${CastResult}
}
| /if (!${IAmABard} && ${Spell[${WhatSpell}].Mana}<=${Me.CurrentMana}) /return
/if (!${Target.CanSplashLand} && ${Spell[${WhatSpell}].TargetType.Equal[Free Target]}) {
/echo Splash Spell will not cast at targets location. Skipping ${WhatSpell}
/return
}
/if (${Target.ID}!=${WhatID} && ${Spell[${WhatSpell}].TargetType.NotEqual[Self]} && ${Spawn[id ${WhatID}].ID}) /call CastTarget ${WhatID}
/if (${Me.Gem[${WhatSpell}]}) {
/if (${Me.GemTimer[${WhatSpell}]}==0) {
/casting "${WhatSpell}" -maxtries|${MaxTryNum}
/while (${Cast.Status.Equal[C]} && ${CastResult.NotEqual[CAST_CANCELLED]}) {
/if (${CastingInterruptOn}) {
/if (${sentFrom.Equal[SingleHeal]}) {
/call CastInteruptHeals "${WhatSpell}"
} else /if (${Select[${sentFrom},dps,gom,burn]}>0) {
/call CastInteruptDPS "${WhatSpell}"
} else /if (${Select[${sentFrom},buffs,buffs-nomem]}>0) {
/call CastInteruptBuffs "${WhatSpell}"
}
}
/delay 5
}
/call CastWait "${WhatSpell}"
/if (${sentFrom.Equal[Pull]} && ${PullAggroTargetID}) /varset CastResult CAST_SUCCESS
| READ THIS. For some reason Cast.Result is still equal to CAST_SUCCESS after /interrupt, maybe macro to fast for plugin to update.
| So checking for CastResult NotEqual CAST_CANCELLED fixes the issue, and fixes the casting on corpse messages even though the spell was canceled.
/if (${CastResult.NotEqual[CAST_CANCELLED]}) /varset CastResult ${Cast.Result}
}
} else {
/echo Skip Casting ${WhatSpell}. Sell Not Memed.
/varset CastResult CAST_CANCELLED
}
/if (${Debug}) /echo CastSpell Leave ${Me.GemTimer[${WhatSpell}]} ${CastResult} ${Cast.Result} Line#: ${Macro.CurLine}
/return ${CastResult}