diff options
| author | Shauren <shauren.trinity@gmail.com> | 2025-09-24 00:21:31 +0200 |
|---|---|---|
| committer | Shauren <shauren.trinity@gmail.com> | 2025-09-24 00:21:31 +0200 |
| commit | c56d18287dad88b214b4a33ccd785484b165acbe (patch) | |
| tree | d63a7b88ba52ff1afe0b705fbf341282c6881f3b /src/server/game/Entities | |
| parent | 5fad0fb43af8498c1ae6d4bc79f47fe318d391c8 (diff) | |
Core/Auras: Corrected SPELL_AURA_MOD_HONOR_GAIN_PCT implementation - it should only increase honor gains from some sources
Diffstat (limited to 'src/server/game/Entities')
| -rw-r--r-- | src/server/game/Entities/Player/KillRewarder.cpp | 2 | ||||
| -rw-r--r-- | src/server/game/Entities/Player/Player.cpp | 12 | ||||
| -rw-r--r-- | src/server/game/Entities/Player/Player.h | 18 |
3 files changed, 24 insertions, 8 deletions
diff --git a/src/server/game/Entities/Player/KillRewarder.cpp b/src/server/game/Entities/Player/KillRewarder.cpp index 742d97761bf..8197fc36158 100644 --- a/src/server/game/Entities/Player/KillRewarder.cpp +++ b/src/server/game/Entities/Player/KillRewarder.cpp @@ -134,7 +134,7 @@ inline void KillRewarder::_RewardHonor(Player* player) { // Rewarded player must be alive. if (player->IsAlive()) - player->RewardHonor(_victim, _count, -1, true); + player->RewardHonor(_victim, _count, -1, HonorGainSource::Kill); } inline void KillRewarder::_RewardXP(Player* player, float rate) diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 3e2c88b1036..b40f949e0d3 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -6746,7 +6746,7 @@ void Player::UpdateHonorFields() ///Calculate the amount of honor gained based on the victim ///and the size of the group for which the honor is divided ///An exact honor value can also be given (overriding the calcs) -bool Player::RewardHonor(Unit* victim, uint32 groupsize, int32 honor, bool pvptoken) +bool Player::RewardHonor(Unit* victim, uint32 groupsize, int32 honor, HonorGainSource source) { // do not reward honor in arenas, but enable onkill spellproc if (InArena()) @@ -6847,7 +6847,7 @@ bool Player::RewardHonor(Unit* victim, uint32 groupsize, int32 honor, bool pvpto honor_f /= groupsize; // apply honor multiplier from aura (not stacking-get highest) - AddPct(honor_f, GetMaxPositiveAuraModifier(SPELL_AURA_MOD_HONOR_GAIN_PCT)); + AddPct(honor_f, GetMaxPositiveAuraModifierByMiscMask(SPELL_AURA_MOD_HONOR_GAIN_PCT_FROM_SOURCE, 1 << AsUnderlyingType(source))); honor_f += _restMgr->GetRestBonusFor(REST_TYPE_HONOR, honor_f); } @@ -6873,11 +6873,11 @@ bool Player::RewardHonor(Unit* victim, uint32 groupsize, int32 honor, bool pvpto { if (Battleground* bg = GetBattleground()) { - bg->UpdatePlayerScore(this, SCORE_BONUS_HONOR, honor, false); //false: prevent looping + bg->UpdatePlayerScore(this, SCORE_BONUS_HONOR, honor, false, source); //false: prevent looping } } - if (sWorld->getBoolConfig(CONFIG_PVP_TOKEN_ENABLE) && pvptoken) + if (sWorld->getBoolConfig(CONFIG_PVP_TOKEN_ENABLE) && source == HonorGainSource::Kill) { if (!victim || victim == this || victim->HasAuraType(SPELL_AURA_NO_PVP_CREDIT)) return true; @@ -7828,7 +7828,7 @@ void Player::DuelComplete(DuelCompleteType type) // Honor points after duel (the winner) - ImpConfig if (uint32 amount = sWorld->getIntConfig(CONFIG_HONOR_AFTER_DUEL)) - opponent->RewardHonor(nullptr, 1, amount); + opponent->RewardHonor(nullptr, 1, amount, HonorGainSource::Kill); break; default: @@ -15091,7 +15091,7 @@ void Player::RewardQuest(Quest const* quest, LootItemType rewardType, uint32 rew // honor reward if (uint32 honor = quest->CalculateHonorGain(GetLevel())) - RewardHonor(nullptr, 0, honor); + RewardHonor(nullptr, 0, honor, HonorGainSource::Quest); // title reward if (quest->GetRewTitle()) diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h index c12d6cf311d..51c91183d20 100644 --- a/src/server/game/Entities/Player/Player.h +++ b/src/server/game/Entities/Player/Player.h @@ -336,6 +336,22 @@ enum ActionButtonType ACTION_BUTTON_ITEM = 0x80 }; +enum class HonorGainSource : uint8 +{ + Kill = 0, + Quest = 1, + ArenaCompletion = 2, + BGCompletion = 3, + LFG = 4, + TeamContribution = 5, + RankedBGCompletion = 6, + RatedArenaCompletion = 7, + ArenaSkirmishCompletion = 8, + RandomBGCompletion = 9, + HolidayBGCompletion = 10, + Spell = 11, +}; + enum ReputationSource { REPUTATION_SOURCE_KILL, @@ -2360,7 +2376,7 @@ class TC_GAME_API Player final : public Unit, public GridObject<Player> /*** PVP SYSTEM ***/ /*********************************************************/ void UpdateHonorFields(); - bool RewardHonor(Unit* victim, uint32 groupsize, int32 honor = -1, bool pvptoken = false); + bool RewardHonor(Unit* victim, uint32 groupsize, int32 honor = -1, HonorGainSource source = HonorGainSource::Kill); void ResetHonorStats(); uint32 GetMaxPersonalArenaRatingRequirement(uint32 minarenaslot) const; |
