From 3edca4bbef722ef93f86a61888d754e9e5d0d4c5 Mon Sep 17 00:00:00 2001 From: KnowOne Date: Mon, 24 Feb 2025 16:20:07 -0600 Subject: [PATCH] Quest Warding Vampires to IF --- scripts/globals/quests.lua | 2 +- scripts/quests/sandoria/Warding_Vampires.lua | 87 +++++++++++++++++++ .../Northern_San_dOria/npcs/Maloquedil.lua | 42 +-------- 3 files changed, 90 insertions(+), 41 deletions(-) create mode 100644 scripts/quests/sandoria/Warding_Vampires.lua diff --git a/scripts/globals/quests.lua b/scripts/globals/quests.lua index e0542692e26..3e331cd5b8d 100644 --- a/scripts/globals/quests.lua +++ b/scripts/globals/quests.lua @@ -74,7 +74,7 @@ xi.quest.id = THE_COMPETITION = 76, -- ± STARTING_A_FLAME = 77, -- ± FEAR_OF_THE_DARK = 78, -- + Converted - WARDING_VAMPIRES = 79, -- + + WARDING_VAMPIRES = 79, -- + Converted SLEEPLESS_NIGHTS = 80, -- ± LUFETS_LAKE_SALT = 81, -- ± HEALING_THE_LAND = 82, -- ± diff --git a/scripts/quests/sandoria/Warding_Vampires.lua b/scripts/quests/sandoria/Warding_Vampires.lua new file mode 100644 index 00000000000..cc857013058 --- /dev/null +++ b/scripts/quests/sandoria/Warding_Vampires.lua @@ -0,0 +1,87 @@ +----------------------------------- +-- Warding Vampires +----------------------------------- +-- Log ID: 0, Quest ID: 79 +----------------------------------- +-- Maloquedil : !pos 35 0.1 60 231 +----------------------------------- + +local quest = Quest:new(xi.questLog.SANDORIA, xi.quest.id.sandoria.WARDING_VAMPIRES) + +quest.reward = +{ + title = xi.title.VAMPIRE_HUNTER_D_MINUS, +} + +quest.sections = +{ + { + check = function(player, status, vars) + return status == xi.questStatus.QUEST_AVAILABLE + end, + + [xi.zone.NORTHERN_SAN_DORIA] = + { + ['Maloquedil'] = + { + onTrigger = function(player, npc) + if player:getFameLevel(xi.fameArea.SANDORIA) >= 3 then + return quest:progressEvent(24) + else + return quest:event(21) + end + end, + }, + + onEventFinish = + { + [24] = function(player, csid, option, npc) + if option == 1 then + quest:begin(player) + end + end, + }, + }, + }, + { + check = function(player, status, vars) + return status ~= xi.questStatus.QUEST_AVAILABLE + end, + + [xi.zone.NORTHERN_SAN_DORIA] = + { + ['Maloquedil'] = + { + onTrade = function(player, npc, trade) + if npcUtil.tradeHas(trade, { { xi.item.BULB_OF_SHAMAN_GARLIC, 2 } }) then + return quest:progressEvent(23) + end + end, + + onTrigger = function(player, npc) + if player:getQuestStatus(xi.questLog.SANDORIA, xi.quest.id.sandoria.WARDING_VAMPIRES) == xi.questStatus.QUEST_ACCEPTED then + return quest:event(22) + else + return quest:event(24, { [7] = 1 }) + end + end, + }, + + onEventFinish = + { + [23] = function(player, csid, option, npc) + if player:getQuestStatus(xi.questLog.SANDORIA, xi.quest.id.sandoria.WARDING_VAMPIRES) == xi.questStatus.QUEST_ACCEPTED then + quest:complete(player) + else + player:addFame(xi.fameArea.SANDORIA, 5) + end + + npcUtil.giveCurrency(player, 'gil', 900) + player:confirmTrade() + end, + }, + }, + }, +} + +return quest diff --git a/scripts/zones/Northern_San_dOria/npcs/Maloquedil.lua b/scripts/zones/Northern_San_dOria/npcs/Maloquedil.lua index 52888b7672a..f79958020b0 100644 --- a/scripts/zones/Northern_San_dOria/npcs/Maloquedil.lua +++ b/scripts/zones/Northern_San_dOria/npcs/Maloquedil.lua @@ -7,55 +7,17 @@ ---@type TNpcEntity local entity = {} -entity.onTrade = function(player, npc, trade) - if player:getQuestStatus(xi.questLog.SANDORIA, xi.quest.id.sandoria.WARDING_VAMPIRES) ~= xi.questStatus.QUEST_AVAILABLE then - if - trade:hasItemQty(xi.item.BULB_OF_SHAMAN_GARLIC, 2) and - trade:getItemCount() == 2 - then - player:startEvent(23) - end - end -end - entity.onTrigger = function(player, npc) - local warding = player:getQuestStatus(xi.questLog.SANDORIA, xi.quest.id.sandoria.WARDING_VAMPIRES) - local wildcatSandy = player:getCharVar('WildcatSandy') - if player:getQuestStatus(xi.questLog.SANDORIA, xi.quest.id.sandoria.LURE_OF_THE_WILDCAT) == xi.questStatus.QUEST_ACCEPTED and - not utils.mask.getBit(wildcatSandy, 7) + not utils.mask.getBit(player:getCharVar('WildcatSandy'), 7) then player:startEvent(807) - elseif - warding == xi.questStatus.QUEST_AVAILABLE and - player:getFameLevel(xi.fameArea.SANDORIA) >= 3 - then - -- Quest available for fame superior or equal to 3 - player:startEvent(24) - elseif warding == xi.questStatus.QUEST_ACCEPTED then --Quest accepted, and he just tell me where to get item. - player:startEvent(22) - elseif warding == xi.questStatus.QUEST_COMPLETED then --Since the quest is repeatable, he tells me where to find (again) the items. - player:startEvent(22) - else - player:startEvent(21) end end entity.onEventFinish = function(player, csid, option, npc) - if csid == 24 and option == 1 then - player:addQuest(xi.questLog.SANDORIA, xi.quest.id.sandoria.WARDING_VAMPIRES) - elseif csid == 23 then - player:tradeComplete() - player:addTitle(xi.title.VAMPIRE_HUNTER_D_MINUS) - npcUtil.giveCurrency(player, 'gil', 900) - if player:getQuestStatus(xi.questLog.SANDORIA, xi.quest.id.sandoria.WARDING_VAMPIRES) == xi.questStatus.QUEST_ACCEPTED then - player:addFame(xi.fameArea.SANDORIA, 30) - player:completeQuest(xi.questLog.SANDORIA, xi.quest.id.sandoria.WARDING_VAMPIRES) - else - player:addFame(xi.fameArea.SANDORIA, 5) - end - elseif csid == 807 then + if csid == 807 then player:setCharVar('WildcatSandy', utils.mask.setBit(player:getCharVar('WildcatSandy'), 7, true)) end end