private static void LoadFirstWorldHK(On.OverWorld.orig_LoadFirstWorld orig, global::OverWorld self) { orig(self); if (MonklandSteamManager.isInGame) { MonklandSteamManager.WorldManager.GameStart(); } }
private static void OverWorld_LoadFirstWorld(On.OverWorld.orig_LoadFirstWorld orig, OverWorld self) { textLoadWorld = null; singleWorld = null; AddMissingRegions(self); bool flag = false; string text = string.Empty; if (self.game.IsArenaSession) { flag = true; text = self.game.GetArenaGameSession.arenaSitting.GetCurrentLevel; } else if (self.game.manager.menuSetup.startGameCondition == ProcessManager.MenuSetup.StoryGameInitCondition.Dev) { string[] array = File.ReadAllLines(Custom.RootFolderDirectory() + "setup.txt"); text = Regex.Split(array[0], ": ")[1]; flag = !self.game.setupValues.world; } else if (self.game.manager.menuSetup.startGameCondition == ProcessManager.MenuSetup.StoryGameInitCondition.RegionSelect || self.game.manager.menuSetup.FastTravelInitCondition) { text = self.game.manager.menuSetup.regionSelectRoom; flag = false; } else { text = (self.game.session as StoryGameSession).saveState.denPosition; flag = false; } if (self.game.startingRoom != string.Empty) { text = self.game.startingRoom; } string text2 = Regex.Split(text, "_")[0]; if (!flag) { bool flag2 = false; // Check vanilla first string directory = Custom.RootFolderDirectory() + "World" + Path.DirectorySeparatorChar + "Regions" + Path.DirectorySeparatorChar + text2; string directory2 = Custom.RootFolderDirectory() + "World" + Path.DirectorySeparatorChar + "Regions" + Path.DirectorySeparatorChar + Regex.Split(text, "_")[1]; if (Directory.Exists(directory)) { flag2 = true; } else if (Regex.Split(text, "_").Length > 2 && Directory.Exists(directory2)) { text2 = Regex.Split(text, "_")[1]; flag2 = true; } // Check custom regions if (!flag2) { text2 = Regex.Split(text, "_")[0]; foreach (KeyValuePair <string, string> keyValues in CustomWorldMod.activatedPacks) { string customDirectory = Custom.RootFolderDirectory() + CustomWorldMod.resourcePath + keyValues.Value + Path.DirectorySeparatorChar + "World" + Path.DirectorySeparatorChar + "Regions" + Path.DirectorySeparatorChar + text2; //string customDirectory2 = Custom.RootFolderDirectory() + CustomWorldMod.resourcePath + keyValues.Value + Path.DirectorySeparatorChar + "World" + Path.DirectorySeparatorChar + "Regions" + Path.DirectorySeparatorChar + Regex.Split(text, "_")[1]; CustomWorldMod.Log($"Custom Regions: CustomDirectory [{customDirectory}]"); //CustomWorldMod.Log($"Custom Regions: CustomDirectory2 [{customDirectory2}]"); if (Directory.Exists(customDirectory)) { flag2 = true; break; } else if (Regex.Split(text, "_").Length > 2 && Directory.Exists(directory2)) { text2 = Regex.Split(text, "_")[1]; flag2 = true; break; } } } if (!flag2) { flag = true; } } // If arena or SetupWorld if (flag) { textLoadWorld = text; singleWorld = true; } else { textLoadWorld = text2; singleWorld = false; } self.FIRSTROOM = text; orig(self); }