From 890547924b61a992650fe1959031d2d153a775a3 Mon Sep 17 00:00:00 2001 From: Aeshur Date: Tue, 14 Apr 2026 12:53:43 -0400 Subject: [PATCH] [lua] Convert Better Part of Valor + Fires of Discontent to IF --- scripts/globals/quests.lua | 4 +- .../crystalWar/Better_Part_of_Valor.lua | 144 +++++++++++++++ .../quests/crystalWar/Fires_of_Discontent.lua | 172 ++++++++++++++++++ .../Bastok_Markets_[S]/DefaultActions.lua | 3 + .../Bastok_Markets_[S]/npcs/Engelhart.lua | 69 ------- .../Bastok_Markets_[S]/npcs/Gentle_Tiger.lua | 27 --- .../zones/Bastok_Markets_[S]/npcs/Pagdako.lua | 27 --- scripts/zones/Grauberg_[S]/npcs/qm5.lua | 25 --- scripts/zones/Metalworks/npcs/Iron_Eater.lua | 27 --- scripts/zones/North_Gustaberg_[S]/Zone.lua | 16 +- .../zones/North_Gustaberg_[S]/npcs/qm1.lua | 25 --- .../zones/Vunkerl_Inlet_[S]/npcs/Leadavox.lua | 45 ----- 12 files changed, 322 insertions(+), 262 deletions(-) create mode 100644 scripts/quests/crystalWar/Better_Part_of_Valor.lua create mode 100644 scripts/quests/crystalWar/Fires_of_Discontent.lua delete mode 100644 scripts/zones/Bastok_Markets_[S]/npcs/Engelhart.lua delete mode 100644 scripts/zones/Bastok_Markets_[S]/npcs/Gentle_Tiger.lua delete mode 100644 scripts/zones/Bastok_Markets_[S]/npcs/Pagdako.lua delete mode 100644 scripts/zones/Grauberg_[S]/npcs/qm5.lua delete mode 100644 scripts/zones/Metalworks/npcs/Iron_Eater.lua delete mode 100644 scripts/zones/North_Gustaberg_[S]/npcs/qm1.lua delete mode 100644 scripts/zones/Vunkerl_Inlet_[S]/npcs/Leadavox.lua diff --git a/scripts/globals/quests.lua b/scripts/globals/quests.lua index 27d775b971f..760b054a9b7 100644 --- a/scripts/globals/quests.lua +++ b/scripts/globals/quests.lua @@ -718,8 +718,8 @@ xi.quest.id = STEAMED_RAMS = 9, -- + Converted SEEING_SPOTS = 10, -- + Converted THE_FLIPSIDE_OF_THINGS = 11, -- + Converted - BETTER_PART_OF_VALOR = 12, - FIRES_OF_DISCONTENT = 13, + BETTER_PART_OF_VALOR = 12, -- + Converted + FIRES_OF_DISCONTENT = 13, -- + Converted HAMMERING_HEARTS = 14, -- + Converted GIFTS_OF_THE_GRIFFON = 15, -- + Converted CLAWS_OF_THE_GRIFFON = 16, -- + Converted diff --git a/scripts/quests/crystalWar/Better_Part_of_Valor.lua b/scripts/quests/crystalWar/Better_Part_of_Valor.lua new file mode 100644 index 00000000000..bdee46ec3e9 --- /dev/null +++ b/scripts/quests/crystalWar/Better_Part_of_Valor.lua @@ -0,0 +1,144 @@ +----------------------------------- +-- Better Part of Valor +----------------------------------- +-- !addquest 7 12 +-- Wolfram : !pos -249 0 88 87 +-- Engelhart : !pos -79 -4 -123 87 +-- ??? : !pos -232 41 425 88 +-- Leadavox : !pos 206 -32 316 83 +----------------------------------- + +local quest = Quest:new(xi.questLog.CRYSTAL_WAR, xi.quest.id.crystalWar.BETTER_PART_OF_VALOR) + +quest.reward = +{ + gil = 10000, + keyItem = xi.ki.WARNING_LETTER, +} + +quest.sections = +{ + { + check = function(player, status, vars) + return status == xi.questStatus.QUEST_AVAILABLE + end, + + [xi.zone.NORTH_GUSTABERG_S] = + { + onZoneIn = function(player, prevZone) + if + prevZone == xi.zone.BASTOK_MARKETS_S and + player:getCampaignAllegiance() > 0 + then + return 1 + end + end, + + onEventFinish = + { + [1] = function(player, csid, option, npc) + quest:begin(player) + npcUtil.giveKeyItem(player, xi.ki.CLUMP_OF_ANIMAL_HAIR) + end, + }, + }, + }, + + { + check = function(player, status, vars) + return status == xi.questStatus.QUEST_ACCEPTED + end, + + [xi.zone.BASTOK_MARKETS_S] = + { + ['Engelhart'] = + { + onTrigger = function(player, npc) + local questProgress = quest:getVar(player, 'Prog') + + if questProgress == 0 then + return quest:progressEvent(116) + elseif questProgress == 4 then + return quest:progressEvent(118) + else + return quest:event(117) + end + end, + }, + + onEventFinish = + { + [116] = function(player, csid, option, npc) + quest:setVar(player, 'Prog', 1) + player:delKeyItem(xi.ki.CLUMP_OF_ANIMAL_HAIR) + end, + + [118] = function(player, csid, option, npc) + if quest:complete(player) then + player:delKeyItem(xi.ki.XHIFHUT) + player:needToZone(true) + end + end, + }, + }, + + [xi.zone.NORTH_GUSTABERG_S] = + { + ['qm1'] = + { + onTrigger = function(player, npc) + if quest:getVar(player, 'Prog') == 1 then + return quest:progressEvent(3) + end + end, + }, + + onEventFinish = + { + [3] = function(player, csid, option, npc) + quest:setVar(player, 'Prog', 2) + end, + }, + }, + + [xi.zone.VUNKERL_INLET_S] = + { + ['Leadavox'] = + { + onTrigger = function(player, npc) + local questProgress = quest:getVar(player, 'Prog') + + if questProgress == 2 then + return quest:progressEvent(101) + elseif questProgress == 3 then + return quest:event(102) + end + end, + + onTrade = function(player, npc, trade) + if + quest:getVar(player, 'Prog') == 3 and + npcUtil.tradeHasExactly(trade, { { xi.item.GNOLE_CLAW, 1 } }) + then + return quest:progressEvent(103) + end + end, + }, + + onEventFinish = + { + [101] = function(player, csid, option, npc) + quest:setVar(player, 'Prog', 3) + end, + + [103] = function(player, csid, option, npc) + player:confirmTrade() + npcUtil.giveKeyItem(player, xi.ki.XHIFHUT) + quest:setVar(player, 'Prog', 4) + end, + }, + }, + }, +} + +return quest diff --git a/scripts/quests/crystalWar/Fires_of_Discontent.lua b/scripts/quests/crystalWar/Fires_of_Discontent.lua new file mode 100644 index 00000000000..374c4f9a8d3 --- /dev/null +++ b/scripts/quests/crystalWar/Fires_of_Discontent.lua @@ -0,0 +1,172 @@ +----------------------------------- +-- Fires of Discontent +----------------------------------- +-- !addquest 7 13 +-- Engelhart : !pos -80.085 -4.425 -125.327 87 +-- Pagdako : !pos -202.080 -6.000 -93.928 87 +-- Iron Eater : !pos 92.936 -19.532 1.814 237 +-- qm5 : !pos 259.793 33.192 515.257 89 +-- Gentle Tiger : !pos -203.932 -9.998 2.237 87 +----------------------------------- + +local quest = Quest:new(xi.questLog.CRYSTAL_WAR, xi.quest.id.crystalWar.FIRES_OF_DISCONTENT) + +quest.reward = +{ + gil = 10000, +} + +quest.sections = +{ + { + check = function(player, status, vars) + return status == xi.questStatus.QUEST_AVAILABLE and + player:hasCompletedQuest(xi.questLog.CRYSTAL_WAR, xi.quest.id.crystalWar.BETTER_PART_OF_VALOR) + end, + + [xi.zone.BASTOK_MARKETS_S] = + { + ['Engelhart'] = + { + onTrigger = function(player, npc) + return quest:progressEvent(120) + end, + }, + + onEventFinish = + { + [120] = function(player, csid, option, npc) + quest:begin(player) + end, + }, + }, + }, + + { + check = function(player, status, vars) + return status == xi.questStatus.QUEST_ACCEPTED + end, + + [xi.zone.BASTOK_MARKETS_S] = + { + ['Engelhart'] = + { + onTrigger = function(player, npc) + local questProgress = quest:getVar(player, 'Prog') + + if questProgress < 2 then + return quest:event(121) + elseif questProgress == 2 then + return quest:progressEvent(124) + elseif questProgress == 3 then + return quest:event(125) + elseif questProgress == 4 then + return quest:progressEvent(126) + elseif questProgress == 5 then + return quest:event(127) + elseif questProgress == 6 then + return quest:progressEvent(164) + end + end, + }, + + ['Pagdako'] = + { + onTrigger = function(player, npc) + if quest:getVar(player, 'Prog') == 0 then + return quest:progressEvent(122) + else + return quest:event(123) + end + end, + }, + + ['Gentle_Tiger'] = + { + onTrigger = function(player, npc) + if quest:getVar(player, 'Prog') == 5 then + return quest:progressEvent(160) + else + return quest:event(161) + end + end, + }, + + onEventFinish = + { + [122] = function(player, csid, option, npc) + quest:setVar(player, 'Prog', 1) + end, + + [124] = function(player, csid, option, npc) + quest:setVar(player, 'Prog', 3) + end, + + [126] = function(player, csid, option, npc) + quest:setVar(player, 'Prog', 5) + end, + + [160] = function(player, csid, option, npc) + quest:setVar(player, 'Prog', 6) + end, + + [164] = function(player, csid, option, npc) + quest:complete(player) + end, + }, + }, + + [xi.zone.METALWORKS] = + { + ['Iron_Eater'] = + { + onTrigger = function(player, npc) + if quest:getVar(player, 'Prog') == 1 then + return quest:progressEvent(956) + else + return quest:event(957) + end + end, + }, + + onEventFinish = + { + [956] = function(player, csid, option, npc) + quest:setVar(player, 'Prog', 2) + end, + }, + }, + + [xi.zone.GRAUBERG_S] = + { + ['qm5'] = + { + onTrigger = function(player, npc) + if quest:getVar(player, 'Prog') == 3 then + return quest:progressEvent(11) + end + end, + }, + + onEventFinish = + { + [11] = function(player, csid, option, npc) + quest:setVar(player, 'Prog', 4) + end, + }, + }, + }, + + { + check = function(player, status, vars) + return status == xi.questStatus.QUEST_COMPLETED + end, + + [xi.zone.BASTOK_MARKETS_S] = + { + ['Engelhart'] = quest:event(165):replaceDefault(), + }, + }, +} + +return quest diff --git a/scripts/zones/Bastok_Markets_[S]/DefaultActions.lua b/scripts/zones/Bastok_Markets_[S]/DefaultActions.lua index be4d424f778..73474d222a2 100644 --- a/scripts/zones/Bastok_Markets_[S]/DefaultActions.lua +++ b/scripts/zones/Bastok_Markets_[S]/DefaultActions.lua @@ -8,5 +8,8 @@ return { ['Bottomless_Gorge'] = { event = 150 }, ['Christoph'] = { event = 157 }, ['Clemens'] = { event = 149 }, + ['Engelhart'] = { event = 104 }, + ['Gentle_Tiger'] = { event = 109 }, ['Heumila'] = { event = 0 }, + ['Pagdako'] = { event = 106 }, } diff --git a/scripts/zones/Bastok_Markets_[S]/npcs/Engelhart.lua b/scripts/zones/Bastok_Markets_[S]/npcs/Engelhart.lua deleted file mode 100644 index 5f4338bf58b..00000000000 --- a/scripts/zones/Bastok_Markets_[S]/npcs/Engelhart.lua +++ /dev/null @@ -1,69 +0,0 @@ ------------------------------------ --- Area: Bastok Markets (S) --- NPC: Engelhart --- pos -79 -4 -125 ------------------------------------ ----@type TNpcEntity -local entity = {} - -entity.onTrigger = function(player, npc) - if player:getQuestStatus(xi.questLog.CRYSTAL_WAR, xi.quest.id.crystalWar.BETTER_PART_OF_VALOR) == xi.questStatus.QUEST_ACCEPTED then - if player:getCharVar('BetterPartOfValProg') == 0 then - player:startEvent(116) - elseif player:getCharVar('BetterPartOfValProg') == 4 then - player:startEvent(118) - else - player:startEvent(117) - end - elseif - player:getQuestStatus(xi.questLog.CRYSTAL_WAR, xi.quest.id.crystalWar.BETTER_PART_OF_VALOR) == xi.questStatus.QUEST_COMPLETED and - player:getQuestStatus(xi.questLog.CRYSTAL_WAR, xi.quest.id.crystalWar.FIRES_OF_DISCONTENT) == xi.questStatus.QUEST_AVAILABLE - then - player:startEvent(120) - elseif player:getQuestStatus(xi.questLog.CRYSTAL_WAR, xi.quest.id.crystalWar.FIRES_OF_DISCONTENT) == xi.questStatus.QUEST_ACCEPTED then - if player:getCharVar('FiresOfDiscProg') < 2 then - player:startEvent(121) - elseif player:getCharVar('FiresOfDiscProg') == 2 then - player:startEvent(124) - elseif player:getCharVar('FiresOfDiscProg') == 3 then - player:startEvent(125) - elseif player:getCharVar('FiresOfDiscProg') == 4 then - player:startEvent(126) - elseif player:getCharVar('FiresOfDiscProg') == 5 then - player:startEvent(127) - elseif player:getCharVar('FiresOfDiscProg') == 6 then - player:startEvent(164) - end - elseif player:getQuestStatus(xi.questLog.CRYSTAL_WAR, xi.quest.id.crystalWar.FIRES_OF_DISCONTENT) == xi.questStatus.QUEST_COMPLETED then - player:startEvent(165) - else - player:startEvent(104) - end -end - -entity.onEventFinish = function(player, csid, option, npc) - if csid == 116 then - player:setCharVar('BetterPartOfValProg', 1) - player:delKeyItem(xi.ki.CLUMP_OF_ANIMAL_HAIR) - elseif csid == 118 then - player:delKeyItem(xi.ki.XHIFHUT) - player:completeQuest(xi.questLog.CRYSTAL_WAR, xi.quest.id.crystalWar.BETTER_PART_OF_VALOR) - npcUtil.giveKeyItem(player, xi.ki.WARNING_LETTER) - npcUtil.giveCurrency(player, 'gil', 10000) - player:setCharVar('BetterPartOfValProg', 0) - player:needToZone(true) - elseif csid == 120 then - player:addQuest(xi.questLog.CRYSTAL_WAR, xi.quest.id.crystalWar.FIRES_OF_DISCONTENT) - player:delKeyItem(xi.ki.WARNING_LETTER) - elseif csid == 124 then - player:setCharVar('FiresOfDiscProg', 3) - elseif csid == 126 then - player:setCharVar('FiresOfDiscProg', 5) - elseif csid == 164 then - player:completeQuest(xi.questLog.CRYSTAL_WAR, xi.quest.id.crystalWar.FIRES_OF_DISCONTENT) - npcUtil.giveCurrency(player, 'gil', 10000) - player:setCharVar('FiresOfDiscProg', 0) - end -end - -return entity diff --git a/scripts/zones/Bastok_Markets_[S]/npcs/Gentle_Tiger.lua b/scripts/zones/Bastok_Markets_[S]/npcs/Gentle_Tiger.lua deleted file mode 100644 index 7b22984de1b..00000000000 --- a/scripts/zones/Bastok_Markets_[S]/npcs/Gentle_Tiger.lua +++ /dev/null @@ -1,27 +0,0 @@ ------------------------------------ --- Area: Bastok Markets [S] --- NPC: GentleTiger --- !pos -203 -10 1 ------------------------------------ ----@type TNpcEntity -local entity = {} - -entity.onTrigger = function(player, npc) - if player:getQuestStatus(xi.questLog.CRYSTAL_WAR, xi.quest.id.crystalWar.FIRES_OF_DISCONTENT) == xi.questStatus.QUEST_ACCEPTED then - if player:getCharVar('FiresOfDiscProg') == 5 then - player:startEvent(160) - else - player:startEvent(161) - end - else - player:startEvent(109) - end -end - -entity.onEventFinish = function(player, csid, option) - if csid == 160 then - player:setCharVar('FiresOfDiscProg', 6) - end -end - -return entity diff --git a/scripts/zones/Bastok_Markets_[S]/npcs/Pagdako.lua b/scripts/zones/Bastok_Markets_[S]/npcs/Pagdako.lua deleted file mode 100644 index ba630b650ed..00000000000 --- a/scripts/zones/Bastok_Markets_[S]/npcs/Pagdako.lua +++ /dev/null @@ -1,27 +0,0 @@ ------------------------------------ --- Area: Bastok Markets (S) --- NPC: Pagdako --- pos -200 -6 -93 ------------------------------------ ----@type TNpcEntity -local entity = {} - -entity.onTrigger = function(player, npc) - if player:getQuestStatus(xi.questLog.CRYSTAL_WAR, xi.quest.id.crystalWar.FIRES_OF_DISCONTENT) == xi.questStatus.QUEST_ACCEPTED then - if player:getCharVar('FiresOfDiscProg') == 0 then - player:startEvent(122) - else - player:startEvent(123) - end - else - player:startEvent(106) - end -end - -entity.onEventFinish = function(player, csid, option, npc) - if csid == 122 then - player:setCharVar('FiresOfDiscProg', 1) - end -end - -return entity diff --git a/scripts/zones/Grauberg_[S]/npcs/qm5.lua b/scripts/zones/Grauberg_[S]/npcs/qm5.lua deleted file mode 100644 index 6ba7c7656fd..00000000000 --- a/scripts/zones/Grauberg_[S]/npcs/qm5.lua +++ /dev/null @@ -1,25 +0,0 @@ ------------------------------------ --- Area: Grauberg [S] --- NPC: ??? --- Quest - Fires of Discontent --- pos 258 33 516 ------------------------------------ ----@type TNpcEntity -local entity = {} - -entity.onTrigger = function(player, npc) - if - player:getQuestStatus(xi.questLog.CRYSTAL_WAR, xi.quest.id.crystalWar.FIRES_OF_DISCONTENT) == xi.questStatus.QUEST_ACCEPTED and - player:getCharVar('FiresOfDiscProg') == 3 - then - player:startEvent(11) - end -end - -entity.onEventFinish = function(player, csid, option, npc) - if csid == 11 then - player:setCharVar('FiresOfDiscProg', 4) - end -end - -return entity diff --git a/scripts/zones/Metalworks/npcs/Iron_Eater.lua b/scripts/zones/Metalworks/npcs/Iron_Eater.lua deleted file mode 100644 index 60563f8709f..00000000000 --- a/scripts/zones/Metalworks/npcs/Iron_Eater.lua +++ /dev/null @@ -1,27 +0,0 @@ ------------------------------------ --- Area: Metalworks --- NPC: Iron Eater --- Involved in Missions --- Starts and Finishes; The Weight of Your Limits --- !pos 92.936 -19.532 1.814 237 ------------------------------------ ----@type TNpcEntity -local entity = {} - -entity.onTrigger = function(player, npc) - if player:getQuestStatus(xi.questLog.CRYSTAL_WAR, xi.quest.id.crystalWar.FIRES_OF_DISCONTENT) == xi.questStatus.QUEST_ACCEPTED then - if player:getCharVar('FiresOfDiscProg') == 1 then - player:startEvent(956) - else - player:startEvent(957) - end - end -end - -entity.onEventFinish = function(player, csid, option, npc) - if csid == 956 then - player:setCharVar('FiresOfDiscProg', 2) - end -end - -return entity diff --git a/scripts/zones/North_Gustaberg_[S]/Zone.lua b/scripts/zones/North_Gustaberg_[S]/Zone.lua index b438f8463f9..38fee922abf 100644 --- a/scripts/zones/North_Gustaberg_[S]/Zone.lua +++ b/scripts/zones/North_Gustaberg_[S]/Zone.lua @@ -10,8 +10,6 @@ zoneObject.onInitialize = function(zone) end zoneObject.onZoneIn = function(player, prevZone) - local cs = -1 - if player:getXPos() == 0 and player:getYPos() == 0 and @@ -20,15 +18,7 @@ zoneObject.onZoneIn = function(player, prevZone) player:setPos(380.038, -2.25, 147.627, 192) end - if - prevZone == xi.zone.BASTOK_MARKETS_S and - player:getCampaignAllegiance() > 0 and - player:getQuestStatus(xi.questLog.CRYSTAL_WAR, xi.quest.id.crystalWar.BETTER_PART_OF_VALOR) == xi.questStatus.QUEST_AVAILABLE - then - cs = 1 - end - - return cs + return -1 end zoneObject.onTriggerAreaEnter = function(player, triggerArea) @@ -38,10 +28,6 @@ zoneObject.onEventUpdate = function(player, csid, option, npc) end zoneObject.onEventFinish = function(player, csid, option, npc) - if csid == 1 then - player:addQuest(xi.questLog.CRYSTAL_WAR, xi.quest.id.crystalWar.BETTER_PART_OF_VALOR) - npcUtil.giveKeyItem(player, xi.ki.CLUMP_OF_ANIMAL_HAIR) - end end return zoneObject diff --git a/scripts/zones/North_Gustaberg_[S]/npcs/qm1.lua b/scripts/zones/North_Gustaberg_[S]/npcs/qm1.lua deleted file mode 100644 index 9b986081738..00000000000 --- a/scripts/zones/North_Gustaberg_[S]/npcs/qm1.lua +++ /dev/null @@ -1,25 +0,0 @@ ------------------------------------ --- Area: North Gustaberg (S) (F-8) --- NPC: ??? --- Involved in Quests --- !pos -232 41 425 ------------------------------------ ----@type TNpcEntity -local entity = {} - -entity.onTrigger = function(player, npc) - if - player:getQuestStatus(xi.questLog.CRYSTAL_WAR, xi.quest.id.crystalWar.BETTER_PART_OF_VALOR) == xi.questStatus.QUEST_ACCEPTED and - player:getCharVar('BetterPartOfValProg') == 1 - then - player:startEvent(3) - end -end - -entity.onEventFinish = function(player, csid, option, npc) - if csid == 3 then - player:setCharVar('BetterPartOfValProg', 2) - end -end - -return entity diff --git a/scripts/zones/Vunkerl_Inlet_[S]/npcs/Leadavox.lua b/scripts/zones/Vunkerl_Inlet_[S]/npcs/Leadavox.lua deleted file mode 100644 index 5e353a34914..00000000000 --- a/scripts/zones/Vunkerl_Inlet_[S]/npcs/Leadavox.lua +++ /dev/null @@ -1,45 +0,0 @@ ------------------------------------ --- Area: Vunkerl Inlet (S) (I-6) --- NPC: Leadavox --- Involved in Quests --- !pos 206 -32 316 ------------------------------------ ----@type TNpcEntity -local entity = {} - -entity.onTrade = function(player, npc, trade) - if - player:getQuestStatus(xi.questLog.CRYSTAL_WAR, xi.quest.id.crystalWar.BETTER_PART_OF_VALOR) == xi.questStatus.QUEST_ACCEPTED and - player:getCharVar('BetterPartOfValProg') == 3 - then - if - trade:hasItemQty(xi.item.GNOLE_CLAW, 1) and - trade:getItemCount() == 1 and - trade:getGil() == 0 - then - player:startEvent(103) - end - end -end - -entity.onTrigger = function(player, npc) - if player:getQuestStatus(xi.questLog.CRYSTAL_WAR, xi.quest.id.crystalWar.BETTER_PART_OF_VALOR) == xi.questStatus.QUEST_ACCEPTED then - if player:getCharVar('BetterPartOfValProg') == 2 then - player:startEvent(101) - elseif player:getCharVar('BetterPartOfValProg') == 3 then - player:startEvent(102) - end - end -end - -entity.onEventFinish = function(player, csid, option, npc) - if csid == 101 then - player:setCharVar('BetterPartOfValProg', 3) - elseif csid == 103 then - player:tradeComplete() - player:setCharVar('BetterPartOfValProg', 4) - npcUtil.giveKeyItem(player, xi.ki.XHIFHUT) - end -end - -return entity