Decompiled source of Prelude v0.0.91

BepInEx/plugins/FloLib.dll

Decompiled 5 months ago
using System;
using System.CodeDom.Compiler;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Cryptography;
using System.Security.Permissions;
using System.Text;
using AIGraph;
using AK;
using Agents;
using AssetShards;
using BepInEx;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using BepInEx.Unity.IL2CPP.Hook;
using BepInEx.Unity.IL2CPP.Utils;
using FloLib.Attributes;
using FloLib.Events;
using FloLib.Infos;
using FloLib.Infos.Comps;
using FloLib.Networks;
using FloLib.Networks.Inject;
using FloLib.Networks.PayloadStructs;
using FloLib.Networks.Replications;
using FloLib.Utils;
using FloLib.Utils.Comps;
using FloLib.Utils.Extensions;
using GTFO.API;
using GameData;
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 Microsoft.CodeAnalysis;
using Player;
using SNetwork;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("FloLib")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.1.0")]
[assembly: AssemblyInformationalVersion("1.1.0+gitda3025d-dirty-master")]
[assembly: AssemblyProduct("FloLib")]
[assembly: AssemblyTitle("FloLib")]
[assembly: TargetPlatform("Windows7.0")]
[assembly: SupportedOSPlatform("Windows7.0")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.1.0.0")]
[module: UnverifiableCode]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NativeIntegerAttribute : Attribute
	{
		public readonly bool[] TransformFlags;

		public NativeIntegerAttribute()
		{
			TransformFlags = new bool[1] { true };
		}

		public NativeIntegerAttribute(bool[] P_0)
		{
			TransformFlags = P_0;
		}
	}
}
namespace FloLib
{
	public static class Automation
	{
		private const BindingFlags ALL = BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic;

		private static readonly Queue<(MethodInfo method, object[] args)> _InvokeWhenStartGame;

		private static readonly Queue<(MethodInfo method, object[] args)> _InvokeWhenStartupAssetLoaded;

		private static readonly Queue<(MethodInfo method, object[] args)> _InvokeWhenEnemyAssetLoaded;

		private static readonly Queue<(MethodInfo method, object[] args)> _InvokeWhenSharedAssetLoaded;

		private static readonly Queue<(MethodInfo method, object[] args)> _InvokeWhenAllAssetsLoaded;

		static Automation()
		{
			_InvokeWhenStartGame = new Queue<(MethodInfo, object[])>();
			_InvokeWhenStartupAssetLoaded = new Queue<(MethodInfo, object[])>();
			_InvokeWhenEnemyAssetLoaded = new Queue<(MethodInfo, object[])>();
			_InvokeWhenSharedAssetLoaded = new Queue<(MethodInfo, object[])>();
			_InvokeWhenAllAssetsLoaded = new Queue<(MethodInfo, object[])>();
			StartGameEvent.OnGameLoaded += delegate
			{
				(MethodInfo, object[]) result5;
				while (_InvokeWhenStartGame.TryDequeue(out result5))
				{
					RunMethod(result5.Item1, result5.Item2);
				}
			};
			AssetEvent.OnStartupAssetLoaded += delegate
			{
				(MethodInfo, object[]) result4;
				while (_InvokeWhenStartupAssetLoaded.TryDequeue(out result4))
				{
					RunMethod(result4.Item1, result4.Item2);
				}
			};
			AssetEvent.OnEnemyAssetLoaded += delegate
			{
				(MethodInfo, object[]) result3;
				while (_InvokeWhenEnemyAssetLoaded.TryDequeue(out result3))
				{
					RunMethod(result3.Item1, result3.Item2);
				}
			};
			AssetEvent.OnSharedAssetLoaded += delegate
			{
				(MethodInfo, object[]) result2;
				while (_InvokeWhenSharedAssetLoaded.TryDequeue(out result2))
				{
					RunMethod(result2.Item1, result2.Item2);
				}
			};
			AssetEvent.OnAllAssetsLoaded += delegate
			{
				(MethodInfo, object[]) result;
				while (_InvokeWhenAllAssetsLoaded.TryDequeue(out result))
				{
					RunMethod(result.Item1, result.Item2);
				}
			};
		}

		public static void RegisterTypes()
		{
			Assembly obj = new StackFrame(1).GetMethod()?.GetType()?.Assembly ?? null;
			if (obj == null)
			{
				throw new NullReferenceException("Caller Assembly was null");
			}
			RegisterTypes(obj);
		}

		public static void RegisterTypes(Type target)
		{
			if (target == null)
			{
				throw new ArgumentNullException("target");
			}
			RegisterTypes(target.Assembly);
		}

		public static void RegisterTypes(Assembly target)
		{
			if (target == null)
			{
				throw new ArgumentNullException("target");
			}
			InjectAll(target);
			AddAutoInvokes(target);
		}

		private static void InjectAll(Assembly assem)
		{
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Expected O, but got Unknown
			foreach (Type item in assem.GetTypes()?.Where((Type x) => Attribute.IsDefined(x, typeof(AutoInjectAttribute))) ?? Enumerable.Empty<Type>())
			{
				AutoInjectAttribute autoInjectAttribute = (AutoInjectAttribute)Attribute.GetCustomAttribute(item, typeof(AutoInjectAttribute));
				if (autoInjectAttribute.Interfaces.Length != 0)
				{
					RegisterTypeOptions val = new RegisterTypeOptions();
					val.set_Interfaces(Il2CppInterfaceCollection.op_Implicit(autoInjectAttribute.Interfaces));
					val.set_LogSuccess(RegisterTypeOptions.Default.LogSuccess);
					ClassInjector.RegisterTypeInIl2Cpp(item, val);
				}
				else
				{
					ClassInjector.RegisterTypeInIl2Cpp(item);
				}
			}
		}

		private static void AddAutoInvokes(Assembly assem)
		{
			foreach (MethodInfo item in assem.GetTypes()?.SelectMany((Type x) => x.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic))?.Where((MethodInfo x) => x.IsStatic && Attribute.IsDefined(x, typeof(AutoInvokeAttribute))) ?? Enumerable.Empty<MethodInfo>())
			{
				AutoInvokeAttribute obj = (AutoInvokeAttribute)Attribute.GetCustomAttribute(item, typeof(AutoInvokeAttribute));
				object[] arguments = obj.Arguments;
				switch (obj.When)
				{
				case InvokeWhen.PluginLoaded:
					RunMethod(item, arguments);
					break;
				case InvokeWhen.StartGame:
					_InvokeWhenStartGame.Enqueue((item, arguments));
					break;
				case InvokeWhen.StartupAssetLoaded:
					_InvokeWhenStartupAssetLoaded.Enqueue((item, arguments));
					break;
				case InvokeWhen.EnemyAssetLoaded:
					_InvokeWhenEnemyAssetLoaded.Enqueue((item, arguments));
					break;
				case InvokeWhen.SharedAssetLoaded:
					_InvokeWhenSharedAssetLoaded.Enqueue((item, arguments));
					break;
				case InvokeWhen.AllAssetsLoaded:
					_InvokeWhenAllAssetsLoaded.Enqueue((item, arguments));
					break;
				}
			}
		}

		private static void RunMethod(MethodInfo method, params object[] args)
		{
			if (method.IsConstructor)
			{
				RuntimeHelpers.RunClassConstructor(method.DeclaringType.TypeHandle);
			}
			else
			{
				method.Invoke(null, args);
			}
		}
	}
	[BepInPlugin("GTFO.FloLib", "FloLib", "1.1.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	internal class EntryPoint : BasePlugin
	{
		private Harmony _Harmony;

		public override void Load()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Expected O, but got Unknown
			_Harmony = new Harmony("FloLib.Harmony");
			_Harmony.PatchAll();
			Automation.RegisterTypes(((object)this).GetType());
		}

		public override bool Unload()
		{
			_Harmony.UnpatchSelf();
			return ((BasePlugin)this).Unload();
		}
	}
	internal static class Logger
	{
		internal static bool LogExceptionInDetail;

		private static readonly ManualLogSource _Logger;

		static Logger()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Expected O, but got Unknown
			_Logger = new ManualLogSource("FloLib");
			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)
		{
		}

		public static void Exception(Exception e)
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Expected O, but got Unknown
			if (LogExceptionInDetail)
			{
				_Logger.LogError((object)e.ToString());
				return;
			}
			bool flag = default(bool);
			BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(2, 2, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(e.GetType().Name);
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(": ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(e.Message);
			}
			_Logger.LogError(val);
		}
	}
	[GeneratedCode("VersionInfoGenerator", "2.1.3+git35c0c2a-master")]
	[CompilerGenerated]
	internal static class VersionInfo
	{
		public const string RootNamespace = "FloLib";

		public const string Version = "1.1.0";

		public const string VersionPrerelease = null;

		public const string VersionMetadata = "gitda3025d-dirty-master";

		public const string SemVer = "1.1.0+gitda3025d-dirty-master";

		public const string GitRevShort = "da3025d-dirty";

		public const string GitRevLong = "da3025dbbe994fcdc7ce3608ffb5d5f2e299e73f-dirty";

		public const string GitBranch = "master";

		public const string GitTag = null;

		public const int GitCommitsSinceTag = 0;

		public const bool GitIsDirty = true;
	}
}
namespace FloLib.Utils
{
	public enum CoroutineLifeTime
	{
		Forever,
		Lobby,
		Level,
		BetweenRecall
	}
	public static class Coroutines
	{
		private static MonoBehaviour _Runner;

		private static readonly Queue<Coroutine> _Coroutines_Lobby = new Queue<Coroutine>();

		private static readonly Queue<Coroutine> _Coroutines_Level = new Queue<Coroutine>();

		private static readonly Queue<Coroutine> _Coroutines_CPLoad = new Queue<Coroutine>();

		[AutoInvoke(InvokeWhen.StartGame)]
		internal static void Init()
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Expected O, but got Unknown
			GameObject val = new GameObject();
			Object.DontDestroyOnLoad((Object)val);
			_Runner = (MonoBehaviour)(object)val.AddComponent<EmptyMB>();
			LevelAPI.OnLevelCleanup += LevelAPI_OnLevelCleanup;
			Inject_SNet_Capture.OnBufferRecalled += Inject_SNet_Capture_OnBufferRecalled;
		}

		private static void Inject_SNet_Capture_OnBufferRecalled(eBufferType obj)
		{
			StopAll(CoroutineLifeTime.BetweenRecall);
		}

		private static void LevelAPI_OnLevelCleanup()
		{
			StopAll();
			StopAll(CoroutineLifeTime.BetweenRecall);
		}

		public static void StopAll(CoroutineLifeTime lifeTime = CoroutineLifeTime.Level)
		{
			Queue<Coroutine> queue = lifeTime switch
			{
				CoroutineLifeTime.Lobby => _Coroutines_Lobby, 
				CoroutineLifeTime.Level => _Coroutines_Level, 
				CoroutineLifeTime.BetweenRecall => _Coroutines_CPLoad, 
				_ => throw new NotSupportedException($"{"CoroutineLifeTime"}: {lifeTime} is not supported!"), 
			};
			Coroutine result;
			while (queue.TryDequeue(out result))
			{
				_Runner.StopCoroutine(result);
			}
		}

		public static void Stop(Coroutine coroutine)
		{
			_Runner.StopCoroutine(coroutine);
		}

		public static Coroutine Start(IEnumerator coroutine, CoroutineLifeTime lifeTime = CoroutineLifeTime.Forever)
		{
			switch (lifeTime)
			{
			case CoroutineLifeTime.Forever:
				return MonoBehaviourExtensions.StartCoroutine(_Runner, coroutine);
			case CoroutineLifeTime.Lobby:
			{
				Coroutine val = MonoBehaviourExtensions.StartCoroutine(_Runner, coroutine);
				_Coroutines_Lobby.Enqueue(val);
				return val;
			}
			case CoroutineLifeTime.Level:
			{
				Coroutine val = MonoBehaviourExtensions.StartCoroutine(_Runner, coroutine);
				_Coroutines_Level.Enqueue(val);
				return val;
			}
			case CoroutineLifeTime.BetweenRecall:
			{
				Coroutine val = MonoBehaviourExtensions.StartCoroutine(_Runner, coroutine);
				_Coroutines_CPLoad.Enqueue(val);
				return val;
			}
			default:
				throw new NotSupportedException($"{"CoroutineLifeTime"}: {lifeTime} is not supported!!");
			}
		}

		public static Coroutine DoWait(float delay, Action onDone, CoroutineLifeTime lifeTime = CoroutineLifeTime.Forever)
		{
			return Start(Wait(delay, onDone), lifeTime);
		}

		public static Coroutine DoWaitRealtime(float delay, Action onDone, CoroutineLifeTime lifeTime = CoroutineLifeTime.Forever)
		{
			return Start(WaitRealtime(delay, onDone), lifeTime);
		}

		public static Coroutine DoBlink(BlinkInfo blinkInfo, Action<bool> onBlinkChanged, CoroutineLifeTime lifeTime = CoroutineLifeTime.Forever)
		{
			return Start(Blink(blinkInfo, onBlinkChanged), lifeTime);
		}

		public static Coroutine DoLerp(LerpInfo lerpInfo, Action<float> onValueChanged, CoroutineLifeTime lifeTime = CoroutineLifeTime.Forever)
		{
			return Start(Lerp(lerpInfo, onValueChanged), lifeTime);
		}

		public static IEnumerator Wait(float delay, Action onDone)
		{
			yield return (object)new WaitForSeconds(delay);
			onDone?.Invoke();
		}

		public static IEnumerator WaitRealtime(float delay, Action onDone)
		{
			yield return (object)new WaitForSecondsRealtime(delay);
			onDone?.Invoke();
		}

		public static IEnumerator Blink(BlinkInfo info, Action<bool> onBlinkChanged)
		{
			float time = 0f;
			bool lastCond = false;
			onBlinkChanged?.Invoke(obj: false);
			while (time < info.Duration)
			{
				bool flag = BlinkByProgress(Mathf.Repeat(time * info.Speed, 1f));
				if (flag != lastCond)
				{
					onBlinkChanged?.Invoke(flag);
					lastCond = flag;
				}
				time += Time.deltaTime;
				yield return null;
			}
			onBlinkChanged?.Invoke(info.EndBlinkState);
		}

		public static IEnumerator Lerp(LerpInfo info, Action<float> onValueChanged)
		{
			float time = 0f;
			onValueChanged?.Invoke(info.From);
			while (time < info.Duration)
			{
				float num = info.Easing.Evaluate(time / info.Duration);
				float obj = Mathf.Lerp(info.From, info.To, num);
				onValueChanged?.Invoke(obj);
				time += Time.deltaTime;
				yield return null;
			}
			onValueChanged?.Invoke(info.To);
		}

		private static bool BlinkByProgress(float progress)
		{
			return progress % 0.25f < 0.125f;
		}
	}
	public struct BlinkInfo
	{
		public bool EndBlinkState;

		public float Speed;

		public float Duration;

		public static readonly BlinkInfo InDefault = new BlinkInfo
		{
			Duration = 0.33f,
			Speed = 3f,
			EndBlinkState = true
		};

		public static readonly BlinkInfo OutDefault = new BlinkInfo
		{
			Duration = 0.33f,
			Speed = 3f,
			EndBlinkState = false
		};
	}
	public struct LerpInfo
	{
		public float From;

		public float To;

		public float Duration;

		public EaseFunc.Type Easing;

		public LerpInfo(float from, float to, float duration, EaseFunc.Type ease = EaseFunc.Type.Linear)
		{
			From = from;
			To = to;
			Duration = duration;
			Easing = ease;
		}
	}
	public static class EaseFunc
	{
		public enum Type : byte
		{
			Linear,
			Zero,
			One,
			InQuad,
			OutQuad,
			InOutQuad,
			InCubic,
			OutCubic,
			InOutCubic,
			InQuart,
			OutQuart,
			InOutQuart,
			InQuint,
			OutQuint,
			InOutQuint,
			InSine,
			OutSine,
			InOutSine,
			InExpo,
			OutExpo,
			InOutExpo,
			InCirc,
			OutCirc,
			InOutCirc,
			InElastic,
			OutElastic,
			InOutElastic,
			InBack,
			OutBack,
			InOutBack,
			InBounce,
			OutBounce,
			InOutBounce
		}

		public static float Evaluate(this Type type, float t)
		{
			t = Mathf.Clamp01(t);
			return type switch
			{
				Type.Linear => t, 
				Type.Zero => 0f, 
				Type.One => 1f, 
				Type.InQuad => InQuad(t), 
				Type.OutQuad => OutQuad(t), 
				Type.InOutQuad => InOutQuad(t), 
				Type.InCubic => InCubic(t), 
				Type.OutCubic => OutCubic(t), 
				Type.InOutCubic => InOutCubic(t), 
				Type.InQuart => InQuart(t), 
				Type.OutQuart => OutQuart(t), 
				Type.InOutQuart => InOutQuart(t), 
				Type.InQuint => InQuint(t), 
				Type.OutQuint => OutQuint(t), 
				Type.InOutQuint => InOutQuint(t), 
				Type.InSine => InSine(t), 
				Type.OutSine => OutSine(t), 
				Type.InOutSine => InOutSine(t), 
				Type.InExpo => InExpo(t), 
				Type.OutExpo => OutExpo(t), 
				Type.InOutExpo => InOutExpo(t), 
				Type.InCirc => InCirc(t), 
				Type.OutCirc => OutCirc(t), 
				Type.InOutCirc => InOutCirc(t), 
				Type.InElastic => InElastic(t), 
				Type.OutElastic => OutElastic(t), 
				Type.InOutElastic => InOutElastic(t), 
				Type.InBack => InBack(t), 
				Type.OutBack => OutBack(t), 
				Type.InOutBack => InOutBack(t), 
				Type.InBounce => InBounce(t), 
				Type.OutBounce => OutBounce(t), 
				Type.InOutBounce => InOutBounce(t), 
				_ => throw new ArgumentOutOfRangeException("type", "Given type was invalid!"), 
			};
		}

		public static float InQuad(float t)
		{
			return t * t;
		}

		public static float OutQuad(float t)
		{
			return 1f - InQuad(1f - t);
		}

		public static float InOutQuad(float t)
		{
			if ((double)t < 0.5)
			{
				return InQuad(t * 2f) / 2f;
			}
			return 1f - InQuad((1f - t) * 2f) / 2f;
		}

		public static float InCubic(float t)
		{
			return t * t * t;
		}

		public static float OutCubic(float t)
		{
			return 1f - InCubic(1f - t);
		}

		public static float InOutCubic(float t)
		{
			if ((double)t < 0.5)
			{
				return InCubic(t * 2f) / 2f;
			}
			return 1f - InCubic((1f - t) * 2f) / 2f;
		}

		public static float InQuart(float t)
		{
			return t * t * t * t;
		}

		public static float OutQuart(float t)
		{
			return 1f - InQuart(1f - t);
		}

		public static float InOutQuart(float t)
		{
			if ((double)t < 0.5)
			{
				return InQuart(t * 2f) / 2f;
			}
			return 1f - InQuart((1f - t) * 2f) / 2f;
		}

		public static float InQuint(float t)
		{
			return t * t * t * t * t;
		}

		public static float OutQuint(float t)
		{
			return 1f - InQuint(1f - t);
		}

		public static float InOutQuint(float t)
		{
			if ((double)t < 0.5)
			{
				return InQuint(t * 2f) / 2f;
			}
			return 1f - InQuint((1f - t) * 2f) / 2f;
		}

		public static float InSine(float t)
		{
			return (float)(0.0 - Math.Cos((double)t * Math.PI / 2.0));
		}

		public static float OutSine(float t)
		{
			return (float)Math.Sin((double)t * Math.PI / 2.0);
		}

		public static float InOutSine(float t)
		{
			return (float)(Math.Cos((double)t * Math.PI) - 1.0) / -2f;
		}

		public static float InExpo(float t)
		{
			return (float)Math.Pow(2.0, 10f * (t - 1f));
		}

		public static float OutExpo(float t)
		{
			return 1f - InExpo(1f - t);
		}

		public static float InOutExpo(float t)
		{
			if ((double)t < 0.5)
			{
				return InExpo(t * 2f) / 2f;
			}
			return 1f - InExpo((1f - t) * 2f) / 2f;
		}

		public static float InCirc(float t)
		{
			return 0f - ((float)Math.Sqrt(1f - t * t) - 1f);
		}

		public static float OutCirc(float t)
		{
			return 1f - InCirc(1f - t);
		}

		public static float InOutCirc(float t)
		{
			if ((double)t < 0.5)
			{
				return InCirc(t * 2f) / 2f;
			}
			return 1f - InCirc((1f - t) * 2f) / 2f;
		}

		public static float InElastic(float t)
		{
			return 1f - OutElastic(1f - t);
		}

		public static float OutElastic(float t)
		{
			float num = 0.3f;
			return (float)Math.Pow(2.0, -10f * t) * (float)Math.Sin((double)(t - num / 4f) * (Math.PI * 2.0) / (double)num) + 1f;
		}

		public static float InOutElastic(float t)
		{
			if ((double)t < 0.5)
			{
				return InElastic(t * 2f) / 2f;
			}
			return 1f - InElastic((1f - t) * 2f) / 2f;
		}

		public static float InBack(float t)
		{
			float num = 1.70158f;
			return t * t * ((num + 1f) * t - num);
		}

		public static float OutBack(float t)
		{
			return 1f - InBack(1f - t);
		}

		public static float InOutBack(float t)
		{
			if ((double)t < 0.5)
			{
				return InBack(t * 2f) / 2f;
			}
			return 1f - InBack((1f - t) * 2f) / 2f;
		}

		public static float InBounce(float t)
		{
			return 1f - OutBounce(1f - t);
		}

		public static float OutBounce(float t)
		{
			float num = 2.75f;
			float num2 = 7.5625f;
			if (t < 1f / num)
			{
				return num2 * t * t;
			}
			if (t < 2f / num)
			{
				t -= 1.5f / num;
				return num2 * t * t + 0.75f;
			}
			if ((double)t < 2.5 / (double)num)
			{
				t -= 2.25f / num;
				return num2 * t * t + 0.9375f;
			}
			t -= 2.625f / num;
			return num2 * t * t + 63f / 64f;
		}

		public static float InOutBounce(float t)
		{
			if ((double)t < 0.5)
			{
				return InBounce(t * 2f) / 2f;
			}
			return 1f - InBounce((1f - t) * 2f) / 2f;
		}
	}
	public static class EasyDetour
	{
		public unsafe delegate void StaticVoidDelegate(Il2CppMethodInfo* methodInfo);

		public unsafe delegate void InstanceVoidDelegate(IntPtr instancePtr, Il2CppMethodInfo* methodInfo);

		public static bool TryCreate<T>(DetourDescriptor descriptor, T to, out T originalCall, out INativeDetour detourInstance) where T : Delegate
		{
			try
			{
				nint methodPointer = descriptor.GetMethodPointer();
				detourInstance = INativeDetour.CreateAndApply<T>((IntPtr)methodPointer, to, ref originalCall);
				return detourInstance != null;
			}
			catch (Exception ex)
			{
				Logger.Error("Exception Thrown while creating Detour:");
				Logger.Error(ex.ToString());
			}
			originalCall = null;
			detourInstance = null;
			return false;
		}
	}
	public struct DetourDescriptor
	{
		public Type Type;

		public Type ReturnType;

		public Type[] ArgTypes;

		public string MethodName;

		public bool IsGeneric;

		public unsafe nint GetMethodPointer()
		{
			if (Type == null)
			{
				throw new MissingFieldException("Field Type is not set!");
			}
			if (ReturnType == null)
			{
				throw new MissingFieldException("Field ReturnType is not set! If you mean 'void' do typeof(void)");
			}
			if (string.IsNullOrEmpty(MethodName))
			{
				throw new MissingFieldException("Field MethodName is not set or valid!");
			}
			Il2CppType.From(Type, true);
			IntPtr nativeClassPointer = Il2CppClassPointerStore.GetNativeClassPointer(Type);
			string fullName = GetFullName(ReturnType);
			string[] array;
			if (ArgTypes == null || ArgTypes.Length == 0)
			{
				array = Array.Empty<string>();
			}
			else
			{
				int num = ArgTypes.Length;
				array = new string[num];
				for (int i = 0; i < num; i++)
				{
					Type type = ArgTypes[i];
					array[i] = GetFullName(type);
				}
			}
			void** ptr = (void**)IL2CPP.GetIl2CppMethod(nativeClassPointer, IsGeneric, MethodName, fullName, array).ToPointer();
			if (ptr == null)
			{
				return (nint)ptr;
			}
			return (nint)(*ptr);
		}

		private static string GetFullName(Type type)
		{
			bool isPointer = type.IsPointer;
			if (isPointer)
			{
				type = type.GetElementType();
			}
			if (type.IsPrimitive || type == typeof(string))
			{
				if (isPointer)
				{
					return type.MakePointerType().FullName;
				}
				return type.FullName;
			}
			Type val = Il2CppType.From(type, true);
			if (isPointer)
			{
				return val.MakePointerType().FullName;
			}
			return val.FullName;
		}
	}
	public struct HalfColor
	{
		public Half R;

		public Half G;

		public Half B;

		public Half A;

		public HalfColor()
		{
			R = (Half)0f;
			G = (Half)0f;
			B = (Half)0f;
			A = (Half)0f;
		}

		public HalfColor(float r, float g, float b, float a)
		{
			R = (Half)r;
			G = (Half)g;
			B = (Half)b;
			A = (Half)a;
		}

		public static implicit operator Color(HalfColor halfCol)
		{
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			return new Color((float)halfCol.R, (float)halfCol.G, (float)halfCol.B, (float)halfCol.A);
		}

		public static implicit operator HalfColor(Color col)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			HalfColor result = new HalfColor();
			result.R = (Half)col.r;
			result.G = (Half)col.g;
			result.B = (Half)col.b;
			result.A = (Half)col.a;
			return result;
		}
	}
	public struct HalfRGBColor
	{
		public Half R;

		public Half G;

		public Half B;

		public static implicit operator Color(HalfRGBColor halfCol)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			return new Color((float)halfCol.R, (float)halfCol.G, (float)halfCol.B);
		}

		public static implicit operator HalfRGBColor(Color col)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			HalfRGBColor result = default(HalfRGBColor);
			result.R = (Half)col.r;
			result.G = (Half)col.g;
			result.B = (Half)col.b;
			return result;
		}
	}
	public class RNG
	{
		private const int Float01Precision = 2000000000;

		private const float Float01Inv = 5E-10f;

		private static uint _UniqueIDForRandomSeed = 0u;

		private Random _Rand;

		private int _Seed;

		public static GlobalRNG Global { get; private set; } = new GlobalRNG();


		public float Float01 => (float)_Rand.Next(0, 2000000001) * 5E-10f;

		public float FloatMinusOneToPlusOne => (float)_Rand.Next(-2000000000, 2000000001) * 5E-10f;

		public int Int0ToPositive => _Rand.Next(0, int.MaxValue);

		public int Int0ToNegative => _Rand.Next(int.MinValue, 1);

		public int Int => _Rand.Next(int.MinValue, int.MaxValue);

		public RNG()
		{
			if (_UniqueIDForRandomSeed == uint.MaxValue)
			{
				_UniqueIDForRandomSeed = 0u;
			}
			else
			{
				_UniqueIDForRandomSeed++;
			}
			_Seed = $"{_UniqueIDForRandomSeed} {Environment.TickCount64}".GetHashCode();
			_Rand = new Random(_Seed);
		}

		public RNG(int seed)
		{
			_Seed = seed;
			_Rand = new Random(seed);
		}

		public virtual void Reset(int? newSeed = null)
		{
			if (newSeed.HasValue)
			{
				_Seed = newSeed.Value;
			}
			_Rand = new Random(_Seed);
		}

		public bool Probability(float probability)
		{
			if (probability <= 0f)
			{
				return false;
			}
			if (probability >= 1f)
			{
				return true;
			}
			return Float01 < probability;
		}

		public bool OneIn(int cases)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Expected O, but got Unknown
			if (cases <= 0)
			{
				bool flag = default(bool);
				BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(46, 3, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("RNG");
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral(".");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("OneIn");
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" received ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(cases);
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" (0 or negative); fallback to false");
				}
				Logger.Warn(val);
				return false;
			}
			if (cases == 1)
			{
				return true;
			}
			return _Rand.Next(0, cases) == 0;
		}

		public T Choice<T>(params T[] items)
		{
			return Choice((IEnumerable<T>)items);
		}

		public T Choice<T>(IEnumerable<T> items)
		{
			if (IsChoiceHaveSimpleScenarioValue(items, out var value))
			{
				return value;
			}
			int maxValue = items.Count();
			int index = _Rand.Next(0, maxValue);
			return items.ElementAt(index);
		}

		public T[] Choice<T>(IEnumerable<T> items, int count)
		{
			if (IsChoiceHaveSimpleScenarioValue(items, out var value))
			{
				return new T[1] { value };
			}
			return items.OrderBy((T x) => _Rand.NextDouble()).Take(count).ToArray();
		}

		public T WeightedChoice<T>(IEnumerable<(T item, float weight)> itemTuples)
		{
			if (IsChoiceHaveSimpleScenarioValue<(T, float)>(itemTuples, out var value))
			{
				return value.Item1;
			}
			T[] array = itemTuples.Select(((T item, float weight) x) => x.item).ToArray();
			float[] array2 = itemTuples.Select(((T item, float weight) x) => x.weight).ToArray();
			float num = 0f;
			for (int i = 0; i < array2.Length; i++)
			{
				float num2 = array2[i];
				if (num2 <= 0f)
				{
					array2[i] = -1f;
				}
				else
				{
					num = (array2[i] = num + num2);
				}
			}
			if (num <= 0f)
			{
				return Choice(array);
			}
			float num3 = Float01 * num;
			for (int j = 0; j < array2.Length; j++)
			{
				if (j == array2.Length - 1 || num3 <= array2[j])
				{
					return array[j];
				}
			}
			throw new InvalidOperationException("What? this should never happen");
		}

		private static bool IsChoiceHaveSimpleScenarioValue<T>(IEnumerable<T> items, out T value)
		{
			int num = items.Count();
			if (num <= 0)
			{
				throw new ArgumentException("Argument Item Count is 0!", "items");
			}
			if (num == 1)
			{
				value = items.First();
				return true;
			}
			value = default(T);
			return false;
		}
	}
	public sealed class GlobalRNG : RNG
	{
		public sealed override void Reset(int? newSeed = null)
		{
			Logger.Warn("Resetting Seed Value is not allowed on RNG.Global");
		}
	}
}
namespace FloLib.Utils.Extensions
{
	public static class ColorExtension
	{
		public static string ToHex(this Color input)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			return "#" + ColorUtility.ToHtmlStringRGB(input);
		}

