diff --git a/Data/Script/origin/common.lua b/Data/Script/origin/common.lua index 239cc77ed4..34c8bdcc53 100644 --- a/Data/Script/origin/common.lua +++ b/Data/Script/origin/common.lua @@ -1402,7 +1402,7 @@ function COMMON.EndDayCycle() type_count = 6 else type_count = 7 - end +end for ii = 1, type_count, 1 do local idx = math.random(1, #catalog) @@ -1414,3 +1414,98 @@ function COMMON.EndDayCycle() COMMON.UpdateDayEndVars() end + +function COMMON.JuncPatchSupport(obj, activator, other_new_dungeons, other_new_grounds, base_dungeon_entrances, base_ground_entrances, force_list, speaker, confirm_msg) + DEBUG.EnableDbgCoro() --Enable debugging this coroutine + + local DoMerge = function (tableAddedTo, tableTakenFrom) + if tableAddedTo and tableTakenFrom then + for i=1,#tableTakenFrom do + tableAddedTo[#tableAddedTo+1] = tableTakenFrom[i] + end + end + end + + local DeepClone = function (target) + local clone = {} + if target then + for i=1,#target do + clone[#clone+1] = target[i] + end + end + return clone + end + -- do a deep clone to avoid shennaigans + -- improvement: cacheing of some sort, probs + local dungeon_entrances = DeepClone(base_dungeon_entrances) + -- merge these together + DoMerge(dungeon_entrances, other_new_dungeons) + -- todo: sort dungeon entrances by how their names are coloured + -- table.sort(dungeon_entrance,somefuncforcolorsorting) + + -- same for ground + local ground_entrances = DeepClone(base_ground_entrances) + DoMerge(ground_entrances, other_new_grounds) + + -- go show the destination menu itself + COMMON.ShowDestinationMenu(dungeon_entrances,ground_entrances,force_list,speaker,confirm_msg) +end + +-- Does the process of patching the junction function. +-- This should "replace" the base script when doing CURMAPSCR patching. +-- It is pretty much an extender to a ground map action. +-- Fields: +-- * obj: The object being activated. Pass the obj from the replacer of the ground map action. Should be part of replacer function's arguments. +-- * activator: The thing that activated the object. Pass the activator from the replacer of the ground map action. +-- * other_new_dungeons: Potential new dungeon entrances that may have been passed through other mods. +-- * other_new_grounds: Potential new ground entrances thay may have been passed through other mods. Should be part of replacer function's arguments. +-- * dungeons_to_add: A table of the new zones (aka dungeons) in their ID form that are to be added to the navigation menu. Leave "nil" if no such dungeons. +-- * grounds_to_add: A table of the new grounds that are to be added to the navigation menu. More complicated than working with dungeons. Leave "nil" if no such grounds. +-- * base_script_func: The base map function from the map being patched, obtained by using CURMAPSCR. +-- Returns: N/A +function COMMON.DoJuncPatch(obj, activator, other_new_dungeons, other_new_grounds, dungeons_to_add, grounds_to_add, base_script_func) + -- Make sure base_script_func actually exists before doing anything + if base_script_func then + local copy = function (target) + local clone = {} + if target then + for i=1,#target do + clone[#clone+1] = target[i] + end + end + return clone + end + + local merge = function (tableAddedTo, tableTakenFrom) + if tableAddedTo and tableTakenFrom then + for i=1,#tableTakenFrom do + tableAddedTo[#tableAddedTo+1] = tableTakenFrom[i] + end + end + end + + -- If new dun ents, then merge + -- If not, just copy dungeons_to_add + local dunEnts = {} + if other_new_dungeons then + dunEnts = copy(other_new_dungeons) + merge(dunEnts,dungeons_to_add) + else + dunEnts = copy(dungeons_to_add) + end + + -- If new ground ents, then merge + -- If not, just copy grounds_to_add + local groEnts = {} + if other_new_grounds then + groEnts = copy(other_new_grounds) + merge(groEnts,grounds_to_add) + else + groEnts = copy(grounds_to_add) + end + + base_script_func(obj, activator, dunEnts, groEnts) + else -- Tell the user about it! + print('Exception: DoJuncPatch was called, but no BaseFun was passed!\r\n\t Please edit the script to pass it using CURMAPSCR ') + end +end \ No newline at end of file diff --git a/Data/Script/origin/ground/base_camp/init.lua b/Data/Script/origin/ground/base_camp/init.lua index 8fbc0bc5ba..ba3a36503f 100644 --- a/Data/Script/origin/ground/base_camp/init.lua +++ b/Data/Script/origin/ground/base_camp/init.lua @@ -1,6 +1,21 @@ require 'origin.common' local base_camp = {} +-------------------------------------------------- +-- Variables +-------------------------------------------------- +local CAMP_DUN_ENTRANCES = { 'tropical_path', 'faultline_ridge', 'guildmaster_trail' } +local CAMP_GRO_ENTRANCES = { + {Flag=SV.forest_camp.ExpositionComplete,Zone='guildmaster_island',ID=3,Entry=0}, + {Flag=SV.cliff_camp.ExpositionComplete,Zone='guildmaster_island',ID=4,Entry=0}, + {Flag=SV.canyon_camp.ExpositionComplete,Zone='guildmaster_island',ID=5,Entry=0}, + {Flag=SV.rest_stop.ExpositionComplete,Zone='guildmaster_island',ID=6,Entry=0}, + {Flag=SV.final_stop.ExpositionComplete,Zone='guildmaster_island',ID=7,Entry=0}, + {Flag=SV.guildmaster_summit.GameComplete,Zone='guildmaster_island',ID=8,Entry=0} +} + +local FERRY_DUN_ENTRANCES = { 'lava_floe_island', 'castaway_cave', 'eon_island', 'uncharted_waters', 'inscribed_cave', 'prism_isles' } +local FERRY_GRO_ENTRANCES = {} -------------------------------------------------- -- Map Callbacks @@ -44,15 +59,15 @@ function base_camp.Enter(map) base_camp.RewardDialogue() SV.guildmaster_trail.Rewarded = true SV.base_camp.ExpositionComplete = true - elseif not SV.base_camp.ExpositionComplete then + elseif not SV.base_camp.ExpositionComplete then base_camp.SetupNpcs() base_camp.BeginExposition() SV.base_camp.ExpositionComplete = true else base_camp.SetupNpcs() - + base_camp.CheckMissions() - + GAME:FadeIn(20) end @@ -86,21 +101,21 @@ function base_camp.SetupNpcs() --Noctowl: 64, 252 --Luxio: 104, 252 if not SV.family.Sister and SV.family.SisterActiveDays >= 3 then - local noctowl = CH('Noctowl') - local entrance = CH('NPC_Entrance') - GROUND:TeleportTo(noctowl, 64, 252, Direction.Right) - GROUND:TeleportTo(entrance, 104, 252, Direction.Left) + local noctowl = CH('Noctowl') + local entrance = CH('NPC_Entrance') + GROUND:TeleportTo(noctowl, 64, 252, Direction.Right) + GROUND:TeleportTo(entrance, 104, 252, Direction.Left) end --Wingull: 344, 264 if not SV.family.Mother and SV.family.MotherActiveDays >= 3 then - local coast = CH('NPC_Coast') - GROUND:TeleportTo(coast, 232, 456, Direction.Down) + local coast = CH('NPC_Coast') + GROUND:TeleportTo(coast, 232, 456, Direction.Down) end if SV.team_catch.Status == 1 then GROUND:Unhide("NPC_Catch_1") - GROUND:Unhide("NPC_Catch_2") + GROUND:Unhide("NPC_Catch_2") elseif SV.team_catch.Status == 4 then -- TODO cycling end @@ -113,11 +128,11 @@ function base_camp.SetupNpcs() if SV.team_steel.DaysSinceArgue >= 2 and not SV.team_steel.Rescued then GROUND:Unhide("NPC_Steel_1") - local questname = "QuestSteel" + local questname = "QuestSteel" local quest = SV.missions.Missions[questname] - if quest ~= nil and quest.Complete == COMMON.MISSION_COMPLETE then - GROUND:Unhide("NPC_Steel_2") - end + if quest ~= nil and quest.Complete == COMMON.MISSION_COMPLETE then + GROUND:Unhide("NPC_Steel_2") + end end if SV.guildmaster_summit.GameComplete then @@ -126,10 +141,10 @@ function base_camp.SetupNpcs() end if not SV.family.Sister and SV.family.SisterActiveDays >= 3 then - local noctowl = CH('Noctowl') - local entrance = CH('NPC_Entrance') - GROUND:CharTurnToChar(noctowl,entrance) - GROUND:CharTurnToChar(entrance,noctowl) + local noctowl = CH('Noctowl') + local entrance = CH('NPC_Entrance') + GROUND:CharTurnToChar(noctowl,entrance) + GROUND:CharTurnToChar(entrance,noctowl) end end @@ -140,8 +155,8 @@ function base_camp.CheckMissions() local quest = SV.missions.Missions["EscortMother"] if quest ~= nil then if quest.Complete == COMMON.MISSION_COMPLETE then - - --spawn her + + --spawn her GAME:FadeIn(20) UI:WaitShowDialogue("Escort mission state: Complete.") @@ -150,78 +165,78 @@ function base_camp.CheckMissions() UI:WaitShowDialogue("The mother drops something as she runs off.") SV.magnagate.Cards = SV.magnagate.Cards + 1 - SV.family.Mother = true + SV.family.Mother = true COMMON.GiftKeyItem(player, RogueEssence.StringKey("ITEM_KEY_CARD_WATER"):ToLocal()) - COMMON.CompleteMission("EscortMother") - + COMMON.CompleteMission("EscortMother") + end end end function base_camp.BeginExposition() - -- move founder to team if not in party - -- get party - local party_table = GAME:GetPlayerPartyTable() - -- check for presence - local in_party = false - for ii = 1, #party_table, 1 do - local ent = party_table[ii] - if ent.IsFounder then - in_party = true - break - end - end - - -- if no, search assembly and then add to party - if not in_party then - local assemblyCount = GAME:GetPlayerAssemblyCount() + -- move founder to team if not in party + -- get party + local party_table = GAME:GetPlayerPartyTable() + -- check for presence + local in_party = false + for ii = 1, #party_table, 1 do + local ent = party_table[ii] + if ent.IsFounder then + in_party = true + break + end + end + + -- if no, search assembly and then add to party + if not in_party then + local assemblyCount = GAME:GetPlayerAssemblyCount() for i = assemblyCount,1,-1 do p = GAME:GetPlayerAssemblyMember(i-1) - if p.IsFounder then - GAME:RemovePlayerAssembly(i-1) - GAME:AddPlayerTeam(p) - end + if p.IsFounder then + GAME:RemovePlayerAssembly(i-1) + GAME:AddPlayerTeam(p) + end end - end - - -- move everyone else into assembly - local partyCount = GAME:GetPlayerPartyCount() + end + + -- move everyone else into assembly + local partyCount = GAME:GetPlayerPartyCount() for i = partyCount,1,-1 do p = GAME:GetPlayerPartyMember(i-1) - if not p.IsFounder then - GAME:RemovePlayerTeam(i-1) - GAME:AddPlayerAssembly(p) - end + if not p.IsFounder then + GAME:RemovePlayerTeam(i-1) + GAME:AddPlayerAssembly(p) end - - -- make leader - GAME:SetTeamLeaderIndex(0) - -- update team + end + + -- make leader + GAME:SetTeamLeaderIndex(0) + -- update team COMMON.RespawnAllies() - - + + local noctowl = CH('Noctowl') local player = CH('PLAYER') - - local floor_record = 0 - if SV.floor_records["guildmaster_trail-0"] ~= nil then - floor_record = SV.floor_records["guildmaster_trail-0"] - end - + local floor_record = 0 + if SV.floor_records["guildmaster_trail-0"] ~= nil then + floor_record = SV.floor_records["guildmaster_trail-0"] + end + + GAME:CutsceneMode(true) UI:SetSpeaker(STRINGS:Format("\\uE040"), true, "", -1, "", RogueEssence.Data.Gender.Unknown) - + local zone = _DATA.DataIndices[RogueEssence.Data.DataManager.DataType.Zone]:Get('guildmaster_trail') - if floor_record < 9 then + if floor_record < 9 then UI:WaitShowDialogue(STRINGS:Format(STRINGS.MapStrings['Expo_Cutscene_Line_001'], zone:GetColoredName())) - elseif floor_record < 19 then - UI:WaitShowDialogue(STRINGS:Format(STRINGS.MapStrings['Expo_Achieved_01_Line_001'], zone:GetColoredName())) - else - UI:WaitShowDialogue(STRINGS:Format(STRINGS.MapStrings['Expo_Achieved_02_Line_001'], zone:GetColoredName())) - end + elseif floor_record < 19 then + UI:WaitShowDialogue(STRINGS:Format(STRINGS.MapStrings['Expo_Achieved_01_Line_001'], zone:GetColoredName())) + else + UI:WaitShowDialogue(STRINGS:Format(STRINGS.MapStrings['Expo_Achieved_02_Line_001'], zone:GetColoredName())) + end --move the noctowl to a new position GROUND:TeleportTo(noctowl, 244, 286, Direction.Up) GAME:FadeIn(20) @@ -250,11 +265,11 @@ function base_camp.BeginExposition() local name = "" while not ch do name = "" - while name == "" do + while name == "" do UI:NameMenu(STRINGS:FormatKey("INPUT_TEAM_TITLE"), "") UI:WaitForChoice() name = UI:ChoiceResult() - end + end --UI:WaitShowDialogue("I see... {0}? [Exactly.] [Actually, it's...]") @@ -325,9 +340,9 @@ function base_camp.RewardDialogue() local noctowl = CH('Noctowl') GROUND:TeleportTo(noctowl, 244, 286, Direction.Up) - + GAME:FadeIn(20) - + UI:SetSpeaker(noctowl) UI:WaitShowDialogue("Your badge... that insignia!") @@ -364,16 +379,11 @@ end -- Objects Callbacks -------------------------------------------------- -function base_camp.North_Exit_Touch(obj, activator) +-- go take in any patched new dungeons and grouns and add them too! +function base_camp.North_Exit_Touch(obj, activator, newDunEnts, newGroEnts) DEBUG.EnableDbgCoro() --Enable debugging this coroutine - local dungeon_entrances = { 'tropical_path', 'faultline_ridge', 'guildmaster_trail' } - local ground_entrances = {{Flag=SV.forest_camp.ExpositionComplete,Zone='guildmaster_island',ID=3,Entry=0}, - {Flag=SV.cliff_camp.ExpositionComplete,Zone='guildmaster_island',ID=4,Entry=0}, - {Flag=SV.canyon_camp.ExpositionComplete,Zone='guildmaster_island',ID=5,Entry=0}, - {Flag=SV.rest_stop.ExpositionComplete,Zone='guildmaster_island',ID=6,Entry=0}, - {Flag=SV.final_stop.ExpositionComplete,Zone='guildmaster_island',ID=7,Entry=0}, - {Flag=SV.guildmaster_summit.GameComplete,Zone='guildmaster_island',ID=8,Entry=0}} - COMMON.ShowDestinationMenu(dungeon_entrances,ground_entrances) + + COMMON.JuncPatchSupport(obj, activator, newDunEnts, newGroEnts, CAMP_DUN_ENTRANCES, CAMP_GRO_ENTRANCES) end function base_camp.First_North_Exit_Touch(obj, activator) @@ -387,7 +397,7 @@ function base_camp.First_North_Exit_Touch(obj, activator) ch = UI:ChoiceResult() if ch then _DATA:PreLoadZone('guildmaster_trail') - SOUND:PlayBGM("", true) + SOUND:PlayBGM("", true) GAME:FadeOut(false, 20) GAME:EnterDungeon('guildmaster_trail', 0, 0, 0, RogueEssence.Data.GameProgress.DungeonStakes.Risk, true, true) end @@ -405,22 +415,19 @@ function base_camp.East_Exit_Touch(obj, activator) GAME:EnterGroundMap("base_camp_2", "entrance_west", true) end -function base_camp.Ferry_Action(obj, activator) +function base_camp.Ferry_Action(obj, activator, newDunEnts, newGroEnts) DEBUG.EnableDbgCoro() --Enable debugging this coroutine local ferry = CH('Lapras') UI:SetSpeaker(ferry) if not SV.base_camp.FerryIntroduced then UI:WaitShowDialogue(STRINGS:Format(STRINGS.MapStrings['Ferry_Line_001'])) - SV.base_camp.FerryIntroduced = true + SV.base_camp.FerryIntroduced = true end - local dungeon_entrances = { 'lava_floe_island', 'castaway_cave', 'eon_island', 'uncharted_waters', 'inscribed_cave', 'prism_isles' } - local ground_entrances = {} UI:WaitShowDialogue(STRINGS:Format(STRINGS.MapStrings['Ferry_Line_002'])) - COMMON.ShowDestinationMenu(dungeon_entrances,ground_entrances, true, - ferry, - STRINGS:Format(STRINGS.MapStrings['Ferry_Line_003'])) + COMMON.JuncPatchSupport(obj, activator, newDunEnts, newGroEnts, FERRY_DUN_ENTRANCES, FERRY_GRO_ENTRANCES, true, ferry, STRINGS:Format(STRINGS.MapStrings['Ferry_Line_003'])) + end base_camp.sign_count = 0 @@ -436,10 +443,10 @@ function base_camp.Sign_Action(obj, activator) UI:ChoiceMenuYesNo("UNLOCK THE HALF FINISHED STORY? NO TURNING OFF.", true) UI:WaitForChoice() ch = UI:ChoiceResult() - if ch then - SV.Experimental = true - UI:WaitShowDialogue("UNLOCKED") - end + if ch then + SV.Experimental = true + UI:WaitShowDialogue("UNLOCKED") + end end end @@ -524,7 +531,7 @@ function base_camp.Catch_Action() GROUND:CharTurnToChar(player, catch2) GAME:WaitFrames(RogueEssence.Content.ItemAnim.ITEM_ACTION_TIME) - + SOUND:PlayBattleSE("DUN_Equip") UI:SetSpeaker(catch2) UI:WaitShowDialogue(STRINGS:Format(STRINGS.MapStrings['Catch_Line_002'])) @@ -549,25 +556,25 @@ function base_camp.NPC_Steel_1_Action(chara, activator) local questname = "QuestSteel" local quest = SV.missions.Missions[questname] - + if quest == nil then UI:SetSpeaker(chara) GROUND:CharTurnToChar(chara,player) - UI:WaitShowDialogue(STRINGS:Format(STRINGS.MapStrings['Steel_Line_001'])) - - COMMON.CreateMission(questname, - { Complete = COMMON.MISSION_INCOMPLETE, Type = COMMON.SIDEQUEST_TYPE_RESCUE, + UI:WaitShowDialogue(STRINGS:Format(STRINGS.MapStrings['Steel_Line_001'])) + + COMMON.CreateMission(questname, + { Complete = COMMON.MISSION_INCOMPLETE, Type = COMMON.SIDEQUEST_TYPE_RESCUE, DestZone = "guildmaster_trail", DestSegment = 0, DestFloor = 14, FloorUnknown = false, TargetSpecies = RogueEssence.Dungeon.MonsterID("scizor", 0, "normal", Gender.Male), ClientSpecies = RogueEssence.Dungeon.MonsterID("steelix", 0, "normal", Gender.Male) } - ) - + ) + elseif quest.Complete == COMMON.MISSION_INCOMPLETE then UI:SetSpeaker(chara) GROUND:CharTurnToChar(chara,player) - UI:WaitShowDialogue(STRINGS:Format(STRINGS.MapStrings['Steel_Line_002'])) + UI:WaitShowDialogue(STRINGS:Format(STRINGS.MapStrings['Steel_Line_002'])) else base_camp.Steel_Complete() end @@ -645,7 +652,7 @@ function base_camp.NPC_Coast_Action(chara, activator) if not SV.family.Mother and SV.family.MotherActiveDays >= 3 then UI:WaitShowDialogue(STRINGS:Format(STRINGS.MapStrings['Hint_Mother_Line_001'])) - + else UI:WaitShowDialogue(STRINGS:Format(STRINGS.MapStrings['Outside_Line_001'])) @@ -732,4 +739,4 @@ function base_camp.MotherReminderActive() return false end -return base_camp +return base_camp \ No newline at end of file diff --git a/Data/Script/origin/ground/canyon_camp/init.lua b/Data/Script/origin/ground/canyon_camp/init.lua index ca8043936e..adfac9d36e 100644 --- a/Data/Script/origin/ground/canyon_camp/init.lua +++ b/Data/Script/origin/ground/canyon_camp/init.lua @@ -1,6 +1,23 @@ require 'origin.common' local canyon_camp = {} +-------------------------------------------------- +-- Variables +-------------------------------------------------- +local EAST_DUN_ENTRANCES = { 'copper_quarry', 'depleted_basin', 'forsaken_desert', +'relic_tower', 'sleeping_caldera', 'royal_halls', 'starfall_heights', 'wisdom_road', 'sacred_tower'} +local EAST_GRO_ENTRANCES = { + {Flag=SV.rest_stop.ExpositionComplete,Zone='guildmaster_island',ID=6,Entry=0}, + {Flag=SV.final_stop.ExpositionComplete,Zone='guildmaster_island',ID=7,Entry=0}, + {Flag=SV.guildmaster_summit.GameComplete,Zone='guildmaster_island',ID=8,Entry=0} +} + +local WEST_DUN_ENTRANCES = {} +local WEST_GRO_ENTRANCES = { + {Flag=true,Zone='guildmaster_island',ID=1,Entry=3}, + {Flag=SV.forest_camp.ExpositionComplete,Zone='guildmaster_island',ID=3,Entry=2}, + {Flag=SV.cliff_camp.ExpositionComplete,Zone='guildmaster_island',ID=4,Entry=2} +} -------------------------------------------------- -- Map Callbacks @@ -292,7 +309,6 @@ end -- Objects Callbacks -------------------------------------------------- - function canyon_camp.Rival_1_Action(chara, activator) DEBUG.EnableDbgCoro() --Enable debugging this coroutine @@ -1165,24 +1181,16 @@ function canyon_camp.Aggron_Fail() --get back up end -function canyon_camp.East_Exit_Touch(obj, activator) +function canyon_camp.East_Exit_Touch(obj, activator, newDunEnts, newGroEnts) DEBUG.EnableDbgCoro() --Enable debugging this coroutine - local dungeon_entrances = { 'copper_quarry', 'depleted_basin', 'forsaken_desert', 'relic_tower', 'sleeping_caldera', 'royal_halls', 'starfall_heights', 'wisdom_road', 'sacred_tower'} - local ground_entrances = {{Flag=SV.rest_stop.ExpositionComplete,Zone='guildmaster_island',ID=6,Entry=0}, - {Flag=SV.final_stop.ExpositionComplete,Zone='guildmaster_island',ID=7,Entry=0}, - {Flag=SV.guildmaster_summit.GameComplete,Zone='guildmaster_island',ID=8,Entry=0}} - COMMON.ShowDestinationMenu(dungeon_entrances,ground_entrances) + COMMON.JuncPatchSupport(obj, activator, newDunEnts, newGroEnts, EAST_DUN_ENTRANCES, EAST_GRO_ENTRANCES) end -function canyon_camp.West_Exit_Touch(obj, activator) +function canyon_camp.West_Exit_Touch(obj, activator, newDunEnts, newGroEnts) DEBUG.EnableDbgCoro() --Enable debugging this coroutine - local dungeon_entrances = { } - local ground_entrances = {{Flag=true,Zone='guildmaster_island',ID=1,Entry=3}, - {Flag=SV.forest_camp.ExpositionComplete,Zone='guildmaster_island',ID=3,Entry=2}, - {Flag=SV.cliff_camp.ExpositionComplete,Zone='guildmaster_island',ID=4,Entry=2}} - COMMON.ShowDestinationMenu(dungeon_entrances,ground_entrances) + COMMON.JuncPatchSupport(obj, activator, newDunEnts, newGroEnts, WEST_DUN_ENTRANCES, WEST_GRO_ENTRANCES) end diff --git a/Data/Script/origin/ground/cliff_camp/init.lua b/Data/Script/origin/ground/cliff_camp/init.lua index 4e33ab2409..05d507ae23 100644 --- a/Data/Script/origin/ground/cliff_camp/init.lua +++ b/Data/Script/origin/ground/cliff_camp/init.lua @@ -1,7 +1,24 @@ require 'origin.common' local cliff_camp = {} - +-------------------------------------------------- +-- Variables +-------------------------------------------------- +local EAST_DUN_ENTRANCES = { +'fertile_valley', 'flyaway_cliffs', 'wayward_wetlands', 'deserted_fortress', + 'bravery_road', 'geode_crevice', 'the_sky' } +local EAST_GRO_ENTRANCES = { + {Flag=SV.canyon_camp.ExpositionComplete,Zone='guildmaster_island',ID=5,Entry=0}, + {Flag=SV.rest_stop.ExpositionComplete,Zone='guildmaster_island',ID=6,Entry=0}, + {Flag=SV.final_stop.ExpositionComplete,Zone='guildmaster_island',ID=7,Entry=0}, + {Flag=SV.guildmaster_summit.GameComplete,Zone='guildmaster_island',ID=8,Entry=0} +} + +local WEST_DUN_ENTRANCES = {} +local WEST_GRO_ENTRANCES = { + {Flag=true,Zone='guildmaster_island',ID=1,Entry=3}, + {Flag=SV.forest_camp.ExpositionComplete,Zone='guildmaster_island',ID=3,Entry=2} +} -------------------------------------------------- -- Map Callbacks -------------------------------------------------- @@ -259,24 +276,16 @@ end -------------------------------------------------- -- Objects Callbacks -------------------------------------------------- -function cliff_camp.East_Exit_Touch(obj, activator) +function cliff_camp.East_Exit_Touch(obj, activator, newDunEnts, newGroEnts) DEBUG.EnableDbgCoro() --Enable debugging this coroutine - UI:ResetSpeaker() - local dungeon_entrances = { 'fertile_valley', 'flyaway_cliffs', 'wayward_wetlands', 'deserted_fortress', 'bravery_road', 'geode_crevice', 'the_sky' } - local ground_entrances = {{Flag=SV.canyon_camp.ExpositionComplete,Zone='guildmaster_island',ID=5,Entry=0}, - {Flag=SV.rest_stop.ExpositionComplete,Zone='guildmaster_island',ID=6,Entry=0}, - {Flag=SV.final_stop.ExpositionComplete,Zone='guildmaster_island',ID=7,Entry=0}, - {Flag=SV.guildmaster_summit.GameComplete,Zone='guildmaster_island',ID=8,Entry=0}} - COMMON.ShowDestinationMenu(dungeon_entrances,ground_entrances) + COMMON.JuncPatchSupport(obj, activator, newDunEnts, newGroEnts, EAST_DUN_ENTRANCES, EAST_GRO_ENTRANCES) end -function cliff_camp.West_Exit_Touch(obj, activator) +function cliff_camp.West_Exit_Touch(obj, activator, newDunEnts, newGroEnts) DEBUG.EnableDbgCoro() --Enable debugging this coroutine - local dungeon_entrances = { } - local ground_entrances = {{Flag=true,Zone='guildmaster_island',ID=1,Entry=3}, - {Flag=SV.forest_camp.ExpositionComplete,Zone='guildmaster_island',ID=3,Entry=2}} - COMMON.ShowDestinationMenu(dungeon_entrances,ground_entrances) + + COMMON.JuncPatchSupport(obj, activator, newDunEnts, newGroEnts, WEST_DUN_ENTRANCES, WEST_GRO_ENTRANCES) end diff --git a/Data/Script/origin/ground/final_stop/init.lua b/Data/Script/origin/ground/final_stop/init.lua index 9e499f509e..8968e3d0fa 100644 --- a/Data/Script/origin/ground/final_stop/init.lua +++ b/Data/Script/origin/ground/final_stop/init.lua @@ -1,6 +1,25 @@ require 'origin.common' local final_stop = {} +-------------------------------------------------- +-- Variables +-------------------------------------------------- +-- north +local NORTH_DUN_ENTRANCES = { +'champions_road', 'barren_tundra', 'cave_of_solace', 'labyrinth_of_the_lost' } +local NORTH_GRO_ENTRANCES = { + {Flag=SV.guildmaster_summit.GameComplete,Zone='guildmaster_island',ID=8,Entry=0} +} + +-- south +local SOUTH_DUN_ENTRANCES = {} +local SOUTH_GRO_ENTRANCES = { + {Flag=true,Zone='guildmaster_island',ID=1,Entry=3}, + {Flag=SV.forest_camp.ExpositionComplete,Zone='guildmaster_island',ID=3,Entry=2}, + {Flag=SV.cliff_camp.ExpositionComplete,Zone='guildmaster_island',ID=4,Entry=2}, + {Flag=SV.canyon_camp.ExpositionComplete,Zone='guildmaster_island',ID=5,Entry=2}, + {Flag=SV.rest_stop.ExpositionComplete,Zone='guildmaster_island',ID=6,Entry=2} +} -------------------------------------------------- -- Map Callbacks @@ -630,23 +649,16 @@ function final_stop.NPC_Forbidden_Action(chara, activator) end end -function final_stop.North_Exit_Touch(obj, activator) +function final_stop.North_Exit_Touch(obj, activator, newDunEnts, newGroEnts) DEBUG.EnableDbgCoro() --Enable debugging this coroutine - local dungeon_entrances = { 'champions_road', 'barren_tundra', 'cave_of_solace', 'labyrinth_of_the_lost' } - local ground_entrances = {{Flag=SV.guildmaster_summit.GameComplete,Zone='guildmaster_island',ID=8,Entry=0}} - COMMON.ShowDestinationMenu(dungeon_entrances,ground_entrances) + COMMON.JuncPatchSupport(obj, activator, newDunEnts, newGroEnts, NORTH_DUN_ENTRANCES, NORTH_GRO_ENTRANCES) end -function final_stop.South_Exit_Touch(obj, activator) +function final_stop.South_Exit_Touch(obj, activator, newDunEnts, newGroEnts) DEBUG.EnableDbgCoro() --Enable debugging this coroutine - local dungeon_entrances = { } - local ground_entrances = {{Flag=true,Zone='guildmaster_island',ID=1,Entry=3}, - {Flag=SV.forest_camp.ExpositionComplete,Zone='guildmaster_island',ID=3,Entry=2}, - {Flag=SV.cliff_camp.ExpositionComplete,Zone='guildmaster_island',ID=4,Entry=2}, - {Flag=SV.canyon_camp.ExpositionComplete,Zone='guildmaster_island',ID=5,Entry=2}, - {Flag=SV.rest_stop.ExpositionComplete,Zone='guildmaster_island',ID=6,Entry=2}} - COMMON.ShowDestinationMenu(dungeon_entrances,ground_entrances) + + COMMON.JuncPatchSupport(obj, activator, newDunEnts, newGroEnts, SOUTH_DUN_ENTRANCES, SOUTH_GRO_ENTRANCES) end diff --git a/Data/Script/origin/ground/forest_camp/init.lua b/Data/Script/origin/ground/forest_camp/init.lua index 7693e11183..89b8647719 100644 --- a/Data/Script/origin/ground/forest_camp/init.lua +++ b/Data/Script/origin/ground/forest_camp/init.lua @@ -1,7 +1,50 @@ require 'origin.common' local forest_camp = {} +-------------------------------------------------- +-- Variables +-------------------------------------------------- +local helper = {} + +-- north +local NORTH_DUN_ENTRANCES = { +'faded_trail', 'bramble_woods', 'trickster_woods', 'overgrown_wilds', +'moonlit_courtyard', 'ambush_forest', 'tiny_tunnel', 'energy_garden', +'sickly_hollow', 'secret_garden'} +local NORTH_GRO_ENTRANCES = { + {Flag=SV.cliff_camp.ExpositionComplete,Zone='guildmaster_island',ID=4,Entry=0}, + {Flag=SV.canyon_camp.ExpositionComplete,Zone='guildmaster_island',ID=5,Entry=0}, + {Flag=SV.rest_stop.ExpositionComplete,Zone='guildmaster_island',ID=6,Entry=0}, + {Flag=SV.final_stop.ExpositionComplete,Zone='guildmaster_island',ID=7,Entry=0}, + {Flag=SV.guildmaster_summit.GameComplete,Zone='guildmaster_island',ID=8,Entry=0} +} + +-- south +local SOUTH_DUN_ENTRANCES = {} +local SOUTH_GRO_ENTRANCES = { + {Flag=true,Zone='guildmaster_island',ID=1,Entry=3} +} +-------------------------------------------------- +-- Helpers +-------------------------------------------------- +-- these should probably be stuffed in some common location! +function helper.HelperDeepClone(target) + local clone = {} + if target then + for i=1,#target do + clone[#clone+1] = target[i] + end + end + return clone +end +function helper.HelperMerge(tableAddedTo, tableTakenFrom) + if tableAddedTo and tableTakenFrom then + for i=1,#tableTakenFrom do + tableAddedTo[#tableAddedTo+1] = tableTakenFrom[i] + end + end +end -------------------------------------------------- -- Map Callbacks -------------------------------------------------- @@ -179,23 +222,16 @@ end -------------------------------------------------- -- Objects Callbacks -------------------------------------------------- -function forest_camp.North_Exit_Touch(obj, activator) +function forest_camp.North_Exit_Touch(obj, activator, newDunEnts, newGroEnts) DEBUG.EnableDbgCoro() --Enable debugging this coroutine - local dungeon_entrances = { 'faded_trail', 'bramble_woods', 'trickster_woods', 'overgrown_wilds', 'moonlit_courtyard', 'ambush_forest', 'tiny_tunnel', 'energy_garden', 'sickly_hollow', 'secret_garden'} - local ground_entrances = {{Flag=SV.cliff_camp.ExpositionComplete,Zone='guildmaster_island',ID=4,Entry=0}, - {Flag=SV.canyon_camp.ExpositionComplete,Zone='guildmaster_island',ID=5,Entry=0}, - {Flag=SV.rest_stop.ExpositionComplete,Zone='guildmaster_island',ID=6,Entry=0}, - {Flag=SV.final_stop.ExpositionComplete,Zone='guildmaster_island',ID=7,Entry=0}, - {Flag=SV.guildmaster_summit.GameComplete,Zone='guildmaster_island',ID=8,Entry=0}} - COMMON.ShowDestinationMenu(dungeon_entrances,ground_entrances) + + COMMON.JuncPatchSupport(obj, activator, newDunEnts, newGroEnts, NORTH_DUN_ENTRANCES, NORTH_GRO_ENTRANCES) end -function forest_camp.South_Exit_Touch(obj, activator) +function forest_camp.South_Exit_Touch(obj, activator, newDunEnts, newGroEnts) DEBUG.EnableDbgCoro() --Enable debugging this coroutine - local dungeon_entrances = { } - local ground_entrances = {{Flag=true,Zone='guildmaster_island',ID=1,Entry=3}} - COMMON.ShowDestinationMenu(dungeon_entrances,ground_entrances) + COMMON.JuncPatchSupport(obj, activator, newDunEnts, newGroEnts, SOUTH_DUN_ENTRANCES, SOUTH_GRO_ENTRANCES) end function forest_camp.Assembly_Action(obj, activator) @@ -282,8 +318,6 @@ function forest_camp.NPC_Carry_Action(chara, activator) UI:SetSpeakerEmotion("Angry") UI:WaitShowDialogue(STRINGS:Format(STRINGS.MapStrings['Carry_Line_001'])) UI:SetSpeakerEmotion("Stunned") - - --local skill_summary = _DATA.DataIndices[RogueEssence.Data.DataManager.DataType.Skill]:Get("wake_up_slap") UI:WaitShowDialogue(STRINGS:Format(STRINGS.MapStrings['Carry_Line_002'])) GROUND:EntTurn(chara, Direction.Left) elseif SV.supply_corps.Status >= 20 then diff --git a/Data/Script/origin/ground/rest_stop/init.lua b/Data/Script/origin/ground/rest_stop/init.lua index 2295a5f7a9..f318c6fd75 100644 --- a/Data/Script/origin/ground/rest_stop/init.lua +++ b/Data/Script/origin/ground/rest_stop/init.lua @@ -1,7 +1,26 @@ require 'origin.common' local rest_stop = {} - +-------------------------------------------------- +-- Variables +-------------------------------------------------- +-- north +local NORTH_DUN_ENTRANCES = { +'thunderstruck_pass', 'veiled_ridge', 'snowbound_path', +'treacherous_mountain', 'hope_road', 'cave_of_whispers' } +local NORTH_GRO_ENTRANCES = { + {Flag=SV.final_stop.ExpositionComplete,Zone='guildmaster_island',ID=7,Entry=0}, + {Flag=SV.guildmaster_summit.GameComplete,Zone='guildmaster_island',ID=8,Entry=0} +} + +-- south +local SOUTH_DUN_ENTRANCES = {} +local SOUTH_GRO_ENTRANCES = { + {Flag=true,Zone='guildmaster_island',ID=1,Entry=3}, + {Flag=SV.forest_camp.ExpositionComplete,Zone='guildmaster_island',ID=3,Entry=2}, + {Flag=SV.cliff_camp.ExpositionComplete,Zone='guildmaster_island',ID=4,Entry=2}, + {Flag=SV.canyon_camp.ExpositionComplete,Zone='guildmaster_island',ID=5,Entry=2} +} -------------------------------------------------- -- Map Callbacks -------------------------------------------------- @@ -788,26 +807,20 @@ function rest_stop.Ice_Complete() SV.team_dark.Status = 5 end -function rest_stop.North_Exit_Touch(obj, activator) +function rest_stop.North_Exit_Touch(obj, activator, newDunEnts, newGroEnts) DEBUG.EnableDbgCoro() --Enable debugging this coroutine - local dungeon_entrances = { 'thunderstruck_pass', 'veiled_ridge', 'snowbound_path', 'treacherous_mountain', 'hope_road', 'cave_of_whispers' } + COMMON.JuncPatchSupport(obj, activator, newDunEnts, newGroEnts, NORTH_DUN_ENTRANCES, NORTH_GRO_ENTRANCES) + --also dungeon 21: royal halls, is accessible by ??? --also dungeon 22: cave of solace, is accessible by having 8 key items - local ground_entrances = {{Flag=SV.final_stop.ExpositionComplete,Zone='guildmaster_island',ID=7,Entry=0}, - {Flag=SV.guildmaster_summit.GameComplete,Zone='guildmaster_island',ID=8,Entry=0}} - COMMON.ShowDestinationMenu(dungeon_entrances,ground_entrances) + end -function rest_stop.South_Exit_Touch(obj, activator) +function rest_stop.South_Exit_Touch(obj, activator, newDunEnts, newGroEnts) DEBUG.EnableDbgCoro() --Enable debugging this coroutine - local dungeon_entrances = { } - local ground_entrances = {{Flag=true,Zone='guildmaster_island',ID=1,Entry=3}, - {Flag=SV.forest_camp.ExpositionComplete,Zone='guildmaster_island',ID=3,Entry=2}, - {Flag=SV.cliff_camp.ExpositionComplete,Zone='guildmaster_island',ID=4,Entry=2}, - {Flag=SV.canyon_camp.ExpositionComplete,Zone='guildmaster_island',ID=5,Entry=2}} - COMMON.ShowDestinationMenu(dungeon_entrances,ground_entrances) + COMMON.JuncPatchSupport(obj, activator, newDunEnts, newGroEnts, SOUTH_DUN_ENTRANCES, SOUTH_GRO_ENTRANCES) end function rest_stop.Assembly_Action(obj, activator)