peq-quests/lua_modules/command.lua
brainiac c373f05c45
Fix import of lua_modules/commands (#1420)
This import only works because its succeeding on a search path
from the working directory.

If the lua_modules dir is not in the working directory, the import
fails.
2026-04-05 19:36:43 -04:00

30 lines
851 B
Lua

--copy or symbolic link this file to /server/lua_modules/, it will not work in /server/quests/lua_modules/
local commands_path = "commands/";
local commands = { };
commands["don"] = { 80, require(commands_path .. "don") };
commands["endurance"] = { 50, require(commands_path .. "endurance") };
commands["lockouts"] = { 0, require(commands_path .. "lockouts") };
commands["timeleft"] = { 0, require(commands_path .. "time_left") };
function eq.DispatchCommands(e)
local command = commands[e.command];
for k,v in pairs(e.args) do
eq.debug("[command.lua] key " .. k .. ' value ' .. v, 3);
end
if(command) then
local access = command[1];
if(access > e.self:Admin()) then
e.self:Message(MT.Red, "Access level not high enough.");
return 1;
end
local func = command[2];
func(e);
return 1;
end
return 0;
end