From 3f38bba7f9ce6f22f58f03e316151bf2e29b58f4 Mon Sep 17 00:00:00 2001 From: KnowOne Date: Mon, 24 Feb 2025 12:02:54 -0600 Subject: [PATCH] Quest setting sun to if --- scripts/globals/quests.lua | 2 +- scripts/quests/sandoria/The_Setting_Sun.lua | 80 +++++++++++++++++++ .../Northern_San_dOria/DefaultActions.lua | 7 +- .../Northern_San_dOria/npcs/Vamorcote.lua | 49 ------------ 4 files changed, 85 insertions(+), 53 deletions(-) create mode 100644 scripts/quests/sandoria/The_Setting_Sun.lua delete mode 100644 scripts/zones/Northern_San_dOria/npcs/Vamorcote.lua diff --git a/scripts/globals/quests.lua b/scripts/globals/quests.lua index e0542692e26..694f62030ad 100644 --- a/scripts/globals/quests.lua +++ b/scripts/globals/quests.lua @@ -68,7 +68,7 @@ xi.quest.id = THE_MERCHANTS_BIDDING = 69, -- ± UNEXPECTED_TREASURE = 70, BLACKMAIL = 71, -- + Converted - THE_SETTING_SUN = 72, -- + + THE_SETTING_SUN = 72, -- + Converted DISTANT_LOYALTIES = 74, -- ± Converted THE_RIVALRY = 75, -- ± THE_COMPETITION = 76, -- ± diff --git a/scripts/quests/sandoria/The_Setting_Sun.lua b/scripts/quests/sandoria/The_Setting_Sun.lua new file mode 100644 index 00000000000..4984f81eb69 --- /dev/null +++ b/scripts/quests/sandoria/The_Setting_Sun.lua @@ -0,0 +1,80 @@ +----------------------------------- +-- The Setting Sun +----------------------------------- +-- LogID: 0 QuestID: 72 +----------------------------------- +-- Vamorcote: !pos -137.070 10.999 161.855 231 +----------------------------------- + +local quest = Quest:new(xi.questLog.SANDORIA, xi.quest.id.sandoria.THE_SETTING_SUN) + +quest.reward = +{ + gil = 10000, +} + +quest.sections = +{ + { + check = function(player, status, vars) + return status == xi.questStatus.QUEST_AVAILABLE and + player:getFameLevel(xi.fameArea.SANDORIA) >= 5 and + player:hasCompletedQuest(xi.questLog.SANDORIA, xi.quest.id.sandoria.BLACKMAIL) + end, + + [xi.zone.NORTHERN_SAN_DORIA] = + { + ['Vamorcote'] = quest:progressEvent(654, { [1] = xi.item.ENGRAVED_KEY, [2] = xi.item.ENGRAVED_KEY }), + + onEventFinish = + { + [654] = function(player, csid, option, npc) + if option == 1 then + quest:begin(player) + end + end, + }, + }, + }, + { + check = function(player, status, vars) + return status == xi.questStatus.QUEST_ACCEPTED + end, + + [xi.zone.NORTHERN_SAN_DORIA] = + { + ['Vamorcote'] = + { + onTrade = function(player, npc, trade) + if npcUtil.tradeHasExactly(trade, xi.item.ENGRAVED_KEY) then + return quest:progressEvent(658) + end + end, + + onTrigger = quest:event(655, { [2] = xi.item.ENGRAVED_KEY }), + }, + onEventFinish = + { + [658] = function(player, csid, option, npc) + if quest:complete(player) then + player:confirmTrade() + player:needToZone(true) + end + end, + }, + }, + }, + { + check = function(player, status, vars) + return status == xi.questStatus.QUEST_COMPLETED and + player:needToZone() + end, + + [xi.zone.NORTHERN_SAN_DORIA] = + { + ['Vamorcote'] = quest:event(659):replaceDefault(), + }, + }, +} + +return quest diff --git a/scripts/zones/Northern_San_dOria/DefaultActions.lua b/scripts/zones/Northern_San_dOria/DefaultActions.lua index fc37e46e7d1..cfe69960f02 100644 --- a/scripts/zones/Northern_San_dOria/DefaultActions.lua +++ b/scripts/zones/Northern_San_dOria/DefaultActions.lua @@ -62,7 +62,8 @@ return { ['Sochiene'] = { text = ID.text.SOCHIENE_DIALOG }, ['Suspicious_Elvaan'] = { event = 881 }, ['Synergy_Engineer'] = { event = 11002 }, - ['Taurette'] = { event = 664 }, - ['Vavegallet'] = { event = 673 }, - ['Villion'] = { event = 632 }, + ['Taurette'] = { event = 664 }, + ['Vamorcote'] = { event = 651 }, + ['Vavegallet'] = { event = 673 }, + ['Villion'] = { event = 632 }, } diff --git a/scripts/zones/Northern_San_dOria/npcs/Vamorcote.lua b/scripts/zones/Northern_San_dOria/npcs/Vamorcote.lua deleted file mode 100644 index c74951d52b8..00000000000 --- a/scripts/zones/Northern_San_dOria/npcs/Vamorcote.lua +++ /dev/null @@ -1,49 +0,0 @@ ------------------------------------ --- Area: Northern San d'Oria --- NPC: Vamorcote --- Starts and Finishes Quest: The Setting Sun --- !pos -137.070 10.999 161.855 231 ------------------------------------ ----@type TNpcEntity -local entity = {} - -entity.onTrade = function(player, npc, trade) - -- "The Setting Sun" conditional script - if player:getQuestStatus(xi.questLog.SANDORIA, xi.quest.id.sandoria.THE_SETTING_SUN) == xi.questStatus.QUEST_ACCEPTED then - if trade:hasItemQty(xi.item.ENGRAVED_KEY, 1) and trade:getItemCount() == 1 then - player:startEvent (658) - end - end -end - -entity.onTrigger = function(player, npc) - -- Look at the "The Setting Sun" quest status and San d'Oria player's fame - local theSettingSun = player:getQuestStatus(xi.questLog.SANDORIA, xi.quest.id.sandoria.THE_SETTING_SUN) - - if - theSettingSun == xi.questStatus.QUEST_AVAILABLE and - player:getFameLevel(xi.fameArea.SANDORIA) >= 5 and - player:getQuestStatus(xi.questLog.SANDORIA, xi.quest.id.sandoria.BLACKMAIL) ~= xi.questStatus.QUEST_COMPLETED - then - player:startEvent(654, 0, xi.item.ENGRAVED_KEY, xi.item.ENGRAVED_KEY) --The quest is offered to the player. - elseif theSettingSun == xi.questStatus.QUEST_ACCEPTED then - player:startEvent(655, 0, 0, xi.item.ENGRAVED_KEY) --The NPC asks if the player got the key.' - elseif theSettingSun == xi.questStatus.QUEST_COMPLETED and player:needToZone() then - player:startEvent(659) --The quest is already done by the player and the NPC does small talks. - else - player:startEvent(651) - end -end - -entity.onEventFinish = function(player, csid, option, npc) - if csid == 654 and option == 1 then --Player accepts the quest - player:addQuest(xi.questLog.SANDORIA, xi.quest.id.sandoria.THE_SETTING_SUN) - elseif csid == 658 then --The player trades the Engraved Key to the NPC. Here come the rewards! - player:tradeComplete() - npcUtil.giveCurrency(player, 'gil', 10000) - player:addFame(xi.fameArea.SANDORIA, 30) - player:completeQuest(xi.questLog.SANDORIA, xi.quest.id.sandoria.THE_SETTING_SUN) - end -end - -return entity