Code: Select all
; fixed a few problems 9-5-6
; Spell_Routines.inc 3.0.1
; fixed timers for recasts,
; spell_routines.inc 2.5.0
; Originally Written by Rusty~
; Much code and logic stolen from A_Druid_00
; Translated for ISXEQ by echoism
; Requires ISXEQExchange for item swap
; spell_routines.inc 2.5
; Fixed by iluvseq
; Modified for ISXEQ by echoism
; Originally Written by Rusty~
; Much logic and code stolen from A_Druid_00
; Requires IXSEQExchange for item swap
; Also includes FD fix that would cause an endless loop if you were hit by FD mid-cast (originally by A_Druid_00)
; Features:
; - Casts spells, clicks items, or uses AA abilities for you
; - Allows back to back casting without waiting on spell gems to pop all the way up
; - Will interrupt spell if target dies while casting. If on a mount, it will dismount and duck if the time left
; is greater than 7 seconds, else it will move forward a bit to interrupt, then move you back
; IMPORTANT: if you don't want to interrupt a spell while mounted, put this at the top of your script:
; variable int noInterrupt=
; - Allows you to use items in bags. Equips item, clicks it, then returns it to its previous location
; - Lets you set how long you want to keep trying to cast the spell (defaults to 0)
; If the spell is interrupted before the given time, it will recast, else it will return CAST_INTERRUPTED
; - Lets you call a custom subroutine while waiting for spell to finish casting
; Try to keep custom functions very small. A common use would be to interrupt the spell if a certain condition is true
; - This file also includes a function named Interrupt. You can call this to interrupt any spell you're casting instantly.
; - You can also use the SwapItem sub included in this to swap items to certain slots
; - Added EquipItem sub to easily equip items in your main Inventory slots.
; - Note: if you don't want this to cast spells while you're invis, in your main function have this at the top:
; variable int noInvis=1
; - This will make it return CAST_INVIS if you're invis
; Below is a list of variables you can access in your script:
; refreshTime - How much time is left till you're done recovering from casting
; castEndTime - How much time left till you're done casting the current spell... usable in custom spell Subs
; spellNotHold - 1 if your last spell didn't take hold, 0 otherwise
; spellRecastTime1..9 - How much time left till that spell is back up
;======================================================================================================================
; EquipItem: An easier way to equip items you have in bags ( useful for weapons or focus items )
; slot name is optional. If not given, it will equip it in the first possible spot
; Usage:
; call EquipItem "item name|slotname"
; Returns: "old item name|slotname"
; Examples:
; To Equip Sharp Ended Broken Lever when you have Serpent of Vindication equiped:
; call EquipItem "Sharp Ended Broken Lever"
; It will return "Staff of Vindication|mainhand"
; To reequip the original item, you can save the return in a variable, and then use it later like this:
; oldPrimary:Set[${Return}]
; ... do stuff here with your new item equiped
; call EquipItem ${oldPrimary}
;======================================================================================================================
; SwapItem: a subroutine which is used in the Cast function itself. You don't need to do this to cast an item in a bag
; but you can call it in your script to swap items (such as weapons or focus items)
; Usage:
; call SwapItem "item name" slotname
; Examples:
; To swap Darkblade of the Warlord to your main hand:
; call SwapItem "Darkblade of the Warlord" mainhand
; To swap stat food in one bag with other food in another bag:
; call SwapItem "Bristlebanes Party Platter" ${FindItem[halas 10lb meat pie].InvSlot}
;======================================================================================================================
; Cast: the main function that casts spells or items for you
; Usage:
; call Cast "spellname|itemname|AAname|AA#" [item|alt|gem#] [give up time][m|s] [custom subroutine name] [Number of resist recasts]
; Examples:
; To cast Howl of Tashan and mem it in slot 3 if not memmed:
; call Cast "Howl of Tashan" gem3
; To cast Arcane Rune and keep trying for 7 seconds, in case of interrupts.
; call Cast "Arcane Rune" gem5 7s
; To click Grim Aura earring that's in a bag:
; call Cast "Shrunken Goblin Skull Earring" item
; To use AA ability Eldritch Rune:
; call Cast "Eldritch Rune" alt
; or
; call Cast "173" alt
; To call a subroutine that interrupts CH if target gets healed before it lands:
; call Cast "Complete Healing" gem1 0 CheckHP
; Then in your script have somewhere:
; function CheckHP()
; {
; if ${Target.PctHPs}>=80
; call Interrupt
; }
; Returns these values:
;-----------------------+-----------------------------------------------------------------------+
; CAST_CANCELLED | Spell was cancelled by ducking (either manually or because mob died) |
; CAST_CANNOTSEE | You can't see your target |
; CAST_IMMUNE | Target is immune to this spell |
; CAST_INTERRUPTED | Casting was interrupted and exceeded the given time limit |
; CAST_INVIS | You were invis, and noInvis is set to true |
; CAST_NOTARGET | You don't have a target selected for this spell |
; CAST_NOTMEMMED | Spell is not memmed and you gem to mem was not specified |
; CAST_NOTREADY | AA ability or spell is not ready yet |
; CAST_OUTOFMANA | You don't have enough mana for this spell! |
; CAST_OUTOFRANGE | Target is out of range |
; CAST_RESISTED | Your spell was resisted! |
; CAST_SUCCESS | Your spell was cast successfully! (yay) |
; CAST_UNKNOWNSPELL | Spell/Item/Ability was not found |
;-----------------------+-----------------------------------------------------------------------+
#define _SPELL_ROUTINES_ 2.5.0
#macro pausecheck(a)
if (a>0.1 && !${Me.Spawn.Class.Name.Equal[Bard]})
{
if (${Stick.Status.Equal[ON]})
Stick pause
if (${FollowFlag})
call PauseFunction
if (${Me.Moving})
Keypress back
}
#endmac
#macro sr_ProcessQueue()
if ${QueuedCommands}
while ${QueuedCommands}
ExecuteQueued
#endmac
objectdef rscripttimer
{
variable bool StopWatch=FALSE
variable uint EndTime
method Set(string settime)
{
variable string temptime
if ${settime.Left[1].Equal[-]}
{
StopWatch:Set[TRUE]
EndTime:Set[${Script.RunningTime}]
return
}
if ${settime.Find[:]}
switch ${settime.Count[:]}
{
case 2
temptime:Set[${Math.Calc[${settime.Token[1,:]}*3600 + ${settime.Token[2,:]}*60 + ${settime.Token[3,:]}].Int}000]
break
case 1
temptime:Set[${Math.Calc[${settime.Token[1,:]}*60 + ${settime.Token[2,:]}].Int}000]
break
default
temptime:Set[0]
}
else
switch ${settime.Right[1]}
{
case s
temptime:Set[${settime.Left[${Math.Calc[${settime.Length}-1]}]}000]
break
case m
temptime:Set[${Math.Calc[${settime.Left[${Math.Calc[${settime.Length}-1]}]}*60].Int}000]
break
case 0
case 1
case 2
case 3
case 4
case 5
case 6
case 7
case 8
case 9
temptime:Set[${settime}00]
break
default
temptime:Set[0]
}
StopWatch:Set[FALSE]
EndTime:Set[${temptime}+${Script.RunningTime}]
}
member:uint TimeLeft()
{
if ${Script.RunningTime}>=${EndTime}
if ${StopWatch}
return ${Math.Calc[${Script.RunningTime}-${EndTime}]}
else
return 0
return ${Math.Calc[${EndTime}-${Script.RunningTime}]}
}
member:uint ToText()
{
if ${Script.RunningTime}>=${EndTime}
if ${StopWatch}
return ${Math.Calc[(${Script.RunningTime}-${EndTime})/100].Int}
else
return 0
return ${Math.Calc[(${EndTime}-${Script.RunningTime})/100].Int}
}
member:uint TotalSeconds()
{
if ${Script.RunningTime}>=${EndTime}
if ${StopWatch}
return ${Math.Calc[((${Script.RunningTime}-${EndTime})/1000)].Int}
else
return 0
return ${Math.Calc[((${EndTime}-${Script.RunningTime})/1000)].Int}
}
member:uint Hours()
{
if ${Script.RunningTime}>=${EndTime}
if ${StopWatch}
return ${Math.Calc[((${Script.RunningTime}-${EndTime})/1000)/3600].Int}
else
return 0
return ${Math.Calc[((${EndTime}-${Script.RunningTime})/1000)/3600].Int}
}
member:uint Minutes()
{
if ${Script.RunningTime}>=${EndTime}
if ${StopWatch}
return ${Math.Calc[((${Script.RunningTime}-${EndTime})/1000)/60%60].Int}
else
return 0
return ${Math.Calc[((${EndTime}-${Script.RunningTime})/1000)/60%60].Int}
}
member:uint Seconds()
{
if ${Script.RunningTime}>=${EndTime}
if ${StopWatch}
return ${Math.Calc[((${Script.RunningTime}-${EndTime})/1000)%60].Int}
else
return 0
return ${Math.Calc[((${EndTime}-${Script.RunningTime})/1000)%60].Int}
}
member:string HMS()
{
variable int h=${Math.Calc[((${EndTime}-${Script.RunningTime})/1000)/3600].Int}
variable int m=${Math.Calc[((${EndTime}-${Script.RunningTime})/1000)/60%60].Int}
variable int s=${Math.Calc[((${EndTime}-${Script.RunningTime})/1000)%60].Int}
if ${Script.RunningTime}>=${EndTime}
if ${StopWatch}
{
h:Set[${Math.Calc[((${Script.RunningTime}-${EndTime})/1000)/3600].Int}]
m:Set[${Math.Calc[((${Script.RunningTime}-${EndTime})/1000)/60%60].Int}]
s:Set[${Math.Calc[((${Script.RunningTime}-${EndTime})/1000)%60].Int}]
return "${If[${h}>0,${h}:,]}${If[${m}>9,${m},0${m}]}:${If[${s}>9,${s},0${s}]}"
}
else
return ""
return "${If[${h}>0,${h}:,]}${If[${m}>9,${m},0${m}]}:${If[${s}>9,${s},0${s}]}"
}
}
variable int ResistCounter
variable bool moveBack=FALSE
variable int selfResist=0
variable string selfResistSpell
variable rscripttimer giveUpTimer
variable rscripttimer castEndTime
variable rscripttimer refreshTime
variable float itemRefreshTime
variable int spellNotHold=0
variable int noInterrupt=0
variable rscripttimer spellRecastTime1
variable rscripttimer spellRecastTime2
variable rscripttimer spellRecastTime3
variable rscripttimer spellRecastTime4
variable rscripttimer spellRecastTime5
variable rscripttimer spellRecastTime6
variable rscripttimer spellRecastTime7
variable rscripttimer spellRecastTime8
variable rscripttimer spellRecastTime9
variable bool init=TRUE
variable string castReturn="CAST_CANCELLED"
variable int barddelay=32
function Cast(string spellName, string spellType, int giveUpValue, string mySub, int ResistTotal)
{
if !${spellType.Length}
spellType:Set[spell]
ext -require ISXEQ
if "!${Script[exchange](exists)}"
ext -require ISXEQExchange
variable int i=0
variable int spellID
if ${Me.Spawn.Invis} && ${noInvis}
return CAST_INVIS
if ${init}
{
call cast_add_triggers
for (i:Set[1] ; ${i}<=9 ; i:Inc)
{
if ${Me.SpellReady[${i}]}
spellRecastTime${i}:Set[0]
else
spellRecastTime${i}:Set[10*${Me.Gem[${i}].RecastTime}]
}
}
giveUpTimer:Set[${giveUpValue}*10]
ResistCounter:Set[${ResistTotal}]
spellNotHold:Set[0]
selfResist:Set[0]
while (${Me.Casting.ID(exists)} || (${Me.Moving} && ${castTime}>0.1))
if ${mySub.Length} && ${mySub.NotEqual[NULL]}
call "${mySub}" "${spellID}"
if (${Window[SpellBookWnd].Open})
Keypress spellbook
castReturn:Set[X]
Switch ${spellType}
{
case item
if !${FindItem[${spellName}].InvSlot}
return CAST_UNKNOWNSPELL
pausecheck(${FindItem[${spellName}].CastTime})
call ItemCast "${spellName}" "${mySub}"
break
case alt
if !${Me.AltAbility[${spellName}].ID}
return CAST_UNKNOWNSPELL
pausecheck(${Me.AltAbility[${spellName}].Spell.MyCastTime})
call AltCast "${spellName}" "${mySub}"
break
default
if !${Me.Book[${spellName}](exists)}
return CAST_UNKNOWNSPELL
spellID:Set[${Me.Book[${Me.Book[${spellName}]}].ID}]
if ${Me.CurrentMana}<${Spell[${spellID}].Mana}
return CAST_OUTOFMANA
pausecheck(${Spell[${spellName}].MyCastTime})
call SpellCast "${spellType}" "${spellName}" "${spellID}" "${mySub}" "${giveUpValue}"
}
if (${Stick.Status.Equal[PAUSED]})
Stick unpause
if (${PauseFlag})
call PauseFunction
giveUpTimer:Set[0]
ResistCounter:Set[0]
WaitFrame
return ${castReturn}
}
function SpellCast(string spellType, string spellName, int spellID, string mySub, int giveUpValue)
{
variable rscripttimer recoverWaitTime=30
variable bool retrySpell=FALSE
; echo SpellCast() debug - spellName = ${spellName}
if !${Me.Gem[${spellName}]}
{
if ${Cursor.ID}
call ClearCursor
if ${spellType.Left[3].Equal[gem]}
memspell ${spellType.Right[1]} "${spellName}"
else
return CAST_NOTMEMMED
}
if ${mySub.Length} && ${mySub.NotEqual[NULL]}
call ${mySub} ${spellID}
Wait 90 ${Me.Gem[${spellName}]}
if (${Me.Gem[${spellName}]})
spellRecastTime${Me.Gem[${spellName}]}:Set[10*${Spell[${spellID}].RecastTime}]
else
return CAST_INTERRUPTED
while (!${Me.SpellReady[${spellName}]})
{
if ${mySub.Length} && ${mySub.NotEqual[NULL]}
call ${mySub} ${spellID}
Wait 150 ${Me.SpellReady[${spellName}]}
if (!${giveUpTimer} && !${Me.SpellReady[${spellName}]})
return CAST_NOTREADY
}
if ${spellName.Find[illusion: ]} && ${Me.AltAbilityReady[project illusion]}
call Cast "project illusion" alt
giveUpTimer:Set[${giveUpValue}*10]
do
{
if (!${Me.SpellReady[${spellName}]} && (${spellRecastTime${Me.Gem[${spellName}]}}<${giveUpTimer} || ${refreshTime}>0 || ${castReturn.Equal[CAST_RESISTED]}))
{
if ${mySub.Length} && ${mySub.NotEqual[NULL]}
call ${mySub} ${spellID}
continue
}
else
{
if (!${Me.SpellReady[${spellName}]} && !${castReturn.Equal[CAST_RESISTED]})
return CAST_NOTREADY
}
waitframe
Me:Stand
CastSpell "${spellName}"
if ${Me.Class.ShortName.Equal[BRD]}
timedcommand ${barddelay} EQExecute /stopsong
Wait 10 ${QueuedCommands}
sr_ProcessQueue()
if (${Me.Spawn.Casting.ID})
{
spellID:Set[${Me.Spawn.Casting.ID}]
castEndTime:Set[${Me.Spawn.Casting.MyCastTime}*10]
if (${castEndTime}<${Math.Calc[${Me.Spawn.Casting.CastTime}*5]})
castEndTime:Set[${Me.Spawn.Casting.CastTime}*5]
}
moveBack:Set[FALSE]
if ${mySub.Length} && ${mySub.NotEqual[NULL]}
call WaitCast ${mySub} ${spellID}
else
call WaitCast
if (${moveBack})
{
Keypress back hold
Wait 4
Keypress back
Wait 15 !${Me.Moving}
}
sr_ProcessQueue()
retrySpell:Set[TRUE]
Switch ${castReturn}
{
case CAST_CANCELLED
return CAST_CANCELLED
case CAST_RECOVER
castReturn:Set[CAST_NOTREADY]
if !${recoverWaitTime}
{
spellRecastTime${Me.Gem[${spellName}]}:Set[10*${Spell[${spellID}].RecastTime}]
if !${giveUpTimer}
return CAST_NOTREADY
}
break
case CAST_RESTART
case CAST_INTERRUPTED
if !${giveUpTimer}
return CAST_INTERRUPTED
break
case CAST_RESISTED
if !${ResistCounter}
return CAST_RESISTED
break
case CAST_STUNNED
case CAST_FIZZLE
case CAST_COLLAPSE
break
case CAST_SUCCESS
default
retrySpell:Set[FALSE]
}
}
while ${retrySpell}
{
if (!${castReturn.Equal[CAST_CANNOTSEE]} && !${castReturn.Equal[CAST_OUTOFRANGE]} && !${castReturn.Equal[CAST_OUTOFMANA]} && !${castReturn.Equal[CAST_NOTARGET]} && !${castReturn.Equal[CAST_INTERRUPTED]})
{
refreshTime:Set[10*${Spell[${spellID}].RecoveryTime}]
spellRecastTime${Me.Gem[${spellName}]}:Set[10*${Spell[${spellID}].RecastTime}]
}
}
}
function ItemCast(string spellName,string mySub)
{
variable int charges
variable string oldItemName
variable string slotName
variable bool swapItemBack=FALSE
variable bool retrySpell
do
{
if (${FindItem[${spellName}].InvSlot}>21)
{
swapItemBack:Set[TRUE]
if (${FindItem[${spellName}].WornSlot[1]} && ${FindItem[${spellName}].EffectType.Find[worn]})
slotName:Set[${FindItem[${spellName}].WornSlot[1].Name}]
elseif (${FindItem[${spellName}].InvSlot}>29)
slotName:Set[pack8]
else
slotName:Set[${FindItem[${spellName}].InvSlot.Name}]
oldItemName:Set[${InvSlot[${slotName}].Item.Name}]
call SwapItem "${spellName}" ${slotName}
}
while (${itemRefreshTime}>${MacroQuest.Running})
WaitFrame
itemRefreshTime:Set[${Math.Calc[${MacroQuest.Running}+000]}]
charges:Set[${FindItem[${spellName}].Charges}]
Me:Stand
waitframe
CastSpell item "${spellName}"
Wait 10 ${QueuedCommands}
sr_ProcessQueue()
if (${Me.Spawn.Casting.ID})
castEndTime:Set[${FindItem[${spellName}].CastTime}*10]
if (${charges})
Wait 10 ${FindItem[${spellName}].Charges}!=${charges}
call WaitCast ${mySub}
if (${swapItemBack} && ${FindItem[${oldItemName}].ID})
call SwapItem "${oldItemName}" ${slotName}
retrySpell:Set[TRUE]
sr_ProcessQueue()
Switch ${castReturn}
{
case CAST_CANCELLED
return CAST_CANCELLED
case CAST_NOTREADY
case CAST_RECOVER
castReturn:Set[CAST_NOTREADY]
if !${giveUpTimer}
return CAST_NOTREADY
break
case CAST_RESTART
case CAST_INTERRUPTED
castReturn:Set[CAST_INTERRUPTED]
if !${giveUpTimer}
return CAST_INTERRUPTED
break
case CAST_RESISTED
if !${ResistCounter}
return CAST_RESISTED
break
case CAST_STUNNED
case CAST_COLLAPSE
break
case CAST_SUCCESS
default
retrySpell:Set[FALSE]
}
}
while ${retrySpell}
}
function AltCast(string spellName,string mySub)
{
variable bool retrySpell
Me:Stand
waitframe
do
{
EQExecute /alt activate ${Me.AltAbility[${spellName}].ID}
if ${Me.Spawn.Casting.ID}
castEndTime:Set[${Me.AltAbility[${spellName}].Spell.MyCastTime}*10]
Wait 10 ${QueuedCommands}
sr_ProcessQueue()
call WaitCast ${mySub}
sr_ProcessQueue()
retrySpell:Set[TRUE]
Switch ${castReturn}
{
case CAST_CANCELLED
return CAST_CANCELLED
case CAST_NOTREADY
case CAST_RECOVER
castReturn:Set[NOTREADY]
if !${giveUpTimer}
return CAST_NOTREADY
break
case CAST_RESTART
case CAST_INTERRUPTED
if !${giveUpTimer}
return CAST_INTERRUPTED
break
case CAST_RESISTED
if !${ResistCounter}
return CAST_RESISTED
break
case CAST_STUNNED
case CAST_COLLAPSE
break
case CAST_SUCCESS
default
retrySpell:Set[FALSE]
}
}
while ${retrySpell}
}
function ClearCursor()
{
variable int i=0
while (${Cursor.ID})
{
if (${Cursor.Container})
while (${i:Inc}<=8)
if (!${InvSlot[pack${i}].Item.Container})
NoModKey itemnotify pack${i} leftmouseup
else
EQExecute /autoinventory
}
}
function EquipItem(WhatWhere)
{
variable string DestName
variable string ItemName=${WhatWhere.Token[1,|]}
variable string SlotName=${WhatWhere.Token[2,|]}
if (${SlotName.Equal[NULL]})
SlotName:Set[${InvSlot[${FindItem[=${ItemName}].WornSlot[1]}].Name}]
if (${FindItem[=${ItemName}].InvSlot}<22 || !${FindItem[=${ItemName}].WornSlot[${SlotName}]})
return
if (!${InvSlot[${SlotName}].Item.Name.Equal[NULL]})
DestName:Set["${InvSlot[${SlotName}].Item.Name}|${SlotName}"]
call SwapItem "${ItemName}" "${SlotName}"
return ${DestName}
}
function Interrupt()
{
;; TODO remove the dismount?
if (${Me.Spawn.Mount.ID})
EQExecute /dismount
EQExecute /stopcast
while ${Me.Spawn.Casting.ID}
WaitFrame
castReturn:Set[CAST_CANCELLED]
return ${castReturn}
}
function SwapItem(string itemName,string slotName)
{
if (${Cursor.ID})
call ClearCursor
exchange "${itemName}" ${slotName}
Wait 50 ${InvSlot[${slotName}].Item.Name.Equal[${itemName}]}
if (${Cursor.ID})
call ClearCursor
return
}
function WaitCast(string mySub,int spellID)
{
variable int currentTarget=${Target.ID}
variable string currentTargetType=${Target.Type}
do
{
if ${mySub.Length} && ${mySub.NotEqual[NULL]}
call ${mySub} ${spellID}
if (${Me.Spawn.Casting.ID})
{
if (${currentTarget} && !${Spawn[${currentTarget}].Type.Equal[${currentTargetType}]})
{
if (!${Me.Spawn.Casting.TargetType.Equal[PB AE]} && !${Me.Spawn.Casting.TargetType.Equal[self]} && !${moveBack} && (!${Me.Mount.ID} || !${noInterrupt}))
{
if (!${Me.Mount.ID} || ${castEndTime}>70)
{
call Interrupt
}
elseif (${Me.Spawn.Casting.RecastTime}>3)
{
castReturn:Set[CAST_CANCELLED]
EQExecute /stopcast
moveBack:Set[true]
}
}
}
if (${Me.Spawn.State.Equal[DUCK]})
castReturn:Set[CAST_CANCELLED]
}
}
while (${Me.Spawn.Casting.ID})
}
function cast_add_triggers()
{
AddTrigger cast_begin "You begin casting @SPELL@."
AddTrigger cast_collapse "Your gate is too unstable, and collapses."
AddTrigger cast_fdfail "@PERSON@ has fallen to the ground."
AddTrigger cast_fizzle "Your spell fizzles!"
AddTrigger cast_immune "Your target is immune to changes in its @WHAT@ speed."
AddTrigger cast_immune "Your target cannot be mesmerized@rest@"
AddTrigger cast_interrupt "Your casting has been interrupted!"
AddTrigger cast_interrupt "Your spell is interrupted."
AddTrigger cast_interrupt "Aborting memorization of spell."
AddTrigger cast_nohold "Your spell did not take hold."
AddTrigger cast_nohold "Your spell would not have taken hold."
AddTrigger cast_nohold "You must first target a group member@REST@"
AddTrigger cast_nohold "Your spell is too powerful for your intended target@REST@"
AddTrigger cast_nohold "This spell only works on @REST@"
AddTrigger cast_nolos "You cannot see your target."
AddTrigger cast_notarget "You must first select a target for this spell!"
AddTrigger cast_notready "Spell recast time not yet met."
AddTrigger cast_notready "You can use the ability @ALT@ again in @MIN@ minute(s) @SEC@ seconds."
AddTrigger cast_outofmana "Insufficient Mana to cast this spell!"
AddTrigger cast_outofrange "Your target is out of range, get closer!"
AddTrigger cast_recover "You haven't recovered yet..."
AddTrigger cast_recover "Spell recovery time not yet met."
AddTrigger cast_resisted "Your target resisted the @NAME@ spell."
AddTrigger cast_resisted2 "You resist the @NAME@ spell."
AddTrigger cast_standing "You must be standing to cast a spell."
AddTrigger cast_stunned "You are stunned!"
AddTrigger cast_stunned "You cannot cast spells while stunned!"
AddTrigger cast_stunned "You *CANNOT* cast spells, you have been silenced!"
}
function cast_remove_triggers()
{
RemoveTrigger cast_begin
RemoveTrigger cast_collapse
RemoveTrigger cast_fdfail
RemoveTrigger cast_fizzle
RemoveTrigger cast_immune
RemoveTrigger cast_interrupted
RemoveTrigger cast_nohold
RemoveTrigger cast_nolos
RemoveTrigger cast_notarget
RemoveTrigger cast_notready
RemoveTrigger cast_outofmana
RemoveTrigger cast_outofrange
RemoveTrigger cast_recover
RemoveTrigger cast_resisted
RemoveTrigger cast_resisted2
RemoveTrigger cast_standing
RemoveTrigger cast_stunned
}
function cast_begin()
{
castReturn:Set[CAST_SUCCESS]
}
function cast_collapse()
{
castReturn:Set[CAST_COLLAPSE]
}
function cast_fdfail(line,name)
{
if ${name.Equal[${Me.Name}]}
{
if !${Me.Spawn.State.Equal[STAND]}
Me:Stand
castReturn:Set[CAST_RESTART]
}
}
function cast_fizzle()
{
castReturn:Set[CAST_FIZZLE]
}
function cast_immune()
{
castReturn:Set[CAST_IMMUNE]
}
function cast_interrupt()
{
if !${castReturn.Equal[CAST_CANCELLED]}
castReturn:Set[CAST_INTERRUPTED]
}
function cast_nohold()
{
spellNotHold:Set[1]
castReturn:Set[CAST_IMMUNE]
}
function cast_nolos()
{
castReturn:Set[CAST_CANNOTSEE]
}
function cast_notarget()
{
castReturn:Set[CAST_NOTARGET]
}
function cast_notready()
{
castReturn:Set[CAST_NOTREADY]
}
function cast_outofmana()
{
castReturn:Set[CAST_OUTOFMANA]
}
function cast_outofrange()
{
castReturn:Set[CAST_OUTOFRANGE]
}
function cast_recover()
{
castReturn:Set[CAST_RECOVER]
}
function cast_resisted(line,name)
{
if (${selfResist} && ${name.Equal[${selfResistSpell}]})
selfResist:Set[0]
if (${ResistCounter})
ResistCounter:Dec
castReturn:Set[CAST_RESISTED]
}
function cast_resisted1(line,name)
{
selfResist:Set[1]
selfResistSpell:Set[${name}]
}
function cast_standing()
{
Me:Stand
castReturn:Set[CAST_RESTART]
}
function cast_stunned()
{
if (${Me.Stunned})
Wait 30 !${Me.Stunned}
else
Wait 7
castReturn:Set[CAST_STUNNED]
}