[9185] Auto-leave player at login back to bg/arena when bg/arena finished.

This commit is contained in:
VladimirMangos 2010-01-16 03:08:56 +03:00
parent 1adcf67349
commit 7272b52daf
2 changed files with 9 additions and 2 deletions

View file

@ -14702,7 +14702,9 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder )
{
BattleGround *currentBg = sBattleGroundMgr.GetBattleGround(m_bgData.bgInstanceID, BATTLEGROUND_TYPE_NONE);
if(currentBg && currentBg->IsPlayerInBattleGround(GetGUID()))
bool player_at_bg = currentBg && currentBg->IsPlayerInBattleGround(GetGUID());
if(player_at_bg && currentBg->GetStatus() != STATUS_WAIT_LEAVE)
{
BattleGroundQueueTypeId bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(currentBg->GetTypeID(), currentBg->GetArenaType());
AddBattleGroundQueueId(bgQueueTypeId);
@ -14717,6 +14719,11 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder )
}
else
{
// leave bg
if (player_at_bg)
currentBg->RemovePlayerAtLeave(GetGUID(), false, true);
// move to bg enter point
const WorldLocation& _loc = GetBattleGroundEntryPoint();
SetLocationMapId(_loc.mapid);
Relocate(_loc.coord_x, _loc.coord_y, _loc.coord_z, _loc.orientation);