diff --git a/scripts/quests/sandoria/WHM_AF1_Messenger_From_Beyond.lua b/scripts/quests/sandoria/WHM_AF1_Messenger_From_Beyond.lua new file mode 100644 index 00000000000..8eea2ca9cd7 --- /dev/null +++ b/scripts/quests/sandoria/WHM_AF1_Messenger_From_Beyond.lua @@ -0,0 +1,92 @@ +----------------------------------- +-- Messenger from Beyond +-- !addquest: 0 87 +-- Narcheral: !pos 128 -11 128 231 +-- qm2 : !pos -714 -9 68 103 +----------------------------------- +local valkID = zones[xi.zone.VALKURM_DUNES] +----------------------------------- + +local quest = Quest:new(xi.questLog.SANDORIA, xi.quest.id.sandoria.MESSENGER_FROM_BEYOND) + +quest.reward = +{ + item = xi.item.BLESSED_HAMMER, + fame = 20, + fameArea = xi.fameArea.SANDORIA, +} + +quest.sections = +{ + -- Section: Quest available. + { + check = function(player, status, vars) + return status == xi.questStatus.QUEST_AVAILABLE and + player:getMainJob() == xi.job.WHM and + player:getMainLvl() >= xi.settings.main.AF1_QUEST_LEVEL + end, + + [xi.zone.NORTHERN_SAN_DORIA] = + { + ['Narcheral'] = quest:progressEvent(689), + + onEventFinish = + { + [689] = function(player, csid, option, npc) + quest:begin(player) + end, + }, + }, + }, + + -- Section: Quest accepted + { + check = function(player, status, vars) + return status == xi.questStatus.QUEST_ACCEPTED + end, + + [xi.zone.VALKURM_DUNES] = + { + ['qm2'] = + { + onTrigger = function(player, npc) + if + not player:hasItem(xi.item.TAVNAZIA_PASS) and + npcUtil.popFromQM(player, npc, valkID.mob.MARCHELUTE, { claim = true, hide = 0 }) + then + return quest:messageSpecial(valkID.text.FOUL_PRESENSE) + else + return quest:messageSpecial(valkID.text.NOTHING_OUT_OF_ORDINARY) + end + end, + }, + }, + + [xi.zone.NORTHERN_SAN_DORIA] = + { + ['Narcheral'] = + { + onTrade = function(player, npc, trade) + if npcUtil.tradeHasExactly(trade, xi.item.TAVNAZIA_PASS) then + return quest:progressEvent(690) -- Finish quest. + end + end, + + onTrigger = function(player, npc) + return quest:event(688) + end, + }, + + onEventFinish = + { + [690] = function(player, csid, option, npc) + if quest:complete(player) then + player:confirmTrade() + end + end, + }, + }, + }, +} + +return quest diff --git a/scripts/zones/Northern_San_dOria/npcs/Narcheral.lua b/scripts/zones/Northern_San_dOria/npcs/Narcheral.lua index b0bee29a4eb..c805fae1fcb 100644 --- a/scripts/zones/Northern_San_dOria/npcs/Narcheral.lua +++ b/scripts/zones/Northern_San_dOria/npcs/Narcheral.lua @@ -9,14 +9,7 @@ local ID = zones[xi.zone.NORTHERN_SAN_DORIA] local entity = {} entity.onTrade = function(player, npc, trade) - if player:getQuestStatus(xi.questLog.SANDORIA, xi.quest.id.sandoria.MESSENGER_FROM_BEYOND) == xi.questStatus.QUEST_ACCEPTED then - if - trade:hasItemQty(xi.item.TAVNAZIA_PASS, 1) and - trade:getItemCount() == 1 - then - player:startEvent(690) -- Finish quest "Messenger from Beyond" - end - elseif player:getQuestStatus(xi.questLog.SANDORIA, xi.quest.id.sandoria.PRELUDE_OF_BLACK_AND_WHITE) == xi.questStatus.QUEST_ACCEPTED then + if player:getQuestStatus(xi.questLog.SANDORIA, xi.quest.id.sandoria.PRELUDE_OF_BLACK_AND_WHITE) == xi.questStatus.QUEST_ACCEPTED then if trade:hasItemQty(xi.item.CANTEEN_OF_YAGUDO_HOLY_WATER, 1) and trade:hasItemQty(xi.item.MOCCASINS, 1) and @@ -36,40 +29,13 @@ entity.onTrade = function(player, npc, trade) end entity.onTrigger = function(player, npc) - local messengerFromBeyond = player:getQuestStatus(xi.questLog.SANDORIA, xi.quest.id.sandoria.MESSENGER_FROM_BEYOND) - - -- Checking levels and jobs for af quest - local mLvl = player:getMainLvl() - local mJob = player:getMainJob() - - if - messengerFromBeyond == xi.questStatus.QUEST_AVAILABLE and - mJob == xi.job.WHM and - mLvl >= xi.settings.main.AF1_QUEST_LEVEL - then - player:startEvent(689) -- Start quest "Messenger from Beyond" - else - player:startEvent(688) -- Standard dialog - end end entity.onEventUpdate = function(player, csid, option, npc) end entity.onEventFinish = function(player, csid, option, npc) - if csid == 689 then - player:addQuest(xi.questLog.SANDORIA, xi.quest.id.sandoria.MESSENGER_FROM_BEYOND) - elseif csid == 690 then - if player:getFreeSlotsCount() == 0 then - player:messageSpecial(ID.text.ITEM_CANNOT_BE_OBTAINED, xi.item.BLESSED_HAMMER) - else - player:addItem(xi.item.BLESSED_HAMMER) - player:messageSpecial(ID.text.ITEM_OBTAINED, xi.item.BLESSED_HAMMER) -- Blessed Hammer - player:tradeComplete() - player:addFame(xi.fameArea.SANDORIA, 20) - player:completeQuest(xi.questLog.SANDORIA, xi.quest.id.sandoria.MESSENGER_FROM_BEYOND) - end - elseif csid == 691 then + if csid == 691 then if player:getFreeSlotsCount() == 0 then player:messageSpecial(ID.text.ITEM_CANNOT_BE_OBTAINED, xi.item.HEALERS_DUCKBILLS) -- Healer's Duckbills else diff --git a/scripts/zones/Valkurm_Dunes/IDs.lua b/scripts/zones/Valkurm_Dunes/IDs.lua index 385f4720811..e05cc3f5a43 100644 --- a/scripts/zones/Valkurm_Dunes/IDs.lua +++ b/scripts/zones/Valkurm_Dunes/IDs.lua @@ -32,6 +32,7 @@ zones[xi.zone.VALKURM_DUNES] = SIGNPOST2 = 7374, -- Northeast: La Theine Plateau Southeast: Konschtat Highlands West: Selbina SIGNPOST1 = 7375, -- Northeast: La Theine Plateau Southeast: Konschtat Highlands Southwest: Selbina CONQUEST = 7385, -- You've earned conquest points! + FOUL_PRESENSE = 7719, -- You sense a foul presence. YOU_SENSE_AN_EVIL_PRESENCE = 7729, -- You sense an evil presence... WHAT_DO_YOU_THINK = 7731, -- What do you think you are doing!? AN_EMPTY_LIGHT_SWIRLS = 7763, -- An empty light swirls about the cave, eating away at the surroundings... diff --git a/scripts/zones/Valkurm_Dunes/npcs/qm2.lua b/scripts/zones/Valkurm_Dunes/npcs/qm2.lua index f43a49654c1..5af4759adcc 100644 --- a/scripts/zones/Valkurm_Dunes/npcs/qm2.lua +++ b/scripts/zones/Valkurm_Dunes/npcs/qm2.lua @@ -12,15 +12,6 @@ entity.onTrade = function(player, npc, trade) end entity.onTrigger = function(player, npc) - if - not GetMobByID(ID.mob.MARCHELUTE):isSpawned() and - player:getQuestStatus(xi.questLog.SANDORIA, xi.quest.id.sandoria.MESSENGER_FROM_BEYOND) == xi.questStatus.QUEST_ACCEPTED and - not player:hasItem(xi.item.TAVNAZIA_PASS) - then - SpawnMob(ID.mob.MARCHELUTE):updateClaim(player) - else - player:messageSpecial(ID.text.NOTHING_OUT_OF_ORDINARY) - end end entity.onEventUpdate = function(player, csid, option, npc)