Decompiled source of GTFR v0.2.2
GTFR.dll
Decompiled 5 months ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using AIGraph; using AK; using Agents; using BepInEx; using BepInEx.Configuration; using BepInEx.Core.Logging.Interpolation; using BepInEx.Logging; using BepInEx.Unity.IL2CPP; using BepInEx.Unity.IL2CPP.Hook; using BoosterImplants; using CellMenu; using ChainedPuzzles; using CullingSystem; using Enemies; using Expedition; using GTFO.API; using GTFR.Patches; using GTFR.Randomizers; using GTFR.Structs; using GameData; using GameEvent; using Globals; using HarmonyLib; using Il2CppInterop.Runtime; using Il2CppInterop.Runtime.Injection; using Il2CppInterop.Runtime.InteropTypes; using Il2CppInterop.Runtime.InteropTypes.Arrays; using Il2CppInterop.Runtime.Runtime; using Il2CppSystem; using Il2CppSystem.Collections.Generic; using LevelGeneration; using Microsoft.CodeAnalysis; using Player; using SNetwork; using StateMachines; using TMPro; using UnityEngine; using UnityEngine.AI; using XXHashing; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")] [assembly: AssemblyCompany("GTFR")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("GTFR")] [assembly: AssemblyTitle("GTFR")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.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] [Microsoft.CodeAnalysis.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] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NativeIntegerAttribute : Attribute { public readonly bool[] TransformFlags; public NativeIntegerAttribute() { TransformFlags = new bool[1] { true }; } public NativeIntegerAttribute(bool[] P_0) { TransformFlags = P_0; } } } namespace GTFR { public class Datablock : MonoBehaviour { public static LevelLayoutDataBlock[] data = (LevelLayoutDataBlock[])(object)new LevelLayoutDataBlock[3]; public static Datablock current; public static LevelLayoutDataBlock[] originalData; public static LevelLayoutDataBlock[] refData; public static string playerName; public static float originalEnemyTotalCost; private Layout layOutRandomizer = new Layout(); public Datablock() { current = this; originalEnemyTotalCost = EnemyCostManager.AllowedTotalCost; refData = Il2CppArrayBase<LevelLayoutDataBlock>.op_Implicit(GameDataBlockBase<LevelLayoutDataBlock>.GetAllBlocks()); originalData = (LevelLayoutDataBlock[])(object)new LevelLayoutDataBlock[refData.Length]; for (int i = 0; i < originalData.Length; i++) { try { originalData[i] = GameDataBlockBase<LevelLayoutDataBlock>.CreateNewCopy(refData[i]); LevelLayoutDataBlock obj = originalData[i]; string name = ((GameDataBlockBase<LevelLayoutDataBlock>)(object)originalData[i]).name; ((GameDataBlockBase<LevelLayoutDataBlock>)(object)obj).name = name.Substring(0, name.Length - 5); } catch { EntryPoint.LogIt("An original Datablock was Null so we're skipping"); } } WeaponSwap(); List<float> resourcePackSizes = GameDataBlockBase<ExpeditionBalanceDataBlock>.GetBlock(1u).ResourcePackSizes; List<float> val = resourcePackSizes; val[0] = val[0] * 2f; val = resourcePackSizes; val[1] = val[1] * 2f; val = resourcePackSizes; val[2] = val[2] * 2f; resourcePackSizes.Add(2.4f); resourcePackSizes.Add(3f); resourcePackSizes.Add(3.2f); resourcePackSizes.Add(4f); } public void Build() { layOutRandomizer.GetBlockAndBuild(); } public static T[] Blocks<T>() where T : GameDataBlockBase<T> { return Il2CppArrayBase<T>.op_Implicit(GameDataBlockBase<T>.GetAllBlocks()); } public static T Block<T>(uint id) where T : GameDataBlockBase<T> { return GameDataBlockBase<T>.GetBlock(id); } public static T Block<T>(string name) where T : GameDataBlockBase<T> { return GameDataBlockBase<T>.GetBlock(name); } public static T Copy<T>(T block) where T : GameDataBlockBase<T> { return GameDataBlockBase<T>.CreateNewCopy(block); } public static LevelLayoutDataBlock GetOrignalLevelLayout(string name) { for (int i = 0; i < originalData.Length; i++) { if (originalData[i] != null && ((GameDataBlockBase<LevelLayoutDataBlock>)(object)originalData[i]).name.Contains(name)) { return originalData[i]; } } return null; } public static void WeaponSwap() { Dictionary<string, WeaponCate> dictionary = new Dictionary<string, WeaponCate>(); foreach (GearCategoryDataBlock allBlock in GameDataBlockBase<GearCategoryDataBlock>.GetAllBlocks()) { uint baseItem = allBlock.BaseItem; if ((baseItem - 108 <= 2 || baseItem == 156) ? true : false) { GearCategoryDataBlock val2 = GameDataBlockBase<GearCategoryDataBlock>.CreateNewCopy(allBlock); switch (val2.BaseItem) { case 108u: val2.BaseItem = 109u; break; case 109u: val2.BaseItem = 108u; break; case 110u: val2.BaseItem = 156u; break; case 156u: val2.BaseItem = 110u; break; } dictionary[((GameDataBlockBase<GearCategoryDataBlock>)(object)allBlock).persistentID.ToString()] = new WeaponCate { id = ((GameDataBlockBase<GearCategoryDataBlock>)(object)val2).persistentID.ToString(), baseItem = val2.BaseItem.ToString(), toReplace = allBlock.BaseItem.ToString() }; } } foreach (PlayerOfflineGearDataBlock allBlock2 in GameDataBlockBase<PlayerOfflineGearDataBlock>.GetAllBlocks()) { string[] array = allBlock2.GearJSON.Split(':'); int num = -1; string text = "0"; for (int i = 0; i < array.Length; i++) { if (array[i].Contains("108") || array[i].Contains("109") || array[i].Contains("110") || array[i].Contains("156")) { num = i; break; } } if (num != -1) { PlayerOfflineGearDataBlock val4 = GameDataBlockBase<PlayerOfflineGearDataBlock>.CreateNewCopy(allBlock2); string text2 = array[num - 3]; WeaponCate weaponCate = dictionary[text2.Substring(0, text2.Length - 5)]; int num2 = num - 3; string obj = array[num - 3]; text2 = array[num - 3]; array[num2] = obj.Replace(text2.Substring(0, text2.Length - 5), weaponCate.id); array[num] = array[num].Replace(weaponCate.toReplace, weaponCate.baseItem); if (num == 14) { text2 = array[num - 6]; text = text2.Substring(0, text2.Length - 5); } val4.GearJSON = string.Join(':', array); GearCategoryDataBlock block = GameDataBlockBase<GearCategoryDataBlock>.GetBlock(uint.Parse(weaponCate.id)); ArchetypeDataBlock val5 = GameDataBlockBase<ArchetypeDataBlock>.CreateNewCopy(GameDataBlockBase<ArchetypeDataBlock>.GetBlock(text switch { "0" => block.SemiArchetype, "1" => block.BurstArchetype, "2" => block.AutoArchetype, _ => block.SemiBurstArchetype, })); if (weaponCate.toReplace.Equals("108") || weaponCate.toReplace.Equals("156")) { val5.CostOfBullet *= 0.5f; } else if (weaponCate.toReplace.Equals("109") || weaponCate.toReplace.Equals("110")) { val5.CostOfBullet *= 2f; } switch (text) { case "0": block.SemiArchetype = ((GameDataBlockBase<ArchetypeDataBlock>)(object)val5).persistentID; break; case "1": block.BurstArchetype = ((GameDataBlockBase<ArchetypeDataBlock>)(object)val5).persistentID; break; case "2": block.AutoArchetype = ((GameDataBlockBase<ArchetypeDataBlock>)(object)val5).persistentID; break; default: block.SemiBurstArchetype = ((GameDataBlockBase<ArchetypeDataBlock>)(object)val5).persistentID; break; } } } } } internal struct WeaponCate { public string id; public string baseItem; public string toReplace; public WeaponCate(string id, string baseItem, string toReplace) { this.id = id; this.baseItem = baseItem; this.toReplace = toReplace; } } public static class Detour { public unsafe delegate void StaticVoidDelegate(Il2CppMethodInfo* methodInfo); public unsafe delegate void InstanceVoidDelegate(IntPtr instance, Il2CppMethodInfo* methodInfo); public static bool TryCreate<T>(DetourDescription description, T to, out T originalCall, out INativeDetour detourInstance) where T : Delegate { try { detourInstance = INativeDetour.CreateAndApply<T>((IntPtr)description.GetMethodPointer(), to, ref originalCall); return detourInstance != null; } catch { } originalCall = null; detourInstance = null; return false; } } public struct DetourDescription { public Type Type; public Type ReturnType; public Type[] ArgTypes; public string MethodName; public bool IsGeneric; public unsafe nint GetMethodPointer() { if (Type == null) { throw new MissingFieldException("Field Type is not set!"); } if (ReturnType == null) { throw new MissingFieldException("Field ReturnType is not set! If you mean 'void' do typeof(void)"); } if (string.IsNullOrEmpty(MethodName)) { throw new MissingFieldException("Field MethodName is not set or valid!"); } Type val = Il2CppType.From(Type, true); IntPtr nativeClassPointer = Il2CppClassPointerStore.GetNativeClassPointer(Type); Type val2 = Il2CppType.From(ReturnType, true); Type[] array; if (ArgTypes == null || ArgTypes.Length == 0) { array = Array.Empty<Type>(); } else { int num = ArgTypes.Length; array = (Type[])(object)new Type[num]; for (int i = 0; i < num; i++) { Type type = ArgTypes[i]; array[i] = Il2CppType.From(type, true); } } string[] array2 = array.Select((Type t) => t.FullName).ToArray(); void** ptr = (void**)IL2CPP.GetIl2CppMethod(nativeClassPointer, IsGeneric, MethodName, val2.FullName, array2).ToPointer(); if (ptr == null) { return (nint)ptr; } return (nint)(*ptr); } } [BepInPlugin("JishWasha.GTFR", "GTFR", "0.2.1")] public class EntryPoint : BasePlugin { public static ConfigEntry<bool> GeosRandom; public static ConfigEntry<bool> bioScans; public static ConfigEntry<bool> movingScans; public static ConfigEntry<bool> BloodDoors; public static ConfigEntry<bool> Enemy; public static ConfigEntry<bool> EnemyScale; public static ConfigEntry<bool> EnemyBirth; public static ConfigEntry<bool> chaosRando; public static ConfigEntry<bool> spittersRando; public static ConfigEntry<bool> itemsRando; public static ConfigEntry<bool> eventRando; public static int configLevel; public static ConfigFile configFile; public static EntryPoint e; public override void Load() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown e = this; Harmony val = new Harmony("JishWasha.GTFR"); ClassInjector.RegisterTypeInIl2Cpp<Datablock>(); ClassInjector.RegisterTypeInIl2Cpp<MovingScanAI>(); Action<ulong, pScanPos> action = delegate(ulong _, pScanPos data) { ScansReplicator.UpdateScanPosition(data); }; NetworkAPI.RegisterEvent<pScanPos>("UpdateScanPosition", action); LogIt("Scans setting up to be synced"); LogIt("Levels are ready to be EvilWasha"); GetTheSettings(); ResourcePack.CreateDetour(); val.PatchAll(); } public static void GetTheSettings() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown configFile = new ConfigFile(Path.Combine(Paths.ConfigPath, "JishWasha.GTFR.cfg"), true); GeosRandom = configFile.Bind<bool>("Setup", "GeosRandom", true, "Toggle for Geomorphs --- Everyone must have the same config in order to drop"); bioScans = configFile.Bind<bool>("Setup", "bioScans", true, "Bioscans Rando"); movingScans = configFile.Bind<bool>("Setup", "movingScans", true, "Bioscans Rando"); BloodDoors = configFile.Bind<bool>("Setup", "BloodDoors", true, "Toggle for Blood Doors"); Enemy = configFile.Bind<bool>("Setup", "Enemy", false, "Toggle for enemies spawning"); EnemyScale = configFile.Bind<bool>("Setup", "EnemyScale", true, "Toggle for enemies Scale"); EnemyBirth = configFile.Bind<bool>("Setup", "EnemyBirth", true, "Toggle for Mom and scout random wave"); chaosRando = configFile.Bind<bool>("Setup", "chaosRando", false, "Chaos Jish rando >__<"); spittersRando = configFile.Bind<bool>("Setup", "spittersRando", false, "evil Spitters being random"); itemsRando = configFile.Bind<bool>("Setup", "itemsRando", false, "Toggle for da babies that are not yours"); eventRando = configFile.Bind<bool>("Setup", "eventRando", false, "Toggle to take the red pills and randomize events"); Geos.randomize = GeosRandom.Value; BioScans.randomize = bioScans.Value; ScanPatch.randomize = movingScans.Value; Enemies.randoBloodDoors = BloodDoors.Value; Enemies.randoEnemy = Enemy.Value; EnemyPatch.random = Enemy.Value; EnemySpawnPatch.random = EnemyScale.Value; Spitters.randomize = spittersRando.Value; ItemsRandomizer.randomize = itemsRando.Value; LevelDesignRando.randomize = chaosRando.Value; Events.randomize = eventRando.Value; } public static int ConfigToBinary() { string text = ""; configLevel = 0; text += "1"; text += (GeosRandom.Value ? "1" : "0"); text += (bioScans.Value ? "1" : "0"); text += (movingScans.Value ? "1" : "0"); text += (BloodDoors.Value ? "1" : "0"); text += (Enemy.Value ? "1" : "0"); text += (EnemyScale.Value ? "1" : "0"); text += (EnemyBirth.Value ? "1" : "0"); text += (chaosRando.Value ? "1" : "0"); text += (spittersRando.Value ? "1" : "0"); text += (itemsRando.Value ? "1" : "0"); text += (eventRando.Value ? "1" : "0"); text += "1"; string text2 = text; foreach (char c in text2) { configLevel += (int)char.GetNumericValue(c); } LogIt("HostID: " + (int)Convert.ToInt64(text, 2)); return (int)Convert.ToInt64(text, 2); } public static void BinaryToConfig(int num) { string text = Convert.ToString(num, 2); LogIt("Config is: " + text); Geos.randomize = text[1] == '1'; BioScans.randomize = text[2] == '1'; ScanPatch.randomize = text[3] == '1'; Enemies.randoBloodDoors = text[4] == '1'; Enemies.randoEnemy = text[5] == '1'; EnemyPatch.random = text[6] == '1'; EnemySpawnPatch.random = text[7] == '1'; LevelDesignRando.randomize = text[8] == '1'; Spitters.randomize = text[9] == '1'; ItemsRandomizer.randomize = text[10] == '1'; Events.randomize = text[11] == '1'; } public static void LogIt(object data) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Expected O, but got Unknown ManualLogSource log = ((BasePlugin)e).Log; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(0, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<object>(data); } log.LogInfo(val); } public override bool Unload() { return ((BasePlugin)this).Unload(); } } public static class PluginInfo { public const string PLUGIN_GUID = "JishWasha.GTFR"; public const string PLUGIN_NAME = "GTFR"; public const string PLUGIN_VERSION = "0.2.1"; public const string AUTHOR = "time1pm/Jish/microchips-n-dips"; public const string BRANCH = "OpenBeta"; public const string INTERNAL_VERSION = "002346"; } [HarmonyPatch] public class Initializer { public static int hostID; [HarmonyPostfix] [HarmonyPatch(typeof(StartMainGame), "Start")] private static void StartData(StartMainGame __instance) { ((Component)__instance).gameObject.AddComponent<Datablock>(); ScansReplicator.scans = new List<MovingScanAI>(); EntryPoint.LogIt("datablock is LOADED"); } [HarmonyPrefix] [HarmonyPatch(typeof(RundownManager), "SetActiveExpedition")] public static void SetActiveExp(ref pActiveExpedition expPackage, ref ExpeditionInTierData expTierData) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected I4, but got Unknown Layout.tierLevel = (int)expPackage.tier; expTierData.MainLayerData.ArtifactData.ArtifactAmountMulti = 0f; EntryPoint.GetTheSettings(); expTierData.Seeds.BuildSeed = new Random(expPackage.sessionSeed).Next(100000000, int.MaxValue); if (SNet.IsMaster) { expPackage.hostIDSeed = EntryPoint.ConfigToBinary(); hostID = expPackage.hostIDSeed; } } [HarmonyPostfix] [HarmonyPatch(typeof(RundownManager), "SetActiveExpedition")] public static void GetSeeds(ref pActiveExpedition expPackage, ref ExpeditionInTierData expTierData) { BigPickUpPatch.seedweed = expPackage.sessionSeed; EntryPoint.LogIt("Session: " + expTierData.SessionSeed + " HostID: " + expTierData.HostIDSeed); } [HarmonyPostfix] [HarmonyPatch(typeof(ExpeditionInTierData), "SetSeeds")] public static void SetHostSeed(ref int hostIDSeed) { if (!SNet.IsMaster) { hostID = hostIDSeed; } } [HarmonyPrefix] [HarmonyPatch(typeof(Builder), "Build")] public static void BuildNewLevel() { EntryPoint.BinaryToConfig(hostID); ScansReplicator.scans.Clear(); Datablock.current.Build(); } } } namespace GTFR.Structs { internal struct Danger { private float danger; private float enenmyDanger; private float costDanger; private static Danger current; public Danger() { danger = 0f; enenmyDanger = 0f; costDanger = 0f; current = this; } public static void Add(float amount) { current.danger += amount; } public static float Level() { current.costDanger = (EnemyCostManager.AllowedTotalCost - Datablock.originalEnemyTotalCost) / 100f * 3f; current.enenmyDanger = current.danger / 100f * 2f; return current.costDanger + current.enenmyDanger; } public static float ResMulti() { return 1f + Level() * 1.1f; } } public struct pScanPos { public int m_index; public Vector3 m_position; } public struct Rando { private Random random; private static Rando current; public Rando() { random = new Random(RundownManager.ActiveExpedition.SessionSeed); current = this; } public static int Next(int max) { return current.random.Next(max); } public static int Next(int min, int max) { return current.random.Next(min, max); } } } namespace GTFR.Randomizers { internal class Balance : Randomizer { public void Finalize(List<ExpeditionZoneData> zones, List<ExpeditionZoneData> ogZones) { CuratedException(); RebalanceBoxes(); } private void RebalanceBoxes() { int tierLevel = Layout.tierLevel; EnemyCostManager.AllowedTotalCost = Datablock.originalEnemyTotalCost + (float)Rando.Next(tierLevel - 1, 35 - 34 / tierLevel); EntryPoint.LogIt("Danger Level: " + (1f + Danger.Level()) * 100f + "%"); LevelLayoutDataBlock[] data = Datablock.data; foreach (LevelLayoutDataBlock val in data) { if (val == null) { continue; } Enumerator<ExpeditionZoneData> enumerator = val.Zones.GetEnumerator(); while (enumerator.MoveNext()) { ExpeditionZoneData current = enumerator.Current; if (current.BigPickupDistributionInZone == 10 || current.EventsOnPortalWarp.Count > 0) { EntryPoint.LogIt("There's MWP, we're skipping"); continue; } float num = 0.2f * (float)tierLevel; current.ToolAmmoMulti = Mathf.Clamp(current.ToolAmmoMulti, num, 100f); current.WeaponAmmoMulti = Mathf.Clamp(current.WeaponAmmoMulti, num, 100f); current.HealthMulti = Mathf.Clamp(current.HealthMulti, num, 100f); current.DisinfectionMulti = Mathf.Clamp(current.DisinfectionMulti, 0.2f, 100f); float num2 = Danger.ResMulti(); current.ToolAmmoMulti *= num2; current.WeaponAmmoMulti *= num2; current.HealthMulti *= num2; current.DisinfectionMulti *= num2; } } } private void CuratedException() { LevelLayoutDataBlock val = Datablock.Block<LevelLayoutDataBlock>(RundownManager.ActiveExpedition.LevelLayoutData); if (((GameDataBlockBase<LevelLayoutDataBlock>)(object)val).name.Contains("R7_D2_MainframeRush")) { val.Zones[11].AltitudeData.AllowedZoneAltitude = (eWantedZoneHeighs)9; val.Zones[11].AltitudeData.ChanceToChange = 0f; val.Zones[11].ForbidTerminalsInZone = true; } } } internal struct BioScan { public uint id; public int numScans; public float difficulty; public BioScan(ChainedPuzzleDataBlock puzzle) { id = ((GameDataBlockBase<ChainedPuzzleDataBlock>)(object)puzzle).persistentID; numScans = puzzle.ChainedPuzzle.Count; if (numScans == 0) { numScans = 1; } difficulty = PuzzleDifficulty(puzzle); } public static float ScanDifficulty(uint scanType) { switch (scanType) { case 3u: return -0.5f; case 5u: case 8u: case 14u: return 0.25f; case 6u: case 20u: return 0.5f; case 25u: case 26u: case 27u: case 28u: case 29u: return 0.75f; case 13u: case 16u: case 32u: return 1f; case 15u: return 1.5f; case 33u: case 34u: case 35u: case 36u: case 37u: return 2f; case 17u: case 18u: return 2f; case 40u: case 44u: return 2f; default: return 0f; } } public static float PuzzleDifficulty(ChainedPuzzleDataBlock puzzle) { float num = 0f; Enumerator<ChainedPuzzleComponent> enumerator = puzzle.ChainedPuzzle.GetEnumerator(); while (enumerator.MoveNext()) { ChainedPuzzleComponent current = enumerator.Current; num += ScanDifficulty(current.PuzzleType); } return num; } public static bool IsInvalid(ChainedPuzzleDataBlock puzzle) { Enumerator<ChainedPuzzleComponent> enumerator = puzzle.ChainedPuzzle.GetEnumerator(); while (enumerator.MoveNext()) { ChainedPuzzleComponent current = enumerator.Current; bool flag; switch (current.PuzzleType) { case 10u: case 11u: case 12u: case 21u: case 22u: case 24u: case 31u: case 38u: case 42u: case 43u: flag = true; break; default: flag = false; break; } if (flag) { return true; } } return false; } } internal class BioScans : Randomizer { public static List<BioScan>[] bioscans = new List<BioScan>[15]; private Dictionary<uint, int> scanCounts = new Dictionary<uint, int>(); public static bool randomize = true; public BioScans() { for (int i = 0; i < bioscans.Length; i++) { bioscans[i] = new List<BioScan>(); } scanCounts[0u] = 1; ChainedPuzzleDataBlock[] array = Datablock.Blocks<ChainedPuzzleDataBlock>(); foreach (ChainedPuzzleDataBlock puzzle in array) { if (!BioScan.IsInvalid(puzzle)) { BioScan item = new BioScan(puzzle); bioscans[item.numScans].Add(item); scanCounts[item.id] = item.numScans; } } } public void Randomize(ExpeditionZoneData zone, ExpeditionZoneData original, int index) { if (randomize) { CreateScanInZone(zone); } } public void CreateScanInZone(ExpeditionZoneData zone) { int num; try { num = Math.Clamp(scanCounts[zone.ChainedPuzzleToEnter] + Rando.Next(5) - 2, 1, 14); } catch { return; } while (bioscans[num].Count == 0) { num--; } BioScan bioScan = bioscans[num][Rando.Next(bioscans[num].Count)]; zone.ChainedPuzzleToEnter = bioScan.id; Danger.Add(bioScan.difficulty); if (ScanPatch.randomize) { Danger.Add(0.1f); } EntryPoint.LogIt("Added scan with difficulty " + num); } } internal class Enemies : Randomizer { private Dictionary<uint, float> enemyDict; private Dictionary<uint, EnemyPop> enemyPopDict; private Dictionary<uint, int> enemyGroupDiff; private static List<EnemyGroupDataBlock>[] huntersByDiff; private static List<EnemyGroupDataBlock>[] othersByDiff; private List<uint> WaveSettings; private List<uint> WavePopulations; private int tierLevel; private static Enemies current; public static bool randoEnemy = true; public static bool randoBloodDoors = true; public Enemies() { //IL_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: Expected I4, but got Unknown //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Expected I4, but got Unknown //IL_024a: Unknown result type (might be due to invalid IL or missing references) //IL_0254: Expected I4, but got Unknown //IL_0270: Unknown result type (might be due to invalid IL or missing references) //IL_0365: Unknown result type (might be due to invalid IL or missing references) //IL_036b: Invalid comparison between Unknown and I4 //IL_0387: Unknown result type (might be due to invalid IL or missing references) //IL_038d: Invalid comparison between Unknown and I4 current = this; huntersByDiff = new List<EnemyGroupDataBlock>[8]; othersByDiff = new List<EnemyGroupDataBlock>[8]; enemyDict = new Dictionary<uint, float>(); enemyPopDict = new Dictionary<uint, EnemyPop>(); enemyGroupDiff = new Dictionary<uint, int>(); WaveSettings = new List<uint>(); WavePopulations = new List<uint>(); SurvivalWavePopulationDataBlock[] array = Datablock.Blocks<SurvivalWavePopulationDataBlock>(); foreach (SurvivalWavePopulationDataBlock val in array) { WavePopulations.Add(((GameDataBlockBase<SurvivalWavePopulationDataBlock>)(object)val).persistentID); } SurvivalWaveSettingsDataBlock[] array2 = Datablock.Blocks<SurvivalWaveSettingsDataBlock>(); foreach (SurvivalWaveSettingsDataBlock val2 in array2) { WaveSettings.Add(((GameDataBlockBase<SurvivalWaveSettingsDataBlock>)(object)val2).persistentID); } for (int k = 0; k < huntersByDiff.Length; k++) { huntersByDiff[k] = new List<EnemyGroupDataBlock>(); } for (int l = 0; l < othersByDiff.Length; l++) { othersByDiff[l] = new List<EnemyGroupDataBlock>(); } EnemyDataBlock[] array3 = Datablock.Blocks<EnemyDataBlock>(); foreach (EnemyDataBlock val3 in array3) { try { enemyDict[((GameDataBlockBase<EnemyDataBlock>)(object)val3).persistentID] = Datablock.Block<EnemyBalancingDataBlock>(val3.BalancingDataId).Health.HealthMax; } catch { EntryPoint.LogIt("Couldn't find Balancing Data for " + ((GameDataBlockBase<EnemyDataBlock>)(object)val3).name); } } Enumerator<EnemyRoleData> enumerator = Datablock.Block<EnemyPopulationDataBlock>(1u).RoleDatas.GetEnumerator(); while (enumerator.MoveNext()) { EnemyRoleData val4 = enumerator.Current; try { enemyPopDict[(uint)(int)val4.Role].AddHealth(enemyDict[val4.Enemy]); } catch { enemyPopDict[(uint)(int)val4.Role] = new EnemyPop(val4.Cost, enemyDict[val4.Enemy]); } } EnemyGroupDataBlock[] array4 = Datablock.Blocks<EnemyGroupDataBlock>(); foreach (EnemyGroupDataBlock val5 in array4) { float num = 0f; Enumerator<EnemyGroupCompositionData> enumerator2 = val5.Roles.GetEnumerator(); while (enumerator2.MoveNext()) { EnemyGroupCompositionData val6 = enumerator2.Current; EnemyPop enemyPop = enemyPopDict[(uint)(int)val6.Role]; num += enemyPop.health * val5.MaxScore / (enemyPop.cost * DisIndex(val6.Distribution)); } uint persistentID = ((GameDataBlockBase<EnemyGroupDataBlock>)(object)val5).persistentID; if (persistentID == 75) { num *= 100f; } int num2 = DifficultyTranslateFromHealth(num); enemyGroupDiff[persistentID] = num2; bool flag; switch (persistentID) { case 40u: case 41u: case 46u: case 69u: case 79u: case 85u: flag = true; break; default: flag = false; break; } if (!flag && num2 != 6) { if ((persistentID == 63 || persistentID == 70 || persistentID == 73) ? true : false) { huntersByDiff[num2].Add(val5); othersByDiff[num2].Add(val5); } else if ((int)val5.Type == 6) { huntersByDiff[num2].Add(val5); } else if ((int)val5.Type != 4) { othersByDiff[num2].Add(val5); } } } } public void Preparation(List<ExpeditionZoneData> zones, List<ExpeditionZoneData> ogZones) { tierLevel = Layout.tierLevel; EntryPoint.LogIt("Tier Level:" + tierLevel); } public void Randomize(ExpeditionZoneData zone, ExpeditionZoneData original, int index) { if (randoBloodDoors) { CreateBloodDoorInZone(zone); } if (randoEnemy) { SpawnEnemiesInZone(zone, 10 + tierLevel); } } public void SpawnEnemiesInZone(ExpeditionZoneData zone, int cap = 11) { //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Expected O, but got Unknown if (zone.EnemySpawningInZone == null && Rando.Next(7) == 0) { return; } int num = Rando.Next(tierLevel, cap); List<EnemySpawningData> val = new List<EnemySpawningData>(); EntryPoint.LogIt("Zone has " + num + " litres of gas"); while (num > 0) { EnemyGroupDataBlock val2 = RandomGroup(othersByDiff); int num2 = enemyGroupDiff[((GameDataBlockBase<EnemyGroupDataBlock>)(object)val2).persistentID]; int num3 = num2 + 1; if (num3 <= num) { if (num > 2 && num3 < 3 * num / 4) { num--; continue; } num -= num3; EntryPoint.LogIt("Created group with difficulty " + num2 + "--ID: " + ((GameDataBlockBase<EnemyGroupDataBlock>)(object)val2).persistentID); Danger.Add((float)num2 / 2.5f); val.Add(new EnemySpawningData { Difficulty = val2.Difficulty, GroupType = val2.Type, Distribution = (eEnemyZoneDistribution)3, DistributionValue = 1f }); } } zone.EnemySpawningInZone = val; zone.EnemyRespawning = Rando.Next(7) == 0; EntryPoint.LogIt("Created " + zone.EnemySpawningInZone.Count + " sleeper groups"); } public void CreateBloodDoorInZone(ExpeditionZoneData zone) { EnemyGroupDataBlock val = RandomGroup(huntersByDiff); EnemyGroupDataBlock val2 = RandomGroup(huntersByDiff); if (Rando.Next(6 - tierLevel) == 0) { ActiveEnemyWaveData activeEnemyWave = zone.ActiveEnemyWave; activeEnemyWave.HasActiveEnemyWave = true; activeEnemyWave.EnemyGroupInfrontOfDoor = ((GameDataBlockBase<EnemyGroupDataBlock>)(object)val).persistentID; activeEnemyWave.EnemyGroupInArea = ((GameDataBlockBase<EnemyGroupDataBlock>)(object)val2).persistentID; int num = enemyGroupDiff[((GameDataBlockBase<EnemyGroupDataBlock>)(object)val).persistentID]; int num2 = enemyGroupDiff[((GameDataBlockBase<EnemyGroupDataBlock>)(object)val2).persistentID]; EntryPoint.LogIt("Front wave difficulty: " + num); EntryPoint.LogIt("Rear wave difficulty: " + num2); int num3 = 4 - (2 + num2 + num) / 4 + (tierLevel * 2 - 2); int num5 = (activeEnemyWave.EnemyGroupsInArea = 1 + ((num3 != 0) ? Rando.Next(num3) : 0)); Danger.Add((float)(num5 * (num + num2)) * 1.2f); EntryPoint.LogIt("Rolled for " + num5 + " groups"); } } private static EnemyGroupDataBlock RandomGroup(List<EnemyGroupDataBlock>[] group) { int num = 0; while (Rando.Next(5) >= 3 && num != 7) { num++; } while (group[num].Count == 0) { num--; } return group[num][Rando.Next(group[num].Count)]; } public static EnemyGroupDataBlock RandomHunterGroupStatic() { return RandomGroup(huntersByDiff); } public static uint ReturnPopulation() { return current.WavePopulations[Rando.Next(current.WavePopulations.Count)]; } public static uint ReturnSettings() { return current.WaveSettings[Rando.Next(current.WaveSettings.Count)]; } public int DifficultyTranslateFromHealth(float health) { if (!(health < 50f)) { if (!(health < 150f)) { if (!(health < 250f)) { if (!(health < 500f)) { if (!(health <= 1000f)) { if (health <= 2500f) { return 5; } return 6; } return 4; } return 3; } return 2; } return 1; } return 0; } public static float DisIndex(eEnemyRoleDistribution dis) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected I4, but got Unknown return (int)dis switch { 0 => 0f, 1 => 1f, 8 => 0.05f, 7 => 0.1f, 6 => 0.15f, 2 => 0.25f, 3 => 0.5f, 4 => 0.75f, 5 => 1f, _ => 0f, }; } } internal struct EnemyPop { public float cost; public float health; public EnemyPop(float cost, float health) { this.cost = cost; this.health = health; } public void AddHealth(float addedHealth) { health += addedHealth; health /= 2f; } } internal class Events : Randomizer { private int waves = 0; private int eventLightCounter = 8; private FogSettingsDataBlock[] fogSettings = Datablock.Blocks<FogSettingsDataBlock>(); public static bool randomize; public void Randomize(ExpeditionZoneData zone, ExpeditionZoneData original, int index) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown if (randomize) { WardenObjectiveEventData eventData = new WardenObjectiveEventData { Delay = 5f }; switch (Rando.Next(eventLightCounter)) { case 0: EventTurnOnLights(ref eventData); break; case 1: EventTurnOffLights(ref eventData); break; case 2: SpawnWavesEvents(ref eventData); break; case 3: UnlockDoor(ref eventData, index); break; case 4: OpenDoor(ref eventData, index); break; case 5: ChainPuzzelStart(ref eventData); break; case 6: FogEvent(ref eventData); break; case 7: PlaySound(ref eventData); break; } switch (Rando.Next(5)) { case 0: zone.EventsOnApproachDoor.Add(eventData); break; case 1: zone.EventsOnDoorScanDone.Add(eventData); break; case 2: zone.EventsOnDoorScanStart.Add(eventData); break; case 3: zone.EventsOnOpenDoor.Add(eventData); break; case 4: zone.EventsOnUnlockDoor.Add(eventData); break; } eventLightCounter--; } } private void EventTurnOffLights(ref WardenObjectiveEventData eventData) { eventData.Type = (eWardenObjectiveEventType)3; } private void EventTurnOnLights(ref WardenObjectiveEventData eventData) { eventData.Type = (eWardenObjectiveEventType)4; eventLightCounter = 7; } private void FogEvent(ref WardenObjectiveEventData eventData) { eventData.Type = (eWardenObjectiveEventType)6; eventData.FogSetting = ((GameDataBlockBase<FogSettingsDataBlock>)(object)fogSettings[Rando.Next(fogSettings.Length)]).persistentID; eventData.FogTransitionDuration = Rando.Next(300); } private void SpawnWavesEvents(ref WardenObjectiveEventData eventData) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Expected O, but got Unknown if (waves > 2) { eventData.Type = (eWardenObjectiveEventType)10; waves = 0; return; } eventData.Type = (eWardenObjectiveEventType)9; GenericEnemyWaveData val = new GenericEnemyWaveData { WavePopulation = Enemies.ReturnPopulation(), TriggerAlarm = true, SpawnDelay = 4f }; if (Rando.Next(2) == 0) { Danger.Add(0.02f); val.WaveSettings = 54u; } else { Danger.Add(0.1f); val.WaveSettings = 229u; waves++; } eventData.EnemyWaveData = val; EntryPoint.LogIt("Wave settings:" + val.WaveSettings + "--Population:" + val.WavePopulation); } private void ChainPuzzelStart(ref WardenObjectiveEventData eventData) { eventData.Type = (eWardenObjectiveEventType)22; List<BioScan>[] bioscans = BioScans.bioscans; int num = Rando.Next(bioscans.Length); eventData.ChainPuzzle = bioscans[num][Rando.Next(bioscans[num].Count)].id; } private void OpenDoor(ref WardenObjectiveEventData eventData, int i) { eventData.Type = (eWardenObjectiveEventType)1; eventData.LocalIndex = (eLocalZoneIndex)(i + 1); } private void UnlockDoor(ref WardenObjectiveEventData eventData, int i) { eventData.Type = (eWardenObjectiveEventType)2; eventData.LocalIndex = (eLocalZoneIndex)(i + 1); } private void PlaySound(ref WardenObjectiveEventData eventData) { eventData.Type = (eWardenObjectiveEventType)5; eventData.SoundID = 4217976462u; } } internal class Geos : Randomizer { private LightSettingsDataBlock[] lights = Il2CppArrayBase<LightSettingsDataBlock>.op_Implicit(GameDataBlockBase<LightSettingsDataBlock>.GetAllBlocks()); private List<string> geosToRandom = new List<string>(); private List<string> reactors = new List<string>(); private List<string> portals = new List<string>(); private List<string> blackList = new List<string>(); private List<string> clusters = new List<string>(); private List<string> availGeos = new List<string>(); public static bool randomize; public static Geos current; public Geos() { PopulateGeoRandomTo(); PopulateBlackList(); current = this; } public void Preparation(List<ExpeditionZoneData> zones, List<ExpeditionZoneData> ogZones) { availGeos = new List<string>(); Enumerator<ResourceData> enumerator = Datablock.Block<ComplexResourceSetDataBlock>(RundownManager.ActiveExpedition.Expedition.ComplexResourceData).CustomGeomorphs_Objective_1x1.GetEnumerator(); while (enumerator.MoveNext()) { ResourceData val = enumerator.Current; availGeos.Add(val.Prefab); } availGeos = CullAvailableGeo(availGeos); } public void Randomize(ExpeditionZoneData zones, ExpeditionZoneData ogZones, int index) { if (!randomize) { return; } string customGeomorph; bool flag; try { if (ogZones.CustomGeomorph.Contains("reactor") && !ogZones.CustomGeomorph.Contains("geo_64x64_mining_reactor_HA_02")) { zones.CustomGeomorph = reactors[Rando.Next(reactors.Count)]; } else if (ogZones.CustomGeomorph.Contains("portal")) { zones.CustomGeomorph = ogZones.CustomGeomorph; } else if (((Object)((WardenObjectiveEventData)ogZones.EventsOnTrigger[0]).CustomSubObjective).ToString().ToLower().Contains("shuttlebox")) { EntryPoint.LogIt("There's a shuttlebox... we're skipping"); zones.CustomGeomorph = ogZones.CustomGeomorph; } else if (ogZones.GeneratorClustersInZone == 1) { zones.CustomGeomorph = clusters[Rando.Next(clusters.Count)]; } else { customGeomorph = ogZones.CustomGeomorph; flag = ((customGeomorph == "" || customGeomorph == null) ? true : false); if (!flag && !CheckBlackList(zones.CustomGeomorph)) { zones.CustomGeomorph = availGeos[Rando.Next(availGeos.Count)]; } } if (ogZones.CustomGeomorph.Contains("geo_64x64_service_gardens_dead_end_SF")) { zones.BigPickupDistributionInZone = 10u; } } catch { zones.CustomGeomorph = ogZones.CustomGeomorph; } customGeomorph = ogZones.CustomGeomorph; flag = ((customGeomorph == "" || customGeomorph == null) ? true : false); if (!flag && zones.CustomGeomorph.Contains("portal")) { zones.AltitudeData.AllowedZoneAltitude = (eWantedZoneHeighs)9; zones.AltitudeData.ChanceToChange = 0f; } else { zones.AltitudeData.AllowedZoneAltitude = (eWantedZoneHeighs)0; zones.AltitudeData.ChanceToChange = Rando.Next(10) / 2; } zones.SubComplex = (SubComplex)5; zones.LightSettings = ((GameDataBlockBase<LightSettingsDataBlock>)(object)lights[Rando.Next(lights.Length)]).persistentID; EntryPoint.LogIt($"Zone: {zones.Alias} ---- Geo: {zones.CustomGeomorph} ---- Lights: {zones.LightSettings}"); } public void ReRandomize(ExpeditionZoneData zones, ExpeditionZoneData ogZones, int index) { try { if (ogZones.CustomGeomorph.Contains("reactor") && !ogZones.CustomGeomorph.Contains("geo_64x64_mining_reactor_HA_02")) { zones.CustomGeomorph = reactors[Rando.Next(reactors.Count)]; } else if (ogZones.CustomGeomorph.Contains("portal")) { zones.CustomGeomorph = portals[Rando.Next(portals.Count)]; } else if (CheckBlackList(zones.CustomGeomorph)) { zones.CustomGeomorph = ogZones.CustomGeomorph; } else { string customGeomorph = ogZones.CustomGeomorph; if ((customGeomorph == "" || customGeomorph == null) ? true : false) { zones.CustomGeomorph = availGeos[Rando.Next(availGeos.Count)]; } else if (((Object)((WardenObjectiveEventData)ogZones.EventsOnTrigger[0]).CustomSubObjective).ToString().ToLower().Contains("shuttlebox")) { zones.CustomGeomorph = ogZones.CustomGeomorph; } else if (ogZones.GeneratorClustersInZone == 1) { zones.CustomGeomorph = clusters[Rando.Next(clusters.Count)]; } else { zones.CustomGeomorph = availGeos[Rando.Next(availGeos.Count)]; } } } catch { zones.CustomGeomorph = availGeos[Rando.Next(availGeos.Count)]; } if (ogZones.CustomGeomorph.Contains("portal")) { zones.AltitudeData.AllowedZoneAltitude = (eWantedZoneHeighs)9; zones.AltitudeData.ChanceToChange = 0f; } else { zones.AltitudeData.AllowedZoneAltitude = (eWantedZoneHeighs)0; zones.AltitudeData.ChanceToChange = Rando.Next(10) / 2; } EntryPoint.LogIt($"Zone: {zones.Alias} ---- Geo: {zones.CustomGeomorph} ---- Lights: {zones.LightSettings}"); } private string getAvailGeo(int index) { return availGeos[index]; } private List<string> CullAvailableGeo(List<string> availGeos) { List<string> list = new List<string>(); foreach (string availGeo in availGeos) { if (CheckWhiteList(availGeo)) { list.Add(availGeo); if (availGeo.Contains("reactor") && !availGeo.Contains("tunnel")) { reactors.Add(availGeo); } } } return list; } private bool CheckWhiteList(string currentGeo) { foreach (string item in geosToRandom) { if (currentGeo.Contains(item)) { return true; } } return false; } private bool CheckBlackList(string currentGeo) { foreach (string black in blackList) { if (currentGeo.ToLower().Contains(black.ToLower())) { return true; } } return false; } private void PopulateGeoRandomTo() { geosToRandom.Add("geo_64x64_service_gardens_HA_01"); geosToRandom.Add("geo_64x64_service_gardens_HA_02"); geosToRandom.Add("geo_64x64_service_gardens_SF_01"); geosToRandom.Add("geo_64x64_service_gardens_AW_01"); geosToRandom.Add("geo_64x64_service_gardens_JG_01"); geosToRandom.Add("geo_64x64_service_gardens_JG_02"); geosToRandom.Add("geo_64x64_service_gardens_HA_03"); geosToRandom.Add("geo_64x64_service_gardens_I_01"); geosToRandom.Add("geo_64x64_service_gardens_X_01"); geosToRandom.Add("geo_64x64_service_gardens_Lab_HSU_Womb"); geosToRandom.Add("geo_64x64_service_gardens_Lab_HSU_Prep"); geosToRandom.Add("geo_64x64_service_gardens_Lab_HSU_Prep_TestingFunc"); geosToRandom.Add("geo_64x64_service_gardens_Lab_HSU_Prep_Timur"); geosToRandom.Add("geo_64x64_service_gardens_hub_SF_01"); geosToRandom.Add("geo_64x64_service_gardens_I_02_SF"); geosToRandom.Add("geo_64x64_service_gardens_dead_end_SF"); geosToRandom.Add("geo_64x64_service_gardens_VS_01"); geosToRandom.Add("geo_64x64_service_gardens_bridge_R8D1"); geosToRandom.Add("geo_64x64_service_gardens_SF_01_R8D1"); geosToRandom.Add("geo_64x64_service_gardens_VS_01_R8A2"); geosToRandom.Add("geo_64x64_service_gardens_HA_01_R8A2"); geosToRandom.Add("geo_64x64_service_gardens_AW_01_R8D1"); geosToRandom.Add("geo_64x64_service_gardens_dead_end_SF_R8D1"); geosToRandom.Add("geo_64x64_service_gardens_HA_01_R7D1_01"); geosToRandom.Add("geo_64x64_mining_dig_site_AS_04"); geosToRandom.Add("geo_64x64_mining_dig_site_AS_02"); geosToRandom.Add("geo_64x64_mining_dig_site_AS_01"); geosToRandom.Add("geo_64x64_mining_dig_site_HA_01"); geosToRandom.Add("geo_64x64_mining_dig_site_HA_02"); geosToRandom.Add("geo_64x64_mining_dig_site_HA_03"); geosToRandom.Add("geo_64x64_mining_dig_site_HA_04"); geosToRandom.Add("geo_64x64_mining_dig_site_HA_05"); geosToRandom.Add("geo_64x64_mining_dig_site_HA_06"); geosToRandom.Add("geo_64x64_mining_dig_site_HA_07"); geosToRandom.Add("geo_64x64_mining_refinery_HA_01"); geosToRandom.Add("geo_64x64_mining_refinery_HA_02"); geosToRandom.Add("geo_64x64_mining_refinery_HA_03"); geosToRandom.Add("geo_64x64_mining_refinery_HA_04"); geosToRandom.Add("geo_64x64_mining_refinery_HA_05"); geosToRandom.Add("geo_64x64_mining_refinery_HA_06"); geosToRandom.Add("geo_64x64_mining_refinery_HA_07"); geosToRandom.Add("geo_64x64_mining_storage_HA_05"); geosToRandom.Add("geo_64x64_mining_storage_HA_06"); geosToRandom.Add("geo_64x64_mining_storage_HA_01"); geosToRandom.Add("geo_64x64_mining_storage_HA_02"); geosToRandom.Add("geo_64x64_mining_storage_HA_03"); geosToRandom.Add("geo_64x64_mining_storage_HA_04"); geosToRandom.Add("geo_64x64_mining_storage_HA_07"); geosToRandom.Add("geo_64x64_mining_storage_HA_08"); geosToRandom.Add("geo_64x64_mining_refinery_JG_01"); geosToRandom.Add("geo_64x64_mining_refinery_JG_02"); geosToRandom.Add("geo_64x64_mining_exit_01"); geosToRandom.Add("geo_64x64_mining_reactor_open_HA_01"); geosToRandom.Add("geo_64x64_mining_reactor_HA_02"); geosToRandom.Add("geo_64x64_mining_storage_hub_HA_01"); geosToRandom.Add("geo_64x64_mining_storage_hub_HA_02"); geosToRandom.Add("geo_64x64_mining_storage_hub_HA_03"); geosToRandom.Add("geo_64x64_mining_storage_hub_HA_04"); geosToRandom.Add("geo_64x64_mining_storage_hub_HA_05"); geosToRandom.Add("geo_64x64_mining_storage_vault_HA_01"); geosToRandom.Add("geo_64x64_mining_storage_I_HA_01"); geosToRandom.Add("geo_64x64_mining_refinery_X_HA_01"); geosToRandom.Add("geo_64x64_mining_refinery_X_HA_02"); geosToRandom.Add("geo_64x64_mining_refinery_X_HA_03"); geosToRandom.Add("geo_64x64_mining_refinery_X_HA_04"); geosToRandom.Add("geo_64x64_mining_refinery_X_HA_05"); geosToRandom.Add("geo_64x64_mining_refinery_X_HA_06"); geosToRandom.Add("geo_64x64_mining_refinery_I_HA_01"); geosToRandom.Add("geo_64x64_mining_refinery_I_HA_02"); geosToRandom.Add("geo_64x64_mining_refinery_I_HA_03"); geosToRandom.Add("geo_64x64_mining_refinery_I_HA_04"); geosToRandom.Add("geo_64x64_mining_refinery_I_HA_05"); geosToRandom.Add("geo_64x64_mining_refinery_L_HA_01"); geosToRandom.Add("geo_64x64_mining_refinery_dead_end_HA_01"); geosToRandom.Add("geo_64x64_mining_dig_site_hub_HA_01"); geosToRandom.Add("geo_64x64_mining_dig_site_hub_HA_02"); geosToRandom.Add("geo_64x64_mining_dig_site_hub_HA_03"); geosToRandom.Add("geo_64x64_mining_dig_site_I_HA_01"); geosToRandom.Add("geo_64x64_mining_dig_site_reactor_tunnel_I_HA_01"); geosToRandom.Add("geo_64x64_mining_dig_site_hub_SF_01"); geosToRandom.Add("geo_64x64_mining_refinery_I_HA_06"); geosToRandom.Add("geo_64x64_mining_dig_site_hub_SF_02"); geosToRandom.Add("geo_64x64_mining_storage_vault_v2_HA_01"); geosToRandom.Add("geo_64x64_mining_storage_hub_VS_01"); geosToRandom.Add("geo_64x64_mining_storage_vault_v3_HA_01"); geosToRandom.Add("geo_64x64_mining_refinery_I_HA_01_v2"); geosToRandom.Add("geo_64x64_mining_refinery_X_HA_07"); geosToRandom.Add("geo_64x64_mining_portal_HA_01"); geosToRandom.Add("geo_64x64_mining_HSU_exit_02"); geosToRandom.Add("geo_64x64_mining_HSU_exit_03"); geosToRandom.Add("geo_64x64_mining_refinery_I_HA_06_AW"); geosToRandom.Add("geo_64x64_mining_refinery_I_HA_03_R8E2"); geosToRandom.Add("geo_64x64_mining_refinery_I_HA_01_v2_R8E2"); geosToRandom.Add("geo_64x64_mining_dig_site_reactor_tunnel_I_HA_01_R8E2"); geosToRandom.Add("geo_64x64_mining_reactor_open_HA_01_R8E2"); geosToRandom.Add("geo_64x64_mining_refinery_I_HA_07"); geosToRandom.Add("geo_64x64_mining_refinery_X_HA_04_R8B3"); geosToRandom.Add("geo_64x64_mining_refinery_X_HA_04_test"); geosToRandom.Add("geo_64x64_mining_refinery_dead_end_HA_01_R8B3"); geosToRandom.Add("geo_64x64_mining_dig_site_hub_HA_03_v2"); geosToRandom.Add("geo_64x64_mining_refinery_I_HA_05_v3"); geosToRandom.Add("geo_64x64_mining_dig_site_HA_02_R8B3"); geosToRandom.Add("geo_64x64_mining_dig_site_HA_07_v2"); geosToRandom.Add("geo_64x64_mining_dig_site_HA_02_v2"); geosToRandom.Add("geo_64x64_mining_dig_site_HA_02_v3"); geosToRandom.Add("geo_64x64_mining_dig_site_AS_02_v2"); geosToRandom.Add("geo_64x64_mining_dig_site_HA_01_v2"); geosToRandom.Add("geo_64x64_mining_dig_site_HA_03_v2"); geosToRandom.Add("geo_64x64_mining_dig_site_AS_04_v2"); geosToRandom.Add("geo_64x64_mining_dig_site_HA_05_v2"); geosToRandom.Add("geo_64x64_mining_dig_site_HA_03_v3"); geosToRandom.Add("geo_64x64_mining_dig_site_HA_07_v3"); geosToRandom.Add("geo_64x64_mining_dig_site_HA_02_v4"); geosToRandom.Add("geo_64x64_mining_dig_site_hub_HA_01.R4E1"); geosToRandom.Add("geo_64x64_mining_dig_site_hub_SF_01_AW"); geosToRandom.Add("geo_64x64_mining_dig_site_HA_04_AW"); geosToRandom.Add("geo_64x64_mining_dig_site_HA_03_AW"); geosToRandom.Add("geo_64x64_mining_dig_site_HA_01_AW"); geosToRandom.Add("geo_64x64_mining_storage_I_HA_AW"); geosToRandom.Add("geo_64x64_mining_storage_HA_03_AW"); geosToRandom.Add("geo_64x64_mining_storage_SF_AW"); geosToRandom.Add("geo_64x64_mining_storage_HA_08_AW"); geosToRandom.Add("geo_64x64_mining_storage_HA_06_AW"); geosToRandom.Add("geo_64x64_mining_storage_HA_01_AW"); geosToRandom.Add("geo_64x64_mining_refinery_I_HA_02_AW"); geosToRandom.Add("geo_64x64_mining_refinery_I_HA_03_AW"); geosToRandom.Add("geo_64x64_mining_refinery_I_HA_05_AW"); geosToRandom.Add("geo_64x64_mining_HSU_exit_R8E1"); geosToRandom.Add("geo_64x64_mining_refinery_HA_04_v2"); geosToRandom.Add("geo_64x64_mining_refinery_HA_05_v2"); geosToRandom.Add("geo_64x64_mining_dig_site_HA_04_v2"); geosToRandom.Add("geo_64x64_mining_storage_hub_HA_04_R3B1"); geosToRandom.Add("geo_64x64_mining_refinery_X_HA_06_R3B2"); geosToRandom.Add("geo_64x64_mining_exit_01_tutorial"); geosToRandom.Add("geo_64x64_mining_storage_tutorial_VS_01"); geosToRandom.Add("geo_64x64_mining_storage_tutorial_VS_02"); geosToRandom.Add("geo_64x64_mining_storage_tutorial_VS_03"); geosToRandom.Add("geo_64x64_mining_storage_tutorial_VS_04"); geosToRandom.Add("geo_64x64_mining_storage_I_HA_01_tutorial"); geosToRandom.Add("geo_64x64_tech_data_center_HA_01"); geosToRandom.Add("geo_64x64_tech_data_center_HA_02"); geosToRandom.Add("geo_64x64_tech_data_center_HA_03"); geosToRandom.Add("geo_64x64_tech_data_center_HA_04"); geosToRandom.Add("geo_64x64_tech_data_center_HA_05"); geosToRandom.Add("geo_64x64_tech_data_center_HA_06"); geosToRandom.Add("geo_64x64_tech_data_center_HA_07"); geosToRandom.Add("geo_64x64_tech_data_center_HA_08"); geosToRandom.Add("geo_64x64_tech_data_center_HA_09"); geosToRandom.Add("geo_64x64_tech_lab_HA_05"); geosToRandom.Add("geo_64x64_tech_lab_HA_02"); geosToRandom.Add("geo_64x64_tech_lab_HA_03"); geosToRandom.Add("geo_64x64_tech_lab_HA_04"); geosToRandom.Add("geo_64x64_tech_lab_HA_01"); geosToRandom.Add("geo_64x64_tech_lab_HA_06"); geosToRandom.Add("geo_64x64_tech_lab_HA_07"); geosToRandom.Add("geo_64x64_tech_lab_HA_08"); geosToRandom.Add("geo_64x64_tech_lab_HA_09"); geosToRandom.Add("geo_64x64_tech_lab_HA_10"); geosToRandom.Add("geo_64x64_Lab_dead_end_room_01"); geosToRandom.Add("geo_64x64_Lab_dead_end_room_02"); geosToRandom.Add("geo_64x64_tech_lab_hub_HA_01"); geosToRandom.Add("geo_64x64_tech_lab_hub_HA_02"); geosToRandom.Add("geo_64x64_tech_destroyed_HA_01"); geosToRandom.Add("geo_64x64_lab_reactor_HA_01"); geosToRandom.Add("geo_64x64_lab_I_HA_01"); geosToRandom.Add("geo_64x64_lab_I_HA_02"); geosToRandom.Add("geo_64x64_tech_lab_hub_HA_03"); geosToRandom.Add("geo_64x64_tech_lab_hub_HA_04"); geosToRandom.Add("geo_64x64_tech_destroyed_HA_02"); geosToRandom.Add("geo_64x64_tech_data_center_dead_end_HA_01"); geosToRandom.Add("geo_64x64_lab_dead_end_HA_03"); geosToRandom.Add("geo_64x64_tech_lab_hub_HA_01_V2"); geosToRandom.Add("geo_64x64_lab_reactor_HA_02"); geosToRandom.Add("geo_64x64_lab_I_HA_03"); geosToRandom.Add("geo_64x64_tech_data_center_hub_SF_01"); geosToRandom.Add("geo_64x64_tech_data_center_hub_JG_01"); geosToRandom.Add("geo_64x64_tech_lab_hub_HA_03_V2"); geosToRandom.Add("geo_64x64_tech_destroyed_HA_03"); geosToRandom.Add("geo_64x64_tech_data_center_hub_SF_ConduitVersion"); geosToRandom.Add("geo_64x64_tech_lab_hub_HA_04_V3"); geosToRandom.Add("geo_64x64_lab_dead_end_HA_03_R7E1_01"); geosToRandom.Add("geo_64x64_lab_dead_end_HA_03_R7E1_02"); geosToRandom.Add("geo_64x64_tech_node_transition_02_JG"); geosToRandom.Add("geo_64x64_tech_node_transition_03_JG"); geosToRandom.Add("geo_64x64_tech_node_transition_04_JG"); geosToRandom.Add("geo_64x64_tech_node_transition_05_JG"); geosToRandom.Add("geo_64x64_tech_node_transition_06_JG"); geosToRandom.Add("geo_64x64_portal_HA_01_Spawn"); geosToRandom.Add("geo_64x64_lab_dead_end_HA_03_R7E1_03"); geosToRandom.Add("geo_64x64_tech_lab_hub_HA_02_V2"); geosToRandom.Add("geo_64x64_tech_lab_hub_SF_02"); geosToRandom.Add("geo_64x64_Lab_dead_end_room_03"); geosToRandom.Add("geo_64x64_tech_data_center_MainframeRoom_01"); geosToRandom.Add("geo_64x64_lab_dead_end_HA_03_R7E1_04"); geosToRandom.Add("geo_64x64_tech_lab_hub_LF_01"); geosToRandom.Add("geo_64x64_tech_data_center_hub_JG_02"); geosToRandom.Add("geo_64x64_tech_data_center_hub_JG_02_v2"); geosToRandom.Add("geo_64x64_tech_lab_hub_HA_04_V4_LF"); geosToRandom.Add("geo_64x64_tech_lab_hub_HA_01_V3_LF"); geosToRandom.Add("geo_64x64_tech_node_transition_07_JG"); geosToRandom.Add("geo_64x64_Lab_dead_end_room_02_R5C3"); geosToRandom.Add("geo_64x64_Lab_dead_end_room_02_R8C2"); geosToRandom.Add("geo_64x64_tech_lab_LF_01_R8C2"); geosToRandom.Add("geo_64x64_tech_node_transition_07_LF"); geosToRandom.Add("geo_64x64_tech_lab_hub_LF_03_R8C2"); geosToRandom.Add("geo_64x64_lab_I_HA_03_v2"); geosToRandom.Add("geo_64x64_portal_HA_01"); geosToRandom.Add("geo_64x64_tech_lab_hub_HA_04_V2"); geosToRandom.Add("geo_64x64_portal_HA_03"); geosToRandom.Add("geo_64x64_tech_lab_hub_HA_03_R8B1"); geosToRandom.Add("geo_64x64_tech_lab_HA_10_R8B1"); geosToRandom.Add("geo_64x64_tech_lab_hub_HA_01_R8B1"); geosToRandom.Add("geo_64x64_tech_lab_HA_06_R8B1"); geosToRandom.Add("geo_64x64_tech_lab_HA_06_R8B1_v2"); geosToRandom.Add("geo_64x64_tech_lab_hub_HA_02_R8B1"); geosToRandom.Add("geo_64x64_Lab_dead_end_room_04"); geosToRandom.Add("geo_64x64_Lab_dead_end_room_01_Gamescom"); geosToRandom.Add("geo_64x64_Lab_dead_end_room_02_R4C1"); geosToRandom.Add("geo_64x64_tech_lab_hub_HA_02_R5C2"); geosToRandom.Add("geo_64x64_tech_lab_HA_08_v2_R5B2"); geosToRandom.Add("geo_64x64_tech_lab_HA_09_v2_R5B2"); geosToRandom.Add("geo_64x64_tech_data_center_HA_05_V2_R5B2"); geosToRandom.Add("geo_64x64_tech_data_center_HA_05_v3_R5B2"); geosToRandom.Add("geo_64x64_tech_data_center_HA_04_V2_R5B2"); geosToRandom.Add("geo_64x64_tech_data_center_HA_07_v2_R5B2"); geosToRandom.Add("geo_64x64_tech_data_center_HA_09_v2_R5B2"); geosToRandom.Add("geo_64x64_tech_data_center_HA_01_v2_R5B2"); geosToRandom.Add("geo_64x64_Lab_dead_end_room_02_R3D1"); geosToRandom.Add("geo_64x64_tech_lab_hub_HA_01_R3D1"); geosToRandom.Add("geo_64x64_Lab_dead_end_room_01_R3A1"); geosToRandom.Add("geo_64x64_lab_dead_end_HA_03_Spawn"); geosToRandom.Add("geo_64x64_Lab_dead_end_HSU"); geosToRandom.Add("geo_64x64_tech_lab_HA_05_R5D2"); geosToRandom.Add("geo_64x64_tech_lab_HA_02_R5D2"); geosToRandom.Add("geo_64x64_service_floodways_HA_01"); geosToRandom.Add("geo_64x64_service_floodways_HA_02"); geosToRandom.Add("geo_64x64_service_floodways_HA_03"); geosToRandom.Add("geo_64x64_service_floodways_HA_04"); geosToRandom.Add("geo_64x64_service_floodways_HA_05"); geosToRandom.Add("geo_64x64_service_floodways_HA_06"); geosToRandom.Add("geo_64x64_service_floodways_HA_07"); geosToRandom.Add("geo_64x64_service_floodways_HA_08"); geosToRandom.Add("geo_64x64_service_floodways_HA_09"); geosToRandom.Add("geo_64x64_service_floodways_SF_01"); geosToRandom.Add("geo_64x64_service_floodways_hub_HA_01"); geosToRandom.Add("geo_64x64_service_floodways_I_HA_01"); geosToRandom.Add("geo_64x64_service_floodways_I_HA_02"); geosToRandom.Add("geo_64x64_service_floodways_hub_HA_02"); geosToRandom.Add("geo_64x64_service_floodways_hub_HA_03"); geosToRandom.Add("geo_64x64_service_floodways_dead_end_HA_01"); geosToRandom.Add("geo_64x64_service_floodways_hub_SF_01"); geosToRandom.Add("geo_64x64_service_floodways_hub_SF_02"); geosToRandom.Add("geo_64x64_service_floodways_hub_AW_01"); geosToRandom.Add("geo_64x64_service_floodways_hub_AW_01_V2"); geosToRandom.Add("geo_64x64_service_floodways_I_HA_01_R7D1"); geosToRandom.Add("geo_64x64_mining_refinery_X_VS_01_v2"); geosToRandom.Add("geo_64x64_service_floodways_VS_01"); geosToRandom.Add("geo_64x64_service_floodways_hub_SF_01_R8D1"); geosToRandom.Add("geo_64x64_mining_refinery_X_VS_01"); geosToRandom.Add("geo_64x64_mining_storage_VS_TestSounds"); geosToRandom.Add("geo_64x64_mining_refinery_HA_08"); geosToRandom.Add("geo_64x64_mining_exit_02"); geosToRandom.Add("geo_64x64_mining_refinery_X_HA_06_v2"); geosToRandom.Add("geo_64x64_mining_refinery_I_HA_05_v2"); geosToRandom.Add("geo_64x64_tech_data_center_hub_JG"); geosToRandom.Add("geo_64x64_service_floodways_HA_08_V2"); geosToRandom.Add("geo_64x64_service_floodways_HA_07_V2"); geosToRandom.Add("geo_64x64_service_floodways_HA_03_V2"); geosToRandom.Add("geo_64x64_service_floodways_HA_05_V2"); geosToRandom.Add("geo_64x64_service_floodways_dead_end_HA_02"); geosToRandom.Add("geo_64x64_service_floodways_I_HA_03"); geosToRandom.Add("geo_64x64_service_floodways_hub_HA_03_V2"); geosToRandom.Add("geo_64x64_service_floodways_I_HA_04"); geosToRandom.Add("geo_64x64_service_floodways_I_HA_03_v2"); geosToRandom.Add("geo_64x64_service_floodways_VS_03_ControlRoom"); geosToRandom.Add("geo_64x64_service_floodways_VS_02_ControlRoom"); geosToRandom.Add("geo_64x64_service_floodways_hub_SF_02_R8A2"); geosToRandom.Add("geo_64x64_service_floodways_hub_HA_03_R8A2"); geosToRandom.Add("geo_64x64_mining_storage_tutorial_VS_01_v2"); geosToRandom.Add("geo_64x64_mining_storage_tutorial_VS_02_v2"); geosToRandom.Add("geo_64x64_mining_storage_tutorial_VS_03_v2"); geosToRandom.Add("geo_64x64_mining_storage_tutorial_VS_04_v2"); geosToRandom.Add("geo_64x64_mining_storage_tutorial_VS_05_v2"); geosToRandom.Add("geo_64x64_mining_storage_I_HA_01_tutorial_v2"); geosToRandom.Add("geo_64x64_mining_exit_01_tutorial_v2"); geosToRandom.Add("geo_64x64_service_floodways_dead_end_HA_01_R8A2"); geosToRandom.Add("geo_64x64_mining_node_transition_01"); geosToRandom.Add("geo_64x64_mining_node_transition_R8A2_01"); geosToRandom.Add("geo_64x64_mining_node_transition_R8A2_02"); geosToRandom.Add("geo_64x64_service_floodways_dead_end_HA_01_R8A2_v2"); geosToRandom.Add("geo_64x64_service_floodways_dead_end_HA_01_v2"); geosToRandom.Add("geo_64x64_service_floodways_hub_HA_01_R7D1"); geosToRandom.Add("geo_64x64_service_floodways_dead_end_HA_01_R7D1"); geosToRandom.Add("geo_64x64_tech_lab_HA_08_rot_90"); geosToRandom.Add("geo_64x64_tech_data_center_hub_SF_02_CreativeDesign"); geosToRandom.Add("geo_64x64_mining_HSU_exit_01"); geosToRandom.Add("geo_64x64_service_floodways_HA_03_R5A1_1"); geosToRandom.Add("geo_64x64_service_floodways_HA_01_R5A1_1"); geosToRandom.Add("geo_64x64_service_floodways_HA_05_R5A1_1"); geosToRandom.Add("geo_64x64_service_floodways_HA_06_R5A1_1"); geosToRandom.Add("geo_64x64_service_floodways_HA_03_R5A1_2"); geosToRandom.Add("geo_64x64_service_floodways_HA_03_R5A1_3"); geosToRandom.Add("geo_64x64_service_floodways_HA_05_R5A1_2"); geosToRandom.Add("geo_64x64_service_floodways_HA_06_R5A1_2"); geosToRandom.Add("geo_64x64_service_floodways_HA_01_R5A1_2"); geosToRandom.Add("geo_64x64_mining_storage_HA_06b"); geosToRandom.Add("geo_64x64_mining_challenge_01"); geosToRandom.Add("geo_64x64_mining_dig_site_HA_02_R2A1"); portals.Add("Assets/AssetPrefabs/Complex/Tech/Geomorphs/geo_64x64_portal_HA_01.prefab"); portals.Add("Assets/AssetPrefabs/Complex/Tech/Geomorphs/geo_64x64_portal_HA_03.prefab"); portals.Add("Assets/AssetPrefabs/Complex/Mining/Geomorphs/geo_64x64_mining_portal_HA_01.prefab"); portals.Add("Assets/AssetPrefabs/Complex/Tech/Geomorphs/geo_64x64_portal_HA_01_Spawn.prefab"); clusters.Add("Assets/AssetPrefabs/Complex/Mining/Geomorphs/Digsite/geo_64x64_mining_dig_site_hub_HA_01.prefab"); clusters.Add("Assets/AssetPrefabs/Complex/Mining/Geomorphs/Digsite/geo_64x64_mining_dig_site_hub_HA_02.prefab"); clusters.Add("Assets/AssetPrefabs/Complex/Mining/Geomorphs/Digsite/geo_64x64_mining_dig_site_hub_HA_01.prefab"); clusters.Add("Assets/AssetPrefabs/Complex/Mining/Geomorphs/Digsite/geo_64x64_mining_dig_site_hub_HA_02.prefab"); clusters.Add("Assets/AssetPrefabs/Complex/Tech/Geomorphs/geo_64x64_tech_lab_hub_HA_02_R5C2.prefab"); clusters.Add("Assets/AssetPrefabs/Complex/Mining/Geomorphs/Digsite/geo_64x64_mining_dig_site_hub_HA_01.prefab"); clusters.Add("Assets/AssetPrefabs/Complex/Mining/Geomorphs/Refinery/geo_64x64_mining_refinery_X_HA_07.prefab"); clusters.Add("Assets/AssetPrefabs/Complex/Tech/Geomorphs/geo_64x64_tech_lab_hub_LF_03_R8C2.prefab"); clusters.Add("Assets/AssetPrefabs/Complex/Mining/Geomorphs/Digsite/geo_64x64_mining_dig_site_hub_HA_01.prefab"); } private void PopulateBlackList() { blackList.Add("Mainframe"); blackList.Add("dead_end"); blackList.Add("reactor"); blackList.Add("geo_64x64_Lab_dead_end_room"); blackList.Add("geo_64x64_mining_refinery_X"); blackList.Add("portal"); blackList.Add("exit"); blackList.Add("geo_64x64_tech_lab_hub_HA_02"); blackList.Add("geo_64x64_service_gardens_Lab_HSU_Prep_TestingFunc"); blackList.Add("geo_64x64_service_gardens_X_01"); blackList.Add("geo_64x64_service_gardens_I_01"); blackList.Add("geo_64x64_service_gardens"); } } internal class ItemsRandomizer : Randomizer { private ConsumableDistributionDataBlock[] smallItems = Datablock.Blocks<ConsumableDistributionDataBlock>(); private BigPickupDistributionDataBlock[] bigitem = Datablock.Blocks<BigPickupDistributionDataBlock>(); public static bool randomize; public void Randomize(ExpeditionZoneData zone, ExpeditionZoneData original, int index) { if (randomize) { if (zone.ConsumableDistributionInZone != 39) { zone.ConsumableDistributionInZone = ((GameDataBlockBase<ConsumableDistributionDataBlock>)(object)smallItems[Rando.Next(smallItems.Length)]).persistentID; } uint num = zone.BigPickupDistributionInZone; if (Rando.Next(3) == 0 && num == 0) { num = ((GameDataBlockBase<BigPickupDistributionDataBlock>)(object)bigitem[Rando.Next(bigitem.Length)]).persistentID; } zone.BigPickupDistributionInZone = num; EntryPoint.LogIt("Small pickups: " + zone.ConsumableDistributionInZone); EntryPoint.LogIt("Big pickups: " + zone.BigPickupDistributionInZone); } } } internal class Layout { public static List<Randomizer> randomizers = new List<Randomizer>(); public static int tierLevel; public static LevelLayoutDataBlock currentMainBlock; public static LevelLayoutDataBlock currentSecBlock; public static LevelLayoutDataBlock currentOverBlock; public Layout() { randomizers.Add(new Balance()); randomizers.Add(new Geos()); randomizers.Add(new ItemsRandomizer()); randomizers.Add(new BioScans()); randomizers.Add(new Enemies()); randomizers.Add(new LevelDesignRando()); randomizers.Add(new Spitters()); randomizers.Add(new Events()); tierLevel = 0; } public void GetBlockAndBuild() { Rando rando = new Rando(); Danger danger = new Danger(); ExpeditionInTierData activeExpedition = RundownManager.ActiveExpedition; currentMainBlock = null; currentSecBlock = null; currentOverBlock = null; LevelLayoutDataBlock val = (currentMainBlock = Datablock.Block<LevelLayoutDataBlock>(activeExpedition.LevelLayoutData)); Datablock.data[0] = val; RandomizeLayout(val); if (activeExpedition.SecondaryLayerEnabled && activeExpedition.SecondaryLayout != 0) { LevelLayoutDataBlock val2 = Datablock.Block<LevelLayoutDataBlock>(activeExpedition.SecondaryLayout); if (val2 != null) { Datablock.data[1] = val2; currentSecBlock = val2; RandomizeLayout(val2); } } if (activeExpedition.ThirdLayerEnabled && activeExpedition.ThirdLayout != 0) { LevelLayoutDataBlock val3 = Datablock.Block<LevelLayoutDataBlock>(activeExpedition.ThirdLayout); if (val3 != null) { Datablock.data[2] = val3; currentOverBlock = val3; RandomizeLayout(val3); } } } public void RandomizeLayout(LevelLayoutDataBlock block) { BuildPatch.levelFailCount = 0; BuildPatch.zoneFailCount = 0; EntryPoint.LogIt($"GTFO ----> EvilJish-like: {((GameDataBlockBase<LevelLayoutDataBlock>)(object)block).name} -- {BuildPatch.levelFailCount}"); List<ExpeditionZoneData> zones = block.Zones; List<ExpeditionZoneData> zones2 = Datablock.GetOrignalLevelLayout(((GameDataBlockBase<LevelLayoutDataBlock>)(object)block).name).Zones; for (int i = 0; i < zones.Count; i++) { ResetZoneData(zones[i], zones2[i]); } for (int j = 0; j < randomizers.Count; j++) { randomizers[j].Preparation(zones, zones2); } for (int k = 0; k < zones.Count; k++) { for (int l = 0; l < randomizers.Count; l++) { randomizers[l].EarlyRandomize(zones[k], zones2[k], k); } } for (int m = 0; m < zones.Count; m++) { for (int n = 0; n < randomizers.Count; n++) { randomizers[n].Randomize(zones[m], zones2[m], m); } } for (int num = 0; num < zones.Count; num++) { for (int num2 = 0; num2 < randomizers.Count; num2++) { randomizers[num2].LateRandomize(zones[num], zones2[num], num); } } for (int num3 = 0; num3 < randomizers.Count; num3++) { randomizers[num3].Finalize(zones, zones2); } EntryPoint.LogIt("We're done here folks for " + ((GameDataBlockBase<LevelLayoutDataBlock>)(object)block).name); } public static void RedoRandomizeLayout(LevelLayoutDataBlock block, int alias) { if (block == null) { return; } List<ExpeditionZoneData> zones = block.Zones; List<ExpeditionZoneData> zones2 = Datablock.GetOrignalLevelLayout(((GameDataBlockBase<LevelLayoutDataBlock>)(object)block).name).Zones; for (int i = 0; i < zones.Count; i++) { if (alias == zones[i].Alias) { EntryPoint.LogIt("REDO: " + ((GameDataBlockBase<LevelLayoutDataBlock>)(object)block).name); Geos.current.ReRandomize(zones[i], zones2[i], i); } } } public static void RedoRandomizeLayout(LevelLayoutDataBlock block) { if (block != null) { EntryPoint.LogIt("REDO: " + ((GameDataBlockBase<LevelLayoutDataBlock>)(object)block).name); List<ExpeditionZoneData> zones = block.Zones; List<ExpeditionZoneData> zones2 = Datablock.GetOrignalLevelLayout(((GameDataBlockBase<LevelLayoutDataBlock>)(object)block).name).Zones; for (int i = 0; i < zones.Count; i++) { Geos.current.ReRandomize(zones[i], zones2[i], i); } } } public static void ResetZoneData(ExpeditionZoneData zones, ExpeditionZoneData ogZones) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) zones.CustomGeomorph = ogZones.CustomGeomorph; zones.SubComplex = ogZones.SubComplex; zones.LightSettings = ogZones.LightSettings; zones.AltitudeData.AllowedZoneAltitude = ogZones.AltitudeData.AllowedZoneAltitude; zones.AltitudeData.ChanceToChange = ogZones.AltitudeData.ChanceToChange; zones.ConsumableDistributionInZone = ogZones.ConsumableDistributionInZone; zones.BigPickupDistributionInZone = ogZones.BigPickupDistributionInZone; zones.ChainedPuzzleToEnter = ogZones.ChainedPuzzleToEnter; zones.ActiveEnemyWave.HasActiveEnemyWave = ogZones.ActiveEnemyWave.HasActiveEnemyWave; zones.ActiveEnemyWave.EnemyGroupInfrontOfDoor = ogZones.ActiveEnemyWave.EnemyGroupInfrontOfDoor; zones.ActiveEnemyWave.EnemyGroupsInArea = ogZones.ActiveEnemyWave.EnemyGroupsInArea; zones.ActiveEnemyWave.EnemyGroupInArea = ogZones.ActiveEnemyWave.EnemyGroupInArea; zones.EnemyRespawning = ogZones.EnemyRespawning; zones.EnemySpawningInZone = ogZones.EnemySpawningInZone; zones.Alias = ogZones.Alias; zones.AliasOverride = ogZones.AliasOverride; zones.LocalIndex = ogZones.LocalIndex; zones.StartExpansion = ogZones.StartExpansion; zones.StartPosition = ogZones.StartPosition; zones.ZoneExpansion = ogZones.ZoneExpansion; zones.StartPosition_IndexWeight = ogZones.StartPosition_IndexWeight; zones.BuildFromLocalIndex = ogZones.BuildFromLocalIndex; zones.BuildFromZoneAlias = ogZones.BuildFromZoneAlias; zones.ProgressionPuzzleToEnter = ogZones.ProgressionPuzzleToEnter; zones.StaticSpawnDataContainers.Clear(); zones.StaticSpawnDataContainers = ResetStaticSpawn(ogZones.StaticSpawnDataContainers); zones.GroundSpawnersInZone = ogZones.GroundSpawnersInZone; zones.EventsOnDoorScanDone = ResetEvents(ogZones.EventsOnDoorScanDone); zones.EventsOnApproachDoor = ResetEvents(ogZones.EventsOnApproachDoor); zones.EventsOnOpenDoor = ResetEvents(ogZones.EventsOnOpenDoor); zones.EventsOnUnlockDoor = ResetEvents(ogZones.EventsOnUnlockDoor); zones.EventsOnBossDeath = ResetEvents(ogZones.EventsOnBossDeath); zones.EventsOnDoorScanStart = ResetEvents(ogZones.EventsOnDoorScanStart); zones.EventsOnPortalWarp = ResetEvents(ogZones.EventsOnPortalWarp); zones.EventsOnTerminalDeactivateAlarm = ResetEvents(ogZones.EventsOnTerminalDeactivateAlarm); zones.HealthMulti = ogZones.HealthMulti; zones.ToolAmmoMulti = ogZones.ToolAmmoMulti; zones.WeaponAmmoMulti = ogZones.WeaponAmmoMulti; zones.DisinfectionMulti = ogZones.DisinfectionMulti; } public static List<WardenObjectiveEventData> ResetEvents(List<WardenObjectiveEventData> ogEvents) { if (ogEvents == null) { return null; } List<WardenObjectiveEventData> val = new List<WardenObjectiveEventData>(); for (int i = 0; i < ogEvents.Count; i++) { val.Add(ogEvents[i]); } return val; } public static List<StaticSpawnDataContainer> ResetStaticSpawn(List<StaticSpawnDataContainer> ogStatics) { if (ogStatics == null) { return null; } List<StaticSpawnDataContainer> val = new List<StaticSpawnDataContainer>(); for (int i = 0; i < ogStatics.Count; i++) { val.Add(ogStatics[i]); } return val; } } public class LevelDesignRando : Randomizer { private List<int> connectionCounts; public static bool randomize; public void Preparation(List<ExpeditionZoneData> zones, List<ExpeditionZoneData> ogZones) { connectionCounts = new List<int>(); Enumerator<ExpeditionZoneData> enumerator = zones.GetEnumerator(); while (enumerator.MoveNext()) { ExpeditionZoneData current = enumerator.Current; connectionCounts.Add(0); } } public void EarlyRandomize(ExpeditionZoneData zone, ExpeditionZoneData original, int i) { //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Expected O, but got Unknown //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Expected O, but got Unknown if (!randomize || i == 0) { return; } EntryPoint.LogIt("JISH RANDOOOOO TIMMMEEEE!!!"); int num = ((i >= 3) ? Rando.Next(i - 2, i) : Rando.Next(i)); if (connectionCounts[num] < 2) { connectionCounts[num]++; zone.BuildFromLocalIndex = (eLocalZoneIndex)num; int num2 = ((i >= 3) ? Rando.Next(i) : Rando.Next(i - 3, i)); ProgressionPuzzleData val = new ProgressionPuzzleData { PlacementCount = 1 }; if (Rando.Next(4) == 0) { val.PuzzleType = (eProgressionPuzzleType)1; } else if (Rando.Next(4) == 1) { val.PuzzleType = (eProgressionPuzzleType)2; } val.ZonePlacementData.Add(new ZonePlacementData { LocalIndex = (eLocalZoneIndex)num2, DimensionIndex = (eDimensionIndex)0 }); zone.ProgressionPuzzleToEnter = val; zone.StartPosition = (eZoneBuildFromType)5; zone.StartPosition_IndexWeight = (float)Rando.Next(25, 100) / 100f; } } public void LateRandomize(ExpeditionZoneData zone, ExpeditionZoneData original, int index) { if (randomize) { zone.AliasOverride = Rando.Next(50, 450); } } } public interface Randomizer { void Preparation(List<ExpeditionZoneData> zones, List<ExpeditionZoneData> ogZones) { } void EarlyRandomize(ExpeditionZoneData zone, ExpeditionZoneData original, int index) { } void Randomize(ExpeditionZoneData zone, ExpeditionZoneData original, int index) { } void LateRandomize(ExpeditionZoneData zone, ExpeditionZoneData original, int index) { } void Finalize(List<ExpeditionZoneData> zones, List<ExpeditionZoneData> ogZones) { } } internal class Spitters : Randomizer { public static bool randomize; public void Randomize(ExpeditionZoneData zone, ExpeditionZoneData original, int index) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown if (randomize) { StaticSpawnDataContainer val = new StaticSpawnDataContainer { Count = Rando.Next(30, 50) }; switch (Rando.Next(9)) { case 0: val.StaticSpawnDataId = 1u; break; case 1: val.StaticSpawnDataId = 3u; break; } zone.StaticSpawnDataContainers.Add(val); } } } } namespace GTFR.Patches { [HarmonyPatch] internal class BigPickUpPatch { public static int seedweed; [HarmonyPrefix] [HarmonyPatch(typeof(LG_PickupItem), "SetupAsBigPickupItem", new Type[] { typeof(int), typeof(BigPickupDistributionDataBlock), typeof(bool), typeof(int) })] public static bool SpawnPatch(LG_PickupItem __instance, ref int randomSeed, ref BigPickupDistributionDataBlock data, ref bool isWardenObjectiveItem, ref int objectiveChainIndex) { __instance.SetupCommon(); __instance.SetupBigPickupItemWithItemId(data.SpawnData[seedweed % data.SpawnData.Count].ItemID, isWardenObjectiveItem, objectiveChainIndex); seedweed++; return false; } } [HarmonyPatch] internal class BoosterPatch { [HarmonyPrefix] [HarmonyPatch(typeof(DropServerGameSession), "ConsumeBoosters")] public static bool KeepBooster() { return false; } [HarmonyPostfix] [HarmonyPatch(typeof(ArtifactInventory), "GetArtifactCount")] public static void BoosterFarm(ref int __result) { __result = 1000; } [HarmonyPrefix] [HarmonyPatch(typeof(DropServerManager), "NewGameSession")] public static bool BoosterSessionPatch(ref uint[] boosterIds) { boosterIds = null; return true; } } [Harmony] [HarmonyPatch] internal class BuildPatch { public static int levelFailCount; public static int zoneFailCount; public static LG_ZoneJob_CreateExpandFromData currentZone; [HarmonyFinalizer] [HarmonyPatch(typeof(LG_ZoneJob_CreateExpandFromData), "Build")] public static void BuildFinalizer(LG_ZoneJob_CreateExpandFromData __instance, ref Exception __exception, ref bool __result) { if (__exception != null) { levelFailCount++; zoneFailCount++; EntryPoint.LogIt($"We failed {__instance.m_zone.AliasName} -- {__instance.m_zone.m_coverage} -- {__instance.m_subSeed} -- {__instance.m_zone.m_subSeed} -- {levelFailCount}"); currentZone = __instance; if (levelFailCount < 100) { if (zoneFailCount > 7) { EntryPoint.LogIt("We're Bailing"); Layout.RedoRandomizeLayout(Layout.currentMainBlock, __instance.m_zone.Alias); Layout.RedoRandomizeLayout(Layout.currentSecBlock, __instance.m_zone.Alias); Layout.RedoRandomizeLayout(Layout.currentOverBlock, __instance.m_zone.Alias); zoneFailCount = 0; } __instance.CleanupFailedZoneBuilds(); LG_Zone zone = __instance.m_zone; uint subSeed = zone.m_subSeed; zone.m_subSeed = subSeed + 1; subSeed = __instance.m_subSeed; __instance.m_subSeed = subSeed + 1; __result = false; } else { EntryPoint.LogIt("We're REDOING EVERYTHING"); __result = false; levelFailCount = 0; ((GlobalManager)Builder.Current).OnLevelCleanupPreparation(); ((GlobalManager)Builder.Current).OnLevelCleanup(); ExpeditionInTierData activeExpedition = RundownManager.ActiveExpedition; int sessionSeed = activeExpedition.SessionSeed; activeExpedition.SessionSeed = sessionSeed + 1; BuildSeedData seeds = RundownManager.ActiveExpedition.Seeds; sessionSeed = seeds.BuildSeed; seeds.BuildSeed = sessionSeed + 1; Builder.Current.Build(); } } else { EntryPoint.LogIt($"Building {__instance.m_zone.AliasName} -- {((Object)__instance.m_zone.m_sourceExpander).name} -- {__result}"); } } public static void Reset() { ((GlobalManager)Builder.Current).OnLevelCleanupPreparation(); ((GlobalManager)Builder.Current).OnLevelCleanup(); ExpeditionInTierData activeExpedition = RundownManager.ActiveExpedition; int sessionSeed = activeExpedition.SessionSeed; activeExpedition.SessionSeed = sessionSeed + 1; BuildSeedData seeds = RundownManager.ActiveExpedition.Seeds; sessionSeed = seeds.BuildSeed; seeds.BuildSeed = sessionSeed + 1; Builder.Current.Build(); } } [HarmonyPatch] internal class ConfigButtonPatch { private static eRundownKey type; private static eRundownTier tier; private static int expIndex; private static string customRundownKey; private static uint customRundownID; [HarmonyPostfix] [HarmonyPatch(typeof(CM_PageLoadout), "Setup")] public static void NewButton(CM_PageLoadout __instance) { //IL_005f: Unknown result type (might be due to invalid IL or missing references) GameObject val = Object.Instantiate<GameObject>(((Component)((Component)__instance).gameObject.transform.GetChild(2).GetChild(1).GetChild(1)).gameObject, ((Component)((Component)__instance).gameObject.transform.GetChild(2).GetChild(1)).gameObject.transform); val.transform.localPosition = new Vector3(-450f, 0f, 0f); val.SetActive(true); Action<int> action = delegate { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) RundownManager.MasterSelectActiveExpedition(type, tier, expIndex, customRundownKey, customRundownID); }; ((CM_Item)val.GetComponent<CM_TimedButton>()).OnBtnPressCallback = Action<int>.op_Implicit(action); ((TMP_Text)val.GetComponentInChildren<TextMeshPro>()).SetText("Apply Config", true); } [HarmonyPrefix] [HarmonyPatch(typeof(PlayerChatManager), "PostMessage")] private static void ManualReset(PlayerChatManager __instance) { //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) if (__instance.m_currentValue.ToLower().Contains("/applyconfig")) { RundownManager.MasterSelectActiveExpedition(type, tier, expIndex, customRundownKey, customRundownID); __instance.m_currentValue = "MANUALLY APPLYING CONFIG"; } } [HarmonyPrefix] [HarmonyPatch(typeof(RundownManager), "MasterSelectActiveExpedition")] private static void CustomCommand(ref eRundownKey type, ref eRundownTier tier, ref int expIndex, ref string customRundownKey, ref uint customRundownID) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) ConfigButtonPatch.type = type; ConfigButtonPatch.tier = tier; ConfigButtonPatch.expIndex = expIndex; ConfigButtonPatch.customRundownKey = customRundownKey; ConfigButtonPatch.customRundownID = customRundownID; } } [HarmonyPatch] internal class EnemyPatch { public static bool random; public static void ScoutWaveSpawn(AIG_CourseNode course, uint settings = 3u, uint population = 72u) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) population = Enemies.ReturnPopulation(); ushort num = default(ushort); Mastermind.Current.TriggerSurvivalWave(course, settings, population, ref num, (SurvivalWaveSpawnType)0, 0f, 2f, true, false, default(Vector3), ""); } public static void MomBirthSpawn(EAB_Birthing __instance) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) __instance.m_groupDataBlock = Enemies.RandomHunterGroupStatic(); Mastermind.Current.SpawnGroup(((EnemyAbility)__instance).m_owner.Position, ((Agent)((EnemyAbility)__instance).m_owner).CourseNode, (EnemyGroupType)2, (eEnemyGroupSpawnType)4, __instance.m_groupDataBlock, __instance.m_childrenAllowedSpawn * __instance.m_childrenCost, ((EnemyAbility)__instance).m_owner.Position, ((Il2CppObjectBase)((Agent)((EnemyAbility)__instance).m_owner).m_replicator).TryCast<IReplicator>()); } [HarmonyPrefix] [HarmonyPatch(typeof(EAB_Birthing), "DoTrigger")] public static bool SpawnBirthPatch(ref EAB_Birthing __instance) { if (!random) { return true; } __instance.m_lastSpawnedRel = __instance.m_childrenAllowedSpawn / (float)__instance.m_childrenPerBirth; if (!SNet.IsMaster) { return false; } MomBirthSpawn(__instance); ((Behaviour)__instance).enabled = true; __instance.m_state = (BirthingState)1; return false; } [HarmonyPrefix] [HarmonyPatch(typeof(ES_ScoutScream), "CommonUpdate")] [HarmonyWrapSafe] public static bool ScoutScreamPatch(ES_ScoutScream __instance) { //IL_0015: 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_001b: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected I4, but got Unknown //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_0352: Unknown result type (might be due to invalid IL or missing references) //IL_0400: Unknown result type (might be due to invalid IL or missing references) //IL_0247: Unknown result type (might be due to invalid IL or missing references) //IL_0251: Expected O, but got Unknown //IL_0253: Unknown result type (might be due to invalid IL or missing references) //IL_025d: Expected O, but got Unknown //IL_0265: Unknown result type (might be due to invalid IL or missing references) //IL_0467: Unknown result type (might be due to invalid IL or missing references) //IL_0289: Unknown result type (might be due to invalid IL or missing references) //IL_02b0: Unknown result type (might be due to invalid IL or missing references) //IL_02da: Unknown result type (might be due to invalid IL or missing references) //IL_0301: Unknown result type (might be due to invalid IL or missing references) if (!random) { return true; } ScoutScreamState state = __instance.m_state; ScoutScreamState val = state; switch ((int)val) { case 0: ((ES_Base)__instance).m_enemyAgent.Appearance.InterpolateGlow(ES_ScoutScream.s_screamChargeupColor, ES_ScoutScream.s_glowLocation, 4f); ((ES_Base)__instance).m_locomotion.m_animator.applyRootMotion = true; ((ES_Base)__instance).m_locomotion.m_animator.CrossFadeInFixedTime(((Il2CppArrayBase<int>)(object)EnemyLocomotion.s_hashAbilityUse)[__instance.m_animIndex], 0.15f); ((ES_Base)__instance).m_enemyAgent.Voice.PlayVoiceEvent(EVENTS.SCOUT_DETECT_SCREAM_CHARGE); __instance.m_stateDoneTimer = Clock.Time + 4f; __instance.m_state = (ScoutScreamState)1; break; case 1: if ((double)__instance.m_stateDoneTimer >= (double)Clock.Time) { break; } ((ES_Base)__instance).m_enemyAgent.Voice.PlayVoiceEvent(EVENTS.SCOUT_DETECT_SCREAM); ((ES_Base)__instance).m_enemyAgent.Appearance.InterpolateGlow(ES_ScoutScream.s_screamPopColor, ES_ScoutScream.s_glowLocation, 0.05f); if (SNet.IsMaster && (Object)(object)((ES_Base)__instance).m_ai.m_group != (Object)null) { Agent val2 = null; PlayerAgent val3 = default(PlayerAgent); if (((AgentAI)((ES_Base)__instance).m_ai).Target != null && (Object)(object)((AgentAI)((ES_Base)__instance).m_ai).Target.m_agent != (Object)null && ((AgentAI)((ES_Base)__instance).m_ai).Target.m_agent.Alive) { val2 = ((AgentAI)((ES_Base)__instance).m_ai).Target.m_agent; } else if (((Agent)((ES_Base)__instance).m_enemyAgent).CourseNode != null && PlayerManager.TryGetClosestAlivePlayerAgent(((Agent)((ES_Base)__instance).m_enemyAgent).CourseNode, ref val3)) { val2 = (Agent)(object)val3; } if ((Object)(object)val2 != (Object)null) { ((ES_Base)__instance).m_enemyAgent.PropagateTargetFull(val2); if (((AgentAI)((ES_Base)__instance).m_ai).Target != null) { ((AgentAI)((ES_Base)__instance).m_ai).Target.m_propagation = (AgentTargetPropagationType)0; } } } GameEventManager.PostEvent((eGameEvent)44, (PlayerAgent)null, 0f, "", (Dictionary<string, string>)null); ((ES_Base)__instance).m_locomotion.m_animator.CrossFadeInFixedTime(((Il2CppArrayBase<int>)(object)EnemyLocomotion.s_hashAbilityUseOut)[__instance.m_animIndex], 0.15f); __instance.m_fogSphereAdd = new FogSphereAllocator(); __instance.m_fogSphereSub = new FogSphereAllocator(); __instance.m_fogPos = ((Agent)((ES_Base)__instance).m_enemyAgent).EyePosition; if (__instance.m_fogSphereAdd.TryAllocate()) { __instance.m_fogSphereAdd.SetPositionRange(__instance.m_fogPos, 2f); __instance.m_fogSphereAdd.SetDensity(1f); __instance.m_fogSphereAdd.SetRadiance(ES_ScoutScream.s_screamPopColor, 1f); } if (__instance.m_fogSphereSub.TryAllocate()) { __instance.m_fogSphereSub.SetPositionRange(__instance.m_fogPos, 1f); __instance.m_fogSphereSub.SetDensity(-10f); __instance.m_fogSphereSub.SetRadiance(Color.black, 0f); } __instance.m_stateDoneTimer = Clock.Time + 1.5f; __instance.m_state = (ScoutScreamState)2; break; case 2: try { if (__instance.m_stateDoneTimer < Clock.Time) { ((ES_Base)__instance).m_enemyAgent.Appearance.InterpolateGlow(ES_ScoutScream.s_screamCalmdownColor, 0.5f); if (__instance.m_fogSphereAdd.IsAllocated) { __instance.m_fogSphereAdd.Deallocate(); } if (__instance.m_fogSphereSub.IsAllocated) { __instance.m_fogSphereSub.Deallocate(); } __instance.m_stateDoneTimer = Clock.Time + 3f; __instance.m_state = (ScoutScreamState)3; } else if (__instance.m_fogSphereAdd.IsAllocated) { float num = (float)(1.0 - ((double)__instance.m_stateDoneTimer - (double)Clock.Time) / 1.5); __instance.m_fogSphereAdd.SetPositionRange(__instance.m_fogPos, Mathf.Lerp(2f, 130f, num)); float num2 = Mathf.Pow(num, 32f); __instance.m_fogSphereAdd.SetDensity(Mathf.Lerp(1f, 0f, num2)); if (__instance.m_fogSphereSub.IsAllocated) { __instance.m_fogSphereSub.SetPositionRange(__instance.m_fogPos, Mathf.Lerp(0f, 90f, num)); __instance.m_fogSphereSub.SetDensity(Mathf.Lerp(-10f, 0f, num2)); } } } catch { __instance.m_state = (ScoutScreamState)3; } break; case 3: if ((double)__instance.m_stateDoneTimer >= (double)Clock.Time) { break; } if (SNet.IsMaster) { if (((Agent)((ES_Base)__instance).m_enemyAgent).CourseNode != null && RundownManager.ActiveExpedition.Expedition.ScoutWaveSettings != 0 && RundownManager.ActiveExpedition.Expedition.ScoutWavePopulation != 0) { ScoutWaveSpawn(((Agent)((ES_Base)__instance).m_enemyAgent).CourseNode); } ((ES_Base)__instance).m_enemyAgent.AI.m_behaviour.ChangeState((EB_States)5); } ((MachineState<ES_Base>)(object)__instance).m_machine.ChangeState(2); __instance.m_state = (ScoutScreamState)4; break; } return false; } } [HarmonyPatch] internal class EnemySpawnPatch { public static bool random; [HarmonyPrefix] [HarmonyPatch(typeof(EnemyAllocator), "SpawnEnemy")] public static void SpawnPatch(ref AgentMode mode, ref Quaternion rotation) { //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) if (SNet.IsMaster && random) { if (Rando.Next(50) == 0 && (int)mode != 1) { mode = (AgentMode)3; } if (Rando.Next(500) == 0 && (int)mode == 4) { mode = (AgentMode)1; } rotation = Quaternion.identity * Quaternion.Euler(0f, (float)Rando.Next(0, 360), 0f); } } [HarmonyPrefix] [HarmonyPatch(typeof(EnemyAgent), "Setup")] public static void SpawnSync(ref pEnemySpawnData spawnData, EnemyAgent __instance) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: 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_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) if (random) { Quaternion val = Quaternion.Inverse(Quaternion.identity) * spawnData.rotation; float num = default(float); Vector3 val2 = default(Vector3); ((Quaternion)(ref val)).ToAngleAxis(ref num, ref val2); float num2 = Mathf.Clamp((8f + num / 72f) / 10f, 0.8f, 1.3f); Transform transform = ((Component)__instance).transform; transform.localScale *= num2; spawnData.HealthRel *= num2; } } [HarmonyPostfix] [HarmonyPatch(typeof(EnemyAgent), "Setup")] public static void LimbScale(ref pEnemySpawnData spawnData, EnemyAgent __instance) { if (!random) { return; } foreach (Dam_EnemyDamageLimb item in (Il2CppArrayBase<Dam_EnemyDamageLimb>)(object)__instance.Damage.DamageLimbs) { item.m_healthMax *= spawnData.HealthRel; item.m_health = item.m_healthMax; } } } [HarmonyPatch] internal class LevelCleanUpPatch { [HarmonyPrefix] [HarmonyPatch(typeof(EnemyAgent), "OnDead")] public static void DeadPatch(EnemyAgent __instance) { try { ProximityManager.RemoveObject((Object)(object)__instance); foreach (iEnemyAgentCustomSetupComponent item in (Il2CppArrayBase<iEnemyAgentCustomSetupComponent>)(object)__instance.m_customSetupComps) { item.OnDead(); } __instance.Locomotion.OnDead(); } catch { } } } [Harmony] [HarmonyPatch] internal class MarkerPatch { [HarmonyPrefix] [HarmonyPatch(typeof(LG_FunctionMarkerBuilder), "BuildMarkerSpawnerRec")] public static bool MarkerBuilderPatch(LG_FunctionMarkerBuilder __instance, ref LG_MarkerSpawner markerSpawner, ref ExpeditionFunction function) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0073: 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) ExpeditionFunction val = function; bool flag = false; if (markerSpawner != null) { if ((Object)(object)markerSpawner.m_zone == (Object)null && !markerSpawner.AllowFunction()) { LG_MarkerProducer producerSource = markerSpawner.m_producerSource; ((Object)producerSource).name = ((Object)producerSource).name + "_FuncNotAllowed"; val = (ExpeditionFunction)0; } XXHashSequence val2 = default(XXHashSequence); ((XXHashSequence)(ref val2))..ctor(XXHash.Hash(markerSpawner.m_markerInstanceSeed, 973686256u, true), true); GameObject val3 = LG_MarkerFactory.InstantiateMarkerGameObject(markerSpawner, val, ((XXHashSequence)(ref val2)).NextFloat(), ((XXHashSequence)(ref val2)).NextFloat(), ((XXHashSequence)(ref val2)).NextRange(-1f, 1f), ref flag, false); if ((Object)(object)val3 == (Object)null) { if (((object)(ExpeditionFunction)(ref val)).ToString() == "PowerGenerator") { EntryPoint.LogIt("OPPSSS... This was really important.... REROLLL"); BuildPatch.currentZone.CleanupFailedZoneBuilds(); LG_Zone zone = BuildPatch.currentZone.m_zone; uint subSeed = zone.m_subSeed; zone.m_subSeed = subSeed + 1; LG_ZoneJob_CreateExpandFromData currentZone = BuildPatch.currentZone; subSeed = currentZone.m_subSeed; currentZone.m_subSeed = subSeed + 1; } if (((object)(ExpeditionFunction)(ref val)).ToString() == "ResourceContainerWeak") { EntryPoint.LogIt("Bad Surprise Box"); return false; } } } return true; } } public class MovingScanAI : MonoBehaviour { public AIG_CourseNode courseNode; public C_Node node; public CP_Bioscan_Core core; public List<Vector3> positions; public NavMeshAgent agent; private CP_Holopath_Spline spline; private pScanPos dataPos; public Vector3 m_position; private int indexPoint; public void Awake() { //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) ((Behaviour)this).enabled = false; positions = new List<Vector3>(); ((Component)this).gameObject.AddComponent<NavMeshAgent>(); agent = ((Component)this).gameObject.GetComponent<NavMeshAgent>(); agent.updateRotation = false; agent.speed = 1f; indexPoint = 0; dataPos = default(pScanPos); dataPos.m_position = ((Component)this).transform.position; ScansReplicator.scans.Add(this); dataPos.m_index = ScansReplicator.scans.IndexOf(this); } public void Setup(AIG_CourseNode courseNode, CP_Bioscan_Core core) { this.courseNode = courseNode; this.core = core; spline = ((Il2CppObjectBase)core.m_spline).TryCast<CP_Holopath_Spline>(); } public void OnEnable() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < 5; i++) { positions.Add(courseNode.GetRandomPositionInside()); } } public void LateUpdate() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Invalid comparison between Unknown and I4 if ((int)core.State.status != 1) { ((Component)spline).gameObject.active = false; } } public void FixedUpdate() { //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: 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) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Invalid comparison between Unknown and I4 //IL_007c: Unknown result type (might be due to invalid IL or missing references) if (!SNet.IsMaster) { return; } if (!agent.pathPending && agent.remainingDistance < 1f && (int)core.State.status != 1) { try { indexPoint = (indexPoint + 1) % positions.Count; agent.SetDestination(positions[indexPoint]); } catch { indexPoint = 0; agent.SetDestination(positions[indexPoint]); } } dataPos.m_position = ((Component)this).transform.position; NetworkAPI.InvokeEvent<pScanPos>("UpdateScanPosition", dataPos, (SNet_ChannelType)4); } public void UpdateScanPos() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) ((Behaviour)agent).enabled = false; ((Component)this).transform.position = dataPos.m_position; string text = dataPos.m_index.ToString(); Vector3 position = m_position; EntryPoint.LogIt("Moving scan " + text + " to " + ((object)(Vector3)(ref position)).ToString()); } } [Harmony] [HarmonyPatch] internal static class ResourcePack { private delegate float ResourceDelegate(IntPtr __instance, AmmoType ammoType, int bulletCount); p