From a435929ffde26e301a135daa464ed394556dcc38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bruno=20Lu=C3=ADs=20Lucarelo=20Lamonato?= Date: Tue, 24 Oct 2023 14:31:32 -0300 Subject: [PATCH 1/4] fix: yonan npc exchanging items adds the possibility of exchanging items with the npc --- data-otservbr-global/npc/yonan.lua | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/data-otservbr-global/npc/yonan.lua b/data-otservbr-global/npc/yonan.lua index 65aee681ac9..55e0b516e0d 100644 --- a/data-otservbr-global/npc/yonan.lua +++ b/data-otservbr-global/npc/yonan.lua @@ -179,6 +179,25 @@ local function creatureSayCallback(npc, creature, type, message) npcHandler:say({ "Sorry." }, npc, creature) -- It needs to be revised, it's not the same as the global end end + + if MsgContains(message, "regalia of suon") then + npcHandler:say({ "You have all parts of the famous Regalia of Suon! Only a few of them were ever forged, back in the times of the old empire. You are holding a very rare and precious treasure, my friend. ... As you have all four pieces, I could combine them into the full insignia. Shall I do this for you?" }, npc, creature) + npcHandler:setTopic(playerId, 5) + + elseif MsgContains(message, "yes") and npcHandler:getTopic(playerId) == 5 then + if player:getItemById(31572, 1) and player:getItemById(31573, 1) and player:getItemById(31574, 1) and player:getItemById(31575, 1) then + if(player:addItem(31576,1)) then -- regalia of suon + player:removeItem(31572, 1) -- blue and golden cordon + player:removeItem(31573, 1) -- sun medal + player:removeItem(31574, 1) -- sunray emblem + player:removeItem(31575, 1) -- golden bijou + npcHandler:say({ "Well then, let me have a look." }, npc, creature) + end + else + npcHandler:say({ "Sorry, you dont have the necessary items." }, npc, creature) -- It needs to be revised, it's not the same as the global + end + end + return true end From 1087ac856045f860cf29c4f4bd26ed6614107ed6 Mon Sep 17 00:00:00 2001 From: GitHub Actions Date: Tue, 24 Oct 2023 17:32:39 +0000 Subject: [PATCH 2/4] Lua code format - (Stylua) --- data-otservbr-global/npc/yonan.lua | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/data-otservbr-global/npc/yonan.lua b/data-otservbr-global/npc/yonan.lua index 55e0b516e0d..1c6101ab842 100644 --- a/data-otservbr-global/npc/yonan.lua +++ b/data-otservbr-global/npc/yonan.lua @@ -183,15 +183,14 @@ local function creatureSayCallback(npc, creature, type, message) if MsgContains(message, "regalia of suon") then npcHandler:say({ "You have all parts of the famous Regalia of Suon! Only a few of them were ever forged, back in the times of the old empire. You are holding a very rare and precious treasure, my friend. ... As you have all four pieces, I could combine them into the full insignia. Shall I do this for you?" }, npc, creature) npcHandler:setTopic(playerId, 5) - elseif MsgContains(message, "yes") and npcHandler:getTopic(playerId) == 5 then - if player:getItemById(31572, 1) and player:getItemById(31573, 1) and player:getItemById(31574, 1) and player:getItemById(31575, 1) then - if(player:addItem(31576,1)) then -- regalia of suon + if player:getItemById(31572, 1) and player:getItemById(31573, 1) and player:getItemById(31574, 1) and player:getItemById(31575, 1) then + if player:addItem(31576, 1) then -- regalia of suon player:removeItem(31572, 1) -- blue and golden cordon player:removeItem(31573, 1) -- sun medal player:removeItem(31574, 1) -- sunray emblem player:removeItem(31575, 1) -- golden bijou - npcHandler:say({ "Well then, let me have a look." }, npc, creature) + npcHandler:say({ "Well then, let me have a look." }, npc, creature) end else npcHandler:say({ "Sorry, you dont have the necessary items." }, npc, creature) -- It needs to be revised, it's not the same as the global From 66fa5993ff3cf0220ef0e2dc1adc2bd294189309 Mon Sep 17 00:00:00 2001 From: GitHub Actions Date: Wed, 25 Oct 2023 02:00:55 +0000 Subject: [PATCH 3/4] Lua code format - (Stylua) --- data-otservbr-global/npc/percybald.lua | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/data-otservbr-global/npc/percybald.lua b/data-otservbr-global/npc/percybald.lua index 957504acc49..be04fe59109 100644 --- a/data-otservbr-global/npc/percybald.lua +++ b/data-otservbr-global/npc/percybald.lua @@ -144,17 +144,17 @@ local function creatureSayCallback(npc, creature, type, message) npcHandler:say({ "Great! To clarify, donating 30,000 silver tokens and 25,000 gold tokens will entitle you to a unique outfit. ...", "For 15,000 silver tokens and 12,500 gold tokens, you will receive the {armor}. For an additional 7,500 silver tokens and 6,250 gold tokens each, you can also receive the {shield} and {crown}. ...", - "What will you choose?" + "What will you choose?", }, npc, creature) npcHandler:setTopic(playerId, 13) - + -- Topic 13: User already accepted to learn about donations, further actions here elseif npcHandler:getTopic(playerId) == 13 then npcHandler:say("If you haven't made up your mind, please come back when you are ready.", npc, creature) npcHandler:setTopic(playerId, 0) elseif npcHandler:getTopic(playerId) == 14 then if player:getStorageValue(Storage.OutfitQuest.RoyalCostumeOutfit) < 1 then - if (player:removeItem(22516, 15000) and player:removeItem(22721, 12500)) then + if player:removeItem(22516, 15000) and player:removeItem(22721, 12500) then npcHandler:say("Take this armor as a token of great gratitude. Let us forever remember this day, my friend!", npc, creature) player:addOutfit(1457) player:addOutfit(1456) @@ -170,7 +170,7 @@ local function creatureSayCallback(npc, creature, type, message) elseif npcHandler:getTopic(playerId) == 15 then if player:getStorageValue(Storage.OutfitQuest.RoyalCostumeOutfit) == 1 then if player:getStorageValue(Storage.OutfitQuest.RoyalCostumeOutfit) < 2 then - if (player:removeItem(22516, 7500) and player:removeItem(22721, 6250)) then + if player:removeItem(22516, 7500) and player:removeItem(22721, 6250) then npcHandler:say("Take this sheild as a token of great gratitude. Let us forever remember this day, my friend. ", npc, creature) player:addOutfitAddon(1457, 1) player:addOutfitAddon(1456, 1) @@ -193,7 +193,7 @@ local function creatureSayCallback(npc, creature, type, message) elseif npcHandler:getTopic(playerId) == 16 then if player:getStorageValue(Storage.OutfitQuest.RoyalCostumeOutfit) == 2 then if player:getStorageValue(Storage.OutfitQuest.RoyalCostumeOutfit) < 3 then - if (player:removeItem(22516, 7500) and player:removeItem(22721, 6250)) then + if player:removeItem(22516, 7500) and player:removeItem(22721, 6250) then npcHandler:say("Take this crown as a token of great gratitude. Let us forever remember this day, my friend. ", npc, creature) player:addOutfitAddon(1457, 2) player:addOutfitAddon(1456, 2) @@ -214,16 +214,14 @@ local function creatureSayCallback(npc, creature, type, message) end npcHandler:setTopic(playerId, 13) end - + -- Handle options for armor, shield, and crown elseif (MsgContains(message, "armor")) and npcHandler:getTopic(playerId) == 13 then npcHandler:say("Would you like to donate 15,000 silver tokens and 12,500 gold tokens for a unique red armor?", npc, creature) npcHandler:setTopic(playerId, 14) - elseif (MsgContains(message, "shield")) and npcHandler:getTopic(playerId) == 13 then npcHandler:say("Would you like to donate 7,500 silver tokens and 6,250 gold tokens for a unique shield?", npc, creature) npcHandler:setTopic(playerId, 15) - elseif (MsgContains(message, "crown")) and npcHandler:getTopic(playerId) == 13 then npcHandler:say("Would you like to donate 7,500 silver tokens and 6,250 gold tokens for a unique crown?", npc, creature) npcHandler:setTopic(playerId, 16) From 87855ed31de1f22fe1559e4daabbed71f3ee4378 Mon Sep 17 00:00:00 2001 From: Eduardo Dantas Date: Tue, 24 Oct 2023 23:04:14 -0300 Subject: [PATCH 4/4] fix --- data-otservbr-global/npc/percybald.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/data-otservbr-global/npc/percybald.lua b/data-otservbr-global/npc/percybald.lua index be04fe59109..5ecb521302e 100644 --- a/data-otservbr-global/npc/percybald.lua +++ b/data-otservbr-global/npc/percybald.lua @@ -216,13 +216,13 @@ local function creatureSayCallback(npc, creature, type, message) end -- Handle options for armor, shield, and crown - elseif (MsgContains(message, "armor")) and npcHandler:getTopic(playerId) == 13 then + elseif MsgContains(message, "armor") and npcHandler:getTopic(playerId) == 13 then npcHandler:say("Would you like to donate 15,000 silver tokens and 12,500 gold tokens for a unique red armor?", npc, creature) npcHandler:setTopic(playerId, 14) - elseif (MsgContains(message, "shield")) and npcHandler:getTopic(playerId) == 13 then + elseif MsgContains(message, "shield") and npcHandler:getTopic(playerId) == 13 then npcHandler:say("Would you like to donate 7,500 silver tokens and 6,250 gold tokens for a unique shield?", npc, creature) npcHandler:setTopic(playerId, 15) - elseif (MsgContains(message, "crown")) and npcHandler:getTopic(playerId) == 13 then + elseif MsgContains(message, "crown") and npcHandler:getTopic(playerId) == 13 then npcHandler:say("Would you like to donate 7,500 silver tokens and 6,250 gold tokens for a unique crown?", npc, creature) npcHandler:setTopic(playerId, 16) end