mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-15 23:20:36 +01:00
Core/Shared: add BattlefieldBattleId definitions
Also rename BG_TEAMS_COUNT and BattlegroundTeamId
This commit is contained in:
@@ -164,13 +164,13 @@ bool Battlefield::Update(uint32 diff)
|
||||
if (m_uiKickDontAcceptTimer <= diff)
|
||||
{
|
||||
time_t now = GameTime::GetGameTime();
|
||||
for (uint8 team = 0; team < BG_TEAMS_COUNT; ++team)
|
||||
for (uint8 team = 0; team < PVP_TEAMS_COUNT; ++team)
|
||||
for (PlayerTimerMap::iterator itr = m_InvitedPlayers[team].begin(); itr != m_InvitedPlayers[team].end(); ++itr)
|
||||
if (itr->second <= now)
|
||||
KickPlayerFromBattlefield(itr->first);
|
||||
|
||||
InvitePlayersInZoneToWar();
|
||||
for (uint8 team = 0; team < BG_TEAMS_COUNT; ++team)
|
||||
for (uint8 team = 0; team < PVP_TEAMS_COUNT; ++team)
|
||||
for (PlayerTimerMap::iterator itr = m_PlayersWillBeKick[team].begin(); itr != m_PlayersWillBeKick[team].end(); ++itr)
|
||||
if (itr->second <= now)
|
||||
KickPlayerFromBattlefield(itr->first);
|
||||
@@ -201,7 +201,7 @@ bool Battlefield::Update(uint32 diff)
|
||||
|
||||
void Battlefield::InvitePlayersInZoneToQueue()
|
||||
{
|
||||
for (uint8 team = 0; team < BG_TEAMS_COUNT; ++team)
|
||||
for (uint8 team = 0; team < PVP_TEAMS_COUNT; ++team)
|
||||
for (auto itr = m_players[team].begin(); itr != m_players[team].end(); ++itr)
|
||||
if (Player* player = ObjectAccessor::FindPlayer(*itr))
|
||||
InvitePlayerToQueue(player);
|
||||
@@ -218,7 +218,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)
|
||||
{
|
||||
for (auto itr = m_PlayersInQueue[team].begin(); itr != m_PlayersInQueue[team].end(); ++itr)
|
||||
{
|
||||
@@ -238,7 +238,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 (auto itr = m_players[team].begin(); itr != m_players[team].end(); ++itr)
|
||||
{
|
||||
@@ -297,7 +297,7 @@ void Battlefield::InitStalker(uint32 entry, Position const& pos)
|
||||
|
||||
void Battlefield::KickAfkPlayers()
|
||||
{
|
||||
for (uint8 team = 0; team < BG_TEAMS_COUNT; ++team)
|
||||
for (uint8 team = 0; team < PVP_TEAMS_COUNT; ++team)
|
||||
for (auto itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr)
|
||||
if (Player* player = ObjectAccessor::FindPlayer(*itr))
|
||||
if (player->isAFK())
|
||||
@@ -316,7 +316,7 @@ void Battlefield::StartBattle()
|
||||
if (m_isActive)
|
||||
return;
|
||||
|
||||
for (uint8 team = 0; team < BG_TEAMS_COUNT; ++team)
|
||||
for (uint8 team = 0; team < PVP_TEAMS_COUNT; ++team)
|
||||
{
|
||||
m_PlayersInWar[team].clear();
|
||||
m_Groups[team].clear();
|
||||
@@ -425,7 +425,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 (auto itr = m_players[team].begin(); itr != m_players[team].end(); ++itr)
|
||||
if (Player* player = ObjectAccessor::FindPlayer(*itr))
|
||||
player->SendDirectMessage(&data);
|
||||
@@ -433,7 +433,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 (auto itr = m_PlayersInQueue[team].begin(); itr != m_PlayersInQueue[team].end(); ++itr)
|
||||
if (Player* player = ObjectAccessor::FindConnectedPlayer(*itr))
|
||||
player->SendDirectMessage(&data);
|
||||
@@ -441,7 +441,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 (auto itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr)
|
||||
if (Player* player = ObjectAccessor::FindPlayer(*itr))
|
||||
player->SendDirectMessage(&data);
|
||||
@@ -455,7 +455,7 @@ void Battlefield::SendWarning(uint8 id, WorldObject const* target /*= nullptr*/)
|
||||
|
||||
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 (auto itr = m_players[i].begin(); itr != m_players[i].end(); ++itr)
|
||||
if (Player* player = ObjectAccessor::FindPlayer(*itr))
|
||||
player->SendUpdateWorldState(field, value);
|
||||
@@ -964,7 +964,7 @@ bool BfCapturePoint::Update(uint32 diff)
|
||||
{
|
||||
float radius = capturePoint->GetGOInfo()->capturePoint.radius;
|
||||
|
||||
for (uint8 team = 0; team < BG_TEAMS_COUNT; ++team)
|
||||
for (uint8 team = 0; team < PVP_TEAMS_COUNT; ++team)
|
||||
{
|
||||
for (GuidSet::iterator itr = m_activePlayers[team].begin(); itr != m_activePlayers[team].end();)
|
||||
{
|
||||
@@ -1079,7 +1079,7 @@ bool BfCapturePoint::Update(uint32 diff)
|
||||
|
||||
void BfCapturePoint::SendUpdateWorldState(uint32 field, uint32 value)
|
||||
{
|
||||
for (uint8 team = 0; team < BG_TEAMS_COUNT; ++team)
|
||||
for (uint8 team = 0; team < PVP_TEAMS_COUNT; ++team)
|
||||
for (GuidSet::iterator itr = m_activePlayers[team].begin(); itr != m_activePlayers[team].end(); ++itr) // send to all players present in the area
|
||||
if (Player* player = ObjectAccessor::FindPlayer(*itr))
|
||||
player->SendUpdateWorldState(field, value);
|
||||
|
||||
@@ -110,7 +110,7 @@ class TC_GAME_API BfCapturePoint
|
||||
bool DelCapturePoint();
|
||||
|
||||
// active Players in the area of the objective, 0 - alliance, 1 - horde
|
||||
GuidSet m_activePlayers[BG_TEAMS_COUNT];
|
||||
GuidSet m_activePlayers[PVP_TEAMS_COUNT];
|
||||
|
||||
// Total shift needed to capture the objective
|
||||
float m_maxValue;
|
||||
@@ -182,7 +182,7 @@ class TC_GAME_API BfGraveyard
|
||||
protected:
|
||||
TeamId m_ControlTeam;
|
||||
uint32 m_GraveyardId;
|
||||
ObjectGuid m_SpiritGuide[BG_TEAMS_COUNT];
|
||||
ObjectGuid m_SpiritGuide[PVP_TEAMS_COUNT];
|
||||
GuidSet m_ResurrectQueue;
|
||||
Battlefield* m_Bf;
|
||||
};
|
||||
@@ -356,11 +356,11 @@ class TC_GAME_API Battlefield : public ZoneScript
|
||||
BfCapturePointMap 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
|
||||
@@ -387,7 +387,7 @@ class TC_GAME_API 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;
|
||||
|
||||
@@ -601,7 +601,7 @@ void BattlefieldWG::OnBattleStart()
|
||||
for (WintergraspWorkshop* workshop : Workshops)
|
||||
workshop->UpdateGraveyardAndWorkshop();
|
||||
|
||||
for (uint8 team = 0; team < BG_TEAMS_COUNT; ++team)
|
||||
for (uint8 team = 0; team < PVP_TEAMS_COUNT; ++team)
|
||||
{
|
||||
for (auto itr = m_players[team].begin(); itr != m_players[team].end(); ++itr)
|
||||
{
|
||||
@@ -718,7 +718,7 @@ void BattlefieldWG::OnBattleEnd(bool endByTimer)
|
||||
if (Player* player = ObjectAccessor::FindPlayer(*itr))
|
||||
player->CastSpell(player, SPELL_DEFEAT_REWARD, true);
|
||||
|
||||
for (uint8 team = 0; team < BG_TEAMS_COUNT; ++team)
|
||||
for (uint8 team = 0; team < PVP_TEAMS_COUNT; ++team)
|
||||
{
|
||||
for (auto itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr)
|
||||
if (Player* player = ObjectAccessor::FindPlayer(*itr))
|
||||
@@ -736,7 +736,7 @@ void BattlefieldWG::OnBattleEnd(bool endByTimer)
|
||||
|
||||
if (!endByTimer)
|
||||
{
|
||||
for (uint8 team = 0; team < BG_TEAMS_COUNT; ++team)
|
||||
for (uint8 team = 0; team < PVP_TEAMS_COUNT; ++team)
|
||||
{
|
||||
for (auto itr = m_players[team].begin(); itr != m_players[team].end(); ++itr)
|
||||
{
|
||||
@@ -973,7 +973,7 @@ void BattlefieldWG::HandleKill(Player* killer, Unit* victim)
|
||||
|
||||
bool BattlefieldWG::FindAndRemoveVehicleFromList(Unit* vehicle)
|
||||
{
|
||||
for (uint32 team = 0; team < BG_TEAMS_COUNT; ++team)
|
||||
for (uint32 team = 0; team < PVP_TEAMS_COUNT; ++team)
|
||||
{
|
||||
auto itr = m_vehicles[team].find(vehicle->GetGUID());
|
||||
if (itr != m_vehicles[team].end())
|
||||
@@ -1190,7 +1190,7 @@ void BattlefieldWG::SendInitWorldStatesTo(Player* player)
|
||||
|
||||
void BattlefieldWG::SendInitWorldStatesToAll()
|
||||
{
|
||||
for (uint8 team = 0; team < BG_TEAMS_COUNT; ++team)
|
||||
for (uint8 team = 0; team < PVP_TEAMS_COUNT; ++team)
|
||||
for (auto itr = m_players[team].begin(); itr != m_players[team].end(); ++itr)
|
||||
if (Player* player = ObjectAccessor::FindPlayer(*itr))
|
||||
SendInitWorldStatesTo(player);
|
||||
|
||||
@@ -387,10 +387,10 @@ class TC_GAME_API BattlefieldWG : public Battlefield
|
||||
|
||||
WorkshopVect Workshops;
|
||||
|
||||
GuidVector DefenderPortalList[BG_TEAMS_COUNT];
|
||||
GuidVector DefenderPortalList[PVP_TEAMS_COUNT];
|
||||
GameObjectBuildingVect BuildingsInZone;
|
||||
|
||||
GuidUnorderedSet m_vehicles[BG_TEAMS_COUNT];
|
||||
GuidUnorderedSet m_vehicles[PVP_TEAMS_COUNT];
|
||||
GuidVector CanonList;
|
||||
|
||||
TeamId m_tenacityTeam;
|
||||
@@ -557,11 +557,11 @@ private:
|
||||
StaticWintergraspTowerInfo const* _staticTowerInfo;
|
||||
|
||||
// GameObject associations
|
||||
GuidVector m_GameObjectList[BG_TEAMS_COUNT];
|
||||
GuidVector m_GameObjectList[PVP_TEAMS_COUNT];
|
||||
|
||||
// Creature associations
|
||||
GuidVector m_CreatureBottomList[BG_TEAMS_COUNT];
|
||||
GuidVector m_CreatureTopList[BG_TEAMS_COUNT];
|
||||
GuidVector m_CreatureBottomList[PVP_TEAMS_COUNT];
|
||||
GuidVector m_CreatureTopList[PVP_TEAMS_COUNT];
|
||||
GuidVector m_TowerCannonBottomList;
|
||||
GuidVector m_TurretTopList;
|
||||
|
||||
|
||||
@@ -203,8 +203,8 @@ void Arena::EndBattleground(uint32 winner)
|
||||
|
||||
// bg team that the client expects is different to TeamId
|
||||
// alliance 1, horde 0
|
||||
uint8 winnerTeam = winner == ALLIANCE ? BG_TEAM_ALLIANCE : BG_TEAM_HORDE;
|
||||
uint8 loserTeam = winner == ALLIANCE ? BG_TEAM_HORDE : BG_TEAM_ALLIANCE;
|
||||
uint8 winnerTeam = winner == ALLIANCE ? PVP_TEAM_ALLIANCE : PVP_TEAM_HORDE;
|
||||
uint8 loserTeam = winner == ALLIANCE ? PVP_TEAM_HORDE : PVP_TEAM_ALLIANCE;
|
||||
|
||||
_arenaTeamScores[winnerTeam].Assign(winnerChange, winnerMatchmakerRating, winnerArenaTeam->GetName());
|
||||
_arenaTeamScores[loserTeam].Assign(loserChange, loserMatchmakerRating, loserArenaTeam->GetName());
|
||||
@@ -224,8 +224,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(ARENA_TIMELIMIT_POINTS_LOSS, winnerMatchmakerRating, winnerArenaTeam->GetName());
|
||||
_arenaTeamScores[BG_TEAM_HORDE].Assign(ARENA_TIMELIMIT_POINTS_LOSS, loserMatchmakerRating, loserArenaTeam->GetName());
|
||||
_arenaTeamScores[PVP_TEAM_ALLIANCE].Assign(ARENA_TIMELIMIT_POINTS_LOSS, winnerMatchmakerRating, winnerArenaTeam->GetName());
|
||||
_arenaTeamScores[PVP_TEAM_HORDE].Assign(ARENA_TIMELIMIT_POINTS_LOSS, loserMatchmakerRating, loserArenaTeam->GetName());
|
||||
|
||||
winnerArenaTeam->FinishGame(ARENA_TIMELIMIT_POINTS_LOSS);
|
||||
loserArenaTeam->FinishGame(ARENA_TIMELIMIT_POINTS_LOSS);
|
||||
|
||||
@@ -26,7 +26,7 @@ struct TC_GAME_API ArenaScore : public BattlegroundScore
|
||||
friend class Arena;
|
||||
|
||||
protected:
|
||||
ArenaScore(ObjectGuid playerGuid, uint32 team) : BattlegroundScore(playerGuid), TeamId(team == ALLIANCE ? BG_TEAM_ALLIANCE : BG_TEAM_HORDE) { }
|
||||
ArenaScore(ObjectGuid playerGuid, uint32 team) : BattlegroundScore(playerGuid), TeamId(team == ALLIANCE ? PVP_TEAM_ALLIANCE : PVP_TEAM_HORDE) { }
|
||||
|
||||
void AppendToPacket(WorldPacket& data) final override;
|
||||
void BuildObjectivesBlock(WorldPacket& data) final override;
|
||||
@@ -39,7 +39,7 @@ struct TC_GAME_API ArenaScore : public BattlegroundScore
|
||||
return stream.str();
|
||||
}
|
||||
|
||||
uint8 TeamId; // BattlegroundTeamId
|
||||
uint8 TeamId; // PvPTeamId
|
||||
};
|
||||
|
||||
struct TC_GAME_API ArenaTeamScore
|
||||
|
||||
@@ -76,7 +76,7 @@ Battleground::Battleground()
|
||||
m_InvitedHorde = 0;
|
||||
m_ArenaType = 0;
|
||||
m_IsArena = false;
|
||||
_winnerTeamId = BG_TEAM_NEUTRAL;
|
||||
_winnerTeamId = PVP_TEAM_NEUTRAL;
|
||||
m_StartTime = 0;
|
||||
m_ResetStatTimer = 0;
|
||||
m_ValidStartPositionTimer = 0;
|
||||
@@ -684,7 +684,7 @@ void Battleground::EndBattleground(uint32 winner)
|
||||
|
||||
PlaySoundToAll(SOUND_ALLIANCE_WINS); // alliance wins sound
|
||||
|
||||
SetWinner(BG_TEAM_ALLIANCE);
|
||||
SetWinner(PVP_TEAM_ALLIANCE);
|
||||
}
|
||||
else if (winner == HORDE)
|
||||
{
|
||||
@@ -693,11 +693,11 @@ void Battleground::EndBattleground(uint32 winner)
|
||||
|
||||
PlaySoundToAll(SOUND_HORDE_WINS); // horde wins sound
|
||||
|
||||
SetWinner(BG_TEAM_HORDE);
|
||||
SetWinner(PVP_TEAM_HORDE);
|
||||
}
|
||||
else
|
||||
{
|
||||
SetWinner(BG_TEAM_NEUTRAL);
|
||||
SetWinner(PVP_TEAM_NEUTRAL);
|
||||
}
|
||||
|
||||
PreparedStatement* stmt = nullptr;
|
||||
@@ -943,7 +943,7 @@ void Battleground::RemovePlayerAtLeave(ObjectGuid guid, bool Transport, bool Sen
|
||||
// this method is called when no players remains in battleground
|
||||
void Battleground::Reset()
|
||||
{
|
||||
SetWinner(BG_TEAM_NEUTRAL);
|
||||
SetWinner(PVP_TEAM_NEUTRAL);
|
||||
SetStatus(STATUS_WAIT_QUEUE);
|
||||
SetStartTime(0);
|
||||
SetEndTime(0);
|
||||
@@ -964,7 +964,7 @@ void Battleground::Reset()
|
||||
delete itr->second;
|
||||
PlayerScores.clear();
|
||||
|
||||
for (uint8 i = 0; i < BG_TEAMS_COUNT; ++i)
|
||||
for (uint8 i = 0; i < PVP_TEAMS_COUNT; ++i)
|
||||
_arenaTeamScores[i].Reset();
|
||||
|
||||
ResetBGSubclass();
|
||||
@@ -1211,10 +1211,10 @@ void Battleground::BuildPvPLogDataPacket(WorldPacket& data)
|
||||
|
||||
if (type) // arena
|
||||
{
|
||||
for (uint8 i = 0; i < BG_TEAMS_COUNT; ++i)
|
||||
for (uint8 i = 0; i < PVP_TEAMS_COUNT; ++i)
|
||||
_arenaTeamScores[i].BuildRatingInfoBlock(data);
|
||||
|
||||
for (uint8 i = 0; i < BG_TEAMS_COUNT; ++i)
|
||||
for (uint8 i = 0; i < PVP_TEAMS_COUNT; ++i)
|
||||
_arenaTeamScores[i].BuildTeamInfoBlock(data);
|
||||
}
|
||||
|
||||
|
||||
@@ -278,7 +278,7 @@ class TC_GAME_API Battleground
|
||||
|
||||
int32 GetStartDelayTime() const { return m_StartDelayTime; }
|
||||
uint8 GetArenaType() const { return m_ArenaType; }
|
||||
BattlegroundTeamId GetWinner() const { return _winnerTeamId; }
|
||||
PvPTeamId GetWinner() const { return _winnerTeamId; }
|
||||
uint32 GetScriptId() const { return ScriptId; }
|
||||
uint32 GetBonusHonorFromKill(uint32 kills) const;
|
||||
bool IsRandom() const { return m_IsRandom; }
|
||||
@@ -301,7 +301,7 @@ class TC_GAME_API Battleground
|
||||
void SetRated(bool state) { m_IsRated = state; }
|
||||
void SetArenaType(uint8 type) { m_ArenaType = type; }
|
||||
void SetArenaorBGType(bool _isArena) { m_IsArena = _isArena; }
|
||||
void SetWinner(BattlegroundTeamId winnerTeamId) { _winnerTeamId = winnerTeamId; }
|
||||
void SetWinner(PvPTeamId winnerTeamId) { _winnerTeamId = winnerTeamId; }
|
||||
void SetScriptId(uint32 scriptId) { ScriptId = scriptId; }
|
||||
|
||||
void ModifyStartDelayTime(int diff) { m_StartDelayTime -= diff; }
|
||||
@@ -525,9 +525,9 @@ class TC_GAME_API Battleground
|
||||
bool m_IsRandom;
|
||||
|
||||
BGHonorMode m_HonorMode;
|
||||
int32 m_TeamScores[BG_TEAMS_COUNT];
|
||||
int32 m_TeamScores[PVP_TEAMS_COUNT];
|
||||
|
||||
ArenaTeamScore _arenaTeamScores[BG_TEAMS_COUNT];
|
||||
ArenaTeamScore _arenaTeamScores[PVP_TEAMS_COUNT];
|
||||
|
||||
private:
|
||||
// Battleground
|
||||
@@ -546,7 +546,7 @@ class TC_GAME_API Battleground
|
||||
bool m_InBGFreeSlotQueue; // used to make sure that BG is only once inserted into the BattlegroundMgr.BGFreeSlotQueue[bgTypeId] deque
|
||||
bool m_SetDeleteThis; // used for safe deletion of the bg after end / all players leave
|
||||
bool m_IsArena;
|
||||
BattlegroundTeamId _winnerTeamId;
|
||||
PvPTeamId _winnerTeamId;
|
||||
int32 m_StartDelayTime;
|
||||
bool m_IsRated; // is this battle rated?
|
||||
bool m_PrematureCountDown;
|
||||
@@ -594,15 +594,15 @@ class TC_GAME_API Battleground
|
||||
uint32 m_InvitedHorde;
|
||||
|
||||
// Raid Group
|
||||
Group* m_BgRaids[BG_TEAMS_COUNT]; // 0 - alliance, 1 - horde
|
||||
Group* m_BgRaids[PVP_TEAMS_COUNT]; // 0 - alliance, 1 - horde
|
||||
|
||||
// Players count by team
|
||||
uint32 m_PlayersCount[BG_TEAMS_COUNT];
|
||||
uint32 m_PlayersCount[PVP_TEAMS_COUNT];
|
||||
|
||||
// Arena team ids by team
|
||||
uint32 m_ArenaTeamIds[BG_TEAMS_COUNT];
|
||||
uint32 m_ArenaTeamIds[PVP_TEAMS_COUNT];
|
||||
|
||||
uint32 m_ArenaTeamMMR[BG_TEAMS_COUNT];
|
||||
uint32 m_ArenaTeamMMR[PVP_TEAMS_COUNT];
|
||||
|
||||
// Limits
|
||||
uint32 m_LevelMin;
|
||||
@@ -615,7 +615,7 @@ class TC_GAME_API Battleground
|
||||
// Start location
|
||||
uint32 m_MapId;
|
||||
BattlegroundMap* m_Map;
|
||||
Position StartPosition[BG_TEAMS_COUNT];
|
||||
Position StartPosition[PVP_TEAMS_COUNT];
|
||||
float m_StartMaxDist;
|
||||
uint32 ScriptId;
|
||||
};
|
||||
|
||||
@@ -53,7 +53,7 @@ struct BattlegroundTemplate
|
||||
uint16 MaxPlayersPerTeam;
|
||||
uint8 MinLevel;
|
||||
uint8 MaxLevel;
|
||||
Position StartLocation[BG_TEAMS_COUNT];
|
||||
Position StartLocation[PVP_TEAMS_COUNT];
|
||||
float MaxStartDistSq;
|
||||
uint8 Weight;
|
||||
uint32 ScriptId;
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
|
||||
BattlegroundQueue::BattlegroundQueue()
|
||||
{
|
||||
for (uint32 i = 0; i < BG_TEAMS_COUNT; ++i)
|
||||
for (uint32 i = 0; i < PVP_TEAMS_COUNT; ++i)
|
||||
{
|
||||
for (uint32 j = 0; j < MAX_BATTLEGROUND_BRACKETS; ++j)
|
||||
{
|
||||
@@ -155,7 +155,7 @@ GroupQueueInfo* BattlegroundQueue::AddGroup(Player* leader, Group* grp, Battlegr
|
||||
//compute index (if group is premade or joined a rated match) to queues
|
||||
uint32 index = 0;
|
||||
if (!isRated && !isPremade)
|
||||
index += BG_TEAMS_COUNT;
|
||||
index += PVP_TEAMS_COUNT;
|
||||
if (ginfo->Team == HORDE)
|
||||
index++;
|
||||
TC_LOG_DEBUG("bg.battleground", "Adding Group to BattlegroundQueue bgTypeId : %u, bracket_id : %u, index : %u", BgTypeId, bracketId, index);
|
||||
@@ -313,7 +313,7 @@ void BattlegroundQueue::RemovePlayer(ObjectGuid guid, bool decreaseInvitedCount)
|
||||
{
|
||||
//we must check premade and normal team's queue - because when players from premade are joining bg,
|
||||
//they leave groupinfo so we can't use its players size to find out index
|
||||
for (uint32 j = index; j < BG_QUEUE_GROUP_TYPES_COUNT; j += BG_TEAMS_COUNT)
|
||||
for (uint32 j = index; j < BG_QUEUE_GROUP_TYPES_COUNT; j += PVP_TEAMS_COUNT)
|
||||
{
|
||||
GroupsQueueType::iterator k = m_QueuedGroups[bracket_id_tmp][j].begin();
|
||||
for (; k != m_QueuedGroups[bracket_id_tmp][j].end(); ++k)
|
||||
@@ -624,7 +624,7 @@ bool BattlegroundQueue::CheckPremadeMatch(BattlegroundBracketId bracket_id, uint
|
||||
//add groups/players from normal queue to size of bigger group
|
||||
uint32 maxPlayers = std::min(m_SelectionPools[TEAM_ALLIANCE].GetPlayerCount(), m_SelectionPools[TEAM_HORDE].GetPlayerCount());
|
||||
GroupsQueueType::const_iterator itr;
|
||||
for (uint32 i = 0; i < BG_TEAMS_COUNT; i++)
|
||||
for (uint32 i = 0; i < PVP_TEAMS_COUNT; i++)
|
||||
{
|
||||
for (itr = m_QueuedGroups[bracket_id][BG_QUEUE_NORMAL_ALLIANCE + i].begin(); itr != m_QueuedGroups[bracket_id][BG_QUEUE_NORMAL_ALLIANCE + i].end(); ++itr)
|
||||
{
|
||||
@@ -642,7 +642,7 @@ bool BattlegroundQueue::CheckPremadeMatch(BattlegroundBracketId bracket_id, uint
|
||||
// if first is invited to BG and seconds timer expired, but we can ignore it, because players have only 80 seconds to click to enter bg
|
||||
// and when they click or after 80 seconds the queue info is removed from queue
|
||||
uint32 time_before = GameTime::GetGameTimeMS() - sWorld->getIntConfig(CONFIG_BATTLEGROUND_PREMADE_GROUP_WAIT_FOR_MATCH);
|
||||
for (uint32 i = 0; i < BG_TEAMS_COUNT; i++)
|
||||
for (uint32 i = 0; i < PVP_TEAMS_COUNT; i++)
|
||||
{
|
||||
if (!m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_ALLIANCE + i].empty())
|
||||
{
|
||||
@@ -662,8 +662,8 @@ bool BattlegroundQueue::CheckPremadeMatch(BattlegroundBracketId bracket_id, uint
|
||||
// this method tries to create battleground or arena with MinPlayersPerTeam against MinPlayersPerTeam
|
||||
bool BattlegroundQueue::CheckNormalMatch(Battleground* bg_template, BattlegroundBracketId bracket_id, uint32 minPlayers, uint32 maxPlayers)
|
||||
{
|
||||
GroupsQueueType::const_iterator itr_team[BG_TEAMS_COUNT];
|
||||
for (uint32 i = 0; i < BG_TEAMS_COUNT; i++)
|
||||
GroupsQueueType::const_iterator itr_team[PVP_TEAMS_COUNT];
|
||||
for (uint32 i = 0; i < PVP_TEAMS_COUNT; i++)
|
||||
{
|
||||
itr_team[i] = m_QueuedGroups[bracket_id][BG_QUEUE_NORMAL_ALLIANCE + i].begin();
|
||||
for (; itr_team[i] != m_QueuedGroups[bracket_id][BG_QUEUE_NORMAL_ALLIANCE + i].end(); ++(itr_team[i]))
|
||||
@@ -688,7 +688,7 @@ bool BattlegroundQueue::CheckNormalMatch(Battleground* bg_template, Battleground
|
||||
for (; itr_team[j] != m_QueuedGroups[bracket_id][BG_QUEUE_NORMAL_ALLIANCE + j].end(); ++(itr_team[j]))
|
||||
{
|
||||
if (!(*(itr_team[j]))->IsInvitedToBGInstanceGUID)
|
||||
if (!m_SelectionPools[j].AddGroup(*(itr_team[j]), m_SelectionPools[(j + 1) % BG_TEAMS_COUNT].GetPlayerCount()))
|
||||
if (!m_SelectionPools[j].AddGroup(*(itr_team[j]), m_SelectionPools[(j + 1) % PVP_TEAMS_COUNT].GetPlayerCount()))
|
||||
break;
|
||||
}
|
||||
// do not allow to start bg with more than 2 players more on 1 faction
|
||||
@@ -852,7 +852,7 @@ void BattlegroundQueue::BattlegroundQueueUpdate(uint32 /*diff*/, BattlegroundTyp
|
||||
return;
|
||||
}
|
||||
// invite those selection pools
|
||||
for (uint32 i = 0; i < BG_TEAMS_COUNT; i++)
|
||||
for (uint32 i = 0; i < PVP_TEAMS_COUNT; i++)
|
||||
for (GroupsQueueType::const_iterator citr = m_SelectionPools[TEAM_ALLIANCE + i].SelectedGroups.begin(); citr != m_SelectionPools[TEAM_ALLIANCE + i].SelectedGroups.end(); ++citr)
|
||||
InviteGroupToBG((*citr), bg2, (*citr)->Team);
|
||||
|
||||
@@ -879,7 +879,7 @@ void BattlegroundQueue::BattlegroundQueueUpdate(uint32 /*diff*/, BattlegroundTyp
|
||||
}
|
||||
|
||||
// invite those selection pools
|
||||
for (uint32 i = 0; i < BG_TEAMS_COUNT; i++)
|
||||
for (uint32 i = 0; i < PVP_TEAMS_COUNT; i++)
|
||||
for (GroupsQueueType::const_iterator citr = m_SelectionPools[TEAM_ALLIANCE + i].SelectedGroups.begin(); citr != m_SelectionPools[TEAM_ALLIANCE + i].SelectedGroups.end(); ++citr)
|
||||
InviteGroupToBG((*citr), bg2, (*citr)->Team);
|
||||
// start bg
|
||||
@@ -925,7 +925,7 @@ void BattlegroundQueue::BattlegroundQueueUpdate(uint32 /*diff*/, BattlegroundTyp
|
||||
int32 discardTime = GameTime::GetGameTimeMS() - sBattlegroundMgr->GetRatingDiscardTimer();
|
||||
|
||||
// we need to find 2 teams which will play next game
|
||||
GroupsQueueType::iterator itr_teams[BG_TEAMS_COUNT];
|
||||
GroupsQueueType::iterator itr_teams[PVP_TEAMS_COUNT];
|
||||
uint8 found = 0;
|
||||
uint8 team = 0;
|
||||
|
||||
|
||||
@@ -125,14 +125,14 @@ class TC_GAME_API BattlegroundQueue
|
||||
};
|
||||
|
||||
//one selection pool for horde, other one for alliance
|
||||
SelectionPool m_SelectionPools[BG_TEAMS_COUNT];
|
||||
SelectionPool m_SelectionPools[PVP_TEAMS_COUNT];
|
||||
uint32 GetPlayersInQueue(TeamId id);
|
||||
private:
|
||||
|
||||
bool InviteGroupToBG(GroupQueueInfo* ginfo, Battleground* bg, uint32 side);
|
||||
uint32 m_WaitTimes[BG_TEAMS_COUNT][MAX_BATTLEGROUND_BRACKETS][COUNT_OF_PLAYERS_TO_AVERAGE_WAIT_TIME];
|
||||
uint32 m_WaitTimeLastPlayer[BG_TEAMS_COUNT][MAX_BATTLEGROUND_BRACKETS];
|
||||
uint32 m_SumOfWaitTimes[BG_TEAMS_COUNT][MAX_BATTLEGROUND_BRACKETS];
|
||||
uint32 m_WaitTimes[PVP_TEAMS_COUNT][MAX_BATTLEGROUND_BRACKETS][COUNT_OF_PLAYERS_TO_AVERAGE_WAIT_TIME];
|
||||
uint32 m_WaitTimeLastPlayer[PVP_TEAMS_COUNT][MAX_BATTLEGROUND_BRACKETS];
|
||||
uint32 m_SumOfWaitTimes[PVP_TEAMS_COUNT][MAX_BATTLEGROUND_BRACKETS];
|
||||
|
||||
// Event handler
|
||||
EventProcessor m_events;
|
||||
|
||||
@@ -53,7 +53,7 @@ BattlegroundAB::BattlegroundAB()
|
||||
m_BannerTimers[i].teamIndex = 0;
|
||||
}
|
||||
|
||||
for (uint8 i = 0; i < BG_TEAMS_COUNT; ++i)
|
||||
for (uint8 i = 0; i < PVP_TEAMS_COUNT; ++i)
|
||||
{
|
||||
m_lastTick[i] = 0;
|
||||
m_HonorScoreTics[i] = 0;
|
||||
@@ -71,7 +71,7 @@ void BattlegroundAB::PostUpdateImpl(uint32 diff)
|
||||
{
|
||||
if (GetStatus() == STATUS_IN_PROGRESS)
|
||||
{
|
||||
int team_points[BG_TEAMS_COUNT] = { 0, 0 };
|
||||
int team_points[PVP_TEAMS_COUNT] = { 0, 0 };
|
||||
|
||||
for (int node = 0; node < BG_AB_DYNAMIC_NODES_COUNT; ++node)
|
||||
{
|
||||
@@ -120,13 +120,13 @@ void BattlegroundAB::PostUpdateImpl(uint32 diff)
|
||||
}
|
||||
}
|
||||
|
||||
for (int team = 0; team < BG_TEAMS_COUNT; ++team)
|
||||
for (int team = 0; team < PVP_TEAMS_COUNT; ++team)
|
||||
if (m_Nodes[node] == team + BG_AB_NODE_TYPE_OCCUPIED)
|
||||
++team_points[team];
|
||||
}
|
||||
|
||||
// Accumulate points
|
||||
for (int team = 0; team < BG_TEAMS_COUNT; ++team)
|
||||
for (int team = 0; team < PVP_TEAMS_COUNT; ++team)
|
||||
{
|
||||
int points = team_points[team];
|
||||
if (!points)
|
||||
@@ -172,7 +172,7 @@ void BattlegroundAB::PostUpdateImpl(uint32 diff)
|
||||
UpdateWorldState(BG_AB_OP_RESOURCES_HORDE, m_TeamScores[team]);
|
||||
// update achievement flags
|
||||
// we increased m_TeamScores[team] so we just need to check if it is 500 more than other teams resources
|
||||
uint8 otherTeam = (team + 1) % BG_TEAMS_COUNT;
|
||||
uint8 otherTeam = (team + 1) % PVP_TEAMS_COUNT;
|
||||
if (m_TeamScores[team] > m_TeamScores[otherTeam] + 500)
|
||||
m_TeamScores500Disadvantage[otherTeam] = true;
|
||||
}
|
||||
|
||||
@@ -348,13 +348,13 @@ class BattlegroundAB : public Battleground
|
||||
uint8 m_prevNodes[BG_AB_DYNAMIC_NODES_COUNT];
|
||||
BG_AB_BannerTimer m_BannerTimers[BG_AB_DYNAMIC_NODES_COUNT];
|
||||
uint32 m_NodeTimers[BG_AB_DYNAMIC_NODES_COUNT];
|
||||
uint32 m_lastTick[BG_TEAMS_COUNT];
|
||||
uint32 m_HonorScoreTics[BG_TEAMS_COUNT];
|
||||
uint32 m_ReputationScoreTics[BG_TEAMS_COUNT];
|
||||
uint32 m_lastTick[PVP_TEAMS_COUNT];
|
||||
uint32 m_HonorScoreTics[PVP_TEAMS_COUNT];
|
||||
uint32 m_ReputationScoreTics[PVP_TEAMS_COUNT];
|
||||
bool m_IsInformedNearVictory;
|
||||
uint32 m_HonorTics;
|
||||
uint32 m_ReputationTics;
|
||||
// need for achievements
|
||||
bool m_TeamScores500Disadvantage[BG_TEAMS_COUNT];
|
||||
bool m_TeamScores500Disadvantage[PVP_TEAMS_COUNT];
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -700,6 +700,6 @@ class BattlegroundSA : public Battleground
|
||||
bool _gateDestroyed;
|
||||
|
||||
// Achievement: Not Even a Scratch
|
||||
bool _allVehiclesAlive[BG_TEAMS_COUNT];
|
||||
bool _allVehiclesAlive[PVP_TEAMS_COUNT];
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -599,7 +599,7 @@ bool OutdoorPvP::HandleAreaTrigger(Player* /*player*/, uint32 /*trigger*/)
|
||||
void OutdoorPvP::BroadcastPacket(WorldPacket &data) const
|
||||
{
|
||||
// This is faster than sWorld->SendZoneMessage
|
||||
for (uint32 team = 0; team < BG_TEAMS_COUNT; ++team)
|
||||
for (uint32 team = 0; team < PVP_TEAMS_COUNT; ++team)
|
||||
for (GuidSet::const_iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr)
|
||||
if (Player* const player = ObjectAccessor::FindPlayer(*itr))
|
||||
player->SendDirectMessage(&data);
|
||||
@@ -681,7 +681,7 @@ void OutdoorPvP::SendDefenseMessage(uint32 zoneId, uint32 id)
|
||||
template<class Worker>
|
||||
void OutdoorPvP::BroadcastWorker(Worker& _worker, uint32 zoneId)
|
||||
{
|
||||
for (uint32 i = 0; i < BG_TEAMS_COUNT; ++i)
|
||||
for (uint32 i = 0; i < PVP_TEAMS_COUNT; ++i)
|
||||
for (GuidSet::iterator itr = m_players[i].begin(); itr != m_players[i].end(); ++itr)
|
||||
if (Player* player = ObjectAccessor::FindPlayer(*itr))
|
||||
if (player->GetZoneId() == zoneId)
|
||||
|
||||
@@ -33,7 +33,7 @@ WorldPacket const* WorldPackets::Quest::QueryQuestInfoResponse::Write()
|
||||
_worldPacket << uint32(Info.QuestType);
|
||||
_worldPacket << uint32(Info.SuggestedGroupNum);
|
||||
|
||||
for (uint8 i = 0; i < BG_TEAMS_COUNT; ++i)
|
||||
for (uint8 i = 0; i < PVP_TEAMS_COUNT; ++i)
|
||||
{
|
||||
_worldPacket << uint32(Info.RequiredFactionId[i]);
|
||||
_worldPacket << uint32(Info.RequiredFactionValue[i]);
|
||||
|
||||
@@ -52,8 +52,8 @@ namespace WorldPackets
|
||||
uint32 SuggestedGroupNum = 0;
|
||||
int32 AllowableRaces = -1;
|
||||
|
||||
uint32 RequiredFactionId[BG_TEAMS_COUNT] = { }; // shown in quest log as part of quest objective (same/opposite faction)
|
||||
int32 RequiredFactionValue[BG_TEAMS_COUNT] = { }; // shown in quest log as part of quest objective (same/opposite faction)
|
||||
uint32 RequiredFactionId[PVP_TEAMS_COUNT] = { }; // shown in quest log as part of quest objective (same/opposite faction)
|
||||
int32 RequiredFactionValue[PVP_TEAMS_COUNT] = { }; // shown in quest log as part of quest objective (same/opposite faction)
|
||||
|
||||
uint32 RewardNextQuest = 0; // client will request this quest from NPC, if not 0
|
||||
uint32 RewardXPDifficulty = 0; // used for calculating rewarded experience
|
||||
|
||||
@@ -3427,14 +3427,14 @@ enum BanReturn
|
||||
BAN_EXISTS
|
||||
};
|
||||
|
||||
enum BattlegroundTeamId
|
||||
enum PvPTeamId
|
||||
{
|
||||
BG_TEAM_HORDE = 0, // Battleground: Horde, Arena: Green
|
||||
BG_TEAM_ALLIANCE = 1, // Battleground: Alliance, Arena: Gold
|
||||
BG_TEAM_NEUTRAL = 2 // Battleground: Neutral, Arena: None
|
||||
PVP_TEAM_HORDE = 0, // Battleground: Horde, Arena: Green
|
||||
PVP_TEAM_ALLIANCE = 1, // Battleground: Alliance, Arena: Gold
|
||||
PVP_TEAM_NEUTRAL = 2 // Battleground: Neutral, Arena: None
|
||||
};
|
||||
|
||||
#define BG_TEAMS_COUNT 2
|
||||
uint8 constexpr PVP_TEAMS_COUNT = 2;
|
||||
|
||||
// indexes of BattlemasterList.dbc
|
||||
enum BattlegroundTypeId : uint32
|
||||
@@ -3457,6 +3457,12 @@ enum BattlegroundTypeId : uint32
|
||||
|
||||
#define MAX_BATTLEGROUND_TYPE_ID 33
|
||||
|
||||
enum BattlefieldBattleId : uint8
|
||||
{
|
||||
BATTLEFIELD_BATTLEID_WINTERGRASP = 1, // Wintergrasp battle
|
||||
BATTLEFIELD_BATTLEID_MAX = 2
|
||||
};
|
||||
|
||||
enum MailResponseType
|
||||
{
|
||||
MAIL_SEND = 0,
|
||||
|
||||
Reference in New Issue
Block a user