Attempting to fix chat command call
This commit is contained in:
parent
e792efff8c
commit
3e07ca5ee7
@ -1,23 +1,27 @@
|
||||
// src/teleport-to-node.cpp
|
||||
#include "ScriptMgr.h"
|
||||
#include "CommandScript.h"
|
||||
#include "Chat.h"
|
||||
#include "ChatCommand.h"
|
||||
#include "Player.h"
|
||||
#include "GameObject.h"
|
||||
|
||||
using namespace Acore::ChatCommands;
|
||||
|
||||
namespace
|
||||
{
|
||||
// === CONFIG ===
|
||||
static constexpr float TELEPORT_DISTANCE = 200.0f; // yards
|
||||
static constexpr float Z_BUMP = 1.5f; // anti-clip offset
|
||||
static constexpr float TELEPORT_DISTANCE = 200.0f; // yards
|
||||
static constexpr float Z_BUMP = 1.5f; // anti-clip offset
|
||||
|
||||
// Mining node entries (trim this list to what you actually want)
|
||||
// Mining node entries (trim as needed)
|
||||
static const std::vector<uint32> kVeinEntries = {
|
||||
324, 1610, 1667, 1731, 1732, 1733, 1734, 2054, 2055, 3763, 3764, 19903,
|
||||
73940, 73941, 103711, 103713, 105569, 123848, 150080, 150082, 175404,
|
||||
176643, 177388, 179144, 179224, 180215, 181109, 181248, 181249, 181557,
|
||||
185557, 191133, 1735, 2040, 2047, 2653, 73939, 123309, 123310, 150079,
|
||||
150081, 165658, 176645, 181108, 181555, 181556, 181569, 181570, 185877,
|
||||
189978, 189979, 189980, 189981, 195036,
|
||||
324,1610,1667,1731,1732,1733,1734,2054,2055,3763,3764,19903,
|
||||
73940,73941,103711,103713,105569,123848,150080,150082,175404,
|
||||
176643,177388,179144,179224,180215,181109,181248,181249,181557,
|
||||
185557,191133,1735,2040,2047,2653,73939,123309,123310,150079,
|
||||
150081,165658,176645,181108,181555,181556,181569,181570,185877,
|
||||
189978,189979,189980,189981,195036,
|
||||
};
|
||||
|
||||
static GameObject* FindNearestVein(Player* player, float maxRange)
|
||||
@ -48,7 +52,7 @@ namespace
|
||||
if (player->IsInCombat())
|
||||
{
|
||||
ChatHandler(player->GetSession()).PSendSysMessage("You can't use this while in combat.");
|
||||
return true; // handled
|
||||
return true;
|
||||
}
|
||||
|
||||
if (GameObject* node = FindNearestVein(player, TELEPORT_DISTANCE))
|
||||
@ -74,27 +78,30 @@ class telenode_commandscript : public CommandScript
|
||||
public:
|
||||
telenode_commandscript() : CommandScript("telenode_commandscript") { }
|
||||
|
||||
// NOTE: Use Acore::ChatCommands::ChatCommandTable (or the 'using' above)
|
||||
ChatCommandTable GetCommands() const override
|
||||
{
|
||||
static ChatCommandTable commandTable =
|
||||
static ChatCommandTable cmds =
|
||||
{
|
||||
// .telenode
|
||||
// .telenode (player-only; change SEC if you want)
|
||||
{ "telenode",
|
||||
SEC_PLAYER,
|
||||
Console::No,
|
||||
// handler signature with no args
|
||||
[](ChatHandler* handler)
|
||||
{
|
||||
if (Player* player = handler->GetSession() ? handler->GetSession()->GetPlayer() : nullptr)
|
||||
return DoTeleNode(player);
|
||||
if (auto* session = handler->GetSession())
|
||||
return DoTeleNode(session->GetPlayer());
|
||||
return false;
|
||||
},
|
||||
SEC_PLAYER, // usable by anyone; override via DB 'command' table if desired
|
||||
Console::No
|
||||
"" // help text (optional)
|
||||
},
|
||||
};
|
||||
return commandTable;
|
||||
return cmds;
|
||||
}
|
||||
};
|
||||
|
||||
// Module entry point (call this from your module's loader)
|
||||
// Called by your module loader
|
||||
void Addmod_telenodeScripts()
|
||||
{
|
||||
new telenode_commandscript();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user