aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Battlegrounds/Battleground.cpp
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2025-09-24 00:21:31 +0200
committerShauren <shauren.trinity@gmail.com>2025-09-24 00:21:31 +0200
commitc56d18287dad88b214b4a33ccd785484b165acbe (patch)
treed63a7b88ba52ff1afe0b705fbf341282c6881f3b /src/server/game/Battlegrounds/Battleground.cpp
parent5fad0fb43af8498c1ae6d4bc79f47fe318d391c8 (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/Battlegrounds/Battleground.cpp')
-rw-r--r--src/server/game/Battlegrounds/Battleground.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/server/game/Battlegrounds/Battleground.cpp b/src/server/game/Battlegrounds/Battleground.cpp
index 9c2468a95c9..1f55c0ccb86 100644
--- a/src/server/game/Battlegrounds/Battleground.cpp
+++ b/src/server/game/Battlegrounds/Battleground.cpp
@@ -576,7 +576,7 @@ void Battleground::RewardHonorToTeam(uint32 Honor, Team team)
{
for (BattlegroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
if (Player* player = _GetPlayerForTeam(team, itr, "RewardHonorToTeam"))
- UpdatePlayerScore(player, SCORE_BONUS_HONOR, Honor);
+ UpdatePlayerScore(player, SCORE_BONUS_HONOR, Honor, true, HonorGainSource::TeamContribution);
}
void Battleground::RewardReputationToTeam(uint32 faction_id, uint32 Reputation, Team team)
@@ -726,7 +726,11 @@ void Battleground::EndBattleground(Team winner)
if (BattlegroundMgr::IsRandomBattleground(bgPlayer->queueTypeId.BattlemasterListId)
|| BattlegroundMgr::IsBGWeekend(BattlegroundTypeId(bgPlayer->queueTypeId.BattlemasterListId)))
{
- UpdatePlayerScore(player, SCORE_BONUS_HONOR, GetBonusHonorFromKill(winnerKills));
+ HonorGainSource source = HonorGainSource::BGCompletion;
+ if (!player->GetRandomWinner())
+ source = BattlegroundMgr::IsRandomBattleground(bgPlayer->queueTypeId.BattlemasterListId) ? HonorGainSource::RandomBGCompletion : HonorGainSource::HolidayBGCompletion;
+
+ UpdatePlayerScore(player, SCORE_BONUS_HONOR, GetBonusHonorFromKill(winnerKills), true, source);
if (!player->GetRandomWinner())
{
player->SetRandomWinner(true);
@@ -756,7 +760,7 @@ void Battleground::EndBattleground(Team winner)
{
if (BattlegroundMgr::IsRandomBattleground(bgPlayer->queueTypeId.BattlemasterListId)
|| BattlegroundMgr::IsBGWeekend(BattlegroundTypeId(bgPlayer->queueTypeId.BattlemasterListId)))
- UpdatePlayerScore(player, SCORE_BONUS_HONOR, GetBonusHonorFromKill(loserKills));
+ UpdatePlayerScore(player, SCORE_BONUS_HONOR, GetBonusHonorFromKill(loserKills), true, HonorGainSource::BGCompletion);
}
}
@@ -1279,14 +1283,14 @@ BattlegroundScore const* Battleground::GetBattlegroundScore(Player* player) cons
return Trinity::Containers::MapGetValuePtr(PlayerScores, player->GetGUID());
}
-bool Battleground::UpdatePlayerScore(Player* player, uint32 type, uint32 value, bool doAddHonor)
+bool Battleground::UpdatePlayerScore(Player* player, uint32 type, uint32 value, bool doAddHonor, Optional<HonorGainSource> source)
{
BattlegroundScoreMap::const_iterator itr = PlayerScores.find(player->GetGUID());
if (itr == PlayerScores.end()) // player not found...
return false;
if (type == SCORE_BONUS_HONOR && doAddHonor && isBattleground())
- player->RewardHonor(nullptr, 1, value); // RewardHonor calls UpdatePlayerScore with doAddHonor = false
+ player->RewardHonor(nullptr, 1, value, source.value_or(HonorGainSource::Kill)); // RewardHonor calls UpdatePlayerScore with doAddHonor = false
else
itr->second->UpdateScore(type, value);