aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/game/BattleGround.cpp41
-rw-r--r--src/game/BattleGround.h7
-rw-r--r--src/game/BattleGroundAB.cpp5
-rw-r--r--src/game/BattleGroundAB.h2
-rw-r--r--src/game/BattleGroundBE.cpp5
-rw-r--r--src/game/BattleGroundBE.h2
-rw-r--r--src/game/BattleGroundEY.cpp5
-rw-r--r--src/game/BattleGroundEY.h2
-rw-r--r--src/game/BattleGroundMgr.cpp85
-rw-r--r--src/game/BattleGroundMgr.h2
-rw-r--r--src/game/BattleGroundNA.cpp5
-rw-r--r--src/game/BattleGroundNA.h2
-rw-r--r--src/game/BattleGroundRL.cpp5
-rw-r--r--src/game/BattleGroundRL.h4
-rw-r--r--src/game/BattleGroundWS.cpp5
-rw-r--r--src/game/BattleGroundWS.h2
-rw-r--r--src/game/MovementHandler.cpp1
-rw-r--r--src/game/Player.cpp40
-rw-r--r--src/shared/revision_nr.h2
19 files changed, 107 insertions, 115 deletions
diff --git a/src/game/BattleGround.cpp b/src/game/BattleGround.cpp
index 2dae960f404..3aa4aa27f04 100644
--- a/src/game/BattleGround.cpp
+++ b/src/game/BattleGround.cpp
@@ -181,6 +181,7 @@ void BattleGround::Update(uint32 diff)
}
}
+ //this should be handled by spell system:
m_LastResurrectTime += diff;
if (m_LastResurrectTime >= RESURRECTION_INTERVAL)
{
@@ -308,7 +309,7 @@ void BattleGround::SendPacketToTeam(uint32 TeamID, WorldPacket *packet, Player *
if(!self && sender == plr)
continue;
- uint32 team = itr->second.Team;//GetPlayerTeam(plr->GetGUID());
+ uint32 team = itr->second.Team;
if(!team) team = plr->GetTeam();
if(team == TeamID)
@@ -337,7 +338,7 @@ void BattleGround::PlaySoundToTeam(uint32 SoundID, uint32 TeamID)
continue;
}
- uint32 team = itr->second.Team;//GetPlayerTeam(plr->GetGUID());
+ uint32 team = itr->second.Team;
if(!team) team = plr->GetTeam();
if(team == TeamID)
@@ -360,7 +361,7 @@ void BattleGround::CastSpellOnTeam(uint32 SpellID, uint32 TeamID)
continue;
}
- uint32 team = itr->second.Team;//GetPlayerTeam(plr->GetGUID());
+ uint32 team = itr->second.Team;
if(!team) team = plr->GetTeam();
if(team == TeamID)
@@ -397,7 +398,7 @@ void BattleGround::RewardHonorToTeam(uint32 Honor, uint32 TeamID)
continue;
}
- uint32 team = itr->second.Team;//GetPlayerTeam(plr->GetGUID());
+ uint32 team = itr->second.Team;
if(!team) team = plr->GetTeam();
if(team == TeamID)
@@ -422,7 +423,7 @@ void BattleGround::RewardReputationToTeam(uint32 faction_id, uint32 Reputation,
continue;
}
- uint32 team = itr->second.Team;//GetPlayerTeam(plr->GetGUID());
+ uint32 team = itr->second.Team;
if(!team) team = plr->GetTeam();
if(team == TeamID)
@@ -910,9 +911,6 @@ void BattleGround::Reset()
m_Players.clear();
m_PlayerScores.clear();
-
- // reset BGSubclass
- ResetBGSubclass();
}
void BattleGround::StartBattleGround()
@@ -993,10 +991,37 @@ void BattleGround::AddPlayer(Player *plr)
plr->CastSpell(plr, SPELL_PREPARATION, true); // reduces all mana cost of spells.
}
+ // setup BG group membership
+ PlayerRelogin(plr);
+ AddOrSetPlayerToCorrectBgGroup(plr, guid, team);
+
// Log
sLog.outDetail("BATTLEGROUND: Player %s joined the battle.", plr->GetName());
}
+/* this method adds player to his team's bg group, or sets his correct group if player is already in bg group */
+void BattleGround::AddOrSetPlayerToCorrectBgGroup(Player *plr, uint64 plr_guid, uint32 team)
+{
+ Group* group = GetBgRaid(team);
+ if(!group) // first player joined
+ {
+ group = new Group;
+ SetBgRaid(team, group);
+ group->Create(plr_guid, plr->GetName());
+ }
+ else // raid already exist
+ {
+ if(group->IsMember(plr_guid))
+ {
+ uint8 subgroup = group->GetMemberGroup(plr_guid);
+ plr->SetGroup(group, subgroup);
+ }
+ else
+ GetBgRaid(team)->AddMember(plr_guid, plr->GetName());
+ }
+}
+
+
/* This method should be called only once ... it adds pointer to queue */
void BattleGround::AddToBGFreeSlotQueue()
{
diff --git a/src/game/BattleGround.h b/src/game/BattleGround.h
index 99cb119c1f2..aa7cd316eb4 100644
--- a/src/game/BattleGround.h
+++ b/src/game/BattleGround.h
@@ -258,10 +258,7 @@ class BattleGround
{
return true;
}
- void Reset(); // resets all common properties for battlegrounds
- virtual void ResetBGSubclass() // must be implemented in BG subclass
- {
- }
+ virtual void Reset(); // resets all common properties for battlegrounds, must be implemented and called in BG subclass
/* Battleground */
// Get methods:
@@ -425,6 +422,8 @@ class BattleGround
virtual void AddPlayer(Player *plr); // must be implemented in BG subclass
+ void AddOrSetPlayerToCorrectBgGroup(Player *plr, uint64 plr_guid, uint32 team);
+
virtual void RemovePlayerAtLeave(uint64 guid, bool Transport, bool SendPacket);
// can be extended in in BG subclass
diff --git a/src/game/BattleGroundAB.cpp b/src/game/BattleGroundAB.cpp
index e4b0c82882d..322c1f6c920 100644
--- a/src/game/BattleGroundAB.cpp
+++ b/src/game/BattleGroundAB.cpp
@@ -592,8 +592,11 @@ bool BattleGroundAB::SetupBattleGround()
return true;
}
-void BattleGroundAB::ResetBGSubclass()
+void BattleGroundAB::Reset()
{
+ //call parent's class reset
+ BattleGround::Reset();
+
m_TeamScores[BG_TEAM_ALLIANCE] = 0;
m_TeamScores[BG_TEAM_HORDE] = 0;
m_lastTick[BG_TEAM_ALLIANCE] = 0;
diff --git a/src/game/BattleGroundAB.h b/src/game/BattleGroundAB.h
index 0844f3b5c4f..d859b34b1e1 100644
--- a/src/game/BattleGroundAB.h
+++ b/src/game/BattleGroundAB.h
@@ -243,7 +243,7 @@ class BattleGroundAB : public BattleGround
void RemovePlayer(Player *plr,uint64 guid);
void HandleAreaTrigger(Player *Source, uint32 Trigger);
virtual bool SetupBattleGround();
- virtual void ResetBGSubclass();
+ virtual void Reset();
virtual WorldSafeLocsEntry const* GetClosestGraveYard(float x, float y, float z, uint32 team);
/* Scorekeeping */
diff --git a/src/game/BattleGroundBE.cpp b/src/game/BattleGroundBE.cpp
index f63c6822c5b..e3d7b268c92 100644
--- a/src/game/BattleGroundBE.cpp
+++ b/src/game/BattleGroundBE.cpp
@@ -202,9 +202,10 @@ void BattleGroundBE::FillInitialWorldStates(WorldPacket &data)
data << uint32(0x9f3) << uint32(1); // 9
}
-void BattleGroundBE::ResetBGSubclass()
+void BattleGroundBE::Reset()
{
-
+ //call parent's class reset
+ BattleGround::Reset();
}
bool BattleGroundBE::SetupBattleGround()
diff --git a/src/game/BattleGroundBE.h b/src/game/BattleGroundBE.h
index a3826fcdd7d..94b7a189b53 100644
--- a/src/game/BattleGroundBE.h
+++ b/src/game/BattleGroundBE.h
@@ -65,7 +65,7 @@ class BattleGroundBE : public BattleGround
void RemovePlayer(Player *plr, uint64 guid);
void HandleAreaTrigger(Player *Source, uint32 Trigger);
bool SetupBattleGround();
- void ResetBGSubclass();
+ virtual void Reset();
virtual void FillInitialWorldStates(WorldPacket &d);
void HandleKillPlayer(Player* player, Player *killer);
bool HandlePlayerUnderMap(Player * plr);
diff --git a/src/game/BattleGroundEY.cpp b/src/game/BattleGroundEY.cpp
index baaa345d96d..05456abc78d 100644
--- a/src/game/BattleGroundEY.cpp
+++ b/src/game/BattleGroundEY.cpp
@@ -524,8 +524,11 @@ bool BattleGroundEY::SetupBattleGround()
return true;
}
-void BattleGroundEY::ResetBGSubclass()
+void BattleGroundEY::Reset()
{
+ //call parent's class reset
+ BattleGround::Reset();
+
m_TeamScores[BG_TEAM_ALLIANCE] = 0;
m_TeamScores[BG_TEAM_HORDE] = 0;
m_TeamPointsCount[BG_TEAM_ALLIANCE] = 0;
diff --git a/src/game/BattleGroundEY.h b/src/game/BattleGroundEY.h
index c99c0eeb4d4..3a4215d713e 100644
--- a/src/game/BattleGroundEY.h
+++ b/src/game/BattleGroundEY.h
@@ -319,7 +319,7 @@ class BattleGroundEY : public BattleGround
void HandleKillPlayer(Player *player, Player *killer);
virtual WorldSafeLocsEntry const* GetClosestGraveYard(float x, float y, float z, uint32 team);
virtual bool SetupBattleGround();
- virtual void ResetBGSubclass();
+ virtual void Reset();
void UpdateTeamScore(uint32 Team);
void UpdatePlayerScore(Player *Source, uint32 type, uint32 value);
virtual void FillInitialWorldStates(WorldPacket& data);
diff --git a/src/game/BattleGroundMgr.cpp b/src/game/BattleGroundMgr.cpp
index 966bcbcc176..5c47270ead8 100644
--- a/src/game/BattleGroundMgr.cpp
+++ b/src/game/BattleGroundMgr.cpp
@@ -55,12 +55,6 @@ INSTANTIATE_SINGLETON_1( BattleGroundMgr );
BattleGroundQueue::BattleGroundQueue()
{
//queues are empty, we don't have to call clear()
-/* for (int i = 0; i < MAX_BATTLEGROUND_QUEUES; i++)
- {
- //m_QueuedPlayers[i].Horde = 0;
- //m_QueuedPlayers[i].Alliance = 0;
- //m_QueuedPlayers[i].AverageTime = 0;
- }*/
}
BattleGroundQueue::~BattleGroundQueue()
@@ -87,17 +81,17 @@ void BattleGroundQueue::EligibleGroups::Init(BattleGroundQueue::QueuedGroupsList
{
next = itr;
++next;
- if( (*itr)->BgTypeId == BgTypeId && // bg type must match
- (*itr)->ArenaType == ArenaType && // arena type must match
- (*itr)->IsRated == IsRated && // israted must match
- (*itr)->IsInvitedToBGInstanceGUID == 0 && // leave out already invited groups
- (*itr)->Team == side && // match side
- (*itr)->Players.size() <= MaxPlayers && // the group must fit in the bg
+ if( (*itr)->BgTypeId == BgTypeId && // bg type must match
+ (*itr)->ArenaType == ArenaType && // arena type must match
+ (*itr)->IsRated == IsRated && // israted must match
+ (*itr)->IsInvitedToBGInstanceGUID == 0 && // leave out already invited groups
+ (*itr)->Team == side && // match side
+ (*itr)->Players.size() <= MaxPlayers && // the group must fit in the bg
( !excludeTeam || (*itr)->ArenaTeamId != excludeTeam ) && // if excludeTeam is specified, leave out those arena team ids
( !IsRated || (*itr)->Players.size() == MaxPlayers ) && // if rated, then pass only if the player count is exact NEEDS TESTING! (but now this should never happen)
- ( !DisregardTime || (*itr)->JoinTime <= DisregardTime // pass if disregard time is greater than join time
- || (*itr)->ArenaTeamRating == 0 // pass if no rating info
- || ( (*itr)->ArenaTeamRating >= MinRating // pass if matches the rating range
+ ( !DisregardTime || (*itr)->JoinTime <= DisregardTime // pass if disregard time is greater than join time
+ || (*itr)->ArenaTeamRating == 0 // pass if no rating info
+ || ( (*itr)->ArenaTeamRating >= MinRating // pass if matches the rating range
&& (*itr)->ArenaTeamRating <= MaxRating ) ) )
{
// the group matches the conditions
@@ -1433,9 +1427,8 @@ BattleGround * BattleGroundMgr::CreateNewBattleGround(BattleGroundTypeId bgTypeI
bg = new BattleGroundRV(*(BattleGroundRV*)bg_template);
break;
default:
- //bg = new BattleGround;
+ //error, but it is handled few lines above
return 0;
- break; // placeholder for non implemented BG
}
// generate a new instance id
@@ -1463,11 +1456,10 @@ BattleGround * BattleGroundMgr::CreateNewBattleGround(BattleGroundTypeId bgTypeI
}
// used to create the BG templates
-uint32 BattleGroundMgr::CreateBattleGround(BattleGroundTypeId bgTypeId, uint32 MinPlayersPerTeam, uint32 MaxPlayersPerTeam, uint32 LevelMin, uint32 LevelMax, char* BattleGroundName, uint32 MapID, float Team1StartLocX, float Team1StartLocY, float Team1StartLocZ, float Team1StartLocO, float Team2StartLocX, float Team2StartLocY, float Team2StartLocZ, float Team2StartLocO)
+uint32 BattleGroundMgr::CreateBattleGround(BattleGroundTypeId bgTypeId, bool IsArena, uint32 MinPlayersPerTeam, uint32 MaxPlayersPerTeam, uint32 LevelMin, uint32 LevelMax, char* BattleGroundName, uint32 MapID, float Team1StartLocX, float Team1StartLocY, float Team1StartLocZ, float Team1StartLocO, float Team2StartLocX, float Team2StartLocY, float Team2StartLocZ, float Team2StartLocO)
{
// Create the BG
BattleGround *bg = NULL;
-
switch(bgTypeId)
{
case BATTLEGROUND_AV: bg = new BattleGroundAV; break;
@@ -1488,19 +1480,13 @@ uint32 BattleGroundMgr::CreateBattleGround(BattleGroundTypeId bgTypeId, uint32 M
bg->Reset();
- BattlemasterListEntry const *bl = sBattlemasterListStore.LookupEntry(bgTypeId);
- //in previous method is checked if exists entry in sBattlemasterListStore, so no check needed
- if (bl)
- {
- bg->SetArenaorBGType(bl->type == TYPE_ARENA);
- }
-
bg->SetTypeID(bgTypeId);
- bg->SetInstanceID(0); // template bg, instance id is 0
+ bg->SetInstanceID(0);
+ bg->SetArenaorBGType(IsArena);
bg->SetMinPlayersPerTeam(MinPlayersPerTeam);
bg->SetMaxPlayersPerTeam(MaxPlayersPerTeam);
- bg->SetMinPlayers(MinPlayersPerTeam*2);
- bg->SetMaxPlayers(MaxPlayersPerTeam*2);
+ bg->SetMinPlayers(MinPlayersPerTeam * 2);
+ bg->SetMaxPlayers(MaxPlayersPerTeam * 2);
bg->SetName(BattleGroundName);
bg->SetTeamStartLoc(ALLIANCE, Team1StartLocX, Team1StartLocY, Team1StartLocZ, Team1StartLocO);
bg->SetTeamStartLoc(HORDE, Team2StartLocX, Team2StartLocY, Team2StartLocZ, Team2StartLocO);
@@ -1522,6 +1508,7 @@ void BattleGroundMgr::CreateInitialBattleGrounds()
uint32 MaxPlayersPerTeam, MinPlayersPerTeam, MinLvl, MaxLvl, start1, start2;
BattlemasterListEntry const *bl;
WorldSafeLocsEntry const *start;
+ bool IsArena;
uint32 count = 0;
@@ -1552,28 +1539,28 @@ void BattleGroundMgr::CreateInitialBattleGrounds()
bl = sBattlemasterListStore.LookupEntry(bgTypeID_);
if(!bl)
{
- sLog.outError("Battleground ID %u not found in BattlemasterList.dbc. Battleground not created.",bgTypeID_);
+ sLog.outError("Battleground ID %u not found in BattlemasterList.dbc. Battleground not created.", bgTypeID_);
continue;
}
BattleGroundTypeId bgTypeID = BattleGroundTypeId(bgTypeID_);
- MaxPlayersPerTeam = bl->maxplayersperteam;
- MinPlayersPerTeam = bl->maxplayersperteam/2;
- MinLvl = bl->minlvl;
- MaxLvl = bl->maxlvl;
-
- if(fields[1].GetUInt32())
- MinPlayersPerTeam = fields[1].GetUInt32();
-
- if(fields[2].GetUInt32())
- MaxPlayersPerTeam = fields[2].GetUInt32();
-
- if(fields[3].GetUInt32())
- MinLvl = fields[3].GetUInt32();
-
- if(fields[4].GetUInt32())
- MaxLvl = fields[4].GetUInt32();
+ IsArena = (bl->type == TYPE_ARENA);
+ MinPlayersPerTeam = fields[1].GetUInt32();
+ MaxPlayersPerTeam = fields[2].GetUInt32();
+ MinLvl = fields[3].GetUInt32();
+ MaxLvl = fields[4].GetUInt32();
+ //check values from DB
+ if( MaxPlayersPerTeam == 0 || MinPlayersPerTeam == 0 || MinPlayersPerTeam > MaxPlayersPerTeam )
+ {
+ MaxPlayersPerTeam = bl->maxplayersperteam;
+ MinPlayersPerTeam = bl->maxplayersperteam / 2;
+ }
+ if( MinLvl == 0 || MaxLvl == 0 || MinLvl > MaxLvl )
+ {
+ MinLvl = bl->minlvl;
+ MaxLvl = bl->maxlvl;
+ }
start1 = fields[5].GetUInt32();
@@ -1594,7 +1581,7 @@ void BattleGroundMgr::CreateInitialBattleGrounds()
}
else
{
- sLog.outErrorDb("Table `battleground_template` for id %u have non-existed WorldSafeLocs.dbc id %u in field `AllianceStartLoc`. BG not created.",bgTypeID,start1);
+ sLog.outErrorDb("Table `battleground_template` for id %u have non-existed WorldSafeLocs.dbc id %u in field `AllianceStartLoc`. BG not created.", bgTypeID, start1);
continue;
}
@@ -1617,12 +1604,12 @@ void BattleGroundMgr::CreateInitialBattleGrounds()
}
else
{
- sLog.outErrorDb("Table `battleground_template` for id %u have non-existed WorldSafeLocs.dbc id %u in field `HordeStartLoc`. BG not created.",bgTypeID,start2);
+ sLog.outErrorDb("Table `battleground_template` for id %u have non-existed WorldSafeLocs.dbc id %u in field `HordeStartLoc`. BG not created.", bgTypeID, start2);
continue;
}
//sLog.outDetail("Creating battleground %s, %u-%u", bl->name[sWorld.GetDBClang()], MinLvl, MaxLvl);
- if(!CreateBattleGround(bgTypeID, MinPlayersPerTeam, MaxPlayersPerTeam, MinLvl, MaxLvl, bl->name[sWorld.GetDefaultDbcLocale()], bl->mapid[0], AStartLoc[0], AStartLoc[1], AStartLoc[2], AStartLoc[3], HStartLoc[0], HStartLoc[1], HStartLoc[2], HStartLoc[3]))
+ if(!CreateBattleGround(bgTypeID, IsArena, MinPlayersPerTeam, MaxPlayersPerTeam, MinLvl, MaxLvl, bl->name[sWorld.GetDefaultDbcLocale()], bl->mapid[0], AStartLoc[0], AStartLoc[1], AStartLoc[2], AStartLoc[3], HStartLoc[0], HStartLoc[1], HStartLoc[2], HStartLoc[3]))
continue;
++count;
diff --git a/src/game/BattleGroundMgr.h b/src/game/BattleGroundMgr.h
index c42a7638a69..07047e3aaa0 100644
--- a/src/game/BattleGroundMgr.h
+++ b/src/game/BattleGroundMgr.h
@@ -202,7 +202,7 @@ class BattleGroundMgr
BattleGround * GetBattleGroundTemplate(BattleGroundTypeId bgTypeId);
BattleGround * CreateNewBattleGround(BattleGroundTypeId bgTypeId);
- uint32 CreateBattleGround(BattleGroundTypeId bgTypeId, uint32 MinPlayersPerTeam, uint32 MaxPlayersPerTeam, uint32 LevelMin, uint32 LevelMax, char* BattleGroundName, uint32 MapID, float Team1StartLocX, float Team1StartLocY, float Team1StartLocZ, float Team1StartLocO, float Team2StartLocX, float Team2StartLocY, float Team2StartLocZ, float Team2StartLocO);
+ uint32 CreateBattleGround(BattleGroundTypeId bgTypeId, bool IsArena, uint32 MinPlayersPerTeam, uint32 MaxPlayersPerTeam, uint32 LevelMin, uint32 LevelMax, char* BattleGroundName, uint32 MapID, float Team1StartLocX, float Team1StartLocY, float Team1StartLocZ, float Team1StartLocO, float Team2StartLocX, float Team2StartLocY, float Team2StartLocZ, float Team2StartLocO);
void AddBattleGround(uint32 InstanceID, BattleGround* BG) { m_BattleGrounds[InstanceID] = BG; };
void RemoveBattleGround(uint32 instanceID) { m_BattleGrounds.erase(instanceID); }
diff --git a/src/game/BattleGroundNA.cpp b/src/game/BattleGroundNA.cpp
index ad6d622e71a..9574adac9b1 100644
--- a/src/game/BattleGroundNA.cpp
+++ b/src/game/BattleGroundNA.cpp
@@ -195,9 +195,10 @@ void BattleGroundNA::FillInitialWorldStates(WorldPacket &data)
data << uint32(0xa11) << uint32(1); // 9
}
-void BattleGroundNA::ResetBGSubclass()
+void BattleGroundNA::Reset()
{
-
+ //call parent's class reset
+ BattleGround::Reset();
}
bool BattleGroundNA::SetupBattleGround()
diff --git a/src/game/BattleGroundNA.h b/src/game/BattleGroundNA.h
index 9fb94263e9c..531cbe0cb23 100644
--- a/src/game/BattleGroundNA.h
+++ b/src/game/BattleGroundNA.h
@@ -66,7 +66,7 @@ class BattleGroundNA : public BattleGround
void RemovePlayer(Player *plr, uint64 guid);
void HandleAreaTrigger(Player *Source, uint32 Trigger);
bool SetupBattleGround();
- virtual void ResetBGSubclass();
+ virtual void Reset();
virtual void FillInitialWorldStates(WorldPacket &d);
void HandleKillPlayer(Player* player, Player *killer);
bool HandlePlayerUnderMap(Player * plr);
diff --git a/src/game/BattleGroundRL.cpp b/src/game/BattleGroundRL.cpp
index 85117acd2f6..9b2ffa18289 100644
--- a/src/game/BattleGroundRL.cpp
+++ b/src/game/BattleGroundRL.cpp
@@ -197,9 +197,10 @@ void BattleGroundRL::FillInitialWorldStates(WorldPacket &data)
data << uint32(0xbba) << uint32(1); // 9
}
-void BattleGroundRL::ResetBGSubclass()
+void BattleGroundRL::Reset()
{
-
+ //call parent's reset
+ BattleGround::Reset();
}
bool BattleGroundRL::SetupBattleGround()
diff --git a/src/game/BattleGroundRL.h b/src/game/BattleGroundRL.h
index 0fd1af89506..cc3e460fa6b 100644
--- a/src/game/BattleGroundRL.h
+++ b/src/game/BattleGroundRL.h
@@ -58,12 +58,12 @@ class BattleGroundRL : public BattleGround
/* inherited from BattlegroundClass */
virtual void AddPlayer(Player *plr);
+ virtual void Reset();
+ virtual void FillInitialWorldStates(WorldPacket &d);
void RemovePlayer(Player *plr, uint64 guid);
void HandleAreaTrigger(Player *Source, uint32 Trigger);
bool SetupBattleGround();
- virtual void ResetBGSubclass();
- virtual void FillInitialWorldStates(WorldPacket &d);
void HandleKillPlayer(Player* player, Player *killer);
bool HandlePlayerUnderMap(Player * plr);
};
diff --git a/src/game/BattleGroundWS.cpp b/src/game/BattleGroundWS.cpp
index 3175f2873f9..2af90fcd3c6 100644
--- a/src/game/BattleGroundWS.cpp
+++ b/src/game/BattleGroundWS.cpp
@@ -654,8 +654,11 @@ bool BattleGroundWS::SetupBattleGround()
return true;
}
-void BattleGroundWS::ResetBGSubclass()
+void BattleGroundWS::Reset()
{
+ //call parent's class reset
+ BattleGround::Reset();
+
m_FlagKeepers[BG_TEAM_ALLIANCE] = 0;
m_FlagKeepers[BG_TEAM_HORDE] = 0;
m_DroppedFlagGUID[BG_TEAM_ALLIANCE] = 0;
diff --git a/src/game/BattleGroundWS.h b/src/game/BattleGroundWS.h
index 0c9baee1c76..92bc8a03008 100644
--- a/src/game/BattleGroundWS.h
+++ b/src/game/BattleGroundWS.h
@@ -161,7 +161,7 @@ class BattleGroundWS : public BattleGround
void HandleAreaTrigger(Player *Source, uint32 Trigger);
void HandleKillPlayer(Player *player, Player *killer);
bool SetupBattleGround();
- virtual void ResetBGSubclass();
+ virtual void Reset();
void UpdateFlagState(uint32 team, uint32 value);
void UpdateTeamScore(uint32 team);
diff --git a/src/game/MovementHandler.cpp b/src/game/MovementHandler.cpp
index aae26b5c5c1..8d595c38089 100644
--- a/src/game/MovementHandler.cpp
+++ b/src/game/MovementHandler.cpp
@@ -97,7 +97,6 @@ void WorldSession::HandleMoveWorldportAckOpcode()
// cleanup seting if outdated
if(!mEntry->IsBattleGroundOrArena())
{
- // Do next only if found in battleground
_player->SetBattleGroundId(0); // We're not in BG.
// reset destination bg team
_player->SetBGTeam(0);
diff --git a/src/game/Player.cpp b/src/game/Player.cpp
index ba11ffa6c27..9652734f7bb 100644
--- a/src/game/Player.cpp
+++ b/src/game/Player.cpp
@@ -1605,7 +1605,7 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati
}
else
{
- sLog.outDebug("Player %s will teleported to map %u", GetName(), mapid);
+ sLog.outDebug("Player %s is being teleported to map %u", GetName(), mapid);
}
// if we were on a transport, leave
@@ -14600,6 +14600,10 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder )
SetBattleGroundId(currentBg->GetInstanceID());
SetBGTeam(bgteam);
+ //join player to battleground group
+ currentBg->PlayerRelogin(this);
+ currentBg->AddOrSetPlayerToCorrectBgGroup(this, GetGUID(), bgteam);
+
SetInviteForBattleGroundQueueType(bgQueueTypeId,currentBg->GetInstanceID());
}
else
@@ -18685,40 +18689,6 @@ void Player::SendInitialPacketsAfterAddToMap()
SendMessageToSet(&data,true);
}
- // setup BG group membership if need
- if(BattleGround* currentBg = GetBattleGround())
- {
- // call for invited (join) or listed (relogin) and avoid other cases (GM teleport)
- if (IsInvitedForBattleGroundInstance(GetBattleGroundId()) ||
- currentBg->IsPlayerInBattleGround(GetGUID()))
- {
- currentBg->PlayerRelogin(this);
- if(currentBg->GetMapId() == GetMapId()) // we teleported/login to/in bg
- {
- uint32 team = currentBg->GetPlayerTeam(GetGUID());
- if(!team)
- team = GetTeam();
- Group* group = currentBg->GetBgRaid(team);
- if(!group) // first player joined
- {
- group = new Group;
- currentBg->SetBgRaid(team, group);
- group->Create(GetGUIDLow(), GetName());
- }
- else // raid already exist
- {
- if(group->IsMember(GetGUID()))
- {
- uint8 subgroup = group->GetMemberGroup(GetGUID());
- SetGroup(group, subgroup);
- }
- else
- currentBg->GetBgRaid(team)->AddMember(GetGUID(), GetName());
- }
- }
- }
- }
-
SendAurasForTarget(this);
SendEnchantmentDurations(); // must be after add to map
SendItemDurations(); // must be after add to map
diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h
index 253f4bc1ce1..868623fc8f0 100644
--- a/src/shared/revision_nr.h
+++ b/src/shared/revision_nr.h
@@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
- #define REVISION_NR "7275"
+ #define REVISION_NR "7276"
#endif // __REVISION_NR_H__