Decompiled source of JariasModPackV2 v1.0.1

Mods/BetterTruckHeals.dll

Decompiled a year 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!");
	}
}

Mods/BetterUpgrades.dll

Decompiled a year 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 BetterUpgrades;
using HarmonyLib;
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: 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.1.1.0")]
[assembly: AssemblyInformationalVersion("1.1.1")]
[assembly: AssemblyProduct("BetterUpgrades")]
[assembly: AssemblyTitle("BetterUpgrades")]
[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.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.EnableTieredUpgradesForTeam.Value)
		{
			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.EnableTieredUpgradesForTeam.Value)
		{
			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.EnableTieredUpgradesForTeam.Value)
		{
			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.EnableTieredUpgradesForTeam.Value)
		{
			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.EnableTieredUpgradesForTeam.Value)
		{
			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.EnableTieredUpgradesForTeam.Value)
		{
			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.EnableTieredUpgradesForTeam.Value)
		{
			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.EnableTieredUpgradesForTeam.Value)
		{
			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.EnableTieredUpgradesForTeam.Value)
		{
			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.EnableTieredUpgradesForTeam.Value)
		{
			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.EnableTieredUpgradesForTeam.Value)
		{
			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.EnableTieredUpgradesForTeam.Value)
		{
			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.EnableTieredUpgradesForTeam.Value)
		{
			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.EnableTieredUpgradesForTeam.Value)
		{
			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.1.1")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class BetterUpgrades : BaseUnityPlugin
	{
		internal class Configuration
		{
			public static ConfigEntry<bool> EnableTieredUpgradesForTeam;

			public static ConfigEntry<bool> EnableConsistentVanillaPricing;

			public static ConfigEntry<int> EnergyTwoPriceMin;

			public static ConfigEntry<int> EnergyTwoPriceMax;

			public static ConfigEntry<int> EnergyThreePriceMin;

			public static ConfigEntry<int> EnergyThreePriceMax;

			public static ConfigEntry<int> ExtraJumpTwoPriceMin;

			public static ConfigEntry<int> ExtraJumpTwoPriceMax;

			public static ConfigEntry<int> ExtraJumpThreePriceMin;

			public static ConfigEntry<int> ExtraJumpThreePriceMax;

			public static ConfigEntry<int> RangeTwoPriceMin;

			public static ConfigEntry<int> RangeTwoPriceMax;

			public static ConfigEntry<int> RangeThreePriceMin;

			public static ConfigEntry<int> RangeThreePriceMax;

			public static ConfigEntry<int> StrengthTwoPriceMin;

			public static ConfigEntry<int> StrengthTwoPriceMax;

			public static ConfigEntry<int> StrengthThreePriceMin;

			public static ConfigEntry<int> StrengthThreePriceMax;

			public static ConfigEntry<int> HealthTwoPriceMin;

			public static ConfigEntry<int> HealthTwoPriceMax;

			public static ConfigEntry<int> HealthThreePriceMin;

			public static ConfigEntry<int> HealthThreePriceMax;

			public static ConfigEntry<int> SpeedTwoPriceMin;

			public static ConfigEntry<int> SpeedTwoPriceMax;

			public static ConfigEntry<int> SpeedThreePriceMin;

			public static ConfigEntry<int> SpeedThreePriceMax;

			public static ConfigEntry<int> TumbleLaunchTwoPriceMin;

			public static ConfigEntry<int> TumbleLaunchTwoPriceMax;

			public static ConfigEntry<int> TumbleLaunchThreePriceMin;

			public static ConfigEntry<int> TumbleLaunchThreePriceMax;

			public static void Init(ConfigFile config)
			{
				//IL_005c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0066: Expected O, but got Unknown
				//IL_0090: Unknown result type (might be due to invalid IL or missing references)
				//IL_009a: Expected O, but got Unknown
				//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ce: Expected O, but got Unknown
				//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
				//IL_0102: Expected O, but got Unknown
				//IL_012c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0136: Expected O, but got Unknown
				//IL_0160: Unknown result type (might be due to invalid IL or missing references)
				//IL_016a: Expected O, but got Unknown
				//IL_0194: Unknown result type (might be due to invalid IL or missing references)
				//IL_019e: Expected O, but got Unknown
				//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
				//IL_01d2: Expected O, but got Unknown
				//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
				//IL_0206: Expected O, but got Unknown
				//IL_0230: Unknown result type (might be due to invalid IL or missing references)
				//IL_023a: Expected O, but got Unknown
				//IL_0264: Unknown result type (might be due to invalid IL or missing references)
				//IL_026e: Expected O, but got Unknown
				//IL_0298: Unknown result type (might be due to invalid IL or missing references)
				//IL_02a2: Expected O, but got Unknown
				//IL_02cc: Unknown result type (might be due to invalid IL or missing references)
				//IL_02d6: Expected O, but got Unknown
				//IL_0300: Unknown result type (might be due to invalid IL or missing references)
				//IL_030a: Expected O, but got Unknown
				//IL_0334: Unknown result type (might be due to invalid IL or missing references)
				//IL_033e: Expected O, but got Unknown
				//IL_0368: Unknown result type (might be due to invalid IL or missing references)
				//IL_0372: Expected O, but got Unknown
				//IL_039c: Unknown result type (might be due to invalid IL or missing references)
				//IL_03a6: Expected O, but got Unknown
				//IL_03d0: Unknown result type (might be due to invalid IL or missing references)
				//IL_03da: Expected O, but got Unknown
				//IL_0404: Unknown result type (might be due to invalid IL or missing references)
				//IL_040e: Expected O, but got Unknown
				//IL_0438: Unknown result type (might be due to invalid IL or missing references)
				//IL_0442: Expected O, but got Unknown
				//IL_046c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0476: Expected O, but got Unknown
				//IL_04a0: Unknown result type (might be due to invalid IL or missing references)
				//IL_04aa: Expected O, but got Unknown
				//IL_04d4: Unknown result type (might be due to invalid IL or missing references)
				//IL_04de: Expected O, but got Unknown
				//IL_0508: Unknown result type (might be due to invalid IL or missing references)
				//IL_0512: Expected O, but got Unknown
				//IL_053c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0546: 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_05a4: Unknown result type (might be due to invalid IL or missing references)
				//IL_05ae: Expected O, but got Unknown
				//IL_05d8: Unknown result type (might be due to invalid IL or missing references)
				//IL_05e2: Expected O, but got Unknown
				EnableTieredUpgradesForTeam = config.Bind<bool>("General", "EnableTieredUpgradesForTeam", true, "The tiered upgrades now work for the whole team");
				EnableConsistentVanillaPricing = config.Bind<bool>("General", "EnableConsistentVanillaPricing", true, "Vanilla items no longer have a min-max price");
				EnergyTwoPriceMin = config.Bind<int>("EnergyTwo", "EnergyTwoPriceMin", 3000, new ConfigDescription("Change the min price of energytwoupgrade in the shop", (AcceptableValueBase)(object)new AcceptableValueRange<int>(-1, 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>(-1, 100000), Array.Empty<object>()));
				EnergyThreePriceMin = config.Bind<int>("EnergyThree", "EnergyThreePriceMin", 5200, new ConfigDescription("Change the min price of energythreeupgrade in the shop", (AcceptableValueBase)(object)new AcceptableValueRange<int>(-1, 100000), Array.Empty<object>()));
				EnergyThreePriceMax = config.Bind<int>("EnergyThree", "EnergyThreePriceMax", 5200, new ConfigDescription("Change the max price of energythreeupgrade in the shop", (AcceptableValueBase)(object)new AcceptableValueRange<int>(-1, 100000), Array.Empty<object>()));
				ExtraJumpTwoPriceMin = config.Bind<int>("ExtraJumpTwo", "ExtraJumpTwoPriceMin", 17000, new ConfigDescription("Change the min price of extrajumptwoupgrade in the shop", (AcceptableValueBase)(object)new AcceptableValueRange<int>(-1, 100000), Array.Empty<object>()));
				ExtraJumpTwoPriceMax = config.Bind<int>("ExtraJumpTwo", "ExtraJumpTwoPriceMax", 17000, new ConfigDescription("Change the max price of extrajumptwoupgrade in the shop", (AcceptableValueBase)(object)new AcceptableValueRange<int>(-1, 100000), Array.Empty<object>()));
				ExtraJumpThreePriceMin = config.Bind<int>("ExtraJumpThree", "ExtraJumpThreePriceMin", 26000, new ConfigDescription("Change the min price of extrajumpthreeupgrade in the shop", (AcceptableValueBase)(object)new AcceptableValueRange<int>(-1, 100000), Array.Empty<object>()));
				ExtraJumpThreePriceMax = config.Bind<int>("ExtraJumpThree", "ExtraJumpThreePriceMax", 26000, new ConfigDescription("Change the max price of extrajumpthreeupgrade in the shop", (AcceptableValueBase)(object)new AcceptableValueRange<int>(-1, 100000), Array.Empty<object>()));
				RangeTwoPriceMin = config.Bind<int>("RangeTwo", "RangeTwoPriceMin", 14400, new ConfigDescription("Change the min price of rangetwoupgrade in the shop", (AcceptableValueBase)(object)new AcceptableValueRange<int>(-1, 100000), Array.Empty<object>()));
				RangeTwoPriceMax = config.Bind<int>("RangeTwo", "RangeTwoPriceMax", 14400, new ConfigDescription("Change the max price of rangetwoupgrade in the shop", (AcceptableValueBase)(object)new AcceptableValueRange<int>(-1, 100000), Array.Empty<object>()));
				RangeThreePriceMin = config.Bind<int>("RangeThree", "RangeThreePriceMin", 20800, new ConfigDescription("Change the min price of rangethreeupgrade in the shop", (AcceptableValueBase)(object)new AcceptableValueRange<int>(-1, 100000), Array.Empty<object>()));
				RangeThreePriceMax = config.Bind<int>("RangeThree", "RangeThreePriceMax", 20800, new ConfigDescription("Change the max price of rangethreeupgrade in the shop", (AcceptableValueBase)(object)new AcceptableValueRange<int>(-1, 100000), Array.Empty<object>()));
				StrengthTwoPriceMin = config.Bind<int>("StrengthTwo", "StrengthTwoPriceMin", 14400, new ConfigDescription("Change the min price of strengthtwoupgrade in the shop", (AcceptableValueBase)(object)new AcceptableValueRange<int>(-1, 100000), Array.Empty<object>()));
				StrengthTwoPriceMax = config.Bind<int>("StrengthTwo", "StrengthTwoPriceMax", 14400, new ConfigDescription("Change the max price of strengthtwoupgrade in the shop", (AcceptableValueBase)(object)new AcceptableValueRange<int>(-1, 100000), Array.Empty<object>()));
				StrengthThreePriceMin = config.Bind<int>("StrengthThree", "StrengthThreePriceMin", 20800, new ConfigDescription("Change the min price of strengththreeupgrade in the shop", (AcceptableValueBase)(object)new AcceptableValueRange<int>(-1, 100000), Array.Empty<object>()));
				StrengthThreePriceMax = config.Bind<int>("StrengthThree", "StrengthThreePriceMax", 20800, new ConfigDescription("Change the max price of strengththreeupgrade in the shop", (AcceptableValueBase)(object)new AcceptableValueRange<int>(-1, 100000), Array.Empty<object>()));
				HealthTwoPriceMin = config.Bind<int>("HealthTwo", "HealthTwoPriceMin", 8000, new ConfigDescription("Change the min price of healthtwoupgrade in the shop", (AcceptableValueBase)(object)new AcceptableValueRange<int>(-1, 100000), Array.Empty<object>()));
				HealthTwoPriceMax = config.Bind<int>("HealthTwo", "HealthTwoPriceMax", 8000, new ConfigDescription("Change the max price of healthtwoupgrade in the shop", (AcceptableValueBase)(object)new AcceptableValueRange<int>(-1, 100000), Array.Empty<object>()));
				HealthThreePriceMin = config.Bind<int>("HealthThree", "HealthThreePriceMin", 12000, new ConfigDescription("Change the min price of healththreeupgrade in the shop", (AcceptableValueBase)(object)new AcceptableValueRange<int>(-1, 100000), Array.Empty<object>()));
				HealthThreePriceMax = config.Bind<int>("HealthThree", "HealthThreePriceMax", 12000, new ConfigDescription("Change the max price of healththreeupgrade in the shop", (AcceptableValueBase)(object)new AcceptableValueRange<int>(-1, 100000), Array.Empty<object>()));
				SpeedTwoPriceMin = config.Bind<int>("SpeedTwo", "SpeedTwoPriceMin", 14400, new ConfigDescription("Change the min price of speedtwoupgrade in the shop", (AcceptableValueBase)(object)new AcceptableValueRange<int>(-1, 100000), Array.Empty<object>()));
				SpeedTwoPriceMax = config.Bind<int>("SpeedTwo", "SpeedTwoPriceMax", 14400, new ConfigDescription("Change the max price of speedtwoupgrade in the shop", (AcceptableValueBase)(object)new AcceptableValueRange<int>(-1, 100000), Array.Empty<object>()));
				SpeedThreePriceMin = config.Bind<int>("SpeedThree", "SpeedThreePriceMin", 20800, new ConfigDescription("Change the min price of speedthreeupgrade in the shop", (AcceptableValueBase)(object)new AcceptableValueRange<int>(-1, 100000), Array.Empty<object>()));
				SpeedThreePriceMax = config.Bind<int>("SpeedThree", "SpeedThreePriceMax", 20800, new ConfigDescription("Change the max price of speedthreeupgrade in the shop", (AcceptableValueBase)(object)new AcceptableValueRange<int>(-1, 100000), Array.Empty<object>()));
				TumbleLaunchTwoPriceMin = config.Bind<int>("TumbleLaunchTwo", "TumbleLaunchTwoPriceMin", 8000, new ConfigDescription("Change the min price of tumblelaunchtwoupgrade in the shop", (AcceptableValueBase)(object)new AcceptableValueRange<int>(-1, 100000), Array.Empty<object>()));
				TumbleLaunchTwoPriceMax = config.Bind<int>("TumbleLaunchTwo", "TumbleLaunchTwoPriceMax", 8000, new ConfigDescription("Change the max price of tumblelaunchtwoupgrade in the shop", (AcceptableValueBase)(object)new AcceptableValueRange<int>(-1, 100000), Array.Empty<object>()));
				TumbleLaunchThreePriceMin = config.Bind<int>("TumbleLaunchThree", "TumbleLaunchThreePriceMin", 12000, new ConfigDescription("Change the min price of tumblelaunchthreeupgrade in the shop", (AcceptableValueBase)(object)new AcceptableValueRange<int>(-1, 100000), Array.Empty<object>()));
				TumbleLaunchThreePriceMax = config.Bind<int>("TumbleLaunchThree", "TumbleLaunchThreePriceMax", 12000, new ConfigDescription("Change the max price of tumblelaunchthreeupgrade in the shop", (AcceptableValueBase)(object)new AcceptableValueRange<int>(-1, 100000), Array.Empty<object>()));
			}
		}

		[HarmonyPatch(typeof(ShopManager))]
		internal static class ShopManagerPatch
		{
			[HarmonyPatch("ShopInitialize")]
			[HarmonyPostfix]
			private static void StartPatch()
			{
				Dictionary<string, List<int>> dictionary = new Dictionary<string, List<int>>
				{
					{
						"Strength Upgrade",
						new List<int>(3) { 8000, 7000, 10000 }
					},
					{
						"Stamina Upgrade",
						new List<int>(3) { 2000, 1500, 2250 }
					},
					{
						"Extra Jump Upgrade",
						new List<int>(3) { 10000, 10000, 15000 }
					},
					{
						"Health Upgrade",
						new List<int>(3) { 5000, 4250, 5500 }
					},
					{
						"Range Upgrade",
						new List<int>(3) { 8000, 7000, 10000 }
					},
					{
						"Sprint Speed Upgrade",
						new List<int>(3) { 8000, 7000, 10000 }
					},
					{
						"Tumble Launch Upgrade",
						new List<int>(3) { 5000, 4250, 5500 }
					},
					{
						"Map Player Count Upgrade",
						new List<int>(3) { 10000, 10000, 15000 }
					}
				};
				Dictionary<string, List<int>> dictionary2 = new Dictionary<string, List<int>>
				{
					{
						"Strength Upgrade Two",
						new List<int>(2)
						{
							Configuration.StrengthTwoPriceMin.Value,
							Configuration.StrengthTwoPriceMax.Value
						}
					},
					{
						"Strength Upgrade Three",
						new List<int>(2)
						{
							Configuration.StrengthThreePriceMin.Value,
							Configuration.StrengthThreePriceMax.Value
						}
					},
					{
						"Stamina Upgrade Two",
						new List<int>(2)
						{
							Configuration.EnergyTwoPriceMin.Value,
							Configuration.EnergyTwoPriceMax.Value
						}
					},
					{
						"Stamina Upgrade Three",
						new List<int>(2)
						{
							Configuration.EnergyThreePriceMin.Value,
							Configuration.EnergyThreePriceMax.Value
						}
					},
					{
						"Extra Jump Upgrade Two",
						new List<int>(2)
						{
							Configuration.ExtraJumpTwoPriceMin.Value,
							Configuration.ExtraJumpTwoPriceMax.Value
						}
					},
					{
						"Extra Jump Upgrade Three",
						new List<int>(2)
						{
							Configuration.ExtraJumpThreePriceMin.Value,
							Configuration.ExtraJumpThreePriceMax.Value
						}
					},
					{
						"Health Upgrade Two",
						new List<int>(2)
						{
							Configuration.HealthTwoPriceMin.Value,
							Configuration.HealthTwoPriceMax.Value
						}
					},
					{
						"Health Upgrade Three",
						new List<int>(2)
						{
							Configuration.HealthThreePriceMin.Value,
							Configuration.HealthThreePriceMax.Value
						}
					},
					{
						"Range Upgrade Two",
						new List<int>(2)
						{
							Configuration.RangeTwoPriceMin.Value,
							Configuration.RangeTwoPriceMax.Value
						}
					},
					{
						"Range Upgrade Three",
						new List<int>(2)
						{
							Configuration.RangeThreePriceMin.Value,
							Configuration.RangeThreePriceMax.Value
						}
					},
					{
						"Sprint Speed Upgrade Two",
						new List<int>(2)
						{
							Configuration.SpeedTwoPriceMin.Value,
							Configuration.SpeedTwoPriceMax.Value
						}
					},
					{
						"Sprint Speed Upgrade Three",
						new List<int>(2)
						{
							Configuration.SpeedThreePriceMin.Value,
							Configuration.SpeedThreePriceMax.Value
						}
					},
					{
						"Tumble Launch Upgrade Two",
						new List<int>(2)
						{
							Configuration.TumbleLaunchTwoPriceMin.Value,
							Configuration.TumbleLaunchTwoPriceMax.Value
						}
					},
					{
						"Tumble Launch Upgrade Three",
						new List<int>(2)
						{
							Configuration.TumbleLaunchThreePriceMin.Value,
							Configuration.TumbleLaunchThreePriceMax.Value
						}
					}
				};
				foreach (KeyValuePair<string, List<int>> item in dictionary2)
				{
					string key = item.Key;
					List<int> value = item.Value;
					SetItemValueMinMax(Items.GetItemByName(key), value[0], value[1], key);
				}
				foreach (KeyValuePair<string, List<int>> item2 in dictionary)
				{
					string key2 = item2.Key;
					List<int> value2 = item2.Value;
					if (Configuration.EnableConsistentVanillaPricing.Value)
					{
						SetItemValueMinMax(Items.GetItemByName(key2), value2[0], value2[0], key2);
					}
					else
					{
						SetItemValueMinMax(Items.GetItemByName(key2), value2[1], value2[2], key2);
					}
				}
				Debug.Log((object)"All items patched for BetterUpgrades");
			}

			private static void SetItemValueMinMax(Item item, int minValue, int maxValue, string name)
			{
				if ((Object)(object)item == (Object)null)
				{
					Debug.LogError((object)("StatsManagerPatch: Failed to set item min max value. " + name + "is null."));
					return;
				}
				Value val = ScriptableObject.CreateInstance<Value>();
				val.valueMin = minValue / 5;
				val.valueMax = maxValue / 5;
				item.value = val;
			}
		}

		internal AssetBundle assetBundle;

		internal static BetterUpgrades 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;
			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_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()
		{
		}
	}
}

Mods/DeadMapAccess.dll

Decompiled a year 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 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.3.0")]
[assembly: AssemblyInformationalVersion("1.0.3+06ac64da26402c29c8f2224970527fed2f0f1107")]
[assembly: AssemblyProduct("DeadMapAccess")]
[assembly: AssemblyTitle("DeadMapAccess")]
[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 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;

		public 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.");
		}
	}
	[BepInPlugin("dev.saturnkai.deadmapaccess", "DeadMapAccess", "1.0.3")]
	public class DeadMap : BaseUnityPlugin
	{
		public static RenderTexture? renderTexture;

		public static bool spectating;

		private bool active;

		private bool activePrev;

		private readonly float scaleSpeed = 5f;

		private float scale = 0.5f;

		private float targetScale = 1f;

		internal static DeadMap Instance { get; private set; }

		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();
			}
		}

		internal static void SetSpectating(bool isSpectating)
		{
			spectating = isSpectating;
		}

		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)
			{
				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();
				}
			}
		}

		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);
		}
	}
}
namespace DeadMapAccess.patches
{
	[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 (DeadMap.spectating)
			{
				DeadMap.SetSpectating(isSpectating: 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.renderTexture == (Object)null))
			{
				return;
			}
			Camera[] array = Object.FindObjectsOfType<Camera>(true);
			Camera[] array2 = array;
			foreach (Camera val in array2)
			{
				if (((Object)val).name == "Dirt Finder Map Camera")
				{
					((MonoBehaviour)Map.Instance).StartCoroutine(LoadMapTexture(val));
				}
			}
		}

		private static IEnumerator LoadMapTexture(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(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);
			}
		}
	}
}

Mods/EnhancedStaminaUpgrade.dll

