mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-20 01:15:35 +01:00
Scripts/Command: implement .debug play music command
This commit is contained in:
@@ -51,6 +51,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)
|
||||
{
|
||||
@@ -151,8 +151,8 @@ public:
|
||||
|
||||
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 playsound #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)
|
||||
|
||||
Reference in New Issue
Block a user