aboutsummaryrefslogtreecommitdiff
path: root/src/game/BattleGround.cpp
diff options
context:
space:
mode:
authormegamage <none@none>2009-02-10 01:16:16 -0600
committermegamage <none@none>2009-02-10 01:16:16 -0600
commit029554d4e30ea654ac1a4f5362c60d946a80d04f (patch)
tree970a32f5369752fe8fc4b6a287521b64432ac3d5 /src/game/BattleGround.cpp
parent58374f87b4b3eb2f92dfa8f28969b187a544e6b2 (diff)
[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 Author: GriffonHeart --HG-- branch : trunk
Diffstat (limited to 'src/game/BattleGround.cpp')
-rw-r--r--src/game/BattleGround.cpp29
1 files changed, 26 insertions, 3 deletions
diff --git a/src/game/BattleGround.cpp b/src/game/BattleGround.cpp
index 221d93323c8..49d5224c223 100644
--- a/src/game/BattleGround.cpp
+++ b/src/game/BattleGround.cpp
@@ -165,8 +165,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())
{
@@ -181,7 +179,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)
@@ -1535,6 +1533,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;