mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-23 21:56:22 +00:00
feat(Core/Commands): Add debug command for applying a spell cooldown. (#20004)
* Init. * Correct wrong query characters.
This commit is contained in:
2
data/sql/updates/pending_db_world/debug-cooldown.sql
Normal file
2
data/sql/updates/pending_db_world/debug-cooldown.sql
Normal file
@@ -0,0 +1,2 @@
|
||||
DELETE FROM `command` WHERE `name` = 'debug cooldown';
|
||||
INSERT INTO `command` (`name`, `security`, `help`) VALUES ('debug cooldown', 3, 'Syntax: .debug cooldown #spellID #cooldownTime #itemID\nApply a cooldown of the given duration (in milliseconds) for the given spell and item ID.');
|
||||
@@ -82,6 +82,7 @@ public:
|
||||
{ "anim", HandleDebugAnimCommand, SEC_ADMINISTRATOR, Console::No },
|
||||
{ "arena", HandleDebugArenaCommand, SEC_ADMINISTRATOR, Console::No },
|
||||
{ "bg", HandleDebugBattlegroundCommand, SEC_ADMINISTRATOR, Console::No },
|
||||
{ "cooldown", HandleDebugCooldownCommand, SEC_ADMINISTRATOR, Console::No },
|
||||
{ "getitemstate", HandleDebugGetItemStateCommand, SEC_ADMINISTRATOR, Console::No },
|
||||
{ "lootrecipient", HandleDebugGetLootRecipientCommand, SEC_ADMINISTRATOR, Console::No },
|
||||
{ "getvalue", HandleDebugGetValueCommand, SEC_ADMINISTRATOR, Console::No },
|
||||
@@ -784,6 +785,33 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleDebugCooldownCommand(ChatHandler* handler, uint32 spell_id, uint32 end_time, Optional<uint32> item_id)
|
||||
{
|
||||
Player* player = handler->GetPlayer();
|
||||
|
||||
if (!player || !spell_id || !end_time)
|
||||
return false;
|
||||
|
||||
if (!sSpellMgr->GetSpellInfo(spell_id))
|
||||
return false;
|
||||
|
||||
if (!item_id)
|
||||
item_id = 0;
|
||||
else if (!sItemStore.LookupEntry(*item_id))
|
||||
return false;
|
||||
|
||||
if (end_time < player->GetSpellCooldownDelay(spell_id))
|
||||
player->RemoveSpellCooldown(spell_id, true);
|
||||
|
||||
player->AddSpellCooldown(spell_id, *item_id, end_time, true, false);
|
||||
|
||||
WorldPacket data;
|
||||
player->BuildCooldownPacket(data, SPELL_COOLDOWN_FLAG_NONE, spell_id, end_time);
|
||||
player->SendDirectMessage(&data);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleDebugArenaCommand(ChatHandler* /*handler*/)
|
||||
{
|
||||
sBattlegroundMgr->ToggleArenaTesting();
|
||||
|
||||
Reference in New Issue
Block a user