mirror of
https://github.com/mangosfour/server.git
synced 2025-12-15 01:37:00 +00:00
[9185] Auto-leave player at login back to bg/arena when bg/arena finished.
This commit is contained in:
parent
1adcf67349
commit
7272b52daf
2 changed files with 9 additions and 2 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue