landsandboat/scripts/effects/level_sync.lua

38 lines
1 KiB
Lua
Raw Permalink Normal View History

2016-01-16 01:26:33 -05:00
-----------------------------------
2021-04-01 15:10:15 -04:00
-- xi.effect.LEVEL_SYNC
2016-01-16 01:26:33 -05:00
-----------------------------------
---@type TEffect
local effectObject = {}
2016-01-16 01:26:33 -05:00
effectObject.onEffectGain = function(target, effect)
target:levelRestriction(effect:getPower())
2021-04-01 15:10:15 -04:00
if target:getObjType() == xi.objType.PC then
target:clearTrusts()
if xi.settings.map.DESPAWN_JUGPETS_BELOW_MINIMUM_LEVEL then
local pet = target:getPet()
local masterLevel = target:getMainLvl()
if
pet and
pet:getObjType() == xi.objType.PET and
target:hasJugPet() and -- hasJugPet checks m_PBaseEntity->PPet's check type, not the target's pet type.
masterLevel < pet:getMinimumPetLevel()
then
target:despawnPet()
end
end
end
end
2016-01-16 01:26:33 -05:00
effectObject.onEffectTick = function(target, effect)
end
2016-01-16 01:26:33 -05:00
effectObject.onEffectLose = function(target, effect)
target:levelRestriction(0)
target:disableLevelSync()
end
return effectObject