using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using Dawn.Internal; using GameNetcodeStuff; using HarmonyLib; using MelMPocketLib.NetcodePatcher; using MelaniePocketRoom; using Microsoft.CodeAnalysis; using Unity.Netcode; using UnityEngine; using UnityEngine.AI; using loaforcsSoundAPI.LethalCompany.Conditions.Player; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("MelaniePocketRoom")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("MelanieMelicious")] [assembly: AssemblyProduct("MelaniePocketRoom")] [assembly: AssemblyCopyright("Copyright © 2025")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] [module: NetcodePatchedAssembly] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [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; } } } public class AltSavePatch { [HarmonyPostfix] [HarmonyPatch(typeof(StartOfRound), "LoadUnlockables")] private static void PlayerPostStart(StartOfRound __instance) { foreach (Collider roomBound in MelShipBoundsCheck.roomBounds) { ItemSaveDataHandler.AddColliderForItemSaving(roomBound); } } } public class HarmonyPatches { internal static HashSet blacklist = new HashSet(); internal static HashSet mediumEmy = new HashSet(); internal static HashSet largeEmy = new HashSet(); internal static bool walkWarp; [HarmonyPrefix] [HarmonyPatch(typeof(PlayerControllerB), "Start")] private static void PlayerPostStart(PlayerControllerB __instance) { __instance.isInElevator = true; __instance.isInHangarShipRoom = true; } [HarmonyPrefix] [HarmonyPatch(typeof(StartOfRound), "Start")] [HarmonyBefore(new string[] { "MelanieMelicious.2StoryShip" })] private static void PreStart() { walkWarp = PocketRoomCfg.walkWarp.Value; } [HarmonyPostfix] [HarmonyPatch(typeof(StartOfRound), "Start")] [HarmonyAfter(new string[] { "MelanieMelicious.2StoryShip", "mborsh.WiderShipMod" })] private static void PostStart(StartOfRound __instance) { EnemyType[] array = Resources.FindObjectsOfTypeAll(); foreach (EnemyType val in array) { string[] array2 = PocketRoomCfg.warpBlacklist.Value.Split(new char[1] { ',' }); foreach (string text in array2) { if (val.enemyName == text) { blacklist.Add(val); Plugin.mls.LogInfo((object)$"Found and added {val} to door teleport blacklist."); } } string[] array3 = PocketRoomCfg.largeEmy.Value.Split(new char[1] { ',' }); foreach (string text2 in array3) { if (val.enemyName == text2) { largeEmy.Add(val); Plugin.mls.LogInfo((object)$"Found and added {val} to large enemy list."); } } } } [HarmonyPostfix] [HarmonyPatch(typeof(StartOfRound), "LoadUnlockables")] private static void PostUnlock() { Physics.SyncTransforms(); } [HarmonyPrefix] [HarmonyPatch(typeof(QuickMenuManager), "LeaveGameConfirm")] private static void PreQuit() { MelShipBoundsCheck.roomBounds.Clear(); } [HarmonyTranspiler] [HarmonyPatch(typeof(AudioReverbTrigger), "ChangeAudioReverbForPlayer")] [HarmonyPriority(800)] private static IEnumerable TranspilerARTCARFP(IEnumerable instructions, ILGenerator generator) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Expected O, but got Unknown //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Expected O, but got Unknown //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Expected O, but got Unknown //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Expected O, but got Unknown //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Expected O, but got Unknown //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Expected O, but got Unknown //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Expected O, but got Unknown CodeMatcher val = new CodeMatcher(instructions, (ILGenerator)null); Label label = generator.DefineLabel(); List list = new List(); val.Start().MatchForward(false, (CodeMatch[])(object)new CodeMatch[1] { new CodeMatch((OpCode?)OpCodes.Ldfld, (object)AccessTools.Field(typeof(StartOfRound), "shipBounds"), (string)null) }); list.Add(val.InstructionAt(-1)); val.Advance(1).MatchForward(false, (CodeMatch[])(object)new CodeMatch[1] { new CodeMatch((OpCode?)OpCodes.Ldfld, (object)null, (string)null) }); list.AddRange(val.InstructionsWithOffsets(0, 2)); val.MatchForward(false, (CodeMatch[])(object)new CodeMatch[1] { new CodeMatch((OpCode?)OpCodes.Brfalse, (object)null, (string)null) }).InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[7] { new CodeInstruction(OpCodes.Brtrue, (object)label), list[0], new CodeInstruction(OpCodes.Ldarg_0, (object)null), list[1], list[2], list[3], new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(MelShipBoundsCheck), "IsInShipRooms", (Type[])null, (Type[])null)) }).Advance(1) .Labels.Add(label); return val.InstructionEnumeration(); } [HarmonyTranspiler] [HarmonyPatch(typeof(BeltBagItem), "RemoveObjectFromBag")] [HarmonyPriority(800)] private static IEnumerable TranspilerBBIROFB(IEnumerable instructions, ILGenerator generator) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0009: 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_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Expected O, but got Unknown //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Expected O, but got Unknown //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Expected O, but got Unknown //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Expected O, but got Unknown //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Expected O, but got Unknown //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Expected O, but got Unknown //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Expected O, but got Unknown //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Expected O, but got Unknown //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Expected O, but got Unknown //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Expected O, but got Unknown //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Expected O, but got Unknown CodeMatcher val = new CodeMatcher(instructions, (ILGenerator)null); Label label = generator.DefineLabel(); Label label2 = generator.DefineLabel(); val.Start().MatchForward(false, (CodeMatch[])(object)new CodeMatch[1] { new CodeMatch((OpCode?)OpCodes.Ldfld, (object)AccessTools.Field(typeof(StartOfRound), "shipInnerRoomBounds"), (string)null) }).MatchForward(false, (CodeMatch[])(object)new CodeMatch[1] { new CodeMatch((OpCode?)OpCodes.Brfalse, (object)null, (string)null) }) .InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[4] { new CodeInstruction(OpCodes.Brtrue, (object)label), new CodeInstruction(OpCodes.Ldarg_0, (object)null), new CodeInstruction(OpCodes.Ldloc_S, (object)4), new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(MelShipBoundsCheck), "IsInShipRooms", (Type[])null, (Type[])null)) }) .Advance(1) .Labels.Add(label); val.MatchForward(false, (CodeMatch[])(object)new CodeMatch[1] { new CodeMatch((OpCode?)OpCodes.Ldfld, (object)AccessTools.Field(typeof(StartOfRound), "shipBounds"), (string)null) }).MatchForward(false, (CodeMatch[])(object)new CodeMatch[1] { new CodeMatch((OpCode?)OpCodes.Brfalse, (object)null, (string)null) }).InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[4] { new CodeInstruction(OpCodes.Brtrue, (object)label2), new CodeInstruction(OpCodes.Ldarg_0, (object)null), new CodeInstruction(OpCodes.Ldloc_S, (object)4), new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(MelShipBoundsCheck), "IsInShipRooms", (Type[])null, (Type[])null)) }) .Advance(1) .Labels.Add(label2); return val.InstructionEnumeration(); } [HarmonyTranspiler] [HarmonyPatch(typeof(DeadBodyInfo), "LateUpdate")] [HarmonyPriority(800)] private static IEnumerable TranspilerDBILU(IEnumerable instructions, ILGenerator generator) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Expected O, but got Unknown //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Expected O, but got Unknown //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Expected O, but got Unknown //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Expected O, but got Unknown //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Expected O, but got Unknown //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Expected O, but got Unknown //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Expected O, but got Unknown CodeMatcher val = new CodeMatcher(instructions, (ILGenerator)null); Label label = generator.DefineLabel(); List list = new List(); val.Start().MatchForward(false, (CodeMatch[])(object)new CodeMatch[1] { new CodeMatch((OpCode?)OpCodes.Ldfld, (object)AccessTools.Field(typeof(StartOfRound), "shipBounds"), (string)null) }); list.Add(val.InstructionAt(-1)); val.MatchForward(false, (CodeMatch[])(object)new CodeMatch[1] { new CodeMatch((OpCode?)OpCodes.Call, (object)null, (string)null) }); list.AddRange(val.InstructionsWithOffsets(0, 1)); val.MatchForward(false, (CodeMatch[])(object)new CodeMatch[1] { new CodeMatch((OpCode?)OpCodes.Brfalse, (object)null, (string)null) }).InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[6] { new CodeInstruction(OpCodes.Brtrue, (object)label), list[0], new CodeInstruction(OpCodes.Ldarg_0, (object)null), list[1], list[2], new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(MelShipBoundsCheck), "IsInShipRooms", (Type[])null, (Type[])null)) }).Advance(1) .Labels.Add(label); return val.InstructionEnumeration(); } [HarmonyTranspiler] [HarmonyPatch(typeof(ElevatorAnimationEvents), "SetBodiesKinematic")] [HarmonyPriority(800)] private static IEnumerable TranspilerEAESBK(IEnumerable instructions, ILGenerator generator) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Expected O, but got Unknown //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Expected O, but got Unknown //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Expected O, but got Unknown //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Expected O, but got Unknown //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Expected O, but got Unknown //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Expected O, but got Unknown //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Expected O, but got Unknown //IL_011d: 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_0131: Expected O, but got Unknown //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Expected O, but got Unknown //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Expected O, but got Unknown //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Expected O, but got Unknown CodeMatcher val = new CodeMatcher(instructions, (ILGenerator)null); Label label = generator.DefineLabel(); List list = new List(); val.Start().MatchForward(false, (CodeMatch[])(object)new CodeMatch[1] { new CodeMatch((OpCode?)OpCodes.Ldfld, (object)AccessTools.Field(typeof(StartOfRound), "shipBounds"), (string)null) }); list.Add(val.InstructionAt(-1)); val.Advance(1).MatchForward(false, (CodeMatch[])(object)new CodeMatch[1] { new CodeMatch((OpCode?)OpCodes.Ldfld, (object)null, (string)null) }); list.Add(val.Instruction); val.MatchForward(false, (CodeMatch[])(object)new CodeMatch[1] { new CodeMatch((OpCode?)OpCodes.Callvirt, (object)null, (string)null) }); list.Add(val.Instruction); val.MatchForward(false, (CodeMatch[])(object)new CodeMatch[1] { new CodeMatch((OpCode?)OpCodes.Brfalse, (object)null, (string)null) }).InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[10] { new CodeInstruction(OpCodes.Brtrue, (object)label), list[0], new CodeInstruction(OpCodes.Ldloc_0, (object)null), new CodeInstruction(OpCodes.Ldloc_1, (object)null), new CodeInstruction(OpCodes.Ldelem_Ref, (object)null), list[1], new CodeInstruction(OpCodes.Ldc_I4_5, (object)null), new CodeInstruction(OpCodes.Ldelem_Ref, (object)null), list[2], new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(MelShipBoundsCheck), "IsInShipRooms", (Type[])null, (Type[])null)) }).Advance(1) .Labels.Add(label); return val.InstructionEnumeration(); } [HarmonyTranspiler] [HarmonyPatch(typeof(PlayerControllerB), "DiscardHeldObject")] [HarmonyPriority(800)] private static IEnumerable TranspilerPCBDHO(IEnumerable instructions) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Expected O, but got Unknown //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Expected O, but got Unknown //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Expected O, but got Unknown //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Expected O, but got Unknown //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Expected O, but got Unknown CodeMatcher val = new CodeMatcher(instructions, (ILGenerator)null); List list = new List(); val.Start().MatchForward(false, (CodeMatch[])(object)new CodeMatch[1] { new CodeMatch((OpCode?)OpCodes.Ldfld, (object)AccessTools.Field(typeof(StartOfRound), "shipBounds"), (string)null) }); list.Add(val.InstructionAt(-1)); val.MatchForward(false, (CodeMatch[])(object)new CodeMatch[1] { new CodeMatch((OpCode?)OpCodes.Brtrue, (object)null, (string)null) }); list.Add(val.InstructionAt(-2)); list.Add(val.Instruction); val.Insert((CodeInstruction[])(object)new CodeInstruction[5] { list[2], new CodeInstruction(OpCodes.Ldarg_0, (object)null), list[0], list[1], new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(MelShipBoundsCheck), "IsInShipRooms", (Type[])null, (Type[])null)) }); return val.InstructionEnumeration(); } [HarmonyTranspiler] [HarmonyPatch(typeof(ShipBuildModeManager), "Update")] [HarmonyPriority(800)] private static IEnumerable TranspilerSBMMU(IEnumerable instructions, ILGenerator generator) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Expected O, but got Unknown //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Expected O, but got Unknown //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Expected O, but got Unknown //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Expected O, but got Unknown //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Expected O, but got Unknown //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Expected O, but got Unknown //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0117: 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 //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Expected O, but got Unknown //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Expected O, but got Unknown CodeMatcher val = new CodeMatcher(instructions, (ILGenerator)null); List list = new List(); Label label = generator.DefineLabel(); val.Start().MatchForward(false, (CodeMatch[])(object)new CodeMatch[1] { new CodeMatch((OpCode?)OpCodes.Ldfld, (object)AccessTools.Field(typeof(StartOfRound), "shipInnerRoomBounds"), (string)null) }); list.Add(val.InstructionAt(-1)); val.MatchForward(false, (CodeMatch[])(object)new CodeMatch[1] { new CodeMatch((OpCode?)OpCodes.Br, (object)null, (string)null) }); object operand = val.Operand; list.AddRange(val.InstructionsWithOffsets(-3, -2)); val.SetInstructionAndAdvance(new CodeInstruction(OpCodes.Brtrue_S, (object)label)).InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[6] { list[0], new CodeInstruction(OpCodes.Ldarg_0, (object)null), list[1], list[2], new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(MelShipBoundsCheck), "IsInShipRooms", (Type[])null, (Type[])null)), new CodeInstruction(OpCodes.Brtrue_S, (object)label) }).Advance(1) .InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[2] { new CodeInstruction(OpCodes.Br, operand), new CodeInstruction(OpCodes.Ldc_I4_1, (object)null) }) .Advance(-1) .Labels.Add(label); val.Advance(1).Insert((CodeInstruction[])(object)new CodeInstruction[1] { new CodeInstruction(OpCodes.Br, operand) }); return val.InstructionEnumeration(); } [HarmonyTranspiler] [HarmonyPatch(typeof(SoccerBallProp), "BeginKickBall")] [HarmonyPriority(800)] private static IEnumerable TranspilerSBPBKB(IEnumerable instructions, ILGenerator generator) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Expected O, but got Unknown //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0051: 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 //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Expected O, but got Unknown //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Expected O, but got Unknown //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Expected O, but got Unknown //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Expected O, but got Unknown //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Expected O, but got Unknown //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_0161: 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_0196: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Expected O, but got Unknown //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Expected O, but got Unknown //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Expected O, but got Unknown //IL_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: Expected O, but got Unknown //IL_01d8: Unknown result type (might be due to invalid IL or missing references) //IL_01de: Expected O, but got Unknown //IL_0210: Unknown result type (might be due to invalid IL or missing references) //IL_0216: Expected O, but got Unknown CodeMatcher val = new CodeMatcher(instructions, (ILGenerator)null); List list = new List(); Label label = generator.DefineLabel(); Label label2 = generator.DefineLabel(); val.Start().MatchForward(false, (CodeMatch[])(object)new CodeMatch[1] { new CodeMatch((OpCode?)OpCodes.Ldfld, (object)AccessTools.Field(typeof(StartOfRound), "shipBounds"), (string)null) }).MatchForward(false, (CodeMatch[])(object)new CodeMatch[1] { new CodeMatch((OpCode?)OpCodes.Brtrue, (object)null, (string)null) }); list.Add(val.Instruction); val.InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[4] { list[0], new CodeInstruction(OpCodes.Ldarg_0, (object)null), new CodeInstruction(OpCodes.Ldloc_0, (object)null), new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(MelShipBoundsCheck), "IsInShipRooms", (Type[])null, (Type[])null)) }).MatchForward(false, (CodeMatch[])(object)new CodeMatch[1] { new CodeMatch((OpCode?)OpCodes.Ldfld, (object)AccessTools.Field(typeof(StartOfRound), "shipInnerRoomBounds"), (string)null) }); list.Add(val.InstructionAt(-1)); val.Advance(2).MatchForward(false, (CodeMatch[])(object)new CodeMatch[1] { new CodeMatch((OpCode?)OpCodes.Call, (object)null, (string)null) }).Advance(1) .InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[8] { new CodeInstruction(OpCodes.Brtrue_S, (object)label), list[1], new CodeInstruction(OpCodes.Ldloc_0, (object)null), new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(MelShipBoundsCheck), "IsInShipRooms", (Type[])null, (Type[])null)), new CodeInstruction(OpCodes.Brtrue_S, (object)label), new CodeInstruction(OpCodes.Ldc_I4_1, (object)null), new CodeInstruction(OpCodes.Br_S, (object)label2), new CodeInstruction(OpCodes.Ldc_I4_0, (object)null) }) .Advance(-1) .Labels.Add(label); val.Advance(1).InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1] { new CodeInstruction(OpCodes.Br_S, (object)label2) }).Labels.Add(label2); return val.InstructionEnumeration(); } [HarmonyTranspiler] [HarmonyPatch(typeof(StartOfRound), "LoadShipGrabbableItems")] [HarmonyPriority(800)] private static IEnumerable TranspilerLSGI(IEnumerable instructions) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Expected O, but got Unknown //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Expected O, but got Unknown //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Expected O, but got Unknown //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Expected O, but got Unknown //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Expected O, but got Unknown //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Expected O, but got Unknown //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Expected O, but got Unknown //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Expected O, but got Unknown //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Expected O, but got Unknown CodeMatcher val = new CodeMatcher(instructions, (ILGenerator)null); val.Start().MatchForward(false, (CodeMatch[])(object)new CodeMatch[1] { new CodeMatch((OpCode?)OpCodes.Ldfld, (object)AccessTools.Field(typeof(StartOfRound), "shipBounds"), (string)null) }).MatchForward(false, (CodeMatch[])(object)new CodeMatch[1] { new CodeMatch((OpCode?)OpCodes.Brtrue, (object)null, (string)null) }); object operand = val.Operand; val.Advance(1).Insert((CodeInstruction[])(object)new CodeInstruction[6] { new CodeInstruction(OpCodes.Ldarg_0, (object)null), new CodeInstruction(OpCodes.Ldloc_2, (object)null), new CodeInstruction(OpCodes.Ldloc_S, (object)9), new CodeInstruction(OpCodes.Ldelem, (object)typeof(Vector3)), new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(MelShipBoundsCheck), "IsInShipRooms", (Type[])null, (Type[])null)), new CodeInstruction(OpCodes.Brtrue, operand) }); return val.InstructionEnumeration(); } [HarmonyTranspiler] [HarmonyPatch(typeof(StartOfRound), "TeleportPlayerInShipIfOutOfRoomBounds")] [HarmonyPriority(800)] private static IEnumerable TranspilerTPISIOORB(IEnumerable instructions) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Expected O, but got Unknown //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Expected O, but got Unknown //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Expected O, but got Unknown //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: 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 CodeMatcher val = new CodeMatcher(instructions, (ILGenerator)null); List list = new List(); val.Start().MatchForward(false, (CodeMatch[])(object)new CodeMatch[1] { new CodeMatch((OpCode?)OpCodes.Ldfld, (object)AccessTools.Field(typeof(StartOfRound), "shipInnerRoomBounds"), (string)null) }).MatchForward(false, (CodeMatch[])(object)new CodeMatch[1] { new CodeMatch((OpCode?)OpCodes.Brtrue, (object)null, (string)null) }); list.Add(val.Instruction); list.AddRange(val.InstructionsWithOffsets(-5, -2)); val.Insert((CodeInstruction[])(object)new CodeInstruction[7] { list[0], new CodeInstruction(OpCodes.Ldarg_0, (object)null), list[1], list[2], list[3], list[4], new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(MelShipBoundsCheck), "IsInShipRooms", (Type[])null, (Type[])null)) }); return val.InstructionEnumeration(); } [HarmonyDebug] [HarmonyTranspiler] [HarmonyPatch(typeof(StartOfRound), "LateUpdate")] [HarmonyPriority(800)] private static IEnumerable TranspilerLU(IEnumerable instructions, ILGenerator generator) { //IL_0510: Unknown result type (might be due to invalid IL or missing references) //IL_0517: Expected O, but got Unknown //IL_055d: Unknown result type (might be due to invalid IL or missing references) //IL_0563: Expected O, but got Unknown //IL_057d: Unknown result type (might be due to invalid IL or missing references) //IL_0583: Expected O, but got Unknown //IL_05c6: Unknown result type (might be due to invalid IL or missing references) //IL_05cc: Expected O, but got Unknown //IL_0615: Unknown result type (might be due to invalid IL or missing references) //IL_061b: Expected O, but got Unknown //IL_0648: Unknown result type (might be due to invalid IL or missing references) //IL_064e: Expected O, but got Unknown //IL_0668: Unknown result type (might be due to invalid IL or missing references) //IL_066e: Expected O, but got Unknown //IL_06a5: Unknown result type (might be due to invalid IL or missing references) //IL_06ab: Expected O, but got Unknown //IL_06b3: Unknown result type (might be due to invalid IL or missing references) //IL_06b9: Expected O, but got Unknown //IL_0702: Unknown result type (might be due to invalid IL or missing references) //IL_0708: Expected O, but got Unknown //IL_074b: Unknown result type (might be due to invalid IL or missing references) //IL_0751: Expected O, but got Unknown //IL_076b: Unknown result type (might be due to invalid IL or missing references) //IL_0771: Expected O, but got Unknown //IL_07a8: Unknown result type (might be due to invalid IL or missing references) //IL_07ae: Expected O, but got Unknown //IL_07b6: Unknown result type (might be due to invalid IL or missing references) //IL_07bc: Expected O, but got Unknown //IL_0805: Unknown result type (might be due to invalid IL or missing references) //IL_080b: Expected O, but got Unknown //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Expected O, but got Unknown //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Expected O, but got Unknown //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Expected O, but got Unknown //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: 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_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: 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_0128: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Expected O, but got Unknown //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Expected O, but got Unknown //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Expected O, but got Unknown //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Expected O, but got Unknown //IL_01d5: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Expected O, but got Unknown //IL_01e3: Unknown result type (might be due to invalid IL or missing references) //IL_01e9: Expected O, but got Unknown //IL_01f6: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Expected O, but got Unknown //IL_0204: Unknown result type (might be due to invalid IL or missing references) //IL_020a: Expected O, but got Unknown //IL_024f: Unknown result type (might be due to invalid IL or missing references) //IL_0255: Expected O, but got Unknown //IL_0296: Unknown result type (might be due to invalid IL or missing references) //IL_029c: Expected O, but got Unknown //IL_02b6: Unknown result type (might be due to invalid IL or missing references) //IL_02bc: Expected O, but got Unknown //IL_02e8: Unknown result type (might be due to invalid IL or missing references) //IL_02ee: Expected O, but got Unknown //IL_0333: Unknown result type (might be due to invalid IL or missing references) //IL_0339: Expected O, but got Unknown //IL_0368: Unknown result type (might be due to invalid IL or missing references) //IL_036e: Expected O, but got Unknown //IL_0388: Unknown result type (might be due to invalid IL or missing references) //IL_038e: Expected O, but got Unknown //IL_03a7: Unknown result type (might be due to invalid IL or missing references) //IL_03ad: Expected O, but got Unknown //IL_03b5: Unknown result type (might be due to invalid IL or missing references) //IL_03bb: Expected O, but got Unknown //IL_0400: Unknown result type (might be due to invalid IL or missing references) //IL_0406: Expected O, but got Unknown //IL_0448: Unknown result type (might be due to invalid IL or missing references) //IL_044e: Expected O, but got Unknown //IL_0468: Unknown result type (might be due to invalid IL or missing references) //IL_046e: Expected O, but got Unknown //IL_0487: Unknown result type (might be due to invalid IL or missing references) //IL_048d: Expected O, but got Unknown //IL_0495: Unknown result type (might be due to invalid IL or missing references) //IL_049b: Expected O, but got Unknown //IL_04e0: Unknown result type (might be due to invalid IL or missing references) //IL_04e6: Expected O, but got Unknown try { CodeMatcher val = new CodeMatcher(instructions, (ILGenerator)null); List list = new List(); Label label = generator.DefineLabel(); Label label2 = generator.DefineLabel(); Label label3 = generator.DefineLabel(); Label label4 = generator.DefineLabel(); val.Start().MatchForward(false, (CodeMatch[])(object)new CodeMatch[1] { new CodeMatch((OpCode?)OpCodes.Ldfld, (object)AccessTools.Field(typeof(StartOfRound), "shipBounds"), (string)null) }).MatchForward(false, (CodeMatch[])(object)new CodeMatch[1] { new CodeMatch((OpCode?)OpCodes.Call, (object)null, (string)null) }); list.AddRange(val.InstructionsWithOffsets(0, 3)); val.Advance(9).InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[9] { new CodeInstruction(OpCodes.Stloc_1, (object)null), new CodeInstruction(OpCodes.Ldloc_1, (object)null), new CodeInstruction(OpCodes.Brtrue, (object)label), new CodeInstruction(OpCodes.Ldarg_0, (object)null), list[0], list[1], list[2], list[3], new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(MelShipBoundsCheck), "IsInShipRooms", (Type[])null, (Type[])null)) }).Advance(4) .Labels.Add(label); val.MatchForward(false, (CodeMatch[])(object)new CodeMatch[1] { new CodeMatch((OpCode?)OpCodes.Ldfld, (object)AccessTools.Field(typeof(StartOfRound), "shipInnerRoomBounds"), (string)null) }).MatchForward(false, (CodeMatch[])(object)new CodeMatch[1] { new CodeMatch((OpCode?)OpCodes.Call, (object)null, (string)null) }).Advance(1) .MatchForward(false, (CodeMatch[])(object)new CodeMatch[1] { new CodeMatch((OpCode?)OpCodes.Call, (object)null, (string)null) }) .Advance(5) .InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[9] { new CodeInstruction(OpCodes.Stloc_3, (object)null), new CodeInstruction(OpCodes.Ldloc_3, (object)null), new CodeInstruction(OpCodes.Brtrue, (object)label2), new CodeInstruction(OpCodes.Ldarg_0, (object)null), list[0], list[1], list[2], list[3], new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(MelShipBoundsCheck), "IsInShipRooms", (Type[])null, (Type[])null)) }) .Advance(1) .Labels.Add(label2); val.MatchForward(false, (CodeMatch[])(object)new CodeMatch[1] { new CodeMatch((OpCode?)OpCodes.Ldfld, (object)AccessTools.Field(typeof(StartOfRound), "shipBounds"), (string)null) }).MatchForward(false, (CodeMatch[])(object)new CodeMatch[1] { new CodeMatch((OpCode?)OpCodes.Brtrue, (object)null, (string)null) }); list.Add(val.Instruction); val.InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[7] { list[4], new CodeInstruction(OpCodes.Ldarg_0, (object)null), list[0], list[1], list[2], list[3], new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(MelShipBoundsCheck), "IsInShipRooms", (Type[])null, (Type[])null)) }); val.MatchForward(false, (CodeMatch[])(object)new CodeMatch[1] { new CodeMatch((OpCode?)OpCodes.Ldfld, (object)AccessTools.Field(typeof(StartOfRound), "shipBounds"), (string)null) }).MatchForward(false, (CodeMatch[])(object)new CodeMatch[1] { new CodeMatch((OpCode?)OpCodes.Brfalse, (object)null, (string)null) }).InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[7] { new CodeInstruction(OpCodes.Brtrue, (object)label3), new CodeInstruction(OpCodes.Ldarg_0, (object)null), list[0], list[1], list[2], list[3], new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(MelShipBoundsCheck), "IsInShipRooms", (Type[])null, (Type[])null)) }) .Advance(1) .Labels.Add(label3); val.MatchForward(false, (CodeMatch[])(object)new CodeMatch[1] { new CodeMatch((OpCode?)OpCodes.Ldfld, (object)AccessTools.Field(typeof(StartOfRound), "shipInnerRoomBounds"), (string)null) }).MatchForward(false, (CodeMatch[])(object)new CodeMatch[1] { new CodeMatch((OpCode?)OpCodes.Brfalse, (object)null, (string)null) }).InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[7] { new CodeInstruction(OpCodes.Brtrue, (object)label4), new CodeInstruction(OpCodes.Ldarg_0, (object)null), list[0], list[1], list[2], list[3], new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(MelShipBoundsCheck), "IsInShipRooms", (Type[])null, (Type[])null)) }) .Advance(1) .Labels.Add(label4); return val.InstructionEnumeration(); } catch { CodeMatcher val2 = new CodeMatcher(instructions, (ILGenerator)null); List list2 = new List(); Label label5 = generator.DefineLabel(); Label label6 = generator.DefineLabel(); val2.Start().MatchForward(false, (CodeMatch[])(object)new CodeMatch[1] { new CodeMatch((OpCode?)OpCodes.Ldfld, (object)AccessTools.Field(typeof(StartOfRound), "shipBounds"), (string)null) }).MatchForward(false, (CodeMatch[])(object)new CodeMatch[1] { new CodeMatch((OpCode?)OpCodes.Brtrue, (object)null, (string)null) }); list2.Add(val2.Instruction); list2.AddRange(val2.InstructionsWithOffsets(-5, -2)); val2.InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[7] { list2[0], new CodeInstruction(OpCodes.Ldarg_0, (object)null), list2[1], list2[2], list2[3], list2[4], new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(MelShipBoundsCheck), "IsInShipRooms", (Type[])null, (Type[])null)) }).MatchForward(false, (CodeMatch[])(object)new CodeMatch[1] { new CodeMatch((OpCode?)OpCodes.Ldfld, (object)AccessTools.Field(typeof(StartOfRound), "shipBounds"), (string)null) }).MatchForward(false, (CodeMatch[])(object)new CodeMatch[1] { new CodeMatch((OpCode?)OpCodes.Brfalse, (object)null, (string)null) }); list2.Clear(); list2.AddRange(val2.InstructionsWithOffsets(-5, -2)); val2.InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[7] { new CodeInstruction(OpCodes.Brtrue, (object)label5), new CodeInstruction(OpCodes.Ldarg_0, (object)null), list2[0], list2[1], list2[2], list2[3], new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(MelShipBoundsCheck), "IsInShipRooms", (Type[])null, (Type[])null)) }).Advance(1).Labels.Add(label5); val2.MatchForward(false, (CodeMatch[])(object)new CodeMatch[1] { new CodeMatch((OpCode?)OpCodes.Ldfld, (object)AccessTools.Field(typeof(StartOfRound), "shipInnerRoomBounds"), (string)null) }).MatchForward(false, (CodeMatch[])(object)new CodeMatch[1] { new CodeMatch((OpCode?)OpCodes.Brfalse, (object)null, (string)null) }); list2.Clear(); list2.AddRange(val2.InstructionsWithOffsets(-5, -2)); val2.InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[7] { new CodeInstruction(OpCodes.Brtrue, (object)label6), new CodeInstruction(OpCodes.Ldarg_0, (object)null), list2[0], list2[1], list2[2], list2[3], new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(MelShipBoundsCheck), "IsInShipRooms", (Type[])null, (Type[])null)) }).Advance(1).Labels.Add(label6); return val2.InstructionEnumeration(); } } [HarmonyTranspiler] [HarmonyPatch(typeof(StartOfRound), "GetValueOfAllScrap")] [HarmonyPriority(800)] private static IEnumerable TranspilerGVOAS(IEnumerable instructions, ILGenerator generator) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Expected O, but got Unknown //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Expected O, but got Unknown //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Expected O, but got Unknown //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Expected O, but got Unknown //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Expected O, but got Unknown //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Expected O, but got Unknown //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Expected O, but got Unknown CodeMatcher val = new CodeMatcher(instructions, (ILGenerator)null); List list = new List(); Label label = generator.DefineLabel(); val.Start().MatchForward(false, (CodeMatch[])(object)new CodeMatch[1] { new CodeMatch((OpCode?)OpCodes.Ldfld, (object)AccessTools.Field(typeof(StartOfRound), "shipInnerRoomBounds"), (string)null) }).MatchForward(false, (CodeMatch[])(object)new CodeMatch[1] { new CodeMatch((OpCode?)OpCodes.Brfalse, (object)null, (string)null) }); list.AddRange(val.InstructionsWithOffsets(-5, -2)); val.InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[8] { new CodeInstruction(OpCodes.Brtrue, (object)label), new CodeInstruction(OpCodes.Ldarg_0, (object)null), new CodeInstruction(OpCodes.Ldloc_0, (object)null), list[0], list[1], list[2], list[3], new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(MelShipBoundsCheck), "IsInShipRooms", (Type[])null, (Type[])null)) }).Advance(1).Labels.Add(label); return val.InstructionEnumeration(); } [HarmonyTranspiler] [HarmonyPatch(typeof(StormyWeather), "PlayThunderEffects")] [HarmonyPriority(800)] private static IEnumerable TranspilerSWPTE(IEnumerable instructions, ILGenerator generator) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Expected O, but got Unknown //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Expected O, but got Unknown //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Expected O, but got Unknown //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Expected O, but got Unknown //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Expected O, but got Unknown //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Expected O, but got Unknown //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Expected O, but got Unknown CodeMatcher val = new CodeMatcher(instructions, (ILGenerator)null); Label label = generator.DefineLabel(); val.Start().MatchForward(false, (CodeMatch[])(object)new CodeMatch[1] { new CodeMatch((OpCode?)OpCodes.Ldfld, (object)AccessTools.Field(typeof(StartOfRound), "shipBounds"), (string)null) }).MatchForward(false, (CodeMatch[])(object)new CodeMatch[1] { new CodeMatch((OpCode?)OpCodes.Brfalse, (object)null, (string)null) }) .InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[4] { new CodeInstruction(OpCodes.Brtrue, (object)label), new CodeInstruction(OpCodes.Ldarg_0, (object)null), new CodeInstruction(OpCodes.Ldarg_1, (object)null), new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(MelShipBoundsCheck), "IsInShipRooms", (Type[])null, (Type[])null)) }) .Advance(1) .Labels.Add(label); return val.InstructionEnumeration(); } } public class MelShipBoundsCheck { public static List roomBounds = new List(); internal bool IsInShipRooms(Vector3 pos) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) foreach (BoxCollider roomBound in roomBounds) { BoxCollider val = roomBound; if (!((Object)(object)val == (Object)null)) { Bounds bounds = ((Collider)val).bounds; if (((Bounds)(ref bounds)).Contains(pos)) { return true; } } } return false; } } public class OnlyOrbitPatch { [HarmonyPrefix] [HarmonyPatch(typeof(StartOfRound), "OnShipLandedMiscEvents")] private static void PreLand(StartOfRound __instance) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) foreach (BoxCollider roomBound in MelShipBoundsCheck.roomBounds) { BoxCollider val = roomBound; if (!((Object)(object)val == (Object)null)) { Bounds bounds = ((Collider)val).bounds; if (((Bounds)(ref bounds)).Contains(((Component)GameNetworkManager.Instance.localPlayerController).transform.position)) { GameNetworkManager.Instance.localPlayerController.TeleportPlayer(__instance.playerSpawnPositions[0].position, false, 0f, false, true); } } } } } public class PocketRoom : MonoBehaviour { public Collider[] roomBounds; public GameObject room; public Vector3 position; public Vector3 rotation; private void Awake() { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)room == (Object)null) { room = ((Component)this).gameObject; } room.transform.parent = StartOfRound.Instance.elevatorTransform; room.transform.localPosition = position; room.transform.localRotation = Quaternion.Euler(rotation); Collider[] array = roomBounds; foreach (Collider item in array) { MelShipBoundsCheck.roomBounds.Add(item); } } private void OnDestroy() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_002b: 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) Collider[] array = roomBounds; foreach (Collider val in array) { Bounds bounds = val.bounds; if (((Bounds)(ref bounds)).Contains(((Component)GameNetworkManager.Instance.localPlayerController).transform.position)) { GameNetworkManager.Instance.localPlayerController.TeleportPlayer(StartOfRound.Instance.playerSpawnPositions[0].position, false, 0f, false, true); break; } MelShipBoundsCheck.roomBounds.Remove(val); } if ((Object)(object)room != (Object)null) { Object.Destroy((Object)(object)room); } } } internal static class PocketRoomCfg { internal static ConfigEntry onlyOrbit; internal static ConfigEntry walkWarp; internal static ConfigEntry warpBlacklist; internal static ConfigEntry largeEmy; internal static ConfigEntry enterTime0; internal static ConfigEntry exitTime0; internal static ConfigEntry enterTime1; internal static ConfigEntry exitTime1; internal static void SetupConfig(ConfigFile config) { onlyOrbit = config.Bind("Customization", "No Room Access When Landed", false, "Toggle if you can only enter rooms when the ship isn't landed. You will be teleported out when the ship fully lands."); walkWarp = config.Bind("Customization", "Walk-In Teleport", true, "Toggle walk-in teleports when not in build mode."); warpBlacklist = config.Bind("Customization", "Enemy Door Warp Blacklist", "SandWorm,ForestGiant,RadMech,Tornado,Guardsman,Cactus Budling,Driftwood Menace,Redwood Titan,Carnivorous Plant,Elder,Ogopogo,T-rex,Stegosaurus", "Prevent most listed enemies from using doors to pocket rooms."); largeEmy = config.Bind("Customization", "Large-Size Enemy List", "MouthDog,Peace Keeper,Monarch", "Enemies considered large-sized for enter and exit times."); enterTime0 = config.Bind("Customization", "Small Enemy Entrance Teleport Time", 2, "How long small enemies need to stand by entrances to teleport."); exitTime0 = config.Bind("Customization", "Small Enemy Exit Teleport Time", 2, "How long small enemies need to stand by exits to teleport."); enterTime1 = config.Bind("Customization", "Large Enemy Entrance Teleport Time", 3, "How long medium enemies need to stand by entrances to teleport."); exitTime1 = config.Bind("Customization", "Large Enemy Exit Teleport Time", 3, "How long medium enemies need to stand by exits to teleport."); } } public class PocketSyncSpawn : MonoBehaviour { public GameObject prefab; private NetworkObject netObj; private void Start() { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) if (GameNetworkManager.Instance.isHostingGame && (Object)(object)prefab != (Object)null) { GameObject val = Object.Instantiate(prefab, ((Component)this).transform.position, ((Component)this).transform.rotation); NetworkObject val2 = default(NetworkObject); if (val.TryGetComponent(ref val2)) { val2.Spawn(false); val2.TrySetParent(StartOfRound.Instance.elevatorTransform, true); netObj = val2; } } } private void OnDestroy() { if (GameNetworkManager.Instance.isHostingGame && (Object)(object)netObj != (Object)null) { netObj.Despawn(true); } } } public class RoomTeleport : NetworkBehaviour { [CompilerGenerated] private sealed class d__13 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public NavMeshAgent agent; public int time; public RoomTeleport <>4__this; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__13(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Expected O, but got Unknown //IL_0072: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds((float)time); <>1__state = 1; return true; case 1: <>1__state = -1; if (<>4__this.teleport || agent.isOnOffMeshLink) { agent.Warp(<>4__this.exitPoint.position); } return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } public Transform entrancePoint; public Transform exitPoint; public bool isExit; private StartOfRound playersManager; [SerializeField] private bool enemyEnter; private bool teleport = false; private bool onlyOrbit; private int teleportTime0; private int teleportTime1; private void Awake() { playersManager = Object.FindObjectOfType(); onlyOrbit = PocketRoomCfg.onlyOrbit.Value; if (enemyEnter) { if (isExit) { teleportTime0 = PocketRoomCfg.exitTime0.Value; teleportTime1 = PocketRoomCfg.exitTime1.Value; } else { teleportTime0 = PocketRoomCfg.enterTime0.Value; teleportTime1 = PocketRoomCfg.enterTime1.Value; } } } private void OnTriggerEnter(Collider other) { PlayerControllerB val = default(PlayerControllerB); EnemyAICollisionDetect val2 = default(EnemyAICollisionDetect); NavMeshAgent agent = default(NavMeshAgent); if (((Component)other).gameObject.CompareTag("Player") && ((Component)other).gameObject.TryGetComponent(ref val) && (Object)(object)val == (Object)(object)GameNetworkManager.Instance.localPlayerController && (HarmonyPatches.walkWarp || ShipBuildModeManager.Instance.InBuildMode)) { TeleportPlayer(val); } else if (enemyEnter && ((Component)other).gameObject.layer == 19 && ((Component)other).TryGetComponent(ref val2) && !HarmonyPatches.blacklist.Contains(val2.mainScript.enemyType) && ((Component)val2.mainScript).TryGetComponent(ref agent)) { if (HarmonyPatches.largeEmy.Contains(val2.mainScript.enemyType)) { ((MonoBehaviour)this).StartCoroutine(TeleportTrigger(agent, teleportTime1)); } else { ((MonoBehaviour)this).StartCoroutine(TeleportTrigger(agent, teleportTime0)); } } } private void OnTriggerStay(Collider other) { if (enemyEnter && ((Component)other).gameObject.layer == 19) { teleport = true; } } private void OnTriggerExit(Collider other) { if (enemyEnter && ((Component)other).gameObject.layer == 19) { teleport = false; } } [IteratorStateMachine(typeof(d__13))] private IEnumerator TeleportTrigger(NavMeshAgent agent, int time) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__13(0) { <>4__this = this, agent = agent, time = time }; } public void TeleportPlayer(PlayerControllerB player) { //IL_002a: 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_004f: 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_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) if (!onlyOrbit || !StartOfRound.Instance.shipHasLanded) { Transform thisPlayerBody = player.thisPlayerBody; player.TeleportPlayer(exitPoint.position, false, 0f, false, true); thisPlayerBody.eulerAngles = new Vector3(thisPlayerBody.eulerAngles.x, exitPoint.eulerAngles.y, thisPlayerBody.eulerAngles.z); TeleportPlayerServerRpc((int)player.playerClientId); player.thisController.SimpleMove(Vector3.zero); } } public void TeleportPlayer() { //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0064: 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_0079: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) if (!onlyOrbit || !StartOfRound.Instance.shipHasLanded) { Transform thisPlayerBody = GameNetworkManager.Instance.localPlayerController.thisPlayerBody; GameNetworkManager.Instance.localPlayerController.TeleportPlayer(exitPoint.position, false, 0f, false, true); thisPlayerBody.eulerAngles = new Vector3(thisPlayerBody.eulerAngles.x, exitPoint.eulerAngles.y, thisPlayerBody.eulerAngles.z); TeleportPlayerServerRpc((int)GameNetworkManager.Instance.localPlayerController.playerClientId); GameNetworkManager.Instance.localPlayerController.thisController.SimpleMove(Vector3.zero); } } [ServerRpc(RequireOwnership = false)] public void TeleportPlayerServerRpc(int playerObj) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Invalid comparison between Unknown and I4 //IL_005f: 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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(685105481u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerObj); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 685105481u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; TeleportPlayerClientRpc(playerObj); } } } [ClientRpc] public void TeleportPlayerClientRpc(int playerObj) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Invalid comparison between Unknown and I4 //IL_005f: 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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(784327969u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerObj); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 784327969u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; if (!((Object)(object)playersManager.allPlayerScripts[playerObj] == (Object)(object)GameNetworkManager.Instance.localPlayerController)) { playersManager.allPlayerScripts[playerObj].TeleportPlayer(exitPoint.position, true, exitPoint.eulerAngles.y, false, true); } } } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } protected override void __initializeRpcs() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown ((NetworkBehaviour)this).__registerRpc(685105481u, new RpcReceiveHandler(__rpc_handler_685105481), "TeleportPlayerServerRpc"); ((NetworkBehaviour)this).__registerRpc(784327969u, new RpcReceiveHandler(__rpc_handler_784327969), "TeleportPlayerClientRpc"); ((NetworkBehaviour)this).__initializeRpcs(); } private static void __rpc_handler_685105481(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: 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_0050: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int playerObj = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref playerObj); target.__rpc_exec_stage = (__RpcExecStage)1; ((RoomTeleport)(object)target).TeleportPlayerServerRpc(playerObj); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_784327969(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: 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_0050: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int playerObj = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref playerObj); target.__rpc_exec_stage = (__RpcExecStage)1; ((RoomTeleport)(object)target).TeleportPlayerClientRpc(playerObj); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "RoomTeleport"; } } public class SoundAPICompat { [HarmonyTranspiler] [HarmonyPatch(typeof(PlayerLocationCondition), "EvaluateWithContext")] private static IEnumerable TranspilerEWC(IEnumerable instructions, ILGenerator generator) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Expected O, but got Unknown //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Expected O, but got Unknown //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Expected O, but got Unknown //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Expected O, but got Unknown //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Expected O, but got Unknown //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Expected O, but got Unknown //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Expected O, but got Unknown CodeMatcher val = new CodeMatcher(instructions, (ILGenerator)null); Label label = generator.DefineLabel(); List list = new List(); List list2 = new List(); val.Start().MatchForward(false, (CodeMatch[])(object)new CodeMatch[1] { new CodeMatch((OpCode?)OpCodes.Ldfld, (object)AccessTools.Field(typeof(StartOfRound), "shipBounds"), (string)null) }).MatchForward(false, (CodeMatch[])(object)new CodeMatch[1] { new CodeMatch((OpCode?)OpCodes.Brfalse, (object)null, (string)null) }); list.AddRange(val.InstructionsWithOffsets(-4, -2)); val.InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[7] { new CodeInstruction(OpCodes.Brtrue_S, (object)label), new CodeInstruction(OpCodes.Ldarg_0, (object)null), new CodeInstruction(OpCodes.Ldarg_1, (object)null), list[0], list[1], list[2], new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(MelShipBoundsCheck), "IsInShipRooms", (Type[])null, (Type[])null)) }).Advance(1).Labels.Add(label); return val.InstructionEnumeration(); } } namespace MelaniePocketRoom { [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("MelanieMelicious.pocketRoomLib", "Melanie Melicious - Pocket Room Library", "2.1.6")] public class Plugin : BaseUnityPlugin { private const string GUID = "MelanieMelicious.pocketRoomLib"; private const string NAME = "Melanie Melicious - Pocket Room Library"; private const string VERSION = "2.1.6"; private readonly Harmony harmony = new Harmony("MelanieMelicious.pocketRoomLib"); internal static ManualLogSource mls; private void Awake() { PocketRoomCfg.SetupConfig(((BaseUnityPlugin)this).Config); mls = Logger.CreateLogSource("MelanieMelicious - Pocket Room Library"); mls = ((BaseUnityPlugin)this).Logger; harmony.PatchAll(typeof(HarmonyPatches)); if (PocketRoomCfg.onlyOrbit.Value) { harmony.PatchAll(typeof(OnlyOrbitPatch)); } if (Chainloader.PluginInfos.ContainsKey("me.loaforc.soundapi.lethalcompany")) { harmony.PatchAll(typeof(SoundAPICompat)); } if (Chainloader.PluginInfos.ContainsKey("com.github.teamxiaolan.dawnlib")) { harmony.PatchAll(typeof(AltSavePatch)); } } } } namespace __GEN { internal class NetworkVariableSerializationHelper { [RuntimeInitializeOnLoadMethod] internal static void InitializeSerialization() { } } } namespace MelMPocketLib.NetcodePatcher { [AttributeUsage(AttributeTargets.Module)] internal class NetcodePatchedAssemblyAttribute : Attribute { } }