From 18ec4a7b180e0068a98a4131899001d24915a900 Mon Sep 17 00:00:00 2001 From: Carlos Eduardo Silva <104630060+CarlosE-Dev@users.noreply.github.com> Date: Mon, 18 Mar 2024 21:01:24 -0300 Subject: [PATCH] fix: incorrect pricing for enchant/recharge with silver tokens (#2463) The NPC Cledwyn, who performs enchant/recharge of various items in exchange for silver tokens is ALWAYS charging 2 silver tokens for each operation. However, some of them should cost 5 silver tokens. --- data-otservbr-global/npc/cledwyn.lua | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/data-otservbr-global/npc/cledwyn.lua b/data-otservbr-global/npc/cledwyn.lua index 6e9efd9f76c..7bea164c4b6 100644 --- a/data-otservbr-global/npc/cledwyn.lua +++ b/data-otservbr-global/npc/cledwyn.lua @@ -97,6 +97,8 @@ end local charge = {} +local chargePrice = {} + local chargeItem = { ["pendulet"] = { noChargeID = 29429, ChargeID = 30344 }, ["sleep shawl"] = { noChargeID = 29428, ChargeID = 30342 }, @@ -137,18 +139,20 @@ local function creatureSayCallback(npc, creature, type, message) elseif table.contains({ "pendulet", "sleep shawl", "blister ring", "theurgic amulet", "ring of souls", "turtle amulet" }, message:lower()) and npcHandler:getTopic(playerId) == 1 then npcHandler:say("Should I enchant the item " .. message .. " for 2 " .. ItemType(npc:getCurrency()):getPluralName():lower() .. "?", npc, creature) charge = message:lower() + chargePrice = 2 npcHandler:setTopic(playerId, 2) elseif table.contains({ "spiritthorn ring", "alicorn ring", "arcanomancer sigil", "arboreal ring" }, message:lower()) and npcHandler:getTopic(playerId) == 1 then npcHandler:say("Should I enchant the item " .. message .. " for 5 " .. ItemType(npc:getCurrency()):getPluralName():lower() .. "?", npc, creature) charge = message:lower() + chargePrice = 5 npcHandler:setTopic(playerId, 2) elseif npcHandler:getTopic(playerId) == 2 then if MsgContains(message, "yes") then if not chargeItem[charge] then npcHandler:say("Sorry, you don't have an unenchanted " .. charge .. ".", npc, creature) else - if (player:getItemCount(npc:getCurrency()) >= 2) and (player:getItemCount(chargeItem[charge].noChargeID) >= 1) then - player:removeItem(npc:getCurrency(), 2) + if (player:getItemCount(npc:getCurrency()) >= chargePrice) and (player:getItemCount(chargeItem[charge].noChargeID) >= 1) then + player:removeItem(npc:getCurrency(), chargePrice) player:removeItem(chargeItem[charge].noChargeID, 1) local itemAdd = player:addItem(chargeItem[charge].ChargeID, 1) npcHandler:say("Ah, excellent. Here is your " .. itemAdd:getName():lower() .. ".", npc, creature)