Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of BCMHQModule v1.5.0
Tomatobird.BCMHQModule.dll
Decompiled a day agousing System; using System.Collections; 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 BCMHQModule.MonoBehaviours; using BCMHQModule.Patches; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using BrutalCompanyMinus; using BrutalCompanyMinus.Minus; using BrutalCompanyMinus.Minus.Events; using BrutalCompanyMinus.Minus.Handlers; using BrutalCompanyMinus.Minus.MonoBehaviours; using HQoL.Network; using HarmonyLib; using Microsoft.CodeAnalysis; using TMPro; using UnityEngine; using UnityEngine.AI; using UnityEngine.Events; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: IgnoresAccessChecksTo("BrutalCompanyMinus")] [assembly: IgnoresAccessChecksTo("OreoM.HQoL.72")] [assembly: IgnoresAccessChecksTo("OreoM.HQoL.73")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("Tomatobird.BCMHQModule")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.5.0.0")] [assembly: AssemblyInformationalVersion("1.5.0+2dbcdf471fbd6fe298b6ee5922ce3d845da3245d")] [assembly: AssemblyProduct("BCMHQModule")] [assembly: AssemblyTitle("Tomatobird.BCMHQModule")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.5.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace BCMHQModule { [BepInPlugin("Tomatobird.BCMHQModule", "BCMHQModule", "1.5.0")] [BepInDependency("Drinkable.BrutalCompanyMinus", "0.10.12")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public class BCMHQModule : BaseUnityPlugin { internal enum Versions { v49, v50, v56, v72, v73, v81 } public static ConfigEntry<bool> internalNames = null; public static ConfigEntry<bool> sdcMode = null; internal static bool correctVersion = false; internal static string bcmVersionString = ""; internal static List<VersionDefinition> versionDefinitions = new List<VersionDefinition> { new VersionDefinition(Versions.v49, "0.10.12", new Type[4] { typeof(NoMasksPatcher), typeof(GetSafePositionPatcher), typeof(DelayedExecutionPatcher_v49), typeof(ShipLeaveOnQuit) }), new VersionDefinition(Versions.v50, "0.13.9", new Type[2] { typeof(DelayedExecutionPatcher), typeof(ShipLeaveOnQuit) }), new VersionDefinition(Versions.v56, "0.13.10", new Type[2] { typeof(DelayedExecutionPatcher), typeof(ShipLeaveOnQuit) }), new VersionDefinition(Versions.v72, "0.13.13", new Type[3] { typeof(DelayedExecutionPatcher), typeof(ShipLeaveOnQuit), typeof(UpdateEnemyHPPatcher) }), new VersionDefinition(Versions.v73, "0.13.14", new Type[3] { typeof(DelayedExecutionPatcher), typeof(ShipLeaveOnQuit), typeof(UpdateEnemyHPPatcher) }), new VersionDefinition(Versions.v81, "0.13.16", Array.Empty<Type>()) }; internal static bool isHQoLLoaded; public static BCMHQModule Instance { get; private set; } = null; internal static ManualLogSource Logger { get; private set; } = null; internal static Harmony? Harmony { get; set; } private void Awake() { Logger = ((BaseUnityPlugin)this).Logger; if ((Object)(object)Instance == (Object)null) { Instance = this; } internalNames = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "InternalEventNames", true, "Display the internal event names instead of the randomly selected event descriptions."); sdcMode = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "SdcMode", false, "Set difficulty to 100 for Single Day Clear runs."); isHQoLLoaded = Chainloader.PluginInfos.ContainsKey("OreoM.HQoL.72") || Chainloader.PluginInfos.ContainsKey("OreoM.HQoL.73"); Patch(); Logger.LogInfo((object)"Tomatobird.BCMHQModule v1.5.0 has loaded!"); } internal static void Patch() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown if (Harmony == null) { Harmony = new Harmony("Tomatobird.BCMHQModule"); } foreach (PluginInfo value in Chainloader.PluginInfos.Values) { if (value.Metadata.GUID != "Drinkable.BrutalCompanyMinus") { continue; } Version version = value.Metadata.Version; bcmVersionString = version.ToString(); foreach (VersionDefinition versionDefinition in versionDefinitions) { if (bcmVersionString != versionDefinition.bcmVersion) { continue; } PatchType(versionDefinition.types); if (versionDefinition.version != Versions.v49) { PatchType(typeof(LockConfigurationPatcher)); if (isHQoLLoaded) { PatchType(typeof(ValueSynchronizer)); } } correctVersion = true; break; } if (!correctVersion) { Logger.LogWarning((object)$"Version {version} of BCM loaded was NOT contained in the internal version list. Make sure you're using one of the versions listed below!"); foreach (VersionDefinition versionDefinition2 in versionDefinitions) { Logger.LogWarning((object)$"{versionDefinition2.version}: {versionDefinition2.bcmVersion}"); } Logger.LogWarning((object)"Applying generic patches anyway assuming this is a newer version. Things may break."); } if (bcmVersionString != versionDefinitions[0].bcmVersion) { PatchType(typeof(MenuManagerPatcher)); } PatchType(new Type[2] { typeof(EndOfGamePatcher), typeof(QuotaRackupPatcher) }); break; } Logger.LogDebug((object)"Finished patching!"); } internal static void PatchType(Type[] typeArray) { foreach (Type type in typeArray) { PatchType(type); } } internal static void PatchType(Type type) { Logger.LogDebug((object)("Patching " + type.Name)); Harmony? harmony = Harmony; if (harmony != null) { harmony.PatchAll(type); } } internal static void EndOfGameBackupPatch() { Logger.LogWarning((object)"Failed to patch EndOfGamePatcher! Patching EndOfGamePatcherBackup as backup!"); PatchType(new Type[1] { typeof(EndOfGamePatcherBackup) }); } } internal class VersionDefinition(BCMHQModule.Versions version, string bcmVersion, Type[] types) { public BCMHQModule.Versions version = version; public string bcmVersion = bcmVersion; public Type[] types = types; } public static class MyPluginInfo { public const string PLUGIN_GUID = "Tomatobird.BCMHQModule"; public const string PLUGIN_NAME = "BCMHQModule"; public const string PLUGIN_VERSION = "1.5.0"; } } namespace BCMHQModule.Patches { [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class DelayedExecutionPatcher { [HarmonyTranspiler] private static IEnumerable<CodeInstruction> DelayedExcecutionTranspiler(IEnumerable<CodeInstruction> instructions) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0045: 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_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Expected O, but got Unknown //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: 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_011a: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Expected O, but got Unknown //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Expected O, but got Unknown //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Expected O, but got Unknown //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Expected O, but got Unknown return new CodeMatcher(instructions, (ILGenerator)null).MatchForward(false, (CodeMatch[])(object)new CodeMatch[1] { new CodeMatch((OpCode?)OpCodes.Newobj, (object)AccessTools.Constructor(typeof(WaitForSeconds), new Type[1] { typeof(float) }, false), (string)null) }).ThrowIfNotMatch("Could not match for WaitForSeconds(float) in DelayedExcecution", Array.Empty<CodeMatch>()).MatchForward(false, (CodeMatch[])(object)new CodeMatch[1] { new CodeMatch((OpCode?)OpCodes.Call, (object)AccessTools.PropertyGetter(typeof(Net), "Instance"), (string)null) }) .ThrowIfNotMatch("Could not match for BrutalCompanyMinus.Net.Instance in DelayedExcecution", Array.Empty<CodeMatch>()) .Insert((CodeInstruction[])(object)new CodeInstruction[8] { new CodeInstruction(OpCodes.Call, (object)AccessTools.PropertyGetter(typeof(StartOfRound), "Instance")), new CodeInstruction(OpCodes.Ldfld, (object)AccessTools.Field(typeof(StartOfRound), "randomMapSeed")), new CodeInstruction(OpCodes.Ldc_I4_2, (object)null), new CodeInstruction(OpCodes.Add, (object)null), new CodeInstruction(OpCodes.Call, (object)AccessTools.PropertyGetter(typeof(Net), "Instance")), new CodeInstruction(OpCodes.Ldfld, (object)AccessTools.Field(typeof(Net), "_seed")), new CodeInstruction(OpCodes.Add, (object)null), new CodeInstruction(OpCodes.Stsfld, (object)AccessTools.Field(typeof(Spawn), "randomSeedValue")) }) .InstructionEnumeration(); } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class DelayedExecutionPatcher_v49 { [HarmonyTranspiler] private static IEnumerable<CodeInstruction> DelayedExcecutionTranspiler(IEnumerable<CodeInstruction> instructions) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0045: 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_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Expected O, but got Unknown //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: 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_011a: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Expected O, but got Unknown return new CodeMatcher(instructions, (ILGenerator)null).MatchForward(false, (CodeMatch[])(object)new CodeMatch[1] { new CodeMatch((OpCode?)OpCodes.Newobj, (object)AccessTools.Constructor(typeof(WaitForSeconds), new Type[1] { typeof(float) }, false), (string)null) }).ThrowIfNotMatch("Could not match for WaitForSeconds(float) in DelayedExcecution", Array.Empty<CodeMatch>()).MatchForward(false, (CodeMatch[])(object)new CodeMatch[1] { new CodeMatch((OpCode?)OpCodes.Call, (object)AccessTools.PropertyGetter(typeof(Net), "Instance"), (string)null) }) .ThrowIfNotMatch("Could not match for BrutalCompanyMinus.Net.Instance in DelayedExcecution", Array.Empty<CodeMatch>()) .Insert((CodeInstruction[])(object)new CodeInstruction[5] { new CodeInstruction(OpCodes.Call, (object)AccessTools.PropertyGetter(typeof(StartOfRound), "Instance")), new CodeInstruction(OpCodes.Ldfld, (object)AccessTools.Field(typeof(StartOfRound), "randomMapSeed")), new CodeInstruction(OpCodes.Ldc_I4_2, (object)null), new CodeInstruction(OpCodes.Add, (object)null), new CodeInstruction(OpCodes.Stsfld, (object)AccessTools.Field(typeof(Spawn), "randomSeedValue")) }) .InstructionEnumeration(); } } [HarmonyPatch(typeof(StartOfRound))] public class EndOfGamePatcher { [HarmonyPatch(/*Could not decode attribute arguments.*/)] [HarmonyTranspiler] private static IEnumerable<CodeInstruction> EndOfGameTranspiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator) { //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Expected O, but got Unknown //IL_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Expected O, but got Unknown //IL_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Expected O, but got Unknown //IL_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Expected O, but got Unknown //IL_01f4: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: Expected O, but got Unknown //IL_0208: Unknown result type (might be due to invalid IL or missing references) //IL_020e: Expected O, but got Unknown //IL_0244: Unknown result type (might be due to invalid IL or missing references) //IL_024a: Expected O, but got Unknown //IL_0258: Unknown result type (might be due to invalid IL or missing references) //IL_025e: Expected O, but got Unknown //IL_026c: Unknown result type (might be due to invalid IL or missing references) //IL_0272: Expected O, but got Unknown //IL_0280: Unknown result type (might be due to invalid IL or missing references) //IL_0286: Expected O, but got Unknown //IL_0294: Unknown result type (might be due to invalid IL or missing references) //IL_029a: Expected O, but got Unknown //IL_02a8: Unknown result type (might be due to invalid IL or missing references) //IL_02ae: Expected O, but got Unknown //IL_02dd: Unknown result type (might be due to invalid IL or missing references) //IL_02e3: Expected O, but got Unknown //IL_02f7: Unknown result type (might be due to invalid IL or missing references) //IL_02fd: Expected O, but got Unknown //IL_0311: Unknown result type (might be due to invalid IL or missing references) //IL_0317: Expected O, but got Unknown //IL_0330: Unknown result type (might be due to invalid IL or missing references) //IL_0336: Expected O, but got Unknown //IL_034a: Unknown result type (might be due to invalid IL or missing references) //IL_0350: Expected O, but got Unknown //IL_0364: Unknown result type (might be due to invalid IL or missing references) //IL_036a: Expected O, but got Unknown //IL_037d: Unknown result type (might be due to invalid IL or missing references) //IL_0383: Expected O, but got Unknown //IL_039c: Unknown result type (might be due to invalid IL or missing references) //IL_03a2: Expected O, but got Unknown FieldInfo fieldInfo = null; foreach (CodeInstruction instruction in instructions) { FieldInfo obj = instruction.operand as FieldInfo; if ((object)obj != null && obj.Name?.Contains("<playersDead>") == true) { FieldInfo obj2 = instruction.operand as FieldInfo; if ((object)obj2 != null && obj2.ReflectedType?.Name.Contains("<EndOfGame>") == true) { fieldInfo = instruction.operand as FieldInfo; break; } } } if (fieldInfo == null) { BCMHQModule.Logger.LogWarning((object)"Could not find playersDead in EndOfGame."); BCMHQModule.EndOfGameBackupPatch(); return instructions; } IEnumerable<CodeInstruction> result = instructions; FieldInfo fieldInfo2 = AccessTools.Field(typeof(StartOfRound), "gameStats"); FieldInfo fieldInfo3 = AccessTools.Field(typeof(EndOfGameStats), "daysSpent"); FieldInfo fieldInfo4 = AccessTools.Field(typeof(StartOfRound), "currentLevel"); FieldInfo fieldInfo5 = AccessTools.Field(typeof(SelectableLevel), "planetHasTime"); MethodInfo methodInfo = AccessTools.PropertyGetter(typeof(TimeOfDay), "Instance"); FieldInfo fieldInfo6 = AccessTools.Field(typeof(TimeOfDay), "daysUntilDeadline"); try { Label label = default(Label); Label label2 = default(Label); result = new CodeMatcher(instructions, generator).MatchForward(true, (CodeMatch[])(object)new CodeMatch[6] { new CodeMatch((OpCode?)OpCodes.Ldfld, (object)fieldInfo2, (string)null), new CodeMatch((OpCode?)OpCodes.Dup, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Ldfld, (object)fieldInfo3, (string)null), new CodeMatch((OpCode?)OpCodes.Ldc_I4_1, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Add, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Stfld, (object)fieldInfo3, (string)null) }).ThrowIfNotMatch("Couldnt match codes.", Array.Empty<CodeMatch>()).Advance(1) .CreateLabel(ref label) .MatchBack(false, (CodeMatch[])(object)new CodeMatch[6] { new CodeMatch((OpCode?)OpCodes.Ldfld, (object)fieldInfo2, (string)null), new CodeMatch((OpCode?)OpCodes.Dup, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Ldfld, (object)fieldInfo3, (string)null), new CodeMatch((OpCode?)OpCodes.Ldc_I4_1, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Add, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Stfld, (object)fieldInfo3, (string)null) }) .ThrowIfNotMatch("Failed to MatchBack.", Array.Empty<CodeMatch>()) .Advance(-1) .CreateLabel(ref label2) .InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1] { new CodeInstruction(OpCodes.Ldloc_1, (object)null) }) .InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1] { new CodeInstruction(OpCodes.Ldfld, (object)fieldInfo4) }) .InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1] { new CodeInstruction(OpCodes.Ldfld, (object)fieldInfo5) }) .InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1] { new CodeInstruction(OpCodes.Brtrue_S, (object)label2) }) .InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1] { new CodeInstruction(OpCodes.Call, (object)methodInfo) }) .InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1] { new CodeInstruction(OpCodes.Ldfld, (object)fieldInfo6) }) .InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1] { new CodeInstruction(OpCodes.Ldc_I4_1, (object)null) }) .InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1] { new CodeInstruction(OpCodes.Bge_S, (object)label) }) .InstructionEnumeration(); } catch (Exception arg) { BCMHQModule.Logger.LogWarning((object)$"Could not set new codeinstructions to EndOfGame. Exception {arg}"); BCMHQModule.EndOfGameBackupPatch(); } return result; } } [HarmonyPatch(typeof(StartOfRound))] public class EndOfGamePatcherBackup { [HarmonyPatch("EndOfGame")] [HarmonyPrefix] private static void EndOfGamePrefix(StartOfRound __instance) { if (!__instance.currentLevel.planetHasTime && TimeOfDay.Instance.daysUntilDeadline >= 1) { EndOfGameStats gameStats = __instance.gameStats; gameStats.daysSpent--; } } } [HarmonyPatch("BrutalCompanyMinus.Minus.Functions, BrutalCompanyMinus, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null", "GetSafePosition")] public class GetSafePositionPatcher { [HarmonyTranspiler] public static IEnumerable<CodeInstruction> GetSafePositionTranspiler(IEnumerable<CodeInstruction> instructions) { //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Expected O, but got Unknown BCMHQModule.Logger.LogDebug((object)"Transpiler called for GetSafePosition"); List<CodeInstruction> list = new List<CodeInstruction>(instructions); MethodInfo methodInfo = AccessTools.Method(typeof(RoundManager), "GetRandomPositionInRadius", new Type[4] { typeof(Vector3), typeof(float), typeof(float), typeof(Random) }, (Type[])null); MethodInfo methodInfo2 = AccessTools.Method(typeof(GetSafePositionPatcher), "GetSafePosition_Replacement", (Type[])null, (Type[])null); if (methodInfo == null || methodInfo2 == null) { BCMHQModule.Logger.LogDebug((object)"OriginalMethod or ReplacementMethod were null."); return list; } for (int i = 0; i < list.Count; i++) { if (CodeInstructionExtensions.Calls(list[i], methodInfo)) { BCMHQModule.Logger.LogDebug((object)string.Format("Replacing call at index {0} with {1}.", i, "GetRandomNavMeshPositionInRadius")); list[i] = new CodeInstruction(OpCodes.Call, (object)methodInfo2); } } return list; } public static Vector3 GetSafePosition_Replacement(Vector3 vector, float minRadius, float radius, Random random) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: 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_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) return RoundManager.Instance.GetRandomNavMeshPositionInRadius(vector, radius, default(NavMeshHit)); } } [HarmonyPatch(typeof(Configuration))] public class LockConfigurationPatcher { [HarmonyPatch("CreateConfig")] [HarmonyPostfix] public static void PostfixCreateConfig() { //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_019a: 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_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_01c1: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_01de: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: 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_0343: Unknown result type (might be due to invalid IL or missing references) //IL_034d: Unknown result type (might be due to invalid IL or missing references) //IL_0352: Unknown result type (might be due to invalid IL or missing references) //IL_035c: Unknown result type (might be due to invalid IL or missing references) //IL_0361: Unknown result type (might be due to invalid IL or missing references) //IL_036b: Unknown result type (might be due to invalid IL or missing references) //IL_0370: Unknown result type (might be due to invalid IL or missing references) //IL_037a: Unknown result type (might be due to invalid IL or missing references) //IL_037f: Unknown result type (might be due to invalid IL or missing references) //IL_0389: Unknown result type (might be due to invalid IL or missing references) //IL_038e: Unknown result type (might be due to invalid IL or missing references) //IL_0398: Unknown result type (might be due to invalid IL or missing references) //IL_039d: Unknown result type (might be due to invalid IL or missing references) //IL_03a7: Unknown result type (might be due to invalid IL or missing references) //IL_03ac: Unknown result type (might be due to invalid IL or missing references) //IL_03b6: 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_04db: Unknown result type (might be due to invalid IL or missing references) //IL_04e0: Unknown result type (might be due to invalid IL or missing references) //IL_04f0: Unknown result type (might be due to invalid IL or missing references) //IL_04f5: Unknown result type (might be due to invalid IL or missing references) //IL_0505: Unknown result type (might be due to invalid IL or missing references) //IL_050a: Unknown result type (might be due to invalid IL or missing references) //IL_051a: Unknown result type (might be due to invalid IL or missing references) //IL_051f: Unknown result type (might be due to invalid IL or missing references) //IL_052f: Unknown result type (might be due to invalid IL or missing references) //IL_0534: Unknown result type (might be due to invalid IL or missing references) //IL_0544: Unknown result type (might be due to invalid IL or missing references) //IL_0549: Unknown result type (might be due to invalid IL or missing references) //IL_0559: Unknown result type (might be due to invalid IL or missing references) //IL_055e: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Expected O, but got Unknown //IL_0588: Unknown result type (might be due to invalid IL or missing references) //IL_058d: Unknown result type (might be due to invalid IL or missing references) //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_05b4: Unknown result type (might be due to invalid IL or missing references) //IL_05b9: Unknown result type (might be due to invalid IL or missing references) //IL_05ca: Unknown result type (might be due to invalid IL or missing references) //IL_05cf: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_076a: Unknown result type (might be due to invalid IL or missing references) //IL_076f: Unknown result type (might be due to invalid IL or missing references) //IL_0771: Unknown result type (might be due to invalid IL or missing references) //IL_0773: Unknown result type (might be due to invalid IL or missing references) //IL_0775: Unknown result type (might be due to invalid IL or missing references) //IL_0794: Expected I4, but got Unknown for (int i = 0; i < EventManager.events.Count; i++) { MEvent val = EventManager.events[i]; if (val != null) { try { Type type = ((object)val).GetType(); MEvent val2 = (MEvent)Activator.CreateInstance(((object)val).GetType()); val2.Initalize(); type.GetField("Instance", BindingFlags.Static | BindingFlags.Public)?.SetValue(null, val); bool executed = val.Executed; val.Weight = val2.Weight; val.Enabled = val2.Enabled; val.ColorHex = val2.ColorHex; val.Type = val2.Type; val.Descriptions = val2.Descriptions.ToList(); val.EventsToRemove = val2.EventsToRemove.ToList(); val.EventsToSpawnWith = val2.EventsToSpawnWith.ToList(); val.ScaleList = new Dictionary<ScaleType, Scale>(val2.ScaleList); val.monsterEvents = val2.monsterEvents.ToList(); val.scrapTransmutationEvent = val2.scrapTransmutationEvent; val.Executed = executed; } catch (Exception ex) { Debug.LogError((object)("Failed to force defaults on event " + val.Name() + ": " + ex.Message)); } } } Configuration.useCustomWeights.Value = false; Configuration.eventsToSpawn = Helper.getScale("2, 0.03, 2.0, 5.0"); Configuration.weightsForExtraEvents = Helper.ParseValuesFromString("40, 39, 15, 5, 1"); Configuration.showEventsInChat.Value = false; Configuration.eventTypeScales = (Scale[])(object)new Scale[6] { Helper.getScale("5, 0.25, 5, 30"), Helper.getScale("40, -0.15, 25, 40"), Helper.getScale("10, -0.05, 5, 10"), Helper.getScale("23, -0.1, 13, 23"), Helper.getScale("3, 0.14, 3, 17"), Helper.getScale("15, -0.05, 10, 15") }; Configuration.difficultyTransitions = Helper.GetDifficultyTransitionsFromString("Easy,00FF00,0|Medium,008000,15|Hard,FF0000,30|Very Hard,800000,50|Insane,140000,75"); Configuration.ignoreMaxCap.Value = false; Configuration.difficultyMaxCap.Value = 100f; Configuration.scaleByDaysPassed.Value = true; Configuration.daysPassedDifficultyMultiplier.Value = 1f; Configuration.daysPassedDifficultyCap.Value = 60f; Configuration.scaleByScrapInShip.Value = true; Configuration.scrapInShipDifficultyMultiplier.Value = 0.0025f; Configuration.scrapInShipDifficultyCap.Value = 30f; Configuration.scaleByQuota.Value = false; Configuration.quotaDifficultyMultiplier.Value = 0.005f; Configuration.quotaDifficultyCap.Value = 100f; Configuration.scaleByMoonGrade.Value = true; Configuration.gradeAdditives = Helper.GetMoonRiskFromString("D,-8|C,-8|B,-4|A,5|S,10|S+,15|S++,20|S+++,30|Other,10"); Configuration.scaleByWeather.Value = false; Configuration.weatherAdditives = new Dictionary<LevelWeatherType, float> { { (LevelWeatherType)(-1), 0f }, { (LevelWeatherType)1, 2f }, { (LevelWeatherType)0, 2f }, { (LevelWeatherType)4, 4f }, { (LevelWeatherType)3, 4f }, { (LevelWeatherType)2, 7f }, { (LevelWeatherType)5, 7f } }; Configuration.spawnChanceMultiplierScaling = Helper.getScale("1.0, 0.017, 1.0, 2.0"); Configuration.insideSpawnChanceAdditive = Helper.getScale("0.0, 0.0, 0.0, 0.0"); Configuration.outsideSpawnChanceAdditive = Helper.getScale("0.0, 0.0, 0.0, 0.0"); Configuration.spawnCapMultiplier = Helper.getScale("1.0, 0.017, 1.0, 2.0"); Configuration.insideEnemyMaxPowerCountScaling = Helper.getScale("0,0,0,0"); Configuration.outsideEnemyPowerCountScaling = Helper.getScale("0,0,0,0"); Configuration.enemyBonusHpScaling = Helper.getScale("0,0,0,0"); Configuration.scrapValueMultiplier = Helper.getScale("1.0, 0.003, 1.0, 1.3"); Configuration.scrapAmountMultiplier = Helper.getScale("1.0, 0.003, 1.0, 1.3"); Configuration.goodEventIncrementMultiplier.Value = 1f; Configuration.badEventIncrementMultiplier.Value = 1f; Configuration.nutSlayerLives.Value = 5; Configuration.nutSlayerHp.Value = 6; Configuration.nutSlayerMovementSpeed.Value = 9.5f; Configuration.nutSlayerImmortal.Value = true; Assets.grabbableTurret.maxValue = 75; Assets.grabbableTurret.minValue = 50; Assets.grabbableLandmine.maxValue = 150; Assets.grabbableLandmine.minValue = 100; Configuration.slayerShotgunMinValue.Value = 200; Configuration.slayerShotgunMaxValue.Value = 300; Configuration.useWeatherMultipliers.Value = true; Configuration.randomizeWeatherMultipliers.Value = false; Configuration.enableTerminalText.Value = true; Configuration.weatherRandomRandomMinInclusive.Value = 0.9f; Configuration.weatherRandomRandomMaxInclusive.Value = 1.2f; Configuration.enableQuotaChanges.Value = false; Configuration.enableAllEnemies.Value = false; Configuration.enableAllAllEnemies.Value = false; Configuration.noneMultiplier = createNewWeatherSettings((LevelWeatherType)(-1), 1f, 1f); Configuration.dustCloudMultiplier = createNewWeatherSettings((LevelWeatherType)0, 1.05f, 1f); Configuration.rainyMultiplier = createNewWeatherSettings((LevelWeatherType)1, 1.05f, 1f); Configuration.stormyMultiplier = createNewWeatherSettings((LevelWeatherType)2, 1.35f, 1.2f); Configuration.foggyMultiplier = createNewWeatherSettings((LevelWeatherType)3, 1.15f, 1.1f); Configuration.floodedMultiplier = createNewWeatherSettings((LevelWeatherType)4, 1.25f, 1.15f); Configuration.eclipsedMultiplier = createNewWeatherSettings((LevelWeatherType)5, 1.35f, 1.2f); foreach (KeyValuePair<int, LevelProperties> levelProperty in Configuration.levelProperties) { levelProperty.Value.minScrapAmount = Helper.getScale("1,0,1,1"); levelProperty.Value.maxScrapAmount = Helper.getScale("1,0,1,1"); levelProperty.Value.minScrapValue = Helper.getScale("1,0,1,1"); levelProperty.Value.maxScrapValue = Helper.getScale("1,0,1,1"); } FacilityGhost.actionCurrentTime = 15f; FacilityGhost.ghostCrazyActionInterval = 0.1f; FacilityGhost.ghostCrazyPeriod = 5f; FacilityGhost.crazyGhostChance = 0.1f; FacilityGhost.DoNothingWeight = 25; FacilityGhost.OpenCloseBigDoorsWeight = 20; FacilityGhost.MessWithLightsWeight = 16; FacilityGhost.MessWithBreakerWeight = 4; FacilityGhost.disableTurretsWeight = 5; FacilityGhost.disableLandminesWeight = 5; FacilityGhost.disableSpikeTrapsWeight = 5; FacilityGhost.turretRageWeight = 5; FacilityGhost.OpenCloseDoorsWeight = 9; FacilityGhost.lockUnlockDoorsWeight = 3; FacilityGhost.chanceToOpenCloseDoor = 0.3f; FacilityGhost.rageTurretsChance = 0.3f; RealityShift.normalScrapWeight = 85; RealityShift.grabbableLandmineWeight = 15; RealityShift.transmuteChance = 0.5f; RealityShift.enemyTeleportChance = 0.1f; DDay.bombardmentInterval = 100f; DDay.bombardmentTime = 15f; DDay.fireInterval = 1f; DDay.fireAmount = 8; DDay.displayWarning = true; DDay.volume = 0.3f; ArtilleryShell.speed = 100f; EventManager.disabledEvents.Clear(); EventManager.allVeryBad.Clear(); EventManager.allBad.Clear(); EventManager.allNeutral.Clear(); EventManager.allGood.Clear(); EventManager.allVeryGood.Clear(); EventManager.allRemove.Clear(); List<MEvent> list = new List<MEvent>(); foreach (MEvent @event in EventManager.events) { if (!@event.Enabled) { EventManager.disabledEvents.Add(@event); continue; } list.Add(@event); EventType type2 = @event.Type; EventType val3 = type2; switch ((int)val3) { case 0: EventManager.allVeryBad.Add(@event); break; case 1: EventManager.allBad.Add(@event); break; case 2: EventManager.allNeutral.Add(@event); break; case 3: EventManager.allGood.Add(@event); break; case 4: EventManager.allVeryGood.Add(@event); break; case 5: EventManager.allRemove.Add(@event); break; } } EventManager.events = list; EventManager.UpdateEventTypeCounts(); EventManager.UpdateAllEventWeights(); static Weather createNewWeatherSettings(LevelWeatherType levelWeatherType, float value, float amount) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0009: 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) return new Weather(levelWeatherType, value, amount); } } } [HarmonyPatch] public class MenuManagerPatcher { private static TextMeshProUGUI? infoDisplay; [HarmonyPatch(typeof(MenuManager), "Start")] [HarmonyPostfix] public static void Start_Postfix(MenuManager __instance) { //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Expected O, but got Unknown //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)__instance.menuButtons == (Object)null || __instance.isInitScene) { return; } try { GameObject val = GameObject.Find("Canvas/MenuContainer/SettingsPanel/ControlsOptions/InvertYAxis"); if ((Object)(object)val == (Object)null) { BCMHQModule.Logger.LogWarning((object)"Failed to locate InvertYAxis."); return; } GameObject val2 = new GameObject("BCMHQModule_ButtonContainer", new Type[1] { typeof(RectTransform) }); val2.transform.SetParent(__instance.menuButtons.transform, false); RectTransform component = val2.GetComponent<RectTransform>(); component.anchoredPosition = new Vector2(-70f, -120f); component.sizeDelta = new Vector2(360f, 60f); ((Transform)component).localScale = Vector3.one; VerticalLayoutGroup val3 = val2.AddComponent<VerticalLayoutGroup>(); ((LayoutGroup)val3).childAlignment = (TextAnchor)1; ((HorizontalOrVerticalLayoutGroup)val3).spacing = 10f; ((HorizontalOrVerticalLayoutGroup)val3).childControlHeight = false; ((HorizontalOrVerticalLayoutGroup)val3).childControlWidth = false; CreateSimulatedToggle(val, val2.transform, "Internal Event Names", 0); CreateSimulatedToggle(val, val2.transform, "SDC Mode", 1); BCMHQModule.Logger.LogInfo((object)"Custom settings built and rendered successfully."); } catch (Exception ex) { BCMHQModule.Logger.LogError((object)("Failed to construct UI stack: " + ex.Message)); } } private static void CreateSimulatedToggle(GameObject template, Transform parent, string titleText, int id) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_020e: Unknown result type (might be due to invalid IL or missing references) //IL_0225: Unknown result type (might be due to invalid IL or missing references) //IL_0232: Unknown result type (might be due to invalid IL or missing references) //IL_02d9: Unknown result type (might be due to invalid IL or missing references) //IL_02f0: 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_031e: Unknown result type (might be due to invalid IL or missing references) //IL_0335: Unknown result type (might be due to invalid IL or missing references) //IL_0342: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject($"BCMHQModule_Row_{id}", new Type[1] { typeof(RectTransform) }); val.transform.SetParent(parent, false); RectTransform component = val.GetComponent<RectTransform>(); component.sizeDelta = new Vector2(100f, 15f); ((Transform)component).localScale = Vector3.one; Image component2 = ((Component)template.transform.Find("Background")).GetComponent<Image>(); Sprite val2 = ((component2 != null) ? component2.sprite : null); if ((Object)(object)val2 == (Object)null) { BCMHQModule.Logger.LogWarning((object)"Block was null!"); } Sprite val3 = template.GetComponent<SettingsOption>()?.enabledImage; if ((Object)(object)val3 == (Object)null) { BCMHQModule.Logger.LogWarning((object)"Checkmark was null!"); } GameObject val4 = Object.Instantiate<GameObject>(template); ((Object)val4).name = $"BCMHQModule_ToggleButton_{id}"; val4.transform.SetParent(val.transform, false); Button component3 = val4.GetComponent<Button>(); if ((Object)(object)component3 == (Object)null) { BCMHQModule.Logger.LogWarning((object)"buttonComp was null!"); } else { ((UnityEventBase)component3.onClick).RemoveAllListeners(); } MonoBehaviour[] components = val4.GetComponents<MonoBehaviour>(); foreach (MonoBehaviour val5 in components) { if ((!(val5 is Button) && !(val5 is Image)) || 1 == 0) { Object.Destroy((Object)(object)val5); } } RectTransform component4 = val4.GetComponent<RectTransform>(); if ((Object)(object)component4 == (Object)null) { BCMHQModule.Logger.LogWarning((object)"buttonRect was null!"); } else { component4.anchorMin = new Vector2(1f, 1f); component4.anchorMax = new Vector2(1f, 1f); component4.pivot = new Vector2(1f, 0.5f); component4.anchoredPosition = new Vector2(0f, -4f); component4.sizeDelta = new Vector2(40f, 10f); ((Transform)component4).localScale = Vector3.one; } object obj = val4.transform.Find("Text (2)"); if (obj == null) { TextMeshProUGUI componentInChildren = ((Component)val4.transform).GetComponentInChildren<TextMeshProUGUI>(); obj = ((componentInChildren != null) ? ((TMP_Text)componentInChildren).transform : null); } Transform val6 = (Transform)obj; if ((Object)(object)val6 == (Object)null) { BCMHQModule.Logger.LogWarning((object)"labelTransform was null!"); } else { val6.SetParent(val.transform, false); RectTransform component5 = ((Component)val6).GetComponent<RectTransform>(); if ((Object)(object)component5 == (Object)null) { BCMHQModule.Logger.LogWarning((object)"textRect was null!"); } else { component5.anchorMin = new Vector2(0f, 0.5f); component5.anchorMax = new Vector2(0f, 0.5f); component5.pivot = new Vector2(0f, 0.5f); component5.anchoredPosition = new Vector2(10f, 0f); component5.sizeDelta = new Vector2(320f, 10f); ((Transform)component5).localScale = Vector3.one; } TextMeshProUGUI component6 = ((Component)val6).GetComponent<TextMeshProUGUI>(); if ((Object)(object)component6 == (Object)null) { BCMHQModule.Logger.LogWarning((object)"textComp was null!"); } else { ((TMP_Text)component6).text = titleText; ((TMP_Text)component6).alignment = (TextAlignmentOptions)4097; ((TMP_Text)component6).overflowMode = (TextOverflowModes)0; ((TMP_Text)component6).enableWordWrapping = false; } } MenuToggleController menuToggleController = val4.AddComponent<MenuToggleController>(); menuToggleController.settingId = id; menuToggleController.baseTitle = titleText; menuToggleController.checkmarkSprite = val3; menuToggleController.buttonSprite = val2; } [HarmonyPatch(typeof(Manager), "ComputeDifficultyValues")] [HarmonyPostfix] [HarmonyPriority(0)] public static void ComputeDifficultyValues_Postfix() { if (BCMHQModule.sdcMode.Value) { Manager.difficulty = 100f; } } [HarmonyPatch(typeof(EventManager), "UpdateEventDescriptions")] [HarmonyPostfix] public static void UpdateEventDescriptions_Postfix(ref List<MEvent> events) { if (!BCMHQModule.internalNames.Value || !Configuration.displayEvents.Value) { return; } EventManager.currentEventDescriptions.Clear(); foreach (MEvent @event in events) { if (@event.Name() == "ChineseProduce") { EventManager.currentEventDescriptions.Add("<color=" + @event.ColorHex + ">CheapProduce</color>"); continue; } EventManager.currentEventDescriptions.Add("<color=" + @event.ColorHex + ">" + @event.Name() + "</color>"); } } [HarmonyPatch(typeof(TimeOfDay), "Start")] [HarmonyPostfix] private static void Start_Postfix() { //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Expected O, but got Unknown //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: 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_0100: Unknown result type (might be due to invalid IL or missing references) //IL_015f: 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_01c5: Unknown result type (might be due to invalid IL or missing references) //IL_01dc: Unknown result type (might be due to invalid IL or missing references) //IL_01e9: Unknown result type (might be due to invalid IL or missing references) //IL_01f6: Unknown result type (might be due to invalid IL or missing references) if (!BCMHQModule.sdcMode.Value && BCMHQModule.correctVersion) { return; } if ((Object)(object)infoDisplay == (Object)null) { BCMHQModule.Logger.LogInfo((object)"infoDisplay is null. Creating a new infodisplay."); GameObject val = new GameObject("BCMHQModule_infoDisplay"); val.transform.parent = ((TMP_Text)HUDManager.Instance.weightCounter).transform.parent; TextMeshProUGUI weightCounter = HUDManager.Instance.weightCounter; infoDisplay = val.AddComponent<TextMeshProUGUI>(); ((TMP_Text)infoDisplay).textStyle = ((TMP_Text)weightCounter).textStyle; ((Component)infoDisplay).tag = ((Component)weightCounter).tag; ((TMP_Text)infoDisplay).alignment = ((TMP_Text)weightCounter).alignment; ((Graphic)infoDisplay).color = ((Graphic)weightCounter).color; ((TMP_Text)infoDisplay).font = ((TMP_Text)weightCounter).font; ((TMP_Text)infoDisplay).fontSize = ((TMP_Text)weightCounter).fontSize; ((TMP_Text)infoDisplay).fontStyle = ((TMP_Text)weightCounter).fontStyle; ((TMP_Text)infoDisplay).fontWeight = ((TMP_Text)weightCounter).fontWeight; ((TMP_Text)infoDisplay).enableAutoSizing = ((TMP_Text)weightCounter).enableAutoSizing; ((TMP_Text)infoDisplay).fontSizeMin = ((TMP_Text)weightCounter).fontSizeMin; ((TMP_Text)infoDisplay).fontSizeMax = ((TMP_Text)weightCounter).fontSizeMax; ((TMP_Text)infoDisplay).isOverlay = ((TMP_Text)weightCounter).isOverlay; ((TMP_Text)infoDisplay).transform.position = ((TMP_Text)weightCounter).transform.position; ((TMP_Text)infoDisplay).text = "text"; RectTransform component = ((Component)infoDisplay).GetComponent<RectTransform>(); if ((Object)(object)component == (Object)null) { BCMHQModule.Logger.LogError((object)"Transform not found"); return; } component.offsetMin = ((Component)weightCounter).GetComponent<RectTransform>().offsetMin; component.offsetMax = ((Component)weightCounter).GetComponent<RectTransform>().offsetMax; component.anchoredPosition = new Vector2(67f, -32f); ((Transform)component).localScale = Vector3.one; ((Transform)component).localRotation = Quaternion.identity; } if (!((Object)(object)infoDisplay == (Object)null)) { if (!BCMHQModule.correctVersion) { ((TMP_Text)infoDisplay).text = "Invalid Pack: BCM v" + BCMHQModule.bcmVersionString; } else { ((TMP_Text)infoDisplay).text = "SDC Mode"; } } } } [HarmonyPatch] public class NoMasksPatcher { [HarmonyPatch("BrutalCompanyMinus.Minus.Events.NoMasks, BrutalCompanyMinus, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null", "Execute")] [HarmonyPrefix] public static void ExecutePatcher() { BCMHQModule.Logger.LogDebug((object)"Patching NoMasks event to keep a reference to the Comedy and Tragedy mask objects."); Type typeFromHandle = typeof(NoMasks); int num = RoundManager.Instance.currentLevel.spawnableScrap.FindIndex((SpawnableItemWithRarity s) => ((Object)s.spawnableItem).name == Assets.ItemNameList[(ItemName)35]); if (num != -1) { FieldInfo field = typeFromHandle.GetField("comedyReference"); field.SetValue(null, RoundManager.Instance.currentLevel.spawnableScrap[num]); } num = RoundManager.Instance.currentLevel.spawnableScrap.FindIndex((SpawnableItemWithRarity s) => ((Object)s.spawnableItem).name == Assets.ItemNameList[(ItemName)36]); if (num != -1) { FieldInfo field2 = typeFromHandle.GetField("tragedyRefernece"); field2.SetValue(null, RoundManager.Instance.currentLevel.spawnableScrap[num]); } } } [HarmonyPatch(typeof(HUDManager))] public class QuotaRackupPatcher { [HarmonyPatch(/*Could not decode attribute arguments.*/)] [HarmonyTranspiler] private static IEnumerable<CodeInstruction> rackUpNewQuotaTextMoveNext(IEnumerable<CodeInstruction> instructions) { //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Expected O, but got Unknown //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Expected O, but got Unknown FieldInfo fieldInfo = null; foreach (CodeInstruction instruction in instructions) { FieldInfo obj = instruction.operand as FieldInfo; if ((object)obj != null && obj.Name?.Contains("<quotaTextAmount>") == true) { FieldInfo obj2 = instruction.operand as FieldInfo; if ((object)obj2 != null && obj2.ReflectedType?.Name.Contains("<rackUpNewQuotaText>") == true) { fieldInfo = instruction.operand as FieldInfo; break; } } } if (fieldInfo == null) { BCMHQModule.Logger.LogWarning((object)"Could not find quotaTextAmount in rackUpNewQuotaText enumerator. Quota rackup will not be sped up."); return instructions; } IEnumerable<CodeInstruction> result = instructions; try { result = new CodeMatcher(instructions, (ILGenerator)null).MatchForward(false, (CodeMatch[])(object)new CodeMatch[2] { new CodeMatch((OpCode?)OpCodes.Ldc_R4, (object)250f, (string)null), new CodeMatch((OpCode?)OpCodes.Mul, (object)null, (string)null) }).ThrowIfNotMatch("250f quota increment amount not found", Array.Empty<CodeMatch>()).SetOperandAndAdvance((object)1500f) .InstructionEnumeration(); } catch (Exception arg) { BCMHQModule.Logger.LogWarning((object)$"Could not set new codeinstructions to rackUpNewQuotaText. Exception: {arg}"); } return result; } } [HarmonyPatch] public class ShipLeaveOnQuit { [HarmonyPatch(typeof(QuickMenuManager), "LeaveGameConfirm")] [HarmonyPrefix] private static void ShipLeave() { if ((Object)(object)GameNetworkManager.Instance != (Object)null && !HUDManager.Instance.retrievingSteamLeaderboard && Net.Instance.receivedSyncedValues) { BCMHQModule.Logger.LogInfo((object)"ShipLeave called from LeaveGameConfirm to remove extra enemy spawn attributes."); LevelModifications.OnShipLeave(); } } } [HarmonyPatch(typeof(EnemyAI))] public class UpdateEnemyHPPatcher { [HarmonyPatch("Start")] [HarmonyPostfix] public static void Start_Postfix(EnemyAI __instance) { ((MonoBehaviour)__instance).StartCoroutine(UpdateHP(__instance)); } private static IEnumerator UpdateHP(EnemyAI ai) { yield return (object)new WaitUntil((Func<bool>)(() => Net.Instance.receivedSyncedValues)); ai.enemyHP = (int)Mathf.Clamp((float)(ai.enemyHP + Manager.bonusEnemyHp), 1.1f, 100000000f); } } [HarmonyPatch] public class ValueSynchronizer { [HarmonyPatch(typeof(Manager), "GetScrapInShip")] [HarmonyPostfix] private static void AddStoredScrapValue(ref float __result) { HQoLNetwork instance = HQoLNetwork.Instance; if ((Object)(object)instance != (Object)null) { __result += HQoLNetwork.Instance.totalStorageValue.Value; } HQoLNetwork instance2 = HQoLNetwork.Instance; if ((Object)(object)instance2 != (Object)null) { __result += HQoLNetwork.Instance.totalStorageValue.Value; } } } [HarmonyPatch] public class PassTimeToNextDayPatcher { [HarmonyPatch(typeof(StartOfRound), "PassTimeToNextDay")] [HarmonyPrefix] public static void PassTimeToNextDayPatch() { if (TimeOfDay.Instance.currentLevel.planetHasTime || TimeOfDay.Instance.profitQuota - TimeOfDay.Instance.quotaFulfilled <= 0) { return; } if (TimeOfDay.Instance.daysUntilDeadline > 0) { if (TimeOfDay.Instance.daysUntilDeadline == 1) { TimeOfDay.Instance.globalTimeAtEndOfDay = 0f; } TimeOfDay instance = TimeOfDay.Instance; instance.timeUntilDeadline -= 1050f; TimeOfDay.Instance.OnDayChanged(); HUDManager.Instance.DisplayDaysLeft((int)Mathf.Floor(TimeOfDay.Instance.timeUntilDeadline / TimeOfDay.Instance.totalTime)); } else { TimeOfDay instance2 = TimeOfDay.Instance; instance2.timeUntilDeadline -= 1050f; } } } } namespace BCMHQModule.MonoBehaviours { public class MenuToggleController : MonoBehaviour { private Button? button; private TextMeshProUGUI? buttonText; private Image? checkmarkImage; public Sprite? buttonSprite; public Sprite? checkmarkSprite; public int settingId = 0; public string baseTitle = "Setting"; private void Awake() { //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Expected O, but got Unknown button = ((Component)this).GetComponent<Button>(); Transform obj = ((Component)this).transform.Find("Background/Checkmark"); checkmarkImage = ((obj != null) ? ((Component)obj).GetComponent<Image>() : null); buttonText = ((Component)((Component)this).transform.parent.Find("Text (2)")).GetComponent<TextMeshProUGUI>(); if ((Object)(object)button == (Object)null) { BCMHQModule.Logger.LogWarning((object)"checkmarkImage was null!"); } else { ((UnityEvent)button.onClick).AddListener(new UnityAction(OnButtonClicked)); } } private void Start() { UpdateVisualState(); } private void OnButtonClicked() { if (settingId == 0) { BCMHQModule.internalNames.Value = !BCMHQModule.internalNames.Value; ((ConfigEntryBase)BCMHQModule.internalNames).ConfigFile.Save(); } else { BCMHQModule.sdcMode.Value = !BCMHQModule.sdcMode.Value; ((ConfigEntryBase)BCMHQModule.sdcMode).ConfigFile.Save(); } UpdateVisualState(); } private void UpdateVisualState() { if ((Object)(object)buttonText == (Object)null) { return; } ((TMP_Text)buttonText).text = baseTitle ?? ""; if (!((Object)(object)checkmarkImage == (Object)null)) { if ((settingId == 0) ? BCMHQModule.internalNames.Value : BCMHQModule.sdcMode.Value) { checkmarkImage.overrideSprite = checkmarkSprite; } else { checkmarkImage.overrideSprite = null; } } } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }