From 51ed28c235fe608083496d336625cad474620968 Mon Sep 17 00:00:00 2001 From: Aeshur Date: Tue, 21 Apr 2026 14:06:35 -0400 Subject: [PATCH] [lua] Quelling the Storm quest --- scripts/globals/quests.lua | 4 +- .../quests/crystalWar/Fire_in_the_Hole.lua | 31 +- .../quests/crystalWar/Quelling_the_Storm.lua | 314 ++++++++++++++++++ 3 files changed, 331 insertions(+), 18 deletions(-) create mode 100644 scripts/quests/crystalWar/Quelling_the_Storm.lua diff --git a/scripts/globals/quests.lua b/scripts/globals/quests.lua index 81d18be74aa..dbd7aee0051 100644 --- a/scripts/globals/quests.lua +++ b/scripts/globals/quests.lua @@ -742,13 +742,13 @@ xi.quest.id = DOWNWARD_HELIX = 33, -- + Converted SEEING_BLOOD_RED = 34, STORM_ON_THE_HORIZON = 35, - FIRE_IN_THE_HOLE = 36, + FIRE_IN_THE_HOLE = 36, -- + Converted PERILS_OF_THE_GRIFFON = 37, -- + Converted IN_A_HAZE_OF_GLORY = 38, -- + Converted WHEN_ONE_MAN_IS_NOT_ENOUGH = 39, A_FEAST_FOR_GNATS = 40, SAY_IT_WITH_A_HANDBAG = 41, -- + TODO: Can be completed, but reward latent not implemented - QUELLING_THE_STORM = 42, + QUELLING_THE_STORM = 42, -- + Converted HONOR_UNDER_FIRE = 43, THE_PRICE_OF_VALOR = 44, -- + Converted BONDS_THAT_NEVER_DIE = 45, -- + Converted diff --git a/scripts/quests/crystalWar/Fire_in_the_Hole.lua b/scripts/quests/crystalWar/Fire_in_the_Hole.lua index 257c466dc94..1f4cdc5aae4 100644 --- a/scripts/quests/crystalWar/Fire_in_the_Hole.lua +++ b/scripts/quests/crystalWar/Fire_in_the_Hole.lua @@ -40,7 +40,6 @@ quest.sections = [77] = function(player, csid, option, npc) quest:begin(player) npcUtil.giveKeyItem(player, xi.ki.SILVERMINE_KEY) - quest:setVar(player, 'Prog', 1) end, }, }, @@ -57,7 +56,7 @@ quest.sections = { onTrigger = function(player, npc) if - quest:getVar(player, 'Prog') == 1 and + quest:getVar(player, 'Prog') == 0 and player:hasKeyItem(xi.ki.SILVERMINE_KEY) then return quest:progressEvent(5) @@ -71,13 +70,13 @@ quest.sections = local questProgress = quest:getVar(player, 'Prog') if - questProgress >= 1 and - questProgress <= 2 and + questProgress >= 0 and + questProgress <= 1 and player:hasKeyItem(xi.ki.SILVERMINE_KEY) then return quest:progressEvent(7) elseif - questProgress >= 3 and + questProgress >= 2 and not player:hasKeyItem(xi.ki.SILVERMINE_KEY) then return quest:progressEvent(8) @@ -87,7 +86,7 @@ quest.sections = onZoneIn = function(player, prevZone) if - quest:getVar(player, 'Prog') == 4 and + quest:getVar(player, 'Prog') == 3 and prevZone == xi.zone.RUHOTZ_SILVERMINES then return 6 @@ -97,17 +96,17 @@ quest.sections = onEventFinish = { [5] = function(player, csid, option, npc) - quest:setVar(player, 'Prog', 2) + quest:setVar(player, 'Prog', 1) end, [6] = function(player, csid, option, npc) - quest:setVar(player, 'Prog', 5) + quest:setVar(player, 'Prog', 4) end, [8] = function(player, csid, option, npc) if npc and npc:getName() == 'Solitary_Ant' then npcUtil.giveKeyItem(player, xi.ki.SILVERMINE_KEY) - quest:setVar(player, 'Prog', 2) + quest:setVar(player, 'Prog', 1) end end, }, @@ -119,8 +118,8 @@ quest.sections = onEventFinish = { [10000] = function(player, csid, option, npc) - if quest:getVar(player, 'Prog') == 3 then - quest:setVar(player, 'Prog', 4) + if quest:getVar(player, 'Prog') == 2 then + quest:setVar(player, 'Prog', 3) end end, }, @@ -130,7 +129,7 @@ quest.sections = { onZoneIn = function(player, prevZone) if - quest:getVar(player, 'Prog') == 5 and + quest:getVar(player, 'Prog') == 4 and prevZone == xi.zone.NORTH_GUSTABERG_S then return 62 @@ -142,9 +141,9 @@ quest.sections = onTrigger = function(player, npc) local questProgress = quest:getVar(player, 'Prog') - if questProgress == 6 then + if questProgress == 5 then return quest:progressEvent(63) - elseif questProgress == 7 then + elseif questProgress == 6 then return quest:progressEvent(65) end end, @@ -153,11 +152,11 @@ quest.sections = onEventFinish = { [62] = function(player, csid, option, npc) - quest:setVar(player, 'Prog', 6) + quest:setVar(player, 'Prog', 5) end, [63] = function(player, csid, option, npc) - quest:setVar(player, 'Prog', 7) + quest:setVar(player, 'Prog', 6) end, [65] = function(player, csid, option, npc) diff --git a/scripts/quests/crystalWar/Quelling_the_Storm.lua b/scripts/quests/crystalWar/Quelling_the_Storm.lua new file mode 100644 index 00000000000..565709cc46a --- /dev/null +++ b/scripts/quests/crystalWar/Quelling_the_Storm.lua @@ -0,0 +1,314 @@ +----------------------------------- +-- Quelling the Storm +----------------------------------- +-- !addquest 7 42 +-- Gentle Tiger : !pos -203.932 -9.998 2.237 87 +-- Paul : !pos -192.880 -3.999 53.083 87 +-- Biggorf : !pos -210.139 1.999 -140.872 87 +-- Wilhelmina : !pos -158.092 -4.000 -120.077 87 +-- Blatherix : !pos -309.824 -11.999 -42.791 87 +-- ??? (qm8) : !pos -356.278 -32.117 285.950 83 +----------------------------------- + +local quest = Quest:new(xi.questLog.CRYSTAL_WAR, xi.quest.id.crystalWar.QUELLING_THE_STORM) + +local function checkTownNpcProgress(player) + if + quest:getVar(player, 'Paul') == 1 and + quest:getVar(player, 'Biggorf') == 1 and + quest:getVar(player, 'Wilhelmina') == 1 + then + quest:setVar(player, 'Prog', 2) + end +end + +quest.reward = +{ + item = xi.item.GOBLIN_BELT, +} + +quest.sections = +{ + { + check = function(player, status, vars) + return status == xi.questStatus.QUEST_AVAILABLE and + player:hasCompletedQuest(xi.questLog.CRYSTAL_WAR, xi.quest.id.crystalWar.FIRE_IN_THE_HOLE) and + player:getCurrentMission(xi.mission.log_id.WOTG) >= xi.mission.id.wotg.CROSSROADS_OF_TIME + end, + + [xi.zone.BASTOK_MARKETS_S] = + { + onZoneIn = function(player, prevZone) + if prevZone == xi.zone.NORTH_GUSTABERG_S then + return 179 + end + end, + + onEventFinish = + { + [179] = function(player, csid, option, npc) + quest:begin(player) + end, + }, + }, + }, + + { + check = function(player, status, vars) + return status == xi.questStatus.QUEST_ACCEPTED and vars.Prog == 0 + end, + + [xi.zone.BASTOK_MARKETS_S] = + { + ['Gentle_Tiger'] = + { + onTrigger = function(player, npc) + return quest:progressEvent(180) + end, + }, + + onEventFinish = + { + [180] = function(player, csid, option, npc) + quest:setVar(player, 'Prog', 1) + end, + }, + }, + }, + + { + check = function(player, status, vars) + return status == xi.questStatus.QUEST_ACCEPTED and vars.Prog == 1 + end, + + [xi.zone.BASTOK_MARKETS_S] = + { + ['Gentle_Tiger'] = quest:event(186), + + ['Paul'] = + { + onTrigger = function(player, npc) + if quest:getVar(player, 'Paul') == 0 then + return quest:progressEvent(193) + else + return quest:event(196) + end + end, + }, + + ['Biggorf'] = + { + onTrigger = function(player, npc) + if quest:getVar(player, 'Biggorf') == 0 then + return quest:progressEvent(194) + else + return quest:event(197) + end + end, + }, + + ['Wilhelmina'] = + { + onTrigger = function(player, npc) + if quest:getVar(player, 'Wilhelmina') == 0 then + return quest:progressEvent(192) + else + return quest:event(195) + end + end, + }, + + onEventFinish = + { + [192] = function(player, csid, option, npc) + quest:setVar(player, 'Wilhelmina', 1) + checkTownNpcProgress(player) + end, + + [193] = function(player, csid, option, npc) + quest:setVar(player, 'Paul', 1) + checkTownNpcProgress(player) + end, + + [194] = function(player, csid, option, npc) + quest:setVar(player, 'Biggorf', 1) + checkTownNpcProgress(player) + end, + }, + }, + }, + + { + check = function(player, status, vars) + return status == xi.questStatus.QUEST_ACCEPTED and vars.Prog == 2 + end, + + [xi.zone.BASTOK_MARKETS_S] = + { + ['Paul'] = quest:event(196), + ['Biggorf'] = quest:event(197), + ['Wilhelmina'] = quest:event(195), + + ['Gentle_Tiger'] = + { + onTrigger = function(player, npc) + return quest:progressEvent(181) + end, + }, + + onEventFinish = + { + [181] = function(player, csid, option, npc) + quest:setVar(player, 'Prog', 3) + end, + }, + }, + }, + + { + check = function(player, status, vars) + return status == xi.questStatus.QUEST_ACCEPTED and vars.Prog == 3 + end, + + [xi.zone.BASTOK_MARKETS_S] = + { + ['Gentle_Tiger'] = quest:event(187), + + ['Blatherix'] = + { + onTrigger = function(player, npc) + return quest:progressEvent(182) + end, + }, + + onEventFinish = + { + [182] = function(player, csid, option, npc) + quest:setVar(player, 'Prog', 4) + end, + }, + }, + }, + + { + check = function(player, status, vars) + return status == xi.questStatus.QUEST_ACCEPTED and vars.Prog == 4 + end, + + [xi.zone.BASTOK_MARKETS_S] = + { + ['Gentle_Tiger'] = quest:event(187), + + ['Blatherix'] = + { + onTrigger = function(player, npc) + return quest:event(188) + end, + + onTrade = function(player, npc, trade) + if + npcUtil.tradeHasExactly( + trade, + { + xi.item.GOBLIN_MESS_TIN, + xi.item.GOBLIN_MUSHPOT, + xi.item.PINCH_OF_TWINKLE_POWDER, + } + ) + then + return quest:progressEvent(183) + end + end, + }, + + onEventFinish = + { + [183] = function(player, csid, option, npc) + player:confirmTrade() + quest:setVar(player, 'Prog', 5) + end, + }, + }, + }, + + { + check = function(player, status, vars) + return status == xi.questStatus.QUEST_ACCEPTED and vars.Prog == 5 + end, + + [xi.zone.BASTOK_MARKETS_S] = + { + ['Blatherix'] = quest:event(189), + + ['Gentle_Tiger'] = + { + onTrigger = function(player, npc) + return quest:progressEvent(184) + end, + }, + + onEventFinish = + { + [184] = function(player, csid, option, npc) + quest:setVar(player, 'Prog', 6) + end, + }, + }, + }, + + { + check = function(player, status, vars) + return status == xi.questStatus.QUEST_ACCEPTED and vars.Prog == 6 + end, + + [xi.zone.VUNKERL_INLET_S] = + { + ['qm8'] = + { + onTrigger = function(player, npc) + return quest:progressEvent(113) + end, + }, + + onEventFinish = + { + [113] = function(player, csid, option, npc) + quest:setVar(player, 'Prog', 7) + end, + }, + }, + + [xi.zone.BASTOK_MARKETS_S] = + { + ['Gentle_Tiger'] = quest:event(190), + ['Blatherix'] = quest:event(189), + }, + }, + + { + check = function(player, status, vars) + return status == xi.questStatus.QUEST_ACCEPTED and vars.Prog == 7 + end, + + [xi.zone.BASTOK_MARKETS_S] = + { + ['Gentle_Tiger'] = quest:event(191), + + ['Blatherix'] = + { + onTrigger = function(player, npc) + return quest:progressEvent(185) + end, + }, + + onEventFinish = + { + [185] = function(player, csid, option, npc) + quest:complete(player) + end, + }, + }, + }, +} + +return quest