aboutsummaryrefslogtreecommitdiff
path: root/src/game/BattleGround.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/game/BattleGround.cpp')
-rw-r--r--src/game/BattleGround.cpp41
1 files changed, 33 insertions, 8 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()
{