Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[lua, quest] Converts BRD unlock and BRD AF1 to IF #6682

Open
wants to merge 1 commit into
base: base
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
[lua, quest] Converts BRD unlock and BRD AF1 to IF
Co-authored-by: hooksta4 <[email protected]>
  • Loading branch information
2 people authored and Laura Yardeen committed Jan 28, 2025

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
commit 9a34126811e295ed1ea9d8a0f56561ebf6c21e07
2 changes: 1 addition & 1 deletion scripts/globals/quests.lua
Original file line number Diff line number Diff line change
@@ -336,7 +336,7 @@ xi.quest.id =
TENSHODO_MEMBERSHIP = 17, -- +
THE_LOST_CARDIAN = 18, -- +
PATH_OF_THE_BEASTMASTER = 19, -- + Converted
PATH_OF_THE_BARD = 20, -- +
PATH_OF_THE_BARD = 20, -- + Converted
THE_CLOCKMASTER = 21, -- + Converted
CANDLE_MAKING = 22, -- + Converted
CHILDS_PLAY = 23, -- + Converted
2 changes: 1 addition & 1 deletion scripts/quests/jeuno/A_Minstrel_In_Despair.lua
Original file line number Diff line number Diff line change
@@ -19,7 +19,7 @@ quest.sections =
{
check = function(player, status, vars)
return status == xi.questStatus.QUEST_AVAILABLE and
player:getQuestStatus(xi.questLog.JEUNO, xi.quest.id.jeuno.THE_OLD_MONUMENT) == xi.questStatus.QUEST_COMPLETED
player:hasCompletedQuest(xi.questLog.JEUNO, xi.quest.id.jeuno.THE_OLD_MONUMENT)
end,

[xi.zone.LOWER_JEUNO] =
130 changes: 130 additions & 0 deletions scripts/quests/jeuno/BRD_AF1_Painful_Memory.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
-----------------------------------
-- Painful Memory
-----------------------------------
-- Log ID: 3, Quest ID: 63
-- Mertaire: !gotoid 17780764
-- Waters_of_Oblivion: !gotoid 17457347
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Swap these !gotoid checks to !pos this way if ids ever shift this won't cause issues or need to be updated in the future.

-----------------------------------
local ID = zones[xi.zone.RANGUEMONT_PASS]
-----------------------------------

local quest = Quest:new(xi.questLog.JEUNO, xi.quest.id.jeuno.PAINFUL_MEMORY)

quest.reward =
{
item = xi.item.PAPER_KNIFE,
}

quest.sections =
{
{
check = function(player, status, vars)
return status == xi.questStatus.QUEST_AVAILABLE and
player:getMainLvl() >= xi.settings.main.AF1_QUEST_LEVEL and
player:hasCompletedQuest(xi.questLog.JEUNO, xi.quest.id.jeuno.PATH_OF_THE_BARD) and
player:getMainJob() == xi.job.BRD
end,

[xi.zone.LOWER_JEUNO] =
{
['Mertaire'] =
{
onTrigger = function(player, npc)
local initialCS = quest:getVar(player, 'initialCS')

if initialCS == 0 then
return quest:progressEvent(138)
elseif initialCS == 1 then
return quest:progressEvent(137)
end
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

onTrigger = function(player, npc)
    local initialCS = quest:getVar(player, 'initialCS')
    if initialCS == 0 then
        return quest:progressEvent(138)
    elseif initialCS == 1 then
        return quest:progressEvent(137)
    end
end,

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adjusted to the example

end,
},

onEventFinish =
{
[138] = function(player, csid, option, npc)
if option == 1 then
quest:begin(player)
quest:setVar(player, 'initialCS', 0)
npcUtil.giveKeyItem(player, xi.ki.MERTAIRES_BRACELET)
else
quest:setVar(player, 'initialCS', 1)
end
end,

[137] = function(player, csid, option, npc)
if option == 1 then
quest:begin(player)
quest:setVar(player, 'initialCS ', 0)
npcUtil.giveKeyItem(player, xi.ki.MERTAIRES_BRACELET)
end
end,
},
},
},

{
check = function(player, status, vars)
return status == xi.questStatus.QUEST_ACCEPTED
end,

[xi.zone.LOWER_JEUNO] =
{
['Mertaire'] =
{
onTrigger = function(player, npc)
return quest:event(136)
end,
},

['Mataligeat'] =
{
onTrigger = function(player, npc)
if quest:getVar(player, 'Prog') >= 1 then
return quest:event(141)
end
end,
},
},

[xi.zone.RANGUEMONT_PASS] =
{
['Waters_of_Oblivion'] =
{
onTrigger = function(player, npc)
local nmKilled = quest:getVar(player, 'nmKilled')

if
player:hasKeyItem(xi.ki.MERTAIRES_BRACELET) and
npcUtil.popFromQM(player, npc, ID.mob.TROS, { claim = true, hide = 0 }) and
nmKilled == 0
then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As written, there is a bug with this part of the code. If the player delays checking the Waters of Oblivion until after Tros has fully despawned, Tros will then respawn and agro onto the player while they are in the final cutscene.

if
    nmKilled == 0 and
    player:hasKeyItem(xi.ki.MERTAIRES_BRACELET) and
    npcUtil.popFromQM(player, npc, ID.mob.TROS, { claim = true, hide = 0 })
then

Swap the NM killed check to the top (or at least above the NM spawn) to prevent this from happening. Since you want to make sure all checks are passed before spawning the NM.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, I'll keep that in mind for future quests. Got it adjusted, along with the NPC commands below.

return quest:noAction()
elseif nmKilled == 1 then
return quest:progressEvent(8)
end
end,
},

['Tros'] =
{
onMobDeath = function(mob, player, optParams)
if player:hasKeyItem(xi.ki.MERTAIRES_BRACELET) then
quest:setVar(player, 'nmKilled', 1)
end
end,
},

onEventFinish =
{
[8] = function(player, csid, option, npc)
if quest:complete(player) then
player:delKeyItem(xi.ki.MERTAIRES_BRACELET)
end
end,
},
},
},
}

return quest
50 changes: 50 additions & 0 deletions scripts/quests/jeuno/Path_of_the_Bard.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
-- -----------------------------------
-- -- Path of the Bard
-- -----------------------------------
-- -- Log ID: 3, Quest ID: 20
-- -- Song Runes: !gotoid 17199695
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This !gotoid as well.

-- -----------------------------------
local ID = zones[xi.zone.VALKURM_DUNES]
-----------------------------------

local quest = Quest:new(xi.questLog.JEUNO, xi.quest.id.jeuno.PATH_OF_THE_BARD)

quest.reward =
{
gil = 3000,
fame = 30,
fameArea = xi.fameArea.JEUNO,
title = xi.title.WANDERING_MINSTREL,
}

quest.sections =
{
{
check = function(player, status, vars)
return status == xi.questStatus.QUEST_AVAILABLE and
player:hasCompletedQuest(xi.questLog.JEUNO, xi.quest.id.jeuno.A_MINSTREL_IN_DESPAIR)
end,

[xi.zone.VALKURM_DUNES] =
{
['Song_Runes'] =
{
onTrigger = function(player, npc)
return quest:progressEvent(2)
end,
},

onEventFinish =
{
[2] = function(player, csid, option, npc)
if quest:complete(player) then
player:unlockJob(xi.job.BRD)
player:messageSpecial(ID.text.UNLOCK_BARD)
end
end,
},
},
},
}

return quest
1 change: 1 addition & 0 deletions scripts/zones/Lower_Jeuno/IDs.lua
Original file line number Diff line number Diff line change
@@ -36,6 +36,7 @@ zones[xi.zone.LOWER_JEUNO] =
CHOCOBO_DIALOG = 7337, -- Hmph.
MERTAIRE_MALLIEBELL_LEFT = 7418, -- Ugh... Malliebell... This time she's left me forever...
MERTAIRE_DEFAULT = 7443, -- Who are you? Leave me alone!
MERTAIRE_MINSTREL = 7453, -- Wait, could he be...? Naw, he couldn't be.
ITS_LOCKED = 7605, -- It's locked.
PAWKRIX_SHOP_DIALOG = 7653, -- Hey, we're fixin' up some stew. Gobbie food's good food!
AMALASANDA_SHOP_DIALOG = 7701, -- Welcome to the Tenshodo. You want something, we got it. We got all kinds of special merchandise you won't find anywhere else!
36 changes: 6 additions & 30 deletions scripts/zones/Lower_Jeuno/npcs/Mertaire.lua
Original file line number Diff line number Diff line change
@@ -12,26 +12,12 @@ local entity = {}
entity.onTrigger = function(player, npc)
local painfulMemory = player:getQuestStatus(xi.questLog.JEUNO, xi.quest.id.jeuno.PAINFUL_MEMORY)
local circleOfTime = player:getQuestStatus(xi.questLog.JEUNO, xi.quest.id.jeuno.THE_CIRCLE_OF_TIME)
local minstrel = player:getQuestStatus(xi.questLog.JEUNO, xi.quest.id.jeuno.A_MINSTREL_IN_DESPAIR)
local job = player:getMainJob()
local level = player:getMainLvl()

-- PAINFUL MEMORY (Bard AF1)
if
painfulMemory == xi.questStatus.QUEST_AVAILABLE and
job == xi.job.BRD and
level >= xi.settings.main.AF1_QUEST_LEVEL
then
if player:getCharVar('PainfulMemoryCS') == 0 then
player:startEvent(138) -- Long dialog for 'Painful Memory'
else
player:startEvent(137) -- Short dialog for 'Painful Memory'
end

elseif painfulMemory == xi.questStatus.QUEST_ACCEPTED then
player:startEvent(136) -- During Quest 'Painful Memory'

-- CIRCLE OF TIME (Bard AF3)
elseif
if
player:getQuestStatus(xi.questLog.JEUNO, xi.quest.id.jeuno.THE_REQUIEM) == xi.questStatus.QUEST_COMPLETED and
circleOfTime == xi.questStatus.QUEST_AVAILABLE and
job == xi.job.BRD and
@@ -46,27 +32,17 @@ entity.onTrigger = function(player, npc)
elseif painfulMemory == xi.questStatus.QUEST_COMPLETED then
player:startEvent(135) -- Standard dialog after completed "Painful Memory"

elseif minstrel == xi.questStatus.QUEST_COMPLETED then
player:messageSpecial(ID.text.MERTAIRE_MINSTREL) -- Standard dialog after completing "A Minstrel in Despair"

else
player:messageSpecial(ID.text.MERTAIRE_DEFAULT)
end
end

entity.onEventFinish = function(player, csid, option, npc)
-- PAINFUL MEMORY (Bard AF1)
if csid == 138 and option == 0 then
player:setCharVar('PainfulMemoryCS', 1) -- player declined quest

elseif
(csid == 137 or csid == 138) and
option == 1
then
player:addQuest(xi.questLog.JEUNO, xi.quest.id.jeuno.PAINFUL_MEMORY)
player:setCharVar('PainfulMemoryCS', 0)
player:addKeyItem(xi.ki.MERTAIRES_BRACELET)
player:messageSpecial(ID.text.KEYITEM_OBTAINED, xi.ki.MERTAIRES_BRACELET)

-- CIRCLE OF TIME (Bard AF3)
elseif csid == 139 then
if csid == 139 then
player:addQuest(xi.questLog.JEUNO, xi.quest.id.jeuno.THE_CIRCLE_OF_TIME)
player:setCharVar('circleTime', 1)
end
5 changes: 5 additions & 0 deletions scripts/zones/Ranguemont_Pass/DefaultActions.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
local ID = zones[xi.zone.RANGUEMONT_PASS]

return {
['Waters_of_Oblivion'] = { messageSpecial = ID.text.NOTHING_OUT_OF_ORDINARY },
}
4 changes: 0 additions & 4 deletions scripts/zones/Ranguemont_Pass/mobs/Tros.lua
Original file line number Diff line number Diff line change
@@ -12,10 +12,6 @@ entity.onMobInitialize = function(mob)
end

entity.onMobDeath = function(mob, player, optParams)
if player:hasKeyItem(xi.ki.MERTAIRES_BRACELET) then
player:setCharVar('TrosKilled', 1)
player:setCharVar('Tros_Timer', os.time())
end
end

return entity
23 changes: 0 additions & 23 deletions scripts/zones/Ranguemont_Pass/npcs/Waters_of_Oblivion.lua
Original file line number Diff line number Diff line change
@@ -4,36 +4,13 @@
-- Finish Quest: Painful Memory (BARD AF1)
-- !pos -284 -45 210 166
-----------------------------------
local ID = zones[xi.zone.RANGUEMONT_PASS]
-----------------------------------
---@type TNpcEntity
local entity = {}

entity.onTrigger = function(player, npc)
local trosKilled = player:getCharVar('TrosKilled')

if
player:hasKeyItem(xi.ki.MERTAIRES_BRACELET) and
not GetMobByID(ID.mob.TROS):isSpawned() and
(trosKilled == 0 or (os.time() - player:getCharVar('Tros_Timer')) > 60)
then
player:messageSpecial(ID.text.SENSE_OF_FOREBODING)
SpawnMob(ID.mob.TROS):updateClaim(player)
elseif player:hasKeyItem(xi.ki.MERTAIRES_BRACELET) and trosKilled == 1 then
player:startEvent(8) -- Finish Quest 'Painful Memory'
else
player:messageSpecial(ID.text.NOTHING_OUT_OF_ORDINARY)
end
end

entity.onEventFinish = function(player, csid, option, npc)
if csid == 8 then
if npcUtil.completeQuest(player, xi.questLog.JEUNO, xi.quest.id.jeuno.PAINFUL_MEMORY, { item = 16766 }) then
player:delKeyItem(xi.ki.MERTAIRES_BRACELET)
player:setCharVar('TrosKilled', 0)
player:setCharVar('Tros_Timer', 0)
end
end
end

return entity
1 change: 1 addition & 0 deletions scripts/zones/Valkurm_Dunes/DefaultActions.lua
Original file line number Diff line number Diff line change
@@ -6,4 +6,5 @@ return {
['qm4'] = { messageSpecial = ID.text.MONSTERS_KILLED_ADVENTURERS },
['Signpost1'] = { messageSpecial = ID.text.SIGNPOST1 },
['Signpost2'] = { messageSpecial = ID.text.SIGNPOST2 },
['Song_Runes'] = { messageSpecial = ID.text.SONG_RUNES_DEFAULT },
}
22 changes: 0 additions & 22 deletions scripts/zones/Valkurm_Dunes/npcs/Song_Runes.lua
Original file line number Diff line number Diff line change
@@ -4,35 +4,13 @@
-- Finishes Quest: Path of the Bard
-- !pos -721 -7 102 103
-----------------------------------
local ID = zones[xi.zone.VALKURM_DUNES]
-----------------------------------
---@type TNpcEntity
local entity = {}

entity.onTrigger = function(player, npc)
-- PATH OF THE BARD (Bard Flag)
if
player:getQuestStatus(xi.questLog.JEUNO, xi.quest.id.jeuno.PATH_OF_THE_BARD) == xi.questStatus.QUEST_AVAILABLE and
player:getCharVar('PathOfTheBard_Event') == 1
then
player:startEvent(2)

-- DEFAULT DIALOG
else
player:messageSpecial(ID.text.SONG_RUNES_DEFAULT)
end
end

entity.onEventFinish = function(player, csid, option, npc)
if csid == 2 then
npcUtil.giveCurrency(player, 'gil', 3000)
player:addTitle(xi.title.WANDERING_MINSTREL)
player:unlockJob(xi.job.BRD) -- Bard
player:messageSpecial(ID.text.UNLOCK_BARD) --You can now become a bard!
player:setCharVar('PathOfTheBard_Event', 0)
player:addFame(xi.fameArea.JEUNO, 30)
player:completeQuest(xi.questLog.JEUNO, xi.quest.id.jeuno.PATH_OF_THE_BARD)
end
end

return entity