Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of Scandals Tweaks v1.4.3
BepInEx/plugins/scandalstweaks/scandal.scandalstweaks.dll
Decompiled 2 days agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Logging; using CruiserImproved.Patches; using GameNetcodeStuff; using HarmonyLib; using JLL.Components; using Microsoft.CodeAnalysis; using ScandalsTweaks.Compatibility; using ScandalsTweaks.Patches; using ScandalsTweaks.Patches.Enemies; using ScandalsTweaks.Utils; using UnityEngine; [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("JLL")] [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.4.3.0")] [assembly: AssemblyInformationalVersion("1.4.3")] [assembly: AssemblyProduct("ScandalsTweaks")] [assembly: AssemblyTitle("scandal.scandalstweaks")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.4.3.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.4.3")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { internal static bool initialized; public static Plugin Instance { get; private set; } internal static ManualLogSource Logger { get; private set; } internal static Harmony? Harmony { get; set; } public void Awake() { if (!initialized) { initialized = true; Logger = ((BaseUnityPlugin)this).Logger; Instance = this; Patch(); LogInfo("scandal.scandalstweaks v1.4.3 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"); } LogDebug("Patching..."); CompatibilityUtils.Init(Harmony); Harmony.PatchAll(typeof(BaboonBirdAIPatches)); Harmony.PatchAll(typeof(BushWolfEnemyPatches)); Harmony.PatchAll(typeof(EnemyAIPatches)); Harmony.PatchAll(typeof(ForestGiantAIPatches)); Harmony.PatchAll(typeof(GiantKiwiAIPatches)); Harmony.PatchAll(typeof(MouthDogAIPatches)); Harmony.PatchAll(typeof(RadMechAIPatches)); Harmony.PatchAll(typeof(ItemDropshipPatches)); Harmony.PatchAll(typeof(LandminePatches)); Harmony.PatchAll(typeof(PlayerControllerBPatches)); Harmony.PatchAll(typeof(StartOfRoundPatches)); Harmony.PatchAll(typeof(TerminalPatches)); Harmony.PatchAll(typeof(TimeOfDayPatches)); LogDebug("Finished patching!"); } internal static void Unpatch() { LogDebug("Unpatching..."); Harmony? harmony = Harmony; if (harmony != null) { harmony.UnpatchSelf(); } LogDebug("Finished unpatching!"); } [MethodImpl(MethodImplOptions.AggressiveInlining)] internal static void LogMessage(string messageLog) { Logger.LogMessage((object)messageLog); } [MethodImpl(MethodImplOptions.AggressiveInlining)] internal static void LogDebug(string debugLog) { Logger.LogDebug((object)debugLog); } [MethodImpl(MethodImplOptions.AggressiveInlining)] internal static void LogInfo(string infoLog) { Logger.LogInfo((object)infoLog); } [MethodImpl(MethodImplOptions.AggressiveInlining)] internal static void LogWarning(string warningLog) { Logger.LogWarning((object)warningLog); } [MethodImpl(MethodImplOptions.AggressiveInlining)] internal static void LogError(string errorLog) { Logger.LogError((object)errorLog); } } public static class MyPluginInfo { public const string PLUGIN_GUID = "scandal.scandalstweaks"; public const string PLUGIN_NAME = "ScandalsTweaks"; public const string PLUGIN_VERSION = "1.4.3"; } } namespace ScandalsTweaks.Utils { internal static class CompatibilityUtils { internal const string GUID_CRUISER_IMPROVED = "DiggC.CruiserImproved"; internal const string GUID_JLL = "JacobG5.JLL"; internal static bool INSTALLED_CRUISER_IMPROVED; internal static bool INSTALLED_JLL; internal static void Init(Harmony harmony) { if (Chainloader.PluginInfos.ContainsKey("DiggC.CruiserImproved")) { INSTALLED_CRUISER_IMPROVED = true; harmony.PatchAll(typeof(CruiserImprovedCompatibility)); Plugin.LogDebug("CROSS-COMPATIBILITY - CruiserImproved detected"); } if (Chainloader.PluginInfos.ContainsKey("JacobG5.JLL")) { INSTALLED_JLL = true; harmony.PatchAll(typeof(JLLCompatibility)); Plugin.LogDebug("CROSS-COMPATIBILITY - JLL detected"); } } } public class NullMemberException : Exception { private NullMemberException(string message) : base(message) { } public static NullMemberException Method(Type type, string methodName, Type[] parameters = null, Type[] generics = null) { string text = ""; string text2 = ""; if (parameters != null && parameters.Length != 0) { text = string.Join(", ", parameters.Select((Type param) => param.ToString())); } if (generics != null && generics.Length != 0) { text2 = "<" + string.Join(", ", generics.Select((Type param) => param.ToString())) + ">"; } return new NullMemberException("Could not find method " + type.Name + ":" + text2 + methodName + "(" + text + ")"); } public static NullMemberException Field(Type type, string fieldName) { return new NullMemberException("Could not find field " + type.Name + "." + fieldName); } } internal static class PatchUtils { public struct OpcodeMatch { public OpCode opcode; public object operandOrNull; public OpcodeMatch(OpCode opcode) { operandOrNull = null; this.opcode = opcode; } public OpcodeMatch(OpCode opcode, object operand) { operandOrNull = null; this.opcode = opcode; operandOrNull = operand; } } public static bool OperandCompare(object inputOperand, object codeInstructionOperand) { if (inputOperand.Equals(codeInstructionOperand)) { return true; } Type type = codeInstructionOperand.GetType(); if (type == typeof(LocalBuilder)) { return inputOperand.Equals(((LocalBuilder)codeInstructionOperand).LocalIndex); } if (!(inputOperand is IConvertible) || !(codeInstructionOperand is IConvertible)) { return false; } return Convert.ChangeType(inputOperand, codeInstructionOperand.GetType())?.Equals(codeInstructionOperand) ?? false; } public static int LocateCodeSegment(int startIndex, List<CodeInstruction> searchSpace, List<OpcodeMatch> searchFor) { if (startIndex < 0 || startIndex >= searchSpace.Count) { return -1; } int num = 0; for (int i = startIndex; i < searchSpace.Count; i++) { CodeInstruction val = searchSpace[i]; OpcodeMatch opcodeMatch = searchFor[num]; bool flag = val.opcode == opcodeMatch.opcode; if (flag && opcodeMatch.operandOrNull != null) { flag = OperandCompare(opcodeMatch.operandOrNull, val.operand); } if (flag) { num++; if (num == searchFor.Count) { return i - num + 1; } } else { num = 0; } } return -1; } public static string GetAllMaskLayers(LayerMask _mask) { int value = ((LayerMask)(ref _mask)).value; string text = ""; for (int i = 0; i < 32; i++) { if (((1 << i) & value) != 0) { text = text + " " + LayerMask.LayerToName(i); } } return text; } public static bool TryMethod(Type type, string name, out MethodInfo methodInfo) { return TryMethod(type, name, null, null, out methodInfo); } public static bool TryMethod(Type type, string name, Type[] parameters, out MethodInfo methodInfo) { return TryMethod(type, name, parameters, null, out methodInfo); } public static bool TryMethod(Type type, string name, Type[] parameters, Type[] generics, out MethodInfo methodInfo) { if (parameters == null && generics == null) { methodInfo = type.GetMethod(name, AccessTools.all); } else { if (generics == null) { generics = Type.EmptyTypes; } if (parameters == null) { parameters = Type.EmptyTypes; } methodInfo = type.GetMethod(name, generics.Length, AccessTools.all, null, parameters, null); if (generics.Length != 0) { methodInfo = methodInfo.MakeGenericMethod(generics); } } return methodInfo != null; } public static MethodInfo Method(Type type, string name, Type[] parameters = null, Type[] generics = null) { if (!TryMethod(type, name, parameters, generics, out MethodInfo methodInfo)) { throw NullMemberException.Method(type, name, parameters, generics); } return methodInfo; } public static bool TryField(Type type, string name, out FieldInfo fieldInfo) { fieldInfo = AccessTools.Field(type, name); return fieldInfo != null; } public static FieldInfo Field(Type type, string name) { if (!TryField(type, name, out FieldInfo fieldInfo)) { throw NullMemberException.Field(type, name); } return fieldInfo; } } internal static class References { 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 ItemDropship itemShip = null; 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 GameObject? kenjiAcidRainObj; internal static GameObject? kenjiAcidStormyRainObj; internal static ParticleSystem? kenjiAcidRainParticles; internal static ParticleSystem? kenjiAcidRainHitParticles; internal static ParticleSystem? kenjiAcidStormyRainParticles; internal static ParticleSystem? kenjiAcidStormyRainHitParticles; internal static GameObject? kenjiAcidStormyRainHurtZoneObj; } public static class Utilities { public static void SetParticleEffects(ParticleSystem particleSystem) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003e: 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) if (!((Object)(object)particleSystem == (Object)null)) { CollisionModule collision = particleSystem.collision; ((CollisionModule)(ref collision)).enabled = true; ((CollisionModule)(ref collision)).collidesWith = LayerMask.op_Implicit(LayerMask.op_Implicit(((CollisionModule)(ref collision)).collidesWith) | 0x40000000); TriggerModule trigger = particleSystem.trigger; ((TriggerModule)(ref trigger)).enabled = true; ((TriggerModule)(ref trigger)).colliderQueryMode = (ParticleSystemColliderQueryMode)1; ((TriggerModule)(ref trigger)).enter = (ParticleSystemOverlapAction)1; ((TriggerModule)(ref trigger)).exit = (ParticleSystemOverlapAction)1; ((TriggerModule)(ref trigger)).inside = (ParticleSystemOverlapAction)1; } } public static bool ShouldAllowSightThroughVehicle(PlayerControllerB player, EnemyAI enemy) { return false; } public static bool IsItRaining() { //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Invalid comparison between Unknown and I4 //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Invalid comparison between Unknown and I4 //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Invalid comparison between Unknown and I4 if (((Object)(object)References.wesleyHurricaneRainObj != (Object)null && References.wesleyHurricaneRainObj.activeSelf) || ((Object)(object)References.wesleyForsakenRainObj != (Object)null && References.wesleyForsakenRainObj.activeSelf)) { return true; } if ((Object)(object)References.kenjiAcidRainObj != (Object)null && (Object)(object)References.kenjiAcidStormyRainObj != (Object)null && References.kenjiAcidStormyRainObj.activeSelf) { return true; } return (int)TimeOfDay.Instance.currentLevelWeather == 1 || (int)TimeOfDay.Instance.currentLevelWeather == 4 || (int)TimeOfDay.Instance.currentLevelWeather == 2; } } } namespace ScandalsTweaks.Patches { [HarmonyPatch(typeof(ItemDropship))] public static class ItemDropshipPatches { [HarmonyPatch("Start")] [HarmonyPrefix] private static void ItemDropship_Pre_Start(ItemDropship __instance) { if (!((Object)(object)__instance == (Object)null)) { References.itemShip = __instance; } } } [HarmonyPatch(typeof(Landmine))] public static class LandminePatches { 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> Landmine_Trans_SpawnExplosion(IEnumerable<CodeInstruction> instructions) { //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Expected O, but got Unknown //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Expected O, but got Unknown //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Expected O, but got Unknown List<CodeInstruction> list = instructions.ToList(); if (CompatibilityUtils.INSTALLED_CRUISER_IMPROVED) { Plugin.LogDebug("Skipping Landmine transpiler as CruiserImproved is present"); return list; } MethodInfo operand = PatchUtils.Method(typeof(Vector3), "get_magnitude"); List<PatchUtils.OpcodeMatch> searchFor = new List<PatchUtils.OpcodeMatch> { 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) }; int num = PatchUtils.LocateCodeSegment(0, list, searchFor); if (num == -1) { Plugin.LogWarning("Could not find Landmine vehicle knockback check!"); return list; } object operand2 = 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(LandminePatches), "ShouldDealKnockback")), new CodeInstruction(OpCodes.Brfalse_S, operand2) })); return list; } } [HarmonyPatch(typeof(PlayerControllerB))] public static class PlayerControllerBPatches { [HarmonyPatch("PlaceGrabbableObject")] [HarmonyPostfix] private static void PlayerControllerB_Post_PlaceGrabbableObject(GrabbableObject placeObject) { if (!CompatibilityUtils.INSTALLED_CRUISER_IMPROVED) { 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("Crouch")] [HarmonyTranspiler] private static IEnumerable<CodeInstruction> PlayerControllerB_Trans_Crouch(IEnumerable<CodeInstruction> instructions) { //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Expected O, but got Unknown //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Expected O, but got Unknown List<CodeInstruction> list = instructions.ToList(); Plugin.LogDebug("Attempting to transpile 'Crouch' for 'PlayerControllerB'"); FieldInfo operand = PatchUtils.Field(typeof(PlayerControllerB), "playersManager"); FieldInfo operand2 = PatchUtils.Field(typeof(StartOfRound), "collidersAndRoomMask"); int num = 1107302656; List<PatchUtils.OpcodeMatch> searchFor = new List<PatchUtils.OpcodeMatch> { new PatchUtils.OpcodeMatch(OpCodes.Ldfld, operand), new PatchUtils.OpcodeMatch(OpCodes.Ldfld, operand2) }; int num2 = PatchUtils.LocateCodeSegment(0, list, searchFor); if (num2 == -1) { Plugin.LogError("Failed to transpile Raycast mask on 'PlayerControllerB.Crouch'!"); return list; } list.RemoveRange(num2, 2); list.InsertRange(num2, new <>z__ReadOnlyArray<CodeInstruction>((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 PlayerControllerB_Pre_Update(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> PlayerControllerB_Trans_SetHoverTipAndCurrentInteractTrigger(IEnumerable<CodeInstruction> instructions) { //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: 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 List<CodeInstruction> list = new List<CodeInstruction>(instructions); if (CompatibilityUtils.INSTALLED_CRUISER_IMPROVED) { Plugin.LogDebug("Skipping HoverTip transpiler as CruiserImproved is present"); return list; } Plugin.LogDebug("Attempting to transpile 'SetHoverTipAndCurrentInteractTrigger' for 'PlayerControllerB'"); MethodInfo operand = PatchUtils.Method(typeof(GameObject), "get_layer"); List<PatchUtils.OpcodeMatch> searchFor = new List<PatchUtils.OpcodeMatch> { new PatchUtils.OpcodeMatch(OpCodes.Callvirt, operand), new PatchUtils.OpcodeMatch(OpCodes.Ldc_I4_S, 30), new PatchUtils.OpcodeMatch(OpCodes.Beq) }; int num = PatchUtils.LocateCodeSegment(0, list, searchFor); if (num == -1) { Plugin.LogWarning("Could not transpile SetHoverTipAndCurrentInteractTrigger!"); 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(StartOfRound))] public static class StartOfRoundPatches { [HarmonyPatch("Awake")] [HarmonyPostfix] private static void StartOfRound_Post_Awake(StartOfRound __instance) { SetCustomWeather(); References.magnetLever = GameObject.Find("Environment/HangarShip/MagnetLever"); if ((Object)(object)References.magnetLever == (Object)null) { Plugin.LogError("Magnet-lever is null"); return; } References.magnetTrigger = References.magnetLever.GetComponent<AnimatedObjectTrigger>(); if ((Object)(object)References.magnetTrigger == (Object)null) { Plugin.LogError("Magnet-trigger is null"); } } private static void SetCustomWeather() { if (CompatibilityUtils.INSTALLED_JLL) { References.wesleyHurricaneRainObj = ((IEnumerable<GameObject>)Resources.FindObjectsOfTypeAll<GameObject>()).FirstOrDefault((Func<GameObject, bool>)((GameObject hw) => ((Object)hw).name == "HurricaneWeatherRainEffect(Clone)")); if ((Object)(object)References.wesleyHurricaneRainObj != (Object)null) { References.wesleyHurricaneRainParticles = ((Component)References.wesleyHurricaneRainObj.transform.Find("Particle System (2)")).GetComponent<ParticleSystem>(); References.wesleyHurricaneRainHitParticles = ((Component)References.wesleyHurricaneRainObj.transform.Find("Particle System (2)/RainHitParticle")).GetComponent<ParticleSystem>(); References.wesleyHurricaneSandParticles = ((Component)References.wesleyHurricaneRainObj.transform.Find("SandParticles")).GetComponent<ParticleSystem>(); Utilities.SetParticleEffects(References.wesleyHurricaneRainParticles); Utilities.SetParticleEffects(References.wesleyHurricaneRainHitParticles); Utilities.SetParticleEffects(References.wesleyHurricaneSandParticles); } else { Plugin.LogDebug("Could not find Hurricane weather effects"); } References.wesleyForsakenRainObj = ((IEnumerable<GameObject>)Resources.FindObjectsOfTypeAll<GameObject>()).FirstOrDefault((Func<GameObject, bool>)((GameObject fw) => ((Object)fw).name == "ForsakenWeatherRainEffect(Clone)")); if ((Object)(object)References.wesleyForsakenRainObj != (Object)null) { References.wesleyForsakenRainParticles = ((Component)References.wesleyForsakenRainObj.transform.Find("Particle System")).GetComponent<ParticleSystem>(); References.wesleyForsakenRainHitParticles = ((Component)References.wesleyForsakenRainObj.transform.Find("Particle System/RainHitParticle")).GetComponent<ParticleSystem>(); Utilities.SetParticleEffects(References.wesleyForsakenRainParticles); Utilities.SetParticleEffects(References.wesleyForsakenRainHitParticles); } else { Plugin.LogDebug("Could not find Forsaken weather effects"); } References.kenjiAcidRainObj = ((IEnumerable<GameObject>)Resources.FindObjectsOfTypeAll<GameObject>()).FirstOrDefault((Func<GameObject, bool>)((GameObject arf) => ((Object)arf).name == "AcidRainFinal(Clone)")); if ((Object)(object)References.kenjiAcidRainObj != (Object)null) { References.kenjiAcidRainParticles = ((Component)References.kenjiAcidRainObj.transform.Find("AcidRainTimer/AcidAnimCont/RainParticleContainer/Particle System")).GetComponent<ParticleSystem>(); References.kenjiAcidRainHitParticles = ((Component)References.kenjiAcidRainObj.transform.Find("AcidRainTimer/AcidAnimCont/RainParticleContainer/Particle System/RainHitParticle")).GetComponent<ParticleSystem>(); References.kenjiAcidStormyRainParticles = ((Component)References.kenjiAcidRainObj.transform.Find("AcidRainTimer/AcidAnimCont/StormyRainParticleContainer/Particle System")).GetComponent<ParticleSystem>(); References.kenjiAcidStormyRainHitParticles = ((Component)References.kenjiAcidRainObj.transform.Find("AcidRainTimer/AcidAnimCont/StormyRainParticleContainer/Particle System/RainHitParticle")).GetComponent<ParticleSystem>(); References.kenjiAcidStormyRainObj = ((Component)References.kenjiAcidRainObj.transform.Find("AcidRainTimer/AcidAnimCont/StormyRainParticleContainer")).gameObject; References.kenjiAcidStormyRainHurtZoneObj = ((Component)References.kenjiAcidRainObj.transform.Find("AcidRainTimer/AcidAnimCont/StormyRainParticleContainer/HurtZone")).gameObject; Utilities.SetParticleEffects(References.kenjiAcidRainParticles); Utilities.SetParticleEffects(References.kenjiAcidRainHitParticles); Utilities.SetParticleEffects(References.kenjiAcidStormyRainParticles); Utilities.SetParticleEffects(References.kenjiAcidStormyRainHitParticles); JLLCompatibility.TrySetDamageTrigger(References.kenjiAcidStormyRainHurtZoneObj); } else { Plugin.LogDebug("Could not find Acid-Rain weather effects"); } } } } [HarmonyPatch(typeof(Terminal))] public static class TerminalPatches { [HarmonyPatch("Awake")] [HarmonyPrefix] private static void Terminal_Pre_Awake(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 TimeOfDay_Pre_Awake(TimeOfDay __instance) { 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)) { Utilities.SetParticleEffects(References.rainParticles); Utilities.SetParticleEffects(References.rainHitParticles); Utilities.SetParticleEffects(References.stormyRainParticles); Utilities.SetParticleEffects(References.stormyRainHitParticles); } } } } namespace ScandalsTweaks.Patches.Enemies { [HarmonyPatch(typeof(BaboonBirdAI))] public static class BaboonBirdAIPatches { [HarmonyPatch("DoAIInterval")] [HarmonyTranspiler] private static IEnumerable<CodeInstruction> BaboonBirdAI_Trans_DoAIInterval(IEnumerable<CodeInstruction> instructions) { //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Expected O, but got Unknown List<CodeInstruction> list = instructions.ToList(); Plugin.LogDebug("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<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.LogError("Failed to transpile Raycast mask on 'BaboonBirdAI.DoAIInterval'!"); return list; } list.RemoveRange(num2, 2); list.InsertRange(num2, new <>z__ReadOnlySingleElementList<CodeInstruction>(new CodeInstruction(OpCodes.Ldc_I4, (object)num))); return list; } [HarmonyPatch("DoLOSCheck")] [HarmonyTranspiler] private static IEnumerable<CodeInstruction> BaboonBirdAI_Trans_DoLOSCheck(IEnumerable<CodeInstruction> instructions) { //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Expected O, but got Unknown //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Expected O, but got Unknown //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Expected O, but got Unknown //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Expected O, but got Unknown //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Expected O, but got Unknown //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Expected O, but got Unknown List<CodeInstruction> list = instructions.ToList(); Plugin.LogDebug("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(BaboonBirdAIPatches), "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.LogError("Failed to transpile Linecast mask on 'BaboonBirdAI.DoLOSCheck'!"); return list; } list.RemoveRange(num, 2); list.InsertRange(num, new <>z__ReadOnlyArray<CodeInstruction>((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<PlayerControllerB>(ref player)) { return StartOfRound.Instance.collidersAndRoomMaskAndDefault; } if (!Utilities.ShouldAllowSightThroughVehicle(player, (EnemyAI)(object)baboonBird)) { return StartOfRound.Instance.collidersAndRoomMaskAndDefault; } return 33554433; } } [HarmonyPatch(typeof(BushWolfEnemy))] public static class BushWolfEnemyPatches { [HarmonyPatch("Update")] [HarmonyTranspiler] private static IEnumerable<CodeInstruction> BushWolfEnemy_Trans_Update(IEnumerable<CodeInstruction> instructions, ILGenerator generator) { //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Expected O, but got Unknown //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Expected O, but got Unknown //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Expected O, but got Unknown //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Expected O, but got Unknown //IL_019b: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: Expected O, but got Unknown List<CodeInstruction> list = instructions.ToList(); Plugin.LogDebug("Attempting to transpile 'Update' for 'BushWolfEnemy'"); FieldInfo fieldInfo = PatchUtils.Field(typeof(EnemyAI), "targetPlayer"); FieldInfo operand = PatchUtils.Field(typeof(BushWolfEnemy), "dragging"); FieldInfo operand2 = PatchUtils.Field(typeof(VehicleController), "backDoorOpen"); MethodInfo methodInfo = PatchUtils.Method(typeof(BushWolfEnemyPatches), "IsTargetPlayerProtected"); List<PatchUtils.OpcodeMatch> searchFor = new List<PatchUtils.OpcodeMatch> { new PatchUtils.OpcodeMatch(OpCodes.Ldfld, operand2) }; int num = PatchUtils.LocateCodeSegment(0, list, searchFor); if (num == -1) { Plugin.LogError("Failed to locate body!"); return list; } num += 2; List<PatchUtils.OpcodeMatch> searchFor2 = new List<PatchUtils.OpcodeMatch> { new PatchUtils.OpcodeMatch(OpCodes.Ldarg_0), new PatchUtils.OpcodeMatch(OpCodes.Ldfld, operand) }; int num2 = PatchUtils.LocateCodeSegment(0, list, searchFor2); if (num2 == -1) { Plugin.LogError("Failed to locate continue block!"); return list; } Label label = list[num].labels[0]; List<Label> labels = list[num2].labels; list[num2].labels = new List<Label>(); list.InsertRange(num2, new <>z__ReadOnlyArray<CodeInstruction>((CodeInstruction[])(object)new CodeInstruction[5] { new CodeInstruction(OpCodes.Ldarg_0, (object)null) { labels = labels }, new CodeInstruction(OpCodes.Ldfld, (object)fieldInfo), new CodeInstruction(OpCodes.Ldloc_S, (object)(byte)9), new CodeInstruction(OpCodes.Call, (object)methodInfo), new CodeInstruction(OpCodes.Brtrue_S, (object)label) })); return list; } [HarmonyPatch("CancelReelingPlayerIn")] [HarmonyTranspiler] public static IEnumerable<CodeInstruction> BushWolfEnemy_Trans_CancelReelingPlayerIn(IEnumerable<CodeInstruction> instructions) { List<CodeInstruction> list = instructions.ToList(); Plugin.LogDebug("Attempting to transpile 'CancelReelingPlayerIn' for 'BushWolfEnemy'"); FieldInfo operand = PatchUtils.Field(typeof(BushWolfEnemy), "draggingPlayer"); FieldInfo operand2 = PatchUtils.Field(typeof(PlayerControllerB), "inSpecialInteractAnimation"); List<PatchUtils.OpcodeMatch> searchFor = new List<PatchUtils.OpcodeMatch> { new PatchUtils.OpcodeMatch(OpCodes.Ldarg_0), new PatchUtils.OpcodeMatch(OpCodes.Ldfld, operand), new PatchUtils.OpcodeMatch(OpCodes.Ldc_I4_0), new PatchUtils.OpcodeMatch(OpCodes.Stfld, operand2) }; int num = PatchUtils.LocateCodeSegment(0, list, searchFor); if (num == -1) { Plugin.LogError("Failed to transpile 'BushWolfEnemy.CancelReelingPlayerIn'!"); return list; } list.RemoveRange(num, 4); return list; } public static bool IsTargetPlayerProtected(PlayerControllerB player, VehicleController vehicle) { return false; } } [HarmonyPatch(typeof(EnemyAI))] public static class EnemyAIPatches { [HarmonyPatch("CheckLineOfSightForPosition")] [HarmonyTranspiler] private static IEnumerable<CodeInstruction> EnemyAI_Trans_CheckLineOfSightForPosition(IEnumerable<CodeInstruction> instructions) { //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Expected O, but got Unknown //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Expected O, but got Unknown //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Expected O, but got Unknown //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Expected O, but got Unknown List<CodeInstruction> list = instructions.ToList(); Plugin.LogDebug("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(EnemyAIPatches), "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.LogError("Failed to transpile first Linecast mask on 'EnemyAI.CheckLineOfSightForPosition'!"); return list; } list.RemoveRange(num, 2); list.InsertRange(num, new <>z__ReadOnlyArray<CodeInstruction>((CodeInstruction[])(object)new CodeInstruction[2] { new CodeInstruction(OpCodes.Ldarg_0, (object)null), new CodeInstruction(OpCodes.Call, (object)methodInfo) })); int num2 = PatchUtils.LocateCodeSegment(num + 1, list, searchFor); if (num2 == -1) { Plugin.LogError("Failed to transpile second Linecast mask on 'EnemyAI.CheckLineOfSightForPosition'!"); return list; } list.RemoveRange(num2, 2); list.InsertRange(num2, new <>z__ReadOnlyArray<CodeInstruction>((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> EnemyAI_Trans_CurrentSearchCoroutine(IEnumerable<CodeInstruction> instructions, MethodBase method) { //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Expected O, but got Unknown //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_010c: 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 FieldInfo field = method.DeclaringType.GetField("<>4__this", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field == null) { Plugin.LogError("Failed to find the enumerator field pointing to EnemyAI (<>4__this)"); return instructions; } List<CodeInstruction> list = instructions.ToList(); Plugin.LogDebug("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(EnemyAIPatches), "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.LogError("Failed to transpile Linecast mask on 'EnemyAI.CurrentSearchCoroutine'!"); return list; } list.RemoveRange(num, 2); list.InsertRange(num, new <>z__ReadOnlyArray<CodeInstruction>((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.ShouldAllowSightThroughVehicle(player, enemy)) { return StartOfRound.Instance.collidersAndRoomMaskAndDefault; } return 33554433; } } [HarmonyPatch(typeof(ForestGiantAI))] public static class ForestGiantAIPatches { [HarmonyPatch("OnCollideWithPlayer")] [HarmonyTranspiler] private static IEnumerable<CodeInstruction> ForestGiantAI_Trans_OnCollideWithPlayer(IEnumerable<CodeInstruction> instructions) { //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Expected O, but got Unknown List<CodeInstruction> list = instructions.ToList(); Plugin.LogDebug("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<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.LogError("Failed to transpile Linecast mask on 'ForestGiantAI.OnCollideWithPlayer'!"); return list; } list.RemoveRange(num2, 2); list.InsertRange(num2, new <>z__ReadOnlySingleElementList<CodeInstruction>(new CodeInstruction(OpCodes.Ldc_I4, (object)num))); return list; } } [HarmonyPatch(typeof(GiantKiwiAI))] public static class GiantKiwiAIPatches { [HarmonyPatch("NavigateTowardsTargetPlayer")] [HarmonyTranspiler] private static IEnumerable<CodeInstruction> GiantKiwiAI_Trans_NavigateTowardsTargetPlayer(IEnumerable<CodeInstruction> instructions, ILGenerator generator) { //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Expected O, but got Unknown //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Expected O, but got Unknown //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Expected O, but got Unknown //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_0110: 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 List<CodeInstruction> list = instructions.ToList(); Plugin.LogDebug("Attempting to transpile 'NavigateTowardsTargetPlayer' for 'GiantKiwiAI'"); MethodInfo operand = PatchUtils.Method(typeof(Vector3), "Distance"); List<PatchUtils.OpcodeMatch> searchFor = new List<PatchUtils.OpcodeMatch> { 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.LogError("Failed to locate vehicle distance check on 'GiantKiwiAI.NavigateTowardsTargetPlayer'!"); return list; } Label label = generator.DefineLabel(); num += 3; list[num].labels.Add(label); list.InsertRange(num, new <>z__ReadOnlyArray<CodeInstruction>((CodeInstruction[])(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(GiantKiwiAIPatches), "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(MouthDogAI))] public static class MouthDogAIPatches { [HarmonyPatch("OnCollideWithPlayer")] [HarmonyTranspiler] private static IEnumerable<CodeInstruction> MouthDogAI_Trans_OnCollideWithPlayer(IEnumerable<CodeInstruction> instructions) { //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Expected O, but got Unknown List<CodeInstruction> list = instructions.ToList(); Plugin.LogDebug("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<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.LogError("Failed to transpile Linecast mask on 'MouthDogAI.OnCollideWithPlayer'!"); return list; } list.RemoveRange(num2, 2); list.InsertRange(num2, new <>z__ReadOnlySingleElementList<CodeInstruction>(new CodeInstruction(OpCodes.Ldc_I4, (object)num))); return list; } [HarmonyPatch("EnterLunge")] [HarmonyTranspiler] private static IEnumerable<CodeInstruction> MouthDogAI_Trans_EnterLunge(IEnumerable<CodeInstruction> instructions) { //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Expected O, but got Unknown List<CodeInstruction> list = instructions.ToList(); Plugin.LogDebug("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<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.LogError("Failed to transpile Raycast mask on 'MouthDogAI.EnterLunge'!"); return list; } list.RemoveRange(num2, 2); list.InsertRange(num2, new <>z__ReadOnlySingleElementList<CodeInstruction>(new CodeInstruction(OpCodes.Ldc_I4, (object)num))); return list; } } [HarmonyPatch(typeof(RadMechAI))] public static class RadMechAIPatches { [HarmonyPatch("CheckSightForThreat")] [HarmonyTranspiler] private static IEnumerable<CodeInstruction> RadMechAI_Trans_CheckSightForThreat(IEnumerable<CodeInstruction> instructions) { //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Expected O, but got Unknown //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Expected O, but got Unknown //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Expected O, but got Unknown //IL_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 //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Expected O, but got Unknown //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Expected O, but got Unknown //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: 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 List<CodeInstruction> list = instructions.ToList(); Plugin.LogDebug("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(RadMechAIPatches), "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.LogError("Failed to transpile first Linecast mask on 'RadMechAI.CheckSightForThreat'!"); return list; } list.RemoveRange(num, 2); list.InsertRange(num, new <>z__ReadOnlyArray<CodeInstruction>((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.LogError("Failed to transpile second Linecast mask on 'RadMechAI.CheckSightForThreat'!"); return list; } list.RemoveRange(num2, 2); list.InsertRange(num2, new <>z__ReadOnlyArray<CodeInstruction>((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<PlayerControllerB>(ref player)) { return StartOfRound.Instance.collidersAndRoomMaskAndDefault; } if (!Utilities.ShouldAllowSightThroughVehicle(player, (EnemyAI)(object)radMech)) { return StartOfRound.Instance.collidersAndRoomMaskAndDefault; } return 33554433; } } } namespace ScandalsTweaks.Compatibility { [HarmonyPatch] public static class CruiserImprovedCompatibility { [HarmonyPatch(typeof(LandminePatches), "ShouldNotDealKnockback")] [HarmonyPrefix] public static bool LandminePatches_Pre_ShouldNotDealKnockback(PlayerControllerB instance, ref bool __result) { if (!LandminePatches.ShouldCheckCustomKnockback()) { return true; } __result = !LandminePatches.CanPlayerBeKnockedBack(); return false; } } [HarmonyPatch] public static class JLLCompatibility { public static GameObject? kenjiDamageTriggerObj; [HarmonyPatch(typeof(JBlowerFan), "OnTriggerStay")] [HarmonyTranspiler] private static IEnumerable<CodeInstruction> JBlowerFan_Trans_OnTriggerStay(IEnumerable<CodeInstruction> instructions, ILGenerator generator) { //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_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Expected O, but got Unknown List<CodeInstruction> list = instructions.ToList(); Plugin.LogDebug("Attempting to transpile 'OnTriggerStay' for 'JBlowerFan'"); MethodInfo methodInfo = AccessTools.Method(typeof(JLLCompatibility), "ShouldBlowPlayer", (Type[])null, (Type[])null); FieldInfo operand = AccessTools.Field(typeof(PlayerControllerB), "externalForceAutoFade"); List<PatchUtils.OpcodeMatch> searchFor = new List<PatchUtils.OpcodeMatch> { new PatchUtils.OpcodeMatch(OpCodes.Ldloc_0), new PatchUtils.OpcodeMatch(OpCodes.Dup), new PatchUtils.OpcodeMatch(OpCodes.Ldfld, operand) }; int num = PatchUtils.LocateCodeSegment(0, list, searchFor); if (num == -1) { Plugin.LogError("Failed to transpile 'OnTriggerStay' on 'JBlowerFan.OnTriggerStay'!"); return list; } Label label = generator.DefineLabel(); list[num + 10].labels.Add(label); list.InsertRange(num, new <>z__ReadOnlyArray<CodeInstruction>((CodeInstruction[])(object)new CodeInstruction[3] { new CodeInstruction(OpCodes.Ldloc_0, (object)null), new CodeInstruction(OpCodes.Call, (object)methodInfo), new CodeInstruction(OpCodes.Brfalse_S, (object)label) })); return list; } public static void TrySetDamageTrigger(GameObject hurtObject) { DamageTrigger val = default(DamageTrigger); if (!((Object)(object)hurtObject == (Object)null) && hurtObject.TryGetComponent<DamageTrigger>(ref val)) { kenjiDamageTriggerObj = hurtObject; } } public static bool CanDamagePlayer(PlayerControllerB player) { return true; } [HarmonyPatch(typeof(DamageTrigger), "DamagePlayer")] [HarmonyPrefix] public static bool DamageTrigger_Pre_DamagePlayer(DamageTrigger __instance, PlayerControllerB player) { if ((Object)(object)((Component)__instance).gameObject == (Object)(object)kenjiDamageTriggerObj && !CanDamagePlayer(player)) { return false; } return true; } public static bool CanBlowPlayer(PlayerControllerB player) { return true; } private static bool ShouldBlowPlayer(PlayerControllerB instance) { if (instance.isInHangarShipRoom) { return false; } return CanBlowPlayer(instance); } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } } [CompilerGenerated] 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(); } } [CompilerGenerated] internal sealed class <>z__ReadOnlySingleElementList<T> : IEnumerable, ICollection, IList, IEnumerable<T>, IReadOnlyCollection<T>, IReadOnlyList<T>, ICollection<T>, IList<T> { private sealed class Enumerator : IDisposable, IEnumerator, IEnumerator<T> { object IEnumerator.Current => _item; T IEnumerator<T>.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<T>.Count => 1; T IReadOnlyList<T>.this[int index] { get { if (index != 0) { throw new IndexOutOfRangeException(); } return _item; } } int ICollection<T>.Count => 1; bool ICollection<T>.IsReadOnly => true; T IList<T>.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<T>.Default.Equals(_item, (T)value); } int IList.IndexOf(object value) { return (!EqualityComparer<T>.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<T> IEnumerable<T>.GetEnumerator() { return new Enumerator(_item); } void ICollection<T>.Add(T item) { throw new NotSupportedException(); } void ICollection<T>.Clear() { throw new NotSupportedException(); } bool ICollection<T>.Contains(T item) { return EqualityComparer<T>.Default.Equals(_item, item); } void ICollection<T>.CopyTo(T[] array, int arrayIndex) { array[arrayIndex] = _item; } bool ICollection<T>.Remove(T item) { throw new NotSupportedException(); } int IList<T>.IndexOf(T item) { return (!EqualityComparer<T>.Default.Equals(_item, item)) ? (-1) : 0; } void IList<T>.Insert(int index, T item) { throw new NotSupportedException(); } void IList<T>.RemoveAt(int index) { throw new NotSupportedException(); } }