Core/Battleground: Simplified Battleground.SendPacketToTeam

This commit is contained in:
hondacrx
2018-01-12 17:08:37 -05:00
parent ea2285e66f
commit a3159de0a7
+5 -10
View File
@@ -536,14 +536,14 @@ namespace Game.BattleGrounds
} }
} }
void SendPacketToTeam(Team team, ServerPacket packet, Player sender, bool self) void SendPacketToTeam(Team team, ServerPacket packet, Player except = null)
{ {
foreach (var pair in m_Players) foreach (var pair in m_Players)
{ {
Player player = _GetPlayerForTeam(team, pair, "SendPacketToTeam"); Player player = _GetPlayerForTeam(team, pair, "SendPacketToTeam");
if (player) if (player)
{ {
if (self || sender != player) if (player != except)
player.SendPacket(packet); player.SendPacket(packet);
} }
} }
@@ -561,12 +561,7 @@ namespace Game.BattleGrounds
void PlaySoundToTeam(uint soundID, Team team) void PlaySoundToTeam(uint soundID, Team team)
{ {
foreach (var pair in m_Players) SendPacketToTeam(team, new PlaySound(ObjectGuid.Empty, soundID));
{
Player player = _GetPlayerForTeam(team, pair, "PlaySoundToTeam");
if (player)
player.SendPacket(new PlaySound(ObjectGuid.Empty, soundID));
}
} }
public void CastSpellOnTeam(uint SpellID, Team team) public void CastSpellOnTeam(uint SpellID, Team team)
@@ -897,7 +892,7 @@ namespace Game.BattleGrounds
// Let others know // Let others know
BattlegroundPlayerLeft playerLeft = new BattlegroundPlayerLeft(); BattlegroundPlayerLeft playerLeft = new BattlegroundPlayerLeft();
playerLeft.Guid = guid; playerLeft.Guid = guid;
SendPacketToTeam(team, playerLeft, player, false); SendPacketToTeam(team, playerLeft, player);
} }
if (player) if (player)
@@ -987,7 +982,7 @@ namespace Game.BattleGrounds
BattlegroundPlayerJoined playerJoined = new BattlegroundPlayerJoined(); BattlegroundPlayerJoined playerJoined = new BattlegroundPlayerJoined();
playerJoined.Guid = player.GetGUID(); playerJoined.Guid = player.GetGUID();
SendPacketToTeam(team, playerJoined, player, false); SendPacketToTeam(team, playerJoined, player);
// BG Status packet // BG Status packet
BattlegroundQueueTypeId bgQueueTypeId = Global.BattlegroundMgr.BGQueueTypeId(m_TypeID, GetArenaType()); BattlegroundQueueTypeId bgQueueTypeId = Global.BattlegroundMgr.BGQueueTypeId(m_TypeID, GetArenaType());