Decompiled a year 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.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETFramework,Version=v4.6", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("EnhancedStaminaUpgrade")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("My first plugin")]
[assembly: AssemblyTitle("EnhancedStaminaUpgrade")]
[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 EnhancedStaminaUpgrade
{
	[BepInPlugin("traktool.enhancedstaminaupgrade", "Enhanced Stamina Upgrade", "1.0.0")]
	public class EnhancedStaminaUpgrade : BaseUnityPlugin
	{
		public const string PluginGUID = "traktool.enhancedstaminaupgrade";

		public const string PluginName = "Enhanced Stamina Upgrade";

		public const string PluginVersion = "1.0.0";

		internal static ManualLogSource Logger;

		private void Awake()
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Expected O, but got Unknown
			Logger = ((BaseUnityPlugin)this).Logger;
			Logger.LogInfo((object)"Plugin traktool.enhancedstaminaupgrade is loaded!");
			Harmony val = new Harmony("traktool.enhancedstaminaupgrade");
			val.PatchAll();
			LogAllPatches();
		}

		private void LogAllPatches()
		{
			List<MethodBase> list = Harmony.GetAllPatchedMethods().ToList();
			if (!list.Any())
			{
				Logger.LogDebug((object)"No patch found.");
				return;
			}
			foreach (MethodBase item in list)
			{
				Patches patchInfo = Harmony.GetPatchInfo(item);
				if (patchInfo == null)
				{
					continue;
				}
				List<Patch> list2 = patchInfo.Prefixes.Where((Patch p) => p.owner == "traktool.enhancedstaminaupgrade").ToList();
				List<Patch> list3 = patchInfo.Postfixes.Where((Patch p) => p.owner == "traktool.enhancedstaminaupgrade").ToList();
				List<Patch> list4 = patchInfo.Transpilers.Where((Patch p) => p.owner == "traktool.enhancedstaminaupgrade").ToList();
				List<Patch> list5 = patchInfo.Finalizers.Where((Patch p) => p.owner == "traktool.enhancedstaminaupgrade").ToList();
				if (list2.Count == 0 && list3.Count == 0 && list4.Count == 0 && list5.Count == 0)
				{
					continue;
				}
				string text = item.DeclaringType?.FullName + ":" + item.Name;
				Logger.LogDebug((object)("Patched method traktool.enhancedstaminaupgrade : " + text));
				foreach (Patch item2 in list2)
				{
					Logger.LogDebug((object)("  -> [Prefix]    (patched method : " + item2.PatchMethod.Name + ")"));
				}
				foreach (Patch item3 in list3)
				{
					Logger.LogDebug((object)("  -> [Postfix]   (patched method : " + item3.PatchMethod.Name + ")"));
				}
				foreach (Patch item4 in list4)
				{
					Logger.LogDebug((object)("  -> [Transpiler](patched method : " + item4.PatchMethod.Name + ")"));
				}
				foreach (Patch item5 in list5)
				{
					Logger.LogDebug((object)("  -> [Finalizer] (patched method : " + item5.PatchMethod.Name + ")"));
				}
			}
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "EnhancedStaminaUpgrade";

		public const string PLUGIN_NAME = "My first plugin";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace EnhancedStaminaUpgrade.Patches
{
	[HarmonyPatch(typeof(PlayerController))]
	internal class PlayerControllerPatch
	{
		[HarmonyPatch("Update")]
		[HarmonyPrefix]
		private static void Update_Prefix(ref float ___sprintRechargeAmount, PlayerController __instance)
		{
			if (!LevelGenerator.Instance.Generated || SemiFunc.MenuLevel())
			{
				return;
			}
			string key = SemiFunc.PlayerGetSteamID(__instance.playerAvatarScript);
			if (StatsManager.instance.playerUpgradeStamina.ContainsKey(key))
			{
				float num = float.Parse(StatsManager.instance.playerUpgradeStamina[key].ToString());
				if (___sprintRechargeAmount != 2f + 0.5f * num)
				{
					EnhancedStaminaUpgrade.Logger.LogDebug((object)$"Old Sprint Recharge Amount: {___sprintRechargeAmount}");
					___sprintRechargeAmount = 2f + 0.5f * num;
					EnhancedStaminaUpgrade.Logger.LogDebug((object)$"New Sprint Recharge Amount: {___sprintRechargeAmount}");
				}
			}
		}
	}
}

Mods/MenuLib.dll

Decompiled a year 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.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.3.0")]
[assembly: AssemblyInformationalVersion("1.0.0+d09ef1dec861a6323ece44f68f5fa7fbdc3dacbd")]
[assembly: AssemblyProduct("MenuLib")]
[assembly: AssemblyTitle("MenuLib")]
[assembly: AssemblyVersion("2.3.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.3.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;
		}

		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_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)
				float num = SemiFunc.InputMovementY();
				float num2 = SemiFunc.InputScrollY();
				float num5;
				if (MenuAPI.customMenuPages.TryGetValue(menuPage, out var value))
				{
					float? scrollSpeed = value.scrollView.scrollSpeed;
					if (scrollSpeed.HasValue)
					{
						float valueOrDefault = scrollSpeed.GetValueOrDefault();
						valueOrDefault *= 10f;
						float num3 = Mathf.Abs((float)REPOReflection.menuScrollBox_ScrollerEndPosition.GetValue(menuScrollBox) - (float)REPOReflection.menuScrollBox_ScrollerStartPosition.GetValue(menuScrollBox));
						float num4 = (num + (float)Math.Sign(num2)) * valueOrDefault / num3;
						Rect rect = menuScrollBox.scrollBarBackground.rect;
						num5 = num4 * ((Rect)(ref rect)).height;
						goto IL_00c1;
					}
				}
				float num6 = (float)REPOReflection.menuScrollBox_ScrollHeight.GetValue(menuScrollBox);
				num5 = num * 20f / (num6 * 0.01f) + num2 / (num6 * 0.01f);
				goto IL_00c1;
				IL_00c1:
				float num7 = (float)REPOReflection.menuScrollBox_ScrollHandleTargetPosition.GetValue(menuScrollBox);
				REPOReflection.menuScrollBox_ScrollHandleTargetPosition.SetValue(menuScrollBox, num7 + num5);
			});
			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);
		}

		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
			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);
		}
	}
	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 = "Menu 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 = "Menu 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 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_0055: 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_005a: 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;
			customMenuPages.Add(rEPOPopupPage.menuPage, rEPOPopupPage);
			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 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_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_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Expected I4, but got Unknown
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Expected O, but got Unknown
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Expected O, but got Unknown
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Expected O, but got Unknown
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Expected O, but got Unknown
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Expected O, but got Unknown
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Expected O, but got Unknown
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Expected O, but got Unknown
			foreach (MenuPages menuPage in MenuManager.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 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 RectTransform rectTransform;

		public RectTransform maskRectTransform;

		public RectTransform scrollBarRectTransform;

		public MenuPage menuPage;

		public TextMeshProUGUI headerTMP;

		public MenuScrollBox menuScrollBox;

		public REPOScrollView scrollView;

		public bool closeMenuOnEscape = true;

		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>());
		}

		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);
			}
		}

		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)
				{
					ClosePage(closePagesAddedOnTop: false);
				}
			}
		}

		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_0162: Unknown result type (might be due to invalid IL or missing references)
			//IL_0167: Unknown result type (might be due to invalid IL or missing references)
			//IL_0177: Unknown result type (might be due to invalid IL or missing references)
			//IL_017c: 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 num6 = 0.55f * ((Rect)(ref rect)).height;
			rect = menuScrollBox.scrollBarBackground.rect;
			menuScrollBox_ScrollerStartPosition.SetValue(menuScrollBox, Math.Abs(num5 / (1f - num6 / ((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 references)
			//IL_0212: Unknown result type (might be due to invalid IL or missing references)
			//IL_0217: Unknown result type (might be due to invalid IL or missing references)
			//IL_0218: Unknown result type (might be due to invalid IL or missing references)
			//IL_0233: Unknown result type (might be due to invalid IL or missing references)
			//IL_0238: Unknown result type (might be due to invalid IL or missing references)
			//IL_0239: Unknown result type (might be due to invalid IL or missing references)
			//IL_0256: Unknown result type (might be due to invalid IL or missing references)
			//IL_025b: Unknown result type (might be due to invalid IL or missing references)
			//IL_025c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0272: Unknown result type (might be due to invalid IL or missing references)
			//IL_027c: Expected O, but got Unknown
			//IL_0282: Unknown result type (might be due to invalid IL or missing references)
			//IL_029c: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c6: Expected O, but got Unknown
			//IL_02cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_0309: Unknown result type (might be due to invalid IL or missing references)
			//IL_031f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0324: 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_0330: Unknown result type (might be due to invalid IL or missing references)
			//IL_033a: Expected O, but got Unknown
			//IL_0346: Unknown result type (might be due to invalid IL or missing references)
			//IL_0350: Expected O, but got Unknown
			//IL_0359: Unknown result type (might be due to invalid IL or missing references)
			//IL_035e: Unknown result type (might be due to invalid IL or missing references)
			//IL_035f: Unknown result type (might be due to invalid IL or missing references)
			//IL_036a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0374: Expected O, but got Unknown
			//IL_0380: Unknown result type (might be due to invalid IL or missing references)
			//IL_038a: Expected O, but got Unknown
			base.rectTransform = (RectTransform)((Component)this).transform;
			menuPage = ((Component)this).GetComponentInParent<MenuPage>();
			menuSelectableElement = ((Component)this).GetComponent<MenuSelectableElement>();
			labelTMP = ((Component)this).GetComponentInChildren<TextMeshProUGUI>();
			descriptionTMP = ((Component)((Component)this).transform.Find("Big Setting Text")).GetComponent<TextMeshProUGUI>();
			valueTMP = ((Component)((Component)this).transform.Find("Bar Text")).GetComponent<TextMeshProUGUI>();
			barMaskRectTransform = (RectTransform)((Component)this).transform.Find("MaskedText");
			maskedValueTMP = ((Component)barMaskRectTransform).GetComponentInChildren<TextMeshProUGUI>();
			barPointerRectTransform = (RectTransform)((Component)((Component)this).transform.Find("Bar Pointer")).transform;
			Vector3 val = default(Vector3);
			((Vector3)(ref val))..ctor(5.3f, 0f);
			RectTransform obj = ((TMP_Text)labelTMP).rectTransform;
			((Transform)obj).localPosition = ((Transform)obj).localPosition - val;
			((TMP_Text)descriptionTMP).alignment = (TextAlignmentOptions)514;
			TextMeshProUGUI obj2 = descriptionTMP;
			bool enableWordWrapping = (((TMP_Text)descriptionTMP).enableAutoSizing = false);
			((TMP_Text)obj2).enableWordWrapping = enableWordWrapping;
			((TMP_Text)descriptionTMP).overflowMode = (TextOverflowModes)2;
			TextMeshProUGUI obj3 = descriptionTMP;
			((TMP_Text)obj3).fontSize = ((TMP_Text)obj3).fontSize - 5f;
			repoTextScroller = ((Component)descriptionTMP).gameObject.AddComponent<REPOTextScroller>();
			repoTextScroller.textMeshPro = (TMP_Text)(object)descriptionTMP;
			RectTransform obj4 = ((TMP_Text)descriptionTMP).rectTransform;
			obj4.sizeDelta -= new Vector2(0f, 4f);
			RectTransform obj5 = ((TMP_Text)descriptionTMP).rectTransform;
			((Transform)obj5).localPosition = ((Transform)obj5).localPosition - val;
			sliderBackgroundRectTransform = (RectTransform)((Component)this).transform.Find("SliderBG");
			backgroundFillRectTransform = (RectTransform)((Transform)sliderBackgroundRectTransform).Find("RawImage (2)");
			backgroundOutlineRectTransform = (RectTransform)((Transform)sliderBackgroundRectTransform).Find("RawImage (3)");
			RectTransform obj6 = sliderBackgroundRectTransform;
			((Transform)obj6).localPosition = ((Transform)obj6).localPosition - val;
			RectTransform obj7 = ((TMP_Text)valueTMP).rectTransform;
			((Transform)obj7).localPosition = ((Transform)obj7).localPosition - val;
			Transform parent = ((Transform)((TMP_Text)maskedValueTMP).rectTransform).parent;
			parent.localPosition -= val;
			Transform val2 = ((Component)this).transform.Find("Bar");
			val2.localPosition -= val;
			barRectTransform = (RectTransform)val2.Find("RawImage");
			barRectTransform.pivot = Vector2.zero;
			((Transform)barRectTransform).localPosition = Vector2.op_Implicit(new Vector2(0f, -5f));
			barSizeRectTransform = (RectTransform)((Component)this).transform.Find("BarSize");
			RectTransform obj8 = barSizeRectTransform;
			((Transform)obj8).localPosition = ((Transform)obj8).localPosition - val;
			Vector2 sizeDelta = ((TMP_Text)labelTMP).rectTransform.sizeDelta;
			sizeDelta.y -= 10f;
			((TMP_Text)labelTMP).rectTransform.sizeDelta = sizeDelta;
			Button[] componentsInChildren = ((Component)this).GetComponentsInChildren<Button>();
			Button obj9 = componentsInChildren[0];
			Transform transform = ((Component)obj9).transform;
			transform.localPosition -= val;
			obj9.onClick = new ButtonClickedEvent();
			((UnityEvent)obj9.onClick).AddListener(new UnityAction(Decrement));
			Button obj10 = componentsInChildren[1];
			Transform transform2 = ((Component)obj10).transform;
			transform2.localPosition -= val;
			obj10.onClick = new ButtonClickedEvent();
			((UnityEvent)obj10.onClick).AddListener(new UnityAction(Increment));
			Object.Destroy((Object)(object)((Component)((Transform)sliderBackgroundRectTransform).Find("RawImage (4)")).gameObject);
			Object.Destroy((Object)(object)((Component)((Transform)sliderBackgroundRectTransform).Find("RawImage (5)")).gameObject);
			Object.Destroy((Object)(object)((Component)val2.Find("Extra Bar")).gameObject);
			Object.Destroy((Object)(object)((Component)this).GetComponent<MenuSliderMicrophone>());
			Object.Destroy((Object)(object)((Component)this).GetComponent<MenuSlider>());
		}

		private void Update()
		{
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: 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_0089: Unknown result type (might be due to invalid IL or missing references)
			HandleDescription();
			if (SemiFunc.UIMouseHover(menuPage, barSizeRectTransform, REPOReflection.menuSelectableElement_MenuID.GetValue(menuSelectableElement) as string, 5f, 5f))
			{
				if (!isHovering)
				{
					MenuManager.instance.MenuEffectHover(SemiFunc.MenuGetPitchFromYPos(base.rectTransform), -1f);
				}
				isHovering = true;
				SemiFunc.MenuSelectionBoxTargetSet(menuPage, barSizeRectTransform, new Vector2(-3f, 0f), new Vector2(20f, 10f));
				if (!((Component)barPointerRectTransform).gameObject.activeSelf)
				{
					((Component)barPointerRectTransform).gameObject.SetActive(true);
				}
				HandleHovering();
			}
			else
			{
				isHovering = false;
				if (((Component)barPointerRectTransform).gameObject.activeSelf)
				{
					RectTransform obj = barPointerRectTransform;
					Vector3 localPosition = ((Transform)barPointerRectTransform).localPosition;
					localPosition.x = -1000f;
					((Transform)obj).localPosition = localPosition;
					((Component)barPointerRectTransform).gameObject.SetActive(false);
				}
			}
			if (hasValueChanged)
			{
				value = Mathf.Clamp(value, min, max);
				UpdateBarVisual();
				UpdateBarText();
				onValueChanged(previousValue = value);
			}
		}

		private void HandleDescription()
		{
			//IL_0047: 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)
			if (!(((TMP_Text)descriptionTMP).text == currentDescription))
			{
				bool flag = !string.IsNullOrEmpty(((TMP_Text)descriptionTMP).text);
				backgroundFillRectTransform.sizeDelta = new Vector2(109.8f, flag ? 33f : 15f);
				backgroundOutlineRectTransform.sizeDelta = new Vector2(108f, flag ? 30.6f : 15f);
				if (Object.op_Implicit((Object)(object)base.repoScrollViewElement))
				{
					base.repoScrollViewElement.bottomPadding = (flag ? 25f : 1f);
					base.repoScrollViewElement.onSettingChanged?.Invoke();
				}
				currentDescription = ((TMP_Text)descriptionTMP).text;
			}
		}

		private void HandleHovering()
		{
			//IL_0006: 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_004d: 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_0070: 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_0090: 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_00c2: Unknown result type (might be due to invalid IL or missing references)
			float x = SemiFunc.UIMouseGetLocalPositionWithinRectTransform(barSizeRectTransform).x;
			float num = max - min;
			float num2 = precisionDecimal / num;
			float num3 = Mathf.Round(Mathf.Clamp01(x / barSizeRectTransform.sizeDelta.x) / num2) * num2;
			float x2 = Mathf.Clamp(((Transform)barSizeRectTransform).localPosition.x + num3 * barSizeRectTransform.sizeDelta.x, ((Transform)barSizeRectTransform).localPosition.x, ((Transform)barSizeRectTransform).localPosition.x + barSizeRectTransform.sizeDelta.x) - 2f;
			RectTransform obj = barPointerRectTransform;
			Vector3 localPosition = ((Transform)barPointerRectTransform).localPosition;
			localPosition.x = x2;
			((Transform)obj).localPosition = localPosition;
			if (Input.GetMouseButton(0))
			{
				value = min + num3 * num;
				if (hasValueChanged)
				{
					MenuManager.instance.MenuEffectClick((MenuClickEffectType)4, menuPage, -1f, -1f, false);
				}
			}
		}

		private void UpdateBarVisual()
		{
			//IL_005b: 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)
			float num = barBehavior switch
			{
				BarBehavior.UpdateWithValue => normalizedValue, 
				BarBehavior.StaticAtMinimum => 0f, 
				BarBehavior.StaticAtMaximum => 1f, 
				_ => throw new ArgumentOutOfRangeException(), 
			};
			RectTransform obj = barRectTransform;
			RectTransform obj2 = barMaskRectTransform;
			Vector2 sizeDelta = default(Vector2);
			((Vector2)(ref sizeDelta))..ctor(num * 100f, 10f);
			obj2.sizeDelta = sizeDelta;
			obj.sizeDelta = sizeDelta;
		}

		private void UpdateBarText()
		{
			float num = value;
			if (prefix == null)
			{
				prefix = string.Empty;
			}
			if (postfix == null)
			{
				postfix = string.Empty;
			}
			string text = prefix;
			string[] array = stringOptions;
			text = ((array == null || array.Length == 0) ? (text + num.ToString($"F{precision}", CultureInfo.CurrentCulture)) : (text + (stringOptions.ElementAtOrDefault(Convert.ToInt32(num)) ?? stringOptions.First())));
			TextMeshProUGUI obj = maskedValueTMP;
			string text3 = (((TMP_Text)valueTMP).text = text + postfix);
			((TMP_Text)obj).text = text3;
		}
	}
	public sealed class REPOSpacer : REPOElement
	{
		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_0017: Unknown result type (might be due to invalid IL or missing references)
			base.rectTransform = (RectTransform)((Component)this).transform;
			base.rectTransform.pivot = Vector2.zero;
		}
	}
	public sealed class REPOTextScroller : MonoBehaviour
	{
		public TMP_Text textMeshPro;

		public int maxCharacters;

		public float initialWaitTime = 5f;

		public float startWaitTime = 3f;

		public float endWaitTime = 3f;

		public float scrollingSpeedInSecondsPerCharacter = 0.5f;

		private bool isInitial = true;

		public IEnumerator Animate()
		{
			while (true)
			{
				textMeshPro.firstVisibleCharacter = 0;
				textMeshPro.maxVisibleCharacters = maxCharacters;
				if (isInitial)
				{
					yield return (object)new WaitForSeconds(initialWaitTime);
					isInitial = false;
				}
				else
				{
					yield return (object)new WaitForSeconds(startWaitTime);
				}
				while (textMeshPro.maxVisibleCharacters < textMeshPro.text.Length)
				{
					TMP_Text obj = textMeshPro;
					int firstVisibleCharacter = obj.firstVisibleCharacter;
					obj.firstVisibleCharacter = firstVisibleCharacter + 1;
					TMP_Text obj2 = textMeshPro;
					firstVisibleCharacter = obj2.maxVisibleCharacters;
					obj2.maxVisibleCharacters = firstVisibleCharacter + 1;
					yield return (object)new WaitForSeconds(scrollingSpeedInSecondsPerCharacter);
				}
				yield return (object)new WaitForSeconds(endWaitTime);
			}
		}

		private void Awake()
		{
			if (!Object.op_Implicit((Object)(object)textMeshPro))
			{
				textMeshPro = (TMP_Text)(object)((Component)this).GetComponent<TextMeshProUGUI>();
			}
		}
	}
	public sealed class REPOToggle : REPOElement
	{
		public TextMeshProUGUI labelTMP;

		public TextMeshProUGUI leftButtonTMP;

		public TextMeshProUGUI rightButtonTMP;

		public Action<bool> onToggle;

		private RectTransform optionBox;

		private RectTransform optionBoxBehind;

		private Vector3 targetPosition;

		private Vector3 targetScale;

		public bool state { get; private set; }

		public void SetState(bool newState, bool invokeCallback)
		{
			//IL_001f: 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_0024: 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_003c: 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)
			targetPosition = (newState ? new Vector3(137.8f, 12.3f) : new Vector3(212.644f, 12.3f));
			targetScale = (newState ? new Vector3(73f, 22f, 1f) : new Vector3(74f, 22f, 1f));
			if (invokeCallback && state != newState)
			{
				onToggle?.Invoke(newState);
			}
			state = newState;
		}

		private void Awake()
		{
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Expected O, but got Unknown
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Expected O, but got Unknown
			//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_0062: 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)
			//IL_007a: 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_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_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: 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_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: 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_0123: 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_0143: 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)
			//IL_014f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0159: Expected O, but got Unknown
			//IL_0166: Unknown result type (might be due to invalid IL or missing references)
			//IL_0170: Expected O, but got Unknown
			//IL_0186: Unknown result type (might be due to invalid IL or missing references)
			//IL_018b: Unknown result type (might be due to invalid IL or missing references)
			//IL_018c: 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_01a1: Expected O, but got Unknown
			//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b8: Expected O, but got Unknown
			Transform transform = ((Component)this).transform;
			base.rectTransform = (RectTransform)(object)((transform is RectTransform) ? transform : null);
			labelTMP = ((Component)this).GetComponentInChildren<TextMeshProUGUI>();
			optionBox = (RectTransform)((Component)this).transform.Find("Option Box");
			optionBoxBehind = (RectTransform)((Component)this).transform.Find("Option Box Behind");
			Vector3 val = Vector3.right * 100f;
			Transform obj = ((Component)this).transform.Find("SliderBG");
			obj.localPosition += val;
			RectTransform obj2 = ((TMP_Text)labelTMP).rectTransform;
			obj2.sizeDelta -= new Vector2(0f, 4f);
			RectTransform obj3 = ((TMP_Text)labelTMP).rectTransform;
			((Transform)obj3).localPosition = ((Transform)obj3).localPosition + val;
			Transform obj4 = ((Component)this).transform.Find("RawImage");
			obj4.localPosition += val;
			Transform obj5 = ((Component)this).transform.Find("RawImage (1)");
			obj5.localPosition += val;
			Transform obj6 = ((Component)this).transform.Find("RawImage (2)");
			obj6.localPosition += val;
			Button[] componentsInChildren = ((Component)this).GetComponentsInChildren<Button>();
			Button val2 = componentsInChildren[0];
			Transform transform2 = ((Component)val2).transform;
			transform2.localPosition += val;
			val2.onClick = new ButtonClickedEvent();
			((UnityEvent)val2.onClick).AddListener((UnityAction)delegate
			{
				SetState(newState: true, invokeCallback: true);
			});
			leftButtonTMP = ((Component)val2).GetComponentInChildren<TextMeshProUGUI>();
			Button val3 = componentsInChildren[1];
			Transform transform3 = ((Component)val3).transform;
			transform3.localPosition += val;
			val3.onClick = new ButtonClickedEvent();
			((UnityEvent)val3.onClick).AddListener((UnityAction)delegate
			{
				SetState(newState: false, invokeCallback: true);
			});
			rightButtonTMP = ((Component)val3).GetComponentInChildren<TextMeshProUGUI>();
			Object.Destroy((Object)(object)((Component)this).GetComponent<MenuTwoOptions>());
		}

		private void OnTransformParentChanged()
		{
			MenuButton[] componentsInChildren = ((Component)this).GetComponentsInChildren<MenuButton>();
			foreach (MenuButton obj in componentsInChildren)
			{
				REPOReflection.menuButton_ParentPage.SetValue(obj, ((Component)this).GetComponentInParent<MenuPage>());
			}
		}

		private void Update()
		{
			//IL_0027: 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_003d: 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 resul

Mods/Mimics.dll

Decompiled a year 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.Threading.Tasks;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Photon.Pun;
using Photon.Realtime;
using Photon.Voice;
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("Mimics")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.1.4.0")]
[assembly: AssemblyInformationalVersion("1.1.4")]
[assembly: AssemblyProduct("My first plugin")]
[assembly: AssemblyTitle("Mimics")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.1.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.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace Mimics
{
	public class Mimics : MonoBehaviour
	{
		[CompilerGenerated]
		private sealed class <DestroyAfterDelay>d__33 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public AudioSource audioSource;

			public float delay;

			public Mimics <>4__this;

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

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

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

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

			private bool MoveNext()
			{
				//IL_0027: Unknown result type (might be due to invalid IL or missing references)
				//IL_0031: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = (object)new WaitForSeconds(delay);
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					Object.Destroy((Object)(object)audioSource);
					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 <RecordAtRandomIntervals>d__15 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public Mimics <>4__this;

			private int <clipCount>5__1;

			private float <randomDelay>5__2;

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

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

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

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

			private bool MoveNext()
			{
				//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c3: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					goto IL_00e0;
				case 1:
					<>1__state = -1;
					break;
				case 2:
					{
						<>1__state = -1;
						<>4__this.StartRecording();
						goto IL_00e0;
					}
					IL_00e0:
					<clipCount>5__1 = Directory.GetFiles(<>4__this.audioFolderPath, "*.wav").Length;
					if (<clipCount>5__1 >= <>4__this.maxClipCount)
					{
						<>2__current = <>4__this.ClearAudioFolderAsync().AsCoroutine();
						<>1__state = 1;
						return true;
					}
					break;
				}
				<randomDelay>5__2 = Random.Range(Plugin.configMinDelay.Value, Plugin.configMaxDelay.Value);
				<>2__current = (object)new WaitForSeconds(<randomDelay>5__2);
				<>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();
			}
		}

		[CompilerGenerated]
		private sealed class <WaitForVoiceChat>d__14 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public PlayerAvatar playerAvatar;

			public Mimics <>4__this;

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

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

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

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

			private bool MoveNext()
			{
				//IL_003c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0046: 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
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>4__this.playerVoiceChat = (PlayerVoiceChat)<>4__this.voiceChatField.GetValue(playerAvatar);
					break;
				case 1:
					<>1__state = -1;
					<>4__this.playerVoiceChat = (PlayerVoiceChat)<>4__this.voiceChatField.GetValue(playerAvatar);
					break;
				}
				if ((Object)(object)<>4__this.playerVoiceChat == (Object)null)
				{
					<>2__current = null;
					<>1__state = 1;
					return true;
				}
				log.LogInfo((object)"PlayerVoiceChat successfully initialized.");
				if (<>4__this.photonView.IsMine && SemiFunc.RunIsLevel())
				{
					<>4__this.audioFolderPath = Path.Combine(Application.dataPath, "AudioFiles");
					Directory.CreateDirectory(<>4__this.audioFolderPath);
					((MonoBehaviour)<>4__this).StartCoroutine(<>4__this.RecordAtRandomIntervals());
				}
				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 ManualLogSource log = Logger.CreateLogSource("Mimics");

		public PhotonView photonView;

		private PlayerVoiceChat playerVoiceChat;

		private FieldInfo voiceChatField;

		private int sampleRate = 48000;

		private float[] audioBuffer;

		private int bufferPosition = 0;

		public bool isRecording = false;

		private bool capturingSpeech = false;

		private string audioFolderPath;

		private int maxClipCount = 10;

		private bool fileSaved = false;

		private Dictionary<string, bool> filter;

		private HashSet<int> sentChunks = new HashSet<int>();

		private List<byte[]> receivedChunks = new List<byte[]>();

		private int expectedChunkCount = 0;

		private void Awake()
		{
			photonView = ((Component)this).GetComponent<PhotonView>();
			if ((Object)(object)photonView == (Object)null)
			{
				log.LogError((object)"PhotonView not found on Mimics.");
				return;
			}
			PlayerAvatar component = ((Component)this).GetComponent<PlayerAvatar>();
			if ((Object)(object)component == (Object)null)
			{
				log.LogError((object)"PlayerAvatar not found on Mimics.");
				return;
			}
			voiceChatField = typeof(PlayerAvatar).GetField("voiceChat", BindingFlags.Instance | BindingFlags.NonPublic);
			if (voiceChatField == null)
			{
				log.LogError((object)"Could not find 'voiceChat' field in PlayerAvatar.");
				return;
			}
			if (Plugin.configFilterEnabled.Value)
			{
				filter = new Dictionary<string, bool>();
				SetEnemyFilter();
			}
			else
			{
				log.LogInfo((object)"Filter not enabled. All enemies (custom included) will mimic voices.");
			}
			((MonoBehaviour)this).StartCoroutine(WaitForVoiceChat(component));
		}

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

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

		private void StartRecording()
		{
			if (!isRecording)
			{
				audioBuffer = new float[sampleRate * 3];
				bufferPosition = 0;
				isRecording = true;
				capturingSpeech = false;
				fileSaved = false;
				log.LogInfo((object)"Recording started.");
			}
		}

		public void ProcessVoiceData(short[] voiceData)
		{
			if (!isRecording || !photonView.IsMine)
			{
				return;
			}
			if ((bool)typeof(PlayerVoiceChat).GetField("isTalking", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(playerVoiceChat) && !capturingSpeech)
			{
				capturingSpeech = true;
				bufferPosition = 0;
				log.LogInfo((object)"Speech detected, capturing audio.");
			}
			if (capturingSpeech)
			{
				int num = Mathf.Min(voiceData.Length, audioBuffer.Length - bufferPosition);
				for (int i = 0; i < num; i++)
				{
					audioBuffer[bufferPosition + i] = (float)voiceData[i] / 32768f;
				}
				bufferPosition += num;
				if (bufferPosition >= audioBuffer.Length && !fileSaved)
				{
					isRecording = false;
					capturingSpeech = false;
					fileSaved = true;
					log.LogInfo((object)"Buffer full, saving audio.");
					SaveAudioToFileAsync(audioBuffer);
				}
			}
		}

		private async Task SaveAudioToFileAsync(float[] audioData)
		{
			string filePath = Path.Combine(audioFolderPath, $"audio_{Guid.NewGuid()}.wav");
			byte[] audioBytes = ConvertFloatArrayToByteArray(audioData);
			using (FileStream fileStream = new FileStream(filePath, FileMode.Create, FileAccess.Write))
			{
				using BinaryWriter writer = new BinaryWriter(fileStream);
				WriteWavHeader(writer, audioData.Length, sampleRate);
				writer.Write(audioBytes);
			}
			log.LogInfo((object)("Audio saved to: " + filePath));
			await PlayRandomAudioFile();
		}

		private void WriteWavHeader(BinaryWriter writer, int sampleCount, int sampleRate)
		{
			writer.Write("RIFF".ToCharArray());
			writer.Write(36 + sampleCount * 2);
			writer.Write("WAVE".ToCharArray());
			writer.Write("fmt ".ToCharArray());
			writer.Write(16);
			writer.Write((short)1);
			writer.Write((short)1);
			writer.Write(sampleRate);
			writer.Write(sampleRate * 2);
			writer.Write((short)2);
			writer.Write((short)16);
			writer.Write("data".ToCharArray());
			writer.Write(sampleCount * 2);
		}

		private byte[] ConvertFloatArrayToByteArray(float[] audioData)
		{
			byte[] array = new byte[audioData.Length * 2];
			for (int i = 0; i < audioData.Length; i++)
			{
				short value = (short)(audioData[i] * 32767f);
				BitConverter.GetBytes(value).CopyTo(array, i * 2);
			}
			return array;
		}

		private async Task PlayRandomAudioFile()
		{
			string[] files = Directory.GetFiles(audioFolderPath, "*.wav");
			if (files.Length != 0)
			{
				string selectedFile = files[Random.Range(0, files.Length)];
				await SendAudioInChunksAsync(await File.ReadAllBytesAsync(selectedFile));
			}
		}

		private async Task SendAudioInChunksAsync(byte[] audioData)
		{
			List<byte[]> chunks = ChunkAudioData(audioData, 8192);
			sentChunks.Clear();
			for (int i = 0; i < chunks.Count; i++)
			{
				if (!PhotonNetwork.IsConnectedAndReady)
				{
					log.LogWarning((object)"Photon disconnected, aborting send.");
					return;
				}
				photonView.RPC("ReceiveAudioChunk", (RpcTarget)0, new object[3]
				{
					chunks[i],
					i,
					chunks.Count
				});
				sentChunks.Add(i);
				await Task.Delay(125);
			}
			log.LogInfo((object)"All chunks sent.");
		}

		[PunRPC]
		public void ReceiveAudioChunk(byte[] chunk, int chunkIndex, int totalChunks)
		{
			if (chunkIndex == 0)
			{
				receivedChunks.Clear();
				expectedChunkCount = totalChunks;
				log.LogInfo((object)$"New audio transmission started, expecting {totalChunks} chunks.");
			}
			if (chunkIndex >= expectedChunkCount)
			{
				log.LogWarning((object)$"Received chunk index {chunkIndex} exceeds expected {expectedChunkCount}.");
				return;
			}
			if (chunkIndex >= receivedChunks.Count)
			{
				receivedChunks.AddRange(Enumerable.Repeat<byte[]>(null, chunkIndex - receivedChunks.Count + 1));
			}
			receivedChunks[chunkIndex] = chunk;
			if (receivedChunks.Count >= expectedChunkCount && receivedChunks.All((byte[] c) => c != null))
			{
				log.LogInfo((object)"All chunks received, playing audio.");
				byte[] audioData = CombineChunks(receivedChunks);
				PlayReceivedAudio(audioData);
				receivedChunks.Clear();
				expectedChunkCount = 0;
			}
		}

		private byte[] CombineChunks(List<byte[]> chunks)
		{
			int num = chunks.Sum((byte[] chunk) => chunk.Length);
			byte[] array = new byte[num];
			int num2 = 0;
			foreach (byte[] chunk in chunks)
			{
				Array.Copy(chunk, 0, array, num2, chunk.Length);
				num2 += chunk.Length;
			}
			return array;
		}

		private void PlayReceivedAudio(byte[] audioData)
		{
			float[] array = ConvertByteArrayToFloatArray(audioData);
			AudioClip val = AudioClip.Create("ReceivedClip", array.Length, 1, sampleRate, false);
			val.SetData(array, 0);
			foreach (GameObject item in from e in GetEnemiesList()
				where (Object)(object)e != (Object)null && !((Object)e).name.Contains("Gnome")
				select e)
			{
				if (Plugin.configFilterEnabled.Value)
				{
					string text = ((Object)item).name.Replace("(Clone)", "");
					if (!filter.TryGetValue(text, out var value) || !value)
					{
						log.LogInfo((object)("Skipped " + text + ": disabled in config"));
						continue;
					}
				}
				Transform obj = item.transform.Find("Enable/Controller");
				GameObject val2 = ((obj != null) ? ((Component)obj).gameObject : null);
				if (!((Object)(object)val2 == (Object)null))
				{
					AudioSource val3 = val2.GetComponent<AudioSource>() ?? val2.AddComponent<AudioSource>();
					val3.clip = val;
					val3.volume = 1f;
					val3.spatialBlend = 1f;
					val3.dopplerLevel = 0.5f;
					val3.minDistance = 1f;
					val3.maxDistance = 20f;
					val3.rolloffMode = (AudioRolloffMode)1;
					val3.outputAudioMixerGroup = playerVoiceChat.mixerMicrophoneSound;
					val3.Play();
					((MonoBehaviour)this).StartCoroutine(DestroyAfterDelay(val3, val.length + 0.1f));
				}
			}
		}

		private void SetEnemyFilter()
		{
			filter.Clear();
			if (filter == null)
			{
				log.LogError((object)"Enemy filter is null");
			}
			filter.Add("Enemy - Animal", Plugin.configAnimal.Value);
			filter.Add("Enemy - Bang", Plugin.configBang.Value);
			filter.Add("Enemy - Beamer", Plugin.configBeamer.Value);
			filter.Add("Enemy - Bowtie", Plugin.configBowtie.Value);
			filter.Add("Enemy - Ceiling Eye", Plugin.configCeilingEye.Value);
			filter.Add("Enemy - Tumbler", Plugin.configTumbler.Value);
			filter.Add("Enemy - Duck", Plugin.configDuck.Value);
			filter.Add("Enemy - Floater", Plugin.configFloater.Value);
			filter.Add("Enemy - Gnome", Plugin.configGnome.Value);
			filter.Add("Enemy - Head", Plugin.configHead.Value);
			filter.Add("Enemy - Hidden", Plugin.configHidden.Value);
			filter.Add("Enemy - Hunter", Plugin.configHunter.Value);
			filter.Add("Enemy - Robe", Plugin.configRobe.Value);
			filter.Add("Enemy - Slow Mouth", Plugin.configSlowMouth.Value);
			filter.Add("Enemy - Slow Walker", Plugin.configSlowWalker.Value);
			filter.Add("Enemy - Thin Man", Plugin.configThinMan.Value);
			filter.Add("Enemy - Upscream", Plugin.configUpscream.Value);
			filter.Add("Enemy - Valuable Thrower", Plugin.configValuableThrower.Value);
			filter.Add("Enemy - Runner", Plugin.configRunner.Value);
			log.LogInfo((object)"Config loaded and filter set.");
		}

		private List<GameObject> GetEnemiesList()
		{
			GameObject obj = GameObject.Find("Level Generator");
			Transform val = ((obj != null) ? obj.transform.Find("Enemies") : null);
			return ((Object)(object)val != (Object)null) ? (from Transform t in (IEnumerable)val
				select ((Component)t).gameObject).ToList() : new List<GameObject>();
		}

		private float[] ConvertByteArrayToFloatArray(byte[] byteArray)
		{
			int num = (int)((float)sampleRate * 0.5f);
			int num2 = byteArray.Length / 2;
			int num3 = (int)((float)sampleRate * 0.02f);
			float[] array = new float[num2 + 2 * num];
			for (int i = 0; i < num; i++)
			{
				array[i] = 0f;
			}
			for (int j = 0; j < num2; j++)
			{
				float num4 = (float)BitConverter.ToInt16(byteArray, j * 2) / 32768f;
				float num5 = 1f;
				if (j < num3)
				{
					num5 = (float)j / (float)num3;
				}
				else if (j >= num2 - num3)
				{
					num5 = (float)(num2 - j) / (float)num3;
				}
				array[j + num] = num4 * num5;
			}
			for (int k = num2 + num; k < array.Length; k++)
			{
				array[k] = 0f;
			}
			return array;
		}

		private async Task ClearAudioFolderAsync()
		{
			string[] files = Directory.GetFiles(audioFolderPath, "*.wav");
			foreach (string file in files)
			{
				await Task.Run(delegate
				{
					File.Delete(file);
				});
			}
			log.LogInfo((object)"Audio folder cleared.");
		}

		[IteratorStateMachine(typeof(<DestroyAfterDelay>d__33))]
		private IEnumerator DestroyAfterDelay(AudioSource audioSource, float delay)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <DestroyAfterDelay>d__33(0)
			{
				<>4__this = this,
				audioSource = audioSource,
				delay = delay
			};
		}

		private List<byte[]> ChunkAudioData(byte[] audioData, int chunkSize)
		{
			List<byte[]> list = new List<byte[]>();
			for (int i = 0; i < audioData.Length; i += chunkSize)
			{
				int num = Mathf.Min(chunkSize, audioData.Length - i);
				byte[] array = new byte[num];
				Array.Copy(audioData, i, array, 0, num);
				list.Add(array);
			}
			return list;
		}
	}
	public static class TaskExtensions
	{
		[CompilerGenerated]
		private sealed class <AsCoroutine>d__0 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public Task task;

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

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

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

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

			private bool MoveNext()
			{
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					break;
				case 1:
					<>1__state = -1;
					break;
				}
				if (!task.IsCompleted)
				{
					<>2__current = null;
					<>1__state = 1;
					return true;
				}
				if (task.Exception != null)
				{
					throw task.Exception;
				}
				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();
			}
		}

		[IteratorStateMachine(typeof(<AsCoroutine>d__0))]
		public static IEnumerator AsCoroutine(this Task task)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <AsCoroutine>d__0(0)
			{
				task = task
			};
		}
	}
	[BepInPlugin("Mimics", "Mimics", "1.1.4")]
	public class Plugin : BaseUnityPlugin
	{
		internal static ManualLogSource Logger;

		private static Harmony _harmony;

		public static ConfigEntry<float> configMinDelay;

		public static ConfigEntry<float> configMaxDelay;

		public static ConfigEntry<bool> configFilterEnabled;

		public static ConfigEntry<bool> configAnimal;

		public static ConfigEntry<bool> configBang;

		public static ConfigEntry<bool> configBeamer;

		public static ConfigEntry<bool> configBowtie;

		public static ConfigEntry<bool> configCeilingEye;

		public static ConfigEntry<bool> configDuck;

		public static ConfigEntry<bool> configFloater;

		public static ConfigEntry<bool> configGnome;

		public static ConfigEntry<bool> configHead;

		public static ConfigEntry<bool> configHidden;

		public static ConfigEntry<bool> configHunter;

		public static ConfigEntry<bool> configRobe;

		public static ConfigEntry<bool> configRunner;

		public static ConfigEntry<bool> configSlowMouth;

		public static ConfigEntry<bool> configSlowWalker;

		public static ConfigEntry<bool> configThinMan;

		public static ConfigEntry<bool> configTumbler;

		public static ConfigEntry<bool> configUpscream;

		public static ConfigEntry<bool> configValuableThrower;

		private void Awake()
		{
			//IL_02e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f3: Expected O, but got Unknown
			Logger = ((BaseUnityPlugin)this).Logger;
			Logger.LogInfo((object)"Plugin Mimics is loaded!");
			configMinDelay = ((BaseUnityPlugin)this).Config.Bind<float>("General", "MinDelay", 30f, "Minimum time before an audio clip is recorded and played.");
			configMaxDelay = ((BaseUnityPlugin)this).Config.Bind<float>("General", "MaxDelay", 120f, "Maximum time before an audio clip is recorded and played.");
			configFilterEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Filter", "Filter Enabled?", false, "Turning this on allows you to customize which enemies can mimic voices. (Keep as 'false' if you want to allow custom enemies to mimic voices)");
			configAnimal = ((BaseUnityPlugin)this).Config.Bind<bool>("Enemies", "Animal", true, "Enables/disables ability to mimic player voices.");
			configBang = ((BaseUnityPlugin)this).Config.Bind<bool>("Enemies", "Banger", true, "Enables/disables ability to mimic player voices.");
			configBeamer = ((BaseUnityPlugin)this).Config.Bind<bool>("Enemies", "Beamer", true, "Enables/disables ability to mimic player voices.");
			configBowtie = ((BaseUnityPlugin)this).Config.Bind<bool>("Enemies", "Bowtie", true, "Enables/disables ability to mimic player voices.");
			configCeilingEye = ((BaseUnityPlugin)this).Config.Bind<bool>("Enemies", "Ceiling Eye", true, "Enables/disables ability to mimic player voices.");
			configTumbler = ((BaseUnityPlugin)this).Config.Bind<bool>("Enemies", "Chef", true, "Enables/disables ability to mimic player voices.");
			configDuck = ((BaseUnityPlugin)this).Config.Bind<bool>("Enemies", "Duck", true, "Enables/disables ability to mimic player voices.");
			configFloater = ((BaseUnityPlugin)this).Config.Bind<bool>("Enemies", "Mentalist", true, "Enables/disables ability to mimic player voices.");
			configGnome = ((BaseUnityPlugin)this).Config.Bind<bool>("Enemies", "Gnome", true, "Enables/disables ability to mimic player voices.");
			configHead = ((BaseUnityPlugin)this).Config.Bind<bool>("Enemies", "Headman", true, "Enables/disables ability to mimic player voices.");
			configHidden = ((BaseUnityPlugin)this).Config.Bind<bool>("Enemies", "Hidden", true, "Enables/disables ability to mimic player voices.");
			configHunter = ((BaseUnityPlugin)this).Config.Bind<bool>("Enemies", "Huntsman", true, "Enables/disables ability to mimic player voices.");
			configRobe = ((BaseUnityPlugin)this).Config.Bind<bool>("Enemies", "Robe", true, "Enables/disables ability to mimic player voices.");
			configSlowMouth = ((BaseUnityPlugin)this).Config.Bind<bool>("Enemies", "Spewer", true, "Enables/disables ability to mimic player voices.");
			configSlowWalker = ((BaseUnityPlugin)this).Config.Bind<bool>("Enemies", "Trudge", true, "Enables/disables ability to mimic player voices.");
			configThinMan = ((BaseUnityPlugin)this).Config.Bind<bool>("Enemies", "Shadow Child", true, "Enables/disables ability to mimic player voices.");
			configUpscream = ((BaseUnityPlugin)this).Config.Bind<bool>("Enemies", "Upscream", true, "Enables/disables ability to mimic player voices.");
			configValuableThrower = ((BaseUnityPlugin)this).Config.Bind<bool>("Enemies", "Rugrat", true, "Enables/disables ability to mimic player voices.");
			configRunner = ((BaseUnityPlugin)this).Config.Bind<bool>("Enemies", "Runner", true, "Enables/disables ability to mimic player voices.");
			_harmony = new Harmony("Mimics");
			_harmony.PatchAll();
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "Mimics";

		public const string PLUGIN_NAME = "My first plugin";

		public const string PLUGIN_VERSION = "1.1.4";
	}
}
namespace Mimics.patches
{
	public class MimicsFinder : MonoBehaviour
	{
		private static MimicsFinder instance;

		private static readonly ManualLogSource log = Logger.CreateLogSource("Mimics");

		public static Mimics LocalMimics { get; set; }

		public static void EnsureInitialized()
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)instance == (Object)null)
			{
				instance = new GameObject("MimicsFinder").AddComponent<MimicsFinder>();
				Object.DontDestroyOnLoad((Object)(object)((Component)instance).gameObject);
				ManualLogSource obj = log;
				Player localPlayer = PhotonNetwork.LocalPlayer;
				obj.LogInfo((object)$"MimicsFinder initialized for Player {((localPlayer != null) ? localPlayer.ActorNumber : (-1))}");
			}
		}

		private void OnDestroy()
		{
			if ((Object)(object)instance == (Object)(object)this)
			{
				LocalMimics = null;
				instance = null;
				log.LogInfo((object)"MimicsFinder destroyed, clearing cache.");
			}
		}
	}
	[HarmonyPatch(typeof(PlayerAvatar), "Awake")]
	internal class PlayerAvatarPatch
	{
		private static readonly ManualLogSource log = Logger.CreateLogSource("Mimics");

		private static void Postfix(PlayerAvatar __instance)
		{
			if (PhotonNetwork.IsConnectedAndReady)
			{
				Mimics mimics = ((Component)__instance).GetComponent<Mimics>();
				if ((Object)(object)mimics == (Object)null)
				{
					mimics = ((Component)__instance).gameObject.AddComponent<Mimics>();
					log.LogInfo((object)("Added Mimics component to PlayerAvatar: " + ((Object)__instance).name));
				}
				PhotonView component = ((Component)__instance).GetComponent<PhotonView>();
				if ((Object)(object)component != (Object)null && component.IsMine)
				{
					MimicsFinder.LocalMimics = mimics;
					log.LogInfo((object)("Set LocalMimics for local PlayerAvatar: " + ((Object)__instance).name));
				}
			}
		}
	}
	[HarmonyPatch(typeof(LocalVoiceFramed<short>), "PushDataAsync")]
	internal class LocalVoiceFramedPatch
	{
		private static void Prefix(short[] buf)
		{
			MimicsFinder.EnsureInitialized();
			if (PhotonNetwork.IsConnectedAndReady && !((Object)(object)MimicsFinder.LocalMimics == (Object)null) && !((Object)(object)((Component)MimicsFinder.LocalMimics).gameObject == (Object)null) && MimicsFinder.LocalMimics.photonView.IsMine)
			{
				MimicsFinder.LocalMimics.ProcessVoiceData(buf);
			}
		}
	}
}

