Skip to content

Commit

Permalink
Convert Beast AF1 Quest
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesbradleym committed Sep 4, 2024
1 parent 38e60f3 commit c7b0b87
Show file tree
Hide file tree
Showing 3 changed files with 102 additions and 34 deletions.
2 changes: 1 addition & 1 deletion scripts/globals/quests.lua
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ xi.quest.id =
BORGHERTZ_S_DRAGON_HANDS = 57, -- +
BORGHERTZ_S_CALLING_HANDS = 58, -- +
AXE_THE_COMPETITION = 59, -- + Converted
WINGS_OF_GOLD = 60, -- ±
WINGS_OF_GOLD = 60, -- ± Converted
SCATTERED_INTO_SHADOW = 61, -- ±
A_NEW_DAWN = 62,
PAINFUL_MEMORY = 63, -- +
Expand Down
99 changes: 99 additions & 0 deletions scripts/quests/jeuno/Wings_of_Gold.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
-----------------------------------
-- Wings of Gold
-----------------------------------
-- Log ID: 3, Quest ID: 60
-- Brutus : !pos -55 8 95 244
-----------------------------------
local quest = Quest:new(xi.questLog.JEUNO, xi.quest.id.jeuno.WINGS_OF_GOLD)

quest.reward =
{
fame = 20,
fameArea = xi.fameArea.JEUNO,
item = xi.item.BARBAROI_AXE,
}

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

[xi.zone.UPPER_JEUNO] =
{
['Brutus'] =
{
onTrigger = function(player, npc)
if quest:getVar(player, 'Prog') == 0 then
return quest:progressEvent(139)
else
return quest:progressEvent(137)
end
end,

},
onEventFinish =
{
[137] = function(player, csid, option, npc)
if option == 1 then
quest:begin(player)
end
end,

[139] = function(player, csid, option, npc)
if option == 1 then
quest:begin(player)
else
quest:setVar(player, 'Prog', 1) -- If declined then future Brutus quest start will use short dialog
end
end,
},
},
},
{
check = function(player, status, vars)
return status == xi.questStatus.QUEST_ACCEPTED
end,

[xi.zone.UPPER_JEUNO] =
{
['Brutus'] =
{
onTrigger = function(player, npc)
if not player:hasKeyItem(xi.ki.GUIDING_BELL) then
return quest:event(136)
else
return quest:progressEvent(138)
end
end,
},

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

{
check = function(player, status, vars)
return status == xi.questStatus.QUEST_COMPLETED and
not player:hasCompletedQuest(xi.questLog.JEUNO, xi.quest.id.jeuno.SCATTERED_INTO_SHADOW)
end,

[xi.zone.UPPER_JEUNO] =
{
['Brutus'] = quest:event(134):importantOnce(),
},
},
}

return quest
35 changes: 2 additions & 33 deletions scripts/zones/Upper_Jeuno/npcs/Brutus.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,36 +11,15 @@ entity.onTrade = function(player, npc, trade)
end

entity.onTrigger = function(player, npc)
local pathOfTheBeastmaster = player:getQuestStatus(xi.questLog.JEUNO, xi.quest.id.jeuno.PATH_OF_THE_BEASTMASTER)
local wingsOfGold = player:getQuestStatus(xi.questLog.JEUNO, xi.quest.id.jeuno.WINGS_OF_GOLD)
local scatteredIntoShadow = player:getQuestStatus(xi.questLog.JEUNO, xi.quest.id.jeuno.SCATTERED_INTO_SHADOW)
local scatteredIntoShadowStat = player:getCharVar('scatIntoShadowCS')

local mLvl = player:getMainLvl()
local mJob = player:getMainJob()

-- WINGS OF GOLD
if
pathOfTheBeastmaster == xi.questStatus.QUEST_COMPLETED and
wingsOfGold == xi.questStatus.QUEST_AVAILABLE and
mJob == xi.job.BST and
mLvl >= xi.settings.main.AF1_QUEST_LEVEL
then
if player:getCharVar('wingsOfGold_shortCS') == 1 then
player:startEvent(137) -- Start Quest 'Wings of gold' (Short dialog)
else
player:setCharVar('wingsOfGold_shortCS', 1)
player:startEvent(139) -- Start Quest 'Wings of gold' (Long dialog)
end
elseif wingsOfGold == xi.questStatus.QUEST_ACCEPTED then
if not player:hasKeyItem(xi.ki.GUIDING_BELL) then
player:startEvent(136)
else
player:startEvent(138) -- Finish Quest 'Wings of gold'
end

-- SCATTERED INTO SHADOW
elseif
if
wingsOfGold == xi.questStatus.QUEST_COMPLETED and
scatteredIntoShadow == xi.questStatus.QUEST_AVAILABLE and
mJob == xi.job.BST and
Expand Down Expand Up @@ -78,18 +57,8 @@ entity.onTrigger = function(player, npc)
end

entity.onEventFinish = function(player, csid, option, npc)
-- WINGS OF GOLD
if (csid == 137 or csid == 139) and option == 1 then
player:addQuest(xi.questLog.JEUNO, xi.quest.id.jeuno.WINGS_OF_GOLD)
player:setCharVar('wingsOfGold_shortCS', 0)
elseif
csid == 138 and
npcUtil.completeQuest(player, xi.questLog.JEUNO, xi.quest.id.jeuno.WINGS_OF_GOLD, { item = 16680, fame = 20 })
then
player:delKeyItem(xi.ki.GUIDING_BELL)

-- SCATTERED INTO SHADOW
elseif (csid == 141 or csid == 143) and option == 1 then
if (csid == 141 or csid == 143) and option == 1 then
player:addQuest(xi.questLog.JEUNO, xi.quest.id.jeuno.SCATTERED_INTO_SHADOW)
player:setCharVar('scatIntoShadow_shortCS', 0)
npcUtil.giveKeyItem(player, { xi.ki.AQUAFLORA1, xi.ki.AQUAFLORA2, xi.ki.AQUAFLORA3 })
Expand Down

0 comments on commit c7b0b87

Please sign in to comment.