[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); 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()); BattleGroundQueueTypeId bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(currentBg->GetTypeID(), currentBg->GetArenaType());
AddBattleGroundQueueId(bgQueueTypeId); AddBattleGroundQueueId(bgQueueTypeId);
@ -14717,6 +14719,11 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder )
} }
else else
{ {
// leave bg
if (player_at_bg)
currentBg->RemovePlayerAtLeave(GetGUID(), false, true);
// move to bg enter point
const WorldLocation& _loc = GetBattleGroundEntryPoint(); const WorldLocation& _loc = GetBattleGroundEntryPoint();
SetLocationMapId(_loc.mapid); SetLocationMapId(_loc.mapid);
Relocate(_loc.coord_x, _loc.coord_y, _loc.coord_z, _loc.orientation); Relocate(_loc.coord_x, _loc.coord_y, _loc.coord_z, _loc.orientation);

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__ #ifndef __REVISION_NR_H__
#define __REVISION_NR_H__ #define __REVISION_NR_H__
#define REVISION_NR "9184" #define REVISION_NR "9185"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__