Mods/MoreHead.dll

Decompiled a year 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 BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using MenuLib;
using MenuLib.MonoBehaviors;
using MenuLib.Structs;
using Microsoft.CodeAnalysis;
using MoreHead;
using Newtonsoft.Json;
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 = "")]
[assembly: AssemblyCompany("YMC_MHZ")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyCopyright("Copyright © 2025")]
[assembly: AssemblyDescription("一个简单好玩的装饰模组,提供unitypackage,供玩家自行导入模型。")]
[assembly: AssemblyFileVersion("1.3.5.0")]
[assembly: AssemblyInformationalVersion("1.3.5+705124b9dd11b657260ac87da796bc7af91b42a9")]
[assembly: AssemblyProduct("MoreHead")]
[assembly: AssemblyTitle("MoreHead")]
[assembly: AssemblyVersion("1.3.5.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.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;
		}
	}
}
[BepInPlugin("Mhz.REPOMoreHead", "MoreHead", "1.3.5")]
public class Morehead : BaseUnityPlugin
{
	private const string PluginGuid = "Mhz.REPOMoreHead";

	private const string PluginName = "MoreHead";

	private const string PluginVersion = "1.3.5";

	public static ManualLogSource? Logger;

	public static Morehead? Instance { get; private set; }

	public static string GetPluginVersion()
	{
		return "1.3.5";
	}

	private void Awake()
	{
		//IL_0019: Unknown result type (might be due to invalid IL or missing references)
		//IL_001f: Expected O, but got Unknown
		Instance = this;
		Logger = ((BaseUnityPlugin)this).Logger;
		try
		{
			Harmony val = new Harmony("Mhz.REPOMoreHead");
			val.PatchAll(typeof(PlayerAvatarVisualsPatch));
			val.PatchAll(typeof(PlayerUpdatePatch));
			val.PatchAll(typeof(PlayerAvatarAwakePatch));
			val.PatchAll(typeof(GameDirectorUpdatePatch));
			val.PatchAll(typeof(PlayerRevivePatch));
			val.PatchAll(typeof(MenuManagerStartPatch));
			val.PatchAll(typeof(MenuButtonHoveringPatch));
			val.PatchAll(typeof(MenuButtonHoverEndPatch));
			val.PatchAll(typeof(MenuPageStateSetPatch));
			string text = "\n\n ███▄ ▄███▓ ▒█████   ██▀███  ▓█████  ██░ ██ ▓█████ ▄▄▄      ▓█████▄ \n▓██▒▀█▀ ██▒▒██▒  ██▒▓██ ▒ ██▒▓█   ▀ ▓██░ ██▒▓█   ▀▒████▄    ▒██▀ ██▌\n▓██    ▓██░▒██░  ██▒▓██ ░▄█ ▒▒███   ▒██▀███░▒███  ▒██  ▀█▄  ░██   █▌\n▒██    ▒██ ▒██   ██░▒███▀█▄  ▒▓█  ▄ ░▓█ ░██ ▒▓█  ▄░██▄▄▄▄██ ░▓█▄   ▌\n▒██▒   ░██▒░ ████▓▒░░██▓ ▒██▒░▒████▒░▓█▒░██▓░▒████▒▓█   ▓██▒░▒████▓   v1.3.5\n░ ▒░   ░  ░░ ▒░▒░▒░ ░ ▒▓ ░▒▓░░░ ▒░ ░ ▒ ░░▒░▒░░ ▒░ ░▒▒   ▓▒█░ ▒▒▓  ▒ \n░  ░      ░  ░ ▒ ▒░   ░▒ ░ ▒░ ░ ░  ░ ▒ ░▒░ ░ ░ ░  ░ ▒   ▒▒ ░ ░ ▒  ▒ \n░      ░   ░ ░ ░ ▒    ░░   ░    ░    ░  ░░ ░   ░    ░   ▒    ░ ░  ░ \n       ░       ░ ░     ░        ░  ░ ░  ░  ░   ░  ░     ░  ░   ░    \n";
			ManualLogSource? logger = Logger;
			if (logger != null)
			{
				logger.LogMessage((object)text);
			}
			HeadDecorationManager.Initialize();
			ConfigManager.Initialize();
		}
		catch (Exception ex)
		{
			ManualLogSource? logger2 = Logger;
			if (logger2 != null)
			{
				logger2.LogError((object)("Harmony补丁应用失败: " + ex.Message));
			}
		}
	}

	private void OnApplicationQuit()
	{
		ConfigManager.SaveConfig();
	}

	public static bool GetDecorationState(string? name)
	{
		return HeadDecorationManager.GetDecorationState(name);
	}
}
[HarmonyPatch(typeof(MenuManager))]
[HarmonyPatch("Start")]
internal class MenuManagerStartPatch
{
	[HarmonyPostfix]
	private static void Postfix()
	{
		try
		{
			if ((Object)(object)MenuManager.instance != (Object)null && MenuManager.instance.menuPages != null && MenuManager.instance.menuPages.Count > 0)
			{
				ManualLogSource? logger = Morehead.Logger;
				if (logger != null)
				{
					logger.LogInfo((object)"MenuManager已初始化,正在初始化MoreHeadUI...");
				}
				MoreHeadUI.Initialize();
			}
			else
			{
				ManualLogSource? logger2 = Morehead.Logger;
				if (logger2 != null)
				{
					logger2.LogWarning((object)"MenuManager未准备好,无法初始化UI");
				}
			}
		}
		catch (Exception arg)
		{
			ManualLogSource? logger3 = Morehead.Logger;
			if (logger3 != null)
			{
				logger3.LogError((object)$"在MenuManager.Start补丁中初始化UI时出错: {arg}");
			}
		}
	}
}
[HarmonyPatch(typeof(PlayerAvatar))]
[HarmonyPatch("Update")]
internal class PlayerUpdatePatch
{
	private static void Postfix(PlayerAvatar __instance)
	{
		if (__instance.photonView.IsMine && GameManager.Multiplayer() && PhotonNetwork.LocalPlayer != null)
		{
		}
	}

	public static void UpdatePlayerDecorations(PlayerAvatar playerAvatar)
	{
		try
		{
			if ((Object)(object)playerAvatar?.playerAvatarVisuals == (Object)null)
			{
				return;
			}
			Dictionary<string, Transform> decorationParentNodes = DecorationUtils.GetDecorationParentNodes(((Component)playerAvatar.playerAvatarVisuals).transform);
			if (decorationParentNodes.Count == 0)
			{
				ManualLogSource? logger = Morehead.Logger;
				if (logger != null)
				{
					logger.LogWarning((object)"找不到任何装饰物父级节点");
				}
				return;
			}
			DecorationUtils.EnsureDecorationContainers(decorationParentNodes);
			foreach (DecorationInfo decoration in HeadDecorationManager.Decorations)
			{
				if (decorationParentNodes.TryGetValue(decoration.ParentTag ?? string.Empty, out var value))
				{
					Transform val = value.Find("HeadDecorations");
					if ((Object)(object)val != (Object)null)
					{
						DecorationUtils.UpdateDecoration(val, decoration.Name ?? string.Empty, decoration.IsVisible);
					}
				}
				else
				{
					ManualLogSource? logger2 = Morehead.Logger;
					if (logger2 != null)
					{
						logger2.LogWarning((object)("找不到装饰物 " + decoration.DisplayName + " 的父级节点: " + decoration.ParentTag));
					}
				}
			}
		}
		catch (Exception ex)
		{
			ManualLogSource? logger3 = Morehead.Logger;
			if (logger3 != null)
			{
				logger3.LogError((object)("更新玩家装饰物时出错: " + ex.Message));
			}
		}
	}

	public static void UpdateMenuPlayerDecorations()
	{
		try
		{
			PlayerAvatarVisuals val = FindMenuPlayerVisuals();
			if ((Object)(object)val == (Object)null)
			{
				return;
			}
			Dictionary<string, Transform> decorationParentNodes = DecorationUtils.GetDecorationParentNodes(((Component)val).transform);
			if (decorationParentNodes.Count == 0)
			{
				ManualLogSource? logger = Morehead.Logger;
				if (logger != null)
				{
					logger.LogWarning((object)"找不到任何菜单角色装饰物父级节点");
				}
				return;
			}
			DecorationUtils.EnsureDecorationContainers(decorationParentNodes);
			foreach (DecorationInfo decoration in HeadDecorationManager.Decorations)
			{
				if (decorationParentNodes.TryGetValue(decoration.ParentTag ?? string.Empty, out var value))
				{
					Transform val2 = value.Find("HeadDecorations");
					if ((Object)(object)val2 != (Object)null)
					{
						Transform val3 = val2.Find(decoration.Name);
						if ((Object)(object)val3 == (Object)null)
						{
							AddMenuDecoration(val2, decoration.Name);
						}
						else
						{
							DecorationUtils.UpdateDecoration(val2, decoration.Name ?? string.Empty, decoration.IsVisible);
						}
					}
				}
				else
				{
					ManualLogSource? logger2 = Morehead.Logger;
					if (logger2 != null)
					{
						logger2.LogWarning((object)("找不到菜单角色装饰物 " + decoration.DisplayName + " 的父级节点: " + decoration.ParentTag));
					}
				}
			}
		}
		catch (Exception ex)
		{
			ManualLogSource? logger3 = Morehead.Logger;
			if (logger3 != null)
			{
				logger3.LogError((object)("更新菜单角色装饰物状态失败: " + ex.Message));
			}
		}
	}

	private static PlayerAvatarVisuals? FindMenuPlayerVisuals()
	{
		if ((Object)(object)PlayerAvatarMenu.instance == (Object)null)
		{
			return null;
		}
		return ((Component)PlayerAvatarMenu.instance).GetComponentInChildren<PlayerAvatarVisuals>();
	}

	public static void AddMenuDecoration(Transform parent, string? decorationName)
	{
		string decorationName2 = decorationName;
		try
		{
			Transform val = parent.Find(decorationName2);
			if ((Object)(object)val != (Object)null)
			{
				bool decorationState = Morehead.GetDecorationState(decorationName2);
				((Component)val).gameObject.SetActive(decorationState);
				return;
			}
			DecorationInfo decorationInfo = HeadDecorationManager.Decorations.Find((DecorationInfo d) => d.Name != null && d.Name.Equals(decorationName2, StringComparison.OrdinalIgnoreCase));
			if (decorationInfo != null && (Object)(object)decorationInfo.Prefab != (Object)null)
			{
				GameObject val2 = Object.Instantiate<GameObject>(decorationInfo.Prefab, parent);
				((Object)val2).name = decorationName2;
				val2.SetActive(decorationInfo.IsVisible);
				return;
			}
			ManualLogSource? logger = Morehead.Logger;
			if (logger != null)
			{
				logger.LogWarning((object)("AddMenuDecoration: 找不到装饰物 " + decorationName2 + " 或其预制体为空"));
			}
		}
		catch (Exception ex)
		{
			ManualLogSource? logger2 = Morehead.Logger;
			if (logger2 != null)
			{
				logger2.LogError((object)("为菜单角色添加装饰物时出错: " + ex.Message));
			}
		}
	}
}
[HarmonyPatch(typeof(PlayerAvatar))]
[HarmonyPatch("Awake")]
internal class PlayerAvatarAwakePatch
{
	private static void Postfix(PlayerAvatar __instance)
	{
		((Component)__instance).gameObject.AddComponent<HeadDecorationSync>();
	}
}
public class HeadDecorationSync : MonoBehaviourPun
{
	public void SyncAllDecorations()
	{
		try
		{
			string[] array = new string[HeadDecorationManager.Decorations.Count];
			bool[] array2 = new bool[HeadDecorationManager.Decorations.Count];
			string[] array3 = new string[HeadDecorationManager.Decorations.Count];
			for (int i = 0; i < HeadDecorationManager.Decorations.Count; i++)
			{
				DecorationInfo decorationInfo = HeadDecorationManager.Decorations[i];
				array[i] = decorationInfo.Name;
				array2[i] = decorationInfo.IsVisible;
				array3[i] = decorationInfo.ParentTag;
			}
			((MonoBehaviourPun)this).photonView.RPC("UpdateAllDecorations", (RpcTarget)1, new object[3] { array, array2, array3 });
		}
		catch (Exception ex)
		{
			ManualLogSource? logger = Morehead.Logger;
			if (logger != null)
			{
				logger.LogError((object)("同步所有装饰物状态失败: " + ex.Message));
			}
		}
	}

	[PunRPC]
	private void UpdateAllDecorations(string[] names, bool[] states, string[] parentTags)
	{
		try
		{
			PlayerAvatar component = ((Component)this).GetComponent<PlayerAvatar>();
			if ((Object)(object)component == (Object)null || (Object)(object)component.playerAvatarVisuals == (Object)null)
			{
				ManualLogSource? logger = Morehead.Logger;
				if (logger != null)
				{
					logger.LogWarning((object)"找不到PlayerAvatar或PlayerAvatarVisuals组件");
				}
				return;
			}
			Dictionary<string, Transform> decorationParentNodes = DecorationUtils.GetDecorationParentNodes(((Component)component.playerAvatarVisuals).transform);
			if (decorationParentNodes.Count == 0)
			{
				ManualLogSource? logger2 = Morehead.Logger;
				if (logger2 != null)
				{
					logger2.LogWarning((object)"找不到任何装饰物父级节点");
				}
				return;
			}
			DecorationUtils.EnsureDecorationContainers(decorationParentNodes);
			for (int i = 0; i < names.Length; i++)
			{
				string decorationName = names[i];
				bool showDecoration = states[i];
				string key = parentTags[i];
				if (decorationParentNodes.TryGetValue(key, out var value))
				{
					Transform val = value.Find("HeadDecorations");
					if ((Object)(object)val != (Object)null)
					{
						DecorationUtils.UpdateDecoration(val, decorationName, showDecoration);
					}
				}
			}
		}
		catch (Exception ex)
		{
			ManualLogSource? logger3 = Morehead.Logger;
			if (logger3 != null)
			{
				logger3.LogError((object)("RPC更新所有装饰物状态失败: " + ex.Message));
			}
		}
	}
}
[HarmonyPatch(typeof(PlayerAvatarVisuals))]
[HarmonyPatch("Start")]
internal class PlayerAvatarVisualsPatch
{
	private static void Postfix(PlayerAvatarVisuals __instance)
	{
		try
		{
			Dictionary<string, Transform> decorationParentNodes = DecorationUtils.GetDecorationParentNodes(((Component)__instance).transform);
			if (decorationParentNodes.Count == 0)
			{
				ManualLogSource? logger = Morehead.Logger;
				if (logger != null)
				{
					logger.LogWarning((object)$"找不到任何装饰物父级节点 (isMenuAvatar: {__instance.isMenuAvatar})");
				}
				return;
			}
			DecorationUtils.EnsureDecorationContainers(decorationParentNodes);
			if (__instance.isMenuAvatar)
			{
				foreach (KeyValuePair<string, Transform> item in decorationParentNodes)
				{
					string key = item.Key;
					Transform value = item.Value;
					Transform val = value.Find("HeadDecorations");
					if ((Object)(object)val != (Object)null)
					{
						foreach (DecorationInfo decoration in HeadDecorationManager.Decorations)
						{
							if (decoration.ParentTag == key)
							{
								PlayerUpdatePatch.AddMenuDecoration(val, decoration.Name);
							}
						}
					}
				}
				return;
			}
			foreach (DecorationInfo decoration2 in HeadDecorationManager.Decorations)
			{
				if (decorationParentNodes.TryGetValue(decoration2.ParentTag ?? string.Empty, out var value2))
				{
					Transform val2 = value2.Find("HeadDecorations");
					if ((Object)(object)val2 != (Object)null)
					{
						AddNewDecoration(val2, decoration2, __instance);
					}
				}
				else
				{
					ManualLogSource? logger2 = Morehead.Logger;
					if (logger2 != null)
					{
						logger2.LogWarning((object)("初始化时找不到装饰物 " + decoration2.DisplayName + " 的父级节点: " + decoration2.ParentTag));
					}
				}
			}
			if (!GameManager.Multiplayer() || !((Object)(object)__instance.playerAvatar != (Object)null) || !((Object)(object)__instance.playerAvatar.photonView != (Object)null) || !__instance.playerAvatar.photonView.IsMine)
			{
				return;
			}
			try
			{
				HeadDecorationSync component = ((Component)__instance.playerAvatar).GetComponent<HeadDecorationSync>();
				if ((Object)(object)component != (Object)null)
				{
					component.SyncAllDecorations();
					return;
				}
				ManualLogSource? logger3 = Morehead.Logger;
				if (logger3 != null)
				{
					logger3.LogWarning((object)"找不到HeadDecorationSync组件,无法同步初始状态");
				}
			}
			catch (Exception ex)
			{
				ManualLogSource? logger4 = Morehead.Logger;
				if (logger4 != null)
				{
					logger4.LogError((object)("同步初始装饰物状态失败: " + ex.Message));
				}
			}
		}
		catch (Exception ex2)
		{
			ManualLogSource? logger5 = Morehead.Logger;
			if (logger5 != null)
			{
				logger5.LogError((object)$"添加装饰物失败: {ex2.Message} (isMenuAvatar: {__instance.isMenuAvatar})");
			}
		}
	}

