Skip to content

Commit

Permalink
Fix issues identified in mission scripts from annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
claywar committed Sep 7, 2024
1 parent 61f9a40 commit 6ff1fcd
Show file tree
Hide file tree
Showing 117 changed files with 986 additions and 1,432 deletions.
20 changes: 11 additions & 9 deletions scripts/missions/amk/01_A_Moogle_Kupo_dEtat.lua
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,18 @@ mission.reward =
-- Since there are so many zones with interactions:
-- Populate each by hand
mission.sections = {}
mission.sections[1] = {} -- REMEMBER: Lua is 1-indexed!

mission.sections[1].check = function(player, currentMission, missionStatus, vars)
return currentMission == mission.missionId and
xi.settings.main.ENABLE_AMK == 1 and
xi.moghouse.isInMogHouseInHomeNation(player) and
player:getMainLvl() >= 10 and
player:getCharVar('HQuest[moghouseExpo]notSeen') == 0
end
mission.sections[1] = -- REMEMBER: Lua is 1-indexed!
{
check = function(player, currentMission, missionStatus, vars)
return currentMission == mission.missionId and
xi.settings.main.ENABLE_AMK == 1 and
xi.moghouse.isInMogHouseInHomeNation(player) and
player:getMainLvl() >= 10 and
player:getCharVar('HQuest[moghouseExpo]notSeen') == 0
end,
}

