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

[AMK, Lua, SQL] Mission 9, stone hunt in quicksands caves complete #4850

Merged
Merged
Show file tree
Hide file tree
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
155 changes: 131 additions & 24 deletions scripts/missions/amk/09_Rescue_A_Moogles_Labor_of_Love.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,22 @@
-- Rescue! A Moogle's Labor of Love
-- A Moogle Kupo d'Etat M9
-- !addmission 10 8
-- Geologist cutscene args : csid, progress, has QC map: 1 or 0, markerset: 1-10
-- Goblin Geologist : !pos -737 -6 -550 208
-- STONE_OF_SURYA : !addkeyitem 1145
-- STONE_OF_CHANDRA : !addkeyitem 1146
-- STONE_OF_MANGALA : !addkeyitem 1147
-- STONE_OF_BUDHA : !addkeyitem 1148
-- STONE_OF_BRIHASPATI : !addkeyitem 1149
-- STONE_OF_SHUKRA : !addkeyitem 1150
-- STONE_OF_SHANI : !addkeyitem 1151
-- STONE_OF_RAHU : !addkeyitem 1152
-- STONE_OF_KETU : !addkeyitem 1153
-- NAVARATNA_TALISMAN : !addkeyitem 1158
-----------------------------------
require('scripts/globals/missions')
require('scripts/globals/interaction/mission')
local ID = zones[xi.zone.QUICKSAND_CAVES]
-----------------------------------

local mission = Mission:new(xi.mission.log_id.AMK, xi.mission.id.amk.RESCUE_A_MOOGLES_LABOR_OF_LOVE)
Expand All @@ -14,83 +27,177 @@ mission.reward =
nextMission = { xi.mission.log_id.AMK, xi.mission.id.amk.ROAR_A_CAT_BURGLAR_BARES_HER_FANGS },
}

local markerSets =
zach2good marked this conversation as resolved.
Show resolved Hide resolved
{
{ 1, 2, 5, 7, 8, 11, 14, 19, 20 },
{ 3, 4, 6, 9, 11, 13, 16, 17, 18 },
{ 2, 6, 7, 8, 10, 12, 15, 19, 20 },
{ 1, 3, 4, 5, 8, 9, 10, 17, 18 },
{ 2, 4, 7, 11, 12, 13, 15, 16, 20 },
{ 1, 3, 5, 6, 8, 9, 14, 18, 19 },
{ 2, 5, 7, 10, 11, 12, 15, 16, 17 },
{ 1, 3, 4, 6, 8, 13, 14, 17, 20 },
{ 2, 4, 7, 9, 10, 11, 16, 18, 19 },
{ 3, 5, 6, 12, 13, 14, 15, 18, 20 },
}

