diff --git a/zone/bonuses.cpp b/zone/bonuses.cpp index 7df4e3ded..576a3f547 100644 --- a/zone/bonuses.cpp +++ b/zone/bonuses.cpp @@ -246,26 +246,24 @@ void Mob::ProcessItemCaps() itembonuses.ATK = std::min(itembonuses.ATK, CalcItemATKCap()); - int spell_damage_cap = ( - IsOfClientBot() ? - GetStatCap(StatCap::SpellDamage) : - RuleI(Character, ItemSpellDmgCap) - ); - if (IsOfClientBotMerc() && itembonuses.SpellDmg > spell_damage_cap) { - itembonuses.SpellDmg = spell_damage_cap; + if (IsOfClientBotMerc() && itembonuses.SpellDmg > GetStatCap(StatCap::SpellDamage)) { + itembonuses.SpellDmg = GetStatCap(StatCap::SpellDamage); } - int heal_amount_cap = ( - IsOfClientBot() ? - GetStatCap(StatCap::HealAmount) : - RuleI(Character, ItemHealAmtCap) - ); - if (IsOfClientBotMerc() && itembonuses.HealAmt > heal_amount_cap) { - itembonuses.HealAmt = heal_amount_cap; + if (IsOfClientBotMerc() && itembonuses.HealAmt > GetStatCap(StatCap::HealAmount)) { + itembonuses.HealAmt = GetStatCap(StatCap::HealAmount); } } -void Mob::AddItemBonuses(const EQ::ItemInstance* inst, StatBonuses* b, bool is_augment, bool is_tribute, int recommended_level_override, bool is_ammo_item) { +void Mob::AddItemBonuses( + const EQ::ItemInstance* inst, + StatBonuses* b, + bool is_augment, + bool is_tribute, + int recommended_level_override, + bool is_ammo_item +) +{ if (!inst || !inst->IsClassCommon()) { return; } @@ -361,138 +359,49 @@ void Mob::AddItemBonuses(const EQ::ItemInstance* inst, StatBonuses* b, bool is_a b->ManaRegen += CalcItemBonus(item->ManaRegen); b->EnduranceRegen += CalcItemBonus(item->EnduranceRegen); - int accuracy_cap = ( - IsOfClientBot() ? - GetStatCap(StatCap::Accuracy) : - RuleI(Character, ItemAccuracyCap) - ); - - int attack_cap = ( - IsOfClientBot() ? - GetStatCap(StatCap::Attack) : - RuleI(Character, ItemATKCap) - ); - - int avoidance_cap = ( - IsOfClientBot() ? - GetStatCap(StatCap::Avoidance) : - RuleI(Character, ItemAvoidanceCap) - ); - - int clairvoyance_cap = ( - IsOfClientBot() ? - GetStatCap(StatCap::Clairvoyance) : - RuleI(Character, ItemClairvoyanceCap) - ); - - int combat_effects_cap = ( - IsOfClientBot() ? - GetStatCap(StatCap::CombatEffects) : - RuleI(Character, ItemCombatEffectsCap) - ); - - int damage_shield_cap = ( - IsOfClientBot() ? - GetStatCap(StatCap::DamageShield) : - RuleI(Character, ItemDamageShieldCap) - ); - - int dot_shielding_cap = ( - IsOfClientBot() ? - GetStatCap(StatCap::DOTShielding) : - RuleI(Character, ItemDoTShieldingCap) - ); - - int dsmitigation_cap = ( - IsOfClientBot() ? - GetStatCap(StatCap::DSMitigation) : - RuleI(Character, ItemDSMitigationCap) - ); - - int heal_amount_cap = ( - IsOfClientBot() ? - GetStatCap(StatCap::HealAmount) : - RuleI(Character, ItemHealAmtCap) - ); - - int shielding_cap = ( - IsOfClientBot() ? - GetStatCap(StatCap::Shielding) : - RuleI(Character, ItemShieldingCap) - ); - - int spell_damage_cap = ( - IsOfClientBot() ? - GetStatCap(StatCap::SpellDamage) : - RuleI(Character, ItemSpellDmgCap) - ); - - int spell_shielding_cap = ( - IsOfClientBot() ? - GetStatCap(StatCap::SpellShielding) : - RuleI(Character, ItemSpellShieldingCap) - ); - - int strikethrough_cap = ( - IsOfClientBot() ? - GetStatCap(StatCap::Strikethrough) : - RuleI(Character, ItemStrikethroughCap) - ); - - int stun_resist_cap = ( - IsOfClientBot() ? - GetStatCap(StatCap::StunResist) : - RuleI(Character, ItemStunResistCap) - ); - // These have rule-configured caps. b->ATK = CalcCappedItemBonus( b->ATK, item->Attack, ( - attack_cap + + GetStatCap(StatCap::Attack) + itembonuses.ItemATKCap + spellbonuses.ItemATKCap + aabonuses.ItemATKCap ) ); - b->DamageShield = CalcCappedItemBonus(b->DamageShield, item->DamageShield, damage_shield_cap); - b->SpellShield = CalcCappedItemBonus(b->SpellShield, item->SpellShield, spell_shielding_cap); - b->MeleeMitigation = CalcCappedItemBonus(b->MeleeMitigation, item->Shielding, shielding_cap); - b->StunResist = CalcCappedItemBonus(b->StunResist, item->StunResist, stun_resist_cap); - b->StrikeThrough = CalcCappedItemBonus(b->StrikeThrough, item->StrikeThrough, strikethrough_cap); - b->AvoidMeleeChance = CalcCappedItemBonus(b->AvoidMeleeChance, item->Avoidance, avoidance_cap); - b->HitChance = CalcCappedItemBonus(b->HitChance, item->Accuracy, accuracy_cap); - b->ProcChance = CalcCappedItemBonus(b->ProcChance, item->CombatEffects, combat_effects_cap); - b->DoTShielding = CalcCappedItemBonus(b->DoTShielding, item->DotShielding, dot_shielding_cap); - b->HealAmt = CalcCappedItemBonus(b->HealAmt, item->HealAmt, heal_amount_cap); - b->SpellDmg = CalcCappedItemBonus(b->SpellDmg, item->SpellDmg, spell_damage_cap); - b->Clairvoyance = CalcCappedItemBonus(b->Clairvoyance, item->Clairvoyance, clairvoyance_cap); - b->DSMitigation = CalcCappedItemBonus(b->DSMitigation, item->DSMitigation, dsmitigation_cap); + b->AvoidMeleeChance = CalcCappedItemBonus(b->AvoidMeleeChance, item->Avoidance, GetStatCap(StatCap::Avoidance)); + b->Clairvoyance = CalcCappedItemBonus(b->Clairvoyance, item->Clairvoyance, GetStatCap(StatCap::Clairvoyance)); + b->DamageShield = CalcCappedItemBonus(b->DamageShield, item->DamageShield, GetStatCap(StatCap::DamageShield)); + b->DoTShielding = CalcCappedItemBonus(b->DoTShielding, item->DotShielding, GetStatCap(StatCap::DOTShielding)); + b->DSMitigation = CalcCappedItemBonus(b->DSMitigation, item->DSMitigation, GetStatCap(StatCap::DSMitigation)); + b->HealAmt = CalcCappedItemBonus(b->HealAmt, item->HealAmt, GetStatCap(StatCap::HealAmount)); + b->HitChance = CalcCappedItemBonus(b->HitChance, item->Accuracy, GetStatCap(StatCap::Accuracy)); + b->MeleeMitigation = CalcCappedItemBonus(b->MeleeMitigation, item->Shielding, GetStatCap(StatCap::Shielding)); + b->ProcChance = CalcCappedItemBonus(b->ProcChance, item->CombatEffects, GetStatCap(StatCap::CombatEffects)); + b->SpellDmg = CalcCappedItemBonus(b->SpellDmg, item->SpellDmg, GetStatCap(StatCap::SpellDamage)); + b->SpellShield = CalcCappedItemBonus(b->SpellShield, item->SpellShield, GetStatCap(StatCap::SpellShielding)); + b->StrikeThrough = CalcCappedItemBonus(b->StrikeThrough, item->StrikeThrough, GetStatCap(StatCap::Strikethrough)); + b->StunResist = CalcCappedItemBonus(b->StunResist, item->StunResist, GetStatCap(StatCap::StunResist)); if (b->haste < item->Haste) { b->haste = item->Haste; } if (item->ExtraDmgAmt != 0 && item->ExtraDmgSkill <= EQ::skills::HIGHEST_SKILL) { - int extra_damage_cap = ( - IsOfClientBot() ? - GetStatCap(StatCap::ExtraDamage) : - RuleI(Character, ItemExtraDmgCap) - ); if (item->ExtraDmgSkill == ALL_SKILLS) { for (const auto &skill_id: EQ::skills::GetExtraDamageSkills()) { b->SkillDamageAmount[skill_id] = CalcCappedItemBonus( b->SkillDamageAmount[skill_id], item->ExtraDmgAmt, - extra_damage_cap + GetStatCap(StatCap::ExtraDamage) ); } } else { b->SkillDamageAmount[item->ExtraDmgSkill] = CalcCappedItemBonus( b->SkillDamageAmount[item->ExtraDmgSkill], item->ExtraDmgAmt, - extra_damage_cap + GetStatCap(StatCap::ExtraDamage) ); } } diff --git a/zone/mob.cpp b/zone/mob.cpp index 31ab72ce8..d21523380 100644 --- a/zone/mob.cpp +++ b/zone/mob.cpp @@ -2061,20 +2061,10 @@ void Mob::SendStatsWindow(Client* c, bool use_window) for (auto mod2_row_counter = 0; mod2_row_counter < mod2_rows; mod2_row_counter++) { switch (mod2_row_counter) { case 0: { - int avoidance_cap = ( - IsOfClientBot() ? - GetStatCap(StatCap::Avoidance) : - RuleI(Character, ItemAvoidanceCap) - ); - int combat_effects_cap = ( - IsOfClientBot() ? - GetStatCap(StatCap::CombatEffects) : - RuleI(Character, ItemCombatEffectsCap) - ); mod2a_name = "Avoidance"; mod2b_name = "Combat Effects"; - mod2a_cap = Strings::Commify(avoidance_cap); - mod2b_cap = Strings::Commify(combat_effects_cap); + mod2a_cap = Strings::Commify(GetStatCap(StatCap::Avoidance)); + mod2b_cap = Strings::Commify(GetStatCap(StatCap::CombatEffects)); if (IsBot()) { mod2a = Strings::Commify(CastToBot()->GetAvoidance()); @@ -2091,20 +2081,10 @@ void Mob::SendStatsWindow(Client* c, bool use_window) break; } case 1: { - int accuracy_cap = ( - IsOfClientBot() ? - GetStatCap(StatCap::Accuracy) : - RuleI(Character, ItemAccuracyCap) - ); - int strikethrough_cap = ( - IsOfClientBot() ? - GetStatCap(StatCap::Strikethrough) : - RuleI(Character, ItemStrikethroughCap) - ); mod2a_name = "Accuracy"; mod2b_name = "Strikethrough"; - mod2a_cap = Strings::Commify(accuracy_cap); - mod2b_cap = Strings::Commify(strikethrough_cap); + mod2a_cap = Strings::Commify(GetStatCap(StatCap::Accuracy)); + mod2b_cap = Strings::Commify(GetStatCap(StatCap::Strikethrough)); if (IsBot()) { mod2a = Strings::Commify(CastToBot()->GetAccuracy()); @@ -2121,20 +2101,10 @@ void Mob::SendStatsWindow(Client* c, bool use_window) break; } case 2: { - int shielding_cap = ( - IsOfClientBot() ? - GetStatCap(StatCap::Shielding) : - RuleI(Character, ItemShieldingCap) - ); - int spell_shielding_cap = ( - IsOfClientBot() ? - GetStatCap(StatCap::SpellShielding) : - RuleI(Character, ItemSpellShieldingCap) - ); mod2a_name = "Shielding"; mod2b_name = "Spell Shielding"; - mod2a_cap = Strings::Commify(shielding_cap); - mod2b_cap = Strings::Commify(spell_shielding_cap); + mod2a_cap = Strings::Commify(GetStatCap(StatCap::Shielding)); + mod2b_cap = Strings::Commify(GetStatCap(StatCap::SpellShielding)); if (IsBot()) { mod2a = Strings::Commify(CastToBot()->GetShielding()); @@ -2152,20 +2122,10 @@ void Mob::SendStatsWindow(Client* c, bool use_window) break; } case 3: { - int dot_shielding_cap = ( - IsOfClientBot() ? - GetStatCap(StatCap::DOTShielding) : - RuleI(Character, ItemDoTShieldingCap) - ); - int stun_resist_cap = ( - IsOfClientBot() ? - GetStatCap(StatCap::StunResist) : - RuleI(Character, ItemStunResistCap) - ); mod2a_name = "Stun Resist"; mod2b_name = "DOT Shielding"; - mod2a_cap = Strings::Commify(stun_resist_cap); - mod2b_cap = Strings::Commify(dot_shielding_cap); + mod2a_cap = Strings::Commify(GetStatCap(StatCap::DOTShielding)); + mod2b_cap = Strings::Commify(GetStatCap(StatCap::StunResist)); if (IsBot()) { mod2a = Strings::Commify(CastToBot()->GetStunResist()); @@ -2401,11 +2361,6 @@ void Mob::SendStatsWindow(Client* c, bool use_window) final_string += DialogueWindow::Break(1); - int attack_cap = ( - IsOfClientBot() ? - GetStatCap(StatCap::Attack) : - RuleI(Character, ItemATKCap) - ); // Attack 2 final_string += fmt::format( "Offense: {}{}{}{}", @@ -2415,7 +2370,7 @@ void Mob::SendStatsWindow(Client* c, bool use_window) fmt::format( " | Item: {} / {} | Used: {}", Strings::Commify(itembonuses.ATK), - Strings::Commify(attack_cap), + Strings::Commify(GetStatCap(StatCap::Attack)), Strings::Commify(static_cast(itembonuses.ATK * 1.342)) ) : "" @@ -2462,11 +2417,6 @@ void Mob::SendStatsWindow(Client* c, bool use_window) final_string += DialogueWindow::CenterMessage("Haste"); - int haste_cap = ( - IsOfClientBot() ? - GetStatCap(StatCap::Haste) : - RuleI(Character, HasteCap) - ); // Haste Table const auto& haste_table = DialogueWindow::Table( fmt::format( @@ -2485,7 +2435,7 @@ void Mob::SendStatsWindow(Client* c, bool use_window) fmt::format( "{} ({})", IsClient() ? Strings::Commify(CastToClient()->GetHaste()) : Strings::Commify(GetHaste()), - Strings::Commify(haste_cap) + Strings::Commify(GetStatCap(StatCap::Haste)) ) ) ) @@ -2520,41 +2470,26 @@ void Mob::SendStatsWindow(Client* c, bool use_window) // Heal Amount if (GetHealAmt()) { - int cap = ( - IsOfClientBot() ? - GetStatCap(StatCap::HealAmount) : - RuleI(Character, ItemHealAmtCap) - ); final_string += fmt::format( "Heal Amount: {} / {}{}", Strings::Commify(GetHealAmt()), - Strings::Commify(cap), + Strings::Commify(GetStatCap(StatCap::HealAmount)), DialogueWindow::Break(1) ); } // Spell Damage if (GetSpellDmg()) { - int cap = ( - IsOfClientBot() ? - GetStatCap(StatCap::SpellDamage) : - RuleI(Character, ItemSpellDmgCap) - ); final_string += fmt::format( "Spell Damage: {} / {}{}", Strings::Commify(GetSpellDmg()), - Strings::Commify(cap), + Strings::Commify(GetStatCap(StatCap::SpellDamage)), DialogueWindow::Break(1) ); } // Damage Shield if (itembonuses.DamageShield || spellbonuses.DamageShield) { - int cap = ( - IsOfClientBot() ? - GetStatCap(StatCap::DamageShield) : - RuleI(Character, ItemDamageShieldCap) - ); final_string += fmt::format( "Damage Shield: {}{}{}{}", Strings::Commify(itembonuses.DamageShield + spellbonuses.DamageShield), @@ -2568,7 +2503,7 @@ void Mob::SendStatsWindow(Client* c, bool use_window) fmt::format( " | Item: {} / {}", Strings::Commify(itembonuses.DamageShield), - Strings::Commify(cap) + Strings::Commify(GetStatCap(StatCap::DamageShield)) ) : "" ), @@ -2579,15 +2514,10 @@ void Mob::SendStatsWindow(Client* c, bool use_window) // Clairvoyance const auto clairvoyance = IsBot() ? CastToBot()->GetClair() : CastToClient()->GetClair(); if (clairvoyance) { - int cap = ( - IsOfClientBot() ? - GetStatCap(StatCap::Clairvoyance) : - RuleI(Character, ItemClairvoyanceCap) - ); final_string += fmt::format( "Clairvoyance: {} / {}{}", Strings::Commify(clairvoyance), - Strings::Commify(cap), + Strings::Commify(GetStatCap(StatCap::Clairvoyance)), DialogueWindow::Break(1) ); } @@ -2595,15 +2525,10 @@ void Mob::SendStatsWindow(Client* c, bool use_window) // Damage Shield Mitigation const auto ds_mitigation = IsBot() ? CastToBot()->GetDSMit() : CastToClient()->GetDSMit(); if (ds_mitigation) { - int cap = ( - IsOfClientBot() ? - GetStatCap(StatCap::DSMitigation) : - RuleI(Character, ItemDSMitigationCap) - ); final_string += fmt::format( "DS Mitigation: {} / {}{}", Strings::Commify(ds_mitigation), - Strings::Commify(cap), + Strings::Commify(GetStatCap(StatCap::DSMitigation)), DialogueWindow::Break(1) ); } @@ -2632,12 +2557,6 @@ void Mob::SendStatsWindow(Client* c, bool use_window) final_string += faction_item_string; } - int damage_shield_cap = ( - IsOfClientBot() ? - GetStatCap(StatCap::DamageShield) : - RuleI(Character, ItemDamageShieldCap) - ); - if (use_window) { if (final_string.size() < 4096) { const uint32 popup_buttons = (c->ClientVersion() < EQ::versions::ClientVersion::SoD) ? 0 : 1; @@ -2679,7 +2598,7 @@ void Mob::SendStatsWindow(Client* c, bool use_window) GetRaceIDName(GetRace()), GetRace(), IsBot() ? Strings::Commify(CastToBot()->GetDS()) : Strings::Commify(CastToClient()->GetDS()), - Strings::Commify(damage_shield_cap), + Strings::Commify(GetStatCap(StatCap::DamageShield)), GetSize(), GetRunspeed(), IsBot() ? static_cast(CastToBot()->CalcCurrentWeight()) / 10.0f : static_cast(CastToClient()->CalcCurrentWeight()) / 10.0f, @@ -2783,17 +2702,12 @@ void Mob::SendStatsWindow(Client* c, bool use_window) ); if ((IsClient() && CastToClient()->GetHaste()) || (!IsClient() && GetHaste())) { - int haste_cap = ( - IsOfClientBot() ? - GetStatCap(StatCap::Haste) : - RuleI(Character, HasteCap) - ); c->Message( Chat::White, fmt::format( "Haste: {}/{} (Item: {} + Spell: {} + Over: {})", IsClient() ? Strings::Commify(CastToClient()->GetHaste()) : Strings::Commify(GetHaste()), - Strings::Commify(haste_cap), + Strings::Commify(GetStatCap(StatCap::Haste)), Strings::Commify(itembonuses.haste), Strings::Commify(spellbonuses.haste + spellbonuses.hastetype2), Strings::Commify(spellbonuses.hastetype3 + extra_haste)