mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
Core/Battleground: Rework BattlegroundScore (#29438)
This commit is contained in:
60
sql/updates/hotfixes/master/2023_12_12_00_hotfixes.sql
Normal file
60
sql/updates/hotfixes/master/2023_12_12_00_hotfixes.sql
Normal file
@@ -0,0 +1,60 @@
|
||||
--
|
||||
-- Table structure for table `pvp_stat`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `pvp_stat`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!50503 SET character_set_client = utf8mb4 */;
|
||||
CREATE TABLE `pvp_stat` (
|
||||
`Description` text,
|
||||
`ID` int(10) unsigned NOT NULL DEFAULT '0',
|
||||
`MapID` int(11) NOT NULL DEFAULT '0',
|
||||
`VerifiedBuild` int(11) NOT NULL DEFAULT '0',
|
||||
PRIMARY KEY (`ID`,`VerifiedBuild`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
-- Dumping data for table `pvp_stat`
|
||||
--
|
||||
|
||||
LOCK TABLES `pvp_stat` WRITE;
|
||||
/*!40000 ALTER TABLE `pvp_stat` DISABLE KEYS */;
|
||||
/*!40000 ALTER TABLE `pvp_stat` ENABLE KEYS */;
|
||||
UNLOCK TABLES;
|
||||
|
||||
--
|
||||
-- Table structure for table `pvp_stat_locale`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `pvp_stat_locale`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!50503 SET character_set_client = utf8mb4 */;
|
||||
CREATE TABLE `pvp_stat_locale` (
|
||||
`ID` int(10) unsigned NOT NULL DEFAULT '0',
|
||||
`locale` varchar(4) NOT NULL,
|
||||
`Description_lang` text,
|
||||
`VerifiedBuild` int(11) NOT NULL DEFAULT '0',
|
||||
PRIMARY KEY (`ID`,`locale`,`VerifiedBuild`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci
|
||||
/*!50500 PARTITION BY LIST COLUMNS(locale)
|
||||
(PARTITION deDE VALUES IN ('deDE') ENGINE = InnoDB,
|
||||
PARTITION esES VALUES IN ('esES') ENGINE = InnoDB,
|
||||
PARTITION esMX VALUES IN ('esMX') ENGINE = InnoDB,
|
||||
PARTITION frFR VALUES IN ('frFR') ENGINE = InnoDB,
|
||||
PARTITION itIT VALUES IN ('itIT') ENGINE = InnoDB,
|
||||
PARTITION koKR VALUES IN ('koKR') ENGINE = InnoDB,
|
||||
PARTITION ptBR VALUES IN ('ptBR') ENGINE = InnoDB,
|
||||
PARTITION ruRU VALUES IN ('ruRU') ENGINE = InnoDB,
|
||||
PARTITION zhCN VALUES IN ('zhCN') ENGINE = InnoDB,
|
||||
PARTITION zhTW VALUES IN ('zhTW') ENGINE = InnoDB) */;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
-- Dumping data for table `pvp_stat_locale`
|
||||
--
|
||||
|
||||
LOCK TABLES `pvp_stat_locale` WRITE;
|
||||
/*!40000 ALTER TABLE `pvp_stat_locale` DISABLE KEYS */;
|
||||
/*!40000 ALTER TABLE `pvp_stat_locale` ENABLE KEYS */;
|
||||
UNLOCK TABLES;
|
||||
@@ -1274,6 +1274,11 @@ void HotfixDatabaseConnection::DoPrepareStatements()
|
||||
PrepareStatement(HOTFIX_SEL_PVP_ITEM, "SELECT ID, ItemID, ItemLevelDelta FROM pvp_item WHERE (`VerifiedBuild` > 0) = ?", CONNECTION_SYNCH);
|
||||
PREPARE_MAX_ID_STMT(HOTFIX_SEL_PVP_ITEM, "SELECT MAX(ID) + 1 FROM pvp_item", CONNECTION_SYNCH);
|
||||
|
||||
// PvpStat.db2
|
||||
PrepareStatement(HOTFIX_SEL_PVP_STAT, "SELECT Description, ID, MapID FROM pvp_stat WHERE (`VerifiedBuild` > 0) = ?", CONNECTION_SYNCH);
|
||||
PREPARE_MAX_ID_STMT(HOTFIX_SEL_PVP_STAT, "SELECT MAX(ID) + 1 FROM pvp_stat", CONNECTION_SYNCH);
|
||||
PREPARE_LOCALE_STMT(HOTFIX_SEL_PVP_STAT, "SELECT ID, Description_lang FROM pvp_stat_locale WHERE (`VerifiedBuild` > 0) = ? AND locale = ?", CONNECTION_SYNCH);
|
||||
|
||||
// PvpSeason.db2
|
||||
PrepareStatement(HOTFIX_SEL_PVP_SEASON, "SELECT ID, MilestoneSeason, AllianceAchievementID, HordeAchievementID FROM pvp_season"
|
||||
" WHERE (`VerifiedBuild` > 0) = ?", CONNECTION_SYNCH);
|
||||
|
||||
@@ -729,6 +729,10 @@ enum HotfixDatabaseStatements : uint32
|
||||
HOTFIX_SEL_PVP_ITEM,
|
||||
HOTFIX_SEL_PVP_ITEM_MAX_ID,
|
||||
|
||||
HOTFIX_SEL_PVP_STAT,
|
||||
HOTFIX_SEL_PVP_STAT_MAX_ID,
|
||||
HOTFIX_SEL_PVP_STAT_LOCALE,
|
||||
|
||||
HOTFIX_SEL_PVP_SEASON,
|
||||
HOTFIX_SEL_PVP_SEASON_MAX_ID,
|
||||
|
||||
|
||||
@@ -17,6 +17,8 @@
|
||||
|
||||
#include "Arena.h"
|
||||
#include "ArenaTeamMgr.h"
|
||||
#include "BattlegroundPackets.h"
|
||||
#include "BattlegroundScore.h"
|
||||
#include "GuildMgr.h"
|
||||
#include "Guild.h"
|
||||
#include "Log.h"
|
||||
@@ -41,10 +43,7 @@ Arena::Arena(BattlegroundTemplate const* battlegroundTemplate) : Battleground(ba
|
||||
|
||||
void Arena::AddPlayer(Player* player, BattlegroundQueueTypeId queueId)
|
||||
{
|
||||
bool const isInBattleground = IsPlayerInBattleground(player->GetGUID());
|
||||
Battleground::AddPlayer(player, queueId);
|
||||
if (!isInBattleground)
|
||||
PlayerScores[player->GetGUID()] = new ArenaScore(player->GetGUID(), player->GetBGTeam());
|
||||
|
||||
if (player->GetBGTeam() == ALLIANCE) // gold
|
||||
{
|
||||
|
||||
@@ -16,38 +16,6 @@
|
||||
*/
|
||||
|
||||
#include "ArenaScore.h"
|
||||
#include <sstream>
|
||||
|
||||
ArenaScore::ArenaScore(ObjectGuid playerGuid, uint32 team) : BattlegroundScore(playerGuid, team)
|
||||
{
|
||||
}
|
||||
|
||||
void ArenaScore::BuildPvPLogPlayerDataPacket(WorldPackets::Battleground::PVPMatchStatistics::PVPMatchPlayerStatistics& playerData) const
|
||||
{
|
||||
BattlegroundScore::BuildPvPLogPlayerDataPacket(playerData);
|
||||
|
||||
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()
|
||||
{
|
||||
|
||||
@@ -18,41 +18,19 @@
|
||||
#ifndef TRINITY_ARENA_SCORE_H
|
||||
#define TRINITY_ARENA_SCORE_H
|
||||
|
||||
#include "BattlegroundScore.h"
|
||||
|
||||
struct TC_GAME_API ArenaScore : public BattlegroundScore
|
||||
{
|
||||
friend class Arena;
|
||||
|
||||
protected:
|
||||
ArenaScore(ObjectGuid playerGuid, uint32 team);
|
||||
|
||||
void BuildPvPLogPlayerDataPacket(WorldPackets::Battleground::PVPMatchStatistics::PVPMatchPlayerStatistics& playerData) const override;
|
||||
|
||||
// For Logging purpose
|
||||
std::string ToString() const override;
|
||||
|
||||
uint32 PreMatchRating = 0;
|
||||
uint32 PreMatchMMR = 0;
|
||||
uint32 PostMatchRating = 0;
|
||||
uint32 PostMatchMMR = 0;
|
||||
};
|
||||
#include "Define.h"
|
||||
|
||||
struct TC_GAME_API ArenaTeamScore
|
||||
{
|
||||
friend class Arena;
|
||||
friend class Battleground;
|
||||
ArenaTeamScore();
|
||||
virtual ~ArenaTeamScore();
|
||||
|
||||
protected:
|
||||
ArenaTeamScore();
|
||||
virtual ~ArenaTeamScore();
|
||||
void Assign(uint32 preMatchRating, uint32 postMatchRating, uint32 preMatchMMR, uint32 postMatchMMR);
|
||||
|
||||
void Assign(uint32 preMatchRating, uint32 postMatchRating, uint32 preMatchMMR, uint32 postMatchMMR);
|
||||
|
||||
uint32 PreMatchRating = 0;
|
||||
uint32 PostMatchRating = 0;
|
||||
uint32 PreMatchMMR = 0;
|
||||
uint32 PostMatchMMR = 0;
|
||||
uint32 PreMatchRating = 0;
|
||||
uint32 PostMatchRating = 0;
|
||||
uint32 PreMatchMMR = 0;
|
||||
uint32 PostMatchMMR = 0;
|
||||
};
|
||||
|
||||
#endif // TRINITY_ARENA_SCORE_H
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
#include "Language.h"
|
||||
#include "Log.h"
|
||||
#include "Map.h"
|
||||
#include "MapUtils.h"
|
||||
#include "MiscPackets.h"
|
||||
#include "ObjectAccessor.h"
|
||||
#include "ObjectMgr.h"
|
||||
@@ -55,7 +56,7 @@ void Battleground::BroadcastWorker(Do& _do)
|
||||
_do(player);
|
||||
}
|
||||
|
||||
Battleground::Battleground(BattlegroundTemplate const* battlegroundTemplate) : _battlegroundTemplate(battlegroundTemplate), _pvpDifficultyEntry(nullptr)
|
||||
Battleground::Battleground(BattlegroundTemplate const* battlegroundTemplate) : _battlegroundTemplate(battlegroundTemplate), _pvpDifficultyEntry(nullptr), _pvpStatIds(nullptr)
|
||||
{
|
||||
ASSERT(_battlegroundTemplate, "Nonexisting Battleground Template passed to battleground ctor!");
|
||||
|
||||
@@ -742,11 +743,11 @@ void Battleground::EndBattleground(uint32 winner)
|
||||
stmt->setUInt32(6, score->second->GetBonusHonor());
|
||||
stmt->setUInt32(7, score->second->GetDamageDone());
|
||||
stmt->setUInt32(8, score->second->GetHealingDone());
|
||||
stmt->setUInt32(9, score->second->GetAttr1());
|
||||
stmt->setUInt32(10, score->second->GetAttr2());
|
||||
stmt->setUInt32(11, score->second->GetAttr3());
|
||||
stmt->setUInt32(12, score->second->GetAttr4());
|
||||
stmt->setUInt32(13, score->second->GetAttr5());
|
||||
stmt->setUInt32(9, score->second->GetAttr(0));
|
||||
stmt->setUInt32(10, score->second->GetAttr(1));
|
||||
stmt->setUInt32(11, score->second->GetAttr(2));
|
||||
stmt->setUInt32(12, score->second->GetAttr(3));
|
||||
stmt->setUInt32(13, score->second->GetAttr(4));
|
||||
|
||||
CharacterDatabase.Execute(stmt);
|
||||
}
|
||||
@@ -1013,7 +1014,10 @@ void Battleground::AddPlayer(Player* player, BattlegroundQueueTypeId queueId)
|
||||
m_Players[player->GetGUID()] = bp;
|
||||
|
||||
if (!isInBattleground)
|
||||
{
|
||||
UpdatePlayersCountByTeam(team, false); // +1 player
|
||||
PlayerScores[player->GetGUID()] = new BattlegroundScore(player->GetGUID(), player->GetBGTeam(), _pvpStatIds);
|
||||
}
|
||||
|
||||
WorldPackets::Battleground::BattlegroundPlayerJoined playerJoined;
|
||||
playerJoined.Guid = player->GetGUID();
|
||||
@@ -1285,26 +1289,31 @@ void Battleground::BuildPvPLogDataPacket(WorldPackets::Battleground::PVPMatchSta
|
||||
pvpLogData.Statistics.reserve(GetPlayerScoresSize());
|
||||
for (auto const& score : PlayerScores)
|
||||
{
|
||||
WorldPackets::Battleground::PVPMatchStatistics::PVPMatchPlayerStatistics playerData;
|
||||
score.second->BuildPvPLogPlayerDataPacket(playerData);
|
||||
|
||||
if (Player* player = ObjectAccessor::GetPlayer(GetBgMap(), playerData.PlayerGUID))
|
||||
if (Player* player = ObjectAccessor::GetPlayer(GetBgMap(), score.first))
|
||||
{
|
||||
WorldPackets::Battleground::PVPMatchStatistics::PVPMatchPlayerStatistics playerData;
|
||||
score.second->BuildPvPLogPlayerDataPacket(playerData);
|
||||
|
||||
playerData.IsInWorld = true;
|
||||
playerData.PrimaryTalentTree = AsUnderlyingType(player->GetPrimarySpecialization());
|
||||
playerData.Sex = player->GetGender();
|
||||
playerData.Race = player->GetRace();
|
||||
playerData.Class = player->GetClass();
|
||||
playerData.HonorLevel = player->GetHonorLevel();
|
||||
}
|
||||
|
||||
pvpLogData.Statistics.push_back(playerData);
|
||||
pvpLogData.Statistics.push_back(playerData);
|
||||
}
|
||||
}
|
||||
|
||||
pvpLogData.PlayerCount[PVP_TEAM_HORDE] = int8(GetPlayersCountByTeam(HORDE));
|
||||
pvpLogData.PlayerCount[PVP_TEAM_ALLIANCE] = int8(GetPlayersCountByTeam(ALLIANCE));
|
||||
}
|
||||
|
||||
BattlegroundScore const* Battleground::GetBattlegroundScore(Player* player) const
|
||||
{
|
||||
return Trinity::Containers::MapGetValuePtr(PlayerScores, player->GetGUID());
|
||||
}
|
||||
|
||||
bool Battleground::UpdatePlayerScore(Player* player, uint32 type, uint32 value, bool doAddHonor)
|
||||
{
|
||||
BattlegroundScoreMap::const_iterator itr = PlayerScores.find(player->GetGUID());
|
||||
@@ -1319,6 +1328,12 @@ bool Battleground::UpdatePlayerScore(Player* player, uint32 type, uint32 value,
|
||||
return true;
|
||||
}
|
||||
|
||||
void Battleground::UpdatePvpStat(Player* player, uint32 pvpStatId, uint32 value)
|
||||
{
|
||||
if (BattlegroundScore* score = Trinity::Containers::MapGetValuePtr(PlayerScores, player->GetGUID()))
|
||||
score->UpdatePvpStat(pvpStatId, value);
|
||||
}
|
||||
|
||||
bool Battleground::AddObject(uint32 type, uint32 entry, float x, float y, float z, float o, float rotation0, float rotation1, float rotation2, float rotation3, uint32 /*respawnTime*/, GOState goState)
|
||||
{
|
||||
// If the assert is called, means that BgObjects must be resized!
|
||||
@@ -1451,6 +1466,15 @@ uint32 Battleground::GetMapId() const
|
||||
return _battlegroundTemplate->BattlemasterEntry->MapID[0];
|
||||
}
|
||||
|
||||
void Battleground::SetBgMap(BattlegroundMap* map)
|
||||
{
|
||||
m_Map = map;
|
||||
if (map)
|
||||
_pvpStatIds = sDB2Manager.GetPVPStatIDsForMap(map->GetId());
|
||||
else
|
||||
_pvpStatIds = nullptr;
|
||||
}
|
||||
|
||||
void Battleground::SpawnBGObject(uint32 type, uint32 respawntime)
|
||||
{
|
||||
if (Map* map = FindBgMap())
|
||||
|
||||
@@ -36,6 +36,7 @@ class Transport;
|
||||
class Unit;
|
||||
class WorldObject;
|
||||
class WorldPacket;
|
||||
struct BattlegroundPlayerScoreTemplate;
|
||||
struct BattlegroundScore;
|
||||
struct BattlegroundTemplate;
|
||||
struct PVPDifficultyEntry;
|
||||
@@ -309,6 +310,7 @@ class TC_GAME_API Battleground : public ZoneScript
|
||||
void SetRated(bool state) { m_IsRated = state; }
|
||||
void SetArenaType(uint8 type) { m_ArenaType = type; }
|
||||
void SetWinner(PvPTeamId winnerTeamId) { _winnerTeamId = winnerTeamId; }
|
||||
std::unordered_set<uint32> const* GetPvpStatIds() const { return _pvpStatIds; }
|
||||
|
||||
void ModifyStartDelayTime(int diff) { m_StartDelayTime -= diff; }
|
||||
void SetStartDelayTime(int Time) { m_StartDelayTime = Time; }
|
||||
@@ -343,7 +345,7 @@ class TC_GAME_API Battleground : public ZoneScript
|
||||
uint32 GetMapId() const;
|
||||
|
||||
// Map pointers
|
||||
void SetBgMap(BattlegroundMap* map) { m_Map = map; }
|
||||
void SetBgMap(BattlegroundMap* map);
|
||||
BattlegroundMap* GetBgMap() const;
|
||||
BattlegroundMap* FindBgMap() const { return m_Map; }
|
||||
|
||||
@@ -380,7 +382,11 @@ class TC_GAME_API Battleground : public ZoneScript
|
||||
void SetBgRaid(uint32 TeamID, Group* bg_raid);
|
||||
|
||||
virtual void BuildPvPLogDataPacket(WorldPackets::Battleground::PVPMatchStatistics& pvpLogData) const;
|
||||
|
||||
BattlegroundScore const* GetBattlegroundScore(Player* player) const;
|
||||
|
||||
virtual bool UpdatePlayerScore(Player* player, uint32 type, uint32 value, bool doAddHonor = true);
|
||||
void UpdatePvpStat(Player* player, uint32 pvpStatId, uint32 value);
|
||||
|
||||
static TeamId GetTeamIndexByTeamId(uint32 Team) { return Team == ALLIANCE ? TEAM_ALLIANCE : TEAM_HORDE; }
|
||||
uint32 GetPlayersCountByTeam(uint32 Team) const { return m_PlayersCount[GetTeamIndexByTeamId(Team)]; }
|
||||
@@ -601,6 +607,7 @@ class TC_GAME_API Battleground : public ZoneScript
|
||||
|
||||
BattlegroundTemplate const* _battlegroundTemplate;
|
||||
PVPDifficultyEntry const* _pvpDifficultyEntry;
|
||||
std::unordered_set<uint32> const* _pvpStatIds;
|
||||
|
||||
std::vector<WorldPackets::Battleground::BattlegroundPlayerPosition> _playerPositions;
|
||||
};
|
||||
|
||||
@@ -150,6 +150,7 @@ class TC_GAME_API BattlegroundMgr
|
||||
return &itr->second;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
private:
|
||||
uint32 CreateClientVisibleInstanceId(BattlegroundTypeId bgTypeId, BattlegroundBracketId bracket_id);
|
||||
static bool IsArenaType(BattlegroundTypeId bgTypeId);
|
||||
|
||||
@@ -16,17 +16,25 @@
|
||||
*/
|
||||
|
||||
#include "BattlegroundScore.h"
|
||||
#include "BattlegroundMgr.h"
|
||||
#include "Errors.h"
|
||||
#include "Log.h"
|
||||
#include "ObjectAccessor.h"
|
||||
#include "Player.h"
|
||||
#include "SharedDefines.h"
|
||||
|
||||
BattlegroundScore::BattlegroundScore(ObjectGuid playerGuid, uint32 team) : PlayerGuid(playerGuid), TeamId(team == ALLIANCE ? PVP_TEAM_ALLIANCE : PVP_TEAM_HORDE),
|
||||
KillingBlows(0), Deaths(0), HonorableKills(0), BonusHonor(0), DamageDone(0), HealingDone(0)
|
||||
#include <sstream>
|
||||
|
||||
BattlegroundScore::BattlegroundScore(ObjectGuid playerGuid, uint32 team, std::unordered_set<uint32> const* pvpStatIds) : PlayerGuid(playerGuid), TeamId(team == ALLIANCE ? PVP_TEAM_ALLIANCE : PVP_TEAM_HORDE),
|
||||
KillingBlows(0), Deaths(0), HonorableKills(0), BonusHonor(0), DamageDone(0), HealingDone(0),
|
||||
PreMatchRating(0), PreMatchMMR(0), PostMatchRating(0), PostMatchMMR(0), _validPvpStatIds(pvpStatIds)
|
||||
{
|
||||
if (_validPvpStatIds)
|
||||
for (uint32 pvpStatId : *_validPvpStatIds)
|
||||
PvpStats[pvpStatId] = 0;
|
||||
}
|
||||
|
||||
BattlegroundScore::~BattlegroundScore()
|
||||
{
|
||||
}
|
||||
BattlegroundScore::~BattlegroundScore() = default;
|
||||
|
||||
void BattlegroundScore::UpdateScore(uint32 type, uint32 value)
|
||||
{
|
||||
@@ -56,6 +64,31 @@ void BattlegroundScore::UpdateScore(uint32 type, uint32 value)
|
||||
}
|
||||
}
|
||||
|
||||
void BattlegroundScore::UpdatePvpStat(uint32 pvpStatID, uint32 value)
|
||||
{
|
||||
if (!_validPvpStatIds)
|
||||
return;
|
||||
|
||||
if (!_validPvpStatIds->contains(pvpStatID))
|
||||
{
|
||||
TC_LOG_WARN("bg.scores", "Tried updating PvpStat {} but this stat is not allowed on this map", pvpStatID);
|
||||
return;
|
||||
}
|
||||
|
||||
PvpStats[pvpStatID] += value;
|
||||
if (Player* player = ObjectAccessor::FindConnectedPlayer(PlayerGuid))
|
||||
player->UpdateCriteria(CriteriaType::TrackedWorldStateUIModified, pvpStatID);
|
||||
}
|
||||
|
||||
uint32 BattlegroundScore::GetAttr(uint8 index) const
|
||||
{
|
||||
auto const& itr = std::next(PvpStats.begin(), index);
|
||||
if (itr == PvpStats.end())
|
||||
return 0;
|
||||
|
||||
return itr->second;
|
||||
}
|
||||
|
||||
void BattlegroundScore::BuildPvPLogPlayerDataPacket(WorldPackets::Battleground::PVPMatchStatistics::PVPMatchPlayerStatistics& playerData) const
|
||||
{
|
||||
playerData.PlayerGUID = PlayerGuid;
|
||||
@@ -71,4 +104,28 @@ void BattlegroundScore::BuildPvPLogPlayerDataPacket(WorldPackets::Battleground::
|
||||
|
||||
playerData.DamageDone = DamageDone;
|
||||
playerData.HealingDone = HealingDone;
|
||||
|
||||
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 (const auto& [pvpStatID, value] : PvpStats)
|
||||
playerData.Stats.emplace_back(pvpStatID, value);
|
||||
}
|
||||
|
||||
std::string BattlegroundScore::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();
|
||||
}
|
||||
|
||||
@@ -20,8 +20,11 @@
|
||||
|
||||
#include "BattlegroundPackets.h"
|
||||
#include "ObjectGuid.h"
|
||||
#include <map>
|
||||
#include <string>
|
||||
|
||||
struct BattlegroundPlayerScoreTemplate;
|
||||
|
||||
enum ScoreType
|
||||
{
|
||||
// ALL
|
||||
@@ -30,67 +33,53 @@ enum ScoreType
|
||||
SCORE_HONORABLE_KILLS = 3,
|
||||
SCORE_BONUS_HONOR = 4,
|
||||
SCORE_DAMAGE_DONE = 5,
|
||||
SCORE_HEALING_DONE = 6,
|
||||
|
||||
// WS, EY and TP
|
||||
SCORE_FLAG_CAPTURES = 7,
|
||||
SCORE_FLAG_RETURNS = 8,
|
||||
|
||||
// AB and IC
|
||||
SCORE_BASES_ASSAULTED = 9,
|
||||
SCORE_BASES_DEFENDED = 10,
|
||||
|
||||
// AV
|
||||
SCORE_GRAVEYARDS_ASSAULTED = 11,
|
||||
SCORE_GRAVEYARDS_DEFENDED = 12,
|
||||
SCORE_TOWERS_ASSAULTED = 13,
|
||||
SCORE_TOWERS_DEFENDED = 14,
|
||||
SCORE_MINES_CAPTURED = 15,
|
||||
|
||||
// SOTA
|
||||
SCORE_DESTROYED_DEMOLISHER = 16,
|
||||
SCORE_DESTROYED_WALL = 17
|
||||
SCORE_HEALING_DONE = 6
|
||||
};
|
||||
|
||||
struct BattlegroundScore
|
||||
{
|
||||
friend class Arena;
|
||||
friend class Battleground;
|
||||
BattlegroundScore(ObjectGuid playerGuid, uint32 team, std::unordered_set<uint32> const* pvpStatIds);
|
||||
virtual ~BattlegroundScore();
|
||||
|
||||
protected:
|
||||
BattlegroundScore(ObjectGuid playerGuid, uint32 team);
|
||||
virtual ~BattlegroundScore();
|
||||
void UpdateScore(uint32 type, uint32 value);
|
||||
void UpdatePvpStat(uint32 pvpStatID, uint32 value);
|
||||
|
||||
virtual void UpdateScore(uint32 type, uint32 value);
|
||||
// For Logging purpose
|
||||
std::string ToString() const;
|
||||
|
||||
virtual void BuildPvPLogPlayerDataPacket(WorldPackets::Battleground::PVPMatchStatistics::PVPMatchPlayerStatistics& playerData) const;
|
||||
uint32 GetKillingBlows() const { return KillingBlows; }
|
||||
uint32 GetDeaths() const { return Deaths; }
|
||||
uint32 GetHonorableKills() const { return HonorableKills; }
|
||||
uint32 GetBonusHonor() const { return BonusHonor; }
|
||||
uint32 GetDamageDone() const { return DamageDone; }
|
||||
uint32 GetHealingDone() const { return HealingDone; }
|
||||
|
||||
// For Logging purpose
|
||||
virtual std::string ToString() const { return ""; }
|
||||
uint32 GetAttr(uint8 index) const;
|
||||
|
||||
uint32 GetKillingBlows() const { return KillingBlows; }
|
||||
uint32 GetDeaths() const { return Deaths; }
|
||||
uint32 GetHonorableKills() const { return HonorableKills; }
|
||||
uint32 GetBonusHonor() const { return BonusHonor; }
|
||||
uint32 GetDamageDone() const { return DamageDone; }
|
||||
uint32 GetHealingDone() const { return HealingDone; }
|
||||
void BuildPvPLogPlayerDataPacket(WorldPackets::Battleground::PVPMatchStatistics::PVPMatchPlayerStatistics& playerData) const;
|
||||
|
||||
virtual uint32 GetAttr1() const { return 0; }
|
||||
virtual uint32 GetAttr2() const { return 0; }
|
||||
virtual uint32 GetAttr3() const { return 0; }
|
||||
virtual uint32 GetAttr4() const { return 0; }
|
||||
virtual uint32 GetAttr5() const { return 0; }
|
||||
protected:
|
||||
|
||||
ObjectGuid PlayerGuid;
|
||||
uint8 TeamId; // PvPTeamId
|
||||
ObjectGuid PlayerGuid;
|
||||
uint8 TeamId; // PvPTeamId
|
||||
|
||||
// Default score, present in every type
|
||||
uint32 KillingBlows;
|
||||
uint32 Deaths;
|
||||
uint32 HonorableKills;
|
||||
uint32 BonusHonor;
|
||||
uint32 DamageDone;
|
||||
uint32 HealingDone;
|
||||
// Default score, present in every type
|
||||
uint32 KillingBlows;
|
||||
uint32 Deaths;
|
||||
uint32 HonorableKills;
|
||||
uint32 BonusHonor;
|
||||
uint32 DamageDone;
|
||||
uint32 HealingDone;
|
||||
|
||||
uint32 PreMatchRating;
|
||||
uint32 PreMatchMMR;
|
||||
uint32 PostMatchRating;
|
||||
uint32 PostMatchMMR;
|
||||
|
||||
std::map<uint32 /*pvpStatID*/, uint32 /*value*/> PvpStats;
|
||||
|
||||
private:
|
||||
std::unordered_set<uint32> const* _validPvpStatIds;
|
||||
};
|
||||
|
||||
#endif // TRINITY_BATTLEGROUND_SCORE_H
|
||||
|
||||
@@ -17,6 +17,8 @@
|
||||
|
||||
#include "BattlegroundAB.h"
|
||||
#include "BattlegroundMgr.h"
|
||||
#include "BattlegroundPackets.h"
|
||||
#include "BattlegroundScore.h"
|
||||
#include "Creature.h"
|
||||
#include "GameObject.h"
|
||||
#include "Log.h"
|
||||
@@ -25,6 +27,12 @@
|
||||
#include "Player.h"
|
||||
#include "SpellInfo.h"
|
||||
|
||||
enum ArathiBasinPvpStats
|
||||
{
|
||||
PVP_STAT_BASES_ASSAULTED = 926,
|
||||
PVP_STAT_BASES_DEFENDED = 927,
|
||||
};
|
||||
|
||||
BattlegroundAB::BattlegroundAB(BattlegroundTemplate const* battlegroundTemplate) : Battleground(battlegroundTemplate)
|
||||
{
|
||||
m_IsInformedNearVictory = false;
|
||||
@@ -131,18 +139,6 @@ void BattlegroundAB::StartingEventOpenDoors()
|
||||
TriggerGameEvent(AB_EVENT_START_BATTLE);
|
||||
}
|
||||
|
||||
void BattlegroundAB::AddPlayer(Player* player, BattlegroundQueueTypeId queueId)
|
||||
{
|
||||
bool const isInBattleground = IsPlayerInBattleground(player->GetGUID());
|
||||
Battleground::AddPlayer(player, queueId);
|
||||
if (!isInBattleground)
|
||||
PlayerScores[player->GetGUID()] = new BattlegroundABScore(player->GetGUID(), player->GetBGTeam());
|
||||
}
|
||||
|
||||
void BattlegroundAB::RemovePlayer(Player* /*player*/, ObjectGuid /*guid*/, uint32 /*team*/)
|
||||
{
|
||||
}
|
||||
|
||||
void BattlegroundAB::HandleAreaTrigger(Player* player, uint32 trigger, bool entered)
|
||||
{
|
||||
switch (trigger)
|
||||
@@ -241,14 +237,14 @@ void BattlegroundAB::ProcessEvent(WorldObject* /*source*/, uint32 eventId, World
|
||||
UpdateWorldState(BG_AB_WS_BLACKSMITH_HORDE_CONTROL_STATE, 0);
|
||||
PlaySoundToAll(BG_AB_SOUND_NODE_ASSAULTED_ALLIANCE);
|
||||
if (Player* player = invoker->ToPlayer())
|
||||
UpdatePlayerScore(player, SCORE_BASES_ASSAULTED, 1);
|
||||
UpdatePvpStat(player, PVP_STAT_BASES_ASSAULTED, 1);
|
||||
break;
|
||||
case AB_EVENT_DEFENDED_BLACKSMITH_ALLIANCE:
|
||||
UpdateWorldState(BG_AB_WS_BLACKSMITH_ALLIANCE_CONTROL_STATE, 2);
|
||||
UpdateWorldState(BG_AB_WS_BLACKSMITH_HORDE_CONTROL_STATE, 0);
|
||||
PlaySoundToAll(BG_AB_SOUND_NODE_CAPTURED_ALLIANCE);
|
||||
if (Player* player = invoker->ToPlayer())
|
||||
UpdatePlayerScore(player, SCORE_BASES_DEFENDED, 1);
|
||||
UpdatePvpStat(player, PVP_STAT_BASES_DEFENDED, 1);
|
||||
break;
|
||||
case AB_EVENT_CAPTURE_BLACKSMITH_ALLIANCE:
|
||||
UpdateWorldState(BG_AB_WS_BLACKSMITH_ALLIANCE_CONTROL_STATE, 2);
|
||||
@@ -259,14 +255,14 @@ void BattlegroundAB::ProcessEvent(WorldObject* /*source*/, uint32 eventId, World
|
||||
UpdateWorldState(BG_AB_WS_BLACKSMITH_HORDE_CONTROL_STATE, 1);
|
||||
PlaySoundToAll(BG_AB_SOUND_NODE_ASSAULTED_HORDE);
|
||||
if (Player* player = invoker->ToPlayer())
|
||||
UpdatePlayerScore(player, SCORE_BASES_ASSAULTED, 1);
|
||||
UpdatePvpStat(player, PVP_STAT_BASES_ASSAULTED, 1);
|
||||
break;
|
||||
case AB_EVENT_DEFENDED_BLACKSMITH_HORDE:
|
||||
UpdateWorldState(BG_AB_WS_BLACKSMITH_ALLIANCE_CONTROL_STATE, 0);
|
||||
UpdateWorldState(BG_AB_WS_BLACKSMITH_HORDE_CONTROL_STATE, 2);
|
||||
PlaySoundToAll(BG_AB_SOUND_NODE_CAPTURED_HORDE);
|
||||
if (Player* player = invoker->ToPlayer())
|
||||
UpdatePlayerScore(player, SCORE_BASES_DEFENDED, 1);
|
||||
UpdatePvpStat(player, PVP_STAT_BASES_DEFENDED, 1);
|
||||
break;
|
||||
case AB_EVENT_CAPTURE_BLACKSMITH_HORDE:
|
||||
UpdateWorldState(BG_AB_WS_BLACKSMITH_HORDE_CONTROL_STATE, 2);
|
||||
@@ -277,14 +273,14 @@ void BattlegroundAB::ProcessEvent(WorldObject* /*source*/, uint32 eventId, World
|
||||
UpdateWorldState(BG_AB_WS_FARM_HORDE_CONTROL_STATE, 0);
|
||||
PlaySoundToAll(BG_AB_SOUND_NODE_ASSAULTED_ALLIANCE);
|
||||
if (Player* player = invoker->ToPlayer())
|
||||
UpdatePlayerScore(player, SCORE_BASES_ASSAULTED, 1);
|
||||
UpdatePvpStat(player, PVP_STAT_BASES_ASSAULTED, 1);
|
||||
break;
|
||||
case AB_EVENT_DEFENDED_FARM_ALLIANCE:
|
||||
UpdateWorldState(BG_AB_WS_FARM_ALLIANCE_CONTROL_STATE, 2);
|
||||
UpdateWorldState(BG_AB_WS_FARM_HORDE_CONTROL_STATE, 0);
|
||||
PlaySoundToAll(BG_AB_SOUND_NODE_CAPTURED_ALLIANCE);
|
||||
if (Player* player = invoker->ToPlayer())
|
||||
UpdatePlayerScore(player, SCORE_BASES_DEFENDED, 1);
|
||||
UpdatePvpStat(player, PVP_STAT_BASES_DEFENDED, 1);
|
||||
break;
|
||||
case AB_EVENT_CAPTURE_FARM_ALLIANCE:
|
||||
UpdateWorldState(BG_AB_WS_FARM_ALLIANCE_CONTROL_STATE, 2);
|
||||
@@ -295,14 +291,14 @@ void BattlegroundAB::ProcessEvent(WorldObject* /*source*/, uint32 eventId, World
|
||||
UpdateWorldState(BG_AB_WS_FARM_HORDE_CONTROL_STATE, 1);
|
||||
PlaySoundToAll(BG_AB_SOUND_NODE_ASSAULTED_HORDE);
|
||||
if (Player* player = invoker->ToPlayer())
|
||||
UpdatePlayerScore(player, SCORE_BASES_ASSAULTED, 1);
|
||||
UpdatePvpStat(player, PVP_STAT_BASES_ASSAULTED, 1);
|
||||
break;
|
||||
case AB_EVENT_DEFENDED_FARM_HORDE:
|
||||
UpdateWorldState(BG_AB_WS_FARM_ALLIANCE_CONTROL_STATE, 0);
|
||||
UpdateWorldState(BG_AB_WS_FARM_HORDE_CONTROL_STATE, 2);
|
||||
PlaySoundToAll(BG_AB_SOUND_NODE_CAPTURED_HORDE);
|
||||
if (Player* player = invoker->ToPlayer())
|
||||
UpdatePlayerScore(player, SCORE_BASES_DEFENDED, 1);
|
||||
UpdatePvpStat(player, PVP_STAT_BASES_DEFENDED, 1);
|
||||
break;
|
||||
case AB_EVENT_CAPTURE_FARM_HORDE:
|
||||
UpdateWorldState(BG_AB_WS_FARM_HORDE_CONTROL_STATE, 2);
|
||||
@@ -313,14 +309,14 @@ void BattlegroundAB::ProcessEvent(WorldObject* /*source*/, uint32 eventId, World
|
||||
UpdateWorldState(BG_AB_WS_GOLD_MINE_HORDE_CONTROL_STATE, 0);
|
||||
PlaySoundToAll(BG_AB_SOUND_NODE_ASSAULTED_ALLIANCE);
|
||||
if (Player* player = invoker->ToPlayer())
|
||||
UpdatePlayerScore(player, SCORE_BASES_ASSAULTED, 1);
|
||||
UpdatePvpStat(player, PVP_STAT_BASES_ASSAULTED, 1);
|
||||
break;
|
||||
case AB_EVENT_DEFENDED_GOLD_MINE_ALLIANCE:
|
||||
UpdateWorldState(BG_AB_WS_GOLD_MINE_ALLIANCE_CONTROL_STATE, 2);
|
||||
UpdateWorldState(BG_AB_WS_GOLD_MINE_HORDE_CONTROL_STATE, 0);
|
||||
PlaySoundToAll(BG_AB_SOUND_NODE_CAPTURED_ALLIANCE);
|
||||
if (Player* player = invoker->ToPlayer())
|
||||
UpdatePlayerScore(player, SCORE_BASES_DEFENDED, 1);
|
||||
UpdatePvpStat(player, PVP_STAT_BASES_DEFENDED, 1);
|
||||
break;
|
||||
case AB_EVENT_CAPTURE_GOLD_MINE_ALLIANCE:
|
||||
UpdateWorldState(BG_AB_WS_GOLD_MINE_ALLIANCE_CONTROL_STATE, 2);
|
||||
@@ -331,14 +327,14 @@ void BattlegroundAB::ProcessEvent(WorldObject* /*source*/, uint32 eventId, World
|
||||
UpdateWorldState(BG_AB_WS_GOLD_MINE_HORDE_CONTROL_STATE, 1);
|
||||
PlaySoundToAll(BG_AB_SOUND_NODE_ASSAULTED_HORDE);
|
||||
if (Player* player = invoker->ToPlayer())
|
||||
UpdatePlayerScore(player, SCORE_BASES_ASSAULTED, 1);
|
||||
UpdatePvpStat(player, PVP_STAT_BASES_ASSAULTED, 1);
|
||||
break;
|
||||
case AB_EVENT_DEFENDED_GOLD_MINE_HORDE:
|
||||
UpdateWorldState(BG_AB_WS_GOLD_MINE_ALLIANCE_CONTROL_STATE, 0);
|
||||
UpdateWorldState(BG_AB_WS_GOLD_MINE_HORDE_CONTROL_STATE, 2);
|
||||
PlaySoundToAll(BG_AB_SOUND_NODE_CAPTURED_HORDE);
|
||||
if (Player* player = invoker->ToPlayer())
|
||||
UpdatePlayerScore(player, SCORE_BASES_DEFENDED, 1);
|
||||
UpdatePvpStat(player, PVP_STAT_BASES_DEFENDED, 1);
|
||||
break;
|
||||
case AB_EVENT_CAPTURE_GOLD_MINE_HORDE:
|
||||
UpdateWorldState(BG_AB_WS_GOLD_MINE_HORDE_CONTROL_STATE, 2);
|
||||
@@ -349,14 +345,14 @@ void BattlegroundAB::ProcessEvent(WorldObject* /*source*/, uint32 eventId, World
|
||||
UpdateWorldState(BG_AB_WS_LUMBER_MILL_HORDE_CONTROL_STATE, 0);
|
||||
PlaySoundToAll(BG_AB_SOUND_NODE_ASSAULTED_ALLIANCE);
|
||||
if (Player* player = invoker->ToPlayer())
|
||||
UpdatePlayerScore(player, SCORE_BASES_ASSAULTED, 1);
|
||||
UpdatePvpStat(player, PVP_STAT_BASES_ASSAULTED, 1);
|
||||
break;
|
||||
case AB_EVENT_DEFENDED_LUMBER_MILL_ALLIANCE:
|
||||
UpdateWorldState(BG_AB_WS_LUMBER_MILL_ALLIANCE_CONTROL_STATE, 2);
|
||||
UpdateWorldState(BG_AB_WS_LUMBER_MILL_HORDE_CONTROL_STATE, 0);
|
||||
PlaySoundToAll(BG_AB_SOUND_NODE_CAPTURED_ALLIANCE);
|
||||
if (Player* player = invoker->ToPlayer())
|
||||
UpdatePlayerScore(player, SCORE_BASES_DEFENDED, 1);
|
||||
UpdatePvpStat(player, PVP_STAT_BASES_DEFENDED, 1);
|
||||
break;
|
||||
case AB_EVENT_CAPTURE_LUMBER_MILL_ALLIANCE:
|
||||
UpdateWorldState(BG_AB_WS_LUMBER_MILL_ALLIANCE_CONTROL_STATE, 2);
|
||||
@@ -367,14 +363,14 @@ void BattlegroundAB::ProcessEvent(WorldObject* /*source*/, uint32 eventId, World
|
||||
UpdateWorldState(BG_AB_WS_LUMBER_MILL_HORDE_CONTROL_STATE, 1);
|
||||
PlaySoundToAll(BG_AB_SOUND_NODE_ASSAULTED_HORDE);
|
||||
if (Player* player = invoker->ToPlayer())
|
||||
UpdatePlayerScore(player, SCORE_BASES_ASSAULTED, 1);
|
||||
UpdatePvpStat(player, PVP_STAT_BASES_ASSAULTED, 1);
|
||||
break;
|
||||
case AB_EVENT_DEFENDED_LUMBER_MILL_HORDE:
|
||||
UpdateWorldState(BG_AB_WS_LUMBER_MILL_ALLIANCE_CONTROL_STATE, 0);
|
||||
UpdateWorldState(BG_AB_WS_LUMBER_MILL_HORDE_CONTROL_STATE, 2);
|
||||
PlaySoundToAll(BG_AB_SOUND_NODE_CAPTURED_HORDE);
|
||||
if (Player* player = invoker->ToPlayer())
|
||||
UpdatePlayerScore(player, SCORE_BASES_DEFENDED, 1);
|
||||
UpdatePvpStat(player, PVP_STAT_BASES_DEFENDED, 1);
|
||||
break;
|
||||
case AB_EVENT_CAPTURE_LUMBER_MILL_HORDE:
|
||||
UpdateWorldState(BG_AB_WS_LUMBER_MILL_HORDE_CONTROL_STATE, 2);
|
||||
@@ -385,14 +381,14 @@ void BattlegroundAB::ProcessEvent(WorldObject* /*source*/, uint32 eventId, World
|
||||
UpdateWorldState(BG_AB_WS_STABLES_HORDE_CONTROL_STATE, 0);
|
||||
PlaySoundToAll(BG_AB_SOUND_NODE_ASSAULTED_ALLIANCE);
|
||||
if (Player* player = invoker->ToPlayer())
|
||||
UpdatePlayerScore(player, SCORE_BASES_ASSAULTED, 1);
|
||||
UpdatePvpStat(player, PVP_STAT_BASES_ASSAULTED, 1);
|
||||
break;
|
||||
case AB_EVENT_DEFENDED_STABLES_ALLIANCE:
|
||||
UpdateWorldState(BG_AB_WS_STABLES_ALLIANCE_CONTROL_STATE, 2);
|
||||
UpdateWorldState(BG_AB_WS_STABLES_HORDE_CONTROL_STATE, 0);
|
||||
PlaySoundToAll(BG_AB_SOUND_NODE_CAPTURED_ALLIANCE);
|
||||
if (Player* player = invoker->ToPlayer())
|
||||
UpdatePlayerScore(player, SCORE_BASES_DEFENDED, 1);
|
||||
UpdatePvpStat(player, PVP_STAT_BASES_DEFENDED, 1);
|
||||
break;
|
||||
case AB_EVENT_CAPTURE_STABLES_ALLIANCE:
|
||||
UpdateWorldState(BG_AB_WS_STABLES_ALLIANCE_CONTROL_STATE, 2);
|
||||
@@ -403,14 +399,14 @@ void BattlegroundAB::ProcessEvent(WorldObject* /*source*/, uint32 eventId, World
|
||||
UpdateWorldState(BG_AB_WS_STABLES_HORDE_CONTROL_STATE, 1);
|
||||
PlaySoundToAll(BG_AB_SOUND_NODE_ASSAULTED_HORDE);
|
||||
if (Player* player = invoker->ToPlayer())
|
||||
UpdatePlayerScore(player, SCORE_BASES_ASSAULTED, 1);
|
||||
UpdatePvpStat(player, PVP_STAT_BASES_ASSAULTED, 1);
|
||||
break;
|
||||
case AB_EVENT_DEFENDED_STABLES_HORDE:
|
||||
UpdateWorldState(BG_AB_WS_STABLES_ALLIANCE_CONTROL_STATE, 0);
|
||||
UpdateWorldState(BG_AB_WS_STABLES_HORDE_CONTROL_STATE, 2);
|
||||
PlaySoundToAll(BG_AB_SOUND_NODE_CAPTURED_HORDE);
|
||||
if (Player* player = invoker->ToPlayer())
|
||||
UpdatePlayerScore(player, SCORE_BASES_DEFENDED, 1);
|
||||
UpdatePvpStat(player, PVP_STAT_BASES_DEFENDED, 1);
|
||||
break;
|
||||
case AB_EVENT_CAPTURE_STABLES_HORDE:
|
||||
UpdateWorldState(BG_AB_WS_STABLES_HORDE_CONTROL_STATE, 2);
|
||||
@@ -508,22 +504,3 @@ WorldSafeLocsEntry const* BattlegroundAB::GetExploitTeleportLocation(Team team)
|
||||
{
|
||||
return sObjectMgr->GetWorldSafeLoc(team == ALLIANCE ? AB_EXPLOIT_TELEPORT_LOCATION_ALLIANCE : AB_EXPLOIT_TELEPORT_LOCATION_HORDE);
|
||||
}
|
||||
|
||||
bool BattlegroundAB::UpdatePlayerScore(Player* player, uint32 type, uint32 value, bool doAddHonor)
|
||||
{
|
||||
if (!Battleground::UpdatePlayerScore(player, type, value, doAddHonor))
|
||||
return false;
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case SCORE_BASES_ASSAULTED:
|
||||
player->UpdateCriteria(CriteriaType::TrackedWorldStateUIModified, AB_OBJECTIVE_ASSAULT_BASE);
|
||||
break;
|
||||
case SCORE_BASES_DEFENDED:
|
||||
player->UpdateCriteria(CriteriaType::TrackedWorldStateUIModified, AB_OBJECTIVE_DEFEND_BASE);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
#define __BATTLEGROUNDAB_H
|
||||
|
||||
#include "Battleground.h"
|
||||
#include "BattlegroundScore.h"
|
||||
#include "Object.h"
|
||||
|
||||
enum BG_AB_WorldStates
|
||||
@@ -138,12 +137,6 @@ enum BG_AB_Sounds
|
||||
BG_AB_SOUND_NEAR_VICTORY_HORDE = 8457
|
||||
};
|
||||
|
||||
enum BG_AB_Objectives
|
||||
{
|
||||
AB_OBJECTIVE_ASSAULT_BASE = 926,
|
||||
AB_OBJECTIVE_DEFEND_BASE = 927
|
||||
};
|
||||
|
||||
enum BG_AB_ExploitTeleportLocations
|
||||
{
|
||||
AB_EXPLOIT_TELEPORT_LOCATION_ALLIANCE = 7056,
|
||||
@@ -222,53 +215,13 @@ const uint32 BG_AB_GraveyardIds[BG_AB_ALL_NODES_COUNT] =
|
||||
AB_GRAVEYARD_HORDE_BASE
|
||||
};
|
||||
|
||||
struct BattlegroundABScore final : public BattlegroundScore
|
||||
{
|
||||
friend class BattlegroundAB;
|
||||
|
||||
protected:
|
||||
BattlegroundABScore(ObjectGuid playerGuid, uint32 team) : BattlegroundScore(playerGuid, team), BasesAssaulted(0), BasesDefended(0) { }
|
||||
|
||||
void UpdateScore(uint32 type, uint32 value) override
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case SCORE_BASES_ASSAULTED:
|
||||
BasesAssaulted += value;
|
||||
break;
|
||||
case SCORE_BASES_DEFENDED:
|
||||
BasesDefended += value;
|
||||
break;
|
||||
default:
|
||||
BattlegroundScore::UpdateScore(type, value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void BuildPvPLogPlayerDataPacket(WorldPackets::Battleground::PVPMatchStatistics::PVPMatchPlayerStatistics& playerData) const override
|
||||
{
|
||||
BattlegroundScore::BuildPvPLogPlayerDataPacket(playerData);
|
||||
|
||||
playerData.Stats.emplace_back(AB_OBJECTIVE_ASSAULT_BASE, BasesAssaulted);
|
||||
playerData.Stats.emplace_back(AB_OBJECTIVE_DEFEND_BASE, BasesDefended);
|
||||
}
|
||||
|
||||
uint32 GetAttr1() const final override { return BasesAssaulted; }
|
||||
uint32 GetAttr2() const final override { return BasesDefended; }
|
||||
|
||||
uint32 BasesAssaulted;
|
||||
uint32 BasesDefended;
|
||||
};
|
||||
|
||||
class BattlegroundAB : public Battleground
|
||||
{
|
||||
public:
|
||||
BattlegroundAB(BattlegroundTemplate const* battlegroundTemplate);
|
||||
~BattlegroundAB();
|
||||
|
||||
void AddPlayer(Player* player, BattlegroundQueueTypeId queueId) override;
|
||||
void StartingEventOpenDoors() override;
|
||||
void RemovePlayer(Player* player, ObjectGuid guid, uint32 team) override;
|
||||
void HandleAreaTrigger(Player* source, uint32 trigger, bool entered) override;
|
||||
bool SetupBattleground() override;
|
||||
void Reset() override;
|
||||
@@ -276,9 +229,6 @@ class BattlegroundAB : public Battleground
|
||||
WorldSafeLocsEntry const* GetClosestGraveyard(Player* player) override;
|
||||
WorldSafeLocsEntry const* GetExploitTeleportLocation(Team team) override;
|
||||
|
||||
/* Scorekeeping */
|
||||
bool UpdatePlayerScore(Player* player, uint32 type, uint32 value, bool doAddHonor = true) override;
|
||||
|
||||
uint32 GetPrematureWinner() override;
|
||||
|
||||
void ProcessEvent(WorldObject* obj, uint32 eventId, WorldObject* invoker = nullptr) override;
|
||||
|
||||
@@ -25,6 +25,15 @@
|
||||
#include "ObjectMgr.h"
|
||||
#include "Player.h"
|
||||
|
||||
enum AlteracValleyPvpStats
|
||||
{
|
||||
PVP_STAT_TOWERS_ASSAULTED = 61,
|
||||
PVP_STAT_GRAVEYARDS_ASSAULTED = 63,
|
||||
PVP_STAT_TOWERS_DEFENDED = 64,
|
||||
PVP_STAT_GRAVEYARDS_DEFENDED = 65,
|
||||
PVP_STAT_SECONDARY_OBJECTIVES = 82
|
||||
};
|
||||
|
||||
BattlegroundAV::BattlegroundAV(BattlegroundTemplate const* battlegroundTemplate) : Battleground(battlegroundTemplate)
|
||||
{
|
||||
BgObjects.resize(BG_AV_OBJECT_MAX);
|
||||
@@ -438,14 +447,6 @@ void BattlegroundAV::StartingEventOpenDoors()
|
||||
TriggerGameEvent(BG_AV_EVENT_START_BATTLE);
|
||||
}
|
||||
|
||||
void BattlegroundAV::AddPlayer(Player* player, BattlegroundQueueTypeId queueId)
|
||||
{
|
||||
bool const isInBattleground = IsPlayerInBattleground(player->GetGUID());
|
||||
Battleground::AddPlayer(player, queueId);
|
||||
if (!isInBattleground)
|
||||
PlayerScores[player->GetGUID()] = new BattlegroundAVScore(player->GetGUID(), player->GetBGTeam());
|
||||
}
|
||||
|
||||
void BattlegroundAV::EndBattleground(uint32 winner)
|
||||
{
|
||||
//calculate bonuskills for both teams:
|
||||
@@ -525,31 +526,6 @@ void BattlegroundAV::HandleAreaTrigger(Player* player, uint32 trigger, bool ente
|
||||
}
|
||||
}
|
||||
|
||||
bool BattlegroundAV::UpdatePlayerScore(Player* player, uint32 type, uint32 value, bool doAddHonor)
|
||||
{
|
||||
if (!Battleground::UpdatePlayerScore(player, type, value, doAddHonor))
|
||||
return false;
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case SCORE_GRAVEYARDS_ASSAULTED:
|
||||
player->UpdateCriteria(CriteriaType::TrackedWorldStateUIModified, AV_OBJECTIVE_ASSAULT_GRAVEYARD);
|
||||
break;
|
||||
case SCORE_GRAVEYARDS_DEFENDED:
|
||||
player->UpdateCriteria(CriteriaType::TrackedWorldStateUIModified, AV_OBJECTIVE_DEFEND_GRAVEYARD);
|
||||
break;
|
||||
case SCORE_TOWERS_ASSAULTED:
|
||||
player->UpdateCriteria(CriteriaType::TrackedWorldStateUIModified, AV_OBJECTIVE_ASSAULT_TOWER);
|
||||
break;
|
||||
case SCORE_TOWERS_DEFENDED:
|
||||
player->UpdateCriteria(CriteriaType::TrackedWorldStateUIModified, AV_OBJECTIVE_DEFEND_TOWER);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void BattlegroundAV::EventPlayerDestroyedPoint(BG_AV_Nodes node)
|
||||
{
|
||||
uint32 object = GetObjectThroughNode(node);
|
||||
@@ -924,7 +900,7 @@ void BattlegroundAV::EventPlayerDefendsPoint(Player* player, uint32 object)
|
||||
herold->AI()->Talk(team == ALLIANCE ? nodeInfo->TextIds.AllianceCapture : nodeInfo->TextIds.HordeCapture);
|
||||
|
||||
// update the statistic for the defending player
|
||||
UpdatePlayerScore(player, IsTower(node) ? SCORE_TOWERS_DEFENDED : SCORE_GRAVEYARDS_DEFENDED, 1);
|
||||
UpdatePvpStat(player, IsTower(node) ? PVP_STAT_TOWERS_DEFENDED : PVP_STAT_GRAVEYARDS_DEFENDED, 1);
|
||||
}
|
||||
|
||||
void BattlegroundAV::EventPlayerAssaultsPoint(Player* player, uint32 object)
|
||||
@@ -1013,7 +989,7 @@ void BattlegroundAV::EventPlayerAssaultsPoint(Player* player, uint32 object)
|
||||
herold->AI()->Talk(team == ALLIANCE ? nodeInfo->TextIds.AllianceAttack : nodeInfo->TextIds.HordeAttack);
|
||||
|
||||
// update the statistic for the assaulting player
|
||||
UpdatePlayerScore(player, (IsTower(node)) ? SCORE_TOWERS_ASSAULTED : SCORE_GRAVEYARDS_ASSAULTED, 1);
|
||||
UpdatePvpStat(player, (IsTower(node)) ? PVP_STAT_TOWERS_ASSAULTED : PVP_STAT_GRAVEYARDS_ASSAULTED, 1);
|
||||
}
|
||||
|
||||
void BattlegroundAV::UpdateNodeWorldState(BG_AV_Nodes node)
|
||||
|
||||
@@ -1501,15 +1501,6 @@ enum BG_AV_QuestIds
|
||||
AV_QUEST_H_RIDER_TAME = 7001
|
||||
};
|
||||
|
||||
enum BG_AV_Objectives
|
||||
{
|
||||
AV_OBJECTIVE_ASSAULT_TOWER = 61,
|
||||
AV_OBJECTIVE_ASSAULT_GRAVEYARD = 63,
|
||||
AV_OBJECTIVE_DEFEND_TOWER = 64,
|
||||
AV_OBJECTIVE_DEFEND_GRAVEYARD = 65,
|
||||
AV_OBJECTIVE_SECONDARY_OBJECTIVE= 82
|
||||
};
|
||||
|
||||
struct StaticNodeInfo
|
||||
{
|
||||
BG_AV_Nodes NodeId;
|
||||
@@ -1587,62 +1578,6 @@ struct BG_AV_NodeInfo
|
||||
|
||||
inline BG_AV_Nodes &operator++(BG_AV_Nodes& i) { return i = BG_AV_Nodes(i + 1); }
|
||||
|
||||
struct BattlegroundAVScore final : public BattlegroundScore
|
||||
{
|
||||
friend class BattlegroundAV;
|
||||
|
||||
protected:
|
||||
BattlegroundAVScore(ObjectGuid playerGuid, uint32 team) : BattlegroundScore(playerGuid, team), GraveyardsAssaulted(0), GraveyardsDefended(0), TowersAssaulted(0), TowersDefended(0), MinesCaptured(0) { }
|
||||
|
||||
void UpdateScore(uint32 type, uint32 value) override
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case SCORE_GRAVEYARDS_ASSAULTED:
|
||||
GraveyardsAssaulted += value;
|
||||
break;
|
||||
case SCORE_GRAVEYARDS_DEFENDED:
|
||||
GraveyardsDefended += value;
|
||||
break;
|
||||
case SCORE_TOWERS_ASSAULTED:
|
||||
TowersAssaulted += value;
|
||||
break;
|
||||
case SCORE_TOWERS_DEFENDED:
|
||||
TowersDefended += value;
|
||||
break;
|
||||
case SCORE_MINES_CAPTURED:
|
||||
MinesCaptured += value;
|
||||
break;
|
||||
default:
|
||||
BattlegroundScore::UpdateScore(type, value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void BuildPvPLogPlayerDataPacket(WorldPackets::Battleground::PVPMatchStatistics::PVPMatchPlayerStatistics& playerData) const override
|
||||
{
|
||||
BattlegroundScore::BuildPvPLogPlayerDataPacket(playerData);
|
||||
|
||||
playerData.Stats.emplace_back(AV_OBJECTIVE_ASSAULT_GRAVEYARD, GraveyardsAssaulted);
|
||||
playerData.Stats.emplace_back(AV_OBJECTIVE_DEFEND_GRAVEYARD, GraveyardsDefended);
|
||||
playerData.Stats.emplace_back(AV_OBJECTIVE_ASSAULT_TOWER, TowersAssaulted);
|
||||
playerData.Stats.emplace_back(AV_OBJECTIVE_DEFEND_TOWER, TowersDefended);
|
||||
playerData.Stats.emplace_back(AV_OBJECTIVE_SECONDARY_OBJECTIVE, MinesCaptured);
|
||||
}
|
||||
|
||||
uint32 GetAttr1() const final override { return GraveyardsAssaulted; }
|
||||
uint32 GetAttr2() const final override { return GraveyardsDefended; }
|
||||
uint32 GetAttr3() const final override { return TowersAssaulted; }
|
||||
uint32 GetAttr4() const final override { return TowersDefended; }
|
||||
uint32 GetAttr5() const final override { return MinesCaptured; }
|
||||
|
||||
uint32 GraveyardsAssaulted;
|
||||
uint32 GraveyardsDefended;
|
||||
uint32 TowersAssaulted;
|
||||
uint32 TowersDefended;
|
||||
uint32 MinesCaptured;
|
||||
};
|
||||
|
||||
class BattlegroundAV : public Battleground
|
||||
{
|
||||
public:
|
||||
@@ -1650,7 +1585,6 @@ class BattlegroundAV : public Battleground
|
||||
~BattlegroundAV();
|
||||
|
||||
/* inherited from BattlegroundClass */
|
||||
void AddPlayer(Player* player, BattlegroundQueueTypeId queueId) override;
|
||||
void StartingEventCloseDoors() override;
|
||||
void StartingEventOpenDoors() override;
|
||||
|
||||
@@ -1661,7 +1595,6 @@ class BattlegroundAV : public Battleground
|
||||
|
||||
/*general stuff*/
|
||||
void UpdateScore(uint16 team, int16 points);
|
||||
bool UpdatePlayerScore(Player* player, uint32 type, uint32 value, bool doAddHonor = true) override;
|
||||
|
||||
/*handlestuff*/ //these are functions which get called from extern
|
||||
void EventPlayerClickedOnFlag(Player* source, GameObject* target_obj) override;
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
#define __BATTLEGROUNDBFG_H
|
||||
|
||||
#include "Battleground.h"
|
||||
#include "BattlegroundScore.h"
|
||||
|
||||
enum BG_BFG_Objectives
|
||||
{
|
||||
@@ -27,42 +26,6 @@ enum BG_BFG_Objectives
|
||||
BFG_OBJECTIVE_BASES_DEFENDED = 371
|
||||
};
|
||||
|
||||
class BattlegroundBFGScore final : public BattlegroundScore
|
||||
{
|
||||
protected:
|
||||
BattlegroundBFGScore(ObjectGuid playerGuid, uint32 team) : BattlegroundScore(playerGuid, team), BasesAssaulted(0), BasesDefended(0) { }
|
||||
|
||||
void UpdateScore(uint32 type, uint32 value) override
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case SCORE_BASES_ASSAULTED:
|
||||
BasesAssaulted += value;
|
||||
break;
|
||||
case SCORE_BASES_DEFENDED:
|
||||
BasesDefended += value;
|
||||
break;
|
||||
default:
|
||||
BattlegroundScore::UpdateScore(type, value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void BuildPvPLogPlayerDataPacket(WorldPackets::Battleground::PVPMatchStatistics::PVPMatchPlayerStatistics& playerData) const override
|
||||
{
|
||||
BattlegroundScore::BuildPvPLogPlayerDataPacket(playerData);
|
||||
|
||||
playerData.Stats.emplace_back(BFG_OBJECTIVE_BASES_ASSAULTED, BasesAssaulted);
|
||||
playerData.Stats.emplace_back(BFG_OBJECTIVE_BASES_DEFENDED, BasesDefended);
|
||||
}
|
||||
|
||||
uint32 GetAttr1() const final override { return BasesAssaulted; }
|
||||
uint32 GetAttr2() const final override { return BasesDefended; }
|
||||
|
||||
uint32 BasesAssaulted;
|
||||
uint32 BasesDefended;
|
||||
};
|
||||
|
||||
class BattlegroundBFG : public Battleground
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -31,6 +31,11 @@
|
||||
#include "SpellInfo.h"
|
||||
#include "Util.h"
|
||||
|
||||
enum EyeOfTheStormPvpStats
|
||||
{
|
||||
PVP_STAT_FLAG_CAPTURES = 183
|
||||
};
|
||||
|
||||
BattlegroundEY::BattlegroundEY(BattlegroundTemplate const* battlegroundTemplate) : Battleground(battlegroundTemplate)
|
||||
{
|
||||
BgObjects.resize(0);
|
||||
@@ -295,7 +300,7 @@ void BattlegroundEY::OnCaptureFlag(AreaTrigger* areaTrigger, Player* player)
|
||||
UpdateWorldState(NETHERSTORM_FLAG_STATE_HORDE, BG_EY_FLAG_STATE_ON_BASE);
|
||||
UpdateWorldState(NETHERSTORM_FLAG_STATE_ALLIANCE, BG_EY_FLAG_STATE_ON_BASE);
|
||||
|
||||
UpdatePlayerScore(player, SCORE_FLAG_CAPTURES, 1);
|
||||
UpdatePvpStat(player, PVP_STAT_FLAG_CAPTURES, 1);
|
||||
|
||||
player->RemoveAurasDueToSpell(BG_EY_NETHERSTORM_FLAG_SPELL);
|
||||
player->RemoveAurasWithInterruptFlags(SpellAuraInterruptFlags::PvPActive);
|
||||
@@ -349,14 +354,6 @@ void BattlegroundEY::OnFlagStateChange(GameObject* /*flagInBase*/, FlagState /*o
|
||||
UpdateWorldState(NETHERSTORM_FLAG, AsUnderlyingType(newValue));
|
||||
}
|
||||
|
||||
void BattlegroundEY::AddPlayer(Player* player, BattlegroundQueueTypeId queueId)
|
||||
{
|
||||
bool const isInBattleground = IsPlayerInBattleground(player->GetGUID());
|
||||
Battleground::AddPlayer(player, queueId);
|
||||
if (!isInBattleground)
|
||||
PlayerScores[player->GetGUID()] = new BattlegroundEYScore(player->GetGUID(), player->GetBGTeam());
|
||||
}
|
||||
|
||||
void BattlegroundEY::HandleAreaTrigger(Player* player, uint32 trigger, bool entered)
|
||||
{
|
||||
if (!player->IsAlive()) //hack code, must be removed later
|
||||
@@ -453,17 +450,6 @@ void BattlegroundEY::EventTeamCapturedPoint(TeamId teamId, uint32 point, GameObj
|
||||
UpdatePointsCount(teamId);
|
||||
}
|
||||
|
||||
bool BattlegroundEY::UpdatePlayerScore(Player* player, uint32 type, uint32 value, bool doAddHonor)
|
||||
{
|
||||
if (!Battleground::UpdatePlayerScore(player, type, value, doAddHonor))
|
||||
return false;
|
||||
|
||||
if (type == SCORE_FLAG_CAPTURES)
|
||||
player->UpdateCriteria(CriteriaType::TrackedWorldStateUIModified, EY_OBJECTIVE_CAPTURE_FLAG);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
WorldSafeLocsEntry const* BattlegroundEY::GetExploitTeleportLocation(Team team)
|
||||
{
|
||||
return sObjectMgr->GetWorldSafeLoc(team == ALLIANCE ? EY_EXPLOIT_TELEPORT_LOCATION_ALLIANCE : EY_EXPLOIT_TELEPORT_LOCATION_HORDE);
|
||||
|
||||
@@ -140,11 +140,6 @@ enum EYBattlegroundPointState
|
||||
EY_POINT_UNDER_CONTROL = 3
|
||||
};
|
||||
|
||||
enum BG_EY_Objectives
|
||||
{
|
||||
EY_OBJECTIVE_CAPTURE_FLAG = 183
|
||||
};
|
||||
|
||||
enum BG_EY_ExploitTeleportLocations
|
||||
{
|
||||
EY_EXPLOIT_TELEPORT_LOCATION_ALLIANCE = 3773,
|
||||
@@ -260,38 +255,6 @@ const std::array<BattlegroundEYCapturingPointStruct, EY_POINTS_MAX> m_CapturingP
|
||||
BattlegroundEYCapturingPointStruct(BG_EY_TEXT_ALLIANCE_TAKEN_MAGE_TOWER, BG_EY_TEXT_HORDE_TAKEN_MAGE_TOWER)
|
||||
};
|
||||
|
||||
struct BattlegroundEYScore final : public BattlegroundScore
|
||||
{
|
||||
friend class BattlegroundEY;
|
||||
|
||||
protected:
|
||||
BattlegroundEYScore(ObjectGuid playerGuid, uint32 team) : BattlegroundScore(playerGuid, team), FlagCaptures(0) { }
|
||||
|
||||
void UpdateScore(uint32 type, uint32 value) override
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case SCORE_FLAG_CAPTURES: // Flags captured
|
||||
FlagCaptures += value;
|
||||
break;
|
||||
default:
|
||||
BattlegroundScore::UpdateScore(type, value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void BuildPvPLogPlayerDataPacket(WorldPackets::Battleground::PVPMatchStatistics::PVPMatchPlayerStatistics& playerData) const override
|
||||
{
|
||||
BattlegroundScore::BuildPvPLogPlayerDataPacket(playerData);
|
||||
|
||||
playerData.Stats.emplace_back(EY_OBJECTIVE_CAPTURE_FLAG, FlagCaptures);
|
||||
}
|
||||
|
||||
uint32 GetAttr1() const final override { return FlagCaptures; }
|
||||
|
||||
uint32 FlagCaptures;
|
||||
};
|
||||
|
||||
class BattlegroundEY : public Battleground
|
||||
{
|
||||
public:
|
||||
@@ -299,7 +262,6 @@ class BattlegroundEY : public Battleground
|
||||
~BattlegroundEY();
|
||||
|
||||
/* inherited from BattlegroundClass */
|
||||
void AddPlayer(Player* player, BattlegroundQueueTypeId queueId) override;
|
||||
void StartingEventOpenDoors() override;
|
||||
|
||||
void HandleAreaTrigger(Player* source, uint32 trigger, bool entered) override;
|
||||
@@ -309,7 +271,6 @@ class BattlegroundEY : public Battleground
|
||||
void Reset() override;
|
||||
void UpdateTeamScore(uint32 Team);
|
||||
void EndBattleground(uint32 winner) override;
|
||||
bool UpdatePlayerScore(Player* player, uint32 type, uint32 value, bool doAddHonor = true) override;
|
||||
|
||||
uint32 GetPrematureWinner() override;
|
||||
|
||||
|
||||
@@ -26,6 +26,12 @@
|
||||
#include "UnitAI.h"
|
||||
#include "Vehicle.h"
|
||||
|
||||
enum IsleOfConquestPvpStats
|
||||
{
|
||||
PVP_STAT_BASES_ASSAULTED = 245,
|
||||
PVP_STAT_BASES_DEFENDED = 246
|
||||
};
|
||||
|
||||
BattlegroundIC::BattlegroundIC(BattlegroundTemplate const* battlegroundTemplate) : Battleground(battlegroundTemplate)
|
||||
{
|
||||
BgObjects.resize(MAX_NORMAL_GAMEOBJECTS_SPAWNS + MAX_AIRSHIPS_SPAWNS + MAX_HANGAR_TELEPORTERS_SPAWNS + MAX_FORTRESS_TELEPORTERS_SPAWNS + MAX_HANGAR_TELEPORTER_EFFECTS_SPAWNS + MAX_FORTRESS_TELEPORTER_EFFECTS_SPAWNS);
|
||||
@@ -244,10 +250,7 @@ void BattlegroundIC::StartingEventOpenDoors()
|
||||
|
||||
void BattlegroundIC::AddPlayer(Player* player, BattlegroundQueueTypeId queueId)
|
||||
{
|
||||
bool const isInBattleground = IsPlayerInBattleground(player->GetGUID());
|
||||
Battleground::AddPlayer(player, queueId);
|
||||
if (!isInBattleground)
|
||||
PlayerScores[player->GetGUID()] = new BattlegroundICScore(player->GetGUID(), player->GetBGTeam());
|
||||
|
||||
if (nodePoint[NODE_TYPE_QUARRY].nodeState == (GetPlayerTeam(player->GetGUID()) == ALLIANCE ? NODE_STATE_CONTROLLED_A : NODE_STATE_CONTROLLED_H))
|
||||
player->CastSpell(player, SPELL_QUARRY, true);
|
||||
@@ -436,7 +439,7 @@ void BattlegroundIC::EventPlayerClickedOnFlag(Player* player, GameObject* target
|
||||
if (!BgCreatures[BG_IC_NPC_SPIRIT_GUIDE_1 + uint32(nodePoint[i].nodeType) - 2].IsEmpty())
|
||||
DelCreature(BG_IC_NPC_SPIRIT_GUIDE_1 + uint32(nodePoint[i].nodeType) - 2);
|
||||
|
||||
UpdatePlayerScore(player, SCORE_BASES_ASSAULTED, 1);
|
||||
UpdatePvpStat(player, PVP_STAT_BASES_ASSAULTED, 1);
|
||||
|
||||
if (nodePoint[i].faction == TEAM_ALLIANCE)
|
||||
SendBroadcastText(ICNodes[i].TextAssaulted, CHAT_MSG_BG_SYSTEM_ALLIANCE, player);
|
||||
@@ -456,7 +459,7 @@ void BattlegroundIC::EventPlayerClickedOnFlag(Player* player, GameObject* target
|
||||
SendBroadcastText(ICNodes[i].TextDefended, CHAT_MSG_BG_SYSTEM_HORDE, player);
|
||||
|
||||
HandleCapturedNodes(&nodePoint[i], true);
|
||||
UpdatePlayerScore(player, SCORE_BASES_DEFENDED, 1);
|
||||
UpdatePvpStat(player, PVP_STAT_BASES_DEFENDED, 1);
|
||||
}
|
||||
|
||||
GameObject* banner = GetBGObject(nodePoint[i].gameobject_type);
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
#define __BATTLEGROUNDIC_H
|
||||
|
||||
#include "Battleground.h"
|
||||
#include "BattlegroundScore.h"
|
||||
#include "Object.h"
|
||||
|
||||
const uint32 BG_IC_Factions[2] =
|
||||
@@ -726,12 +725,6 @@ enum Spells
|
||||
SPELL_LAUNCH_NO_FALLING_DAMAGE = 66251
|
||||
};
|
||||
|
||||
enum BG_IC_Objectives
|
||||
{
|
||||
IC_OBJECTIVE_ASSAULT_BASE = 245,
|
||||
IC_OBJECTIVE_DEFEND_BASE = 246
|
||||
};
|
||||
|
||||
enum ICWorldStates
|
||||
{
|
||||
BG_IC_ALLIANCE_REINFORCEMENTS_SET = 4221,
|
||||
@@ -920,44 +913,6 @@ enum HonorRewards
|
||||
WINNER_HONOR_AMOUNT = 500
|
||||
};
|
||||
|
||||
struct BattlegroundICScore final : public BattlegroundScore
|
||||
{
|
||||
friend class BattlegroundIC;
|
||||
|
||||
protected:
|
||||
BattlegroundICScore(ObjectGuid playerGuid, uint32 team) : BattlegroundScore(playerGuid, team), BasesAssaulted(0), BasesDefended(0) { }
|
||||
|
||||
void UpdateScore(uint32 type, uint32 value) override
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case SCORE_BASES_ASSAULTED:
|
||||
BasesAssaulted += value;
|
||||
break;
|
||||
case SCORE_BASES_DEFENDED:
|
||||
BasesDefended += value;
|
||||
break;
|
||||
default:
|
||||
BattlegroundScore::UpdateScore(type, value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void BuildPvPLogPlayerDataPacket(WorldPackets::Battleground::PVPMatchStatistics::PVPMatchPlayerStatistics& playerData) const override
|
||||
{
|
||||
BattlegroundScore::BuildPvPLogPlayerDataPacket(playerData);
|
||||
|
||||
playerData.Stats.emplace_back(IC_OBJECTIVE_ASSAULT_BASE, BasesAssaulted);
|
||||
playerData.Stats.emplace_back(IC_OBJECTIVE_DEFEND_BASE, BasesDefended);
|
||||
}
|
||||
|
||||
uint32 GetAttr1() const final override { return BasesAssaulted; }
|
||||
uint32 GetAttr2() const final override { return BasesDefended; }
|
||||
|
||||
uint32 BasesAssaulted;
|
||||
uint32 BasesDefended;
|
||||
};
|
||||
|
||||
class BattlegroundIC : public Battleground
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
*/
|
||||
|
||||
#include "BattlegroundSA.h"
|
||||
#include "BattlegroundScore.h"
|
||||
#include "Creature.h"
|
||||
#include "CreatureAI.h"
|
||||
#include "DB2Stores.h"
|
||||
@@ -30,6 +31,12 @@
|
||||
#include "UpdateData.h"
|
||||
#include "WorldStateMgr.h"
|
||||
|
||||
enum StrandOfTheAncientsPvpStats
|
||||
{
|
||||
PVP_STAT_GATES_DESTROYED = 231,
|
||||
PVP_STAT_DEMOLISHERS_DESTROYED = 232
|
||||
};
|
||||
|
||||
BattlegroundSA::BattlegroundSA(BattlegroundTemplate const* battlegroundTemplate) : Battleground(battlegroundTemplate)
|
||||
{
|
||||
StartMessageIds[BG_STARTING_EVENT_FOURTH] = 0; // handle by Kanrethad
|
||||
@@ -432,8 +439,6 @@ void BattlegroundSA::AddPlayer(Player* player, BattlegroundQueueTypeId queueId)
|
||||
{
|
||||
bool const isInBattleground = IsPlayerInBattleground(player->GetGUID());
|
||||
Battleground::AddPlayer(player, queueId);
|
||||
if (!isInBattleground)
|
||||
PlayerScores[player->GetGUID()] = new BattlegroundSAScore(player->GetGUID(), player->GetBGTeam());
|
||||
|
||||
SendTransportInit(player);
|
||||
|
||||
@@ -565,7 +570,7 @@ void BattlegroundSA::ProcessEvent(WorldObject* obj, uint32 eventId, WorldObject*
|
||||
{
|
||||
if (Player* player = unit->GetCharmerOrOwnerPlayerOrPlayerItself())
|
||||
{
|
||||
UpdatePlayerScore(player, SCORE_DESTROYED_WALL, 1);
|
||||
UpdatePvpStat(player, PVP_STAT_GATES_DESTROYED, 1);
|
||||
if (rewardHonor)
|
||||
UpdatePlayerScore(player, SCORE_BONUS_HONOR, GetBonusHonorFromKill(1));
|
||||
}
|
||||
@@ -591,7 +596,7 @@ void BattlegroundSA::HandleKillUnit(Creature* creature, Player* killer)
|
||||
{
|
||||
if (creature->GetEntry() == NPC_DEMOLISHER_SA)
|
||||
{
|
||||
UpdatePlayerScore(killer, SCORE_DESTROYED_DEMOLISHER, 1);
|
||||
UpdatePvpStat(killer, PVP_STAT_DEMOLISHERS_DESTROYED, 1);
|
||||
int32 worldStateId = Attackers == TEAM_HORDE ? BG_SA_DESTROYED_HORDE_VEHICLES : BG_SA_DESTROYED_ALLIANCE_VEHICLES;
|
||||
int32 currentDestroyedVehicles = sWorldStateMgr->GetValue(worldStateId, GetBgMap());
|
||||
UpdateWorldState(worldStateId, currentDestroyedVehicles + 1);
|
||||
@@ -1014,22 +1019,3 @@ bool BattlegroundSA::IsSpellAllowed(uint32 spellId, Player const* /*player*/) co
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool BattlegroundSA::UpdatePlayerScore(Player* player, uint32 type, uint32 value, bool doAddHonor /*= true*/)
|
||||
{
|
||||
if (!Battleground::UpdatePlayerScore(player, type, value, doAddHonor))
|
||||
return false;
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case SCORE_DESTROYED_DEMOLISHER:
|
||||
player->UpdateCriteria(CriteriaType::TrackedWorldStateUIModified, BG_SA_DEMOLISHERS_DESTROYED);
|
||||
break;
|
||||
case SCORE_DESTROYED_WALL:
|
||||
player->UpdateCriteria(CriteriaType::TrackedWorldStateUIModified, BG_SA_GATES_DESTROYED);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
#define __BATTLEGROUNDSA_H
|
||||
|
||||
#include "Battleground.h"
|
||||
#include "BattlegroundScore.h"
|
||||
#include "Object.h"
|
||||
|
||||
#define BG_SA_FLAG_AMOUNT 3
|
||||
@@ -307,12 +306,6 @@ enum BG_SA_Objects
|
||||
BG_SA_MAXOBJ = BG_SA_BOMB+68
|
||||
};
|
||||
|
||||
enum BG_SA_Objectives
|
||||
{
|
||||
BG_SA_GATES_DESTROYED = 231,
|
||||
BG_SA_DEMOLISHERS_DESTROYED = 232
|
||||
};
|
||||
|
||||
Position const BG_SA_ObjSpawnlocs[BG_SA_MAXOBJ] =
|
||||
{
|
||||
{ 1411.57f, 108.163f, 28.692f, 5.441f },
|
||||
@@ -528,44 +521,6 @@ struct BG_SA_RoundScore
|
||||
uint32 time;
|
||||
};
|
||||
|
||||
struct BattlegroundSAScore final : public BattlegroundScore
|
||||
{
|
||||
friend class BattlegroundSA;
|
||||
|
||||
protected:
|
||||
BattlegroundSAScore(ObjectGuid playerGuid, uint32 team) : BattlegroundScore(playerGuid, team), DemolishersDestroyed(0), GatesDestroyed(0) { }
|
||||
|
||||
void UpdateScore(uint32 type, uint32 value) override
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case SCORE_DESTROYED_DEMOLISHER:
|
||||
DemolishersDestroyed += value;
|
||||
break;
|
||||
case SCORE_DESTROYED_WALL:
|
||||
GatesDestroyed += value;
|
||||
break;
|
||||
default:
|
||||
BattlegroundScore::UpdateScore(type, value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void BuildPvPLogPlayerDataPacket(WorldPackets::Battleground::PVPMatchStatistics::PVPMatchPlayerStatistics& playerData) const override
|
||||
{
|
||||
BattlegroundScore::BuildPvPLogPlayerDataPacket(playerData);
|
||||
|
||||
playerData.Stats.emplace_back(BG_SA_DEMOLISHERS_DESTROYED, DemolishersDestroyed);
|
||||
playerData.Stats.emplace_back(BG_SA_GATES_DESTROYED, GatesDestroyed);
|
||||
}
|
||||
|
||||
uint32 GetAttr1() const final override { return DemolishersDestroyed; }
|
||||
uint32 GetAttr2() const final override { return GatesDestroyed; }
|
||||
|
||||
uint32 DemolishersDestroyed;
|
||||
uint32 GatesDestroyed;
|
||||
};
|
||||
|
||||
/// Class for manage Strand of Ancient battleground
|
||||
class BattlegroundSA : public Battleground
|
||||
{
|
||||
@@ -618,8 +573,6 @@ class BattlegroundSA : public Battleground
|
||||
// Control Phase Shift
|
||||
bool IsSpellAllowed(uint32 spellId, Player const* player) const override;
|
||||
|
||||
bool UpdatePlayerScore(Player* player, uint32 type, uint32 value, bool doAddHonor = true) override;
|
||||
|
||||
private:
|
||||
|
||||
/**
|
||||
|
||||
@@ -27,42 +27,6 @@ enum BG_TP_Objectives
|
||||
BG_TP_FLAG_RETURNS = 291
|
||||
};
|
||||
|
||||
class BattlegroundTPScore final : public BattlegroundScore
|
||||
{
|
||||
protected:
|
||||
BattlegroundTPScore(ObjectGuid playerGuid, uint32 team) : BattlegroundScore(playerGuid, team), FlagCaptures(0), FlagReturns(0) { }
|
||||
|
||||
void UpdateScore(uint32 type, uint32 value) override
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case SCORE_FLAG_CAPTURES:
|
||||
FlagCaptures += value;
|
||||
break;
|
||||
case SCORE_FLAG_RETURNS:
|
||||
FlagReturns += value;
|
||||
break;
|
||||
default:
|
||||
BattlegroundScore::UpdateScore(type, value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void BuildPvPLogPlayerDataPacket(WorldPackets::Battleground::PVPMatchStatistics::PVPMatchPlayerStatistics& playerData) const override
|
||||
{
|
||||
BattlegroundScore::BuildPvPLogPlayerDataPacket(playerData);
|
||||
|
||||
playerData.Stats.emplace_back(BG_TP_FLAG_CAPTURES, FlagCaptures);
|
||||
playerData.Stats.emplace_back(BG_TP_FLAG_RETURNS, FlagReturns);
|
||||
}
|
||||
|
||||
uint32 GetAttr1() const final override { return FlagCaptures; }
|
||||
uint32 GetAttr2() const final override { return FlagReturns; }
|
||||
|
||||
uint32 FlagCaptures;
|
||||
uint32 FlagReturns;
|
||||
};
|
||||
|
||||
class BattlegroundTP : public Battleground
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -45,6 +45,12 @@ uint32 BG_WSG_Honor[2][BG_WSG_REWARD_NUM] =
|
||||
{60, 40, 80} // holiday
|
||||
};
|
||||
|
||||
enum WarsongGulchPvpStats
|
||||
{
|
||||
PVP_STAT_FLAG_CAPTURES = 928,
|
||||
PVP_STAT_FLAG_RETURNS = 929
|
||||
};
|
||||
|
||||
BattlegroundWS::BattlegroundWS(BattlegroundTemplate const* battlegroundTemplate) : Battleground(battlegroundTemplate)
|
||||
{
|
||||
BgObjects.resize(0);
|
||||
@@ -181,14 +187,6 @@ void BattlegroundWS::StartingEventOpenDoors()
|
||||
TriggerGameEvent(WS_EVENT_START_BATTLE);
|
||||
}
|
||||
|
||||
void BattlegroundWS::AddPlayer(Player* player, BattlegroundQueueTypeId queueId)
|
||||
{
|
||||
bool const isInBattleground = IsPlayerInBattleground(player->GetGUID());
|
||||
Battleground::AddPlayer(player, queueId);
|
||||
if (!isInBattleground)
|
||||
PlayerScores[player->GetGUID()] = new BattlegroundWGScore(player->GetGUID(), player->GetBGTeam());
|
||||
}
|
||||
|
||||
FlagState BattlegroundWS::GetFlagState(TeamId team) const
|
||||
{
|
||||
if (GameObject* gameObject = FindBgMap()->GetGameObject(_flags[team]))
|
||||
@@ -314,25 +312,6 @@ void BattlegroundWS::HandleKillPlayer(Player* player, Player* killer)
|
||||
Battleground::HandleKillPlayer(player, killer);
|
||||
}
|
||||
|
||||
bool BattlegroundWS::UpdatePlayerScore(Player* player, uint32 type, uint32 value, bool doAddHonor)
|
||||
{
|
||||
if (!Battleground::UpdatePlayerScore(player, type, value, doAddHonor))
|
||||
return false;
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case SCORE_FLAG_CAPTURES: // flags captured
|
||||
player->UpdateCriteria(CriteriaType::TrackedWorldStateUIModified, WS_OBJECTIVE_CAPTURE_FLAG);
|
||||
break;
|
||||
case SCORE_FLAG_RETURNS: // flags returned
|
||||
player->UpdateCriteria(CriteriaType::TrackedWorldStateUIModified, WS_OBJECTIVE_RETURN_FLAG);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
WorldSafeLocsEntry const* BattlegroundWS::GetClosestGraveyard(Player* player)
|
||||
{
|
||||
return sObjectMgr->GetClosestGraveyard(*player, player->GetBGTeam(), player);
|
||||
@@ -411,7 +390,7 @@ void BattlegroundWS::OnFlagStateChange(GameObject* flagInBase, FlagState /*oldVa
|
||||
if (player)
|
||||
{
|
||||
// flag got returned to base by player interaction
|
||||
UpdatePlayerScore(player, SCORE_FLAG_RETURNS, 1); // +1 flag returns
|
||||
UpdatePvpStat(player, PVP_STAT_FLAG_RETURNS, 1); // +1 flag returns
|
||||
|
||||
if (team == ALLIANCE)
|
||||
{
|
||||
@@ -548,7 +527,7 @@ void BattlegroundWS::OnCaptureFlag(AreaTrigger* /*areaTrigger*/, Player* player)
|
||||
}
|
||||
|
||||
// 4. update criteria's for achievement, player score etc.
|
||||
UpdatePlayerScore(player, SCORE_FLAG_CAPTURES, 1); // +1 flag captures
|
||||
UpdatePvpStat(player, PVP_STAT_FLAG_CAPTURES, 1); // +1 flag captures
|
||||
|
||||
// 5. Remove all related auras
|
||||
RemoveAssaultDebuffFromPlayer(player);
|
||||
|
||||
@@ -123,12 +123,6 @@ enum BG_WS_CarrierDebuffs
|
||||
SPELL_CAPTURED_HORDE_COSMETIC_FX = 262512,
|
||||
};
|
||||
|
||||
enum BG_WS_Objectives
|
||||
{
|
||||
WS_OBJECTIVE_CAPTURE_FLAG = 928,
|
||||
WS_OBJECTIVE_RETURN_FLAG = 929
|
||||
};
|
||||
|
||||
enum BG_WS_AreaTriggers
|
||||
{
|
||||
AT_CAPTURE_POINT_ALLIANCE = 30,
|
||||
@@ -140,44 +134,6 @@ static constexpr uint32 WS_EVENT_START_BATTLE = 35912;
|
||||
static constexpr Seconds FLAG_ASSAULT_TIMER = 30s;
|
||||
static constexpr uint16 FLAG_BRUTAL_ASSAULT_STACK_COUNT = 5;
|
||||
|
||||
struct BattlegroundWGScore final : public BattlegroundScore
|
||||
{
|
||||
friend class BattlegroundWS;
|
||||
|
||||
protected:
|
||||
BattlegroundWGScore(ObjectGuid playerGuid, uint32 team) : BattlegroundScore(playerGuid, team), FlagCaptures(0), FlagReturns(0) { }
|
||||
|
||||
void UpdateScore(uint32 type, uint32 value) override
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case SCORE_FLAG_CAPTURES: // Flags captured
|
||||
FlagCaptures += value;
|
||||
break;
|
||||
case SCORE_FLAG_RETURNS: // Flags returned
|
||||
FlagReturns += value;
|
||||
break;
|
||||
default:
|
||||
BattlegroundScore::UpdateScore(type, value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void BuildPvPLogPlayerDataPacket(WorldPackets::Battleground::PVPMatchStatistics::PVPMatchPlayerStatistics& playerData) const override
|
||||
{
|
||||
BattlegroundScore::BuildPvPLogPlayerDataPacket(playerData);
|
||||
|
||||
playerData.Stats.emplace_back(WS_OBJECTIVE_CAPTURE_FLAG, FlagCaptures);
|
||||
playerData.Stats.emplace_back(WS_OBJECTIVE_RETURN_FLAG, FlagReturns);
|
||||
}
|
||||
|
||||
uint32 GetAttr1() const final override { return FlagCaptures; }
|
||||
uint32 GetAttr2() const final override { return FlagReturns; }
|
||||
|
||||
uint32 FlagCaptures;
|
||||
uint32 FlagReturns;
|
||||
};
|
||||
|
||||
class BattlegroundWS : public Battleground
|
||||
{
|
||||
public:
|
||||
@@ -186,7 +142,6 @@ class BattlegroundWS : public Battleground
|
||||
~BattlegroundWS();
|
||||
|
||||
/* inherited from BattlegroundClass */
|
||||
void AddPlayer(Player* player, BattlegroundQueueTypeId queueId) override;
|
||||
void StartingEventOpenDoors() override;
|
||||
|
||||
/* BG Flags */
|
||||
@@ -204,7 +159,6 @@ class BattlegroundWS : public Battleground
|
||||
void UpdateFlagState(uint32 team, FlagState value);
|
||||
void SetLastFlagCapture(uint32 team) { _lastFlagCaptureTeam = team; }
|
||||
void UpdateTeamScore(uint32 team);
|
||||
bool UpdatePlayerScore(Player* player, uint32 type, uint32 value, bool doAddHonor = true) override;
|
||||
|
||||
/* Scorekeeping */
|
||||
void AddPoint(uint32 TeamID, uint32 Points = 1) { m_TeamScores[GetTeamIndexByTeamId(TeamID)] += Points; }
|
||||
|
||||
@@ -4218,6 +4218,18 @@ struct PvpItemLoadInfo
|
||||
static constexpr DB2LoadInfo Instance{ Fields, 3, &PVPItemMeta::Instance, HOTFIX_SEL_PVP_ITEM };
|
||||
};
|
||||
|
||||
struct PvpStatLoadInfo
|
||||
{
|
||||
static constexpr DB2FieldMeta Fields[3] =
|
||||
{
|
||||
{ false, FT_STRING, "Description" },
|
||||
{ false, FT_INT, "ID" },
|
||||
{ true, FT_INT, "MapID" },
|
||||
};
|
||||
|
||||
static constexpr DB2LoadInfo Instance{ Fields, 3, &PVPStatMeta::Instance, HOTFIX_SEL_PVP_STAT };
|
||||
};
|
||||
|
||||
struct PvpSeasonLoadInfo
|
||||
{
|
||||
static constexpr DB2FieldMeta Fields[4] =
|
||||
|
||||
@@ -251,6 +251,7 @@ DB2Storage<PowerTypeEntry> sPowerTypeStore("PowerType.db2",
|
||||
DB2Storage<PrestigeLevelInfoEntry> sPrestigeLevelInfoStore("PrestigeLevelInfo.db2", &PrestigeLevelInfoLoadInfo::Instance);
|
||||
DB2Storage<PVPDifficultyEntry> sPVPDifficultyStore("PVPDifficulty.db2", &PvpDifficultyLoadInfo::Instance);
|
||||
DB2Storage<PVPItemEntry> sPVPItemStore("PVPItem.db2", &PvpItemLoadInfo::Instance);
|
||||
DB2Storage<PVPStatEntry> sPVPStatStore("PVPStat.db2", &PvpStatLoadInfo::Instance);
|
||||
DB2Storage<PvpSeasonEntry> sPvpSeasonStore("PvpSeason.db2", &PvpSeasonLoadInfo::Instance);
|
||||
DB2Storage<PvpTalentEntry> sPvpTalentStore("PvpTalent.db2", &PvpTalentLoadInfo::Instance);
|
||||
DB2Storage<PvpTalentCategoryEntry> sPvpTalentCategoryStore("PvpTalentCategory.db2", &PvpTalentCategoryLoadInfo::Instance);
|
||||
@@ -514,6 +515,7 @@ namespace
|
||||
std::unordered_multimap<int32, UiMapAssignmentEntry const*> _uiMapAssignmentByWmoGroup[MAX_UI_MAP_SYSTEM];
|
||||
std::unordered_set<int32> _uiMapPhases;
|
||||
WMOAreaTableLookupContainer _wmoAreaTableLookup;
|
||||
std::unordered_map<uint32, std::unordered_set<uint32>> _pvpStatIdsByMap;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
@@ -847,6 +849,7 @@ uint32 DB2Manager::LoadStores(std::string const& dataPath, LocaleConstant defaul
|
||||
LOAD_DB2(sPrestigeLevelInfoStore);
|
||||
LOAD_DB2(sPVPDifficultyStore);
|
||||
LOAD_DB2(sPVPItemStore);
|
||||
LOAD_DB2(sPVPStatStore);
|
||||
LOAD_DB2(sPvpSeasonStore);
|
||||
LOAD_DB2(sPvpTalentStore);
|
||||
LOAD_DB2(sPvpTalentCategoryStore);
|
||||
@@ -1621,6 +1624,9 @@ uint32 DB2Manager::LoadStores(std::string const& dataPath, LocaleConstant defaul
|
||||
sOldContinentsNodesMask[field] |= submask;
|
||||
}
|
||||
|
||||
for (PVPStatEntry const* pvpStat : sPVPStatStore)
|
||||
_pvpStatIdsByMap[pvpStat->MapID].insert(pvpStat->ID);
|
||||
|
||||
TC_LOG_INFO("server.loading", ">> Initialized {} DB2 data stores in {} ms", _stores.size(), GetMSTimeDiffToNow(oldMSTime));
|
||||
|
||||
return availableDb2Locales.to_ulong();
|
||||
@@ -3353,6 +3359,11 @@ WMOAreaTableEntry const* DB2Manager::GetWMOAreaTable(int32 rootId, int32 adtId,
|
||||
return Trinity::Containers::MapGetValuePtr(_wmoAreaTableLookup, WMOAreaTableKey(int16(rootId), int8(adtId), groupId));
|
||||
}
|
||||
|
||||
std::unordered_set<uint32> const* DB2Manager::GetPVPStatIDsForMap(uint32 mapId) const
|
||||
{
|
||||
return Trinity::Containers::MapGetValuePtr(_pvpStatIdsByMap, mapId);
|
||||
}
|
||||
|
||||
bool ChrClassesXPowerTypesEntryComparator::Compare(ChrClassesXPowerTypesEntry const* left, ChrClassesXPowerTypesEntry const* right)
|
||||
{
|
||||
if (left->ClassID != right->ClassID)
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#include <set>
|
||||
#include <span>
|
||||
#include <vector>
|
||||
#include <unordered_set>
|
||||
|
||||
// temporary hack until includes are sorted out (don't want to pull in Windows.h)
|
||||
#ifdef GetClassName
|
||||
@@ -197,6 +198,7 @@ TC_GAME_API extern DB2Storage<PhaseEntry> sPhaseStore;
|
||||
TC_GAME_API extern DB2Storage<PlayerConditionEntry> sPlayerConditionStore;
|
||||
TC_GAME_API extern DB2Storage<PowerDisplayEntry> sPowerDisplayStore;
|
||||
TC_GAME_API extern DB2Storage<PowerTypeEntry> sPowerTypeStore;
|
||||
TC_GAME_API extern DB2Storage<PVPStatEntry> sPVPStatStore;
|
||||
TC_GAME_API extern DB2Storage<PvpSeasonEntry> sPvpSeasonStore;
|
||||
TC_GAME_API extern DB2Storage<PvpTalentEntry> sPvpTalentStore;
|
||||
TC_GAME_API extern DB2Storage<PvpTalentCategoryEntry> sPvpTalentCategoryStore;
|
||||
@@ -523,6 +525,7 @@ public:
|
||||
void Map2ZoneCoordinates(uint32 areaId, float& x, float& y) const;
|
||||
bool IsUiMapPhase(uint32 phaseId) const;
|
||||
WMOAreaTableEntry const* GetWMOAreaTable(int32 rootId, int32 adtId, int32 groupId) const;
|
||||
std::unordered_set<uint32> const* GetPVPStatIDsForMap(uint32 mapId) const;
|
||||
|
||||
private:
|
||||
friend class DB2HotfixGeneratorBase;
|
||||
|
||||
@@ -3130,6 +3130,13 @@ struct PVPItemEntry
|
||||
uint8 ItemLevelDelta;
|
||||
};
|
||||
|
||||
struct PVPStatEntry
|
||||
{
|
||||
LocalizedString Description;
|
||||
uint32 ID;
|
||||
int32 MapID;
|
||||
};
|
||||
|
||||
struct PvpSeasonEntry
|
||||
{
|
||||
uint32 ID;
|
||||
|
||||
Reference in New Issue
Block a user