mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-20 09:17:36 +01:00
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)
|
||||
{
|
||||
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);
|
||||
if (itr2 != m_PlayerScores.end())
|
||||
@@ -895,18 +905,7 @@ void Battleground::RemovePlayerAtLeave(const uint64& guid, bool Transport, bool
|
||||
plr->SpawnCorpseBones();
|
||||
}
|
||||
|
||||
RemovePlayer(plr, guid); // 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;
|
||||
}
|
||||
RemovePlayer(plr, guid, team); // BG subclass specific code
|
||||
|
||||
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)
|
||||
{
|
||||
// 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!
|
||||
if (isArena())
|
||||
|
||||
@@ -591,7 +591,7 @@ class Battleground
|
||||
// Scorekeeping
|
||||
BattlegroundScoreMap m_PlayerScores; // Player scores
|
||||
// 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
|
||||
BattlegroundPlayerMap m_Players;
|
||||
|
||||
@@ -62,7 +62,7 @@ void BattlegroundAA::AddPlayer(Player *plr)
|
||||
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 StartingEventOpenDoors();
|
||||
|
||||
void RemovePlayer(Player *plr, uint64 guid);
|
||||
void RemovePlayer(Player *plr, uint64 guid, uint32 team);
|
||||
void HandleAreaTrigger(Player *Source, uint32 Trigger);
|
||||
bool SetupBattleground();
|
||||
void HandleKillPlayer(Player* player, Player* killer);
|
||||
|
||||
@@ -215,7 +215,7 @@ void BattlegroundAB::AddPlayer(Player *plr)
|
||||
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);
|
||||
virtual void StartingEventCloseDoors();
|
||||
virtual void StartingEventOpenDoors();
|
||||
void RemovePlayer(Player *plr, uint64 guid);
|
||||
void RemovePlayer(Player *plr, uint64 guid, uint32 team);
|
||||
void HandleAreaTrigger(Player *Source, uint32 Trigger);
|
||||
virtual bool SetupBattleground();
|
||||
virtual void Reset();
|
||||
|
||||
@@ -475,7 +475,7 @@ void BattlegroundAV::EndBattleground(uint32 winner)
|
||||
Battleground::EndBattleground(winner);
|
||||
}
|
||||
|
||||
void BattlegroundAV::RemovePlayer(Player* plr, uint64 /*guid*/)
|
||||
void BattlegroundAV::RemovePlayer(Player* plr, uint64 /*guid*/, uint32 /*team*/)
|
||||
{
|
||||
if (!plr)
|
||||
{
|
||||
|
||||
@@ -1546,7 +1546,7 @@ class BattlegroundAV : public Battleground
|
||||
virtual void StartingEventCloseDoors();
|
||||
virtual void StartingEventOpenDoors();
|
||||
|
||||
void RemovePlayer(Player *plr, uint64 guid);
|
||||
void RemovePlayer(Player *plr, uint64 guid, uint32 team);
|
||||
void HandleAreaTrigger(Player *Source, uint32 Trigger);
|
||||
bool SetupBattleground();
|
||||
virtual void ResetBGSubclass();
|
||||
|
||||
@@ -87,7 +87,7 @@ void BattlegroundBE::AddPlayer(Player *plr)
|
||||
UpdateArenaWorldState();
|
||||
}
|
||||
|
||||
void BattlegroundBE::RemovePlayer(Player* /*plr*/, uint64 /*guid*/)
|
||||
void BattlegroundBE::RemovePlayer(Player* /*plr*/, uint64 /*guid*/, uint32 /*team*/)
|
||||
{
|
||||
if (GetStatus() == STATUS_WAIT_LEAVE)
|
||||
return;
|
||||
|
||||
@@ -62,7 +62,7 @@ class BattlegroundBE : public Battleground
|
||||
virtual void StartingEventCloseDoors();
|
||||
virtual void StartingEventOpenDoors();
|
||||
|
||||
void RemovePlayer(Player *plr, uint64 guid);
|
||||
void RemovePlayer(Player *plr, uint64 guid, uint32 team);
|
||||
void HandleAreaTrigger(Player *Source, uint32 Trigger);
|
||||
bool SetupBattleground();
|
||||
virtual void Reset();
|
||||
|
||||
@@ -110,7 +110,7 @@ void BattlegroundDS::AddPlayer(Player *plr)
|
||||
UpdateArenaWorldState();
|
||||
}
|
||||
|
||||
void BattlegroundDS::RemovePlayer(Player* /*plr*/, uint64 /*guid*/)
|
||||
void BattlegroundDS::RemovePlayer(Player* /*plr*/, uint64 /*guid*/, uint32 /*team*/)
|
||||
{
|
||||
if (GetStatus() == STATUS_WAIT_LEAVE)
|
||||
return;
|
||||
|
||||
@@ -71,7 +71,7 @@ class BattlegroundDS : public Battleground
|
||||
virtual void StartingEventCloseDoors();
|
||||
virtual void StartingEventOpenDoors();
|
||||
|
||||
void RemovePlayer(Player *plr, uint64 guid);
|
||||
void RemovePlayer(Player *plr, uint64 guid, uint32 team);
|
||||
void HandleAreaTrigger(Player *Source, uint32 Trigger);
|
||||
bool SetupBattleground();
|
||||
virtual void Reset();
|
||||
|
||||
@@ -343,7 +343,7 @@ void BattlegroundEY::AddPlayer(Player *plr)
|
||||
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 :(
|
||||
for (int j = EY_POINTS_MAX; j >= 0; --j)
|
||||
|
||||
@@ -348,7 +348,7 @@ class BattlegroundEY : public Battleground
|
||||
void RespawnFlag(bool send_message);
|
||||
void RespawnFlagAfterDrop();
|
||||
|
||||
void RemovePlayer(Player *plr, uint64 guid);
|
||||
void RemovePlayer(Player *plr, uint64 guid, uint32 team);
|
||||
void HandleBuffUse(uint64 const& buff_guid);
|
||||
void HandleAreaTrigger(Player *Source, uint32 Trigger);
|
||||
void HandleKillPlayer(Player* player, Player* killer);
|
||||
|
||||
@@ -310,7 +310,7 @@ void BattlegroundIC::AddPlayer(Player *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_OIL_REFINERY);
|
||||
|
||||
@@ -869,7 +869,7 @@ class BattlegroundIC : public Battleground
|
||||
virtual void StartingEventCloseDoors();
|
||||
virtual void StartingEventOpenDoors();
|
||||
|
||||
void RemovePlayer(Player *plr, uint64 guid);
|
||||
void RemovePlayer(Player *plr, uint64 guid, uint32 team);
|
||||
void HandleAreaTrigger(Player *Source, uint32 Trigger);
|
||||
bool SetupBattleground();
|
||||
void SpawnLeader(uint32 teamid);
|
||||
|
||||
@@ -84,7 +84,7 @@ void BattlegroundNA::AddPlayer(Player *plr)
|
||||
UpdateArenaWorldState();
|
||||
}
|
||||
|
||||
void BattlegroundNA::RemovePlayer(Player* /*plr*/, uint64 /*guid*/)
|
||||
void BattlegroundNA::RemovePlayer(Player* /*plr*/, uint64 /*guid*/, uint32 /*team*/)
|
||||
{
|
||||
if (GetStatus() == STATUS_WAIT_LEAVE)
|
||||
return;
|
||||
|
||||
@@ -63,7 +63,7 @@ class BattlegroundNA : public Battleground
|
||||
virtual void StartingEventCloseDoors();
|
||||
virtual void StartingEventOpenDoors();
|
||||
|
||||
void RemovePlayer(Player *plr, uint64 guid);
|
||||
void RemovePlayer(Player *plr, uint64 guid, uint32 team);
|
||||
void HandleAreaTrigger(Player *Source, uint32 Trigger);
|
||||
bool SetupBattleground();
|
||||
virtual void Reset();
|
||||
|
||||
@@ -57,7 +57,7 @@ void BattlegroundRB::AddPlayer(Player *plr)
|
||||
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 StartingEventOpenDoors();
|
||||
|
||||
void RemovePlayer(Player *plr, uint64 guid);
|
||||
void RemovePlayer(Player *plr, uint64 guid, uint32 team);
|
||||
void HandleAreaTrigger(Player *Source, uint32 Trigger);
|
||||
|
||||
/* Scorekeeping */
|
||||
|
||||
@@ -84,7 +84,7 @@ void BattlegroundRL::AddPlayer(Player *plr)
|
||||
UpdateArenaWorldState();
|
||||
}
|
||||
|
||||
void BattlegroundRL::RemovePlayer(Player* /*plr*/, uint64 /*guid*/)
|
||||
void BattlegroundRL::RemovePlayer(Player* /*plr*/, uint64 /*guid*/, uint32 /*team*/)
|
||||
{
|
||||
if (GetStatus() == STATUS_WAIT_LEAVE)
|
||||
return;
|
||||
|
||||
@@ -61,7 +61,7 @@ class BattlegroundRL : public Battleground
|
||||
virtual void StartingEventCloseDoors();
|
||||
virtual void StartingEventOpenDoors();
|
||||
|
||||
void RemovePlayer(Player *plr, uint64 guid);
|
||||
void RemovePlayer(Player *plr, uint64 guid, uint32 team);
|
||||
void HandleAreaTrigger(Player *Source, uint32 Trigger);
|
||||
bool SetupBattleground();
|
||||
void HandleKillPlayer(Player* player, Player* killer);
|
||||
|
||||
@@ -131,7 +131,7 @@ void BattlegroundRV::AddPlayer(Player *plr)
|
||||
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)
|
||||
return;
|
||||
|
||||
@@ -118,7 +118,7 @@ class BattlegroundRV : public Battleground
|
||||
virtual void Reset();
|
||||
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);
|
||||
bool SetupBattleground();
|
||||
void HandleKillPlayer(Player* player, Player* killer);
|
||||
|
||||
@@ -465,7 +465,7 @@ void BattlegroundSA::AddPlayer(Player *plr)
|
||||
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);
|
||||
|
||||
/// 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);
|
||||
|
||||
/* Scorekeeping */
|
||||
|
||||
@@ -559,7 +559,7 @@ void BattlegroundWS::EventPlayerClickedOnFlag(Player *Source, GameObject* target
|
||||
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 :(
|
||||
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 EventPlayerCapturedFlag(Player *Source);
|
||||
|
||||
void RemovePlayer(Player *plr, uint64 guid);
|
||||
void RemovePlayer(Player *plr, uint64 guid, uint32 team);
|
||||
void HandleAreaTrigger(Player *Source, uint32 Trigger);
|
||||
void HandleKillPlayer(Player* player, Player* killer);
|
||||
bool SetupBattleground();
|
||||
|
||||
Reference in New Issue
Block a user