	private static void AddNewDecoration(Transform parent, DecorationInfo decoration, PlayerAvatarVisuals __instance)
	{
		Transform val = parent.Find(decoration.Name);
		if ((Object)(object)val != (Object)null)
		{
			((Component)val).gameObject.SetActive(decoration.IsVisible);
			return;
		}
		if ((Object)(object)decoration.Prefab != (Object)null)
		{
			try
			{
				GameObject val2 = Object.Instantiate<GameObject>(decoration.Prefab, parent);
				((Object)val2).name = decoration.Name;
				val2.SetActive(decoration.IsVisible);
				return;
			}
			catch (Exception ex)
			{
				ManualLogSource? logger = Morehead.Logger;
				if (logger != null)
				{
					logger.LogError((object)("实例化预制体时出错: " + ex.Message));
				}
				return;
			}
		}
		ManualLogSource? logger2 = Morehead.Logger;
		if (logger2 != null)
		{
			logger2.LogWarning((object)("AddNewDecoration: 装饰物 " + decoration.DisplayName + " 的预制体为空"));
		}
	}
}
[HarmonyPatch(typeof(GameDirector))]
[HarmonyPatch("Update")]
internal class GameDirectorUpdatePatch
{
	private static gameState previousState;

	private static void Postfix(GameDirector __instance)
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0008: Invalid comparison between Unknown and I4
		//IL_000b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0011: Invalid comparison between Unknown and I4
		//IL_0023: 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)
		try
		{
			if ((int)previousState != 2 && (int)__instance.currentState == 2)
			{
				SyncAllPlayersDecorations();
			}
			previousState = __instance.currentState;
		}
		catch (Exception ex)
		{
			ManualLogSource? logger = Morehead.Logger;
			if (logger != null)
			{
				logger.LogError((object)("监听游戏状态变化时出错: " + ex.Message));
			}
		}
	}

	private static void SyncAllPlayersDecorations()
	{
		try
		{
			PlayerAvatar val = FindLocalPlayer();
			if ((Object)(object)val != (Object)null)
			{
				PlayerUpdatePatch.UpdatePlayerDecorations(val);
				HeadDecorationSync component = ((Component)val).GetComponent<HeadDecorationSync>();
				if ((Object)(object)component != (Object)null)
				{
					component.SyncAllDecorations();
				}
			}
		}
		catch (Exception ex)
		{
			ManualLogSource? logger = Morehead.Logger;
			if (logger != null)
			{
				logger.LogError((object)("同步所有玩家装饰物状态时出错: " + ex.Message));
			}
		}
	}

	private static PlayerAvatar? FindLocalPlayer()
	{
		try
		{
			PlayerAvatar[] array = Object.FindObjectsOfType<PlayerAvatar>();
			PlayerAvatar[] array2 = array;
			foreach (PlayerAvatar val in array2)
			{
				if ((Object)(object)val?.photonView != (Object)null && val.photonView.IsMine)
				{
					return val;
				}
			}
		}
		catch (Exception ex)
		{
			ManualLogSource? logger = Morehead.Logger;
			if (logger != null)
			{
				logger.LogError((object)("查找本地玩家时出错: " + ex.Message));
			}
		}
		return null;
	}
}
[HarmonyPatch(typeof(PlayerAvatar))]
[HarmonyPatch("ReviveRPC")]
internal class PlayerRevivePatch
{
	[CompilerGenerated]
	private sealed class <DelayedSync>d__1 : IEnumerator<object>, IEnumerator, IDisposable
	{
		private int <>1__state;

		private object <>2__current;

		public PlayerAvatar playerAvatar;

		private Exception <e>5__1;

		private HeadDecorationSync <syncComponent>5__2;

		private Exception <e>5__3;

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

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

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

		[DebuggerHidden]
		void IDisposable.Dispose()
		{
			<e>5__1 = null;
			<syncComponent>5__2 = null;
			<e>5__3 = null;
			<>1__state = -2;
		}

		private bool MoveNext()
		{
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Expected O, but got Unknown
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Expected O, but got Unknown
			switch (<>1__state)
			{
			default:
				return false;
			case 0:
				<>1__state = -1;
				<>2__current = null;
				<>1__state = 1;
				return true;
			case 1:
				<>1__state = -1;
				<>2__current = (object)new WaitForSeconds(0.2f);
				<>1__state = 2;
				return true;
			case 2:
				<>1__state = -1;
				try
				{
					PlayerUpdatePatch.UpdatePlayerDecorations(playerAvatar);
				}
				catch (Exception ex)
				{
					<e>5__1 = ex;
					ManualLogSource? logger3 = Morehead.Logger;
					if (logger3 != null)
					{
						logger3.LogError((object)("更新玩家装饰物状态失败: " + <e>5__1.Message));
					}
				}
				<>2__current = (object)new WaitForSeconds(0.1f);
				<>1__state = 3;
				return true;
			case 3:
				<>1__state = -1;
				try
				{
					<syncComponent>5__2 = ((Component)playerAvatar).GetComponent<HeadDecorationSync>();
					if ((Object)(object)<syncComponent>5__2 != (Object)null)
					{
						<syncComponent>5__2.SyncAllDecorations();
					}
					else
					{
						ManualLogSource? logger = Morehead.Logger;
						if (logger != null)
						{
							logger.LogWarning((object)"玩家复活后找不到HeadDecorationSync组件");
						}
					}
					<syncComponent>5__2 = null;
				}
				catch (Exception ex)
				{
					<e>5__3 = ex;
					ManualLogSource? logger2 = Morehead.Logger;
					if (logger2 != null)
					{
						logger2.LogError((object)("同步装饰物状态失败: " + <e>5__3.Message));
					}
				}
				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 void Postfix(PlayerAvatar __instance)
	{
		try
		{
			if (__instance.photonView.IsMine)
			{
				((MonoBehaviour)__instance).StartCoroutine(DelayedSync(__instance));
			}
		}
		catch (Exception ex)
		{
			ManualLogSource? logger = Morehead.Logger;
			if (logger != null)
			{
				logger.LogError((object)("玩家复活时同步装饰物状态失败: " + ex.Message));
			}
		}
	}

	[IteratorStateMachine(typeof(<DelayedSync>d__1))]
	private static IEnumerator DelayedSync(PlayerAvatar playerAvatar)
	{
		//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
		return new <DelayedSync>d__1(0)
		{
			playerAvatar = playerAvatar
		};
	}
}
public class DecorationButtonMarker : MonoBehaviour
{
	public DecorationInfo? Decoration { get; set; }

	public bool HasHandledHover { get; set; }
}
[HarmonyPatch(typeof(MenuButton))]
[HarmonyPatch("OnHovering")]
internal class MenuButtonHoveringPatch
{
	[HarmonyPostfix]
	private static void Postfix(MenuButton __instance)
	{
		try
		{
			if ((Object)(object)__instance == (Object)null || (Object)(object)((Component)__instance).gameObject == (Object)null || !((Component)__instance).gameObject.activeInHierarchy)
			{
				return;
			}
			DecorationButtonMarker decorationButtonMarker = null;
			try
			{
				foreach (DecorationButtonMarker value2 in MoreHeadUI.buttonMarkers.Values)
				{
					if ((Object)(object)value2 != (Object)null && (Object)(object)((Component)value2).gameObject != (Object)null && (Object)(object)((Component)value2).gameObject == (Object)(object)((Component)__instance).gameObject)
					{
						decorationButtonMarker = value2;
						break;
					}
				}
			}
			catch (Exception)
			{
				return;
			}
			if ((Object)(object)decorationButtonMarker == (Object)null || decorationButtonMarker.Decoration == null || decorationButtonMarker.HasHandledHover)
			{
				return;
			}
			DecorationInfo decoration = decorationButtonMarker.Decoration;
			if (string.IsNullOrEmpty(decoration.ModName))
			{
				return;
			}
			if (MoreHeadUI.decorationButtons.TryGetValue(decoration.Name ?? string.Empty, out REPOButton value))
			{
				if ((Object)(object)value == (Object)null || (Object)(object)value.labelTMP == (Object)null)
				{
					return;
				}
				if (!((TMP_Text)value.labelTMP).text.Contains(decoration.ModName))
				{
					((TMP_Text)value.labelTMP).text = ((TMP_Text)value.labelTMP).text + " <size=12><color=#AAAAAA>- " + decoration.ModName + "</color></size>";
				}
			}
			decorationButtonMarker.HasHandledHover = true;
		}
		catch (Exception ex2)
		{
			ManualLogSource? logger = Morehead.Logger;
			if (logger != null)
			{
				logger.LogError((object)("MenuButton.OnHovering补丁出错: " + ex2.Message + "\n" + ex2.StackTrace));
			}
		}
	}
}
[HarmonyPatch(typeof(MenuButton))]
[HarmonyPatch("OnHoverEnd")]
internal class MenuButtonHoverEndPatch
{
	[HarmonyPostfix]
	private static void Postfix(MenuButton __instance)
	{
		try
		{
			if ((Object)(object)__instance == (Object)null || (Object)(object)((Component)__instance).gameObject == (Object)null || !((Component)__instance).gameObject.activeInHierarchy)
			{
				return;
			}
			DecorationButtonMarker decorationButtonMarker = null;
			try
			{
				foreach (DecorationButtonMarker value3 in MoreHeadUI.buttonMarkers.Values)
				{
					if ((Object)(object)value3 != (Object)null && (Object)(object)((Component)value3).gameObject != (Object)null && (Object)(object)((Component)value3).gameObject == (Object)(object)((Component)__instance).gameObject)
					{
						decorationButtonMarker = value3;
						break;
					}
				}
			}
			catch (Exception)
			{
				return;
			}
			if ((Object)(object)decorationButtonMarker == (Object)null || decorationButtonMarker.Decoration == null)
			{
				return;
			}
			DecorationInfo decoration = decorationButtonMarker.Decoration;
			if (string.IsNullOrEmpty(decoration.ModName))
			{
				return;
			}
			if (MoreHeadUI.decorationButtons.TryGetValue(decoration.Name ?? string.Empty, out REPOButton value))
			{
				if ((Object)(object)value == (Object)null || (Object)(object)value.labelTMP == (Object)null)
				{
					return;
				}
				string text = ((TMP_Text)value.labelTMP).text;
				string value2 = " <size=12><color=#AAAAAA>- " + decoration.ModName + "</color></size>";
				int num = text.IndexOf(value2);
				if (num != -1)
				{
					((TMP_Text)value.labelTMP).text = text.Substring(0, num).TrimEnd();
				}
			}
			decorationButtonMarker.HasHandledHover = false;
		}
		catch (Exception ex2)
		{
			ManualLogSource? logger = Morehead.Logger;
			if (logger != null)
			{
				logger.LogError((object)("MenuButton.OnHoverEnd补丁出错: " + ex2.Message + "\n" + ex2.StackTrace));
			}
		}
	}
}
[HarmonyPatch(typeof(MenuPage))]
[HarmonyPatch("PageStateSet")]
internal class MenuPageStateSetPatch
{
	[HarmonyPostfix]
	private static void Postfix(MenuPage __instance, PageState pageState)
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0004: 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
		try
		{
			if (((int)pageState == 2 || (int)pageState == 3) && (Object)(object)MoreHeadUI.decorationsPage != (Object)null && (Object)(object)__instance == (Object)(object)MoreHeadUI.decorationsPage.menuPage)
			{
				MoreHeadUI.SafeDestroyAvatar();
			}
		}
		catch (Exception ex)
		{
			ManualLogSource? logger = Morehead.Logger;
			if (logger != null)
			{
				logger.LogError((object)("MenuPage.PageStateSet补丁出错: " + ex.Message + "\n" + ex.StackTrace));
			}
		}
	}
}
namespace MoreHead
{
	public static class ConfigManager
	{
		private const string MOD_DATA_FOLDER = "REPOModData";

		private const string MOD_FOLDER = "MoreHead";

		private const string CONFIG_FILENAME = "MoreHeadConfig.json";

		private static Dictionary<string?, bool> _decorationStates = new Dictionary<string, bool>();

		private static ManualLogSource? Logger => Morehead.Logger;

		private static string NewConfigFilePath => Path.Combine(Application.persistentDataPath, "REPOModData", "MoreHead", "MoreHeadConfig.json");

		private static string BepInExConfigFilePath => Path.Combine(Paths.ConfigPath, "MoreHeadConfig.json");

		private static string OldConfigFilePath
		{
			get
			{
				Morehead? instance = Morehead.Instance;
				return Path.Combine(Path.GetDirectoryName((instance != null) ? ((BaseUnityPlugin)instance).Info.Location : null) ?? string.Empty, "MoreHeadConfig.txt");
			}
		}

		public static void Initialize()
		{
			try
			{
				EnsureModDataDirectoryExists();
				LoadConfig();
				ApplySavedStates();
			}
			catch (Exception ex)
			{
				ManualLogSource? logger = Logger;
				if (logger != null)
				{
					logger.LogError((object)("初始化配置管理器时出错: " + ex.Message));
				}
			}
		}

		private static void EnsureModDataDirectoryExists()
		{
			try
			{
				string text = Path.Combine(Application.persistentDataPath, "REPOModData");
				if (!Directory.Exists(text))
				{
					Directory.CreateDirectory(text);
					ManualLogSource? logger = Logger;
					if (logger != null)
					{
						logger.LogInfo((object)("已创建MOD数据总文件夹: " + text));
					}
				}
				string text2 = Path.Combine(text, "MoreHead");
				if (!Directory.Exists(text2))
				{
					Directory.CreateDirectory(text2);
					ManualLogSource? logger2 = Logger;
					if (logger2 != null)
					{
						logger2.LogInfo((object)("已创建MOD特定文件夹: " + text2));
					}
				}
			}
			catch (Exception ex)
			{
				ManualLogSource? logger3 = Logger;
				if (logger3 != null)
				{
					logger3.LogError((object)("创建MOD数据目录时出错: " + ex.Message));
				}
			}
		}

		private static void LoadConfig()
		{
			try
			{
				_decorationStates.Clear();
				if (File.Exists(NewConfigFilePath) && LoadJsonConfig(NewConfigFilePath))
				{
					ManualLogSource? logger = Logger;
					if (logger != null)
					{
						logger.LogInfo((object)("已从Unity存档位置加载配置: " + NewConfigFilePath));
					}
					return;
				}
				if (File.Exists(BepInExConfigFilePath) && LoadJsonConfig(BepInExConfigFilePath))
				{
					ManualLogSource? logger2 = Logger;
					if (logger2 != null)
					{
						logger2.LogInfo((object)("已从BepInEx配置目录加载配置: " + BepInExConfigFilePath));
					}
					SaveConfigWithoutUpdate();
					ManualLogSource? logger3 = Logger;
					if (logger3 != null)
					{
						logger3.LogInfo((object)("已将配置从BepInEx目录迁移到Unity存档位置: " + NewConfigFilePath));
					}
					try
					{
						File.Delete(BepInExConfigFilePath);
						ManualLogSource? logger4 = Logger;
						if (logger4 != null)
						{
							logger4.LogInfo((object)("已删除BepInEx配置文件: " + BepInExConfigFilePath));
						}
						return;
					}
					catch (Exception ex)
					{
						ManualLogSource? logger5 = Logger;
						if (logger5 != null)
						{
							logger5.LogWarning((object)("删除BepInEx配置文件失败: " + ex.Message));
						}
						return;
					}
				}
				if (!File.Exists(OldConfigFilePath))
				{
					return;
				}
				try
				{
					string[] array = File.ReadAllLines(OldConfigFilePath);
					string[] array2 = array;
					foreach (string text in array2)
					{
						if (!string.IsNullOrWhiteSpace(text))
						{
							string[] array3 = text.Split('=');
							if (array3.Length == 2)
							{
								string key = array3[0].Trim();
								bool value = array3[1].Trim().Equals("1", StringComparison.OrdinalIgnoreCase);
								_decorationStates[key] = value;
							}
						}
					}
					if (_decorationStates.Count <= 0)
					{
						return;
					}
					ManualLogSource? logger6 = Logger;
					if (logger6 != null)
					{
						logger6.LogInfo((object)$"已从旧文本格式加载配置,包含 {_decorationStates.Count} 个装饰物状态");
					}
					SaveConfigWithoutUpdate();
					ManualLogSource? logger7 = Logger;
					if (logger7 != null)
					{
						logger7.LogInfo((object)("已将旧文本格式配置迁移到新的JSON格式: " + NewConfigFilePath));
					}
					try
					{
						File.Delete(OldConfigFilePath);
						ManualLogSource? logger8 = Logger;
						if (logger8 != null)
						{
							logger8.LogInfo((object)("已删除旧文本配置文件: " + OldConfigFilePath));
						}
					}
					catch (Exception ex2)
					{
						ManualLogSource? logger9 = Logger;
						if (logger9 != null)
						{
							logger9.LogWarning((object)("删除旧文本配置文件失败: " + ex2.Message));
						}
					}
				}
				catch (Exception ex3)
				{
					ManualLogSource? logger10 = Logger;
					if (logger10 != null)
					{
						logger10.LogError((object)("从旧文本格式加载配置时出错: " + ex3.Message));
					}
				}
			}
			catch (Exception ex4)
			{
				ManualLogSource? logger11 = Logger;
				if (logger11 != null)
				{
					logger11.LogError((object)("加载配置时出错: " + ex4.Message));
				}
				_decorationStates.Clear();
			}
		}

		private static bool LoadJsonConfig(string filePath)
		{
			//IL_0095: Expected O, but got Unknown
			try
			{
				string text = File.ReadAllText(filePath);
				Dictionary<string, bool> dictionary = JsonConvert.DeserializeObject<Dictionary<string, bool>>(text);
				if (dictionary != null)
				{
					foreach (KeyValuePair<string, bool> item in dictionary)
					{
						_decorationStates[item.Key] = item.Value;
					}
					ManualLogSource? logger = Logger;
					if (logger != null)
					{
						logger.LogInfo((object)$"已从JSON加载配置,包含 {_decorationStates.Count} 个装饰物状态");
					}
					return true;
				}
			}
			catch (JsonException val)
			{
				JsonException val2 = val;
				ManualLogSource? logger2 = Logger;
				if (logger2 != null)
				{
					logger2.LogError((object)("解析JSON配置文件时出错: " + ((Exception)(object)val2).Message));
				}
			}
			catch (Exception ex)
			{
				ManualLogSource? logger3 = Logger;
				if (logger3 != null)
				{
					logger3.LogError((object)("加载JSON配置文件时出错: " + ex.Message));
				}
			}
			return false;
		}

		public static void SaveConfig()
		{
			try
			{
				UpdateConfigData();
				SaveToFile();
			}
			catch (Exception ex)
			{
				ManualLogSource? logger = Logger;
				if (logger != null)
				{
					logger.LogError((object)("保存配置时出错: " + ex.Message));
				}
			}
		}

		private static void SaveConfigWithoutUpdate()
		{
			try
			{
				SaveToFile();
			}
			catch (Exception ex)
			{
				ManualLogSource? logger = Logger;
				if (logger != null)
				{
					logger.LogError((object)("保存配置时出错: " + ex.Message));
				}
			}
		}

		private static void SaveToFile()
		{
			try
			{
				EnsureModDataDirectoryExists();
				string contents = JsonConvert.SerializeObject((object)_decorationStates, (Formatting)1);
				File.WriteAllText(NewConfigFilePath, contents);
			}
			catch (Exception ex)
			{
				ManualLogSource? logger = Logger;
				if (logger != null)
				{
					logger.LogError((object)("写入配置文件时出错: " + ex.Message));
				}
			}
		}

		private static void UpdateConfigData()
		{
			_decorationStates.Clear();
			foreach (DecorationInfo decoration in HeadDecorationManager.Decorations)
			{
				_decorationStates[decoration.Name] = decoration.IsVisible;
			}
		}

		public static void ApplySavedStates()
		{
			try
			{
				int num = 0;
				foreach (DecorationInfo decoration in HeadDecorationManager.Decorations)
				{
					if (_decorationStates.TryGetValue(decoration.Name, out var value))
					{
						decoration.IsVisible = value;
						num++;
					}
				}
				if (num > 0)
				{
					ManualLogSource? logger = Logger;
					if (logger != null)
					{
						logger.LogInfo((object)$"已应用 {num} 个已保存的装饰物状态");
					}
				}
			}
			catch (Exception ex)
			{
				ManualLogSource? logger2 = Logger;
				if (logger2 != null)
				{
					logger2.LogError((object)("应用已保存的装饰物状态时出错: " + ex.Message));
				}
			}
		}
	}
	public static class DecorationUtils
	{
		private const string HEAD_NODE_PATH = "[RIG]/code_lean/code_tilt/ANIM BOT/_____________________________________/ANIM BODY BOT/_____________________________________/ANIM BODY TOP/code_body_top_up/code_body_top_side/_____________________________________/ANIM HEAD BOT/code_head_bot_up/code_head_bot_side/_____________________________________/ANIM HEAD TOP/code_head_top";

		private const string NECK_NODE_PATH = "[RIG]/code_lean/code_tilt/ANIM BOT/_____________________________________/ANIM BODY BOT/_____________________________________/ANIM BODY TOP/code_body_top_up/code_body_top_side/_____________________________________/ANIM HEAD BOT/code_head_bot_up/code_head_bot_side";

		private const string BODY_NODE_PATH = "[RIG]/code_lean/code_tilt/ANIM BOT/_____________________________________/ANIM BODY BOT/_____________________________________/ANIM BODY TOP/code_body_top_up/code_body_top_side/ANIM BODY TOP SCALE";

		private const string HIP_NODE_PATH = "[RIG]/code_lean/code_tilt/ANIM BOT/_____________________________________/ANIM BODY BOT";

		private const string LEFT_ARM_NODE_PATH = "[RIG]/code_lean/code_tilt/ANIM BOT/_____________________________________/ANIM BODY BOT/_____________________________________/ANIM BODY TOP/code_body_top_up/code_body_top_side/_____________________________________/ANIM ARM L/code_arm_l";

		private const string RIGHT_ARM_NODE_PATH = "[RIG]/code_lean/code_tilt/ANIM BOT/_____________________________________/ANIM BODY BOT/_____________________________________/ANIM BODY TOP/code_body_top_up/code_body_top_side/_____________________________________/ANIM ARM R/code_arm_r_parent/code_arm_r/ANIM ARM R SCALE";

		private const string LEFT_LEG_NODE_PATH = "[RIG]/code_lean/code_tilt/ANIM BOT/code_leg_twist/_____________________________________/ANIM LEG L BOT/_____________________________________/ANIM LEG L TOP";

		private const string RIGHT_LEG_NODE_PATH = "[RIG]/code_lean/code_tilt/ANIM BOT/code_leg_twist/_____________________________________/ANIM LEG R BOT/_____________________________________/ANIM LEG R TOP";

		public static Dictionary<string, Transform> GetDecorationParentNodes(Transform rootTransform)
		{
			//IL_0211: Unknown result type (might be due to invalid IL or missing references)
			//IL_0218: Expected O, but got Unknown
			//IL_022e: 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_0252: Unknown result type (might be due to invalid IL or missing references)
			Dictionary<string, Transform> dictionary = new Dictionary<string, Transform>();
			Transform val = rootTransform.Find("[RIG]/code_lean/code_tilt/ANIM BOT/_____________________________________/ANIM BODY BOT/_____________________________________/ANIM BODY TOP/code_body_top_up/code_body_top_side/_____________________________________/ANIM HEAD BOT/code_head_bot_up/code_head_bot_side/_____________________________________/ANIM HEAD TOP/code_head_top");
			if ((Object)(object)val != (Object)null)
			{
				dictionary["head"] = val;
			}
			Transform val2 = rootTransform.Find("[RIG]/code_lean/code_tilt/ANIM BOT/_____________________________________/ANIM BODY BOT/_____________________________________/ANIM BODY TOP/code_body_top_up/code_body_top_side/_____________________________________/ANIM HEAD BOT/code_head_bot_up/code_head_bot_side");
			if ((Object)(object)val2 != (Object)null)
			{
				dictionary["neck"] = val2;
			}
			Transform val3 = rootTransform.Find("[RIG]/code_lean/code_tilt/ANIM BOT/_____________________________________/ANIM BODY BOT/_____________________________________/ANIM BODY TOP/code_body_top_up/code_body_top_side/ANIM BODY TOP SCALE");
			if ((Object)(object)val3 != (Object)null)
			{
				dictionary["body"] = val3;
			}
			Transform val4 = rootTransform.Find("[RIG]/code_lean/code_tilt/ANIM BOT/_____________________________________/ANIM BODY BOT");
			if ((Object)(object)val4 != (Object)null)
			{
				dictionary["hip"] = val4;
			}
			Transform val5 = rootTransform.Find("[RIG]/code_lean/code_tilt/ANIM BOT/_____________________________________/ANIM BODY BOT/_____________________________________/ANIM BODY TOP/code_body_top_up/code_body_top_side/_____________________________________/ANIM ARM L/code_arm_l");
			if ((Object)(object)val5 != (Object)null)
			{
				dictionary["leftarm"] = val5;
			}
			Transform val6 = rootTransform.Find("[RIG]/code_lean/code_tilt/ANIM BOT/_____________________________________/ANIM BODY BOT/_____________________________________/ANIM BODY TOP/code_body_top_up/code_body_top_side/_____________________________________/ANIM ARM R/code_arm_r_parent/code_arm_r/ANIM ARM R SCALE");
			if ((Object)(object)val6 != (Object)null)
			{
				dictionary["rightarm"] = val6;
			}
			Transform val7 = rootTransform.Find("[RIG]/code_lean/code_tilt/ANIM BOT/code_leg_twist/_____________________________________/ANIM LEG L BOT/_____________________________________/ANIM LEG L TOP");
			if ((Object)(object)val7 != (Object)null)
			{
				dictionary["leftleg"] = val7;
			}
			Transform val8 = rootTransform.Find("[RIG]/code_lean/code_tilt/ANIM BOT/code_leg_twist/_____________________________________/ANIM LEG R BOT/_____________________________________/ANIM LEG R TOP");
			if ((Object)(object)val8 != (Object)null)
			{
				dictionary["rightleg"] = val8;
			}
			if ((Object)(object)rootTransform != (Object)null)
			{
				bool flag = false;
				PlayerAvatar componentInChildren = ((Component)rootTransform.parent).GetComponentInChildren<PlayerAvatar>();
				if ((Object)(object)componentInChildren != (Object)null)
				{
					flag = !SemiFunc.IsMultiplayer() || ((Object)(object)componentInChildren.photonView != (Object)null && componentInChildren.photonView.IsMine);
				}
				Transform val9 = rootTransform.Find("WorldDecorationFollower");
				if ((Object)(object)val9 != (Object)null)
				{
					if (flag)
					{
						((Component)val9).gameObject.SetActive(false);
					}
					else
					{
						((Component)val9).gameObject.SetActive(true);
					}
					dictionary["world"] = val9;
				}
				else
				{
					GameObject val10 = new GameObject("WorldDecorationFollower");
					val10.transform.SetParent(rootTransform, false);
					val10.transform.localPosition = Vector3.zero;
					val10.transform.localRotation = Quaternion.identity;
					val10.transform.localScale = Vector3.one;
					val10.AddComponent<WorldSpaceFollower>();
					if (flag)
					{
						val10.SetActive(false);
					}
					else
					{
						val10.SetActive(true);
					}
					dictionary["world"] = val10.transform;
				}
			}
			return dictionary;
		}

		public static void EnsureDecorationContainers(Dictionary<string, Transform> parentNodes)
		{
			//IL_003b: 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_005c: 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)
			foreach (KeyValuePair<string, Transform> parentNode in parentNodes)
			{
				Transform value = parentNode.Value;
				Transform val = value.Find("HeadDecorations");
				if ((Object)(object)val == (Object)null)
				{
					val = new GameObject("HeadDecorations").transform;
					val.SetParent(value, false);
					val.localPosition = Vector3.zero;
					val.localRotation = Quaternion.identity;
					val.localScale = Vector3.one;
				}
			}
		}

		public static void UpdateDecoration(Transform parent, string decorationName, bool showDecoration)
		{
			Transform val = parent.Find(decorationName);
			if ((Object)(object)val != (Object)null && ((Component)val).gameObject.activeSelf != showDecoration)
			{
				((Component)val).gameObject.SetActive(showDecoration);
			}
		}
	}
	public class WorldSpaceFollower : MonoBehaviour
	{
		private Transform? _rootTransform;

		private Vector3 _initialOffset;

		private void Start()
		{
			//IL_002a: 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_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			_rootTransform = ((Component)this).transform.parent;
			if ((Object)(object)_rootTransform != (Object)null)
			{
				_initialOffset = ((Component)this).transform.position - _rootTransform.position;
				((Component)this).transform.rotation = Quaternion.identity;
				((Component)this).transform.localScale = Vector3.one;
			}
		}