		public static string ToHexRGBA(this Color input)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			return "#" + ColorUtility.ToHtmlStringRGBA(input);
		}

		public static void GetColorInfo(this Color input, out Color baseColor, out float colorMultiplier)
		{
			//IL_000c: 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_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			float num = 0f;
			float num2 = 0f;
			float r = input.r;
			float g = input.g;
			float b = input.b;
			float num3 = Mathf.Abs(r);
			float num4 = Mathf.Abs(g);
			float num5 = Mathf.Abs(b);
			if (num3 > num2)
			{
				num2 = num3;
				num = r;
			}
			if (num4 > num2)
			{
				num2 = num4;
				num = g;
			}
			if (num5 > num2)
			{
				num2 = num5;
				num = b;
			}
			if (num2 > 0f)
			{
				baseColor = new Color(r / num, g / num, b / num, 1f);
				colorMultiplier = num;
			}
			else
			{
				baseColor = Color.black;
				colorMultiplier = 1f;
			}
		}
	}
	public static class ComponentExtension
	{
		public static bool TryGetComp<T>(this Component comp, out T component)
		{
			component = comp.GetComponent<T>();
			return component != null;
		}

		public static bool TryGetVirtualScene(this Component comp, out GUIX_VirtualScene scene)
		{
			GUIX_VirtualSceneLink component = comp.GetComponent<GUIX_VirtualSceneLink>();
			if ((Object)(object)component == (Object)null)
			{
				scene = null;
				return false;
			}
			scene = component.m_virtualScene;
			return (Object)(object)scene != (Object)null;
		}

		public static string GetGameObjectPath(this Component comp)
		{
			return comp.gameObject.GetPath();
		}
	}
	public static class GameObjectExtension
	{
		public static bool TryGetComp<T>(this GameObject obj, out T component)
		{
			component = obj.GetComponent<T>();
			return component != null;
		}

		public static T GetCompInParentOrChild<T>(this GameObject obj)
		{
			T val = obj.GetComponentInParent<T>();
			if (val == null)
			{
				val = obj.GetComponentInChildren<T>();
				if (val == null)
				{
					obj.GetComponent<T>();
				}
			}
			return val;
		}

		public static string GetPath(this GameObject obj)
		{
			string text = "/" + ((Object)obj).name;
			while ((Object)(object)obj.transform.parent != (Object)null)
			{
				obj = ((Component)obj.transform.parent).gameObject;
				text = "/" + ((Object)obj).name + text;
			}
			return text;
		}
	}
	public static class Il2CppBoxingExtension
	{
		public static Object BoxToIl2CppObject(this bool value)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			Boolean val = default(Boolean);
			val.m_value = value;
			return ((Boolean)(ref val)).BoxIl2CppObject();
		}

		public static Object BoxToIl2CppObject(this byte value)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			Byte val = default(Byte);
			val.m_value = value;
			return ((Byte)(ref val)).BoxIl2CppObject();
		}

		public static Object BoxToIl2CppObject(this sbyte value)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			SByte val = default(SByte);
			val.m_value = value;
			return ((SByte)(ref val)).BoxIl2CppObject();
		}

		public static Object BoxToIl2CppObject(this char value)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			Char val = default(Char);
			val.m_value = value;
			return ((Char)(ref val)).BoxIl2CppObject();
		}

		public static Object BoxToIl2CppObject(this short value)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			Int16 val = default(Int16);
			val.m_value = value;
			return ((Int16)(ref val)).BoxIl2CppObject();
		}

		public static Object BoxToIl2CppObject(this ushort value)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			UInt16 val = default(UInt16);
			val.m_value = value;
			return ((UInt16)(ref val)).BoxIl2CppObject();
		}

		public static Object BoxToIl2CppObject(this int value)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			Int32 val = default(Int32);
			val.m_value = value;
			return ((Int32)(ref val)).BoxIl2CppObject();
		}

		public static Object BoxToIl2CppObject(this uint value)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			UInt32 val = default(UInt32);
			val.m_value = value;
			return ((UInt32)(ref val)).BoxIl2CppObject();
		}

		public static Object BoxToIl2CppObject(this long value)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			Int64 val = default(Int64);
			val.m_value = value;
			return ((Int64)(ref val)).BoxIl2CppObject();
		}

		public static Object BoxToIl2CppObject(this ulong value)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			UInt64 val = default(UInt64);
			val.m_value = value;
			return ((UInt64)(ref val)).BoxIl2CppObject();
		}

		public static Object BoxToIl2CppObject(this float value)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			Single val = default(Single);
			val.m_value = value;
			return ((Single)(ref val)).BoxIl2CppObject();
		}

		public static Object BoxToIl2CppObject(this double value)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			Double val = default(Double);
			val.m_value = value;
			return ((Double)(ref val)).BoxIl2CppObject();
		}

		public static Object BoxToIl2CppObject(this nint value)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			IntPtr val = default(IntPtr);
			val.m_value = value;
			return ((IntPtr)(ref val)).BoxIl2CppObject();
		}
	}
	public static class Il2CppObjectExtension
	{
		public static bool CanCastToType<T>(this Il2CppObjectBase obj) where T : Il2CppObjectBase
		{
			return obj.TryCast<T>() != null;
		}

		public static bool TryCastToType<T>(this Il2CppObjectBase obj, out T result) where T : Il2CppObjectBase
		{
			result = obj.TryCast<T>();
			return result != null;
		}
	}
	public static class LGLightExtension
	{
		public static void SetColor(this IEnumerable<LG_Light> lights, Color color)
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			foreach (LG_Light light in lights)
			{
				light.ChangeColor(color);
			}
		}

		public static void SetEnabled(this IEnumerable<LG_Light> lights, bool enabled)
		{
			foreach (LG_Light light in lights)
			{
				light.SetEnabled(enabled);
			}
		}

		public static bool Is(this LG_Light light, LightCategory lightCategory)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Invalid comparison between Unknown and I4
			return (int)light.m_category == (int)lightCategory;
		}

		public static bool IsAny(this LG_Light light, params LightCategory[] categories)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Invalid comparison between Unknown and I4
			for (int i = 0; i < categories.Length; i++)
			{
				if ((int)light.m_category == (int)categories[i])
				{
					return true;
				}
			}
			return false;
		}
	}
	public enum LightCategory
	{
		General = 0,
		Special = 1,
		Independent = 3,
		Sign = 5,
		Door = 4,
		DoorImportant = 6,
		Emergency = 2
	}
	public static class TerminalExtension
	{
		public static void SetPowered(this LG_ComputerTerminal terminal, bool isPowered)
		{
			terminal.OnProximityExit();
			Interact_ComputerTerminal componentInChildren = ((Component)terminal).GetComponentInChildren<Interact_ComputerTerminal>(true);
			if ((Object)(object)componentInChildren != (Object)null)
			{
				((Behaviour)componentInChildren).enabled = isPowered;
				((Interact_Base)componentInChildren).SetActive(isPowered);
			}
			GUIX_VirtualSceneLink component = ((Component)terminal).GetComponent<GUIX_VirtualSceneLink>();
			if ((Object)(object)component != (Object)null && (Object)(object)component.m_virtualScene != (Object)null)
			{
				GUIX_VirtualCamera virtualCamera = component.m_virtualScene.virtualCamera;
				float num = (isPowered ? 0.3f : 0f);
				float num2 = (isPowered ? 1000f : 0f);
				virtualCamera.SetFovAndClip(virtualCamera.paramCamera.fieldOfView, num, num2);
			}
			if ((Object)(object)terminal.m_text != (Object)null)
			{
				((Behaviour)terminal.m_text).enabled = isPowered;
			}
			if (!isPowered)
			{
				PlayerAgent localInteractionSource = terminal.m_localInteractionSource;
				if ((Object)(object)localInteractionSource != (Object)null && localInteractionSource.FPItemHolder.InTerminalTrigger)
				{
					terminal.ExitFPSView();
				}
			}
		}
	}
	public static class VectorExtension
	{
		public static string ToFormattedString(this Vector2 vector)
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			return $"x: {vector.x:0.0000}, y: {vector.y:0.0000}";
		}

		public static string ToFormattedString(this Vector3 vector)
		{
			//IL_0018: 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_0054: Unknown result type (might be due to invalid IL or missing references)
			return $"x: {vector.x:0.0000}, y: {vector.y:0.0000} z: {vector.z:0.0000}";
		}

		public static string ToFormattedString(this Vector4 vector)
		{
			//IL_0018: 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_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			return $"x: {vector.x:0.0000}, y: {vector.y:0.0000} z: {vector.z:0.0000} w: {vector.w:0.0000}";
		}
	}
}
namespace FloLib.Utils.Comps
{
	[AutoInject]
	internal sealed class EmptyMB : MonoBehaviour
	{
	}
}
namespace FloLib.Networks
{
	public static class GlobalNetAction<P> where P : struct
	{
		private static string _EventName;

		private static bool _IsSetup;

		public static SNet_ChannelType SendChannel { get; set; }

		public static SNet_Player LastSender { get; private set; }

		public static ulong LastSenderID { get; private set; }

		public static event Action<ulong, P> OnReceive;

		public static event Action<ulong, P> OnReceiveLocally;

		static GlobalNetAction()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			SendChannel = (SNet_ChannelType)2;
			_IsSetup = false;
			Setup();
		}

		public static void Setup()
		{
			if (!_IsSetup)
			{
				_EventName = UName.Get(typeof(P), "NA");
				NetworkAPI.RegisterEvent<P>(_EventName, (Action<ulong, P>)Received);
				_IsSetup = true;
			}
		}

		public static void Send(P payload)
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			if (!_IsSetup)
			{
				Logger.Error("Action Wasn't Setup!");
				return;
			}
			SendToLocal(payload);
			NetworkAPI.InvokeEvent<P>(_EventName, payload, SendChannel);
		}

		public static void SendTo(P payload, SNet_Player target)
		{
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			if (!_IsSetup)
			{
				Logger.Error("Action Wasn't Setup!");
			}
			else if (target.IsLocal)
			{
				SendToLocal(payload);
			}
			else
			{
				NetworkAPI.InvokeEvent<P>(_EventName, payload, SendChannel);
			}
		}

		public static void SendTo(P payload, SNet_SendGroup group)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			if (!_IsSetup)
			{
				Logger.Error("Action Wasn't Setup!");
				return;
			}
			Enumerator<SNet_Player> enumerator = SNet_PlayerSendGroupManager.GetGroup(group).GetEnumerator();
			while (enumerator.MoveNext())
			{
				SNet_Player current = enumerator.Current;
				SendTo(payload, current);
			}
		}

		private static void SendToLocal(P payload)
		{
			if (!_IsSetup)
			{
				Logger.Error("Action Wasn't Setup!");
				return;
			}
			SNet_Player val = (LastSender = SNet.LocalPlayer);
			if ((Object)(object)val != (Object)null)
			{
				LastSenderID = val.Lookup;
			}
			GlobalNetAction<P>.OnReceive?.Invoke(LastSenderID, payload);
			GlobalNetAction<P>.OnReceiveLocally?.Invoke(LastSenderID, payload);
		}

		private static void Received(ulong sender, P payload)
		{
			if (!_IsSetup)
			{
				Logger.Error("Action Wasn't Setup!");
				return;
			}
			SNet_Player lastSender = default(SNet_Player);
			if (!SNet.Core.TryGetPlayer(sender, ref lastSender, false))
			{
				LastSender = null;
				LastSenderID = 0uL;
				Logger.Error("NetAction sender was invalid!");
			}
			LastSender = lastSender;
			LastSenderID = sender;
			GlobalNetAction<P>.OnReceive?.Invoke(sender, payload);
		}
	}
	public static class GlobalNetMasterAction<P> where P : struct
	{
		public static Func<ulong, P, bool> IsActionValid;

		private static string _AskEventName;

		private static string _EventName;

		private static bool _IsSetup;

		public static SNet_ChannelType SendChannel { get; set; }

		public static SNet_Player LastSender { get; private set; }

		public static ulong LastSenderID { get; private set; }

		public static event Action<ulong, P> OnReceive;

		public static event Action<ulong, P> OnMasterReceive;

		static GlobalNetMasterAction()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			SendChannel = (SNet_ChannelType)2;
			IsActionValid = (ulong sender, P p) => true;
			_IsSetup = false;
			Setup();
		}

		public static void Setup()
		{
			if (!_IsSetup)
			{
				_AskEventName = UName.Get(typeof(P), "NMA0");
				_EventName = UName.Get(typeof(P), "NMA1");
				NetworkAPI.RegisterEvent<P>(_AskEventName, (Action<ulong, P>)ReceivedAsk);
				NetworkAPI.RegisterEvent<P>(_EventName, (Action<ulong, P>)Received);
				_IsSetup = true;
			}
		}

		public static void Ask(P payload)
		{
			//IL_0090: 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)
			if (!_IsSetup)
			{
				Logger.Error("Action Wasn't Setup!");
			}
			else
			{
				if (!SNet.HasMaster)
				{
					return;
				}
				if (SNet.IsMaster)
				{
					Func<ulong, P, bool> isActionValid = IsActionValid;
					if (isActionValid == null || isActionValid(SNet.LocalPlayer.Lookup, payload))
					{
						NetworkAPI.InvokeEvent<P>(_EventName, payload, SendChannel);
						GlobalNetMasterAction<P>.OnReceive?.Invoke(SNet.LocalPlayer.Lookup, payload);
						GlobalNetMasterAction<P>.OnMasterReceive?.Invoke(SNet.LocalPlayer.Lookup, payload);
					}
				}
				else
				{
					NetworkAPI.InvokeEvent<P>(_AskEventName, payload, SNet.Master, SendChannel);
				}
			}
		}

		private static void ReceivedAsk(ulong sender, P payload)
		{
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			if (!_IsSetup)
			{
				Logger.Error("Action Wasn't Setup!");
				return;
			}
			if (!SNet.IsMaster)
			{
				Logger.Error("Non Master Received Ask Action!");
				return;
			}
			Func<ulong, P, bool> isActionValid = IsActionValid;
			if (isActionValid == null || isActionValid(sender, payload))
			{
				NetworkAPI.InvokeEvent<P>(_EventName, payload, SendChannel);
				GlobalNetMasterAction<P>.OnReceive?.Invoke(SNet.LocalPlayer.Lookup, payload);
				GlobalNetMasterAction<P>.OnMasterReceive?.Invoke(sender, payload);
			}
		}

		private static void Received(ulong sender, P payload)
		{
			if (!_IsSetup)
			{
				Logger.Error("Action Wasn't Setup!");
				return;
			}
			SNet_Player lastSender = default(SNet_Player);
			if (!SNet.Core.TryGetPlayer(sender, ref lastSender, false))
			{
				LastSender = null;
				LastSenderID = 0uL;
				Logger.Error("NetMasterAction sender was invalid!");
				return;
			}
			LastSender = lastSender;
			LastSenderID = sender;
			if (!LastSender.IsMaster)
			{
				Logger.Error("Sender was not a master");
			}
			else
			{
				GlobalNetMasterAction<P>.OnReceive?.Invoke(sender, payload);
			}
		}
	}
	internal static class UName
	{
		private static readonly SHA1 SHA = SHA1.Create();

		public static string Get(Type type, string prefix)
		{
			return prefix + GetHash(type.FullName);
		}

		public static string GetHash(string text)
		{
			return Convert.ToBase64String(SHA.ComputeHash(Encoding.Unicode.GetBytes(text + "this is salt text, Awesome!")));
		}
	}
}
namespace FloLib.Networks.Replications
{
	public interface IStateReplicatorHolder<S> where S : struct
	{
		StateReplicator<S> Replicator { get; }

		void OnStateChange(S oldState, S state, bool isRecall);
	}
	public sealed class ReplicatorHandshake
	{
		public delegate void ClientRequestedSyncDel(SNet_Player requestedPlayer);

		public struct Packet
		{
			public uint replicatorID;

			public PacketAction action;
		}

		public enum PacketAction : byte
		{
			Created,
			Destroyed,
			SyncRequest
		}

		public sealed class Data
		{
			public bool SetupOnHost;

			public bool SetupOnClient;
		}

		private readonly Dictionary<uint, Data> _Lookup = new Dictionary<uint, Data>();

		public string EventName { get; private set; }

		public bool IsReadyToSync { get; private set; }

		public event ClientRequestedSyncDel OnClientSyncRequested;

		public static ReplicatorHandshake Create(string guid)
		{
			if (string.IsNullOrWhiteSpace(guid))
			{
				return null;
			}
			string text = "RHs" + guid;
			if (!NetworkAPI.IsEventRegistered(text))
			{
				return new ReplicatorHandshake(text);
			}
			return null;
		}

		private ReplicatorHandshake(string eventName)
		{
			EventName = eventName;
			NetworkAPI.RegisterEvent<Packet>(eventName, (Action<ulong, Packet>)OnSyncAction);
		}

		public void Reset()
		{
			_Lookup.Clear();
		}

		private void OnSyncAction(ulong sender, Packet packet)
		{
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Expected O, but got Unknown
			if (!SNet.IsMaster && sender == SNet.Master.Lookup)
			{
				if (packet.action == PacketAction.Created)
				{
					SetHostState(packet.replicatorID, isSetup: true);
				}
				else if (packet.action == PacketAction.Destroyed)
				{
					SetHostState(packet.replicatorID, isSetup: false);
				}
			}
			else
			{
				if (!SNet.IsMaster)
				{
					return;
				}
				if (packet.action == PacketAction.Created)
				{
					SetClientState(packet.replicatorID, isSetup: true);
				}
				else if (packet.action == PacketAction.Destroyed)
				{
					SetClientState(packet.replicatorID, isSetup: false);
				}
				else
				{
					if (packet.action != PacketAction.SyncRequest)
					{
						return;
					}
					SNet_Player requestedPlayer = default(SNet_Player);
					if (!SNet.TryGetPlayer(sender, ref requestedPlayer))
					{
						bool flag = default(bool);
						BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(32, 1, ref flag);
						if (flag)
						{
							((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Cannot find player from sender: ");
							((BepInExLogInterpolatedStringHandler)val).AppendFormatted<ulong>(sender);
						}
						Logger.Error(val);
					}
					else
					{
						this.OnClientSyncRequested?.Invoke(requestedPlayer);
					}
				}
			}
		}

		public void UpdateCreated(uint id)
		{
			if (SNet.IsInLobby)
			{
				if (SNet.IsMaster)
				{
					SetHostState(id, isSetup: true);
					NetworkAPI.InvokeEvent<Packet>(EventName, new Packet
					{
						replicatorID = id,
						action = PacketAction.Created
					}, (SNet_ChannelType)2);
				}
				else if (SNet.HasMaster)
				{
					SetClientState(id, isSetup: true);
					NetworkAPI.InvokeEvent<Packet>(EventName, new Packet
					{
						replicatorID = id,
						action = PacketAction.Created
					}, SNet.Master, (SNet_ChannelType)2);
				}
				else
				{
					Logger.Error("Handshake::MASTER is NULL in lobby; This should NOT happen!!!!!!!!!!!!");
				}
			}
			else
			{
				Logger.Error("Handshake::Session Type StateReplicator cannot be created without lobby!");
			}
		}

		public void UpdateDestroyed(uint id)
		{
			if (SNet.IsInLobby)
			{
				if (SNet.IsMaster)
				{
					SetHostState(id, isSetup: true);
					NetworkAPI.InvokeEvent<Packet>(EventName, new Packet
					{
						replicatorID = id,
						action = PacketAction.Destroyed
					}, (SNet_ChannelType)2);
				}
				else if (SNet.HasMaster)
				{
					SetClientState(id, isSetup: true);
					NetworkAPI.InvokeEvent<Packet>(EventName, new Packet
					{
						replicatorID = id,
						action = PacketAction.Destroyed
					}, SNet.Master, (SNet_ChannelType)2);
				}
				else
				{
					Logger.Error("Handshake::MASTER is NULL in lobby; This should NOT happen!!!!!!!!!!!!");
				}
			}
			else
			{
				Logger.Error("Handshake::Session Type StateReplicator cannot be created without lobby!");
			}
		}

		private void SetHostState(uint id, bool isSetup)
		{
			if (_Lookup.TryGetValue(id, out var value))
			{
				value.SetupOnHost = isSetup;
			}
			else
			{
				_Lookup[id] = new Data
				{
					SetupOnHost = isSetup
				};
			}
			UpdateSyncState(id);
		}

		private void SetClientState(uint id, bool isSetup)
		{
			if (_Lookup.TryGetValue(id, out var value))
			{
				value.SetupOnClient = isSetup;
			}
			else
			{
				_Lookup[id] = new Data
				{
					SetupOnClient = isSetup
				};
			}
			UpdateSyncState(id);
		}

		private void UpdateSyncState(uint id)
		{
			bool isReadyToSync = IsReadyToSync;
			if (_Lookup.TryGetValue(id, out var value))
			{
				IsReadyToSync = value.SetupOnHost && value.SetupOnClient;
			}
			else
			{
				IsReadyToSync = false;
			}
			if (IsReadyToSync && isReadyToSync != IsReadyToSync && SNet.HasMaster && !SNet.IsMaster)
			{
				NetworkAPI.InvokeEvent<Packet>(EventName, new Packet
				{
					replicatorID = id,
					action = PacketAction.SyncRequest
				}, SNet.Master, (SNet_ChannelType)2);
			}
		}
	}
	public delegate void OnReceiveDel<S>(ulong sender, uint replicatorID, S newState) where S : struct;
	public static class StatePayloads
	{
		public enum Size
		{
			State4Byte = 4,
			State8Byte = 8,
			State16Byte = 16,
			State32Byte = 32,
			State48Byte = 48,
			State64Byte = 64,
			State80Byte = 80,
			State96Byte = 96,
			State128Byte = 128,
			State196Byte = 196,
			State256Byte = 256
		}

		public static Size GetSizeType(int size)
		{
			Size size2 = Size.State8Byte;
			foreach (object value in Enum.GetValues(typeof(Size)))
			{
				if (size <= (int)value && (int)size2 < (int)value)
				{
					size2 = (Size)value;
					break;
				}
			}
			return size2;
		}

		public static IReplicatorEvent<S> CreateEvent<S>(Size size, string eventName, OnReceiveDel<S> onReceiveCallback) where S : struct
		{
			return size switch
			{
				Size.State4Byte => ReplicatorPayloadWrapper<S, StatePayload4Byte>.Create(eventName, onReceiveCallback), 
				Size.State8Byte => ReplicatorPayloadWrapper<S, StatePayload8Byte>.Create(eventName, onReceiveCallback), 
				Size.State16Byte => ReplicatorPayloadWrapper<S, StatePayload16Byte>.Create(eventName, onReceiveCallback), 
				Size.State32Byte => ReplicatorPayloadWrapper<S, StatePayload32Byte>.Create(eventName, onReceiveCallback), 
				Size.State48Byte => ReplicatorPayloadWrapper<S, StatePayload48Byte>.Create(eventName, onReceiveCallback), 
				Size.State64Byte => ReplicatorPayloadWrapper<S, StatePayload64Byte>.Create(eventName, onReceiveCallback), 
				Size.State80Byte => ReplicatorPayloadWrapper<S, StatePayload80Byte>.Create(eventName, onReceiveCallback), 
				Size.State96Byte => ReplicatorPayloadWrapper<S, StatePayload96Byte>.Create(eventName, onReceiveCallback), 
				Size.State128Byte => ReplicatorPayloadWrapper<S, StatePayload128Byte>.Create(eventName, onReceiveCallback), 
				Size.State196Byte => ReplicatorPayloadWrapper<S, StatePayload196Byte>.Create(eventName, onReceiveCallback), 
				Size.State256Byte => ReplicatorPayloadWrapper<S, StatePayload256Byte>.Create(eventName, onReceiveCallback), 
				_ => null, 
			};
		}

		public static S Get<S>(byte[] bytes, int bytesLength) where S : struct
		{
			int num = Marshal.SizeOf(typeof(S));
			if (num > bytesLength)
			{
				throw new ArgumentException($"StateData Exceed size of {bytesLength} : Unable to Deserialize", "S");
			}
			IntPtr intPtr = Marshal.AllocHGlobal(num);
			Marshal.Copy(bytes, 0, intPtr, num);
			S result = (S)Marshal.PtrToStructure(intPtr, typeof(S));
			Marshal.FreeHGlobal(intPtr);
			return result;
		}

		public static void Set<S>(S stateData, int size, ref byte[] payloadBytes) where S : struct
		{
			if (Marshal.SizeOf(stateData) > size)
			{
				throw new ArgumentException($"StateData Exceed size of {size} : Unable to Serialize", "S");
			}
			byte[] array = new byte[size];
			IntPtr intPtr = Marshal.AllocHGlobal(size);
			Marshal.StructureToPtr(stateData, intPtr, fDeleteOld: false);
			Marshal.Copy(intPtr, array, 0, size);
			Marshal.FreeHGlobal(intPtr);
			payloadBytes = array;
		}
	}
	public interface IReplicatorEvent<S> where S : struct
	{
		string Name { get; }

		bool IsRegistered { get; }

		void Invoke(uint replicatorID, S data);

		void Invoke(uint replicatorID, S data, SNet_ChannelType channelType);

		void Invoke(uint replicatorID, S data, SNet_Player target);

		void Invoke(uint replicatorID, S data, SNet_Player target, SNet_ChannelType channelType);
	}
	public class ReplicatorPayloadWrapper<S, P> : IReplicatorEvent<S> where S : struct where P : struct, IStatePayload
	{
		public string Name { get; private set; }

		public bool IsRegistered { get; private set; }

		public static IReplicatorEvent<S> Create(string eventName, OnReceiveDel<S> onReceiveCallback)
		{
			ReplicatorPayloadWrapper<S, P> replicatorPayloadWrapper = new ReplicatorPayloadWrapper<S, P>();
			replicatorPayloadWrapper.Register(eventName, onReceiveCallback);
			if (!replicatorPayloadWrapper.IsRegistered)
			{
				return null;
			}
			return replicatorPayloadWrapper;
		}

		public void Register(string eventName, OnReceiveDel<S> onReceiveCallback)
		{
			if (!IsRegistered && !NetworkAPI.IsEventRegistered(eventName))
			{
				NetworkAPI.RegisterEvent<P>(eventName, (Action<ulong, P>)delegate(ulong sender, P payload)
				{
					onReceiveCallback?.Invoke(sender, payload.ID, payload.Get<S>());
				});
				IsRegistered = true;
				Name = eventName;
			}
		}

		public void Invoke(uint replicatorID, S data)
		{
			P val = new P
			{
				ID = replicatorID
			};
			val.Set(data);
			NetworkAPI.InvokeEvent<P>(Name, val, (SNet_ChannelType)2);
		}

		public void Invoke(uint replicatorID, S data, SNet_ChannelType channelType)
		{
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			P val = new P
			{
				ID = replicatorID
			};
			val.Set(data);
			NetworkAPI.InvokeEvent<P>(Name, val, channelType);
		}

		public void Invoke(uint replicatorID, S data, SNet_Player target)
		{
			P val = new P
			{
				ID = replicatorID
			};
			val.Set(data);
			NetworkAPI.InvokeEvent<P>(Name, val, target, (SNet_ChannelType)2);
		}

		public void Invoke(uint replicatorID, S data, SNet_Player target, SNet_ChannelType channelType)
		{
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			P val = new P
			{
				ID = replicatorID
			};
			val.Set(data);
			NetworkAPI.InvokeEvent<P>(Name, val, target, channelType);
		}
	}
	public interface IStatePayload
	{
		uint ID { get; set; }

		S Get<S>() where S : struct;

		void Set<S>(S stateData) where S : struct;
	}
	public struct StatePayload4Byte : IStatePayload
	{
		public const int Size = 4;

		private uint id;

		[MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)]
		public byte[] PayloadBytes;

		public uint ID
		{
			get
			{
				return id;
			}
			set
			{
				id = value;
			}
		}

		public S Get<S>() where S : struct
		{
			return StatePayloads.Get<S>(PayloadBytes, 4);
		}

		public void Set<S>(S stateData) where S : struct
		{
			StatePayloads.Set(stateData, 4, ref PayloadBytes);
		}
	}
	public struct StatePayload8Byte : IStatePayload
	{
		public const int Size = 8;

		[MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)]
		public byte[] PayloadBytes;

		[field: MarshalAs(UnmanagedType.U4)]
		public uint ID { get; set; }

		public S Get<S>() where S : struct
		{
			return StatePayloads.Get<S>(PayloadBytes, 8);
		}

		public void Set<S>(S stateData) where S : struct
		{
			StatePayloads.Set(stateData, 8, ref PayloadBytes);
		}
	}
	public struct StatePayload16Byte : IStatePayload
	{
		public const int Size = 16;

		[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
		public byte[] PayloadBytes;

		[field: MarshalAs(UnmanagedType.U4)]
		public uint ID { get; set; }

		public S Get<S>() where S : struct
		{
			return StatePayloads.Get<S>(PayloadBytes, 16);
		}

		public void Set<S>(S stateData) where S : struct
		{
			StatePayloads.Set(stateData, 16, ref PayloadBytes);
		}
	}
	public struct StatePayload32Byte : IStatePayload
	{
		public const int Size = 32;

		[MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)]
		public byte[] PayloadBytes;

		[field: MarshalAs(UnmanagedType.U4)]
		public uint ID { get; set; }

		public S Get<S>() where S : struct
		{
			return StatePayloads.Get<S>(PayloadBytes, 32);
		}

		public void Set<S>(S stateData) where S : struct
		{
			StatePayloads.Set(stateData, 32, ref PayloadBytes);
		}
	}
	public struct StatePayload48Byte : IStatePayload
	{
		public const int Size = 48;

		[MarshalAs(UnmanagedType.ByValArray, SizeConst = 48)]
		public byte[] PayloadBytes;

		[field: MarshalAs(UnmanagedType.U4)]
		public uint ID { get; set; }

		public S Get<S>() where S : struct
		{
			return StatePayloads.Get<S>(PayloadBytes, 48);
		}

		public void Set<S>(S stateData) where S : struct
		{
			StatePayloads.Set(stateData, 48, ref PayloadBytes);
		}
	}
	public struct StatePayload64Byte : IStatePayload
	{
		public const int Size = 64;

		[MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)]
		public byte[] PayloadBytes;

		[field: MarshalAs(UnmanagedType.U4)]
		public uint ID { get; set; }

		public S Get<S>() where S : struct
		{
			return StatePayloads.Get<S>(PayloadBytes, 64);
		}

