Decompiled source of HighQuotaRebalance Beta v0.7.1
OreoM.HQRebalance.dll
Decompiled 3 days 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.Linq; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using BepInEx; using BepInEx.Logging; using GameNetcodeStuff; using HQRebalance.Networking; using HQRebalance.Patches; using HQRebalance.Utility; using HarmonyLib; using Microsoft.CodeAnalysis; using OreoM.HQRebalance.NetcodePatcher; using Unity.Netcode; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: IgnoresAccessChecksTo("AmazingAssets.TerrainToMesh")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: IgnoresAccessChecksTo("ClientNetworkTransform")] [assembly: IgnoresAccessChecksTo("com.olegknyazev.softmask")] [assembly: IgnoresAccessChecksTo("DissonanceVoip")] [assembly: IgnoresAccessChecksTo("EasyTextEffects")] [assembly: IgnoresAccessChecksTo("Facepunch Transport for Netcode for GameObjects")] [assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")] [assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")] [assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging")] [assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging.DocCodeExamples")] [assembly: IgnoresAccessChecksTo("Unity.Burst")] [assembly: IgnoresAccessChecksTo("Unity.Burst.Unsafe")] [assembly: IgnoresAccessChecksTo("Unity.Collections")] [assembly: IgnoresAccessChecksTo("Unity.Collections.LowLevel.ILSupport")] [assembly: IgnoresAccessChecksTo("Unity.InputSystem")] [assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")] [assembly: IgnoresAccessChecksTo("Unity.Jobs")] [assembly: IgnoresAccessChecksTo("Unity.Mathematics")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.Common")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.MetricTypes")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStats")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Component")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Configuration")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Implementation")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsReporting")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkProfiler.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkSolutionInterface")] [assembly: IgnoresAccessChecksTo("Unity.Netcode.Components")] [assembly: IgnoresAccessChecksTo("Unity.Netcode.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.Networking.Transport")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Csg")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.KdTree")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Poly2Tri")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Stl")] [assembly: IgnoresAccessChecksTo("Unity.Profiling.Core")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Config.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")] [assembly: IgnoresAccessChecksTo("Unity.Services.Authentication")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Analytics")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Configuration")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Device")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments.Internal")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Internal")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Networking")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Registration")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Scheduler")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Telemetry")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Threading")] [assembly: IgnoresAccessChecksTo("Unity.Services.QoS")] [assembly: IgnoresAccessChecksTo("Unity.Services.Relay")] [assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")] [assembly: IgnoresAccessChecksTo("Unity.Timeline")] [assembly: IgnoresAccessChecksTo("Unity.VisualEffectGraph.Runtime")] [assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.UI")] [assembly: AssemblyCompany("OreoM.HQRebalance")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("0.7.1.0")] [assembly: AssemblyInformationalVersion("0.7.1")] [assembly: AssemblyProduct("HQRebalance")] [assembly: AssemblyTitle("OreoM.HQRebalance")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.7.1.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] [module: NetcodePatchedAssembly] internal class <Module> { static <Module>() { NetworkVariableSerializationTypes.InitializeSerializer_UnmanagedByMemcpy<bool>(); NetworkVariableSerializationTypes.InitializeEqualityChecker_UnmanagedIEquatable<bool>(); } } 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.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace HQRebalance { [BepInPlugin("OreoM.HQRebalance", "HQRebalance", "0.7.1")] public class HQRebalance : BaseUnityPlugin { private SelectableLevel[] patchedMoons; public static HQRebalance Instance { get; private set; } internal static ManualLogSource Logger { get; private set; } internal static Harmony? Harmony { get; set; } private void Awake() { Logger = ((BaseUnityPlugin)this).Logger; Instance = this; Patch(); NetcodePatch(); Logger.LogInfo((object)"OreoM.HQRebalance v0.7.1 has loaded!"); } private static void NetcodePatch() { Type[] types = Assembly.GetExecutingAssembly().GetTypes(); Type[] array = types; foreach (Type type in array) { MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic); MethodInfo[] array2 = methods; foreach (MethodInfo methodInfo in array2) { object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false); if (customAttributes.Length != 0) { methodInfo.Invoke(null, null); } } } } internal static void Patch() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown if (Harmony == null) { Harmony = new Harmony("OreoM.HQRebalance"); } Logger.LogDebug((object)"Patching..."); Harmony.PatchAll(); Logger.LogDebug((object)"Finished patching!"); } internal static void Unpatch() { Logger.LogDebug((object)"Unpatching..."); Harmony? harmony = Harmony; if (harmony != null) { harmony.UnpatchSelf(); } Logger.LogDebug((object)"Finished unpatching!"); } internal void SetupMoons(StartOfRound instance) { //IL_043a: Unknown result type (might be due to invalid IL or missing references) //IL_043f: Unknown result type (might be due to invalid IL or missing references) //IL_0464: Unknown result type (might be due to invalid IL or missing references) //IL_0469: Unknown result type (might be due to invalid IL or missing references) //IL_048e: Unknown result type (might be due to invalid IL or missing references) //IL_0493: Unknown result type (might be due to invalid IL or missing references) //IL_04a6: Unknown result type (might be due to invalid IL or missing references) //IL_04b0: Expected O, but got Unknown //IL_0502: Unknown result type (might be due to invalid IL or missing references) //IL_0507: Unknown result type (might be due to invalid IL or missing references) //IL_052c: Unknown result type (might be due to invalid IL or missing references) //IL_0531: Unknown result type (might be due to invalid IL or missing references) //IL_0556: Unknown result type (might be due to invalid IL or missing references) //IL_055b: Unknown result type (might be due to invalid IL or missing references) //IL_056e: Unknown result type (might be due to invalid IL or missing references) //IL_0578: Expected O, but got Unknown //IL_059e: Unknown result type (might be due to invalid IL or missing references) //IL_05a3: Unknown result type (might be due to invalid IL or missing references) //IL_05c8: Unknown result type (might be due to invalid IL or missing references) //IL_05cd: Unknown result type (might be due to invalid IL or missing references) //IL_05f2: Unknown result type (might be due to invalid IL or missing references) //IL_05f7: Unknown result type (might be due to invalid IL or missing references) //IL_061c: Unknown result type (might be due to invalid IL or missing references) //IL_0621: Unknown result type (might be due to invalid IL or missing references) //IL_0635: Unknown result type (might be due to invalid IL or missing references) //IL_063f: Expected O, but got Unknown //IL_0665: Unknown result type (might be due to invalid IL or missing references) //IL_066a: Unknown result type (might be due to invalid IL or missing references) //IL_068f: Unknown result type (might be due to invalid IL or missing references) //IL_0694: Unknown result type (might be due to invalid IL or missing references) //IL_06b9: Unknown result type (might be due to invalid IL or missing references) //IL_06be: Unknown result type (might be due to invalid IL or missing references) //IL_06e3: Unknown result type (might be due to invalid IL or missing references) //IL_06e8: Unknown result type (might be due to invalid IL or missing references) //IL_070d: Unknown result type (might be due to invalid IL or missing references) //IL_0712: Unknown result type (might be due to invalid IL or missing references) //IL_0726: Unknown result type (might be due to invalid IL or missing references) //IL_0730: Expected O, but got Unknown //IL_0dad: Unknown result type (might be due to invalid IL or missing references) //IL_0db2: Unknown result type (might be due to invalid IL or missing references) //IL_0dc4: Unknown result type (might be due to invalid IL or missing references) //IL_0dce: Expected O, but got Unknown if (Instance.patchedMoons != null) { instance.levels = Instance.patchedMoons; return; } Instance.patchedMoons = instance.levels; Instance.patchedMoons[6].minScrap = 21; Instance.patchedMoons[7].minScrap = 24; Instance.patchedMoons[7].maxScrap = 29; Instance.patchedMoons[8].minScrap = 18; Instance.patchedMoons[8].maxScrap = 22; Instance.patchedMoons[9].minScrap = 31; Instance.patchedMoons[9].maxScrap = 34; Instance.patchedMoons[10].minScrap = 32; Instance.patchedMoons[10].maxScrap = 37; Instance.patchedMoons[2].factorySizeMultiplier = 1f; Instance.patchedMoons[10].factorySizeMultiplier = 2f; Instance.patchedMoons[0].dungeonFlowTypes[0].rarity = 98; Instance.patchedMoons[0].dungeonFlowTypes[1].rarity = 1; Instance.patchedMoons[0].dungeonFlowTypes[2].rarity = 1; Instance.patchedMoons[1].dungeonFlowTypes[0].rarity = 49; Instance.patchedMoons[1].dungeonFlowTypes[1].rarity = 2; Instance.patchedMoons[1].dungeonFlowTypes[2].rarity = 49; Instance.patchedMoons[2].dungeonFlowTypes[0].rarity = 7; Instance.patchedMoons[2].dungeonFlowTypes[1].rarity = 1; Instance.patchedMoons[2].dungeonFlowTypes[2].rarity = 92; Instance.patchedMoons[5].dungeonFlowTypes[0].rarity = 13; Instance.patchedMoons[5].dungeonFlowTypes[1].rarity = 74; Instance.patchedMoons[5].dungeonFlowTypes[2].rarity = 13; Instance.patchedMoons[6].dungeonFlowTypes[1].rarity = 88; Instance.patchedMoons[6].dungeonFlowTypes[0].rarity = 2; Instance.patchedMoons[6].dungeonFlowTypes[2].rarity = 10; Instance.patchedMoons[7].dungeonFlowTypes[1].rarity = 10; Instance.patchedMoons[7].dungeonFlowTypes[0].rarity = 88; Instance.patchedMoons[7].dungeonFlowTypes[2].rarity = 2; Instance.patchedMoons[8].dungeonFlowTypes[0].rarity = 46; Instance.patchedMoons[8].dungeonFlowTypes[1].rarity = 8; Instance.patchedMoons[8].dungeonFlowTypes[2].rarity = 46; Instance.patchedMoons[9].dungeonFlowTypes[0].rarity = 2; Instance.patchedMoons[9].dungeonFlowTypes[1].rarity = 10; Instance.patchedMoons[9].dungeonFlowTypes[2].rarity = 88; Instance.patchedMoons[10].dungeonFlowTypes[0].rarity = 100; Instance.patchedMoons[10].dungeonFlowTypes[1].rarity = 100; Instance.patchedMoons[10].dungeonFlowTypes[2].rarity = 100; Instance.patchedMoons[12].dungeonFlowTypes[0].rarity = 76; Instance.patchedMoons[12].dungeonFlowTypes[1].rarity = 1; Instance.patchedMoons[12].dungeonFlowTypes[2].rarity = 23; Keyframe[] array = (Keyframe[])(object)new Keyframe[3] { new Keyframe(0f, 7.097602f, -12.1866f, -12.1866f, 0.3333f, 0.119f), new Keyframe(0.4764f, -1.126f, -27.2869f, -27.2869f, 0.1039f, 0.125f), new Keyframe(1f, -15f, 0f, 0f, 0f, 0f) }; Instance.patchedMoons[8].daytimeEnemySpawnChanceThroughDay = new AnimationCurve(array); Instance.patchedMoons[8].daytimeEnemiesProbabilityRange = 1f; Instance.patchedMoons[8].spawnProbabilityRange = 8f; Keyframe[] array2 = (Keyframe[])(object)new Keyframe[3] { new Keyframe(0f, -3f, 19.70508f, 19.70508f, 0f, 0.2589182f), new Keyframe(0.3162474f, 2.817775f, 15.63821f, 15.63821f, 0.5307108f, 0.6788604f), new Keyframe(1f, 15f, 35.60403f, 35.60403f, 0.1551032f, 0f) }; Instance.patchedMoons[6].enemySpawnChanceThroughoutDay = new AnimationCurve(array2); Keyframe[] array3 = (Keyframe[])(object)new Keyframe[4] { new Keyframe(0f, -3f, 59.19933f, 59.19933f, 0f, 0.1882948f), new Keyframe(0.2971778f, 2.103194f, 11.64772f, 11.64772f, 0.6591896f, 0.404842f), new Keyframe(0.7631003f, 11.27556f, 25.28926f, 25.28926f, 0.4166799f, 0.5360636f), new Keyframe(1f, 15f, 35.60403f, 35.60403f, 0.04912584f, 0f) }; Instance.patchedMoons[9].enemySpawnChanceThroughoutDay = new AnimationCurve(array3); Keyframe[] array4 = (Keyframe[])(object)new Keyframe[5] { new Keyframe(0f, -3f, 15.1757f, 15.1757f, 0f, 0.3430422f), new Keyframe(0.1625553f, 1.142029f, 9.178675f, 9.178675f, 0.6591896f, 0.6591896f), new Keyframe(0.4976344f, 5.041142f, 6.361235f, 6.361235f, 0.3227605f, 0.3704014f), new Keyframe(0.6644974f, 6.988362f, 2.044127f, 2.044127f, 0.4955147f, 0.4224021f), new Keyframe(1f, 15f, 14.53138f, 14.53138f, 0.3106435f, 0f) }; Instance.patchedMoons[10].enemySpawnChanceThroughoutDay = new AnimationCurve(array4); AnimationCurve numberToSpawn = Instance.patchedMoons[5].spawnableMapObjects[0].numberToSpawn; AnimationCurve numberToSpawn2 = Instance.patchedMoons[10].spawnableMapObjects[0].numberToSpawn; AnimationCurve numberToSpawn3 = Instance.patchedMoons[10].spawnableMapObjects[1].numberToSpawn; AnimationCurve numberToSpawn4 = Instance.patchedMoons[10].spawnableMapObjects[2].numberToSpawn; Instance.patchedMoons[6].spawnableMapObjects[0].numberToSpawn = numberToSpawn; Instance.patchedMoons[6].spawnableMapObjects[1].numberToSpawn = numberToSpawn4; Instance.patchedMoons[7].spawnableMapObjects[0].numberToSpawn = numberToSpawn3; Instance.patchedMoons[7].spawnableMapObjects[1].numberToSpawn = numberToSpawn; Instance.patchedMoons[7].spawnableMapObjects[2].numberToSpawn = numberToSpawn; Instance.patchedMoons[9].spawnableMapObjects[0].numberToSpawn = numberToSpawn2; Instance.patchedMoons[9].spawnableMapObjects[1].numberToSpawn = numberToSpawn; Instance.patchedMoons[9].spawnableMapObjects[2].numberToSpawn = numberToSpawn; LootPool lootPool = new LootPool(13, 0, 80, 29, 0, 2, 6, 0, 0, 13, 0, 0, 5, 32, 9, 10, 0, 42, 0, 17, 1, 0, 0, 22, 25, 80, 11, 0, 0, 66, 0, 0, 0, 0, 4, 8, 12, 0, 0, 8, 0, 0, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 90, 0, 6, 1); LootPool lootPool2 = new LootPool(19, 18, 59, 100, 26, 0, 6, 0, 0, 19, 15, 12, 49, 0, 36, 34, 0, 10, 39, 18, 0, 0, 7, 14, 23, 35, 8, 0, 21, 23, 12, 7, 0, 0, 7, 19, 10, 12, 13, 0, 0, 23, 19, 34, 32, 0, 19, 0, 31, 6, 0, 3, 40, 11, 17, 1); LootPool lootPool3 = new LootPool(35, 33, 31, 54, 46, 0, 8, 51, 0, 35, 0, 12, 29, 0, 28, 39, 0, 30, 27, 20, 0, 0, 0, 8, 27, 25, 8, 0, 29, 16, 24, 11, 0, 0, 5, 22, 30, 19, 12, 0, 24, 22, 17, 40, 40, 0, 34, 0, 13, 7, 0, 0, 25, 6, 16, 1); LootPool lootPool4 = new LootPool(43, 0, 72, 48, 0, 2, 4, 0, 0, 43, 0, 11, 24, 0, 65, 0, 0, 42, 20, 24, 5, 0, 0, 0, 0, 49, 6, 0, 19, 42, 0, 6, 0, 0, 21, 27, 28, 4, 13, 0, 0, 19, 0, 29, 24, 0, 32, 0, 18, 9, 0, 0, 60, 0, 8, 1); LootPool lootPool5 = new LootPool(18, 0, 89, 63, 0, 0, 0, 0, 6, 18, 61, 40, 16, 0, 19, 0, 0, 40, 31, 19, 0, 0, 3, 17, 0, 67, 10, 0, 20, 65, 0, 8, 0, 0, 23, 19, 28, 0, 15, 0, 0, 0, 0, 27, 24, 11, 18, 0, 19, 9, 6, 61, 80, 0, 28, 1); LootPool lootPool6 = new LootPool(24, 57, 31, 68, 36, 0, 9, 52, 0, 24, 0, 31, 40, 0, 50, 29, 0, 30, 13, 23, 0, 0, 0, 21, 28, 27, 17, 0, 25, 16, 13, 9, 0, 0, 19, 24, 32, 17, 24, 0, 25, 0, 6, 40, 32, 0, 40, 0, 17, 9, 0, 0, 29, 14, 16, 1); LootPool lootPool7 = new LootPool(19, 44, 0, 6, 0, 3, 38, 0, 12, 19, 63, 5, 0, 0, 21, 0, 85, 0, 7, 82, 0, 14, 93, 0, 4, 0, 13, 23, 35, 0, 18, 17, 85, 89, 0, 0, 9, 17, 0, 19, 16, 28, 0, 0, 11, 91, 61, 0, 52, 73, 94, 63, 0, 0, 0, 1); LootPool lootPool8 = new LootPool(40, 47, 0, 18, 0, 3, 41, 0, 0, 40, 27, 0, 0, 0, 44, 0, 80, 0, 8, 41, 0, 62, 73, 0, 12, 12, 55, 24, 14, 0, 48, 37, 80, 67, 0, 0, 5, 50, 0, 67, 25, 0, 0, 0, 11, 56, 7, 21, 33, 94, 0, 27, 19, 0, 0, 1); LootPool lootPool9 = new LootPool(39, 37, 47, 33, 0, 0, 0, 0, 0, 39, 43, 0, 0, 0, 0, 0, 31, 0, 0, 23, 0, 33, 45, 0, 8, 38, 10, 16, 35, 0, 21, 22, 51, 14, 0, 0, 16, 38, 0, 36, 24, 0, 0, 0, 30, 21, 8, 36, 20, 35, 0, 46, 28, 0, 0, 1); LootPool lootPool10 = new LootPool(39, 76, 0, 17, 0, 0, 32, 0, 69, 39, 57, 0, 0, 0, 19, 0, 63, 0, 14, 24, 32, 55, 75, 0, 33, 16, 53, 30, 42, 0, 35, 25, 72, 33, 0, 0, 16, 20, 0, 65, 60, 39, 0, 0, 30, 53, 42, 42, 22, 71, 35, 57, 30, 0, 0, 12); LootPool lootPool11 = new LootPool(23, 0, 66, 52, 0, 0, 0, 0, 0, 18, 0, 14, 52, 0, 52, 0, 0, 0, 0, 17, 0, 0, 0, 9, 0, 81, 6, 0, 14, 100, 0, 8, 0, 0, 0, 0, 28, 0, 28, 0, 0, 26, 0, 28, 23, 12, 45, 0, 25, 43, 0, 0, 80, 0, 14, 1); Instance.patchedMoons[0].spawnableScrap = lootPool.GetLootpool(); Instance.patchedMoons[1].spawnableScrap = lootPool2.GetLootpool(); Instance.patchedMoons[2].spawnableScrap = lootPool3.GetLootpool(); Instance.patchedMoons[4].spawnableScrap = lootPool4.GetLootpool(); Instance.patchedMoons[8].spawnableScrap = lootPool5.GetLootpool(); Instance.patchedMoons[5].spawnableScrap = lootPool6.GetLootpool(); Instance.patchedMoons[6].spawnableScrap = lootPool7.GetLootpool(); Instance.patchedMoons[7].spawnableScrap = lootPool8.GetLootpool(); Instance.patchedMoons[9].spawnableScrap = lootPool9.GetLootpool(); Instance.patchedMoons[10].spawnableScrap = lootPool10.GetLootpool(); Instance.patchedMoons[12].spawnableScrap = lootPool11.GetLootpool(); Instance.patchedMoons[4].DaytimeEnemies[0].rarity = 20; Instance.patchedMoons[4].DaytimeEnemies[2].rarity = 100; SpawnableEnemyWithRarity item = new SpawnableEnemyWithRarity { enemyType = ((EnemyAI)Resources.FindObjectsOfTypeAll<GiantKiwiAI>()[0]).enemyType, rarity = 100 }; Instance.patchedMoons[8].DaytimeEnemies.Add(item); EnemyPool enemyPool = new EnemyPool(5, 20, 0, 15, 5, 0, 15, 40, 0, 30, 20, 100, 0, 30, 50); EnemyPool enemyPool2 = new EnemyPool(8, 30, 8, 4, 20, 3, 3, 5, 7, 10, 0, 8, 0, 4, 5); EnemyPool enemyPool3 = new EnemyPool(0, 0, 0, 60, 0, 60, 20, 60, 80, 60, 30, 60, 0, 60, 60); EnemyPool enemyPool4 = new EnemyPool(35, 91, 42, 77, 45, 92, 35, 100, 95, 92, 89, 100, 0, 100, 86); Instance.patchedMoons[6].Enemies = enemyPool.GetEnemyPool(); Instance.patchedMoons[7].Enemies = enemyPool2.GetEnemyPool(); Instance.patchedMoons[9].Enemies = enemyPool3.GetEnemyPool(); Instance.patchedMoons[10].Enemies = enemyPool4.GetEnemyPool(); EnemyPool enemyPool5 = new EnemyPool(0, 0, 0, 50, 35, 35, 0, 0, 0, 0); EnemyPool enemyPool6 = new EnemyPool(0, 0, 32, 80, 25, 0, 0, 0, 0, 0); Instance.patchedMoons[7].OutsideEnemies = enemyPool5.GetEnemyPool(); Instance.patchedMoons[9].OutsideEnemies = enemyPool6.GetEnemyPool(); instance.levels = Instance.patchedMoons; } } public static class MyPluginInfo { public const string PLUGIN_GUID = "OreoM.HQRebalance"; public const string PLUGIN_NAME = "HQRebalance"; public const string PLUGIN_VERSION = "0.7.1"; } } namespace HQRebalance.Utility { internal class EnemyPool { public static Dictionary<string, EnemyType> enemyList = Resources.FindObjectsOfTypeAll<EnemyType>().ToDictionary((EnemyType enemy) => ((Object)enemy).name); private readonly List<SpawnableEnemyWithRarity> enemyPool; public EnemyPool(int blob, int butler, int maneater, int centipede, int barber, int thumper, int girl, int bracken, int lootbug, int jester, int masked, int nutcracker, int puffer, int spider, int coilhead) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Expected O, but got Unknown //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Expected O, but got Unknown //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Expected O, but got Unknown //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Expected O, but got Unknown //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Expected O, but got Unknown //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00da: 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 //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: 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: Expected O, but got Unknown //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Expected O, but got Unknown //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Expected O, but got Unknown //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Expected O, but got Unknown //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Expected O, but got Unknown //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: Expected O, but got Unknown //IL_01d1: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: Expected O, but got Unknown //IL_01f5: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_020b: Unknown result type (might be due to invalid IL or missing references) //IL_0218: Expected O, but got Unknown //IL_0219: Unknown result type (might be due to invalid IL or missing references) //IL_021e: Unknown result type (might be due to invalid IL or missing references) //IL_022f: Unknown result type (might be due to invalid IL or missing references) //IL_023c: Expected O, but got Unknown if (enemyList == null) { HQRebalance.Logger.LogError((object)"All enemies list is null"); return; } enemyPool = new List<SpawnableEnemyWithRarity> { new SpawnableEnemyWithRarity { enemyType = EnemyByName("Blob"), rarity = blob }, new SpawnableEnemyWithRarity { enemyType = EnemyByName("Butler"), rarity = butler }, new SpawnableEnemyWithRarity { enemyType = EnemyByName("CaveDweller"), rarity = maneater }, new SpawnableEnemyWithRarity { enemyType = EnemyByName("Centipede"), rarity = centipede }, new SpawnableEnemyWithRarity { enemyType = EnemyByName("ClaySurgeon"), rarity = barber }, new SpawnableEnemyWithRarity { enemyType = EnemyByName("Crawler"), rarity = thumper }, new SpawnableEnemyWithRarity { enemyType = EnemyByName("DressGirl"), rarity = girl }, new SpawnableEnemyWithRarity { enemyType = EnemyByName("Flowerman"), rarity = bracken }, new SpawnableEnemyWithRarity { enemyType = EnemyByName("HoarderBug"), rarity = lootbug }, new SpawnableEnemyWithRarity { enemyType = EnemyByName("Jester"), rarity = jester }, new SpawnableEnemyWithRarity { enemyType = EnemyByName("MaskedPlayerEnemy"), rarity = masked }, new SpawnableEnemyWithRarity { enemyType = EnemyByName("Nutcracker"), rarity = nutcracker }, new SpawnableEnemyWithRarity { enemyType = EnemyByName("Puffer"), rarity = puffer }, new SpawnableEnemyWithRarity { enemyType = EnemyByName("SandSpider"), rarity = spider }, new SpawnableEnemyWithRarity { enemyType = EnemyByName("SpringMan"), rarity = coilhead } }; enemyPool.RemoveAll((SpawnableEnemyWithRarity i) => i.rarity == 0); } public EnemyPool(int baboon, int fox, int giant, int dog, int radmech, int worm, int locust, int manticoil, int tulip, int bee) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Expected O, but got Unknown //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Expected O, but got Unknown //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Expected O, but got Unknown //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Expected O, but got Unknown //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Expected O, but got Unknown //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00da: 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 //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: 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: Expected O, but got Unknown //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Expected O, but got Unknown //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Expected O, but got Unknown //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Expected O, but got Unknown if (enemyList == null) { HQRebalance.Logger.LogError((object)"All enemies list is null"); return; } enemyPool = new List<SpawnableEnemyWithRarity> { new SpawnableEnemyWithRarity { enemyType = EnemyByName("BaboonHawk"), rarity = baboon }, new SpawnableEnemyWithRarity { enemyType = EnemyByName("BushWolf"), rarity = fox }, new SpawnableEnemyWithRarity { enemyType = EnemyByName("ForestGiant"), rarity = giant }, new SpawnableEnemyWithRarity { enemyType = EnemyByName("MouthDog"), rarity = dog }, new SpawnableEnemyWithRarity { enemyType = EnemyByName("RadMech"), rarity = radmech }, new SpawnableEnemyWithRarity { enemyType = EnemyByName("SandWorm"), rarity = worm }, new SpawnableEnemyWithRarity { enemyType = EnemyByName("DocileLocustBees"), rarity = locust }, new SpawnableEnemyWithRarity { enemyType = EnemyByName("Doublewing"), rarity = manticoil }, new SpawnableEnemyWithRarity { enemyType = EnemyByName("FlowerSnake"), rarity = tulip }, new SpawnableEnemyWithRarity { enemyType = EnemyByName("RedLocustBees"), rarity = bee } }; enemyPool.RemoveAll((SpawnableEnemyWithRarity i) => i.rarity == 0); } private EnemyType EnemyByName(string name) { if (enemyList.TryGetValue(name, out EnemyType value)) { return value; } throw new Exception("Could not retrieve enemy of name: " + name); } public List<SpawnableEnemyWithRarity> GetEnemyPool() { return enemyPool; } } internal class LootPool { public static Dictionary<string, Item> itemList = Resources.FindObjectsOfTypeAll<Item>().ToDictionary((Item item) => ((Object)item).name); private readonly List<SpawnableItemWithRarity> lootPoll; public LootPool(int airhorn, int bell, int big_bolt, int bottles, int brush, int candy, int cash_register, int chemical_jug, int clock, int clown_horn, int comedy, int control_pad, int cookie_mold, int dust_pan, int easter_egg, int egg_beater, int fancy_lamp, int flask, int garbage_lid, int gift_box, int gold_bar, int golden_cup, int hairdryer, int flashbang, int pickles, int large_axle, int laser_pointer, int magic_ball, int mag_glass, int metal_sheet, int mug, int old_phone, int painting, int perfume, int pill_bottle, int plastic_cup, int plastic_fish, int red_soda, int remote, int ring, int rubber_duck, int soccer_ball, int wheel, int stop_sign, int tea_kettle, int teeth, int toiler_paper, int toothpaste, int toy_cube, int toy_robot, int toy_train, int tragedy, int engine, int whoopie, int yield_sign, int zed_dog) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Expected O, but got Unknown //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Expected O, but got Unknown //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Expected O, but got Unknown //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Expected O, but got Unknown //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Expected O, but got Unknown //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00da: 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 //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: 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: Expected O, but got Unknown //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Expected O, but got Unknown //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Expected O, but got Unknown //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Expected O, but got Unknown //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Expected O, but got Unknown //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: Expected O, but got Unknown //IL_01d1: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: Expected O, but got Unknown //IL_01f5: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_020b: Unknown result type (might be due to invalid IL or missing references) //IL_0218: Expected O, but got Unknown //IL_0219: Unknown result type (might be due to invalid IL or missing references) //IL_021e: Unknown result type (might be due to invalid IL or missing references) //IL_022f: Unknown result type (might be due to invalid IL or missing references) //IL_023c: Expected O, but got Unknown //IL_023d: Unknown result type (might be due to invalid IL or missing references) //IL_0242: Unknown result type (might be due to invalid IL or missing references) //IL_0253: Unknown result type (might be due to invalid IL or missing references) //IL_0260: Expected O, but got Unknown //IL_0261: Unknown result type (might be due to invalid IL or missing references) //IL_0266: Unknown result type (might be due to invalid IL or missing references) //IL_0277: Unknown result type (might be due to invalid IL or missing references) //IL_0284: Expected O, but got Unknown //IL_0285: Unknown result type (might be due to invalid IL or missing references) //IL_028a: Unknown result type (might be due to invalid IL or missing references) //IL_029b: Unknown result type (might be due to invalid IL or missing references) //IL_02a8: Expected O, but got Unknown //IL_02a9: Unknown result type (might be due to invalid IL or missing references) //IL_02ae: Unknown result type (might be due to invalid IL or missing references) //IL_02bf: Unknown result type (might be due to invalid IL or missing references) //IL_02cc: Expected O, but got Unknown //IL_02cd: Unknown result type (might be due to invalid IL or missing references) //IL_02d2: Unknown result type (might be due to invalid IL or missing references) //IL_02e3: Unknown result type (might be due to invalid IL or missing references) //IL_02f0: Expected O, but got Unknown //IL_02f1: Unknown result type (might be due to invalid IL or missing references) //IL_02f6: Unknown result type (might be due to invalid IL or missing references) //IL_0307: Unknown result type (might be due to invalid IL or missing references) //IL_0314: Expected O, but got Unknown //IL_0315: Unknown result type (might be due to invalid IL or missing references) //IL_031a: Unknown result type (might be due to invalid IL or missing references) //IL_032b: Unknown result type (might be due to invalid IL or missing references) //IL_0338: Expected O, but got Unknown //IL_0339: Unknown result type (might be due to invalid IL or missing references) //IL_033e: Unknown result type (might be due to invalid IL or missing references) //IL_034f: Unknown result type (might be due to invalid IL or missing references) //IL_035c: Expected O, but got Unknown //IL_035d: Unknown result type (might be due to invalid IL or missing references) //IL_0362: Unknown result type (might be due to invalid IL or missing references) //IL_0373: Unknown result type (might be due to invalid IL or missing references) //IL_0380: Expected O, but got Unknown //IL_0381: Unknown result type (might be due to invalid IL or missing references) //IL_0386: Unknown result type (might be due to invalid IL or missing references) //IL_0397: Unknown result type (might be due to invalid IL or missing references) //IL_03a4: Expected O, but got Unknown //IL_03a5: Unknown result type (might be due to invalid IL or missing references) //IL_03aa: Unknown result type (might be due to invalid IL or missing references) //IL_03bb: Unknown result type (might be due to invalid IL or missing references) //IL_03c8: Expected O, but got Unknown //IL_03c9: Unknown result type (might be due to invalid IL or missing references) //IL_03ce: Unknown result type (might be due to invalid IL or missing references) //IL_03df: Unknown result type (might be due to invalid IL or missing references) //IL_03ec: Expected O, but got Unknown //IL_03ed: Unknown result type (might be due to invalid IL or missing references) //IL_03f2: Unknown result type (might be due to invalid IL or missing references) //IL_0403: Unknown result type (might be due to invalid IL or missing references) //IL_0410: Expected O, but got Unknown //IL_0411: Unknown result type (might be due to invalid IL or missing references) //IL_0416: Unknown result type (might be due to invalid IL or missing references) //IL_0427: Unknown result type (might be due to invalid IL or missing references) //IL_0434: Expected O, but got Unknown //IL_0435: Unknown result type (might be due to invalid IL or missing references) //IL_043a: Unknown result type (might be due to invalid IL or missing references) //IL_044b: Unknown result type (might be due to invalid IL or missing references) //IL_0458: Expected O, but got Unknown //IL_0459: Unknown result type (might be due to invalid IL or missing references) //IL_045e: Unknown result type (might be due to invalid IL or missing references) //IL_046f: Unknown result type (might be due to invalid IL or missing references) //IL_047c: Expected O, but got Unknown //IL_047d: Unknown result type (might be due to invalid IL or missing references) //IL_0482: Unknown result type (might be due to invalid IL or missing references) //IL_0493: Unknown result type (might be due to invalid IL or missing references) //IL_04a0: Expected O, but got Unknown //IL_04a1: Unknown result type (might be due to invalid IL or missing references) //IL_04a6: Unknown result type (might be due to invalid IL or missing references) //IL_04b7: Unknown result type (might be due to invalid IL or missing references) //IL_04c4: Expected O, but got Unknown //IL_04c5: Unknown result type (might be due to invalid IL or missing references) //IL_04ca: Unknown result type (might be due to invalid IL or missing references) //IL_04db: Unknown result type (might be due to invalid IL or missing references) //IL_04e8: Expected O, but got Unknown //IL_04e9: Unknown result type (might be due to invalid IL or missing references) //IL_04ee: Unknown result type (might be due to invalid IL or missing references) //IL_04ff: Unknown result type (might be due to invalid IL or missing references) //IL_050c: Expected O, but got Unknown //IL_050d: Unknown result type (might be due to invalid IL or missing references) //IL_0512: Unknown result type (might be due to invalid IL or missing references) //IL_0523: Unknown result type (might be due to invalid IL or missing references) //IL_0530: Expected O, but got Unknown //IL_0531: Unknown result type (might be due to invalid IL or missing references) //IL_0536: Unknown result type (might be due to invalid IL or missing references) //IL_0547: Unknown result type (might be due to invalid IL or missing references) //IL_0554: Expected O, but got Unknown //IL_0555: Unknown result type (might be due to invalid IL or missing references) //IL_055a: Unknown result type (might be due to invalid IL or missing references) //IL_056b: Unknown result type (might be due to invalid IL or missing references) //IL_0578: Expected O, but got Unknown //IL_0579: Unknown result type (might be due to invalid IL or missing references) //IL_057e: Unknown result type (might be due to invalid IL or missing references) //IL_058f: Unknown result type (might be due to invalid IL or missing references) //IL_059c: Expected O, but got Unknown //IL_059d: Unknown result type (might be due to invalid IL or missing references) //IL_05a2: Unknown result type (might be due to invalid IL or missing references) //IL_05b3: Unknown result type (might be due to invalid IL or missing references) //IL_05c0: Expected O, but got Unknown //IL_05c1: Unknown result type (might be due to invalid IL or missing references) //IL_05c6: Unknown result type (might be due to invalid IL or missing references) //IL_05d7: Unknown result type (might be due to invalid IL or missing references) //IL_05e4: Expected O, but got Unknown //IL_05e5: Unknown result type (might be due to invalid IL or missing references) //IL_05ea: Unknown result type (might be due to invalid IL or missing references) //IL_05fb: Unknown result type (might be due to invalid IL or missing references) //IL_0608: Expected O, but got Unknown //IL_0609: Unknown result type (might be due to invalid IL or missing references) //IL_060e: Unknown result type (might be due to invalid IL or missing references) //IL_061f: Unknown result type (might be due to invalid IL or missing references) //IL_062c: Expected O, but got Unknown //IL_062d: Unknown result type (might be due to invalid IL or missing references) //IL_0632: Unknown result type (might be due to invalid IL or missing references) //IL_0643: Unknown result type (might be due to invalid IL or missing references) //IL_0650: Expected O, but got Unknown //IL_0651: Unknown result type (might be due to invalid IL or missing references) //IL_0656: Unknown result type (might be due to invalid IL or missing references) //IL_0667: Unknown result type (might be due to invalid IL or missing references) //IL_0674: Expected O, but got Unknown //IL_0675: Unknown result type (might be due to invalid IL or missing references) //IL_067a: Unknown result type (might be due to invalid IL or missing references) //IL_068b: Unknown result type (might be due to invalid IL or missing references) //IL_0698: Expected O, but got Unknown //IL_0699: Unknown result type (might be due to invalid IL or missing references) //IL_069e: Unknown result type (might be due to invalid IL or missing references) //IL_06af: Unknown result type (might be due to invalid IL or missing references) //IL_06bc: Expected O, but got Unknown //IL_06bd: Unknown result type (might be due to invalid IL or missing references) //IL_06c2: Unknown result type (might be due to invalid IL or missing references) //IL_06d3: Unknown result type (might be due to invalid IL or missing references) //IL_06e0: Expected O, but got Unknown //IL_06e1: Unknown result type (might be due to invalid IL or missing references) //IL_06e6: Unknown result type (might be due to invalid IL or missing references) //IL_06f7: Unknown result type (might be due to invalid IL or missing references) //IL_0704: Expected O, but got Unknown //IL_0705: Unknown result type (might be due to invalid IL or missing references) //IL_070a: Unknown result type (might be due to invalid IL or missing references) //IL_071b: Unknown result type (might be due to invalid IL or missing references) //IL_0728: Expected O, but got Unknown //IL_0729: Unknown result type (might be due to invalid IL or missing references) //IL_072e: Unknown result type (might be due to invalid IL or missing references) //IL_073f: Unknown result type (might be due to invalid IL or missing references) //IL_074c: Expected O, but got Unknown //IL_074d: Unknown result type (might be due to invalid IL or missing references) //IL_0752: Unknown result type (might be due to invalid IL or missing references) //IL_0763: Unknown result type (might be due to invalid IL or missing references) //IL_0770: Expected O, but got Unknown //IL_0771: Unknown result type (might be due to invalid IL or missing references) //IL_0776: Unknown result type (might be due to invalid IL or missing references) //IL_0787: Unknown result type (might be due to invalid IL or missing references) //IL_0794: Expected O, but got Unknown //IL_0795: Unknown result type (might be due to invalid IL or missing references) //IL_079a: Unknown result type (might be due to invalid IL or missing references) //IL_07ab: Unknown result type (might be due to invalid IL or missing references) //IL_07b8: Expected O, but got Unknown //IL_07b9: Unknown result type (might be due to invalid IL or missing references) //IL_07be: Unknown result type (might be due to invalid IL or missing references) //IL_07cf: Unknown result type (might be due to invalid IL or missing references) //IL_07dc: Expected O, but got Unknown //IL_07dd: Unknown result type (might be due to invalid IL or missing references) //IL_07e2: Unknown result type (might be due to invalid IL or missing references) //IL_07f3: Unknown result type (might be due to invalid IL or missing references) //IL_0800: Expected O, but got Unknown if (itemList == null) { HQRebalance.Logger.LogError((object)"All items list is null"); return; } lootPoll = new List<SpawnableItemWithRarity> { new SpawnableItemWithRarity { spawnableItem = ItemByName("Airhorn"), rarity = airhorn }, new SpawnableItemWithRarity { spawnableItem = ItemByName("Bell"), rarity = bell }, new SpawnableItemWithRarity { spawnableItem = ItemByName("BigBolt"), rarity = big_bolt }, new SpawnableItemWithRarity { spawnableItem = ItemByName("BottleBin"), rarity = bottles }, new SpawnableItemWithRarity { spawnableItem = ItemByName("Brush"), rarity = brush }, new SpawnableItemWithRarity { spawnableItem = ItemByName("Candy"), rarity = candy }, new SpawnableItemWithRarity { spawnableItem = ItemByName("CashRegister"), rarity = cash_register }, new SpawnableItemWithRarity { spawnableItem = ItemByName("ChemicalJug"), rarity = chemical_jug }, new SpawnableItemWithRarity { spawnableItem = ItemByName("Clock"), rarity = clock }, new SpawnableItemWithRarity { spawnableItem = ItemByName("ClownHorn"), rarity = clown_horn }, new SpawnableItemWithRarity { spawnableItem = ItemByName("ComedyMask"), rarity = comedy }, new SpawnableItemWithRarity { spawnableItem = ItemByName("ControlPad"), rarity = control_pad }, new SpawnableItemWithRarity { spawnableItem = ItemByName("MoldPan"), rarity = cookie_mold }, new SpawnableItemWithRarity { spawnableItem = ItemByName("DustPan"), rarity = dust_pan }, new SpawnableItemWithRarity { spawnableItem = ItemByName("EasterEgg"), rarity = easter_egg }, new SpawnableItemWithRarity { spawnableItem = ItemByName("EggBeater"), rarity = egg_beater }, new SpawnableItemWithRarity { spawnableItem = ItemByName("FancyLamp"), rarity = fancy_lamp }, new SpawnableItemWithRarity { spawnableItem = ItemByName("Flask"), rarity = flask }, new SpawnableItemWithRarity { spawnableItem = ItemByName("GarbageLid"), rarity = garbage_lid }, new SpawnableItemWithRarity { spawnableItem = ItemByName("GiftBox"), rarity = gift_box }, new SpawnableItemWithRarity { spawnableItem = ItemByName("GoldBar"), rarity = gold_bar }, new SpawnableItemWithRarity { spawnableItem = ItemByName("FancyCup"), rarity = golden_cup }, new SpawnableItemWithRarity { spawnableItem = ItemByName("Hairdryer"), rarity = hairdryer }, new SpawnableItemWithRarity { spawnableItem = ItemByName("DiyFlashbang"), rarity = flashbang }, new SpawnableItemWithRarity { spawnableItem = ItemByName("PickleJar"), rarity = pickles }, new SpawnableItemWithRarity { spawnableItem = ItemByName("Cog1"), rarity = large_axle }, new SpawnableItemWithRarity { spawnableItem = ItemByName("FlashLaserPointer"), rarity = laser_pointer }, new SpawnableItemWithRarity { spawnableItem = ItemByName("7Ball"), rarity = magic_ball }, new SpawnableItemWithRarity { spawnableItem = ItemByName("MagnifyingGlass"), rarity = mag_glass }, new SpawnableItemWithRarity { spawnableItem = ItemByName("MetalSheet"), rarity = metal_sheet }, new SpawnableItemWithRarity { spawnableItem = ItemByName("Mug"), rarity = mug }, new SpawnableItemWithRarity { spawnableItem = ItemByName("Phone"), rarity = old_phone }, new SpawnableItemWithRarity { spawnableItem = ItemByName("FancyPainting"), rarity = painting }, new SpawnableItemWithRarity { spawnableItem = ItemByName("PerfumeBottle"), rarity = perfume }, new SpawnableItemWithRarity { spawnableItem = ItemByName("PillBottle"), rarity = pill_bottle }, new SpawnableItemWithRarity { spawnableItem = ItemByName("PlasticCup"), rarity = plastic_cup }, new SpawnableItemWithRarity { spawnableItem = ItemByName("FishTestProp"), rarity = plastic_fish }, new SpawnableItemWithRarity { spawnableItem = ItemByName("SodaCanRed"), rarity = red_soda }, new SpawnableItemWithRarity { spawnableItem = ItemByName("Remote"), rarity = remote }, new SpawnableItemWithRarity { spawnableItem = ItemByName("Ring"), rarity = ring }, new SpawnableItemWithRarity { spawnableItem = ItemByName("RubberDuck"), rarity = rubber_duck }, new SpawnableItemWithRarity { spawnableItem = ItemByName("SoccerBall"), rarity = soccer_ball }, new SpawnableItemWithRarity { spawnableItem = ItemByName("SteeringWheel"), rarity = wheel }, new SpawnableItemWithRarity { spawnableItem = ItemByName("StopSign"), rarity = stop_sign }, new SpawnableItemWithRarity { spawnableItem = ItemByName("TeaKettle"), rarity = tea_kettle }, new SpawnableItemWithRarity { spawnableItem = ItemByName("Dentures"), rarity = teeth }, new SpawnableItemWithRarity { spawnableItem = ItemByName("ToiletPaperRolls"), rarity = toiler_paper }, new SpawnableItemWithRarity { spawnableItem = ItemByName("Toothpaste"), rarity = toothpaste }, new SpawnableItemWithRarity { spawnableItem = ItemByName("ToyCube"), rarity = toy_cube }, new SpawnableItemWithRarity { spawnableItem = ItemByName("RobotToy"), rarity = toy_robot }, new SpawnableItemWithRarity { spawnableItem = ItemByName("ToyTrain"), rarity = toy_train }, new SpawnableItemWithRarity { spawnableItem = ItemByName("TragedyMask"), rarity = tragedy }, new SpawnableItemWithRarity { spawnableItem = ItemByName("EnginePart1"), rarity = engine }, new SpawnableItemWithRarity { spawnableItem = ItemByName("WhoopieCushion"), rarity = whoopie }, new SpawnableItemWithRarity { spawnableItem = ItemByName("YieldSign"), rarity = yield_sign }, new SpawnableItemWithRarity { spawnableItem = ItemByName("Zeddog"), rarity = zed_dog } }; lootPoll.RemoveAll((SpawnableItemWithRarity i) => i.rarity == 0); } private Item ItemByName(string name) { if (itemList.TryGetValue(name, out Item value)) { return value; } throw new Exception("Could not retrieve item of name: " + name); } public List<SpawnableItemWithRarity> GetLootpool() { return lootPoll; } } } namespace HQRebalance.Patches { [HarmonyPatch(typeof(ButlerEnemyAI))] internal class ButlerEnemyAIPatches { public static int knifeCount = 0; private static readonly ConditionalWeakTable<EnemyAI, KnifeIconInfo> knifeIcons = new ConditionalWeakTable<EnemyAI, KnifeIconInfo>(); [HarmonyPatch("Start")] [HarmonyPostfix] private static void PostStart(ButlerEnemyAI __instance) { knifeIcons.Add((EnemyAI)(object)__instance, new KnifeIconInfo { radarIcon = Object.Instantiate<GameObject>(StartOfRound.Instance.itemRadarIconPrefab, RoundManager.Instance.mapPropsContainer.transform).transform, knifeTransform = ((Component)((Component)__instance).gameObject.transform.GetChild(1).GetChild(4).GetChild(0) .GetChild(1) .GetChild(0) .GetChild(0) .GetChild(0)).transform }); knifeCount++; } [HarmonyPatch("LateUpdate")] [HarmonyPostfix] private static void PostLateUpdate(ButlerEnemyAI __instance) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) if (!((EnemyAI)__instance).isEnemyDead) { if (knifeIcons.TryGetValue((EnemyAI)(object)__instance, out KnifeIconInfo value)) { value.radarIcon.position = value.knifeTransform.position; } else { HQRebalance.Logger.LogInfo((object)"Could not find icon to update"); } } } [HarmonyPatch("KillEnemy")] [HarmonyPostfix] private static void PostKillEnemy(ButlerEnemyAI __instance) { if (knifeIcons.TryGetValue((EnemyAI)(object)__instance, out KnifeIconInfo value)) { Object.Destroy((Object)(object)((Component)value.radarIcon).gameObject); knifeCount--; } else { HQRebalance.Logger.LogInfo((object)"Could not find icon to destroy"); } } [HarmonyPatch("OnCollideWithPlayer")] [HarmonyPrefix] private static void PreOnCollideWithPlayer(ButlerEnemyAI __instance) { __instance.timeSinceStealthStab = Time.realtimeSinceStartup; } } public class KnifeIconInfo { public Transform radarIcon; public Transform knifeTransform; } [HarmonyPatch(typeof(CaveDwellerAI))] internal class CaveDwellerAIPatches { [HarmonyPatch("HitEnemy")] [HarmonyPrefix] private static void PreHitEnemy(CaveDwellerAI __instance, int force) { if (!((EnemyAI)__instance).inSpecialAnimation && ((EnemyAI)__instance).currentBehaviourStateIndex != 0) { ((EnemyAI)__instance).enemyHP = ((EnemyAI)__instance).enemyHP - (force - 1); } } [HarmonyPatch("BabyUpdate")] [HarmonyPrefix] private static void PreBabyUpdate(CaveDwellerAI __instance) { if (NetworkManager.Singleton.IsServer || NetworkManager.Singleton.IsHost) { if (__instance.eatingScrap && !__instance.hasPlayerFoundBaby) { __instance.eatingScrap = false; } if (__instance.babyCrying && !__instance.hasPlayerFoundBaby) { __instance.SetCryingLocalClient(false); __instance.SetBabyCryingServerRpc(false); } } } [HarmonyPatch("ScareBaby")] [HarmonyPrefix] private static bool PreScareBaby(CaveDwellerAI __instance) { if (!__instance.hasPlayerFoundBaby) { return false; } return true; } } [HarmonyPatch(typeof(GameNetworkManager))] internal class GameNetworkManagerPatches { [HarmonyPatch("Start")] [HarmonyPostfix] private static void PostStart(GameNetworkManager __instance) { HQRNetworkManager.CreateAndRegisterPrefab(); } [HarmonyPatch("SaveGameValues")] [HarmonyPostfix] private static void PostSaveGameValues(GameNetworkManager __instance) { if (!__instance.isHostingGame || !StartOfRound.Instance.inShipPhase || StartOfRound.Instance.isChallengeFile) { return; } try { ES3.Save<bool>("Tier3Pass", HQRNetworkManager.Instance.tier3pass.Value, __instance.currentSaveFileName); } catch (Exception arg) { HQRebalance.Logger.LogError((object)$"Error while trying to save game values when disconnecting as host: {arg}"); } } [HarmonyPatch("Disconnect")] [HarmonyPrefix] private static void PreDisconnect(GameNetworkManager __instance) { HQRNetworkManager.DespawnNetworkHandler(); } } [HarmonyPatch(typeof(JesterAI))] internal class JesterAIPatches { [HarmonyPatch("Start")] [HarmonyPostfix] private static void PostStart(JesterAI __instance) { ((Component)__instance.mainCollider).gameObject.GetComponent<Collider>().isTrigger = true; ((EnemyAI)__instance).enemyType.pushPlayerForce = 6.5f; } [HarmonyPatch("SetJesterInitialValues")] [HarmonyPostfix] private static void PostSetJesterInitialValues(JesterAI __instance) { __instance.mainCollider.isTrigger = true; __instance.beginCrankingTimer = 1.25f * (__instance.beginCrankingTimer - 13f) + 30f * StartOfRound.Instance.currentLevel.factorySizeMultiplier - 10f; } } [HarmonyPatch(typeof(ManualCameraRenderer))] internal class ManualCameraRendererPatches { [HarmonyPatch("CheckIfPlayerIsInCaves")] [HarmonyPrefix] private static bool PreCheckIfPlayerIsInCaves(ManualCameraRenderer __instance) { return false; } } [HarmonyPatch(typeof(NetworkManager))] internal class NetworkManagerPatches { [HarmonyPatch("ShutdownInternal")] [HarmonyPrefix] private static void PreShutdownInternal(NetworkManager __instance) { if (!((Object)(object)NetworkManager.Singleton == (Object)null) && NetworkManager.Singleton.CustomMessagingManager != null) { ButlerEnemyAIPatches.knifeCount = 0; } } } [HarmonyPatch(typeof(PlayerControllerB))] internal class PlayerControllerBPatches { [HarmonyPatch("CalculateGroundNormal")] [HarmonyPrefix] private static bool OverwriteCalculateGroundNormal(PlayerControllerB __instance) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_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_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_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: 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) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) RaycastHit hit = default(RaycastHit); if (Physics.Raycast(((Component)__instance).transform.position + Vector3.up * 0.2f, -Vector3.up, ref hit, 6f, 268438273, (QueryTriggerInteraction)1)) { __instance.playerGroundNormal = ((RaycastHit)(ref hit)).normal; } else { __instance.playerGroundNormal = Vector3.up; } __instance.hit = hit; return false; } [HarmonyPatch("Update")] [HarmonyPostfix] private static void PostUpdate(PlayerControllerB __instance) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) if (((Component)__instance).transform.position.y <= -80f && __instance.isUnderwater && RoundManager.Instance.currentDungeonType == 4) { __instance.hinderedMultiplier = 0.55f; } } } [HarmonyPatch(typeof(RoundManager))] internal class RoundManagerPatches { [HarmonyPatch("Start")] [HarmonyPostfix] private static void PostStart(RoundManager __instance) { __instance.enemyRushIndex = -1; __instance.dungeonFlowTypes[4].MapTileSize = 1.1f; __instance.dungeonFlowTypes[4].dungeonFlow.Lines[0].Length = 0.15f; __instance.dungeonFlowTypes[4].dungeonFlow.Lines[1].Length = 0.65f; __instance.dungeonFlowTypes[4].dungeonFlow.Lines[1].Position = 0.15f; __instance.dungeonFlowTypes[4].dungeonFlow.Lines[2].Length = 0.20000002f; __instance.dungeonFlowTypes[4].dungeonFlow.Lines[2].Position = 0.8f; } [HarmonyPatch("OnDestroy")] [HarmonyPrefix] private static void PreOnDestroy(RoundManager __instance) { if (__instance.enemyRushIndex > -1) { StartOfRound.Instance.currentLevel.Enemies[__instance.enemyRushIndex].enemyType.MaxCount = RoundManagerHelper.saveMaxEnemyCount; } } [HarmonyPatch("SpawnScrapInLevel")] [HarmonyTranspiler] private static IEnumerable<CodeInstruction> TranspileSpawnScrapInLevel(IEnumerable<CodeInstruction> codes) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Expected O, but got Unknown CodeMatcher val = new CodeMatcher(codes, (ILGenerator)null); val.MatchForward(false, (CodeMatch[])(object)new CodeMatch[1] { new CodeMatch((OpCode?)OpCodes.Ldc_I4_6, (object)null, (string)null) }); if (val.IsInvalid) { HQRebalance.Logger.LogError((object)"Could not find the first pattern. Aborting TranspileSpawnScrapInLevel transpiler."); return codes; } val.SetOpcodeAndAdvance(OpCodes.Ldc_I4_0); val.MatchForward(false, (CodeMatch[])(object)new CodeMatch[1] { new CodeMatch((OpCode?)OpCodes.Ldc_I4_S, (object)(sbyte)20, (string)null) }); if (val.IsInvalid) { HQRebalance.Logger.LogError((object)"Could not find the second pattern. Aborting TranspileSpawnScrapInLevel transpiler."); return codes; } val.SetOperandAndAdvance((object)(-1)); return val.InstructionEnumeration(); } [HarmonyPatch("PlotOutEnemiesForNextHour")] [HarmonyTranspiler] private static IEnumerable<CodeInstruction> TranspilePlotOutEnemiesForNextHour(IEnumerable<CodeInstruction> codes) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Expected O, but got Unknown //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Expected O, but got Unknown //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Expected O, but got Unknown //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Expected O, but got Unknown //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Expected O, but got Unknown //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Expected O, but got Unknown //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Expected O, but got Unknown CodeMatcher val = new CodeMatcher(codes, (ILGenerator)null); val.MatchForward(false, (CodeMatch[])(object)new CodeMatch[2] { new CodeMatch((OpCode?)OpCodes.Ldloc_1, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Call, (object)AccessTools.PropertyGetter(typeof(TimeOfDay), "Instance"), (string)null) }); if (val.IsInvalid) { HQRebalance.Logger.LogError((object)"Could not find the starting pattern. Aborting TranspilePlotOutEnemiesForNextHour transpiler."); return codes; } List<Label> labels = val.Instruction.labels; int pos = val.Pos; CodeMatcher val2 = val.Clone(); val2.MatchForward(false, (CodeMatch[])(object)new CodeMatch[1] { new CodeMatch((OpCode?)OpCodes.Stloc_2, (object)null, (string)null) }); if (val2.IsInvalid) { HQRebalance.Logger.LogError((object)"Could not find the ending pattern. Aborting TranspilePlotOutEnemiesForNextHour transpiler."); return codes; } int pos2 = val2.Pos; val.RemoveInstructionsInRange(pos, pos2); List<CodeInstruction> list = new List<CodeInstruction>(); list.Add(new CodeInstruction(OpCodes.Ldloc_1, (object)null)); list.Add(new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(RoundManagerHelper), "SteadSpawnIncrease", (Type[])null, (Type[])null))); list.Add(new CodeInstruction(OpCodes.Add, (object)null)); list.Add(new CodeInstruction(OpCodes.Stloc_2, (object)null)); List<CodeInstruction> list2 = list; list2[0].labels.AddRange(labels); val.InsertAndAdvance((IEnumerable<CodeInstruction>)list2); val.MatchForward(false, (CodeMatch[])(object)new CodeMatch[1] { new CodeMatch((OpCode?)OpCodes.Ldc_I4_2, (object)null, (string)null) }); if (val.IsInvalid) { HQRebalance.Logger.LogError((object)"Could not find the second pattern. Aborting TranspilePlotOutEnemiesForNextHour transpiler."); return codes; } val.SetOpcodeAndAdvance(OpCodes.Ldc_I4_0); return val.InstructionEnumeration(); } [HarmonyPatch("RefreshEnemiesList")] [HarmonyTranspiler] private static IEnumerable<CodeInstruction> TranspileRefreshEnemyList(IEnumerable<CodeInstruction> codes) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Expected O, but got Unknown //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Expected O, but got Unknown //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Expected O, but got Unknown CodeMatcher val = new CodeMatcher(codes, (ILGenerator)null); val.MatchForward(false, (CodeMatch[])(object)new CodeMatch[1] { new CodeMatch((OpCode?)OpCodes.Ldloca_S, (object)null, (string)null) }); if (val.IsInvalid) { HQRebalance.Logger.LogError((object)"Could not find the starting pattern. Aborting TranspileRefreshEnemyList transpiler."); return codes; } int pos = val.Pos; CodeMatcher val2 = val.Clone(); val2.End().MatchBack(true, (CodeMatch[])(object)new CodeMatch[1] { new CodeMatch((OpCode?)OpCodes.Callvirt, (object)AccessTools.Method(typeof(GameObject), "SetActive", (Type[])null, (Type[])null), (string)null) }); if (val2.IsInvalid) { HQRebalance.Logger.LogError((object)"Could not find the ending pattern. Aborting TranspileRefreshEnemyList transpiler."); return codes; } int pos2 = val2.Pos; if (pos >= pos2) { HQRebalance.Logger.LogWarning((object)"Start and end patterns are the same or in the wrong order. Nothing to remove."); return codes; } val.RemoveInstructionsInRange(pos, pos2); val.InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[2] { new CodeInstruction(OpCodes.Ldarg_0, (object)null), new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(RoundManagerHelper), "OverwriteRushCode", (Type[])null, (Type[])null)) }); return val.InstructionEnumeration(); } [HarmonyPatch("AssignRandomEnemyToVent")] [HarmonyTranspiler] private static IEnumerable<CodeInstruction> TranspileAssignRandomEnemyToVent(IEnumerable<CodeInstruction> codes) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Expected O, but got Unknown //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Expected O, but got Unknown //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Expected O, but got Unknown //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Expected O, but got Unknown //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Expected O, but got Unknown //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Expected O, but got Unknown //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Expected O, but got Unknown //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Expected O, but got Unknown //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Expected O, but got Unknown //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Expected O, but got Unknown //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Expected O, but got Unknown //IL_020d: Unknown result type (might be due to invalid IL or missing references) //IL_0217: Expected O, but got Unknown //IL_021f: Unknown result type (might be due to invalid IL or missing references) //IL_0229: Expected O, but got Unknown //IL_0244: Unknown result type (might be due to invalid IL or missing references) //IL_024e: Expected O, but got Unknown //IL_026b: Unknown result type (might be due to invalid IL or missing references) //IL_0275: Expected O, but got Unknown //IL_027d: Unknown result type (might be due to invalid IL or missing references) //IL_0287: Expected O, but got Unknown //IL_02a2: Unknown result type (might be due to invalid IL or missing references) //IL_02ac: Expected O, but got Unknown //IL_02c9: Unknown result type (might be due to invalid IL or missing references) //IL_02d3: Expected O, but got Unknown //IL_02db: Unknown result type (might be due to invalid IL or missing references) //IL_02e5: Expected O, but got Unknown CodeMatcher val = new CodeMatcher(codes, (ILGenerator)null); val.MatchForward(false, (CodeMatch[])(object)new CodeMatch[3] { new CodeMatch((OpCode?)OpCodes.Ldarg_0, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Ldfld, (object)AccessTools.Field(typeof(RoundManager), "enemyRushIndex"), (string)null), new CodeMatch((OpCode?)OpCodes.Ldc_I4_M1, (object)null, (string)null) }); if (val.IsInvalid) { HQRebalance.Logger.LogError((object)"Could not find the starting pattern. Aborting TranspileAssignRandomEnemyToVent transpiler."); return codes; } int pos = val.Pos; CodeMatcher val2 = val.Clone(); val2.End().MatchBack(true, (CodeMatch[])(object)new CodeMatch[1] { new CodeMatch((OpCode?)OpCodes.Stloc_S, (object)null, (string)null) }); if (val2.IsInvalid) { HQRebalance.Logger.LogError((object)"Could not find the ending pattern. Aborting TranspileAssignRandomEnemyToVent transpiler."); return codes; } int pos2 = val2.Pos; val.RemoveInstructionsInRange(pos, pos2); val.InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[5] { new CodeInstruction(OpCodes.Ldarg_0, (object)null), new CodeInstruction(OpCodes.Ldloc_1, (object)null), new CodeInstruction(OpCodes.Ldloc_3, (object)null), new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(RoundManagerHelper), "SpawnProbabilityCode", (Type[])null, (Type[])null)), new CodeInstruction(OpCodes.Stloc_S, (object)(sbyte)4) }); val.MatchForward(false, (CodeMatch[])(object)new CodeMatch[2] { new CodeMatch((OpCode?)OpCodes.Ldarg_0, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Ldarg_0, (object)null, (string)null) }); if (val.IsInvalid) { HQRebalance.Logger.LogError((object)"Could not find the starting pattern2. Aborting TranspileAssignRandomEnemyToVent transpiler."); return codes; } pos = val.Pos; List<Label> labels = val.Instruction.labels; val2 = val.Clone(); val2.MatchForward(true, (CodeMatch[])(object)new CodeMatch[1] { new CodeMatch((OpCode?)OpCodes.Stloc_2, (object)null, (string)null) }); if (val2.IsInvalid) { HQRebalance.Logger.LogError((object)"Could not find the ending pattern2. Aborting TranspileAssignRandomEnemyToVent transpiler."); return codes; } pos2 = val2.Pos; val.RemoveInstructionsInRange(pos, pos2); List<CodeInstruction> list = new List<CodeInstruction>(); list.Add(new CodeInstruction(OpCodes.Ldarg_0, (object)null)); list.Add(new CodeInstruction(OpCodes.Ldarg_0, (object)null)); list.Add(new CodeInstruction(OpCodes.Ldfld, (object)AccessTools.Field(typeof(RoundManager), "SpawnProbabilities"))); list.Add(new CodeInstruction(OpCodes.Callvirt, (object)AccessTools.Method(typeof(List<int>), "ToArray", (Type[])null, (Type[])null))); list.Add(new CodeInstruction(OpCodes.Ldarg_0, (object)null)); list.Add(new CodeInstruction(OpCodes.Ldfld, (object)AccessTools.Field(typeof(RoundManager), "EnemySpawnRandom"))); list.Add(new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(RoundManagerHelper), "GetModifiedRandomWeightedIndex", (Type[])null, (Type[])null))); list.Add(new CodeInstruction(OpCodes.Stloc_2, (object)null)); List<CodeInstruction> list2 = list; list2[0].labels.AddRange(labels); val.InsertAndAdvance((IEnumerable<CodeInstruction>)list2); return val.InstructionEnumeration(); } } internal class RoundManagerHelper { public static int saveMaxEnemyCount; public static float SteadSpawnIncrease() { return (float)TimeOfDay.Instance.timesFulfilledQuota / 5f; } public static void OverwriteRushCode(RoundManager instance) { Random random = new Random(StartOfRound.Instance.randomMapSeed + 2145); int num = ((StartOfRoundPatches.daysClearedInARow >= 3) ? 20 : 4); if (random.Next(0, 100) >= num) { return; } int num2 = -1; bool flag = false; List<int> list = new List<int>(); for (int i = 0; i < instance.currentLevel.Enemies.Count; i++) { if (instance.currentLevel.Enemies[i].enemyType.enemyName == "Nutcracker") { list.Add(i); flag = true; } if (instance.currentLevel.Enemies[i].enemyType.enemyName == "Butler") { list.Add(i); flag = true; } } if (flag) { num2 = list[random.Next(0, list.Count)]; saveMaxEnemyCount = instance.currentLevel.Enemies[num2].enemyType.MaxCount; instance.currentLevel.Enemies[num2].enemyType.MaxCount = 999; instance.enemyRushIndex = num2; } } public static int SpawnProbabilityCode(RoundManager instance, EnemyType enemy, int index) { int num = 0; if (instance.increasedInsideEnemySpawnRateIndex == index) { return 100; } if (!enemy.useNumberSpawnedFalloff) { return (int)((double)instance.currentLevel.Enemies[index].rarity * (double)enemy.probabilityCurve.Evaluate(instance.timeScript.normalizedTimeOfDay)); } return (int)((double)instance.currentLevel.Enemies[index].rarity * (double)enemy.probabilityCurve.Evaluate(instance.timeScript.normalizedTimeOfDay) * (double)enemy.numberSpawnedFalloff.Evaluate((float)enemy.numberSpawned / 10f)); } public static int GetModifiedRandomWeightedIndex(RoundManager instance, int[] SpawnProbabilities, Random EnemySpawnRandom) { if (instance.enemyRushIndex != -1 && EnemySpawnRandom.Next(0, 100) < 60) { return instance.enemyRushIndex; } return instance.GetRandomWeightedIndex(SpawnProbabilities, EnemySpawnRandom); } } [HarmonyPatch(typeof(StartOfRound))] internal class StartOfRoundPatches { public static int daysClearedInARow; [HarmonyPatch("Awake")] [HarmonyPrefix] private static void PreAwake(StartOfRound __instance) { HQRNetworkManager.SpawnNetworkHandler(); } [HarmonyPatch("Start")] [HarmonyPostfix] private static void PostStart(StartOfRound __instance) { daysClearedInARow = 0; HQRebalance.Instance.SetupMoons(__instance); ((EnemyAI)Resources.FindObjectsOfTypeAll<CaveDwellerAI>()[0]).enemyType.increasedChanceInterior = -1; } [HarmonyPatch("ShipHasLeft")] [HarmonyPrefix] private static void PreShipHasLeft(StartOfRound __instance) { if (((NetworkBehaviour)__instance).IsServer || ((NetworkBehaviour)__instance).IsHost) { int num = Object.FindObjectsOfType<DeadBodyInfo>().Length; HQRNetworkManager.Instance.bottomLine.Value = __instance.GetValueOfAllScrap(false, true) + 35 * ButlerEnemyAIPatches.knifeCount - 5 * num; } } [HarmonyPatch("EndOfGameClientRpc")] [HarmonyPrefix] private static void PreEndOfGameClientRpc(StartOfRound __instance, int scrapCollectedOnServer) { ButlerEnemyAIPatches.knifeCount = 0; RoundManager.Instance.totalScrapValueInLevel = HQRNetworkManager.Instance.bottomLine.Value; if (__instance.currentLevel.spawnEnemiesAndScrap) { if ((double)(scrapCollectedOnServer - 5 * __instance.GetBodiesInShip()) / (double)HQRNetworkManager.Instance.bottomLine.Value > 0.8500000238418579) { daysClearedInARow++; } else { daysClearedInARow = 0; } } if (RoundManager.Instance.enemyRushIndex != -1) { __instance.currentLevel.Enemies[RoundManager.Instance.enemyRushIndex].enemyType.MaxCount = RoundManagerHelper.saveMaxEnemyCount; } } [HarmonyPatch("PassTimeToNextDay")] [HarmonyPostfix] private static void PostPassTimeToNextDay(StartOfRound __instance) { if ((((NetworkBehaviour)__instance).IsServer || ((NetworkBehaviour)__instance).IsHost) && TimeOfDay.Instance.daysUntilDeadline == 0) { HQRNetworkManager.Instance.tier3pass.Value = false; } } [HarmonyPatch("SetTimeAndPlanetToSavedSettings")] [HarmonyPostfix] private static void PostSetTimeAndPlanetToSavedSettings(StartOfRound __instance) { HQRNetworkManager.Instance.tier3pass.Value = ES3.Load<bool>("Tier3Pass", GameNetworkManager.Instance.currentSaveFileName, false); } } [HarmonyPatch(typeof(Terminal))] internal class TerminalPatches { [HarmonyPatch("ParsePlayerSentence")] [HarmonyPrefix] private static void ParsePlayerSentencePrePatch(Terminal __instance) { string text = __instance.screenText.text.Substring(__instance.screenText.text.Length - __instance.textAdded); StringBuilder stringBuilder = new StringBuilder(); string text2 = text; foreach (char c in text2) { if (!char.IsPunctuation(c)) { stringBuilder.Append(c); } } text = stringBuilder.ToString().ToLower(); TerminalHelper.terminalInput = text; } [HarmonyPatch("Start")] [HarmonyPostfix] private static void PostStart(Terminal __instance) { TerminalHelper.terminal = Object.FindObjectOfType<Terminal>(); TerminalNode result = __instance.terminalNodes.allKeywords[27].compatibleNouns[10].result; TerminalNode result2 = __instance.terminalNodes.allKeywords[27].compatibleNouns[5].result; TerminalNode result3 = __instance.terminalNodes.allKeywords[27].compatibleNouns[6].result; TerminalNode result4 = __instance.terminalNodes.allKeywords[27].compatibleNouns[9].result; result.itemCost = 3000; result.terminalOptions[1].result.itemCost = 3000; result2.itemCost = 0; result2.terminalOptions[1].result.itemCost = 0; result2.displayText = result2.displayText.Replace("The cost to route to 85-Rend is [totalCost]", "No additional cost required to route to 85-Rend"); result3.itemCost = 0; result3.terminalOptions[1].result.itemCost = 0; result3.displayText = result3.displayText.Replace("The cost to route to 7-Dine is [totalCost]", "No additional cost required to route to 7-Dine"); result4.itemCost = 0; result4.terminalOptions[1].result.itemCost = 0; result4.displayText = result4.displayText.Replace("The cost to route to 8-Titan is [totalCost]", "No additional cost required to route to 8-Titan"); } [HarmonyPatch("LoadNewNode")] [HarmonyPrefix] private static void PreLoadNewNode(Terminal __instance, ref TerminalNode node) { if ((((Object)node).name == "85route" || ((Object)node).name == "7route" || ((Object)node).name == "8route") && !HQRNetworkManager.Instance.tier3pass.Value) { if (((Object)node).name == "85route") { TerminalHelper.moon = "85-Rend"; } else if (((Object)node).name == "7route") { TerminalHelper.moon = "7-Dine"; } else if (((Object)node).name == "8route") { TerminalHelper.moon = "8-Titan"; } __instance.totalCostOfItems = TerminalHelper.TerminalNodes.buyPass.itemCost; node = TerminalHelper.TerminalNodes.buyPass; } } [HarmonyPatch("TextPostProcess")] [HarmonyPrefix] private static void PreTextPostProcess(Terminal __instance, ref string modifiedDisplayText) { if (modifiedDisplayText.Contains("[scanForItems]")) { Random random = new Random(StartOfRound.Instance.randomMapSeed + 91); int num = 0; int num2 = 0; GrabbableObject[] array = Object.FindObjectsOfType<GrabbableObject>(); GrabbableObject[] array2 = array; foreach (GrabbableObject val in array2) { if (val.itemProperties.isScrap && !val.isInShipRoom && !val.isInElevator) { num2 += val.scrapValue; num++; } } num2 += 35 * ButlerEnemyAIPatches.knifeCount; num += ButlerEnemyAIPatches.knifeCount; int num3 = ((num <= 5) ? 1 : 2); num2 = num3 * (int)((double)num2 * (0.10000000149011612 * random.NextDouble() + 0.949999988079071)); modifiedDisplayText = modifiedDisplayText.Replace("[scanForItems]", $"There are {num} objects outside the ship, totalling at an approximate value of ${num2}."); } else { if (modifiedDisplayText.Contains("[passConfirm]")) { modifiedDisplayText = modifiedDisplayText.Replace("[passConfirm]", TerminalHelper.PassConfirmDisplay()); } if (modifiedDisplayText.Contains("[coldMoon]")) { modifiedDisplayText = modifiedDisplayText.Replace("[coldMoon]", TerminalHelper.moon); } } } } internal static class TerminalHelper { public class TerminalNodes { public static TerminalNode passConfirm = new TerminalNode { acceptAnything = false, buyItemIndex = -1, buyRerouteToMoon = -1, buyUnlockable = false, buyVehicleIndex = -1, clearPreviousText = true, creatureFileID = -1, creatureName = "", displayPlanetInfo = -1, displayText = "[passConfirm]", displayTexture = null, displayVideo = null, hideFlags = (HideFlags)0, isConfirmationNode = false, itemCost = 610, loadImageSlowly = false, maxCharactersToType = 35, name = "passConfirm", overrideOptions = false, persistentImage = false, playClip = null, playSyncedClip = 0, returnFromStorage = false, shipUnlockableID = -1, storyLogFileID = -1, terminalEvent = "" }; public static TerminalNode passDeny = new TerminalNode { acceptAnything = false, buyItemIndex = -1, buyRerouteToMoon = -1, buyUnlockable = false, buyVehicleIndex = -1, clearPreviousText = false, creatureFileID = -1, creatureName = "", displayPlanetInfo = -1, displayText = "\nCold Moon Pass purchase canceled.\n\n", displayTexture = null, displayVideo = null, hideFlags = (HideFlags)0, isConfirmationNode = false, itemCost = 0, loadImageSlowly = false, maxCharactersToType = 35, name = "passDeny", overrideOptions = false, persistentImage = false, playClip = null, playSyncedClip = -1, returnFromStorage = false, shipUnlockableID = -1, storyLogFileID = -1, terminalEvent = "" }; public static TerminalNode buyPass; static TerminalNodes() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: 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_0013: 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_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0041: 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_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00be: 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_00d5: Expected O, but got Unknown //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: 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_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0104: 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_0116: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_012f: 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_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Expected O, but got Unknown //IL_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Expected O, but got Unknown //IL_0280: Unknown result type (might be due to invalid IL or missing references) //IL_0285: Unknown result type (might be due to invalid IL or missing references) //IL_029c: Unknown result type (might be due to invalid IL or missing references) //IL_02a8: Expected O, but got Unknown //IL_02aa: Unknown result type (might be due to invalid IL or missing references) //IL_02af: Unknown result type (might be due to invalid IL or missing references) //IL_02c6: Unknown result type (might be due to invalid IL or missing references) //IL_02d2: Expected O, but got Unknown TerminalNode val = new TerminalNode(); val.acceptAnything = false; val.buyItemIndex = -1; val.buyRerouteToMoon = -1; val.buyUnlockable = false; val.buyVehicleIndex = -1; val.clearPreviousText = true; val.creatureFileID = -1; val.creatureName = ""; val.displayPlanetInfo = -1; val.displayText = "You have requested to route to [coldMoon] without the Cold Moon Pass.\nYou must purchase a Cold Moon Pass first.\n\nThe Cold Moon Pass is a one time fee required to travel to 85-Rend, 7-Dine and 8-Titan. Once purchased, the crew will be able to freely travel to any of the cold moons for the duration of the current quota, free of additional expenses!\nCost: [totalCost].\n\nPlease CONFIRM or DENY.\n\n"; val.displayTexture = null; val.displayVideo = null; ((Object)val).hideFlags = (HideFlags)0; val.isConfirmationNode = true; val.itemCost = 610; val.loadImageSlowly = false; val.maxCharactersToType = 35; ((Object)val).name = "buyPass"; val.overrideOptions = true; val.persistentImage = false; val.playClip = null; val.playSyncedClip = -1; val.returnFromStorage = false; val.shipUnlockableID = -1; val.storyLogFileID = -1; val.terminalEvent = ""; val.terminalOptions = (CompatibleNoun[])(object)new CompatibleNoun[2] { new CompatibleNoun { noun = terminal.terminalNodes.allKeywords[3], result = passConfirm }, new CompatibleNoun { noun = terminal.terminalNodes.allKeywords[4], result = passDeny } }; buyPass = val; } } private const int passCost = 610; public const string passConfirmString = "[passConfirm]"; public static Terminal terminal; public static string terminalInput; public static string moon; public static string PassConfirmDisplay() { if (terminal.groupCredits < TerminalNodes.passConfirm.itemCost) { TerminalNodes.passConfirm.playSyncedClip = 1; return "Unable to purchase Cold Moon Pass.\n\n"; } HQRNetworkManager.Instance.BuyTier3PassServerRpc(); HQRNetworkManager.Instance.SyncTerminalCreditsServerRpc(terminal.groupCredits - TerminalNodes.passConfirm.itemCost); TerminalNodes.passConfirm.playSyncedClip = 0; return "Cold Moon Pass purchased.\n\n"; } } [HarmonyPatch(typeof(TimeOfDay))] internal class TimeOfDayPatches { [HarmonyPatch("CalculateLuckValue")] [HarmonyPostfix] private static void PostCalculateLuckValue(TimeOfDay __instance) { TimeOfDayHelper.luckPoints = 0; AutoParentToShip[] array = Object.FindObjectsByType<AutoParentToShip>((FindObjectsSortMode)0); AutoParentToShip[] array2 = array; foreach (AutoParentToShip val in array2) { if (val.unlockableID != -1 && StartOfRound.Instance.unlockablesList.unlockables[val.unlockableID].spawnPrefab) { if (StartOfRound.Instance.unlockablesList.unlockables[val.unlockableID].luckValue >= 0f) { TimeOfDayHelper.luckPoints++; } else { TimeOfDayHelper.luckPoints--; } } } } [HarmonyPatch("SetNewProfitQuota")] [HarmonyTranspiler] private static IEnumerable<CodeInstruction> TranspileSetNewProfitQuota(IEnumerable<CodeInstruction> codes) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Expected O, but got Unknown //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Expected O, but got Unknown //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Expected O, but got Unknown //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Expected O, but got Unknown //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Expected O, but got Unknown CodeMatcher val = new CodeMatcher(codes, (ILGenerator)null); val.MatchForward(false, (CodeMatch[])(object)new CodeMatch[1] { new CodeMatch((OpCode?)OpCodes.Stloc_1, (object)null, (string)null) }); if (val.IsInvalid) { HQRebalance.Logger.LogError((object)"Could not find the starting pattern. Aborting TranspileSetNewProfitQuota transpiler."); return codes; } int pos = val.Pos; CodeMatcher val2 = val.Clone(); val2.MatchForward(true, (CodeMatch[])(object)new CodeMatch[1] { new CodeMatch((OpCode?)OpCodes.Stloc_0, (object)null, (string)null) }); val2.MatchForward(true, (CodeMatch[])(object)new CodeMatch[1] { new CodeMatch((OpCode?)OpCodes.Call, (object)AccessTools.Method(typeof(Debug), "Log", new Type[1] { typeof(void) }, (Type[])null), (string)null) }); if (val2.IsInvalid) { HQRebalance.Logger.LogError((object)"Could not find the ending pattern. Aborting TranspileSetNewProfitQuota transpiler."); return codes; } int pos2 = val2.Pos; if (pos >= pos2) { HQRebalance.Logger.LogWarning((object)"Start and end patterns are the same or in the wrong order. Nothing to remove."); return codes; } val.RemoveInstructionsInRange(pos, pos2); val.InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[3] { new CodeInstruction(OpCodes.Ldloc_0, (object)null), new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(TimeOfDayHelper), "CalculateQuotaIncrease", (Type[])null, (Type[])null)), new CodeInstruction(OpCodes.Stloc_0, (object)null) }); return val.InstructionEnumeration(); } } internal class TimeOfDayHelper { public static int luckPoints; public static float CalculateQuotaIncrease(float unitaryRandom, float startInc