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.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("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.1.7.0")]
[assembly: AssemblyInformationalVersion("1.1.7")]
[assembly: AssemblyProduct("ScandalsTweaks")]
[assembly: AssemblyTitle("scandal.scandalstweaks")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.1.7.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("scandal.scandalstweaks", "ScandalsTweaks", "1.1.7")]
[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;
AssetBundle val = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "scandal_sharedassets"));
if ((Object)(object)val == (Object)null)
{
Logger.LogError((object)"[AssetBundle] Failed to load asset bundle: SharedAssetsBundle");
return;
}
Patch();
Logger.LogInfo((object)"scandal.scandalstweaks v1.1.7 has loaded!");
}
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...");
if (IsModPresent("DiggC.CruiserImproved") && !GlobalReferences.CRUISER_IMPROVED_INSTALLED)
{
GlobalReferences.CRUISER_IMPROVED_INSTALLED = true;
CruiserImprovedCompatibility.PatchAllCompatibilityMethods(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);
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "scandal.scandalstweaks";
public const string PLUGIN_NAME = "ScandalsTweaks";
public const string PLUGIN_VERSION = "1.1.7";
}
}
namespace ScandalsTweaks.Utils
{
public static class GlobalReferences
{
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;
public static VehicleController vehicleController = null;
internal static float timeSinceDemagnetising;
internal static GameObject magnetLever = null;
internal static AnimatedObjectTrigger magnetTrigger = null;
internal static GameObject wesleyHurricaneRainObj = null;
internal static ParticleSystem wesleyHurricaneRainParticles = null;
internal static ParticleSystem wesleyHurricaneSandParticles = null;
internal static ParticleSystem wesleyHurricaneRainHitParticles = null;
internal static GameObject wesleyForsakenRainObj = null;
internal static ParticleSystem wesleyForsakenRainParticles = null;
internal static ParticleSystem wesleyForsakenRainHitParticles = null;
internal static bool CRUISER_IMPROVED_INSTALLED;
}
public class NullMemberException : Exception
{
private NullMemberException(string message)
: base(message)
{
}
public static NullMemberException Method(Type type, string methodName, Type[] parameters = null, Type[] generics = null)
{
string text = "";
string text2 = "";
if (parameters != null && parameters.Length != 0)
{
text = string.Join(", ", parameters.Select((Type param) => param.ToString()));
}
if (generics != null && generics.Length != 0)
{
text2 = "<" + string.Join(", ", generics.Select((Type param) => param.ToString())) + ">";
}
return new NullMemberException("Could not find method " + type.Name + ":" + text2 + methodName + "(" + text + ")");
}
public static NullMemberException Field(Type type, string fieldName)
{
return new NullMemberException("Could not find field " + type.Name + "." + fieldName);
}
}
internal static class PatchUtils
{
public struct OpcodeMatch
{
public OpCode opcode;
public object operandOrNull;
public OpcodeMatch(OpCode opcode)
{
operandOrNull = null;
this.opcode = opcode;
}
public OpcodeMatch(OpCode opcode, object operand)
{
operandOrNull = null;
this.opcode = opcode;
operandOrNull = operand;
}
}
public static bool OperandCompare(object inputOperand, object codeInstructionOperand)
{
if (inputOperand.Equals(codeInstructionOperand))
{
return true;
}
Type type = codeInstructionOperand.GetType();
if (type == typeof(LocalBuilder))
{
return inputOperand.Equals(((LocalBuilder)codeInstructionOperand).LocalIndex);
}
if (!(inputOperand is IConvertible) || !(codeInstructionOperand is IConvertible))
{
return false;
}
return Convert.ChangeType(inputOperand, codeInstructionOperand.GetType())?.Equals(codeInstructionOperand) ?? false;
}
public static int LocateCodeSegment(int startIndex, List<CodeInstruction> searchSpace, List<OpcodeMatch> searchFor)
{
if (startIndex < 0 || startIndex >= searchSpace.Count)
{
return -1;
}
int num = 0;
for (int i = startIndex; i < searchSpace.Count; i++)
{
CodeInstruction val = searchSpace[i];
OpcodeMatch opcodeMatch = searchFor[num];
bool flag = val.opcode == opcodeMatch.opcode;
if (flag && opcodeMatch.operandOrNull != null)
{
flag = OperandCompare(opcodeMatch.operandOrNull, val.operand);
}
if (flag)
{
num++;
if (num == searchFor.Count)
{
return i - num + 1;
}
}
else
{
num = 0;
}
}
return -1;
}
public static string GetAllMaskLayers(LayerMask _mask)
{
int value = ((LayerMask)(ref _mask)).value;
string text = "";
for (int i = 0; i < 32; i++)
{
if (((1 << i) & value) != 0)
{
text = text + " " + LayerMask.LayerToName(i);
}
}
return text;
}
public static bool TryMethod(Type type, string name, out MethodInfo methodInfo)
{
return TryMethod(type, name, null, null, out methodInfo);
}
public static bool TryMethod(Type type, string name, Type[] parameters, out MethodInfo methodInfo)
{
return TryMethod(type, name, parameters, null, out methodInfo);
}
public static bool TryMethod(Type type, string name, Type[] parameters, Type[] generics, out MethodInfo methodInfo)
{
if (parameters == null && generics == null)
{
methodInfo = type.GetMethod(name, AccessTools.all);
}
else
{
if (generics == null)
{
generics = Type.EmptyTypes;
}
if (parameters == null)
{
parameters = Type.EmptyTypes;
}
methodInfo = type.GetMethod(name, generics.Length, AccessTools.all, null, parameters, null);
if (generics.Length != 0)
{
methodInfo = methodInfo.MakeGenericMethod(generics);
}
}
return methodInfo != null;
}
public static MethodInfo Method(Type type, string name, Type[] parameters = null, Type[] generics = null)
{
if (!TryMethod(type, name, parameters, generics, out MethodInfo methodInfo))
{
throw NullMemberException.Method(type, name, parameters, generics);
}
return methodInfo;
}
public static bool TryField(Type type, string name, out FieldInfo fieldInfo)
{
fieldInfo = AccessTools.Field(type, name);
return fieldInfo != null;
}
public static FieldInfo Field(Type type, string name)
{
if (!TryField(type, name, out FieldInfo fieldInfo))
{
throw NullMemberException.Field(type, name);
}
return fieldInfo;
}
}
public static class Utilities
{
public static bool ShouldAllowSightForVehicle(PlayerControllerB player, EnemyAI enemy)
{
return false;
}
}
}
namespace ScandalsTweaks.Scripts
{
public class AudioMixerFixer : MonoBehaviour
{
public AudioSource[] allAudios = null;
public void Awake()
{
if (!((Object)(object)GlobalReferences.diageticSFXGroup == (Object)null))
{
AudioSource[] array = allAudios;
foreach (AudioSource val in array)
{
val.outputAudioMixerGroup = GlobalReferences.diageticSFXGroup;
}
}
}
}
}
namespace ScandalsTweaks.Patches
{
[HarmonyPatch(typeof(BaboonBirdAI))]
public static class BaboonBirdAI_Patches
{
[HarmonyPatch("DoAIInterval")]
[HarmonyTranspiler]
private static IEnumerable<CodeInstruction> DoAIInterval_Transpiler(IEnumerable<CodeInstruction> instructions)
{
//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
//IL_00af: Expected O, but got Unknown
List<CodeInstruction> list = instructions.ToList();
MethodInfo operand = PatchUtils.Method(typeof(StartOfRound), "get_Instance");
FieldInfo operand2 = PatchUtils.Field(typeof(StartOfRound), "collidersAndRoomMaskAndDefault");
List<PatchUtils.OpcodeMatch> searchFor = new List<PatchUtils.OpcodeMatch>
{
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 patch Raycast mask!");
return list;
}
list.RemoveRange(num, 2);
list.Insert(num, new CodeInstruction(OpCodes.Ldc_I4, (object)33554433));
return list;
}
[HarmonyPatch("DoLOSCheck")]
[HarmonyTranspiler]
private static IEnumerable<CodeInstruction> DoLOSCheck_Transpiler(IEnumerable<CodeInstruction> instructions)
{
//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
//IL_00f1: Expected O, but got Unknown
//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
//IL_00ff: Expected O, but got Unknown
//IL_0108: Unknown result type (might be due to invalid IL or missing references)
//IL_010e: Expected O, but got Unknown
//IL_011c: Unknown result type (might be due to invalid IL or missing references)
//IL_0122: Expected O, but got Unknown
//IL_012a: Unknown result type (might be due to invalid IL or missing references)
//IL_0130: 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
List<CodeInstruction> list = instructions.ToList();
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<PatchUtils.OpcodeMatch> searchFor = new List<PatchUtils.OpcodeMatch>
{
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 patch Linecast mask!");
return list;
}
list.RemoveRange(num, 2);
list.InsertRange(num, (IEnumerable<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;
}
PlayerControllerB player = default(PlayerControllerB);
if (!((Component)((Component)threatCollider).transform).TryGetComponent<PlayerControllerB>(ref player))
{
return StartOfRound.Instance.collidersAndRoomMaskAndDefault;
}
if (!Utilities.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<CodeInstruction> CheckLineOfSightForPosition_Transpiler(IEnumerable<CodeInstruction> instructions)
{
//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
//IL_00c6: Expected O, but got Unknown
//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
//IL_00d4: Expected O, but got Unknown
//IL_0124: Unknown result type (might be due to invalid IL or missing references)
//IL_012a: Expected O, but got Unknown
//IL_0132: Unknown result type (might be due to invalid IL or missing references)
//IL_0138: Expected O, but got Unknown
List<CodeInstruction> list = instructions.ToList();
MethodInfo operand = PatchUtils.Method(typeof(StartOfRound), "get_Instance");
FieldInfo operand2 = PatchUtils.Field(typeof(StartOfRound), "collidersAndRoomMaskAndDefault");
MethodInfo methodInfo = PatchUtils.Method(typeof(EnemyAI_Patches), "GetLayerMaskForLineOfSight");
List<PatchUtils.OpcodeMatch> searchFor = new List<PatchUtils.OpcodeMatch>
{
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 patch first Linecast mask!");
return list;
}
list.RemoveRange(num, 2);
list.InsertRange(num, (IEnumerable<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 patch second Linecast mask!");
return list;
}
list.RemoveRange(num2, 2);
list.InsertRange(num2, (IEnumerable<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<CodeInstruction> CurrentSearchCoroutine_Transpiler(IEnumerable<CodeInstruction> instructions, MethodBase method)
{
//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
//IL_00fd: Expected O, but got Unknown
//IL_0105: Unknown result type (might be due to invalid IL or missing references)
//IL_010b: Expected O, but got Unknown
//IL_0114: Unknown result type (might be due to invalid IL or missing references)
//IL_011a: 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<CodeInstruction> list = instructions.ToList();
MethodInfo operand = PatchUtils.Method(typeof(StartOfRound), "get_Instance");
FieldInfo operand2 = PatchUtils.Field(typeof(StartOfRound), "collidersAndRoomMaskAndDefault");
MethodInfo methodInfo = PatchUtils.Method(typeof(EnemyAI_Patches), "GetLayerMaskForLineOfSight");
List<PatchUtils.OpcodeMatch> searchFor = new List<PatchUtils.OpcodeMatch>
{
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 patch Linecast mask!");
return list;
}
list.RemoveRange(num, 2);
list.InsertRange(num, (IEnumerable<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<PlayerControllerB>(ref player))
{
return StartOfRound.Instance.collidersAndRoomMaskAndDefault;
}
if (!Utilities.ShouldAllowSightForVehicle(player, enemy))
{
return StartOfRound.Instance.collidersAndRoomMaskAndDefault;
}
return 33554433;
}
}
[HarmonyPatch(typeof(InteractTrigger))]
public static class InteractTriggerPatches
{
public static readonly int stopAnimationID = Animator.StringToHash("SA_stopAnimation");
[HarmonyPatch("Interact")]
[HarmonyPrefix]
private static void Interact_Prefix(InteractTrigger __instance, ref Transform playerTransform)
{
PlayerControllerB component = ((Component)playerTransform).GetComponent<PlayerControllerB>();
if (!((Object)(object)component == (Object)null) && !component.isPlayerDead && component.isPlayerControlled)
{
component.playerBodyAnimator.ResetTrigger(stopAnimationID);
}
}
[HarmonyPatch("StopSpecialAnimation")]
[HarmonyPostfix]
private static void StopSpecialAnimation_bool_postfix(InteractTrigger __instance)
{
if (!((Object)(object)__instance == (Object)null) && !((Object)(object)__instance.lockedPlayer == (Object)null) && !__instance.isGettingDestroyed)
{
PlayerControllerB component = ((Component)__instance.lockedPlayer).GetComponent<PlayerControllerB>();
if (!((Object)(object)component == (Object)null) && component.isPlayerControlled && !((Object)(object)component != (Object)(object)GameNetworkManager.Instance.localPlayerController))
{
component.playerBodyAnimator.ResetTrigger(stopAnimationID);
}
}
}
}
[HarmonyPatch(typeof(Landmine))]
public static class Landmine_Patches
{
private static MethodInfo get_magnitude = PatchUtils.Method(typeof(Vector3), "get_magnitude");
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<CodeInstruction> SpawnExplosion_Transpiler(IEnumerable<CodeInstruction> instructions)
{
//IL_011a: Unknown result type (might be due to invalid IL or missing references)
//IL_0120: Expected O, but got Unknown
//IL_013d: Unknown result type (might be due to invalid IL or missing references)
//IL_0143: 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
List<CodeInstruction> list = instructions.ToList();
if (GlobalReferences.CRUISER_IMPROVED_INSTALLED)
{
Plugin.Logger.LogDebug((object)"CruiserImproved detected! skipping landmine transpiler!");
return list;
}
int num = PatchUtils.LocateCodeSegment(0, list, new List<PatchUtils.OpcodeMatch>(7)
{
new PatchUtils.OpcodeMatch(OpCodes.Ldloca_S, 16),
new PatchUtils.OpcodeMatch(OpCodes.Call, get_magnitude),
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, get_magnitude),
new PatchUtils.OpcodeMatch(OpCodes.Ldc_R4, 10)
});
if (num == -1)
{
Plugin.Logger.LogWarning((object)"Could not patch landmine knockback vehicle check!");
return list;
}
object operand = list[num + 3].operand;
list.InsertRange(num + 4, new <>z__ReadOnlyArray<CodeInstruction>((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, operand)
}));
return list;
}
}
[HarmonyPatch(typeof(MouthDogAI))]
public static class MouthDogAI_Patches
{
[HarmonyPatch("OnCollideWithPlayer")]
[HarmonyTranspiler]
private static IEnumerable<CodeInstruction> OnCollideWithPlayer_Transpiler(IEnumerable<CodeInstruction> instructions)
{
//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
//IL_00b7: Expected O, but got Unknown
List<CodeInstruction> list = instructions.ToList();
MethodInfo operand = PatchUtils.Method(typeof(StartOfRound), "get_Instance");
FieldInfo operand2 = PatchUtils.Field(typeof(StartOfRound), "collidersAndRoomMask");
int num = 33556736;
List<PatchUtils.OpcodeMatch> searchFor = new List<PatchUtils.OpcodeMatch>
{
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 patch Linecast mask!");
return list;
}
list.RemoveRange(num2, 2);
list.InsertRange(num2, (IEnumerable<CodeInstruction>)(object)new CodeInstruction[1]
{
new CodeInstruction(OpCodes.Ldc_I4, (object)num)
});
return list;
}
[HarmonyPatch("EnterLunge")]
[HarmonyTranspiler]
private static IEnumerable<CodeInstruction> EnterLunge_Transpiler(IEnumerable<CodeInstruction> instructions)
{
//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
//IL_00b7: Expected O, but got Unknown
List<CodeInstruction> list = instructions.ToList();
MethodInfo operand = PatchUtils.Method(typeof(StartOfRound), "get_Instance");
FieldInfo operand2 = PatchUtils.Field(typeof(StartOfRound), "collidersAndRoomMask");
int num = 33556736;
List<PatchUtils.OpcodeMatch> searchFor = new List<PatchUtils.OpcodeMatch>
{
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 patch Raycast mask!");
return list;
}
list.RemoveRange(num2, 2);
list.InsertRange(num2, (IEnumerable<CodeInstruction>)(object)new CodeInstruction[1]
{
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)
{
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_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<CodeInstruction> SetHoverTipAndCurrentInteractTrigger_Transpiler(IEnumerable<CodeInstruction> 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<CodeInstruction> list = new List<CodeInstruction>(instructions);
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(PlayerControllerB_Patches), "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(RadMechAI))]
public static class RadMechAI_Patches
{
[HarmonyPatch("CheckSightForThreat")]
[HarmonyTranspiler]
private static IEnumerable<CodeInstruction> CheckSightForThreat_Transpiler(IEnumerable<CodeInstruction> instructions)
{
//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
//IL_00f4: Expected O, but got Unknown
//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
//IL_0102: Expected O, but got Unknown
//IL_010b: Unknown result type (might be due to invalid IL or missing references)
//IL_0111: Expected O, but got Unknown
//IL_011e: Unknown result type (might be due to invalid IL or missing references)
//IL_0124: 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_013b: Unknown result type (might be due to invalid IL or missing references)
//IL_0141: Expected O, but got Unknown
//IL_0191: Unknown result type (might be due to invalid IL or missing references)
//IL_0197: Expected O, but got Unknown
//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
//IL_01aa: Expected O, but got Unknown
//IL_01b3: Unknown result type (might be due to invalid IL or missing references)
//IL_01b9: Expected O, but got Unknown
List<CodeInstruction> list = instructions.ToList();
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<PatchUtils.OpcodeMatch> searchFor = new List<PatchUtils.OpcodeMatch>
{
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 patch first Linecast mask!");
return list;
}
list.RemoveRange(num, 2);
list.InsertRange(num, (IEnumerable<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 patch second Linecast mask!");
return list;
}
list.RemoveRange(num2, 2);
list.InsertRange(num2, (IEnumerable<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;
}
PlayerControllerB player = default(PlayerControllerB);
if (!((Component)((Component)threatCollider).transform).TryGetComponent<PlayerControllerB>(ref player))
{
return StartOfRound.Instance.collidersAndRoomMaskAndDefault;
}
if (!Utilities.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<AnimatedObjectTrigger>();
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<GameObject>)Resources.FindObjectsOfTypeAll<GameObject>()).FirstOrDefault((Func<GameObject, bool>)((GameObject hw) => ((Object)hw).name == "HurricaneWeatherRainEffect(Clone)"));
GlobalReferences.wesleyForsakenRainObj = ((IEnumerable<GameObject>)Resources.FindObjectsOfTypeAll<GameObject>()).FirstOrDefault((Func<GameObject, bool>)((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<ParticleSystem>();
GlobalReferences.wesleyHurricaneRainHitParticles = ((Component)GlobalReferences.wesleyHurricaneRainObj.transform.Find("Particle System (2)/RainHitParticle")).GetComponent<ParticleSystem>();
GlobalReferences.wesleyHurricaneSandParticles = ((Component)GlobalReferences.wesleyHurricaneRainObj.transform.Find("SandParticles")).GetComponent<ParticleSystem>();
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<ParticleSystem>();
GlobalReferences.wesleyForsakenRainHitParticles = ((Component)GlobalReferences.wesleyForsakenRainObj.transform.Find("Particle System/RainHitParticle")).GetComponent<ParticleSystem>();
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<ParticleSystem>();
GlobalReferences.rainHitParticles = ((Component)((Component)__instance).transform.Find("RainParticleContainer/Particle System/RainHitParticle")).GetComponent<ParticleSystem>();
GlobalReferences.stormyRainParticles = ((Component)((Component)__instance).transform.Find("StormyRainParticleContainer/Particle System")).GetComponent<ParticleSystem>();
GlobalReferences.stormyRainHitParticles = ((Component)((Component)__instance).transform.Find("StormyRainParticleContainer/Particle System/RainHitParticle")).GetComponent<ParticleSystem>();
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(ref 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<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();
}
}