diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/server/game/Accounts/RBAC.h | 1 | ||||
-rw-r--r-- | src/server/scripts/Commands/cs_debug.cpp | 74 |
2 files changed, 51 insertions, 24 deletions
diff --git a/src/server/game/Accounts/RBAC.h b/src/server/game/Accounts/RBAC.h index 66816ea1591..557b122de95 100644 --- a/src/server/game/Accounts/RBAC.h +++ b/src/server/game/Accounts/RBAC.h @@ -759,6 +759,7 @@ enum RBACPermissions RBAC_PERM_COMMAND_GO_OFFSET = 852, RBAC_PERM_COMMAND_RELOAD_CONVERSATION_TEMPLATE = 853, // not on 3.3.5a RBAC_PERM_COMMAND_DEBUG_CONVERSATION = 854, // not on 3.3.5a + RBAC_PERM_COMMAND_DEBUG_PLAY_MUSIC = 855, // custom permissions 1000+ RBAC_PERM_MAX diff --git a/src/server/scripts/Commands/cs_debug.cpp b/src/server/scripts/Commands/cs_debug.cpp index c907b8f41ad..bf69bc4defb 100644 --- a/src/server/scripts/Commands/cs_debug.cpp +++ b/src/server/scripts/Commands/cs_debug.cpp @@ -52,6 +52,7 @@ public: { "cinematic", rbac::RBAC_PERM_COMMAND_DEBUG_PLAY_CINEMATIC, false, &HandleDebugPlayCinematicCommand, "" }, { "movie", rbac::RBAC_PERM_COMMAND_DEBUG_PLAY_MOVIE, false, &HandleDebugPlayMovieCommand, "" }, { "sound", rbac::RBAC_PERM_COMMAND_DEBUG_PLAY_SOUND, false, &HandleDebugPlaySoundCommand, "" }, + { "music", rbac::RBAC_PERM_COMMAND_DEBUG_PLAY_MUSIC, false, &HandleDebugPlayMusicCommand, "" }, }; static std::vector<ChatCommand> debugSendCommandTable = { @@ -110,8 +111,8 @@ public: static bool HandleDebugPlayCinematicCommand(ChatHandler* handler, char const* args) { - // USAGE: .debug play cinematic #cinematicid - // #cinematicid - ID decimal number from CinemaicSequences.dbc (1st column) + // USAGE: .debug play cinematic #cinematicId + // #cinematicId - ID decimal number from CinemaicSequences.dbc (1st column) if (!*args) { handler->SendSysMessage(LANG_BAD_VALUE); @@ -119,22 +120,21 @@ public: return false; } - uint32 id = atoi((char*)args); - - if (!sCinematicSequencesStore.LookupEntry(id)) + uint32 cinematicId = atoul(args); + if (!sCinematicSequencesStore.LookupEntry(cinematicId)) { - handler->PSendSysMessage(LANG_CINEMATIC_NOT_EXIST, id); + handler->PSendSysMessage(LANG_CINEMATIC_NOT_EXIST, cinematicId); handler->SetSentErrorMessage(true); return false; } // Dump camera locations - if (CinematicSequencesEntry const* cineSeq = sCinematicSequencesStore.LookupEntry(id)) + if (CinematicSequencesEntry const* cineSeq = sCinematicSequencesStore.LookupEntry(cinematicId)) { std::unordered_map<uint32, FlyByCameraCollection>::const_iterator itr = sFlyByCameraStore.find(cineSeq->cinematicCamera); if (itr != sFlyByCameraStore.end()) { - handler->PSendSysMessage("Waypoints for sequence %u, camera %u", id, cineSeq->cinematicCamera); + handler->PSendSysMessage("Waypoints for sequence %u, camera %u", cinematicId, cineSeq->cinematicCamera); uint32 count = 1 ; for (FlyByCamera cam : itr->second) { @@ -145,14 +145,14 @@ public: } } - handler->GetSession()->GetPlayer()->SendCinematicStart(id); + handler->GetSession()->GetPlayer()->SendCinematicStart(cinematicId); return true; } static bool HandleDebugPlayMovieCommand(ChatHandler* handler, char const* args) { - // USAGE: .debug play movie #movieid - // #movieid - ID decimal number from Movie.dbc (1st column) + // USAGE: .debug play movie #movieId + // #movieId - ID decimal number from Movie.dbc (1st column) if (!*args) { handler->SendSysMessage(LANG_BAD_VALUE); @@ -160,24 +160,22 @@ public: return false; } - uint32 id = atoi((char*)args); - - if (!sMovieStore.LookupEntry(id)) + uint32 movieId = atoul(args); + if (!sMovieStore.LookupEntry(movieId)) { - handler->PSendSysMessage(LANG_MOVIE_NOT_EXIST, id); + handler->PSendSysMessage(LANG_MOVIE_NOT_EXIST, movieId); handler->SetSentErrorMessage(true); return false; } - handler->GetSession()->GetPlayer()->SendMovieStart(id); + handler->GetSession()->GetPlayer()->SendMovieStart(movieId); return true; } - //Play sound static bool HandleDebugPlaySoundCommand(ChatHandler* handler, char const* args) { - // USAGE: .debug playsound #soundid - // #soundid - ID decimal number from SoundEntries.dbc (1st column) + // USAGE: .debug play sound #soundId + // #soundId - ID decimal number from SoundEntries.dbc (1st column) if (!*args) { handler->SendSysMessage(LANG_BAD_VALUE); @@ -185,8 +183,7 @@ public: return false; } - uint32 soundId = atoi((char*)args); - + uint32 soundId = atoul(args); if (!sSoundEntriesStore.LookupEntry(soundId)) { handler->PSendSysMessage(LANG_SOUND_NOT_EXIST, soundId); @@ -194,6 +191,8 @@ public: return false; } + Player* player = handler->GetSession()->GetPlayer(); + Unit* unit = handler->getSelectedUnit(); if (!unit) { @@ -202,15 +201,42 @@ public: return false; } - if (handler->GetSession()->GetPlayer()->GetTarget()) - unit->PlayDistanceSound(soundId, handler->GetSession()->GetPlayer()); + if (player->GetTarget()) + unit->PlayDistanceSound(soundId, player); else - unit->PlayDirectSound(soundId, handler->GetSession()->GetPlayer()); + unit->PlayDirectSound(soundId, player); handler->PSendSysMessage(LANG_YOU_HEAR_SOUND, soundId); return true; } + static bool HandleDebugPlayMusicCommand(ChatHandler* handler, char const* args) + { + // USAGE: .debug play music #musicId + // #musicId - ID decimal number from SoundEntries.dbc (1st column) + if (!*args) + { + handler->SendSysMessage(LANG_BAD_VALUE); + handler->SetSentErrorMessage(true); + return false; + } + + uint32 musicId = atoul(args); + if (!sSoundEntriesStore.LookupEntry(musicId)) + { + handler->PSendSysMessage(LANG_SOUND_NOT_EXIST, musicId); + handler->SetSentErrorMessage(true); + return false; + } + + Player* player = handler->GetSession()->GetPlayer(); + + player->PlayDirectMusic(musicId, player); + + handler->PSendSysMessage(LANG_YOU_HEAR_SOUND, musicId); + return true; + } + static bool HandleDebugSendSpellFailCommand(ChatHandler* handler, char const* args) { if (!*args) |