Scripts/Command: implement .debug play music command

This commit is contained in:
Aokromes
2017-05-30 09:55:45 +02:00
parent 16e60ba408
commit dff1518ac2
13 changed files with 70 additions and 29 deletions

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,8 @@
DELETE FROM `rbac_permissions` WHERE `id` = 855;
INSERT INTO `rbac_permissions` (`id`,`name`) VALUES
(855, 'Command: debug play music');
DELETE FROM `rbac_linked_permissions` WHERE `id` = 855;
INSERT INTO `rbac_linked_permissions` (`id`,`linkedId`) VALUES
(198, 855);

View File

@@ -1,2 +0,0 @@
-- Caynrus <Shield Vendor> used Bent Staff (item ID 35) before Cataclysm (patch 4.0.3a)
UPDATE `creature_equip_template` SET `ItemID1`=35, `ItemID2`=0, `VerifiedBuild`=12340 WHERE `CreatureID`=4240;

View File

@@ -1 +0,0 @@
UPDATE `spell_proc` SET `SchoolMask`=0, `SpellFamilyName`=3 WHERE `SpellId`=71761;

View File

@@ -0,0 +1,2 @@
-- Caynrus <Shield Vendor> used Bent Staff (item ID 35) before Cataclysm (patch 4.0.3a)
-- UPDATE `creature_equip_template` SET `ItemID1`=35, `ItemID2`=0, `VerifiedBuild`=12340 WHERE `CreatureID`=4240;

View File

@@ -0,0 +1 @@
-- UPDATE `spell_proc` SET `SchoolMask`=0, `SpellFamilyName`=3 WHERE `SpellId`=71761;

View File

@@ -0,0 +1,4 @@
DELETE FROM `command` WHERE `name` = 'debug play music';
INSERT INTO `command` (`name`,`permission`,`help`) VALUES
('debug play music', 855, 'Syntax: .debug play music #musicId\nPlay music with #musicId.\nMusic will be played only for you. Other players will not hear this.');

View File

@@ -750,6 +750,9 @@ enum RBACPermissions
RBAC_PERM_COMMAND_RELOAD_QUEST_GREETING = 843, // not on 3.3.5a or 4.3.4
RBAC_PERM_COMMAND_DEBUG_SEND_PLAYSCENE = 844, // not on 3.3.5a or 4.3.4
RBAC_PERM_COMMAND_GO_OFFSET = 845,
RBAC_PERM_COMMAND_RELOAD_CONVERSATION_TEMPLATE = 853, // not on 3.3.5a or 4.3.4
RBAC_PERM_COMMAND_DEBUG_CONVERSATION = 854, // not on 3.3.5a or 4.3.4
RBAC_PERM_COMMAND_DEBUG_PLAY_MUSIC = 855,
// custom permissions 1000+
RBAC_PERM_MAX

View File

@@ -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)