Debuff info
Posted: Sat Aug 19, 2006 4:24 am
Yet another little utility snippet.
Debuff info is a little script that lets you see what debuffs and how much time is left on them each mob has. It detects when you cast a debuff and sends that to all is sessions(they need to be running the script of course) the spells and their remaining time will then be displayed when you select a target on any of your is sessions.
Makes the life of an enchanter so much easier =D .. (going to make a real UI for this once the enchanter gets his internet back).
Debuff info is a little script that lets you see what debuffs and how much time is left on them each mob has. It detects when you cast a debuff and sends that to all is sessions(they need to be running the script of course) the spells and their remaining time will then be displayed when you select a target on any of your is sessions.
Makes the life of an enchanter so much easier =D .. (going to make a real UI for this once the enchanter gets his internet back).
Code: Select all
;beta2
#define DEBHUD_X 500
#define DEBHUD_Y 50
function main()
{
AddTrigger Event_StartCast "You begin casting @SpellName@."
declare deb collection:collection:uint global
declare debuffs0 string global
declare debuffs1 string global
declare debuffs2 string global
declare debuffs3 string global
declare debuffs4 string global
declare debuffs5 string global
declare debuffs6 string global
declare debuffs7 string global
declare debuffs8 string global
declare spellCasted string script
variable int c = -1
while ${c:Inc}<=8
squelch hud -add debuff${c} DEBHUD_X,${Math.Calc[DEBHUD_Y+(12*${c})].Int} ${debuffs${c}}
echo Debuff info running.
while 1
{
waitframe
ExecuteQueued
call print2
}
}
function Event_StartCast(Line,SpellName)
{
echo ${SpellName}
if ${Spell[${SpellName}].SpellType.Equal[Detrimental]} && ${Target.Type.Equal[NPC]} && ${Spell[${SpellName}].Duration.TotalSeconds}>0
{
spellCasted:Set[${SpellName}]
echo cast detected!
AddTrigger Event_CastLanded "${Target.CleanName}${Spell[${SpellName}].CastOnAnother}"
AddTrigger Event_CastFailed "Your spell fizzles!"
AddTrigger Event_CastFailed "Your target cannot be mesmerized@rest@"
AddTrigger Event_CastFailed "Your casting has been interrupted!"
AddTrigger Event_CastFailed "Your spell is interrupted."
AddTrigger Event_CastFailed "Your spell did not take hold."
AddTrigger Event_CastFailed "Your spell would not have taken hold."
AddTrigger Event_CastFailed "This spell only works on @REST@"
AddTrigger Event_CastFailed "Your target is out of range, get closer!"
AddTrigger Event_CastFailed "Your target resisted the @NAME@ spell."
}
}
function Event_CastFailed(Line)
{
echo cast failed
RemoveTrigger Event_CastFailed
RemoveTrigger Event_CastLanded
}
function Event_CastLanded(Line)
{
echo cast landed
RemoveTrigger Event_CastFailed
RemoveTrigger Event_CastLanded
relay all squelch debuffed ${Target.ID} "${spellCasted}"
}
atom(global) debuffed(string mobid,string spellid)
{
echo ${spellid}
if ${Spawn[${mobid}](exists)}
{
if !${deb.Element[${mobid}](exists)}
deb:Set[${mobid}]
deb.Element[${mobid}]:Set[${spellid},${Math.Calc[${Script.RunningTime}+(${Spell[${spellid}].Duration.TotalSeconds}*1000)]}]
}
}
function print2()
{
variable int temp
variable int min
variable int sec
variable int i = 0
if ${deb.Element[${Target.ID}](exists)}
{
if ${deb.Element[${Target.ID}].FirstKey(exists)}
{
do
{
if ${deb.Element[${Target.ID}].CurrentValue}<${Script.RunningTime}
{
;spell has worn off
deb.Element[${Target.ID}]:Erase[${deb.Element[${Target.ID}].CurrentKey}]
break
}
else
{
;modulus operand sends me to desktop =/
temp:Set[${Math.Calc[(${deb.Element[${Target.ID}].CurrentValue}-${Script.RunningTime})/1000].Int}]
min:Set[${Math.Calc[${temp}/60].Int}]
sec:Set[${Math.Calc[${temp}-(${min}*60)].Int}]
debuffs${i}:Set[${deb.Element[${Target.ID}].CurrentKey} (${min}:${sec})]
squelch hudset debuff${i} -t ${debuffs${i}}
i:Inc
}
}
while ${deb.Element[${Target.ID}].NextKey(exists)}
;Clear old labels
while ${i}<=8
{
squelch hudset debuff${i} -t ""
i:Inc
}
}
}
else
{
if ${deb.FirstKey(exists)}
{
do
{
if !${Spawn[${deb.CurrentKey}](exists)}
{
deb:Erase[${deb.CurrentKey}]
break
}
}
while ${deb.NextKey(exists)}
}
variable int c = -1
while ${c:Inc}<=8
squelch hudset debuff${c} -t ""
}
}
function atexit()
{
echo debuff info has ended..
squelch hud -remove debuff0
squelch hud -remove debuff1
squelch hud -remove debuff2
squelch hud -remove debuff3
squelch hud -remove debuff4
squelch hud -remove debuff5
squelch hud -remove debuff6
squelch hud -remove debuff7
squelch hud -remove debuff8
}