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 HighQuotaRebalance Beta v0.2.0
HQRebalance.dll
Decompiled a year agousing System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Logging; using GameNetcodeStuff; using HQRebalance.Patches; using HarmonyLib; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("HQRebalance")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("HQRebalance")] [assembly: AssemblyCopyright("Copyright © 2025")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("8ecf0e7a-a457-4359-ad0c-7f8bb4c29572")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("1.0.0.0")] namespace HQRebalance { [BepInPlugin("OreoM.HQ60", "HQRebalance", "0.2.0")] public class HQRebalance : BaseUnityPlugin { private const string modGUID = "OreoM.HQ60"; private const string modName = "HQRebalance"; private const string modVersion = "0.2.0"; internal static ManualLogSource mls; private readonly Harmony harmony = new Harmony("OreoM.HQ60"); private void Awake() { mls = Logger.CreateLogSource("OreoM.HQ60"); mls.LogInfo((object)"Patching"); Patch(); mls.LogInfo((object)"Patched"); } private void Patch() { harmony.PatchAll(typeof(HQRebalance)); harmony.PatchAll(typeof(JesterAIPatches)); harmony.PatchAll(typeof(CaveDwellerAIPatches)); harmony.PatchAll(typeof(TerminalPatches)); harmony.PatchAll(typeof(StartOfRoundPatches)); harmony.PatchAll(typeof(RoundManagerPatches)); harmony.PatchAll(typeof(PlayerControllerBPatches)); } } } namespace HQRebalance.Patches { [HarmonyPatch(typeof(CaveDwellerAI))] internal class CaveDwellerAIPatches { [HarmonyPatch("HitEnemy")] [HarmonyPrefix] private static void PreHitEnemy(CaveDwellerAI __instance, int force) { if (!((EnemyAI)__instance).inSpecialAnimation) { ((EnemyAI)__instance).enemyHP = ((EnemyAI)__instance).enemyHP - (force - 1); } } [HarmonyPatch("BabyUpdate")] [HarmonyPostfix] private static void PostBabyUpdate(CaveDwellerAI __instance) { Traverse val = Traverse.Create((object)__instance); object value = val.Field("observingPlayer").GetValue(); PlayerControllerB val2 = (PlayerControllerB)((value is PlayerControllerB) ? value : null); if ((Object)(object)val2 != (Object)null) { __instance.hasPlayerFoundBaby = true; } if (__instance.eatingScrap && !__instance.hasPlayerFoundBaby) { __instance.eatingScrap = false; } if (__instance.babyCrying && !__instance.hasPlayerFoundBaby) { val.Method("SetCryingLocalClient", new object[1] { false }).GetValue(); __instance.SetBabyCryingServerRpc(false); } } } [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; if (StartOfRound.Instance.connectedPlayersAmount == 0) { __instance.beginCrankingTimer *= 2f; } } } [HarmonyPatch(typeof(PlayerControllerB))] internal class PlayerControllerBPatches { [HarmonyPatch("CalculateGroundNormal")] [HarmonyPrefix] private static bool OverwriteCalculateGroundNormal(PlayerControllerB __instance) { //IL_000e: 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_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: 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_005f: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) Traverse val = Traverse.Create((object)__instance); RaycastHit val2 = default(RaycastHit); if (Physics.Raycast(((Component)__instance).transform.position + Vector3.up * 0.2f, -Vector3.up, ref val2, 6f, 268438273, (QueryTriggerInteraction)1)) { __instance.playerGroundNormal = ((RaycastHit)(ref val2)).normal; } else { __instance.playerGroundNormal = Vector3.up; } val.Field("hit").SetValue((object)val2); return false; } [HarmonyPatch("Update")] [HarmonyPostfix] private static void PostUpdate(PlayerControllerB __instance) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) if (((Component)__instance).transform.position.y <= -80f && __instance.isUnderwater) { __instance.isMovementHindered = 0; } } } [HarmonyPatch(typeof(RoundManager))] internal class RoundManagerPatches { [HarmonyPatch("Awake")] [HarmonyPostfix] private static void PostAwake(RoundManager __instance) { __instance.dungeonFlowTypes[4].MapTileSize = 1.12f; __instance.dungeonFlowTypes[4].dungeonFlow.Lines[0].Length = 0.1611f; __instance.dungeonFlowTypes[4].dungeonFlow.Lines[1].Length = 0.6778f; __instance.dungeonFlowTypes[4].dungeonFlow.Lines[1].Position = 0.1611f; __instance.dungeonFlowTypes[4].dungeonFlow.Lines[2].Length = 0.1611f; __instance.dungeonFlowTypes[4].dungeonFlow.Lines[2].Position = 0.8389f; } [HarmonyPatch("SpawnScrapInLevel")] [HarmonyTranspiler] private static IEnumerable<CodeInstruction> TranpileSpawnScrapInLevel(IEnumerable<CodeInstruction> instructions) { //IL_027c: Unknown result type (might be due to invalid IL or missing references) //IL_0286: Expected O, but got Unknown //IL_03e5: Unknown result type (might be due to invalid IL or missing references) //IL_03eb: Expected O, but got Unknown //IL_03f3: Unknown result type (might be due to invalid IL or missing references) //IL_03f9: Expected O, but got Unknown //IL_0407: Unknown result type (might be due to invalid IL or missing references) //IL_040d: Expected O, but got Unknown //IL_041e: Unknown result type (might be due to invalid IL or missing references) //IL_0424: Expected O, but got Unknown //IL_042c: Unknown result type (might be due to invalid IL or missing references) //IL_0432: Expected O, but got Unknown //IL_0443: Unknown result type (might be due to invalid IL or missing references) //IL_0449: Expected O, but got Unknown //IL_0451: Unknown result type (might be due to invalid IL or missing references) //IL_0457: Expected O, but got Unknown //IL_0465: Unknown result type (might be due to invalid IL or missing references) //IL_046b: Expected O, but got Unknown //IL_047c: Unknown result type (might be due to invalid IL or missing references) //IL_0482: Expected O, but got Unknown //IL_048b: Unknown result type (might be due to invalid IL or missing references) //IL_0491: Expected O, but got Unknown //IL_04a3: Unknown result type (might be due to invalid IL or missing references) //IL_04a9: Expected O, but got Unknown //IL_04b2: Unknown result type (might be due to invalid IL or missing references) //IL_04b8: Expected O, but got Unknown //IL_04c1: Unknown result type (might be due to invalid IL or missing references) //IL_04c7: Expected O, but got Unknown //IL_04d0: Unknown result type (might be due to invalid IL or missing references) //IL_04d6: Expected O, but got Unknown List<CodeInstruction> list = new List<CodeInstruction>(instructions); Label label = default(Label); for (int i = 0; i < list.Count - 2; i++) { if (list[i].opcode == OpCodes.Ldc_I4_6) { list[i].opcode = OpCodes.Ldc_I4_0; } if (list[i].opcode == OpCodes.Ldc_I4 && list[i].operand is int num && num == 500) { list[i].operand = 100; } if (list[i].opcode == OpCodes.Ldc_I4_S && list[i].operand is sbyte b && b == 25) { list[i].operand = 15; list[i + 1].opcode = OpCodes.Bge; if (list[i + 2].labels.Count == 0) { list[i + 2].labels.Add(label); HQRebalance.mls.LogInfo((object)"Jump point found"); } } } int num2 = -1; int num3 = -1; int num4 = -1; int num5 = -1; int num6 = -1; int num7 = -1; int num8 = -1; int num9 = -1; for (int j = 0; j < list.Count - 3; j++) { if (list[j].opcode == OpCodes.Ldc_I4_5) { num2 = j - 11; num3 = j + 1; } if (num2 != -1 && num3 != -1) { j = num2; list.RemoveRange(num2, num3 - num2 + 1); num2 = -1; num3 = -1; HQRebalance.mls.LogInfo((object)"Rare item check patched"); } if (list[j].opcode == OpCodes.Ldfld && list[j].operand is FieldInfo fieldInfo && fieldInfo.Name == "twoHanded" && list[j + 2].opcode == OpCodes.Ldarg_0) { num4 = j + 2; list[j + 1] = new CodeInstruction(OpCodes.Brtrue_S, (object)label); } if (list[j].opcode == OpCodes.Ldc_I4_S && list[j].operand is sbyte b2 && b2 == 60) { num5 = j + 3; } if (num4 != -1 && num5 != -1) { j = num4; list.RemoveRange(num4, num5 - num4 + 1); num4 = -1; num5 = -1; HQRebalance.mls.LogInfo((object)"Two-handed check patched"); } if (list[j].opcode == OpCodes.Ldc_I4_S && list[j + 1].opcode == OpCodes.Ldc_I4 && list[j + 1].operand is int num10 && num10 == 170) { num6 = j; num7 = j + 2; } if (num6 != -1 && num7 != -1) { j = num6 - 1; list.RemoveRange(num6, num7 - num6 + 1); num6 = -1; num7 = -1; HQRebalance.mls.LogInfo((object)"Sid value clamp patched"); CodeInstruction[] collection = (CodeInstruction[])(object)new CodeInstruction[14] { new CodeInstruction(OpCodes.Dup, (object)null), new CodeInstruction(OpCodes.Dup, (object)null), new CodeInstruction(OpCodes.Stloc_S, (object)22), new CodeInstruction(OpCodes.Ldc_R4, (object)3f), new CodeInstruction(OpCodes.Mul, (object)null), new CodeInstruction(OpCodes.Ldc_R4, (object)330f), new CodeInstruction(OpCodes.Add, (object)null), new CodeInstruction(OpCodes.Ldloc_S, (object)22), new CodeInstruction(OpCodes.Ldc_R4, (object)4f), new CodeInstruction(OpCodes.Mul, (object)null), new CodeInstruction(OpCodes.Ldc_R4, (object)120f), new CodeInstruction(OpCodes.Add, (object)null), new CodeInstruction(OpCodes.Div, (object)null), new CodeInstruction(OpCodes.Mul, (object)null) }; list.InsertRange(j, collection); } if (list[j].opcode == OpCodes.Ldloc_2 && list[j + 3].opcode == OpCodes.Ldc_R4 && list[j + 3].operand is float num11 && num11 == 600f) { num8 = j; } if (list[j + 1].opcode == OpCodes.Call && list[j + 1].operand is MethodInfo methodInfo && methodInfo.Name == "StartCoroutine") { num9 = j - 7; } if (num8 != -1 && num9 != -1) { j = num8; list.RemoveRange(num8, num9 - num8 + 1); num8 = -1; num9 = -1; HQRebalance.mls.LogInfo((object)"SID value readjust patched"); } } return list.AsEnumerable(); } [HarmonyPatch("RefreshEnemiesList")] [HarmonyPostfix] private static void PostRefresheEnemiesList(RoundManager __instance) { ((Component)__instance.indoorFog).gameObject.SetActive(false); } } [HarmonyPatch(typeof(StartOfRound))] internal class StartOfRoundPatches { [HarmonyPatch("Awake")] [HarmonyPostfix] private static void PostAwake(StartOfRound __instance) { SelectableLevel[] levels = __instance.levels; levels[6].minScrap = 22; levels[7].maxScrap = 28; levels[9].minScrap = 31; levels[9].maxScrap = 34; levels[10].minScrap = 32; levels[10].maxScrap = 37; levels[10].factorySizeMultiplier = 2f; levels[0].dungeonFlowTypes[1].rarity = 5; levels[0].dungeonFlowTypes[2].rarity = 5; levels[1].dungeonFlowTypes[1].rarity = 5; levels[2].dungeonFlowTypes[0].rarity = 40; levels[2].dungeonFlowTypes[1].rarity = 5; levels[2].dungeonFlowTypes[2].rarity = 300; levels[5].dungeonFlowTypes[1].rarity = 25; levels[6].dungeonFlowTypes[0].rarity = 50; levels[6].dungeonFlowTypes[2].rarity = 5; levels[7].dungeonFlowTypes[0].rarity = 5; levels[7].dungeonFlowTypes[1].rarity = 50; levels[7].dungeonFlowTypes[2].rarity = 300; levels[8].dungeonFlowTypes[1].rarity = 5; levels[8].dungeonFlowTypes[2].rarity = 300; levels[9].dungeonFlowTypes[1].rarity = 5; levels[9].dungeonFlowTypes[2].rarity = 50; levels[10].dungeonFlowTypes[0].rarity = 300; levels[10].dungeonFlowTypes[1].rarity = 300; levels[10].dungeonFlowTypes[2].rarity = 300; levels[12].dungeonFlowTypes[1].rarity = 5; levels[12].dungeonFlowTypes[2].rarity = 100; SpawnableItemWithRarity item = levels[1].spawnableScrap[40]; levels[0].spawnableScrap.Add(item); levels[5].spawnableScrap.Add(item); levels[9].spawnableScrap.Add(item); levels[12].spawnableScrap.Add(item); levels[10].spawnableScrap[34].rarity = 35; ((Keyframe)(ref levels[10].enemySpawnChanceThroughoutDay.keys[1])).time = 0.1625553f; ((Keyframe)(ref levels[10].enemySpawnChanceThroughoutDay.keys[2])).time = 0.4976344f; ((Keyframe)(ref levels[10].enemySpawnChanceThroughoutDay.keys[1])).value = 1.142029f; ((Keyframe)(ref levels[10].enemySpawnChanceThroughoutDay.keys[2])).value = 5.041142f; ((Keyframe)(ref levels[10].enemySpawnChanceThroughoutDay.keys[3])).value = 6.988362f; ((Keyframe)(ref levels[10].enemySpawnChanceThroughoutDay.keys[4])).value = 15f; ((Keyframe)(ref levels[10].enemySpawnChanceThroughoutDay.keys[1])).inTangent = 9.178675f; ((Keyframe)(ref levels[10].enemySpawnChanceThroughoutDay.keys[1])).outTangent = 9.178675f; ((Keyframe)(ref levels[10].enemySpawnChanceThroughoutDay.keys[1])).inWeight = 0.6591896f; ((Keyframe)(ref levels[10].enemySpawnChanceThroughoutDay.keys[1])).outWeight = 0.4374599f; AnimationCurve numberToSpawn = levels[6].spawnableMapObjects[0].numberToSpawn; AnimationCurve numberToSpawn2 = levels[10].spawnableMapObjects[0].numberToSpawn; AnimationCurve numberToSpawn3 = levels[10].spawnableMapObjects[1].numberToSpawn; AnimationCurve numberToSpawn4 = levels[10].spawnableMapObjects[2].numberToSpawn; levels[6].spawnableMapObjects[1].numberToSpawn = numberToSpawn4; levels[7].spawnableMapObjects[0].numberToSpawn = numberToSpawn3; levels[7].spawnableMapObjects[1].numberToSpawn = numberToSpawn; levels[7].spawnableMapObjects[2].numberToSpawn = numberToSpawn; levels[9].spawnableMapObjects[0].numberToSpawn = numberToSpawn2; levels[9].spawnableMapObjects[1].numberToSpawn = numberToSpawn; levels[9].spawnableMapObjects[2].numberToSpawn = numberToSpawn; levels[6].spawnableScrap[0].rarity = 0; levels[6].spawnableScrap[1].rarity = 0; levels[6].spawnableScrap[2].rarity = 9; levels[6].spawnableScrap[3].rarity = 0; levels[6].spawnableScrap[4].rarity = 85; levels[6].spawnableScrap[5].rarity = 33; levels[6].spawnableScrap[7].rarity = 13; levels[6].spawnableScrap[8].rarity = 14; levels[6].spawnableScrap[9].rarity = 85; levels[6].spawnableScrap[10].rarity = 44; levels[6].spawnableScrap[12].rarity = 71; levels[6].spawnableScrap[13].rarity = 0; levels[6].spawnableScrap[14].rarity = 0; levels[6].spawnableScrap[15].rarity = 0; levels[6].spawnableScrap[16].rarity = 89; levels[6].spawnableScrap[17].rarity = 18; levels[6].spawnableScrap[18].rarity = 6; levels[6].spawnableScrap[20].rarity = 95; levels[6].spawnableScrap[22].rarity = 17; levels[6].spawnableScrap[23].rarity = 91; levels[6].spawnableScrap[26].rarity = 11; levels[6].spawnableScrap[27].rarity = 41; levels[6].spawnableScrap[28].rarity = 19; levels[6].spawnableScrap[29].rarity = 19; levels[6].spawnableScrap[30].rarity = 0; levels[6].spawnableScrap[31].rarity = 82; levels[6].spawnableScrap[32].rarity = 63; levels[6].spawnableScrap[33].rarity = 63; levels[6].spawnableScrap[35].rarity = 5; levels[6].spawnableScrap[37].rarity = 88; levels[6].spawnableScrap[38].rarity = 0; levels[6].spawnableScrap[40].rarity = 97; levels[6].spawnableScrap[41].rarity = 12; levels[6].spawnableScrap.RemoveAll((SpawnableItemWithRarity x) => x.rarity == 0); } } [HarmonyPatch(typeof(Terminal))] internal class TerminalPatches { [HarmonyPatch("Awake")] [HarmonyPostfix] private static void PostAwake(Terminal __instance) { TerminalNode result = __instance.terminalNodes.allKeywords[27].compatibleNouns[10].result; result.itemCost = 3000; result.terminalOptions[1].result.itemCost = 3000; } } }