		private void LateUpdate()
		{
			//IL_001e: 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_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)_rootTransform != (Object)null)
			{
				((Component)this).transform.position = _rootTransform.position + _initialOffset;
				((Component)this).transform.rotation = Quaternion.Euler(0f, _rootTransform.eulerAngles.y, 0f);
				((Component)this).transform.localScale = Vector3.one;
			}
		}
	}
	public class DecorationInfo
	{
		public string? Name { get; set; }

		public string? DisplayName { get; set; }

		public bool IsVisible { get; set; }

		public GameObject? Prefab { get; set; }

		public string? ParentTag { get; set; }

		public string? BundlePath { get; set; }

		public string? ModName { get; set; }
	}
	public static class HeadDecorationManager
	{
		private static Dictionary<string?, string> parentPathMap = new Dictionary<string, string>
		{
			{ "head", "[RIG]/code_lean/code_tilt/ANIM BOT/_____________________________________/ANIM BODY BOT/_____________________________________/ANIM BODY TOP/code_body_top_up/code_body_top_side/_____________________________________/ANIM HEAD BOT/code_head_bot_up/code_head_bot_side/_____________________________________/ANIM HEAD TOP/code_head_top" },
			{ "neck", "[RIG]/code_lean/code_tilt/ANIM BOT/_____________________________________/ANIM BODY BOT/_____________________________________/ANIM BODY TOP/code_body_top_up/code_body_top_side/_____________________________________/ANIM HEAD BOT/code_head_bot_up/code_head_bot_side" },
			{ "body", "[RIG]/code_lean/code_tilt/ANIM BOT/_____________________________________/ANIM BODY BOT/_____________________________________/ANIM BODY TOP/code_body_top_up/code_body_top_side/ANIM BODY TOP SCALE" },
			{ "hip", "[RIG]/code_lean/code_tilt/ANIM BOT/_____________________________________/ANIM BODY BOT" },
			{ "leftarm", "[RIG]/code_lean/code_tilt/ANIM BOT/_____________________________________/ANIM BODY BOT/_____________________________________/ANIM BODY TOP/code_body_top_up/code_body_top_side/_____________________________________/ANIM ARM L/code_arm_l" },
			{ "rightarm", "[RIG]/code_lean/code_tilt/ANIM BOT/_____________________________________/ANIM BODY BOT/_____________________________________/ANIM BODY TOP/code_body_top_up/code_body_top_side/_____________________________________/ANIM ARM R/code_arm_r_parent/code_arm_r/ANIM ARM R SCALE" },
			{ "leftleg", "[RIG]/code_lean/code_tilt/ANIM BOT/code_leg_twist/_____________________________________/ANIM LEG L BOT/_____________________________________/ANIM LEG L TOP" },
			{ "rightleg", "[RIG]/code_lean/code_tilt/ANIM BOT/code_leg_twist/_____________________________________/ANIM LEG R BOT/_____________________________________/ANIM LEG R TOP" },
			{ "world", "" }
		};

		private static Dictionary<string, List<DecorationInfo>> externalDecorations = new Dictionary<string, List<DecorationInfo>>();

		private static ManualLogSource? Logger => Morehead.Logger;

		public static List<DecorationInfo> Decorations { get; private set; } = new List<DecorationInfo>();


		public static void Initialize()
		{
			try
			{
				ManualLogSource? logger = Logger;
				if (logger != null)
				{
					logger.LogInfo((object)"正在初始化装饰物管理器...");
				}
				Decorations.Clear();
				LoadAllDecorations();
				ManualLogSource? logger2 = Logger;
				if (logger2 != null)
				{
					logger2.LogInfo((object)$"装饰物管理器初始化完成,共加载了 {Decorations.Count} 个装饰物");
				}
			}
			catch (Exception ex)
			{
				ManualLogSource? logger3 = Logger;
				if (logger3 != null)
				{
					logger3.LogError((object)("初始化装饰物管理器时出错: " + ex.Message));
				}
			}
		}

		private static void LoadAllDecorations()
		{
			try
			{
				Morehead? instance = Morehead.Instance;
				string directoryName = Path.GetDirectoryName((instance != null) ? ((BaseUnityPlugin)instance).Info.Location : null);
				if (string.IsNullOrEmpty(directoryName))
				{
					ManualLogSource? logger = Logger;
					if (logger != null)
					{
						logger.LogError((object)"无法获取MOD所在目录");
					}
					return;
				}
				string text = Path.Combine(directoryName, "Decorations");
				if (!Directory.Exists(text))
				{
					Directory.CreateDirectory(text);
					ManualLogSource? logger2 = Logger;
					if (logger2 != null)
					{
						logger2.LogInfo((object)("已创建装饰物目录: " + text));
					}
				}
				List<string> list = new List<string>();
				string[] files = Directory.GetFiles(text, "*.hhh");
				list.AddRange(files);
				try
				{
					string pluginPath = Paths.PluginPath;
					if (!string.IsNullOrEmpty(pluginPath) && Directory.Exists(pluginPath))
					{
						string[] files2 = Directory.GetFiles(pluginPath, "*.hhh", SearchOption.AllDirectories);
						list.AddRange(files2);
						ManualLogSource? logger3 = Logger;
						if (logger3 != null)
						{
							logger3.LogInfo((object)$"在plugins目录中找到 {files2.Length} 个.hhh文件");
						}
					}
					else
					{
						ManualLogSource? logger4 = Logger;
						if (logger4 != null)
						{
							logger4.LogWarning((object)"无法找到BepInEx/plugins目录,将只加载本地装饰物");
						}
					}
				}
				catch (Exception ex)
				{
					ManualLogSource? logger5 = Logger;
					if (logger5 != null)
					{
						logger5.LogError((object)("搜索plugins目录时出错: " + ex.Message));
					}
				}
				list = list.Distinct().ToList();
				if (list.Count == 0)
				{
					ManualLogSource? logger6 = Logger;
					if (logger6 != null)
					{
						logger6.LogWarning((object)"未找到任何装饰物包文件,请确保.hhh文件已放置");
					}
				}
				else
				{
					ManualLogSource? logger7 = Logger;
					if (logger7 != null)
					{
						logger7.LogInfo((object)$"找到 {list.Count} 个装饰物包文件");
					}
					if (files.Length != 0)
					{
						ManualLogSource? logger8 = Logger;
						if (logger8 != null)
						{
							logger8.LogInfo((object)$"- Decorations目录: {files.Length} 个文件");
						}
					}
				}
				foreach (string item in list)
				{
					LoadDecorationBundle(item);
				}
			}
			catch (Exception ex2)
			{
				ManualLogSource? logger9 = Logger;
				if (logger9 != null)
				{
					logger9.LogError((object)("加载装饰物时出错: " + ex2.Message));
				}
			}
		}

		private static void LoadDecorationBundle(string bundlePath)
		{
			AssetBundle val = null;
			try
			{
				if (!File.Exists(bundlePath))
				{
					ManualLogSource? logger = Logger;
					if (logger != null)
					{
						logger.LogWarning((object)("文件不存在: " + bundlePath));
					}
					return;
				}
				FileInfo fileInfo = new FileInfo(bundlePath);
				if (fileInfo.Length < 1024)
				{
					ManualLogSource? logger2 = Logger;
					if (logger2 != null)
					{
						logger2.LogWarning((object)$"文件过小,可能不是有效的AssetBundle: {bundlePath}, 大小: {fileInfo.Length} 字节");
					}
					return;
				}
				string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(bundlePath);
				string parentTag = "head";
				string text = fileNameWithoutExtension;
				if (fileNameWithoutExtension.Contains("_"))
				{
					string[] array = fileNameWithoutExtension.Split('_');
					if (array.Length >= 2)
					{
						string text2 = array[^1].ToLower();
						if (parentPathMap.ContainsKey(text2))
						{
							parentTag = text2;
							text = string.Join("_", array, 0, array.Length - 1);
						}
					}
				}
				string text3 = EnsureUniqueName(text);
				if (text3 != text)
				{
					ManualLogSource? logger3 = Logger;
					if (logger3 != null)
					{
						logger3.LogWarning((object)("检测到重名,将基础名称从 " + text + " 修改为 " + text3));
					}
					text = text3;
				}
				try
				{
					val = AssetBundle.LoadFromFile(bundlePath);
					if ((Object)(object)val == (Object)null)
					{
						ManualLogSource? logger4 = Logger;
						if (logger4 != null)
						{
							logger4.LogError((object)("无法加载AssetBundle,文件可能已损坏或不是有效的AssetBundle: " + bundlePath));
						}
						return;
					}
				}
				catch (Exception ex)
				{
					ManualLogSource? logger5 = Logger;
					if (logger5 != null)
					{
						logger5.LogError((object)("加载AssetBundle时出错,文件可能不是有效的AssetBundle: " + bundlePath + ", 错误: " + ex.Message));
					}
					return;
				}
				try
				{
					string[] allAssetNames;
					try
					{
						allAssetNames = val.GetAllAssetNames();
					}
					catch (Exception ex2)
					{
						ManualLogSource? logger6 = Logger;
						if (logger6 != null)
						{
							logger6.LogError((object)("获取AssetBundle资源名称时出错: " + bundlePath + ", 错误: " + ex2.Message));
						}
						val.Unload(true);
						return;
					}
					if (allAssetNames.Length == 0)
					{
						ManualLogSource? logger7 = Logger;
						if (logger7 != null)
						{
							logger7.LogWarning((object)("AssetBundle不包含任何资源: " + bundlePath));
						}
						val.Unload(true);
						return;
					}
					bool flag = false;
					GameObject val2 = null;
					string[] array2 = allAssetNames;
					foreach (string text4 in array2)
					{
						try
						{
							val2 = val.LoadAsset<GameObject>(text4);
							if ((Object)(object)val2 != (Object)null)
							{
								flag = true;
								break;
							}
						}
						catch (Exception ex3)
						{
							ManualLogSource? logger8 = Logger;
							if (logger8 != null)
							{
								logger8.LogWarning((object)("加载资源 " + text4 + " 时出错: " + ex3.Message));
							}
						}
					}
					if (!flag || (Object)(object)val2 == (Object)null)
					{
						ManualLogSource? logger9 = Logger;
						if (logger9 != null)
						{
							logger9.LogWarning((object)("AssetBundle不包含有效的GameObject资源: " + bundlePath));
						}
						val.Unload(true);
						return;
					}
					string text5 = ((Object)val2).name;
					string text6 = EnsureUniqueDisplayName(text5);
					if (text6 != text5)
					{
						ManualLogSource? logger10 = Logger;
						if (logger10 != null)
						{
							logger10.LogWarning((object)("检测到显示名称重复,将显示名称从 " + text5 + " 修改为 " + text6));
						}
						text5 = text6;
					}
					DecorationInfo decorationInfo = new DecorationInfo
					{
						Name = text,
						DisplayName = text5,
						IsVisible = false,
						Prefab = val2,
						ParentTag = parentTag,
						BundlePath = bundlePath,
						ModName = GetModNameFromPath(bundlePath)
					};
					Decorations.Add(decorationInfo);
					ManualLogSource? logger11 = Logger;
					if (logger11 != null)
					{
						logger11.LogInfo((object)("成功加载装饰物: " + decorationInfo.DisplayName + ", 标签: " + decorationInfo.ParentTag));
					}
					val.Unload(false);
				}
				catch (Exception ex4)
				{
					ManualLogSource? logger12 = Logger;
					if (logger12 != null)
					{
						logger12.LogError((object)("处理AssetBundle时出错: " + ex4.Message));
					}
					if ((Object)(object)val != (Object)null)
					{
						val.Unload(true);
					}
				}
			}
			catch (Exception ex5)
			{
				ManualLogSource? logger13 = Logger;
				if (logger13 != null)
				{
					logger13.LogError((object)("加载装饰物包时出错: " + ex5.Message + ", 路径: " + bundlePath));
				}
				if ((Object)(object)val != (Object)null)
				{
					val.Unload(true);
				}
			}
		}

		private static string EnsureUniqueName(string baseName)
		{
			string name = baseName;
			int num = 1;
			while (Decorations.Any((DecorationInfo d) => d.Name != null && d.Name.Equals(name, StringComparison.OrdinalIgnoreCase)))
			{
				name = $"{baseName}({num})";
				num++;
			}
			return name;
		}

		private static string EnsureUniqueDisplayName(string baseDisplayName)
		{
			string displayName = baseDisplayName;
			int num = 1;
			while (Decorations.Any((DecorationInfo d) => d.DisplayName != null && d.DisplayName.Equals(displayName, StringComparison.OrdinalIgnoreCase)))
			{
				displayName = $"{baseDisplayName}({num})";
				num++;
			}
			return displayName;
		}

		private static string? GetParentTagFromPrefab(GameObject prefab)
		{
			string text = ((Object)prefab).name.ToLower();
			foreach (string key in parentPathMap.Keys)
			{
				if (key != null && text.Contains(key))
				{
					return key;
				}
			}
			return null;
		}

		public static bool GetDecorationState(string? name)
		{
			string name2 = name;
			DecorationInfo decorationInfo = Decorations.FirstOrDefault((DecorationInfo d) => d.Name != null && d.Name.Equals(name2, StringComparison.OrdinalIgnoreCase));
			if (decorationInfo == null)
			{
				ManualLogSource? logger = Logger;
				if (logger != null)
				{
					logger.LogWarning((object)("GetDecorationState: 找不到装饰物 " + name2));
				}
			}
			return decorationInfo?.IsVisible ?? false;
		}

		public static void SetDecorationState(string name, bool isVisible)
		{
			string name2 = name;
			DecorationInfo decorationInfo = Decorations.FirstOrDefault((DecorationInfo d) => d.Name != null && d.Name.Equals(name2, StringComparison.OrdinalIgnoreCase));
			if (decorationInfo != null)
			{
				decorationInfo.IsVisible = isVisible;
				ManualLogSource? logger = Logger;
				if (logger != null)
				{
					logger.LogInfo((object)$"设置装饰物 {decorationInfo.DisplayName} 显示状态为: {isVisible}");
				}
			}
			else
			{
				ManualLogSource? logger2 = Logger;
				if (logger2 != null)
				{
					logger2.LogWarning((object)("SetDecorationState: 找不到装饰物 " + name2));
				}
			}
		}

		public static bool ToggleDecorationState(string? name)
		{
			string name2 = name;
			DecorationInfo decorationInfo = Decorations.FirstOrDefault((DecorationInfo d) => d.Name != null && d.Name.Equals(name2, StringComparison.OrdinalIgnoreCase));
			if (decorationInfo != null)
			{
				decorationInfo.IsVisible = !decorationInfo.IsVisible;
				return decorationInfo.IsVisible;
			}
			ManualLogSource? logger = Logger;
			if (logger != null)
			{
				logger.LogWarning((object)("ToggleDecorationState: 找不到装饰物 " + name2));
			}
			return false;
		}

		public static string GetParentPath(string parentTag)
		{
			if (parentPathMap.TryGetValue(parentTag.ToLower(), out string value))
			{
				return value;
			}
			return parentPathMap["head"];
		}

		public static void DisableAllDecorations()
		{
			try
			{
				int num = 0;
				foreach (DecorationInfo decoration in Decorations)
				{
					if (decoration.IsVisible)
					{
						decoration.IsVisible = false;
						num++;
					}
				}
			}
			catch (Exception ex)
			{
				ManualLogSource? logger = Logger;
				if (logger != null)
				{
					logger.LogError((object)("关闭所有装饰物时出错: " + ex.Message));
				}
			}
		}

		public static bool LoadExternalAssetBundle(byte[] bundleData, string resourceName)
		{
			try
			{
				string text = Path.Combine(Path.GetTempPath(), resourceName);
				File.WriteAllBytes(text, bundleData);
				LoadDecorationBundle(text);
				try
				{
					File.Delete(text);
				}
				catch (Exception ex)
				{
					ManualLogSource? logger = Logger;
					if (logger != null)
					{
						logger.LogWarning((object)("清理临时文件失败: " + ex.Message));
					}
				}
				return true;
			}
			catch (Exception ex2)
			{
				ManualLogSource? logger2 = Logger;
				if (logger2 != null)
				{
					logger2.LogError((object)("加载外部AB包失败: " + ex2.Message));
				}
				return false;
			}
		}

		public static void LoadExternalAssetBundlesFromAssembly(Assembly assembly)
		{
			try
			{
				int num = 0;
				string name2 = assembly.GetName().Name;
				string location = assembly.Location;
				string fileName = Path.GetFileName(location);
				if (!externalDecorations.ContainsKey(name2))
				{
					externalDecorations[name2] = new List<DecorationInfo>();
				}
				else
				{
					externalDecorations[name2].Clear();
				}
				int count = Decorations.Count;
				string[] manifestResourceNames = assembly.GetManifestResourceNames();
				IEnumerable<string> enumerable = manifestResourceNames.Where((string name) => name.EndsWith(".hhh", StringComparison.OrdinalIgnoreCase));
				if (!enumerable.Any())
				{
					ManualLogSource? logger = Logger;
					if (logger != null)
					{
						logger.LogWarning((object)("在DLL " + name2 + " 中未找到.hhh资源"));
					}
					return;
				}
				ManualLogSource? logger2 = Logger;
				if (logger2 != null)
				{
					logger2.LogInfo((object)$"在DLL {name2} 中找到 {enumerable.Count()} 个.hhh资源");
				}
				foreach (string item in enumerable)
				{
					try
					{
						string text = item.Substring(0, item.Length - 4);
						string text2 = ((!text.Contains(".")) ? text : text.Split('.').Last());
						ManualLogSource? logger3 = Logger;
						if (logger3 != null)
						{
							logger3.LogInfo((object)("处理资源: " + item + ", 提取文件名: " + text2));
						}
						byte[] array;
						using (Stream stream = assembly.GetManifestResourceStream(item))
						{
							if (stream == null)
							{
								continue;
							}
							array = new byte[stream.Length];
							stream.Read(array, 0, array.Length);
							goto IL_01bc;
						}
						IL_01bc:
						if (LoadExternalAssetBundle(array, text2 + ".hhh"))
						{
							num++;
						}
					}
					catch (Exception ex)
					{
						ManualLogSource? logger4 = Logger;
						if (logger4 != null)
						{
							logger4.LogError((object)("加载资源 " + item + " 失败: " + ex.Message));
						}
					}
				}
				if (num > 0)
				{
					for (int i = count; i < Decorations.Count; i++)
					{
						DecorationInfo decorationInfo = Decorations[i];
						decorationInfo.ModName = fileName;
						externalDecorations[name2].Add(decorationInfo);
					}
					ManualLogSource? logger5 = Logger;
					if (logger5 != null)
					{
						logger5.LogInfo((object)$"成功从DLL {name2} 加载了 {num} 个资源,已保存到外部装饰物记录中");
					}
					ConfigManager.ApplySavedStates();
				}
			}
			catch (Exception ex2)
			{
				ManualLogSource? logger6 = Logger;
				if (logger6 != null)
				{
					logger6.LogError((object)("从DLL加载资源失败: " + ex2.Message));
				}
			}
		}

		public static List<DecorationInfo> GetDecorationsFromAssembly(Assembly assembly)
		{
			string name = assembly.GetName().Name;
			if (externalDecorations.TryGetValue(name, out List<DecorationInfo> value))
			{
				return value;
			}
			return new List<DecorationInfo>();
		}

		public static List<GameObject> GetDecorationGameObjectsFromAssembly(Assembly assembly)
		{
			List<GameObject> list = new List<GameObject>();
			foreach (DecorationInfo item in GetDecorationsFromAssembly(assembly))
			{
				if ((Object)(object)item.Prefab != (Object)null)
				{
					list.Add(item.Prefab);
				}
			}
			return list;
		}

		public static DecorationInfo GetDecorationByName(Assembly assembly, string decorationName)
		{
			string decorationName2 = decorationName;
			List<DecorationInfo> decorationsFromAssembly = GetDecorationsFromAssembly(assembly);
			return decorationsFromAssembly.FirstOrDefault((DecorationInfo d) => (d.Name != null && d.Name.Equals(decorationName2, StringComparison.OrdinalIgnoreCase)) || (d.DisplayName != null && d.DisplayName.Equals(decorationName2, StringComparison.OrdinalIgnoreCase)));
		}

		public static List<DecorationInfo> FindDecorationsByPartialName(Assembly assembly, string partialName)
		{
			string partialName2 = partialName;
			if (string.IsNullOrEmpty(partialName2))
			{
				return new List<DecorationInfo>();
			}
			List<DecorationInfo> decorationsFromAssembly = GetDecorationsFromAssembly(assembly);
			return decorationsFromAssembly.Where((DecorationInfo d) => (d.Name != null && d.Name.IndexOf(partialName2, StringComparison.OrdinalIgnoreCase) >= 0) || (d.DisplayName != null && d.DisplayName.IndexOf(partialName2, StringComparison.OrdinalIgnoreCase) >= 0)).ToList();
		}

		public static void RecreateUI()
		{
			try
			{
				MoreHeadUI.RecreateUI();
			}
			catch (Exception ex)
			{
				ManualLogSource? logger = Logger;
				if (logger != null)
				{
					logger.LogError((object)("重新创建UI时出错: " + ex.Message));
				}
			}
		}

		private static string? GetModNameFromPath(string? bundlePath)
		{
			try
			{
				if (string.IsNullOrEmpty(bundlePath))
				{
					return null;
				}
				string pluginPath = Paths.PluginPath;
				if (string.IsNullOrEmpty(pluginPath) || !Directory.Exists(pluginPath))
				{
					return null;
				}
				if (!bundlePath.StartsWith(pluginPath, StringComparison.OrdinalIgnoreCase))
				{
					return null;
				}
				string directoryName = Path.GetDirectoryName(bundlePath);
				if (string.IsNullOrEmpty(directoryName))
				{
					return null;
				}
				string text = directoryName;
				while (!string.IsNullOrEmpty(text))
				{
					DirectoryInfo? parent = Directory.GetParent(text);
					if (parent == null || parent.FullName.Equals(pluginPath, StringComparison.OrdinalIgnoreCase))
					{
						break;
					}
					text = Directory.GetParent(text)?.FullName ?? string.Empty;
				}
				if (string.IsNullOrEmpty(text))
				{
					return null;
				}
				string fileName = Path.GetFileName(text);
				string[] array = fileName.Split('-');
				if (array.Length <= 1)
				{
					return fileName;
				}
				string text2 = array[^1];
				bool flag = IsLikelyVersionNumber(text2);
				if (flag && array.Length > 2)
				{
					return array[^2];
				}
				if (flag)
				{
					return array[0];
				}
				return text2;
			}
			catch (Exception ex)
			{
				ManualLogSource? logger = Morehead.Logger;
				if (logger != null)
				{
					logger.LogError((object)("获取模组名称时出错: " + ex.Message));
				}
				return null;
			}
		}

		private static bool IsLikelyVersionNumber(string text)
		{
			if (text.Length == 0 || !char.IsDigit(text[0]))
			{
				return false;
			}
			bool flag = false;
			bool flag2 = false;
			foreach (char c in text)
			{
				if (char.IsDigit(c))
				{
					flag = true;
				}
				else if (c == '.' || c == '_' || c == '-')
				{
					flag2 = true;
				}
			}
			return flag && flag2;
		}
	}
	public static class MoreHeadUI
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static BuilderDelegate <>9__16_0;

			public static Func<DecorationInfo, bool> <>9__17_0;

			public static Action <>9__21_1;

			public static BuilderDelegate <>9__21_0;

			public static BuilderDelegate <>9__33_0;

			public static Func<DecorationInfo, bool> <>9__37_0;

			public static Func<DecorationInfo, string> <>9__37_1;

			public static Func<DecorationInfo, bool> <>9__37_2;

			public static Func<DecorationInfo, string> <>9__37_3;

			public static BuilderDelegate <>9__39_0;

			public static BuilderDelegate <>9__39_1;

			internal void <Initialize>b__16_0(Transform parent)
			{
				//IL_0022: Unknown result type (might be due to invalid IL or missing references)
				MenuAPI.CreateREPOButton("<color=#FF0000>M</color><color=#FF3300>O</color><color=#FF6600>R</color><color=#FF9900>E</color><color=#FFCC00>H</color><color=#FFDD00>E</color><color=#FFEE00>A</color><color=#FFFF00>D</color>", (Action)OnMenuButtonClick, parent, Vector2.zero);
			}

			internal bool <InitializeDataCache>b__17_0(DecorationInfo decoration)
			{
				return LIMB_TAGS.Contains(decoration.ParentTag?.ToUpper());
			}

			internal void <AddAuthorCredit>b__21_0(Transform parent)
			{
				//IL_0030: Unknown result type (might be due to invalid IL or missing references)
				MenuAPI.CreateREPOButton("<size=10><color=#FFFFA0>Masaicker</color> and <color=#FFFFA0>Yuriscat</color> co-developed.\n由<color=#FFFFA0>马赛克了</color>和<color=#FFFFA0>尤里的猫</color>共同制作。</size>", (Action)delegate
				{
				}, parent, new Vector2(300f, 329f));
			}

			internal void <AddAuthorCredit>b__21_1()
			{
			}

			internal void <CreateAvatarPreview>b__33_0(Transform parent)
			{
				//IL_000c: Unknown result type (might be due to invalid IL or missing references)
				avatarPreview = MenuAPI.CreateREPOAvatarPreview(parent, new Vector2(420f, 10f), false, (Color?)null);
			}

			internal bool <CreateAllDecorationButtons>b__37_0(DecorationInfo decoration)
			{
				return IsBuiltInDecoration(decoration);
			}

			internal string <CreateAllDecorationButtons>b__37_1(DecorationInfo decoration)
			{
				return decoration.DisplayName;
			}

			internal bool <CreateAllDecorationButtons>b__37_2(DecorationInfo decoration)
			{
				return !IsBuiltInDecoration(decoration);
			}

			internal string <CreateAllDecorationButtons>b__37_3(DecorationInfo decoration)
			{
				return decoration.DisplayName;
			}

			internal void <AddActionButtons>b__39_0(Transform parent)
			{
				//IL_002c: Unknown result type (might be due to invalid IL or missing references)
				MenuAPI.CreateREPOButton("<size=18><color=#FFFFFF>C</color><color=#E6E6E6>L</color><color=#CCCCCC>O</color><color=#B3B3B3>S</color><color=#999999>E</color></size>", (Action)OnCloseButtonClick, parent, new Vector2(301f, 0f));
			}

			internal void <AddActionButtons>b__39_1(Transform parent)
			{
				//IL_002c: Unknown result type (might be due to invalid IL or missing references)
				MenuAPI.CreateREPOButton("<size=18><color=#FFAA00>CLEAR ALL</color></size>", (Action)OnDisableAllButtonClick, parent, new Vector2(401f, 0f));
			}
		}

		[CompilerGenerated]
		private sealed class <DelayedOpenMoreHeadUI>d__19 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			private Exception <e>5__1;

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

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

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

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

