Decompiled source of Collision v0.0.1

plugins/CollisionRundown.dll

Decompiled a week ago
using System;
using System.CodeDom.Compiler;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Globalization;
using System.Linq;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using AIGraph;
using AK;
using Agents;
using AssetShards;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using BepInEx.Unity.IL2CPP.Hook;
using BepInEx.Unity.IL2CPP.Utils.Collections;
using CConsole.Interop;
using ChainedPuzzles;
using CharacterDestruction;
using CollisionRundown.Features;
using CollisionRundown.Features.ForceConnectZones;
using CullingSystem;
using Enemies;
using FX_EffectSystem;
using GTFO.API;
using GameData;
using Gear;
using Globals;
using HarmonyLib;
using Il2CppInterop.Runtime;
using Il2CppInterop.Runtime.Injection;
using Il2CppInterop.Runtime.InteropTypes;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppInterop.Runtime.InteropTypes.Fields;
using Il2CppInterop.Runtime.Runtime;
using Il2CppSystem;
using Il2CppSystem.Collections.Generic;
using LevelGeneration;
using LevelGeneration.Core;
using Localization;
using Microsoft.CodeAnalysis;
using Player;
using SNetwork;
using SecDoorTerminalInterface;
using TMPro;
using UnityEngine;
using UnityEngine.Rendering;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("CollisionRundown")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("CollisionRundown")]
[assembly: AssemblyTitle("CollisionRundown")]
[assembly: TargetPlatform("Windows7.0")]
[assembly: SupportedOSPlatform("Windows7.0")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class IsUnmanagedAttribute : Attribute
	{
	}
	[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 CollisionRundown
{
	[AttributeUsage(AttributeTargets.Method)]
	internal sealed class AutoInvokeOnLoadAttribute : Attribute
	{
	}
	[BepInPlugin("CollisionRundown.GUID", "CollisionRundown", "1.0.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	internal class EntryPoint : BasePlugin
	{
		private Harmony _Harmony = null;

		public override void Load()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			_Harmony = new Harmony("CollisionRundown.Harmony");
			_Harmony.PatchAll();
			Type[] typesFromAssembly = AccessTools.GetTypesFromAssembly(((object)this).GetType().Assembly);
			IEnumerable<MethodInfo> enumerable = from method in ((IEnumerable<Type>)typesFromAssembly).SelectMany((Func<Type, IEnumerable<MethodInfo>>)AccessTools.GetDeclaredMethods)
				where method.GetCustomAttribute<AutoInvokeOnLoadAttribute>() != null
				where method.IsStatic
				select method;
			foreach (MethodInfo item in enumerable)
			{
				item.Invoke(null, null);
			}
		}

		public override bool Unload()
		{
			_Harmony.UnpatchSelf();
			return ((BasePlugin)this).Unload();
		}
	}
	internal static class Logger
	{
		private static readonly ManualLogSource _Logger;

		static Logger()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Expected O, but got Unknown
			_Logger = new ManualLogSource("CollisionRundown");
			Logger.Sources.Add((ILogSource)(object)_Logger);
		}

		private static string Format(object msg)
		{
			return msg.ToString();
		}

		public static void Info(BepInExInfoLogInterpolatedStringHandler handler)
		{
			_Logger.LogInfo(handler);
		}

		public static void Info(string str)
		{
			_Logger.LogMessage((object)str);
		}

		public static void Info(object data)
		{
			_Logger.LogMessage((object)Format(data));
		}

		public static void Debug(BepInExDebugLogInterpolatedStringHandler handler)
		{
			_Logger.LogDebug(handler);
		}

		public static void Debug(string str)
		{
			_Logger.LogDebug((object)str);
		}

		public static void Debug(object data)
		{
			_Logger.LogDebug((object)Format(data));
		}

		public static void Error(BepInExErrorLogInterpolatedStringHandler handler)
		{
			_Logger.LogError(handler);
		}

		public static void Error(string str)
		{
			_Logger.LogError((object)str);
		}

		public static void Error(object data)
		{
			_Logger.LogError((object)Format(data));
		}

		public static void Fatal(BepInExFatalLogInterpolatedStringHandler handler)
		{
			_Logger.LogFatal(handler);
		}

		public static void Fatal(string str)
		{
			_Logger.LogFatal((object)str);
		}

		public static void Fatal(object data)
		{
			_Logger.LogFatal((object)Format(data));
		}

		public static void Warn(BepInExWarningLogInterpolatedStringHandler handler)
		{
			_Logger.LogWarning(handler);
		}

		public static void Warn(string str)
		{
			_Logger.LogWarning((object)str);
		}

		public static void Warn(object data)
		{
			_Logger.LogWarning((object)Format(data));
		}

		[Conditional("DEBUG")]
		public static void DebugOnly(object data)
		{
			_Logger.LogDebug((object)Format(data));
		}
	}
	[GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
	[DebuggerNonUserCode]
	[CompilerGenerated]
	internal class Resource
	{
		private static ResourceManager resourceMan;

		private static CultureInfo resourceCulture;

		[EditorBrowsable(EditorBrowsableState.Advanced)]
		internal static ResourceManager ResourceManager
		{
			get
			{
				if (resourceMan == null)
				{
					ResourceManager resourceManager = new ResourceManager("CollisionRundown.Resource", typeof(Resource).Assembly);
					resourceMan = resourceManager;
				}
				return resourceMan;
			}
		}

		[EditorBrowsable(EditorBrowsableState.Advanced)]
		internal static CultureInfo Culture
		{
			get
			{
				return resourceCulture;
			}
			set
			{
				resourceCulture = value;
			}
		}

		internal static byte[] marker_shadow
		{
			get
			{
				object @object = ResourceManager.GetObject("marker_shadow", resourceCulture);
				return (byte[])@object;
			}
		}

		internal Resource()
		{
		}
	}
	[GeneratedCode("VersionInfoGenerator", "2.1.3+git35c0c2a-master")]
	[CompilerGenerated]
	internal static class VersionInfo
	{
		public const string RootNamespace = "CollisionRundown";

		public const string Version = "1.0.0";

		public const string VersionPrerelease = null;

		public const string VersionMetadata = null;

		public const string SemVer = "1.0.0";

		public const string GitRevShort = null;

		public const string GitRevLong = null;

		public const string GitBranch = null;

		public const string GitTag = null;

		public const int GitCommitsSinceTag = 0;

		public const bool GitIsDirty = false;
	}
}
namespace CollisionRundown.Netcode
{
	internal class LevelVariable<T> where T : unmanaged
	{
	}
}
namespace CollisionRundown.LevelSpecifics
{
	internal sealed class ARC_D1_Androgynous : LevelBehaviour
	{
		private SecDoorTerminal _OverloadSDT;

		private LG_WardenObjective_Reactor _Reactor;

		private eReactorStatus _ReactorOldStatus;

		private int _ReactorOldWave;

		private int _SecID_ReactorToHub;

		private int _SecID_HubToAttackB;

		private LG_SecurityDoor _Sec_ReactorToHub;

		private LG_SecurityDoor _Sec_HubToAttackB;

		private readonly string[] _ReactorCmdList = new string[6] { "REACTOR_COOLANT_MAIN_OK", "REACTOR_COOLANT_SUB_OK", "REACTOR_CLOSE_X05_DRAIN", "REACTOR_ROD_CLUSTER_A_OK", "REACTOR_ROD_CLUSTER_B_OK", "REACTOR_OK" };

		public override uint RundownID => 1u;

		public override eRundownTier TargetTier => (eRundownTier)4;

		public override int TargetIndex => 0;

		public override void OnBuildBatchStarted(BatchName batchName)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Invalid comparison between Unknown and I4
			if ((int)batchName == 6)
			{
				_SecID_ReactorToHub = ForceConnectZone.Build((eDimensionIndex)0, (LG_LayerType)2, (eLocalZoneIndex)2, (eLocalZoneIndex)7);
				_SecID_HubToAttackB = ForceConnectZone.Build((eDimensionIndex)0, (LG_LayerType)2, (eLocalZoneIndex)11, (eLocalZoneIndex)7);
			}
		}

		public override void OnBuildBatchFinished(BatchName batchName)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0004: Invalid comparison between Unknown and I4
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			if ((int)batchName != 40)
			{
				return;
			}
			LG_SecurityDoor val = LevelBehaviour.FindSecDoorInLevel((LG_LayerType)2, (eLocalZoneIndex)13);
			_OverloadSDT = SecDoorTerminal.Place(val, (TerminalStartStateData)null, (TerminalPlacementData)null);
			_OverloadSDT.AddCommand(new CommandDescriptor
			{
				Command = "OPEN_SECTOR_Z20",
				Description = "Open the Sector Z20",
				Rule = (TERM_CommandRule)2,
				Type = (TERM_Command)251
			}, (Action<LG_ComputerTerminalCommandInterpreter>)delegate(LG_ComputerTerminalCommandInterpreter cmd)
			{
				cmd.AddOutput((TerminalLineType)4, "Initiating Sample Lab Door control protocol...", 3f, (TerminalSoundType)0, (TerminalSoundType)0);
				cmd.AddOutput((TerminalLineType)2, "Door Clamp Depressurize...", 1.5f, (TerminalSoundType)0, (TerminalSoundType)2);
				cmd.AddOutput((TerminalLineType)2, "Checking Sector Power Status...", 0.75f, (TerminalSoundType)0, (TerminalSoundType)2);
				cmd.AddOutput((TerminalLineType)2, "Checking Motion Trigger Status...", 0.75f, (TerminalSoundType)0, (TerminalSoundType)2);
				cmd.AddOutput((TerminalLineType)2, "Checking Outer Sector Air Condition...", 0.75f, (TerminalSoundType)0, (TerminalSoundType)2);
				cmd.AddOutput((TerminalLineType)3, "Checking Inner Sector Air Condition...", 0.75f, (TerminalSoundType)0, (TerminalSoundType)3);
				cmd.AddOutput((TerminalLineType)1, "<color=red>ERROR::SATETY PROTOCOL UNMET!</color>", 3f, (TerminalSoundType)3, (TerminalSoundType)0);
				cmd.AddOutputEmptyLine(0f);
				cmd.AddOutput((TerminalLineType)0, "Do you want to force override the door? Type [<color=orange>CONFIRM</color>] if you confirm", 0f, (TerminalSoundType)0, (TerminalSoundType)0);
				cmd.AddOutput((TerminalLineType)1, "<color=orange>WARNING::This will restart the <color=red>ventilation system</color> by procedure</color>", 0f, (TerminalSoundType)0, (TerminalSoundType)0);
				_OverloadSDT.SetEndOfQueue((Action)delegate
				{
					//IL_0009: Unknown result type (might be due to invalid IL or missing references)
					//IL_002a: Unknown result type (might be due to invalid IL or missing references)
					//IL_0036: Unknown result type (might be due to invalid IL or missing references)
					//IL_003b: Unknown result type (might be due to invalid IL or missing references)
					_OverloadSDT.AddCommand(new CommandDescriptor
					{
						Command = "CONFIRM",
						Description = "CONFIRM",
						Rule = (TERM_CommandRule)2,
						Type = (TERM_Command)250
					}, (Action<LG_ComputerTerminalCommandInterpreter>)delegate(LG_ComputerTerminalCommandInterpreter cmd)
					{
						cmd.AddOutput((TerminalLineType)3, "Initiating Force open...", 2f, (TerminalSoundType)0, (TerminalSoundType)0);
						_OverloadSDT.ForceOpenDoor(2f);
					});
				});
			});
		}

		public override void OnLevelStart()
		{
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: 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_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_0190: Unknown result type (might be due to invalid IL or missing references)
			//IL_0195: Unknown result type (might be due to invalid IL or missing references)
			//IL_019d: Unknown result type (might be due to invalid IL or missing references)
			//IL_01aa: Expected O, but got Unknown
			//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_01af: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c5: Expected O, but got Unknown
			//IL_0257: Unknown result type (might be due to invalid IL or missing references)
			//IL_0260: Unknown result type (might be due to invalid IL or missing references)
			//IL_0265: Unknown result type (might be due to invalid IL or missing references)
			Patch_ReactorMessageBlacklist.IDsToBlock.Add(Text.InGame_WardenIntel_Reactors_TestSequenceRestart);
			Patch_ReactorMessageBlacklist.IDsToBlock.Add(Text.InGame_WardenIntel_Reactors_TestSequenceSecurityVerification);
			Patch_ReactorMessageBlacklist.IDsToBlock.Add(Text.InGame_WardenIntel_Reactors_TestSequenceWarmingUp);
			_Reactor = LevelBehaviour.FindObjectInLevel<LG_WardenObjective_Reactor>(includeInactive: false);
			_ReactorOldStatus = (eReactorStatus)0;
			_ReactorOldWave = 0;
			_Reactor.m_terminal.TrySyncSetCommandHidden((TERM_Command)22);
			WardenObjectiveDataBlock val = default(WardenObjectiveDataBlock);
			WardenObjectiveManager.TryGetWardenObjectiveDataForLayer(_Reactor.OriginLayer, 0, ref val);
			List<ReactorWaveData> reactorWaves = val.ReactorWaves;
			int count = reactorWaves.Count;
			LG_Zone val3 = default(LG_Zone);
			for (int i = 0; i < count; i++)
			{
				ReactorWaveData val2 = reactorWaves[i];
				Builder.CurrentFloor.TryGetZoneByLocalIndex(_Reactor.SpawnNode.m_dimension.DimensionIndex, _Reactor.OriginLayer, val2.ZoneForVerification, ref val3);
				Enumerator<LG_ComputerTerminal> enumerator = val3.TerminalsSpawnedInZone.GetEnumerator();
				while (enumerator.MoveNext())
				{
					LG_ComputerTerminal current = enumerator.Current;
					if (current.ItemKey.Equals(val2.VerificationTerminalSerial))
					{
						current.ConnectedReactor = _Reactor;
						current.RemoveLocalLog(val2.VerificationTerminalFileName.ToUpperInvariant());
						current.m_command.AddCommand((TERM_Command)42, _ReactorCmdList[i], LocalizedText.op_Implicit(0u), (TERM_CommandRule)0);
						current.TrySyncSetCommandRule((TERM_Command)42, (TERM_CommandRule)0);
					}
				}
			}
			ForceConnectZone.TryGetDoor(_SecID_ReactorToHub, out _Sec_ReactorToHub);
			ForceConnectZone.TryGetDoor(_SecID_HubToAttackB, out _Sec_HubToAttackB);
			LocalizedText val4 = new LocalizedText
			{
				Id = 0u,
				UntranslatedText = "Insufficent Power! [<color=orange>REQ::POWER_LEVEL_VI</color>]"
			};
			LocalizedText val5 = new LocalizedText
			{
				Id = 0u,
				UntranslatedText = "Insufficent Power! [<color=orange>REQ::POWER_LEVEL_VII</color>]"
			};
			_Sec_HubToAttackB.SetupAsLockedNoKey(val4);
			_Sec_ReactorToHub.SetupAsLockedNoKey(val5);
			if (!SNet.IsMaster)
			{
				return;
			}
			IEnumerable<LG_WeakResourceContainer> source = LevelBehaviour.FindObjectsInLevel<LG_WeakResourceContainer>(includeInactive: false);
			foreach (LG_WeakResourceContainer item in source.Where((LG_WeakResourceContainer c) => PreOpenedLockerZone(c.SpawnNode)))
			{
				item.TriggerOpen(true);
				if ((Object)(object)item.m_weakLock != (Object)null)
				{
					item.m_weakLock.AttemptInteract(new pWeakLockInteraction
					{
						type = (eWeakLockInteractionType)1
					});
				}
			}
		}

		public override void LateUpdate()
		{
			UpdateSDT();
			UpdateReactor();
		}

		private void UpdateSDT()
		{
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Invalid comparison between Unknown and I4
			if (_OverloadSDT != null && !((Object)(object)_OverloadSDT.ComputerTerminal == (Object)null) && !((Object)(object)_OverloadSDT.LinkedDoor == (Object)null) && (int)_OverloadSDT.LinkedDoor.m_sync.GetCurrentSyncState().status == 7 && _OverloadSDT.IsTerminalActive)
			{
				_OverloadSDT.SetTerminalActive(false);
				_OverloadSDT.SetIdleText("<color=red>::POWERLINE INSUFFICENT::</color>");
			}
		}

		private void UpdateReactor()
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Invalid comparison between Unknown and I4
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Invalid comparison between Unknown and I4
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Invalid comparison between Unknown and I4
			//IL_0254: 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_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: Unknown result type (might be due to invalid IL or missing references)
			//IL_0136: Unknown result type (might be due to invalid IL or missing references)
			//IL_013c: Invalid comparison between Unknown and I4
			//IL_0270: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0180: Unknown result type (might be due to invalid IL or missing references)
			//IL_0186: Unknown result type (might be due to invalid IL or missing references)
			//IL_0442: Unknown result type (might be due to invalid IL or missing references)
			//IL_0448: Unknown result type (might be due to invalid IL or missing references)
			//IL_0479: Unknown result type (might be due to invalid IL or missing references)
			//IL_047f: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)_Reactor == (Object)null)
			{
				return;
			}
			pReactorState currentState = _Reactor.m_currentState;
			_Reactor.ReadyForVerification = (int)_Reactor.m_currentState.status == 3;
			eReactorStatus status = currentState.status;
			eReactorStatus val = status;
			if ((int)val != 2)
			{
				if (val - 3 <= 1)
				{
					string verificationTerminalSerial = _Reactor.m_currentWaveData.VerificationTerminalSerial;
					string value = _ReactorCmdList[_Reactor.m_currentWaveCount - 1];
					_Reactor.SetGUIMessage(true, $"PERFORMING OVERLOAD TEST :: ADMIN FOR <color=orange>{verificationTerminalSerial}</color> SHOULD USE COMMAND <color=orange>{value}</color> TO CONTINUE", (ePUIMessageStyle)4, false, "", "");
				}
			}
			else
			{
				_Reactor.SetGUIMessage(true, "Cooling down Reactor core...", (ePUIMessageStyle)0, true, "", "");
			}
			if (currentState.status != _ReactorOldStatus)
			{
				_ReactorOldStatus = currentState.status;
				if ((int)currentState.status == 5)
				{
					if (SNet.IsMaster)
					{
						LG_SecurityDoor val2 = LevelBehaviour.FindSecDoorInLevel((LG_LayerType)2, (eLocalZoneIndex)13);
						val2.AttemptOpenCloseInteraction(true);
					}
					_Sec_ReactorToHub.m_sync.AttemptDoorInteraction((eDoorInteractionType)0, 0f, 0f, default(Vector3), (Agent)null);
					string formattedText = ((LG_ZoneExpander)_Sec_ReactorToHub.Gate).m_linksTo.m_zone.NavInfo.GetFormattedText((LG_NavInfoFormat)6);
					string formattedText2 = ((LG_ZoneExpander)_Sec_ReactorToHub.Gate).m_linksFrom.m_zone.NavInfo.GetFormattedText((LG_NavInfoFormat)6);
					GuiManager.PlayerLayer.m_wardenIntel.ShowSubObjectiveMessage("", $"PASSAGE DOOR FOR <color=orange>{formattedText}</color>-<color=orange>{formattedText2}</color> has opened!", false, 200f, 8f, (Action)null);
					GuiManager.PlayerLayer.m_objectiveTimer.SetTimerActive(false, true);
				}
			}
			if (currentState.stateCount == _ReactorOldWave)
			{
				return;
			}
			_ReactorOldWave = currentState.stateCount;
			GuiManager.PlayerLayer.m_objectiveTimer.SetTimerActive(true, true);
			GuiManager.PlayerLayer.m_objectiveTimer.SetTimerTextEnabled(false);
			GuiManager.PlayerLayer.m_objectiveTimer.UpdateTimerTitle($"POWERLINE LEVEL: <color=orange>{currentState.stateCount}</color>");
			LG_SecurityDoor val3 = null;
			switch (_ReactorOldWave)
			{
			case 1:
				val3 = LevelBehaviour.FindSecDoorInLevel((LG_LayerType)2, (eLocalZoneIndex)3);
				break;
			case 2:
				val3 = LevelBehaviour.FindSecDoorInLevel((LG_LayerType)2, (eLocalZoneIndex)5);
				break;
			case 3:
				val3 = LevelBehaviour.FindSecDoorInLevel((LG_LayerType)2, (eLocalZoneIndex)7);
				break;
			case 4:
				val3 = LevelBehaviour.FindSecDoorInLevel((LG_LayerType)2, (eLocalZoneIndex)8);
				break;
			case 5:
				val3 = LevelBehaviour.FindSecDoorInLevel((LG_LayerType)2, (eLocalZoneIndex)10);
				break;
			case 6:
			{
				val3 = LevelBehaviour.FindSecDoorInLevel((LG_LayerType)2, (eLocalZoneIndex)12);
				string formattedText3 = ((LG_ZoneExpander)_Sec_HubToAttackB.Gate).m_linksTo.m_zone.NavInfo.GetFormattedText((LG_NavInfoFormat)6);
				string formattedText4 = ((LG_ZoneExpander)_Sec_HubToAttackB.Gate).m_linksFrom.m_zone.NavInfo.GetFormattedText((LG_NavInfoFormat)6);
				GuiManager.PlayerLayer.m_wardenIntel.ShowSubObjectiveMessage("", $"PASSAGE DOOR FOR <color=orange>{formattedText3}</color>-<color=orange>{formattedText4}</color> has unlocked!", false, 200f, 8f, (Action)null);
				if (SNet.IsMaster)
				{
					_Sec_HubToAttackB.m_sync.AttemptDoorInteraction((eDoorInteractionType)0, 0f, 0f, default(Vector3), (Agent)null);
					ushort num = default(ushort);
					Mastermind.Current.TriggerSurvivalWave(_Reactor.SpawnNode, 196u, 18u, ref num, (SurvivalWaveSpawnType)0, 6f, 2f, true, false, default(Vector3), "");
				}
				break;
			}
			}
			if ((Object)(object)val3 != (Object)null)
			{
				string formattedText5 = ((LG_ZoneExpander)val3.Gate).m_linksTo.m_zone.NavInfo.GetFormattedText((LG_NavInfoFormat)6);
				GuiManager.PlayerLayer.m_wardenIntel.ShowSubObjectiveMessage("", "DOOR TO <color=orange>" + formattedText5 + "</color> has unlocked", false, 200f, 8f, (Action)null);
				if (SNet.IsMaster)
				{
					val3.AttemptOpenCloseInteraction(true);
				}
			}
		}

		private static bool PreOpenedLockerZone(AIG_CourseNode node)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Invalid comparison between Unknown and I4
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Invalid comparison between Unknown and I4
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Invalid comparison between Unknown and I4
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Invalid comparison between Unknown and I4
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Invalid comparison between Unknown and I4
			LG_Zone zone = node.m_zone;
			if ((int)zone.DimensionIndex > 0)
			{
				return false;
			}
			if ((int)zone.Layer.m_type != 2)
			{
				return false;
			}
			eLocalZoneIndex localIndex = zone.LocalIndex;
			return (int)localIndex == 2 || (int)localIndex == 1 || (int)localIndex == 7;
		}
	}
	internal abstract class LevelBehaviour
	{
		public abstract uint RundownID { get; }

		public abstract eRundownTier TargetTier { get; }

		public abstract int TargetIndex { get; }

		public virtual void OnLevelSelected()
		{
		}

		public virtual void OnLevelDeselected()
		{
		}

		public virtual void OnLevelStart()
		{
		}

		public virtual void OnBuildBatchStarted(BatchName batchName)
		{
		}

		public virtual void OnBuildBatchFinished(BatchName batchName)
		{
		}

		public virtual void OnLevelBuilt()
		{
		}

		public virtual void Update()
		{
		}

		public virtual void FixedUpdate()
		{
		}

		public virtual void LateUpdate()
		{
		}

		public static C FindObjectInLevel<C>(bool includeInactive = false) where C : Object
		{
			return ((Component)Builder.CurrentFloor).GetComponentInChildren<C>(includeInactive);
		}

		public static IEnumerable<C> FindObjectsInLevel<C>(bool includeInactive = false) where C : Object
		{
			return (IEnumerable<C>)((Component)Builder.CurrentFloor).GetComponentsInChildren<C>(includeInactive);
		}

		public static LG_SecurityDoor FindSecDoorInLevel(LG_LayerType layer, eLocalZoneIndex localindex)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			return FindSecDoorInLevel((eDimensionIndex)0, layer, localindex);
		}

		public static LG_SecurityDoor FindSecDoorInLevel(eDimensionIndex dim, LG_LayerType layer, eLocalZoneIndex localindex)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			LG_Zone val = default(LG_Zone);
			Builder.CurrentFloor.TryGetZoneByLocalIndex(dim, layer, localindex, ref val);
			if ((Object)(object)val == (Object)null)
			{
				return null;
			}
			if ((Object)(object)val.m_sourceGate == (Object)null)
			{
				return null;
			}
			if (val.m_sourceGate.SpawnedDoor == null)
			{
				return null;
			}
			return ((Il2CppObjectBase)val.m_sourceGate.SpawnedDoor).TryCast<LG_SecurityDoor>();
		}

		public static SecDoorTerminal PlaceSecDoorTerminal(LG_LayerType layer, eLocalZoneIndex localindex)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			return PlaceSecDoorTerminal((eDimensionIndex)0, layer, localindex);
		}

		public static SecDoorTerminal PlaceSecDoorTerminal(eDimensionIndex dim, LG_LayerType layer, eLocalZoneIndex localindex)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			LG_SecurityDoor val = FindSecDoorInLevel(dim, layer, localindex);
			if ((Object)(object)val == (Object)null)
			{
				return null;
			}
			return SecDoorTerminal.Place(val, (TerminalStartStateData)null, (TerminalPlacementData)null);
		}
	}
	internal static class LevelBehaviourManager
	{
		[HarmonyPatch(typeof(LG_Factory), "NextBatch")]
		private static class Patch_LGBatch
		{
			private static void Prefix(LG_Factory __instance)
			{
				//IL_001b: Unknown result type (might be due to invalid IL or missing references)
				if (__instance.m_batchStep > -1)
				{
					ActiveBehaviour?.OnBuildBatchFinished(__instance.m_currentBatchName);
				}
			}

			private static void Postfix(LG_Factory __instance)
			{
				//IL_000d: Unknown result type (might be due to invalid IL or missing references)
				ActiveBehaviour?.OnBuildBatchStarted(__instance.m_currentBatchName);
			}
		}

		[CompilerGenerated]
		private static class <>O
		{
			public static Action <0>__LevelAPI_OnEnterLevel;

			public static Action <1>__LevelAPI_OnBuildDone;

			public static LevelSelectedEvent <2>__LevelAPI_OnLevelSelected;
		}

		private static readonly LevelBehaviour[] s_LevelBehaviours = new LevelBehaviour[2]
		{
			new T1_Tutorial(),
			new ARC_D1_Androgynous()
		};

		public static LevelBehaviour ActiveBehaviour { get; private set; }

		[AutoInvokeOnLoad]
		public static void Init()
		{
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Expected O, but got Unknown
			LevelAPI.OnEnterLevel += LevelAPI_OnEnterLevel;
			LevelAPI.OnBuildDone += LevelAPI_OnBuildDone;
			object obj = <>O.<2>__LevelAPI_OnLevelSelected;
			if (obj == null)
			{
				LevelSelectedEvent val = LevelAPI_OnLevelSelected;
				<>O.<2>__LevelAPI_OnLevelSelected = val;
				obj = (object)val;
			}
			LevelAPI.OnLevelSelected += (LevelSelectedEvent)obj;
			UpdateHooks.OnUpdate += delegate
			{
				ActiveBehaviour?.Update();
			};
			UpdateHooks.OnLateUpdate += delegate
			{
				ActiveBehaviour?.LateUpdate();
			};
			UpdateHooks.OnFixedUpdate += delegate
			{
				ActiveBehaviour?.FixedUpdate();
			};
		}

		private static void LevelAPI_OnBuildDone()
		{
			ActiveBehaviour?.OnLevelBuilt();
		}

		private static void LevelAPI_OnLevelSelected(eRundownTier expTier, int expIndexInTier, ExpeditionInTierData expData)
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Expected O, but got Unknown
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			ActiveBehaviour?.OnLevelDeselected();
			ActiveBehaviour = null;
			bool flag = default(bool);
			BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(29, 3, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Exp Change :: RD: ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<uint>(Global.RundownIdToLoad);
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(", TR: ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<eRundownTier>(expTier);
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(", ID:");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(expIndexInTier);
			}
			Logger.Error(val);
			LevelBehaviour[] array = s_LevelBehaviours;
			foreach (LevelBehaviour levelBehaviour in array)
			{
				if (levelBehaviour.RundownID == Global.RundownIdToLoad && levelBehaviour.TargetTier == expTier && levelBehaviour.TargetIndex == expIndexInTier)
				{
					ActiveBehaviour = levelBehaviour;
					ActiveBehaviour.OnLevelSelected();
					break;
				}
			}
		}

		private static void LevelAPI_OnEnterLevel()
		{
			ActiveBehaviour?.OnLevelStart();
		}
	}
	internal sealed class T1_Tutorial : LevelBehaviour
	{
		public int PowerStep = 1;

		public override uint RundownID => 1u;

		public override eRundownTier TargetTier => (eRundownTier)1;

		public override int TargetIndex => 0;

		public override void OnLevelStart()
		{
			PowerStep = 4;
		}

		public override void LateUpdate()
		{
			if (PowerStep <= 3)
			{
				((RectTransformComp)GuiManager.PlayerLayer.m_wardenObjective).SetVisible(false);
				((GuiLayerComp)GuiManager.PlayerLayer.m_compass).SetVisible(false, false);
			}
			if (PowerStep <= 2)
			{
				((GuiLayer)GuiManager.WatermarkLayer).SetVisible(false);
				((GuiLayer)GuiManager.CrosshairLayer).SetVisible(false);
			}
			if (PowerStep <= 1)
			{
				((Component)GuiManager.PlayerLayer.m_wardenIntel).gameObject.SetActive(false);
				((RectTransformComp)GuiManager.PlayerLayer.Inventory).SetVisible(false);
				((RectTransformComp)GuiManager.PlayerLayer.m_playerStatus).SetVisible(false);
			}
		}
	}
	internal sealed class UpdateHooks : MonoBehaviour
	{
		public static event Action OnUpdate;

		public static event Action OnFixedUpdate;

		public static event Action OnLateUpdate;

		[AutoInvokeOnLoad]
		private static void Init()
		{
			ClassInjector.RegisterTypeInIl2Cpp<UpdateHooks>();
			AssetAPI.OnImplReady += GameLoaded;
		}

		private static void GameLoaded()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			GameObject val = new GameObject("CollisionRDN Update Hooks");
			Object.DontDestroyOnLoad((Object)(object)val);
			val.AddComponent<UpdateHooks>();
		}

		private void Update()
		{
			UpdateHooks.OnUpdate?.Invoke();
		}

		private void FixedUpdate()
		{
			UpdateHooks.OnFixedUpdate?.Invoke();
		}

		private void LateUpdate()
		{
			UpdateHooks.OnLateUpdate?.Invoke();
		}
	}
}
namespace CollisionRundown.Extensions
{
	public static class LGExtensions
	{
		public static bool IsSame(this LG_GridPosition position, LG_GridPosition other)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: 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)
			return position.x == other.x && position.z == other.z;
		}

		public static LG_GridPosition ToNormalGrid(this LG_Tile tile, int gridSize)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//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_0015: Unknown result type (might be due to invalid IL or missing references)
			return tile.m_shape.m_gridPosition.GetNormal(gridSize);
		}

		public static LG_GridPosition GetNormal(this LG_GridPosition position, int gridSize)
		{
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: 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)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: 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_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			LG_GridPosition result;
			if (gridSize < 0)
			{
				result = default(LG_GridPosition);
				result.x = position.x - 32;
				result.z = position.z - 32;
				return result;
			}
			int num = gridSize / 2;
			result = default(LG_GridPosition);
			result.x = position.x - num;
			result.z = position.z - num;
			return result;
		}

		public static Vector3 GetPositionNormal(this LG_Grid grid, int x, int z, int gridSize)
		{
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			if (gridSize < 0)
			{
				return ((CellGridBase<LG_Grid, LG_Tile, LG_Cell>)(object)grid).GetPosition(x + 32, z + 32);
			}
			int num = gridSize / 2;
			return ((CellGridBase<LG_Grid, LG_Tile, LG_Cell>)(object)grid).GetPosition(x + num, z + num);
		}

		public static int GetGridSize(this Dimension dimension)
		{
			return ((CellGridBase<LG_Grid, LG_Tile, LG_Cell>)(object)dimension.Grid).m_sizeX;
		}

		public static bool TryGetDimension(this LG_Floor floor, int dimensionIndex, out Dimension dimension)
		{
			if (Enum.IsDefined(typeof(eDimensionIndex), dimensionIndex))
			{
				return floor.GetDimension((eDimensionIndex)dimensionIndex, ref dimension);
			}
			dimension = null;
			return false;
		}

		public static bool TryGetDimension(this LG_Floor floor, eDimensionIndex dimensionIndex, out Dimension dimension)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			if (Enum.IsDefined(typeof(eDimensionIndex), dimensionIndex))
			{
				return floor.GetDimension(dimensionIndex, ref dimension);
			}
			dimension = null;
			return false;
		}
	}
}
namespace CollisionRundown.Debugs
{
	internal static class CConsoleCommandInjector
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static OnCommandUsedDelegate <0>__MusicRTPC;

			public static OnCommandUsedDelegate <1>__MusicPlay;
		}

		[AutoInvokeOnLoad]
		public static void Init()
		{
			if (((BaseChainloader<BasePlugin>)(object)IL2CPPChainloader.Instance).Plugins.TryGetValue("CConsole", out var _))
			{
				LoadCommands();
			}
		}

		private static void LoadCommands()
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Expected O, but got Unknown
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Expected O, but got Unknown
			CustomCommandSetting val = default(CustomCommandSetting);
			val.Command = "MusicRTPC";
			val.Usage = "MusicRTPC <id> <value>";
			val.MinArgumentCount = 2;
			val.RequireInLevel = true;
			CustomCommandSetting val2 = val;
			object obj = <>O.<0>__MusicRTPC;
			if (obj == null)
			{
				OnCommandUsedDelegate val3 = MusicRTPC;
				<>O.<0>__MusicRTPC = val3;
				obj = (object)val3;
			}
			CustomCommands.Register(val2, (OnCommandUsedDelegate)obj);
			val = default(CustomCommandSetting);
			val.Command = "MusicPlay";
			val.Usage = "MusicPlay <id>";
			val.MinArgumentCount = 1;
			val.RequireInLevel = true;
			CustomCommandSetting val4 = val;
			object obj2 = <>O.<1>__MusicPlay;
			if (obj2 == null)
			{
				OnCommandUsedDelegate val5 = MusicPlay;
				<>O.<1>__MusicPlay = val5;
				obj2 = (object)val5;
			}
			CustomCommands.Register(val4, (OnCommandUsedDelegate)obj2);
		}

		private static void MusicRTPC(in CustomCmdContext context, string[] args)
		{
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			if (!float.TryParse(args[1], out var result))
			{
				context.LogError("Invalid Value");
				return;
			}
			context.Log($"Set RTPC {args[0]} to {result}");
			MusicManager.Current.m_machine.Sound.SetRTPCValue(args[0], result);
		}

		private static void MusicPlay(in CustomCmdContext context, string[] args)
		{
			MusicManager.Current.m_machine.Sound.Post(args[0], true);
		}
	}
}
namespace CollisionRundown.CustomGears.SpecialReloadTypes
{
	[HarmonyPatch(typeof(PUI_Inventory), "SetSlotAmmo")]
	internal static class Patch_PUI_InventoryItem
	{
		private static void Postfix(PUI_Inventory __instance, InventorySlot slot, int clipAbs, int inPackAbs)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Invalid comparison between Unknown and I4
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Invalid comparison between Unknown and I4
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			if (((int)slot == 1 || (int)slot == 2) && TryGetSlotItem(__instance, slot, out var value) && value.m_selected_root.active && Patch_SpecialReloads.AutoReload == AutoReloadType.AlwaysFullClip)
			{
				((TMP_Text)value.m_selected_ammoClip).text = (clipAbs + inPackAbs).ToString();
			}
		}

		private static bool TryGetSlotItem(PUI_Inventory inventory, InventorySlot key, out PUI_InventoryItem value)
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			value = null;
			Enumerator<InventorySlot, PUI_InventoryItem> enumerator = inventory.m_inventorySlots.GetEnumerator();
			while (enumerator.MoveNext())
			{
				KeyValuePair<InventorySlot, PUI_InventoryItem> current = enumerator.Current;
				if (current.Key == key)
				{
					value = current.Value;
					break;
				}
			}
			return (Object)(object)value != (Object)null;
		}
	}
	public enum AutoReloadType
	{
		None,
		AlwaysFullClip,
		AutoReload
	}
	[HarmonyPatch(typeof(BulletWeapon))]
	internal static class Patch_SpecialReloads
	{
		public static AutoReloadType AutoReload;

		[HarmonyPostfix]
		[HarmonyPatch("OnUnWield")]
		private static void Post_UnWield(BulletWeapon __instance)
		{
			if (!((Object)(object)((Item)__instance).Owner == (Object)null) && ((Agent)((Item)__instance).Owner).IsLocallyOwned)
			{
				AutoReload = AutoReloadType.None;
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch("OnWield")]
		private static void Post_Wield(BulletWeapon __instance)
		{
			if (!((Object)(object)((Item)__instance).Owner == (Object)null) && ((Agent)((Item)__instance).Owner).IsLocallyOwned)
			{
				string name = ((GameDataBlockBase<ArchetypeDataBlock>)(object)((ItemEquippable)__instance).ArchetypeData).name;
				if (name.Contains("AUTORELOAD_NOANIM", StringComparison.OrdinalIgnoreCase))
				{
					AutoReload = AutoReloadType.AlwaysFullClip;
					((MonoBehaviour)__instance).StartCoroutine(CollectionExtensions.WrapToIl2Cpp(AmmoObserver(__instance)));
				}
				else if (name.Contains("AUTORELOAD_ANIM", StringComparison.OrdinalIgnoreCase))
				{
					AutoReload = AutoReloadType.AutoReload;
					((MonoBehaviour)__instance).StartCoroutine(CollectionExtensions.WrapToIl2Cpp(AmmoObserver(__instance)));
				}
				else
				{
					AutoReload = AutoReloadType.None;
				}
				DoReload(__instance);
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch("UpdateAmmoStatus")]
		private static void Post_UpdateAmmoStatus(BulletWeapon __instance)
		{
			DoReload(__instance);
		}

		private static IEnumerator AmmoObserver(BulletWeapon weapon)
		{
			int currentTotalAmmo = TotalAmmoOf(weapon);
			while (true)
			{
				yield return null;
				int totalAmmo = TotalAmmoOf(weapon);
				if (currentTotalAmmo != totalAmmo)
				{
					currentTotalAmmo = totalAmmo;
					DoReload(weapon);
				}
			}
		}

		private static int TotalAmmoOf(BulletWeapon weapon)
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			int currentClip = ((ItemEquippable)weapon).GetCurrentClip();
			int bulletsInPack = PlayerBackpackManager.LocalBackpack.AmmoStorage.GetBulletsInPack(((ItemEquippable)weapon).AmmoType);
			return currentClip + bulletsInPack;
		}

		private static void DoReload(BulletWeapon weapon)
		{
			if (!((Agent)((Item)weapon).Owner).IsLocallyOwned)
			{
				return;
			}
			switch (AutoReload)
			{
			case AutoReloadType.AlwaysFullClip:
				((Item)weapon).Owner.Inventory.DoReload();
				break;
			case AutoReloadType.AutoReload:
				if (weapon.m_clip == 0 && ((PlayerInventoryBase)((Weapon)weapon).m_inventory).CanReloadCurrent() && !((ItemEquippable)weapon).IsReloading)
				{
					((ItemEquippable)weapon).TryTriggerReloadAnimationSequence();
					if (((Item)weapon).Owner.Locomotion.IsRunning)
					{
						((Item)weapon).Owner.Locomotion.ChangeState((PLOC_State)0, false);
					}
				}
				break;
			}
		}
	}
}
namespace CollisionRundown.CustomGears.SightRedesigns
{
	[HarmonyPatch(typeof(PartSpawnData), "LoadAssets")]
	internal class Patch_GearPartSpawn
	{
		private static void Prefix(PartSpawnData __instance)
		{
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Expected O, but got Unknown
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: Unknown result type (might be due to invalid IL or missing references)
			//IL_012f: Expected O, but got Unknown
			//IL_014c: Unknown result type (might be due to invalid IL or missing references)
			//IL_015b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0208: Unknown result type (might be due to invalid IL or missing references)
			//IL_020f: Expected O, but got Unknown
			//IL_022c: Unknown result type (might be due to invalid IL or missing references)
			//IL_023b: Unknown result type (might be due to invalid IL or missing references)
			//IL_024a: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f9: Expected O, but got Unknown
			//IL_0316: Unknown result type (might be due to invalid IL or missing references)
			//IL_0325: Unknown result type (might be due to invalid IL or missing references)
			//IL_0337: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_03dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e3: Expected O, but got Unknown
			//IL_0495: Unknown result type (might be due to invalid IL or missing references)
			//IL_049c: Expected O, but got Unknown
			//IL_04b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_04d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_056e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0575: Expected O, but got Unknown
			//IL_057c: Unknown result type (might be due to invalid IL or missing references)
			//IL_059d: Unknown result type (might be due to invalid IL or missing references)
			//IL_05be: Unknown result type (might be due to invalid IL or missing references)
			//IL_0638: Unknown result type (might be due to invalid IL or missing references)
			//IL_063f: Expected O, but got Unknown
			//IL_0674: Unknown result type (might be due to invalid IL or missing references)
			//IL_0686: Unknown result type (might be due to invalid IL or missing references)
			//IL_06a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_072b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0732: Expected O, but got Unknown
			//IL_0739: Unknown result type (might be due to invalid IL or missing references)
			//IL_074b: Unknown result type (might be due to invalid IL or missing references)
			//IL_075d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0786: Unknown result type (might be due to invalid IL or missing references)
			//IL_078d: Expected O, but got Unknown
			//IL_07a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_07b0: Unknown result type (might be due to invalid IL or missing references)
			if (__instance.general.Model.EndsWith("Sight_18.prefab"))
			{
				GameObject loadedAsset = AssetShardManager.GetLoadedAsset<GameObject>(__instance.general.Model, false);
				Transform val = loadedAsset.transform.Find("Sight_18_Glass");
				MeshRenderer component = ((Component)val).GetComponent<MeshRenderer>();
				Material val2 = new Material(((Renderer)component).sharedMaterial);
				val2.SetColor("_ReticuleColorA", ColorExt.Hex("#005eff") * 8.5f);
				val2.SetColor("_ReticuleColorB", Color.clear);
				val2.SetColor("_ReticuleColorC", ColorExt.Hex("#00a2ff") * 6f);
				val2.SetFloat("_SightDirt", 0.5f);
				((Renderer)component).sharedMaterial = val2;
				((Renderer)component).material = val2;
			}
			else if (__instance.general.Model.EndsWith("Sight_2.prefab"))
			{
				GameObject loadedAsset2 = AssetShardManager.GetLoadedAsset<GameObject>(__instance.general.Model, false);
				Transform val3 = loadedAsset2.transform.Find("Sight_2_Glass");
				MeshRenderer component2 = ((Component)val3).GetComponent<MeshRenderer>();
				Material val4 = new Material(((Renderer)component2).sharedMaterial);
				Color val5 = default(Color);
				((Color)(ref val5))..ctor(5f, 2f, 13f);
				val4.SetColor("_ReticuleColorA", val5);
				val4.SetColor("_ReticuleColorB", val5);
				val4.SetFloat("_ReticuleScaleA", 2f);
				val4.SetFloat("_ReticuleScaleB", 1.5f);
				val4.SetFloat("_SightDirt", 10f);
				((Renderer)component2).sharedMaterial = val4;
				((Renderer)component2).material = val4;
			}
			else if (__instance.general.Model.EndsWith("Sight_6.prefab"))
			{
				GameObject loadedAsset3 = AssetShardManager.GetLoadedAsset<GameObject>(__instance.general.Model, false);
				Transform val6 = loadedAsset3.transform.Find("Sight_6_Glass");
				MeshRenderer component3 = ((Component)val6).GetComponent<MeshRenderer>();
				Material val7 = new Material(((Renderer)component3).sharedMaterial);
				Color val8 = default(Color);
				((Color)(ref val8))..ctor(9f, 1.3f, 0.3f);
				val7.SetColor("_ReticuleColorA", val8);
				val7.SetColor("_ReticuleColorB", val8);
				val7.SetColor("_ReticuleColorC", Color.clear);
				val7.SetFloat("_SightDirt", 0.5f);
				((Renderer)component3).sharedMaterial = val7;
				((Renderer)component3).material = val7;
			}
			else if (__instance.general.Model.EndsWith("Sight_15.prefab"))
			{
				GameObject loadedAsset4 = AssetShardManager.GetLoadedAsset<GameObject>(__instance.general.Model, false);
				loadedAsset4.transform.localScale = Vector3.one * 0.9f;
				Transform val9 = loadedAsset4.transform.Find("Sight_15_Glass");
				MeshRenderer component4 = ((Component)val9).GetComponent<MeshRenderer>();
				Material val10 = new Material(((Renderer)component4).sharedMaterial);
				Color val11 = default(Color);
				((Color)(ref val11))..ctor(60f, 6f, 0f);
				val10.SetColor("_ReticuleColorA", val11);
				val10.SetColor("_ReticuleColorB", Color.clear);
				val10.SetColor("_ReticuleColorC", val11);
				val10.SetFloat("_SightDirt", 1f);
				((Renderer)component4).sharedMaterial = val10;
				((Renderer)component4).material = val10;
			}
			else if (__instance.general.Model.EndsWith("Sight_20.prefab"))
			{
				GameObject loadedAsset5 = AssetShardManager.GetLoadedAsset<GameObject>(__instance.general.Model, false);
				loadedAsset5.transform.localScale = Vector3.one * 0.95f;
				Transform val12 = loadedAsset5.transform.Find("Sight_20_sight/g_hologram");
				MeshRenderer component5 = ((Component)val12).GetComponent<MeshRenderer>();
				Material val13 = new Material(((Renderer)component5).sharedMaterial);
				val13.DisableKeyword("ALTERNATIVE_PROJECTION_MODE");
				val13.SetFloat("_ReticuleOffsetB", 0f);
				val13.SetFloat("_ReticuleOffsetC", 0f);
				val13.SetFloat("_SightDirt", 3f);
				((Renderer)component5).sharedMaterial = val13;
				((Renderer)component5).material = val13;
			}
			else if (__instance.general.Model.EndsWith("Front_Pistol_1.prefab"))
			{
				GameObject loadedAsset6 = AssetShardManager.GetLoadedAsset<GameObject>(__instance.general.Model, false);
				Transform val14 = loadedAsset6.transform.Find("a_slide/Sight_Align/ironsight_hologlass/g_ironsight_hologlass");
				MeshRenderer component6 = ((Component)val14).GetComponent<MeshRenderer>();
				Material val15 = new Material(((Renderer)component6).sharedMaterial);
				val15.SetColor("_ReticuleColorA", new Color(0f, 5f, 1f));
				val15.SetColor("_ReticuleColorB", new Color(0f, 2f, 0f));
				val15.SetColor("_ReticuleColorC", new Color(0f, 2f, 0f));
				((Renderer)component6).sharedMaterial = val15;
				((Renderer)component6).material = val15;
			}
			else if (__instance.general.Model.EndsWith("Front_Pistol_2.prefab"))
			{
				GameObject loadedAsset7 = AssetShardManager.GetLoadedAsset<GameObject>(__instance.general.Model, false);
				Transform val16 = loadedAsset7.transform.Find("Sight_Align/ironsight_hologlass/g_ironsight_hologlass");
				MeshRenderer component7 = ((Component)val16).GetComponent<MeshRenderer>();
				Material val17 = new Material(((Renderer)component7).sharedMaterial);
				val17.SetColor("_ReticuleColorA", Color.clear);
				val17.SetColor("_ReticuleColorB", new Color(0f, 0.075f, 0f));
				val17.SetColor("_ReticuleColorC", new Color(8f, 0.1f, 0.1f));
				((Renderer)component7).sharedMaterial = val17;
				((Renderer)component7).material = val17;
			}
			else if (__instance.general.Model.EndsWith("Sight_14.prefab"))
			{
				GameObject loadedAsset8 = AssetShardManager.GetLoadedAsset<GameObject>(__instance.general.Model, false);
				Transform val18 = loadedAsset8.transform.Find("Sight_14_Glass");
				MeshRenderer component8 = ((Component)val18).GetComponent<MeshRenderer>();
				Material val19 = new Material(((Renderer)component8).sharedMaterial);
				val19.DisableKeyword("ALTERNATIVE_PROJECTION_MODE");
				val19.SetFloat("_ProjDist", 100f);
				val19.SetColor("_ReticuleColorA", new Color(8f, 0f, 0f));
				val19.SetColor("_ReticuleColorB", Color.clear);
				val19.SetColor("_ReticuleColorC", new Color(2f, 0f, 0f));
				((Renderer)component8).sharedMaterial = val19;
				((Renderer)component8).material = val19;
			}
			else if (__instance.general.Model.EndsWith("Front_Short_Shotgun_2.prefab"))
			{
				GameObject loadedAsset9 = AssetShardManager.GetLoadedAsset<GameObject>(__instance.general.Model, false);
				Transform val20 = loadedAsset9.transform.Find("Short_Shotgun_2_Parts_Reload/Short_Shotgun/Anim_Short_Shotgun/Front_Short_Shotgun_Back_2");
				MeshRenderer component9 = ((Component)val20).GetComponent<MeshRenderer>();
				Il2CppReferenceArray<Material> sharedMaterials = ((Renderer)component9).sharedMaterials;
				Material val21 = new Material(((Il2CppArrayBase<Material>)(object)sharedMaterials)[2]);
				val21.SetColor("_ReticuleColorA", Color.clear);
				val21.SetColor("_ReticuleColorB", Color.clear);
				val21.SetColor("_ReticuleColorC", Color.clear);
				((Il2CppArrayBase<Material>)(object)sharedMaterials)[2] = val21;
				((Il2CppArrayBase<Material>)(object)sharedMaterials)[2] = val21;
				Material val22 = new Material(((Il2CppArrayBase<Material>)(object)sharedMaterials)[1]);
				val22.SetTexture("_EmissiveMap", (Texture)(object)Texture2D.whiteTexture);
				val22.SetColor("_EmissiveColor", Color.cyan * 0.175f);
				((Il2CppArrayBase<Material>)(object)sharedMaterials)[1] = val22;
				((Il2CppArrayBase<Material>)(object)sharedMaterials)[1] = val22;
				((Renderer)component9).sharedMaterials = sharedMaterials;
				((Renderer)component9).materials = sharedMaterials;
			}
		}
	}
}
namespace CollisionRundown.CustomGears.Minigun
{
	internal sealed class MinigunComp : MonoBehaviour
	{
		public BulletWeapon MinigunWeapon;

		public Transform Barrel;

		public float SpinUpAmount = 0f;

		public bool SpinUpping = false;

		private float _SpinUpTime = 1.5f;

		private float _SpinDownTime = 2f;

		public bool Wielded => ((ItemEquippable)MinigunWeapon).m_isWielded;

		public bool FullySpunUp => SpinUpAmount >= 1f;

		[AutoInvokeOnLoad]
		private static void Init()
		{
			ClassInjector.RegisterTypeInIl2Cpp<MinigunComp>();
		}

		private void Update()
		{
			UpdateSpinUp();
		}

		private void OnDisable()
		{
			SetInteractionAllowed(allowed: true);
		}

		private bool IsLocal()
		{
			if ((Object)(object)((Item)MinigunWeapon).Owner == (Object)null)
			{
				return false;
			}
			if (!((Agent)((Item)MinigunWeapon).Owner).IsLocallyOwned)
			{
				return false;
			}
			return true;
		}

		private void UpdateSpinUp()
		{
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0179: Unknown result type (might be due to invalid IL or missing references)
			if (IsLocal() && Wielded)
			{
				if (InputMapper.GetButtonKeyMouseGamepad((InputAction)7, ((Item)MinigunWeapon).Owner.InputFilter))
				{
					SpinUpAmount = Mathf.Clamp01(SpinUpAmount + Clock.Delta / _SpinUpTime);
				}
				else
				{
					SpinUpAmount = Mathf.Clamp01(SpinUpAmount - Clock.Delta / _SpinDownTime);
				}
				if (SpinUpAmount <= 0f && SpinUpping)
				{
					((ItemEquippable)MinigunWeapon).Sound.Post(EVENTS.DRILLLOOPENDOVERHEAT, true);
					SpinUpping = false;
					SetInteractionAllowed(allowed: true);
				}
				else if (SpinUpAmount >= float.Epsilon && !SpinUpping)
				{
					((ItemEquippable)MinigunWeapon).Sound.Post(EVENTS.DRILLLOOP, true);
					SpinUpping = true;
					SetInteractionAllowed(allowed: false);
				}
				GuiManager.CrosshairLayer.SetChargeUpVisibleAndProgress(true, SpinUpAmount);
				((ItemEquippable)MinigunWeapon).Sound.SetRTPCValue(GAME_PARAMETERS.DRILLPRESSURE, SpinUpAmount * 50f);
				if ((Object)(object)Barrel != (Object)null)
				{
					Barrel.Rotate(new Vector3(0f, 0f, 2000f * SpinUpAmount * Clock.Delta), (Space)1);
				}
			}
		}