---@type ZoneSection
local moogleTriggerEvent =
{
-- TODO: Does there need to be onZoneIn here?
Expand Down
14 changes: 8 additions & 6 deletions scripts/missions/amk/02_Drenched_It_Began_with_a_Raindrop.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,15 @@ mission.reward =
-- Since there are so many zones with interactions:
-- Populate each by hand
mission.sections = {}
mission.sections[1] = {} -- REMEMBER: Lua is 1-indexed!

mission.sections[1].check = function(player, currentMission, missionStatus, vars)
return currentMission == mission.missionId and
xi.moghouse.isInMogHouseInHomeNation(player)
end
mission.sections[1] = -- REMEMBER: Lua is 1-indexed!
{
check = function(player, currentMission, missionStatus, vars)
return currentMission == mission.missionId and
xi.moghouse.isInMogHouseInHomeNation(player)
end,
}

---@type ZoneSection
local moogleTriggerEvent =
{
['Moogle'] =
Expand Down
5 changes: 3 additions & 2 deletions scripts/missions/amk/09_Rescue_A_Moogles_Labor_of_Love.lua
Original file line number Diff line number Diff line change
Expand Up @@ -122,15 +122,16 @@ mission.sections =
end

-- Determine if QM triggered is in markerset
local keyItem = 0
---@type xi.keyItem
local keyItem
for idx, markerIdIndex in ipairs(markerSets[amkMarkerSet]) do
if npc:getID() == ID.npc.QM_AMK[markerIdIndex] then
keyItem = xi.ki.STONE_OF_SURYA + idx - 1
end
end

-- Give KI if QM is correct
if keyItem ~= 0 and not player:hasKeyItem(keyItem) then
if keyItem and not player:hasKeyItem(keyItem) then
player:addKeyItem(keyItem)
return mission:messageSpecial(ID.text.KEYITEM_OBTAINED, keyItem)
end
Expand Down
3 changes: 2 additions & 1 deletion scripts/missions/asa/01_A_Shantotto_Ascension.lua
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ mission.sections =
onEventFinish =
{
[510] = function(player, csid, option, npc)
return mission:event(514)
-- TODO: This is most likely a pos change, followed by onZoneIn event
player:startEvent(514)
end,

[514] = function(player, csid, option, npc)
Expand Down
3 changes: 2 additions & 1 deletion scripts/missions/bastok/5_2_Xarcabard_Land_of_Truths.lua
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,8 @@ mission.sections =
player:addMission(xi.mission.log_id.ZILART, xi.mission.id.zilart.THE_NEW_FRONTIER)
end

return mission:progressEvent(7)
-- TODO: This is most likely a pos change followed by onZoneIn event
player:startEvent(7)
end
end,

Expand Down
16 changes: 10 additions & 6 deletions scripts/missions/cop/1_1_The_Rites_of_Life.lua
Original file line number Diff line number Diff line change
Expand Up @@ -36,20 +36,24 @@ mission.sections =

onEventFinish =
{
-- TODO: These are most likely a series of pos changes that trigger
-- onZoneIn events. In addition, set status vars after each one
-- so that on disconnect, it will resume at the latest state. This
-- pattern should also change in section 3
[22] = function(player, csid, option, npc)
return mission:event(36)
player:startEvent(36)
end,

[36] = function(player, csid, option, npc)
return mission:event(37)
player:startEvent(37)
end,

[37] = function(player, csid, option, npc)
return mission:event(38)
player:startEvent(38)
end,

[38] = function(player, csid, option, npc)
return mission:event(39)
player:startEvent(39)
end,

[39] = function(player, csid, option, npc)
Expand Down Expand Up @@ -94,11 +98,11 @@ mission.sections =
onEventFinish =
{
[10] = function(player, csid, option, npc)
return mission:event(206)
player:startEvent(206)
end,

[206] = function(player, csid, option, npc)
return mission:event(207)
player:startEvent(207)
end,

[207] = function(player, csid, option, npc)
Expand Down
13 changes: 5 additions & 8 deletions scripts/missions/cop/2_1_An_Invitation_West.lua
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,11 @@ mission.sections =

[xi.zone.LUFAISE_MEADOWS] =
{
onZoneIn =
{
function(player, prevZone)
if mission:getVar(player, 'Status') == 0 then
return 110
end
end,
},
onZoneIn = function(player, prevZone)
if mission:getVar(player, 'Status') == 0 then
return 110
end
end,

onEventFinish =
{
Expand Down
15 changes: 6 additions & 9 deletions scripts/missions/cop/3_3_The_Road_Forks.lua
Original file line number Diff line number Diff line change
Expand Up @@ -419,15 +419,12 @@ mission.sections =
end,
},

onZoneOut =
{
function(player)
if player:hasKeyItem(xi.ki.MIMEO_JEWEL) then
player:messageSpecial(attohwaChasmID.text.MIMEO_JEWEL_OFFSET + 4)
player:delKeyItem(xi.ki.MIMEO_JEWEL)
end
end,
},
onZoneOut = function(player)
if player:hasKeyItem(xi.ki.MIMEO_JEWEL) then
player:messageSpecial(attohwaChasmID.text.MIMEO_JEWEL_OFFSET + 4)
player:delKeyItem(xi.ki.MIMEO_JEWEL)
end
end,

onEventFinish =
{
Expand Down
13 changes: 5 additions & 8 deletions scripts/missions/cop/8_3_When_Angels_Fall.lua
Original file line number Diff line number Diff line change
Expand Up @@ -171,14 +171,11 @@ mission.sections =

[xi.zone.ALTAIEU] =
{
onZoneIn =
{
function(player, prevZone)
if mission:getVar(player, 'Status') == 6 then
return 165
end
end,
},
onZoneIn = function(player, prevZone)
if mission:getVar(player, 'Status') == 6 then
return 165
end
end,

onEventFinish =
{
Expand Down
50 changes: 19 additions & 31 deletions scripts/missions/cop/8_4_Dawn.lua
Original file line number Diff line number Diff line change
Expand Up @@ -82,18 +82,15 @@ mission.sections =

[xi.zone.EMPYREAL_PARADOX] =
{
onZoneIn =
{
function(player, prevZone)
local missionStatus = mission:getVar(player, 'Status')
onZoneIn = function(player, prevZone)
local missionStatus = mission:getVar(player, 'Status')

if missionStatus == 2 then
return 6
elseif missionStatus == 3 then
return 3
end
end,
},
if missionStatus == 2 then
return 6
elseif missionStatus == 3 then
return 3
end
end,

['TR_Entrance'] =
{
Expand Down Expand Up @@ -268,14 +265,11 @@ mission.sections =

[xi.zone.ULEGUERAND_RANGE] =
{
onZoneIn =
{
function(player, prevZone)
if mission:getVar(player, 'LProg') == 1 then
return 17
end
end,
},
onZoneIn = function(player, prevZone)
if mission:getVar(player, 'LProg') == 1 then
return 17
end
end,

onEventFinish =
{
Expand Down Expand Up @@ -358,12 +352,9 @@ mission.sections =

[xi.zone.MHAURA] =
{
onZoneIn =
{
function(player, prevZone)
return 322
end,
},
onZoneIn = function(player, prevZone)
return 322
end,

onEventFinish =
{
Expand All @@ -385,12 +376,9 @@ mission.sections =

[xi.zone.OLDTON_MOVALPOLOS] =
{
onZoneIn =
{
function(player, prevZone)
return 57
end,
},
onZoneIn = function(player, prevZone)
return 57
end,

onEventFinish =
{
Expand Down
9 changes: 3 additions & 6 deletions scripts/missions/rotz/01_The_New_Frontier.lua
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,9 @@ mission.sections =

[xi.zone.NORG] =
{
onZoneIn =
{
function(player, prevZone)
return 1
end,
},
onZoneIn = function(player, prevZone)
return 1
end,

onEventFinish =
{
Expand Down
21 changes: 9 additions & 12 deletions scripts/missions/rotz/04_The_Temple_of_Uggalepih.lua
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,15 @@ mission.sections =

[xi.zone.SACRIFICIAL_CHAMBER] =
{
onZoneIn =
{
function(player, prevZone)
local missionStatus = player:getMissionStatus(mission.areaId)

if missionStatus == 1 then
return 7
elseif missionStatus == 2 then
return 8
end
end,
},
onZoneIn = function(player, prevZone)
local missionStatus = player:getMissionStatus(mission.areaId)

if missionStatus == 1 then
return 7
elseif missionStatus == 2 then
return 8
end
end,

onEventUpdate =
{
Expand Down
31 changes: 11 additions & 20 deletions scripts/missions/rotz/08_Return_to_Delkfutts_Tower.lua
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,9 @@ mission.sections =

[xi.zone.LOWER_DELKFUTTS_TOWER] =
{
onZoneIn =
{
function(player, prevZone)
return 15
end,
},
onZoneIn = function(player, prevZone)
return 15
end,

onEventFinish =
{
Expand All @@ -85,12 +82,9 @@ mission.sections =

[xi.zone.STELLAR_FULCRUM] =
{
onZoneIn =
{
function(player, prevZone)
return 0
end,
},
onZoneIn = function(player, prevZone)
return 0
end,

onEventUpdate =
{
Expand Down Expand Up @@ -118,14 +112,11 @@ mission.sections =

[xi.zone.STELLAR_FULCRUM] =
{
onZoneIn =
{
function(player, prevZone)
if player:getMissionStatus(mission.areaId) == 3 then
return 17
end
end,
},
onZoneIn = function(player, prevZone)
if player:getMissionStatus(mission.areaId) == 3 then
return 17
end
end,

onEventFinish =
{
Expand Down
9 changes: 3 additions & 6 deletions scripts/missions/rotz/13_The_Gate_of_the_Gods.lua
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,9 @@ mission.sections =

[xi.zone.RUAUN_GARDENS] =
{
onZoneIn =
{
function(player, prevZone)
return 51
end,
},
onZoneIn = function(player, prevZone)
return 51
end,

onEventFinish =
{
Expand Down
Loading

0 comments on commit 6ff1fcd

Please sign in to comment.