Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of RepoSeeded v2.6.2
RepoSeeded.dll
Decompiled a month agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Cryptography; using System.Security.Permissions; using System.Text; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Logging; using HarmonyLib; using MenuLib; using MenuLib.MonoBehaviors; using Microsoft.CodeAnalysis; using Photon.Pun; using UnityEngine; using UnityEngine.UIElements.Collections; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("Larsielol")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("RepoSeeded")] [assembly: AssemblyTitle("RepoSeeded")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace RepoSeeded { [HarmonyPatch(typeof(EnemyDirector))] internal static class EnemyRNGPatch { [HarmonyPrefix] [HarmonyPatch("PickEnemies")] private static bool EnemyTypeRNGSeeder(List<EnemySetup> _enemiesList) { int num = RepoSeeded.EnemyTypeRandom.Next(); Random.InitState(num); int num2 = DataDirector.instance.SettingValueFetch((Setting)31); ListExtension.Shuffle<EnemySetup>((IList<EnemySetup>)_enemiesList); EnemySetup item = null; float num3 = -1f; foreach (EnemySetup _enemies in _enemiesList) { if (_enemies.levelsCompletedCondition && (RunManager.instance.levelsCompleted < _enemies.levelsCompletedMin || RunManager.instance.levelsCompleted > _enemies.levelsCompletedMax)) { continue; } int num4 = 0; foreach (EnemySetup item2 in RunManager.instance.enemiesSpawned) { if ((Object)(object)item2 == (Object)(object)_enemies) { num4++; } } int num5 = 0; foreach (EnemySetup enemy in EnemyDirector.instance.enemyList) { if ((Object)(object)enemy == (Object)(object)_enemies) { num5++; } } float num6 = 100f; if (Object.op_Implicit((Object)(object)_enemies.rarityPreset)) { num6 = _enemies.rarityPreset.chance; } float num7 = Mathf.Max(1f, num6 - 30f * (float)num4 - 10f * (float)num5); float num8 = Random.Range(0f, num7); if (num8 > num3) { item = _enemies; num3 = num8; } } EnemyDirector.instance.enemyListCurrent.Add(item); EnemyDirector.instance.enemyList.Add(item); RepoSeeded.EnemyOrbRandoms.Clear(); return false; } [HarmonyPrefix] [HarmonyPatch("Start")] private static bool EnemyIdleRNGGSeeder() { Random.InitState(RepoSeeded.LevelRandom.Next()); return true; } } [HarmonyPatch(typeof(SemiFunc))] internal static class enemyPingOnMessage { [HarmonyPrefix] [HarmonyPatch("UIBigMessage")] private static void RemoveEnemyPingOnText(ref string message, string emoji, float size, Color colorMain, Color colorFlash) { if (message == "EXTRACTION POINT ACTIVATED") { message = message.Replace("ACTIVATED", "ENABLED"); } } } [HarmonyPatch(typeof(RunManager))] internal static class LevelAreaRNGPatch { [HarmonyPrefix] [HarmonyPatch("SetRunLevel")] private static void LevelAreaRNGSeeder(ref Level ___previousRunLevel, ref Level ___levelCurrent, int ___levelsCompleted) { SaveHijack.previousLevel = ___previousRunLevel; if (___levelsCompleted == 0) { ___previousRunLevel = null; ___levelCurrent = null; RunManager.instance.cosmeticWorldObjectBadLuckCount = 0; } } [HarmonyPrefix] [HarmonyPatch("ChangeLevel")] private static void ShopLevelRNGSeeder() { if (!RepoSeeded.savedSeedToHistory) { RepoSeeded.savedSeedToHistory = true; SeedHistory.addSeed(RepoSeeded.currentSeed); } if (!RepoSeeded.JustHijackedTheSave) { RepoSeeded.saveRandoms(); } else { RepoSeeded.JustHijackedTheSave = false; } int seed = RepoSeeded.ShopRandom.Next(); RepoSeeded.shopTemporaryRandom = new Random(seed); int num = RepoSeeded.LevelRandom.Next(); Random.InitState(num); } } [HarmonyPatch(typeof(LevelGenerator))] internal static class LevelLayoutRNGPatch { [HarmonyPrefix] [HarmonyPatch(/*Could not decode attribute arguments.*/)] private static void LevelGenerationRNGSeederTiles() { Random.InitState(RepoSeeded.LevelRandom.Next()); RepoSeeded.TruckTextRandom = new Random(RepoSeeded.LevelRandom.Next()); } [HarmonyPrefix] [HarmonyPatch(/*Could not decode attribute arguments.*/)] private static void LevelGenerationRNGSeederModules() { Random.InitState(RepoSeeded.LevelRandom.Next()); } } [HarmonyPatch(typeof(EnemyParent))] internal static class OrbValueRNGPatch { [HarmonyPrefix] [HarmonyPatch("Despawn")] private static bool RemoveValueRNG(EnemyParent __instance) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Invalid comparison between Unknown and I4 //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Invalid comparison between Unknown and I4 //IL_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) Random.InitState(RepoSeeded.EnemyOrbRandom.Next()); if (GameManager.Multiplayer() && !PhotonNetwork.IsMasterClient) { return false; } __instance.Enemy.CurrentState = (EnemyState)11; __instance.DespawnedTimer = Random.Range(__instance.DespawnedTimeMin, __instance.DespawnedTimeMax) * EnemyDirector.instance.despawnedDecreaseMultiplier * EnemyDirector.instance.despawnedTimeMultiplier; __instance.DespawnedTimer = Mathf.Max(__instance.DespawnedTimer, 1f); if (__instance.Enemy.HasRigidbody) { __instance.Enemy.Rigidbody.grabbed = false; __instance.Enemy.Rigidbody.grabStrengthTimer = 0f; __instance.Enemy.Rigidbody.GrabRelease(true, 0.1f); } if (GameManager.Multiplayer()) { ((MonoBehaviourPun)__instance).photonView.RPC("DespawnRPC", (RpcTarget)0, Array.Empty<object>()); } else { __instance.DespawnRPC(default(PhotonMessageInfo)); } if (!__instance.Enemy.HasHealth || __instance.Enemy.Health.healthCurrent > 0) { return false; } if (__instance.Enemy.Health.spawnValuable && __instance.valuableSpawnTimer > 0f && __instance.Enemy.Health.spawnValuableCurrent < __instance.Enemy.Health.spawnValuableMax) { GameObject val = AssetManager.instance.enemyValuableSmall; if ((int)__instance.difficulty == 1) { val = AssetManager.instance.enemyValuableMedium; } else if ((int)__instance.difficulty == 2) { val = AssetManager.instance.enemyValuableBig; } Transform val2 = __instance.Enemy.CustomValuableSpawnTransform; if (!Object.op_Implicit((Object)(object)val2)) { val2 = __instance.Enemy.CenterTransform; } GameObject val3 = (SemiFunc.IsMultiplayer() ? PhotonNetwork.InstantiateRoomObject("Valuables/" + ((Object)val).name, val2.position, Quaternion.identity, (byte)0, (object[])null) : Object.Instantiate<GameObject>(val, val2.position, Quaternion.identity)); EnemyHealth health = __instance.Enemy.Health; health.spawnValuableCurrent++; ValuableObject component = val3.GetComponent<ValuableObject>(); Random.InitState(RepoSeeded.EnemyOrbRandoms[__instance].Next()); component.DollarValueSetLogic(); } __instance.DespawnedTimer *= 3f; return false; } } [HarmonyPatch(typeof(LevelGenerator))] internal static class AddEnemiesToOrbRNG { [HarmonyPrefix] [HarmonyPatch("EnemySpawn")] private static bool getAllEnemiesIntoList(ref EnemySetup enemySetup, ref Vector3 position) { //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) foreach (PrefabRef spawnObject in enemySetup.spawnObjects) { GameObject val = ((GameManager.instance.gameMode != 0) ? PhotonNetwork.InstantiateRoomObject(((PrefabRef<GameObject>)(object)spawnObject).ResourcePath, position, Quaternion.identity, (byte)0, (object[])null) : Object.Instantiate<GameObject>(((PrefabRef<GameObject>)(object)spawnObject).Prefab, position, Quaternion.identity)); EnemyParent component = val.GetComponent<EnemyParent>(); if (Object.op_Implicit((Object)(object)component)) { RepoSeeded.EnemyOrbRandoms.Add(component, new Random(RepoSeeded.EnemyOrbRandom.Next())); component.SetupDone = true; val.GetComponentInChildren<Enemy>().EnemyTeleported(position); LevelGenerator instance = LevelGenerator.Instance; instance.EnemiesSpawnTarget++; EnemyDirector.instance.FirstSpawnPointAdd(component); } } return false; } } [HarmonyPatch(typeof(ItemAttributes))] internal class RemoveAttributeStartFunctionRNG { [HarmonyPrefix] [HarmonyPatch("Start")] private static bool stopStartFunctionRNG() { if (SemiFunc.RunIsShop()) { Random.InitState(RepoSeeded.ShopRandom.Next()); } return true; } } [BepInPlugin("Larsielol.RepoSeeded", "RepoSeeded", "2.6.2")] public class RepoSeeded : BaseUnityPlugin { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static Action<string> <>9__37_6; public static ScrollViewBuilderDelegate <>9__37_4; public static ScrollViewBuilderDelegate <>9__37_5; public static Action <>9__37_1; public static BuilderDelegate <>9__37_0; internal void <Start>b__37_0(Transform parent) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) REPOButton val = MenuAPI.CreateREPOButton("Seed menu", (Action)delegate { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Expected O, but got Unknown //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Expected O, but got Unknown //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Expected O, but got Unknown //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Expected O, but got Unknown //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Expected O, but got Unknown <>c__DisplayClass37_0 CS$<>8__locals4 = new <>c__DisplayClass37_0(); REPOPopupPage val3 = MenuAPI.CreateREPOPopupPage("Seed Menu", (PresetSide)0, false, true, 1.5f); CS$<>8__locals4.seedInput = null; val3.AddElementToScrollView((ScrollViewBuilderDelegate)delegate(Transform scrollView) { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) Action<string> obj3 = delegate(string newSeed) { setSeed(newSeed); }; string text = (randomizeSeed ? "Random" : currentSeed); CS$<>8__locals4.seedInput = MenuAPI.CreateREPOInputField("Seed", obj3, scrollView, default(Vector2), false, "", text); return ((REPOElement)CS$<>8__locals4.seedInput).rectTransform; }, 0f, 0f); val3.AddElementToScrollView((ScrollViewBuilderDelegate)delegate(Transform scrollView) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) Action<bool> obj3 = delegate(bool randomize) { RepoSeeded.randomizeSeed = randomize; CS$<>8__locals4.seedInput.inputStringSystem.SetValue(RepoSeeded.randomizeSeed ? "Random" : currentSeed, false); }; bool randomizeSeed = RepoSeeded.randomizeSeed; REPOToggle val6 = MenuAPI.CreateREPOToggle("Randomize seed", obj3, scrollView, default(Vector2), "ON", "OFF", randomizeSeed); return ((REPOElement)val6).rectTransform; }, 0f, 0f); object obj = <>9__37_4; if (obj == null) { ScrollViewBuilderDelegate val4 = delegate(Transform scrollView) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) REPOLabel val6 = MenuAPI.CreateREPOLabel("Recent Seeds", scrollView, default(Vector2)); return ((REPOElement)val6).rectTransform; }; <>9__37_4 = val4; obj = (object)val4; } val3.AddElementToScrollView((ScrollViewBuilderDelegate)obj, 0f, 0f); object obj2 = <>9__37_5; if (obj2 == null) { ScrollViewBuilderDelegate val5 = delegate(Transform scrollView) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) REPOLabel val6 = MenuAPI.CreateREPOLabel("Click to copy", scrollView, default(Vector2)); ((Component)val6).gameObject.transform.localScale = new Vector3(0.6f, 0.6f, 0.6f); return ((REPOElement)val6).rectTransform; }; <>9__37_5 = val5; obj2 = (object)val5; } val3.AddElementToScrollView((ScrollViewBuilderDelegate)obj2, 0f, 0f); List<string> seeds = SeedHistory.getSeeds(); for (int num = seeds.Count - 1; num >= 0; num--) { val3.AddElementToScrollView(new ScrollViewBuilderDelegate(new <>c__DisplayClass37_1 { seed = seeds[num] }.<Start>b__8), 0f, 0f); } val3.OpenPage(false); }, parent, new Vector2(50f, 95f)); Transform val2 = parent.Find("Buttons"); val2 = ((!((Object)(object)val != (Object)null)) ? parent.Find("Menu Button - Tutorial") : val2.Find("Menu Button - Tutorial")); ((Component)val2).gameObject.SetActive(false); } internal void <Start>b__37_1() { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Expected O, but got Unknown //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Expected O, but got Unknown //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Expected O, but got Unknown //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Expected O, but got Unknown //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Expected O, but got Unknown <>c__DisplayClass37_0 CS$<>8__locals4 = new <>c__DisplayClass37_0(); REPOPopupPage val = MenuAPI.CreateREPOPopupPage("Seed Menu", (PresetSide)0, false, true, 1.5f); CS$<>8__locals4.seedInput = null; val.AddElementToScrollView((ScrollViewBuilderDelegate)delegate(Transform scrollView) { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) Action<string> obj3 = delegate(string newSeed) { setSeed(newSeed); }; string text = (randomizeSeed ? "Random" : currentSeed); CS$<>8__locals4.seedInput = MenuAPI.CreateREPOInputField("Seed", obj3, scrollView, default(Vector2), false, "", text); return ((REPOElement)CS$<>8__locals4.seedInput).rectTransform; }, 0f, 0f); val.AddElementToScrollView((ScrollViewBuilderDelegate)delegate(Transform scrollView) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) Action<bool> obj3 = delegate(bool randomize) { RepoSeeded.randomizeSeed = randomize; CS$<>8__locals4.seedInput.inputStringSystem.SetValue(RepoSeeded.randomizeSeed ? "Random" : currentSeed, false); }; bool randomizeSeed = RepoSeeded.randomizeSeed; REPOToggle val4 = MenuAPI.CreateREPOToggle("Randomize seed", obj3, scrollView, default(Vector2), "ON", "OFF", randomizeSeed); return ((REPOElement)val4).rectTransform; }, 0f, 0f); object obj = <>9__37_4; if (obj == null) { ScrollViewBuilderDelegate val2 = delegate(Transform scrollView) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) REPOLabel val4 = MenuAPI.CreateREPOLabel("Recent Seeds", scrollView, default(Vector2)); return ((REPOElement)val4).rectTransform; }; <>9__37_4 = val2; obj = (object)val2; } val.AddElementToScrollView((ScrollViewBuilderDelegate)obj, 0f, 0f); object obj2 = <>9__37_5; if (obj2 == null) { ScrollViewBuilderDelegate val3 = delegate(Transform scrollView) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) REPOLabel val4 = MenuAPI.CreateREPOLabel("Click to copy", scrollView, default(Vector2)); ((Component)val4).gameObject.transform.localScale = new Vector3(0.6f, 0.6f, 0.6f); return ((REPOElement)val4).rectTransform; }; <>9__37_5 = val3; obj2 = (object)val3; } val.AddElementToScrollView((ScrollViewBuilderDelegate)obj2, 0f, 0f); List<string> seeds = SeedHistory.getSeeds(); for (int num = seeds.Count - 1; num >= 0; num--) { val.AddElementToScrollView(new ScrollViewBuilderDelegate(new <>c__DisplayClass37_1 { seed = seeds[num] }.<Start>b__8), 0f, 0f); } val.OpenPage(false); } internal void <Start>b__37_6(string newSeed) { setSeed(newSeed); } internal RectTransform <Start>b__37_4(Transform scrollView) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) REPOLabel val = MenuAPI.CreateREPOLabel("Recent Seeds", scrollView, default(Vector2)); return ((REPOElement)val).rectTransform; } internal RectTransform <Start>b__37_5(Transform scrollView) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) REPOLabel val = MenuAPI.CreateREPOLabel("Click to copy", scrollView, default(Vector2)); ((Component)val).gameObject.transform.localScale = new Vector3(0.6f, 0.6f, 0.6f); return ((REPOElement)val).rectTransform; } } [CompilerGenerated] private sealed class <>c__DisplayClass37_0 { public REPOInputField seedInput; public Action<bool> <>9__7; internal RectTransform <Start>b__2(Transform scrollView) { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) Action<string> obj = delegate(string newSeed) { setSeed(newSeed); }; string text = (randomizeSeed ? "Random" : currentSeed); seedInput = MenuAPI.CreateREPOInputField("Seed", obj, scrollView, default(Vector2), false, "", text); return ((REPOElement)seedInput).rectTransform; } internal RectTransform <Start>b__3(Transform scrollView) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) Action<bool> obj = delegate(bool randomize) { RepoSeeded.randomizeSeed = randomize; seedInput.inputStringSystem.SetValue(RepoSeeded.randomizeSeed ? "Random" : currentSeed, false); }; bool randomizeSeed = RepoSeeded.randomizeSeed; REPOToggle val = MenuAPI.CreateREPOToggle("Randomize seed", obj, scrollView, default(Vector2), "ON", "OFF", randomizeSeed); return ((REPOElement)val).rectTransform; } internal void <Start>b__7(bool randomize) { randomizeSeed = randomize; seedInput.inputStringSystem.SetValue(randomizeSeed ? "Random" : currentSeed, false); } } [CompilerGenerated] private sealed class <>c__DisplayClass37_1 { public string seed; public Action <>9__9; internal RectTransform <Start>b__8(Transform scrollView) { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) REPOButton val = MenuAPI.CreateREPOButton(seed ?? "", (Action)delegate { GUIUtility.systemCopyBuffer = seed; }, scrollView, default(Vector2)); return ((REPOElement)val).rectTransform; } internal void <Start>b__9() { GUIUtility.systemCopyBuffer = seed; } } internal static bool JustHijackedTheSave = true; internal static bool savedSeedToHistory = false; public static bool randomizeSeed = true; internal static Random ValuableTypeRandom = new Random(1); internal static Random ValuableCostRandom = new Random(1); internal static Random LevelRandom = new Random(1); internal static Random ShopRandom = new Random(1); internal static Random shopTemporaryRandom = new Random(1); internal static Random EnemyTypeRandom = new Random(1); internal static Random EnemyOrbRandom = new Random(1); internal static Random TruckTextRandom = new Random(1); internal static Dictionary<EnemyParent, Random> EnemyOrbRandoms = new Dictionary<EnemyParent, Random>(); private static string settingsPath = Path.Combine(Paths.ConfigPath, "SeededSettings.txt"); internal static int ValuableTypeSeed = 1; internal static int ValuableCostSeed = 1; internal static int LevelSeed = 1; internal static int ShopSeed = 1; internal static int EnemyTypeSeed = 1; internal static int EnemyOrbSeed = 1; internal static int TruckTextSeed = 1; public static bool isLibrary = false; public static bool shouldSave = false; public static string currentSeed = "1"; internal static RepoSeeded Instance { get; private set; } = null; internal static ManualLogSource Logger => Instance._logger; private ManualLogSource _logger => ((BaseUnityPlugin)this).Logger; internal Harmony? Harmony { get; set; } public static void setSeed(string seed) { if (randomizeSeed) { seed = Random.Range(int.MinValue, int.MaxValue).ToString(); } SHA256 sHA = SHA256.Create(); currentSeed = seed; seed = seed.Replace(" ", ""); int num = 1; try { num = int.Parse(seed); } catch (FormatException) { byte[] array = sHA.ComputeHash(Encoding.UTF8.GetBytes(seed)); num = BitConverter.ToInt32(array); } ValuableTypeRandom = new Random(num); ValuableCostRandom = new Random(num + 1); LevelRandom = new Random(num + 2); ShopRandom = new Random(num + 3); EnemyTypeRandom = new Random(num + 4); EnemyOrbRandom = new Random(num + 5); TruckTextRandom = new Random(num + 6); if (Object.op_Implicit((Object)(object)RunManager.instance)) { RunManager.instance.enemiesSpawned = new List<EnemySetup>(); } } public static void saveRandoms() { ValuableTypeSeed = ValuableTypeRandom.Next(); ValuableTypeRandom = new Random(ValuableTypeSeed); ValuableCostSeed = ValuableCostRandom.Next(); ValuableCostRandom = new Random(ValuableCostSeed); LevelSeed = LevelRandom.Next(); LevelRandom = new Random(LevelSeed); ShopSeed = ShopRandom.Next(); ShopRandom = new Random(ShopSeed); EnemyTypeSeed = EnemyTypeRandom.Next(); EnemyTypeRandom = new Random(EnemyTypeSeed); EnemyOrbSeed = EnemyOrbRandom.Next(); EnemyOrbRandom = new Random(EnemyOrbSeed); } private void Start() { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Expected O, but got Unknown if (isLibrary) { return; } object obj = <>c.<>9__37_0; if (obj == null) { BuilderDelegate val = delegate(Transform parent) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) REPOButton val2 = MenuAPI.CreateREPOButton("Seed menu", (Action)delegate { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Expected O, but got Unknown //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Expected O, but got Unknown //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Expected O, but got Unknown //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Expected O, but got Unknown //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Expected O, but got Unknown REPOPopupPage val4 = MenuAPI.CreateREPOPopupPage("Seed Menu", (PresetSide)0, false, true, 1.5f); REPOInputField seedInput = null; val4.AddElementToScrollView((ScrollViewBuilderDelegate)delegate(Transform scrollView) { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) Action<string> obj4 = delegate(string newSeed) { setSeed(newSeed); }; string text = (randomizeSeed ? "Random" : currentSeed); seedInput = MenuAPI.CreateREPOInputField("Seed", obj4, scrollView, default(Vector2), false, "", text); return ((REPOElement)seedInput).rectTransform; }, 0f, 0f); val4.AddElementToScrollView((ScrollViewBuilderDelegate)delegate(Transform scrollView) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) Action<bool> obj4 = delegate(bool randomize) { randomizeSeed = randomize; seedInput.inputStringSystem.SetValue(randomizeSeed ? "Random" : currentSeed, false); }; bool flag = randomizeSeed; REPOToggle val7 = MenuAPI.CreateREPOToggle("Randomize seed", obj4, scrollView, default(Vector2), "ON", "OFF", flag); return ((REPOElement)val7).rectTransform; }, 0f, 0f); object obj2 = <>c.<>9__37_4; if (obj2 == null) { ScrollViewBuilderDelegate val5 = delegate(Transform scrollView) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) REPOLabel val7 = MenuAPI.CreateREPOLabel("Recent Seeds", scrollView, default(Vector2)); return ((REPOElement)val7).rectTransform; }; <>c.<>9__37_4 = val5; obj2 = (object)val5; } val4.AddElementToScrollView((ScrollViewBuilderDelegate)obj2, 0f, 0f); object obj3 = <>c.<>9__37_5; if (obj3 == null) { ScrollViewBuilderDelegate val6 = delegate(Transform scrollView) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) REPOLabel val7 = MenuAPI.CreateREPOLabel("Click to copy", scrollView, default(Vector2)); ((Component)val7).gameObject.transform.localScale = new Vector3(0.6f, 0.6f, 0.6f); return ((REPOElement)val7).rectTransform; }; <>c.<>9__37_5 = val6; obj3 = (object)val6; } val4.AddElementToScrollView((ScrollViewBuilderDelegate)obj3, 0f, 0f); List<string> seeds = SeedHistory.getSeeds(); for (int num = seeds.Count - 1; num >= 0; num--) { string seed = seeds[num]; val4.AddElementToScrollView((ScrollViewBuilderDelegate)delegate(Transform scrollView) { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) REPOButton val7 = MenuAPI.CreateREPOButton(seed ?? "", (Action)delegate { GUIUtility.systemCopyBuffer = seed; }, scrollView, default(Vector2)); return ((REPOElement)val7).rectTransform; }, 0f, 0f); } val4.OpenPage(false); }, parent, new Vector2(50f, 95f)); Transform val3 = parent.Find("Buttons"); val3 = ((!((Object)(object)val2 != (Object)null)) ? parent.Find("Menu Button - Tutorial") : val3.Find("Menu Button - Tutorial")); ((Component)val3).gameObject.SetActive(false); }; <>c.<>9__37_0 = val; obj = (object)val; } MenuAPI.AddElementToMainMenu((BuilderDelegate)obj); } private void Awake() { Instance = this; setSeed(currentSeed); ((Component)this).gameObject.transform.parent = null; ((Object)((Component)this).gameObject).hideFlags = (HideFlags)61; List<string> list = new List<string>(); if (File.Exists(settingsPath)) { list = File.ReadAllLines(settingsPath).ToList(); if (list.Count > 0 && !bool.TryParse(list[0], out randomizeSeed)) { randomizeSeed = true; } if (list.Count > 1) { setSeed(list[1]); } } SeedHistory.ReadSeeds(); Patch(); Logger.LogInfo((object)$"{((BaseUnityPlugin)this).Info.Metadata.GUID} v{((BaseUnityPlugin)this).Info.Metadata.Version} has loaded!"); } internal void Patch() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Expected O, but got Unknown //IL_0025: Expected O, but got Unknown if (Harmony == null) { Harmony val = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID); Harmony val2 = val; Harmony = val; } Harmony.PatchAll(); } internal void Unpatch() { Harmony? harmony = Harmony; if (harmony != null) { harmony.UnpatchSelf(); } } internal void OnApplicationQuit() { List<string> contents = new List<string> { randomizeSeed.ToString(), currentSeed }; File.WriteAllLines(settingsPath, contents); } private void Update() { } } [HarmonyPatch(typeof(UpgradeStand))] internal class RerollRNGPatch { private static Dictionary<string, Random> upgradeRandoms = new Dictionary<string, Random>(); [HarmonyPrefix] [HarmonyPatch("StateRerollOpenHatch")] private static void fixRerollRNG() { Random.InitState(RepoSeeded.shopTemporaryRandom.Next()); } [HarmonyPrefix] [HarmonyPatch("GetWeightedUpgradeExcluding")] private static bool fixDictRNG(Item excludeItem, Dictionary<string, int> displayedCounts, Dictionary<string, int> selectedDuringReroll, ref Item? __result, bool secondAttempt = false) { //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Invalid comparison between Unknown and I4 List<Item> list = new List<Item>(); foreach (Item item in from i in StatsManager.instance.itemDictionary.Values orderby (Object)(object)i == (Object)(object)excludeItem, i.itemName, i.itemType, i.value.valueMax select i) { if ((int)item.itemType == 3 && (secondAttempt || !(((Object)item).name == ((Object)excludeItem).name))) { list.Add(item); } } if (!secondAttempt) { upgradeRandoms.TryGetValue(((Object)excludeItem).name, out Random value); Random.InitState(value.Next()); } if (list.Count == 0) { if (!secondAttempt) { fixDictRNG(excludeItem, displayedCounts, selectedDuringReroll, ref __result, secondAttempt: true); return false; } __result = null; return false; } if (secondAttempt && list.Count > 1 && list.Contains(excludeItem)) { list.Remove(excludeItem); } __result = list[Random.Range(0, list.Count)]; return false; } [HarmonyPrefix] [HarmonyPatch("SpawnNewUpgrades")] private static bool fixCacheDictRNG(UpgradeStand __instance) { //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_043e: Unknown result type (might be due to invalid IL or missing references) //IL_0443: Unknown result type (might be due to invalid IL or missing references) //IL_0572: Unknown result type (might be due to invalid IL or missing references) //IL_0574: Unknown result type (might be due to invalid IL or missing references) //IL_0579: Unknown result type (might be due to invalid IL or missing references) //IL_057b: Unknown result type (might be due to invalid IL or missing references) //IL_054e: Unknown result type (might be due to invalid IL or missing references) //IL_0550: Unknown result type (might be due to invalid IL or missing references) //IL_0555: Unknown result type (might be due to invalid IL or missing references) //IL_0557: Unknown result type (might be due to invalid IL or missing references) //IL_049d: Unknown result type (might be due to invalid IL or missing references) //IL_049f: Unknown result type (might be due to invalid IL or missing references) //IL_04ba: Unknown result type (might be due to invalid IL or missing references) //IL_04d3: Unknown result type (might be due to invalid IL or missing references) //IL_04d8: Unknown result type (might be due to invalid IL or missing references) //IL_052a: Unknown result type (might be due to invalid IL or missing references) //IL_052c: Unknown result type (might be due to invalid IL or missing references) //IL_0531: Unknown result type (might be due to invalid IL or missing references) //IL_050b: Unknown result type (might be due to invalid IL or missing references) //IL_050d: Unknown result type (might be due to invalid IL or missing references) //IL_0512: Unknown result type (might be due to invalid IL or missing references) __instance.cachedUpgrades.Sort(delegate(CachedUpgrade a, CachedUpgrade b) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) int num13 = string.Compare(((Object)a.itemData).name, ((Object)b.itemData).name); if (num13 == 0) { ref itemType itemType = ref a.itemData.itemType; object target = b.itemData.itemType; num13 = ((Enum)Unsafe.As<itemType, itemType>(ref itemType)/*cast due to .constrained prefix*/).CompareTo(target); } if (num13 == 0) { num13 = a.itemData.value.valueMax.CompareTo(b.itemData.value.valueMax); } return num13; }); Random.InitState(RepoSeeded.shopTemporaryRandom.Next()); List<Item> list = new List<Item>(); List<Item> list2 = new List<Item>(); foreach (CachedUpgrade cachedUpgrade in __instance.cachedUpgrades) { list.Add(cachedUpgrade.itemData); list2.Add(cachedUpgrade.itemData); } Dictionary<string, int> currentlyDisplayedUpgradeCounts = __instance.GetCurrentlyDisplayedUpgradeCounts(list); Dictionary<string, int> dictionary = new Dictionary<string, int>(); int num = 0; while (__instance.cachedUpgrades.Count > 0) { num++; for (int num2 = 0; num2 < list2.Count; num2++) { Item val = list2[num2]; ((Object)val).name = ((Object)val).name.Replace(" SeededReroll", ""); Item weightedUpgradeExcluding = __instance.GetWeightedUpgradeExcluding(val, currentlyDisplayedUpgradeCounts, dictionary, false); if ((Object)(object)weightedUpgradeExcluding != (Object)null) { list2[num2] = weightedUpgradeExcluding; } } bool flag = true; for (int num3 = 0; num3 < list2.Count; num3++) { Item val2 = list2[num3]; string name = ((Object)val2).name; dictionary.TryAdd(name, 0); dictionary[name]++; int num4 = SemiFunc.StatGetItemsPurchased(name); int num5 = (currentlyDisplayedUpgradeCounts.ContainsKey(name) ? currentlyDisplayedUpgradeCounts[name] : 0); int num6 = DictionaryExtensions.Get<string, int>((IDictionary<string, int>)dictionary, name, 0) - 1; int num7 = num5 + num5 + num6; if ((val2.maxAmountInShop <= 0 || num7 < val2.maxAmountInShop) && (!val2.maxPurchase || StatsManager.instance.GetItemsUpgradesPurchasedTotal(name) < val2.maxPurchaseAmount) && (val2.minPlayerCount <= 1 || GameDirector.instance.PlayerList.Count >= val2.minPlayerCount)) { continue; } bool flag2 = false; bool flag3 = false; foreach (Item value2 in StatsManager.instance.itemDictionary.Values) { string name2 = ((Object)value2).name; int num8 = SemiFunc.StatGetItemsPurchased(((Object)value2).name); int num9 = (currentlyDisplayedUpgradeCounts.ContainsKey(name2) ? currentlyDisplayedUpgradeCounts[name2] : 0); int num10 = DictionaryExtensions.Get<string, int>((IDictionary<string, int>)dictionary, ((Object)value2).name, 0); int num11 = num9 + num9 + num10; if ((value2.maxAmountInShop <= 0 || num11 < value2.maxAmountInShop) && (!value2.maxPurchase || StatsManager.instance.GetItemsUpgradesPurchasedTotal(name2) < value2.maxPurchaseAmount) && (value2.minPlayerCount <= 1 || GameDirector.instance.PlayerList.Count >= value2.minPlayerCount)) { if ((Object)(object)value2 != (Object)(object)val2) { flag2 = true; break; } flag3 = true; } } if (!flag2 && !flag3) { list2.RemoveAt(num3); __instance.cachedUpgrades.RemoveAt(num3); dictionary[name]--; num3--; continue; } if (flag3 && !flag2) { dictionary[name]--; int index = num3; Item value = (list2[num3] = Object.Instantiate<Item>(list2[num3])); list2[index] = value; ((Object)list2[num3]).name = "BLOCKED!"; } else if (flag2) { dictionary[name]--; Item val4 = Object.Instantiate<Item>(list2[num3]); ((Object)val4).name = ((Object)list2[num3]).name + " SeededReroll"; list2[num3] = val4; } flag = false; } for (int num12 = 0; num12 < list2.Count; num12++) { if ((Object)(object)list2[num12] == (Object)null || ((Object)list2[num12]).name == "BLOCKED!" || ((Object)list2[num12]).name.EndsWith(" SeededReroll")) { continue; } CachedUpgrade val5 = __instance.cachedUpgrades[num12]; Item val6 = list2[num12]; if ((Object)(object)ShopManager.instance != (Object)null && (Object)(object)ShopManager.instance.itemRotateHelper != (Object)null) { ((Component)ShopManager.instance.itemRotateHelper).transform.parent = ((Component)__instance).transform; ((Component)ShopManager.instance.itemRotateHelper).transform.position = val5.position; ((Component)ShopManager.instance.itemRotateHelper).transform.localRotation = val6.spawnRotationOffset; Quaternion rotation = ((Component)ShopManager.instance.itemRotateHelper).transform.rotation; ((Component)ShopManager.instance.itemRotateHelper).transform.parent = ((Component)ShopManager.instance).transform; if (SemiFunc.IsMultiplayer()) { PhotonNetwork.InstantiateRoomObject(((PrefabRef<GameObject>)(object)val6.prefab).ResourcePath, val5.position, rotation, (byte)0, (object[])null); } else { Object.Instantiate<GameObject>(((PrefabRef<GameObject>)(object)val6.prefab).Prefab, val5.position, rotation); } } else if (SemiFunc.IsMultiplayer()) { PhotonNetwork.InstantiateRoomObject(((PrefabRef<GameObject>)(object)val6.prefab).ResourcePath, val5.position, val5.rotation, (byte)0, (object[])null); } else { Object.Instantiate<GameObject>(((PrefabRef<GameObject>)(object)val6.prefab).Prefab, val5.position, val5.rotation); } list2.RemoveAt(num12); __instance.cachedUpgrades.RemoveAt(num12); num12--; } } return false; } private static void printListOfItems(List<Item> list) { foreach (Item item in list) { if ((Object)(object)item == (Object)null) { Debug.Log((object)"NULL"); } else { Debug.Log((object)((Object)item).name); } } } [HarmonyPrefix] [HarmonyPatch("StatePressSucceed")] private static void fixButtonBreakRNG() { Random.InitState(RepoSeeded.shopTemporaryRandom.Next()); } [HarmonyPrefix] [HarmonyPatch("Start")] private static void createUpgradeRandoms() { //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Invalid comparison between Unknown and I4 upgradeRandoms.Clear(); foreach (Item item in StatsManager.instance.itemDictionary.Values.OrderBy((Item i) => ((Object)i).name)) { if ((int)item.itemType == 3) { upgradeRandoms.TryAdd(((Object)item).name, new Random(RepoSeeded.shopTemporaryRandom.Next())); } } } } [HarmonyPatch(typeof(MenuPageSaves))] internal static class RNGSetterOnGameStart { [HarmonyPrefix] [HarmonyPatch("OnNewGame")] private static void setSeedOnNewGame() { RepoSeeded.setSeed(RepoSeeded.currentSeed); RepoSeeded.JustHijackedTheSave = true; RepoSeeded.savedSeedToHistory = false; } } [HarmonyPatch(typeof(MenuPageLobby))] internal static class RNGSetterOnGameHost { [HarmonyPrefix] [HarmonyPatch("ButtonStart")] private static void OnHostGame() { RepoSeeded.setSeed(RepoSeeded.currentSeed); RepoSeeded.JustHijackedTheSave = true; RepoSeeded.savedSeedToHistory = false; } } [HarmonyPatch(typeof(StatsManager))] internal static class SaveHijack { private const string saveName = "R.E.P.O. SEEDED"; public static Level previousLevel = null; private static StatsManager sm = StatsManager.instance; [HarmonyPrefix] [HarmonyPatch("SaveGame")] private static bool InjectOwnRNGSaveData(ref string fileName) { //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Expected O, but got Unknown //IL_011c: Unknown result type (might be due to invalid IL or missing references) if (RepoSeeded.isLibrary && !RepoSeeded.shouldSave) { return false; } if (string.IsNullOrEmpty(fileName) || !SemiFunc.IsMasterClientOrSingleplayer()) { return false; } sm.dateAndTime = DateTime.Now.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture); string text = Application.persistentDataPath + "/saves"; if (!Directory.Exists(text)) { Directory.CreateDirectory(text); } string text2 = text + "/" + fileName; if (!Directory.Exists(text2)) { Directory.CreateDirectory(text2); } string text3 = text2 + "/" + fileName + ".es3"; if (File.Exists(text3)) { StatsManager obj = sm; obj.backupIndex++; string text4 = text2 + "/" + fileName + "_BACKUP" + sm.backupIndex + ".es3"; if (File.Exists(text4)) { File.Delete(text4); } File.Move(text3, text4); } ES3Settings val = new ES3Settings(new Enum[1] { (Enum)(object)(Location)4 }); val.encryptionType = (EncryptionType)1; val.encryptionPassword = sm.totallyNormalString; val.path = text3; ES3.Save<string>("teamName", "R.E.P.O. SEEDED", val); ES3.Save<bool>("teamNameChanged", sm.teamNameChanged, val); ES3.Save<string>("dateAndTime", "Seed: " + RepoSeeded.currentSeed, val); ES3.Save<float>("timePlayed", sm.timePlayed, val); ES3.Save<Dictionary<string, string>>("playerNames", sm.playerNames, val); ES3.Save<int>("ValuableTypeRandom", RepoSeeded.ValuableTypeSeed, val); ES3.Save<int>("ValuableCostRandom", RepoSeeded.ValuableCostSeed, val); ES3.Save<int>("LevelRandom", RepoSeeded.LevelSeed, val); ES3.Save<int>("ShopRandom", RepoSeeded.ShopSeed, val); ES3.Save<int>("EnemyTypeRandom", RepoSeeded.EnemyTypeSeed, val); ES3.Save<int>("EnemyOrbRandom", RepoSeeded.EnemyOrbSeed, val); ES3.Save<int>("TruckTextRandom", RepoSeeded.TruckTextSeed, val); if ((Object)(object)previousLevel != (Object)null) { ES3.Save<string>("PreviousLevel", previousLevel.NarrativeName, val); } ES3.Save<int>("BadLuckCount", RunManager.instance.cosmeticWorldObjectBadLuckCount, val); ES3.Save<List<string>>("EnemiesSpawned", RunManager.instance.enemiesSpawned.Select((EnemySetup e) => ((Object)e).name).ToList(), val); Dictionary<string, Dictionary<string, int>> dictionary = new Dictionary<string, Dictionary<string, int>>(); foreach (KeyValuePair<string, Dictionary<string, int>> dictionaryOfDictionary in sm.dictionaryOfDictionaries) { if (sm.doNotSaveTheseDictionaries.Contains(dictionaryOfDictionary.Key)) { continue; } if (sm.stripTheseDictionaries.TryGetValue(dictionaryOfDictionary.Key, out var value)) { Dictionary<string, int> dictionary2 = new Dictionary<string, int>(); foreach (KeyValuePair<string, int> item in dictionaryOfDictionary.Value) { if (value != item.Value) { dictionary2[item.Key] = item.Value; } else { dictionary2.Remove(item.Key); } } dictionary[dictionaryOfDictionary.Key] = dictionary2; } else { dictionary[dictionaryOfDictionary.Key] = dictionaryOfDictionary.Value; } } ES3.Save<Dictionary<string, Dictionary<string, int>>>("dictionaryOfDictionaries", dictionary, val); ES3.Save<int>("saveVersion", sm.saveVersion, val); ES3.StoreCachedFile(val); return false; } [HarmonyPostfix] [HarmonyPatch("LoadGame")] public static void GetInjectedSaveData(string fileName, ref List<string> backupList) { //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Expected O, but got Unknown if (!SemiFunc.IsMasterClientOrSingleplayer()) { return; } string text = Application.persistentDataPath + "/saves/" + fileName + "/" + fileName + ".es3"; if (File.Exists(text)) { sm.saveFileCurrent = fileName; ES3Settings val = new ES3Settings(text, (EncryptionType)1, sm.totallyNormalString, (ES3Settings)null); sm.teamName = ES3.Load<string>("teamName", (string)null, "R.E.P.O.", val); sm.teamNameChanged = ES3.Load<bool>("teamNameChanged", (string)null, sm.teamName != "R.E.P.O.", val); sm.dateAndTime = ES3.Load<string>("dateAndTime", (string)null, DateTime.Now.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture), val); sm.timePlayed = ES3.Load<float>("timePlayed", (string)null, 0f, val); sm.playerNames = ES3.Load<Dictionary<string, string>>("playerNames", (string)null, new Dictionary<string, string>(), val); sm.saveVersion = ES3.Load<int>("saveVersion", (string)null, 0, val); if (sm.teamName == "R.E.P.O. SEEDED") { RepoSeeded.currentSeed = sm.dateAndTime.Substring(6); RepoSeeded.ValuableTypeSeed = ES3.Load<int>("ValuableTypeRandom", (string)null, -1, val); RepoSeeded.ValuableTypeRandom = new Random(RepoSeeded.ValuableTypeSeed); RepoSeeded.ValuableCostSeed = ES3.Load<int>("ValuableCostRandom", (string)null, -1, val); RepoSeeded.ValuableCostRandom = new Random(RepoSeeded.ValuableCostSeed); RepoSeeded.LevelSeed = ES3.Load<int>("LevelRandom", (string)null, -1, val); RepoSeeded.LevelRandom = new Random(RepoSeeded.LevelSeed); RepoSeeded.ShopSeed = ES3.Load<int>("ShopRandom", (string)null, -1, val); RepoSeeded.ShopRandom = new Random(RepoSeeded.ShopSeed); RepoSeeded.EnemyTypeSeed = ES3.Load<int>("EnemyTypeRandom", (string)null, -1, val); RepoSeeded.TruckTextSeed = ES3.Load<int>("TruckTextRandom", (string)null, -1, val); RepoSeeded.TruckTextRandom = new Random(RepoSeeded.TruckTextSeed); RepoSeeded.EnemyTypeRandom = new Random(RepoSeeded.EnemyTypeSeed); RepoSeeded.EnemyOrbSeed = ES3.Load<int>("EnemyOrbRandom", (string)null, -1, val); RepoSeeded.EnemyOrbRandom = new Random(RepoSeeded.EnemyOrbSeed); string prevLevelName = ES3.Load<string>("PreviousLevel", (string)null, val); RunManager.instance.previousRunLevel = RunManager.instance.levels.Find((Level x) => x.NarrativeName == prevLevelName); RunManager.instance.cosmeticWorldObjectBadLuckCount = ES3.Load<int>("BadLuckCount", 0, val); List<string> list = ES3.Load<List<string>>("EnemiesSpawned", new List<string>(), val); RunManager.instance.enemiesSpawned = new List<EnemySetup>(); foreach (string name in list) { EnemySetup val2 = EnemyDirector.instance.enemiesDifficulty1.Find((EnemySetup x) => ((Object)x).name == name); if ((Object)(object)val2 != (Object)null) { RunManager.instance.enemiesSpawned.Add(val2); } val2 = EnemyDirector.instance.enemiesDifficulty2.Find((EnemySetup x) => ((Object)x).name == name); if ((Object)(object)val2 != (Object)null) { RunManager.instance.enemiesSpawned.Add(val2); } val2 = EnemyDirector.instance.enemiesDifficulty3.Find((EnemySetup x) => ((Object)x).name == name); if ((Object)(object)val2 != (Object)null) { RunManager.instance.enemiesSpawned.Add(val2); } } RepoSeeded.JustHijackedTheSave = true; } foreach (KeyValuePair<string, Dictionary<string, int>> item in ES3.Load<Dictionary<string, Dictionary<string, int>>>("dictionaryOfDictionaries", (string)null, new Dictionary<string, Dictionary<string, int>>(), val)) { if (sm.doNotSaveTheseDictionaries.Contains(item.Key)) { continue; } if (sm.dictionaryOfDictionaries.TryGetValue(item.Key, out var value)) { foreach (KeyValuePair<string, int> item2 in item.Value) { if (!sm.stripTheseDictionaries.ContainsKey(item.Key) || sm.stripTheseDictionaries[item.Key] != item2.Value) { value[item2.Key] = item2.Value; } else { value.Remove(item2.Key); } } } else { Debug.LogWarning((object)("dictionaryOfDictionaries does not contain key '" + item.Key + "'.")); sm.dictionaryOfDictionaries.Add(item.Key, new Dictionary<string, int>(item.Value)); } } if (sm.saveVersion < 1) { foreach (string item3 in sm.itemStatBattery.Keys.Where((string key) => !key.Contains("/")).ToList()) { sm.itemStatBattery.Remove(item3); } foreach (string item4 in sm.item.Keys.Where((string key) => !sm.itemStatBattery.ContainsKey(key)).ToList()) { sm.item.Remove(item4); } } } else { sm.teamName = "R.E.P.O."; sm.teamNameChanged = false; Debug.LogWarning((object)("Save file not found in " + text)); } sm.saveVersion = sm.latestSaveVersion; RunManager.instance.levelsCompleted = sm.GetRunStatLevel(); RunManager.instance.runLives = sm.GetRunStatLives(); RunManager.instance.loadLevel = sm.GetRunStatSaveLevel(); sm.PlayersAddAll(); if (backupList == null) { backupList = sm.SaveFileGetBackups(fileName, Application.persistentDataPath + "/saves"); } if (backupList.Count > 0) { Match match = Regex.Match(backupList[0], "_BACKUP(\\d+)$"); sm.backupIndex = (match.Success ? int.Parse(match.Groups[1].Value) : 0); } else { sm.backupIndex = 0; } sm.saveFileReady = true; } } internal static class SeedHistory { private const int MAX_SEEDS = 10; private static string seedHistoryPath = Path.Combine(Paths.ConfigPath, "SeedHistory.txt"); private static List<string> seeds = new List<string>(); internal static void ReadSeeds() { if (File.Exists(seedHistoryPath)) { seeds = File.ReadAllLines(seedHistoryPath).ToList(); } } private static void saveSeeds() { File.WriteAllLines(seedHistoryPath, seeds); } internal static void addSeed(string seed) { seeds.Remove(seed); seeds.Add(seed); if (seeds.Count > 10) { seeds.Remove(seeds[0]); } saveSeeds(); } internal static List<string> getSeeds() { return seeds; } } [HarmonyPatch(typeof(RunManager))] internal static class SetNewSeedToPreviousSeed { [HarmonyPostfix] [HarmonyPatch("ResetProgress")] private static void setSeedOnNewAutoRun() { RepoSeeded.setSeed(RepoSeeded.currentSeed); RepoSeeded.JustHijackedTheSave = true; RepoSeeded.savedSeedToHistory = false; } [HarmonyPostfix] [HarmonyPatch("LeaveToMainMenu")] private static void setSeedWhenBackToMenu() { RepoSeeded.setSeed(RepoSeeded.currentSeed); RepoSeeded.JustHijackedTheSave = true; RepoSeeded.savedSeedToHistory = false; } } [HarmonyPatch(typeof(ShopManager))] internal static class ShopRNGPatch { private const string placeholderName = "REPOSEEDED PLACEHOLDER"; private static ShopManager sm = ShopManager.instance; [HarmonyPatch("GetAllItemsFromStatsManager")] [HarmonyPrefix] private static bool GetAlllItemsPrefix() { //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Invalid comparison between Unknown and I4 //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Invalid comparison between Unknown and I4 //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Invalid comparison between Unknown and I4 //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Invalid comparison between Unknown and I4 //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Invalid comparison between Unknown and I4 //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Invalid comparison between Unknown and I4 //IL_0206: Unknown result type (might be due to invalid IL or missing references) //IL_022b: Unknown result type (might be due to invalid IL or missing references) //IL_025c: Unknown result type (might be due to invalid IL or missing references) //IL_0242: Unknown result type (might be due to invalid IL or missing references) int num = RepoSeeded.ShopRandom.Next(); Random.InitState(num); if (SemiFunc.IsNotMasterClient()) { return false; } sm.potentialItems.Clear(); sm.potentialItemConsumables.Clear(); sm.potentialItemUpgrades.Clear(); sm.potentialItemHealthPacks.Clear(); sm.potentialSecretItems.Clear(); sm.itemConsumablesAmount = Random.Range(4, 6); Item[] array = sortItemsOnName(StatsManager.instance.itemDictionary.Values); foreach (Item val in array) { Item val2 = val; int num2 = SemiFunc.StatGetItemsPurchased(((Object)val2).name); float num3 = val2.value.valueMax / 1000f * sm.itemValueMultiplier; if ((int)val2.itemType == 3) { num3 = sm.UpgradeValueGet(num3, val2); } else if ((int)val2.itemType == 8) { num3 = sm.HealthPackValueGet(num3); } else if ((int)val2.itemType == 5) { num3 = sm.CrystalValueGet(num3); } float num4 = Mathf.Clamp(num3, 1f, num3); bool flag = (int)val2.itemType == 5; bool flag2 = (int)val2.itemType == 3; bool flag3 = (int)val2.itemType == 8; int maxAmountInShop = val2.maxAmountInShop; if (num2 >= maxAmountInShop || (val2.maxPurchase && StatsManager.instance.GetItemsUpgradesPurchasedTotal(((Object)val2).name) >= val2.maxPurchaseAmount) || (val2.minPlayerCount > 1 && GameDirector.instance.PlayerList.Count < val2.minPlayerCount)) { val2 = null; } for (int j = 0; j < maxAmountInShop; j++) { if ((Object)(object)val2 != (Object)null && j >= maxAmountInShop - num2) { val2 = null; } if (flag2) { sm.potentialItemUpgrades.Add(val2); continue; } if (flag3) { sm.potentialItemHealthPacks.Add(val2); continue; } if (flag) { sm.potentialItemConsumables.Add(val2); continue; } if ((int)val.itemSecretShopType == 0) { sm.potentialItems.Add(val2); continue; } if (!sm.potentialSecretItems.ContainsKey(val.itemSecretShopType)) { sm.potentialSecretItems.Add(val.itemSecretShopType, new List<Item>()); } sm.potentialSecretItems[val.itemSecretShopType].Add(val2); } } ListExtension.Shuffle<Item>((IList<Item>)sm.potentialItems); for (int num5 = sm.potentialItems.Count - 1; num5 >= 0; num5--) { if ((Object)(object)sm.potentialItems[num5] == (Object)null) { sm.potentialItems.RemoveAt(num5); } } ListExtension.Shuffle<Item>((IList<Item>)sm.potentialItemConsumables); for (int num6 = sm.potentialItemConsumables.Count - 1; num6 >= 0; num6--) { if ((Object)(object)sm.potentialItemConsumables[num6] == (Object)null) { sm.potentialItemConsumables.RemoveAt(num6); } } ListExtension.Shuffle<Item>((IList<Item>)sm.potentialItemUpgrades); for (int num7 = sm.potentialItemUpgrades.Count - 1; num7 >= 0; num7--) { if ((Object)(object)sm.potentialItemUpgrades[num7] == (Object)null) { sm.potentialItemUpgrades.RemoveAt(num7); } } ListExtension.Shuffle<Item>((IList<Item>)sm.potentialItemHealthPacks); for (int num8 = sm.potentialItemHealthPacks.Count - 1; num8 >= 0; num8--) { if ((Object)(object)sm.potentialItemHealthPacks[num8] == (Object)null) { sm.potentialItemHealthPacks.RemoveAt(num8); } } foreach (List<Item> value in sm.potentialSecretItems.Values) { ListExtension.Shuffle<Item>((IList<Item>)value); for (int num9 = value.Count - 1; num9 >= 0; num9--) { if ((Object)(object)value[num9] == (Object)null) { value.RemoveAt(num9); } } } return false; } [HarmonyPatch("GetAllItemVolumesInScene")] [HarmonyPrefix] private static bool GetAllVolumesPrefix() { //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) Random.InitState(RepoSeeded.ShopRandom.Next()); if (SemiFunc.IsNotMasterClient()) { return false; } sm.itemVolumes.Clear(); sm.secretItemVolumes.Clear(); ItemVolume[] array = Object.FindObjectsByType<ItemVolume>((FindObjectsSortMode)0); sortVolumesOnLocation(array); ItemVolume[] array2 = array; foreach (ItemVolume val in array2) { if ((int)val.itemSecretShopType == 0) { sm.itemVolumes.Add(val); continue; } if (!sm.secretItemVolumes.ContainsKey(val.itemSecretShopType)) { sm.secretItemVolumes.Add(val.itemSecretShopType, new List<ItemVolume>()); } sm.secretItemVolumes[val.itemSecretShopType].Add(val); } foreach (List<ItemVolume> value in sm.secretItemVolumes.Values) { ListExtension.Shuffle<ItemVolume>((IList<ItemVolume>)value); } ListExtension.Shuffle<ItemVolume>((IList<ItemVolume>)sm.itemVolumes); return false; } public static void sortVolumesOnLocation(ItemVolume[] volumes) { Array.Sort(volumes, delegate(ItemVolume a, ItemVolume b) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) Vector3 val = new Vector3(0f, 0f, 0f) - ((Component)a).transform.position; float sqrMagnitude = ((Vector3)(ref val)).sqrMagnitude; val = new Vector3(0f, 0f, 0f) - ((Component)b).transform.position; return sqrMagnitude.CompareTo(((Vector3)(ref val)).sqrMagnitude); }); } public static Item[] sortItemsOnName(IEnumerable<Item> items) { Item[] array = items.ToArray(); Array.Sort(array, (Item a, Item b) => a.itemName.CompareTo(b.itemName)); return array; } } [HarmonyPatch(typeof(TruckScreenText))] internal static class TruckTextRNGPatch { [HarmonyPrefix] [HarmonyPatch("NextLine")] private static bool RemoveTruckTextRNG(TruckScreenText __instance, ref int _currentLineIndex) { Random.InitState(RepoSeeded.TruckTextRandom.Next()); return true; } } internal static class ValuableCostsRNGPatch { [HarmonyPatch("DollarValueSetLogic")] [HarmonyPrefix] private static bool RemoveValueRNG(ref Rigidbody ___rb) { return true; } } [HarmonyPatch(typeof(ValuableDirector))] internal static class ValuableTypesRNGPatch { [HarmonyPrefix] [HarmonyPatch("SetupHost")] private static bool ValuablesRNGSeeder(ref IEnumerator __result) { __result = newSetupHost(); return false; } private static IEnumerator newSetupHost() { ValuableDirector vd = ValuableDirector.instance; if (SemiFunc.RunGetDifficultyMultiplier2() > 0f && !SemiFunc.RunIsArena()) { float num = SemiFunc.RunGetDifficultyMultiplier2(); vd.totalMaxValue = Mathf.RoundToInt(vd.totalMaxValueCurve2.Evaluate(num)); vd.tinyMaxAmount = Mathf.RoundToInt(vd.tinyMaxAmountCurve2.Evaluate(num)); vd.smallMaxAmount = Mathf.RoundToInt(vd.smallMaxAmountCurve2.Evaluate(num)); vd.mediumMaxAmount = Mathf.RoundToInt(vd.mediumMaxAmountCurve2.Evaluate(num)); vd.bigMaxAmount = Mathf.RoundToInt(vd.bigMaxAmountCurve2.Evaluate(num)); vd.wideMaxAmount = Mathf.RoundToInt(vd.wideMaxAmountCurve2.Evaluate(num)); vd.tallMaxAmount = Mathf.RoundToInt(vd.tallMaxAmountCurve2.Evaluate(num)); vd.veryTallMaxAmount = Mathf.RoundToInt(vd.veryTallMaxAmountCurve2.Evaluate(num)); } else { float num2 = SemiFunc.RunGetDifficultyMultiplier1(); if (SemiFunc.RunIsArena()) { num2 = 0.75f; } vd.totalMaxValue = Mathf.RoundToInt(vd.totalMaxValueCurve1.Evaluate(num2)); vd.tinyMaxAmount = Mathf.RoundToInt(vd.tinyMaxAmountCurve1.Evaluate(num2)); vd.smallMaxAmount = Mathf.RoundToInt(vd.smallMaxAmountCurve1.Evaluate(num2)); vd.mediumMaxAmount = Mathf.RoundToInt(vd.mediumMaxAmountCurve1.Evaluate(num2)); vd.bigMaxAmount = Mathf.RoundToInt(vd.bigMaxAmountCurve1.Evaluate(num2)); vd.wideMaxAmount = Mathf.RoundToInt(vd.wideMaxAmountCurve1.Evaluate(num2)); vd.tallMaxAmount = Mathf.RoundToInt(vd.tallMaxAmountCurve1.Evaluate(num2)); vd.veryTallMaxAmount = Mathf.RoundToInt(vd.veryTallMaxAmountCurve1.Evaluate(num2)); } if (SemiFunc.RunIsArena()) { vd.totalMaxAmount /= 2; vd.tinyMaxAmount /= 3; vd.smallMaxAmount /= 3; vd.mediumMaxAmount /= 3; vd.bigMaxAmount /= 3; vd.wideMaxAmount /= 2; vd.tallMaxAmount /= 2; vd.veryTallMaxAmount /= 2; } foreach (LevelValuables valuablePreset in LevelGenerator.Instance.Level.ValuablePresets) { vd.tinyValuables.AddRange(valuablePreset.tiny); vd.smallValuables.AddRange(valuablePreset.small); vd.mediumValuables.AddRange(valuablePreset.medium); vd.bigValuables.AddRange(valuablePreset.big); vd.wideValuables.AddRange(valuablePreset.wide); vd.tallValuables.AddRange(valuablePreset.tall); vd.veryTallValuables.AddRange(valuablePreset.veryTall); } List<ValuableVolume> list = Object.FindObjectsByType<ValuableVolume>((FindObjectsInactive)0, (FindObjectsSortMode)0).ToList(); sortVolumesOnLocation(list); Random.InitState(RepoSeeded.ValuableTypeRandom.Next()); vd.tinyVolumes = list.FindAll((ValuableVolume x) => (int)x.VolumeType == 0); ListExtension.Shuffle<ValuableVolume>((IList<ValuableVolume>)vd.tinyVolumes); vd.smallVolumes = list.FindAll((ValuableVolume x) => (int)x.VolumeType == 1); ListExtension.Shuffle<ValuableVolume>((IList<ValuableVolume>)vd.smallVolumes); vd.mediumVolumes = list.FindAll((ValuableVolume x) => (int)x.VolumeType == 2); ListExtension.Shuffle<ValuableVolume>((IList<ValuableVolume>)vd.mediumVolumes); vd.bigVolumes = list.FindAll((ValuableVolume x) => (int)x.VolumeType == 3); ListExtension.Shuffle<ValuableVolume>((IList<ValuableVolume>)vd.bigVolumes); vd.wideVolumes = list.FindAll((ValuableVolume x) => (int)x.VolumeType == 4); ListExtension.Shuffle<ValuableVolume>((IList<ValuableVolume>)vd.wideVolumes); vd.tallVolumes = list.FindAll((ValuableVolume x) => (int)x.VolumeType == 5); ListExtension.Shuffle<ValuableVolume>((IList<ValuableVolume>)vd.tallVolumes); vd.veryTallVolumes = list.FindAll((ValuableVolume x) => (int)x.VolumeType == 6); ListExtension.Shuffle<ValuableVolume>((IList<ValuableVolume>)vd.veryTallVolumes); if ((int)vd.valuableDebug == 1) { vd.totalMaxAmount = list.Count; vd.totalMaxValue = 99999f; vd.tinyMaxAmount = vd.tinyVolumes.Count; vd.smallMaxAmount = vd.smallVolumes.Count; vd.mediumMaxAmount = vd.mediumVolumes.Count; vd.bigMaxAmount = vd.bigVolumes.Count; vd.wideMaxAmount = vd.wideVolumes.Count; vd.tallMaxAmount = vd.tallVolumes.Count; vd.veryTallMaxAmount = vd.veryTallVolumes.Count; } if ((int)vd.valuableDebug == 2 || LevelGenerator.Instance.Level.ValuablePresets.Count <= 0) { vd.totalMaxAmount = 0; vd.tinyMaxAmount = 0; vd.smallMaxAmount = 0; vd.mediumMaxAmount = 0; vd.bigMaxAmount = 0; vd.wideMaxAmount = 0; vd.tallMaxAmount = 0; vd.veryTallMaxAmount = 0; } vd.valuableTargetAmount = 0; string[] _names = new string[7] { "Tiny", "Small", "Medium", "Big", "Wide", "Tall", "Very Tall" }; int[] _maxAmount = new int[7] { vd.tinyMaxAmount, vd.smallMaxAmount, vd.mediumMaxAmount, vd.bigMaxAmount, vd.wideMaxAmount, vd.tallMaxAmount, vd.veryTallMaxAmount }; List<ValuableVolume>[] _volumes = new List<ValuableVolume>[7] { vd.tinyVolumes, vd.smallVolumes, vd.mediumVolumes, vd.bigVolumes, vd.wideVolumes, vd.tallVolumes, vd.veryTallVolumes }; string[] _path = new string[7] { vd.tinyPath, vd.smallPath, vd.mediumPath, vd.bigPath, vd.widePath, vd.tallPath, vd.veryTallPath }; int[] _chance = new int[7] { vd.tinyChance, vd.smallChance, vd.mediumChance, vd.bigChance, vd.wideChance, vd.tallChance, vd.veryTallChance }; List<PrefabRef>[] _valuables = new List<PrefabRef>[7] { vd.tinyValuables, vd.smallValuables, vd.mediumValuables, vd.bigValuables, vd.wideValuables, vd.tallValuables, vd.veryTallValuables }; int[] _volumeIndex = new int[7]; for (int _i = 0; _i < vd.totalMaxAmount; _i++) { Random.InitState(RepoSeeded.ValuableTypeRandom.Next()); float num3 = -1f; int num4 = -1; for (int num5 = 0; num5 < _names.Length; num5++) { if (_volumeIndex[num5] < _maxAmount[num5] && _volumeIndex[num5] < _volumes[num5].Count && _valuables[num5].Count != 0) { int num6 = Random.Range(0, _chance[num5]); if ((float)num6 > num3) { num3 = num6; num4 = num5; } } } if (num4 == -1) { break; } ValuableVolume val = _volumes[num4][_volumeIndex[num4]]; PrefabRef val2 = _valuables[num4][Random.Range(0, _valuables[num4].Count)]; vd.SpawnValuable(val2, val, _path[num4]); _volumeIndex[num4]++; yield return null; } if (vd.valuableTargetAmount < vd.totalMaxAmount && Object.op_Implicit((Object)(object)DebugComputerCheck.instance) && (DebugComputerCheck.instance.DebugDisable || !DebugComputerCheck.instance.LevelDebug || !DebugComputerCheck.instance.ModuleOverrideActive || DebugComputerCheck.instance.ModuleOverride == null)) { for (int num7 = 0; num7 < _names.Length; num7++) { if (_volumeIndex[num7] < _maxAmount[num7]) { Debug.LogError((object)("Could not spawn enough ''" + _names[num7] + "'' valuables!")); } } } if (SemiFunc.IsMultiplayer()) { vd.PhotonView.RPC("ValuablesTargetSetRPC", (RpcTarget)0, new object[1] { vd.valuableTargetAmount }); } vd.valuableSpawnPlayerReady++; while (GameManager.instance.gameMode == 1 && vd.valuableSpawnPlayerReady < PhotonNetwork.CurrentRoom.PlayerCount) { yield return (object)new WaitForSeconds(0.1f); } vd.cosmeticWorldObjectTargetAmount = 0; if ((int)vd.cosmeticWorldObjectDebug == 0 && SemiFunc.RunIsLevel()) { int _i = vd.CosmeticWorldObjectLevelLoopsGet(); int _cosmeticWorldObjectLevelLoopsClamped = vd.CosmeticWorldObjectLevelLoopsClampedGet(); for (int _i2 = 0; _i2 <= _cosmeticWorldObjectLevelLoopsClamped; _i2++) { float num8 = ((_i2 >= _i) ? ((float)(RunManager.instance.levelsCompleted % vd.cosmeticWorldObjectsLevelLoop) / (float)vd.cosmeticWorldObjectsLevelLoop) : 1f); int num9 = Mathf.RoundToInt(vd.cosmeticWorldObjectsSpawnCurve.Evaluate(num8) * 100f); if (RunManager.instance.cosmeticWorldObjectBadLuckCount > 0) { num9 += Mathf.RoundToInt((float)RunManager.instance.cosmeticWorldObjectBadLuckCount * 25f); } if (Random.Range(0, 100) >= num9) { continue; } CosmeticWorldObjectSetup val3 = null; float num10 = -1f; foreach (CosmeticWorldObjectSetup cosmeticWorldObjectSetup in vd.cosmeticWorldObjectSetups) { int num11 = Mathf.RoundToInt(cosmeticWorldObjectSetup.chanceCurve.Evaluate(num8) * 100f); int num12 = Random.Range(0, num11); if ((float)num12 > num10) { num10 = num12; val3 = cosmeticWorldObjectSetup; } } if (val3 != null) { vd.SpawnCosmeticWorldObject(val3.rarity, _volumeIndex, _volumes); yield return null; } } } else if ((int)vd.cosmeticWorldObjectDebug == 1) { vd.SpawnCosmeticWorldObject((Rarity)0, _volumeIndex, _volumes); yield return null; vd.SpawnCosmeticWorldObject((Rarity)1, _volumeIndex, _volumes); yield return null; vd.SpawnCosmeticWorldObject((Rarity)2, _volumeIndex, _volumes); yield return null; vd.SpawnCosmeticWorldObject((Rarity)3, _volumeIndex, _volumes); yield return null; } if (SemiFunc.IsMultiplayer()) { vd.PhotonView.RPC("CosmeticWorldObjectTargetSetRPC", (RpcTarget)0, new object[1] { vd.cosmeticWorldObjectTargetAmount }); } yield return null; vd.cosmeticWorldObjectSpawnPlayerReady++; while (SemiFunc.IsMultiplayer() && vd.cosmeticWorldObjectSpawnPlayerReady < PhotonNetwork.CurrentRoom.PlayerCount) { yield return (object)new WaitForSeconds(0.1f); } vd.VolumesAndSwitchSetup(); while (GameManager.instance.gameMode == 1 && vd.switchSetupPlayerReady < PhotonNetwork.CurrentRoom.PlayerCount) { yield return (object)new WaitForSeconds(0.1f); } ValuableDirector.instance.setupComplete = true; Console.WriteLine(ValuableDirector.instance.setupComplete); } [HarmonyPatch("SpawnValuable")] [HarmonyPrefix] private static bool RemoveStartRandomizing(ref PrefabRef _valuable, ref ValuableVolume _volume, ref string _path) { //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) ValuableDirector instance = ValuableDirector.instance; GameObject prefab = ((PrefabRef<GameObject>)(object)_valuable).Prefab; GameObject val = ((GameManager.instance.gameMode != 0) ? PhotonNetwork.InstantiateRoomObject(((PrefabRef<GameObject>)(object)_valuable).resourcePath, ((Component)_volume).transform.position, ((Component)_volume).transform.rotation, (byte)0, (object[])null) : Object.Instantiate<GameObject>(prefab, ((Component)_volume).transform.position, ((Component)_volume).transform.rotation)); ValuableObject component = val.GetComponent<ValuableObject>(); Random.InitState(RepoSeeded.ValuableCostRandom.Next()); component.DollarValueSetLogic(); instance.valuableTargetAmount++; instance.totalCurrentValue += component.dollarValueCurrent * 0.001f; if (instance.totalCurrentValue > instance.totalMaxValue) { instance.totalMaxAmount = instance.valuableTargetAmount; } return false; } public static void sortVolumesOnLocation(List<ValuableVolume> volumes) { volumes.Sort(delegate(ValuableVolume a, ValuableVolume b) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) Vector3 val = new Vector3(0f, 0f, 0f) - ((Component)a).transform.position; float sqrMagnitude = ((Vector3)(ref val)).sqrMagnitude; val = new Vector3(0f, 0f, 0f) - ((Component)b).transform.position; return sqrMagnitude.CompareTo(((Vector3)(ref val)).sqrMagnitude); }); } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }