Decompiled source of ImprovedREPO v1.0.4

BepInEx/plugins/Cronchy-DeathHeadHopper/DeathHeadHopper.dll

Decompiled 2 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using DeathHeadHopper.Abilities;
using DeathHeadHopper.Abilities.Charge;
using DeathHeadHopper.DeathHead;
using DeathHeadHopper.DeathHead.Handlers;
using DeathHeadHopper.Helpers;
using DeathHeadHopper.Managers;
using DeathHeadHopper.Models;
using DeathHeadHopper.UI;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Photon.Pun;
using Photon.Realtime;
using REPOLib.Modules;
using TMPro;
using Unity.VisualScripting;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.Rendering;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: IgnoresAccessChecksTo("Autodesk.Fbx")]
[assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")]
[assembly: IgnoresAccessChecksTo("FbxBuildTestAssets")]
[assembly: IgnoresAccessChecksTo("Klattersynth")]
[assembly: IgnoresAccessChecksTo("Photon3Unity3D")]
[assembly: IgnoresAccessChecksTo("PhotonChat")]
[assembly: IgnoresAccessChecksTo("PhotonRealtime")]
[assembly: IgnoresAccessChecksTo("PhotonUnityNetworking")]
[assembly: IgnoresAccessChecksTo("PhotonUnityNetworking.Utilities")]
[assembly: IgnoresAccessChecksTo("PhotonVoice.API")]
[assembly: IgnoresAccessChecksTo("PhotonVoice")]
[assembly: IgnoresAccessChecksTo("PhotonVoice.PUN")]
[assembly: IgnoresAccessChecksTo("SingularityGroup.HotReload.Runtime")]
[assembly: IgnoresAccessChecksTo("SingularityGroup.HotReload.Runtime.Public")]
[assembly: IgnoresAccessChecksTo("Sirenix.OdinInspector.Attributes")]
[assembly: IgnoresAccessChecksTo("Sirenix.Serialization.Config")]
[assembly: IgnoresAccessChecksTo("Sirenix.Serialization")]
[assembly: IgnoresAccessChecksTo("Sirenix.Utilities")]
[assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")]
[assembly: IgnoresAccessChecksTo("Unity.Formats.Fbx.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")]
[assembly: IgnoresAccessChecksTo("Unity.Postprocessing.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")]
[assembly: IgnoresAccessChecksTo("Unity.Timeline")]
[assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Antlr3.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Core")]
[assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Flow")]
[assembly: IgnoresAccessChecksTo("Unity.VisualScripting.State")]
[assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.UI")]
[assembly: IgnoresAccessChecksTo("websocket-sharp")]
[assembly: AssemblyCompany("Cronchy")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("2.0.0.0")]
[assembly: AssemblyInformationalVersion("2.0.0+a6973b3777e554cc8d5accb19d396e4bf891f831")]
[assembly: AssemblyProduct("DeathHeadHopper")]
[assembly: AssemblyTitle("DeathHeadHopper")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("2.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

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

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

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

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace DeathHeadHopper
{
	[BepInPlugin("Cronchy.DeathHeadHopper", "DeathHeadHopper", "2.0.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class DeathHeadHopper : BaseUnityPlugin
	{
		internal static DeathHeadHopper Instance { get; private set; }

		internal static Version Version { get; private set; }

		internal static ManualLogSource Logger => Instance._logger;

		private ManualLogSource _logger => ((BaseUnityPlugin)this).Logger;

		internal Harmony? Harmony { get; set; }

		internal void Awake()
		{
			Instance = this;
			Version = ((BaseUnityPlugin)this).Info.Metadata.Version;
			((Component)this).gameObject.transform.parent = null;
			((Object)((Component)this).gameObject).hideFlags = (HideFlags)61;
			DHHConfigManager.BindConfig(((BaseUnityPlugin)this).Config);
			Patch();
			DHHAssetManager.LoadAssets();
			Logger.LogInfo((object)$"{((BaseUnityPlugin)this).Info.Metadata.GUID} v{((BaseUnityPlugin)this).Info.Metadata.Version} has loaded!");
		}

		internal void Patch()
		{
			//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_0020: Expected O, but got Unknown
			//IL_0025: Expected O, but got Unknown
			if (Harmony == null)
			{
				Harmony val = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID);
				Harmony val2 = val;
				Harmony = val;
			}
			Harmony.PatchAll();
		}

		internal void Unpatch()
		{
			Harmony? harmony = Harmony;
			if (harmony != null)
			{
				harmony.UnpatchSelf();
			}
		}
	}
}
namespace DeathHeadHopper.UI
{
	public class AbilityCooldown : MonoBehaviour
	{
		private float startCooldown;

		private float cooldownTimer;

		private Image cooldownIcon;

		protected void Awake()
		{
			cooldownIcon = ((Component)this).GetComponent<Image>();
		}

		protected void Update()
		{
			if (cooldownTimer > 0f)
			{
				cooldownTimer = Mathf.Max(cooldownTimer - Time.deltaTime, 0f);
				UpdateCooldownCircle();
			}
		}

		public void SetCooldown(float cooldown)
		{
			startCooldown = (cooldownTimer = cooldown);
		}

		private void UpdateCooldownCircle()
		{
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			cooldownIcon.fillAmount = -1f / startCooldown * cooldownTimer + 1f;
			if (cooldownIcon.fillAmount < 1f)
			{
				Color color = ((Graphic)cooldownIcon).color;
				color.a = 0.3f;
				((Graphic)cooldownIcon).color = color;
			}
			else
			{
				Color color2 = ((Graphic)cooldownIcon).color;
				color2.a = 1f;
				((Graphic)cooldownIcon).color = color2;
			}
		}
	}
	public class AbilityEnergyUI : SemiUI
	{
		public static AbilityEnergyUI instance;

		public TextMeshProUGUI textCurrent;

		public TextMeshProUGUI textMax;

		public float energyLerpSpeed = 5f;

		private float energyLerp;

		private float actualEnergy;

		private float maxEnergy;

		private Transform? scanlines;

		protected void Awake()
		{
			instance = this;
		}

		public override void Start()
		{
			((SemiUI)this).Start();
			base.uiText = null;
			Transform obj = DHHUIManager.instance.gameHUD.transform.Find("Energy");
			scanlines = ((obj != null) ? obj.Find("Scanlines") : null);
			if (scanlines != null)
			{
				Object.Instantiate<Transform>(scanlines, ((Component)this).transform);
			}
		}

		public override void Update()
		{
			if (LevelGenerator.Instance.Generated)
			{
				((SemiUI)this).Update();
				((SemiUI)this).Hide();
			}
			if ((Object)(object)SpectateCamera.instance == (Object)null || (Object)(object)SpectateCamera.instance.player == (Object)null || (Object)(object)SpectateCamera.instance.player.playerDeathHead == (Object)null || !SpectateCamera.instance.CheckState((State)1))
			{
				return;
			}
			DeathHeadController component = ((Component)SpectateCamera.instance.player.playerDeathHead).GetComponent<DeathHeadController>();
			if ((Object)(object)component != (Object)null && component.deathHead.triggered)
			{
				actualEnergy = component.abilityEnergyHandler.Energy;
				maxEnergy = component.abilityEnergyHandler.energyMax;
			}
			if (actualEnergy != energyLerp)
			{
				energyLerp = Mathf.Lerp(energyLerp, actualEnergy, Time.deltaTime * energyLerpSpeed);
				if (Mathf.Abs(actualEnergy - energyLerp) < 0.3f)
				{
					energyLerp = actualEnergy;
				}
			}
			((TMP_Text)textCurrent).text = Mathf.Floor(energyLerp).ToString();
			((TMP_Text)textMax).text = "<b><color=orange>/</color></b>" + Mathf.Floor(maxEnergy);
		}
	}
	public class AbilitySpot : SemiUI
	{
		public int abilitySpotIndex;

		public TextMeshProUGUI noAbility;

		public TextMeshProUGUI energyCost;

		public TextMeshProUGUI level;

		public Image backgroundIcon;

		private AbilityCooldown cooldownUI;

		private Image cooldownIcon;

		internal float lastUseTime;

		private AbilityBase? _currentAbility;

		public AbilityBase? CurrentAbility
		{
			get
			{
				return _currentAbility;
			}
			private set
			{
				_currentAbility = value;
			}
		}

		protected void Awake()
		{
			cooldownUI = ((Component)this).GetComponentInChildren<AbilityCooldown>();
			cooldownIcon = ((Component)cooldownUI).GetComponent<Image>();
		}

		public override void Start()
		{
			UpdateUI();
			((SemiUI)this).Start();
			base.uiText = null;
			SetIcon(null);
			if (SemiFunc.RunIsLevel() || SemiFunc.RunIsShop())
			{
				DHHAbilityManager.instance.SetAbilitySpotAtIndex(this, abilitySpotIndex);
			}
		}

		public void SetIcon(Sprite? sprite)
		{
			if (!Object.op_Implicit((Object)(object)sprite))
			{
				((Behaviour)backgroundIcon).enabled = false;
				((Behaviour)cooldownIcon).enabled = false;
				((Behaviour)noAbility).enabled = true;
			}
			else
			{
				((Behaviour)backgroundIcon).enabled = true;
				backgroundIcon.sprite = sprite;
				((Behaviour)cooldownIcon).enabled = true;
				cooldownIcon.sprite = sprite;
				((Behaviour)noAbility).enabled = false;
			}
		}

		public void UpdateUI()
		{
			if (CurrentAbility != null)
			{
				((SemiUI)this).SemiUISpringScale(0.5f, 2f, 0.2f);
				SetIcon(CurrentAbility.icon);
				((Behaviour)level).enabled = true;
			}
			else
			{
				SetIcon(null);
				((SemiUI)this).SemiUISpringScale(0.5f, 2f, 0.2f);
				((Behaviour)level).enabled = false;
			}
		}

		public void EquipAbility(AbilityBase ability)
		{
			CurrentAbility = ability;
			((TMP_Text)energyCost).text = CurrentAbility.EnergyCost.ToString();
			UpdateUI();
		}

		public void RemoveAbility()
		{
			CurrentAbility = null;
			((TMP_Text)energyCost).text = "0";
			UpdateUI();
		}

		public override void Update()
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			if (CurrentAbility == null)
			{
				((SemiUI)this).SemiUIScoot(new Vector2(0f, -20f));
			}
			else
			{
				((TMP_Text)level).text = $"LV. {CurrentAbility.AbilityLevel}";
			}
			((SemiUI)this).Update();
		}

		public void SetCooldown(float cooldown)
		{
			cooldownUI.SetCooldown(cooldown);
		}
	}
	public class AbilityUI : SemiUI
	{
		public static AbilityUI instance;

		protected void Awake()
		{
			instance = this;
		}

		public override void Start()
		{
			((SemiUI)this).Start();
			base.uiText = null;
		}

		public override void Update()
		{
			if (LevelGenerator.Instance.Generated)
			{
				((SemiUI)this).Update();
				((SemiUI)this).Hide();
			}
		}
	}
}
namespace DeathHeadHopper.Patches
{
	[HarmonyPatch(typeof(GameDirector))]
	public static class GameDirectorPatch
	{
		[HarmonyPatch("gameStateLoad")]
		[HarmonyPrefix]
		public static void GameStateLoad_Prefix()
		{
			//IL_0012: 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)
			if ((Object)(object)DHHStatsManager.instance == (Object)null)
			{
				new GameObject("DHHStatsManager").AddComponent<DHHStatsManager>();
			}
			if (SemiFunc.RunIsLevel() || SemiFunc.RunIsShop())
			{
				if ((Object)(object)DHHPunManager.instance == (Object)null || (Object)(object)((Component)DHHPunManager.instance).gameObject == (Object)null)
				{
					DHHPunManager dHHPunManager = new GameObject("DHHPunManager").AddComponent<DHHPunManager>();
					dHHPunManager.VersionCheck();
				}
				else if ((Object)(object)((Component)DHHPunManager.instance).GetComponent<PhotonView>() == (Object)null)
				{
					DHHPunManager.instance.EnsurePhotonView();
				}
			}
		}

		[HarmonyPatch("gameStateStart")]
		[HarmonyPostfix]
		public static void GameStateStart_Postfix()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Invalid comparison between Unknown and I4
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Expected O, but got Unknown
			if ((int)GameDirector.instance.currentState != 2 || (!SemiFunc.RunIsLevel() && !SemiFunc.RunIsShop()))
			{
				return;
			}
			string text = "DHHInputManager";
			if (((Object)((Component)PlayerAvatar.instance.spectatePoint).gameObject).name == text)
			{
				DeathHeadHopper.Logger.LogDebug((object)"Player already has DeathHeadHopper enabled");
				return;
			}
			new GameObject("DHHAbilityManager").AddComponent<DHHAbilityManager>();
			new GameObject("DHHUIManager").AddComponent<DHHUIManager>();
			DeathHeadHopper.Logger.LogDebug((object)"Creating DeathHeadHopper object instance...");
			DHHFunc.DeathHeadHopperObj = new GameObject(text);
			if (DHHFunc.DeathHeadHopperObj == null)
			{
				DeathHeadHopper.Logger.LogError((object)"Failed to create DeathHeadHopper object instance :(");
				return;
			}
			DHHFunc.DeathHeadHopperObj.SetActive(false);
			DHHFunc.DeathHeadHopperObj.AddComponent<DHHInputManager>();
			DHHFunc.DeathHeadHopperObj.transform.SetParent(((Component)PlayerAvatar.instance).transform.parent, false);
			DeathHeadHopper.Logger.LogDebug((object)"DeathHeadHopper object instance created!");
			foreach (PlayerAvatar player in GameDirector.instance.PlayerList)
			{
				ComponentHolderProtocol.AddComponent<DeathHeadController>((Object)(object)player.playerDeathHead);
			}
			DeathHeadHopper.Logger.LogDebug((object)"Added DeathHeadController to player heads!");
		}

		[HarmonyPatch("Revive")]
		[HarmonyPrefix]
		private static void Revive_Prefix()
		{
			if (DHHFunc.DeathHeadHopperObj != null && DHHFunc.DeathHeadHopperObj.activeSelf)
			{
				DeathHeadHopper.Logger.LogInfo((object)"You are revived! Disabling DeathHeadHopper");
				DHHFunc.DeathHeadHopperObj.SetActive(false);
			}
		}
	}
	[HarmonyPatch(typeof(LevelGenerator))]
	public class LevelGeneratorPatch
	{
		[HarmonyPatch("ItemSetup")]
		[HarmonyPrefix]
		public static void ItemSetup_Prefix()
		{
			if (SemiFunc.IsMultiplayer())
			{
				foreach (KeyValuePair<string, Item> shopItem in DHHAssetManager.shopItems)
				{
					if (!StatsManager.instance.itemDictionary.ContainsKey(shopItem.Key))
					{
						StatsManager.instance.itemDictionary.Add(shopItem.Key, shopItem.Value);
					}
				}
				return;
			}
			foreach (string key in DHHAssetManager.shopItems.Keys)
			{
				if (StatsManager.instance.itemDictionary.ContainsKey(key))
				{
					StatsManager.instance.itemDictionary.Remove(key);
				}
			}
		}
	}
	[HarmonyPatch(typeof(PunManager))]
	public class PunManagerPatch
	{
		[HarmonyPatch("ShopPopulateItemVolumes")]
		[HarmonyPrefix]
		public static void ShopPopulateItemVolumes_Prefix(PunManager __instance)
		{
			DHHShopManager.ShopPopulateItemVolumes(__instance);
		}
	}
	[HarmonyPatch(typeof(SemiIconMaker))]
	public class SemiIconMakerPatch
	{
		[HarmonyPatch("CreateIconFromRenderTexture")]
		[HarmonyPrefix]
		public static void CreateIconFromRenderTexture_Prefix(SemiIconMaker __instance)
		{
			if ((Object)(object)__instance.iconCamera.targetTexture == (Object)null)
			{
				__instance.iconCamera.targetTexture = __instance.renderTexture;
			}
		}
	}
	[HarmonyPatch(typeof(ShopManager))]
	public static class ShopManagerPatch
	{
		[HarmonyPatch("GetAllItemVolumesInScene")]
		[HarmonyPostfix]
		public static void GetAllItemVolumesInScene_Postfix()
		{
			DHHPunManager.instance.LoadShopAtticShelves();
		}

		[HarmonyPatch("GetAllItemsFromStatsManager")]
		[HarmonyPostfix]
		public static void GetAllItemsFromStatsManager_Postfix()
		{
			DHHShopManager.LoadItems();
		}
	}
	[HarmonyPatch(typeof(SpectateCamera))]
	internal static class SpectateCameraPatch
	{
		private static readonly FieldInfo f_isDisabled = AccessTools.Field(typeof(PlayerAvatar), "isDisabled");

		private static readonly MethodInfo m_inputDown = AccessTools.Method(typeof(SemiFunc), "InputDown", (Type[])null, (Type[])null);

		private static readonly MethodInfo m_playerSwitch = AccessTools.Method(typeof(SpectateCamera), "PlayerSwitch", (Type[])null, (Type[])null);

		private static readonly MethodInfo m_componentTransform = AccessTools.Method(typeof(Component), "get_transform", (Type[])null, (Type[])null);

		private static readonly MethodInfo m_transformPosition = AccessTools.Method(typeof(Transform), "get_position", (Type[])null, (Type[])null);

		private static readonly FieldInfo f_vector3Y = AccessTools.Field(typeof(Vector3), "y");

		[HarmonyPatch("LateUpdate")]
		[HarmonyPostfix]
		private static void LateUpdate_Postfix()
		{
			DeathHeadController deathHeadController = default(DeathHeadController);
			if ((SemiFunc.RunIsLevel() || SemiFunc.RunIsShop()) && MenuManager.instance.currentMenuState == 1 && ((Component)PlayerAvatar.instance.playerDeathHead).TryGetComponent<DeathHeadController>(ref deathHeadController) && deathHeadController.spectated && DHHAbilityManager.instance.HasEquippedAbility())
			{
				((SemiUI)AbilityUI.instance).Show();
				((SemiUI)AbilityEnergyUI.instance).Show();
			}
		}

		[HarmonyPatch("StateNormal")]
		[HarmonyPrefix]
		private static void StateNormal_Prefix()
		{
			if ((SemiFunc.RunIsLevel() || SemiFunc.RunIsShop()) && Object.op_Implicit((Object)(object)DHHFunc.DeathHeadHopperObj) && DHHFunc.DeathHeadHopperObj != null && !DHHFunc.DeathHeadHopperObj.activeSelf)
			{
				DeathHeadHopper.Logger.LogInfo((object)"You died! Enabling DeathHeadHopper");
				DHHFunc.DeathHeadHopperObj.SetActive(true);
			}
		}

		[HarmonyPatch("PlayerSwitch")]
		[HarmonyTranspiler]
		private static IEnumerable<CodeInstruction> PlayerSwitch_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
		{
			//IL_014a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0150: Expected O, but got Unknown
			//IL_0189: Unknown result type (might be due to invalid IL or missing references)
			//IL_018f: Expected O, but got Unknown
			List<CodeInstruction> list = instructions.ToList();
			int num = list.FindIndex((CodeInstruction ci) => CodeInstructionExtensions.LoadsField(ci, f_isDisabled, false));
			if (num <= 0 || !(list[num + 1].operand is Label item))
			{
				return instructions;
			}
			DeathHeadHopper.Logger.LogDebug((object)string.Format("{0} index: {1}", "PlayerSwitch_Transpiler", num));
			int num2 = list.FindIndex(num, (CodeInstruction ci) => ci.opcode == OpCodes.Ret);
			if (num2 <= 0)
			{
				DeathHeadHopper.Logger.LogError((object)"Could not find playerAvatar.isDisabled check in PlayerSwitch");
				return instructions;
			}
			DeathHeadHopper.Logger.LogDebug((object)string.Format("{0} returnIndex: {1}", "PlayerSwitch_Transpiler", num2));
			DeathHeadHopper.Logger.LogDebug((object)"Found playerAvatar.isDisabled check in PlayerSwitch, replacing code instructions");
			Label label = generator.DefineLabel();
			list[num2 + 1].labels.Add(label);
			list[num2 + 1].labels.Remove(item);
			list[num + 1].opcode = OpCodes.Brfalse_S;
			list[num + 2].labels.Add(item);
			list.InsertRange(num + 2, (IEnumerable<CodeInstruction>)(object)new CodeInstruction[3]
			{
				new CodeInstruction(OpCodes.Ldloc_3, (object)null),
				CodeInstruction.Call(typeof(DHHFunc), "IsDeathHeadSpectatable", new Type[1] { typeof(PlayerAvatar) }, (Type[])null),
				new CodeInstruction(OpCodes.Brfalse, (object)label)
			});
			return list.AsEnumerable();
		}

		[HarmonyPatch("StateNormal")]
		[HarmonyTranspiler]
		private static IEnumerable<CodeInstruction> StateNormal_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
		{
			//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b2: Expected O, but got Unknown
			//IL_01f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f6: Expected O, but got Unknown
			List<CodeInstruction> list = instructions.ToList();
			int num = list.FindIndex((CodeInstruction ci) => CodeInstructionExtensions.Calls(ci, m_inputDown)) - 1;
			if (num <= 0 || list[num].opcode != OpCodes.Ldc_I4_1)
			{
				return instructions;
			}
			DeathHeadHopper.Logger.LogDebug((object)string.Format("{0} start: {1}", "StateNormal_Transpiler", num));
			int num2 = list.FindIndex(num, (CodeInstruction ci) => CodeInstructionExtensions.Calls(ci, m_playerSwitch));
			if (num2 == -1)
			{
				return instructions;
			}
			DeathHeadHopper.Logger.LogDebug((object)string.Format("{0} end: {1}", "StateNormal_Transpiler", num2));
			DeathHeadHopper.Logger.LogDebug((object)"Found jump check in StateNormal, removing code instructions");
			CodeInstruction val = list[num];
			val.opcode = OpCodes.Nop;
			list.RemoveRange(num + 1, num2 - num);
			int num3 = -1;
			for (int i = 0; i < list.Count; i++)
			{
				if (CodeInstructionExtensions.IsLdarg(list[i], (int?)0) && CodeInstructionExtensions.Calls(list[i + 1], m_componentTransform) && CodeInstructionExtensions.Calls(list[i + 2], m_transformPosition) && CodeInstructionExtensions.LoadsField(list[i + 3], f_vector3Y, false))
				{
					num3 = i;
					break;
				}
			}
			if (num3 < 0)
			{
				DeathHeadHopper.Logger.LogWarning((object)"Camera Y lock not found in StateNormal");
				return list.AsEnumerable();
			}
			DeathHeadHopper.Logger.LogDebug((object)"Adding player is disabled check to camera Y lock in StateNormal");
			Label label = generator.DefineLabel();
			val.labels.Add(label);
			list.InsertRange(num3, (IEnumerable<CodeInstruction>)(object)new CodeInstruction[4]
			{
				new CodeInstruction(OpCodes.Ldarg_0, (object)null),
				CodeInstruction.LoadField(typeof(SpectateCamera), "player", false),
				CodeInstruction.LoadField(typeof(PlayerAvatar), "isDisabled", false),
				new CodeInstruction(OpCodes.Brtrue, (object)label)
			});
			return list.AsEnumerable();
		}

		[HarmonyPatch("StateNormal")]
		[HarmonyPrefix]
		private static void StateNormal_Prefix(SpectateCamera __instance, out float __state)
		{
			__state = __instance.normalAimVertical;
		}

		[HarmonyPatch("StateNormal")]
		[HarmonyPostfix]
		private static void StateNormal_Postfix(SpectateCamera __instance, float __state)
		{
		}
	}
}
namespace DeathHeadHopper.Models
{
	public class Tether : MonoBehaviour
	{
		public Vector3 origin;

		public Vector3 point;

		public Color tetherStartColor;

		public Color tetherEndColor;

		public float curveSpeed;

		public int curveResolution;

		public float colorInterpolation;

		public bool curveEnabled;

		public float width;

		[Header("Texture Scrolling")]
		public Vector2 scrollSpeed;

		private Vector3 curvePointSmooth;

		private LineRenderer lineRenderer;

		[HideInInspector]
		public Material lineMaterial;

		protected void Awake()
		{
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			lineRenderer = ((Component)this).gameObject.AddComponent<LineRenderer>();
			LineRenderer component = ((Component)PlayerAvatar.instance).GetComponent<PhysGrabber>().physGrabBeam.gameObject.GetComponent<LineRenderer>();
			((Renderer)lineRenderer).material = ((Renderer)component).material;
			lineRenderer.textureMode = component.textureMode;
			((Renderer)lineRenderer).shadowCastingMode = (ShadowCastingMode)0;
			lineMaterial = ((Renderer)lineRenderer).material;
		}

		protected void Start()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			//IL_0033: 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)
			ResetCurvePointSmooth();
			AnimationCurve val = new AnimationCurve();
			val.AddKey(0f, 0f);
			val.AddKey(new Keyframe(0.1f, width, 0f, 0f));
			val.AddKey(new Keyframe(0.9f, width * 0.64f, 0f, 0f));
			val.AddKey(1f, width * 0.45f);
			lineRenderer.widthCurve = val;
		}

		protected void LateUpdate()
		{
			DrawLine();
			ScrollTexture();
		}

		internal void ResetCurvePointSmooth()
		{
			//IL_0002: 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_0017: 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)
			curvePointSmooth = (origin + point) / 2f;
		}

		private void DrawLine()
		{
			//IL_0016: 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_0021: 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)
			//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_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: 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_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			float num = curveSpeed;
			if (!curveEnabled)
			{
				num = 20f;
			}
			Vector3 val = (origin + point) / 2f;
			Vector3[] array = (Vector3[])(object)new Vector3[curveResolution];
			curvePointSmooth = Vector3.Lerp(curvePointSmooth, val, Time.deltaTime * num);
			for (int i = 0; i < curveResolution; i++)
			{
				float t = (float)i / ((float)curveResolution - 1f);
				array[i] = CalculateBezierPoint(t, origin, curvePointSmooth, point);
			}
			lineRenderer.positionCount = curveResolution;
			lineRenderer.SetPositions(array);
		}

		private Vector3 CalculateBezierPoint(float t, Vector3 p0, Vector3 p1, Vector3 p2)
		{
			//IL_0011: 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_0026: 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)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			return Mathf.Pow(1f - t, 2f) * p0 + 2f * (1f - t) * t * p1 + Mathf.Pow(t, 2f) * p2;
		}

		private void ScrollTexture()
		{
			//IL_0020: 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_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: 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_008a: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)lineMaterial))
			{
				lineMaterial.mainTextureScale = new Vector2(1f, 1f);
				Vector2 mainTextureOffset = Time.time * scrollSpeed;
				lineMaterial.mainTextureOffset = mainTextureOffset;
				lineMaterial.color = Color.Lerp(tetherStartColor, tetherEndColor, colorInterpolation);
				lineMaterial.EnableKeyword("_EMISSION");
				lineMaterial.SetColor("_EmissionColor", lineMaterial.color);
			}
		}

		public Tether()
		{
			//IL_0016: 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_0022: 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_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: 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_00a3: Unknown result type (might be due to invalid IL or missing references)
			Color val = default(Color);
			tetherStartColor = (Color)(ColorUtility.TryParseHtmlString("#00C4FD", ref val) ? new Color(val.r, val.g, val.b, 0.1f) : Color.blue);
			Color val2 = default(Color);
			tetherEndColor = (Color)(ColorUtility.TryParseHtmlString("#E70A17", ref val2) ? new Color(val2.r, val2.g, val2.b, 0.4f) : Color.red);
			curveSpeed = 2f;
			curveResolution = 20;
			curveEnabled = true;
			width = 0.11f;
			scrollSpeed = new Vector2(4f, 0f);
			((MonoBehaviour)this)..ctor();
		}
	}
}
namespace DeathHeadHopper.Managers
{
	public class DHHAbilityManager : MonoBehaviour
	{
		internal static List<AbilityBase> abilities = new List<AbilityBase>();

		internal const int abilitySlots = 3;

		internal bool spotsFeched;

		private readonly AbilitySpot[] abilitySpots = new AbilitySpot[3];

		private AbilitySpot? currentAbilitySpotDown;

		private AbilitySpot? currentAbilitySpot;

		private Dictionary<InputKey, int> inputKeyToAbilitySpot = new Dictionary<InputKey, int>
		{
			{
				(InputKey)19,
				0
			},
			{
				(InputKey)20,
				1
			},
			{
				(InputKey)21,
				2
			}
		};

		internal static DHHAbilityManager instance { get; private set; }

		internal static ChargeAbility ChargeAbility => (ChargeAbility)abilities.First((AbilityBase x) => x is ChargeAbility);

		protected void Awake()
		{
			instance = this;
		}

		protected void Start()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			DHHStatsManager.instance.m_LocalPlayerUpgrade.AddListener(new UnityAction(EquipAbilities));
		}

		protected void Update()
		{
			//IL_001e: 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_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: 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)
			if (!spotsFeched)
			{
				return;
			}
			foreach (InputKey key in inputKeyToAbilitySpot.Keys)
			{
				AbilitySpot abilitySpot = abilitySpots[inputKeyToAbilitySpot[key]];
				if (SemiFunc.InputDown(key) && currentAbilitySpotDown == null)
				{
					HandleInputDown(abilitySpot);
				}
				else if (SemiFunc.InputHold(key) && (Object)(object)currentAbilitySpotDown == (Object)(object)abilitySpot)
				{
					HandleInputHold(abilitySpot);
				}
				else if (SemiFunc.InputUp(key) && (Object)(object)currentAbilitySpotDown == (Object)(object)abilitySpot)
				{
					HandleInputUp(abilitySpot);
				}
			}
			if (currentAbilitySpot != null && (SemiFunc.InputDown((InputKey)1) || SemiFunc.InputDown((InputKey)24) || SemiFunc.InputDown((InputKey)23)))
			{
				currentAbilitySpot.CurrentAbility?.OnAbilityCancel();
				currentAbilitySpot = null;
			}
		}

		internal void EquipAbilities()
		{
			if (spotsFeched)
			{
				int headChargeUpgrade = DHHStatsManager.GetHeadChargeUpgrade(PlayerAvatar.instance.steamID);
				if (headChargeUpgrade > 0)
				{
					EquipAbility(ChargeAbility);
				}
				else
				{
					RemoveAbility(ChargeAbility);
				}
			}
		}

		public void EquipAbility(AbilityBase ability)
		{
			AbilityBase ability2 = ability;
			if (abilitySpots.Any((AbilitySpot x) => (Object)(object)x.CurrentAbility == (Object)(object)ability2))
			{
				DeathHeadHopper.Logger.LogDebug((object)("Ability " + ability2.AbilityName + " already equipped"));
				return;
			}
			AbilitySpot[] array = abilitySpots;
			foreach (AbilitySpot abilitySpot in array)
			{
				if ((Object)(object)abilitySpot.CurrentAbility == (Object)null)
				{
					DeathHeadHopper.Logger.LogDebug((object)$"Equipping {ability2.AbilityName} to spot {Array.IndexOf(abilitySpots, abilitySpot) + 1}");
					abilitySpot.EquipAbility(ability2);
					ability2.m_AbilityUsedLocal.AddListener((UnityAction<AbilityBase>)OnAbilityUsed);
					break;
				}
			}
		}

		public void RemoveAbility(AbilityBase ability)
		{
			AbilityBase ability2 = ability;
			AbilitySpot abilitySpot = abilitySpots.FirstOrDefault((AbilitySpot x) => (Object)(object)x.CurrentAbility == (Object)(object)ability2);
			if ((Object)(object)abilitySpot != (Object)null)
			{
				DeathHeadHopper.Logger.LogDebug((object)$"Removing {ability2.AbilityName} from spot {Array.IndexOf(abilitySpots, abilitySpot) + 1}");
				abilitySpot.RemoveAbility();
				ability2.m_AbilityUsedLocal.RemoveListener((UnityAction<AbilityBase>)OnAbilityUsed);
			}
		}

		internal bool HasEquippedAbility()
		{
			if (!spotsFeched)
			{
				return false;
			}
			AbilitySpot[] array = abilitySpots;
			for (int i = 0; i < array.Length; i++)
			{
				if ((Object)(object)array[i]?.CurrentAbility != (Object)null)
				{
					return true;
				}
			}
			return false;
		}

		internal void SetAbilitySpotAtIndex(AbilitySpot spot, int index)
		{
			if (SemiFunc.RunIsLevel() || SemiFunc.RunIsShop())
			{
				abilitySpots[index] = spot;
				if (abilitySpots.Count((AbilitySpot spot) => (Object)(object)spot != (Object)null) == 3)
				{
					spotsFeched = true;
					EquipAbilities();
				}
			}
		}

		private void HandleInputDown(AbilitySpot abilitySpot)
		{
			if (abilitySpot.CurrentAbility != null)
			{
				abilitySpot.CurrentAbility.OnAbilityDown();
				currentAbilitySpotDown = abilitySpot;
				if (currentAbilitySpot != null && (Object)(object)currentAbilitySpot != (Object)(object)abilitySpot)
				{
					currentAbilitySpot.CurrentAbility?.OnAbilityCancel();
				}
				currentAbilitySpot = abilitySpot;
			}
		}

		private void HandleInputHold(AbilitySpot abilitySpot)
		{
			abilitySpot.CurrentAbility?.OnAbilityHold();
		}

		private void HandleInputUp(AbilitySpot abilitySpot)
		{
			abilitySpot.lastUseTime = Time.time;
			abilitySpot.CurrentAbility?.OnAbilityUp();
			currentAbilitySpotDown = null;
		}

		private void OnAbilityUsed(AbilityBase ability)
		{
			DeathHeadController localDeathHeadController = DHHFunc.GetLocalDeathHeadController();
			if (localDeathHeadController != null)
			{
				GetAbilitySpot(ability)?.SetCooldown(ability.Cooldown);
			}
			currentAbilitySpot = null;
		}

		private AbilitySpot? GetAbilitySpot(AbilityBase ability)
		{
			AbilitySpot[] array = abilitySpots;
			foreach (AbilitySpot abilitySpot in array)
			{
				if ((Object)(object)abilitySpot.CurrentAbility == (Object)(object)ability)
				{
					return abilitySpot;
				}
			}
			return null;
		}
	}
	public static class DHHAssetManager
	{
		public static Material headPhaseMaterial = null;

		internal static readonly Dictionary<string, Item> shopItems = new Dictionary<string, Item>();

		private const string _mainAssetBundle = "deathheadhopper";

		public static void LoadAssets()
		{
			DeathHeadHopper.Logger.LogInfo((object)"Loading Assets...");
			AssetBundle val = LoadAssetBundle("deathheadhopper");
			if ((Object)(object)val == (Object)null)
			{
				DeathHeadHopper.Logger.LogError((object)"Failed to load asset bundle :(");
				return;
			}
			headPhaseMaterial = val.LoadAsset<Material>("Assets/DeathHeadHopper/Materials/Head Phase.mat");
			LoadItems(val);
			LoadAbilities(val);
			DHHShopManager.shopAtticShelvesPrefab = val.LoadAsset<GameObject>("Assets/DeathHeadHopper/Shop Attic Shelves.prefab");
			DHHUIManager.abilityUIPrefab = val.LoadAsset<GameObject>("Assets/DeathHeadHopper/Ability UI.prefab");
			LoadChargeAssets(val);
		}

		private static AssetBundle LoadAssetBundle(string name)
		{
			DeathHeadHopper.Logger.LogDebug((object)("DeathHeadHopper: Loading Asset Bundle: " + name));
			string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), name);
			return AssetBundle.LoadFromFile(text);
		}

		private static void LoadItems(AssetBundle assetBundle)
		{
			foreach (string item in from x in assetBundle.GetAllAssetNames()
				where x.ToLower().Contains("/items/") && x.EndsWith(".asset")
				select x)
			{
				Item val = assetBundle.LoadAsset<Item>(item);
				if ((Object)(object)val == (Object)null)
				{
					DeathHeadHopper.Logger.LogError((object)("Failed to load item; " + item + " :("));
					continue;
				}
				string text = item.Replace(".asset", ".prefab");
				val.prefab = assetBundle.LoadAsset<GameObject>(text);
				if ((Object)(object)val.prefab == (Object)null)
				{
					DeathHeadHopper.Logger.LogError((object)("Failed to load item prefab; " + text + " :("));
					continue;
				}
				DeathHeadHopper.Logger.LogDebug((object)("Loaded item: " + val.itemName));
				shopItems.Add(val.itemAssetName, val);
				Items.RegisterItem(val);
			}
		}

		private static void LoadAbilities(AssetBundle assetBundle)
		{
			foreach (string item in from x in assetBundle.GetAllAssetNames()
				where x.ToLower().Contains("/abilities/") && x.EndsWith(".asset")
				select x)
			{
				AbilityBase abilityBase = assetBundle.LoadAsset<AbilityBase>(item);
				if ((Object)(object)abilityBase == (Object)null)
				{
					DeathHeadHopper.Logger.LogError((object)("Failed to load ability " + item + " :("));
					continue;
				}
				DeathHeadHopper.Logger.LogDebug((object)("Loaded ability " + item));
				DHHAbilityManager.abilities.Add(abilityBase);
			}
		}

		private static void LoadChargeAssets(AssetBundle assetBundle)
		{
			ChargeEffects.prefab = assetBundle.LoadAsset<GameObject>("Assets/DeathHeadHopper/Abilities/Charge/Charge Effects.prefab");
		}
	}
	public static class DHHConfigManager
	{
		public static ConfigEntry<bool> flashLightFlicker;

		public static ConfigEntry<AnchorMode> anchorMode;

		public static ConfigEntry<bool> itemsAppearInShop;

		public static void BindConfig(ConfigFile Config)
		{
			DeathHeadHopper.Logger.LogInfo((object)"Binding Config...");
			string text = "General";
			string text2 = "Host Client Config";
			flashLightFlicker = Config.Bind<bool>(text, "FlashlightFlicker", true, "The head flickers its flashlight to indicate when something is wrong.");
			anchorMode = Config.Bind<AnchorMode>(text2, "AnchorMode", AnchorMode.ExtractionPointsCompleted, "Always anchor head with a tether | anchor once the last extraction point is completed | never anchor.");
			itemsAppearInShop = Config.Bind<bool>(text2, "ItemsAppearInShop", true, "Enable DeathHeadHopper items in the shop");
			RemoveOrphanedEntries(Config);
		}

		public static void RemoveOrphanedEntries(ConfigFile Config)
		{
			HashSet<string> hashSet = Config.Keys.Select((ConfigDefinition x) => x.Key).ToHashSet();
			Dictionary<int, string> orphanedEntries = new Dictionary<int, string>();
			string[] array = File.ReadAllLines(Config.ConfigFilePath);
			bool result = default(bool);
			for (int j = 0; j < array.Length; j++)
			{
				string text = array[j];
				string[] array2 = text.Split(new char[1] { '=' }, 2);
				if (array2.Length != 2)
				{
					continue;
				}
				string text2 = array2[0].Trim();
				string value = array2[1].Trim();
				if (!hashSet.Contains(text2))
				{
					if (text2 == "AnchorOnAllStages" && bool.TryParse(value, out result) && result)
					{
						DeathHeadHopper.Logger.LogWarning((object)("Config entry " + text2 + " is deprecated, loading value into new config entry " + ((ConfigEntryBase)anchorMode).Definition.Key));
						anchorMode.Value = AnchorMode.Always;
						Config.Save();
					}
					orphanedEntries.Add(j, text2);
				}
			}
			if (orphanedEntries.Count > 0)
			{
				DeathHeadHopper.Logger.LogWarning((object)("Removing orphaned " + string.Join(", ", orphanedEntries.Values) + " from config file"));
				string[] contents = File.ReadAllLines(Config.ConfigFilePath).Where((string _, int i) => !orphanedEntries.Keys.Contains(i)).ToArray();
				File.WriteAllLines(Config.ConfigFilePath, contents);
				Config.Reload();
			}
		}
	}
	public class DHHInputManager : MonoBehaviour
	{
		public Vector3 spectateOffset = new Vector3(0f, 0.6f, 0f);

		public float lowChargePitch = 0.8f;

		public float highChargePitch = 1.4f;

		private PlayerDeathHead deathHead;

		private Transform headTransform;

		private PhotonView headPhotonView;

		private DeathHeadController headController;

		private Transform _tMainCamera;

		public static DHHInputManager instance { get; private set; }

		protected void Awake()
		{
			instance = this;
			if (DHHPunManager.hostVersion == string.Empty)
			{
				DeathHeadHopper.Logger.LogWarning((object)"Host does not have DeathHeadHopper installed!");
			}
			deathHead = PlayerAvatar.instance.playerDeathHead;
			headTransform = ((Component)deathHead).transform;
			headPhotonView = ((Component)deathHead).GetComponent<PhotonView>();
			headController = ((Component)deathHead).GetComponent<DeathHeadController>();
			PlayerAvatar.instance.spectatePoint = ((Component)this).transform;
			_tMainCamera = ((Component)Camera.main).transform;
		}

		protected void Update()
		{
			//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_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0062: 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_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_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)_tMainCamera == (Object)null)
			{
				_tMainCamera = ((Component)Camera.main).transform;
			}
			if (Object.op_Implicit((Object)(object)headTransform) && Object.op_Implicit((Object)(object)((Component)this).transform))
			{
				Quaternion val = Quaternion.LookRotation(Vector3.ProjectOnPlane(headTransform.forward, Vector3.up));
				Quaternion rotation = ((Component)this).transform.rotation;
				float x = ((Quaternion)(ref rotation)).eulerAngles.x;
				float y = ((Quaternion)(ref val)).eulerAngles.y;
				rotation = ((Component)this).transform.rotation;
				Quaternion val2 = Quaternion.Euler(x, y, ((Quaternion)(ref rotation)).eulerAngles.z);
				((Component)this).transform.SetPositionAndRotation(headTransform.position + spectateOffset, val2);
				if (headController.chargeHandler.State == ChargeHandler.ChargeState.Windup)
				{
					UpdateChargeWindup();
				}
			}
		}

		protected void LateUpdate()
		{
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: 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_0050: 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)
			//IL_0063: 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)
			if ((Object)(object)SpectateCamera.instance.player != (Object)(object)PlayerAvatar.instance)
			{
				return;
			}
			if (SemiFunc.InputDown((InputKey)1))
			{
				Jump();
			}
			if (SemiFunc.InputDown((InputKey)14))
			{
				Vector3 val = Vector3.ProjectOnPlane(((Component)_tMainCamera).transform.forward, Vector3.up);
				Vector3 normalized = ((Vector3)(ref val)).normalized;
				if (SemiFunc.IsMasterClientOrSingleplayer())
				{
					headController.hopHandler.HopRealign(normalized, GetMoveDirection());
				}
				else
				{
					headPhotonView.RPC("HopRealign", (RpcTarget)2, new object[2]
					{
						normalized,
						GetMoveDirection()
					});
				}
			}
			Vector3 val2 = ((Component)_tMainCamera).transform.forward;
			val2 = Vector3.RotateTowards(val2, Vector3.up, 0.34906584f, 0f);
			Debug.DrawRay(((Component)this).transform.position, ((Vector3)(ref val2)).normalized * 10f, Color.blue);
		}

		private Vector3 GetMoveDirection()
		{
			//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_0015: 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_001e: 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_0024: 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_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: 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_0071: 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)
			//IL_008d: 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_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = Vector3.ProjectOnPlane(((Component)_tMainCamera).transform.forward, Vector3.up);
			Vector3 normalized = ((Vector3)(ref val)).normalized;
			Vector3 val2 = Vector3.Cross(Vector3.up, normalized);
			float num = SemiFunc.InputMovementX();
			float num2 = SemiFunc.InputMovementY();
			Vector3 val3 = Vector3.zero;
			if (num2 > 0f)
			{
				val3 += normalized;
			}
			if (num2 < 0f)
			{
				val3 -= normalized;
			}
			if (num < 0f)
			{
				val3 -= val2;
			}
			if (num > 0f)
			{
				val3 += val2;
			}
			return ((Vector3)(ref val3)).normalized;
		}

		private void Jump()
		{
			//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_0034: 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)
			Vector3 moveDirection = GetMoveDirection();
			if (SemiFunc.IsMasterClientOrSingleplayer())
			{
				headController.jumpHandler.JumpHead(moveDirection);
				return;
			}
			headPhotonView.RPC("JumpHead", (RpcTarget)2, new object[1] { moveDirection });
		}

		public void ChargeWindup()
		{
			//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_0011: 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_0021: 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_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			Vector3 forward = ((Component)_tMainCamera).transform.forward;
			forward = Vector3.RotateTowards(forward, Vector3.up, MathF.PI * 2f / 45f, 0f);
			if (SemiFunc.IsMasterClientOrSingleplayer())
			{
				headController.chargeHandler.ChargeWindup(forward);
				return;
			}
			headPhotonView.RPC("ChargeWindup", (RpcTarget)2, new object[1] { forward });
		}

		private void UpdateChargeWindup()
		{
			//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_0011: 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_0021: 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_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			Vector3 forward = ((Component)_tMainCamera).transform.forward;
			forward = Vector3.RotateTowards(forward, Vector3.up, MathF.PI * 2f / 45f, 0f);
			if (SemiFunc.IsMasterClientOrSingleplayer())
			{
				headController.chargeHandler.UpdateWindupDirection(forward);
				return;
			}
			headPhotonView.RPC("UpdateWindupDirection", (RpcTarget)2, new object[1] { forward });
		}

		public void CancelCharge()
		{
			if (SemiFunc.IsMasterClientOrSingleplayer())
			{
				headController.chargeHandler.CancelCharge();
			}
			else
			{
				headPhotonView.RPC("CancelCharge", (RpcTarget)2, Array.Empty<object>());
			}
		}
	}
	public class DHHPunManager : MonoBehaviour
	{
		internal static string hostVersion = string.Empty;

		internal static string localVersion = string.Empty;

		internal PhotonView photonView;

		private DHHStatsManager statsManager;

		public static DHHPunManager instance { get; private set; }

		protected void Awake()
		{
			if ((Object)(object)instance == (Object)null)
			{
				instance = this;
				EnsurePhotonView();
			}
			else
			{
				Object.Destroy((Object)(object)((Component)this).gameObject);
			}
		}

		protected void Start()
		{
			statsManager = DHHStatsManager.instance;
		}

		internal void EnsurePhotonView()
		{
			if ((Object)(object)((Component)this).gameObject.GetComponent<PhotonView>() == (Object)null)
			{
				photonView = ((Component)this).gameObject.AddComponent<PhotonView>();
				photonView.ViewID = 745;
			}
			else if ((Object)(object)photonView == (Object)null)
			{
				photonView = ((Component)this).gameObject.GetComponent<PhotonView>();
			}
		}

		internal void VersionCheck()
		{
			localVersion = DeathHeadHopper.Version.ToString();
			DeathHeadHopper.Logger.LogInfo((object)("DeathHeadHopper version: " + localVersion));
			if (SemiFunc.IsMasterClientOrSingleplayer())
			{
				hostVersion = localVersion;
			}
			if (SemiFunc.IsMultiplayer() && PhotonNetwork.PlayerList.Length != 1)
			{
				if (SemiFunc.IsMasterClient())
				{
					photonView.RPC("VersionCheckRPC", (RpcTarget)1, new object[1] { localVersion });
				}
				else
				{
					photonView.RPC("VersionCheckRPC", (RpcTarget)2, new object[1] { localVersion });
				}
			}
		}

		[PunRPC]
		internal void VersionCheckRPC(string remoteVersion, PhotonMessageInfo info)
		{
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			string text = DeathHeadHopper.Version.ToString();
			if (!SemiFunc.IsMasterClientOrSingleplayer())
			{
				hostVersion = remoteVersion;
				if (text != remoteVersion)
				{
					DeathHeadHopper.Logger.LogWarning((object)("Master client has a different version of DeathHeadHopper! Local version: " + text + ", Remote version: " + remoteVersion + ". Some features may not work correctly or may be disabled."));
				}
				return;
			}
			Player sender = info.Sender;
			if (text != remoteVersion)
			{
				DeathHeadHopper.Logger.LogWarning((object)("Player " + sender.NickName + " has a different version of DeathHeadHopper! Local version: " + text + ", Remote version: " + remoteVersion + ". Some features may not work correctly or may be disabled."));
			}
		}

		internal void LoadShopAtticShelves()
		{
			if (SemiFunc.IsMasterClient() && DHHConfigManager.itemsAppearInShop.Value)
			{
				DHHShopManager.LoadShopAtticShelves();
				if (PhotonNetwork.PlayerList.Length > 1)
				{
					photonView.RPC("LoadShopAtticShelvesRPC", (RpcTarget)1, Array.Empty<object>());
				}
			}
		}

		[PunRPC]
		internal void LoadShopAtticShelvesRPC()
		{
			DHHShopManager.LoadShopAtticShelves();
		}

		internal void AbilityUsed(string playerId, AbilityBase ability)
		{
			if (!SemiFunc.IsMultiplayer())
			{
				AbilityUsedRPC(playerId, ability.AbilityName);
				return;
			}
			photonView.RPC("AbilityUsedRPC", (RpcTarget)0, new object[2] { playerId, ability.AbilityName });
		}

		[PunRPC]
		internal void AbilityUsedRPC(string playerId, string abilityName)
		{
			string abilityName2 = abilityName;
			PlayerAvatar val = SemiFunc.PlayerAvatarGetFromSteamID(playerId);
			AbilityBase abilityBase = DHHAbilityManager.abilities.FirstOrDefault((AbilityBase x) => x.AbilityName == abilityName2);
			if ((Object)(object)abilityBase == (Object)null)
			{
				DeathHeadHopper.Logger.LogWarning((object)("Ability " + abilityName2 + " not found"));
				return;
			}
			if ((Object)(object)val == (Object)(object)SemiFunc.PlayerAvatarLocal())
			{
				abilityBase.m_AbilityUsedLocal.Invoke(abilityBase);
			}
			((Component)val.playerDeathHead).GetComponent<DeathHeadController>().abilityEnergyHandler.DecreaseEnergy(abilityBase.EnergyCost);
		}

		[PunRPC]
		public void UpgradeHeadChargeRPC(string _steamID, int value)
		{
			statsManager.UpdateHeadChargeStat(_steamID, value);
		}
	}
	public class DHHShopManager
	{
		public static GameObject shopAtticShelvesPrefab;

		private static readonly List<ItemVolume> itemVolumes = new List<ItemVolume>();

		private static readonly List<Item> potentialItems = new List<Item>();

		public static void LoadShopAtticShelves()
		{
			Module val = (from x in Object.FindObjectsOfType<Module>()
				where ((Object)x).name.Contains("Shop") && ((Object)x).name.Contains("Generic")
				select x).FirstOrDefault();
			GameObject val2 = Object.Instantiate<GameObject>(shopAtticShelvesPrefab, ((Component)val).transform, false);
			DeathHeadHopper.Logger.LogInfo((object)("Added " + ((Object)shopAtticShelvesPrefab).name + " to " + ((Object)val).name));
			if (!SemiFunc.IsNotMasterClient())
			{
				itemVolumes.Clear();
				itemVolumes.AddRange(val2.GetComponentsInChildren<ItemVolume>());
				ListExtension.Shuffle<ItemVolume>((IList<ItemVolume>)itemVolumes);
			}
		}

		public static void LoadItems()
		{
			if (!SemiFunc.IsNotMasterClient())
			{
				ShopManager instance = ShopManager.instance;
				potentialItems.Clear();
				potentialItems.AddRange(instance.potentialItemUpgrades.Where((Item x) => DHHAssetManager.shopItems.ContainsKey(x.itemAssetName)));
				potentialItems.AddRange(instance.potentialItems.Where((Item x) => DHHAssetManager.shopItems.ContainsKey(x.itemAssetName)));
				instance.potentialItemUpgrades.RemoveAll((Item x) => DHHAssetManager.shopItems.ContainsKey(x.itemAssetName));
				instance.potentialItems.RemoveAll((Item x) => DHHAssetManager.shopItems.ContainsKey(x.itemAssetName));
			}
		}

		public static void ShopPopulateItemVolumes(PunManager punManager)
		{
			if (SemiFunc.IsNotMasterClient())
			{
				return;
			}
			int num = 0;
			foreach (ItemVolume itemVolume in itemVolumes)
			{
				punManager.SpawnShopItem(itemVolume, potentialItems, ref num, false);
			}
		}
	}
	public class DHHStatsManager : MonoBehaviour
	{
		public string[] playersInDictionary = new string[10];

		private readonly Dictionary<string, int> playerUpgradeHeadCharge = new Dictionary<string, int>();

		internal UnityEvent m_LocalPlayerUpgrade = new UnityEvent();

		public static DHHStatsManager instance { get; private set; }

		protected void Awake()
		{
			if ((Object)(object)instance == (Object)null)
			{
				instance = this;
				Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject);
			}
			else
			{
				Object.Destroy((Object)(object)((Component)this).gameObject);
			}
		}

		protected void Start()
		{
			if (!StatsManager.instance.dictionaryOfDictionaries.TryAdd("playerUpgradeHeadCharge", playerUpgradeHeadCharge))
			{
				DeathHeadHopper.Logger.LogError((object)"Failed to add playerUpgradeHeadCharge dictionary to StatsManager");
			}
		}

		internal int UpgradeHeadCharge(string playerId)
		{
			playerUpgradeHeadCharge[playerId]++;
			if (SemiFunc.IsMasterClientOrSingleplayer())
			{
				UpdateHeadChargeStat(playerId, playerUpgradeHeadCharge[playerId]);
			}
			if (SemiFunc.IsMasterClient())
			{
				DHHPunManager.instance.photonView.RPC("UpgradeHeadChargeRPC", (RpcTarget)1, new object[2]
				{
					playerId,
					playerUpgradeHeadCharge[playerId]
				});
			}
			return playerUpgradeHeadCharge[playerId];
		}

		internal void UpdateHeadChargeStat(string playerId, int value)
		{
			playerUpgradeHeadCharge[playerId] = value;
			if (PlayerAvatar.instance.steamID == playerId)
			{
				m_LocalPlayerUpgrade.Invoke();
			}
		}

		public static int GetHeadChargeUpgrade(string playerId)
		{
			if (instance.playerUpgradeHeadCharge.TryGetValue(playerId, out var value))
			{
				return value;
			}
			return 0;
		}
	}
	public class DHHUIManager : MonoBehaviour
	{
		internal static GameObject abilityUIPrefab;

		internal GameObject gameHUD;

		internal static DHHUIManager instance { get; private set; }

		protected void Awake()
		{
			instance = this;
			gameHUD = ((Component)((Component)InventoryUI.instance).transform.parent).gameObject;
			if (gameHUD == null)
			{
				DeathHeadHopper.Logger.LogError((object)"Game Hud not found!");
			}
			else
			{
				Object.Instantiate<GameObject>(abilityUIPrefab, gameHUD.transform, false);
			}
		}
	}
}
namespace DeathHeadHopper.Items
{
	public class DHHItemHeadCharger : MonoBehaviour
	{
		public Transform chargePoint;

		public Renderer batteryMaterial;

		public Light batteryLight;

		public Color tetherStartColor;

		public Color tetherEndColor;

		public float tetherWidth;

		internal float chargeRate;

		internal float chargeRadius;

		internal float headChargeMultiplier;

		private float maxBatteryLightIntensity;

		private float chargeBurstTimer;

		private float batteryOutBlinkTimer;

		private float batteryBleepTimer;

		private LayerMask headLayerMask;

		private ItemBattery itemBattery;

		private ItemEquippable itemEquippable;

		private readonly HashSet<DeathHeadController> headsInRange;

		private readonly Dictionary<DeathHeadController, Tether> headTethers;

		protected void Start()
		{
			//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_006a: Unknown result type (might be due to invalid IL or missing references)
			itemBattery = ((Component)this).GetComponent<ItemBattery>();
			itemEquippable = ((Component)this).GetComponent<ItemEquippable>();
			headLayerMask = LayerMask.op_Implicit(LayerMask.GetMask(new string[1] { "PhysGrabObject" }));
			itemBattery.batteryLife = 100f;
			itemBattery.itemBatteryMaterial.material.color = new Color(0f, 0f, 0f, 0f);
			maxBatteryLightIntensity = batteryLight.intensity;
		}

		protected void Update()
		{
			if (chargeBurstTimer > 0f)
			{
				chargeBurstTimer -= Time.deltaTime;
			}
			SphereCheck();
			DrawChargeLines();
			UpdateBatteryEffects();
		}

		protected void FixedUpdate()
		{
			if (!SemiFunc.IsMasterClientOrSingleplayer() || itemBattery.batteryLife <= 0f)
			{
				return;
			}
			float num = 0f;
			foreach (DeathHeadController item in headsInRange)
			{
				if (item.abilityEnergyHandler.Energy < item.abilityEnergyHandler.energyMax)
				{
					float num2 = Mathf.Min(chargeRate * Time.fixedDeltaTime, item.abilityEnergyHandler.energyMax - item.abilityEnergyHandler.Energy);
					item.abilityEnergyHandler.IncreaseEnergy(num2);
					num += num2 / Time.fixedDeltaTime;
				}
			}
			if (num > 0f)
			{
				itemBattery.Drain(num / headChargeMultiplier);
			}
		}

		private void SphereCheck()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			headsInRange.Clear();
			Collider[] array = Physics.OverlapSphere(chargePoint.position, chargeRadius, LayerMask.op_Implicit(headLayerMask));
			Collider[] array2 = array;
			DeathHeadController item = default(DeathHeadController);
			foreach (Collider val in array2)
			{
				if (((Component)((Component)val).transform.parent).TryGetComponent<DeathHeadController>(ref item))
				{
					headsInRange.Add(item);
				}
			}
		}

		private void DrawChargeLines()
		{
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Expected O, but got Unknown
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: 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)
			List<DeathHeadController> list = headTethers.Keys.Where((DeathHeadController head) => !headsInRange.Contains(head)).ToList();
			foreach (DeathHeadController item in list)
			{
				Object.Destroy((Object)(object)((Component)headTethers[item]).gameObject);
				headTethers.Remove(item);
			}
			foreach (DeathHeadController item2 in headsInRange)
			{
				if (!headTethers.ContainsKey(item2))
				{
					GameObject val = new GameObject("HeadChargeLine");
					val.transform.parent = ((Component)this).transform;
					headTethers[item2] = val.AddComponent<Tether>();
					headTethers[item2].tetherStartColor = tetherStartColor;
					headTethers[item2].tetherEndColor = tetherEndColor;
					headTethers[item2].width = tetherWidth;
				}
			}
			foreach (KeyValuePair<DeathHeadController, Tether> headTether in headTethers)
			{
				DeathHeadController key = headTether.Key;
				Tether value = headTether.Value;
				RepositionTether(value, key);
				if (key.abilityEnergyHandler.Energy < key.abilityEnergyHandler.energyMax && itemBattery.batteryLife > 0f)
				{
					if (!((Component)value).gameObject.activeInHierarchy)
					{
						((Component)value).gameObject.SetActive(true);
					}
					value.ResetCurvePointSmooth();
				}
				else if (((Component)value).gameObject.activeInHierarchy)
				{
					((Component)value).gameObject.SetActive(false);
				}
			}
		}

		private void UpdateBatteryEffects()
		{
			if (itemBattery.batteryLife <= 0f)
			{
				if (headsInRange.Any((DeathHeadController x) => x.abilityEnergyHandler.Energy < x.abilityEnergyHandler.energyMax))
				{
					batteryBleepTimer += Time.deltaTime;
					bool flag = batteryBleepTimer < 3f;
					if (flag != itemBattery.batteryActive)
					{
						itemBattery.BatteryToggle(flag);
					}
				}
				else
				{
					batteryBleepTimer = 0f;
					if (itemBattery.batteryActive)
					{
						itemBattery.BatteryToggle(false);
					}
				}
				if (itemBattery.batteryActive)
				{
					batteryOutBlinkTimer = (batteryOutBlinkTimer + Time.deltaTime) % 1f;
					BatteryOffsetTexture((batteryOutBlinkTimer >= 0.5f) ? 1 : 0);
				}
				else
				{
					batteryOutBlinkTimer = 0f;
					BatteryOffsetTexture(0);
				}
			}
			else
			{
				batteryOutBlinkTimer = 0f;
				BatteryOffsetTexture(itemBattery.batteryLifeInt);
				bool flag2 = headsInRange.Any((DeathHeadController x) => x.abilityEnergyHandler.Energy < x.abilityEnergyHandler.energyMax);
				if (flag2 != itemBattery.batteryActive)
				{
					itemBattery.BatteryToggle(flag2);
				}
			}
		}

		private void RepositionTether(Tether tether, DeathHeadController head)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_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)
			tether.origin = chargePoint.position;
			tether.point = ((Component)head).transform.position;
		}

		private void BatteryOffsetTexture(int batteryLife)
		{
			//IL_01ad: 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_0135: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: 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_004b: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)batteryMaterial))
			{
				switch (batteryLife)
				{
				case 6:
					batteryMaterial.material.SetTextureOffset("_MainTex", new Vector2(0f, 0f));
					batteryLight.intensity = maxBatteryLightIntensity;
					break;
				case 5:
					batteryMaterial.material.SetTextureOffset("_MainTex", new Vector2(0.25f, 0f));
					batteryLight.intensity = maxBatteryLightIntensity * 0.9f;
					break;
				case 4:
					batteryMaterial.material.SetTextureOffset("_MainTex", new Vector2(0.5f, 0f));
					batteryLight.intensity = maxBatteryLightIntensity * 0.8f;
					break;
				case 3:
					batteryMaterial.material.SetTextureOffset("_MainTex", new Vector2(0.75f, 0f));
					batteryLight.intensity = maxBatteryLightIntensity * 0.7f;
					break;
				case 2:
					batteryMaterial.material.SetTextureOffset("_MainTex", new Vector2(0f, -0.5f));
					batteryLight.intensity = maxBatteryLightIntensity * 0.6f;
					break;
				case 1:
					batteryMaterial.material.SetTextureOffset("_MainTex", new Vector2(0.25f, -0.5f));
					batteryLight.intensity = maxBatteryLightIntensity * 0.5f;
					break;
				case 0:
					batteryMaterial.material.SetTextureOffset("_MainTex", new Vector2(0.5f, -0.5f));
					batteryLight.intensity = 0f;
					break;
				}
			}
		}

		public DHHItemHeadCharger()
		{
			//IL_0016: 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_0022: 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_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			Color val = default(Color);
			tetherStartColor = (Color)(ColorUtility.TryParseHtmlString("#FCFF00", ref val) ? new Color(val.r, val.g, val.b, 0.6f) : Color.yellow);
			Color val2 = default(Color);
			tetherEndColor = (Color)(ColorUtility.TryParseHtmlString("#FCFF00", ref val2) ? new Color(val2.r, val2.g, val2.b, 0.9f) : Color.yellow);
			tetherWidth = 0.06f;
			chargeRate = 15f;
			chargeRadius = 4f;
			headChargeMultiplier = 2f;
			headsInRange = new HashSet<DeathHeadController>();
			headTethers = new Dictionary<DeathHeadController, Tether>();
			((MonoBehaviour)this)..ctor();
		}
	}
	public class DHHItemUpgradeCharge : MonoBehaviour
	{
		private ItemToggle itemToggle;

		private void Start()
		{
			itemToggle = ((Component)this).GetComponent<ItemToggle>();
		}

		public void Upgrade()
		{
			DHHStatsManager.instance.UpgradeHeadCharge(SemiFunc.PlayerGetSteamID(SemiFunc.PlayerAvatarGetFromPhotonID(itemToggle.playerTogglePhotonID)));
		}
	}
}
namespace DeathHeadHopper.Helpers
{
	public static class DHHFunc
	{
		public static GameObject? DeathHeadHopperObj;

		public static bool IsDeathHeadSpectatable(PlayerAvatar player)
		{
			if ((Object)(object)player == (Object)(object)PlayerAvatar.instance)
			{
				if (!SemiFunc.RunIsLevel())
				{
					return SemiFunc.RunIsShop();
				}
				return true;
			}
			return false;
		}

		public static bool IsLastPointExtracting()
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Invalid comparison between Unknown and I4
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Invalid comparison between Unknown and I4
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Invalid comparison between Unknown and I4
			RoundDirector instance = RoundDirector.instance;
			if (instance.extractionPointsCompleted >= instance.extractionPoints - 1 && Object.op_Implicit((Object)(object)instance.extractionPointCurrent))
			{
				if ((int)instance.extractionPointCurrent.currentState != 3 && (int)instance.extractionPointCurrent.currentState != 4)
				{
					return (int)instance.extractionPointCurrent.currentState == 6;
				}
				return true;
			}
			return false;
		}

		public static DeathHeadController? GetLocalDeathHeadController()
		{
			return ((Component)PlayerAvatar.instance.playerDeathHead).GetComponent<DeathHeadController>();
		}

		public static float StatWithDiminishingReturns(float baseValue, float increasePerLevel, int currentLevel, int thresholdLevel = 10, float diminishingFactor = 0.9f)
		{
			currentLevel--;
			thresholdLevel--;
			float num = Mathf.Min(currentLevel, thresholdLevel);
			float num2 = Mathf.Max(0, currentLevel - thresholdLevel);
			float num3 = num2 * Mathf.Pow(diminishingFactor, num2);
			return baseValue + increasePerLevel * (num + num3);
		}
	}
}
namespace DeathHeadHopper.DeathHead
{
	public class DeathHeadController : MonoBehaviourPun
	{
		internal PlayerDeathHead deathHead;

		internal Rigidbody rb;

		internal PhysGrabObjectImpactDetector impactDetector;

		internal CollisionHandler collisionHandler;

		internal HopHandler hopHandler;

		internal JumpHandler jumpHandler;

		internal AudioHandler audioHandler;

		internal ReboundHandler reboundHandler;

		internal AnchorHandler anchorHandler;

		internal EyeHandler eyeHandler;

		internal PhaseHandler phaseHandler;

		internal EffectHandler effectHandler;

		internal ShakeHandler shakeHandler;

		internal ChargeHandler chargeHandler;

		internal AbilityEnergyHandler abilityEnergyHandler;

		public float mouseTalkPlayerDistanceRange = 5f;

		public UnityEvent m_HeadJumpEvent = new UnityEvent();

		public UnityEvent m_HeadHopEvent = new UnityEvent();

		internal bool spectated;

		internal float timeSinceGrabbed = float.PositiveInfinity;

		internal float timeInTruck;

		private bool localSeen;

		internal void Start()
		{
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Expected O, but got Unknown
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Expected O, but got Unknown
			deathHead = ((Component)this).GetComponent<PlayerDeathHead>();
			rb = ((Component)this).GetComponent<Rigidbody>();
			impactDetector = ((Component)this).GetComponent<PhysGrabObjectImpactDetector>();
			impactDetector.playerHurtDisable = false;
			if (m_HeadJumpEvent == null)
			{
				m_HeadJumpEvent = new UnityEvent();
			}
			if (m_HeadHopEvent == null)
			{
				m_HeadHopEvent = new UnityEvent();
			}
			collisionHandler = ((Component)this).gameObject.AddComponent<CollisionHandler>();
			hopHandler = ((Component)this).gameObject.AddComponent<HopHandler>();
			jumpHandler = ((Component)this).gameObject.AddComponent<JumpHandler>();
			audioHandler = ((Component)this).gameObject.AddComponent<AudioHandler>();
			reboundHandler = ((Component)this).gameObject.AddComponent<ReboundHandler>();
			anchorHandler = ((Component)this).gameObject.AddComponent<AnchorHandler>();
			eyeHandler = ((Component)this).gameObject.AddComponent<EyeHandler>();
			phaseHandler = ((Component)this).gameObject.AddComponent<PhaseHandler>();
			effectHandler = ((Component)this).gameObject.AddComponent<EffectHandler>();
			shakeHandler = ((Component)this).gameObject.AddComponent<ShakeHandler>();
			chargeHandler = ((Component)this).gameObject.AddComponent<ChargeHandler>();
			abilityEnergyHandler = ((Component)this).gameObject.AddComponent<AbilityEnergyHandler>();
		}

		internal void Update()
		{
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			timeSinceGrabbed = (deathHead.physGrabObject.grabbed ? 0f : (timeSinceGrabbed + Time.deltaTime));
			timeInTruck = (deathHead.roomVolumeCheck.inTruck ? (timeInTruck + Time.deltaTime) : 0f);
			CancelReviveInCart();
			FixDeathHeadTpWhenOutsideRoom();
			if (spectated && (StandardTruckReviveCondition() || deathHead.roomVolumeCheck.inExtractionPoint) && SemiFunc.PlayerNearestDistance(((Component)this).transform.position) < mouseTalkPlayerDistanceRange)
			{
				audioHandler.PlayMouseTalkSound();
			}
		}

		internal void FixDeathHeadTpWhenOutsideRoom()
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Invalid comparison between Unknown and I4
			//IL_001b: 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_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			if (!SemiFunc.IsMasterClientOrSingleplayer() || (int)GameDirector.instance.currentState != 2)
			{
				return;
			}
			if (((Component)this).transform.position.y < -50f)
			{
				if (RoundDirector.instance.extractionPointActive)
				{
					deathHead.physGrabObject.Teleport(RoundDirector.instance.extractionPointCurrent.safetySpawn.position, RoundDirector.instance.extractionPointCurrent.safetySpawn.rotation);
				}
				else
				{
					deathHead.physGrabObject.Teleport(((Component)TruckSafetySpawnPoint.instance).transform.position, ((Component)TruckSafetySpawnPoint.instance).transform.rotation);
				}
				rb.velocity = Vector3.zero;
				if (anchorHandler.isAnchored)
				{
					anchorHandler.DestroyAnchor();
				}
			}
			if (deathHead.outsideLevelTimer > 0f)
			{
				deathHead.outsideLevelTimer = 0f;
			}
		}

		internal void CancelReviveInCart()
		{
			if (!StandardTruckReviveCondition())
			{
				localSeen = false;
				return;
			}
			if (!localSeen && effectHandler.TryCreateDiscoverEffect((State)0))
			{
				localSeen = true;
			}
			if (SemiFunc.IsMasterClientOrSingleplayer() && !ShouldReviveInTruck())
			{
				deathHead.inTruckReviveTimer = 0.4f;
			}
		}

		internal bool StandardTruckReviveCondition()
		{
			if (RoundDirector.instance.allExtractionPointsCompleted && !deathHead.playerAvatar.finalHeal)
			{
				return deathHead.roomVolumeCheck.inTruck;
			}
			return false;
		}

		internal bool ShouldReviveInTruck()
		{
			if (DHHConfigManager.anchorMode.Value == AnchorMode.Never)
			{
				if (timeSinceGrabbed < timeInTruck)
				{
					return true;
				}
				if (collisionHandler.timeSinceCollidedGrabbedCart < 2f)
				{
					return true;
				}
				if (collisionHandler.timeSinceCollidedGrabbedCart < timeInTruck)
				{
					return true;
				}
				return false;
			}
			if (!anchorHandler.isAnchored)
			{
				return true;
			}
			float? timeSinceAnchorCartGrabbed = anchorHandler.timeSinceAnchorCartGrabbed;
			if (timeSinceAnchorCartGrabbed.HasValue)
			{
				timeSinceAnchorCartGrabbed = anchorHandler.timeSinceAnchorCartGrabbed;
				if (timeSinceAnchorCartGrabbed.HasValue && timeSinceAnchorCartGrabbed.GetValueOrDefault() < 2f)
				{
					return true;
				}
			}
			if (timeSinceGrabbed < timeInTruck)
			{
				return true;
			}
			return false;
		}

		internal void LateUpdate()
		{
			UpdateSpectated();
		}

		private void UpdateSpectated()
		{
			if (!deathHead.playerAvatar.isLocal)
			{
				return;
			}
			if (!deathHead.triggered || SpectateCamera.instance?.player == null)
			{
				spectated = false;
			}
			else if ((Object)(object)SpectateCamera.instance.player == (Object)(object)PlayerAvatar.instance && !spectated)
			{
				if (GameManager.Multiplayer())
				{
					((MonoBehaviourPun)this).photonView.RPC("SetSpectated", (RpcTarget)1, new object[1] { true });
				}
				SetSpectated(value: true);
			}
			else if ((Object)(object)SpectateCamera.instance.player != (Object)(object)PlayerAvatar.instance && spectated)
			{
				if (GameManager.Multiplayer())
				{
					((MonoBehaviourPun)this).photonView.RPC("SetSpectated", (RpcTarget)1, new object[1] { false });
				}
				SetSpectated(value: false);
			}
		}

		[PunRPC]
		internal void SetSpectated(bool value)
		{
			spectated = value;
		}
	}
}
namespace DeathHeadHopper.DeathHead.Handlers
{
	public class AbilityEnergyHandler : MonoBehaviourPun
	{
		private DeathHeadController controller;

		public float energyMax = 120f;

		public float chargeSpeed = 2f;

		public float rechargeSoundDelay = 0.5f;

		private float lastRechargeSoundTime;

		public float Energy { get; private set; } = 120f;


		protected void Awake()
		{
			controller = ((Component)this).GetComponent<DeathHeadController>();
		}

		public void IncreaseEnergy(float amount)
		{
			Energy += amount;
			if (SemiFunc.IsMasterClient())
			{
				((MonoBehaviourPun)this).photonView.RPC("SyncEnergyRPC", (RpcTarget)1, new object[1] { Energy });
			}
			PlayRechargeSound();
		}

		public void DecreaseEnergy(float amount)
		{
			Energy -= amount;
			if (SemiFunc.IsMasterClient())
			{
				((MonoBehaviourPun)this).photonView.RPC("SyncEnergyRPC", (RpcTarget)1, new object[1] { Energy });
			}
		}

		[PunRPC]
		protected void SyncEnergyRPC(float energy)
		{
			Energy = energy;
			PlayRechargeSound();
		}

		private void PlayRechargeSound()
		{
			if (Time.time - lastRechargeSoundTime > rechargeSoundDelay)
			{
				controller.audioHandler.PlayRechargeSound();
				lastRechargeSoundTime = Time.time;
			}
		}
	}
	public enum AnchorMode
	{
		Always,
		ExtractionPointsCompleted,
		Never
	}
	internal class AnchorHandler : MonoBehaviour
	{
		private DeathHeadController controller;

		public float anchorRadius = 8f;

		public float phaseRadius = 14f;

		public Vector3 tetherOffset = new Vector3(0f, 0.2f, 0f);

		public float anchorReboundForce = 0.05f;

		public float lightThreshold = 0.95f;

		public float minGroundedTime = 0.5f;

		public float breakSpeed = 2f;

		public float unAnchorDelay = 0.4f;

		public Vector4 cameraShake = new Vector4(1f, 3f, 5f, 0.4f);

		public Vector4 cameraImpact = new Vector4(2f, 3f, 8f, 0.1f);

		public Vector3 cartAnchorPointOffset = new Vector3(0.5f, -0.2f, 0.2f);

		public Vector3 smallCartAnchorPointOffset = new Vector3(0.4f, -0.2f, 0.1f);

		public Vector3 phasePointOffset = new Vector3(0f, 0.6f, 0f);

		public float shakeMagnitude = 0.3f;

		public float shakeDuration = 0.4f;

		public float shakeInterval = 0.05f;

		internal bool isAnchored;

		internal float? timeSinceAnchorCartGrabbed;

		private Vector3 anchorOrigin = Vector3.zero;

		private float distanceFromAnchor;

		private float unAnchorTimer;

		private float anchoredFor;

		private Tether? anchorTether;

		private bool isBreaking;

		private Vector3 breakPoint = Vector3.zero;

		private float breakingLerp;

		private bool hasAnchoredAfterExtracted;

		private float reAnchorCooldown;

		private PhysGrabCart? anchorCart;

		private bool isUnAnchoringSoundPlaying;

		private float phaseTimer;

		private Vector3? CartAnchorPoint
		{
			get
			{
				//IL_002f: 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)
				//IL_0034: Unknown result type (might be due to invalid IL or missing references)
				PhysGrabCart? obj = anchorCart;
				if (obj == null)
				{
					return null;
				}
				return obj.cartGrabPoint.TransformPoint(anchorCart.isSmallCart ? smallCartAnchorPointOffset : cartAnchorPointOffset);
			}
		}

		private Vector3? CartCenterPhasePoint
		{
			get
			{
				//IL_001a: Unknown result type (might be due to invalid IL or missing references)
				//IL_001f: Unknown result type (might be due to invalid IL or missing references)
				PhysGrabCart? obj = anchorCart;
				if (obj == null)
				{
					return null;
				}
				return ((Component)obj).transform.TransformPoint(phasePointOffset);
			}
		}

		protected void Awake()
		{
			controller = ((Component)this).GetComponent<DeathHeadController>();
		}

		protected void Start()
		{
			controller.reboundHandler.AddReboundForce(new ReboundHandler.Rebound(() => anchorOrigin - ((Component)this).transform.position, () => isAnchored && distanceFromAnchor > anchorRadius, () => Mathf.Min(distanceFromAnchor / anchorRadius * anchorReboundForce, controller.reboundHandler.defaultReboundForce), shouldNegateProductVelocity: false));
			controller.eyeHandler.eyeNegativeConditions.Add(delegate
			{
				float num = controller.anchorHandler.anchoredFor;
				return num > 0.1f && num < 1f;
			});
			controller.eyeHandler.eyeNegativeConditions.Add(isOutsideAnchorRange);
			controller.eyeHandler.eyeFlickerConditions.Add(isOutsideAnchorRange);
			bool isOutsideAnchorRange()
			{
				return controller.anchorHandler.distanceFromAnchor / controller.anchorHandler.anchorRadius > controller.anchorHandler.lightThreshold;
			}
		}

		protected void Update()
		{
			//IL_001b: 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_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			anchorOrigin = (Vector3)(((??)CartAnchorPoint) ?? anchorOrigin);
			UpdateAnchorState();
			UpdatePhasing();
			UpdateUnAnchoringSound();
			if (isAnchored)
			{
				distanceFromAnchor = Vector3.Distance(anchorOrigin, ((Component)this).transform.position);
				anchoredFor += Time.deltaTime;
			}
			else
			{
				distanceFromAnchor = 0f;
				anchoredFor = 0f;
			}
			UpdateTetherBreaking();
			if (isAnchored && !isBreaking)
			{
				RepositionTether();
			}
		}

		private void UpdateAnchorState()
		{
			//IL_0233: Unknown result type (might be due to invalid IL or missing references)
			if (!SemiFunc.IsMasterClientOrSingleplayer())
			{
				return;
			}
			if (!RoundDirector.instance.allExtractionPointsCompleted)
			{
				hasAnchoredAfterExtracted = false;
			}
			timeSinceAnchorCartGrabbed = ((anchorCart == null) ? null : (((Component)anchorCart).gameObject.GetComponent<PhysGrabObject>().grabbed ? new float?(0f) : (timeSinceAnchorCartGrabbed + Time.deltaTime)));
			unAnchorTimer = (controller.impactDetector.physGrabObject.grabbed ? (unAnchorTimer + Time.deltaTime) : 0f);
			reAnchorCooldown = (controller.impactDetector.physGrabObject.grabbed ? (reAnchorCooldown - Time.deltaTime) : 0.5f);
			bool flag = DHHConfigManager.anchorMode.Value != AnchorMode.Never && (RoundDirector.instance.allExtractionPointsCompleted || (DHHConfigManager.anchorMode.Value == AnchorMode.Always && SemiFunc.RunIsLevel()));
			if (unAnchorTimer > unAnchorDelay || !controller.deathHead.triggered || !flag)
			{
				if (isAnchored)
				{
					DestroyAnchor();
				}
			}
			else
			{
				if (reAnchorCooldown <= 0f)
				{
					return;
				}
				if (controller.collisionHandler.isCollidingCart && controller.collisionHandler.collidingCart != null)
				{
					if (anchorCart != controller.collisionHandler.collidingCart)
					{
						AnchorToCart(controller.collisionHandler.collidingCart);
					}
					return;
				}
				bool flag2 = !hasAnchoredAfterExtracted && RoundDirector.instance.allExtractionPointsCompleted;
				if (!flag2 && (!controller.collisionHandler.isColliding || controller.collisionHandler.isCollidingCart))
				{
					return;
				}
				Vector3? groundPointDown = controller.collisionHandler.GetGroundPointDown();
				if (groundPointDown.HasValue)
				{
					if (flag2)
					{
						hasAnchoredAfterExtracted = true;
					}
					if (!isAnchored)
					{
						CreateAnchor(groundPointDown.Value);
					}
				}
			}
		}

		private void UpdatePhasing()
		{
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			if (SemiFunc.IsMasterClientOrSingleplayer())
			{
				bool flag = isAnchored && distanceFromAnchor > phaseRadius && anchorCart != null && !controller.phaseHandler.phasing && phaseTimer <= 0f;
				phaseTimer = ((flag || controller.phaseHandler.phasing) ? 0.5f : (phaseTimer - Time.deltaTime));
				if (flag || controller.phaseHandler.phasing)
				{
					controller.phaseHandler.PhaseToPoint((Vector3)(((??)CartCenterPhasePoint) ?? (anchorOrigin + phasePointOffset)));
				}
			}
		}

		private void UpdateUnAnchoringSound()
		{
			if (isAnchored && controller.impactDetector.physGrabObject.grabbed)
			{
				if (!isUnAnchoringSoundPlaying)
				{
					isUnAnchoringSoundPlaying = true;
					controller.audioHandler.PlayUnAnchoringSound();
				}
			}
			else if (isUnAnchoringSoundPlaying)
			{
				isUnAnchoringSoundPlaying = false;
				controller.audioHandler.StopUnAnchoringSound();
			}
		}

		private void UpdateTetherBreaking()
		{
			//IL_0030: 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)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			if (isBreaking && anchorTether != null)
			{
				breakingLerp += Time.deltaTime * breakSpeed;
				anchorTether.origin = anchorOrigin;
				anchorTether.point = Vector3.Lerp(breakPoint, anchorOrigin, breakingLerp);
				if (breakingLerp >= 1f)
				{
					((Component)anchorTether).gameObject.SetActive(false);
					isBreaking = false;
				}
			}
		}

		private void RepositionTether()
		{
			//IL_0022: 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)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//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_0044: 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 (anchorTether != null && ((Component)anchorTether).gameObject.activeInHierarchy)
			{
				anchorTether.origin = anchorOrigin;
				Vector3 point = ((Component)this).transform.TransformPoint(tetherOffset);
				anchorTether.point = point;
				anchorTether.colorInterpolation = Mathf.Max(0f, (Mathf.Clamp01(distanceFromAnchor / anchorRadius) - lightThreshold) * (1f / (1f - lightThreshold)));
			}
		}

		private void EnableTether(Vector3? position)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Expected O, but got Unknown
			//IL_005c: 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_0061: Unknown result type (might be due to invalid IL or missing references)
			if (anchorTether == null)
			{
				GameObject val = new GameObject("HeadAnchorTether");
				val.transform.parent = ((Component)this).transform;
				anchorTether = val.AddComponent<Tether>();
			}
			((Component)anchorTether).gameObject.SetActive(true);
			anchorOrigin = (Vector3)(((??)position) ?? ((Component)this).transform.position);
			anchorTether.curveEnabled = true;
			controller.audioHandler.PlayAnchorAttachSound();
			RepositionTether();
			anchorTether.ResetCurvePointSmooth();
			isBreaking = false;
		}

		private void DisableTether()
		{
			//IL_0120: Unknown result type (might be due to invalid IL or missing references)
			//IL_0125: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			if (anchorTether == null)
			{
				return;
			}
			if (controller.deathHead.triggered)
			{
				controller.audioHandler.PlayAnchorBreakSound();
				controller.effectHandler.PlayBreakEffect();
				controller.shakeHandler.ShakeEffect(shakeMagnitude, shakeDuration, shakeInterval);
				if (controller.deathHead.playerAvatar.isLocal)
				{
					GameDirector.instance.CameraShake.ShakeDistance(cameraShake.x, cameraShake.y, cameraShake.z, ((Component)this).transform.position, cameraShake.w);
					GameDirector.instance.CameraImpact.ShakeDistance(cameraImpact.x, cameraImpact.y, cameraImpact.z, ((Component)this).transform.position, cameraImpact.w);
				}
			}
			anchorTether.curveEnabled = false;
			isBreaking = true;
			breakPoint = anchorTether.point;
			breakingLerp = 0f;
		}

		internal void CreateAnchor(Vector3 position)
		{
			//IL_002f: 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)
			isAnchored = true;
			if (!SemiFunc.IsMultiplayer())
			{
				CreateAnchorRPC(position);
				return;
			}
			((MonoBehaviourPun)controller).photonView.RPC("CreateAnchorRPC", (RpcTarget)0, new object[1] { position });
		}

		[PunRPC]
		internal void CreateAnchorRPC(Vector3 position)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			isAnchored = true;
			EnableTether(position);
		}

		internal void AnchorToCart(PhysGrabCart cart)
		{
			isAnchored = true;
			if (!SemiFunc.IsMultiplayer())
			{
				AnchorToCartRPC(cart);
				return;
			}
			((MonoBehaviourPun)controller).photonView.RPC("AnchorToCartRPC", (RpcTarget)0, new object[1] { cart.photonView.ViewID });
		}

		[PunRPC]
		internal void AnchorToCartRPC(int cartViewID)
		{
			AnchorToCartRPC(((Component)PhotonView.Find(cartViewID)).GetComponent<PhysGrabCart>());
		}

		internal void AnchorToCartRPC(PhysGrabCart cart)
		{
			anchorCart = cart;
			if (isAnchored)
			{
				DisableTether();
			}
			isAnchored = true;
			EnableTether(CartAnchorPoint);
		}

		internal void DestroyAnchor()
		{
			anchorCart = null;
			isAnchored = false;
			if (!SemiFunc.IsMultiplayer())
			{
				DestroyAnchorRPC();
			}
			else
			{
				((MonoBehaviourPun)controller).photonView.RPC("DestroyAnchorRPC", (RpcTarget)0, Array.Empty<object>());
			}
		}

		[PunRPC]
		internal void DestroyAnchorRPC()
		{
			anchorCart = null;
			isAnchored = false;
			DisableTether();
		}
	}
	public class AudioHandler : MonoBehaviour
	{
		private DeathHeadController controller;

		public Sound? jumpSound;

		public Sound? anchorBreakSound;

		public Sound? anchorAttachSound;

		public Sound? unAnchoringSound;

		public Sound? windupSound;

		public Sound? rechargeSound;

		[Space]
		public Sound? mouseTalkSound1;

		public Sound? mouseTalkSound2;

		public Vector2 mouseTalkCooldownRange = new Vector2(1.5f, 6f);

		private float mouseTalkCooldown;

		private GameObject? audioSourceContainer;

		protected void Awake()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Expected O, but got Unknown
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Expected O, but got Unknown
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Expected O, but got Unknown
			//IL_016c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0172: Expected O, but got Unknown
			//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dc: Expected O, but got Unknown
			//IL_023f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0245: Expected O, but got Unknown
			//IL_02aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b0: Expected O, but got Unknown
			//IL_0313: Unknown result type (might be due to invalid IL or missing references)
			//IL_0319: Expected O, but got Unknown
			controller = ((Component)this).GetComponent<DeathHeadController>();
			Sound val = new Sound();
			val.Sounds = ((Component)this).gameObject.GetComponent<NotValuableObject>().audioPreset.impactMedium.Sounds.Clone() as AudioClip[];
			val.Volume = 0.12f;
			val.VolumeRandom = 0f;
			val.Pitch = 0.8f;
			val.PitchRandom = 0f;
			jumpSound = val;
			val = new Sound();
			val.Source = CreateAudioSource();
			val.Sounds = controller.deathHead.playerAvatar.tumbleBreakFreeSound.Sounds.Clone() as AudioClip[];
			val.Volume = 0.1f;
			val.VolumeRandom = 0f;
			val.Pitch = 1f;
			val.PitchRandom = 0f;
			anchorBreakSound = val;
			val = new Sound();
			val.Source = CreateAudioSource();
			val.Sounds = ((IEnumerable<MaterialPreset>)Materials.Instance.MaterialList).FirstOrDefault((Func<MaterialPreset, bool>)((MaterialPreset x) => (int)x.Type == 2)).SlideOneShot.Sounds.Clone() as AudioClip[];
			val.Volume = 1f;
			val.VolumeRandom = 0f;
			val.Pitch = 0.6f;
			val.PitchRandom = 0f;
			unAnchoringSound = val;
			val = new Sound();
			val.Source = CreateAudioSource();
			val.Sounds = controller.deathHead.eyeFlashNegativeSound.Sounds.Clone() as AudioClip[];
			val.Volume = 0.5f;
			val.VolumeRandom = 0f;
			val.Pitch = 0.3f;
			val.PitchRandom = 0.03f;
			anchorAttachSound = val;
			val = new Sound();
			val.Source = CreateAudioSource();
			val.Sounds = PlayerAvatar.instance.tumble.tumbleMoveSound.Sounds.Clone() as AudioClip[];
			val.Volume = 0.4f;
			val.VolumeRandom = 0.02f;
			val.Pitch = 0.8f;
			val.PitchRandom = 0f;
			windupSound = val;
			val = new Sound();
			val.Source = CreateAudioSource();
			val.Sounds = AssetManager.instance.batteryChargeSound.Sounds.Clone() as AudioClip[];
			val.Volume = 0.2f;
			val.VolumeRandom = 0.01f;
			val.Pitch = 1f;
			val.PitchRandom = 0.02f;
			rechargeSound = val;
			AudioSource source = CreateAudioSource();
			val = new Sound();
			val.Source = source;
			val.Sounds = Resources.FindObjectsOfTypeAll<TrapTV>().ToList().FirstOrDefault()
				.mouseTalkSound1.Sounds.Clone() as AudioClip[];
			val.Volume = 0.1f;
			val.VolumeRandom = 0f;
			val.Pitch = 1f;
			val.PitchRandom = 0.05f;
			mouseTalkSound1 = val;
			val = new Sound();
			val.So

BepInEx/plugins/EvilCheetah-TeamUpgrades/TeamUpgrades.dll

Decompiled 2 months ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using REPOTeamBoosters.Patches;
using TeamUpgrades.Configuration;
using TeamUpgrades.Patches;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("TeamUpgrades")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("TeamUpgrades")]
[assembly: AssemblyCopyright("Copyright ©  2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("ef74d5e5-8fe6-4b6a-86ed-0e29e12695bb")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace REPOTeamBoosters
{
	[BepInPlugin("EvilCheetah.REPO.TeamBoosters", "Team Boosters", "1.1.4")]
	public class TeamBoostersBase : BaseUnityPlugin
	{
		private const string mod_guid = "EvilCheetah.REPO.TeamBoosters";

		private const string mod_name = "Team Boosters";

		private const string mod_version = "1.1.4";

		private readonly Harmony harmony = new Harmony("EvilCheetah.REPO.TeamBoosters");

		private static TeamBoostersBase instance;

		internal ManualLogSource mls;

		private void Awake()
		{
			if ((Object)(object)instance == (Object)null)
			{
				instance = this;
			}
			mls = Logger.CreateLogSource("EvilCheetah.REPO.TeamBoosters");
			harmony.PatchAll(typeof(TeamBoostersBase));
			Configuration.Init(((BaseUnityPlugin)this).Config);
			(ConfigEntry<bool>, Action, string)[] array = new(ConfigEntry<bool>, Action, string)[9]
			{
				(Configuration.EnableItemUpgradeMapPlayerCountPatch, delegate
				{
					harmony.PatchAll(typeof(ItemUpgradeMapPlayerCountPatch));
				}, "Map Player Count Upgrade"),
				(Configuration.EnableItemUpgradePlayerEnergyPatch, delegate
				{
					harmony.PatchAll(typeof(ItemUpgradePlayerEnergyPatch));
				}, "Player Energy Upgrade"),
				(Configuration.EnableItemUpgradePlayerExtraJumpPatch, delegate
				{
					harmony.PatchAll(typeof(ItemUpgradePlayerExtraJumpPatch));
				}, "Player Extra Jump Upgrade"),
				(Configuration.EnableItemUpgradePlayerGrabRangePatch, delegate
				{
					harmony.PatchAll(typeof(ItemUpgradePlayerGrabRangePatch));
				}, "Player Grab Range Upgrade"),
				(Configuration.EnableItemUpgradePlayerGrabStrengthPatch, delegate
				{
					harmony.PatchAll(typeof(ItemUpgradePlayerGrabStrengthPatch));
				}, "Player Grab Strength Upgrade"),
				(Configuration.EnableItemUpgradePlayerGrabThrowPatch, delegate
				{
					harmony.PatchAll(typeof(ItemUpgradePlayerGrabThrowPatch));
				}, "Player Grab Throw Upgrade"),
				(Configuration.EnableItemUpgradePlayerHealthPatch, delegate
				{
					harmony.PatchAll(typeof(ItemUpgradePlayerHealthPatch));
				}, "Player Health Upgrade"),
				(Configuration.EnableItemUpgradePlayerSprintSpeedPatch, delegate
				{
					harmony.PatchAll(typeof(ItemUpgradePlayerSprintSpeedPatch));
				}, "Player Sprint Speed Upgrade"),
				(Configuration.EnableItemUpgradePlayerTumbleLaunchPatch, delegate
				{
					harmony.PatchAll(typeof(ItemUpgradePlayerTumbleLaunchPatch));
				}, "Player Thumle Lauch Upgrade")
			};
			for (int i = 0; i < array.Length; i++)
			{
				var (val, action, text) = array[i];
				if (val.Value)
				{
					action();
					mls.LogInfo((object)(text + " patch is applied"));
				}
			}
			mls.LogInfo((object)"Team Boosters mod has been activated");
		}
	}
}
namespace REPOTeamBoosters.Patches
{
	[HarmonyPatch(typeof(ItemUpgradeMapPlayerCount), "Upgrade")]
	internal class ItemUpgradeMapPlayerCountPatch
	{
		private static bool Prefix(ItemUpgradeMapPlayerCount __instance)
		{
			foreach (PlayerAvatar item in SemiFunc.PlayerGetAll())
			{
				PunManager.instance.UpgradeMapPlayerCount(SemiFunc.PlayerGetSteamID(item));
			}
			return false;
		}
	}
	[HarmonyPatch(typeof(ItemUpgradePlayerEnergy), "Upgrade")]
	internal class ItemUpgradePlayerEnergyPatch
	{
		private static bool Prefix(ItemUpgradePlayerEnergy __instance)
		{
			foreach (PlayerAvatar item in SemiFunc.PlayerGetAll())
			{
				PunManager.instance.UpgradePlayerEnergy(SemiFunc.PlayerGetSteamID(item));
			}
			return false;
		}
	}
	[HarmonyPatch(typeof(ItemUpgradePlayerHealth), "Upgrade")]
	internal class ItemUpgradePlayerHealthPatch
	{
		private static bool Prefix(ItemUpgradePlayerHealth __instance)
		{
			foreach (PlayerAvatar item in SemiFunc.PlayerGetAll())
			{
				PunManager.instance.UpgradePlayerHealth(SemiFunc.PlayerGetSteamID(item));
			}
			return false;
		}
	}
	[HarmonyPatch(typeof(ItemUpgradePlayerSprintSpeed), "Upgrade")]
	internal class ItemUpgradePlayerSprintSpeedPatch
	{
		private static bool Prefix(ItemUpgradePlayerSprintSpeed __instance)
		{
			foreach (PlayerAvatar item in SemiFunc.PlayerGetAll())
			{
				PunManager.instance.UpgradePlayerSprintSpeed(SemiFunc.PlayerGetSteamID(item));
			}
			return false;
		}
	}
}
namespace TeamUpgrades.Patches
{
	[HarmonyPatch(typeof(ItemUpgradePlayerExtraJump), "Upgrade")]
	internal class ItemUpgradePlayerExtraJumpPatch
	{
		private static bool Prefix(ItemUpgradePlayerExtraJump __instance)
		{
			foreach (PlayerAvatar item in SemiFunc.PlayerGetAll())
			{
				PunManager.instance.UpgradePlayerExtraJump(SemiFunc.PlayerGetSteamID(item));
			}
			return false;
		}
	}
	[HarmonyPatch(typeof(ItemUpgradePlayerGrabRange), "Upgrade")]
	internal class ItemUpgradePlayerGrabRangePatch
	{
		private static bool Prefix(ItemUpgradePlayerGrabRange __instance)
		{
			foreach (PlayerAvatar item in SemiFunc.PlayerGetAll())
			{
				PunManager.instance.UpgradePlayerGrabRange(SemiFunc.PlayerGetSteamID(item));
			}
			return false;
		}
	}
	[HarmonyPatch(typeof(ItemUpgradePlayerGrabStrength), "Upgrade")]
	internal class ItemUpgradePlayerGrabStrengthPatch
	{
		private static bool Prefix(ItemUpgradePlayerGrabStrength __instance)
		{
			foreach (PlayerAvatar item in SemiFunc.PlayerGetAll())
			{
				PunManager.instance.UpgradePlayerGrabStrength(SemiFunc.PlayerGetSteamID(item));
			}
			return false;
		}
	}
	[HarmonyPatch(typeof(ItemUpgradePlayerGrabThrow), "Upgrade")]
	internal class ItemUpgradePlayerGrabThrowPatch
	{
		private static bool Prefix(ItemUpgradePlayerGrabThrow __instance)
		{
			foreach (PlayerAvatar item in SemiFunc.PlayerGetAll())
			{
				PunManager.instance.UpgradePlayerThrowStrength(SemiFunc.PlayerGetSteamID(item));
			}
			return false;
		}
	}
	[HarmonyPatch(typeof(ItemUpgradePlayerTumbleLaunch), "Upgrade")]
	internal class ItemUpgradePlayerTumbleLaunchPatch
	{
		private static bool Prefix(ItemUpgradePlayerTumbleLaunch __instance)
		{
			foreach (PlayerAvatar item in SemiFunc.PlayerGetAll())
			{
				PunManager.instance.UpgradePlayerTumbleLaunch(SemiFunc.PlayerGetSteamID(item));
			}
			return false;
		}
	}
}
namespace TeamUpgrades.Configuration
{
	internal class Configuration
	{
		public static ConfigEntry<bool> EnableItemUpgradeMapPlayerCountPatch;

		public static ConfigEntry<bool> EnableItemUpgradePlayerEnergyPatch;

		public static ConfigEntry<bool> EnableItemUpgradePlayerExtraJumpPatch;

		public static ConfigEntry<bool> EnableItemUpgradePlayerGrabRangePatch;

		public static ConfigEntry<bool> EnableItemUpgradePlayerGrabStrengthPatch;

		public static ConfigEntry<bool> EnableItemUpgradePlayerGrabThrowPatch;

		public static ConfigEntry<bool> EnableItemUpgradePlayerHealthPatch;

		public static ConfigEntry<bool> EnableItemUpgradePlayerSprintSpeedPatch;

		public static ConfigEntry<bool> EnableItemUpgradePlayerTumbleLaunchPatch;

		public static void Init(ConfigFile config)
		{
			EnableItemUpgradeMapPlayerCountPatch = config.Bind<bool>("General", "EnableUpgradeMapPlayer", true, "Enables Team Upgrades for Map Player Count Upgrade");
			EnableItemUpgradePlayerEnergyPatch = config.Bind<bool>("General", "EnableUpgradePlayerEnergy", true, "Enables Team Upgrades for Player Energy Upgrade");
			EnableItemUpgradePlayerExtraJumpPatch = config.Bind<bool>("General", "EnableUpgradePlayerExtraJump", true, "Enables Team Upgrades for Player Extra Jump Upgrade");
			EnableItemUpgradePlayerGrabRangePatch = config.Bind<bool>("General", "EnableUpgradePlayerGrabRange", true, "Enables Team Upgrades for Player Grab Range Upgrade");
			EnableItemUpgradePlayerGrabStrengthPatch = config.Bind<bool>("General", "EnableUpgradePlayerGrabStrength", true, "Enables Team Upgrades for Player Grab Strength Upgrade");
			EnableItemUpgradePlayerGrabThrowPatch = config.Bind<bool>("General", "EnableUpgradePlayerGrabThrow", true, "Enables Team Upgrades for Player Grab Throw Upgrade");
			EnableItemUpgradePlayerHealthPatch = config.Bind<bool>("General", "EnableUpgradePlayerHealth", true, "Enables Team Upgrades for Player Health Upgrade");
			EnableItemUpgradePlayerSprintSpeedPatch = config.Bind<bool>("General", "EnableUpgradePlayerSprintSpeed", true, "Enables Team Upgrades for Player Sprint Speed Upgrade");
			EnableItemUpgradePlayerTumbleLaunchPatch = config.Bind<bool>("General", "EnableUpgradePlayerTumbleLaunch", true, "Enables Team Upgrades for Player Tumble Launch Upgrade");
		}
	}
}

BepInEx/plugins/flipf17-DeadTTS/REPO-DeadTTS.dll

Decompiled 2 months ago
using System;
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 BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using REPO_DeadTTS.Config;
using TMPro;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("REPO-DeadTTS")]
[assembly: AssemblyDescription("Mod created by flipf17")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("REPO-DeadTTS")]
[assembly: AssemblyCopyright("Copyright ©  2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("8e05cd18-c8aa-419a-b430-33faaf371490")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace REPO_DeadTTS
{
	[BepInPlugin("flipf17.DeadTTS", "DeadTTS", "1.0.10")]
	public class Plugin : BaseUnityPlugin
	{
		private Harmony _harmony;

		public static Plugin instance;

		private static ManualLogSource logger;

		private void Awake()
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Expected O, but got Unknown
			instance = this;
			CreateCustomLogger();
			ConfigSettings.BindConfigSettings();
			_harmony = new Harmony("DeadTTS");
			PatchAll();
			Log("DeadTTS loaded");
		}

		private void PatchAll()
		{
			IEnumerable<Type> enumerable;
			try
			{
				enumerable = Assembly.GetExecutingAssembly().GetTypes();
			}
			catch (ReflectionTypeLoadException ex)
			{
				enumerable = ex.Types.Where((Type t) => t != null);
			}
			foreach (Type item in enumerable)
			{
				_harmony.PatchAll(item);
			}
		}

		private void CreateCustomLogger()
		{
			try
			{
				logger = Logger.CreateLogSource(string.Format("{0}-{1}", "DeadTTS", "1.0.10"));
			}
			catch
			{
				logger = ((BaseUnityPlugin)this).Logger;
			}
		}

		internal static void Log(string message)
		{
			logger.LogInfo((object)message);
		}

		internal static void LogError(string message)
		{
			logger.LogError((object)message);
		}

		internal static void LogWarning(string message)
		{
			logger.LogWarning((object)message);
		}

		internal static void LogVerbose(string message)
		{
			if (ConfigSettings.verboseLogs.Value)
			{
				logger.LogInfo((object)("[VERBOSE] " + message));
			}
		}

		internal static void LogErrorVerbose(string message)
		{
			if (ConfigSettings.verboseLogs.Value)
			{
				logger.LogError((object)("[VERBOSE] " + message));
			}
		}

		internal static void LogWarningVerbose(string message)
		{
			if (ConfigSettings.verboseLogs.Value)
			{
				logger.LogWarning((object)("[VERBOSE] " + message));
			}
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "flipf17.DeadTTS";

		public const string PLUGIN_NAME = "DeadTTS";

		public const string PLUGIN_VERSION = "1.0.10";
	}
}
namespace REPO_DeadTTS.Patches
{
	[HarmonyPatch]
	public static class UIPatcher
	{
		private static HashSet<WorldSpaceUITTS> deadTTSElements = new HashSet<WorldSpaceUITTS>();

		private static Dictionary<PlayerAvatar, bool> isDisabledStates = new Dictionary<PlayerAvatar, bool>();

		private static FieldInfo textField = typeof(WorldSpaceUITTS).GetField("text", BindingFlags.Instance | BindingFlags.NonPublic);

		private static FieldInfo playerAvatarField = typeof(WorldSpaceUITTS).GetField("playerAvatar", BindingFlags.Instance | BindingFlags.NonPublic);

		private static FieldInfo followTransformField = typeof(WorldSpaceUITTS).GetField("followTransform", BindingFlags.Instance | BindingFlags.NonPublic);

		private static FieldInfo worldPositionField = typeof(WorldSpaceUITTS).GetField("worldPosition", BindingFlags.Instance | BindingFlags.NonPublic);

		private static FieldInfo followPositionField = typeof(WorldSpaceUITTS).GetField("followPosition", BindingFlags.Instance | BindingFlags.NonPublic);

		private static FieldInfo wordTimeField = typeof(WorldSpaceUITTS).GetField("wordTime", BindingFlags.Instance | BindingFlags.NonPublic);

		private static FieldInfo ttsVoiceField = typeof(WorldSpaceUITTS).GetField("ttsVoice", BindingFlags.Instance | BindingFlags.NonPublic);

		[HarmonyPatch(typeof(WorldSpaceUIParent), "TTS")]
		[HarmonyPrefix]
		public static void OnTTSUI(PlayerAvatar _player, string _text, float _time, WorldSpaceUIParent __instance)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Invalid comparison between Unknown and I4
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Invalid comparison between Unknown and I4
			//IL_01e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0200: Unknown result type (might be due to invalid IL or missing references)
			//IL_022d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0234: Expected O, but got Unknown
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Expected O, but got Unknown
			if (!GameManager.Multiplayer() || (int)GameDirector.instance.currentState < 2 || !ConfigSettings.deadTTSSpatialAudio.Value || (int)GameDirector.instance.currentState != 2 || !Object.op_Implicit((Object)(object)_player) || !(bool)PlayerPatcher.isDisabledField.GetValue(_player) || !Object.op_Implicit((Object)(object)_player.playerDeathHead) || string.IsNullOrEmpty(_text) || (ConfigSettings.enableWhenDiscovered.Value && !(bool)PlayerPatcher.serverSeenField.GetValue(_player.playerDeathHead) && !PlayerPatcher.IsLocalPlayerDead() && SemiFunc.RunIsLevel()))
			{
				return;
			}
			try
			{
				WorldSpaceUITTS component = Object.Instantiate<GameObject>(__instance.TTSPrefab, ((Component)__instance).transform.position, ((Component)__instance).transform.rotation, ((Component)__instance).transform).GetComponent<WorldSpaceUITTS>();
				if (!Object.op_Implicit((Object)(object)component))
				{
					return;
				}
				TMP_Text val = (TMP_Text)textField.GetValue(component);
				val.text = _text;
				if (!PlayerPatcher.IsLocalPlayerDead())
				{
					string text = val.text;
					try
					{
						text = "<color=#" + ConfigSettings.deadTTSColor.Value.TrimStart(new char[1] { '#' }) + ">" + val.text + "</color>";
						val.text = text;
					}
					catch (Exception ex)
					{
						Plugin.LogError("Failed to apply dead TTS color: " + ConfigSettings.deadTTSColor.Value + "\n" + ex);
					}
				}
				playerAvatarField.SetValue(component, _player);
				Transform transform = ((Component)_player.playerDeathHead).transform;
				followTransformField.SetValue(component, transform);
				worldPositionField.SetValue(component, transform.position);
				followPositionField.SetValue(component, transform.position);
				wordTimeField.SetValue(component, _time);
				PlayerVoiceChat val2 = (PlayerVoiceChat)PlayerPatcher.voiceChatField.GetValue(_player);
				ttsVoiceField.SetValue(component, val2.ttsVoice);
				deadTTSElements.Add(component);
				try
				{
					deadTTSElements.RemoveWhere((WorldSpaceUITTS obj) => (Object)(object)obj == (Object)null);
				}
				catch
				{
				}
			}
			catch (Exception ex2)
			{
				Plugin.LogError("Error initializing dead TTS UI:\n" + ex2);
			}
		}

		[HarmonyPatch(typeof(WorldSpaceUITTS), "Update")]
		[HarmonyPrefix]
		public static void UpdateUIPositionPrefix(WorldSpaceUITTS __instance)
		{
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Expected O, but got Unknown
			if (ConfigSettings.displayDeadTTSText.Value && deadTTSElements.Contains(__instance))
			{
				try
				{
					PlayerAvatar val = (PlayerAvatar)playerAvatarField.GetValue(__instance);
					bool value = (bool)PlayerPatcher.isDisabledField.GetValue(val);
					isDisabledStates[val] = value;
					PlayerPatcher.isDisabledField.SetValue(val, false);
				}
				catch (Exception ex)
				{
					Plugin.LogError("Error (A) updating dead TTS UI location:\n" + ex);
					deadTTSElements.Remove(__instance);
				}
			}
		}

		[HarmonyPatch(typeof(WorldSpaceUITTS), "Update")]
		[HarmonyPostfix]
		public static void UpdateUIPositionPostfix(WorldSpaceUITTS __instance)
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Expected O, but got Unknown
			if (!deadTTSElements.Contains(__instance))
			{
				return;
			}
			try
			{
				PlayerAvatar val = (PlayerAvatar)playerAvatarField.GetValue(__instance);
				if (isDisabledStates.TryGetValue(val, out var value))
				{
					PlayerPatcher.isDisabledField.SetValue(val, value);
				}
			}
			catch (Exception ex)
			{
				Plugin.LogError("Error (B) updating dead TTS UI location:\n" + ex);
				deadTTSElements.Remove(__instance);
			}
		}
	}
	[HarmonyPatch]
	public static class PlayerPatcher
	{
		internal static PlayerAvatar localPlayer;

		internal static FieldInfo voiceChatField = typeof(PlayerAvatar).GetField("voiceChat", BindingFlags.Instance | BindingFlags.NonPublic);

		internal static FieldInfo isDisabledField = typeof(PlayerAvatar).GetField("isDisabled", BindingFlags.Instance | BindingFlags.NonPublic);

		internal static FieldInfo serverSeenField = typeof(PlayerDeathHead).GetField("serverSeen", BindingFlags.Instance | BindingFlags.NonPublic);

		internal static FieldInfo eyeMaterialField = typeof(PlayerDeathHead).GetField("eyeMaterial", BindingFlags.Instance | BindingFlags.NonPublic);

		internal static FieldInfo eyeMaterialAmountField = typeof(PlayerDeathHead).GetField("eyeMaterialAmount", BindingFlags.Instance | BindingFlags.NonPublic);

		internal static FieldInfo eyeFlashLerpField = typeof(PlayerDeathHead).GetField("eyeFlashLerp", BindingFlags.Instance | BindingFlags.NonPublic);

		internal static FieldInfo isSpeakingField = typeof(TTSVoice).GetField("isSpeaking", BindingFlags.Instance | BindingFlags.NonPublic);

		internal static Dictionary<PlayerAvatar, float> deadPlayersVoicePitch = new Dictionary<PlayerAvatar, float>();

		[HarmonyPatch(typeof(PlayerAvatar), "Awake")]
		[HarmonyPostfix]
		public static void InitPlayer(ref bool ___isLocal, PlayerAvatar __instance)
		{
			if (___isLocal)
			{
				localPlayer = __instance;
			}
		}

		[HarmonyPatch(typeof(RoundDirector), "StartRoundLogic")]
		[HarmonyPrefix]
		public static void RandomizeTTSPitch(int value, RoundDirector __instance)
		{
			int num = value;
			deadPlayersVoicePitch.Clear();
			for (int i = 0; i < GameDirector.instance.PlayerList.Count; i++)
			{
				PlayerAvatar val = GameDirector.instance.PlayerList[i];
				if (!Object.op_Implicit((Object)(object)val))
				{
					continue;
				}
				float num2 = 1f;
				if (GameManager.Multiplayer() && value > 0)
				{
					int num3 = -1;
					int seed = -1;
					try
					{
						num3 = val.photonView.Owner.ActorNumber;
					}
					catch (Exception ex)
					{
						Plugin.LogWarning("Failed to get player id for player: " + ((Object)val).name + " when calculating random seed. Don't worry about this.");
						Plugin.LogWarningVerbose("Error: " + ex);
					}
					if (num3 != -1)
					{
						seed = num + num3;
						Random random = new Random(seed);
						float value2 = ConfigSettings.minRandomPitch.Value;
						float value3 = ConfigSettings.maxRandomPitch.Value;
						num2 = (float)(random.NextDouble() * (double)(value3 - value2) + (double)value2);
					}
					if (deadPlayersVoicePitch.TryGetValue(val, out var value4) && num2 != value4)
					{
						Plugin.Log("Setting dead TTS pitch for player with id: " + num3 + " to: " + num2);
					}
					Plugin.LogVerbose("BaseSeed: " + num + " PlayerId: " + num3 + " PlayerSeed: " + seed);
				}
				deadPlayersVoicePitch[val] = num2;
			}
		}

		[HarmonyPatch(typeof(PlayerVoiceChat), "TtsFollowVoiceSettings")]
		[HarmonyPostfix]
		public static void OnTtsFollowVoiceSettings(ref PlayerAvatar ___playerAvatar, ref AudioLowPassLogic ___lowPassLogicTTS, ref bool ___inLobbyMixerTTS, ref float ___clipLoudnessTTS, PlayerVoiceChat __instance)
		{
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Invalid comparison between Unknown and I4
			//IL_0234: Unknown result type (might be due to invalid IL or missing references)
			//IL_023b: Expected O, but got Unknown
			if (!Object.op_Implicit((Object)(object)___playerAvatar) || !Object.op_Implicit((Object)(object)___playerAvatar.playerDeathHead) || !GameManager.Multiplayer() || (int)GameDirector.instance.currentState < 2 || !((IsPlayerDead(___playerAvatar) && ((Behaviour)___playerAvatar.playerDeathHead).isActiveAndEnabled) & ___inLobbyMixerTTS))
			{
				return;
			}
			if ((!ConfigSettings.enableWhenDiscovered.Value || (bool)serverSeenField.GetValue(___playerAvatar.playerDeathHead) || IsLocalPlayerDead() || !SemiFunc.RunIsLevel()) && Object.op_Implicit((Object)(object)__instance.ttsAudioSource) && Object.op_Implicit((Object)(object)__instance.ttsVoice) && Object.op_Implicit((Object)(object)__instance.mixerTTSSound))
			{
				if ((Object)(object)__instance.ttsAudioSource.outputAudioMixerGroup != (Object)(object)__instance.mixerTTSSound)
				{
					Plugin.LogVerbose("The game has toggled ON lobby chat for player: " + ((Object)___playerAvatar).name + ". Disabling TTS lobby mixer.");
					__instance.ttsVoice.setVoice(1);
					__instance.ttsAudioSource.outputAudioMixerGroup = __instance.mixerTTSSound;
					__instance.ttsVoice.StopAndClearVoice();
				}
				float pitch = (deadPlayersVoicePitch.ContainsKey(___playerAvatar) ? deadPlayersVoicePitch[___playerAvatar] : 1f);
				__instance.ttsAudioSource.pitch = pitch;
				if ((!ConfigSettings.disableWhileDead.Value || !IsLocalPlayerDead()) && (Object)(object)___playerAvatar != (Object)(object)localPlayer)
				{
					__instance.ttsAudioSource.volume = ConfigSettings.deadTTSVolume.Value;
					if (ConfigSettings.deadTTSSpatialAudio.Value)
					{
						__instance.ttsAudioSource.spatialBlend = 1f;
					}
				}
				else
				{
					__instance.ttsAudioSource.volume = 1f;
				}
			}
			if (Object.op_Implicit((Object)(object)___playerAvatar.playerDeathHead))
			{
				bool flag = (bool)isSpeakingField.GetValue(__instance.ttsVoice);
				Material val = (Material)eyeMaterialField.GetValue(___playerAvatar.playerDeathHead);
				int num = (int)eyeMaterialAmountField.GetValue(___playerAvatar.playerDeathHead);
				if (flag)
				{
					float num2 = (float)eyeFlashLerpField.GetValue(___playerAvatar.playerDeathHead);
					float num3 = Mathf.Clamp01(Mathf.Max(___clipLoudnessTTS, 0f) / 0.2f);
					num2 = Mathf.Lerp(num2, num3, 20f * Time.deltaTime);
					val.SetFloat(num, Mathf.Pow(num2, 0.5f));
					eyeFlashLerpField.SetValue(___playerAvatar.playerDeathHead, num2);
				}
			}
		}

		[HarmonyPatch(typeof(PlayerVoiceChat), "ToggleLobby")]
		[HarmonyPostfix]
		public static void OnToggleOffLobbyChat(bool _toggle, ref PlayerAvatar ___playerAvatar, PlayerVoiceChat __instance)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Invalid comparison between Unknown and I4
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Expected O, but got Unknown
			if (GameManager.Multiplayer() && (int)GameDirector.instance.currentState >= 2 && !_toggle)
			{
				Plugin.LogVerbose("The game has toggled OFF lobby chat for player: " + ((Object)___playerAvatar).name);
				if (Object.op_Implicit((Object)(object)__instance.ttsAudioSource) && Object.op_Implicit((Object)(object)__instance.mixerTTSSound))
				{
					__instance.ttsAudioSource.volume = 1f;
					__instance.ttsAudioSource.pitch = 1f;
					__instance.ttsVoice.setVoice(0);
				}
				if (Object.op_Implicit((Object)(object)___playerAvatar.playerDeathHead))
				{
					Material val = (Material)eyeMaterialField.GetValue(___playerAvatar.playerDeathHead);
					int num = (int)eyeMaterialAmountField.GetValue(___playerAvatar.playerDeathHead);
					val.SetFloat(num, 0f);
				}
			}
		}

		[HarmonyPatch(typeof(PlayerVoiceChat), "LateUpdate")]
		[HarmonyPrefix]
		public static void MoveTTSAudioTransform(ref PlayerAvatar ___playerAvatar, ref bool ___inLobbyMixerTTS, PlayerVoiceChat __instance)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Invalid comparison between Unknown and I4
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			if (LevelGenerator.Instance.Generated && Object.op_Implicit((Object)(object)___playerAvatar) && GameManager.Multiplayer() && (int)GameDirector.instance.currentState >= 2 && ___inLobbyMixerTTS && IsPlayerDead(___playerAvatar) && Object.op_Implicit((Object)(object)___playerAvatar.playerDeathHead) && Object.op_Implicit((Object)(object)__instance.ttsVoice))
			{
				((Component)__instance).transform.position = Vector3.Lerp(((Component)__instance).transform.position, ((Component)___playerAvatar.playerDeathHead).transform.position, 30f * Time.deltaTime);
			}
		}

		public static bool IsLocalPlayerDead()
		{
			return IsPlayerDead(PlayerAvatar.instance);
		}

		public static bool IsPlayerDead(PlayerAvatar playerAvatar)
		{
			if (!Object.op_Implicit((Object)(object)playerAvatar) || !Object.op_Implicit((Object)(object)playerAvatar.playerDeathHead))
			{
				return false;
			}
			return (bool)isDisabledField.GetValue(playerAvatar) && ((Behaviour)playerAvatar.playerDeathHead).isActiveAndEnabled;
		}
	}
}
namespace REPO_DeadTTS.Config
{
	[Serializable]
	public static class ConfigSettings
	{
		public static ConfigEntry<float> minRandomPitch;

		public static ConfigEntry<float> maxRandomPitch;

		public static ConfigEntry<float> deadTTSVolume;

		public static ConfigEntry<bool> displayDeadTTSText;

		public static ConfigEntry<bool> deadTTSSpatialAudio;

		public static ConfigEntry<bool> enableWhenDiscovered;

		public static ConfigEntry<bool> disableWhileDead;

		public static ConfigEntry<string> deadTTSColor;

		public static ConfigEntry<bool> verboseLogs;

		public static Dictionary<string, ConfigEntryBase> currentConfigEntries = new Dictionary<string, ConfigEntryBase>();

		internal static void BindConfigSettings()
		{
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Expected O, but got Unknown
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Expected O, but got Unknown
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Expected O, but got Unknown
			//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b0: Expected O, but got Unknown
			//IL_01da: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e4: Expected O, but got Unknown
			Plugin.Log("Binding Configs");
			minRandomPitch = AddConfigEntry<float>(((BaseUnityPlugin)Plugin.instance).Config.Bind<float>("General", "Dead TTS Random Pitch Min", 0.8f, new ConfigDescription("The lower range limit when randomizing dead players pitch.\nValues will be clamped between 0.8 and 2.0", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.8f, 2f), Array.Empty<object>())));
			maxRandomPitch = AddConfigEntry<float>(((BaseUnityPlugin)Plugin.instance).Config.Bind<float>("General", "Dead TTS Random Pitch Max", 1.5f, new ConfigDescription("The upper range limit when randomizing dead players pitch.\nValues will be clamped between 0.8 and 2.0", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.8f, 2f), Array.Empty<object>())));
			deadTTSVolume = AddConfigEntry<float>(((BaseUnityPlugin)Plugin.instance).Config.Bind<float>("General", "Dead TTS Volume", 0.5f, new ConfigDescription("Affects the TTS volume of all dead players.\nSet to 0 to mute the TTS of dead players. If muted, the TTS text will still appear.\nValues will be clamped between 0.0 and 1.0", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>())));
			displayDeadTTSText = AddConfigEntry<bool>(((BaseUnityPlugin)Plugin.instance).Config.Bind<bool>("General", "Display Dead TTS Text", true, "If true, TTS Text will appear from dead players' heads."));
			deadTTSSpatialAudio = AddConfigEntry<bool>(((BaseUnityPlugin)Plugin.instance).Config.Bind<bool>("General", "Use Spatial Audio", true, "If true, TTS audio from dead players should be 3D directional.\nIf false, the audio should appear as if it's in your head all the time."));
			enableWhenDiscovered = AddConfigEntry<bool>(((BaseUnityPlugin)Plugin.instance).Config.Bind<bool>("General", "Enable When Discovered", false, "If true, you will only head DeadTTS from players once their head is \"discovered\"."));
			disableWhileDead = AddConfigEntry<bool>(((BaseUnityPlugin)Plugin.instance).Config.Bind<bool>("General", "Disable Spatial TTS While Dead", false, "This will only disable the (directional) DeadTTS for other dead players while you (the local player) are dead. Pitch will remain synced, however."));
			deadTTSColor = AddConfigEntry<string>(((BaseUnityPlugin)Plugin.instance).Config.Bind<string>("General", "Dead TTS Text Color Hex", "CC3333", new ConfigDescription("Hex color value for dead TTS text color. Hex string must be 6 characters long.", (AcceptableValueBase)null, Array.Empty<object>())));
			verboseLogs = AddConfigEntry<bool>(((BaseUnityPlugin)Plugin.instance).Config.Bind<bool>("General", "Verbose Logs", false, new ConfigDescription("Enables verbose logs. Useful for debugging.", (AcceptableValueBase)null, Array.Empty<object>())));
			if (minRandomPitch.Value < 0.8f)
			{
				minRandomPitch.Value = (float)((ConfigEntryBase)minRandomPitch).DefaultValue;
			}
			if (maxRandomPitch.Value > 2f)
			{
				maxRandomPitch.Value = (float)((ConfigEntryBase)maxRandomPitch).DefaultValue;
			}
			minRandomPitch.Value = Mathf.Clamp(minRandomPitch.Value, 0.8f, 2f);
			maxRandomPitch.Value = Mathf.Max(maxRandomPitch.Value, minRandomPitch.Value);
			deadTTSVolume.Value = Mathf.Clamp(deadTTSVolume.Value, 0f, 2f);
		}

		internal static ConfigEntry<T> AddConfigEntry<T>(ConfigEntry<T> configEntry)
		{
			currentConfigEntries.Add(((ConfigEntryBase)configEntry).Definition.Key, (ConfigEntryBase)(object)configEntry);
			return configEntry;
		}
	}
}

BepInEx/plugins/GalaxyMods-MoreShopItems/MoreShopItems.dll

Decompiled 2 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using MoreShopItems.Compatability;
using MoreShopItems.Config;
using Photon.Pun;
using REPOLib.Modules;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("MoreShopItems")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.3.3.0")]
[assembly: AssemblyInformationalVersion("1.3.3")]
[assembly: AssemblyProduct("More Shop Items")]
[assembly: AssemblyTitle("MoreShopItems")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.3.3.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.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace MoreShopItems
{
	[BepInPlugin("MoreShopItems", "More Shop Items", "1.3.3")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		private readonly Harmony _harmony = new Harmony("MoreShopItems");

		internal Dictionary<string, ConfigEntry<int>> intConfigEntries = new Dictionary<string, ConfigEntry<int>>();

		internal Dictionary<string, ConfigEntry<bool>> boolConfigEntries = new Dictionary<string, ConfigEntry<bool>>();

		internal static GameObject CustomItemShelf;

		internal static Plugin Instance { get; private set; }

		internal static ManualLogSource Logger { get; private set; }

		private void Awake()
		{
			Instance = CheckInstance();
			Logger = ((BaseUnityPlugin)this).Logger;
			LoadConfig();
			AssetBundle bundle = LoadAssetBundle("moreshopitems_assets.file");
			CustomItemShelf = LoadAssetFromBundle(bundle, "custom_soda_shelf");
			NetworkPrefabs.RegisterNetworkPrefab(CustomItemShelf);
			_harmony.PatchAll(typeof(ShopManagerPatch));
			_harmony.PatchAll(typeof(PunManagerPatch));
			Logger.LogInfo((object)"\n __  __               ___ _               ___ _                \n|  \\/  |___ _ _ ___  / __| |_  ___ _ __  |_ _| |_ ___ _ __  ___\n| |\\/| / _ \\ '_/ -_) \\__ \\ ' \\/ _ \\ '_ \\  | ||  _/ -_) '  \\(_-<\n|_|  |_\\___/_| \\___| |___/_||_\\___/ .__/ |___|\\__\\___|_|_|_/__/\n                                  |_|                    v1.3.3\n");
		}

		private Plugin CheckInstance()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				return this;
			}
			return Instance;
		}

		private void LoadConfig()
		{
			string[] configDescriptions = ConfigEntries.GetConfigDescriptions();
			intConfigEntries.Add("Max Upgrades In Shop", ConfigHelper.CreateConfig<ConfigEntry<int>>("Upgrades", "Max Upgrades In Shop", 5, configDescriptions[0], -1, 20));
			intConfigEntries.Add("Max Upgrade Purchase Amount", ConfigHelper.CreateConfig<ConfigEntry<int>>("Upgrades", "Max Upgrade Purchase Amount", 0, configDescriptions[1], 0, 1000));
			intConfigEntries.Add("Max Melee Weapons In Shop", ConfigHelper.CreateConfig<ConfigEntry<int>>("Weapons", "Max Melee Weapons In Shop", 5, configDescriptions[2], -1, 20));
			intConfigEntries.Add("Max Melee Weapon Purchase Amount", ConfigHelper.CreateConfig<ConfigEntry<int>>("Weapons", "Max Melee Weapon Purchase Amount", 0, configDescriptions[3], 0, 1000));
			intConfigEntries.Add("Max Guns In Shop", ConfigHelper.CreateConfig<ConfigEntry<int>>("Weapons", "Max Guns In Shop", 5, configDescriptions[4], -1, 20));
			intConfigEntries.Add("Max Gun Purchase Amount", ConfigHelper.CreateConfig<ConfigEntry<int>>("Weapons", "Max Gun Purchase Amount", 0, configDescriptions[5], 0, 1000));
			intConfigEntries.Add("Max Grenades In Shop", ConfigHelper.CreateConfig<ConfigEntry<int>>("Weapons", "Max Grenades In Shop", 5, configDescriptions[6], -1, 20));
			intConfigEntries.Add("Max Grenade Purchase Amount", ConfigHelper.CreateConfig<ConfigEntry<int>>("Weapons", "Max Grenade Purchase Amount", 0, configDescriptions[7], 0, 1000));
			intConfigEntries.Add("Max Mines In Shop", ConfigHelper.CreateConfig<ConfigEntry<int>>("Weapons", "Max Mines In Shop", 5, configDescriptions[8], -1, 20));
			intConfigEntries.Add("Max Mine Purchase Amount", ConfigHelper.CreateConfig<ConfigEntry<int>>("Weapons", "Max Mine Purchase Amount", 0, configDescriptions[9], 0, 1000));
			intConfigEntries.Add("Max Health-Packs In Shop", ConfigHelper.CreateConfig<ConfigEntry<int>>("Health-Packs", "Max Health-Packs In Shop", 15, configDescriptions[10], -1, 20));
			intConfigEntries.Add("Max Health-Pack Purchase Amount", ConfigHelper.CreateConfig<ConfigEntry<int>>("Health-Packs", "Max Health-Pack Purchase Amount", 0, configDescriptions[11], 0, 1000));
			intConfigEntries.Add("Max Drones In Shop", ConfigHelper.CreateConfig<ConfigEntry<int>>("Utilities", "Max Drones In Shop", 5, configDescriptions[12], -1, 20));
			intConfigEntries.Add("Max Drone Purchase Amount", ConfigHelper.CreateConfig<ConfigEntry<int>>("Utilities", "Max Drone Purchase Amount", 0, configDescriptions[13], 0, 1000));
			intConfigEntries.Add("Max Orbs In Shop", ConfigHelper.CreateConfig<ConfigEntry<int>>("Utilities", "Max Orbs In Shop", 5, configDescriptions[14], -1, 20));
			intConfigEntries.Add("Max Orb Purchase Amount", ConfigHelper.CreateConfig<ConfigEntry<int>>("Utilities", "Max Orb Purchase Amount", 0, configDescriptions[15], 0, 1000));
			intConfigEntries.Add("Max Crystals In Shop", ConfigHelper.CreateConfig<ConfigEntry<int>>("Utilities", "Max Crystals In Shop", 5, configDescriptions[16], -1, 20));
			intConfigEntries.Add("Max Crystal Purchase Amount", ConfigHelper.CreateConfig<ConfigEntry<int>>("Utilities", "Max Crystal Purchase Amount", 0, configDescriptions[17], 0, 1000));
			intConfigEntries.Add("Max Trackers In Shop", ConfigHelper.CreateConfig<ConfigEntry<int>>("Utilities", "Max Trackers In Shop", 5, configDescriptions[18], -1, 20));
			intConfigEntries.Add("Max Tracker Purchase Amount", ConfigHelper.CreateConfig<ConfigEntry<int>>("Utilities", "Max Tracker Purchase Amount", 0, configDescriptions[19], 0, 1000));
			boolConfigEntries.Add("Override Modded Items", ConfigHelper.CreateConfig<ConfigEntry<bool>>("General", "Override Modded Items", true, configDescriptions[20], -1, -1));
			boolConfigEntries.Add("Override Single-Use Upgrades", ConfigHelper.CreateConfig<ConfigEntry<bool>>("General", "Override Single-Use Upgrades", false, configDescriptions[21], -1, -1));
			boolConfigEntries.Add("Spawn Additional Shelving", ConfigHelper.CreateConfig<ConfigEntry<bool>>("General", "Spawn Additional Shelving", true, configDescriptions[22], -1, -1));
		}

		private AssetBundle LoadAssetBundle(string filename)
		{
			return AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)Instance).Info.Location), filename));
		}

		private GameObject LoadAssetFromBundle(AssetBundle bundle, string name)
		{
			return bundle.LoadAsset<GameObject>(name);
		}
	}
	[HarmonyPatch(typeof(ShopManager))]
	internal static class ShopManagerPatch
	{
		private static readonly FieldRef<ShopManager, int> itemSpawnTargetAmount_ref = AccessTools.FieldRefAccess<ShopManager, int>("itemSpawnTargetAmount");

		private static readonly FieldRef<ShopManager, int> itemConsumablesAmount_ref = AccessTools.FieldRefAccess<ShopManager, int>("itemConsumablesAmount");

		private static readonly FieldRef<ShopManager, int> itemUpgradesAmount_ref = AccessTools.FieldRefAccess<ShopManager, int>("itemUpgradesAmount");

		private static readonly FieldRef<ShopManager, int> itemHealthPacksAmount_ref = AccessTools.FieldRefAccess<ShopManager, int>("itemHealthPacksAmount");

		private static GameObject shelf;

		internal static bool isMoreUpgrades = false;

		[HarmonyPrefix]
		[HarmonyPatch("Awake")]
		private static void SetValues(ShopManager __instance)
		{
			ref int reference = ref itemSpawnTargetAmount_ref.Invoke(__instance);
			ref int reference2 = ref itemConsumablesAmount_ref.Invoke(__instance);
			ref int reference3 = ref itemUpgradesAmount_ref.Invoke(__instance);
			ref int reference4 = ref itemHealthPacksAmount_ref.Invoke(__instance);
			reference = 250;
			reference2 = 100;
			reference3 = 50;
			reference4 = 50;
		}

		[HarmonyPrefix]
		[HarmonyPatch("ShopInitialize")]
		private static void SpawnShelf()
		{
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: 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_01a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0223: Unknown result type (might be due to invalid IL or missing references)
			//IL_022f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0243: Unknown result type (might be due to invalid IL or missing references)
			//IL_0248: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0300: Unknown result type (might be due to invalid IL or missing references)
			//IL_030a: Unknown result type (might be due to invalid IL or missing references)
			//IL_030f: Unknown result type (might be due to invalid IL or missing references)
			//IL_031b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0325: Unknown result type (might be due to invalid IL or missing references)
			//IL_032a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0336: Unknown result type (might be due to invalid IL or missing references)
			//IL_034a: Unknown result type (might be due to invalid IL or missing references)
			//IL_034f: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_03de: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_0403: Unknown result type (might be due to invalid IL or missing references)
			//IL_0408: Unknown result type (might be due to invalid IL or missing references)
			if (!(RunManager.instance.levelCurrent.ResourcePath == "Shop") || !Plugin.Instance.boolConfigEntries["Spawn Additional Shelving"].Value)
			{
				return;
			}
			GameObject val = GameObject.Find("Soda Shelf");
			GameObject val2 = GameObject.Find("Module Switch BOT");
			if ((Object)(object)val != (Object)null && !val2.GetComponent<ModulePropSwitch>().ConnectedParent.activeSelf)
			{
				if (!SemiFunc.IsMultiplayer())
				{
					shelf = Object.Instantiate<GameObject>(Plugin.CustomItemShelf, val.transform.position, val.transform.rotation, val2.transform);
				}
				else
				{
					if (!SemiFunc.IsMasterClient())
					{
						val.SetActive(false);
						return;
					}
					shelf = PhotonNetwork.Instantiate(((Object)Plugin.CustomItemShelf).name, val.transform.position, val.transform.rotation, (byte)0, (object[])null);
					SetParent(val2.transform, shelf);
				}
				val.SetActive(false);
			}
			else
			{
				GameObject val3 = GameObject.Find("Shop Magazine Stand (1)");
				GameObject val4 = GameObject.Find("Shop Magazine Stand");
				GameObject val5 = GameObject.Find("Module Switch (1) top");
				if ((Object)(object)val3 != (Object)null && !val5.GetComponent<ModulePropSwitch>().ConnectedParent.activeSelf)
				{
					if (!SemiFunc.IsMultiplayer())
					{
						shelf = Object.Instantiate<GameObject>(Plugin.CustomItemShelf, val3.transform.position, val3.transform.rotation * Quaternion.Euler(0f, 90f, 0f), val5.transform.parent);
					}
					else
					{
						if (!SemiFunc.IsMasterClient())
						{
							val3.SetActive(false);
							if ((Object)(object)val4 != (Object)null)
							{
								val4.SetActive(false);
							}
							return;
						}
						shelf = PhotonNetwork.Instantiate(((Object)Plugin.CustomItemShelf).name, val3.transform.position, val3.transform.rotation * Quaternion.Euler(0f, 90f, 0f), (byte)0, (object[])null);
						SetParent(val5.transform, shelf);
					}
					val3.SetActive(false);
					if ((Object)(object)val4 != (Object)null)
					{
						val4.SetActive(false);
					}
				}
				else
				{
					GameObject val6 = GameObject.Find("Module Switch (2) left");
					GameObject val7 = GameObject.Find("Candy Shelf");
					if (!((Object)(object)val6 != (Object)null) || val6.GetComponent<ModulePropSwitch>().ConnectedParent.activeSelf)
					{
						Plugin.Logger.LogInfo((object)"Edge case found. Temporarily preventing spawn of custom shelf.");
						return;
					}
					if (!SemiFunc.IsMultiplayer())
					{
						shelf = Object.Instantiate<GameObject>(Plugin.CustomItemShelf, val6.transform.position + val6.transform.right * 0.5f - val6.transform.forward * 0.8f, val6.transform.rotation * Quaternion.Euler(0f, 180f, 0f), val5.transform.parent);
					}
					else
					{
						if (!SemiFunc.IsMasterClient())
						{
							if ((Object)(object)val7 != (Object)null)
							{
								val7.SetActive(false);
							}
							return;
						}
						shelf = PhotonNetwork.Instantiate(((Object)Plugin.CustomItemShelf).name, val6.transform.position + val6.transform.right * 0.5f - val6.transform.forward * 0.8f, val6.transform.rotation * Quaternion.Euler(0f, 180f, 0f), (byte)0, (object[])null);
						SetParent(val6.transform, shelf);
					}
					if ((Object)(object)val7 != (Object)null)
					{
						val7.SetActive(false);
					}
				}
			}
			Plugin.Logger.LogInfo((object)"Successfully spawned the shelf!");
		}

		[HarmonyPrefix]
		[HarmonyPatch("ShopInitialize")]
		private static void AdjustItems()
		{
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: 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_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Expected I4, but got Unknown
			//IL_03d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d8: Invalid comparison between Unknown and I4
			//IL_03de: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e4: Invalid comparison between Unknown and I4
			//IL_03e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ef: Invalid comparison between Unknown and I4
			if (!(RunManager.instance.levelCurrent.ResourcePath == "Shop") || (Object)(object)StatsManager.instance == (Object)null || (!SemiFunc.IsMasterClient() && SemiFunc.IsMultiplayer()))
			{
				return;
			}
			Dictionary<string, ConfigEntry<int>> intConfigEntries = Plugin.Instance.intConfigEntries;
			Dictionary<string, ConfigEntry<bool>> boolConfigEntries = Plugin.Instance.boolConfigEntries;
			Plugin.Logger.LogInfo((object)("Override modded items = " + boolConfigEntries["Override Modded Items"].Value));
			foreach (Item value in StatsManager.instance.itemDictionary.Values)
			{
				int num = -2;
				int maxPurchaseAmount = -2;
				itemType itemType = value.itemType;
				itemType val = itemType;
				switch ((int)val)
				{
				case 0:
					if (intConfigEntries["Max Drones In Shop"].Value != -1)
					{
						num = intConfigEntries["Max Drones In Shop"].Value;
						maxPurchaseAmount = intConfigEntries["Max Drone Purchase Amount"].Value;
					}
					break;
				case 1:
					if (intConfigEntries["Max Orbs In Shop"].Value != -1)
					{
						num = intConfigEntries["Max Orbs In Shop"].Value;
						maxPurchaseAmount = intConfigEntries["Max Orb Purchase Amount"].Value;
					}
					break;
				case 3:
					if (intConfigEntries["Max Upgrades In Shop"].Value != -1)
					{
						num = intConfigEntries["Max Upgrades In Shop"].Value;
						maxPurchaseAmount = intConfigEntries["Max Upgrade Purchase Amount"].Value;
					}
					break;
				case 5:
					if (intConfigEntries["Max Crystals In Shop"].Value != -1)
					{
						num = intConfigEntries["Max Crystals In Shop"].Value;
						maxPurchaseAmount = intConfigEntries["Max Crystal Purchase Amount"].Value;
					}
					break;
				case 6:
					if (intConfigEntries["Max Grenades In Shop"].Value != -1)
					{
						num = intConfigEntries["Max Grenades In Shop"].Value;
						maxPurchaseAmount = intConfigEntries["Max Grenade Purchase Amount"].Value;
					}
					break;
				case 7:
					if (intConfigEntries["Max Melee Weapons In Shop"].Value != -1)
					{
						num = intConfigEntries["Max Melee Weapons In Shop"].Value;
						maxPurchaseAmount = intConfigEntries["Max Melee Weapon Purchase Amount"].Value;
					}
					break;
				case 8:
					if (intConfigEntries["Max Health-Packs In Shop"].Value != -1)
					{
						num = intConfigEntries["Max Health-Packs In Shop"].Value;
						maxPurchaseAmount = intConfigEntries["Max Health-Pack Purchase Amount"].Value;
					}
					break;
				case 9:
					if (intConfigEntries["Max Guns In Shop"].Value != -1)
					{
						num = intConfigEntries["Max Guns In Shop"].Value;
						maxPurchaseAmount = intConfigEntries["Max Gun Purchase Amount"].Value;
					}
					break;
				case 10:
					if (intConfigEntries["Max Trackers In Shop"].Value != -1)
					{
						num = intConfigEntries["Max Trackers In Shop"].Value;
						maxPurchaseAmount = intConfigEntries["Max Tracker Purchase Amount"].Value;
					}
					break;
				case 11:
					if (intConfigEntries["Max Mines In Shop"].Value != -1)
					{
						num = intConfigEntries["Max Mines In Shop"].Value;
						maxPurchaseAmount = intConfigEntries["Max Mine Purchase Amount"].Value;
					}
					break;
				default:
					continue;
				}
				bool flag = (int)value.itemType == 3;
				if ((int)value.itemType == 2 || (int)value.itemType == 12 || num == -2)
				{
					continue;
				}
				if (boolConfigEntries["Override Modded Items"].Value)
				{
					if (boolConfigEntries["Override Single-Use Upgrades"].Value && flag)
					{
						SetItemValues(value, num, maxPurchaseAmount);
					}
					else if (value.maxPurchase)
					{
						if (!flag)
						{
							SetItemValues(value, num, maxPurchaseAmount);
						}
					}
					else
					{
						SetItemValues(value, num, maxPurchaseAmount);
					}
				}
				else if ((!MoreUpgradesMOD.isLoaded() || !value.itemAssetName.Contains("Modded")) && !(VanillaUpgradesMOD.isLoaded() && flag))
				{
					if (boolConfigEntries["Override Single-Use Upgrades"].Value && flag)
					{
						SetItemValues(value, num, maxPurchaseAmount);
					}
					else if (flag && !value.maxPurchase)
					{
						SetItemValues(value, num, maxPurchaseAmount);
					}
					else if (!flag)
					{
						SetItemValues(value, num, maxPurchaseAmount);
					}
				}
			}
		}

		private static void SetItemValues(Item item, int maxInShop, int maxPurchaseAmount)
		{
			item.maxAmountInShop = (item.maxAmount = maxInShop);
			item.maxPurchase = maxPurchaseAmount > 0;
			item.maxPurchaseAmount = maxPurchaseAmount;
		}

		[PunRPC]
		public static void SetParent(Transform parent, GameObject gameObj)
		{
			gameObj.transform.SetParent(parent);
		}
	}
	[HarmonyPatch(typeof(PunManager))]
	internal static class PunManagerPatch
	{
		[HarmonyPrefix]
		[HarmonyPatch("TruckPopulateItemVolumes")]
		private static void RemoveNullValues()
		{
			if (!((Object)(object)ItemManager.instance == (Object)null) && (SemiFunc.IsMasterClient() || !SemiFunc.IsMultiplayer()))
			{
				ItemManager.instance.itemVolumes.RemoveAll((ItemVolume volume) => (Object)(object)volume == (Object)null);
			}
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "MoreShopItems";

		public const string PLUGIN_NAME = "More Shop Items";

		public const string PLUGIN_VERSION = "1.3.3";
	}
}
namespace MoreShopItems.Compatability
{
	internal class MoreUpgradesMOD
	{
		internal const string modGUID = "bulletbot.moreupgrades";

		public static bool isLoaded()
		{
			return Chainloader.PluginInfos.ContainsKey("bulletbot.moreupgrades");
		}
	}
	internal class VanillaUpgradesMOD
	{
		internal const string modGUID = "bulletbot.vanillaupgrades";

		public static bool isLoaded()
		{
			return Chainloader.PluginInfos.ContainsKey("bulletbot.vanillaupgrades");
		}
	}
}
namespace MoreShopItems.Constants
{
	public static class Values
	{
		public const int TargetSpawnAmount = 250;

		public const int UpgradesAmount = 50;

		public const int HealthPacksAmount = 50;

		public const int ConsumablesAmount = 100;
	}
}
namespace MoreShopItems.Config
{
	public static class ConfigEntries
	{
		private static string[] DESCRIPTIONS = new string[23]
		{
			"How many of each upgrade to spawn in the shop.", "How many upgrades you can purchase total. Set 0 to disable", "How many of each melee weapon to spawn in the shop.", "How many melee weapons you can purchase total. Set 0 to disable", "How many of each gun to spawn in the shop.", "How many guns you can purchase total. Set 0 to disable", "How many of each grenade to spawn in the shop.", "How many grenades you can purchase total. Set 0 to disable", "How many of each mine to spawn in the shop.", "How many mines you can purchase total. Set 0 to disable",
			"How many of each health-pack to spawn in the shop.", "How many health-packs you can purchase total. Set 0 to disable", "How many of each drone to spawn in the shop.", "How many drones you can purchase total. Set 0 to disable", "How many of each orb to spawn in the shop.", "How many orbs you can purchase total. Set 0 to disable", "How many of each crystal to spawn in the shop.", "How many crystals you can purchase total. Set 0 to disable", "How many trackers to spawn in the shop.", "How many trackers you can purchase total. Set 0 to disable",
			"Overrides the values (MaxAmountInShop, MaxPurchaseAmount) set by other item/upgrade mods.", "Overrides the values (MaxAmountInShop, MaxPurchaseAmount) of single-use upgrades.", "Spawns the additional shelving into the shop (set false to disable the shelf spawning)."
		};

		public static string[] GetConfigDescriptions()
		{
			return DESCRIPTIONS;
		}
	}
	public class ConfigHelper
	{
		public static T CreateConfig<T>(string section, string name, object value, string desc, int min, int max)
		{
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Expected O, but got Unknown
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Expected O, but got Unknown
			if (value is int)
			{
				return (T)(object)((BaseUnityPlugin)Plugin.Instance).Config.Bind<int>(section, name, (int)value, new ConfigDescription(desc, (AcceptableValueBase)(object)new AcceptableValueRange<int>(min, max), Array.Empty<object>()));
			}
			return (T)(object)((BaseUnityPlugin)Plugin.Instance).Config.Bind<bool>(section, name, (bool)value, new ConfigDescription(desc, (AcceptableValueBase)null, Array.Empty<object>()));
		}
	}
}

BepInEx/plugins/Godji-UltimateRevive/UltimateRevive.dll

Decompiled 2 months ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using UltimateRevive.Patches;
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Controls;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("UltimateRevive")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("UltimateRevive")]
[assembly: AssemblyCopyright("Copyright ©  2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("f6d01380-ae72-46c1-999b-efd8e0c25027")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace UltimateRevive
{
	[BepInPlugin("Godji.UltimateRevive", "REPO Ultimate Revive", "1.0.0")]
	public class UltimateRevive : BaseUnityPlugin
	{
		private const string modGUID = "Godji.UltimateRevive";

		private const string modName = "REPO Ultimate Revive";

		private const string modVersion = "1.0.0";

		private readonly Harmony harmony = new Harmony("Godji.UltimateRevive");

		private static UltimateRevive Instance;

		internal ManualLogSource mls;

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			mls = Logger.CreateLogSource("Godji.UltimateRevive");
			ConfigManager.Initialize(((BaseUnityPlugin)this).Config);
			mls.LogInfo((object)"[Godji] Ultiumate Revive Inited.");
			harmony.PatchAll(typeof(UltimateRevive));
			harmony.PatchAll(typeof(ShopManagerPatch));
			harmony.PatchAll(typeof(PlayerControllerPatch));
			harmony.PatchAll(typeof(PhysGrabCartPatch));
		}
	}
}
namespace UltimateRevive.Patches
{
	internal class ConfigManager
	{
		public static ConfigEntry<int> hpCost;

		public static ConfigEntry<string> reviveKey;

		public static void Initialize(ConfigFile cfg)
		{
			hpCost = cfg.Bind<int>("Revive HP Settings", "StaminaCost", 20, "The amount of hp consumed when reviving.");
			reviveKey = cfg.Bind<string>("Controls", "ReviveKey", "h", "The key used to trigger a revive.");
		}
	}
	[HarmonyPatch(typeof(PhysGrabCart))]
	internal class PhysGrabCartPatch
	{
		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		private static void displayText()
		{
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			if (!SemiFunc.RunIsShop() && PlayerControllerPatch.isGrab)
			{
				FieldInfo fieldInfo = AccessTools.Field(typeof(PlayerAvatar), "playerName");
				object value = fieldInfo.GetValue(PlayerControllerPatch.grabHead.playerAvatar);
				PlayerHealth playerHealth = PlayerController.instance.playerAvatarScript.playerHealth;
				FieldInfo fieldInfo2 = AccessTools.Field(typeof(PlayerHealth), "health");
				int num = (int)fieldInfo2.GetValue(playerHealth);
				int value2 = ConfigManager.hpCost.Value;
				string value3 = ConfigManager.reviveKey.Value;
				if (num < value2)
				{
					Color val = default(Color);
					((Color)(ref val))..ctor(1f, 0f, 0f);
					ItemInfoExtraUI.instance.ItemInfoText($"Your HP is below {value2}", val);
				}
				else
				{
					Color val2 = default(Color);
					((Color)(ref val2))..ctor(0.2f, 0.8f, 0.1f);
					ItemInfoExtraUI.instance.ItemInfoText($"Press [{value3}] to revive {value} with {value2} HP", val2);
				}
			}
		}
	}
	[HarmonyPatch(typeof(PlayerController))]
	internal class PlayerControllerPatch
	{
		public static PlayerDeathHead grabHead;

		public static bool isGrab;

		[HarmonyPatch("FixedUpdate")]
		[HarmonyPostfix]
		private static void PlayerGrabHeadPatch(PlayerController __instance)
		{
			if ((Object)(object)__instance == (Object)null)
			{
				return;
			}
			if (__instance.physGrabActive && (Object)(object)__instance.physGrabObject != (Object)null)
			{
				PlayerDeathHead component = __instance.physGrabObject.GetComponent<PlayerDeathHead>();
				if ((Object)(object)component != (Object)null && (Object)(object)component.playerAvatar != (Object)null)
				{
					grabHead = component;
					isGrab = true;
				}
			}
			else
			{
				isGrab = false;
			}
		}
	}
	internal class ReviveManager : MonoBehaviour
	{
		private void Update()
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			InputControl val = ((InputControl)Keyboard.current)[ConfigManager.reviveKey.Value];
			if (!((ButtonControl)val).wasPressedThisFrame)
			{
				return;
			}
			PlayerDeathHead grabHead = PlayerControllerPatch.grabHead;
			bool isGrab = PlayerControllerPatch.isGrab;
			PlayerHealth playerHealth = PlayerController.instance.playerAvatarScript.playerHealth;
			FieldInfo fieldInfo = AccessTools.Field(typeof(PlayerHealth), "health");
			int num = (int)fieldInfo.GetValue(playerHealth);
			int value = ConfigManager.hpCost.Value;
			if (num >= value && num >= num - value && isGrab)
			{
				FieldInfo fieldInfo2 = AccessTools.Field(typeof(PlayerDeathHead), "inExtractionPoint");
				if (!(bool)fieldInfo2.GetValue(grabHead))
				{
					fieldInfo2.SetValue(grabHead, true);
					grabHead.Revive();
					playerHealth.Hurt(value, true, -1);
					fieldInfo2.SetValue(grabHead, false);
				}
			}
		}
	}
	[HarmonyPatch(typeof(ShopManager))]
	internal class ShopManagerPatch
	{
		[HarmonyPatch("Awake")]
		[HarmonyPostfix]
		private static void keyboardListener(ShopManager __instance)
		{
			if (!((Object)(object)__instance == (Object)null) && (Object)(object)((Component)__instance).gameObject.GetComponent<ReviveManager>() == (Object)null)
			{
				((Component)__instance).gameObject.AddComponent<ReviveManager>();
				Debug.Log((object)"[UltimateRevive] Added keyboard event listener");
			}
		}
	}
}

BepInEx/plugins/Lazarus-BetterTruckHeals/BetterTruckHeals.dll

Decompiled 2 months ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("BetterTruckHeals")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("BetterTruckHeals")]
[assembly: AssemblyCopyright("Copyright ©  2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("819aea69-b910-4066-83d4-ca334402331c")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace BetterTruckHeals;

[BepInPlugin("Lazarus.BetterTruckHeals", "Better Truck Heals", "1.0.0")]
public class BetterTruckHeals : BaseUnityPlugin
{
	[HarmonyPatch(typeof(PlayerAvatar), "FinalHealRPC")]
	public class PlayerAvatarPatch
	{
		private static readonly FieldInfo FinalHealField = typeof(PlayerAvatar).GetField("finalHeal", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);

		private static readonly FieldInfo IsLocalField = typeof(PlayerAvatar).GetField("isLocal", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);

		private static readonly FieldInfo PlayerNameField = typeof(PlayerAvatar).GetField("playerName", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);

		[HarmonyPrefix]
		private static bool Prefix(PlayerAvatar __instance)
		{
			if (FinalHealField == null || IsLocalField == null || PlayerNameField == null)
			{
				ModLogger.LogError((object)"Failed to reflect fields in PlayerAvatar. Check assembly reference.");
				return true;
			}
			if ((bool)FinalHealField.GetValue(__instance))
			{
				return true;
			}
			if ((bool)IsLocalField.GetValue(__instance))
			{
				int value = HealAmountConfig.Value;
				string text = (string)PlayerNameField.GetValue(__instance);
				ModLogger.LogInfo((object)$"Applying custom heal amount: {value} for player: {text}");
				__instance.playerHealth.EyeMaterialOverride((EyeOverrideState)2, 2f, 1);
				TruckScreenText.instance.MessageSendCustom("", text + " {arrowright}{truck}{check}\n {point}{shades}{pointright}<b><color=#00FF00>+" + value + "</color></b>{heart}", 0);
				__instance.playerHealth.Heal(value, true);
				FinalHealField.SetValue(__instance, true);
			}
			return false;
		}

		[HarmonyPostfix]
		private static void Postfix(PlayerAvatar __instance)
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			TruckHealer.instance.Heal(__instance);
			__instance.truckReturn.Play(__instance.PlayerVisionTarget.VisionTransform.position, 1f, 1f, 1f, 1f);
			__instance.truckReturnGlobal.Play(__instance.PlayerVisionTarget.VisionTransform.position, 1f, 1f, 1f, 1f);
			((Component)__instance.playerAvatarVisuals.effectGetIntoTruck).gameObject.SetActive(true);
		}
	}

	private const string PluginGUID = "Lazarus.BetterTruckHeals";

	private const string PluginName = "Better Truck Heals";

	private const string PluginVersion = "1.0.0";

	public static ConfigEntry<int> HealAmountConfig;

	internal static ManualLogSource ModLogger;

	private void Awake()
	{
		//IL_005b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0065: Expected O, but got Unknown
		//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ae: Expected O, but got Unknown
		((BaseUnityPlugin)this).Logger.LogInfo((object)"John 11:11!");
		((BaseUnityPlugin)this).Logger.LogInfo((object)"WAKEY WAKEY!");
		((BaseUnityPlugin)this).Logger.LogInfo((object)"BetterTruckHeals has risen!");
		HealAmountConfig = ((BaseUnityPlugin)this).Config.Bind<int>("General", "HealAmount", 50, new ConfigDescription("The amount of health the truck healer restores to the player.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 200), Array.Empty<object>()));
		ModLogger = ((BaseUnityPlugin)this).Logger;
		ModLogger.LogInfo((object)string.Format("{0} v{1} is loading with heal amount: {2}", "Better Truck Heals", "1.0.0", HealAmountConfig.Value));
		Harmony val = new Harmony("Lazarus.BetterTruckHeals");
		val.PatchAll();
		ModLogger.LogInfo((object)"Harmony patches applied successfully!");
	}
}

BepInEx/plugins/Magic_Wesley-Wesleys_Enemies/WesleysEnemies.dll

Decompiled 2 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using Microsoft.CodeAnalysis;
using Photon.Pun;
using REPOLib.Modules;
using UnityEngine;
using UnityEngine.AI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("Magic_Wesley")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyCopyright("Copyright © 2025 Magic_Wesley")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+821e3516aba9ed1f4bc1c877fe23775cd38a8a01")]
[assembly: AssemblyProduct("WesleysEnemies")]
[assembly: AssemblyTitle("WesleysEnemies")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace WesleysEnemies
{
	internal class JustFuckingRound : MonoBehaviour
	{
		public AudioSource audioSource;

		public List<ParticleSystem> _particles;

		public List<AudioClip> _songs = new List<AudioClip>();

		private PhotonView _photonView;

		private PhysGrabObject _physGrabObject;

		private int _currentSongIndex;

		private ItemToggle _toggle;

		private bool _isPlaying;

		private bool _isFirstGrab = true;

		private bool _changeImpulse = false;

		private readonly Dictionary<AudioClip, ParticleSystem> _songParticleMap = new Dictionary<AudioClip, ParticleSystem>();

		private void Awake()
		{
			_toggle = ((Component)this).GetComponent<ItemToggle>();
			_photonView = ((Component)this).GetComponent<PhotonView>();
			_physGrabObject = ((Component)this).GetComponent<PhysGrabObject>();
			for (int i = 0; i < _songs.Count; i++)
			{
				if (i < _particles.Count)
				{
					_songParticleMap[_songs[i]] = _particles[i];
				}
			}
		}

		private void Update()
		{
			if (_physGrabObject.grabbed)
			{
				audioSource.volume = 1f;
				FirstGrab();
			}
			else if (!_physGrabObject.grabbed && _isPlaying)
			{
				audioSource.volume = 0.4f;
			}
			if (_changeImpulse)
			{
				PlaySong();
				_changeImpulse = false;
			}
		}

		private void FirstGrab()
		{
			if (_isFirstGrab)
			{
				_toggle.toggleState = true;
				_isFirstGrab = false;
			}
			else
			{
				ToggleAudio();
			}
		}

		private void ToggleAudio()
		{
			if (_toggle.toggleState)
			{
				SetRandomSong();
			}
			else if (!_toggle.toggleState)
			{
				_isPlaying = false;
				StopParticles();
				audioSource.Stop();
			}
		}

		private void ToggleParticles()
		{
			foreach (ParticleSystem particle in _particles)
			{
				particle.Stop();
			}
			if (_toggle.toggleState && _currentSongIndex < _particles.Count)
			{
				_particles[_currentSongIndex].Play();
			}
		}

		private void PlayParticle(string songName)
		{
			AudioClip key = ((IEnumerable<AudioClip>)_songs).FirstOrDefault((Func<AudioClip, bool>)((AudioClip s) => ((Object)s).name == songName));
			if (_songParticleMap.ContainsKey(key))
			{
				_songParticleMap[key].Play();
			}
		}

		private void StopParticles()
		{
			foreach (ParticleSystem particle in _particles)
			{
				particle.Stop(true, (ParticleSystemStopBehavior)0);
			}
		}

		private void SetRandomSong()
		{
			if (!_isPlaying)
			{
				_isPlaying = true;
				if (GameManager.Multiplayer())
				{
					_photonView.RPC("ChangeRandomSongValue", (RpcTarget)0, Array.Empty<object>());
				}
				_changeImpulse = true;
			}
		}

		private void PlaySong()
		{
			AudioClip val = _songs[_currentSongIndex];
			audioSource.clip = val;
			audioSource.Play();
			PlayParticle(((Object)val).name);
			ToggleParticles();
		}

		[PunRPC]
		private void ChangeRandomSongValue()
		{
			int currentSongIndex = Random.Range(0, _songs.Count);
			_currentSongIndex = currentSongIndex;
		}
	}
	[BepInPlugin("WesleysEnemies", "WesleysEnemies", "1.0.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class WesleysEnemies : BaseUnityPlugin
	{
		private void Awake()
		{
			string directoryName = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location);
			string text = Path.Combine(directoryName, "wesleysenemies_enemyprefabs");
			string[] array = new string[11]
			{
				"EnemySetup - Gusher", "EnemySetup - 2GusherGroup", "EnemySetup - 4GusherGroup", "EnemySetup - Roaster", "EnemySetup - 2RoasterGroup", "EnemySetup - LostDroid", "EnemySetup - 2LostDroidGroup", "EnemySetup - 3LostDroidGroup", "EnemySetup - Gnomeageddon", "EnemySetup - LostDestroyer",
				"EnemySetup - 2DestroyerGroup"
			};
			AssetBundle val = AssetBundle.LoadFromFile(text);
			string[] array2 = array;
			foreach (string text2 in array2)
			{
				EnemySetup val2 = ScriptableObject.CreateInstance<EnemySetup>();
				val2 = val.LoadAsset<EnemySetup>(text2);
				Enemies.RegisterEnemy(val2);
				Debug.Log((object)("Loaded " + text2));
			}
			Debug.Log((object)"Please, if you don't like a mod, at least be respectful about it, do not call someones work 'dogshit' while calling them 'bluddingtons'..");
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "WesleysEnemies";

		public const string PLUGIN_NAME = "WesleysEnemies";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace WesleysEnemies.AI
{
	internal class Gusher : MonoBehaviour
	{
		public enum State
		{
			Spawn,
			StartListen,
			Listen,
			EndListen,
			Attack,
			Wander,
			Stun,
			Despawn,
			Flee
		}

		public GusherAnimationController GusherAnim;

		private LayerMask layermask;

		private LayerMask playerLayermask;

		internal Enemy _enemy;

		private PhotonView _photonView;

		public Transform feetTransform;

		public bool Terminator = false;

		private float _speedChangeCooldown;

		private int _hitAmount;

		internal float _animSpeed;

		private float _spawnCool;

		private bool _stateImpulse;

		internal bool _deathImpulse;

		internal bool _despawnImpulse;

		internal bool _roamImpulse;

		internal bool _attackImpulse;

		internal bool _hearImpulse;

		internal bool _isListening;

		private Quaternion _horizontalRotationTarget = Quaternion.identity;

		private Vector3 _agentDestination;

		private Vector3 _investigatePoint;

		private int _hearCount;

		private int _hurtAmount;

		private bool _hurtImpulse;

		private float hurtLerp;

		private float _hearCooldown;

		private List<Material> _hurtMaterial = new List<Material>();

		[Header("State")]
		[SerializeField]
		public State CurrentState;

		[SerializeField]
		public float stateTimer;

		[SerializeField]
		public float stateHaltTimer;

		[Header("Animation")]
		[SerializeField]
		private AnimationCurve hurtCurve;

		[SerializeField]
		private SkinnedMeshRenderer[] _skinnedMeshRenderer;

		[SerializeField]
		private MeshRenderer[] _MeshRenderer;

		[Header("Rotation and LookAt")]
		public SpringQuaternion horizontalRotationSpring;

		[SerializeField]
		private Transform _listenPoint;

		private EnemyNavMeshAgent _navMeshAgent => _enemy.NavMeshAgent;

		private EnemyRigidbody _rigidbody => _enemy.Rigidbody;

		private EnemyParent _enemyParent => _enemy.EnemyParent;

		private EnemyVision _Vision => _enemy.Vision;

		public Enemy Enemy => _enemy;

		private void Awake()
		{
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			layermask = LayerMask.op_Implicit(LayerMask.GetMask(new string[5] { "Default", "PhysGrabObject", "PhysGrabObjectCart", "PhysGrabObjectHinge", "StaticGrabObject" }));
			playerLayermask = LayerMask.op_Implicit(LayerMask.GetMask(new string[1] { "Player" }));
			_enemy = ((Component)this).GetComponent<Enemy>();
			_photonView = ((Component)this).GetComponent<PhotonView>();
			_hurtAmount = Shader.PropertyToID("_ColorOverlayAmount");
			SkinnedMeshRenderer[] skinnedMeshRenderer = _skinnedMeshRenderer;
			foreach (SkinnedMeshRenderer val in skinnedMeshRenderer)
			{
				if ((Object)(object)val != (Object)null)
				{
					_hurtMaterial.AddRange(((Renderer)val).materials);
				}
			}
			MeshRenderer[] meshRenderer = _MeshRenderer;
			for (int j = 0; j < meshRenderer.Length; j++)
			{
				Renderer val2 = (Renderer)(object)meshRenderer[j];
				if ((Object)(object)val2 != (Object)null)
				{
					_hurtMaterial.AddRange(val2.materials);
				}
			}
			hurtCurve = AssetManager.instance.animationCurveImpact;
		}

		private void Update()
		{
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Invalid comparison between Unknown and I4
			if (!SemiFunc.IsMasterClientOrSingleplayer() || !LevelGenerator.Instance.Generated)
			{
				return;
			}
			if (!_enemy.IsStunned())
			{
				if ((int)_enemy.EnemyParent.Enemy.CurrentState == 11 && CurrentState != State.Despawn)
				{
					UpdateState(State.Despawn);
				}
				switch (CurrentState)
				{
				case State.Spawn:
					StateSpawn();
					break;
				case State.Listen:
					StateListen();
					break;
				case State.StartListen:
					StateStartListen();
					break;
				case State.EndListen:
					StateEndListen();
					break;
				case State.Attack:
					StateAttack();
					break;
				case State.Wander:
					StateWander();
					break;
				case State.Flee:
					StateFlee();
					break;
				case State.Stun:
					StateStun();
					break;
				case State.Despawn:
					StateDespawn();
					break;
				default:
					throw new ArgumentOutOfRangeException();
				}
				RotationLogic();
			}
			else
			{
				UpdateState(State.Stun);
				StateStun();
			}
			HurtEffect();
			if (_spawnCool > 0f)
			{
				_spawnCool -= Time.deltaTime;
			}
		}

		private void StateSpawn()
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			if (_stateImpulse)
			{
				_navMeshAgent.Warp(((Component)_rigidbody).transform.position);
				_navMeshAgent.ResetPath();
				_stateImpulse = false;
				stateTimer = 2f;
				_navMeshAgent.Agent.speed = 1f;
				if (GameManager.Multiplayer())
				{
					_photonView.RPC("ChangeAnimSpeedRPC", (RpcTarget)0, new object[1] { 1f });
				}
				else
				{
					ChangeAnimSpeedRPC(1f);
				}
			}
			stateTimer -= Time.deltaTime;
			if (stateTimer <= 0f)
			{
				UpdateState(State.Wander);
			}
		}

		private void StateListen()
		{
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			if (_stateImpulse)
			{
				_stateImpulse = false;
				if (Terminator)
				{
					stateTimer = Random.Range(7f, 12f);
				}
				else
				{
					stateTimer = Random.Range(20f, 33f);
				}
				_navMeshAgent.Warp(((Component)_rigidbody).transform.position);
				_navMeshAgent.ResetPath();
			}
			if (!SemiFunc.EnemySpawnIdlePause())
			{
				stateTimer -= Time.deltaTime;
				if (stateTimer <= 0f)
				{
					_hearCount = 0;
					UpdateState(State.EndListen);
				}
				if (_hearCooldown > 0f)
				{
					_hearCooldown -= Time.deltaTime;
				}
			}
		}

		private void StateStartListen()
		{
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			if (_stateImpulse)
			{
				_hearCount = 0;
				_isListening = true;
				if (GameManager.Multiplayer())
				{
					_photonView.RPC("IsListeningRPC", (RpcTarget)1, new object[1] { _isListening });
					_photonView.RPC("ChangeAnimSpeedRPC", (RpcTarget)0, new object[1] { 1f });
				}
				else
				{
					IsListeningRPC(_isListening);
					ChangeAnimSpeedRPC(1f);
				}
				_stateImpulse = false;
				stateTimer = 1f;
				_navMeshAgent.Warp(((Component)_rigidbody).transform.position);
				_navMeshAgent.ResetPath();
			}
			stateTimer -= Time.deltaTime;
			if (stateTimer <= 0f)
			{
				UpdateState(State.Listen);
			}
		}

		private void StateEndListen()
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			if (_stateImpulse)
			{
				_stateImpulse = false;
				stateTimer = 1f;
				_navMeshAgent.Warp(((Component)_rigidbody).transform.position);
				_navMeshAgent.ResetPath();
				Debug.Log((object)CrazyCalculation());
			}
			stateTimer -= Time.deltaTime;
			if (stateTimer <= 0f)
			{
				if (SemiFunc.EnemyForceLeave(_enemy))
				{
					UpdateState(State.Flee);
				}
				else
				{
					UpdateState(State.Wander);
				}
			}
		}

		private void StateWander()
		{
			//IL_025d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0156: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: Unknown result type (might be due to invalid IL or missing references)
			//IL_0182: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a6: 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_01b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0204: Unknown result type (might be due to invalid IL or missing references)
			//IL_0209: Unknown result type (might be due to invalid IL or missing references)
			//IL_0244: Unknown result type (might be due to invalid IL or missing references)
			if (_stateImpulse)
			{
				_isListening = false;
				if (GameManager.Multiplayer())
				{
					_photonView.RPC("IsListeningRPC", (RpcTarget)1, new object[1] { _isListening });
					_photonView.RPC("RoamImpulseRPC", (RpcTarget)0, Array.Empty<object>());
				}
				else
				{
					IsListeningRPC(_isListening);
					RoamImpulseRPC();
				}
				if (Terminator)
				{
					if (GameManager.Multiplayer())
					{
						_photonView.RPC("ChangeAnimSpeedRPC", (RpcTarget)0, new object[1] { 6f });
					}
					else
					{
						ChangeAnimSpeedRPC(6f);
					}
					_navMeshAgent.Agent.speed = 12f;
				}
				else
				{
					_navMeshAgent.Agent.speed = 0.05f;
				}
				bool flag = false;
				LevelPoint val;
				if (Terminator)
				{
					stateTimer = Random.Range(4f, 10f);
					val = SemiFunc.LevelPointGet(((Component)this).transform.position, 5f, 15f);
				}
				else
				{
					stateTimer = Random.Range(8f, 12f);
					val = SemiFunc.LevelPointGet(((Component)this).transform.position, 10f, 25f);
				}
				if (!Object.op_Implicit((Object)(object)val))
				{
					val = SemiFunc.LevelPointGet(((Component)this).transform.position, 0f, 999f);
				}
				NavMeshHit val2 = default(NavMeshHit);
				if (Object.op_Implicit((Object)(object)val) && NavMesh.SamplePosition(((Component)val).transform.position + Random.insideUnitSphere * 3f, ref val2, 5f, -1) && Physics.Raycast(((NavMeshHit)(ref val2)).position, Vector3.down, 5f, LayerMask.GetMask(new string[1] { "Default" })))
				{
					_agentDestination = ((NavMeshHit)(ref val2)).position;
					flag = true;
				}
				if (flag)
				{
					_enemy.Rigidbody.notMovingTimer = 0f;
					_stateImpulse = false;
					_navMeshAgent.SetDestination(_agentDestination);
				}
				return;
			}
			_navMeshAgent.SetDestination(_agentDestination);
			if (_navMeshAgent.Agent.speed <= 4f && !Terminator)
			{
				if (_speedChangeCooldown <= 0f)
				{
					if (GameManager.Multiplayer())
					{
						_photonView.RPC("ChangeAnimSpeedRPC", (RpcTarget)0, new object[1] { _navMeshAgent.Agent.speed / 1.5f + 1f });
						_speedChangeCooldown = 1f;
					}
					else
					{
						ChangeAnimSpeedRPC(_navMeshAgent.Agent.speed / 1.5f + 1f);
						_speedChangeCooldown = 1f;
					}
				}
				else
				{
					_speedChangeCooldown -= Time.deltaTime;
				}
				NavMeshAgent agent = _navMeshAgent.Agent;
				agent.speed += 0.4f * Time.deltaTime;
			}
			if (_enemy.Rigidbody.notMovingTimer > 2f)
			{
				stateTimer -= Time.deltaTime;
			}
			if (stateTimer <= 0f || CheckPathCompletion())
			{
				UpdateState(State.StartListen);
			}
		}

		private void StateFlee()
		{
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: Unknown result type (might be due to invalid IL or missing references)
			//IL_0159: Unknown result type (might be due to invalid IL or missing references)
			//IL_015e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0168: Unknown result type (might be due to invalid IL or missing references)
			//IL_016d: 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_0188: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
			if (_stateImpulse)
			{
				_isListening = false;
				if (GameManager.Multiplayer())
				{
					_photonView.RPC("IsListeningRPC", (RpcTarget)1, new object[1] { _isListening });
					_photonView.RPC("RoamImpulseRPC", (RpcTarget)0, Array.Empty<object>());
					_photonView.RPC("ChangeAnimSpeedRPC", (RpcTarget)0, new object[1] { 7f });
				}
				else
				{
					IsListeningRPC(_isListening);
					RoamImpulseRPC();
					ChangeAnimSpeedRPC(7f);
				}
				_navMeshAgent.Agent.speed = 24f;
				stateTimer = 5f;
				stateHaltTimer = 1f;
				bool flag = false;
				LevelPoint val = ((!Terminator) ? SemiFunc.LevelPointGet(((Component)this).transform.position, 15f, 80f) : SemiFunc.LevelPointGet(((Component)this).transform.position, 10f, 30f));
				if (!Object.op_Implicit((Object)(object)val))
				{
					val = SemiFunc.LevelPointGet(((Component)this).transform.position, 0f, 999f);
				}
				NavMeshHit val2 = default(NavMeshHit);
				if (Object.op_Implicit((Object)(object)val) && NavMesh.SamplePosition(((Component)val).transform.position + Random.insideUnitSphere * 3f, ref val2, 5f, -1) && Physics.Raycast(((NavMeshHit)(ref val2)).position, Vector3.down, 5f, LayerMask.GetMask(new string[1] { "Default" })))
				{
					_agentDestination = ((Component)val).transform.position;
					flag = true;
				}
				if (flag)
				{
					_navMeshAgent.SetDestination(_agentDestination);
					_enemy.Rigidbody.notMovingTimer = 0f;
					_stateImpulse = false;
				}
				return;
			}
			if (_enemy.Rigidbody.notMovingTimer > 2f)
			{
				stateTimer -= Time.deltaTime;
			}
			stateHaltTimer -= Time.deltaTime;
			if (stateHaltTimer <= 0f)
			{
				SemiFunc.EnemyCartJump(_enemy);
				if (stateTimer <= 0f || CheckPathCompletion())
				{
					SemiFunc.EnemyCartJumpReset(_enemy);
					UpdateState(State.StartListen);
				}
			}
		}

		private void StateAttack()
		{
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			if (_stateImpulse)
			{
				if (GameManager.Multiplayer())
				{
					_photonView.RPC("AttackImpulseRPC", (RpcTarget)0, Array.Empty<object>());
				}
				else
				{
					AttackImpulseRPC();
				}
				stateTimer = 5f;
				_stateImpulse = false;
				_navMeshAgent.Warp(((Component)_rigidbody).transform.position);
				_navMeshAgent.ResetPath();
				return;
			}
			stateTimer -= Time.deltaTime;
			if (stateTimer <= 0f)
			{
				UpdateState(State.Flee);
				_isListening = false;
				if (GameManager.Multiplayer())
				{
					_photonView.RPC("IsListeningRPC", (RpcTarget)1, new object[1] { _isListening });
				}
				else
				{
					IsListeningRPC(_isListening);
				}
			}
		}

		private void StateDespawn()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			if (_stateImpulse)
			{
				_stateImpulse = false;
				_enemy.NavMeshAgent.Warp(feetTransform.position);
				_enemy.NavMeshAgent.ResetPath();
				if (GameManager.Multiplayer())
				{
					_photonView.RPC("DespawnImpulseRPC", (RpcTarget)0, Array.Empty<object>());
				}
				else
				{
					DespawnImpulseRPC();
				}
			}
		}

		private void StateStun()
		{
			if (_stateImpulse)
			{
				_stateImpulse = false;
			}
			if (!_enemy.IsStunned())
			{
				_hearCount = 0;
				_isListening = false;
				if (GameManager.Multiplayer())
				{
					_photonView.RPC("IsListeningRPC", (RpcTarget)1, new object[1] { _isListening });
					_photonView.RPC("AttackImpulseRPC", (RpcTarget)0, Array.Empty<object>());
				}
				else
				{
					IsListeningRPC(_isListening);
					AttackImpulseRPC();
				}
				if (_spawnCool <= 0f)
				{
					UpdateState(State.Attack);
				}
				else
				{
					UpdateState(State.Wander);
				}
			}
		}

		private void UpdateState(State _newState)
		{
			if (CurrentState != _newState)
			{
				CurrentState = _newState;
				stateTimer = 0f;
				_stateImpulse = true;
				if (GameManager.Multiplayer())
				{
					_photonView.RPC("UpdateStateRPC", (RpcTarget)0, new object[1] { CurrentState });
				}
				else
				{
					UpdateStateRPC(CurrentState);
				}
			}
		}

		[PunRPC]
		private void UpdateStateRPC(State _state)
		{
			CurrentState = _state;
			if (CurrentState == State.Spawn)
			{
				GusherAnim.SetSpawn();
			}
		}

		[PunRPC]
		private void RoamImpulseRPC()
		{
			_roamImpulse = true;
		}

		[PunRPC]
		private void DespawnImpulseRPC()
		{
			_despawnImpulse = true;
		}

		[PunRPC]
		private void AttackImpulseRPC()
		{
			_attackImpulse = true;
		}

		[PunRPC]
		private void HearImpulseRPC()
		{
			_hearImpulse = true;
		}

		[PunRPC]
		private void IsListeningRPC(bool value)
		{
			_isListening = value;
		}

		[PunRPC]
		private void ChangeAnimSpeedRPC(float value)
		{
			_animSpeed = value;
		}

		private bool CheckPathCompletion()
		{
			NavMeshAgent agent = _navMeshAgent.Agent;
			float remainingDistance = agent.remainingDistance;
			if (remainingDistance <= 0.07f)
			{
				return true;
			}
			return false;
		}

		private float CrazyCalculation()
		{
			return 5.5f;
		}

		private void RotationLogic()
		{
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: 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_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			if (CurrentState != State.Stun && CurrentState != State.StartListen && CurrentState != State.Listen && CurrentState != State.EndListen && CurrentState != State.Attack)
			{
				horizontalRotationSpring.speed = 8f;
				horizontalRotationSpring.damping = 0.85f;
				Vector3 normalized = ((Vector3)(ref _navMeshAgent.AgentVelocity)).normalized;
				if (((Vector3)(ref normalized)).magnitude > 0.1f)
				{
					_horizontalRotationTarget = Quaternion.LookRotation(((Vector3)(ref _navMeshAgent.AgentVelocity)).normalized);
					((Quaternion)(ref _horizontalRotationTarget)).eulerAngles = new Vector3(0f, ((Quaternion)(ref _horizontalRotationTarget)).eulerAngles.y, 0f);
				}
			}
			((Component)this).transform.rotation = SemiFunc.SpringQuaternionGet(horizontalRotationSpring, _horizontalRotationTarget, -1f);
		}

		private void HurtEffect()
		{
			if (!_hurtImpulse)
			{
				return;
			}
			hurtLerp += 2.5f * Time.deltaTime;
			hurtLerp = Mathf.Clamp01(hurtLerp);
			foreach (Material item in _hurtMaterial)
			{
				if ((Object)(object)item != (Object)null)
				{
					item.SetFloat(_hurtAmount, hurtCurve.Evaluate(hurtLerp));
				}
				if (hurtLerp >= 1f)
				{
					hurtLerp = 0f;
					_hurtImpulse = false;
					if ((Object)(object)item != (Object)null)
					{
						item.SetFloat(_hurtAmount, 0f);
					}
				}
			}
		}

		public void OnInvestigate()
		{
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//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_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)
			if (CurrentState != State.Listen || !(_hearCooldown <= 0f))
			{
				return;
			}
			_investigatePoint = _enemy.StateInvestigate.onInvestigateTriggeredPosition;
			Vector3 position = _listenPoint.position;
			if (!(Vector3.Distance(_investigatePoint, position) < 14f))
			{
				return;
			}
			int num;
			float hearCooldown;
			if (Terminator)
			{
				num = 2;
				hearCooldown = 1f;
			}
			else
			{
				num = 4;
				hearCooldown = 2f;
			}
			if (_hearCount < num)
			{
				_hearCooldown = hearCooldown;
				_hearCount++;
				if (GameManager.Multiplayer())
				{
					_photonView.RPC("HearImpulseRPC", (RpcTarget)0, Array.Empty<object>());
				}
				else
				{
					HearImpulseRPC();
				}
			}
			else
			{
				_stateImpulse = true;
				_hearCount = 0;
				UpdateState(State.Attack);
			}
		}

		public void OnSpawn()
		{
			if (SemiFunc.IsMasterClientOrSingleplayer() && SemiFunc.EnemySpawn(_enemy))
			{
				UpdateState(State.Spawn);
			}
			_spawnCool = 8f;
		}

		public void OnGrab()
		{
			if (CurrentState == State.Listen)
			{
				_hearCount = 0;
				UpdateState(State.Attack);
				_stateImpulse = true;
			}
		}

		public void OnHurt()
		{
			_hurtImpulse = true;
			if (CurrentState == State.Listen && !(_spawnCool > 0f))
			{
				if ((float)_hitAmount < 2f)
				{
					_hitAmount++;
				}
				else
				{
					UpdateState(State.Attack);
				}
			}
		}

		public void OnDeath()
		{
			_deathImpulse = true;
			_despawnImpulse = true;
			_enemy.Stunned = false;
			GusherAnim.PlayDeathParticles();
			if (SemiFunc.IsMasterClientOrSingleplayer())
			{
				_enemy.EnemyParent.Despawn();
			}
		}
	}
	internal class GusherAnimationController : MonoBehaviour
	{
		[Header("References")]
		public Gusher Controller;

		public Animator animator;

		[Header("Particles")]
		public ParticleSystem[] pukeParticles;

		public ParticleSystem[] pukeSplashParticles;

		public ParticleSystem[] pukeEndParticles;

		public ParticleSystem[] Deathparticles;

		[Header("Sounds")]
		[SerializeField]
		private Sound roamSounds;

		[SerializeField]
		private Sound hearSounds;

		[SerializeField]
		private Sound attackSounds;

		[SerializeField]
		private Sound attackGlobalSounds;

		[SerializeField]
		private Sound hurtSounds;

		[SerializeField]
		private Sound deathSounds;

		private void Update()
		{
			if (Controller.Enemy.IsStunned())
			{
				animator.SetTrigger("stun");
				EndPukePart();
				ChangeAnimSpeed(1f);
			}
			if (Controller._roamImpulse)
			{
				Controller._roamImpulse = false;
				animator.SetTrigger("roam");
			}
			if (Controller._attackImpulse)
			{
				Controller._attackImpulse = false;
				animator.SetTrigger("attack");
			}
			if (Controller._despawnImpulse)
			{
				Controller._despawnImpulse = false;
				animator.SetTrigger("despawn");
			}
			if (Controller._deathImpulse)
			{
				Controller._deathImpulse = false;
				animator.SetTrigger("death");
			}
			if (Controller._hearImpulse)
			{
				Controller._hearImpulse = false;
				animator.SetTrigger("hear");
			}
			if (Controller._isListening)
			{
				animator.SetBool("isListening", true);
			}
			else
			{
				animator.SetBool("isListening", false);
			}
			if (Controller._animSpeed != animator.speed)
			{
				animator.speed = Controller._animSpeed;
			}
		}

		public void ChangeAnimSpeed(float value)
		{
			animator.speed = value;
		}

		public void PlayRoamSound()
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			roamSounds.Play(Controller.Enemy.CenterTransform.position, 1f, 1f, 1f, 1f);
		}

		public void PlayHurtSound()
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			hurtSounds.Play(Controller.Enemy.CenterTransform.position, 1f, 1f, 1f, 1f);
		}

		public void PlayDeathSound()
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			deathSounds.Play(Controller.Enemy.CenterTransform.position, 1f, 1f, 1f, 1f);
		}

		public void PlayAttackSound()
		{
			//IL_0017: 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)
			attackSounds.Play(Controller.Enemy.CenterTransform.position, 1f, 1f, 1f, 1f);
			attackGlobalSounds.Play(Controller.Enemy.CenterTransform.position, 1f, 1f, 1f, 1f);
		}

		public void PlayHearSound()
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			hearSounds.Play(Controller.Enemy.CenterTransform.position, 1f, 1f, 1f, 1f);
		}

		public void StartPukePart()
		{
			ParticleSystem[] array = pukeSplashParticles;
			for (int i = 0; i < array.Length; i++)
			{
				array[i].Play();
			}
			ParticleSystem[] array2 = pukeParticles;
			for (int j = 0; j < array2.Length; j++)
			{
				array2[j].Play();
			}
		}

		public void StartRandomPukePart()
		{
			ParticleSystem[] array = pukeSplashParticles;
			ParticleSystem[] array2 = pukeParticles;
			int num = Random.Range(0, array.Length);
			array[num].Play();
			array2[num].Play();
		}

		public void EndPukePart()
		{
			ParticleSystem[] array = pukeEndParticles;
			for (int i = 0; i < array.Length; i++)
			{
				array[i].Play();
			}
			ParticleSystem[] array2 = pukeParticles;
			for (int j = 0; j < array2.Length; j++)
			{
				array2[j].Stop();
			}
		}

		public void PlayDeathParticles()
		{
			PlayDeathSound();
			ParticleSystem[] deathparticles = Deathparticles;
			foreach (ParticleSystem val in deathparticles)
			{
				val.Play();
			}
		}

		public void SetDespawn()
		{
			Controller._enemy.EnemyParent.Despawn();
		}

		public void SetSpawn()
		{
			animator.Play("New State", -1, 0f);
		}

		public void Despawn()
		{
			Controller._enemy.EnemyParent.Despawn();
		}
	}
	internal class LostDroid : MonoBehaviour
	{
		public enum State
		{
			Spawn,
			Idle,
			Wander,
			RWander,
			RSwing,
			Stun,
			Notice,
			Follow,
			Transform,
			RAttack,
			RShortAttack,
			Despawn
		}

		public LostDroidAnimationController LostDroidAnim;

		internal Enemy _enemy;

		private PhotonView _photonView;

		public Renderer[] renderers;

		private Color[] colors = (Color[])(object)new Color[5];

		private int droidVariant;

		public Transform _bulletPosition;

		public Transform feetTransform;

		public GameObject bulletPrefab;

		[Header("Sounds")]
		public Sound soundHit;

		public Sound genericLines;

		public Sound SadLines;

		public Sound EnvyLines;

		public Sound HateLines;

		public Sound CuteLines;

		public Sound MurderLines;

		public Sound RageLines;

		public AnimationCurve shootLineWidthCurve;

		public ParticleSystem minigunParticles;

		public bool Terminator = false;

		public bool Transformed = false;

		private bool _stateImpulse = false;

		private Quaternion _horizontalRotationTarget = Quaternion.identity;

		private Vector3 _agentDestination;

		private Vector3 _targetPosition;

		private Vector3 _turnPosition;

		private PlayerAvatar _targetPlayer;

		private List<Material> _hurtMaterial = new List<Material>();

		private float _overrideAgentLerp;

		private bool _hurtImpulse;

		private float hurtLerp;

		private float _attackCooldown;

		private int _hurtAmount;

		private float _talkTimer;

		private float _avoidDist;

		private bool _talker;

		private float _bulletSpread;

		internal bool _isWalking;

		internal bool _isSprinting;

		internal bool _isTurning;

		internal bool _deathImpulse;

		internal bool _despawnImpulse;

		internal bool _attackImpulse;

		internal bool _attackShortImpulse;

		internal bool _fireBullets;

		internal bool _swingImpulse;

		internal bool _firstStun;

		internal bool _hasSpawned;

		internal bool _isTurningToPlayer;

		internal bool _transformImpulse;

		internal bool _isStun;

		internal int _damageAmount;

		internal float _animSpeed = 1f;

		internal float _transformCountMax;

		internal float _transformCount;

		private float _bulletFireCooldown;

		[Header("State")]
		[SerializeField]
		public State CurrentState;

		[SerializeField]
		public float stateTimer;

		[SerializeField]
		public float stateHaltTimer;

		[Header("Animation")]
		[SerializeField]
		private AnimationCurve hurtCurve;

		[SerializeField]
		private SkinnedMeshRenderer[] _skinnedMeshRenderer;

		[SerializeField]
		private MeshRenderer[] _MeshRenderer;

		[Header("Rotation and LookAt")]
		public SpringQuaternion horizontalRotationSpring;

		private EnemyNavMeshAgent _navMeshAgent => _enemy.NavMeshAgent;

		private EnemyRigidbody _rigidbody => _enemy.Rigidbody;

		private EnemyParent _enemyParent => _enemy.EnemyParent;

		private EnemyVision _Vision => _enemy.Vision;

		public Enemy Enemy => _enemy;

		private void Awake()
		{
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			_enemy = ((Component)this).GetComponent<Enemy>();
			_photonView = ((Component)this).GetComponent<PhotonView>();
			_hurtAmount = Shader.PropertyToID("_ColorOverlayAmount");
			colors[0] = new Color(1f, 0.1764706f, 0.1764706f, 0f);
			colors[1] = new Color(0.4117647f, 7f / 15f, 1f, 0f);
			colors[2] = new Color(1f, 0.7607843f, 0f, 0f);
			colors[3] = new Color(0.95686275f, 0.08627451f, 40f / 51f, 0f);
			colors[4] = new Color(1f, 1f, 1f, 0f);
			if (Terminator)
			{
				_transformCount = 5f;
				_transformCountMax = Random.Range(5f, 10f);
				_bulletSpread = 10f;
			}
			else
			{
				_transformCount = 8f;
				_transformCountMax = Random.Range(6f, 12f);
				_bulletSpread = 20f;
			}
			_talker = Random.value < 0.5f;
			_talkTimer = Random.Range(5f, 28f);
			_avoidDist = Random.Range(2f, 4f);
			SkinnedMeshRenderer[] skinnedMeshRenderer = _skinnedMeshRenderer;
			foreach (SkinnedMeshRenderer val in skinnedMeshRenderer)
			{
				if ((Object)(object)val != (Object)null)
				{
					_hurtMaterial.AddRange(((Renderer)val).materials);
				}
			}
			MeshRenderer[] meshRenderer = _MeshRenderer;
			for (int j = 0; j < meshRenderer.Length; j++)
			{
				Renderer val2 = (Renderer)(object)meshRenderer[j];
				if ((Object)(object)val2 != (Object)null)
				{
					_hurtMaterial.AddRange(val2.materials);
				}
			}
			hurtCurve = AssetManager.instance.animationCurveImpact;
		}

		private void Update()
		{
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Invalid comparison between Unknown and I4
			if (!SemiFunc.IsMasterClientOrSingleplayer() || !LevelGenerator.Instance.Generated)
			{
				return;
			}
			if (!_enemy.IsStunned())
			{
				if ((int)_enemy.EnemyParent.Enemy.CurrentState == 11 && CurrentState != State.Despawn)
				{
					UpdateState(State.Despawn);
				}
				switch (CurrentState)
				{
				case State.Spawn:
					StateSpawn();
					break;
				case State.Wander:
					StateWander();
					break;
				case State.RAttack:
					StateRAttack();
					break;
				case State.RShortAttack:
					StateRShortAttack();
					break;
				case State.Stun:
					StateStun();
					break;
				case State.RWander:
					StateWander();
					break;
				case State.RSwing:
					StateRSwing();
					break;
				case State.Notice:
					StateNotice();
					break;
				case State.Idle:
					StateIdle();
					break;
				case State.Follow:
					StateFollow();
					break;
				case State.Despawn:
					StateDespawn();
					break;
				case State.Transform:
					StateTransform();
					break;
				default:
					throw new ArgumentOutOfRangeException();
				}
				RotationLogic();
			}
			else
			{
				UpdateState(State.Stun);
				StateStun();
			}
			HurtEffect();
			if (_transformCount < _transformCountMax)
			{
				_transformCount += Time.deltaTime * 0.25f;
			}
			if (_attackCooldown > 0f)
			{
				_attackCooldown -= Time.deltaTime;
			}
			if (_talkTimer > 0f)
			{
				_talkTimer -= Time.deltaTime;
				return;
			}
			Talk();
			if (SemiFunc.IsMasterClientOrSingleplayer())
			{
				_talkTimer = Random.Range(5f, 28f);
			}
		}

		private void StateSpawn()
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			if (_stateImpulse)
			{
				_stateImpulse = false;
				_navMeshAgent.Warp(((Component)this).transform.position);
				_navMeshAgent.ResetPath();
				if (GameManager.Multiplayer())
				{
					_photonView.RPC("ChangeAnimSpeedRPC", (RpcTarget)0, new object[1] { 1f });
					_photonView.RPC("IsSprintingRPC", (RpcTarget)0, new object[1] { false });
					_photonView.RPC("IsWalkingRPC", (RpcTarget)0, new object[1] { false });
					_photonView.RPC("IsTurningRPC", (RpcTarget)0, new object[1] { false });
				}
				else
				{
					ChangeAnimSpeedRPC(1f);
					IsSprintingRPC(value: false);
					IsWalkingRPC(value: false);
					IsTurningRPC(value: false);
				}
				stateTimer = 2f;
			}
			else
			{
				UpdateState(State.Wander);
				_hasSpawned = true;
			}
		}

		private void StateIdle()
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			if (_stateImpulse)
			{
				_stateImpulse = false;
				_isTurningToPlayer = false;
				_navMeshAgent.Warp(((Component)this).transform.position);
				_navMeshAgent.ResetPath();
				stateTimer = Random.Range(6f, 8f);
				if (GameManager.Multiplayer())
				{
					_photonView.RPC("IsSprintingRPC", (RpcTarget)0, new object[1] { false });
					_photonView.RPC("IsWalkingRPC", (RpcTarget)0, new object[1] { false });
					_photonView.RPC("IsTurningRPC", (RpcTarget)0, new object[1] { false });
				}
				else
				{
					IsSprintingRPC(value: false);
					IsWalkingRPC(value: false);
					IsTurningRPC(value: false);
				}
			}
			else
			{
				stateTimer -= Time.deltaTime;
				if (stateTimer <= 0f)
				{
					UpdateState(State.Wander);
				}
			}
		}

		private void StateWander()
		{
			//IL_022a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: 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_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: 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_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0211: Unknown result type (might be due to invalid IL or missing references)
			if (_stateImpulse)
			{
				bool flag = false;
				LevelPoint val = SemiFunc.LevelPointGet(((Component)this).transform.position, 10f, 20f);
				if (Transformed)
				{
					stateTimer = 30f;
				}
				else
				{
					stateTimer = 18f;
				}
				if (!Object.op_Implicit((Object)(object)val))
				{
					val = SemiFunc.LevelPointGet(((Component)this).transform.position, 5f, 999f);
				}
				NavMeshHit val2 = default(NavMeshHit);
				if (Object.op_Implicit((Object)(object)val) && NavMesh.SamplePosition(((Component)val).transform.position + Random.insideUnitSphere * 4f, ref val2, 8f, -1) && Physics.Raycast(((NavMeshHit)(ref val2)).position, Vector3.down, 5f, LayerMask.GetMask(new string[1] { "Default" })))
				{
					_agentDestination = ((NavMeshHit)(ref val2)).position;
					flag = true;
				}
				if (!flag)
				{
					return;
				}
				if (GameManager.Multiplayer())
				{
					_photonView.RPC("IsWalkingRPC", (RpcTarget)0, new object[1] { true });
				}
				else
				{
					IsWalkingRPC(value: true);
				}
				_enemy.Rigidbody.notMovingTimer = 0f;
				_stateImpulse = false;
				if (Transformed)
				{
					if (Terminator)
					{
						_navMeshAgent.Agent.speed = 0.75f;
						if (GameManager.Multiplayer())
						{
							_photonView.RPC("ChangeAnimSpeedRPC", (RpcTarget)0, new object[1] { 3f });
						}
						else
						{
							ChangeAnimSpeedRPC(3f);
						}
					}
					else
					{
						_navMeshAgent.Agent.speed = 0.25f;
					}
				}
				else
				{
					_navMeshAgent.Agent.speed = 1.4f;
				}
				_navMeshAgent.SetDestination(_agentDestination);
				return;
			}
			_navMeshAgent.SetDestination(_agentDestination);
			if (_enemy.Rigidbody.notMovingTimer > 2f)
			{
				stateTimer -= Time.deltaTime;
			}
			if (stateTimer <= 0f || CheckPathCompletion())
			{
				if (Transformed)
				{
					UpdateState(State.RWander);
					_stateImpulse = true;
				}
				else
				{
					UpdateState(State.Idle);
				}
			}
		}

		private void StateDespawn()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			if (_stateImpulse)
			{
				_stateImpulse = false;
				_enemy.NavMeshAgent.Warp(feetTransform.position);
				_enemy.NavMeshAgent.ResetPath();
				if (GameManager.Multiplayer())
				{
					_photonView.RPC("DespawnImpulseRPC", (RpcTarget)0, Array.Empty<object>());
				}
				else
				{
					DespawnImpulseRPC();
				}
			}
		}

		private void StateRSwing()
		{
			//IL_0143: Unknown result type (might be due to invalid IL or missing references)
			//IL_014e: 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_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			if (_stateImpulse)
			{
				if (Terminator)
				{
					if (GameManager.Multiplayer())
					{
						_photonView.RPC("ChangeAnimSpeedRPC", (RpcTarget)0, new object[1] { 2f });
					}
					else
					{
						ChangeAnimSpeedRPC(2f);
					}
					stateTimer = 1.2f;
				}
				else
				{
					stateTimer = 2.4f;
				}
				_stateImpulse = false;
				_navMeshAgent.Warp(((Component)this).transform.position);
				_navMeshAgent.ResetPath();
				_turnPosition = ((Component)_targetPlayer).transform.position;
				if (GameManager.Multiplayer())
				{
					_photonView.RPC("SwingImpulseRPC", (RpcTarget)0, Array.Empty<object>());
					_photonView.RPC("IsWalkingRPC", (RpcTarget)0, new object[1] { false });
				}
				else
				{
					SwingImpulseRPC();
					IsWalkingRPC(value: false);
				}
				return;
			}
			stateTimer -= Time.deltaTime;
			if (stateTimer <= 0f)
			{
				float num = Vector3.Distance(((Component)_targetPlayer).transform.position, ((Component)this).transform.position);
				if (num < 1f)
				{
					UpdateState(State.RSwing);
					_stateImpulse = true;
				}
				else
				{
					UpdateState(State.RWander);
				}
			}
		}

		private void StateRShortAttack()
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			if (_stateImpulse)
			{
				_navMeshAgent.Warp(((Component)this).transform.position);
				_navMeshAgent.ResetPath();
				_stateImpulse = false;
				stateTimer = 5.5f;
				if ((Object)(object)_targetPlayer != (Object)null)
				{
					_turnPosition = ((Component)_targetPlayer).transform.position;
				}
				if (Terminator)
				{
					if (GameManager.Multiplayer())
					{
						_photonView.RPC("ChangeAnimSpeedRPC", (RpcTarget)0, new object[1] { 1f });
					}
					else
					{
						ChangeAnimSpeedRPC(1f);
					}
				}
				if (GameManager.Multiplayer())
				{
					_photonView.RPC("AttackShortImpulseRPC", (RpcTarget)0, Array.Empty<object>());
					_photonView.RPC("IsWalkingRPC", (RpcTarget)0, new object[1] { false });
				}
				else
				{
					AttackShortImpulseRPC();
					IsWalkingRPC(value: false);
				}
			}
			else
			{
				FireBullets();
				stateTimer -= Time.deltaTime;
				if (stateTimer <= 0f)
				{
					UpdateState(State.RWander);
				}
			}
		}

		private void StateRAttack()
		{
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			if (_stateImpulse)
			{
				if (Terminator)
				{
					if (GameManager.Multiplayer())
					{
						_photonView.RPC("ChangeAnimSpeedRPC", (RpcTarget)0, new object[1] { 1f });
					}
					else
					{
						ChangeAnimSpeedRPC(1f);
					}
				}
				_attackCooldown = Random.Range(22f, 32f);
				_stateImpulse = false;
				stateTimer = 19.4f;
				_navMeshAgent.Warp(((Component)this).transform.position);
				_navMeshAgent.ResetPath();
				_turnPosition = ((Component)this).transform.position;
				if ((Object)(object)_targetPlayer != (Object)null)
				{
					_turnPosition = ((Component)_targetPlayer).transform.position;
				}
				if (GameManager.Multiplayer())
				{
					_photonView.RPC("AttackImpulseRPC", (RpcTarget)0, Array.Empty<object>());
					_photonView.RPC("IsWalkingRPC", (RpcTarget)0, new object[1] { false });
				}
				else
				{
					AttackImpulseRPC();
					IsWalkingRPC(value: false);
				}
			}
			else
			{
				FireBullets();
				stateTimer -= Time.deltaTime;
				if (stateTimer <= 0f)
				{
					UpdateState(State.RWander);
				}
			}
		}

		private void StateTransform()
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			if (_stateImpulse)
			{
				stateTimer = 12f;
				_stateImpulse = false;
				_isTurningToPlayer = false;
				_navMeshAgent.Warp(((Component)this).transform.position);
				_navMeshAgent.ResetPath();
				if (GameManager.Multiplayer())
				{
					_photonView.RPC("TransformImpulseRPC", (RpcTarget)0, Array.Empty<object>());
					_photonView.RPC("IsSprintingRPC", (RpcTarget)0, new object[1] { false });
					_photonView.RPC("IsWalkingRPC", (RpcTarget)0, new object[1] { false });
					_photonView.RPC("IsTurningRPC", (RpcTarget)0, new object[1] { false });
				}
				else
				{
					TransformImpulseRPC();
					IsSprintingRPC(value: false);
					IsWalkingRPC(value: false);
					IsTurningRPC(value: false);
				}
			}
			else
			{
				stateTimer -= Time.deltaTime;
				if (stateTimer <= 0f)
				{
					UpdateState(State.RAttack);
					Transformed = true;
				}
			}
		}

		private void StateStun()
		{
			if (_stateImpulse)
			{
				LostDroidAnim.StopFiring();
				_isTurningToPlayer = false;
				if (Terminator)
				{
					if (GameManager.Multiplayer())
					{
						_photonView.RPC("ChangeAnimSpeedRPC", (RpcTarget)0, new object[1] { 1f });
					}
					else
					{
						ChangeAnimSpeedRPC(1f);
					}
				}
				_stateImpulse = false;
				if (!Transformed)
				{
					if (!_firstStun && _hasSpawned)
					{
						if (GameManager.Multiplayer())
						{
							_photonView.RPC("IsStunnedRPC", (RpcTarget)0, new object[1] { true });
						}
						else
						{
							IsStunnedRPC(value: true);
						}
						_firstStun = true;
					}
				}
				else if (GameManager.Multiplayer())
				{
					_photonView.RPC("IsStunnedRPC", (RpcTarget)0, new object[1] { true });
				}
				else
				{
					IsStunnedRPC(value: true);
				}
			}
			if (_enemy.IsStunned())
			{
				return;
			}
			if (GameManager.Multiplayer())
			{
				_photonView.RPC("IsStunnedRPC", (RpcTarget)0, new object[1] { false });
			}
			else
			{
				IsStunnedRPC(value: false);
			}
			if (Transformed)
			{
				if (_attackCooldown > 0f)
				{
					UpdateState(State.RShortAttack);
				}
				else
				{
					UpdateState(State.RAttack);
				}
			}
			else
			{
				UpdateState(State.Transform);
			}
		}

		private void StateFollow()
		{
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: 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_01b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c6: Unknown result type (might be due to invalid IL or missing references)
			if (_stateImpulse)
			{
				stateTimer = 6f;
				_stateImpulse = false;
				if (GameManager.Multiplayer())
				{
					_photonView.RPC("IsSprintingRPC", (RpcTarget)0, new object[1] { true });
					_photonView.RPC("IsTurningRPC", (RpcTarget)0, new object[1] { false });
				}
				else
				{
					IsSprintingRPC(value: true);
					IsTurningRPC(value: false);
				}
				return;
			}
			if (Vector3.Distance(((Component)this).transform.position, ((Component)_targetPlayer).transform.position) > _avoidDist)
			{
				_overrideAgentLerp -= Time.deltaTime / 0.01f;
				_enemy.Rigidbody.OverrideFollowPosition(0.2f, 5f, 30f);
				_overrideAgentLerp = Mathf.Clamp(_overrideAgentLerp, 0f, 1f);
				float num = 25f;
				float num2 = 25f;
				float num3 = Mathf.Lerp(_enemy.NavMeshAgent.DefaultSpeed, num, _overrideAgentLerp);
				float num4 = Mathf.Lerp(_enemy.Rigidbody.positionSpeedChase, num2, _overrideAgentLerp);
				_enemy.NavMeshAgent.OverrideAgent(num3 * 2f, _enemy.NavMeshAgent.DefaultAcceleration, 0.2f);
				_enemy.Rigidbody.OverrideFollowPosition(1f, num4 * 2f, -1f);
				_targetPosition = ((Component)_targetPlayer).transform.position;
				_enemy.NavMeshAgent.SetDestination(_targetPosition);
				_isTurningToPlayer = false;
				if (GameManager.Multiplayer())
				{
					_photonView.RPC("IsSprintingRPC", (RpcTarget)0, new object[1] { true });
					_photonView.RPC("IsTurningRPC", (RpcTarget)0, new object[1] { false });
				}
				else
				{
					IsSprintingRPC(value: true);
					IsTurningRPC(value: false);
				}
			}
			else
			{
				_navMeshAgent.Agent.ResetPath();
				_isTurningToPlayer = true;
				if (GameManager.Multiplayer())
				{
					_photonView.RPC("IsSprintingRPC", (RpcTarget)0, new object[1] { false });
					_photonView.RPC("IsWalkingRPC", (RpcTarget)0, new object[1] { false });
				}
				else
				{
					IsSprintingRPC(value: false);
					IsWalkingRPC(value: false);
				}
			}
			if (_transformCount > 0f)
			{
				_transformCount -= Time.deltaTime * 0.8f;
				stateTimer -= Time.deltaTime;
				if (stateTimer <= 0f)
				{
					UpdateState(State.Idle);
				}
			}
			else
			{
				UpdateState(State.Transform);
			}
		}

		private void StateNotice()
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			if (_stateImpulse)
			{
				_stateImpulse = false;
				_navMeshAgent.Warp(((Component)this).transform.position);
				_navMeshAgent.ResetPath();
				stateTimer = Random.Range(2f, 4f);
				if (GameManager.Multiplayer())
				{
					_photonView.RPC("IsSprintingRPC", (RpcTarget)0, new object[1] { false });
					_photonView.RPC("IsWalkingRPC", (RpcTarget)0, new object[1] { false });
				}
				else
				{
					IsSprintingRPC(value: false);
					IsWalkingRPC(value: false);
				}
				return;
			}
			if (_transformCount > 0f)
			{
				_transformCount -= Time.deltaTime * 0.4f;
				stateTimer -= Time.deltaTime;
				if (stateTimer <= 0f)
				{
					UpdateState(State.Idle);
				}
			}
			else
			{
				UpdateState(State.Transform);
			}
			stateTimer -= Time.deltaTime;
			if (stateTimer <= 0f)
			{
				UpdateState(State.Follow);
			}
		}

		private void UpdateState(State _newState)
		{
			if (CurrentState != _newState)
			{
				CurrentState = _newState;
				stateTimer = 0f;
				_stateImpulse = true;
				if (GameManager.Multiplayer())
				{
					_photonView.RPC("UpdateStateRPC", (RpcTarget)0, new object[1] { CurrentState });
				}
				else
				{
					UpdateStateRPC(CurrentState);
				}
			}
		}

		[PunRPC]
		private void PickRandomVariantRPC(int value)
		{
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			droidVariant = value;
			Renderer[] array = renderers;
			foreach (Renderer val in array)
			{
				val.material.SetColor("_AlbedoColor", colors[droidVariant]);
			}
		}

		[PunRPC]
		private void UpdateStateRPC(State _state)
		{
			CurrentState = _state;
			if (CurrentState == State.Spawn)
			{
				LostDroidAnim.SetSpawn();
			}
		}

		[PunRPC]
		private void IsWalkingRPC(bool value)
		{
			_isWalking = value;
		}

		[PunRPC]
		private void IsSprintingRPC(bool value)
		{
			_isSprinting = value;
		}

		[PunRPC]
		private void IsTurningRPC(bool value)
		{
			_isTurning = value;
		}

		[PunRPC]
		private void TransformImpulseRPC()
		{
			_transformImpulse = true;
		}

		[PunRPC]
		private void IsStunnedRPC(bool value)
		{
			_isStun = value;
		}

		[PunRPC]
		private void AttackImpulseRPC()
		{
			_attackImpulse = true;
		}

		[PunRPC]
		private void AttackShortImpulseRPC()
		{
			_attackShortImpulse = true;
		}

		[PunRPC]
		private void SwingImpulseRPC()
		{
			_swingImpulse = true;
		}

		[PunRPC]
		private void DespawnImpulseRPC()
		{
			_despawnImpulse = true;
		}

		[PunRPC]
		private void TargetPlayerRPC(int _playerID)
		{
			foreach (PlayerAvatar player in GameDirector.instance.PlayerList)
			{
				if (player.photonView.ViewID == _playerID)
				{
					_targetPlayer = player;
				}
			}
		}

		[PunRPC]
		private void FireBulletRPC()
		{
			//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_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)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: 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_0084: 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_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: 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_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: 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_010f: Unknown result type (might be due to invalid IL or missing references)
			if (SemiFunc.IsMasterClientOrSingleplayer())
			{
				Vector3 endPosition = _bulletPosition.position;
				bool hit = false;
				bool flag = false;
				Vector3 forward = _bulletPosition.forward;
				float num = Random.Range(0f, _bulletSpread);
				float num2 = Random.Range(0f, 360f);
				Vector3 val = Vector3.Cross(forward, Random.onUnitSphere);
				Vector3 normalized = ((Vector3)(ref val)).normalized;
				Quaternion val2 = Quaternion.AngleAxis(num, normalized);
				val = Quaternion.AngleAxis(num2, forward) * val2 * forward;
				forward = ((Vector3)(ref val)).normalized;
				RaycastHit val3 = default(RaycastHit);
				if (Physics.Raycast(_bulletPosition.position, forward, ref val3, 80f, LayerMask.op_Implicit(SemiFunc.LayerMaskGetVisionObstruct()) + LayerMask.GetMask(new string[1] { "Enemy" })))
				{
					endPosition = ((RaycastHit)(ref val3)).point;
					hit = true;
				}
				else
				{
					flag = true;
				}
				if (flag)
				{
					endPosition = _bulletPosition.position + _bulletPosition.forward * 80f;
				}
				ShootBullet(endPosition, hit);
			}
		}

		[PunRPC]
		public void ShootBulletRPC(Vector3 _endPosition, bool _hit)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			ItemGunBullet component = Object.Instantiate<GameObject>(bulletPrefab, _bulletPosition.position, _bulletPosition.rotation).GetComponent<ItemGunBullet>();
			component.hitPosition = _endPosition;
			component.bulletHit = _hit;
			soundHit.Play(_endPosition, 1f, 1f, 1f, 1f);
			component.shootLineWidthCurve = shootLineWidthCurve;
			component.ActivateAll();
		}

		[PunRPC]
		private void ChangeAnimSpeedRPC(float value)
		{
			_animSpeed = value;
		}

		[PunRPC]
		private void PlayVoicelineRPC(int value)
		{
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_012a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0161: Unknown result type (might be due to invalid IL or missing references)
			//IL_0198: Unknown result type (might be due to invalid IL or missing references)
			switch (value)
			{
			case 0:
				EnvyLines.Play(((Component)genericLines.Source).transform.position, 1f, 1f, 1f, 1f);
				break;
			case 1:
				SadLines.Play(((Component)genericLines.Source).transform.position, 1f, 1f, 1f, 1f);
				break;
			case 2:
				HateLines.Play(((Component)genericLines.Source).transform.position, 1f, 1f, 1f, 1f);
				break;
			case 3:
				CuteLines.Play(((Component)genericLines.Source).transform.position, 1f, 1f, 1f, 1f);
				break;
			case 4:
				genericLines.Play(((Component)genericLines.Source).transform.position, 1f, 1f, 1f, 1f);
				break;
			case 5:
				RageLines.Play(((Component)genericLines.Source).transform.position, 1f, 1f, 1f, 1f);
				break;
			case 6:
				MurderLines.Play(((Component)genericLines.Source).transform.position, 1f, 1f, 1f, 1f);
				break;
			}
		}

		public void OnHurt()
		{
			if (!Transformed)
			{
				if (_damageAmount < 2)
				{
					_damageAmount++;
				}
				else
				{
					UpdateState(State.Transform);
				}
			}
		}

		public void OnSpawn()
		{
			if (SemiFunc.IsMasterClientOrSingleplayer() && SemiFunc.EnemySpawn(_enemy))
			{
				UpdateState(State.Spawn);
			}
			_talker = Random.value < 0.5f;
			_talkTimer = Random.Range(5f, 28f);
			_avoidDist = Random.Range(2f, 4f);
			if (GameManager.Multiplayer())
			{
				_photonView.RPC("IsStunnedRPC", (RpcTarget)0, new object[1] { false });
			}
			else
			{
				IsStunnedRPC(value: false);
			}
			if (!Terminator)
			{
				int num = Random.Range(0, colors.Length);
				if (GameManager.Multiplayer() && SemiFunc.IsMasterClientOrSingleplayer())
				{
					_photonView.RPC("PickRandomVariantRPC", (RpcTarget)0, new object[1] { num });
				}
				else
				{
					PickRandomVariantRPC(num);
				}
			}
		}

		public void OnGrab()
		{
			_targetPlayer = _enemy.Vision.onVisionTriggeredPlayer;
			if (CurrentState == State.Idle || CurrentState == State.Wander)
			{
				if (GameManager.Multiplayer() && (Object)(object)_targetPlayer != (Object)null)
				{
					_photonView.RPC("TargetPlayerRPC", (RpcTarget)0, new object[1] { _targetPlayer.photonView.ViewID });
				}
				if ((Object)(object)_targetPlayer != (Object)null)
				{
					UpdateState(State.Notice);
				}
			}
			else if (CurrentState == State.RWander)
			{
				if (GameManager.Multiplayer() && (Object)(object)_targetPlayer != (Object)null)
				{
					_photonView.RPC("TargetPlayerRPC", (RpcTarget)0, new object[1] { _targetPlayer.photonView.ViewID });
				}
				UpdateState(State.RSwing);
			}
		}

		public void OnDeath()
		{
			_deathImpulse = true;
			_enemy.Stunned = false;
			LostDroidAnim.PlayDeathParticles();
			if (SemiFunc.IsMasterClientOrSingleplayer())
			{
				_enemy.EnemyParent.Despawn();
			}
		}

		public void OnVision()
		{
			//IL_0157: Unknown result type (might be due to invalid IL or missing references)
			//IL_0162: Unknown result type (might be due to invalid IL or missing references)
			if (!Transformed)
			{
				if (CurrentState == State.Wander || CurrentState == State.Idle)
				{
					_targetPlayer = _enemy.Vision.onVisionTriggeredPlayer;
					if (!_targetPlayer.isCrawling)
					{
						UpdateState(State.Notice);
						if (GameManager.Multiplayer())
						{
							_photonView.RPC("TargetPlayerRPC", (RpcTarget)0, new object[1] { _targetPlayer.photonView.ViewID });
						}
					}
				}
				else if ((CurrentState == State.Follow || CurrentState == State.Notice) && (Object)(object)_targetPlayer == (Object)(object)_enemy.Vision.onVisionTriggeredPlayer && !_targetPlayer.isCrawling)
				{
					stateTimer = MathF.Max(stateTimer, 3f);
				}
			}
			else
			{
				if (CurrentState != State.RWander)
				{
					return;
				}
				_targetPlayer = _enemy.Vision.onVisionTriggeredPlayer;
				if (!_targetPlayer.isCrawling)
				{
					if (Vector3.Distance(((Component)_targetPlayer).transform.position, ((Component)this).transform.position) < 3f)
					{
						UpdateState(State.RSwing);
					}
					else if (_attackCooldown > 0f)
					{
						UpdateState(State.RShortAttack);
					}
					else
					{
						UpdateState(State.RAttack);
					}
					if (GameManager.Multiplayer())
					{
						_photonView.RPC("TargetPlayerRPC", (RpcTarget)0, new object[1] { _targetPlayer.photonView.ViewID });
					}
				}
			}
		}

		private void Talk()
		{
			if (!_talker)
			{
				return;
			}
			if (!Terminator && !Transformed && CurrentState != State.Transform)
			{
				if (_transformCount < _transformCountMax / 6f * 2f)
				{
					PlayVoicelineMultiplayer(5);
				}
				else if (Random.value < 0.95f)
				{
					switch (droidVariant)
					{
					case 0:
						PlayVoicelineMultiplayer(0);
						break;
					case 1:
						PlayVoicelineMultiplayer(1);
						break;
					case 2:
						PlayVoicelineMultiplayer(2);
						break;
					case 3:
						PlayVoicelineMultiplayer(3);
						break;
					case 4:
						PlayVoicelineMultiplayer(4);
						break;
					}
				}
				else
				{
					PlayVoicelineMultiplayer(4);
				}
			}
			else
			{
				PlayVoicelineMultiplayer(6);
			}
		}

		private void PlayVoicelineMultiplayer(int value)
		{
			if (SemiFunc.IsMasterClientOrSingleplayer())
			{
				if (GameManager.Multiplayer())
				{
					_photonView.RPC("PlayVoicelineRPC", (RpcTarget)0, new object[1] { value });
				}
				else
				{
					PlayVoicelineRPC(value);
				}
			}
		}

		private void ShootBullet(Vector3 _endPosition, bool _hit)
		{
			//IL_0050: 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)
			if (SemiFunc.IsMasterClientOrSingleplayer())
			{
				minigunParticles.Play();
				if (SemiFunc.IsMultiplayer())
				{
					_photonView.RPC("ShootBulletRPC", (RpcTarget)0, new object[2] { _endPosition, _hit });
				}
				else
				{
					ShootBulletRPC(_endPosition, _hit);
				}
			}
		}

		public void FireBullets()
		{
			if (!_fireBullets)
			{
				return;
			}
			if (_bulletFireCooldown <= 0f)
			{
				_bulletFireCooldown = 0.02f;
				if (SemiFunc.IsMultiplayer())
				{
					_photonView.RPC("FireBulletRPC", (RpcTarget)0, Array.Empty<object>());
				}
				else
				{
					FireBulletRPC();
				}
			}
			_bulletFireCooldown -= Time.deltaTime;
		}

		private void RotationLogic()
		{
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0193: Unknown result type (might be due to invalid IL or missing references)
			//IL_019e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a8: 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_01ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: 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_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_012d: Unknown result type (might be due to invalid IL or missing references)
			//IL_013c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0245: Unknown result type (might be due to invalid IL or missing references)
			//IL_0250: Unknown result type (might be due to invalid IL or missing references)
			//IL_0255: Unknown result type (might be due to invalid IL or missing references)
			//IL_025a: Unknown result type (might be due to invalid IL or missing references)
			//IL_025d: Unknown result type (might be due to invalid IL or missing references)
			//IL_025f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0264: Unknown result type (might be due to invalid IL or missing references)
			//IL_0269: Unknown result type (might be due to invalid IL or missing references)
			//IL_027f: Unknown result type (might be due to invalid IL or missing references)
			//IL_028e: Unknown result type (might be due to invalid IL or missing references)
			if (CurrentState != State.Stun && CurrentState != State.Idle && CurrentState != State.Notice && CurrentState != State.Transform && CurrentState != State.RAttack && CurrentState != State.RShortAttack && CurrentState != State.RSwing)
			{
				horizontalRotationSpring.speed = 10f;
				horizontalRotationSpring.damping = 1f;
				Vector3 normalized = ((Vector3)(ref _navMeshAgent.AgentVelocity)).normalized;
				if (((Vector3)(ref normalized)).magnitude > 0.1f)
				{
					_horizontalRotationTarget = Quaternion.LookRotation(((Vector3)(ref _navMeshAgent.AgentVelocity)).normalized);
					((Quaternion)(ref _horizontalRotationTarget)).eulerAngles = new Vector3(0f, ((Quaternion)(ref _horizontalRotationTarget)).eulerAngles.y, 0f);
				}
				else if (_isTurningToPlayer)
				{
					Vector3 val = ((Component)_targetPlayer).transform.position - ((Component)this).transform.position;
					_horizontalRotationTarget = Quaternion.LookRotation(val, Vector3.up);
					((Quaternion)(ref _horizontalRotationTarget)).eulerAngles = new Vector3(0f, ((Quaternion)(ref _horizontalRotationTarget)).eulerAngles.y, 0f);
					TurnDroid();
				}
			}
			else if (CurrentState == State.Notice)
			{
				horizontalRotationSpring.speed = 10f;
				horizontalRotationSpring.damping = 1f;
				Vector3 val2 = ((Component)_targetPlayer).transform.position - ((Component)this).transform.position;
				_horizontalRotationTarget = Quaternion.LookRotation(val2, Vector3.up);
				((Quaternion)(ref _horizontalRotationTarget)).eulerAngles = new Vector3(0f, ((Quaternion)(ref _horizontalRotationTarget)).eulerAngles.y, 0f);
				TurnDroid();
			}
			else if (CurrentState == State.RSwing || CurrentState == State.RShortAttack || (CurrentState == State.RAttack && _isTurningToPlayer))
			{
				horizontalRotationSpring.speed = 5f;
				horizontalRotationSpring.damping = 0.5f;
				Vector3 val3 = _turnPosition - ((Component)this).transform.position;
				_horizontalRotationTarget = Quaternion.LookRotation(val3, Vector3.up);
				((Quaternion)(ref _horizontalRotationTarget)).eulerAngles = new Vector3(0f, ((Quaternion)(ref _horizontalRotationTarget)).eulerAngles.y, 0f);
			}
			((Component)this).transform.rotation = SemiFunc.SpringQuaternionGet(horizontalRotationSpring, _horizontalRotationTarget, -1f);
		}

		private void TurnDroid()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			float num = Quaternion.Angle(((Component)this).transform.rotation, _horizontalRotationTarget);
			if (num > 7f || num < -7f)
			{
				if (GameManager.Multiplayer())
				{
					_photonView.RPC("IsTurningRPC", (RpcTarget)0, new object[1] { true });
				}
				else
				{
					IsTurningRPC(value: true);
				}
			}
			else if (GameManager.Multiplayer())
			{
				_photonView.RPC("IsTurningRPC", (RpcTarget)0, new object[1] { false });
			}
			else
			{
				IsTurningRPC(value: false);
			}
		}

		private void HurtEffect()
		{
			if (!_hurtImpulse)
			{
				return;
			}
			hurtLerp += 2.5f * Time.deltaTime;
			hurtLerp = Mathf.Clamp01(hurtLerp);
			foreach (Material item in _hurtMaterial)
			{
				if ((Object)(object)item != (Object)null)
				{
					item.SetFloat(_hurtAmount, hurtCurve.Evaluate(hurtLerp));
				}
				if (hurtLerp >= 1f)
				{
					hurtLerp = 0f;
					_hurtImpulse = false;
					if ((Object)(object)item != (Object)null)
					{
						item.SetFloat(_hurtAmount, 0f);
					}
				}
			}
		}

		private bool CheckPathCompletion()
		{
			NavMeshAgent agent = _navMeshAgent.Agent;
			float remainingDistance = agent.remainingDistance;
			if (remainingDistance <= 0.07f)
			{
				return true;
			}
			return false;
		}
	}
	internal class LostDroidAnimationController : MonoBehaviour
	{
		[Header("References")]
		public LostDroid Controller;

		public Animator animator;

		public Transform minigunFirePosition;

		public GameObject ExplosionPrefab;

		[Header("Particles")]
		public ParticleSystem[] Deathparticles;

		public ParticleSystem footstepParticles;

		public ParticleSystem goreExplosion;

		[Header("Sounds")]
		[SerializeField]
		private Sound mediumFootstepSounds;

		[SerializeField]
		private Sound mediumWoodFootstepSounds;

		[SerializeField]
		private Sound mediumStoneFootstepSounds;

		[SerializeField]
		private Sound smallFootstepSounds;

		[SerializeField]
		private Sound largeFootstepSounds;

		[SerializeField]
		private Sound transformSounds;

		[SerializeField]
		private Sound stingerSounds;

		[SerializeField]
		public Sound minigunAttackSounds;

		[SerializeField]
		public Sound minigunShortAttackSounds;

		[SerializeField]
		public Sound minigunAttackGlobalSounds;

		[SerializeField]
		public Sound minigunShortAttackGlobalSounds;

		[SerializeField]
		private Sound hurtSounds;

		[SerializeField]
		private Sound deathSounds;

		[SerializeField]
		private Sound whipSounds;

		[SerializeField]
		private Sound explodeSounds;

		private void Update()
		{
			//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
			animator.SetBool("isSprinting", Controller._isSprinting);
			animator.SetBool("isWalking", Controller._isWalking);
			animator.SetBool("isTurning", Controller._isTurning);
			animator.SetBool("stun", Controller._isStun);
			if (Controller._animSpeed != animator.speed)
			{
				animator.speed = Controller._animSpeed;
			}
			if (Controller._despawnImpulse)
			{
				Controller._despawnImpulse = false;
				animator.SetTrigger("despawn");
			}
			if (Controller._transformImpulse)
			{
				Controller._transformImpulse = false;
				animator.SetTrigger("transform");
			}
			if (Controller._attackImpulse)
			{
				Controller._attackImpulse = false;
				animator.SetTrigger("attack");
			}
			if (Controller._attackShortImpulse)
			{
				Controller._attackShortImpulse = false;
				animator.SetTrigger("attack2");
			}
			if (Controller._deathImpulse)
			{
				Controller._deathImpulse = false;
				animator.SetTrigger("death");
				deathSounds.Play(Controller._enemy.CenterTransform.position, 1f, 1f, 1f, 1f);
			}
			if (Controller._swingImpulse)
			{
				Controller._swingImpulse = false;
				animator.SetTrigger("swing");
			}
		}

		public void ShakeCameraSmall()
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			GameDirector.instance.CameraShake.ShakeDistance(2f, 5f, 15f, ((Component)this).transform.position, 0.8f);
		}

		public void ShakeCameraBig()
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			GameDirector.instance.CameraShake.ShakeDistance(6f, 5f, 15f, ((Component)this).transform.position, 1.8f);
		}

		public void ShakeCameraStep()
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			GameDirector.instance.CameraShake.ShakeDistance(3f, 5f, 15f, ((Component)this).transform.position, 1f);
			footstepParticles.Play();
		}

		public void ShakeCameraFire()
		{
			//IL_0020: 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)
			GameDirector.instance.CameraShake.ShakeDistance(7f, 10f, 20f, ((Component)this).transform.position, 8.64f);
			EnemyDirector.instance.SetInvestigate(((Component)this).transform.position, 40f);
		}

		public void StartFiring()
		{
			Controller._fireBullets = true;
		}

		public void StopFiring()
		{
			Controller._fireBullets = false;
		}

		public void ExplodeMinigun()
		{
			Object.Instantiate<GameObject>(ExplosionPrefab, minigunFirePosition);
			PlayExplode();
		}

		public void StartTurning()
		{
			Controller._isTurningToPlayer = true;
		}

		public void StopTurning()
		{
			Controller._isTurningToPlayer = false;
		}

		public void PlayGorePartExplosion()
		{
			goreExplosion.Play();
		}

		public void PlaySmallFootstep()
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			smallFootstepSounds.Play(Controller.Enemy.CenterTransform.position, 1f, 1f, 1f, 1f);
		}

		public void PlayMediumFootstep()
		{
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			if (LevelGenerator.Instance.Level.NarrativeName == "McJannek Station")
			{
				mediumFootstepSounds.Play(Controller.Enemy.CenterTransform.position, 1f, 1f, 1f, 1f);
			}
			else if (LevelGenerator.Instance.Level.NarrativeName == "Headman Manor")
			{
				mediumWoodFootstepSounds.Play(Controller.Enemy.CenterTransform.position, 1f, 1f, 1f, 1f);
			}
			else if (LevelGenerator.Instance.Level.NarrativeName == "Swiftbroom Academy")
			{
				mediumStoneFootstepSounds.Play(Controller.Enemy.CenterTransform.position, 1f, 1f, 1f, 1f);
			}
		}

		public void PlayLargeFootstep()
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			largeFootstepSounds.Play(Controller.Enemy.CenterTransform.position, 1f, 1f, 1f, 1f);
		}

		public void PlayStinger()
		{
			//IL_0017: 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_0081: Unknown result type (might be due to invalid IL or missing references)
			stingerSounds.Play(Controller.Enemy.CenterTransform.position, 1f, 1f, 1f, 1f);
			minigunAttackSounds.Play(Controller.Enemy.CenterTransform.position, 1f, 1f, 1f, 1f);
			minigunAttackGlobalSounds.Play(Controller.Enemy.CenterTransform.position, 1f, 1f, 1f, 1f);
		}

		public void PlayShortStinger()
		{
			//IL_0017: 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)
			minigunShortAttackSounds.Play(Controller.Enemy.CenterTransform.position, 1f, 1f, 1f, 1f);
			minigunShortAttackGlobalSounds.Play(Controller.Enemy.CenterTransform.position, 1f, 1f, 1f, 1f);
		}

		public void PlayAttackSmall()
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			stingerSounds.Play(Controller.Enemy.CenterTransform.position, 1f, 1f, 1f, 1f);
		}

		public void PlayWhipSound()
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			whipSounds.Play(Controller.Enemy.CenterTransform.position, 1f, 1f, 1f, 1f);
		}

		public void PlayHurtSound()
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			hurtSounds.Play(Controller.Enemy.CenterTransform.position, 1f, 1f, 1f, 1f);
		}

		public void PlayTransform()
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			transformSounds.Play(Controller.Enemy.CenterTransform.position, 1f, 1f, 1f, 1f);
		}

		public void PlayDeathsound()
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			deathSounds.Play(Controller.Enemy.CenterTransform.position, 1f, 1f, 1f, 1f);
		}

		public void PlayExplode()
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			explodeSounds.Play(Controller.Enemy.CenterTransform.position, 1f, 1f, 1f, 1f);
		}

		public void PlayDeathParticles()
		{
			PlayDeathsound();
			ParticleSystem[] deathparticles = Deathparticles;
			foreach (ParticleSystem val in deathparticles)
			{
				val.Play();
			}
		}

		public void SetDespawn()
		{
			if (SemiFunc.IsMasterClientOrSingleplayer())
			{
				Controller._enemy.EnemyParent.Despawn();
			}
		}

		public void SetSpawn()
		{
			animator.Play("New State", -1, 0f);
			Controller._damageAmount = 0;
			Controller.Transformed = false;
			if (Controller.Terminator)
			{
				Controller._transformCount = 5f;
				Controller._transformCountMax = Random.Range(5f, 10f);
			}
			else
			{
				Controller._transformCount = 8f;
				Controller._transformCountMax = Random.Range(6f, 12f);
			}
		}

		public void Despawn()
		{
			Controller._enemy.EnemyParent.Despawn();
		}
	}
	internal class Popper : MonoBehaviour
	{
		public enum State
		{
			Spawn,
			Idle,
			Wander,
			Stun,
			Despawn
		}

		private Enemy _enemy;

		private PhotonView _photonView;

		public bool Terminator = false;

		private bool _stateImpulse = false;

		private Quaternion _horizontalRotationTarget = Quaternion.identity;

		private Material _hurtMaterial;

		private bool _hurtImpulse;

		private float hurtLerp;

		private int _hurtAmount;

		[Header("State")]
		[SerializeField]
		public State currentState;

		[SerializeField]
		public float stateTimer;

		[SerializeField]
		public float stateHaltTimer;

		[Header("Animation")]
		[SerializeField]
		private AnimationCurve hurtCurve;

		[SerializeField]
		private SkinnedMeshRenderer _skinnedMeshRenderer;

		[Header("Rotation and LookAt")]
		public SpringQuaternion horizontalRotationSpring;

		private EnemyNavMeshAgent _navMeshAgent => _enemy.NavMeshAgent;

		private EnemyRigidbody _rigidbody => _enemy.Rigidbody;

		private EnemyParent _enemyParent => _enemy.EnemyParent;

		private EnemyVision _Vision => _enemy.Vision;

		public Enemy Enemy => _enemy;

		private void Awake()
		{
			_enemy = ((Component)this).GetComponent<Enemy>();
			_photonView = ((Component)this).GetComponent<PhotonView>();
			_hurtAmount = Shader.PropertyToID("_ColorOverlayAmount");
			if ((Object)(object)_skinnedMeshRenderer != (Object)null)
			{
				_hurtMaterial = ((Renderer)_skinnedMeshRenderer).material;
			}
			hurtCurve = AssetManager.instance.animationCurveImpact;
		}

		private void Update()
		{
			if ((GameManager.Multiplayer() && !PhotonNetwork.IsMasterClient) || !LevelGenerator.Instance.Generated)
			{
				return;
			}
			if (!_enemy.IsStunned())
			{
				switch (currentState)
				{
				case State.Spawn:
					StateSpawn();
					break;
				case State.Wander:
					StateWander();
					break;
				case State.Idle:
					StateIdle();
					break;
				case State.Despawn:
					StateDespawn();
					break;
				default:
					throw new ArgumentOutOfRangeException();
				}
				RotationLogic();
			}
			else
			{
				UpdateState(State.Stun);
				StateStun();
			}
			HurtEffect();
		}

		private void StateSpawn()
		{
		}

		private void StateWander()
		{
		}

		private void StateIdle()
		{
		}

		private void StateDespawn()
		{
		}

		private void StateStun()
		{
		}

		private void UpdateState(State _newState)
		{
			if (currentState != _newState)
			{
				currentState = _newState;
				stateTimer = 0f;
				_stateImpulse = true;
				if (GameManager.Multiplayer())
				{
					_photonView.RPC("UpdateStateRPC", (RpcTarget)0, new object[1] { currentState });
				}
				else if (SemiFunc.IsMasterClientOrSingleplayer())
				{
					_enemy.EnemyParent.Despawn();
				}
			}
		}

		[PunRPC]
		private void UpdateStateRPC(State _state)
		{
			currentState = _state;
			Debug.Log((object)_state);
		}

		private void RotationLogic()
		{
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			if (currentState != State.Stun && currentState != State.Idle)
			{
				horizontalRotationSpring.speed = 8f;
				horizontalRotationSpring.damping = 0.85f;
				Vector3 normalized = ((Vector3)(ref _navMeshAgent.AgentVelocity)).normalized;
				if (((Vector3)(ref normalized)).magnitude > 0.1f)
				{
					_horizontalRotationTarget = Quaternion.LookRotation(((Vector3)(ref _navMeshAgent.AgentVelocity)).normalized);
					((Quaternion)(ref _horizontalRotationTarget)).eulerAngles = new Vector3(0f, ((Quaternion)(ref _horizontalRotationTarget)).eulerAngles.y, 0f);
				}
			}
			((Component)this).transform.rotation = SemiFunc.SpringQuaternionGet(horizontalRotationSpring, _horizontalRotationTarget, -1f);
		}

		private void HurtEffect()
		{
			if (!_hurtImpulse)
			{
				return;
			}
			hurtLerp += 2.5f * Time.deltaTime;
			hurtLerp = Mathf.Clamp01(hurtLerp);
			if ((Object)(object)_hurtMaterial != (Object)null)
			{
				_hurtMaterial.SetFloat(_hurtAmount, hurtCurve.Evaluate(hurtLerp));
			}
			if (hurtLerp >= 1f)
			{
				hurtLerp = 0f;
				_hurtImpulse = false;
				if ((Object)(object)_hurtMaterial != (Object)null)
				{
					_hurtMaterial.SetFloat(_hurtAmount, 0f);
				}
			}
		}
	}
	internal class PopperAnimationController : MonoBehaviour
	{
		[Header("References")]
		public Popper Controller;

		public Animator animator;
	}
	internal class TheLady : MonoBehaviour
	{
		public enum State
		{
			Spawn,
			Idle,
			Wander,
			Stun,
			Despawn
		}

		private Enemy _enemy;

		private PhotonView _photonView;

		public bool Terminator = false;

		private bool _stateImpulse = false;

		private Quaternion _horizontalRotationTarget = Quaternion.identity;

		private Material _hurtMaterial;

		private bool _hurtImpulse;

		private float hurtLerp;

		private int _hurtAmount;

		[Header("State")]
		[SerializeField]
		public State currentState;

		[SerializeField]
		public float stateTimer;

		[SerializeField]
		public float stateHaltTimer;

		[Header("Animation")]
		[SerializeField]
		private AnimationCurve hurtCurve;

		[SerializeField]
		private SkinnedMeshRenderer _skinnedMeshRenderer;

		[Header("Rotation and LookAt")]
		public SpringQuaternion horizontalRotationSpring;

		private EnemyNavMeshAgent _navMeshAgent => _enemy.NavMeshAgent;

		private EnemyRigidbody _rigidbody => _enemy.Rigidbody;

		private EnemyParent _enemyParent => _enemy.EnemyParent;

		private EnemyVision _Vision => _enemy.Vision;

		public Enemy Enemy => _enemy;

		private void Awake()
		{
			_enemy = ((Component)this).GetComponent<Enemy>();
			_photonView = ((Component)this).GetComponent<PhotonView>();
			_hurtAmount = Shader.PropertyToID("_ColorOverlayAmount");
			if ((Object)(object)_skinnedMeshRenderer != (Object)null)
			{
				_hurtMaterial = ((Renderer)_skinnedMeshRenderer).material;
			}
			hurtCurve = AssetManager.instance.animationCurveImpact;
		}

		private void Update()
		{
			if ((GameManager.Multiplayer() && !PhotonNetwork.IsMasterClient) || !LevelGenerator.Instance.Generated)
			{
				return;
			}
			if (!_enemy.IsStunned())
			{
				switch (currentState)
				{
				case State.Spawn:
					StateSpawn();
					break;
				case State.Wander:
					StateWander();
					break;
				case State.Idle:
					StateIdle();
					break;
				case State.Despawn:
					StateDespawn();
					break;
				default:
					throw new ArgumentOutOfRangeException();
				}
				RotationLogic();
			}
			else
			{
				UpdateState(State.Stun);
				StateStun();
			}
			HurtEffect();
		}

		private void StateSpawn()
		{
		}

		private void StateWander()
		{
		}

		private void StateIdle()
		{
		}

		private void StateDespawn()
		{
		}

		private void StateStun()
		{
		}

		private void UpdateState(State _newState)
		{
			if (currentState != _newState)
			{
				currentState = _newState;
				stateTimer = 0f;
				_stateImpulse = true;
				if (GameManager.Multiplayer())
				{
					_photonView.RPC("UpdateStateRPC", (RpcTarget)0, new object[1] { currentState });
				}
				else if (SemiFunc.IsMasterClientOrSingleplayer())
				{
					_enemy.EnemyParent.Despawn();
				}
			}
		}

		[PunRPC]
		private void UpdateStateRPC(State _state)
		{
			currentState = _state;
			Debug.Log((object)_state);
		}

		private void RotationLogic()
		{
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			if (currentState != State.Stun && currentState != State.Idle)
			{
				horizontalRotationSpring.speed = 8f;
				horizontalRotationSpring.damping = 0.85f;
				Vector3 normalized = ((Vector3)(ref _navMeshAgent.AgentVelocity)).normalized;
				if (((Vector3)(ref normalized)).magnitude > 0.1f)
				{
					_horizontalRotationTarget = Quaternion.LookRotation(((Vector3)(ref _navMeshAgent.AgentVelocity)).normalized);
					((Quaternion)(ref _horizontalRotationTarget)).eulerAngles = new Vector3(0f, ((Quaternion)(ref _horizontalRotationTarget)).eulerAngles.y, 0f);
				}
			}
			((Component)this).transform.rotation = SemiFunc.SpringQuaternionGet(horizontalRotationSpring, _horizontalRotationTarget, -1f);
		}

		private void HurtEffect()
		{
			if (!_hurtImpulse)
			{
				return;
			}
			hurtLerp += 2.5f * Time.deltaTime;
			hurtLerp = Mathf.Clamp01(hurtLerp);
			if ((Object)(object)_hurtMaterial != (Object)null)
			{
				_hurtMaterial.SetFloat(_hurtAmount, hurtCurve.Evaluate(hurtLerp));
			}
			if (hurtLerp >= 1f)
			{
				hurtLerp = 0f;
				_hurtImpulse = false;
				if ((Object)(object)_hurtMaterial != (Object)null)
				{
					_hurtMaterial.SetFloat(_hurtAmount, 0f);
				}
			}
		}
	}
	internal class TheLadyAnimationController : MonoBehaviour
	{
		[Header("References")]
		public TheLady Controller;

		public Animator animator;
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}

BepInEx/plugins/Magic_Wesley-Wesleys_Valuables/WesleysItemProj.dll

Decompiled 2 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using Microsoft.CodeAnalysis;
using REPOLib.Modules;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("Magic_Wesley")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyCopyright("Copyright © 2025 Magic_Wesley")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("WesleysItemProj")]
[assembly: AssemblyTitle("WesleysItemProj")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace WesleysItemProj
{
	[BepInPlugin("MagicWesley.WesleysItems", "WesleysItems", "0.2.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class WesleysItems : BaseUnityPlugin
	{
		private void Awake()
		{
			string directoryName = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location);
			string text = Path.Combine(directoryName, "wesleysitems_itemprefabs");
			AssetBundle val = AssetBundle.LoadFromFile(text);
			GameObject val2 = val.LoadAsset<GameObject>("BeholdersEye");
			GameObject val3 = val.LoadAsset<GameObject>("BiomontyDisplay");
			GameObject val4 = val.LoadAsset<GameObject>("Pickle");
			GameObject val5 = val.LoadAsset<GameObject>("PickleJar");
			GameObject val6 = val.LoadAsset<GameObject>("SpikyEye");
			GameObject val7 = val.LoadAsset<GameObject>("BananaHolder");
			GameObject val8 = val.LoadAsset<GameObject>("Webley");
			GameObject val9 = val.LoadAsset<GameObject>("Saphire");
			List<string> list = new List<string> { "Valuables - Arctic" };
			List<string> list2 = new List<string> { "Valuables - Wizard", "Valuables - Manor" };
			List<string> list3 = new List<string> { "Valuables - Manor" };
			List<string> list4 = new List<string> { "Valuables - Generic" };
			Valuables.RegisterValuable(val2, list2);
			Valuables.RegisterValuable(val3, list2);
			Valuables.RegisterValuable(val4, list4);
			Valuables.RegisterValuable(val5, list4);
			Valuables.RegisterValuable(val6, list2);
			Valuables.RegisterValuable(val7, list3);
			Valuables.RegisterValuable(val8, list4);
			Valuables.RegisterValuable(val9, list);
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "WesleysItemProj";

		public const string PLUGIN_NAME = "WesleysItemProj";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}

BepInEx/plugins/nickklmao-MenuLib/MenuLib.dll

Decompiled 2 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using MenuLib.MonoBehaviors;
using MenuLib.Structs;
using Microsoft.CodeAnalysis;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using MonoMod.RuntimeDetour;
using TMPro;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Controls;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("MenuLib")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("2.4.0")]
[assembly: AssemblyInformationalVersion("1.0.0+310afff596361610ac32e6fdbe1fd314baf713da")]
[assembly: AssemblyProduct("MenuLib")]
[assembly: AssemblyTitle("MenuLib")]
[assembly: AssemblyVersion("2.4.0.0")]
[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.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace MenuLib
{
	[BepInPlugin("nickklmao.menulib", "Menu Lib", "2.4.0")]
	internal sealed class Entry : BaseUnityPlugin
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static Action<Action<MenuPageMain>, MenuPageMain> <0>__MenuPageMain_StartHook;

			public static Action<Action<MenuPageSettings>, MenuPageSettings> <1>__MenuPageSettings_StartHook;

			public static Action<Action<MenuPageColor>, MenuPageColor> <2>__MenuPageColor_StartHook;

			public static Action<Action<MenuPageEsc>, MenuPageEsc> <3>__MenuPageEsc_StartHook;

			public static Action<Action<MenuPageLobby>, MenuPageLobby> <4>__MenuPageLobby_StartHook;

			public static Manipulator <5>__SemiFunc_UIMouseHoverILHook;

			public static Manipulator <6>__MenuPage_StateClosingILHook;

			public static Manipulator <7>__MenuScrollBox_UpdateILHook;

			public static Manipulator <8>__ChatManager_StateInactiveILHook;
		}

		private const string MOD_NAME = "Menu Lib";

		internal static readonly ManualLogSource logger = Logger.CreateLogSource("Menu Lib");

		private static void MenuPageMain_StartHook(Action<MenuPageMain> orig, MenuPageMain self)
		{
			orig(self);
			MenuAPI.mainMenuBuilderDelegate?.Invoke(((Component)self).transform);
		}

		private static void MenuPageSettings_StartHook(Action<MenuPageSettings> orig, MenuPageSettings self)
		{
			orig(self);
			MenuAPI.settingsMenuBuilderDelegate?.Invoke(((Component)self).transform);
		}

		private static void MenuPageColor_StartHook(Action<MenuPageColor> orig, MenuPageColor self)
		{
			orig(self);
			MenuAPI.colorMenuBuilderDelegate?.Invoke(((Component)self).transform);
		}

		private static void MenuPageEsc_StartHook(Action<MenuPageEsc> orig, MenuPageEsc self)
		{
			orig(self);
			MenuAPI.escapeMenuBuilderDelegate?.Invoke(((Component)self).transform);
		}

		private static void MenuPageLobby_StartHook(Action<MenuPageLobby> orig, MenuPageLobby self)
		{
			orig(self);
			MenuAPI.lobbyMenuBuilderDelegate?.Invoke(((Component)self).transform);
		}

		private static void SemiFunc_UIMouseHoverILHook(ILContext il)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			ILLabel val4 = default(ILLabel);
			val.GotoNext(new Func<Instruction, bool>[1]
			{
				(Instruction instruction) => ILPatternMatchingExt.MatchBrfalse(instruction, ref val4) && val4.Target.OpCode == OpCodes.Ldarg_1
			});
			val.Index += 2;
			val.RemoveRange(27);
			val.Emit(OpCodes.Ldloc_0);
			val.EmitDelegate<Func<MenuScrollBox, Vector2, bool>>((Func<MenuScrollBox, Vector2, bool>)delegate(MenuScrollBox menuScrollBox, Vector2 vector)
			{
				//IL_000b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0011: Expected O, but got Unknown
				//IL_0012: 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_002b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0034: Unknown result type (might be due to invalid IL or missing references)
				RectTransform val3 = (RectTransform)((Transform)menuScrollBox.scroller).parent;
				float y = ((Transform)val3).position.y;
				float num = y + val3.sizeDelta.y;
				return vector.y > y && vector.y < num;
			});
			ILLabel val2 = val.DefineLabel();
			val.Emit(OpCodes.Brtrue_S, (object)val2);
			val.Emit(OpCodes.Ldc_I4_0);
			val.Emit(OpCodes.Ret);
			val.MarkLabel(val2);
		}

		private static void MenuPage_StateClosingILHook(ILContext il)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			val.GotoNext(new Func<Instruction, bool>[1]
			{
				(Instruction instruction) => ILPatternMatchingExt.MatchLdfld<MenuPage>(instruction, "stateStart")
			});
			val.Index += 2;
			val.Emit(OpCodes.Ldarg_0);
			val.EmitDelegate<Action<MenuPage>>((Action<MenuPage>)delegate(MenuPage menuPage)
			{
				//IL_0016: Unknown result type (might be due to invalid IL or missing references)
				//IL_001c: Expected O, but got Unknown
				//IL_001d: 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_0027: 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)
				//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_0058: Unknown result type (might be due to invalid IL or missing references)
				if (MenuAPI.customMenuPages.TryGetValue(menuPage, out var value2))
				{
					RectTransform val2 = (RectTransform)((Component)menuPage).transform;
					Vector2 val3 = Vector2.op_Implicit(((Transform)val2).position);
					Rect rect = val2.rect;
					float num = 0f - ((Rect)(ref rect)).height;
					rect = value2.rectTransform.rect;
					val3.y = num - ((Rect)(ref rect)).height;
					REPOReflection.menuPage_AnimateAwayPosition.SetValue(menuPage, val3);
				}
			});
			val.GotoNext(new Func<Instruction, bool>[1]
			{
				(Instruction instruction) => ILPatternMatchingExt.MatchCall<Object>(instruction, "Destroy")
			});
			val.Index -= 5;
			val.RemoveRange(6);
			val.Emit(OpCodes.Ldarg_0);
			val.EmitDelegate<Action<MenuPage>>((Action<MenuPage>)delegate(MenuPage menuPage)
			{
				if (MenuAPI.customMenuPages.TryGetValue(menuPage, out var value) && (value.isCachedPage || !value.pageWasActivatedOnce))
				{
					((Behaviour)menuPage).enabled = false;
				}
				else
				{
					MenuManager.instance.PageRemove(menuPage);
					Object.Destroy((Object)(object)((Component)menuPage).gameObject);
				}
			});
		}

		private static void MenuScrollBox_UpdateILHook(ILContext il)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0132: Unknown result type (might be due to invalid IL or missing references)
			//IL_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_014a: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0219: Unknown result type (might be due to invalid IL or missing references)
			//IL_025e: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			val.GotoNext(new Func<Instruction, bool>[2]
			{
				(Instruction instruction) => ILPatternMatchingExt.MatchLdarg(instruction, 0),
				(Instruction instruction) => ILPatternMatchingExt.MatchLdfld<MenuScrollBox>(instruction, "scrollBoxActive")
			});
			val.RemoveRange(4);
			ILLabel val2 = val.MarkLabel();
			val.Index -= 2;
			val.Remove();
			val.Emit(OpCodes.Brtrue_S, (object)val2);
			val.GotoNext(new Func<Instruction, bool>[1]
			{
				(Instruction instruction) => ILPatternMatchingExt.MatchCall(instruction, typeof(SemiFunc), "InputScrollY")
			});
			int index = val.Index;
			val.Index = index - 1;
			val.Remove();
			ILLabel val3 = val.DefineLabel();
			val.Emit(OpCodes.Bne_Un_S, (object)val3);
			val.Index += 2;
			object operand = il.Instrs[val.Index].Operand;
			ILLabel val4 = (ILLabel)((operand is ILLabel) ? operand : null);
			index = val.Index;
			val.Index = index + 1;
			val.RemoveRange(24);
			val.MarkLabel(val3);
			val.Emit(OpCodes.Ldarg_0);
			val.Emit(OpCodes.Ldarg_0);
			val.Emit<MenuScrollBox>(OpCodes.Ldfld, "parentPage");
			val.EmitDelegate<Action<MenuScrollBox, MenuPage>>((Action<MenuScrollBox, MenuPage>)delegate(MenuScrollBox menuScrollBox, MenuPage menuPage)
			{
				//IL_0087: Unknown result type (might be due to invalid IL or missing references)
				//IL_008c: Unknown result type (might be due to invalid IL or missing references)
				float num3 = SemiFunc.InputMovementY() / 20f;
				float num4 = SemiFunc.InputScrollY();
				float num7;
				if (MenuAPI.customMenuPages.TryGetValue(menuPage, out var value))
				{
					float? scrollSpeed = value.scrollView.scrollSpeed;
					if (scrollSpeed.HasValue)
					{
						float valueOrDefault = scrollSpeed.GetValueOrDefault();
						valueOrDefault *= 10f;
						float num5 = Mathf.Abs((float)REPOReflection.menuScrollBox_ScrollerEndPosition.GetValue(menuScrollBox) - (float)REPOReflection.menuScrollBox_ScrollerStartPosition.GetValue(menuScrollBox));
						float num6 = (num3 + (float)Math.Sign(num4)) * valueOrDefault / num5;
						Rect rect2 = menuScrollBox.scrollBarBackground.rect;
						num7 = num6 * ((Rect)(ref rect2)).height;
						goto IL_00c1;
					}
				}
				float num8 = (float)REPOReflection.menuScrollBox_ScrollHeight.GetValue(menuScrollBox);
				num7 = num3 / (num8 * 0.01f) + num4 / (num8 * 0.01f);
				goto IL_00c1;
				IL_00c1:
				float num9 = (float)REPOReflection.menuScrollBox_ScrollHandleTargetPosition.GetValue(menuScrollBox);
				REPOReflection.menuScrollBox_ScrollHandleTargetPosition.SetValue(menuScrollBox, num9 + num7);
			});
			val.GotoPrev(new Func<Instruction, bool>[1]
			{
				(Instruction instruction) => ILPatternMatchingExt.MatchCall(instruction, typeof(SemiFunc), "InputMovementY")
			});
			ILLabel val5 = val.MarkLabel();
			val.Emit(OpCodes.Ldarg_0);
			val.Emit<MenuScrollBox>(OpCodes.Ldfld, "scrollBoxActive");
			val.Emit(OpCodes.Brfalse_S, (object)val4);
			val.GotoPrev((MoveType)2, new Func<Instruction, bool>[1]
			{
				(Instruction instruction) => ILPatternMatchingExt.MatchCall<Input>(instruction, "GetMouseButton")
			});
			val.Remove();
			val.Emit(OpCodes.Brfalse, (object)val5);
			val.GotoNext((MoveType)2, new Func<Instruction, bool>[1]
			{
				(Instruction instruction) => ILPatternMatchingExt.MatchCall(instruction, typeof(SemiFunc), "UIMouseHover")
			});
			val.Remove();
			val.Emit(OpCodes.Brfalse, (object)val5);
			val.GotoNext(new Func<Instruction, bool>[1]
			{
				(Instruction instruction) => ILPatternMatchingExt.MatchStfld<MenuScrollBox>(instruction, "scrollAmount")
			});
			val.Index -= 13;
			val.RemoveRange(14);
			val.EmitDelegate<Action<MenuScrollBox>>((Action<MenuScrollBox>)delegate(MenuScrollBox instance)
			{
				//IL_0010: Unknown result type (might be due to invalid IL or missing references)
				//IL_001a: Expected O, but got Unknown
				//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_0075: Unknown result type (might be due to invalid IL or missing references)
				//IL_0022: Unknown result type (might be due to invalid IL or missing references)
				//IL_0032: Unknown result type (might be due to invalid IL or missing references)
				//IL_0049: Unknown result type (might be due to invalid IL or missing references)
				//IL_004e: Unknown result type (might be due to invalid IL or missing references)
				Rect rect;
				float num2;
				if (MenuAPI.customMenuPages.ContainsKey((MenuPage)REPOReflection.menuScrollBox_ParentPage.GetValue(instance)))
				{
					float num = ((Transform)instance.scrollHandle).localPosition.y + instance.scrollHandle.sizeDelta.y / 2f;
					rect = instance.scrollBarBackground.rect;
					num2 = num / ((Rect)(ref rect)).height;
				}
				else
				{
					float y = ((Transform)instance.scrollHandle).localPosition.y;
					rect = instance.scrollBarBackground.rect;
					num2 = y / ((Rect)(ref rect)).height * 1.1f;
				}
				REPOReflection.menuScrollBox_ScrollAmount.SetValue(instance, num2);
			});
		}

		private static void ChatManager_StateInactiveILHook(ILContext il)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			val.GotoNext((MoveType)2, new Func<Instruction, bool>[1]
			{
				(Instruction instruction) => ILPatternMatchingExt.MatchStfld<ChatManager>(instruction, "chatActive")
			});
			ILLabel val2 = val.DefineLabel();
			val.Emit<REPOInputStringSystem>(OpCodes.Ldsfld, "hasAnyFocus");
			val.Emit(OpCodes.Brfalse_S, (object)val2);
			val.Emit(OpCodes.Ret);
			val.MarkLabel(val2);
		}

		private void Awake()
		{
			//IL_0040: 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_00cc: 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_0158: Unknown result type (might be due to invalid IL or missing references)
			//IL_019e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0193: Unknown result type (might be due to invalid IL or missing references)
			//IL_0198: Unknown result type (might be due to invalid IL or missing references)
			//IL_019e: Expected O, but got Unknown
			//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01de: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e4: Expected O, but got Unknown
			//IL_022a: Unknown result type (might be due to invalid IL or missing references)
			//IL_021f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0224: Unknown result type (might be due to invalid IL or missing references)
			//IL_022a: Expected O, but got Unknown
			//IL_0270: Unknown result type (might be due to invalid IL or missing references)
			//IL_0265: Unknown result type (might be due to invalid IL or missing references)
			//IL_026a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0270: Expected O, but got Unknown
			logger.LogDebug((object)"Hooking `MenuPageMain.Start`");
			new Hook((MethodBase)AccessTools.Method(typeof(MenuPageMain), "Start", (Type[])null, (Type[])null), (Delegate)new Action<Action<MenuPageMain>, MenuPageMain>(MenuPageMain_StartHook));
			logger.LogDebug((object)"Hooking `MenuPageSettings.Start`");
			new Hook((MethodBase)AccessTools.Method(typeof(MenuPageSettings), "Start", (Type[])null, (Type[])null), (Delegate)new Action<Action<MenuPageSettings>, MenuPageSettings>(MenuPageSettings_StartHook));
			logger.LogDebug((object)"Hooking `MenuPageColor.Start`");
			new Hook((MethodBase)AccessTools.Method(typeof(MenuPageColor), "Start", (Type[])null, (Type[])null), (Delegate)new Action<Action<MenuPageColor>, MenuPageColor>(MenuPageColor_StartHook));
			logger.LogDebug((object)"Hooking `MenuPageEsc.Start`");
			new Hook((MethodBase)AccessTools.Method(typeof(MenuPageEsc), "Start", (Type[])null, (Type[])null), (Delegate)new Action<Action<MenuPageEsc>, MenuPageEsc>(MenuPageEsc_StartHook));
			logger.LogDebug((object)"Hooking `MenuPageLobby.Start`");
			new Hook((MethodBase)AccessTools.Method(typeof(MenuPageLobby), "Start", (Type[])null, (Type[])null), (Delegate)new Action<Action<MenuPageLobby>, MenuPageLobby>(MenuPageLobby_StartHook));
			logger.LogDebug((object)"Hooking `SemiFunc.UIMouseHover`");
			MethodInfo methodInfo = AccessTools.Method(typeof(SemiFunc), "UIMouseHover", (Type[])null, (Type[])null);
			object obj = <>O.<5>__SemiFunc_UIMouseHoverILHook;
			if (obj == null)
			{
				Manipulator val = SemiFunc_UIMouseHoverILHook;
				<>O.<5>__SemiFunc_UIMouseHoverILHook = val;
				obj = (object)val;
			}
			new ILHook((MethodBase)methodInfo, (Manipulator)obj);
			logger.LogDebug((object)"Hooking `MenuPage.StateClosing`");
			MethodInfo methodInfo2 = AccessTools.Method(typeof(MenuPage), "StateClosing", (Type[])null, (Type[])null);
			object obj2 = <>O.<6>__MenuPage_StateClosingILHook;
			if (obj2 == null)
			{
				Manipulator val2 = MenuPage_StateClosingILHook;
				<>O.<6>__MenuPage_StateClosingILHook = val2;
				obj2 = (object)val2;
			}
			new ILHook((MethodBase)methodInfo2, (Manipulator)obj2);
			logger.LogDebug((object)"Hooking `MenuScrollBox.Update`");
			MethodInfo methodInfo3 = AccessTools.Method(typeof(MenuScrollBox), "Update", (Type[])null, (Type[])null);
			object obj3 = <>O.<7>__MenuScrollBox_UpdateILHook;
			if (obj3 == null)
			{
				Manipulator val3 = MenuScrollBox_UpdateILHook;
				<>O.<7>__MenuScrollBox_UpdateILHook = val3;
				obj3 = (object)val3;
			}
			new ILHook((MethodBase)methodInfo3, (Manipulator)obj3);
			logger.LogDebug((object)"Hooking `ChatManager.StateInactive`");
			MethodInfo methodInfo4 = AccessTools.Method(typeof(ChatManager), "StateInactive", (Type[])null, (Type[])null);
			object obj4 = <>O.<8>__ChatManager_StateInactiveILHook;
			if (obj4 == null)
			{
				Manipulator val4 = ChatManager_StateInactiveILHook;
				<>O.<8>__ChatManager_StateInactiveILHook = val4;
				obj4 = (object)val4;
			}
			new ILHook((MethodBase)methodInfo4, (Manipulator)obj4);
		}
	}
	public static class MenuAPI
	{
		public delegate void BuilderDelegate(Transform parent);

		internal static BuilderDelegate mainMenuBuilderDelegate;

		internal static BuilderDelegate settingsMenuBuilderDelegate;

		internal static BuilderDelegate colorMenuBuilderDelegate;

		internal static BuilderDelegate lobbyMenuBuilderDelegate;

		internal static BuilderDelegate escapeMenuBuilderDelegate;

		internal static readonly Dictionary<MenuPage, REPOPopupPage> customMenuPages = new Dictionary<MenuPage, REPOPopupPage>();

		private static MenuButtonPopUp menuButtonPopup;

		public static void AddElementToMainMenu(BuilderDelegate builderDelegate)
		{
			mainMenuBuilderDelegate = (BuilderDelegate)Delegate.Combine(mainMenuBuilderDelegate, builderDelegate);
		}

		public static void AddElementToSettingsMenu(BuilderDelegate builderDelegate)
		{
			settingsMenuBuilderDelegate = (BuilderDelegate)Delegate.Combine(settingsMenuBuilderDelegate, builderDelegate);
		}

		public static void AddElementToColorMenu(BuilderDelegate builderDelegate)
		{
			colorMenuBuilderDelegate = (BuilderDelegate)Delegate.Combine(colorMenuBuilderDelegate, builderDelegate);
		}

		public static void AddElementToLobbyMenu(BuilderDelegate builderDelegate)
		{
			lobbyMenuBuilderDelegate = (BuilderDelegate)Delegate.Combine(lobbyMenuBuilderDelegate, builderDelegate);
		}

		public static void AddElementToEscapeMenu(BuilderDelegate builderDelegate)
		{
			escapeMenuBuilderDelegate = (BuilderDelegate)Delegate.Combine(escapeMenuBuilderDelegate, builderDelegate);
		}

		public static void CloseAllPagesAddedOnTop()
		{
			MenuManager.instance.PageCloseAllAddedOnTop();
		}

		public static void OpenPopup(string header, Color headerColor, string content, Action onLeftClicked, Action onRightClicked = null)
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Expected O, but got Unknown
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Expected O, but got Unknown
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Expected O, but got Unknown
			//IL_0087: 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_007c: Expected O, but got Unknown
			if (!Object.op_Implicit((Object)(object)menuButtonPopup))
			{
				menuButtonPopup = ((Component)MenuManager.instance).gameObject.AddComponent<MenuButtonPopUp>();
			}
			menuButtonPopup.option1Event = new UnityEvent();
			menuButtonPopup.option2Event = new UnityEvent();
			if (onLeftClicked != null)
			{
				menuButtonPopup.option1Event.AddListener(new UnityAction(onLeftClicked.Invoke));
			}
			if (onRightClicked != null)
			{
				menuButtonPopup.option2Event.AddListener(new UnityAction(onRightClicked.Invoke));
			}
			MenuManager.instance.PagePopUpTwoOptions(menuButtonPopup, header, headerColor, content, "Yes", "No");
		}

		public static REPOButton CreateREPOButton(string text, Action onClick, Transform parent, Vector2 localPosition = default(Vector2))
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			RectTransform obj = Object.Instantiate<RectTransform>(REPOTemplates.buttonTemplate, parent);
			((Object)obj).name = "Button - " + text;
			((Transform)obj).localPosition = Vector2.op_Implicit(localPosition);
			REPOButton rEPOButton = ((Component)obj).gameObject.AddComponent<REPOButton>();
			((TMP_Text)rEPOButton.labelTMP).text = text;
			rEPOButton.onClick = onClick;
			return rEPOButton;
		}

		public static REPOToggle CreateREPOToggle(string text, Action<bool> onToggle, Transform parent, Vector2 localPosition = default(Vector2), string leftButtonText = "ON", string rightButtonText = "OFF", bool defaultValue = false)
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			RectTransform obj = Object.Instantiate<RectTransform>(REPOTemplates.toggleTemplate, parent);
			((Object)obj).name = "Toggle - " + text;
			((Transform)obj).localPosition = Vector2.op_Implicit(localPosition);
			REPOToggle rEPOToggle = ((Component)obj).gameObject.AddComponent<REPOToggle>();
			((TMP_Text)rEPOToggle.labelTMP).text = text;
			((TMP_Text)rEPOToggle.leftButtonTMP).text = leftButtonText;
			((TMP_Text)rEPOToggle.rightButtonTMP).text = rightButtonText;
			rEPOToggle.onToggle = onToggle;
			rEPOToggle.SetState(defaultValue, invokeCallback: false);
			return rEPOToggle;
		}

		public static REPOInputField CreateREPOInputField(string labelText, Action<string> onValueChanged, Transform parent, Vector2 localPosition = default(Vector2), bool onlyNotifyOnSubmit = false, string placeholder = "", string defaultValue = "")
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			RectTransform obj = Object.Instantiate<RectTransform>(REPOTemplates.toggleTemplate, parent);
			((Object)obj).name = "Input Field - " + labelText;
			((Transform)obj).localPosition = Vector2.op_Implicit(localPosition);
			REPOInputField rEPOInputField = ((Component)obj).gameObject.AddComponent<REPOInputField>();
			((TMP_Text)rEPOInputField.labelTMP).text = labelText;
			rEPOInputField.inputStringSystem.onValueChanged = onValueChanged;
			rEPOInputField.inputStringSystem.onlyNotifyOnSubmit = onlyNotifyOnSubmit;
			rEPOInputField.inputStringSystem.placeholder = placeholder;
			rEPOInputField.inputStringSystem.SetValue(defaultValue, notify: false);
			return rEPOInputField;
		}

		public static REPOSlider CreateREPOSlider(string text, string description, Action<float> onValueChanged, Transform parent, Vector2 localPosition = default(Vector2), float min = 0f, float max = 1f, int precision = 2, float defaultValue = 0f, string prefix = "", string postfix = "", REPOSlider.BarBehavior barBehavior = REPOSlider.BarBehavior.UpdateWithValue)
		{
			//IL_001d: 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)
			RectTransform obj = Object.Instantiate<RectTransform>(REPOTemplates.sliderTemplate, parent);
			((Object)obj).name = "Float Slider - " + text;
			((Transform)obj).localPosition = Vector2.op_Implicit(localPosition);
			REPOSlider rEPOSlider = ((Component)obj).gameObject.AddComponent<REPOSlider>();
			((TMP_Text)rEPOSlider.labelTMP).text = text;
			((TMP_Text)rEPOSlider.descriptionTMP).text = description;
			rEPOSlider.onValueChanged = onValueChanged;
			rEPOSlider.min = min;
			rEPOSlider.max = max;
			rEPOSlider.precision = precision;
			rEPOSlider.prefix = prefix;
			rEPOSlider.postfix = postfix;
			rEPOSlider.barBehavior = barBehavior;
			rEPOSlider.SetValue(defaultValue, invokeCallback: false);
			return rEPOSlider;
		}

		public static REPOSlider CreateREPOSlider(string text, string description, Action<int> onValueChanged, Transform parent, Vector2 localPosition = default(Vector2), int min = 0, int max = 1, int defaultValue = 0, string prefix = "", string postfix = "", REPOSlider.BarBehavior barBehavior = REPOSlider.BarBehavior.UpdateWithValue)
		{
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			RectTransform obj = Object.Instantiate<RectTransform>(REPOTemplates.sliderTemplate, parent);
			((Object)obj).name = "Int Slider - " + text;
			((Transform)obj).localPosition = Vector2.op_Implicit(localPosition);
			REPOSlider rEPOSlider = ((Component)obj).gameObject.AddComponent<REPOSlider>();
			((TMP_Text)rEPOSlider.labelTMP).text = text;
			((TMP_Text)rEPOSlider.descriptionTMP).text = description;
			rEPOSlider.onValueChanged = delegate(float f)
			{
				onValueChanged(Convert.ToInt32(f));
			};
			rEPOSlider.min = min;
			rEPOSlider.max = max;
			rEPOSlider.precision = 0;
			rEPOSlider.prefix = prefix;
			rEPOSlider.postfix = postfix;
			rEPOSlider.barBehavior = barBehavior;
			rEPOSlider.SetValue(defaultValue, invokeCallback: false);
			return rEPOSlider;
		}

		public static REPOSlider CreateREPOSlider(string text, string description, Action<string> onOptionChanged, Transform parent, string[] stringOptions, string defaultOption, Vector2 localPosition = default(Vector2), string prefix = "", string postfix = "", REPOSlider.BarBehavior barBehavior = REPOSlider.BarBehavior.UpdateWithValue)
		{
			//IL_002b: 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)
			RectTransform val = Object.Instantiate<RectTransform>(REPOTemplates.sliderTemplate, parent);
			((Object)val).name = "Option Slider - " + text;
			((Transform)val).localPosition = Vector2.op_Implicit(localPosition);
			REPOSlider repoSlider = ((Component)val).gameObject.AddComponent<REPOSlider>();
			((TMP_Text)repoSlider.labelTMP).text = text;
			((TMP_Text)repoSlider.descriptionTMP).text = description;
			repoSlider.onValueChanged = delegate(float f)
			{
				onOptionChanged(repoSlider.stringOptions.ElementAtOrDefault(Convert.ToInt32(f)) ?? repoSlider.stringOptions.FirstOrDefault());
			};
			repoSlider.stringOptions = stringOptions;
			repoSlider.prefix = prefix;
			repoSlider.postfix = postfix;
			repoSlider.barBehavior = barBehavior;
			int num = Array.IndexOf(stringOptions, defaultOption);
			if (num == -1)
			{
				num = 0;
			}
			repoSlider.SetValue(num, invokeCallback: false);
			return repoSlider;
		}

		public static REPOSlider CreateREPOSlider(string text, string description, Action<int> onOptionChanged, Transform parent, string[] stringOptions, string defaultOption, Vector2 localPosition = default(Vector2), string prefix = "", string postfix = "", REPOSlider.BarBehavior barBehavior = REPOSlider.BarBehavior.UpdateWithValue)
		{
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			RectTransform obj = Object.Instantiate<RectTransform>(REPOTemplates.sliderTemplate, parent);
			((Object)obj).name = "Option Slider - " + text;
			((Transform)obj).localPosition = Vector2.op_Implicit(localPosition);
			REPOSlider rEPOSlider = ((Component)obj).gameObject.AddComponent<REPOSlider>();
			((TMP_Text)rEPOSlider.labelTMP).text = text;
			((TMP_Text)rEPOSlider.descriptionTMP).text = description;
			rEPOSlider.onValueChanged = delegate(float f)
			{
				onOptionChanged(Convert.ToInt32(f));
			};
			rEPOSlider.stringOptions = stringOptions;
			rEPOSlider.prefix = prefix;
			rEPOSlider.postfix = postfix;
			rEPOSlider.barBehavior = barBehavior;
			int num = Array.IndexOf(stringOptions, defaultOption);
			if (num == -1)
			{
				num = 0;
			}
			rEPOSlider.SetValue(num, invokeCallback: false);
			return rEPOSlider;
		}

		public static REPOLabel CreateREPOLabel(string text, Transform parent, Vector2 localPosition = default(Vector2))
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			RectTransform obj = Object.Instantiate<RectTransform>(REPOTemplates.labelTemplate, parent);
			((Object)obj).name = "Label - " + text;
			((Transform)obj).localPosition = Vector2.op_Implicit(localPosition);
			REPOLabel rEPOLabel = ((Component)obj).gameObject.AddComponent<REPOLabel>();
			((TMP_Text)rEPOLabel.labelTMP).text = text;
			return rEPOLabel;
		}

		public static REPOSpacer CreateREPOSpacer(Transform parent, Vector2 localPosition = default(Vector2), Vector2 size = default(Vector2))
		{
			//IL_0018: 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_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			RectTransform val = (RectTransform)new GameObject("Spacer", new Type[1] { typeof(RectTransform) }).transform;
			((Transform)val).SetParent(parent);
			REPOSpacer result = ((Component)val).gameObject.AddComponent<REPOSpacer>();
			((Transform)val).localPosition = Vector2.op_Implicit(localPosition);
			val.sizeDelta = size;
			return result;
		}

		[Obsolete("Switch to the overload with the 'shouldCachePage' argument!")]
		public static REPOPopupPage CreateREPOPopupPage(string headerText, REPOPopupPage.PresetSide presetSide, bool pageDimmerVisibility = false, float spacing = 0f)
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			return CreateREPOPopupPage(headerText, pageDimmerVisibility, spacing, (presetSide == REPOPopupPage.PresetSide.Left) ? null : new Vector2?(new Vector2(40f, 0f)));
		}

		[Obsolete("Switch to the overload with the 'shouldCachePage' argument!")]
		public static REPOPopupPage CreateREPOPopupPage(string headerText, bool pageDimmerVisibility = false, float spacing = 0f, Vector2? localPosition = null)
		{
			return CreateREPOPopupPage(headerText, shouldCachePage: false, pageDimmerVisibility, spacing, localPosition);
		}

		public static REPOPopupPage CreateREPOPopupPage(string headerText, REPOPopupPage.PresetSide presetSide, bool shouldCachePage, bool pageDimmerVisibility = false, float spacing = 0f)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			return CreateREPOPopupPage(headerText, shouldCachePage, pageDimmerVisibility, spacing, (presetSide == REPOPopupPage.PresetSide.Left) ? null : new Vector2?(new Vector2(40f, 0f)));
		}

		public static REPOPopupPage CreateREPOPopupPage(string headerText, bool shouldCachePage, bool pageDimmerVisibility = false, float spacing = 0f, Vector2? localPosition = null)
		{
			//IL_0054: 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_0059: Unknown result type (might be due to invalid IL or missing references)
			RectTransform obj = Object.Instantiate<RectTransform>(REPOTemplates.popupPageTemplate, ((Component)MenuHolder.instance).transform);
			((Object)obj).name = "Menu Page " + headerText;
			REPOPopupPage rEPOPopupPage = ((Component)obj).gameObject.AddComponent<REPOPopupPage>();
			((Transform)rEPOPopupPage.rectTransform).localPosition = Vector2.op_Implicit((Vector2)(((??)localPosition) ?? new Vector2(-280f, 0f)));
			((TMP_Text)rEPOPopupPage.headerTMP).text = headerText;
			rEPOPopupPage.isCachedPage = shouldCachePage;
			rEPOPopupPage.pageDimmerVisibility = pageDimmerVisibility;
			rEPOPopupPage.scrollView.spacing = spacing;
			return rEPOPopupPage;
		}

		public static REPOAvatarPreview CreateREPOAvatarPreview(Transform parent, Vector2 localPosition = default(Vector2), bool enableBackgroundImage = false, Color? backgroundImageColor = null)
		{
			//IL_0026: 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)
			//IL_004d: 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_0062: Unknown result type (might be due to invalid IL or missing references)
			Transform obj = Object.Instantiate<Transform>(REPOTemplates.avatarPreviewTemplate, parent);
			((Object)obj).name = "Player Avatar Preview";
			REPOAvatarPreview rEPOAvatarPreview = ((Component)obj).gameObject.AddComponent<REPOAvatarPreview>();
			((Transform)rEPOAvatarPreview.rectTransform).localPosition = Vector2.op_Implicit(localPosition);
			rEPOAvatarPreview.enableBackgroundImage = enableBackgroundImage;
			rEPOAvatarPreview.backgroundImageColor = (Color)(((??)backgroundImageColor) ?? Color.white);
			rEPOAvatarPreview.previewSize = new Vector2(184f, 345f);
			return rEPOAvatarPreview;
		}

		public static REPOObjectPreview CreateREPOObjectPreview(Transform parent, GameObject previewObject, Vector2 localPosition = default(Vector2), bool enableBackgroundImage = false, Color? backgroundImageColor = null)
		{
			//IL_0026: 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)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			Transform obj = Object.Instantiate<Transform>(REPOTemplates.avatarPreviewTemplate, parent);
			((Object)obj).name = "Object Preview";
			REPOObjectPreview rEPOObjectPreview = ((Component)obj).gameObject.AddComponent<REPOObjectPreview>();
			((Transform)rEPOObjectPreview.rectTransform).localPosition = Vector2.op_Implicit(localPosition);
			rEPOObjectPreview.enableBackgroundImage = enableBackgroundImage;
			rEPOObjectPreview.backgroundImageColor = (Color)(((??)backgroundImageColor) ?? Color.white);
			rEPOObjectPreview.previewObject = previewObject;
			rEPOObjectPreview.previewSize = new Vector2(184f, 345f);
			return rEPOObjectPreview;
		}

		internal static void OpenMenuPage(MenuPage menuPage, bool pageOnTop)
		{
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			object? value = REPOReflection.menuManager_CurrentMenuPage.GetValue(MenuManager.instance);
			MenuPage val = (MenuPage)((value is MenuPage) ? value : null);
			List<MenuPage> list = REPOReflection.menuManager_AddedPagesOnTop.GetValue(MenuManager.instance) as List<MenuPage>;
			if (pageOnTop && !Object.op_Implicit((Object)(object)val))
			{
				pageOnTop = false;
			}
			if (pageOnTop)
			{
				if (list == null || list.Contains(val))
				{
					return;
				}
			}
			else if (Object.op_Implicit((Object)(object)val))
			{
				REPOReflection.menuManager_PageInactiveAdd.Invoke(MenuManager.instance, new object[1] { val });
				val.PageStateSet((PageState)3);
			}
			((Component)menuPage).transform.SetAsLastSibling();
			((Behaviour)menuPage).enabled = true;
			menuPage.ResetPage();
			menuPage.PageStateSet((PageState)0);
			MenuManager.instance.PageAdd(menuPage);
			((MonoBehaviour)menuPage).StartCoroutine(REPOReflection.menuPage_LateStart.Invoke(menuPage, null) as IEnumerator);
			REPOReflection.menuPage_AddedPageOnTop.SetValue(menuPage, false);
			if (!pageOnTop)
			{
				MenuManager.instance.PageSetCurrent(menuPage.menuPageIndex, menuPage);
				REPOReflection.menuPage_PageIsOnTopOfOtherPage.SetValue(menuPage, true);
				REPOReflection.menuPage_PageUnderThisPage.SetValue(menuPage, val);
			}
			else
			{
				REPOReflection.menuPage_ParentPage.SetValue(menuPage, val);
				list.Add(menuPage);
			}
		}

		internal static void CloseMenuPage(MenuPage menuPage, bool closePagesAddedOnTop)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			if (closePagesAddedOnTop)
			{
				CloseAllPagesAddedOnTop();
			}
			menuPage.PageStateSet((PageState)2);
			object? value = REPOReflection.menuPage_PageUnderThisPage.GetValue(menuPage);
			MenuPage val = (MenuPage)((value is MenuPage) ? value : null);
			if (val != null)
			{
				MenuManager.instance.PageSetCurrent(val.menuPageIndex, val);
			}
		}
	}
	public static class REPOReflection
	{
		public static readonly FieldInfo menuManager_CurrentMenuPage = AccessTools.Field(typeof(MenuManager), "currentMenuPage");

		public static readonly FieldInfo menuManager_AddedPagesOnTop = AccessTools.Field(typeof(MenuManager), "addedPagesOnTop");

		public static readonly FieldInfo menuPage_AddedPageOnTop = AccessTools.Field(typeof(MenuPage), "addedPageOnTop");

		public static readonly FieldInfo menuPage_PageUnderThisPage = AccessTools.Field(typeof(MenuPage), "pageUnderThisPage");

		public static readonly FieldInfo menuPage_ParentPage = AccessTools.Field(typeof(MenuPage), "parentPage");

		public static readonly FieldInfo menuPage_PageIsOnTopOfOtherPage = AccessTools.Field(typeof(MenuPage), "pageIsOnTopOfOtherPage");

		public static readonly FieldInfo menuPage_ScrollBoxes = AccessTools.Field(typeof(MenuPage), "scrollBoxes");

		public static readonly FieldInfo menuPage_CurrentPageState = AccessTools.Field(typeof(MenuPage), "currentPageState");

		public static readonly FieldInfo menuPage_AnimateAwayPosition = AccessTools.Field(typeof(MenuPage), "animateAwayPosition");

		public static readonly FieldInfo menuButton_ParentPage = AccessTools.Field(typeof(MenuButton), "parentPage");

		public static readonly FieldInfo menuScrollBox_ScrollerEndPosition = AccessTools.Field(typeof(MenuScrollBox), "scrollerEndPosition");

		public static readonly FieldInfo menuScrollBox_ScrollerStartPosition = AccessTools.Field(typeof(MenuScrollBox), "scrollerStartPosition");

		public static readonly FieldInfo menuScrollBox_ScrollHandleTargetPosition = AccessTools.Field(typeof(MenuScrollBox), "scrollHandleTargetPosition");

		public static readonly FieldInfo menuScrollBox_ScrollHeight = AccessTools.Field(typeof(MenuScrollBox), "scrollHeight");

		public static readonly FieldInfo menuScrollBox_ScrollAmount = AccessTools.Field(typeof(MenuScrollBox), "scrollAmount");

		public static readonly FieldInfo menuScrollBox_ParentPage = AccessTools.Field(typeof(MenuScrollBox), "parentPage");

		public static readonly FieldInfo menuSelectableElement_MenuID = AccessTools.Field(typeof(MenuSelectableElement), "menuID");

		public static readonly MethodInfo menuManager_PageInactiveAdd = AccessTools.Method(typeof(MenuManager), "PageInactiveAdd", (Type[])null, (Type[])null);

		public static readonly MethodInfo menuPage_LateStart = AccessTools.Method(typeof(MenuPage), "LateStart", (Type[])null, (Type[])null);
	}
	internal static class REPOTemplates
	{
		internal static readonly RectTransform pageDimmerTemplate;

		internal static readonly RectTransform simplePageTemplate;

		internal static readonly RectTransform buttonTemplate;

		internal static readonly RectTransform popupPageTemplate;

		internal static readonly RectTransform toggleTemplate;

		internal static readonly RectTransform sliderTemplate;

		internal static readonly RectTransform labelTemplate;

		internal static readonly Transform avatarPreviewTemplate;

		static REPOTemplates()
		{
			//IL_003b: 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_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Expected I4, but got Unknown
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Expected O, but got Unknown
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Expected O, but got Unknown
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Expected O, but got Unknown
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Expected O, but got Unknown
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Expected O, but got Unknown
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Expected O, but got Unknown
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Expected O, but got Unknown
			MenuManager instance = MenuManager.instance;
			if (!Object.op_Implicit((Object)(object)instance))
			{
				throw new NullReferenceException("Error fetching templates... Ensure you're not creating UI elements too early, use \"MenuAPI.AddElementTo...\"");
			}
			foreach (MenuPages menuPage in instance.menuPages)
			{
				Transform transform = menuPage.menuPage.transform;
				MenuPageIndex menuPageIndex = menuPage.menuPageIndex;
				switch ((int)menuPageIndex)
				{
				case 0:
					simplePageTemplate = (RectTransform)transform;
					buttonTemplate = (RectTransform)((Transform)simplePageTemplate).Find("Menu Button - Quit game");
					break;
				case 2:
					pageDimmerTemplate = (RectTransform)transform.GetChild(0);
					break;
				case 4:
					popupPageTemplate = (RectTransform)transform;
					break;
				case 5:
				{
					Transform obj = transform.Find("Menu Scroll Box/Mask/Scroller");
					toggleTemplate = (RectTransform)obj.Find("Bool Setting - Push to Talk");
					sliderTemplate = (RectTransform)obj.Find("Slider - microphone");
					break;
				}
				case 6:
					labelTemplate = (RectTransform)transform.Find("Scroll Box/Mask/Scroller").Find("Header Movement");
					break;
				case 1:
					avatarPreviewTemplate = transform.Find("Menu Element Player Avatar");
					break;
				}
			}
		}
	}
}
namespace MenuLib.Structs
{
	public struct Padding
	{
		public float left;

		public float top;

		public float right;

		public float bottom;

		public Padding(float left, float top, float right, float bottom)
		{
			this.left = left;
			this.top = top;
			this.right = right;
			this.bottom = bottom;
		}
	}
}
namespace MenuLib.MonoBehaviors
{
	public sealed class REPOAvatarPreview : REPOElement
	{
		private PlayerAvatarMenu playerAvatarMenu;

		private Image backgroundImage;

		private RectTransform renderTextureRectTransform;

		public bool enableBackgroundImage
		{
			get
			{
				return ((Behaviour)backgroundImage).enabled;
			}
			set
			{
				((Behaviour)backgroundImage).enabled = value;
			}
		}

		public Color backgroundImageColor
		{
			get
			{
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				return ((Graphic)backgroundImage).color;
			}
			set
			{
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				((Graphic)backgroundImage).color = value;
			}
		}

		public Vector2 previewSize
		{
			get
			{
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				return base.rectTransform.sizeDelta;
			}
			set
			{
				//IL_0000: 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_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_002c: 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_003e: 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_000f: 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_0024: 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_004d: Unknown result type (might be due to invalid IL or missing references)
				//IL_004e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0054: 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)
				Vector2 val;
				if (value.x > value.y)
				{
					val = value;
					val.y = value.x / (8f / 15f);
					value = val;
				}
				else
				{
					val = value;
					val.x = value.y * (8f / 15f);
					value = val;
				}
				RectTransform obj = renderTextureRectTransform;
				val = (base.rectTransform.sizeDelta = value);
				obj.sizeDelta = val;
				((Transform)renderTextureRectTransform).localPosition = Vector3.zero;
			}
		}

		public PlayerAvatarVisuals playerAvatarVisuals { get; private set; }

		public Transform rigTransform => playerAvatarVisuals.meshParent.transform;

		private void Awake()
		{
			//IL_0017: 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_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: 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_0056: Expected O, but got Unknown
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			base.rectTransform = ((Component)this).gameObject.AddComponent<RectTransform>();
			base.rectTransform.pivot = Vector2.right;
			RectTransform obj = base.rectTransform;
			Vector2 anchorMin = (base.rectTransform.anchorMax = Vector2.zero);
			obj.anchorMin = anchorMin;
			renderTextureRectTransform = (RectTransform)((Transform)base.rectTransform).GetChild(1);
			((Transform)renderTextureRectTransform).localPosition = Vector3.zero;
			playerAvatarMenu = ((Component)this).GetComponentInChildren<PlayerAvatarMenuHover>().playerAvatarMenu;
			playerAvatarVisuals = ((Component)playerAvatarMenu).GetComponentInChildren<PlayerAvatarVisuals>();
			backgroundImage = ((Component)this).gameObject.AddComponent<Image>();
			((Behaviour)backgroundImage).enabled = false;
		}

		private void OnDestroy()
		{
			if (Object.op_Implicit((Object)(object)playerAvatarMenu))
			{
				if (Object.op_Implicit((Object)(object)playerAvatarMenu.cameraAndStuff))
				{
					Object.Destroy((Object)(object)((Component)playerAvatarMenu.cameraAndStuff).gameObject);
				}
				Object.Destroy((Object)(object)((Component)playerAvatarMenu).gameObject);
			}
		}
	}
	public sealed class REPOButton : REPOElement
	{
		public MenuButton menuButton;

		public TextMeshProUGUI labelTMP;

		[Obsolete("Update the button clicked event using the 'onClick' field rather than through the button")]
		public Button button;

		public Action onClick;

		public Vector2? overrideButtonSize;

		private string previousText;

		private Vector2? previousOverrideButtonSize;

		public Vector2 GetLabelSize()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			return ((TMP_Text)labelTMP).GetPreferredValues();
		}

		private void Awake()
		{
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Expected O, but got Unknown
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Expected O, but got Unknown
			Transform transform = ((Component)this).transform;
			base.rectTransform = (RectTransform)(object)((transform is RectTransform) ? transform : null);
			button = ((Component)this).GetComponent<Button>();
			menuButton = ((Component)this).GetComponent<MenuButton>();
			labelTMP = ((Component)this).GetComponentInChildren<TextMeshProUGUI>();
			button.onClick = new ButtonClickedEvent();
			((UnityEvent)button.onClick).AddListener((UnityAction)delegate
			{
				onClick?.Invoke();
			});
			Object.Destroy((Object)(object)((Component)this).GetComponent<MenuButtonPopUp>());
		}

		private void Update()
		{
			//IL_007b: 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_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			if (((TMP_Text)labelTMP).text == previousText)
			{
				Vector2? val = overrideButtonSize;
				Vector2? val2 = previousOverrideButtonSize;
				if (val.HasValue == val2.HasValue && (!val.HasValue || val.GetValueOrDefault() == val2.GetValueOrDefault()))
				{
					return;
				}
			}
			base.rectTransform.sizeDelta = (Vector2)(((??)overrideButtonSize) ?? GetLabelSize());
			previousText = ((TMP_Text)labelTMP).text;
			previousOverrideButtonSize = overrideButtonSize;
		}

		private void OnTransformParentChanged()
		{
			REPOReflection.menuButton_ParentPage.SetValue(menuButton, ((Component)this).GetComponentInParent<MenuPage>());
		}
	}
	public class REPOElement : MonoBehaviour
	{
		private REPOScrollViewElement _repoScrollViewElement;

		public RectTransform rectTransform { get; protected set; }

		public REPOScrollViewElement repoScrollViewElement
		{
			get
			{
				if (Object.op_Implicit((Object)(object)_repoScrollViewElement))
				{
					return _repoScrollViewElement;
				}
				return _repoScrollViewElement = ((Component)this).GetComponent<REPOScrollViewElement>();
			}
		}
	}
	public sealed class REPOInputField : REPOElement
	{
		public TextMeshProUGUI labelTMP;

		public REPOInputStringSystem inputStringSystem;

		private RectTransform inputAreaRectTransform;

		private MenuPage menuPage;

		private MenuSelectableElement menuSelectableElement;

		public Vector2 GetLabelSize()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			return ((TMP_Text)labelTMP).GetPreferredValues();
		}

		private void Awake()
		{
			//IL_0041: 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)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//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_0080: 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_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_019e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_0200: Unknown result type (might be due to invalid IL or missing references)
			//IL_0205: Unknown result type (might be due to invalid IL or missing references)
			//IL_0230: Unknown result type (might be due to invalid IL or missing references)
			//IL_0240: Unknown result type (might be due to invalid IL or missing references)
			//IL_025f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0264: Unknown result type (might be due to invalid IL or missing references)
			//IL_0265: Unknown result type (might be due to invalid IL or missing references)
			//IL_029d: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02af: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b1: Unknown result type (might be due to invalid IL or missing references)
			Transform transform = ((Component)this).transform;
			base.rectTransform = (RectTransform)(object)((transform is RectTransform) ? transform : null);
			menuPage = ((Component)this).GetComponentInParent<MenuPage>();
			menuSelectableElement = ((Component)this).GetComponent<MenuSelectableElement>();
			labelTMP = ((Component)this).GetComponentInChildren<TextMeshProUGUI>();
			RectTransform obj = ((TMP_Text)labelTMP).rectTransform;
			obj.sizeDelta -= new Vector2(0f, 10f);
			Vector3 val = Vector3.right * 100f;
			Transform obj2 = ((Component)this).transform.Find("SliderBG");
			obj2.localPosition += val;
			Transform obj3 = ((Component)this).transform.Find("RawImage");
			obj3.localPosition += val;
			Transform obj4 = ((Component)this).transform.Find("RawImage (1)");
			obj4.localPosition += val;
			RectTransform obj5 = ((TMP_Text)labelTMP).rectTransform;
			((Transform)obj5).localPosition = ((Transform)obj5).localPosition + val;
			TextMeshProUGUI val2 = null;
			for (int i = 0; i < ((Component)this).transform.childCount; i++)
			{
				Transform child = ((Component)this).transform.GetChild(i);
				switch (((Object)child).name)
				{
				case "Option Box":
				case "Option Box Behind":
				case "RawImage (2)":
					Object.Destroy((Object)(object)((Component)child).gameObject);
					break;
				case "Button BUTTON":
					if (!Object.op_Implicit((Object)(object)val2))
					{
						val2 = ((Component)((Component)child).GetComponent<MenuButton>()).GetComponentInChildren<TextMeshProUGUI>();
						((TMP_Text)val2).transform.SetParent(child.parent);
					}
					Object.Destroy((Object)(object)((Component)child).gameObject);
					break;
				}
			}
			((TMP_Text)val2).rectTransform.pivot = Vector2.zero;
			((TMP_Text)val2).enableAutoSizing = false;
			((TMP_Text)val2).alignment = (TextAlignmentOptions)513;
			((TMP_Text)val2).margin = new Vector4(2f, 2f, 0f, 0f);
			TextMeshProUGUI obj6 = val2;
			TextMeshProUGUI obj7 = val2;
			float num2 = (((TMP_Text)val2).fontSize = 18f);
			float fontSizeMax = (((TMP_Text)obj7).fontSizeMin = num2);
			((TMP_Text)obj6).fontSizeMax = fontSizeMax;
			GameObject val3 = new GameObject("Input Area");
			val3.transform.parent = ((Component)this).transform;
			inputAreaRectTransform = val3.AddComponent<RectTransform>();
			inputAreaRectTransform.sizeDelta = new Vector2(146.5f, 20f);
			inputAreaRectTransform.pivot = Vector2.zero;
			((Transform)inputAreaRectTransform).localPosition = new Vector3(2f, 2.5f, 0f) + val;
			((Component)inputAreaRectTransform).gameObject.AddComponent<RectMask2D>();
			((TMP_Text)val2).transform.SetParent((Transform)(object)inputAreaRectTransform);
			Transform transform2 = ((TMP_Text)val2).transform;
			Vector2 val5 = (((TMP_Text)val2).rectTransform.sizeDelta = Vector2.op_Implicit(Vector3.zero));
			transform2.localPosition = Vector2.op_Implicit(val5);
			Object.Destroy((Object)(object)((Component)this).GetComponent<MenuSettingElement>());
			Object.Destroy((Object)(object)((Component)this).GetComponent<AudioButtonPushToTalk>());
			inputStringSystem = ((Component)this).gameObject.AddComponent<REPOInputStringSystem>();
			inputStringSystem.inputTMP = (TMP_Text)(object)val2;
			inputStringSystem.maskRectTransform = inputAreaRectTransform;
		}

		private void Update()
		{
			inputStringSystem.SetHovering(SemiFunc.UIMouseHover(menuPage, inputAreaRectTransform, (string)REPOReflection.menuSelectableElement_MenuID.GetValue(menuSelectableElement), 2f, 2f));
			if (Mouse.current.leftButton.wasPressedThisFrame)
			{
				inputStringSystem.isFocused = inputStringSystem.isHovering;
			}
		}
	}
	public sealed class REPOInputStringSystem : MonoBehaviour
	{
		public struct Colors
		{
			public Color focusedColor;

			public Color hoverColor;

			public Color unfocusedColor;

			public Color placeholderColor;

			public Color characterAddedColor;

			public Color characterRemovedColor;

			public Colors()
			{
				//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_000c: 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_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_0040: Unknown result type (might be due to invalid IL or missing references)
				//IL_0045: Unknown result type (might be due to invalid IL or missing references)
				//IL_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_0074: Unknown result type (might be due to invalid IL or missing references)
				//IL_0079: Unknown result type (might be due to invalid IL or missing references)
				focusedColor = Color.white;
				hoverColor = Color.white;
				unfocusedColor = new Color(0.5f, 0.5f, 0.5f);
				placeholderColor = new Color(1f, 0.6f, 0.4f);
				characterAddedColor = new Color(0.5f, 1f, 0.5f);
				characterRemovedColor = new Color(1f, 0.5f, 0.5f);
			}
		}

		public static bool hasAnyFocus;

		public TMP_Text inputTMP;

		public RectTransform maskRectTransform;

		public Action<string> onValueChanged;

		public Colors colors = new Colors();

		public string placeholder = string.Empty;

		public bool onlyNotifyOnSubmit;

		public bool disableMovement = true;

		private string previousValue;

		private float timeSinceCharacterAdded = 1f;

		private float timeSinceCharacterRemoved = 1f;

		private bool pressedSubmit;

		private bool _isFocused;

		public string currentValue { get; private set; }

		public bool isHovering { get; private set; }

		public bool isFocused
		{
			get
			{
				return _isFocused;
			}
			set
			{
				//IL_004f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0060: Unknown result type (might be due to invalid IL or missing references)
				//IL_0065: Unknown result type (might be due to invalid IL or missing references)
				if (!value)
				{
					if (_isFocused)
					{
						MoveTMP(reset: true);
					}
				}
				else if (!isFocused)
				{
					if (IsTMPInMask())
					{
						MoveTMP(reset: true);
					}
					else
					{
						float num = 0f - inputTMP.GetPreferredValues(currentValue + "<b>|</b>").x;
						Rect rect = maskRectTransform.rect;
						MoveTMP(reset: true, num + ((Rect)(ref rect)).width - 6f);
					}
					((SemiUI)ChatUI.instance).Hide();
				}
				hasAnyFocus = (_isFocused = value);
			}
		}

		private bool shouldUsePlaceholder => string.IsNullOrEmpty(currentValue);

		public void SetValue(string value, bool notify)
		{
			string text2 = (currentValue = value);
			previousValue = text2;
			if (notify)
			{
				onValueChanged?.Invoke(value);
			}
		}

		public void SetHovering(bool value)
		{
			if (value && !isHovering)
			{
				MenuManager.instance.MenuEffectHover(SemiFunc.MenuGetPitchFromYPos(inputTMP.rectTransform), -1f);
			}
			isHovering = value;
		}

		private void Update()
		{
			if (!Object.op_Implicit((Object)(object)inputTMP))
			{
				return;
			}
			if (disableMovement && isFocused)
			{
				InputManager instance = InputManager.instance;
				if (instance != null)
				{
					instance.DisableMovement();
				}
			}
			HandleInput();
			UpdateColors();
			if (pressedSubmit)
			{
				isFocused = false;
				pressedSubmit = false;
				if (onlyNotifyOnSubmit)
				{
					onValueChanged?.Invoke(currentValue);
				}
			}
			if (!onlyNotifyOnSubmit && previousValue != currentValue)
			{
				onValueChanged?.Invoke(currentValue);
			}
			if (isFocused)
			{
				inputTMP.text = currentValue;
				if (timeSinceCharacterAdded < 0.5f || timeSinceCharacterRemoved < 0.5f || Mathf.Sin(Time.time * 10f) > 0f)
				{
					TMP_Text obj = inputTMP;
					obj.text += "<b>|</b>";
				}
			}
			else
			{
				inputTMP.text = (shouldUsePlaceholder ? placeholder : currentValue);
			}
			previousValue = currentValue;
		}

		private void OnDestroy()
		{
			hasAnyFocus = false;
		}

		private void HandleInput()
		{
			//IL_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_013c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0141: Unknown result type (might be due to invalid IL or missing references)
			if (timeSinceCharacterAdded < 1f)
			{
				timeSinceCharacterAdded += Time.deltaTime;
			}
			if (timeSinceCharacterRemoved < 1f)
			{
				timeSinceCharacterRemoved += Time.deltaTime;
			}
			if (!isFocused)
			{
				return;
			}
			string previousText = currentValue;
			if (Keyboard.current.ctrlKey.isPressed)
			{
				if (((ButtonControl)Keyboard.current.cKey).wasPressedThisFrame)
				{
					GUIUtility.systemCopyBuffer = currentValue;
				}
				else if (((ButtonControl)Keyboard.current.xKey).wasPressedThisFrame)
				{
					GUIUtility.systemCopyBuffer = currentValue;
					currentValue = null;
					timeSinceCharacterRemoved = 0f;
					MoveTMP(reset: true);
				}
				else if (((ButtonControl)Keyboard.current.vKey).wasPressedThisFrame)
				{
					currentValue += GUIUtility.systemCopyBuffer.Replace("\n", string.Empty);
					timeSinceCharacterAdded = 0f;
					if (IsTMPInMask())
					{
						MoveTMP(reset: true);
						return;
					}
					float num = 0f - inputTMP.GetPreferredValues(currentValue + "<b>|</b>").x;
					Rect rect = maskRectTransform.rect;
					MoveTMP(reset: true, num + ((Rect)(ref rect)).width - 6f);
				}
				return;
			}
			string inputString = Input.inputString;
			if (!(inputString == "\b"))
			{
				if (inputString == "\r")
				{
					pressedSubmit = true;
				}
				else if (!string.IsNullOrEmpty(inputString))
				{
					currentValue += inputString;
					timeSinceCharacterAdded = 0f;
					if (IsTMPInMask())
					{
						MoveTMP(reset: true);
					}
					else
					{
						MoveTMP(reset: false, 0f - CalculateTMPDifference(previousText, currentValue));
					}
				}
			}
			else if (currentValue.Length > 0)
			{
				currentValue = currentValue.Remove(currentValue.Length - 1, 1);
				timeSinceCharacterRemoved = 0f;
				if (IsTMPInMask())
				{
					MoveTMP(reset: true);
				}
				else
				{
					MoveTMP(reset: false, 0f - CalculateTMPDifference(previousText, currentValue));
				}
			}
		}

		private void UpdateColors()
		{
			//IL_0019: 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_005c: 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_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			if (timeSinceCharacterAdded < 0.1f)
			{
				((Graphic)inputTMP).color = colors.characterAddedColor;
			}
			else if (timeSinceCharacterRemoved < 0.1f)
			{
				((Graphic)inputTMP).color = colors.characterRemovedColor;
			}
			else if (isHovering)
			{
				((Graphic)inputTMP).color = colors.hoverColor;
			}
			else if (isFocused)
			{
				((Graphic)inputTMP).color = colors.focusedColor;
			}
			else
			{
				((Graphic)inputTMP).color = (shouldUsePlaceholder ? colors.placeholderColor : colors.unfocusedColor);
			}
		}

		private void MoveTMP(bool reset, float moveBy = 0f)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			if (reset)
			{
				inputTMP.transform.localPosition = Vector3.zero;
			}
			if (moveBy != 0f)
			{
				Transform transform = inputTMP.transform;
				transform.localPosition += Vector3.right * moveBy;
			}
		}

		private float CalculateTMPDifference(string previousText, string newText)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			return inputTMP.GetPreferredValues(newText).x - inputTMP.GetPreferredValues(previousText).x;
		}

		private bool IsTMPInMask()
		{
			//IL_000c: 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_0021: Unknown result type (might be due to invalid IL or missing references)
			float x = inputTMP.GetPreferredValues(currentValue).x;
			Rect rect = maskRectTransform.rect;
			return x < ((Rect)(ref rect)).width - 6f;
		}
	}
	public sealed class REPOLabel : REPOElement
	{
		public TextMeshProUGUI labelTMP;

		private void Awake()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: 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_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			base.rectTransform = (RectTransform)((Component)this).transform;
			labelTMP = ((Component)this).GetComponentInChildren<TextMeshProUGUI>();
			Vector2 sizeDelta = (((TMP_Text)labelTMP).rectTransform.pivot = (base.rectTransform.pivot = Vector2.zero));
			RectTransform obj = ((TMP_Text)labelTMP).rectTransform;
			RectTransform obj2 = base.rectTransform;
			((Vector2)(ref sizeDelta))..ctor(200f, 30f);
			obj2.sizeDelta = sizeDelta;
			obj.sizeDelta = sizeDelta;
			((TMP_Text)labelTMP).fontSize = 30f;
			TextMeshProUGUI obj3 = labelTMP;
			bool enableWordWrapping = (((TMP_Text)labelTMP).enableAutoSizing = false);
			((TMP_Text)obj3).enableWordWrapping = enableWordWrapping;
			((TMP_Text)labelTMP).alignment = (TextAlignmentOptions)513;
			((TMP_Text)labelTMP).margin = Vector4.zero;
		}

		private void Start()
		{
			//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)
			((Transform)((TMP_Text)labelTMP).rectTransform).localPosition = Vector2.op_Implicit(Vector2.zero);
		}
	}
	public sealed class REPOObjectPreview : REPOElement
	{
		private PlayerAvatarMenuHover playerAvatarMenuHover;

		private Image backgroundImage;

		private RectTransform renderTextureRectTransform;

		private GameObject _previewObject;

		public GameObject previewObject
		{
			get
			{
				return _previewObject;
			}
			set
			{
				if (!((Object)(object)_previewObject == (Object)(object)value))
				{
					UpdatePreviewGameObject(value);
					_previewObject = value;
				}
			}
		}

		public bool enableBackgroundImage
		{
			get
			{
				return ((Behaviour)backgroundImage).enabled;
			}
			set
			{
				((Behaviour)backgroundImage).enabled = value;
			}
		}

		public Color backgroundImageColor
		{
			get
			{
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				return ((Graphic)backgroundImage).color;
			}
			set
			{
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				((Graphic)backgroundImage).color = value;
			}
		}

		public Vector2 previewSize
		{
			get
			{
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				return base.rectTransform.sizeDelta;
			}
			set
			{
				//IL_0000: 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_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_002c: 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_003e: 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_000f: 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_0024: 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_004d: Unknown result type (might be due to invalid IL or missing references)
				//IL_004e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0054: 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)
				Vector2 val;
				if (value.x > value.y)
				{
					val = value;
					val.y = value.x / (8f / 15f);
					value = val;
				}
				else
				{
					val = value;
					val.x = value.y * (8f / 15f);
					value = val;
				}
				RectTransform obj = renderTextureRectTransform;
				val = (base.rectTransform.sizeDelta = value);
				obj.sizeDelta = val;
				((Transform)renderTextureRectTransform).localPosition = Vector3.zero;
			}
		}

		private void Awake()
		{
			//IL_0017: 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_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: 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_0056: Expected O, but got Unknown
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			base.rectTransform = ((Component)this).gameObject.AddComponent<RectTransform>();
			base.rectTransform.pivot = Vector2.right;
			RectTransform obj = base.rectTransform;
			Vector2 anchorMin = (base.rectTransform.anchorMax = Vector2.zero);
			obj.anchorMin = anchorMin;
			renderTextureRectTransform = (RectTransform)((Transform)base.rectTransform).GetChild(1);
			((Transform)renderTextureRectTransform).localPosition = Vector3.zero;
			playerAvatarMenuHover = ((Component)this).GetComponentInChildren<PlayerAvatarMenuHover>();
			((Component)playerAvatarMenuHover.playerAvatarMenu.cameraAndStuff).GetComponentInChildren<Camera>().farClipPlane = 100f;
			backgroundImage = ((Component)this).gameObject.AddComponent<Image>();
			((Behaviour)backgroundImage).enabled = false;
		}

		private void Start()
		{
			Transform transform = ((Component)playerAvatarMenuHover.playerAvatarMenu).transform;
			for (int i = 0; i < 3; i++)
			{
				Object.Destroy((Object)(object)((Component)transform.GetChild(i)).gameObject);
			}
		}

		private void OnDestroy()
		{
			if (!Object.op_Implicit((Object)(object)playerAvatarMenuHover) || !Object.op_Implicit((Object)(object)playerAvatarMenuHover.playerAvatarMenu))
			{
				return;
			}
			PlayerAvatarMenu playerAvatarMenu = playerAvatarMenuHover.playerAvatarMenu;
			if (Object.op_Implicit((Object)(object)playerAvatarMenu))
			{
				Transform cameraAndStuff = playerAvatarMenu.cameraAndStuff;
				if (Object.op_Implicit((Object)(object)cameraAndStuff))
				{
					Object.Destroy((Object)(object)((Component)cameraAndStuff).gameObject);
				}
				Object.Destroy((Object)(object)((Component)playerAvatarMenu).gameObject);
			}
		}

		private void UpdatePreviewGameObject(GameObject previewGameObject)
		{
			if (Object.op_Implicit((Object)(object)previewObject))
			{
				Object.Destroy((Object)(object)previewObject);
			}
			previewGameObject.transform.SetParent(((Component)playerAvatarMenuHover.playerAvatarMenu).transform, false);
			Rigidbody component = previewGameObject.GetComponent<Rigidbody>();
			if (component != null)
			{
				component.automaticInertiaTensor = false;
			}
		}
	}
	public sealed class REPOPopupPage : MonoBehaviour
	{
		public enum PresetSide
		{
			Left,
			Right
		}

		public delegate RectTransform ScrollViewBuilderDelegate(Transform scrollView);

		public delegate bool ShouldCloseMenuDelegate();

		public RectTransform rectTransform;

		public RectTransform maskRectTransform;

		public RectTransform scrollBarRectTransform;

		public MenuPage menuPage;

		public TextMeshProUGUI headerTMP;

		public MenuScrollBox menuScrollBox;

		public REPOScrollView scrollView;

		[Obsolete("Use onEscapePressed instead.")]
		public bool closeMenuOnEscape = true;

		public ShouldCloseMenuDelegate onEscapePressed;

		internal bool pageWasActivatedOnce;

		private GameObject pageDimmerGameObject;

		private RawImage pageDimmerRawImage;

		private RectTransform scrollBarFillRectTransform;

		private RectTransform scrollBarOutlineRectTransform;

		private Vector2 defaultMaskSizeDelta;

		private Vector2 defaultMaskPosition;

		private Padding _maskPadding;

		public bool pageDimmerVisibility
		{
			get
			{
				return pageDimmerGameObject.gameObject.activeSelf;
			}
			set
			{
				pageDimmerGameObject.gameObject.SetActive(value);
			}
		}

		public bool isCachedPage { get; internal set; }

		public float pageDimmerOpacity
		{
			get
			{
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				return ((Graphic)pageDimmerRawImage).color.a;
			}
			set
			{
				//IL_000c: 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_001a: Unknown result type (might be due to invalid IL or missing references)
				RawImage obj = pageDimmerRawImage;
				Color color = ((Graphic)pageDimmerRawImage).color;
				color.a = value;
				((Graphic)obj).color = color;
			}
		}

		public Padding maskPadding
		{
			get
			{
				return _maskPadding;
			}
			set
			{
				//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_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_0080: Unknown result type (might be due to invalid IL or missing references)
				//IL_008c: Unknown result type (might be due to invalid IL or missing references)
				//IL_008d: Unknown result type (might be due to invalid IL or missing references)
				Vector2 sizeDelta = defaultMaskSizeDelta;
				Vector2 val = defaultMaskPosition;
				sizeDelta.x -= value.left + value.right;
				sizeDelta.y -= value.top + value.bottom;
				if (value.left != 0f)
				{
					val.x += value.left;
				}
				if (value.bottom != 0f)
				{
					val.y += value.bottom;
				}
				maskRectTransform.sizeDelta = sizeDelta;
				((Transform)maskRectTransform).localPosition = Vector2.op_Implicit(val);
				_maskPadding = value;
				UpdateScrollBarPosition();
			}
		}

		public void OpenPage(bool openOnTop)
		{
			MenuAPI.OpenMenuPage(menuPage, openOnTop);
			pageWasActivatedOnce = true;
			scrollView.UpdateElements();
		}

		public void ClosePage(bool closePagesAddedOnTop)
		{
			MenuAPI.CloseMenuPage(menuPage, closePagesAddedOnTop);
		}

		public void AddElement(MenuAPI.BuilderDelegate builderDelegate)
		{
			builderDelegate?.Invoke(((Component)this).transform);
		}

		public void AddElement(RectTransform elementRectTransform, Vector2 localPosition = default(Vector2))
		{
			//IL_000d: 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)
			((Transform)elementRectTransform).SetParent(((Component)this).transform);
			((Transform)elementRectTransform).localPosition = Vector2.op_Implicit(localPosition);
		}

		public void AddElementToScrollView(ScrollViewBuilderDelegate scrollViewBuilderDelegate, float topPadding = 0f, float bottomPadding = 0f)
		{
			object obj;
			if (scrollViewBuilderDelegate == null)
			{
				obj = null;
			}
			else
			{
				RectTransform obj2 = scrollViewBuilderDelegate((Transform)(object)menuScrollBox.scroller);
				obj = ((obj2 != null) ? ((Component)obj2).gameObject.AddComponent<REPOScrollViewElement>() : null);
			}
			REPOScrollViewElement rEPOScrollViewElement = (REPOScrollViewElement)obj;
			if (rEPOScrollViewElement != null)
			{
				rEPOScrollViewElement.onSettingChanged = scrollView.UpdateElements;
				rEPOScrollViewElement.topPadding = topPadding;
				rEPOScrollViewElement.bottomPadding = bottomPadding;
			}
		}

		public void AddElementToScrollView(RectTransform elementRectTransform, Vector2 localPosition = default(Vector2), float topPadding = 0f, float bottomPadding = 0f)
		{
			//IL_0039: 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)
			REPOScrollViewElement rEPOScrollViewElement = ((Component)elementRectTransform).gameObject.AddComponent<REPOScrollViewElement>();
			if (rEPOScrollViewElement != null)
			{
				rEPOScrollViewElement.onSettingChanged = scrollView.UpdateElements;
				((Transform)elementRectTransform).SetParent((Transform)(object)menuScrollBox.scroller);
				((Transform)elementRectTransform).localPosition = Vector2.op_Implicit(localPosition);
				rEPOScrollViewElement.topPadding = topPadding;
				rEPOScrollViewElement.bottomPadding = bottomPadding;
			}
		}

		private void Awake()
		{
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Expected O, but got Unknown
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0148: Unknown result type (might be due to invalid IL or missing references)
			//IL_0152: Expected O, but got Unknown
			//IL_0159: Unknown result type (might be due to invalid IL or missing references)
			//IL_015e: Unknown result type (might be due to invalid IL or missing references)
			//IL_016a: Unknown result type (might be due to invalid IL or missing references)
			//IL_016f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0174: Unknown result type (might be due to invalid IL or missing references)
			//IL_018a: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01af: Expected O, but got Unknown
			//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ca: Expected O, but got Unknown
			//IL_01db: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e5: Expected O, but got Unknown
			menuPage = ((Component)this).GetComponent<MenuPage>();
			headerTMP = ((Component)this).GetComponentInChildren<TextMeshProUGUI>();
			menuScrollBox = ((Component)this).GetComponentInChildren<MenuScrollBox>();
			rectTransform = (RectTransform)new GameObject("Page Content", new Type[1] { typeof(RectTransform) }).transform;
			((Transform)rectTransform).SetParent(((Component)this).transform);
			((Component)this).transform.Find("Panel").SetParent((Transform)(object)rectTransform);
			((TMP_Text)headerTMP).transform.parent.SetParent((Transform)(object)rectTransform);
			((Component)menuScrollBox).transform.SetParent((Transform)(object)rectTransform);
			pageDimmerGameObject = ((Component)Object.Instantiate<RectTransform>(REPOTemplates.pageDimmerTemplate, ((Component)this).transform)).gameObject;
			pageDimmerGameObject.transform.SetAsFirstSibling();
			pageDimmerRawImage = pageDimmerGameObject.GetComponentInChildren<RawImage>();
			menuPage.menuPageIndex = (MenuPageIndex)(-1);
			RectTransform scroller = menuScrollBox.scroller;
			for (int i = 2; i < ((Transform)scroller).childCount; i++)
			{
				Object.Destroy((Object)(object)((Component)((Transform)scroller).GetChild(i)).gameObject);
			}
			scrollView = ((Component)scroller).gameObject.AddComponent<REPOScrollView>();
			scrollView.popupPage = this;
			maskRectTransform = (RectTransform)((Transform)scroller).parent;
			defaultMaskSizeDelta = maskRectTransform.sizeDelta;
			defaultMaskPosition = Vector2.op_Implicit(((Transform)maskRectTransform).localPosition);
			menuScrollBox.scroller.sizeDelta = maskRectTransform.sizeDelta;
			scrollBarRectTransform = (RectTransform)menuScrollBox.scrollBar.transform;
			scrollBarFillRectTransform = (RectTransform)((Transform)scrollBarRectTransform).Find("Scroll Bar Bg (2)");
			scrollBarOutlineRectTransform = (RectTransform)((Transform)scrollBarRectTransform).Find("Scroll Bar Bg (1)");
			maskPadding = new Padding(0f, 0f, 0f, 25f);
			Object.Destroy((Object)(object)((Component)this).GetComponent<MenuPageSettingsPage>());
			MenuAPI.customMenuPages.Add(menuPage, this);
		}

		private void Start()
		{
			//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_003e: Unknown result type (might be due to invalid IL or missing references)
			REPOReflection.menuScrollBox_ScrollerEndPosition.SetValue(menuScrollBox, 0);
			RectTransform scroller = menuScrollBox.scroller;
			Vector3 localPosition = ((Transform)menuScrollBox.scroller).localPosition;
			localPosition.y = 0f;
			((Transform)scroller).localPosition = localPosition;
			REPOReflection.menuPage_ScrollBoxes.SetValue(menuPage, 2);
			if (!pageWasActivatedOnce)
			{
				menuPage.PageStateSet((PageState)2);
			}
			scrollView.SetScrollPosition(0f);
		}

		private void Update()
		{
			//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_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Invalid comparison between Unknown and I4
			if (closeMenuOnEscape)
			{
				PageState val = (PageState)REPOReflection.menuPage_CurrentPageState.GetValue(menuPage);
				if (SemiFunc.InputDown((InputKey)18) && (int)val != 2 && (onEscapePressed == null || onEscapePressed()))
				{
					ClosePage(closePagesAddedOnTop: false);
				}
			}
		}

		private void OnDestroy()
		{
			MenuAPI.customMenuPages.Remove(menuPage);
		}

		private void UpdateScrollBarPosition()
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: 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_0051: 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_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: 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_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: 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_00a3: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)scrollBarRectTransform))
			{
				RectTransform obj = scrollBarRectTransform;
				Vector3 localPosition = ((Transform)scrollBarRectTransform).localPosition;
				localPosition.y = ((Transform)maskRectTransform).localPosition.y;
				((Transform)obj).localPosition = localPosition;
				Vector2 sizeDelta = scrollBarRectTransform.sizeDelta;
				sizeDelta.y = maskRectTransform.sizeDelta.y;
				RectTransform scrollBarBackground = menuScrollBox.scrollBarBackground;
				RectTransform obj2 = scrollBarFillRectTransform;
				Vector2 val2 = (scrollBarRectTransform.sizeDelta = sizeDelta);
				Vector2 sizeDelta2 = (obj2.sizeDelta = val2);
				scrollBarBackground.sizeDelta = sizeDelta2;
				scrollBarOutlineRectTransform.sizeDelta = sizeDelta + new Vector2(4f, 4f);
			}
		}
	}
	public sealed class REPOScrollView : MonoBehaviour
	{
		public REPOPopupPage popupPage;

		public float? scrollSpeed;

		private REPOScrollViewElement[] scrollViewElements = Array.Empty<REPOScrollViewElement>();

		private float _spacing;

		public float spacing
		{
			get
			{
				return _spacing;
			}
			set
			{
				if (!(Math.Abs(_spacing - value) < float.Epsilon))
				{
					_spacing = value;
					UpdateElements();
				}
			}
		}

		public void UpdateElements()
		{
			//IL_001e: 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_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_015d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0162: 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_0176: Unknown result type (might be due to invalid IL or missing references)
			//IL_0131: Unknown result type (might be due to invalid IL or missing references)
			//IL_0136: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: Unknown result type (might be due to invalid IL or missing references)
			scrollViewElements = ((Component)this).GetComponentsInChildren<REPOScrollViewElement>(true);
			float num = 0f;
			float num2 = popupPage.maskRectTransform.sizeDelta.y;
			REPOScrollViewElement[] array = scrollViewElements;
			Rect rect;
			foreach (REPOScrollViewElement rEPOScrollViewElement in array)
			{
				if (rEPOScrollViewElement.visibility)
				{
					Vector3 localPosition = ((Transform)rEPOScrollViewElement.rectTransform).localPosition;
					num2 -= rEPOScrollViewElement.topPadding;
					float num3 = num2;
					rect = rEPOScrollViewElement.rectTransform.rect;
					num2 = num3 - ((Rect)(ref rect)).height;
					num = (localPosition.y = num2);
					num2 -= rEPOScrollViewElement.bottomPadding;
					num2 -= spacing;
					((Transform)rEPOScrollViewElement.rectTransform).localPosition = localPosition;
				}
			}
			GameObject gameObject = ((Component)popupPage.scrollBarRectTransform).gameObject;
			MenuScrollBox menuScrollBox = popupPage.menuScrollBox;
			RectTransform scroller = menuScrollBox.scroller;
			float num4 = num;
			if (!(num4 < 0f))
			{
				if (num4 >= 0f && gameObject.activeSelf)
				{
					((Component)popupPage.scrollBarRectTransform).gameObject.SetActive(false);
					Vector3 localPosition2 = ((Transform)scroller).localPosition;
					localPosition2.y = 0f;
					((Transform)scroller).localPosition = localPosition2;
				}
			}
			else if (!gameObject.activeSelf)
			{
				((Component)popupPage.scrollBarRectTransform).gameObject.SetActive(true);
			}
			FieldInfo menuScrollBox_ScrollerStartPosition = REPOReflection.menuScrollBox_ScrollerStartPosition;
			float num5 = num;
			rect = menuScrollBox.scrollHandle.rect;
			float height = ((Rect)(ref rect)).height;
			rect = menuScrollBox.scrollBarBackground.rect;
			menuScrollBox_ScrollerStartPosition.SetValue(menuScrollBox, Math.Abs(num5 / (1f - height / ((Rect)(ref rect)).height)));
		}

		public void SetScrollPosition(float normalizedPosition)
		{
			//IL_0028: 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_004a: Unknown result type (might be due to invalid IL or missing references)
			normalizedPosition = Mathf.Clamp(1f - normalizedPosition, 0f, 1f);
			Rect rect = popupPage.menuScrollBox.scrollBarBackground.rect;
			float height = ((Rect)(ref rect)).height;
			float num = normalizedPosition * height;
			float num2 = popupPage.menuScrollBox.scrollHandle.sizeDelta.y / 2f;
			if (num < num2)
			{
				num = num2;
			}
			else if (num > height - num2)
			{
				num = height - num2;
			}
			REPOReflection.menuScrollBox_ScrollHandleTargetPosition.SetValue(popupPage.menuScrollBox, num);
		}

		private void OnTransformChildrenChanged()
		{
			UpdateElements();
		}

		private void Update()
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: 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_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			RectTransform maskRectTransform = popupPage.maskRectTransform;
			REPOScrollViewElement[] array = scrollViewElements;
			foreach (REPOScrollViewElement rEPOScrollViewElement in array)
			{
				if (!rEPOScrollViewElement.visibility)
				{
					continue;
				}
				Vector3 position = ((Component)rEPOScrollViewElement).transform.position;
				bool num = position.y <= ((Transform)maskRectTransform).position.y + maskRectTransform.sizeDelta.y + 50f && position.y >= ((Transform)maskRectTransform).position.y - 50f;
				GameObject gameObject = ((Component)rEPOScrollViewElement).gameObject;
				if (!num)
				{
					if (gameObject.activeSelf)
					{
						gameObject.SetActive(false);
					}
				}
				else if (!gameObject.activeSelf)
				{
					gameObject.SetActive(true);
				}
			}
		}
	}
	public sealed class REPOScrollViewElement : MonoBehaviour
	{
		public RectTransform rectTransform;

		internal Action onSettingChanged;

		private bool _visibility = true;

		private float _topPadding;

		private float _bottomPadding;

		public float topPadding
		{
			get
			{
				return _topPadding;
			}
			set
			{
				if (!(Math.Abs(_topPadding - value) < float.Epsilon))
				{
					_topPadding = value;
					onSettingChanged?.Invoke();
				}
			}
		}

		public float bottomPadding
		{
			get
			{
				return _bottomPadding;
			}
			set
			{
				if (!(Math.Abs(_bottomPadding - value) < float.Epsilon))
				{
					_bottomPadding = value;
					onSettingChanged?.Invoke();
				}
			}
		}

		public bool visibility
		{
			get
			{
				return _visibility;
			}
			set
			{
				if (_visibility != value)
				{
					_visibility = value;
					((Component)this).gameObject.SetActive(value);
					onSettingChanged?.Invoke();
				}
			}
		}

		private void Awake()
		{
			ref RectTransform reference = ref rectTransform;
			Transform transform = ((Component)this).transform;
			reference = (RectTransform)(object)((transform is RectTransform) ? transform : null);
		}

		private void OnRectTransformDimensionsChange()
		{
			onSettingChanged?.Invoke();
		}
	}
	public sealed class REPOSlider : REPOElement
	{
		public enum BarBehavior
		{
			UpdateWithValue,
			StaticAtMinimum,
			StaticAtMaximum
		}

		public TextMeshProUGUI labelTMP;

		public TextMeshProUGUI descriptionTMP;

		public REPOTextScroller repoTextScroller;

		public Action<float> onValueChanged;

		public BarBehavior barBehavior;

		public float value;

		public string prefix;

		public string postfix;

		private RectTransform barRectTransform;

		private RectTransform barSizeRectTransform;

		private RectTransform barPointerRectTransform;

		private RectTransform barMaskRectTransform;

		private RectTransform sliderBackgroundRectTransform;

		private RectTransform backgroundFillRectTransform;

		private RectTransform backgroundOutlineRectTransform;

		private TextMeshProUGUI valueTMP;

		private TextMeshProUGUI maskedValueTMP;

		private MenuPage menuPage;

		private MenuSelectableElement menuSelectableElement;

		private float _min;

		private float _max = 1f;

		private float previousValue;

		private float _precisionDecimal = 0.01f;

		private int _precision = 2;

		private string[] _stringOptions = Array.Empty<string>();

		private string currentDescription;

		private bool isHovering;

		public float min
		{
			get
			{
				string[] array = stringOptions;
				if (array == null || array.Length == 0)
				{
					return _min;
				}
				return 0f;
			}
			set
			{
				_min = value;
			}
		}

		public float max
		{
			get
			{
				string[] array = stringOptions;
				if (array == null || array.Length == 0)
				{
					return _max;
				}
				return stringOptions.Length - 1;
			}
			set
			{
				_max = value;
			}
		}

		public string[] stringOptions
		{
			get
			{
				return _stringOptions;
			}
			set
			{
				_stringOptions = value;
				UpdateBarText();
			}
		}

		public int precision
		{
			get
			{
				string[] array = stringOptions;
				if (array == null || array.Length == 0)
				{
					return _precision;
				}
				return 0;
			}
			set
			{
				precisionDecimal = ((value == 0) ? 1f : Mathf.Pow(10f, (float)(-value)));
				_precision = value;
			}
		}

		public float precisionDecimal
		{
			get
			{
				string[] array = stringOptions;
				if (array == null || array.Length == 0)
				{
					return _precisionDecimal;
				}
				return 1f;
			}
			set
			{
				_precisionDecimal = value;
			}
		}

		private float normalizedValue => (value - min) / (max - min);

		private bool hasValueChanged => Math.Abs(value - previousValue) > float.Epsilon;

		public void SetValue(float newValue, bool invokeCallback)
		{
			newValue = Mathf.Clamp(newValue, min, max);
			if (invokeCallback && Math.Abs(value - newValue) > float.Epsilon)
			{
				onValueChanged(newValue);
			}
			previousValue = (value = newValue);
			UpdateBarVisual();
			UpdateBarText();
		}

		public void Decrement()
		{
			float num = value - precisionDecimal;
			if (Math.Abs(value - min) < float.Epsilon)
			{
				num = max;
			}
			else if (num < min)
			{
				num = min;
			}
			SetValue(num, invokeCallback: true);
		}

		public void Increment()
		{
			float num = value + precisionDecimal;
			if (Math.Abs(max - value) < float.Epsilon)
			{
				num = min;
			}
			else if (num > max)
			{
				num = max;
			}
			SetValue(num, invokeCallback: true);
		}

		private void Awake()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Expected O, but got Unknown
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Expected O, but got Unknown
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_0164: Unknown result type (might be due to invalid IL or missing references)
			//IL_0173: Unknown result type (might be due to invalid IL or missing references)
			//IL_0178: Unknown result type (might be due to invalid IL or missing references)
			//IL_018e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0193: Unknown result type (might be due to invalid IL or missing references)
			//IL_0194: Unknown result type (might be due to invalid IL or missing references)
			//IL_01af: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b9: Expected O, but got Unknown
			//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d4: Expected O, but got Unknown
			//IL_01e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ef: Expected O, but got Unknown
			//IL_01f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fc: Unknown result type (might be due to invalid IL or missing r

BepInEx/plugins/nickklmao-REPOConfig/REPOConfig.dll

Decompiled 2 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Text.RegularExpressions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using MenuLib;
using MenuLib.MonoBehaviors;
using MenuLib.Structs;
using Microsoft.CodeAnalysis;
using MonoMod.RuntimeDetour;
using TMPro;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("REPOConfig")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.2.0")]
[assembly: AssemblyInformationalVersion("1.1.8+f5a40c4d0f746dd1b7f07aaec1f06a03a10fa7d4")]
[assembly: AssemblyProduct("REPOConfig")]
[assembly: AssemblyTitle("REPOConfig")]
[assembly: AssemblyVersion("1.2.0.0")]
[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.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace REPOConfig
{
	internal sealed class ConfigMenu
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static BuilderDelegate <>9__4_0;

			public static BuilderDelegate <>9__4_1;

			public static BuilderDelegate <>9__4_2;

			public static Action <>9__5_4;

			public static Action <>9__5_8;

			public static Action <>9__6_3;

			public static ShouldCloseMenuDelegate <>9__6_5;

			public static Action <>9__6_10;

			public static BuilderDelegate <>9__6_6;

			public static ScrollViewBuilderDelegate <>9__6_9;

			public static Func<ConfigEntryBase, string> <>9__7_0;

			public static ScrollViewBuilderDelegate <>9__7_2;

			public static Func<PluginInfo, string> <>9__8_0;

			public static Func<KeyValuePair<ConfigDefinition, ConfigEntryBase>, ConfigEntryBase> <>9__8_1;

			internal void <Initialize>b__4_0(Transform parent)
			{
				//IL_002b: Unknown result type (might be due to invalid IL or missing references)
				MenuAPI.CreateREPOButton("Mods", (Action)CreateModMenu, parent, new Vector2(48.3f, 55.5f));
			}

			internal void <Initialize>b__4_1(Transform parent)
			{
				//IL_002b: Unknown result type (might be due to invalid IL or missing references)
				MenuAPI.CreateREPOButton("Mods", (Action)CreateModMenu, parent, new Vector2(186f, 32f));
			}

			internal void <Initialize>b__4_2(Transform parent)
			{
				//IL_002b: Unknown result type (might be due to invalid IL or missing references)
				MenuAPI.CreateREPOButton("Mods", (Action)CreateModMenu, parent, new Vector2(126f, 86f));
			}

			internal void <CreateModMenu>b__5_4()
			{
				hasPopupMenuOpened = false;
			}

			internal void <CreateModMenu>b__5_8()
			{
				hasPopupMenuOpened = false;
			}

			internal void <CreateModList>b__6_3()
			{
				hasPopupMenuOpened = false;
			}

			internal bool <CreateModList>b__6_5()
			{
				if (!hasPopupMenuOpened)
				{
					return changedEntries.Count == 0;
				}
				return false;
			}

			internal void <CreateModList>b__6_6(Transform mainPageParent)
			{
				//IL_002f: Unknown result type (might be due to invalid IL or missing references)
				MenuAPI.CreateREPOButton("Save Changes", (Action)delegate
				{
					KeyValuePair<ConfigEntryBase, object>[] array = changedEntries.ToArray();
					changedEntries.Clear();
					KeyValuePair<ConfigEntryBase, object>[] array2 = array;
					for (int i = 0; i < array2.Length; i++)
					{
						KeyValuePair<ConfigEntryBase, object> keyValuePair = array2[i];
						var (val2, boxedValue) = (KeyValuePair<ConfigEntryBase, object>)(ref keyValuePair);
						val2.BoxedValue = boxedValue;
					}
				}, mainPageParent, new Vector2(370f, 18f));
			}

			internal void <CreateModList>b__6_10()
			{
				KeyValuePair<ConfigEntryBase, object>[] array = changedEntries.ToArray();
				changedEntries.Clear();
				KeyValuePair<ConfigEntryBase, object>[] array2 = array;
				for (int i = 0; i < array2.Length; i++)
				{
					KeyValuePair<ConfigEntryBase, object> keyValuePair = array2[i];
					var (val2, boxedValue) = (KeyValuePair<ConfigEntryBase, object>)(ref keyValuePair);
					val2.BoxedValue = boxedValue;
				}
			}

			internal RectTransform <CreateModList>b__6_9(Transform scrollView)
			{
				//IL_0014: 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_001b: Unknown result type (might be due to invalid IL or missing references)
				Vector2 val = default(Vector2);
				((Vector2)(ref val))..ctor(0f, 10f);
				return ((REPOElement)MenuAPI.CreateREPOSpacer(scrollView, default(Vector2), val)).rectTransform;
			}

			internal string <CreateModEntries>b__7_0(ConfigEntryBase entry)
			{
				return entry.Definition.Section;
			}

			internal RectTransform <CreateModEntries>b__7_2(Transform scrollView)
			{
				//IL_0014: 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_001b: Unknown result type (might be due to invalid IL or missing references)
				Vector2 val = default(Vector2);
				((Vector2)(ref val))..ctor(0f, 20f);
				return ((REPOElement)MenuAPI.CreateREPOSpacer(scrollView, default(Vector2), val)).rectTransform;
			}

			internal string <GetModConfigEntries>b__8_0(PluginInfo p)
			{
				return p.Metadata.Name;
			}

			internal ConfigEntryBase <GetModConfigEntries>b__8_1(KeyValuePair<ConfigDefinition, ConfigEntryBase> configEntry)
			{
				return configEntry.Value;
			}
		}

		private static readonly Dictionary<ConfigEntryBase, object> changedEntries = new Dictionary<ConfigEntryBase, object>();

		internal static REPOButton lastClickedModButton;

		private static readonly List<REPOButton> currentModButtons = new List<REPOButton>();

		private static bool hasPopupMenuOpened;

		internal static void Initialize()
		{
			//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: Expected O, but got Unknown
			//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_0043: Expected O, but got Unknown
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Expected O, but got Unknown
			object obj = <>c.<>9__4_0;
			if (obj == null)
			{
				BuilderDelegate val = delegate(Transform parent)
				{
					//IL_002b: Unknown result type (might be due to invalid IL or missing references)
					MenuAPI.CreateREPOButton("Mods", (Action)CreateModMenu, parent, new Vector2(48.3f, 55.5f));
				};
				<>c.<>9__4_0 = val;
				obj = (object)val;
			}
			MenuAPI.AddElementToMainMenu((BuilderDelegate)obj);
			object obj2 = <>c.<>9__4_1;
			if (obj2 == null)
			{
				BuilderDelegate val2 = delegate(Transform parent)
				{
					//IL_002b: Unknown result type (might be due to invalid IL or missing references)
					MenuAPI.CreateREPOButton("Mods", (Action)CreateModMenu, parent, new Vector2(186f, 32f));
				};
				<>c.<>9__4_1 = val2;
				obj2 = (object)val2;
			}
			MenuAPI.AddElementToLobbyMenu((BuilderDelegate)obj2);
			object obj3 = <>c.<>9__4_2;
			if (obj3 == null)
			{
				BuilderDelegate val3 = delegate(Transform parent)
				{
					//IL_002b: Unknown result type (might be due to invalid IL or missing references)
					MenuAPI.CreateREPOButton("Mods", (Action)CreateModMenu, parent, new Vector2(126f, 86f));
				};
				<>c.<>9__4_2 = val3;
				obj3 = (object)val3;
			}
			MenuAPI.AddElementToEscapeMenu((BuilderDelegate)obj3);
		}

		private static void CreateModMenu()
		{
			//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_0066: 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_0089: Expected O, but got Unknown
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Expected O, but got Unknown
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Expected O, but got Unknown
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Expected O, but got Unknown
			changedEntries.Clear();
			lastClickedModButton = null;
			REPOPopupPage repoPopupPage = MenuAPI.CreateREPOPopupPage("Mods", (PresetSide)0, false, true, 0f);
			repoPopupPage.scrollView.scrollSpeed = 3f;
			REPOPopupPage obj = repoPopupPage;
			Padding maskPadding = repoPopupPage.maskPadding;
			maskPadding.top = 35f;
			obj.maskPadding = maskPadding;
			REPOPopupPage obj2 = repoPopupPage;
			obj2.onEscapePressed = (ShouldCloseMenuDelegate)Delegate.Combine((Delegate?)(object)obj2.onEscapePressed, (Delegate?)(ShouldCloseMenuDelegate)delegate
			{
				//IL_001c: Unknown result type (might be due to invalid IL or missing references)
				if (hasPopupMenuOpened)
				{
					return false;
				}
				if (changedEntries.Count == 0)
				{
					return true;
				}
				MenuAPI.OpenPopup("Unsaved Changes", Color.red, "You have unsaved changes, are you sure you want to exit?", (Action)delegate
				{
					repoPopupPage.ClosePage(true);
					changedEntries.Clear();
					hasPopupMenuOpened = false;
				}, (Action)delegate
				{
					hasPopupMenuOpened = false;
				});
				hasPopupMenuOpened = true;
				return false;
			});
			repoPopupPage.AddElement((BuilderDelegate)delegate(Transform parent)
			{
				//IL_002f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0049: Unknown result type (might be due to invalid IL or missing references)
				//IL_0053: Unknown result type (might be due to invalid IL or missing references)
				((Component)MenuAPI.CreateREPOInputField("Mod Search", (Action<string>)delegate(string s)
				{
					string text = (string.IsNullOrEmpty(s) ? null : s.ToLower().Trim());
					foreach (REPOButton currentModButton in currentModButtons)
					{
						((REPOElement)currentModButton).repoScrollViewElement.visibility = text == null || ((TMP_Text)currentModButton.labelTMP).text.ToLower().Contains(text);
					}
					repoPopupPage.scrollView.SetScrollPosition(0f);
				}, parent, new Vector2(83f, 272f), false, "", "")).transform.localScale = Vector3.one * 0.95f;
			});
			CreateModList(repoPopupPage);
			repoPopupPage.AddElement((BuilderDelegate)delegate(Transform parent)
			{
				//IL_002f: Unknown result type (might be due to invalid IL or missing references)
				MenuAPI.CreateREPOButton("Back", (Action)delegate
				{
					//IL_0025: Unknown result type (might be due to invalid IL or missing references)
					if (changedEntries.Count == 0 || hasPopupMenuOpened)
					{
						repoPopupPage.ClosePage(true);
					}
					else
					{
						MenuAPI.OpenPopup("Unsaved Changes", Color.red, "You have unsaved changes, are you sure you want to exit?", (Action)delegate
						{
							repoPopupPage.ClosePage(true);
							changedEntries.Clear();
							hasPopupMenuOpened = false;
						}, (Action)delegate
						{
							hasPopupMenuOpened = false;
						});
						hasPopupMenuOpened = true;
					}
				}, parent, new Vector2(66f, 18f));
			});
			repoPopupPage.OpenPage(false);
		}

		private static void CreateModList(REPOPopupPage mainModPage)
		{
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Expected O, but got Unknown
			currentModButtons.Clear();
			foreach (KeyValuePair<string, ConfigEntryBase[]> modConfigEntry in GetModConfigEntries())
			{
				var (modName, configEntryBases) = (KeyValuePair<string, ConfigEntryBase[]>)(ref modConfigEntry);
				mainModPage.AddElementToScrollView((ScrollViewBuilderDelegate)delegate(Transform parent)
				{
					//IL_0018: 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_0044: Unknown result type (might be due to invalid IL or missing references)
					//IL_0049: Unknown result type (might be due to invalid IL or missing references)
					//IL_0056: Unknown result type (might be due to invalid IL or missing references)
					REPOButton modButton = MenuAPI.CreateREPOButton(modName, (Action)null, parent, default(Vector2));
					if (modName.Length > 24)
					{
						REPOButton obj = modButton;
						Vector2 labelSize = modButton.GetLabelSize();
						labelSize.x = 250f;
						obj.overrideButtonSize = labelSize;
						REPOTextScroller val = ((Component)modButton.labelTMP).gameObject.AddComponent<REPOTextScroller>();
						val.maxCharacters = 24;
						((MonoBehaviour)MenuManager.instance).StartCoroutine(val.Animate());
					}
					BuilderDelegate val2 = default(BuilderDelegate);
					modButton.onClick = delegate
					{
						//IL_002b: Unknown result type (might be due to invalid IL or missing references)
						if (!((Object)(object)lastClickedModButton == (Object)(object)modButton))
						{
							if (changedEntries.Count == 0)
							{
								OpenPage();
							}
							else
							{
								MenuAPI.OpenPopup("Unsaved Changes", Color.red, "You have unsaved changes, are you sure you want to exit?", (Action)delegate
								{
									changedEntries.Clear();
									OpenPage();
									hasPopupMenuOpened = false;
								}, (Action)delegate
								{
									hasPopupMenuOpened = false;
								});
								hasPopupMenuOpened = true;
							}
						}
					};
					currentModButtons.Add(modButton);
					return ((REPOElement)modButton).rectTransform;
					void OpenPage()
					{
						//IL_0064: Unknown result type (might be due to invalid IL or missing references)
						//IL_0069: Unknown result type (might be due to invalid IL or missing references)
						//IL_006f: Expected O, but got Unknown
						//IL_008e: Unknown result type (might be due to invalid IL or missing references)
						//IL_0093: Unknown result type (might be due to invalid IL or missing references)
						//IL_0099: Expected O, but got Unknown
						//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
						//IL_00e9: Expected O, but got Unknown
						//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
						//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
						//IL_00bd: Expected O, but got Unknown
						//IL_00c2: Expected O, but got Unknown
						//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_010e: Expected O, but got Unknown
						MenuAPI.CloseAllPagesAddedOnTop();
						REPOPopupPage modPage = MenuAPI.CreateREPOPopupPage(modName, (PresetSide)1, false, false, 5f);
						modPage.scrollView.scrollSpeed = 3f;
						REPOPopupPage obj3 = modPage;
						object obj4 = <>c.<>9__6_5;
						if (obj4 == null)
						{
							ShouldCloseMenuDelegate val3 = () => !hasPopupMenuOpened && changedEntries.Count == 0;
							<>c.<>9__6_5 = val3;
							obj4 = (object)val3;
						}
						obj3.onEscapePressed = (ShouldCloseMenuDelegate)obj4;
						REPOPopupPage obj5 = modPage;
						object obj6 = <>c.<>9__6_6;
						if (obj6 == null)
						{
							BuilderDelegate val4 = delegate(Transform mainPageParent)
							{
								//IL_002f: Unknown result type (might be due to invalid IL or missing references)
								MenuAPI.CreateREPOButton("Save Changes", (Action)delegate
								{
									KeyValuePair<ConfigEntryBase, object>[] array3 = changedEntries.ToArray();
									changedEntries.Clear();
									KeyValuePair<ConfigEntryBase, object>[] array4 = array3;
									for (int j = 0; j < array4.Length; j++)
									{
										KeyValuePair<ConfigEntryBase, object> keyValuePair2 = array4[j];
										var (val11, boxedValue) = (KeyValuePair<ConfigEntryBase, object>)(ref keyValuePair2);
										val11.BoxedValue = boxedValue;
									}
								}, mainPageParent, new Vector2(370f, 18f));
							};
							<>c.<>9__6_6 = val4;
							obj6 = (object)val4;
						}
						obj5.AddElement((BuilderDelegate)obj6);
						REPOPopupPage obj7 = modPage;
						BuilderDelegate obj8 = val2;
						if (obj8 == null)
						{
							BuilderDelegate val5 = delegate(Transform mainPageParent)
							{
								//IL_002f: Unknown result type (might be due to invalid IL or missing references)
								MenuAPI.CreateREPOButton("Revert", (Action)delegate
								{
									if (changedEntries.Count != 0)
									{
										changedEntries.Clear();
										lastClickedModButton = null;
										OpenPage();
									}
								}, mainPageParent, new Vector2(585f, 18f));
							};
							BuilderDelegate val6 = val5;
							val2 = val5;
							obj8 = val6;
						}
						obj7.AddElement(obj8);
						modPage.AddElementToScrollView((ScrollViewBuilderDelegate)delegate(Transform scrollView)
						{
							//IL_0036: Unknown result type (might be due to invalid IL or missing references)
							//IL_003c: Unknown result type (might be due to invalid IL or missing references)
							//IL_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_0062: Unknown result type (might be due to invalid IL or missing references)
							//IL_0078: Unknown result type (might be due to invalid IL or missing references)
							//IL_007d: Unknown result type (might be due to invalid IL or missing references)
							REPOButton val9 = MenuAPI.CreateREPOButton("Reset To Default", (Action)delegate
							{
								//IL_0059: Unknown result type (might be due to invalid IL or missing references)
								MenuAPI.OpenPopup("Reset " + modName + "'" + (modName.ToLower().EndsWith('s') ? string.Empty : "s") + " settings?", Color.red, "Are you sure you want to reset all settings back to default?", (Action)ResetToDefault, (Action)null);
							}, scrollView, default(Vector2));
							RectTransform rectTransform = ((REPOElement)val9).rectTransform;
							Rect rect = modPage.maskRectTransform.rect;
							((Transform)rectTransform).localPosition = Vector2.op_Implicit(new Vector2((((Rect)(ref rect)).width - val9.GetLabelSize().x) * 0.5f, 0f));
							return ((REPOElement)val9).rectTransform;
						}, 0f, 0f);
						REPOPopupPage obj9 = modPage;
						object obj10 = <>c.<>9__6_9;
						if (obj10 == null)
						{
							ScrollViewBuilderDelegate val7 = delegate(Transform scrollView)
							{
								//IL_0014: 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_001b: Unknown result type (might be due to invalid IL or missing references)
								Vector2 val8 = default(Vector2);
								((Vector2)(ref val8))..ctor(0f, 10f);
								return ((REPOElement)MenuAPI.CreateREPOSpacer(scrollView, default(Vector2), val8)).rectTransform;
							};
							<>c.<>9__6_9 = val7;
							obj10 = (object)val7;
						}
						obj9.AddElementToScrollView((ScrollViewBuilderDelegate)obj10, 0f, 0f);
						CreateModEntries(modPage, configEntryBases);
						modPage.OpenPage(true);
						lastClickedModButton = modButton;
					}
					void ResetToDefault()
					{
						ConfigEntryBase[] array2 = configEntryBases;
						foreach (ConfigEntryBase obj2 in array2)
						{
							obj2.BoxedValue = obj2.DefaultValue;
						}
						changedEntries.Clear();
						lastClickedModButton = null;
						modButton.onClick();
					}
				}, 0f, 0f);
			}
		}

		private static void CreateModEntries(REPOPopupPage modPage, ConfigEntryBase[] configEntryBases)
		{
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Expected O, but got Unknown
			//IL_03c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_03cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d3: Expected O, but got Unknown
			//IL_019b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01af: Expected O, but got Unknown
			//IL_01dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f0: Expected O, but got Unknown
			//IL_021d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0231: Expected O, but got Unknown
			//IL_02ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e2: Expected O, but got Unknown
			//IL_028d: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a1: Expected O, but got Unknown
			//IL_037e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0392: Expected O, but got Unknown
			foreach (IGrouping<string, ConfigEntryBase> group in from entry in configEntryBases
				group entry by entry.Definition.Section)
			{
				modPage.AddElementToScrollView((ScrollViewBuilderDelegate)((Transform scrollView) => ((REPOElement)MenuAPI.CreateREPOLabel(FixNaming(group.Key), scrollView, default(Vector2))).rectTransform), 0f, 0f);
				foreach (ConfigEntryBase entry2 in group)
				{
					string modName = FixNaming(entry2.Definition.Key);
					string description = (Entry.showDescriptions.Value ? entry2.Description.Description.Replace("\n", string.Empty) : string.Empty);
					ConfigEntryBase val = entry2;
					if (!(val is ConfigEntry<bool>))
					{
						if (!(val is ConfigEntry<float>))
						{
							if (!(val is ConfigEntry<int>))
							{
								if (!(val is ConfigEntry<string>))
								{
									if (val == null || !entry2.SettingType.IsSubclassOf(typeof(Enum)))
									{
										continue;
									}
									Type enumType = entry2.SettingType;
									string[] values = Enum.GetNames(enumType);
									modPage.AddElementToScrollView((ScrollViewBuilderDelegate)delegate(Transform scrollView)
									{
										//IL_0067: Unknown result type (might be due to invalid IL or missing references)
										//IL_006d: Unknown result type (might be due to invalid IL or missing references)
										REPOSlider val10 = MenuAPI.CreateREPOSlider(modName, description, (Action<int>)delegate(int i)
										{
											changedEntries[entry2] = Enum.Parse(enumType, values[i]);
										}, scrollView, values, entry2.BoxedValue.ToString(), default(Vector2), "", "", (BarBehavior)0);
										if (description.Length <= 43)
										{
											return ((REPOElement)val10).rectTransform;
										}
										((TMP_Text)val10.descriptionTMP).maxVisibleCharacters = (val10.repoTextScroller.maxCharacters = 43);
										val10.repoTextScroller.scrollingSpeedInSecondsPerCharacter = Entry.descriptionScrollSpeed.Value;
										val10.repoTextScroller.endWaitTime = (val10.repoTextScroller.initialWaitTime = 5f);
										val10.repoTextScroller.startWaitTime = 3f;
										((TMP_Text)val10.descriptionTMP).alignment = (TextAlignmentOptions)513;
										((MonoBehaviour)modPage).StartCoroutine(val10.repoTextScroller.Animate());
										return ((REPOElement)val10).rectTransform;
									}, 0f, 0f);
									continue;
								}
								AcceptableValueBase acceptableValues = entry2.Description.AcceptableValues;
								AcceptableValueList<string> val2 = acceptableValues as AcceptableValueList<string>;
								if (val2 != null)
								{
									modPage.AddElementToScrollView((ScrollViewBuilderDelegate)delegate(Transform scrollView)
									{
										//IL_007b: 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)
										REPOSlider val9 = MenuAPI.CreateREPOSlider(modName, description, (Action<string>)delegate(string s)
										{
											changedEntries[entry2] = s;
										}, scrollView, val2.AcceptableValues, (string)entry2.BoxedValue, default(Vector2), "", "", (BarBehavior)0);
										if (description.Length <= 43)
										{
											return ((REPOElement)val9).rectTransform;
										}
										((TMP_Text)val9.descriptionTMP).maxVisibleCharacters = (val9.repoTextScroller.maxCharacters = 43);
										val9.repoTextScroller.scrollingSpeedInSecondsPerCharacter = Entry.descriptionScrollSpeed.Value;
										val9.repoTextScroller.endWaitTime = (val9.repoTextScroller.initialWaitTime = 5f);
										val9.repoTextScroller.startWaitTime = 3f;
										((TMP_Text)val9.descriptionTMP).alignment = (TextAlignmentOptions)513;
										((MonoBehaviour)modPage).StartCoroutine(val9.repoTextScroller.Animate());
										return ((REPOElement)val9).rectTransform;
									}, 0f, 0f);
									continue;
								}
								modPage.AddElementToScrollView((ScrollViewBuilderDelegate)delegate(Transform scrollView)
								{
									//IL_004b: Unknown result type (might be due to invalid IL or missing references)
									string text6 = (string)entry2.DefaultValue;
									return ((REPOElement)MenuAPI.CreateREPOInputField(modName, (Action<string>)delegate(string s)
									{
										changedEntries[entry2] = s;
									}, scrollView, Vector2.zero, false, (!string.IsNullOrEmpty(text6)) ? text6 : "<NONE>", (string)entry2.BoxedValue)).rectTransform;
								}, 0f, 0f);
								continue;
							}
							modPage.AddElementToScrollView((ScrollViewBuilderDelegate)delegate(Transform scrollView)
							{
								//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
								//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
								int num9;
								int num10;
								int num12;
								if (entry2.Description.AcceptableValues is AcceptableValueRange<int> val7)
								{
									num9 = val7.MinValue;
									num10 = val7.MaxValue;
								}
								else
								{
									int num11 = Math.Abs((int)entry2.BoxedValue);
									num12 = ((num11 > 100) ? (-(num10 = num11 * 2)) : ((num11 != 0) ? (-(num10 = num11 * 3)) : (-(num10 = 100))));
									num9 = num12;
								}
								string text4 = modName;
								string text5 = description;
								Action<int> obj5 = delegate(int i)
								{
									changedEntries[entry2] = i;
								};
								num12 = (int)entry2.BoxedValue;
								int num13 = num9;
								int num14 = num10;
								REPOSlider val8 = MenuAPI.CreateREPOSlider(text4, text5, obj5, scrollView, default(Vector2), num13, num14, num12, "", "", (BarBehavior)0);
								if (description.Length <= 43)
								{
									return ((REPOElement)val8).rectTransform;
								}
								((TMP_Text)val8.descriptionTMP).maxVisibleCharacters = (val8.repoTextScroller.maxCharacters = 43);
								val8.repoTextScroller.scrollingSpeedInSecondsPerCharacter = Entry.descriptionScrollSpeed.Value;
								val8.repoTextScroller.endWaitTime = (val8.repoTextScroller.initialWaitTime = 5f);
								val8.repoTextScroller.startWaitTime = 3f;
								((TMP_Text)val8.descriptionTMP).alignment = (TextAlignmentOptions)513;
								((MonoBehaviour)modPage).StartCoroutine(val8.repoTextScroller.Animate());
								return ((REPOElement)val8).rectTransform;
							}, 0f, 0f);
							continue;
						}
						modPage.AddElementToScrollView((ScrollViewBuilderDelegate)delegate(Transform scrollView)
						{
							//IL_0152: Unknown result type (might be due to invalid IL or missing references)
							//IL_0158: Unknown result type (might be due to invalid IL or missing references)
							int num = 2;
							float num2;
							float num3;
							if (entry2.Description.AcceptableValues is AcceptableValueRange<float> val5)
							{
								num2 = val5.MinValue;
								num3 = val5.MaxValue;
								num = Mathf.Max(new int[3]
								{
									GetDecimalPlaces(num2),
									GetDecimalPlaces(num3),
									GetDecimalPlaces((float)entry2.DefaultValue)
								});
							}
							else
							{
								float num4 = Math.Abs((float)entry2.BoxedValue);
								num2 = ((num4 == 0f) ? (0f - (num3 = 100f)) : (((double)num4 <= 0.001) ? (0f - (num3 = 10f)) : (((double)num4 <= 0.01) ? (0f - (num3 = 50f)) : ((!(num4 <= 100f)) ? (0f - (num3 = num4 * 2f)) : (0f - (num3 = num4 * 3f))))));
							}
							string text2 = modName;
							string text3 = description;
							Action<float> obj4 = delegate(float f)
							{
								changedEntries[entry2] = f;
							};
							float num5 = (float)entry2.BoxedValue;
							float num6 = num2;
							float num7 = num3;
							int num8 = num;
							REPOSlider val6 = MenuAPI.CreateREPOSlider(text2, text3, obj4, scrollView, default(Vector2), num6, num7, num8, num5, "", "", (BarBehavior)0);
							if (description.Length <= 43)
							{
								return ((REPOElement)val6).rectTransform;
							}
							((TMP_Text)val6.descriptionTMP).maxVisibleCharacters = (val6.repoTextScroller.maxCharacters = 43);
							val6.repoTextScroller.scrollingSpeedInSecondsPerCharacter = Entry.descriptionScrollSpeed.Value;
							val6.repoTextScroller.endWaitTime = (val6.repoTextScroller.initialWaitTime = 5f);
							val6.repoTextScroller.startWaitTime = 3f;
							((TMP_Text)val6.descriptionTMP).alignment = (TextAlignmentOptions)513;
							((MonoBehaviour)modPage).StartCoroutine(val6.repoTextScroller.Animate());
							return ((REPOElement)val6).rectTransform;
						}, 0f, 0f);
						continue;
					}
					modPage.AddElementToScrollView((ScrollViewBuilderDelegate)delegate(Transform scrollView)
					{
						//IL_004d: 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)
						string text = modName;
						Action<bool> obj3 = delegate(bool b)
						{
							changedEntries[entry2] = b;
						};
						bool flag = (bool)entry2.BoxedValue;
						return ((REPOElement)MenuAPI.CreateREPOToggle(text, obj3, scrollView, default(Vector2), "ON", "OFF", flag)).rectTransform;
					}, 0f, 0f);
				}
				REPOPopupPage obj = modPage;
				object obj2 = <>c.<>9__7_2;
				if (obj2 == null)
				{
					ScrollViewBuilderDelegate val3 = delegate(Transform scrollView)
					{
						//IL_0014: 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_001b: Unknown result type (might be due to invalid IL or missing references)
						Vector2 val4 = default(Vector2);
						((Vector2)(ref val4))..ctor(0f, 20f);
						return ((REPOElement)MenuAPI.CreateREPOSpacer(scrollView, default(Vector2), val4)).rectTransform;
					};
					<>c.<>9__7_2 = val3;
					obj2 = (object)val3;
				}
				obj.AddElementToScrollView((ScrollViewBuilderDelegate)obj2, 0f, 0f);
			}
		}

		private static Dictionary<string, ConfigEntryBase[]> GetModConfigEntries()
		{
			Dictionary<string, ConfigEntryBase[]> dictionary = new Dictionary<string, ConfigEntryBase[]>();
			foreach (PluginInfo item in Chainloader.PluginInfos.Values.OrderBy((PluginInfo p) => p.Metadata.Name))
			{
				List<ConfigEntryBase> list = new List<ConfigEntryBase>();
				foreach (ConfigEntryBase item2 in ((IEnumerable<KeyValuePair<ConfigDefinition, ConfigEntryBase>>)item.Instance.Config).Select((KeyValuePair<ConfigDefinition, ConfigEntryBase> configEntry) => configEntry.Value))
				{
					ConfigDescription description = item2.Description;
					object[] array = ((description != null) ? description.Tags : null);
					if (array == null || (!array.Contains("HideREPOConfig") && !array.Contains("HideFromREPOConfig")))
					{
						list.Add(item2);
					}
				}
				if (list.Count > 0)
				{
					dictionary.TryAdd(FixNaming(item.Metadata.Name), list.ToArray());
				}
			}
			return dictionary;
		}

		private static string FixNaming(string input)
		{
			input = Regex.Replace(input, "([a-z])([A-Z])", "$1 $2");
			input = Regex.Replace(input, "([A-Z])([A-Z][a-z])", "$1 $2");
			input = Regex.Replace(input, "\\s+", " ");
			input = Regex.Replace(input, "([A-Z]\\.)\\s([A-Z]\\.)", "$1$2");
			return input.Trim();
		}

		private static int GetDecimalPlaces(float value)
		{
			string text = value.ToString(CultureInfo.InvariantCulture);
			int num = text.IndexOf('.');
			if (num != -1)
			{
				string text2 = text;
				int num2 = num + 1;
				return text2.Substring(num2, text2.Length - num2).Length;
			}
			return 0;
		}
	}
	[BepInPlugin("nickklmao.repoconfig", "REPOConfig", "1.2.0")]
	[BepInDependency("nickklmao.menulib", "2.4.0")]
	internal sealed class Entry : BaseUnityPlugin
	{
		private const string MOD_NAME = "REPOConfig";

		internal static readonly ManualLogSource logger = Logger.CreateLogSource("REPOConfig");

		internal static ConfigEntry<bool> showDescriptions;

		internal static ConfigEntry<float> descriptionScrollSpeed;

		private static ConfigEntry<bool> showInGame;

		private static void MenuPageMain_StartHook(Action<MenuPageMain> orig, MenuPageMain self)
		{
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			IOrderedEnumerable<Transform> orderedEnumerable = from Transform transform in (IEnumerable)((Component)self).transform
				where ((Object)transform).name.Contains("Menu Button")
				orderby transform.localPosition.y descending
				select transform;
			float num = 224f;
			foreach (Transform item in orderedEnumerable)
			{
				if (((Object)item).name.Contains("Quit"))
				{
					num -= 34f;
				}
				Vector3 localPosition = item.localPosition;
				localPosition.y = num;
				item.localPosition = localPosition;
				num -= 34f;
			}
			orig(self);
		}

		private void Awake()
		{
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Expected O, but got Unknown
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Expected O, but got Unknown
			//IL_0103: Unknown result type (might be due to invalid IL or missing references)
			showDescriptions = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Show Descriptions", true, (ConfigDescription)null);
			showDescriptions.SettingChanged += delegate
			{
				REPOButton lastClickedModButton = ConfigMenu.lastClickedModButton;
				if (Object.op_Implicit((Object)(object)lastClickedModButton))
				{
					ConfigMenu.lastClickedModButton = null;
					lastClickedModButton.onClick();
				}
			};
			descriptionScrollSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Description Scroll Speed", 0.15f, new ConfigDescription("How fast descriptions scroll. (Seconds per character)", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 2f), Array.Empty<object>()));
			showInGame = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Show In Game", true, new ConfigDescription(string.Empty, (AcceptableValueBase)null, new object[1] { "HideFromREPOConfig" }));
			if (showInGame.Value)
			{
				logger.LogDebug((object)"Hooking `MenuPageMain.Start`");
				new Hook((MethodBase)AccessTools.Method(typeof(MenuPageMain), "Start", (Type[])null, (Type[])null), (Delegate)new Action<Action<MenuPageMain>, MenuPageMain>(MenuPageMain_StartHook));
				ConfigMenu.Initialize();
			}
		}
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field)]
	[Obsolete("This attribute is not used and will be removed eventually.")]
	public class REPOConfigEntryAttribute : Attribute
	{
		public REPOConfigEntryAttribute(string displayName)
		{
		}

		public REPOConfigEntryAttribute(string displayName, int min, int max, string prefix = "", string postfix = "")
		{
		}

		public REPOConfigEntryAttribute(string displayName, float min, float max, string prefix = "", string postfix = "")
		{
		}

		public REPOConfigEntryAttribute(string displayName, float min, float max, int precision = 2, string prefix = "", string postfix = "")
		{
		}

		public REPOConfigEntryAttribute(string displayName, string prefix = "", string postfix = "")
		{
		}

		public REPOConfigEntryAttribute(string displayName, params string[] customOptions)
		{
		}
	}
}

BepInEx/plugins/OrtonLongGaming-FNAFLevel/FNAFLevel.dll

Decompiled 2 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Photon.Pun;
using REPOLib.Modules;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: IgnoresAccessChecksTo("Autodesk.Fbx")]
[assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")]
[assembly: IgnoresAccessChecksTo("FbxBuildTestAssets")]
[assembly: IgnoresAccessChecksTo("Klattersynth")]
[assembly: IgnoresAccessChecksTo("Photon3Unity3D")]
[assembly: IgnoresAccessChecksTo("PhotonChat")]
[assembly: IgnoresAccessChecksTo("PhotonRealtime")]
[assembly: IgnoresAccessChecksTo("PhotonUnityNetworking")]
[assembly: IgnoresAccessChecksTo("PhotonUnityNetworking.Utilities")]
[assembly: IgnoresAccessChecksTo("PhotonVoice.API")]
[assembly: IgnoresAccessChecksTo("PhotonVoice")]
[assembly: IgnoresAccessChecksTo("PhotonVoice.PUN")]
[assembly: IgnoresAccessChecksTo("SingularityGroup.HotReload.Runtime")]
[assembly: IgnoresAccessChecksTo("SingularityGroup.HotReload.Runtime.Public")]
[assembly: IgnoresAccessChecksTo("Sirenix.OdinInspector.Attributes")]
[assembly: IgnoresAccessChecksTo("Sirenix.Serialization.Config")]
[assembly: IgnoresAccessChecksTo("Sirenix.Serialization")]
[assembly: IgnoresAccessChecksTo("Sirenix.Utilities")]
[assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")]
[assembly: IgnoresAccessChecksTo("Unity.Formats.Fbx.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")]
[assembly: IgnoresAccessChecksTo("Unity.Postprocessing.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")]
[assembly: IgnoresAccessChecksTo("Unity.Timeline")]
[assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Antlr3.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Core")]
[assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Flow")]
[assembly: IgnoresAccessChecksTo("Unity.VisualScripting.State")]
[assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.UI")]
[assembly: IgnoresAccessChecksTo("websocket-sharp")]
[assembly: AssemblyCompany("OrtonLongGaming")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+ca4e1956341ba23deb272ddd09f0b39bb60c007c")]
[assembly: AssemblyProduct("FNAFLevel")]
[assembly: AssemblyTitle("FNAFLevel")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

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

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

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

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace FNAFLevel
{
	[BepInPlugin("OrtonLongGaming.FNAFLevel", "FNAFLevel", "1.0.2")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class FNAFLevel : BaseUnityPlugin
	{
		public static Level Level;

		public static LevelValuables LevelValuables;

		internal static FNAFLevel Instance { get; private set; }

		internal static ManualLogSource Logger => Instance._logger;

		private ManualLogSource _logger => ((BaseUnityPlugin)this).Logger;

		internal Harmony? Harmony { get; set; }

		private void Awake()
		{
			Instance = this;
			((Component)this).gameObject.transform.parent = null;
			((Object)((Component)this).gameObject).hideFlags = (HideFlags)61;
			Logger.LogInfo((object)$"{((BaseUnityPlugin)this).Info.Metadata.GUID} v{((BaseUnityPlugin)this).Info.Metadata.Version} is loading assets...");
			LoadAssets();
			Logger.LogInfo((object)$"{((BaseUnityPlugin)this).Info.Metadata.GUID} v{((BaseUnityPlugin)this).Info.Metadata.Version} has loaded assets!");
			RegisterLevel();
			RegisterValuables();
			Patch();
			Logger.LogInfo((object)$"{((BaseUnityPlugin)this).Info.Metadata.GUID} v{((BaseUnityPlugin)this).Info.Metadata.Version} has loaded!");
		}

		internal void LoadAssets()
		{
			string text = Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "fnaflevel.bundle");
			AssetBundle val = AssetBundle.LoadFromFile(text);
			Level = val.LoadAsset<Level>("assets/FNAF/Level - FNAF.asset");
			LevelValuables = val.LoadAsset<LevelValuables>("assets/FNAF/FNAFVALUABLES.asset");
			Logger.LogInfo((object)$"{((BaseUnityPlugin)this).Info.Metadata.GUID} v{((BaseUnityPlugin)this).Info.Metadata.Version} has loaded assets!");
		}

		internal void RegisterValuables()
		{
			List<string> list = new List<string> { "Valuables - FNAF" };
			foreach (GameObject item in LevelValuables.tiny)
			{
				Valuables.RegisterValuable(item, list);
				Logger.LogInfo((object)$"{((BaseUnityPlugin)this).Info.Metadata.GUID} v{((BaseUnityPlugin)this).Info.Metadata.Version} registering a Valuable.");
			}
			foreach (GameObject item2 in LevelValuables.small)
			{
				Valuables.RegisterValuable(item2, list);
				Logger.LogInfo((object)$"{((BaseUnityPlugin)this).Info.Metadata.GUID} v{((BaseUnityPlugin)this).Info.Metadata.Version} registering a Valuable.");
			}
			foreach (GameObject item3 in LevelValuables.medium)
			{
				Valuables.RegisterValuable(item3, list);
				Logger.LogInfo((object)$"{((BaseUnityPlugin)this).Info.Metadata.GUID} v{((BaseUnityPlugin)this).Info.Metadata.Version} registering a Valuable.");
			}
			foreach (GameObject item4 in LevelValuables.big)
			{
				Valuables.RegisterValuable(item4, list);
				Logger.LogInfo((object)$"{((BaseUnityPlugin)this).Info.Metadata.GUID} v{((BaseUnityPlugin)this).Info.Metadata.Version} registering a Valuable.");
			}
			foreach (GameObject item5 in LevelValuables.wide)
			{
				Valuables.RegisterValuable(item5, list);
				Logger.LogInfo((object)$"{((BaseUnityPlugin)this).Info.Metadata.GUID} v{((BaseUnityPlugin)this).Info.Metadata.Version} registering a Valuable.");
			}
			foreach (GameObject item6 in LevelValuables.tall)
			{
				Valuables.RegisterValuable(item6, list);
				Logger.LogInfo((object)$"{((BaseUnityPlugin)this).Info.Metadata.GUID} v{((BaseUnityPlugin)this).Info.Metadata.Version} registering a Valuable.");
			}
			foreach (GameObject item7 in LevelValuables.veryTall)
			{
				Valuables.RegisterValuable(item7, list);
				Logger.LogInfo((object)$"{((BaseUnityPlugin)this).Info.Metadata.GUID} v{((BaseUnityPlugin)this).Info.Metadata.Version} registering a Valuable.");
			}
		}

		internal void RegisterLevel()
		{
			Levels.RegisterLevel(Level);
		}

		internal void Patch()
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Expected O, but got Unknown
			//IL_0026: Expected O, but got Unknown
			if (Harmony == null)
			{
				Harmony val = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID);
				Harmony val2 = val;
				Harmony = val;
			}
			Harmony.PatchAll();
		}

		internal void Unpatch()
		{
			Harmony? harmony = Harmony;
			if (harmony != null)
			{
				harmony.UnpatchSelf();
			}
		}

		private void Update()
		{
		}
	}
	public class OfficeDoor : MonoBehaviour
	{
		[CompilerGenerated]
		private sealed class <LateStart>d__20 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public OfficeDoor <>4__this;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <LateStart>d__20(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0029: Unknown result type (might be due to invalid IL or missing references)
				//IL_0033: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					break;
				case 1:
					<>1__state = -1;
					break;
				}
				if (!LevelGenerator.Instance.Generated)
				{
					<>2__current = (object)new WaitForSeconds(0.1f);
					<>1__state = 1;
					return true;
				}
				if (SemiFunc.IsMasterClientOrSingleplayer())
				{
					<>4__this.ActivateDoor();
				}
				return false;
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		public bool Working;

		[Space]
		public GameObject functionObjects;

		public GameObject doorObject;

		public Animator doorAnimator;

		public GameObject hurtCollider;

		public Sound doorCloseSound;

		public Sound doorCloseSoundGlobal;

		public Sound doorButtonSound;

		private PhotonView photonView;

		private StaticGrabObject staticGrabObject;

		private bool closed = true;

		private float timer = 0f;

		public List<Renderer> renderers;

		public Light doorLight;

		private List<Material> sharedMaterials = new List<Material>();

		internal List<Material> instancedMaterials = new List<Material>();

		private int materialColorField;

		private int materialEmissionColorField;

		private void Awake()
		{
			materialColorField = Shader.PropertyToID("_Color");
			materialEmissionColorField = Shader.PropertyToID("_EmissionColor");
			foreach (Renderer renderer in renderers)
			{
				Material val = null;
				foreach (Material sharedMaterial in sharedMaterials)
				{
					if (((Object)renderer.sharedMaterials[1]).name == ((Object)sharedMaterial).name)
					{
						val = sharedMaterial;
						renderer.sharedMaterials[1] = instancedMaterials[sharedMaterials.IndexOf(sharedMaterial)];
					}
				}
				if (!Object.op_Implicit((Object)(object)val))
				{
					val = renderer.sharedMaterials[1];
					sharedMaterials.Add(val);
					instancedMaterials.Add(renderer.materials[1]);
				}
			}
		}

		private void Start()
		{
			photonView = ((Component)this).GetComponent<PhotonView>();
			staticGrabObject = ((Component)this).GetComponent<StaticGrabObject>();
			((MonoBehaviour)this).StartCoroutine(LateStart());
		}

		[IteratorStateMachine(typeof(<LateStart>d__20))]
		private IEnumerator LateStart()
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <LateStart>d__20(0)
			{
				<>4__this = this
			};
		}

		private void ActivateDoor()
		{
			if (!SemiFunc.IsMultiplayer())
			{
				ActivateDoorRPC(Working);
				return;
			}
			photonView.RPC("ActivateDoorRPC", (RpcTarget)0, new object[1] { Working });
		}

		[PunRPC]
		public void ActivateDoorRPC(bool workin)
		{
			doorObject.SetActive(true);
			Working = workin;
		}

		private void Update()
		{
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_0127: 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_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			functionObjects.SetActive(Working);
			if (timer > 0f)
			{
				if (closed && timer > 1f)
				{
					hurtCollider.SetActive(true);
				}
				else
				{
					hurtCollider.SetActive(false);
				}
				timer -= Time.deltaTime;
			}
			else
			{
				hurtCollider.SetActive(false);
			}
			Color val = Color.black;
			if (Working)
			{
				val = (closed ? Color.green : Color.red);
			}
			if (instancedMaterials.Count > 0)
			{
				foreach (Material instancedMaterial in instancedMaterials)
				{
					instancedMaterial.SetColor(materialColorField, val);
					instancedMaterial.SetColor(materialEmissionColorField, val);
				}
			}
			if (Object.op_Implicit((Object)(object)doorLight))
			{
				doorLight.color = val;
			}
		}

		public void ButtonPressed()
		{
			if (SemiFunc.IsMasterClientOrSingleplayer() && !(timer > 0f))
			{
				closed = !closed;
				if (!SemiFunc.IsMultiplayer())
				{
					ActionTimeRPC(closed);
					return;
				}
				photonView.RPC("ActionTimeRPC", (RpcTarget)0, new object[1] { closed });
			}
		}

		[PunRPC]
		public void ActionTimeRPC(bool shouldClose)
		{
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0120: Unknown result type (might be due to invalid IL or missing references)
			timer = 1.5f;
			closed = shouldClose;
			GameDirector.instance.CameraShake.ShakeDistance(8f, 3f, 8f, doorObject.transform.position, 0.5f);
			GameDirector.instance.CameraImpact.ShakeDistance(8f, 3f, 12f, doorObject.transform.position, 0.1f);
			doorAnimator.SetBool("Closed", closed);
			doorCloseSoundGlobal.Play(doorObject.transform.position, 1f, 1f, 1f, 1f);
			doorCloseSound.Play(doorObject.transform.position, 1f, 1f, 1f, 1f);
			if ((Object)(object)renderers[0] != (Object)null)
			{
				doorButtonSound.Play(((Component)renderers[0]).transform.position, 1f, 1f, 1f, 1f);
			}
		}
	}
}
namespace FNAFLevel.SpringBones
{
	public class SpringBones : MonoBehaviour
	{
		private enum Axis
		{
			X,
			Y,
			Z
		}

		private class Item
		{
			private readonly Transform bone;

			private readonly Transform parent;

			private readonly int axis;

			private readonly Vector3 pLookDir;

			private readonly Vector3 pSecDir;

			private Vector3 wBasePos;

			private Vector3 wMassPos;

			private Vector3 delta;

			private Vector3 speed;

			private Vector3 aMain;

			private Vector3 aSec;

			private Quaternion qrot;

			public int deep;

			public Item(Transform bone, int axis, float len)
			{
				//IL_0022: 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)
				//IL_0028: 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_0049: Unknown result type (might be due to invalid IL or missing references)
				//IL_004e: Unknown result type (might be due to invalid IL or missing references)
				//IL_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)
				//IL_0059: Unknown result type (might be due to invalid IL or missing references)
				//IL_005e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0060: Unknown result type (might be due to invalid IL or missing references)
				//IL_0065: Unknown result type (might be due to invalid IL or missing references)
				//IL_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_0070: Unknown result type (might be due to invalid IL or missing references)
				//IL_0075: Unknown result type (might be due to invalid IL or missing references)
				//IL_007a: Unknown result type (might be due to invalid IL or missing references)
				//IL_007f: 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_008b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0092: Unknown result type (might be due to invalid IL or missing references)
				//IL_0097: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
				//IL_00df: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
				//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
				this.bone = bone;
				parent = bone.parent;
				this.axis = axis;
				Vector3 val = Vector3.forward;
				Vector3 val2 = Vector3.up;
				switch (axis)
				{
				case 0:
					val = bone.right;
					val2 = bone.up;
					break;
				case 1:
					val = bone.up;
					val2 = bone.forward;
					break;
				case 2:
					val = bone.forward;
					val2 = bone.right;
					break;
				}
				wBasePos = bone.position + val * len;
				wMassPos = wBasePos;
				if ((Object)(object)parent != (Object)null)
				{
					pLookDir = parent.InverseTransformDirection(val);
					pSecDir = parent.InverseTransformDirection(val2);
				}
				else
				{
					pLookDir = val;
					pSecDir = val2;
				}
				deep = 0;
				Transform val3 = bone;
				while ((Object)(object)val3.parent != (Object)null)
				{
					val3 = val3.parent;
					deep++;
				}
			}

			public void Tick(float rigid, float damping, float length, float impact)
			{
				//IL_0008: Unknown result type (might be due to invalid IL or missing references)
				//IL_002a: Unknown result type (might be due to invalid IL or missing references)
				//IL_002f: 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_0035: Unknown result type (might be due to invalid IL or missing references)
				//IL_003a: Unknown result type (might be due to invalid IL or missing references)
				//IL_003f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0046: 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_0051: Unknown result type (might be due to invalid IL or missing references)
				//IL_0056: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
				//IL_00da: Unknown result type (might be due to invalid IL or missing references)
				//IL_00df: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
				//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
				//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
				//IL_00fe: 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_010d: 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_0119: Unknown result type (might be due to invalid IL or missing references)
				//IL_0124: Unknown result type (might be due to invalid IL or missing references)
				//IL_0129: Unknown result type (might be due to invalid IL or missing references)
				//IL_012e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0131: Unknown result type (might be due to invalid IL or missing references)
				//IL_0136: 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_007d: 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_0149: Unknown result type (might be due to invalid IL or missing references)
				//IL_0153: Unknown result type (might be due to invalid IL or missing references)
				//IL_0158: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
				//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
				//IL_0095: Unknown result type (might be due to invalid IL or missing references)
				//IL_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_0180: Unknown result type (might be due to invalid IL or missing references)
				//IL_0173: Unknown result type (might be due to invalid IL or missing references)
				//IL_0178: Unknown result type (might be due to invalid IL or missing references)
				//IL_0185: Unknown result type (might be due to invalid IL or missing references)
				//IL_018c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0192: 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_019c: Unknown result type (might be due to invalid IL or missing references)
				//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
				//IL_01b3: Unknown result type (might be due to invalid IL or missing references)
				//IL_01c3: Unknown result type (might be due to invalid IL or missing references)
				//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
				//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
				wBasePos = bone.position + (((Object)(object)parent != (Object)null) ? parent.TransformDirection(pLookDir) : pLookDir) * length;
				delta = wBasePos - wMassPos;
				if (((Vector3)(ref delta)).sqrMagnitude > length * length)
				{
					delta = ((Vector3)(ref delta)).normalized * length;
					if (length < 0f)
					{
						delta *= -1f;
					}
					wMassPos = wBasePos - delta;
				}
				speed += rigid * Time.deltaTime * delta;
				speed *= damping;
				wMassPos += speed * Time.deltaTime;
				Vector3 val = wMassPos - bone.position;
				aMain = ((Vector3)(ref val)).normalized;
				if (length < 0f)
				{
					aMain *= -1f;
				}
				aSec = (((Object)(object)parent == (Object)null) ? pSecDir : parent.TransformDirection(pSecDir));
				qrot = Quaternion.LookRotation(aMain, aSec);
				bone.rotation = Quaternion.Lerp(bone.rotation, qrot * QRots[axis], impact);
			}
		}

		private static readonly Quaternion[] QRots = (Quaternion[])(object)new Quaternion[3]
		{
			new Quaternion(0f, -0.7071f, 0f, 0.7071f),
			new Quaternion(0f, 0.7071f, 0.7071f, 0f),
			new Quaternion(0f, 0f, 0.7071f, 0.7071f)
		};

		[SerializeField]
		private float length = 1f;

		[SerializeField]
		private float rigid = 100f;

		[SerializeField]
		[Range(0f, 1f)]
		private float damping = 0.95f;

		[SerializeField]
		[Range(0f, 1f)]
		private float impact = 1f;

		[SerializeField]
		private Axis axis;

		private int iaxis;

		[SerializeField]
		private List<Transform> bones;

		private List<Item> items;

		public bool doUpdate = true;

		private void Awake()
		{
			Init();
		}

		private void Init()
		{
			if (items == null)
			{
				items = new List<Item>();
			}
			items.Clear();
			iaxis = (int)axis;
			for (int i = 0; i < bones.Count; i++)
			{
				if (!((Object)(object)bones[i] == (Object)null))
				{
					items.Add(new Item(bones[i], iaxis, length));
				}
			}
			items.Sort((Item x, Item y) => x.deep.CompareTo(y.deep));
		}

		private void LateUpdate()
		{
			for (int i = 0; i < items.Count; i++)
			{
				items[i].Tick(rigid, 1f - damping, length, impact);
			}
		}

		private void OnDrawGizmosSelected()
		{
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: 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_0070: Unknown result type (might be due to invalid IL or missing references)
			if (bones == null)
			{
				return;
			}
			iaxis = (int)axis;
			for (int i = 0; i < bones.Count; i++)
			{
				if (!((Object)(object)bones[i] == (Object)null))
				{
					Vector3 val = bones[i].position + ((iaxis == 0) ? bones[i].right : ((iaxis == 1) ? bones[i].up : bones[i].forward)) * length;
					Gizmos.DrawLine(bones[i].position, val);
					Gizmos.DrawWireSphere(val, Mathf.Abs(length) / 10f);
				}
			}
		}
	}
}

BepInEx/plugins/RoemisTeam-BlackBox/BlackBox.dll

Decompiled 2 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Photon.Pun;
using REPOLib.Modules;
using TMPro;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: IgnoresAccessChecksTo("Autodesk.Fbx")]
[assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")]
[assembly: IgnoresAccessChecksTo("FbxBuildTestAssets")]
[assembly: IgnoresAccessChecksTo("Klattersynth")]
[assembly: IgnoresAccessChecksTo("Photon3Unity3D")]
[assembly: IgnoresAccessChecksTo("PhotonChat")]
[assembly: IgnoresAccessChecksTo("PhotonRealtime")]
[assembly: IgnoresAccessChecksTo("PhotonUnityNetworking")]
[assembly: IgnoresAccessChecksTo("PhotonUnityNetworking.Utilities")]
[assembly: IgnoresAccessChecksTo("PhotonVoice.API")]
[assembly: IgnoresAccessChecksTo("PhotonVoice")]
[assembly: IgnoresAccessChecksTo("PhotonVoice.PUN")]
[assembly: IgnoresAccessChecksTo("SingularityGroup.HotReload.Runtime")]
[assembly: IgnoresAccessChecksTo("SingularityGroup.HotReload.Runtime.Public")]
[assembly: IgnoresAccessChecksTo("Sirenix.OdinInspector.Attributes")]
[assembly: IgnoresAccessChecksTo("Sirenix.Serialization.Config")]
[assembly: IgnoresAccessChecksTo("Sirenix.Serialization")]
[assembly: IgnoresAccessChecksTo("Sirenix.Utilities")]
[assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")]
[assembly: IgnoresAccessChecksTo("Unity.Formats.Fbx.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")]
[assembly: IgnoresAccessChecksTo("Unity.Postprocessing.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")]
[assembly: IgnoresAccessChecksTo("Unity.Timeline")]
[assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Antlr3.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Core")]
[assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Flow")]
[assembly: IgnoresAccessChecksTo("Unity.VisualScripting.State")]
[assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.UI")]
[assembly: IgnoresAccessChecksTo("websocket-sharp")]
[assembly: AssemblyCompany("Roemi")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("BlackBox")]
[assembly: AssemblyTitle("BlackBox")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

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

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

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

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace Blackbox
{
	[BepInPlugin("Roemi.Blackbox", "Blackbox", "1.0.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Blackbox : BaseUnityPlugin
	{
		internal static class BlackBoxConfig
		{
			public static ConfigEntry<bool>? DisplayRemainingValue { get; private set; }

			public static void Initialize(ConfigFile configFile)
			{
				DisplayRemainingValue = configFile.Bind<bool>("General", "DisplayRemainingValue", true, "Display the current value remaining on the map in the top right of the UI when in the truck.");
			}

			public static bool shouldDisplayRemainingValue()
			{
				if (DisplayRemainingValue == null)
				{
					return false;
				}
				return DisplayRemainingValue.Value;
			}
		}

		public GameObject? itemDmgMonitorShop;

		public GameObject? itemDmgMonitorLevel;

		public MonitorTest? itemDmgMonitorScriptLevel;

		public MonitorTest? itemDmgMonitorScriptShop;

		public ValuableEventTracker valueEventTracker = new ValuableEventTracker();

		public string PostRunStatString = "";

		public string ItemDamageStringShort = "";

		public bool updateShopMonitorFlag = false;

		public Dictionary<string, string> ItemDamageStringDetaied = new Dictionary<string, string>();

		public int currPlayerDisplayed = 0;

		internal static Blackbox Instance { get; private set; }

		internal static ManualLogSource Logger => Instance._logger;

		private ManualLogSource _logger => ((BaseUnityPlugin)this).Logger;

		internal Harmony? Harmony { get; set; }

		private void Awake()
		{
			Instance = this;
			((Component)this).gameObject.transform.parent = null;
			((Object)((Component)this).gameObject).hideFlags = (HideFlags)61;
			AssetBundle val = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)Instance).Info.Location), "mydamagecanvasbundle"));
			if ((Object)(object)val == (Object)null)
			{
				Logger.LogError((object)("Assetbundle required for " + ((BaseUnityPlugin)this).Info.Metadata.GUID + " not found!"));
				return;
			}
			itemDmgMonitorShop = val.LoadAsset<GameObject>("DamageCanvasMultiplayerShop");
			itemDmgMonitorLevel = val.LoadAsset<GameObject>("DamageCanvasMultiplayer");
			NetworkPrefabs.RegisterNetworkPrefab(itemDmgMonitorLevel);
			NetworkPrefabs.RegisterNetworkPrefab(itemDmgMonitorShop);
			Patch();
			Logger.LogInfo((object)$"{((BaseUnityPlugin)this).Info.Metadata.GUID} v{((BaseUnityPlugin)this).Info.Metadata.Version} has loaded!");
		}

		internal void Patch()
		{
			//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_002d: Expected O, but got Unknown
			//IL_0032: Expected O, but got Unknown
			BlackBoxConfig.Initialize(((BaseUnityPlugin)this).Config);
			if (Harmony == null)
			{
				Harmony val = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID);
				Harmony val2 = val;
				Harmony = val;
			}
			Harmony.PatchAll(typeof(PhysGrabObjectImpactDetectorPatch));
			Harmony.PatchAll(typeof(PhysGrabObjectPatch));
			Harmony.PatchAll(typeof(ValuableObjectPatch));
			Harmony.PatchAll(typeof(TruckScreenTextPatch));
			Harmony.PatchAll(typeof(ShopManagerPatch));
			Harmony.PatchAll(typeof(RunManagerPatch));
			Harmony.PatchAll(typeof(SemiFuncPatch));
			Harmony.PatchAll(typeof(HaulUIPatch));
			Harmony.PatchAll(typeof(PlayerHealthPatch));
			Harmony.PatchAll(typeof(HurtColliderPatch));
			Harmony.PatchAll(typeof(EnemyBangPatch));
			Harmony.PatchAll(typeof(EnemyUpscreamAnimPatch));
			Harmony.PatchAll(typeof(FloaterAttackLogicPatch));
			Harmony.PatchAll(typeof(LevelGeneratorPatch));
		}

		internal void Unpatch()
		{
			Harmony? harmony = Harmony;
			if (harmony != null)
			{
				harmony.UnpatchSelf();
			}
		}

		public void addBreakEvent(PhysGrabObjectImpactDetector __instance, float valueLost, bool broken = false)
		{
			valueEventTracker.addBreakEvent(__instance, valueLost, broken);
			updateStrings();
		}

		public void updateStrings()
		{
			ItemDamageStringShort = valueEventTracker.getStatsByPlayerValueLost();
			ItemDamageStringDetaied = valueEventTracker.getDetailedStatsByValueLost();
			PostRunStatString = getPostRunStatString();
		}

		public void updateLevelMonitor()
		{
			Instance.updateStrings();
			string text = "DAMAGE DONE TO ITEMS:\n\n" + ItemDamageStringShort;
			MonitorTest? obj = itemDmgMonitorScriptLevel;
			if (obj != null)
			{
				obj.setText(text.ToUpper(), SemiFunc.IsMultiplayer());
			}
		}

		public void updateShopMonitor()
		{
			string postRunStatString = Instance.PostRunStatString;
			string playerSpecificText = Instance.getPlayerSpecificText();
			string text = postRunStatString + playerSpecificText;
			MonitorTest? obj = itemDmgMonitorScriptShop;
			if (obj != null)
			{
				obj.setText(text.ToUpper(), SemiFunc.IsMultiplayer());
			}
			switchPlayerOnMonitor();
		}

		public string getPlayerSpecificText()
		{
			if (Instance.ItemDamageStringDetaied.Count == 0)
			{
				return "";
			}
			if (currPlayerDisplayed >= 0 && currPlayerDisplayed < Instance.ItemDamageStringDetaied.Count)
			{
				KeyValuePair<string, string> keyValuePair = Instance.ItemDamageStringDetaied.ElementAt(currPlayerDisplayed);
				string text = "<b>" + keyValuePair.Key + "</b>:\n";
				return text + keyValuePair.Value;
			}
			return "";
		}

		public void switchPlayerOnMonitor()
		{
			if (Instance.ItemDamageStringDetaied.Count < 2)
			{
				currPlayerDisplayed = 0;
			}
			else
			{
				currPlayerDisplayed = (currPlayerDisplayed + 1) % Instance.ItemDamageStringDetaied.Count;
			}
		}

		public string getPostRunStatString()
		{
			ValuableEventTracker valuableEventTracker = valueEventTracker;
			string text = "<color=#008000>";
			string text2 = "<color=#BA8E23>";
			string text3 = "<color=#FF0000>";
			string text4 = "</color>";
			string text5 = SemiFunc.DollarGetString((int)Math.Round(valuableEventTracker.totalValueExtracted));
			string text6 = SemiFunc.DollarGetString((int)Math.Round(valuableEventTracker.totalValueSpawnedOnMap));
			string text7 = SemiFunc.DollarGetString((int)Math.Round(valuableEventTracker.totalValueLost));
			return $"Extracted {text}${text5}{text4}({valuableEventTracker.totalNumItemsExtracted} item(s)) / {text}${text6}{text4}({valuableEventTracker.totalNumItems} item(s))\n" + $"Lost {text3}${text7}{text4} in value with {text3}{valuableEventTracker.itemsDestroyed}{text4} item(s) destroyed.\n" + $"Discovered {text2}{valuableEventTracker.itemsDiscovered}{text4} out of {text2}{valuableEventTracker.totalNumItems}{text4} item(s).\n";
		}

		public void CompletedExtraction()
		{
			Instance.updateStrings();
			Logger.LogDebug((object)"Completed Extraction, leaving level!");
		}
	}
	public static class BlackboxHelper
	{
		public static string getCleanedValuableObjectName(string name)
		{
			name = name.Replace("Valuable", "");
			name = name.Replace("(Clone)", "");
			if (name.Contains("Enemy"))
			{
				string[] array = name.Split(" - ");
				name = "ORB ";
				if (array.Length != 2)
				{
					return name;
				}
				name += array[1];
			}
			name = name.TrimStart();
			name = name.TrimEnd();
			return name;
		}

		public static string getNameOfEnemey(Enemy enemy)
		{
			string text = "";
			if (enemy.HasRigidbody)
			{
				return enemy.Rigidbody.enemyParent.enemyName;
			}
			if (Object.op_Implicit((Object)(object)enemy.EnemyParent))
			{
				return enemy.EnemyParent.enemyName;
			}
			return ((Object)enemy).name;
		}
	}
	public class ValuableEventTracker
	{
		public class ItemBreakEvent
		{
			public int ItemID;

			public string ItemName;

			public float ValueOriginal;

			public float ValueLost;

			public List<string> PlayerNamesCausedDamage;

			public bool broke;

			public ItemBreakEvent(int _itemID, string _itemName, float _valueOriginal, float _valueLost, List<string> _playerNamesCausedDamage, bool _broke)
			{
				ItemID = _itemID;
				ItemName = _itemName;
				ValueOriginal = _valueOriginal;
				ValueLost = _valueLost;
				PlayerNamesCausedDamage = _playerNamesCausedDamage;
				broke = _broke;
			}
		}

		public class PlayerDamageEvent
		{
			public enum EntityDamagedType
			{
				Enemy,
				Player,
				TumbleHit,
				Unknown
			}

			public string playerDamaged;

			public string damageSourceEntityName;

			public EntityDamagedType entityType;

			public int damageDone;

			public PlayerDamageEvent(string _playerDamaged, string _damageSourceEntityName, EntityDamagedType _entityType, int _damageDone)
			{
				playerDamaged = _playerDamaged;
				damageSourceEntityName = _damageSourceEntityName;
				entityType = _entityType;
				damageDone = _damageDone;
			}
		}

		public List<ItemBreakEvent> itemBreakEvents = new List<ItemBreakEvent>();

		public List<PlayerDamageEvent> playerDamageEvent = new List<PlayerDamageEvent>();

		public Dictionary<PlayerTumble, string> impactHurtTracker = new Dictionary<PlayerTumble, string>();

		public List<ValuableObject> levelItems = new List<ValuableObject>();

		public float totalValueSpawnedOnMap = 0f;

		public float totalValueLeftOnMap = 0f;

		public float totalValueExtracted = 0f;

		public float totalValueLost = 0f;

		public int totalNumItemsExtracted = 0;

		public int totalNumItems = 0;

		public int itemsDiscovered = 0;

		public int itemsDestroyed = 0;

		public void resetRunStats()
		{
			Blackbox.Logger.LogDebug((object)"Resetting stats.");
			itemBreakEvents.Clear();
			impactHurtTracker.Clear();
			playerDamageEvent.Clear();
			levelItems.Clear();
			totalValueSpawnedOnMap = 0f;
			totalValueLeftOnMap = 0f;
			totalValueExtracted = 0f;
			totalNumItemsExtracted = 0;
			totalValueLost = 0f;
			totalNumItems = 0;
			itemsDiscovered = 0;
			itemsDestroyed = 0;
			Blackbox.Instance.PostRunStatString = "";
			Blackbox.Instance.ItemDamageStringShort = "";
			Blackbox.Instance.ItemDamageStringDetaied.Clear();
		}

		public void runLevelComplete()
		{
			Blackbox.Logger.LogDebug((object)"Leaving run level, clearing references to level objects");
			levelItems.Clear();
			impactHurtTracker.Clear();
			totalValueLeftOnMap = 0f;
		}

		public void addBreakEvent(PhysGrabObjectImpactDetector __instance, float valueLost, bool broken)
		{
			List<string> list = new List<string>();
			foreach (PhysGrabber item2 in __instance.physGrabObject.playerGrabbing)
			{
				list.Add(item2.playerAvatar.playerName);
			}
			if (list.Count == 0)
			{
				if (Object.op_Implicit((Object)(object)__instance.physGrabObject.lastPlayerGrabbing))
				{
					list.Add(__instance.physGrabObject.lastPlayerGrabbing.playerName);
				}
				else
				{
					list.Add("Unknown");
				}
			}
			string cleanedValuableObjectName = BlackboxHelper.getCleanedValuableObjectName(((Object)__instance.valuableObject).name);
			ItemBreakEvent item = new ItemBreakEvent(((Object)__instance).GetInstanceID(), BlackboxHelper.getCleanedValuableObjectName(((Object)__instance.valuableObject).name), __instance.valuableObject.dollarValueOriginal, valueLost, list, broken);
			itemBreakEvents.Add(item);
			totalValueLeftOnMap -= valueLost;
			totalValueLost += valueLost;
			Blackbox.Logger.LogDebug((object)(string.Join(" and ", list) + " damaged " + cleanedValuableObjectName + ". It lost $" + (broken ? __instance.valuableObject.dollarValueCurrent : valueLost) + " in value " + (broken ? "and broke." : ".")));
		}

		public void itemExtractedEvent(ValuableObject valueObj)
		{
			totalNumItemsExtracted++;
			totalValueExtracted += valueObj.dollarValueCurrent;
			totalValueLeftOnMap -= valueObj.dollarValueCurrent;
			levelItems.Remove(valueObj);
		}

		public void discoveredObjectEvent(ValuableObject valueObj)
		{
			itemsDiscovered++;
		}

		public void valuableItemDestroyed(ValuableObject destroyedObj)
		{
			levelItems.Remove(destroyedObj);
			itemsDestroyed++;
		}

		public void addValuableObject(ValuableObject item)
		{
			levelItems.Add(item);
			totalNumItems++;
			totalValueLeftOnMap += item.dollarValueCurrent;
			if (!((Object)item).name.Contains("surplus"))
			{
				totalValueSpawnedOnMap += item.dollarValueCurrent;
			}
		}

		public Dictionary<string, string> getDetailedStatsByValueLost()
		{
			Dictionary<string, Dictionary<int, float>> dictionary = new Dictionary<string, Dictionary<int, float>>();
			Dictionary<int, bool> dictionary2 = new Dictionary<int, bool>();
			Dictionary<int, string> dictionary3 = new Dictionary<int, string>();
			Dictionary<string, string> dictionary4 = new Dictionary<string, string>();
			foreach (ItemBreakEvent itemBreakEvent in itemBreakEvents)
			{
				float num = itemBreakEvent.ValueLost / (float)itemBreakEvent.PlayerNamesCausedDamage.Count;
				if (!dictionary3.ContainsKey(itemBreakEvent.ItemID))
				{
					dictionary3[itemBreakEvent.ItemID] = itemBreakEvent.ItemName;
					dictionary2[itemBreakEvent.ItemID] = itemBreakEvent.broke;
				}
				if (!dictionary2[itemBreakEvent.ItemID])
				{
					dictionary2[itemBreakEvent.ItemID] = itemBreakEvent.broke;
				}
				foreach (string item in itemBreakEvent.PlayerNamesCausedDamage)
				{
					if (!dictionary.ContainsKey(item))
					{
						dictionary[item] = new Dictionary<int, float>();
					}
					if (!dictionary[item].ContainsKey(itemBreakEvent.ItemID))
					{
						dictionary[item][itemBreakEvent.ItemID] = 0f;
					}
					dictionary[item][itemBreakEvent.ItemID] += num;
				}
			}
			foreach (KeyValuePair<string, Dictionary<int, float>> item2 in dictionary)
			{
				string text = "";
				int num2 = 0;
				foreach (KeyValuePair<int, float> item3 in item2.Value)
				{
					string text2 = (dictionary2[item3.Key] ? " - <color=#FF0000>DESTROYED</color>" : "");
					string text3 = SemiFunc.DollarGetString((int)Mathf.Round(item3.Value));
					string cleanedValuableObjectName = BlackboxHelper.getCleanedValuableObjectName(dictionary3[item3.Key]);
					text = text + "   " + cleanedValuableObjectName + " <color=#FF0000>-$<u>" + text3 + "</color></u>" + text2 + "\n";
					num2 += (int)Mathf.Round(item3.Value);
				}
				dictionary4[item2.Key] = "Total: <color=#FF0000>-$<u>" + SemiFunc.DollarGetString(num2) + "</color></u>\n<size=0.1>" + text + "</size>";
			}
			return dictionary4;
		}

		public string getStatsByPlayerValueLost()
		{
			Dictionary<string, float> dictionary = new Dictionary<string, float>();
			Dictionary<int, string> dictionary2 = new Dictionary<int, string>();
			foreach (ItemBreakEvent itemBreakEvent in itemBreakEvents)
			{
				float num = itemBreakEvent.ValueLost / (float)itemBreakEvent.PlayerNamesCausedDamage.Count;
				foreach (string item in itemBreakEvent.PlayerNamesCausedDamage)
				{
					if (!dictionary.ContainsKey(item))
					{
						dictionary[item] = num;
					}
					else
					{
						dictionary[item] += num;
					}
				}
			}
			Dictionary<string, float> dictionary3 = dictionary.OrderByDescending((KeyValuePair<string, float> pair) => pair.Value).ToDictionary((KeyValuePair<string, float> pair) => pair.Key, (KeyValuePair<string, float> pair) => pair.Value);
			StringBuilder stringBuilder = new StringBuilder();
			foreach (KeyValuePair<string, float> item2 in dictionary3)
			{
				string text = SemiFunc.DollarGetString((int)Mathf.Round(item2.Value));
				if (item2.Key == "Unknown")
				{
					stringBuilder.AppendLine("Unknown <color=#FF0000>-$<u>" + text + "</color></u>");
				}
				else
				{
					stringBuilder.AppendLine(item2.Key + " <color=#FF0000>-$<u>" + text + "</color></u>");
				}
			}
			return stringBuilder.ToString();
		}

		public void addNewImpactSource(PlayerTumble target, string sourceName)
		{
			impactHurtTracker[target] = sourceName;
		}

		public void addNewPlayerDamageEvent(string _playerDamaged, string _damageSourceEntityName, PlayerDamageEvent.EntityDamagedType _entityType, int _damageDone)
		{
			PlayerDamageEvent item = new PlayerDamageEvent(_playerDamaged, _damageSourceEntityName, _entityType, _damageDone);
			playerDamageEvent.Add(item);
		}

		public string getTargetCausedTumbleDamage(PlayerTumble target)
		{
			if (impactHurtTracker.ContainsKey(target))
			{
				string result = impactHurtTracker[target];
				impactHurtTracker.Remove(target);
				return result;
			}
			return "";
		}
	}
	[HarmonyPatch(typeof(PhysGrabObjectImpactDetector))]
	internal static class PhysGrabObjectImpactDetectorPatch
	{
		[HarmonyPrefix]
		[HarmonyPatch("BreakRPC")]
		private static void Start_Prefix(PhysGrabObjectImpactDetector __instance, float valueLost, Vector3 _contactPoint, int breakLevel, bool _loseValue)
		{
			if (SemiFunc.RunIsLevel() && _loseValue && Object.op_Implicit((Object)(object)__instance.valuableObject))
			{
				if (__instance.valuableObject.dollarValueCurrent - valueLost < __instance.valuableObject.dollarValueOriginal * 0.15f)
				{
					Blackbox.Instance.addBreakEvent(__instance, __instance.valuableObject.dollarValueCurrent, broken: true);
				}
				else
				{
					Blackbox.Instance.addBreakEvent(__instance, valueLost);
				}
				if (SemiFunc.IsMasterClientOrSingleplayer())
				{
					Blackbox.Instance.updateLevelMonitor();
				}
			}
		}
	}
	[HarmonyPatch(typeof(PhysGrabObject))]
	internal static class PhysGrabObjectPatch
	{
		[HarmonyPrefix]
		[HarmonyPatch("DestroyPhysGrabObjectRPC")]
		private static void DestroyPhysGrabObjectRPC_Prefix(PhysGrabObject __instance)
		{
			if (!SemiFunc.RunIsLevel() || !SemiFunc.IsMasterClientOrSingleplayer())
			{
				return;
			}
			ValuableObject component = ((Component)__instance).GetComponent<ValuableObject>();
			if (!((Object)(object)component == (Object)null))
			{
				if (component.dollarValueCurrent < component.dollarValueOriginal * 0.15f)
				{
					Blackbox.Instance.valueEventTracker.valuableItemDestroyed(component);
					return;
				}
				string cleanedValuableObjectName = BlackboxHelper.getCleanedValuableObjectName(((Object)component).name);
				Blackbox.Logger.LogDebug((object)("Item " + cleanedValuableObjectName + " got extracted"));
				Blackbox.Instance.valueEventTracker.itemExtractedEvent(component);
			}
		}
	}
	[HarmonyPatch(typeof(ValuableObject))]
	internal static class ValuableObjectPatch
	{
		[HarmonyPostfix]
		[HarmonyPatch("DollarValueSetLogic")]
		private static void DollarValueSetLogic_Postfix(ValuableObject __instance)
		{
			if (SemiFunc.RunIsLevel())
			{
				string cleanedValuableObjectName = BlackboxHelper.getCleanedValuableObjectName(((Object)__instance).name);
				Blackbox.Instance.valueEventTracker.addValuableObject(__instance);
				Blackbox.Logger.LogDebug((object)$"Valuable item \"{cleanedValuableObjectName}\" spawned, worth ${__instance.dollarValueCurrent}.");
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch("DollarValueSetRPC")]
		private static void DollarValueSetRPC_Postfix(ValuableObject __instance)
		{
			if (SemiFunc.RunIsLevel())
			{
				string cleanedValuableObjectName = BlackboxHelper.getCleanedValuableObjectName(((Object)__instance).name);
				Blackbox.Instance.valueEventTracker.addValuableObject(__instance);
				Blackbox.Logger.LogDebug((object)$"Valuable item \"{cleanedValuableObjectName}\" spawned, worth ${__instance.dollarValueCurrent}.");
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch("DiscoverRPC")]
		private static void DiscoverRPC_Prefix(ValuableObject __instance)
		{
			string cleanedValuableObjectName = BlackboxHelper.getCleanedValuableObjectName(((Object)__instance).name);
			Blackbox.Instance.valueEventTracker.discoveredObjectEvent(__instance);
			Blackbox.Logger.LogDebug((object)$"Valuable item \"{cleanedValuableObjectName}\" worth ${__instance.dollarValueCurrent} discovered.");
		}
	}
	[HarmonyPatch(typeof(TruckScreenText))]
	internal static class TruckScreenTextPatch
	{
		[HarmonyPrefix]
		[HarmonyPatch("GotoNextLevel")]
		private static void GotoNextLevelPrefix(TruckScreenText __instance)
		{
			Blackbox.Instance.CompletedExtraction();
		}
	}
	[HarmonyPatch(typeof(ShopManager))]
	internal static class ShopManagerPatch
	{
		[CompilerGenerated]
		private sealed class <repeating>d__1 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <repeating>d__1(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0034: Unknown result type (might be due to invalid IL or missing references)
				//IL_003e: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					break;
				case 1:
					<>1__state = -1;
					break;
				}
				if (SemiFunc.RunIsShop() && Blackbox.Instance.updateShopMonitorFlag)
				{
					Blackbox.Instance.updateShopMonitor();
					<>2__current = (object)new WaitForSeconds(4f);
					<>1__state = 1;
					return true;
				}
				return false;
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch("ShopInitialize")]
		private static void ShopInitialize_Postfix(ShopManager __instance)
		{
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: 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_0092: Unknown result type (might be due to invalid IL or missing references)
			if (!SemiFunc.RunIsShop() || (Object)(object)Blackbox.Instance.itemDmgMonitorShop == (Object)null || !SemiFunc.IsMasterClientOrSingleplayer())
			{
				return;
			}
			Vector3 position = Blackbox.Instance.itemDmgMonitorShop.transform.position;
			Quaternion rotation = Blackbox.Instance.itemDmgMonitorShop.transform.rotation;
			GameObject val = (GameManager.Multiplayer() ? PhotonNetwork.Instantiate(((Object)Blackbox.Instance.itemDmgMonitorShop).name, position, rotation, (byte)0, (object[])null) : Object.Instantiate<GameObject>(Blackbox.Instance.itemDmgMonitorShop));
			if ((Object)(object)val == (Object)null)
			{
				Blackbox.Logger.LogError((object)"Unable to instantiate Loss Monitor!");
				return;
			}
			Blackbox.Instance.itemDmgMonitorScriptShop = val.GetComponent<MonitorTest>();
			Blackbox.Instance.currPlayerDisplayed = 0;
			Blackbox.Instance.updateShopMonitor();
			if (SemiFunc.IsMultiplayer())
			{
				Blackbox.Instance.updateShopMonitorFlag = true;
				((MonoBehaviour)__instance).StartCoroutine(repeating());
			}
		}

		[IteratorStateMachine(typeof(<repeating>d__1))]
		private static IEnumerator repeating()
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <repeating>d__1(0);
		}
	}
	[HarmonyPatch(typeof(RunManager))]
	internal static class RunManagerPatch
	{
		[HarmonyPostfix]
		[HarmonyPatch("LeaveToMainMenu")]
		private static void LeaveToMainMenu_Postfix(ShopManager __instance)
		{
			Blackbox.Instance.valueEventTracker.resetRunStats();
			Blackbox.Instance.updateShopMonitorFlag = false;
		}

		[HarmonyPostfix]
		[HarmonyPatch("UpdateLevel")]
		private static void UpdateLevel_Postfix(RunManager __instance)
		{
			if ((Object)(object)__instance.levelCurrent == (Object)(object)__instance.levelShop)
			{
				Blackbox.Instance.valueEventTracker.runLevelComplete();
				return;
			}
			foreach (Level level in __instance.levels)
			{
				if (((Object)level).name == ((Object)__instance.levelCurrent).name)
				{
					Blackbox.Instance.valueEventTracker.resetRunStats();
					Blackbox.Instance.updateShopMonitorFlag = false;
					break;
				}
			}
		}
	}
	[HarmonyPatch(typeof(SemiFunc))]
	internal static class SemiFuncPatch
	{
		[HarmonyPrefix]
		[HarmonyPatch("StatSetSaveLevel")]
		private static void StatSetSaveLevel_Prefix()
		{
			if ((Object)(object)RunManager.instance == (Object)null)
			{
				return;
			}
			if ((Object)(object)RunManager.instance.levelCurrent == (Object)(object)RunManager.instance.levelShop)
			{
				Blackbox.Instance.valueEventTracker.runLevelComplete();
				return;
			}
			foreach (Level level in RunManager.instance.levels)
			{
				if (((Object)level).name == ((Object)RunManager.instance.levelCurrent).name)
				{
					Blackbox.Instance.valueEventTracker.resetRunStats();
					Blackbox.Instance.updateShopMonitorFlag = false;
					break;
				}
			}
		}
	}
	[HarmonyPatch(typeof(LevelGenerator))]
	internal static class LevelGeneratorPatch
	{
		[HarmonyPostfix]
		[HarmonyPatch("GenerateDone")]
		private static void GenerateDone_Postfix(LevelGenerator __instance)
		{
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			if (!SemiFunc.RunIsLevel() || (Object)(object)Blackbox.Instance.itemDmgMonitorLevel == (Object)null || !SemiFunc.IsMasterClientOrSingleplayer())
			{
				return;
			}
			Vector3 val = Blackbox.Instance.itemDmgMonitorLevel.transform.position;
			Quaternion val2 = Blackbox.Instance.itemDmgMonitorLevel.transform.rotation;
			GameObject val3 = GameObject.Find("cctv");
			if ((Object)(object)val3 == (Object)null)
			{
				Blackbox.Logger.LogWarning((object)"Couldnt find CCTV object, Monitor most likely in the wrong spot now.");
			}
			else
			{
				val += val3.transform.position;
				val2 *= val3.transform.rotation;
			}
			GameObject val4 = (GameManager.Multiplayer() ? PhotonNetwork.Instantiate(((Object)Blackbox.Instance.itemDmgMonitorLevel).name, val, val2, (byte)0, (object[])null) : Object.Instantiate<GameObject>(Blackbox.Instance.itemDmgMonitorLevel, val, val2));
			if ((Object)(object)val4 == (Object)null)
			{
				Blackbox.Logger.LogError((object)"Unable to instantiate Loss Monitor!");
				return;
			}
			Blackbox.Instance.itemDmgMonitorScriptLevel = val4.GetComponent<MonitorTest>();
			MonitorTest? itemDmgMonitorScriptLevel = Blackbox.Instance.itemDmgMonitorScriptLevel;
			if (itemDmgMonitorScriptLevel != null)
			{
				itemDmgMonitorScriptLevel.setText("DAMAGE DONE TO ITEMS:\n\n", SemiFunc.IsMultiplayer());
			}
		}
	}
	[HarmonyPatch(typeof(HaulUI))]
	internal static class HaulUIPatch
	{
		[HarmonyPostfix]
		[HarmonyPatch("Update")]
		private static void Update_Postfix(HaulUI __instance)
		{
			if (Blackbox.BlackBoxConfig.shouldDisplayRemainingValue() && SemiFunc.RunIsLevel() && RoundDirector.instance.extractionPointActive && PlayerAvatar.instance.RoomVolumeCheck.inTruck)
			{
				string text = "<color=#558B2F>$</color>";
				int num = (int)Mathf.Round(Blackbox.Instance.valueEventTracker.totalValueLeftOnMap);
				TextMeshProUGUI text2 = __instance.Text;
				((TMP_Text)text2).text = ((TMP_Text)text2).text + "</u> <size=45>//</size> </color>" + text + "<u>" + SemiFunc.DollarGetString(num) + " left";
			}
		}
	}
	[HarmonyPatch(typeof(PlayerHealth))]
	internal static class PlayerHealthPatch
	{
		[HarmonyPrefix]
		[HarmonyPatch("Hurt")]
		private static void Hurt_Prefix(PlayerHealth __instance, int damage, bool savingGrace, int enemyIndex)
		{
			if (__instance.invincibleTimer > 0f || damage <= 0 || (GameManager.Multiplayer() && !__instance.photonView.IsMine) || __instance.playerAvatar.deadSet || __instance.godMode)
			{
				return;
			}
			string playerName = __instance.playerAvatar.playerName;
			Enemy val = SemiFunc.EnemyGetFromIndex(enemyIndex);
			if (Object.op_Implicit((Object)(object)val))
			{
				string nameOfEnemey = BlackboxHelper.getNameOfEnemey(val);
				Blackbox.Instance.valueEventTracker.addNewPlayerDamageEvent(playerName, nameOfEnemey, ValuableEventTracker.PlayerDamageEvent.EntityDamagedType.Enemy, damage);
				return;
			}
			string targetCausedTumbleDamage = Blackbox.Instance.valueEventTracker.getTargetCausedTumbleDamage(__instance.playerAvatar.tumble);
			if (targetCausedTumbleDamage != "")
			{
				Blackbox.Instance.valueEventTracker.addNewPlayerDamageEvent(playerName, targetCausedTumbleDamage, ValuableEventTracker.PlayerDamageEvent.EntityDamagedType.Enemy, damage);
			}
			else if (savingGrace && damage == 5)
			{
				Blackbox.Instance.valueEventTracker.addNewPlayerDamageEvent(playerName, "Unknown", ValuableEventTracker.PlayerDamageEvent.EntityDamagedType.TumbleHit, damage);
			}
		}
	}
	[HarmonyPatch(typeof(HurtCollider))]
	internal static class HurtColliderPatch
	{
		[HarmonyPrefix]
		[HarmonyPatch("PlayerHurt")]
		private static void PlayerHurt_Prefix(HurtCollider __instance, PlayerAvatar _player)
		{
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			if ((!GameManager.Multiplayer() || _player.photonView.IsMine) && !((Object)(object)__instance.enemyHost == (Object)null) && !__instance.playerKill && CanHitOnlyInfo(__instance, ((Component)_player).gameObject, -1f, __instance.playerRayCast, _player.PlayerVisionTarget.VisionTransform.position, (HitType)0) && __instance.playerTumbleTime > 0f)
			{
				string nameOfEnemey = BlackboxHelper.getNameOfEnemey(__instance.enemyHost);
				Blackbox.Instance.valueEventTracker.addNewImpactSource(_player.tumble, nameOfEnemey);
			}
		}

		private static bool CanHitOnlyInfo(HurtCollider __instance, GameObject hitObject, float cooldown, bool raycast, Vector3 hitPosition, HitType hitType)
		{
			//IL_0057: 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_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: 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_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_007d: 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_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: 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_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			foreach (Hit hit in __instance.hits)
			{
				if ((Object)(object)hit.hitObject == (Object)(object)hitObject)
				{
					return false;
				}
			}
			if (raycast)
			{
				Bounds bounds = __instance.Collider.bounds;
				Vector3 val = hitPosition - ((Bounds)(ref bounds)).center;
				Vector3 normalized = ((Vector3)(ref val)).normalized;
				bounds = __instance.Collider.bounds;
				float num = Vector3.Distance(hitPosition, ((Bounds)(ref bounds)).center);
				bounds = __instance.Collider.bounds;
				RaycastHit[] array = Physics.RaycastAll(((Bounds)(ref bounds)).center, normalized, num, LayerMask.op_Implicit(__instance.RayMask), (QueryTriggerInteraction)2);
				for (int i = 0; i < array.Length; i++)
				{
					RaycastHit val2 = array[i];
					if (((Component)((RaycastHit)(ref val2)).collider).gameObject.CompareTag("Wall"))
					{
						PhysGrabObject componentInParent = hitObject.GetComponentInParent<PhysGrabObject>();
						PhysGrabObject componentInParent2 = ((Component)((RaycastHit)(ref val2)).collider).gameObject.GetComponentInParent<PhysGrabObject>();
						if (!Object.op_Implicit((Object)(object)componentInParent) || (Object)(object)componentInParent != (Object)(object)componentInParent2)
						{
							return false;
						}
					}
				}
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(EnemyBang))]
	internal static class EnemyBangPatch
	{
		[HarmonyPostfix]
		[HarmonyPatch("OnDeath")]
		private static void OnDeath_Postfix(EnemyBang __instance)
		{
			if (Object.op_Implicit((Object)(object)__instance.explosionScript))
			{
				__instance.explosionScript.HurtCollider.enemyHost = __instance.enemy;
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch("ExplodeRPC")]
		private static void ExplodeRPC_Postfix(EnemyBang __instance)
		{
			if (Object.op_Implicit((Object)(object)__instance.explosionScript))
			{
				__instance.explosionScript.HurtCollider.enemyHost = __instance.enemy;
			}
		}
	}
	[HarmonyPatch(typeof(EnemyUpscreamAnim))]
	internal static class EnemyUpscreamAnimPatch
	{
		[HarmonyPrefix]
		[HarmonyPatch("AttackImpulse")]
		private static void AttackImpulse_Prefix(EnemyUpscreamAnim __instance)
		{
			if ((!SemiFunc.IsMultiplayer() || SemiFunc.IsMasterClient()) && Object.op_Implicit((Object)(object)__instance.controller.targetPlayer))
			{
				string nameOfEnemey = BlackboxHelper.getNameOfEnemey(__instance.enemy);
				Blackbox.Instance.valueEventTracker.addNewImpactSource(__instance.controller.targetPlayer.tumble, nameOfEnemey);
			}
		}
	}
	[HarmonyPatch(typeof(FloaterAttackLogic))]
	internal static class FloaterAttackLogicPatch
	{
		[HarmonyPrefix]
		[HarmonyPatch("StateSmash")]
		private static void StateSmash_Prefix(FloaterAttackLogic __instance)
		{
			if (!__instance.stateStart || !SemiFunc.IsMasterClientOrSingleplayer())
			{
				return;
			}
			foreach (PlayerAvatar capturedPlayerAvatar in __instance.capturedPlayerAvatars)
			{
				if (Object.op_Implicit((Object)(object)capturedPlayerAvatar) && capturedPlayerAvatar.tumble.isTumbling)
				{
					string nameOfEnemey = BlackboxHelper.getNameOfEnemey(__instance.controller.enemy);
					Blackbox.Instance.valueEventTracker.addNewImpactSource(__instance.controller.targetPlayer.tumble, nameOfEnemey);
				}
			}
		}
	}
}

BepInEx/plugins/RoemisTeam-BlackBox/MonitorTest.dll

Decompiled 2 months ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using Photon.Pun;
using TMPro;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("MonitorTest")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("MonitorTest")]
[assembly: AssemblyTitle("MonitorTest")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace Blackbox;

public class MonitorTest : MonoBehaviour
{
	public TextMeshProUGUI textObj;

	public void Start()
	{
		textObj = ((Component)this).GetComponentInChildren<TextMeshProUGUI>();
		PhotonView component = ((Component)this).GetComponent<PhotonView>();
	}

	[PunRPC]
	public void setTextRPC(string text)
	{
		((TMP_Text)textObj).text = text;
	}

	public void setText(string text, bool multiplayer = true)
	{
		if (!multiplayer)
		{
			setTextRPC(text);
			return;
		}
		PhotonView component = ((Component)this).GetComponent<PhotonView>();
		component.RPC("setTextRPC", (RpcTarget)0, new object[1] { text });
	}
}

BepInEx/plugins/SaturnKai-Dead_Map_Access/DeadMapAccess.dll

Decompiled 2 months ago
using System;
using System.Collections;
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.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Photon.Pun;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: IgnoresAccessChecksTo("Autodesk.Fbx")]
[assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")]
[assembly: IgnoresAccessChecksTo("FbxBuildTestAssets")]
[assembly: IgnoresAccessChecksTo("Klattersynth")]
[assembly: IgnoresAccessChecksTo("Photon3Unity3D")]
[assembly: IgnoresAccessChecksTo("PhotonChat")]
[assembly: IgnoresAccessChecksTo("PhotonRealtime")]
[assembly: IgnoresAccessChecksTo("PhotonUnityNetworking")]
[assembly: IgnoresAccessChecksTo("PhotonUnityNetworking.Utilities")]
[assembly: IgnoresAccessChecksTo("PhotonVoice.API")]
[assembly: IgnoresAccessChecksTo("PhotonVoice")]
[assembly: IgnoresAccessChecksTo("PhotonVoice.PUN")]
[assembly: IgnoresAccessChecksTo("SingularityGroup.HotReload.Runtime")]
[assembly: IgnoresAccessChecksTo("SingularityGroup.HotReload.Runtime.Public")]
[assembly: IgnoresAccessChecksTo("Sirenix.OdinInspector.Attributes")]
[assembly: IgnoresAccessChecksTo("Sirenix.Serialization.Config")]
[assembly: IgnoresAccessChecksTo("Sirenix.Serialization")]
[assembly: IgnoresAccessChecksTo("Sirenix.Utilities")]
[assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")]
[assembly: IgnoresAccessChecksTo("Unity.Formats.Fbx.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")]
[assembly: IgnoresAccessChecksTo("Unity.Postprocessing.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")]
[assembly: IgnoresAccessChecksTo("Unity.Timeline")]
[assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Antlr3.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Core")]
[assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Flow")]
[assembly: IgnoresAccessChecksTo("Unity.VisualScripting.State")]
[assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.UI")]
[assembly: IgnoresAccessChecksTo("websocket-sharp")]
[assembly: AssemblyCompany("SaturnKai")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.4.0")]
[assembly: AssemblyInformationalVersion("1.0.4+a79dee4aa0fca7a6cd5ff757e184d547a209136b")]
[assembly: AssemblyProduct("DeadMapAccess")]
[assembly: AssemblyTitle("DeadMapAccess")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.4.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 DeadMapAccess
{
	internal static class Configuration
	{
		internal static Color borderColor = Color32.op_Implicit(new Color32((byte)19, (byte)19, (byte)19, byte.MaxValue));

		internal static ConfigEntry<float> width = null;

		internal static ConfigEntry<float> height = null;

		internal static ConfigEntry<int> borderSize = null;

		internal static ConfigEntry<bool> toggle = null;

		internal static ConfigEntry<bool> showUpgrades = null;

		internal static ConfigEntry<bool> hideValuables = null;

		internal static void Init(ConfigFile config)
		{
			width = config.Bind<float>("General", "Width", 600f, "The width of the map.");
			height = config.Bind<float>("General", "Height", 600f, "The height of the map.");
			borderSize = config.Bind<int>("General", "Border", 6, "The size of the map border.");
			toggle = config.Bind<bool>("General", "Toggle", false, "Set the map to toggle instead of hold.");
			showUpgrades = config.Bind<bool>("General", "ShowUpgrades", true, "Show upgrades while the map is shown.");
			hideValuables = config.Bind<bool>("Host", "HideValuables", false, "Force hide valuables on the map for all spectating players (only works when you are host).");
		}
	}
	[BepInPlugin("dev.saturnkai.deadmapaccess", "DeadMapAccess", "1.0.4")]
	public class DeadMap : BaseUnityPlugin
	{
		internal static RenderTexture? renderTexture = null;

		internal static Camera? camera = null;

		internal static float cameraOrthographicDefault = 2.5f;

		internal static bool spectating = false;

		internal static bool hideValuables = false;

		private bool active;

		private bool activePrev;

		private readonly float scaleSpeed = 5f;

		private float scale = 0.5f;

		private float targetScale = 1f;

		private readonly float zoomSpeed = 0.2f;

		private readonly float zoomMin = 1f;

		private readonly float zoomMax = 20f;

		internal static DeadMap Instance { get; private set; } = null;


		internal static ManualLogSource Logger => Instance._logger;

		internal Harmony? Harmony { get; set; }

		private ManualLogSource _logger => ((BaseUnityPlugin)this).Logger;

		private void Awake()
		{
			//IL_0048: 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_004f: Expected O, but got Unknown
			//IL_0054: Expected O, but got Unknown
			Instance = this;
			((Component)this).gameObject.transform.parent = null;
			((Object)((Component)this).gameObject).hideFlags = (HideFlags)61;
			Configuration.Init(((BaseUnityPlugin)this).Config);
			if (Harmony == null)
			{
				Harmony val = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID);
				Harmony val2 = val;
				Harmony = val;
			}
			Harmony.PatchAll();
			Logger.LogInfo((object)$"{((BaseUnityPlugin)this).Info.Metadata.GUID} v{((BaseUnityPlugin)this).Info.Metadata.Version} has loaded!");
		}

		internal void Unpatch()
		{
			Harmony? harmony = Harmony;
			if (harmony != null)
			{
				harmony.UnpatchSelf();
			}
		}

		private void Update()
		{
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Invalid comparison between Unknown and I4
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_014e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0153: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			if (Configuration.toggle.Value && spectating)
			{
				if (SemiFunc.InputDown((InputKey)8))
				{
					active = !active;
				}
			}
			else if (spectating)
			{
				active = SemiFunc.InputHold((InputKey)8);
			}
			targetScale = (active ? 1f : 0.5f);
			scale = Mathf.Lerp(scale, targetScale, Time.deltaTime * scaleSpeed);
			if (!spectating || !((Object)(object)SpectateCamera.instance != (Object)null) || (int)SpectateCamera.instance.currentState != 1)
			{
				return;
			}
			Transform transform = ((Component)SpectateCamera.instance).transform;
			if ((Object)(object)DirtFinderMapPlayer.Instance.PlayerTransform == (Object)null)
			{
				Logger.LogWarning((object)"DirtFinderMapPlayer transform null.");
				DirtFinderMapPlayer.Instance.PlayerTransform = new GameObject().transform;
			}
			DirtFinderMapPlayer.Instance.PlayerTransform.position = transform.position;
			Transform playerTransform = DirtFinderMapPlayer.Instance.PlayerTransform;
			Quaternion rotation = transform.rotation;
			float y = ((Quaternion)(ref rotation)).eulerAngles.y;
			rotation = transform.rotation;
			playerTransform.rotation = Quaternion.Euler(0f, y, ((Quaternion)(ref rotation)).eulerAngles.z);
			PlayerController.instance.playerAvatarScript.LastNavmeshPosition = SpectateCamera.instance.player.LastNavmeshPosition;
			if (active && Configuration.showUpgrades.Value)
			{
				((SemiUI)StatsUI.instance).Show();
			}
			if (active)
			{
				float num = SemiFunc.InputScrollY() * 0.01f;
				if (num != 0f && (Object)(object)camera != (Object)null)
				{
					Camera? obj = camera;
					obj.orthographicSize -= num * zoomSpeed;
					camera.orthographicSize = Mathf.Clamp(camera.orthographicSize, zoomMin, zoomMax);
				}
			}
		}

		private void OnGUI()
		{
			//IL_013d: 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_0153: Unknown result type (might be due to invalid IL or missing references)
			//IL_0161: 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)
			if (!spectating)
			{
				return;
			}
			if (active != activePrev)
			{
				activePrev = active;
				Sound val = (activePrev ? PlayerAvatar.instance.mapToolController.SoundStart : PlayerAvatar.instance.mapToolController.SoundStop);
				if ((Object)(object)SpectateCamera.instance != (Object)null)
				{
					val.Play(((Component)SpectateCamera.instance).transform.position, 1f, 1f, 1f, 1f);
				}
			}
			Map.Instance.Active = active;
			if (!active)
			{
				targetScale = 0.5f;
				return;
			}
			CameraTopFade.Instance.Set(0.5f, 0.1f);
			float num = Configuration.width.Value * scale;
			float num2 = Configuration.height.Value * scale;
			float num3 = ((float)Screen.width - num) / 2f;
			float num4 = ((float)Screen.height - num2) / 2f;
			Rect val2 = default(Rect);
			((Rect)(ref val2))..ctor(num3 - (float)Configuration.borderSize.Value, num4 - (float)Configuration.borderSize.Value, num + (float)(Configuration.borderSize.Value * 2), num2 + (float)(Configuration.borderSize.Value * 2));
			GUI.color = Configuration.borderColor;
			GUI.DrawTexture(val2, (Texture)(object)Texture2D.whiteTexture);
			GUI.color = Color.white;
			GUI.DrawTexture(new Rect(num3, num4, num, num2), (Texture)(object)renderTexture, (ScaleMode)0, false);
		}

		internal static void SetSpectating(bool isSpectating)
		{
			spectating = isSpectating;
			if ((Object)(object)camera != (Object)null)
			{
				camera.orthographicSize = cameraOrthographicDefault;
			}
			if (hideValuables)
			{
				MapValuable[] componentsInChildren = ((Component)Map.Instance.OverLayerParent).GetComponentsInChildren<MapValuable>(true);
				MapValuable[] array = componentsInChildren;
				foreach (MapValuable val in array)
				{
					((Component)val).gameObject.SetActive(!spectating);
				}
			}
		}
	}
	internal class NetworkController : MonoBehaviourPun
	{
		[PunRPC]
		internal void HideValuables()
		{
			if (!DeadMap.hideValuables)
			{
				DeadMap.hideValuables = true;
				DeadMap.Logger.LogInfo((object)"Valuables set to hidden.");
			}
		}
	}
}
namespace DeadMapAccess.patches
{
	[HarmonyPatch(typeof(DirtFinderMapPlayer))]
	internal static class DirtFinderMapPlayerPatch
	{
		[HarmonyPostfix]
		[HarmonyPatch("Awake")]
		private static void Awake_Postfix(DirtFinderMapPlayer __instance)
		{
			Camera componentInChildren = ((Component)__instance).GetComponentInChildren<Camera>();
			if (((Object)componentInChildren).name != "Dirt Finder Map Camera")
			{
				DeadMap.Logger.LogWarning((object)"Dirt Finder Map Camera not found in map children.");
			}
			else if ((Object)(object)DeadMap.camera == (Object)null)
			{
				DeadMap.camera = componentInChildren;
				DeadMap.cameraOrthographicDefault = componentInChildren.orthographicSize;
			}
		}
	}
	[HarmonyPatch(typeof(GameDirector))]
	internal static class GameDirectorPatch
	{
		[HarmonyPrefix]
		[HarmonyPatch("Revive")]
		private static void Revive_Prefix()
		{
			if (DeadMap.spectating)
			{
				DeadMap.SetSpectating(isSpectating: false);
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch("gameStateStart")]
		private static void GameStateStart_Prefix()
		{
			if (SemiFunc.IsMasterClient() && Configuration.hideValuables.Value)
			{
				NetworkController component = ((Component)Map.Instance).gameObject.GetComponent<NetworkController>();
				if ((Object)(object)component == (Object)null)
				{
					DeadMap.Logger.LogWarning((object)"Failed to send hide valuables event: Network controller is null.");
					return;
				}
				((MonoBehaviourPun)component).photonView.RPC("HideValuables", (RpcTarget)0, new object[0]);
			}
			if (DeadMap.spectating)
			{
				DeadMap.SetSpectating(isSpectating: false);
			}
		}
	}
	[HarmonyPatch(typeof(Map))]
	internal static class MapPatch
	{
		[HarmonyPostfix]
		[HarmonyPatch("Awake")]
		private static void Awake_Postfix(Map __instance)
		{
			if ((Object)(object)((Component)__instance).gameObject.GetComponent<NetworkController>() == (Object)null)
			{
				((Component)__instance).gameObject.AddComponent<NetworkController>();
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch("AddValuable")]
		private static void AddValuable_Postfix(Map __instance)
		{
			if (DeadMap.spectating && DeadMap.hideValuables)
			{
				MapValuable[] componentsInChildren = ((Component)__instance.OverLayerParent).GetComponentsInChildren<MapValuable>();
				MapValuable[] array = componentsInChildren;
				foreach (MapValuable val in array)
				{
					((Component)val).gameObject.SetActive(false);
				}
			}
		}
	}
	[HarmonyPatch(typeof(PlayerAvatar))]
	internal static class PlayerAvatarPatch
	{
		[HarmonyPrefix]
		[HarmonyPatch("SetSpectate")]
		private static void SetSpectate_Prefix()
		{
			Map.Instance.ActiveParent.SetActive(true);
			if ((Object)(object)DeadMap.camera != (Object)null)
			{
				((MonoBehaviour)Map.Instance).StartCoroutine(LoadRenderTexture(DeadMap.camera));
			}
		}

		private static IEnumerator LoadRenderTexture(Camera camera)
		{
			RenderTexture activeTexture = camera.activeTexture;
			while ((Object)(object)activeTexture == (Object)null)
			{
				yield return null;
				activeTexture = camera.activeTexture;
			}
			DeadMap.renderTexture = activeTexture;
			DeadMap.Logger.LogInfo((object)"Loaded map render texture.");
		}
	}
	[HarmonyPatch(typeof(RoundDirector))]
	internal static class RoundDirectorPatch
	{
		[HarmonyPostfix]
		[HarmonyPatch("StartRound")]
		private static void StartRound_Postfix()
		{
			DeadMap.hideValuables = false;
		}
	}
	[HarmonyPatch(typeof(SpectateCamera))]
	internal static class SpectateCameraPatch
	{
		[HarmonyPrefix]
		[HarmonyPatch("StateNormal")]
		private static void StateNormal_Prefix()
		{
			if ((SemiFunc.RunIsLevel() || SemiFunc.RunIsShop()) && !DeadMap.spectating && (Object)(object)SpectateCamera.instance.player != (Object)null)
			{
				DeadMap.SetSpectating(isSpectating: true);
			}
		}
	}
}

BepInEx/plugins/Tansinator-Map_Value_Tracker/MapValueTracker.dll

Decompiled 2 months ago
using System;
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 BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using MapValueTracker.Config;
using Microsoft.CodeAnalysis;
using TMPro;
using UnityEngine;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("MapValueTracker")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.2.2.0")]
[assembly: AssemblyInformationalVersion("1.2.2+487376b9015d76a9cb2dcb327d3146692bcd3575")]
[assembly: AssemblyProduct("MapValueTracker")]
[assembly: AssemblyTitle("MapValueTracker")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.2.2.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 MapValueTracker
{
	[BepInPlugin("MapValueTracker", "MapValueTracker", "1.2.2")]
	public class MapValueTracker : BaseUnityPlugin
	{
		public const string PLUGIN_GUID = "MapValueTracker";

		public const string PLUGIN_NAME = "MapValueTracker";

		public const string PLUGIN_VERSION = "1.2.2";

		public static ManualLogSource Logger;

		private readonly Harmony harmony = new Harmony("Tansinator.REPO.MapValueTracker");

		public static MapValueTracker instance;

		public static GameObject textInstance;

		public static TextMeshProUGUI valueText;

		public static float totalValue;

		public static float totalValueInit;

		public void Awake()
		{
			Logger = ((BaseUnityPlugin)this).Logger;
			Logger.LogInfo((object)"Plugin MapValueTracker is loaded!");
			if ((Object)(object)instance == (Object)null)
			{
				instance = this;
			}
			Configuration.Init(((BaseUnityPlugin)this).Config);
			harmony.PatchAll();
		}

		public static void ResetValues()
		{
			if (!SemiFunc.RunIsLevel())
			{
				totalValue = 0f;
			}
			Logger.LogDebug((object)"In ResetValues()");
			Logger.LogDebug((object)("Total Map Value: " + totalValue));
		}

		public static void CheckForItems(ValuableObject ignoreThis = null)
		{
			if (!Traverse.Create((object)RoundDirector.instance).Field("allExtractionPointsCompleted").GetValue<bool>())
			{
				totalValue = 0f;
				List<ValuableObject> list = Object.FindObjectsOfType<ValuableObject>().ToList();
				if ((Object)(object)ignoreThis != (Object)null)
				{
					list.Remove(ignoreThis);
				}
				for (int i = 0; i < list.Count; i++)
				{
					totalValue += list[i].dollarValueCurrent;
				}
				Logger.LogDebug((object)("After CheckForItems Total Val: " + totalValue));
			}
		}
	}
	public class MyOnDestroy : MonoBehaviour
	{
		private void OnDestroy()
		{
			MapValueTracker.Logger.LogDebug((object)"Destroying!");
			ValuableObject component = ((Component)this).GetComponent<ValuableObject>();
			MapValueTracker.Logger.LogDebug((object)("Destroyed Valuable Object! " + ((Object)component).name + " Val: " + component.dollarValueCurrent));
			MapValueTracker.totalValue -= component.dollarValueCurrent;
			MapValueTracker.Logger.LogDebug((object)("Total Val: " + MapValueTracker.totalValue));
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "MapValueTracker";

		public const string PLUGIN_NAME = "MapValueTracker";

		public const string PLUGIN_VERSION = "1.2.2";
	}
}
namespace MapValueTracker.Patches
{
	[HarmonyPatch(typeof(LevelGenerator))]
	internal static class LevelGeneratorPatches
	{
		[HarmonyPatch("StartRoomGeneration")]
		[HarmonyPrefix]
		public static void StartRoomGeneration()
		{
			MapValueTracker.Logger.LogDebug((object)"Generating Started. Resetting to zero.");
			MapValueTracker.ResetValues();
			MapValueTracker.Logger.LogDebug((object)("Room generation started. Now val is " + MapValueTracker.totalValue));
		}

		[HarmonyPatch("GenerateDone")]
		[HarmonyPrefix]
		public static void GenerateDonePostfix()
		{
			MapValueTracker.Logger.LogDebug((object)"Generating Started. Resetting to zero.");
			MapValueTracker.CheckForItems();
			MapValueTracker.totalValueInit = MapValueTracker.totalValue;
			MapValueTracker.Logger.LogDebug((object)("Generation done. Now val is " + MapValueTracker.totalValue + ". Init Value: " + MapValueTracker.totalValueInit));
		}
	}
	[HarmonyPatch(typeof(PhysGrabObjectImpactDetector))]
	public static class PhysGrabObjectImpactDetectorPatches
	{
		[HarmonyPatch("BreakRPC")]
		[HarmonyPostfix]
		private static void StartPostFix(float valueLost, PhysGrabObjectImpactDetector? __instance, bool _loseValue)
		{
			if (_loseValue)
			{
				MapValueTracker.Logger.LogDebug((object)("BreakRPC - Current Value: " + MapValueTracker.totalValue));
				ValuableObject obj = ((__instance != null) ? ((Component)__instance).GetComponent<ValuableObject>() : null);
				MapValueTracker.Logger.LogDebug((object)("BreakRPC - Valuable Object current value: " + obj?.dollarValueCurrent));
				MapValueTracker.Logger.LogDebug((object)("BreakRPC - Value lost: " + valueLost));
				MapValueTracker.totalValue -= valueLost;
				MapValueTracker.Logger.LogDebug((object)("BreakRPC - After Break Value: " + MapValueTracker.totalValue));
			}
		}

		[HarmonyPatch(typeof(PhysGrabObject), "DestroyPhysGrabObjectRPC")]
		[HarmonyPostfix]
		public static void DestroyPhysGrabObjectPostfix(PhysGrabObject __instance)
		{
			if (!SemiFunc.RunIsLevel())
			{
				return;
			}
			ValuableObject component = ((Component)__instance).GetComponent<ValuableObject>();
			if (!((Object)(object)component == (Object)null))
			{
				MapValueTracker.Logger.LogDebug((object)"Destroying (DPGO)!");
				MapValueTracker.Logger.LogDebug((object)("Destroyed Valuable Object! " + ((Object)component).name + " Val: " + component.dollarValueCurrent));
				if (component.dollarValueCurrent < component.dollarValueOriginal * 0.15f)
				{
					MapValueTracker.totalValue -= 0f;
				}
				else
				{
					MapValueTracker.totalValue -= component.dollarValueCurrent;
				}
				MapValueTracker.Logger.LogDebug((object)("After DPGO Map Remaining Val: " + MapValueTracker.totalValue));
			}
		}
	}
	[HarmonyPatch(typeof(RoundDirector))]
	public static class RoundDirectorPatches
	{
		[HarmonyPatch("ExtractionCompleted")]
		[HarmonyPostfix]
		public static void ExtractionComplete()
		{
			if (SemiFunc.RunIsLevel())
			{
				MapValueTracker.Logger.LogDebug((object)"Extraction Completed!");
				MapValueTracker.CheckForItems();
				MapValueTracker.Logger.LogDebug((object)("Checked after Extraction. Val is " + MapValueTracker.totalValue));
			}
		}

		[HarmonyPatch(typeof(RoundDirector), "Update")]
		[HarmonyPostfix]
		public static void UpdateUI()
		{
			//IL_02c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0307: Unknown result type (might be due to invalid IL or missing references)
			//IL_031e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0335: Unknown result type (might be due to invalid IL or missing references)
			//IL_034c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Expected O, but got Unknown
			//IL_0128: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: 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_01c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01de: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_020c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0223: Unknown result type (might be due to invalid IL or missing references)
			//IL_023a: Unknown result type (might be due to invalid IL or missing references)
			int? num = Traverse.Create((object)RoundDirector.instance).Field("extractionHaulGoal").GetValue<int>();
			bool value = Traverse.Create((object)RoundDirector.instance).Field("extractionPointActive").GetValue<bool>();
			bool value2 = Traverse.Create((object)RoundDirector.instance).Field("allExtractionPointsCompleted").GetValue<bool>();
			if (!SemiFunc.RunIsLevel())
			{
				return;
			}
			if ((Object)(object)MapValueTracker.textInstance == (Object)null)
			{
				GameObject val = GameObject.Find("Game Hud");
				GameObject val2 = GameObject.Find("Tax Haul");
				if (!((Object)(object)val == (Object)null) && !((Object)(object)val2 == (Object)null))
				{
					TMP_FontAsset font = val2.GetComponent<TMP_Text>().font;
					MapValueTracker.textInstance = new GameObject();
					MapValueTracker.textInstance.SetActive(false);
					((Object)MapValueTracker.textInstance).name = "Value HUD";
					MapValueTracker.textInstance.AddComponent<TextMeshProUGUI>();
					MapValueTracker.valueText = MapValueTracker.textInstance.GetComponent<TextMeshProUGUI>();
					((TMP_Text)MapValueTracker.valueText).font = font;
					((Graphic)MapValueTracker.valueText).color = Color.op_Implicit(new Vector4(0.7882f, 0.9137f, 0.902f, 1f));
					((TMP_Text)MapValueTracker.valueText).fontSize = 24f;
					((TMP_Text)MapValueTracker.valueText).enableWordWrapping = false;
					((TMP_Text)MapValueTracker.valueText).alignment = (TextAlignmentOptions)2052;
					((TMP_Text)MapValueTracker.valueText).horizontalAlignment = (HorizontalAlignmentOptions)4;
					((TMP_Text)MapValueTracker.valueText).verticalAlignment = (VerticalAlignmentOptions)2048;
					MapValueTracker.textInstance.transform.SetParent(val.transform, false);
					RectTransform component = MapValueTracker.textInstance.GetComponent<RectTransform>();
					component.pivot = new Vector2(1f, 1f);
					component.anchoredPosition = new Vector2(1f, -1f);
					component.anchorMin = new Vector2(0f, 0f);
					component.anchorMax = new Vector2(1f, 0f);
					component.sizeDelta = new Vector2(0f, 0f);
					component.offsetMax = new Vector2(0f, 225f);
					component.offsetMin = new Vector2(0f, 225f);
				}
			}
			else if ((Object)(object)MapValueTracker.valueText != (Object)null && ((num.HasValue && num != 0) || !value2))
			{
				bool value3 = Traverse.Create((object)MapToolController.instance).Field("mapToggled").GetValue<bool>();
				RectTransform component2 = MapValueTracker.textInstance.GetComponent<RectTransform>();
				component2.pivot = new Vector2(1f, 1f);
				component2.anchoredPosition = new Vector2(1f, -1f);
				component2.anchorMin = new Vector2(0f, 0f);
				component2.anchorMax = new Vector2(1f, 0f);
				component2.sizeDelta = new Vector2(0f, 0f);
				component2.offsetMax = new Vector2(0f, 225f);
				component2.offsetMin = new Vector2(0f, 225f);
				if (Configuration.StartingValueOnly.Value)
				{
					((TMP_Text)MapValueTracker.valueText).SetText("Map: $" + MapValueTracker.totalValueInit.ToString("N0"), true);
				}
				else
				{
					((TMP_Text)MapValueTracker.valueText).SetText("Map: $" + MapValueTracker.totalValue.ToString("N0"), true);
				}
				if (Configuration.AlwaysOn.Value)
				{
					MapValueTracker.textInstance.SetActive(true);
				}
				else if (Configuration.UseValueRatio.Value)
				{
					if (MapValueTracker.totalValue / (float)num.Value <= Configuration.ValueRatio.Value)
					{
						MapValueTracker.textInstance.SetActive(true);
					}
					else
					{
						MapValueTracker.textInstance.SetActive(false);
					}
				}
				else if (SemiFunc.InputHold((InputKey)8) || value3)
				{
					MapValueTracker.textInstance.SetActive(true);
				}
				else
				{
					MapValueTracker.textInstance.SetActive(false);
				}
			}
			else
			{
				MapValueTracker.textInstance.SetActive(false);
			}
		}
	}
	[HarmonyPatch(typeof(ValuableObject))]
	internal static class ValuableObjectPatches
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		private static void Start(ValuableObject __instance)
		{
		}

		[HarmonyPatch("DollarValueSetRPC")]
		[HarmonyPostfix]
		private static void DollarValueSet(ValuableObject __instance, float value)
		{
			MapValueTracker.Logger.LogDebug((object)("Created Valuable Object! " + ((Object)__instance).name + " Val: " + value));
			MapValueTracker.totalValue += value;
			MapValueTracker.Logger.LogDebug((object)("After dollar value set Total Val: " + MapValueTracker.totalValue));
		}

		[HarmonyPatch("DollarValueSetLogic")]
		[HarmonyPostfix]
		private static void DollarValueSetLogic(ValuableObject __instance)
		{
			if (SemiFunc.IsMasterClientOrSingleplayer())
			{
				MapValueTracker.Logger.LogDebug((object)("Created Valuable Object! " + ((Object)__instance).name + " Val: " + __instance.dollarValueCurrent));
				MapValueTracker.totalValue += __instance.dollarValueCurrent;
				MapValueTracker.Logger.LogDebug((object)("After dollar value set Total Val: " + MapValueTracker.totalValue));
			}
		}
	}
}
namespace MapValueTracker.Config
{
	internal class Configuration
	{
		public static ConfigEntry<bool> AlwaysOn;

		public static ConfigEntry<bool> StartingValueOnly;

		public static ConfigEntry<bool> UseValueRatio;

		public static ConfigEntry<float> ValueRatio;

		public static void Init(ConfigFile config)
		{
			config.SaveOnConfigSet = false;
			AlwaysOn = config.Bind<bool>("Default", "AlwaysOn", true, "Toggle to always display map value when an extraction goal is active. If false, use the menu key to pull up the tracker (Tab by default).");
			StartingValueOnly = config.Bind<bool>("Default", "StartingValueOnly", false, "Toggle to keep the Map Value fixed to the level's initially generated value. Will not update value in real time from breaking items, killing enemies, or extracting loot. Should not be used with UseValueRatio set to true.");
			UseValueRatio = config.Bind<bool>("Default", "UseValueRatio", false, "Toggle to use value ratio to display Map Valuables. AlwaysOn must be false and this must be true to take effect.");
			ValueRatio = config.Bind<float>("Default", "ValueRatio", 2f, "Ratio of Map Value to Extraction Goal. UseValueRatio must be true to take effect. Ex: 20k map value to 10k goal is 2.0 ");
			ClearOrphanedEntries(config);
			config.Save();
			config.SaveOnConfigSet = true;
		}

		private static void ClearOrphanedEntries(ConfigFile cfg)
		{
			PropertyInfo propertyInfo = AccessTools.Property(typeof(ConfigFile), "OrphanedEntries");
			Dictionary<ConfigDefinition, string> dictionary = (Dictionary<ConfigDefinition, string>)propertyInfo.GetValue(cfg);
			dictionary.Clear();
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}

BepInEx/plugins/upgame-DurableBatteryArea/DurableBatteryArea.dll

Decompiled 2 months ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using DurableBatteryArea.Patches;
using HarmonyLib;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("DurableBatteryArea")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("DurableBatteryArea")]
[assembly: AssemblyCopyright("Copyright ©  2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("2ddfcb1a-b23e-4c2e-b28e-2211e58be5b8")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
public class DurableCrystalStateData
{
	public float ChargeSegments { get; set; }

	public float ChargeRate { get; set; }

	public DurableCrystalStateData(float chargeSegments, float chargeRate)
	{
		ChargeSegments = chargeSegments;
		ChargeRate = chargeRate;
	}
}
public static class Log
{
	public static ManualLogSource _logSource;

	static Log()
	{
		_logSource = Logger.CreateLogSource("Durable Battery Area");
	}

	public static void LogInfo(object data)
	{
		_logSource.LogInfo(data);
	}

	public static void LogWarning(object data)
	{
		_logSource.LogWarning(data);
	}

	public static void LogError(object data)
	{
		_logSource.LogError(data);
	}

	public static void LogDebug(object data)
	{
		_logSource.LogDebug(data);
	}

	public static void LogFatal(object data)
	{
		_logSource.LogFatal(data);
	}

	public static void LogMessage(object data)
	{
		_logSource.LogMessage(data);
	}
}
namespace DurableBatteryArea
{
	[BepInPlugin("upgame.REPO.DurableBatteryArea", "Durable Battery Area", "1.0.0")]
	public class PluginBase : BaseUnityPlugin
	{
		public const string PluginGUID = "upgame.REPO.DurableBatteryArea";

		public const string PluginName = "Durable Battery Area";

		public const string PluginVersion = "1.0.0";

		private readonly Harmony _harmony = new Harmony("upgame.REPO.DurableBatteryArea");

		private static PluginBase Instance;

		private ConfigEntry<bool> _energyEnable;

		private ConfigEntry<float> _multiplier;

		private static AcceptableValueRange<float> acceptableRange = new AcceptableValueRange<float>(0.5f, 5f);

		private void Awake()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Expected O, but got Unknown
			if ((Object)Instance == (Object)null)
			{
				Instance = this;
			}
			Log.LogInfo("<更耐久的卡车电池>加载成功! Successfully loaded plugin: upgame.REPO.DurableBatteryArea!");
			_energyEnable = ((BaseUnityPlugin)this).Config.Bind<bool>("DurableCrystal", "Enable", false, "True is set to enable infinite energy.");
			_multiplier = ((BaseUnityPlugin)this).Config.Bind<float>("DurableCrystal", "PowerMultiplier", 2f, new ConfigDescription("PowerMultiplier indicates how many times greater the current crystal energy is compared to the vanilla. eg) value set to 2 then the crystal energy that was originally sufficient for one device can now power two devices.", (AcceptableValueBase)(object)acceptableRange, Array.Empty<object>()));
			_multiplier.Value = Mathf.Clamp(_multiplier.Value, 0.5f, 5f);
			_harmony.PatchAll(typeof(PluginBase));
			_harmony.PatchAll(typeof(ChargingStation_Update_Patch));
			Log.LogInfo((_energyEnable.Value ? "已启用无限电池!" : "已禁用无限电池,") + " " + (_energyEnable.Value ? "" : ("当前电池容量已扩容为原版的" + _multiplier.Value + "倍。")));
		}

		public static bool GetEnable()
		{
			return Instance._energyEnable.Value;
		}

		public static float GetMultiplier()
		{
			return Instance._multiplier.Value;
		}
	}
}
namespace DurableBatteryArea.Patches
{
	[HarmonyPatch(typeof(ChargingStation), "Update")]
	internal class ChargingStation_Update_Patch
	{
		private static void Prefix(out object __state, ref float ___chargeSegments, ref float ___chargeRate, ref float ___charge, int ___chargeInt)
		{
			__state = new DurableCrystalStateData(___chargeSegments, ___chargeRate);
			if (!PluginBase.GetEnable())
			{
				float multiplier = PluginBase.GetMultiplier();
				___chargeSegments /= multiplier;
				___chargeRate /= multiplier;
			}
		}

		private static void Postfix(object __state, ref float ___chargeSegments, ref float ___chargeRate, ref float ___charge, int ___chargeInt)
		{
			float num = ___chargeSegments;
			float num2 = ___chargeRate;
			if (PluginBase.GetEnable())
			{
				___charge = 6f;
			}
			else
			{
				float multiplier = PluginBase.GetMultiplier();
				___chargeSegments /= multiplier;
				___chargeRate /= multiplier;
			}
			if (__state is DurableCrystalStateData durableCrystalStateData)
			{
				___chargeSegments = durableCrystalStateData.ChargeSegments;
				___chargeRate = durableCrystalStateData.ChargeRate;
			}
		}
	}
}

BepInEx/plugins/x753_REPO-CustomColors/CustomColors.dll

Decompiled 2 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 HarmonyLib;
using Microsoft.CodeAnalysis;
using Photon.Pun;
using TMPro;
using UnityEngine;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("CustomColors")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("A mod for REPO that lets you change your color with RGB sliders")]
[assembly: AssemblyFileVersion("1.1.1.0")]
[assembly: AssemblyInformationalVersion("1.1.1+4bcde4ebec2db39237802dc00215ea1ce569b180")]
[assembly: AssemblyProduct("CustomColors")]
[assembly: AssemblyTitle("CustomColors")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.1.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.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace CustomColors
{
	[BepInPlugin("x753.CustomColors", "CustomColors", "1.1.1")]
	public class CustomColorsMod : BaseUnityPlugin
	{
		[HarmonyPatch(typeof(PlayerAvatar), "Awake")]
		private class PlayerAvatar_Awake_Patch
		{
			[HarmonyPostfix]
			public static void PlayerAvatar_Awake_Postfix(PlayerAvatar __instance)
			{
				((Component)__instance).gameObject.AddComponent<ModdedColorPlayerAvatar>();
			}
		}

		public class ModdedColorPlayerAvatar : MonoBehaviour, IPunObservable
		{
			public Color moddedColor;

			public static Color LocalColor = new Color(1f, 0f, 0f);

			public static bool ColorLock = false;

			public PlayerAvatar avatar;

			public PlayerAvatarVisuals visuals;

			public Material bodyMaterial;

			public void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info)
			{
				throw new NotImplementedException();
			}

			private void Awake()
			{
				avatar = ((Component)this).gameObject.GetComponent<PlayerAvatar>();
				visuals = avatar.playerAvatarVisuals;
			}

			public static void LocalPlayerAvatarSetColor()
			{
				//IL_009c: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a2: Expected O, but got Unknown
				if (!GameManager.Multiplayer())
				{
					((Component)PlayerAvatar.instance).GetComponent<ModdedColorPlayerAvatar>().ModdedSetColorRPC(LocalColor.r, LocalColor.g, LocalColor.b);
				}
				else
				{
					PlayerAvatar.instance.photonView.RPC("ModdedSetColorRPC", (RpcTarget)3, new object[3] { LocalColor.r, LocalColor.g, LocalColor.b });
				}
				try
				{
					ES3Settings val = new ES3Settings("ModSettingsData.es3", new Enum[1] { (Enum)(object)(Location)0 });
					ES3.Save<string>("PlayerBodyColorR", LocalColor.r.ToString(), val);
					ES3.Save<string>("PlayerBodyColorG", LocalColor.g.ToString(), val);
					ES3.Save<string>("PlayerBodyColorB", LocalColor.b.ToString(), val);
				}
				catch (Exception)
				{
					Debug.Log((object)"Failed to save ModSettingsData.es3 file!");
				}
			}

			[PunRPC]
			public void ModdedSetColorRPC(float r, float g, float b)
			{
				//IL_000b: Unknown result type (might be due to invalid IL or missing references)
				//IL_000c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0017: Unknown result type (might be due to invalid IL or missing references)
				//IL_0018: Unknown result type (might be due to invalid IL or missing references)
				//IL_0051: 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)
				Color val = default(Color);
				((Color)(ref val))..ctor(r, g, b);
				moddedColor = val;
				visuals.color = val;
				if ((Object)(object)bodyMaterial == (Object)null)
				{
					bodyMaterial = avatar.playerHealth.bodyMaterial;
				}
				bodyMaterial.SetColor(Shader.PropertyToID("_AlbedoColor"), val);
				if (SemiFunc.RunIsLobbyMenu() && Object.op_Implicit((Object)(object)MenuPageLobby.instance))
				{
					foreach (MenuPlayerListed menuPlayerListed in MenuPageLobby.instance.menuPlayerListedList)
					{
						if ((Object)(object)menuPlayerListed.playerAvatar == (Object)(object)avatar)
						{
							menuPlayerListed.playerHead.SetColor(val);
							break;
						}
					}
				}
				visuals.colorSet = true;
			}
		}

		public class SliderReinitializer : MonoBehaviour
		{
			public string elementName = "";

			public MenuSlider menuSlider;

			public float startValue;

			public void Start()
			{
				((Component)this).gameObject.GetComponent<MenuSlider>().elementName = elementName;
				((TMP_Text)((Component)((Component)this).gameObject.transform.Find("Element Name")).GetComponent<TextMeshProUGUI>()).SetText(elementName, true);
				((Object)((Component)this).gameObject).name = "Slider - " + elementName;
				menuSlider.SetBar(startValue);
			}
		}

		[HarmonyPatch(typeof(MenuPageColor), "Start")]
		private class MenuPageColor_Start_Patch
		{
			[HarmonyPostfix]
			public static void MenuPageColor_Start_Postfix(MenuPageColor __instance)
			{
				//IL_0030: Unknown result type (might be due to invalid IL or missing references)
				//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
				//IL_0115: Unknown result type (might be due to invalid IL or missing references)
				//IL_011f: Unknown result type (might be due to invalid IL or missing references)
				//IL_014e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0158: Unknown result type (might be due to invalid IL or missing references)
				((Component)__instance).transform.Find("Color Button Holder");
				((Component)__instance).transform.Find("Menu Button - Confirm").localPosition = new Vector3(330f, 80f, 0f);
				foreach (MenuPages menuPage2 in MenuManager.instance.menuPages)
				{
					GameObject menuPage = menuPage2.menuPage;
					if (((Object)menuPage).name == "Menu Page Settings Audio")
					{
						Transform obj = menuPage.transform.Find("Menu Scroll Box");
						Transform obj2 = ((obj != null) ? obj.Find("Mask") : null);
						Transform obj3 = ((obj2 != null) ? obj2.Find("Scroller") : null);
						Transform val = ((obj3 != null) ? obj3.Find("Slider - Master volume") : null);
						if ((Object)(object)val != (Object)null)
						{
							RedSlider = CreateColorSlider(((Component)val).gameObject, ((Component)__instance).transform, new Vector3(60f, 525f, 0f), "Color [RED]", Color.red, 753);
							GreenSlider = CreateColorSlider(((Component)val).gameObject, ((Component)__instance).transform, new Vector3(60f, 495f, 0f), "Color [GREEN]", Color.green, 754);
							BlueSlider = CreateColorSlider(((Component)val).gameObject, ((Component)__instance).transform, new Vector3(60f, 465f, 0f), "Color [BLUE]", Color.blue, 755);
						}
					}
				}
			}
		}

		[HarmonyPatch(typeof(MenuButtonColor), "Start")]
		private class MenuButtonColor_Start_Patch
		{
			[HarmonyPostfix]
			public static void MenuButtonColor_Start_Postfix(MenuButtonColor __instance)
			{
				//IL_0033: Unknown result type (might be due to invalid IL or missing references)
				//IL_003e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0052: Unknown result type (might be due to invalid IL or missing references)
				//IL_0057: Unknown result type (might be due to invalid IL or missing references)
				if (DataDirector.instance.ColorGetBody() == __instance.colorID)
				{
					ModdedColorPlayerAvatar.ColorLock = true;
					__instance.menuPageColor.menuColorSelected.SetColor(AssetManager.instance.playerColors[__instance.colorID], ((Component)__instance).transform.position - new Vector3(0f, 405f, 0f));
				}
			}
		}

		[HarmonyPatch(typeof(PlayerAvatar), "PlayerAvatarSetColor")]
		private class PlayerAvatar_PlayerAvatarSetColor_Patch
		{
			[HarmonyPostfix]
			public static void PlayerAvatar_PlayerAvatarSetColor_Postfix(PlayerAvatar __instance, int colorIndex)
			{
				//IL_000d: Unknown result type (might be due to invalid IL or missing references)
				ModdedColorPlayerAvatar component = ((Component)__instance).GetComponent<ModdedColorPlayerAvatar>();
				if (component != null)
				{
					_ = component.moddedColor;
					if (true)
					{
						ModdedColorPlayerAvatar.LocalPlayerAvatarSetColor();
					}
				}
			}
		}

		[HarmonyPatch(typeof(PlayerAvatarVisuals), "MenuAvatarGetColorsFromRealAvatar")]
		private class PlayerAvatarVisuals_MenuAvatarGetColorsFromRealAvatar_Patch
		{
			public static Material bodyMaterial;

			[HarmonyPrefix]
			public static bool PlayerAvatarVisuals_MenuAvatarGetColorsFromRealAvatar_Prefix(PlayerAvatarVisuals __instance)
			{
				//IL_0044: Unknown result type (might be due to invalid IL or missing references)
				if (__instance.isMenuAvatar && !Object.op_Implicit((Object)(object)__instance.playerAvatar))
				{
					__instance.playerAvatar = PlayerAvatar.instance;
				}
				bodyMaterial = ((Component)((Component)__instance).transform).GetComponentInParent<PlayerHealth>().bodyMaterial;
				bodyMaterial.SetColor(Shader.PropertyToID("_AlbedoColor"), ModdedColorPlayerAvatar.LocalColor);
				return false;
			}
		}

		[HarmonyPatch(typeof(MenuColorSelected), "SetColor")]
		private class MenuColorSelected_SetColor_Patch
		{
			[HarmonyPostfix]
			public static void MenuColorSelected_SetColor_Postfix(MenuColorSelected __instance, Color color, Vector3 position)
			{
				//IL_0020: 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_0065: Unknown result type (might be due to invalid IL or missing references)
				//IL_0066: 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)
				if (ModdedColorPlayerAvatar.ColorLock)
				{
					ModdedColorPlayerAvatar.ColorLock = false;
					return;
				}
				if ((Object)(object)RedSlider != (Object)null)
				{
					RedSlider.SetBar(color.r);
				}
				if ((Object)(object)GreenSlider != (Object)null)
				{
					GreenSlider.SetBar(color.g);
				}
				if ((Object)(object)BlueSlider != (Object)null)
				{
					BlueSlider.SetBar(color.b);
				}
				ModdedColorPlayerAvatar.LocalColor = color;
			}
		}

		[HarmonyPatch(typeof(MenuPageColor), "ConfirmButton")]
		private class MenuPageColor_ConfirmButton_Patch
		{
			[HarmonyPrefix]
			public static void MenuPageColor_ConfirmButton_Prefix(MenuPageColor __instance)
			{
				ModdedColorPlayerAvatar.LocalPlayerAvatarSetColor();
			}
		}

		[HarmonyPatch(typeof(DataDirector), "SettingValueSet")]
		private class DataDirector_SettingValueSet_Patch
		{
			[HarmonyPrefix]
			public static bool DataDirector_SettingValueSet_Prefix(DataDirector __instance, Setting setting, int value)
			{
				//IL_0000: Unknown result type (might be due to invalid IL or missing references)
				//IL_0006: Invalid comparison between Unknown and I4
				//IL_001c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0022: Invalid comparison between Unknown and I4
				//IL_0038: Unknown result type (might be due to invalid IL or missing references)
				//IL_003e: Invalid comparison between Unknown and I4
				if ((int)setting == 753)
				{
					ModdedColorPlayerAvatar.LocalColor.r = (float)value / 100f;
					return false;
				}
				if ((int)setting == 754)
				{
					ModdedColorPlayerAvatar.LocalColor.g = (float)value / 100f;
					return false;
				}
				if ((int)setting == 755)
				{
					ModdedColorPlayerAvatar.LocalColor.b = (float)value / 100f;
					return false;
				}
				return true;
			}
		}

		private const string modGUID = "x753.CustomColors";

		private const string modName = "CustomColors";

		private const string modVersion = "1.1.1";

		private readonly Harmony harmony = new Harmony("x753.CustomColors");

		private static CustomColorsMod Instance;

		public static MenuSlider RedSlider;

		public static MenuSlider GreenSlider;

		public static MenuSlider BlueSlider;

		private void Awake()
		{
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Expected O, but got Unknown
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			harmony.PatchAll();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin CustomColors is loaded!");
			ES3Settings val = new ES3Settings("ModSettingsData.es3", new Enum[1] { (Enum)(object)(Location)0 });
			try
			{
				if (ES3.KeyExists("PlayerBodyColorR", val))
				{
					string s = ES3.Load<string>("PlayerBodyColorR", "0", val);
					string s2 = ES3.Load<string>("PlayerBodyColorG", "1", val);
					string s3 = ES3.Load<string>("PlayerBodyColorB", "0", val);
					ModdedColorPlayerAvatar.LocalColor.r = float.Parse(s);
					ModdedColorPlayerAvatar.LocalColor.g = float.Parse(s2);
					ModdedColorPlayerAvatar.LocalColor.b = float.Parse(s3);
				}
			}
			catch (Exception)
			{
				((BaseUnityPlugin)this).Logger.LogWarning((object)"Failed to load ModSettingsData.es3 file!");
				ES3.DeleteFile(val);
			}
		}

		public static MenuSlider CreateColorSlider(GameObject sliderPrefab, Transform parentTransform, Vector3 position, string elementName, Color color, int settingNum)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_011b: 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_013b: Unknown result type (might be due to invalid IL or missing references)
			//IL_013d: Unknown result type (might be due to invalid IL or missing references)
			//IL_015b: Unknown result type (might be due to invalid IL or missing references)
			//IL_015d: Unknown result type (might be due to invalid IL or missing references)
			GameObject obj = Object.Instantiate<GameObject>(sliderPrefab, parentTransform);
			obj.transform.position = position;
			((Graphic)((Component)obj.transform.Find("SliderBG").Find("RawImage (1)")).GetComponent<RawImage>()).color = Color.black;
			((Component)obj.transform.Find("SliderBG").Find("RawImage (2)")).gameObject.SetActive(false);
			((Graphic)((Component)obj.transform.Find("SliderBG").Find("RawImage (3)")).GetComponent<RawImage>()).color = new Color(0.1f, 0.1f, 0.1f);
			((Component)obj.transform.Find("MaskedText")).gameObject.SetActive(false);
			((Graphic)((Component)obj.transform.Find("Bar").Find("RawImage")).GetComponent<RawImage>()).color = color;
			MenuSlider component = obj.GetComponent<MenuSlider>();
			component.pointerSegmentJump = 1;
			component.buttonSegmentJump = 1;
			obj.GetComponent<MenuSetting>().setting = (Setting)settingNum;
			Object.Destroy((Object)(object)obj.GetComponent<MenuSettingElement>());
			SliderReinitializer sliderReinitializer = obj.AddComponent<SliderReinitializer>();
			sliderReinitializer.menuSlider = component;
			sliderReinitializer.elementName = elementName;
			if (color == Color.red)
			{
				sliderReinitializer.startValue = ModdedColorPlayerAvatar.LocalColor.r;
			}
			else if (color == Color.green)
			{
				sliderReinitializer.startValue = ModdedColorPlayerAvatar.LocalColor.g;
			}
			else if (color == Color.blue)
			{
				sliderReinitializer.startValue = ModdedColorPlayerAvatar.LocalColor.b;
			}
			return component;
		}
	}
}

BepInEx/plugins/Xaru-JustRetryPlus/JustRetryPlus.dll

Decompiled 2 months ago
using System;
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 BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("JustRetryPlus")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.3.0")]
[assembly: AssemblyInformationalVersion("1.0.3")]
[assembly: AssemblyProduct("JustRetryPlus")]
[assembly: AssemblyTitle("JustRetryPlus")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.3.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 JustRetryPlus
{
	[BepInPlugin("JustRetryPlus", "JustRetryPlus", "1.0.3")]
	public class Plugin : BaseUnityPlugin
	{
		internal static ManualLogSource Logger;

		private static ConfigEntry<bool> _shouldResetLevel;

		private static ConfigEntry<bool> _shouldHealAfterFail;

		private static ConfigEntry<bool> _isEnabled;

		private static ConfigEntry<int> _healthToHeal;

		public static bool ShouldResetLevel => _shouldResetLevel.Value;

		public static bool ShouldHealAfterFail => _shouldHealAfterFail.Value;

		public static bool DidFailLevel { get; set; }

		public static bool IsEnabled => _isEnabled.Value;

		public static int HealthToHealValue => _healthToHeal.Value;

		private void Awake()
		{
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Expected O, but got Unknown
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Expected O, but got Unknown
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Expected O, but got Unknown
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Expected O, but got Unknown
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: Expected O, but got Unknown
			Logger = ((BaseUnityPlugin)this).Logger;
			Logger.LogInfo((object)"Plugin JustRetryPlus is loaded!");
			Logger.LogInfo((object)"Thanks for nickklmao for the original Idea and bits of code! please check out their mods on Thunderstore!");
			Logger.LogInfo((object)"Without them this mod wouldn't be possible!");
			Harmony val = new Harmony("eu.xaru.justretryplus");
			val.PatchAll();
			Logger.LogInfo((object)"Harmony patches applied.");
			_isEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Settings", "IsEnabled", true, new ConfigDescription("Toggle if the plugin should be enabled, if false the normal game death scene will take over", (AcceptableValueBase)(object)new AcceptableValueRange<bool>(false, true), Array.Empty<object>()));
			_shouldResetLevel = ((BaseUnityPlugin)this).Config.Bind<bool>("Settings", "ShouldResetLevel", false, new ConfigDescription("Toggle if the game should restart at level one & reset the map when failing a level", (AcceptableValueBase)(object)new AcceptableValueRange<bool>(false, true), Array.Empty<object>()));
			_shouldHealAfterFail = ((BaseUnityPlugin)this).Config.Bind<bool>("Settings", "ShouldHealAfterFail", true, new ConfigDescription("Toggle if the game should restart with full health when failing a level", (AcceptableValueBase)(object)new AcceptableValueRange<bool>(false, true), Array.Empty<object>()));
			_healthToHeal = ((BaseUnityPlugin)this).Config.Bind<int>("Settings", "HealthToHeal", 100, new ConfigDescription("The amount of health to heal when failing a level", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 500), Array.Empty<object>()));
		}

		private void Start()
		{
			Logger.LogInfo((object)"JustRetryPlus started!");
		}
	}
	[HarmonyPatch(typeof(RunManager), "ChangeLevel")]
	public static class ChangeLevelPatch
	{
		private static void Prefix(RunManager __instance, ref bool _completedLevel, ref bool _levelFailed, ref ChangeLevelType _changeLevelType)
		{
			if (!Plugin.IsEnabled)
			{
				return;
			}
			Plugin.Logger.LogInfo((object)$"Level failed?: {_levelFailed}");
			Plugin.DidFailLevel = _levelFailed;
			if (Plugin.DidFailLevel)
			{
				if (Plugin.ShouldResetLevel)
				{
					Plugin.Logger.LogInfo((object)"Restarting at level one");
					__instance.ResetProgress();
					__instance.SetRunLevel();
				}
				Plugin.Logger.LogInfo((object)"Level failed, retrying...");
				__instance.RestartScene();
				Plugin.Logger.LogInfo((object)"Restarted scene");
			}
		}
	}
	[HarmonyPatch(typeof(RoundDirector), "StartRoundLogic")]
	public static class RoundDirectorPatch
	{
		private static void Postfix(RoundDirector __instance)
		{
			if (!Plugin.IsEnabled || !Plugin.ShouldHealAfterFail || !Plugin.DidFailLevel || !SemiFunc.IsMasterClientOrSingleplayer())
			{
				return;
			}
			foreach (PlayerHealth item in from player in SemiFunc.PlayerGetAll()
				select player.playerHealth)
			{
				if (!((Object)(object)item == (Object)null))
				{
					item.HealOther(Plugin.HealthToHealValue, true);
				}
			}
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "JustRetryPlus";

		public const string PLUGIN_NAME = "JustRetryPlus";

		public const string PLUGIN_VERSION = "1.0.3";
	}
}

BepInEx/plugins/Zehs-ExtractionPointConfirmButton/com.github.zehsteam.ExtractionPointConfirmButton.dll

Decompiled 2 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Photon.Pun;
using REPOLib;
using REPOLib.Modules;
using UnityEngine;
using com.github.zehsteam.ExtractionPointConfirmButton.MonoBehaviours;
using com.github.zehsteam.ExtractionPointConfirmButton.Patches;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("Zehs")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyCopyright("Copyright © 2025 Zehs")]
[assembly: AssemblyDescription("Adds a confirm button to extraction points.")]
[assembly: AssemblyFileVersion("1.1.0.0")]
[assembly: AssemblyInformationalVersion("1.1.0+4e79a0b5f97bea0d28b3a655637fcb08838a55c6")]
[assembly: AssemblyProduct("ExtractionPointConfirmButton")]
[assembly: AssemblyTitle("com.github.zehsteam.ExtractionPointConfirmButton")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.1.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace com.github.zehsteam.ExtractionPointConfirmButton
{
	internal static class Assets
	{
		public static GameObject ConfirmButtonPrefab { get; private set; }

		public static void Initialize()
		{
			string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
			string text = "extractionpointconfirmbutton_assets";
			string text2 = Path.Combine(directoryName, text);
			if (!File.Exists(text2))
			{
				Logger.LogFatal("Failed to load assets. AssetBundle file could not be found at path \"" + text2 + "\". Make sure the \"" + text + "\" file is in the same folder as the mod's DLL file.");
			}
			else
			{
				BundleLoader.LoadBundle(text2, (Action<AssetBundle>)OnAssetBundleLoaded, false);
			}
		}

		private static void OnAssetBundleLoaded(AssetBundle assetBundle)
		{
			ConfirmButtonPrefab = LoadAsset<GameObject>("ConfirmButton", assetBundle);
			NetworkPrefabs.RegisterNetworkPrefab(ConfirmButtonPrefab);
		}

		private static T LoadAsset<T>(string name, AssetBundle assetBundle) where T : Object
		{
			if (string.IsNullOrWhiteSpace(name))
			{
				Logger.LogError("Failed to load asset of type \"" + typeof(T).Name + "\" from AssetBundle. Name is null or whitespace.");
				return default(T);
			}
			if ((Object)(object)assetBundle == (Object)null)
			{
				Logger.LogError("Failed to load asset of type \"" + typeof(T).Name + "\" with name \"" + name + "\" from AssetBundle. AssetBundle is null.");
				return default(T);
			}
			T val = assetBundle.LoadAsset<T>(name);
			if ((Object)(object)val == (Object)null)
			{
				Logger.LogError("Failed to load asset of type \"" + typeof(T).Name + "\" with name \"" + name + "\" from AssetBundle. No asset found with that type and name.");
				return default(T);
			}
			return val;
		}

		private static bool TryLoadAsset<T>(string name, AssetBundle assetBundle, out T asset) where T : Object
		{
			asset = LoadAsset<T>(name, assetBundle);
			return (Object)(object)asset != (Object)null;
		}
	}
	internal static class ConfigManager
	{
		public static ConfigFile ConfigFile { get; private set; }

		public static ConfigEntry<bool> ExtendedLogging { get; private set; }

		public static void Initialize(ConfigFile configFile)
		{
			ConfigFile = configFile;
			BindConfigs();
		}

		private static void BindConfigs()
		{
			ExtendedLogging = ConfigFile.Bind<bool>("General", "ExtendedLogging", false, "Enable extended logging.");
		}
	}
	internal static class Logger
	{
		public static ManualLogSource ManualLogSource { get; private set; }

		public static void Initialize(ManualLogSource manualLogSource)
		{
			ManualLogSource = manualLogSource;
		}

		public static void LogDebug(object data, bool extended = true)
		{
			Log((LogLevel)32, data, extended);
		}

		public static void LogInfo(object data, bool extended = false)
		{
			Log((LogLevel)16, data, extended);
		}

		public static void LogWarning(object data, bool extended = false)
		{
			Log((LogLevel)4, data, extended);
		}

		public static void LogError(object data, bool extended = false)
		{
			Log((LogLevel)2, data, extended);
		}

		public static void LogFatal(object data, bool extended = false)
		{
			Log((LogLevel)1, data, extended);
		}

		public static void Log(LogLevel logLevel, object data, bool extended = false)
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			if (!extended || IsExtendedLoggingEnabled())
			{
				ManualLogSource manualLogSource = ManualLogSource;
				if (manualLogSource != null)
				{
					manualLogSource.Log(logLevel, data);
				}
			}
		}

		public static bool IsExtendedLoggingEnabled()
		{
			if (ConfigManager.ExtendedLogging == null)
			{
				return false;
			}
			return ConfigManager.ExtendedLogging.Value;
		}
	}
	[BepInPlugin("com.github.zehsteam.ExtractionPointConfirmButton", "ExtractionPointConfirmButton", "1.1.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	internal class Plugin : BaseUnityPlugin
	{
		private readonly Harmony _harmony = new Harmony("com.github.zehsteam.ExtractionPointConfirmButton");

		internal static Plugin Instance { get; private set; }

		private void Awake()
		{
			Instance = this;
			Logger.Initialize(Logger.CreateLogSource("com.github.zehsteam.ExtractionPointConfirmButton"));
			Logger.LogInfo("ExtractionPointConfirmButton has awoken!");
			_harmony.PatchAll(typeof(RunManagerPatch));
			_harmony.PatchAll(typeof(ExtractionPointPatch));
			ConfigManager.Initialize(((BaseUnityPlugin)this).Config);
			Assets.Initialize();
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "com.github.zehsteam.ExtractionPointConfirmButton";

		public const string PLUGIN_NAME = "ExtractionPointConfirmButton";

		public const string PLUGIN_VERSION = "1.1.0";
	}
}
namespace com.github.zehsteam.ExtractionPointConfirmButton.Patches
{
	[HarmonyPatch(typeof(ExtractionPoint))]
	internal static class ExtractionPointPatch
	{
		private static readonly Dictionary<ExtractionPoint, float> _timeConfirms = new Dictionary<ExtractionPoint, float>();

		public static Dictionary<ExtractionPoint, ConfirmButton> ConfirmButtons { get; private set; } = new Dictionary<ExtractionPoint, ConfirmButton>();


		public static void Reset()
		{
			ConfirmButtons.Clear();
			_timeConfirms.Clear();
			Logger.LogInfo("ExtractionPointPatch: Reset();", extended: true);
		}

		public static void ConfirmExtractionPoint(ExtractionPoint extractionPoint)
		{
			if ((Object)(object)extractionPoint == (Object)null || extractionPoint.isShop)
			{
				return;
			}
			if (extractionPoint.haulGoal - extractionPoint.haulCurrent > 0)
			{
				if (extractionPoint.StateIs((State)2))
				{
					extractionPoint.StateSet((State)5);
				}
			}
			else
			{
				_timeConfirms[extractionPoint] = Time.realtimeSinceStartup;
			}
		}

		public static void AddConfirmButtonPair(ExtractionPoint extractionPoint, ConfirmButton confirmButton)
		{
			if (!((Object)(object)extractionPoint == (Object)null) && !((Object)(object)confirmButton == (Object)null))
			{
				ConfirmButtons[extractionPoint] = confirmButton;
			}
		}

		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		private static void StartPatch(ref ExtractionPoint __instance)
		{
			SpawnConfirmButtonObject(__instance);
			UpdateConfirmButtonVisibility(__instance);
		}

		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		private static void UpdatePatch(ref ExtractionPoint __instance)
		{
			UpdateSuccessDelay(__instance);
		}

		[HarmonyPatch("StateSetRPC")]
		[HarmonyPostfix]
		private static void StateSetRPCPatch(ref ExtractionPoint __instance)
		{
			UpdateConfirmButtonVisibility(__instance);
		}

		private static void SpawnConfirmButtonObject(ExtractionPoint extractionPoint)
		{
			//IL_0047: 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: 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_006f: 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)
			if ((Object)(object)extractionPoint == (Object)null || extractionPoint.isShop || !SemiFunc.IsMasterClientOrSingleplayer())
			{
				return;
			}
			Transform val = ((Component)extractionPoint).transform.Find("Scale");
			if ((Object)(object)val == (Object)null)
			{
				Logger.LogFatal("ExtractionPointPatch: Failed to spawn confirm button object. Target transform is null.");
				return;
			}
			GameObject confirmButtonPrefab = Assets.ConfirmButtonPrefab;
			Vector3 position = val.position;
			Quaternion rotation = val.rotation;
			if ((Object)(object)confirmButtonPrefab == (Object)null)
			{
				Logger.LogFatal("ExtractionPointPatch: Failed to spawn confirm button. Prefab is null.");
				return;
			}
			GameObject val2 = NetworkPrefabs.SpawnNetworkPrefab(((Object)confirmButtonPrefab).name, position, rotation, (byte)0, (object[])null);
			ConfirmButton confirmButton = default(ConfirmButton);
			if ((Object)(object)val2 == (Object)null)
			{
				Logger.LogFatal("ExtractionPointPatch: Failed to spawn confirm button. GameObject is null.");
			}
			else if (!val2.TryGetComponent<ConfirmButton>(ref confirmButton))
			{
				Logger.LogFatal("ExtractionPointPatch: Failed to spawn confirm button. ConfirmButton is null.");
			}
			else
			{
				confirmButton.SetExtractionPoint(extractionPoint);
			}
		}

		private static void UpdateSuccessDelay(ExtractionPoint extractionPoint)
		{
			if (!((Object)(object)extractionPoint == (Object)null) && !extractionPoint.isShop && HasConfirmButton(extractionPoint))
			{
				bool flag = true;
				if (_timeConfirms.TryGetValue(extractionPoint, out var value) && Time.realtimeSinceStartup - value <= 2f)
				{
					flag = false;
				}
				if (flag)
				{
					extractionPoint.successDelay = 1.5f;
				}
				else
				{
					extractionPoint.successDelay = 0f;
				}
			}
		}

		private static bool HasConfirmButton(ExtractionPoint extractionPoint)
		{
			if ((Object)(object)extractionPoint == (Object)null || extractionPoint.isShop)
			{
				return false;
			}
			if (ConfirmButtons.TryGetValue(extractionPoint, out var value))
			{
				if ((Object)(object)value == (Object)null)
				{
					return false;
				}
				return ((Component)value).gameObject.activeSelf;
			}
			return false;
		}

		private static void UpdateConfirmButtonVisibility(ExtractionPoint extractionPoint)
		{
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)extractionPoint == (Object)null) && !extractionPoint.isShop && ConfirmButtons.TryGetValue(extractionPoint, out var value) && !((Object)(object)value == (Object)null))
			{
				value.SetVisible(ShowConfirmButton(extractionPoint.stateSetTo));
			}
		}

		private static bool ShowConfirmButton(State state)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Invalid comparison between Unknown and I4
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Invalid comparison between Unknown and I4
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Invalid comparison between Unknown and I4
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Invalid comparison between Unknown and I4
			if ((int)state == 1)
			{
				return false;
			}
			if ((int)state == 6)
			{
				return false;
			}
			if ((int)state == 9)
			{
				return false;
			}
			if ((int)state == 7)
			{
				return false;
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(RunManager))]
	internal static class RunManagerPatch
	{
		[HarmonyPatch("UpdateLevel")]
		[HarmonyPostfix]
		private static void UpdateLevelPatch()
		{
			ExtractionPointPatch.Reset();
		}
	}
}
namespace com.github.zehsteam.ExtractionPointConfirmButton.MonoBehaviours
{
	public class ConfirmButton : MonoBehaviour
	{
		[SerializeField]
		private GameObject _objectObject;

		[SerializeField]
		private Transform _buttonVisualTransform;

		private bool _buttonAnimation;

		private float _buttonAnimationEval;

		private ExtractionPoint _extractionPoint;

		private PhotonView _photonView;

		private void Start()
		{
			_photonView = ((Component)this).GetComponent<PhotonView>();
			SyncExtractionPoint();
		}

		private void Update()
		{
			ButtonAnimation();
		}

		public void OnClick()
		{
			if (SemiFunc.IsMultiplayer())
			{
				_photonView.RPC("OnClickRPC", (RpcTarget)0, Array.Empty<object>());
			}
			else
			{
				OnClickRPC();
			}
		}

		public void SetExtractionPoint(ExtractionPoint extractionPoint)
		{
			_extractionPoint = extractionPoint;
			ExtractionPointPatch.AddConfirmButtonPair(extractionPoint, this);
			Logger.LogInfo("ConfirmButton: Set extraction point.");
		}

		public void SetVisible(bool value)
		{
			if (!((Object)(object)_objectObject == (Object)null))
			{
				_objectObject.SetActive(value);
			}
		}

		private void SyncExtractionPoint()
		{
			if (SemiFunc.IsMasterClientOrSingleplayer())
			{
				if ((Object)(object)_extractionPoint == (Object)null)
				{
					Logger.LogError("ConfirmButton: Failed to sync extraction point. ExtractionPoint is null.");
				}
				else if (SemiFunc.IsMultiplayer())
				{
					int viewID = _extractionPoint.photonView.ViewID;
					_photonView.RPC("SyncExtractionPointRPC", (RpcTarget)0, new object[1] { viewID });
				}
			}
		}

		[PunRPC]
		private void SyncExtractionPointRPC(int extractionPointViewID)
		{
			PhotonView photonView = PhotonNetwork.GetPhotonView(extractionPointViewID);
			if ((Object)(object)photonView == (Object)null)
			{
				Logger.LogError("ConfirmButton: Failed to set extraction point. PhotonView is null.");
				return;
			}
			ExtractionPoint extractionPoint = default(ExtractionPoint);
			if (!((Component)photonView).TryGetComponent<ExtractionPoint>(ref extractionPoint))
			{
				Logger.LogError("ConfirmButton: Failed to set extraction point. ExtractionPoint is null.");
				return;
			}
			_extractionPoint = extractionPoint;
			ExtractionPointPatch.AddConfirmButtonPair(extractionPoint, this);
			Logger.LogInfo($"ConfirmButton: Set extraction point. (ViewID: {extractionPointViewID})");
		}

		[PunRPC]
		private void OnClickRPC()
		{
			ButtonPushVisualsStart();
			ExtractionPointPatch.ConfirmExtractionPoint(_extractionPoint);
		}

		private void ButtonPushVisualsStart()
		{
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)_extractionPoint == (Object)null) && !_buttonAnimation)
			{
				_buttonVisualTransform.localScale = new Vector3(1f, 0.1f, 1f);
				_extractionPoint.soundButton.Play(_buttonVisualTransform.position, 1f, 1f, 1f, 1f);
				_buttonAnimationEval = 0f;
				_buttonAnimation = true;
			}
		}

		private void ButtonAnimation()
		{
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: 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_00bd: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)_extractionPoint == (Object)null) && _buttonAnimation)
			{
				_buttonAnimationEval += Time.deltaTime * 2f;
				_buttonAnimationEval = Mathf.Clamp01(_buttonAnimationEval);
				float num = _extractionPoint.buttonPressAnimationCurve.Evaluate(_buttonAnimationEval);
				Color val = default(Color);
				((Color)(ref val))..ctor(1f, 0.5f, 0f, 1f);
				((Renderer)((Component)_buttonVisualTransform).GetComponent<MeshRenderer>()).material.SetColor("_EmissionColor", Color.Lerp(val, Color.white, num));
				num = Mathf.Clamp(num, 0.5f, 1f);
				_buttonVisualTransform.localScale = new Vector3(1f, num, 1f);
				if (_buttonAnimationEval >= 1f)
				{
					_buttonAnimation = false;
					_buttonAnimationEval = 0f;
				}
			}
		}
	}
}
namespace com.github.zehsteam.ExtractionPointConfirmButton.Extensions
{
	internal static class ConfigFileExtensions
	{
		public static ConfigEntry<T> Bind<T>(this ConfigFile configFile, string section, string key, T defaultValue, string description, AcceptableValueBase acceptableValues)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Expected O, but got Unknown
			return configFile.Bind<T>(section, key, defaultValue, new ConfigDescription(description, acceptableValues, Array.Empty<object>()));
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}

BepInEx/plugins/Zehs-REPOLib/REPOLib.dll

Decompiled 2 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using ExitGames.Client.Photon;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Photon.Pun;
using Photon.Realtime;
using REPOLib.Commands;
using REPOLib.Extensions;
using REPOLib.Modules;
using REPOLib.Objects;
using REPOLib.Objects.Sdk;
using REPOLib.Patches;
using TMPro;
using UnityEngine;
using UnityEngine.Audio;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("Zehs")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyCopyright("Copyright © 2025 Zehs")]
[assembly: AssemblyDescription("Library for adding content to R.E.P.O.")]
[assembly: AssemblyFileVersion("2.0.1.0")]
[assembly: AssemblyInformationalVersion("2.0.1+56712f43ffba9641e36a63c6b573cff6e2791c96")]
[assembly: AssemblyProduct("REPOLib")]
[assembly: AssemblyTitle("REPOLib")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/ZehsTeam/REPOLib")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("2.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

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

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

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

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace REPOLib
{
	public static class BundleLoader
	{
		private class LoadOperation
		{
			public enum State
			{
				LoadingBundle,
				LoadingContent
			}

			public string Path { get; }

			public DateTime StartTime { get; }

			public State CurrentState { get; set; }

			public bool LoadContents { get; }

			public Func<AssetBundle, IEnumerator>? OnBundleLoaded { get; }

			public AssetBundleCreateRequest BundleRequest { get; }

			public TimeSpan ElapsedTime => DateTime.Now - StartTime;

			public string FileName => System.IO.Path.GetFileNameWithoutExtension(Path);

			public LoadOperation(string path, Func<AssetBundle, IEnumerator>? onBundleLoaded = null, bool loadContents = true)
			{
				Path = path;
				StartTime = DateTime.Now;
				LoadContents = loadContents;
				OnBundleLoaded = onBundleLoaded;
				BundleRequest = AssetBundle.LoadFromFileAsync(path);
				base..ctor();
			}
		}

		[StructLayout(LayoutKind.Auto)]
		[CompilerGenerated]
		private struct <>c__DisplayClass11_0
		{
			public LoadOperation operation;
		}

		[CompilerGenerated]
		private sealed class <>c__DisplayClass6_0
		{
			public Action<AssetBundle> onLoaded;
		}

		[CompilerGenerated]
		private sealed class <FinishLoadOperation>d__11 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public LoadOperation operation;

			private <>c__DisplayClass11_0 <>8__1;

			private AssetBundle <bundle>5__2;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <FinishLoadOperation>d__11(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>8__1 = default(<>c__DisplayClass11_0);
				<bundle>5__2 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>8__1.operation = operation;
					<>2__current = <>8__1.operation.BundleRequest;
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					<bundle>5__2 = <>8__1.operation.BundleRequest.assetBundle;
					if ((Object)(object)<bundle>5__2 == (Object)null)
					{
						Logger.LogError("Failed to load bundle " + <>8__1.operation.FileName + "!");
						<FinishLoadOperation>g__Finish|11_0(ref <>8__1);
						return false;
					}
					if (<>8__1.operation.LoadContents)
					{
						<>2__current = LoadBundleContent(<>8__1.operation, <bundle>5__2);
						<>1__state = 2;
						return true;
					}
					goto IL_00f6;
				case 2:
					<>1__state = -1;
					goto IL_00f6;
				case 3:
					{
						<>1__state = -1;
						break;
					}
					IL_00f6:
					if (<>8__1.operation.OnBundleLoaded != null)
					{
						<>2__current = <>8__1.operation.OnBundleLoaded(<bundle>5__2);
						<>1__state = 3;
						return true;
					}
					break;
				}
				if (ConfigManager.ExtendedLogging.Value)
				{
					Logger.LogInfo($"Loaded bundle {<>8__1.operation.FileName} in {<>8__1.operation.ElapsedTime.TotalSeconds:N1}s");
				}
				<FinishLoadOperation>g__Finish|11_0(ref <>8__1);
				return false;
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		[CompilerGenerated]
		private sealed class <FinishLoadOperationsRoutine>d__9 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public MonoBehaviour behaviour;

			private TMP_Text <text>5__2;

			private Action <disableLoadingUI>5__3;

			private float <lastUpdate>5__4;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <FinishLoadOperationsRoutine>d__9(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<text>5__2 = null;
				<disableLoadingUI>5__3 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = null;
					<>1__state = 1;
					return true;
				case 1:
				{
					<>1__state = -1;
					LoadOperation[] array = _operations.ToArray();
					foreach (LoadOperation operation in array)
					{
						behaviour.StartCoroutine(FinishLoadOperation(operation));
					}
					(TMP_Text, Action) tuple = SetupLoadingUI();
					<text>5__2 = tuple.Item1;
					<disableLoadingUI>5__3 = tuple.Item2;
					<lastUpdate>5__4 = Time.time;
					break;
				}
				case 2:
					<>1__state = -1;
					break;
				}
				while (_operations.Count > 0)
				{
					if (Time.time - <lastUpdate>5__4 > 1f)
					{
						<lastUpdate>5__4 = Time.time;
						string arg = ((_operations.Count == 1) ? "bundle" : "bundles");
						<text>5__2.text = $"REPOLib: Waiting for {_operations.Count} {arg} to load...";
						if (!ConfigManager.ExtendedLogging.Value)
						{
							continue;
						}
						foreach (LoadOperation operation2 in _operations)
						{
							string text = $"Loading {operation2.FileName}: {operation2.CurrentState}";
							float? num = ((operation2.CurrentState != 0) ? null : new float?(((AsyncOperation)operation2.BundleRequest).progress));
							float? num2 = num;
							if (num2.HasValue)
							{
								text += $" {num2.Value:P0}";
							}
							Logger.LogDebug(text);
						}
					}
					<>2__current = null;
					<>1__state = 2;
					return true;
				}
				Logger.LogInfo("Finished loading bundles.");
				<disableLoadingUI>5__3();
				Utilities.SafeInvokeEvent(BundleLoader.OnAllBundlesLoaded);
				return false;
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		[CompilerGenerated]
		private sealed class <LoadBundleContent>d__12 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public LoadOperation operation;

			public AssetBundle bundle;

			private AssetBundleRequest <assetRequest>5__2;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <LoadBundleContent>d__12(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<assetRequest>5__2 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					operation.CurrentState = LoadOperation.State.LoadingContent;
					<assetRequest>5__2 = bundle.LoadAllAssetsAsync<ScriptableObject>();
					<>2__current = <assetRequest>5__2;
					<>1__state = 1;
					return true;
				case 1:
				{
					<>1__state = -1;
					Object[] allAssets = <assetRequest>5__2.allAssets;
					Mod[] array = allAssets.OfType<Mod>().ToArray();
					int num = array.Length;
					if (num <= 1)
					{
						if (num == 0)
						{
							Logger.LogError("Bundle " + operation.FileName + " contains no mods!");
							return false;
						}
						Mod mod = array[0];
						foreach (Content item in allAssets.OfType<Content>())
						{
							try
							{
								item.Initialize(mod);
							}
							catch (Exception ex)
							{
								Logger.LogError($"Failed to load {item.Name} ({((object)item).GetType().Name}) from bundle {operation.FileName} ({mod.Identifier}): {ex}");
							}
						}
						return false;
					}
					Logger.LogError("Bundle " + operation.FileName + " contains more than one mod!");
					return false;
				}
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		private static readonly List<LoadOperation> _operations = new List<LoadOperation>();

		public static event Action? OnAllBundlesLoaded;

		internal static void LoadAllBundles(string root, string withExtension)
		{
			Logger.LogInfo("Loading all bundles with extension " + withExtension + " from root " + root, extended: true);
			string[] files = Directory.GetFiles(root, "*" + withExtension, SearchOption.AllDirectories);
			string[] array = files;
			foreach (string path in array)
			{
				LoadBundleAndContent(path);
			}
		}

		public static void LoadBundleAndContent(string path)
		{
			LoadBundle(path, (Func<AssetBundle, IEnumerator>?)null, loadContents: true);
		}

		public static void LoadBundle(string path, Action<AssetBundle> onLoaded, bool loadContents = false)
		{
			<>c__DisplayClass6_0 CS$<>8__locals0 = new <>c__DisplayClass6_0();
			CS$<>8__locals0.onLoaded = onLoaded;
			LoadBundle(path, (Func<AssetBundle, IEnumerator>?)OnLoaded, loadContents);
			[IteratorStateMachine(typeof(<>c__DisplayClass6_0.<<LoadBundle>g__OnLoaded|0>d))]
			IEnumerator OnLoaded(AssetBundle bundle)
			{
				//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
				return new <>c__DisplayClass6_0.<<LoadBundle>g__OnLoaded|0>d(0)
				{
					<>4__this = CS$<>8__locals0,
					bundle = bundle
				};
			}
		}

		public static void LoadBundle(string path, Func<AssetBundle, IEnumerator>? onLoaded = null, bool loadContents = false)
		{
			Logger.LogInfo("Loading bundle at " + path + "...");
			_operations.Add(new LoadOperation(path, onLoaded, loadContents));
		}

		internal static void FinishLoadOperations(MonoBehaviour behaviour)
		{
			behaviour.StartCoroutine(FinishLoadOperationsRoutine(behaviour));
		}

		[IteratorStateMachine(typeof(<FinishLoadOperationsRoutine>d__9))]
		private static IEnumerator FinishLoadOperationsRoutine(MonoBehaviour behaviour)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <FinishLoadOperationsRoutine>d__9(0)
			{
				behaviour = behaviour
			};
		}

		private static (TMP_Text, Action) SetupLoadingUI()
		{
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = GameObject.Find("HUD Canvas");
			Transform hud = val.transform.Find("HUD");
			((Component)hud).gameObject.SetActive(false);
			TMP_Text val2 = Object.FindObjectOfType<TMP_Text>();
			TMP_Text text = Object.Instantiate<TMP_Text>(val2, val.transform);
			((Object)((Component)text).gameObject).name = "REPOLibText";
			((Component)text).gameObject.SetActive(true);
			text.text = "REPOLib is loading bundles... Hang tight!";
			((Graphic)text).color = Color.white;
			text.alignment = (TextAlignmentOptions)514;
			RectTransform component = ((Component)text).GetComponent<RectTransform>();
			component.anchoredPosition = Vector2.zero;
			component.anchorMin = Vector2.zero;
			component.anchorMax = Vector2.one;
			component.sizeDelta = Vector2.zero;
			return (text, delegate
			{
				((Component)text).gameObject.SetActive(false);
				((Component)hud).gameObject.SetActive(true);
			});
		}

		[IteratorStateMachine(typeof(<FinishLoadOperation>d__11))]
		private static IEnumerator FinishLoadOperation(LoadOperation operation)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <FinishLoadOperation>d__11(0)
			{
				operation = operation
			};
		}

		[IteratorStateMachine(typeof(<LoadBundleContent>d__12))]
		private static IEnumerator LoadBundleContent(LoadOperation operation, AssetBundle bundle)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <LoadBundleContent>d__12(0)
			{
				operation = operation,
				bundle = bundle
			};
		}

		[Obsolete("Use LoadBundleAndContent instead")]
		public static void LoadBundle(string path, string relativePath)
		{
			LoadBundleAndContent(path);
		}

		[CompilerGenerated]
		internal static void <FinishLoadOperation>g__Finish|11_0(ref <>c__DisplayClass11_0 P_0)
		{
			_operations.Remove(P_0.operation);
		}
	}
	internal static class ConfigManager
	{
		public static ConfigFile ConfigFile { get; private set; }

		public static ConfigEntry<bool> ExtendedLogging { get; private set; }

		public static ConfigEntry<bool> DeveloperMode { get; private set; }

		public static ConfigEntry<bool> VanillaDeveloperMode { get; private set; }

		public static void Initialize(ConfigFile configFile)
		{
			ConfigFile = configFile;
			BindConfigs();
		}

		private static void BindConfigs()
		{
			ExtendedLogging = ConfigFile.Bind<bool>("General", "ExtendedLogging", false, "Enable extended logging.");
			DeveloperMode = ConfigFile.Bind<bool>("General", "DeveloperMode", false, "Enable developer mode cheats for testing.");
			VanillaDeveloperMode = ConfigFile.Bind<bool>("General", "VanillaDeveloperMode", false, "Enable vanilla developer mode cheats for testing.");
			VanillaDeveloperMode.SettingChanged += delegate
			{
				SteamManagerPatch.UpdateDeveloperMode();
			};
		}
	}
	internal static class Logger
	{
		public static ManualLogSource ManualLogSource { get; private set; }

		public static void Initialize(ManualLogSource manualLogSource)
		{
			ManualLogSource = manualLogSource;
		}

		public static void LogDebug(object data, bool extended = true)
		{
			Log((LogLevel)32, data, extended);
		}

		public static void LogInfo(object data, bool extended = false)
		{
			Log((LogLevel)16, data, extended);
		}

		public static void LogWarning(object data, bool extended = false)
		{
			Log((LogLevel)4, data, extended);
		}

		public static void LogError(object data, bool extended = false)
		{
			Log((LogLevel)2, data, extended);
		}

		public static void LogFatal(object data, bool extended = false)
		{
			Log((LogLevel)1, data, extended);
		}

		public static void Log(LogLevel logLevel, object data, bool extended = false)
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			if (!extended || IsExtendedLoggingEnabled())
			{
				ManualLogSource manualLogSource = ManualLogSource;
				if (manualLogSource != null)
				{
					manualLogSource.Log(logLevel, data);
				}
			}
		}

		public static bool IsExtendedLoggingEnabled()
		{
			if (ConfigManager.ExtendedLogging == null)
			{
				return false;
			}
			return ConfigManager.ExtendedLogging.Value;
		}
	}
	[BepInPlugin("REPOLib", "REPOLib", "2.0.1")]
	public class Plugin : BaseUnityPlugin
	{
		private readonly Harmony _harmony = new Harmony("REPOLib");

		public static Plugin Instance { get; private set; }

		private void Awake()
		{
			Instance = this;
			Logger.Initialize(Logger.CreateLogSource("REPOLib"));
			Logger.LogInfo("REPOLib has awoken!");
			_harmony.PatchAll(typeof(RunManagerPatch));
			_harmony.PatchAll(typeof(EnemyDirectorPatch));
			_harmony.PatchAll(typeof(StatsManagerPatch));
			_harmony.PatchAll(typeof(SemiFuncPatch));
			_harmony.PatchAll(typeof(AudioManagerPatch));
			_harmony.PatchAll(typeof(SteamManagerPatch));
			_harmony.PatchAll(typeof(EnemyGnomeDirectorPatch));
			_harmony.PatchAll(typeof(EnemyBangDirectorPatch));
			ConfigManager.Initialize(((BaseUnityPlugin)this).Config);
			BundleLoader.LoadAllBundles(Paths.PluginPath, ".repobundle");
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "REPOLib";

		public const string PLUGIN_NAME = "REPOLib";

		public const string PLUGIN_VERSION = "2.0.1";
	}
}
namespace REPOLib.Patches
{
	[HarmonyPatch(typeof(AudioManager))]
	internal static class AudioManagerPatch
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		private static void StartPatch()
		{
			Utilities.FixAudioMixerGroupsOnPrefabs();
		}
	}
	[HarmonyPatch(typeof(EnemyBangDirector))]
	internal static class EnemyBangDirectorPatch
	{
		[CompilerGenerated]
		private sealed class <PreSetup>d__1 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public EnemyBangDirector instance;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <PreSetup>d__1(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0034: Unknown result type (might be due to invalid IL or missing references)
				//IL_003e: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					if (LevelGenerator.Instance.Generated)
					{
						<>2__current = (object)new WaitForSeconds(0.1f);
						<>1__state = 1;
						return true;
					}
					goto IL_004e;
				case 1:
					<>1__state = -1;
					goto IL_004e;
				case 2:
					{
						<>1__state = -1;
						return false;
					}
					IL_004e:
					<>2__current = instance.Setup();
					<>1__state = 2;
					return true;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		[HarmonyPatch("Awake")]
		[HarmonyTranspiler]
		private static IEnumerable<CodeInstruction> AwakeTranspiler(IEnumerable<CodeInstruction> instructions)
		{
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Expected O, but got Unknown
			MethodInfo methodInfo = AccessTools.Method(typeof(EnemyBangDirector), "Setup", (Type[])null, (Type[])null);
			MethodInfo methodInfo2 = AccessTools.Method(typeof(EnemyBangDirectorPatch), "PreSetup", (Type[])null, (Type[])null);
			if (methodInfo == null || methodInfo2 == null)
			{
				Logger.LogError("EnemyBangDirectorPatch: failed to find required methods for AwakeTranspiler.");
				return instructions;
			}
			List<CodeInstruction> list = new List<CodeInstruction>();
			foreach (CodeInstruction instruction in instructions)
			{
				if ((instruction.opcode == OpCodes.Call || instruction.opcode == OpCodes.Callvirt) && instruction.operand is MethodInfo methodInfo3 && methodInfo3 == methodInfo)
				{
					list.Add(new CodeInstruction(OpCodes.Call, (object)methodInfo2));
					Logger.LogDebug("EnemyBangDirectorPatch: AwakeTranspiler replaced " + methodInfo.Name + " call with " + methodInfo2.Name + ".");
				}
				else
				{
					list.Add(instruction);
				}
			}
			return list.AsEnumerable();
		}

		[IteratorStateMachine(typeof(<PreSetup>d__1))]
		private static IEnumerator PreSetup(EnemyBangDirector instance)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <PreSetup>d__1(0)
			{
				instance = instance
			};
		}
	}
	[HarmonyPatch(typeof(EnemyDirector))]
	internal static class EnemyDirectorPatch
	{
		private static bool _alreadyRegistered;

		[HarmonyPatch("Awake")]
		[HarmonyPostfix]
		private static void AwakePatch()
		{
			if (_alreadyRegistered)
			{
				foreach (EnemySetup registeredEnemy in Enemies.RegisteredEnemies)
				{
					EnemyDirector.instance.AddEnemy(registeredEnemy);
				}
				return;
			}
			Enemies.RegisterInitialEnemies();
			_alreadyRegistered = true;
		}
	}
	[HarmonyPatch(typeof(EnemyGnomeDirector))]
	internal static class EnemyGnomeDirectorPatch
	{
		[CompilerGenerated]
		private sealed class <PreSetup>d__1 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public EnemyGnomeDirector instance;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <PreSetup>d__1(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0034: Unknown result type (might be due to invalid IL or missing references)
				//IL_003e: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					if (LevelGenerator.Instance.Generated)
					{
						<>2__current = (object)new WaitForSeconds(0.1f);
						<>1__state = 1;
						return true;
					}
					goto IL_004e;
				case 1:
					<>1__state = -1;
					goto IL_004e;
				case 2:
					{
						<>1__state = -1;
						return false;
					}
					IL_004e:
					<>2__current = instance.Setup();
					<>1__state = 2;
					return true;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		[HarmonyPatch("Awake")]
		[HarmonyTranspiler]
		private static IEnumerable<CodeInstruction> AwakeTranspiler(IEnumerable<CodeInstruction> instructions)
		{
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Expected O, but got Unknown
			MethodInfo methodInfo = AccessTools.Method(typeof(EnemyGnomeDirector), "Setup", (Type[])null, (Type[])null);
			MethodInfo methodInfo2 = AccessTools.Method(typeof(EnemyGnomeDirectorPatch), "PreSetup", (Type[])null, (Type[])null);
			if (methodInfo == null || methodInfo2 == null)
			{
				Logger.LogError("EnemyGnomeDirectorPatch: failed to find required methods for AwakeTranspiler.");
				return instructions;
			}
			List<CodeInstruction> list = new List<CodeInstruction>();
			foreach (CodeInstruction instruction in instructions)
			{
				if ((instruction.opcode == OpCodes.Call || instruction.opcode == OpCodes.Callvirt) && instruction.operand is MethodInfo methodInfo3 && methodInfo3 == methodInfo)
				{
					list.Add(new CodeInstruction(OpCodes.Call, (object)methodInfo2));
					Logger.LogDebug("EnemyGnomeDirectorPatch: AwakeTranspiler replaced " + methodInfo.Name + " call with " + methodInfo2.Name + ".");
				}
				else
				{
					list.Add(instruction);
				}
			}
			return list.AsEnumerable();
		}

		[IteratorStateMachine(typeof(<PreSetup>d__1))]
		private static IEnumerator PreSetup(EnemyGnomeDirector instance)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <PreSetup>d__1(0)
			{
				instance = instance
			};
		}
	}
	[HarmonyPatch(typeof(RunManager))]
	internal static class RunManagerPatch
	{
		private static bool _patchedAwake;

		[HarmonyPatch("Awake")]
		[HarmonyPostfix]
		[HarmonyPriority(0)]
		private static void AwakePatch(RunManager __instance)
		{
			if (!_patchedAwake)
			{
				_patchedAwake = true;
				NetworkPrefabs.Initialize();
				NetworkingEvents.Initialize();
				Levels.RegisterInitialLevels();
				Valuables.RegisterInitialValuables();
				BundleLoader.OnAllBundlesLoaded += CommandManager.Initialize;
				BundleLoader.FinishLoadOperations((MonoBehaviour)(object)__instance);
			}
		}
	}
	[HarmonyPatch(typeof(SemiFunc))]
	internal static class SemiFuncPatch
	{
		[HarmonyPatch("Command")]
		[HarmonyPrefix]
		private static bool CommandPatch(string _command)
		{
			if (_command.StartsWith("/"))
			{
				return Command(_command);
			}
			return true;
		}

		private static bool Command(string message)
		{
			string text = message.ToLower();
			string text2 = text.Split(' ')[0].Substring(1);
			string text3 = "";
			if (text.Length > text2.Length)
			{
				text3 = text.Substring(text2.Length + 1).Trim();
			}
			CommandManager.CommandExecutionMethods.TryGetValue(text2, out MethodInfo value);
			if (value != null)
			{
				CommandExecutionAttribute customAttribute = value.GetCustomAttribute<CommandExecutionAttribute>();
				if (CommandManager.CommandsEnabled.TryGetValue(customAttribute.Name, out var value2) && !value2)
				{
					return false;
				}
				if (customAttribute != null && customAttribute.RequiresDeveloperMode && !ConfigManager.DeveloperMode.Value)
				{
					Logger.LogWarning("Command " + text2 + " requires developer mode to be enabled. Enable it in REPOLib.cfg");
					return false;
				}
				try
				{
					ParameterInfo[] parameters = value.GetParameters();
					if (parameters.Length == 0)
					{
						value.Invoke(null, null);
					}
					else
					{
						value.Invoke(null, new object[1] { text3 });
					}
				}
				catch (Exception arg)
				{
					Logger.LogError($"Error executing command: {arg}");
				}
				return false;
			}
			return true;
		}

		[HarmonyPatch("EnemySpawn")]
		[HarmonyPrefix]
		private static bool EnemySpawnPatch(ref bool __result)
		{
			if (Enemies.SpawnNextEnemiesNotDespawned > 0)
			{
				Enemies.SpawnNextEnemiesNotDespawned--;
				__result = true;
				return false;
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(StatsManager))]
	internal static class StatsManagerPatch
	{
		[HarmonyPatch("RunStartStats")]
		[HarmonyPostfix]
		private static void RunStartStatsPatch()
		{
			Items.RegisterItems();
		}
	}
	[HarmonyPatch(typeof(SteamManager))]
	internal static class SteamManagerPatch
	{
		[HarmonyPatch("Awake")]
		[HarmonyPostfix]
		public static void AwakePatch(SteamManager __instance)
		{
			UpdateDeveloperMode();
		}

		public static void UpdateDeveloperMode()
		{
			if (ConfigManager.VanillaDeveloperMode == null || (Object)(object)SteamManager.instance == (Object)null)
			{
				return;
			}
			bool value = ConfigManager.VanillaDeveloperMode.Value;
			if (SteamManager.instance.developerMode != value)
			{
				if (value)
				{
					Logger.LogInfo("Enabling vanilla developer mode.");
				}
				else
				{
					Logger.LogInfo("Disabling vanilla developer mode.");
				}
			}
			SteamManager.instance.developerMode = value;
		}
	}
}
namespace REPOLib.Objects
{
	public class CustomPrefabPool : IPunPrefabPool
	{
		public readonly Dictionary<string, GameObject> Prefabs = new Dictionary<string, GameObject>();

		private DefaultPool? _defaultPool;

		public DefaultPool DefaultPool
		{
			get
			{
				//IL_0009: Unknown result type (might be due to invalid IL or missing references)
				//IL_0013: Expected O, but got Unknown
				if (_defaultPool == null)
				{
					_defaultPool = new DefaultPool();
				}
				return _defaultPool;
			}
			set
			{
				if (value != null)
				{
					_defaultPool = value;
				}
			}
		}

		public bool RegisterPrefab(string prefabId, GameObject prefab)
		{
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)prefab == (Object)null)
			{
				throw new ArgumentException("CustomPrefabPool: failed to register network prefab. Prefab is null.");
			}
			if (string.IsNullOrWhiteSpace(prefabId))
			{
				throw new ArgumentException("CustomPrefabPool: failed to register network prefab. PrefabId is invalid.");
			}
			if (ResourcesHelper.HasPrefab(prefabId))
			{
				Logger.LogError("CustomPrefabPool: failed to register network prefab \"" + prefabId + "\". Prefab already exists in Resources with the same prefab id.");
				return false;
			}
			if (Prefabs.TryGetValue(prefabId, out GameObject value, ignoreKeyCase: true))
			{
				LogLevel logLevel = (LogLevel)(((Object)(object)value == (Object)(object)prefab) ? 4 : 2);
				Logger.Log(logLevel, "CustomPrefabPool: failed to register network prefab \"" + prefabId + "\". There is already a prefab registered with the same prefab id.");
				return false;
			}
			Prefabs[prefabId] = prefab;
			Logger.LogDebug("CustomPrefabPool: registered network prefab \"" + prefabId + "\"");
			return true;
		}

		public bool HasPrefab(GameObject prefab)
		{
			if (Prefabs.ContainsValue(prefab))
			{
				return true;
			}
			if (ResourcesHelper.HasPrefab(prefab))
			{
				return true;
			}
			return false;
		}

		public bool HasPrefab(string prefabId)
		{
			if (Prefabs.ContainsKey(prefabId, ignoreKeyCase: true))
			{
				return true;
			}
			if (ResourcesHelper.HasPrefab(prefabId))
			{
				return true;
			}
			return false;
		}

		public string? GetPrefabId(GameObject prefab)
		{
			if ((Object)(object)prefab == (Object)null)
			{
				Logger.LogError("Failed to get prefab id. GameObject is null.");
				return string.Empty;
			}
			return Prefabs.GetKeyOrDefault(prefab);
		}

		public GameObject? GetPrefab(string prefabId)
		{
			return Prefabs.GetValueOrDefault(prefabId, ignoreKeyCase: true);
		}

		public GameObject? Instantiate(string prefabId, Vector3 position, Quaternion rotation)
		{
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: 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_0086: Unknown result type (might be due to invalid IL or missing references)
			if (string.IsNullOrWhiteSpace(prefabId))
			{
				throw new ArgumentException("CustomPrefabPool: failed to spawn network prefab. PrefabId is null.");
			}
			GameObject val;
			if (!Prefabs.TryGetValue(prefabId, out GameObject value, ignoreKeyCase: true))
			{
				val = DefaultPool.Instantiate(prefabId, position, rotation);
				if ((Object)(object)val == (Object)null)
				{
					Logger.LogError("CustomPrefabPool: failed to spawn network prefab \"" + prefabId + "\". GameObject is null.");
				}
				return val;
			}
			bool activeSelf = value.activeSelf;
			if (activeSelf)
			{
				value.SetActive(false);
			}
			val = Object.Instantiate<GameObject>(value, position, rotation);
			if (activeSelf)
			{
				value.SetActive(true);
			}
			Logger.LogInfo($"CustomPrefabPool: spawned network prefab \"{prefabId}\" at position {position}, rotation {((Quaternion)(ref rotation)).eulerAngles}", extended: true);
			return val;
		}

		public void Destroy(GameObject gameObject)
		{
			Object.Destroy((Object)(object)gameObject);
		}
	}
	public class UnityObjectNameComparer<T> : IEqualityComparer<T> where T : Object
	{
		public StringComparison ComparisonType { get; private set; }

		public UnityObjectNameComparer(StringComparison comparisonType = StringComparison.OrdinalIgnoreCase)
		{
			ComparisonType = comparisonType;
		}

		public bool Equals(T x, T y)
		{
			if ((Object)(object)x == (Object)(object)y)
			{
				return true;
			}
			if ((Object)(object)x == (Object)null || (Object)(object)y == (Object)null)
			{
				return false;
			}
			return ((Object)x).name.Equals(((Object)y).name, ComparisonType);
		}

		public int GetHashCode(T obj)
		{
			if (!((Object)(object)obj != (Object)null))
			{
				return 0;
			}
			return ((Object)obj).name.GetHashCode();
		}
	}
}
namespace REPOLib.Objects.Sdk
{
	public abstract class Content : ScriptableObject
	{
		public abstract string Name { get; }

		public abstract void Initialize(Mod mod);
	}
	[CreateAssetMenu(menuName = "REPOLib/Enemy", order = 3, fileName = "New Enemy")]
	public class EnemyContent : Content
	{
		[SerializeField]
		private EnemySetup _setup;

		public EnemySetup Setup => _setup;

		public override string Name
		{
			get
			{
				EnemySetup setup = Setup;
				return ((setup != null) ? ((Object)setup).name : null) ?? string.Empty;
			}
		}

		public override void Initialize(Mod mod)
		{
			Enemies.RegisterEnemy(Setup);
		}
	}
	[CreateAssetMenu(menuName = "REPOLib/Item", order = 2, fileName = "New Item")]
	public class ItemContent : Content
	{
		[SerializeField]
		private ItemAttributes _prefab;

		public ItemAttributes Prefab => _prefab;

		public override string Name
		{
			get
			{
				ItemAttributes prefab = Prefab;
				return ((prefab != null) ? ((Object)prefab).name : null) ?? string.Empty;
			}
		}

		public override void Initialize(Mod mod)
		{
			_prefab.item.prefab = ((Component)_prefab).gameObject;
			Items.RegisterItem(Prefab.item);
		}
	}
	[CreateAssetMenu(menuName = "REPOLib/Level", order = 4, fileName = "New Level")]
	public class LevelContent : Content
	{
		[SerializeField]
		private Level _level;

		public Level Level => _level;

		public override string Name
		{
			get
			{
				Level level = Level;
				return ((level != null) ? ((Object)level).name : null) ?? string.Empty;
			}
		}

		public override void Initialize(Mod mod)
		{
			Levels.RegisterLevel(Level);
		}
	}
	[CreateAssetMenu(menuName = "REPOLib/Mod", order = 0, fileName = "New Mod")]
	public class Mod : ScriptableObject
	{
		[SerializeField]
		private string _name;

		[SerializeField]
		private string _author;

		[SerializeField]
		private string _version = "1.0.0";

		[SerializeField]
		private string _description;

		[SerializeField]
		private string _websiteUrl;

		[SerializeField]
		private string[] _dependencies = new string[1] { "Zehs-REPOLib-2.0.1" };

		[SerializeField]
		private Sprite _icon;

		[SerializeField]
		private TextAsset _readme;

		public string Name => _name;

		public string Author => _author;

		public string Version => _version;

		public string Description => _description;

		public string WebsiteUrl => _websiteUrl;

		public IReadOnlyList<string> Dependencies => _dependencies;

		public Sprite Icon => _icon;

		public TextAsset Readme => _readme;

		public string FullName => Author + "-" + Name;

		public string Identifier => Author + "-" + Name + "-" + Version;
	}
	[CreateAssetMenu(menuName = "REPOLib/Valuable", order = 1, fileName = "New Valuable")]
	public class ValuableContent : Content
	{
		[SerializeField]
		private ValuableObject _prefab;

		[SerializeField]
		private string[] _valuablePresets = new string[1] { "Valuables - Generic" };

		public ValuableObject Prefab => _prefab;

		public IReadOnlyList<string> ValuablePresets => _valuablePresets;

		public override string Name
		{
			get
			{
				ValuableObject prefab = Prefab;
				return ((prefab != null) ? ((Object)prefab).name : null) ?? string.Empty;
			}
		}

		public override void Initialize(Mod mod)
		{
			Valuables.RegisterValuable(((Component)Prefab).gameObject, ValuablePresets.ToList());
		}
	}
}
namespace REPOLib.Modules
{
	public static class Enemies
	{
		internal static int SpawnNextEnemiesNotDespawned = 0;

		private static readonly List<EnemySetup> _enemiesToRegister = new List<EnemySetup>();

		private static readonly List<EnemySetup> _enemiesRegistered = new List<EnemySetup>();

		private static bool _initialEnemiesRegistered;

		public static IReadOnlyList<EnemySetup> AllEnemies => GetEnemies();

		public static IReadOnlyList<EnemySetup> RegisteredEnemies => _enemiesRegistered;

		internal static void RegisterInitialEnemies()
		{
			if (_initialEnemiesRegistered)
			{
				return;
			}
			foreach (EnemySetup item in _enemiesToRegister)
			{
				RegisterEnemyWithGame(item);
			}
			_enemiesToRegister.Clear();
			_initialEnemiesRegistered = true;
		}

		private static void RegisterEnemyWithGame(EnemySetup enemy)
		{
			//IL_005f: 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)
			if (!_enemiesRegistered.Contains(enemy) && enemy.TryGetEnemyParent(out EnemyParent enemyParent))
			{
				if (EnemyDirector.instance.AddEnemy(enemy))
				{
					_enemiesRegistered.Add(enemy);
					Logger.LogInfo($"Added enemy \"{enemyParent.enemyName}\" to difficulty {enemyParent.difficulty}", extended: true);
				}
				else
				{
					Logger.LogWarning($"Failed to add enemy \"{enemyParent.enemyName}\" to difficulty {enemyParent.difficulty}", extended: true);
				}
			}
		}

		public static void RegisterEnemy(EnemySetup enemySetup)
		{
			if ((Object)(object)enemySetup == (Object)null || enemySetup.spawnObjects == null || enemySetup.spawnObjects.Count == 0)
			{
				throw new ArgumentException("Failed to register enemy. EnemySetup or spawnObjects list is empty.");
			}
			EnemyParent enemyParent = enemySetup.GetEnemyParent();
			if ((Object)(object)enemyParent == (Object)null)
			{
				Logger.LogError("Failed to register enemy \"" + ((Object)enemySetup).name + "\". No enemy prefab found in spawnObjects list.");
				return;
			}
			if (ResourcesHelper.HasEnemyPrefab(enemySetup))
			{
				Logger.LogError("Failed to register enemy \"" + enemyParent.enemyName + "\". Enemy prefab already exists in Resources with the same name.");
				return;
			}
			if (_enemiesToRegister.Contains(enemySetup))
			{
				Logger.LogError("Failed to register enemy \"" + enemyParent.enemyName + "\". Enemy is already registered!");
				return;
			}
			foreach (GameObject distinctSpawnObject in enemySetup.GetDistinctSpawnObjects())
			{
				foreach (EnemySetup item in _enemiesToRegister)
				{
					if (item.AnySpawnObjectsNameEqualsThatIsNotTheSameObject(distinctSpawnObject))
					{
						Logger.LogError("Failed to register enemy \"" + enemyParent.enemyName + "\". Enemy \"" + ((Object)item).name + "\" already has a spawn object called \"" + ((Object)distinctSpawnObject).name + "\"");
						return;
					}
				}
			}
			foreach (GameObject distinctSpawnObject2 in enemySetup.GetDistinctSpawnObjects())
			{
				string enemyPrefabPath = ResourcesHelper.GetEnemyPrefabPath(distinctSpawnObject2);
				if (!NetworkPrefabs.HasNetworkPrefab(enemyPrefabPath))
				{
					NetworkPrefabs.RegisterNetworkPrefab(enemyPrefabPath, distinctSpawnObject2);
				}
				Utilities.FixAudioMixerGroups(distinctSpawnObject2);
			}
			if (_initialEnemiesRegistered)
			{
				RegisterEnemyWithGame(enemySetup);
			}
			else
			{
				_enemiesToRegister.Add(enemySetup);
			}
		}

		public static List<EnemyParent>? SpawnEnemy(EnemySetup enemySetup, Vector3 position, Quaternion rotation, bool spawnDespawned = true)
		{
			//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0241: Unknown result type (might be due to invalid IL or missing references)
			//IL_0194: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)enemySetup == (Object)null)
			{
				Logger.LogError("Failed to spawn enemy. EnemySetup is null.");
				return null;
			}
			if (!enemySetup.TryGetEnemyParent(out EnemyParent enemyParent))
			{
				Logger.LogError("Failed to spawn enemy. EnemyParent is null.");
				return null;
			}
			if ((Object)(object)LevelGenerator.Instance == (Object)null)
			{
				Logger.LogError("Failed to spawn enemy \"" + enemyParent.enemyName + "\". EnemySetup instance is null.");
				return null;
			}
			if ((Object)(object)RunManager.instance == (Object)null)
			{
				Logger.LogError("Failed to spawn enemy \"" + enemyParent.enemyName + "\". RunManager instance is null.");
				return null;
			}
			if ((Object)(object)EnemyDirector.instance == (Object)null)
			{
				Logger.LogError("Failed to spawn enemy \"" + enemyParent.enemyName + "\". EnemyDirector instance is null.");
				return null;
			}
			List<EnemyParent> list = new List<EnemyParent>();
			EnemyParent val2 = default(EnemyParent);
			foreach (GameObject sortedSpawnObject in enemySetup.GetSortedSpawnObjects())
			{
				if ((Object)(object)sortedSpawnObject == (Object)null)
				{
					Logger.LogError("Failed to spawn enemy \"" + enemyParent.enemyName + "\" spawn object. GameObject is null.");
					continue;
				}
				string enemyPrefabPath = ResourcesHelper.GetEnemyPrefabPath(sortedSpawnObject);
				GameObject val = NetworkPrefabs.SpawnNetworkPrefab(enemyPrefabPath, position, rotation, 0);
				if ((Object)(object)val == (Object)null)
				{
					Logger.LogError("Failed to spawn enemy \"" + enemyParent.enemyName + "\" spawn object \"" + ((Object)sortedSpawnObject).name + "\"");
				}
				else if (val.TryGetComponent<EnemyParent>(ref val2))
				{
					list.Add(val2);
					if (!spawnDespawned)
					{
						SpawnNextEnemiesNotDespawned++;
					}
					val2.SetupDone = true;
					Enemy componentInChildren = val.GetComponentInChildren<Enemy>();
					if ((Object)(object)componentInChildren != (Object)null)
					{
						componentInChildren.EnemyTeleported(position);
					}
					else
					{
						Logger.LogError("Enemy \"" + enemyParent.enemyName + "\" spawn object \"" + ((Object)sortedSpawnObject).name + "\" does not have an enemy component.");
					}
					LevelGenerator instance = LevelGenerator.Instance;
					instance.EnemiesSpawnTarget++;
					EnemyDirector.instance.FirstSpawnPointAdd(val2);
				}
			}
			if (list.Count == 0)
			{
				Logger.LogInfo("Failed to spawn enemy \"" + enemyParent.enemyName + "\". No spawn objects where spawned.", extended: true);
				return list;
			}
			Logger.LogInfo($"Spawned enemy \"{enemyParent.enemyName}\" at position {position}", extended: true);
			RunManager.instance.EnemiesSpawnedRemoveEnd();
			return list;
		}

		public static IReadOnlyList<EnemySetup> GetEnemies()
		{
			if ((Object)(object)EnemyDirector.instance == (Object)null)
			{
				return Array.Empty<EnemySetup>();
			}
			return EnemyDirector.instance.GetEnemies();
		}

		public static bool TryGetEnemyByName(string name, [NotNullWhen(true)] out EnemySetup? enemySetup)
		{
			enemySetup = GetEnemyByName(name);
			return (Object)(object)enemySetup != (Object)null;
		}

		public static EnemySetup? GetEnemyByName(string name)
		{
			return EnemyDirector.instance?.GetEnemyByName(name);
		}

		public static bool TryGetEnemyThatContainsName(string name, [NotNullWhen(true)] out EnemySetup? enemySetup)
		{
			enemySetup = GetEnemyThatContainsName(name);
			return (Object)(object)enemySetup != (Object)null;
		}

		public static EnemySetup? GetEnemyThatContainsName(string name)
		{
			return EnemyDirector.instance?.GetEnemyThatContainsName(name);
		}
	}
	public static class Items
	{
		private static readonly List<Item> _itemsToRegister = new List<Item>();

		private static readonly List<Item> _itemsRegistered = new List<Item>();

		private static bool _initialItemsRegistered;

		public static IReadOnlyList<Item> AllItems => GetItems();

		public static IReadOnlyList<Item> RegisteredItems => _itemsRegistered;

		internal static void RegisterItems()
		{
			if ((Object)(object)StatsManager.instance == (Object)null)
			{
				Logger.LogError("Failed to register items. StatsManager instance is null.");
				return;
			}
			Logger.LogInfo("Adding items.");
			foreach (Item item in _itemsToRegister)
			{
				RegisterItemWithGame(item);
			}
			_initialItemsRegistered = true;
		}

		private static void RegisterItemWithGame(Item item)
		{
			Utilities.FixAudioMixerGroups(item.prefab);
			if (StatsManager.instance.AddItem(item))
			{
				if (!_itemsRegistered.Contains(item))
				{
					_itemsRegistered.Add(item);
				}
				Logger.LogInfo("Added item \"" + item.itemName + "\"", extended: true);
			}
			else
			{
				Logger.LogWarning("Failed to add item \"" + item.itemName + "\"", extended: true);
			}
		}

		public static void RegisterItem(Item item)
		{
			Item item2 = item;
			if ((Object)(object)item2 == (Object)null)
			{
				throw new ArgumentException("Failed to register item. Item is null.");
			}
			if ((Object)(object)item2.prefab == (Object)null)
			{
				Logger.LogError("Failed to register item \"" + item2.itemName + "\". Item prefab is null.");
				return;
			}
			if (item2.itemAssetName != ((Object)item2.prefab).name)
			{
				Logger.LogError("Failed to register item \"" + item2.itemName + "\". Item itemAssetName does not match the prefab name.");
				return;
			}
			if (ResourcesHelper.HasItemPrefab(item2))
			{
				Logger.LogError("Failed to register item \"" + item2.itemName + "\". Item prefab already exists in Resources with the same name.");
				return;
			}
			if (_itemsToRegister.Any((Item x) => x.itemAssetName == item2.itemAssetName))
			{
				Logger.LogError("Failed to register item \"" + item2.itemName + "\". Item prefab already exists with the same name.");
				return;
			}
			if (_itemsToRegister.Contains(item2))
			{
				Logger.LogError("Failed to register item \"" + item2.itemName + "\". Item is already registered!");
				return;
			}
			string itemPrefabPath = ResourcesHelper.GetItemPrefabPath(item2);
			NetworkPrefabs.RegisterNetworkPrefab(itemPrefabPath, item2.prefab);
			_itemsToRegister.Add(item2);
			if (_initialItemsRegistered)
			{
				RegisterItemWithGame(item2);
			}
		}

		public static GameObject? SpawnItem(Item item, Vector3 position, Quaternion rotation)
		{
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)item == (Object)null)
			{
				Logger.LogError("Failed to spawn item. Item is null.");
				return null;
			}
			if ((Object)(object)item.prefab == (Object)null)
			{
				Logger.LogError("Failed to spawn item. Prefab is null.");
				return null;
			}
			if (!SemiFunc.IsMasterClientOrSingleplayer())
			{
				Logger.LogError("Failed to spawn item \"" + item.itemName + "\". You are not the host.");
				return null;
			}
			string itemPrefabPath = ResourcesHelper.GetItemPrefabPath(item);
			GameObject val = NetworkPrefabs.SpawnNetworkPrefab(itemPrefabPath, position, rotation, 0);
			if ((Object)(object)val == (Object)null)
			{
				Logger.LogError("Failed to spawn item \"" + item.itemName + "\"");
				return null;
			}
			Logger.LogInfo($"Spawned item \"{item.itemName}\" at position {position}, rotation: {((Quaternion)(ref rotation)).eulerAngles}", extended: true);
			return val;
		}

		public static IReadOnlyList<Item> GetItems()
		{
			if ((Object)(object)StatsManager.instance == (Object)null)
			{
				return Array.Empty<Item>();
			}
			return StatsManager.instance.GetItems();
		}

		public static bool TryGetItemByName(string name, [NotNullWhen(true)] out Item? item)
		{
			item = GetItemByName(name);
			return (Object)(object)item != (Object)null;
		}

		public static Item? GetItemByName(string name)
		{
			return StatsManager.instance?.GetItemByName(name);
		}

		public static bool TryGetItemThatContainsName(string name, [NotNullWhen(true)] out Item? item)
		{
			item = GetItemThatContainsName(name);
			return (Object)(object)item != (Object)null;
		}

		public static Item? GetItemThatContainsName(string name)
		{
			return StatsManager.instance?.GetItemThatContainsName(name);
		}
	}
	public static class Levels
	{
		private static readonly List<Level> _levelsToRegister = new List<Level>();

		private static readonly List<Level> _levelsRegistered = new List<Level>();

		private static bool _initialLevelsRegistered;

		public static IReadOnlyList<Level> AllLevels => GetLevels();

		public static IReadOnlyList<Level> RegisteredLevels => _levelsRegistered;

		internal static void RegisterInitialLevels()
		{
			if (_initialLevelsRegistered)
			{
				return;
			}
			ValuablePresets.CacheValuablePresets();
			Logger.LogInfo("Adding levels.");
			foreach (Level item in _levelsToRegister)
			{
				RegisterLevelWithGame(item);
			}
			_levelsToRegister.Clear();
			_initialLevelsRegistered = true;
		}

		private static void RegisterLevelWithGame(Level level)
		{
			if (_levelsRegistered.Contains(level))
			{
				return;
			}
			if (level.ValuablePresets.Count == 0)
			{
				Logger.LogWarning("Level \"" + ((Object)level).name + "\" does not have any valuable presets! Adding generic preset.");
				level.ValuablePresets.Add(ValuablePresets.GenericPreset);
			}
			for (int i = 0; i < level.ValuablePresets.Count; i++)
			{
				LevelValuables val = level.ValuablePresets[i];
				if (ValuablePresets.AllValuablePresets.Values.Contains(val))
				{
					continue;
				}
				if (ValuablePresets.AllValuablePresets.TryGetValue(((Object)val).name, out LevelValuables value))
				{
					if (val.GetCombinedList().Count > 0)
					{
						Logger.LogWarning("Proxy preset \"" + ((Object)val).name + "\" in level \"" + ((Object)level).name + "\" contains valuables! This likely caused duplicate valuables to load!");
					}
					level.ValuablePresets[i] = value;
					Logger.LogInfo("Replaced proxy preset \"" + ((Object)val).name + "\" in level \"" + ((Object)level).name + "\".", extended: true);
				}
				else
				{
					ValuablePresets.RegisterValuablePreset(val);
					Logger.LogInfo("Registered valuable preset \"" + ((Object)val).name + "\" from \"" + ((Object)level).name + "\".", extended: true);
				}
			}
			RunManager.instance.levels.Add(level);
			Logger.LogInfo("Added level \"" + ((Object)level).name + "\"", extended: true);
			_levelsRegistered.Add(level);
		}

		public static void RegisterLevel(Level level)
		{
			Level level2 = level;
			if ((Object)(object)level2 == (Object)null)
			{
				Logger.LogError("Failed to register level. Level is null.");
				return;
			}
			if (_levelsToRegister.Any((Level x) => ((Object)x).name.Equals(((Object)level2).name, StringComparison.OrdinalIgnoreCase)))
			{
				Logger.LogError("Failed to register level \"" + ((Object)level2).name + "\". Level already exists with the same name.");
				return;
			}
			if (_levelsToRegister.Contains(level2))
			{
				Logger.LogWarning("Failed to register level \"" + ((Object)level2).name + "\". Level is already registered!");
				return;
			}
			List<(GameObject, ResourcesHelper.LevelPrefabType)> list2 = (from prefab in new List<GameObject>[12]
				{
					level2.ModulesExtraction1, level2.ModulesExtraction2, level2.ModulesExtraction3, level2.ModulesNormal1, level2.ModulesNormal2, level2.ModulesNormal3, level2.ModulesPassage1, level2.ModulesPassage2, level2.ModulesPassage3, level2.ModulesDeadEnd1,
					level2.ModulesDeadEnd2, level2.ModulesDeadEnd3
				}.SelectMany((List<GameObject> list) => list)
				select (prefab, ResourcesHelper.LevelPrefabType.Module)).ToList();
			foreach (GameObject startRoom in level2.StartRooms)
			{
				list2.Add((startRoom, ResourcesHelper.LevelPrefabType.StartRoom));
			}
			if ((Object)(object)level2.ConnectObject != (Object)null)
			{
				list2.Add((level2.ConnectObject, ResourcesHelper.LevelPrefabType.Other));
			}
			if ((Object)(object)level2.BlockObject != (Object)null)
			{
				list2.Add((level2.BlockObject, ResourcesHelper.LevelPrefabType.Other));
			}
			foreach (var item3 in list2)
			{
				GameObject item = item3.Item1;
				ResourcesHelper.LevelPrefabType item2 = item3.Item2;
				string levelPrefabPath = ResourcesHelper.GetLevelPrefabPath(level2, item, item2);
				if (!ResourcesHelper.HasPrefab(levelPrefabPath))
				{
					NetworkPrefabs.RegisterNetworkPrefab(levelPrefabPath, item);
					Utilities.FixAudioMixerGroups(item);
				}
			}
			if (_initialLevelsRegistered)
			{
				RegisterLevelWithGame(level2);
			}
			else
			{
				_levelsToRegister.Add(level2);
			}
		}

		public static IReadOnlyList<Level> GetLevels()
		{
			if ((Object)(object)RunManager.instance == (Object)null)
			{
				return Array.Empty<Level>();
			}
			return RunManager.instance.levels;
		}

		public static bool TryGetLevelByName(string name, [NotNullWhen(true)] out Level? level)
		{
			level = GetLevelByName(name);
			return (Object)(object)level != (Object)null;
		}

		public static Level? GetLevelByName(string name)
		{
			foreach (Level level in GetLevels())
			{
				if (((Object)level).name.EqualsAny(new <>z__ReadOnlyArray<string>(new string[2]
				{
					name,
					"Level - " + name
				}), StringComparison.OrdinalIgnoreCase))
				{
					return level;
				}
			}
			return null;
		}

		public static bool TryGetLevelThatContainsName(string name, [NotNullWhen(true)] out Level? level)
		{
			level = GetLevelThatContainsName(name);
			return (Object)(object)level != (Object)null;
		}

		public static Level? GetLevelThatContainsName(string name)
		{
			foreach (Level level in GetLevels())
			{
				if (((Object)level).name.Contains(name, StringComparison.OrdinalIgnoreCase))
				{
					return level;
				}
			}
			return null;
		}
	}
	public static class NetworkingEvents
	{
		public static readonly byte[] ReservedEventCodes = new byte[3] { 0, 1, 2 };

		private static readonly List<NetworkedEvent> _customEvents = new List<NetworkedEvent>();

		public static readonly RaiseEventOptions RaiseAll = new RaiseEventOptions
		{
			Receivers = (ReceiverGroup)1
		};

		public static readonly RaiseEventOptions RaiseOthers = new RaiseEventOptions
		{
			Receivers = (ReceiverGroup)0
		};

		public static readonly RaiseEventOptions RaiseMasterClient = new RaiseEventOptions
		{
			Receivers = (ReceiverGroup)2
		};

		public static IReadOnlyList<NetworkedEvent> CustomEvents => _customEvents;

		internal static void Initialize()
		{
			PhotonNetwork.NetworkingClient.EventReceived += OnEvent;
			Application.quitting += delegate
			{
				PhotonNetwork.NetworkingClient.EventReceived -= OnEvent;
			};
		}

		internal static void AddCustomEvent(NetworkedEvent networkedEvent)
		{
			if (!_customEvents.Contains(networkedEvent))
			{
				_customEvents.Add(networkedEvent);
			}
		}

		private static void OnEvent(EventData photonEvent)
		{
			EventData photonEvent2 = photonEvent;
			_customEvents.FirstOrDefault((NetworkedEvent e) => e.EventCode == photonEvent2.Code)?.EventAction?.Invoke(photonEvent2);
		}

		internal static bool TryGetUniqueEventCode(out byte eventCode)
		{
			eventCode = 0;
			while (IsEventCodeTaken(eventCode) && eventCode < 200)
			{
				eventCode++;
			}
			if (eventCode > 200 || (eventCode == 200 && IsEventCodeTaken(eventCode)))
			{
				eventCode = 0;
				return false;
			}
			return true;
		}

		public static bool IsEventCodeTaken(byte eventCode)
		{
			if (ReservedEventCodes.Any((byte x) => x == eventCode))
			{
				return true;
			}
			if (_customEvents.Any((NetworkedEvent x) => x.EventCode == eventCode))
			{
				return true;
			}
			return false;
		}
	}
	public class NetworkedEvent
	{
		public string Name { get; private set; }

		public byte EventCode { get; private set; }

		public Action<EventData> EventAction { get; private set; }

		public NetworkedEvent(string name, Action<EventData> eventAction)
		{
			Name = name;
			EventAction = eventAction;
			if (NetworkingEvents.TryGetUniqueEventCode(out var eventCode))
			{
				EventCode = eventCode;
				NetworkingEvents.AddCustomEvent(this);
				Logger.LogInfo($"Registered NetworkedEvent \"{Name}\" with event code: {EventCode}", extended: true);
			}
			else
			{
				Logger.LogError("Failed to register NetworkedEvent \"" + Name + "\". Could not get unique event code.");
			}
		}

		public void RaiseEvent(object eventContent, RaiseEventOptions raiseEventOptions, SendOptions sendOptions)
		{
			//IL_0018: 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 (SemiFunc.IsMultiplayer())
			{
				PhotonNetwork.RaiseEvent(EventCode, eventContent, raiseEventOptions, sendOptions);
			}
			else if ((int)raiseEventOptions.Receivers != 0)
			{
				RaiseEventSingleplayer(eventContent);
			}
		}

		private void RaiseEventSingleplayer(object eventContent)
		{
			//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_001a: Expected O, but got Unknown
			if (!SemiFunc.IsMultiplayer())
			{
				EventData val = new EventData
				{
					Code = EventCode
				};
				val.Parameters[val.CustomDataKey] = eventContent;
				val.Parameters[val.SenderKey] = 1;
				EventAction?.Invoke(val);
			}
		}
	}
	public static class NetworkPrefabs
	{
		private static CustomPrefabPool? _customPrefabPool;

		internal static CustomPrefabPool CustomPrefabPool
		{
			get
			{
				if (_customPrefabPool == null)
				{
					_customPrefabPool = new CustomPrefabPool();
				}
				return _customPrefabPool;
			}
			private set
			{
				_customPrefabPool = value;
			}
		}

		internal static void Initialize()
		{
			if (PhotonNetwork.PrefabPool is CustomPrefabPool)
			{
				Logger.LogWarning("NetworkPrefabs failed to initialize. PhotonNetwork.PrefabPool is already a CustomPrefabPool.");
				return;
			}
			Logger.LogInfo("Initializing NetworkPrefabs.");
			Logger.LogDebug($"PhotonNetwork.PrefabPool = {((object)PhotonNetwork.PrefabPool).GetType()}");
			IPunPrefabPool prefabPool = PhotonNetwork.PrefabPool;
			DefaultPool val = (DefaultPool)(object)((prefabPool is DefaultPool) ? prefabPool : null);
			if (val != null)
			{
				CustomPrefabPool.DefaultPool = val;
			}
			else if (!(PhotonNetwork.PrefabPool is CustomPrefabPool))
			{
				Logger.LogWarning($"PhotonNetwork has an unknown prefab pool assigned. PhotonNetwork.PrefabPool = {((object)PhotonNetwork.PrefabPool).GetType()}");
			}
			PhotonNetwork.PrefabPool = (IPunPrefabPool)(object)CustomPrefabPool;
			Logger.LogInfo("Replaced PhotonNetwork.PrefabPool with CustomPrefabPool.");
			Logger.LogDebug($"PhotonNetwork.PrefabPool = {((object)PhotonNetwork.PrefabPool).GetType()}");
			Logger.LogInfo("Finished initializing NetworkPrefabs.");
		}

		public static void RegisterNetworkPrefab(GameObject prefab)
		{
			RegisterNetworkPrefab((prefab != null) ? ((Object)prefab).name : null, prefab);
		}

		public static void RegisterNetworkPrefab(string prefabId, GameObject prefab)
		{
			CustomPrefabPool.RegisterPrefab(prefabId, prefab);
		}

		public static bool HasNetworkPrefab(string prefabId)
		{
			return CustomPrefabPool.HasPrefab(prefabId);
		}

		public static GameObject? SpawnNetworkPrefab(string prefabId, Vector3 position, Quaternion rotation, byte group = 0, object[]? data = null)
		{
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			if (string.IsNullOrWhiteSpace(prefabId))
			{
				Logger.LogError("Failed to spawn network prefab. PrefabId is null.");
				return null;
			}
			if (!HasNetworkPrefab(prefabId))
			{
				Logger.LogError("Failed to spawn network prefab \"" + prefabId + "\". PrefabId is not registered as a network prefab.");
				return null;
			}
			if (!SemiFunc.IsMasterClientOrSingleplayer())
			{
				Logger.LogError("Failed to spawn network prefab \"" + prefabId + "\". You are not the host.");
				return null;
			}
			if (SemiFunc.IsMultiplayer())
			{
				return PhotonNetwork.InstantiateRoomObject(prefabId, position, rotation, group, data);
			}
			return Object.Instantiate<GameObject>(CustomPrefabPool.GetPrefab(prefabId), position, rotation);
		}
	}
	public static class ResourcesHelper
	{
		public enum LevelPrefabType
		{
			Module,
			Other,
			StartRoom
		}

		public static string GetValuablesFolderPath(Type volumeType)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Expected I4, but got Unknown
			return "Valuables/" + (int)volumeType switch
			{
				0 => "01 Tiny", 
				1 => "02 Small", 
				2 => "03 Medium", 
				3 => "04 Big", 
				4 => "05 Wide", 
				5 => "06 Tall", 
				6 => "07 Very Tall", 
				_ => string.Empty, 
			};
		}

		public static string GetItemsFolderPath()
		{
			return "Items";
		}

		public static string GetEnemiesFolderPath()
		{
			return "Enemies";
		}

		public static string GetLevelPrefabsFolderPath(Level level, LevelPrefabType type)
		{
			string text = type switch
			{
				LevelPrefabType.Module => "Modules", 
				LevelPrefabType.Other => "Other", 
				LevelPrefabType.StartRoom => "Start Room", 
				_ => string.Empty, 
			};
			return "Level/" + level.ResourcePath + "/" + text;
		}

		public static string GetValuablePrefabPath(ValuableObject valuableObject)
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)valuableObject == (Object)null)
			{
				return string.Empty;
			}
			string valuablesFolderPath = GetValuablesFolderPath(valuableObject.volumeType);
			return valuablesFolderPath + "/" + ((Object)((Component)valuableObject).gameObject).name;
		}

		public static string GetValuablePrefabPath(GameObject prefab)
		{
			if ((Object)(object)prefab == (Object)null)
			{
				return string.Empty;
			}
			ValuableObject valuableObject = default(ValuableObject);
			if (prefab.TryGetComponent<ValuableObject>(ref valuableObject))
			{
				return GetValuablePrefabPath(valuableObject);
			}
			return string.Empty;
		}

		public static string GetItemPrefabPath(Item item)
		{
			if ((Object)(object)item == (Object)null)
			{
				return string.Empty;
			}
			return GetItemPrefabPath(item.prefab);
		}

		public static string GetItemPrefabPath(GameObject prefab)
		{
			if ((Object)(object)prefab == (Object)null)
			{
				return string.Empty;
			}
			string itemsFolderPath = GetItemsFolderPath();
			return itemsFolderPath + "/" + ((Object)prefab).name;
		}

		public static string GetEnemyPrefabPath(EnemySetup enemySetup)
		{
			if ((Object)(object)enemySetup == (Object)null || enemySetup.spawnObjects == null)
			{
				return string.Empty;
			}
			GameObject mainSpawnObject = enemySetup.GetMainSpawnObject();
			if ((Object)(object)mainSpawnObject == (Object)null)
			{
				return string.Empty;
			}
			string enemiesFolderPath = GetEnemiesFolderPath();
			return enemiesFolderPath + "/" + ((Object)mainSpawnObject).name;
		}

		public static string GetEnemyPrefabPath(GameObject prefab)
		{
			if ((Object)(object)prefab == (Object)null)
			{
				return string.Empty;
			}
			string enemiesFolderPath = GetEnemiesFolderPath();
			return enemiesFolderPath + "/" + ((Object)prefab).name;
		}

		public static string GetLevelPrefabPath(Level level, GameObject prefab, LevelPrefabType type)
		{
			if ((Object)(object)prefab == (Object)null)
			{
				return string.Empty;
			}
			string levelPrefabsFolderPath = GetLevelPrefabsFolderPath(level, type);
			return levelPrefabsFolderPath + "/" + ((Object)prefab).name;
		}

		public static bool HasValuablePrefab(ValuableObject valuableObject)
		{
			if ((Object)(object)valuableObject == (Object)null)
			{
				return false;
			}
			string valuablePrefabPath = GetValuablePrefabPath(valuableObject);
			return (Object)(object)Resources.Load<GameObject>(valuablePrefabPath) != (Object)null;
		}

		public static bool HasItemPrefab(Item item)
		{
			if ((Object)(object)item == (Object)null)
			{
				return false;
			}
			string itemPrefabPath = GetItemPrefabPath(item);
			return (Object)(object)Resources.Load<GameObject>(itemPrefabPath) != (Object)null;
		}

		public static bool HasEnemyPrefab(EnemySetup enemySetup)
		{
			if ((Object)(object)enemySetup == (Object)null)
			{
				return false;
			}
			foreach (GameObject distinctSpawnObject in enemySetup.GetDistinctSpawnObjects())
			{
				string enemyPrefabPath = GetEnemyPrefabPath(distinctSpawnObject);
				if ((Object)(object)Resources.Load<GameObject>(enemyPrefabPath) != (Object)null)
				{
					return true;
				}
			}
			return false;
		}

		public static bool HasPrefab(GameObject prefab)
		{
			return (Object)(object)Resources.Load<GameObject>((prefab != null) ? ((Object)prefab).name : null) != (Object)null;
		}

		public static bool HasPrefab(string prefabId)
		{
			return (Object)(object)Resources.Load<GameObject>(prefabId) != (Object)null;
		}
	}
	public static class Utilities
	{
		private static readonly List<GameObject> _prefabsToFix = new List<GameObject>();

		private static readonly List<GameObject> _fixedPrefabs = new List<GameObject>();

		internal static void FixAudioMixerGroupsOnPrefabs()
		{
			foreach (GameObject item in _prefabsToFix)
			{
				item.FixAudioMixerGroups();
				_fixedPrefabs.Add(item);
			}
			_prefabsToFix.Clear();
		}

		public static void FixAudioMixerGroups(GameObject prefab)
		{
			if (!((Object)(object)prefab == (Object)null) && !_prefabsToFix.Contains(prefab) && !_fixedPrefabs.Contains(prefab))
			{
				if ((Object)(object)AudioManager.instance == (Object)null)
				{
					_prefabsToFix.Add(prefab);
					return;
				}
				prefab.FixAudioMixerGroups();
				_fixedPrefabs.Add(prefab);
			}
		}

		internal static void SafeInvokeEvent(Action? action)
		{
			try
			{
				action?.Invoke();
			}
			catch (Exception arg)
			{
				Logger.LogError($"Exception occured while invoking event: {arg}");
			}
		}
	}
	public static class ValuablePresets
	{
		private static readonly Dictionary<string, LevelValuables> _valuablePresets = new Dictionary<string, LevelValuables>();

		public const string GenericValuablePresetName = "Valuables - Generic";

		public static IReadOnlyDictionary<string, LevelValuables> AllValuablePresets => _valuablePresets;

		public static LevelValuables GenericPreset => AllValuablePresets["Valuables - Generic"];

		public static void CacheValuablePresets()
		{
			if ((Object)(object)RunManager.instance == (Object)null)
			{
				Logger.LogError("Failed to cache LevelValuables. RunManager instance is null.");
				return;
			}
			foreach (Level level in RunManager.instance.levels)
			{
				foreach (LevelValuables valuablePreset in level.ValuablePresets)
				{
					_valuablePresets.TryAdd(((Object)valuablePreset).name, valuablePreset);
				}
			}
		}

		internal static void RegisterValuablePreset(LevelValuables valuablePreset)
		{
			_valuablePresets.Add(((Object)valuablePreset).name, valuablePreset);
		}
	}
	public static class Valuables
	{
		private static readonly Dictionary<GameObject, List<string>> _valuablesToRegister = new Dictionary<GameObject, List<string>>();

		private static readonly List<GameObject> _valuablesRegistered = new List<GameObject>();

		private static bool _initialValuablesRegistered;

		public static IReadOnlyList<GameObject> AllValuables => GetValuables();

		public static IReadOnlyList<GameObject> RegisteredValuables => _valuablesRegistered;

		private static IEnumerable<GameObject> PendingAndRegisteredValuables => _valuablesToRegister.Keys.Concat(_valuablesRegistered);

		internal static void RegisterInitialValuables()
		{
			if (_initialValuablesRegistered)
			{
				return;
			}
			Logger.LogInfo("Adding valuables to valuable presets.");
			foreach (GameObject key in _valuablesToRegister.Keys)
			{
				RegisterValuableWithGame(key);
			}
			_valuablesToRegister.Clear();
			_initialValuablesRegistered = true;
		}

		private static void RegisterValuableWithGame(GameObject valuable)
		{
			if (_valuablesRegistered.Contains(valuable))
			{
				return;
			}
			List<string> list = _valuablesToRegister[valuable];
			if (!list.Any((string x) => ValuablePresets.AllValuablePresets.Keys.Any((string y) => x == y)))
			{
				Logger.LogWarning("Valuable \"" + ((Object)valuable).name + "\" does not have any valid valuable preset names set. Adding generic valuable preset name.");
				list.Add("Valuables - Generic");
			}
			foreach (string item in list)
			{
				if (item == null || !ValuablePresets.AllValuablePresets.ContainsKey(item))
				{
					Logger.LogWarning("Failed to add valuable \"" + ((Object)valuable).name + "\" to valuable preset \"" + item + "\". The valuable preset does not exist.");
				}
				else if (ValuablePresets.AllValuablePresets[item].AddValuable(valuable))
				{
					_valuablesRegistered.Add(valuable);
					Logger.LogDebug("Added valuable \"" + ((Object)valuable).name + "\" to valuable preset \"" + item + "\"");
				}
				else
				{
					Logger.LogWarning("Failed to add valuable \"" + ((Object)valuable).name + "\" to valuable preset \"" + item + "\"", extended: true);
				}
			}
		}

		public static void RegisterValuable(GameObject prefab)
		{
			RegisterValuable(prefab, new List<string>());
		}

		public static void RegisterValuable(GameObject prefab, List<LevelValuables> presets)
		{
			RegisterValuable(prefab, presets.Select((LevelValuables preset) => ((Object)preset).name).ToList());
		}

		public static void RegisterValuable(GameObject prefab, List<string> presetNames)
		{
			ValuableObject valuableObject = default(ValuableObject);
			if ((Object)(object)prefab == (Object)null)
			{
				Logger.LogError("Failed to register valuable. Prefab is null.");
			}
			else if (!prefab.TryGetComponent<ValuableObject>(ref valuableObject))
			{
				Logger.LogError("Failed to register valuable. Prefab does not have a ValuableObject component.");
			}
			else
			{
				RegisterValuable(valuableObject, presetNames);
			}
		}

		public static void RegisterValuable(ValuableObject valuableObject)
		{
			RegisterValuable(valuableObject, new List<string>());
		}

		public static void RegisterValuable(ValuableObject valuableObject, List<LevelValuables> presets)
		{
			RegisterValuable(valuableObject, presets.Select((LevelValuables preset) => ((Object)preset).name).ToList());
		}

		public static void RegisterValuable(ValuableObject valuableObject, List<string> presetNames)
		{
			if ((Object)(object)valuableObject == (Object)null)
			{
				Logger.LogError("Failed to register valuable. ValuableObject is null.");
				return;
			}
			GameObject prefab = ((Component)valuableObject).gameObject;
			if (presetNames == null || presetNames.Count == 0)
			{
				Logger.LogWarning("Valuable \"" + ((Object)valuableObject).name + "\" does not have any valid valuable preset names set. Adding generic valuable preset name.", extended: true);
				presetNames = new List<string>(1) { "Valuables - Generic" };
			}
			if (ResourcesHelper.HasValuablePrefab(valuableObject))
			{
				Logger.LogError("Failed to register valuable \"" + ((Object)prefab).name + "\". Valuable prefab already exists in Resources with the same name.");
				return;
			}
			if (PendingAndRegisteredValuables.Any((GameObject x) => ((Object)x).name.Equals(((Object)prefab).name, StringComparison.OrdinalIgnoreCase)))
			{
				Logger.LogError("Failed to register valuable \"" + ((Object)prefab).name + "\". Valuable prefab already exists with the same name.");
				return;
			}
			if (PendingAndRegisteredValuables.Contains(prefab))
			{
				Logger.LogWarning("Failed to register valuable \"" + ((Object)prefab).name + "\". Valuable is already registered!");
				return;
			}
			string valuablePrefabPath = ResourcesHelper.GetValuablePrefabPath(valuableObject);
			NetworkPrefabs.RegisterNetworkPrefab(valuablePrefabPath, prefab);
			Utilities.FixAudioMixerGroups(prefab);
			_valuablesToRegister.Add(prefab, presetNames);
			if (_initialValuablesRegistered)
			{
				RegisterValuableWithGame(((Component)valuableObject).gameObject);
			}
		}

		public static GameObject? SpawnValuable(ValuableObject valuableObject, Vector3 position, Quaternion rotation)
		{
			//IL_0047: 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_0087: 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 ((Object)(object)valuableObject == (Object)null)
			{
				Logger.LogError("Failed to spawn valuable. ValuableObject is null.");
				return null;
			}
			if (!SemiFunc.IsMasterClientOrSingleplayer())
			{
				Logger.LogError("Failed to spawn valuable \"" + ((Object)((Component)valuableObject).gameObject).name + "\". You are not the host.");
				return null;
			}
			string valuablePrefabPath = ResourcesHelper.GetValuablePrefabPath(valuableObject);
			GameObject val = NetworkPrefabs.SpawnNetworkPrefab(valuablePrefabPath, position, rotation, 0);
			if ((Object)(object)val == (Object)null)
			{
				Logger.LogError("Failed to spawn valuable \"" + ((Object)((Component)valuableObject).gameObject).name + "\"");
				return null;
			}
			Logger.LogInfo($"Spawned valuable \"{((Object)val).name}\" at position {position}, rotation: {((Quaternion)(ref rotation)).eulerAngles}", extended: true);
			return val;
		}

		public static IReadOnlyList<GameObject> GetValuables()
		{
			if ((Object)(object)RunManager.instance == (Object)null)
			{
				return Array.Empty<GameObject>();
			}
			return ValuablePresets.AllValuablePresets.Values.Select((LevelValuables levelValuables) => levelValuables.GetCombinedList()).SelectMany((List<GameObject> list) => list).Distinct()
				.ToList();
		}

		public static bool TryGetValuableByName(string name, [NotNullWhen(true)] out ValuableObject? valuableObject)
		{
			valuableObject = GetValuableByName(name);
			return (Object)(object)valuableObject != (Object)null;
		}

		public static ValuableObject? GetValuableByName(string name)
		{
			ValuableObject result = default(ValuableObject);
			foreach (GameObject valuable in GetValuables())
			{
				if (valuable.TryGetComponent<ValuableObject>(ref result) && ((Object)valuable).name.EqualsAny(new <>z__ReadOnlyArray<string>(new string[2]
				{
					name,
					"Valuable " + name
				}), StringComparison.OrdinalIgnoreCase))
				{
					return result;
				}
			}
			return null;
		}

		public static bool TryGetValuableThatContainsName(string name, [NotNullWhen(true)] out ValuableObject? valuableObject)
		{
			valuableObject = GetValuableThatContainsName(name);
			return (Object)(object)valuableObject != (Object)null;
		}

		public static ValuableObject? GetValuableThatContainsName(string name)
		{
			ValuableObject result = default(ValuableObject);
			foreach (GameObject valuable in GetValuables())
			{
				if (valuable.TryGetComponent<ValuableObject>(ref result) && ((Object)valuable).name.Contains(name, StringComparison.OrdinalIgnoreCase))
				{
					return result;
				}
			}
			return null;
		}

		[Obsolete("prefabId is no longer supported", true)]
		public static void RegisterValuable(string prefabId, GameObject prefab)
		{
			RegisterValuable(prefab);
		}

		[Obsolete("prefabId is no longer supported", true)]
		public static void RegisterValuable(string prefabId, GameObject prefab, List<LevelValuables> presets)
		{
			RegisterValuable(prefab, presets);
		}

		[Obsolete("prefabId is no longer supported", true)]
		public static void RegisterValuable(string prefabId, GameObject prefab, List<string> presetNames)
		{
			RegisterValuable(prefab, presetNames);
		}
	}
}
namespace REPOLib.Extensions
{
	public static class AudioSourceExtensions
	{
		public static void FixAudioMixerGroup(this AudioSource audioSource)
		{
			audioSource.FixAudioMixerGroup(((Component)audioSource).gameObject);
		}

		public static void FixAudioMixerGroup(this AudioSource audioSource, GameObject parentObject)
		{
			if ((Object)(object)audioSource == (Object)null)
			{
				return;
			}
			string text = ((!((Object)(object)parentObject == (Object)(object)((Component)audioSource).gameObject)) ? (((Object)parentObject).name + "/" + ((Object)((Component)audioSource).gameObject).name) : ((Object)((Component)audioSource).gameObject).name);
			if ((Object)(object)AudioManager.instance == (Object)null)
			{
				Logger.LogWarning("Failed to fix AudioMixerGroup on GameObject \"" + text + "\". AudioManager instance is null.");
				return;
			}
			if ((Object)(object)audioSource.outputAudioMixerGroup == (Object)null)
			{
				Logger.LogWarning("Failed to fix AudioMixerGroup on GameObject \"" + text + "\". No AudioMixerGroup is assigned.");
				return;
			}
			AudioMixer val = (AudioMixer)(((Object)audioSource.outputAudioMixerGroup.audioMixer).name switch
			{
				"Master" => AudioManager.instance.MasterMixer, 
				"Music" => AudioManager.instance.MusicMasterGroup.audioMixer, 
				"Sound" => AudioManager.instance.SoundMasterGroup.audioMixer, 
				"Spectate" => AudioManager.instance.MicrophoneSpectateGroup.audioMixer, 
				_ => AudioManager.instance.SoundMasterGroup.audioMixer, 
			});
			AudioMixerGroup[] array = val.FindMatchingGroups(((Object)audioSource.outputAudioMixerGroup).name);
			AudioMixerGroup val2;
			if (array.Length >= 1)
			{
				val2 = array[0];
			}
			else
			{
				val = AudioManager.instance.SoundMasterGroup.audioMixer;
				val2 = val.FindMatchingGroups("Sound Effects")[0];
				Logger.LogWarning("Could not find matching AudioMixerGroup for GameObject \"" + text + "\". Using default AudioMixerGroup \"" + ((Object)val).name + "/" + ((Object)val2).name + "\"", extended: true);
			}
			audioSource.outputAudioMixerGroup = val2;
			Logger.LogDebug("Fixed AudioMixerGroup on GameObject \"" + text + "\". AudioMixerGroup \"" + ((Object)val).name + "/" + ((Object)val2).name + "\"");
		}
	}
	public static class DictionaryExtensions
	{
		public static bool TryGetKey<TKey, TValue>(this Dictionary<TKey, TValue> dictionary, TValue value, [NotNullWhen(true)] out TKey? key)
		{
			foreach (KeyValuePair<TKey, TValue> item in dictionary)
			{
				if (object.Equals(item.Value, value))
				{
					key = item.Key;
					return true;
				}
			}
			key = default(TKey);
			return false;
		}

		public static TKey? GetKeyOrDefault<TKey, TValue>(this Dictionary<TKey, TValue> dictionary, TValue value)
		{
			if (dictionary.TryGetKey(value, out TKey key))
			{
				return key;
			}
			return default(TKey);
		}

		public static TKey? GetKeyOrDefault<TKey, TValue>(this Dictionary<TKey, TValue> dictionary, TValue value, TKey defaultKey)
		{
			if (dictionary.TryGetKey(value, out TKey key))
			{
				return key;
			}
			return defaultKey;
		}

		public static bool ContainsKey<T>(this Dictionary<string, T> dictionary, string key, bool ignoreKeyCase)
		{
			if (!ignoreKeyCase)
			{
				return dictionary.ContainsKey(key);
			}
			foreach (KeyValuePair<string, T> item in dictionary)
			{
				if (string.Equals(item.Key, key, StringComparison.OrdinalIgnoreCase))
				{
					return true;
				}
			}
			return false;
		}

		public static bool TryGetValue<T>(this Dictionary<string, T> dictionary, string key, [NotNullWhen(true)] out T? value, bool ignoreKeyCase)
		{
			if (!ignoreKeyCase)
			{
				return dictionary.TryGetValue(key, out value);
			}
			foreach (KeyValuePair<string, T> item in dictionary)
			{
				if (string.Equals(item.Key, key, StringComparison.OrdinalIgnoreCase))
				{
					value = item.Value;
					return true;
				}
			}
			value = default(T);
			return false;
		}

		public static T? GetValueOrDefault<T>(this Dictionary<string, T> dictionary, string key, bool ignoreKeyCase)
		{
			if (dictionary.TryGetValue(key, out T value, ignoreKeyCase))
			{
				return value;
			}
			return default(T);
		}

		public static T? GetValueOrDefault<T>(this Dictionary<string, T> dictionary, string key, T defaultValue, bool ignoreKeyCase)
		{
			if (dictionary.TryGetValue(key, out T value, ignoreKeyCase))
			{
				return value;
			}
			return defaultValue;
		}
	}
	public static class EnemyDirectorExtensions
	{
		public static bool HasEnemy(this EnemyDirector enemyDirector, EnemySetup enemySetup)
		{
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)enemySetup == (Object)null || enemySetup.spawnObjects.Count == 0)
			{
				return false;
			}
			EnemyParent val = default(EnemyParent);
			foreach (GameObject spawnObject in enemySetup.spawnObjects)
			{
				if (spawnObject.TryGetComponent<EnemyParent>(ref val) && enemyDirector.TryGetList(val.difficulty, out List<EnemySetup> list))
				{
					return list.Contains(enemySetup);
				}
			}
			return false;
		}

		internal static bool AddEnemy(this EnemyDirector enemyDirector, EnemySetup enemySetup)
		{
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)enemySetup == (Object)null)
			{
				return false;
			}
			EnemyParent val = default(EnemyParent);
			foreach (GameObject spawnObject in enemySetup.spawnObjects)
			{
				if (spawnObject.TryGetComponent<EnemyParent>(ref val) && enemyDirector.TryGetList(val.difficulty, out List<EnemySetup> list) && !list.Contains(enemySetup))
				{
					list.Add(enemySetup);
					return true;
				}
			}
			return false;
		}

		public static bool TryGetList(this EnemyDirector enemyDirector, Difficulty difficultyType, [NotNullWhen(true)] out List<EnemySetup>? list)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected I4, but got Unknown
			list = (int)difficultyType switch
			{
				0 => enemyDirector.enemiesDifficulty1, 
				1 => enemyDirector.enemiesDifficulty2, 
				2 => enemyDirector.enemiesDifficulty3, 
				_ => null, 
			};
			return list != null;
		}

		public static List<EnemySetup> GetEnemies(this EnemyDirector enemyDirector)
		{
			List<EnemySetup> enemiesDifficulty = enemyDirector.enemiesDifficulty1;
			List<EnemySetup> enemiesDifficulty2 = enemyDirector.enemiesDifficulty2;
			List<EnemySetup> enemiesDifficulty3 = enemyDirector.enemiesDifficulty3;
			List<EnemySetup> list = new List<EnemySetup>(enemiesDifficulty.Count + enemiesDifficulty2.Count + enemiesDifficulty3.Count);
			list.AddRange(enemiesDifficulty);
			list.AddRange(enemiesDifficulty2);
			list.AddRange(enemiesDifficulty3);
			return list;
		}

		public static bool TryGetEnemyByName(this EnemyDirector enemyDirector, string name, [NotNullWhen(true)] out EnemySetup? enemySetup)
		{
			enemySetup = enemyDirector.GetEnemyByName(name);
			return (Object)(object)enemySetup != (Object)null;
		}

		public static EnemySetup? GetEnemyByName(this EnemyDirector enemyDirector, string name)
		{
			string name2 = name;
			return ((IEnumerable<EnemySetup>)enemyDirector.GetEnemies()).FirstOrDefault((Func<EnemySetup, bool>)((EnemySetup x) => x.NameEquals(name2)));
		}

		public static bool TryGetEnemyThatContainsName(this EnemyDirector enemyDirector, string name, out EnemySetup enemySetup)
		{
			enemySetup = enemyDirector.GetEnemyThatContainsName(name);
			return (Object)(object)enemySetup != (Object)null;
		}

		public static EnemySetup GetEnemyThatContainsName(this EnemyDirector enemyDirector, string name)
		{
			string name2 = name;
			return ((IEnumerable<EnemySetup>)enemyDirector.GetEnemies()).FirstOrDefault((Func<EnemySetup, bool>)((EnemySetup x) => x.NameContains(name2)));
		}
	}
	public static class EnemySetupExtensions
	{
		public static List<GameObject> GetDistinctSpawnObjects(this EnemySetup enemySetup)
		{
			if ((Object)(object)enemySetup == (Object)null || enemySetup.spawnObjects == null)
			{
				return new List<GameObject>();
			}
			return enemySetup.spawnObjects.Where((GameObject x) => (Object)(object)x != (Object)null).Distinct(new UnityObjectNameComparer<GameObject>()).ToList();
		}

		public static List<GameObject> GetSortedSpawnObjects(this EnemySetup enemySetup)
		{
			if ((Object)(object)enemySetup == (Object)null || enemySetup.spawnObjects == null)
			{
				return new List<GameObject>();
			}
			EnemyParent val = default(EnemyParent);
			return (from x in enemySetup.spawnObjects
				where (Object)(object)x != (Object)null
				orderby x.TryGetComponent<EnemyParent>(ref val) descending
				select x).ToList();
		}

		public static GameObject? GetMainSpawnObject(this EnemySetup enemySetup)
		{
			EnemyParent? enemyParent = enemySetup.GetEnemyParent();
			if (enemyParent == null)
			{
				return null;
			}
			return ((Component)enemyParent).gameObject;
		}

		public static EnemyParent? GetEnemyParent(this EnemySetup enemySetup)
		{
			EnemyParent result = default(EnemyParent);
			foreach (GameObject distinctSpawnObject in enemySetup.GetDistinctSpawnObjects())
			{
				if (distinctSpawnObject.TryGetComponent<EnemyParent>(ref result))
				{
					return result;
				}
			}
			return null;
		}

		public static bool TryGetEnemyParent(this EnemySetup enemySetup, [NotNullWhen(true)] out EnemyParent? enemyParent)
		{
			enemyParent = enemySetup.GetEnemyParent();
			return (Object)(object)enemyParent != (Object)null;
		}

		public static bool AnySpawnObjectsNameEquals(this EnemySetup enemySetup, string name)
		{
			string name2 = name;
			if ((Object)(object)enemySetup == (Object)null)
			{
				return false;
			}
			return enemySetup.GetDistinctSpawnObjects().Any((GameObject x) => ((Object)x).name.Equals(name2, StringComparison.OrdinalIgnoreCase));
		}

		public static bool AnySpawnObjectsNameEqualsThatIsNotTheSameObject(this EnemySetup enemySetup, GameObject gameObject)
		{
			GameObject gameObject2 = gameObject;
			if ((Object)(object)enemySetup == (Object)null || (Object)(object)gameObject2 == (Object)null)
			{
				return false;
			}
			return enemySetup.GetDistinctSpawnObjects().Any((GameObject x) => ((Object)x).name.Equals(((Object)gameObject2).name, StringComparison.OrdinalIgnoreCase) && (Object)(object)x != (Object)(object)gameObject2);
		}

		public static bool NameEquals(this EnemySetup enemySetup, string name)
		{
			if ((Object)(object)enemySetup == (Object)null)
			{
				return false;
			}
			if (((Object)enemySetup).name.EqualsAny(new <>z__ReadOnlyArray<string>(new string[2]
			{
				name,
				"Enemy - " + name
			}), StringComparison.OrdinalIgnoreCase))
			{
				return true;
			}
			if (enemySetup.TryGetEnemyParent(out EnemyParent enemyParent))
			{
				if (enemyParent.enemyName.Equals(name, StringComparison.OrdinalIgnoreCase))
				{
					return true;
				}
				if (((Object)((Component)enemyParent).gameObject).name.EqualsAny(new <>z__ReadOnlyArray<string>(new string[2]
				{
					name,
					"Enemy - " + name
				}), StringComparison.OrdinalIgnoreCase))
				{
					return true;
				}
			}
			return false;
		}

		public static bool NameContains(this EnemySetup enemySetup, string name)
		{
			if ((Object)(object)enemySetup == (Object)null)
			{
				return false;
			}
			if (((Object)enemySetup).name.Contains(name, StringComparison.OrdinalIgnoreCase))
			{
				return true;
			}
			if (enemySetup.TryGetEnemyParent(out EnemyParent enemyParent))
			{
				if (enemyParent.enemyName.Contains(name, StringComparison.OrdinalIgnoreCase))
				{
					return true;
				}
				if (((Object)((Component)enemyParent).gameObject).name.Contains(name, StringComparison.OrdinalIgnoreCase))
				{
					return true;
				}
			}
			return false;
		}
	}
	public static class GameObjectExtensions
	{
		public static void FixAudioMixerGroups(this GameObject gameObject)
		{
			if ((Object)(object)gameObject == (Object)null)
			{
				return;
			}
			if ((Object)(object)AudioManager.instance == (Object)null)
			{
				Logger.LogWarning("Failed to fix audio mixer groups on GameObject \"" + ((Object)gameObject).name + "\". AudioManager instance is null.");
				return;
			}
			AudioSource[] componentsInChildren = gameObject.GetComponentsInChildren<AudioSource>();
			foreach (AudioSource audioSource in componentsInChildren)
			{
				audioSource.FixAudioMixerGroup(gameObject);
			}
		}
	}
	internal static class ItemExtensions
	{
		public static bool NameEquals(this Item item, string name)
		{
			if ((Object)(object)item == (Object)null)
			{
				return false;
			}
			if (((Object)item).name.EqualsAny(new <>z__ReadOnlyArray<string>(new string[2]
			{
				name,
				"Item " + name
			}), StringComparison.OrdinalIgnoreCase))
			{
				return true;
			}
			if (item.itemAssetName.EqualsAny(new <>z__ReadOnlyArray<string>(new string[2]
			{
				name,
				"Item " + name
			}), StringComparison.OrdinalIgnoreCase))
			{
				return true;
			}
			if (item.itemName.Equals(name, StringComparison.OrdinalIgnoreCase))
			{
				return true;
			}
			return false;
		}

		public static bool NameContains(this Item item, string name)
		{
			if ((Object)(object)item == (Object)null)
			{
				return false;
			}
			if (((Object)item).name.Contains(name, StringComparison.OrdinalIgnoreCase))
			{
				return true;
			}
			if (item.itemAssetName.Contains(name, StringComparison.OrdinalIgnoreCase))
			{
				return true;
			}
			if (item.itemName.Contains(name, StringComparison.OrdinalIgnoreCase))
			{
				return true;
			}
			return false;
		}
	}
	public static class LevelValuablesExtensions
	{
		public static bool HasValuable(this LevelValuables levelValuables, GameObject prefab)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			ValuableObject val = default(ValuableObject);
			if (!prefab.TryGetComponent<ValuableObject>(ref val))
			{
				return false;
			}
			if (!levelValuables.TryGetList(val.volumeType, out List<GameObject> list))
			{
				return false;
			}
			return list.Contains(prefab);
		}

		internal static bool AddValuable(this LevelValuables levelValuables, GameObject prefab)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			ValuableObject val = default(ValuableObject);
			if (!prefab.TryGetComponent<ValuableObject>(ref val))
			{
				return false;
			}
			if (!levelValuables.TryGetList(val.volumeType, out List<GameObject> list))
			{
				return false;
			}
			if (list.Contains(prefab))
			{
				return false;
			}
			list.Add(prefab);
			return true;
		}

		public static bool TryGetList(this LevelValuables levelValuables, Type volumeType, [NotNullWhen(true)] out List<GameObject>? list)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Expected I4, but got Unknown
			list = (int)volumeType switch
			{
				0 => levelValuables.tiny, 
				1 => levelValuables.small, 
				2 => levelValuables.medium, 
				3 => levelValuables.big, 
				4 => levelValuables.wide, 
				5 => levelValuables.tall, 
				6 => levelValuables.veryTall, 
				_ => null, 
			};
			return list != null;
		}

		public static bool TryGetCombinedList(this LevelValuables levelValuables, out List<GameObject> list)
		{
			List<List<GameObject>> source = new List<List<GameObject>> { levelValuables.tiny, levelValuables.small, levelValuables.medium, levelValuables.big, levelValuables.wide, levelValuables.tall, levelValuables.veryTall };
			list = (from x in source.SelectMany((List<GameObject> valuables) => valuables)
				where (Object)(object)x != (Object)null
				select x).Distinct().ToList();
			return list != null;
		}

		public static List<GameObject> GetCombinedList(this LevelValuables levelValuables)
		{
			if (levelValuables.TryGetCombinedList(out List<GameObject> list))
			{
				return list;
			}
			return new List<GameObject>();
		}
	}
	internal static class ReflectionExtensions
	{
		public static IEnumerable<MethodInfo> SafeGetMethods(this Type type)
		{
			try
			{
				return type.GetMethods();
			}
			catch
			{
				return Array.Empty<MethodInfo>();
			}
		}

		public static T? SafeGetCustomAttribute<T>(this MethodInfo method) where T : Attribute
		{
			try
			{
				return method.GetCustomAttribute<T>();
			}
			catch
			{
				return null;
			}
		}

		public static bool HasCustomAttribute<T>(this MethodInfo method) where T : Attribute
		{
			try
			{
				return method.GetCustomAttribute<T>() != null;
			}
			catch
			{
				return false;
			}
		}
	}
	public static class StatsManagerExtensions
	{
		public static bool HasItem(this StatsManager statsManager, Item item)
		{
			if ((Object)(object)item == (Object)null)
			{
				return false;
			}
			return statsManager.itemDictionary.ContainsKey(item.itemAssetName);
		}

		internal static bool AddItem(this StatsManager statsManager, Item item)
		{
			if (!statsManager.itemDictionary.ContainsKey(item.itemAssetName))
			{
				statsManager.itemDictionary.Add(item.itemAssetName, item);
			}
			foreach (Dictionary<string, int> item2 in statsManager.AllDictionariesWithPrefix("item"))
			{
				item2[item.itemAssetName] = 0;
			}
			return true;
		}

		public static List<Item> GetItems(this StatsManager statsManager)
		{
			return statsManager.itemDictionary.Values.ToList();
		}

		public static bool TryGetItemByName(this StatsManager statsManager, string name, out Item item)
		{
			item = statsManager.GetItemByName(name);
			return (Object)(object)item != (Object)null;
		}

		public static Item GetItemByName(this StatsManager statsManager, string name)
		{
			string name2 = name;
			return ((IEnumerable<Item>)statsManager.GetItems()).FirstOrDefault((Func<Item, bool>)((Item x) => x.NameEquals(name2)));
		}

		public static bool TryGetItemThatContainsName(this StatsManager statsManager, string name, out Item item)
		{
			item = statsManager.GetItemThatContainsName(name);
			return (Object)(object)item != (Object)null;
		}

		public static Item GetItemThatContainsName(this StatsManager statsManager, string name)
		{
			string name2 = name;
			return ((IEnumerable<Item>)statsManager.GetItems()).FirstOrDefault((Func<Item, bool>)((Item x) => x.NameContains(name2)));
		}
	}
	public static class StringExtensions
	{
		public static bool EqualsAny(this string value, IReadOnlyCollection<string> inputs, StringComparison comparisonType = StringComparison.Ordinal)
		{
			if (value == null || inputs == null)
			{
				return false;
			}
			return inputs.Contains<string>(value, StringComparer.FromComparison(comparisonType));
		}
	}
}
namespace REPOLib.Commands
{
	[AttributeUsage(AttributeTargets.Method, Inherited = false, AllowMultiple = false)]
	public class CommandExecutionAttribute : Attribute
	{
		public bool RequiresDeveloperMode { get; private set; }

		public bool EnabledByDefault { get; private set; }

		public string Name { get; private set; }

		public string Description { get; private set; }

		public CommandExecutionAttribute(string? name = null, string? description = null, bool enabledByDefault = true, bool requiresDeveloperMode = false)
		{
			RequiresDeveloperMode = requiresDeveloperMode;
			EnabledByDefault = enabledByDefault;
			Name = name ?? "";
			Description = description ?? "";
		}
	}
	[AttributeUsage(AttributeTargets.Method, Inherited = false, AllowMultiple = false)]
	public class CommandInitializerAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Method, Inherited = false, AllowMultiple = true)]
	public class CommandAliasAttribute : Attribute
	{
		public string Alias { get; private set; }

		public CommandAliasAttribute(string alias)
		{
			Alias = alias;
		}
	}
	internal static class CommandManager
	{
		private static List<MethodInfo> _commandExecutionMethodCache = new List<MethodInfo>();

		public static Dictionary<string, MethodInfo> CommandExecutionMethods { get; private set; } = new Dictionary<string, MethodInfo>();


		public static List<MethodInfo> CommandInitializerMethods { get; private set; } = new List<MethodInfo>();


		public static Dictionary<string, bool> CommandsEnabled { get; private set; } = new Dictionary<string, bool>();


		public static void Initialize()
		{
			Logger.LogInfo("CommandManager initializing.", extended: true);
			CommandInitializerMethods = (from method in AccessTools.AllTypes().SelectMany((Type type) => type.SafeGetMethods())
				where method.HasCustomAttribute<CommandInitializerAttribute>()
				select method).ToList();
			foreach (MethodInfo commandInitializerMethod in CommandInitializerMethods)
			{
				try
				{
					Logger.LogDebug($"Initializing command initializer on method {commandInitializerMethod.DeclaringType}.{commandInitializerMethod.Name}");
					if (!commandInitializerMethod.IsStatic)
					{
						Logger.LogWarning($"Command initializer {commandInitializerMethod.DeclaringType}.{commandInitializerMethod.Name} is not static!");
					}
					commandInitializerMethod.Invoke(null, null);
				}
				catch (Exception arg)
				{
					Logger.LogError($"Failed to initialize command: {arg}");
				}
			}
			FindAllCommandMethods();
			foreach (KeyValuePair<string, MethodInfo> commandExecutionMethod in CommandExecutionMethods)
			{
				if (!commandExecutionMethod.Value.IsStatic)
				{
					Logger.LogWarning("Command execution method for command \"" + commandExecutionMethod.Key + "\" is not static!");
				}
			}
			BindConfigs();
			Logger.LogInfo("Finished initializing custom commands.");
		}

		public static void FindAllCommandMethods()
		{
			_commandExecutionMethodCache = (from method in AccessTools.AllTypes().SelectMany((Type type) => type.SafeGetMethods())
				where method.HasCustomAttribute<CommandExecutionAttribute>()
				select method).ToList();
			foreach (MethodInfo item in _commandExecutionMethodCache)
			{
				ParameterInfo[] parameters = item.GetParameters();
				if (parameters.Length > 1)
				{
					Logger.LogError("Command \"" + item.GetCustomAttribute<CommandExecutionAttribute>().Name + "\" execution method \"" + item.Name + "\" has too many parameters! Should only have 1 string parameter or none.");
					break;
				}
				if (parameters.Length == 1 && parameters[0].ParameterType != typeof(string))
				{
					Logger.LogError("Command \"" + item.GetCustomAttribute<CommandExecutionAttribute>().Name + "\" execution method \"" + item.Name + "\" has parameter of the wrong type! Should be string.");
					break;
				}
				IEnumerable<CommandAliasAttribute> customAttributes = item.GetCustomAttributes<CommandAliasAttribute>();
				bool flag = false;
				if (customAttributes == null || customAttributes.Count() == 0)
				{
					Logger.LogWarning("Command " + item.Name + " has no alias attributes!");
					continue;
				}
				foreach (CommandAliasAttribute item2 in customAttributes)
				{
					if (CommandExecutionMethods.TryAdd(item2.Alias, item))
					{
						Logger.LogDebug($"Registered command alias \"{item2.Alias}\" for method \"{item.DeclaringType}.{item.Name}\".");
						flag = true;
					}
				}
				if (!flag)
				{
					Logger.LogWarning("Failed to add any command aliases for method \"" + item.Name + "\".");
				}
			}
		}

		public static void BindConfigs()
		{
			foreach (MethodInfo item in _commandExecutionMethodCache)
			{
				CommandExecutionAttribute customAttribute = item.GetCustomAttribute<CommandExecutionAttribute>();
				BepInPlugin customAttribute2 = ((MemberInfo)(from type in AccessTools.GetTypesFromAssembly(item.Module.Assembly)
					where ((MemberInfo)type).GetCustomAttribute<BepInPlugin>() != null
					select type).ToList()[0]).GetCustomAttribute<BepInPlugin>();
				string text = ((customAttribute2 != null) ? customAttribute2.GUID : null) ?? "Unknown";
				string text2 = item.DeclaringType.ToString() ?? "Unknown";
				List<string> list = new List<string>();
				foreach (CommandAliasAttribute customAttribute3 in item.GetCustomAttributes<CommandAliasAttribute>())
				{
	

BepInEx/plugins/zelofi-MorePlayers/MorePlayers/MovePlayers.dll

Decompiled 2 months ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Photon.Pun;
using Photon.Realtime;
using Steamworks;
using Steamworks.Data;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("AdjustMaxPlayers")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("AdjustMaxPlayers")]
[assembly: AssemblyCopyright("Copyright ©  2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("332fb87a-6417-4a3c-b614-543d93450b34")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace MorePlayers;

[BepInPlugin("zelofi.MorePlayers", "MorePlayers", "1.0.1")]
public class Plugin : BaseUnityPlugin
{
	[HarmonyPatch(typeof(NetworkConnect), "TryJoiningRoom")]
	public class TryJoiningRoomPatch
	{
		private static bool Prefix(ref string ___RoomName)
		{
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Expected O, but got Unknown
			if (string.IsNullOrEmpty(___RoomName))
			{
				mls.LogError((object)"RoomName is null or empty, using previous method!");
				return true;
			}
			if (configMaxPlayers.Value == 0)
			{
				mls.LogError((object)"The MaxPlayers config is null or empty, using previous method!");
				return true;
			}
			if ((Object)(object)NetworkConnect.instance != (Object)null)
			{
				PhotonNetwork.JoinOrCreateRoom(___RoomName, new RoomOptions
				{
					MaxPlayers = configMaxPlayers.Value
				}, TypedLobby.Default, (string[])null);
				return false;
			}
			mls.LogError((object)"NetworkConnect instance is null, using previous method!");
			return true;
		}
	}

	[HarmonyPatch(typeof(SteamManager), "HostLobby")]
	public class HostLobbyPatch
	{
		private static bool Prefix()
		{
			HostLobbyAsync();
			return false;
		}

		private static async void HostLobbyAsync()
		{
			Debug.Log((object)"Steam: Hosting lobby...");
			Lobby? lobby = await SteamMatchmaking.CreateLobbyAsync(configMaxPlayers.Value);
			if (!lobby.HasValue)
			{
				Debug.LogError((object)"Lobby created but not correctly instantiated.");
				return;
			}
			Lobby value = lobby.Value;
			((Lobby)(ref value)).SetPublic();
			value = lobby.Value;
			((Lobby)(ref value)).SetJoinable(false);
		}
	}

	public const string modGUID = "zelofi.MorePlayers";

	public const string modName = "MorePlayers";

	public const string modVersion = "1.0.1";

	private readonly Harmony harmony = new Harmony("zelofi.MorePlayers");

	public static ConfigEntry<int> configMaxPlayers;

	public static ManualLogSource mls;

	private void Awake()
	{
		mls = Logger.CreateLogSource("zelofi.MorePlayers");
		mls.LogInfo((object)"zelofi.MorePlayers is now awake!");
		configMaxPlayers = ((BaseUnityPlugin)this).Config.Bind<int>("General", "MaxPlayers", 10, "The max amount of players allowed in a server");
		harmony.PatchAll(typeof(TryJoiningRoomPatch));
		harmony.PatchAll(typeof(HostLobbyPatch));
	}
}

BepInEx/plugins/Zondar-Shared_Upgrade_With_Scaling/SharedUpgradeWithScaling.dll

Decompiled 2 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.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Photon.Pun;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: IgnoresAccessChecksTo("Autodesk.Fbx")]
[assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")]
[assembly: IgnoresAccessChecksTo("FbxBuildTestAssets")]
[assembly: IgnoresAccessChecksTo("Klattersynth")]
[assembly: IgnoresAccessChecksTo("Photon3Unity3D")]
[assembly: IgnoresAccessChecksTo("PhotonChat")]
[assembly: IgnoresAccessChecksTo("PhotonRealtime")]
[assembly: IgnoresAccessChecksTo("PhotonUnityNetworking")]
[assembly: IgnoresAccessChecksTo("PhotonUnityNetworking.Utilities")]
[assembly: IgnoresAccessChecksTo("PhotonVoice.API")]
[assembly: IgnoresAccessChecksTo("PhotonVoice")]
[assembly: IgnoresAccessChecksTo("PhotonVoice.PUN")]
[assembly: IgnoresAccessChecksTo("SingularityGroup.HotReload.Runtime")]
[assembly: IgnoresAccessChecksTo("SingularityGroup.HotReload.Runtime.Public")]
[assembly: IgnoresAccessChecksTo("Sirenix.OdinInspector.Attributes")]
[assembly: IgnoresAccessChecksTo("Sirenix.Serialization.Config")]
[assembly: IgnoresAccessChecksTo("Sirenix.Serialization")]
[assembly: IgnoresAccessChecksTo("Sirenix.Utilities")]
[assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")]
[assembly: IgnoresAccessChecksTo("Unity.Formats.Fbx.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")]
[assembly: IgnoresAccessChecksTo("Unity.Postprocessing.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")]
[assembly: IgnoresAccessChecksTo("Unity.Timeline")]
[assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Antlr3.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Core")]
[assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Flow")]
[assembly: IgnoresAccessChecksTo("Unity.VisualScripting.State")]
[assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.UI")]
[assembly: IgnoresAccessChecksTo("websocket-sharp")]
[assembly: AssemblyCompany("Zondar")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("SharedUpgradeWithScaling")]
[assembly: AssemblyTitle("SharedUpgradeWithScaling")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

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

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

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

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace SharedUpgradeWithScaling
{
	internal class Configuration
	{
		public static ConfigEntry<float> PriceScaling;

		public static void Init(ConfigFile config)
		{
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Expected O, but got Unknown
			PriceScaling = config.Bind<float>("General", "Price Scaling", 1f, new ConfigDescription("Price of upgrades according to: Price = DefaultValue + ((PlayerCount - 1) * PriceScaling)", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 2f), Array.Empty<object>()));
		}
	}
	[BepInPlugin("Zondar.SharedUpgradeWithScaling", "SharedUpgradeWithScaling", "1.0.2")]
	public class SharedUpgradeWithScaling : BaseUnityPlugin
	{
		internal static SharedUpgradeWithScaling Instance { get; private set; }

		internal static ManualLogSource Logger => Instance._logger;

		private ManualLogSource _logger => ((BaseUnityPlugin)this).Logger;

		internal Harmony? Harmony { get; set; }

		private void Awake()
		{
			Instance = this;
			((Component)this).gameObject.transform.parent = null;
			((Object)((Component)this).gameObject).hideFlags = (HideFlags)61;
			Configuration.Init(((BaseUnityPlugin)this).Config);
			Patch();
			Logger.LogInfo((object)$"{((BaseUnityPlugin)this).Info.Metadata.GUID} v{((BaseUnityPlugin)this).Info.Metadata.Version} has loaded!");
		}

		internal void Patch()
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Expected O, but got Unknown
			//IL_0026: Expected O, but got Unknown
			if (Harmony == null)
			{
				Harmony val = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID);
				Harmony val2 = val;
				Harmony = val;
			}
			Harmony.PatchAll();
		}
	}
	[HarmonyPatch(typeof(ItemAttributes), "GetValue")]
	public class UpdatePrice
	{
		[HarmonyPostfix]
		[HarmonyPatch("GetValue")]
		private static void Start_Postfix(ItemAttributes __instance)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Invalid comparison between Unknown and I4
			float value = Configuration.PriceScaling.Value;
			float num = 1f + (float)(SemiFunc.PlayerGetAll().Count - 1) * value;
			if ((int)__instance.itemType == 3)
			{
				int num2 = (int)Math.Round((float)__instance.value * num);
				if (num2 < 0)
				{
					num2 = 0;
				}
				__instance.value = num2;
				if (GameManager.Multiplayer() && PhotonNetwork.IsMasterClient)
				{
					__instance.photonView.RPC("GetValueRPC", (RpcTarget)1, new object[1] { __instance.value });
				}
				SharedUpgradeWithScaling.Logger.LogDebug((object)$"{__instance} UpdatedPrice to {num2}");
			}
		}
	}
}

BepInEx/plugins/Zonk-BetterUpgrades/BetterUpgrades.dll

Decompiled 2 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using BetterUpgrades;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Photon.Pun;
using REPOLib.Modules;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: IgnoresAccessChecksTo("Autodesk.Fbx")]
[assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")]
[assembly: IgnoresAccessChecksTo("FbxBuildTestAssets")]
[assembly: IgnoresAccessChecksTo("Klattersynth")]
[assembly: IgnoresAccessChecksTo("Photon3Unity3D")]
[assembly: IgnoresAccessChecksTo("PhotonChat")]
[assembly: IgnoresAccessChecksTo("PhotonRealtime")]
[assembly: IgnoresAccessChecksTo("PhotonUnityNetworking")]
[assembly: IgnoresAccessChecksTo("PhotonUnityNetworking.Utilities")]
[assembly: IgnoresAccessChecksTo("PhotonVoice.API")]
[assembly: IgnoresAccessChecksTo("PhotonVoice")]
[assembly: IgnoresAccessChecksTo("PhotonVoice.PUN")]
[assembly: IgnoresAccessChecksTo("SingularityGroup.HotReload.Runtime")]
[assembly: IgnoresAccessChecksTo("SingularityGroup.HotReload.Runtime.Public")]
[assembly: IgnoresAccessChecksTo("Sirenix.OdinInspector.Attributes")]
[assembly: IgnoresAccessChecksTo("Sirenix.Serialization.Config")]
[assembly: IgnoresAccessChecksTo("Sirenix.Serialization")]
[assembly: IgnoresAccessChecksTo("Sirenix.Utilities")]
[assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")]
[assembly: IgnoresAccessChecksTo("Unity.Formats.Fbx.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")]
[assembly: IgnoresAccessChecksTo("Unity.Postprocessing.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")]
[assembly: IgnoresAccessChecksTo("Unity.Timeline")]
[assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Antlr3.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Core")]
[assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Flow")]
[assembly: IgnoresAccessChecksTo("Unity.VisualScripting.State")]
[assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.UI")]
[assembly: IgnoresAccessChecksTo("websocket-sharp")]
[assembly: AssemblyCompany("Zonk")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.5.0.0")]
[assembly: AssemblyInformationalVersion("1.5.0")]
[assembly: AssemblyProduct("BetterUpgrades")]
[assembly: AssemblyTitle("BetterUpgrades")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.5.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

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

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

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

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
public class ItemUpgradePlayerEnergyThree : MonoBehaviour
{
	private ItemToggle itemToggle;

	private void Start()
	{
		itemToggle = ((Component)this).GetComponent<ItemToggle>();
	}

	public void Upgrade()
	{
		if (global::BetterUpgrades.BetterUpgrades.Configuration.EnableTeamEnergyUpgradeThree.Value && SemiFunc.IsMultiplayer())
		{
			foreach (PlayerAvatar item in SemiFunc.PlayerGetAll())
			{
				PunManager.instance.UpgradePlayerEnergy(SemiFunc.PlayerGetSteamID(item));
				PunManager.instance.UpgradePlayerEnergy(SemiFunc.PlayerGetSteamID(item));
				PunManager.instance.UpgradePlayerEnergy(SemiFunc.PlayerGetSteamID(item));
			}
			return;
		}
		PunManager.instance.UpgradePlayerEnergy(SemiFunc.PlayerGetSteamID(SemiFunc.PlayerAvatarGetFromPhotonID(itemToggle.playerTogglePhotonID)));
		PunManager.instance.UpgradePlayerEnergy(SemiFunc.PlayerGetSteamID(SemiFunc.PlayerAvatarGetFromPhotonID(itemToggle.playerTogglePhotonID)));
		PunManager.instance.UpgradePlayerEnergy(SemiFunc.PlayerGetSteamID(SemiFunc.PlayerAvatarGetFromPhotonID(itemToggle.playerTogglePhotonID)));
	}
}
public class ItemUpgradePlayerExtraJumpThree : MonoBehaviour
{
	private ItemToggle itemToggle;

	private void Start()
	{
		itemToggle = ((Component)this).GetComponent<ItemToggle>();
	}

	public void Upgrade()
	{
		if (global::BetterUpgrades.BetterUpgrades.Configuration.EnableTeamExtraJumpUpgradeThree.Value && SemiFunc.IsMultiplayer())
		{
			foreach (PlayerAvatar item in SemiFunc.PlayerGetAll())
			{
				PunManager.instance.UpgradePlayerExtraJump(SemiFunc.PlayerGetSteamID(item));
				PunManager.instance.UpgradePlayerExtraJump(SemiFunc.PlayerGetSteamID(item));
				PunManager.instance.UpgradePlayerExtraJump(SemiFunc.PlayerGetSteamID(item));
			}
			return;
		}
		PunManager.instance.UpgradePlayerExtraJump(SemiFunc.PlayerGetSteamID(SemiFunc.PlayerAvatarGetFromPhotonID(itemToggle.playerTogglePhotonID)));
		PunManager.instance.UpgradePlayerExtraJump(SemiFunc.PlayerGetSteamID(SemiFunc.PlayerAvatarGetFromPhotonID(itemToggle.playerTogglePhotonID)));
		PunManager.instance.UpgradePlayerExtraJump(SemiFunc.PlayerGetSteamID(SemiFunc.PlayerAvatarGetFromPhotonID(itemToggle.playerTogglePhotonID)));
	}
}
public class ItemUpgradePlayerGrabRangeThree : MonoBehaviour
{
	private ItemToggle itemToggle;

	private void Start()
	{
		itemToggle = ((Component)this).GetComponent<ItemToggle>();
	}

	public void Upgrade()
	{
		if (global::BetterUpgrades.BetterUpgrades.Configuration.EnableTeamRangeUpgradeThree.Value && SemiFunc.IsMultiplayer())
		{
			foreach (PlayerAvatar item in SemiFunc.PlayerGetAll())
			{
				PunManager.instance.UpgradePlayerGrabRange(SemiFunc.PlayerGetSteamID(item));
				PunManager.instance.UpgradePlayerGrabRange(SemiFunc.PlayerGetSteamID(item));
				PunManager.instance.UpgradePlayerGrabRange(SemiFunc.PlayerGetSteamID(item));
			}
			return;
		}
		PunManager.instance.UpgradePlayerGrabRange(SemiFunc.PlayerGetSteamID(SemiFunc.PlayerAvatarGetFromPhotonID(itemToggle.playerTogglePhotonID)));
		PunManager.instance.UpgradePlayerGrabRange(SemiFunc.PlayerGetSteamID(SemiFunc.PlayerAvatarGetFromPhotonID(itemToggle.playerTogglePhotonID)));
		PunManager.instance.UpgradePlayerGrabRange(SemiFunc.PlayerGetSteamID(SemiFunc.PlayerAvatarGetFromPhotonID(itemToggle.playerTogglePhotonID)));
	}
}
public class ItemUpgradePlayerGrabStrengthThree : MonoBehaviour
{
	private ItemToggle itemToggle;

	private void Start()
	{
		itemToggle = ((Component)this).GetComponent<ItemToggle>();
	}

	public void Upgrade()
	{
		if (global::BetterUpgrades.BetterUpgrades.Configuration.EnableTeamStrengthUpgradeThree.Value && SemiFunc.IsMultiplayer())
		{
			foreach (PlayerAvatar item in SemiFunc.PlayerGetAll())
			{
				PunManager.instance.UpgradePlayerGrabStrength(SemiFunc.PlayerGetSteamID(item));
				PunManager.instance.UpgradePlayerGrabStrength(SemiFunc.PlayerGetSteamID(item));
				PunManager.instance.UpgradePlayerGrabStrength(SemiFunc.PlayerGetSteamID(item));
			}
			return;
		}
		PunManager.instance.UpgradePlayerGrabStrength(SemiFunc.PlayerGetSteamID(SemiFunc.PlayerAvatarGetFromPhotonID(itemToggle.playerTogglePhotonID)));
		PunManager.instance.UpgradePlayerGrabStrength(SemiFunc.PlayerGetSteamID(SemiFunc.PlayerAvatarGetFromPhotonID(itemToggle.playerTogglePhotonID)));
		PunManager.instance.UpgradePlayerGrabStrength(SemiFunc.PlayerGetSteamID(SemiFunc.PlayerAvatarGetFromPhotonID(itemToggle.playerTogglePhotonID)));
	}
}
public class ItemUpgradePlayerHealthThree : MonoBehaviour
{
	private ItemToggle itemToggle;

	private void Start()
	{
		itemToggle = ((Component)this).GetComponent<ItemToggle>();
	}

	public void Upgrade()
	{
		if (global::BetterUpgrades.BetterUpgrades.Configuration.EnableTeamHealthUpgradeThree.Value && SemiFunc.IsMultiplayer())
		{
			foreach (PlayerAvatar item in SemiFunc.PlayerGetAll())
			{
				PunManager.instance.UpgradePlayerHealth(SemiFunc.PlayerGetSteamID(item));
				PunManager.instance.UpgradePlayerHealth(SemiFunc.PlayerGetSteamID(item));
				PunManager.instance.UpgradePlayerHealth(SemiFunc.PlayerGetSteamID(item));
			}
			return;
		}
		PunManager.instance.UpgradePlayerHealth(SemiFunc.PlayerGetSteamID(SemiFunc.PlayerAvatarGetFromPhotonID(itemToggle.playerTogglePhotonID)));
		PunManager.instance.UpgradePlayerHealth(SemiFunc.PlayerGetSteamID(SemiFunc.PlayerAvatarGetFromPhotonID(itemToggle.playerTogglePhotonID)));
		PunManager.instance.UpgradePlayerHealth(SemiFunc.PlayerGetSteamID(SemiFunc.PlayerAvatarGetFromPhotonID(itemToggle.playerTogglePhotonID)));
	}
}
public class ItemUpgradePlayerSprintSpeedThree : MonoBehaviour
{
	private ItemToggle itemToggle;

	private void Start()
	{
		itemToggle = ((Component)this).GetComponent<ItemToggle>();
	}

	public void Upgrade()
	{
		if (global::BetterUpgrades.BetterUpgrades.Configuration.EnableTeamSpeedUpgradeThree.Value && SemiFunc.IsMultiplayer())
		{
			foreach (PlayerAvatar item in SemiFunc.PlayerGetAll())
			{
				PunManager.instance.UpgradePlayerSprintSpeed(SemiFunc.PlayerGetSteamID(item));
				PunManager.instance.UpgradePlayerSprintSpeed(SemiFunc.PlayerGetSteamID(item));
				PunManager.instance.UpgradePlayerSprintSpeed(SemiFunc.PlayerGetSteamID(item));
			}
			return;
		}
		PunManager.instance.UpgradePlayerSprintSpeed(SemiFunc.PlayerGetSteamID(SemiFunc.PlayerAvatarGetFromPhotonID(itemToggle.playerTogglePhotonID)));
		PunManager.instance.UpgradePlayerSprintSpeed(SemiFunc.PlayerGetSteamID(SemiFunc.PlayerAvatarGetFromPhotonID(itemToggle.playerTogglePhotonID)));
		PunManager.instance.UpgradePlayerSprintSpeed(SemiFunc.PlayerGetSteamID(SemiFunc.PlayerAvatarGetFromPhotonID(itemToggle.playerTogglePhotonID)));
	}
}
public class ItemUpgradePlayerTumbleLaunchThree : MonoBehaviour
{
	private ItemToggle itemToggle;

	private void Start()
	{
		itemToggle = ((Component)this).GetComponent<ItemToggle>();
	}

	public void Upgrade()
	{
		if (global::BetterUpgrades.BetterUpgrades.Configuration.EnableTeamTumbleLaunchUpgradeThree.Value && SemiFunc.IsMultiplayer())
		{
			foreach (PlayerAvatar item in SemiFunc.PlayerGetAll())
			{
				PunManager.instance.UpgradePlayerTumbleLaunch(SemiFunc.PlayerGetSteamID(item));
				PunManager.instance.UpgradePlayerTumbleLaunch(SemiFunc.PlayerGetSteamID(item));
				PunManager.instance.UpgradePlayerTumbleLaunch(SemiFunc.PlayerGetSteamID(item));
			}
			return;
		}
		PunManager.instance.UpgradePlayerTumbleLaunch(SemiFunc.PlayerGetSteamID(SemiFunc.PlayerAvatarGetFromPhotonID(itemToggle.playerTogglePhotonID)));
		PunManager.instance.UpgradePlayerTumbleLaunch(SemiFunc.PlayerGetSteamID(SemiFunc.PlayerAvatarGetFromPhotonID(itemToggle.playerTogglePhotonID)));
		PunManager.instance.UpgradePlayerTumbleLaunch(SemiFunc.PlayerGetSteamID(SemiFunc.PlayerAvatarGetFromPhotonID(itemToggle.playerTogglePhotonID)));
	}
}
public class ItemUpgradePlayerEnergyTwo : MonoBehaviour
{
	private ItemToggle itemToggle;

	private void Start()
	{
		itemToggle = ((Component)this).GetComponent<ItemToggle>();
	}

	public void Upgrade()
	{
		if (global::BetterUpgrades.BetterUpgrades.Configuration.EnableTeamEnergyUpgradeTwo.Value && SemiFunc.IsMultiplayer())
		{
			foreach (PlayerAvatar item in SemiFunc.PlayerGetAll())
			{
				PunManager.instance.UpgradePlayerEnergy(SemiFunc.PlayerGetSteamID(item));
				PunManager.instance.UpgradePlayerEnergy(SemiFunc.PlayerGetSteamID(item));
			}
			return;
		}
		PunManager.instance.UpgradePlayerEnergy(SemiFunc.PlayerGetSteamID(SemiFunc.PlayerAvatarGetFromPhotonID(itemToggle.playerTogglePhotonID)));
		PunManager.instance.UpgradePlayerEnergy(SemiFunc.PlayerGetSteamID(SemiFunc.PlayerAvatarGetFromPhotonID(itemToggle.playerTogglePhotonID)));
	}
}
public class ItemUpgradePlayerExtraJumpTwo : MonoBehaviour
{
	private ItemToggle itemToggle;

	private void Start()
	{
		itemToggle = ((Component)this).GetComponent<ItemToggle>();
	}

	public void Upgrade()
	{
		if (global::BetterUpgrades.BetterUpgrades.Configuration.EnableTeamExtraJumpUpgradeTwo.Value && SemiFunc.IsMultiplayer())
		{
			foreach (PlayerAvatar item in SemiFunc.PlayerGetAll())
			{
				PunManager.instance.UpgradePlayerExtraJump(SemiFunc.PlayerGetSteamID(item));
				PunManager.instance.UpgradePlayerExtraJump(SemiFunc.PlayerGetSteamID(item));
			}
			return;
		}
		PunManager.instance.UpgradePlayerExtraJump(SemiFunc.PlayerGetSteamID(SemiFunc.PlayerAvatarGetFromPhotonID(itemToggle.playerTogglePhotonID)));
		PunManager.instance.UpgradePlayerExtraJump(SemiFunc.PlayerGetSteamID(SemiFunc.PlayerAvatarGetFromPhotonID(itemToggle.playerTogglePhotonID)));
	}
}
public class ItemUpgradePlayerGrabRangeTwo : MonoBehaviour
{
	private ItemToggle itemToggle;

	private void Start()
	{
		itemToggle = ((Component)this).GetComponent<ItemToggle>();
	}

	public void Upgrade()
	{
		if (global::BetterUpgrades.BetterUpgrades.Configuration.EnableTeamRangeUpgradeTwo.Value && SemiFunc.IsMultiplayer())
		{
			foreach (PlayerAvatar item in SemiFunc.PlayerGetAll())
			{
				PunManager.instance.UpgradePlayerGrabRange(SemiFunc.PlayerGetSteamID(item));
				PunManager.instance.UpgradePlayerGrabRange(SemiFunc.PlayerGetSteamID(item));
			}
			return;
		}
		PunManager.instance.UpgradePlayerGrabRange(SemiFunc.PlayerGetSteamID(SemiFunc.PlayerAvatarGetFromPhotonID(itemToggle.playerTogglePhotonID)));
		PunManager.instance.UpgradePlayerGrabRange(SemiFunc.PlayerGetSteamID(SemiFunc.PlayerAvatarGetFromPhotonID(itemToggle.playerTogglePhotonID)));
	}
}
public class ItemUpgradePlayerGrabStrengthTwo : MonoBehaviour
{
	private ItemToggle itemToggle;

	private void Start()
	{
		itemToggle = ((Component)this).GetComponent<ItemToggle>();
	}

	public void Upgrade()
	{
		if (global::BetterUpgrades.BetterUpgrades.Configuration.EnableTeamStrengthUpgradeTwo.Value && SemiFunc.IsMultiplayer())
		{
			foreach (PlayerAvatar item in SemiFunc.PlayerGetAll())
			{
				PunManager.instance.UpgradePlayerGrabStrength(SemiFunc.PlayerGetSteamID(item));
				PunManager.instance.UpgradePlayerGrabStrength(SemiFunc.PlayerGetSteamID(item));
			}
			return;
		}
		PunManager.instance.UpgradePlayerGrabStrength(SemiFunc.PlayerGetSteamID(SemiFunc.PlayerAvatarGetFromPhotonID(itemToggle.playerTogglePhotonID)));
		PunManager.instance.UpgradePlayerGrabStrength(SemiFunc.PlayerGetSteamID(SemiFunc.PlayerAvatarGetFromPhotonID(itemToggle.playerTogglePhotonID)));
	}
}
public class ItemUpgradePlayerHealthTwo : MonoBehaviour
{
	private ItemToggle itemToggle;

	private void Start()
	{
		itemToggle = ((Component)this).GetComponent<ItemToggle>();
	}

	public void Upgrade()
	{
		if (global::BetterUpgrades.BetterUpgrades.Configuration.EnableTeamHealthUpgradeTwo.Value && SemiFunc.IsMultiplayer())
		{
			foreach (PlayerAvatar item in SemiFunc.PlayerGetAll())
			{
				PunManager.instance.UpgradePlayerHealth(SemiFunc.PlayerGetSteamID(item));
				PunManager.instance.UpgradePlayerHealth(SemiFunc.PlayerGetSteamID(item));
			}
			return;
		}
		PunManager.instance.UpgradePlayerHealth(SemiFunc.PlayerGetSteamID(SemiFunc.PlayerAvatarGetFromPhotonID(itemToggle.playerTogglePhotonID)));
		PunManager.instance.UpgradePlayerHealth(SemiFunc.PlayerGetSteamID(SemiFunc.PlayerAvatarGetFromPhotonID(itemToggle.playerTogglePhotonID)));
	}
}
public class ItemUpgradePlayerSprintSpeedTwo : MonoBehaviour
{
	private ItemToggle itemToggle;

	private void Start()
	{
		itemToggle = ((Component)this).GetComponent<ItemToggle>();
	}

	public void Upgrade()
	{
		if (global::BetterUpgrades.BetterUpgrades.Configuration.EnableTeamSpeedUpgradeTwo.Value && SemiFunc.IsMultiplayer())
		{
			foreach (PlayerAvatar item in SemiFunc.PlayerGetAll())
			{
				PunManager.instance.UpgradePlayerSprintSpeed(SemiFunc.PlayerGetSteamID(item));
				PunManager.instance.UpgradePlayerSprintSpeed(SemiFunc.PlayerGetSteamID(item));
			}
			return;
		}
		PunManager.instance.UpgradePlayerSprintSpeed(SemiFunc.PlayerGetSteamID(SemiFunc.PlayerAvatarGetFromPhotonID(itemToggle.playerTogglePhotonID)));
		PunManager.instance.UpgradePlayerSprintSpeed(SemiFunc.PlayerGetSteamID(SemiFunc.PlayerAvatarGetFromPhotonID(itemToggle.playerTogglePhotonID)));
	}
}
public class ItemUpgradePlayerTumbleLaunchTwo : MonoBehaviour
{
	private ItemToggle itemToggle;

	private void Start()
	{
		itemToggle = ((Component)this).GetComponent<ItemToggle>();
	}

	public void Upgrade()
	{
		if (global::BetterUpgrades.BetterUpgrades.Configuration.EnableTeamTumbleLaunchUpgradeTwo.Value && SemiFunc.IsMultiplayer())
		{
			foreach (PlayerAvatar item in SemiFunc.PlayerGetAll())
			{
				PunManager.instance.UpgradePlayerTumbleLaunch(SemiFunc.PlayerGetSteamID(item));
				PunManager.instance.UpgradePlayerTumbleLaunch(SemiFunc.PlayerGetSteamID(item));
			}
			return;
		}
		PunManager.instance.UpgradePlayerTumbleLaunch(SemiFunc.PlayerGetSteamID(SemiFunc.PlayerAvatarGetFromPhotonID(itemToggle.playerTogglePhotonID)));
		PunManager.instance.UpgradePlayerTumbleLaunch(SemiFunc.PlayerGetSteamID(SemiFunc.PlayerAvatarGetFromPhotonID(itemToggle.playerTogglePhotonID)));
	}
}
namespace BetterUpgrades
{
	[BepInPlugin("Zonk.BetterUpgrades", "BetterUpgrades", "1.5.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class BetterUpgrades : BaseUnityPlugin
	{
		internal class Configuration
		{
			public static ConfigEntry<bool> EnableCommands;

			public static ConfigEntry<int> FakePlayers;

			public static ConfigEntry<bool> EnableConformingUpgradeScaling;

			public static ConfigEntry<bool> EnableTeamEnergyUpgradeTwo;

			public static ConfigEntry<bool> EnableTeamEnergyUpgradeThree;

			public static ConfigEntry<bool> EnableTeamExtraJumpUpgradeTwo;

			public static ConfigEntry<bool> EnableTeamExtraJumpUpgradeThree;

			public static ConfigEntry<bool> EnableTeamRangeUpgradeTwo;

			public static ConfigEntry<bool> EnableTeamRangeUpgradeThree;

			public static ConfigEntry<bool> EnableTeamStrengthUpgradeTwo;

			public static ConfigEntry<bool> EnableTeamStrengthUpgradeThree;

			public static ConfigEntry<bool> EnableTeamHealthUpgradeTwo;

			public static ConfigEntry<bool> EnableTeamHealthUpgradeThree;

			public static ConfigEntry<bool> EnableTeamSpeedUpgradeTwo;

			public static ConfigEntry<bool> EnableTeamSpeedUpgradeThree;

			public static ConfigEntry<bool> EnableTeamTumbleLaunchUpgradeTwo;

			public static ConfigEntry<bool> EnableTeamTumbleLaunchUpgradeThree;

			public static ConfigEntry<int> MaxInShopEnergyOne;

			public static ConfigEntry<int> MaxInShopEnergyTwo;

			public static ConfigEntry<int> MaxInShopEnergyThree;

			public static ConfigEntry<int> MaxInShopExtraJumpOne;

			public static ConfigEntry<int> MaxInShopExtraJumpTwo;

			public static ConfigEntry<int> MaxInShopExtraJumpThree;

			public static ConfigEntry<int> MaxInShopRangeOne;

			public static ConfigEntry<int> MaxInShopRangeTwo;

			public static ConfigEntry<int> MaxInShopRangeThree;

			public static ConfigEntry<int> MaxInShopStrengthOne;

			public static ConfigEntry<int> MaxInShopStrengthTwo;

			public static ConfigEntry<int> MaxInShopStrengthThree;

			public static ConfigEntry<int> MaxInShopHealthOne;

			public static ConfigEntry<int> MaxInShopHealthTwo;

			public static ConfigEntry<int> MaxInShopHealthThree;

			public static ConfigEntry<int> MaxInShopSpeedOne;

			public static ConfigEntry<int> MaxInShopSpeedTwo;

			public static ConfigEntry<int> MaxInShopSpeedThree;

			public static ConfigEntry<int> MaxInShopTumbleLaunchOne;

			public static ConfigEntry<int> MaxInShopTumbleLaunchTwo;

			public static ConfigEntry<int> MaxInShopTumbleLaunchThree;

			public static ConfigEntry<int> MaxInShopPlayerCount;

			public static ConfigEntry<float> UpgradePriceScalingIncrease;

			public static ConfigEntry<float> UpgradePlayerPriceScaling;

			public static ConfigEntry<float> UpgradeBasePriceMultiplier;

			public static ConfigEntry<int> EnergyOnePriceMin;

			public static ConfigEntry<int> EnergyOnePriceMax;

			public static ConfigEntry<int> EnergyTwoPriceMin;

			public static ConfigEntry<int> EnergyTwoPriceMax;

			public static ConfigEntry<int> EnergyThreePriceMin;

			public static ConfigEntry<int> EnergyThreePriceMax;

			public static ConfigEntry<int> ExtraJumpOnePriceMin;

			public static ConfigEntry<int> ExtraJumpOnePriceMax;

			public static ConfigEntry<int> ExtraJumpTwoPriceMin;

			public static ConfigEntry<int> ExtraJumpTwoPriceMax;

			public static ConfigEntry<int> ExtraJumpThreePriceMin;

			public static ConfigEntry<int> ExtraJumpThreePriceMax;

			public static ConfigEntry<int> RangeOnePriceMin;

			public static ConfigEntry<int> RangeOnePriceMax;

			public static ConfigEntry<int> RangeTwoPriceMin;

			public static ConfigEntry<int> RangeTwoPriceMax;

			public static ConfigEntry<int> RangeThreePriceMin;

			public static ConfigEntry<int> RangeThreePriceMax;

			public static ConfigEntry<int> StrengthOnePriceMin;

			public static ConfigEntry<int> StrengthOnePriceMax;

			public static ConfigEntry<int> StrengthTwoPriceMin;

			public static ConfigEntry<int> StrengthTwoPriceMax;

			public static ConfigEntry<int> StrengthThreePriceMin;

			public static ConfigEntry<int> StrengthThreePriceMax;

			public static ConfigEntry<int> HealthOnePriceMin;

			public static ConfigEntry<int> HealthOnePriceMax;

			public static ConfigEntry<int> HealthTwoPriceMin;

			public static ConfigEntry<int> HealthTwoPriceMax;

			public static ConfigEntry<int> HealthThreePriceMin;

			public static ConfigEntry<int> HealthThreePriceMax;

			public static ConfigEntry<int> SpeedOnePriceMin;

			public static ConfigEntry<int> SpeedOnePriceMax;

			public static ConfigEntry<int> SpeedTwoPriceMin;

			public static ConfigEntry<int> SpeedTwoPriceMax;

			public static ConfigEntry<int> SpeedThreePriceMin;

			public static ConfigEntry<int> SpeedThreePriceMax;

			public static ConfigEntry<int> TumbleLaunchOnePriceMin;

			public static ConfigEntry<int> TumbleLaunchOnePriceMax;

			public static ConfigEntry<int> TumbleLaunchTwoPriceMin;

			public static ConfigEntry<int> TumbleLaunchTwoPriceMax;

			public static ConfigEntry<int> TumbleLaunchThreePriceMin;

			public static ConfigEntry<int> TumbleLaunchThreePriceMax;

			public static ConfigEntry<int> PlayerCountPriceMin;

			public static ConfigEntry<int> PlayerCountPriceMax;

			public static void Init(ConfigFile config)
			{
				//IL_0018: Unknown result type (might be due to invalid IL or missing references)
				//IL_0022: Expected O, but got Unknown
				//IL_0045: Unknown result type (might be due to invalid IL or missing references)
				//IL_004f: Expected O, but got Unknown
				//IL_006b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0075: Expected O, but got Unknown
				//IL_0091: Unknown result type (might be due to invalid IL or missing references)
				//IL_009b: Expected O, but got Unknown
				//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c1: Expected O, but got Unknown
				//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e7: Expected O, but got Unknown
				//IL_0103: Unknown result type (might be due to invalid IL or missing references)
				//IL_010d: Expected O, but got Unknown
				//IL_0129: Unknown result type (might be due to invalid IL or missing references)
				//IL_0133: Expected O, but got Unknown
				//IL_014f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0159: Expected O, but got Unknown
				//IL_0175: Unknown result type (might be due to invalid IL or missing references)
				//IL_017f: Expected O, but got Unknown
				//IL_019b: Unknown result type (might be due to invalid IL or missing references)
				//IL_01a5: Expected O, but got Unknown
				//IL_01c1: Unknown result type (might be due to invalid IL or missing references)
				//IL_01cb: Expected O, but got Unknown
				//IL_01e7: Unknown result type (might be due to invalid IL or missing references)
				//IL_01f1: Expected O, but got Unknown
				//IL_020d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0217: Expected O, but got Unknown
				//IL_0233: Unknown result type (might be due to invalid IL or missing references)
				//IL_023d: Expected O, but got Unknown
				//IL_0259: Unknown result type (might be due to invalid IL or missing references)
				//IL_0263: Expected O, but got Unknown
				//IL_027f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0289: Expected O, but got Unknown
				//IL_02b7: Unknown result type (might be due to invalid IL or missing references)
				//IL_02c1: Expected O, but got Unknown
				//IL_02ef: Unknown result type (might be due to invalid IL or missing references)
				//IL_02f9: Expected O, but got Unknown
				//IL_0327: Unknown result type (might be due to invalid IL or missing references)
				//IL_0331: Expected O, but got Unknown
				//IL_0354: Unknown result type (might be due to invalid IL or missing references)
				//IL_035e: Expected O, but got Unknown
				//IL_0381: Unknown result type (might be due to invalid IL or missing references)
				//IL_038b: Expected O, but got Unknown
				//IL_03ae: Unknown result type (might be due to invalid IL or missing references)
				//IL_03b8: Expected O, but got Unknown
				//IL_03db: Unknown result type (might be due to invalid IL or missing references)
				//IL_03e5: Expected O, but got Unknown
				//IL_0408: Unknown result type (might be due to invalid IL or missing references)
				//IL_0412: Expected O, but got Unknown
				//IL_0435: Unknown result type (might be due to invalid IL or missing references)
				//IL_043f: Expected O, but got Unknown
				//IL_0462: Unknown result type (might be due to invalid IL or missing references)
				//IL_046c: Expected O, but got Unknown
				//IL_048f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0499: Expected O, but got Unknown
				//IL_04bc: Unknown result type (might be due to invalid IL or missing references)
				//IL_04c6: Expected O, but got Unknown
				//IL_04e9: Unknown result type (might be due to invalid IL or missing references)
				//IL_04f3: Expected O, but got Unknown
				//IL_0516: Unknown result type (might be due to invalid IL or missing references)
				//IL_0520: Expected O, but got Unknown
				//IL_0543: Unknown result type (might be due to invalid IL or missing references)
				//IL_054d: Expected O, but got Unknown
				//IL_0570: Unknown result type (might be due to invalid IL or missing references)
				//IL_057a: Expected O, but got Unknown
				//IL_059d: Unknown result type (might be due to invalid IL or missing references)
				//IL_05a7: Expected O, but got Unknown
				//IL_05ca: Unknown result type (might be due to invalid IL or missing references)
				//IL_05d4: Expected O, but got Unknown
				//IL_05f7: Unknown result type (might be due to invalid IL or missing references)
				//IL_0601: Expected O, but got Unknown
				//IL_0624: Unknown result type (might be due to invalid IL or missing references)
				//IL_062e: Expected O, but got Unknown
				//IL_0651: Unknown result type (might be due to invalid IL or missing references)
				//IL_065b: Expected O, but got Unknown
				//IL_067e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0688: Expected O, but got Unknown
				//IL_06ab: Unknown result type (might be due to invalid IL or missing references)
				//IL_06b5: Expected O, but got Unknown
				//IL_06d8: Unknown result type (might be due to invalid IL or missing references)
				//IL_06e2: Expected O, but got Unknown
				//IL_0705: Unknown result type (might be due to invalid IL or missing references)
				//IL_070f: Expected O, but got Unknown
				//IL_073d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0747: Expected O, but got Unknown
				//IL_0775: Unknown result type (might be due to invalid IL or missing references)
				//IL_077f: Expected O, but got Unknown
				//IL_07ad: Unknown result type (might be due to invalid IL or missing references)
				//IL_07b7: Expected O, but got Unknown
				//IL_07e5: Unknown result type (might be due to invalid IL or missing references)
				//IL_07ef: Expected O, but got Unknown
				//IL_081d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0827: Expected O, but got Unknown
				//IL_0855: Unknown result type (might be due to invalid IL or missing references)
				//IL_085f: Expected O, but got Unknown
				//IL_088d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0897: Expected O, but got Unknown
				//IL_08c5: Unknown result type (might be due to invalid IL or missing references)
				//IL_08cf: Expected O, but got Unknown
				//IL_08fd: Unknown result type (might be due to invalid IL or missing references)
				//IL_0907: Expected O, but got Unknown
				//IL_0935: Unknown result type (might be due to invalid IL or missing references)
				//IL_093f: Expected O, but got Unknown
				//IL_096d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0977: Expected O, but got Unknown
				//IL_09a5: Unknown result type (might be due to invalid IL or missing references)
				//IL_09af: Expected O, but got Unknown
				//IL_09dd: Unknown result type (might be due to invalid IL or missing references)
				//IL_09e7: Expected O, but got Unknown
				//IL_0a15: Unknown result type (might be due to invalid IL or missing references)
				//IL_0a1f: Expected O, but got Unknown
				//IL_0a4d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0a57: Expected O, but got Unknown
				//IL_0a85: Unknown result type (might be due to invalid IL or missing references)
				//IL_0a8f: Expected O, but got Unknown
				//IL_0abd: Unknown result type (might be due to invalid IL or missing references)
				//IL_0ac7: Expected O, but got Unknown
				//IL_0af5: Unknown result type (might be due to invalid IL or missing references)
				//IL_0aff: Expected O, but got Unknown
				//IL_0b2d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0b37: Expected O, but got Unknown
				//IL_0b65: Unknown result type (might be due to invalid IL or missing references)
				//IL_0b6f: Expected O, but got Unknown
				//IL_0b9d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0ba7: Expected O, but got Unknown
				//IL_0bd5: Unknown result type (might be due to invalid IL or missing references)
				//IL_0bdf: Expected O, but got Unknown
				//IL_0c0d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0c17: Expected O, but got Unknown
				//IL_0c45: Unknown result type (might be due to invalid IL or missing references)
				//IL_0c4f: Expected O, but got Unknown
				//IL_0c7d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0c87: Expected O, but got Unknown
				//IL_0cb5: Unknown result type (might be due to invalid IL or missing references)
				//IL_0cbf: Expected O, but got Unknown
				//IL_0ced: Unknown result type (might be due to invalid IL or missing references)
				//IL_0cf7: Expected O, but got Unknown
				//IL_0d25: Unknown result type (might be due to invalid IL or missing references)
				//IL_0d2f: Expected O, but got Unknown
				//IL_0d5d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0d67: Expected O, but got Unknown
				//IL_0d95: Unknown result type (might be due to invalid IL or missing references)
				//IL_0d9f: Expected O, but got Unknown
				//IL_0dcd: Unknown result type (might be due to invalid IL or missing references)
				//IL_0dd7: Expected O, but got Unknown
				//IL_0e05: Unknown result type (might be due to invalid IL or missing references)
				//IL_0e0f: Expected O, but got Unknown
				//IL_0e3d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0e47: Expected O, but got Unknown
				//IL_0e75: Unknown result type (might be due to invalid IL or missing references)
				//IL_0e7f: Expected O, but got Unknown
				//IL_0ead: Unknown result type (might be due to invalid IL or missing references)
				//IL_0eb7: Expected O, but got Unknown
				//IL_0ee5: Unknown result type (might be due to invalid IL or missing references)
				//IL_0eef: Expected O, but got Unknown
				//IL_0f1d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0f27: Expected O, but got Unknown
				//IL_0f55: Unknown result type (might be due to invalid IL or missing references)
				//IL_0f5f: Expected O, but got Unknown
				//IL_0f8d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0f97: Expected O, but got Unknown
				//IL_0fc5: Unknown result type (might be due to invalid IL or missing references)
				//IL_0fcf: Expected O, but got Unknown
				//IL_0ffd: Unknown result type (might be due to invalid IL or missing references)
				//IL_1007: Expected O, but got Unknown
				//IL_1035: Unknown result type (might be due to invalid IL or missing references)
				//IL_103f: Expected O, but got Unknown
				//IL_106d: Unknown result type (might be due to invalid IL or missing references)
				//IL_1077: Expected O, but got Unknown
				//IL_10a5: Unknown result type (might be due to invalid IL or missing references)
				//IL_10af: Expected O, but got Unknown
				EnableCommands = config.Bind<bool>("General", "EnableCommands", true, new ConfigDescription("Enable if you and your team can use developer commands /be spawn (item) and /be money (number)", (AcceptableValueBase)null, Array.Empty<object>()));
				FakePlayers = config.Bind<int>("General", "FakePlayers", 0, new ConfigDescription("Fake the amount of players in the game (don't include you)", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 10), Array.Empty<object>()));
				EnableConformingUpgradeScaling = config.Bind<bool>("General", "EnableConformingUpgradeScaling", true, new ConfigDescription("Enable if purchasing upgrade one affects the prices of upgrade two and three", (AcceptableValueBase)null, Array.Empty<object>()));
				EnableTeamEnergyUpgradeTwo = config.Bind<bool>("EnergyTwo", "EnableTeamEnergyUpgradeTwo", true, new ConfigDescription("Enable the teamwide use of this upgrade", (AcceptableValueBase)null, Array.Empty<object>()));
				EnableTeamEnergyUpgradeThree = config.Bind<bool>("EnergyThree", "EnableTeamEnergyUpgradeThree", true, new ConfigDescription("Enable the teamwide use of this upgrade", (AcceptableValueBase)null, Array.Empty<object>()));
				EnableTeamExtraJumpUpgradeTwo = config.Bind<bool>("ExtraJumpTwo", "EnableTeamExtraJumpUpgradeTwo", true, new ConfigDescription("Enable the teamwide use of this upgrade", (AcceptableValueBase)null, Array.Empty<object>()));
				EnableTeamExtraJumpUpgradeThree = config.Bind<bool>("ExtraJumpThree", "EnableTeamExtraJumpUpgradeThree", true, new ConfigDescription("Enable the teamwide use of this upgrade", (AcceptableValueBase)null, Array.Empty<object>()));
				EnableTeamRangeUpgradeTwo = config.Bind<bool>("RangeTwo", "EnableTeamRangeUpgradeTwo", true, new ConfigDescription("Enable the teamwide use of this upgrade", (AcceptableValueBase)null, Array.Empty<object>()));
				EnableTeamRangeUpgradeThree = config.Bind<bool>("RangeThree", "EnableTeamRangeUpgradeThree", true, new ConfigDescription("Enable the teamwide use of this upgrade", (AcceptableValueBase)null, Array.Empty<object>()));
				EnableTeamStrengthUpgradeTwo = config.Bind<bool>("StrengthTwo", "EnableTeamStrengthUpgradeTwo", true, new ConfigDescription("Enable the teamwide use of this upgrade", (AcceptableValueBase)null, Array.Empty<object>()));
				EnableTeamStrengthUpgradeThree = config.Bind<bool>("StrengthThree", "EnableTeamStrengthUpgradeThree", true, new ConfigDescription("Enable the teamwide use of this upgrade", (AcceptableValueBase)null, Array.Empty<object>()));
				EnableTeamHealthUpgradeTwo = config.Bind<bool>("HealthTwo", "EnableTeamHealthUpgradeTwo", true, new ConfigDescription("Enable the teamwide use of this upgrade", (AcceptableValueBase)null, Array.Empty<object>()));
				EnableTeamHealthUpgradeThree = config.Bind<bool>("HealthThree", "EnableTeamHealthUpgradeThree", true, new ConfigDescription("Enable the teamwide use of this upgrade", (AcceptableValueBase)null, Array.Empty<object>()));
				EnableTeamSpeedUpgradeTwo = config.Bind<bool>("SpeedTwo", "EnableTeamSpeedUpgradeTwo", true, new ConfigDescription("Enable the teamwide use of this upgrade", (AcceptableValueBase)null, Array.Empty<object>()));
				EnableTeamSpeedUpgradeThree = config.Bind<bool>("SpeedThree", "EnableTeamSpeedUpgradeThree", true, new ConfigDescription("Enable the teamwide use of this upgrade", (AcceptableValueBase)null, Array.Empty<object>()));
				EnableTeamTumbleLaunchUpgradeTwo = config.Bind<bool>("TumbleLaunchTwo", "EnableTeamTumbleLaunchUpgradeTwo", true, new ConfigDescription("Enable the teamwide use of this upgrade", (AcceptableValueBase)null, Array.Empty<object>()));
				EnableTeamTumbleLaunchUpgradeThree = config.Bind<bool>("TumbleLaunchThree", "EnableTeamTumbleLaunchUpgradeThree", true, new ConfigDescription("Enable the teamwide use of this upgrade", (AcceptableValueBase)null, Array.Empty<object>()));
				UpgradePriceScalingIncrease = config.Bind<float>("General", "UpgradePriceScalingIncrease", 50f, new ConfigDescription("Vanilla: 50%, UpgradePrice + (pruchasedUpgradeCount * 0.5), Change the percent increase for every purchased upgrade", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 200f), Array.Empty<object>()));
				UpgradePlayerPriceScaling = config.Bind<float>("General", "UpgradePlayerPriceScaling", 0f, new ConfigDescription("BaseUpgradePrice + (x% * playerCount), Change the percent increase for every player", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 200f), Array.Empty<object>()));
				UpgradeBasePriceMultiplier = config.Bind<float>("General", "UpgradeBasePriceMultiplier", 1f, new ConfigDescription("UpgradePrice * x, Multiplier to the price of an item at the start of a game", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 100.5f), Array.Empty<object>()));
				MaxInShopEnergyOne = config.Bind<int>("EnergyOne", "MaxInShopEnergyOne", 2, new ConfigDescription("Set the max amount of instances of the respective upgrade in the shop at a time", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 10), Array.Empty<object>()));
				MaxInShopEnergyTwo = config.Bind<int>("EnergyTwo", "MaxInShopEnergyTwo", 1, new ConfigDescription("Set the max amount of instances of the respective upgrade in the shop at a time", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 10), Array.Empty<object>()));
				MaxInShopEnergyThree = config.Bind<int>("EnergyThree", "MaxInShopEnergyThree", 1, new ConfigDescription("Set the max amount of instances of the respective upgrade in the shop at a time", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 10), Array.Empty<object>()));
				MaxInShopExtraJumpOne = config.Bind<int>("ExtraJumpOne", "MaxInShopExtraJumpOne", 2, new ConfigDescription("Set the max amount of instances of the respective upgrade in the shop at a time", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 10), Array.Empty<object>()));
				MaxInShopExtraJumpTwo = config.Bind<int>("ExtraJumpTwo", "MaxInShopExtraJumpTwo", 1, new ConfigDescription("Set the max amount of instances of the respective upgrade in the shop at a time", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 10), Array.Empty<object>()));
				MaxInShopExtraJumpThree = config.Bind<int>("ExtraJumpThree", "MaxInShopExtraJumpThree", 1, new ConfigDescription("Set the max amount of instances of the respective upgrade in the shop at a time", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 10), Array.Empty<object>()));
				MaxInShopRangeOne = config.Bind<int>("RangeOne", "MaxInShopRangeOne", 2, new ConfigDescription("Set the max amount of instances of the respective upgrade in the shop at a time", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 10), Array.Empty<object>()));
				MaxInShopRangeTwo = config.Bind<int>("RangeTwo", "MaxInShopRangeTwo", 1, new ConfigDescription("Set the max amount of instances of the respective upgrade in the shop at a time", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 10), Array.Empty<object>()));
				MaxInShopRangeThree = config.Bind<int>("RangeThree", "MaxInShopRangeThree", 1, new ConfigDescription("Set the max amount of instances of the respective upgrade in the shop at a time", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 10), Array.Empty<object>()));
				MaxInShopStrengthOne = config.Bind<int>("StrengthOne", "MaxInShopStrengthOne", 2, new ConfigDescription("Set the max amount of instances of the respective upgrade in the shop at a time", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 10), Array.Empty<object>()));
				MaxInShopStrengthTwo = config.Bind<int>("StrengthTwo", "MaxInShopStrengthTwo", 1, new ConfigDescription("Set the max amount of instances of the respective upgrade in the shop at a time", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 10), Array.Empty<object>()));
				MaxInShopStrengthThree = config.Bind<int>("StrengthThree", "MaxInShopStrengthThree", 1, new ConfigDescription("Set the max amount of instances of the respective upgrade in the shop at a time", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 10), Array.Empty<object>()));
				MaxInShopHealthOne = config.Bind<int>("HealthOne", "MaxInShopHealthOne", 2, new ConfigDescription("Set the max amount of instances of the respective upgrade in the shop at a time", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 10), Array.Empty<object>()));
				MaxInShopHealthTwo = config.Bind<int>("HealthTwo", "MaxInShopHealthTwo", 1, new ConfigDescription("Set the max amount of instances of the respective upgrade in the shop at a time", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 10), Array.Empty<object>()));
				MaxInShopHealthThree = config.Bind<int>("HealthThree", "MaxInShopHealthThree", 1, new ConfigDescription("Set the max amount of instances of the respective upgrade in the shop at a time", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 10), Array.Empty<object>()));
				MaxInShopSpeedOne = config.Bind<int>("SpeedOne", "MaxInShopSpeedOne", 2, new ConfigDescription("Set the max amount of instances of the respective upgrade in the shop at a time", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 10), Array.Empty<object>()));
				MaxInShopSpeedTwo = config.Bind<int>("SpeedTwo", "MaxInShopSpeedTwo", 1, new ConfigDescription("Set the max amount of instances of the respective upgrade in the shop at a time", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 10), Array.Empty<object>()));
				MaxInShopSpeedThree = config.Bind<int>("SpeedThree", "MaxInShopSpeedThree", 1, new ConfigDescription("Set the max amount of instances of the respective upgrade in the shop at a time", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 10), Array.Empty<object>()));
				MaxInShopTumbleLaunchOne = config.Bind<int>("TumbleLaunchOne", "MaxInShopTumbleLaunchOne", 2, new ConfigDescription("Set the max amount of instances of the respective upgrade in the shop at a time", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 10), Array.Empty<object>()));
				MaxInShopTumbleLaunchTwo = config.Bind<int>("TumbleLaunchTwo", "MaxInShopTumbleLaunchTwo", 1, new ConfigDescription("Set the max amount of instances of the respective upgrade in the shop at a time", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 10), Array.Empty<object>()));
				MaxInShopTumbleLaunchThree = config.Bind<int>("TumbleLaunchThree", "MaxInShopTumbleLaunchThree", 1, new ConfigDescription("Set the max amount of instances of the respective upgrade in the shop at a time", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 10), Array.Empty<object>()));
				MaxInShopPlayerCount = config.Bind<int>("PlayerCount", "MaxInShopPlayerCount", 2, new ConfigDescription("Set the max amount of instances of the respective upgrade in the shop at a time", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 10), Array.Empty<object>()));
				EnergyOnePriceMin = config.Bind<int>("EnergyOne", "EnergyOnePriceMin", 2000, new ConfigDescription("Change the min price of energyupgrade in the shop", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1000, 100000), Array.Empty<object>()));
				EnergyOnePriceMax = config.Bind<int>("EnergyOne", "EnergyOnePriceMax", 2000, new ConfigDescription("Change the max price of energyupgrade in the shop", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1000, 100000), Array.Empty<object>()));
				EnergyTwoPriceMin = config.Bind<int>("EnergyTwo", "EnergyTwoPriceMin", 3000, new ConfigDescription("Change the min price of energytwoupgrade in the shop", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1000, 100000), Array.Empty<object>()));
				EnergyTwoPriceMax = config.Bind<int>("EnergyTwo", "EnergyTwoPriceMax", 3000, new ConfigDescription("Change the max price of energytwoupgrade in the shop", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1000, 100000), Array.Empty<object>()));
				EnergyThreePriceMin = config.Bind<int>("EnergyThree", "EnergyThreePriceMin", 5000, new ConfigDescription("Change the min price of energythreeupgrade in the shop", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1000, 100000), Array.Empty<object>()));
				EnergyThreePriceMax = config.Bind<int>("EnergyThree", "EnergyThreePriceMax", 5000, new ConfigDescription("Change the max price of energythreeupgrade in the shop", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1000, 100000), Array.Empty<object>()));
				ExtraJumpOnePriceMin = config.Bind<int>("ExtraJumpOne", "ExtraJumpOnePriceMin", 8000, new ConfigDescription("Change the min price of extrajumpupgrade in the shop", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1000, 100000), Array.Empty<object>()));
				ExtraJumpOnePriceMax = config.Bind<int>("ExtraJumpOne", "ExtraJumpOnePriceMax", 8000, new ConfigDescription("Change the max price of extrajumpupgrade in the shop", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1000, 100000), Array.Empty<object>()));
				ExtraJumpTwoPriceMin = config.Bind<int>("ExtraJumpTwo", "ExtraJumpTwoPriceMin", 14000, new ConfigDescription("Change the min price of extrajumptwoupgrade in the shop", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1000, 100000), Array.Empty<object>()));
				ExtraJumpTwoPriceMax = config.Bind<int>("ExtraJumpTwo", "ExtraJumpTwoPriceMax", 14000, new ConfigDescription("Change the max price of extrajumptwoupgrade in the shop", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1000, 100000), Array.Empty<object>()));
				ExtraJumpThreePriceMin = config.Bind<int>("ExtraJumpThree", "ExtraJumpThreePriceMin", 21000, new ConfigDescription("Change the min price of extrajumpthreeupgrade in the shop", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1000, 100000), Array.Empty<object>()));
				ExtraJumpThreePriceMax = config.Bind<int>("ExtraJumpThree", "ExtraJumpThreePriceMax", 21000, new ConfigDescription("Change the max price of extrajumpthreeupgrade in the shop", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1000, 100000), Array.Empty<object>()));
				RangeOnePriceMin = config.Bind<int>("RangeOne", "RangeOnePriceMin", 7000, new ConfigDescription("Change the min price of rangeupgrade in the shop", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1000, 100000), Array.Empty<object>()));
				RangeOnePriceMax = config.Bind<int>("RangeOne", "RangeOnePriceMax", 7000, new ConfigDescription("Change the max price of rangeupgrade in the shop", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1000, 100000), Array.Empty<object>()));
				RangeTwoPriceMin = config.Bind<int>("RangeTwo", "RangeTwoPriceMin", 12000, new ConfigDescription("Change the min price of rangetwoupgrade in the shop", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1000, 100000), Array.Empty<object>()));
				RangeTwoPriceMax = config.Bind<int>("RangeTwo", "RangeTwoPriceMax", 12000, new ConfigDescription("Change the max price of rangetwoupgrade in the shop", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1000, 100000), Array.Empty<object>()));
				RangeThreePriceMin = config.Bind<int>("RangeThree", "RangeThreePriceMin", 18000, new ConfigDescription("Change the min price of rangethreeupgrade in the shop", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1000, 100000), Array.Empty<object>()));
				RangeThreePriceMax = config.Bind<int>("RangeThree", "RangeThreePriceMax", 18000, new ConfigDescription("Change the max price of rangethreeupgrade in the shop", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1000, 100000), Array.Empty<object>()));
				StrengthOnePriceMin = config.Bind<int>("StrengthOne", "StrengthOnePriceMin", 7000, new ConfigDescription("Change the min price of strengthupgrade in the shop", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1000, 100000), Array.Empty<object>()));
				StrengthOnePriceMax = config.Bind<int>("StrengthOne", "StrengthOnePriceMax", 7000, new ConfigDescription("Change the max price of strengthupgrade in the shop", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1000, 100000), Array.Empty<object>()));
				StrengthTwoPriceMin = config.Bind<int>("StrengthTwo", "StrengthTwoPriceMin", 12000, new ConfigDescription("Change the min price of strengthtwoupgrade in the shop", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1000, 100000), Array.Empty<object>()));
				StrengthTwoPriceMax = config.Bind<int>("StrengthTwo", "StrengthTwoPriceMax", 12000, new ConfigDescription("Change the max price of strengthtwoupgrade in the shop", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1000, 100000), Array.Empty<object>()));
				StrengthThreePriceMin = config.Bind<int>("StrengthThree", "StrengthThreePriceMin", 18000, new ConfigDescription("Change the min price of strengththreeupgrade in the shop", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1000, 100000), Array.Empty<object>()));
				StrengthThreePriceMax = config.Bind<int>("StrengthThree", "StrengthThreePriceMax", 18000, new ConfigDescription("Change the max price of strengththreeupgrade in the shop", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1000, 100000), Array.Empty<object>()));
				HealthOnePriceMin = config.Bind<int>("HealthOne", "HealthOnePriceMin", 4000, new ConfigDescription("Change the min price of healthupgrade in the shop", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1000, 100000), Array.Empty<object>()));
				HealthOnePriceMax = config.Bind<int>("HealthOne", "HealthOnePriceMax", 4000, new ConfigDescription("Change the max price of healthupgrade in the shop", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1000, 100000), Array.Empty<object>()));
				HealthTwoPriceMin = config.Bind<int>("HealthTwo", "HealthTwoPriceMin", 6000, new ConfigDescription("Change the min price of healthtwoupgrade in the shop", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1000, 100000), Array.Empty<object>()));
				HealthTwoPriceMax = config.Bind<int>("HealthTwo", "HealthTwoPriceMax", 6000, new ConfigDescription("Change the max price of healthtwoupgrade in the shop", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1000, 100000), Array.Empty<object>()));
				HealthThreePriceMin = config.Bind<int>("HealthThree", "HealthThreePriceMin", 9000, new ConfigDescription("Change the min price of healththreeupgrade in the shop", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1000, 100000), Array.Empty<object>()));
				HealthThreePriceMax = config.Bind<int>("HealthThree", "HealthThreePriceMax", 9000, new ConfigDescription("Change the max price of healththreeupgrade in the shop", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1000, 100000), Array.Empty<object>()));
				SpeedOnePriceMin = config.Bind<int>("SpeedOne", "SpeedOnePriceMin", 7000, new ConfigDescription("Change the min price of speedupgrade in the shop", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1000, 100000), Array.Empty<object>()));
				SpeedOnePriceMax = config.Bind<int>("SpeedOne", "SpeedOnePriceMax", 7000, new ConfigDescription("Change the max price of speedupgrade in the shop", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1000, 100000), Array.Empty<object>()));
				SpeedTwoPriceMin = config.Bind<int>("SpeedTwo", "SpeedTwoPriceMin", 12000, new ConfigDescription("Change the min price of speedtwoupgrade in the shop", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1000, 100000), Array.Empty<object>()));
				SpeedTwoPriceMax = config.Bind<int>("SpeedTwo", "SpeedTwoPriceMax", 12000, new ConfigDescription("Change the max price of speedtwoupgrade in the shop", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1000, 100000), Array.Empty<object>()));
				SpeedThreePriceMin = config.Bind<int>("SpeedThree", "SpeedThreePriceMin", 18000, new ConfigDescription("Change the min price of speedthreeupgrade in the shop", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1000, 100000), Array.Empty<object>()));
				SpeedThreePriceMax = config.Bind<int>("SpeedThree", "SpeedThreePriceMax", 18000, new ConfigDescription("Change the max price of speedthreeupgrade in the shop", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1000, 100000), Array.Empty<object>()));
				TumbleLaunchOnePriceMin = config.Bind<int>("TumbleLaunchOne", "TumbleLaunchOnePriceMin", 4000, new ConfigDescription("Change the min price of tumblelaunchupgrade in the shop", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1000, 100000), Array.Empty<object>()));
				TumbleLaunchOnePriceMax = config.Bind<int>("TumbleLaunchOne", "TumbleLaunchOnePriceMax", 4000, new ConfigDescription("Change the max price of tumblelaunchupgrade in the shop", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1000, 100000), Array.Empty<object>()));
				TumbleLaunchTwoPriceMin = config.Bind<int>("TumbleLaunchTwo", "TumbleLaunchTwoPriceMin", 6000, new ConfigDescription("Change the min price of tumblelaunchtwoupgrade in the shop", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1000, 100000), Array.Empty<object>()));
				TumbleLaunchTwoPriceMax = config.Bind<int>("TumbleLaunchTwo", "TumbleLaunchTwoPriceMax", 6000, new ConfigDescription("Change the max price of tumblelaunchtwoupgrade in the shop", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1000, 100000), Array.Empty<object>()));
				TumbleLaunchThreePriceMin = config.Bind<int>("TumbleLaunchThree", "TumbleLaunchThreePriceMin", 9000, new ConfigDescription("Change the min price of tumblelaunchthreeupgrade in the shop", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1000, 100000), Array.Empty<object>()));
				TumbleLaunchThreePriceMax = config.Bind<int>("TumbleLaunchThree", "TumbleLaunchThreePriceMax", 9000, new ConfigDescription("Change the max price of tumblelaunchthreeupgrade in the shop", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1000, 100000), Array.Empty<object>()));
				PlayerCountPriceMin = config.Bind<int>("PlayerCount", "PlayerCountPriceMin", 8000, new ConfigDescription("Change the min price of playercountupgrade in the shop", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1000, 100000), Array.Empty<object>()));
				PlayerCountPriceMax = config.Bind<int>("PlayerCount", "PlayerCountPriceMax", 8000, new ConfigDescription("Change the max price of playercountupgrade in the shop", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1000, 100000), Array.Empty<object>()));
			}
		}

		[HarmonyPatch(typeof(ShopManager))]
		internal static class ShopManagerPatch
		{
			[HarmonyPatch("ShopInitialize")]
			[HarmonyPostfix]
			private static void StartConfigPatch()
			{
				Dictionary<string, List<int>> dictionary = new Dictionary<string, List<int>>
				{
					{
						"Strength Upgrade",
						new List<int>(3)
						{
							Configuration.StrengthOnePriceMin.Value,
							Configuration.StrengthOnePriceMax.Value,
							Configuration.MaxInShopStrengthOne.Value
						}
					},
					{
						"Strength Upgrade Two",
						new List<int>(3)
						{
							Configuration.StrengthTwoPriceMin.Value,
							Configuration.StrengthTwoPriceMax.Value,
							Configuration.MaxInShopStrengthTwo.Value
						}
					},
					{
						"Strength Upgrade Three",
						new List<int>(3)
						{
							Configuration.StrengthThreePriceMin.Value,
							Configuration.StrengthThreePriceMax.Value,
							Configuration.MaxInShopStrengthThree.Value
						}
					},
					{
						"Stamina Upgrade",
						new List<int>(3)
						{
							Configuration.EnergyOnePriceMin.Value,
							Configuration.EnergyOnePriceMax.Value,
							Configuration.MaxInShopEnergyOne.Value
						}
					},
					{
						"Stamina Upgrade Two",
						new List<int>(3)
						{
							Configuration.EnergyTwoPriceMin.Value,
							Configuration.EnergyTwoPriceMax.Value,
							Configuration.MaxInShopEnergyTwo.Value
						}
					},
					{
						"Stamina Upgrade Three",
						new List<int>(3)
						{
							Configuration.EnergyThreePriceMin.Value,
							Configuration.EnergyThreePriceMax.Value,
							Configuration.MaxInShopEnergyThree.Value
						}
					},
					{
						"Extra Jump Upgrade",
						new List<int>(3)
						{
							Configuration.ExtraJumpOnePriceMin.Value,
							Configuration.ExtraJumpOnePriceMax.Value,
							Configuration.MaxInShopExtraJumpOne.Value
						}
					},
					{
						"Extra Jump Upgrade Two",
						new List<int>(3)
						{
							Configuration.ExtraJumpTwoPriceMin.Value,
							Configuration.ExtraJumpTwoPriceMax.Value,
							Configuration.MaxInShopExtraJumpTwo.Value
						}
					},
					{
						"Extra Jump Upgrade Three",
						new List<int>(3)
						{
							Configuration.ExtraJumpThreePriceMin.Value,
							Configuration.ExtraJumpThreePriceMax.Value,
							Configuration.MaxInShopExtraJumpThree.Value
						}
					},
					{
						"Health Upgrade",
						new List<int>(3)
						{
							Configuration.HealthOnePriceMin.Value,
							Configuration.HealthOnePriceMax.Value,
							Configuration.MaxInShopHealthOne.Value
						}
					},
					{
						"Health Upgrade Two",
						new List<int>(3)
						{
							Configuration.HealthTwoPriceMin.Value,
							Configuration.HealthTwoPriceMax.Value,
							Configuration.MaxInShopHealthTwo.Value
						}
					},
					{
						"Health Upgrade Three",
						new List<int>(3)
						{
							Configuration.HealthThreePriceMin.Value,
							Configuration.HealthThreePriceMax.Value,
							Configuration.MaxInShopHealthThree.Value
						}
					},
					{
						"Range Upgrade",
						new List<int>(3)
						{
							Configuration.RangeOnePriceMin.Value,
							Configuration.RangeOnePriceMax.Value,
							Configuration.MaxInShopRangeOne.Value
						}
					},
					{
						"Range Upgrade Two",
						new List<int>(3)
						{
							Configuration.RangeTwoPriceMin.Value,
							Configuration.RangeTwoPriceMax.Value,
							Configuration.MaxInShopRangeTwo.Value
						}
					},
					{
						"Range Upgrade Three",
						new List<int>(3)
						{
							Configuration.RangeThreePriceMin.Value,
							Configuration.RangeThreePriceMax.Value,
							Configuration.MaxInShopRangeThree.Value
						}
					},
					{
						"Sprint Speed Upgrade",
						new List<int>(3)
						{
							Configuration.SpeedOnePriceMin.Value,
							Configuration.SpeedOnePriceMax.Value,
							Configuration.MaxInShopSpeedOne.Value
						}
					},
					{
						"Sprint Speed Upgrade Two",
						new List<int>(3)
						{
							Configuration.SpeedTwoPriceMin.Value,
							Configuration.SpeedTwoPriceMax.Value,
							Configuration.MaxInShopSpeedTwo.Value
						}
					},
					{
						"Sprint Speed Upgrade Three",
						new List<int>(3)
						{
							Configuration.SpeedThreePriceMin.Value,
							Configuration.SpeedThreePriceMax.Value,
							Configuration.MaxInShopSpeedThree.Value
						}
					},
					{
						"Tumble Launch Upgrade",
						new List<int>(3)
						{
							Configuration.TumbleLaunchOnePriceMin.Value,
							Configuration.TumbleLaunchOnePriceMax.Value,
							Configuration.MaxInShopTumbleLaunchOne.Value
						}
					},
					{
						"Tumble Launch Upgrade Two",
						new List<int>(3)
						{
							Configuration.TumbleLaunchTwoPriceMin.Value,
							Configuration.TumbleLaunchTwoPriceMax.Value,
							Configuration.MaxInShopTumbleLaunchTwo.Value
						}
					},
					{
						"Tumble Launch Upgrade Three",
						new List<int>(3)
						{
							Configuration.TumbleLaunchThreePriceMin.Value,
							Configuration.TumbleLaunchThreePriceMax.Value,
							Configuration.MaxInShopTumbleLaunchThree.Value
						}
					},
					{
						"Map Player Count Upgrade",
						new List<int>(3)
						{
							Configuration.PlayerCountPriceMin.Value,
							Configuration.PlayerCountPriceMax.Value,
							Configuration.MaxInShopPlayerCount.Value
						}
					}
				};
				int num = 0;
				float upgradeValueIncrease = Configuration.UpgradePriceScalingIncrease.Value / 100f;
				ShopManager.instance.upgradeValueIncrease = upgradeValueIncrease;
				foreach (KeyValuePair<string, List<int>> item in dictionary)
				{
					string key = item.Key;
					List<int> value = item.Value;
					SetItemValueMinMax(Items.GetItemByName(key), value[0], value[1], key, Configuration.UpgradeBasePriceMultiplier.Value, value[2], num);
					num++;
				}
				Debug.Log((object)"All items patched for BetterUpgrades");
			}

			private static void SetItemValueMinMax(Item item, int minValue, int maxValue, string name, float basePriceMult, int maxInShop, int index)
			{
				if ((Object)(object)item == (Object)null)
				{
					Debug.LogError((object)("StatsManagerPatch: Failed to set item min max value. " + name + " is null."));
					return;
				}
				int num = index + 1;
				int num2 = num;
				int num3;
				int num4;
				if (num2 > 1 && num2 < 4)
				{
					num3 = StatsManager.instance.GetItemsUpgradesPurchased("Item Upgrade Player Grab Strength");
					num4 = Configuration.StrengthOnePriceMax.Value;
				}
				else
				{
					int num5 = num2;
					if (num5 > 4 && num5 < 7)
					{
						num3 = StatsManager.instance.GetItemsUpgradesPurchased("Item Upgrade Player Energy");
						num4 = Configuration.EnergyOnePriceMax.Value;
					}
					else
					{
						int num6 = num2;
						if (num6 > 7 && num6 < 10)
						{
							num3 = StatsManager.instance.GetItemsUpgradesPurchased("Item Upgrade Player Extra Jump");
							num4 = Configuration.ExtraJumpOnePriceMax.Value;
						}
						else
						{
							int num7 = num2;
							if (num7 > 10 && num7 < 13)
							{
								num3 = StatsManager.instance.GetItemsUpgradesPurchased("Item Upgrade Player Health");
								num4 = Configuration.HealthOnePriceMax.Value;
							}
							else
							{
								int num8 = num2;
								if (num8 > 13 && num8 < 16)
								{
									num3 = StatsManager.instance.GetItemsUpgradesPurchased("Item Upgrade Player Grab Range");
									num4 = Configuration.RangeOnePriceMax.Value;
								}
								else
								{
									int num9 = num2;
									if (num9 > 16 && num9 < 19)
									{
										num3 = StatsManager.instance.GetItemsUpgradesPurchased("Item Upgrade Player Sprint Speed");
										num4 = Configuration.SpeedOnePriceMax.Value;
									}
									else
									{
										int num10 = num2;
										if (num10 > 19 && num10 < 22)
										{
											num3 = StatsManager.instance.GetItemsUpgradesPurchased("Item Upgrade Player Tumble Launch");
											num4 = Configuration.TumbleLaunchOnePriceMax.Value;
										}
										else
										{
											num3 = 0;
											num4 = 0;
										}
									}
								}
							}
						}
					}
				}
				float num11 = GameDirector.instance.PlayerList.Count - 1 + Configuration.FakePlayers.Value;
				float value = Configuration.UpgradePlayerPriceScaling.Value;
				if (!Configuration.EnableConformingUpgradeScaling.Value)
				{
					num3 = 0;
					num4 = 0;
				}
				float num12 = value / 100f * num11;
				int num13 = (int)Math.Round((double)minValue / 1000.0) * 1000 / 4;
				int num14 = (int)Math.Round((double)maxValue / 1000.0) * 1000 / 4;
				float num15 = (float)(num4 / 4) * ShopManager.instance.upgradeValueIncrease * (float)num3;
				Value val = ScriptableObject.CreateInstance<Value>();
				val.valueMin = ((float)num13 + num12 * (float)(minValue / 4)) * basePriceMult + num15;
				val.valueMax = ((float)num14 + num12 * (float)(maxValue / 4)) * basePriceMult + num15;
				item.value = val;
				item.maxAmountInShop = maxInShop;
			}
		}

		[HarmonyPatch(typeof(ChatManager))]
		internal static class ChatManagerPatch
		{
			[HarmonyPatch("MessageSend")]
			[HarmonyPostfix]
			private static void CommandsPatch()
			{
				//IL_0186: Unknown result type (might be due to invalid IL or missing references)
				//IL_018d: 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_019c: 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_01a3: Unknown result type (might be due to invalid IL or missing references)
				//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
				//IL_0220: Unknown result type (might be due to invalid IL or missing references)
				//IL_0222: Unknown result type (might be due to invalid IL or missing references)
				//IL_01f2: Unknown result type (might be due to invalid IL or missing references)
				//IL_01f4: Unknown result type (might be due to invalid IL or missing references)
				string text = ChatManager.instance.chatHistory[ChatManager.instance.chatHistory.Count - 1];
				if (!text.StartsWith("/") || !Configuration.EnableCommands.Value)
				{
					return;
				}
				string[] array = text.Split(new char[1] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
				if (!(array[0] == "/be"))
				{
					return;
				}
				if (SemiFunc.RunIsShop() && array[1] == "money")
				{
					if (int.TryParse(array[2], out var result) && result >= 1000)
					{
						StatsManager.instance.runStats["currency"] = StatsManager.instance.runStats["currency"] + result / 1000;
						Debug.Log((object)$"Gave you {result} currency");
					}
				}
				else
				{
					if (!(array[1] == "spawn"))
					{
						return;
					}
					string itemName = "";
					for (int i = 2; i <= array.Length - 1; i++)
					{
						itemName = itemName + " " + array[i];
					}
					itemName = itemName.Trim();
					Transform transform = ((Component)Camera.main).transform;
					Vector3 val = transform.position + transform.forward * 2f;
					Quaternion identity = Quaternion.identity;
					IReadOnlyList<Item> registeredItems = Items.RegisteredItems;
					Item val2 = ((IEnumerable<Item>)registeredItems).FirstOrDefault((Func<Item, bool>)((Item go) => string.Equals(((Object)go).name, itemName, StringComparison.OrdinalIgnoreCase)));
					if (Object.op_Implicit((Object)(object)val2))
					{
						if (SemiFunc.IsMultiplayer())
						{
							PhotonNetwork.InstantiateRoomObject("Items/" + ((Object)val2).name, val, identity, (byte)0, (object[])null);
							Debug.Log((object)(((Object)val2).name + " has been spawned"));
						}
						else
						{
							Object.Instantiate<GameObject>(val2.prefab, val, identity);
							Debug.Log((object)(((Object)val2).name + " has been spawned"));
						}
					}
				}
			}
		}

		internal AssetBundle assetBundle;

		internal static BetterUpgrades Instance { get; private set; }

		internal static ManualLogSource Logger => Instance._logger;

		private ManualLogSource _logger => ((BaseUnityPlugin)this).Logger;

		internal static Harmony? Harmony { get; set; }

		private void Awake()
		{
			Instance = this;
			string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "betterupgrades");
			AssetBundle val = (assetBundle = AssetBundle.LoadFromFile(text));
			List<string> list = new List<string>(14)
			{
				"Item Upgrade Player Grab Strength Two", "Item Upgrade Player Grab Strength Three", "Item Upgrade Player Energy Two", "Item Upgrade Player Energy Three", "Item Upgrade Player Extra Jump Two", "Item Upgrade Player Extra Jump Three", "Item Upgrade Player Grab Range Two", "Item Upgrade Player Grab Range Three", "Item Upgrade Player Health Two", "Item Upgrade Player Health Three",
				"Item Upgrade Player Sprint Speed Two", "Item Upgrade Player Sprint Speed Three", "Item Upgrade Player Tumble Launch Two", "Item Upgrade Player Tumble Launch Three"
			};
			foreach (string item in list)
			{
				Item val2 = val.LoadAsset<Item>("Assets/Upgrades/" + item + ".asset");
				Items.RegisterItem(val2);
			}
			Configuration.Init(((BaseUnityPlugin)this).Config);
			Patch();
		}

		internal void Patch()
		{
			//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_0023: Expected O, but got Unknown
			if (Harmony == null)
			{
				Harmony = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID);
			}
			Harmony.PatchAll();
		}

		internal void Unpatch()
		{
			Harmony? harmony = Harmony;
			if (harmony != null)
			{
				harmony.UnpatchSelf();
			}
		}

		private void Update()
		{
		}
	}
}