aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorForesterDev <forester.manv@gmail.com>2017-05-26 10:52:56 +0400
committerfunjoker <funjoker109@gmail.com>2020-06-14 23:49:04 +0200
commit7211c6e51d7471cef6c2de6bf1b1bf3711887835 (patch)
tree6dbb91b574fc698e8b1d2342c8a5c69f73d860be
parent3f83c9dd1d409afa5f81dfc2cdcf21cb15b6c06b (diff)
Scripts/Command: implement .debug play music command
Closes #19809 (cherry picked from commit dd4ff1fe5458c89fc1d988fcc6ba5792ee482dcf)
-rw-r--r--sql/base/auth_database.sql3
-rw-r--r--sql/updates/auth/master/2020_05_19_00_auth.sql7
-rw-r--r--sql/updates/world/master/2020_06_14_18_world_2017_05_29_00_world.sql3
-rw-r--r--src/server/game/Accounts/RBAC.h1
-rw-r--r--src/server/scripts/Commands/cs_debug.cpp66
5 files changed, 62 insertions, 18 deletions
diff --git a/sql/base/auth_database.sql b/sql/base/auth_database.sql
index 5ebb0a579eb..da0258f519b 100644
--- a/sql/base/auth_database.sql
+++ b/sql/base/auth_database.sql
@@ -1267,6 +1267,7 @@ INSERT INTO `rbac_linked_permissions` VALUES
(198,316),
(198,317),
(198,318),
+(198,855),
(198,367),
(198,368),
(198,369),
@@ -2084,6 +2085,7 @@ INSERT INTO `rbac_permissions` VALUES
(852,'Command: go offset'),
(853,'Command: .reload conversation_template'),
(854,'Command: .debug conversation'),
+(855,'Command: debug play music'),
(868,'Command: modify power'),
(869,'Command: debug send playerchoice'),
(872,'Command: server debug');
@@ -2331,6 +2333,7 @@ INSERT INTO `updates` VALUES
('2020_03_31_00_auth.sql','BA82A58E95730A397922B6723DA027986E6CD535','RELEASED','2020-03-31 17:00:16',0),
('2020_04_04_00_auth.sql','5F118989A9F8AFA3B2065AB9C2C0BB7D9A0EB97A','RELEASED','2020-04-04 13:23:53',0),
('2020_04_30_00_auth.sql','2FD304B8EF82D529D69287BF22EF061A267F827E','RELEASED','2020-04-30 00:39:29',0),
+('2020_05_19_00_auth.sql','12D9F26538F63546B74793499E8A71BD885E8E5F','RELEASED','2020-05-19 12:00:00',0),
('2020_06_04_00_auth.sql','BA797B558196B1A07F8FF66E5288AD04659CF6AC','RELEASED','2020-06-04 09:57:07',0);
/*!40000 ALTER TABLE `updates` ENABLE KEYS */;
UNLOCK TABLES;
diff --git a/sql/updates/auth/master/2020_05_19_00_auth.sql b/sql/updates/auth/master/2020_05_19_00_auth.sql
new file mode 100644
index 00000000000..7ddeabe630c
--- /dev/null
+++ b/sql/updates/auth/master/2020_05_19_00_auth.sql
@@ -0,0 +1,7 @@
+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);
diff --git a/sql/updates/world/master/2020_06_14_18_world_2017_05_29_00_world.sql b/sql/updates/world/master/2020_06_14_18_world_2017_05_29_00_world.sql
new file mode 100644
index 00000000000..6282e1c7b69
--- /dev/null
+++ b/sql/updates/world/master/2020_06_14_18_world_2017_05_29_00_world.sql
@@ -0,0 +1,3 @@
+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.');
diff --git a/src/server/game/Accounts/RBAC.h b/src/server/game/Accounts/RBAC.h
index 9ad98ac6466..68b3d673a15 100644
--- a/src/server/game/Accounts/RBAC.h
+++ b/src/server/game/Accounts/RBAC.h
@@ -760,6 +760,7 @@ enum RBACPermissions
RBAC_PERM_COMMAND_GO_OFFSET = 852,
RBAC_PERM_COMMAND_RELOAD_CONVERSATION_TEMPLATE = 853,
RBAC_PERM_COMMAND_DEBUG_CONVERSATION = 854,
+ RBAC_PERM_COMMAND_DEBUG_PLAY_MUSIC = 855,
RBAC_PERM_COMMAND_NPC_SPAWNGROUP = 856, // reserved for dynamic_spawning
RBAC_PERM_COMMAND_NPC_DESPAWNGROUP = 857, // reserved for dynamic_spawning
RBAC_PERM_COMMAND_GOBJECT_SPAWNGROUP = 858, // reserved for dynamic_spawning
diff --git a/src/server/scripts/Commands/cs_debug.cpp b/src/server/scripts/Commands/cs_debug.cpp
index 11417b305a5..81bc3e533e1 100644
--- a/src/server/scripts/Commands/cs_debug.cpp
+++ b/src/server/scripts/Commands/cs_debug.cpp
@@ -61,6 +61,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 =
{
@@ -117,8 +118,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);
@@ -126,12 +127,12 @@ public:
return false;
}
- uint32 id = atoul(args);
+ uint32 cinematicId = atoul(args);
- CinematicSequencesEntry const* cineSeq = sCinematicSequencesStore.LookupEntry(id);
+ CinematicSequencesEntry const* cineSeq = sCinematicSequencesStore.LookupEntry(cinematicId);
if (!cineSeq)
{
- handler->PSendSysMessage(LANG_CINEMATIC_NOT_EXIST, id);
+ handler->PSendSysMessage(LANG_CINEMATIC_NOT_EXIST, cinematicId);
handler->SetSentErrorMessage(true);
return false;
}
@@ -139,7 +140,7 @@ public:
// Dump camera locations
if (std::vector<FlyByCamera> const* flyByCameras = GetFlyByCameras(cineSeq->Camera[0]))
{
- handler->PSendSysMessage("Waypoints for sequence %u, camera %u", id, cineSeq->Camera[0]);
+ handler->PSendSysMessage("Waypoints for sequence %u, camera %u", cinematicId, cineSeq->Camera[0]);
uint32 count = 1;
for (FlyByCamera const& cam : *flyByCameras)
{
@@ -149,14 +150,14 @@ public:
handler->PSendSysMessage(SZFMTD " waypoints dumped", flyByCameras->size());
}
- 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);
@@ -164,24 +165,24 @@ public:
return false;
}
- uint32 id = atoul(args);
+ uint32 movieId = atoul(args);
- if (!sMovieStore.LookupEntry(id))
+ 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);
@@ -198,6 +199,8 @@ public:
return false;
}
+ Player* player = handler->GetSession()->GetPlayer();
+
Unit* unit = handler->getSelectedUnit();
if (!unit)
{
@@ -206,15 +209,42 @@ public:
return false;
}
- if (!handler->GetSession()->GetPlayer()->GetTarget().IsEmpty())
- unit->PlayDistanceSound(soundId, handler->GetSession()->GetPlayer());
+ if (player->GetTarget().IsEmpty())
+ 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 (!sSoundKitStore.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)