2021-01-18 13:34:00 -05:00
|
|
|
-----------------------------------
|
2016-07-29 08:35:15 -06:00
|
|
|
-- func: capskill
|
2016-01-16 01:26:33 -05:00
|
|
|
-- desc: Caps a specific skill.
|
2021-01-18 13:34:00 -05:00
|
|
|
-----------------------------------
|
2024-08-25 10:54:45 -04:00
|
|
|
---@type TCommand
|
2023-09-02 07:01:35 -04:00
|
|
|
local commandObj = {}
|
|
|
|
|
|
|
|
|
|
commandObj.cmdprops =
|
2016-01-16 01:26:33 -05:00
|
|
|
{
|
|
|
|
|
permission = 1,
|
2023-08-28 21:02:28 -04:00
|
|
|
parameters = 's'
|
2020-02-19 21:40:57 -08:00
|
|
|
}
|
2016-01-16 01:26:33 -05: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('!capskill <skillID>')
|
2020-02-19 21:40:57 -08:00
|
|
|
end
|
2017-08-03 12:31:51 -04:00
|
|
|
|
2023-09-02 07:01:35 -04:00
|
|
|
commandObj.onTrigger = function(player, skillId)
|
2017-08-03 12:31:51 -04:00
|
|
|
-- validate skillId
|
2022-11-04 10:44:34 -04:00
|
|
|
if skillId == nil then
|
2023-08-28 21:02:28 -04:00
|
|
|
error(player, 'You must provide a skillID.')
|
2020-02-19 21:40:57 -08:00
|
|
|
return
|
2016-01-16 01:26:33 -05:00
|
|
|
end
|
2022-11-22 14:39:00 -05:00
|
|
|
|
2021-04-01 15:10:15 -04:00
|
|
|
skillId = tonumber(skillId) or xi.skill[string.upper(skillId)]
|
2022-11-04 10:44:34 -04:00
|
|
|
if skillId == nil or skillId == 0 then
|
2023-08-28 21:02:28 -04:00
|
|
|
error(player, 'Invalid skillID.')
|
2020-02-19 21:40:57 -08:00
|
|
|
return
|
2016-01-16 01:26:33 -05:00
|
|
|
end
|
2017-07-24 20:55:28 -04:00
|
|
|
|
2017-08-03 12:31:51 -04:00
|
|
|
-- cap skill
|
2022-11-06 08:16:08 -05:00
|
|
|
player:capSkill(skillId)
|
2023-12-09 23:54:00 +00:00
|
|
|
player:printToPlayer(string.format('Capped skillID %i.', skillId))
|
2016-01-16 01:26:33 -05:00
|
|
|
end
|
2023-09-02 07:01:35 -04:00
|
|
|
|
|
|
|
|
return commandObj
|