From da5fb6c9f824e8d8f299bfe4f5839157a08eec9c Mon Sep 17 00:00:00 2001 From: Peter Date: Sun, 12 Oct 2025 13:30:02 +0200 Subject: [PATCH] feat(Core): BG reputation modifier for WSG, AB and AV (#22685) Co-authored-by: Zoidwaffle --- .../apps/worldserver/worldserver.conf.dist | 12 ++++ .../Battlegrounds/Zones/BattlegroundAB.cpp | 3 +- .../game/Battlegrounds/Zones/BattlegroundAB.h | 1 + .../Battlegrounds/Zones/BattlegroundAV.cpp | 69 ++++++++++--------- .../game/Battlegrounds/Zones/BattlegroundAV.h | 1 + .../Battlegrounds/Zones/BattlegroundWS.cpp | 6 +- .../game/Battlegrounds/Zones/BattlegroundWS.h | 1 + src/server/game/World/WorldConfig.cpp | 3 + src/server/game/World/WorldConfig.h | 3 + 9 files changed, 63 insertions(+), 36 deletions(-) diff --git a/src/server/apps/worldserver/worldserver.conf.dist b/src/server/apps/worldserver/worldserver.conf.dist index 89863ac4f..07945f07f 100644 --- a/src/server/apps/worldserver/worldserver.conf.dist +++ b/src/server/apps/worldserver/worldserver.conf.dist @@ -2350,6 +2350,18 @@ Rate.Reputation.LowLevel.Quest = 1 Rate.Reputation.RecruitAFriendBonus = 0.1 +# +# Rate.Reputation.Gain.WSG +# Rate.Reputation.Gain.AB +# Rate.Reputation.Gain.AV +# Description: Reputation bonus rate for WSG, AB and AV battlegrounds. +# This is applied IN ADDITION to the global Rate.Reputation.Gain. +# Default: 1 + +Rate.Reputation.Gain.WSG = 1 +Rate.Reputation.Gain.AB = 1 +Rate.Reputation.Gain.AV = 1 + # ################################################################################################### diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp index 10c0956e5..d1aa246ab 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp @@ -115,7 +115,7 @@ void BattlegroundAB::PostUpdateImpl(uint32 diff) if (honorRewards < uint8(m_TeamScores[teamId] / _honorTics)) RewardHonorToTeam(GetBonusHonorFromKill(1), teamId); if (reputationRewards < uint8(m_TeamScores[teamId] / _reputationTics)) - RewardReputationToTeam(teamId == TEAM_ALLIANCE ? 509 : 510, 10, teamId); + RewardReputationToTeam(teamId == TEAM_ALLIANCE ? 509 : 510, uint32(10 * _abReputationRate), teamId); if (information < uint8(m_TeamScores[teamId] / BG_AB_WARNING_NEAR_VICTORY_SCORE)) { if (teamId == TEAM_ALLIANCE) @@ -421,6 +421,7 @@ bool BattlegroundAB::SetupBattleground() { _honorTics = BattlegroundMgr::IsBGWeekend(GetBgTypeID(true)) ? BG_AB_HONOR_TICK_WEEKEND : BG_AB_HONOR_TICK_NORMAL; _reputationTics = BattlegroundMgr::IsBGWeekend(GetBgTypeID(true)) ? BG_AB_REP_TICK_WEEKEND : BG_AB_REP_TICK_NORMAL; + _abReputationRate = sWorld->getRate(RATE_REPUTATION_GAIN_AB); for (uint32 i = 0; i < BG_AB_DYNAMIC_NODES_COUNT; ++i) { diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAB.h b/src/server/game/Battlegrounds/Zones/BattlegroundAB.h index a250c9f16..61aee582d 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundAB.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundAB.h @@ -299,6 +299,7 @@ private: EventMap _bgEvents; uint32 _honorTics; uint32 _reputationTics; + float _abReputationRate; uint8 _controlledPoints[PVP_TEAMS_COUNT] {}; bool _teamScores500Disadvantage[PVP_TEAMS_COUNT] {}; uint32 _configurableMaxTeamScore; diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp index 5b6a8b335..b65daf5d9 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp @@ -194,21 +194,21 @@ void BattlegroundAV::HandleQuestComplete(uint32 questid, Player* player) case AV_QUEST_A_COMMANDER1: case AV_QUEST_H_COMMANDER1: m_Team_QuestStatus[teamId][1]++; - RewardReputationToTeam(teamId, 1, teamId); + RewardReputationToTeam(teamId, uint32(1 * _avReputationRate), teamId); if (m_Team_QuestStatus[teamId][1] == 30) LOG_DEBUG("bg.battleground", "BG_AV Quest {} completed (need to implement some events here", questid); break; case AV_QUEST_A_COMMANDER2: case AV_QUEST_H_COMMANDER2: m_Team_QuestStatus[teamId][2]++; - RewardReputationToTeam(teamId, 1, teamId); + RewardReputationToTeam(teamId, uint32(1 * _avReputationRate), teamId); if (m_Team_QuestStatus[teamId][2] == 60) LOG_DEBUG("bg.battleground", "BG_AV Quest {} completed (need to implement some events here", questid); break; case AV_QUEST_A_COMMANDER3: case AV_QUEST_H_COMMANDER3: m_Team_QuestStatus[teamId][3]++; - RewardReputationToTeam(teamId, 1, teamId); + RewardReputationToTeam(teamId, uint32(1 * _avReputationRate), teamId); if (m_Team_QuestStatus[teamId][3] == 120) LOG_DEBUG("bg.battleground", "BG_AV Quest {} completed (need to implement some events here", questid); break; @@ -316,21 +316,21 @@ Creature* BattlegroundAV::AddAVCreature(uint16 cinfoid, uint16 type) type -= AV_CPLACE_MAX; cinfoid = uint16(BG_AV_StaticCreaturePos[type][4]); creature = AddCreature(BG_AV_StaticCreatureInfo[cinfoid], - type + AV_CPLACE_MAX, - BG_AV_StaticCreaturePos[type][0], - BG_AV_StaticCreaturePos[type][1], - BG_AV_StaticCreaturePos[type][2], - BG_AV_StaticCreaturePos[type][3]); + type + AV_CPLACE_MAX, + BG_AV_StaticCreaturePos[type][0], + BG_AV_StaticCreaturePos[type][1], + BG_AV_StaticCreaturePos[type][2], + BG_AV_StaticCreaturePos[type][3]); isStatic = true; } else { creature = AddCreature(BG_AV_CreatureInfo[cinfoid], - type, - BG_AV_CreaturePos[type][0], - BG_AV_CreaturePos[type][1], - BG_AV_CreaturePos[type][2], - BG_AV_CreaturePos[type][3]); + type, + BG_AV_CreaturePos[type][0], + BG_AV_CreaturePos[type][1], + BG_AV_CreaturePos[type][2], + BG_AV_CreaturePos[type][3]); } if (!creature) return nullptr; @@ -344,7 +344,7 @@ Creature* BattlegroundAV::AddAVCreature(uint16 cinfoid, uint16 type) (cinfoid >= AV_NPC_H_GRAVEDEFENSE0 && cinfoid <= AV_NPC_H_GRAVEDEFENSE3)))) { if (!isStatic && ((cinfoid >= AV_NPC_A_GRAVEDEFENSE0 && cinfoid <= AV_NPC_A_GRAVEDEFENSE3) - || (cinfoid >= AV_NPC_H_GRAVEDEFENSE0 && cinfoid <= AV_NPC_H_GRAVEDEFENSE3))) + || (cinfoid >= AV_NPC_H_GRAVEDEFENSE0 && cinfoid <= AV_NPC_H_GRAVEDEFENSE3))) { CreatureData& data = sObjectMgr->NewOrExistCreatureData(creature->GetSpawnId()); data.wander_distance = 5; @@ -814,11 +814,11 @@ void BattlegroundAV::PopulateNode(BG_AV_Nodes node) if (!trigger) { trigger = AddCreature(WORLD_TRIGGER, - node + 302, - BG_AV_CreaturePos[node + 302][0], - BG_AV_CreaturePos[node + 302][1], - BG_AV_CreaturePos[node + 302][2], - BG_AV_CreaturePos[node + 302][3]); + node + 302, + BG_AV_CreaturePos[node + 302][0], + BG_AV_CreaturePos[node + 302][1], + BG_AV_CreaturePos[node + 302][2], + BG_AV_CreaturePos[node + 302][3]); } //add bonus honor aura trigger creature when node is accupied @@ -1240,25 +1240,28 @@ GraveyardStruct const* BattlegroundAV::GetClosestGraveyard(Player* player) bool BattlegroundAV::SetupBattleground() { + _avReputationRate = sWorld->getRate(RATE_REPUTATION_GAIN_AV); + if (sBattlegroundMgr->IsBGWeekend(GetBgTypeID(true))) { - _reputationTower = 18; - _reputationCaptain = 185; - _reputationBoss = 525; - _reputationPerOwnedGraveyard = 18; - _reputationSurvivingCaptain = 175; - _reputationSurvivingTower = 18; - _reputationPerOwnedMine = 36; + _reputationTower = uint32(18 * _avReputationRate); + _reputationCaptain = uint32(185 * _avReputationRate); + _reputationBoss = uint32(525 * _avReputationRate); + _reputationPerOwnedGraveyard = uint32(18 * _avReputationRate); + _reputationSurvivingCaptain = uint32(175 * _avReputationRate); + _reputationSurvivingTower = uint32(18 * _avReputationRate); + _reputationPerOwnedMine = uint32(36 * _avReputationRate); } else { - _reputationTower = 12; - _reputationCaptain = 125; - _reputationBoss = sWorld->getIntConfig(CONFIG_BATTLEGROUND_ALTERAC_REP_ONBOSSDEATH); - _reputationPerOwnedGraveyard = 12; - _reputationSurvivingCaptain = 125; - _reputationSurvivingTower = 12; - _reputationPerOwnedMine = 24; + _reputationTower = uint32(12 * _avReputationRate); + _reputationCaptain = uint32(125 * _avReputationRate); + // Special case: This value comes from another config setting, but we still apply our multiplier + _reputationBoss = uint32(sWorld->getIntConfig(CONFIG_BATTLEGROUND_ALTERAC_REP_ONBOSSDEATH) * _avReputationRate); + _reputationPerOwnedGraveyard = uint32(12 * _avReputationRate); + _reputationSurvivingCaptain = uint32(125 * _avReputationRate); + _reputationSurvivingTower = uint32(12 * _avReputationRate); + _reputationPerOwnedMine = uint32(24 * _avReputationRate); } // Create starting objects diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAV.h b/src/server/game/Battlegrounds/Zones/BattlegroundAV.h index a058f1d98..c8a0fd8cd 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundAV.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundAV.h @@ -1846,6 +1846,7 @@ private: uint32 _reputationSurvivingCaptain = 0; // 125, 175 uint32 _reputationSurvivingTower = 0; // 12, 18 uint32 _reputationPerOwnedMine = 0; // 24, 36 + float _avReputationRate; bool m_IsInformedNearVictory[2] {}; }; diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp index 272f07fba..974e1d67a 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp @@ -426,15 +426,17 @@ void BattlegroundWS::HandleAreaTrigger(Player* player, uint32 trigger) bool BattlegroundWS::SetupBattleground() { + _wsReputationRate = sWorld->getRate(RATE_REPUTATION_GAIN_WSG); + if (sBattlegroundMgr->IsBGWeekend(GetBgTypeID(true))) { - _reputationCapture = 45; + _reputationCapture = uint32(45 * _wsReputationRate); _honorWinKills = 3; _honorEndKills = 4; } else { - _reputationCapture = 35; + _reputationCapture = uint32(35 * _wsReputationRate); _honorWinKills = 1; _honorEndKills = 2; } diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundWS.h b/src/server/game/Battlegrounds/Zones/BattlegroundWS.h index 61fa2516e..7aa897500 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundWS.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundWS.h @@ -258,6 +258,7 @@ private: ObjectGuid _droppedFlagGUID[2]; uint8 _flagState[2]; TeamId _lastFlagCaptureTeam; + float _wsReputationRate; uint32 _reputationCapture; uint32 _honorWinKills; uint32 _honorEndKills; diff --git a/src/server/game/World/WorldConfig.cpp b/src/server/game/World/WorldConfig.cpp index eedd61eaf..7ee1b6f6d 100644 --- a/src/server/game/World/WorldConfig.cpp +++ b/src/server/game/World/WorldConfig.cpp @@ -85,6 +85,9 @@ void WorldConfig::BuildConfigCache() SetConfigValue(RATE_BUYVALUE_ITEM_HEIRLOOM, "Rate.BuyValue.Item.Heirloom", 1.0f); SetConfigValue(RATE_REPUTATION_GAIN, "Rate.Reputation.Gain", 1.0f); + SetConfigValue(RATE_REPUTATION_GAIN_AB, "Rate.Reputation.Gain.AB", 1.0f); + SetConfigValue(RATE_REPUTATION_GAIN_AV, "Rate.Reputation.Gain.AV", 1.0f); + SetConfigValue(RATE_REPUTATION_GAIN_WSG, "Rate.Reputation.Gain.WSG", 1.0f); SetConfigValue(RATE_REPUTATION_LOWLEVEL_KILL, "Rate.Reputation.LowLevel.Kill", 1.0f); SetConfigValue(RATE_REPUTATION_LOWLEVEL_QUEST, "Rate.Reputation.LowLevel.Quest", 1.0f); SetConfigValue(RATE_REPUTATION_RECRUIT_A_FRIEND_BONUS, "Rate.Reputation.RecruitAFriendBonus", 0.1f); diff --git a/src/server/game/World/WorldConfig.h b/src/server/game/World/WorldConfig.h index ce089b65a..f076d0b29 100644 --- a/src/server/game/World/WorldConfig.h +++ b/src/server/game/World/WorldConfig.h @@ -437,6 +437,9 @@ enum ServerConfigs RATE_XP_PET_NEXT_LEVEL, RATE_REPAIRCOST, RATE_REPUTATION_GAIN, + RATE_REPUTATION_GAIN_AB, + RATE_REPUTATION_GAIN_AV, + RATE_REPUTATION_GAIN_WSG, RATE_REPUTATION_LOWLEVEL_KILL, RATE_REPUTATION_LOWLEVEL_QUEST, RATE_REPUTATION_RECRUIT_A_FRIEND_BONUS,