From 95c1bb6883f0afc462de1d122f2f63d07f276140 Mon Sep 17 00:00:00 2001 From: nytmyr <53322305+nytmyr@users.noreply.github.com> Date: Fri, 10 Jan 2025 11:45:00 -0600 Subject: [PATCH] code cleanup 2 --- common/spdat.cpp | 258 ++++---- common/spdat.h | 38 +- zone/bot.cpp | 893 +++++++++++++-------------- zone/bot.h | 214 +++---- zone/bot_command.cpp | 52 +- zone/bot_commands/bot.cpp | 48 +- zone/bot_database.cpp | 58 +- zone/botspellsai.cpp | 1195 +++++++++++++++++++------------------ zone/client.cpp | 144 +++-- zone/client.h | 6 +- 10 files changed, 1455 insertions(+), 1451 deletions(-) diff --git a/common/spdat.cpp b/common/spdat.cpp index 8990b4673..898c06bc2 100644 --- a/common/spdat.cpp +++ b/common/spdat.cpp @@ -2791,8 +2791,8 @@ bool IsLichSpell(uint16 spell_id) return false; } -bool IsBotSpellTypeDetrimental(uint16 spellType) { - switch (spellType) { +bool IsBotSpellTypeDetrimental(uint16 spell_type) { + switch (spell_type) { case BotSpellTypes::Nuke: case BotSpellTypes::Root: case BotSpellTypes::Lifetap: @@ -2831,8 +2831,8 @@ bool IsBotSpellTypeDetrimental(uint16 spellType) { return false; } -bool IsBotSpellTypeBeneficial(uint16 spellType) { - switch (spellType) { +bool IsBotSpellTypeBeneficial(uint16 spell_type) { + switch (spell_type) { case BotSpellTypes::RegularHeal: case BotSpellTypes::CompleteHeal: case BotSpellTypes::GroupCompleteHeals: @@ -2881,8 +2881,8 @@ bool IsBotSpellTypeBeneficial(uint16 spellType) { return false; } -bool IsBotSpellTypeOtherBeneficial(uint16 spellType) { - switch (spellType) { +bool IsBotSpellTypeOtherBeneficial(uint16 spell_type) { + switch (spell_type) { case BotSpellTypes::RegularHeal: case BotSpellTypes::CompleteHeal: case BotSpellTypes::GroupCompleteHeals: @@ -2925,8 +2925,8 @@ bool IsBotSpellTypeOtherBeneficial(uint16 spellType) { return false; } -bool IsBotSpellTypeInnate(uint16 spellType) { - switch (spellType) { +bool IsBotSpellTypeInnate(uint16 spell_type) { + switch (spell_type) { case BotSpellTypes::AENukes: case BotSpellTypes::AERains: case BotSpellTypes::PBAENuke: @@ -2960,8 +2960,8 @@ bool IsBotSpellTypeInnate(uint16 spellType) { return false; } -bool IsAEBotSpellType(uint16 spellType) { - switch (spellType) { +bool IsAEBotSpellType(uint16 spell_type) { + switch (spell_type) { case BotSpellTypes::AEDebuff: case BotSpellTypes::AEFear: case BotSpellTypes::AEMez: @@ -2985,8 +2985,8 @@ bool IsAEBotSpellType(uint16 spellType) { return false; } -bool IsGroupBotSpellType(uint16 spellType) { - switch (spellType) { +bool IsGroupBotSpellType(uint16 spell_type) { + switch (spell_type) { case BotSpellTypes::GroupCures: case BotSpellTypes::GroupCompleteHeals: case BotSpellTypes::GroupHeals: @@ -2999,8 +2999,8 @@ bool IsGroupBotSpellType(uint16 spellType) { return false; } -bool IsGroupTargetOnlyBotSpellType(uint16 spellType) { - switch (spellType) { +bool IsGroupTargetOnlyBotSpellType(uint16 spell_type) { + switch (spell_type) { case BotSpellTypes::GroupCures: case BotSpellTypes::GroupCompleteHeals: case BotSpellTypes::GroupHeals: @@ -3012,8 +3012,8 @@ bool IsGroupTargetOnlyBotSpellType(uint16 spellType) { return false; } -bool IsPetBotSpellType(uint16 spellType) { - switch (spellType) { +bool IsPetBotSpellType(uint16 spell_type) { + switch (spell_type) { case BotSpellTypes::PetBuffs: case BotSpellTypes::PetRegularHeals: case BotSpellTypes::PetCompleteHeals: @@ -3031,8 +3031,8 @@ bool IsPetBotSpellType(uint16 spellType) { return false; } -bool IsClientBotSpellType(uint16 spellType) { - switch (spellType) { +bool IsClientBotSpellType(uint16 spell_type) { + switch (spell_type) { case BotSpellTypes::RegularHeal: case BotSpellTypes::CompleteHeal: case BotSpellTypes::GroupCompleteHeals: @@ -3063,8 +3063,8 @@ bool IsClientBotSpellType(uint16 spellType) { return false; } -bool IsHealBotSpellType(uint16 spellType) { - switch (spellType) { +bool IsHealBotSpellType(uint16 spell_type) { + switch (spell_type) { case BotSpellTypes::VeryFastHeals: case BotSpellTypes::FastHeals: case BotSpellTypes::RegularHeal: @@ -3086,12 +3086,12 @@ bool IsHealBotSpellType(uint16 spellType) { return false; } -bool SpellTypeRequiresLoS(uint16 spellType) { - if (IsAEBotSpellType(spellType)) { // These gather their own targets later +bool SpellTypeRequiresLoS(uint16 spell_type) { + if (IsAEBotSpellType(spell_type)) { // These gather their own targets later return false; } - switch (spellType) { + switch (spell_type) { case BotSpellTypes::RegularHeal: case BotSpellTypes::GroupCompleteHeals: case BotSpellTypes::CompleteHeal: @@ -3114,8 +3114,8 @@ bool SpellTypeRequiresLoS(uint16 spellType) { return true; } -bool SpellTypeRequiresTarget(uint16 spellType) { - switch (spellType) { +bool SpellTypeRequiresTarget(uint16 spell_type) { + switch (spell_type) { case BotSpellTypes::Pet: case BotSpellTypes::Succor: return false; @@ -3126,8 +3126,8 @@ bool SpellTypeRequiresTarget(uint16 spellType) { return true; } -bool SpellTypeRequiresAEChecks(uint16 spellType) { - switch (spellType) { +bool SpellTypeRequiresAEChecks(uint16 spell_type) { + switch (spell_type) { case BotSpellTypes::AEMez: return false; default: @@ -3137,12 +3137,12 @@ bool SpellTypeRequiresAEChecks(uint16 spellType) { return true; } -bool IsValidSpellAndLoS(uint32 spell_id, bool hasLoS) { +bool IsValidSpellAndLoS(uint32 spell_id, bool has_los) { if (!IsValidSpell(spell_id)) { return false; } - if (!hasLoS && IsTargetRequiredForSpell(spell_id)) { + if (!has_los && IsTargetRequiredForSpell(spell_id)) { return false; } @@ -3162,8 +3162,8 @@ bool IsResurrectSpell(uint16 spell_id) return IsEffectInSpell(spell_id, SE_Revive); } -bool RequiresStackCheck(uint16 spellType) { - switch (spellType) { +bool RequiresStackCheck(uint16 spell_type) { + switch (spell_type) { case BotSpellTypes::VeryFastHeals: case BotSpellTypes::PetVeryFastHeals: case BotSpellTypes::FastHeals: @@ -3244,8 +3244,8 @@ bool IsHateSpell(uint16 spell_id) { return false; } -bool IsCommandedSpellType(uint16 spellType) { - switch (spellType) { +bool IsCommandedSpellType(uint16 spell_type) { + switch (spell_type) { case BotSpellTypes::Charm: case BotSpellTypes::AEFear: case BotSpellTypes::Fear: @@ -3278,8 +3278,8 @@ bool IsCommandedSpellType(uint16 spellType) { return false; } -bool IsPullingSpellType(uint16 spellType) { - switch (spellType) { +bool IsPullingSpellType(uint16 spell_type) { + switch (spell_type) { case BotSpellTypes::Nuke: case BotSpellTypes::Lifetap: case BotSpellTypes::Snare: @@ -3297,101 +3297,101 @@ bool IsPullingSpellType(uint16 spellType) { return false; } -uint16 GetCorrectSpellType(uint16 spellType, uint16 spell_id) { - uint16 correctType = UINT16_MAX; +uint16 GetCorrectSpellType(uint16 spell_type, uint16 spell_id) { + uint16 correct_type = UINT16_MAX; SPDat_Spell_Struct spell = spells[spell_id]; - std::string teleportZone = spell.teleport_zone; + std::string teleport_zone = spell.teleport_zone; if (IsCharmSpell(spell_id)) { - correctType = BotSpellTypes::Charm; + correct_type = BotSpellTypes::Charm; } else if (IsFearSpell(spell_id)) { - correctType = BotSpellTypes::Fear; + correct_type = BotSpellTypes::Fear; } else if (IsEffectInSpell(spell_id, SE_Revive)) { - correctType = BotSpellTypes::Resurrect; + correct_type = BotSpellTypes::Resurrect; } else if (IsHarmonySpell(spell_id)) { - correctType = BotSpellTypes::Lull; + correct_type = BotSpellTypes::Lull; } - else if (teleportZone.compare("") && !IsEffectInSpell(spell_id, SE_GateToHomeCity) && IsBeneficialSpell(spell_id) && (IsEffectInSpell(spell_id, SE_Teleport) || IsEffectInSpell(spell_id, SE_Translocate))) { - correctType = BotSpellTypes::Teleport; + else if (teleport_zone.compare("") && !IsEffectInSpell(spell_id, SE_GateToHomeCity) && IsBeneficialSpell(spell_id) && (IsEffectInSpell(spell_id, SE_Teleport) || IsEffectInSpell(spell_id, SE_Translocate))) { + correct_type = BotSpellTypes::Teleport; } else if (IsBeneficialSpell(spell_id) && IsEffectInSpell(spell_id, SE_Succor)) { - correctType = BotSpellTypes::Succor; + correct_type = BotSpellTypes::Succor; } else if (IsEffectInSpell(spell_id, SE_BindAffinity)) { - correctType = BotSpellTypes::BindAffinity; + correct_type = BotSpellTypes::BindAffinity; } else if (IsEffectInSpell(spell_id, SE_Identify)) { - correctType = BotSpellTypes::Identify; + correct_type = BotSpellTypes::Identify; } - else if (spellType == BotSpellTypes::Levitate && IsBeneficialSpell(spell_id) && (IsEffectInSpell(spell_id, SE_Levitate))) { - correctType = BotSpellTypes::Levitate; + else if (spell_type == BotSpellTypes::Levitate && IsBeneficialSpell(spell_id) && (IsEffectInSpell(spell_id, SE_Levitate))) { + correct_type = BotSpellTypes::Levitate; } - else if (spellType == BotSpellTypes::Rune && IsBeneficialSpell(spell_id) && (IsEffectInSpell(spell_id, SE_AbsorbMagicAtt) || IsEffectInSpell(spell_id, SE_Rune))) { - correctType = BotSpellTypes::Rune; + else if (spell_type == BotSpellTypes::Rune && IsBeneficialSpell(spell_id) && (IsEffectInSpell(spell_id, SE_AbsorbMagicAtt) || IsEffectInSpell(spell_id, SE_Rune))) { + correct_type = BotSpellTypes::Rune; } - else if (spellType == BotSpellTypes::WaterBreathing && IsBeneficialSpell(spell_id) && IsEffectInSpell(spell_id, SE_WaterBreathing)) { - correctType = BotSpellTypes::WaterBreathing; + else if (spell_type == BotSpellTypes::WaterBreathing && IsBeneficialSpell(spell_id) && IsEffectInSpell(spell_id, SE_WaterBreathing)) { + correct_type = BotSpellTypes::WaterBreathing; } - else if (spellType == BotSpellTypes::Size && IsBeneficialSpell(spell_id) && (IsEffectInSpell(spell_id, SE_ModelSize) || IsEffectInSpell(spell_id, SE_ChangeHeight))) { - correctType = BotSpellTypes::Size; + else if (spell_type == BotSpellTypes::Size && IsBeneficialSpell(spell_id) && (IsEffectInSpell(spell_id, SE_ModelSize) || IsEffectInSpell(spell_id, SE_ChangeHeight))) { + correct_type = BotSpellTypes::Size; } - else if (spellType == BotSpellTypes::Invisibility && IsBeneficialSpell(spell_id) && (IsEffectInSpell(spell_id, SE_SeeInvis) || IsInvisibleSpell(spell_id))) { - correctType = BotSpellTypes::Invisibility; + else if (spell_type == BotSpellTypes::Invisibility && IsBeneficialSpell(spell_id) && (IsEffectInSpell(spell_id, SE_SeeInvis) || IsInvisibleSpell(spell_id))) { + correct_type = BotSpellTypes::Invisibility; } - else if (spellType == BotSpellTypes::MovementSpeed && IsBeneficialSpell(spell_id) && IsEffectInSpell(spell_id, SE_MovementSpeed)) { - correctType = BotSpellTypes::MovementSpeed; + else if (spell_type == BotSpellTypes::MovementSpeed && IsBeneficialSpell(spell_id) && IsEffectInSpell(spell_id, SE_MovementSpeed)) { + correct_type = BotSpellTypes::MovementSpeed; } - else if (!teleportZone.compare("") && IsBeneficialSpell(spell_id) && (IsEffectInSpell(spell_id, SE_Translocate) || IsEffectInSpell(spell_id, SE_GateToHomeCity))) { - correctType = BotSpellTypes::SendHome; + else if (!teleport_zone.compare("") && IsBeneficialSpell(spell_id) && (IsEffectInSpell(spell_id, SE_Translocate) || IsEffectInSpell(spell_id, SE_GateToHomeCity))) { + correct_type = BotSpellTypes::SendHome; } else if (IsEffectInSpell(spell_id, SE_SummonCorpse)) { - correctType = BotSpellTypes::SummonCorpse; + correct_type = BotSpellTypes::SummonCorpse; } - if (correctType == UINT16_MAX) { + if (correct_type == UINT16_MAX) { if (IsSummonPetSpell(spell_id) || IsEffectInSpell(spell_id, SE_TemporaryPets)) { - correctType = BotSpellTypes::Pet; + correct_type = BotSpellTypes::Pet; } else if (IsMesmerizeSpell(spell_id)) { - correctType = BotSpellTypes::Mez; + correct_type = BotSpellTypes::Mez; } else if (IsEscapeSpell(spell_id)) { - correctType = BotSpellTypes::Escape; + correct_type = BotSpellTypes::Escape; } else if (IsDetrimentalSpell(spell_id) && IsEffectInSpell(spell_id, SE_Root)) { if (IsAnyAESpell(spell_id)) { - correctType = BotSpellTypes::AERoot; + correct_type = BotSpellTypes::AERoot; } else { - correctType = BotSpellTypes::Root; + correct_type = BotSpellTypes::Root; } } else if (IsDetrimentalSpell(spell_id) && IsLifetapSpell(spell_id)) { - correctType = BotSpellTypes::Lifetap; + correct_type = BotSpellTypes::Lifetap; } else if (IsDetrimentalSpell(spell_id) && IsEffectInSpell(spell_id, SE_MovementSpeed)) { - correctType = BotSpellTypes::Snare; + correct_type = BotSpellTypes::Snare; } else if (IsDetrimentalSpell(spell_id) && (IsStackableDOT(spell_id) || IsDamageOverTimeSpell(spell_id))) { - correctType = BotSpellTypes::DOT; + correct_type = BotSpellTypes::DOT; } else if (IsDispelSpell(spell_id)) { - correctType = BotSpellTypes::Dispel; + correct_type = BotSpellTypes::Dispel; } else if (IsDetrimentalSpell(spell_id) && IsSlowSpell(spell_id)) { - correctType = BotSpellTypes::Slow; + correct_type = BotSpellTypes::Slow; } else if (IsDebuffSpell(spell_id) && !IsHateReduxSpell(spell_id) && !IsHateSpell(spell_id)) { - correctType = BotSpellTypes::Debuff; + correct_type = BotSpellTypes::Debuff; } else if (IsHateReduxSpell(spell_id)) { - correctType = BotSpellTypes::HateRedux; + correct_type = BotSpellTypes::HateRedux; } else if (IsDetrimentalSpell(spell_id) && IsHateSpell(spell_id)) { - correctType = BotSpellTypes::HateLine; + correct_type = BotSpellTypes::HateLine; } else if ( IsBuffSpell(spell_id) && @@ -3399,133 +3399,133 @@ uint16 GetCorrectSpellType(uint16 spellType, uint16 spell_id) { IsBardSong(spell_id) ) { if ( - spellType == BotSpellTypes::InCombatBuffSong || - spellType == BotSpellTypes::OutOfCombatBuffSong || - spellType == BotSpellTypes::PreCombatBuffSong + spell_type == BotSpellTypes::InCombatBuffSong || + spell_type == BotSpellTypes::OutOfCombatBuffSong || + spell_type == BotSpellTypes::PreCombatBuffSong ) { - correctType = spellType; + correct_type = spell_type; } else { - correctType = BotSpellTypes::OutOfCombatBuffSong; + correct_type = BotSpellTypes::OutOfCombatBuffSong; } } else if ( !IsBardSong(spell_id) && ( (IsSelfConversionSpell(spell_id) && spell.buff_duration < 1) || - (spellType == BotSpellTypes::InCombatBuff && IsAnyBuffSpell(spell_id)) + (spell_type == BotSpellTypes::InCombatBuff && IsAnyBuffSpell(spell_id)) ) ) { - correctType = BotSpellTypes::InCombatBuff; + correct_type = BotSpellTypes::InCombatBuff; } else if ( - spellType == BotSpellTypes::PreCombatBuff && + spell_type == BotSpellTypes::PreCombatBuff && IsAnyBuffSpell(spell_id) && !IsBardSong(spell_id) ) { - correctType = BotSpellTypes::PreCombatBuff; + correct_type = BotSpellTypes::PreCombatBuff; } else if ( - (IsCureSpell(spell_id) && spellType == BotSpellTypes::Cure) || + (IsCureSpell(spell_id) && spell_type == BotSpellTypes::Cure) || (IsCureSpell(spell_id) && !IsAnyHealSpell(spell_id)) ) { - correctType = BotSpellTypes::Cure; + correct_type = BotSpellTypes::Cure; } else if (IsAnyNukeOrStunSpell(spell_id)) { if (IsAnyAESpell(spell_id)) { if (IsAERainSpell(spell_id)) { - correctType = BotSpellTypes::AERains; + correct_type = BotSpellTypes::AERains; } else if (IsPBAENukeSpell(spell_id)) { - correctType = BotSpellTypes::PBAENuke; + correct_type = BotSpellTypes::PBAENuke; } else if (IsStunSpell(spell_id)) { - correctType = BotSpellTypes::AEStun; + correct_type = BotSpellTypes::AEStun; } else { - correctType = BotSpellTypes::AENukes; + correct_type = BotSpellTypes::AENukes; } } else if (IsStunSpell(spell_id)) { - correctType = BotSpellTypes::Stun; + correct_type = BotSpellTypes::Stun; } else { - correctType = BotSpellTypes::Nuke; + correct_type = BotSpellTypes::Nuke; } } else if (IsAnyHealSpell(spell_id)) { if (IsGroupSpell(spell_id)) { if (IsGroupCompleteHealSpell(spell_id)) { - correctType = BotSpellTypes::GroupCompleteHeals; + correct_type = BotSpellTypes::GroupCompleteHeals; } else if (IsGroupHealOverTimeSpell(spell_id)) { - correctType = BotSpellTypes::GroupHoTHeals; + correct_type = BotSpellTypes::GroupHoTHeals; } else if (IsRegularGroupHealSpell(spell_id)) { - correctType = BotSpellTypes::GroupHeals; + correct_type = BotSpellTypes::GroupHeals; } } else { if (IsVeryFastHealSpell(spell_id)) { - correctType = BotSpellTypes::VeryFastHeals; + correct_type = BotSpellTypes::VeryFastHeals; } else if (IsFastHealSpell(spell_id)) { - correctType = BotSpellTypes::FastHeals; + correct_type = BotSpellTypes::FastHeals; } else if (IsCompleteHealSpell(spell_id)) { - correctType = BotSpellTypes::CompleteHeal; + correct_type = BotSpellTypes::CompleteHeal; } else if (IsHealOverTimeSpell(spell_id)) { - correctType = BotSpellTypes::HoTHeals; + correct_type = BotSpellTypes::HoTHeals; } else if (IsRegularSingleTargetHealSpell(spell_id)) { - correctType = BotSpellTypes::RegularHeal; + correct_type = BotSpellTypes::RegularHeal; } else if (IsRegularPetHealSpell(spell_id)) { - correctType = BotSpellTypes::RegularHeal; + correct_type = BotSpellTypes::RegularHeal; } } } else if (IsAnyBuffSpell(spell_id)) { if (IsResistanceOnlySpell(spell_id)) { - correctType = BotSpellTypes::ResistBuffs; + correct_type = BotSpellTypes::ResistBuffs; } else if (IsDamageShieldOnlySpell(spell_id)) { - correctType = BotSpellTypes::DamageShields; + correct_type = BotSpellTypes::DamageShields; } else { - correctType = BotSpellTypes::Buff; + correct_type = BotSpellTypes::Buff; } } } - return correctType; + return correct_type; } -uint16 GetPetSpellType(uint16 spellType) { - switch (spellType) { - case BotSpellTypes::Buff: - return BotSpellTypes::PetBuffs; - case BotSpellTypes::RegularHeal: - return BotSpellTypes::PetRegularHeals; - case BotSpellTypes::CompleteHeal: - return BotSpellTypes::PetCompleteHeals; - case BotSpellTypes::FastHeals: - return BotSpellTypes::PetFastHeals; - case BotSpellTypes::VeryFastHeals: - return BotSpellTypes::PetVeryFastHeals; - case BotSpellTypes::HoTHeals: - return BotSpellTypes::PetHoTHeals; - case BotSpellTypes::Cure: - return BotSpellTypes::PetCures; - case BotSpellTypes::DamageShields: - return BotSpellTypes::PetDamageShields; - case BotSpellTypes::ResistBuffs: - return BotSpellTypes::PetResistBuffs; - default: - return spellType; +uint16 GetPetSpellType(uint16 spell_type) { + switch (spell_type) { + case BotSpellTypes::Buff: + return BotSpellTypes::PetBuffs; + case BotSpellTypes::RegularHeal: + return BotSpellTypes::PetRegularHeals; + case BotSpellTypes::CompleteHeal: + return BotSpellTypes::PetCompleteHeals; + case BotSpellTypes::FastHeals: + return BotSpellTypes::PetFastHeals; + case BotSpellTypes::VeryFastHeals: + return BotSpellTypes::PetVeryFastHeals; + case BotSpellTypes::HoTHeals: + return BotSpellTypes::PetHoTHeals; + case BotSpellTypes::Cure: + return BotSpellTypes::PetCures; + case BotSpellTypes::DamageShields: + return BotSpellTypes::PetDamageShields; + case BotSpellTypes::ResistBuffs: + return BotSpellTypes::PetResistBuffs; + default: + return spell_type; } - return spellType; + return spell_type; } diff --git a/common/spdat.h b/common/spdat.h index 985aab518..69662eee0 100644 --- a/common/spdat.h +++ b/common/spdat.h @@ -896,23 +896,23 @@ const uint32 SPELL_TYPES_DETRIMENTAL = (SpellType_Nuke | SpellType_Root | SpellT const uint32 SPELL_TYPES_BENEFICIAL = (SpellType_Heal | SpellType_Buff | SpellType_Escape | SpellType_Pet | SpellType_InCombatBuff | SpellType_Cure | SpellType_HateRedux | SpellType_InCombatBuffSong | SpellType_OutOfCombatBuffSong | SpellType_PreCombatBuff | SpellType_PreCombatBuffSong); const uint32 SPELL_TYPES_INNATE = (SpellType_Nuke | SpellType_Lifetap | SpellType_DOT | SpellType_Dispel | SpellType_Mez | SpellType_Slow | SpellType_Debuff | SpellType_Charm | SpellType_Root); -bool IsBotSpellTypeDetrimental (uint16 spellType); -bool IsBotSpellTypeBeneficial (uint16 spellType); -bool IsBotSpellTypeOtherBeneficial(uint16 spellType); -bool IsBotSpellTypeInnate (uint16 spellType); -bool IsAEBotSpellType(uint16 spellType); -bool IsGroupBotSpellType(uint16 spellType); -bool IsGroupTargetOnlyBotSpellType(uint16 spellType); -bool IsPetBotSpellType(uint16 spellType); -bool IsClientBotSpellType(uint16 spellType); -bool IsHealBotSpellType(uint16 spellType); -bool SpellTypeRequiresLoS(uint16 spellType); -bool SpellTypeRequiresTarget(uint16 spellType); -bool SpellTypeRequiresAEChecks(uint16 spellType); -bool IsCommandedSpellType(uint16 spellType); -bool IsPullingSpellType(uint16 spellType); -uint16 GetCorrectSpellType(uint16 spellType, uint16 spell_id); -uint16 GetPetSpellType(uint16 spellType); +bool IsBotSpellTypeDetrimental (uint16 spell_type); +bool IsBotSpellTypeBeneficial (uint16 spell_type); +bool IsBotSpellTypeOtherBeneficial(uint16 spell_type); +bool IsBotSpellTypeInnate (uint16 spell_type); +bool IsAEBotSpellType(uint16 spell_type); +bool IsGroupBotSpellType(uint16 spell_type); +bool IsGroupTargetOnlyBotSpellType(uint16 spell_type); +bool IsPetBotSpellType(uint16 spell_type); +bool IsClientBotSpellType(uint16 spell_type); +bool IsHealBotSpellType(uint16 spell_type); +bool SpellTypeRequiresLoS(uint16 spell_type); +bool SpellTypeRequiresTarget(uint16 spell_type); +bool SpellTypeRequiresAEChecks(uint16 spell_type); +bool IsCommandedSpellType(uint16 spell_type); +bool IsPullingSpellType(uint16 spell_type); +uint16 GetCorrectSpellType(uint16 spell_type, uint16 spell_id); +uint16 GetPetSpellType(uint16 spell_type); // These should not be used to determine spell category.. // They are a graphical affects (effects?) index only @@ -1810,7 +1810,7 @@ bool IsEffectInSpell(uint16 spell_id, int effect_id); uint16 GetSpellTriggerSpellID(uint16 spell_id, int effect_id); bool IsBlankSpellEffect(uint16 spell_id, int effect_index); bool IsValidSpell(uint32 spell_id); -bool IsValidSpellAndLoS(uint32 spell_id, bool hasLoS = true); +bool IsValidSpellAndLoS(uint32 spell_id, bool has_los = true); bool IsSummonSpell(uint16 spell_id); bool IsDamageSpell(uint16 spell_id); bool IsAnyDamageSpell(uint16 spell_id); @@ -1906,7 +1906,7 @@ int8 SpellEffectsCount(uint16 spell_id); bool IsLichSpell(uint16 spell_id); bool IsInstantHealSpell(uint32 spell_id); bool IsResurrectSpell(uint16 spell_id); -bool RequiresStackCheck(uint16 spellType); +bool RequiresStackCheck(uint16 spell_type); bool IsResistanceOnlySpell(uint16 spell_id); bool IsDamageShieldOnlySpell(uint16 spell_id); bool IsHateSpell(uint16 spell_id); diff --git a/zone/bot.cpp b/zone/bot.cpp index 76268c03f..3f99c4cdb 100644 --- a/zone/bot.cpp +++ b/zone/bot.cpp @@ -1803,20 +1803,20 @@ void Bot::SpellProcess() { } } -void Bot::BotMeditate(bool isSitting) { +void Bot::BotMeditate(bool is_sitting) { if (GetManaRatio() < GetSitManaPct() || (GetHPRatio() < GetSitHPPct() && GetLevel() < GetStopMeleeLevel())) { - if ((!IsEngaged() || (IsEngaged() && GetMedInCombat() && !HasTargetReflection())) && !isSitting) { + if ((!IsEngaged() || (IsEngaged() && GetMedInCombat() && !HasTargetReflection())) && !is_sitting) { Sit(); } } else { - if (isSitting) { + if (is_sitting) { Stand(); } } } -bool Bot::BotRangedAttack(Mob* other, bool CanDoubleAttack) { +bool Bot::BotRangedAttack(Mob* other, bool can_double_attack) { if (!other || !IsAttackAllowed(other) || IsCasting() || DivineAura() || IsStunned() || IsMezzed() || (GetAppearance() == eaDead)) { return false; } @@ -1831,48 +1831,48 @@ bool Bot::BotRangedAttack(Mob* other, bool CanDoubleAttack) { return false; } - if (!CanDoubleAttack && ((attack_timer.Enabled() && !attack_timer.Check(false)) || (ranged_timer.Enabled() && !ranged_timer.Check()))) { + if (!can_double_attack && ((attack_timer.Enabled() && !attack_timer.Check(false)) || (ranged_timer.Enabled() && !ranged_timer.Check()))) { LogCombatDetail("Bot ranged attack canceled. Timer not up. Attack [{}] ranged [{}]", attack_timer.GetRemainingTime(), ranged_timer.GetRemainingTime()); return false; } - const auto rangedItem = GetBotItem(EQ::invslot::slotRange); - const EQ::ItemData* RangeWeapon = nullptr; + const auto ranged_item = GetBotItem(EQ::invslot::slotRange); + const EQ::ItemData* ranged_weapon = nullptr; - if (rangedItem) { - RangeWeapon = rangedItem->GetItem(); + if (ranged_item) { + ranged_weapon = ranged_item->GetItem(); } - if (!RangeWeapon) { + if (!ranged_weapon) { return false; } - const auto ammoItem = GetBotItem(EQ::invslot::slotAmmo); - const EQ::ItemData* Ammo = nullptr; + const auto ammo_item = GetBotItem(EQ::invslot::slotAmmo); + const EQ::ItemData* ammo = nullptr; - if (ammoItem) { - Ammo = ammoItem->GetItem(); + if (ammo_item) { + ammo = ammo_item->GetItem(); } // Bow requires arrows if ( - !Ammo || - (RangeWeapon && + !ammo || + (ranged_weapon && ( - (RangeWeapon->ItemType != EQ::item::ItemTypeBow && RangeWeapon->ItemType != EQ::item::ItemTypeSmallThrowing && RangeWeapon->ItemType != EQ::item::ItemTypeLargeThrowing) || - (RangeWeapon->ItemType == EQ::item::ItemTypeBow && (Ammo->ItemType != EQ::item::ItemTypeArrow)) || + (ranged_weapon->ItemType != EQ::item::ItemTypeBow && ranged_weapon->ItemType != EQ::item::ItemTypeSmallThrowing && ranged_weapon->ItemType != EQ::item::ItemTypeLargeThrowing) || + (ranged_weapon->ItemType == EQ::item::ItemTypeBow && (ammo->ItemType != EQ::item::ItemTypeArrow)) || ( - (RangeWeapon->ItemType == EQ::item::ItemTypeSmallThrowing || RangeWeapon->ItemType == EQ::item::ItemTypeLargeThrowing) && - ammoItem->GetCharges() < 1 || + (ranged_weapon->ItemType == EQ::item::ItemTypeSmallThrowing || ranged_weapon->ItemType == EQ::item::ItemTypeLargeThrowing) && + ammo_item->GetCharges() < 1 || ( - (RuleI(Bots, StackSizeMin) != -1 && rangedItem->GetCharges() != RangeWeapon->StackSize) || - rangedItem->GetCharges() < RuleI(Bots, StackSizeMin) + (RuleI(Bots, StackSizeMin) != -1 && ranged_item->GetCharges() != ranged_weapon->StackSize) || + ranged_item->GetCharges() < RuleI(Bots, StackSizeMin) ) ) ) ) ) { - if (!Ammo || ammoItem->GetCharges() < 1) { + if (!ammo || ammo_item->GetCharges() < 1) { if (!GetCombatRoundForAlerts()) { SetCombatRoundForAlerts(); BotGroupSay(this, "I do not have enough any ammo!"); @@ -1884,17 +1884,17 @@ bool Bot::BotRangedAttack(Mob* other, bool CanDoubleAttack) { LogCombatDetail("Ranged attacking [{}] with {} [{}] ([{}]){}{}{}", other->GetCleanName(), - (RangeWeapon->ItemType == EQ::item::ItemTypeBow ? "bow" : "throwing"), - RangeWeapon->Name, - RangeWeapon->ID, - (Ammo && Ammo->ItemType == EQ::item::ItemTypeArrow ? " and arrow " : ""), - (Ammo && Ammo->ItemType == EQ::item::ItemTypeArrow ? Ammo->Name : ""), - (Ammo && Ammo->ItemType == EQ::item::ItemTypeArrow ? std::to_string(Ammo->ID) : "") + (ranged_weapon->ItemType == EQ::item::ItemTypeBow ? "bow" : "throwing"), + ranged_weapon->Name, + ranged_weapon->ID, + (ammo && ammo->ItemType == EQ::item::ItemTypeArrow ? " and arrow " : ""), + (ammo && ammo->ItemType == EQ::item::ItemTypeArrow ? ammo->Name : ""), + (ammo && ammo->ItemType == EQ::item::ItemTypeArrow ? std::to_string(ammo->ID) : "") ); - SendItemAnimation(other, Ammo, (RangeWeapon->ItemType == EQ::item::ItemTypeBow ? EQ::skills::SkillArchery : EQ::skills::SkillThrowing)); - if (RangeWeapon->ItemType == EQ::item::ItemTypeBow) { - DoArcheryAttackDmg(other, rangedItem, ammoItem); // watch + SendItemAnimation(other, ammo, (ranged_weapon->ItemType == EQ::item::ItemTypeBow ? EQ::skills::SkillArchery : EQ::skills::SkillThrowing)); + if (ranged_weapon->ItemType == EQ::item::ItemTypeBow) { + DoArcheryAttackDmg(other, ranged_item, ammo_item); // watch //EndlessQuiver AA base1 = 100% Chance to avoid consumption arrow. int ChanceAvoidConsume = aabonuses.ConsumeProjectile + itembonuses.ConsumeProjectile + spellbonuses.ConsumeProjectile; @@ -1903,15 +1903,15 @@ bool Bot::BotRangedAttack(Mob* other, bool CanDoubleAttack) { if ( consumes_ammo && ( - RangeWeapon->ExpendableArrow || + ranged_weapon->ExpendableArrow || !ChanceAvoidConsume || (ChanceAvoidConsume < 100 && zone->random.Int(0, 99) > ChanceAvoidConsume) ) ) { - ammoItem->SetCharges((ammoItem->GetCharges() - 1)); + ammo_item->SetCharges((ammo_item->GetCharges() - 1)); LogCombatDetail("Consumed Archery Ammo from slot {}.", EQ::invslot::slotAmmo); - if (ammoItem->GetCharges() < 1) { + if (ammo_item->GetCharges() < 1) { RemoveBotItemBySlot(EQ::invslot::slotAmmo); BotRemoveEquipItem(EQ::invslot::slotAmmo); } @@ -1924,13 +1924,13 @@ bool Bot::BotRangedAttack(Mob* other, bool CanDoubleAttack) { } } else { - DoThrowingAttackDmg(other, rangedItem); // watch + DoThrowingAttackDmg(other, ranged_item); // watch // Consume Ammo, unless Ammo Consumption is disabled if (RuleB(Bots, BotThrowingConsumesAmmo)) { - ammoItem->SetCharges((ammoItem->GetCharges() - 1)); + ammo_item->SetCharges((ammo_item->GetCharges() - 1)); LogCombatDetail("Consumed Throwing Ammo from slot {}.", EQ::invslot::slotAmmo); - if (ammoItem->GetCharges() < 1) { + if (ammo_item->GetCharges() < 1) { RemoveBotItemBySlot(EQ::invslot::slotAmmo); BotRemoveEquipItem(EQ::invslot::slotAmmo); } @@ -1945,7 +1945,7 @@ bool Bot::BotRangedAttack(Mob* other, bool CanDoubleAttack) { return true; } -bool Bot::CheckBotDoubleAttack(bool tripleAttack) { +bool Bot::CheckBotDoubleAttack(bool triple_attack) { //Check for bonuses that give you a double attack chance regardless of skill (ie Bestial Frenzy/Harmonious Attack AA) uint32 bonus_give_double_attack = aabonuses.GiveDoubleAttack + spellbonuses.GiveDoubleAttack + itembonuses.GiveDoubleAttack; @@ -2146,10 +2146,10 @@ void Bot::AI_Process() return; } - std::vector spellTargetList = GatherSpellTargets(RuleB(Bots, CrossRaidBuffingAndHealing)); - SetSpellTargetList(spellTargetList); - std::vector groupSpellTargetList = GatherSpellTargets(); - SetGroupSpellTargetList(groupSpellTargetList); + std::vector spell_target_list = GatherSpellTargets(RuleB(Bots, CrossRaidBuffingAndHealing)); + SetSpellTargetList(spell_target_list); + std::vector group_spell_target_list = GatherSpellTargets(); + SetGroupSpellTargetList(group_spell_target_list); SetTempSpellType(UINT16_MAX); // HEAL ROTATION CASTING CHECKS @@ -2235,10 +2235,10 @@ void Bot::AI_Process() // COMBAT RANGE CALCS - bool atCombatRange = false; - bool behindMob = BehindMob(tar, GetX(), GetY()); - bool frontMob = InFrontMob(tar, GetX(), GetY()); - uint8 stopMeleeLevel = GetStopMeleeLevel(); + bool at_combat_range = false; + bool behind_mob = BehindMob(tar, GetX(), GetY()); + bool front_mob = InFrontMob(tar, GetX(), GetY()); + uint8 stop_melee_level = GetStopMeleeLevel(); const EQ::ItemInstance* p_item; const EQ::ItemInstance* s_item; float melee_distance_min = 0.0f; @@ -2246,7 +2246,7 @@ void Bot::AI_Process() float melee_distance = 0.0f; tar_distance = sqrt(tar_distance); - CheckCombatRange(tar, tar_distance, atCombatRange, behindMob, p_item, s_item, melee_distance_min, melee_distance, melee_distance_max, stopMeleeLevel); + CheckCombatRange(tar, tar_distance, at_combat_range, behind_mob, p_item, s_item, melee_distance_min, melee_distance, melee_distance_max, stop_melee_level); // PULLING FLAG (ACTIONABLE RANGE) @@ -2257,7 +2257,7 @@ void Bot::AI_Process() return; } - if (atCombatRange) { + if (at_combat_range) { if (!tar->GetSpecialAbility(SpecialAbility::RangedAttackImmunity) && RuleB(Bots, AllowRangedPulling) && IsBotRanged() && ranged_timer.Check(false)) { StopMoving(CalculateHeadingToTarget(tar->GetX(), tar->GetY())); @@ -2280,12 +2280,12 @@ void Bot::AI_Process() } if (RuleB(Bots, UseSpellPulling)) { - uint16 pullSpell = RuleI(Bots, PullSpellID); + uint16 spell_id = RuleI(Bots, PullSpellID); - if (tar_distance <= spells[pullSpell].range) { + if (tar_distance <= spells[spell_id].range) { StopMoving(); SetPullingSpell(true); - CastSpell(pullSpell, tar->GetID()); + CastSpell(spell_id, tar->GetID()); SetPullingSpell(false); return; @@ -2300,11 +2300,11 @@ void Bot::AI_Process() // ENGAGED AT COMBAT RANGE // We can fight - if (atCombatRange) { - bool jitterCooldown = false; + if (at_combat_range) { + bool jitter_cooldown = false; if (m_combat_jitter_timer.GetRemainingTime() > 1 && m_combat_jitter_timer.Enabled()) { - jitterCooldown = true; + jitter_cooldown = true; } if (IsMoving() || GetCombatJitterFlag() || GetCombatOutOfRangeJitterFlag()) { @@ -2315,8 +2315,8 @@ void Bot::AI_Process() return; } - if (!jitterCooldown && AI_movement_timer->Check() && (!spellend_timer.Enabled() || GetClass() == Class::Bard)) { - DoCombatPositioning(tar, Goal, stopMeleeLevel, tar_distance, melee_distance_min, melee_distance, melee_distance_max, behindMob, frontMob); + if (!jitter_cooldown && AI_movement_timer->Check() && (!spellend_timer.Enabled() || GetClass() == Class::Bard)) { + DoCombatPositioning(tar, Goal, stop_melee_level, tar_distance, melee_distance_min, melee_distance, melee_distance_max, behind_mob, front_mob); return; } else { @@ -2342,7 +2342,7 @@ void Bot::AI_Process() ranged_timer.Start(); } - else if (!IsBotRanged() && GetLevel() < stopMeleeLevel) { + else if (!IsBotRanged() && GetLevel() < stop_melee_level) { if (!GetMaxMeleeRange() || !RuleB(Bots, DisableSpecialAbilitiesAtMaxMelee)) { DoClassAttacks(tar); } @@ -2509,17 +2509,17 @@ bool Bot::TryAutoDefend(Client* bot_owner, float leash_distance) { NOT_HOLDING && NOT_PASSIVE ) { - XTargetAutoHaters* tempHaters; - std::vector assisteeHaters; - std::vector assisteeMembers; + XTargetAutoHaters* temp_haters; + std::vector assistee_haters; + std::vector assistee_members; bool found = false; if (bot_owner->GetAggroCount()) { - tempHaters = bot_owner->GetXTargetAutoMgr(); + temp_haters = bot_owner->GetXTargetAutoMgr(); - if (tempHaters && !tempHaters->empty()) { - assisteeHaters.emplace_back(tempHaters); - assisteeMembers.emplace_back(bot_owner); + if (temp_haters && !temp_haters->empty()) { + assistee_haters.emplace_back(temp_haters); + assistee_members.emplace_back(bot_owner); } } @@ -2528,7 +2528,7 @@ bool Bot::TryAutoDefend(Client* bot_owner, float leash_distance) { RuleB(Bots, AllowCrossGroupRaidAssist) ) { XTargetAutoHaters* temp_xhaters = bot_owner->GetXTargetAutoMgr(); - bool assisteeFound = false; + bool assistee_found = false; if (IsRaidGrouped()) { Raid* raid = GetStoredRaid(); @@ -2546,8 +2546,8 @@ bool Bot::TryAutoDefend(Client* bot_owner, float leash_distance) { continue; } - assisteeHaters.emplace_back(temp_xhaters); - assisteeMembers.emplace_back(m.member); + assistee_haters.emplace_back(temp_xhaters); + assistee_members.emplace_back(m.member); } } } @@ -2568,8 +2568,8 @@ bool Bot::TryAutoDefend(Client* bot_owner, float leash_distance) { continue; } - assisteeHaters.emplace_back(temp_xhaters); - assisteeMembers.emplace_back(m->CastToClient()); + assistee_haters.emplace_back(temp_xhaters); + assistee_members.emplace_back(m->CastToClient()); } } } @@ -2583,32 +2583,32 @@ bool Bot::TryAutoDefend(Client* bot_owner, float leash_distance) { Client* c = entity_list.GetClientByCharID(bot_owner->GetAssistee()); if (bot_owner->IsInGroupOrRaid(c) && c->GetAggroCount()) { - tempHaters = bot_owner->GetXTargetAutoMgr(); + temp_haters = bot_owner->GetXTargetAutoMgr(); - if (tempHaters && !tempHaters->empty()) { - assisteeHaters.emplace_back(tempHaters); - assisteeMembers.emplace_back(c); + if (temp_haters && !temp_haters->empty()) { + assistee_haters.emplace_back(temp_haters); + assistee_members.emplace_back(c); } } } } - if (!assisteeHaters.empty()) { - for (XTargetAutoHaters* xHaters : assisteeHaters) { - if (!xHaters->empty()) { - for (auto hater_iter : xHaters->get_list()) { + if (!assistee_haters.empty()) { + for (XTargetAutoHaters* x_haters : assistee_haters) { + if (!x_haters->empty()) { + for (auto hater_iter : x_haters->get_list()) { if (!hater_iter.spawn_id) { continue; } Mob* hater = nullptr; - for (Client* xMember : assisteeMembers) { + for (Client* x_member : assistee_members) { if ( - xMember && - xMember->GetBotPulling() && - xMember->GetTarget() && - (hater_iter.spawn_id == xMember->GetTarget()->GetID()) + x_member && + x_member->GetBotPulling() && + x_member->GetTarget() && + (hater_iter.spawn_id == x_member->GetTarget()->GetID()) ) { continue; } @@ -2619,7 +2619,7 @@ bool Bot::TryAutoDefend(Client* bot_owner, float leash_distance) { hater && !hater->IsMezzed() && (DistanceSquared(hater->GetPosition(), bot_owner->GetPosition()) <= leash_distance) && - hater->CastToNPC()->IsOnHatelist(xMember) + hater->CastToNPC()->IsOnHatelist(x_member) ) { break; } @@ -2915,8 +2915,8 @@ bool Bot::TryEvade(Mob* tar) { return false; } -void Bot::CheckCombatRange(Mob* tar, float tar_distance, bool& atCombatRange, bool behindMob, const EQ::ItemInstance*& p_item, const EQ::ItemInstance*& s_item, float& melee_distance_min, float& melee_distance, float& melee_distance_max, uint8 stopMeleeLevel) { - atCombatRange= false; +void Bot::CheckCombatRange(Mob* tar, float tar_distance, bool& at_combat_range, bool behind_mob, const EQ::ItemInstance*& p_item, const EQ::ItemInstance*& s_item, float& melee_distance_min, float& melee_distance, float& melee_distance_max, uint8 stop_melee_level) { + at_combat_range = false; p_item = GetBotItem(EQ::invslot::slotPrimary); s_item = GetBotItem(EQ::invslot::slotSecondary); @@ -2930,14 +2930,14 @@ void Bot::CheckCombatRange(Mob* tar, float tar_distance, bool& atCombatRange, bo } // Calculate melee distances - CalcMeleeDistances(tar, p_item, s_item, backstab_weapon, behindMob, melee_distance_min, melee_distance, melee_distance_max, stopMeleeLevel); + CalcMeleeDistances(tar, p_item, s_item, backstab_weapon, behind_mob, melee_distance_min, melee_distance, melee_distance_max, stop_melee_level); if (tar_distance <= melee_distance) { - atCombatRange = true; + at_combat_range = true; } } -void Bot::CalcMeleeDistances(const Mob* tar, const EQ::ItemInstance* const& p_item, const EQ::ItemInstance* const& s_item, bool backstab_weapon, bool behindMob, float& melee_distance_min, float& melee_distance, float& melee_distance_max, uint8 stopMeleeLevel) { +void Bot::CalcMeleeDistances(const Mob* tar, const EQ::ItemInstance* const& p_item, const EQ::ItemInstance* const& s_item, bool backstab_weapon, bool behind_mob, float& melee_distance_min, float& melee_distance, float& melee_distance_max, uint8 stop_melee_level) { float size_mod = GetSize(); float other_size_mod = tar->GetSize(); @@ -3017,7 +3017,7 @@ void Bot::CalcMeleeDistances(const Mob* tar, const EQ::ItemInstance* const& p_it } break; case Class::Rogue: - if (behindMob && backstab_weapon) { + if (behind_mob && backstab_weapon) { if (p_item->GetItem()->IsType2HWeapon()) { melee_distance = melee_distance_max * 0.30f; } @@ -3057,25 +3057,25 @@ void Bot::CalcMeleeDistances(const Mob* tar, const EQ::ItemInstance* const& p_it melee_distance = melee_distance * RuleR(Bots, TauntNormalMeleeRangeDistance); } - bool isStopMeleeLevel = GetLevel() >= stopMeleeLevel; + bool is_stop_melee_level = GetLevel() >= stop_melee_level; - if (!IsTaunting() && !IsBotRanged() && !isStopMeleeLevel && GetMaxMeleeRange()) { + if (!IsTaunting() && !IsBotRanged() && !is_stop_melee_level && GetMaxMeleeRange()) { melee_distance_min = melee_distance_max * RuleR(Bots, PercentMinMaxMeleeRangeDistance); melee_distance = melee_distance_max * RuleR(Bots, PercentMaxMeleeRangeDistance); } - if (isStopMeleeLevel && !IsBotRanged()) { - float desiredRange = GetBotDistanceRanged(); - melee_distance_min = std::max(melee_distance, (desiredRange / 2)); - melee_distance = std::max((melee_distance + 1), desiredRange); + if (is_stop_melee_level && !IsBotRanged()) { + float desired_range = GetBotDistanceRanged(); + melee_distance_min = std::max(melee_distance, (desired_range / 2)); + melee_distance = std::max((melee_distance + 1), desired_range); } if (IsBotRanged()) { - float minDistance = RuleI(Combat, MinRangedAttackDist); - float maxDistance = GetBotRangedValue(); - float desiredRange = GetBotDistanceRanged(); - melee_distance_min = std::max(minDistance, (desiredRange / 2)); - melee_distance = std::min(maxDistance, desiredRange); + float min_distance = RuleI(Combat, MinRangedAttackDist); + float max_distance = GetBotRangedValue(); + float desired_range = GetBotDistanceRanged(); + melee_distance_min = std::max(min_distance, (desired_range / 2)); + melee_distance = std::min(max_distance, desired_range); } } @@ -5888,14 +5888,17 @@ bool Bot::IsImmuneToSpell(uint16 spell_id, Mob *caster) { bool Bot::DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_center, CastAction_type &CastAction, EQ::spells::CastingSlot slot) { bool Result = false; - SpellTargetType targetType = spells[spell_id].target_type; - if (targetType == ST_GroupClientAndPet) { + SpellTargetType target_type = spells[spell_id].target_type; + + if (target_type == ST_GroupClientAndPet) { if ((spell_id == 1768 && zone->GetZoneID() == 202) || (!IsDetrimentalSpell(spell_id))) { CastAction = SingleTarget; return true; } } + Result = Mob::DetermineSpellTargets(spell_id, spell_target, ae_center, CastAction, slot); + return Result; } @@ -6854,10 +6857,13 @@ bool Bot::IsAtRange(Mob *target) { range *= range; float targetDistance = DistanceSquaredNoZ(m_Position, target->GetPosition()); float minRuleDistance = (RuleI(Combat, MinRangedAttackDist) * RuleI(Combat, MinRangedAttackDist)); - if ((targetDistance > range) || (targetDistance < minRuleDistance)) + + if ((targetDistance > range) || (targetDistance < minRuleDistance)) { result = false; - else + } + else { result = true; + } } return result; } @@ -7266,7 +7272,7 @@ bool Bot::CheckLoreConflict(const EQ::ItemData* item) { return (m_inv.HasItemByLoreGroup(item->LoreGroup, invWhereWorn) != INVALID_INDEX); } -bool Bot::AttemptCloseBeneficialSpells(uint16 spellType) { +bool Bot::AttemptCloseBeneficialSpells(uint16 spell_type) { bool result = false; Mob* tar = nullptr; @@ -7277,14 +7283,14 @@ bool Bot::AttemptCloseBeneficialSpells(uint16 spellType) { continue; } - if (IsGroupTargetOnlyBotSpellType(spellType)) { + if (IsGroupTargetOnlyBotSpellType(spell_type)) { Raid* raid = GetStoredRaid(); if (raid && (raid->GetGroup(GetName()) == raid->GetGroup(tar->GetName()))) { continue; } } - result = AttemptAICastSpell(spellType, tar); + result = AttemptAICastSpell(spell_type, tar); if (!result) { if (tar->HasPet() && (!m->GetPet()->IsFamiliar() || RuleB(Bots, AllowBuffingHealingFamiliars))) { @@ -7298,7 +7304,7 @@ bool Bot::AttemptCloseBeneficialSpells(uint16 spellType) { continue; } - result = AttemptAICastSpell(spellType, tar); + result = AttemptAICastSpell(spell_type, tar); } } @@ -7575,7 +7581,7 @@ void EntityList::ScanCloseClientMobs(std::unordered_map& close_mob LogAIScanCloseDetail("Close Client Mob List Size [{}] for mob [{}]", close_mobs.size(), scanning_mob->GetCleanName()); } -uint8 Bot::GetNumberNeedingHealedInGroup(uint8 hpr, bool includePets, Raid* raid) { +uint8 Bot::GetNumberNeedingHealedInGroup(uint8 hpr, bool include_pets, Raid* raid) { uint8 need_healed = 0; if (HasGroup()) { @@ -7590,14 +7596,14 @@ uint8 Bot::GetNumberNeedingHealedInGroup(uint8 hpr, bool includePets, Raid* raid need_healed++; } - if (includePets && member->GetPet() && !member->GetPet()->IsFamiliar() && member->GetPet()->GetHPRatio() <= hpr) { + if (include_pets && member->GetPet() && !member->GetPet()->IsFamiliar() && member->GetPet()->GetHPRatio() <= hpr) { need_healed++; } } } } } - return GetNumberNeedingHealedInRaidGroup(need_healed, hpr, includePets, raid); + return GetNumberNeedingHealedInRaidGroup(need_healed, hpr, include_pets, raid); } int Bot::GetRawACNoShield(int &shield_ac) { @@ -7719,7 +7725,7 @@ int Bot::GroupLeadershipAAOffenseEnhancement() { } bool Bot::GetNeedsCured(Mob *tar) { - bool needCured = false; + bool need_cured = false; if (tar) { if (tar->FindType(SE_PoisonCounter) || tar->FindType(SE_DiseaseCounter) || tar->FindType(SE_CurseCounter) || tar->FindType(SE_CorruptionCounter)) { @@ -7732,14 +7738,14 @@ bool Bot::GetNeedsCured(Mob *tar) { continue; } - needCured = true; + need_cured = true; } } } } } - return needCured; + return need_cured; } bool Bot::GetNeedsHateRedux(Mob *tar) { @@ -7757,38 +7763,38 @@ bool Bot::GetNeedsHateRedux(Mob *tar) { } bool Bot::HasOrMayGetAggro(bool SitAggro, uint32 spell_id) { - bool mayGetAggro = false; + bool may_get_aggro = false; if (GetTarget() && GetTarget()->GetHateTop()) { - Mob* topHate = GetTarget()->GetHateTop(); - if (topHate == this) { - mayGetAggro = true; + Mob* top_hate = GetTarget()->GetHateTop(); + if (top_hate == this) { + may_get_aggro = true; } else { - uint32 myHateAmt = GetTarget()->GetHateAmount(this); - uint32 topHateAmt = GetTarget()->GetHateAmount(topHate); + uint32 my_hate_amt = GetTarget()->GetHateAmount(this); + uint32 top_hate_amt = GetTarget()->GetHateAmount(top_hate); if (SitAggro && !spell_id) { - myHateAmt *= (1 + (RuleI(Aggro, SittingAggroMod) / 100)); + my_hate_amt *= (1 + (RuleI(Aggro, SittingAggroMod) / 100)); } if (spell_id && IsValidSpell(spell_id) && GetTarget()) { - myHateAmt += CheckAggroAmount(spell_id, GetTarget()); + my_hate_amt += CheckAggroAmount(spell_id, GetTarget()); } if ( - topHateAmt < 1 || + top_hate_amt < 1 || ( - myHateAmt > 0 && - (uint8)((myHateAmt / topHateAmt) * 100) > RuleI(Bots, HasOrMayGetAggroThreshold) + my_hate_amt > 0 && + (uint8)((my_hate_amt / top_hate_amt) * 100) > RuleI(Bots, HasOrMayGetAggroThreshold) ) ) { - mayGetAggro = true; + may_get_aggro = true; } } } - return mayGetAggro; + return may_get_aggro; } void Bot::SetDefaultBotStance() { @@ -9309,45 +9315,45 @@ void Bot::DoItemClick(const EQ::ItemData *item, uint16 slot_id) uint8 Bot::spell_casting_chances[SPELL_TYPE_COUNT][Class::PLAYER_CLASS_COUNT][Stance::AEBurn][cntHSND] = { 0 }; -bool Bot::PrecastChecks(Mob* tar, uint16 spellType) { +bool Bot::PrecastChecks(Mob* tar, uint16 spell_type) { if (!tar) { LogBotPreChecksDetail("{} says, 'Cancelling cast due to PrecastChecks !tar.'", GetCleanName()); return false; } - LogBotPreChecksDetail("{} says, 'Running [{}] PreChecks on [{}].'", GetCleanName(), GetSpellTypeNameByID(spellType), tar->GetCleanName()); + LogBotPreChecksDetail("{} says, 'Running [{}] PreChecks on [{}].'", GetCleanName(), GetSpellTypeNameByID(spell_type), tar->GetCleanName()); - if (GetUltimateSpellHold(spellType, tar)) { - LogBotHoldChecksDetail("{} says, 'Cancelling cast of [{}] on [{}] due to GetUltimateSpellHold.'", GetCleanName(), GetSpellTypeNameByID(spellType), tar->GetCleanName()); + if (GetUltimateSpellHold(spell_type, tar)) { + LogBotHoldChecksDetail("{} says, 'Cancelling cast of [{}] on [{}] due to GetUltimateSpellHold.'", GetCleanName(), GetSpellTypeNameByID(spell_type), tar->GetCleanName()); return false; } - if (IsPullingSpell() && IsPullingSpellType(spellType)) { //Skip remaining checks for commanded + if (IsPullingSpell() && IsPullingSpellType(spell_type)) { //Skip remaining checks for commanded return true; } - if (GetManaRatio() < GetSpellTypeMinManaLimit(spellType) || GetManaRatio() > GetSpellTypeMaxManaLimit(spellType)) { - LogBotPreChecksDetail("{} says, 'Cancelling cast of [{}] on [{}] due to GetSpellTypeMinManaLimit or GetSpellTypeMaxManaLimit.'", GetCleanName(), GetSpellTypeNameByID(spellType), tar->GetCleanName()); + if (GetManaRatio() < GetSpellTypeMinManaLimit(spell_type) || GetManaRatio() > GetSpellTypeMaxManaLimit(spell_type)) { + LogBotPreChecksDetail("{} says, 'Cancelling cast of [{}] on [{}] due to GetSpellTypeMinManaLimit or GetSpellTypeMaxManaLimit.'", GetCleanName(), GetSpellTypeNameByID(spell_type), tar->GetCleanName()); return false; } - if (GetHPRatio() < GetSpellTypeMinHPLimit(spellType) || GetHPRatio() > GetSpellTypeMaxHPLimit(spellType)) { - LogBotPreChecksDetail("{} says, 'Cancelling cast of [{}] on [{}] due to GetSpellTypeMinHPLimit or GetSpellTypeMaxHPLimit.'", GetCleanName(), GetSpellTypeNameByID(spellType), tar->GetCleanName()); + if (GetHPRatio() < GetSpellTypeMinHPLimit(spell_type) || GetHPRatio() > GetSpellTypeMaxHPLimit(spell_type)) { + LogBotPreChecksDetail("{} says, 'Cancelling cast of [{}] on [{}] due to GetSpellTypeMinHPLimit or GetSpellTypeMaxHPLimit.'", GetCleanName(), GetSpellTypeNameByID(spell_type), tar->GetCleanName()); return false; } - if (!GetUltimateSpellDelayCheck(spellType, tar)) { - LogBotDelayChecksDetail("{} says, 'Cancelling cast of [{}] on [{}] due to GetUltimateSpellDelayCheck.'", GetCleanName(), GetSpellTypeNameByID(spellType), tar->GetCleanName()); + if (!GetUltimateSpellDelayCheck(spell_type, tar)) { + LogBotDelayChecksDetail("{} says, 'Cancelling cast of [{}] on [{}] due to GetUltimateSpellDelayCheck.'", GetCleanName(), GetSpellTypeNameByID(spell_type), tar->GetCleanName()); return false; } - switch (spellType) { //This will skip Threshold Checks during Precast for specific SpellTypes that are checked when acquiring new targets + switch (spell_type) { //This will skip Threshold Checks during Precast for specific SpellTypes that are checked when acquiring new targets case BotSpellTypes::Mez: case BotSpellTypes::AEMez: return true; default: - if (GetHPRatioForSpellType(spellType, tar) < GetUltimateSpellMinThreshold(spellType, tar) || GetHPRatioForSpellType(spellType, tar) > GetUltimateSpellMaxThreshold(spellType, tar)) { - LogBotThresholdChecksDetail("{} says, 'Cancelling cast of [{}] on [{}] due to GetUltimateSpellMinThreshold or GetUltimateSpellMaxThreshold.'", GetCleanName(), GetSpellTypeNameByID(spellType), tar->GetCleanName()); + if (GetHPRatioForSpellType(spell_type, tar) < GetUltimateSpellMinThreshold(spell_type, tar) || GetHPRatioForSpellType(spell_type, tar) > GetUltimateSpellMaxThreshold(spell_type, tar)) { + LogBotThresholdChecksDetail("{} says, 'Cancelling cast of [{}] on [{}] due to GetUltimateSpellMinThreshold or GetUltimateSpellMaxThreshold.'", GetCleanName(), GetSpellTypeNameByID(spell_type), tar->GetCleanName()); return false; } } @@ -9355,8 +9361,8 @@ bool Bot::PrecastChecks(Mob* tar, uint16 spellType) { return true; } -bool Bot::CastChecks(uint16 spell_id, Mob* tar, uint16 spellType, bool doPrechecks, bool AECheck) { - if (doPrechecks) { +bool Bot::CastChecks(uint16 spell_id, Mob* tar, uint16 spell_type, bool prechecks, bool ae_check) { + if (prechecks) { if (!tar) { LogBotPreChecksDetail("{} says, 'Cancelling cast due to CastChecks !tar.'", GetCleanName()); return false; @@ -9371,13 +9377,13 @@ bool Bot::CastChecks(uint16 spell_id, Mob* tar, uint16 spellType, bool doPrechec } } - if (!PrecastChecks(tar, spellType)) { + if (!PrecastChecks(tar, spell_type)) { LogBotPreChecksDetail("{} says, 'Cancelling cast due to !PrecastChecks.'", GetCleanName()); return false; } } - LogBotPreChecksDetail("{} says, 'Running [{}] CastChecks on [{}].'", GetCleanName(), GetSpellTypeNameByID(spellType), (tar ? tar->GetCleanName() : "nobody")); + LogBotPreChecksDetail("{} says, 'Running [{}] CastChecks on [{}].'", GetCleanName(), GetSpellTypeNameByID(spell_type), (tar ? tar->GetCleanName() : "nobody")); if (!IsValidSpell(spell_id)) { LogBotPreChecksDetail("{} says, 'Cancelling cast due to !IsValidSpell.'", GetCleanName()); @@ -9465,7 +9471,7 @@ bool Bot::CastChecks(uint16 spell_id, Mob* tar, uint16 spellType, bool doPrechec return false; } - if (SpellTypeRequiresTarget(spellType) && !tar) { + if (SpellTypeRequiresTarget(spell_type) && !tar) { LogBotPreChecksDetail("{} says, 'Cancelling cast due to CastChecks !tar.'", GetCleanName()); return false; } @@ -9473,7 +9479,7 @@ bool Bot::CastChecks(uint16 spell_id, Mob* tar, uint16 spellType, bool doPrechec if ( spells[spell_id].target_type == ST_Self && tar != this && - (spellType != BotSpellTypes::SummonCorpse || RuleB(Bots, AllowCommandedSummonCorpse)) + (spell_type != BotSpellTypes::SummonCorpse || RuleB(Bots, AllowCommandedSummonCorpse)) ) { LogBotPreChecksDetail("{} says, 'Cancelling cast of {} on {} due to ST_Self.'", GetCleanName(), GetSpellName(spell_id), tar->GetCleanName()); return false; @@ -9530,7 +9536,7 @@ bool Bot::CastChecks(uint16 spell_id, Mob* tar, uint16 spellType, bool doPrechec } } //LogBotPreChecksDetail("{} says, 'Doing CanCastSpellType checks of {} on {}.'", GetCleanName(), GetSpellName(spell_id), tar->GetCleanName()); - if (!CanCastSpellType(spellType, spell_id, tar)) { + if (!CanCastSpellType(spell_type, spell_id, tar)) { return false; } @@ -9544,7 +9550,7 @@ bool Bot::CastChecks(uint16 spell_id, Mob* tar, uint16 spellType, bool doPrechec } if ( - (RequiresStackCheck(spellType) || (!RequiresStackCheck(spellType) && CalcBuffDuration(this, tar, spell_id) != 0)) + (RequiresStackCheck(spell_type) || (!RequiresStackCheck(spell_type) && CalcBuffDuration(this, tar, spell_id) != 0)) && tar->CanBuffStack(spell_id, GetLevel(), true) < 0 ) { @@ -9561,16 +9567,16 @@ bool Bot::CastChecks(uint16 spell_id, Mob* tar, uint16 spellType, bool doPrechec return false; } - if (spellType == UINT16_MAX) { //AA/Forced cast checks, return here + if (spell_type == UINT16_MAX) { //AA/Forced cast checks, return here return true; } - if (!IsTaunting() && GetSpellTypeAggroCheck(spellType) && HasOrMayGetAggro(IsSitting(), spell_id) && !tar->IsFleeing()) { + if (!IsTaunting() && GetSpellTypeAggroCheck(spell_type) && HasOrMayGetAggro(IsSitting(), spell_id) && !tar->IsFleeing()) { LogBotPreChecksDetail("{} says, 'Cancelling cast of {} on {} due to HasOrMayGetAggro.'", GetCleanName(), GetSpellName(spell_id), tar->GetCleanName()); return false; } - if (!DoResistCheckBySpellType(tar, spell_id, spellType)) { + if (!DoResistCheckBySpellType(tar, spell_id, spell_type)) { LogBotPreChecksDetail("{} says, 'Cancelling cast of {} on {} due to DoResistCheckBySpellType.'", GetCleanName(), GetSpellName(spell_id), tar->GetCleanName()); return false; } @@ -9583,15 +9589,15 @@ bool Bot::CastChecks(uint16 spell_id, Mob* tar, uint16 spellType, bool doPrechec return true; } -bool Bot::CanCastSpellType(uint16 spellType, uint16 spell_id, Mob* tar) { +bool Bot::CanCastSpellType(uint16 spell_type, uint16 spell_id, Mob* tar) { if (!spell_id || !tar) { - LogBotPreChecksDetail("{} says, 'Cancelling cast of {} on {} due to failsafe checks.'", GetCleanName(), (spell_id ? GetSpellName(spell_id) : (spellType ? GetSpellTypeNameByID(spellType) : "Unknown")), (tar ? tar->GetCleanName() : "Unknown")); + LogBotPreChecksDetail("{} says, 'Cancelling cast of {} on {} due to failsafe checks.'", GetCleanName(), (spell_id ? GetSpellName(spell_id) : (spell_type ? GetSpellTypeNameByID(spell_type) : "Unknown")), (tar ? tar->GetCleanName() : "Unknown")); return false; } - uint8 botClass = GetClass(); + uint8 bot_class = GetClass(); - switch (spellType) { + switch (spell_type) { case BotSpellTypes::Buff: case BotSpellTypes::PetBuffs: case BotSpellTypes::PreCombatBuff: @@ -9616,7 +9622,7 @@ bool Bot::CanCastSpellType(uint16 spellType, uint16 spell_id, Mob* tar) { return false; } - if ((spellType != BotSpellTypes::Teleport && spellType != BotSpellTypes::Succor) && (IsEffectInSpell(spell_id, SE_Teleport) || IsEffectInSpell(spell_id, SE_Succor))) { + if ((spell_type != BotSpellTypes::Teleport && spell_type != BotSpellTypes::Succor) && (IsEffectInSpell(spell_id, SE_Teleport) || IsEffectInSpell(spell_id, SE_Succor))) { LogBotPreChecksDetail("{} says, 'Cancelling cast of {} on {} due to Teleport.'", GetCleanName(), GetSpellName(spell_id), tar->GetCleanName()); return false; } @@ -9667,7 +9673,7 @@ bool Bot::CanCastSpellType(uint16 spellType, uint16 spell_id, Mob* tar) { } // Differences for each type - if (spellType != BotSpellTypes::InCombatBuff) { + if (spell_type != BotSpellTypes::InCombatBuff) { if (IsEffectInSpell(spell_id, SE_AbsorbMagicAtt) || IsEffectInSpell(spell_id, SE_Rune)) { for (int i = 0; i < tar->GetMaxTotalSlots(); i++) { uint32 buff_count = tar->GetMaxTotalSlots(); @@ -9740,10 +9746,9 @@ bool Bot::BotHasEnoughMana(uint16 spell_id) { return false; } - //int32 manaCost = GetActSpellCost(spell_id, spells[spell_id].mana); - int32 manaCost = spells[spell_id].mana; + int32 mana_cost = spells[spell_id].mana; - if (GetMana() < manaCost) { + if (GetMana() < mana_cost) { return false; } @@ -9756,7 +9761,7 @@ bool Bot::IsTargetAlreadyReceivingSpell(Mob* tar, uint16 spell_id) { } std::vector v; - uint16 targetID = tar->GetID(); + uint16 target_id = tar->GetID(); if (RuleB(Bots, CrossRaidBuffingAndHealing)) { v = GetSpellTargetList(); @@ -9782,7 +9787,7 @@ bool Bot::IsTargetAlreadyReceivingSpell(Mob* tar, uint16 spell_id) { } } else { - if (m->CastToBot()->casting_spell_targetid == targetID) { + if (m->CastToBot()->casting_spell_targetid == target_id) { return true; } } @@ -9805,90 +9810,90 @@ bool Bot::DoResistCheck(Mob* tar, uint16 spell_id, int32 resist_limit) { level_mod = -level_mod; } - int32 targetResist = 0; + int32 target_resist = 0; switch (GetSpellResistType(spell_id)) { case RESIST_NONE: return true; case RESIST_MAGIC: - targetResist = tar->GetMR(); + target_resist = tar->GetMR(); break; case RESIST_COLD: - targetResist = tar->GetCR(); + target_resist = tar->GetCR(); break; case RESIST_FIRE: - targetResist = tar->GetFR(); + target_resist = tar->GetFR(); break; case RESIST_POISON: - targetResist = tar->GetPR(); + target_resist = tar->GetPR(); break; case RESIST_DISEASE: - targetResist = tar->GetDR(); + target_resist = tar->GetDR(); break; case RESIST_CORRUPTION: - targetResist = tar->GetCorrup(); + target_resist = tar->GetCorrup(); break; default: return true; } - //LogBotPreChecksDetail("DoResistCheck on {} for {} - TarResist [{}] LMod [{}] ResistDiff [{}] - Adjust [{}] > ResistLim [{}]", tar->GetCleanName(), GetSpellName(spell_id), targetResist, level_mod, resist_difficulty, (targetResist + level_mod - resist_difficulty), resist_limit); - if ((targetResist + level_mod - resist_difficulty) > resist_limit) { + //LogBotPreChecksDetail("DoResistCheck on {} for {} - TarResist [{}] LMod [{}] ResistDiff [{}] - Adjust [{}] > ResistLim [{}]", tar->GetCleanName(), GetSpellName(spell_id), target_resist, level_mod, resist_difficulty, (target_resist + level_mod - resist_difficulty), resist_limit); + if ((target_resist + level_mod - resist_difficulty) > resist_limit) { return false; } return true; } -bool Bot::DoResistCheckBySpellType(Mob* tar, uint16 spell_id, uint16 spellType) { +bool Bot::DoResistCheckBySpellType(Mob* tar, uint16 spell_id, uint16 spell_type) { if (!tar || !IsValidSpell(spell_id)) { return false; } - if (GetSpellTypeResistLimit(spellType) == 0) { + if (GetSpellTypeResistLimit(spell_type) == 0) { return true; } - return DoResistCheck(tar, spell_id, GetSpellTypeResistLimit(spellType)); + return DoResistCheck(tar, spell_id, GetSpellTypeResistLimit(spell_type)); } -bool Bot::IsValidTargetType(uint16 spell_id, int targetType, uint8 bodyType) { +bool Bot::IsValidTargetType(uint16 spell_id, int target_type, uint8 body_type) { if (!spell_id) { return false; } - switch (targetType) { + switch (target_type) { case ST_Undead: - if (bodyType == BodyType::Undead || bodyType == BodyType::SummonedUndead || bodyType == BodyType::Vampire) { + if (body_type == BodyType::Undead || body_type == BodyType::SummonedUndead || body_type == BodyType::Vampire) { return true; } break; case ST_Summoned: - if (bodyType == BodyType::Summoned || bodyType == BodyType::Summoned2 || bodyType == BodyType::Summoned3) { + if (body_type == BodyType::Summoned || body_type == BodyType::Summoned2 || body_type == BodyType::Summoned3) { return true; } break; case ST_Animal: - if (bodyType == BodyType::Animal) { + if (body_type == BodyType::Animal) { return true; } break; case ST_Plant: - if (bodyType == BodyType::Plant) { + if (body_type == BodyType::Plant) { return true; } break; case ST_Giant: - if (bodyType == BodyType::Giant || bodyType == BodyType::RaidGiant) { + if (body_type == BodyType::Giant || body_type == BodyType::RaidGiant) { return true; } break; case ST_Dragon: - if (bodyType == BodyType::Dragon || bodyType == BodyType::VeliousDragon) { + if (body_type == BodyType::Dragon || body_type == BodyType::VeliousDragon) { return true; } @@ -9979,104 +9984,104 @@ bool Bot::IsValidMezTarget(Mob* owner, Mob* npc, uint16 spell_id) { return true; } -void Bot::SetBotSetting(uint8 settingType, uint16 botSetting, int settingValue) { - switch (settingType) { +void Bot::SetBotSetting(uint8 setting_type, uint16 bot_setting, int setting_value) { + switch (setting_type) { case BotSettingCategories::BaseSetting: - SetBotBaseSetting(botSetting, settingValue); + SetBotBaseSetting(bot_setting, setting_value); break; case BotSettingCategories::SpellHold: - SetSpellHold(botSetting, settingValue); + SetSpellHold(bot_setting, setting_value); break; case BotSettingCategories::SpellDelay: - SetSpellDelay(botSetting, settingValue); + SetSpellDelay(bot_setting, setting_value); break; case BotSettingCategories::SpellMinThreshold: - SetSpellMinThreshold(botSetting, settingValue); + SetSpellMinThreshold(bot_setting, setting_value); break; case BotSettingCategories::SpellMaxThreshold: - SetSpellMaxThreshold(botSetting, settingValue); + SetSpellMaxThreshold(bot_setting, setting_value); break; case BotSettingCategories::SpellTypeAggroCheck: - SetSpellTypeAggroCheck(botSetting, settingValue); + SetSpellTypeAggroCheck(bot_setting, setting_value); break; case BotSettingCategories::SpellTypeMinManaPct: - SetSpellTypeMinManaLimit(botSetting, settingValue); + SetSpellTypeMinManaLimit(bot_setting, setting_value); break; case BotSettingCategories::SpellTypeMaxManaPct: - SetSpellTypeMaxManaLimit(botSetting, settingValue); + SetSpellTypeMaxManaLimit(bot_setting, setting_value); break; case BotSettingCategories::SpellTypeMinHPPct: - SetSpellTypeMinHPLimit(botSetting, settingValue); + SetSpellTypeMinHPLimit(bot_setting, setting_value); break; case BotSettingCategories::SpellTypeMaxHPPct: - SetSpellTypeMaxHPLimit(botSetting, settingValue); + SetSpellTypeMaxHPLimit(bot_setting, setting_value); break; case BotSettingCategories::SpellTypeIdlePriority: - SetSpellTypePriority(botSetting, BotPriorityCategories::Idle, settingValue); + SetSpellTypePriority(bot_setting, BotPriorityCategories::Idle, setting_value); break; case BotSettingCategories::SpellTypeEngagedPriority: - SetSpellTypePriority(botSetting, BotPriorityCategories::Engaged, settingValue); + SetSpellTypePriority(bot_setting, BotPriorityCategories::Engaged, setting_value); break; case BotSettingCategories::SpellTypePursuePriority: - SetSpellTypePriority(botSetting, BotPriorityCategories::Pursue, settingValue); + SetSpellTypePriority(bot_setting, BotPriorityCategories::Pursue, setting_value); break; case BotSettingCategories::SpellTypeAEOrGroupTargetCount: - SetSpellTypeAEOrGroupTargetCount(botSetting, settingValue); + SetSpellTypeAEOrGroupTargetCount(bot_setting, setting_value); break; } } -void Bot::SetBotBaseSetting(uint16 botSetting, int settingValue) { - switch (botSetting) { +void Bot::SetBotBaseSetting(uint16 bot_setting, int setting_value) { + switch (bot_setting) { case BotBaseSettings::ExpansionBitmask: - SetExpansionBitmask(settingValue); + SetExpansionBitmask(setting_value); break; case BotBaseSettings::ShowHelm: - SetShowHelm(settingValue); + SetShowHelm(setting_value); break; case BotBaseSettings::FollowDistance: - SetFollowDistance(EQ::Clamp(static_cast(settingValue * settingValue), static_cast(1), static_cast((RuleI(Bots, MaxFollowDistance) * RuleI(Bots, MaxFollowDistance))))); + SetFollowDistance(EQ::Clamp(static_cast(setting_value * setting_value), static_cast(1), static_cast((RuleI(Bots, MaxFollowDistance) * RuleI(Bots, MaxFollowDistance))))); break; case BotBaseSettings::StopMeleeLevel: - SetStopMeleeLevel(settingValue); + SetStopMeleeLevel(setting_value); break; case BotBaseSettings::EnforceSpellSettings: - SetBotEnforceSpellSetting(settingValue); + SetBotEnforceSpellSetting(setting_value); break; case BotBaseSettings::RangedSetting: - SetBotRangedSetting(settingValue); + SetBotRangedSetting(setting_value); break; case BotBaseSettings::PetSetTypeSetting: - SetPetChooserID(settingValue); + SetPetChooserID(setting_value); break; case BotBaseSettings::BehindMob: - SetBehindMob(settingValue); + SetBehindMob(setting_value); break; case BotBaseSettings::DistanceRanged: - SetBotDistanceRanged(settingValue); + SetBotDistanceRanged(setting_value); break; case BotBaseSettings::IllusionBlock: - SetIllusionBlock(settingValue); + SetIllusionBlock(setting_value); break; case BotBaseSettings::MaxMeleeRange: - SetMaxMeleeRange(settingValue); + SetMaxMeleeRange(setting_value); break; case BotBaseSettings::MedInCombat: - SetMedInCombat(settingValue); + SetMedInCombat(setting_value); break; case BotBaseSettings::SitHPPct: - SetSitHPPct(settingValue); + SetSitHPPct(setting_value); break; case BotBaseSettings::SitManaPct: - SetSitManaPct(settingValue); + SetSitManaPct(setting_value); break; default: break; } } -int Bot::GetBotBaseSetting(uint16 botSetting) { - switch (botSetting) { +int Bot::GetBotBaseSetting(uint16 bot_setting) { + switch (bot_setting) { case BotBaseSettings::ExpansionBitmask: return GetExpansionBitmask(); case BotBaseSettings::ShowHelm: @@ -10112,8 +10117,8 @@ int Bot::GetBotBaseSetting(uint16 botSetting) { return true; } -int Bot::GetDefaultBotBaseSetting(uint16 botSetting, uint8 stance) { - switch (botSetting) { +int Bot::GetDefaultBotBaseSetting(uint16 bot_setting, uint8 stance) { + switch (bot_setting) { case BotBaseSettings::ExpansionBitmask: return RuleI(Bots, BotExpansionSettings); case BotBaseSettings::ShowHelm: @@ -10172,11 +10177,11 @@ int Bot::GetDefaultBotBaseSetting(uint16 botSetting, uint8 stance) { void Bot::LoadDefaultBotSettings() { _spellSettings.clear(); - uint8 botStance = GetBotStance(); + uint8 bot_stance = GetBotStance(); for (uint16 i = BotBaseSettings::START_ALL; i <= BotBaseSettings::END; ++i) { - SetBotBaseSetting(i, GetDefaultSetting(BotSettingCategories::BaseSetting, i, botStance)); - LogBotSettingsDetail("{} says, 'Setting default {} [{}] to [{}]'", GetCleanName(), GetBotSettingCategoryName(i), i, GetDefaultBotBaseSetting(i, botStance)); + SetBotBaseSetting(i, GetDefaultSetting(BotSettingCategories::BaseSetting, i, bot_stance)); + LogBotSettingsDetail("{} says, 'Setting default {} [{}] to [{}]'", GetCleanName(), GetBotSettingCategoryName(i), i, GetDefaultBotBaseSetting(i, bot_stance)); } for (uint16 i = BotSpellTypes::START; i <= BotSpellTypes::END; ++i) { @@ -10185,192 +10190,192 @@ void Bot::LoadDefaultBotSettings() { t.spellType = i; t.shortName = GetSpellTypeShortNameByID(i); t.name = GetSpellTypeNameByID(i); - t.hold = GetDefaultSpellHold(i, botStance); - t.delay = GetDefaultSpellDelay(i, botStance); - t.minThreshold = GetDefaultSpellMinThreshold(i, botStance); - t.maxThreshold = GetDefaultSpellMaxThreshold(i, botStance); - t.resistLimit = GetDefaultSpellTypeResistLimit(i, botStance); - t.aggroCheck = GetDefaultSpellTypeAggroCheck(i, botStance); - t.minManaPct = GetDefaultSpellTypeMinManaLimit(i, botStance); - t.maxManaPct = GetDefaultSpellTypeMaxManaLimit(i, botStance); - t.minHPPct = GetDefaultSpellTypeMinHPLimit(i, botStance); - t.maxHPPct = GetDefaultSpellTypeMaxHPLimit(i, botStance); - t.idlePriority = GetDefaultSpellTypePriority(i, BotPriorityCategories::Idle, GetClass(), botStance); - t.engagedPriority = GetDefaultSpellTypePriority(i, BotPriorityCategories::Engaged, GetClass(), botStance); - t.pursuePriority = GetDefaultSpellTypePriority(i, BotPriorityCategories::Pursue, GetClass(), botStance); - t.AEOrGroupTargetCount = GetDefaultSpellTypeAEOrGroupTargetCount(i, botStance); + t.hold = GetDefaultSpellHold(i, bot_stance); + t.delay = GetDefaultSpellDelay(i, bot_stance); + t.minThreshold = GetDefaultSpellMinThreshold(i, bot_stance); + t.maxThreshold = GetDefaultSpellMaxThreshold(i, bot_stance); + t.resistLimit = GetDefaultSpellTypeResistLimit(i, bot_stance); + t.aggroCheck = GetDefaultSpellTypeAggroCheck(i, bot_stance); + t.minManaPct = GetDefaultSpellTypeMinManaLimit(i, bot_stance); + t.maxManaPct = GetDefaultSpellTypeMaxManaLimit(i, bot_stance); + t.minHPPct = GetDefaultSpellTypeMinHPLimit(i, bot_stance); + t.maxHPPct = GetDefaultSpellTypeMaxHPLimit(i, bot_stance); + t.idlePriority = GetDefaultSpellTypePriority(i, BotPriorityCategories::Idle, GetClass(), bot_stance); + t.engagedPriority = GetDefaultSpellTypePriority(i, BotPriorityCategories::Engaged, GetClass(), bot_stance); + t.pursuePriority = GetDefaultSpellTypePriority(i, BotPriorityCategories::Pursue, GetClass(), bot_stance); + t.AEOrGroupTargetCount = GetDefaultSpellTypeAEOrGroupTargetCount(i, bot_stance); t.recastTimer.Start(); _spellSettings.push_back(t); - LogBotSettingsDetail("{} says, 'Setting defaults for {} ({}) [#{}] - [{} [#{}] stance]'", GetCleanName(), t.name, t.shortName, t.spellType, Stance::GetName(botStance), botStance); - LogBotSettingsDetail("{} says, 'Hold = [{}] | Delay = [{}ms] | MinThreshold = [{}\%] | MaxThreshold = [{}\%]'", GetCleanName(), GetDefaultSpellHold(i, botStance), GetDefaultSpellDelay(i, botStance), GetDefaultSpellMinThreshold(i, botStance), GetDefaultSpellMaxThreshold(i, botStance)); - LogBotSettingsDetail("{} says, 'AggroCheck = [{}] | MinManaPCT = [{}\%] | MaxManaPCT = [{}\%] | MinHPPCT = [{}\% | MaxHPPCT = [{}\%]'", GetCleanName(), GetDefaultSpellTypeAggroCheck(i, botStance), GetDefaultSpellTypeMinManaLimit(i, botStance), GetDefaultSpellTypeMaxManaLimit(i, botStance), GetDefaultSpellTypeMinHPLimit(i, botStance), GetDefaultSpellTypeMaxHPLimit(i, botStance)); - LogBotSettingsDetail("{} says, 'IdlePriority = [{}] | EngagedPriority = [{}] | PursuePriority = [{}] | AEOrGroupTargetCount = [{}]'", GetCleanName(), GetDefaultSpellTypeIdlePriority(i, GetClass(), botStance), GetDefaultSpellTypeEngagedPriority(i, GetClass(), botStance), GetDefaultSpellTypePursuePriority(i, GetClass(), botStance), GetDefaultSpellTypeAEOrGroupTargetCount(i, botStance)); + LogBotSettingsDetail("{} says, 'Setting defaults for {} ({}) [#{}] - [{} [#{}] stance]'", GetCleanName(), t.name, t.shortName, t.spellType, Stance::GetName(bot_stance), bot_stance); + LogBotSettingsDetail("{} says, 'Hold = [{}] | Delay = [{}ms] | MinThreshold = [{}\%] | MaxThreshold = [{}\%]'", GetCleanName(), GetDefaultSpellHold(i, bot_stance), GetDefaultSpellDelay(i, bot_stance), GetDefaultSpellMinThreshold(i, bot_stance), GetDefaultSpellMaxThreshold(i, bot_stance)); + LogBotSettingsDetail("{} says, 'AggroCheck = [{}] | MinManaPCT = [{}\%] | MaxManaPCT = [{}\%] | MinHPPCT = [{}\% | MaxHPPCT = [{}\%]'", GetCleanName(), GetDefaultSpellTypeAggroCheck(i, bot_stance), GetDefaultSpellTypeMinManaLimit(i, bot_stance), GetDefaultSpellTypeMaxManaLimit(i, bot_stance), GetDefaultSpellTypeMinHPLimit(i, bot_stance), GetDefaultSpellTypeMaxHPLimit(i, bot_stance)); + LogBotSettingsDetail("{} says, 'IdlePriority = [{}] | EngagedPriority = [{}] | PursuePriority = [{}] | AEOrGroupTargetCount = [{}]'", GetCleanName(), GetDefaultSpellTypeIdlePriority(i, GetClass(), bot_stance), GetDefaultSpellTypeEngagedPriority(i, GetClass(), bot_stance), GetDefaultSpellTypePursuePriority(i, GetClass(), bot_stance), GetDefaultSpellTypeAEOrGroupTargetCount(i, bot_stance)); } } -void Bot::SetBotSpellRecastTimer(uint16 spellType, Mob* tar, bool preCast) { +void Bot::SetBotSpellRecastTimer(uint16 spell_type, Mob* tar, bool precast) { if (!tar) { return; } - if (!preCast && IsBotSpellTypeOtherBeneficial(spellType)) { + if (!precast && IsBotSpellTypeOtherBeneficial(spell_type)) { return; } - uint32 addedDelay = 0; + uint32 added_delay = 0; - switch (spellType) { //Additional delays + switch (spell_type) { //Additional delays case BotSpellTypes::Mez: - addedDelay = RuleI(Bots, MezSuccessDelay); + added_delay = RuleI(Bots, MezSuccessDelay); break; case BotSpellTypes::AEMez: - addedDelay = RuleI(Bots, AEMezSuccessDelay); + added_delay = RuleI(Bots, AEMezSuccessDelay); break; } if (tar->IsPet() && tar->GetOwner() && tar->GetOwner()->IsOfClientBot()) { - return tar->GetOwner()->SetSpellTypeRecastTimer(spellType, (GetUltimateSpellDelay(spellType, tar) + addedDelay)); + return tar->GetOwner()->SetSpellTypeRecastTimer(spell_type, (GetUltimateSpellDelay(spell_type, tar) + added_delay)); } - else if (IsBotSpellTypeOtherBeneficial(spellType)) { - tar->SetSpellTypeRecastTimer(spellType, (GetUltimateSpellDelay(spellType, tar) + addedDelay)); + else if (IsBotSpellTypeOtherBeneficial(spell_type)) { + tar->SetSpellTypeRecastTimer(spell_type, (GetUltimateSpellDelay(spell_type, tar) + added_delay)); } else { - SetSpellTypeRecastTimer(spellType, (GetUltimateSpellDelay(spellType, tar) + addedDelay)); + SetSpellTypeRecastTimer(spell_type, (GetUltimateSpellDelay(spell_type, tar) + added_delay)); } } -BotSpell Bot::GetSpellByHealType(uint16 spellType, Mob* tar) { - switch (spellType) { +BotSpell Bot::GetSpellByHealType(uint16 spell_type, Mob* tar) { + switch (spell_type) { case BotSpellTypes::VeryFastHeals: case BotSpellTypes::PetVeryFastHeals: - return GetBestBotSpellForVeryFastHeal(this, tar, spellType); + return GetBestBotSpellForVeryFastHeal(this, tar, spell_type); case BotSpellTypes::FastHeals: case BotSpellTypes::PetFastHeals: - return GetBestBotSpellForFastHeal(this, tar, spellType); + return GetBestBotSpellForFastHeal(this, tar, spell_type); case BotSpellTypes::RegularHeal: case BotSpellTypes::PetRegularHeals: - return GetBestBotSpellForRegularSingleTargetHeal(this, tar, spellType); + return GetBestBotSpellForRegularSingleTargetHeal(this, tar, spell_type); case BotSpellTypes::GroupHeals: - return GetBestBotSpellForGroupHeal(this, tar, spellType); + return GetBestBotSpellForGroupHeal(this, tar, spell_type); case BotSpellTypes::CompleteHeal: case BotSpellTypes::PetCompleteHeals: - return GetBestBotSpellForPercentageHeal(this, tar, spellType); + return GetBestBotSpellForPercentageHeal(this, tar, spell_type); case BotSpellTypes::GroupCompleteHeals: - return GetBestBotSpellForGroupCompleteHeal(this, tar, spellType); + return GetBestBotSpellForGroupCompleteHeal(this, tar, spell_type); case BotSpellTypes::HoTHeals: case BotSpellTypes::PetHoTHeals: - return GetBestBotSpellForHealOverTime(this, tar, spellType); + return GetBestBotSpellForHealOverTime(this, tar, spell_type); case BotSpellTypes::GroupHoTHeals: - return GetBestBotSpellForGroupHealOverTime(this, tar, spellType); + return GetBestBotSpellForGroupHealOverTime(this, tar, spell_type); } } -uint16 Bot::GetSpellTypePriority(uint16 spellType, uint8 priorityType) { - switch (priorityType) { +uint16 Bot::GetSpellTypePriority(uint16 spell_type, uint8 priority_type) { + switch (priority_type) { case BotPriorityCategories::Idle: - return _spellSettings[spellType].idlePriority; + return _spellSettings[spell_type].idlePriority; case BotPriorityCategories::Engaged: - return _spellSettings[spellType].engagedPriority; + return _spellSettings[spell_type].engagedPriority; case BotPriorityCategories::Pursue: - return _spellSettings[spellType].pursuePriority; + return _spellSettings[spell_type].pursuePriority; default: return 0; } } -int Bot::GetDefaultSetting(uint16 settingCategory, uint16 settingType, uint8 stance) { - switch (settingCategory) { +int Bot::GetDefaultSetting(uint16 setting_category, uint16 setting_type, uint8 stance) { + switch (setting_category) { case BotSettingCategories::BaseSetting: - return GetDefaultBotBaseSetting(settingType, stance); + return GetDefaultBotBaseSetting(setting_type, stance); case BotSettingCategories::SpellHold: - return GetDefaultSpellHold(settingType, stance); + return GetDefaultSpellHold(setting_type, stance); case BotSettingCategories::SpellDelay: - return GetDefaultSpellDelay(settingType, stance); + return GetDefaultSpellDelay(setting_type, stance); case BotSettingCategories::SpellMinThreshold: - return GetDefaultSpellMinThreshold(settingType, stance); + return GetDefaultSpellMinThreshold(setting_type, stance); case BotSettingCategories::SpellMaxThreshold: - return GetDefaultSpellMaxThreshold(settingType, stance); + return GetDefaultSpellMaxThreshold(setting_type, stance); case BotSettingCategories::SpellTypeAggroCheck: - return GetDefaultSpellTypeAggroCheck(settingType, stance); + return GetDefaultSpellTypeAggroCheck(setting_type, stance); case BotSettingCategories::SpellTypeMinManaPct: - return GetDefaultSpellTypeMinManaLimit(settingType, stance); + return GetDefaultSpellTypeMinManaLimit(setting_type, stance); case BotSettingCategories::SpellTypeMaxManaPct: - return GetDefaultSpellTypeMaxManaLimit(settingType, stance); + return GetDefaultSpellTypeMaxManaLimit(setting_type, stance); case BotSettingCategories::SpellTypeMinHPPct: - return GetDefaultSpellTypeMinHPLimit(settingType, stance); + return GetDefaultSpellTypeMinHPLimit(setting_type, stance); case BotSettingCategories::SpellTypeMaxHPPct: - return GetDefaultSpellTypeMaxHPLimit(settingType, stance); + return GetDefaultSpellTypeMaxHPLimit(setting_type, stance); case BotSettingCategories::SpellTypeIdlePriority: - return GetDefaultSpellTypePriority(settingType, BotPriorityCategories::Idle, GetClass(), stance); + return GetDefaultSpellTypePriority(setting_type, BotPriorityCategories::Idle, GetClass(), stance); case BotSettingCategories::SpellTypeEngagedPriority: - return GetDefaultSpellTypePriority(settingType, BotPriorityCategories::Engaged, GetClass(), stance); + return GetDefaultSpellTypePriority(setting_type, BotPriorityCategories::Engaged, GetClass(), stance); case BotSettingCategories::SpellTypePursuePriority: - return GetDefaultSpellTypePriority(settingType, BotPriorityCategories::Pursue, GetClass(), stance); + return GetDefaultSpellTypePriority(setting_type, BotPriorityCategories::Pursue, GetClass(), stance); case BotSettingCategories::SpellTypeAEOrGroupTargetCount: - return GetDefaultSpellTypeAEOrGroupTargetCount(settingType, stance); + return GetDefaultSpellTypeAEOrGroupTargetCount(setting_type, stance); default: break; } } -int Bot::GetSetting(uint16 settingCategory, uint16 settingType) { - switch (settingCategory) { +int Bot::GetSetting(uint16 setting_category, uint16 setting_type) { + switch (setting_category) { case BotSettingCategories::BaseSetting: - return GetBotBaseSetting(settingType); + return GetBotBaseSetting(setting_type); case BotSettingCategories::SpellHold: - return GetSpellHold(settingType); + return GetSpellHold(setting_type); case BotSettingCategories::SpellDelay: - return GetSpellDelay(settingType); + return GetSpellDelay(setting_type); case BotSettingCategories::SpellMinThreshold: - return GetSpellMinThreshold(settingType); + return GetSpellMinThreshold(setting_type); case BotSettingCategories::SpellMaxThreshold: - return GetSpellMaxThreshold(settingType); + return GetSpellMaxThreshold(setting_type); case BotSettingCategories::SpellTypeAggroCheck: - return GetSpellTypeAggroCheck(settingType); + return GetSpellTypeAggroCheck(setting_type); case BotSettingCategories::SpellTypeMinManaPct: - return GetSpellTypeMinManaLimit(settingType); + return GetSpellTypeMinManaLimit(setting_type); case BotSettingCategories::SpellTypeMaxManaPct: - return GetSpellTypeMaxManaLimit(settingType); + return GetSpellTypeMaxManaLimit(setting_type); case BotSettingCategories::SpellTypeMinHPPct: - return GetSpellTypeMinHPLimit(settingType); + return GetSpellTypeMinHPLimit(setting_type); case BotSettingCategories::SpellTypeMaxHPPct: - return GetSpellTypeMaxHPLimit(settingType); + return GetSpellTypeMaxHPLimit(setting_type); case BotSettingCategories::SpellTypeIdlePriority: - return GetSpellTypePriority(settingType, BotPriorityCategories::Idle); + return GetSpellTypePriority(setting_type, BotPriorityCategories::Idle); case BotSettingCategories::SpellTypeEngagedPriority: - return GetSpellTypePriority(settingType, BotPriorityCategories::Engaged); + return GetSpellTypePriority(setting_type, BotPriorityCategories::Engaged); case BotSettingCategories::SpellTypePursuePriority: - return GetSpellTypePriority(settingType, BotPriorityCategories::Pursue); + return GetSpellTypePriority(setting_type, BotPriorityCategories::Pursue); case BotSettingCategories::SpellTypeAEOrGroupTargetCount: - return GetSpellTypeAEOrGroupTargetCount(settingType); + return GetSpellTypeAEOrGroupTargetCount(setting_type); default: break; } } -uint16 Bot::GetDefaultSpellTypePriority(uint16 spellType, uint8 priorityType, uint8 botClass, uint8 stance) { - switch (priorityType) { +uint16 Bot::GetDefaultSpellTypePriority(uint16 spell_type, uint8 priority_type, uint8 bot_class, uint8 stance) { + switch (priority_type) { case BotPriorityCategories::Idle: - return GetDefaultSpellTypeIdlePriority(spellType, botClass, stance); + return GetDefaultSpellTypeIdlePriority(spell_type, bot_class, stance); case BotPriorityCategories::Engaged: - return GetDefaultSpellTypeEngagedPriority(spellType, botClass, stance); + return GetDefaultSpellTypeEngagedPriority(spell_type, bot_class, stance); case BotPriorityCategories::Pursue: - return GetDefaultSpellTypePursuePriority(spellType, botClass, stance); + return GetDefaultSpellTypePursuePriority(spell_type, bot_class, stance); default: return 0; } } -uint16 Bot::GetDefaultSpellTypeIdlePriority(uint16 spellType, uint8 botClass, uint8 stance) { - if (!IsBotSpellTypeBeneficial(spellType)) { +uint16 Bot::GetDefaultSpellTypeIdlePriority(uint16 spell_type, uint8 bot_class, uint8 stance) { + if (!IsBotSpellTypeBeneficial(spell_type)) { return 0; } uint16 priority = 0; - switch (spellType) { + switch (spell_type) { case BotSpellTypes::VeryFastHeals: priority = 1; @@ -10484,8 +10489,8 @@ uint16 Bot::GetDefaultSpellTypeIdlePriority(uint16 spellType, uint8 botClass, ui return priority; } -uint16 Bot::GetDefaultSpellTypeEngagedPriority(uint16 spellType, uint8 botClass, uint8 stance) { - switch (spellType) { +uint16 Bot::GetDefaultSpellTypeEngagedPriority(uint16 spell_type, uint8 bot_class, uint8 stance) { + switch (spell_type) { case BotSpellTypes::Escape: return 1; case BotSpellTypes::VeryFastHeals: @@ -10579,8 +10584,8 @@ uint16 Bot::GetDefaultSpellTypeEngagedPriority(uint16 spellType, uint8 botClass, } } -uint16 Bot::GetDefaultSpellTypePursuePriority(uint16 spellType, uint8 botClass, uint8 stance) { - switch (spellType) { +uint16 Bot::GetDefaultSpellTypePursuePriority(uint16 spell_type, uint8 bot_class, uint8 stance) { + switch (spell_type) { case BotSpellTypes::Escape: return 1; case BotSpellTypes::VeryFastHeals: @@ -10632,9 +10637,9 @@ uint16 Bot::GetDefaultSpellTypePursuePriority(uint16 spellType, uint8 botClass, } } -uint16 Bot::GetDefaultSpellTypeResistLimit(uint16 spellType, uint8 stance) { +uint16 Bot::GetDefaultSpellTypeResistLimit(uint16 spell_type, uint8 stance) { - if (!IsBotSpellTypeBeneficial(spellType)) { + if (!IsBotSpellTypeBeneficial(spell_type)) { return RuleI(Bots, SpellResistLimit); } else { @@ -10642,7 +10647,7 @@ uint16 Bot::GetDefaultSpellTypeResistLimit(uint16 spellType, uint8 stance) { } } -bool Bot::GetDefaultSpellTypeAggroCheck(uint16 spellType, uint8 stance) { +bool Bot::GetDefaultSpellTypeAggroCheck(uint16 spell_type, uint8 stance) { switch (stance) { case Stance::AEBurn: case Stance::Burn: @@ -10651,7 +10656,7 @@ bool Bot::GetDefaultSpellTypeAggroCheck(uint16 spellType, uint8 stance) { break; } - switch (spellType) { + switch (spell_type) { case BotSpellTypes::Nuke: case BotSpellTypes::Root: case BotSpellTypes::Snare: @@ -10677,12 +10682,12 @@ bool Bot::GetDefaultSpellTypeAggroCheck(uint16 spellType, uint8 stance) { } } -uint8 Bot::GetDefaultSpellTypeMinManaLimit(uint16 spellType, uint8 stance) { +uint8 Bot::GetDefaultSpellTypeMinManaLimit(uint16 spell_type, uint8 stance) { return 0; } -uint8 Bot::GetDefaultSpellTypeMaxManaLimit(uint16 spellType, uint8 stance) { - switch (spellType) { +uint8 Bot::GetDefaultSpellTypeMaxManaLimit(uint16 spell_type, uint8 stance) { + switch (spell_type) { case BotSpellTypes::InCombatBuff: if (GetClass() == Class::Shaman) { return 75; @@ -10696,8 +10701,8 @@ uint8 Bot::GetDefaultSpellTypeMaxManaLimit(uint16 spellType, uint8 stance) { return 100; } -uint8 Bot::GetDefaultSpellTypeMinHPLimit(uint16 spellType, uint8 stance) { - switch (spellType) { +uint8 Bot::GetDefaultSpellTypeMinHPLimit(uint16 spell_type, uint8 stance) { + switch (spell_type) { case BotSpellTypes::InCombatBuff: if (GetClass() == Class::Shaman) { return 40; @@ -10711,99 +10716,99 @@ uint8 Bot::GetDefaultSpellTypeMinHPLimit(uint16 spellType, uint8 stance) { return 0; } -uint8 Bot::GetDefaultSpellTypeMaxHPLimit(uint16 spellType, uint8 stance) { +uint8 Bot::GetDefaultSpellTypeMaxHPLimit(uint16 spell_type, uint8 stance) { return 100; } -uint16 Bot::GetDefaultSpellTypeAEOrGroupTargetCount(uint16 spellType, uint8 stance) { - if (IsAEBotSpellType(spellType)) { +uint16 Bot::GetDefaultSpellTypeAEOrGroupTargetCount(uint16 spell_type, uint8 stance) { + if (IsAEBotSpellType(spell_type)) { return RuleI(Bots, MinTargetsForAESpell); } - if (IsGroupBotSpellType(spellType)) { + if (IsGroupBotSpellType(spell_type)) { return RuleI(Bots, MinTargetsForGroupSpell); } return 0; } -void Bot::SetSpellTypePriority(uint16 spellType, uint8 priorityType, uint16 priority) { - switch (priorityType) { +void Bot::SetSpellTypePriority(uint16 spell_type, uint8 priority_type, uint16 priority) { + switch (priority_type) { case BotPriorityCategories::Idle: - _spellSettings[spellType].idlePriority = priority; + _spellSettings[spell_type].idlePriority = priority; break; case BotPriorityCategories::Engaged: - _spellSettings[spellType].engagedPriority = priority; + _spellSettings[spell_type].engagedPriority = priority; break; case BotPriorityCategories::Pursue: - _spellSettings[spellType].pursuePriority = priority; + _spellSettings[spell_type].pursuePriority = priority; break; default: return; } } -void Bot::SetSpellTypeResistLimit(uint16 spellType, uint16 resistLimit) { - _spellSettings[spellType].resistLimit = resistLimit; +void Bot::SetSpellTypeResistLimit(uint16 spell_type, uint16 resist_limit) { + _spellSettings[spell_type].resistLimit = resist_limit; } -void Bot::SetSpellTypeAggroCheck(uint16 spellType, bool aggroCheck) { - _spellSettings[spellType].aggroCheck = aggroCheck; +void Bot::SetSpellTypeAggroCheck(uint16 spell_type, bool aggro_check) { + _spellSettings[spell_type].aggroCheck = aggro_check; } -void Bot::SetSpellTypeMinManaLimit(uint16 spellType, uint8 manaLimit) { - _spellSettings[spellType].minManaPct = manaLimit; +void Bot::SetSpellTypeMinManaLimit(uint16 spell_type, uint8 mana_limit) { + _spellSettings[spell_type].minManaPct = mana_limit; } -void Bot::SetSpellTypeMaxManaLimit(uint16 spellType, uint8 manaLimit) { - _spellSettings[spellType].maxManaPct = manaLimit; +void Bot::SetSpellTypeMaxManaLimit(uint16 spell_type, uint8 mana_limit) { + _spellSettings[spell_type].maxManaPct = mana_limit; } -void Bot::SetSpellTypeMinHPLimit(uint16 spellType, uint8 hpLimit) { - _spellSettings[spellType].minHPPct = hpLimit; +void Bot::SetSpellTypeMinHPLimit(uint16 spell_type, uint8 hp_limit) { + _spellSettings[spell_type].minHPPct = hp_limit; } -void Bot::SetSpellTypeMaxHPLimit(uint16 spellType, uint8 hpLimit) { - _spellSettings[spellType].maxHPPct = hpLimit; +void Bot::SetSpellTypeMaxHPLimit(uint16 spell_type, uint8 hp_limit) { + _spellSettings[spell_type].maxHPPct = hp_limit; } -void Bot::SetSpellTypeAEOrGroupTargetCount(uint16 spellType, uint16 targetCount) { - _spellSettings[spellType].AEOrGroupTargetCount = targetCount; +void Bot::SetSpellTypeAEOrGroupTargetCount(uint16 spell_type, uint16 target_count) { + _spellSettings[spell_type].AEOrGroupTargetCount = target_count; } -std::list Bot::GetSpellTypesPrioritized(uint8 priorityType) { - std::list castOrder; - std::list tempCastOrder; +std::list Bot::GetSpellTypesPrioritized(uint8 priority_type) { + std::list cast_order; + std::list temp_cast_order; for (uint16 i = BotSpellTypes::START; i <= BotSpellTypes::END; i++) { BotSpellTypeOrder typeSettings = { .spellType = i, - .priority = GetSpellTypePriority(i, priorityType) + .priority = GetSpellTypePriority(i, priority_type) }; - castOrder.emplace_back(typeSettings); + cast_order.emplace_back(typeSettings); } - for (auto& currentType : castOrder) { + for (auto& currentType : cast_order) { if (currentType.priority != 0) { - tempCastOrder.emplace_back(currentType); + temp_cast_order.emplace_back(currentType); } } - castOrder = tempCastOrder; + cast_order = temp_cast_order; - if (castOrder.size() > 1) { - castOrder.sort( + if (cast_order.size() > 1) { + cast_order.sort( [](BotSpellTypeOrder const& l, BotSpellTypeOrder const& r) { return l.priority < r.priority; } ); } - return castOrder; + return cast_order; } -bool Bot::AttemptAICastSpell(uint16 spellType, Mob* tar) { +bool Bot::AttemptAICastSpell(uint16 spell_type, Mob* tar) { bool result = false; if (!tar) { @@ -10811,28 +10816,28 @@ bool Bot::AttemptAICastSpell(uint16 spellType, Mob* tar) { tar = GetTarget(); } else { - if (!IsBotSpellTypeBeneficial(spellType)) { + if (!IsBotSpellTypeBeneficial(spell_type)) { return result; } } } - if (!IsTaunting() && !IsCommandedSpell() && GetSpellTypeAggroCheck(spellType) && HasOrMayGetAggro(IsSitting())) { - LogBotPreChecksDetail("{} says, 'Cancelling cast of [{}] due to GetSpellTypeAggroCheck and HasOrMayGetAggro.'", GetCleanName(), GetSpellTypeNameByID(spellType)); + if (!IsTaunting() && !IsCommandedSpell() && GetSpellTypeAggroCheck(spell_type) && HasOrMayGetAggro(IsSitting())) { + LogBotPreChecksDetail("{} says, 'Cancelling cast of [{}] due to GetSpellTypeAggroCheck and HasOrMayGetAggro.'", GetCleanName(), GetSpellTypeNameByID(spell_type)); return result; } - if (IsBotSpellTypeBeneficial(spellType)) { + if (IsBotSpellTypeBeneficial(spell_type)) { if (GetClass() == Class::Bard) { tar = this; } - if (!PrecastChecks(tar, spellType) || !AICastSpell(tar, GetChanceToCastBySpellType(spellType), spellType)) { + if (!PrecastChecks(tar, spell_type) || !AICastSpell(tar, GetChanceToCastBySpellType(spell_type), spell_type)) { return result; } } else { - if (!PrecastChecks(tar, spellType) || !AICastSpell(tar, GetChanceToCastBySpellType(spellType), spellType)) { + if (!PrecastChecks(tar, spell_type) || !AICastSpell(tar, GetChanceToCastBySpellType(spell_type), spell_type)) { return result; } } @@ -10937,7 +10942,7 @@ bool Bot::AttemptAACastSpell(Mob* tar, uint16 spell_id, AA::Rank* rank) { return true; } -bool Bot::AttemptForcedCastSpell(Mob* tar, uint16 spell_id, bool isDisc) { +bool Bot::AttemptForcedCastSpell(Mob* tar, uint16 spell_id, bool is_disc) { if (!IsValidSpell(spell_id)) { return false; } @@ -10987,7 +10992,7 @@ bool Bot::AttemptForcedCastSpell(Mob* tar, uint16 spell_id, bool isDisc) { return false; } - if (!isDisc) { + if (!is_disc) { if (!CheckSpellRecastTimer(spell_id)) { return false; } @@ -11048,7 +11053,7 @@ bool Bot::AttemptForcedCastSpell(Mob* tar, uint16 spell_id, bool isDisc) { int timer_duration = 0; - if (!isDisc) { + if (!is_disc) { timer_duration = CalcBuffDuration(tar, this, spell_id); if (timer_duration) { @@ -11077,7 +11082,7 @@ bool Bot::AttemptForcedCastSpell(Mob* tar, uint16 spell_id, bool isDisc) { } } - if (!isDisc) { + if (!is_disc) { SetSpellRecastTimer(spell_id, timer_duration); } else { @@ -11090,8 +11095,8 @@ bool Bot::AttemptForcedCastSpell(Mob* tar, uint16 spell_id, bool isDisc) { return false; } -uint16 Bot::GetParentSpellType(uint16 spellType) { - switch (spellType) { +uint16 Bot::GetParentSpellType(uint16 spell_type) { + switch (spell_type) { case BotSpellTypes::AENukes: case BotSpellTypes::AERains: case BotSpellTypes::AEStun: @@ -11175,22 +11180,22 @@ uint16 Bot::GetParentSpellType(uint16 spellType) { case BotSpellTypes::PreCombatBuffSong: case BotSpellTypes::Resurrect: default: - return spellType; + return spell_type; } - return spellType; + return spell_type; } -bool Bot::IsValidSpellTypeBySpellID(uint16 spellType, uint16 spell_id) { - if (IsAEBotSpellType(spellType) && !IsAnyAESpell(spell_id)) { +bool Bot::IsValidSpellTypeBySpellID(uint16 spell_type, uint16 spell_id) { + if (IsAEBotSpellType(spell_type) && !IsAnyAESpell(spell_id)) { return false; } - if (IsGroupBotSpellType(spellType) && !IsGroupSpell(spell_id)) { + if (IsGroupBotSpellType(spell_type) && !IsGroupSpell(spell_id)) { return false; } - switch (spellType) { + switch (spell_type) { case BotSpellTypes::Buff: case BotSpellTypes::PetBuffs: if (IsResistanceOnlySpell(spell_id) || IsDamageShieldOnlySpell(spell_id)) { @@ -11244,8 +11249,8 @@ bool Bot::IsValidSpellTypeBySpellID(uint16 spellType, uint16 spell_id) { return true; } -void Bot::SetCastedSpellType(uint16 spellType) { - _castedSpellType = spellType; +void Bot::SetCastedSpellType(uint16 spell_type) { + _castedSpellType = spell_type; } void Bot::DoFaceCheckWithJitter(Mob* tar) { @@ -11305,13 +11310,13 @@ void Bot::SetCombatJitter() { void Bot::DoCombatPositioning( Mob* tar, glm::vec3 Goal, - bool stopMeleeLevel, + bool stop_melee_level, float tar_distance, float melee_distance_min, float melee_distance, float melee_distance_max, - bool behindMob, - bool frontMob + bool behind_mob, + bool front_mob ) { if (HasTargetReflection()) { if (!IsTaunting() && !tar->IsFeared() && !tar->IsStunned()) { @@ -11328,7 +11333,7 @@ void Bot::DoCombatPositioning( } } } - else if (IsTaunting() && ((tar_distance < melee_distance_min) || !frontMob)) { // Back up any bots that are too close + else if (IsTaunting() && ((tar_distance < melee_distance_min) || !front_mob)) { // Back up any bots that are too close if (PlotBotPositionAroundTarget(tar, Goal.x, Goal.y, Goal.z, melee_distance_min, melee_distance, false, IsTaunting())) { RunToGoalWithJitter(Goal); @@ -11339,39 +11344,39 @@ void Bot::DoCombatPositioning( else { if (!tar->IsFeared()) { if (IsTaunting()) { // Taunting adjustments - Mob* mobTar = tar->GetTarget(); + Mob* mob_tar = tar->GetTarget(); - if (!mobTar || mobTar == nullptr) { + if (!mob_tar || mob_tar == nullptr) { DoFaceCheckNoJitter(tar); return; } if (RuleB(Bots, TauntingBotsFollowTopHate)) { // If enabled, taunting bots will stick to top hate - if (Distance(m_Position, mobTar->GetPosition()) > RuleI(Bots, DistanceTauntingBotsStickMainHate)) { - Goal = mobTar->GetPosition(); + if (Distance(m_Position, mob_tar->GetPosition()) > RuleI(Bots, DistanceTauntingBotsStickMainHate)) { + Goal = mob_tar->GetPosition(); RunToGoalWithJitter(Goal); return; } } else { // Otherwise, stick to any other bots that are taunting - if (mobTar->IsBot() && mobTar->CastToBot()->IsTaunting() && (Distance(m_Position, mobTar->GetPosition()) > RuleI(Bots, DistanceTauntingBotsStickMainHate))) { - Goal = mobTar->GetPosition(); + if (mob_tar->IsBot() && mob_tar->CastToBot()->IsTaunting() && (Distance(m_Position, mob_tar->GetPosition()) > RuleI(Bots, DistanceTauntingBotsStickMainHate))) { + Goal = mob_tar->GetPosition(); RunToGoalWithJitter(Goal); return; } } } - else if (tar_distance < melee_distance_min || (GetBehindMob() && !behindMob) || (IsTaunting() && !frontMob)|| !HasRequiredLoSForPositioning(tar)) { // Regular adjustment + else if (tar_distance < melee_distance_min || (GetBehindMob() && !behind_mob) || (IsTaunting() && !front_mob)|| !HasRequiredLoSForPositioning(tar)) { // Regular adjustment if (PlotBotPositionAroundTarget(tar, Goal.x, Goal.y, Goal.z, melee_distance_min, melee_distance, GetBehindMob(), IsTaunting())) { RunToGoalWithJitter(Goal); return; } } - else if (tar->IsEnraged() && !IsTaunting() && !stopMeleeLevel && !behindMob) { // Move non-taunting melee bots behind target during enrage + else if (tar->IsEnraged() && !IsTaunting() && !stop_melee_level && !behind_mob) { // Move non-taunting melee bots behind target during enrage if (PlotBotPositionAroundTarget(tar, Goal.x, Goal.y, Goal.z, melee_distance_min, melee_distance, true)) { RunToGoalWithJitter(Goal); @@ -11418,19 +11423,19 @@ bool Bot::HasRequiredLoSForPositioning(Mob* tar) { return true; } -bool Bot::HasValidAETarget(Bot* botCaster, uint16 spell_id, uint16 spellType, Mob* tar) { - int spellRange = botCaster->GetActSpellRange(spell_id, spells[spell_id].range); - int spellAERange = botCaster->GetActSpellRange(spell_id, spells[spell_id].aoe_range); - int targetCount = 0; +bool Bot::HasValidAETarget(Bot* caster, uint16 spell_id, uint16 spell_type, Mob* tar) { + int spell_range = caster->GetActSpellRange(spell_id, spells[spell_id].range); + int spell_ae_range = caster->GetActSpellRange(spell_id, spells[spell_id].aoe_range); + int target_count = 0; - for (auto& close_mob : botCaster->m_close_mobs) { + for (auto& close_mob : caster->m_close_mobs) { Mob* m = close_mob.second; if (tar == m) { continue; } - switch (spellType) { + switch (spell_type) { case BotSpellTypes::AEDispel: if (m->GetSpecialAbility(SpecialAbility::DispellImmunity)) { continue; @@ -11465,7 +11470,7 @@ bool Bot::HasValidAETarget(Bot* botCaster, uint16 spell_id, uint16 spellType, Mo break; } - if (!m->IsNPC() || (!IsCommandedSpell() && !m->CastToNPC()->IsOnHatelist(botCaster->GetOwner()))) { + if (!m->IsNPC() || (!IsCommandedSpell() && !m->CastToNPC()->IsOnHatelist(caster->GetOwner()))) { continue; } @@ -11475,27 +11480,27 @@ bool Bot::HasValidAETarget(Bot* botCaster, uint16 spell_id, uint16 spellType, Mo if (IsPBAESpell(spell_id)) { if ( - spellAERange >= Distance(botCaster->GetPosition(), m->GetPosition()) && - botCaster->CastChecks(spell_id, m, spellType, true, true) + spell_ae_range >= Distance(caster->GetPosition(), m->GetPosition()) && + caster->CastChecks(spell_id, m, spell_type, true, true) ) { - ++targetCount; + ++target_count; } } else { - if (!tar || spellRange < Distance(botCaster->GetPosition(), tar->GetPosition()) || !DoLosChecks(this, m)) { + if (!tar || spell_range < Distance(caster->GetPosition(), tar->GetPosition()) || !DoLosChecks(this, m)) { continue; } if ( - spellAERange >= Distance(tar->GetPosition(), m->GetPosition()) && - botCaster->CastChecks(spell_id, m, spellType, true, true) + spell_ae_range >= Distance(tar->GetPosition(), m->GetPosition()) && + caster->CastChecks(spell_id, m, spell_type, true, true) ) { - ++targetCount; + ++target_count; } } } - if (targetCount < botCaster->GetSpellTypeAEOrGroupTargetCount(spellType)) { + if (target_count < caster->GetSpellTypeAEOrGroupTargetCount(spell_type)) { return false; } @@ -11504,8 +11509,8 @@ bool Bot::HasValidAETarget(Bot* botCaster, uint16 spell_id, uint16 spellType, Mo return true; } -void Bot::CopySettings(Bot* to, uint8 settingType, uint16 spellType) { - switch (settingType) { +void Bot::CopySettings(Bot* to, uint8 setting_type, uint16 spell_type) { + switch (setting_type) { case BotSettingCategories::BaseSetting: for (uint16 i = BotBaseSettings::START; i <= BotBaseSettings::END; ++i) { to->SetBotBaseSetting(i, GetBotBaseSetting(i)); @@ -11513,8 +11518,8 @@ void Bot::CopySettings(Bot* to, uint8 settingType, uint16 spellType) { break; case BotSettingCategories::SpellHold: - if (spellType != UINT16_MAX) { - to->SetSpellHold(spellType, GetSpellHold(spellType)); + if (spell_type != UINT16_MAX) { + to->SetSpellHold(spell_type, GetSpellHold(spell_type)); } else { for (uint16 i = BotSpellTypes::START; i <= BotSpellTypes::END; ++i) { @@ -11524,8 +11529,8 @@ void Bot::CopySettings(Bot* to, uint8 settingType, uint16 spellType) { break; case BotSettingCategories::SpellDelay: - if (spellType != UINT16_MAX) { - to->SetSpellDelay(spellType, GetSpellDelay(spellType)); + if (spell_type != UINT16_MAX) { + to->SetSpellDelay(spell_type, GetSpellDelay(spell_type)); } else { for (uint16 i = BotSpellTypes::START; i <= BotSpellTypes::END; ++i) { @@ -11535,8 +11540,8 @@ void Bot::CopySettings(Bot* to, uint8 settingType, uint16 spellType) { break; case BotSettingCategories::SpellMinThreshold: - if (spellType != UINT16_MAX) { - to->SetSpellMinThreshold(spellType, GetSpellMinThreshold(spellType)); + if (spell_type != UINT16_MAX) { + to->SetSpellMinThreshold(spell_type, GetSpellMinThreshold(spell_type)); } else { for (uint16 i = BotSpellTypes::START; i <= BotSpellTypes::END; ++i) { @@ -11546,8 +11551,8 @@ void Bot::CopySettings(Bot* to, uint8 settingType, uint16 spellType) { break; case BotSettingCategories::SpellMaxThreshold: - if (spellType != UINT16_MAX) { - to->SetSpellMaxThreshold(spellType, GetSpellMaxThreshold(spellType)); + if (spell_type != UINT16_MAX) { + to->SetSpellMaxThreshold(spell_type, GetSpellMaxThreshold(spell_type)); } else { for (uint16 i = BotSpellTypes::START; i <= BotSpellTypes::END; ++i) { @@ -11557,8 +11562,8 @@ void Bot::CopySettings(Bot* to, uint8 settingType, uint16 spellType) { break; case BotSettingCategories::SpellTypeAggroCheck: - if (spellType != UINT16_MAX) { - to->SetSpellTypeAggroCheck(spellType, GetSpellTypeAggroCheck(spellType)); + if (spell_type != UINT16_MAX) { + to->SetSpellTypeAggroCheck(spell_type, GetSpellTypeAggroCheck(spell_type)); } else { for (uint16 i = BotSpellTypes::START; i <= BotSpellTypes::END; ++i) { @@ -11568,8 +11573,8 @@ void Bot::CopySettings(Bot* to, uint8 settingType, uint16 spellType) { break; case BotSettingCategories::SpellTypeMinManaPct: - if (spellType != UINT16_MAX) { - to->SetSpellTypeMinManaLimit(spellType, GetSpellTypeMinManaLimit(spellType)); + if (spell_type != UINT16_MAX) { + to->SetSpellTypeMinManaLimit(spell_type, GetSpellTypeMinManaLimit(spell_type)); } else { for (uint16 i = BotSpellTypes::START; i <= BotSpellTypes::END; ++i) { @@ -11579,8 +11584,8 @@ void Bot::CopySettings(Bot* to, uint8 settingType, uint16 spellType) { break; case BotSettingCategories::SpellTypeMaxManaPct: - if (spellType != UINT16_MAX) { - to->SetSpellTypeMaxManaLimit(spellType, GetSpellTypeMaxManaLimit(spellType)); + if (spell_type != UINT16_MAX) { + to->SetSpellTypeMaxManaLimit(spell_type, GetSpellTypeMaxManaLimit(spell_type)); } else { for (uint16 i = BotSpellTypes::START; i <= BotSpellTypes::END; ++i) { @@ -11590,8 +11595,8 @@ void Bot::CopySettings(Bot* to, uint8 settingType, uint16 spellType) { break; case BotSettingCategories::SpellTypeMinHPPct: - if (spellType != UINT16_MAX) { - to->SetSpellTypeMinHPLimit(spellType, GetSpellTypeMinHPLimit(spellType)); + if (spell_type != UINT16_MAX) { + to->SetSpellTypeMinHPLimit(spell_type, GetSpellTypeMinHPLimit(spell_type)); } else { for (uint16 i = BotSpellTypes::START; i <= BotSpellTypes::END; ++i) { @@ -11601,8 +11606,8 @@ void Bot::CopySettings(Bot* to, uint8 settingType, uint16 spellType) { break; case BotSettingCategories::SpellTypeMaxHPPct: - if (spellType != UINT16_MAX) { - to->SetSpellTypeMaxHPLimit(spellType, GetSpellTypeMaxHPLimit(spellType)); + if (spell_type != UINT16_MAX) { + to->SetSpellTypeMaxHPLimit(spell_type, GetSpellTypeMaxHPLimit(spell_type)); } else { for (uint16 i = BotSpellTypes::START; i <= BotSpellTypes::END; ++i) { @@ -11612,8 +11617,8 @@ void Bot::CopySettings(Bot* to, uint8 settingType, uint16 spellType) { break; case BotSettingCategories::SpellTypeIdlePriority: - if (spellType != UINT16_MAX) { - to->SetSpellTypePriority(spellType, BotPriorityCategories::Idle, GetSpellTypePriority(spellType, BotPriorityCategories::Idle)); + if (spell_type != UINT16_MAX) { + to->SetSpellTypePriority(spell_type, BotPriorityCategories::Idle, GetSpellTypePriority(spell_type, BotPriorityCategories::Idle)); } else { for (uint16 i = BotSpellTypes::START; i <= BotSpellTypes::END; ++i) { @@ -11623,8 +11628,8 @@ void Bot::CopySettings(Bot* to, uint8 settingType, uint16 spellType) { break; case BotSettingCategories::SpellTypeEngagedPriority: - if (spellType != UINT16_MAX) { - to->SetSpellTypePriority(spellType, BotPriorityCategories::Engaged, GetSpellTypePriority(spellType, BotPriorityCategories::Engaged)); + if (spell_type != UINT16_MAX) { + to->SetSpellTypePriority(spell_type, BotPriorityCategories::Engaged, GetSpellTypePriority(spell_type, BotPriorityCategories::Engaged)); } else { for (uint16 i = BotSpellTypes::START; i <= BotSpellTypes::END; ++i) { @@ -11634,8 +11639,8 @@ void Bot::CopySettings(Bot* to, uint8 settingType, uint16 spellType) { break; case BotSettingCategories::SpellTypePursuePriority: - if (spellType != UINT16_MAX) { - to->SetSpellTypePriority(spellType, BotPriorityCategories::Pursue, GetSpellTypePriority(spellType, BotPriorityCategories::Pursue)); + if (spell_type != UINT16_MAX) { + to->SetSpellTypePriority(spell_type, BotPriorityCategories::Pursue, GetSpellTypePriority(spell_type, BotPriorityCategories::Pursue)); } else { for (uint16 i = BotSpellTypes::START; i <= BotSpellTypes::END; ++i) { @@ -11645,8 +11650,8 @@ void Bot::CopySettings(Bot* to, uint8 settingType, uint16 spellType) { break; case BotSettingCategories::SpellTypeAEOrGroupTargetCount: - if (spellType != UINT16_MAX) { - to->SetSpellTypeAEOrGroupTargetCount(spellType, GetSpellTypeAEOrGroupTargetCount(spellType)); + if (spell_type != UINT16_MAX) { + to->SetSpellTypeAEOrGroupTargetCount(spell_type, GetSpellTypeAEOrGroupTargetCount(spell_type)); } else { for (uint16 i = BotSpellTypes::START; i <= BotSpellTypes::END; ++i) { @@ -11721,10 +11726,10 @@ void Bot::CopyBotBlockedBuffs(Bot* to) { to->ClearBotBlockedBuffs(); - std::vector blockedBuffs = GetBotBlockedBuffs(); + std::vector blocked_buffs = GetBotBlockedBuffs(); - if (!blockedBuffs.empty()) { - for (auto& blocked_buff : blockedBuffs) { + if (!blocked_buffs.empty()) { + for (auto& blocked_buff : blocked_buffs) { to->SetBotBlockedBuff(blocked_buff.spell_id, blocked_buff.blocked); } } @@ -11737,10 +11742,10 @@ void Bot::CopyBotBlockedPetBuffs(Bot* to) { to->ClearBotBlockedBuffs(); - std::vector blockedBuffs = GetBotBlockedBuffs(); + std::vector blocked_buffs = GetBotBlockedBuffs(); - if (!blockedBuffs.empty()) { - for (auto& blocked_buff : blockedBuffs) { + if (!blocked_buffs.empty()) { + for (auto& blocked_buff : blocked_buffs) { to->SetBotBlockedPetBuff(blocked_buff.spell_id, blocked_buff.blocked_pet); } } @@ -11764,12 +11769,12 @@ bool Bot::BotPassiveCheck() { return false; } -bool Bot::IsValidSpellTypeSubType(uint16 spellType, uint16 subType, uint16 spell_id) { - if (subType == UINT16_MAX) { +bool Bot::IsValidSpellTypeSubType(uint16 spell_type, uint16 sub_type, uint16 spell_id) { + if (sub_type == UINT16_MAX) { return true; } - switch (subType) { + switch (sub_type) { case CommandedSubTypes::SingleTarget: if ( !IsAnyAESpell(spell_id) && @@ -12052,12 +12057,12 @@ void Bot::CleanBotBlockedBuffs() } } -std::vector Bot::BotGetSpellsByType(uint16 spellType) { - if (AIBot_spells_by_type[spellType].empty()) { - spellType = GetParentSpellType(spellType); +std::vector Bot::BotGetSpellsByType(uint16 spell_type) { + if (AIBot_spells_by_type[spell_type].empty()) { + spell_type = GetParentSpellType(spell_type); } - return AIBot_spells_by_type[spellType]; + return AIBot_spells_by_type[spell_type]; } void Bot::AssignBotSpellsToTypes(std::vector& AIBot_spells, std::unordered_map>& AIBot_spells_by_type) { @@ -12070,7 +12075,7 @@ void Bot::AssignBotSpellsToTypes(std::vector& AIBot_spells, st continue; } - BotSpells_Struct_wIndex spellWithIndex{ + BotSpells_Struct_wIndex spell_with_index{ static_cast(i), spell.type, spell.spellid, @@ -12088,6 +12093,6 @@ void Bot::AssignBotSpellsToTypes(std::vector& AIBot_spells, st spell.bucket_comparison }; - AIBot_spells_by_type[spell.type].emplace_back(spellWithIndex); + AIBot_spells_by_type[spell.type].emplace_back(spell_with_index); } } diff --git a/zone/bot.h b/zone/bot.h index c7852b511..d558b1a75 100644 --- a/zone/bot.h +++ b/zone/bot.h @@ -288,7 +288,7 @@ public: uint16 BotGetSpells(int spellslot) { return AIBot_spells[spellslot].spellid; } uint32 BotGetSpellType(int spellslot) { return AIBot_spells[spellslot].type; } uint16 BotGetSpellPriority(int spellslot) { return AIBot_spells[spellslot].priority; } - std::vector BotGetSpellsByType(uint16 spellType); + std::vector BotGetSpellsByType(uint16 spell_type); float GetProcChances(float ProcBonus, uint16 hand) override; int GetHandToHandDamage(void) override; bool TryFinishingBlow(Mob *defender, int64 &damage) override; @@ -322,7 +322,7 @@ public: void SetTarget(Mob* mob) override; void Zone(); bool IsAtRange(Mob* target); - void ChangeBotRangedWeapons(bool isRanged); + void ChangeBotRangedWeapons(bool is_ranged); void Sit(); void Stand(); bool IsSitting() const override; @@ -347,8 +347,8 @@ public: bool GetIsUsingItemClick() { return is_using_item_click; } void SetIsUsingItemClick(bool flag = true) { is_using_item_click = flag; } bool UseDiscipline(uint32 spell_id, uint32 target); - uint8 GetNumberNeedingHealedInGroup(uint8 hpr, bool includePets, Raid* raid); - uint8 GetNumberNeedingHealedInRaidGroup(uint8& need_healed, uint8 hpr, bool includePets, Raid* raid); + uint8 GetNumberNeedingHealedInGroup(uint8 hpr, bool include_pets, Raid* raid); + uint8 GetNumberNeedingHealedInRaidGroup(uint8& need_healed, uint8 hpr, bool include_pets, Raid* raid); bool GetNeedsCured(Mob *tar); bool GetNeedsHateRedux(Mob *tar); bool HasOrMayGetAggro(bool SitAggro, uint32 spell_id = 0); @@ -450,11 +450,11 @@ public: void AI_Bot_Event_SpellCastFinished(bool iCastSucceeded, uint16 slot); // AI Methods - bool AICastSpell(Mob* tar, uint8 iChance, uint16 spellType, uint16 subTargetType = UINT16_MAX, uint16 subType = UINT16_MAX); - bool AttemptAICastSpell(uint16 spellType, Mob* tar = nullptr); + bool AICastSpell(Mob* tar, uint8 chance, uint16 spell_type, uint16 sub_target_type = UINT16_MAX, uint16 sub_type = UINT16_MAX); + bool AttemptAICastSpell(uint16 spell_type, Mob* tar = nullptr); bool AttemptAACastSpell(Mob* tar, uint16 spell_id, AA::Rank* rank); - bool AttemptForcedCastSpell(Mob* tar, uint16 spell_id, bool isDisc = false); - bool AttemptCloseBeneficialSpells(uint16 spellType); + bool AttemptForcedCastSpell(Mob* tar, uint16 spell_id, bool is_disc = false); + bool AttemptCloseBeneficialSpells(uint16 spell_type); bool AI_EngagedCastCheck() override; bool AI_PursueCastCheck() override; bool AI_IdleCastCheck() override; @@ -509,37 +509,37 @@ public: { return Mob::Attack(other, Hand, FromRiposte, IsStrikethrough, IsFromSpell, opts); } void DoAttackRounds(Mob* target, int hand); - bool PrecastChecks(Mob* tar, uint16 spellType); - bool CastChecks(uint16 spell_id, Mob* tar, uint16 spellType, bool doPrechecks = false, bool AECheck = false); - bool CanCastSpellType(uint16 spellType, uint16 spell_id, Mob* tar); + bool PrecastChecks(Mob* tar, uint16 spell_type); + bool CastChecks(uint16 spell_id, Mob* tar, uint16 spell_type, bool prechecks = false, bool ae_check = false); + bool CanCastSpellType(uint16 spell_type, uint16 spell_id, Mob* tar); bool BotHasEnoughMana(uint16 spell_id); std::vector GetSpellTargetList() { return _spellTargetList; } - void SetSpellTargetList(std::vector spellTargetList) { _spellTargetList = spellTargetList; } + void SetSpellTargetList(std::vector spell_target_list) { _spellTargetList = spell_target_list; } std::vector GetGroupSpellTargetList() { return _groupSpellTargetList; } - void SetGroupSpellTargetList(std::vector spellTargetList) { _groupSpellTargetList = spellTargetList; } + void SetGroupSpellTargetList(std::vector spell_target_list) { _groupSpellTargetList = spell_target_list; } Raid* GetStoredRaid() { return _storedRaid; } - void SetStoredRaid(Raid* storedRaid) { _storedRaid = storedRaid; } + void SetStoredRaid(Raid* stored_raid) { _storedRaid = stored_raid; } bool GetVerifiedRaid() { return _verifiedRaid; } void SetVerifiedRaid(bool status) { _verifiedRaid = status; } uint16 GetTempSpellType() { return _tempSpellType; } - void SetTempSpellType(uint16 spellType) { _tempSpellType = spellType; } + void SetTempSpellType(uint16 spell_type) { _tempSpellType = spell_type; } void AssignBotSpellsToTypes(std::vector& AIBot_spells, std::unordered_map>& AIBot_spells_by_type); bool IsTargetAlreadyReceivingSpell(Mob* tar, uint16 spell_id); bool DoResistCheck(Mob* target, uint16 spell_id, int32 resist_limit); - bool DoResistCheckBySpellType(Mob* tar, uint16 spell_id, uint16 spellType); - bool IsValidTargetType(uint16 spell_id, int targetType, uint8 bodyType); + bool DoResistCheckBySpellType(Mob* tar, uint16 spell_id, uint16 spell_type); + bool IsValidTargetType(uint16 spell_id, int target_type, uint8 body_type); bool IsMobEngagedByAnyone(Mob* tar); - void SetBotSetting(uint8 settingType, uint16 botSetting, int settingValue); - void CopySettings(Bot* to, uint8 settingType, uint16 spellType = UINT16_MAX); + void SetBotSetting(uint8 setting_type, uint16 bot_setting, int setting_value); + void CopySettings(Bot* to, uint8 setting_type, uint16 spell_type = UINT16_MAX); void CopyBotSpellSettings(Bot* to); void ResetBotSpellSettings(); void CopyBotBlockedBuffs(Bot* to); void CopyBotBlockedPetBuffs(Bot* to); - int GetBotBaseSetting(uint16 botSetting); - int GetDefaultBotBaseSetting(uint16 botSetting, uint8 stance = Stance::Balanced); - void SetBotBaseSetting(uint16 botSetting, int settingValue); + int GetBotBaseSetting(uint16 bot_setting); + int GetDefaultBotBaseSetting(uint16 bot_setting, uint8 stance = Stance::Balanced); + void SetBotBaseSetting(uint16 bot_setting, int setting_value); void LoadDefaultBotSettings(); - void SetBotSpellRecastTimer(uint16 spellType, Mob* spelltar, bool preCast = false); + void SetBotSpellRecastTimer(uint16 spell_type, Mob* spelltar, bool pre_cast = false); uint16 GetSpellByAA(int id, AA::Rank* &rank); void CleanBotBlockedBuffs(); void ClearBotBlockedBuffs() { bot_blocked_buffs.clear(); } @@ -548,40 +548,40 @@ public: void SetBotBlockedBuff(uint16 spell_id, bool block); void SetBotBlockedPetBuff(uint16 spell_id, bool block); - int GetDefaultSetting(uint16 settingCategory, uint16 settingType, uint8 stance = Stance::Balanced); - uint16 GetDefaultSpellTypePriority(uint16 spellType, uint8 priorityType, uint8 botClass, uint8 stance = Stance::Balanced); - uint16 GetDefaultSpellTypeIdlePriority(uint16 spellType, uint8 botClass, uint8 stance = Stance::Balanced); - uint16 GetDefaultSpellTypeEngagedPriority(uint16 spellType, uint8 botClass, uint8 stance = Stance::Balanced); - uint16 GetDefaultSpellTypePursuePriority(uint16 spellType, uint8 botClass, uint8 stance = Stance::Balanced); - uint16 GetDefaultSpellTypeResistLimit(uint16 spellType, uint8 stance = Stance::Balanced); - bool GetDefaultSpellTypeAggroCheck(uint16 spellType, uint8 stance = Stance::Balanced); - uint8 GetDefaultSpellTypeMinManaLimit(uint16 spellType, uint8 stance = Stance::Balanced); - uint8 GetDefaultSpellTypeMaxManaLimit(uint16 spellType, uint8 stance = Stance::Balanced); - uint8 GetDefaultSpellTypeMinHPLimit(uint16 spellType, uint8 stance = Stance::Balanced); - uint8 GetDefaultSpellTypeMaxHPLimit(uint16 spellType, uint8 stance = Stance::Balanced); - uint16 GetDefaultSpellTypeAEOrGroupTargetCount(uint16 spellType, uint8 stance = Stance::Balanced); + int GetDefaultSetting(uint16 setting_category, uint16 setting_type, uint8 stance = Stance::Balanced); + uint16 GetDefaultSpellTypePriority(uint16 spell_type, uint8 priority_type, uint8 bot_class, uint8 stance = Stance::Balanced); + uint16 GetDefaultSpellTypeIdlePriority(uint16 spell_type, uint8 bot_class, uint8 stance = Stance::Balanced); + uint16 GetDefaultSpellTypeEngagedPriority(uint16 spell_type, uint8 bot_class, uint8 stance = Stance::Balanced); + uint16 GetDefaultSpellTypePursuePriority(uint16 spell_type, uint8 bot_class, uint8 stance = Stance::Balanced); + uint16 GetDefaultSpellTypeResistLimit(uint16 spell_type, uint8 stance = Stance::Balanced); + bool GetDefaultSpellTypeAggroCheck(uint16 spell_type, uint8 stance = Stance::Balanced); + uint8 GetDefaultSpellTypeMinManaLimit(uint16 spell_type, uint8 stance = Stance::Balanced); + uint8 GetDefaultSpellTypeMaxManaLimit(uint16 spell_type, uint8 stance = Stance::Balanced); + uint8 GetDefaultSpellTypeMinHPLimit(uint16 spell_type, uint8 stance = Stance::Balanced); + uint8 GetDefaultSpellTypeMaxHPLimit(uint16 spell_type, uint8 stance = Stance::Balanced); + uint16 GetDefaultSpellTypeAEOrGroupTargetCount(uint16 spell_type, uint8 stance = Stance::Balanced); - int GetSetting(uint16 settingCategory, uint16 settingType); - uint16 GetSpellTypePriority(uint16 spellType, uint8 priorityType); - void SetSpellTypePriority(uint16 spellType, uint8 priorityType, uint16 priority); - inline uint16 GetSpellTypeResistLimit(uint16 spellType) const { return _spellSettings[spellType].resistLimit; } - void SetSpellTypeResistLimit(uint16 spellType, uint16 resistLimit); - inline bool GetSpellTypeAggroCheck(uint16 spellType) const { return _spellSettings[spellType].aggroCheck; } - void SetSpellTypeAggroCheck(uint16 spellType, bool AggroCheck); - inline uint8 GetSpellTypeMinManaLimit(uint16 spellType) const { return _spellSettings[spellType].minManaPct; } - inline uint8 GetSpellTypeMaxManaLimit(uint16 spellType) const { return _spellSettings[spellType].maxManaPct; } - void SetSpellTypeMinManaLimit(uint16 spellType, uint8 manaLimit); - void SetSpellTypeMaxManaLimit(uint16 spellType, uint8 manaLimit); - inline uint8 GetSpellTypeMinHPLimit(uint16 spellType) const { return _spellSettings[spellType].minHPPct; } - inline uint8 GetSpellTypeMaxHPLimit(uint16 spellType) const { return _spellSettings[spellType].maxHPPct; } - void SetSpellTypeMinHPLimit(uint16 spellType, uint8 hpLimit); - void SetSpellTypeMaxHPLimit(uint16 spellType, uint8 hpLimit); - inline uint16 GetSpellTypeAEOrGroupTargetCount(uint16 spellType) const { return _spellSettings[spellType].AEOrGroupTargetCount; } - void SetSpellTypeAEOrGroupTargetCount(uint16 spellType, uint16 targetCount); + int GetSetting(uint16 setting_category, uint16 setting_type); + uint16 GetSpellTypePriority(uint16 spell_type, uint8 priority_type); + void SetSpellTypePriority(uint16 spell_type, uint8 priority_type, uint16 priority); + inline uint16 GetSpellTypeResistLimit(uint16 spell_type) const { return _spellSettings[spell_type].resistLimit; } + void SetSpellTypeResistLimit(uint16 spell_type, uint16 resist_limit); + inline bool GetSpellTypeAggroCheck(uint16 spell_type) const { return _spellSettings[spell_type].aggroCheck; } + void SetSpellTypeAggroCheck(uint16 spell_type, bool aggro_check); + inline uint8 GetSpellTypeMinManaLimit(uint16 spell_type) const { return _spellSettings[spell_type].minManaPct; } + inline uint8 GetSpellTypeMaxManaLimit(uint16 spell_type) const { return _spellSettings[spell_type].maxManaPct; } + void SetSpellTypeMinManaLimit(uint16 spell_type, uint8 mana_limit); + void SetSpellTypeMaxManaLimit(uint16 spell_type, uint8 mana_limit); + inline uint8 GetSpellTypeMinHPLimit(uint16 spell_type) const { return _spellSettings[spell_type].minHPPct; } + inline uint8 GetSpellTypeMaxHPLimit(uint16 spell_type) const { return _spellSettings[spell_type].maxHPPct; } + void SetSpellTypeMinHPLimit(uint16 spell_type, uint8 hp_limit); + void SetSpellTypeMaxHPLimit(uint16 spell_type, uint8 hp_limit); + inline uint16 GetSpellTypeAEOrGroupTargetCount(uint16 spell_type) const { return _spellSettings[spell_type].AEOrGroupTargetCount; } + void SetSpellTypeAEOrGroupTargetCount(uint16 spell_type, uint16 target_count); bool BotPassiveCheck(); bool GetShowHelm() const { return _showHelm; } - void SetShowHelm(bool showHelm) { _showHelm = showHelm; } + void SetShowHelm(bool show_helm) { _showHelm = show_helm; } bool GetBehindMob() const { return _behindMobStatus; } void SetBehindMob(bool value) { _behindMobStatus = value; } bool GetMaxMeleeRange() const { return _maxMeleeRangeStatus; } @@ -589,24 +589,24 @@ public: uint8 GetStopMeleeLevel() const { return _stopMeleeLevel; } void SetStopMeleeLevel(uint8 level) { _stopMeleeLevel = level; } uint32 GetBotDistanceRanged() const { return _distanceRanged; } - void SetBotDistanceRanged(uint32 distanceRanged) { _distanceRanged = distanceRanged; } + void SetBotDistanceRanged(uint32 distance) { _distanceRanged = distance; } bool GetMedInCombat() const { return _medInCombat; } void SetMedInCombat(bool value) { _medInCombat = value; } uint8 GetSitHPPct() const { return _SitHPPct; } void SetSitHPPct(uint8 value) { _SitHPPct = value; } uint8 GetSitManaPct() const { return _SitManaPct; } void SetSitManaPct(uint8 value) { _SitManaPct = value; } - void SetHasLoS(bool hasLoS) { _hasLoS = hasLoS; } + void SetHasLoS(bool has_los) { _hasLoS = has_los; } bool HasLoS() const { return _hasLoS; } - std::list GetSpellTypesPrioritized(uint8 priorityType); - uint16 GetParentSpellType(uint16 spellType); - bool IsValidSpellTypeBySpellID(uint16 spellType, uint16 spell_id); + std::list GetSpellTypesPrioritized(uint8 priority_type); + uint16 GetParentSpellType(uint16 spell_type); + bool IsValidSpellTypeBySpellID(uint16 spell_type, uint16 spell_id); inline uint16 GetCastedSpellType() const { return _castedSpellType; } - void SetCastedSpellType(uint16 spellType); - bool IsValidSpellTypeSubType(uint16 spellType, uint16 subType, uint16 spell_id); + void SetCastedSpellType(uint16 spell_type); + bool IsValidSpellTypeSubType(uint16 spell_type, uint16 sub_type, uint16 spell_id); - bool HasValidAETarget(Bot* botCaster, uint16 spell_id, uint16 spellType, Mob* tar); + bool HasValidAETarget(Bot* caster, uint16 spell_id, uint16 spell_type, Mob* tar); void CheckBotSpells(); @@ -655,37 +655,37 @@ public: ProcessBotGroupAdd(Group* group, Raid* raid, Client* client = nullptr, bool new_raid = false, bool initial = false); - static std::list GetBotSpellsForSpellEffect(Bot* botCaster, uint16 spellType, int spellEffect); - static std::list GetBotSpellsForSpellEffectAndTargetType(Bot* botCaster, uint16 spellType, int spellEffect, SpellTargetType targetType); - static std::list GetBotSpellsBySpellType(Bot* botCaster, uint16 spellType); - static std::vector GetPrioritizedBotSpellsBySpellType(Bot* botCaster, uint16 spellType, Mob* tar, bool AE = false, uint16 subTargetType = UINT16_MAX, uint16 subType = UINT16_MAX); + static std::list GetBotSpellsForSpellEffect(Bot* caster, uint16 spell_type, int spell_effect); + static std::list GetBotSpellsForSpellEffectAndTargetType(Bot* caster, uint16 spell_type, int spell_effect, SpellTargetType target_type); + static std::list GetBotSpellsBySpellType(Bot* caster, uint16 spell_type); + static std::vector GetPrioritizedBotSpellsBySpellType(Bot* caster, uint16 spell_type, Mob* tar, bool AE = false, uint16 sub_target_type = UINT16_MAX, uint16 sub_type = UINT16_MAX); - static BotSpell GetFirstBotSpellBySpellType(Bot* botCaster, uint16 spellType); - BotSpell GetSpellByHealType(uint16 spellType, Mob* tar); - static BotSpell GetBestBotSpellForVeryFastHeal(Bot* botCaster, Mob* tar, uint16 spellType = BotSpellTypes::RegularHeal); - static BotSpell GetBestBotSpellForFastHeal(Bot* botCaster, Mob* tar, uint16 spellType = BotSpellTypes::RegularHeal); - static BotSpell GetBestBotSpellForHealOverTime(Bot* botCaster, Mob* tar, uint16 spellType = BotSpellTypes::RegularHeal); - static BotSpell GetBestBotSpellForPercentageHeal(Bot* botCaster, Mob* tar, uint16 spellType = BotSpellTypes::RegularHeal); - static BotSpell GetBestBotSpellForRegularSingleTargetHeal(Bot* botCaster, Mob* tar, uint16 spellType = BotSpellTypes::RegularHeal); - static BotSpell GetFirstBotSpellForSingleTargetHeal(Bot* botCaster, Mob* tar, uint16 spellType = BotSpellTypes::RegularHeal); - static BotSpell GetBestBotSpellForGroupHealOverTime(Bot* botCaster, Mob* tar, uint16 spellType = BotSpellTypes::RegularHeal); - static BotSpell GetBestBotSpellForGroupCompleteHeal(Bot* botCaster, Mob* tar, uint16 spellType = BotSpellTypes::RegularHeal); - static BotSpell GetBestBotSpellForGroupHeal(Bot* botCaster, Mob* tar, uint16 spellType = BotSpellTypes::RegularHeal); + static BotSpell GetFirstBotSpellBySpellType(Bot* caster, uint16 spell_type); + BotSpell GetSpellByHealType(uint16 spell_type, Mob* tar); + static BotSpell GetBestBotSpellForVeryFastHeal(Bot* caster, Mob* tar, uint16 spell_type = BotSpellTypes::RegularHeal); + static BotSpell GetBestBotSpellForFastHeal(Bot* caster, Mob* tar, uint16 spell_type = BotSpellTypes::RegularHeal); + static BotSpell GetBestBotSpellForHealOverTime(Bot* caster, Mob* tar, uint16 spell_type = BotSpellTypes::RegularHeal); + static BotSpell GetBestBotSpellForPercentageHeal(Bot* caster, Mob* tar, uint16 spell_type = BotSpellTypes::RegularHeal); + static BotSpell GetBestBotSpellForRegularSingleTargetHeal(Bot* caster, Mob* tar, uint16 spell_type = BotSpellTypes::RegularHeal); + static BotSpell GetFirstBotSpellForSingleTargetHeal(Bot* caster, Mob* tar, uint16 spell_type = BotSpellTypes::RegularHeal); + static BotSpell GetBestBotSpellForGroupHealOverTime(Bot* caster, Mob* tar, uint16 spell_type = BotSpellTypes::RegularHeal); + static BotSpell GetBestBotSpellForGroupCompleteHeal(Bot* caster, Mob* tar, uint16 spell_type = BotSpellTypes::RegularHeal); + static BotSpell GetBestBotSpellForGroupHeal(Bot* caster, Mob* tar, uint16 spell_type = BotSpellTypes::RegularHeal); - static Mob* GetFirstIncomingMobToMez(Bot* botCaster, int16 spell_id, uint16 spellType, bool AE); + static Mob* GetFirstIncomingMobToMez(Bot* caster, int16 spell_id, uint16 spell_type, bool AE); bool IsValidMezTarget(Mob* owner, Mob* npc, uint16 spell_id); - static BotSpell GetBestBotSpellForMez(Bot* botCaster, uint16 spellType = BotSpellTypes::Mez); - static BotSpell GetBestBotMagicianPetSpell(Bot* botCaster, uint16 spellType = BotSpellTypes::Pet); - static std::string GetBotMagicianPetType(Bot* botCaster); - static BotSpell GetBestBotSpellForNukeByTargetType(Bot* botCaster, SpellTargetType targetType, uint16 spellType, bool AE = false, Mob* tar = nullptr); - static BotSpell GetBestBotSpellForStunByTargetType(Bot* botCaster, SpellTargetType targetType, uint16 spellType, bool AE = false, Mob* tar = nullptr); - static BotSpell GetBestBotWizardNukeSpellByTargetResists(Bot* botCaster, Mob* target, uint16 spellType); - static BotSpell GetDebuffBotSpell(Bot* botCaster, Mob* target, uint16 spellType); - static BotSpell GetBestBotSpellForCure(Bot* botCaster, Mob* target, uint16 spellType); - static BotSpell GetBestBotSpellForResistDebuff(Bot* botCaster, Mob* target, uint16 spellType); - static BotSpell GetBestBotSpellForNukeByBodyType(Bot* botCaster, uint8 bodyType, uint16 spellType, bool AE = false, Mob* tar = nullptr); - static BotSpell GetBestBotSpellForRez(Bot* botCaster, Mob* target, uint16 spellType); - static BotSpell GetBestBotSpellForCharm(Bot* botCaster, Mob* target, uint16 spellType); + static BotSpell GetBestBotSpellForMez(Bot* caster, uint16 spell_type = BotSpellTypes::Mez); + static BotSpell GetBestBotMagicianPetSpell(Bot* caster, uint16 spell_type = BotSpellTypes::Pet); + static std::string GetBotMagicianPetType(Bot* caster); + static BotSpell GetBestBotSpellForNukeByTargetType(Bot* caster, SpellTargetType target_type, uint16 spell_type, bool AE = false, Mob* tar = nullptr); + static BotSpell GetBestBotSpellForStunByTargetType(Bot* caster, SpellTargetType target_type, uint16 spell_type, bool AE = false, Mob* tar = nullptr); + static BotSpell GetBestBotWizardNukeSpellByTargetResists(Bot* caster, Mob* target, uint16 spell_type); + static BotSpell GetDebuffBotSpell(Bot* caster, Mob* target, uint16 spell_type); + static BotSpell GetBestBotSpellForCure(Bot* caster, Mob* target, uint16 spell_type); + static BotSpell GetBestBotSpellForResistDebuff(Bot* caster, Mob* target, uint16 spell_type); + static BotSpell GetBestBotSpellForNukeByBodyType(Bot* caster, uint8 body_type, uint16 spell_type, bool AE = false, Mob* tar = nullptr); + static BotSpell GetBestBotSpellForRez(Bot* caster, Mob* target, uint16 spell_type); + static BotSpell GetBestBotSpellForCharm(Bot* caster, Mob* target, uint16 spell_type); static NPCType *CreateDefaultNPCTypeStructForBot( const std::string& botName, @@ -720,7 +720,7 @@ public: bool GetRangerAutoWeaponSelect() { return _rangerAutoWeaponSelect; } uint8 GetBotStance() { return _botStance; } - uint8 GetChanceToCastBySpellType(uint16 spellType); + uint8 GetChanceToCastBySpellType(uint16 spell_type); bool IsGroupHealer() const { return m_CastingRoles.GroupHealer; } bool IsGroupSlower() const { return m_CastingRoles.GroupSlower; } bool IsGroupNuker() const { return m_CastingRoles.GroupNuker; } @@ -832,7 +832,7 @@ public: void SetBotSpellID(uint32 newSpellID); void SetSpawnStatus(bool spawnStatus) { _spawnStatus = spawnStatus; } void SetPetChooserID(uint8 id) { _petChooserID = id; } - void SetBotRangedSetting(bool botRangedSetting) { _botRangedSetting = botRangedSetting; } + void SetBotRangedSetting(bool value) { _botRangedSetting = value; } void SetBotCharmer(bool c) { _botCharmer = c; } void SetBotOwner(Mob* botOwner) { this->_botOwner = botOwner; } void SetRangerAutoWeaponSelect(bool enable) { GetClass() == Class::Ranger ? _rangerAutoWeaponSelect = enable : _rangerAutoWeaponSelect = false; } @@ -950,7 +950,7 @@ public: std::vector GetBotTimers() { return bot_timers; } void SetBotTimers(std::vector timers) { bot_timers = timers; } std::vector GetBotBlockedBuffs() { return bot_blocked_buffs; } - void SetBotBlockedBuffs(std::vector blockedBuff) { bot_blocked_buffs = blockedBuff; } + void SetBotBlockedBuffs(std::vector blocked_buffs) { bot_blocked_buffs = blocked_buffs; } uint32 GetLastZoneID() const { return _lastZoneId; } int32 GetBaseAC() const { return _baseAC; } int32 GetBaseATK() const { return _baseATK; } @@ -977,11 +977,11 @@ public: static uint8 spell_casting_chances[SPELL_TYPE_COUNT][Class::PLAYER_CLASS_COUNT][Stance::AEBurn][cntHSND]; - bool BotCastMez(Mob* tar, uint8 botClass, BotSpell& botSpell, uint16 spellType); - bool BotCastHeal(Mob* tar, uint8 botClass, BotSpell& botSpell, uint16 spellType); - bool BotCastNuke(Mob* tar, uint8 botClass, BotSpell& botSpell, uint16 spellType); - bool BotCastPet(Mob* tar, uint8 botClass, BotSpell& botSpell, uint16 spellType); - bool BotCastCure(Mob* tar, uint8 botClass, BotSpell& botSpell, uint16 spellType); + bool BotCastMez(Mob* tar, uint8 bot_class, BotSpell& bot_spell, uint16 spell_type); + bool BotCastHeal(Mob* tar, uint8 bot_class, BotSpell& bot_spell, uint16 spell_type); + bool BotCastNuke(Mob* tar, uint8 bot_class, BotSpell& bot_spell, uint16 spell_type); + bool BotCastPet(Mob* tar, uint8 bot_class, BotSpell& bot_spell, uint16 spell_type); + bool BotCastCure(Mob* tar, uint8 bot_class, BotSpell& bot_spell, uint16 spell_type); bool CheckIfIncapacitated(); bool IsAIProcessValid(const Client* bot_owner, const Group* bot_group, const Raid* raid); @@ -1010,12 +1010,12 @@ public: const Mob* tar, const EQ::ItemInstance* const& p_item, const EQ::ItemInstance* const& s_item, - bool behindMob, + bool behind_mob, bool backstab_weapon, float& melee_distance_min, float& melee_distance, float& melee_distance_max, - uint8 stopMeleeLevel + uint8 stop_melee_level ); // Combat Checks @@ -1025,14 +1025,14 @@ public: void CheckCombatRange( Mob* tar, float tar_distance, - bool& atCombatRange, - bool behindMob, + bool& at_combat_range, + bool behind_mob, const EQ::ItemInstance*& p_item, const EQ::ItemInstance*& s_item, float& melee_distance_min, float& melee_distance, float& melee_distance_max, - uint8 stopMeleeLevel + uint8 stop_melee_level ); bool GetCombatJitterFlag() { return m_combat_jitter_flag; } void SetCombatJitterFlag(bool flag = true) { m_combat_jitter_flag = flag; } @@ -1040,7 +1040,7 @@ public: void SetCombatOutOfRangeJitterFlag(bool flag = true) { m_combat_out_of_range_jitter_flag = flag; } void SetCombatJitter(); void SetCombatOutOfRangeJitter(); - void DoCombatPositioning(Mob* tar, glm::vec3 Goal, bool stopMeleeLevel, float tar_distance, float melee_distance_min, float melee_distance, float melee_distance_max, bool behindMob, bool frontMob); + void DoCombatPositioning(Mob* tar, glm::vec3 Goal, bool stop_melee_level, float tar_distance, float melee_distance_min, float melee_distance, float melee_distance_max, bool behind_mob, bool front_mob); void DoFaceCheckWithJitter(Mob* tar); void DoFaceCheckNoJitter(Mob* tar); void RunToGoalWithJitter(glm::vec3 Goal); @@ -1056,15 +1056,15 @@ public: bool TryIdleChecks(float fm_distance); bool TryNonCombatMovementChecks(Client* bot_owner, const Mob* follow_mob, glm::vec3& Goal); bool TryBardMovementCasts(); - bool BotRangedAttack(Mob* other, bool CanDoubleAttack = false); + bool BotRangedAttack(Mob* other, bool can_double_attack = false); bool CheckDoubleRangedAttack(); // Public "Refactor" Methods static bool CheckCampSpawnConditions(Client* c); protected: - void BotMeditate(bool isSitting); - bool CheckBotDoubleAttack(bool Triple = false); + void BotMeditate(bool is_sitting); + bool CheckBotDoubleAttack(bool triple_attack = false); bool CheckTripleAttack(); void PerformTradeWithClient(int16 begin_slot_id, int16 end_slot_id, Client* client); bool AIDoSpellCast(int32 i, Mob* tar, int32 mana_cost, uint32* oDontDoAgainBefore = nullptr) override; @@ -1210,6 +1210,6 @@ private: int32 CalcItemATKCap() final; }; -bool IsSpellInBotList(DBbotspells_Struct* spell_list, uint16 iSpellID); +bool IsSpellInBotList(DBbotspells_Struct* spell_list, uint16 spell_id); #endif // BOT_H diff --git a/zone/bot_command.cpp b/zone/bot_command.cpp index 33b40ce79..706a8c208 100644 --- a/zone/bot_command.cpp +++ b/zone/bot_command.cpp @@ -2100,34 +2100,34 @@ void SendSpellTypeWindow(Client* c, const Seperator* sep) { std::string arg0 = sep->arg[0]; std::string arg1 = sep->arg[1]; - uint8 minCount = 0; - uint8 maxCount = 0; - bool clientOnly = false; + uint8 min_count = 0; + uint8 max_count = 0; + bool client_only = false; if (BotSpellTypes::END <= 19) { - minCount = BotSpellTypes::START; - maxCount = BotSpellTypes::END; + min_count = BotSpellTypes::START; + max_count = BotSpellTypes::END; } else if (!arg1.compare("0-19")) { - minCount = BotSpellTypes::START; - maxCount = 19; + min_count = BotSpellTypes::START; + max_count = 19; } else if (!arg1.compare("20-39")) { - minCount = std::min(static_cast(20), static_cast(BotSpellTypes::END)); - maxCount = std::min(static_cast(39), static_cast(BotSpellTypes::END)); + min_count = std::min(static_cast(20), static_cast(BotSpellTypes::END)); + max_count = std::min(static_cast(39), static_cast(BotSpellTypes::END)); } else if (!arg1.compare("40+")) { - minCount = std::min(static_cast(40), static_cast(BotSpellTypes::END)); - maxCount = BotSpellTypes::END; + min_count = std::min(static_cast(40), static_cast(BotSpellTypes::END)); + max_count = BotSpellTypes::END; } else if (!arg1.compare("commanded")) { - minCount = BotSpellTypes::COMMANDED_START; - maxCount = BotSpellTypes::COMMANDED_END; + min_count = BotSpellTypes::COMMANDED_START; + max_count = BotSpellTypes::COMMANDED_END; } else if (!arg1.compare("client")) { - minCount = BotSpellTypes::START; - maxCount = BotSpellTypes::END; - clientOnly = true; + min_count = BotSpellTypes::START; + max_count = BotSpellTypes::END; + client_only = true; } else { c->Message(Chat::Yellow, "You must choose a valid range option"); @@ -2141,25 +2141,25 @@ void SendSpellTypeWindow(Client* c, const Seperator* sep) { const std::string& forest_green = "forest_green"; const std::string& goldenrod = "goldenrod"; - std::string fillerLine = "-----------"; - std::string spellTypeField = "Spell Type"; - std::string idField = "ID"; - std::string shortnameField = "Short Name"; + std::string filler_line = "-----------"; + std::string spell_type_field = "Spell Type"; + std::string id_field = "ID"; + std::string shortname_field = "Short Name"; std::string popup_text = DialogueWindow::TableRow( - DialogueWindow::TableCell(DialogueWindow::ColorMessage(goldenrod, spellTypeField)) + DialogueWindow::TableCell(DialogueWindow::ColorMessage(goldenrod, spell_type_field)) + - DialogueWindow::TableCell((!arg0.compare("^spelltypeids") ? DialogueWindow::ColorMessage(goldenrod, idField) : DialogueWindow::ColorMessage(goldenrod, shortnameField))) + DialogueWindow::TableCell((!arg0.compare("^spelltypeids") ? DialogueWindow::ColorMessage(goldenrod, id_field) : DialogueWindow::ColorMessage(goldenrod, shortname_field))) ); popup_text += DialogueWindow::TableRow( - DialogueWindow::TableCell(DialogueWindow::ColorMessage(gold, fillerLine)) + DialogueWindow::TableCell(DialogueWindow::ColorMessage(gold, filler_line)) + - DialogueWindow::TableCell(DialogueWindow::ColorMessage(gold, fillerLine)) + DialogueWindow::TableCell(DialogueWindow::ColorMessage(gold, filler_line)) ); - for (int i = minCount; i <= maxCount; ++i) { - if (clientOnly && !IsClientBotSpellType(i)) { + for (int i = min_count; i <= max_count; ++i) { + if (client_only && !IsClientBotSpellType(i)) { continue; } diff --git a/zone/bot_commands/bot.cpp b/zone/bot_commands/bot.cpp index 704e62863..8654f5e69 100644 --- a/zone/bot_commands/bot.cpp +++ b/zone/bot_commands/bot.cpp @@ -56,15 +56,15 @@ void bot_command_camp(Client *c, const Seperator *sep) return; } - uint16 campCount; + uint16 camp_count; for (auto bot_iter : sbl) { bot_iter->Camp(); - ++campCount; + ++camp_count; } - if (campCount) { - c->Message(Chat::White, "%i of your bots have been camped.", campCount); + if (camp_count) { + c->Message(Chat::White, "%i of your bots have been camped.", camp_count); } } @@ -559,7 +559,7 @@ void bot_command_follow_distance(Client *c, const Seperator *sep) uint32 bfd = RuleI(Bots, DefaultFollowDistance); bool set_flag = false; - bool currentCheck = false; + bool current_check = false; int ab_arg = 2; std::string arg1 = sep->arg[1]; @@ -589,7 +589,7 @@ void bot_command_follow_distance(Client *c, const Seperator *sep) ++ab_arg; } else if (!arg1.compare("current")) { - currentCheck = true; + current_check = true; } else if (arg1.compare("reset")) { c->Message( @@ -619,13 +619,13 @@ void bot_command_follow_distance(Client *c, const Seperator *sep) sbl.erase(std::remove(sbl.begin(), sbl.end(), nullptr), sbl.end()); - int botCount = 0; + int bot_count = 0; for (auto bot_iter : sbl) { if (!bot_iter) { continue; } - if (currentCheck) { + if (current_check) { Mob* follow_mob = entity_list.GetMob(bot_iter->GetFollowID()); c->Message( @@ -640,15 +640,15 @@ void bot_command_follow_distance(Client *c, const Seperator *sep) } else { bot_iter->SetFollowDistance(bfd * bfd); - ++botCount; + ++bot_count; } } - if (currentCheck) { + if (current_check) { return; } - if (botCount == 1) { + if (bot_count == 1) { Mob* follow_mob = entity_list.GetMob(sbl.front()->GetFollowID()); c->Message( @@ -666,7 +666,7 @@ void bot_command_follow_distance(Client *c, const Seperator *sep) Chat::Green, fmt::format( "{} of your bots are now following at a distance of {}.", - botCount, + bot_count, bfd ).c_str() ); @@ -1170,16 +1170,16 @@ void bot_command_spawn(Client *c, const Seperator *sep) } std::string silent_confirm = sep->arg[2]; - bool silentTell = false; + bool silent_tell = false; if (!silent_confirm.compare("silent")) { - silentTell = true; + silent_tell = true; } - if (!silentTell && c->GetBotOption(Client::booSpawnMessageSay)) { + if (!silent_tell && c->GetBotOption(Client::booSpawnMessageSay)) { Bot::BotGroupSay(my_bot, bot_spawn_message[message_index].c_str()); } - else if (!silentTell && c->GetBotOption(Client::booSpawnMessageTell)) { + else if (!silent_tell && c->GetBotOption(Client::booSpawnMessageTell)) { my_bot->OwnerMessage(bot_spawn_message[message_index]); } } @@ -1330,7 +1330,7 @@ void bot_command_stance(Client *c, const Seperator *sep) const int ab_mask = ActionableBots::ABM_Type1; - bool currentCheck = false; + bool current_check = false; int ab_arg = 1; uint32 value = 0; @@ -1360,7 +1360,7 @@ void bot_command_stance(Client *c, const Seperator *sep) } else if (!arg1.compare("current")) { ++ab_arg; - currentCheck = true; + current_check = true; } else { c->Message( @@ -1395,7 +1395,7 @@ void bot_command_stance(Client *c, const Seperator *sep) first_found = bot_iter; } - if (currentCheck) { + if (current_check) { c->Message( Chat::Green, fmt::format( @@ -1436,7 +1436,7 @@ void bot_command_stance(Client *c, const Seperator *sep) ++success_count; } - if (currentCheck) { + if (current_check) { return; } @@ -1482,7 +1482,7 @@ void bot_command_stop_melee_level(Client* c, const Seperator* sep) uint8 sml = RuleI(Bots, CasterStopMeleeLevel); bool sync_sml = false; bool reset_sml = false; - bool currentCheck = false; + bool current_check = false; if (sep->IsNumber(1)) { ab_arg = 2; @@ -1498,7 +1498,7 @@ void bot_command_stop_melee_level(Client* c, const Seperator* sep) } else if (!arg1.compare("current")) { ab_arg = 2; - currentCheck = true; + current_check = true; } else if (!strcasecmp(sep->arg[1], "reset")) { ab_arg = 2; @@ -1553,7 +1553,7 @@ void bot_command_stop_melee_level(Client* c, const Seperator* sep) sml = my_bot->GetDefaultBotBaseSetting(BotBaseSettings::StopMeleeLevel); } - if (currentCheck) { + if (current_check) { c->Message( Chat::White, fmt::format( @@ -1570,7 +1570,7 @@ void bot_command_stop_melee_level(Client* c, const Seperator* sep) } } - if (!currentCheck) { + if (!current_check) { if (success_count == 1 && first_found) { c->Message( Chat::White, diff --git a/zone/bot_database.cpp b/zone/bot_database.cpp index 3ca0f0e45..5573de2b1 100644 --- a/zone/bot_database.cpp +++ b/zone/bot_database.cpp @@ -1161,8 +1161,8 @@ bool BotDatabase::SaveEquipmentColor(const uint32 bot_id, const int16 slot_id, c if (all_flag) { where_clause = fmt::format( "IN ({}, {}, {}, {}, {}, {}, {})", - EQ::invslot::slotHead, - EQ::invslot::slotArms, + EQ::invslot::SlotHead, + EQ::invslot::SlotArms, EQ::invslot::slotWrist1, EQ::invslot::slotHands, EQ::invslot::slotChest, @@ -2214,19 +2214,19 @@ bool BotDatabase::LoadBotSettings(Mob* m) return false; } - uint32 mobID = (m->IsClient() ? m->CastToClient()->CharacterID() : m->CastToBot()->GetBotID()); - uint8 stanceID = (m->IsBot() ? m->CastToBot()->GetBotStance() : 0); + uint32 mob_id = (m->IsClient() ? m->CastToClient()->CharacterID() : m->CastToBot()->GetBotID()); + uint8 stance_id = (m->IsBot() ? m->CastToBot()->GetBotStance() : 0); std::string query = ""; if (m->IsClient()) { - query = fmt::format("`char_id` = {} AND `stance` = {}", mobID, stanceID); + query = fmt::format("`char_id` = {} AND `stance` = {}", mob_id, stance_id); } else { - query = fmt::format("`bot_id` = {} AND `stance` = {}", mobID, stanceID); + query = fmt::format("`bot_id` = {} AND `stance` = {}", mob_id, stance_id); } - if (stanceID == Stance::Passive) { + if (stance_id == Stance::Passive) { LogBotSettings("{} is currently set to {} [#{}]. No saving or loading required.", m->GetCleanName(), Stance::GetName(Stance::Passive), Stance::Passive); return true; } @@ -2273,11 +2273,11 @@ bool BotDatabase::SaveBotSettings(Mob* m) return false; } - uint32 botID = (m->IsBot() ? m->CastToBot()->GetBotID() : 0); - uint32 charID = (m->IsClient() ? m->CastToClient()->CharacterID() : 0); - uint8 stanceID = (m->IsBot() ? m->CastToBot()->GetBotStance() : 0); + uint32 bot_id = (m->IsBot() ? m->CastToBot()->GetBotID() : 0); + uint32 char_id = (m->IsClient() ? m->CastToClient()->CharacterID() : 0); + uint8 stance_id = (m->IsBot() ? m->CastToBot()->GetBotStance() : 0); - if (stanceID == Stance::Passive) { + if (stance_id == Stance::Passive) { LogBotSettings("{} is currently set to {} [#{}]. No saving or loading required.", m->GetCleanName(), Stance::GetName(Stance::Passive), Stance::Passive); return true; } @@ -2285,10 +2285,10 @@ bool BotDatabase::SaveBotSettings(Mob* m) std::string query = ""; if (m->IsClient()) { - query = fmt::format("`char_id` = {} AND `stance` = {}", charID, stanceID); + query = fmt::format("`char_id` = {} AND `stance` = {}", char_id, stance_id); } else { - query = fmt::format("`bot_id` = {} AND `stance` = {}", botID, stanceID); + query = fmt::format("`bot_id` = {} AND `stance` = {}", bot_id, stance_id); } BotSettingsRepository::DeleteWhere(database, query); @@ -2296,14 +2296,14 @@ bool BotDatabase::SaveBotSettings(Mob* m) std::vector v; if (m->IsBot()) { - uint8 botStance = m->CastToBot()->GetBotStance(); + uint8 bot_stance = m->CastToBot()->GetBotStance(); for (uint16 i = BotBaseSettings::START_ALL; i <= BotBaseSettings::END; ++i) { - if (m->CastToBot()->GetBotBaseSetting(i) != m->CastToBot()->GetDefaultBotBaseSetting(i, botStance)) { + if (m->CastToBot()->GetBotBaseSetting(i) != m->CastToBot()->GetDefaultBotBaseSetting(i, bot_stance)) { auto e = BotSettingsRepository::BotSettings{ - .char_id = charID, - .bot_id = botID, - .stance = stanceID, + .char_id = char_id, + .bot_id = bot_id, + .stance = stance_id, .setting_id = static_cast(i), .setting_type = static_cast(BotSettingCategories::BaseSetting), .value = static_cast(m->CastToBot()->GetBotBaseSetting(i)), @@ -2319,11 +2319,11 @@ bool BotDatabase::SaveBotSettings(Mob* m) for (uint16 i = BotSettingCategories::START_NO_BASE; i <= BotSettingCategories::END; ++i) { for (uint16 x = BotSpellTypes::START; x <= BotSpellTypes::END; ++x) { - if (m->CastToBot()->GetSetting(i, x) != m->CastToBot()->GetDefaultSetting(i, x, botStance)) { + if (m->CastToBot()->GetSetting(i, x) != m->CastToBot()->GetDefaultSetting(i, x, bot_stance)) { auto e = BotSettingsRepository::BotSettings{ - .char_id = charID, - .bot_id = botID, - .stance = stanceID, + .char_id = char_id, + .bot_id = bot_id, + .stance = stance_id, .setting_id = static_cast(x), .setting_type = static_cast(i), .value = m->CastToBot()->GetSetting(i, x), @@ -2333,7 +2333,7 @@ bool BotDatabase::SaveBotSettings(Mob* m) v.emplace_back(e); - LogBotSettings("{} says, 'Saving {} {} [{}] - set to [{}] default [{}].'", m->GetCleanName(), m->GetBotSpellCategoryName(i), m->GetSpellTypeNameByID(x), x, e.value, m->CastToBot()->GetDefaultSetting(i, x, botStance)); + LogBotSettings("{} says, 'Saving {} {} [{}] - set to [{}] default [{}].'", m->GetCleanName(), m->GetBotSpellCategoryName(i), m->GetSpellTypeNameByID(x), x, e.value, m->CastToBot()->GetDefaultSetting(i, x, bot_stance)); } } } @@ -2342,9 +2342,9 @@ bool BotDatabase::SaveBotSettings(Mob* m) if (m->IsClient()) { if (m->CastToClient()->GetDefaultBotSettings(BotSettingCategories::BaseSetting, BotBaseSettings::IllusionBlock) != m->GetIllusionBlock()) { // Only illusion block supported auto e = BotSettingsRepository::BotSettings{ - .char_id = charID, - .bot_id = botID, - .stance = stanceID, + .char_id = char_id, + .bot_id = bot_id, + .stance = stance_id, .setting_id = static_cast(BotBaseSettings::IllusionBlock), .setting_type = static_cast(BotSettingCategories::BaseSetting), .value = m->GetIllusionBlock(), @@ -2362,9 +2362,9 @@ bool BotDatabase::SaveBotSettings(Mob* m) LogBotSettings("{} says, 'Checking {} {} [{}] - set to [{}] default [{}].'", m->GetCleanName(), m->GetBotSpellCategoryName(i), m->CastToBot()->GetSpellTypeNameByID(x), x, m->CastToClient()->GetBotSetting(i, x), m->CastToClient()->GetDefaultBotSettings(i, x)); if (m->CastToClient()->GetBotSetting(i, x) != m->CastToClient()->GetDefaultBotSettings(i, x)) { auto e = BotSettingsRepository::BotSettings{ - .char_id = charID, - .bot_id = botID, - .stance = stanceID, + .char_id = char_id, + .bot_id = bot_id, + .stance = stance_id, .setting_id = static_cast(x), .setting_type = static_cast(i), .value = m->CastToClient()->GetBotSetting(i, x), diff --git a/zone/botspellsai.cpp b/zone/botspellsai.cpp index 69bc55c16..78d6ed135 100644 --- a/zone/botspellsai.cpp +++ b/zone/botspellsai.cpp @@ -21,57 +21,57 @@ #include "../common/repositories/bot_spells_entries_repository.h" #include "../common/repositories/npc_spells_repository.h" -bool Bot::AICastSpell(Mob* tar, uint8 iChance, uint16 spellType, uint16 subTargetType, uint16 subType) { +bool Bot::AICastSpell(Mob* tar, uint8 chance, uint16 spell_type, uint16 sub_target_type, uint16 sub_type) { if (!tar) { return false; } - LogBotPreChecksDetail("{} says, 'Attempting {} AICastSpell on {}.'", GetCleanName(), GetSpellTypeNameByID(spellType), tar->GetCleanName()); + LogBotPreChecksDetail("{} says, 'Attempting {} AICastSpell on {}.'", GetCleanName(), GetSpellTypeNameByID(spell_type), tar->GetCleanName()); if ( !AI_HasSpells() || - (spellType == BotSpellTypes::Pet && tar != this) || - (IsPetBotSpellType(spellType) && !tar->IsPet()) || - (spellType == BotSpellTypes::Buff && tar->IsPet()) || - (spellType == BotSpellTypes::InCombatBuffSong && tar->IsPet()) || - (spellType == BotSpellTypes::OutOfCombatBuffSong && tar->IsPet()) || - (spellType == BotSpellTypes::PreCombatBuffSong && tar->IsPet()) || + (spell_type == BotSpellTypes::Pet && tar != this) || + (IsPetBotSpellType(spell_type) && !tar->IsPet()) || + (spell_type == BotSpellTypes::Buff && tar->IsPet()) || + (spell_type == BotSpellTypes::InCombatBuffSong && tar->IsPet()) || + (spell_type == BotSpellTypes::OutOfCombatBuffSong && tar->IsPet()) || + (spell_type == BotSpellTypes::PreCombatBuffSong && tar->IsPet()) || (!RuleB(Bots, AllowBuffingHealingFamiliars) && tar->IsFamiliar()) || - (tar->IsPet() && tar->IsCharmed() && spellType == BotSpellTypes::PetBuffs && !RuleB(Bots, AllowCharmedPetBuffs)) || - (tar->IsPet() && tar->IsCharmed() && spellType == BotSpellTypes::PetCures && !RuleB(Bots, AllowCharmedPetCures)) || - (tar->IsPet() && tar->IsCharmed() && IsHealBotSpellType(spellType) && !RuleB(Bots, AllowCharmedPetHeals)) + (tar->IsPet() && tar->IsCharmed() && spell_type == BotSpellTypes::PetBuffs && !RuleB(Bots, AllowCharmedPetBuffs)) || + (tar->IsPet() && tar->IsCharmed() && spell_type == BotSpellTypes::PetCures && !RuleB(Bots, AllowCharmedPetCures)) || + (tar->IsPet() && tar->IsCharmed() && IsHealBotSpellType(spell_type) && !RuleB(Bots, AllowCharmedPetHeals)) ) { return false; } - if (iChance < 100 && zone->random.Int(0, 100) > iChance) { + if (chance < 100 && zone->random.Int(0, 100) > chance) { return false; } - if ((spellType != BotSpellTypes::Resurrect && spellType != BotSpellTypes::SummonCorpse) && tar->GetAppearance() == eaDead) { + if ((spell_type != BotSpellTypes::Resurrect && spell_type != BotSpellTypes::SummonCorpse) && tar->GetAppearance() == eaDead) { if (!((tar->IsClient() && tar->CastToClient()->GetFeigned()) || tar->IsBot())) { return false; } } - uint8 botClass = GetClass(); + uint8 bot_class = GetClass(); SetCastedSpellType(UINT16_MAX); // this is for recast timers - SetTempSpellType(spellType); // this is for spell checks + SetTempSpellType(spell_type); // this is for spell checks - BotSpell botSpell; - botSpell.SpellId = 0; - botSpell.SpellIndex = 0; - botSpell.ManaCost = 0; + BotSpell bot_spell; + bot_spell.SpellId = 0; + bot_spell.SpellIndex = 0; + bot_spell.ManaCost = 0; - if (SpellTypeRequiresLoS(spellType) && tar != this) { + if (SpellTypeRequiresLoS(spell_type) && tar != this) { SetHasLoS(DoLosChecks(this, tar)); } else { SetHasLoS(true); } - switch (spellType) { + switch (spell_type) { case BotSpellTypes::Slow: if (tar->GetSpecialAbility(SpecialAbility::SlowImmunity)) { return false; @@ -118,7 +118,7 @@ bool Bot::AICastSpell(Mob* tar, uint8 iChance, uint16 spellType, uint16 subTarge break; case BotSpellTypes::InCombatBuff: - if (!IsCommandedSpell() && GetClass() != Class::Shaman && spellType == BotSpellTypes::InCombatBuff && IsCasterClass(GetClass()) && GetLevel() >= GetStopMeleeLevel()) { + if (!IsCommandedSpell() && GetClass() != Class::Shaman && spell_type == BotSpellTypes::InCombatBuff && IsCasterClass(GetClass()) && GetLevel() >= GetStopMeleeLevel()) { return false; } @@ -162,14 +162,14 @@ bool Bot::AICastSpell(Mob* tar, uint8 iChance, uint16 spellType, uint16 subTarge break; case BotSpellTypes::AEMez: case BotSpellTypes::Mez: - return BotCastMez(tar, botClass, botSpell, spellType); + return BotCastMez(tar, bot_class, bot_spell, spell_type); case BotSpellTypes::AENukes: case BotSpellTypes::AERains: case BotSpellTypes::PBAENuke: case BotSpellTypes::Nuke: case BotSpellTypes::AEStun: case BotSpellTypes::Stun: - return BotCastNuke(tar, botClass, botSpell, spellType); + return BotCastNuke(tar, bot_class, bot_spell, spell_type); case BotSpellTypes::RegularHeal: case BotSpellTypes::GroupCompleteHeals: case BotSpellTypes::CompleteHeal: @@ -187,7 +187,7 @@ bool Bot::AICastSpell(Mob* tar, uint8 iChance, uint16 spellType, uint16 subTarge return false; } - return BotCastHeal(tar, botClass, botSpell, spellType); + return BotCastHeal(tar, bot_class, bot_spell, spell_type); case BotSpellTypes::GroupCures: case BotSpellTypes::Cure: case BotSpellTypes::PetCures: @@ -195,13 +195,13 @@ bool Bot::AICastSpell(Mob* tar, uint8 iChance, uint16 spellType, uint16 subTarge return false; } - return BotCastCure(tar, botClass, botSpell, spellType); + return BotCastCure(tar, bot_class, bot_spell, spell_type); case BotSpellTypes::Pet: if (HasPet() || IsBotCharmer()) { return false; } - return BotCastPet(tar, botClass, botSpell, spellType); + return BotCastPet(tar, bot_class, bot_spell, spell_type); case BotSpellTypes::Resurrect: if (!tar->IsCorpse() || !tar->CastToCorpse()->IsPlayerCorpse()) { return false; @@ -218,9 +218,9 @@ bool Bot::AICastSpell(Mob* tar, uint8 iChance, uint16 spellType, uint16 subTarge break; } - std::vector botSpellList = GetPrioritizedBotSpellsBySpellType(this, spellType, tar, (IsAEBotSpellType(spellType) || subTargetType == CommandedSubTypes::AETarget), subTargetType, subType); + std::vector bot_spell_list = GetPrioritizedBotSpellsBySpellType(this, spell_type, tar, (IsAEBotSpellType(spell_type) || sub_target_type == CommandedSubTypes::AETarget), sub_target_type, sub_type); - for (const auto& s : botSpellList) { + for (const auto& s : bot_spell_list) { if (!IsValidSpellAndLoS(s.SpellId, HasLoS())) { continue; @@ -236,7 +236,7 @@ bool Bot::AICastSpell(Mob* tar, uint8 iChance, uint16 spellType, uint16 subTarge fmt::format( "Interrupting {}. I have been commanded to try to cast a [{}] spell, {} on {}.", CastingSpellID() ? spells[CastingSpellID()].name : "my spell", - GetSpellTypeNameByID(spellType), + GetSpellTypeNameByID(spell_type), spells[s.SpellId].name, tar->GetCleanName() ).c_str() @@ -246,24 +246,24 @@ bool Bot::AICastSpell(Mob* tar, uint8 iChance, uint16 spellType, uint16 subTarge } if (AIDoSpellCast(s.SpellIndex, tar, s.ManaCost)) { - if (IsBotSpellTypeOtherBeneficial(spellType)) { + if (IsBotSpellTypeOtherBeneficial(spell_type)) { SetCastedSpellType(UINT16_MAX); if (!IsCommandedSpell()) { - SetBotSpellRecastTimer(spellType, tar, true); + SetBotSpellRecastTimer(spell_type, tar, true); } } else { - SetCastedSpellType(spellType); + SetCastedSpellType(spell_type); } - if (botClass != Class::Bard || RuleB(Bots, BardsAnnounceCasts)) { + if (bot_class != Class::Bard || RuleB(Bots, BardsAnnounceCasts)) { BotGroupSay( this, fmt::format( "Casting {} [{}] on {}.", GetSpellName(s.SpellId), - GetSpellTypeNameByID(spellType), + GetSpellTypeNameByID(spell_type), (tar == this ? "myself" : tar->GetCleanName()) ).c_str() ); @@ -276,34 +276,34 @@ bool Bot::AICastSpell(Mob* tar, uint8 iChance, uint16 spellType, uint16 subTarge return false; } -bool Bot::BotCastMez(Mob* tar, uint8 botClass, BotSpell& botSpell, uint16 spellType) { - std::vector botSpellList = GetPrioritizedBotSpellsBySpellType(this, spellType, tar, IsAEBotSpellType(spellType)); +bool Bot::BotCastMez(Mob* tar, uint8 bot_class, BotSpell& bot_spell, uint16 spell_type) { + std::vector bot_spell_list = GetPrioritizedBotSpellsBySpellType(this, spell_type, tar, IsAEBotSpellType(spell_type)); - for (const auto& s : botSpellList) { + for (const auto& s : bot_spell_list) { if (!IsValidSpellAndLoS(s.SpellId, HasLoS())) { continue; } if (!IsCommandedSpell()) { - Mob* addMob = GetFirstIncomingMobToMez(this, s.SpellId, spellType, IsAEBotSpellType(spellType)); + Mob* add_mob = GetFirstIncomingMobToMez(this, s.SpellId, spell_type, IsAEBotSpellType(spell_type)); - if (!addMob) { + if (!add_mob) { return false; } - tar = addMob; + tar = add_mob; } if (AIDoSpellCast(s.SpellIndex, tar, s.ManaCost)) { - if (IsBotSpellTypeOtherBeneficial(spellType)) { + if (IsBotSpellTypeOtherBeneficial(spell_type)) { SetCastedSpellType(UINT16_MAX); if (!IsCommandedSpell()) { - SetBotSpellRecastTimer(spellType, tar, true); + SetBotSpellRecastTimer(spell_type, tar, true); } } else { - SetCastedSpellType(spellType); + SetCastedSpellType(spell_type); } BotGroupSay( @@ -311,7 +311,7 @@ bool Bot::BotCastMez(Mob* tar, uint8 botClass, BotSpell& botSpell, uint16 spellT fmt::format( "Casting {} [{}] on {}.", GetSpellName(s.SpellId), - GetSpellTypeNameByID(spellType), + GetSpellTypeNameByID(spell_type), (tar == this ? "myself" : tar->GetCleanName()) ).c_str() ); @@ -323,30 +323,30 @@ bool Bot::BotCastMez(Mob* tar, uint8 botClass, BotSpell& botSpell, uint16 spellT return false; } -bool Bot::BotCastCure(Mob* tar, uint8 botClass, BotSpell& botSpell, uint16 spellType) { - uint32 currentTime = Timer::GetCurrentTime(); - uint32 nextCureTime = tar->DontCureMeBefore(); +bool Bot::BotCastCure(Mob* tar, uint8 bot_class, BotSpell& bot_spell, uint16 spell_type) { + uint32 current_time = Timer::GetCurrentTime(); + uint32 next_cure_time = tar->DontCureMeBefore(); if (!IsCommandedSpell()) { - if ((nextCureTime > currentTime) || !GetNeedsCured(tar)) { + if ((next_cure_time > current_time) || !GetNeedsCured(tar)) { return false; } } - botSpell = GetBestBotSpellForCure(this, tar, spellType); + bot_spell = GetBestBotSpellForCure(this, tar, spell_type); - if (!IsValidSpellAndLoS(botSpell.SpellId, HasLoS())) { + if (!IsValidSpellAndLoS(bot_spell.SpellId, HasLoS())) { return false; } - if (AIDoSpellCast(botSpell.SpellIndex, tar, botSpell.ManaCost)) { - if (botClass != Class::Bard || RuleB(Bots, BardsAnnounceCasts)) { - if (IsGroupSpell(botSpell.SpellId)) { + if (AIDoSpellCast(bot_spell.SpellIndex, tar, bot_spell.ManaCost)) { + if (bot_class != Class::Bard || RuleB(Bots, BardsAnnounceCasts)) { + if (IsGroupSpell(bot_spell.SpellId)) { BotGroupSay( this, fmt::format( "Curing the group with {}.", - GetSpellName(botSpell.SpellId) + GetSpellName(bot_spell.SpellId) ).c_str() ); @@ -354,7 +354,7 @@ bool Bot::BotCastCure(Mob* tar, uint8 botClass, BotSpell& botSpell, uint16 spell if (!IsCommandedSpell()) { for (Mob* m : v) { - SetBotSpellRecastTimer(spellType, m, true); + SetBotSpellRecastTimer(spell_type, m, true); } } } @@ -364,12 +364,12 @@ bool Bot::BotCastCure(Mob* tar, uint8 botClass, BotSpell& botSpell, uint16 spell fmt::format( "Curing {} with {}.", (tar == this ? "myself" : tar->GetCleanName()), - GetSpellName(botSpell.SpellId) + GetSpellName(bot_spell.SpellId) ).c_str() ); if (!IsCommandedSpell()) { - SetBotSpellRecastTimer(spellType, tar, true); + SetBotSpellRecastTimer(spell_type, tar, true); } return true; @@ -380,8 +380,8 @@ bool Bot::BotCastCure(Mob* tar, uint8 botClass, BotSpell& botSpell, uint16 spell return false; } -bool Bot::BotCastPet(Mob* tar, uint8 botClass, BotSpell& botSpell, uint16 spellType) { - if (botClass == Class::Wizard) { +bool Bot::BotCastPet(Mob* tar, uint8 bot_class, BotSpell& bot_spell, uint16 spell_type) { + if (bot_class == Class::Wizard) { auto buffs_max = GetMaxBuffSlots(); auto my_buffs = GetBuffs(); int familiar_buff_slot = -1; @@ -402,26 +402,26 @@ bool Bot::BotCastPet(Mob* tar, uint8 botClass, BotSpell& botSpell, uint16 spellT return false; } - botSpell = GetFirstBotSpellBySpellType(this, spellType); + bot_spell = GetFirstBotSpellBySpellType(this, spell_type); } - else if (botClass == Class::Magician) { - botSpell = GetBestBotMagicianPetSpell(this, spellType); + else if (bot_class == Class::Magician) { + bot_spell = GetBestBotMagicianPetSpell(this, spell_type); } else { - botSpell = GetFirstBotSpellBySpellType(this, spellType); + bot_spell = GetFirstBotSpellBySpellType(this, spell_type); } - if (!IsValidSpellAndLoS(botSpell.SpellId, HasLoS())) { + if (!IsValidSpellAndLoS(bot_spell.SpellId, HasLoS())) { return false; } - if (AIDoSpellCast(botSpell.SpellIndex, tar, botSpell.ManaCost)) { - SetCastedSpellType(spellType); + if (AIDoSpellCast(bot_spell.SpellIndex, tar, bot_spell.ManaCost)) { + SetCastedSpellType(spell_type); BotGroupSay( this, fmt::format( "Summoning a pet [{}].", - GetSpellName(botSpell.SpellId) + GetSpellName(bot_spell.SpellId) ).c_str() ); @@ -431,55 +431,55 @@ bool Bot::BotCastPet(Mob* tar, uint8 botClass, BotSpell& botSpell, uint16 spellT return false; } -bool Bot::BotCastNuke(Mob* tar, uint8 botClass, BotSpell& botSpell, uint16 spellType) { - if (spellType == BotSpellTypes::Stun || spellType == BotSpellTypes::AEStun) { - uint8 stunChance = (tar->IsCasting() ? RuleI(Bots, StunCastChanceIfCasting) : RuleI(Bots, StunCastChanceNormal)); +bool Bot::BotCastNuke(Mob* tar, uint8 bot_class, BotSpell& bot_spell, uint16 spell_type) { + if (spell_type == BotSpellTypes::Stun || spell_type == BotSpellTypes::AEStun) { + uint8 stun_chance = (tar->IsCasting() ? RuleI(Bots, StunCastChanceIfCasting) : RuleI(Bots, StunCastChanceNormal)); - if (botClass == Class::Paladin) { - stunChance = RuleI(Bots, StunCastChancePaladins); + if (bot_class == Class::Paladin) { + stun_chance = RuleI(Bots, StunCastChancePaladins); } if ( !tar->GetSpecialAbility(SpecialAbility::StunImmunity) && ( IsCommandedSpell() || - (!tar->IsStunned() && (zone->random.Int(1, 100) <= stunChance)) + (!tar->IsStunned() && (zone->random.Int(1, 100) <= stun_chance)) ) ) { - botSpell = GetBestBotSpellForStunByTargetType(this, ST_TargetOptional, spellType, IsAEBotSpellType(spellType), tar); + bot_spell = GetBestBotSpellForStunByTargetType(this, ST_TargetOptional, spell_type, IsAEBotSpellType(spell_type), tar); } - if (!IsValidSpellAndLoS(botSpell.SpellId, HasLoS())) { + if (!IsValidSpellAndLoS(bot_spell.SpellId, HasLoS())) { return false; } } - if (!IsValidSpellAndLoS(botSpell.SpellId, HasLoS())) { - botSpell = GetBestBotSpellForNukeByBodyType(this, tar->GetBodyType(), spellType, IsAEBotSpellType(spellType), tar); + if (!IsValidSpellAndLoS(bot_spell.SpellId, HasLoS())) { + bot_spell = GetBestBotSpellForNukeByBodyType(this, tar->GetBodyType(), spell_type, IsAEBotSpellType(spell_type), tar); } - if (!IsValidSpellAndLoS(botSpell.SpellId, HasLoS()) && spellType == BotSpellTypes::Nuke && botClass == Class::Wizard) { - botSpell = GetBestBotWizardNukeSpellByTargetResists(this, tar, spellType); + if (!IsValidSpellAndLoS(bot_spell.SpellId, HasLoS()) && spell_type == BotSpellTypes::Nuke && bot_class == Class::Wizard) { + bot_spell = GetBestBotWizardNukeSpellByTargetResists(this, tar, spell_type); } - if (!IsValidSpellAndLoS(botSpell.SpellId, HasLoS())) { - std::vector botSpellList = GetPrioritizedBotSpellsBySpellType(this, spellType, tar, IsAEBotSpellType(spellType)); + if (!IsValidSpellAndLoS(bot_spell.SpellId, HasLoS())) { + std::vector bot_spell_list = GetPrioritizedBotSpellsBySpellType(this, spell_type, tar, IsAEBotSpellType(spell_type)); - for (const auto& s : botSpellList) { + for (const auto& s : bot_spell_list) { if (!IsValidSpellAndLoS(s.SpellId, HasLoS())) { continue; } if (AIDoSpellCast(s.SpellIndex, tar, s.ManaCost)) { - SetCastedSpellType(spellType); + SetCastedSpellType(spell_type); - if (botClass != Class::Bard || RuleB(Bots, BardsAnnounceCasts)) { + if (bot_class != Class::Bard || RuleB(Bots, BardsAnnounceCasts)) { BotGroupSay( this, fmt::format( "Casting {} [{}] on {}.", GetSpellName(s.SpellId), - GetSpellTypeNameByID(spellType), + GetSpellTypeNameByID(spell_type), tar->GetCleanName() ).c_str() ); @@ -490,16 +490,16 @@ bool Bot::BotCastNuke(Mob* tar, uint8 botClass, BotSpell& botSpell, uint16 spell } } else { - if (AIDoSpellCast(botSpell.SpellIndex, tar, botSpell.ManaCost)) { - SetCastedSpellType(spellType); + if (AIDoSpellCast(bot_spell.SpellIndex, tar, bot_spell.ManaCost)) { + SetCastedSpellType(spell_type); - if (botClass != Class::Bard || RuleB(Bots, BardsAnnounceCasts)) { + if (bot_class != Class::Bard || RuleB(Bots, BardsAnnounceCasts)) { BotGroupSay( this, fmt::format( "Casting {} [{}] on {}.", - GetSpellName(botSpell.SpellId), - GetSpellTypeNameByID(spellType), + GetSpellName(bot_spell.SpellId), + GetSpellTypeNameByID(spell_type), tar->GetCleanName() ).c_str() ); @@ -512,31 +512,31 @@ bool Bot::BotCastNuke(Mob* tar, uint8 botClass, BotSpell& botSpell, uint16 spell return false; } -bool Bot::BotCastHeal(Mob* tar, uint8 botClass, BotSpell& botSpell, uint16 spellType) { - botSpell = GetSpellByHealType(spellType, tar); +bool Bot::BotCastHeal(Mob* tar, uint8 bot_class, BotSpell& bot_spell, uint16 spell_type) { + bot_spell = GetSpellByHealType(spell_type, tar); - if (!IsValidSpell(botSpell.SpellId)) { + if (!IsValidSpell(bot_spell.SpellId)) { return false; } - if (AIDoSpellCast(botSpell.SpellIndex, tar, botSpell.ManaCost)) { - if (botClass != Class::Bard || RuleB(Bots, BardsAnnounceCasts)) { - if (IsGroupSpell(botSpell.SpellId)) { + if (AIDoSpellCast(bot_spell.SpellIndex, tar, bot_spell.ManaCost)) { + if (bot_class != Class::Bard || RuleB(Bots, BardsAnnounceCasts)) { + if (IsGroupSpell(bot_spell.SpellId)) { BotGroupSay( this, fmt::format( "Healing the group with {} [{}].", - GetSpellName(botSpell.SpellId), - GetSpellTypeNameByID(spellType) + GetSpellName(bot_spell.SpellId), + GetSpellTypeNameByID(spell_type) ).c_str() ); - if (botClass != Class::Bard) { + if (bot_class != Class::Bard) { const std::vector v = GatherSpellTargets(false, tar); if (!IsCommandedSpell()) { for (Mob* m : v) { - SetBotSpellRecastTimer(spellType, m, true); + SetBotSpellRecastTimer(spell_type, m, true); } } } @@ -548,14 +548,14 @@ bool Bot::BotCastHeal(Mob* tar, uint8 botClass, BotSpell& botSpell, uint16 spell fmt::format( "Healing {} with {} [{}].", (tar == this ? "myself" : tar->GetCleanName()), - GetSpellName(botSpell.SpellId), - GetSpellTypeNameByID(spellType) + GetSpellName(bot_spell.SpellId), + GetSpellTypeNameByID(spell_type) ).c_str() ); - if (botClass != Class::Bard) { + if (bot_class != Class::Bard) { if (!IsCommandedSpell()) { - SetBotSpellRecastTimer(spellType, tar, true); + SetBotSpellRecastTimer(spell_type, tar, true); } } } @@ -631,31 +631,31 @@ bool Bot::AI_PursueCastCheck() { return false; } - auto castOrder = GetSpellTypesPrioritized(BotPriorityCategories::Pursue); + auto cast_order = GetSpellTypesPrioritized(BotPriorityCategories::Pursue); Mob* tar = nullptr; - for (auto& currentCast : castOrder) { - if (currentCast.priority == 0) { - LogBotPreChecksDetail("{} says, '[{}] is priority 0, skipping.'", GetCleanName(), GetSpellTypeNameByID(currentCast.spellType)); + for (auto& current_cast : cast_order) { + if (current_cast.priority == 0) { + LogBotPreChecksDetail("{} says, '[{}] is priority 0, skipping.'", GetCleanName(), GetSpellTypeNameByID(current_cast.spellType)); continue; } - if (!RuleB(Bots, AllowAIMez) && (currentCast.spellType == BotSpellTypes::AEMez || currentCast.spellType == BotSpellTypes::Mez)) { + if (!RuleB(Bots, AllowAIMez) && (current_cast.spellType == BotSpellTypes::AEMez || current_cast.spellType == BotSpellTypes::Mez)) { continue; } - if (IsCommandedSpellType(currentCast.spellType)) { // Unsupported by AI currently. + if (IsCommandedSpellType(current_cast.spellType)) { // Unsupported by AI currently. continue; } - if (AIBot_spells_by_type[currentCast.spellType].empty()) { + if (AIBot_spells_by_type[current_cast.spellType].empty()) { continue; } - result = AttemptAICastSpell(currentCast.spellType, nullptr); + result = AttemptAICastSpell(current_cast.spellType, nullptr); - if (!result && IsBotSpellTypeBeneficial(currentCast.spellType)) { - result = AttemptCloseBeneficialSpells(currentCast.spellType); + if (!result && IsBotSpellTypeBeneficial(current_cast.spellType)) { + result = AttemptCloseBeneficialSpells(current_cast.spellType); } if (result) { @@ -685,7 +685,7 @@ bool Bot::AI_IdleCastCheck() { AIautocastspell_timer->Disable(); //prevent the timer from going off AGAIN while we are casting. - bool preCombat = false; + bool pre_combat = false; Client* test_against = nullptr; if (HasGroup() && GetGroup()->GetLeader() && GetGroup()->GetLeader()->IsClient()) { @@ -696,45 +696,45 @@ bool Bot::AI_IdleCastCheck() { } if (test_against) { - preCombat = test_against->GetBotPrecombat(); + pre_combat = test_against->GetBotPrecombat(); } - auto castOrder = GetSpellTypesPrioritized(BotPriorityCategories::Idle); + auto cast_order = GetSpellTypesPrioritized(BotPriorityCategories::Idle); Mob* tar = nullptr; - for (auto& currentCast : castOrder) { - if (currentCast.priority == 0) { - LogBotPreChecksDetail("{} says, '[{}] is priority 0, skipping.'", GetCleanName(), GetSpellTypeNameByID(currentCast.spellType)); + for (auto& current_cast : cast_order) { + if (current_cast.priority == 0) { + LogBotPreChecksDetail("{} says, '[{}] is priority 0, skipping.'", GetCleanName(), GetSpellTypeNameByID(current_cast.spellType)); continue; } - if (!preCombat && (currentCast.spellType == BotSpellTypes::PreCombatBuff || currentCast.spellType == BotSpellTypes::PreCombatBuffSong)) { + if (!pre_combat && (current_cast.spellType == BotSpellTypes::PreCombatBuff || current_cast.spellType == BotSpellTypes::PreCombatBuffSong)) { continue; } - if (!RuleB(Bots, AllowAIMez) && (currentCast.spellType == BotSpellTypes::AEMez || currentCast.spellType == BotSpellTypes::Mez)) { + if (!RuleB(Bots, AllowAIMez) && (current_cast.spellType == BotSpellTypes::AEMez || current_cast.spellType == BotSpellTypes::Mez)) { continue; } - if (IsCommandedSpellType(currentCast.spellType)) { // Unsupported by AI currently. + if (IsCommandedSpellType(current_cast.spellType)) { // Unsupported by AI currently. continue; } - if (!IsBotSpellTypeBeneficial(currentCast.spellType)) { + if (!IsBotSpellTypeBeneficial(current_cast.spellType)) { continue; } - if (AIBot_spells_by_type[currentCast.spellType].empty()) { + if (AIBot_spells_by_type[current_cast.spellType].empty()) { continue; } - result = AttemptAICastSpell(currentCast.spellType, nullptr); + result = AttemptAICastSpell(current_cast.spellType, nullptr); if (result) { break; } - result = AttemptCloseBeneficialSpells(currentCast.spellType); + result = AttemptCloseBeneficialSpells(current_cast.spellType); if (result) { break; @@ -755,7 +755,6 @@ bool Bot::AI_EngagedCastCheck() { } bool result = false; - bool failedToCast = false; if (GetTarget() && AIautocastspell_timer->Check(false)) { @@ -768,31 +767,31 @@ bool Bot::AI_EngagedCastCheck() { return false; } - auto castOrder = GetSpellTypesPrioritized(BotPriorityCategories::Engaged); + auto cast_order = GetSpellTypesPrioritized(BotPriorityCategories::Engaged); Mob* tar = nullptr; - for (auto& currentCast : castOrder) { - if (currentCast.priority == 0) { - LogBotPreChecksDetail("{} says, '[{}] is priority 0, skipping.'", GetCleanName(), GetSpellTypeNameByID(currentCast.spellType)); + for (auto& current_cast : cast_order) { + if (current_cast.priority == 0) { + LogBotPreChecksDetail("{} says, '[{}] is priority 0, skipping.'", GetCleanName(), GetSpellTypeNameByID(current_cast.spellType)); continue; } - if (!RuleB(Bots, AllowAIMez) && (currentCast.spellType == BotSpellTypes::AEMez || currentCast.spellType == BotSpellTypes::Mez)) { + if (!RuleB(Bots, AllowAIMez) && (current_cast.spellType == BotSpellTypes::AEMez || current_cast.spellType == BotSpellTypes::Mez)) { continue; } - if (IsCommandedSpellType(currentCast.spellType)) { // Unsupported by AI currently. + if (IsCommandedSpellType(current_cast.spellType)) { // Unsupported by AI currently. continue; } - if (AIBot_spells_by_type[currentCast.spellType].empty()) { + if (AIBot_spells_by_type[current_cast.spellType].empty()) { continue; } - result = AttemptAICastSpell(currentCast.spellType, nullptr); + result = AttemptAICastSpell(current_cast.spellType, nullptr); - if (!result && IsBotSpellTypeBeneficial(currentCast.spellType)) { - result = AttemptCloseBeneficialSpells(currentCast.spellType); + if (!result && IsBotSpellTypeBeneficial(current_cast.spellType)) { + result = AttemptCloseBeneficialSpells(current_cast.spellType); } if (result) { @@ -896,37 +895,37 @@ bool Bot::AIHealRotation(Mob* tar, bool useFastHeals) { return castedSpell; } -std::list Bot::GetBotSpellsForSpellEffect(Bot* botCaster, uint16 spellType, int spellEffect) { +std::list Bot::GetBotSpellsForSpellEffect(Bot* caster, uint16 spell_type, int spell_effect) { std::list result; - if (!botCaster) { + if (!caster) { return result; } - if (auto bot_owner = botCaster->GetBotOwner(); !bot_owner) { + if (auto bot_owner = caster->GetBotOwner(); !bot_owner) { return result; } - if (botCaster->AI_HasSpells()) { - std::vector botSpellList = botCaster->BotGetSpellsByType(spellType); + if (caster->AI_HasSpells()) { + std::vector bot_spell_list = caster->BotGetSpellsByType(spell_type); - for (int i = botSpellList.size() - 1; i >= 0; i--) { - if (!IsValidSpellAndLoS(botSpellList[i].spellid, botCaster->HasLoS())) { + for (int i = bot_spell_list.size() - 1; i >= 0; i--) { + if (!IsValidSpellAndLoS(bot_spell_list[i].spellid, caster->HasLoS())) { continue; } if ( - botCaster->CheckSpellRecastTimer(botSpellList[i].spellid) && - (botSpellList[i].type == spellType || botSpellList[i].type == botCaster->GetParentSpellType(spellType)) && - botCaster->IsValidSpellTypeBySpellID(spellType, botSpellList[i].spellid) && - (IsEffectInSpell(botSpellList[i].spellid, spellEffect) || GetSpellTriggerSpellID(botSpellList[i].spellid, spellEffect)) + caster->CheckSpellRecastTimer(bot_spell_list[i].spellid) && + (bot_spell_list[i].type == spell_type || bot_spell_list[i].type == caster->GetParentSpellType(spell_type)) && + caster->IsValidSpellTypeBySpellID(spell_type, bot_spell_list[i].spellid) && + (IsEffectInSpell(bot_spell_list[i].spellid, spell_effect) || GetSpellTriggerSpellID(bot_spell_list[i].spellid, spell_effect)) ) { - BotSpell botSpell; - botSpell.SpellId = botSpellList[i].spellid; - botSpell.SpellIndex = botSpellList[i].index; - botSpell.ManaCost = botSpellList[i].manacost; + BotSpell bot_spell; + bot_spell.SpellId = bot_spell_list[i].spellid; + bot_spell.SpellIndex = bot_spell_list[i].index; + bot_spell.ManaCost = bot_spell_list[i].manacost; - result.push_back(botSpell); + result.push_back(bot_spell); } } } @@ -934,40 +933,40 @@ std::list Bot::GetBotSpellsForSpellEffect(Bot* botCaster, uint16 spell return result; } -std::list Bot::GetBotSpellsForSpellEffectAndTargetType(Bot* botCaster, uint16 spellType, int spellEffect, SpellTargetType targetType) { +std::list Bot::GetBotSpellsForSpellEffectAndTargetType(Bot* caster, uint16 spell_type, int spell_effect, SpellTargetType target_type) { std::list result; - if (!botCaster) { + if (!caster) { return result; } - if (auto bot_owner = botCaster->GetBotOwner(); !bot_owner) { + if (auto bot_owner = caster->GetBotOwner(); !bot_owner) { return result; } - if (botCaster->AI_HasSpells()) { - std::vector botSpellList = botCaster->BotGetSpellsByType(spellType); + if (caster->AI_HasSpells()) { + std::vector bot_spell_list = caster->BotGetSpellsByType(spell_type); - for (int i = botSpellList.size() - 1; i >= 0; i--) { - if (!IsValidSpellAndLoS(botSpellList[i].spellid, botCaster->HasLoS())) { + for (int i = bot_spell_list.size() - 1; i >= 0; i--) { + if (!IsValidSpellAndLoS(bot_spell_list[i].spellid, caster->HasLoS())) { continue; } if ( - botCaster->CheckSpellRecastTimer(botSpellList[i].spellid) && - (botSpellList[i].type == spellType || botSpellList[i].type == botCaster->GetParentSpellType(spellType)) && - botCaster->IsValidSpellTypeBySpellID(spellType, botSpellList[i].spellid) && + caster->CheckSpellRecastTimer(bot_spell_list[i].spellid) && + (bot_spell_list[i].type == spell_type || bot_spell_list[i].type == caster->GetParentSpellType(spell_type)) && + caster->IsValidSpellTypeBySpellID(spell_type, bot_spell_list[i].spellid) && ( - IsEffectInSpell(botSpellList[i].spellid, spellEffect) || - GetSpellTriggerSpellID(botSpellList[i].spellid, spellEffect) + IsEffectInSpell(bot_spell_list[i].spellid, spell_effect) || + GetSpellTriggerSpellID(bot_spell_list[i].spellid, spell_effect) ) && - (targetType == ST_TargetOptional || spells[botSpellList[i].spellid].target_type == targetType) + (target_type == ST_TargetOptional || spells[bot_spell_list[i].spellid].target_type == target_type) ) { - BotSpell botSpell; - botSpell.SpellId = botSpellList[i].spellid; - botSpell.SpellIndex = botSpellList[i].index; - botSpell.ManaCost = botSpellList[i].manacost; - result.push_back(botSpell); + BotSpell bot_spell; + bot_spell.SpellId = bot_spell_list[i].spellid; + bot_spell.SpellIndex = bot_spell_list[i].index; + bot_spell.ManaCost = bot_spell_list[i].manacost; + result.push_back(bot_spell); } } } @@ -975,36 +974,36 @@ std::list Bot::GetBotSpellsForSpellEffectAndTargetType(Bot* botCaster, return result; } -std::list Bot::GetBotSpellsBySpellType(Bot* botCaster, uint16 spellType) { +std::list Bot::GetBotSpellsBySpellType(Bot* caster, uint16 spell_type) { std::list result; - if (!botCaster) { + if (!caster) { return result; } - if (auto bot_owner = botCaster->GetBotOwner(); !bot_owner) { + if (auto bot_owner = caster->GetBotOwner(); !bot_owner) { return result; } - if (botCaster->AI_HasSpells()) { - std::vector botSpellList = botCaster->BotGetSpellsByType(spellType); + if (caster->AI_HasSpells()) { + std::vector bot_spell_list = caster->BotGetSpellsByType(spell_type); - for (int i = botSpellList.size() - 1; i >= 0; i--) { - if (!IsValidSpellAndLoS(botSpellList[i].spellid, botCaster->HasLoS())) { + for (int i = bot_spell_list.size() - 1; i >= 0; i--) { + if (!IsValidSpellAndLoS(bot_spell_list[i].spellid, caster->HasLoS())) { continue; } if ( - botCaster->CheckSpellRecastTimer(botSpellList[i].spellid) && - (botSpellList[i].type == spellType || botSpellList[i].type == botCaster->GetParentSpellType(spellType)) && - botCaster->IsValidSpellTypeBySpellID(spellType, botSpellList[i].spellid) + caster->CheckSpellRecastTimer(bot_spell_list[i].spellid) && + (bot_spell_list[i].type == spell_type || bot_spell_list[i].type == caster->GetParentSpellType(spell_type)) && + caster->IsValidSpellTypeBySpellID(spell_type, bot_spell_list[i].spellid) ) { - BotSpell botSpell; - botSpell.SpellId = botSpellList[i].spellid; - botSpell.SpellIndex = botSpellList[i].index; - botSpell.ManaCost = botSpellList[i].manacost; + BotSpell bot_spell; + bot_spell.SpellId = bot_spell_list[i].spellid; + bot_spell.SpellIndex = bot_spell_list[i].index; + bot_spell.ManaCost = bot_spell_list[i].manacost; - result.push_back(botSpell); + result.push_back(bot_spell); } } } @@ -1012,77 +1011,77 @@ std::list Bot::GetBotSpellsBySpellType(Bot* botCaster, uint16 spellTyp return result; } -std::vector Bot::GetPrioritizedBotSpellsBySpellType(Bot* botCaster, uint16 spellType, Mob* tar, bool AE, uint16 subTargetType, uint16 subType) { +std::vector Bot::GetPrioritizedBotSpellsBySpellType(Bot* caster, uint16 spell_type, Mob* tar, bool AE, uint16 sub_target_type, uint16 sub_type) { std::vector result; - if (botCaster && botCaster->AI_HasSpells()) { - std::vector botSpellList = botCaster->BotGetSpellsByType(spellType); + if (caster && caster->AI_HasSpells()) { + std::vector bot_spell_list = caster->BotGetSpellsByType(spell_type); - for (int i = botSpellList.size() - 1; i >= 0; i--) { - if (!IsValidSpellAndLoS(botSpellList[i].spellid, botCaster->HasLoS())) { + for (int i = bot_spell_list.size() - 1; i >= 0; i--) { + if (!IsValidSpellAndLoS(bot_spell_list[i].spellid, caster->HasLoS())) { continue; } - if (spellType == BotSpellTypes::HateRedux && botCaster->GetClass() == Class::Bard) { - if (spells[botSpellList[i].spellid].target_type != ST_Target) { + if (spell_type == BotSpellTypes::HateRedux && caster->GetClass() == Class::Bard) { + if (spells[bot_spell_list[i].spellid].target_type != ST_Target) { continue; } } if ( - botCaster->CheckSpellRecastTimer(botSpellList[i].spellid) && - (botSpellList[i].type == spellType || botSpellList[i].type == botCaster->GetParentSpellType(spellType)) && - botCaster->IsValidSpellTypeBySpellID(spellType, botSpellList[i].spellid) + caster->CheckSpellRecastTimer(bot_spell_list[i].spellid) && + (bot_spell_list[i].type == spell_type || bot_spell_list[i].type == caster->GetParentSpellType(spell_type)) && + caster->IsValidSpellTypeBySpellID(spell_type, bot_spell_list[i].spellid) ) { if ( - botCaster->IsCommandedSpell() && + caster->IsCommandedSpell() && ( - !botCaster->IsValidSpellTypeSubType(spellType, subTargetType, botSpellList[i].spellid) || - !botCaster->IsValidSpellTypeSubType(spellType, subType, botSpellList[i].spellid) + !caster->IsValidSpellTypeSubType(spell_type, sub_target_type, bot_spell_list[i].spellid) || + !caster->IsValidSpellTypeSubType(spell_type, sub_type, bot_spell_list[i].spellid) ) ) { continue; } - if (!AE && IsAnyAESpell(botSpellList[i].spellid) && !IsGroupSpell(botSpellList[i].spellid)) { + if (!AE && IsAnyAESpell(bot_spell_list[i].spellid) && !IsGroupSpell(bot_spell_list[i].spellid)) { continue; } - else if (AE && !IsAnyAESpell(botSpellList[i].spellid)) { + else if (AE && !IsAnyAESpell(bot_spell_list[i].spellid)) { continue; } if ( - !botCaster->IsInGroupOrRaid(tar, true) && + !caster->IsInGroupOrRaid(tar, true) && ( !RuleB(Bots, EnableBotTGB) || ( - IsGroupSpell(botSpellList[i].spellid) && - !IsTGBCompatibleSpell(botSpellList[i].spellid) + IsGroupSpell(bot_spell_list[i].spellid) && + !IsTGBCompatibleSpell(bot_spell_list[i].spellid) ) ) ) { continue; } - if (!IsPBAESpell(botSpellList[i].spellid) && !botCaster->CastChecks(botSpellList[i].spellid, tar, spellType, false, IsAEBotSpellType(spellType))) { + if (!IsPBAESpell(bot_spell_list[i].spellid) && !caster->CastChecks(bot_spell_list[i].spellid, tar, spell_type, false, IsAEBotSpellType(spell_type))) { continue; } if ( - botCaster->IsCommandedSpell() || + caster->IsCommandedSpell() || !AE || ( - SpellTypeRequiresAEChecks(spellType) && - botCaster->HasValidAETarget(botCaster, botSpellList[i].spellid, spellType, tar) + SpellTypeRequiresAEChecks(spell_type) && + caster->HasValidAETarget(caster, bot_spell_list[i].spellid, spell_type, tar) ) ) { - BotSpell_wPriority botSpell; - botSpell.SpellId = botSpellList[i].spellid; - botSpell.SpellIndex = botSpellList[i].index; - botSpell.ManaCost = botSpellList[i].manacost; - botSpell.Priority = botSpellList[i].priority; + BotSpell_wPriority bot_spell; + bot_spell.SpellId = bot_spell_list[i].spellid; + bot_spell.SpellIndex = bot_spell_list[i].index; + bot_spell.ManaCost = bot_spell_list[i].manacost; + bot_spell.Priority = bot_spell_list[i].priority; - result.emplace_back(botSpell); + result.emplace_back(bot_spell); } } } @@ -1097,29 +1096,29 @@ std::vector Bot::GetPrioritizedBotSpellsBySpellType(Bot* bot return result; } -BotSpell Bot::GetFirstBotSpellBySpellType(Bot* botCaster, uint16 spellType) { +BotSpell Bot::GetFirstBotSpellBySpellType(Bot* caster, uint16 spell_type) { BotSpell result; result.SpellId = 0; result.SpellIndex = 0; result.ManaCost = 0; - if (botCaster && botCaster->AI_HasSpells()) { - std::vector botSpellList = botCaster->BotGetSpellsByType(spellType); + if (caster && caster->AI_HasSpells()) { + std::vector bot_spell_list = caster->BotGetSpellsByType(spell_type); - for (int i = botSpellList.size() - 1; i >= 0; i--) { - if (!IsValidSpellAndLoS(botSpellList[i].spellid, botCaster->HasLoS())) { + for (int i = bot_spell_list.size() - 1; i >= 0; i--) { + if (!IsValidSpellAndLoS(bot_spell_list[i].spellid, caster->HasLoS())) { continue; } if ( - botCaster->CheckSpellRecastTimer(botSpellList[i].spellid) && - (botSpellList[i].type == spellType || botSpellList[i].type == botCaster->GetParentSpellType(spellType)) && - botCaster->IsValidSpellTypeBySpellID(spellType, botSpellList[i].spellid) + caster->CheckSpellRecastTimer(bot_spell_list[i].spellid) && + (bot_spell_list[i].type == spell_type || bot_spell_list[i].type == caster->GetParentSpellType(spell_type)) && + caster->IsValidSpellTypeBySpellID(spell_type, bot_spell_list[i].spellid) ) { - result.SpellId = botSpellList[i].spellid; - result.SpellIndex = botSpellList[i].index; - result.ManaCost = botSpellList[i].manacost; + result.SpellId = bot_spell_list[i].spellid; + result.SpellIndex = bot_spell_list[i].index; + result.ManaCost = bot_spell_list[i].manacost; break; } @@ -1129,23 +1128,23 @@ BotSpell Bot::GetFirstBotSpellBySpellType(Bot* botCaster, uint16 spellType) { return result; } -BotSpell Bot::GetBestBotSpellForVeryFastHeal(Bot* botCaster, Mob* tar, uint16 spellType) { +BotSpell Bot::GetBestBotSpellForVeryFastHeal(Bot* caster, Mob* tar, uint16 spell_type) { BotSpell result; result.SpellId = 0; result.SpellIndex = 0; result.ManaCost = 0; - if (botCaster) { - std::list botSpellList = GetBotSpellsForSpellEffect(botCaster, spellType, SE_CurrentHP); + if (caster) { + std::list bot_spell_list = GetBotSpellsForSpellEffect(caster, spell_type, SE_CurrentHP); - for (auto botSpellListItr : botSpellList) { + for (auto bot_spell_list_itr : bot_spell_list) { // Assuming all the spells have been loaded into this list by level and in descending order if ( - IsVeryFastHealSpell(botSpellListItr.SpellId) && botCaster->CastChecks(botSpellListItr.SpellId, tar, spellType)) { - result.SpellId = botSpellListItr.SpellId; - result.SpellIndex = botSpellListItr.SpellIndex; - result.ManaCost = botSpellListItr.ManaCost; + IsVeryFastHealSpell(bot_spell_list_itr.SpellId) && caster->CastChecks(bot_spell_list_itr.SpellId, tar, spell_type)) { + result.SpellId = bot_spell_list_itr.SpellId; + result.SpellIndex = bot_spell_list_itr.SpellIndex; + result.ManaCost = bot_spell_list_itr.ManaCost; break; } @@ -1155,22 +1154,22 @@ BotSpell Bot::GetBestBotSpellForVeryFastHeal(Bot* botCaster, Mob* tar, uint16 sp return result; } -BotSpell Bot::GetBestBotSpellForFastHeal(Bot *botCaster, Mob* tar, uint16 spellType) { +BotSpell Bot::GetBestBotSpellForFastHeal(Bot* caster, Mob* tar, uint16 spell_type) { BotSpell result; result.SpellId = 0; result.SpellIndex = 0; result.ManaCost = 0; - if (botCaster) { - std::list botSpellList = GetBotSpellsForSpellEffect(botCaster, spellType, SE_CurrentHP); + if (caster) { + std::list bot_spell_list = GetBotSpellsForSpellEffect(caster, spell_type, SE_CurrentHP); - for (auto botSpellListItr : botSpellList) { + for (auto bot_spell_list_itr : bot_spell_list) { // Assuming all the spells have been loaded into this list by level and in descending order - if (IsFastHealSpell(botSpellListItr.SpellId) && botCaster->CastChecks(botSpellListItr.SpellId, tar, spellType)) { - result.SpellId = botSpellListItr.SpellId; - result.SpellIndex = botSpellListItr.SpellIndex; - result.ManaCost = botSpellListItr.ManaCost; + if (IsFastHealSpell(bot_spell_list_itr.SpellId) && caster->CastChecks(bot_spell_list_itr.SpellId, tar, spell_type)) { + result.SpellId = bot_spell_list_itr.SpellId; + result.SpellIndex = bot_spell_list_itr.SpellIndex; + result.ManaCost = bot_spell_list_itr.ManaCost; break; } @@ -1180,22 +1179,22 @@ BotSpell Bot::GetBestBotSpellForFastHeal(Bot *botCaster, Mob* tar, uint16 spellT return result; } -BotSpell Bot::GetBestBotSpellForHealOverTime(Bot* botCaster, Mob* tar, uint16 spellType) { +BotSpell Bot::GetBestBotSpellForHealOverTime(Bot* caster, Mob* tar, uint16 spell_type) { BotSpell result; result.SpellId = 0; result.SpellIndex = 0; result.ManaCost = 0; - if (botCaster) { - std::list botSpellList = GetBotSpellsForSpellEffect(botCaster, spellType, SE_HealOverTime); + if (caster) { + std::list bot_spell_list = GetBotSpellsForSpellEffect(caster, spell_type, SE_HealOverTime); - for (auto botSpellListItr : botSpellList) { + for (auto bot_spell_list_itr : bot_spell_list) { // Assuming all the spells have been loaded into this list by level and in descending order - if (IsHealOverTimeSpell(botSpellListItr.SpellId) && botCaster->CastChecks(botSpellListItr.SpellId, tar, spellType)) { - result.SpellId = botSpellListItr.SpellId; - result.SpellIndex = botSpellListItr.SpellIndex; - result.ManaCost = botSpellListItr.ManaCost; + if (IsHealOverTimeSpell(bot_spell_list_itr.SpellId) && caster->CastChecks(bot_spell_list_itr.SpellId, tar, spell_type)) { + result.SpellId = bot_spell_list_itr.SpellId; + result.SpellIndex = bot_spell_list_itr.SpellIndex; + result.ManaCost = bot_spell_list_itr.ManaCost; break; } @@ -1205,29 +1204,29 @@ BotSpell Bot::GetBestBotSpellForHealOverTime(Bot* botCaster, Mob* tar, uint16 sp return result; } -BotSpell Bot::GetBestBotSpellForPercentageHeal(Bot *botCaster, Mob* tar, uint16 spellType) { +BotSpell Bot::GetBestBotSpellForPercentageHeal(Bot* caster, Mob* tar, uint16 spell_type) { BotSpell result; result.SpellId = 0; result.SpellIndex = 0; result.ManaCost = 0; - if (botCaster && botCaster->AI_HasSpells()) { - std::vector botSpellList = botCaster->BotGetSpellsByType(spellType); - for (int i = botSpellList.size() - 1; i >= 0; i--) { - if (!IsValidSpell(botSpellList[i].spellid)) { + if (caster && caster->AI_HasSpells()) { + std::vector bot_spell_list = caster->BotGetSpellsByType(spell_type); + for (int i = bot_spell_list.size() - 1; i >= 0; i--) { + if (!IsValidSpell(bot_spell_list[i].spellid)) { continue; } if ( - (botSpellList[i].type == spellType || botSpellList[i].type == botCaster->GetParentSpellType(spellType)) && - botCaster->IsValidSpellTypeBySpellID(spellType, botSpellList[i].spellid) && - IsCompleteHealSpell(botSpellList[i].spellid) && - botCaster->CastChecks(botSpellList[i].spellid, tar, spellType) + (bot_spell_list[i].type == spell_type || bot_spell_list[i].type == caster->GetParentSpellType(spell_type)) && + caster->IsValidSpellTypeBySpellID(spell_type, bot_spell_list[i].spellid) && + IsCompleteHealSpell(bot_spell_list[i].spellid) && + caster->CastChecks(bot_spell_list[i].spellid, tar, spell_type) ) { - result.SpellId = botSpellList[i].spellid; - result.SpellIndex = botSpellList[i].index; - result.ManaCost = botSpellList[i].manacost; + result.SpellId = bot_spell_list[i].spellid; + result.SpellIndex = bot_spell_list[i].index; + result.ManaCost = bot_spell_list[i].manacost; break; } @@ -1237,22 +1236,22 @@ BotSpell Bot::GetBestBotSpellForPercentageHeal(Bot *botCaster, Mob* tar, uint16 return result; } -BotSpell Bot::GetBestBotSpellForRegularSingleTargetHeal(Bot* botCaster, Mob* tar, uint16 spellType) { +BotSpell Bot::GetBestBotSpellForRegularSingleTargetHeal(Bot* caster, Mob* tar, uint16 spell_type) { BotSpell result; result.SpellId = 0; result.SpellIndex = 0; result.ManaCost = 0; - if (botCaster) { - std::list botSpellList = GetBotSpellsForSpellEffect(botCaster, spellType, SE_CurrentHP); + if (caster) { + std::list bot_spell_list = GetBotSpellsForSpellEffect(caster, spell_type, SE_CurrentHP); - for (std::list::iterator botSpellListItr = botSpellList.begin(); botSpellListItr != botSpellList.end(); ++botSpellListItr) { + for (std::list::iterator bot_spell_list_itr = bot_spell_list.begin(); bot_spell_list_itr != bot_spell_list.end(); ++bot_spell_list_itr) { // Assuming all the spells have been loaded into this list by level and in descending order - if (IsRegularSingleTargetHealSpell(botSpellListItr->SpellId) && botCaster->CastChecks(botSpellListItr->SpellId, tar, spellType)) { - result.SpellId = botSpellListItr->SpellId; - result.SpellIndex = botSpellListItr->SpellIndex; - result.ManaCost = botSpellListItr->ManaCost; + if (IsRegularSingleTargetHealSpell(bot_spell_list_itr->SpellId) && caster->CastChecks(bot_spell_list_itr->SpellId, tar, spell_type)) { + result.SpellId = bot_spell_list_itr->SpellId; + result.SpellIndex = bot_spell_list_itr->SpellIndex; + result.ManaCost = bot_spell_list_itr->ManaCost; break; } @@ -1262,22 +1261,22 @@ BotSpell Bot::GetBestBotSpellForRegularSingleTargetHeal(Bot* botCaster, Mob* tar return result; } -BotSpell Bot::GetFirstBotSpellForSingleTargetHeal(Bot* botCaster, Mob* tar, uint16 spellType) { +BotSpell Bot::GetFirstBotSpellForSingleTargetHeal(Bot* caster, Mob* tar, uint16 spell_type) { BotSpell result; result.SpellId = 0; result.SpellIndex = 0; result.ManaCost = 0; - if (botCaster) { - std::list botSpellList = GetBotSpellsForSpellEffect(botCaster, spellType, SE_CurrentHP); + if (caster) { + std::list bot_spell_list = GetBotSpellsForSpellEffect(caster, spell_type, SE_CurrentHP); - for (std::list::iterator botSpellListItr = botSpellList.begin(); botSpellListItr != botSpellList.end(); ++botSpellListItr) { + for (std::list::iterator bot_spell_list_itr = bot_spell_list.begin(); bot_spell_list_itr != bot_spell_list.end(); ++bot_spell_list_itr) { // Assuming all the spells have been loaded into this list by level and in descending order - if (IsRegularSingleTargetHealSpell(botSpellListItr->SpellId) && botCaster->CastChecks(botSpellListItr->SpellId, tar, spellType)) { - result.SpellId = botSpellListItr->SpellId; - result.SpellIndex = botSpellListItr->SpellIndex; - result.ManaCost = botSpellListItr->ManaCost; + if (IsRegularSingleTargetHealSpell(bot_spell_list_itr->SpellId) && caster->CastChecks(bot_spell_list_itr->SpellId, tar, spell_type)) { + result.SpellId = bot_spell_list_itr->SpellId; + result.SpellIndex = bot_spell_list_itr->SpellIndex; + result.ManaCost = bot_spell_list_itr->ManaCost; break; } @@ -1287,38 +1286,38 @@ BotSpell Bot::GetFirstBotSpellForSingleTargetHeal(Bot* botCaster, Mob* tar, uint return result; } -BotSpell Bot::GetBestBotSpellForGroupHeal(Bot* botCaster, Mob* tar, uint16 spellType) { +BotSpell Bot::GetBestBotSpellForGroupHeal(Bot* caster, Mob* tar, uint16 spell_type) { BotSpell result; result.SpellId = 0; result.SpellIndex = 0; result.ManaCost = 0; - if (botCaster) { - std::list botSpellList = GetBotSpellsForSpellEffect(botCaster, spellType, SE_CurrentHP); + if (caster) { + std::list bot_spell_list = GetBotSpellsForSpellEffect(caster, spell_type, SE_CurrentHP); - int targetCount = 0; + int target_count = 0; - for (std::list::iterator botSpellListItr = botSpellList.begin(); botSpellListItr != botSpellList.end(); ++botSpellListItr) { + for (std::list::iterator bot_spell_list_itr = bot_spell_list.begin(); bot_spell_list_itr != bot_spell_list.end(); ++bot_spell_list_itr) { // Assuming all the spells have been loaded into this list by level and in descending order - if (IsRegularGroupHealSpell(botSpellListItr->SpellId)) { - if (!botCaster->IsCommandedSpell()) { - targetCount = 0; + if (IsRegularGroupHealSpell(bot_spell_list_itr->SpellId)) { + if (!caster->IsCommandedSpell()) { + target_count = 0; - for (Mob* m : botCaster->GetSpellTargetList()) { - if (botCaster->IsValidSpellRange(botSpellListItr->SpellId, m) && botCaster->CastChecks(botSpellListItr->SpellId, m, spellType, true, IsGroupBotSpellType(spellType))) { - ++targetCount; + for (Mob* m : caster->GetSpellTargetList()) { + if (caster->IsValidSpellRange(bot_spell_list_itr->SpellId, m) && caster->CastChecks(bot_spell_list_itr->SpellId, m, spell_type, true, IsGroupBotSpellType(spell_type))) { + ++target_count; } } - if (targetCount < botCaster->GetSpellTypeAEOrGroupTargetCount(spellType)) { + if (target_count < caster->GetSpellTypeAEOrGroupTargetCount(spell_type)) { continue; } } - result.SpellId = botSpellListItr->SpellId; - result.SpellIndex = botSpellListItr->SpellIndex; - result.ManaCost = botSpellListItr->ManaCost; + result.SpellId = bot_spell_list_itr->SpellId; + result.SpellIndex = bot_spell_list_itr->SpellIndex; + result.ManaCost = bot_spell_list_itr->ManaCost; break; } @@ -1328,38 +1327,38 @@ BotSpell Bot::GetBestBotSpellForGroupHeal(Bot* botCaster, Mob* tar, uint16 spell return result; } -BotSpell Bot::GetBestBotSpellForGroupHealOverTime(Bot* botCaster, Mob* tar, uint16 spellType) { +BotSpell Bot::GetBestBotSpellForGroupHealOverTime(Bot* caster, Mob* tar, uint16 spell_type) { BotSpell result; result.SpellId = 0; result.SpellIndex = 0; result.ManaCost = 0; - if (botCaster) { - std::list botSpellList = GetBotSpellsForSpellEffect(botCaster, spellType, SE_HealOverTime); + if (caster) { + std::list bot_spell_list = GetBotSpellsForSpellEffect(caster, spell_type, SE_HealOverTime); - int targetCount = 0; + int target_count = 0; - for (std::list::iterator botSpellListItr = botSpellList.begin(); botSpellListItr != botSpellList.end(); ++botSpellListItr) { + for (std::list::iterator bot_spell_list_itr = bot_spell_list.begin(); bot_spell_list_itr != bot_spell_list.end(); ++bot_spell_list_itr) { // Assuming all the spells have been loaded into this list by level and in descending order - if (IsGroupHealOverTimeSpell(botSpellListItr->SpellId)) { - if (!botCaster->IsCommandedSpell()) { - targetCount = 0; + if (IsGroupHealOverTimeSpell(bot_spell_list_itr->SpellId)) { + if (!caster->IsCommandedSpell()) { + target_count = 0; - for (Mob* m : botCaster->GetSpellTargetList()) { - if (botCaster->IsValidSpellRange(botSpellListItr->SpellId, m) && botCaster->CastChecks(botSpellListItr->SpellId, m, spellType, true, IsGroupBotSpellType(spellType))) { - ++targetCount; + for (Mob* m : caster->GetSpellTargetList()) { + if (caster->IsValidSpellRange(bot_spell_list_itr->SpellId, m) && caster->CastChecks(bot_spell_list_itr->SpellId, m, spell_type, true, IsGroupBotSpellType(spell_type))) { + ++target_count; } } - if (targetCount < botCaster->GetSpellTypeAEOrGroupTargetCount(spellType)) { + if (target_count < caster->GetSpellTypeAEOrGroupTargetCount(spell_type)) { continue; } } - result.SpellId = botSpellListItr->SpellId; - result.SpellIndex = botSpellListItr->SpellIndex; - result.ManaCost = botSpellListItr->ManaCost; + result.SpellId = bot_spell_list_itr->SpellId; + result.SpellIndex = bot_spell_list_itr->SpellIndex; + result.ManaCost = bot_spell_list_itr->ManaCost; break; } @@ -1369,38 +1368,38 @@ BotSpell Bot::GetBestBotSpellForGroupHealOverTime(Bot* botCaster, Mob* tar, uint return result; } -BotSpell Bot::GetBestBotSpellForGroupCompleteHeal(Bot* botCaster, Mob* tar, uint16 spellType) { +BotSpell Bot::GetBestBotSpellForGroupCompleteHeal(Bot* caster, Mob* tar, uint16 spell_type) { BotSpell result; result.SpellId = 0; result.SpellIndex = 0; result.ManaCost = 0; - if (botCaster) { - std::list botSpellList = GetBotSpellsForSpellEffect(botCaster, spellType, SE_CompleteHeal); + if (caster) { + std::list bot_spell_list = GetBotSpellsForSpellEffect(caster, spell_type, SE_CompleteHeal); - int targetCount = 0; + int target_count = 0; - for(std::list::iterator botSpellListItr = botSpellList.begin(); botSpellListItr != botSpellList.end(); ++botSpellListItr) { + for(std::list::iterator bot_spell_list_itr = bot_spell_list.begin(); bot_spell_list_itr != bot_spell_list.end(); ++bot_spell_list_itr) { // Assuming all the spells have been loaded into this list by level and in descending order - if (IsGroupCompleteHealSpell(botSpellListItr->SpellId)) { - if (!botCaster->IsCommandedSpell()) { - targetCount = 0; + if (IsGroupCompleteHealSpell(bot_spell_list_itr->SpellId)) { + if (!caster->IsCommandedSpell()) { + target_count = 0; - for (Mob* m : botCaster->GetSpellTargetList()) { - if (botCaster->IsValidSpellRange(botSpellListItr->SpellId, m) && botCaster->CastChecks(botSpellListItr->SpellId, m, spellType, true, IsGroupBotSpellType(spellType))) { - ++targetCount; + for (Mob* m : caster->GetSpellTargetList()) { + if (caster->IsValidSpellRange(bot_spell_list_itr->SpellId, m) && caster->CastChecks(bot_spell_list_itr->SpellId, m, spell_type, true, IsGroupBotSpellType(spell_type))) { + ++target_count; } } - if (targetCount < botCaster->GetSpellTypeAEOrGroupTargetCount(spellType)) { + if (target_count < caster->GetSpellTypeAEOrGroupTargetCount(spell_type)) { continue; } } - result.SpellId = botSpellListItr->SpellId; - result.SpellIndex = botSpellListItr->SpellIndex; - result.ManaCost = botSpellListItr->ManaCost; + result.SpellId = bot_spell_list_itr->SpellId; + result.SpellIndex = bot_spell_list_itr->SpellIndex; + result.ManaCost = bot_spell_list_itr->ManaCost; break; } @@ -1410,25 +1409,25 @@ BotSpell Bot::GetBestBotSpellForGroupCompleteHeal(Bot* botCaster, Mob* tar, uint return result; } -BotSpell Bot::GetBestBotSpellForMez(Bot* botCaster, uint16 spellType) { +BotSpell Bot::GetBestBotSpellForMez(Bot* caster, uint16 spell_type) { BotSpell result; result.SpellId = 0; result.SpellIndex = 0; result.ManaCost = 0; - if (botCaster) { - std::list botSpellList = GetBotSpellsForSpellEffect(botCaster, spellType, SE_Mez); + if (caster) { + std::list bot_spell_list = GetBotSpellsForSpellEffect(caster, spell_type, SE_Mez); - for (std::list::iterator botSpellListItr = botSpellList.begin(); botSpellListItr != botSpellList.end(); ++botSpellListItr) { + for (std::list::iterator bot_spell_list_itr = bot_spell_list.begin(); bot_spell_list_itr != bot_spell_list.end(); ++bot_spell_list_itr) { // Assuming all the spells have been loaded into this list by level and in descending order if ( - IsMesmerizeSpell(botSpellListItr->SpellId) && - botCaster->CheckSpellRecastTimer(botSpellListItr->SpellId) + IsMesmerizeSpell(bot_spell_list_itr->SpellId) && + caster->CheckSpellRecastTimer(bot_spell_list_itr->SpellId) ) { - result.SpellId = botSpellListItr->SpellId; - result.SpellIndex = botSpellListItr->SpellIndex; - result.ManaCost = botSpellListItr->ManaCost; + result.SpellId = bot_spell_list_itr->SpellId; + result.SpellIndex = bot_spell_list_itr->SpellIndex; + result.ManaCost = bot_spell_list_itr->ManaCost; break; } @@ -1438,15 +1437,15 @@ BotSpell Bot::GetBestBotSpellForMez(Bot* botCaster, uint16 spellType) { return result; } -Mob* Bot::GetFirstIncomingMobToMez(Bot* botCaster, int16 spell_id, uint16 spellType, bool AE) { +Mob* Bot::GetFirstIncomingMobToMez(Bot* caster, int16 spell_id, uint16 spell_type, bool AE) { Mob* result = nullptr; - if (botCaster && botCaster->GetOwner()) { - int spellRange = (!AE ? botCaster->GetActSpellRange(spell_id, spells[spell_id].range) : botCaster->GetActSpellRange(spell_id, spells[spell_id].aoe_range)); + if (caster && caster->GetOwner()) { + int spell_range = (!AE ? caster->GetActSpellRange(spell_id, spells[spell_id].range) : caster->GetActSpellRange(spell_id, spells[spell_id].aoe_range)); int buff_count = 0; NPC* npc = nullptr; - for (auto& close_mob : botCaster->m_close_mobs) { + for (auto& close_mob : caster->m_close_mobs) { buff_count = 0; npc = close_mob.second->CastToNPC(); @@ -1454,66 +1453,66 @@ Mob* Bot::GetFirstIncomingMobToMez(Bot* botCaster, int16 spell_id, uint16 spellT continue; } - if (!botCaster->IsValidMezTarget(botCaster->GetOwner(), npc, spell_id)) { + if (!caster->IsValidMezTarget(caster->GetOwner(), npc, spell_id)) { continue; } if (AE) { - int targetCount = 0; + int target_count = 0; - for (auto& close_mob : botCaster->m_close_mobs) { + for (auto& close_mob : caster->m_close_mobs) { Mob* m = close_mob.second; if (npc == m) { continue; } - if (!botCaster->IsValidMezTarget(botCaster->GetOwner(), m, spell_id)) { + if (!caster->IsValidMezTarget(caster->GetOwner(), m, spell_id)) { continue; } if (IsPBAESpell(spell_id)) { - if (spellRange < Distance(botCaster->GetPosition(), m->GetPosition())) { + if (spell_range < Distance(caster->GetPosition(), m->GetPosition())) { continue; } } else { - if (spellRange < Distance(m->GetPosition(), npc->GetPosition())) { + if (spell_range < Distance(m->GetPosition(), npc->GetPosition())) { continue; } } - if (botCaster->CastChecks(spell_id, m, spellType, true, true)) { - ++targetCount; + if (caster->CastChecks(spell_id, m, spell_type, true, true)) { + ++target_count; } - if (targetCount >= botCaster->GetSpellTypeAEOrGroupTargetCount(spellType)) { + if (target_count >= caster->GetSpellTypeAEOrGroupTargetCount(spell_type)) { break; } } - if (targetCount < botCaster->GetSpellTypeAEOrGroupTargetCount(spellType)) { + if (target_count < caster->GetSpellTypeAEOrGroupTargetCount(spell_type)) { continue; } if (zone->random.Int(1, 100) < RuleI(Bots, AEMezChance)) { - botCaster->SetSpellTypeRecastTimer(spellType, RuleI(Bots, MezFailDelay)); + caster->SetSpellTypeRecastTimer(spell_type, RuleI(Bots, MezFailDelay)); return result; } result = npc; } else { - if (spellRange < Distance(botCaster->GetPosition(), npc->GetPosition())) { + if (spell_range < Distance(caster->GetPosition(), npc->GetPosition())) { continue; } - if (!botCaster->CastChecks(spell_id, npc, spellType, true)) { + if (!caster->CastChecks(spell_id, npc, spell_type, true)) { continue; } if (zone->random.Int(1, 100) < RuleI(Bots, MezChance)) { - botCaster->SetSpellTypeRecastTimer(spellType, RuleI(Bots, MezAEFailDelay)); + caster->SetSpellTypeRecastTimer(spell_type, RuleI(Bots, MezAEFailDelay)); return result; } @@ -1522,7 +1521,7 @@ Mob* Bot::GetFirstIncomingMobToMez(Bot* botCaster, int16 spell_id, uint16 spellT } if (result) { - botCaster->SetHasLoS(true); + caster->SetHasLoS(true); return result; } @@ -1532,27 +1531,27 @@ Mob* Bot::GetFirstIncomingMobToMez(Bot* botCaster, int16 spell_id, uint16 spellT return result; } -BotSpell Bot::GetBestBotMagicianPetSpell(Bot *botCaster, uint16 spellType) { +BotSpell Bot::GetBestBotMagicianPetSpell(Bot* caster, uint16 spell_type) { BotSpell result; result.SpellId = 0; result.SpellIndex = 0; result.ManaCost = 0; - if (botCaster) { - std::list botSpellList = GetBotSpellsForSpellEffect(botCaster, spellType, SE_SummonPet); - std::string petType = GetBotMagicianPetType(botCaster); + if (caster) { + std::list bot_spell_list = GetBotSpellsForSpellEffect(caster, spell_type, SE_SummonPet); + std::string pet_type = GetBotMagicianPetType(caster); - for(std::list::iterator botSpellListItr = botSpellList.begin(); botSpellListItr != botSpellList.end(); ++botSpellListItr) { + for(std::list::iterator bot_spell_list_itr = bot_spell_list.begin(); bot_spell_list_itr != bot_spell_list.end(); ++bot_spell_list_itr) { // Assuming all the spells have been loaded into this list by level and in descending order if ( - IsSummonPetSpell(botSpellListItr->SpellId) && - botCaster->CheckSpellRecastTimer(botSpellListItr->SpellId) && - !strncmp(spells[botSpellListItr->SpellId].teleport_zone, petType.c_str(), petType.length()) + IsSummonPetSpell(bot_spell_list_itr->SpellId) && + caster->CheckSpellRecastTimer(bot_spell_list_itr->SpellId) && + !strncmp(spells[bot_spell_list_itr->SpellId].teleport_zone, pet_type.c_str(), pet_type.length()) ) { - result.SpellId = botSpellListItr->SpellId; - result.SpellIndex = botSpellListItr->SpellIndex; - result.ManaCost = botSpellListItr->ManaCost; + result.SpellId = bot_spell_list_itr->SpellId; + result.SpellIndex = bot_spell_list_itr->SpellIndex; + result.ManaCost = bot_spell_list_itr->ManaCost; break; } @@ -1562,36 +1561,36 @@ BotSpell Bot::GetBestBotMagicianPetSpell(Bot *botCaster, uint16 spellType) { return result; } -std::string Bot::GetBotMagicianPetType(Bot* botCaster) { +std::string Bot::GetBotMagicianPetType(Bot* caster) { std::string result; - if (botCaster) { - uint8 petType = botCaster->GetPetChooserID(); - uint8 botLevel = botCaster->GetLevel(); - bool epicAllowed = false; - std::string epicSpellName = RuleS(Bots, EpicPetSpellName); + if (caster) { + uint8 pet_type = caster->GetPetChooserID(); + uint8 bot_level = caster->GetLevel(); + bool epic_allowed = false; + std::string epic_spell_name = RuleS(Bots, EpicPetSpellName); - if (epicSpellName.empty()) { - epicSpellName = "SumMageMultiElement"; + if (epic_spell_name.empty()) { + epic_spell_name = "SumMageMultiElement"; } if (RuleB(Bots, AllowMagicianEpicPet)) { - if (botLevel >= RuleI(Bots, AllowMagicianEpicPetLevel)) { + if (bot_level >= RuleI(Bots, AllowMagicianEpicPetLevel)) { if (!RuleI(Bots, RequiredMagicianEpicPetItemID)) { - epicAllowed = true; + epic_allowed = true; } else { - bool has_item = botCaster->HasBotItem(RuleI(Bots, RequiredMagicianEpicPetItemID)) != INVALID_INDEX; + bool has_item = caster->HasBotItem(RuleI(Bots, RequiredMagicianEpicPetItemID)) != INVALID_INDEX; if (has_item) { - epicAllowed = true; + epic_allowed = true; } } } } - if (petType > 0) { - switch (petType) { + if (pet_type > 0) { + switch (pet_type) { case SumWater: result = std::string("SumWater"); break; @@ -1608,25 +1607,25 @@ std::string Bot::GetBotMagicianPetType(Bot* botCaster) { result = std::string("MonsterSum"); break; case SumMageMultiElement: - if (epicAllowed) { - result = epicSpellName; + if (epic_allowed) { + result = epic_spell_name; } else { - botCaster->SetPetChooserID(0); + caster->SetPetChooserID(0); } break; } } else { - uint8 airMinLevel = 255; - uint8 fireMinLevel = 255; - uint8 waterMinLevel = 255; - uint8 earthMinLevel = 255; - uint8 monsterMinLevel = 255; - uint8 epicMinLevel = 255; - std::list botSpellList = botCaster->GetBotSpellsBySpellType(botCaster, BotSpellTypes::Pet); + uint8 air_min_level = 255; + uint8 fire_min_level = 255; + uint8 water_min_level = 255; + uint8 earth_min_level = 255; + uint8 monster_min_level = 255; + uint8 epic_min_level = 255; + std::list bot_spell_list = caster->GetBotSpellsBySpellType(caster, BotSpellTypes::Pet); - for (const auto& s : botSpellList) { + for (const auto& s : bot_spell_list) { if (!IsValidSpell(s.SpellId)) { continue; } @@ -1637,31 +1636,31 @@ std::string Bot::GetBotMagicianPetType(Bot* botCaster) { auto spell = spells[s.SpellId]; - if (!strncmp(spell.teleport_zone, "SumWater", 8) && spell.classes[Class::Magician - 1] < waterMinLevel) { - waterMinLevel = spell.classes[Class::Magician - 1]; + if (!strncmp(spell.teleport_zone, "SumWater", 8) && spell.classes[Class::Magician - 1] < water_min_level) { + water_min_level = spell.classes[Class::Magician - 1]; } - else if (!strncmp(spell.teleport_zone, "SumFire", 7) && spell.classes[Class::Magician - 1] < fireMinLevel) { - fireMinLevel = spell.classes[Class::Magician - 1]; + else if (!strncmp(spell.teleport_zone, "SumFire", 7) && spell.classes[Class::Magician - 1] < fire_min_level) { + fire_min_level = spell.classes[Class::Magician - 1]; } - else if (!strncmp(spell.teleport_zone, "SumAir", 6) && spell.classes[Class::Magician - 1] < airMinLevel) { - airMinLevel = spell.classes[Class::Magician - 1]; + else if (!strncmp(spell.teleport_zone, "SumAir", 6) && spell.classes[Class::Magician - 1] < air_min_level) { + air_min_level = spell.classes[Class::Magician - 1]; } - else if (!strncmp(spell.teleport_zone, "SumEarth", 8) && spell.classes[Class::Magician - 1] < earthMinLevel) { - earthMinLevel = spell.classes[Class::Magician - 1]; + else if (!strncmp(spell.teleport_zone, "SumEarth", 8) && spell.classes[Class::Magician - 1] < earth_min_level) { + earth_min_level = spell.classes[Class::Magician - 1]; } - else if (!strncmp(spell.teleport_zone, "MonsterSum", 10) && spell.classes[Class::Magician - 1] < monsterMinLevel) { - monsterMinLevel = spell.classes[Class::Magician - 1]; + else if (!strncmp(spell.teleport_zone, "MonsterSum", 10) && spell.classes[Class::Magician - 1] < monster_min_level) { + monster_min_level = spell.classes[Class::Magician - 1]; } - else if (!strncmp(spell.teleport_zone, epicSpellName.c_str(), epicSpellName.length()) && spell.classes[Class::Magician - 1] < epicMinLevel) { - epicMinLevel = spell.classes[Class::Magician - 1]; + else if (!strncmp(spell.teleport_zone, epic_spell_name.c_str(), epic_spell_name.length()) && spell.classes[Class::Magician - 1] < epic_min_level) { + epic_min_level = spell.classes[Class::Magician - 1]; } } - if (epicAllowed) { - epicMinLevel = std::max(int(epicMinLevel), RuleI(Bots, AllowMagicianEpicPetLevel)); + if (epic_allowed) { + epic_min_level = std::max(int(epic_min_level), RuleI(Bots, AllowMagicianEpicPetLevel)); - if (botLevel >= epicMinLevel) { - result = epicSpellName; + if (bot_level >= epic_min_level) { + result = epic_spell_name; } } else { @@ -1673,28 +1672,28 @@ std::string Bot::GetBotMagicianPetType(Bot* botCaster) { switch (counter) { case SumWater: - if (botLevel >= waterMinLevel) { + if (bot_level >= water_min_level) { result = std::string("SumWater"); } found = true; break; case SumFire: - if (botLevel >= fireMinLevel) { + if (bot_level >= fire_min_level) { result = std::string("SumFire"); } found = true; break; case SumAir: - if (botLevel >= airMinLevel) { + if (bot_level >= air_min_level) { result = std::string("SumAir"); } found = true; break; case SumEarth: - if (botLevel >= earthMinLevel) { + if (bot_level >= earth_min_level) { result = std::string("SumEarth"); } @@ -1711,7 +1710,7 @@ std::string Bot::GetBotMagicianPetType(Bot* botCaster) { return result; } -BotSpell Bot::GetBestBotSpellForNukeByTargetType(Bot* botCaster, SpellTargetType targetType, uint16 spellType, bool AE, Mob* tar) { +BotSpell Bot::GetBestBotSpellForNukeByTargetType(Bot* caster, SpellTargetType target_type, uint16 spell_type, bool AE, Mob* tar) { BotSpell result; result.SpellId = 0; @@ -1719,35 +1718,35 @@ BotSpell Bot::GetBestBotSpellForNukeByTargetType(Bot* botCaster, SpellTargetType result.ManaCost = 0; if (tar == nullptr) { - tar = botCaster->GetTarget(); + tar = caster->GetTarget(); } - if (botCaster) { - std::list botSpellList = GetBotSpellsForSpellEffectAndTargetType(botCaster, spellType, SE_CurrentHP, targetType); + if (caster) { + std::list bot_spell_list = GetBotSpellsForSpellEffectAndTargetType(caster, spell_type, SE_CurrentHP, target_type); - for(std::list::iterator botSpellListItr = botSpellList.begin(); botSpellListItr != botSpellList.end(); ++botSpellListItr) { + for(std::list::iterator bot_spell_list_itr = bot_spell_list.begin(); bot_spell_list_itr != bot_spell_list.end(); ++bot_spell_list_itr) { // Assuming all the spells have been loaded into this list by level and in descending order - if (IsPureNukeSpell(botSpellListItr->SpellId) || IsDamageSpell(botSpellListItr->SpellId)) { - if (!AE && IsAnyAESpell(botSpellListItr->SpellId) && !IsGroupSpell(botSpellListItr->SpellId)) { + if (IsPureNukeSpell(bot_spell_list_itr->SpellId) || IsDamageSpell(bot_spell_list_itr->SpellId)) { + if (!AE && IsAnyAESpell(bot_spell_list_itr->SpellId) && !IsGroupSpell(bot_spell_list_itr->SpellId)) { continue; } - else if (AE && !IsAnyAESpell(botSpellListItr->SpellId)) { + else if (AE && !IsAnyAESpell(bot_spell_list_itr->SpellId)) { continue; } - if (!IsPBAESpell(botSpellListItr->SpellId) && !botCaster->CastChecks(botSpellListItr->SpellId, tar, spellType, false, IsAEBotSpellType(spellType))) { + if (!IsPBAESpell(bot_spell_list_itr->SpellId) && !caster->CastChecks(bot_spell_list_itr->SpellId, tar, spell_type, false, IsAEBotSpellType(spell_type))) { continue; } if ( - botCaster->IsCommandedSpell() || + caster->IsCommandedSpell() || !AE || - (AE && botCaster->HasValidAETarget(botCaster, botSpellListItr->SpellId, spellType, tar)) + (AE && caster->HasValidAETarget(caster, bot_spell_list_itr->SpellId, spell_type, tar)) ) { - result.SpellId = botSpellListItr->SpellId; - result.SpellIndex = botSpellListItr->SpellIndex; - result.ManaCost = botSpellListItr->ManaCost; + result.SpellId = bot_spell_list_itr->SpellId; + result.SpellIndex = bot_spell_list_itr->SpellIndex; + result.ManaCost = bot_spell_list_itr->ManaCost; break; } @@ -1758,7 +1757,7 @@ BotSpell Bot::GetBestBotSpellForNukeByTargetType(Bot* botCaster, SpellTargetType return result; } -BotSpell Bot::GetBestBotSpellForStunByTargetType(Bot* botCaster, SpellTargetType targetType, uint16 spellType, bool AE, Mob* tar) +BotSpell Bot::GetBestBotSpellForStunByTargetType(Bot* caster, SpellTargetType target_type, uint16 spell_type, bool AE, Mob* tar) { BotSpell result; @@ -1767,36 +1766,36 @@ BotSpell Bot::GetBestBotSpellForStunByTargetType(Bot* botCaster, SpellTargetType result.ManaCost = 0; if (tar == nullptr) { - tar = botCaster->GetTarget(); + tar = caster->GetTarget(); } - if (botCaster) + if (caster) { - std::list botSpellList = GetBotSpellsForSpellEffectAndTargetType(botCaster, spellType, SE_Stun, targetType); + std::list bot_spell_list = GetBotSpellsForSpellEffectAndTargetType(caster, spell_type, SE_Stun, target_type); - for(std::list::iterator botSpellListItr = botSpellList.begin(); botSpellListItr != botSpellList.end(); ++botSpellListItr) + for(std::list::iterator bot_spell_list_itr = bot_spell_list.begin(); bot_spell_list_itr != bot_spell_list.end(); ++bot_spell_list_itr) { // Assuming all the spells have been loaded into this list by level and in descending order - if (IsStunSpell(botSpellListItr->SpellId)) { - if (!AE && IsAnyAESpell(botSpellListItr->SpellId) && !IsGroupSpell(botSpellListItr->SpellId)) { + if (IsStunSpell(bot_spell_list_itr->SpellId)) { + if (!AE && IsAnyAESpell(bot_spell_list_itr->SpellId) && !IsGroupSpell(bot_spell_list_itr->SpellId)) { continue; } - else if (AE && !IsAnyAESpell(botSpellListItr->SpellId)) { + else if (AE && !IsAnyAESpell(bot_spell_list_itr->SpellId)) { continue; } - if (!IsPBAESpell(botSpellListItr->SpellId) && !botCaster->CastChecks(botSpellListItr->SpellId, tar, spellType, false, IsAEBotSpellType(spellType))) { + if (!IsPBAESpell(bot_spell_list_itr->SpellId) && !caster->CastChecks(bot_spell_list_itr->SpellId, tar, spell_type, false, IsAEBotSpellType(spell_type))) { continue; } if ( - botCaster->IsCommandedSpell() || + caster->IsCommandedSpell() || !AE || - (AE && botCaster->HasValidAETarget(botCaster, botSpellListItr->SpellId, spellType, tar)) + (AE && caster->HasValidAETarget(caster, bot_spell_list_itr->SpellId, spell_type, tar)) ) { - result.SpellId = botSpellListItr->SpellId; - result.SpellIndex = botSpellListItr->SpellIndex; - result.ManaCost = botSpellListItr->ManaCost; + result.SpellId = bot_spell_list_itr->SpellId; + result.SpellIndex = bot_spell_list_itr->SpellIndex; + result.ManaCost = bot_spell_list_itr->ManaCost; break; } @@ -1807,107 +1806,107 @@ BotSpell Bot::GetBestBotSpellForStunByTargetType(Bot* botCaster, SpellTargetType return result; } -BotSpell Bot::GetBestBotWizardNukeSpellByTargetResists(Bot* botCaster, Mob* target, uint16 spellType) { +BotSpell Bot::GetBestBotWizardNukeSpellByTargetResists(Bot* caster, Mob* target, uint16 spell_type) { BotSpell result; result.SpellId = 0; result.SpellIndex = 0; result.ManaCost = 0; - if (botCaster && target) { + if (caster && target) { - const int lureResisValue = -100; + const int lure_resis_value = -100; - int32 level_mod = (target->GetLevel() - botCaster->GetLevel()) * (target->GetLevel() - botCaster->GetLevel()) / 2; + int32 level_mod = (target->GetLevel() - caster->GetLevel()) * (target->GetLevel() - caster->GetLevel()) / 2; - if (target->GetLevel() - botCaster->GetLevel() < 0) { + if (target->GetLevel() - caster->GetLevel() < 0) { level_mod = -level_mod; } - const int maxTargetResistValue = botCaster->GetSpellTypeResistLimit(spellType); - bool selectLureNuke = false; + const int max_target_resist_value = caster->GetSpellTypeResistLimit(spell_type); + bool select_lure_nuke = false; - if (((target->GetMR() + level_mod) > maxTargetResistValue) && ((target->GetCR() + level_mod) > maxTargetResistValue) && ((target->GetFR() + level_mod) > maxTargetResistValue)) { - selectLureNuke = true; + if (((target->GetMR() + level_mod) > max_target_resist_value) && ((target->GetCR() + level_mod) > max_target_resist_value) && ((target->GetFR() + level_mod) > max_target_resist_value)) { + select_lure_nuke = true; } - std::list botSpellList = GetBotSpellsForSpellEffectAndTargetType(botCaster, spellType, SE_CurrentHP, ST_Target); + std::list bot_spell_list = GetBotSpellsForSpellEffectAndTargetType(caster, spell_type, SE_CurrentHP, ST_Target); - BotSpell firstWizardMagicNukeSpellFound; - firstWizardMagicNukeSpellFound.SpellId = 0; - firstWizardMagicNukeSpellFound.SpellIndex = 0; - firstWizardMagicNukeSpellFound.ManaCost = 0; - bool spellSelected = false; + BotSpell first_wizard_magic_nuke_spell_found; + first_wizard_magic_nuke_spell_found.SpellId = 0; + first_wizard_magic_nuke_spell_found.SpellIndex = 0; + first_wizard_magic_nuke_spell_found.ManaCost = 0; + bool spell_selected = false; - for (std::list::iterator botSpellListItr = botSpellList.begin(); botSpellListItr != botSpellList.end(); ++botSpellListItr) { + for (std::list::iterator bot_spell_list_itr = bot_spell_list.begin(); bot_spell_list_itr != bot_spell_list.end(); ++bot_spell_list_itr) { // Assuming all the spells have been loaded into this list by level and in descending order - if (!botCaster->IsValidSpellRange(botSpellListItr->SpellId, target)) { + if (!caster->IsValidSpellRange(bot_spell_list_itr->SpellId, target)) { continue; } - if (selectLureNuke && (spells[botSpellListItr->SpellId].resist_difficulty < lureResisValue)) { - if (botCaster->CastChecks(botSpellListItr->SpellId, target, spellType)) { - spellSelected = true; + if (select_lure_nuke && (spells[bot_spell_list_itr->SpellId].resist_difficulty < lure_resis_value)) { + if (caster->CastChecks(bot_spell_list_itr->SpellId, target, spell_type)) { + spell_selected = true; } } - else if (!selectLureNuke && IsPureNukeSpell(botSpellListItr->SpellId)) { + else if (!select_lure_nuke && IsPureNukeSpell(bot_spell_list_itr->SpellId)) { if ( ((target->GetMR() < target->GetCR()) || (target->GetMR() < target->GetFR())) && - (GetSpellResistType(botSpellListItr->SpellId) == RESIST_MAGIC) && - (spells[botSpellListItr->SpellId].resist_difficulty > lureResisValue) && - botCaster->CastChecks(botSpellListItr->SpellId, target, spellType) + (GetSpellResistType(bot_spell_list_itr->SpellId) == RESIST_MAGIC) && + (spells[bot_spell_list_itr->SpellId].resist_difficulty > lure_resis_value) && + caster->CastChecks(bot_spell_list_itr->SpellId, target, spell_type) ) { - spellSelected = true; + spell_selected = true; } else if ( ((target->GetCR() < target->GetMR()) || (target->GetCR() < target->GetFR())) && - (GetSpellResistType(botSpellListItr->SpellId) == RESIST_COLD) && - (spells[botSpellListItr->SpellId].resist_difficulty > lureResisValue) && - botCaster->CastChecks(botSpellListItr->SpellId, target, spellType) + (GetSpellResistType(bot_spell_list_itr->SpellId) == RESIST_COLD) && + (spells[bot_spell_list_itr->SpellId].resist_difficulty > lure_resis_value) && + caster->CastChecks(bot_spell_list_itr->SpellId, target, spell_type) ) { - spellSelected = true; + spell_selected = true; } else if ( ((target->GetFR() < target->GetCR()) || (target->GetFR() < target->GetMR())) && - (GetSpellResistType(botSpellListItr->SpellId) == RESIST_FIRE) && - (spells[botSpellListItr->SpellId].resist_difficulty > lureResisValue) && - botCaster->CastChecks(botSpellListItr->SpellId, target, spellType) + (GetSpellResistType(bot_spell_list_itr->SpellId) == RESIST_FIRE) && + (spells[bot_spell_list_itr->SpellId].resist_difficulty > lure_resis_value) && + caster->CastChecks(bot_spell_list_itr->SpellId, target, spell_type) ) { - spellSelected = true; + spell_selected = true; } else if ( - (GetSpellResistType(botSpellListItr->SpellId) == RESIST_MAGIC) && - (spells[botSpellListItr->SpellId].resist_difficulty > lureResisValue) && - botCaster->CastChecks(botSpellListItr->SpellId, target, spellType) + (GetSpellResistType(bot_spell_list_itr->SpellId) == RESIST_MAGIC) && + (spells[bot_spell_list_itr->SpellId].resist_difficulty > lure_resis_value) && + caster->CastChecks(bot_spell_list_itr->SpellId, target, spell_type) ) { - firstWizardMagicNukeSpellFound.SpellId = botSpellListItr->SpellId; - firstWizardMagicNukeSpellFound.SpellIndex = botSpellListItr->SpellIndex; - firstWizardMagicNukeSpellFound.ManaCost = botSpellListItr->ManaCost; + first_wizard_magic_nuke_spell_found.SpellId = bot_spell_list_itr->SpellId; + first_wizard_magic_nuke_spell_found.SpellIndex = bot_spell_list_itr->SpellIndex; + first_wizard_magic_nuke_spell_found.ManaCost = bot_spell_list_itr->ManaCost; } } - if (spellSelected) { - result.SpellId = botSpellListItr->SpellId; - result.SpellIndex = botSpellListItr->SpellIndex; - result.ManaCost = botSpellListItr->ManaCost; + if (spell_selected) { + result.SpellId = bot_spell_list_itr->SpellId; + result.SpellIndex = bot_spell_list_itr->SpellIndex; + result.ManaCost = bot_spell_list_itr->ManaCost; break; } } - if (!spellSelected) { - for (std::list::iterator botSpellListItr = botSpellList.begin(); botSpellListItr != botSpellList.end(); ++botSpellListItr) { + if (!spell_selected) { + for (std::list::iterator bot_spell_list_itr = bot_spell_list.begin(); bot_spell_list_itr != bot_spell_list.end(); ++bot_spell_list_itr) { // Assuming all the spells have been loaded into this list by level and in descending order - if (botCaster->CheckSpellRecastTimer(botSpellListItr->SpellId)) { - if (botCaster->CastChecks(botSpellListItr->SpellId, target, spellType)) { - spellSelected = true; + if (caster->CheckSpellRecastTimer(bot_spell_list_itr->SpellId)) { + if (caster->CastChecks(bot_spell_list_itr->SpellId, target, spell_type)) { + spell_selected = true; } } - if (spellSelected) { - result.SpellId = botSpellListItr->SpellId; - result.SpellIndex = botSpellListItr->SpellIndex; - result.ManaCost = botSpellListItr->ManaCost; + if (spell_selected) { + result.SpellId = bot_spell_list_itr->SpellId; + result.SpellIndex = bot_spell_list_itr->SpellIndex; + result.ManaCost = bot_spell_list_itr->ManaCost; break; } @@ -1915,38 +1914,38 @@ BotSpell Bot::GetBestBotWizardNukeSpellByTargetResists(Bot* botCaster, Mob* targ } if (result.SpellId == 0) { - result = firstWizardMagicNukeSpellFound; + result = first_wizard_magic_nuke_spell_found; } } return result; } -BotSpell Bot::GetDebuffBotSpell(Bot* botCaster, Mob *tar, uint16 spellType) { +BotSpell Bot::GetDebuffBotSpell(Bot* caster, Mob *tar, uint16 spell_type) { BotSpell result; result.SpellId = 0; result.SpellIndex = 0; result.ManaCost = 0; - if (!tar || !botCaster) + if (!tar || !caster) return result; - if (botCaster->AI_HasSpells()) { - std::vector botSpellList = botCaster->BotGetSpellsByType(spellType); + if (caster->AI_HasSpells()) { + std::vector bot_spell_list = caster->BotGetSpellsByType(spell_type); - for (int i = botSpellList.size() - 1; i >= 0; i--) { - if (!IsValidSpellAndLoS(botSpellList[i].spellid, botCaster->HasLoS())) { + for (int i = bot_spell_list.size() - 1; i >= 0; i--) { + if (!IsValidSpellAndLoS(bot_spell_list[i].spellid, caster->HasLoS())) { continue; } - if (((botSpellList[i].type == BotSpellTypes::Debuff) || IsDebuffSpell(botSpellList[i].spellid)) - && (!tar->IsImmuneToSpell(botSpellList[i].spellid, botCaster) - && tar->CanBuffStack(botSpellList[i].spellid, botCaster->GetLevel(), true) >= 0) - && botCaster->CheckSpellRecastTimer(botSpellList[i].spellid)) { - result.SpellId = botSpellList[i].spellid; - result.SpellIndex = botSpellList[i].index; - result.ManaCost = botSpellList[i].manacost; + if (((bot_spell_list[i].type == BotSpellTypes::Debuff) || IsDebuffSpell(bot_spell_list[i].spellid)) + && (!tar->IsImmuneToSpell(bot_spell_list[i].spellid, caster) + && tar->CanBuffStack(bot_spell_list[i].spellid, caster->GetLevel(), true) >= 0) + && caster->CheckSpellRecastTimer(bot_spell_list[i].spellid)) { + result.SpellId = bot_spell_list[i].spellid; + result.SpellIndex = bot_spell_list[i].index; + result.ManaCost = bot_spell_list[i].manacost; break; } @@ -1956,48 +1955,52 @@ BotSpell Bot::GetDebuffBotSpell(Bot* botCaster, Mob *tar, uint16 spellType) { return result; } -BotSpell Bot::GetBestBotSpellForResistDebuff(Bot* botCaster, Mob *tar, uint16 spellType) { +BotSpell Bot::GetBestBotSpellForResistDebuff(Bot* caster, Mob *tar, uint16 spell_type) { BotSpell result; result.SpellId = 0; result.SpellIndex = 0; result.ManaCost = 0; - if (!tar || !botCaster) { + if (!tar || !caster) { return result; } - int level_mod = (tar->GetLevel() - botCaster->GetLevel())* (tar->GetLevel() - botCaster->GetLevel()) / 2; - if (tar->GetLevel() - botCaster->GetLevel() < 0) { + int level_mod = (tar->GetLevel() - caster->GetLevel())* (tar->GetLevel() - caster->GetLevel()) / 2; + if (tar->GetLevel() - caster->GetLevel() < 0) { level_mod = -level_mod; } - bool needsMagicResistDebuff = (tar->GetMR() + level_mod) > 100; - bool needsColdResistDebuff = (tar->GetCR() + level_mod) > 100; - bool needsFireResistDebuff = (tar->GetFR() + level_mod) > 100; - bool needsPoisonResistDebuff = (tar->GetPR() + level_mod) > 100; - bool needsDiseaseResistDebuff = (tar->GetDR() + level_mod) > 100; + bool needs_magic_resist_debuff = (tar->GetMR() + level_mod) > 100; + bool needs_cold_resist_debuff = (tar->GetCR() + level_mod) > 100; + bool needs_fire_resist_debuff = (tar->GetFR() + level_mod) > 100; + bool needs_poison_resist_debuff = (tar->GetPR() + level_mod) > 100; + bool needs_disease_resist_debuff = (tar->GetDR() + level_mod) > 100; - if (botCaster->AI_HasSpells()) { - std::vector botSpellList = botCaster->BotGetSpellsByType(spellType); + if (caster->AI_HasSpells()) { + std::vector bot_spell_list = caster->BotGetSpellsByType(spell_type); - for (int i = botSpellList.size() - 1; i >= 0; i--) { - if (!IsValidSpellAndLoS(botSpellList[i].spellid, botCaster->HasLoS())) { + for (int i = bot_spell_list.size() - 1; i >= 0; i--) { + if (!IsValidSpellAndLoS(bot_spell_list[i].spellid, caster->HasLoS())) { continue; } - if (((botSpellList[i].type == BotSpellTypes::Debuff) || IsResistDebuffSpell(botSpellList[i].spellid)) - && ((needsMagicResistDebuff && (IsEffectInSpell(botSpellList[i].spellid, SE_ResistMagic)) || IsEffectInSpell(botSpellList[i].spellid, SE_ResistAll)) - || (needsColdResistDebuff && (IsEffectInSpell(botSpellList[i].spellid, SE_ResistCold)) || IsEffectInSpell(botSpellList[i].spellid, SE_ResistAll)) - || (needsFireResistDebuff && (IsEffectInSpell(botSpellList[i].spellid, SE_ResistFire)) || IsEffectInSpell(botSpellList[i].spellid, SE_ResistAll)) - || (needsPoisonResistDebuff && (IsEffectInSpell(botSpellList[i].spellid, SE_ResistPoison)) || IsEffectInSpell(botSpellList[i].spellid, SE_ResistAll)) - || (needsDiseaseResistDebuff && (IsEffectInSpell(botSpellList[i].spellid, SE_ResistDisease)) || IsEffectInSpell(botSpellList[i].spellid, SE_ResistAll))) - && (!tar->IsImmuneToSpell(botSpellList[i].spellid, botCaster) - && tar->CanBuffStack(botSpellList[i].spellid, botCaster->GetLevel(), true) >= 0) - && botCaster->CheckSpellRecastTimer(botSpellList[i].spellid)) { - result.SpellId = botSpellList[i].spellid; - result.SpellIndex = botSpellList[i].index; - result.ManaCost = botSpellList[i].manacost; + if ( + (bot_spell_list[i].type == BotSpellTypes::Debuff || IsResistDebuffSpell(bot_spell_list[i].spellid)) && + ( + (needs_magic_resist_debuff && (IsEffectInSpell(bot_spell_list[i].spellid, SE_ResistMagic) || IsEffectInSpell(bot_spell_list[i].spellid, SE_ResistAll))) || + (needs_cold_resist_debuff && (IsEffectInSpell(bot_spell_list[i].spellid, SE_ResistCold) || IsEffectInSpell(bot_spell_list[i].spellid, SE_ResistAll))) || + (needs_fire_resist_debuff && (IsEffectInSpell(bot_spell_list[i].spellid, SE_ResistFire) || IsEffectInSpell(bot_spell_list[i].spellid, SE_ResistAll))) || + (needs_poison_resist_debuff && (IsEffectInSpell(bot_spell_list[i].spellid, SE_ResistPoison) || IsEffectInSpell(bot_spell_list[i].spellid, SE_ResistAll))) || + (needs_disease_resist_debuff && (IsEffectInSpell(bot_spell_list[i].spellid, SE_ResistDisease) || IsEffectInSpell(bot_spell_list[i].spellid, SE_ResistAll))) + ) && + !tar->IsImmuneToSpell(bot_spell_list[i].spellid, caster) && + tar->CanBuffStack(bot_spell_list[i].spellid, caster->GetLevel(), true) >= 0 && + caster->CheckSpellRecastTimer(bot_spell_list[i].spellid) + ) { + result.SpellId = bot_spell_list[i].spellid; + result.SpellIndex = bot_spell_list[i].index; + result.ManaCost = bot_spell_list[i].manacost; break; } @@ -2007,7 +2010,7 @@ BotSpell Bot::GetBestBotSpellForResistDebuff(Bot* botCaster, Mob *tar, uint16 sp return result; } -BotSpell Bot::GetBestBotSpellForCure(Bot* botCaster, Mob* tar, uint16 spellType) { +BotSpell Bot::GetBestBotSpellForCure(Bot* caster, Mob* tar, uint16 spell_type) { BotSpell_wPriority result; result.SpellId = 0; @@ -2018,51 +2021,51 @@ BotSpell Bot::GetBestBotSpellForCure(Bot* botCaster, Mob* tar, uint16 spellType) return result; } - if (botCaster) { - std::vector botSpellListItr = GetPrioritizedBotSpellsBySpellType(botCaster, spellType, tar); + if (caster) { + std::vector bot_spell_list_itr = GetPrioritizedBotSpellsBySpellType(caster, spell_type, tar); - if (IsGroupBotSpellType(spellType)) { - int countNeedsCured = 0; - uint16 countPoisoned = 0; - uint16 countDiseased = 0; - uint16 countCursed = 0; - uint16 countCorrupted = 0; + if (IsGroupBotSpellType(spell_type)) { + int count_needs_cured = 0; + uint16 count_poisoned = 0; + uint16 count_diseased = 0; + uint16 count_cursed = 0; + uint16 count_corrupted = 0; - for (std::vector::iterator itr = botSpellListItr.begin(); itr != botSpellListItr.end(); ++itr) { + for (std::vector::iterator itr = bot_spell_list_itr.begin(); itr != bot_spell_list_itr.end(); ++itr) { if (!IsValidSpell(itr->SpellId) || !IsGroupSpell(itr->SpellId)) { continue; } - for (Mob* m : botCaster->GetSpellTargetList()) { - if (IsGroupBotSpellType(spellType)) { - if (!botCaster->IsInGroupOrRaid(m, true)) { + for (Mob* m : caster->GetSpellTargetList()) { + if (IsGroupBotSpellType(spell_type)) { + if (!caster->IsInGroupOrRaid(m, true)) { continue; } } - if (botCaster->GetNeedsCured(m)) { - if (botCaster->CastChecks(itr->SpellId, m, spellType, true, IsGroupBotSpellType(spellType))) { + if (caster->GetNeedsCured(m)) { + if (caster->CastChecks(itr->SpellId, m, spell_type, true, IsGroupBotSpellType(spell_type))) { if (m->FindType(SE_PoisonCounter)) { - ++countPoisoned; + ++count_poisoned; } if (m->FindType(SE_DiseaseCounter)) { - ++countDiseased; + ++count_diseased; } if (m->FindType(SE_CurseCounter)) { - ++countCursed; + ++count_cursed; } if (m->FindType(SE_CorruptionCounter)) { - ++countCorrupted; + ++count_corrupted; } } } } if ( - (countPoisoned >= botCaster->GetSpellTypeAEOrGroupTargetCount(spellType) && IsEffectInSpell(itr->SpellId, SE_PoisonCounter)) || - (countDiseased >= botCaster->GetSpellTypeAEOrGroupTargetCount(spellType) && IsEffectInSpell(itr->SpellId, SE_DiseaseCounter)) || - (countCursed >= botCaster->GetSpellTypeAEOrGroupTargetCount(spellType) && IsEffectInSpell(itr->SpellId, SE_CurseCounter)) || - (countCorrupted >= botCaster->GetSpellTypeAEOrGroupTargetCount(spellType) && IsEffectInSpell(itr->SpellId, SE_CorruptionCounter)) + (count_poisoned >= caster->GetSpellTypeAEOrGroupTargetCount(spell_type) && IsEffectInSpell(itr->SpellId, SE_PoisonCounter)) || + (count_diseased >= caster->GetSpellTypeAEOrGroupTargetCount(spell_type) && IsEffectInSpell(itr->SpellId, SE_DiseaseCounter)) || + (count_cursed >= caster->GetSpellTypeAEOrGroupTargetCount(spell_type) && IsEffectInSpell(itr->SpellId, SE_CurseCounter)) || + (count_corrupted >= caster->GetSpellTypeAEOrGroupTargetCount(spell_type) && IsEffectInSpell(itr->SpellId, SE_CorruptionCounter)) ) { result.SpellId = itr->SpellId; result.SpellIndex = itr->SpellIndex; @@ -2073,7 +2076,7 @@ BotSpell Bot::GetBestBotSpellForCure(Bot* botCaster, Mob* tar, uint16 spellType) } } else { - for (std::vector::iterator itr = botSpellListItr.begin(); itr != botSpellListItr.end(); ++itr) { + for (std::vector::iterator itr = bot_spell_list_itr.begin(); itr != bot_spell_list_itr.end(); ++itr) { if (!IsValidSpell(itr->SpellId) || IsGroupSpell(itr->SpellId)) { continue; } @@ -2096,9 +2099,9 @@ BotSpell Bot::GetBestBotSpellForCure(Bot* botCaster, Mob* tar, uint16 spellType) return result; } -uint8 Bot::GetChanceToCastBySpellType(uint16 spellType) +uint8 Bot::GetChanceToCastBySpellType(uint16 spell_type) { - switch (spellType) { + switch (spell_type) { case BotSpellTypes::AENukes: case BotSpellTypes::AERains: case BotSpellTypes::AEStun: @@ -2773,43 +2776,43 @@ bool Bot::IsValidSpellRange(uint16 spell_id, Mob* tar) { return true; } -BotSpell Bot::GetBestBotSpellForNukeByBodyType(Bot* botCaster, uint8 bodyType, uint16 spellType, bool AE, Mob* tar) { +BotSpell Bot::GetBestBotSpellForNukeByBodyType(Bot* caster, uint8 body_type, uint16 spell_type, bool AE, Mob* tar) { BotSpell result; result.SpellId = 0; result.SpellIndex = 0; result.ManaCost = 0; - if (!botCaster || !bodyType) { + if (!caster || !body_type) { return result; } if (tar == nullptr) { - tar = botCaster->GetTarget(); + tar = caster->GetTarget(); } - switch (bodyType) { + switch (body_type) { case BodyType::Undead: case BodyType::SummonedUndead: case BodyType::Vampire: - result = GetBestBotSpellForNukeByTargetType(botCaster, (!AE ? ST_Undead : ST_UndeadAE), spellType, AE, tar); + result = GetBestBotSpellForNukeByTargetType(caster, (!AE ? ST_Undead : ST_UndeadAE), spell_type, AE, tar); break; case BodyType::Summoned: case BodyType::Summoned2: case BodyType::Summoned3: - result = GetBestBotSpellForNukeByTargetType(botCaster, (!AE ? ST_Summoned : ST_SummonedAE), spellType, AE, tar); + result = GetBestBotSpellForNukeByTargetType(caster, (!AE ? ST_Summoned : ST_SummonedAE), spell_type, AE, tar); break; case BodyType::Animal: - result = GetBestBotSpellForNukeByTargetType(botCaster, ST_Animal, spellType, AE, tar); + result = GetBestBotSpellForNukeByTargetType(caster, ST_Animal, spell_type, AE, tar); break; case BodyType::Plant: - result = GetBestBotSpellForNukeByTargetType(botCaster, ST_Plant, spellType, AE, tar); + result = GetBestBotSpellForNukeByTargetType(caster, ST_Plant, spell_type, AE, tar); break; case BodyType::Giant: - result = GetBestBotSpellForNukeByTargetType(botCaster, ST_Giant, spellType, AE, tar); + result = GetBestBotSpellForNukeByTargetType(caster, ST_Giant, spell_type, AE, tar); break; case BodyType::Dragon: - result = GetBestBotSpellForNukeByTargetType(botCaster, ST_Dragon, spellType, AE, tar); + result = GetBestBotSpellForNukeByTargetType(caster, ST_Dragon, spell_type, AE, tar); break; default: break; @@ -2819,13 +2822,13 @@ BotSpell Bot::GetBestBotSpellForNukeByBodyType(Bot* botCaster, uint8 bodyType, u } void Bot::CheckBotSpells() { - auto spellList = BotSpellsEntriesRepository::All(content_db); + auto spell_list = BotSpellsEntriesRepository::All(content_db); uint16 spell_id; SPDat_Spell_Struct spell; - uint16 correctType; - uint16 parentType; + uint16 correct_type; + uint16 parent_type; - for (const auto& s : spellList) { + for (const auto& s : spell_list) { if (!IsValidSpell(s.spell_id)) { LogBotSpellTypeChecks("{} is an invalid spell", s.spell_id); continue; @@ -2897,25 +2900,25 @@ void Bot::CheckBotSpells() { } } - correctType = GetCorrectSpellType(s.type, spell_id); - parentType = GetParentSpellType(correctType); + correct_type = GetCorrectSpellType(s.type, spell_id); + parent_type = GetParentSpellType(correct_type); if (RuleB(Bots, UseParentSpellTypeForChecks)) { - if (s.type == parentType || s.type == correctType) { + if (s.type == parent_type || s.type == correct_type) { continue; } } else { if (IsPetBotSpellType(s.type)) { - correctType = GetPetSpellType(correctType); + correct_type = GetPetSpellType(correct_type); } } - if (correctType == s.type) { + if (correct_type == s.type) { continue; } - if (correctType == UINT16_MAX) { + if (correct_type == UINT16_MAX) { LogBotSpellTypeChecks("{} [#{}] is incorrect. It is currently set as {} [#{}] but the correct type is unknown." , GetSpellName(spell_id) , spell_id @@ -2929,42 +2932,42 @@ void Bot::CheckBotSpells() { , spell_id , GetSpellTypeNameByID(s.type) , s.type - , GetSpellTypeNameByID(correctType) - , correctType + , GetSpellTypeNameByID(correct_type) + , correct_type ); LogBotSpellTypeChecksDetail("UPDATE bot_spells_entries SET `type` = {} WHERE `spell_id` = {}; -- {} [#{}] from {} [#{}] to {} [#{}]" - , correctType + , correct_type , spell_id , GetSpellName(spell_id) , spell_id , GetSpellTypeNameByID(s.type) , s.type - , GetSpellTypeNameByID(correctType) - , correctType + , GetSpellTypeNameByID(correct_type) + , correct_type ); } } } -BotSpell Bot::GetBestBotSpellForRez(Bot* botCaster, Mob* target, uint16 spellType) { +BotSpell Bot::GetBestBotSpellForRez(Bot* caster, Mob* target, uint16 spell_type) { BotSpell result; result.SpellId = 0; result.SpellIndex = 0; result.ManaCost = 0; - if (botCaster) { - std::list botSpellList = GetBotSpellsForSpellEffect(botCaster, spellType, SE_Revive); + if (caster) { + std::list bot_spell_list = GetBotSpellsForSpellEffect(caster, spell_type, SE_Revive); - for (std::list::iterator botSpellListItr = botSpellList.begin(); botSpellListItr != botSpellList.end(); ++botSpellListItr) { + for (std::list::iterator bot_spell_list_itr = bot_spell_list.begin(); bot_spell_list_itr != bot_spell_list.end(); ++bot_spell_list_itr) { // Assuming all the spells have been loaded into this list by level and in descending order if ( - IsResurrectSpell(botSpellListItr->SpellId) && - botCaster->CheckSpellRecastTimer(botSpellListItr->SpellId) + IsResurrectSpell(bot_spell_list_itr->SpellId) && + caster->CheckSpellRecastTimer(bot_spell_list_itr->SpellId) ) { - result.SpellId = botSpellListItr->SpellId; - result.SpellIndex = botSpellListItr->SpellIndex; - result.ManaCost = botSpellListItr->ManaCost; + result.SpellId = bot_spell_list_itr->SpellId; + result.SpellIndex = bot_spell_list_itr->SpellIndex; + result.ManaCost = bot_spell_list_itr->ManaCost; break; } @@ -2974,25 +2977,25 @@ BotSpell Bot::GetBestBotSpellForRez(Bot* botCaster, Mob* target, uint16 spellTyp return result; } -BotSpell Bot::GetBestBotSpellForCharm(Bot* botCaster, Mob* target, uint16 spellType) { +BotSpell Bot::GetBestBotSpellForCharm(Bot* caster, Mob* target, uint16 spell_type) { BotSpell result; result.SpellId = 0; result.SpellIndex = 0; result.ManaCost = 0; - if (botCaster) { - std::list botSpellList = GetBotSpellsForSpellEffect(botCaster, spellType, SE_Charm); + if (caster) { + std::list bot_spell_list = GetBotSpellsForSpellEffect(caster, spell_type, SE_Charm); - for (std::list::iterator botSpellListItr = botSpellList.begin(); botSpellListItr != botSpellList.end(); ++botSpellListItr) { + for (std::list::iterator bot_spell_list_itr = bot_spell_list.begin(); bot_spell_list_itr != bot_spell_list.end(); ++bot_spell_list_itr) { // Assuming all the spells have been loaded into this list by level and in descending order if ( - IsCharmSpell(botSpellListItr->SpellId) && - botCaster->CastChecks(botSpellListItr->SpellId, target, spellType) + IsCharmSpell(bot_spell_list_itr->SpellId) && + caster->CastChecks(bot_spell_list_itr->SpellId, target, spell_type) ) { - result.SpellId = botSpellListItr->SpellId; - result.SpellIndex = botSpellListItr->SpellIndex; - result.ManaCost = botSpellListItr->ManaCost; + result.SpellId = bot_spell_list_itr->SpellId; + result.SpellIndex = bot_spell_list_itr->SpellIndex; + result.ManaCost = bot_spell_list_itr->ManaCost; break; } diff --git a/zone/client.cpp b/zone/client.cpp index 27480804b..d5ea6c79a 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -13089,50 +13089,50 @@ void Client::LoadDefaultBotSettings() { } } -int Client::GetDefaultBotSettings(uint8 settingType, uint16 botSetting) { - switch (settingType) { +int Client::GetDefaultBotSettings(uint8 setting_type, uint16 bot_setting) { + switch (setting_type) { case BotSettingCategories::BaseSetting: return false; case BotSettingCategories::SpellHold: - return GetDefaultSpellHold(botSetting); + return GetDefaultSpellHold(bot_setting); case BotSettingCategories::SpellDelay: - return GetDefaultSpellDelay(botSetting); + return GetDefaultSpellDelay(bot_setting); case BotSettingCategories::SpellMinThreshold: - return GetDefaultSpellMinThreshold(botSetting); + return GetDefaultSpellMinThreshold(bot_setting); case BotSettingCategories::SpellMaxThreshold: - return GetDefaultSpellMaxThreshold(botSetting); + return GetDefaultSpellMaxThreshold(bot_setting); } } -int Client::GetBotSetting(uint8 settingType, uint16 botSetting) { - switch (settingType) { +int Client::GetBotSetting(uint8 setting_type, uint16 bot_setting) { + switch (setting_type) { case BotSettingCategories::SpellHold: - return GetSpellHold(botSetting); + return GetSpellHold(bot_setting); case BotSettingCategories::SpellDelay: - return GetSpellDelay(botSetting); + return GetSpellDelay(bot_setting); case BotSettingCategories::SpellMinThreshold: - return GetSpellMinThreshold(botSetting); + return GetSpellMinThreshold(bot_setting); case BotSettingCategories::SpellMaxThreshold: - return GetSpellMaxThreshold(botSetting); + return GetSpellMaxThreshold(bot_setting); } } -void Client::SetBotSetting(uint8 settingType, uint16 botSetting, uint32 settingValue) { - switch (settingType) { +void Client::SetBotSetting(uint8 setting_type, uint16 bot_setting, uint32 setting_value) { + switch (setting_type) { case BotSettingCategories::BaseSetting: - SetBaseSetting(botSetting, settingValue); + SetBaseSetting(bot_setting, setting_value); break; case BotSettingCategories::SpellHold: - SetSpellHold(botSetting, settingValue); + SetSpellHold(bot_setting, setting_value); break; case BotSettingCategories::SpellDelay: - SetSpellDelay(botSetting, settingValue); + SetSpellDelay(bot_setting, setting_value); break; case BotSettingCategories::SpellMinThreshold: - SetSpellMinThreshold(botSetting, settingValue); + SetSpellMinThreshold(bot_setting, setting_value); break; case BotSettingCategories::SpellMaxThreshold: - SetSpellMaxThreshold(botSetting, settingValue); + SetSpellMaxThreshold(bot_setting, setting_value); break; } } @@ -13148,9 +13148,9 @@ std::string Client::SendCommandHelpWindow( std::vector options_one, std::vector options_two, std::vector options_three ) { - unsigned stringLength = 0; - unsigned currentPlace = 0; - uint16 maxLength = RuleI(Command, MaxHelpLineLength); //character length of a line before splitting in to multiple lines + unsigned string_length = 0; + unsigned current_place = 0; + uint16 max_length = RuleI(Command, MaxHelpLineLength); //character length of a line before splitting in to multiple lines const std::string& description_color = RuleS(Command, DescriptionColor); const std::string& description_header_color = RuleS(Command, DescriptionHeaderColor); const std::string& alt_description_color = RuleS(Command, AltDescriptionColor); @@ -13177,78 +13177,74 @@ std::string Client::SendCommandHelpWindow( - std::string fillerLine = "--------------------------------------------------------------------"; - std::string fillerDia = DialogueWindow::TableRow(DialogueWindow::TableCell(fmt::format("{}", DialogueWindow::ColorMessage(filler_line_color, fillerLine)))); - std::string breakLine = DialogueWindow::Break(); + std::string filler_line = "--------------------------------------------------------------------"; + std::string filler_dia = DialogueWindow::TableRow(DialogueWindow::TableCell(fmt::format("{}", DialogueWindow::ColorMessage(filler_line_color, filler_line)))); + std::string break_line = DialogueWindow::Break(); std::string indent = "        "; std::string bullet = "- "; std::string popup_text = ""; /* - maxLength is how long you want lines to be before splitting them. This will look for the last space before the count and split there so words are not split mid sentence - Any SplitCommandHelpText can be be have the first string from a vector differ in color from the next strings by setting secondColor to true and assigning a color. - ex: SplitCommandHelpText(examples_one, example_color, maxLength, true, alt_example_color) - - This will make the first string from examples_one vector be the color of example_color and all following strings the color of alt_example_color - ex: SplitCommandHelpText(examples_one, example_color, maxLength) - - This will apply the color example_color to everything in examples_one vector + max_length is how long you want lines to be before splitting them. This will look for the last space before the count and split there so words are not split mid sentence + Any SplitCommandHelpText can have the first string from a vector differ in color from the next strings by setting an alternate color for that type in the rule. */ if (!description.empty()) { popup_text += GetCommandHelpHeader(description_header_color, "[Description]"); - popup_text += SplitCommandHelpText(description, description_color, maxLength, true, alt_description_color); + popup_text += SplitCommandHelpText(description, description_color, max_length, !alt_description_color.empty(), alt_description_color); } if (!notes.empty()) { - popup_text += breakLine; - popup_text += breakLine; + popup_text += break_line; + popup_text += break_line; popup_text += GetCommandHelpHeader(note_header_color, "[Notes]"); - popup_text += SplitCommandHelpText(notes, note_color, maxLength, true, alt_note_color); + popup_text += SplitCommandHelpText(notes, note_color, max_length, !alt_note_color.empty(), alt_note_color); } if (!example_format.empty()) { - popup_text += fillerDia; + popup_text += filler_dia; popup_text += GetCommandHelpHeader(example_header_color, "[Examples]"); - popup_text += SplitCommandHelpText(example_format, example_color, maxLength, true, alt_example_color); + popup_text += SplitCommandHelpText(example_format, example_color, max_length, !alt_example_color.empty(), alt_example_color); } if (!examples_one.empty()) { - popup_text += breakLine; - popup_text += breakLine; - popup_text += SplitCommandHelpText(examples_one, sub_example_color, maxLength, true, sub_alt_example_color); + popup_text += break_line; + popup_text += break_line; + popup_text += SplitCommandHelpText(examples_one, sub_example_color, max_length, !sub_alt_example_color.empty(), sub_alt_example_color); } if (!examples_two.empty()) { - popup_text += SplitCommandHelpText(examples_two, sub_example_color, maxLength, true, sub_alt_example_color); + popup_text += SplitCommandHelpText(examples_two, sub_example_color, max_length, !sub_alt_example_color.empty(), sub_alt_example_color); } if (!examples_three.empty()) { - popup_text += SplitCommandHelpText(examples_three, sub_example_color, maxLength, true, sub_alt_example_color); + popup_text += SplitCommandHelpText(examples_three, sub_example_color, max_length, !sub_alt_example_color.empty(), sub_alt_example_color); } if (!options.empty()) { - popup_text += fillerDia; + popup_text += filler_dia; popup_text += GetCommandHelpHeader(option_header_color, "[Options]"); - popup_text += SplitCommandHelpText(options, option_color, maxLength, true, alt_option_color); + popup_text += SplitCommandHelpText(options, option_color, max_length, !alt_option_color.empty(), alt_option_color); } if (!options_one.empty()) { - popup_text += breakLine; - popup_text += breakLine; - popup_text += SplitCommandHelpText(options_one, sub_option_color, maxLength, true, sub_alt_option_color); + popup_text += break_line; + popup_text += break_line; + popup_text += SplitCommandHelpText(options_one, sub_option_color, max_length, !sub_alt_option_color.empty(), sub_alt_option_color); } if (!options_two.empty()) { - popup_text += SplitCommandHelpText(options_two, sub_option_color, maxLength, true, sub_alt_option_color); + popup_text += SplitCommandHelpText(options_two, sub_option_color, max_length, !sub_alt_option_color.empty(), sub_alt_option_color); } if (!options_three.empty()) { - popup_text += SplitCommandHelpText(options_three, secondary_header_color, maxLength, true, sub_alt_option_color); + popup_text += SplitCommandHelpText(options_three, secondary_header_color, max_length, !sub_alt_option_color.empty(), sub_alt_option_color); } if (!actionables.empty()) { - popup_text += fillerDia; + popup_text += filler_dia; popup_text += GetCommandHelpHeader(actionable_header_color, "[Actionables]"); - popup_text += SplitCommandHelpText(actionables, actionable_color, maxLength, true, alt_actionable_color); + popup_text += SplitCommandHelpText(actionables, actionable_color, max_length, !alt_actionable_color.empty(), alt_actionable_color); } popup_text = DialogueWindow::Table(popup_text); @@ -13257,7 +13253,7 @@ std::string Client::SendCommandHelpWindow( } std::string Client::GetCommandHelpHeader(std::string color, std::string header) { - std::string returnText = DialogueWindow::TableRow( + std::string return_text = DialogueWindow::TableRow( DialogueWindow::TableCell( fmt::format( "{}", @@ -13266,58 +13262,58 @@ std::string Client::GetCommandHelpHeader(std::string color, std::string header) ) ); - return returnText; + return return_text; } -std::string Client::SplitCommandHelpText(std::vector msg, std::string color, uint16 maxLength, bool secondColor, std::string secondaryColor) { - std::string returnText; +std::string Client::SplitCommandHelpText(std::vector msg, std::string color, uint16 max_length, bool second_color, std::string secondary_color) { + std::string return_text; for (int i = 0; i < msg.size(); i++) { std::vector msg_split; - int stringLength = msg[i].length() + 1; - int endCount = 0; - int newCount = 0; - int splitCount = 0; + int string_length = msg[i].length() + 1; + int end_count = 0; + int new_count = 0; + int split_count = 0; - for (int x = 0; x < stringLength; x = endCount) { - endCount = std::min(int(stringLength), (int(x) + std::min(int(stringLength), int(maxLength)))); + for (int x = 0; x < string_length; x = end_count) { + end_count = std::min(int(string_length), (int(x) + std::min(int(string_length), int(max_length)))); - if ((stringLength - (x + 1)) > maxLength) { - for (int y = endCount; y >= x; --y) { + if ((string_length - (x + 1)) > max_length) { + for (int y = end_count; y >= x; --y) { if (msg[i][y] == ' ') { - splitCount = y - x; - msg_split.emplace_back(msg[i].substr(x, splitCount)); - endCount = y + 1; + split_count = y - x; + msg_split.emplace_back(msg[i].substr(x, split_count)); + end_count = y + 1; break; } if (y == x) { - msg_split.emplace_back(msg[i].substr(x, maxLength)); + msg_split.emplace_back(msg[i].substr(x, max_length)); break; } } } else { - msg_split.emplace_back(msg[i].substr(x, (stringLength - 1) - x)); + msg_split.emplace_back(msg[i].substr(x, (string_length - 1) - x)); break; } } for (const auto& s : msg_split) { - returnText += DialogueWindow::TableRow( - DialogueWindow::TableCell(DialogueWindow::ColorMessage(((secondColor && i == 0) ? color : secondaryColor), s)) + return_text += DialogueWindow::TableRow( + DialogueWindow::TableCell(DialogueWindow::ColorMessage(((second_color && i == 0) ? color : secondary_color), s)) ); } } - return returnText; + return return_text; } -void Client::SendSpellTypePrompts(bool commandedTypes, bool clientOnlyTypes) { - if (clientOnlyTypes) { +void Client::SendSpellTypePrompts(bool commanded_types, bool client_only_types) { + if (client_only_types) { Message( Chat::Yellow, fmt::format( @@ -13358,7 +13354,7 @@ void Client::SendSpellTypePrompts(bool commandedTypes, bool clientOnlyTypes) { ); } - if (commandedTypes) { + if (commanded_types) { Message( Chat::Yellow, fmt::format( diff --git a/zone/client.h b/zone/client.h index d7d01cda3..9da15a9b0 100644 --- a/zone/client.h +++ b/zone/client.h @@ -2239,9 +2239,9 @@ public: void SpawnRaidBotsOnConnect(Raid* raid); void LoadDefaultBotSettings(); - int GetDefaultBotSettings(uint8 settingType, uint16 botSetting); - int GetBotSetting(uint8 settingType, uint16 botSetting); - void SetBotSetting(uint8 settingType, uint16 botSetting, uint32 settingValue); + int GetDefaultBotSettings(uint8 setting_type, uint16 bot_setting); + int GetBotSetting(uint8 setting_type, uint16 bot_setting); + void SetBotSetting(uint8 setting_type, uint16 bot_setting, uint32 setting_value); private: bool bot_owner_options[_booCount];