		public void Set<S>(S stateData) where S : struct
		{
			StatePayloads.Set(stateData, 64, ref PayloadBytes);
		}
	}
	public struct StatePayload80Byte : IStatePayload
	{
		public const int Size = 80;

		[MarshalAs(UnmanagedType.ByValArray, SizeConst = 80)]
		public byte[] PayloadBytes;

		[field: MarshalAs(UnmanagedType.U4)]
		public uint ID { get; set; }

		public S Get<S>() where S : struct
		{
			return StatePayloads.Get<S>(PayloadBytes, 80);
		}

		public void Set<S>(S stateData) where S : struct
		{
			StatePayloads.Set(stateData, 80, ref PayloadBytes);
		}
	}
	public struct StatePayload96Byte : IStatePayload
	{
		public const int Size = 96;

		[MarshalAs(UnmanagedType.ByValArray, SizeConst = 96)]
		public byte[] PayloadBytes;

		[field: MarshalAs(UnmanagedType.U4)]
		public uint ID { get; set; }

		public S Get<S>() where S : struct
		{
			return StatePayloads.Get<S>(PayloadBytes, 96);
		}

		public void Set<S>(S stateData) where S : struct
		{
			StatePayloads.Set(stateData, 96, ref PayloadBytes);
		}
	}
	public struct StatePayload128Byte : IStatePayload
	{
		public const int Size = 128;

		[MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)]
		public byte[] PayloadBytes;

		[field: MarshalAs(UnmanagedType.U4)]
		public uint ID { get; set; }

		public S Get<S>() where S : struct
		{
			return StatePayloads.Get<S>(PayloadBytes, 128);
		}

		public void Set<S>(S stateData) where S : struct
		{
			StatePayloads.Set(stateData, 128, ref PayloadBytes);
		}
	}
	public struct StatePayload196Byte : IStatePayload
	{
		public const int Size = 196;

		[MarshalAs(UnmanagedType.ByValArray, SizeConst = 196)]
		public byte[] PayloadBytes;

		[field: MarshalAs(UnmanagedType.U4)]
		public uint ID { get; set; }

		public S Get<S>() where S : struct
		{
			return StatePayloads.Get<S>(PayloadBytes, 196);
		}

		public void Set<S>(S stateData) where S : struct
		{
			StatePayloads.Set(stateData, 196, ref PayloadBytes);
		}
	}
	public struct StatePayload256Byte : IStatePayload
	{
		public const int Size = 256;

		[MarshalAs(UnmanagedType.ByValArray, SizeConst = 256)]
		public byte[] PayloadBytes;

		[field: MarshalAs(UnmanagedType.U4)]
		public uint ID { get; set; }

		public S Get<S>() where S : struct
		{
			return StatePayloads.Get<S>(PayloadBytes, 256);
		}

		public void Set<S>(S stateData) where S : struct
		{
			StatePayloads.Set(stateData, 256, ref PayloadBytes);
		}
	}
	public enum LifeTimeType
	{
		Forever,
		Level
	}
	public sealed class StateReplicator<S> where S : struct
	{
		private readonly Dictionary<eBufferType, S> _RecallStateSnapshots = new Dictionary<eBufferType, S>();

		public static readonly string Name;

		public static readonly string HashName;

		public static readonly string ClientRequestEventName;

		public static readonly string HostSetStateEventName;

		public static readonly string HostSetRecallStateEventName;

		public static readonly int StateSize;

		public static readonly StatePayloads.Size StateSizeType;

		private static readonly IReplicatorEvent<S> _C_RequestEvent;

		private static readonly IReplicatorEvent<S> _H_SetStateEvent;

		private static readonly IReplicatorEvent<S> _H_SetRecallStateEvent;

		private static readonly ReplicatorHandshake _Handshake;

		private static readonly Dictionary<uint, StateReplicator<S>> _Replicators;

		public bool IsValid => ID != 0;

		public bool IsInvalid => ID == 0;

		public uint ID { get; private set; }

		public LifeTimeType LifeTime { get; private set; }

		public IStateReplicatorHolder<S> Holder { get; private set; }

		public S State { get; private set; }

		public bool ClientSendStateAllowed { get; set; } = true;


		public bool CanSendToClient
		{
			get
			{
				if (SNet.IsInLobby)
				{
					return SNet.IsMaster;
				}
				return false;
			}
		}

		public bool CanSendToHost
		{
			get
			{
				if (SNet.IsInLobby && !SNet.IsMaster && SNet.HasMaster)
				{
					return ClientSendStateAllowed;
				}
				return false;
			}
		}

		public bool IsHandshakeSetup { get; private set; }

		public event Action<S, S, bool> OnStateChanged;

		public void SetupHandshake()
		{
			if (!IsInvalid && !IsHandshakeSetup)
			{
				_Handshake.UpdateCreated(ID);
				IsHandshakeSetup = true;
			}
		}

		public void SetState(S state)
		{
			if (!IsInvalid)
			{
				DoSync(state);
			}
		}

		public void SetStateUnsynced(S state)
		{
			if (!IsInvalid)
			{
				State = state;
			}
		}

		public void Unload()
		{
			if (IsValid)
			{
				_Replicators.Remove(ID);
				_RecallStateSnapshots.Clear();
				_Handshake.UpdateDestroyed(ID);
				IsHandshakeSetup = false;
				ID = 0u;
			}
		}

		private void DoSync(S newState)
		{
			if (!IsInvalid)
			{
				if (CanSendToClient)
				{
					_H_SetStateEvent.Invoke(ID, newState);
					Internal_ChangeState(newState, isRecall: false);
				}
				else if (CanSendToHost)
				{
					_C_RequestEvent.Invoke(ID, newState, SNet.Master);
				}
			}
		}

		private void Internal_ChangeState(S state, bool isRecall)
		{
			if (!IsInvalid)
			{
				S state2 = State;
				State = state;
				this.OnStateChanged?.Invoke(state2, state, isRecall);
				Holder?.OnStateChange(state2, state, isRecall);
			}
		}

		private void SendDropInState(SNet_Player target)
		{
			if (!IsInvalid)
			{
				if ((Object)(object)target == (Object)null)
				{
					Logger.Error("SendDropInState::Target was null??");
				}
				else
				{
					_H_SetRecallStateEvent.Invoke(ID, State, target);
				}
			}
		}

		public void ClearAllRecallSnapshot()
		{
			if (!IsInvalid)
			{
				_RecallStateSnapshots.Clear();
			}
		}

		private void SaveSnapshot(eBufferType type)
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			if (!IsInvalid)
			{
				_RecallStateSnapshots[type] = State;
			}
		}

		private void RestoreSnapshot(eBufferType type)
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Expected O, but got Unknown
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			if (IsInvalid || !CanSendToClient)
			{
				return;
			}
			if (_RecallStateSnapshots.TryGetValue(type, out var value))
			{
				_H_SetRecallStateEvent.Invoke(ID, value);
				Internal_ChangeState(value, isRecall: true);
				return;
			}
			bool flag = default(bool);
			BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(29, 2, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("RestoreSnapshot");
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("::There was no snapshot for ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<eBufferType>(type);
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("?");
			}
			Logger.Error(val);
		}

		static StateReplicator()
		{
			_Replicators = new Dictionary<uint, StateReplicator<S>>();
			Name = typeof(S).Name;
			StateSize = Marshal.SizeOf(typeof(S));
			StateSizeType = StatePayloads.GetSizeType(StateSize);
			using (MD5.Create())
			{
				HashName = UName.GetHash(typeof(S).FullName);
				ClientRequestEventName = "SRs" + Name + "-" + HashName;
				HostSetStateEventName = "SRr" + Name + "-" + HashName;
				HostSetRecallStateEventName = "SRre" + Name + "-" + HashName;
				_C_RequestEvent = StatePayloads.CreateEvent<S>(StateSizeType, ClientRequestEventName, ClientRequestEventCallback);
				_H_SetStateEvent = StatePayloads.CreateEvent<S>(StateSizeType, HostSetStateEventName, HostSetStateEventCallback);
				_H_SetRecallStateEvent = StatePayloads.CreateEvent<S>(StateSizeType, HostSetRecallStateEventName, HostSetRecallStateEventCallback);
				_Handshake = ReplicatorHandshake.Create(Name + "-" + HashName);
				_Handshake.OnClientSyncRequested += ClientSyncRequested;
				Inject_SNet_Capture.OnBufferCapture += BufferStored;
				Inject_SNet_Capture.OnBufferRecalled += BufferRecalled;
				LevelAPI.OnLevelCleanup += LevelCleanedUp;
			}
		}

		public static void Setup()
		{
		}

		private static void ClientSyncRequested(SNet_Player requestedPlayer)
		{
			foreach (StateReplicator<S> value in _Replicators.Values)
			{
				if (value.IsValid)
				{
					value.SendDropInState(requestedPlayer);
				}
			}
		}

		private static void BufferStored(eBufferType type)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			foreach (StateReplicator<S> value in _Replicators.Values)
			{
				if (value.IsValid)
				{
					value.SaveSnapshot(type);
				}
			}
		}

		private static void BufferRecalled(eBufferType type)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			foreach (StateReplicator<S> value in _Replicators.Values)
			{
				if (value.IsValid)
				{
					value.RestoreSnapshot(type);
				}
			}
		}

		private static void LevelCleanedUp()
		{
			UnloadSessionReplicator();
		}

		private StateReplicator()
		{
		}

		public static StateReplicator<S> Create(uint replicatorID, S startState, LifeTimeType lifeTime, IStateReplicatorHolder<S> owner = null)
		{
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Expected O, but got Unknown
			if (replicatorID == 0)
			{
				Logger.Error("Replicator ID 0 is reserved for empty!");
				return null;
			}
			if (_Replicators.ContainsKey(replicatorID))
			{
				Logger.Error("Replicator ID has already assigned!");
				return null;
			}
			StateReplicator<S> stateReplicator = new StateReplicator<S>
			{
				ID = replicatorID,
				LifeTime = lifeTime,
				Holder = owner,
				State = startState
			};
			switch (lifeTime)
			{
			case LifeTimeType.Forever:
				stateReplicator.IsHandshakeSetup = true;
				break;
			case LifeTimeType.Level:
				stateReplicator.SetupHandshake();
				break;
			default:
			{
				bool flag = default(bool);
				BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(22, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("LifeTime is invalid!: ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<LifeTimeType>(lifeTime);
				}
				Logger.Error(val);
				return null;
			}
			}
			_Replicators[replicatorID] = stateReplicator;
			return stateReplicator;
		}

		public static void UnloadSessionReplicator()
		{
			List<uint> list = new List<uint>();
			foreach (StateReplicator<S> value in _Replicators.Values)
			{
				if (value.LifeTime == LifeTimeType.Level)
				{
					list.Add(value.ID);
					value.Unload();
				}
			}
			foreach (uint item in list)
			{
				_Replicators.Remove(item);
			}
			_Handshake.Reset();
		}

		private static void ClientRequestEventCallback(ulong sender, uint replicatorID, S newState)
		{
			if (SNet.IsMaster && _Replicators.TryGetValue(replicatorID, out var value))
			{
				value.SetState(newState);
			}
		}

		private static void HostSetStateEventCallback(ulong sender, uint replicatorID, S newState)
		{
			if (SNet.HasMaster && SNet.Master.Lookup == sender && _Replicators.TryGetValue(replicatorID, out var value))
			{
				value.Internal_ChangeState(newState, isRecall: false);
			}
		}

		private static void HostSetRecallStateEventCallback(ulong sender, uint replicatorID, S newState)
		{
			if (SNet.HasMaster && SNet.Master.Lookup == sender && _Replicators.TryGetValue(replicatorID, out var value))
			{
				value.Internal_ChangeState(newState, isRecall: true);
			}
		}
	}
}
namespace FloLib.Networks.PayloadStructs
{
	public struct PL_Agent
	{
		public ushort AgentID;

		public PL_Agent()
		{
			AgentID = 0;
		}

		public PL_Agent(Agent agent)
		{
			AgentID = agent.GlobalID;
		}

		public void Set(Agent agent)
		{
			AgentID = agent.GlobalID;
		}

		public bool TryGet(out Agent agent)
		{
			IReplicator val = default(IReplicator);
			if (!SNet_Replication.TryGetReplicator(AgentID, ref val))
			{
				agent = null;
				return false;
			}
			if (val == null)
			{
				agent = null;
				return false;
			}
			if (val.ReplicatorSupplier == null)
			{
				agent = null;
				return false;
			}
			MonoBehaviour val2 = ((Il2CppObjectBase)val.ReplicatorSupplier).TryCast<MonoBehaviour>();
			if ((Object)(object)val2 == (Object)null)
			{
				agent = null;
				return false;
			}
			agent = ((Component)val2).GetComponent<Agent>();
			return (Object)(object)agent != (Object)null;
		}
	}
}
namespace FloLib.Networks.Inject
{
	[HarmonyPatch(typeof(SNet_Capture))]
	internal static class Inject_SNet_Capture
	{
		public static event Action<eBufferType> OnBufferCapture;

		public static event Action<eBufferType> OnBufferRecalled;

		[HarmonyPatch("TriggerCapture")]
		[HarmonyPrefix]
		private static void Pre_TriggerCapture(SNet_Capture __instance)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: 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)
			eBufferType primedBufferType = __instance.PrimedBufferType;
			Inject_SNet_Capture.OnBufferCapture?.Invoke(primedBufferType);
		}

		[HarmonyPatch("RecallBuffer")]
		[HarmonyPostfix]
		[HarmonyWrapSafe]
		private static void Post_RecallBuffer(SNet_Capture __instance, eBufferType bufferType)
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			if (!__instance.IsRecalling)
			{
				Inject_SNet_Capture.OnBufferRecalled?.Invoke(bufferType);
			}
		}
	}
}
namespace FloLib.Infos
{
	public sealed class ComponentList<T> : IEnumerable<T>, IEnumerable where T : Component
	{
		private readonly List<T> _InternalList = new List<T>();

		private T[] _ArrayCache = Array.Empty<T>();

		public T[] Items => _ArrayCache;

		internal void Add(T itemToAdd)
		{
			int id = ((Object)(object)itemToAdd).GetInstanceID();
			if (!_InternalList.Any((T t) => ((Object)(object)t).GetInstanceID() == id))
			{
				_InternalList.Add(itemToAdd);
				_ArrayCache = _InternalList.ToArray();
			}
		}

		internal void AddRange(IEnumerable<T> itemsToAdd)
		{
			foreach (T item in itemsToAdd)
			{
				Add(item);
			}
		}

		internal void Remove(T itemToRemove)
		{
			int id = ((Object)(object)itemToRemove).GetInstanceID();
			int num = _InternalList.FindIndex((T i) => ((Object)(object)i).GetInstanceID() == id);
			if (num > -1)
			{
				_InternalList.RemoveAt(num);
				_ArrayCache = _InternalList.ToArray();
			}
		}

		internal void Clear()
		{
			_InternalList.Clear();
			_ArrayCache = Array.Empty<T>();
		}

		public IEnumerator<T> GetEnumerator()
		{
			return _InternalList.GetEnumerator();
		}

		IEnumerator IEnumerable.GetEnumerator()
		{
			return _InternalList.GetEnumerator();
		}
	}
	public static class LG_LightInfo
	{
		public struct Data
		{
			public float PrefabIntensity;

			public LightMode SpawnedMode;

			public float SpawnedIntensity;

			public Color SpawnedColor;
		}

		public static bool TryGetLightData(LG_Light light, out Data data)
		{
			if ((Object)(object)light == (Object)null)
			{
				data = default(Data);
				return false;
			}
			if (!((Component)(object)light).TryGetComp<LightData>(out var component))
			{
				data = default(Data);
				return false;
			}
			data = component.CreateData();
			return true;
		}

		public static void RevertToSpawnedState(LG_Light light)
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)light == (Object)null) && ((Component)(object)light).TryGetComp<LightData>(out var component))
			{
				light.ChangeColor(component.SpawnedColor);
				light.ChangeIntensity(component.SpawnedIntensity);
			}
		}
	}
	public enum LightMode
	{
		Off,
		On,
		Broken_Flickering
	}
	public static class LG_Objects
	{
		public static ComponentList<LG_SecurityDoor> SecurityDoors { get; private set; } = new ComponentList<LG_SecurityDoor>();


		public static ComponentList<LG_WeakDoor> WeakDoors { get; private set; } = new ComponentList<LG_WeakDoor>();


		public static ComponentList<LG_Light> Lights { get; private set; } = new ComponentList<LG_Light>();


		public static ComponentList<LG_ComputerTerminal> Terminals { get; private set; } = new ComponentList<LG_ComputerTerminal>();


		public static ComponentList<LG_LabDisplay> LabDisplays { get; private set; } = new ComponentList<LG_LabDisplay>();


		public static ComponentList<LG_DoorButton> DoorButtons { get; private set; } = new ComponentList<LG_DoorButton>();


		public static ComponentList<LG_WeakLock> WeakLocks { get; private set; } = new ComponentList<LG_WeakLock>();


		public static ComponentList<LG_HSUActivator_Core> HSUActivators { get; private set; } = new ComponentList<LG_HSUActivator_Core>();


		public static ComponentList<CarryItemPickup_Core> CarryItems { get; private set; } = new ComponentList<CarryItemPickup_Core>();


		public static ComponentList<GenericSmallPickupItem_Core> PickupItems { get; private set; } = new ComponentList<GenericSmallPickupItem_Core>();


		public static ComponentList<LG_Ladder> Ladders { get; private set; } = new ComponentList<LG_Ladder>();


		public static ComponentList<LG_WardenObjective_Reactor> Reactors { get; private set; } = new ComponentList<LG_WardenObjective_Reactor>();


		public static ComponentList<LG_PowerGeneratorCluster> GeneratorClusters { get; private set; } = new ComponentList<LG_PowerGeneratorCluster>();


		public static ComponentList<LG_PowerGenerator_Core> Generators { get; private set; } = new ComponentList<LG_PowerGenerator_Core>();


		[AutoInvoke(InvokeWhen.PluginLoaded)]
		internal static void Init()
		{
			LevelAPI.OnLevelCleanup += OnLevelCleanup;
		}

		private static void OnLevelCleanup()
		{
			SecurityDoors.Clear();
			WeakDoors.Clear();
			Lights.Clear();
			Terminals.Clear();
			LabDisplays.Clear();
			DoorButtons.Clear();
			WeakLocks.Clear();
			HSUActivators.Clear();
			CarryItems.Clear();
			PickupItems.Clear();
			Ladders.Clear();
			Reactors.Clear();
			GeneratorClusters.Clear();
			Generators.Clear();
		}

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

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

		public static LG_SecurityDoor FindSecurityDoor(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 FindSecurityDoor((eDimensionIndex)0, layer, localindex);
		}

		public static LG_SecurityDoor FindSecurityDoor(eDimensionIndex dim, LG_LayerType layer, eLocalZoneIndex localindex)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//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)
			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 class LocalPlayer
	{
		private static int? _InstanceID;

		public static bool HasAgent { get; private set; }

		public static PlayerAgent Agent { get; private set; }

		public static LocalPlayerAgent LocalAgent { get; private set; }

		public static bool TryGetAgent(out PlayerAgent agent)
		{
			agent = Agent;
			return HasAgent;
		}

		public static bool TryGetLocalAgent(out LocalPlayerAgent agent)
		{
			agent = LocalAgent;
			return HasAgent;
		}

		public static Vector3 GetPosition()
		{
			//IL_0012: 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)
			if (HasAgent)
			{
				return ((Agent)Agent).Position;
			}
			return Vector3.zero;
		}

		public static Vector3 GetPosition(Vector3 fallback)
		{
			//IL_0012: 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)
			if (HasAgent)
			{
				return ((Agent)Agent).Position;
			}
			return fallback;
		}

		public static Vector3 GetEyePosition()
		{
			//IL_0012: 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)
			if (HasAgent)
			{
				return ((Agent)Agent).EyePosition;
			}
			return Vector3.zero;
		}

		public static Vector3 GetEyePosition(Vector3 fallback)
		{
			//IL_0012: 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)
			if (HasAgent)
			{
				return ((Agent)Agent).EyePosition;
			}
			return fallback;
		}

		[AutoInvoke(InvokeWhen.StartupAssetLoaded)]
		internal static void Init()
		{
			Coroutines.Start(UpdatePlayerInfo());
		}

		private static IEnumerator UpdatePlayerInfo()
		{
			while (true)
			{
				if (PlayerManager.HasLocalPlayerAgent())
				{
					PlayerAgent localPlayerAgent = PlayerManager.GetLocalPlayerAgent();
					int instanceID = ((Object)localPlayerAgent).GetInstanceID();
					if (!_InstanceID.HasValue || _InstanceID.Value != instanceID)
					{
						Agent = localPlayerAgent;
						LocalAgent = ((Il2CppObjectBase)localPlayerAgent).Cast<LocalPlayerAgent>();
						_InstanceID = ((Object)localPlayerAgent).GetInstanceID();
						HasAgent = true;
					}
				}
				else
				{
					Agent = null;
					LocalAgent = null;
					_InstanceID = null;
					HasAgent = false;
				}
				yield return null;
			}
		}
	}
}
namespace FloLib.Infos.Inject
{
	[HarmonyPatch(typeof(Builder), "BuildDone")]
	internal static class Inject_Builder
	{
		[HarmonyPriority(800)]
		private static void Postfix()
		{
			LG_Objects.Terminals.AddRange(Find<LG_ComputerTerminal>());
			LG_Objects.LabDisplays.AddRange(Find<LG_LabDisplay>());
			LG_Objects.DoorButtons.AddRange(Find<LG_DoorButton>());
			LG_Objects.WeakLocks.AddRange(Find<LG_WeakLock>());
			LG_Objects.HSUActivators.AddRange(Find<LG_HSUActivator_Core>());
			LG_Objects.CarryItems.AddRange(Find<CarryItemPickup_Core>());
			LG_Objects.PickupItems.AddRange(Find<GenericSmallPickupItem_Core>());
			LG_Objects.Ladders.AddRange(Find<LG_Ladder>());
			LG_Objects.Reactors.AddRange(Find<LG_WardenObjective_Reactor>());
			LG_Objects.GeneratorClusters.AddRange(Find<LG_PowerGeneratorCluster>());
			LG_Objects.Generators.AddRange(Find<LG_PowerGenerator_Core>());
		}

		private static IEnumerable<T> Find<T>() where T : Object
		{
			return LG_Objects.FindObjectsInLevel<T>();
		}
	}
	[HarmonyPatch(typeof(LG_BuildZoneLightsJob), "Build")]
	internal static class Inject_LG_LightBuild
	{
		[HarmonyPriority(0)]
		private static void Prefix(LG_BuildZoneLightsJob __instance, out List<LG_Light> __state)
		{
			__state = new List<LG_Light>();
			Enumerator<AIG_CourseNode> enumerator = __instance.m_zone.m_courseNodes.GetEnumerator();
			while (enumerator.MoveNext())
			{
				foreach (LG_Light componentsInChild in ((Component)enumerator.Current.m_area).GetComponentsInChildren<LG_Light>())
				{
					LightData lightData = ((Component)componentsInChild).gameObject.AddComponent<LightData>();
					LG_PointLight result2;
					if (((Il2CppObjectBase)(object)componentsInChild).TryCastToType<LG_SpotLight>(out LG_SpotLight result))
					{
						lightData.PrefabIntensity.Set(result.m_spotLight.intensity);
					}
					else if (((Il2CppObjectBase)(object)componentsInChild).TryCastToType<LG_PointLight>(out result2))
					{
						lightData.PrefabIntensity.Set(result2.m_pointLight.intensity);
					}
					else
					{
						if (!((Il2CppObjectBase)(object)componentsInChild).TryCastToType<LG_SpotLightAmbient>(out LG_SpotLightAmbient result3))
						{
							continue;
						}
						lightData.PrefabIntensity.Set(result3.m_spotLight.intensity);
					}
					__state.Add(componentsInChild);
				}
			}
			LG_Objects.Lights.AddRange(__state);
		}

		[HarmonyPriority(0)]
		private static void Postfix(List<LG_Light> __state)
		{
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Expected O, but got Unknown
			bool flag = default(bool);
			foreach (LG_Light item in __state)
			{
				LightData component = ((Component)item).GetComponent<LightData>();
				if ((Object)(object)component == (Object)null)
				{
					BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(32, 2, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Found Light without ");
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("LightData");
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" Component! ");
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(((Component)(object)item).GetGameObjectPath());
					}
					Logger.Error(val);
				}
				else
				{
					component.SpawnedIntensity = item.m_intensity;
					component.SpawnedColor = item.m_color;
					component.SpawnedMode = GetLightMode(item);
				}
			}
			__state.Clear();
		}

		private static LightMode GetLightMode(LG_Light light)
		{
			if (light.GetC_Light().LightUpdator != null)
			{
				return LightMode.Broken_Flickering;
			}
			if (((Component)light).gameObject.active)
			{
				return LightMode.On;
			}
			return LightMode.Off;
		}
	}
	[HarmonyPatch(typeof(LG_SecurityDoor), "Setup")]
	internal static class Inject_LG_SecDoor
	{
		private static void Postfix(LG_SecurityDoor __instance)
		{
			LG_Objects.SecurityDoors.Add(__instance);
		}
	}
	[HarmonyPatch(typeof(LG_WeakDoor), "Setup")]
	internal static class Inject_LG_WeakDoor
	{
		private static void Postfix(LG_WeakDoor __instance)
		{
			LG_Objects.WeakDoors.Add(__instance);
		}
	}
}
namespace FloLib.Infos.Comps
{
	[AutoInject]
	internal sealed class LightData : MonoBehaviour
	{
		public Il2CppValueField<float> PrefabIntensity;

		public LightMode SpawnedMode;

		public float SpawnedIntensity;

		public Color SpawnedColor;

		public LG_LightInfo.Data CreateData()
		{
			//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)
			LG_LightInfo.Data result = default(LG_LightInfo.Data);
			result.PrefabIntensity = Il2CppValueField<float>.op_Implicit(PrefabIntensity);
			result.SpawnedMode = SpawnedMode;
			result.SpawnedIntensity = SpawnedIntensity;
			result.SpawnedColor = SpawnedColor;
			return result;
		}
	}
}
namespace FloLib.Game.ScreenShakes
{
	public sealed class ScreenShake
	{
		[AutoInvoke(InvokeWhen.StartupAssetLoaded)]
		internal static void Init()
		{
			GlobalNetAction<ScreenShakeDescriptor>.OnReceive += OnReceive;
		}

		public static void Trigger(ScreenShakeDescriptor data)
		{
			GlobalNetAction<ScreenShakeDescriptor>.Send(data);
		}

		private static void OnReceive(ulong sender, ScreenShakeDescriptor data)
		{
			if (LocalPlayer.TryGetAgent(out var agent))
			{
				FPSCamera fPSCamera = agent.FPSCamera;
				MonoBehaviourExtensions.StartCoroutine((MonoBehaviour)(object)fPSCamera, DoShake(fPSCamera, data));
			}
		}

		private static IEnumerator DoShake(FPSCamera camera, ScreenShakeDescriptor data)
		{
			float time = 0f;
			while (time < data.Duration)
			{
				float num = 1f;
				if (data.Mode == ScreenShakeMode.PositionFalloff)
				{
					float num2 = Vector3.Distance(data.Position, camera.Position);
					num = Mathf.InverseLerp(data.FalloffEnd, data.FalloffStart, num2);
				}
				float t = data.Modifier switch
				{
					ScreenShakeModifier.PingPong => Mathf.PingPong(Mathf.InverseLerp(data.Duration, 0f, time) * 2f, 1f), 
					ScreenShakeModifier.Increase => Mathf.InverseLerp(0f, data.Duration, time), 
					ScreenShakeModifier.Decrease => Mathf.InverseLerp(data.Duration, 0f, time), 
					_ => 1f, 
				};
				t = data.IntensityEasing.Evaluate(t);
				float constantCameraShakeAmount = num * t * data.Intensity;
				camera.SetConstantCameraShakeAmount(constantCameraShakeAmount);
				time += Time.deltaTime;
				yield return null;
			}
			camera.SetConstantCameraShakeAmount(0f);
		}
	}
	public struct ScreenShakeDescriptor
	{
		public ScreenShakeMode Mode;

		public ScreenShakeModifier Modifier;

		public Vector3 Position;

		public float Intensity;

		public float Duration;

		public float FalloffStart;

		public float FalloffEnd;

		public EaseFunc.Type IntensityEasing;
	}
	public enum ScreenShakeMode : byte
	{
		Global,
		PositionFalloff
	}
	public enum ScreenShakeModifier : byte
	{
		PingPong,
		Increase,
		Decrease,
		Constant
	}
}
namespace FloLib.Game.Projectiles
{
	public sealed class Projectile
	{
		public readonly Transform Transform;

		public readonly Rigidbody RigidBody;

		public readonly ProjectileBehaviour Behaviour;

		private static readonly Dictionary<string, (Type behaviourType, GameObject prefab)> _Lookup = new Dictionary<string, (Type, GameObject)>();

		private Projectile(string id)
		{
			if (!_Lookup.TryGetValue(id, out (Type, GameObject) value))
			{
				throw new ArgumentOutOfRangeException("id", "Undefinied Projectile ID: '" + id + "'!");
			}
			GameObject val = Object.Instantiate<GameObject>(value.Item2);
			((Object)val).name = "ProjectileInstance__" + id;
			val.GetComponent<ProjectileWorker>().Setup(out Behaviour);
			RigidBody = val.GetComponent<Rigidbody>();
			Transform = val.transform;
		}

		public static void Spawn(string name)
		{
		}

		public static Projectile SpawnLocal(string name)
		{
			return new Projectile(name);
		}

		public static void BuildPrefab<B>(string id, string basePrefab) where B : ProjectileBehaviour
		{
		}

		internal static bool TryGetNewBehaviour(string id, out ProjectileBehaviour behaviour)
		{
			behaviour = null;
			return true;
		}
	}
	public class ProjectileBehaviour
	{
		internal ProjectileWorker _Worker;

		public float Speed { get; set; }

		public float Gravity { get; set; }

		public virtual void Setup()
		{
		}

		public virtual void OnCollision(Collision collision)
		{
		}

		public virtual void PhysicsUpdate()
		{
		}

		public virtual void OnDestroy()
		{
		}

		public void Destroy()
		{
			Object.Destroy((Object)(object)_Worker);
		}
	}
	public enum CollisionType
	{
		World,
		Player,
		Enemy
	}
	[AutoInject]
	internal sealed class ProjectileWorker : MonoBehaviour
	{
		internal Il2CppStringField BehaviourName;

		private ProjectileBehaviour _Behaviour;

		internal void Setup(out ProjectileBehaviour behaviour)
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Expected O, but got Unknown
			string text = BehaviourName.Get();
			if (!Projectile.TryGetNewBehaviour(text, out _Behaviour))
			{
				bool flag = default(bool);
				BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(64, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Unable to find Projectile Behaviour using name: '");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(text);
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("' Defaulting...");
				}
				Logger.Error(val);
			}
			_Behaviour.Setup();
			behaviour = _Behaviour;
		}

		private void OnCollisionEnter(Collision collision)
		{
			_Behaviour.OnCollision(collision);
		}

		private void FixedUpdate()
		{
			_Behaviour.PhysicsUpdate();
		}
	}
}
namespace FloLib.Game.Explosions
{
	public sealed class Explosion
	{
		public static readonly Color DefaultFlashColor = new Color(1f, 0.2f, 0f, 1f);

		[AutoInvoke(InvokeWhen.StartupAssetLoaded)]
		internal static void Init()
		{
			ExplosionEffectPooling.Initialize();
			GlobalNetAction<ExplosionDescriptor>.OnReceive += OnReceive;
		}

		private static void OnReceive(ulong sender, ExplosionDescriptor data)
		{
			Internal_TriggerExplosion(data);
		}

		public static void Trigger(ExplosionDescriptor data)
		{
			GlobalNetAction<ExplosionDescriptor>.Send(data);
		}

		internal static void Internal_TriggerExplosion(ExplosionDescriptor data)
		{
			//IL_0006: 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_0023: 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)
			CellSound.Post(EVENTS.STICKYMINEEXPLODE, data.Position);
			LightFlash(data.Position, data.MaxDamageRange, data.LightColor);
			if (!SNet.IsMaster)
			{
				return;
			}
			Il2CppReferenceArray<Collider> val = Physics.OverlapSphere(data.Position, data.MaxDamageRange, LayerManager.MASK_EXPLOSION_TARGETS);
			if (((Il2CppArrayBase<Collider>)(object)val).Count < 1)
			{
				return;
			}
			DamageUtil.IncrementSearchID();
			uint searchID = DamageUtil.SearchID;
			foreach (Collider item in (Il2CppArrayBase<Collider>)(object)val)
			{
				ProcessExplosion(data, item, searchID);
			}
		}

