Skip to content

Commit

Permalink
Implement Play Music debug command
Browse files Browse the repository at this point in the history
  • Loading branch information
killerwife authored and cyberium committed Apr 13, 2017
1 parent 9084eda commit 3fd84ba
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/game/Chat.cpp
Expand Up @@ -213,7 +213,8 @@ ChatCommand* ChatHandler::getCommandTable()
{ "cinematic", SEC_MODERATOR, false, &ChatHandler::HandleDebugPlayCinematicCommand, "", nullptr },
{ "movie", SEC_MODERATOR, false, &ChatHandler::HandleDebugPlayMovieCommand, "", nullptr },
{ "sound", SEC_MODERATOR, false, &ChatHandler::HandleDebugPlaySoundCommand, "", nullptr },
{ nullptr, 0, false, nullptr, "", nullptr }
{ "music", SEC_MODERATOR, false, &ChatHandler::HandleDebugPlayMusicCommand, "", nullptr },
{ nullptr, 0, false, nullptr, "", nullptr }
};

static ChatCommand debugSendCommandTable[] =
Expand Down
1 change: 1 addition & 0 deletions src/game/Chat.h
Expand Up @@ -238,6 +238,7 @@ class MANGOS_DLL_SPEC ChatHandler
bool HandleDebugPlayCinematicCommand(char* args);
bool HandleDebugPlayMovieCommand(char* args);
bool HandleDebugPlaySoundCommand(char* args);
bool HandleDebugPlayMusicCommand(char* args);

bool HandleDebugSendBuyErrorCommand(char* args);
bool HandleDebugSendChannelNotifyCommand(char* args);
Expand Down
22 changes: 22 additions & 0 deletions src/game/debugcmds.cpp
Expand Up @@ -283,6 +283,28 @@ bool ChatHandler::HandleDebugPlaySoundCommand(char* args)
return true;
}

// Play Music
bool ChatHandler::HandleDebugPlayMusicCommand(char* args)
{
// USAGE: .debug playmusic #musicid
// #musicid - ID decimal number from SoundEntries.dbc (1st column)
uint32 dwMusicId;
if (!ExtractUInt32(&args, dwMusicId))
return false;

if (!sSoundEntriesStore.LookupEntry(dwMusicId))
{
PSendSysMessage(LANG_SOUND_NOT_EXIST, dwMusicId);
SetSentErrorMessage(true);
return false;
}

m_session->GetPlayer()->PlayMusic(dwMusicId, dynamic_cast<Player*>(getSelectedUnit()));

PSendSysMessage(LANG_YOU_HEAR_SOUND, dwMusicId);
return true;
}

// Send notification in channel
bool ChatHandler::HandleDebugSendChannelNotifyCommand(char* args)
{
Expand Down

0 comments on commit 3fd84ba

Please sign in to comment.