From f93d9fd7ec9e8bbffef79a7294803d06ad76ff5d Mon Sep 17 00:00:00 2001 From: KnowOne Date: Sun, 26 Jan 2025 18:36:04 -0600 Subject: [PATCH] move quest tigers teeth to IF --- scripts/globals/quests.lua | 2 +- scripts/quests/sandoria/Tigers_Teeth.lua | 107 ++++++++++++++++++ .../Southern_San_dOria/DefaultActions.lua | 1 + scripts/zones/Southern_San_dOria/IDs.lua | 1 + .../zones/Southern_San_dOria/npcs/Taumila.lua | 54 --------- 5 files changed, 110 insertions(+), 55 deletions(-) create mode 100644 scripts/quests/sandoria/Tigers_Teeth.lua delete mode 100644 scripts/zones/Southern_San_dOria/npcs/Taumila.lua diff --git a/scripts/globals/quests.lua b/scripts/globals/quests.lua index 805760c149a..109d844c1eb 100644 --- a/scripts/globals/quests.lua +++ b/scripts/globals/quests.lua @@ -48,7 +48,7 @@ xi.quest.id = GATES_TO_PARADISE = 18, -- + A_SQUIRES_TEST_II = 19, -- + Converted TO_CURE_A_COUGH = 20, -- + - TIGER_S_TEETH = 23, -- ± + TIGER_S_TEETH = 23, -- ± Converted UNDYING_FLAMES = 26, -- + A_PURCHASE_OF_ARMS = 27, -- + A_KNIGHTS_TEST = 29, -- + Converted diff --git a/scripts/quests/sandoria/Tigers_Teeth.lua b/scripts/quests/sandoria/Tigers_Teeth.lua new file mode 100644 index 00000000000..4cd631ab8e4 --- /dev/null +++ b/scripts/quests/sandoria/Tigers_Teeth.lua @@ -0,0 +1,107 @@ +----------------------------------- +-- Tigers Teeth +----------------------------------- +-- LogID: 0 QuestID: 23 +-- Taukila : !pos -140 -6 -8 230 +----------------------------------- + +local quest = Quest:new(xi.questLog.SANDORIA, xi.quest.id.sandoria.TIGER_S_TEETH) + +quest.reward = +{ + gil = 2100, + title = xi.title.FANG_FINDER, + fame = 30, +} + +quest.sections = +{ + { + check = function(player, status, vars) + return status == xi.questStatus.QUEST_AVAILABLE and + player:getFameLevel(xi.fameArea.SANDORIA) >= 3 + end, + + [xi.zone.SOUTHERN_SAN_DORIA] = + { + ['Taumila'] = quest:progressEvent(574), + + onEventFinish = + { + [574] = function(player, csid, option, npc) + if option == 0 then + quest:begin(player) + end + end, + }, + }, + }, + { + check = function(player, status, vars) + return status == xi.questStatus.QUEST_ACCEPTED + end, + + [xi.zone.SOUTHERN_SAN_DORIA] = + { + ['Taumila'] = + { + onTrade = function(player, npc, trade) + if npcUtil.tradeHasExactly(trade, { { xi.item.BLACK_TIGER_FANG, 3 } }) then + return quest:progressEvent(572) + elseif npcUtil.tradeHas(trade, xi.item.BLACK_TIGER_FANG) then + return quest:event(573) + end + end, + + onTrigger = quest:event(575):replaceDefault(), + }, + + onEventFinish = + { + [572] = function(player, csid, option, npc) + if quest:complete(player) then + player:confirmTrade() + end + end, + }, + }, + }, + { + check = function(player, status, vars) + return status == xi.questStatus.QUEST_COMPLETED + end, + + [xi.zone.SOUTHERN_SAN_DORIA] = + { + ['Taumila'] = + { + onTrade = function(player, npc, trade) + if npcUtil.tradeHasExactly(trade, { { xi.item.BLACK_TIGER_FANG, 3 } }) then + quest:setLocalVar(player, 'Option', 1) + return quest:progressEvent(572) + elseif npcUtil.tradeHas(trade, xi.item.BLACK_TIGER_FANG) then + return quest:event(573) + end + end, + + onTrigger = quest:event(571):replaceDefault(), + }, + + onEventFinish = + { + [572] = function(player, csid, option, npc) + if + quest:getLocalVar(player, 'Option') == 1 and + npcUtil.giveCurrency(player, 'gil', 2100) + then + quest:setLocalVar(player, 'Option', 0) + player:confirmTrade() + player:addFame(xi.fameArea.SANDORIA, 5) + end + end, + }, + }, + }, +} + +return quest diff --git a/scripts/zones/Southern_San_dOria/DefaultActions.lua b/scripts/zones/Southern_San_dOria/DefaultActions.lua index bca87b1d304..622fbe96113 100644 --- a/scripts/zones/Southern_San_dOria/DefaultActions.lua +++ b/scripts/zones/Southern_San_dOria/DefaultActions.lua @@ -42,5 +42,6 @@ return { ['Rumoie'] = { event = 863 }, ['Simmie'] = { event = 673 }, ['Sobane'] = { text = ID.text.SOBANE_DIALOG }, + ['Taumila'] = { text = ID.text.TAUMILA_DIALOG }, ['Valderotaux'] = { event = 58 }, } diff --git a/scripts/zones/Southern_San_dOria/IDs.lua b/scripts/zones/Southern_San_dOria/IDs.lua index 63109c275b5..2f12532d039 100644 --- a/scripts/zones/Southern_San_dOria/IDs.lua +++ b/scripts/zones/Southern_San_dOria/IDs.lua @@ -58,6 +58,7 @@ zones[xi.zone.SOUTHERN_SAN_DORIA] = YOU_FIND_A_WELL = 7915, -- You find a well. DONT_NEED_MORE_WATER = 7917, -- You don't need any more water. I_THANK_YOU_ADVENTURER = 7919, -- I thank you, kind adventurer. His Majesty, the late king, thanks you, too. + TAUMILA_DIALOG = 7994, -- I am Taumila, the owner of this establishment. Talk to the lady behind the counter if you wish to make a purchase. LUSIANE_SHOP_DIALOG = 7995, -- Hello! Let Taumila's handle all your sundry needs! OSTALIE_SHOP_DIALOG = 7996, -- Welcome, customer. Please have a look. ASH_THADI_ENE_SHOP_DIALOG = 8017, -- Welcome to Helbort's Blades! diff --git a/scripts/zones/Southern_San_dOria/npcs/Taumila.lua b/scripts/zones/Southern_San_dOria/npcs/Taumila.lua deleted file mode 100644 index 2ec6748cebf..00000000000 --- a/scripts/zones/Southern_San_dOria/npcs/Taumila.lua +++ /dev/null @@ -1,54 +0,0 @@ ------------------------------------ --- Area: Northern San d'Oria --- NPC: Taumila --- Starts and Finishes Quest: Tiger's Teeth (R) --- !pos -140 -5 -8 230 ------------------------------------ ----@type TNpcEntity -local entity = {} - -entity.onTrade = function(player, npc, trade) - if player:getQuestStatus(xi.questLog.SANDORIA, xi.quest.id.sandoria.TIGER_S_TEETH) ~= xi.questStatus.QUEST_AVAILABLE then - if - trade:hasItemQty(xi.item.BLACK_TIGER_FANG, 3) and - trade:getItemCount() == 3 - then - player:startEvent(572) - end - end -end - -entity.onTrigger = function(player, npc) - local tigersTeeth = player:getQuestStatus(xi.questLog.SANDORIA, xi.quest.id.sandoria.TIGER_S_TEETH) - - if - player:getFameLevel(xi.fameArea.SANDORIA) >= 3 and - tigersTeeth == xi.questStatus.QUEST_AVAILABLE - then - player:startEvent(574) - elseif tigersTeeth == xi.questStatus.QUEST_ACCEPTED then - player:startEvent(575) - elseif tigersTeeth == xi.questStatus.QUEST_COMPLETED then - player:startEvent(573) - else - player:startEvent(571) - end -end - -entity.onEventFinish = function(player, csid, option, npc) - if csid == 574 and option == 0 then - player:addQuest(xi.questLog.SANDORIA, xi.quest.id.sandoria.TIGER_S_TEETH) - elseif csid == 572 then - player:tradeComplete() - player:addTitle(xi.title.FANG_FINDER) - npcUtil.giveCurrency(player, 'gil', 2100) - if player:getQuestStatus(xi.questLog.SANDORIA, xi.quest.id.sandoria.TIGER_S_TEETH) == xi.questStatus.QUEST_ACCEPTED then - player:addFame(xi.fameArea.SANDORIA, 30) - player:completeQuest(xi.questLog.SANDORIA, xi.quest.id.sandoria.TIGER_S_TEETH) - else - player:addFame(xi.fameArea.SANDORIA, 5) - end - end -end - -return entity