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 Scandals Fixes v1.0.7
BepInEx/plugins/scandalsfixes/scandal.scandalsfixes.dll
Decompiled 5 days 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 BepInEx; using BepInEx.Bootstrap; using BepInEx.Logging; using CruiserImproved; using CruiserImproved.Patches; using GameNetcodeStuff; using HarmonyLib; using JLL.Components; using Microsoft.CodeAnalysis; using ScandalsFixes.Patches; using ScandalsFixes.Patches.Compatiblity; using ScandalsFixes.UnPatches; using ScandalsFixes.Utils; using UnityEngine; using UnityEngine.Events; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: IgnoresAccessChecksTo("AmazingAssets.TerrainToMesh")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: IgnoresAccessChecksTo("ClientNetworkTransform")] [assembly: IgnoresAccessChecksTo("com.olegknyazev.softmask")] [assembly: IgnoresAccessChecksTo("DiggC.CruiserImproved")] [assembly: IgnoresAccessChecksTo("DissonanceVoip")] [assembly: IgnoresAccessChecksTo("DunGen")] [assembly: IgnoresAccessChecksTo("DunGen.Integration.ASPP")] [assembly: IgnoresAccessChecksTo("DunGen.Integration.UnityNav")] [assembly: IgnoresAccessChecksTo("EasyTextEffects")] [assembly: IgnoresAccessChecksTo("Facepunch Transport for Netcode for GameObjects")] [assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")] [assembly: IgnoresAccessChecksTo("JLL")] [assembly: IgnoresAccessChecksTo("scandal.scandallib")] [assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")] [assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging")] [assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging.DocCodeExamples")] [assembly: IgnoresAccessChecksTo("Unity.Burst")] [assembly: IgnoresAccessChecksTo("Unity.Burst.Unsafe")] [assembly: IgnoresAccessChecksTo("Unity.Collections")] [assembly: IgnoresAccessChecksTo("Unity.Collections.LowLevel.ILSupport")] [assembly: IgnoresAccessChecksTo("Unity.InputSystem")] [assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")] [assembly: IgnoresAccessChecksTo("Unity.Jobs")] [assembly: IgnoresAccessChecksTo("Unity.Mathematics")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.Common")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.MetricTypes")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStats")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Component")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Configuration")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Implementation")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsReporting")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkProfiler.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkSolutionInterface")] [assembly: IgnoresAccessChecksTo("Unity.Netcode.Components")] [assembly: IgnoresAccessChecksTo("Unity.Netcode.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.Networking.Transport")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Csg")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.KdTree")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Poly2Tri")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Stl")] [assembly: IgnoresAccessChecksTo("Unity.Profiling.Core")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Config.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")] [assembly: IgnoresAccessChecksTo("Unity.Services.Authentication")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Analytics")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Components")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Configuration")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Device")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments.Internal")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Internal")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Networking")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Registration")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Scheduler")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Telemetry")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Threading")] [assembly: IgnoresAccessChecksTo("Unity.Services.QoS")] [assembly: IgnoresAccessChecksTo("Unity.Services.Relay")] [assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")] [assembly: IgnoresAccessChecksTo("Unity.Timeline")] [assembly: IgnoresAccessChecksTo("Unity.VisualEffectGraph.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.XR.CoreUtils")] [assembly: IgnoresAccessChecksTo("Unity.XR.Management")] [assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR")] [assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR.Features.ConformanceAutomation")] [assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR.Features.MetaQuestSupport")] [assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR.Features.MockRuntime")] [assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR.Features.OculusQuestSupport")] [assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR.Features.RuntimeDebugger")] [assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.SpatialTracking")] [assembly: IgnoresAccessChecksTo("UnityEngine.UI")] [assembly: IgnoresAccessChecksTo("UnityEngine.XR.LegacyInputHelpers")] [assembly: AssemblyCompany("scandal.scandalsfixes")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.7.0")] [assembly: AssemblyInformationalVersion("1.0.7")] [assembly: AssemblyProduct("ScandalsFixes")] [assembly: AssemblyTitle("scandal.scandalsfixes")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.7.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 ScandalsFixes { [BepInPlugin("scandal.scandalsfixes", "ScandalsFixes", "1.0.7")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { internal static bool initialized; public static Plugin Instance { get; private set; } internal static ManualLogSource Logger { get; private set; } internal static Harmony? Harmony { get; set; } public void Awake() { if (!initialized) { initialized = true; Logger = ((BaseUnityPlugin)this).Logger; Instance = this; Patch(); LogInfo("scandal.scandalsfixes v1.0.7 has loaded!"); } } internal static void Patch() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown if (Harmony == null) { Harmony = new Harmony("scandal.scandalsfixes"); } LogDebug("Patching..."); CompatibilityUtils.Init(Harmony); Harmony.PatchAll(); if (!CompatibilityUtils.INSTALLED_SCANDALLIB) { Harmony.PatchAll(typeof(BushWolfEnemyPatches)); Harmony.PatchAll(typeof(InteractTriggerPatches)); Harmony.PatchAll(typeof(PlayerControllerBPatches)); Harmony.PatchAll(typeof(StartOfRoundPatches)); } LogDebug("Finished patching!"); } internal static void Unpatch() { LogDebug("Unpatching..."); Harmony? harmony = Harmony; if (harmony != null) { harmony.UnpatchSelf(); } LogDebug("Finished unpatching!"); } [MethodImpl(MethodImplOptions.AggressiveInlining)] internal static void LogMessage(string messageLog) { Logger.LogMessage((object)messageLog); } [MethodImpl(MethodImplOptions.AggressiveInlining)] internal static void LogDebug(string debugLog) { Logger.LogDebug((object)debugLog); } [MethodImpl(MethodImplOptions.AggressiveInlining)] internal static void LogInfo(string infoLog) { Logger.LogInfo((object)infoLog); } [MethodImpl(MethodImplOptions.AggressiveInlining)] internal static void LogWarning(string warningLog) { Logger.LogWarning((object)warningLog); } [MethodImpl(MethodImplOptions.AggressiveInlining)] internal static void LogError(string errorLog) { Logger.LogError((object)errorLog); } } public static class MyPluginInfo { public const string PLUGIN_GUID = "scandal.scandalsfixes"; public const string PLUGIN_NAME = "ScandalsFixes"; public const string PLUGIN_VERSION = "1.0.7"; } } namespace ScandalsFixes.Utils { internal static class CompatibilityUtils { internal const string GUID_CRUISER_IMPROVED = "DiggC.CruiserImproved"; internal const string GUID_JLL = "JacobG5.JLL"; internal const string GUID_SCANDALLIB = "scandal.scandallib"; internal static bool INSTALLED_CRUISER_IMPROVED; internal static bool INSTALLED_JLL; internal static bool INSTALLED_SCANDALLIB; internal static void Init(Harmony harmony) { if (Chainloader.PluginInfos.ContainsKey("DiggC.CruiserImproved")) { INSTALLED_CRUISER_IMPROVED = true; CruiserImprovedUnPatches.CruiserImproved_UnPatch_GrabbableObjectPatch(); Plugin.LogDebug("CROSS-COMPATIBILITY - CruiserImproved detected"); } if (Chainloader.PluginInfos.ContainsKey("scandal.scandallib")) { INSTALLED_SCANDALLIB = true; Plugin.LogDebug("CROSS-COMPATIBILITY - ScandalLib detected"); } if (Chainloader.PluginInfos.ContainsKey("JacobG5.JLL")) { INSTALLED_JLL = true; if (INSTALLED_SCANDALLIB) { Plugin.LogDebug("CROSS-COMPATIBILITY - JLL & ScandalLib detected"); return; } harmony.PatchAll(typeof(JLLPatches)); Plugin.LogDebug("CROSS-COMPATIBILITY - JLL detected"); } } } public class NullMemberException : Exception { private NullMemberException(string message) : base(message) { } public static NullMemberException Method(Type type, string methodName, Type[] parameters = null, Type[] generics = null) { string text = ""; string text2 = ""; if (parameters != null && parameters.Length != 0) { text = string.Join(", ", parameters.Select((Type param) => param.ToString())); } if (generics != null && generics.Length != 0) { text2 = "<" + string.Join(", ", generics.Select((Type param) => param.ToString())) + ">"; } return new NullMemberException("Could not find method " + type.Name + ":" + text2 + methodName + "(" + text + ")"); } public static NullMemberException Field(Type type, string fieldName) { return new NullMemberException("Could not find field " + type.Name + "." + fieldName); } } internal static class PatchUtils { public struct OpcodeMatch { public OpCode opcode; public object operandOrNull; public OpcodeMatch(OpCode opcode) { operandOrNull = null; this.opcode = opcode; } public OpcodeMatch(OpCode opcode, object operand) { operandOrNull = null; this.opcode = opcode; operandOrNull = operand; } } public static bool OperandCompare(object inputOperand, object codeInstructionOperand) { if (inputOperand.Equals(codeInstructionOperand)) { return true; } Type type = codeInstructionOperand.GetType(); if (type == typeof(LocalBuilder)) { return inputOperand.Equals(((LocalBuilder)codeInstructionOperand).LocalIndex); } if (!(inputOperand is IConvertible) || !(codeInstructionOperand is IConvertible)) { return false; } return Convert.ChangeType(inputOperand, codeInstructionOperand.GetType())?.Equals(codeInstructionOperand) ?? false; } public static int LocateCodeSegment(int startIndex, List<CodeInstruction> searchSpace, List<OpcodeMatch> searchFor) { if (startIndex < 0 || startIndex >= searchSpace.Count) { return -1; } int num = 0; for (int i = startIndex; i < searchSpace.Count; i++) { CodeInstruction val = searchSpace[i]; OpcodeMatch opcodeMatch = searchFor[num]; bool flag = val.opcode == opcodeMatch.opcode; if (flag && opcodeMatch.operandOrNull != null) { flag = OperandCompare(opcodeMatch.operandOrNull, val.operand); } if (flag) { num++; if (num == searchFor.Count) { return i - num + 1; } } else { num = 0; } } return -1; } public static string GetAllMaskLayers(LayerMask _mask) { int value = ((LayerMask)(ref _mask)).value; string text = ""; for (int i = 0; i < 32; i++) { if (((1 << i) & value) != 0) { text = text + " " + LayerMask.LayerToName(i); } } return text; } public static bool TryMethod(Type type, string name, out MethodInfo methodInfo) { return TryMethod(type, name, null, null, out methodInfo); } public static bool TryMethod(Type type, string name, Type[] parameters, out MethodInfo methodInfo) { return TryMethod(type, name, parameters, null, out methodInfo); } public static bool TryMethod(Type type, string name, Type[] parameters, Type[] generics, out MethodInfo methodInfo) { if (parameters == null && generics == null) { methodInfo = type.GetMethod(name, AccessTools.all); } else { if (generics == null) { generics = Type.EmptyTypes; } if (parameters == null) { parameters = Type.EmptyTypes; } methodInfo = type.GetMethod(name, generics.Length, AccessTools.all, null, parameters, null); if (generics.Length != 0) { methodInfo = methodInfo.MakeGenericMethod(generics); } } return methodInfo != null; } public static MethodInfo Method(Type type, string name, Type[] parameters = null, Type[] generics = null) { if (!TryMethod(type, name, parameters, generics, out MethodInfo methodInfo)) { throw NullMemberException.Method(type, name, parameters, generics); } return methodInfo; } public static bool TryField(Type type, string name, out FieldInfo fieldInfo) { fieldInfo = AccessTools.Field(type, name); return fieldInfo != null; } public static FieldInfo Field(Type type, string name) { if (!TryField(type, name, out FieldInfo fieldInfo)) { throw NullMemberException.Field(type, name); } return fieldInfo; } } } namespace ScandalsFixes.UnPatches { public static class CruiserImprovedUnPatches { public static void CruiserImproved_UnPatch_GrabbableObjectPatch() { Harmony harmony = CruiserImproved.Instance.harmony; MethodInfo method = typeof(PlayerControllerPatches).GetMethod("PlaceGrabbableObject_Postfix", BindingFlags.Static | BindingFlags.NonPublic); if (method == null) { Plugin.LogError("Could not find 'CruiserImproved.PlaceGrabbableObject_Postfix'!"); } else { harmony.Unpatch((MethodBase)method, (HarmonyPatchType)0, "DiggC.CruiserImproved"); } } } } namespace ScandalsFixes.Patches { public static class BushWolfEnemyPatches { [HarmonyPatch(typeof(BushWolfEnemy), "CancelReelingPlayerIn")] [HarmonyTranspiler] public static IEnumerable<CodeInstruction> BushWolfEnemy_Trans_CancelReelingPlayerIn(IEnumerable<CodeInstruction> instructions) { List<CodeInstruction> list = instructions.ToList(); Plugin.LogDebug("Attempting to transpile 'CancelReelingPlayerIn' for 'BushWolfEnemy'"); FieldInfo operand = PatchUtils.Field(typeof(BushWolfEnemy), "draggingPlayer"); FieldInfo operand2 = PatchUtils.Field(typeof(PlayerControllerB), "inSpecialInteractAnimation"); List<PatchUtils.OpcodeMatch> searchFor = new List<PatchUtils.OpcodeMatch> { new PatchUtils.OpcodeMatch(OpCodes.Ldarg_0), new PatchUtils.OpcodeMatch(OpCodes.Ldfld, operand), new PatchUtils.OpcodeMatch(OpCodes.Ldc_I4_0), new PatchUtils.OpcodeMatch(OpCodes.Stfld, operand2) }; int num = PatchUtils.LocateCodeSegment(0, list, searchFor); if (num == -1) { Plugin.LogError("Failed to transpile 'BushWolfEnemy.CancelReelingPlayerIn'!"); return list; } list.RemoveRange(num, 4); return list; } } public static class InteractTriggerPatches { [HarmonyPatch(typeof(InteractTrigger), "StopSpecialAnimation")] [HarmonyTranspiler] public static IEnumerable<CodeInstruction> InteractTrigger_Trans_StopSpecialAnimation(IEnumerable<CodeInstruction> instructions) { //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: 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 List<CodeInstruction> list = new List<CodeInstruction>(instructions); Plugin.LogDebug("Attempting to transpile 'StopSpecialAnimation' for 'InteractTrigger'"); MethodInfo methodInfo = PatchUtils.Method(typeof(HUDManager), "get_Instance"); FieldInfo operand = PatchUtils.Field(typeof(PlayerControllerB), "isHoldingObject"); MethodInfo methodInfo2 = PatchUtils.Method(typeof(HUDManager), "ClearControlTips"); List<PatchUtils.OpcodeMatch> searchFor = new List<PatchUtils.OpcodeMatch> { new PatchUtils.OpcodeMatch(OpCodes.Ldloc_0), new PatchUtils.OpcodeMatch(OpCodes.Ldfld, operand), new PatchUtils.OpcodeMatch(OpCodes.Brfalse) }; int num = PatchUtils.LocateCodeSegment(0, list, searchFor); if (num == -1) { Plugin.LogError("Could not transpile 'StopSpecialAnimation' on 'InteractTrigger.StopSpecialAnimation'!"); return list; } list.InsertRange(num, new <>z__ReadOnlyArray<CodeInstruction>((CodeInstruction[])(object)new CodeInstruction[2] { new CodeInstruction(OpCodes.Call, (object)methodInfo), new CodeInstruction(OpCodes.Callvirt, (object)methodInfo2) })); return list; } [HarmonyPatch(typeof(InteractTrigger), "StopUsingClientRpc")] [HarmonyTranspiler] public static IEnumerable<CodeInstruction> InteractTrigger_Trans_StopUsingClientRpc(IEnumerable<CodeInstruction> instructions) { //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_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Expected O, but got Unknown List<CodeInstruction> list = new List<CodeInstruction>(instructions); Plugin.LogDebug("Attempting to transpile 'StopUsingClientRpc' for 'InteractTrigger'"); FieldInfo fieldInfo = PatchUtils.Field(typeof(StartOfRound), "allPlayerScripts"); FieldInfo operand = PatchUtils.Field(typeof(PlayerControllerB), "inVehicleAnimation"); MethodInfo methodInfo = PatchUtils.Method(typeof(InteractTriggerPatches), "ClearPlayerOverrideOnInteractTrigger"); List<PatchUtils.OpcodeMatch> searchFor = new List<PatchUtils.OpcodeMatch> { new PatchUtils.OpcodeMatch(OpCodes.Stfld, operand) }; int num = PatchUtils.LocateCodeSegment(0, list, searchFor); if (num == -1) { Plugin.LogError("Could not transpile 'StopUsingClientRpc' for 'InteractTrigger'!"); return list; } num++; list.InsertRange(num, new <>z__ReadOnlyArray<CodeInstruction>((CodeInstruction[])(object)new CodeInstruction[3] { new CodeInstruction(OpCodes.Ldarg_0, (object)null), new CodeInstruction(OpCodes.Ldarg_1, (object)null), new CodeInstruction(OpCodes.Call, (object)methodInfo) })); return list; } [HarmonyPatch(typeof(InteractTrigger), "StopSpecialAnimation")] [HarmonyTranspiler] public static IEnumerable<CodeInstruction> InteractTrigger_Trans_StopSpecialAnimation_ClearPlayerSpecialAnim(IEnumerable<CodeInstruction> instructions) { //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Expected O, but got Unknown //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Expected O, but got Unknown //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Expected O, but got Unknown List<CodeInstruction> list = new List<CodeInstruction>(instructions); Plugin.LogDebug("Attempting to transpile 'StopSpecialAnimation' for 'InteractTrigger'"); FieldInfo operand = PatchUtils.Field(typeof(InteractTrigger), "isPlayingSpecialAnimation"); FieldInfo fieldInfo = PatchUtils.Field(typeof(InteractTrigger), "playerScriptInSpecialAnimation"); List<PatchUtils.OpcodeMatch> searchFor = new List<PatchUtils.OpcodeMatch> { new PatchUtils.OpcodeMatch(OpCodes.Ldarg_0), new PatchUtils.OpcodeMatch(OpCodes.Ldc_I4_0), new PatchUtils.OpcodeMatch(OpCodes.Stfld, operand) }; int num = PatchUtils.LocateCodeSegment(0, list, searchFor); if (num == -1) { Plugin.LogError("Could not transpile 'StopSpecialAnimation' for 'InteractTrigger'!"); return list; } List<Label> list2 = CodeInstructionExtensions.ExtractLabels(list[num]); list.InsertRange(num, new <>z__ReadOnlyArray<CodeInstruction>((CodeInstruction[])(object)new CodeInstruction[3] { CodeInstructionExtensions.WithLabels(new CodeInstruction(OpCodes.Ldarg_0, (object)null), (IEnumerable<Label>)list2), new CodeInstruction(OpCodes.Ldnull, (object)null), new CodeInstruction(OpCodes.Stfld, (object)fieldInfo) })); return list; } [HarmonyPatch(typeof(InteractTrigger), "UpdateUsedByPlayerClientRpc")] [HarmonyTranspiler] public static IEnumerable<CodeInstruction> InteractTrigger_Trans_UpdateUsedByPlayerClientRpc(IEnumerable<CodeInstruction> instructions) { //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Expected O, but got Unknown //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Expected O, but got Unknown //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Expected O, but got Unknown //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Expected O, but got Unknown List<CodeInstruction> list = new List<CodeInstruction>(instructions); Plugin.LogDebug("Attempting to transpile 'UpdateUsedByPlayerClientRpc' for 'InteractTrigger'"); FieldInfo operand = PatchUtils.Field(typeof(InteractTrigger), "onInteractEarlyOtherClients"); MethodInfo methodInfo = PatchUtils.Method(typeof(InteractTriggerPatches), "SetPlayerInSpecialAnimationTrigger"); List<PatchUtils.OpcodeMatch> searchFor = new List<PatchUtils.OpcodeMatch> { new PatchUtils.OpcodeMatch(OpCodes.Ldarg_0), new PatchUtils.OpcodeMatch(OpCodes.Ldfld, operand) }; int num = PatchUtils.LocateCodeSegment(0, list, searchFor); if (num == -1) { Plugin.LogError("Could not transpile 'UpdateUsedByPlayerClientRpc' for 'InteractTrigger'!"); return list; } list.InsertRange(num, new <>z__ReadOnlyArray<CodeInstruction>((CodeInstruction[])(object)new CodeInstruction[4] { new CodeInstruction(OpCodes.Ldarg_0, (object)null), new CodeInstruction(OpCodes.Ldarg_1, (object)null), new CodeInstruction(OpCodes.Call, (object)methodInfo), new CodeInstruction(OpCodes.Ret, (object)null) })); return list; } internal static void SetPlayerInSpecialAnimationTrigger(InteractTrigger trigger, int playerNum) { //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[playerNum]; ((UnityEvent<PlayerControllerB>)(object)trigger.onInteractEarlyOtherClients).Invoke(val); if ((Object)(object)val != (Object)(object)GameNetworkManager.Instance.localPlayerController && (Object)(object)trigger.lockedPlayer == (Object)(object)((Component)GameNetworkManager.Instance.localPlayerController).transform) { Plugin.LogDebug("Client is getting kicked off of InteractTrigger animation"); ((MonoBehaviour)trigger).StopAllCoroutines(); trigger.StopSpecialAnimation(); } if (!((Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)(object)val)) { if (Object.op_Implicit((Object)(object)trigger.overridePlayerParent)) { val.overridePhysicsParent = trigger.overridePlayerParent; } trigger.isPlayingSpecialAnimation = true; trigger.lockedPlayer = val.thisPlayerBody; trigger.playerScriptInSpecialAnimation = val; trigger.playerUsingId = playerNum; if (trigger.setVehicleAnimation) { val.inVehicleAnimation = true; val.syncFullCameraRotation = ((Component)val.gameplayCamera).transform.localEulerAngles; } if (trigger.hidePlayerItem && (Object)(object)val.currentlyHeldObjectServer != (Object)null) { val.currentlyHeldObjectServer.EnableItemMeshes(false); } val.inSpecialInteractAnimation = true; val.currentTriggerInAnimationWith = trigger; if (!trigger.stopAnimationManually) { ((MonoBehaviour)trigger).StartCoroutine(trigger.isSpecialAnimationPlayingTimer(playerNum)); } } } internal static void ClearPlayerOverrideOnInteractTrigger(InteractTrigger trigger, int playerUsing) { PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[playerUsing]; if (Object.op_Implicit((Object)(object)trigger.overridePlayerParent) && (Object)(object)val.overridePhysicsParent == (Object)(object)trigger.overridePlayerParent) { val.overridePhysicsParent = null; } } [HarmonyPatch(typeof(InteractTrigger), "CancelLadderAnimation")] [HarmonyPrefix] public static bool InteractTrigger_Pre_CancelLadderAnimation(InteractTrigger __instance) { return (Object)(object)__instance.playerScriptInSpecialAnimation != (Object)null; } } [HarmonyPatch] public static class PlayAudioAnimationEventPatches { private static bool ShouldPlayAudio(AudioSource audio, AudioClip? audioToPlay = null, bool checkArray = false, AudioClip[]? audioArray = null) { if ((Object)(object)RoundManager.Instance != (Object)null && (Object)(object)audio != (Object)null) { if (!checkArray) { return (Object)(object)audioToPlay != (Object)null; } if (audioArray != null) { return audioArray.Length != 0; } return false; } return false; } [HarmonyPatch(typeof(PlayAudioAnimationEvent), "PlayAudio1")] [HarmonyTranspiler] public static IEnumerable<CodeInstruction> PlayAudioAnimationEvent_Trans_PlayAudio1(IEnumerable<CodeInstruction> instructions) { //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Expected O, but got Unknown //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Expected O, but got Unknown //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Expected O, but got Unknown //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Expected O, but got Unknown //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Expected O, but got Unknown //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Expected O, but got Unknown //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Expected O, but got Unknown //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Expected O, but got Unknown //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Expected O, but got Unknown List<CodeInstruction> list = new List<CodeInstruction>(instructions); Plugin.LogDebug("Attempting to transpile 'PlayAudio1' for 'PlayAudioAnimationEvent'"); FieldInfo fieldInfo = PatchUtils.Field(typeof(PlayAudioAnimationEvent), "audioToPlay"); FieldInfo fieldInfo2 = PatchUtils.Field(typeof(PlayAudioAnimationEvent), "audioClip"); MethodInfo methodInfo = PatchUtils.Method(typeof(PlayAudioAnimationEventPatches), "ShouldPlayAudio"); Label label = default(Label); list[0].labels.Add(label); list.InsertRange(0, new <>z__ReadOnlyArray<CodeInstruction>((CodeInstruction[])(object)new CodeInstruction[9] { new CodeInstruction(OpCodes.Ldarg_0, (object)null), new CodeInstruction(OpCodes.Ldfld, (object)fieldInfo), new CodeInstruction(OpCodes.Ldarg_0, (object)null), new CodeInstruction(OpCodes.Ldfld, (object)fieldInfo2), new CodeInstruction(OpCodes.Ldc_I4_0, (object)null), new CodeInstruction(OpCodes.Ldnull, (object)null), new CodeInstruction(OpCodes.Call, (object)methodInfo), new CodeInstruction(OpCodes.Brtrue, (object)label), new CodeInstruction(OpCodes.Ret, (object)null) })); return list; } [HarmonyPatch(typeof(PlayAudioAnimationEvent), "PlayAudio1RandomClip")] [HarmonyTranspiler] public static IEnumerable<CodeInstruction> PlayAudioAnimationEvent_Trans_PlayAudio1RandomClip(IEnumerable<CodeInstruction> instructions) { //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Expected O, but got Unknown //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Expected O, but got Unknown //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Expected O, but got Unknown //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Expected O, but got Unknown //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Expected O, but got Unknown //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Expected O, but got Unknown //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Expected O, but got Unknown //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Expected O, but got Unknown //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Expected O, but got Unknown List<CodeInstruction> list = new List<CodeInstruction>(instructions); Plugin.LogDebug("Attempting to transpile 'PlayAudio1RandomClip' for 'PlayAudioAnimationEvent'"); FieldInfo fieldInfo = PatchUtils.Field(typeof(PlayAudioAnimationEvent), "audioToPlay"); FieldInfo fieldInfo2 = PatchUtils.Field(typeof(PlayAudioAnimationEvent), "randomClips"); MethodInfo methodInfo = PatchUtils.Method(typeof(PlayAudioAnimationEventPatches), "ShouldPlayAudio"); Label label = default(Label); list[0].labels.Add(label); list.InsertRange(0, new <>z__ReadOnlyArray<CodeInstruction>((CodeInstruction[])(object)new CodeInstruction[9] { new CodeInstruction(OpCodes.Ldarg_0, (object)null), new CodeInstruction(OpCodes.Ldfld, (object)fieldInfo), new CodeInstruction(OpCodes.Ldnull, (object)null), new CodeInstruction(OpCodes.Ldc_I4_1, (object)null), new CodeInstruction(OpCodes.Ldarg_0, (object)null), new CodeInstruction(OpCodes.Ldfld, (object)fieldInfo2), new CodeInstruction(OpCodes.Call, (object)methodInfo), new CodeInstruction(OpCodes.Brtrue, (object)label), new CodeInstruction(OpCodes.Ret, (object)null) })); return list; } [HarmonyPatch(typeof(PlayAudioAnimationEvent), "PlayAudio2RandomClip")] [HarmonyTranspiler] public static IEnumerable<CodeInstruction> PlayAudioAnimationEvent_Trans_PlayAudio2RandomClip(IEnumerable<CodeInstruction> instructions) { //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Expected O, but got Unknown //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Expected O, but got Unknown //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Expected O, but got Unknown //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Expected O, but got Unknown //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Expected O, but got Unknown //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Expected O, but got Unknown //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Expected O, but got Unknown //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Expected O, but got Unknown //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Expected O, but got Unknown List<CodeInstruction> list = new List<CodeInstruction>(instructions); Plugin.LogDebug("Attempting to transpile 'PlayAudio2RandomClip' for 'PlayAudioAnimationEvent'"); FieldInfo fieldInfo = PatchUtils.Field(typeof(PlayAudioAnimationEvent), "audioToPlayB"); FieldInfo fieldInfo2 = PatchUtils.Field(typeof(PlayAudioAnimationEvent), "randomClips2"); MethodInfo methodInfo = PatchUtils.Method(typeof(PlayAudioAnimationEventPatches), "ShouldPlayAudio"); Label label = default(Label); list[0].labels.Add(label); list.InsertRange(0, new <>z__ReadOnlyArray<CodeInstruction>((CodeInstruction[])(object)new CodeInstruction[9] { new CodeInstruction(OpCodes.Ldarg_0, (object)null), new CodeInstruction(OpCodes.Ldfld, (object)fieldInfo), new CodeInstruction(OpCodes.Ldnull, (object)null), new CodeInstruction(OpCodes.Ldc_I4_1, (object)null), new CodeInstruction(OpCodes.Ldarg_0, (object)null), new CodeInstruction(OpCodes.Ldfld, (object)fieldInfo2), new CodeInstruction(OpCodes.Call, (object)methodInfo), new CodeInstruction(OpCodes.Brtrue, (object)label), new CodeInstruction(OpCodes.Ret, (object)null) })); return list; } [HarmonyPatch(typeof(PlayAudioAnimationEvent), "PlayAudioB1")] [HarmonyTranspiler] public static IEnumerable<CodeInstruction> PlayAudioAnimationEvent_Trans_PlayAudioB1(IEnumerable<CodeInstruction> instructions) { //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Expected O, but got Unknown //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Expected O, but got Unknown //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Expected O, but got Unknown //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Expected O, but got Unknown //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Expected O, but got Unknown //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Expected O, but got Unknown //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Expected O, but got Unknown //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Expected O, but got Unknown //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Expected O, but got Unknown List<CodeInstruction> list = new List<CodeInstruction>(instructions); Plugin.LogDebug("Attempting to transpile 'PlayAudioB1' for 'PlayAudioAnimationEvent'"); FieldInfo fieldInfo = PatchUtils.Field(typeof(PlayAudioAnimationEvent), "audioToPlayB"); FieldInfo fieldInfo2 = PatchUtils.Field(typeof(PlayAudioAnimationEvent), "audioClip"); MethodInfo methodInfo = PatchUtils.Method(typeof(PlayAudioAnimationEventPatches), "ShouldPlayAudio"); Label label = default(Label); list[0].labels.Add(label); list.InsertRange(0, new <>z__ReadOnlyArray<CodeInstruction>((CodeInstruction[])(object)new CodeInstruction[9] { new CodeInstruction(OpCodes.Ldarg_0, (object)null), new CodeInstruction(OpCodes.Ldfld, (object)fieldInfo), new CodeInstruction(OpCodes.Ldarg_0, (object)null), new CodeInstruction(OpCodes.Ldfld, (object)fieldInfo2), new CodeInstruction(OpCodes.Ldc_I4_0, (object)null), new CodeInstruction(OpCodes.Ldnull, (object)null), new CodeInstruction(OpCodes.Call, (object)methodInfo), new CodeInstruction(OpCodes.Brtrue, (object)label), new CodeInstruction(OpCodes.Ret, (object)null) })); return list; } [HarmonyPatch(typeof(PlayAudioAnimationEvent), "PlayAudio1Oneshot")] [HarmonyTranspiler] public static IEnumerable<CodeInstruction> PlayAudioAnimationEvent_Trans_PlayAudio1Oneshot(IEnumerable<CodeInstruction> instructions) { //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Expected O, but got Unknown //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Expected O, but got Unknown //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Expected O, but got Unknown //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Expected O, but got Unknown //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Expected O, but got Unknown //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Expected O, but got Unknown //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Expected O, but got Unknown //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Expected O, but got Unknown //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Expected O, but got Unknown List<CodeInstruction> list = new List<CodeInstruction>(instructions); Plugin.LogDebug("Attempting to transpile 'PlayAudio1Oneshot' for 'PlayAudioAnimationEvent'"); FieldInfo fieldInfo = PatchUtils.Field(typeof(PlayAudioAnimationEvent), "audioToPlay"); FieldInfo fieldInfo2 = PatchUtils.Field(typeof(PlayAudioAnimationEvent), "audioClip"); MethodInfo methodInfo = PatchUtils.Method(typeof(PlayAudioAnimationEventPatches), "ShouldPlayAudio"); Label label = default(Label); list[0].labels.Add(label); list.InsertRange(0, new <>z__ReadOnlyArray<CodeInstruction>((CodeInstruction[])(object)new CodeInstruction[9] { new CodeInstruction(OpCodes.Ldarg_0, (object)null), new CodeInstruction(OpCodes.Ldfld, (object)fieldInfo), new CodeInstruction(OpCodes.Ldarg_0, (object)null), new CodeInstruction(OpCodes.Ldfld, (object)fieldInfo2), new CodeInstruction(OpCodes.Ldc_I4_0, (object)null), new CodeInstruction(OpCodes.Ldnull, (object)null), new CodeInstruction(OpCodes.Call, (object)methodInfo), new CodeInstruction(OpCodes.Brtrue, (object)label), new CodeInstruction(OpCodes.Ret, (object)null) })); return list; } [HarmonyPatch(typeof(PlayAudioAnimationEvent), "PlayAudio2")] [HarmonyTranspiler] public static IEnumerable<CodeInstruction> PlayAudioAnimationEvent_Trans_PlayAudio2(IEnumerable<CodeInstruction> instructions) { //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Expected O, but got Unknown //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Expected O, but got Unknown //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Expected O, but got Unknown //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Expected O, but got Unknown //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Expected O, but got Unknown //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Expected O, but got Unknown //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Expected O, but got Unknown //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Expected O, but got Unknown //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Expected O, but got Unknown List<CodeInstruction> list = new List<CodeInstruction>(instructions); Plugin.LogDebug("Attempting to transpile 'PlayAudio2' for 'PlayAudioAnimationEvent'"); FieldInfo fieldInfo = PatchUtils.Field(typeof(PlayAudioAnimationEvent), "audioToPlay"); FieldInfo fieldInfo2 = PatchUtils.Field(typeof(PlayAudioAnimationEvent), "audioClip2"); MethodInfo methodInfo = PatchUtils.Method(typeof(PlayAudioAnimationEventPatches), "ShouldPlayAudio"); Label label = default(Label); list[0].labels.Add(label); list.InsertRange(0, new <>z__ReadOnlyArray<CodeInstruction>((CodeInstruction[])(object)new CodeInstruction[9] { new CodeInstruction(OpCodes.Ldarg_0, (object)null), new CodeInstruction(OpCodes.Ldfld, (object)fieldInfo), new CodeInstruction(OpCodes.Ldarg_0, (object)null), new CodeInstruction(OpCodes.Ldfld, (object)fieldInfo2), new CodeInstruction(OpCodes.Ldc_I4_0, (object)null), new CodeInstruction(OpCodes.Ldnull, (object)null), new CodeInstruction(OpCodes.Call, (object)methodInfo), new CodeInstruction(OpCodes.Brtrue, (object)label), new CodeInstruction(OpCodes.Ret, (object)null) })); return list; } [HarmonyPatch(typeof(PlayAudioAnimationEvent), "PlayAudioB2")] [HarmonyTranspiler] public static IEnumerable<CodeInstruction> PlayAudioAnimationEvent_Trans_PlayAudioB2(IEnumerable<CodeInstruction> instructions) { //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Expected O, but got Unknown //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Expected O, but got Unknown //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Expected O, but got Unknown //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Expected O, but got Unknown //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Expected O, but got Unknown //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Expected O, but got Unknown //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Expected O, but got Unknown //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Expected O, but got Unknown //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Expected O, but got Unknown List<CodeInstruction> list = new List<CodeInstruction>(instructions); Plugin.LogDebug("Attempting to transpile 'PlayAudioB2' for 'PlayAudioAnimationEvent'"); FieldInfo fieldInfo = PatchUtils.Field(typeof(PlayAudioAnimationEvent), "audioToPlayB"); FieldInfo fieldInfo2 = PatchUtils.Field(typeof(PlayAudioAnimationEvent), "audioClip2"); MethodInfo methodInfo = PatchUtils.Method(typeof(PlayAudioAnimationEventPatches), "ShouldPlayAudio"); Label label = default(Label); list[0].labels.Add(label); list.InsertRange(0, new <>z__ReadOnlyArray<CodeInstruction>((CodeInstruction[])(object)new CodeInstruction[9] { new CodeInstruction(OpCodes.Ldarg_0, (object)null), new CodeInstruction(OpCodes.Ldfld, (object)fieldInfo), new CodeInstruction(OpCodes.Ldarg_0, (object)null), new CodeInstruction(OpCodes.Ldfld, (object)fieldInfo2), new CodeInstruction(OpCodes.Ldc_I4_0, (object)null), new CodeInstruction(OpCodes.Ldnull, (object)null), new CodeInstruction(OpCodes.Call, (object)methodInfo), new CodeInstruction(OpCodes.Brtrue, (object)label), new CodeInstruction(OpCodes.Ret, (object)null) })); return list; } [HarmonyPatch(typeof(PlayAudioAnimationEvent), "PlayAudio2Oneshot")] [HarmonyTranspiler] public static IEnumerable<CodeInstruction> PlayAudioAnimationEvent_Trans_PlayAudio2Oneshot(IEnumerable<CodeInstruction> instructions) { //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Expected O, but got Unknown //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Expected O, but got Unknown //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Expected O, but got Unknown //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Expected O, but got Unknown //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Expected O, but got Unknown //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Expected O, but got Unknown //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Expected O, but got Unknown //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Expected O, but got Unknown //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Expected O, but got Unknown List<CodeInstruction> list = new List<CodeInstruction>(instructions); Plugin.LogDebug("Attempting to transpile 'PlayAudio2Oneshot' for 'PlayAudioAnimationEvent'"); FieldInfo fieldInfo = PatchUtils.Field(typeof(PlayAudioAnimationEvent), "audioToPlay"); FieldInfo fieldInfo2 = PatchUtils.Field(typeof(PlayAudioAnimationEvent), "audioClip2"); MethodInfo methodInfo = PatchUtils.Method(typeof(PlayAudioAnimationEventPatches), "ShouldPlayAudio"); Label label = default(Label); list[0].labels.Add(label); list.InsertRange(0, new <>z__ReadOnlyArray<CodeInstruction>((CodeInstruction[])(object)new CodeInstruction[9] { new CodeInstruction(OpCodes.Ldarg_0, (object)null), new CodeInstruction(OpCodes.Ldfld, (object)fieldInfo), new CodeInstruction(OpCodes.Ldarg_0, (object)null), new CodeInstruction(OpCodes.Ldfld, (object)fieldInfo2), new CodeInstruction(OpCodes.Ldc_I4_0, (object)null), new CodeInstruction(OpCodes.Ldnull, (object)null), new CodeInstruction(OpCodes.Call, (object)methodInfo), new CodeInstruction(OpCodes.Brtrue, (object)label), new CodeInstruction(OpCodes.Ret, (object)null) })); return list; } [HarmonyPatch(typeof(PlayAudioAnimationEvent), "PlayAudio3Oneshot")] [HarmonyTranspiler] public static IEnumerable<CodeInstruction> PlayAudioAnimationEvent_Trans_PlayAudio3Oneshot(IEnumerable<CodeInstruction> instructions) { //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Expected O, but got Unknown //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Expected O, but got Unknown //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Expected O, but got Unknown //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Expected O, but got Unknown //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Expected O, but got Unknown //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Expected O, but got Unknown //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Expected O, but got Unknown //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Expected O, but got Unknown //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Expected O, but got Unknown List<CodeInstruction> list = new List<CodeInstruction>(instructions); Plugin.LogDebug("Attempting to transpile 'PlayAudio3Oneshot' for 'PlayAudioAnimationEvent'"); FieldInfo fieldInfo = PatchUtils.Field(typeof(PlayAudioAnimationEvent), "audioToPlay"); FieldInfo fieldInfo2 = PatchUtils.Field(typeof(PlayAudioAnimationEvent), "audioClip3"); MethodInfo methodInfo = PatchUtils.Method(typeof(PlayAudioAnimationEventPatches), "ShouldPlayAudio"); Label label = default(Label); list[0].labels.Add(label); list.InsertRange(0, new <>z__ReadOnlyArray<CodeInstruction>((CodeInstruction[])(object)new CodeInstruction[9] { new CodeInstruction(OpCodes.Ldarg_0, (object)null), new CodeInstruction(OpCodes.Ldfld, (object)fieldInfo), new CodeInstruction(OpCodes.Ldarg_0, (object)null), new CodeInstruction(OpCodes.Ldfld, (object)fieldInfo2), new CodeInstruction(OpCodes.Ldc_I4_0, (object)null), new CodeInstruction(OpCodes.Ldnull, (object)null), new CodeInstruction(OpCodes.Call, (object)methodInfo), new CodeInstruction(OpCodes.Brtrue, (object)label), new CodeInstruction(OpCodes.Ret, (object)null) })); return list; } [HarmonyPatch(typeof(PlayAudioAnimationEvent), "StopAudio")] [HarmonyTranspiler] public static IEnumerable<CodeInstruction> PlayAudioAnimationEvent_Trans_StopAudio(IEnumerable<CodeInstruction> instructions) { //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_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Expected O, but got Unknown //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Expected O, but got Unknown //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Expected O, but got Unknown //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Expected O, but got Unknown //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Expected O, but got Unknown //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Expected O, but got Unknown //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Expected O, but got Unknown //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Expected O, but got Unknown List<CodeInstruction> list = new List<CodeInstruction>(instructions); Plugin.LogDebug("Attempting to transpile 'StopAudio' for 'PlayAudioAnimationEvent'"); FieldInfo fieldInfo = PatchUtils.Field(typeof(PlayAudioAnimationEvent), "audioToPlay"); MethodInfo methodInfo = PatchUtils.Method(typeof(AudioSource), "get_clip"); MethodInfo methodInfo2 = PatchUtils.Method(typeof(PlayAudioAnimationEventPatches), "ShouldPlayAudio"); Label label = default(Label); list[0].labels.Add(label); list.InsertRange(0, new <>z__ReadOnlyArray<CodeInstruction>((CodeInstruction[])(object)new CodeInstruction[10] { new CodeInstruction(OpCodes.Ldarg_0, (object)null), new CodeInstruction(OpCodes.Ldfld, (object)fieldInfo), new CodeInstruction(OpCodes.Ldarg_0, (object)null), new CodeInstruction(OpCodes.Ldfld, (object)fieldInfo), new CodeInstruction(OpCodes.Callvirt, (object)methodInfo), new CodeInstruction(OpCodes.Ldc_I4_0, (object)null), new CodeInstruction(OpCodes.Ldnull, (object)null), new CodeInstruction(OpCodes.Call, (object)methodInfo2), new CodeInstruction(OpCodes.Brtrue, (object)label), new CodeInstruction(OpCodes.Ret, (object)null) })); return list; } [HarmonyPatch(typeof(PlayAudioAnimationEvent), "PauseAudio")] [HarmonyTranspiler] public static IEnumerable<CodeInstruction> PlayAudioAnimationEvent_Trans_PauseAudio(IEnumerable<CodeInstruction> instructions) { //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_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Expected O, but got Unknown //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Expected O, but got Unknown //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Expected O, but got Unknown //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Expected O, but got Unknown //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Expected O, but got Unknown //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Expected O, but got Unknown //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Expected O, but got Unknown //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Expected O, but got Unknown List<CodeInstruction> list = new List<CodeInstruction>(instructions); Plugin.LogDebug("Attempting to transpile 'PauseAudio' for 'PlayAudioAnimationEvent'"); FieldInfo fieldInfo = PatchUtils.Field(typeof(PlayAudioAnimationEvent), "audioToPlay"); MethodInfo methodInfo = PatchUtils.Method(typeof(AudioSource), "get_clip"); MethodInfo methodInfo2 = PatchUtils.Method(typeof(PlayAudioAnimationEventPatches), "ShouldPlayAudio"); Label label = default(Label); list[0].labels.Add(label); list.InsertRange(0, new <>z__ReadOnlyArray<CodeInstruction>((CodeInstruction[])(object)new CodeInstruction[10] { new CodeInstruction(OpCodes.Ldarg_0, (object)null), new CodeInstruction(OpCodes.Ldfld, (object)fieldInfo), new CodeInstruction(OpCodes.Ldarg_0, (object)null), new CodeInstruction(OpCodes.Ldfld, (object)fieldInfo), new CodeInstruction(OpCodes.Callvirt, (object)methodInfo), new CodeInstruction(OpCodes.Ldc_I4_0, (object)null), new CodeInstruction(OpCodes.Ldnull, (object)null), new CodeInstruction(OpCodes.Call, (object)methodInfo2), new CodeInstruction(OpCodes.Brtrue, (object)label), new CodeInstruction(OpCodes.Ret, (object)null) })); return list; } [HarmonyPatch(typeof(PlayAudioAnimationEvent), "PlayAudio1DefaultClip")] [HarmonyTranspiler] public static IEnumerable<CodeInstruction> PlayAudioAnimationEvent_Trans_PlayAudio1DefaultClip(IEnumerable<CodeInstruction> instructions) { //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_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Expected O, but got Unknown //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Expected O, but got Unknown //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Expected O, but got Unknown //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Expected O, but got Unknown //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Expected O, but got Unknown //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Expected O, but got Unknown //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Expected O, but got Unknown //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Expected O, but got Unknown List<CodeInstruction> list = new List<CodeInstruction>(instructions); Plugin.LogDebug("Attempting to transpile 'PlayAudio1DefaultClip' for 'PlayAudioAnimationEvent'"); FieldInfo fieldInfo = PatchUtils.Field(typeof(PlayAudioAnimationEvent), "audioToPlay"); MethodInfo methodInfo = PatchUtils.Method(typeof(AudioSource), "get_clip"); MethodInfo methodInfo2 = PatchUtils.Method(typeof(PlayAudioAnimationEventPatches), "ShouldPlayAudio"); Label label = default(Label); list[0].labels.Add(label); list.InsertRange(0, new <>z__ReadOnlyArray<CodeInstruction>((CodeInstruction[])(object)new CodeInstruction[10] { new CodeInstruction(OpCodes.Ldarg_0, (object)null), new CodeInstruction(OpCodes.Ldfld, (object)fieldInfo), new CodeInstruction(OpCodes.Ldarg_0, (object)null), new CodeInstruction(OpCodes.Ldfld, (object)fieldInfo), new CodeInstruction(OpCodes.Callvirt, (object)methodInfo), new CodeInstruction(OpCodes.Ldc_I4_0, (object)null), new CodeInstruction(OpCodes.Ldnull, (object)null), new CodeInstruction(OpCodes.Call, (object)methodInfo2), new CodeInstruction(OpCodes.Brtrue, (object)label), new CodeInstruction(OpCodes.Ret, (object)null) })); return list; } [HarmonyPatch(typeof(PlayAudioAnimationEvent), "PlayAudio1DefaultClipIfNotPlaying")] [HarmonyTranspiler] public static IEnumerable<CodeInstruction> PlayAudioAnimationEvent_Trans_PlayAudio1DefaultClipIfNotPlaying(IEnumerable<CodeInstruction> instructions) { //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_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Expected O, but got Unknown //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Expected O, but got Unknown //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Expected O, but got Unknown //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Expected O, but got Unknown //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Expected O, but got Unknown //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Expected O, but got Unknown //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Expected O, but got Unknown //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Expected O, but got Unknown List<CodeInstruction> list = new List<CodeInstruction>(instructions); Plugin.LogDebug("Attempting to transpile 'PlayAudio1DefaultClipIfNotPlaying' for 'PlayAudioAnimationEvent'"); FieldInfo fieldInfo = PatchUtils.Field(typeof(PlayAudioAnimationEvent), "audioToPlay"); MethodInfo methodInfo = PatchUtils.Method(typeof(AudioSource), "get_clip"); MethodInfo methodInfo2 = PatchUtils.Method(typeof(PlayAudioAnimationEventPatches), "ShouldPlayAudio"); Label label = default(Label); list[0].labels.Add(label); list.InsertRange(0, new <>z__ReadOnlyArray<CodeInstruction>((CodeInstruction[])(object)new CodeInstruction[10] { new CodeInstruction(OpCodes.Ldarg_0, (object)null), new CodeInstruction(OpCodes.Ldfld, (object)fieldInfo), new CodeInstruction(OpCodes.Ldarg_0, (object)null), new CodeInstruction(OpCodes.Ldfld, (object)fieldInfo), new CodeInstruction(OpCodes.Callvirt, (object)methodInfo), new CodeInstruction(OpCodes.Ldc_I4_0, (object)null), new CodeInstruction(OpCodes.Ldnull, (object)null), new CodeInstruction(OpCodes.Call, (object)methodInfo2), new CodeInstruction(OpCodes.Brtrue, (object)label), new CodeInstruction(OpCodes.Ret, (object)null) })); return list; } } public static class PlayerControllerBPatches { [HarmonyPatch(typeof(PlayerControllerB), "Update")] [HarmonyTranspiler] public static IEnumerable<CodeInstruction> PlayerControllerB_Trans_Update(IEnumerable<CodeInstruction> instructions) { //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Expected O, but got Unknown //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Expected O, but got Unknown List<CodeInstruction> list = new List<CodeInstruction>(instructions); Plugin.LogDebug("Attempting to transpile 'Update' for 'PlayerControllerB'"); FieldInfo operand = PatchUtils.Field(typeof(PlayerControllerB), "teleportingThisFrame"); MethodInfo methodInfo = PatchUtils.Method(typeof(PlayerControllerBPatches), "DecayExternalForcesAutoFade"); List<PatchUtils.OpcodeMatch> searchFor = new List<PatchUtils.OpcodeMatch> { new PatchUtils.OpcodeMatch(OpCodes.Ldarg_0), new PatchUtils.OpcodeMatch(OpCodes.Ldc_I4_0), new PatchUtils.OpcodeMatch(OpCodes.Stfld, operand) }; int num = PatchUtils.LocateCodeSegment(0, list, searchFor); if (num == -1) { Plugin.LogWarning("Could not transpile 'Update' on 'PlayerControllerB.Update'!"); return list; } num += 3; list.InsertRange(num, new <>z__ReadOnlyArray<CodeInstruction>((CodeInstruction[])(object)new CodeInstruction[2] { new CodeInstruction(OpCodes.Ldarg_0, (object)null), new CodeInstruction(OpCodes.Call, (object)methodInfo) })); return list; } internal static void DecayExternalForcesAutoFade(PlayerControllerB player) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: 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) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) if (!player.isClimbingLadder && (player.inVehicleAnimation || player.inSpecialInteractAnimation)) { if (((Vector3)(ref player.externalForces)).magnitude > 0.05f) { player.externalForces = Vector3.Lerp(player.externalForces, Vector3.zero, 2f * Time.deltaTime); } if (((Vector3)(ref player.externalForceAutoFade)).magnitude > 0.05f) { player.externalForceAutoFade = Vector3.Lerp(player.externalForceAutoFade, Vector3.zero, 2f * Time.deltaTime); } } } [HarmonyPatch(typeof(PlayerControllerB), "SetHoverTipAndCurrentInteractTrigger")] [HarmonyTranspiler] public static IEnumerable<CodeInstruction> PlayerControllerB_Trans_SetHoverTipAndCurrentInteractTrigger(IEnumerable<CodeInstruction> instructions) { //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: 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_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Expected O, but got Unknown List<CodeInstruction> list = new List<CodeInstruction>(instructions); if (CompatibilityUtils.INSTALLED_CRUISER_IMPROVED) { Plugin.LogDebug("Skipping HoverTip transpiler as CruiserImproved is present"); return list; } Plugin.LogDebug("Attempting to transpile 'SetHoverTipAndCurrentInteractTrigger' for 'PlayerControllerB'"); MethodInfo operand = PatchUtils.Method(typeof(GameObject), "get_layer"); List<PatchUtils.OpcodeMatch> searchFor = new List<PatchUtils.OpcodeMatch> { new PatchUtils.OpcodeMatch(OpCodes.Callvirt, operand), new PatchUtils.OpcodeMatch(OpCodes.Ldc_I4_S, 30), new PatchUtils.OpcodeMatch(OpCodes.Beq) }; int num = PatchUtils.LocateCodeSegment(0, list, searchFor); if (num == -1) { Plugin.LogWarning("Could not transpile 'SetHoverTipAndCurrentInteractTrigger' on 'PlayerControllerB.SetHoverTipAndCurrentInteractTrigger'!"); return list; } object operand2 = list[num + 2].operand; num += 3; MethodInfo methodInfo = PatchUtils.Method(typeof(PlayerControllerBPatches), "ValidRayHit"); list.InsertRange(num, new <>z__ReadOnlyArray<CodeInstruction>((CodeInstruction[])(object)new CodeInstruction[3] { new CodeInstruction(OpCodes.Ldarg_0, (object)null), new CodeInstruction(OpCodes.Call, (object)methodInfo), new CodeInstruction(OpCodes.Brfalse, operand2) })); return list; } public static bool ValidRayHit(PlayerControllerB player) { string tag = ((Component)((RaycastHit)(ref player.hit)).collider).tag; if (!(tag == "PhysicsProp")) { return tag == "InteractTrigger"; } return true; } } [HarmonyPatch] public static class SoundManagerPatches { [HarmonyPatch(typeof(SoundManager), "PlayNonDiageticSound")] [HarmonyTranspiler] public static IEnumerable<CodeInstruction> SoundManager_Trans_PlayNonDiageticSound(IEnumerable<CodeInstruction> instructions) { //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Expected O, but got Unknown //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Expected O, but got Unknown //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Expected O, but got Unknown //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Expected O, but got Unknown List<CodeInstruction> list = new List<CodeInstruction>(instructions); Plugin.LogDebug("Attempting to transpile 'PlayNonDiageticSound' for 'SoundManager'"); FieldInfo operand = PatchUtils.Field(typeof(SoundManager), "isInsanityMusicPlaying"); MethodInfo methodInfo = PatchUtils.Method(typeof(SoundManagerPatches), "IsAudioNull"); List<PatchUtils.OpcodeMatch> searchFor = new List<PatchUtils.OpcodeMatch> { new PatchUtils.OpcodeMatch(OpCodes.Ldarg_0), new PatchUtils.OpcodeMatch(OpCodes.Ldfld, operand), new PatchUtils.OpcodeMatch(OpCodes.Brtrue) }; int num = PatchUtils.LocateCodeSegment(0, list, searchFor); if (num == -1) { Plugin.LogWarning("Could not transpile 'PlayNonDiageticSound' on 'SoundManager.PlayNonDiageticSound'!"); return list; } Label label = default(Label); list[num].labels.Add(label); list.InsertRange(num, new <>z__ReadOnlyArray<CodeInstruction>((CodeInstruction[])(object)new CodeInstruction[4] { new CodeInstruction(OpCodes.Ldarg_0, (object)null), new CodeInstruction(OpCodes.Call, (object)methodInfo), new CodeInstruction(OpCodes.Brfalse, (object)label), new CodeInstruction(OpCodes.Ret, (object)null) })); return list; } internal static bool IsAudioNull(SoundManager soundManager) { if (!((Object)(object)soundManager.ambienceAudioNonDiagetic == (Object)null) && !((Object)(object)soundManager.currentLevelAmbience == (Object)null)) { return soundManager.currentLevelAmbience.insanityMusicAudios == null; } return true; } } public static class StartOfRoundPatches { [HarmonyPatch(typeof(StartOfRound), "Start")] [HarmonyTranspiler] public static IEnumerable<CodeInstruction> StartOfRound_Trans_Start(IEnumerable<CodeInstruction> instructions) { //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0055: 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_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Expected O, but got Unknown //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Expected O, but got Unknown List<CodeInstruction> list = new List<CodeInstruction>(instructions); Plugin.LogDebug("Attempting to transpile 'Start' for 'StartOfRound'"); MethodInfo methodInfo = PatchUtils.Method(typeof(StartOfRoundPatches), "RefreshPlayerVoiceEffects"); MethodInfo methodInfo2 = PatchUtils.Method(typeof(StartOfRoundPatches), "TryAddRigidBodyToItemScanNodes"); list.InsertRange(0, new <>z__ReadOnlyArray<CodeInstruction>((CodeInstruction[])(object)new CodeInstruction[4] { new CodeInstruction(OpCodes.Ldarg_0, (object)null), new CodeInstruction(OpCodes.Call, (object)methodInfo), new CodeInstruction(OpCodes.Ldarg_0, (object)null), new CodeInstruction(OpCodes.Call, (object)methodInfo2) })); return list; } internal static void TryAddRigidBodyToItemScanNodes(StartOfRound startOfRound) { GrabbableObject val = default(GrabbableObject); Rigidbody val2 = default(Rigidbody); for (int i = 0; i < startOfRound.allItemsList.itemsList.Count; i++) { GameObject spawnPrefab = startOfRound.allItemsList.itemsList[i].spawnPrefab; if (!((Object)(object)spawnPrefab == (Object)null) && spawnPrefab.TryGetComponent<GrabbableObject>(ref val)) { ScanNodeProperties componentInChildren = ((Component)val).GetComponentInChildren<ScanNodeProperties>(); if (Object.op_Implicit((Object)(object)componentInChildren) && !((Component)componentInChildren).TryGetComponent<Rigidbody>(ref val2)) { Rigidbody val3 = ((Component)componentInChildren).gameObject.AddComponent<Rigidbody>(); val3.isKinematic = true; } } } } [HarmonyPatch(typeof(StartOfRound), "EndOfGameClientRpc")] [HarmonyTranspiler] public static IEnumerable<CodeInstruction> StartOfRound_Trans_EndOfGameClientRpc(IEnumerable<CodeInstruction> instructions) { //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Expected O, but got Unknown //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Expected O, but got Unknown List<CodeInstruction> list = new List<CodeInstruction>(instructions); Plugin.LogDebug("Attempting to transpile 'EndOfGameClientRpc' for 'StartOfRound'"); MethodInfo operand = PatchUtils.Method(typeof(SoundManager), "get_Instance"); FieldInfo operand2 = PatchUtils.Field(typeof(SoundManager), "playingOutsideMusic"); MethodInfo methodInfo = PatchUtils.Method(typeof(StartOfRoundPatches), "RefreshPlayerVoiceEffects"); List<PatchUtils.OpcodeMatch> searchFor = new List<PatchUtils.OpcodeMatch> { new PatchUtils.OpcodeMatch(OpCodes.Call, operand), new PatchUtils.OpcodeMatch(OpCodes.Ldc_I4_0), new PatchUtils.OpcodeMatch(OpCodes.Stfld, operand2) }; int num = PatchUtils.LocateCodeSegment(0, list, searchFor); if (num == -1) { Plugin.LogWarning("Could not transpile 'EndOfGameClientRpc' on 'StartOfRound.EndOfGameClientRpc'!"); return list; } list.InsertRange(num, new <>z__ReadOnlyArray<CodeInstruction>((CodeInstruction[])(object)new CodeInstruction[2] { new CodeInstruction(OpCodes.Ldarg_0, (object)null), new CodeInstruction(OpCodes.Call, (object)methodInfo) })); return list; } internal static void RefreshPlayerVoiceEffects(StartOfRound startOfRound) { startOfRound.RefreshPlayerVoicePlaybackObjects(); OccludeAudio val2 = default(OccludeAudio); for (int i = 0; i < startOfRound.allPlayerScripts.Length; i++) { PlayerControllerB val = startOfRound.allPlayerScripts[i]; if ((Object)(object)val == (Object)null || (Object)(object)val.currentVoiceChatIngameSettings?.voiceAudio == (Object)null || !((Component)val.currentVoiceChatIngameSettings.voiceAudio).TryGetComponent<OccludeAudio>(ref val2)) { continue; } if ((Object)(object)val.underwaterCollider != (Object)null) { QuicksandTrigger component = ((Component)val.underwaterCollider).gameObject.GetComponent<QuicksandTrigger>(); if ((Object)(object)component != (Object)null) { component.OnExit(((Component)val).gameObject.GetComponent<Collider>()); } } val.isUnderwater = false; val.isFaceUnderwaterOnServer = false; val.wasUnderwaterLastFrame = false; val.voiceMuffledByEnemy = false; val2.overridingLowPass = false; val2.lowPassOverride = 20000f; } startOfRound.UpdatePlayerVoiceEffects(); } [HarmonyPatch(typeof(StartOfRound), "ResetPlayersLoadedValueClientRpc")] [HarmonyTranspiler] public static IEnumerable<CodeInstruction> StartOfRound_Trans_ResetPlayersLoadedValueClientRpc(IEnumerable<CodeInstruction> instructions) { //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Expected O, but got Unknown //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Expected O, but got Unknown //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Expected O, but got Unknown List<CodeInstruction> list = new List<CodeInstruction>(instructions); Plugin.LogDebug("Attempting to transpile 'ResetPlayersLoadedValueClientRpc' for 'StartOfRound'"); FieldInfo operand = PatchUtils.Field(typeof(StartOfRound), "currentPlanetAnimator"); FieldInfo fieldInfo = PatchUtils.Field(typeof(StartOfRound), "beganLoadingNewLevel"); List<PatchUtils.OpcodeMatch> searchFor = new List<PatchUtils.OpcodeMatch> { new PatchUtils.OpcodeMatch(OpCodes.Ldarg_0), new PatchUtils.OpcodeMatch(OpCodes.Ldfld, operand), new PatchUtils.OpcodeMatch(OpCodes.Ldnull), new PatchUtils.OpcodeMatch(OpCodes.Call), new PatchUtils.OpcodeMatch(OpCodes.Brfalse) }; int num = PatchUtils.LocateCodeSegment(0, list, searchFor); if (num == -1) { Plugin.LogWarning("Could not transpile 'ResetPlayersLoadedValueClientRpc' on 'StartOfRound.ResetPlayersLoadedValueClientRpc'!"); return list; } list.InsertRange(num, new <>z__ReadOnlyArray<CodeInstruction>((CodeInstruction[])(object)new CodeInstruction[3] { new CodeInstruction(OpCodes.Ldarg_0, (object)null), new CodeInstruction(OpCodes.Ldc_I4_1, (object)null), new CodeInstruction(OpCodes.Stfld, (object)fieldInfo) })); return list; } } [HarmonyPatch] public static class VehicleControllerPatches { [HarmonyPatch(typeof(VehicleController), "LoseControlOfVehicle")] [HarmonyTranspiler] public static IEnumerable<CodeInstruction> VehicleController_Trans_LoseControlOfVehicle(IEnumerable<CodeInstruction> instructions) { //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Expected O, but got Unknown //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Expected O, but got Unknown List<CodeInstruction> list = new List<CodeInstruction>(instructions); Plugin.LogDebug("Attempting to transpile 'LoseControlOfVehicle' for 'VehicleController'"); FieldInfo operand = PatchUtils.Field(typeof(PlayerControllerB), "currentlyHeldObjectServer"); FieldInfo operand2 = PatchUtils.Field(typeof(GameNetworkManager), "localPlayerController"); MethodInfo operand3 = PatchUtils.Method(typeof(GameNetworkManager), "get_Instance"); MethodInfo methodInfo = PatchUtils.Method(typeof(HUDManager), "ClearControlTips"); MethodInfo methodInfo2 = PatchUtils.Method(typeof(HUDManager), "get_Instance"); List<PatchUtils.OpcodeMatch> searchFor = new List<PatchUtils.OpcodeMatch> { new PatchUtils.OpcodeMatch(OpCodes.Call, methodInfo2), new PatchUtils.OpcodeMatch(OpCodes.Callvirt, methodInfo) }; int num = PatchUtils.LocateCodeSegment(0, list, searchFor); if (num == -1) { Plugin.LogError("Could not find 'HUDManager.ClearControlTips()' call in 'VehicleController.LoseControlOfVehicle'!"); return list; } List<PatchUtils.OpcodeMatch> searchFor2 = new List<PatchUtils.OpcodeMatch> { new PatchUtils.OpcodeMatch(OpCodes.Call, operand3), new PatchUtils.OpcodeMatch(OpCodes.Ldfld, operand2), new PatchUtils.OpcodeMatch(OpCodes.Ldfld, operand), new PatchUtils.OpcodeMatch(OpCodes.Ldnull), new PatchUtils.OpcodeMatch(OpCodes.Call), new PatchUtils.OpcodeMatch(OpCodes.Brfalse) }; int num2 = PatchUtils.LocateCodeSegment(0, list, searchFor2); if (num2 == -1) { Plugin.LogError("Could not find 'currentlyHeldObjectServer' check in 'VehicleController.LoseControlOfVehicle'!"); return list; } List<Label> labels = list[num].labels; list.RemoveRange(num, 2); list[num].labels.AddRange(labels); List<CodeInstruction> collection = new List<CodeInstruction> { new CodeInstruction(OpCodes.Call, (object)methodInfo2), new CodeInstruction(OpCodes.Callvirt, (object)methodInfo) }; list.InsertRange(num2, collection); return list; } } } namespace ScandalsFixes.Patches.Compatiblity { public static class JLLPatches { [HarmonyPatch(typeof(JBlowerFan), "OnTriggerStay")] [HarmonyTranspiler] public static IEnumerable<CodeInstruction> JBlowerFan_Trans_OnTriggerStay(IEnumerable<CodeInstruction> instructions, ILGenerator generator) { //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Expected O, but got Unknown //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: 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 List<CodeInstruction> list = instructions.ToList(); Plugin.LogDebug("Attempting to transpile 'OnTriggerStay' for 'JBlowerFan'"); MethodInfo methodInfo = AccessTools.Method(typeof(JLLPatches), "ShouldBlowPlayer", (Type[])null, (Type[])null); FieldInfo operand = AccessTools.Field(typeof(PlayerControllerB), "externalForceAutoFade"); List<PatchUtils.OpcodeMatch> searchFor = new List<PatchUtils.OpcodeMatch> { new PatchUtils.OpcodeMatch(OpCodes.Ldloc_0), new PatchUtils.OpcodeMatch(OpCodes.Dup), new PatchUtils.OpcodeMatch(OpCodes.Ldfld, operand) }; int num = PatchUtils.LocateCodeSegment(0, list, searchFor); if (num == -1) { Plugin.LogError("Failed to transpile 'OnTriggerStay' on 'JBlowerFan.OnTriggerStay'!"); return list; } Label label = generator.DefineLabel(); list[num + 10].labels.Add(label); list.InsertRange(num, new <>z__ReadOnlyArray<CodeInstruction>((CodeInstruction[])(object)new CodeInstruction[3] { new CodeInstruction(OpCodes.Ldloc_0, (object)null), new CodeInstruction(OpCodes.Call, (object)methodInfo), new CodeInstruction(OpCodes.Brfalse_S, (object)label) })); return list; } internal static bool ShouldBlowPlayer(PlayerControllerB instance) { return !instance.isInHangarShipRoom; } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } } internal sealed class <>z__ReadOnlyArray<T> : IEnumerable, ICollection, IList, IEnumerable<T>, IReadOnlyCollection<T>, IReadOnlyList<T>, ICollection<T>, IList<T> { int ICollection.Count => _items.Length; bool ICollection.IsSynchronized => false; object ICollection.SyncRoot => this; object IList.this[int index] { get { return _items[index]; } set { throw new NotSupportedException(); } } bool IList.IsFixedSize => true; bool IList.IsReadOnly => true; int IReadOnlyCollection<T>.Count => _items.Length; T IReadOnlyList<T>.this[int index] => _items[index]; int ICollection<T>.Count => _items.Length; bool ICollection<T>.IsReadOnly => true; T IList<T>.this[int index] { get { return _items[index]; } set { throw new NotSupportedException(); } } public <>z__ReadOnlyArray(T[] items) { _items = items; } IEnumerator IEnumerable.GetEnumerator() { return ((IEnumerable)_items).GetEnumerator(); } void ICollection.CopyTo(Array array, int index) { ((ICollection)_items).CopyTo(array, index); } int IList.Add(object value) { throw new NotSupportedException(); } void IList.Clear() { throw new NotSupportedException(); } bool IList.Contains(object value) { return ((IList)_items).Contains(value); } int IList.IndexOf(object value) { return ((IList)_items).IndexOf(value); } void IList.Insert(int index, object value) { throw new NotSupportedException(); } void IList.Remove(object value) { throw new NotSupportedException(); } void IList.RemoveAt(int index) { throw new NotSupportedException(); } IEnumerator<T> IEnumerable<T>.GetEnumerator() { return ((IEnumerable<T>)_items).GetEnumerator(); } void ICollection<T>.Add(T item) { throw new NotSupportedException(); } void ICollection<T>.Clear() { throw new NotSupportedException(); } bool ICollection<T>.Contains(T item) { return ((ICollection<T>)_items).Contains(item); } void ICollection<T>.CopyTo(T[] array, int arrayIndex) { ((ICollection<T>)_items).CopyTo(array, arrayIndex); } bool ICollection<T>.Remove(T item) { throw new NotSupportedException(); } int IList<T>.IndexOf(T item) { return ((IList<T>)_items).IndexOf(item); } void IList<T>.Insert(int index, T item) { throw new NotSupportedException(); } void IList<T>.RemoveAt(int index) { throw new NotSupportedException(); } }