		private static void ProcessExplosion(ExplosionDescriptor data, Collider target, uint searchID)
		{
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: 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_0052: 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_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)target == (Object)null || (Object)(object)((Component)target).gameObject == (Object)null || !((Component)target).gameObject.TryGetComp<IDamageable>(out var component))
			{
				return;
			}
			component = component.GetBaseDamagable();
			if (component == null || component.TempSearchID == searchID)
			{
				return;
			}
			Vector3 damagablePosition = GetDamagablePosition(component);
			component.TempSearchID = searchID;
			float distance = Vector3.Distance(data.Position, damagablePosition);
			if (!IsExplosionBlocked(data.Position, damagablePosition, target))
			{
				float num = CalcBaseRangeDamage(data.MaxDamage, distance, data.MaxDamageRange, data.MinDamageRange);
				if ((Object)(object)((Il2CppObjectBase)component).TryCast<Dam_EnemyDamageBase>() != (Object)null)
				{
					num *= (float)data.DamageMultiplierToEnemy;
				}
				else if ((Object)(object)((Il2CppObjectBase)component).TryCast<Dam_PlayerDamageBase>() != (Object)null)
				{
					num *= (float)data.DamageMultiplierToPlayer;
				}
				Agent baseAgent = component.GetBaseAgent();
				if ((Object)(object)baseAgent != (Object)null && baseAgent.GlobalID == data.Inflictor.AgentID)
				{
					num *= (float)data.DamageMultiplierToInflictor;
				}
				if (Mathf.Abs(num) > float.Epsilon)
				{
					component.ExplosionDamage(num, data.Position, Vector3.up * 1000f);
				}
			}
		}

		private static Vector3 GetDamagablePosition(IDamageable damagable)
		{
			//IL_0018: 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)
			Agent baseAgent = damagable.GetBaseAgent();
			if ((Object)(object)baseAgent != (Object)null)
			{
				return baseAgent.EyePosition;
			}
			return damagable.DamageTargetPos;
		}

		private static bool IsExplosionBlocked(Vector3 pos1, Vector3 pos2, Collider targetCollider)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			RaycastHit val = default(RaycastHit);
			if (Physics.Linecast(pos1, pos2, ref val, LayerManager.MASK_EXPLOSION_BLOCKERS))
			{
				if ((Object)(object)((RaycastHit)(ref val)).collider == (Object)null)
				{
					return false;
				}
				if ((Object)(object)((Component)((RaycastHit)(ref val)).collider).gameObject == (Object)null)
				{
					return false;
				}
				if (((Object)((Component)((RaycastHit)(ref val)).collider).gameObject).GetInstanceID() != ((Object)((Component)targetCollider).gameObject).GetInstanceID())
				{
					return false;
				}
			}
			return true;
		}

		private static float CalcBaseRangeDamage(float damage, float distance, float minRange, float maxRange)
		{
			float result = 0f;
			if (distance <= minRange)
			{
				result = damage;
			}
			else if (distance <= maxRange)
			{
				result = Mathf.Lerp(damage, 0f, (distance - minRange) / (maxRange - minRange));
			}
			return result;
		}

		public static void LightFlash(Vector3 pos, float range, Color lightColor)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: 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_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: 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_0050: 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)
			ExplosionEffectData data = default(ExplosionEffectData);
			data.Position = pos;
			data.Color = lightColor;
			data.Intensity = 5f;
			data.Range = range;
			data.Duration = 0.05f;
			ExplosionEffectPooling.TryDoEffect(data);
			if (PlayerManager.HasLocalPlayerAgent())
			{
				Vector3 val = ((Agent)PlayerManager.GetLocalPlayerAgent()).Position - pos;
				float magnitude = ((Vector3)(ref val)).magnitude;
				float num = 6f * Mathf.Max(0f, Mathf.InverseLerp(range, 0f, magnitude));
				if (num > 0.01f

BepInEx/plugins/GTFO-API.dll

Decompiled 5 months ago
using System;
using System.CodeDom.Compiler;
using System.Collections;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Net.Http;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using System.Text.Json;
using System.Text.Json.Serialization;
using System.Text.RegularExpressions;
using AIGraph;
using AssetShards;
using BepInEx;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using BepInEx.Unity.IL2CPP.Hook;
using BepInEx.Unity.IL2CPP.Utils;
using GTFO.API.Attributes;
using GTFO.API.Components;
using GTFO.API.Extensions;
using GTFO.API.Impl;
using GTFO.API.JSON;
using GTFO.API.JSON.Converters;
using GTFO.API.Native;
using GTFO.API.Resources;
using GTFO.API.Utilities;
using GTFO.API.Utilities.Impl;
using GTFO.API.Wrappers;
using GameData;
using Gear;
using Globals;
using HarmonyLib;
using Il2CppInterop.Runtime;
using Il2CppInterop.Runtime.Attributes;
using Il2CppInterop.Runtime.Injection;
using Il2CppInterop.Runtime.InteropTypes;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppInterop.Runtime.Runtime;
using Il2CppInterop.Runtime.Runtime.VersionSpecific.Class;
using Il2CppSystem;
using Il2CppSystem.Collections.Generic;
using Il2CppSystem.Reflection;
using ItemSetup;
using LevelGeneration;
using Localization;
using Microsoft.CodeAnalysis;
using Player;
using SNetwork;
using UnityEngine;
using UnityEngine.Analytics;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("GTFO-API")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("0.4.1")]
[assembly: AssemblyInformationalVersion("0.4.1+git1e8fe81-main")]
[assembly: AssemblyProduct("GTFO-API")]
[assembly: AssemblyTitle("GTFO-API")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.4.1.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace GTFO.API
{
	internal static class APILogger
	{
		private static readonly ManualLogSource _logger;

		static APILogger()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Expected O, but got Unknown
			_logger = new ManualLogSource("GTFO-API");
			Logger.Sources.Add((ILogSource)(object)_logger);
		}

		private static string Format(string module, object msg)
		{
			return $"[{module}]: {msg}";
		}

		public static void Info(string module, object data)
		{
			_logger.LogMessage((object)Format(module, data));
		}

		public static void Verbose(string module, object data)
		{
		}

		public static void Debug(string module, object data)
		{
			_logger.LogDebug((object)Format(module, data));
		}

		public static void Warn(string module, object data)
		{
			_logger.LogWarning((object)Format(module, data));
		}

		public static void Error(string module, object data)
		{
			_logger.LogError((object)Format(module, data));
		}
	}
	[API("Asset")]
	public static class AssetAPI
	{
		internal static ConcurrentDictionary<string, Object> s_RegistryCache = new ConcurrentDictionary<string, Object>();

		public static ApiStatusInfo Status => APIStatus.Asset;

		public static event Action OnStartupAssetsLoaded;

		public static event Action OnAssetBundlesLoaded;

		public static event Action OnImplReady;

		public static bool ContainsAsset(string assetName)
		{
			string text = assetName.ToUpper();
			if (!APIStatus.Asset.Ready)
			{
				return s_RegistryCache.ContainsKey(text);
			}
			return AssetShardManager.s_loadedAssetsLookup.ContainsKey(text);
		}

		public static Object GetLoadedAsset(string path)
		{
			string text = path.ToUpper();
			APILogger.Verbose("Asset", "Requested Asset: " + text);
			try
			{
				if (!APIStatus.Asset.Ready && s_RegistryCache.TryGetValue(text, out var value))
				{
					return value;
				}
				return AssetShardManager.GetLoadedAsset(text, false);
			}
			catch
			{
				return null;
			}
		}

		public static TAsset GetLoadedAsset<TAsset>(string path) where TAsset : Object
		{
			Object loadedAsset = GetLoadedAsset(path);
			if (loadedAsset == null)
			{
				return default(TAsset);
			}
			return ((Il2CppObjectBase)loadedAsset).Cast<TAsset>();
		}

		public static void RegisterAsset(string name, Object gameObject)
		{
			string text = name.ToUpper();
			if (!APIStatus.Asset.Ready)
			{
				if (s_RegistryCache.ContainsKey(text))
				{
					throw new ArgumentException("The asset with " + text + " has already been registered.", "name");
				}
				s_RegistryCache.TryAdd(text, gameObject);
			}
			else
			{
				AssetAPI_Impl.Instance.RegisterAsset(text, gameObject);
			}
		}

		public static void RegisterAssetBundle(AssetBundle bundle)
		{
			string[] array = Il2CppArrayBase<string>.op_Implicit((Il2CppArrayBase<string>)(object)bundle.AllAssetNames());
			APILogger.Verbose("Asset", "Bundle names: [" + string.Join(", ", array) + "]");
			string[] array2 = array;
			foreach (string text in array2)
			{
				Object val = bundle.LoadAsset(text);
				if (val != (Object)null)
				{
					RegisterAsset(text, val);
				}
				else
				{
					APILogger.Warn("Asset", "Skipping asset " + text);
				}
			}
		}

		public static void LoadAndRegisterAssetBundle(string pathToBundle)
		{
			AssetBundle obj = AssetBundle.LoadFromFile(pathToBundle);
			if ((Object)(object)obj == (Object)null)
			{
				throw new Exception("Failed to load asset bundle");
			}
			RegisterAssetBundle(obj);
		}

		public static void LoadAndRegisterAssetBundle(byte[] bundleBytes)
		{
			AssetBundle obj = AssetBundle.LoadFromMemory(Il2CppStructArray<byte>.op_Implicit(bundleBytes));
			if ((Object)(object)obj == (Object)null)
			{
				throw new Exception("Failed to load asset bundle");
			}
			RegisterAssetBundle(obj);
		}

		public static Object InstantiateAsset(string assetName, string copyName)
		{
			if (ContainsAsset(copyName))
			{
				throw new ArgumentException("The asset you're trying to copy into is already registered", "copyName");
			}
			RegisterAsset(copyName, Object.Instantiate(GetLoadedAsset(assetName) ?? throw new ArgumentException("Couldn't find an asset with the name '" + assetName + "'", "assetName")));
			return GetLoadedAsset(copyName);
		}

		public static TAsset InstantiateAsset<TAsset>(string assetName, string copyName) where TAsset : Object
		{
			Object obj = InstantiateAsset(assetName, copyName);
			if (obj == null)
			{
				return default(TAsset);
			}
			return ((Il2CppObjectBase)obj).Cast<TAsset>();
		}

		public static bool TryInstantiateAsset<TAsset>(string assetName, string copyName, out TAsset clonedObj) where TAsset : Object
		{
			Object obj = InstantiateAsset(assetName, copyName);
			clonedObj = ((obj != null) ? ((Il2CppObjectBase)obj).TryCast<TAsset>() : default(TAsset));
			return (Object)(object)clonedObj != (Object)null;
		}

		private static void OnAssetsLoaded()
		{
			if (!APIStatus.Asset.Created)
			{
				APIStatus.CreateApi<AssetAPI_Impl>("Asset");
			}
			AssetAPI.OnStartupAssetsLoaded?.Invoke();
		}

		internal static void InvokeImplReady()
		{
			AssetAPI.OnImplReady?.Invoke();
		}

		internal static void Setup()
		{
			EventAPI.OnAssetsLoaded += OnAssetsLoaded;
			OnImplReady += LoadAssetBundles;
		}

		private static void LoadAssetBundles()
		{
			string assetBundlesDir = Path.Combine(Paths.BepInExRootPath, "Assets", "AssetBundles");
			string assetBundlesDir2 = Path.Combine(Paths.ConfigPath, "Assets", "AssetBundles");
			if (LoadAssetBundles(assetBundlesDir) | LoadAssetBundles(assetBundlesDir2, outdated: true))
			{
				AssetAPI.OnAssetBundlesLoaded?.Invoke();
			}
		}

		private static bool LoadAssetBundles(string assetBundlesDir, bool outdated = false)
		{
			if (outdated)
			{
				if (!Directory.Exists(assetBundlesDir))
				{
					return false;
				}
				APILogger.Warn("AssetAPI", "Storing asset bundles in the config path is deprecated and will be removed in a future version of GTFO-API. The path has been moved to 'BepInEx\\Assets\\AssetBundles'.");
			}
			if (!Directory.Exists(assetBundlesDir))
			{
				Directory.CreateDirectory(assetBundlesDir);
				return false;
			}
			string[] array = (from x in Directory.GetFiles(assetBundlesDir, "*", SearchOption.AllDirectories)
				where !x.EndsWith(".manifest", StringComparison.InvariantCultureIgnoreCase)
				select x).ToArray();
			if (array.Length == 0)
			{
				return false;
			}
			for (int i = 0; i < array.Length; i++)
			{
				try
				{
					LoadAndRegisterAssetBundle(array[i]);
				}
				catch (Exception ex)
				{
					APILogger.Warn("AssetAPI", $"Failed to load asset bundle '{array[i]}' ({ex.Message})");
				}
			}
			return true;
		}
	}
	[API("Event")]
	public static class EventAPI
	{
		public static ApiStatusInfo Status => APIStatus.Event;

		public static event Action OnManagersSetup;

		public static event Action OnExpeditionStarted;

		public static event Action OnAssetsLoaded;

		internal static void Setup()
		{
			Global.OnAllManagersSetup += Action.op_Implicit((Action)ManagersSetup);
			AssetShardManager.OnStartupAssetsLoaded += Action.op_Implicit((Action)AssetsLoaded);
			RundownManager.OnExpeditionGameplayStarted += Action.op_Implicit((Action)ExpeditionStarted);
		}

		private static void ManagersSetup()
		{
			EventAPI.OnManagersSetup?.Invoke();
		}

		private static void ExpeditionStarted()
		{
			EventAPI.OnExpeditionStarted?.Invoke();
		}

		private static void AssetsLoaded()
		{
			EventAPI.OnAssetsLoaded?.Invoke();
		}
	}
	[API("GameData")]
	public class GameDataAPI
	{
		public static ApiStatusInfo Status => APIStatus.GameData;

		public static event Action OnGameDataInitialized;

		static GameDataAPI()
		{
			Status.Created = true;
			Status.Ready = true;
		}

		internal static void InvokeGameDataInit()
		{
			GameDataAPI.OnGameDataInitialized?.Invoke();
		}
	}
	[API("Il2Cpp")]
	public static class Il2CppAPI
	{
		public static ApiStatusInfo Status => APIStatus.Il2Cpp;

		static Il2CppAPI()
		{
			Status.Created = true;
			Status.Ready = true;
		}

		public unsafe static void InjectWithInterface<T>() where T : Il2CppObjectBase
		{
			//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_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Expected O, but got Unknown
			List<INativeClassStruct> list = new List<INativeClassStruct>();
			foreach (Il2CppInterfaceAttribute item in GetCustomAttributesInType<T, Il2CppInterfaceAttribute>())
			{
				Il2CppClass* ptr = (Il2CppClass*)(void*)(IntPtr)typeof(Il2CppClassPointerStore<>).MakeGenericType(item.Type).GetField("NativeClassPtr").GetValue(null);
				IL2CPP.il2cpp_runtime_class_init((IntPtr)ptr);
				list.Add(UnityVersionHandler.Wrap(ptr));
			}
			RegisterTypeOptions val = new RegisterTypeOptions();
			val.set_LogSuccess(true);
			val.set_Interfaces(Il2CppInterfaceCollection.op_Implicit(list.ToArray()));
			ClassInjector.RegisterTypeInIl2Cpp<T>(val);
		}

		public unsafe static void* GetIl2CppMethod<T>(string methodName, string returnTypeName, bool isGeneric, params string[] argTypes) where T : Il2CppObjectBase
		{
			void** ptr = (void**)IL2CPP.GetIl2CppMethod(Il2CppClassPointerStore<T>.NativeClassPtr, isGeneric, methodName, returnTypeName, argTypes).ToPointer();
			if (ptr == null)
			{
				return ptr;
			}
			return *ptr;
		}

		public unsafe static TDelegate GetIl2CppMethod<T, TDelegate>(string methodName, string returnTypeName, bool isGeneric, params string[] argTypes) where T : Il2CppObjectBase where TDelegate : Delegate
		{
			void* il2CppMethod = GetIl2CppMethod<T>(methodName, returnTypeName, isGeneric, argTypes);
			if (il2CppMethod == null)
			{
				return null;
			}
			return Marshal.GetDelegateForFunctionPointer<TDelegate>((IntPtr)il2CppMethod);
		}

		public unsafe static INativeDetour CreateGenericDetour<TClass, TDelegate>(string methodName, string returnType, string[] paramTypes, Type[] genericArguments, TDelegate to, out TDelegate original) where TClass : Object where TDelegate : Delegate
		{
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			IntPtr nativeClassPtr = Il2CppClassPointerStore<TClass>.NativeClassPtr;
			if (nativeClassPtr == IntPtr.Zero)
			{
				throw new ArgumentException(typeof(TClass).Name + " does not exist in il2cpp domain");
			}
			return INativeDetour.CreateAndApply<TDelegate>(UnityVersionHandler.Wrap((Il2CppMethodInfo*)(void*)IL2CPP.il2cpp_method_get_from_reflection(((Il2CppObjectBase)new MethodInfo(IL2CPP.il2cpp_method_get_object(IL2CPP.GetIl2CppMethod(nativeClassPtr, true, methodName, returnType, paramTypes), nativeClassPtr)).MakeGenericMethod(((IEnumerable<Type>)genericArguments).Select((Func<Type, Type>)Il2CppType.From).ToArray())).Pointer)).MethodPointer, to, ref original);
		}

		private static IEnumerable<TAttribute> GetCustomAttributesInType<T, TAttribute>() where TAttribute : Attribute
		{
			Type attributeType = typeof(TAttribute);
			return typeof(T).GetCustomAttributes(attributeType, inherit: true).Union(typeof(T).GetInterfaces().SelectMany((Type interfaceType) => interfaceType.GetCustomAttributes(attributeType, inherit: true))).Distinct()
				.Cast<TAttribute>();
		}
	}
	public delegate void LevelDataUpdateEvent(ActiveExpedition activeExp, ExpeditionInTierData expData);
	public delegate void LevelSelectedEvent(eRundownTier expTier, int expIndexInTier, ExpeditionInTierData expData);
	[API("Level")]
	public static class LevelAPI
	{
		private static eRundownTier s_LatestExpTier = (eRundownTier)99;

		private static int s_LatestExpIndex = -1;

		public static ApiStatusInfo Status => APIStatus.Level;

		public static event LevelDataUpdateEvent OnLevelDataUpdated;

		public static event LevelSelectedEvent OnLevelSelected;

		public static event Action OnBuildStart;

		public static event Action OnBuildDone;

		public static event Action OnEnterLevel;

		public static event Action OnLevelCleanup;

		internal static void Setup()
		{
			Status.Created = true;
			Status.Ready = true;
			EventAPI.OnExpeditionStarted += EnterLevel;
		}

		internal static void ExpeditionUpdated(pActiveExpedition activeExp, ExpeditionInTierData expData)
		{
			//IL_0018: 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_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: 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)
			LevelAPI.OnLevelDataUpdated?.Invoke(ActiveExpedition.CreateFrom(activeExp), expData);
			eRundownTier tier = activeExp.tier;
			int expeditionIndex = activeExp.expeditionIndex;
			if (tier != s_LatestExpTier || expeditionIndex != s_LatestExpIndex)
			{
				LevelAPI.OnLevelSelected?.Invoke(tier, expeditionIndex, expData);
				s_LatestExpTier = tier;
				s_LatestExpIndex = expeditionIndex;
			}
		}

		internal static void BuildStart()
		{
			LevelAPI.OnBuildStart?.Invoke();
		}

		internal static void BuildDone()
		{
			LevelAPI.OnBuildDone?.Invoke();
		}

		internal static void EnterLevel()
		{
			LevelAPI.OnEnterLevel?.Invoke();
		}

		internal static void LevelCleanup()
		{
			LevelAPI.OnLevelCleanup?.Invoke();
		}
	}
	public struct ActiveExpedition
	{
		public pPlayer player;

		public eRundownKey rundownType;

		public string rundownKey;

		public eRundownTier tier;

		public int expeditionIndex;

		public int hostIDSeed;

		public int sessionSeed;

		public static ActiveExpedition CreateFrom(pActiveExpedition pActiveExp)
		{
			ActiveExpedition result = default(ActiveExpedition);
			result.CopyFrom(pActiveExp);
			return result;
		}

		public void CopyFrom(pActiveExpedition pActiveExp)
		{
			//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_000e: 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_002b: 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)
			player = pActiveExp.player;
			rundownType = pActiveExp.rundownType;
			rundownKey = pActiveExp.rundownKey.data;
			tier = pActiveExp.tier;
			expeditionIndex = pActiveExp.expeditionIndex;
			hostIDSeed = pActiveExp.hostIDSeed;
			sessionSeed = pActiveExp.sessionSeed;
		}
	}
	[API("Localization")]
	public static class LocalizationAPI
	{
		private sealed class Entry
		{
			private readonly string?[] m_ValuesByLanguage = new string[12];

			private TextDBOptions m_Options;

			public uint? TextBlockId { get; private set; }

			private bool TryGetStringInAnyLanguage([NotNullWhen(true)] out string? value)
			{
				for (int i = 0; i < m_ValuesByLanguage.Length; i++)
				{
					value = m_ValuesByLanguage[i];
					if (value != null)
					{
						return true;
					}
				}
				value = null;
				return false;
			}

			private bool TryGetStringInLanguage(Language language, [NotNullWhen(true)] out string? value)
			{
				//IL_0000: 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_0004: Expected I4, but got Unknown
				int num = language - 1;
				value = m_ValuesByLanguage[num];
				return value != null;
			}

			public bool TryGetString(Language language, FallbackValueOptions options, [NotNullWhen(true)] out string? value)
			{
				//IL_0001: 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)
				if (TryGetStringInLanguage(language, out value))
				{
					return true;
				}
				if (options.UseFallbackLanguage && TryGetStringInLanguage(options.FallbackLanguage.Value, out value))
				{
					return true;
				}
				if (options.UseAnyLanguage && TryGetStringInAnyLanguage(out value))
				{
					return true;
				}
				value = null;
				return false;
			}

			private string GetStringForTextDB(Language language, string key, FallbackValueOptions options)
			{
				//IL_0001: 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)
				if (TryGetString(language, options, out string value))
				{
					return value;
				}
				ValidateUseKey(key, language, options, "GenerateTextDB");
				return key;
			}

			[MemberNotNull("TextBlockId")]
			public void GenerateTextDataBlock(string key, TextDBOptions options, bool force = false)
			{
				m_Options = options;
				GenerateTextDataBlock(key, force);
			}

			[MemberNotNull("TextBlockId")]
			public void GenerateTextDataBlock(string key, bool force = false)
			{
				//IL_0038: Unknown result type (might be due to invalid IL or missing references)
				//IL_003d: 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_0069: Expected O, but got Unknown
				//IL_0069: Unknown result type (might be due to invalid IL or missing references)
				//IL_0070: Unknown result type (might be due to invalid IL or missing references)
				//IL_0077: Unknown result type (might be due to invalid IL or missing references)
				//IL_0082: 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_00a5: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
				//IL_00cd: 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_00f5: Unknown result type (might be due to invalid IL or missing references)
				//IL_0109: Unknown result type (might be due to invalid IL or missing references)
				//IL_011d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0132: Unknown result type (might be due to invalid IL or missing references)
				//IL_0147: Unknown result type (might be due to invalid IL or missing references)
				//IL_015c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0171: Unknown result type (might be due to invalid IL or missing references)
				//IL_0178: Expected O, but got Unknown
				//IL_0178: Unknown result type (might be due to invalid IL or missing references)
				//IL_017f: 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_018d: Expected O, but got Unknown
				//IL_018e: Expected O, but got Unknown
				if (!TextBlockId.HasValue || force)
				{
					FallbackValueOptions options = m_Options.FallbackOptions ?? FallbackValueOptions.AnyLangOrKey;
					TextDataBlock val = new TextDataBlock
					{
						CharacterMetaData = (m_Options.CharacterMetadataId ?? 1)
					};
					((GameDataBlockBase<TextDataBlock>)val).internalEnabled = true;
					val.ExportVersion = 1;
					val.ImportVersion = 1;
					val.Description = string.Empty;
					val.English = GetStringForTextDB((Language)1, key, options);
					val.French = LanguageData.op_Implicit(GetStringForTextDB((Language)2, key, options));
					val.Italian = LanguageData.op_Implicit(GetStringForTextDB((Language)3, key, options));
					val.German = LanguageData.op_Implicit(GetStringForTextDB((Language)4, key, options));
					val.Spanish = LanguageData.op_Implicit(GetStringForTextDB((Language)5, key, options));
					val.Russian = LanguageData.op_Implicit(GetStringForTextDB((Language)6, key, options));
					val.Portuguese_Brazil = LanguageData.op_Implicit(GetStringForTextDB((Language)7, key, options));
					val.Polish = LanguageData.op_Implicit(GetStringForTextDB((Language)8, key, options));
					val.Japanese = LanguageData.op_Implicit(GetStringForTextDB((Language)9, key, options));
					val.Korean = LanguageData.op_Implicit(GetStringForTextDB((Language)10, key, options));
					val.Chinese_Traditional = LanguageData.op_Implicit(GetStringForTextDB((Language)11, key, options));
					val.Chinese_Simplified = LanguageData.op_Implicit(GetStringForTextDB((Language)12, key, options));
					((GameDataBlockBase<TextDataBlock>)val).name = key;
					val.MachineTranslation = false;
					val.SkipLocalization = false;
					((GameDataBlockBase<TextDataBlock>)val).persistentID = 0u;
					TextDataBlock val2 = val;
					GameDataBlockBase<TextDataBlock>.AddBlock(val2, -1);
					TextBlockId = ((GameDataBlockBase<TextDataBlock>)(object)val2).persistentID;
				}
			}

			public bool TryGetString(Language language, string key, FallbackValueOptions options, out string? value)
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				if (TryGetString(language, options, out value))
				{
					return true;
				}
				if (options.UseKey)
				{
					value = key;
					return true;
				}
				value = null;
				return false;
			}

			public string GetString(Language language, string key, FallbackValueOptions options)
			{
				//IL_0001: 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)
				if (TryGetString(language, options, out string value))
				{
					return value;
				}
				ValidateUseKey(key, language, options, "GetString");
				return key;
			}

			public string FormatString(Language language, string key, FallbackValueOptions options, object?[] args)
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				//IL_0016: Unknown result type (might be due to invalid IL or missing references)
				if (TryGetString(language, options, out string value))
				{
					return string.Format(value, args);
				}
				ValidateUseKey(key, language, options, "FormatString");
				return key;
			}

			public bool HasValueInLanguage(Language language)
			{
				//IL_0000: 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_0013: Unknown result type (might be due to invalid IL or missing references)
				ValidateLanguage(language, "language");
				return m_ValuesByLanguage[language - 1] != null;
			}

			public void AddValue(Language language, string value, bool force = false)
			{
				//IL_000b: 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: Expected I4, but got Unknown
				//IL_006b: Unknown result type (might be due to invalid IL or missing references)
				ArgumentNullException.ThrowIfNull(value, "value");
				int num = language - 1;
				if (num < 0 || num >= m_ValuesByLanguage.Length)
				{
					throw new ArgumentOutOfRangeException("language");
				}
				ref string reference = ref m_ValuesByLanguage[num];
				if (reference != null && !force)
				{
					return;
				}
				reference = value;
				if (TextBlockId.HasValue)
				{
					TextDataBlock block = GameDataBlockBase<TextDataBlock>.GetBlock(TextBlockId.Value);
					if (block != null)
					{
						UpdateTextDataBlock(block, language, reference);
					}
				}
			}
		}

		[Flags]
		public enum FallbackValueFlags
		{
			None = 0,
			FallbackLanguage = 1,
			AnyLanguage = 2,
			Key = 4,
			FallbackOrAnyLanguage = 3,
			FallbackLanguageOrKey = 5,
			AnyLanguageOrKey = 6,
			FallbackOrAnyLanguageOrKey = 7
		}

		public readonly struct FallbackValueOptions : IEquatable<FallbackValueOptions>
		{
			public static readonly FallbackValueOptions None = default(FallbackValueOptions);

			public static readonly FallbackValueOptions Key = new FallbackValueOptions(FallbackValueFlags.Key);

			public static readonly FallbackValueOptions AnyLang = new FallbackValueOptions(FallbackValueFlags.AnyLanguage);

			public static readonly FallbackValueOptions AnyLangOrKey = new FallbackValueOptions(FallbackValueFlags.AnyLanguageOrKey);

			public FallbackValueFlags Flags { get; }

			public Language? FallbackLanguage { get; }

			public bool UseKey => Flags.HasFlag(FallbackValueFlags.Key);

			[MemberNotNullWhen(true, "FallbackLanguage")]
			public bool UseFallbackLanguage
			{
				[MemberNotNullWhen(true, "FallbackLanguage")]
				get
				{
					return Flags.HasFlag(FallbackValueFlags.FallbackLanguage);
				}
			}

			public bool UseAnyLanguage => Flags.HasFlag(FallbackValueFlags.AnyLanguage);

			public FallbackValueOptions(FallbackValueFlags flags, Language? fallbackLanguage = null)
			{
				//IL_002e: Unknown result type (might be due to invalid IL or missing references)
				if (flags.HasFlag(FallbackValueFlags.FallbackLanguage))
				{
					if (!fallbackLanguage.HasValue)
					{
						throw new ArgumentNullException("fallbackLanguage", "A fallback language is required if specifying the flag FallbackLanguage");
					}
					ValidateLanguage(fallbackLanguage.Value, "fallbackLanguage");
				}
				Flags = flags;
				FallbackLanguage = fallbackLanguage;
			}

			public override int GetHashCode()
			{
				//IL_000f: Unknown result type (might be due to invalid IL or missing references)
				return HashCode.Combine<FallbackValueFlags, Language>(Flags, FallbackLanguage.GetValueOrDefault());
			}

			public override bool Equals([NotNullWhen(true)] object? obj)
			{
				if (obj is FallbackValueOptions other)
				{
					return Equals(other);
				}
				return false;
			}

			public bool Equals(FallbackValueOptions other)
			{
				//IL_0020: 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)
				if (Flags == other.Flags)
				{
					return FallbackLanguage == other.FallbackLanguage;
				}
				return false;
			}

			public FallbackValueOptions IncludeKey()
			{
				return new FallbackValueOptions(Flags | FallbackValueFlags.Key, FallbackLanguage);
			}

			public FallbackValueOptions ExcludeKey()
			{
				return new FallbackValueOptions(Flags & ~FallbackValueFlags.Key, FallbackLanguage);
			}

			public FallbackValueOptions IncludeFallbackLanguage(Language language)
			{
				//IL_0000: 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)
				ValidateLanguage(language, "language");
				return new FallbackValueOptions(Flags | FallbackValueFlags.FallbackLanguage, language);
			}

			public FallbackValueOptions ExcludeFallbackLanguage()
			{
				return new FallbackValueOptions(Flags & ~FallbackValueFlags.FallbackLanguage);
			}

			public FallbackValueOptions IncludeAnyLanguage()
			{
				return new FallbackValueOptions(Flags | FallbackValueFlags.AnyLanguage, FallbackLanguage);
			}

			public FallbackValueOptions ExcludeAnyLanguage()
			{
				return new FallbackValueOptions(Flags & ~FallbackValueFlags.AnyLanguage, FallbackLanguage);
			}

			public FallbackValueOptions Combine(FallbackValueOptions other)
			{
				return new FallbackValueOptions(Flags | other.Flags, FallbackLanguage ?? other.FallbackLanguage);
			}

			public static bool operator ==(FallbackValueOptions left, FallbackValueOptions right)
			{
				return left.Equals(right);
			}

			public static bool operator !=(FallbackValueOptions left, FallbackValueOptions right)
			{
				return !(left == right);
			}

			public static FallbackValueOptions FallbackLang(Language fallbackLanguage)
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				return new FallbackValueOptions(FallbackValueFlags.FallbackLanguage, fallbackLanguage);
			}

			public static FallbackValueOptions FallbackOrAnyLang(Language fallbackLanguage)
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				return new FallbackValueOptions(FallbackValueFlags.FallbackOrAnyLanguage, fallbackLanguage);
			}

			public static FallbackValueOptions FallbackLangOrKey(Language fallbackLanguage)
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				return new FallbackValueOptions(FallbackValueFlags.FallbackLanguageOrKey, fallbackLanguage);
			}

			public static FallbackValueOptions FallbackOrAnyLangOrKey(Language fallbackLanguage)
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				return new FallbackValueOptions(FallbackValueFlags.FallbackOrAnyLanguageOrKey, fallbackLanguage);
			}
		}

		public struct TextDBOptions
		{
			private FallbackValueOptions? m_FallbackOptions;

			private uint? m_CharacterMetadataId;

			public uint? CharacterMetadataId
			{
				readonly get
				{
					return m_CharacterMetadataId;
				}
				set
				{
					m_CharacterMetadataId = value;
				}
			}

			public FallbackValueOptions? FallbackOptions
			{
				readonly get
				{
					return m_FallbackOptions;
				}
				set
				{
					m_FallbackOptions = value;
				}
			}
		}

		private static readonly Dictionary<string, Entry> s_Entries = new Dictionary<string, Entry>();

		private static readonly List<string> s_EntriesToGenerateTextDBs = new List<string>();

		private static bool s_GameDataInitialized = false;

		private static readonly string STR_NoValueFoundExceptionMsg = "No localization value exists for key '{1}' in language '{0}'.";

		private static readonly string STR_UseKeyGeneric = "{2}: No localization value exists for key '{1}' in language '{0}', defaulting to key.";

		public static ApiStatusInfo Status => APIStatus.Localization;

		public static Language CurrentLanguage => Text.TextLocalizationService.CurrentLanguage;

		public static event Action? OnLanguageChange;

		internal static void Setup()
		{
			GameDataAPI.OnGameDataInitialized += OnGameDataInitialized;
			EventAPI.OnAssetsLoaded += OnGameAssetsLoaded;
			Status.Created = true;
		}

		internal static void OnGameDataInitialized()
		{
			s_GameDataInitialized = true;
			foreach (string s_EntriesToGenerateTextDB in s_EntriesToGenerateTextDBs)
			{
				if (s_Entries.TryGetValue(s_EntriesToGenerateTextDB, out Entry value))
				{
					value.GenerateTextDataBlock(s_EntriesToGenerateTextDB, force: true);
				}
			}
		}

		internal static void OnGameAssetsLoaded()
		{
			Status.Ready = true;
		}

		internal static void LanguageChanged()
		{
			LocalizationAPI.OnLanguageChange?.Invoke();
		}

		public static string FormatString(string key, params object?[] args)
		{
			return FormatString(key, FallbackValueOptions.None, args);
		}

		public static string FormatString(string key, Language fallbackLanguage, params object?[] args)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			return FormatString(key, FallbackValueOptions.FallbackLang(fallbackLanguage), args);
		}

		public static string FormatString(string key, FallbackValueOptions options, params object?[] args)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: 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_0021: Unknown result type (might be due to invalid IL or missing references)
			ValidateLocalizationKey(key, "key");
			Language currentLanguage = CurrentLanguage;
			if (!s_Entries.TryGetValue(key, out Entry value))
			{
				ValidateUseKey(key, currentLanguage, options, "FormatString");
				return key;
			}
			return value.FormatString(currentLanguage, key, options, args);
		}

		public static string GetString(string key)
		{
			return GetString(key, FallbackValueOptions.None);
		}

		public static string GetString(string key, Language fallbackLanguage)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			return GetString(key, FallbackValueOptions.FallbackLang(fallbackLanguage));
		}

		public static string GetString(string key, FallbackValueOptions options)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: 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_0021: Unknown result type (might be due to invalid IL or missing references)
			ValidateLocalizationKey(key, "key");
			Language currentLanguage = CurrentLanguage;
			if (!s_Entries.TryGetValue(key, out Entry value))
			{
				ValidateUseKey(key, currentLanguage, options, "GetString");
				return key;
			}
			return value.GetString(currentLanguage, key, options);
		}

		public static bool TryGetString(string key, [NotNullWhen(true)] out string? value)
		{
			return TryGetString(key, FallbackValueOptions.None, out value);
		}

		public static bool TryGetString(string key, Language fallbackLanguage, [NotNullWhen(true)] out string? value)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			return TryGetString(key, FallbackValueOptions.FallbackLang(fallbackLanguage), out value);
		}

		public static bool TryGetString(string key, FallbackValueOptions options, [NotNullWhen(true)] out string? value)
		{
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			ValidateLocalizationKey(key, "key");
			if (!s_Entries.TryGetValue(key, out Entry value2))
			{
				if (options.UseKey)
				{
					value = key;
					return false;
				}
				value = null;
				return false;
			}
			return value2.TryGetString(CurrentLanguage, key, options, out value);
		}

		public static bool HasKey([NotNullWhen(true)] string? key)
		{
			if (!string.IsNullOrWhiteSpace(key))
			{
				return s_Entries.ContainsKey(key);
			}
			return false;
		}

		public static bool HasLocalizedValue([NotNullWhen(true)] string? key, Language language)
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			if (!string.IsNullOrWhiteSpace(key) && s_Entries.TryGetValue(key, out Entry value))
			{
				return value.HasValueInLanguage(language);
			}
			return false;
		}

		public static uint GenerateTextBlock(string key, TextDBOptions? textDataBlockOptions = null)
		{
			ValidateLocalizationKey(key, "key");
			Entry entry = s_Entries[key];
			if (entry.TextBlockId.HasValue)
			{
				return entry.TextBlockId.Value;
			}
			if (textDataBlockOptions.HasValue)
			{
				entry.GenerateTextDataBlock(key, textDataBlockOptions.Value);
			}
			else
			{
				entry.GenerateTextDataBlock(key);
			}
			s_EntriesToGenerateTextDBs.Add(key);
			return entry.TextBlockId.Value;
		}

		public static bool TryGetTextBlockId(string key, out uint blockId)
		{
			ValidateLocalizationKey(key, "key");
			if (!s_Entries.TryGetValue(key, out Entry value) || !value.TextBlockId.HasValue)
			{
				blockId = 0u;
				return false;
			}
			blockId = value.TextBlockId.Value;
			return true;
		}

		public static void AddEntry(string key, Language language, string value, TextDBOptions? textDataBlockOptions = null)
		{
			//IL_000b: 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)
			ValidateLocalizationKey(key, "key");
			ValidateLanguage(language, "language");
			if (value == null)
			{
				value = string.Empty;
			}
			bool exists;
			ref Entry valueRefOrAddDefault = ref CollectionsMarshal.GetValueRefOrAddDefault(s_Entries, key, out exists);
			if (valueRefOrAddDefault == null)
			{
				valueRefOrAddDefault = new Entry();
			}
			valueRefOrAddDefault.AddValue(language, value);
			if (textDataBlockOptions.HasValue && !exists)
			{
				s_EntriesToGenerateTextDBs.Add(key);
				if (s_GameDataInitialized)
				{
					valueRefOrAddDefault.GenerateTextDataBlock(key, textDataBlockOptions.Value);
				}
			}
		}

		public static void LoadFromResources(string baseName, TextDBOptions? textDataBlockOptions = null)
		{
			LoadFromResources(baseName, Assembly.GetCallingAssembly(), textDataBlockOptions);
		}

		public static void LoadFromResources(string baseName, Assembly assembly, TextDBOptions? textDataBlockOptions = null)
		{
			//IL_002c: 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_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			ResourceManager resourceManager = new ResourceManager(baseName, assembly);
			List<Exception> list = new List<Exception>();
			CultureInfo[] cultures = CultureInfo.GetCultures(CultureTypes.AllCultures);
			foreach (CultureInfo cultureInfo in cultures)
			{
				bool isNeutralCulture = cultureInfo.IsNeutralCulture;
				Language language = GetLanguage(cultureInfo);
				if ((int)language == 0)
				{
					continue;
				}
				ResourceSet resourceSet;
				try
				{
					resourceSet = resourceManager.GetResourceSet(cultureInfo, createIfNotExists: true, tryParents: true);
				}
				catch (MissingManifestResourceException)
				{
					continue;
				}
				catch (Exception item)
				{
					list.Add(item);
					continue;
				}
				if (resourceSet == null)
				{
					continue;
				}
				foreach (DictionaryEntry item2 in resourceSet)
				{
					if (!(item2.Key is string text) || !(item2.Value is string value))
					{
						continue;
					}
					bool exists;
					ref Entry valueRefOrAddDefault = ref CollectionsMarshal.GetValueRefOrAddDefault(s_Entries, text, out exists);
					if (valueRefOrAddDefault == null)
					{
						valueRefOrAddDefault = new Entry();
					}
					valueRefOrAddDefault.AddValue(language, value, isNeutralCulture);
					if (textDataBlockOptions.HasValue && !exists)
					{
						s_EntriesToGenerateTextDBs.Add(text);
						if (s_GameDataInitialized)
						{
							valueRefOrAddDefault.GenerateTextDataBlock(text, textDataBlockOptions.Value);
						}
					}
				}
			}
			resourceManager.ReleaseAllResources();
			if (list.Count > 0)
			{
				throw new AggregateException(list);
			}
		}

		private static void ValidateLocalizationKey([NotNull] string key, [CallerArgumentExpression("key")] string? paramName = null)
		{
			ArgumentNullException.ThrowIfNull(key, paramName);
			if (string.IsNullOrWhiteSpace(paramName))
			{
				throw new ArgumentException("Localization key cannot be empty/whitespace", paramName ?? "key");
			}
		}

		private static void ValidateLanguage(Language language, [CallerArgumentExpression("language")] string? paramName = null)
		{
			//IL_0000: 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)
			if (!Enum.IsDefined<Language>(language))
			{
				throw new ArgumentException($"'{language}' is not a valid language", paramName ?? "language");
			}
		}

		private static void ValidateUseKey(string key, Language language, FallbackValueOptions options, string useCategory)
		{
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			if (!options.UseKey)
			{
				throw new KeyNotFoundException(string.Format(STR_NoValueFoundExceptionMsg, language, key));
			}
			APILogger.Warn("LocalizationAPI", string.Format(STR_UseKeyGeneric, language, key, useCategory));
		}

		private static Language GetLanguage(CultureInfo info)
		{
			//IL_01af: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_019c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0187: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0197: Unknown result type (might be due to invalid IL or missing references)
			//IL_017b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_017f: Unknown result type (might be due to invalid IL or missing references)
			//IL_018b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0183: Unknown result type (might be due to invalid IL or missing references)
			//IL_018f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_0193: Unknown result type (might be due to invalid IL or missing references)
			while (!info.IsNeutralCulture)
			{
				info = info.Parent;
				if (string.IsNullOrEmpty(info.Name))
				{
					return (Language)0;
				}
			}
			return (Language)(info.Name switch
			{
				"en" => 1, 
				"fr" => 2, 
				"it" => 3, 
				"de" => 4, 
				"es" => 5, 
				"ru" => 6, 
				"pt" => 7, 
				"pl" => 8, 
				"ja" => 9, 
				"ko" => 10, 
				"zh-Hans" => 12, 
				"zh-Hant" => 11, 
				_ => 0, 
			});
		}

		private static void UpdateTextDataBlock(TextDataBlock block, Language language, string text)
		{
			//IL_0000: 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_0038: Expected I4, but got Unknown
			switch (language - 1)
			{
			case 0:
				block.English = text;
				break;
			case 1:
				block.French = LanguageData.op_Implicit(text);
				break;
			case 2:
				block.Italian = LanguageData.op_Implicit(text);
				break;
			case 3:
				block.German = LanguageData.op_Implicit(text);
				break;
			case 4:
				block.Spanish = LanguageData.op_Implicit(text);
				break;
			case 5:
				block.Russian = LanguageData.op_Implicit(text);
				break;
			case 6:
				block.Portuguese_Brazil = LanguageData.op_Implicit(text);
				break;
			case 7:
				block.Polish = LanguageData.op_Implicit(text);
				break;
			case 8:
				block.Japanese = LanguageData.op_Implicit(text);
				break;
			case 9:
				block.Korean = LanguageData.op_Implicit(text);
				break;
			case 10:
				block.Chinese_Traditional = LanguageData.op_Implicit(text);
				break;
			case 11:
				block.Chinese_Simplified = LanguageData.op_Implicit(text);
				break;
			}
		}
	}
	[API("Network")]
	public static class NetworkAPI
	{
		internal class CachedEvent
		{
			public string EventName { get; set; }

			public Type PayloadType { get; set; }

			public object OnReceive { get; set; }

			public bool IsFreeSize { get; set; }
		}

		internal static ConcurrentDictionary<string, CachedEvent> s_EventCache = new ConcurrentDictionary<string, CachedEvent>();

		public static ApiStatusInfo Status => APIStatus.Network;

		public static bool IsEventRegistered(string eventName)
		{
			return NetworkAPI_Impl.Instance.EventExists(eventName);
		}

		public static void RegisterEvent<T>(string eventName, Action<ulong, T> onReceive) where T : struct
		{
			if (!APIStatus.Network.Ready)
			{
				if (s_EventCache.ContainsKey(eventName))
				{
					throw new ArgumentException("An event with the name " + eventName + " has already been registered.", "eventName");
				}
				s_EventCache.TryAdd(eventName, new CachedEvent
				{
					EventName = eventName,
					PayloadType = typeof(T),
					OnReceive = onReceive,
					IsFreeSize = false
				});
			}
			else
			{
				NetworkAPI_Impl.Instance.RegisterEvent(eventName, onReceive);
			}
		}

		public static void InvokeEvent<T>(string eventName, T payload, SNet_ChannelType channelType = 2) where T : struct
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			SNet_SendGroup val = default(SNet_SendGroup);
			SNet_SendQuality val2 = default(SNet_SendQuality);
			int num = default(int);
			SNet.GetSendSettings(ref channelType, ref val, ref val2, ref num);
			SNet.Core.SendBytes(MakeBytes(eventName, payload), val, val2, num);
		}

		public static void InvokeEvent<T>(string eventName, T payload, SNet_Player target, SNet_ChannelType channelType = 2) where T : struct
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			SNet_SendGroup val = default(SNet_SendGroup);
			SNet_SendQuality val2 = default(SNet_SendQuality);
			int num = default(int);
			SNet.GetSendSettings(ref channelType, ref val, ref val2, ref num);
			SNet.Core.SendBytes(MakeBytes(eventName, payload), val2, num, target);
		}

		public static void InvokeEvent<T>(string eventName, T payload, List<SNet_Player> targets, SNet_ChannelType channelType = 2) where T : struct
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			SNet_SendGroup val = default(SNet_SendGroup);
			SNet_SendQuality val2 = default(SNet_SendQuality);
			int num = default(int);
			SNet.GetSendSettings(ref channelType, ref val, ref val2, ref num);
			SNet.Core.SendBytes(MakeBytes(eventName, payload), val2, num, targets.ToIl2Cpp());
		}

		public static void RegisterFreeSizedEvent(string eventName, Action<ulong, byte[]> onReceiveBytes)
		{
			if (!APIStatus.Network.Ready)
			{
				if (s_EventCache.ContainsKey(eventName))
				{
					throw new ArgumentException("An event with the name " + eventName + " has already been registered.", "eventName");
				}
				s_EventCache.TryAdd(eventName, new CachedEvent
				{
					EventName = eventName,
					PayloadType = null,
					OnReceive = onReceiveBytes,
					IsFreeSize = true
				});
			}
			else
			{
				NetworkAPI_Impl.Instance.RegisterFreeSizedEvent(eventName, onReceiveBytes);
			}
		}

		public static void InvokeFreeSizedEvent(string eventName, byte[] payload, SNet_ChannelType channelType = 2)
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			SNet_SendGroup val = default(SNet_SendGroup);
			SNet_SendQuality val2 = default(SNet_SendQuality);
			int num = default(int);
			SNet.GetSendSettings(ref channelType, ref val, ref val2, ref num);
			SNet.Core.SendBytes(MakeBytes(eventName, payload), val, val2, num);
		}

		public static void InvokeFreeSizedEvent(string eventName, byte[] payload, SNet_Player target, SNet_ChannelType channelType = 2)
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			SNet_SendGroup val = default(SNet_SendGroup);
			SNet_SendQuality val2 = default(SNet_SendQuality);
			int num = default(int);
			SNet.GetSendSettings(ref channelType, ref val, ref val2, ref num);
			SNet.Core.SendBytes(MakeBytes(eventName, payload), val2, num, target);
		}

		public static void InvokeFreeSizedEvent(string eventName, byte[] payload, IEnumerable<SNet_Player> targets, SNet_ChannelType channelType = 2)
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			SNet_SendGroup val = default(SNet_SendGroup);
			SNet_SendQuality val2 = default(SNet_SendQuality);
			int num = default(int);
			SNet.GetSendSettings(ref channelType, ref val, ref val2, ref num);
			SNet.Core.SendBytes(MakeBytes(eventName, payload), val2, num, targets.ToList().ToIl2Cpp());
		}

		private static Il2CppStructArray<byte> MakeBytes<T>(string eventName, T payload) where T : struct
		{
			return Il2CppStructArray<byte>.op_Implicit(NetworkAPI_Impl.Instance.MakePacketBytes(eventName, payload));
		}

		private static Il2CppStructArray<byte> MakeBytes(string eventName, byte[] payload)
		{
			return Il2CppStructArray<byte>.op_Implicit(NetworkAPI_Impl.Instance.MakeFreeSizedPacketBytes(eventName, payload));
		}
	}
	[API("Prefab")]
	public static class PrefabAPI
	{
		private static Shader s_CustomGearShader;

		private static readonly Dictionary<uint, Action<SyringeFirstPerson>> s_SyringeActions = new Dictionary<uint, Action<SyringeFirstPerson>>();

		public static ApiStatusInfo Status => APIStatus.Prefab;

		private static Shader CustomGearShader
		{
			get
			{
				if ((Object)(object)s_CustomGearShader == (Object)null)
				{
					s_CustomGearShader = Shader.Find("Cell/Player/CustomGearShader");
				}
				return s_CustomGearShader;
			}
		}

		public static void CreateConsumable(string assetName, bool enableEmissive = false)
		{
			Object loadedAsset = AssetAPI.GetLoadedAsset(assetName);
			GameObject val = ((loadedAsset != null) ? ((Il2CppObjectBase)loadedAsset).TryCast<GameObject>() : null) ?? null;
			if ((Object)(object)val == (Object)null)
			{
				throw new ArgumentException("Couldn't find a game object asset with the name " + assetName, "assetName");
			}
			ItemEquippable obj = val.AddComponent<ItemEquippable>();
			obj.m_isFirstPerson = false;
			((Item)obj).m_itemModelHolder = val.transform;
			ReplaceShaderInAssetMaterials(val, CustomGearShader, enableEmissive ? "ENABLE_EMISSIVE" : null);
		}

		public static void CreateConsumablePickup(string assetName, bool enableEmissive = false)
		{
			Object loadedAsset = AssetAPI.GetLoadedAsset(assetName);
			GameObject val = ((loadedAsset != null) ? ((Il2CppObjectBase)loadedAsset).TryCast<GameObject>() : null) ?? null;
			if ((Object)(object)val == (Object)null)
			{
				throw new ArgumentException("Couldn't find a game object asset with the name " + assetName, "assetName");
			}
			BoxCollider componentInChildren = val.GetComponentInChildren<BoxCollider>();
			if ((Object)(object)componentInChildren == (Object)null)
			{
				throw new Exception("The Consumable Pickup prefab doesn't contain a BoxCollider for interaction");
			}
			GameObject gameObject = ((Component)componentInChildren).gameObject;
			gameObject.layer = LayerMask.NameToLayer("Interaction");
			Interact_Pickup_PickupItem val2 = gameObject.AddComponent<Interact_Pickup_PickupItem>();
			((Interact_Base)val2).m_colliderToOwn = (Collider)(object)componentInChildren;
			ConsumablePickup_Core obj = val.AddComponent<ConsumablePickup_Core>();
			obj.m_syncComp = (Component)(object)val.AddComponent<LG_PickupItem_Sync>();
			obj.m_interactComp = (Component)(object)val2;
			ReplaceShaderInAssetMaterials(val, CustomGearShader, enableEmissive ? "ENABLE_EMISSIVE" : null);
		}

		public static void CreateConsumableInstance<T>(string assetName) where T : ConsumableInstance
		{
			Object loadedAsset = AssetAPI.GetLoadedAsset(assetName);
			GameObject obj = ((loadedAsset != null) ? ((Il2CppObjectBase)loadedAsset).TryCast<GameObject>() : null) ?? null;
			if ((Object)(object)obj == (Object)null)
			{
				throw new ArgumentException("Couldn't find a game object asset with the name " + assetName, "assetName");
			}
			if (!ClassInjector.IsTypeRegisteredInIl2Cpp<T>())
			{
				ClassInjector.RegisterTypeInIl2Cpp<T>();
			}
			obj.layer = LayerMask.NameToLayer("Debris");
			Rigidbody component = obj.GetComponent<Rigidbody>();
			obj.AddComponent<ColliderMaterial>().PhysicsBody = component ?? throw new Exception("The Consumable Instance prefab doesn't contain a Rigidbody");
			obj.AddComponent<T>();
		}

		public static void CreateGearComponent(string assetName, bool enableEmissive = false)
		{
			Object loadedAsset = AssetAPI.GetLoadedAsset(assetName);
			GameObject obj = ((loadedAsset != null) ? ((Il2CppObjectBase)loadedAsset).TryCast<GameObject>() : null) ?? null;
			if ((Object)(object)obj == (Object)null)
			{
				throw new ArgumentException("Couldnt find a game object asset with the name " + assetName, "assetName");
			}
			obj.layer = LayerMask.NameToLayer("FirstPersonItem");
			ReplaceShaderInAssetMaterials(obj, CustomGearShader, "ENABLE_FPS_RENDERING", enableEmissive ? "ENABLE_EMISSIVE" : null);
		}

		public static void CreateSyringe(uint itemPersistentId, Action<SyringeFirstPerson> onUse)
		{
			if (s_SyringeActions.ContainsKey(itemPersistentId))
			{
				throw new ArgumentException($"{itemPersistentId} is already registered with a syringe action.");
			}
			s_SyringeActions.Add(itemPersistentId, onUse);
		}

		internal static bool OnSyringeUsed(SyringeFirstPerson syringe)
		{
			if (s_SyringeActions.TryGetValue(((GameDataBlockBase<ItemDataBlock>)(object)((Item)syringe).ItemDataBlock).persistentID, out var value))
			{
				value(syringe);
				return true;
			}
			return false;
		}

		private static void ReplaceShaderInAssetMaterials(GameObject asset, Shader newShader, params string[] addedKeywords)
		{
			addedKeywords = addedKeywords.Where((string x) => !string.IsNullOrEmpty(x)).ToArray();
			foreach (MeshRenderer componentsInChild in asset.GetComponentsInChildren<MeshRenderer>(true))
			{
				foreach (Material item in (Il2CppArrayBase<Material>)(object)((Renderer)componentsInChild).materials)
				{
					item.shader = newShader;
					if (addedKeywords.Length != 0)
					{
						string[] array = Il2CppArrayBase<string>.op_Implicit((Il2CppArrayBase<string>)(object)item.shaderKeywords);
						int num = array.Length;
						Array.Resize(ref array, array.Length + addedKeywords.Length);
						for (int i = 0; i < addedKeywords.Length; i++)
						{
							array[num + i] = addedKeywords[i];
						}
						item.shaderKeywords = Il2CppStringArray.op_Implicit(array);
					}
				}
			}
		}
	}
	[API("SoundBank")]
	public static class SoundBankAPI
	{
		public static ApiStatusInfo Status => APIStatus.SoundBank;

		public static event Action OnSoundBanksLoaded;

		internal static void Setup()
		{
			EventAPI.OnManagersSetup += OnLoadSoundBanks;
		}

		private static void OnLoadSoundBanks()
		{
			FileInfo[] array = (from file in Directory.CreateDirectory(Path.Combine(Paths.BepInExRootPath, "Assets", "SoundBank")).EnumerateFiles()
				where file.Extension.Contains(".bnk")
				select file).ToArray();
			CollectionExtensions.Do<FileInfo>((IEnumerable<FileInfo>)array, (Action<FileInfo>)LoadBank);
			if (array.Any())
			{
				SoundBankAPI.OnSoundBanksLoaded?.Invoke();
			}
		}

		private unsafe static void LoadBank(FileInfo file)
		{
			//IL_0046: 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_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Invalid comparison between Unknown and I4
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			using FileStream fileStream = file.OpenRead();
			uint num = (uint)fileStream.Length;
			byte[] array = new byte[num];
			if (fileStream.Read(array, 0, (int)num) != 0)
			{
				void* intPtr = NativeMemory.AlignedAlloc(num, 16u);
				Unsafe.CopyBlock(ref Unsafe.AsRef<byte>(intPtr), ref array[0], num);
				uint value = default(uint);
				AKRESULT val = AkSoundEngine.LoadBank((IntPtr)(nint)intPtr, num, ref value);
				if ((int)val == 1)
				{
					APILogger.Info("SoundBankAPI", $"Loaded sound bank '{file.Name}' (bankId: {value:X2})");
				}
				else
				{
					APILogger.Error("SoundBankAPI", $"Error while loading sound bank '{file.Name}' ({val})");
				}
			}
		}
	}
	[BepInPlugin("dev.gtfomodding.gtfo-api", "GTFO-API", "0.4.1")]
	internal class EntryPoint : BasePlugin
	{
		private Harmony m_Harmony;

		public override void Load()
		{
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Expected O, but got Unknown
			APILogger.Verbose("Core", "Registering API Implementations");
			ClassInjector.RegisterTypeInIl2Cpp<NetworkAPI_Impl>();
			ClassInjector.RegisterTypeInIl2Cpp<AssetAPI_Impl>();
			APILogger.Verbose("Core", "Registering Wrappers");
			ClassInjector.RegisterTypeInIl2Cpp<ItemWrapped>();
			APILogger.Verbose("Core", "Registering Utilities Implementations");
			ClassInjector.RegisterTypeInIl2Cpp<ThreadDispatcher_Impl>();
			ClassInjector.RegisterTypeInIl2Cpp<CoroutineDispatcher_Impl>();
			APILogger.Verbose("Core", "Applying Patches");
			m_Harmony = new Harmony("dev.gtfomodding.gtfo-api");
			m_Harmony.PatchAll();
			EventAPI.Setup();
			AssetAPI.Setup();
			SoundBankAPI.Setup();
			LevelAPI.Setup();
			LocalizationAPI.Setup();
			APILogger.Verbose("Core", "Plugin Load Complete");
			APILogger.Warn("GTFO-API", "Syringes are currently disabled in this version");
		}
	}
	[GeneratedCode("VersionInfoGenerator", "2.0.0+git50a4b1a-master")]
	[CompilerGenerated]
	internal static class VersionInfo
	{
		public const string RootNamespace = "GTFO.API";

		public const string Version = "0.4.1";

		public const string VersionPrerelease = null;

		public const string VersionMetadata = "git1e8fe81-main";

		public const string SemVer = "0.4.1+git1e8fe81-main";

		public const string GitRevShort = "1e8fe81";

		public const string GitRevLong = "1e8fe816dac645ea837fe046d35f0b1ec044f6db";

		public const string GitBranch = "main";

		public const string GitTag = "0.4.0";

		public const bool GitIsDirty = false;
	}
}
namespace GTFO.API.Wrappers
{
	public class ItemWrapped : Item
	{
		private static readonly Item__Get_pItemData Get_pItemDataBase = Il2CppAPI.GetIl2CppMethod<Item, Item__Get_pItemData>("Get_pItemData", "Player.pItemData", isGeneric: false, Array.Empty<string>());