		private void SetInteractionAllowed(bool allowed)
		{
			if (IsLocal())
			{
				if (!allowed && ((Item)MinigunWeapon).Owner.Locomotion.IsRunning)
				{
					((Item)MinigunWeapon).Owner.Locomotion.ChangeState((PLOC_State)0, false);
				}
				PlayerInteraction.InteractionEnabled = allowed;
				FocusStateManager.MenuToggleAllowed = allowed;
				((Item)MinigunWeapon).Owner.FPItemHolder.AllowQuickMovement = allowed;
			}
		}
	}
	[HarmonyPatch(typeof(BulletWeapon))]
	internal static class Patch_BWA
	{
		[HarmonyPostfix]
		[HarmonyPatch("SetOwner")]
		private static void Post_Spawned(BulletWeapon __instance)
		{
			if (!((GameDataBlockBase<ArchetypeDataBlock>)(object)((ItemEquippable)__instance).ArchetypeData).name.Contains("MINIGUN_SPECIAL") || !((Object)(object)((Component)__instance).GetComponent<MinigunComp>() == (Object)null))
			{
				return;
			}
			MinigunComp minigunComp = ((Component)__instance).gameObject.AddComponent<MinigunComp>();
			minigunComp.MinigunWeapon = __instance;
			if ((Object)(object)((ItemEquippable)__instance).GearPartHolder != (Object)null && (Object)(object)((ItemEquippable)__instance).GearPartHolder.FrontPart != (Object)null)
			{
				Transform val = ((ItemEquippable)__instance).GearPartHolder.FrontPart.transform.Find("Barrels");
				if ((Object)(object)val != (Object)null)
				{
					minigunComp.Barrel = val;
				}
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch(/*Could not decode attribute arguments.*/)]
		private static bool Pre_WeaponSwitchAllowed(BulletWeapon __instance, ref bool __result)
		{
			MinigunComp component = ((Component)__instance).GetComponent<MinigunComp>();
			if ((Object)(object)component == (Object)null)
			{
				return true;
			}
			__result = !component.SpinUpping;
			return false;
		}
	}
	[HarmonyPatch(typeof(ItemEquippable))]
	internal static class Patch_ItemEquippable
	{
		[HarmonyPostfix]
		[HarmonyPatch(/*Could not decode attribute arguments.*/)]
		private static void Post_Fire(ItemEquippable __instance, ref bool __result)
		{
			MinigunComp component = ((Component)__instance).GetComponent<MinigunComp>();
			if (!((Object)(object)component == (Object)null))
			{
				__result &= component.FullySpunUp;
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(/*Could not decode attribute arguments.*/)]
		private static void Post_FirePressed(ItemEquippable __instance, ref bool __result)
		{
			MinigunComp component = ((Component)__instance).GetComponent<MinigunComp>();
			if (!((Object)(object)component == (Object)null))
			{
				__result &= component.FullySpunUp;
			}
		}
	}
}
namespace CollisionRundown.CustomGears.HoloThermalSight
{
	internal sealed class HoloThermalToggleComp : MonoBehaviour
	{
		public Il2CppReferenceField<ItemEquippable> OwnerItem;

