Auto-leave player at login back to bg/arena when bg/arena finished. by VladimirMangos.
--HG-- branch : trunk
This commit is contained in:
+7
-1
@@ -15577,7 +15577,9 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder )
|
|||||||
if(m_bgData.bgInstanceID) //saved in BattleGround
|
if(m_bgData.bgInstanceID) //saved in BattleGround
|
||||||
currentBg = sBattleGroundMgr.GetBattleGround(m_bgData.bgInstanceID, BATTLEGROUND_TYPE_NONE);
|
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 = sBattleGroundMgr.BGQueueTypeId(currentBg->GetTypeID(), currentBg->GetArenaType());
|
BattleGroundQueueTypeId bgQueueTypeId = sBattleGroundMgr.BGQueueTypeId(currentBg->GetTypeID(), currentBg->GetArenaType());
|
||||||
AddBattleGroundQueueId(bgQueueTypeId);
|
AddBattleGroundQueueId(bgQueueTypeId);
|
||||||
@@ -15593,6 +15595,10 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder )
|
|||||||
// Bg was not found - go to Entry Point
|
// Bg was not found - go to Entry Point
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
// leave bg
|
||||||
|
if (player_at_bg)
|
||||||
|
currentBg->RemovePlayerAtLeave(GetGUID(), false, true);
|
||||||
|
|
||||||
// Do not look for instance if bg not found
|
// Do not look for instance if bg not found
|
||||||
const WorldLocation& _loc = GetBattleGroundEntryPoint();
|
const WorldLocation& _loc = GetBattleGroundEntryPoint();
|
||||||
mapId = _loc.GetMapId(); instanceId = 0;
|
mapId = _loc.GetMapId(); instanceId = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user