diff --git a/data/sql/updates/pending_db_world/rev_1736551855453244500.sql b/data/sql/updates/pending_db_world/rev_1736551855453244500.sql new file mode 100644 index 000000000..db974204a --- /dev/null +++ b/data/sql/updates/pending_db_world/rev_1736551855453244500.sql @@ -0,0 +1,9 @@ +-- +DELETE FROM `acore_string` WHERE `entry` IN (5086, 5087); +INSERT INTO `acore_string` (`entry`, `content_default`) VALUES +(5086, 'No doors found within range ({} yards).'), +(5087, 'Door {} (Entry: {}) opened!'); + +DELETE FROM `command` WHERE `name` = 'opendoor'; +INSERT INTO `command` (`name`, `security`, `help`) VALUES +('opendoor', 1, 'Syntax: .opendoor [$range]\nOpens the nearest door within the range provided (default 5.0yd)'); diff --git a/src/server/game/Miscellaneous/Language.h b/src/server/game/Miscellaneous/Language.h index d0219e83b..2911adad2 100644 --- a/src/server/game/Miscellaneous/Language.h +++ b/src/server/game/Miscellaneous/Language.h @@ -1145,7 +1145,10 @@ enum AcoreStrings LANG_CMD_GO_RESPAWN = 5085, - // Room for more strings 5086-9999 + LANG_CMD_NO_DOOR_FOUND = 5086, + LANG_CMD_DOOR_OPENED = 5087, + + // Room for more strings 5088-9999 // Level requirement notifications LANG_SAY_REQ = 6604, diff --git a/src/server/scripts/Commands/cs_misc.cpp b/src/server/scripts/Commands/cs_misc.cpp index 17ee47611..6613f6adc 100644 --- a/src/server/scripts/Commands/cs_misc.cpp +++ b/src/server/scripts/Commands/cs_misc.cpp @@ -146,7 +146,8 @@ public: { "playall", HandlePlayAllCommand, SEC_GAMEMASTER, Console::No }, { "skirmish", HandleSkirmishCommand, SEC_ADMINISTRATOR, Console::No }, { "mailbox", HandleMailBoxCommand, SEC_MODERATOR, Console::No }, - { "string", HandleStringCommand, SEC_GAMEMASTER, Console::No } + { "string", HandleStringCommand, SEC_GAMEMASTER, Console::No }, + { "opendoor", HandleOpenDoorCommand, SEC_GAMEMASTER, Console::No } }; return commandTable; @@ -3034,6 +3035,19 @@ public: return true; } } + + static bool HandleOpenDoorCommand(ChatHandler* handler, Optional range) + { + if (GameObject* go = handler->GetPlayer()->FindNearestGameObjectOfType(GAMEOBJECT_TYPE_DOOR, range ? *range : 5.0f)) + { + go->SetGoState(GO_STATE_ACTIVE); + handler->PSendSysMessage(LANG_CMD_DOOR_OPENED, go->GetName(), go->GetEntry()); + return true; + } + + handler->SendErrorMessage(LANG_CMD_NO_DOOR_FOUND, range ? *range : 5.0f); + return false; + } }; void AddSC_misc_commandscript()