local getMarkerSet = function(player)
-- markerSet is the setIndex of a random table within markerSets defined above
local markerSet = player:getCharVar('Mission[10][8]markerSet')
if markerSet == 0 then
markerSet = math.random(1, #markerSets)
player:setCharVar('Mission[10][8]markerSet', markerSet)
end

return markerSet
end

local hasAllStones = function(player)
for offset = 0, 8 do
if not player:hasKeyItem(xi.ki.STONE_OF_SURYA + offset) then
return false
end
end

return true
end

mission.sections =
{
-- 0: Shady Sconce
-- 0: Initiate quest, get markers
{
check = function(player, currentMission, missionStatus, vars)
return currentMission == mission.missionId and missionStatus == 0
return currentMission == mission.missionId and
player:getCharVar('Mission[10][8]progress') == 0
end,

[xi.zone.SEA_SERPENT_GROTTO] =
[xi.zone.QUICKSAND_CAVES] =
{
['Shady_Sconce'] =
['Goblin_Geologist'] =
{
onTrigger = function(player, npc)
return mission:progressEvent(19, 176)
local hasMap = player:hasKeyItem(xi.ki.MAP_OF_THE_QUICKSAND_CAVES) and 1 or 0
return mission:progressEvent(100, 0, hasMap, getMarkerSet(player))
end,
},

onEventFinish =
{
[19] = function(player, csid, option, npc)
if option == 1 then
player:setMissionStatus(xi.mission.log_id.AMK, 1)
end
[100] = function(player, csid, option, npc)
player:setCharVar('Mission[10][8]progress', 1)
end,
},
},
},

-- 1: Waterfall Basin
-- 1: Have Markers, don't have all stones
{
check = function(player, currentMission, missionStatus, vars)
return currentMission == mission.missionId and missionStatus == 1
return currentMission >= mission.missionId and
player:getCharVar('Mission[10][8]progress') == 1 and
not hasAllStones(player) and
not player:hasKeyItem(xi.ki.NAVARATNA_TALISMAN)
end,

[xi.zone.SEA_SERPENT_GROTTO] =
[xi.zone.QUICKSAND_CAVES] =
{
['Shady_Sconce'] =
['Goblin_Geologist'] =
{
onTrigger = function(player, npc)
return mission:event(22)
local hasMap = player:hasKeyItem(xi.ki.MAP_OF_THE_QUICKSAND_CAVES) and 1 or 0
return mission:progressEvent(100, 2, hasMap, getMarkerSet(player))
end,
},

['Waterfall_Basin'] =
['qm_amk'] =
{
onTrigger = function(player, npc)
return mission:progressEvent(20)
-- Get set of markers assigned by geologist
local amkMarkerSet = player:getCharVar('Mission[10][8]markerSet')
if amkMarkerSet == 0 then
return mission:messageSpecial(ID.text.NOTHING_OUT_OF_ORDINARY)
end

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

-- Give KI if QM is correct
if keyItem ~= 0 and not player:hasKeyItem(keyItem) then
player:addKeyItem(keyItem)
return mission:messageSpecial(ID.text.KEYITEM_OBTAINED, keyItem)
end
end,
},
},
},

-- 2: Have all stones, award talisman
{
check = function(player, currentMission, missionStatus, vars)
return currentMission >= mission.missionId and
hasAllStones(player) and
not player:hasKeyItem(xi.ki.NAVARATNA_TALISMAN)
end,

[xi.zone.QUICKSAND_CAVES] =
{
['Goblin_Geologist'] =
{
onTrigger = function(player, npc)
local hasMap = player:hasKeyItem(xi.ki.MAP_OF_THE_QUICKSAND_CAVES) and 1 or 0
return mission:progressEvent(100, 1, hasMap, 0)
end,
},

onEventFinish =
{
[20] = function(player, csid, option, npc)
player:setMissionStatus(xi.mission.log_id.AMK, 2)
[100] = function(player, csid, option, npc)
for i = 0, 8 do
player:delKeyItem(xi.ki.STONE_OF_SURYA + i)
end

player:setCharVar('Mission[10][8]markerSet', 0)
npcUtil.giveKeyItem(player, xi.ki.NAVARATNA_TALISMAN)
end,
},
},
},

-- 2: Inconspicuous Door
-- 3: Have talisman, CS at shimmering cicle
{
check = function(player, currentMission, missionStatus, vars)
return currentMission == mission.missionId and missionStatus == 2
return currentMission == mission.missionId and
player:hasKeyItem(xi.ki.NAVARATNA_TALISMAN)
end,

[xi.zone.UPPER_JEUNO] =
[xi.zone.QUICKSAND_CAVES] =
{
['Inconspicuous_Door'] =
['Goblin_Geologist'] =
{
onTrigger = function(player, npc)
return mission:progressEvent(10184)
player:messageSpecial(ID.text.GRANT_YOU_EASY_ENTRANCE, xi.ki.NAVARATNA_TALISMAN)
end,
},
},

[xi.zone.CHAMBER_OF_ORACLES] =
{
['Shimmering_Circle'] =
{
onTrigger = function(player, npc)
return mission:progressEvent(5)
end
},

onEventFinish =
{
[10184] = function(player, csid, option, npc)
[5] = function(player, csid, option, npc)
mission:complete(player)
end,
},
Expand Down
2 changes: 0 additions & 2 deletions scripts/zones/Qufim_Island/IDs.lua
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ zones[xi.zone.QUFIM_ISLAND] =
COMMON_SENSE_SURVIVAL = 12665, -- It appears that you have arrived at a new survival guide provided by the Adventurers' Mutual Aid Network. Common sense dictates that you should now be able to teleport here from similar tomes throughout the world.
HOMEPOINT_SET = 12707, -- Home point set!
},

mob =
{
SLIPPERY_SUCKER_PH =
Expand All @@ -65,7 +64,6 @@ zones[xi.zone.QUFIM_ISLAND] =
},
OPHIOTAURUS = 17293666
},

npc =
{
OVERSEER_BASE = GetFirstID('Pitoire_RK'),
Expand Down
1 change: 1 addition & 0 deletions scripts/zones/Quicksand_Caves/DefaultActions.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
local ID = zones[xi.zone.QUICKSAND_CAVES]

return {
['qm_amk'] = { messageSpecial = ID.text.NOTHING_OUT_OF_ORDINARY },
['qm3'] = { messageSpecial = ID.text.NOTHING_OUT_OF_ORDINARY },
['qm4'] = { messageSpecial = ID.text.YOU_FIND_NOTHING_OUT },
['qm6'] = { messageSpecial = ID.text.ANCIENT_LETTERS_UNREAD },
Expand Down
2 changes: 2 additions & 0 deletions scripts/zones/Quicksand_Caves/IDs.lua
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ zones[xi.zone.QUICKSAND_CAVES] =
SOMETHING_ATTACKING_YOU = 7374, -- Something is attacking from behind you!
SOMETHING_IS_BURIED = 7375, -- Something is buried in this fallen pillar.
SENSE_OMINOUS_PRESENCE = 7379, -- You sense an ominous presence...
GRANT_YOU_EASY_ENTRANCE = 7411, -- This <keyitem> should grant you easy entrance to your destination. I haven't a clue what you plan to do there, but...good luck! I'd accompany you, but I'm kind of...stuck here, you see. Oh ho...
PLAYER_OBTAINS_ITEM = 8287, -- <name> obtains <item>!
UNABLE_TO_OBTAIN_ITEM = 8288, -- You were unable to obtain the item.
PLAYER_OBTAINS_TEMP_ITEM = 8289, -- <name> obtains the temporary item: <item>!
Expand Down Expand Up @@ -117,6 +118,7 @@ zones[xi.zone.QUICKSAND_CAVES] =
CHAINS_THAT_BIND_US_QM = 17629746,
TREASURE_COFFER = 17629747,
ANTICAN_TAG_QM = 17629769,
QM_AMK = GetTableOfIDs('qm_amk')
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

},
}

Expand Down
1 change: 0 additions & 1 deletion scripts/zones/Quicksand_Caves/npcs/Goblin_Geologist.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ entity.onTrade = function(player, npc, trade)
end

entity.onTrigger = function(player, npc)
player:startEvent(100)
end

entity.onEventUpdate = function(player, csid, option, npc)
Expand Down
13 changes: 13 additions & 0 deletions scripts/zones/Quicksand_Caves/npcs/qm_amk.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
-----------------------------------
-- Area: Quicksand Caves
-- NPC: qm_amk (???)
-- Mission: AMK9 - Rescue! A Moogle's Labor of Love
-- This script is shared across 20 qm npcs to handle logic for AMK mission 9
-----------------------------------

local entity = {}

entity.onTrigger = function(player, npc)
end

return entity
Loading