			private bool MoveNext()
			{
				//IL_005e: Unknown result type (might be due to invalid IL or missing references)
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = null;
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					try
					{
						if ((Object)(object)decorationsPage == (Object)null)
						{
							decorationsPage = MenuAPI.CreateREPOPopupPage(PAGE_TITLE, true, true, 0f, (Vector2?)new Vector2(-299f, 10f));
							SetupPopupPage(decorationsPage);
							CreateAllDecorationButtons(decorationsPage);
							CreateTagFilterButtons(decorationsPage);
							AddAuthorCredit(decorationsPage);
							AddActionButtons(decorationsPage);
						}
						decorationsPage.OpenPage(false);
						MonoBehaviour obj = Object.FindObjectOfType<MonoBehaviour>();
						if (obj != null)
						{
							obj.StartCoroutine(DelayedShowTagDecorations(currentTagFilter));
						}
						UpdateAvatarPreview();
						UpdateButtonStates();
					}
					catch (Exception ex)
					{
						<e>5__1 = ex;
						ManualLogSource? logger = Logger;
						if (logger != null)
						{
							logger.LogError((object)("延迟打开设置页面时出错: " + <e>5__1.Message));
						}
					}
					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 <DelayedShowTagDecorations>d__41 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public string tag;

			private Exception <e>5__1;

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

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

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

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<e>5__1 = 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;
					try
					{
						ShowTagDecorations(tag);
					}
					catch (Exception ex)
					{
						<e>5__1 = ex;
						ManualLogSource? logger = Logger;
						if (logger != null)
						{
							logger.LogError((object)("延迟显示标签装饰物时出错: " + <e>5__1.Message));
						}
					}
					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 static REPOPopupPage? decorationsPage;

		public static Dictionary<string?, REPOButton> decorationButtons = new Dictionary<string, REPOButton>();

		public static Dictionary<string?, DecorationButtonMarker?> buttonMarkers = new Dictionary<string, DecorationButtonMarker>();

		private static Dictionary<string, List<REPOScrollViewElement>> tagScrollViewElements = new Dictionary<string, List<REPOScrollViewElement>>();

		private static string currentTagFilter = "ALL";

		private static Dictionary<string, REPOButton> tagFilterButtons = new Dictionary<string, REPOButton>();

		private static Dictionary<string, List<DecorationInfo>> decorationDataCache = new Dictionary<string, List<DecorationInfo>>();

		private static Dictionary<string, Dictionary<string, string>> buttonTextCache = new Dictionary<string, Dictionary<string, string>>();

		private static REPOAvatarPreview? avatarPreview;

		private const string BUTTON_NAME = "<color=#FF0000>M</color><color=#FF3300>O</color><color=#FF6600>R</color><color=#FF9900>E</color><color=#FFCC00>H</color><color=#FFDD00>E</color><color=#FFEE00>A</color><color=#FFFF00>D</color>";

		private static readonly string PAGE_TITLE = "Rotate robot: A/D <size=12><color=#AAAAAA>v" + Morehead.GetPluginVersion() + "</color></size>";

		private static readonly string[] ALL_TAGS = new string[7] { "ALL", "HEAD", "NECK", "BODY", "HIP", "LIMBS", "WORLD" };

		private static readonly string[] FULL_TAGS = new string[10] { "ALL", "HEAD", "NECK", "BODY", "HIP", "LEFTARM", "RIGHTARM", "LEFTLEG", "RIGHTLEG", "WORLD" };

		private static readonly string[] LIMB_TAGS = new string[4] { "LEFTARM", "RIGHTARM", "LEFTLEG", "RIGHTLEG" };

		private static ManualLogSource? Logger => Morehead.Logger;

		public static void Initialize()
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Expected O, but got Unknown
			try
			{
				object obj = <>c.<>9__16_0;
				if (obj == null)
				{
					BuilderDelegate val = delegate(Transform parent)
					{
						//IL_0022: Unknown result type (might be due to invalid IL or missing references)
						MenuAPI.CreateREPOButton("<color=#FF0000>M</color><color=#FF3300>O</color><color=#FF6600>R</color><color=#FF9900>E</color><color=#FFCC00>H</color><color=#FFDD00>E</color><color=#FFEE00>A</color><color=#FFFF00>D</color>", (Action)OnMenuButtonClick, parent, Vector2.zero);
					};
					<>c.<>9__16_0 = val;
					obj = (object)val;
				}
				MenuAPI.AddElementToEscapeMenu((BuilderDelegate)obj);
				InitializeDataCache();
				ManualLogSource? logger = Logger;
				if (logger != null)
				{
					logger.LogInfo((object)"MoreHead UI已初始化");
				}
			}
			catch (Exception ex)
			{
				ManualLogSource? logger2 = Logger;
				if (logger2 != null)
				{
					logger2.LogError((object)("初始化UI时出错: " + ex.Message));
				}
			}
		}

		private static void InitializeDataCache()
		{
			try
			{
				decorationDataCache.Clear();
				buttonTextCache.Clear();
				string[] aLL_TAGS = ALL_TAGS;
				foreach (string tag in aLL_TAGS)
				{
					List<DecorationInfo> list = ((!(tag == "LIMBS")) ? HeadDecorationManager.Decorations.Where((DecorationInfo decoration) => tag == "ALL" || decoration.ParentTag?.ToUpper() == tag).ToList() : HeadDecorationManager.Decorations.Where((DecorationInfo decoration) => LIMB_TAGS.Contains(decoration.ParentTag?.ToUpper())).ToList());
					decorationDataCache[tag] = list;
					buttonTextCache[tag] = new Dictionary<string, string>();
					foreach (DecorationInfo item in list)
					{
						string buttonText = GetButtonText(item, item.IsVisible);
						buttonTextCache[tag][item.Name ?? string.Empty] = buttonText;
					}
				}
				ManualLogSource? logger = Logger;
				if (logger != null)
				{
					logger.LogInfo((object)"数据缓存初始化完成");
				}
			}
			catch (Exception ex)
			{
				ManualLogSource? logger2 = Logger;
				if (logger2 != null)
				{
					logger2.LogError((object)("初始化数据缓存时出错: " + ex.Message));
				}
			}
		}

		private static void OnMenuButtonClick()
		{
			try
			{
				MenuManager.instance.PageCloseAll();
				MonoBehaviour obj = Object.FindObjectOfType<MonoBehaviour>();
				if (obj != null)
				{
					obj.StartCoroutine(DelayedOpenMoreHeadUI());
				}
			}
			catch (Exception ex)
			{
				ManualLogSource? logger = Logger;
				if (logger != null)
				{
					logger.LogError((object)("打开设置页面时出错: " + ex.Message));
				}
			}
		}

		[IteratorStateMachine(typeof(<DelayedOpenMoreHeadUI>d__19))]
		private static IEnumerator DelayedOpenMoreHeadUI()
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <DelayedOpenMoreHeadUI>d__19(0);
		}

		private static void SetupPopupPage(REPOPopupPage page)
		{
			//IL_0042: 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)
			try
			{
				if ((Object)(object)((Component)page).gameObject != (Object)null)
				{
					((Object)((Component)page).gameObject).name = "MoreHead_Page";
				}
				page.pageDimmerVisibility = true;
				page.maskPadding = new Padding(10f, 10f, 20f, 10f);
				((Transform)((TMP_Text)page.headerTMP).rectTransform).position = new Vector3(170f, 344f, 0f);
				page.pageDimmerOpacity = 0.85f;
				page.scrollView.scrollSpeed = 4f;
			}
			catch (Exception ex)
			{
				ManualLogSource? logger = Logger;
				if (logger != null)
				{
					logger.LogError((object)("设置弹出页面属性时出错: " + ex.Message));
				}
			}
		}

		private static void AddAuthorCredit(REPOPopupPage page)
		{
			//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)
			//IL_0022: Expected O, but got Unknown
			try
			{
				object obj = <>c.<>9__21_0;
				if (obj == null)
				{
					BuilderDelegate val = delegate(Transform parent)
					{
						//IL_0030: Unknown result type (might be due to invalid IL or missing references)
						MenuAPI.CreateREPOButton("<size=10><color=#FFFFA0>Masaicker</color> and <color=#FFFFA0>Yuriscat</color> co-developed.\n由<color=#FFFFA0>马赛克了</color>和<color=#FFFFA0>尤里的猫</color>共同制作。</size>", (Action)delegate
						{
						}, parent, new Vector2(300f, 329f));
					};
					<>c.<>9__21_0 = val;
					obj = (object)val;
				}
				page.AddElement((BuilderDelegate)obj);
			}
			catch (Exception ex)
			{
				ManualLogSource? logger = Logger;
				if (logger != null)
				{
					logger.LogError((object)("添加作者标记时出错: " + ex.Message));
				}
			}
		}

		private static bool IsBuiltInDecoration(DecorationInfo decoration)
		{
			string bundlePath = decoration.BundlePath;
			if (string.IsNullOrEmpty(bundlePath))
			{
				return false;
			}
			Morehead? instance = Morehead.Instance;
			string directoryName = Path.GetDirectoryName((instance != null) ? ((BaseUnityPlugin)instance).Info.Location : null);
			if (string.IsNullOrEmpty(directoryName))
			{
				return false;
			}
			string value = Path.Combine(directoryName, "Decorations");
			return bundlePath.StartsWith(value);
		}

		private static void CreateTagFilterButtons(REPOPopupPage? page)
		{
			//IL_016f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0179: Expected O, but got Unknown
			try
			{
				tagFilterButtons.Clear();
				for (int i = 0; i < ALL_TAGS.Length; i++)
				{
					string text = ALL_TAGS[i];
					string text2 = text.ToLower();
					int num = i;
					if (1 == 0)
					{
					}
					string text3 = text2 switch
					{
						"head" => "#00AAFF", 
						"neck" => "#AA00FF", 
						"body" => "#FFAA00", 
						"hip" => "#FF00AA", 
						"limbs" => "#AACCAA", 
						"world" => "#00FFAA", 
						_ => "#FFFFFF", 
					};
					if (1 == 0)
					{
					}
					string text4 = text3;
					string buttonText = ((text2 == currentTagFilter.ToLower()) ? ("<size=14><b><color=" + text4 + ">" + text + "</color></b></size>") : ("<size=14><color=" + text4 + "50>" + text + "</color></size>"));
					string tagForCallback = ((text2 == "all") ? "ALL" : text);
					int xPosition = 50 + i * 35;
					if (page == null)
					{
						continue;
					}
					page.AddElement((BuilderDelegate)delegate(Transform parent)
					{
						//IL_0033: Unknown result type (might be due to invalid IL or missing references)
						REPOButton value = MenuAPI.CreateREPOButton(buttonText, (Action)delegate
						{
							OnTagFilterButtonClick(tagForCallback);
						}, parent, new Vector2((float)xPosition, 20f));
						tagFilterButtons[tagForCallback] = value;
					});
				}
			}
			catch (Exception ex)
			{
				ManualLogSource? logger = Logger;
				if (logger != null)
				{
					logger.LogError((object)("创建标签筛选按钮时出错: " + ex.Message));
				}
			}
		}

		private static void OnTagFilterButtonClick(string tag)
		{
			try
			{
				if (tag == currentTagFilter)
				{
					REPOPopupPage? obj = decorationsPage;
					if (obj != null)
					{
						obj.scrollView.SetScrollPosition(0f);
					}
				}
				else
				{
					ShowTagDecorations(tag);
					UpdateTagButtonHighlights();
				}
			}
			catch (Exception ex)
			{
				ManualLogSource? logger = Logger;
				if (logger != null)
				{
					logger.LogError((object)("切换标签筛选时出错: " + ex.Message));
				}
			}
		}

		private static void UpdateButtonStates()
		{
			try
			{
				if (decorationButtons.Count == 0)
				{
					return;
				}
				if (decorationDataCache.TryGetValue(currentTagFilter, out List<DecorationInfo> value))
				{
					foreach (DecorationInfo item in value)
					{
						if (!decorationButtons.TryGetValue(item.Name ?? string.Empty, out REPOButton value2))
						{
							continue;
						}
						if (buttonTextCache.TryGetValue(currentTagFilter, out Dictionary<string, string> value3) && value3.TryGetValue(item.Name ?? string.Empty, out var value4))
						{
							if (currentTagFilter == "LIMBS")
							{
								value4 = GetButtonText(item, item.IsVisible);
								value3[item.Name ?? string.Empty] = value4;
							}
						}
						else
						{
							value4 = GetButtonText(item, item.IsVisible);
							if (buttonTextCache.TryGetValue(currentTagFilter, out value3))
							{
								value3[item.Name ?? string.Empty] = value4;
							}
						}
						((TMP_Text)value2.labelTMP).text = value4;
					}
				}
				UpdateTagButtonHighlights();
			}
			catch (Exception ex)
			{
				ManualLogSource? logger = Logger;
				if (logger != null)
				{
					logger.LogError((object)("更新按钮状态时出错: " + ex.Message));
				}
			}
		}

		private static void UpdateTagButtonHighlights()
		{
			try
			{
				string[] aLL_TAGS = ALL_TAGS;
				foreach (string text in aLL_TAGS)
				{
					string text2 = ((text == "ALL") ? "ALL" : text);
					if (tagFilterButtons.TryGetValue(text2, out REPOButton value))
					{
						string text3 = text.ToLower();
						if (1 == 0)
						{
						}
						string text4 = text3 switch
						{
							"head" => "#00AAFF", 
							"neck" => "#AA00FF", 
							"body" => "#FFAA00", 
							"hip" => "#FF00AA", 
							"limbs" => "#AACCAA", 
							"world" => "#00FFAA", 
							_ => "#FFFFFF", 
						};
						if (1 == 0)
						{
						}
						string text5 = text4;
						string text6 = ((text2 == currentTagFilter) ? ("<size=14><b><color=" + text5 + ">" + text + "</color></b></size>") : ("<size=14><color=" + text5 + "50>" + text + "</color></size>"));
						((TMP_Text)value.labelTMP).text = text6;
					}
				}
			}
			catch (Exception ex)
			{
				ManualLogSource? logger = Logger;
				if (logger != null)
				{
					logger.LogError((object)("更新标签按钮高亮状态时出错: " + ex.Message));
				}
			}
		}

		private static void OnDecorationButtonClick(string? decorationName)
		{
			string decorationName2 = decorationName;
			try
			{
				DecorationInfo decorationInfo = HeadDecorationManager.Decorations.FirstOrDefault((DecorationInfo d) => d.Name != null && d.Name.Equals(decorationName2, StringComparison.OrdinalIgnoreCase));
				if (decorationInfo == null)
				{
					ManualLogSource? logger = Logger;
					if (logger != null)
					{
						logger.LogWarning((object)("OnDecorationButtonClick: 找不到装饰物: " + decorationName2));
					}
					return;
				}
				bool isEnabled = HeadDecorationManager.ToggleDecorationState(decorationName2);
				string buttonText = GetButtonText(decorationInfo, isEnabled);
				string[] aLL_TAGS = ALL_TAGS;
				foreach (string text in aLL_TAGS)
				{
					bool flag = false;
					if (text == "ALL")
					{
						flag = true;
					}
					else if (text == "LIMBS" && LIMB_TAGS.Contains(decorationInfo.ParentTag?.ToUpper()))
					{
						flag = true;
					}
					else if (decorationInfo.ParentTag?.ToUpper() == text)
					{
						flag = true;
					}
					if (flag && buttonTextCache.TryGetValue(text, out Dictionary<string, string> value))
					{
						value[decorationName2 ?? string.Empty] = buttonText;
					}
				}
				if (decorationButtons.TryGetValue(decorationName2 ?? string.Empty, out REPOButton value2))
				{
					((TMP_Text)value2.labelTMP).text = buttonText;
					if (buttonMarkers.TryGetValue(decorationName2 ?? string.Empty, out DecorationButtonMarker value3) && value3?.Decoration != null && !string.IsNullOrEmpty(value3.Decoration.ModName) && !((TMP_Text)value2.labelTMP).text.Contains(value3.Decoration.ModName))
					{
						((TMP_Text)value2.labelTMP).text = ((TMP_Text)value2.labelTMP).text + " <size=12><color=#AAAAAA>- " + value3.Decoration.ModName + "</color></size>";
					}
				}
				UpdateDecorations();
				ConfigManager.SaveConfig();
			}
			catch (Exception ex)
			{
				ManualLogSource? logger2 = Logger;
				if (logger2 != null)
				{
					logger2.LogError((object)("切换装饰物 " + decorationName2 + " 状态时出错: " + ex.Message));
				}
			}
		}

		private static string GetButtonText(DecorationInfo decoration, bool isEnabled)
		{
			string text = decoration.DisplayName?.ToUpper() ?? "UNKNOWN";
			string text2 = decoration.ParentTag ?? "unknown";
			string text3 = text2.ToLower();
			if (1 == 0)
			{
			}
			string text4 = text3 switch
			{
				"head" => "#00AAFF", 
				"neck" => "#AA00FF", 
				"body" => "#FFAA00", 
				"hip" => "#FF00AA", 
				"leftarm" => "#88CC88", 
				"rightarm" => "#88CC88", 
				"leftleg" => "#88BBEE", 
				"rightleg" => "#88BBEE", 
				"world" => "#00FFAA", 
				_ => "#AAAAAA", 
			};
			if (1 == 0)
			{
			}
			string text5 = text4;
			string text6 = "";
			if (LIMB_TAGS.Contains(text2.ToUpper()))
			{
				string text7 = text2.ToLower();
				if (1 == 0)
				{
				}
				text4 = text7 switch
				{
					"leftarm" => "L-ARM", 
					"rightarm" => "R-ARM", 
					"leftleg" => "L-LEG", 
					"rightleg" => "R-LEG", 
					_ => text2, 
				};
				if (1 == 0)
				{
				}
				string text8 = text4;
				text6 = "<color=" + text5 + "><size=12>(" + text8 + ")</size></color> ";
			}
			else
			{
				text6 = "<color=" + text5 + "><size=12>(" + text2 + ")</size></color> ";
			}
			return "<size=16>" + (isEnabled ? "<color=#00FF00>[+]</color>" : "<color=#FF0000>[-]</color>") + " " + text6 + text + "</size>";
		}

		private static void OnCloseButtonClick()
		{
			try
			{
				MenuManager.instance.PageCloseAll();
			}
			catch (Exception ex)
			{
				ManualLogSource? logger = Logger;
				if (logger != null)
				{
					logger.LogError((object)("关闭页面时出错: " + ex.Message));
				}
			}
		}

		private static void UpdateDecorations()
		{
			try
			{
				PlayerAvatar val = FindLocalPlayer();
				if ((Object)(object)val != (Object)null)
				{
					PlayerUpdatePatch.UpdatePlayerDecorations(val);
					HeadDecorationSync component = ((Component)val).GetComponent<HeadDecorationSync>();
					if ((Object)(object)component != (Object)null)
					{
						component.SyncAllDecorations();
					}
				}
				PlayerUpdatePatch.UpdateMenuPlayerDecorations();
			}
			catch (Exception ex)
			{
				ManualLogSource? logger = Logger;
				if (logger != null)
				{
					logger.LogError((object)("更新装饰物状态时出错: " + ex.Message));
				}
			}
		}

		private static PlayerAvatar? FindLocalPlayer()
		{
			try
			{
				PlayerAvatar[] array = Object.FindObjectsOfType<PlayerAvatar>();
				PlayerAvatar[] array2 = array;
				foreach (PlayerAvatar val in array2)
				{
					if ((Object)(object)val?.photonView != (Object)null && val.photonView.IsMine)
					{
						return val;
					}
				}
			}
			catch (Exception ex)
			{
				ManualLogSource? logger = Logger;
				if (logger != null)
				{
					logger.LogError((object)("查找本地玩家时出错: " + ex.Message));
				}
			}
			return null;
		}

		private static void UpdateAvatarPreview()
		{
			try
			{
				if (!((Object)(object)decorationsPage == (Object)null))
				{
					if ((Object)(object)avatarPreview != (Object)null)
					{
						SafeDestroyAvatar();
					}
					CreateAvatarPreview(decorationsPage);
				}
			}
			catch (Exception ex)
			{
				ManualLogSource? logger = Logger;
				if (logger != null)
				{
					logger.LogError((object)("更新头像预览时出错: " + ex.Message));
				}
			}
		}

		private static void CreateAvatarPreview(REPOPopupPage page)
		{
			//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)
			//IL_0022: Expected O, but got Unknown
			try
			{
				object obj = <>c.<>9__33_0;
				if (obj == null)
				{
					BuilderDelegate val = delegate(Transform parent)
					{
						//IL_000c: Unknown result type (might be due to invalid IL or missing references)
						avatarPreview = MenuAPI.CreateREPOAvatarPreview(parent, new Vector2(420f, 10f), false, (Color?)null);
					};
					<>c.<>9__33_0 = val;
					obj = (object)val;
				}
				page.AddElement((BuilderDelegate)obj);
			}
			catch (Exception ex)
			{
				ManualLogSource? logger = Logger;
				if (logger != null)
				{
					logger.LogError((object)("创建头像预览时出错: " + ex.Message));
				}
			}
		}

		public static void SafeDestroyAvatar()
		{
			try
			{
				if ((Object)(object)avatarPreview != (Object)null)
				{
					if ((Object)(object)((Component)avatarPreview).transform != (Object)null && (Object)(object)((Component)avatarPreview).transform.parent != (Object)null)
					{
						((Component)avatarPreview).transform.SetParent((Transform)null, false);
					}
					PlayerAvatarVisuals playerAvatarVisuals = avatarPreview.playerAvatarVisuals;
					if ((Object)(object)playerAvatarVisuals != (Object)null)
					{
					}
					if ((Object)(object)((Component)avatarPreview).gameObject != (Object)null)
					{
						Object.Destroy((Object)(object)((Component)avatarPreview).gameObject);
					}
					avatarPreview = null;
				}
			}
			catch (Exception ex)
			{
				ManualLogSource? logger = Logger;
				if (logger != null)
				{
					logger.LogWarning((object)("安全销毁头像预览时出错,但这不影响功能: " + ex.Message));
				}
				avatarPreview = null;
			}
		}

		private static void OnDisableAllButtonClick()
		{
			try
			{
				HeadDecorationManager.DisableAllDecorations();
				string[] aLL_TAGS = ALL_TAGS;
				foreach (string text in aLL_TAGS)
				{
					if (!buttonTextCache.TryGetValue(text, out Dictionary<string, string> value))
					{
						continue;
					}
					foreach (DecorationInfo decoration in HeadDecorationManager.Decorations)
					{
						bool flag = false;
						if (text == "ALL")
						{
							flag = true;
						}
						else if (text == "LIMBS" && LIMB_TAGS.Contains(decoration.ParentTag?.ToUpper()))
						{
							flag = true;
						}
						else if (decoration.ParentTag?.ToUpper() == text)
						{
							flag = true;
						}
						if (flag)
						{
							string buttonText = GetButtonText(decoration, isEnabled: false);
							value[decoration.Name ?? string.Empty] = buttonText;
						}
					}
				}
				foreach (DecorationInfo decoration2 in HeadDecorationManager.Decorations)
				{
					if (decorationButtons.TryGetValue(decoration2.Name ?? string.Empty, out REPOButton value2))
					{
						((TMP_Text)value2.labelTMP).text = GetButtonText(decoration2, isEnabled: false);
					}
				}
				UpdateDecorations();
				ConfigManager.SaveConfig();
			}
			catch (Exception ex)
			{
				ManualLogSource? logger = Logger;
				if (logger != null)
				{
					logger.LogError((object)("关闭所有装饰物时出错: " + ex.Message));
				}
			}
		}

		public static void RecreateUI()
		{
			try
			{
				decorationDataCache.Clear();
				buttonTextCache.Clear();
				decorationButtons.Clear();
				buttonMarkers.Clear();
				tagScrollViewElements.Clear();
				tagFilterButtons.Clear();
				if ((Object)(object)decorationsPage != (Object)null && (Object)(object)((Component)decorationsPage).gameObject != (Object)null)
				{
					Object.Destroy((Object)(object)((Component)decorationsPage).gameObject);
					decorationsPage = null;
				}
				SafeDestroyAvatar();
				InitializeDataCache();
				ManualLogSource? logger = Logger;
				if (logger != null)
				{
					logger.LogInfo((object)"UI已重新初始化,缓存已重置");
				}
			}
			catch (Exception ex)
			{
				ManualLogSource? logger2 = Logger;
				if (logger2 != null)
				{
					logger2.LogError((object)("重新创建UI时出错: " + ex.Message));
				}
			}
		}

		private static void CreateAllDecorationButtons(REPOPopupPage page)
		{
			try
			{
				decorationButtons.Clear();
				buttonMarkers.Clear();
				tagScrollViewElements.Clear();
				string[] aLL_TAGS = ALL_TAGS;
				foreach (string key in aLL_TAGS)
				{
					tagScrollViewElements[key] = new List<REPOScrollViewElement>();
				}
				List<DecorationInfo> source = HeadDecorationManager.Decorations.ToList();
				List<DecorationInfo> list = (from decoration in source
					where IsBuiltInDecoration(decoration)
					orderby decoration.DisplayName
					select decoration).ToList();
				List<DecorationInfo> list2 = (from decoration in source
					where !IsBuiltInDecoration(decoration)
					orderby decoration.DisplayName
					select decoration).ToList();
				foreach (DecorationInfo item in list)
				{
					CreateDecorationButton(page, item);
				}
				foreach (DecorationInfo item2 in list2)
				{
					CreateDecorationButton(page, item2);
				}
				ManualLogSource? logger = Logger;
				if (logger != null)
				{
					logger.LogInfo((object)$"创建了所有装饰物按钮,总共 {decorationButtons.Count} 个");
				}
			}
			catch (Exception ex)
			{
				ManualLogSource? logger2 = Logger;
				if (logger2 != null)
				{
					logger2.LogError((object)("创建装饰物按钮时出错: " + ex.Message));
				}
			}
		}

		private static void CreateDecorationButton(REPOPopupPage page, DecorationInfo decoration)
		{
			//IL_0191: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a5: Expected O, but got Unknown
			DecorationInfo decoration2 = decoration;
			try
			{
				string decorationName = decoration2.Name;
				string parentTag = decoration2.ParentTag;
				if (string.IsNullOrEmpty(decorationName) || string.IsNullOrEmpty(parentTag))
				{
					ManualLogSource? logger = Logger;
					if (logger != null)
					{
						logger.LogWarning((object)"跳过创建按钮:装饰物名称或标签为空");
					}
					return;
				}
				string buttonText = GetButtonText(decoration2, decoration2.IsVisible);
				string[] aLL_TAGS = ALL_TAGS;
				foreach (string text in aLL_TAGS)
				{
					bool flag = false;
					if (text == "ALL")
					{
						flag = true;
					}
					else if (text == "LIMBS" && LIMB_TAGS.Contains(parentTag.ToUpper()))
					{
						flag = true;
					}
					else if (parentTag.ToUpper() == text)
					{
						flag = true;
					}
					if (flag)
					{
						if (!buttonTextCache.TryGetValue(text, out Dictionary<string, string> value))
						{
							buttonTextCache[text] = new Dictionary<string, string>();
							value = buttonTextCache[text];
						}
						value[decorationName] = buttonText;
					}
				}
				REPOButton repoButton = null;
				page.AddElementToScrollView((ScrollViewBuilderDelegate)delegate(Transform scrollView)
				{
					//IL_002a: 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)
					repoButton = MenuAPI.CreateREPOButton(buttonText, (Action)delegate
					{
						OnDecorationButtonClick(decorationName);
					}, scrollView, default(Vector2));
					DecorationButtonMarker decorationButtonMarker = ((Component)repoButton).gameObject.AddComponent<DecorationButtonMarker>();
					decorationButtonMarker.Decoration = decoration2;
					buttonMarkers[decorationName] = decorationButtonMarker;
					return ((REPOElement)repoButton).rectTransform;
				}, 0f, 0f);
				if ((Object)(object)repoButton != (Object)null)
				{
					decorationButtons[decorationName] = repoButton;
					((REPOElement)repoButton).repoScrollViewElement.visibility = false;
					tagScrollViewElements["ALL"].Add(((REPOElement)repoButton).repoScrollViewElement);
					List<REPOScrollViewElement> value2;
					if (LIMB_TAGS.Contains(parentTag.ToUpper()))
					{
						tagScrollViewElements["LIMBS"].Add(((REPOElement)repoButton).repoScrollViewElement);
					}
					else if (tagScrollViewElements.TryGetValue(parentTag.ToUpper(), out value2))
					{
						value2.Add(((REPOElement)repoButton).repoScrollViewElement);
					}
				}
			}
			catch (Exception ex)
			{
				ManualLogSource? logger2 = Logger;
				if (logger2 != null)
				{
					logger2.LogError((object)("创建装饰物按钮时出错: " + ex.Message));
				}
			}
		}

