2021-10-19 08:21:17 -05:00
|
|
|
-----------------------------------
|
|
|
|
|
-- func: setProgress
|
|
|
|
|
-- desc: changes progress inside an instance
|
|
|
|
|
-----------------------------------
|
2024-08-25 10:54:45 -04:00
|
|
|
---@type TCommand
|
2023-09-02 07:01:35 -04:00
|
|
|
local commandObj = {}
|
2021-10-19 08:21:17 -05:00
|
|
|
|
2023-09-02 07:01:35 -04:00
|
|
|
commandObj.cmdprops =
|
2021-10-19 08:21:17 -05:00
|
|
|
{
|
|
|
|
|
permission = 1,
|
2023-08-28 21:02:28 -04:00
|
|
|
parameters = 'i'
|
2021-10-19 08:21:17 -05:00
|
|
|
}
|
|
|
|
|
|
2023-09-02 07:01:35 -04:00
|
|
|
commandObj.onTrigger = function(player, progress)
|
2021-10-19 08:21:17 -05:00
|
|
|
local zone = player:getZone()
|
2024-08-25 12:01:53 -04:00
|
|
|
if not zone then
|
|
|
|
|
return
|
|
|
|
|
end
|
2021-10-19 08:21:17 -05:00
|
|
|
|
2023-08-15 12:40:21 -04:00
|
|
|
if zone:getTypeMask() == xi.zoneType.INSTANCED then
|
2021-10-19 08:21:17 -05:00
|
|
|
local instance = player:getInstance()
|
2024-08-25 12:01:53 -04:00
|
|
|
if not instance then
|
|
|
|
|
return
|
|
|
|
|
end
|
|
|
|
|
|
2021-10-19 08:21:17 -05:00
|
|
|
local startProgress = instance:getProgress()
|
|
|
|
|
|
|
|
|
|
instance:setProgress(progress)
|
|
|
|
|
|
2023-12-09 23:54:00 +00:00
|
|
|
player:printToPlayer(string.format('Progress changed from %i to %i', startProgress, progress))
|
2021-10-19 08:21:17 -05:00
|
|
|
else
|
2023-12-09 23:54:00 +00:00
|
|
|
player:printToPlayer('Must be in an Instanced zone')
|
2021-10-19 08:21:17 -05:00
|
|
|
end
|
|
|
|
|
end
|
2023-09-02 07:01:35 -04:00
|
|
|
|
|
|
|
|
return commandObj
|