From 573f03dcdd4ab6874b079f3bc7f74bfd6334a87a Mon Sep 17 00:00:00 2001 From: Jouramie <16137441+Jouramie@users.noreply.github.com> Date: Sat, 18 Jul 2026 15:15:29 -0400 Subject: [PATCH 1/5] don't update portals when none are unlocked --- Archipelago/TrackerManager.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/Archipelago/TrackerManager.cs b/Archipelago/TrackerManager.cs index 4dce507..6cdb288 100644 --- a/Archipelago/TrackerManager.cs +++ b/Archipelago/TrackerManager.cs @@ -34,6 +34,7 @@ public void ReconciliateUnlockedPortals() var unlockedPortals = RandoPortalManager.UnlockedPortals; unlockedPortals.UnionWith(ArchipelagoClient.Session.DataStorage[Scope.Slot, "UnlockedPortals"].To>() ?? []); + if (unlockedPortals.Count == 0) return; var unlockedPortalsList = unlockedPortals.ToList(); unlockedPortalsList.Sort(); From b30c07c8b4853d96fac6b7ae882d9d8e9bc3660b Mon Sep 17 00:00:00 2001 From: Jouramie <16137441+Jouramie@users.noreply.github.com> Date: Sat, 18 Jul 2026 17:19:39 -0400 Subject: [PATCH 2/5] fix portal tracking --- APRandomizerMain.cs | 1 + Archipelago/TrackerManager.cs | 59 +- GameOverrideManagers/RandoLevelManager.cs | 8 +- GameOverrideManagers/RandoPortalManager.cs | 833 +++++++++++---------- Utils/RandomizerSaveMethod.cs | 0 5 files changed, 464 insertions(+), 437 deletions(-) delete mode 100644 Utils/RandomizerSaveMethod.cs diff --git a/APRandomizerMain.cs b/APRandomizerMain.cs index 9eb97fd..44446c7 100644 --- a/APRandomizerMain.cs +++ b/APRandomizerMain.cs @@ -112,6 +112,7 @@ public override void Load() On.ElementalSkylandsLevelInitializer.OnBeforeInitDone += RandoLevelManager.ElementalSkylandsInit; // On.PortalOpeningCutscene.OnOpenPortalEvent += RandoPortalManager.OpenPortalEvent; On.TotHQ.LeaveToLevel += RandoPortalManager.LeaveHQ; + On.TowerOfTimePortal.LoadLevel += RandoPortalManager.TowerOfTimePortal_LoadLevel; // generator deactivation management skylandsGeneratorManager.ApplyHooks(); //These functions let us override and manage power seals ourselves with 'fake' items diff --git a/Archipelago/TrackerManager.cs b/Archipelago/TrackerManager.cs index 6cdb288..9004100 100644 --- a/Archipelago/TrackerManager.cs +++ b/Archipelago/TrackerManager.cs @@ -4,42 +4,47 @@ using Archipelago.MultiClient.Net.Enums; using MessengerRando.GameOverrideManagers; -namespace MessengerRando.Archipelago +namespace MessengerRando.Archipelago; + +public class TrackerManager { - public class TrackerManager - { - private List VisitedEntrances = []; + private List VisitedEntrances = []; - public void AddVisitedEntrance(string entrance) - { - if (VisitedEntrances.Contains(entrance)) return; + public void AddVisitedEntrance(string entrance) + { + if (VisitedEntrances.Contains(entrance)) return; + + if (!ArchipelagoClient.Authenticated) return; + VisitedEntrances = ArchipelagoClient.Session.DataStorage[Scope.Slot, "VisitedEntrances"].To>() ?? []; + if (VisitedEntrances.Contains(entrance)) return; - if (!ArchipelagoClient.Authenticated) return; - VisitedEntrances = ArchipelagoClient.Session.DataStorage[Scope.Slot, "VisitedEntrances"].To>() ?? []; - if (VisitedEntrances.Contains(entrance)) return; + Console.WriteLine("Adding visited entrance: " + entrance); + VisitedEntrances.Add(entrance); + VisitedEntrances.Sort(); + ArchipelagoClient.Session.DataStorage[Scope.Slot, "VisitedEntrances"] = VisitedEntrances; - Console.WriteLine("Adding visited entrance: " + entrance); - VisitedEntrances.Add(entrance); - VisitedEntrances.Sort(); - ArchipelagoClient.Session.DataStorage[Scope.Slot, "VisitedEntrances"] = VisitedEntrances; + return; + } - return; - } + public void ReconciliateUnlockedPortals() + { + if (!ArchipelagoClient.Authenticated) return; - public void ReconciliateUnlockedPortals() - { - if (!ArchipelagoClient.Authenticated) return; + var unlockedPortals = RandoPortalManager.UnlockedPortals; + unlockedPortals.UnionWith(ArchipelagoClient.Session.DataStorage[Scope.Slot, "UnlockedPortals"].To>() ?? []); + if (unlockedPortals.Count == 0) return; - var unlockedPortals = RandoPortalManager.UnlockedPortals; - unlockedPortals.UnionWith(ArchipelagoClient.Session.DataStorage[Scope.Slot, "UnlockedPortals"].To>() ?? []); - if (unlockedPortals.Count == 0) return; + var unlockedPortalsList = unlockedPortals.ToList(); + unlockedPortalsList.Sort(); + Console.WriteLine($"Updating unlocked portals with Data Storage. Unlocked portals are\n\t{string.Join("\n\t", [.. unlockedPortalsList])}"); + ArchipelagoClient.Session.DataStorage[Scope.Slot, "UnlockedPortals"] = unlockedPortalsList; + } - var unlockedPortalsList = unlockedPortals.ToList(); - unlockedPortalsList.Sort(); - Console.WriteLine($"Updating unlocked portals with Data Storage. Unlocked portals are\n\t{string.Join("\n\t", [.. unlockedPortalsList])}"); - ArchipelagoClient.Session.DataStorage[Scope.Slot, "UnlockedPortals"] = unlockedPortalsList; - } + public void SetCurrentRegion(ELevel level) + { + if (!ArchipelagoClient.Authenticated) return; + ArchipelagoClient.Session.DataStorage[Scope.Slot, "CurrentRegion"] = level.ToString(); } } diff --git a/GameOverrideManagers/RandoLevelManager.cs b/GameOverrideManagers/RandoLevelManager.cs index 870f248..e03e6f8 100644 --- a/GameOverrideManagers/RandoLevelManager.cs +++ b/GameOverrideManagers/RandoLevelManager.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using Archipelago.MultiClient.Net.Enums; using MessengerRando.Archipelago; using MessengerRando.Utils; using MessengerRando.Utils.Constants; @@ -251,12 +250,11 @@ private static void AddCurrentRegionToStorage(LevelManager self) if (!ArchipelagoClient.Authenticated) return; // put the region we just loaded into in AP data storage for tracking if (self.lastLevelLoaded.Equals(ELevel.Level_13_TowerOfTimeHQ + "_Build")) - ArchipelagoClient.Session.DataStorage[Scope.Slot, "CurrentRegion"] = - ELevel.Level_13_TowerOfTimeHQ.ToString(); + TrackerManager.SetCurrentRegion(ELevel.Level_13_TowerOfTimeHQ); else - ArchipelagoClient.Session.DataStorage[Scope.Slot, "CurrentRegion"] = - self.GetCurrentLevelEnum().ToString(); + TrackerManager.SetCurrentRegion(self.GetCurrentLevelEnum()); } + public static void SkipMusicBox() { var playerPosition = RandomizerStateManager.Instance.SkipMusicBox diff --git a/GameOverrideManagers/RandoPortalManager.cs b/GameOverrideManagers/RandoPortalManager.cs index 2e98ce5..6ad0ec7 100644 --- a/GameOverrideManagers/RandoPortalManager.cs +++ b/GameOverrideManagers/RandoPortalManager.cs @@ -4,469 +4,492 @@ using MessengerRando.Utils.Constants; using UnityEngine; -namespace MessengerRando.GameOverrideManagers +namespace MessengerRando.GameOverrideManagers; + +public static class RandoPortalManager { - public static class RandoPortalManager + public readonly struct Portal { - public readonly struct Portal + public readonly int Region; + public readonly int PortalType; + public readonly int Index; + + public Portal(int portalWarp) { - public readonly int Region; - public readonly int PortalType; - public readonly int Index; + var modWarp = portalWarp.ToString(); + if (modWarp.Length == 4) + { + Region = int.Parse(modWarp.Substring(0, 2)); + PortalType = int.Parse(modWarp[2].ToString()); + Index = int.Parse(modWarp[3].ToString()); + } + else if (modWarp.Length == 3) + { + Region = int.Parse(modWarp[0].ToString()); + PortalType = int.Parse(modWarp[1].ToString()); + Index = int.Parse(modWarp[2].ToString()); + } + else if (modWarp.Length == 2) + { + Region = 0; + PortalType = int.Parse(modWarp[0].ToString()); + Index = int.Parse(modWarp[1].ToString()); + } + else + { + Region = 0; + PortalType = 0; + Index = int.Parse(modWarp); + } + } + } - public Portal(int portalWarp) + public static bool LeftHQPortal; + public static bool ForceTeleport; + public static bool EnteredTower; + public static List StartingPortals; + public static List PortalMapping; + public static TrackerManager TrackerManager; + + static readonly List>> AreaCheckpoints = + new List>> + { + new List> { - var modWarp = portalWarp.ToString(); - if (modWarp.Length == 4) + new List + { + new LevelConstants.RandoLevel(ELevel.Level_02_AutumnHills, new Vector3(485, -102)), + }, + new List + { + new LevelConstants.RandoLevel(ELevel.Level_02_AutumnHills, new Vector3(-45.5f, -89)), + new LevelConstants.RandoLevel(ELevel.Level_02_AutumnHills, new Vector3(68.5f, -111)), + new LevelConstants.RandoLevel(ELevel.Level_02_AutumnHills, new Vector3(407.5f, -74)), + new LevelConstants.RandoLevel(ELevel.Level_02_AutumnHills, new Vector3(892.5f, -27)), + }, + new List { - Region = int.Parse(modWarp.Substring(0, 2)); - PortalType = int.Parse(modWarp[2].ToString()); - Index = int.Parse(modWarp[3].ToString()); + new LevelConstants.RandoLevel(ELevel.Level_02_AutumnHills, new Vector3(175, -148)), + new LevelConstants.RandoLevel(ELevel.Level_02_AutumnHills, new Vector3(91.5f, -87)), + new LevelConstants.RandoLevel(ELevel.Level_02_AutumnHills, new Vector3(238.5f, -74)), + new LevelConstants.RandoLevel(ELevel.Level_02_AutumnHills, new Vector3(607.48f, -35)), + new LevelConstants.RandoLevel(ELevel.Level_02_AutumnHills, new Vector3(718.5f, -73), EBits.BITS_8), } - else if (modWarp.Length == 3) + }, + new List> + { + new List(), + new List + { + new LevelConstants.RandoLevel(ELevel.Level_03_ForlornTemple, new Vector3(0.5f, -11)), + new LevelConstants.RandoLevel(ELevel.Level_03_ForlornTemple, new Vector3(88.5f, -10)), + new LevelConstants.RandoLevel(ELevel.Level_03_ForlornTemple, new Vector3(251.5f, 53)), + new LevelConstants.RandoLevel(ELevel.Level_03_ForlornTemple, new Vector3(156, 85)), + new LevelConstants.RandoLevel(ELevel.Level_03_ForlornTemple, new Vector3(271.5f, 61)), + new LevelConstants.RandoLevel(ELevel.Level_03_ForlornTemple, new Vector3(347.5f, 31)), + new LevelConstants.RandoLevel(ELevel.Level_03_ForlornTemple, new Vector3(354.5f, -11)), + }, + new List { - Region = int.Parse(modWarp[0].ToString()); - PortalType = int.Parse(modWarp[1].ToString()); - Index = int.Parse(modWarp[2].ToString()); + new LevelConstants.RandoLevel(ELevel.Level_03_ForlornTemple, new Vector3(124.5f, 47)), + new LevelConstants.RandoLevel(ELevel.Level_03_ForlornTemple, new Vector3(260.5f, 24)), } - else if (modWarp.Length == 2) + }, + new List> + { + new List(), + new List { - Region = 0; - PortalType = int.Parse(modWarp[0].ToString()); - Index = int.Parse(modWarp[1].ToString()); + new LevelConstants.RandoLevel(ELevel.Level_04_Catacombs, new Vector3(241.5f, -25)), + new LevelConstants.RandoLevel(ELevel.Level_04_Catacombs, new Vector3(731.5f, -75)), + }, + new List + { + new LevelConstants.RandoLevel(ELevel.Level_04_Catacombs, new Vector3(379.5f, -23)), + new LevelConstants.RandoLevel(ELevel.Level_04_Catacombs, new Vector3(529.5f, -75), EBits.BITS_16), + new LevelConstants.RandoLevel(ELevel.Level_04_Catacombs, new Vector3(499.5f, -43)), } - else + }, + new List> + { + new List(), + new List + { + new LevelConstants.RandoLevel(ELevel.Level_06_A_BambooCreek, new Vector3(-28.5f, -19)), + new LevelConstants.RandoLevel(ELevel.Level_06_A_BambooCreek, new Vector3(92.5f, 25)), + new LevelConstants.RandoLevel(ELevel.Level_06_A_BambooCreek, new Vector3(379.5f, 25)), + }, + new List { - Region = 0; - PortalType = 0; - Index = int.Parse(modWarp); + new LevelConstants.RandoLevel(ELevel.Level_06_A_BambooCreek, new Vector3(227.5f, -41)), + new LevelConstants.RandoLevel(ELevel.Level_06_A_BambooCreek, new Vector3(210.5f, 29)), } - } - } - - public static bool LeftHQPortal; - public static bool ForceTeleport; - public static bool EnteredTower; - public static List StartingPortals; - public static List PortalMapping; - public static TrackerManager TrackerManager; - - static readonly List>> AreaCheckpoints = - new List>> + }, + new List> { - new List> - { - new List - { - new LevelConstants.RandoLevel(ELevel.Level_02_AutumnHills, new Vector3(485, -102)), - }, - new List - { - new LevelConstants.RandoLevel(ELevel.Level_02_AutumnHills, new Vector3(-45.5f, -89)), - new LevelConstants.RandoLevel(ELevel.Level_02_AutumnHills, new Vector3(68.5f, -111)), - new LevelConstants.RandoLevel(ELevel.Level_02_AutumnHills, new Vector3(407.5f, -74)), - new LevelConstants.RandoLevel(ELevel.Level_02_AutumnHills, new Vector3(892.5f, -27)), - }, - new List - { - new LevelConstants.RandoLevel(ELevel.Level_02_AutumnHills, new Vector3(175, -148)), - new LevelConstants.RandoLevel(ELevel.Level_02_AutumnHills, new Vector3(91.5f, -87)), - new LevelConstants.RandoLevel(ELevel.Level_02_AutumnHills, new Vector3(238.5f, -74)), - new LevelConstants.RandoLevel(ELevel.Level_02_AutumnHills, new Vector3(607.48f, -35)), - new LevelConstants.RandoLevel(ELevel.Level_02_AutumnHills, new Vector3(718.5f, -73), EBits.BITS_8), - } + new List + { + new LevelConstants.RandoLevel(ELevel.Level_05_A_HowlingGrotto, new Vector3(241f, -196f)), }, - new List> - { - new List(), - new List - { - new LevelConstants.RandoLevel(ELevel.Level_03_ForlornTemple, new Vector3(0.5f, -11)), - new LevelConstants.RandoLevel(ELevel.Level_03_ForlornTemple, new Vector3(88.5f, -10)), - new LevelConstants.RandoLevel(ELevel.Level_03_ForlornTemple, new Vector3(251.5f, 53)), - new LevelConstants.RandoLevel(ELevel.Level_03_ForlornTemple, new Vector3(156, 85)), - new LevelConstants.RandoLevel(ELevel.Level_03_ForlornTemple, new Vector3(271.5f, 61)), - new LevelConstants.RandoLevel(ELevel.Level_03_ForlornTemple, new Vector3(347.5f, 31)), - new LevelConstants.RandoLevel(ELevel.Level_03_ForlornTemple, new Vector3(354.5f, -11)), - }, - new List - { - new LevelConstants.RandoLevel(ELevel.Level_03_ForlornTemple, new Vector3(124.5f, 47)), - new LevelConstants.RandoLevel(ELevel.Level_03_ForlornTemple, new Vector3(260.5f, 24)), - } + new List + { + new LevelConstants.RandoLevel(ELevel.Level_05_A_HowlingGrotto, new Vector3(26.5f, -27)), + new LevelConstants.RandoLevel(ELevel.Level_05_A_HowlingGrotto, new Vector3(310.5f, -115)), + new LevelConstants.RandoLevel(ELevel.Level_05_A_HowlingGrotto, new Vector3(541.5f, -123)), }, - new List> - { - new List(), - new List - { - new LevelConstants.RandoLevel(ELevel.Level_04_Catacombs, new Vector3(241.5f, -25)), - new LevelConstants.RandoLevel(ELevel.Level_04_Catacombs, new Vector3(731.5f, -75)), - }, - new List - { - new LevelConstants.RandoLevel(ELevel.Level_04_Catacombs, new Vector3(379.5f, -23)), - new LevelConstants.RandoLevel(ELevel.Level_04_Catacombs, new Vector3(529.5f, -75), EBits.BITS_16), - new LevelConstants.RandoLevel(ELevel.Level_04_Catacombs, new Vector3(499.5f, -43)), - } + new List + { + new LevelConstants.RandoLevel(ELevel.Level_05_A_HowlingGrotto, new Vector3(138.5f, -90)), + new LevelConstants.RandoLevel(ELevel.Level_05_A_HowlingGrotto, new Vector3(439, -170)), + } + }, + new List> + { + new List(), + new List + { + new LevelConstants.RandoLevel(ELevel.Level_07_QuillshroomMarsh, new Vector3(193.5f, -37)), + new LevelConstants.RandoLevel(ELevel.Level_07_QuillshroomMarsh, new Vector3(663.5f, -27)), + new LevelConstants.RandoLevel(ELevel.Level_07_QuillshroomMarsh, new Vector3(1085.5f, -43)), }, - new List> - { - new List(), - new List - { - new LevelConstants.RandoLevel(ELevel.Level_06_A_BambooCreek, new Vector3(-28.5f, -19)), - new LevelConstants.RandoLevel(ELevel.Level_06_A_BambooCreek, new Vector3(92.5f, 25)), - new LevelConstants.RandoLevel(ELevel.Level_06_A_BambooCreek, new Vector3(379.5f, 25)), - }, - new List - { - new LevelConstants.RandoLevel(ELevel.Level_06_A_BambooCreek, new Vector3(227.5f, -41)), - new LevelConstants.RandoLevel(ELevel.Level_06_A_BambooCreek, new Vector3(210.5f, 29)), - } + new List + { + new LevelConstants.RandoLevel(ELevel.Level_07_QuillshroomMarsh, new Vector3(161.5f, -54)), + new LevelConstants.RandoLevel(ELevel.Level_07_QuillshroomMarsh, new Vector3(409.5f, -42)), + new LevelConstants.RandoLevel(ELevel.Level_07_QuillshroomMarsh, new Vector3(916.5f, -26)), + } + }, + new List> + { + new List + { + new LevelConstants.RandoLevel(ELevel.Level_08_SearingCrags, new Vector3(384.5f, 135f)), }, - new List> - { - new List - { - new LevelConstants.RandoLevel(ELevel.Level_05_A_HowlingGrotto, new Vector3(241f, -196f)), - }, - new List - { - new LevelConstants.RandoLevel(ELevel.Level_05_A_HowlingGrotto, new Vector3(26.5f, -27)), - new LevelConstants.RandoLevel(ELevel.Level_05_A_HowlingGrotto, new Vector3(310.5f, -115)), - new LevelConstants.RandoLevel(ELevel.Level_05_A_HowlingGrotto, new Vector3(541.5f, -123)), - }, - new List - { - new LevelConstants.RandoLevel(ELevel.Level_05_A_HowlingGrotto, new Vector3(138.5f, -90)), - new LevelConstants.RandoLevel(ELevel.Level_05_A_HowlingGrotto, new Vector3(439, -170)), - } + new List + { + new LevelConstants.RandoLevel(ELevel.Level_08_SearingCrags, new Vector3(61, -27)), + new LevelConstants.RandoLevel(ELevel.Level_08_SearingCrags, new Vector3(147.5f, 69)), + new LevelConstants.RandoLevel(ELevel.Level_08_SearingCrags, new Vector3(226.5f, 151)), + new LevelConstants.RandoLevel(ELevel.Level_08_SearingCrags, new Vector3(282, 237)), + new LevelConstants.RandoLevel(ELevel.Level_08_SearingCrags, new Vector3(380.5f, 309)), + new LevelConstants.RandoLevel(ELevel.Level_08_SearingCrags, new Vector3(119.5f, 248), EBits.BITS_8), }, - new List> - { - new List(), - new List - { - new LevelConstants.RandoLevel(ELevel.Level_07_QuillshroomMarsh, new Vector3(193.5f, -37)), - new LevelConstants.RandoLevel(ELevel.Level_07_QuillshroomMarsh, new Vector3(663.5f, -27)), - new LevelConstants.RandoLevel(ELevel.Level_07_QuillshroomMarsh, new Vector3(1085.5f, -43)), - }, - new List - { - new LevelConstants.RandoLevel(ELevel.Level_07_QuillshroomMarsh, new Vector3(161.5f, -54)), - new LevelConstants.RandoLevel(ELevel.Level_07_QuillshroomMarsh, new Vector3(409.5f, -42)), - new LevelConstants.RandoLevel(ELevel.Level_07_QuillshroomMarsh, new Vector3(916.5f, -26)), - } + new List + { + new LevelConstants.RandoLevel(ELevel.Level_08_SearingCrags, new Vector3(109.5f, 63)), + new LevelConstants.RandoLevel(ELevel.Level_08_SearingCrags, new Vector3(296.5f, 189f), EBits.BITS_8), + } + }, + new List> + { + new List + { + new LevelConstants.RandoLevel(ELevel.Level_09_A_GlacialPeak, new Vector3(220.6f, -67)), }, - new List> - { - new List - { - new LevelConstants.RandoLevel(ELevel.Level_08_SearingCrags, new Vector3(384.5f, 135f)), - }, - new List - { - new LevelConstants.RandoLevel(ELevel.Level_08_SearingCrags, new Vector3(61, -27)), - new LevelConstants.RandoLevel(ELevel.Level_08_SearingCrags, new Vector3(147.5f, 69)), - new LevelConstants.RandoLevel(ELevel.Level_08_SearingCrags, new Vector3(226.5f, 151)), - new LevelConstants.RandoLevel(ELevel.Level_08_SearingCrags, new Vector3(282, 237)), - new LevelConstants.RandoLevel(ELevel.Level_08_SearingCrags, new Vector3(380.5f, 309)), - new LevelConstants.RandoLevel(ELevel.Level_08_SearingCrags, new Vector3(119.5f, 248), EBits.BITS_8), - }, - new List - { - new LevelConstants.RandoLevel(ELevel.Level_08_SearingCrags, new Vector3(109.5f, 63)), - new LevelConstants.RandoLevel(ELevel.Level_08_SearingCrags, new Vector3(296.5f, 189f), EBits.BITS_8), - } + new List + { + new LevelConstants.RandoLevel(ELevel.Level_09_A_GlacialPeak, new Vector3(216.5f, -456)), + new LevelConstants.RandoLevel(ELevel.Level_09_A_GlacialPeak, new Vector3(259.5f, -297)), + new LevelConstants.RandoLevel(ELevel.Level_09_A_GlacialPeak, new Vector3(156.5f, -27)), }, - new List> - { - new List - { - new LevelConstants.RandoLevel(ELevel.Level_09_A_GlacialPeak, new Vector3(220.6f, -67)), - }, - new List - { - new LevelConstants.RandoLevel(ELevel.Level_09_A_GlacialPeak, new Vector3(216.5f, -456)), - new LevelConstants.RandoLevel(ELevel.Level_09_A_GlacialPeak, new Vector3(259.5f, -297)), - new LevelConstants.RandoLevel(ELevel.Level_09_A_GlacialPeak, new Vector3(156.5f, -27)), - }, - new List - { - new LevelConstants.RandoLevel(ELevel.Level_09_A_GlacialPeak, new Vector3(227.5f, -405)), - new LevelConstants.RandoLevel(ELevel.Level_09_A_GlacialPeak, new Vector3(251.5f, -235)), - new LevelConstants.RandoLevel(ELevel.Level_09_A_GlacialPeak, new Vector3(195.5f, -131)), - } + new List + { + new LevelConstants.RandoLevel(ELevel.Level_09_A_GlacialPeak, new Vector3(227.5f, -405)), + new LevelConstants.RandoLevel(ELevel.Level_09_A_GlacialPeak, new Vector3(251.5f, -235)), + new LevelConstants.RandoLevel(ELevel.Level_09_A_GlacialPeak, new Vector3(195.5f, -131)), + } + }, + new List> + { + new List(), + new List + { + new LevelConstants.RandoLevel(ELevel.Level_10_A_TowerOfTime, new Vector3(71.5f, -11), EBits.BITS_8), + new LevelConstants.RandoLevel(ELevel.Level_10_A_TowerOfTime, new Vector3(84.5f, 237), EBits.BITS_8), }, - new List> - { - new List(), - new List - { - new LevelConstants.RandoLevel(ELevel.Level_10_A_TowerOfTime, new Vector3(71.5f, -11), EBits.BITS_8), - new LevelConstants.RandoLevel(ELevel.Level_10_A_TowerOfTime, new Vector3(84.5f, 237), EBits.BITS_8), - }, - new List - { - new LevelConstants.RandoLevel(ELevel.Level_10_A_TowerOfTime, new Vector3(38.5f, 21.5f), EBits.BITS_8), - new LevelConstants.RandoLevel(ELevel.Level_10_A_TowerOfTime, new Vector3(5.5f, 37), EBits.BITS_8), - new LevelConstants.RandoLevel(ELevel.Level_10_A_TowerOfTime, new Vector3(50.5f, 77), EBits.BITS_8), - new LevelConstants.RandoLevel(ELevel.Level_10_A_TowerOfTime, new Vector3(57.5f, 85), EBits.BITS_8), - new LevelConstants.RandoLevel(ELevel.Level_10_A_TowerOfTime, new Vector3(31.5f, 133), EBits.BITS_8), - new LevelConstants.RandoLevel(ELevel.Level_10_A_TowerOfTime, new Vector3(58.5f, 165), EBits.BITS_8), - } + new List + { + new LevelConstants.RandoLevel(ELevel.Level_10_A_TowerOfTime, new Vector3(38.5f, 21.5f), EBits.BITS_8), + new LevelConstants.RandoLevel(ELevel.Level_10_A_TowerOfTime, new Vector3(5.5f, 37), EBits.BITS_8), + new LevelConstants.RandoLevel(ELevel.Level_10_A_TowerOfTime, new Vector3(50.5f, 77), EBits.BITS_8), + new LevelConstants.RandoLevel(ELevel.Level_10_A_TowerOfTime, new Vector3(57.5f, 85), EBits.BITS_8), + new LevelConstants.RandoLevel(ELevel.Level_10_A_TowerOfTime, new Vector3(31.5f, 133), EBits.BITS_8), + new LevelConstants.RandoLevel(ELevel.Level_10_A_TowerOfTime, new Vector3(58.5f, 165), EBits.BITS_8), + } + }, + new List> + { + new List(), + new List + { + new LevelConstants.RandoLevel(ELevel.Level_11_A_CloudRuins, new Vector3(-368.5f, -26), EBits.BITS_8), + new LevelConstants.RandoLevel(ELevel.Level_11_A_CloudRuins, new Vector3(-140.5f, -26), EBits.BITS_8), + new LevelConstants.RandoLevel(ELevel.Level_11_A_CloudRuins, new Vector3(116.5f, -25)), + new LevelConstants.RandoLevel(ELevel.Level_11_A_CloudRuins, new Vector3(366.5f, -27), EBits.BITS_8), + new LevelConstants.RandoLevel(ELevel.Level_11_A_CloudRuins, new Vector3(721.5f, -22), EBits.BITS_8), + new LevelConstants.RandoLevel(ELevel.Level_11_A_CloudRuins, new Vector3(816.5f, -26), EBits.BITS_8), + new LevelConstants.RandoLevel(ELevel.Level_11_A_CloudRuins, new Vector3(1148.5f, -27), EBits.BITS_8), }, - new List> - { - new List(), - new List - { - new LevelConstants.RandoLevel(ELevel.Level_11_A_CloudRuins, new Vector3(-368.5f, -26), EBits.BITS_8), - new LevelConstants.RandoLevel(ELevel.Level_11_A_CloudRuins, new Vector3(-140.5f, -26), EBits.BITS_8), - new LevelConstants.RandoLevel(ELevel.Level_11_A_CloudRuins, new Vector3(116.5f, -25)), - new LevelConstants.RandoLevel(ELevel.Level_11_A_CloudRuins, new Vector3(366.5f, -27), EBits.BITS_8), - new LevelConstants.RandoLevel(ELevel.Level_11_A_CloudRuins, new Vector3(721.5f, -22), EBits.BITS_8), - new LevelConstants.RandoLevel(ELevel.Level_11_A_CloudRuins, new Vector3(816.5f, -26), EBits.BITS_8), - new LevelConstants.RandoLevel(ELevel.Level_11_A_CloudRuins, new Vector3(1148.5f, -27), EBits.BITS_8), - }, - new List - { - new LevelConstants.RandoLevel(ELevel.Level_11_A_CloudRuins, new Vector3(-146, 24), EBits.BITS_8), - new LevelConstants.RandoLevel(ELevel.Level_11_A_CloudRuins, new Vector3(164, -21)), - new LevelConstants.RandoLevel(ELevel.Level_11_A_CloudRuins, new Vector3(769.5f, -26)), - new LevelConstants.RandoLevel(ELevel.Level_11_A_CloudRuins, new Vector3(-251, 13)), - } + new List + { + new LevelConstants.RandoLevel(ELevel.Level_11_A_CloudRuins, new Vector3(-146, 24), EBits.BITS_8), + new LevelConstants.RandoLevel(ELevel.Level_11_A_CloudRuins, new Vector3(164, -21)), + new LevelConstants.RandoLevel(ELevel.Level_11_A_CloudRuins, new Vector3(769.5f, -26)), + new LevelConstants.RandoLevel(ELevel.Level_11_A_CloudRuins, new Vector3(-251, 13)), + } + }, + new List> + { + new List(), + new List + { + new LevelConstants.RandoLevel(ELevel.Level_12_UnderWorld, new Vector3(-305, -51), EBits.BITS_8), + new LevelConstants.RandoLevel(ELevel.Level_12_UnderWorld, new Vector3(-186.5f, -24), EBits.BITS_8), + new LevelConstants.RandoLevel(ELevel.Level_12_UnderWorld, new Vector3(-125.5f, -91), EBits.BITS_8), + //new LevelConstants.RandoLevel(ELevel.Level_12_UnderWorld, new Vector3(124.5f, -43)), // barm'athazel which isn't accessible in second quest + new LevelConstants.RandoLevel(ELevel.Level_12_UnderWorld, new Vector3(132.5f, -130)), }, - new List> - { - new List(), - new List - { - new LevelConstants.RandoLevel(ELevel.Level_12_UnderWorld, new Vector3(-305, -51), EBits.BITS_8), - new LevelConstants.RandoLevel(ELevel.Level_12_UnderWorld, new Vector3(-186.5f, -24), EBits.BITS_8), - new LevelConstants.RandoLevel(ELevel.Level_12_UnderWorld, new Vector3(-125.5f, -91), EBits.BITS_8), - //new LevelConstants.RandoLevel(ELevel.Level_12_UnderWorld, new Vector3(124.5f, -43)), // barm'athazel which isn't accessible in second quest - new LevelConstants.RandoLevel(ELevel.Level_12_UnderWorld, new Vector3(132.5f, -130)), - }, - new List - { - new LevelConstants.RandoLevel(ELevel.Level_12_UnderWorld, new Vector3(-226.5f, -89), EBits.BITS_8), - new LevelConstants.RandoLevel(ELevel.Level_12_UnderWorld, new Vector3(0.5f, 72), EBits.BITS_8), - new LevelConstants.RandoLevel(ELevel.Level_12_UnderWorld, new Vector3(-110.5f, -98), EBits.BITS_8), - } + new List + { + new LevelConstants.RandoLevel(ELevel.Level_12_UnderWorld, new Vector3(-226.5f, -89), EBits.BITS_8), + new LevelConstants.RandoLevel(ELevel.Level_12_UnderWorld, new Vector3(0.5f, 72), EBits.BITS_8), + new LevelConstants.RandoLevel(ELevel.Level_12_UnderWorld, new Vector3(-110.5f, -98), EBits.BITS_8), + } + }, + new List> + { + new List + { + new LevelConstants.RandoLevel(ELevel.Level_04_C_RiviereTurquoise, new Vector3(837, 13.5f)), }, - new List> - { - new List - { - new LevelConstants.RandoLevel(ELevel.Level_04_C_RiviereTurquoise, new Vector3(837, 13.5f)), - }, - new List - { - new LevelConstants.RandoLevel(ELevel.Level_04_C_RiviereTurquoise, new Vector3(804.5f, -40)), - new LevelConstants.RandoLevel(ELevel.Level_04_C_RiviereTurquoise, new Vector3(499, -132), EBits.BITS_8), - new LevelConstants.RandoLevel(ELevel.Level_04_C_RiviereTurquoise, new Vector3(337.5f, -131)), - new LevelConstants.RandoLevel(ELevel.Level_04_C_RiviereTurquoise, new Vector3(149.5f, -89)), - new LevelConstants.RandoLevel(ELevel.Level_04_C_RiviereTurquoise, new Vector3(-8.5f, 13)), - new LevelConstants.RandoLevel(ELevel.Level_04_C_RiviereTurquoise, new Vector3(-259, 7)), - }, - new List - { - new LevelConstants.RandoLevel(ELevel.Level_04_C_RiviereTurquoise, new Vector3(648.5f, -83), EBits.BITS_8), - } + new List + { + new LevelConstants.RandoLevel(ELevel.Level_04_C_RiviereTurquoise, new Vector3(804.5f, -40)), + new LevelConstants.RandoLevel(ELevel.Level_04_C_RiviereTurquoise, new Vector3(499, -132), EBits.BITS_8), + new LevelConstants.RandoLevel(ELevel.Level_04_C_RiviereTurquoise, new Vector3(337.5f, -131)), + new LevelConstants.RandoLevel(ELevel.Level_04_C_RiviereTurquoise, new Vector3(149.5f, -89)), + new LevelConstants.RandoLevel(ELevel.Level_04_C_RiviereTurquoise, new Vector3(-8.5f, 13)), + new LevelConstants.RandoLevel(ELevel.Level_04_C_RiviereTurquoise, new Vector3(-259, 7)), }, - new List> - { - new List(), - new List - { - new LevelConstants.RandoLevel(ELevel.Level_09_B_ElementalSkylands, new Vector3(-35, 359)), - new LevelConstants.RandoLevel(ELevel.Level_09_B_ElementalSkylands, new Vector3(87.5f, 407)), - new LevelConstants.RandoLevel(ELevel.Level_09_B_ElementalSkylands, new Vector3(864.5f, 381)), - new LevelConstants.RandoLevel(ELevel.Level_09_B_ElementalSkylands, new Vector3(966.3f, 409.4f)), - new LevelConstants.RandoLevel(ELevel.Level_09_B_ElementalSkylands, new Vector3(1763.5f, 381)), - new LevelConstants.RandoLevel(ELevel.Level_09_B_ElementalSkylands, new Vector3(1909, 411)), - new LevelConstants.RandoLevel(ELevel.Level_09_B_ElementalSkylands, new Vector3(2755.5f, 376), EBits.BITS_8), - new LevelConstants.RandoLevel(ELevel.Level_09_B_ElementalSkylands, new Vector3(2926.5f, 406)), - }, - new List - { - new LevelConstants.RandoLevel(ELevel.Level_09_B_ElementalSkylands, new Vector3(-22.5f, 417)), - } + new List + { + new LevelConstants.RandoLevel(ELevel.Level_04_C_RiviereTurquoise, new Vector3(648.5f, -83), EBits.BITS_8), + } + }, + new List> + { + new List(), + new List + { + new LevelConstants.RandoLevel(ELevel.Level_09_B_ElementalSkylands, new Vector3(-35, 359)), + new LevelConstants.RandoLevel(ELevel.Level_09_B_ElementalSkylands, new Vector3(87.5f, 407)), + new LevelConstants.RandoLevel(ELevel.Level_09_B_ElementalSkylands, new Vector3(864.5f, 381)), + new LevelConstants.RandoLevel(ELevel.Level_09_B_ElementalSkylands, new Vector3(966.3f, 409.4f)), + new LevelConstants.RandoLevel(ELevel.Level_09_B_ElementalSkylands, new Vector3(1763.5f, 381)), + new LevelConstants.RandoLevel(ELevel.Level_09_B_ElementalSkylands, new Vector3(1909, 411)), + new LevelConstants.RandoLevel(ELevel.Level_09_B_ElementalSkylands, new Vector3(2755.5f, 376), EBits.BITS_8), + new LevelConstants.RandoLevel(ELevel.Level_09_B_ElementalSkylands, new Vector3(2926.5f, 406)), }, - new List> - { - new List - { - new LevelConstants.RandoLevel(ELevel.Level_05_B_SunkenShrine, new Vector3(29f, -55f)), - }, - new List - { - new LevelConstants.RandoLevel(ELevel.Level_05_B_SunkenShrine, new Vector3(36.5f, -41)), - new LevelConstants.RandoLevel(ELevel.Level_05_B_SunkenShrine, new Vector3(186.5f, -9), EBits.BITS_8), - new LevelConstants.RandoLevel(ELevel.Level_05_B_SunkenShrine, new Vector3(8, -65), EBits.BITS_8), - new LevelConstants.RandoLevel(ELevel.Level_05_B_SunkenShrine, new Vector3(-102.5f, -121), EBits.BITS_8), - new LevelConstants.RandoLevel(ELevel.Level_05_B_SunkenShrine, new Vector3(100, -81), EBits.BITS_8), - }, - new List - { - new LevelConstants.RandoLevel(ELevel.Level_05_B_SunkenShrine, new Vector3(53.5f, -25), EBits.BITS_8), - new LevelConstants.RandoLevel(ELevel.Level_05_B_SunkenShrine, new Vector3(29.5f, -87), EBits.BITS_8), - new LevelConstants.RandoLevel(ELevel.Level_05_B_SunkenShrine, new Vector3(166, -178), EBits.BITS_8), - new LevelConstants.RandoLevel(ELevel.Level_05_B_SunkenShrine, new Vector3(92.5f, -100), EBits.BITS_8), - } + new List + { + new LevelConstants.RandoLevel(ELevel.Level_09_B_ElementalSkylands, new Vector3(-22.5f, 417)), } - }; - - private static readonly List Portals = new List - { - "Autumn Hills - Portal", - "Riviere Turquoise - Portal", - "Howling Grotto - Portal", - "Sunken Shrine - Portal", - "Searing Crags - Portal", - "Glacial Peak - Portal", + }, + new List> + { + new List + { + new LevelConstants.RandoLevel(ELevel.Level_05_B_SunkenShrine, new Vector3(29f, -55f)), + }, + new List + { + new LevelConstants.RandoLevel(ELevel.Level_05_B_SunkenShrine, new Vector3(36.5f, -41)), + new LevelConstants.RandoLevel(ELevel.Level_05_B_SunkenShrine, new Vector3(186.5f, -9), EBits.BITS_8), + new LevelConstants.RandoLevel(ELevel.Level_05_B_SunkenShrine, new Vector3(8, -65), EBits.BITS_8), + new LevelConstants.RandoLevel(ELevel.Level_05_B_SunkenShrine, new Vector3(-102.5f, -121), EBits.BITS_8), + new LevelConstants.RandoLevel(ELevel.Level_05_B_SunkenShrine, new Vector3(100, -81), EBits.BITS_8), + }, + new List + { + new LevelConstants.RandoLevel(ELevel.Level_05_B_SunkenShrine, new Vector3(53.5f, -25), EBits.BITS_8), + new LevelConstants.RandoLevel(ELevel.Level_05_B_SunkenShrine, new Vector3(29.5f, -87), EBits.BITS_8), + new LevelConstants.RandoLevel(ELevel.Level_05_B_SunkenShrine, new Vector3(166, -178), EBits.BITS_8), + new LevelConstants.RandoLevel(ELevel.Level_05_B_SunkenShrine, new Vector3(92.5f, -100), EBits.BITS_8), + } + } }; - private static readonly List AccessedStartingPortals = new List(); + private static readonly List Portals = new List + { + "Autumn Hills - Portal", + "Riviere Turquoise - Portal", + "Howling Grotto - Portal", + "Sunken Shrine - Portal", + "Searing Crags - Portal", + "Glacial Peak - Portal", + }; + + private static readonly List AccessedStartingPortals = new List(); - public static HashSet UnlockedPortals + public static HashSet UnlockedPortals + { + get { - get + var unlockedPortals = new HashSet(); + + var progressManager = Manager.Instance; + if (progressManager.cutscenesPlayed.Contains("PortalOpeningCutscene")) { - var unlockedPortals = new HashSet(); + unlockedPortals.Add("Autumn Hills Portal"); + unlockedPortals.Add("Howling Grotto Portal"); + unlockedPortals.Add("Glacial Peak Portal"); + } + if (progressManager.cutscenesPlayed.Contains("SunkenShrinePortalOpeningCutscene")) + { + unlockedPortals.Add("Sunken Shrine Portal"); + } + if (progressManager.cutscenesPlayed.Contains("SearingCragsPortalOpeningCutscene")) + { + unlockedPortals.Add("Searing Crags Portal"); + } + if (progressManager.cutscenesPlayed.Contains("RiviereTurquoisePortalOpeningCutscene")) + { + unlockedPortals.Add("Riviere Turquoise Portal"); + } - var progressManager = Manager.Instance; - if (progressManager.cutscenesPlayed.Contains("PortalOpeningCutscene")) - { - unlockedPortals.Add("Autumn Hills Portal"); - unlockedPortals.Add("Howling Grotto Portal"); - unlockedPortals.Add("Glacial Peak Portal"); - } - if (progressManager.cutscenesPlayed.Contains("SunkenShrinePortalOpeningCutscene")) + return unlockedPortals; + } + } + + private static bool PortalShuffleEnabled => PortalMapping is not null && PortalMapping.Count > 0; + + + public static bool ShouldPortalBeOpen(string portal) + { + return AccessedStartingPortals.Contains(portal); + } + + public static void OpenPortalEvent(On.PortalOpeningCutscene.orig_OnOpenPortalEvent orig, + PortalOpeningCutscene self, string eventid) + { + switch (eventid) + { + case "AutumnHills": + if (StartingPortals.Contains("Autumn Hills Portal")) { - unlockedPortals.Add("Sunken Shrine Portal"); + orig(self, eventid); + AccessedStartingPortals.Add(eventid); } - if (progressManager.cutscenesPlayed.Contains("SearingCragsPortalOpeningCutscene")) + break; + case "HowlingGrotto": + if (StartingPortals.Contains("Howling Grotto Portal")) { - unlockedPortals.Add("Searing Crags Portal"); + orig(self, eventid); + AccessedStartingPortals.Add(eventid); } - if (progressManager.cutscenesPlayed.Contains("RiviereTurquoisePortalOpeningCutscene")) + break; + case "GlacialPeak": + if (StartingPortals.Contains("Glacial Peak Portal")) { - unlockedPortals.Add("Riviere Turquoise Portal"); + orig(self, eventid); + AccessedStartingPortals.Add(eventid); } - - return unlockedPortals; - } + break; + default: + orig(self, eventid); + break; } + } - public static bool ShouldPortalBeOpen(string portal) + private static LevelConstants.RandoLevel GetPortalExit(string enteredPortal) + { + Console.WriteLine($"getting portal. entered {enteredPortal}"); + var portalExit = PortalMapping[Portals.IndexOf(enteredPortal)]; + Console.WriteLine($"{portalExit.Region}, {portalExit.PortalType}, {portalExit.Index}"); + return AreaCheckpoints[portalExit.Region][portalExit.PortalType][portalExit.Index]; + } + + public static void Teleport() + { + var currentLevel = Manager.Instance.GetCurrentLevelEnum(); + if (!LevelConstants.TransitionToEntranceName.TryGetValue( + new LevelConstants.Transition(ELevel.Level_13_TowerOfTimeHQ, + currentLevel), out var portal)) { - return AccessedStartingPortals.Contains(portal); + Console.WriteLine($"unable to find portal for {currentLevel}"); } - - public static void OpenPortalEvent(On.PortalOpeningCutscene.orig_OnOpenPortalEvent orig, - PortalOpeningCutscene self, string eventid) + else { - switch (eventid) + if (portal.Equals("Tower of Time - Left") || portal.Equals("Corrupted Future")) { - case "AutumnHills": - if (StartingPortals.Contains("Autumn Hills Portal")) - { - orig(self, eventid); - AccessedStartingPortals.Add(eventid); - } - break; - case "HowlingGrotto": - if (StartingPortals.Contains("Howling Grotto Portal")) - { - orig(self, eventid); - AccessedStartingPortals.Add(eventid); - } - break; - case "GlacialPeak": - if (StartingPortals.Contains("Glacial Peak Portal")) - { - orig(self, eventid); - AccessedStartingPortals.Add(eventid); - } - break; - default: - orig(self, eventid); - break; + if (portal.Equals("Tower of Time - Left")) + EnteredTower = true; + LeftHQPortal = false; + var newLevel = RandoLevelManager.FindEntrance(); + if (RandoLevelManager.RandoLevelMapping != null && RandoLevelManager.RandoLevelMapping.Count > 0) + { + RandoLevelManager.TeleportInArea(newLevel.LevelName, newLevel.PlayerPos, newLevel.Dimension); + } + return; } - } - private static LevelConstants.RandoLevel GetPortalExit(string enteredPortal) - { - Console.WriteLine($"getting portal. entered {enteredPortal}"); - var portalExit = PortalMapping[Portals.IndexOf(enteredPortal)]; - Console.WriteLine($"{portalExit.Region}, {portalExit.PortalType}, {portalExit.Index}"); - return AreaCheckpoints[portalExit.Region][portalExit.PortalType][portalExit.Index]; - } - - public static void Teleport() - { - var currentLevel = Manager.Instance.GetCurrentLevelEnum(); - if (!LevelConstants.TransitionToEntranceName.TryGetValue( - new LevelConstants.Transition(ELevel.Level_13_TowerOfTimeHQ, - currentLevel), out var portal)) + if (!PortalShuffleEnabled) { - Console.WriteLine($"unable to find portal for {currentLevel}"); + LeftHQPortal = false; + return; } - else + try { - if (portal.Equals("Tower of Time - Left") || portal.Equals("Corrupted Future")) - { - if (portal.Equals("Tower of Time - Left")) - EnteredTower = true; - LeftHQPortal = false; - var newLevel = RandoLevelManager.FindEntrance(); - if (RandoLevelManager.RandoLevelMapping != null && RandoLevelManager.RandoLevelMapping.Count > 0) - { - RandoLevelManager.TeleportInArea(newLevel.LevelName, newLevel.PlayerPos, newLevel.Dimension); - } - return; - } - - if (PortalMapping is null || PortalMapping.Count == 0) + var newLevel = GetPortalExit(portal); + switch (newLevel.LevelName) { - LeftHQPortal = false; - return; + case ELevel.Level_09_B_ElementalSkylands: + RandoLevelManager.KillManfred = true; + break; + case ELevel.NONE: + LeftHQPortal = false; + return; } - try - { - var newLevel = GetPortalExit(portal); - switch (newLevel.LevelName) - { - case ELevel.Level_09_B_ElementalSkylands: - RandoLevelManager.KillManfred = true; - break; - case ELevel.NONE: - LeftHQPortal = false; - return; - } - TrackerManager.AddVisitedEntrance("HQ - " + portal.Replace("- ", "")); - RandoLevelManager.TeleportInArea(newLevel.LevelName, newLevel.PlayerPos, newLevel.Dimension); - } - catch (Exception e) - { - Console.WriteLine(e); - } + TrackerManager.AddVisitedEntrance("HQ - " + portal.Replace("- ", "")); + RandoLevelManager.TeleportInArea(newLevel.LevelName, newLevel.PlayerPos, newLevel.Dimension); + } + catch (Exception e) + { + Console.WriteLine(e); } - - LeftHQPortal = false; } - public static void LeaveHQ(On.TotHQ.orig_LeaveToLevel orig, TotHQ self, bool playLevelMusic, bool loadingNewLevel) + LeftHQPortal = false; + } + + public static void LeaveHQ(On.TotHQ.orig_LeaveToLevel orig, TotHQ self, bool playLevelMusic, bool loadingNewLevel) + { + Console.WriteLine("leaving hq..."); + LeftHQPortal = true; + ForceTeleport = !loadingNewLevel; + Console.WriteLine($"Force teleport: {ForceTeleport}"); + orig(self, playLevelMusic, loadingNewLevel); + } + + public static void TowerOfTimePortal_LoadLevel(On.TowerOfTimePortal.orig_LoadLevel orig, TowerOfTimePortal self) + { + try { - Console.WriteLine("leaving hq..."); - LeftHQPortal = true; - ForceTeleport = !loadingNewLevel; - Console.WriteLine($"Force teleport: {ForceTeleport}"); - orig(self, playLevelMusic, loadingNewLevel); + Console.WriteLine("Left ToT through portal."); + orig(self); + + if (!PortalShuffleEnabled) + { + TrackerManager.SetCurrentRegion(self.nextLevel); + return; + } + } + catch (Exception e) + { + Console.Write("Error in TowerOfTimePortal_LoadLevel"); + Console.WriteLine(e); } } + } diff --git a/Utils/RandomizerSaveMethod.cs b/Utils/RandomizerSaveMethod.cs deleted file mode 100644 index e69de29..0000000 From 936cdb33f37bc5d64f284a3a14887cdcedd2af95 Mon Sep 17 00:00:00 2001 From: Jouramie <16137441+Jouramie@users.noreply.github.com> Date: Sat, 18 Jul 2026 23:10:41 -0400 Subject: [PATCH 3/5] also replace hq in main --- APRandomizerMain.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/APRandomizerMain.cs b/APRandomizerMain.cs index 44446c7..cd1d763 100644 --- a/APRandomizerMain.cs +++ b/APRandomizerMain.cs @@ -701,7 +701,7 @@ public static void OnSelectTeleportToHq() RandoLevelManager.CleanupBeforeOptionsTeleport(); //Load the HQ Manager.Instance.TeleportInToTHQ(true, ELevelEntranceID.ENTRANCE_A, null); - ArchipelagoClient.Session.DataStorage[Scope.Slot, "CurrentRegion"] = ELevel.Level_13_TowerOfTimeHQ.ToString(); + RandoLevelManager.TrackerManager.SetCurrentRegion(ELevel.Level_13_TowerOfTimeHQ); RandoLevelManager.CleanupAfterTeleport(); } From 0e28a67ddd8bad7ce2c659a5ff08ca9ad5768163 Mon Sep 17 00:00:00 2001 From: Jouramie <16137441+Jouramie@users.noreply.github.com> Date: Sun, 26 Jul 2026 10:32:53 -0400 Subject: [PATCH 4/5] switch back to namespace block to make diff easier to handle --- Archipelago/TrackerManager.cs | 63 +- GameOverrideManagers/RandoPortalManager.cs | 841 +++++++++++---------- 2 files changed, 453 insertions(+), 451 deletions(-) diff --git a/Archipelago/TrackerManager.cs b/Archipelago/TrackerManager.cs index 9004100..dd7055c 100644 --- a/Archipelago/TrackerManager.cs +++ b/Archipelago/TrackerManager.cs @@ -4,47 +4,48 @@ using Archipelago.MultiClient.Net.Enums; using MessengerRando.GameOverrideManagers; -namespace MessengerRando.Archipelago; - -public class TrackerManager +namespace MessengerRando.Archipelago { + public class TrackerManager + { - private List VisitedEntrances = []; + private List VisitedEntrances = []; - public void AddVisitedEntrance(string entrance) - { - if (VisitedEntrances.Contains(entrance)) return; + public void AddVisitedEntrance(string entrance) + { + if (VisitedEntrances.Contains(entrance)) return; - if (!ArchipelagoClient.Authenticated) return; - VisitedEntrances = ArchipelagoClient.Session.DataStorage[Scope.Slot, "VisitedEntrances"].To>() ?? []; - if (VisitedEntrances.Contains(entrance)) return; + if (!ArchipelagoClient.Authenticated) return; + VisitedEntrances = ArchipelagoClient.Session.DataStorage[Scope.Slot, "VisitedEntrances"].To>() ?? []; + if (VisitedEntrances.Contains(entrance)) return; - Console.WriteLine("Adding visited entrance: " + entrance); - VisitedEntrances.Add(entrance); - VisitedEntrances.Sort(); - ArchipelagoClient.Session.DataStorage[Scope.Slot, "VisitedEntrances"] = VisitedEntrances; + Console.WriteLine("Adding visited entrance: " + entrance); + VisitedEntrances.Add(entrance); + VisitedEntrances.Sort(); + ArchipelagoClient.Session.DataStorage[Scope.Slot, "VisitedEntrances"] = VisitedEntrances; - return; - } + return; + } - public void ReconciliateUnlockedPortals() - { - if (!ArchipelagoClient.Authenticated) return; + public void ReconciliateUnlockedPortals() + { + if (!ArchipelagoClient.Authenticated) return; - var unlockedPortals = RandoPortalManager.UnlockedPortals; - unlockedPortals.UnionWith(ArchipelagoClient.Session.DataStorage[Scope.Slot, "UnlockedPortals"].To>() ?? []); - if (unlockedPortals.Count == 0) return; + var unlockedPortals = RandoPortalManager.UnlockedPortals; + unlockedPortals.UnionWith(ArchipelagoClient.Session.DataStorage[Scope.Slot, "UnlockedPortals"].To>() ?? []); + if (unlockedPortals.Count == 0) return; - var unlockedPortalsList = unlockedPortals.ToList(); - unlockedPortalsList.Sort(); - Console.WriteLine($"Updating unlocked portals with Data Storage. Unlocked portals are\n\t{string.Join("\n\t", [.. unlockedPortalsList])}"); - ArchipelagoClient.Session.DataStorage[Scope.Slot, "UnlockedPortals"] = unlockedPortalsList; - } + var unlockedPortalsList = unlockedPortals.ToList(); + unlockedPortalsList.Sort(); + Console.WriteLine($"Updating unlocked portals with Data Storage. Unlocked portals are\n\t{string.Join("\n\t", [.. unlockedPortalsList])}"); + ArchipelagoClient.Session.DataStorage[Scope.Slot, "UnlockedPortals"] = unlockedPortalsList; + } - public void SetCurrentRegion(ELevel level) - { - if (!ArchipelagoClient.Authenticated) return; - ArchipelagoClient.Session.DataStorage[Scope.Slot, "CurrentRegion"] = level.ToString(); + public void SetCurrentRegion(ELevel level) + { + if (!ArchipelagoClient.Authenticated) return; + ArchipelagoClient.Session.DataStorage[Scope.Slot, "CurrentRegion"] = level.ToString(); + } } } diff --git a/GameOverrideManagers/RandoPortalManager.cs b/GameOverrideManagers/RandoPortalManager.cs index 6ad0ec7..934f188 100644 --- a/GameOverrideManagers/RandoPortalManager.cs +++ b/GameOverrideManagers/RandoPortalManager.cs @@ -4,492 +4,493 @@ using MessengerRando.Utils.Constants; using UnityEngine; -namespace MessengerRando.GameOverrideManagers; - -public static class RandoPortalManager +namespace MessengerRando.GameOverrideManagers { - public readonly struct Portal + public static class RandoPortalManager { - public readonly int Region; - public readonly int PortalType; - public readonly int Index; - - public Portal(int portalWarp) + public readonly struct Portal { - var modWarp = portalWarp.ToString(); - if (modWarp.Length == 4) - { - Region = int.Parse(modWarp.Substring(0, 2)); - PortalType = int.Parse(modWarp[2].ToString()); - Index = int.Parse(modWarp[3].ToString()); - } - else if (modWarp.Length == 3) - { - Region = int.Parse(modWarp[0].ToString()); - PortalType = int.Parse(modWarp[1].ToString()); - Index = int.Parse(modWarp[2].ToString()); - } - else if (modWarp.Length == 2) - { - Region = 0; - PortalType = int.Parse(modWarp[0].ToString()); - Index = int.Parse(modWarp[1].ToString()); - } - else - { - Region = 0; - PortalType = 0; - Index = int.Parse(modWarp); - } - } - } + public readonly int Region; + public readonly int PortalType; + public readonly int Index; - public static bool LeftHQPortal; - public static bool ForceTeleport; - public static bool EnteredTower; - public static List StartingPortals; - public static List PortalMapping; - public static TrackerManager TrackerManager; - - static readonly List>> AreaCheckpoints = - new List>> - { - new List> + public Portal(int portalWarp) { - new List - { - new LevelConstants.RandoLevel(ELevel.Level_02_AutumnHills, new Vector3(485, -102)), - }, - new List - { - new LevelConstants.RandoLevel(ELevel.Level_02_AutumnHills, new Vector3(-45.5f, -89)), - new LevelConstants.RandoLevel(ELevel.Level_02_AutumnHills, new Vector3(68.5f, -111)), - new LevelConstants.RandoLevel(ELevel.Level_02_AutumnHills, new Vector3(407.5f, -74)), - new LevelConstants.RandoLevel(ELevel.Level_02_AutumnHills, new Vector3(892.5f, -27)), - }, - new List + var modWarp = portalWarp.ToString(); + if (modWarp.Length == 4) { - new LevelConstants.RandoLevel(ELevel.Level_02_AutumnHills, new Vector3(175, -148)), - new LevelConstants.RandoLevel(ELevel.Level_02_AutumnHills, new Vector3(91.5f, -87)), - new LevelConstants.RandoLevel(ELevel.Level_02_AutumnHills, new Vector3(238.5f, -74)), - new LevelConstants.RandoLevel(ELevel.Level_02_AutumnHills, new Vector3(607.48f, -35)), - new LevelConstants.RandoLevel(ELevel.Level_02_AutumnHills, new Vector3(718.5f, -73), EBits.BITS_8), + Region = int.Parse(modWarp.Substring(0, 2)); + PortalType = int.Parse(modWarp[2].ToString()); + Index = int.Parse(modWarp[3].ToString()); } - }, - new List> - { - new List(), - new List - { - new LevelConstants.RandoLevel(ELevel.Level_03_ForlornTemple, new Vector3(0.5f, -11)), - new LevelConstants.RandoLevel(ELevel.Level_03_ForlornTemple, new Vector3(88.5f, -10)), - new LevelConstants.RandoLevel(ELevel.Level_03_ForlornTemple, new Vector3(251.5f, 53)), - new LevelConstants.RandoLevel(ELevel.Level_03_ForlornTemple, new Vector3(156, 85)), - new LevelConstants.RandoLevel(ELevel.Level_03_ForlornTemple, new Vector3(271.5f, 61)), - new LevelConstants.RandoLevel(ELevel.Level_03_ForlornTemple, new Vector3(347.5f, 31)), - new LevelConstants.RandoLevel(ELevel.Level_03_ForlornTemple, new Vector3(354.5f, -11)), - }, - new List + else if (modWarp.Length == 3) { - new LevelConstants.RandoLevel(ELevel.Level_03_ForlornTemple, new Vector3(124.5f, 47)), - new LevelConstants.RandoLevel(ELevel.Level_03_ForlornTemple, new Vector3(260.5f, 24)), + Region = int.Parse(modWarp[0].ToString()); + PortalType = int.Parse(modWarp[1].ToString()); + Index = int.Parse(modWarp[2].ToString()); } - }, - new List> - { - new List(), - new List + else if (modWarp.Length == 2) { - new LevelConstants.RandoLevel(ELevel.Level_04_Catacombs, new Vector3(241.5f, -25)), - new LevelConstants.RandoLevel(ELevel.Level_04_Catacombs, new Vector3(731.5f, -75)), - }, - new List - { - new LevelConstants.RandoLevel(ELevel.Level_04_Catacombs, new Vector3(379.5f, -23)), - new LevelConstants.RandoLevel(ELevel.Level_04_Catacombs, new Vector3(529.5f, -75), EBits.BITS_16), - new LevelConstants.RandoLevel(ELevel.Level_04_Catacombs, new Vector3(499.5f, -43)), + Region = 0; + PortalType = int.Parse(modWarp[0].ToString()); + Index = int.Parse(modWarp[1].ToString()); } - }, - new List> - { - new List(), - new List - { - new LevelConstants.RandoLevel(ELevel.Level_06_A_BambooCreek, new Vector3(-28.5f, -19)), - new LevelConstants.RandoLevel(ELevel.Level_06_A_BambooCreek, new Vector3(92.5f, 25)), - new LevelConstants.RandoLevel(ELevel.Level_06_A_BambooCreek, new Vector3(379.5f, 25)), - }, - new List + else { - new LevelConstants.RandoLevel(ELevel.Level_06_A_BambooCreek, new Vector3(227.5f, -41)), - new LevelConstants.RandoLevel(ELevel.Level_06_A_BambooCreek, new Vector3(210.5f, 29)), + Region = 0; + PortalType = 0; + Index = int.Parse(modWarp); } - }, - new List> + } + } + + public static bool LeftHQPortal; + public static bool ForceTeleport; + public static bool EnteredTower; + public static List StartingPortals; + public static List PortalMapping; + public static TrackerManager TrackerManager; + + static readonly List>> AreaCheckpoints = + new List>> { - new List - { - new LevelConstants.RandoLevel(ELevel.Level_05_A_HowlingGrotto, new Vector3(241f, -196f)), + new List> + { + new List + { + new LevelConstants.RandoLevel(ELevel.Level_02_AutumnHills, new Vector3(485, -102)), + }, + new List + { + new LevelConstants.RandoLevel(ELevel.Level_02_AutumnHills, new Vector3(-45.5f, -89)), + new LevelConstants.RandoLevel(ELevel.Level_02_AutumnHills, new Vector3(68.5f, -111)), + new LevelConstants.RandoLevel(ELevel.Level_02_AutumnHills, new Vector3(407.5f, -74)), + new LevelConstants.RandoLevel(ELevel.Level_02_AutumnHills, new Vector3(892.5f, -27)), + }, + new List + { + new LevelConstants.RandoLevel(ELevel.Level_02_AutumnHills, new Vector3(175, -148)), + new LevelConstants.RandoLevel(ELevel.Level_02_AutumnHills, new Vector3(91.5f, -87)), + new LevelConstants.RandoLevel(ELevel.Level_02_AutumnHills, new Vector3(238.5f, -74)), + new LevelConstants.RandoLevel(ELevel.Level_02_AutumnHills, new Vector3(607.48f, -35)), + new LevelConstants.RandoLevel(ELevel.Level_02_AutumnHills, new Vector3(718.5f, -73), EBits.BITS_8), + } }, - new List - { - new LevelConstants.RandoLevel(ELevel.Level_05_A_HowlingGrotto, new Vector3(26.5f, -27)), - new LevelConstants.RandoLevel(ELevel.Level_05_A_HowlingGrotto, new Vector3(310.5f, -115)), - new LevelConstants.RandoLevel(ELevel.Level_05_A_HowlingGrotto, new Vector3(541.5f, -123)), + new List> + { + new List(), + new List + { + new LevelConstants.RandoLevel(ELevel.Level_03_ForlornTemple, new Vector3(0.5f, -11)), + new LevelConstants.RandoLevel(ELevel.Level_03_ForlornTemple, new Vector3(88.5f, -10)), + new LevelConstants.RandoLevel(ELevel.Level_03_ForlornTemple, new Vector3(251.5f, 53)), + new LevelConstants.RandoLevel(ELevel.Level_03_ForlornTemple, new Vector3(156, 85)), + new LevelConstants.RandoLevel(ELevel.Level_03_ForlornTemple, new Vector3(271.5f, 61)), + new LevelConstants.RandoLevel(ELevel.Level_03_ForlornTemple, new Vector3(347.5f, 31)), + new LevelConstants.RandoLevel(ELevel.Level_03_ForlornTemple, new Vector3(354.5f, -11)), + }, + new List + { + new LevelConstants.RandoLevel(ELevel.Level_03_ForlornTemple, new Vector3(124.5f, 47)), + new LevelConstants.RandoLevel(ELevel.Level_03_ForlornTemple, new Vector3(260.5f, 24)), + } }, - new List - { - new LevelConstants.RandoLevel(ELevel.Level_05_A_HowlingGrotto, new Vector3(138.5f, -90)), - new LevelConstants.RandoLevel(ELevel.Level_05_A_HowlingGrotto, new Vector3(439, -170)), - } - }, - new List> - { - new List(), - new List - { - new LevelConstants.RandoLevel(ELevel.Level_07_QuillshroomMarsh, new Vector3(193.5f, -37)), - new LevelConstants.RandoLevel(ELevel.Level_07_QuillshroomMarsh, new Vector3(663.5f, -27)), - new LevelConstants.RandoLevel(ELevel.Level_07_QuillshroomMarsh, new Vector3(1085.5f, -43)), + new List> + { + new List(), + new List + { + new LevelConstants.RandoLevel(ELevel.Level_04_Catacombs, new Vector3(241.5f, -25)), + new LevelConstants.RandoLevel(ELevel.Level_04_Catacombs, new Vector3(731.5f, -75)), + }, + new List + { + new LevelConstants.RandoLevel(ELevel.Level_04_Catacombs, new Vector3(379.5f, -23)), + new LevelConstants.RandoLevel(ELevel.Level_04_Catacombs, new Vector3(529.5f, -75), EBits.BITS_16), + new LevelConstants.RandoLevel(ELevel.Level_04_Catacombs, new Vector3(499.5f, -43)), + } }, - new List - { - new LevelConstants.RandoLevel(ELevel.Level_07_QuillshroomMarsh, new Vector3(161.5f, -54)), - new LevelConstants.RandoLevel(ELevel.Level_07_QuillshroomMarsh, new Vector3(409.5f, -42)), - new LevelConstants.RandoLevel(ELevel.Level_07_QuillshroomMarsh, new Vector3(916.5f, -26)), - } - }, - new List> - { - new List - { - new LevelConstants.RandoLevel(ELevel.Level_08_SearingCrags, new Vector3(384.5f, 135f)), + new List> + { + new List(), + new List + { + new LevelConstants.RandoLevel(ELevel.Level_06_A_BambooCreek, new Vector3(-28.5f, -19)), + new LevelConstants.RandoLevel(ELevel.Level_06_A_BambooCreek, new Vector3(92.5f, 25)), + new LevelConstants.RandoLevel(ELevel.Level_06_A_BambooCreek, new Vector3(379.5f, 25)), + }, + new List + { + new LevelConstants.RandoLevel(ELevel.Level_06_A_BambooCreek, new Vector3(227.5f, -41)), + new LevelConstants.RandoLevel(ELevel.Level_06_A_BambooCreek, new Vector3(210.5f, 29)), + } }, - new List - { - new LevelConstants.RandoLevel(ELevel.Level_08_SearingCrags, new Vector3(61, -27)), - new LevelConstants.RandoLevel(ELevel.Level_08_SearingCrags, new Vector3(147.5f, 69)), - new LevelConstants.RandoLevel(ELevel.Level_08_SearingCrags, new Vector3(226.5f, 151)), - new LevelConstants.RandoLevel(ELevel.Level_08_SearingCrags, new Vector3(282, 237)), - new LevelConstants.RandoLevel(ELevel.Level_08_SearingCrags, new Vector3(380.5f, 309)), - new LevelConstants.RandoLevel(ELevel.Level_08_SearingCrags, new Vector3(119.5f, 248), EBits.BITS_8), + new List> + { + new List + { + new LevelConstants.RandoLevel(ELevel.Level_05_A_HowlingGrotto, new Vector3(241f, -196f)), + }, + new List + { + new LevelConstants.RandoLevel(ELevel.Level_05_A_HowlingGrotto, new Vector3(26.5f, -27)), + new LevelConstants.RandoLevel(ELevel.Level_05_A_HowlingGrotto, new Vector3(310.5f, -115)), + new LevelConstants.RandoLevel(ELevel.Level_05_A_HowlingGrotto, new Vector3(541.5f, -123)), + }, + new List + { + new LevelConstants.RandoLevel(ELevel.Level_05_A_HowlingGrotto, new Vector3(138.5f, -90)), + new LevelConstants.RandoLevel(ELevel.Level_05_A_HowlingGrotto, new Vector3(439, -170)), + } }, - new List - { - new LevelConstants.RandoLevel(ELevel.Level_08_SearingCrags, new Vector3(109.5f, 63)), - new LevelConstants.RandoLevel(ELevel.Level_08_SearingCrags, new Vector3(296.5f, 189f), EBits.BITS_8), - } - }, - new List> - { - new List - { - new LevelConstants.RandoLevel(ELevel.Level_09_A_GlacialPeak, new Vector3(220.6f, -67)), + new List> + { + new List(), + new List + { + new LevelConstants.RandoLevel(ELevel.Level_07_QuillshroomMarsh, new Vector3(193.5f, -37)), + new LevelConstants.RandoLevel(ELevel.Level_07_QuillshroomMarsh, new Vector3(663.5f, -27)), + new LevelConstants.RandoLevel(ELevel.Level_07_QuillshroomMarsh, new Vector3(1085.5f, -43)), + }, + new List + { + new LevelConstants.RandoLevel(ELevel.Level_07_QuillshroomMarsh, new Vector3(161.5f, -54)), + new LevelConstants.RandoLevel(ELevel.Level_07_QuillshroomMarsh, new Vector3(409.5f, -42)), + new LevelConstants.RandoLevel(ELevel.Level_07_QuillshroomMarsh, new Vector3(916.5f, -26)), + } }, - new List - { - new LevelConstants.RandoLevel(ELevel.Level_09_A_GlacialPeak, new Vector3(216.5f, -456)), - new LevelConstants.RandoLevel(ELevel.Level_09_A_GlacialPeak, new Vector3(259.5f, -297)), - new LevelConstants.RandoLevel(ELevel.Level_09_A_GlacialPeak, new Vector3(156.5f, -27)), + new List> + { + new List + { + new LevelConstants.RandoLevel(ELevel.Level_08_SearingCrags, new Vector3(384.5f, 135f)), + }, + new List + { + new LevelConstants.RandoLevel(ELevel.Level_08_SearingCrags, new Vector3(61, -27)), + new LevelConstants.RandoLevel(ELevel.Level_08_SearingCrags, new Vector3(147.5f, 69)), + new LevelConstants.RandoLevel(ELevel.Level_08_SearingCrags, new Vector3(226.5f, 151)), + new LevelConstants.RandoLevel(ELevel.Level_08_SearingCrags, new Vector3(282, 237)), + new LevelConstants.RandoLevel(ELevel.Level_08_SearingCrags, new Vector3(380.5f, 309)), + new LevelConstants.RandoLevel(ELevel.Level_08_SearingCrags, new Vector3(119.5f, 248), EBits.BITS_8), + }, + new List + { + new LevelConstants.RandoLevel(ELevel.Level_08_SearingCrags, new Vector3(109.5f, 63)), + new LevelConstants.RandoLevel(ELevel.Level_08_SearingCrags, new Vector3(296.5f, 189f), EBits.BITS_8), + } }, - new List - { - new LevelConstants.RandoLevel(ELevel.Level_09_A_GlacialPeak, new Vector3(227.5f, -405)), - new LevelConstants.RandoLevel(ELevel.Level_09_A_GlacialPeak, new Vector3(251.5f, -235)), - new LevelConstants.RandoLevel(ELevel.Level_09_A_GlacialPeak, new Vector3(195.5f, -131)), - } - }, - new List> - { - new List(), - new List - { - new LevelConstants.RandoLevel(ELevel.Level_10_A_TowerOfTime, new Vector3(71.5f, -11), EBits.BITS_8), - new LevelConstants.RandoLevel(ELevel.Level_10_A_TowerOfTime, new Vector3(84.5f, 237), EBits.BITS_8), + new List> + { + new List + { + new LevelConstants.RandoLevel(ELevel.Level_09_A_GlacialPeak, new Vector3(220.6f, -67)), + }, + new List + { + new LevelConstants.RandoLevel(ELevel.Level_09_A_GlacialPeak, new Vector3(216.5f, -456)), + new LevelConstants.RandoLevel(ELevel.Level_09_A_GlacialPeak, new Vector3(259.5f, -297)), + new LevelConstants.RandoLevel(ELevel.Level_09_A_GlacialPeak, new Vector3(156.5f, -27)), + }, + new List + { + new LevelConstants.RandoLevel(ELevel.Level_09_A_GlacialPeak, new Vector3(227.5f, -405)), + new LevelConstants.RandoLevel(ELevel.Level_09_A_GlacialPeak, new Vector3(251.5f, -235)), + new LevelConstants.RandoLevel(ELevel.Level_09_A_GlacialPeak, new Vector3(195.5f, -131)), + } }, - new List - { - new LevelConstants.RandoLevel(ELevel.Level_10_A_TowerOfTime, new Vector3(38.5f, 21.5f), EBits.BITS_8), - new LevelConstants.RandoLevel(ELevel.Level_10_A_TowerOfTime, new Vector3(5.5f, 37), EBits.BITS_8), - new LevelConstants.RandoLevel(ELevel.Level_10_A_TowerOfTime, new Vector3(50.5f, 77), EBits.BITS_8), - new LevelConstants.RandoLevel(ELevel.Level_10_A_TowerOfTime, new Vector3(57.5f, 85), EBits.BITS_8), - new LevelConstants.RandoLevel(ELevel.Level_10_A_TowerOfTime, new Vector3(31.5f, 133), EBits.BITS_8), - new LevelConstants.RandoLevel(ELevel.Level_10_A_TowerOfTime, new Vector3(58.5f, 165), EBits.BITS_8), - } - }, - new List> - { - new List(), - new List - { - new LevelConstants.RandoLevel(ELevel.Level_11_A_CloudRuins, new Vector3(-368.5f, -26), EBits.BITS_8), - new LevelConstants.RandoLevel(ELevel.Level_11_A_CloudRuins, new Vector3(-140.5f, -26), EBits.BITS_8), - new LevelConstants.RandoLevel(ELevel.Level_11_A_CloudRuins, new Vector3(116.5f, -25)), - new LevelConstants.RandoLevel(ELevel.Level_11_A_CloudRuins, new Vector3(366.5f, -27), EBits.BITS_8), - new LevelConstants.RandoLevel(ELevel.Level_11_A_CloudRuins, new Vector3(721.5f, -22), EBits.BITS_8), - new LevelConstants.RandoLevel(ELevel.Level_11_A_CloudRuins, new Vector3(816.5f, -26), EBits.BITS_8), - new LevelConstants.RandoLevel(ELevel.Level_11_A_CloudRuins, new Vector3(1148.5f, -27), EBits.BITS_8), + new List> + { + new List(), + new List + { + new LevelConstants.RandoLevel(ELevel.Level_10_A_TowerOfTime, new Vector3(71.5f, -11), EBits.BITS_8), + new LevelConstants.RandoLevel(ELevel.Level_10_A_TowerOfTime, new Vector3(84.5f, 237), EBits.BITS_8), + }, + new List + { + new LevelConstants.RandoLevel(ELevel.Level_10_A_TowerOfTime, new Vector3(38.5f, 21.5f), EBits.BITS_8), + new LevelConstants.RandoLevel(ELevel.Level_10_A_TowerOfTime, new Vector3(5.5f, 37), EBits.BITS_8), + new LevelConstants.RandoLevel(ELevel.Level_10_A_TowerOfTime, new Vector3(50.5f, 77), EBits.BITS_8), + new LevelConstants.RandoLevel(ELevel.Level_10_A_TowerOfTime, new Vector3(57.5f, 85), EBits.BITS_8), + new LevelConstants.RandoLevel(ELevel.Level_10_A_TowerOfTime, new Vector3(31.5f, 133), EBits.BITS_8), + new LevelConstants.RandoLevel(ELevel.Level_10_A_TowerOfTime, new Vector3(58.5f, 165), EBits.BITS_8), + } }, - new List - { - new LevelConstants.RandoLevel(ELevel.Level_11_A_CloudRuins, new Vector3(-146, 24), EBits.BITS_8), - new LevelConstants.RandoLevel(ELevel.Level_11_A_CloudRuins, new Vector3(164, -21)), - new LevelConstants.RandoLevel(ELevel.Level_11_A_CloudRuins, new Vector3(769.5f, -26)), - new LevelConstants.RandoLevel(ELevel.Level_11_A_CloudRuins, new Vector3(-251, 13)), - } - }, - new List> - { - new List(), - new List - { - new LevelConstants.RandoLevel(ELevel.Level_12_UnderWorld, new Vector3(-305, -51), EBits.BITS_8), - new LevelConstants.RandoLevel(ELevel.Level_12_UnderWorld, new Vector3(-186.5f, -24), EBits.BITS_8), - new LevelConstants.RandoLevel(ELevel.Level_12_UnderWorld, new Vector3(-125.5f, -91), EBits.BITS_8), - //new LevelConstants.RandoLevel(ELevel.Level_12_UnderWorld, new Vector3(124.5f, -43)), // barm'athazel which isn't accessible in second quest - new LevelConstants.RandoLevel(ELevel.Level_12_UnderWorld, new Vector3(132.5f, -130)), + new List> + { + new List(), + new List + { + new LevelConstants.RandoLevel(ELevel.Level_11_A_CloudRuins, new Vector3(-368.5f, -26), EBits.BITS_8), + new LevelConstants.RandoLevel(ELevel.Level_11_A_CloudRuins, new Vector3(-140.5f, -26), EBits.BITS_8), + new LevelConstants.RandoLevel(ELevel.Level_11_A_CloudRuins, new Vector3(116.5f, -25)), + new LevelConstants.RandoLevel(ELevel.Level_11_A_CloudRuins, new Vector3(366.5f, -27), EBits.BITS_8), + new LevelConstants.RandoLevel(ELevel.Level_11_A_CloudRuins, new Vector3(721.5f, -22), EBits.BITS_8), + new LevelConstants.RandoLevel(ELevel.Level_11_A_CloudRuins, new Vector3(816.5f, -26), EBits.BITS_8), + new LevelConstants.RandoLevel(ELevel.Level_11_A_CloudRuins, new Vector3(1148.5f, -27), EBits.BITS_8), + }, + new List + { + new LevelConstants.RandoLevel(ELevel.Level_11_A_CloudRuins, new Vector3(-146, 24), EBits.BITS_8), + new LevelConstants.RandoLevel(ELevel.Level_11_A_CloudRuins, new Vector3(164, -21)), + new LevelConstants.RandoLevel(ELevel.Level_11_A_CloudRuins, new Vector3(769.5f, -26)), + new LevelConstants.RandoLevel(ELevel.Level_11_A_CloudRuins, new Vector3(-251, 13)), + } }, - new List - { - new LevelConstants.RandoLevel(ELevel.Level_12_UnderWorld, new Vector3(-226.5f, -89), EBits.BITS_8), - new LevelConstants.RandoLevel(ELevel.Level_12_UnderWorld, new Vector3(0.5f, 72), EBits.BITS_8), - new LevelConstants.RandoLevel(ELevel.Level_12_UnderWorld, new Vector3(-110.5f, -98), EBits.BITS_8), - } - }, - new List> - { - new List - { - new LevelConstants.RandoLevel(ELevel.Level_04_C_RiviereTurquoise, new Vector3(837, 13.5f)), + new List> + { + new List(), + new List + { + new LevelConstants.RandoLevel(ELevel.Level_12_UnderWorld, new Vector3(-305, -51), EBits.BITS_8), + new LevelConstants.RandoLevel(ELevel.Level_12_UnderWorld, new Vector3(-186.5f, -24), EBits.BITS_8), + new LevelConstants.RandoLevel(ELevel.Level_12_UnderWorld, new Vector3(-125.5f, -91), EBits.BITS_8), + //new LevelConstants.RandoLevel(ELevel.Level_12_UnderWorld, new Vector3(124.5f, -43)), // barm'athazel which isn't accessible in second quest + new LevelConstants.RandoLevel(ELevel.Level_12_UnderWorld, new Vector3(132.5f, -130)), + }, + new List + { + new LevelConstants.RandoLevel(ELevel.Level_12_UnderWorld, new Vector3(-226.5f, -89), EBits.BITS_8), + new LevelConstants.RandoLevel(ELevel.Level_12_UnderWorld, new Vector3(0.5f, 72), EBits.BITS_8), + new LevelConstants.RandoLevel(ELevel.Level_12_UnderWorld, new Vector3(-110.5f, -98), EBits.BITS_8), + } }, - new List - { - new LevelConstants.RandoLevel(ELevel.Level_04_C_RiviereTurquoise, new Vector3(804.5f, -40)), - new LevelConstants.RandoLevel(ELevel.Level_04_C_RiviereTurquoise, new Vector3(499, -132), EBits.BITS_8), - new LevelConstants.RandoLevel(ELevel.Level_04_C_RiviereTurquoise, new Vector3(337.5f, -131)), - new LevelConstants.RandoLevel(ELevel.Level_04_C_RiviereTurquoise, new Vector3(149.5f, -89)), - new LevelConstants.RandoLevel(ELevel.Level_04_C_RiviereTurquoise, new Vector3(-8.5f, 13)), - new LevelConstants.RandoLevel(ELevel.Level_04_C_RiviereTurquoise, new Vector3(-259, 7)), + new List> + { + new List + { + new LevelConstants.RandoLevel(ELevel.Level_04_C_RiviereTurquoise, new Vector3(837, 13.5f)), + }, + new List + { + new LevelConstants.RandoLevel(ELevel.Level_04_C_RiviereTurquoise, new Vector3(804.5f, -40)), + new LevelConstants.RandoLevel(ELevel.Level_04_C_RiviereTurquoise, new Vector3(499, -132), EBits.BITS_8), + new LevelConstants.RandoLevel(ELevel.Level_04_C_RiviereTurquoise, new Vector3(337.5f, -131)), + new LevelConstants.RandoLevel(ELevel.Level_04_C_RiviereTurquoise, new Vector3(149.5f, -89)), + new LevelConstants.RandoLevel(ELevel.Level_04_C_RiviereTurquoise, new Vector3(-8.5f, 13)), + new LevelConstants.RandoLevel(ELevel.Level_04_C_RiviereTurquoise, new Vector3(-259, 7)), + }, + new List + { + new LevelConstants.RandoLevel(ELevel.Level_04_C_RiviereTurquoise, new Vector3(648.5f, -83), EBits.BITS_8), + } }, - new List - { - new LevelConstants.RandoLevel(ELevel.Level_04_C_RiviereTurquoise, new Vector3(648.5f, -83), EBits.BITS_8), + new List> + { + new List(), + new List + { + new LevelConstants.RandoLevel(ELevel.Level_09_B_ElementalSkylands, new Vector3(-35, 359)), + new LevelConstants.RandoLevel(ELevel.Level_09_B_ElementalSkylands, new Vector3(87.5f, 407)), + new LevelConstants.RandoLevel(ELevel.Level_09_B_ElementalSkylands, new Vector3(864.5f, 381)), + new LevelConstants.RandoLevel(ELevel.Level_09_B_ElementalSkylands, new Vector3(966.3f, 409.4f)), + new LevelConstants.RandoLevel(ELevel.Level_09_B_ElementalSkylands, new Vector3(1763.5f, 381)), + new LevelConstants.RandoLevel(ELevel.Level_09_B_ElementalSkylands, new Vector3(1909, 411)), + new LevelConstants.RandoLevel(ELevel.Level_09_B_ElementalSkylands, new Vector3(2755.5f, 376), EBits.BITS_8), + new LevelConstants.RandoLevel(ELevel.Level_09_B_ElementalSkylands, new Vector3(2926.5f, 406)), + }, + new List + { + new LevelConstants.RandoLevel(ELevel.Level_09_B_ElementalSkylands, new Vector3(-22.5f, 417)), + } + }, + new List> + { + new List + { + new LevelConstants.RandoLevel(ELevel.Level_05_B_SunkenShrine, new Vector3(29f, -55f)), + }, + new List + { + new LevelConstants.RandoLevel(ELevel.Level_05_B_SunkenShrine, new Vector3(36.5f, -41)), + new LevelConstants.RandoLevel(ELevel.Level_05_B_SunkenShrine, new Vector3(186.5f, -9), EBits.BITS_8), + new LevelConstants.RandoLevel(ELevel.Level_05_B_SunkenShrine, new Vector3(8, -65), EBits.BITS_8), + new LevelConstants.RandoLevel(ELevel.Level_05_B_SunkenShrine, new Vector3(-102.5f, -121), EBits.BITS_8), + new LevelConstants.RandoLevel(ELevel.Level_05_B_SunkenShrine, new Vector3(100, -81), EBits.BITS_8), + }, + new List + { + new LevelConstants.RandoLevel(ELevel.Level_05_B_SunkenShrine, new Vector3(53.5f, -25), EBits.BITS_8), + new LevelConstants.RandoLevel(ELevel.Level_05_B_SunkenShrine, new Vector3(29.5f, -87), EBits.BITS_8), + new LevelConstants.RandoLevel(ELevel.Level_05_B_SunkenShrine, new Vector3(166, -178), EBits.BITS_8), + new LevelConstants.RandoLevel(ELevel.Level_05_B_SunkenShrine, new Vector3(92.5f, -100), EBits.BITS_8), + } } - }, - new List> + }; + + private static readonly List Portals = new List + { + "Autumn Hills - Portal", + "Riviere Turquoise - Portal", + "Howling Grotto - Portal", + "Sunken Shrine - Portal", + "Searing Crags - Portal", + "Glacial Peak - Portal", + }; + + private static readonly List AccessedStartingPortals = new List(); + + public static HashSet UnlockedPortals + { + get { - new List(), - new List - { - new LevelConstants.RandoLevel(ELevel.Level_09_B_ElementalSkylands, new Vector3(-35, 359)), - new LevelConstants.RandoLevel(ELevel.Level_09_B_ElementalSkylands, new Vector3(87.5f, 407)), - new LevelConstants.RandoLevel(ELevel.Level_09_B_ElementalSkylands, new Vector3(864.5f, 381)), - new LevelConstants.RandoLevel(ELevel.Level_09_B_ElementalSkylands, new Vector3(966.3f, 409.4f)), - new LevelConstants.RandoLevel(ELevel.Level_09_B_ElementalSkylands, new Vector3(1763.5f, 381)), - new LevelConstants.RandoLevel(ELevel.Level_09_B_ElementalSkylands, new Vector3(1909, 411)), - new LevelConstants.RandoLevel(ELevel.Level_09_B_ElementalSkylands, new Vector3(2755.5f, 376), EBits.BITS_8), - new LevelConstants.RandoLevel(ELevel.Level_09_B_ElementalSkylands, new Vector3(2926.5f, 406)), - }, - new List + var unlockedPortals = new HashSet(); + + var progressManager = Manager.Instance; + if (progressManager.cutscenesPlayed.Contains("PortalOpeningCutscene")) { - new LevelConstants.RandoLevel(ELevel.Level_09_B_ElementalSkylands, new Vector3(-22.5f, 417)), + unlockedPortals.Add("Autumn Hills Portal"); + unlockedPortals.Add("Howling Grotto Portal"); + unlockedPortals.Add("Glacial Peak Portal"); } - }, - new List> - { - new List + if (progressManager.cutscenesPlayed.Contains("SunkenShrinePortalOpeningCutscene")) { - new LevelConstants.RandoLevel(ELevel.Level_05_B_SunkenShrine, new Vector3(29f, -55f)), - }, - new List + unlockedPortals.Add("Sunken Shrine Portal"); + } + if (progressManager.cutscenesPlayed.Contains("SearingCragsPortalOpeningCutscene")) { - new LevelConstants.RandoLevel(ELevel.Level_05_B_SunkenShrine, new Vector3(36.5f, -41)), - new LevelConstants.RandoLevel(ELevel.Level_05_B_SunkenShrine, new Vector3(186.5f, -9), EBits.BITS_8), - new LevelConstants.RandoLevel(ELevel.Level_05_B_SunkenShrine, new Vector3(8, -65), EBits.BITS_8), - new LevelConstants.RandoLevel(ELevel.Level_05_B_SunkenShrine, new Vector3(-102.5f, -121), EBits.BITS_8), - new LevelConstants.RandoLevel(ELevel.Level_05_B_SunkenShrine, new Vector3(100, -81), EBits.BITS_8), - }, - new List + unlockedPortals.Add("Searing Crags Portal"); + } + if (progressManager.cutscenesPlayed.Contains("RiviereTurquoisePortalOpeningCutscene")) { - new LevelConstants.RandoLevel(ELevel.Level_05_B_SunkenShrine, new Vector3(53.5f, -25), EBits.BITS_8), - new LevelConstants.RandoLevel(ELevel.Level_05_B_SunkenShrine, new Vector3(29.5f, -87), EBits.BITS_8), - new LevelConstants.RandoLevel(ELevel.Level_05_B_SunkenShrine, new Vector3(166, -178), EBits.BITS_8), - new LevelConstants.RandoLevel(ELevel.Level_05_B_SunkenShrine, new Vector3(92.5f, -100), EBits.BITS_8), + unlockedPortals.Add("Riviere Turquoise Portal"); } + + return unlockedPortals; } - }; + } - private static readonly List Portals = new List - { - "Autumn Hills - Portal", - "Riviere Turquoise - Portal", - "Howling Grotto - Portal", - "Sunken Shrine - Portal", - "Searing Crags - Portal", - "Glacial Peak - Portal", - }; + private static bool PortalShuffleEnabled => PortalMapping is not null && PortalMapping.Count > 0; - private static readonly List AccessedStartingPortals = new List(); - public static HashSet UnlockedPortals - { - get + public static bool ShouldPortalBeOpen(string portal) { - var unlockedPortals = new HashSet(); + return AccessedStartingPortals.Contains(portal); + } - var progressManager = Manager.Instance; - if (progressManager.cutscenesPlayed.Contains("PortalOpeningCutscene")) - { - unlockedPortals.Add("Autumn Hills Portal"); - unlockedPortals.Add("Howling Grotto Portal"); - unlockedPortals.Add("Glacial Peak Portal"); - } - if (progressManager.cutscenesPlayed.Contains("SunkenShrinePortalOpeningCutscene")) - { - unlockedPortals.Add("Sunken Shrine Portal"); - } - if (progressManager.cutscenesPlayed.Contains("SearingCragsPortalOpeningCutscene")) - { - unlockedPortals.Add("Searing Crags Portal"); - } - if (progressManager.cutscenesPlayed.Contains("RiviereTurquoisePortalOpeningCutscene")) + public static void OpenPortalEvent(On.PortalOpeningCutscene.orig_OnOpenPortalEvent orig, + PortalOpeningCutscene self, string eventid) + { + switch (eventid) { - unlockedPortals.Add("Riviere Turquoise Portal"); + case "AutumnHills": + if (StartingPortals.Contains("Autumn Hills Portal")) + { + orig(self, eventid); + AccessedStartingPortals.Add(eventid); + } + break; + case "HowlingGrotto": + if (StartingPortals.Contains("Howling Grotto Portal")) + { + orig(self, eventid); + AccessedStartingPortals.Add(eventid); + } + break; + case "GlacialPeak": + if (StartingPortals.Contains("Glacial Peak Portal")) + { + orig(self, eventid); + AccessedStartingPortals.Add(eventid); + } + break; + default: + orig(self, eventid); + break; } - - return unlockedPortals; } - } - - private static bool PortalShuffleEnabled => PortalMapping is not null && PortalMapping.Count > 0; + private static LevelConstants.RandoLevel GetPortalExit(string enteredPortal) + { + Console.WriteLine($"getting portal. entered {enteredPortal}"); + var portalExit = PortalMapping[Portals.IndexOf(enteredPortal)]; + Console.WriteLine($"{portalExit.Region}, {portalExit.PortalType}, {portalExit.Index}"); + return AreaCheckpoints[portalExit.Region][portalExit.PortalType][portalExit.Index]; + } - public static bool ShouldPortalBeOpen(string portal) - { - return AccessedStartingPortals.Contains(portal); - } - - public static void OpenPortalEvent(On.PortalOpeningCutscene.orig_OnOpenPortalEvent orig, - PortalOpeningCutscene self, string eventid) - { - switch (eventid) + public static void Teleport() { - case "AutumnHills": - if (StartingPortals.Contains("Autumn Hills Portal")) - { - orig(self, eventid); - AccessedStartingPortals.Add(eventid); + var currentLevel = Manager.Instance.GetCurrentLevelEnum(); + if (!LevelConstants.TransitionToEntranceName.TryGetValue( + new LevelConstants.Transition(ELevel.Level_13_TowerOfTimeHQ, + currentLevel), out var portal)) + { + Console.WriteLine($"unable to find portal for {currentLevel}"); + } + else + { + if (portal.Equals("Tower of Time - Left") || portal.Equals("Corrupted Future")) + { + if (portal.Equals("Tower of Time - Left")) + EnteredTower = true; + LeftHQPortal = false; + var newLevel = RandoLevelManager.FindEntrance(); + if (RandoLevelManager.RandoLevelMapping != null && RandoLevelManager.RandoLevelMapping.Count > 0) + { + RandoLevelManager.TeleportInArea(newLevel.LevelName, newLevel.PlayerPos, newLevel.Dimension); + } + return; } - break; - case "HowlingGrotto": - if (StartingPortals.Contains("Howling Grotto Portal")) + + if (!PortalShuffleEnabled) { - orig(self, eventid); - AccessedStartingPortals.Add(eventid); + LeftHQPortal = false; + return; } - break; - case "GlacialPeak": - if (StartingPortals.Contains("Glacial Peak Portal")) + try + { + var newLevel = GetPortalExit(portal); + switch (newLevel.LevelName) + { + case ELevel.Level_09_B_ElementalSkylands: + RandoLevelManager.KillManfred = true; + break; + case ELevel.NONE: + LeftHQPortal = false; + return; + } + + TrackerManager.AddVisitedEntrance("HQ - " + portal.Replace("- ", "")); + RandoLevelManager.TeleportInArea(newLevel.LevelName, newLevel.PlayerPos, newLevel.Dimension); + } + catch (Exception e) { - orig(self, eventid); - AccessedStartingPortals.Add(eventid); + Console.WriteLine(e); } - break; - default: - orig(self, eventid); - break; - } - } + } - private static LevelConstants.RandoLevel GetPortalExit(string enteredPortal) - { - Console.WriteLine($"getting portal. entered {enteredPortal}"); - var portalExit = PortalMapping[Portals.IndexOf(enteredPortal)]; - Console.WriteLine($"{portalExit.Region}, {portalExit.PortalType}, {portalExit.Index}"); - return AreaCheckpoints[portalExit.Region][portalExit.PortalType][portalExit.Index]; - } + LeftHQPortal = false; + } - public static void Teleport() - { - var currentLevel = Manager.Instance.GetCurrentLevelEnum(); - if (!LevelConstants.TransitionToEntranceName.TryGetValue( - new LevelConstants.Transition(ELevel.Level_13_TowerOfTimeHQ, - currentLevel), out var portal)) + public static void LeaveHQ(On.TotHQ.orig_LeaveToLevel orig, TotHQ self, bool playLevelMusic, bool loadingNewLevel) { - Console.WriteLine($"unable to find portal for {currentLevel}"); + Console.WriteLine("leaving hq..."); + LeftHQPortal = true; + ForceTeleport = !loadingNewLevel; + Console.WriteLine($"Force teleport: {ForceTeleport}"); + orig(self, playLevelMusic, loadingNewLevel); } - else - { - if (portal.Equals("Tower of Time - Left") || portal.Equals("Corrupted Future")) - { - if (portal.Equals("Tower of Time - Left")) - EnteredTower = true; - LeftHQPortal = false; - var newLevel = RandoLevelManager.FindEntrance(); - if (RandoLevelManager.RandoLevelMapping != null && RandoLevelManager.RandoLevelMapping.Count > 0) - { - RandoLevelManager.TeleportInArea(newLevel.LevelName, newLevel.PlayerPos, newLevel.Dimension); - } - return; - } - if (!PortalShuffleEnabled) - { - LeftHQPortal = false; - return; - } + public static void TowerOfTimePortal_LoadLevel(On.TowerOfTimePortal.orig_LoadLevel orig, TowerOfTimePortal self) + { try { - var newLevel = GetPortalExit(portal); - switch (newLevel.LevelName) + Console.WriteLine("Left ToT through portal."); + orig(self); + + if (!PortalShuffleEnabled) { - case ELevel.Level_09_B_ElementalSkylands: - RandoLevelManager.KillManfred = true; - break; - case ELevel.NONE: - LeftHQPortal = false; - return; + TrackerManager.SetCurrentRegion(self.nextLevel); + return; } - - TrackerManager.AddVisitedEntrance("HQ - " + portal.Replace("- ", "")); - RandoLevelManager.TeleportInArea(newLevel.LevelName, newLevel.PlayerPos, newLevel.Dimension); } catch (Exception e) { + Console.Write("Error in TowerOfTimePortal_LoadLevel"); Console.WriteLine(e); } } - LeftHQPortal = false; - } - - public static void LeaveHQ(On.TotHQ.orig_LeaveToLevel orig, TotHQ self, bool playLevelMusic, bool loadingNewLevel) - { - Console.WriteLine("leaving hq..."); - LeftHQPortal = true; - ForceTeleport = !loadingNewLevel; - Console.WriteLine($"Force teleport: {ForceTeleport}"); - orig(self, playLevelMusic, loadingNewLevel); - } - - public static void TowerOfTimePortal_LoadLevel(On.TowerOfTimePortal.orig_LoadLevel orig, TowerOfTimePortal self) - { - try - { - Console.WriteLine("Left ToT through portal."); - orig(self); - - if (!PortalShuffleEnabled) - { - TrackerManager.SetCurrentRegion(self.nextLevel); - return; - } - } - catch (Exception e) - { - Console.Write("Error in TowerOfTimePortal_LoadLevel"); - Console.WriteLine(e); - } } - } From 5f37977ca252983f97b0be8cd83ffcc4933cbf94 Mon Sep 17 00:00:00 2001 From: Jouramie <16137441+Jouramie@users.noreply.github.com> Date: Sun, 26 Jul 2026 10:35:26 -0400 Subject: [PATCH 5/5] self review --- GameOverrideManagers/RandoPortalManager.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GameOverrideManagers/RandoPortalManager.cs b/GameOverrideManagers/RandoPortalManager.cs index 934f188..9519704 100644 --- a/GameOverrideManagers/RandoPortalManager.cs +++ b/GameOverrideManagers/RandoPortalManager.cs @@ -363,7 +363,6 @@ public static HashSet UnlockedPortals private static bool PortalShuffleEnabled => PortalMapping is not null && PortalMapping.Count > 0; - public static bool ShouldPortalBeOpen(string portal) { return AccessedStartingPortals.Contains(portal); @@ -479,6 +478,7 @@ public static void TowerOfTimePortal_LoadLevel(On.TowerOfTimePortal.orig_LoadLev Console.WriteLine("Left ToT through portal."); orig(self); + // When portals are shuffled, the teleportation override will set the current region. if (!PortalShuffleEnabled) { TrackerManager.SetCurrentRegion(self.nextLevel);