mirror of
https://github.com/redstrate/Kawari.git
synced 2025-06-30 11:47:45 +00:00

-sender was also renamed to command_sender in case we'd like to reserve the word "sender" in the future.
39 lines
1 KiB
Lua
39 lines
1 KiB
Lua
required_rank = GM_RANK_DEBUG
|
|
command_sender = "[unlockaetheryte] "
|
|
|
|
function onCommand(args, player)
|
|
local parts = split(args)
|
|
local argc = #parts
|
|
local usage = "\nThis command unlocks an aetheryte for the user.\nUsage: !unlockaetheryte <on/off> <id>"
|
|
|
|
if argc < 2 then
|
|
printf(player, "This command requires two parameters."..usage)
|
|
return
|
|
end
|
|
|
|
local on = parts[1]
|
|
|
|
if on == "on" then
|
|
on = 0
|
|
elseif on == "off" then
|
|
on = 1
|
|
else
|
|
printf(player, "Error parsing first parameter. Must be either of the words: 'on' or 'off'."..usage)
|
|
return
|
|
end
|
|
|
|
local id = tonumber(parts[2])
|
|
|
|
if not id then
|
|
id = parts[2]
|
|
if id == "all" then
|
|
id = 0
|
|
else
|
|
printf(player, "Error parsing id parameter. Must be an aetheryte id or the word 'all'."..usage)
|
|
return
|
|
end
|
|
end
|
|
|
|
player:unlock_aetheryte(on, id)
|
|
printf(player, "Aetheryte(s) %s had their unlocked status changed!", id)
|
|
end
|