From c93fb05515dd1768cda9285154b7916b2c30c4d3 Mon Sep 17 00:00:00 2001 From: Kempec Halk <80704304+Gozzim@users.noreply.github.com> Date: Wed, 6 Jul 2022 03:55:37 +0200 Subject: [PATCH] feat(Core/Commands): Debug Spell Visuals Command (#12216) * feat(Core/Commands): Debug Spell Visuals Command * feat(DB/Commands): Debug Visual Help * Add missing eol at eof --- .../rev_1656377467861686900.sql | 4 +++ src/server/scripts/Commands/cs_debug.cpp | 25 ++++++++++++++++++- 2 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 data/sql/updates/pending_db_world/rev_1656377467861686900.sql diff --git a/data/sql/updates/pending_db_world/rev_1656377467861686900.sql b/data/sql/updates/pending_db_world/rev_1656377467861686900.sql new file mode 100644 index 000000000..a5e89a128 --- /dev/null +++ b/data/sql/updates/pending_db_world/rev_1656377467861686900.sql @@ -0,0 +1,4 @@ +-- +DELETE FROM `command` WHERE `name` = 'debug play visual'; +INSERT INTO `command` (`name`, `security`, `help`) VALUES +('debug play visual', 3, 'Syntax: .debug play visual #visualid\r\nPlay spell visual with #visualid.\n#visualid refers to the ID from SpellVisualKit.dbc'); diff --git a/src/server/scripts/Commands/cs_debug.cpp b/src/server/scripts/Commands/cs_debug.cpp index a5cf1b9fa..e0c12e927 100644 --- a/src/server/scripts/Commands/cs_debug.cpp +++ b/src/server/scripts/Commands/cs_debug.cpp @@ -58,7 +58,8 @@ public: { "cinematic", HandleDebugPlayCinematicCommand, SEC_ADMINISTRATOR, Console::No }, { "movie", HandleDebugPlayMovieCommand, SEC_ADMINISTRATOR, Console::No }, { "sound", HandleDebugPlaySoundCommand, SEC_ADMINISTRATOR, Console::No }, - { "music", HandleDebugPlayMusicCommand, SEC_ADMINISTRATOR, Console::No } + { "music", HandleDebugPlayMusicCommand, SEC_ADMINISTRATOR, Console::No }, + { "visual", HandleDebugVisualCommand, SEC_ADMINISTRATOR, Console::No } }; static ChatCommandTable debugSendCommandTable = { @@ -203,6 +204,28 @@ public: return true; } + static bool HandleDebugVisualCommand(ChatHandler* handler, uint32 visualId) + { + if (!visualId) + { + handler->SendSysMessage(LANG_BAD_VALUE); + handler->SetSentErrorMessage(true); + return false; + } + + Player* player = handler->GetPlayer(); + Unit* target = handler->getSelectedUnit(); + + if (!target) + { + player->SendPlaySpellVisual(visualId); + return true; + } + + player->SendPlaySpellImpact(target->GetGUID(), visualId); + return true; + } + static bool HandleDebugSendSpellFailCommand(ChatHandler* handler, SpellCastResult result, Optional failArg1, Optional failArg2) { WorldPacket data(SMSG_CAST_FAILED, 5);