diff --git a/src/teleport-to-node.cpp b/src/teleport-to-node.cpp index 7f6b30c..bc26410 100644 --- a/src/teleport-to-node.cpp +++ b/src/teleport-to-node.cpp @@ -1,16 +1,19 @@ /* - * MIT-style module command following AzerothCore boilerplate (std::vector) + * Teleport to nearest mining node (.telenode) — AzerothCore ChatCommandTable style */ #include "ScriptMgr.h" #include "CommandScript.h" #include "Chat.h" +#include "ChatCommand.h" #include "Player.h" #include "GameObject.h" #include #include +using namespace Acore::ChatCommands; + namespace { // === CONFIG === @@ -62,10 +65,10 @@ namespace { player->TeleportTo( node->GetMapId(), - node->GetPositionX(), - node->GetPositionY(), - node->GetPositionZ() + Z_BUMP, - node->GetOrientation() + node->GetPositionX(), + node->GetPositionY(), + node->GetPositionZ() + Z_BUMP, + node->GetOrientation() ); } else @@ -81,26 +84,24 @@ class telenode_commandscript : public CommandScript public: telenode_commandscript() : CommandScript("telenode_commandscript") { } - // EXACTLY like the AzerothCore boilerplate: std::vector - std::vector GetCommands() const override + // Match your si_commandscript style: ChatCommandTable and { name, handler, SEC, Console } + ChatCommandTable GetCommands() const override { - static std::vector commandTable = + static ChatCommandTable commandTable = { - // { name, security, allowConsole, handler, help } - { "telenode", SEC_PLAYER, false, &HandleTeleNode, "" }, + { "telenode", HandleTeleNode, SEC_PLAYER, Console::No }, }; return commandTable; } - static bool HandleTeleNode(ChatHandler* handler, char const* /*args*/) +private: + // No-arg handler (Acore parser will pass only ChatHandler*) + static bool HandleTeleNode(ChatHandler* handler) { if (!handler) return false; - Player* player = nullptr; - if (auto* session = handler->GetSession()) - player = session->GetPlayer(); - + Player* player = handler->GetSession() ? handler->GetSession()->GetPlayer() : nullptr; if (!player) { handler->SendSysMessage("Player only.");