using 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 GameNetcodeStuff;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using ScandalsTweaks.Utils;
using UnityEngine;
using UnityEngine.Audio;
[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("DissonanceVoip")]
[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("UnityEngine.ARModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.UI")]
[assembly: AssemblyCompany("ScandalsTweaks")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("ScandalsTweaks")]
[assembly: AssemblyTitle("ScandalsTweaks")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.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]
[Microsoft.CodeAnalysis.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]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace ScandalsTweaks
{
[BepInPlugin("ScandalsTweaks", "ScandalsTweaks", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
internal static bool cruiserImprovedInstalled;
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;
Patch();
Logger.LogInfo((object)"ScandalsTweaks v1.0.0 has loaded!");
cruiserImprovedInstalled = Chainloader.PluginInfos.ContainsKey("DiggC.CruiserImproved");
}
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("ScandalsTweaks");
}
Logger.LogDebug((object)"Patching...");
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!");
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "ScandalsTweaks";
public const string PLUGIN_NAME = "ScandalsTweaks";
public const string PLUGIN_VERSION = "1.0.0";
}
}
namespace ScandalsTweaks.Utils
{
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);
}
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;
}
}
public static class References
{
internal static ParticleSystem rainParticles = null;
internal static ParticleSystem rainHitParticles = null;
internal static ParticleSystem stormyRainParticles = null;
internal static ParticleSystem stormyRainHitParticles = null;
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 = null;
internal static float timeSinceDemagnetising;
}
}
namespace ScandalsTweaks.Scripts
{
public class AudioMixerFixer : MonoBehaviour
{
public AudioSource[] allAudios = null;
public void Awake()
{
if (!((Object)(object)References.diageticSFXGroup == (Object)null))
{
AudioSource[] array = allAudios;
foreach (AudioSource val in array)
{
val.outputAudioMixerGroup = References.diageticSFXGroup;
}
}
}
}
}
namespace ScandalsTweaks.Patches
{
[HarmonyPatch(typeof(PlayAudioAnimationEvent))]
public class PlayAudioAnimationEventPatches
{
[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 class PlayerControllerBPatches
{
[HarmonyPatch("PlaceGrabbableObject")]
[HarmonyPostfix]
private static void PlaceGrabbableObject_Postfix(GrabbableObject placeObject)
{
if (!Plugin.cruiserImprovedInstalled)
{
ScanNodeProperties componentInChildren = ((Component)placeObject).GetComponentInChildren<ScanNodeProperties>();
if (Object.op_Implicit((Object)(object)componentInChildren) && !Object.op_Implicit((Object)(object)((Component)componentInChildren).GetComponent<Rigidbody>()))
{
Rigidbody val = ((Component)componentInChildren).gameObject.AddComponent<Rigidbody>();
val.isKinematic = true;
}
}
}
[HarmonyPatch("Update")]
[HarmonyPrefix]
public static void Update_Prefix(PlayerControllerB __instance)
{
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
//IL_0063: Unknown result type (might be due to invalid IL or missing references)
//IL_0073: Unknown result type (might be due to invalid IL or missing references)
//IL_0078: Unknown result type (might be due to invalid IL or missing references)
if (!((Object)(object)__instance != (Object)(object)GameNetworkManager.Instance.localPlayerController) && !((Object)(object)__instance == (Object)null) && __instance.isPlayerControlled && !__instance.isPlayerDead && __instance.inVehicleAnimation && ((Vector3)(ref __instance.externalForces)).magnitude > 0.05f)
{
__instance.externalForces = Vector3.Lerp(__instance.externalForces, Vector3.zero, 2f * Time.deltaTime);
}
}
[HarmonyPatch("UpdatePlayerAnimationsToOtherClients")]
[HarmonyPrefix]
public static bool UpdatePlayerAnimationsToOtherClients_Prefix(PlayerControllerB __instance, Vector2 moveInputVector, bool __runOriginal)
{
if (!__runOriginal)
{
return false;
}
if ((Object)(object)__instance != (Object)(object)GameNetworkManager.Instance.localPlayerController)
{
return true;
}
if ((Object)(object)__instance == (Object)null || !__instance.isPlayerControlled || __instance.isPlayerDead)
{
return true;
}
if ((Object)(object)__instance.playerBodyAnimator == (Object)null)
{
return true;
}
if (__instance.currentAnimationStateHash.Count != __instance.playerBodyAnimator.layerCount || __instance.previousAnimationStateHash.Count != __instance.playerBodyAnimator.layerCount)
{
__instance.updatePlayerAnimationsInterval = 0f;
__instance.currentAnimationStateHash = new List<int>(new int[__instance.playerBodyAnimator.layerCount]);
__instance.previousAnimationStateHash = new List<int>(new int[__instance.playerBodyAnimator.layerCount]);
return false;
}
return true;
}
[HarmonyPatch("SetHoverTipAndCurrentInteractTrigger")]
[HarmonyTranspiler]
private static IEnumerable<CodeInstruction> SetHoverTipAndCurrentInteractTrigger_Transpiler(IEnumerable<CodeInstruction> instructions)
{
//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
//IL_00dc: Expected O, but got Unknown
//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
//IL_00eb: Expected O, but got Unknown
//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
//IL_00f9: Expected O, but got Unknown
List<CodeInstruction> list = new List<CodeInstruction>(instructions);
if (Plugin.cruiserImprovedInstalled)
{
return list;
}
MethodInfo operand = PatchUtils.Method(typeof(GameObject), "get_layer");
int num = PatchUtils.LocateCodeSegment(0, list, new List<PatchUtils.OpcodeMatch>(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(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;
}
private static bool ValidRayHit(PlayerControllerB player)
{
string tag = ((Component)((RaycastHit)(ref player.hit)).collider).tag;
return tag == "PhysicsProp" || tag == "InteractTrigger";
}
}
[HarmonyPatch(typeof(SoundManager))]
public class SoundManagerPatches
{
[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)References.diageticSFXGroup == (Object)null)
{
AudioMixerGroup diageticSFXGroup = __instance.diageticMixer.FindMatchingGroups("Master/SFX")[0];
References.diageticSFXGroup = diageticSFXGroup;
}
}
}
[HarmonyPatch(typeof(StartOfRound))]
public class StartOfRoundPatches
{
[HarmonyPatch("SetMagnetOn")]
[HarmonyPrefix]
private static void SetMagnetOn_Prefix(StartOfRound __instance, ref bool on)
{
if (__instance.magnetOn != on && !__instance.magnetOn)
{
References.timeSinceDemagnetising = Time.realtimeSinceStartup;
}
}
[HarmonyPatch("SetMagnetOnClientRpc")]
[HarmonyPrefix]
private static void SetMagnetOnClientRpc_Prefix(StartOfRound __instance, ref bool on)
{
if (__instance.magnetOn != on && !__instance.magnetOn)
{
References.timeSinceDemagnetising = Time.realtimeSinceStartup;
}
}
}
[HarmonyPatch(typeof(Terminal))]
public class TerminalPatches
{
[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 TimeOfDayPatches
{
[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)
References.rainParticles = ((Component)((Component)__instance).transform.Find("RainParticleContainer/Particle System")).GetComponent<ParticleSystem>();
References.rainHitParticles = ((Component)((Component)__instance).transform.Find("RainParticleContainer/Particle System/RainHitParticle")).GetComponent<ParticleSystem>();
References.stormyRainParticles = ((Component)((Component)__instance).transform.Find("StormyRainParticleContainer/Particle System")).GetComponent<ParticleSystem>();
References.stormyRainHitParticles = ((Component)((Component)__instance).transform.Find("StormyRainParticleContainer/Particle System/RainHitParticle")).GetComponent<ParticleSystem>();
if (!((Object)(object)References.rainParticles == (Object)null) && !((Object)(object)References.rainHitParticles == (Object)null) && !((Object)(object)References.stormyRainParticles == (Object)null) && !((Object)(object)References.stormyRainHitParticles == (Object)null))
{
TriggerModule trigger = References.rainParticles.trigger;
TriggerModule trigger2 = References.rainHitParticles.trigger;
TriggerModule trigger3 = References.stormyRainParticles.trigger;
TriggerModule trigger4 = References.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;
}
}
}
}
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();
}
}