From dae90f8a2a4bda0b4fb973dcc041f4f80623b022 Mon Sep 17 00:00:00 2001 From: hooksta4 Date: Fri, 31 May 2024 14:09:39 -0500 Subject: [PATCH] [Quest]An Undying Pledge Conv --- scripts/enum/item.lua | 1 + scripts/quests/outlands/An_Undying_Pledge.lua | 132 ++++++++++++++++++ scripts/zones/Norg/DefaultActions.lua | 29 ++-- scripts/zones/Norg/Zone.lua | 11 -- scripts/zones/Norg/npcs/Stray_Cloud.lua | 41 ------ .../Sea_Serpent_Grotto/DefaultActions.lua | 1 + .../Sea_Serpent_Grotto/mobs/Glyryvilu.lua | 3 - scripts/zones/Sea_Serpent_Grotto/npcs/qm5.lua | 21 --- 8 files changed, 149 insertions(+), 90 deletions(-) create mode 100644 scripts/quests/outlands/An_Undying_Pledge.lua diff --git a/scripts/enum/item.lua b/scripts/enum/item.lua index eff563b781e..f417aacf604 100644 --- a/scripts/enum/item.lua +++ b/scripts/enum/item.lua @@ -3930,6 +3930,7 @@ xi.item = NYMPH_SHIELD = 12364, PICAROONS_SHIELD = 12370, CLIPEUS = 12371, + LIGHT_BUCKLER = 12375, ASTRAL_ASPIS = 12382, ACHERON_SHIELD = 12385, MERCENARYS_TARGE = 12389, diff --git a/scripts/quests/outlands/An_Undying_Pledge.lua b/scripts/quests/outlands/An_Undying_Pledge.lua new file mode 100644 index 00000000000..ae6a5b76978 --- /dev/null +++ b/scripts/quests/outlands/An_Undying_Pledge.lua @@ -0,0 +1,132 @@ +----------------------------------- +-- An Undying Pledge +----------------------------------- +-- Log ID: 5, Quest ID: 149 +-- Stray Cloud : !pos -18 1 -20 252 +-- qm5 : !pos 133 -9 221 176 +----------------------------------- +local ssgID = zones[xi.zone.SEA_SERPENT_GROTTO] + +local quest = Quest:new(xi.questLog.OUTLANDS, xi.quest.id.outlands.AN_UNDYING_PLEDGE) + +quest.reward = +{ + item = xi.item.LIGHT_BUCKLER, + fameArea = xi.fameArea.NORG, + fame = 50, +} + +quest.sections = +{ + { + check = function(player, status, vars) + return status == xi.questStatus.QUEST_AVAILABLE and + player:getFameLevel(xi.fameArea.NORG) >= 4 + end, + + [xi.zone.NORG] = + { + ['Stray_Cloud'] = quest:progressEvent(225), + + onEventFinish = + { + [225] = function(player, csid, option, npc) + quest:begin(player) + end, + }, + }, + }, + + { + check = function(player, status, vars) + return status == xi.questStatus.QUEST_ACCEPTED + end, + + [xi.zone.NORG] = + { + ['Stray_Cloud'] = + { + onTrigger = function(player, npc) + if quest:getVar(player, 'Prog') == 0 then + return quest:event(228) + elseif quest:getVar(player, 'Prog') == 1 then + return quest:event(229) + elseif quest:getVar(player, 'Prog') == 3 then + return quest:progressEvent(227) + end + end, + }, + + onTriggerAreaEnter = + { + [1] = function(player, triggerArea) + if quest:getVar(player, 'Prog') == 0 then + return quest:progressEvent(226) + end + end, + }, + + onEventFinish = + { + [226] = function(player, csid, option, npc) + quest:setVar(player, 'Prog', 1) + end, + + [227] = function(player, csid, option, npc) + if quest:complete(player) then + player:delKeyItem(xi.ki.CALIGINOUS_BLADE) + end + end, + }, + }, + + [xi.zone.SEA_SERPENT_GROTTO] = + { + ['qm5'] = + { + onTrigger = function(player, npc) + if + quest:getVar(player, 'Prog') == 1 and + npcUtil.popFromQM(player, npc, ssgID.mob.GLYRYVILU, { claim = true, hide = 0 }) + then + return quest:messageSpecial(ssgID.text.BODY_NUMB_DREAD) + elseif + quest:getVar(player, 'Prog') == 2 + then + return quest:progressEvent(18) + end + end, + }, + + onEventFinish = + { + [18] = function(player, csid, option, npc) + npcUtil.giveKeyItem(player, xi.ki.CALIGINOUS_BLADE) + quest:setVar(player, 'Prog', 3) + end, + }, + + ['Glyryvilu'] = + { + onMobDeath = function(mob, player, optParams) + if quest:getVar(player, 'Prog') == 1 then + quest:setVar(player, 'Prog', 2) + end + end, + }, + }, + }, + + { + check = function(player, status, vars) + return status == xi.questStatus.QUEST_COMPLETED + end, + + [xi.zone.NORG] = + { + ['Stray_Cloud'] = quest:event(230):replaceDefault(), + }, + }, +} + +return quest diff --git a/scripts/zones/Norg/DefaultActions.lua b/scripts/zones/Norg/DefaultActions.lua index 14f649ff127..ec216700315 100644 --- a/scripts/zones/Norg/DefaultActions.lua +++ b/scripts/zones/Norg/DefaultActions.lua @@ -1,18 +1,19 @@ local ID = zones[xi.zone.NORG] return { - ['_700'] = { messageSpecial = ID.text.DOOR_IS_LOCKED }, - ['Aeka'] = { event = 120 }, - ['Andrause'] = { event = 239 }, - ['Comitiolus'] = { event = 72 }, - ['Heillal'] = { event = 64 }, - ['Jaucribaix'] = { event = 71 }, - ['Kamui'] = { event = 61 }, - ['Keal'] = { event = 89 }, - ['Laisrean'] = { event = 83 }, - ['Ranemaud'] = { event = 68 }, - ['Ryoma'] = { event = 94 }, - ['Shivivi'] = { event = 85 }, - ['Verctissa'] = { event = 114 }, - ['Washu'] = { event = 80 }, + ['_700'] = { messageSpecial = ID.text.DOOR_IS_LOCKED }, + ['Aeka'] = { event = 120 }, + ['Andrause'] = { event = 239 }, + ['Comitiolus'] = { event = 72 }, + ['Heillal'] = { event = 64 }, + ['Jaucribaix'] = { event = 71 }, + ['Kamui'] = { event = 61 }, + ['Keal'] = { event = 89 }, + ['Laisrean'] = { event = 83 }, + ['Ranemaud'] = { event = 68 }, + ['Ryoma'] = { event = 94 }, + ['Shivivi'] = { event = 85 }, + ['Stray_Cloud'] = { event = 231 }, + ['Verctissa'] = { event = 114 }, + ['Washu'] = { event = 80 }, } diff --git a/scripts/zones/Norg/Zone.lua b/scripts/zones/Norg/Zone.lua index 7651976d235..517ca4fc11d 100644 --- a/scripts/zones/Norg/Zone.lua +++ b/scripts/zones/Norg/Zone.lua @@ -27,23 +27,12 @@ zoneObject.onZoneIn = function(player, prevZone) end zoneObject.onTriggerAreaEnter = function(player, triggerArea) - switch (triggerArea:GetTriggerAreaID()): caseof - { - [1] = function() -- An Undying Pledge cs trigger - if player:getCharVar('anUndyingPledgeCS') == 1 then - player:startEvent(226) - end - end, - } end zoneObject.onEventUpdate = function(player, csid, option, npc) end zoneObject.onEventFinish = function(player, csid, option, npc) - if csid == 226 then - player:setCharVar('anUndyingPledgeCS', 2) - end end return zoneObject diff --git a/scripts/zones/Norg/npcs/Stray_Cloud.lua b/scripts/zones/Norg/npcs/Stray_Cloud.lua index 39169fc1444..fb58fe7c934 100644 --- a/scripts/zones/Norg/npcs/Stray_Cloud.lua +++ b/scripts/zones/Norg/npcs/Stray_Cloud.lua @@ -10,53 +10,12 @@ entity.onTrade = function(player, npc, trade) end entity.onTrigger = function(player, npc) - local anUndyingPledge = player:getQuestStatus(xi.questLog.OUTLANDS, xi.quest.id.outlands.AN_UNDYING_PLEDGE) - - if - anUndyingPledge == xi.questStatus.QUEST_AVAILABLE and - player:getFameLevel(xi.fameArea.NORG) >= 4 - then - player:startEvent(225) -- Start quest - elseif - anUndyingPledge == xi.questStatus.QUEST_ACCEPTED and - player:hasKeyItem(xi.ki.CALIGINOUS_BLADE) - then - player:startEvent(227) -- Quest Finish - elseif - anUndyingPledge == xi.questStatus.QUEST_ACCEPTED and - player:getCharVar('anUndyingPledgeCS') == 1 - then - player:startEvent(228) -- Extra Dialogue - elseif - anUndyingPledge == xi.questStatus.QUEST_ACCEPTED and - player:getCharVar('anUndyingPledgeCS') == 2 - then - player:startEvent(229) -- Extra Dialogue - elseif anUndyingPledge == xi.questStatus.QUEST_COMPLETED then - player:startEvent(230) - else - player:startEvent(231) -- Standard Conversation - end end entity.onEventUpdate = function(player, csid, option, npc) end entity.onEventFinish = function(player, csid, option, npc) - if csid == 225 then - player:addQuest(xi.questLog.OUTLANDS, xi.quest.id.outlands.AN_UNDYING_PLEDGE) - player:setCharVar('anUndyingPledgeCS', 1) - elseif - csid == 227 and - npcUtil.completeQuest(player, xi.questLog.OUTLANDS, xi.quest.id.outlands.AN_UNDYING_PLEDGE, { - item = 12375, - fameArea = xi.fameArea.NORG, - fame = 50, - var = 'anUndyingPledgeCS', - }) - then - player:delKeyItem(xi.ki.CALIGINOUS_BLADE) - end end return entity diff --git a/scripts/zones/Sea_Serpent_Grotto/DefaultActions.lua b/scripts/zones/Sea_Serpent_Grotto/DefaultActions.lua index d26a831ede5..e445c03fb46 100644 --- a/scripts/zones/Sea_Serpent_Grotto/DefaultActions.lua +++ b/scripts/zones/Sea_Serpent_Grotto/DefaultActions.lua @@ -2,6 +2,7 @@ local ID = zones[xi.zone.SEA_SERPENT_GROTTO] return { ['qm1'] = { messageSpecial = ID.text.NOTHING_OUT_OF_ORDINARY }, + ['qm5'] = { messageSpecial = ID.text.NOTHING_OUT_OF_ORDINARY }, ['Shady_Sconce'] = { messageSpecial = ID.text.NOTHING_OUT_OF_ORDINARY }, ['Waterfall_Basin'] = { messageSpecial = ID.text.NOTHING_OUT_OF_ORDINARY_2 }, } diff --git a/scripts/zones/Sea_Serpent_Grotto/mobs/Glyryvilu.lua b/scripts/zones/Sea_Serpent_Grotto/mobs/Glyryvilu.lua index 2457ebc764c..f6e04f22ce8 100644 --- a/scripts/zones/Sea_Serpent_Grotto/mobs/Glyryvilu.lua +++ b/scripts/zones/Sea_Serpent_Grotto/mobs/Glyryvilu.lua @@ -8,9 +8,6 @@ local entity = {} entity.onMobDeath = function(mob, player, optParams) - if player:getCharVar('anUndyingPledgeCS') == 2 then - player:setCharVar('anUndyingPledgeNM_killed', 1) - end end return entity diff --git a/scripts/zones/Sea_Serpent_Grotto/npcs/qm5.lua b/scripts/zones/Sea_Serpent_Grotto/npcs/qm5.lua index 0e3fa65521e..a84fb68d8c1 100644 --- a/scripts/zones/Sea_Serpent_Grotto/npcs/qm5.lua +++ b/scripts/zones/Sea_Serpent_Grotto/npcs/qm5.lua @@ -4,33 +4,12 @@ -- Quests: An Undying Pledge -- !pos 135 -9 220 ----------------------------------- -local ID = zones[xi.zone.SEA_SERPENT_GROTTO] ------------------------------------ local entity = {} entity.onTrigger = function(player, npc) - if - player:getCharVar('anUndyingPledgeCS') == 2 and - player:getCharVar('anUndyingPledgeNM_killed') == 1 - then - player:startEvent(18) - elseif - player:getCharVar('anUndyingPledgeCS') == 2 and - player:getCharVar('anUndyingPledgeNM_killed') == 0 and - npcUtil.popFromQM(player, npc, ID.mob.GLYRYVILU, { hide = 0 }) - then - player:messageSpecial(ID.text.BODY_NUMB_DREAD) - else - player:messageSpecial(ID.text.NOTHING_OUT_OF_ORDINARY) - end end entity.onEventFinish = function(player, csid, option, npc) - if csid == 18 then - npcUtil.giveKeyItem(player, xi.ki.CALIGINOUS_BLADE) - player:setCharVar('anUndyingPledgeCS', 3) - player:setCharVar('anUndyingPledgeNM_killed', 0) - end end return entity