feat(Core/Battleground): split Arena and Battleground score (#10616)

This commit is contained in:
Kargatum
2022-02-18 05:20:04 +07:00
committed by GitHub
parent dbd7680f5b
commit 5143872aed
41 changed files with 1750 additions and 1766 deletions

View File

@@ -231,7 +231,7 @@ void Battlefield::InvitePlayerToQueue(Player* player)
void Battlefield::InvitePlayersInQueueToWar()
{
for (uint8 team = 0; team < BG_TEAMS_COUNT; ++team)
for (uint8 team = 0; team < PVP_TEAMS_COUNT; ++team)
{
GuidUnorderedSet copy(m_PlayersInQueue[team]);
for (GuidUnorderedSet::const_iterator itr = copy.begin(); itr != copy.end(); ++itr)
@@ -252,7 +252,7 @@ void Battlefield::InvitePlayersInQueueToWar()
void Battlefield::InvitePlayersInZoneToWar()
{
for (uint8 team = 0; team < BG_TEAMS_COUNT; ++team)
for (uint8 team = 0; team < PVP_TEAMS_COUNT; ++team)
for (GuidUnorderedSet::const_iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr)
{
if (Player* player = ObjectAccessor::FindPlayer(*itr))
@@ -310,7 +310,7 @@ void Battlefield::InitStalker(uint32 entry, float x, float y, float z, float o)
void Battlefield::KickAfkPlayers()
{
// xinef: optimization, dont lookup player twice
for (uint8 team = 0; team < BG_TEAMS_COUNT; ++team)
for (uint8 team = 0; team < PVP_TEAMS_COUNT; ++team)
for (GuidUnorderedSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr)
if (Player* player = ObjectAccessor::FindPlayer(*itr))
if (player->isAFK() && player->GetZoneId() == GetZoneId() && !player->IsGameMaster())
@@ -331,7 +331,7 @@ void Battlefield::StartBattle()
if (m_isActive)
return;
for (int team = 0; team < BG_TEAMS_COUNT; team++)
for (int team = 0; team < PVP_TEAMS_COUNT; team++)
{
m_PlayersInWar[team].clear();
m_Groups[team].clear();
@@ -378,7 +378,7 @@ void Battlefield::DoPlaySoundToAll(uint32 SoundID)
data.Initialize(SMSG_PLAY_SOUND, 4);
data << uint32(SoundID);
for (int team = 0; team < BG_TEAMS_COUNT; team++)
for (int team = 0; team < PVP_TEAMS_COUNT; team++)
for (GuidUnorderedSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr)
if (Player* player = ObjectAccessor::FindPlayer(*itr))
player->GetSession()->SendPacket(&data);
@@ -449,7 +449,7 @@ void Battlefield::TeamCastSpell(TeamId team, int32 spellId)
void Battlefield::BroadcastPacketToZone(WorldPacket& data) const
{
for (uint8 team = 0; team < BG_TEAMS_COUNT; ++team)
for (uint8 team = 0; team < PVP_TEAMS_COUNT; ++team)
for (GuidUnorderedSet::const_iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr)
if (Player* player = ObjectAccessor::FindPlayer(*itr))
player->GetSession()->SendPacket(&data);
@@ -457,7 +457,7 @@ void Battlefield::BroadcastPacketToZone(WorldPacket& data) const
void Battlefield::BroadcastPacketToQueue(WorldPacket& data) const
{
for (uint8 team = 0; team < BG_TEAMS_COUNT; ++team)
for (uint8 team = 0; team < PVP_TEAMS_COUNT; ++team)
for (GuidUnorderedSet::const_iterator itr = m_PlayersInQueue[team].begin(); itr != m_PlayersInQueue[team].end(); ++itr)
if (Player* player = ObjectAccessor::FindPlayer(*itr))
player->GetSession()->SendPacket(&data);
@@ -465,7 +465,7 @@ void Battlefield::BroadcastPacketToQueue(WorldPacket& data) const
void Battlefield::BroadcastPacketToWar(WorldPacket& data) const
{
for (uint8 team = 0; team < BG_TEAMS_COUNT; ++team)
for (uint8 team = 0; team < PVP_TEAMS_COUNT; ++team)
for (GuidUnorderedSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr)
if (Player* player = ObjectAccessor::FindPlayer(*itr))
player->GetSession()->SendPacket(&data);
@@ -487,7 +487,7 @@ void Battlefield::SendWarningToPlayer(Player* player, uint32 entry)
void Battlefield::SendUpdateWorldState(uint32 field, uint32 value)
{
for (uint8 i = 0; i < BG_TEAMS_COUNT; ++i)
for (uint8 i = 0; i < PVP_TEAMS_COUNT; ++i)
for (GuidUnorderedSet::iterator itr = m_players[i].begin(); itr != m_players[i].end(); ++itr)
if (Player* player = ObjectAccessor::FindPlayer(*itr))
player->SendUpdateWorldState(field, value);

View File

@@ -57,7 +57,7 @@ enum BattlefieldSounds
constexpr auto BATTLEFIELD_OBJECTIVE_UPDATE_INTERVAL = 1000;
const uint32 BattlefieldFactions[BG_TEAMS_COUNT] =
const uint32 BattlefieldFactions[PVP_TEAMS_COUNT] =
{
1732, // Alliance
1735 // Horde
@@ -372,11 +372,11 @@ protected:
BfCapturePointVector m_capturePoints;
// Players info maps
GuidUnorderedSet m_players[BG_TEAMS_COUNT]; // Players in zone
GuidUnorderedSet m_PlayersInQueue[BG_TEAMS_COUNT]; // Players in the queue
GuidUnorderedSet m_PlayersInWar[BG_TEAMS_COUNT]; // Players in WG combat
PlayerTimerMap m_InvitedPlayers[BG_TEAMS_COUNT];
PlayerTimerMap m_PlayersWillBeKick[BG_TEAMS_COUNT];
GuidUnorderedSet m_players[PVP_TEAMS_COUNT]; // Players in zone
GuidUnorderedSet m_PlayersInQueue[PVP_TEAMS_COUNT]; // Players in the queue
GuidUnorderedSet m_PlayersInWar[PVP_TEAMS_COUNT]; // Players in WG combat
PlayerTimerMap m_InvitedPlayers[PVP_TEAMS_COUNT];
PlayerTimerMap m_PlayersWillBeKick[PVP_TEAMS_COUNT];
// Variables that must exist for each battlefield
uint32 m_TypeId; // See enum BattlefieldTypes
@@ -403,7 +403,7 @@ protected:
uint32 m_StartGroupingTimer; // Timer for invite players in area 15 minute before start battle
bool m_StartGrouping; // bool for know if all players in area has been invited
GuidUnorderedSet m_Groups[BG_TEAMS_COUNT]; // Contain different raid group
GuidUnorderedSet m_Groups[PVP_TEAMS_COUNT]; // Contain different raid group
std::vector<uint64> m_Data64;
std::vector<uint32> m_Data32;

View File

@@ -315,7 +315,7 @@ void BattlefieldWG::UpdateCounterVehicle(bool init)
// Update vehicle count WorldState to player
void BattlefieldWG::UpdateVehicleCountWG()
{
for (uint8 i = 0; i < BG_TEAMS_COUNT; ++i)
for (uint8 i = 0; i < PVP_TEAMS_COUNT; ++i)
for (GuidUnorderedSet::iterator itr = m_players[i].begin(); itr != m_players[i].end(); ++itr)
if (Player* player = ObjectAccessor::FindPlayer(*itr))
{
@@ -328,7 +328,7 @@ void BattlefieldWG::UpdateVehicleCountWG()
void BattlefieldWG::CapturePointTaken(uint32 areaId)
{
for (uint8 i = 0; i < BG_TEAMS_COUNT; ++i)
for (uint8 i = 0; i < PVP_TEAMS_COUNT; ++i)
for (GuidUnorderedSet::iterator itr = m_players[i].begin(); itr != m_players[i].end(); ++itr)
if (Player* player = ObjectAccessor::FindPlayer(*itr))
if (player->GetAreaId() == areaId)