		private static readonly Item__Set_pItemData Set_pItemDataBase = Il2CppAPI.GetIl2CppMethod<Item, Item__Set_pItemData>("Set_pItemData", "System.Void", isGeneric: false, new string[1] { "Player.pItemData" });

		private static readonly Item__GetCustomData GetCustomDataBase = Il2CppAPI.GetIl2CppMethod<Item, Item__GetCustomData>("GetCustomData", "Player.pItemData_Custom", isGeneric: false, Array.Empty<string>());

		private static readonly Item__SetCustomData SetCustomDataBase = Il2CppAPI.GetIl2CppMethod<Item, Item__SetCustomData>("SetCustomData", "System.Void", isGeneric: false, new string[2] { "Player.pItemData_Custom", "System.Boolean" });

		private static readonly Item__OnCustomDataUpdated OnCustomDataUpdatedBase = Il2CppAPI.GetIl2CppMethod<Item, Item__OnCustomDataUpdated>("OnCustomDataUpdated", "System.Void", isGeneric: false, new string[1] { "Player.pItemData_Custom" });

		private static readonly Item__Awake AwakeBase = Il2CppAPI.GetIl2CppMethod<Item, Item__Awake>("Awake", "System.Void", isGeneric: false, Array.Empty<string>());

		private static readonly Item__OnDespawn OnDespawnBase = Il2CppAPI.GetIl2CppMethod<Item, Item__OnDespawn>("OnDespawn", "System.Void", isGeneric: false, Array.Empty<string>());

		private static readonly Item__Setup SetupBase = Il2CppAPI.GetIl2CppMethod<Item, Item__Setup>("Setup", "System.Void", isGeneric: false, new string[1] { "GameData.ItemDataBlock" });

		private static readonly Item__OnGearSpawnComplete OnGearSpawnCompleteBase = Il2CppAPI.GetIl2CppMethod<Item, Item__OnGearSpawnComplete>("OnGearSpawnComplete", "System.Void", isGeneric: false, Array.Empty<string>());

		private static readonly Item__OnPickUp OnPickUpBase = Il2CppAPI.GetIl2CppMethod<Item, Item__OnPickUp>("OnPickUp", "System.Void", isGeneric: false, new string[1] { "Player.PlayerAgent" });

		private static readonly Item__SetupBaseModel SetupBaseModelBase = Il2CppAPI.GetIl2CppMethod<Item, Item__SetupBaseModel>("SetupBaseModel", "System.Void", isGeneric: false, new string[1] { "ItemSetup.ItemModelSetup" });

		private static readonly Item__SyncedTurnOn SyncedTurnOnBase = Il2CppAPI.GetIl2CppMethod<Item, Item__SyncedTurnOn>("SyncedTurnOn", "System.Void", isGeneric: false, new string[2] { "Player.PlayerAgent", "AIGraph.AIG_CourseNode" });

