Core/Battleground: fix re-enter into battleground after disconnect

This commit is contained in:
Wilds
2012-01-04 11:52:13 +01:00
parent ced346076b
commit 2a38902d2e
3 changed files with 13 additions and 7 deletions
@@ -1245,8 +1245,6 @@ void Battleground::EventPlayerLoggedOut(Player* player)
if (GetAlivePlayersCountByTeam(player->GetTeam()) <= 1 && GetPlayersCountByTeam(GetOtherTeam(player->GetTeam())))
EndBattleground(GetOtherTeam(player->GetTeam()));
}
player->LeaveBattleground();
}
// This method should be called only once ... it adds pointer to queue
+3 -3
View File
@@ -16659,10 +16659,10 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
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);
m_bgData.bgTypeID = currentBg->GetTypeID(true);
m_bgData.bgTypeID = currentBg->GetTypeID();
//join player to battleground group
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 (instanceId && !sInstanceSaveMgr->GetInstanceSave(instanceId))
if (instanceId && !sInstanceSaveMgr->GetInstanceSave(instanceId) && !map->IsBattlegroundOrArena())
{
AreaTrigger const* at = sObjectMgr->GetMapEntranceTrigger(mapId);
if (at)
+10 -2
View File
@@ -124,9 +124,17 @@ Map* MapInstanced::CreateInstanceForPlayer(const uint32 mapId, Player* player)
// the instance id is set in battlegroundid
NewInstanceId = player->GetBattlegroundId();
if (!NewInstanceId) return NULL;
map = FindInstanceMap(NewInstanceId);
map = sMapMgr->FindMap(mapId, NewInstanceId);
if (!map)
map = CreateBattleground(NewInstanceId, player->GetBattleground());
{
if (Battleground* bg = player->GetBattleground())
map = CreateBattleground(NewInstanceId, bg);
else
{
player->TeleportToBGEntryPoint();
return NULL;
}
}
}
else
{