		public Il2CppReferenceField<GearPartHolder> GearPartHolder;

		public Il2CppReferenceField<Transform> HoloGlass;

		public Il2CppReferenceField<Transform> ThermalGlass;

		public Renderer HoloRenderer;

		public bool ThermalEnabled = false;

		public float ZoomOnHip = 0.96f;

		public float ZoomOnAim = 0.55f;

		public float ReticleAOriginalDist = 0f;

		public float ReticleBOriginalDist = 0f;

		public float ReticleCOriginalDist = 0f;

		public FPItemStateName OldState = (FPItemStateName)0;

		public static readonly int ID_Zoom = Shader.PropertyToID("_Zoom");

		public static readonly int ID_ProjDist1 = Shader.PropertyToID("_ProjDist1");

		public static readonly int ID_ProjDist2 = Shader.PropertyToID("_ProjDist2");

		public static readonly int ID_ProjDist3 = Shader.PropertyToID("_ProjDist3");

		[AutoInvokeOnLoad]
		private static void Init()
		{
			ClassInjector.RegisterTypeInIl2Cpp<HoloThermalToggleComp>();
		}

		private void Start()
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Expected O, but got Unknown
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Expected O, but got Unknown
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Expected O, but got Unknown
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_0127: Expected O, but got Unknown
			//IL_0189: Unknown result type (might be due to invalid IL or missing references)
			//IL_018f: Expected O, but got Unknown
			//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e8: Expected O, but got Unknown
			bool flag = default(bool);
			if ((Object)(object)OwnerItem.Value == (Object)null)
			{
				BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(29, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Missing OwnerItem Reference! ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(((Object)((Component)this).gameObject).name);
				}
				Logger.Error(val);
				Object.Destroy((Object)(object)this);
				return;
			}
			if ((Object)(object)GearPartHolder.Value == (Object)null)
			{
				BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(34, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Missing GearPartHolder Reference! ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(((Object)((Component)this).gameObject).name);
				}
				Logger.Error(val);
				Object.Destroy((Object)(object)this);
				return;
			}
			if ((Object)(object)HoloGlass.Value == (Object)null)
			{
				BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(29, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Missing HoloGlass Reference! ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(((Object)((Component)this).gameObject).name);
				}
				Logger.Error(val);
				Object.Destroy((Object)(object)this);
				return;
			}
			if ((Object)(object)ThermalGlass.Value == (Object)null)
			{
				BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(32, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Missing ThermalGlass Reference! ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(((Object)((Component)this).gameObject).name);
				}
				Logger.Error(val);
				Object.Destroy((Object)(object)this);
				return;
			}
			HoloRenderer = ((Component)HoloGlass.Value).GetComponentInChildren<Renderer>();
			if ((Object)(object)HoloRenderer == (Object)null)
			{
				BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(39, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Missing Renderer on Holographic Glass! ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(((Object)((Component)this).gameObject).name);
				}
				Logger.Error(val);
				Object.Destroy((Object)(object)this);
				return;
			}
			Material sharedMaterial = HoloRenderer.sharedMaterial;
			if ((Object)(object)sharedMaterial == (Object)null)
			{
				BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(39, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Missing Material on Holographic Glass! ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(((Object)((Component)this).gameObject).name);
				}
				Logger.Error(val);
				Object.Destroy((Object)(object)this);
			}
			else
			{
				ReticleAOriginalDist = sharedMaterial.GetFloat(ID_ProjDist1);
				ReticleBOriginalDist = sharedMaterial.GetFloat(ID_ProjDist2);
				ReticleCOriginalDist = sharedMaterial.GetFloat(ID_ProjDist3);
				((MonoBehaviour)this).StartCoroutine(CollectionExtensions.WrapToIl2Cpp(UpdateGlassState()));
			}
		}

		private void Update()
		{
			ItemEquippable value = OwnerItem.Value;
			PlayerAgent owner = ((Item)value).Owner;
			if (!((Object)(object)owner == (Object)null) && ((Agent)owner).IsLocallyOwned && value.m_isWielded)
			{
				UpdateInput(value, owner);
				UpdateZoom(value, owner);
			}
		}

		private void UpdateInput(ItemEquippable item, PlayerAgent itemOwner)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Invalid comparison between Unknown and I4
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			if ((int)item.FPItemHolder.m_currentState == 3 && !itemOwner.Interaction.HasWorldInteraction && InputMapper.GetButtonDownKeyMouseGamepad((InputAction)6, itemOwner.InputFilter))
			{
				ThermalEnabled = !ThermalEnabled;
				uint num = (ThermalEnabled ? EVENTS.BUTTONGENERICBLIPONE : EVENTS.BUTTONGENERICPRESS);
				item.Sound.Post(num, true);
				((MonoBehaviour)this).StartCoroutine(CollectionExtensions.WrapToIl2Cpp(UpdateGlassState()));
			}
		}

		private void UpdateZoom(ItemEquippable item, PlayerAgent itemOwner)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Invalid comparison between Unknown and I4
			FPItemStateName currentState = item.FPItemHolder.m_currentState;
			if (currentState != OldState)
			{
				OldState = currentState;
				((MonoBehaviour)this).StartCoroutine(CollectionExtensions.WrapToIl2Cpp(UpdateThermalGlassZoom(((int)currentState == 3) ? ZoomOnAim : ZoomOnHip)));
				((MonoBehaviour)this).StartCoroutine(CollectionExtensions.WrapToIl2Cpp(UpdateGlassState()));
			}
		}

		private IEnumerator UpdateThermalGlassZoom(float targetZoom)
		{
			Renderer renderer = ((Component)ThermalGlass.Value).GetComponentInChildren<Renderer>();
			float startZoom = renderer.material.GetFloat(ID_Zoom);
			float p = 0f;
			while (p < 1f)
			{
				p += Clock.Delta / 0.15f;
				float currentZoom = Mathf.Lerp(startZoom, targetZoom, p);
				renderer.material.SetFloat(ID_Zoom, currentZoom);
				yield return null;
			}
			renderer.material.SetFloat(ID_Zoom, targetZoom);
		}

		private IEnumerator UpdateGlassState()
		{
			((Component)ThermalGlass.Value).gameObject.SetActive(ThermalEnabled);
			float startA = HoloRenderer.material.GetFloat(ID_ProjDist1);
			float startB = HoloRenderer.material.GetFloat(ID_ProjDist2);
			float startC = HoloRenderer.material.GetFloat(ID_ProjDist3);
			float endA = (ThermalEnabled ? 10f : ReticleAOriginalDist);
			float endB = (ThermalEnabled ? 10f : ReticleBOriginalDist);
			float endC = (ThermalEnabled ? 10f : ReticleCOriginalDist);
			float p = 0f;
			while (p < 1f)
			{
				p += Clock.Delta / 0.2f;
				float a = Mathf.Lerp(startA, endA, p);
				float b = Mathf.Lerp(startB, endB, p);
				float c = Mathf.Lerp(startC, endC, p);
				HoloRenderer.material.SetFloat(ID_ProjDist1, a);
				HoloRenderer.material.SetFloat(ID_ProjDist2, b);
				HoloRenderer.material.SetFloat(ID_ProjDist3, c);
				yield return null;
			}
		}
	}
	[HarmonyPatch(typeof(ItemEquippable))]
	internal class Patch_ItemEquippable
	{
		[HarmonyPatch("OnGearSpawnComplete")]
		[HarmonyPostfix]
		[HarmonyWrapSafe]
		private static void Post_GearSpawned(ItemEquippable __instance)
		{
			GearPartHolder gearPartHolder = __instance.GearPartHolder;
			if (!((Object)(object)gearPartHolder == (Object)null) && gearPartHolder.SightData != null)
			{
				Transform val = gearPartHolder.SightPart.transform.Find("Thermal");
				Transform val2 = gearPartHolder.SightPart.transform.Find("Holographic");
				if ((Object)(object)val != (Object)null && (Object)(object)val2 != (Object)null)
				{
					HoloThermalToggleComp holoThermalToggleComp = ((Component)gearPartHolder).gameObject.AddComponent<HoloThermalToggleComp>();
					holoThermalToggleComp.OwnerItem.Set(__instance);
					holoThermalToggleComp.GearPartHolder.Set(gearPartHolder);
					holoThermalToggleComp.HoloGlass.Set(val2);
					holoThermalToggleComp.ThermalGlass.Set(val);
				}
			}
		}
	}
}
namespace CollisionRundown.CustomGears.GlueCannon
{
	[HarmonyPatch(typeof(GlueGun))]
	internal static class Patch_GlueGun
	{
		[HarmonyPostfix]
		[HarmonyPatch("Setup")]
		private static void Post_Setup(GlueGun __instance)
		{
			if ((Object)(object)MineDeployerInstance_Detonate_Glue.s_explosionPool == (Object)null)
			{
				MineDeployerInstance_Detonate_Glue.s_explosionPool = FX_Manager.GetEffectPool(AssetShardManager.GetLoadedAsset<GameObject>("Assets/AssetPrefabs/FX_Effects/FX_TripmineGlue.prefab", false));
			}
			__instance.m_timeToMaxpressure = 1f;
			__instance.m_timeToDepleatePressure = 0.01f;
			__instance.m_pressureProgressToFire = 0.985f;
		}