		private static void AddActionButtons(REPOPopupPage page)
		{
			//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)
			//IL_0022: Expected O, but got Unknown
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Expected O, but got Unknown
			try
			{
				object obj = <>c.<>9__39_0;
				if (obj == null)
				{
					BuilderDelegate val = delegate(Transform parent)
					{
						//IL_002c: Unknown result type (might be due to invalid IL or missing references)
						MenuAPI.CreateREPOButton("<size=18><color=#FFFFFF>C</color><color=#E6E6E6>L</color><color=#CCCCCC>O</

Mods/MoreShopItems.dll

Decompiled a year 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.2.9.0")]
[assembly: AssemblyInformationalVersion("1.2.9")]
[assembly: AssemblyProduct("More Shop Items")]
[assembly: AssemblyTitle("MoreShopItems")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.2.9.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.2.9")]
	[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));
			Logger.LogInfo((object)"\n __  __               ___ _               ___ _                \n|  \\/  |___ _ _ ___  / __| |_  ___ _ __  |_ _| |_ ___ _ __  ___\n| |\\/| / _ \\ '_/ -_) \\__ \\ ' \\/ _ \\ '_ \\  | ||  _/ -_) '  \\(_-<\n|_|  |_\\___/_| \\___| |___/_||_\\___/ .__/ |___|\\__\\___|_|_|_/__/\n                                  |_|                    v1.2.9\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], 0, 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], 0, 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], 0, 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], 0, 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], 0, 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], 0, 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], 0, 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], 0, 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], 0, 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], 0, 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));
		}

		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_0079: 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_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)
			//IL_0170: Unknown result type (might be due to invalid IL or missing references)
			//IL_017c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0190: Unknown result type (might be due to invalid IL or missing references)
			//IL_0195: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0208: Unknown result type (might be due to invalid IL or missing references)
			//IL_021c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0221: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cd: 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_02e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e8: 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_02fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0303: 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_0323: Unknown result type (might be due to invalid IL or missing references)
			//IL_0328: Unknown result type (might be due to invalid IL or missing references)
			//IL_0386: Unknown result type (might be due to invalid IL or missing references)
			//IL_0392: Unknown result type (might be due to invalid IL or missing references)
			//IL_039c: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a1: 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_03b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_03bc: 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_03dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e1: Unknown result type (might be due to invalid IL or missing references)
			if (!(RunManager.instance.levelCurrent.ResourcePath == "Shop"))
			{
				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_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: 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_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Expected I4, but got Unknown
			//IL_027b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0281: Invalid comparison between Unknown and I4
			//IL_0287: Unknown result type (might be due to invalid IL or missing references)
			//IL_028d: Invalid comparison between Unknown and I4
			//IL_0291: Unknown result type (might be due to invalid IL or missing references)
			//IL_0298: 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;
			foreach (Item value in StatsManager.instance.itemDictionary.Values)
			{
				int maxInShop = 0;
				int maxPurchaseAmount = 0;
				itemType itemType = value.itemType;
				itemType val = itemType;
				switch ((int)val)
				{
				case 0:
					maxInShop = intConfigEntries["Max Drones In Shop"].Value;
					maxPurchaseAmount = intConfigEntries["Max Drone Purchase Amount"].Value;
					break;
				case 1:
					maxInShop = intConfigEntries["Max Orbs In Shop"].Value;
					maxPurchaseAmount = intConfigEntries["Max Orb Purchase Amount"].Value;
					break;
				case 3:
					maxInShop = intConfigEntries["Max Upgrades In Shop"].Value;
					maxPurchaseAmount = intConfigEntries["Max Upgrade Purchase Amount"].Value;
					break;
				case 5:
					maxInShop = intConfigEntries["Max Crystals In Shop"].Value;
					maxPurchaseAmount = intConfigEntries["Max Crystal Purchase Amount"].Value;
					break;
				case 6:
					maxInShop = intConfigEntries["Max Grenades In Shop"].Value;
					maxPurchaseAmount = intConfigEntries["Max Grenade Purchase Amount"].Value;
					break;
				case 7:
					maxInShop = intConfigEntries["Max Melee Weapons In Shop"].Value;
					maxPurchaseAmount = intConfigEntries["Max Melee Weapon Purchase Amount"].Value;
					break;
				case 8:
					maxInShop = intConfigEntries["Max Health-Packs In Shop"].Value;
					maxPurchaseAmount = intConfigEntries["Max Health-Pack Purchase Amount"].Value;
					break;
				case 9:
					maxInShop = intConfigEntries["Max Guns In Shop"].Value;
					maxPurchaseAmount = intConfigEntries["Max Gun Purchase Amount"].Value;
					break;
				case 10:
					maxInShop = intConfigEntries["Max Trackers In Shop"].Value;
					maxPurchaseAmount = intConfigEntries["Max Tracker Purchase Amount"].Value;
					break;
				case 11:
					maxInShop = intConfigEntries["Max Mines In Shop"].Value;
					maxPurchaseAmount = intConfigEntries["Max Mine Purchase Amount"].Value;
					break;
				default:
					maxInShop = 5;
					maxPurchaseAmount = 0;
					continue;
				case 4:
					break;
				}
				bool flag = (int)value.itemType == 3;
				if ((int)value.itemType == 2 || (int)value.itemType == 12)
				{
					continue;
				}
				if (boolConfigEntries["Override Modded Items"].Value)
				{
					if (boolConfigEntries["Override Single-Use Upgrades"].Value && flag)
					{
						Plugin.Logger.LogInfo((object)("Result M-SU-U: " + value.itemAssetName));
						SetItemValues(value, maxInShop, maxPurchaseAmount);
					}
					else if (value.maxPurchase)
					{
						if (!flag)
						{
							Plugin.Logger.LogInfo((object)("Result M-MP-I: " + value.itemAssetName));
							SetItemValues(value, maxInShop, maxPurchaseAmount);
						}
						Plugin.Logger.LogInfo((object)("Result M-MP-U-SKIPPED: " + value.itemAssetName));
					}
					else
					{
						Plugin.Logger.LogInfo((object)("Result M-NMP: " + value.itemAssetName));
						SetItemValues(value, maxInShop, maxPurchaseAmount);
					}
				}
				else if (!MoreUpgradesMOD.isLoaded() || !value.itemAssetName.Contains("Modded Item Upgrade Player"))
				{
					if (boolConfigEntries["Override Single-Use Upgrades"].Value && flag)
					{
						Plugin.Logger.LogInfo((object)("Result NM-SU-U: " + value.itemAssetName));
						SetItemValues(value, maxInShop, maxPurchaseAmount);
					}
					else if (flag && !value.maxPurchase)
					{
						Plugin.Logger.LogInfo((object)("Result NM-NMP-U: " + value.itemAssetName));
						SetItemValues(value, maxInShop, maxPurchaseAmount);
					}
					else if (!flag)
					{
						Plugin.Logger.LogInfo((object)("Result NM-NMP-I: " + value.itemAssetName));
						SetItemValues(value, maxInShop, 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);
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "MoreShopItems";

		public const string PLUGIN_NAME = "More Shop Items";

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

		public static bool isLoaded()
		{
			return Chainloader.PluginInfos.ContainsKey("bulletbot.moreupgrades");
		}
	}
}
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[22]
		{
			"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."
		};

		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>()));
		}
	}
}

Mods/MovePlayers.dll

Decompiled a year 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));
	}
}

Mods/MyLegSoundMod.dll

Decompiled a year 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 BepInEx;
using HarmonyLib;
using Microsoft.CodeAnalysis;
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("MyLegSoundMod")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("MyLegSoundMod")]
[assembly: AssemblyTitle("MyLegSoundMod")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

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

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

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
namespace MyLegSoundMod
{
	[BepInPlugin("com.jarias.mylegsoundmod", "MyLeg Sound Mod", "1.0.0")]
	public class MyLegSoundMod : BaseUnityPlugin
	{
		internal static AssetBundle bundle;

		internal static List<AudioClip> sounds;

		internal static AudioClip myLegSound;

		private void Awake()
		{
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			((BaseUnityPlugin)this).Logger.LogInfo((object)"MyLegSoundMod: Loading bundle...");
			bundle = AssetBundle.LoadFromFile(Path.Combine(Paths.PluginPath, "myleg.bundle"));
			if ((Object)(object)bundle == (Object)null)
			{
				((BaseUnityPlugin)this).Logger.LogError((object)"MyLegSoundMod: Failed to load bundle.");
				return;
			}
			sounds = bundle.LoadAllAssets<AudioClip>().ToList();
			myLegSound = sounds.FirstOrDefault();
			if ((Object)(object)myLegSound != (Object)null)
			{
				((BaseUnityPlugin)this).Logger.LogInfo((object)("MyLegSoundMod: Loaded clip: " + ((Object)myLegSound).name));
			}
			else
			{
				((BaseUnityPlugin)this).Logger.LogWarning((object)"MyLegSoundMod: No AudioClip found in bundle.");
			}
			new Harmony("com.jarias.mylegsoundmod").PatchAll();
		}
	}
}
namespace MyLegSoundMod.Patches
{
	[HarmonyPatch(typeof(PlayerDeathEffects))]
	[HarmonyPatch("Start")]
	public class PlayerDeathEffectsPatch
	{
		[HarmonyPostfix]
		public static void Postfix(PlayerDeathEffects __instance)
		{
			if ((Object)(object)__instance != (Object)null && (Object)(object)MyLegSoundMod.myLegSound != (Object)null)
			{
				__instance.deathSound.Sounds = (AudioClip[])(object)new AudioClip[1] { MyLegSoundMod.myLegSound };
				Debug.Log((object)"MyLegSoundMod: Replaced death sound.");
			}
			else
			{
				Debug.LogWarning((object)"MyLegSoundMod: Could not replace death sound — something is null.");
			}
		}
	}
}

Mods/REPOConfig.dll

Decompiled a year 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 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.1.8")]
[assembly: AssemblyInformationalVersion("1.1.8+3b97423c394940b61392c8a9fabb926e81d675f6")]
[assembly: AssemblyProduct("REPOConfig")]
[assembly: AssemblyTitle("REPOConfig")]
[assembly: AssemblyVersion("1.1.8.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__2_0;

			public static BuilderDelegate <>9__2_1;

			public static BuilderDelegate <>9__2_2;

			public static Action <>9__4_8;

			public static BuilderDelegate <>9__4_4;

			public static ScrollViewBuilderDelegate <>9__4_7;

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

			public static ScrollViewBuilderDelegate <>9__5_2;

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

			internal void <Initialize>b__2_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__2_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__2_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 <CreateModList>b__4_4(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__4_8()
			{
				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__4_7(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__5_0(ConfigEntryBase entry)
			{
				return entry.Definition.Section;
			}

			internal RectTransform <CreateModEntries>b__5_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 ConfigEntryBase <GetModConfigEntries>b__6_0(KeyValuePair<ConfigDefinition, ConfigEntryBase> configEntry)
			{
				return configEntry.Value;
			}
		}

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

		internal static REPOButton lastClickedModButton;

		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__2_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__2_0 = val;
				obj = (object)val;
			}
			MenuAPI.AddElementToMainMenu((BuilderDelegate)obj);
			object obj2 = <>c.<>9__2_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__2_1 = val2;
				obj2 = (object)val2;
			}
			MenuAPI.AddElementToLobbyMenu((BuilderDelegate)obj2);
			object obj3 = <>c.<>9__2_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__2_2 = val3;
				obj3 = (object)val3;
			}
			MenuAPI.AddElementToEscapeMenu((BuilderDelegate)obj3);
		}

		private static void CreateModMenu()
		{
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Expected O, but got Unknown
			changedEntries.Clear();
			lastClickedModButton = null;
			REPOPopupPage repoPopupPage = MenuAPI.CreateREPOPopupPage("Mods", (PresetSide)0, false, true, 0f);
			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_001e: Unknown result type (might be due to invalid IL or missing references)
					if (changedEntries.Count == 0)
					{
						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();
						}, (Action)null);
					}
				}, parent, new Vector2(66f, 18f));
			});
			CreateModList(repoPopupPage);
			repoPopupPage.OpenPage(false);
		}

		private static void CreateModList(REPOPopupPage mainModPage)
		{
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Expected O, but got Unknown
			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();
								}, (Action)null);
							}
						}
					};
					return ((REPOElement)modButton).rectTransform;
					void OpenPage()
					{
						//IL_004a: Unknown result type (might be due to invalid IL or missing references)
						//IL_004f: Unknown result type (might be due to invalid IL or missing references)
						//IL_0055: Expected O, but got Unknown
						//IL_0091: Unknown result type (might be due to invalid IL or missing references)
						//IL_00a5: Expected O, but got Unknown
						//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_0079: Expected O, but got Unknown
						//IL_007e: Expected O, but got Unknown
						//IL_00bf: 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_00ca: Expected O, but got Unknown
						MenuAPI.CloseAllPagesAddedOnTop();
						REPOPopupPage modPage = MenuAPI.CreateREPOPopupPage(modName, (PresetSide)1, false, false, 5f);
						REPOPopupPage obj3 = modPage;
						object obj4 = <>c.<>9__4_4;
						if (obj4 == null)
						{
							BuilderDelegate val3 = 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 (val10, boxedValue) = (KeyValuePair<ConfigEntryBase, object>)(ref keyValuePair2);
										val10.BoxedValue = boxedValue;
									}
								}, mainPageParent, new Vector2(370f, 18f));
							};
							<>c.<>9__4_4 = val3;
							obj4 = (object)val3;
						}
						obj3.AddElement((BuilderDelegate)obj4);
						REPOPopupPage obj5 = modPage;
						BuilderDelegate obj6 = val2;
						if (obj6 == null)
						{
							BuilderDelegate val4 = 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;
										modButton.onClick();
									}
								}, mainPageParent, new Vector2(585f, 18f));
							};
							BuilderDelegate val5 = val4;
							val2 = val4;
							obj6 = val5;
						}
						obj5.AddElement(obj6);
						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 val8 = 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)val8).rectTransform;
							Rect rect = modPage.maskRectTransform.rect;
							((Transform)rectTransform).localPosition = Vector2.op_Implicit(new Vector2((((Rect)(ref rect)).width - val8.GetLabelSize().x) * 0.5f, 0f));
							return ((REPOElement)val8).rectTransform;
						}, 0f, 0f);
						REPOPopupPage obj7 = modPage;
						object obj8 = <>c.<>9__4_7;
						if (obj8 == null)
						{
							ScrollViewBuilderDelegate val6 = 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 val7 = default(Vector2);
								((Vector2)(ref val7))..ctor(0f, 10f);
								return ((REPOElement)MenuAPI.CreateREPOSpacer(scrollView, default(Vector2), val7)).rectTransform;
							};
							<>c.<>9__4_7 = val6;
							obj8 = (object)val6;
						}
						obj7.AddElementToScrollView((ScrollViewBuilderDelegate)obj8, 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_0355: Unknown result type (might be due to invalid IL or missing references)
			//IL_035a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0360: Expected O, but got Unknown
			//IL_017c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0190: Expected O, but got Unknown
			//IL_01b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c7: Expected O, but got Unknown
			//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fe: Expected O, but got Unknown
			//IL_026d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0281: Expected O, but got Unknown
			//IL_030b: Unknown result type (might be due to invalid IL or missing references)
			//IL_031f: 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_0058: 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)
										REPOSlider val9 = 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)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;
								}
								AcceptableValueBase acceptableValues = entry2.Description.AcceptableValues;
								AcceptableValueList<string> acceptableValueList = acceptableValues as AcceptableValueList<string>;
								if (acceptableValueList == null)
								{
									continue;
								}
								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 val8 = MenuAPI.CreateREPOSlider(modName, description, (Action<string>)delegate(string s)
									{
										changedEntries[entry2] = s;
									}, scrollView, acceptableValueList.AcceptableValues, (string)entry2.BoxedValue, default(Vector2), "", "", (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_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> val6)
								{
									num9 = val6.MinValue;
									num10 = val6.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 val7 = MenuAPI.CreateREPOSlider(text4, text5, obj5, scrollView, default(Vector2), num13, num14, num12, "", "", (BarBehavior)0);
								if (description.Length <= 43)
								{
									return ((REPOElement)val7).rectTransform;
								}
								((TMP_Text)val7.descriptionTMP).maxVisibleCharacters = (val7.repoTextScroller.maxCharacters = 43);
								val7.repoTextScroller.scrollingSpeedInSecondsPerCharacter = Entry.descriptionScrollSpeed.Value;
								val7.repoTextScroller.endWaitTime = (val7.repoTextScroller.initialWaitTime = 5f);
								val7.repoTextScroller.startWaitTime = 3f;
								((TMP_Text)val7.descriptionTMP).alignment = (TextAlignmentOptions)513;
								((MonoBehaviour)modPage).StartCoroutine(val7.repoTextScroller.Animate());
								return ((REPOElement)val7).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> val4)
							{
								num2 = val4.MinValue;
								num3 = val4.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 val5 = MenuAPI.CreateREPOSlider(text2, text3, obj4, scrollView, default(Vector2), num6, num7, num8, num5, "", "", (BarBehavior)0);
							if (description.Length <= 43)
							{
								return ((REPOElement)val5).rectTransform;
							}
							((TMP_Text)val5.descriptionTMP).maxVisibleCharacters = (val5.repoTextScroller.maxCharacters = 43);
							val5.repoTextScroller.scrollingSpeedInSecondsPerCharacter = Entry.descriptionScrollSpeed.Value;
							val5.repoTextScroller.endWaitTime = (val5.repoTextScroller.initialWaitTime = 5f);
							val5.repoTextScroller.startWaitTime = 3f;
							((TMP_Text)val5.descriptionTMP).alignment = (TextAlignmentOptions)513;
							((MonoBehaviour)modPage).StartCoroutine(val5.repoTextScroller.Animate());
							return ((REPOElement)val5).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__5_2;
				if (obj2 == null)
				{
					ScrollViewBuilderDelegate val2 = 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 val3 = default(Vector2);
						((Vector2)(ref val3))..ctor(0f, 20f);
						return ((REPOElement)MenuAPI.CreateREPOSpacer(scrollView, default(Vector2), val3)).rectTransform;
					};
					<>c.<>9__5_2 = val2;
					obj2 = (object)val2;
				}
				obj.AddElementToScrollView((ScrollViewBuilderDelegate)obj2, 0f, 0f);
			}
		}

		private static Dictionary<string, ConfigEntryBase[]> GetModConfigEntries()
		{
			Dictionary<string, ConfigEntryBase[]> dictionary = new Dictionary<string, ConfigEntryBase[]>();
			foreach (PluginInfo value in Chainloader.PluginInfos.Values)
			{
				List<ConfigEntryBase> list = new List<ConfigEntryBase>();
				foreach (ConfigEntryBase item in ((IEnumerable<KeyValuePair<ConfigDefinition, ConfigEntryBase>>)value.Instance.Config).Select((KeyValuePair<ConfigDefinition, ConfigEntryBase> configEntry) => configEntry.Value))
				{
					ConfigDescription description = item.Description;
					object[] array = ((description != null) ? description.Tags : null);
					if (array == null || (!array.Contains("HideREPOConfig") && !array.Contains("HideFromREPOConfig")))
					{
						list.Add(item);
					}
				}
				if (list.Count > 0)
				{
					dictionary.TryAdd(FixNaming(value.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.1.8")]
	[BepInDependency("nickklmao.menulib", "2.1.1")]
	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)
		{
		}
	}
}

Mods/REPOLib.dll

Decompiled a year ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.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 UnityEngine;
using UnityEngine.Audio;

[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("1.5.0.0")]
[assembly: AssemblyInformationalVersion("1.5.0+50992e22330735a42648859858c536480d3930e4")]
[assembly: AssemblyProduct("REPOLib")]
[assembly: AssemblyTitle("REPOLib")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/ZehsTeam/REPOLib")]
[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.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
	{
		public static void LoadAllBundles(string root, string withExtension)
		{
			string[] files = Directory.GetFiles(root, "*" + withExtension, SearchOption.AllDirectories);
			string[] array = files;
			foreach (string text in array)
			{
				string text2 = text.Replace(root, "");
				try
				{
					LoadBundle(text, text2);
				}
				catch (Exception arg)
				{
					Logger.LogError($"Failed to load bundle at {text2}: {arg}");
				}
			}
		}

		public static void LoadBundle(string path, string relativePath)
		{
			AssetBundle val = AssetBundle.LoadFromFile(path);
			Mod[] array = val.LoadAllAssets<Mod>();
			int num = array.Length;
			if (num <= 1)
			{
				if (num == 0)
				{
					throw new Exception("Bundle contains no mods.");
				}
				Mod mod = array[0];
				Logger.LogInfo("Loading content from bundle at " + relativePath + " (" + mod.Identifier + ")");
				Content[] array2 = val.LoadAllAssets<Content>();
				Content[] array3 = array2;
				foreach (Content content in array3)
				{
					try
					{
						content.Initialize(mod);
					}
					catch (Exception arg)
					{
						throw new Exception($"Failed to load {content.Name} ({((object)content).GetType().Name}): {arg}");
					}
				}
				return;
			}
			throw new Exception("Bundle contains more than one mod.");
		}
	}
	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 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.");
			DeveloperMode.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 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 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", "1.5.0")]
	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 = "1.5.0";
	}
}
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
	{
		[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.LogInfo("EnemyBangDirectorPatch: AwakeTranspiler replaced " + methodInfo.Name + " call with " + methodInfo2.Name + ".", extended: true);
				}
				else
				{
					list.Add(instruction);
				}
			}
			return list.AsEnumerable();
		}

		private static IEnumerator PreSetup(EnemyBangDirector instance)
		{
			if (LevelGenerator.Instance.Generated)
			{
				yield return (object)new WaitForSeconds(0.1f);
			}
			yield return instance.Setup();
		}
	}
	[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.RegisterEnemies();
			_alreadyRegistered = true;
		}
	}
	[HarmonyPatch(typeof(EnemyGnomeDirector))]
	internal static class EnemyGnomeDirectorPatch
	{
		[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.LogInfo("EnemyGnomeDirectorPatch: AwakeTranspiler replaced " + methodInfo.Name + " call with " + methodInfo2.Name + ".", extended: true);
				}
				else
				{
					list.Add(instruction);
				}
			}
			return list.AsEnumerable();
		}

		private static IEnumerator PreSetup(EnemyGnomeDirector instance)
		{
			if (LevelGenerator.Instance.Generated)
			{
				yield return (object)new WaitForSeconds(0.1f);
			}
			yield return instance.Setup();
		}
	}
	[HarmonyPatch(typeof(RunManager))]
	internal static class RunManagerPatch
	{
		private static bool _patchedAwake;

		[HarmonyPatch("Awake")]
		[HarmonyPostfix]
		[HarmonyPriority(0)]
		private static void AwakePatch()
		{
			if (!_patchedAwake)
			{
				_patchedAwake = true;
				NetworkPrefabs.Initialize();
				NetworkingEvents.Initialize();
				Valuables.RegisterValuables();
				CommandManager.Initialize();
			}
		}
	}
	[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 var 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 && !SteamManager.instance.developerMode)
				{
					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.DeveloperMode == null || (Object)(object)SteamManager.instance == (Object)null)
			{
				return;
			}
			bool value = ConfigManager.DeveloperMode.Value;
			if (SteamManager.instance.developerMode != value)
			{
				if (value)
				{
					Logger.LogInfo("Enabling developer mode in SteamManager.");
				}
				else
				{
					Logger.LogInfo("Disabling developer mode in SteamManager.");
				}
			}
			SteamManager.instance.developerMode = value;
		}
	}
}
namespace REPOLib.Objects
{
	public class CustomPrefabPool : IPunPrefabPool
	{
		public readonly Dictionary<string, GameObject> Prefabs = new Dictionary<string, GameObject>();

		private DefaultPool _defaultPool;

