Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: yonan npc now can exchange items #1742

Merged
merged 5 commits into from
Oct 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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