		[HarmonyPrefix]
		[HarmonyPatch("FireBurst")]
		private static bool Pre_FireBurst(GlueGun __instance, float pressure)
		{
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//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_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: 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)
			//IL_00ca: 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_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			((ItemEquippable)__instance).Sound.Post(EVENTS.GLUEGUNCHARGEUPCANCEL, true);
			((ItemEquippable)__instance).Sound.Post(EVENTS.GLUE_GRENADE_EXPLODE_INSTANT, true);
			__instance.m_rechargeTimer = Clock.Time + 4.25f;
			IEnumerator enumerator = FireBurtShots(__instance, 8, pressure, ((ItemEquippable)__instance).FPItemHolder.ItemAimTrigger);
			__instance.m_fireRoutine = ((MonoBehaviour)__instance).StartCoroutine(CollectionExtensions.WrapToIl2Cpp(enumerator));
			PlayerBackpackManager.GetBackpack(((Item)__instance).Owner.Owner).AmmoStorage.UpdateBulletsInPack((AmmoType)2, -1);
			FX_EffectBase_Poolable val = MineDeployerInstance_Detonate_Glue.s_explosionPool.AquireEffect();
			if ((Object)(object)val != (Object)null)
			{
				Quaternion val2 = Quaternion.LookRotation(((ItemEquippable)__instance).MuzzleAlign.forward * -1f, Vector3.up);
				Vector3 position = ((ItemEquippable)__instance).MuzzleAlign.position;
				position += ((ItemEquippable)__instance).MuzzleAlign.forward * 0.15f;
				((FX_EffectBase)val).Play((FX_Trigger)null, position, val2);
			}
			return false;
		}

		private static IEnumerator FireBurtShots(GlueGun glueGun, int burstCount, float pressure, bool narrow)
		{
			glueGun.m_firingCurrentShotCount = burstCount;
			glueGun.m_firing = true;
			while (((ItemEquippable)glueGun).m_isWielded && glueGun.m_firingCurrentShotCount > 0)
			{
				glueGun.m_spreadMax = (narrow ? 1f : 14.5f);
				glueGun.m_forceSizeMax = (narrow ? 35.5f : 25f);
				uint tempModifier = AgentModifierManager.AddModifierValue((Agent)(object)((Item)glueGun).Owner, (AgentModifier)100, 5f, 0f);
				Patch_WantToFireGlue.ForceSplat = false;
				glueGun.FireSingle(pressure, false);
				glueGun.FireSingle(pressure, false);
				glueGun.FireSingle(pressure, false);
				glueGun.FireSingle(pressure, false);
				Patch_WantToFireGlue.ForceSplat = null;
				AgentModifierManager.ClearModifierChange(tempModifier);
				int firingCurrentShotCount = glueGun.m_firingCurrentShotCount;
				glueGun.m_firingCurrentShotCount = firingCurrentShotCount - 1;
				yield return null;
			}
			glueGun.m_firing = false;
			glueGun.m_fireRoutine = null;
		}
	}
	[HarmonyPatch(typeof(ProjectileManager), "WantToFireGlue")]
	internal static class Patch_WantToFireGlue
	{
		public static bool? ForceSplat;

