From dd1ce19d4fd6f408acef848e79f6b68d16dbc152 Mon Sep 17 00:00:00 2001 From: Neckkola Date: Thu, 25 Mar 2021 21:18:52 -0300 Subject: [PATCH] Add Bot Heal Message Display Creates a new rule to display Bot heal messages to the Bot Owner --- common/ruletypes.h | 1 + zone/attack.cpp | 78 ++++++++++++++++++++++++++++++++++++---------- 2 files changed, 62 insertions(+), 17 deletions(-) diff --git a/common/ruletypes.h b/common/ruletypes.h index 31fb54fce..7eca4b0cc 100644 --- a/common/ruletypes.h +++ b/common/ruletypes.h @@ -614,6 +614,7 @@ RULE_REAL(Bots, LeashDistance, 562500.0f, "Distance a bot is allowed to travel f RULE_BOOL(Bots, AllowApplyPoisonCommand, true, "Allows the use of the bot command 'applypoison'") RULE_BOOL(Bots, AllowApplyPotionCommand, true, "Allows the use of the bot command 'applypotion'") RULE_BOOL(Bots, RestrictApplyPotionToRogue, true, "Restricts the bot command 'applypotion' to rogue-usable potions (i.e., poisons)") +RULE_BOOL(Bots, DisplayHealDamage, false, "Enables the display of bot heal damage to the client") RULE_CATEGORY_END() #endif diff --git a/zone/attack.cpp b/zone/attack.cpp index 3f614598a..61cd3fdce 100644 --- a/zone/attack.cpp +++ b/zone/attack.cpp @@ -3853,7 +3853,7 @@ void Mob::CommonDamage(Mob* attacker, int &damage, const uint16 spell_id, const } -void Mob::HealDamage(uint32 amount, Mob *caster, uint16 spell_id) +void Mob::HealDamage(uint32 amount, Mob* caster, uint16 spell_id) { int32 maxhp = GetMaxHP(); int32 curhp = GetHP(); @@ -3868,15 +3868,16 @@ void Mob::HealDamage(uint32 amount, Mob *caster, uint16 spell_id) if (caster) { if (IsBuffSpell(spell_id)) { // hots // message to caster - if (caster->IsClient() && caster == this) { - if (caster->CastToClient()->ClientVersionBit() & EQ::versions::maskSoFAndLater) + if ((caster->IsClient() && caster == this)) { + if (caster->CastToClient()->ClientVersionBit() & EQ::versions::maskSoFAndLater) { FilteredMessageString(caster, Chat::NonMelee, FilterHealOverTime, HOT_HEAL_SELF, itoa(acthealed), spells[spell_id].name); + } else FilteredMessageString(caster, Chat::NonMelee, FilterHealOverTime, YOU_HEALED, GetCleanName(), itoa(acthealed)); } - else if (caster->IsClient() && caster != this) { + else if ((caster->IsClient() && caster != this)) { if (caster->CastToClient()->ClientVersionBit() & EQ::versions::maskSoFAndLater) caster->FilteredMessageString(caster, Chat::NonMelee, FilterHealOverTime, HOT_HEAL_OTHER, GetCleanName(), itoa(acthealed), @@ -3885,8 +3886,35 @@ void Mob::HealDamage(uint32 amount, Mob *caster, uint16 spell_id) caster->FilteredMessageString(caster, Chat::NonMelee, FilterHealOverTime, YOU_HEAL, GetCleanName(), itoa(acthealed)); } +#ifdef BOTS + if (caster->IsBot() && this != caster->CastToBot()->GetBotOwner() && RuleB(Bots, DisplayHealDamage)) { + + + // %1 healed %2 for %3 hit points from %4's %5 + const char s2[]{ " healed " }; + const char s4[]{ " for " }; + const char s6[]{ " hit points from " }; + const char s8[]{ "'s " }; + + caster->CastToBot()->GetBotOwner()->FilteredMessageString( + caster->CastToBot()->GetBotOwner(), //send to the Bot Owner's client + Chat::NonMelee, + FilterHealOverTime, + GENERIC_9_STRINGS, //using generic for testing purposes %1 %2 %3 %4 %5 %6 %7 %8 %9 + caster->GetCleanName(), // %1 caster (bot's) name + s2, // %2 + this->GetCleanName(), // %3 caster (bot's) target + s4, // %4 + itoa(acthealed), // %5 amount healed + s6, // %6 + caster->GetCleanName(), // %7 caster (bot's) name + s8, // %8 + spells[spell_id].name // %9 spell name + ); + } +#endif // BOTS // message to target - if (IsClient() && caster != this) { + if ((IsClient() && caster != this)) { if (CastToClient()->ClientVersionBit() & EQ::versions::maskSoFAndLater) FilteredMessageString(this, Chat::NonMelee, FilterHealOverTime, HOT_HEALED_OTHER, caster->GetCleanName(), @@ -3899,25 +3927,41 @@ void Mob::HealDamage(uint32 amount, Mob *caster, uint16 spell_id) else { // normal heals FilteredMessageString(caster, Chat::NonMelee, FilterSpellDamage, YOU_HEALED, caster->GetCleanName(), itoa(acthealed)); +#ifndef BOTS if (caster != this) caster->FilteredMessageString(caster, Chat::NonMelee, FilterSpellDamage, YOU_HEAL, GetCleanName(), itoa(acthealed)); } - } - else { - Message(Chat::NonMelee, "You have been healed for %d points of damage.", acthealed); - } - } +#endif +#ifdef BOTS + if (caster->IsBot() && RuleB(Bots, DisplayHealDamage)) { + caster->CastToBot()->GetBotOwner()->FilteredMessageString(caster->CastToBot()->GetBotOwner(), + Chat::NonMelee, FilterSpellDamage, GENERIC_9_STRINGS, + caster->GetCleanName(), " healed ", this->GetCleanName(), " for ", itoa(acthealed), " hit points.", " ", " ", " "); + } + else if (caster != this) { + caster->FilteredMessageString(caster, Chat::NonMelee, FilterSpellDamage, + YOU_HEAL, GetCleanName(), itoa(acthealed)); - if (curhp < maxhp) { - if ((curhp + amount) > maxhp) - curhp = maxhp; - else - curhp += amount; - SetHP(curhp); + } + } +#endif // BOTS - SendHPUpdate(); } + else { + Message(Chat::NonMelee, "You have been healed for %d points of damage.", acthealed); + } +} + +if (curhp < maxhp) { + if ((curhp + amount) > maxhp) + curhp = maxhp; + else + curhp += amount; + SetHP(curhp); + + SendHPUpdate(); +} } //proc chance includes proc bonus