aboutsummaryrefslogtreecommitdiff
path: root/src/game/Debugcmds.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/game/Debugcmds.cpp')
-rw-r--r--src/game/Debugcmds.cpp36
1 files changed, 32 insertions, 4 deletions
diff --git a/src/game/Debugcmds.cpp b/src/game/Debugcmds.cpp
index 73aff0dbb09..d0402b4851c 100644
--- a/src/game/Debugcmds.cpp
+++ b/src/game/Debugcmds.cpp
@@ -243,13 +243,41 @@ bool ChatHandler::HandleDebugUpdateWorldStateCommand(const char* args)
return true;
}
-bool ChatHandler::HandleDebugPlaySound2Command(const char* args)
+//Play sound
+bool ChatHandler::HandleDebugPlaySoundCommand(const char* args)
{
- if(!args)
+ // USAGE: .debug playsound #soundid
+ // #soundid - ID decimal number from SoundEntries.dbc (1st column)
+ if( !*args )
+ {
+ SendSysMessage(LANG_BAD_VALUE);
+ SetSentErrorMessage(true);
+ return false;
+ }
+
+ uint32 dwSoundId = atoi((char*)args);
+
+ if(!sSoundEntriesStore.LookupEntry(dwSoundId))
+ {
+ PSendSysMessage(LANG_SOUND_NOT_EXIST, dwSoundId);
+ SetSentErrorMessage(true);
return false;
+ }
+
+ Unit* unit = getSelectedUnit();
+ if(!unit)
+ {
+ SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
+ SetSentErrorMessage(true);
+ return false;
+ }
+
+ if(m_session->GetPlayer()->GetSelection())
+ unit->PlayDistanceSound(dwSoundId,m_session->GetPlayer());
+ else
+ unit->PlayDirectSound(dwSoundId,m_session->GetPlayer());
- uint32 soundid = atoi(args);
- m_session->GetPlayer()->PlaySound(soundid, false);
+ PSendSysMessage(LANG_YOU_HEAR_SOUND, dwSoundId);
return true;
}