Sub CheckHealth
/if (!${HealsOn}) /return
/if (${DebugHeal}) /echo Sub CheckHealth Enter
/declare i int local 0
/declare MostHurtName string local
/declare MostHurtType string local
/declare MostHurtID int local 0
/declare MostHurtHP int local 100
/declare MostHurtNo int local 0
/declare GroupHealthAvg string local 0
:CheckAgain
/varset MostHurtName
/varset MostHurtType
/varset MostHurtID
/varset MostHurtHP 100
/varset MostHurtNo 0
/varset HealAgain 0
/varset GroupHealthAvg 0
| Check self health
/if (${Me.PctHPs} < 100) /call SingleHeal "${Me}" PC ${Me.PctHPs} 0
| Call MA health check for only those that can heal others
/if (${Select[${Me.Class.ShortName},BST,CLR,SHM,DRU,RNG,PAL]}) {
| This is to target Main Assist out of group if class can heal
/if (${Select[${HealsOn},1,3]} && ${Spawn[${MainAssist} ${MainAssistType}].ID} && ${Spawn[${MainAssist} ${MainAssistType}].Type.NotEqual[corpse]} && ${Spawn[${MainAssist}].ID}!=${Me.Pet.ID} && ${Spawn[${MainAssist}].ID}!=${Me.ID}) {
/if ((!${Spawn[${MainAssist} ${MainAssistType} group].ID} && ${MainAssistType.NotEqual[pet]}) || (${Select[${Spawn[=${MainAssist}].Master},${Group.Member[1]},${Group.Member[2]},${Group.Member[3]},${Group.Member[4]},${Group.Member[5]}]}==0 && ${MainAssistType.Equal[pet]})) {
| Skip targeting tank if MA is defined to watch for heals in XTarget
/if (!${XTarHeal} || ${XTarHeal} && ${Me.XTarget[${XTarHeal}].ID}!=${Spawn[${MainAssist} ${MainAssistType}].ID}) {
/target id ${Spawn[${MainAssist} ${MainAssistType}].ID}
/delay 5
}
}
/if (${DebugHeal}) /echo DEBUGHEALS CheckHealth: Tank OOG: ${Spawn[${MainAssist}].PctHPs} ${Spawn[${MainAssist} ${MainAssistType}].ID} ${Spawn[${MainAssist} ${MainAssistType}].Type.NotEqual[corpse]}
/if (${Spawn[${MainAssist} ${MainAssistType}].PctHPs} < 100 || (${MainAssistType.Equal[pet]} && ${Group.Member[${MAGOwnerNum}].Pet.PctHPs} < 100)) /call SingleHeal "${MainAssist}" "${MainAssistType}" ${Spawn[${MainAssist} ${MainAssistType}].PctHPs} 6
}
| Who is the most hurt
/if (${Select[${HealsOn},1,2]} && ${Group} && !${JustZoned} && !${JoinedParty}) {
/for i 0 to ${Group}
|/if (${Select[${HealsOn},2]} && ${Group.Member[${i}].ID}==${Spawn[${MainAssist} ${MainAssistType}].ID}) /goto :NextGMember
/if (${Select[${HealsOn},2]} && ${Select[${Spawn[${MainAssist} ${MainAssistType}].ID},${Group.Member[${i}].ID},${Group.Member[${i}].Pet.ID}]}>0) /goto :NextGMember
/if (${Group} && ${Group.Member[${i}].ID} && ${Group.Member[${i}].Type.NotEqual[corpse]} && ${Group.Member[${i}].PctHPs}>=1) {
/if (${DebugHeal}) /echo DEBUGHEALS CheckHealth: -- Most Hurt:${i} ${MostHurtNo} ${MostHurtName} ${MostHurtID} ${MostHurtHP}
/if (${Group.Member[${i}].PctHPs} < ${MostHurtHP}) {
/varset MostHurtName ${Group.Member[${i}].CleanName}
/varset MostHurtType ${Group.Member[${i}].Type}
/varset MostHurtID ${Group.Member[${i}].ID}
/varset MostHurtHP ${Group.Member[${i}].PctHPs}
/varset MostHurtNo ${i}
}
/if (${Group.Member[${i}].Pet.ID}>0 && ${Group.Member[${i}].Pet.PctHPs} < ${MostHurtHP}) {
/varset MostHurtName ${Group.Member[${i}].Pet.CleanName}
/varset MostHurtType Pet
/varset MostHurtID ${Group.Member[${i}].Pet.ID}
/varset MostHurtHP ${Group.Member[${i}].Pet.PctHPs}
/varcalc MostHurtNo ${i}+8
}
}
:NextGMember
/next i
/if (${DebugHeal}) /echo DEBUGHEALS CheckHealth: (${MostHurtHP} < 100) /call SingleHeal "${MostHurtName}" "${MostHurtType}" ${MostHurtHP} ${MostHurtNo}
/if (${MostHurtHP} < 100) /call SingleHeal "${MostHurtName}" "${MostHurtType}" ${MostHurtHP} ${MostHurtNo}
}
}
| Group Heal Check only call for those clases that can group heal
/if (${Select[${Me.Class.ShortName},BST,CLR,SHM,DRU,PAL]}) {
/call GroupHealthCheck
/varset GroupHealthAvg ${Macro.Return}
/if (${DebugHeal}) /echo DEBUGHEALS CheckHealth: Group Health Average ${GroupHealthAvg}
| Check for group heals
/if (${GroupHealthAvg} < 100 && ${Group}) /call DoGrouopHealStuff ${GroupHealthAvg}
}
| Check xtarget health if on.
/if (${XTarHeal}) {
/if (${Select[${Spawn[${Me.XTarget[${XTarHeal}].ID}].Type},PC,Mercenary,Pet]} && ${Me.XTarget[${XTarHeal}].ID} && ${Spawn[${Me.XTarget[${XTarHeal}].ID}].PctHPs}<100) {
/call SingleHeal "${Spawn[${Me.XTarget[${XTarHeal}].ID}].CleanName}" "${Spawn[${Me.XTarget[${XTarHeal}].ID}].Type}" ${Spawn[${Me.XTarget[${XTarHeal}].ID}].PctHPs} 7
/if (${DebugHeal}) /echo DEBUGHEALS CheckHealth: SingleHeal "${MainAssist}" "${MainAssistType}" ${Spawn[${MainAssist} ${MainAssistType}].PctHPs} 7
}
}
/if (${AutoRezOn}) /call RezCheck
/if (${PetOn} && ${Me.Pet.ID} && ${Me.Pet.PctHPs} < 100) /call DoPetHealStuff
/if (${HealAgain}) /goto :CheckAgain
/if (${DebugHeal}) /echo Sub CheckHealth leave
/call WriteDebuffs
/return