Skip to content

Commit

Permalink
feat(Core/Battleground): split Arena and Battleground score (#10616)
Browse files Browse the repository at this point in the history
  • Loading branch information
Winfidonarleyan committed Feb 17, 2022
1 parent dbd7680 commit 5143872
Show file tree
Hide file tree
Showing 41 changed files with 1,747 additions and 1,763 deletions.
8 changes: 8 additions & 0 deletions data/sql/updates/pending_db_world/rev_1645123941917942700.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
INSERT INTO `version_db_world` (`sql_rev`) VALUES ('1645123941917942700');

DELETE FROM `acore_string` WHERE `entry` BETWEEN 600 AND 704;
DELETE FROM `acore_string` WHERE `entry` BETWEEN 724 AND 726;
DELETE FROM `acore_string` WHERE `entry` BETWEEN 753 AND 755;
DELETE FROM `acore_string` WHERE `entry` BETWEEN 1205 AND 1299;
DELETE FROM `acore_string` WHERE `entry` BETWEEN 1326 AND 1330;
DELETE FROM `acore_string` WHERE `entry` = 1333;
2 changes: 1 addition & 1 deletion src/server/game/Achievements/AchievementMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ bool AchievementCriteriaData::Meets(uint32 criteria_id, Player const* source, Un
return false;
}

TeamId winnerTeam = bg->GetWinner();
TeamId winnerTeam = GetTeamId(bg->GetWinner());
if (winnerTeam == TEAM_NEUTRAL)
{
return false;
Expand Down
18 changes: 9 additions & 9 deletions src/server/game/Battlefield/Battlefield.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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))
Expand Down Expand Up @@ -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())
Expand All @@ -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();
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -449,23 +449,23 @@ 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);
}

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);
}

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);
Expand All @@ -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);
Expand Down
14 changes: 7 additions & 7 deletions src/server/game/Battlefield/Battlefield.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -372,11 +372,11 @@ class Battlefield : public ZoneScript
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
Expand All @@ -403,7 +403,7 @@ class Battlefield : public ZoneScript
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;
Expand Down
4 changes: 2 additions & 2 deletions src/server/game/Battlefield/Zones/BattlefieldWG.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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))
{
Expand All @@ -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)
Expand Down
Loading

0 comments on commit 5143872

Please sign in to comment.