diff --git a/Source/Game/AI/SmartScripts/SmartAIManager.cs b/Source/Game/AI/SmartScripts/SmartAIManager.cs index ee88b7d7d..97374b588 100644 --- a/Source/Game/AI/SmartScripts/SmartAIManager.cs +++ b/Source/Game/AI/SmartScripts/SmartAIManager.cs @@ -2416,6 +2416,8 @@ namespace Game.AI { public uint soundId; public uint onlySelf; + public uint distance; // NYI: awaiting cherry-pick + public uint keyBroadcastTextId; } public struct Emote { diff --git a/Source/Game/AI/SmartScripts/SmartScript.cs b/Source/Game/AI/SmartScripts/SmartScript.cs index 6f1cfd54d..7aef15dfd 100644 --- a/Source/Game/AI/SmartScripts/SmartScript.cs +++ b/Source/Game/AI/SmartScripts/SmartScript.cs @@ -178,7 +178,7 @@ namespace Game.AI { if (IsUnit(target)) { - target.PlayDirectSound(e.Action.sound.soundId, e.Action.sound.onlySelf != 0 ? target.ToPlayer() : null); + target.PlayDirectSound(e.Action.sound.soundId, e.Action.sound.onlySelf != 0 ? target.ToPlayer() : null, e.Action.sound.keyBroadcastTextId); Log.outDebug(LogFilter.ScriptsAi, "SmartScript.ProcessAction. SMART_ACTION_SOUND: target: {0} (GuidLow: {1}), sound: {2}, onlyself: {3}", target.GetName(), target.GetGUID().ToString(), e.Action.sound.soundId, e.Action.sound.onlySelf); } diff --git a/Source/Game/BattleFields/BattleField.cs b/Source/Game/BattleFields/BattleField.cs index f44a7b99a..3818b2dff 100644 --- a/Source/Game/BattleFields/BattleField.cs +++ b/Source/Game/BattleFields/BattleField.cs @@ -357,7 +357,7 @@ namespace Game.BattleFields void DoPlaySoundToAll(uint soundID) { - BroadcastPacketToWar(new PlaySound(ObjectGuid.Empty, soundID)); + BroadcastPacketToWar(new PlaySound(ObjectGuid.Empty, soundID, 0)); } public bool HasPlayer(Player player) diff --git a/Source/Game/BattleGrounds/BattleGround.cs b/Source/Game/BattleGrounds/BattleGround.cs index 0b0b90f1d..2fd03ec13 100644 --- a/Source/Game/BattleGrounds/BattleGround.cs +++ b/Source/Game/BattleGrounds/BattleGround.cs @@ -567,12 +567,12 @@ namespace Game.BattleGrounds public void PlaySoundToAll(uint soundID) { - SendPacketToAll(new PlaySound(ObjectGuid.Empty, soundID)); + SendPacketToAll(new PlaySound(ObjectGuid.Empty, soundID, 0)); } void PlaySoundToTeam(uint soundID, Team team) { - SendPacketToTeam(team, new PlaySound(ObjectGuid.Empty, soundID)); + SendPacketToTeam(team, new PlaySound(ObjectGuid.Empty, soundID, 0)); } public void CastSpellOnTeam(uint SpellID, Team team) diff --git a/Source/Game/Chat/Commands/MiscCommands.cs b/Source/Game/Chat/Commands/MiscCommands.cs index 332e56f5d..36dd07c21 100644 --- a/Source/Game/Chat/Commands/MiscCommands.cs +++ b/Source/Game/Chat/Commands/MiscCommands.cs @@ -1834,7 +1834,9 @@ namespace Game.Chat return false; } - Global.WorldMgr.SendGlobalMessage(new PlaySound(handler.GetSession().GetPlayer().GetGUID(), soundId)); + uint broadcastTextId = args.NextUInt32(); + + Global.WorldMgr.SendGlobalMessage(new PlaySound(handler.GetSession().GetPlayer().GetGUID(), soundId, broadcastTextId)); handler.SendSysMessage(CypherStrings.CommandPlayedToAll, soundId); return true; diff --git a/Source/Game/Entities/Object/WorldObject.cs b/Source/Game/Entities/Object/WorldObject.cs index 60cd648cc..ba816a1d9 100644 --- a/Source/Game/Entities/Object/WorldObject.cs +++ b/Source/Game/Entities/Object/WorldObject.cs @@ -1618,9 +1618,9 @@ namespace Game.Entities SendMessageToSet(playSpeakerBoxSound, true); } - public void PlayDirectSound(uint soundId, Player target = null) + public void PlayDirectSound(uint soundId, Player target = null, uint broadcastTextId = 0) { - PlaySound sound = new PlaySound(GetGUID(), soundId); + PlaySound sound = new PlaySound(GetGUID(), soundId, broadcastTextId); if (target) target.SendPacket(sound); else diff --git a/Source/Game/Networking/Packets/MiscPackets.cs b/Source/Game/Networking/Packets/MiscPackets.cs index 9adca677a..4c73bda14 100644 --- a/Source/Game/Networking/Packets/MiscPackets.cs +++ b/Source/Game/Networking/Packets/MiscPackets.cs @@ -885,22 +885,23 @@ namespace Game.Networking.Packets class PlaySound : ServerPacket { - public PlaySound(ObjectGuid sourceObjectGuid, uint soundKitID) : base(ServerOpcodes.PlaySound) + public PlaySound(ObjectGuid sourceObjectGuid, uint soundKitID, uint broadcastTextId) : base(ServerOpcodes.PlaySound) { SourceObjectGuid = sourceObjectGuid; SoundKitID = soundKitID; + BroadcastTextID = broadcastTextId; } public override void Write() { _worldPacket.WriteUInt32(SoundKitID); _worldPacket.WritePackedGuid(SourceObjectGuid); - _worldPacket.WriteInt32(BroadcastTextID); + _worldPacket.WriteUInt32(BroadcastTextID); } public ObjectGuid SourceObjectGuid; public uint SoundKitID; - public int BroadcastTextID; + public uint BroadcastTextID; } class PlaySpeakerBoxSound : ServerPacket diff --git a/Source/Game/Text/CreatureTextManager.cs b/Source/Game/Text/CreatureTextManager.cs index 1203dc356..5fd6f7f33 100644 --- a/Source/Game/Text/CreatureTextManager.cs +++ b/Source/Game/Text/CreatureTextManager.cs @@ -213,7 +213,7 @@ namespace Game range = textEntry.TextRange; if (finalSound != 0) - SendSound(source, finalSound, finalType, whisperTarget, range, team, gmOnly); + SendSound(source, finalSound, finalType, whisperTarget, range, team, gmOnly, textEntry.BroadcastTextId); Unit finalSource = source; if (srcPlr) @@ -256,12 +256,12 @@ namespace Game return dist; } - public void SendSound(Creature source, uint sound, ChatMsg msgType, WorldObject whisperTarget = null, CreatureTextRange range = CreatureTextRange.Normal, Team team = Team.Other, bool gmOnly = false) + public void SendSound(Creature source, uint sound, ChatMsg msgType, WorldObject whisperTarget = null, CreatureTextRange range = CreatureTextRange.Normal, Team team = Team.Other, bool gmOnly = false, uint keyBroadcastTextId = 0) { if (sound == 0 || !source) return; - SendNonChatPacket(source, new PlaySound(source.GetGUID(), sound), msgType, whisperTarget, range, team, gmOnly); + SendNonChatPacket(source, new PlaySound(source.GetGUID(), sound, keyBroadcastTextId), msgType, whisperTarget, range, team, gmOnly); } void SendNonChatPacket(WorldObject source, ServerPacket data, ChatMsg msgType, WorldObject whisperTarget, CreatureTextRange range, Team team, bool gmOnly)