From dca7931fa260d0ea66e58f4762f7751f0b1a55c1 Mon Sep 17 00:00:00 2001 From: hondacrx Date: Thu, 14 Sep 2023 02:53:58 -0400 Subject: [PATCH] Scripts/Commands: Implemented .debug play objectsound command Port From (https://github.com/TrinityCore/TrinityCore/commit/95893cf53cdc9ab2ca3ec26cfd85793e63e97317) --- Source/Game/Chat/Commands/DebugCommands.cs | 17 +++++++++++++++++ Source/Game/Entities/Object/WorldObject.cs | 2 +- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/Source/Game/Chat/Commands/DebugCommands.cs b/Source/Game/Chat/Commands/DebugCommands.cs index e3c698bf6..71df90929 100644 --- a/Source/Game/Chat/Commands/DebugCommands.cs +++ b/Source/Game/Chat/Commands/DebugCommands.cs @@ -1238,6 +1238,23 @@ namespace Game.Chat return true; } + [Command("objectsound", RBACPermissions.CommandDebug)] + static bool HandleDebugPlayObjectSoundCommand(CommandHandler handler, uint soundKitId, int? broadcastTextId) + { + if (!CliDB.SoundKitStorage.ContainsKey(soundKitId)) + { + handler.SendSysMessage(CypherStrings.SoundNotExist, soundKitId); + return false; + } + + Player player = handler.GetPlayer(); + + player.PlayObjectSound(soundKitId, player.GetGUID(), player, broadcastTextId.GetValueOrDefault(0)); + + handler.SendSysMessage(CypherStrings.YouHearSound, soundKitId); + return true; + } + [Command("sound", RBACPermissions.CommandDebug)] static bool HandleDebugPlaySoundCommand(CommandHandler handler, uint soundId, uint broadcastTextId) { diff --git a/Source/Game/Entities/Object/WorldObject.cs b/Source/Game/Entities/Object/WorldObject.cs index 656fe956f..d69233f8b 100644 --- a/Source/Game/Entities/Object/WorldObject.cs +++ b/Source/Game/Entities/Object/WorldObject.cs @@ -2960,7 +2960,7 @@ namespace Game.Entities SendMessageToSet(new PlayMusic(musicId), true); } - void PlayObjectSound(uint soundKitId, ObjectGuid targetObjectGUID, Player target = null, int broadcastTextId = 0) + public void PlayObjectSound(uint soundKitId, ObjectGuid targetObjectGUID, Player target = null, int broadcastTextId = 0) { PlayObjectSound pkt = new(); pkt.TargetObjectGUID = targetObjectGUID;