genbot - bothealer - group fix
Posted: Sun Mar 13, 2005 12:04 pm
After updating MQ2 bothealer in the last version of genbot is slightly broken. I have hopefully fixed this.
Code: Select all
|bothealer.inc
|Bot healer module.
|Version 13.3.5
|Date:08/29/2004
|
||**
[bothealer]
version=13.3.5
**||
Sub Init-Healer
/declare cmds-HEALER string outer Healer:
|For each command
|/call AddCommand "Command Section" "Command Phrase" "Called Sub"
|Command Section - where the command will be listed in response to the cmd phrase
|Command Phrase to trigger bot - End User can change to suit prefferences
|Called Sub - Routine to execute in response to Command Phrase
/call AddCommands heal resetwatch setcasterheal setcasterhealpct
/call AddCommands setdefaultheal setpatchheal setpetheal setpethealpct
/call AddCommands settankheal settankhealpct watchtarget
|declare Vars
/declare CasterList string outer
/declare HealTargets[21] int outer 0
/declare LowHealthCheck int outer 0
/declare TankList string outer
/declare WatchTargetCount int outer 0
/declare WatchTargetIDs[15] int outer 0
/declare WatchTargets[15] string outer
/declare WatchWaitCount int outer 0
|Timers
/declare CastMsgTimer1 timer outer
/declare CastMsgTimer2 timer outer
|Load Settings
/call AddToggle doheal on return "I will not heal anyone unless commanded." "I will watch and cast heal spells as necessary."
/call LoadSetting CasterSpell string CasterSpell "Name of heal spell autoheal uses on Non Tanks"
/call LoadSetting CasterPctHeal int CasterPctHeal 70
/call LoadSetting DefaultHealSpell string DefaultHealSpell "Name of Default Heal Spell"
/call LoadSetting HealCasterMsg string HealCasterMsg "Healing %t"
/call LoadSetting HealPetMsg string HealPetMsg "Healing %t"
/call AddToggle healpets off return "I will not heal the pets." "I will heal the pets."
/call LoadSetting HealTankMsg string HealTankMsg "Big Heal on %t"
/call LoadSetting IsPally bool IsPally 0
/call LoadSetting PalGrpPct int PalGrpPct 81
/call LoadSetting PalHealPct int PalHealPct 81
/call LoadSetting PallyGroupSpell string PallyGroupSpell "Name of Pally Group Heal Spell"
/call LoadSetting PallyHealSpell string PallyHealSpell "Name of Pally Heal Spell"
/call LoadSetting PalHealMsg string PalHealMsg "Healing %t"
/call AddToggle patchheal on return "I'm not a patch Healer." "I'm a patch Healer."
/call LoadSetting PatchHealMsg string PatchHealMsg "Patch Healing %t"
/call LoadSetting PatchSpell string PatchSpell "Name of Patch Heal Spell"
/call LoadSetting PetPctHeal int PetPctHeal 51
/call LoadSetting PetSpell string PetSpell "Name of Pet Heal Spell"
/call LoadSetting ReportAutoHeal bool ReportAutoHeal 1
/call LoadSetting TankSpell string TankSpell "Name of heal spell autoheal uses on Tanks"
/call LoadSetting TankPctHeal int TankPctHeal 51
/call AddToggle stopifhealed on return "I will not interrupt heal spells even if target is healed by someone else." "I will interrupt heal spells if target is already above the heal %."
/call AddToggle stopforheals off return "I will not interrupt other spells for heal spells." "I will interrupt other spells for heal spells."
/varset TankList ${Ini[${IniFile},Healer,TankList,NotFound]}
/varset CasterList ${Ini[${IniFile},Healer,CasterList,NotFound]}
/if (${TankList.Equal[NotFound]} && ${CasterList.Equal[NotFound]}) {
/ini ${IniFile} Healer TankList "Warrior|Shadow Knight|Paladin|Monk|Beastlord|Ranger|Shaman|Berserker"
/ini ${IniFile} Healer CasterList "Necromancer|Wizard|Enchanter|Magician|Rogue|Druid|Cleric|Bard"
/varset TankList Warrior|Shadow Knight|Paladin|Monk|Beastlord|Ranger|Shaman|Berserker
/varset CasterList Necromancer|Wizard|Enchanter|Magician|Rogue|Druid|Cleric|Bard
}
/return
Sub HealerMain
/call CheckGrpHealth
/call PalGrpHealChk
/call PalHealChk
/return
||||| Do Subs
Sub Command-setcasterheal
/if (!${Defined[Param0]}) {
/call ChatOut 3 "I heal non tanks with ${CasterSpell}."
/return
}
/varset CasterSpell ${CommandParam}
/call ChatOut 3 "I'll start using ${CasterSpell} on non tanks."
/return
Sub Command-setcasterhealpct
/if (!${Defined[Param0]}) {
/call ChatOut 3 "I heal non tanks at ${CasterPctHeal} %."
/return
}
/varset CasterPctHeal ${Param0}
/call ChatOut 3 "I heal non tanks at ${CasterPctHeal} %."
/return
Sub Command-setdefaultheal
/if (!${Defined[Param0]}) {
/call ChatOut 3 "I usualy heal with ${DefaultHealSpell}."
/return
}
/varset DefaultHealSpell ${CommandParam}
/call ChatOut 3 "I'll start using ${DefaultHealSpell}."
/return
Sub Command-heal
/if (${DefaultHealSpell.Equal[${DefaultHealSpell-DefaultValue}]}) /return
/call AssignCastTarget "${CommandParam}"
/declare HealTarget string local ${Macro.Return}
|/call ChatOut 3 "Casting ${DefaultHealSpell} on ${NearestSpawn[${HealTarget}]}."
/call AddCast "${DefaultHealSpell}" "${HealTarget}" h-com
/return
Sub Command-setpatchheal
/if (!${Defined[Param0]}) {
/call ChatOut 3 "I use ${PatchSpell} for patch heals."
/return
}
/varset PatchSpell ${CommandParam}
/call ChatOut 3 "I'll use ${PatchSpell} for patch heals now."
/return
Sub Command-setpetheal
/if (!${Defined[Param0]}) {
/call ChatOut 3 "My pet heal is ${PetSpell}."
/return
}
/varset PetSpell ${CommandParam}
/call ChatOut 3 "I'll use ${PetSpell} to heal pets."
/return
Sub Command-setpethealpct
/if (!${Defined[Param0]}) {
/call ChatOut 3 "I heal pets at ${PetPctHeal} %."
/return
}
/varset PetPctHeal ${Param0}
/call ChatOut 3 "I heal pets at ${PetPctHeal} %."
/return
Sub Command-settankheal
/if (!${Defined[Param0]}) {
/call ChatOut 3 "My tank heal is ${TankSpell}"
/return
}
/varset TankSpell ${CommandParam}
/call ChatOut 3 "I'll use ${TankSpell} to heal tanks."
/return
Sub Command-settankhealpct
/if (!${Defined[Param0]}) {
/call ChatOut 3 "I heal tanks at ${TankPctHeal} %."
/return
}
/varset TankPctHeal ${Param0}
/call ChatOut 3 "I heal tanks at ${TankPctHeal} %."
/return
Sub Command-watchtarget
/if (${String[${Param0}].Equal[off]}) {
/varset WatchTargetCount 0
/return
}
/squelch /target clear
/call delay 5
/call StandardTarget "${CommandParam}"
/if (${Target.ID}) {
/varcalc WatchTargetCount ${WatchTargetCount}+1
/varset WatchTargets[${WatchTargetCount}] ${Target.CleanName}
/varset WatchTargetIDs[${WatchTargetCount}] ${Target.ID}
/call ChatOut 3 "Now watching the health of ${Target.CleanName}."
} else {
/call ChatOut 3 "Who did you want me to watch?"
}
/return
Sub Command-resetwatch
/call ResetWatchTargets
/return
||||| Called Subs
Sub CastHeal(int TarID,string HealSpell,string castMsg)
/if (!${CastMsgTimer1}) {
|/if (${ReportAutoHeal}) /g ${castMsg}
/varset CastMsgTimer1 50
}
/call AddCast "${HealSpell}" "id ${TarID}" "heal"
/return
Sub CheckGrpHealth
/declare HealCount int local 0
/declare BadIDs int local 0
/declare SaveCombatStat int local 0
/declare SaveCombatID int local 0
/declare QuickID int local 0
/declare tempvar int local 0
/if (!${Toggle-doheal}) /return
/if (${IsPally}) /return
/varset HealCount ${Group.Members}
/for tempvar 1 to ${Group.Members}
/varset HealTargets[${tempvar}] ${Group.Member[${tempvar}].ID}
/next tempvar
/varcalc HealCount ${HealCount}+1
/varset HealTargets[${HealCount}] ${Me.ID}
/if (${WatchWaitCount}>10 && ${WatchTargetCount}>0) {
/for tempvar 1 to ${WatchTargetCount}
/varcalc HealCount ${HealCount}+1
/varset HealTargets[${HealCount}] ${WatchTargetIDs[${tempvar}]}
/next tempvar
/varset WatchWaitCount 0
}
/varcalc WatchWaitCount ${WatchWaitCount}+1
/for tempvar 1 to ${HealCount}
/if (${tempvar}>${Group} && ${Target.ID}!=${HealTargets[${tempvar}]} && ${HealTargets[${tempvar}]}!=${Me.ID}) {
/squelch /target id ${HealTargets[${tempvar}]}
/delay 5
/if (${Target.ID}!=${HealTargets[${tempvar}]}) {
/varcalc BadIDs ${BadIDs}+1
}
}
/varset QuickID ${HealTargets[${tempvar}]}
/if (${Spawn[${QuickID}].PctHPs}<${TankPctHeal} && ${Spawn[${QuickID}].State.NotEqual[DEAD]}) {
/if (${TankList.Find[${Spawn[${QuickID}].Class}]}) {
/if (${Spawn[${QuickID}].PctHPs}<${Math.Calc[${TankPctHeal}/2]} && ${Toggle-patchhealer}) /call PatchHeal ${QuickID}
/call CastHeal ${QuickID} "${TankSpell}" "${HealTankMsg}"
}
}
/if ((${Spawn[${QuickID}].PctHPs}<${CasterPctHeal})&&(${Spawn[${QuickID}].State.NotEqual[DEAD]})) {
/if (${CasterList.Find[${Spawn[${QuickID}].Class}]}) {
/if ((${Spawn[${QuickID}].PctHPs}<${Math.Calc[${CasterPctHeal}/2]})&&(${Toggle-patchhealer})) /call PatchHeal ${QuickID}
/call CastHeal ${QuickID} "${CasterSpell}" "${HealCasterMsg}"
}
}
/if (${Toggle-healpets} && ${Spawn[${QuickID}].Class.PetClass} && ${Spawn[${QuickID}].Pet.ID}) {
/if (${Spawn[${QuickID}].Pet.PctHPs}<${PetPctHeal}) {
/call CastHeal ${Spawn[${QuickID}].Pet.ID} "${PetSpell}" "${HealPetMsg}"
}
}
/next tempvar
/if (${CombatTargetID}) /call Target "id ${CombatTargetID}"
/if (${BadIDs}>0) /call ResetWatchTargets
/return
Sub PalHealChk
/declare tempvar int local 0
/if (!${IsPally}) /return
/if (!${Toggle-doheal}) /return
/for tempvar 0 to ${Group}
/if ((${Group[${tempvar}].PctHPs}<${PalHealPct})&&(${Group[${tempvar}].State.NotEqual[DEAD]})) /call PallyHeal ${Group[${tempvar}].ID}
/next tempvar
/return
Sub PalGroupheal
/if (${Me.Sitting}) /stand
/if (${ReportAutoHeal}) /g ${PalHealGrpMsg}
/call AddCast "${PallyGroupSpell}" 0 heal
/return
Sub PalGrpHealChk
/declare tempvar int local 1
/if (!${IsPally}) /return
/if (!${Toggle-doheal}) /return
/if (${Me.PctHPs}>${PalHealPct}) {
/varset LowHealthCheck 0
} else {
/varset LowHealthCheck 1
}
/for tempvar 1 to ${Group}
/if ((${Group[${tempvar}].PctHPs}<${PalHealPct})&&(${Group[${tempvar}].State.NotEqual[DEAD]})) /varcalc LowHealthCheck ${LowHealthCheck}+1
/if (${LowHealthCheck}>=3) {
/call PalGroupheal
/return
}
/next tempvar
/return
Sub PallyHeal(int TarID)
/if (${CombatTargetID}) /return
/if (${TarID}==${Me.ID}) /target myself
/if (${TarID}!=${Me.ID}) /squelch /target id ${TarID}
/g ${PalHealMsg}
/call AddCast "${PallyHealSpell}" 0 heal
/return
Sub Patchheal(int TarID)
/if (${CastMsgTimer1}<=0) {
|/if (${ReportAutoHeal}) /g ${PatchHealMsg}
/varset CastMsgTimer1 50
}
/if (${Me.Gem[${PatchSpell}]}) /call AddCast "${PatchSpell}" "id ${TarID}" "heal"
/return
Sub ResetWatchTargets
/declare counter int local
/for counter 1 to ${WatchTargetCount}
/squelch /target PC ${WatchTargets[${counter}]}
/call Delay 25
/if (${Target.CleanName.Equal[${WatchTargets[${counter}]}]}) {
/varset WatchTargetIDs[${counter}] ${Target.ID}
} else {
/call ChatOut 5 "I failed to find ${WatchTargets[${counter}]} in the zone."
}
/next counter
/return