From 1863d142fc214488b793eed67ac83ec992fe3952 Mon Sep 17 00:00:00 2001 From: valsan-azerty-boi <52854501+valsan-azerty-boi@users.noreply.github.com> Date: Thu, 9 Jan 2025 20:22:52 +0100 Subject: [PATCH] feat(Core/Conf/BG): allow battlegrounds to be more configurable (#20320) --- .../apps/worldserver/worldserver.conf.dist | 44 +++++++++++++++++++ .../Battlegrounds/Zones/BattlegroundAB.cpp | 13 ++++-- .../game/Battlegrounds/Zones/BattlegroundAB.h | 1 + .../Battlegrounds/Zones/BattlegroundAV.cpp | 12 +++-- .../game/Battlegrounds/Zones/BattlegroundAV.h | 12 ++--- .../Battlegrounds/Zones/BattlegroundEY.cpp | 13 ++++-- .../game/Battlegrounds/Zones/BattlegroundEY.h | 1 + .../Battlegrounds/Zones/BattlegroundWS.cpp | 11 +++-- .../game/Battlegrounds/Zones/BattlegroundWS.h | 1 + src/server/game/World/IWorld.h | 5 +++ src/server/game/World/World.cpp | 6 +++ 11 files changed, 99 insertions(+), 20 deletions(-) diff --git a/src/server/apps/worldserver/worldserver.conf.dist b/src/server/apps/worldserver/worldserver.conf.dist index 0041bf486a6929..91859fc16143cf 100644 --- a/src/server/apps/worldserver/worldserver.conf.dist +++ b/src/server/apps/worldserver/worldserver.conf.dist @@ -3708,6 +3708,50 @@ Battleground.SpeedBuffRespawn = 150 Battleground.Override.LowLevels.MinPlayers = 0 +# +# Battleground.Warsong.Flags +# Description: Set the number of flags required for a team to win in Warsong battleground +# Default: 3 (Blizzlike) +# 1 (Minimum) + +Battleground.Warsong.Flags = 3 + +# +# Battleground.Arathi.CapturePoints +# Description: Set the number of capture points required for a team to win in Arathi battleground +# Default: 1600 (Blizzlike) +# 2000 (Vanilla like) + +Battleground.Arathi.CapturePoints = 1600 + +# +# Battleground.Alterac.Reinforcements +# Description: Set the number of total reinforcements for each teams in Alterac battleground +# (It is necessary to restart the server after changing the Reinforcements value) +# Default: 600 (Enabled, Blizzlike) +# 500 (Enabled, MoP like) +# 0 (Disabled, early vanilla like, victory only on boss death) + +Battleground.Alterac.Reinforcements = 600 + +# +# Battleground.Alterac.ReputationOnBossDeath +# Description: Set the number of rep point given for a boss killed in Alterac battleground +# (It is necessary to restart the server after changing the ReputationOnBossDeath value) +# Default: 350 (Enabled, Blizzlike) +# 389 (Enabled, Vanilla like) + +Battleground.Alterac.ReputationOnBossDeath = 350 + +# +# Battleground.EyeOfTheStorm.CapturePoints +# Description: Set the number of capture points required for a team to win in Eye of the Storm battleground +# (The UI part of the max team score will not be compliant with this parameter without client modification) +# Default: 1600 (Blizzlike, UI compliant) +# 2000 (TBC like) + +Battleground.EyeOfTheStorm.CapturePoints = 1600 + # ################################################################################################### diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp index 4cc94a60dae84c..88ba89b1556fcf 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp @@ -107,8 +107,8 @@ void BattlegroundAB::PostUpdateImpl(uint32 diff) auto reputationRewards = uint8(m_TeamScores[teamId] / _reputationTics); auto information = uint8(m_TeamScores[teamId] / BG_AB_WARNING_NEAR_VICTORY_SCORE); m_TeamScores[teamId] += BG_AB_TickPoints[controlledPoints]; - if (m_TeamScores[teamId] > BG_AB_MAX_TEAM_SCORE) - m_TeamScores[teamId] = BG_AB_MAX_TEAM_SCORE; + if (m_TeamScores[teamId] > _configurableMaxTeamScore) + m_TeamScores[teamId] = _configurableMaxTeamScore; if (honorRewards < uint8(m_TeamScores[teamId] / _honorTics)) RewardHonorToTeam(GetBonusHonorFromKill(1), teamId); @@ -131,7 +131,7 @@ void BattlegroundAB::PostUpdateImpl(uint32 diff) UpdateWorldState(teamId == TEAM_ALLIANCE ? BG_AB_OP_RESOURCES_ALLY : BG_AB_OP_RESOURCES_HORDE, m_TeamScores[teamId]); if (m_TeamScores[teamId] > m_TeamScores[GetOtherTeamId(teamId)] + 500) _teamScores500Disadvantage[GetOtherTeamId(teamId)] = true; - if (m_TeamScores[teamId] >= BG_AB_MAX_TEAM_SCORE) + if (m_TeamScores[teamId] >= _configurableMaxTeamScore) EndBattleground(teamId); _bgEvents.ScheduleEvent(eventId, BG_AB_TickIntervals[controlledPoints]); @@ -247,7 +247,7 @@ void BattlegroundAB::FillInitialWorldStates(WorldPacket& data) data << uint32(BG_AB_OP_OCCUPIED_BASES_ALLY) << uint32(_controlledPoints[TEAM_ALLIANCE]); data << uint32(BG_AB_OP_OCCUPIED_BASES_HORDE) << uint32(_controlledPoints[TEAM_HORDE]); - data << uint32(BG_AB_OP_RESOURCES_MAX) << uint32(BG_AB_MAX_TEAM_SCORE); + data << uint32(BG_AB_OP_RESOURCES_MAX) << uint32(_configurableMaxTeamScore); data << uint32(BG_AB_OP_RESOURCES_WARNING) << uint32(BG_AB_WARNING_NEAR_VICTORY_SCORE); data << uint32(BG_AB_OP_RESOURCES_ALLY) << uint32(m_TeamScores[TEAM_ALLIANCE]); data << uint32(BG_AB_OP_RESOURCES_HORDE) << uint32(m_TeamScores[TEAM_HORDE]); @@ -478,6 +478,11 @@ void BattlegroundAB::Init() _capturePointInfo[BG_AB_NODE_BLACKSMITH]._iconCapture = BG_AB_OP_BLACKSMITH_STATE_ALIENCE; _capturePointInfo[BG_AB_NODE_LUMBER_MILL]._iconCapture = BG_AB_OP_LUMBERMILL_STATE_ALIENCE; _capturePointInfo[BG_AB_NODE_GOLD_MINE]._iconCapture = BG_AB_OP_GOLDMINE_STATE_ALIENCE; + + int bgArathiCapturePointsConfig = sWorld->getIntConfig(CONFIG_BATTLEGROUND_ARATHI_CAPTUREPOINTS); + _configurableMaxTeamScore = bgArathiCapturePointsConfig > 0 + ? bgArathiCapturePointsConfig + : BG_AB_MAX_TEAM_SCORE; } void BattlegroundAB::EndBattleground(TeamId winnerTeamId) diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAB.h b/src/server/game/Battlegrounds/Zones/BattlegroundAB.h index 403664fafed556..02ef5f563cd7be 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundAB.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundAB.h @@ -341,5 +341,6 @@ class AC_GAME_API BattlegroundAB : public Battleground uint32 _reputationTics; uint8 _controlledPoints[PVP_TEAMS_COUNT] {}; bool _teamScores500Disadvantage[PVP_TEAMS_COUNT] {}; + uint32 _configurableMaxTeamScore; }; #endif diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp index a5e246daefd420..f621b591315808 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp @@ -265,6 +265,9 @@ void BattlegroundAV::HandleQuestComplete(uint32 questid, Player* player) void BattlegroundAV::UpdateScore(TeamId teamId, int16 points) { + if (BG_AV_SCORE_INITIAL_POINTS == 0) + return; // don't update teamscores if reinforcements are disabled + //note: to remove reinforcementpoints points must be negative, for adding reinforcements points must be positive m_Team_Scores[teamId] += points; @@ -474,8 +477,11 @@ void BattlegroundAV::StartingEventOpenDoors() for (uint8 mine = AV_NORTH_MINE; mine <= AV_SOUTH_MINE; mine++) //mine population ChangeMineOwner(mine, TEAM_NEUTRAL, true); - UpdateWorldState(AV_SHOW_H_SCORE, 1); - UpdateWorldState(AV_SHOW_A_SCORE, 1); + if (BG_AV_SCORE_INITIAL_POINTS > 0) // display teamscores on top only if reinforcements are enabled + { + UpdateWorldState(AV_SHOW_H_SCORE, 1); + UpdateWorldState(AV_SHOW_A_SCORE, 1); + } DoorOpen(BG_AV_OBJECT_DOOR_H); DoorOpen(BG_AV_OBJECT_DOOR_A); @@ -1112,7 +1118,7 @@ void BattlegroundAV::FillInitialWorldStates(WorldPacket& data) data << uint32(AV_SNOWFALL_N) << uint32(1); data << uint32(AV_Alliance_Score) << uint32(m_Team_Scores[0]); data << uint32(AV_Horde_Score) << uint32(m_Team_Scores[1]); - if (GetStatus() == STATUS_IN_PROGRESS) //only if game started the teamscores are displayed + if (GetStatus() == STATUS_IN_PROGRESS && BG_AV_SCORE_INITIAL_POINTS > 0) //only if game started the teamscores are displayed && reinforcements are enabled { data << uint32(AV_SHOW_A_SCORE) << uint32(1); data << uint32(AV_SHOW_H_SCORE) << uint32(1); diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAV.h b/src/server/game/Battlegrounds/Zones/BattlegroundAV.h index 2af1c50b63518c..44bbcde5dca78b 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundAV.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundAV.h @@ -21,14 +21,14 @@ #include "Battleground.h" #include "BattlegroundScore.h" -#define BG_AV_CAPTIME 240000 //4:00 -#define BG_AV_SNOWFALL_FIRSTCAP 300000 //5:00 but i also have seen 4:05 +#define BG_AV_CAPTIME 240000 //4:00 +#define BG_AV_SNOWFALL_FIRSTCAP 300000 //5:00 but i also have seen 4:05 -#define BG_AV_SCORE_INITIAL_POINTS 600 -#define SEND_MSG_NEAR_LOSE 120 +#define BG_AV_SCORE_INITIAL_POINTS (sWorld->getIntConfig(CONFIG_BATTLEGROUND_ALTERAC_REINFORCEMENTS)) // Blizzlike default is 600 +#define SEND_MSG_NEAR_LOSE 120 #define BG_AV_KILL_BOSS 4 -#define BG_AV_REP_BOSS 350 +#define BG_AV_REP_BOSS (sWorld->getIntConfig(CONFIG_BATTLEGROUND_ALTERAC_REP_ONBOSSDEATH)) // Blizzlike default is 350 #define BG_AV_KILL_CAPTAIN 3 #define BG_AV_REP_CAPTAIN 125 @@ -38,7 +38,7 @@ #define BG_AV_REP_TOWER 12 #define BG_AV_RES_TOWER 75 -#define BG_AV_GET_COMMANDER 1 //for a safely returned wingcommander +#define BG_AV_GET_COMMANDER 1 //for a safely returned wingcommander //bonushonor at the end #define BG_AV_KILL_SURVIVING_TOWER 2 #define BG_AV_REP_SURVIVING_TOWER 12 diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp index 226bcf7099c73a..1d15d499886aeb 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp @@ -113,14 +113,14 @@ void BattlegroundEY::AddPoints(TeamId teamId, uint32 points) { uint8 honorRewards = uint8(m_TeamScores[teamId] / _honorTics); m_TeamScores[teamId] += points; - if (m_TeamScores[teamId] > BG_EY_MAX_TEAM_SCORE) - m_TeamScores[teamId] = BG_EY_MAX_TEAM_SCORE; + if (m_TeamScores[teamId] > _configurableMaxTeamScore) + m_TeamScores[teamId] = _configurableMaxTeamScore; for (; honorRewards < uint8(m_TeamScores[teamId] / _honorTics); ++honorRewards) RewardHonorToTeam(GetBonusHonorFromKill(1), teamId); - UpdateWorldState(teamId == TEAM_ALLIANCE ? EY_ALLIANCE_RESOURCES : EY_HORDE_RESOURCES, std::min(m_TeamScores[teamId], BG_EY_MAX_TEAM_SCORE)); - if (m_TeamScores[teamId] >= BG_EY_MAX_TEAM_SCORE) + UpdateWorldState(teamId == TEAM_ALLIANCE ? EY_ALLIANCE_RESOURCES : EY_HORDE_RESOURCES, std::min(m_TeamScores[teamId], _configurableMaxTeamScore)); + if (m_TeamScores[teamId] >= _configurableMaxTeamScore) EndBattleground(teamId); } @@ -361,6 +361,11 @@ void BattlegroundEY::Init() _droppedFlagGUID.Clear(); _flagState = BG_EY_FLAG_STATE_ON_BASE; _flagCapturedObject = 0; + + int bgEyCapturePointsConfig = sWorld->getIntConfig(CONFIG_BATTLEGROUND_EYEOFTHESTORM_CAPTUREPOINTS); + _configurableMaxTeamScore = bgEyCapturePointsConfig > 0 + ? bgEyCapturePointsConfig + : BG_EY_MAX_TEAM_SCORE; } void BattlegroundEY::RespawnFlag() diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundEY.h b/src/server/game/Battlegrounds/Zones/BattlegroundEY.h index 936e9e9b5e75d5..76beb4ffe7eb90 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundEY.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundEY.h @@ -456,5 +456,6 @@ class AC_GAME_API BattlegroundEY : public Battleground ObjectGuid _droppedFlagGUID; uint8 _flagState; uint32 _flagCapturedObject; + uint32 _configurableMaxTeamScore; }; #endif diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp index 1f84f6f6fc4fe3..41f5a90a36ace0 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp @@ -222,10 +222,10 @@ void BattlegroundWS::EventPlayerCapturedFlag(Player* player) RewardHonorToTeam(GetBonusHonorFromKill(2), player->GetTeamId()); - if (GetTeamScore(TEAM_ALLIANCE) == BG_WS_MAX_TEAM_SCORE || GetTeamScore(TEAM_HORDE) == BG_WS_MAX_TEAM_SCORE) + if (GetTeamScore(TEAM_ALLIANCE) == _configurableMaxTeamScore || GetTeamScore(TEAM_HORDE) == _configurableMaxTeamScore) { UpdateWorldState(BG_WS_STATE_TIMER_ACTIVE, 0); - EndBattleground(GetTeamScore(TEAM_HORDE) == BG_WS_MAX_TEAM_SCORE ? TEAM_HORDE : TEAM_ALLIANCE); + EndBattleground(GetTeamScore(TEAM_HORDE) == _configurableMaxTeamScore ? TEAM_HORDE : TEAM_ALLIANCE); } else _bgEvents.ScheduleEvent(BG_WS_EVENT_RESPAWN_BOTH_FLAGS, BG_WS_FLAG_RESPAWN_TIME); @@ -497,6 +497,11 @@ void BattlegroundWS::Init() _honorWinKills = 1; _honorEndKills = 2; } + + int bgWarsongFlagsConfig = sWorld->getIntConfig(CONFIG_BATTLEGROUND_WARSONG_FLAGS); + _configurableMaxTeamScore = bgWarsongFlagsConfig > 0 + ? bgWarsongFlagsConfig + : BG_WS_MAX_TEAM_SCORE; } void BattlegroundWS::EndBattleground(TeamId winnerTeamId) @@ -550,7 +555,7 @@ void BattlegroundWS::FillInitialWorldStates(WorldPacket& data) { data << uint32(BG_WS_FLAG_CAPTURES_ALLIANCE) << uint32(GetTeamScore(TEAM_ALLIANCE)); data << uint32(BG_WS_FLAG_CAPTURES_HORDE) << uint32(GetTeamScore(TEAM_HORDE)); - data << uint32(BG_WS_FLAG_CAPTURES_MAX) << uint32(BG_WS_MAX_TEAM_SCORE); + data << uint32(BG_WS_FLAG_CAPTURES_MAX) << uint32(_configurableMaxTeamScore); data << uint32(BG_WS_STATE_TIMER_ACTIVE) << uint32(GetStatus() == STATUS_IN_PROGRESS); data << uint32(BG_WS_STATE_TIMER) << uint32(GetMatchTime()); diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundWS.h b/src/server/game/Battlegrounds/Zones/BattlegroundWS.h index 1620ca1fd89c22..dd7c709c220786 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundWS.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundWS.h @@ -272,6 +272,7 @@ class AC_GAME_API BattlegroundWS : public Battleground uint32 _reputationCapture; uint32 _honorWinKills; uint32 _honorEndKills; + uint32 _configurableMaxTeamScore; void PostUpdateImpl(uint32 diff) override; }; diff --git a/src/server/game/World/IWorld.h b/src/server/game/World/IWorld.h index ef64ee73ee6374..a340c7475e78f8 100644 --- a/src/server/game/World/IWorld.h +++ b/src/server/game/World/IWorld.h @@ -319,6 +319,11 @@ enum WorldIntConfigs CONFIG_BATTLEGROUND_SPEED_BUFF_RESPAWN, CONFIG_BATTLEGROUND_QUEUE_ANNOUNCER_LIMIT_MIN_LEVEL, CONFIG_BATTLEGROUND_QUEUE_ANNOUNCER_LIMIT_MIN_PLAYERS, + CONFIG_BATTLEGROUND_WARSONG_FLAGS, + CONFIG_BATTLEGROUND_ARATHI_CAPTUREPOINTS, + CONFIG_BATTLEGROUND_ALTERAC_REINFORCEMENTS, + CONFIG_BATTLEGROUND_ALTERAC_REP_ONBOSSDEATH, + CONFIG_BATTLEGROUND_EYEOFTHESTORM_CAPTUREPOINTS, CONFIG_WINTERGRASP_ENABLE, CONFIG_ARENA_MAX_RATING_DIFFERENCE, CONFIG_ARENA_RATING_DISCARD_TIMER, diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp index f0893f3f16ab6e..731db628853e77 100644 --- a/src/server/game/World/World.cpp +++ b/src/server/game/World/World.cpp @@ -1172,6 +1172,12 @@ void World::LoadConfigSettings(bool reload) _int_configs[CONFIG_BATTLEGROUND_SPEED_BUFF_RESPAWN] = 150; } + _int_configs[CONFIG_BATTLEGROUND_WARSONG_FLAGS] = sConfigMgr->GetOption("Battleground.Warsong.Flags", 3); + _int_configs[CONFIG_BATTLEGROUND_ARATHI_CAPTUREPOINTS] = sConfigMgr->GetOption("Battleground.Arathi.CapturePoints", 1600); + _int_configs[CONFIG_BATTLEGROUND_ALTERAC_REINFORCEMENTS] = sConfigMgr->GetOption("Battleground.Alterac.Reinforcements", 600); + _int_configs[CONFIG_BATTLEGROUND_ALTERAC_REP_ONBOSSDEATH] = sConfigMgr->GetOption("Battleground.Alterac.ReputationOnBossDeath", 350); + _int_configs[CONFIG_BATTLEGROUND_EYEOFTHESTORM_CAPTUREPOINTS] = sConfigMgr->GetOption("Battleground.EyeOfTheStorm.CapturePoints", 1600); + _int_configs[CONFIG_ARENA_MAX_RATING_DIFFERENCE] = sConfigMgr->GetOption("Arena.MaxRatingDifference", 150); _int_configs[CONFIG_ARENA_RATING_DISCARD_TIMER] = sConfigMgr->GetOption("Arena.RatingDiscardTimer", 10 * MINUTE * IN_MILLISECONDS); _int_configs[CONFIG_ARENA_PREV_OPPONENTS_DISCARD_TIMER] = sConfigMgr->GetOption("Arena.PreviousOpponentsDiscardTimer", 2 * MINUTE * IN_MILLISECONDS);