		private static void Prefix(ref bool allowSplat)
		{
			if (ForceSplat.HasValue)
			{
				allowSplat = ForceSplat.Value;
			}
		}
	}
}
namespace CollisionRundown.Features
{
	[HarmonyPatch(typeof(EnemyPrefabManager), "BuildEnemyPrefab")]
	internal static class Patch_ActuallyBlackBullrush
	{
		private static void Postfix(GameObject __result)
		{
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Expected O, but got Unknown
			CharacterMaterialHandler componentInChildren = __result.GetComponentInChildren<CharacterMaterialHandler>();
			Enumerator<MaterialRef> enumerator = componentInChildren.m_materialRefs.GetEnumerator();
			while (enumerator.MoveNext())
			{
				MaterialRef current = enumerator.Current;
				Material material = current.m_material;
				if (!((Object)(object)material == (Object)null) && !((Object)(object)material.shader == (Object)null) && ((Object)material.shader).name.Contains("EnemyFlesh_CD") && material.GetFloat("_Enable_SkinNoise") > 0.5f)
				{
					Material val = new Material(material);
					val.SetTexture("_MainTex", (Texture)(object)Texture2D.blackTexture);
					current.m_material = val;
				}
			}
		}
	}
	[HarmonyPatch(typeof(EnemyPrefabManager), "BuildEnemyPrefab")]
	internal static class Patch_ShadowEnemyPrefab
	{
		private static void Postfix(EnemyDataBlock data, GameObject __result)
		{
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Expected O, but got Unknown
			//IL_012e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Invalid comparison between Unknown and I4
			if (!((GameDataBlockBase<EnemyDataBlock>)(object)data).name.Contains("Shadow", StringComparison.InvariantCultureIgnoreCase))
			{
				return;
			}
			CharacterMaterialHandler componentInChildren = __result.GetComponentInChildren<CharacterMaterialHandler>();
			Enumerator<MaterialRef> enumerator = componentInChildren.m_materialRefs.GetEnumerator();
			while (enumerator.MoveNext())
			{
				MaterialRef current = enumerator.Current;
				Material material = current.m_material;
				if ((Object)(object)material == (Object)null || (Object)(object)material.shader == (Object)null)
				{
					continue;
				}
				bool flag = false;
				bool flag2 = false;
				if (((Object)material.shader).name.Contains("EnemyFlesh_CD"))
				{
					Material val = new Material(material);
					val.EnableKeyword("NO_DRAW");
					val.SetFloat("_Cull", 0f);
					val.SetFloat("_NoDraw", 1f);
					current.m_material = val;
					flag = true;
				}
				else if (((Object)material.shader).name.Contains("EnemyFlesh"))
				{
					flag = true;
					flag2 = true;
				}
				if (!flag)
				{
					continue;
				}
				Enumerator<Renderer> enumerator2 = current.m_renderers.GetEnumerator();
				while (enumerator2.MoveNext())
				{
					Renderer current2 = enumerator2.Current;
					if ((int)current2.shadowCastingMode != 3)
					{
						current2.shadowCastingMode = (ShadowCastingMode)((!flag2) ? 1 : 3);
						if ((Object)(object)((Component)current2).GetComponent<ShadowEnemyRenderer>() == (Object)null)
						{
							((Component)current2).gameObject.AddComponent<ShadowEnemyRenderer>();
						}
						SkinnedMeshRenderer val2 = ((Il2CppObjectBase)current2).TryCast<SkinnedMeshRenderer>();
						if ((Object)(object)val2 == (Object)null)
						{
							val2.updateWhenOffscreen = true;
						}
					}
				}
			}
		}
	}
	internal static class Patch_InteSecDoor
	{
		private static void Postfix(LG_SecurityDoor __instance)
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			GameObject loadedAsset = AssetAPI.GetLoadedAsset<GameObject>("Assets/CustomPrefabs/DisintegrateField/DisintegrateField_8x4.prefab");
			GameObject val = Object.Instantiate<GameObject>(loadedAsset, ((Component)__instance).transform);
			val.transform.localPosition = Vector3.zero;
			val.transform.localRotation = Quaternion.identity;
			val.transform.localScale = Vector3.one;
		}
	}
	[HarmonyPatch(typeof(MusicMachine))]
	internal static class Patch_NOFUCKING_SURVIVAL
	{
		[HarmonyPrefix]
		[HarmonyPatch("ChangeState")]
		[HarmonyPatch(new Type[] { typeof(MUS_State) })]
		private static bool Prefix_ChangeState1(MusicMachine __instance, ref MUS_State state)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Expected I4, but got Unknown
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: 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_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Expected I4, but got Unknown
			MUS_State val = state;
			if (1 == 0)
			{
			}
			MUS_State val2 = (MUS_State)((val - 7) switch
			{
				2 => 8, 
				11 => 8, 
				12 => 8, 
				6 => 8, 
				5 => 8, 
				3 => 8, 
				4 => 8, 
				0 => 8, 
				13 => 9, 
				_ => state, 
			});
			if (1 == 0)
			{
			}
			MUS_State val3 = val2;
			if (val3 == __instance.CurrentState)
			{
				return false;
			}
			state = (MUS_State)(int)val3;
			return true;
		}
	}
	[HarmonyPatch(typeof(CP_Holopath_Spline), "Reveal")]
	internal static class Patch_BetterScanSpline
	{
		private static void Postfix(CP_Holopath_Spline __instance)
		{
			__instance.CurvyExtrusion.ScaleX = 0.03f;
			__instance.CurvyExtrusion.ScaleY = 0.03f;
			CP_Bioscan_Graphics componentInParent = ((Component)__instance).GetComponentInParent<CP_Bioscan_Graphics>();
			if ((Object)(object)componentInParent != (Object)null)
			{
				__instance.SetupMaterial();
				((MonoBehaviour)__instance).StartCoroutine(CollectionExtensions.WrapToIl2Cpp(UpdateColor(__instance, componentInParent)));
			}
		}

		private static IEnumerator UpdateColor(CP_Holopath_Spline spline, CP_Bioscan_Graphics graphics)
		{
			Renderer renderer = null;
			while (true)
			{
				if ((Object)(object)renderer == (Object)null)
				{
					renderer = ((Component)spline).GetComponentInChildren<Renderer>(true);
				}
				if ((Object)(object)renderer != (Object)null)
				{
					Color scanColor = graphics.m_zoneMaterialInstance.GetColor(CP_Bioscan_Graphics.s_shaderIDcolorA);
					float maxColor = ((Color)(ref scanColor)).maxColorComponent;
					if (maxColor > 0f)
					{
						scanColor /= maxColor;
					}
					renderer.material.SetColor("_ColorA", scanColor * 1.85f);
					scanColor = default(Color);
				}
				yield return null;
			}
		}
	}
	[HarmonyPatch(typeof(ChainedPuzzleManager), "OnAssetsLoaded")]
	internal class Patch_VanillaScanStupidity
	{
		private static void Postfix(ChainedPuzzleManager __instance)
		{
			uint[] array = new uint[8] { 6u, 8u, 41u, 13u, 32u, 17u, 18u, 14u };
			uint[] array2 = new uint[3] { 10u, 11u, 12u };
			uint[] array3 = array;
			foreach (uint num in array3)
			{
				GameObject val = __instance.m_puzzleComponentPrefabs[num];
				CP_PlayerScanner component = val.GetComponent<CP_PlayerScanner>();
				float num2 = ((Il2CppArrayBase<float>)(object)component.m_scanSpeeds)[3];
				((Il2CppArrayBase<float>)(object)component.m_scanSpeeds)[0] = num2;
				((Il2CppArrayBase<float>)(object)component.m_scanSpeeds)[1] = num2;
				((Il2CppArrayBase<float>)(object)component.m_scanSpeeds)[2] = num2;
				((Il2CppArrayBase<float>)(object)component.m_scanSpeeds)[3] = num2;
			}
			uint[] array4 = array2;
			foreach (uint num3 in array4)
			{
				GameObject val2 = __instance.m_puzzleComponentPrefabs[num3];
				CP_PlayerScanner component2 = val2.GetComponent<CP_PlayerScanner>();
				component2.m_reduceWhenNoPlayer = true;
				component2.m_reduceSpeed = 0.33f;
				((Il2CppArrayBase<float>)(object)component2.m_scanSpeeds)[0] = 0.185f;
				((Il2CppArrayBase<float>)(object)component2.m_scanSpeeds)[1] = 0.185f;
				((Il2CppArrayBase<float>)(object)component2.m_scanSpeeds)[2] = 0.185f;
				((Il2CppArrayBase<float>)(object)component2.m_scanSpeeds)[3] = 0.185f;
			}
		}
	}
	[HarmonyPatch(/*Could not decode attribute arguments.*/)]
	internal class Patch_BigPickup_SlowRun
	{
		private const float BIGPICKUP_SPEED_MODIFIER = 0.715f;

		private static void Postfix(PlayerStamina __instance, ref float __result)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Invalid comparison between Unknown and I4
			if ((int)__instance.m_owner.Inventory.WieldedSlot == 8)
			{
				__result = Mathf.Min(__result, 0.715f);
			}
		}
	}
	[HarmonyPatch(typeof(EnemyAgent), "UpdateScannerData")]
	internal class Patch_ColoredBio
	{
		private static readonly Color s_GlueCol = new Color(0.5f, 0.5f, 0.5f, 1f);

		private static readonly Color s_HibernateCol = new Color(0.7f, 0.7f, 0.7f, 1f);

		private static readonly Color s_HeartbeatOnCol;

		private static readonly Color s_HeartbeatOffCol;

		private static readonly Color s_HibernateWakeupCol;

		private static readonly Color s_ScoutRoamingCol;

		private static readonly Color s_ScoutFeelerCol;

		private static readonly Color s_ScoutScreamCol;

		private static readonly Color s_ActiveCol;

		private static void Postfix(EnemyAgent __instance)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			Color stateColor = GetStateColor(__instance);
			__instance.m_scannerData.m_matProp.SetColor(EnemyScannerGraphics._Color, stateColor);
		}

		private static Color GetStateColor(EnemyAgent agent)
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: 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_0024: Invalid comparison between Unknown and I4
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Invalid comparison between Unknown and I4
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Expected I4, but got Unknown
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: 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_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: 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_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Invalid comparison between Unknown and I4
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			EnemyLocomotion locomotion = agent.Locomotion;
			bool heartbeatActive = locomotion.Hibernate.m_heartbeatActive;
			ES_StateEnum currentStateEnum = agent.Locomotion.CurrentStateEnum;
			ES_StateEnum val = currentStateEnum;
			if ((int)val != 2)
			{
				switch (val - 12)
				{
				default:
					if ((int)val == 28)
					{
						break;
					}
					goto case 4;
				case 2:
					if (agent.IsHibernationDetecting)
					{
						return heartbeatActive ? s_HeartbeatOnCol : s_HeartbeatOffCol;
					}
					return s_HibernateCol;
				case 3:
					return s_HibernateWakeupCol;
				case 0:
					return s_ScoutFeelerCol;
				case 1:
					return s_ScoutScreamCol;
				case 5:
					return s_GlueCol;
				case 4:
					return s_ActiveCol;
				}
			}
			if (agent.AI.m_scoutPath == null)
			{
				return s_ActiveCol;
			}
			if ((int)agent.Locomotion.ScoutScream.m_state == 4)
			{
				return s_ActiveCol;
			}
			return s_ScoutRoamingCol;
		}

		static Patch_ColoredBio()
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: 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_00b8: 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)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			Color yellow = Color.yellow;
			s_HeartbeatOnCol = ((Color)(ref yellow)).RGBMultiplied(0.7f);
			yellow = Color.yellow;
			s_HeartbeatOffCol = ((Color)(ref yellow)).RGBMultiplied(0.6f);
			s_HibernateWakeupCol = new Color(0.8f, 0.4549f, 0.0392f, 1f);
			yellow = Color.yellow;
			s_ScoutRoamingCol = ((Color)(ref yellow)).RGBMultiplied(0.7f);
			s_ScoutFeelerCol = new Color(1f, 0.1f, 0.1f, 1f);
			s_ScoutScreamCol = Color.cyan;
			s_ActiveCol = new Color(1f, 0.1f, 0.1f, 1f);
		}
	}
	[HarmonyPatch(typeof(PlayerInventoryBase), "UpdateFPSFlashlightAlignment")]
	internal static class Patch_Flashlight_Sway
	{
		private static void Postfix(PlayerInventoryBase __instance)
		{
			//IL_00b7: 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)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)__instance.Owner == (Object)null) && ((Agent)__instance.Owner).IsLocallyOwned && !((Object)(object)__instance.Owner.Owner == (Object)null) && !__instance.Owner.Owner.IsBot && !((Object)(object)__instance.Owner.FPSCamera == (Object)null) && __instance.m_flashlightCLight != null)
			{
				FPSCamera fPSCamera = __instance.Owner.FPSCamera;
				Camera camera = ((CameraController)fPSCamera).m_camera;
				Light unityLight = ((C_Light)__instance.m_flashlightCLight).m_unityLight;
				Vector3 val = ((Component)camera).transform.position + ((Component)camera).transform.forward * 6f;
				Vector3 val2 = val - ((Component)unityLight).transform.position;
				Vector3 normalized = ((Vector3)(ref val2)).normalized;
				((Component)unityLight).transform.rotation = Quaternion.LookRotation(Vector3.Lerp(normalized, ((Component)unityLight).transform.forward, 0.1f));
			}
		}
	}
	[HarmonyPatch(typeof(ScoutAntenna), "Init")]
	internal static class Patch_ScoutTendrilColor
	{
		private static void Postfix(ScoutAntenna __instance)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			__instance.m_colorDefault = ColorExt.Hex("#75433D") * 0.65f;
			__instance.m_colorDetection = Color.red * 3.5f;
		}
	}
	[HarmonyPatch]
	internal static class Patch_SentryScreenAmmo
	{
		[HarmonyPostfix]
		[HarmonyPatch(typeof(SentryGunFirstPerson), "OnBulletsUpdate")]
		private static void Post_AmmoUpdate(SentryGunFirstPerson __instance, int bullets)
		{
			int bulletsMaxCap = PlayerBackpackManager.LocalBackpack.AmmoStorage.ClassAmmo.BulletsMaxCap;
			float value = (float)bullets / (float)bulletsMaxCap;
			if (__instance.m_screen != null)
			{
				__instance.m_screen.SetAmmo($"<size=75%><line-height=75%><u>{value:P0}</u>\n{bullets}</line-height></size>");
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(/*Could not decode attribute arguments.*/)]
		private static void Post_SetAmmo(SentryGunInstance __instance)
		{
			int value = Mathf.FloorToInt(__instance.m_ammo / __instance.CostOfBullet);
			float value2 = __instance.Ammo / __instance.AmmoMaxCap;
			if (__instance.m_screen != null)
			{
				__instance.m_screen.SetAmmo($"<size=75%><line-height=75%><u>{value2:P0}</u>\n{value}</line-height></size>");
			}
		}
	}
	[HarmonyPatch(typeof(PUI_WardenIntel), "ShowSubObjectiveMessage")]
	internal static class Patch_ReactorMessageBlacklist
	{
		public static List<uint> IDsToBlock = new List<uint>();

		[AutoInvokeOnLoad]
		private static void Init()
		{
			LevelAPI.OnLevelCleanup += LevelAPI_OnLevelCleanup;
		}

		private static void LevelAPI_OnLevelCleanup()
		{
			IDsToBlock.Clear();
		}

		private static bool Prefix(string newSubObj)
		{
			foreach (uint item in IDsToBlock)
			{
				string text = Text.Get(item);
				if (newSubObj == text)
				{
					return false;
				}
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(LG_WardenObjective_Reactor), "Update")]
	internal class Patch_Reactor_WaveSpawnTypeOverride
	{
		private static void Postfix(LG_WardenObjective_Reactor __instance)
		{
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			if (!__instance.m_spawnEnemies || __instance.m_currentEnemyWaveIndex >= __instance.m_currentWaveData.EnemyWaves.Count)
			{
				return;
			}
			ReactorWaveEnemyData val = __instance.m_currentWaveData.EnemyWaves[__instance.m_currentEnemyWaveIndex];
			if (__instance.m_currentWaveProgress > val.SpawnTimeRel)
			{
				eReactorWaveSpawnType spawnType = val.SpawnType;
				if ((int)spawnType >= 10)
				{
					AIG_CourseNode courseNode = __instance.m_reactorArea.m_courseNode;
					uint waveSettings = val.WaveSettings;
					uint wavePopulation = val.WavePopulation;
					SurvivalWaveSpawnType val2 = (SurvivalWaveSpawnType)(byte)(spawnType - 10);
					ushort num = default(ushort);
					Mastermind.Current.TriggerSurvivalWave(courseNode, waveSettings, wavePopulation, ref num, val2, 0f, 2f, true, false, default(Vector3), "");
					int currentEnemyWaveIndex = __instance.m_currentEnemyWaveIndex;
					__instance.m_currentEnemyWaveIndex = currentEnemyWaveIndex + 1;
				}
			}
		}
	}
}
namespace CollisionRundown.Features.Reactors
{
	[HarmonyPatch(typeof(LG_ComputerTerminalCommandInterpreter), "ReceiveCommand")]
	internal class Patch_Reactor_VerifySpecialCommand
	{
		private static void Prefix(ref TERM_Command cmd, ref string param1, LG_ComputerTerminalCommandInterpreter __instance)
		{
			if ((int)cmd == 42)
			{
				LG_WardenObjective_Reactor connectedReactor = __instance.m_terminal.ConnectedReactor;
				if (!((Object)(object)connectedReactor == (Object)null) && connectedReactor.m_currentWaveData != null && connectedReactor.m_currentWaveData.VerificationTerminalSerial.Equals(__instance.m_terminal.ItemKey, StringComparison.InvariantCultureIgnoreCase))
				{
					cmd = (TERM_Command)22;
					param1 = connectedReactor.CurrentStateOverrideCode;
				}
			}
		}
	}
}
namespace CollisionRundown.Features.WaveDirectionAlert
{
	[HarmonyPatch(typeof(SurvivalWave), "RegisterGroup")]
	internal static class Patch_SurvivalWave_GroupSpawn
	{
		private static void Postfix(EnemyGroup group)
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Expected O, but got Unknown
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: 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)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing r