aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjoschiwald <joschiwald.trinity@gmail.com>2017-07-27 01:19:12 +0200
committerjoschiwald <joschiwald.trinity@gmail.com>2017-07-27 01:19:12 +0200
commitbe144b2fd89c00c5a141c918152fb43a3254b396 (patch)
tree69f741b4e8d0b8318618a343d6aae364839f1bf7
parentb85d46138bf6cd0fd50a0f8060f1512002ced731 (diff)
Core/Battleground: Small BattlegroundScore refactoring
-rw-r--r--src/server/game/Battlegrounds/Arena.cpp26
-rw-r--r--src/server/game/Battlegrounds/Arena.h5
-rw-r--r--src/server/game/Battlegrounds/ArenaScore.cpp65
-rw-r--r--src/server/game/Battlegrounds/ArenaScore.h43
-rw-r--r--src/server/game/Battlegrounds/Battleground.cpp54
-rw-r--r--src/server/game/Battlegrounds/Battleground.h7
-rw-r--r--src/server/game/Battlegrounds/BattlegroundScore.cpp74
-rw-r--r--src/server/game/Battlegrounds/BattlegroundScore.h46
-rw-r--r--src/server/game/Battlegrounds/Zones/BattlegroundAB.h8
-rw-r--r--src/server/game/Battlegrounds/Zones/BattlegroundAV.h14
-rw-r--r--src/server/game/Battlegrounds/Zones/BattlegroundBFG.h8
-rw-r--r--src/server/game/Battlegrounds/Zones/BattlegroundEY.h6
-rw-r--r--src/server/game/Battlegrounds/Zones/BattlegroundIC.h8
-rw-r--r--src/server/game/Battlegrounds/Zones/BattlegroundSA.h8
-rw-r--r--src/server/game/Battlegrounds/Zones/BattlegroundTP.h8
-rw-r--r--src/server/game/Battlegrounds/Zones/BattlegroundWS.h8
-rw-r--r--src/server/game/Server/Packets/BattlegroundPackets.h2
17 files changed, 245 insertions, 145 deletions
diff --git a/src/server/game/Battlegrounds/Arena.cpp b/src/server/game/Battlegrounds/Arena.cpp
index 6fc7271d861..450c455396b 100644
--- a/src/server/game/Battlegrounds/Arena.cpp
+++ b/src/server/game/Battlegrounds/Arena.cpp
@@ -16,7 +16,6 @@
*/
#include "Arena.h"
-#include "ArenaScore.h"
#include "ArenaTeamMgr.h"
#include "GuildMgr.h"
#include "Guild.h"
@@ -97,6 +96,23 @@ void Arena::HandleKillPlayer(Player* player, Player* killer)
CheckWinConditions();
}
+void Arena::BuildPvPLogDataPacket(WorldPackets::Battleground::PVPLogData& pvpLogData) const
+{
+ Battleground::BuildPvPLogDataPacket(pvpLogData);
+
+ if (isRated())
+ {
+ pvpLogData.Ratings = boost::in_place();
+
+ for (uint8 i = 0; i < BG_TEAMS_COUNT; ++i)
+ {
+ pvpLogData.Ratings->Postmatch[i] = _arenaTeamScores[i].PostMatchRating;
+ pvpLogData.Ratings->Prematch[i] = _arenaTeamScores[i].PreMatchRating;
+ pvpLogData.Ratings->PrematchMMR[i] = _arenaTeamScores[i].PreMatchMMR;
+ }
+ }
+}
+
void Arena::RemovePlayerAtLeave(ObjectGuid guid, bool transport, bool sendPacket)
{
if (isRated() && GetStatus() == STATUS_IN_PROGRESS)
@@ -179,8 +195,8 @@ void Arena::EndBattleground(uint32 winner)
uint8 winnerTeam = winner == ALLIANCE ? BG_TEAM_ALLIANCE : BG_TEAM_HORDE;
uint8 loserTeam = winner == ALLIANCE ? BG_TEAM_HORDE : BG_TEAM_ALLIANCE;
- _arenaTeamScores[winnerTeam].Assign(winnerTeamRating, winnerTeamRating + winnerChange, winnerMatchmakerRating);
- _arenaTeamScores[loserTeam].Assign(loserTeamRating, loserTeamRating + loserChange, loserMatchmakerRating);
+ _arenaTeamScores[winnerTeam].Assign(winnerTeamRating, winnerTeamRating + winnerChange, winnerMatchmakerRating, GetArenaMatchmakerRating(winner));
+ _arenaTeamScores[loserTeam].Assign(loserTeamRating, loserTeamRating + loserChange, loserMatchmakerRating, GetArenaMatchmakerRating(GetOtherTeam(winner)));
TC_LOG_DEBUG("bg.arena", "Arena match Type: %u for Team1Id: %u - Team2Id: %u ended. WinnerTeamId: %u. Winner rating: +%d, Loser rating: %d",
GetArenaType(), GetArenaTeamIdByIndex(TEAM_ALLIANCE), GetArenaTeamIdByIndex(TEAM_HORDE), winnerArenaTeam->GetId(), winnerChange, loserChange);
@@ -197,8 +213,8 @@ void Arena::EndBattleground(uint32 winner)
// Deduct 16 points from each teams arena-rating if there are no winners after 45+2 minutes
else
{
- _arenaTeamScores[BG_TEAM_ALLIANCE].Assign(winnerTeamRating, winnerTeamRating + ARENA_TIMELIMIT_POINTS_LOSS, winnerMatchmakerRating);
- _arenaTeamScores[BG_TEAM_HORDE].Assign(loserTeamRating, loserTeamRating + ARENA_TIMELIMIT_POINTS_LOSS, loserMatchmakerRating);
+ _arenaTeamScores[BG_TEAM_ALLIANCE].Assign(winnerTeamRating, winnerTeamRating + ARENA_TIMELIMIT_POINTS_LOSS, winnerMatchmakerRating, GetArenaMatchmakerRating(ALLIANCE));
+ _arenaTeamScores[BG_TEAM_HORDE].Assign(loserTeamRating, loserTeamRating + ARENA_TIMELIMIT_POINTS_LOSS, loserMatchmakerRating, GetArenaMatchmakerRating(HORDE));
winnerArenaTeam->FinishGame(ARENA_TIMELIMIT_POINTS_LOSS);
loserArenaTeam->FinishGame(ARENA_TIMELIMIT_POINTS_LOSS);
diff --git a/src/server/game/Battlegrounds/Arena.h b/src/server/game/Battlegrounds/Arena.h
index 7ecd892e4b4..eab80fb491d 100644
--- a/src/server/game/Battlegrounds/Arena.h
+++ b/src/server/game/Battlegrounds/Arena.h
@@ -18,6 +18,7 @@
#ifndef TRINITY_ARENA_H
#define TRINITY_ARENA_H
+#include "ArenaScore.h"
#include "Battleground.h"
enum ArenaSpellIds
@@ -49,10 +50,14 @@ class TC_GAME_API Arena : public Battleground
void HandleKillPlayer(Player* player, Player* killer) override;
+ void BuildPvPLogDataPacket(WorldPackets::Battleground::PVPLogData& pvpLogData) const override;
+
private:
void RemovePlayerAtLeave(ObjectGuid guid, bool transport, bool sendPacket) override;
void CheckWinConditions() override;
void EndBattleground(uint32 winner) override;
+
+ ArenaTeamScore _arenaTeamScores[BG_TEAMS_COUNT];
};
#endif // TRINITY_ARENA_H
diff --git a/src/server/game/Battlegrounds/ArenaScore.cpp b/src/server/game/Battlegrounds/ArenaScore.cpp
new file mode 100644
index 00000000000..199ccfc610c
--- /dev/null
+++ b/src/server/game/Battlegrounds/ArenaScore.cpp
@@ -0,0 +1,65 @@
+/*
+ * Copyright (C) 2008-2017 TrinityCore <http://www.trinitycore.org/>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "ArenaScore.h"
+#include <sstream>
+
+ArenaScore::ArenaScore(ObjectGuid playerGuid, uint32 team) : BattlegroundScore(playerGuid, team)
+{
+}
+
+void ArenaScore::BuildPvPLogPlayerDataPacket(WorldPackets::Battleground::PVPLogData::PlayerData& playerData) const
+{
+ if (PreMatchRating)
+ playerData.PreMatchRating = PreMatchRating;
+
+ if (PostMatchRating != PreMatchRating)
+ playerData.RatingChange = int32(PostMatchRating) - PreMatchRating;
+
+ if (PreMatchMMR)
+ playerData.PreMatchMMR = PreMatchMMR;
+
+ if (PostMatchMMR != PreMatchMMR)
+ playerData.MmrChange = int32(PostMatchMMR) - PreMatchMMR;
+}
+
+// For Logging purpose
+std::string ArenaScore::ToString() const
+{
+ std::ostringstream stream;
+ stream << "Damage done: " << DamageDone << ", Healing done: " << HealingDone << ", Killing blows: " << KillingBlows
+ << ", PreMatchRating: " << PreMatchRating << ", PreMatchMMR: " << PreMatchMMR
+ << ", PostMatchRating: " << PostMatchRating << ", PostMatchMMR: " << PostMatchMMR;
+ return stream.str();
+}
+
+ArenaTeamScore::ArenaTeamScore()
+{
+}
+
+ArenaTeamScore::~ArenaTeamScore()
+{
+}
+
+void ArenaTeamScore::Assign(uint32 preMatchRating, uint32 postMatchRating, uint32 preMatchMMR, uint32 postMatchMMR)
+{
+ PreMatchRating = preMatchRating;
+ PostMatchRating = postMatchRating;
+ PreMatchMMR = preMatchMMR;
+ PostMatchMMR = postMatchMMR;
+}
+
diff --git a/src/server/game/Battlegrounds/ArenaScore.h b/src/server/game/Battlegrounds/ArenaScore.h
index 8d2a0b6790f..93eb1c64969 100644
--- a/src/server/game/Battlegrounds/ArenaScore.h
+++ b/src/server/game/Battlegrounds/ArenaScore.h
@@ -19,26 +19,23 @@
#define TRINITY_ARENA_SCORE_H
#include "BattlegroundScore.h"
-#include <sstream>
struct TC_GAME_API ArenaScore : public BattlegroundScore
{
friend class Arena;
protected:
- ArenaScore(ObjectGuid playerGuid, uint32 team) : BattlegroundScore(playerGuid, team), TeamId(team == ALLIANCE ? BG_TEAM_ALLIANCE : BG_TEAM_HORDE) { }
+ ArenaScore(ObjectGuid playerGuid, uint32 team);
- void BuildObjectivesBlock(std::vector<int32>& /*stats*/) override { }
+ void BuildPvPLogPlayerDataPacket(WorldPackets::Battleground::PVPLogData::PlayerData& playerData) const;
// For Logging purpose
- std::string ToString() const override
- {
- std::ostringstream stream;
- stream << "Damage done: " << DamageDone << ", Healing done: " << HealingDone << ", Killing blows: " << KillingBlows;
- return stream.str();
- }
+ std::string ToString() const override;
- uint8 TeamId; // BattlegroundTeamId
+ uint32 PreMatchRating = 0;
+ uint32 PreMatchMMR = 0;
+ uint32 PostMatchRating = 0;
+ uint32 PostMatchMMR = 0;
};
struct TC_GAME_API ArenaTeamScore
@@ -47,27 +44,15 @@ struct TC_GAME_API ArenaTeamScore
friend class Battleground;
protected:
- ArenaTeamScore() : OldRating(0), NewRating(0), MatchmakerRating(0) { }
+ ArenaTeamScore();
+ virtual ~ArenaTeamScore();
- virtual ~ArenaTeamScore() { }
+ void Assign(uint32 preMatchRating, uint32 postMatchRating, uint32 preMatchMMR, uint32 postMatchMMR);
- void Reset()
- {
- OldRating = 0;
- NewRating = 0;
- MatchmakerRating = 0;
- }
-
- void Assign(int32 oldRating, int32 newRating, uint32 matchMakerRating)
- {
- OldRating = oldRating;
- NewRating = newRating;
- MatchmakerRating = matchMakerRating;
- }
-
- int32 OldRating;
- int32 NewRating;
- uint32 MatchmakerRating;
+ uint32 PreMatchRating = 0;
+ uint32 PostMatchRating = 0;
+ uint32 PreMatchMMR = 0;
+ uint32 PostMatchMMR = 0;
};
#endif // TRINITY_ARENA_SCORE_H
diff --git a/src/server/game/Battlegrounds/Battleground.cpp b/src/server/game/Battlegrounds/Battleground.cpp
index 356a519c238..fcf4263800e 100644
--- a/src/server/game/Battlegrounds/Battleground.cpp
+++ b/src/server/game/Battlegrounds/Battleground.cpp
@@ -17,7 +17,6 @@
*/
#include "Battleground.h"
-#include "ArenaScore.h"
#include "BattlegroundMgr.h"
#include "BattlegroundPackets.h"
#include "BattlegroundScore.h"
@@ -649,6 +648,12 @@ Player* Battleground::_GetPlayerForTeam(uint32 teamId, BattlegroundPlayerMap::co
return player;
}
+BattlegroundMap* Battleground::GetBgMap() const
+{
+ ASSERT(m_Map);
+ return m_Map;
+}
+
void Battleground::SetTeamStartPosition(TeamId teamId, Position const& pos)
{
ASSERT(teamId < TEAM_NEUTRAL);
@@ -1062,9 +1067,6 @@ void Battleground::Reset()
delete itr->second;
PlayerScores.clear();
- for (uint8 i = 0; i < BG_TEAMS_COUNT; ++i)
- _arenaTeamScores[i].Reset();
-
ResetBGSubclass();
}
@@ -1333,7 +1335,7 @@ bool Battleground::HasFreeSlots() const
return GetPlayersSize() < GetMaxPlayers();
}
-void Battleground::BuildPvPLogDataPacket(WorldPackets::Battleground::PVPLogData& pvpLogData)
+void Battleground::BuildPvPLogDataPacket(WorldPackets::Battleground::PVPLogData& pvpLogData) const
{
if (GetStatus() == STATUS_WAIT_LEAVE)
pvpLogData.Winner = GetWinner();
@@ -1342,54 +1344,22 @@ void Battleground::BuildPvPLogDataPacket(WorldPackets::Battleground::PVPLogData&
for (auto const& score : PlayerScores)
{
WorldPackets::Battleground::PVPLogData::PlayerData playerData;
-
- playerData.PlayerGUID = score.second->PlayerGuid;
- playerData.Kills = score.second->KillingBlows;
- playerData.Faction = score.second->TeamId;
- if (score.second->HonorableKills || score.second->Deaths || score.second->BonusHonor)
- {
- playerData.Honor = boost::in_place();
- playerData.Honor->HonorKills = score.second->HonorableKills;
- playerData.Honor->Deaths = score.second->Deaths;
- playerData.Honor->ContributionPoints = score.second->BonusHonor;
- }
-
- playerData.DamageDone = score.second->DamageDone;
- playerData.HealingDone = score.second->HealingDone;
- score.second->BuildObjectivesBlock(playerData.Stats);
+ score.second->BuildPvPLogPlayerDataPacket(playerData);
if (Player* player = ObjectAccessor::GetPlayer(GetBgMap(), playerData.PlayerGUID))
{
playerData.IsInWorld = true;
playerData.PrimaryTalentTree = player->GetUInt32Value(PLAYER_FIELD_CURRENT_SPEC_ID);
+ playerData.PrimaryTalentTreeNameIndex = 0;
playerData.Race = player->getRace();
+ playerData.Prestige = player->GetPrestigeLevel();
}
- //if (isRated())
- //{
- // playerData.PreMatchRating;
- // playerData.RatingChange;
- // playerData.PreMatchMMR;
- // playerData.MmrChange;
- //}
-
pvpLogData.Players.push_back(playerData);
}
- if (isRated())
- {
- pvpLogData.Ratings = boost::in_place();
-
- for (uint8 i = 0; i < BG_TEAMS_COUNT; ++i)
- {
- pvpLogData.Ratings->Postmatch[i] = _arenaTeamScores[i].NewRating;
- pvpLogData.Ratings->Prematch[i] = _arenaTeamScores[i].OldRating;
- pvpLogData.Ratings->PrematchMMR[i] = _arenaTeamScores[i].MatchmakerRating;
- }
- }
-
- pvpLogData.PlayerCount[0] = int8(GetPlayersCountByTeam(HORDE));
- pvpLogData.PlayerCount[1] = int8(GetPlayersCountByTeam(ALLIANCE));
+ pvpLogData.PlayerCount[BG_TEAM_HORDE] = int8(GetPlayersCountByTeam(HORDE));
+ pvpLogData.PlayerCount[BG_TEAM_ALLIANCE] = int8(GetPlayersCountByTeam(ALLIANCE));
}
bool Battleground::UpdatePlayerScore(Player* player, uint32 type, uint32 value, bool doAddHonor)
diff --git a/src/server/game/Battlegrounds/Battleground.h b/src/server/game/Battlegrounds/Battleground.h
index 26c0a903ebc..e11d0326eb1 100644
--- a/src/server/game/Battlegrounds/Battleground.h
+++ b/src/server/game/Battlegrounds/Battleground.h
@@ -19,7 +19,6 @@
#ifndef __BATTLEGROUND_H
#define __BATTLEGROUND_H
-#include "ArenaScore.h"
#include "DBCEnums.h"
#include "ObjectGuid.h"
#include "Position.h"
@@ -364,7 +363,7 @@ class TC_GAME_API Battleground
// Map pointers
void SetBgMap(BattlegroundMap* map) { m_Map = map; }
- BattlegroundMap* GetBgMap() const { ASSERT(m_Map); return m_Map; }
+ BattlegroundMap* GetBgMap() const;
BattlegroundMap* FindBgMap() const { return m_Map; }
void SetTeamStartPosition(TeamId teamId, Position const& pos);
@@ -404,7 +403,7 @@ class TC_GAME_API Battleground
Group* GetBgRaid(uint32 TeamID) const { return TeamID == ALLIANCE ? m_BgRaids[TEAM_ALLIANCE] : m_BgRaids[TEAM_HORDE]; }
void SetBgRaid(uint32 TeamID, Group* bg_raid);
- void BuildPvPLogDataPacket(WorldPackets::Battleground::PVPLogData& pvpLogData);
+ virtual void BuildPvPLogDataPacket(WorldPackets::Battleground::PVPLogData& pvpLogData) const;
virtual bool UpdatePlayerScore(Player* player, uint32 type, uint32 value, bool doAddHonor = true);
static TeamId GetTeamIndexByTeamId(uint32 Team) { return Team == ALLIANCE ? TEAM_ALLIANCE : TEAM_HORDE; }
@@ -576,8 +575,6 @@ class TC_GAME_API Battleground
BGHonorMode m_HonorMode;
int32 m_TeamScores[BG_TEAMS_COUNT];
- ArenaTeamScore _arenaTeamScores[BG_TEAMS_COUNT];
-
private:
// Battleground
BattlegroundTypeId m_TypeID;
diff --git a/src/server/game/Battlegrounds/BattlegroundScore.cpp b/src/server/game/Battlegrounds/BattlegroundScore.cpp
new file mode 100644
index 00000000000..968a471130a
--- /dev/null
+++ b/src/server/game/Battlegrounds/BattlegroundScore.cpp
@@ -0,0 +1,74 @@
+/*
+ * Copyright (C) 2008-2017 TrinityCore <http://www.trinitycore.org/>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "BattlegroundScore.h"
+#include "Errors.h"
+#include "SharedDefines.h"
+
+BattlegroundScore::BattlegroundScore(ObjectGuid playerGuid, uint32 team) : PlayerGuid(playerGuid), TeamId(team == ALLIANCE ? BG_TEAM_ALLIANCE : BG_TEAM_HORDE),
+ KillingBlows(0), Deaths(0), HonorableKills(0), BonusHonor(0), DamageDone(0), HealingDone(0)
+{
+}
+
+BattlegroundScore::~BattlegroundScore()
+{
+}
+
+void BattlegroundScore::UpdateScore(uint32 type, uint32 value)
+{
+ switch (type)
+ {
+ case SCORE_KILLING_BLOWS: // Killing blows
+ KillingBlows += value;
+ break;
+ case SCORE_DEATHS: // Deaths
+ Deaths += value;
+ break;
+ case SCORE_HONORABLE_KILLS: // Honorable kills
+ HonorableKills += value;
+ break;
+ case SCORE_BONUS_HONOR: // Honor bonus
+ BonusHonor += value;
+ break;
+ case SCORE_DAMAGE_DONE: // Damage Done
+ DamageDone += value;
+ break;
+ case SCORE_HEALING_DONE: // Healing Done
+ HealingDone += value;
+ break;
+ default:
+ ASSERT(false, "Not implemented Battleground score type %u!", type);
+ break;
+ }
+}
+
+void BattlegroundScore::BuildPvPLogPlayerDataPacket(WorldPackets::Battleground::PVPLogData::PlayerData& playerData) const
+{
+ playerData.PlayerGUID = PlayerGuid;
+ playerData.Kills = KillingBlows;
+ playerData.Faction = TeamId;
+ if (HonorableKills || Deaths || BonusHonor)
+ {
+ playerData.Honor = boost::in_place();
+ playerData.Honor->HonorKills = HonorableKills;
+ playerData.Honor->Deaths = Deaths;
+ playerData.Honor->ContributionPoints = BonusHonor;
+ }
+
+ playerData.DamageDone = DamageDone;
+ playerData.HealingDone = HealingDone;
+}
diff --git a/src/server/game/Battlegrounds/BattlegroundScore.h b/src/server/game/Battlegrounds/BattlegroundScore.h
index cd3058f8ded..07825e37f57 100644
--- a/src/server/game/Battlegrounds/BattlegroundScore.h
+++ b/src/server/game/Battlegrounds/BattlegroundScore.h
@@ -18,13 +18,13 @@
#ifndef TRINITY_BATTLEGROUND_SCORE_H
#define TRINITY_BATTLEGROUND_SCORE_H
-#include "Errors.h"
+#include "BattlegroundPackets.h"
#include "ObjectGuid.h"
-#include "SharedDefines.h"
#include <string>
enum ScoreType
{
+ // ALL
SCORE_KILLING_BLOWS = 1,
SCORE_DEATHS = 2,
SCORE_HONORABLE_KILLS = 3,
@@ -58,40 +58,12 @@ struct BattlegroundScore
friend class Battleground;
protected:
- BattlegroundScore(ObjectGuid playerGuid, uint32 team) : PlayerGuid(playerGuid), TeamId(team == ALLIANCE ? 1 : 0),
- KillingBlows(0), Deaths(0), HonorableKills(0), BonusHonor(0), DamageDone(0), HealingDone(0) { }
-
- virtual ~BattlegroundScore() { }
-
- virtual void UpdateScore(uint32 type, uint32 value)
- {
- switch (type)
- {
- case SCORE_KILLING_BLOWS: // Killing blows
- KillingBlows += value;
- break;
- case SCORE_DEATHS: // Deaths
- Deaths += value;
- break;
- case SCORE_HONORABLE_KILLS: // Honorable kills
- HonorableKills += value;
- break;
- case SCORE_BONUS_HONOR: // Honor bonus
- BonusHonor += value;
- break;
- case SCORE_DAMAGE_DONE: // Damage Done
- DamageDone += value;
- break;
- case SCORE_HEALING_DONE: // Healing Done
- HealingDone += value;
- break;
- default:
- ASSERT(false && "Not implemented Battleground score type!");
- break;
- }
- }
-
- virtual void BuildObjectivesBlock(std::vector<int32>& /*stats*/) = 0;
+ BattlegroundScore(ObjectGuid playerGuid, uint32 team);
+ virtual ~BattlegroundScore();
+
+ virtual void UpdateScore(uint32 type, uint32 value);
+
+ virtual void BuildPvPLogPlayerDataPacket(WorldPackets::Battleground::PVPLogData::PlayerData& playerData) const;
// For Logging purpose
virtual std::string ToString() const { return ""; }
@@ -110,7 +82,7 @@ struct BattlegroundScore
virtual uint32 GetAttr5() const { return 0; }
ObjectGuid PlayerGuid;
- uint8 TeamId;
+ uint8 TeamId; // BattlegroundTeamId
// Default score, present in every type
uint32 KillingBlows;
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAB.h b/src/server/game/Battlegrounds/Zones/BattlegroundAB.h
index 052e89ecaee..e3e7e948e3f 100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundAB.h
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundAB.h
@@ -266,10 +266,12 @@ struct BattlegroundABScore final : public BattlegroundScore
}
}
- void BuildObjectivesBlock(std::vector<int32>& stats) override
+ void BuildPvPLogPlayerDataPacket(WorldPackets::Battleground::PVPLogData::PlayerData& playerData) const override
{
- stats.push_back(BasesAssaulted);
- stats.push_back(BasesDefended);
+ BattlegroundScore::BuildPvPLogPlayerDataPacket(playerData);
+
+ playerData.Stats.push_back(BasesAssaulted);
+ playerData.Stats.push_back(BasesDefended);
}
uint32 GetAttr1() const final override { return BasesAssaulted; }
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAV.h b/src/server/game/Battlegrounds/Zones/BattlegroundAV.h
index 648717249dc..eb0a32f7ee1 100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundAV.h
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundAV.h
@@ -1587,13 +1587,15 @@ struct BattlegroundAVScore final : public BattlegroundScore
}
}
- void BuildObjectivesBlock(std::vector<int32>& stats) override
+ void BuildPvPLogPlayerDataPacket(WorldPackets::Battleground::PVPLogData::PlayerData& playerData) const override
{
- stats.push_back(GraveyardsAssaulted);
- stats.push_back(GraveyardsDefended);
- stats.push_back(TowersAssaulted);
- stats.push_back(TowersDefended);
- stats.push_back(MinesCaptured);
+ BattlegroundScore::BuildPvPLogPlayerDataPacket(playerData);
+
+ playerData.Stats.push_back(GraveyardsAssaulted);
+ playerData.Stats.push_back(GraveyardsDefended);
+ playerData.Stats.push_back(TowersAssaulted);
+ playerData.Stats.push_back(TowersDefended);
+ playerData.Stats.push_back(MinesCaptured);
}
uint32 GetAttr1() const final override { return GraveyardsAssaulted; }
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundBFG.h b/src/server/game/Battlegrounds/Zones/BattlegroundBFG.h
index 83767ade174..1b329c75008 100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundBFG.h
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundBFG.h
@@ -42,10 +42,12 @@ class BattlegroundBFGScore final : public BattlegroundScore
}
}
- void BuildObjectivesBlock(std::vector<int32>& stats) override
+ void BuildPvPLogPlayerDataPacket(WorldPackets::Battleground::PVPLogData::PlayerData& playerData) const override
{
- stats.push_back(BasesAssaulted);
- stats.push_back(BasesDefended);
+ BattlegroundScore::BuildPvPLogPlayerDataPacket(playerData);
+
+ playerData.Stats.push_back(BasesAssaulted);
+ playerData.Stats.push_back(BasesDefended);
}
uint32 GetAttr1() const final override { return BasesAssaulted; }
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundEY.h b/src/server/game/Battlegrounds/Zones/BattlegroundEY.h
index 004f3b7de6e..498504fe474 100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundEY.h
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundEY.h
@@ -349,9 +349,11 @@ struct BattlegroundEYScore final : public BattlegroundScore
}
}
- void BuildObjectivesBlock(std::vector<int32>& stats) override
+ void BuildPvPLogPlayerDataPacket(WorldPackets::Battleground::PVPLogData::PlayerData& playerData) const override
{
- stats.push_back(FlagCaptures);
+ BattlegroundScore::BuildPvPLogPlayerDataPacket(playerData);
+
+ playerData.Stats.push_back(FlagCaptures);
}
uint32 GetAttr1() const final override { return FlagCaptures; }
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundIC.h b/src/server/game/Battlegrounds/Zones/BattlegroundIC.h
index be8f46a0a35..016953e8066 100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundIC.h
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundIC.h
@@ -909,10 +909,12 @@ struct BattlegroundICScore final : public BattlegroundScore
}
}
- void BuildObjectivesBlock(std::vector<int32>& stats) override
+ void BuildPvPLogPlayerDataPacket(WorldPackets::Battleground::PVPLogData::PlayerData& playerData) const override
{
- stats.push_back(BasesAssaulted);
- stats.push_back(BasesDefended);
+ BattlegroundScore::BuildPvPLogPlayerDataPacket(playerData);
+
+ playerData.Stats.push_back(BasesAssaulted);
+ playerData.Stats.push_back(BasesDefended);
}
uint32 GetAttr1() const final override { return BasesAssaulted; }
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundSA.h b/src/server/game/Battlegrounds/Zones/BattlegroundSA.h
index 8d6f0c5acb0..ccb7540c65f 100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundSA.h
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundSA.h
@@ -531,10 +531,12 @@ struct BattlegroundSAScore final : public BattlegroundScore
}
}
- void BuildObjectivesBlock(std::vector<int32>& stats) override
+ void BuildPvPLogPlayerDataPacket(WorldPackets::Battleground::PVPLogData::PlayerData& playerData) const override
{
- stats.push_back(DemolishersDestroyed);
- stats.push_back(GatesDestroyed);
+ BattlegroundScore::BuildPvPLogPlayerDataPacket(playerData);
+
+ playerData.Stats.push_back(DemolishersDestroyed);
+ playerData.Stats.push_back(GatesDestroyed);
}
uint32 GetAttr1() const final override { return DemolishersDestroyed; }
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundTP.h b/src/server/game/Battlegrounds/Zones/BattlegroundTP.h
index 6a67bc91304..f5e625220fb 100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundTP.h
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundTP.h
@@ -42,10 +42,12 @@ class BattlegroundTPScore final : public BattlegroundScore
}
}
- void BuildObjectivesBlock(std::vector<int32>& stats) override
+ void BuildPvPLogPlayerDataPacket(WorldPackets::Battleground::PVPLogData::PlayerData& playerData) const override
{
- stats.push_back(FlagCaptures);
- stats.push_back(FlagReturns);
+ BattlegroundScore::BuildPvPLogPlayerDataPacket(playerData);
+
+ playerData.Stats.push_back(FlagCaptures);
+ playerData.Stats.push_back(FlagReturns);
}
uint32 GetAttr1() const final override { return FlagCaptures; }
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundWS.h b/src/server/game/Battlegrounds/Zones/BattlegroundWS.h
index 120fca64c9e..c5e6b5e8015 100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundWS.h
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundWS.h
@@ -176,10 +176,12 @@ struct BattlegroundWGScore final : public BattlegroundScore
}
}
- void BuildObjectivesBlock(std::vector<int32>& stats) override
+ void BuildPvPLogPlayerDataPacket(WorldPackets::Battleground::PVPLogData::PlayerData& playerData) const override
{
- stats.push_back(FlagCaptures);
- stats.push_back(FlagReturns);
+ BattlegroundScore::BuildPvPLogPlayerDataPacket(playerData);
+
+ playerData.Stats.push_back(FlagCaptures);
+ playerData.Stats.push_back(FlagReturns);
}
uint32 GetAttr1() const final override { return FlagCaptures; }
diff --git a/src/server/game/Server/Packets/BattlegroundPackets.h b/src/server/game/Server/Packets/BattlegroundPackets.h
index ff38b48e00d..598d3dc7def 100644
--- a/src/server/game/Server/Packets/BattlegroundPackets.h
+++ b/src/server/game/Server/Packets/BattlegroundPackets.h
@@ -123,7 +123,7 @@ namespace WorldPackets
std::vector<int32> Stats;
int32 PrimaryTalentTree = 0;
int32 PrimaryTalentTreeNameIndex = 0; // controls which name field from ChrSpecialization.dbc will be sent to lua
- int32 Race;
+ int32 Race = 0;
uint32 Prestige = 0;
};