aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Battlegrounds
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
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')
-rw-r--r--src/server/game/Battlegrounds/Battleground.cpp14
-rw-r--r--src/server/game/Battlegrounds/Battleground.h4
2 files changed, 12 insertions, 6 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);
diff --git a/src/server/game/Battlegrounds/Battleground.h b/src/server/game/Battlegrounds/Battleground.h
index b1dad05c67f..32b6075e94a 100644
--- a/src/server/game/Battlegrounds/Battleground.h
+++ b/src/server/game/Battlegrounds/Battleground.h
@@ -21,6 +21,7 @@
#include "DBCEnums.h"
#include "Duration.h"
#include "ObjectGuid.h"
+#include "Optional.h"
#include "Position.h"
#include "SharedDefines.h"
#include "UniqueTrackablePtr.h"
@@ -43,6 +44,7 @@ struct BattlegroundScore;
struct BattlegroundTemplate;
struct PVPDifficultyEntry;
struct WorldSafeLocsEntry;
+enum class HonorGainSource : uint8;
namespace WorldPackets
{
@@ -378,7 +380,7 @@ class TC_GAME_API Battleground
BattlegroundScore const* GetBattlegroundScore(Player* player) const;
- bool UpdatePlayerScore(Player* player, uint32 type, uint32 value, bool doAddHonor = true);
+ bool UpdatePlayerScore(Player* player, uint32 type, uint32 value, bool doAddHonor = true, Optional<HonorGainSource> source = {});
void UpdatePvpStat(Player* player, uint32 pvpStatId, uint32 value);
static TeamId GetTeamIndexByTeamId(Team team) { return team == ALLIANCE ? TEAM_ALLIANCE : TEAM_HORDE; }