		private static readonly Item__SyncedTurnOff SyncedTurnOffBase = Il2CppAPI.GetIl2CppMethod<Item, Item__SyncedTurnOff>("SyncedTurnOff", "System.Void", isGeneric: false, new string[1] { "Player.PlayerAgent" });

		private static readonly Item__SyncedTrigger SyncedTriggerBase = Il2CppAPI.GetIl2CppMethod<Item, Item__SyncedTrigger>("SyncedTrigger", "System.Void", isGeneric: false, new string[1] { "Player.PlayerAgent" });

		private static readonly Item__SyncedTriggerSecondary SyncedTriggerSecondaryBase = Il2CppAPI.GetIl2CppMethod<Item, Item__SyncedTriggerSecondary>("SyncedTriggerSecondary", "System.Void", isGeneric: false, new string[1] { "Player.PlayerAgent" });

		private static readonly Item__SyncedThrow SyncedThrowBase = Il2CppAPI.GetIl2CppMethod<Item, Item__SyncedThrow>("SyncedThrow", "System.Void", isGeneric: false, new string[1] { "Player.PlayerAgent" });

		private static readonly Item__SyncedPickup SyncedPickupBase = Il2CppAPI.GetIl2CppMethod<Item, Item__SyncedPickup>("SyncedPickup", "System.Void", isGeneric: false, new string[1] { "Player.PlayerAgent" });

		private static readonly Item__SyncedSetKeyValue SyncedSetKeyValueBase = Il2CppAPI.GetIl2CppMethod<Item, Item__SyncedSetKeyValue>("SyncedSetKeyValue", "System.Void", isGeneric: false, new string[2] { "System.Int32", "System.Single" });

		private static readonly Item__GetPickupInteraction GetPickupInteractionBase = Il2CppAPI.GetIl2CppMethod<Item, Item__GetPickupInteraction>("GetPickupInteraction", "Interact_Base", isGeneric: false, Array.Empty<string>());

		private static readonly Item__GetItem GetItemBase = Il2CppAPI.GetIl2CppMethod<Item, Item__GetItem>("GetItem", "Item", isGeneric: false, Array.Empty<string>());

		public ItemWrapped(IntPtr hdl)
			: base(hdl)
		{
		}

		public unsafe override pItemData Get_pItemData()
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			pItemData* retstr = (pItemData*)stackalloc pItemData[1];
			return *Get_pItemDataBase(retstr, ((Il2CppObjectBase)this).Pointer.ToPointer());
		}

		public unsafe override void Set_pItemData(pItemData data)
		{
			Set_pItemDataBase(((Il2CppObjectBase)this).Pointer.ToPointer(), &data);
		}

		public unsafe override pItemData_Custom GetCustomData()
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			return *GetCustomDataBase(((Il2CppObjectBase)this).Pointer.ToPointer());
		}

		public unsafe override void SetCustomData(pItemData_Custom custom, bool sync)
		{
			SetCustomDataBase(((Il2CppObjectBase)this).Pointer.ToPointer(), &custom, sync);
		}

		public unsafe override void OnCustomDataUpdated(pItemData_Custom customDataCopy)
		{
			OnCustomDataUpdatedBase(((Il2CppObjectBase)this).Pointer.ToPointer(), &customDataCopy);
		}

		public unsafe override void Awake()
		{
			AwakeBase(((Il2CppObjectBase)this).Pointer.ToPointer());
		}

		public unsafe override void OnDespawn()
		{
			OnDespawnBase(((Il2CppObjectBase)this).Pointer.ToPointer());
		}

		public unsafe override void Setup(ItemDataBlock data)
		{
			SetupBase(((Il2CppObjectBase)this).Pointer.ToPointer(), ((Il2CppObjectBase)data).Pointer.ToPointer());
		}

		public unsafe override void OnGearSpawnComplete()
		{
			OnGearSpawnCompleteBase(((Il2CppObjectBase)this).Pointer.ToPointer());
		}

		public unsafe override void OnPickUp(PlayerAgent player)
		{
			OnPickUpBase(((Il2CppObjectBase)this).Pointer.ToPointer(), ((Il2CppObjectBase)player).Pointer.ToPointer());
		}

		public unsafe override void SetupBaseModel(ItemModelSetup setup)
		{
			SetupBaseModelBase(((Il2CppObjectBase)this).Pointer.ToPointer(), ((Il2CppObjectBase)setup).Pointer.ToPointer());
		}

		public unsafe override void SyncedTurnOn(PlayerAgent agent, AIG_CourseNode courseNode)
		{
			SyncedTurnOnBase(((Il2CppObjectBase)this).Pointer.ToPointer(), ((Il2CppObjectBase)agent).Pointer.ToPointer(), ((Il2CppObjectBase)courseNode).Pointer.ToPointer());
		}

		public unsafe override void SyncedTurnOff(PlayerAgent agent)
		{
			SyncedTurnOffBase(((Il2CppObjectBase)this).Pointer.ToPointer(), ((Il2CppObjectBase)agent).Pointer.ToPointer());
		}

		public unsafe override void SyncedTrigger(PlayerAgent agent)
		{
			SyncedTriggerBase(((Il2CppObjectBase)this).Pointer.ToPointer(), ((Il2CppObjectBase)agent).Pointer.ToPointer());
		}

		public unsafe override void SyncedTriggerSecondary(PlayerAgent agent)
		{
			SyncedTriggerSecondaryBase(((Il2CppObjectBase)this).Pointer.ToPointer(), ((Il2CppObjectBase)agent).Pointer.ToPointer());
		}

		public unsafe override void SyncedThrow(PlayerAgent agent)
		{
			SyncedThrowBase(((Il2CppObjectBase)this).Pointer.ToPointer(), ((Il2CppObjectBase)agent).Pointer.ToPointer());
		}

		public unsafe override void SyncedPickup(PlayerAgent agent)
		{
			SyncedPickupBase(((Il2CppObjectBase)this).Pointer.ToPointer(), ((Il2CppObjectBase)agent).Pointer.ToPointer());
		}

		public unsafe override void SyncedSetKeyValue(int key, float value)
		{
			SyncedSetKeyValueBase(((Il2CppObjectBase)this).Pointer.ToPointer(), key, value);
		}

		public unsafe override Interact_Base GetPickupInteraction()
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Expected O, but got Unknown
			return new Interact_Base((IntPtr)GetPickupInteractionBase(((Il2CppObjectBase)this).Pointer.ToPointer()));
		}

		public unsafe override Item GetItem()
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Expected O, but got Unknown
			return new Item((IntPtr)GetItemBase(((Il2CppObjectBase)this).Pointer.ToPointer()));
		}
	}
	public unsafe delegate pItemData* Item__Get_pItemData(pItemData* retstr, void* _this);
	public unsafe delegate void Item__Set_pItemData(void* _this, void* data);
	public unsafe delegate pItemData_Custom* Item__GetCustomData(void* _this);
	public unsafe delegate void Item__SetCustomData(void* _this, pItemData_Custom* custom, bool sync);
	public unsafe delegate void Item__OnCustomDataUpdated(void* _this, pItemData_Custom* customDataCopy);
	public unsafe delegate void Item__Awake(void* _this);
	public unsafe delegate void Item__OnDespawn(void* _this);
	public unsafe delegate void Item__Setup(void* _this, void* data);
	public unsafe delegate void Item__OnGearSpawnComplete(void* _this);
	public unsafe delegate void Item__OnPickUp(void* _this, void* player);
	public unsafe delegate void Item__SetupBaseModel(void* _this, void* setup);
	public unsafe delegate void Item__SyncedTurnOn(void* _this, void* agent, void* courseNode);
	public unsafe delegate void Item__SyncedTurnOff(void* _this, void* agent);
	public unsafe delegate void Item__SyncedTrigger(void* _this, void* agent);
	public unsafe delegate void Item__SyncedTriggerSecondary(void* _this, void* agent);
	public unsafe delegate void Item__SyncedThrow(void* _this, void* agent);
	public unsafe delegate void Item__SyncedPickup(void* _this, void* agent);
	public unsafe delegate void Item__SyncedSetKeyValue(void* _this, int key, float value);
	public unsafe delegate void* Item__GetPickupInteraction(void* _this);
	public unsafe delegate void* Item__GetItem(void* _this);
	[Il2CppInterface(typeof(iTerminalItem))]
	public interface iTerminalItemWrapper
	{
		uint TerminalItemId { get; set; }

		string TerminalItemKey { get; set; }

		string OverrideCode { get; set; }

		Vector3 LocatorBeaconPosition { get; set; }

		AIG_CourseNode SpawnNode { get; set; }

		bool ShowInFloorInventory { get; set; }

		string FloorItemLocation { get; set; }

		eFloorInventoryObjectType FloorItemType { get; set; }

		eFloorInventoryObjectStatus FloorItemStatus { get; set; }

		Func<List<string>, List<string>> OnWantDetailedInfo { get; set; }

		void Setup(string key);

		List<string> GetDetailedInfo(List<string> defaultDetails);

		void PlayPing();
	}
	[Il2CppInterface(typeof(iResourcePackReceiver))]
	public interface iResourcePackReceiverWrapper
	{
		bool IsLocallyOwned { get; }

		string InteractionName { get; }

		bool NeedHealth();

		bool NeedDisinfection();

		bool NeedWeaponAmmo();

		bool NeedToolAmmo();

		void GiveAmmoRel(float ammoStandardRel, float ammoSpecialRel, float ammoClassRel);

		void GiveHealth(float health);

		void GiveDisinfection(float disinfection);
	}
	[Il2CppInterface(typeof(iPlayerPingTarget))]
	public interface iPlayerPingTargetWrapper
	{
		eNavMarkerStyle PingTargetStyle { get; set; }
	}
	[Il2CppInterface(typeof(iWardenObjectiveItem))]
	public interface iWardenObjectiveItemWrapper
	{
		LG_LayerType OriginLayer { get; }

		AIG_CourseNode SpawnNode { get; }

		string PublicName { get; }

		Transform transform { get; }

		bool ObjectiveItemSolved { get; }

		ePickupItemStatus PickupItemStatus { get; }

		PlayerAgent PickedUpByPlayer { get; }

		void ActivateWardenObjectiveItem();

		void DeactivateWardenObjectiveItem();
	}
}
namespace GTFO.API.Utilities
{
	public static class CoroutineDispatcher
	{
		public static Coroutine StartCoroutine(IEnumerator routine)
		{
			return CoroutineDispatcher_Impl.Instance.RunCoroutine(routine);
		}

		public static Coroutine StartInLevelCoroutine(IEnumerator routine)
		{
			return CoroutineDispatcher_Impl.Instance.RunInLevelCoroutine(routine);
		}
	}
	public delegate void LiveEditEventHandler(LiveEditEventArgs e);
	public class LiveEditEventArgs
	{
		public LiveEditEventType Type { get; set; }

		public string FullPath { get; set; }

		public string FileName { get; set; }
	}
	public enum LiveEditEventType
	{
		Created,
		Deleted,
		Renamed,
		Changed
	}
	public static class LiveEdit
	{
		internal const int RETRY_COUNT = 5;

		internal const float RETRY_INTERVAL = 0.1f;

		internal static readonly List<LiveEditListener> s_Listeners = new List<LiveEditListener>();

		public static LiveEditListener CreateListener(string path, string filter, bool includeSubDir)
		{
			LiveEditListener liveEditListener = new LiveEditListener(path, filter, includeSubDir);
			s_Listeners.Add(liveEditListener);
			return liveEditListener;
		}

		public static void TryReadFileContent(string filepath, Action<string> onReaded)
		{
			CoroutineDispatcher.StartCoroutine(GetFileStream(filepath, 5, 0.1f, delegate(FileStream stream)
			{
				try
				{
					using StreamReader streamReader = new StreamReader(stream, Encoding.UTF8);
					onReaded?.Invoke(streamReader.ReadToEnd());
				}
				catch
				{
				}
			}));
		}

		private static IEnumerator GetFileStream(string filepath, int retryCount, float retryInterval, Action<FileStream> onFileStreamOpened)
		{
			retryCount = Math.Max(retryCount, 1);
			retryInterval = Math.Max(retryInterval, 0f);
			WaitForSecondsRealtime wait = new WaitForSecondsRealtime(retryInterval);
			for (int i = 0; i < retryCount; i++)
			{
				try
				{
					FileStream fileStream = new FileStream(filepath, FileMode.Open, FileAccess.ReadWrite, FileShare.ReadWrite);
					onFileStreamOpened?.Invoke(fileStream);
					fileStream.Close();
					break;
				}
				catch
				{
				}
				yield return wait;
			}
		}
	}
	public sealed class LiveEditListener : IDisposable
	{
		private FileSystemWatcher m_Watcher;

		private bool m_Allocated = true;

		private float m_ChangedCooldownTimer;

		public float FileChangedEventCooldown { get; set; } = 0.05f;


		public event LiveEditEventHandler FileChanged;

		public event LiveEditEventHandler FileDeleted;

		public event LiveEditEventHandler FileCreated;

		public event LiveEditEventHandler FileRenamed;

		private LiveEditListener()
		{
		}

		internal LiveEditListener(string path, string filter, bool includeSubDir)
		{
			LiveEditListener liveEditListener = this;
			m_Watcher = new FileSystemWatcher
			{
				Path = path,
				Filter = filter,
				IncludeSubdirectories = includeSubDir,
				NotifyFilter = (NotifyFilters.FileName | NotifyFilters.LastWrite | NotifyFilters.CreationTime)
			};
			m_Watcher.Deleted += delegate(object sender, FileSystemEventArgs e)
			{
				FileSystemEventArgs e5 = e;
				ThreadDispatcher.Dispatch(delegate
				{
					liveEditListener.FileDeleted?.Invoke(CreateArgs(e5, LiveEditEventType.Deleted));
				});
			};
			m_Watcher.Created += delegate(object sender, FileSystemEventArgs e)
			{
				FileSystemEventArgs e4 = e;
				ThreadDispatcher.Dispatch(delegate
				{
					liveEditListener.FileCreated?.Invoke(CreateArgs(e4, LiveEditEventType.Created));
				});
			};
			m_Watcher.Renamed += delegate(object sender, RenamedEventArgs e)
			{
				RenamedEventArgs e3 = e;
				ThreadDispatcher.Dispatch(delegate
				{
					liveEditListener.FileRenamed?.Invoke(CreateArgs(e3, LiveEditEventType.Renamed));
				});
			};
			m_Watcher.Changed += delegate(object sender, FileSystemEventArgs e)
			{
				FileSystemEventArgs e2 = e;
				ThreadDispatcher.Dispatch(delegate
				{
					float time = Time.time;
					if (!(liveEditListener.m_ChangedCooldownTimer > time))
					{
						liveEditListener.m_ChangedCooldownTimer = time + liveEditListener.FileChangedEventCooldown;
						liveEditListener.FileChanged?.Invoke(CreateArgs(e2, LiveEditEventType.Changed));
					}
				});
			};
			m_Watcher.Error += delegate(object sender, ErrorEventArgs e)
			{
				APILogger.Error("LiveEdit", $"Path: {path} error reported! - {e.GetException()}");
			};
			StartListen();
		}

		private static LiveEditEventArgs CreateArgs(FileSystemEventArgs args, LiveEditEventType type)
		{
			return new LiveEditEventArgs
			{
				FullPath = args.FullPath,
				FileName = Path.GetFileName(args.FullPath),
				Type = type
			};
		}

		public void Dispose()
		{
			if (m_Allocated)
			{
				LiveEdit.s_Listeners.Remove(this);
				m_Allocated = false;
			}
			if (m_Watcher != null)
			{
				StopListen();
				this.FileChanged = null;
				this.FileDeleted = null;
				this.FileCreated = null;
				this.FileRenamed = null;
				m_Watcher.Dispose();
			}
			m_Watcher = null;
		}

		public void StopListen()
		{
			if (m_Watcher != null)
			{
				m_Watcher.EnableRaisingEvents = false;
			}
		}

		public void StartListen()
		{
			if (m_Watcher != null)
			{
				m_Watcher.EnableRaisingEvents = true;
			}
		}
	}
	internal static class MemoryUtils
	{
		private static byte[] _trampolineShellcode = new byte[12]
		{
			72, 184, 0, 0, 0, 0, 0, 0, 0, 0,
			255, 208
		};

		public unsafe static void* FindSignatureInBlock(void* block, ulong blockSize, string pattern, string mask, ulong sigOffset = 0uL)
		{
			return FindSignatureInBlock(block, blockSize, pattern.ToCharArray(), mask.ToCharArray(), sigOffset);
		}

		public unsafe static void* FindSignatureInBlock(void* block, ulong blockSize, char[] pattern, char[] mask, ulong sigOffset = 0uL)
		{
			for (ulong num = 0uL; num < blockSize; num++)
			{
				bool flag = true;
				for (uint num2 = 0u; num2 < mask.Length; num2++)
				{
					if (*(byte*)((long)num + (long)block + num2) != (byte)pattern[num2] && mask[num2] != '?')
					{
						flag = false;
						break;
					}
				}
				if (flag)
				{
					return (void*)((ulong)((long)num + (long)block) + sigOffset);
				}
			}
			return null;
		}

		public unsafe static byte[] MakeTrampoline(void* destination)
		{
			byte[] array = new byte[_trampolineShellcode.Length];
			Array.Copy(_trampolineShellcode, 0, array, 0, _trampolineShellcode.Length);
			fixed (byte* ptr = array)
			{
				*(long*)(ptr + 2) = (long)destination;
			}
			return array;
		}

		public unsafe static void CreateTrampolineBetween(void* start, void* end, void* destination)
		{
			ulong num = (ulong)end - (ulong)start;
			if (num < (ulong)_trampolineShellcode.Length)
			{
				throw new Exception("Trampoline block size is not enough to create.");
			}
			uint flNewProtect = default(uint);
			if (!Kernel32.VirtualProtect(start, num, 64u, &flNewProtect))
			{
				throw new Exception("Failed to change protection of trampoline block.");
			}
			APILogger.Verbose("MemoryUtils", "NOPing trampoline block");
			for (ulong num2 = 0uL; num2 < num; num2++)
			{
				*(sbyte*)((ulong)start + num2) = -112;
			}
			APILogger.Verbose("MemoryUtils", "Creating trampoline shellcode");
			byte[] array = MakeTrampoline(destination);
			APILogger.Verbose("MemoryUtils", "Writing trampoline shellcode");
			for (ulong num3 = 0uL; num3 < (ulong)array.Length; num3++)
			{
				*(byte*)((ulong)start + num3) = array[num3];
			}
			if (!Kernel32.VirtualProtect(start, num, flNewProtect, &flNewProtect))
			{
				throw new Exception("Failed to revert trampoline block protection.");
			}
		}
	}
	public class PersistentData<T> where T : PersistentData<T>, new()
	{
		private const string VERSION_REGEX = "\"PersistentDataVersion\": \"(.+?)\"";

		private static T s_CurrentData;

		public static T CurrentData
		{
			get
			{
				if (s_CurrentData != null)
				{
					return s_CurrentData;
				}
				s_CurrentData = Load();
				return s_CurrentData;
			}
			set
			{
				s_CurrentData = value;
			}
		}

		protected static string persistentPath => Path.Combine(Paths.BepInExRootPath, "GameData", "PersistentData", typeof(T).Assembly.GetName().Name, typeof(T).Name + ".json");

		public virtual string PersistentDataVersion { get; set; } = "1.0.0";


		public static T Load()
		{
			return Load(persistentPath);
		}

		public static T Load(string path)
		{
			T val = new T();
			if (File.Exists(path))
			{
				string text = File.ReadAllText(path);
				T val2;
				try
				{
					val2 = GTFO.API.JSON.JsonSerializer.Deserialize<T>(text);
				}
				catch (JsonException)
				{
					APILogger.Warn("JSON", "Failed to deserialize " + typeof(T).Name + ", replacing with default");
					string text2 = "FAILED";
					Match match = Regex.Match(text, "\"PersistentDataVersion\": \"(.+?)\"");
					if (match.Success)
					{
						text2 = match.Groups[1].Value + "-FAILED";
					}
					File.WriteAllText(Path.ChangeExtension(path, null) + "-" + text2 + ".json", text);
					val2 = new T();
					val2.Save(path);
				}
				if (val2.PersistentDataVersion != val.PersistentDataVersion)
				{
					val2.Save(Path.ChangeExtension(path, null) + "-" + val2.PersistentDataVersion + ".json");
					val.Save(path);
				}
				else
				{
					val = val2;
				}
			}
			else
			{
				val.Save(path);
			}
			return val;
		}

		public void Save()
		{
			Save(persistentPath);
		}

		public void Save(string path)
		{
			string contents = GTFO.API.JSON.JsonSerializer.Serialize((T)this);
			string directoryName = Path.GetDirectoryName(path);
			if (!Directory.Exists(directoryName))
			{
				Directory.CreateDirectory(directoryName);
			}
			File.WriteAllText(path, contents);
		}
	}
	public static class RegexUtils
	{
		private static readonly Regex s_VectorRegex = new Regex("-?[0-9.]+");

		public static bool TryParseVectorString(string input, out float[] vectorArray)
		{
			try
			{
				MatchCollection matchCollection = s_VectorRegex.Matches(input);
				int count = matchCollection.Count;
				if (count < 1)
				{
					throw new Exception();
				}
				vectorArray = new float[count];
				for (int i = 0; i < count; i++)
				{
					Match match = matchCollection[i];
					vectorArray[i] = float.Parse(match.Value, CultureInfo.InvariantCulture);
				}
				return true;
			}
			catch
			{
				vectorArray = null;
				return false;
			}
		}
	}
	public static class StringUtils
	{
		private static readonly uint[] _lookup32 = ((Func<uint[]>)delegate
		{
			uint[] array = new uint[256];
			for (int i = 0; i < 256; i++)
			{
				string text = i.ToString("X2");
				if (BitConverter.IsLittleEndian)
				{
					array[i] = text[0] + ((uint)text[1] << 16);
				}
				else
				{
					array[i] = text[1] + ((uint)text[0] << 16);
				}
			}
			return array;
		})();

		private unsafe static readonly uint* _lookup32Ptr = (uint*)(void*)GCHandle.Alloc(_lookup32, GCHandleType.Pinned).AddrOfPinnedObject();

		public unsafe static string FromByteArrayAsHex(byte[] bytes)
		{
			char[] array = new char[bytes.Length * 2];
			fixed (byte* ptr3 = bytes)
			{
				fixed (char* ptr = array)
				{
					uint* ptr2 = (uint*)ptr;
					for (int i = 0; i < bytes.Length; i++)
					{
						ptr2[i] = _lookup32Ptr[(int)ptr3[i]];
					}
				}
			}
			return new string(array);
		}
	}
	public static class ThreadDispatcher
	{
		public static void Dispatch(Action action)
		{
			ThreadDispatcher_Impl.Instance.EnqueueAction(action);
		}
	}
}
namespace GTFO.API.Utilities.Impl
{
	internal class CoroutineDispatcher_Impl : MonoBehaviour
	{
		private bool m_HasInLevelCoroutines;

		private readonly List<Coroutine> m_InLevelCoroutines;

		private static CoroutineDispatcher_Impl s_Instance;

		public static CoroutineDispatcher_Impl Instance
		{
			get
			{
				if ((Object)(object)s_Instance == (Object)null)
				{
					CoroutineDispatcher_Impl coroutineDispatcher_Impl = Object.FindObjectOfType<CoroutineDispatcher_Impl>();
					if ((Object)(object)coroutineDispatcher_Impl != (Object)null)
					{
						s_Instance = coroutineDispatcher_Impl;
					}
				}
				return s_Instance;
			}
		}

		static CoroutineDispatcher_Impl()
		{
			AssetAPI.OnStartupAssetsLoaded += OnAssetsLoaded;
		}

		private static void OnAssetsLoaded()
		{
			//IL_000e: 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_001a: 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_0032: Expected O, but got Unknown
			if (!((Object)(object)s_Instance != (Object)null))
			{
				GameObject val = new GameObject();
				CoroutineDispatcher_Impl coroutineDispatcher_Impl = val.AddComponent<CoroutineDispatcher_Impl>();
				((Object)val).name = "GTFO-API Coroutine Dispatcher";
				((Object)val).hideFlags = (HideFlags)61;
				Object.DontDestroyOnLoad((Object)val);
				s_Instance = coroutineDispatcher_Impl;
			}
		}

		private void Update()
		{
			if (m_HasInLevelCoroutines && !GameStateManager.IsInExpedition)
			{
				m_InLevelCoroutines.ForEach(delegate(Coroutine coroutine)
				{
					((MonoBehaviour)this).StopCoroutine(coroutine);
				});
				m_HasInLevelCoroutines = false;
			}
		}

		[HideFromIl2Cpp]
		internal Coroutine RunCoroutine(IEnumerator routine)
		{
			return MonoBehaviourExtensions.StartCoroutine((MonoBehaviour)(object)this, routine);
		}

		[HideFromIl2Cpp]
		internal Coroutine RunInLevelCoroutine(IEnumerator routine)
		{
			if (!GameStateManager.IsInExpedition)
			{
				APILogger.Error("CoroutineDispatcher", "Cannot run InLevelCoroutine while you're not in level!");
				return null;
			}
			Coroutine val = MonoBehaviourExtensions.StartCoroutine((MonoBehaviour)(object)this, routine);
			m_InLevelCoroutines.Add(val);
			m_HasInLevelCoroutines = true;
			return val;
		}
	}
	internal class ThreadDispatcher_Impl : MonoBehaviour
	{
		private readonly Queue<Action> s_ActionQueue = new Queue<Action>();

		private static ThreadDispatcher_Impl s_Instance;

		public static ThreadDispatcher_Impl Instance
		{
			get
			{
				if ((Object)(object)s_Instance == (Object)null)
				{
					ThreadDispatcher_Impl threadDispatcher_Impl = Object.FindObjectOfType<ThreadDispatcher_Impl>();
					if ((Object)(object)threadDispatcher_Impl != (Object)null)
					{
						s_Instance = threadDispatcher_Impl;
					}
				}
				return s_Instance;
			}
		}

		public ThreadDispatcher_Impl(IntPtr intPtr)
			: base(intPtr)
		{
		}

		static ThreadDispatcher_Impl()
		{
			AssetAPI.OnStartupAssetsLoaded += OnAssetsLoaded;
		}

		private static void OnAssetsLoaded()
		{
			//IL_000e: 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_001a: 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_0032: Expected O, but got Unknown
			if (!((Object)(object)s_Instance != (Object)null))
			{
				GameObject val = new GameObject();
				ThreadDispatcher_Impl threadDispatcher_Impl = val.AddComponent<ThreadDispatcher_Impl>();
				((Object)val).name = "GTFO-API Thread Dispatcher";
				((Object)val).hideFlags = (HideFlags)61;
				Object.DontDestroyOnLoad((Object)val);
				s_Instance = threadDispatcher_Impl;
			}
		}

		[HideFromIl2Cpp]
		internal void EnqueueAction(Action action)
		{
			lock (s_ActionQueue)
			{
				s_ActionQueue.Enqueue(action);
			}
		}

		internal void Update()
		{
			lock (s_ActionQueue)
			{
				while (s_ActionQueue.Count > 0)
				{
					s_ActionQueue.Dequeue()?.Invoke();
				}
			}
		}
	}
}
namespace GTFO.API.Resources
{
	public class ApiStatusInfo
	{
		public bool Created { get; internal set; }

		public bool Ready { get; internal set; }
	}
	public static class APIStatus
	{
		private static GameObject s_ScriptHolder;

		public static ApiStatusInfo Asset { get; internal set; } = new ApiStatusInfo();


		public static ApiStatusInfo Event { get; internal set; } = new ApiStatusInfo();


		public static ApiStatusInfo GameData { get; internal set; } = new ApiStatusInfo();


		public static ApiStatusInfo Localization { get; internal set; } = new ApiStatusInfo();


		public static ApiStatusInfo Il2Cpp { get; internal set; } = new ApiStatusInfo();


		public static ApiStatusInfo Level { get; internal set; } = new ApiStatusInfo();


		public static ApiStatusInfo Network { get; internal set; } = new ApiStatusInfo();


		public static ApiStatusInfo Prefab { get; internal set; } = new ApiStatusInfo();


		public static ApiStatusInfo SoundBank { get; internal set; } = new ApiStatusInfo();


		internal static GameObject ScriptHolder
		{
			get
			{
				//IL_000d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0017: Expected O, but got Unknown
				if ((Object)(object)s_ScriptHolder == (Object)null)
				{
					s_ScriptHolder = new GameObject();
					((Object)s_ScriptHolder).name = "GTFO-API Script Holder";
					((Object)s_ScriptHolder).hideFlags = (HideFlags)61;
					Object.DontDestroyOnLoad((Object)(object)s_ScriptHolder);
				}
				return s_ScriptHolder;
			}
		}

		internal static void CreateApi<T>(string apiName) where T : Component
		{
			ApiStatusInfo apiStatusInfo = (ApiStatusInfo)(typeof(APIStatus).GetProperty(apiName)?.GetValue(null));
			if (apiStatusInfo == null)
			{
				throw new ArgumentException("Couldn't find API status for " + apiName, "apiName");
			}
			if (!apiStatusInfo.Created && !((Object)(object)ScriptHolder.GetComponent<T>() != (Object)null))
			{
				APILogger.Verbose("Core", "Creating API " + apiName);
				ScriptHolder.AddComponent<T>();
				apiStatusInfo.Created = true;
			}
		}
	}
	internal static class RuntimeData
	{
		public static Dictionary<InventorySlot, string[]> BotFavorites;
	}
	public static class ShaderConstants
	{
		public const string CUSTOM_GEAR_SHADER = "Cell/Player/CustomGearShader";
	}
	public static class NetworkConstants
	{
		public const string Magic = "GAPI_KSQK";

		public const byte MagicSize = 9;

		public const ulong VersionSignature = 18374688171108015565uL;
	}
}
namespace GTFO.API.Patches
{
	[HarmonyPatch(typeof(CellSettingsApply), "ApplyLanguage")]
	internal static class ApplyLanguage_Patches
	{
		private static bool s_LanguageChanged;

		[HarmonyWrapSafe]
		public static void Prefix(int value)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Invalid comparison between Unknown and I4
			s_LanguageChanged = (int)Text.TextLocalizationService.CurrentLanguage != value;
		}

