Scripts/Commands: Implemented .debug play objectsound command

Port From (https://github.com/TrinityCore/TrinityCore/commit/95893cf53cdc9ab2ca3ec26cfd85793e63e97317)
This commit is contained in:
hondacrx
2023-09-14 02:53:58 -04:00
parent 0e2b551b06
commit dca7931fa2
2 changed files with 18 additions and 1 deletions
@@ -1238,6 +1238,23 @@ namespace Game.Chat
return true; 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)] [Command("sound", RBACPermissions.CommandDebug)]
static bool HandleDebugPlaySoundCommand(CommandHandler handler, uint soundId, uint broadcastTextId) static bool HandleDebugPlaySoundCommand(CommandHandler handler, uint soundId, uint broadcastTextId)
{ {
+1 -1
View File
@@ -2960,7 +2960,7 @@ namespace Game.Entities
SendMessageToSet(new PlayMusic(musicId), true); 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(); PlayObjectSound pkt = new();
pkt.TargetObjectGUID = targetObjectGUID; pkt.TargetObjectGUID = targetObjectGUID;