using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; 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.Patches; using GameNetcodeStuff; using HarmonyLib; using Microsoft.CodeAnalysis; using ScandalsTweaks.Compatibility; using ScandalsTweaks.Patches; using ScandalsTweaks.Scripts; using ScandalsTweaks.Utils; using Unity.Netcode; using UnityEngine; using UnityEngine.Audio; using UnityEngine.Events; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [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("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.scandalstweaks")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.2.0.0")] [assembly: AssemblyInformationalVersion("1.2.0")] [assembly: AssemblyProduct("ScandalsTweaks")] [assembly: AssemblyTitle("scandal.scandalstweaks")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.2.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace ScandalsTweaks { [BepInPlugin("scandal.scandalstweaks", "ScandalsTweaks", "1.2.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { public static Plugin Instance { get; private set; } internal static ManualLogSource Logger { get; private set; } internal static Harmony? Harmony { get; set; } public void Awake() { Logger = ((BaseUnityPlugin)this).Logger; Instance = this; LoadAssetBundle(); Patch(); Logger.LogInfo((object)"scandal.scandalstweaks v1.2.0 has loaded!"); } internal void LoadAssetBundle() { AssetBundle val = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "scandalsharedassets")); if ((Object)(object)val == (Object)null) { Logger.LogError((object)"[AssetBundle] Failed to load asset bundle: SharedAssetsBundle"); } } internal static void Patch() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown if (Harmony == null) { Harmony = new Harmony("scandal.scandalstweaks"); } Logger.LogDebug((object)"Patching..."); CompatibilityUtils.Init(Harmony); Harmony.PatchAll(); Logger.LogDebug((object)"Finished patching!"); } internal static void Unpatch() { Logger.LogDebug((object)"Unpatching..."); Harmony? harmony = Harmony; if (harmony != null) { harmony.UnpatchSelf(); } Logger.LogDebug((object)"Finished unpatching!"); } internal static bool IsModPresent(string name) { return Chainloader.PluginInfos.ContainsKey(name); } [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.scandalstweaks"; public const string PLUGIN_NAME = "ScandalsTweaks"; public const string PLUGIN_VERSION = "1.2.0"; } } namespace ScandalsTweaks.Utils { internal class CompatibilityUtils { internal const string GUID_CRUISER_IMPROVED = "DiggC.CruiserImproved"; internal static bool INSTALLED_CRUISER_IMPROVED; internal static void Init(Harmony harmony) { if (Chainloader.PluginInfos.ContainsKey("DiggC.CruiserImproved")) { INSTALLED_CRUISER_IMPROVED = true; CruiserImprovedCompatibility.PatchAllCompatibilityMethods(harmony); Plugin.Logger.LogInfo((object)"CROSS-COMPATIBILITY - CruiserImproved detected"); } } } internal static class GlobalReferences { internal static ParticleSystem? rainParticles; internal static ParticleSystem? rainHitParticles; internal static ParticleSystem? stormyRainParticles; internal static ParticleSystem? stormyRainHitParticles; internal static TriggerModule rainParticlesTrigger = default(TriggerModule); internal static TriggerModule rainHitParticlesTrigger = default(TriggerModule); internal static TriggerModule stormyRainParticlesTrigger = default(TriggerModule); internal static TriggerModule stormyRainHitParticlesTrigger = default(TriggerModule); internal static AudioMixerGroup? diageticSFXGroup; internal static VehicleSeatAnimator? currentPlayerSeat; internal static VehicleController? vehicleController; internal static float timeSinceDemagnetising; internal static GameObject? magnetLever; internal static AnimatedObjectTrigger? magnetTrigger; internal static GameObject? wesleyHurricaneRainObj; internal static ParticleSystem? wesleyHurricaneRainParticles; internal static ParticleSystem? wesleyHurricaneSandParticles; internal static ParticleSystem? wesleyHurricaneRainHitParticles; internal static GameObject? wesleyForsakenRainObj; internal static ParticleSystem? wesleyForsakenRainParticles; internal static ParticleSystem? wesleyForsakenRainHitParticles; internal static bool CRUISER_IMPROVED_INSTALLED = false; } public static class GlobalUtilities { private struct AnimationInfo { public string stateName; public float normalizedTime; } public static readonly int stopAnimationID = Animator.StringToHash("SA_stopAnimation"); private static float[] storedParameters = new float[0]; private static bool[] storedBools = new bool[0]; private static int[] storedInts = new int[0]; private static AnimationInfo[] storedAnimations = new AnimationInfo[0]; public static void ResetHUDToolTips(PlayerControllerB player) { if (!((Object)(object)player == (Object)null) && !player.isPlayerDead && player.isPlayerControlled) { if ((Object)(object)player != (Object)(object)GameNetworkManager.Instance.localPlayerController) { Plugin.LogError("Reset HUD Tooltips called on a non-local player!"); } else if ((Object)(object)player.currentlyHeldObjectServer != (Object)null) { player.currentlyHeldObjectServer.SetControlTipsForItem(); } else { HUDManager.Instance.ClearControlTips(); } } } public static void StoreParameters(Animator playerAnimator) { //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Expected I4, but got Unknown //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) AnimatorControllerParameter[] parameters = playerAnimator.parameters; storedParameters = new float[parameters.Length]; storedBools = new bool[parameters.Length]; storedInts = new int[parameters.Length]; storedAnimations = new AnimationInfo[playerAnimator.layerCount]; for (int i = 0; i < parameters.Length; i++) { AnimatorControllerParameter val = parameters[i]; AnimatorControllerParameterType type = val.type; AnimatorControllerParameterType val2 = type; switch (val2 - 1) { case 0: storedParameters[i] = playerAnimator.GetFloat(val.name); break; case 3: storedBools[i] = playerAnimator.GetBool(val.name); break; case 2: storedInts[i] = playerAnimator.GetInteger(val.name); break; } } for (int j = 0; j < playerAnimator.layerCount; j++) { AnimatorStateInfo currentAnimatorStateInfo = playerAnimator.GetCurrentAnimatorStateInfo(j); AnimationInfo animationInfo = new AnimationInfo { stateName = ((AnimatorStateInfo)(ref currentAnimatorStateInfo)).fullPathHash.ToString(), normalizedTime = ((AnimatorStateInfo)(ref currentAnimatorStateInfo)).normalizedTime }; storedAnimations[j] = animationInfo; } } public static void RestoreParameters(Animator playerAnimator) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Expected I4, but got Unknown AnimatorControllerParameter[] parameters = playerAnimator.parameters; for (int i = 0; i < parameters.Length; i++) { AnimatorControllerParameter val = parameters[i]; AnimatorControllerParameterType type = val.type; AnimatorControllerParameterType val2 = type; switch (val2 - 1) { case 0: playerAnimator.SetFloat(val.name, storedParameters[i]); break; case 3: playerAnimator.SetBool(val.name, storedBools[i]); break; case 2: playerAnimator.SetInteger(val.name, storedInts[i]); break; } } for (int j = 0; j < playerAnimator.layerCount; j++) { AnimationInfo animationInfo = storedAnimations[j]; playerAnimator.Play(int.Parse(animationInfo.stateName), j, animationInfo.normalizedTime); } } public static bool ShouldAllowSightForVehicle(PlayerControllerB player, EnemyAI enemy) { return false; } public static bool IsItRaining() { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Invalid comparison between Unknown and I4 //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Invalid comparison between Unknown and I4 //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Invalid comparison between Unknown and I4 if (((Object)(object)GlobalReferences.wesleyHurricaneRainObj != (Object)null && GlobalReferences.wesleyHurricaneRainObj.activeSelf) || ((Object)(object)GlobalReferences.wesleyForsakenRainObj != (Object)null && GlobalReferences.wesleyForsakenRainObj.activeSelf)) { return true; } return (int)TimeOfDay.Instance.currentLevelWeather == 1 || (int)TimeOfDay.Instance.currentLevelWeather == 4 || (int)TimeOfDay.Instance.currentLevelWeather == 2; } } 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 searchSpace, List 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 ScandalsTweaks.Scripts { public class AudioMixerFixer : MonoBehaviour { public AudioSource[] allAudios = null; public void Awake() { if (!((Object)(object)GlobalReferences.diageticSFXGroup == (Object)null)) { for (int i = 0; i < allAudios.Length; i++) { allAudios[i].outputAudioMixerGroup = GlobalReferences.diageticSFXGroup; } Plugin.LogDebug($"ScandalsTweaks: Corrected output mixer on {allAudios.Length} audios"); } } } public class VehicleSeatAnimator : MonoBehaviour { public RuntimeAnimatorController playerVehicleAnimator = null; private Coroutine specialInteractCoroutine = null; private RuntimeAnimatorController cachedPlayerAnimatorController = null; private Animator thisPlayerAnimator = null; public InteractTrigger seatTrigger = null; public void SetLocalPlayerIntoSeat() { if (specialInteractCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(specialInteractCoroutine); specialInteractCoroutine = null; } specialInteractCoroutine = ((MonoBehaviour)this).StartCoroutine(SpecialInteractAnimation(seatTrigger, GameNetworkManager.Instance.localPlayerController)); } public IEnumerator SpecialInteractAnimation(InteractTrigger seatTrigger, PlayerControllerB playerController) { if ((Object)(object)seatTrigger == (Object)null) { Plugin.Logger.LogError((object)("ScandalsTweaks: No seat found for this trigger? " + ((Object)((Component)this).gameObject).name)); specialInteractCoroutine = null; yield break; } GlobalReferences.currentPlayerSeat = this; SetPlayerAnimations(playerController, isLocalPlayer: true); seatTrigger.UpdateUsedByPlayerServerRpc((int)playerController.playerClientId); seatTrigger.isPlayingSpecialAnimation = true; seatTrigger.lockedPlayer = playerController.thisPlayerBody; seatTrigger.playerScriptInSpecialAnimation = playerController; if (seatTrigger.clampLooking) { seatTrigger.playerScriptInSpecialAnimation.minVerticalClamp = seatTrigger.minVerticalClamp; seatTrigger.playerScriptInSpecialAnimation.maxVerticalClamp = seatTrigger.maxVerticalClamp; seatTrigger.playerScriptInSpecialAnimation.horizontalClamp = seatTrigger.horizontalClamp; seatTrigger.playerScriptInSpecialAnimation.clampLooking = true; } seatTrigger.playerScriptInSpecialAnimation.overridePhysicsParent = seatTrigger.overridePlayerParent; seatTrigger.playerScriptInSpecialAnimation.inVehicleAnimation = true; if (seatTrigger.hidePlayerItem && (Object)(object)seatTrigger.playerScriptInSpecialAnimation.currentlyHeldObjectServer != (Object)null) { seatTrigger.playerScriptInSpecialAnimation.currentlyHeldObjectServer.EnableItemMeshes(false); } playerController.UpdateSpecialAnimationValue(true, (short)seatTrigger.playerPositionNode.eulerAngles.y, 0f, false); playerController.inSpecialInteractAnimation = true; playerController.currentTriggerInAnimationWith = seatTrigger; playerController.playerBodyAnimator.ResetTrigger(GlobalUtilities.stopAnimationID); playerController.playerBodyAnimator.ResetTrigger(seatTrigger.animationString); playerController.playerBodyAnimator.SetTrigger(seatTrigger.animationString); HUDManager.Instance.ClearControlTips(); if (!seatTrigger.stopAnimationManually) { yield return (object)new WaitForSeconds(seatTrigger.animationWaitTime); seatTrigger.StopSpecialAnimation(); } specialInteractCoroutine = null; } public void SetPlayerAnimations(PlayerControllerB playerController, bool isLocalPlayer) { if (!((Object)(object)playerController == (Object)null) && !playerController.isPlayerDead && playerController.isPlayerControlled) { if (isLocalPlayer) { SetPlayerSeated(setSeated: true, playerController); GlobalReferences.currentPlayerSeat = this; UncrouchPlayer(playerController); } ResetPlayerData(playerController); cachedPlayerAnimatorController = null; cachedPlayerAnimatorController = Object.Instantiate(playerController.playerBodyAnimator.runtimeAnimatorController); ((Object)cachedPlayerAnimatorController).name = "metarig"; thisPlayerAnimator = playerController.playerBodyAnimator; if (isLocalPlayer) { GlobalUtilities.StoreParameters(playerController.playerBodyAnimator); } playerController.playerBodyAnimator.runtimeAnimatorController = playerVehicleAnimator; if (!isLocalPlayer) { playerController.playerBodyAnimator.ResetTrigger(GlobalUtilities.stopAnimationID); playerController.playerBodyAnimator.ResetTrigger(seatTrigger.animationString); playerController.playerBodyAnimator.SetTrigger(seatTrigger.animationString); } } } public void ReturnPlayerAnimations(PlayerControllerB playerController, bool isLocalPlayer) { if ((Object)(object)playerController == (Object)null) { return; } if ((Object)(object)cachedPlayerAnimatorController != (Object)null) { playerController.playerBodyAnimator.runtimeAnimatorController = cachedPlayerAnimatorController; if (isLocalPlayer) { GlobalUtilities.RestoreParameters(playerController.playerBodyAnimator); } } else if (isLocalPlayer) { playerController.playerBodyAnimator.runtimeAnimatorController = StartOfRound.Instance.localClientAnimatorController; } else { playerController.playerBodyAnimator.runtimeAnimatorController = StartOfRound.Instance.otherClientsAnimatorController; } if (isLocalPlayer) { playerController.playerBodyAnimator.ResetTrigger(GlobalUtilities.stopAnimationID); SetPlayerSeated(setSeated: false, playerController); UncrouchPlayer(playerController); } ResetPlayerData(playerController); cachedPlayerAnimatorController = null; thisPlayerAnimator = null; } public void OnStopInteract(PlayerControllerB playerController) { ReturnPlayerAnimations(playerController, isLocalPlayer: true); } public virtual void OnPlayerLeaveGame() { } public void Update() { if (!((Object)(object)((NetworkBehaviour)seatTrigger).NetworkManager == (Object)null) && ((NetworkBehaviour)seatTrigger).NetworkManager.IsListening && !((Object)(object)seatTrigger.playerScriptInSpecialAnimation == (Object)null) && !seatTrigger.playerScriptInSpecialAnimation.isPlayerControlled && seatTrigger.playerScriptInSpecialAnimation.disconnectedMidGame) { PlayerControllerB playerScriptInSpecialAnimation = seatTrigger.playerScriptInSpecialAnimation; if (!((Object)(object)playerScriptInSpecialAnimation == (Object)null)) { seatTrigger.StopUsingClientRpc((int)seatTrigger.playerScriptInSpecialAnimation.playerClientId); OnPlayerLeaveGame(); } } } public void UncrouchPlayer(PlayerControllerB player) { player.isCrouching = false; player.playerBodyAnimator.SetBool("crouching", false); } public virtual void ResetPlayerData(PlayerControllerB player) { } public virtual void SetPlayerSeated(bool setSeated, PlayerControllerB localPlayer) { } } } namespace ScandalsTweaks.Patches { [HarmonyPatch(typeof(BaboonBirdAI))] public static class BaboonBirdAI_Patches { [HarmonyPatch("DoAIInterval")] [HarmonyTranspiler] private static IEnumerable DoAIInterval_Transpiler(IEnumerable instructions) { //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Expected O, but got Unknown List list = instructions.ToList(); Plugin.Logger.LogDebug((object)"Attempting to transpile 'DoAIInterval' for 'BaboonBirdAI'"); MethodInfo operand = PatchUtils.Method(typeof(StartOfRound), "get_Instance"); FieldInfo operand2 = PatchUtils.Field(typeof(StartOfRound), "collidersAndRoomMaskAndDefault"); int num = 33554433; List searchFor = new List { new PatchUtils.OpcodeMatch(OpCodes.Call, operand), new PatchUtils.OpcodeMatch(OpCodes.Ldfld, operand2) }; int num2 = PatchUtils.LocateCodeSegment(0, list, searchFor); if (num2 == -1) { Plugin.Logger.LogError((object)"Failed to transpile Raycast mask on 'BaboonBirdAI.DoAIInterval'!"); return list; } list.RemoveRange(num2, 2); list.InsertRange(num2, new <>z__ReadOnlySingleElementList(new CodeInstruction(OpCodes.Ldc_I4, (object)num))); return list; } [HarmonyPatch("DoLOSCheck")] [HarmonyTranspiler] private static IEnumerable DoLOSCheck_Transpiler(IEnumerable instructions) { //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Expected O, but got Unknown //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Expected O, but got Unknown //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Expected O, but got Unknown //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Expected O, but got Unknown //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Expected O, but got Unknown //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Expected O, but got Unknown List list = instructions.ToList(); Plugin.Logger.LogDebug((object)"Attempting to transpile 'DoLOSCheck' for 'BaboonBirdAI'"); MethodInfo operand = PatchUtils.Method(typeof(StartOfRound), "get_Instance"); FieldInfo operand2 = PatchUtils.Field(typeof(StartOfRound), "collidersAndRoomMaskAndDefault"); MethodInfo methodInfo = PatchUtils.Method(typeof(RoundManager), "get_Instance"); FieldInfo fieldInfo = PatchUtils.Field(typeof(RoundManager), "tempColliderResults"); MethodInfo methodInfo2 = PatchUtils.Method(typeof(BaboonBirdAI_Patches), "GetLayerMaskForLineOfSight"); List searchFor = new List { new PatchUtils.OpcodeMatch(OpCodes.Call, operand), new PatchUtils.OpcodeMatch(OpCodes.Ldfld, operand2) }; int num = PatchUtils.LocateCodeSegment(0, list, searchFor); if (num == -1) { Plugin.Logger.LogError((object)"Failed to transpile Linecast mask on 'BaboonBirdAI.DoLOSCheck'!"); return list; } list.RemoveRange(num, 2); list.InsertRange(num, new <>z__ReadOnlyArray((CodeInstruction[])(object)new CodeInstruction[6] { new CodeInstruction(OpCodes.Ldarg_0, (object)null), new CodeInstruction(OpCodes.Call, (object)methodInfo), new CodeInstruction(OpCodes.Ldfld, (object)fieldInfo), new CodeInstruction(OpCodes.Ldloc_S, (object)(byte)11), new CodeInstruction(OpCodes.Ldelem_Ref, (object)null), new CodeInstruction(OpCodes.Call, (object)methodInfo2) })); return list; } public static int GetLayerMaskForLineOfSight(BaboonBirdAI baboonBird, Collider threatCollider) { if ((Object)(object)baboonBird == (Object)null) { return StartOfRound.Instance.collidersAndRoomMaskAndDefault; } if ((Object)(object)threatCollider == (Object)null) { return StartOfRound.Instance.collidersAndRoomMaskAndDefault; } if (((Component)threatCollider).gameObject.layer != 3) { return StartOfRound.Instance.collidersAndRoomMaskAndDefault; } PlayerControllerB player = default(PlayerControllerB); if (!((Component)((Component)threatCollider).transform).TryGetComponent(ref player)) { return StartOfRound.Instance.collidersAndRoomMaskAndDefault; } if (!GlobalUtilities.ShouldAllowSightForVehicle(player, (EnemyAI)(object)baboonBird)) { return StartOfRound.Instance.collidersAndRoomMaskAndDefault; } return 33554433; } } [HarmonyPatch(typeof(EnemyAI))] public static class EnemyAI_Patches { [HarmonyPatch("CheckLineOfSightForPosition")] [HarmonyTranspiler] private static IEnumerable CheckLineOfSightForPosition_Transpiler(IEnumerable instructions) { //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: 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_0139: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Expected O, but got Unknown //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Expected O, but got Unknown List list = instructions.ToList(); Plugin.Logger.LogDebug((object)"Attempting to transpile 'CheckLineOfSightForPosition' for 'EnemyAI'"); MethodInfo operand = PatchUtils.Method(typeof(StartOfRound), "get_Instance"); FieldInfo operand2 = PatchUtils.Field(typeof(StartOfRound), "collidersAndRoomMaskAndDefault"); MethodInfo methodInfo = PatchUtils.Method(typeof(EnemyAI_Patches), "GetLayerMaskForLineOfSight"); List searchFor = new List { new PatchUtils.OpcodeMatch(OpCodes.Call, operand), new PatchUtils.OpcodeMatch(OpCodes.Ldfld, operand2) }; int num = PatchUtils.LocateCodeSegment(0, list, searchFor); if (num == -1) { Plugin.Logger.LogError((object)"Failed to transpile first Linecast mask on 'EnemyAI.CheckLineOfSightForPosition'!"); return list; } list.RemoveRange(num, 2); list.InsertRange(num, new <>z__ReadOnlyArray((CodeInstruction[])(object)new CodeInstruction[2] { new CodeInstruction(OpCodes.Ldarg_0, (object)null), new CodeInstruction(OpCodes.Call, (object)methodInfo) })); int num2 = PatchUtils.LocateCodeSegment(num + 1, list, searchFor); if (num2 == -1) { Plugin.Logger.LogError((object)"Failed to transpile second Linecast mask on 'EnemyAI.CheckLineOfSightForPosition'!"); return list; } list.RemoveRange(num2, 2); list.InsertRange(num2, new <>z__ReadOnlyArray((CodeInstruction[])(object)new CodeInstruction[2] { new CodeInstruction(OpCodes.Ldarg_0, (object)null), new CodeInstruction(OpCodes.Call, (object)methodInfo) })); return list; } [HarmonyPatch(/*Could not decode attribute arguments.*/)] [HarmonyTranspiler] private static IEnumerable CurrentSearchCoroutine_Transpiler(IEnumerable instructions, MethodBase method) { //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Expected O, but got Unknown //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Expected O, but got Unknown //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Expected O, but got Unknown FieldInfo field = method.DeclaringType.GetField("<>4__this", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field == null) { Plugin.Logger.LogError((object)"Failed to find the enumerator field pointing to EnemyAI (<>4__this)"); return instructions; } List list = instructions.ToList(); Plugin.Logger.LogDebug((object)"Attempting to transpile 'CurrentSearchCoroutine' for 'EnemyAI'"); MethodInfo operand = PatchUtils.Method(typeof(StartOfRound), "get_Instance"); FieldInfo operand2 = PatchUtils.Field(typeof(StartOfRound), "collidersAndRoomMaskAndDefault"); MethodInfo methodInfo = PatchUtils.Method(typeof(EnemyAI_Patches), "GetLayerMaskForLineOfSight"); List searchFor = new List { new PatchUtils.OpcodeMatch(OpCodes.Call, operand), new PatchUtils.OpcodeMatch(OpCodes.Ldfld, operand2) }; int num = PatchUtils.LocateCodeSegment(0, list, searchFor); if (num == -1) { Plugin.Logger.LogError((object)"Failed to transpile Linecast mask on 'EnemyAI.CurrentSearchCoroutine'!"); return list; } list.RemoveRange(num, 2); list.InsertRange(num, new <>z__ReadOnlyArray((CodeInstruction[])(object)new CodeInstruction[3] { new CodeInstruction(OpCodes.Ldarg_0, (object)null), new CodeInstruction(OpCodes.Ldfld, (object)field), new CodeInstruction(OpCodes.Call, (object)methodInfo) })); return list; } public static int GetLayerMaskForLineOfSight(EnemyAI enemy) { if (enemy is BaboonBirdAI) { return 33554433; } RadMechAI val = (RadMechAI)(object)((enemy is RadMechAI) ? enemy : null); if (val == null) { return StartOfRound.Instance.collidersAndRoomMaskAndDefault; } if ((Object)(object)val.targetedThreatCollider == (Object)null) { return StartOfRound.Instance.collidersAndRoomMaskAndDefault; } PlayerControllerB player = default(PlayerControllerB); if (!((Component)((Component)val.targetedThreatCollider).transform).TryGetComponent(ref player)) { return StartOfRound.Instance.collidersAndRoomMaskAndDefault; } if (!GlobalUtilities.ShouldAllowSightForVehicle(player, enemy)) { return StartOfRound.Instance.collidersAndRoomMaskAndDefault; } return 33554433; } } [HarmonyPatch(typeof(ForestGiantAI))] public static class ForestGiantAI_Patches { [HarmonyPatch("OnCollideWithPlayer")] [HarmonyTranspiler] private static IEnumerable OnCollideWithPlayer_Transpiler(IEnumerable instructions) { //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Expected O, but got Unknown List list = instructions.ToList(); Plugin.Logger.LogDebug((object)"Attempting to transpile 'OnCollideWithPlayer' for 'ForestGiantAI'"); MethodInfo operand = PatchUtils.Method(typeof(StartOfRound), "get_Instance"); FieldInfo operand2 = PatchUtils.Field(typeof(StartOfRound), "collidersAndRoomMaskAndDefault"); int num = 33554433; List searchFor = new List { new PatchUtils.OpcodeMatch(OpCodes.Call, operand), new PatchUtils.OpcodeMatch(OpCodes.Ldfld, operand2) }; int num2 = PatchUtils.LocateCodeSegment(0, list, searchFor); if (num2 == -1) { Plugin.Logger.LogError((object)"Failed to transpile Linecast mask on 'ForestGiantAI.OnCollideWithPlayer'!"); return list; } list.RemoveRange(num2, 2); list.InsertRange(num2, new <>z__ReadOnlySingleElementList(new CodeInstruction(OpCodes.Ldc_I4, (object)num))); return list; } } [HarmonyPatch(typeof(GiantKiwiAI))] public static class GiantKiwiAI_Patches { [HarmonyPatch("NavigateTowardsTargetPlayer")] [HarmonyTranspiler] private static IEnumerable NavigateTowardsTargetPlayer_Transpiler(IEnumerable instructions, ILGenerator generator) { //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_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Expected O, but got Unknown //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_011a: 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 List list = instructions.ToList(); Plugin.Logger.LogDebug((object)"Attempting to transpile 'NavigateTowardsTargetPlayer' for 'GiantKiwiAI'"); MethodInfo operand = PatchUtils.Method(typeof(Vector3), "Distance"); List searchFor = new List { new PatchUtils.OpcodeMatch(OpCodes.Call, operand), new PatchUtils.OpcodeMatch(OpCodes.Ldc_R4, 10f), new PatchUtils.OpcodeMatch(OpCodes.Bge_Un) }; int num = PatchUtils.LocateCodeSegment(0, list, searchFor); if (num == -1) { Plugin.Logger.LogError((object)"Failed to locate vehicle distance check on 'GiantKiwiAI.NavigateTowardsTargetPlayer'!"); return list; } num += 3; Label label = generator.DefineLabel(); list[num].labels.Add(label); list.InsertRange(num, (IEnumerable)(object)new CodeInstruction[5] { new CodeInstruction(OpCodes.Ldarg_0, (object)null), new CodeInstruction(OpCodes.Ldloc_0, (object)null), new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(GiantKiwiAI_Patches), "CheckTargetPlayerInVehicle", (Type[])null, (Type[])null)), new CodeInstruction(OpCodes.Brfalse_S, (object)label), new CodeInstruction(OpCodes.Ret, (object)null) }); return list; } internal static bool CheckTargetPlayerInVehicle(GiantKiwiAI giantKiwiAi, VehicleController vehicleController) { //IL_0039: 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_004f: 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) if ((Object)(object)((EnemyAI)giantKiwiAi).targetPlayer == (Object)null) { return false; } if (IsTargetPlayerInVehicle(giantKiwiAi, vehicleController)) { giantKiwiAi.targetPlayerIsInTruck = true; ((EnemyAI)giantKiwiAi).destination = RoundManager.Instance.GetNavMeshPosition(((Component)((EnemyAI)giantKiwiAi).targetPlayer).transform.position, RoundManager.Instance.navHit, 5.5f, -33); return true; } return false; } public static bool IsTargetPlayerInVehicle(GiantKiwiAI giantKiwiAi, VehicleController vehicleController) { return false; } } [HarmonyPatch(typeof(InteractTrigger))] public static class InteractTrigger_Patches { [HarmonyPatch("Interact")] [HarmonyPrefix] private static bool Interact_Prefix(InteractTrigger __instance, bool __runOriginal, Transform playerTransform) { if (!__runOriginal) { return false; } PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController; if ((Object)(object)localPlayerController == (Object)null || localPlayerController.isPlayerDead) { return true; } localPlayerController.playerBodyAnimator.ResetTrigger(GlobalUtilities.stopAnimationID); VehicleSeatAnimator vehicleSeatAnimator = default(VehicleSeatAnimator); if (!((Component)__instance).gameObject.TryGetComponent(ref vehicleSeatAnimator)) { return true; } if (__instance.interactCooldown) { if (__instance.currentCooldownValue >= 0f) { return false; } __instance.currentCooldownValue = __instance.cooldownTime; } localPlayerController.ResetFallGravity(); ((UnityEvent)(object)__instance.onInteractEarly).Invoke((PlayerControllerB)null); return false; } [HarmonyPatch("StopSpecialAnimation")] [HarmonyPrefix] private static void StopSpecialAnimation_Prefix(InteractTrigger __instance) { if (__instance.isGettingDestroyed) { return; } PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController; if (!((Object)(object)localPlayerController == (Object)null) && !localPlayerController.isPlayerDead) { localPlayerController.playerBodyAnimator.ResetTrigger(GlobalUtilities.stopAnimationID); VehicleSeatAnimator vehicleSeatAnimator = default(VehicleSeatAnimator); if (((Component)__instance).gameObject.TryGetComponent(ref vehicleSeatAnimator)) { vehicleSeatAnimator.OnStopInteract(localPlayerController); GlobalReferences.currentPlayerSeat = null; } } } } [HarmonyPatch(typeof(Landmine))] public static class Landmine_Patches { public static bool ShouldCheckCustomKnockback() { return false; } public static bool CanPlayerBeKnockedBack() { return true; } public static float CurrentForceMultiplier() { return 1f; } public static bool ShouldDealKnockback(PlayerControllerB instance) { return CanPlayerBeKnockedBack(); } [HarmonyPatch("SpawnExplosion")] [HarmonyTranspiler] private static IEnumerable SpawnExplosion_Transpiler(IEnumerable instructions) { //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Expected O, but got Unknown //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Expected O, but got Unknown //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Expected O, but got Unknown List list = instructions.ToList(); if (CompatibilityUtils.INSTALLED_CRUISER_IMPROVED) { Plugin.Logger.LogDebug((object)"CruiserImproved detected! skipping landmine transpiler!"); return list; } MethodInfo operand = PatchUtils.Method(typeof(Vector3), "get_magnitude"); int num = PatchUtils.LocateCodeSegment(0, list, new List(7) { new PatchUtils.OpcodeMatch(OpCodes.Ldloca_S, 16), new PatchUtils.OpcodeMatch(OpCodes.Call, operand), new PatchUtils.OpcodeMatch(OpCodes.Ldc_R4, 2), new PatchUtils.OpcodeMatch(OpCodes.Ble_Un), new PatchUtils.OpcodeMatch(OpCodes.Ldloca_S, 16), new PatchUtils.OpcodeMatch(OpCodes.Call, operand), new PatchUtils.OpcodeMatch(OpCodes.Ldc_R4, 10) }); if (num == -1) { Plugin.Logger.LogWarning((object)"Could not patch landmine knockback vehicle check!"); return list; } object operand2 = list[num + 3].operand; list.InsertRange(num + 4, new <>z__ReadOnlyArray((CodeInstruction[])(object)new CodeInstruction[3] { new CodeInstruction(OpCodes.Ldloc_S, (object)4), new CodeInstruction(OpCodes.Call, (object)PatchUtils.Method(typeof(Landmine_Patches), "ShouldDealKnockback")), new CodeInstruction(OpCodes.Brfalse_S, operand2) })); return list; } } [HarmonyPatch(typeof(MouthDogAI))] public static class MouthDogAI_Patches { [HarmonyPatch("OnCollideWithPlayer")] [HarmonyTranspiler] private static IEnumerable OnCollideWithPlayer_Transpiler(IEnumerable instructions) { //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Expected O, but got Unknown List list = instructions.ToList(); Plugin.Logger.LogDebug((object)"Attempting to transpile 'OnCollideWithPlayer' for 'MouthDogAI'"); MethodInfo operand = PatchUtils.Method(typeof(StartOfRound), "get_Instance"); FieldInfo operand2 = PatchUtils.Field(typeof(StartOfRound), "collidersAndRoomMask"); int num = 33556736; List searchFor = new List { new PatchUtils.OpcodeMatch(OpCodes.Call, operand), new PatchUtils.OpcodeMatch(OpCodes.Ldfld, operand2) }; int num2 = PatchUtils.LocateCodeSegment(0, list, searchFor); if (num2 == -1) { Plugin.Logger.LogError((object)"Failed to transpile Linecast mask on 'MouthDogAI.OnCollideWithPlayer'!"); return list; } list.RemoveRange(num2, 2); list.InsertRange(num2, new <>z__ReadOnlySingleElementList(new CodeInstruction(OpCodes.Ldc_I4, (object)num))); return list; } [HarmonyPatch("EnterLunge")] [HarmonyTranspiler] private static IEnumerable EnterLunge_Transpiler(IEnumerable instructions) { //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Expected O, but got Unknown List list = instructions.ToList(); Plugin.Logger.LogDebug((object)"Attempting to transpile 'EnterLunge' for 'MouthDogAI'"); MethodInfo operand = PatchUtils.Method(typeof(StartOfRound), "get_Instance"); FieldInfo operand2 = PatchUtils.Field(typeof(StartOfRound), "collidersAndRoomMask"); int num = 33556736; List searchFor = new List { new PatchUtils.OpcodeMatch(OpCodes.Call, operand), new PatchUtils.OpcodeMatch(OpCodes.Ldfld, operand2) }; int num2 = PatchUtils.LocateCodeSegment(0, list, searchFor); if (num2 == -1) { Plugin.Logger.LogError((object)"Failed to transpile Raycast mask on 'MouthDogAI.EnterLunge'!"); return list; } list.RemoveRange(num2, 2); list.InsertRange(num2, new <>z__ReadOnlySingleElementList(new CodeInstruction(OpCodes.Ldc_I4, (object)num))); return list; } } [HarmonyPatch(typeof(PlayAudioAnimationEvent))] public static class PlayAudioAnimationEvent_Patches { [HarmonyPatch("PlayAudio1")] [HarmonyPrefix] private static bool PlayAudio1(PlayAudioAnimationEvent __instance) { if ((Object)(object)RoundManager.Instance == (Object)null) { return false; } if ((Object)(object)__instance.audioToPlay == (Object)null || (Object)(object)__instance.audioClip == (Object)null) { return false; } return true; } [HarmonyPatch("PlayAudio1RandomClip")] [HarmonyPrefix] private static bool PlayAudio1RandomClip(PlayAudioAnimationEvent __instance) { if ((Object)(object)RoundManager.Instance == (Object)null) { return false; } if ((Object)(object)__instance.audioToPlay == (Object)null || __instance.randomClips == null || __instance.randomClips.Length == 0) { return false; } return true; } [HarmonyPatch("PlayAudio2RandomClip")] [HarmonyPrefix] private static bool PlayAudio2RandomClip(PlayAudioAnimationEvent __instance) { if ((Object)(object)RoundManager.Instance == (Object)null) { return false; } if ((Object)(object)__instance.audioToPlayB == (Object)null || __instance.randomClips2 == null || __instance.randomClips2.Length == 0) { return false; } return true; } [HarmonyPatch("PlayAudioB1")] [HarmonyPrefix] private static bool PlayAudioB1(PlayAudioAnimationEvent __instance) { if ((Object)(object)RoundManager.Instance == (Object)null) { return false; } if ((Object)(object)__instance.audioToPlayB == (Object)null || (Object)(object)__instance.audioClip == (Object)null) { return false; } return true; } [HarmonyPatch("PlayAudio1Oneshot")] [HarmonyPrefix] private static bool PlayAudio1Oneshot(PlayAudioAnimationEvent __instance) { if ((Object)(object)RoundManager.Instance == (Object)null) { return false; } if ((Object)(object)__instance.audioToPlay == (Object)null || (Object)(object)__instance.audioClip == (Object)null) { return false; } return true; } [HarmonyPatch("PlayAudio2")] [HarmonyPrefix] private static bool PlayAudio2(PlayAudioAnimationEvent __instance) { if ((Object)(object)__instance.audioToPlay == (Object)null || (Object)(object)__instance.audioClip2 == (Object)null) { return false; } return true; } [HarmonyPatch("PlayAudioB2")] [HarmonyPrefix] private static bool PlayAudioB2(PlayAudioAnimationEvent __instance) { if ((Object)(object)__instance.audioToPlayB == (Object)null || (Object)(object)__instance.audioClip2 == (Object)null) { return false; } return true; } [HarmonyPatch("PlayAudio2Oneshot")] [HarmonyPrefix] private static bool PlayAudio2Oneshot(PlayAudioAnimationEvent __instance) { if ((Object)(object)RoundManager.Instance == (Object)null) { return false; } if ((Object)(object)__instance.audioToPlay == (Object)null || (Object)(object)__instance.audioClip2 == (Object)null) { return false; } return true; } [HarmonyPatch("PlayAudio3Oneshot")] [HarmonyPrefix] private static bool PlayAudio3Oneshot(PlayAudioAnimationEvent __instance) { if ((Object)(object)RoundManager.Instance == (Object)null) { return false; } if ((Object)(object)__instance.audioToPlay == (Object)null || (Object)(object)__instance.audioClip3 == (Object)null) { return false; } return true; } [HarmonyPatch("StopAudio")] [HarmonyPrefix] private static bool StopAudio(PlayAudioAnimationEvent __instance) { if ((Object)(object)__instance.audioToPlay == (Object)null || (Object)(object)__instance.audioToPlay.clip == (Object)null) { return false; } return true; } [HarmonyPatch("PauseAudio")] [HarmonyPrefix] private static bool PauseAudio(PlayAudioAnimationEvent __instance) { if ((Object)(object)__instance.audioToPlay == (Object)null || (Object)(object)__instance.audioToPlay.clip == (Object)null) { return false; } return true; } [HarmonyPatch("PlayAudio1DefaultClip")] [HarmonyPrefix] private static bool PlayAudio1DefaultClip(PlayAudioAnimationEvent __instance) { if ((Object)(object)__instance.audioToPlay == (Object)null || (Object)(object)__instance.audioToPlay.clip == (Object)null) { return false; } return true; } [HarmonyPatch("PlayAudio1DefaultClipIfNotPlaying")] [HarmonyPrefix] private static bool PlayAudio1DefaultClipIfNotPlaying(PlayAudioAnimationEvent __instance) { if ((Object)(object)__instance.audioToPlay == (Object)null || (Object)(object)__instance.audioToPlay.clip == (Object)null) { return false; } return true; } } [HarmonyPatch(typeof(PlayerControllerB))] public static class PlayerControllerB_Patches { [HarmonyPatch("PlaceGrabbableObject")] [HarmonyPostfix] private static void PlaceGrabbableObject_Postfix(GrabbableObject placeObject) { if (!CompatibilityUtils.INSTALLED_CRUISER_IMPROVED) { ScanNodeProperties componentInChildren = ((Component)placeObject).GetComponentInChildren(); if (Object.op_Implicit((Object)(object)componentInChildren) && !Object.op_Implicit((Object)(object)((Component)componentInChildren).GetComponent())) { Rigidbody val = ((Component)componentInChildren).gameObject.AddComponent(); val.isKinematic = true; } } } [HarmonyPatch("ConnectClientToPlayerObject")] [HarmonyPostfix] private static void ConnectClientToPlayerObject_Postfix(PlayerControllerB __instance) { StartOfRound.Instance.UpdatePlayerVoiceEffects(); } [HarmonyPatch("Crouch")] [HarmonyTranspiler] private static IEnumerable OnCollideWithPlayer_Transpiler(IEnumerable instructions) { //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: 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 List list = instructions.ToList(); Plugin.Logger.LogDebug((object)"Attempting to transpile 'Crouch' for 'PlayerControllerB'"); FieldInfo operand = PatchUtils.Field(typeof(PlayerControllerB), "playersManager"); FieldInfo operand2 = PatchUtils.Field(typeof(StartOfRound), "collidersAndRoomMask"); int num = 1107302656; List searchFor = new List { new PatchUtils.OpcodeMatch(OpCodes.Ldfld, operand), new PatchUtils.OpcodeMatch(OpCodes.Ldfld, operand2) }; int num2 = PatchUtils.LocateCodeSegment(0, list, searchFor); if (num2 == -1) { Plugin.Logger.LogError((object)"Failed to transpile Raycast mask on 'PlayerControllerB.Crouch'!"); return list; } list.RemoveRange(num2, 2); list.InsertRange(num2, new <>z__ReadOnlyArray((CodeInstruction[])(object)new CodeInstruction[2] { new CodeInstruction(OpCodes.Pop, (object)null), new CodeInstruction(OpCodes.Ldc_I4, (object)num) })); return list; } [HarmonyPatch("Update")] [HarmonyPrefix] public static void Update_Prefix(PlayerControllerB __instance) { //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0084: 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_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)__instance == (Object)null) && __instance.isPlayerControlled && !__instance.isPlayerDead && !((Object)(object)__instance != (Object)(object)GameNetworkManager.Instance.localPlayerController) && (__instance.inVehicleAnimation || __instance.inSpecialInteractAnimation)) { if (((Vector3)(ref __instance.externalForces)).magnitude > 0.05f) { __instance.externalForces = Vector3.Lerp(__instance.externalForces, Vector3.zero, 2f * Time.deltaTime); } if (((Vector3)(ref __instance.externalForceAutoFade)).magnitude > 0.05f) { __instance.externalForceAutoFade = Vector3.Lerp(__instance.externalForceAutoFade, Vector3.zero, 2f * Time.deltaTime); } } } [HarmonyPatch("SetHoverTipAndCurrentInteractTrigger")] [HarmonyTranspiler] private static IEnumerable SetHoverTipAndCurrentInteractTrigger_Transpiler(IEnumerable instructions) { //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: 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_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Expected O, but got Unknown List list = new List(instructions); MethodInfo operand = PatchUtils.Method(typeof(GameObject), "get_layer"); int num = PatchUtils.LocateCodeSegment(0, list, new List(3) { new PatchUtils.OpcodeMatch(OpCodes.Callvirt, operand), new PatchUtils.OpcodeMatch(OpCodes.Ldc_I4_S, 30), new PatchUtils.OpcodeMatch(OpCodes.Beq) }); if (num == -1) { Plugin.Logger.LogWarning((object)"Could not transpile SetHoverTipAndCurrentInteractTrigger!"); return list; } object operand2 = list[num + 2].operand; num += 3; MethodInfo methodInfo = PatchUtils.Method(typeof(PlayerControllerB_Patches), "ValidRayHit"); list.InsertRange(num, new <>z__ReadOnlyArray((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; } private static bool ValidRayHit(PlayerControllerB player) { string tag = ((Component)((RaycastHit)(ref player.hit)).collider).tag; return tag == "PhysicsProp" || tag == "InteractTrigger"; } } [HarmonyPatch(typeof(RadMechAI))] public static class RadMechAI_Patches { [HarmonyPatch("CheckSightForThreat")] [HarmonyTranspiler] private static IEnumerable CheckSightForThreat_Transpiler(IEnumerable instructions) { //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Expected O, but got Unknown //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Expected O, but got Unknown //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0121: 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_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Expected O, but got Unknown //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Expected O, but got Unknown //IL_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Expected O, but got Unknown //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Expected O, but got Unknown //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Expected O, but got Unknown List list = instructions.ToList(); Plugin.Logger.LogDebug((object)"Attempting to transpile 'CheckSightForThreat' for 'RadMechAI'"); MethodInfo operand = PatchUtils.Method(typeof(StartOfRound), "get_Instance"); FieldInfo operand2 = PatchUtils.Field(typeof(StartOfRound), "collidersAndRoomMaskAndDefault"); MethodInfo methodInfo = PatchUtils.Method(typeof(RoundManager), "get_Instance"); FieldInfo fieldInfo = PatchUtils.Field(typeof(RoundManager), "tempColliderResults"); MethodInfo methodInfo2 = PatchUtils.Method(typeof(RadMechAI_Patches), "GetLayerMaskForLineOfSight"); List searchFor = new List { new PatchUtils.OpcodeMatch(OpCodes.Call, operand), new PatchUtils.OpcodeMatch(OpCodes.Ldfld, operand2) }; int num = PatchUtils.LocateCodeSegment(0, list, searchFor); if (num == -1) { Plugin.Logger.LogError((object)"Failed to transpile first Linecast mask on 'RadMechAI.CheckSightForThreat'!"); return list; } list.RemoveRange(num, 2); list.InsertRange(num, new <>z__ReadOnlyArray((CodeInstruction[])(object)new CodeInstruction[6] { new CodeInstruction(OpCodes.Ldarg_0, (object)null), new CodeInstruction(OpCodes.Call, (object)methodInfo), new CodeInstruction(OpCodes.Ldfld, (object)fieldInfo), new CodeInstruction(OpCodes.Ldloc_S, (object)(byte)5), new CodeInstruction(OpCodes.Ldelem_Ref, (object)null), new CodeInstruction(OpCodes.Call, (object)methodInfo2) })); int num2 = PatchUtils.LocateCodeSegment(num + 1, list, searchFor); if (num2 == -1) { Plugin.Logger.LogError((object)"Failed to transpile second Linecast mask on 'RadMechAI.CheckSightForThreat'!"); return list; } list.RemoveRange(num2, 2); list.InsertRange(num2, new <>z__ReadOnlyArray((CodeInstruction[])(object)new CodeInstruction[3] { new CodeInstruction(OpCodes.Ldarg_0, (object)null), new CodeInstruction(OpCodes.Ldloc_S, (object)(byte)4), new CodeInstruction(OpCodes.Call, (object)methodInfo2) })); return list; } public static int GetLayerMaskForLineOfSight(RadMechAI radMech, Collider threatCollider) { if ((Object)(object)radMech == (Object)null) { return StartOfRound.Instance.collidersAndRoomMaskAndDefault; } if ((Object)(object)threatCollider == (Object)null) { return StartOfRound.Instance.collidersAndRoomMaskAndDefault; } if (((Component)threatCollider).gameObject.layer != 3) { return StartOfRound.Instance.collidersAndRoomMaskAndDefault; } PlayerControllerB player = default(PlayerControllerB); if (!((Component)((Component)threatCollider).transform).TryGetComponent(ref player)) { return StartOfRound.Instance.collidersAndRoomMaskAndDefault; } if (!GlobalUtilities.ShouldAllowSightForVehicle(player, (EnemyAI)(object)radMech)) { return StartOfRound.Instance.collidersAndRoomMaskAndDefault; } return 33554433; } } [HarmonyPatch(typeof(SoundManager))] public static class SoundManager_Patches { [HarmonyPatch("PlayNonDiageticSound")] [HarmonyPrefix] private static bool PlayNonDiageticSound_Prefix(SoundManager __instance) { if (!__instance.isInsanityMusicPlaying && __instance.localPlayerAmbientMusicTimer >= 13f && (__instance.currentLevelAmbience.insanityMusicAudios == null || __instance.currentLevelAmbience.insanityMusicAudios.Length == 0)) { __instance.localPlayerAmbientMusicTimer = 0f; return false; } return true; } [HarmonyPatch("Start")] [HarmonyPrefix] private static void Start_Prefix(SoundManager __instance) { if ((Object)(object)GlobalReferences.diageticSFXGroup == (Object)null) { AudioMixerGroup diageticSFXGroup = __instance.diageticMixer.FindMatchingGroups("Master/SFX")[0]; GlobalReferences.diageticSFXGroup = diageticSFXGroup; } } } [HarmonyPatch(typeof(StartOfRound))] public static class StartOfRound_Patches { [HarmonyPatch("Awake")] [HarmonyPostfix] private static void Awake_Postfix(StartOfRound __instance) { GlobalReferences.magnetLever = GameObject.Find("Environment/HangarShip/MagnetLever"); if (!((Object)(object)GlobalReferences.magnetLever == (Object)null)) { GlobalReferences.magnetTrigger = GlobalReferences.magnetLever.GetComponent(); if (!((Object)(object)GlobalReferences.magnetTrigger == (Object)null)) { FindAndAssignCustomWeather(); } } } private static void FindAndAssignCustomWeather() { //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0252: Unknown result type (might be due to invalid IL or missing references) //IL_0257: Unknown result type (might be due to invalid IL or missing references) //IL_025e: Unknown result type (might be due to invalid IL or missing references) //IL_0263: Unknown result type (might be due to invalid IL or missing references) //IL_027e: Unknown result type (might be due to invalid IL or missing references) //IL_0290: Unknown result type (might be due to invalid IL or missing references) //IL_02a0: Unknown result type (might be due to invalid IL or missing references) //IL_02a5: Unknown result type (might be due to invalid IL or missing references) //IL_02ac: Unknown result type (might be due to invalid IL or missing references) //IL_02b1: Unknown result type (might be due to invalid IL or missing references) GlobalReferences.wesleyHurricaneRainObj = ((IEnumerable)Resources.FindObjectsOfTypeAll()).FirstOrDefault((Func)((GameObject hw) => ((Object)hw).name == "HurricaneWeatherRainEffect(Clone)")); GlobalReferences.wesleyForsakenRainObj = ((IEnumerable)Resources.FindObjectsOfTypeAll()).FirstOrDefault((Func)((GameObject fw) => ((Object)fw).name == "ForsakenWeatherRainEffect(Clone)")); if ((Object)(object)GlobalReferences.wesleyHurricaneRainObj != (Object)null) { GlobalReferences.wesleyHurricaneRainParticles = ((Component)GlobalReferences.wesleyHurricaneRainObj.transform.Find("Particle System (2)")).GetComponent(); GlobalReferences.wesleyHurricaneRainHitParticles = ((Component)GlobalReferences.wesleyHurricaneRainObj.transform.Find("Particle System (2)/RainHitParticle")).GetComponent(); GlobalReferences.wesleyHurricaneSandParticles = ((Component)GlobalReferences.wesleyHurricaneRainObj.transform.Find("SandParticles")).GetComponent(); CollisionModule collision = GlobalReferences.wesleyHurricaneRainParticles.collision; CollisionModule collision2 = GlobalReferences.wesleyHurricaneRainHitParticles.collision; CollisionModule collision3 = GlobalReferences.wesleyHurricaneSandParticles.collision; ((CollisionModule)(ref collision)).enabled = true; ((CollisionModule)(ref collision2)).enabled = true; ((CollisionModule)(ref collision3)).enabled = true; ((CollisionModule)(ref collision)).collidesWith = LayerMask.op_Implicit(1073743104); ((CollisionModule)(ref collision2)).collidesWith = LayerMask.op_Implicit(1073743104); ((CollisionModule)(ref collision3)).collidesWith = LayerMask.op_Implicit(1073743104); TriggerModule trigger = GlobalReferences.wesleyHurricaneRainParticles.trigger; TriggerModule trigger2 = GlobalReferences.wesleyHurricaneRainHitParticles.trigger; TriggerModule trigger3 = GlobalReferences.wesleyHurricaneSandParticles.trigger; ((TriggerModule)(ref trigger)).enabled = true; ((TriggerModule)(ref trigger2)).enabled = true; ((TriggerModule)(ref trigger3)).enabled = true; ((TriggerModule)(ref trigger)).colliderQueryMode = (ParticleSystemColliderQueryMode)1; ((TriggerModule)(ref trigger2)).colliderQueryMode = (ParticleSystemColliderQueryMode)1; ((TriggerModule)(ref trigger3)).colliderQueryMode = (ParticleSystemColliderQueryMode)1; ((TriggerModule)(ref trigger)).enter = (ParticleSystemOverlapAction)1; ((TriggerModule)(ref trigger)).exit = (ParticleSystemOverlapAction)1; ((TriggerModule)(ref trigger)).inside = (ParticleSystemOverlapAction)1; ((TriggerModule)(ref trigger2)).enter = (ParticleSystemOverlapAction)1; ((TriggerModule)(ref trigger2)).exit = (ParticleSystemOverlapAction)1; ((TriggerModule)(ref trigger2)).inside = (ParticleSystemOverlapAction)1; ((TriggerModule)(ref trigger3)).enter = (ParticleSystemOverlapAction)1; ((TriggerModule)(ref trigger3)).exit = (ParticleSystemOverlapAction)1; ((TriggerModule)(ref trigger3)).inside = (ParticleSystemOverlapAction)1; } else { Plugin.Logger.LogWarning((object)"could not find hurricane weather effects!"); } if ((Object)(object)GlobalReferences.wesleyForsakenRainObj != (Object)null) { GlobalReferences.wesleyForsakenRainParticles = ((Component)GlobalReferences.wesleyForsakenRainObj.transform.Find("Particle System")).GetComponent(); GlobalReferences.wesleyForsakenRainHitParticles = ((Component)GlobalReferences.wesleyForsakenRainObj.transform.Find("Particle System/RainHitParticle")).GetComponent(); CollisionModule collision4 = GlobalReferences.wesleyForsakenRainParticles.collision; CollisionModule collision5 = GlobalReferences.wesleyForsakenRainHitParticles.collision; ((CollisionModule)(ref collision4)).enabled = true; ((CollisionModule)(ref collision5)).enabled = true; ((CollisionModule)(ref collision4)).collidesWith = LayerMask.op_Implicit(1073743104); ((CollisionModule)(ref collision5)).collidesWith = LayerMask.op_Implicit(1073743104); TriggerModule trigger4 = GlobalReferences.wesleyForsakenRainParticles.trigger; TriggerModule trigger5 = GlobalReferences.wesleyForsakenRainHitParticles.trigger; ((TriggerModule)(ref trigger4)).enabled = true; ((TriggerModule)(ref trigger5)).enabled = true; ((TriggerModule)(ref trigger4)).colliderQueryMode = (ParticleSystemColliderQueryMode)1; ((TriggerModule)(ref trigger5)).colliderQueryMode = (ParticleSystemColliderQueryMode)1; ((TriggerModule)(ref trigger4)).enter = (ParticleSystemOverlapAction)1; ((TriggerModule)(ref trigger4)).exit = (ParticleSystemOverlapAction)1; ((TriggerModule)(ref trigger4)).inside = (ParticleSystemOverlapAction)1; ((TriggerModule)(ref trigger5)).enter = (ParticleSystemOverlapAction)1; ((TriggerModule)(ref trigger5)).exit = (ParticleSystemOverlapAction)1; ((TriggerModule)(ref trigger5)).inside = (ParticleSystemOverlapAction)1; } else { Plugin.Logger.LogWarning((object)"could not find forsaken weather effects!"); } } [HarmonyPatch("SetMagnetOn")] [HarmonyPrefix] private static void SetMagnetOn_Prefix(StartOfRound __instance, ref bool on) { if (__instance.magnetOn != on && !__instance.magnetOn) { GlobalReferences.timeSinceDemagnetising = Time.realtimeSinceStartup; } } [HarmonyPatch("SetMagnetOnClientRpc")] [HarmonyPrefix] private static void SetMagnetOnClientRpc_Prefix(StartOfRound __instance, ref bool on) { if (__instance.magnetOn != on && !__instance.magnetOn) { GlobalReferences.timeSinceDemagnetising = Time.realtimeSinceStartup; } } } [HarmonyPatch(typeof(Terminal))] public static class Terminal_Patches { [HarmonyPatch("Awake")] [HarmonyPrefix] private static void Awake_Prefix(Terminal __instance) { __instance.terminalNodes.specialNodes[26].displayText = "For the safety of your crew, the Company only allows one vehicle to be in operation at any given time, but a vehicle has been detected.\r\n\r\n"; __instance.terminalNodes.specialNodes[25].displayText = "The delivery pod is busy transporting your vehicle. You cannot purchase items until it arrives.\r\n"; } } [HarmonyPatch(typeof(TimeOfDay))] public static class TimeOfDay_Patches { [HarmonyPatch("Awake")] [HarmonyPrefix] private static void Awake_Prefix(TimeOfDay __instance) { //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) GlobalReferences.rainParticles = ((Component)((Component)__instance).transform.Find("RainParticleContainer/Particle System")).GetComponent(); GlobalReferences.rainHitParticles = ((Component)((Component)__instance).transform.Find("RainParticleContainer/Particle System/RainHitParticle")).GetComponent(); GlobalReferences.stormyRainParticles = ((Component)((Component)__instance).transform.Find("StormyRainParticleContainer/Particle System")).GetComponent(); GlobalReferences.stormyRainHitParticles = ((Component)((Component)__instance).transform.Find("StormyRainParticleContainer/Particle System/RainHitParticle")).GetComponent(); if (!((Object)(object)GlobalReferences.rainParticles == (Object)null) && !((Object)(object)GlobalReferences.rainHitParticles == (Object)null) && !((Object)(object)GlobalReferences.stormyRainParticles == (Object)null) && !((Object)(object)GlobalReferences.stormyRainHitParticles == (Object)null)) { CollisionModule collision = GlobalReferences.rainParticles.collision; CollisionModule collision2 = GlobalReferences.rainHitParticles.collision; CollisionModule collision3 = GlobalReferences.stormyRainParticles.collision; CollisionModule collision4 = GlobalReferences.stormyRainHitParticles.collision; ((CollisionModule)(ref collision)).enabled = true; ((CollisionModule)(ref collision2)).enabled = true; ((CollisionModule)(ref collision3)).enabled = true; ((CollisionModule)(ref collision4)).enabled = true; ((CollisionModule)(ref collision)).collidesWith = LayerMask.op_Implicit(LayerMask.op_Implicit(((CollisionModule)(ref collision)).collidesWith) | 0x40000000); ((CollisionModule)(ref collision2)).collidesWith = LayerMask.op_Implicit(LayerMask.op_Implicit(((CollisionModule)(ref collision2)).collidesWith) | 0x40000000); ((CollisionModule)(ref collision3)).collidesWith = LayerMask.op_Implicit(LayerMask.op_Implicit(((CollisionModule)(ref collision3)).collidesWith) | 0x40000000); ((CollisionModule)(ref collision4)).collidesWith = LayerMask.op_Implicit(LayerMask.op_Implicit(((CollisionModule)(ref collision4)).collidesWith) | 0x40000000); TriggerModule trigger = GlobalReferences.rainParticles.trigger; TriggerModule trigger2 = GlobalReferences.rainHitParticles.trigger; TriggerModule trigger3 = GlobalReferences.stormyRainParticles.trigger; TriggerModule trigger4 = GlobalReferences.stormyRainHitParticles.trigger; ((TriggerModule)(ref trigger)).enabled = true; ((TriggerModule)(ref trigger2)).enabled = true; ((TriggerModule)(ref trigger3)).enabled = true; ((TriggerModule)(ref trigger4)).enabled = true; ((TriggerModule)(ref trigger)).colliderQueryMode = (ParticleSystemColliderQueryMode)1; ((TriggerModule)(ref trigger2)).colliderQueryMode = (ParticleSystemColliderQueryMode)1; ((TriggerModule)(ref trigger3)).colliderQueryMode = (ParticleSystemColliderQueryMode)1; ((TriggerModule)(ref trigger4)).colliderQueryMode = (ParticleSystemColliderQueryMode)1; ((TriggerModule)(ref trigger)).enter = (ParticleSystemOverlapAction)1; ((TriggerModule)(ref trigger)).exit = (ParticleSystemOverlapAction)1; ((TriggerModule)(ref trigger)).inside = (ParticleSystemOverlapAction)1; ((TriggerModule)(ref trigger2)).enter = (ParticleSystemOverlapAction)1; ((TriggerModule)(ref trigger2)).exit = (ParticleSystemOverlapAction)1; ((TriggerModule)(ref trigger2)).inside = (ParticleSystemOverlapAction)1; ((TriggerModule)(ref trigger3)).enter = (ParticleSystemOverlapAction)1; ((TriggerModule)(ref trigger3)).exit = (ParticleSystemOverlapAction)1; ((TriggerModule)(ref trigger3)).inside = (ParticleSystemOverlapAction)1; ((TriggerModule)(ref trigger4)).enter = (ParticleSystemOverlapAction)1; ((TriggerModule)(ref trigger4)).exit = (ParticleSystemOverlapAction)1; ((TriggerModule)(ref trigger4)).inside = (ParticleSystemOverlapAction)1; } } } [HarmonyPatch(typeof(VehicleController))] public static class VehicleController_Patches { [HarmonyPatch("Awake")] [HarmonyPostfix] private static void Awake_Postfix(VehicleController __instance) { GlobalReferences.vehicleController = __instance; } } } namespace ScandalsTweaks.Compatibility { public class CruiserImprovedCompatibility { [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static void PatchAllCompatibilityMethods(Harmony harmony) { ApplyCruiserPatch(harmony); } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] [HarmonyPrefix] public static void ApplyCruiserPatch(Harmony harmony) { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Expected O, but got Unknown MethodInfo methodInfo = AccessTools.Method(typeof(LandminePatches), "ShouldNotDealKnockback", (Type[])null, (Type[])null); MethodInfo methodInfo2 = AccessTools.Method(typeof(CruiserImprovedCompatibility), "ShouldNotDealKnockback_Prefix", (Type[])null, (Type[])null); harmony.Patch((MethodBase)methodInfo, new HarmonyMethod(methodInfo2), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } public static bool ShouldNotDealKnockback_Prefix(PlayerControllerB instance, ref bool __result) { if (!Landmine_Patches.ShouldCheckCustomKnockback()) { return true; } __result = !Landmine_Patches.CanPlayerBeKnockedBack(); return false; } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } } internal sealed class <>z__ReadOnlyArray : IEnumerable, ICollection, IList, IEnumerable, IReadOnlyCollection, IReadOnlyList, ICollection, IList { 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.Count => _items.Length; T IReadOnlyList.this[int index] => _items[index]; int ICollection.Count => _items.Length; bool ICollection.IsReadOnly => true; T IList.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 IEnumerable.GetEnumerator() { return ((IEnumerable)_items).GetEnumerator(); } void ICollection.Add(T item) { throw new NotSupportedException(); } void ICollection.Clear() { throw new NotSupportedException(); } bool ICollection.Contains(T item) { return ((ICollection)_items).Contains(item); } void ICollection.CopyTo(T[] array, int arrayIndex) { ((ICollection)_items).CopyTo(array, arrayIndex); } bool ICollection.Remove(T item) { throw new NotSupportedException(); } int IList.IndexOf(T item) { return ((IList)_items).IndexOf(item); } void IList.Insert(int index, T item) { throw new NotSupportedException(); } void IList.RemoveAt(int index) { throw new NotSupportedException(); } } internal sealed class <>z__ReadOnlySingleElementList : IEnumerable, ICollection, IList, IEnumerable, IReadOnlyCollection, IReadOnlyList, ICollection, IList { private sealed class Enumerator : IDisposable, IEnumerator, IEnumerator { object IEnumerator.Current => _item; T IEnumerator.Current => _item; public Enumerator(T item) { _item = item; } bool IEnumerator.MoveNext() { return !_moveNextCalled && (_moveNextCalled = true); } void IEnumerator.Reset() { _moveNextCalled = false; } void IDisposable.Dispose() { } } int ICollection.Count => 1; bool ICollection.IsSynchronized => false; object ICollection.SyncRoot => this; object IList.this[int index] { get { if (index != 0) { throw new IndexOutOfRangeException(); } return _item; } set { throw new NotSupportedException(); } } bool IList.IsFixedSize => true; bool IList.IsReadOnly => true; int IReadOnlyCollection.Count => 1; T IReadOnlyList.this[int index] { get { if (index != 0) { throw new IndexOutOfRangeException(); } return _item; } } int ICollection.Count => 1; bool ICollection.IsReadOnly => true; T IList.this[int index] { get { if (index != 0) { throw new IndexOutOfRangeException(); } return _item; } set { throw new NotSupportedException(); } } public <>z__ReadOnlySingleElementList(T item) { _item = item; } IEnumerator IEnumerable.GetEnumerator() { return new Enumerator(_item); } void ICollection.CopyTo(Array array, int index) { array.SetValue(_item, index); } int IList.Add(object value) { throw new NotSupportedException(); } void IList.Clear() { throw new NotSupportedException(); } bool IList.Contains(object value) { return EqualityComparer.Default.Equals(_item, (T)value); } int IList.IndexOf(object value) { return (!EqualityComparer.Default.Equals(_item, (T)value)) ? (-1) : 0; } 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 IEnumerable.GetEnumerator() { return new Enumerator(_item); } void ICollection.Add(T item) { throw new NotSupportedException(); } void ICollection.Clear() { throw new NotSupportedException(); } bool ICollection.Contains(T item) { return EqualityComparer.Default.Equals(_item, item); } void ICollection.CopyTo(T[] array, int arrayIndex) { array[arrayIndex] = _item; } bool ICollection.Remove(T item) { throw new NotSupportedException(); } int IList.IndexOf(T item) { return (!EqualityComparer.Default.Equals(_item, item)) ? (-1) : 0; } void IList.Insert(int index, T item) { throw new NotSupportedException(); } void IList.RemoveAt(int index) { throw new NotSupportedException(); } }