Skip to content

Commit

Permalink
fix: yonan npc now can exchange items (#1742)
Browse files Browse the repository at this point in the history
Exchange the items Blue, Golden Cordon, Golden Bijou, Sun Medal, Sunray Emblem for a Regalia of Suon (mount item).
  • Loading branch information
lamonato29 authored Oct 25, 2023
1 parent 28027ab commit c3dc39c
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 11 deletions.
20 changes: 9 additions & 11 deletions data-otservbr-global/npc/percybald.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -214,17 +214,15 @@ 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
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
Expand Down
18 changes: 18 additions & 0 deletions data-otservbr-global/npc/yonan.lua
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,24 @@ 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

Expand Down

0 comments on commit c3dc39c

Please sign in to comment.