From 055c11e2e515bc95017b555dcfedef4ad64bda28 Mon Sep 17 00:00:00 2001 From: Xaver-DaRed Date: Sun, 8 Feb 2026 19:34:53 +0100 Subject: [PATCH 1/2] Fix treasure weakness time --- scripts/globals/treasure.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/globals/treasure.lua b/scripts/globals/treasure.lua index 8fa8721440e..33c5a849bac 100644 --- a/scripts/globals/treasure.lua +++ b/scripts/globals/treasure.lua @@ -1830,7 +1830,7 @@ xi.treasure.onTrade = function(player, npc, trade, bypassType, bypassReward) player:timer(2000, function(playerEntity) local weaknessDuration = 5 + player:getMainLvl() - treasureLevel weaknessDuration = math.floor(weaknessDuration / 5) - weaknessDuration = utils.clamp(weaknessDuration, 5, 60) + weaknessDuration = utils.clamp(weaknessDuration, 5, 60) * 60 -- Clamp and convert to seconds. playerEntity:addStatusEffect(xi.effect.WEAKNESS, 1, 0, weaknessDuration) playerEntity:messageSpecial(ID.text.CHEST_UNLOCKED + 2) From 348dbd1ecb8cf55ea1ee305bf38df18e5ff75d2e Mon Sep 17 00:00:00 2001 From: Xaver-DaRed Date: Mon, 9 Feb 2026 02:31:02 +0100 Subject: [PATCH 2/2] Minor treasure cleanup Removes 2 local functions. They only make the logic more complex than needed --- scripts/globals/treasure.lua | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/scripts/globals/treasure.lua b/scripts/globals/treasure.lua index 33c5a849bac..b7db8009519 100644 --- a/scripts/globals/treasure.lua +++ b/scripts/globals/treasure.lua @@ -1637,16 +1637,6 @@ local function moveTreasure(npc, respawnTime) end) end -local function openAndMoveTreasure(npc, respawnTime) - npc:entityAnimationPacket(xi.animationString.OPEN_CRATE_GLOW) - moveTreasure(npc, respawnTime) -end - -local function trapAndMoveTreasure(npc, respawnTime) - npc:entityAnimationPacket(xi.animationString.OPEN_CRATE_SMOKE) - moveTreasure(npc, respawnTime) -end - local function handleGilDistribution(player, treasureLevel) local zoneId = player:getZoneID() local playersInZoneTable = {} -- Table with player objects both in alliance and in current player zone. @@ -1834,7 +1824,8 @@ xi.treasure.onTrade = function(player, npc, trade, bypassType, bypassReward) playerEntity:addStatusEffect(xi.effect.WEAKNESS, 1, 0, weaknessDuration) playerEntity:messageSpecial(ID.text.CHEST_UNLOCKED + 2) - trapAndMoveTreasure(npc, respawnType.REGULAR) + npc:entityAnimationPacket(xi.animationString.OPEN_CRATE_SMOKE) + moveTreasure(npc, respawnType.REGULAR) end) player:timer(4000, function(playerEntity) @@ -1883,7 +1874,8 @@ xi.treasure.onTrade = function(player, npc, trade, bypassType, bypassReward) player:timer(2000, function(playerEntity) if npcUtil.giveItem(playerEntity, bypassReward) then playerEntity:messageSpecial(ID.text.CHEST_UNLOCKED) - openAndMoveTreasure(npc, respawnType.REGULAR) + npc:entityAnimationPacket(xi.animationString.OPEN_CRATE_GLOW) + moveTreasure(npc, respawnType.REGULAR) end end) @@ -1903,7 +1895,8 @@ xi.treasure.onTrade = function(player, npc, trade, bypassType, bypassReward) player:timer(2000, function(playerEntity) playerEntity:messageSpecial(ID.text.CHEST_UNLOCKED - 1, bypassReward) -- TODO: message -2 seems to be for other party members? playerEntity:addKeyItem(bypassReward) - openAndMoveTreasure(npc, respawnType.REGULAR) + npc:entityAnimationPacket(xi.animationString.OPEN_CRATE_GLOW) + moveTreasure(npc, respawnType.REGULAR) end) player:timer(4000, function(playerEntity) @@ -1925,7 +1918,8 @@ xi.treasure.onTrade = function(player, npc, trade, bypassType, bypassReward) player:timer(2000, function(playerEntity) playerEntity:messageSpecial(ID.text.CHEST_UNLOCKED - 1, treasureMap) -- TODO: message -2 seems to be for other party members? playerEntity:addKeyItem(treasureMap) - openAndMoveTreasure(npc, respawnType.REGULAR) + npc:entityAnimationPacket(xi.animationString.OPEN_CRATE_GLOW) + moveTreasure(npc, respawnType.REGULAR) end) player:timer(4000, function(playerEntity) @@ -1969,7 +1963,8 @@ xi.treasure.onTrade = function(player, npc, trade, bypassType, bypassReward) player:timer(2000, function(playerEntity) playerEntity:messageSpecial(ID.text.CHEST_UNLOCKED) handleGilDistribution(playerEntity, treasureLevel) - openAndMoveTreasure(npc, respawnType.REGULAR) + npc:entityAnimationPacket(xi.animationString.OPEN_CRATE_GLOW) + moveTreasure(npc, respawnType.REGULAR) end) player:timer(4000, function(playerEntity) @@ -1983,7 +1978,8 @@ xi.treasure.onTrade = function(player, npc, trade, bypassType, bypassReward) player:timer(2000, function(playerEntity) playerEntity:addTreasure(itemId, npc) playerEntity:messageSpecial(ID.text.CHEST_UNLOCKED) - openAndMoveTreasure(npc, respawnType.REGULAR) + npc:entityAnimationPacket(xi.animationString.OPEN_CRATE_GLOW) + moveTreasure(npc, respawnType.REGULAR) end) player:timer(4000, function(playerEntity)