2024-08-25 10:54:45 -04:00
|
|
|
---@type TCommand
|
2023-09-02 07:01:35 -04:00
|
|
|
local commandObj = {}
|
|
|
|
|
|
|
|
|
|
commandObj.cmdprops =
|
2020-02-29 00:40:44 +02:00
|
|
|
{
|
2020-03-11 09:49:25 +02:00
|
|
|
permission = 1,
|
2023-08-28 21:02:28 -04:00
|
|
|
parameters = 'sss'
|
2020-07-27 16:54:47 -07:00
|
|
|
}
|
2020-02-29 00:40:44 +02:00
|
|
|
|
2023-09-02 07:01:35 -04:00
|
|
|
local function error(player, msg)
|
2023-12-09 23:54:00 +00:00
|
|
|
player:printToPlayer(msg)
|
|
|
|
|
player:printToPlayer('!mount <mount ID> (player)')
|
2020-02-29 00:40:44 +02:00
|
|
|
end
|
|
|
|
|
|
2023-09-02 07:01:35 -04:00
|
|
|
commandObj.onTrigger = function(player, mount, target)
|
2020-02-29 11:18:45 +02:00
|
|
|
-- Default to Chocobo (0)
|
2022-11-04 10:44:34 -04:00
|
|
|
if mount == nil then
|
2020-02-29 11:18:45 +02:00
|
|
|
mount = 0
|
2020-02-29 00:40:44 +02:00
|
|
|
end
|
|
|
|
|
|
2020-02-29 11:18:45 +02:00
|
|
|
-- validate mount
|
2021-04-01 15:10:15 -04:00
|
|
|
mount = tonumber(mount) or xi.mount[string.upper(mount)]
|
2022-11-04 10:44:34 -04:00
|
|
|
if mount == nil or mount < 0 or mount >= xi.mount.MOUNT_MAX then
|
2023-08-28 21:02:28 -04:00
|
|
|
error(player, 'Invalid mount ID.')
|
2020-02-29 00:40:44 +02:00
|
|
|
return
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- validate target
|
|
|
|
|
local targ
|
2022-10-30 09:13:30 -04:00
|
|
|
if target == nil then
|
2020-02-29 00:40:44 +02:00
|
|
|
targ = player
|
|
|
|
|
else
|
|
|
|
|
targ = GetPlayerByName(target)
|
2022-10-30 09:13:30 -04:00
|
|
|
if targ == nil then
|
2023-08-28 21:02:28 -04:00
|
|
|
error(player, string.format('Player named "%s" not found!', target))
|
2020-02-29 00:40:44 +02:00
|
|
|
return
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
2026-02-19 22:48:02 -07:00
|
|
|
targ:addStatusEffect(xi.effect.MOUNTED, { power = mount, origin = player, silent = true })
|
2022-07-05 12:26:51 +03:00
|
|
|
end
|
2023-09-02 07:01:35 -04:00
|
|
|
|
|
|
|
|
return commandObj
|