Revert "Core/Battlegrounds: Remove player on leave from battleground player map only after battleground-specific code"
Some battlegrounds (arenas) need access to the updated player map in RemovePlayer(), pass team as parameter instead
This commit is contained in:
@@ -873,6 +873,16 @@ void Battleground::BlockMovement(Player* plr)
|
|||||||
void Battleground::RemovePlayerAtLeave(const uint64& guid, bool Transport, bool SendPacket)
|
void Battleground::RemovePlayerAtLeave(const uint64& guid, bool Transport, bool SendPacket)
|
||||||
{
|
{
|
||||||
uint32 team = GetPlayerTeam(guid);
|
uint32 team = GetPlayerTeam(guid);
|
||||||
|
bool participant = false;
|
||||||
|
// Remove from lists/maps
|
||||||
|
BattlegroundPlayerMap::iterator itr = m_Players.find(guid);
|
||||||
|
if (itr != m_Players.end())
|
||||||
|
{
|
||||||
|
UpdatePlayersCountByTeam(team, true); // -1 player
|
||||||
|
m_Players.erase(itr);
|
||||||
|
// check if the player was a participant of the match, or only entered through gm command (goname)
|
||||||
|
participant = true;
|
||||||
|
}
|
||||||
|
|
||||||
BattlegroundScoreMap::iterator itr2 = m_PlayerScores.find(guid);
|
BattlegroundScoreMap::iterator itr2 = m_PlayerScores.find(guid);
|
||||||
if (itr2 != m_PlayerScores.end())
|
if (itr2 != m_PlayerScores.end())
|
||||||
@@ -895,18 +905,7 @@ void Battleground::RemovePlayerAtLeave(const uint64& guid, bool Transport, bool
|
|||||||
plr->SpawnCorpseBones();
|
plr->SpawnCorpseBones();
|
||||||
}
|
}
|
||||||
|
|
||||||
RemovePlayer(plr, guid); // BG subclass specific code
|
RemovePlayer(plr, guid, team); // BG subclass specific code
|
||||||
|
|
||||||
bool participant = false;
|
|
||||||
// Remove from lists/maps
|
|
||||||
BattlegroundPlayerMap::iterator itr = m_Players.find(guid);
|
|
||||||
if (itr != m_Players.end())
|
|
||||||
{
|
|
||||||
UpdatePlayersCountByTeam(team, true); // -1 player
|
|
||||||
m_Players.erase(itr);
|
|
||||||
// check if the player was a participant of the match, or only entered through gm command (goname)
|
|
||||||
participant = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (participant) // if the player was a match participant, remove auras, calc rating, update queue
|
if (participant) // if the player was a match participant, remove auras, calc rating, update queue
|
||||||
{
|
{
|
||||||
@@ -1191,7 +1190,7 @@ void Battleground::EventPlayerLoggedOut(Player* player)
|
|||||||
if (GetStatus() == STATUS_IN_PROGRESS)
|
if (GetStatus() == STATUS_IN_PROGRESS)
|
||||||
{
|
{
|
||||||
// drop flag and handle other cleanups
|
// drop flag and handle other cleanups
|
||||||
RemovePlayer(player, player->GetGUID());
|
RemovePlayer(player, player->GetGUID(), GetPlayerTeam(player->GetGUID()));
|
||||||
|
|
||||||
// 1 player is logging out, if it is the last, then end arena!
|
// 1 player is logging out, if it is the last, then end arena!
|
||||||
if (isArena())
|
if (isArena())
|
||||||
|
|||||||
@@ -591,7 +591,7 @@ class Battleground
|
|||||||
// Scorekeeping
|
// Scorekeeping
|
||||||
BattlegroundScoreMap m_PlayerScores; // Player scores
|
BattlegroundScoreMap m_PlayerScores; // Player scores
|
||||||
// must be implemented in BG subclass
|
// must be implemented in BG subclass
|
||||||
virtual void RemovePlayer(Player* /*player*/, uint64 /*guid*/) {}
|
virtual void RemovePlayer(Player* /*player*/, uint64 /*guid*/, uint32 /*team*/) {}
|
||||||
|
|
||||||
// Player lists, those need to be accessible by inherited classes
|
// Player lists, those need to be accessible by inherited classes
|
||||||
BattlegroundPlayerMap m_Players;
|
BattlegroundPlayerMap m_Players;
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ void BattlegroundAA::AddPlayer(Player *plr)
|
|||||||
m_PlayerScores[plr->GetGUID()] = sc;
|
m_PlayerScores[plr->GetGUID()] = sc;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BattlegroundAA::RemovePlayer(Player* /*plr*/, uint64 /*guid*/)
|
void BattlegroundAA::RemovePlayer(Player* /*plr*/, uint64 /*guid*/, uint32 /*team*/)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ class BattlegroundAA : public Battleground
|
|||||||
virtual void StartingEventCloseDoors();
|
virtual void StartingEventCloseDoors();
|
||||||
virtual void StartingEventOpenDoors();
|
virtual void StartingEventOpenDoors();
|
||||||
|
|
||||||
void RemovePlayer(Player *plr, uint64 guid);
|
void RemovePlayer(Player *plr, uint64 guid, uint32 team);
|
||||||
void HandleAreaTrigger(Player *Source, uint32 Trigger);
|
void HandleAreaTrigger(Player *Source, uint32 Trigger);
|
||||||
bool SetupBattleground();
|
bool SetupBattleground();
|
||||||
void HandleKillPlayer(Player* player, Player* killer);
|
void HandleKillPlayer(Player* player, Player* killer);
|
||||||
|
|||||||
@@ -215,7 +215,7 @@ void BattlegroundAB::AddPlayer(Player *plr)
|
|||||||
m_PlayerScores[plr->GetGUID()] = sc;
|
m_PlayerScores[plr->GetGUID()] = sc;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BattlegroundAB::RemovePlayer(Player* /*plr*/, uint64 /*guid*/)
|
void BattlegroundAB::RemovePlayer(Player* /*plr*/, uint64 /*guid*/, uint32 /*team*/)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -251,7 +251,7 @@ class BattlegroundAB : public Battleground
|
|||||||
void AddPlayer(Player *plr);
|
void AddPlayer(Player *plr);
|
||||||
virtual void StartingEventCloseDoors();
|
virtual void StartingEventCloseDoors();
|
||||||
virtual void StartingEventOpenDoors();
|
virtual void StartingEventOpenDoors();
|
||||||
void RemovePlayer(Player *plr, uint64 guid);
|
void RemovePlayer(Player *plr, uint64 guid, uint32 team);
|
||||||
void HandleAreaTrigger(Player *Source, uint32 Trigger);
|
void HandleAreaTrigger(Player *Source, uint32 Trigger);
|
||||||
virtual bool SetupBattleground();
|
virtual bool SetupBattleground();
|
||||||
virtual void Reset();
|
virtual void Reset();
|
||||||
|
|||||||
@@ -475,7 +475,7 @@ void BattlegroundAV::EndBattleground(uint32 winner)
|
|||||||
Battleground::EndBattleground(winner);
|
Battleground::EndBattleground(winner);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BattlegroundAV::RemovePlayer(Player* plr, uint64 /*guid*/)
|
void BattlegroundAV::RemovePlayer(Player* plr, uint64 /*guid*/, uint32 /*team*/)
|
||||||
{
|
{
|
||||||
if (!plr)
|
if (!plr)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1546,7 +1546,7 @@ class BattlegroundAV : public Battleground
|
|||||||
virtual void StartingEventCloseDoors();
|
virtual void StartingEventCloseDoors();
|
||||||
virtual void StartingEventOpenDoors();
|
virtual void StartingEventOpenDoors();
|
||||||
|
|
||||||
void RemovePlayer(Player *plr, uint64 guid);
|
void RemovePlayer(Player *plr, uint64 guid, uint32 team);
|
||||||
void HandleAreaTrigger(Player *Source, uint32 Trigger);
|
void HandleAreaTrigger(Player *Source, uint32 Trigger);
|
||||||
bool SetupBattleground();
|
bool SetupBattleground();
|
||||||
virtual void ResetBGSubclass();
|
virtual void ResetBGSubclass();
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ void BattlegroundBE::AddPlayer(Player *plr)
|
|||||||
UpdateArenaWorldState();
|
UpdateArenaWorldState();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BattlegroundBE::RemovePlayer(Player* /*plr*/, uint64 /*guid*/)
|
void BattlegroundBE::RemovePlayer(Player* /*plr*/, uint64 /*guid*/, uint32 /*team*/)
|
||||||
{
|
{
|
||||||
if (GetStatus() == STATUS_WAIT_LEAVE)
|
if (GetStatus() == STATUS_WAIT_LEAVE)
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ class BattlegroundBE : public Battleground
|
|||||||
virtual void StartingEventCloseDoors();
|
virtual void StartingEventCloseDoors();
|
||||||
virtual void StartingEventOpenDoors();
|
virtual void StartingEventOpenDoors();
|
||||||
|
|
||||||
void RemovePlayer(Player *plr, uint64 guid);
|
void RemovePlayer(Player *plr, uint64 guid, uint32 team);
|
||||||
void HandleAreaTrigger(Player *Source, uint32 Trigger);
|
void HandleAreaTrigger(Player *Source, uint32 Trigger);
|
||||||
bool SetupBattleground();
|
bool SetupBattleground();
|
||||||
virtual void Reset();
|
virtual void Reset();
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ void BattlegroundDS::AddPlayer(Player *plr)
|
|||||||
UpdateArenaWorldState();
|
UpdateArenaWorldState();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BattlegroundDS::RemovePlayer(Player* /*plr*/, uint64 /*guid*/)
|
void BattlegroundDS::RemovePlayer(Player* /*plr*/, uint64 /*guid*/, uint32 /*team*/)
|
||||||
{
|
{
|
||||||
if (GetStatus() == STATUS_WAIT_LEAVE)
|
if (GetStatus() == STATUS_WAIT_LEAVE)
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ class BattlegroundDS : public Battleground
|
|||||||
virtual void StartingEventCloseDoors();
|
virtual void StartingEventCloseDoors();
|
||||||
virtual void StartingEventOpenDoors();
|
virtual void StartingEventOpenDoors();
|
||||||
|
|
||||||
void RemovePlayer(Player *plr, uint64 guid);
|
void RemovePlayer(Player *plr, uint64 guid, uint32 team);
|
||||||
void HandleAreaTrigger(Player *Source, uint32 Trigger);
|
void HandleAreaTrigger(Player *Source, uint32 Trigger);
|
||||||
bool SetupBattleground();
|
bool SetupBattleground();
|
||||||
virtual void Reset();
|
virtual void Reset();
|
||||||
|
|||||||
@@ -343,7 +343,7 @@ void BattlegroundEY::AddPlayer(Player *plr)
|
|||||||
m_PlayerScores[plr->GetGUID()] = sc;
|
m_PlayerScores[plr->GetGUID()] = sc;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BattlegroundEY::RemovePlayer(Player *plr, uint64 guid)
|
void BattlegroundEY::RemovePlayer(Player *plr, uint64 guid, uint32 /*team*/)
|
||||||
{
|
{
|
||||||
// sometimes flag aura not removed :(
|
// sometimes flag aura not removed :(
|
||||||
for (int j = EY_POINTS_MAX; j >= 0; --j)
|
for (int j = EY_POINTS_MAX; j >= 0; --j)
|
||||||
|
|||||||
@@ -348,7 +348,7 @@ class BattlegroundEY : public Battleground
|
|||||||
void RespawnFlag(bool send_message);
|
void RespawnFlag(bool send_message);
|
||||||
void RespawnFlagAfterDrop();
|
void RespawnFlagAfterDrop();
|
||||||
|
|
||||||
void RemovePlayer(Player *plr, uint64 guid);
|
void RemovePlayer(Player *plr, uint64 guid, uint32 team);
|
||||||
void HandleBuffUse(uint64 const& buff_guid);
|
void HandleBuffUse(uint64 const& buff_guid);
|
||||||
void HandleAreaTrigger(Player *Source, uint32 Trigger);
|
void HandleAreaTrigger(Player *Source, uint32 Trigger);
|
||||||
void HandleKillPlayer(Player* player, Player* killer);
|
void HandleKillPlayer(Player* player, Player* killer);
|
||||||
|
|||||||
@@ -310,7 +310,7 @@ void BattlegroundIC::AddPlayer(Player *plr)
|
|||||||
SendTransportInit(plr);
|
SendTransportInit(plr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BattlegroundIC::RemovePlayer(Player* plr, uint64 /*guid*/)
|
void BattlegroundIC::RemovePlayer(Player* plr, uint64 /*guid*/, uint32 /*team*/)
|
||||||
{
|
{
|
||||||
plr->RemoveAura(SPELL_QUARRY);
|
plr->RemoveAura(SPELL_QUARRY);
|
||||||
plr->RemoveAura(SPELL_OIL_REFINERY);
|
plr->RemoveAura(SPELL_OIL_REFINERY);
|
||||||
|
|||||||
@@ -869,7 +869,7 @@ class BattlegroundIC : public Battleground
|
|||||||
virtual void StartingEventCloseDoors();
|
virtual void StartingEventCloseDoors();
|
||||||
virtual void StartingEventOpenDoors();
|
virtual void StartingEventOpenDoors();
|
||||||
|
|
||||||
void RemovePlayer(Player *plr, uint64 guid);
|
void RemovePlayer(Player *plr, uint64 guid, uint32 team);
|
||||||
void HandleAreaTrigger(Player *Source, uint32 Trigger);
|
void HandleAreaTrigger(Player *Source, uint32 Trigger);
|
||||||
bool SetupBattleground();
|
bool SetupBattleground();
|
||||||
void SpawnLeader(uint32 teamid);
|
void SpawnLeader(uint32 teamid);
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ void BattlegroundNA::AddPlayer(Player *plr)
|
|||||||
UpdateArenaWorldState();
|
UpdateArenaWorldState();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BattlegroundNA::RemovePlayer(Player* /*plr*/, uint64 /*guid*/)
|
void BattlegroundNA::RemovePlayer(Player* /*plr*/, uint64 /*guid*/, uint32 /*team*/)
|
||||||
{
|
{
|
||||||
if (GetStatus() == STATUS_WAIT_LEAVE)
|
if (GetStatus() == STATUS_WAIT_LEAVE)
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ class BattlegroundNA : public Battleground
|
|||||||
virtual void StartingEventCloseDoors();
|
virtual void StartingEventCloseDoors();
|
||||||
virtual void StartingEventOpenDoors();
|
virtual void StartingEventOpenDoors();
|
||||||
|
|
||||||
void RemovePlayer(Player *plr, uint64 guid);
|
void RemovePlayer(Player *plr, uint64 guid, uint32 team);
|
||||||
void HandleAreaTrigger(Player *Source, uint32 Trigger);
|
void HandleAreaTrigger(Player *Source, uint32 Trigger);
|
||||||
bool SetupBattleground();
|
bool SetupBattleground();
|
||||||
virtual void Reset();
|
virtual void Reset();
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ void BattlegroundRB::AddPlayer(Player *plr)
|
|||||||
m_PlayerScores[plr->GetGUID()] = sc;
|
m_PlayerScores[plr->GetGUID()] = sc;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BattlegroundRB::RemovePlayer(Player* /*plr*/, uint64 /*guid*/)
|
void BattlegroundRB::RemovePlayer(Player* /*plr*/, uint64 /*guid*/, uint32 /*team*/)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ class BattlegroundRB : public Battleground
|
|||||||
virtual void StartingEventCloseDoors();
|
virtual void StartingEventCloseDoors();
|
||||||
virtual void StartingEventOpenDoors();
|
virtual void StartingEventOpenDoors();
|
||||||
|
|
||||||
void RemovePlayer(Player *plr, uint64 guid);
|
void RemovePlayer(Player *plr, uint64 guid, uint32 team);
|
||||||
void HandleAreaTrigger(Player *Source, uint32 Trigger);
|
void HandleAreaTrigger(Player *Source, uint32 Trigger);
|
||||||
|
|
||||||
/* Scorekeeping */
|
/* Scorekeeping */
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ void BattlegroundRL::AddPlayer(Player *plr)
|
|||||||
UpdateArenaWorldState();
|
UpdateArenaWorldState();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BattlegroundRL::RemovePlayer(Player* /*plr*/, uint64 /*guid*/)
|
void BattlegroundRL::RemovePlayer(Player* /*plr*/, uint64 /*guid*/, uint32 /*team*/)
|
||||||
{
|
{
|
||||||
if (GetStatus() == STATUS_WAIT_LEAVE)
|
if (GetStatus() == STATUS_WAIT_LEAVE)
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ class BattlegroundRL : public Battleground
|
|||||||
virtual void StartingEventCloseDoors();
|
virtual void StartingEventCloseDoors();
|
||||||
virtual void StartingEventOpenDoors();
|
virtual void StartingEventOpenDoors();
|
||||||
|
|
||||||
void RemovePlayer(Player *plr, uint64 guid);
|
void RemovePlayer(Player *plr, uint64 guid, uint32 team);
|
||||||
void HandleAreaTrigger(Player *Source, uint32 Trigger);
|
void HandleAreaTrigger(Player *Source, uint32 Trigger);
|
||||||
bool SetupBattleground();
|
bool SetupBattleground();
|
||||||
void HandleKillPlayer(Player* player, Player* killer);
|
void HandleKillPlayer(Player* player, Player* killer);
|
||||||
|
|||||||
@@ -131,7 +131,7 @@ void BattlegroundRV::AddPlayer(Player *plr)
|
|||||||
UpdateWorldState(BG_RV_WORLD_STATE_H, GetAlivePlayersCountByTeam(HORDE));
|
UpdateWorldState(BG_RV_WORLD_STATE_H, GetAlivePlayersCountByTeam(HORDE));
|
||||||
}
|
}
|
||||||
|
|
||||||
void BattlegroundRV::RemovePlayer(Player* /*plr*/, uint64 /*guid*/)
|
void BattlegroundRV::RemovePlayer(Player* /*plr*/, uint64 /*guid*/, uint32 /*team*/)
|
||||||
{
|
{
|
||||||
if (GetStatus() == STATUS_WAIT_LEAVE)
|
if (GetStatus() == STATUS_WAIT_LEAVE)
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -118,7 +118,7 @@ class BattlegroundRV : public Battleground
|
|||||||
virtual void Reset();
|
virtual void Reset();
|
||||||
virtual void FillInitialWorldStates(WorldPacket &d);
|
virtual void FillInitialWorldStates(WorldPacket &d);
|
||||||
|
|
||||||
void RemovePlayer(Player *plr, uint64 guid);
|
void RemovePlayer(Player *plr, uint64 guid, uint32 team);
|
||||||
void HandleAreaTrigger(Player *Source, uint32 Trigger);
|
void HandleAreaTrigger(Player *Source, uint32 Trigger);
|
||||||
bool SetupBattleground();
|
bool SetupBattleground();
|
||||||
void HandleKillPlayer(Player* player, Player* killer);
|
void HandleKillPlayer(Player* player, Player* killer);
|
||||||
|
|||||||
@@ -465,7 +465,7 @@ void BattlegroundSA::AddPlayer(Player *plr)
|
|||||||
m_PlayerScores[plr->GetGUID()] = sc;
|
m_PlayerScores[plr->GetGUID()] = sc;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BattlegroundSA::RemovePlayer(Player* /*plr*/, uint64 /*guid*/)
|
void BattlegroundSA::RemovePlayer(Player* /*plr*/, uint64 /*guid*/, uint32 /*team*/)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -481,7 +481,7 @@ class BattlegroundSA : public Battleground
|
|||||||
void EndBattleground(uint32 winner);
|
void EndBattleground(uint32 winner);
|
||||||
|
|
||||||
/// CAlled when a player leave battleground
|
/// CAlled when a player leave battleground
|
||||||
void RemovePlayer(Player *plr, uint64 guid);
|
void RemovePlayer(Player *plr, uint64 guid, uint32 team);
|
||||||
void HandleAreaTrigger(Player *Source, uint32 Trigger);
|
void HandleAreaTrigger(Player *Source, uint32 Trigger);
|
||||||
|
|
||||||
/* Scorekeeping */
|
/* Scorekeeping */
|
||||||
|
|||||||
@@ -559,7 +559,7 @@ void BattlegroundWS::EventPlayerClickedOnFlag(Player *Source, GameObject* target
|
|||||||
Source->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT);
|
Source->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BattlegroundWS::RemovePlayer(Player *plr, uint64 guid)
|
void BattlegroundWS::RemovePlayer(Player *plr, uint64 guid, uint32 /*team*/)
|
||||||
{
|
{
|
||||||
// sometimes flag aura not removed :(
|
// sometimes flag aura not removed :(
|
||||||
if (IsAllianceFlagPickedup() && m_FlagKeepers[BG_TEAM_ALLIANCE] == guid)
|
if (IsAllianceFlagPickedup() && m_FlagKeepers[BG_TEAM_ALLIANCE] == guid)
|
||||||
|
|||||||
@@ -190,7 +190,7 @@ class BattlegroundWS : public Battleground
|
|||||||
virtual void EventPlayerClickedOnFlag(Player *Source, GameObject* target_obj);
|
virtual void EventPlayerClickedOnFlag(Player *Source, GameObject* target_obj);
|
||||||
virtual void EventPlayerCapturedFlag(Player *Source);
|
virtual void EventPlayerCapturedFlag(Player *Source);
|
||||||
|
|
||||||
void RemovePlayer(Player *plr, uint64 guid);
|
void RemovePlayer(Player *plr, uint64 guid, uint32 team);
|
||||||
void HandleAreaTrigger(Player *Source, uint32 Trigger);
|
void HandleAreaTrigger(Player *Source, uint32 Trigger);
|
||||||
void HandleKillPlayer(Player* player, Player* killer);
|
void HandleKillPlayer(Player* player, Player* killer);
|
||||||
bool SetupBattleground();
|
bool SetupBattleground();
|
||||||
|
|||||||
Reference in New Issue
Block a user