landsandboat/scripts/commands/addallmounts.lua
Jsx a453b7a3c7
[lua] Fix addallmounts Add addallwarps [Commands] (#9509)
* [lua] Fix addallmounts Add addallwarps [Commands]

Fixes addallmounts for loop to get all mounts
Adds command for adding all warps

* correct while loop
2026-02-26 06:35:33 +01:00

40 lines
978 B
Lua

-----------------------------------
-- func: addallmounts
-- desc: Adds all mount key items to player, granting access to their associated mounts
-----------------------------------
---@type TCommand
local commandObj = {}
commandObj.cmdprops =
{
permission = 1,
parameters = 's'
}
local function error(player, msg)
player:printToPlayer(msg)
player:printToPlayer('!addallmounts (player)')
end
commandObj.onTrigger = function(player, target)
-- validate target
local targ
if target == nil then
targ = player
else
targ = GetPlayerByName(target)
if targ == nil then
error(player, string.format('Player named "%s" not found!', target))
return
end
end
-- add all mount key items
for i = xi.ki.CHOCOBO_COMPANION, xi.ki.CRAKLAW_COMPANION do
targ:addKeyItem(i)
end
player:printToPlayer(string.format('%s now has all mounts.', targ:getName()))
end
return commandObj