		private IPunPrefabPool _otherPool;

		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 IPunPrefabPool OtherPool
		{
			get
			{
				return _otherPool;
			}
			set
			{
				if (!(value is DefaultPool) && !(value is CustomPrefabPool))
				{
					_otherPool = 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 var 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.LogInfo("CustomPrefabPool: registered network prefab \"" + prefabId + "\"", extended: true);
			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_0018: 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_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_006c: 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_0038: 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)
			GameObject val;
			if (!Prefabs.TryGetValue(prefabId, out var value, ignoreKeyCase: true))
			{
				val = DefaultPool.Instantiate(prefabId, position, rotation);
				if ((Object)(object)val == (Object)null && OtherPool != null)
				{
					val = OtherPool.Instantiate(prefabId, position, rotation);
				}
				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 => ((Object)Setup).name;

		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 => ((Object)Prefab).name;

		public override void Initialize(Mod mod)
		{
			_prefab.item.prefab = ((Component)_prefab).gameObject;
			Items.RegisterItem(Prefab.item);
		}
	}
	[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-1.5.0" };

		[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.GenericValuablePresetName };

		public ValuableObject Prefab => _prefab;

		public IReadOnlyList<string> ValuablePresets => _valuablePresets;

		public override string Name => ((Object)Prefab).name;

		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 _canRegisterEnemies = true;

		public static IReadOnlyList<EnemySetup> AllEnemies => GetEnemies();

		public static IReadOnlyList<EnemySetup> RegisteredEnemies => _enemiesRegistered;

		internal static void RegisterEnemies()
		{
			if (!_canRegisterEnemies)
			{
				return;
			}
			EnemyParent val = default(EnemyParent);
			foreach (EnemySetup item in _enemiesToRegister)
			{
				if (!_enemiesRegistered.Contains(item) && item.spawnObjects[0].TryGetComponent<EnemyParent>(ref val))
				{
					if (EnemyDirector.instance.AddEnemy(item))
					{
						_enemiesRegistered.Add(item);
						Logger.LogInfo("Added enemy \"" + ((Object)item.spawnObjects[0]).name + "\" to difficulty " + ((object)(Difficulty)(ref val.difficulty)).ToString(), extended: true);
					}
					else
					{
						Logger.LogWarning("Failed to add enemy \"" + ((Object)item.spawnObjects[0]).name + "\" to difficulty " + ((object)(Difficulty)(ref val.difficulty)).ToString(), extended: true);
					}
				}
			}
			_enemiesToRegister.Clear();
			_canRegisterEnemies = false;
		}

		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 (!_canRegisterEnemies)
			{
				Logger.LogError("Failed to register enemy \"" + enemyParent.enemyName + "\". You can only register enemies in awake!");
			}
			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);
			}
			_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_023e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0191: 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 var 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);
					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, 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, 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 _canRegisterItems = true;

		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)
			{
				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);
				}
			}
			_canRegisterItems = false;
		}

		public static void RegisterItem(Item item)
		{
			if ((Object)(object)item == (Object)null)
			{
				throw new ArgumentException("Failed to register item. Item is null.");
			}
			if ((Object)(object)item.prefab == (Object)null)
			{
				Logger.LogError("Failed to register item \"" + item.itemName + "\". Item prefab is null.");
				return;
			}
			if (item.itemAssetName != ((Object)item.prefab).name)
			{
				Logger.LogError("Failed to register item \"" + item.itemName + "\". Item itemAssetName does not match the prefab name.");
				return;
			}
			if (!_canRegisterItems)
			{
				Logger.LogError("Failed to register item \"" + item.itemName + "\". You can only register items from your plugins awake!");
				return;
			}
			if (ResourcesHelper.HasItemPrefab(item))
			{
				Logger.LogError("Failed to register item \"" + item.itemName + "\". Item prefab already exists in Resources with the same name.");
				return;
			}
			if (_itemsToRegister.Any((Item x) => x.itemAssetName == item.itemAssetName))
			{
				Logger.LogError("Failed to register item \"" + item.itemName + "\". Item prefab already exists with the same name.");
				return;
			}
			if (_itemsToRegister.Contains(item))
			{
				Logger.LogError("Failed to register item \"" + item.itemName + "\". Item is already registered!");
				return;
			}
			string itemPrefabPath = ResourcesHelper.GetItemPrefabPath(item);
			NetworkPrefabs.RegisterNetworkPrefab(itemPrefabPath, item.prefab);
			Utilities.FixAudioMixerGroups(item.prefab);
			_itemsToRegister.Add(item);
		}

		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, 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, 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 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)
		{
			_customEvents.FirstOrDefault((NetworkedEvent e) => e.EventCode == photonEvent.Code)?.EventAction?.Invoke(photonEvent);
		}

		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.LogInfo($"PhotonNetwork.PrefabPool = {((object)PhotonNetwork.PrefabPool).GetType()}", extended: true);
			IPunPrefabPool prefabPool = PhotonNetwork.PrefabPool;
			DefaultPool val = (DefaultPool)(object)((prefabPool is DefaultPool) ? prefabPool : null);
			if (val != null)
			{
				CustomPrefabPool.DefaultPool = val;
			}
			else
			{
				CustomPrefabPool.OtherPool = PhotonNetwork.PrefabPool;
			}
			PhotonNetwork.PrefabPool = (IPunPrefabPool)(object)CustomPrefabPool;
			Logger.LogInfo("Replaced PhotonNetwork.PrefabPool with CustomPrefabPool.");
			Logger.LogInfo($"PhotonNetwork.PrefabPool = {((object)PhotonNetwork.PrefabPool).GetType()}", extended: true);
			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 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 Path.Combine("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 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 Path.Combine(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 Path.Combine(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 Path.Combine(enemiesFolderPath, ((Object)mainSpawnObject).name);
		}

		public static string GetEnemyPrefabPath(GameObject prefab)
		{
			if ((Object)(object)prefab == (Object)null)
			{
				return string.Empty;
			}
			string enemiesFolderPath = GetEnemiesFolderPath();
			return Path.Combine(enemiesFolderPath, ((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);
			}
		}
	}
	public static class Valuables
	{
		private static readonly Dictionary<string, LevelValuables> _valuablePresets = new Dictionary<string, LevelValuables>();

		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 _canRegisterValuables = true;

		public static IReadOnlyList<GameObject> AllValuables => GetValuables();

		public static IReadOnlyList<GameObject> RegisteredValuables => _valuablesRegistered;

		public static IReadOnlyList<LevelValuables> ValuablePresets => _valuablePresets.Values.ToList();

		public static string GenericValuablePresetName => "Valuables - Generic";

		private 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 RegisterValuables()
		{
			if (!_canRegisterValuables)
			{
				return;
			}
			CacheValuablePresets();
			if (_valuablePresets.Count == 0)
			{
				Logger.LogError("Failed to register valuables. LevelValuables list is empty!");
				return;
			}
			Logger.LogInfo("Adding valuables to valuable presets.");
			foreach (GameObject key in _valuablesToRegister.Keys)
			{
				if (_valuablesRegistered.Contains(key))
				{
					continue;
				}
				List<string> list = _valuablesToRegister[key];
				if (!list.Any((string x) => _valuablePresets.Keys.Any((string y) => x == y)))
				{
					Logger.LogError("Valuable \"" + ((Object)key).name + "\" does not have any valid valuable preset names set. Adding generic valuable preset name.");
					list.Add(GenericValuablePresetName);
				}
				foreach (string item in list)
				{
					if (item == null || !_valuablePresets.ContainsKey(item))
					{
						Logger.LogError("Failed to add valuable \"" + ((Object)key).name + "\" to valuable preset \"" + item + "\". The valuable preset does not exist.");
					}
					else if (_valuablePresets[item].AddValuable(key))
					{
						_valuablesRegistered.Add(key);
						Logger.LogInfo("Added valuable \"" + ((Object)key).name + "\" to valuable preset \"" + item + "\"", extended: true);
					}
					else
					{
						Logger.LogWarning("Failed to add valuable \"" + ((Object)key).name + "\" to valuable preset \"" + item + "\"", extended: true);
					}
				}
			}
			_valuablesToRegister.Clear();
			_canRegisterValuables = false;
		}

		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)
			{
				presetNames = new List<string>(1) { GenericValuablePresetName };
			}
			if (!_canRegisterValuables)
			{
				Logger.LogError("Failed to register valuable \"" + ((Object)prefab).name + "\". You can only register valuables from your plugins awake!");
				return;
			}
			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 (_valuablesToRegister.Keys.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 (_valuablesToRegister.ContainsKey(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);
		}

		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>();
			}
			if (_valuablePresets.Count == 0)
			{
				CacheValuablePresets();
			}
			return _valuablePresets.Values.Select((LevelValuables levelValuables) => levelValuables.GetCombinedList()).SelectMany((List<GameObject> list) => list).Distinct()
				.ToList();
		}

		public static bool TryGetValuableByName(string name, 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, 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.LogInfo("Fixed AudioMixerGroup on GameObject \"" + text + "\". AudioMixerGroup \"" + ((Object)val).name + "/" + ((Object)val2).name + "\"", extended: true);
		}
	}
	public static class DictionaryExtensions
	{
		public static bool TryGetKey<TKey, TValue>(this Dictionary<TKey, TValue> dictionary, TValue value, 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 var 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 var 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, 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 var 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 var 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 var 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 var list) && !list.Contains(enemySetup))
				{
					list.Add(enemySetup);
					return true;
				}
			}
			return false;
		}

		public static bool TryGetList(this EnemyDirector enemyDirector, Difficulty difficultyType, 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, out EnemySetup enemySetup)
		{
			enemySetup = enemyDirector.GetEnemyByName(name);
			return (Object)(object)enemySetup != (Object)null;
		}

		public static EnemySetup GetEnemyByName(this EnemyDirector enemyDirector, string name)
		{
			return ((IEnumerable<EnemySetup>)enemyDirector.GetEnemies()).FirstOrDefault((Func<EnemySetup, bool>)((EnemySetup x) => x.NameEquals(name)));
		}

		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)
		{
			return ((IEnumerable<EnemySetup>)enemyDirector.GetEnemies()).FirstOrDefault((Func<EnemySetup, bool>)((EnemySetup x) => x.NameContains(name)));
		}
	}
	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, out EnemyParent enemyParent)
		{
			enemyParent = enemySetup.GetEnemyParent();
			return (Object)(object)enemyParent != (Object)null;
		}

		public static bool AnySpawnObjectsNameEquals(this EnemySetup enemySetup, string name)
		{
			if ((Object)(object)enemySetup == (Object)null)
			{
				return false;
			}
			return enemySetup.GetDistinctSpawnObjects().Any((GameObject x) => ((Object)x).name.Equals(name, StringComparison.OrdinalIgnoreCase));
		}

		public static bool AnySpawnObjectsNameEqualsThatIsNotTheSameObject(this EnemySetup enemySetup, GameObject gameObject)
		{
			if ((Object)(object)enemySetup == (Object)null || (Object)(object)gameObject == (Object)null)
			{
				return false;
			}
			return enemySetup.GetDistinctSpawnObjects().Any((GameObject x) => ((Object)x).name.Equals(((Object)gameObject).name, StringComparison.OrdinalIgnoreCase) && (Object)(object)x != (Object)(object)gameObject);
		}

		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 var enemyParent) && 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 var enemyParent) && 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 var 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 var list))
			{
				return false;
			}
			if (list.Contains(prefab))
			{
				return false;
			}
			list.Add(prefab);
			return true;
		}

		public static bool TryGetList(this LevelValuables levelValuables, Type volumeType, 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 var list))
			{
				return list;
			}
			return new List<GameObject>();
		}
	}
	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)
		{
			return ((IEnumerable<Item>)statsManager.GetItems()).FirstOrDefault((Func<Item, bool>)((Item x) => x.NameEquals(name)));
		}

		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)
		{
			return ((IEnumerable<Item>)statsManager.GetItems()).FirstOrDefault((Func<Item, bool>)((Item x) => x.NameContains(name)));
		}
	}
	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 AppDomain.CurrentDomain.GetAssemblies().SelectMany((Assembly assembly) => assembly.GetTypes()).SelectMany((Type type) => type.GetMethods())
				where method.GetCustomAttribute<CommandInitializerAttribute>() != null
				select method).ToList();
			foreach (MethodInfo commandInitializerMethod in CommandInitializerMethods)
			{
				try
				{
					Logger.LogInfo($"Initializing command initializer on method {commandInitializerMethod.DeclaringType}.{commandInitializerMethod.Name}", extended: true);
					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 AppDomain.CurrentDomain.GetAssemblies().SelectMany((Assembly assembly) => assembly.GetTypes()).SelectMany((Type type) => type.GetMethods())
				where method.GetCustomAttribute<CommandExecutionAttribute>() != null
				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.LogInfo($"Registered command alias \"{item2.Alias}\" for method \"{item.DeclaringType}.{item.Name}\".", extended: true);
						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 item.Module.Assembly.GetTypes()
					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>())
				{
					list.Add(customAttribute3.Alias);
				}
				string text3 = customAttribute.Name ?? "Unknown";
				string text4 = "(Alias(es): [" + string.Join(", ", list) + "])\n\n" + (customAttribute.Description ?? "Unknown");
				bool enabledByDefault = customAttribute.EnabledByDefault;
				CommandsEnabled[text3] = ConfigManager.ConfigFile.Bind<bool>("Commands." + text, text3, enabledByDefault, text4).Value;
			}
		}
	}
	internal static class SpawnEnemyCommand
	{
		[CommandExecution("Spawn Enemy", "Spawn an instance of an enemy with the specified (case-insensitive) name. You can optionally leave out \"Enemy - \" from the prefab name.", true, true)]
		[CommandAlias("spawnenemy")]
		[CommandAlias("se")]
		public static void Execute(string args)
		{
			//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_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			Logger.LogInfo("Running spawn command with args \"" + args + "\"", extended: true);
			if (string.IsNullOrWhiteSpace(args))
			{
				Logger.LogWarning("No args provided to spawn command.");
				return;
			}
			if (!SemiFunc.IsMasterClientOrSingleplayer())
			{
				Logger.LogError("Only the host can spawn enemies!");
				return;
			}
			if ((Object)(object)EnemyDirector.instance == (Object)null)
			{
				Logger.LogError("Failed spawn enemy command, EnemyDirector is not initialized.");
				return;
			}
			if ((Object)(object)LevelGenerator.Instance == (Object)null)
			{
				Logger.LogError("Failed spawn enemy command, LevelGenerator is not initialized.");
				return;
			}
			if ((Object)(object)RunManager.instance == (Object)null)
			{
				Logger.LogError("Failed spawn enemy command, RunManager is not initialized.");
				return;
			}
			if ((Object)(object)PlayerAvatar.instance == (Object)null)
			{
				Logger.LogWarning("Can't spawn anything, player avatar is not initialized.");
				return;
			}
			if (!EnemyDirector.instance.TryGetEnemyThatContainsName(args, out var enemySetup))
			{
				Logger.LogWarning("Spawn command failed. Unknown enemy with name \"" + args + "\"");
				return;
			}
			Vector3 position = ((Component)PlayerAvatar.instance).transform.position;
			Logger.LogInfo($"Trying to spawn enemy \"{args}\" at {position}...", extended: true);
			((MonoBehaviour)EnemyDirector.instance).StartCoroutine(SpawnEnemyAfterTime(enemySetup, position, TimeSpan.FromSeconds(3.0)));
		}

		private static IEnumerator SpawnEnemyAfterTime(EnemySetup enemySetup, Vector3 position, TimeSpan timeSpan)
		{
			//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)
			yield return (object)new WaitForSeconds((float)timeSpan.TotalSeconds);
			Enemies.SpawnEnemy(enemySetup, position, Quaternion.identity, spawnDespawned: false);
		}
	}
	internal static class SpawnItemCommand
	{
		[CommandExecution("Spawn Item", "Spawn an instance of an item with the specified (case-insensitive) name. You can optionally leave out \"Item \" from the prefab name.", true, true)]
		[CommandAlias("spawnitem")]
		[CommandAlias("si")]
		public static void Execute(string args)
		{
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: 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)
			//IL_00b7: 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_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			Logger.LogInfo("Running spawn command with args \"" + args + "\"", extended: true);
			if (string.IsNullOrWhiteSpace(args))
			{
				Logger.LogWarning("No args provided to spawn command.");
				return;
			}
			if (!SemiFunc.IsMasterClientOrSingleplayer())
			{
				Logger.LogError("Only the host can spawn items!");
				return;
			}
			if ((Object)(object)StatsManager.instance == (Object)null)
			{
				Logger.LogError("Failed spawn item command, StatsManager is not initialized.");
				return;
			}
			if ((Object)(object)PlayerAvatar.instance == (Object)null)
			{
				Logger.LogWarning("Can't spawn anything, player avatar is not initialized.");
				return;
			}
			Vector3 val = ((Component)PlayerAvatar.instance).transform.position + new Vector3(0f, 1f, 0f) + ((Component)PlayerAvatar.instance).transform.forward * 1f;
			Logger.LogInfo($"Trying to spawn item \"{args}\" at {val}...", extended: true);
			if (!Items.TryGetItemThatContainsName(args, out var item))
			{
				Logger.LogWarning("Spawn command failed. Unknown item with name \"" + args + "\"");
			}
			else
			{
				Items.SpawnItem(item, val, Quaternion.identity);
			}
		}
	}
	internal static class SpawnValuableCommand
	{
		[CommandExecution("Spawn Valuable", "Spawn an instance of a valuable with the specified (case-insensitive) name. You can optionally leave out \"Valuable \" from the prefab name.", true, true)]
		[CommandAlias("spawnvaluable")]
		[CommandAlias("spawnval")]
		[CommandAlias("sv")]
		public static void Execute(string args)
		{
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: 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)
			//IL_00b7: 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_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			Logger.LogInfo("Running spawn command with args \"" + args + "\"", extended: true);
			if (string.IsNullOrWhiteSpace(args))
			{
				Logger.LogWarning("No args provided to spawn command.");
				return;
			}
			if (!SemiFunc.IsMasterClientOrSingleplayer())
			{
				Logger.LogError("Only the host can spawn valuables!");
				return;
			}
			if ((Object)(object)PlayerAvatar.instance == (Object)null)
			{
				Logger.LogWarning("Can't spawn anything, player avatar is not initialized.");
				return;
			}
			if ((Object)(object)ValuableDirector.instance == (Object)null)
			{
				Logger.LogError("ValuableDirector not initialized.");
				return;
			}
			Vector3 val = ((Component)PlayerAvatar.instance).transform.position + new Vector3(0f, 1f, 0f) + ((Component)PlayerAvatar.instance).transform.forward * 1f;
			Logger.LogInfo($"Trying to spawn valuable \"{args}\" at {val}...", extended: true);
			if (!Valuables.TryGetValuableThatContainsName(args, out var valuableObject))
			{
				Logger.LogWarning("Spawn command failed. Unknown valuable with name \"" + args + "\"");
			}
			else
			{
				Valuables.SpawnValuable(valuableObject, val, Quaternion.identity);
			}
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}
[CompilerGenerated]
internal sealed class <>z__ReadOnlyArray<T> : IEnumerable, ICollection, IList, IEnumerable<T>, IReadOnlyCollection<T>, IReadOnlyList<T>, ICollection<T>, IList<T>
{
	int ICollection.Count => _items.Length;

	bool ICollection.IsSynchronized => false;

	object ICollection.SyncRoot => this;

	object IList.this[int index]
	{
		get
		{
			return _items[index];
		}
		set
		{
			throw new NotSupportedException();
		}
	}

	bool IList.IsFixedSize => true;

	bool IList.IsReadOnly => true;

	int IReadOnlyCollection<T>.Count => _items.Length;

	T IReadOnlyList<T>.this[int index] => _items[index];

	int ICollection<T>.Count => _items.Length;

	bool ICollection<T>.IsReadOnly => true;

	T IList<T>.this[int index]
	{
		get
		{
			return _items[index];
		}
		set
		{
			throw new NotSupportedException();
		}
	}

	public <>z__ReadOnlyArray(T[] items)
	{
		_items = items;
	}

	IEnumerator IEnumerable.GetEnumerator()
	{
		return ((IEnumerable)_items).GetEnumerator();
	}

	void ICollection.CopyTo(Array array, int index)
	{
		((ICollection)_items).CopyTo(array, index);
	}

	int IList.Add(object value)
	{
		throw new NotSupportedException();
	}

	void IList.Clear()
	{
		throw new NotSupportedException();
	}

	bool IList.Contains(object value)
	{
		return ((IList)_items).Contains(value);
	}

	int IList.IndexOf(object value)
	{
		return ((IList)_items).IndexOf(value);
	}

	void IList.Insert(int index, object value)
	{
		throw new NotSupportedException();
	}

	void IList.Remove(object value)
	{
		throw new NotSupportedException();
	}

	void IList.RemoveAt(int index)
	{
		throw new NotSupportedException();
	}

	IEnumerator<T> IEnumerable<T>.GetEnumerator()
	{
		return ((IEnumerable<T>)_items).GetEnumerator();
	}

	void ICollection<T>.Add(T item)
	{
		throw new NotSupportedException();
	}

	void ICollection<T>.Clear()
	{
		throw new NotSupportedException();
	}

	bool ICollection<T>.Contains(T item)
	{
		return ((ICollection<T>)_items).Contains(item);
	}

	void ICollection<T>.CopyTo(T[] array, int arrayIndex)
	{
		((ICollection<T>)_items).CopyTo(array, arrayIndex);
	}

	bool ICollection<T>.Remove(T item)
	{
		throw new NotSupportedException();
	}

	int IList<T>.IndexOf(T item)
	{
		return ((IList<T>)_items).IndexOf(item);
	}

	void IList<T>.Insert(int index, T item)
	{
		throw new NotSupportedException();
	}

	void IList<T>.RemoveAt(int index)
	{
		throw new NotSupportedException();
	}
}

Mods/REPO_HD.dll

Decompiled a year ago
using System;
using System.Diagnostics;
using System.Reflection;
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 HarmonyLib;
using UnityEngine;
using UnityEngine.Rendering.PostProcessing;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("REPO_HD")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("REPO_HD")]
[assembly: AssemblyCopyright("Copyright © BlueAmulet 2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("a9533aec-df57-4f5d-80ac-8f782ee8883c")]
[assembly: AssemblyFileVersion("1.0.3")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.3.0")]
[module: UnverifiableCode]
namespace REPO_HD
{
	[BepInPlugin("BlueAmulet.REPO_HD", "REPO_HD", "1.0.3")]
	public class REPO_HD : BaseUnityPlugin
	{
		internal const string Name = "REPO_HD";

		internal const string Author = "BlueAmulet";

		internal const string ID = "BlueAmulet.REPO_HD";

		internal const string Version = "1.0.3";

		internal static ManualLogSource Log;

		public void Awake()
		{
			//IL_001b: 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)
			Log = ((BaseUnityPlugin)this).Logger;
			Settings.InitConfig(((BaseUnityPlugin)this).Config);
			Harmony val = new Harmony("BlueAmulet.REPO_HD");
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Applying Harmony patches");
			val.PatchAll(Assembly.GetExecutingAssembly());
			int num = 0;
			foreach (MethodBase patchedMethod in val.GetPatchedMethods())
			{
				((BaseUnityPlugin)this).Logger.LogInfo((object)("Patched " + patchedMethod.DeclaringType.Name + "." + patchedMethod.Name));
				num++;
			}
			((BaseUnityPlugin)this).Logger.LogInfo((object)(num + " patches applied"));
		}
	}
	internal static class Settings
	{
		internal static ConfigEntry<bool> AntiAliasing;

		internal static ConfigEntry<float> ResolutionScale;

		internal static ConfigEntry<bool> FlickerFix;

		public static void InitConfig(ConfigFile config)
		{
			AntiAliasing = config.Bind<bool>("REPO_HD", "AntiAliasing", true, "Apply TAA+SMAA antialiasing to the game");
			ResolutionScale = config.Bind<float>("REPO_HD", "ResolutionScale", 1f, "Resolution scaler");
			FlickerFix = config.Bind<bool>("REPO_HD", "FlickerFix", true, "Fix flickering text on extraction points");
		}
	}
}
namespace REPO_HD.Patches
{
	[HarmonyPatch(typeof(ExtractionPoint))]
	internal static class ExtractionPointPatch
	{
		[HarmonyPrefix]
		[HarmonyPatch("Start")]
		public static void PrefixStart(ref ExtractionPoint __instance)
		{
			//IL_0028: 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)
			if (Settings.FlickerFix.Value)
			{
				REPO_HD.Log.LogInfo((object)"Fixing extraction point text flicker");
				Transform transform = __instance.haulGoalScreen.transform;
				transform.localPosition += new Vector3(0f, 0f, -0.002f);
			}
		}
	}
	[HarmonyPatch(typeof(GraphicsManager))]
	internal static class GraphicsPatch
	{
		[HarmonyPrefix]
		[HarmonyPatch("UpdateRenderSize")]
		public static bool PrefixUpdateRenderSize()
		{
			return false;
		}
	}
	[HarmonyPatch(typeof(RenderTextureMain))]
	internal static class RenderTexturePatch
	{
		[HarmonyPostfix]
		[HarmonyPatch("Start")]
		public static void PostfixStart(ref RenderTextureMain __instance)
		{
			//IL_0052: 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)
			if (!Settings.AntiAliasing.Value)
			{
				return;
			}
			for (int i = 0; i < __instance.cameras.Count; i++)
			{
				Camera val = __instance.cameras[i];
				PostProcessLayer component = ((Component)val).GetComponent<PostProcessLayer>();
				if ((Object)(object)component != (Object)null)
				{
					if (i == 0)
					{
						component.antialiasingMode = (Antialiasing)3;
						REPO_HD.Log.LogInfo((object)$"Enabled TAA on {val}");
					}
					else
					{
						component.antialiasingMode = (Antialiasing)2;
						REPO_HD.Log.LogInfo((object)$"Enabled SMAA on {val}");
					}
				}
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch("Update")]
		public static void PrefixUpdate(ref RenderTextureMain __instance)
		{
			__instance.textureWidthOriginal = Math.Max(Mathf.RoundToInt((float)Screen.width * Settings.ResolutionScale.Value), 1);
			__instance.textureHeightOriginal = Math.Max(Mathf.RoundToInt((float)Screen.height * Settings.ResolutionScale.Value), 1);
		}
	}
}

Mods/REPO_Shop_Items_in_Level.dll

Decompiled a year 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 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: AssemblyCompany("REPO_Shop_Items_in_Level")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.5.15.0")]
[assembly: AssemblyInformationalVersion("1.5.15+b2b9871b9f5e5282966143d620c224a5d0d48baf")]
[assembly: AssemblyProduct("Shop Items spawn in Level")]
[assembly: AssemblyTitle("REPO_Shop_Items_in_Level")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.5.15.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 REPO_Shop_Items_in_Level
{
	public class UsedVolumeTracker : MonoBehaviour
	{
	}
	[BepInPlugin("REPO_Shop_Items_in_Level", "Shop Items spawn in Level", "1.5.15")]
	[BepInProcess("REPO.exe")]
	public class Plugin : BaseUnityPlugin
	{
		internal static ManualLogSource Logger;

		internal static ConfigEntry<bool> SpawnUpgradeItems;

		internal static ConfigEntry<bool> MapHideUpgradeItems;

		internal static ConfigEntry<float> UpgradeItemSpawnChance;

		internal static ConfigEntry<bool> SpawnDroneItems;

		internal static ConfigEntry<bool> MapHideDroneItems;

		internal static ConfigEntry<float> DroneItemSpawnChance;

		internal static List<ConfigEntry<bool>> DisallowedItems;

		private Harmony harmony;

		public static Plugin Instance { get; private set; }

		private void Awake()
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Expected O, but got Unknown
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: 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_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Expected O, but got Unknown
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Expected O, but got Unknown
			//IL_0133: Unknown result type (might be due to invalid IL or missing references)
			//IL_013d: Expected O, but got Unknown
			//IL_0170: Unknown result type (might be due to invalid IL or missing references)
			//IL_017a: Expected O, but got Unknown
			Instance = this;
			Logger = ((BaseUnityPlugin)this).Logger;
			Logger.LogInfo((object)"Plugin REPO_Shop_Items_in_Level is loaded!");
			harmony = new Harmony("REPO_Shop_Items_in_Level");
			harmony.PatchAll(typeof(Plugin));
			Logger.LogInfo((object)"Harmony patches applied!");
			SpawnUpgradeItems = ((BaseUnityPlugin)this).Config.Bind<bool>("UpgradeItems", "SpawnUpgradeItems", true, new ConfigDescription("Whether upgrade items can spawn in levels", (AcceptableValueBase)null, Array.Empty<object>()));
			MapHideUpgradeItems = ((BaseUnityPlugin)this).Config.Bind<bool>("UpgradeItems", "MapHideShopUpgradeItems", true, new ConfigDescription("(Client) Whether upgrade items are hidden on the map", (AcceptableValueBase)null, Array.Empty<object>()));
			UpgradeItemSpawnChance = ((BaseUnityPlugin)this).Config.Bind<float>("UpgradeItems", "UpgradeItemSpawnChance", 2.5f, new ConfigDescription("% chance for an upgrade item to spawn", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 100f), Array.Empty<object>()));
			SpawnDroneItems = ((BaseUnityPlugin)this).Config.Bind<bool>("DroneItems", "SpawnDroneItems", true, new ConfigDescription("Whether drone items can spawn in levels", (AcceptableValueBase)null, Array.Empty<object>()));
			MapHideDroneItems = ((BaseUnityPlugin)this).Config.Bind<bool>("DroneItems", "MapHideDroneItems", true, new ConfigDescription("(Client) Whether drone items are hidden on the map", (AcceptableValueBase)null, Array.Empty<object>()));
			DroneItemSpawnChance = ((BaseUnityPlugin)this).Config.Bind<float>("DroneItems", "DroneItemsSpawnChance", 0.95f, new ConfigDescription("% chance for a drone item to spawn", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 100f), Array.Empty<object>()));
		}

		[HarmonyPatch(typeof(MainMenuOpen), "Awake")]
		[HarmonyPostfix]
		public static void MainMenuOpen_Awake_Postfix(StatsManager __instance)
		{
			//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_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: 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_00c2: Expected O, but got Unknown
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Invalid comparison between Unknown and I4
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Expected O, but got Unknown
			if (DisallowedItems != null)
			{
				return;
			}
			Logger.LogInfo((object)"Initializing disallowed items list");
			DisallowedItems = new List<ConfigEntry<bool>>();
			foreach (Item value in StatsManager.instance.itemDictionary.Values)
			{
				itemType itemType = value.itemType;
				itemType val = itemType;
				ConfigEntry<bool> val2;
				if ((int)val != 0)
				{
					if ((int)val != 3)
					{
						continue;
					}
					val2 = ((BaseUnityPlugin)Instance).Config.Bind<bool>("AllowedItems Upgrades", ((Object)value).name, true, new ConfigDescription("Whether this upgrade item can spawn in levels", (AcceptableValueBase)null, Array.Empty<object>()));
				}
				else
				{
					val2 = ((BaseUnityPlugin)Instance).Config.Bind<bool>("AllowedItems Drones", ((Object)value).name, true, new ConfigDescription("Whether this drone item can spawn in levels", (AcceptableValueBase)null, Array.Empty<object>()));
				}
				if (!val2.Value)
				{
					DisallowedItems.Add(val2);
				}
			}
		}

		private static bool GetRandomItemOfType(itemType itemType, out Item item)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			List<Item> list = (from item in StatsManager.instance.itemDictionary.Values
				where item.itemType == itemType
				where !DisallowedItems.Any((ConfigEntry<bool> configEntry) => ((ConfigEntryBase)configEntry).Definition.Key == ((Object)item).name && !configEntry.Value)
				select item).ToList();
			if (list.Count == 0)
			{
				Logger.LogWarning((object)$"Failed to get random item of type {itemType}");
				item = null;
				return false;
			}
			item = list[Random.Range(0, list.Count)];
			return true;
		}

		private static bool HasValuablePropSwitch(ValuableVolume volume)
		{
			return (Object)(object)((Component)((Component)volume).transform).GetComponentInParent<ValuablePropSwitch>() != (Object)null;
		}

		private static bool ShouldSpawnItem(ValuableVolume volume, out itemType? itemType, out bool hasSwitch)
		{
			//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_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Invalid comparison between Unknown and I4
			itemType = null;
			hasSwitch = HasValuablePropSwitch(volume);
			if (hasSwitch)
			{
				return false;
			}
			Type volumeType = volume.VolumeType;
			Type val = volumeType;
			if ((int)val != 0)
			{
				if ((int)val == 1)
				{
					if (!SpawnDroneItems.Value)
					{
						return false;
					}
					itemType = (itemType)0;
					return Random.Range(0f, 100f) <= DroneItemSpawnChance.Value;
				}
				return false;
			}
			if (!SpawnUpgradeItems.Value)
			{
				return false;
			}
			itemType = (itemType)3;
			return Random.Range(0f, 100f) <= UpgradeItemSpawnChance.Value;
		}

		private static bool RandomItemSpawn(ValuableVolume volume)
		{
			//IL_0034: 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)
			//IL_00a6: 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_007e: Unknown result type (might be due to invalid IL or missing references)
			if (!ShouldSpawnItem(volume, out var itemType, out var _))
			{
				return false;
			}
			if (!itemType.HasValue)
			{
				return false;
			}
			if (!GetRandomItemOfType(itemType.Value, out var item))
			{
				return false;
			}
			if (SemiFunc.IsMultiplayer())
			{
				PhotonNetwork.Instantiate("Items/" + ((Object)item).name, ((Component)volume).transform.position, ((Component)volume).transform.rotation, (byte)0, (object[])null);
			}
			else
			{
				Object.Instantiate<GameObject>(item.prefab, ((Component)volume).transform.position, ((Component)volume).transform.rotation);
			}
			Logger.LogInfo((object)("Spawned " + ((Object)item).name + " with volume " + ((Object)volume).name));
			return true;
		}

		[HarmonyPatch(typeof(ValuableDirector), "Spawn")]
		[HarmonyPrefix]
		public static void ValuableDirector_Spawn_Prefix(GameObject _valuable, ValuableVolume _volume, string _path)
		{
			((Component)_volume).gameObject.AddComponent<UsedVolumeTracker>();
		}

		[HarmonyPatch(typeof(ValuableDirector), "VolumesAndSwitchSetup")]
		[HarmonyPostfix]
		public static void ValuableDirector_VolumesAndSwitchSetup_Postfix(ValuableDirector __instance)
		{
			if (!SemiFunc.RunIsLevel())
			{
				return;
			}
			IEnumerable<ValuableVolume> enumerable = from volume in Object.FindObjectsOfType<ValuableVolume>(false).ToList()
				where (Object)(object)((Component)volume).gameObject.GetComponent<UsedVolumeTracker>() == (Object)null
				where !HasValuablePropSwitch(volume)
				select volume;
			Logger.LogInfo((object)$"Found {enumerable.Count()} potential volumes to spawn items in");
			Logger.LogInfo((object)$"Upgrade item spawn chance: {UpgradeItemSpawnChance.Value}% on {enumerable.Where((ValuableVolume volume) => (int)volume.VolumeType == 0).Count()} tiny volumes");
			Logger.LogInfo((object)$"Drone item spawn chance: {DroneItemSpawnChance.Value}% on {enumerable.Where((ValuableVolume volume) => (int)volume.VolumeType == 1).Count()} small volumes");
			int num = 0;
			foreach (ValuableVolume item in enumerable)
			{
				if (RandomItemSpawn(item))
				{
					num++;
				}
			}
			Logger.LogInfo((object)$"Spawned {num} items in total");
		}

		[HarmonyPatch(typeof(Map), "AddCustom")]
		[HarmonyPostfix]
		public static void Map_AddCustom_Postfix(MapCustom mapCustom)
		{
			//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_0032: 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_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_003c: Invalid comparison between Unknown and I4
			ItemAttributes val = default(ItemAttributes);
			if (!SemiFunc.RunIsLevel() || !((Component)mapCustom).gameObject.TryGetComponent<ItemAttributes>(ref val))
			{
				return;
			}
			itemType itemType = val.item.itemType;
			itemType val2 = itemType;
			if ((int)val2 != 0)
			{
				if ((int)val2 != 3 || !MapHideUpgradeItems.Value)
				{
					return;
				}
			}
			else if (!MapHideDroneItems.Value)
			{
				return;
			}
			((Component)mapCustom.mapCustomEntity).gameObject.SetActive(false);
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "REPO_Shop_Items_in_Level";

		public const string PLUGIN_NAME = "Shop Items spawn in Level";

		public const string PLUGIN_VERSION = "1.5.15";
	}
}

Mods/WesleysEnemies.dll

Decompiled a year 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+89ea82d1c631f62512e8a3bcdec7fb8c6fb6ded4")]
[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 _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_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Invalid comparison between Unknown and I4
			Debug.Log((object)_isStun);
			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.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);
			}
		}

		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)
					{
						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]
		private Sound minigunAttackSounds;

		[SerializeField]
		private Sound minigunShortAttackSounds;

		[SerializeField]
		private Sound minigunAttackGlobalSounds;

		[SerializeField]
		private 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)
		{
		}
	}
}