diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 58528e5ebc4..98a96686934 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -6654,8 +6654,8 @@ void Player::RewardReputation(Unit* victim, float rate) FactionEntry const* factionEntry1 = sFactionStore.LookupEntry(ChampioningFaction ? ChampioningFaction : Rep->RepFaction1); uint32 current_reputation_rank1 = GetReputationMgr().GetRank(factionEntry1); - if (factionEntry1 && current_reputation_rank1 <= Rep->ReputationMaxCap1) - GetReputationMgr().ModifyReputation(factionEntry1, donerep1); + if (factionEntry1) + GetReputationMgr().ModifyReputation(factionEntry1, donerep1, current_reputation_rank1 > Rep->ReputationMaxCap1); } if (Rep->RepFaction2 && (!Rep->TeamDependent || team == HORDE)) @@ -6665,8 +6665,8 @@ void Player::RewardReputation(Unit* victim, float rate) FactionEntry const* factionEntry2 = sFactionStore.LookupEntry(ChampioningFaction ? ChampioningFaction : Rep->RepFaction2); uint32 current_reputation_rank2 = GetReputationMgr().GetRank(factionEntry2); - if (factionEntry2 && current_reputation_rank2 <= Rep->ReputationMaxCap2) - GetReputationMgr().ModifyReputation(factionEntry2, donerep2); + if (factionEntry2) + GetReputationMgr().ModifyReputation(factionEntry2, donerep2, current_reputation_rank2 > Rep->ReputationMaxCap2); } } diff --git a/src/server/game/Reputation/ReputationMgr.cpp b/src/server/game/Reputation/ReputationMgr.cpp index c1020e53bf4..db7aa6f96b1 100644 --- a/src/server/game/Reputation/ReputationMgr.cpp +++ b/src/server/game/Reputation/ReputationMgr.cpp @@ -286,7 +286,7 @@ void ReputationMgr::Initialize() } } -bool ReputationMgr::SetReputation(FactionEntry const* factionEntry, int32 standing, bool incremental) +bool ReputationMgr::SetReputation(FactionEntry const* factionEntry, int32 standing, bool incremental, bool spillOverOnly) { sScriptMgr->OnPlayerReputationChange(_player, factionEntry->ID, standing, incremental); bool res = false; @@ -350,7 +350,10 @@ bool ReputationMgr::SetReputation(FactionEntry const* factionEntry, int32 standi FactionStateList::iterator faction = _factions.find(factionEntry->reputationListID); if (faction != _factions.end()) { - res = SetOneFactionReputation(factionEntry, standing, incremental); + // if we update spillover only, do not update main reputation (rank exceeds creature reward rate) + if (!spillOverOnly) + res = SetOneFactionReputation(factionEntry, standing, incremental); + // only this faction gets reported to client, even if it has no own visible standing SendState(&faction->second); } diff --git a/src/server/game/Reputation/ReputationMgr.h b/src/server/game/Reputation/ReputationMgr.h index 9a78bc94a9b..e35f0f0a8cf 100644 --- a/src/server/game/Reputation/ReputationMgr.h +++ b/src/server/game/Reputation/ReputationMgr.h @@ -118,11 +118,11 @@ class TC_GAME_API ReputationMgr public: // modifiers bool SetReputation(FactionEntry const* factionEntry, int32 standing) { - return SetReputation(factionEntry, standing, false); + return SetReputation(factionEntry, standing, false, false); } - bool ModifyReputation(FactionEntry const* factionEntry, int32 standing) + bool ModifyReputation(FactionEntry const* factionEntry, int32 standing, bool spillOverOnly = false) { - return SetReputation(factionEntry, standing, true); + return SetReputation(factionEntry, standing, true, spillOverOnly); } void SetVisible(FactionTemplateEntry const* factionTemplateEntry); @@ -144,7 +144,7 @@ class TC_GAME_API ReputationMgr private: // internal helper functions void Initialize(); uint32 GetDefaultStateFlags(FactionEntry const* factionEntry) const; - bool SetReputation(FactionEntry const* factionEntry, int32 standing, bool incremental); + bool SetReputation(FactionEntry const* factionEntry, int32 standing, bool incremental, bool spillOverOnly); void SetVisible(FactionState* faction); void SetAtWar(FactionState* faction, bool atWar) const; void SetInactive(FactionState* faction, bool inactive) const;