		[HarmonyWrapSafe]
		public static void Postfix()
		{
			if (s_LanguageChanged)
			{
				LocalizationAPI.LanguageChanged();
			}
		}
	}
	[HarmonyPatch(typeof(AssetShardManager))]
	internal class AssetShardManager_Patches
	{
		[HarmonyPatch("Setup")]
		[HarmonyWrapSafe]
		[HarmonyPostfix]
		public static void Setup_Postfix()
		{
			if (!APIStatus.Asset.Created)
			{
				APIStatus.CreateApi<AssetAPI_Impl>("Asset");
			}
		}
	}
	[HarmonyPatch(typeof(Builder))]
	internal class Builder_Patches
	{
		[HarmonyPatch("Build")]
		[HarmonyWrapSafe]
		[HarmonyPostfix]
		private static void BuildStart_Postfix()
		{
			LevelAPI.BuildStart();
		}

		[HarmonyPatch("BuildDone")]
		[HarmonyWrapSafe]
		[HarmonyPostfix]
		private static void BuildDone_Postfix()
		{
			LevelAPI.BuildDone();
		}
	}
	[HarmonyPatch(typeof(GameDataInit))]
	internal class GameDataInit_Patches
	{
		private struct PluginWhitelistInfo
		{
			public string GUID;

			public string Name;

			public string Version;

			public string Checksum;
		}

		private static PluginWhitelistInfo[] FetchPluginWhitelist()
		{
			using HttpClient httpClient = new HttpClient();
			using Stream stream = httpClient.GetStreamAsync("https://raw.githubusercontent.com/GTFO-Modding/GTFO-API-PluginWhitelist/main/whitelist.txt").GetAwaiter().GetResult();
			using StreamReader streamReader = new StreamReader(stream);
			string[] array = streamReader.ReadToEnd().Split('\n', StringSplitOptions.RemoveEmptyEntries);
			PluginWhitelistInfo[] array2 = new PluginWhitelistInfo[array.Length];
			for (int i = 0; i < array2.Length; i++)
			{
				string[] array3 = array[i].Split(":");
				array2[i] = new PluginWhitelistInfo
				{
					GUID = array3[0],
					Name = array3[1],
					Version = array3[2],
					Checksum = array3[3].TrimEnd('\r')
				};
			}
			return array2;
		}

		[HarmonyPatch("Initialize")]
		[HarmonyWrapSafe]
		[HarmonyPostfix]
		public static void Initialize_Postfix()
		{
			Analytics.enabled = false;
			GameDataAPI.InvokeGameDataInit();
			if (!APIStatus.Network.Created)
			{
				APIStatus.CreateApi<NetworkAPI_Impl>("Network");
			}
		}

		private static void RemoveRequirementFromList(List<ExpeditionInTierData> list)
		{
			//IL_0019: 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_001f: 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: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Invalid comparison between Unknown and I4
			Enumerator<ExpeditionInTierData> enumerator = list.GetEnumerator();
			while (enumerator.MoveNext())
			{
				ExpeditionInTierData current = enumerator.Current;
				if (current.Enabled)
				{
					eExpeditionAccessibility accessibility = current.Accessibility;
					if ((int)accessibility == 0 || accessibility - 4 <= 1)
					{
						current.Accessibility = (eExpeditionAccessibility)2;
					}
				}
			}
		}
	}
	[HarmonyPatch(typeof(GearManager))]
	internal static class GearManager_Patches
	{
		private unsafe delegate IntPtr ReadFromDiskDelegate(IntPtr path, byte* createNew, Il2CppMethodInfo* methodInfo);

		private unsafe delegate void SaveToDiskDelegate(IntPtr path, IntPtr obj, Il2CppMethodInfo* methodInfo);

		private static bool m_PatchApplied;

		private static INativeDetour s_ReadFromDiskDetour;

		private static ReadFromDiskDelegate s_ReadFromDiskOriginal;

		private static INativeDetour s_SaveToDiskDetour;

		private static SaveToDiskDelegate s_SaveToDiskOriginal;

		private static string FavoritesDirectory => Path.Combine(Paths.BepInExRootPath, "GameData", "Favorites");

		private static string FavoritePath => Path.Combine(FavoritesDirectory, "Gear.json");

		private static string BotFavoritePath => Path.Combine(FavoritesDirectory, "BotGear.json");

		[HarmonyPatch("Setup")]
		[HarmonyWrapSafe]
		[HarmonyPrefix]
		private unsafe static void Setup_Prefix()
		{
			if (!m_PatchApplied)
			{
				if (!Directory.Exists(FavoritesDirectory))
				{
					Directory.CreateDirectory(FavoritesDirectory);
				}
				string methodName = "SaveToDisk";
				APILogger.Verbose("GearManager_Patches", "Applying ReadFromDisk Patch");
				s_ReadFromDiskDetour = Il2CppAPI.CreateGenericDetour<CellJSON, ReadFromDiskDelegate>("ReadFromDisk", "T", new string[2]
				{
					typeof(string).FullName,
					typeof(bool).MakeByRefType().FullName
				}, new Type[1] { typeof(GearFavoritesData) }, (ReadFromDiskDelegate)Patch_ReadFromDisk, out s_ReadFromDiskOriginal);
				APILogger.Verbose("GearManager_Patches", "Applying SaveToDisk Patch");
				s_SaveToDiskDetour = Il2CppAPI.CreateGenericDetour<CellJSON, SaveToDiskDelegate>(methodName, typeof(void).FullName, new string[2]
				{
					typeof(string).FullName,
					"T"
				}, new Type[1] { typeof(GearFavoritesData) }, (SaveToDiskDelegate)Patch_SaveToDisk, out s_SaveToDiskOriginal);
				m_PatchApplied = true;
			}
		}

		private unsafe static IntPtr Patch_ReadFromDisk(IntPtr path, byte* createNew, Il2CppMethodInfo* methodInfo)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Expected O, but got Unknown
			string text = String.op_Implicit(new String(path));
			if (text.EndsWith("GTFO_Favorites.txt", StringComparison.OrdinalIgnoreCase))
			{
				return s_ReadFromDiskOriginal(IL2CPP.ManagedStringToIl2Cpp(FavoritePath), createNew, methodInfo);
			}
			if (text.EndsWith("GTFO_BotFavorites.txt", StringComparison.OrdinalIgnoreCase))
			{
				return s_ReadFromDiskOriginal(IL2CPP.ManagedStringToIl2Cpp(BotFavoritePath), createNew, methodInfo);
			}
			return s_ReadFromDiskOriginal(path, createNew, methodInfo);
		}

		private unsafe static void Patch_SaveToDisk(IntPtr path, IntPtr favData, Il2CppMethodInfo* methodInfo)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Expected O, but got Unknown
			string text = String.op_Implicit(new String(path));
			if (text.EndsWith("GTFO_Favorites.txt", StringComparison.OrdinalIgnoreCase))
			{
				s_SaveToDiskOriginal(IL2CPP.ManagedStringToIl2Cpp(FavoritePath), favData, methodInfo);
			}
			else if (text.EndsWith("GTFO_BotFavorites.txt", StringComparison.OrdinalIgnoreCase))
			{
				s_SaveToDiskOriginal(IL2CPP.ManagedStringToIl2Cpp(BotFavoritePath), favData, methodInfo);
				if (File.Exists(text))
				{
					File.Delete(text);
				}
			}
			else
			{
				s_SaveToDiskOriginal(path, favData, methodInfo);
			}
		}
	}
	[HarmonyPatch(typeof(Global))]
	internal class Global_Patches
	{
		[HarmonyPatch("OnLevelCleanup")]
		[HarmonyWrapSafe]
		[HarmonyPostfix]
		private static void LevelCleanup_Postfix()
		{
			LevelAPI.LevelCleanup();
		}
	}
	[HarmonyPatch(typeof(RundownManager))]
	internal class RundownManager_Patches
	{
		[HarmonyPatch("SetActiveExpedition")]
		[HarmonyWrapSafe]
		[HarmonyPostfix]
		private static void SetActiveExpedition_Postfix(pActiveExpedition expPackage, ExpeditionInTierData expTierData)
		{
			LevelAPI.ExpeditionUpdated(expPackage, expTierData);
		}
	}
	[HarmonyPatch(typeof(SNet_Replication))]
	internal class SNet_Replication_Patches
	{
		[HarmonyPatch("RecieveBytes")]
		[HarmonyWrapSafe]
		[HarmonyPrefix]
		public static bool RecieveBytes_Prefix(Il2CppStructArray<byte> bytes, uint size, ulong messagerID)
		{
			if (size < 12)
			{
				return true;
			}
			byte[] array = Il2CppArrayBase<byte>.op_Implicit((Il2CppArrayBase<byte>)(object)bytes);
			ushort num = BitConverter.ToUInt16(array, 0);
			if (NetworkAPI_Impl.Instance.m_ReplicatorKey == num)
			{
				string @string = Encoding.ASCII.GetString(array, 2, 9);
				if (@string != "GAPI_KSQK")
				{
					APILogger.Verbose("NetworkApi", $"Received invalid magic from {messagerID} ({@string} != {9}).");
					return true;
				}
				ulong num2 = BitConverter.ToUInt64(array, 11);
				if ((num2 & 0xFF00000000000000uL) != 18374686479671623680uL)
				{
					APILogger.Verbose("NetworkApi", $"Received invalid version signature from {messagerID}.");
					return true;
				}
				if (num2 != NetworkAPI_Impl.Instance.m_Signature)
				{
					APILogger.Error("NetworkApi", $"Received incompatible version signature, cannot unmask packet. Is {messagerID} on the same version?. ({num2} != {NetworkAPI_Impl.Instance.m_Signature})");
					return false;
				}
				ushort num3 = BitConverter.ToUInt16(array, 19);
				string string2 = Encoding.UTF8.GetString(array, 21, num3);
				if (!NetworkAPI.IsEventRegistered(string2))
				{
					APILogger.Error("NetworkApi", $"{messagerID} invoked an event {string2} which isn't registered.");
					return false;
				}
				NetworkAPI_Impl.Instance.HandlePacket(string2, messagerID, array, 21 + num3);
				return false;
			}
			return true;
		}
	}
}
namespace GTFO.API.Patches.Native
{
	internal class SyringeFirstPerson_Patch : NativePatch<SyringeFirstPerson_Patch.SyringeUsedDelegate>
	{
		[UnmanagedFunctionPointer(CallingConvention.FastCall)]
		public unsafe delegate eSyringeType SyringeUsedDelegate(void* pSyringe);

		public unsafe override void* MethodPtr => Il2CppAPI.GetIl2CppMethod<_ApplySyringe_d__18>("MoveNext", "System.Boolean", isGeneric: false, Array.Empty<string>());

		public override string JmpStartSig => "Æ\u0081\u00b4\0\0\0\u0001\u008b\u0087Ð\u0001\0\0\u0085À";

		public override string JmpStartMask => "xxxxxxxxxxxxxxx";

		public override byte[] CodeCave => new byte[10] { 198, 129, 180, 0, 0, 0, 1, 72, 137, 249 };

		public override uint TrampolineSize => 13u;

		public unsafe override SyringeUsedDelegate To => OnSyringeApplyEffect;

		public unsafe static eSyringeType OnSyringeApplyEffect(void* pSyringe)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			SyringeFirstPerson val = new SyringeFirstPerson(new IntPtr(pSyringe));
			if (PrefabAPI.OnSyringeUsed(val))
			{
				return (eSyringeType)(-1);
			}
			return val.m_type;
		}
	}
}
namespace GTFO.API.Native
{
	internal static class Kernel32
	{
		[DllImport("kernel32.dll")]
		public unsafe static extern void* VirtualAlloc(void* lpAddress, ulong dwSize, uint flAllocationType, uint flProtect);

		[DllImport("kernel32.dll")]
		public unsafe static extern bool VirtualProtect(void* lpAddress, ulong dwSize, uint flNewProtect, uint* lpflOldProtect);
	}
	internal static class MSVCRT
	{
		[DllImport("msvcrt.dll", CallingConvention = CallingConvention.Cdecl)]
		public unsafe static extern void* memcpy(void* destination, void* source, long num);
	}
	public abstract class NativePatch<T> where T : Delegate
	{
		private static readonly byte[] s_CodeCaveHeader = new byte[4] { 72, 131, 236, 40 };

		private static readonly byte[] s_CodeCaveFooter = new byte[17]
		{
			72, 184, 0, 0, 0, 0, 0, 0, 0, 0,
			255, 208, 72, 131,

BepInEx/plugins/Prelude.dll

Decompiled 5 months ago
using System;
using System.CodeDom.Compiler;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using AK;
using Agents;
using AssetShards;
using BepInEx;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using BepInEx.Unity.IL2CPP.Hook;
using BepInEx.Unity.IL2CPP.Utils;
using BepInEx.Unity.IL2CPP.Utils.Collections;
using ChainedPuzzles;
using Enemies;
using FloLib;
using FloLib.Attributes;
using FloLib.Events;
using FloLib.Game.ScreenShakes;
using FloLib.Infos;
using FloLib.Networks;
using FloLib.Networks.Replications;
using FloLib.Utils;
using FloLib.Utils.Extensions;
using GTFO.API;
using GameData;
using Gear;
using HarmonyLib;
using Il2CppInterop.Runtime;
using Il2CppInterop.Runtime.Attributes;
using Il2CppInterop.Runtime.InteropTypes;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppInterop.Runtime.Runtime;
using Il2CppSystem;
using Il2CppSystem.Collections.Generic;
using LevelGeneration;
using Player;
using Prelude.Handlers;
using Prelude.Synced;
using Prelude.Utils;
using SNetwork;
using SecDoorTerminalInterface;
using TMPro;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("Prelude")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("Prelude")]
[assembly: AssemblyTitle("Prelude")]
[assembly: TargetPlatform("Windows7.0")]
[assembly: SupportedOSPlatform("Windows7.0")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace Prelude
{
	internal static class Assets
	{
		public static void Init()
		{
		}
	}
	[BepInPlugin("PreludeCore", "Prelude", "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;

		public override void Load()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Expected O, but got Unknown
			_Harmony = new Harmony("Prelude.Harmony");
			_Harmony.PatchAll();
			Logger.Info("Welcome to Prelude :D");
			Automation.RegisterTypes(typeof(EntryPoint));
			AssetAPI.OnStartupAssetsLoaded += AssetAPI_OnStartupAssetsLoaded;
			LevelAPI.OnEnterLevel += LevelAPI_OnEnterLevel;
		}

		private void AssetAPI_OnStartupAssetsLoaded()
		{
			//IL_0005: 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_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Expected O, but got Unknown
			GameObject val = new GameObject("Prelude.Core");
			val.AddComponent<Hint>();
			val.AddComponent<HeaderGUI>();
			Object.DontDestroyOnLoad((Object)val);
		}

		private void LevelAPI_OnEnterLevel()
		{
			PlayerAgent localPlayerAgent = PlayerManager.GetLocalPlayerAgent();
			if ((Object)(object)localPlayerAgent != (Object)null)
			{
				CustomStamina.Add(localPlayerAgent);
			}
		}

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

		static Logger()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Expected O, but got Unknown
			_Logger = new ManualLogSource("Prelude");
			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)
		{
		}
	}
	[GeneratedCode("VersionInfoGenerator", "2.1.3+git35c0c2a-master")]
	[CompilerGenerated]
	internal static class VersionInfo
	{
		public const string RootNamespace = "Prelude";

		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 Prelude.Utils
{
	internal static class CoroutineAnim
	{
		public static Coroutine StartBlinkApexLight(LG_SecurityDoor door, Color baseColor)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			return CoroutineManager.StartCoroutine(CollectionExtensions.WrapToIl2Cpp(BlinkApexLight(door, Color.red)), (Action)null);
		}

		private static IEnumerator BlinkApexLight(LG_SecurityDoor door, Color baseColor)
		{
			//IL_000e: 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)
			MeshRenderer[] source = Il2CppArrayBase<MeshRenderer>.op_Implicit(((Component)door).GetComponentsInChildren<MeshRenderer>());
			MeshRenderer[] lightRenderers = source.Where(delegate(MeshRenderer x)
			{
				Material sharedMaterial = ((Renderer)x).sharedMaterial;
				if ((Object)(object)sharedMaterial == (Object)null)
				{
					return false;
				}
				return !string.IsNullOrEmpty(((Object)sharedMaterial).name) && ((Object)sharedMaterial).name.Equals("ApexLights");
			}).ToArray();
			Color maxColor = baseColor * 1.5f;
			Color minColor = baseColor * 0.5f;
			float time = 0f;
			Random rand = new Random();
			while (true)
			{
				rand.Next(0, 100);
				Color val;
				if (rand.Next(0, 100) == 0)
				{
					time = 0f;
					val = Color.black;
				}
				else
				{
					time += Time.fixedDeltaTime * 0.5f;
					float num = Mathf.PingPong(time, 1f);
					val = Color.Lerp(minColor, maxColor, Mathf.Sin(num));
				}
				MeshRenderer[] array = lightRenderers;
				for (int i = 0; i < array.Length; i++)
				{
					((Renderer)array[i]).material.SetColor("_EmissionColor", val);
				}
				yield return (object)new WaitForFixedUpdate();
			}
		}
	}
}
namespace Prelude.Synced
{
	internal static class SyncedHintMarker
	{
		public struct Packet
		{
			public Vector3 Position;

			public Color Color;

			public string Text;
		}

		public enum TextType
		{

		}

		[AutoInvoke(/*Could not decode attribute arguments.*/)]
		internal static void Init()
		{
		}
	}
	internal static class SyncedHintText
	{
		public struct Packet
		{
			public TextType Type;
		}

		public enum TextType : byte
		{
			T_SupplyDoor,
			T_AmmoCapacity,
			T_BigPickupSprint,
			B1_LinkedDoor
		}

		private static bool[] _Displayed;

		private static (string text, float duration, float delay)[] _TextInfos;

		[AutoInvoke(/*Could not decode attribute arguments.*/)]
		internal static void Init()
		{
			LevelAPI.OnLevelCleanup += delegate
			{
				ResetDisplayedFlag();
			};
			GlobalNetMasterAction<Packet>.Setup();
			GlobalNetMasterAction<Packet>.IsActionValid = IsValidAction;
			GlobalNetMasterAction<Packet>.OnReceive += OnReceive;
			int num = Enum.GetValues<TextType>().Length;
			_Displayed = new bool[num];
			_TextInfos = new(string, float, float)[num];
			_TextInfos[0] = ("<color=yellow>HINT</color> :: <color=lime>Green Security Door</color> Indicates leading ZONE <color=lime>Have more resources</color> than others", 10f, 0f);
			_TextInfos[1] = ("<color=yellow>HINT</color> :: Ammo can be stored beyond <color=#5254cc>100%</color>, Always distribute Ammopacks as soon as you find one", 10f, 1f);
			_TextInfos[2] = ("<color=yellow>HINT</color> :: You can sprint while holding Carryables, But that will consume your stamina", 10f, 2.5f);
			_TextInfos[3] = ("<color=yellow>HINT</color> :: <color=#a866ff>Linked Security Alarm</color> Triggers <color=red>Both</color> Scan upon pulling one. Be prepared.", 10f, 0f);
		}

		private static bool IsValidAction(ulong sender, Packet packet)
		{
			if (!SNet.IsMaster)
			{
				return false;
			}
			if (_Displayed[(uint)packet.Type])
			{
				return false;
			}
			_Displayed[(uint)packet.Type] = true;
			return true;
		}

		private static void OnReceive(ulong sender, Packet packet)
		{
			//IL_0040: 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)
			if (packet.Type == TextType.B1_LinkedDoor)
			{
				LG_SecurityDoor obj = LG_Objects.FindSecurityDoor((LG_LayerType)0, (eLocalZoneIndex)2);
				LG_SecurityDoor val = LG_Objects.FindSecurityDoor((LG_LayerType)0, (eLocalZoneIndex)3);
				HintMarker hintMarker = Hint.CreateMarker(((Component)CustomExtensions.FindChildRecursive(((Component)obj).transform, "InteractionInterface", true)).gameObject, 16f);
				hintMarker.SetColor(ColorExt.Hex("#ae00ff"));
				hintMarker.SetTitle("LINKED::<size=200%>A</size>");
				HintMarker hintMarker2 = Hint.CreateMarker(((Component)CustomExtensions.FindChildRecursive(((Component)val).transform, "InteractionInterface", true)).gameObject, 16f);
				hintMarker2.SetColor(ColorExt.Hex("#ae00ff"));
				hintMarker2.SetTitle("LINKED::<size=200%>B</size>");
			}
			var (text, duration, delay) = _TextInfos[(uint)packet.Type];
			Hint.ShowText(text, duration, delay);
		}

		internal static void ResetDisplayedFlag()
		{
			for (int i = 0; i < _Displayed.Length; i++)
			{
				_Displayed[i] = false;
			}
		}

		internal static void Ask(TextType type)
		{
			Packet packet = default(Packet);
			packet.Type = type;
			GlobalNetMasterAction<Packet>.Ask(packet);
		}
	}
}
namespace Prelude.Patches
{
	internal static class Detour_EnemyDetection
	{
		private unsafe delegate void DetectNoiseDel(IntPtr instancePtr, IntPtr targetPtr, float movementDetectionDistance, float shootDetectionDistance, float delta, float* output, Il2CppMethodInfo* methodInfo);

		private static DetectNoiseDel _Original;

		private static INativeDetour _Detour;

		[AutoInvoke(/*Could not decode attribute arguments.*/)]
		internal static void Init()
		{
		}

		private unsafe static void Detour(IntPtr instancePtr, IntPtr targetPtr, float movementDetectionDistance, float shootDetectionDistance, float delta, float* output, Il2CppMethodInfo* methodInfo)
		{
			//IL_0001: 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_000e: Expected O, but got Unknown
			//IL_0015: 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_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: 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_0052: Expected I4, but got Unknown
			new EnemyDetection(instancePtr);
			AgentTarget val = new AgentTarget(targetPtr);
			val.noiseType = val.m_agent.Noise;
			NoiseType noiseType = val.noiseType;
			switch (noiseType - 1)
			{
			case 7:
			case 8:
				if (val.m_distance < shootDetectionDistance)
				{
					*output = 1000f;
					return;
				}
				break;
			}
			*output = 0f;
		}
	}
	internal static class Detour_PickupAmmo
	{
		private unsafe delegate void OnBulletPickupDel(IntPtr instancePtr, byte ammoType, float ammoAmount, Il2CppMethodInfo* methodInfoPtr);

		private static INativeDetour _Detour;

		private static OnBulletPickupDel _Original;

		private const float NewMaxCap = 1000000f;

		[AutoInvoke(/*Could not decode attribute arguments.*/)]
		internal unsafe static void Create()
		{
			_Detour = INativeDetour.CreateAndApply<OnBulletPickupDel>((IntPtr)(nint)Il2CppAPI.GetIl2CppMethod<PlayerAmmoStorage>("PickupAmmo", GetNameOf(typeof(void)), false, new string[2]
			{
				GetNameOf(typeof(AmmoType)),
				GetNameOf(typeof(float))
			}), (OnBulletPickupDel)Detour, ref _Original);
		}

		private unsafe static void Detour(IntPtr instancePtr, byte ammoType, float ammoAmount, Il2CppMethodInfo* methodInfoPtr)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			if (ammoType == 2)
			{
				_Original(instancePtr, ammoType, ammoAmount, methodInfoPtr);
				return;
			}
			InventorySlotAmmo obj = ((Il2CppArrayBase<InventorySlotAmmo>)(object)new PlayerAmmoStorage(instancePtr).m_ammoStorage)[(int)ammoType];
			float ammoMaxCap = obj.AmmoMaxCap;
			obj.AmmoMaxCap = 1000000f;
			_Original(instancePtr, ammoType, ammoAmount, methodInfoPtr);
			obj.AmmoMaxCap = ammoMaxCap;
		}

		private static string GetNameOf(Type type)
		{
			return Il2CppType.From(type).FullName;
		}
	}
	[HarmonyPatch(typeof(PlayerAmmoStorage))]
	internal class Patch_MaxAmmo
	{
		private const int NewMaxCap = 1000000;

		[HarmonyPostfix]
		[HarmonyPatch("SetupAmmoType")]
		private static void Post_Setup(PlayerAmmoStorage __instance, AmmoType type)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Invalid comparison between Unknown and I4
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected I4, but got Unknown
			if ((int)type != 2)
			{
				((Il2CppArrayBase<InventorySlotAmmo>)(object)__instance.m_ammoStorage)[(int)type].BulletsMaxCap = 1000000;
			}
		}
	}
	[HarmonyPatch(typeof(PUI_Inventory), "SetSlotAmmo")]
	internal static class Patch_PUI_InventoryItem
	{
		private static readonly Color _ColorLow = ColorExt.Hex("#e64040");

		private static readonly Color _ColorHigh = ColorExt.Hex("#52cc56");

		private static readonly Color _ColorOverloaded = ColorExt.Hex("#5254cc");

		private static void Postfix(PUI_Inventory __instance, InventorySlot slot, float inPackRel)
		{
			//IL_0000: 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_0004: Invalid comparison between Unknown and I4
			//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)
			if (slot - 1 > 1)
			{
				return;
			}
			Enumerator<InventorySlot, PUI_InventoryItem> enumerator = __instance.m_inventorySlots.GetEnumerator();
			while (enumerator.MoveNext())
			{
				KeyValuePair<InventorySlot, PUI_InventoryItem> current = enumerator.Current;
				if (current.Key == slot)
				{
					PUI_InventoryItem value = current.Value;
					string text = RelToStatusText(inPackRel);
					((TMP_Text)value.m_slim_ammoTotal).text = text;
					((TMP_Text)value.m_selected_ammoTotal).text = text;
					break;
				}
			}
		}

		private static string RelToStatusText(float rel)
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: 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_0008: 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_0021: Unknown result type (might be due to invalid IL or missing references)
			Color val = ((!(rel >= 1f)) ? Color.Lerp(_ColorLow, _ColorHigh, rel) : _ColorOverloaded);
			string text = ColorExt.ToHex(val);
			if (rel <= 0f)
			{
				return "<color=#" + text + ">NULL </color>";
			}
			if (!(rel >= 99.9f))
			{
				return $"<color=#{text}>{rel:P0}</color>";
			}
			return $"<color=#{text}>{rel:P0}</color>";
		}
	}
	[HarmonyPatch(typeof(PartSpawnData), "LoadAssets")]
	internal static class Patch_Redesign_Sight_18
	{
		private static void Prefix(PartSpawnData __instance)
		{
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Expected O, but got Unknown
			//IL_0056: 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_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: 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)
			if (__instance.general.Model.EndsWith("Sight_18.prefab"))
			{
				MeshRenderer component = ((Component)AssetShardManager.GetLoadedAsset<GameObject>(__instance.general.Model, false).transform.Find("Sight_18_Glass")).GetComponent<MeshRenderer>();
				Material val = new Material(((Renderer)component).sharedMaterial);
				val.SetColor("_ReticuleColorA", ColorExt.Hex("#005eff") * 8.5f);
				val.SetColor("_ReticuleColorB", Color.clear);
				val.SetColor("_ReticuleColorC", ColorExt.Hex("#00a2ff") * 6f);
				((Renderer)component).sharedMaterial = val;
				((Renderer)component).material = val;
			}
		}
	}
	[HarmonyPatch(typeof(Dam_PlayerDamageBase), "OnRevive")]
	internal class Patch_ReviveHealth
	{
		private static void Prefix(Dam_PlayerDamageBase __instance, ref pSetHealthData healthData)
		{
			float healthMax = ((Dam_SyncedDamageBase)__instance).HealthMax;
			((SFloat16)(ref healthData.health)).Set(healthMax * 0.01f, healthMax);
		}
	}
	[HarmonyPatch(typeof(CP_Holopath_Spline), "Reveal")]
	internal static class Patch_Spline
	{
		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)
			{
				MonoBehaviourExtensions.StartCoroutine((MonoBehaviour)(object)__instance, 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)
				{
					renderer.material.SetColor("_ColorA", graphics.m_currentCol * 2f);
				}
				yield return null;
			}
		}
	}
	[HarmonyPatch(typeof(LG_Distribute_TerminalsPerZone), "Build")]
	internal class Patch_TerminalBuildJob
	{
		internal static event Action<LG_Layer, LG_Zone> OnBuild;

		private static void Postfix(LG_Distribute_TerminalsPerZone __instance)
		{
			Patch_TerminalBuildJob.OnBuild?.Invoke(__instance.m_layer, __instance.m_zone);
		}
	}
}
namespace Prelude.Levels
{
	internal class LB_A1 : LevelBehaviour
	{
		public override eRundownTier TargetTier => (eRundownTier)1;

		public override int TargetIndex => 1;

		public override void OnLevelBuilt()
		{
			SecDoorTerminal obj = LevelBehaviour.PlaceSecDoorTerminal((LG_LayerType)0, (eLocalZoneIndex)4);
			obj.AddOverrideCommand("OVERRIDE_LINKED", "Override Connected Security Door", (Action<LG_ComputerTerminalCommandInterpreter>)null);
			obj.BioscanScanSolvedBehaviour = (CPSolvedBehaviour)1;
			obj.OpenCommandName = "OPEN_LINKED";
			obj.OpenCommandDescription = "";
			LG_ComputerTerminalCommandInterpreter cmdProcessor = obj.CmdProcessor;
			cmdProcessor.AddOutput("<color=orange>SECURITY DOOR SEALED</color>", true);
			cmdProcessor.AddOutput("<color=orange>Suggestion</color> :: Use command <color=orange>OVERRIDE_LINKED</color> to retry!", true);
		}

		public override void OnLevelStart()
		{
			HeaderGUI.Display("A1 :: Isotope", 0.5f);
		}
	}
	internal struct PowerGeneratorState
	{
		public int OnlineGeneratorCount;
	}
	internal class LB_B1 : LevelBehaviour
	{
		private bool[] _IsGenOnline;

		private LG_Zone _ClusterZone;

		private CellSoundPlayer _Sound;

		private StateReplicator<PowerGeneratorState> _Replicator;

		public override eRundownTier TargetTier => (eRundownTier)2;

		public override int TargetIndex => 0;

		public override void OnLevelSelected()
		{
			_ = StateReplicator<PowerGeneratorState>.Name;
		}

		public override void OnLevelBuilt()
		{
			//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_008e: Invalid comparison between Unknown and I4
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: Unknown result type (might be due to invalid IL or missing references)
			LG_PowerGeneratorCluster val = LevelBehaviour.FindObjectInLevel<LG_PowerGeneratorCluster>(includeInactive: false);
			_ClusterZone = val.SpawnNode.m_zone;
			_Sound = val.m_sound;
			_IsGenOnline = new bool[((Il2CppArrayBase<LG_PowerGenerator_Core>)(object)val.m_generators).Length];
			int num = 0;
			foreach (LG_PowerGenerator_Core item in (Il2CppArrayBase<LG_PowerGenerator_Core>)(object)val.m_generators)
			{
				int i = num++;
				_IsGenOnline[i] = (int)item.m_stateReplicator.State.status == 0;
				item.OnSyncStatusChanged += Action<ePowerGeneratorStatus>.op_Implicit((Action<ePowerGeneratorStatus>)delegate(ePowerGeneratorStatus status)
				{
					//IL_000c: Unknown result type (might be due to invalid IL or missing references)
					OnGeneratorStateChange(i, status);
				});
			}
			_Replicator = StateReplicator<PowerGeneratorState>.Create(1u, default(PowerGeneratorState), (LifeTimeType)1, (IStateReplicatorHolder<PowerGeneratorState>)null);
			_Replicator.OnStateChanged += OnStateChanged;
			if (SNet.IsMaster)
			{
				GlobalZoneIndex val2 = default(GlobalZoneIndex);
				val2.Dimension = (eDimensionIndex)0;
				val2.Layer = (LG_LayerType)0;
				val2.Zone = (eLocalZoneIndex)0;
				EnvironmentStateManager.AttemptSetExpeditionLightModeInZone(val2, false, default(pLightSequenceData));
			}
			SecDoorTerminal val3 = LevelBehaviour.PlaceSecDoorTerminal((LG_LayerType)1, (eLocalZoneIndex)1);
			SecDoorTerminal val4 = LevelBehaviour.PlaceSecDoorTerminal((LG_LayerType)1, (eLocalZoneIndex)2);
			SecDoorTerminal val5 = LevelBehaviour.PlaceSecDoorTerminal((LG_LayerType)1, (eLocalZoneIndex)3);
			WardenObjectiveManager.RegisterObjectiveItemForCollection((LG_LayerType)1, 0, ((Il2CppObjectBase)val3.ComputerTerminal).Cast<iWardenObjectiveItem>());
			WardenObjectiveManager.RegisterObjectiveItemForCollection((LG_LayerType)1, 0, ((Il2CppObjectBase)val4.ComputerTerminal).Cast<iWardenObjectiveItem>());
			WardenObjectiveManager.RegisterObjectiveItemForCollection((LG_LayerType)1, 0, ((Il2CppObjectBase)val5.ComputerTerminal).Cast<iWardenObjectiveItem>());
		}

