2024-08-01 23:14:47 +02:00
|
|
|
local struct = require "struct"
|
|
|
|
local commands = {}
|
|
|
|
local defaults = {}
|
|
|
|
|
|
|
|
local functions = {}
|
|
|
|
|
|
|
|
print("Compilation des commandes")
|
|
|
|
|
|
|
|
local function addCommands(command, parent, default)
|
|
|
|
commands[command] = parent
|
|
|
|
if (default ~= nil) then
|
|
|
|
defaults[command] = default
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
local function addStatCommands(name, value)
|
|
|
|
addCommands(name .. ".base", name, value.default)
|
|
|
|
addCommands(name .. ".lvl", name, 0)
|
|
|
|
addCommands(name .. ".add", name, 0)
|
|
|
|
addCommands(name .. ".bonus", name, 0)
|
|
|
|
end
|
|
|
|
|
|
|
|
local function addListCommands(name, value)
|
|
|
|
addCommands(name, name)
|
|
|
|
addCommands(name .. ".replace", name)
|
|
|
|
addCommands(name .. ".reset", name)
|
|
|
|
end
|
|
|
|
|
|
|
|
for key, value in pairs(struct) do
|
|
|
|
if (value.dataType == "stat") then
|
|
|
|
addStatCommands(key, value)
|
|
|
|
elseif (value.dataType == "list") then
|
|
|
|
addListCommands(key, value)
|
|
|
|
elseif (value.dataType == "comp") then
|
|
|
|
addListCommands(key, value)
|
|
|
|
else
|
2024-08-01 23:26:55 +02:00
|
|
|
addCommands(key, key, value.default)
|
2024-08-01 23:14:47 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
function functions.getDefaults()
|
|
|
|
return defaults
|
|
|
|
end
|
|
|
|
|
|
|
|
return functions
|