Jump to content

.Debug play sound ID


Recommended Posts

  • 40 years later...

You should learn how to search something in the core :P

All mangos commands are stored in Chat.cpp, with the function that makes it work.

You should have something like that in this file :

static ChatCommand debugPlayCommandTable[] =
   {
       { "cinematic",      SEC_MODERATOR,      false, &ChatHandler::HandleDebugPlayCinematicCommand,       "", NULL },
       { "movie",          SEC_MODERATOR,      false, &ChatHandler::HandleDebugPlayMovieCommand,           "", NULL },
       { "sound",          SEC_MODERATOR,      false, &ChatHandler::HandleDebugPlaySoundCommand,           "", NULL },
       { NULL,             0,                  false, NULL,                                                "", NULL }
   };

And there you go, you found the function : HandleDebugPlaySoundCommand.

With a little research, you can find this function in debugcmds.cpp

Now you just have to modify it so that it send the sounds to all players instead of only one.

Try it on your own! :)

Link to comment
Share on other sites

I have do nit with a config option.

if the config option = 1 play to all if the option = 0 not to all:

diff --git a/src/main/Object.cpp b/src/main/Object.cpp
index b82c652..7454cf2 100644
--- a/src/main/Object.cpp
+++ b/src/main/Object.cpp
@@ -1910,10 +1910,8 @@ void WorldObject::PlayDirectSound( uint32 sound_id, Player* target /*= NULL*/ )
{
    WorldPacket data(SMSG_PLAY_SOUND, 4);
    data << uint32(sound_id);
-    if (target)
-        target->SendDirectMessage( &data );
-    else
-        SendMessageToSet( &data, true );
+
+    sWorld.SendGlobalMessage(&data);
}

void WorldObject::UpdateObjectVisibility()
diff --git a/src/main/debugcmds.cpp b/src/main/debugcmds.cpp
index a64a4f5..0ded970 100644
--- a/src/main/debugcmds.cpp
+++ b/src/main/debugcmds.cpp
@@ -17,6 +17,7 @@
 */

#include "Common.h"
+#include "Config/Config.h"
#include "Database/DatabaseEnv.h"
#include "WorldPacket.h"
#include "Vehicle.h"
@@ -290,10 +291,13 @@ bool ChatHandler::HandleDebugPlaySoundCommand(const char* args)
        return false;
    }

-    if (m_session->GetPlayer()->GetSelection())
-        unit->PlayDistanceSound(dwSoundId,m_session->GetPlayer());
-    else
-        unit->PlayDirectSound(dwSoundId,m_session->GetPlayer());
+    bool playall = sConfig.GetBoolDefault("Debug.Play.Sound.All.Enable", true);
+
+    if (playall)
+        unit->PlayDirectSound(dwSoundId,m_session->GetPlayer());
+    else
+        unit->PlayDistanceSound(dwSoundId,m_session->GetPlayer());
+        

    PSendSysMessage(LANG_YOU_HEAR_SOUND, dwSoundId);
    return true;

###################################################################################################################
# DEBUG COMMAND SETTINGS
#
#    Debug.Play.Sound.All.Enable
#        Enable or disable playing sounds to all players if you use .debug play sound
#        Default: 0 - Don't play to all
#                    1 - Play to all
###################################################################################################################

Debug.Play.Sound.All.Enable = 0

Set it to 1 to play the sounds to all

Link to comment
Share on other sites

  • 2 weeks later...
  • 2 weeks later...
Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use