[7255] Allows saving characters in Battle Grounds.

* Now player can join to BG after logout during 5 minutes, if BG in progress.
* All players after server crash or restart should appear at the battlemaster

Signed-off-by: VladimirMangos <vladimir@getmangos.com>
This commit is contained in:
GriffonHeart 2009-02-09 16:07:16 +03:00 committed by VladimirMangos
parent 8af53064eb
commit 75121a5823
11 changed files with 162 additions and 52 deletions

View file

@ -161,8 +161,6 @@ void BattleGround::Update(uint32 diff)
m_RemovedPlayers.clear();
}
// this code isn't efficient and its idea isn't implemented yet
/* offline players are removed from battleground in worldsession::LogoutPlayer()
// remove offline players from bg after ~5 minutes
if(GetPlayersSize())
{
@ -177,7 +175,7 @@ void BattleGround::Update(uint32 diff)
if(itr->second.LastOnlineTime >= MAX_OFFLINE_TIME) // 5 minutes
m_RemovedPlayers[itr->first] = 1; // add to remove list (BG)
}
}*/
}
m_LastResurrectTime += diff;
if (m_LastResurrectTime >= RESURRECTION_INTERVAL)
@ -1495,6 +1493,31 @@ uint32 BattleGround::GetPlayerTeam(uint64 guid)
return 0;
}
bool BattleGround::IsPlayerInBattleGround(uint64 guid)
{
std::map<uint64, BattleGroundPlayer>::const_iterator itr = m_Players.find(guid);
if(itr!=m_Players.end())
return true;
return false;
}
void BattleGround::PlayerRelogin(Player* plr)
{
if(GetStatus() != STATUS_WAIT_LEAVE)
return;
WorldPacket data;
uint32 bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(GetTypeID(), GetArenaType());
BlockMovement(plr);
sBattleGroundMgr.BuildPvpLogDataPacket(&data, this);
plr->GetSession()->SendPacket(&data);
sBattleGroundMgr.BuildBattleGroundStatusPacket(&data, this, plr->GetTeam(), plr->GetBattleGroundQueueIndex(bgQueueTypeId), STATUS_IN_PROGRESS, TIME_TO_AUTOREMOVE, GetStartTime());
plr->GetSession()->SendPacket(&data);
}
uint32 BattleGround::GetAlivePlayersCountByTeam(uint32 Team) const
{
int count = 0;