From 67347a8b8610440785bcb36a6319c54b66319c14 Mon Sep 17 00:00:00 2001
From: Fyre <58180427+i-am-fyre@users.noreply.github.com>
Date: Mon, 26 Aug 2024 21:48:34 -0500
Subject: [PATCH 1/4] Add RewardXPToTeam Function
---
src/game/BattleGround/BattleGround.cpp | 51 ++++++++++++++++++++++++++
1 file changed, 51 insertions(+)
diff --git a/src/game/BattleGround/BattleGround.cpp b/src/game/BattleGround/BattleGround.cpp
index a0029863a..a926ee252 100644
--- a/src/game/BattleGround/BattleGround.cpp
+++ b/src/game/BattleGround/BattleGround.cpp
@@ -767,6 +767,57 @@ void BattleGround::RewardReputationToTeam(uint32 faction_id, uint32 Reputation,
}
}
+///
+/// Rewards the XP to team.
+///
+/// The battleground event.
+/// The team id.
+void BattleGround::RewardXPToTeam(uint8 event, Team teamId)
+{
+ enum BGEvent
+ {
+ WS_FLAG_CAPTURE = 1,
+ WS_WIN = 2,
+ };
+
+ for (BattleGroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
+ {
+ if (itr->second.OfflineRemoveTime)
+ {
+ continue;
+ }
+
+ Player* plr = sObjectMgr.GetPlayer(itr->first);
+
+ if (!plr)
+ {
+ sLog.outError("BattleGround:RewardXPToTeam: %s not found!", itr->first.GetString().c_str());
+ continue;
+ }
+
+ Team team = itr->second.PlayerTeam;
+ if (!team)
+ {
+ team = plr->GetTeam();
+ }
+
+ if (team == teamId)
+ {
+ uint32 xp;
+ switch (event)
+ {
+ case WS_FLAG_CAPTURE:
+ xp = 74 + (4.01 * plr->getLevel()) + (1.19 * pow(plr->getLevel(),2)); // This XP curve is a WIP, was established with a limited dataset pulled from various videos. -fyre
+ break;
+ case WS_WIN:
+ xp = (74 + (4.01 * plr->getLevel()) + (1.19 * pow(plr->getLevel(),2)))/2; // Half of a flag capture. Complete guess. -fyre
+ break;
+ }
+ plr->GiveXP(xp, nullptr);
+ }
+ }
+}
+
///
/// Updates the state of the world.
///
From 9e49d203b59da1cd39d4ee57ad6aa6b4825dc205 Mon Sep 17 00:00:00 2001
From: Fyre <58180427+i-am-fyre@users.noreply.github.com>
Date: Mon, 26 Aug 2024 21:50:43 -0500
Subject: [PATCH 2/4] Add RewardXPToTeam Function
---
src/game/BattleGround/BattleGround.h | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/src/game/BattleGround/BattleGround.h b/src/game/BattleGround/BattleGround.h
index 951ca6a7b..a48d0a2ac 100644
--- a/src/game/BattleGround/BattleGround.h
+++ b/src/game/BattleGround/BattleGround.h
@@ -870,6 +870,13 @@ class BattleGround
* @param team
*/
void RewardReputationToTeam(uint32 faction_id, uint32 Reputation, Team team);
+ /**
+ * @brief
+ *
+ * @param event
+ * @param team
+ */
+ void RewardXPToTeam(uint8 event, Team team);
/**
* @brief
*
From 5ea61c0f14bb627ebafc03af11258a116489c2fe Mon Sep 17 00:00:00 2001
From: Fyre <58180427+i-am-fyre@users.noreply.github.com>
Date: Mon, 26 Aug 2024 21:54:07 -0500
Subject: [PATCH 3/4] Add RewardXPToTeam Calls for WSG Flag/Win
---
src/game/BattleGround/BattleGroundWS.cpp | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/src/game/BattleGround/BattleGroundWS.cpp b/src/game/BattleGround/BattleGroundWS.cpp
index 18c2aea7b..f748d7e5d 100644
--- a/src/game/BattleGround/BattleGroundWS.cpp
+++ b/src/game/BattleGround/BattleGroundWS.cpp
@@ -226,6 +226,7 @@ void BattleGroundWS::EventPlayerCapturedFlag(Player* source)
}
PlaySoundToAll(BG_WS_SOUND_FLAG_CAPTURED_ALLIANCE);
RewardReputationToTeam(890, m_ReputationCapture, ALLIANCE);
+ RewardXPToTeam(1, ALLIANCE); // event = WS_FLAG_CAPTURE
}
else
{
@@ -244,6 +245,7 @@ void BattleGroundWS::EventPlayerCapturedFlag(Player* source)
}
PlaySoundToAll(BG_WS_SOUND_FLAG_CAPTURED_HORDE);
RewardReputationToTeam(889, m_ReputationCapture, HORDE);
+ RewardXPToTeam(1, HORDE); // event = WS_FLAG_CAPTURE
}
// for flag capture is reward 2 honorable kills
RewardHonorToTeam(GetBonusHonorFromKill(2), source->GetTeam());
@@ -606,10 +608,25 @@ void BattleGroundWS::EndBattleGround(Team winner)
if (winner == ALLIANCE)
{
RewardHonorToTeam(GetBonusHonorFromKill(m_HonorWinKills), ALLIANCE);
+
+ // Earn XP for any remaining flags not captured by the Horde.
+ for (uint8 i = 0; i < (3 - m_TeamScores[TEAM_INDEX_HORDE]); ++i)
+ {
+ RewardXPToTeam(1, ALLIANCE); // event = WS_FLAG_CAPTURE
+ }
+ RewardXPToTeam(2, ALLIANCE); // event = WS_WIN
}
if (winner == HORDE)
{
RewardHonorToTeam(GetBonusHonorFromKill(m_HonorWinKills), HORDE);
+
+ // Earn XP for any remaining flags not captured by the Horde.
+ for (uint8 i = 0; i < (3 - m_TeamScores[TEAM_INDEX_ALLIANCE]); ++i)
+ {
+ RewardXPToTeam(1, HORDE); // event = WS_FLAG_CAPTURE
+ }
+ RewardXPToTeam(2, HORDE); // event = WS_WIN
+
}
// complete map_end rewards (even if no team wins)
RewardHonorToTeam(GetBonusHonorFromKill(m_HonorEndKills), ALLIANCE);
From 8e781ec03f1b446305fcc0293f6b4bb2b94104be Mon Sep 17 00:00:00 2001
From: Fyre <58180427+i-am-fyre@users.noreply.github.com>
Date: Mon, 26 Aug 2024 22:10:17 -0500
Subject: [PATCH 4/4] Remove whitespace
---
src/game/BattleGround/BattleGroundWS.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/game/BattleGround/BattleGroundWS.cpp b/src/game/BattleGround/BattleGroundWS.cpp
index f748d7e5d..9d9f7a514 100644
--- a/src/game/BattleGround/BattleGroundWS.cpp
+++ b/src/game/BattleGround/BattleGroundWS.cpp
@@ -608,7 +608,7 @@ void BattleGroundWS::EndBattleGround(Team winner)
if (winner == ALLIANCE)
{
RewardHonorToTeam(GetBonusHonorFromKill(m_HonorWinKills), ALLIANCE);
-
+
// Earn XP for any remaining flags not captured by the Horde.
for (uint8 i = 0; i < (3 - m_TeamScores[TEAM_INDEX_HORDE]); ++i)
{
@@ -619,7 +619,7 @@ void BattleGroundWS::EndBattleGround(Team winner)
if (winner == HORDE)
{
RewardHonorToTeam(GetBonusHonorFromKill(m_HonorWinKills), HORDE);
-
+
// Earn XP for any remaining flags not captured by the Horde.
for (uint8 i = 0; i < (3 - m_TeamScores[TEAM_INDEX_ALLIANCE]); ++i)
{