Core/Battleground: fix re-enter into battleground after disconnect
This commit is contained in:
@@ -1245,8 +1245,6 @@ void Battleground::EventPlayerLoggedOut(Player* player)
|
|||||||
if (GetAlivePlayersCountByTeam(player->GetTeam()) <= 1 && GetPlayersCountByTeam(GetOtherTeam(player->GetTeam())))
|
if (GetAlivePlayersCountByTeam(player->GetTeam()) <= 1 && GetPlayersCountByTeam(GetOtherTeam(player->GetTeam())))
|
||||||
EndBattleground(GetOtherTeam(player->GetTeam()));
|
EndBattleground(GetOtherTeam(player->GetTeam()));
|
||||||
}
|
}
|
||||||
|
|
||||||
player->LeaveBattleground();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// This method should be called only once ... it adds pointer to queue
|
// This method should be called only once ... it adds pointer to queue
|
||||||
|
|||||||
@@ -16659,10 +16659,10 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
|
|||||||
|
|
||||||
if (player_at_bg && currentBg->GetStatus() != STATUS_WAIT_LEAVE)
|
if (player_at_bg && currentBg->GetStatus() != STATUS_WAIT_LEAVE)
|
||||||
{
|
{
|
||||||
BattlegroundQueueTypeId bgQueueTypeId = sBattlegroundMgr->BGQueueTypeId(currentBg->GetTypeID(true), currentBg->GetArenaType());
|
BattlegroundQueueTypeId bgQueueTypeId = sBattlegroundMgr->BGQueueTypeId(currentBg->GetTypeID(), currentBg->GetArenaType());
|
||||||
AddBattlegroundQueueId(bgQueueTypeId);
|
AddBattlegroundQueueId(bgQueueTypeId);
|
||||||
|
|
||||||
m_bgData.bgTypeID = currentBg->GetTypeID(true);
|
m_bgData.bgTypeID = currentBg->GetTypeID();
|
||||||
|
|
||||||
//join player to battleground group
|
//join player to battleground group
|
||||||
currentBg->EventPlayerLoggedIn(this);
|
currentBg->EventPlayerLoggedIn(this);
|
||||||
@@ -16834,7 +16834,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// if the player is in an instance and it has been reset in the meantime teleport him to the entrance
|
// if the player is in an instance and it has been reset in the meantime teleport him to the entrance
|
||||||
if (instanceId && !sInstanceSaveMgr->GetInstanceSave(instanceId))
|
if (instanceId && !sInstanceSaveMgr->GetInstanceSave(instanceId) && !map->IsBattlegroundOrArena())
|
||||||
{
|
{
|
||||||
AreaTrigger const* at = sObjectMgr->GetMapEntranceTrigger(mapId);
|
AreaTrigger const* at = sObjectMgr->GetMapEntranceTrigger(mapId);
|
||||||
if (at)
|
if (at)
|
||||||
|
|||||||
@@ -124,9 +124,17 @@ Map* MapInstanced::CreateInstanceForPlayer(const uint32 mapId, Player* player)
|
|||||||
// the instance id is set in battlegroundid
|
// the instance id is set in battlegroundid
|
||||||
NewInstanceId = player->GetBattlegroundId();
|
NewInstanceId = player->GetBattlegroundId();
|
||||||
if (!NewInstanceId) return NULL;
|
if (!NewInstanceId) return NULL;
|
||||||
map = FindInstanceMap(NewInstanceId);
|
map = sMapMgr->FindMap(mapId, NewInstanceId);
|
||||||
if (!map)
|
if (!map)
|
||||||
map = CreateBattleground(NewInstanceId, player->GetBattleground());
|
{
|
||||||
|
if (Battleground* bg = player->GetBattleground())
|
||||||
|
map = CreateBattleground(NewInstanceId, bg);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
player->TeleportToBGEntryPoint();
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user