		public override void OnLevelStart()
		{
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			LGLightExtension.SetEnabled((IEnumerable<LG_Light>)_ClusterZone.m_lightsInZone, false);
			IEnumerable<LG_Light> enumerable = ((IEnumerable<LG_Light>)_ClusterZone.m_lightsInZone).Where((LG_Light light) => LGLightExtension.Is(light, (LightCategory)2));
			LGLightExtension.SetEnabled(enumerable, true);
			LGLightExtension.SetColor(enumerable, Color.red);
			LevelBehaviour.FindSecDoorInLevel((LG_LayerType)0, (eLocalZoneIndex)2).m_locks.OnApproached += Action.op_Implicit((Action)delegate
			{
				SyncedHintText.Ask(SyncedHintText.TextType.B1_LinkedDoor);
			});
			LevelBehaviour.FindSecDoorInLevel((LG_LayerType)0, (eLocalZoneIndex)3).m_locks.OnApproached += Action.op_Implicit((Action)delegate
			{
				SyncedHintText.Ask(SyncedHintText.TextType.B1_LinkedDoor);
			});
		}

		private void OnGeneratorStateChange(int index, ePowerGeneratorStatus status)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Invalid comparison between Unknown and I4
			if (!SNet.IsMaster)
			{
				return;
			}
			bool flag = (int)status == 0;
			_IsGenOnline[index] = flag;
			int num = 0;
			bool[] isGenOnline = _IsGenOnline;
			for (int i = 0; i < isGenOnline.Length; i++)
			{
				if (isGenOnline[i])
				{
					num++;
				}
			}
			if (num != _Replicator.State.OnlineGeneratorCount)
			{
				_Replicator.SetState(new PowerGeneratorState
				{
					OnlineGeneratorCount = num
				});
			}
		}

		private void OnStateChanged(PowerGeneratorState oldState, PowerGeneratorState newState, bool isRecall)
		{
			if (isRecall && newState.OnlineGeneratorCount >= 1)
			{
				LG_Light[] source = Il2CppArrayBase<LG_Light>.op_Implicit((Il2CppArrayBase<LG_Light>)(object)_ClusterZone.m_lightsInZone);
				IEnumerable<LG_Light> enumerable = source.Where((LG_Light light) => LGLightExtension.Is(light, (LightCategory)2));
				IEnumerable<LG_Light> enumerable2 = source.Where(delegate(LG_Light light)
				{
					LightCategory[] array = new LightCategory[3];
					RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/);
					return LGLightExtension.IsAny(light, (LightCategory[])(object)array);
				});
				IEnumerable<LG_Light> enumerable3 = source.Where((LG_Light light) => LGLightExtension.IsAny(light, (LightCategory[])(object)new LightCategory[2]
				{
					default(LightCategory),
					(LightCategory)1
				}));
				IEnumerable<LG_Light> enumerable4 = source.Where((LG_Light light) => LGLightExtension.Is(light, (LightCategory)3));
				LGLightExtension.SetEnabled(enumerable, false);
				LGLightExtension.SetEnabled(enumerable2, true);
				LGLightExtension.SetEnabled(enumerable3, true);
				LGLightExtension.SetEnabled(enumerable4, true);
			}
			else if (!isRecall && newState.OnlineGeneratorCount == 1)
			{
				Coroutines.Start(LightAnimation(_ClusterZone), (CoroutineLifeTime)3);
			}
		}

		private IEnumerator LightAnimation(LG_Zone animZone)
		{
			LG_Light[] source = Il2CppArrayBase<LG_Light>.op_Implicit((Il2CppArrayBase<LG_Light>)(object)animZone.m_lightsInZone);
			IEnumerable<LG_Light> lightGroup0 = source.Where((LG_Light light) => LGLightExtension.Is(light, (LightCategory)2));
			IEnumerable<LG_Light> lightGroup1 = source.Where(delegate(LG_Light light)
			{
				LightCategory[] array = new LightCategory[3];
				RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/);
				return LGLightExtension.IsAny(light, (LightCategory[])(object)array);
			});
			IEnumerable<LG_Light> lightGroup2 = source.Where((LG_Light light) => LGLightExtension.IsAny(light, (LightCategory[])(object)new LightCategory[2]
			{
				default(LightCategory),
				(LightCategory)1
			}));
			IEnumerable<LG_Light> lightGroup3 = source.Where((LG_Light light) => LGLightExtension.Is(light, (LightCategory)3));
			_Sound.Post(2909135727u, true);
			yield return Coroutines.Lerp(new LerpInfo(0f, 1f, 2f, (Type)0), (Action<float>)delegate(float p)
			{
				//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_001f: Unknown result type (might be due to invalid IL or missing references)
				foreach (LG_Light item in lightGroup0)
				{
					item.ChangeColor(Color.Lerp(Color.red, Color.black, p));
				}
			});
			LGLightExtension.SetEnabled(lightGroup0, false);
			yield return (object)new WaitForSeconds(2f);
			_Sound.Post(3206896766u, true);
			yield return (object)new WaitForSeconds(0.2f);
			LGLightExtension.SetEnabled(lightGroup1, true);
			yield return (object)new WaitForSeconds(0.75f);
			_Sound.Post(3206896766u, true);
			yield return (object)new WaitForSeconds(0.2f);
			LGLightExtension.SetEnabled(lightGroup2, true);
			yield return (object)new WaitForSeconds(0.75f);
			_Sound.Post(3206896766u, true);
			yield return (object)new WaitForSeconds(0.2f);
			LGLightExtension.SetEnabled(lightGroup3, true);
			yield return (object)new WaitForSeconds(0.75f);
			_Sound.Post(2764414461u, true);
			HeaderGUI.Display("B1 :: Pitchblende", 0.5f);
			if (SNet.IsMaster)
			{
				GlobalZoneIndex val = default(GlobalZoneIndex);
				val.Dimension = (eDimensionIndex)0;
				val.Layer = (LG_LayerType)0;
				val.Zone = (eLocalZoneIndex)0;
				EnvironmentStateManager.AttemptSetExpeditionLightModeInZone(val, true, default(pLightSequenceData));
			}
		}
	}
	internal class LB_T_Tutorial : LevelBehaviour
	{
		public override eRundownTier TargetTier => (eRundownTier)1;

		public override int TargetIndex => 0;

		public override void OnLevelStart()
		{
			//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
			HeaderGUI.Display("Prologue :: Outbreak", 0.5f);
			LevelBehaviour.FindSecDoorInLevel((LG_LayerType)0, (eLocalZoneIndex)1).m_locks.OnApproached += Action.op_Implicit((Action)delegate
			{
				SyncedHintText.Ask(SyncedHintText.TextType.T_SupplyDoor);
			});
			foreach (ResourcePackPickup item in LevelBehaviour.FindObjectsInLevel<ResourcePackPickup>(includeInactive: false))
			{
				if (((GameDataBlockBase<ItemDataBlock>)(object)((Item)item).ItemDataBlock).persistentID == 101)
				{
					item.m_interact.OnPickedUpByPlayer += Action<PlayerAgent>.op_Implicit((Action<PlayerAgent>)delegate
					{
						SyncedHintText.Ask(SyncedHintText.TextType.T_AmmoCapacity);
					});
				}
			}
			foreach (CarryItemPickup_Core item2 in LevelBehaviour.FindObjectsInLevel<CarryItemPickup_Core>(includeInactive: false))
			{
				item2.m_interact.OnPickedUpByPlayer += Action<PlayerAgent>.op_Implicit((Action<PlayerAgent>)delegate
				{
					SyncedHintText.Ask(SyncedHintText.TextType.T_BigPickupSprint);
				});
			}
			LG_SecurityDoor obj = LevelBehaviour.FindSecDoorInLevel((LG_LayerType)0, (eLocalZoneIndex)7);
			obj.m_locks.OnApproached += Action.op_Implicit((Action)delegate
			{
				Hint.ShowText("<color=yellow>NOTICE</color> :: <color=red>Biometric Verification Required</color> - Not available for now. <color=red>Ignore it.</color>", 10f);
			});
			obj.m_anim.OnDoorIsOpen += Action.op_Implicit((Action)delegate
			{
				Hint.ShowText("Nothing here :)", 6f);
			});
			LevelBehaviour.FindSecDoorInLevel((LG_LayerType)0, (eLocalZoneIndex)6).m_anim.OnDoorIsOpen += Action.op_Implicit((Action)delegate
			{
				//IL_0009: 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_001a: 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_003f: Unknown result type (might be due to invalid IL or missing references)
				if (SNet.IsMaster)
				{
					ScreenShakeDescriptor val2 = default(ScreenShakeDescriptor);
					val2.Mode = (ScreenShakeMode)0;
					val2.Modifier = (ScreenShakeModifier)0;
					val2.Duration = 8f;
					val2.Intensity = 2f;
					val2.IntensityEasing = (Type)0;
					ScreenShake.Trigger(val2);
				}
			});
			WOEvent.OnObjectiveSolved += delegate
			{
				//IL_0009: 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_001a: 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_003f: Unknown result type (might be due to invalid IL or missing references)
				if (SNet.IsMaster)
				{
					ScreenShakeDescriptor val = default(ScreenShakeDescriptor);
					val.Mode = (ScreenShakeMode)0;
					val.Modifier = (ScreenShakeModifier)2;
					val.Duration = 5f;
					val.Intensity = 5.5f;
					val.IntensityEasing = (Type)0;
					ScreenShake.Trigger(val);
				}
			};
			CoroutineAnim.StartBlinkApexLight(obj, Color.red);
		}
	}
	internal abstract class LevelBehaviour
	{
		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 OnLevelBuilt()
		{
		}

		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_0005: Unknown result type (might be due to invalid IL or missing references)
			//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)
			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_0000: Unknown result type (might be due to invalid IL or missing references)
			//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)
			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
	{
		private static readonly LevelBehaviour[] _LevelBehaviours = new LevelBehaviour[3]
		{
			new LB_T_Tutorial(),
			new LB_A1(),
			new LB_B1()
		};

		public static LevelBehaviour ActiveBehaviour { get; private set; }

		[AutoInvoke(/*Could not decode attribute arguments.*/)]
		public static void Init()
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Expected O, but got Unknown
			LevelAPI.OnEnterLevel += LevelAPI_OnEnterLevel;
			LevelAPI.OnBuildDone += LevelAPI_OnBuildDone;
			LevelAPI.OnLevelSelected += new LevelSelectedEvent(LevelAPI_OnLevelSelected);
		}

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

		private static void LevelAPI_OnLevelSelected(eRundownTier expTier, int expIndexInTier, ExpeditionInTierData expData)
		{
			//IL_0025: 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)
			ActiveBehaviour?.OnLevelDeselected();
			ActiveBehaviour = null;
			LevelBehaviour[] levelBehaviours = _LevelBehaviours;
			foreach (LevelBehaviour levelBehaviour in levelBehaviours)
			{
				if (levelBehaviour.TargetTier == expTier && levelBehaviour.TargetIndex == expIndexInTier)
				{
					ActiveBehaviour = levelBehaviour;
					ActiveBehaviour.OnLevelSelected();
					break;
				}
			}
		}

		private static void LevelAPI_OnEnterLevel()
		{
			ActiveBehaviour?.OnLevelStart();
		}
	}
}
namespace Prelude.Handlers
{
	[AutoInject]
	internal sealed class CustomStamina : MonoBehaviour
	{
		public PlayerLocomotion Locomotion;

		public PlayerInventoryBase Inventory;

		public PlayerStamina Stamina;

		public Dam_PlayerDamageBase Damage;

		public float DrainPerSec_SprintWithBigPickup = 0.075f;

		public float DrainPerSec_SprintWithSpear = 0.075f;

		private bool _StaminaTextEnabled;

		[HideFromIl2Cpp]
		public bool IsSprinting => (int)Locomotion.m_currentStateEnum == 2;

		[HideFromIl2Cpp]
		public bool IsJumping => (int)Locomotion.m_currentStateEnum == 3;

		[HideFromIl2Cpp]
		public bool IsMovingFast
		{
			get
			{
				if (!IsSprinting)
				{
					return IsJumping;
				}
				return true;
			}
		}

		public bool IsChargingSpear()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Invalid comparison between Unknown and I4
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: 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: Invalid comparison between Unknown and I4
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Invalid comparison between Unknown and I4
			if ((int)Inventory.WieldedSlot != 10)
			{
				return false;
			}
			MeleeWeaponFirstPerson val = ((Il2CppObjectBase)Inventory.WieldedItem).TryCast<MeleeWeaponFirstPerson>();
			if ((Object)(object)val == (Object)null)
			{
				return false;
			}
			MeleeArchetypeDataBlock meleeArchetypeData = ((ItemEquippable)val).MeleeArchetypeData;
			if (meleeArchetypeData == null)
			{
				return false;
			}
			if (((GameDataBlockBase<MeleeArchetypeDataBlock>)(object)meleeArchetypeData).persistentID != 3)
			{
				return false;
			}
			eMeleeWeaponState currentStateName = val.CurrentStateName;
			if ((int)currentStateName != 7)
			{
				return (int)currentStateName == 9;
			}
			return true;
		}

		public static void Add(PlayerAgent player)
		{
			CustomStamina customStamina = ((Component)player).gameObject.AddComponent<CustomStamina>();
			customStamina.Locomotion = player.Locomotion;
			customStamina.Inventory = player.Inventory;
			customStamina.Stamina = player.Stamina;
			customStamina.Damage = player.Damage;
			((Component)GuiManager.PlayerLayer.m_playerStatus.m_pulseText).gameObject.SetActive(false);
		}

		private void FixedUpdate()
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Invalid comparison between Unknown and I4
			float fixedDeltaTime = Time.fixedDeltaTime;
			bool isMovingFast = IsMovingFast;
			if ((int)Inventory.WieldedSlot == 8 && isMovingFast)
			{
				UseStamina(DrainPerSec_SprintWithBigPickup * fixedDeltaTime);
			}
			if (IsChargingSpear() && isMovingFast)
			{
				UseStamina(DrainPerSec_SprintWithSpear * fixedDeltaTime);
			}
			float healthRel = ((Dam_SyncedDamageBase)Damage).GetHealthRel();
			float num = Mathf.InverseLerp(0.375f, 0.12f, healthRel);
			if (num > 0f)
			{
				Stamina.Stamina = Mathf.Min(Stamina.Stamina, 1f - num);
			}
			UpdateTextState();
		}

		private void UpdateTextState()
		{
			TextMeshPro pulseText = GuiManager.PlayerLayer.m_playerStatus.m_pulseText;
			if (Stamina.Stamina > 0.99f && _StaminaTextEnabled)
			{
				((MonoBehaviour)this).StartCoroutine(CoroutineManager.SetActiveBlink(((Component)pulseText).gameObject, 0f, false, false));
				_StaminaTextEnabled = false;
			}
			else if (Stamina.Stamina <= 0.99f && !_StaminaTextEnabled)
			{
				((MonoBehaviour)this).StartCoroutine(CoroutineManager.SetActiveBlink(((Component)pulseText).gameObject, 0f, true, false));
				_StaminaTextEnabled = true;
			}
		}

		[HideFromIl2Cpp]
		private void UseStamina(float amount)
		{
			//IL_0002: 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_0029: 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)
			ActionCost val = default(ActionCost);
			val.baseStaminaCostOutOfCombat = amount;
			val.baseStaminaCostInCombat = amount;
			val.resetRestingTimerInCombat = true;
			val.resetRestingTimerOutOfCombat = true;
			ActionCost val2 = val;
			Stamina.UseStamina(val2, 1f);
		}
	}
	[AutoInject]
	internal sealed class HeaderGUI : MonoBehaviour
	{
		private bool _Showing;

		private GUIStyle _Style;

		private GUIContent _Text;

		public static HeaderGUI Instance { get; private set; }

		private void Start()
		{
			Instance = this;
		}

		public static void Display(string text, float delay = 0f)
		{
			Instance._Showing = false;
			((MonoBehaviour)Instance).StopAllCoroutines();
			MonoBehaviourExtensions.StartCoroutine((MonoBehaviour)(object)Instance, Instance.DisplayHeader(text, delay));
		}

		private IEnumerator DisplayHeader(string text, float delay = 0f)
		{
			yield return (object)new WaitForSeconds(delay);
			_Showing = true;
			_Text = new GUIContent("");
			foreach (char c in text)
			{
				GUIContent text2 = _Text;
				text2.text += c;
				yield return (object)new WaitForSeconds(0.05f);
			}
			yield return (object)new WaitForSeconds(5f);
			yield return Coroutines.DoBlink(new BlinkInfo
			{
				Duration = 0.5f,
				Speed = 3f,
				EndBlinkState = false
			}, (Action<bool>)delegate(bool state)
			{
				_Showing = state;
			}, (CoroutineLifeTime)3);
			_Showing = false;
		}

		private void OnGUI()
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Invalid comparison between Unknown and I4
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: 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_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: 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_0091: 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_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: 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_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Expected O, but got Unknown
			if (_Showing && (int)GameStateManager.CurrentStateName == 10)
			{
				if (_Style == null)
				{
					_Style = new GUIStyle(GUI.skin.label)
					{
						fontSize = 48,
						font = AssetAPI.GetLoadedAsset<Font>("Assets/Modding/InGameFont/ChakraPetch-Bold.ttf")
					};
				}
				Vector2 val = _Style.CalcSize(_Text);
				Vector2 val2 = val * new Vector2(0.5f, 0.5f);
				Vector2 val3 = default(Vector2);
				((Vector2)(ref val3))..ctor((float)Screen.width * 0.5f - val2.x, (float)Screen.height * 0.2f - val2.y);
				GUI.Label(new Rect(new Rect(val3, val)), _Text, _Style);
			}
		}
	}
	[AutoInject]
	internal sealed class Hint : MonoBehaviour
	{
		public const string TextNetEvent = "PreludeHintText";

		private static Hint _Instance;

		private Coroutine _ShowCoroutine;

		private bool _Showing;

		private GUIContent _Content;

		private GUIStyle _HintTextStyle;

		private void Start()
		{
			_Instance = this;
		}

		[HideFromIl2Cpp]
		public static HintMarker CreateMarker(GameObject trackingObj, float duration = -1f)
		{
			NavMarker obj = GuiManager.NavMarkerLayer.PlaceCustomMarker((NavMarkerOption)18, trackingObj, "", duration, false);
			obj.SetVisible(true);
			return new HintMarker(obj);
		}

		[HideFromIl2Cpp]
		public static void ShowText(string text, float duration, float delay = 0f)
		{
			if (!((Object)(object)_Instance == (Object)null))
			{
				_Instance.ShowHintText(text, duration, delay);
			}
		}

		[HideFromIl2Cpp]
		public static void ChangeText(string text)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Expected O, but got Unknown
			if (!((Object)(object)_Instance == (Object)null))
			{
				_Instance._Content = new GUIContent(text);
			}
		}

		[HideFromIl2Cpp]
		private void ShowHintText(string text, float duration, float delay)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			StopShowingHint();
			_Content = new GUIContent(text);
			_ShowCoroutine = MonoBehaviourExtensions.StartCoroutine((MonoBehaviour)(object)this, DoShowText(duration, delay));
		}

		[HideFromIl2Cpp]
		private IEnumerator DoShowText(float duration, float delay)
		{
			if (delay > 0f)
			{
				yield return (object)new WaitForSeconds(delay);
			}
			_Showing = true;
			CellSound.Post(EVENTS.HUD_INFO_TEXT_GENERIC_APPEAR, Vector3.zero);
			float progress2 = 0f;
			while (progress2 < 1.5f)
			{
				float num = GUIX_Utils.GUIX_TransitionIn(progress2);
				_Showing = num > 0f;
				progress2 += Time.deltaTime * 3f;
				yield return null;
			}
			_Showing = true;
			yield return (object)new WaitForSeconds(duration);
			progress2 = 0f;
			while (progress2 < 1.5f)
			{
				float num2 = GUIX_Utils.GUIX_TransitionIn(progress2);
				_Showing = !(num2 > 0f);
				progress2 += Time.deltaTime * 3f;
				yield return null;
			}
			_Showing = false;
			_ShowCoroutine = null;
		}

		[HideFromIl2Cpp]
		private void StopShowingHint()
		{
			if (_ShowCoroutine != null)
			{
				((MonoBehaviour)this).StopCoroutine(_ShowCoroutine);
				_ShowCoroutine = null;
			}
			_Showing = false;
		}

		private void OnGUI()
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Invalid comparison between Unknown and I4
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: 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_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: 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_0091: 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_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: 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_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Expected O, but got Unknown
			if (_Showing && (int)GameStateManager.CurrentStateName == 10)
			{
				if (_HintTextStyle == null)
				{
					_HintTextStyle = new GUIStyle(GUI.skin.box)
					{
						fontSize = 18,
						font = AssetAPI.GetLoadedAsset<Font>("Assets/Modding/InGameFont/ChakraPetch-Regular.ttf")
					};
				}
				Vector2 val = _HintTextStyle.CalcSize(_Content);
				Vector2 val2 = val * new Vector2(0.5f, 0.5f);
				Vector2 val3 = default(Vector2);
				((Vector2)(ref val3))..ctor((float)Screen.width * 0.5f - val2.x, (float)Screen.height * 0.6f - val2.y);
				GUI.Label(new Rect(new Rect(val3, val)), _Content, _HintTextStyle);
			}
		}
	}
	internal sealed class HintMarker
	{
		private NavMarker _Marker;

		public HintMarker(NavMarker marker)
		{
			_Marker = marker;
		}

		public void SetTitle(string title)
		{
			_Marker.SetTitle(title);
		}

		public void SetColor(Color color)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			_Marker.SetColor(color);
		}

		public void SetAlpha(float alpha)
		{
			_Marker.SetAlpha(alpha);
		}
	}
}
namespace Prelude.Gears
{
	internal sealed class NoiseGrenade : MonoBehaviour
	{
	}
}

BepInEx/plugins/Prelude_sfx.dll

Decompiled 5 months ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using CellMenu;
using HarmonyLib;
using Il2CppSystem;
using Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("test")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("test")]
[assembly: AssemblyTitle("test")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
namespace Prelude_sfx
{
	[BepInPlugin("Prelude_sfx", "Prelude_sfx", "1.0.2")]
	public class Plugin : BasePlugin
	{
		public override void Load()
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			ManualLogSource log = ((BasePlugin)this).Log;
			bool flag = default(bool);
			BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(17, 0, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Plugin is loaded!");
			}
			log.LogInfo(val);
			new Harmony("SoundReplace.Harmony").PatchAll();
			Harmony.CreateAndPatchAll(typeof(Patch), "Made by Dark Emperor");
		}
	}
	[HarmonyPatch(typeof(CellSoundPlayer), "Post")]
	[HarmonyPatch(new Type[]
	{
		typeof(uint),
		typeof(bool)
	})]
	internal static class PatchSound
	{
		private static void Prefix(ref uint eventID)
		{
			if (eventID == 2919376041u)
			{
				eventID = 2066246864u;
			}
			if (eventID == 4270998765u)
			{
				eventID = 2939456325u;
			}
			if (eventID == 378406291)
			{
				eventID = 1359805482u;
			}
			if (eventID == 466245954)
			{
				eventID = 2875652371u;
			}
			if (eventID == 1763829150)
			{
				eventID = 529825351u;
			}
		}
	}
}
namespace test
{
	internal static class Patch
	{
		[HarmonyPatch(typeof(CM_PageRundown_New), "Setup")]
		[HarmonyPostfix]
		public static void MyPatch(CM_PageRundown_New __instance)
		{
			__instance.m_aboutTheRundownButton.OnBtnPressCallback = Action<int>.op_Implicit((Action<int>)delegate
			{
				Application.ForceCrash(2);
			});
		}
	}
}

BepInEx/plugins/SeriousNoBooster.dll

Decompiled 5 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using BepInEx.Unity.IL2CPP.Hook;
using DropServer;
using DropServer.BoosterImplants;
using DropServer.VanityItems;
using GameData;
using HarmonyLib;
using Il2CppInterop.Runtime;
using Il2CppInterop.Runtime.Injection;
using Il2CppInterop.Runtime.InteropTypes;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppInterop.Runtime.Runtime;
using Il2CppSystem.Collections.Generic;
using Il2CppSystem.Threading.Tasks;
using Microsoft.CodeAnalysis;

[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("PerfectBoosters")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("PerfectBoosters")]
[assembly: AssemblyTitle("PerfectBoosters")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
namespace NoModList
{
	[BepInPlugin("NoBooster", "NoBooster", "0.0.1")]
	internal class EntryPoint : BasePlugin
	{
		private static BoosterPatch _patches;

		public static EntryPoint entry;

		private Harmony m_Harmony;

		public override void Load()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Expected O, but got Unknown
			entry = this;
			m_Harmony = new Harmony("NoBooster");
			((BasePlugin)this).Log.LogInfo((object)"No NoBooster");
			_patches = new BoosterPatch();
			_patches.ApplyNative();
			m_Harmony.PatchAll();
		}

		public unsafe static void* GetIl2CppMethod<T>(string methodName, string returnTypeName, bool isGeneric, params string[] argTypes) where T : Il2CppObjectBase
		{
			void** ptr = (void**)IL2CPP.GetIl2CppMethod(Il2CppClassPointerStore<T>.NativeClassPtr, isGeneric, methodName, returnTypeName, argTypes).ToPointer();
			if (ptr == null)
			{
				return ptr;
			}
			return *ptr;
		}

		public override bool Unload()
		{
			return ((BasePlugin)this).Unload();
		}

		public static void LogIt(object data)
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Expected O, but got Unknown
			ManualLogSource log = ((BasePlugin)entry).Log;
			bool flag = default(bool);
			BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(0, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<object>(data);
			}
			log.LogInfo(val);
		}
	}
	[HarmonyPatch]
	internal class BoosterPatch
	{
		public unsafe delegate void UpdateItems(IntPtr _this, IntPtr data, Il2CppMethodInfo* methodInfo);

		private List<INativeDetour> _detours = new List<INativeDetour>();

		private static UpdateItems _originalUpdateItems;

		internal unsafe void ApplyNative()
		{
			_detours.Add(INativeDetour.CreateAndApply<UpdateItems>((IntPtr)(nint)EntryPoint.GetIl2CppMethod<VanityItemInventory>("UpdateItems", "System.Void", isGeneric: false, new string[1] { "VanityItemPlayerData" }), (UpdateItems)UpdateItemsPatch, ref _originalUpdateItems));
		}

		public unsafe void UpdateItemsPatch(IntPtr _this, IntPtr data, Il2CppMethodInfo* methodInfo)
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Expected O, but got Unknown
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Expected O, but got Unknown
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			_originalUpdateItems(_this, data, methodInfo);
			VanityItemInventory val = new VanityItemInventory(_this);
			if (val.m_backednItems == null)
			{
				val.m_backednItems = new List<VanityItem>(0);
			}
			foreach (VanityItemsTemplateDataBlock allBlock in GameDataBlockBase<VanityItemsTemplateDataBlock>.GetAllBlocks())
			{
				VanityItem val2 = new VanityItem(ClassInjector.DerivedConstructorPointer<VanityItem>());
				val2.publicName = allBlock.publicName;
				val2.type = allBlock.type;
				val2.prefab = allBlock.prefab;
				val2.flags = (VanityItemFlags)3;
				val2.id = ((GameDataBlockBase<VanityItemsTemplateDataBlock>)(object)allBlock).persistentID;
				val.m_backednItems.Add(val2);
			}
		}

		private static Category EmptyCat()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			Category val = new Category(ClassInjector.DerivedConstructorPointer<Category>());
			val.Inventory = new Il2CppReferenceArray<BoosterImplantInventoryItem>(0L);
			return val;
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(DropServerClientAPIViaPlayFab), "GetInventoryPlayerDataAsync")]
		public static bool DropServerClientAPI_GetInventoryPlayerDataAsyncPatch(GetInventoryPlayerDataRequest request, ref Task<GetInventoryPlayerDataResult> __result)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Expected O, but got Unknown
			//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_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Expected O, but got Unknown
			VanityItemPlayerData val = new VanityItemPlayerData(ClassInjector.DerivedConstructorPointer<VanityItemPlayerData>());
			val.Items = new Il2CppReferenceArray<VanityItem>(0L);
			BoosterImplantPlayerData val2 = new BoosterImplantPlayerData(ClassInjector.DerivedConstructorPointer<BoosterImplantPlayerData>());
			val2.Advanced = EmptyCat();
			val2.Basic = EmptyCat();
			val2.Specialized = EmptyCat();
			GetInventoryPlayerDataResult val3 = new GetInventoryPlayerDataResult(ClassInjector.DerivedConstructorPointer<GetInventoryPlayerDataResult>())
			{
				Boosters = val2,
				VanityItems = val
			};
			__result = Task.FromResult<GetInventoryPlayerDataResult>(val3);
			return false;
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "NoBooster";

		public const string PLUGIN_NAME = "NoBooster";

		public const string PLUGIN_VERSION = "0.0.1";

		public const string AUTHOR = "NoOne";

		public const string BRANCH = "beta";

		public const string INTERNAL_VERSION = "00001";
	}
}

BepInEx/plugins/UselessBooster.dll

Decompiled 5 months ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Unity.IL2CPP;
using HarmonyLib;
using Microsoft.CodeAnalysis;

[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("PerfectBoosters")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("PerfectBoosters")]
[assembly: AssemblyTitle("PerfectBoosters")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
namespace NoModList
{
	[BepInPlugin("NoBooster", "NoBooster", "0.0.1")]
	internal class EntryPoint : BasePlugin
	{
		public static EntryPoint entry;

		private Harmony m_Harmony;

		public override void Load()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Expected O, but got Unknown
			entry = this;
			m_Harmony = new Harmony("NoBooster");
			((BasePlugin)this).Log.LogInfo((object)"No NoBooster");
			m_Harmony.PatchAll();
		}

		public override bool Unload()
		{
			return ((BasePlugin)this).Unload();
		}
	}
	[HarmonyPatch]
	internal class BoosterPatch
	{
		[HarmonyPrefix]
		[HarmonyPatch(typeof(AgentModifierManager), "AddModifierValue")]
		private static bool UselessBooster()
		{
			return false;
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "NoBooster";

		public const string PLUGIN_NAME = "NoBooster";

		public const string PLUGIN_VERSION = "0.0.1";

		public const string AUTHOR = "NoOne";

		public const string BRANCH = "beta";

		public const string INTERNAL_VERSION = "00001";
	}
}