Skip to content

Commit

Permalink
feat(Core/Conf/BG): allow battlegrounds to be more configurable (azer…
Browse files Browse the repository at this point in the history
  • Loading branch information
valsan-azerty-boi committed Jan 9, 2025
1 parent d62c6e3 commit 1863d14
Show file tree
Hide file tree
Showing 11 changed files with 99 additions and 20 deletions.
44 changes: 44 additions & 0 deletions src/server/apps/worldserver/worldserver.conf.dist
Original file line number Diff line number Diff line change
Expand Up @@ -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

#
###################################################################################################

Expand Down
13 changes: 9 additions & 4 deletions src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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]);
Expand Down Expand Up @@ -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]);
Expand Down Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions src/server/game/Battlegrounds/Zones/BattlegroundAB.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
12 changes: 9 additions & 3 deletions src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
12 changes: 6 additions & 6 deletions src/server/game/Battlegrounds/Zones/BattlegroundAV.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
13 changes: 9 additions & 4 deletions src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<uint32>(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<uint32>(m_TeamScores[teamId], _configurableMaxTeamScore));
if (m_TeamScores[teamId] >= _configurableMaxTeamScore)
EndBattleground(teamId);
}

Expand Down Expand Up @@ -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()
Expand Down
1 change: 1 addition & 0 deletions src/server/game/Battlegrounds/Zones/BattlegroundEY.h
Original file line number Diff line number Diff line change
Expand Up @@ -456,5 +456,6 @@ class AC_GAME_API BattlegroundEY : public Battleground
ObjectGuid _droppedFlagGUID;
uint8 _flagState;
uint32 _flagCapturedObject;
uint32 _configurableMaxTeamScore;
};
#endif
11 changes: 8 additions & 3 deletions src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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());
Expand Down
1 change: 1 addition & 0 deletions src/server/game/Battlegrounds/Zones/BattlegroundWS.h
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,7 @@ class AC_GAME_API BattlegroundWS : public Battleground
uint32 _reputationCapture;
uint32 _honorWinKills;
uint32 _honorEndKills;
uint32 _configurableMaxTeamScore;

void PostUpdateImpl(uint32 diff) override;
};
Expand Down
5 changes: 5 additions & 0 deletions src/server/game/World/IWorld.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
6 changes: 6 additions & 0 deletions src/server/game/World/World.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<uint32>("Battleground.Warsong.Flags", 3);
_int_configs[CONFIG_BATTLEGROUND_ARATHI_CAPTUREPOINTS] = sConfigMgr->GetOption<uint32>("Battleground.Arathi.CapturePoints", 1600);
_int_configs[CONFIG_BATTLEGROUND_ALTERAC_REINFORCEMENTS] = sConfigMgr->GetOption<int32>("Battleground.Alterac.Reinforcements", 600);
_int_configs[CONFIG_BATTLEGROUND_ALTERAC_REP_ONBOSSDEATH] = sConfigMgr->GetOption<int32>("Battleground.Alterac.ReputationOnBossDeath", 350);
_int_configs[CONFIG_BATTLEGROUND_EYEOFTHESTORM_CAPTUREPOINTS] = sConfigMgr->GetOption<uint32>("Battleground.EyeOfTheStorm.CapturePoints", 1600);

_int_configs[CONFIG_ARENA_MAX_RATING_DIFFERENCE] = sConfigMgr->GetOption<uint32>("Arena.MaxRatingDifference", 150);
_int_configs[CONFIG_ARENA_RATING_DISCARD_TIMER] = sConfigMgr->GetOption<uint32>("Arena.RatingDiscardTimer", 10 * MINUTE * IN_MILLISECONDS);
_int_configs[CONFIG_ARENA_PREV_OPPONENTS_DISCARD_TIMER] = sConfigMgr->GetOption<uint32>("Arena.PreviousOpponentsDiscardTimer", 2 * MINUTE * IN_MILLISECONDS);
Expand Down

0 comments on commit 1863d14

Please sign in to comment.