#Event BackOff "[MQ2] BackOff"
#Event BackOff "[MQ2] BackOff #1#"
Sub Assist
/if ((${DMZ} && ${Me.InInstance}==FALSE) || (!${MeleeOn} && !${DPSOn} && !${MezOn}) || ${DPSPaused}<3 || ${Me.Hovering} || (${Pulled} && ${MyTargetID} && ${MainAssist.Equal[${Me}]})) /return
Sub Combat
/doevents
/if (!${MyTargetID} || !${Target.ID} || (${DMZ} && ${Me.InInstance}==FALSE) || !${Target.LineOfSight} || ${DPSPaused}<3 || (${Select[${Role},puller,pullertank,pullerpettank]} && ${Math.Distance[${CampYLoc},${CampXLoc}]}>=${CampRadius} && ${Pulling})) /return
Sub CombatCast
/if (${DebugCombat}) /echo DEBUGCOMBAT CombatCast Enter
/declare i int local 0
/declare DPSStart int local ${Math.Calc[${DebuffCount}+1]}
/declare DPSText string local
/declare DPSAt int local ${AssistAt}
/declare DPSTargetID int local ${MyTargetID}
/declare DPSItem string local
/for i ${DPSStart} to ${DPS.Size}
/doevents
/call CombatTargetCheck
/if (${Spawn[${MyTargetID}].Type.Equal[Corpse]} || !${Spawn[${MyTargetID}].ID}) {
/if (${DebugCombat}) /echo CombatCast: Return from CombatCast cause my target is a corpse or dead.
/return
}
/if (${DPSPaused}<3) {
/if (${DebugCombat}) /echo CombatCast: Return from CombatCast cause DPSPaused is ${DPSPaused}
/return
}
Sub CombatPet
/if (${DebugCombat}) /echo DEBUGCOMBAT CombatPet: Enter
/if (${PetAttack} || ${DPSPaused}<3) /return
Sub CheckForAdds(CalledFrom)
/doevents
/if (${Debug}) /echo DEBUG CheckForAdds: Enter from ${CalledFrom}
/call MobRadar ${MeleeDistance} CheckForAdds
/if (${Debug}) /echo DEBUG MobCount:${MobCount}
| If no mobs, in a DMZone or pulling Leave
/if (${MobCount}<=1 || (${DMZ} && ${Me.InInstance}==FALSE)|| ${Pulling} || (!${DPSOn} && !${MeleeOn}) || (${Select[${Role},puller,pullertank,pullerpettank]} && ${Math.Distance[${CampYLoc},${CampXLoc}]}>=${CampRadius}) || ${IAmDead}) /return
/if (${ChainPull}==2 || ${DPSPaused}<3) /return
Sub DoDebuffStuff(int FirstMobID)
/if (${DebugCombat}) /echo DEBUGDEBUFF DoDebuffStuff: Enter
/doevents
/if (!${DebuffAllOn} || !${DebuffCount} || ${Window[RespawnWnd].Open} || (${DMZ} && ${Me.InInstance}==FALSE) || (!${MyTargetID} && ${Spawn[=${MainAssist}].ID} && ${Spawn[=${MainAssist}].Type.NotEqual[Mercenary]})) /return
|/if (${Role.Find[tank]}) /return
/if (${DPSPaused}<3) {
/if (${DebugCombat}) /echo DoDebuffStuff: Return from CombatCast cause DPSPaused is ${DPSPaused}
/return
}
/declare i int local 0
/declare j int local 0
/declare k int local 0
/declare DebuffTargetID int local 0
/declare DebuffText string local
/if (${IAmABard} && ${MainAssist.Equal[${Me}]} && ${MyTargetID} && ${AggroTargetID}) {
/if (${DebugCombat}) /echo im a bard and stuff so im getting out of here. Returning
/return
}
/call MobRadar ${MeleeDistance} DoDebuffStuff
/for i 1 to ${DebuffCount}
/if (${DBOList${i}.Length}) {
/varset k 1
/if (!${DBOTimer${i}}) {
| Reset the list with only the current DPS mob ID. So you won't try and debuff the mob again.
/varset DBOList${i} |${MyTargetID}
} else {
|Remove mobs from list that are dead or over 200 units away.
/while (${DBOList${i}.Arg[${k},|].Length}) {
/if (!${Spawn[${DBOList${i}.Arg[${k},|]}].ID} || ${Spawn[${DBOList${i}.Arg[${k},|]}].Distance}>200 || ${Spawn[${DBOList${i}.Arg[${k},|]}].Type.Equal[Corpse]}) {
/varset DBOList${i} ${DBOList${i}.Replace[|${DBOList${i}.Arg[${k},|]},]}
} else {
/varcalc k ${k}+1
}
}
}
}
/next i
| For Mobs
/if (${DebugCombat}) /echo MobCount was ${MobCount} MainAssist: ${MainAssist} FirstMobID: ${FirstMobID} MyTargetID: ${MyTargetID}
/call DebuffCast "${FirstMobID}" 1
/for j 1 to 13
|--- only call code for GroupEscape kick off.
/if (${GroupEscapeOn} && ${Select[${Me.Class.ShortName},WIZ,DRU]} && (${Raid.Members}==0)) /call GroupEscape
|/if (${MezOn}) /call DoMezStuff
|/if (${HealsOn}) /call CheckHealth
|/if (${CuresOn}) /call CheckCures
/if (${DPSPaused}<3) {
/if (${DebugCombat}) /echo DEBUGCOMBAT DoDebuffStuff: Return from CombatCast cause DPSPaused is ${DPSPaused}
/return
}
Sub DebuffCast(int DebuffTargetID, int FWait)
/declare c int local 0
/declare f int local 0
/declare g int local 0
/declare i int local 0
/declare DebuffText string local
/declare TempTimer timer local 0
/declare Tag1 string local
/declare Tag2 string local
/declare echoTimer timer local 0
| **************** For Spells *****************************
/if (${DebugCombat}) /echo DebuffCast Enter.
| g - is control variable for remaining in loop while checking for mobs to debuff and spell is ready to cast.
| c - is to tell if the current mob is NOT on the Debuffed List or the debufftimer has runout. c=1 mob needs debuff, c=0 Mob can be skipped
| f - is a flag that is changed if we find a mob to debuff, but the current Spell or AA is not ready for casting, f=1 Spells/AA's were ready, f=0 Spell/AA not ready.
| i - is the index of the debuff to cast.
| !${c} This mob has all debuffs, !${f} There is a debuff that was not ready for this mob.
/while (1) {
/varset TempTimer 70
/varset g 1
/while (${g} && ${TempTimer}) {
/varset c 0
/varset f 1
/if (${i}==${DebuffCount}) /varset i 0
/while (${f} && ${i}<${DebuffCount}) {
/varcalc i ${i}+1
/varset DebuffText ${DPS[${i}].Arg[1,|]}
/if (${DebugCombat}) /echo ${DPS[${i}].Length} ${DebuffText.NotEqual[null]} ${DBOList${i}.Find[|${DebuffTargetID}]} ${DBOTimer${i}} ${i} ${DebuffCount} ${TempTimer}
|If mob not on list or debuff timer expired then increment counter of mobs needing debuff.
/if (${DPS[${i}].Length} && ${DebuffText.NotEqual[null]} && (!${DBOList${i}.Find[|${DebuffTargetID}]} || !${DBOTimer${i}})) {
/varset c 1
| is spell or AA ready to cast? If ready set flag to drop out of loop.
/if (${Select[TRUE,${Me.SpellReady[${DebuffText}]},${Me.AltAbilityReady[${DebuffText}]}]}) {
/varset f 0
} else {
/if (${FWait} && !${echoTimer}) {
/if (${Me.SpellInCooldown}) {
/if (${Int[${Me.Gem[${DebuffText}]}]}) {
/if (!${Me.GemTimer[${DebuffText}]}) {
/echo Waiting on Spell Global Cool Down To Cast ${DebuffText}
/varset echoTimer 3s
}
}
} else /if (${Int[${Me.Gem[${DebuffText}]}]} && ${Me.GemTimer[${DebuffText}]}) {
/echo Waiting on Spell: ${DebuffText} to Refresh. Time Remaining: ${Me.GemTimer[${DebuffText}].TotalSeconds} Seconds.
/varset echoTimer ${Me.GemTimer[${DebuffText}]}
}
}
}
}
}
/if (!${c} || !${f} || (${f} && !${FWait})) /varset g 0
}
/if (${DebugCombat}) /echo DEBUGCOMBAT DebuffCast 0 DebuffTargetID: ${DebuffTargetID} ${i} C: ${c} F: ${f} FWait: ${FWait}
/doevents
/if (${DPSPaused}<3) {
/if (${DebugCombat}) /echo DebuffCast: Return from CombatCast cause DPSPaused is ${DPSPaused}
/return
}
Sub Event_BackOff(Line, int KillMobsInCamp)
/if (${DPSPaused}) {
/if ((${DPSPaused}==2 || ${DPSPaused}==4) && ${UseMQ2Melee}) /squelch /melee on
/varset DPSPaused 0
/echo Resetting. No Longer Backing off.
} else {
/varset DPSPaused 1
/if (${Melee.Combat} || ${Me.Combat}) {
/varset CombatStart 0
/if (${UseMQ2Melee}) /squelch /melee off
/squelch /attack off
/call CombatReset
/varset DPSPaused 2
/if (${Stick.Active}) /stick off
}
/echo Backing off - All Combat has been reset.
}
/if (${ReturnToCamp} && ${Math.Distance[${CampYLoc},${CampXLoc}]}>10) {
/call DoWeMove
}
/if (${KillMobsInCamp} && ${DPSPaused}) /varcalc DPSPaused ${DPSPaused}+2
/doevents flush Event_BackOff
/return