diff --git a/scripts/quests/sandoria/Healing_The_Land.lua b/scripts/quests/sandoria/Healing_The_Land.lua new file mode 100644 index 00000000000..2fb813e93aa --- /dev/null +++ b/scripts/quests/sandoria/Healing_The_Land.lua @@ -0,0 +1,100 @@ +----------------------------------- +-- Healing the Land +----------------------------------- +-- !addquest 0 82 +-- Eperdur: !pos 129 -6 96 231 +-- qm3: !pos -168 1 311 196 +----------------------------------- +local gugsenMinesID = zones[xi.zone.GUSGEN_MINES] +----------------------------------- + +local quest = Quest:new(xi.questLog.SANDORIA, xi.quest.id.sandoria.HEALING_THE_LAND) + +quest.reward = +{ + fame = 30, + fameArea = xi.fameArea.SANDORIA, + item = xi.item.SCROLL_OF_TELEPORT_HOLLA, + title = xi.title.PILGRIM_TO_HOLLA, +} + +quest.sections = +{ + { + check = function(player, status, vars) + return status == xi.questStatus.QUEST_AVAILABLE and + player:getFameLevel(xi.fameArea.SANDORIA) >= 4 and + player:getMainLvl() >= 10 + end, + + [xi.zone.NORTHERN_SAN_DORIA] = + { + ['Eperdur'] = quest:progressEvent(681), + + onEventFinish = + { + [681] = function(player, csid, option, npc) + quest:begin(player) + npcUtil.giveKeyItem(player, xi.ki.SEAL_OF_BANISHING) + end, + }, + }, + }, + + { + check = function(player, status, vars) + return status == xi.questStatus.QUEST_ACCEPTED + end, + + [xi.zone.NORTHERN_SAN_DORIA] = + { + ['Eperdur'] = + { + onTrigger = function(player, npc) + if player:hasKeyItem(xi.ki.SEAL_OF_BANISHING) then + return quest:event(682) + elseif not player:hasKeyItem(xi.ki.SEAL_OF_BANISHING) then + return quest:progressEvent(683) + end + end, + }, + + onEventFinish = + { + [683] = function(player, csid, option, npc) + quest:complete(player) + xi.quest.setMustZone(player, xi.questLog.SANDORIA, xi.quest.id.sandoria.SORCERY_OF_THE_NORTH) + end, + }, + }, + + [xi.zone.GUSGEN_MINES] = + { + ['qm3'] = + { + onTrigger = function(player, npc) + if player:hasKeyItem(xi.ki.SEAL_OF_BANISHING) then + player:delKeyItem(xi.ki.SEAL_OF_BANISHING) + return quest:messageSpecial(gugsenMinesID.text.FOUND_LOCATION_SEAL, xi.ki.SEAL_OF_BANISHING) + elseif not player:hasKeyItem(xi.ki.SEAL_OF_BANISHING) then + player:messageSpecial(gugsenMinesID.text.IS_ON_THIS_SEAL, xi.ki.SEAL_OF_BANISHING) + return quest:noAction() + end + end, + }, + }, + }, + + { + check = function(player, status, vars) + return status == xi.questStatus.QUEST_COMPLETED + end, + + [xi.zone.NORTHERN_SAN_DORIA] = + { + ['Eperdur'] = quest:event(684):replaceDefault(), + }, + }, +} + +return quest diff --git a/scripts/quests/sandoria/Sorcery_of_the_North.lua b/scripts/quests/sandoria/Sorcery_of_the_North.lua new file mode 100644 index 00000000000..98bd3690d28 --- /dev/null +++ b/scripts/quests/sandoria/Sorcery_of_the_North.lua @@ -0,0 +1,67 @@ +----------------------------------- +-- Sorcery of the North +----------------------------------- +-- !addquest 0 83 +-- Eperdur: !pos 129 -6 96 231 +----------------------------------- + +local quest = Quest:new(xi.questLog.SANDORIA, xi.quest.id.sandoria.SORCERY_OF_THE_NORTH) + +quest.reward = +{ + fame = 30, + fameArea = xi.fameArea.SANDORIA, + item = xi.item.SCROLL_OF_TELEPORT_VAHZL, +} + +quest.sections = +{ + { + check = function(player, status, vars) + return status == xi.questStatus.QUEST_AVAILABLE and + player:hasCompletedQuest(xi.questLog.SANDORIA, xi.quest.id.sandoria.HEALING_THE_LAND) and + not quest:getMustZone(player) + end, + + [xi.zone.NORTHERN_SAN_DORIA] = + { + ['Eperdur'] = quest:progressEvent(685), + + onEventFinish = + { + [685] = function(player, csid, option, npc) + quest:begin(player) + end, + }, + }, + }, + + { + check = function(player, status, vars) + return status == xi.questStatus.QUEST_ACCEPTED + end, + + [xi.zone.NORTHERN_SAN_DORIA] = + { + ['Eperdur'] = + { + onTrigger = function(player, npc) + if not player:hasKeyItem(xi.ki.FEIYIN_MAGIC_TOME) then + return quest:event(686) + else + return quest:progressEvent(687) + end + end, + }, + + onEventFinish = + { + [687] = function(player, csid, option, npc) + quest:complete(player) + end, + }, + }, + }, +} + +return quest diff --git a/scripts/zones/Gusgen_Mines/DefaultActions.lua b/scripts/zones/Gusgen_Mines/DefaultActions.lua index 56ac43221d3..fe5706202cd 100644 --- a/scripts/zones/Gusgen_Mines/DefaultActions.lua +++ b/scripts/zones/Gusgen_Mines/DefaultActions.lua @@ -2,5 +2,6 @@ local ID = zones[xi.zone.GUSGEN_MINES] return { ['qm2'] = { messageSpecial = ID.text.SEE_MONSTER_TRACKS }, + ['qm3'] = { messageSpecial = ID.text.LETTERS_IS_WRITTEN_HERE }, ['qm4'] = { messageSpecial = ID.text.NOTHING_OUT_OF_ORDINARY }, } diff --git a/scripts/zones/Gusgen_Mines/npcs/qm3.lua b/scripts/zones/Gusgen_Mines/npcs/qm3.lua index b00e5216b89..cde74111bc0 100644 --- a/scripts/zones/Gusgen_Mines/npcs/qm3.lua +++ b/scripts/zones/Gusgen_Mines/npcs/qm3.lua @@ -4,30 +4,13 @@ -- Involved In Quest: Healing the Land -- !pos -168 1 311 196 ----------------------------------- -local ID = zones[xi.zone.GUSGEN_MINES] ------------------------------------ +---@type TNpcEntity local entity = {} entity.onTrade = function(player, npc, trade) end entity.onTrigger = function(player, npc) - local healingTheLand = player:getQuestStatus(xi.questLog.SANDORIA, xi.quest.id.sandoria.HEALING_THE_LAND) - - if - healingTheLand == xi.questStatus.QUEST_ACCEPTED and - player:hasKeyItem(xi.ki.SEAL_OF_BANISHING) - then - player:delKeyItem(xi.ki.SEAL_OF_BANISHING) - player:messageSpecial(ID.text.FOUND_LOCATION_SEAL, xi.ki.SEAL_OF_BANISHING) - elseif - healingTheLand == xi.questStatus.QUEST_ACCEPTED and - not player:hasKeyItem(xi.ki.SEAL_OF_BANISHING) - then - player:messageSpecial(ID.text.IS_ON_THIS_SEAL, xi.ki.SEAL_OF_BANISHING) - else - player:messageSpecial(ID.text.LETTERS_IS_WRITTEN_HERE) - end end entity.onEventUpdate = function(player, csid, option, npc) diff --git a/scripts/zones/Northern_San_dOria/npcs/Eperdur.lua b/scripts/zones/Northern_San_dOria/npcs/Eperdur.lua index 58cd2f2c78b..f931bb75899 100644 --- a/scripts/zones/Northern_San_dOria/npcs/Eperdur.lua +++ b/scripts/zones/Northern_San_dOria/npcs/Eperdur.lua @@ -1,93 +1,22 @@ ----------------------------------- -- Area: Northern San d'Oria --- NPC: Eperdur +-- NPC: Eperdur -- Starts and Finishes Quest: Healing the Land, -- !pos 129 -6 96 231 ----------------------------------- -local ID = zones[xi.zone.NORTHERN_SAN_DORIA] ------------------------------------ +---@type TNpcEntity local entity = {} entity.onTrade = function(player, npc, trade) end entity.onTrigger = function(player, npc) - local healingTheLand = player:getQuestStatus(xi.questLog.SANDORIA, xi.quest.id.sandoria.HEALING_THE_LAND) - local sorceryOfTheNorth = player:getQuestStatus(xi.questLog.SANDORIA, xi.quest.id.sandoria.SORCERY_OF_THE_NORTH) - - if - healingTheLand == xi.questStatus.QUEST_AVAILABLE and - player:getFameLevel(xi.fameArea.SANDORIA) >= 4 and - player:getMainLvl() >= 10 - then - player:startEvent(681) -- Start quest "Healing the Land" - elseif - healingTheLand == xi.questStatus.QUEST_ACCEPTED and - player:hasKeyItem(xi.ki.SEAL_OF_BANISHING) - then - player:startEvent(682) -- During quest "Healing the Land" - elseif - healingTheLand == xi.questStatus.QUEST_ACCEPTED and - not player:hasKeyItem(xi.ki.SEAL_OF_BANISHING) - then - player:startEvent(683) -- Finish quest "Healing the Land" - elseif - healingTheLand == xi.questStatus.QUEST_COMPLETED and - sorceryOfTheNorth == xi.questStatus.QUEST_AVAILABLE and - player:needToZone() - then - player:startEvent(684) -- New standard dialog after "Healing the Land" - elseif - healingTheLand == xi.questStatus.QUEST_COMPLETED and - sorceryOfTheNorth == xi.questStatus.QUEST_AVAILABLE and - not player:needToZone() - then - player:startEvent(685) -- Start quest "Sorcery of the North" - elseif - sorceryOfTheNorth == xi.questStatus.QUEST_ACCEPTED and - not player:hasKeyItem(xi.ki.FEIYIN_MAGIC_TOME) - then - player:startEvent(686) -- During quest "Sorcery of the North" - elseif - sorceryOfTheNorth == xi.questStatus.QUEST_ACCEPTED and - player:hasKeyItem(xi.ki.FEIYIN_MAGIC_TOME) - then - player:startEvent(687) -- Finish quest "Sorcery of the North" - end end entity.onEventUpdate = function(player, csid, option, npc) end entity.onEventFinish = function(player, csid, option, npc) - if csid == 681 and option == 0 then - player:addQuest(xi.questLog.SANDORIA, xi.quest.id.sandoria.HEALING_THE_LAND) - player:addKeyItem(xi.ki.SEAL_OF_BANISHING) - player:messageSpecial(ID.text.KEYITEM_OBTAINED, xi.ki.SEAL_OF_BANISHING) - elseif csid == 683 then - if player:getFreeSlotsCount() == 0 then - player:messageSpecial(ID.text.ITEM_CANNOT_BE_OBTAINED, xi.item.SCROLL_OF_TELEPORT_HOLLA) - else - player:addTitle(xi.title.PILGRIM_TO_HOLLA) - player:addItem(xi.item.SCROLL_OF_TELEPORT_HOLLA) - player:messageSpecial(ID.text.ITEM_OBTAINED, xi.item.SCROLL_OF_TELEPORT_HOLLA) -- Scroll of Teleport-Holla - player:needToZone(true) - player:addFame(xi.fameArea.SANDORIA, 30) - player:completeQuest(xi.questLog.SANDORIA, xi.quest.id.sandoria.HEALING_THE_LAND) - end - elseif csid == 685 and option == 0 then - player:addQuest(xi.questLog.SANDORIA, xi.quest.id.sandoria.SORCERY_OF_THE_NORTH) - elseif csid == 687 then - if player:getFreeSlotsCount() == 0 then - player:messageSpecial(ID.text.ITEM_CANNOT_BE_OBTAINED, xi.item.SCROLL_OF_TELEPORT_VAHZL) - else - player:delKeyItem(xi.ki.FEIYIN_MAGIC_TOME) - player:addItem(xi.item.SCROLL_OF_TELEPORT_VAHZL) - player:messageSpecial(ID.text.ITEM_OBTAINED, xi.item.SCROLL_OF_TELEPORT_VAHZL) -- Scroll of Teleport-Vahzl - player:addFame(xi.fameArea.SANDORIA, 30) - player:completeQuest(xi.questLog.SANDORIA, xi.quest.id.sandoria.SORCERY_OF_THE_NORTH) - end - end end return entity