Decompiled source of NuageRoles v4.0.0

NuageRoles.Plugin.dll

Decompiled 6 hours 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.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using ExitGames.Client.Photon;
using HarmonyLib;
using MenuLib;
using MenuLib.MonoBehaviors;
using Microsoft.CodeAnalysis;
using NuageRoles.Roles;
using NuageRoles.Roles.Patches;
using Photon.Pun;
using Photon.Realtime;
using REPOLib;
using REPOLib.Modules;
using TMPro;
using Unity.VisualScripting;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.SceneManagement;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("NuageRoles")]
[assembly: AssemblyDescription("Role mod for R.E.P.O., maintained as NuageRoles.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("TheoHay, GangDesNuages")]
[assembly: AssemblyProduct("NuageRoles")]
[assembly: AssemblyCopyright("")]
[assembly: ComVisible(false)]
[assembly: Guid("b55829e7-8346-4258-b5db-23566f7af06b")]
[assembly: AssemblyFileVersion("4.0.0")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("4.0.0.0")]
[module: UnverifiableCode]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

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

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

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
namespace NuageRoles
{
	public sealed class NuageRolesConfig
	{
		private const string RandomRoleName = "Random";

		private const string DefaultRoleName = "Strongman";

		private static readonly string[] AllRoleChoices = new string[12]
		{
			"Random", "Runner", "Tank", "Gambler", "Strongman", "Ranged Looter", "Athletic", "Mage", "Reaper", "Scout",
			"Regular", "Engineer"
		};

		private readonly ConfigFile configFile;

		private REPOSlider? roleSlider;

		private REPOPopupPage? configPage;

		private REPOButton? buttonOpen;

		private REPOButton? buttonOpenLobby;

		private REPOButton? buttonClose;

		private REPOToggle? afterDeathRoleToggle;

		private REPOToggle? mageTopMana;

		private Action? updateManaDisplay;

		public ConfigEntry<KeyCode> ToggleKey { get; private set; }

		public ConfigEntry<KeyCode> ShowSpellsKey { get; private set; }

		public ConfigEntry<KeyCode> HealKey { get; private set; }

		public ConfigEntry<KeyCode> SpeedKey { get; private set; }

		public ConfigEntry<KeyCode> OverchargeKey { get; private set; }

		public ConfigEntry<KeyCode> JumpKey { get; private set; }

		public ConfigEntry<KeyCode> StaminaKey { get; private set; }

		public ConfigEntry<KeyCode> ScoutKey { get; private set; }

		public ConfigEntry<KeyCode> ChargeItemKey { get; private set; }

		public ConfigEntry<float> RunnerSpeedMultiplier { get; private set; }

		public ConfigEntry<float> RunnerStaminaMultiplier { get; private set; }

		public ConfigEntry<float> TankHealthMultiplier { get; private set; }

		public ConfigEntry<float> TankSpeedMultiplier { get; private set; }

		public ConfigEntry<int> TankPassiveRegenAmount { get; private set; }

		public ConfigEntry<int> TankPassiveRegenIntervalSeconds { get; private set; }

		public ConfigEntry<float> GamblerPositiveSpeedMultiplier { get; private set; }

		public ConfigEntry<float> GamblerPositiveStaminaMultiplier { get; private set; }

		public ConfigEntry<float> GamblerPositiveHealthMultiplier { get; private set; }

		public ConfigEntry<float> GamblerPositiveStrengthMultiplier { get; private set; }

		public ConfigEntry<float> GamblerPositiveJumpMultiplier { get; private set; }

		public ConfigEntry<float> GamblerNegativeSpeedMultiplier { get; private set; }

		public ConfigEntry<float> GamblerNegativeStaminaMultiplier { get; private set; }

		public ConfigEntry<float> GamblerNegativeHealthMultiplier { get; private set; }

		public ConfigEntry<float> GamblerNegativeStrengthMultiplier { get; private set; }

		public ConfigEntry<float> GamblerNegativeJumpMultiplier { get; private set; }

		public ConfigEntry<float> StrongmanStrengthMultiplier { get; private set; }

		public ConfigEntry<float> StrongmanStrengthBonus { get; private set; }

		public ConfigEntry<float> RangedLooterGrabRangeMultiplier { get; private set; }

		public ConfigEntry<float> RangedLooterStrengthMultiplier { get; private set; }

		public ConfigEntry<float> AthleticStrengthMultiplier { get; private set; }

		public ConfigEntry<int> AthleticStaminaBonus { get; private set; }

		public ConfigEntry<float> AthleticJumpForceBonus { get; private set; }

		public ConfigEntry<float> ReaperHealthMultiplier { get; private set; }

		public ConfigEntry<int> ReaperMaxHealthBonusPerKill { get; private set; }

		public ConfigEntry<int> ReaperHealAmountPerKill { get; private set; }

		public ConfigEntry<int> ReaperBuffCooldownFrames { get; private set; }

		public ConfigEntry<float> ScoutStaminaMultiplier { get; private set; }

		public ConfigEntry<float> ScoutSprintRechargeMultiplier { get; private set; }

		public ConfigEntry<int> ScoutAbilityDurationSeconds { get; private set; }

		public ConfigEntry<int> ScoutAbilityCooldownSeconds { get; private set; }

		public ConfigEntry<int> MageMaxMana { get; private set; }

		public ConfigEntry<int> MageHealAmount { get; private set; }

		public ConfigEntry<float> MageSpeedMultiplier { get; private set; }

		public ConfigEntry<float> MageJumpForceBonus { get; private set; }

		public ConfigEntry<float> MageOverchargeMultiplier { get; private set; }

		public ConfigEntry<int> MageSpeedBoostDurationSeconds { get; private set; }

		public ConfigEntry<int> MageJumpBoostDurationSeconds { get; private set; }

		public ConfigEntry<int> MageOverchargeDurationSeconds { get; private set; }

		public ConfigEntry<int> EngineerChargeStaminaCost { get; private set; }

		public ConfigEntry<int> EngineerStaminaRestoreAmount { get; private set; }

		public ConfigEntry<int> EngineerStaminaRestoreIntervalSeconds { get; private set; }

		public ConfigEntry<string> CustomRoleNameRunner { get; private set; }

		public ConfigEntry<string> CustomRoleNameTank { get; private set; }

		public ConfigEntry<string> CustomRoleNameGambler { get; private set; }

		public ConfigEntry<string> CustomRoleNameStrongman { get; private set; }

		public ConfigEntry<string> CustomRoleNameRL { get; private set; }

		public ConfigEntry<string> CustomRoleNameAthletic { get; private set; }

		public ConfigEntry<string> CustomRoleNameMage { get; private set; }

		public ConfigEntry<string> CustomRoleNameReaper { get; private set; }

		public ConfigEntry<string> CustomRoleNameScout { get; private set; }

		public ConfigEntry<string> CustomRoleNameRegular { get; private set; }

		public ConfigEntry<string> CustomRoleNameEngineer { get; private set; }

		public ConfigEntry<string> CustomRoleDecRunner { get; private set; }

		public ConfigEntry<string> CustomRoleDecTank { get; private set; }

		public ConfigEntry<string> CustomRoleDecGambler { get; private set; }

		public ConfigEntry<string> CustomRoleDecStrongman { get; private set; }

		public ConfigEntry<string> CustomRoleDecRL { get; private set; }

		public ConfigEntry<string> CustomRoleDecAthletic { get; private set; }

		public ConfigEntry<string> CustomRoleDecMage { get; private set; }

		public ConfigEntry<string> CustomRoleDecReaper { get; private set; }

		public ConfigEntry<string> CustomRoleDecScout { get; private set; }

		public ConfigEntry<string> CustomRoleDecRegular { get; private set; }

		public ConfigEntry<string> CustomRoleDecEngineer { get; private set; }

		public ConfigEntry<string> SavedRole { get; private set; }

		public ConfigEntry<bool> EnableRoleUpgrades { get; private set; }

		public ConfigEntry<bool> AssignRoleAfterRevive { get; private set; }

		public ConfigEntry<bool> MageTopManaConf { get; private set; }

		public ConfigEntry<bool> ShowGUIAtStart { get; private set; }

		public ConfigEntry<bool> EnableRunner { get; private set; }

		public ConfigEntry<bool> EnableTank { get; private set; }

		public ConfigEntry<bool> EnableGambler { get; private set; }

		public ConfigEntry<bool> EnableStrongman { get; private set; }

		public ConfigEntry<bool> EnableRL { get; private set; }

		public ConfigEntry<bool> EnableAthletic { get; private set; }

		public ConfigEntry<bool> EnableMage { get; private set; }

		public ConfigEntry<bool> EnableReaper { get; private set; }

		public ConfigEntry<bool> EnableScout { get; private set; }

		public ConfigEntry<bool> EnableRegular { get; private set; }

		public ConfigEntry<bool> EnableEngineer { get; private set; }

		public bool AfterDeathNewRole => AssignRoleAfterRevive.Value;

		public bool MageTopManaTop => MageTopManaConf.Value;

		public string ChosenRoleName => GetSelectableRoleName(SavedRole.Value);

		public NuageRolesConfig(ConfigFile configFile)
		{
			this.configFile = configFile;
		}

		public void Bind()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Expected O, but got Unknown
			//IL_0039: Expected O, but got Unknown
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Expected O, but got Unknown
			//IL_006a: Expected O, but got Unknown
			//IL_0080: 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_009b: Expected O, but got Unknown
			//IL_009b: Expected O, but got Unknown
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Expected O, but got Unknown
			//IL_00cc: Expected O, but got Unknown
			//IL_00e2: 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_00fd: Expected O, but got Unknown
			//IL_00fd: Expected O, but got Unknown
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_0124: Unknown result type (might be due to invalid IL or missing references)
			//IL_012e: Expected O, but got Unknown
			//IL_012e: Expected O, but got Unknown
			//IL_0144: Unknown result type (might be due to invalid IL or missing references)
			//IL_0155: Unknown result type (might be due to invalid IL or missing references)
			//IL_015f: Expected O, but got Unknown
			//IL_015f: Expected O, but got Unknown
			//IL_0175: Unknown result type (might be due to invalid IL or missing references)
			//IL_0186: Unknown result type (might be due to invalid IL or missing references)
			//IL_0190: Expected O, but got Unknown
			//IL_0190: Expected O, but got Unknown
			//IL_01a6: 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_01c1: Expected O, but got Unknown
			//IL_01c1: Expected O, but got Unknown
			//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f2: Expected O, but got Unknown
			//IL_01f2: Expected O, but got Unknown
			//IL_0208: 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_0223: Expected O, but got Unknown
			//IL_0223: Expected O, but got Unknown
			//IL_0239: Unknown result type (might be due to invalid IL or missing references)
			//IL_024a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0254: Expected O, but got Unknown
			//IL_0254: Expected O, but got Unknown
			//IL_026a: Unknown result type (might be due to invalid IL or missing references)
			//IL_027b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0285: Expected O, but got Unknown
			//IL_0285: Expected O, but got Unknown
			//IL_029b: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b6: Expected O, but got Unknown
			//IL_02b6: Expected O, but got Unknown
			//IL_02cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_02dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e7: Expected O, but got Unknown
			//IL_02e7: Expected O, but got Unknown
			//IL_02fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_030e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0318: Expected O, but got Unknown
			//IL_0318: Expected O, but got Unknown
			//IL_032e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0340: Unknown result type (might be due to invalid IL or missing references)
			//IL_034a: Expected O, but got Unknown
			//IL_034a: Expected O, but got Unknown
			//IL_0360: Unknown result type (might be due to invalid IL or missing references)
			//IL_0372: Unknown result type (might be due to invalid IL or missing references)
			//IL_037c: Expected O, but got Unknown
			//IL_037c: Expected O, but got Unknown
			//IL_0392: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ae: Expected O, but got Unknown
			//IL_03ae: Expected O, but got Unknown
			//IL_03c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e0: Expected O, but got Unknown
			//IL_03e0: Expected O, but got Unknown
			//IL_03f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0408: Unknown result type (might be due to invalid IL or missing references)
			//IL_0412: Expected O, but got Unknown
			//IL_0412: Expected O, but got Unknown
			//IL_0428: Unknown result type (might be due to invalid IL or missing references)
			//IL_043a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0444: Expected O, but got Unknown
			//IL_0444: Expected O, but got Unknown
			//IL_045a: Unknown result type (might be due to invalid IL or missing references)
			//IL_046c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0476: Expected O, but got Unknown
			//IL_0476: Expected O, but got Unknown
			//IL_048c: Unknown result type (might be due to invalid IL or missing references)
			//IL_049e: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a8: Expected O, but got Unknown
			//IL_04a8: Expected O, but got Unknown
			//IL_04be: Unknown result type (might be due to invalid IL or missing references)
			//IL_04d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_04da: Expected O, but got Unknown
			//IL_04da: Expected O, but got Unknown
			//IL_04f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0513: Unknown result type (might be due to invalid IL or missing references)
			//IL_051d: Expected O, but got Unknown
			//IL_051d: Expected O, but got Unknown
			//IL_0533: Unknown result type (might be due to invalid IL or missing references)
			//IL_0556: Unknown result type (might be due to invalid IL or missing references)
			//IL_0560: Expected O, but got Unknown
			//IL_0560: Expected O, but got Unknown
			//IL_0576: Unknown result type (might be due to invalid IL or missing references)
			//IL_0599: Unknown result type (might be due to invalid IL or missing references)
			//IL_05a3: Expected O, but got Unknown
			//IL_05a3: Expected O, but got Unknown
			//IL_05b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_05dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_05e6: Expected O, but got Unknown
			//IL_05e6: Expected O, but got Unknown
			//IL_05fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0614: Unknown result type (might be due to invalid IL or missing references)
			//IL_061e: Expected O, but got Unknown
			//IL_061e: Expected O, but got Unknown
			//IL_0634: Unknown result type (might be due to invalid IL or missing references)
			//IL_064f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0659: Expected O, but got Unknown
			//IL_0659: Expected O, but got Unknown
			//IL_066f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0692: Unknown result type (might be due to invalid IL or missing references)
			//IL_069c: Expected O, but got Unknown
			//IL_069c: Expected O, but got Unknown
			//IL_06b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_06d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_06df: Expected O, but got Unknown
			//IL_06df: Expected O, but got Unknown
			//IL_06f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0718: Unknown result type (might be due to invalid IL or missing references)
			//IL_0722: Expected O, but got Unknown
			//IL_0722: Expected O, but got Unknown
			//IL_0738: Unknown result type (might be due to invalid IL or missing references)
			//IL_075b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0765: Expected O, but got Unknown
			//IL_0765: Expected O, but got Unknown
			//IL_077b: Unknown result type (might be due to invalid IL or missing references)
			//IL_079e: Unknown result type (might be due to invalid IL or missing references)
			//IL_07a8: Expected O, but got Unknown
			//IL_07a8: Expected O, but got Unknown
			//IL_07be: Unknown result type (might be due to invalid IL or missing references)
			//IL_07e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_07eb: Expected O, but got Unknown
			//IL_07eb: Expected O, but got Unknown
			//IL_0801: Unknown result type (might be due to invalid IL or missing references)
			//IL_0824: Unknown result type (might be due to invalid IL or missing references)
			//IL_082e: Expected O, but got Unknown
			//IL_082e: Expected O, but got Unknown
			//IL_0844: Unknown result type (might be due to invalid IL or missing references)
			//IL_0867: Unknown result type (might be due to invalid IL or missing references)
			//IL_0871: Expected O, but got Unknown
			//IL_0871: Expected O, but got Unknown
			//IL_0887: Unknown result type (might be due to invalid IL or missing references)
			//IL_08aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_08b4: Expected O, but got Unknown
			//IL_08b4: Expected O, but got Unknown
			//IL_08ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_08ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_08f7: Expected O, but got Unknown
			//IL_08f7: Expected O, but got Unknown
			//IL_090d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0930: Unknown result type (might be due to invalid IL or missing references)
			//IL_093a: Expected O, but got Unknown
			//IL_093a: Expected O, but got Unknown
			//IL_0950: Unknown result type (might be due to invalid IL or missing references)
			//IL_0973: Unknown result type (might be due to invalid IL or missing references)
			//IL_097d: Expected O, but got Unknown
			//IL_097d: Expected O, but got Unknown
			//IL_0993: Unknown result type (might be due to invalid IL or missing references)
			//IL_09b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_09c0: Expected O, but got Unknown
			//IL_09c0: Expected O, but got Unknown
			//IL_09d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_09f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a03: Expected O, but got Unknown
			//IL_0a03: Expected O, but got Unknown
			//IL_0a19: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a3c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a46: Expected O, but got Unknown
			//IL_0a46: Expected O, but got Unknown
			//IL_0a5c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a78: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a82: Expected O, but got Unknown
			//IL_0a82: Expected O, but got Unknown
			//IL_0a98: Unknown result type (might be due to invalid IL or missing references)
			//IL_0abb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ac5: Expected O, but got Unknown
			//IL_0ac5: Expected O, but got Unknown
			//IL_0adb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0afe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b08: Expected O, but got Unknown
			//IL_0b08: Expected O, but got Unknown
			//IL_0b1e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b39: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b43: Expected O, but got Unknown
			//IL_0b43: Expected O, but got Unknown
			//IL_0b59: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b75: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b7f: Expected O, but got Unknown
			//IL_0b7f: Expected O, but got Unknown
			//IL_0b95: Unknown result type (might be due to invalid IL or missing references)
			//IL_0bb1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0bbb: Expected O, but got Unknown
			//IL_0bbb: Expected O, but got Unknown
			//IL_0bd1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0bf4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0bfe: Expected O, but got Unknown
			//IL_0bfe: Expected O, but got Unknown
			//IL_0c14: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c37: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c41: Expected O, but got Unknown
			//IL_0c41: Expected O, but got Unknown
			//IL_0c57: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c72: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c7c: Expected O, but got Unknown
			//IL_0c7c: Expected O, but got Unknown
			//IL_0c92: Unknown result type (might be due to invalid IL or missing references)
			//IL_0cae: Unknown result type (might be due to invalid IL or missing references)
			//IL_0cb8: Expected O, but got Unknown
			//IL_0cb8: Expected O, but got Unknown
			//IL_0cce: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ce6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0cf0: Expected O, but got Unknown
			//IL_0cf0: Expected O, but got Unknown
			//IL_0d06: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d1e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d28: Expected O, but got Unknown
			//IL_0d28: Expected O, but got Unknown
			//IL_0d3e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d61: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d6b: Expected O, but got Unknown
			//IL_0d6b: Expected O, but got Unknown
			//IL_0d81: Unknown result type (might be due to invalid IL or missing references)
			//IL_0da4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0dae: Expected O, but got Unknown
			//IL_0dae: Expected O, but got Unknown
			//IL_0dc4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0de7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0df1: Expected O, but got Unknown
			//IL_0df1: Expected O, but got Unknown
			//IL_0e07: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e23: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e2d: Expected O, but got Unknown
			//IL_0e2d: Expected O, but got Unknown
			//IL_0e43: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e5f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e69: Expected O, but got Unknown
			//IL_0e69: Expected O, but got Unknown
			//IL_0e7f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e9b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ea5: Expected O, but got Unknown
			//IL_0ea5: Expected O, but got Unknown
			//IL_0ebb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ed4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ede: Expected O, but got Unknown
			//IL_0ede: Expected O, but got Unknown
			//IL_0ef4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f0c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f16: Expected O, but got Unknown
			//IL_0f16: Expected O, but got Unknown
			//IL_0f2c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f48: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f52: Expected O, but got Unknown
			//IL_0f52: Expected O, but got Unknown
			//IL_0f68: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f7d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f87: Expected O, but got Unknown
			//IL_0f87: Expected O, but got Unknown
			//IL_0f9d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0fb2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0fbc: Expected O, but got Unknown
			//IL_0fbc: Expected O, but got Unknown
			//IL_0fd2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0fe7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ff1: Expected O, but got Unknown
			//IL_0ff1: Expected O, but got Unknown
			//IL_1007: Unknown result type (might be due to invalid IL or missing references)
			//IL_101c: Unknown result type (might be due to invalid IL or missing references)
			//IL_1026: Expected O, but got Unknown
			//IL_1026: Expected O, but got Unknown
			//IL_103c: Unknown result type (might be due to invalid IL or missing references)
			//IL_1051: Unknown result type (might be due to invalid IL or missing references)
			//IL_105b: Expected O, but got Unknown
			//IL_105b: Expected O, but got Unknown
			//IL_1071: Unknown result type (might be due to invalid IL or missing references)
			//IL_1086: Unknown result type (might be due to invalid IL or missing references)
			//IL_1090: Expected O, but got Unknown
			//IL_1090: Expected O, but got Unknown
			//IL_10a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_10bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_10c5: Expected O, but got Unknown
			//IL_10c5: Expected O, but got Unknown
			//IL_10db: Unknown result type (might be due to invalid IL or missing references)
			//IL_10f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_10fa: Expected O, but got Unknown
			//IL_10fa: Expected O, but got Unknown
			//IL_1110: Unknown result type (might be due to invalid IL or missing references)
			//IL_1125: Unknown result type (might be due to invalid IL or missing references)
			//IL_112f: Expected O, but got Unknown
			//IL_112f: Expected O, but got Unknown
			//IL_1145: Unknown result type (might be due to invalid IL or missing references)
			//IL_115a: Unknown result type (might be due to invalid IL or missing references)
			//IL_1164: Expected O, but got Unknown
			//IL_1164: Expected O, but got Unknown
			//IL_117a: Unknown result type (might be due to invalid IL or missing references)
			//IL_118f: Unknown result type (might be due to invalid IL or missing references)
			//IL_1199: Expected O, but got Unknown
			//IL_1199: Expected O, but got Unknown
			//IL_11af: Unknown result type (might be due to invalid IL or missing references)
			//IL_11c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_11ce: Expected O, but got Unknown
			//IL_11ce: Expected O, but got Unknown
			//IL_11e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_11f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_1203: Expected O, but got Unknown
			//IL_1203: Expected O, but got Unknown
			//IL_1219: Unknown result type (might be due to invalid IL or missing references)
			//IL_122e: Unknown result type (might be due to invalid IL or missing references)
			//IL_1238: Expected O, but got Unknown
			//IL_1238: Expected O, but got Unknown
			//IL_124e: Unknown result type (might be due to invalid IL or missing references)
			//IL_1263: Unknown result type (might be due to invalid IL or missing references)
			//IL_126d: Expected O, but got Unknown
			//IL_126d: Expected O, but got Unknown
			//IL_1283: Unknown result type (might be due to invalid IL or missing references)
			//IL_1298: Unknown result type (might be due to invalid IL or missing references)
			//IL_12a2: Expected O, but got Unknown
			//IL_12a2: Expected O, but got Unknown
			//IL_12b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_12cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_12d7: Expected O, but got Unknown
			//IL_12d7: Expected O, but got Unknown
			//IL_12ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_1302: Unknown result type (might be due to invalid IL or missing references)
			//IL_130c: Expected O, but got Unknown
			//IL_130c: Expected O, but got Unknown
			//IL_1322: Unknown result type (might be due to invalid IL or missing references)
			//IL_1337: Unknown result type (might be due to invalid IL or missing references)
			//IL_1341: Expected O, but got Unknown
			//IL_1341: Expected O, but got Unknown
			//IL_1357: Unknown result type (might be due to invalid IL or missing references)
			//IL_136c: Unknown result type (might be due to invalid IL or missing references)
			//IL_1376: Expected O, but got Unknown
			//IL_1376: Expected O, but got Unknown
			//IL_138c: Unknown result type (might be due to invalid IL or missing references)
			//IL_13a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_13ab: Expected O, but got Unknown
			//IL_13ab: Expected O, but got Unknown
			//IL_13c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_13d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_13e0: Expected O, but got Unknown
			//IL_13e0: Expected O, but got Unknown
			SavedRole = configFile.Bind<string>(new ConfigDefinition("Role", "Your selected role"), "Strongman", new ConfigDescription("Preferred role for this player. Disabled preferred roles temporarily act as Random until enabled again.", (AcceptableValueBase)(object)new AcceptableValueList<string>(AllRoleChoices), Array.Empty<object>()));
			AssignRoleAfterRevive = configFile.Bind<bool>(new ConfigDefinition("Role", "Reaasign roles after being revived"), false, new ConfigDescription("When enabled, a player receives a new role after dying and being revived.", (AcceptableValueBase)null, Array.Empty<object>()));
			MageTopManaConf = configFile.Bind<bool>(new ConfigDefinition("Role", "Place where mana is shown"), true, new ConfigDescription("Controls Mage mana display placement. True shows mana at the top; false shows it beside the stamina UI.", (AcceptableValueBase)null, Array.Empty<object>()));
			ShowGUIAtStart = configFile.Bind<bool>(new ConfigDefinition("GUI", "Show GUI when being assigned a role"), true, new ConfigDescription("Shows the role information overlay when a role is assigned.", (AcceptableValueBase)null, Array.Empty<object>()));
			EnableRoleUpgrades = configFile.Bind<bool>(new ConfigDefinition("Upgrades", "Enable Role Upgrades in Shop"), true, new ConfigDescription("Enables NuageRoles upgrade items in the shop.", (AcceptableValueBase)null, Array.Empty<object>()));
			EnableRunner = configFile.Bind<bool>(new ConfigDefinition("Role", "Enable Runner"), true, new ConfigDescription("Allows Runner to be selected or randomly assigned.", (AcceptableValueBase)null, Array.Empty<object>()));
			EnableTank = configFile.Bind<bool>(new ConfigDefinition("Role", "Enable Tank"), true, new ConfigDescription("Allows Tank to be selected or randomly assigned.", (AcceptableValueBase)null, Array.Empty<object>()));
			EnableGambler = configFile.Bind<bool>(new ConfigDefinition("Role", "Enable Gambler"), true, new ConfigDescription("Allows Gambler to be selected or randomly assigned.", (AcceptableValueBase)null, Array.Empty<object>()));
			EnableStrongman = configFile.Bind<bool>(new ConfigDefinition("Role", "Enable Strongman"), true, new ConfigDescription("Allows Strongman to be selected or randomly assigned.", (AcceptableValueBase)null, Array.Empty<object>()));
			EnableRL = configFile.Bind<bool>(new ConfigDefinition("Role", "Enable Ranged Looter"), true, new ConfigDescription("Allows Ranged Looter to be selected or randomly assigned.", (AcceptableValueBase)null, Array.Empty<object>()));
			EnableAthletic = configFile.Bind<bool>(new ConfigDefinition("Role", "Enable Athletic"), true, new ConfigDescription("Allows Athletic to be selected or randomly assigned.", (AcceptableValueBase)null, Array.Empty<object>()));
			EnableMage = configFile.Bind<bool>(new ConfigDefinition("Role", "Enable Mage"), true, new ConfigDescription("Allows Mage to be selected or randomly assigned.", (AcceptableValueBase)null, Array.Empty<object>()));
			EnableReaper = configFile.Bind<bool>(new ConfigDefinition("Role", "Enable Reaper"), true, new ConfigDescription("Allows Reaper to be selected or randomly assigned.", (AcceptableValueBase)null, Array.Empty<object>()));
			EnableScout = configFile.Bind<bool>(new ConfigDefinition("Role", "Enable Scout"), true, new ConfigDescription("Allows Scout to be selected or randomly assigned.", (AcceptableValueBase)null, Array.Empty<object>()));
			EnableRegular = configFile.Bind<bool>(new ConfigDefinition("Role", "Enable Regular"), true, new ConfigDescription("Allows Regular to be selected or randomly assigned.", (AcceptableValueBase)null, Array.Empty<object>()));
			EnableEngineer = configFile.Bind<bool>(new ConfigDefinition("Role", "Enable Engineer"), true, new ConfigDescription("Allows Engineer to be selected or randomly assigned.", (AcceptableValueBase)null, Array.Empty<object>()));
			ToggleKey = configFile.Bind<KeyCode>(new ConfigDefinition("GUI", "GUI Toggle Key"), (KeyCode)114, new ConfigDescription("Key used to toggle the role information overlay.", (AcceptableValueBase)null, Array.Empty<object>()));
			ScoutKey = configFile.Bind<KeyCode>(new ConfigDefinition("GUI", "Activate Scout Ability"), (KeyCode)103, new ConfigDescription("Key used to activate the Scout enemy marker ability.", (AcceptableValueBase)null, Array.Empty<object>()));
			ShowSpellsKey = configFile.Bind<KeyCode>(new ConfigDefinition("Mage", "Show Spells"), (KeyCode)109, new ConfigDescription("Key used to show or hide the Mage spell list.", (AcceptableValueBase)null, Array.Empty<object>()));
			HealKey = configFile.Bind<KeyCode>(new ConfigDefinition("Mage", "Healing Spell"), (KeyCode)104, new ConfigDescription("Key used to cast Mage heal.", (AcceptableValueBase)null, Array.Empty<object>()));
			SpeedKey = configFile.Bind<KeyCode>(new ConfigDefinition("Mage", "Speed Spell"), (KeyCode)106, new ConfigDescription("Key used to cast Mage speed boost.", (AcceptableValueBase)null, Array.Empty<object>()));
			OverchargeKey = configFile.Bind<KeyCode>(new ConfigDefinition("Mage", "Overcharge Spell"), (KeyCode)111, new ConfigDescription("Key used to cast Mage overcharge.", (AcceptableValueBase)null, Array.Empty<object>()));
			JumpKey = configFile.Bind<KeyCode>(new ConfigDefinition("Mage", "Jump Boost Spell"), (KeyCode)107, new ConfigDescription("Key used to cast Mage jump boost.", (AcceptableValueBase)null, Array.Empty<object>()));
			StaminaKey = configFile.Bind<KeyCode>(new ConfigDefinition("Mage", "Stamina Refill Spell"), (KeyCode)110, new ConfigDescription("Key used to cast Mage stamina refill.", (AcceptableValueBase)null, Array.Empty<object>()));
			ChargeItemKey = configFile.Bind<KeyCode>(new ConfigDefinition("Engineer", "Charge Held Item"), (KeyCode)99, new ConfigDescription("Key used by Engineer to charge the held item.", (AcceptableValueBase)null, Array.Empty<object>()));
			RunnerSpeedMultiplier = configFile.Bind<float>(new ConfigDefinition("Runner", "Speed Multiplier"), 1.5f, new ConfigDescription("Multiplier applied to Runner crouch, walk, and sprint speed.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 5f), Array.Empty<object>()));
			RunnerStaminaMultiplier = configFile.Bind<float>(new ConfigDefinition("Runner", "Stamina Multiplier"), 1.5f, new ConfigDescription("Multiplier applied to Runner max and current stamina.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 5f), Array.Empty<object>()));
			TankHealthMultiplier = configFile.Bind<float>(new ConfigDefinition("Tank", "Health Multiplier"), 2f, new ConfigDescription("Multiplier applied to Tank max and current health.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 10f), Array.Empty<object>()));
			TankSpeedMultiplier = configFile.Bind<float>(new ConfigDefinition("Tank", "Speed Multiplier"), 0.9f, new ConfigDescription("Multiplier applied to Tank crouch, walk, and sprint speed.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 5f), Array.Empty<object>()));
			TankPassiveRegenAmount = configFile.Bind<int>(new ConfigDefinition("Tank", "Passive Regen Amount"), 1, new ConfigDescription("Health restored each Tank passive regeneration tick.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>()));
			TankPassiveRegenIntervalSeconds = configFile.Bind<int>(new ConfigDefinition("Tank", "Passive Regen Interval Seconds"), 5, new ConfigDescription("Seconds between Tank passive regeneration ticks.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 300), Array.Empty<object>()));
			GamblerPositiveSpeedMultiplier = configFile.Bind<float>(new ConfigDefinition("Gambler", "Positive Speed Multiplier"), 1.3f, new ConfigDescription("Positive Gambler speed effect multiplier.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 5f), Array.Empty<object>()));
			GamblerPositiveStaminaMultiplier = configFile.Bind<float>(new ConfigDefinition("Gambler", "Positive Stamina Multiplier"), 1.8f, new ConfigDescription("Positive Gambler stamina effect multiplier.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 10f), Array.Empty<object>()));
			GamblerPositiveHealthMultiplier = configFile.Bind<float>(new ConfigDefinition("Gambler", "Positive Health Multiplier"), 1.8f, new ConfigDescription("Positive Gambler health effect multiplier.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 10f), Array.Empty<object>()));
			GamblerPositiveStrengthMultiplier = configFile.Bind<float>(new ConfigDefinition("Gambler", "Positive Strength Multiplier"), 1.3f, new ConfigDescription("Positive Gambler grab strength effect multiplier.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 10f), Array.Empty<object>()));
			GamblerPositiveJumpMultiplier = configFile.Bind<float>(new ConfigDefinition("Gambler", "Positive Jump Multiplier"), 1.5f, new ConfigDescription("Positive Gambler jump force effect multiplier.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 10f), Array.Empty<object>()));
			GamblerNegativeSpeedMultiplier = configFile.Bind<float>(new ConfigDefinition("Gambler", "Negative Speed Multiplier"), 0.8f, new ConfigDescription("Negative Gambler speed effect multiplier.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 5f), Array.Empty<object>()));
			GamblerNegativeStaminaMultiplier = configFile.Bind<float>(new ConfigDefinition("Gambler", "Negative Stamina Multiplier"), 0.8f, new ConfigDescription("Negative Gambler stamina effect multiplier.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 10f), Array.Empty<object>()));
			GamblerNegativeHealthMultiplier = configFile.Bind<float>(new ConfigDefinition("Gambler", "Negative Health Multiplier"), 0.8f, new ConfigDescription("Negative Gambler health effect multiplier.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 10f), Array.Empty<object>()));
			GamblerNegativeStrengthMultiplier = configFile.Bind<float>(new ConfigDefinition("Gambler", "Negative Strength Multiplier"), 0.8f, new ConfigDescription("Negative Gambler grab strength effect multiplier.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 10f), Array.Empty<object>()));
			GamblerNegativeJumpMultiplier = configFile.Bind<float>(new ConfigDefinition("Gambler", "Negative Jump Multiplier"), 0.7f, new ConfigDescription("Negative Gambler jump force effect multiplier.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 10f), Array.Empty<object>()));
			StrongmanStrengthMultiplier = configFile.Bind<float>(new ConfigDefinition("Strongman", "Strength Multiplier"), 1.5f, new ConfigDescription("Multiplier applied to Strongman grab strength before the flat bonus.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 10f), Array.Empty<object>()));
			StrongmanStrengthBonus = configFile.Bind<float>(new ConfigDefinition("Strongman", "Strength Bonus"), 0.5f, new ConfigDescription("Flat grab strength bonus added after the Strongman multiplier.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 10f), Array.Empty<object>()));
			RangedLooterGrabRangeMultiplier = configFile.Bind<float>(new ConfigDefinition("Ranged Looter", "Grab Range Multiplier"), 2.5f, new ConfigDescription("Multiplier applied to Ranged Looter grab range.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 10f), Array.Empty<object>()));
			RangedLooterStrengthMultiplier = configFile.Bind<float>(new ConfigDefinition("Ranged Looter", "Strength Multiplier"), 1.2f, new ConfigDescription("Multiplier applied to Ranged Looter grab strength.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 10f), Array.Empty<object>()));
			AthleticStrengthMultiplier = configFile.Bind<float>(new ConfigDefinition("Athletic", "Strength Multiplier"), 1.4f, new ConfigDescription("Multiplier applied to Athletic grab strength.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 10f), Array.Empty<object>()));
			AthleticStaminaBonus = configFile.Bind<int>(new ConfigDefinition("Athletic", "Stamina Bonus"), 20, new ConfigDescription("Flat max and current stamina bonus applied to Athletic.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 300), Array.Empty<object>()));
			AthleticJumpForceBonus = configFile.Bind<float>(new ConfigDefinition("Athletic", "Jump Force Bonus"), 3f, new ConfigDescription("Flat jump force bonus applied to Athletic.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 50f), Array.Empty<object>()));
			ReaperHealthMultiplier = configFile.Bind<float>(new ConfigDefinition("Reaper", "Health Multiplier"), 1.5f, new ConfigDescription("Multiplier applied to Reaper max and current health when the role is assigned.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 10f), Array.Empty<object>()));
			ReaperMaxHealthBonusPerKill = configFile.Bind<int>(new ConfigDefinition("Reaper", "Max Health Bonus Per Enemy"), 5, new ConfigDescription("Max health gained by each living Reaper when an enemy dies.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 1000), Array.Empty<object>()));
			ReaperHealAmountPerKill = configFile.Bind<int>(new ConfigDefinition("Reaper", "Heal Amount Per Enemy"), 30, new ConfigDescription("Health restored by each living Reaper when an enemy dies.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 1000), Array.Empty<object>()));
			ReaperBuffCooldownFrames = configFile.Bind<int>(new ConfigDefinition("Reaper", "Buff Cooldown Frames"), 50, new ConfigDescription("Update frames a Reaper must wait before receiving another enemy-death buff.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 10000), Array.Empty<object>()));
			ScoutStaminaMultiplier = configFile.Bind<float>(new ConfigDefinition("Scout", "Stamina Multiplier"), 2f, new ConfigDescription("Multiplier applied to Scout max and current stamina.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 10f), Array.Empty<object>()));
			ScoutSprintRechargeMultiplier = configFile.Bind<float>(new ConfigDefinition("Scout", "Sprint Recharge Multiplier"), 2f, new ConfigDescription("Multiplier applied to Scout stamina recharge amount.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 10f), Array.Empty<object>()));
			ScoutAbilityDurationSeconds = configFile.Bind<int>(new ConfigDefinition("Scout", "Ability Duration Seconds"), 5, new ConfigDescription("Duration of the Scout enemy marker ability.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 300), Array.Empty<object>()));
			ScoutAbilityCooldownSeconds = configFile.Bind<int>(new ConfigDefinition("Scout", "Ability Cooldown Seconds"), 40, new ConfigDescription("Base cooldown of the Scout enemy marker ability before upgrade reductions.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 600), Array.Empty<object>()));
			MageMaxMana = configFile.Bind<int>(new ConfigDefinition("Mage", "Max Mana"), 8, new ConfigDescription("Maximum mana available to the Mage.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(3, 12), Array.Empty<object>()));
			MageHealAmount = configFile.Bind<int>(new ConfigDefinition("Mage", "Heal Amount"), 5, new ConfigDescription("Health restored by the Mage heal spell before overcharge is applied.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 100), Array.Empty<object>()));
			MageSpeedMultiplier = configFile.Bind<float>(new ConfigDefinition("Mage", "Speed Multiplier"), 1.4f, new ConfigDescription("Movement speed multiplier applied by the Mage speed spell.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 5f), Array.Empty<object>()));
			MageJumpForceBonus = configFile.Bind<float>(new ConfigDefinition("Mage", "Jump Force Bonus"), 3f, new ConfigDescription("Flat JumpForce bonus applied by the Mage jump spell.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 50f), Array.Empty<object>()));
			MageOverchargeMultiplier = configFile.Bind<float>(new ConfigDefinition("Mage", "Overcharge Multiplier"), 2f, new ConfigDescription("Multiplier applied by overcharge to heal amount and boost durations.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 10f), Array.Empty<object>()));
			MageSpeedBoostDurationSeconds = configFile.Bind<int>(new ConfigDefinition("Mage", "Speed Boost Duration Seconds"), 30, new ConfigDescription("Base duration of the Mage speed spell in seconds.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 300), Array.Empty<object>()));
			MageJumpBoostDurationSeconds = configFile.Bind<int>(new ConfigDefinition("Mage", "Jump Boost Duration Seconds"), 30, new ConfigDescription("Base duration of the Mage jump spell in seconds.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 300), Array.Empty<object>()));
			MageOverchargeDurationSeconds = configFile.Bind<int>(new ConfigDefinition("Mage", "Overcharge Duration Seconds"), 20, new ConfigDescription("Duration of the Mage overcharge spell in seconds.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 300), Array.Empty<object>()));
			EngineerChargeStaminaCost = configFile.Bind<int>(new ConfigDefinition("Engineer", "Charge Stamina Cost"), 10, new ConfigDescription("Max stamina sacrificed when charging an item. The sacrificed stamina is restored over time.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>()));
			EngineerStaminaRestoreAmount = configFile.Bind<int>(new ConfigDefinition("Engineer", "Stamina Restore Amount"), 5, new ConfigDescription("Amount of sacrificed max stamina restored each restore tick.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>()));
			EngineerStaminaRestoreIntervalSeconds = configFile.Bind<int>(new ConfigDefinition("Engineer", "Stamina Restore Interval Seconds"), 15, new ConfigDescription("Seconds between Engineer stamina restore ticks.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 300), Array.Empty<object>()));
			CustomRoleNameRunner = configFile.Bind<string>(new ConfigDefinition("Role Names", "Runner Name"), "Runner", new ConfigDescription("Display name for the Runner role.", (AcceptableValueBase)null, Array.Empty<object>()));
			CustomRoleNameTank = configFile.Bind<string>(new ConfigDefinition("Role Names", "Tank Name"), "Tank", new ConfigDescription("Display name for the Tank role.", (AcceptableValueBase)null, Array.Empty<object>()));
			CustomRoleNameGambler = configFile.Bind<string>(new ConfigDefinition("Role Names", "Gambler Name"), "Gambler", new ConfigDescription("Display name for the Gambler role.", (AcceptableValueBase)null, Array.Empty<object>()));
			CustomRoleNameStrongman = configFile.Bind<string>(new ConfigDefinition("Role Names", "Strongman Name"), "Strongman", new ConfigDescription("Display name for the Strongman role.", (AcceptableValueBase)null, Array.Empty<object>()));
			CustomRoleNameRL = configFile.Bind<string>(new ConfigDefinition("Role Names", "Ranged Looter Name"), "Ranged Looter", new ConfigDescription("Display name for the Ranged Looter role.", (AcceptableValueBase)null, Array.Empty<object>()));
			CustomRoleNameAthletic = configFile.Bind<string>(new ConfigDefinition("Role Names", "Athletic Name"), "Athletic", new ConfigDescription("Display name for the Athletic role.", (AcceptableValueBase)null, Array.Empty<object>()));
			CustomRoleNameMage = configFile.Bind<string>(new ConfigDefinition("Role Names", "Mage Name"), "Mage", new ConfigDescription("Display name for the Mage role.", (AcceptableValueBase)null, Array.Empty<object>()));
			CustomRoleNameReaper = configFile.Bind<string>(new ConfigDefinition("Role Names", "Reaper Name"), "Reaper", new ConfigDescription("Display name for the Reaper role.", (AcceptableValueBase)null, Array.Empty<object>()));
			CustomRoleNameScout = configFile.Bind<string>(new ConfigDefinition("Role Names", "Scout Name"), "Scout", new ConfigDescription("Display name for the Scout role.", (AcceptableValueBase)null, Array.Empty<object>()));
			CustomRoleNameRegular = configFile.Bind<string>(new ConfigDefinition("Role Names", "Regular Name"), "Regular", new ConfigDescription("Display name for the Regular role.", (AcceptableValueBase)null, Array.Empty<object>()));
			CustomRoleNameEngineer = configFile.Bind<string>(new ConfigDefinition("Role Names", "Engineer Name"), "Engineer", new ConfigDescription("Display name for the Engineer role.", (AcceptableValueBase)null, Array.Empty<object>()));
			CustomRoleDecRunner = configFile.Bind<string>(new ConfigDefinition("Role Descriptions", "Runner Description"), "You have more stamina and run much faster than everyone else!", new ConfigDescription("Role assignment text shown for Runner.", (AcceptableValueBase)null, Array.Empty<object>()));
			CustomRoleDecTank = configFile.Bind<string>(new ConfigDefinition("Role Descriptions", "Tank Description"), "You walk slower but your hp is doubled!", new ConfigDescription("Role assignment text shown for Tank.", (AcceptableValueBase)null, Array.Empty<object>()));
			CustomRoleDecGambler = configFile.Bind<string>(new ConfigDefinition("Role Descriptions", "Gambler Description"), "You rolled random effects:", new ConfigDescription("Role assignment text shown for Gambler before the rolled effects.", (AcceptableValueBase)null, Array.Empty<object>()));
			CustomRoleDecStrongman = configFile.Bind<string>(new ConfigDefinition("Role Descriptions", "Strongman Description"), "You're incredibly strong!", new ConfigDescription("Role assignment text shown for Strongman.", (AcceptableValueBase)null, Array.Empty<object>()));
			CustomRoleDecRL = configFile.Bind<string>(new ConfigDefinition("Role Descriptions", "Ranged Looter Description"), "You can reach objects from far away!", new ConfigDescription("Role assignment text shown for Ranged Looter.", (AcceptableValueBase)null, Array.Empty<object>()));
			CustomRoleDecAthletic = configFile.Bind<string>(new ConfigDefinition("Role Descriptions", "Athletic Description"), "You have more stamina, strength and can jump higher", new ConfigDescription("Role assignment text shown for Athletic.", (AcceptableValueBase)null, Array.Empty<object>()));
			CustomRoleDecMage = configFile.Bind<string>(new ConfigDefinition("Role Descriptions", "Mage Description"), "You are able to use your mana to become incredibly strong!", new ConfigDescription("Role assignment text shown for Mage.", (AcceptableValueBase)null, Array.Empty<object>()));
			CustomRoleDecReaper = configFile.Bind<string>(new ConfigDefinition("Role Descriptions", "Reaper Description"), "For each enemy you and your friends kill, you become stronger!", new ConfigDescription("Role assignment text shown for Reaper.", (AcceptableValueBase)null, Array.Empty<object>()));
			CustomRoleDecScout = configFile.Bind<string>(new ConfigDefinition("Role Descriptions", "Scout Description"), "Your stamina is more efficient and by pressing [G] you can see all enemies around you.", new ConfigDescription("Role assignment text shown for Scout. [G] is replaced with the configured Scout key.", (AcceptableValueBase)null, Array.Empty<object>()));
			CustomRoleDecRegular = configFile.Bind<string>(new ConfigDefinition("Role Descriptions", "Regular Description"), "You are just a regular Semibot. Nothing special.", new ConfigDescription("Role assignment text shown for Regular.", (AcceptableValueBase)null, Array.Empty<object>()));
			CustomRoleDecEngineer = configFile.Bind<string>(new ConfigDefinition("Role Descriptions", "Engineer Description"), "You can recharge Items with on charge but you lose Stamina", new ConfigDescription("Role assignment text shown for Engineer.", (AcceptableValueBase)null, Array.Empty<object>()));
			ValidateSavedRole();
		}

		public void RegisterMenu(Action updateManaDisplay)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Expected O, but got Unknown
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Expected O, but got Unknown
			this.updateManaDisplay = updateManaDisplay;
			MenuAPI.AddElementToSettingsMenu((BuilderDelegate)delegate(Transform parent)
			{
				//IL_0024: Unknown result type (might be due to invalid IL or missing references)
				EnsureConfigPage();
				buttonOpen = MenuAPI.CreateREPOButton("NuageRoles Config", (Action)delegate
				{
					RefreshRoleSlider();
					EnsureConfigPage().OpenPage(false);
				}, parent, new Vector2(500f, 10f));
			});
			MenuAPI.AddElementToLobbyMenu((BuilderDelegate)delegate(Transform parent)
			{
				//IL_001d: Unknown result type (might be due to invalid IL or missing references)
				buttonOpenLobby = MenuAPI.CreateREPOButton("NuageRoles Config", (Action)delegate
				{
					RefreshRoleSlider();
					EnsureConfigPage().OpenPage(false);
				}, parent, new Vector2(500f, 500f));
			});
		}

		public int GetSelectedRoleId(Random random)
		{
			string selectableRoleName = GetSelectableRoleName(SavedRole.Value);
			if (selectableRoleName == "Random")
			{
				return GetRandomEnabledRoleId(random);
			}
			return GetRoleId(selectableRoleName);
		}

		public int ResolveEnabledRoleIdOrRandom(int roleId, Random random)
		{
			if (IsRoleEnabled(roleId))
			{
				return roleId;
			}
			return GetRandomEnabledRoleId(random);
		}

		private REPOPopupPage EnsureConfigPage()
		{
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Expected O, but got Unknown
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Expected O, but got Unknown
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Expected O, but got Unknown
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Expected O, but got Unknown
			if ((Object)(object)configPage != (Object)null)
			{
				return configPage;
			}
			configPage = MenuAPI.CreateREPOPopupPage("NuageRoles", (PresetSide)0, true, true, 1.5f);
			configPage.AddElementToScrollView((ScrollViewBuilderDelegate)delegate(Transform scrollView)
			{
				//IL_0047: Unknown result type (might be due to invalid IL or missing references)
				if ((Object)(object)roleSlider == (Object)null)
				{
					roleSlider = MenuAPI.CreateREPOSlider("Role", "Choose your role", (Action<string>)SetSelectedRole, scrollView, GetAvailableRoleChoices(), GetSelectableRoleName(SavedRole.Value), new Vector2(0f, 0f), "", "", (BarBehavior)0);
				}
				return ((REPOElement)roleSlider).rectTransform;
			}, 0f, 0f);
			configPage.AddElementToScrollView((ScrollViewBuilderDelegate)delegate(Transform scrollView)
			{
				//IL_002b: Unknown result type (might be due to invalid IL or missing references)
				if ((Object)(object)afterDeathRoleToggle == (Object)null)
				{
					afterDeathRoleToggle = MenuAPI.CreateREPOToggle("Reassign role on respawn", (Action<bool>)SetReassignRoleAfterRevive, scrollView, new Vector2(0f, 0f), "ON", "OFF", AssignRoleAfterRevive.Value);
				}
				return ((REPOElement)afterDeathRoleToggle).rectTransform;
			}, 0f, 0f);
			configPage.AddElementToScrollView((ScrollViewBuilderDelegate)delegate(Transform scrollView)
			{
				//IL_002b: Unknown result type (might be due to invalid IL or missing references)
				if ((Object)(object)mageTopMana == (Object)null)
				{
					mageTopMana = MenuAPI.CreateREPOToggle("Mage Mana Position", (Action<bool>)SetMageManaTop, scrollView, new Vector2(0f, 0f), "TOP", "LEFT", MageTopManaConf.Value);
				}
				return ((REPOElement)mageTopMana).rectTransform;
			}, 0f, 0f);
			configPage.AddElement((BuilderDelegate)delegate(Transform parent)
			{
				//IL_0021: Unknown result type (might be due to invalid IL or missing references)
				if ((Object)(object)buttonClose == (Object)null)
				{
					buttonClose = MenuAPI.CreateREPOButton("Back", (Action)delegate
					{
						configPage.ClosePage(false);
					}, parent, Vector2.zero);
				}
			});
			return configPage;
		}

		private void SetSelectedRole(string roleName)
		{
			string value = NormalizeRoleName(roleName);
			SavedRole.Value = value;
			configFile.Save();
			RefreshRoleSlider();
		}

		private void SetReassignRoleAfterRevive(bool enabled)
		{
			AssignRoleAfterRevive.Value = enabled;
			configFile.Save();
		}

		private void SetMageManaTop(bool enabled)
		{
			MageTopManaConf.Value = enabled;
			configFile.Save();
			if (guiManager.isMage)
			{
				updateManaDisplay?.Invoke();
			}
		}

		private void RefreshRoleSlider()
		{
			if (!((Object)(object)roleSlider == (Object)null))
			{
				string[] availableRoleChoices = GetAvailableRoleChoices();
				string selectableRoleName = GetSelectableRoleName(SavedRole.Value);
				int num = Array.IndexOf(availableRoleChoices, selectableRoleName);
				if (num < 0)
				{
					num = 0;
				}
				roleSlider.stringOptions = availableRoleChoices;
				roleSlider.SetValue((float)num, false);
			}
		}

		private void ValidateSavedRole()
		{
			string value = SavedRole.Value;
			string text = NormalizeRoleName(value);
			if (!string.Equals(value, text, StringComparison.Ordinal))
			{
				NuageRolesPlugin.Logger.LogWarning((object)("Saved NuageRoles role '" + value + "' is invalid. Falling back to " + text + "."));
				SavedRole.Value = text;
				configFile.Save();
			}
		}

		private string[] GetAvailableRoleChoices()
		{
			List<string> list = new List<string> { "Random" };
			for (int i = 1; i < AllRoleChoices.Length; i++)
			{
				if (IsRoleEnabled(i))
				{
					list.Add(AllRoleChoices[i]);
				}
			}
			return list.ToArray();
		}

		private string GetSelectableRoleName(string? roleName)
		{
			string text = NormalizeRoleName(roleName);
			if (text == "Random" || IsRoleEnabled(text))
			{
				return text;
			}
			return "Random";
		}

		private string NormalizeRoleName(string? roleName)
		{
			if (string.IsNullOrWhiteSpace(roleName))
			{
				return "Strongman";
			}
			string[] allRoleChoices = AllRoleChoices;
			foreach (string text in allRoleChoices)
			{
				if (string.Equals(text, roleName.Trim(), StringComparison.OrdinalIgnoreCase))
				{
					return text;
				}
			}
			return "Strongman";
		}

		private int GetRandomEnabledRoleId(Random random)
		{
			List<int> enabledRoleIds = GetEnabledRoleIds();
			if (enabledRoleIds.Count == 0)
			{
				return -1;
			}
			return enabledRoleIds[random.Next(enabledRoleIds.Count)];
		}

		private List<int> GetEnabledRoleIds()
		{
			List<int> list = new List<int>();
			for (int i = 1; i < AllRoleChoices.Length; i++)
			{
				if (IsRoleEnabled(i))
				{
					list.Add(i);
				}
			}
			return list;
		}

		private int GetRoleId(string roleName)
		{
			for (int i = 0; i < AllRoleChoices.Length; i++)
			{
				if (AllRoleChoices[i] == roleName)
				{
					return i;
				}
			}
			return -1;
		}

		private bool IsRoleEnabled(string roleName)
		{
			return IsRoleEnabled(GetRoleId(roleName));
		}

		private bool IsRoleEnabled(int roleId)
		{
			return roleId switch
			{
				1 => EnableRunner.Value, 
				2 => EnableTank.Value, 
				3 => EnableGambler.Value, 
				4 => EnableStrongman.Value, 
				5 => EnableRL.Value, 
				6 => EnableAthletic.Value, 
				7 => EnableMage.Value, 
				8 => EnableReaper.Value, 
				9 => EnableScout.Value, 
				10 => EnableRegular.Value, 
				11 => EnableEngineer.Value, 
				_ => false, 
			};
		}
	}
	[BepInPlugin("com.theohay.nuageroles", "NuageRoles", "4.0.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class NuageRolesPlugin : BaseUnityPlugin
	{
		private sealed class RoleUpgradeDefinition
		{
			public string AssetName { get; }

			public string UpgradeId { get; }

			public string StatKey { get; }

			public RoleUpgradeDefinition(string assetName, string upgradeId, string statKey)
			{
				AssetName = assetName;
				UpgradeId = upgradeId;
				StatKey = statKey;
			}
		}

		private sealed class NuageRolesUpgradeRuntimeBinder : MonoBehaviour
		{
			public string upgradeName = string.Empty;

			private ItemToggle? itemToggle;

			private ItemUpgrade? itemUpgrade;

			private REPOLibItemUpgrade? repoLibUpgrade;

			private ItemAttributes? itemAttributes;

			private bool eventsBound;

			private void Awake()
			{
				RefreshComponents();
				BindRuntimeEvents();
			}

			private void Start()
			{
				RefreshComponents();
				BindRuntimeEvents();
				EnableToggleWhenUsable();
			}

			private void Update()
			{
				if ((Object)(object)itemToggle == (Object)null || (Object)(object)itemUpgrade == (Object)null || (Object)(object)repoLibUpgrade == (Object)null || (Object)(object)itemAttributes == (Object)null)
				{
					RefreshComponents();
				}
				if (!eventsBound)
				{
					BindRuntimeEvents();
				}
				EnableToggleWhenUsable();
			}

			private void RefreshComponents()
			{
				itemToggle = ((Component)this).GetComponent<ItemToggle>();
				itemUpgrade = ((Component)this).GetComponent<ItemUpgrade>();
				repoLibUpgrade = ((Component)this).GetComponent<REPOLibItemUpgrade>();
				itemAttributes = ((Component)this).GetComponent<ItemAttributes>();
			}

			private void BindRuntimeEvents()
			{
				//IL_0084: Unknown result type (might be due to invalid IL or missing references)
				//IL_008e: Expected O, but got Unknown
				//IL_0053: Unknown result type (might be due to invalid IL or missing references)
				//IL_005d: Expected O, but got Unknown
				//IL_00db: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e5: Expected O, but got Unknown
				//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b4: Expected O, but got Unknown
				if (!((Object)(object)itemToggle == (Object)null) && !((Object)(object)itemUpgrade == (Object)null) && !((Object)(object)repoLibUpgrade == (Object)null))
				{
					itemToggle.playSound = false;
					itemToggle.autoTurnOffWhenEquipped = true;
					ItemToggle val = itemToggle;
					if (val.onToggle == null)
					{
						val.onToggle = new UnityEvent();
					}
					((UnityEventBase)itemToggle.onToggle).RemoveAllListeners();
					itemToggle.onToggle.AddListener(new UnityAction(itemUpgrade.PlayerUpgrade));
					itemUpgrade.isPlayerUpgrade = true;
					ItemUpgrade val2 = itemUpgrade;
					if (val2.upgradeEvent == null)
					{
						val2.upgradeEvent = new UnityEvent();
					}
					((UnityEventBase)itemUpgrade.upgradeEvent).RemoveAllListeners();
					itemUpgrade.upgradeEvent.AddListener(new UnityAction(repoLibUpgrade.Upgrade));
					SetFieldIfAvailable(typeof(REPOLibItemUpgrade), repoLibUpgrade, "_itemToggle", itemToggle);
					eventsBound = true;
				}
			}

			private void EnableToggleWhenUsable()
			{
				if ((Object)(object)itemToggle != (Object)null && !((Behaviour)itemToggle).enabled && IsUsable())
				{
					((Behaviour)itemToggle).enabled = true;
				}
			}

			private bool IsUsable()
			{
				if (SemiFunc.RunIsShop())
				{
					return IsPurchased();
				}
				return true;
			}

			private bool IsPurchased()
			{
				if ((Object)(object)StatsManager.instance == (Object)null || (Object)(object)itemAttributes?.item == (Object)null)
				{
					return false;
				}
				if (StatsManager.instance.itemsPurchased.TryGetValue(((Object)itemAttributes.item).name, out var value))
				{
					return value > 0;
				}
				return false;
			}
		}

		public const string PluginGuid = "com.theohay.nuageroles";

		public const string PluginName = "NuageRoles";

		public const string PluginVersion = "4.0.0";

		public const string AssetBundleName = "NuageRoles_assets";

		private const string ManaUpgradeStatKey = "playerUpgradeManaRegeneration";

		private const string ScoutUpgradeStatKey = "playerUpgradeScoutCooldownReduction";

		private static readonly Vector3 UpgradeColliderSize = new Vector3(0.17882313f, 0.26898482f, 0.07221024f);

		private static readonly RoleUpgradeDefinition[] RoleUpgradeDefinitions = new RoleUpgradeDefinition[2]
		{
			new RoleUpgradeDefinition("Mana Regeneration Upgrade", "ManaRegeneration", "playerUpgradeManaRegeneration"),
			new RoleUpgradeDefinition("Scout Cooldown Upgrade", "ScoutCooldownReduction", "playerUpgradeScoutCooldownReduction")
		};

		private static PhysAttribute? upgradePhysAttributePreset;

		public readonly Harmony harmony = new Harmony("com.theohay.nuageroles");

		public static Font newFont = null;

		public static guiManager GUIinstance = null;

		public static NuageRolesPlugin Instance { get; private set; } = null;


		internal static ManualLogSource Logger { get; private set; } = null;


		public static NuageRolesConfig Settings { get; private set; } = null;


		public static string getPath()
		{
			return Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "NuageRoles_assets");
		}

		private void Awake()
		{
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Expected O, but got Unknown
			Instance = this;
			Logger = ((BaseUnityPlugin)this).Logger;
			Settings = new NuageRolesConfig(((BaseUnityPlugin)this).Config);
			Settings.Bind();
			Settings.RegisterMenu(delegate
			{
				if ((Object)(object)GUIinstance != (Object)null)
				{
					GUIinstance.UpdateManaDisplay();
				}
			});
			if ((Object)Instance == (Object)null)
			{
				Instance = this;
			}
			harmony.PatchAll(typeof(NuageRolesPlugin));
			harmony.PatchAll(typeof(Sender));
			Logger.LogInfo((object)"Plugin NuageRoles v4.0.0 loaded successfully.");
			SceneManager.sceneLoaded += delegate
			{
				//IL_000d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0013: Expected O, but got Unknown
				//IL_0032: Unknown result type (might be due to invalid IL or missing references)
				//IL_0037: Unknown result type (might be due to invalid IL or missing references)
				//IL_003d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0047: Expected O, but got Unknown
				if ((Object)(object)GUIinstance == (Object)null)
				{
					GameObject val7 = new GameObject();
					GUIinstance = val7.AddComponent<guiManager>();
					GUIinstance.text = "";
					GUIinstance.color = Color.cyan;
					Object.DontDestroyOnLoad((Object)val7);
				}
			};
			harmony.PatchAll(typeof(PunManagerPatch));
			harmony.PatchAll(typeof(PlayerAvatarPatch));
			harmony.PatchAll(typeof(StatsManagerPatch));
			harmony.PatchAll(typeof(ShopManagerPatch));
			harmony.PatchAll(typeof(EnemyHealthPatch));
			BundleLoader.LoadBundle(getPath(), (Action<AssetBundle>)delegate(AssetBundle assetBundle)
			{
				RoleUpgradeDefinition[] roleUpgradeDefinitions = RoleUpgradeDefinitions;
				PlayerUpgrade val6 = default(PlayerUpgrade);
				foreach (RoleUpgradeDefinition upgrade in roleUpgradeDefinitions)
				{
					try
					{
						string assetName = upgrade.AssetName;
						Item val = assetBundle.LoadAsset<Item>(assetName);
						if ((Object)(object)val == (Object)null)
						{
							Logger.LogError((object)("Failed loading Item asset '" + assetName + "' from bundle."));
						}
						else
						{
							GameObject val2 = assetBundle.LoadAsset<GameObject>(assetName);
							if ((Object)(object)val2 == (Object)null)
							{
								Logger.LogError((object)("Failed loading prefab for upgrade '" + assetName + "'. Make sure the prefab is included in the bundle."));
							}
							else
							{
								string name = (((Object)val2).name = "REPORoles_upgrade " + assetName);
								((Object)val).name = name;
								val.itemName = assetName ?? "";
								val.physicalItem = true;
								if (ValidateUpgradeItem(val, assetName))
								{
									ItemAttributes val3 = PrepareUpgradePrefab(val2, val, upgrade);
									if (!((Object)(object)val3 == (Object)null))
									{
										PrefabRef val4 = Items.RegisterItem(val3);
										if (val4 == null)
										{
											Logger.LogWarning((object)("Items.RegisterItem returned null for '" + assetName + "'. It may already be registered or there was an error."));
										}
										else
										{
											Logger.LogInfo((object)("Registered upgrade item '" + assetName + "'."));
										}
										PlayerUpgrade val5 = Upgrades.RegisterUpgrade(upgrade.UpgradeId, val, (Action<PlayerAvatar, int>)delegate(PlayerAvatar player, int level)
										{
											ApplyRoleUpgradeLevel(upgrade, player, level);
										}, (Action<PlayerAvatar, int>)delegate(PlayerAvatar player, int level)
										{
											ApplyRoleUpgradeLevel(upgrade, player, level);
										});
										if (val5 == null)
										{
											if (Upgrades.TryGetUpgrade(upgrade.UpgradeId, ref val6) && val6 != null)
											{
												AttachUpgradeDictionary(upgrade, val6);
												Logger.LogWarning((object)("Role upgrade '" + assetName + "' was already registered; attached existing REPOLib id '" + upgrade.UpgradeId + "'."));
											}
											else
											{
												Logger.LogWarning((object)("Failed to register role upgrade '" + assetName + "' with REPOLib id '" + upgrade.UpgradeId + "'."));
											}
										}
										else
										{
											AttachUpgradeDictionary(upgrade, val5);
											Logger.LogInfo((object)("Registered role upgrade '" + assetName + "' with REPOLib id '" + upgrade.UpgradeId + "' and stat key '" + upgrade.StatKey + "'."));
										}
									}
								}
							}
						}
					}
					catch (Exception arg)
					{
						Logger.LogError((object)$"Exception while registering upgrade '{upgrade.AssetName}': {arg}");
					}
				}
			}, false);
		}

		private static bool ValidateUpgradeItem(Item item, string upgradeName)
		{
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Invalid comparison between Unknown and I4
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Invalid comparison between Unknown and I4
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)item.value == (Object)null)
			{
				Logger.LogError((object)("Upgrade Item asset '" + upgradeName + "' has no Value asset. Fix the bundle and rebuild it."));
				return false;
			}
			if ((int)item.itemType != 3)
			{
				Logger.LogError((object)$"Upgrade Item asset '{upgradeName}' has itemType '{item.itemType}', expected '{(object)(itemType)3}'. Fix the bundle and rebuild it.");
				return false;
			}
			if ((int)item.itemVolume != 6)
			{
				Logger.LogError((object)$"Upgrade Item asset '{upgradeName}' has itemVolume '{item.itemVolume}', expected '{(object)(itemVolume)6}'. Fix the bundle and rebuild it.");
				return false;
			}
			if (!item.maxPurchase || item.maxPurchaseAmount <= 0)
			{
				Logger.LogError((object)("Upgrade Item asset '" + upgradeName + "' must enable maxPurchase and set maxPurchaseAmount above zero. Fix the bundle and rebuild it."));
				return false;
			}
			if (item.maxAmount <= 0 || item.maxAmountInShop <= 0 || item.minPlayerCount <= 0)
			{
				Logger.LogError((object)("Upgrade Item asset '" + upgradeName + "' has invalid shop counts. Fix the bundle and rebuild it."));
				return false;
			}
			Logger.LogInfo((object)$"Loaded upgrade Item asset '{upgradeName}' with value seed {item.value.valueMin}-{item.value.valueMax}.");
			return true;
		}

		private static ItemAttributes? PrepareUpgradePrefab(GameObject prefab, Item item, RoleUpgradeDefinition upgrade)
		{
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_0185: 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)
			string assetName = upgrade.AssetName;
			Rigidbody component = prefab.GetComponent<Rigidbody>();
			if ((Object)(object)component == (Object)null)
			{
				Logger.LogError((object)("Upgrade prefab '" + assetName + "' has no Rigidbody. Fix the bundle prefab and rebuild it."));
				return null;
			}
			PhotonView value = prefab.GetComponent<PhotonView>() ?? prefab.AddComponent<PhotonView>();
			PhotonTransformView value2 = prefab.GetComponent<PhotonTransformView>() ?? prefab.AddComponent<PhotonTransformView>();
			RoomVolumeCheck val = prefab.GetComponent<RoomVolumeCheck>() ?? prefab.AddComponent<RoomVolumeCheck>();
			if (val.CurrentRooms == null)
			{
				val.CurrentRooms = new List<RoomVolume>();
			}
			val.Continuous = true;
			val.currentSize = UpgradeColliderSize;
			val.CheckPosition = Vector3.zero;
			PhysGrabObject val2 = prefab.GetComponent<PhysGrabObject>() ?? prefab.AddComponent<PhysGrabObject>();
			val2.rb = component;
			val2.clientNonKinematic = true;
			val2.overrideTagsAndLayers = true;
			val2.ignoreGrabPointCentering = false;
			if (val2.playerGrabbing == null)
			{
				val2.playerGrabbing = new List<PhysGrabber>();
			}
			ConfigureUpgradeTemplateChildren(prefab.transform, assetName);
			BoxCollider val3 = ConfigureGrabCollider(prefab.transform, val2, assetName);
			if ((Object)(object)val3 == (Object)null)
			{
				return null;
			}
			PhysGrabObjectImpactDetector val4 = prefab.GetComponent<PhysGrabObjectImpactDetector>() ?? prefab.AddComponent<PhysGrabObjectImpactDetector>();
			ConfigureUpgradeImpactDetector(val4);
			NotValuableObject val5 = prefab.GetComponent<NotValuableObject>() ?? prefab.AddComponent<NotValuableObject>();
			val5.physAttributePreset = GetUpgradePhysAttributePreset();
			val5.hasHealth = false;
			val5.healthDestroy = false;
			val5.healthMax = 0;
			ItemAttributes val6 = prefab.GetComponent<ItemAttributes>() ?? prefab.AddComponent<ItemAttributes>();
			val6.item = item;
			val6.costOffset = new Vector3(0f, 0.18f, 0f);
			SetFieldIfAvailable(typeof(ItemAttributes), val6, "roomVolumeCheck", val);
			SetFieldIfAvailable(typeof(ItemAttributes), val6, "physGrabObject", val2);
			SetFieldIfAvailable(typeof(ItemAttributes), val6, "photonView", value);
			SetFieldIfAvailable(typeof(PhysGrabObject), val2, "roomVolumeCheck", val);
			SetFieldIfAvailable(typeof(PhysGrabObject), val2, "photonView", value);
			SetFieldIfAvailable(typeof(PhysGrabObject), val2, "photonTransformView", value2);
			SetFieldIfAvailable(typeof(PhysGrabObject), val2, "impactDetector", val4);
			REPOLibItemUpgrade obj = prefab.GetComponent<REPOLibItemUpgrade>() ?? prefab.AddComponent<REPOLibItemUpgrade>();
			AccessTools.Field(typeof(REPOLibItemUpgrade), "_upgradeId").SetValue(obj, upgrade.UpgradeId);
			if (!ConfigureUpgradeConsumption(prefab, upgrade))
			{
				return null;
			}
			NuageRolesUpgradeRuntimeBinder nuageRolesUpgradeRuntimeBinder = prefab.GetComponent<NuageRolesUpgradeRuntimeBinder>() ?? prefab.AddComponent<NuageRolesUpgradeRuntimeBinder>();
			nuageRolesUpgradeRuntimeBinder.upgradeName = assetName;
			Logger.LogInfo((object)("Prepared upgrade prefab '" + assetName + "' with runtime shop item components, REPOLib upgrade id '" + upgrade.UpgradeId + "', and collider '" + ((Object)val3).name + "'."));
			return val6;
		}

		private static bool ConfigureUpgradeConsumption(GameObject prefab, RoleUpgradeDefinition upgrade)
		{
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Expected O, but got Unknown
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Expected O, but got Unknown
			string assetName = upgrade.AssetName;
			EnsureParticleEffects(prefab.transform, assetName);
			ItemToggle val = prefab.GetComponent<ItemToggle>() ?? prefab.AddComponent<ItemToggle>();
			val.playSound = false;
			val.autoTurnOffWhenEquipped = true;
			val.onToggle = new UnityEvent();
			ItemUpgrade val2 = prefab.GetComponent<ItemUpgrade>() ?? prefab.AddComponent<ItemUpgrade>();
			val2.isPlayerUpgrade = true;
			val2.upgradeEvent = new UnityEvent();
			return true;
		}

		internal static void AttachRegisteredUpgradeDictionaries()
		{
			RoleUpgradeDefinition[] roleUpgradeDefinitions = RoleUpgradeDefinitions;
			PlayerUpgrade val = default(PlayerUpgrade);
			foreach (RoleUpgradeDefinition roleUpgradeDefinition in roleUpgradeDefinitions)
			{
				if (Upgrades.TryGetUpgrade(roleUpgradeDefinition.UpgradeId, ref val) && val != null)
				{
					AttachUpgradeDictionary(roleUpgradeDefinition, val);
				}
			}
		}

		private static void AttachUpgradeDictionary(RoleUpgradeDefinition upgrade, PlayerUpgrade playerUpgrade)
		{
			Dictionary<string, int> dictionary = EnsureUpgradeDictionary(upgrade.StatKey);
			if (dictionary != null)
			{
				playerUpgrade.PlayerDictionary = dictionary;
			}
		}

		private static void ApplyRoleUpgradeLevel(RoleUpgradeDefinition upgrade, PlayerAvatar player, int level)
		{
			if ((Object)(object)player == (Object)null)
			{
				return;
			}
			string text = SemiFunc.PlayerGetSteamID(player);
			if (string.IsNullOrEmpty(text))
			{
				Logger.LogWarning((object)("Could not apply role upgrade '" + upgrade.AssetName + "': player steam ID was empty."));
				return;
			}
			Upgrader.SetStat(level, text, upgrade.StatKey);
			if (player.isLocal)
			{
				ApplyLocalRoleUpgradeEffects(upgrade.StatKey);
			}
			Logger.LogInfo((object)$"Applied role upgrade '{upgrade.AssetName}' at level {level} for {text}.");
		}

		private static Dictionary<string, int>? EnsureUpgradeDictionary(string statKey)
		{
			if ((Object)(object)StatsManager.instance == (Object)null)
			{
				return null;
			}
			if (!StatsManager.instance.dictionaryOfDictionaries.TryGetValue(statKey, out var value))
			{
				value = new Dictionary<string, int>();
				StatsManager.instance.dictionaryOfDictionaries.Add(statKey, value);
			}
			return value;
		}

		private static void ApplyLocalRoleUpgradeEffects(string statKey)
		{
			if (statKey == "playerUpgradeManaRegeneration")
			{
				Update_ManaRegeneration();
			}
			else if (statKey == "playerUpgradeScoutCooldownReduction")
			{
				Update_ScoutCooldown();
			}
		}

		private static void ConfigureUpgradeImpactDetector(PhysGrabObjectImpactDetector impactDetector)
		{
			impactDetector.particleDisable = true;
			impactDetector.particleBreakSmokeDisable = true;
			impactDetector.hasFreezeFrameOnBreakParticles = false;
			impactDetector.particleMultiplier = 0f;
			impactDetector.playerHurtDisable = true;
			impactDetector.slidingDisable = true;
			impactDetector.indestructibleBreakEffects = false;
			impactDetector.canHurtLogic = false;
			impactDetector.destroyDisable = false;
			impactDetector.isCart = false;
			impactDetector.fragility = 0f;
			impactDetector.durability = 100f;
			SetFieldIfAvailable(typeof(PhysGrabObjectImpactDetector), impactDetector, "impactDisable", true);
			SetFieldIfAvailable(typeof(PhysGrabObjectImpactDetector), impactDetector, "breakLogic", false);
			SetFieldIfAvailable(typeof(PhysGrabObjectImpactDetector), impactDetector, "audioActive", false);
			SetFieldIfAvailable(typeof(PhysGrabObjectImpactDetector), impactDetector, "breakLevelHeavy", 0);
			SetFieldIfAvailable(typeof(PhysGrabObjectImpactDetector), impactDetector, "breakLevelMedium", 0);
			SetFieldIfAvailable(typeof(PhysGrabObjectImpactDetector), impactDetector, "breakLevelLight", 0);
		}

		private static PhysAttribute GetUpgradePhysAttributePreset()
		{
			if ((Object)(object)upgradePhysAttributePreset == (Object)null)
			{
				upgradePhysAttributePreset = ScriptableObject.CreateInstance<PhysAttribute>();
				((Object)upgradePhysAttributePreset).name = "Repo Roles Upgrade PhysAttribute";
				upgradePhysAttributePreset.mass = 0.25f;
			}
			return upgradePhysAttributePreset;
		}

		private static void ConfigureUpgradeTemplateChildren(Transform root, string upgradeName)
		{
			Transform val = root.Find("Force Grab Point");
			if ((Object)(object)val != (Object)null)
			{
				SetLayerIfAvailable(((Component)val).gameObject, "PhysGrabObject");
				TrySetTag(((Component)val).gameObject, "Untagged");
			}
			else
			{
				Logger.LogWarning((object)("Upgrade prefab '" + upgradeName + "' is missing child 'Force Grab Point'. Fix the bundle prefab and rebuild it."));
			}
			if ((Object)(object)root.Find("ItemEquipCube") == (Object)null)
			{
				Logger.LogWarning((object)("Upgrade prefab '" + upgradeName + "' is missing child 'ItemEquipCube'. Fix the bundle prefab and rebuild it."));
			}
		}

		private static void EnsureParticleEffects(Transform root, string upgradeName)
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Expected O, but got Unknown
			Transform val = root.Find("Particle Effects");
			if ((Object)(object)val == (Object)null)
			{
				GameObject val2 = new GameObject("Particle Effects");
				val = val2.transform;
				val.SetParent(root, false);
				Logger.LogWarning((object)("Upgrade prefab '" + upgradeName + "' is missing child 'Particle Effects'. Created an empty runtime placeholder."));
			}
			((Component)val).gameObject.SetActive(false);
		}

		private static BoxCollider? ConfigureGrabCollider(Transform root, PhysGrabObject physGrabObject, string upgradeName)
		{
			Transform val = root.Find("Semi Box Collider");
			if ((Object)(object)val == (Object)null)
			{
				Logger.LogError((object)("Upgrade prefab '" + upgradeName + "' is missing child 'Semi Box Collider'. Fix the bundle prefab and rebuild it."));
				return null;
			}
			SetLayerIfAvailable(((Component)val).gameObject, "PhysGrabObject");
			TrySetTag(((Component)val).gameObject, "Phys Grab Object");
			BoxCollider component = ((Component)val).GetComponent<BoxCollider>();
			if ((Object)(object)component == (Object)null)
			{
				Logger.LogError((object)("Upgrade prefab '" + upgradeName + "' child 'Semi Box Collider' has no BoxCollider. Fix the bundle prefab and rebuild it."));
				return null;
			}
			if ((Object)(object)((Component)val).GetComponent<PhysGrabObjectBoxCollider>() == (Object)null)
			{
				((Component)val).gameObject.AddComponent<PhysGrabObjectBoxCollider>();
			}
			PhysGrabObjectCollider instance = ((Component)val).GetComponent<PhysGrabObjectCollider>() ?? ((Component)val).gameObject.AddComponent<PhysGrabObjectCollider>();
			SetFieldIfAvailable(typeof(PhysGrabObjectCollider), instance, "physGrabObject", physGrabObject);
			return component;
		}

		private static void SetLayerIfAvailable(GameObject gameObject, string layerName)
		{
			int num = LayerMask.NameToLayer(layerName);
			if (num >= 0)
			{
				gameObject.layer = num;
			}
		}

		private static void TrySetTag(GameObject gameObject, string tag)
		{
			try
			{
				gameObject.tag = tag;
			}
			catch (UnityException)
			{
				Logger.LogWarning((object)("Could not set upgrade prefab tag '" + tag + "'."));
			}
		}

		private static void SetFieldIfAvailable(Type type, object instance, string fieldName, object value)
		{
			FieldInfo fieldInfo = AccessTools.Field(type, fieldName);
			if (fieldInfo != null)
			{
				fieldInfo.SetValue(instance, value);
			}
		}

		public static void Update_ManaRegeneration()
		{
			if (LevelGenerator.Instance.Generated && !SemiFunc.MenuLevel())
			{
				int stat = Upgrader.GetStat(PlayerAvatar.instance.steamID, "playerUpgradeManaRegeneration");
				guiManager.manaRegenRate = Upgrader.GetStat(PlayerAvatar.instance.steamID, "playerUpgradeManaRegeneration");
			}
		}

		public static void Update_ScoutCooldown()
		{
			if (LevelGenerator.Instance.Generated && !SemiFunc.MenuLevel())
			{
				int stat = Upgrader.GetStat(PlayerAvatar.instance.steamID, "playerUpgradeScoutCooldownReduction");
				ScoutMarker.reductionUpgrades = Upgrader.GetStat(PlayerAvatar.instance.steamID, "playerUpgradeScoutCooldownReduction");
			}
		}
	}
	[HarmonyPatch(typeof(PunManager))]
	internal static class PunManagerPatch
	{
		[HarmonyPostfix]
		[HarmonyPatch("Start")]
		private static void Start_Postfix(PunManager __instance)
		{
			if ((Object)(object)ComponentHolderProtocol.GetComponent<StrengthManager>((Object)(object)__instance) == (Object)null)
			{
				ComponentHolderProtocol.AddComponent<StrengthManager>((Object)(object)__instance);
			}
			if ((Object)(object)ComponentHolderProtocol.GetComponent<HealthManager>((Object)(object)__instance) == (Object)null)
			{
				ComponentHolderProtocol.AddComponent<HealthManager>((Object)(object)__instance);
			}
			if ((Object)(object)ComponentHolderProtocol.GetComponent<ScoutMarker>((Object)(object)__instance) == (Object)null)
			{
				ComponentHolderProtocol.AddComponent<ScoutMarker>((Object)(object)__instance);
			}
		}
	}
	public class ScoutMarker : MonoBehaviour
	{
		private int cooldownTicker;

		private int activeTicker;

		private bool isActive;

		private bool onCooldown = true;

		public static int reductionUpgrades;

		private static int SecondsToFixedTicks(float seconds)
		{
			return Mathf.Max(1, Mathf.RoundToInt(Mathf.Max(0f, seconds) / Time.fixedDeltaTime));
		}

		private static int GetActiveTicks()
		{
			return SecondsToFixedTicks(NuageRolesPlugin.Settings.ScoutAbilityDurationSeconds.Value);
		}

		private static int GetCooldownTicks()
		{
			int num = Mathf.Max(0, Mathf.RoundToInt(Mathf.Max(0f, (float)NuageRolesPlugin.Settings.ScoutAbilityCooldownSeconds.Value) / Time.fixedDeltaTime));
			int num2 = num - reductionUpgrades * 250;
			if (reductionUpgrades > 5)
			{
				num2 = Mathf.Min(num, 750);
			}
			return Mathf.Max(0, num2);
		}

		private void ResetState()
		{
			cooldownTicker = 0;
			activeTicker = 0;
			isActive = false;
			onCooldown = true;
		}

		private void OnGUI()
		{
			//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_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Expected O, but got Unknown
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Expected O, but got Unknown
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Expected O, but got Unknown
			//IL_00c5: 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_00df: Expected O, but got Unknown
			//IL_0326: Unknown result type (might be due to invalid IL or missing references)
			//IL_0353: Unknown result type (might be due to invalid IL or missing references)
			//IL_0395: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d9: 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_0115: Expected O, but got Unknown
			//IL_0154: Unknown result type (might be due to invalid IL or missing references)
			//IL_015f: Expected O, but got Unknown
			//IL_0166: Unknown result type (might be due to invalid IL or missing references)
			//IL_0171: Expected O, but got Unknown
			//IL_02b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_017f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0184: Unknown result type (might be due to invalid IL or missing references)
			//IL_0189: 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_01ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cb: Expected O, but got Unknown
			//IL_01c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cb: 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_01db: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0200: Unknown result type (might be due to invalid IL or missing references)
			//IL_0214: Unknown result type (might be due to invalid IL or missing references)
			//IL_021b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0222: Unknown result type (might be due to invalid IL or missing references)
			if (!SemiFunc.RunIsLevel() || SemiFunc.RunIsShop() || PlayerAvatar.instance.playerHealth.health <= 0)
			{
				return;
			}
			GUIStyle val = new GUIStyle(GUI.skin.label)
			{
				alignment = (TextAnchor)4,
				fontSize = 22
			};
			val.normal.textColor = new Color(0.902f, 0.733f, 0.11f);
			if ((Object)guiManager.customFont != (Object)null)
			{
				val.font = guiManager.customFont;
			}
			if (EnemyDirector.instance.enemiesSpawned != null && ClassManager.isScout && isActive)
			{
				GUIStyle val2 = new GUIStyle(GUI.skin.label)
				{
					alignment = (TextAnchor)4,
					fontSize = 22
				};
				val2.normal.textColor = Color.red;
				if ((Object)guiManager.customFont != (Object)null)
				{
					val2.font = guiManager.customFont;
				}
				foreach (EnemyParent item in EnemyDirector.instance.enemiesSpawned)
				{
					if ((Object)item == (Object)null || !item.EnableObject.activeInHierarchy)
					{
						continue;
					}
					object? value = AccessTools.Field(typeof(EnemyParent), "Enemy").GetValue(item);
					Enemy val3 = (Enemy)((value is Enemy) ? value : null);
					Camera main = Camera.main;
					if ((Object)val3 != (Object)null && (Object)main != (Object)null)
					{
						Vector3 val4 = main.WorldToViewportPoint(val3.CenterTransform.position);
						if (!(val4.z < 0f))
						{
							string enemyName = item.enemyName;
							string text = $"{enemyName} [{val4.z:F0}m]";
							Vector2 val5 = val2.CalcSize(new GUIContent(text));
							float num = val4.x * (float)Screen.width - val5.x / 2f;
							float num2 = (float)Screen.height - val4.y * (float)Screen.height - val5.y / 2f;
							GUI.Label(new Rect(num, num2, val5.x, val5.y), text, val2);
						}
					}
				}
				if (isActive && !onCooldown)
				{
					int num3 = Screen.width / 2 - 100;
					int num4 = Screen.height - 125;
					string text2 = Mathf.CeilToInt((float)activeTicker * Time.fixedDeltaTime).ToString();
					string text3 = "Ability runs out in: " + text2 + "s";
					GUI.Label(new Rect((float)num3, (float)num4, 200f, 50f), text3, val);
				}
			}
			if (!isActive && ClassManager.isScout && onCooldown)
			{
				int num5 = Screen.width / 2 - 100;
				int num6 = Screen.height - 125;
				string text4 = Mathf.CeilToInt((float)cooldownTicker * Time.fixedDeltaTime).ToString();
				val.normal.textColor = new Color(0.851f, 0.667f, 0.098f);
				string text5 = "Ability is ready in: " + text4 + "s";
				GUI.Label(new Rect((float)num5, (float)num6, 200f, 60f), text5, val);
			}
			else if (!isActive && ClassManager.isScout && cooldownTicker <= 0)
			{
				int num7 = Screen.width / 2 - 100;
				int num8 = Screen.height - 125;
				val.normal.textColor = Color.green;
				string text6 = "Ability is ready!\nPress [" + ((object)NuageRolesPlugin.Settings.ScoutKey.Value).ToString() + "] to activate";
				GUI.Label(new Rect((float)num7, (float)num8, 200f, 60f), text6, val);
			}
		}

		private void FixedUpdate()
		{
			if (!ClassManager.isScout)
			{
				ResetState();
				return;
			}
			if (isActive)
			{
				activeTicker--;
			}
			if (isActive && activeTicker <= 0)
			{
				isActive = false;
				onCooldown = true;
				cooldownTicker = GetCooldownTicks();
			}
			if (cooldownTicker <= 0)
			{
				onCooldown = false;
			}
			if (cooldownTicker >= 0 && onCooldown)
			{
				cooldownTicker--;
			}
		}

		private void Update()
		{
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			if (ClassManager.isScout && SemiFunc.RunIsLevel() && !SemiFunc.RunIsShop() && !ChatManager.instance.chatActive && !onCooldown && Input.GetKeyDown(NuageRolesPlugin.Settings.ScoutKey.Value))
			{
				activeTicker = GetActiveTicks();
				isActive = true;
			}
		}
	}
}
namespace NuageRoles.Roles
{
	public class ClassManager
	{
		private Random rnd = new Random();

		public int chosenRoleId;

		public ReaperManager rMan;

		public readonly Harmony harmonyPatcher = new Harmony("patches.NuageRolesPlugin.mod");

		public static int stackKills;

		public static bool isTank;

		public static bool isScout;

		public static bool isEngineer;

		private static float MinMultiplier(float value)
		{
			return Mathf.Max(0.1f, value);
		}

		private static float NonNegative(float value)
		{
			return Mathf.Max(0f, value);
		}

		private static int NonNegative(int value)
		{
			return Mathf.Max(0, value);
		}

		private static int ScaleHealthValue(int value, float multiplier)
		{
			if (value <= 0)
			{
				return value;
			}
			return Mathf.Max(1, Mathf.RoundToInt((float)value * MinMultiplier(multiplier)));
		}

		private void assignRandomEnabledRole()
		{
			int num = NuageRolesPlugin.Settings.ResolveEnabledRoleIdOrRandom(-1, rnd);
			if (num <= 0)
			{
				NuageRolesPlugin.Logger.LogWarning((object)"Unable to roll a fallback role because all roles are disabled.");
				return;
			}
			assignRole(num, PlayerController.instance);
			NuageRolesPlugin.Logger.LogInfo((object)"You got assigned a new random enabled role because this one was disabled.");
		}

		public int genGamblerEffectNr()
		{
			return rnd.Next(0, 5);
		}

		public object[] genGamblerEffects()
		{
			string[] array = new string[5] { "You walk faster", "You have more stamina", "You have more health", "You\u00b4re stronger", "You jump higher" };
			string[] array2 = new string[5] { "you walk slower", "you have less stamina", "you have less health", "you\u00b4re weaker", "you don\u00b4t jump as high" };
			int num = genGamblerEffectNr();
			int num2 = genGamblerEffectNr();
			while (num == num2)
			{
				num = genGamblerEffectNr();
				num2 = genGamblerEffectNr();
			}
			string text = array[num];
			string text2 = array2[num2];
			string text3 = NuageRolesPlugin.Settings.CustomRoleDecGambler.Value + " " + text + " but " + text2 + "!";
			return new object[3] { text3, num, num2 };
		}

		public void assignRoleFromConfig(PlayerController __instance)
		{
			chosenRoleId = NuageRolesPlugin.Settings.GetSelectedRoleId(rnd);
			assignRole(chosenRoleId, __instance);
		}

		private void modifyStrength(string steamID, float newStrength)
		{
			if (!SemiFunc.IsMultiplayer())
			{
				PlayerAvatar.instance.physGrabber.grabStrength = newStrength;
				return;
			}
			PunManager.instance.photonView.RPC("setStrengthRPC", (RpcTarget)0, new object[2] { steamID, newStrength });
		}

		private void setHealth(string steamID, int maxHealth, int health)
		{
			if (!SemiFunc.IsMultiplayer())
			{
				PlayerAvatar.instance.playerHealth.health = health;
				PlayerAvatar.instance.playerHealth.maxHealth = maxHealth;
				return;
			}
			PunManager.instance.photonView.RPC("setHealthRPC", (RpcTarget)0, new object[3] { steamID, maxHealth, health });
		}

		public void setReaperStatus(string steamID, bool isReaper)
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Expected O, but got Unknown
			if (!SemiFunc.IsMultiplayer())
			{
				((Component)PlayerAvatar.instance).GetComponent<ReaperManager>().isReaper = isReaper;
			}
			else if ((Object)PlayerAvatar.instance.photonView != (Object)null && !((Object)(object)RunManager.instance == (Object)null) && !((Object)(object)RunManager.instance.levelCurrent == (Object)null) && RunManager.instance.levels.Contains(RunManager.instance.levelCurrent) && (Object)(object)PlayerAvatar.instance != (Object)null && (Object)(object)PlayerAvatar.instance.photonView != (Object)null)
			{
				PlayerAvatar.instance.photonView.RPC("setReaperStatusRPC", (RpcTarget)0, new object[2] { steamID, isReaper });
			}
		}

		public void assignRole(int roleId, PlayerController __instance)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Expected O, but got Unknown
			//IL_03e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_03eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0413: Unknown result type (might be due to invalid IL or missing references)
			//IL_0445: Unknown result type (might be due to invalid IL or missing references)
			//IL_044a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0534: Unknown result type (might be due to invalid IL or missing references)
			//IL_0539: U