Decompiled source of SkillsPlusPlus v0.9.2

Skills.dll

Decompiled a day ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using EntityStates;
using EntityStates.Acolyte;
using EntityStates.Acolyte.Weapon;
using EntityStates.Bandit2;
using EntityStates.Bandit2.Weapon;
using EntityStates.Captain.Weapon;
using EntityStates.CaptainSupplyDrop;
using EntityStates.Chef;
using EntityStates.Commando;
using EntityStates.Commando.CommandoWeapon;
using EntityStates.Commando.StickyGrenade;
using EntityStates.Croco;
using EntityStates.Drifter;
using EntityStates.Drifter.Bag;
using EntityStates.Drone.Command;
using EntityStates.DroneTech;
using EntityStates.DroneTech.DroneBall;
using EntityStates.DroneTech.Weapon;
using EntityStates.Enforcer;
using EntityStates.Engi.EngiBubbleShield;
using EntityStates.Engi.EngiMissilePainter;
using EntityStates.Engi.EngiWeapon;
using EntityStates.Engi.Mine;
using EntityStates.Engi.SpiderMine;
using EntityStates.EngiTurret.EngiTurretWeapon;
using EntityStates.FalseSon;
using EntityStates.GlobalSkills.LunarDetonator;
using EntityStates.GlobalSkills.LunarNeedle;
using EntityStates.Huntress;
using EntityStates.Huntress.Cyclone;
using EntityStates.Huntress.HuntressWeapon;
using EntityStates.Huntress.Weapon;
using EntityStates.Loader;
using EntityStates.Mage;
using EntityStates.Mage.Weapon;
using EntityStates.Merc;
using EntityStates.Merc.Weapon;
using EntityStates.Railgunner.Backpack;
using EntityStates.Railgunner.Reload;
using EntityStates.Railgunner.Scope;
using EntityStates.Railgunner.Weapon;
using EntityStates.Seeker;
using EntityStates.Toolbot;
using EntityStates.Treebot;
using EntityStates.Treebot.TreebotFlower;
using EntityStates.Treebot.Weapon;
using EntityStates.VoidSurvivor;
using EntityStates.VoidSurvivor.Weapon;
using HG.Reflection;
using HarmonyLib;
using IL.EntityStates.Chef;
using IL.EntityStates.Drifter;
using IL.RoR2.Projectile;
using Microsoft.CodeAnalysis;
using Mono.Cecil;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using On;
using On.EntityStates;
using On.EntityStates.DroneTech.DroneBall;
using On.EntityStates.DroneTech.Weapon;
using On.EntityStates.Enforcer;
using On.EntityStates.Loader;
using On.EntityStates.Railgunner.Reload;
using On.EntityStates.Seeker;
using On.RoR2;
using On.RoR2.Projectile;
using On.RoR2.Skills;
using On.RoR2.UI;
using R2API;
using R2API.Networking;
using R2API.Networking.Interfaces;
using R2API.Utils;
using Rebindables;
using Rewired;
using RiskOfOptions;
using RiskOfOptions.OptionConfigs;
using RiskOfOptions.Options;
using RoR2;
using RoR2.AsyncManagement;
using RoR2.CharacterAI;
using RoR2.ConVar;
using RoR2.Orbs;
using RoR2.Projectile;
using RoR2.Skills;
using RoR2.UI;
using SkillsPlusPlus.ConVars;
using SkillsPlusPlus.Director;
using SkillsPlusPlus.Generic;
using SkillsPlusPlus.Modifiers;
using SkillsPlusPlus.Networking;
using SkillsPlusPlus.UI;
using SkillsPlusPlus.Util;
using TMPro;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Events;
using UnityEngine.Networking;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: OptIn]
[assembly: IgnoresAccessChecksTo("RoR2")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("CWMlolzlz, Volvary, icebro, damioGit")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+29671e8a0e5ef2052bfbaa207ecd873ad08ba8ca")]
[assembly: AssemblyProduct("Skills")]
[assembly: AssemblyTitle("Skills")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[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]
	[Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

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

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace SkillsPlusPlus
{
	internal static class Progression
	{
		internal static ConfigEntry<KeyboardShortcut> RespecKey;

		internal static ConfigEntry<bool> RespecOnlyInBazaar;

		internal static ConfigEntry<int> RespecLunarCoinCost;

		internal static ConfigEntry<int> PointsPerTeleporter;

		internal static ConfigEntry<int> StagesPerBonusPoint;

		internal static ConfigEntry<int> MaxSkillLevel;

		internal static void Init(ConfigFile config)
		{
			//IL_0015: 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_00c0: Expected O, but got Unknown
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Expected O, but got Unknown
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Expected O, but got Unknown
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: Expected O, but got Unknown
			//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Expected O, but got Unknown
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: Expected O, but got Unknown
			//IL_011a: Unknown result type (might be due to invalid IL or missing references)
			//IL_011f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_0132: Expected O, but got Unknown
			//IL_012d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: Expected O, but got Unknown
			//IL_013c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0141: Unknown result type (might be due to invalid IL or missing references)
			//IL_0148: Unknown result type (might be due to invalid IL or missing references)
			//IL_0155: Expected O, but got Unknown
			//IL_0150: Unknown result type (might be due to invalid IL or missing references)
			//IL_015a: Expected O, but got Unknown
			RespecKey = config.Bind<KeyboardShortcut>("Respec", "Respec key", new KeyboardShortcut((KeyCode)289, Array.Empty<KeyCode>()), "Press to refund all your spent skill points (see the other respec settings for where and for how much).");
			RespecOnlyInBazaar = config.Bind<bool>("Respec", "Only in the Bazaar", true, "Respec is only allowed in the Bazaar Between Time. The host's setting is used.");
			RespecLunarCoinCost = config.Bind<int>("Respec", "Lunar coin cost", 1, "Lunar coins a respec costs. 0 = free. The host's setting is used.");
			PointsPerTeleporter = config.Bind<int>("Bonus points", "Points per charged teleporter", 0, "Extra skill points every player gets when the teleporter finishes charging. The host's setting is used.");
			StagesPerBonusPoint = config.Bind<int>("Bonus points", "Stages per bonus point", 0, "Every player gets an extra skill point every this many cleared stages. 0 = off. The host's setting is used.");
			MaxSkillLevel = config.Bind<int>("Skills++", "Max level per skill", 10, "Highest level a single skill can reach. 0 = no limit. The host's setting is used.");
			ModSettingsManager.AddOption((BaseOption)new KeyBindOption(RespecKey));
			ModSettingsManager.AddOption((BaseOption)new IntSliderOption(MaxSkillLevel, new IntSliderConfig
			{
				min = 0,
				max = 30
			}));
			ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(RespecOnlyInBazaar));
			ModSettingsManager.AddOption((BaseOption)new IntSliderOption(RespecLunarCoinCost, new IntSliderConfig
			{
				min = 0,
				max = 10
			}));
			ModSettingsManager.AddOption((BaseOption)new IntSliderOption(PointsPerTeleporter, new IntSliderConfig
			{
				min = 0,
				max = 5
			}));
			ModSettingsManager.AddOption((BaseOption)new IntSliderOption(StagesPerBonusPoint, new IntSliderConfig
			{
				min = 0,
				max = 10
			}));
			TeleporterInteraction.onTeleporterChargedGlobal += OnTeleporterCharged;
			Stage.onServerStageComplete += OnServerStageComplete;
		}

		internal static void PollRespecKey()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			KeyboardShortcut value = RespecKey.Value;
			if (((KeyboardShortcut)(ref value)).IsDown())
			{
				RequestLocalRespec();
			}
		}

		[ConCommand(/*Could not decode attribute arguments.*/)]
		private static void CCRespec(ConCommandArgs args)
		{
			RequestLocalRespec();
		}

		private static void RequestLocalRespec()
		{
			SkillPointsController skillPointsController = default(SkillPointsController);
			foreach (NetworkUser readOnlyLocalPlayers in NetworkUser.readOnlyLocalPlayersList)
			{
				CharacterMaster val = (Object.op_Implicit((Object)(object)readOnlyLocalPlayers) ? readOnlyLocalPlayers.master : null);
				if (Object.op_Implicit((Object)(object)val) && ((Component)val).TryGetComponent<SkillPointsController>(ref skillPointsController))
				{
					skillPointsController.RequestRespec();
				}
			}
		}

		internal static void AnnounceRespec(SkillPointsController controller, bool success, string reason)
		{
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Expected O, but got Unknown
			if (NetworkServer.active && Object.op_Implicit((Object)(object)controller))
			{
				PlayerCharacterMasterController component = ((Component)controller).GetComponent<PlayerCharacterMasterController>();
				string text = ((Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)component.networkUser)) ? component.networkUser.userName : "Player");
				string baseToken = (success ? ("<color=#e5c962>" + text + " reset their Skills++ upgrades.</color>") : ("<color=#c4c4c4>" + text + " can't respec: " + reason + ".</color>"));
				Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage
				{
					baseToken = baseToken
				});
			}
		}

		private static void OnTeleporterCharged(TeleporterInteraction teleporter)
		{
			if (NetworkServer.active && PointsPerTeleporter.Value > 0)
			{
				GiveEveryone(PointsPerTeleporter.Value);
			}
		}

		private static void OnServerStageComplete(Stage stage)
		{
			int value = StagesPerBonusPoint.Value;
			if (NetworkServer.active && value > 0 && Object.op_Implicit((Object)(object)Run.instance) && (Run.instance.stageClearCount + 1) % value == 0)
			{
				GiveEveryone(1);
			}
		}

		private static void GiveEveryone(int amount)
		{
			SkillPointsController skillPointsController = default(SkillPointsController);
			foreach (PlayerCharacterMasterController instance in PlayerCharacterMasterController.instances)
			{
				if (Object.op_Implicit((Object)(object)instance) && Object.op_Implicit((Object)(object)instance.master) && ((Component)instance.master).TryGetComponent<SkillPointsController>(ref skillPointsController))
				{
					skillPointsController.ServerGiveBonusPoint(amount);
				}
			}
		}
	}
	internal sealed class SkillLevelIconController : MonoBehaviour
	{
		private static string BUY_TOKEN = "SKILLS_SLOT_BUY_BTN";

		private SkillIcon skillIcon;

		private GameObject CanBuyPanel;

		private GameObject LevelBackgroundPanel;

		private GameObject LevelText;

		private GameObject UpgradeButton;

		private HGTextMeshProUGUI levelTextMesh;

		private HGButton buyButton;

		private CanvasRenderer CanBuyBorderRenderer;

		public SkillUpgrade skillUpgrade;

		private void Awake()
		{
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Expected O, but got Unknown
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: Expected O, but got Unknown
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_014d: 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_018e: Expected O, but got Unknown
			//IL_019a: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a4: Expected O, but got Unknown
			//IL_020d: Unknown result type (might be due to invalid IL or missing references)
			//IL_023a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0245: 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_0255: Unknown result type (might be due to invalid IL or missing references)
			//IL_0260: Unknown result type (might be due to invalid IL or missing references)
			//IL_026b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0276: Unknown result type (might be due to invalid IL or missing references)
			//IL_0281: Unknown result type (might be due to invalid IL or missing references)
			//IL_0296: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a0: Expected O, but got Unknown
			//IL_0305: Unknown result type (might be due to invalid IL or missing references)
			//IL_0343: Unknown result type (might be due to invalid IL or missing references)
			//IL_034d: Expected O, but got Unknown
			//IL_0354: Unknown result type (might be due to invalid IL or missing references)
			//IL_035f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0364: Unknown result type (might be due to invalid IL or missing references)
			//IL_036f: Unknown result type (might be due to invalid IL or missing references)
			//IL_037a: Unknown result type (might be due to invalid IL or missing references)
			//IL_038f: Unknown result type (might be due to invalid IL or missing references)
			//IL_039a: Unknown result type (might be due to invalid IL or missing references)
			//IL_03af: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c4: Unknown result type (might be due to invalid IL or missing references)
			skillIcon = ((Component)this).GetComponent<SkillIcon>();
			CanBuyPanel = Object.Instantiate<GameObject>(skillIcon.isReadyPanelObject, ((Component)skillIcon).transform);
			((Object)CanBuyPanel).name = "CanBuyBorderPanel";
			CanBuyPanel.transform.SetSiblingIndex(1);
			CanBuyBorderRenderer = CanBuyPanel.GetComponent<CanvasRenderer>();
			LevelBackgroundPanel = new GameObject("Skills++ Level Background Panel");
			LevelBackgroundPanel.transform.parent = ((Component)skillIcon).transform;
			LevelBackgroundPanel.transform.localPosition = Vector3.zero;
			LevelBackgroundPanel.transform.localScale = Vector3.one;
			RectTransform obj = LevelBackgroundPanel.AddComponent<RectTransform>();
			obj.offsetMin = Vector2.zero;
			obj.offsetMax = Vector2.zero;
			obj.anchorMin = new Vector2(0.5f, 0.25f);
			obj.anchorMax = new Vector2(0.5f, 0.25f);
			obj.ForceUpdateRectTransforms();
			RawImage obj2 = LevelBackgroundPanel.AddComponent<RawImage>();
			Texture2D val = new Texture2D(1, 1);
			((Texture)val).wrapMode = (TextureWrapMode)0;
			val.SetPixel(0, 0, Color.white);
			val.Apply();
			obj2.texture = (Texture)(object)val;
			((Graphic)obj2).color = new Color(0f, 0f, 0f, 0.7f);
			((Graphic)obj2).SetNativeSize();
			ContentSizeFitter obj3 = LevelBackgroundPanel.AddComponent<ContentSizeFitter>();
			obj3.horizontalFit = (FitMode)2;
			obj3.verticalFit = (FitMode)2;
			HorizontalLayoutGroup obj4 = LevelBackgroundPanel.AddComponent<HorizontalLayoutGroup>();
			((LayoutGroup)obj4).padding = new RectOffset(4, 4, 0, 0);
			((LayoutGroup)obj4).childAlignment = (TextAnchor)4;
			LevelText = new GameObject("LevelIndicator");
			LevelText.transform.parent = LevelBackgroundPanel.transform;
			LevelText.AddComponent<CanvasRenderer>();
			RectTransform obj5 = LevelText.AddComponent<RectTransform>();
			levelTextMesh = LevelText.AddComponent<HGTextMeshProUGUI>();
			((TMP_Text)levelTextMesh).text = "";
			((TMP_Text)levelTextMesh).fontSize = 16f;
			((Graphic)levelTextMesh).color = Color.yellow;
			((TMP_Text)levelTextMesh).alignment = (TextAlignmentOptions)514;
			((TMP_Text)levelTextMesh).enableWordWrapping = false;
			obj5.ForceUpdateRectTransforms();
			((Transform)obj5).localScale = Vector3.one;
			((Transform)obj5).localPosition = Vector2.op_Implicit(Vector2.zero);
			obj5.anchorMin = Vector2.zero;
			obj5.anchorMax = Vector2.one;
			obj5.sizeDelta = Vector2.zero;
			obj5.offsetMin = Vector2.zero;
			obj5.offsetMax = Vector2.zero;
			obj5.ForceUpdateRectTransforms();
			UpgradeButton = new GameObject("BuySkillButton");
			UpgradeButton.transform.parent = ((Component)skillIcon).transform;
			UpgradeButton.AddComponent<CanvasRenderer>();
			RectTransform obj6 = UpgradeButton.AddComponent<RectTransform>();
			UpgradeButton.AddComponent<MPEventSystemLocator>();
			HGTextMeshProUGUI obj7 = UpgradeButton.AddComponent<HGTextMeshProUGUI>();
			((TMP_Text)obj7).text = Language.GetString(BUY_TOKEN);
			((TMP_Text)obj7).fontSize = 18f;
			((Graphic)obj7).color = Color.yellow;
			((TMP_Text)obj7).alignment = (TextAlignmentOptions)514;
			((TMP_Text)obj7).enableWordWrapping = false;
			buyButton = UpgradeButton.AddComponent<HGButton>();
			((UnityEvent)((Button)buyButton).onClick).AddListener(new UnityAction(OnBuySkill));
			obj6.ForceUpdateRectTransforms();
			((Transform)obj6).localScale = Vector3.one;
			((Transform)obj6).localPosition = Vector2.op_Implicit(Vector2.zero);
			obj6.anchorMin = Vector2.zero;
			obj6.anchorMax = Vector2.one;
			obj6.anchoredPosition = new Vector2(0f, 0f);
			obj6.sizeDelta = Vector2.zero;
			obj6.offsetMin = new Vector2(0f, 0f);
			obj6.offsetMax = new Vector2(0f, 0f);
			obj6.ForceUpdateRectTransforms();
		}

		private void Update()
		{
			//IL_0124: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_01af: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c9: Expected I4, but got Unknown
			//IL_01ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_0201: Unknown result type (might be due to invalid IL or missing references)
			//IL_022d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0240: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)skillIcon) && Object.op_Implicit((Object)(object)skillIcon.targetSkill))
			{
				GenericSkill targetSkill = skillIcon.targetSkill;
				object obj;
				if (targetSkill == null)
				{
					obj = null;
				}
				else
				{
					CharacterBody characterBody = targetSkill.characterBody;
					obj = ((characterBody != null) ? ((Component)characterBody).GetComponents<SkillUpgrade>() : null);
				}
				SkillUpgrade[] array = (SkillUpgrade[])obj;
				if (array != null)
				{
					SkillUpgrade[] array2 = array;
					foreach (SkillUpgrade skillUpgrade in array2)
					{
						if (Object.op_Implicit((Object)(object)skillUpgrade.targetGenericSkill))
						{
							SkillIcon obj2 = skillIcon;
							SkillDef obj3 = ((obj2 != null) ? obj2.targetSkill.skillDef : null);
							string obj4 = ((obj3 != null) ? ((Object)obj3).name : null);
							SkillDef skillDef = skillUpgrade.targetGenericSkill.skillDef;
							if (obj4 == ((skillDef != null) ? ((Object)skillDef).name : null))
							{
								this.skillUpgrade = skillUpgrade;
							}
						}
					}
				}
			}
			if (!Object.op_Implicit((Object)(object)this.skillUpgrade))
			{
				return;
			}
			bool flag = this.skillUpgrade.CanUpgradeSkill();
			if ((Object)(object)levelTextMesh != (Object)null)
			{
				((TMP_Text)levelTextMesh).text = ((this.skillUpgrade.skillLevel > 0) ? this.skillUpgrade.skillLevel.ToString() : null);
			}
			((Component)CanBuyBorderRenderer).gameObject.SetActive(flag);
			CanBuyBorderRenderer.SetColor(Color.yellow);
			PlayerCharacterMasterController val = skillIcon?.playerCharacterMasterController;
			if (!Object.op_Implicit((Object)(object)val))
			{
				return;
			}
			LocalUser obj5 = ((val == null) ? null : val.networkUser?.localUser);
			Player val2 = ((obj5 != null) ? obj5.inputPlayer : null);
			InputBankTest inputBank = val.body.inputBank;
			if (val2 != null && (Object)(object)skillIcon != (Object)null)
			{
				SkillSlot targetSkillSlot = skillIcon.targetSkillSlot;
				int num = 0;
				switch (targetSkillSlot - -1)
				{
				case 0:
					num = 0;
					break;
				case 1:
					num = 7;
					break;
				case 2:
					num = 8;
					break;
				case 3:
					num = 9;
					break;
				case 4:
					num = 10;
					break;
				}
				UpgradeButton.SetActive((flag && (KeyboardShortcutExtensions.IsPressedInclusive(SkillsPlusPlus.ConVars.ConVars.buySkillsKeybind) || InputBankExtensions.GetButtonState(inputBank, SkillOptions.hotkey).down)) || val2.GetButton(19));
				if (num != 0 && val2.GetButtonDown(num) && (KeyboardShortcutExtensions.IsPressedInclusive(SkillsPlusPlus.ConVars.ConVars.buySkillsKeybind) || InputBankExtensions.GetButtonState(inputBank, SkillOptions.hotkey).down))
				{
					OnBuySkill();
				}
			}
		}

		private void OnBuySkill()
		{
			if (Object.op_Implicit((Object)(object)skillUpgrade))
			{
				skillUpgrade.OnBuySkill();
			}
		}
	}
	public sealed class SkillModifierManager
	{
		private static readonly Dictionary<string, BaseSkillModifier> skillNameToModifierMap = new Dictionary<string, BaseSkillModifier>(StringComparer.OrdinalIgnoreCase);

		private static readonly Dictionary<Type, BaseSkillModifier> typeToModifierMap = new Dictionary<Type, BaseSkillModifier>();

		public static void LoadSkillModifiers()
		{
			Assembly callingAssembly = Assembly.GetCallingAssembly();
			if (callingAssembly == null)
			{
				return;
			}
			Type[] types = callingAssembly.GetTypes();
			foreach (Type type in types)
			{
				IEnumerable<SkillLevelModifierAttribute> customAttributes = type.GetCustomAttributes<SkillLevelModifierAttribute>();
				if (customAttributes == null || customAttributes.Count() == 0)
				{
					continue;
				}
				try
				{
					ConstructorInfo constructor = type.GetConstructor(new Type[0]);
					if (constructor == null)
					{
						Logger.Debug("Failed to find constructor info for {0}", type.FullName);
						Logger.Debug("Other constructors included");
						ConstructorInfo[] constructors = type.GetConstructors();
						for (int j = 0; j < constructors.Length; j++)
						{
							Logger.Debug(constructors[j]);
						}
						continue;
					}
					foreach (SkillLevelModifierAttribute item in customAttributes)
					{
						object obj = constructor.Invoke(new object[0]);
						if (!(obj is BaseSkillModifier baseSkillModifier))
						{
							continue;
						}
						baseSkillModifier.SetupSkill();
						baseSkillModifier.SetupConfig(((BaseUnityPlugin)SkillsPlugin.Instance).Config);
						baseSkillModifier.skillNames = item.skillNames;
						baseSkillModifier.EntityStateTypes = item.baseStateTypes;
						string[] skillNames = item.skillNames;
						foreach (string text in skillNames)
						{
							if (skillNameToModifierMap.TryGetValue(text, out var value))
							{
								Logger.Warn("Skill modifier conflict!!!");
								Logger.Warn("Cannot add {0} since {1} already exists for skill named {2}", obj.GetType().FullName, value.GetType().FullName, text);
							}
							else
							{
								skillNameToModifierMap[text] = baseSkillModifier;
							}
						}
						Type[] baseStateTypes = item.baseStateTypes;
						foreach (Type type2 in baseStateTypes)
						{
							if (typeToModifierMap.TryGetValue(type2, out var value2))
							{
								Logger.Warn("Skill modifier conflict!!!");
								Logger.Warn("Cannot add {0} since {1} already exists for the entity state {2}", obj.GetType().FullName, value2.GetType().FullName, type2.FullName);
							}
							else
							{
								typeToModifierMap[type2] = baseSkillModifier;
							}
						}
					}
				}
				catch (Exception exception)
				{
					Logger.Error(exception);
				}
			}
		}

		internal static void RegisterModifier(BaseSkillModifier modifier, string[] skillNames, Type[] stateTypes)
		{
			modifier.skillNames = skillNames;
			modifier.EntityStateTypes = stateTypes;
			foreach (string text in skillNames)
			{
				if (skillNameToModifierMap.ContainsKey(text))
				{
					Logger.Warn("Skill modifier conflict for {0}, keeping the existing one", text);
				}
				else
				{
					skillNameToModifierMap[text] = modifier;
				}
			}
			foreach (Type type in stateTypes)
			{
				if (!(type == null) && !typeToModifierMap.ContainsKey(type))
				{
					typeToModifierMap[type] = modifier;
				}
			}
		}

		internal static BaseSkillModifier GetSkillModifier(SkillDef skillDef)
		{
			if ((Object)(object)skillDef == (Object)null)
			{
				return null;
			}
			return GetSkillModifierByName(SkillUpgrade.SkillName(skillDef));
		}

		internal static BaseSkillModifier GetSkillModifierByName(string skillName)
		{
			if (skillName == null)
			{
				return null;
			}
			if (skillNameToModifierMap.TryGetValue(skillName, out var value))
			{
				return value;
			}
			return null;
		}

		internal static bool HasSkillModifier(SkillDef skillDef)
		{
			if ((Object)(object)skillDef == (Object)null)
			{
				return false;
			}
			return HasSkillModifier(SkillUpgrade.SkillName(skillDef));
		}

		internal static bool HasSkillModifier(string baseSkillName)
		{
			if (baseSkillName == null)
			{
				return false;
			}
			return skillNameToModifierMap.ContainsKey(baseSkillName);
		}

		internal static BaseSkillModifier GetSkillModifiersForEntityStateType(Type entityStateType)
		{
			if (entityStateType == null)
			{
				return null;
			}
			if (typeToModifierMap.TryGetValue(entityStateType, out var value))
			{
				return value;
			}
			return null;
		}
	}
	internal class SkillOptions
	{
		public static ModKeybind hotkey { get; set; }

		internal static bool IsBuyKeyHeld(CharacterBody body)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			if (KeyboardShortcutExtensions.IsPressedInclusive(SkillsPlusPlus.ConVars.ConVars.buySkillsKeybind))
			{
				return true;
			}
			InputBankTest val = (Object.op_Implicit((Object)(object)body) ? body.inputBank : null);
			if (Object.op_Implicit((Object)(object)val) && hotkey != null)
			{
				return InputBankExtensions.GetButtonState(val, hotkey).down;
			}
			return false;
		}

		internal static void SetupGameplayOptions()
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Expected O, but got Unknown
			hotkey = RebindAPI.RegisterModKeybind(new ModKeybind("SKILLS_GAMEPAD_BUY_BTN", (KeyCode)0, 16, "Jump", (InputActionType)1, (AxisRange)0));
		}
	}
	[RequireComponent(typeof(PlayerCharacterMasterController))]
	public sealed class SkillPointsController : MonoBehaviour
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static hook_RecalculateStats <0>__OnRecalculateStats;

			public static hook_GetDeployableSameSlotLimit <1>__GetDeployableSameSlotLimit;

			public static hook_CanExecuteSkill <2>__CanExecuteSkill;
		}

		private PlayerCharacterMasterController playerCharacterMasterController;

		private CharacterMaster master;

		private readonly Dictionary<string, int> skillLevels = new Dictionary<string, int>(StringComparer.OrdinalIgnoreCase);

		private readonly Dictionary<string, string> overrideAliases = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);

		private int levelPoints;

		private int bonusPoints;

		public bool isSurvivorEnabled { get; private set; } = true;

		public int earnedSkillPoints { get; private set; }

		public int unspentSkillPoints { get; private set; }

		public int levelsPerSkillPoint { get; private set; } = 5;

		public bool multScalingLinear { get; private set; }

		public int maxSkillLevel { get; private set; } = 10;

		public bool hasUnspentPoints => unspentSkillPoints > 0;

		internal NetworkInstanceId MasterNetId
		{
			get
			{
				//IL_0019: Unknown result type (might be due to invalid IL or missing references)
				//IL_000d: Unknown result type (might be due to invalid IL or missing references)
				if (!Object.op_Implicit((Object)(object)master))
				{
					return NetworkInstanceId.Invalid;
				}
				return ((NetworkBehaviour)master).netId;
			}
		}

		private CharacterBody body
		{
			get
			{
				if (!Object.op_Implicit((Object)(object)master))
				{
					return null;
				}
				return master.GetBody();
			}
		}

		public static SkillPointsController FromBody(CharacterBody body)
		{
			if (!Object.op_Implicit((Object)(object)body) || !Object.op_Implicit((Object)(object)body.master))
			{
				return null;
			}
			return ((Component)body.master).GetComponent<SkillPointsController>();
		}

		public int GetLevel(string skillName)
		{
			if (string.IsNullOrEmpty(skillName))
			{
				return 0;
			}
			if (skillLevels.TryGetValue(skillName, out var value))
			{
				return value;
			}
			if (overrideAliases.TryGetValue(skillName, out var value2) && skillLevels.TryGetValue(value2, out value))
			{
				return value;
			}
			return 0;
		}

		public bool IsAtMaxLevel(string skillName)
		{
			if (maxSkillLevel > 0)
			{
				return GetLevel(skillName) >= maxSkillLevel;
			}
			return false;
		}

		internal void SetOverrideAlias(string activeSkillName, string baseSkillName)
		{
			if (!string.IsNullOrEmpty(activeSkillName) && !string.IsNullOrEmpty(baseSkillName))
			{
				overrideAliases[activeSkillName] = baseSkillName;
			}
		}

		internal void ClearOverrideAlias(string activeSkillName)
		{
			if (!string.IsNullOrEmpty(activeSkillName))
			{
				overrideAliases.Remove(activeSkillName);
			}
		}

		internal List<KeyValuePair<string, int>> GetAllLevels()
		{
			return new List<KeyValuePair<string, int>>(skillLevels);
		}

		private void Awake()
		{
			playerCharacterMasterController = ((Component)this).GetComponent<PlayerCharacterMasterController>();
			master = ((Component)this).GetComponent<CharacterMaster>();
			levelsPerSkillPoint = Math.Max(1, ((IntConVar)SkillsPlusPlus.ConVars.ConVars.levelsPerSkillPoint).value);
			multScalingLinear = SkillsPlusPlus.ConVars.ConVars.multScalingLinear.value;
		}

		private void OnEnable()
		{
			if (Object.op_Implicit((Object)(object)master))
			{
				master.onBodyStart += OnBodyStart;
			}
		}

		private void OnDisable()
		{
			if (Object.op_Implicit((Object)(object)master))
			{
				master.onBodyStart -= OnBodyStart;
			}
		}

		private void OnBodyStart(CharacterBody newBody)
		{
			if (NetworkServer.active)
			{
				isSurvivorEnabled = !SkillsPlusPlus.ConVars.ConVars.disabledSurvivors.value.Contains(newBody.GetDisplayName());
			}
			SkillUpgrade[] components = ((Component)newBody).GetComponents<SkillUpgrade>();
			for (int i = 0; i < components.Length; i++)
			{
				components[i].SetSkillPointsController(this);
			}
			if (NetworkServer.active)
			{
				ServerRecalculatePoints(forceSync: true);
			}
		}

		internal void ServerRecalculatePoints(bool forceSync = false)
		{
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Invalid comparison between Unknown and I4
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			if (NetworkServer.active && Object.op_Implicit((Object)(object)master))
			{
				levelsPerSkillPoint = Math.Max(1, ((IntConVar)SkillsPlusPlus.ConVars.ConVars.levelsPerSkillPoint).value);
				multScalingLinear = SkillsPlusPlus.ConVars.ConVars.multScalingLinear.value;
				int num = maxSkillLevel;
				maxSkillLevel = Math.Max(0, Progression.MaxSkillLevel.Value);
				forceSync |= num != maxSkillLevel;
				int num2 = earnedSkillPoints;
				int num3 = unspentSkillPoints;
				TeamIndex teamIndex = master.teamIndex;
				if ((int)teamIndex != -1 && Object.op_Implicit((Object)(object)TeamManager.instance))
				{
					int characterLevel = (int)TeamManager.instance.teamLevels[teamIndex];
					levelPoints = Math.Max(levelPoints, SkillPointsAtLevel(characterLevel));
				}
				earnedSkillPoints = levelPoints + bonusPoints;
				RecomputeUnspent();
				if (forceSync || num2 != earnedSkillPoints || num3 != unspentSkillPoints)
				{
					ServerSync();
				}
			}
		}

		internal void ServerTryBuy(string skillName)
		{
			if (!NetworkServer.active || !isSurvivorEnabled || string.IsNullOrEmpty(skillName))
			{
				return;
			}
			CharacterBody val = body;
			if (!Object.op_Implicit((Object)(object)val))
			{
				return;
			}
			SkillUpgrade skillUpgrade = null;
			SkillUpgrade[] components = ((Component)val).GetComponents<SkillUpgrade>();
			foreach (SkillUpgrade skillUpgrade2 in components)
			{
				if (string.Equals(skillUpgrade2.targetBaseSkillName, skillName, StringComparison.OrdinalIgnoreCase))
				{
					skillUpgrade = skillUpgrade2;
					break;
				}
			}
			if ((Object)(object)skillUpgrade == (Object)null || !SlotUpgrades.CanUpgrade(skillName))
			{
				return;
			}
			maxSkillLevel = Math.Max(0, Progression.MaxSkillLevel.Value);
			if (!IsAtMaxLevel(skillName))
			{
				RecomputeUnspent();
				if (unspentSkillPoints > 0)
				{
					skillLevels[skillName] = GetLevel(skillName) + 1;
					Logger.Debug("ServerTryBuy({0}) -> level {1}", skillName, skillLevels[skillName]);
					RecomputeUnspent();
					ServerSync();
					RefreshBodyUpgrades();
				}
			}
		}

		internal void ServerGiveBonusPoint(int amount = 1)
		{
			if (NetworkServer.active && amount > 0)
			{
				bonusPoints += amount;
				earnedSkillPoints = levelPoints + bonusPoints;
				RecomputeUnspent();
				ServerSync();
			}
		}

		internal bool ServerTryRespec(out string reason)
		{
			reason = null;
			if (!NetworkServer.active)
			{
				reason = "not host";
				return false;
			}
			if (skillLevels.Count == 0)
			{
				reason = "nothing to refund";
				return false;
			}
			if (Progression.RespecOnlyInBazaar.Value && !IsInBazaar())
			{
				reason = "respec is only available in the Bazaar Between Time";
				return false;
			}
			NetworkUser val = (Object.op_Implicit((Object)(object)playerCharacterMasterController) ? playerCharacterMasterController.networkUser : null);
			uint num = (uint)Math.Max(0, Progression.RespecLunarCoinCost.Value);
			if (num != 0)
			{
				if (!Object.op_Implicit((Object)(object)val) || val.lunarCoins < num)
				{
					reason = $"needs {num} lunar coin(s)";
					return false;
				}
				val.DeductLunarCoins(num);
			}
			skillLevels.Clear();
			RecomputeUnspent();
			ServerSync();
			RefreshBodyUpgrades();
			return true;
		}

		private static bool IsInBazaar()
		{
			SceneDef sceneDefForCurrentScene = SceneCatalog.GetSceneDefForCurrentScene();
			if (Object.op_Implicit((Object)(object)sceneDefForCurrentScene))
			{
				return sceneDefForCurrentScene.cachedName == "bazaar";
			}
			return false;
		}

		private void RecomputeUnspent()
		{
			int num = 0;
			foreach (int value in skillLevels.Values)
			{
				num += value;
			}
			unspentSkillPoints = Math.Max(0, earnedSkillPoints - num);
		}

		private void ServerSync()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			if (NetworkServer.active && !(MasterNetId == NetworkInstanceId.Invalid))
			{
				NetMessageExtensions.Send((INetMessage)(object)new SyncSkillPointsMessage(this), (NetworkDestination)1);
			}
		}

		private int SkillPointsAtLevel(int characterLevel)
		{
			if (levelsPerSkillPoint <= 1)
			{
				return Math.Max(0, characterLevel - 1);
			}
			return characterLevel / levelsPerSkillPoint;
		}

		internal void ClientApplySync(bool enabled, int earned, int unspent, int levelsPer, bool linear, int maxLevel, List<KeyValuePair<string, int>> levels)
		{
			maxSkillLevel = maxLevel;
			isSurvivorEnabled = enabled;
			earnedSkillPoints = earned;
			unspentSkillPoints = unspent;
			levelsPerSkillPoint = levelsPer;
			multScalingLinear = linear;
			skillLevels.Clear();
			foreach (KeyValuePair<string, int> level in levels)
			{
				skillLevels[level.Key] = level.Value;
			}
			RefreshBodyUpgrades();
		}

		public void RequestRespec()
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			if (NetworkServer.active)
			{
				Progression.AnnounceRespec(this, ServerTryRespec(out var reason), reason);
			}
			else if (NetworkClient.active)
			{
				NetMessageExtensions.Send((INetMessage)(object)new RespecMessage(MasterNetId), (NetworkDestination)2);
			}
		}

		public void RequestBuy(string skillName)
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			if (!string.IsNullOrEmpty(skillName))
			{
				if (NetworkServer.active)
				{
					ServerTryBuy(skillName);
				}
				else if (NetworkClient.active)
				{
					NetMessageExtensions.Send((INetMessage)(object)new BuySkillMessage(MasterNetId, skillName), (NetworkDestination)2);
				}
			}
		}

		private void RefreshBodyUpgrades()
		{
			CharacterBody val = body;
			if (Object.op_Implicit((Object)(object)val))
			{
				SkillUpgrade[] components = ((Component)val).GetComponents<SkillUpgrade>();
				for (int i = 0; i < components.Length; i++)
				{
					components[i].RefreshUpgrades();
				}
			}
		}

		internal static void InstallHooks()
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Expected O, but got Unknown
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Expected O, but got Unknown
			object obj = <>O.<0>__OnRecalculateStats;
			if (obj == null)
			{
				hook_RecalculateStats val = OnRecalculateStats;
				<>O.<0>__OnRecalculateStats = val;
				obj = (object)val;
			}
			CharacterBody.RecalculateStats += (hook_RecalculateStats)obj;
			object obj2 = <>O.<1>__GetDeployableSameSlotLimit;
			if (obj2 == null)
			{
				hook_GetDeployableSameSlotLimit val2 = GetDeployableSameSlotLimit;
				<>O.<1>__GetDeployableSameSlotLimit = val2;
				obj2 = (object)val2;
			}
			CharacterMaster.GetDeployableSameSlotLimit += (hook_GetDeployableSameSlotLimit)obj2;
			object obj3 = <>O.<2>__CanExecuteSkill;
			if (obj3 == null)
			{
				hook_CanExecuteSkill val3 = CanExecuteSkill;
				<>O.<2>__CanExecuteSkill = val3;
				obj3 = (object)val3;
			}
			GenericCharacterMain.CanExecuteSkill += (hook_CanExecuteSkill)obj3;
		}

		private static void OnRecalculateStats(orig_RecalculateStats orig, CharacterBody self)
		{
			orig.Invoke(self);
			if (NetworkServer.active && Object.op_Implicit((Object)(object)self) && self.isPlayerControlled)
			{
				FromBody(self)?.ServerRecalculatePoints();
			}
		}

		private static int GetDeployableSameSlotLimit(orig_GetDeployableSameSlotLimit orig, CharacterMaster self, DeployableSlot slot)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			int num = orig.Invoke(self, slot);
			SkillPointsController skillPointsController = default(SkillPointsController);
			if (Object.op_Implicit((Object)(object)self) && ((Component)self).TryGetComponent<SkillPointsController>(ref skillPointsController) && skillPointsController.isSurvivorEnabled)
			{
				num += EngiSkillModifier.GetDeployableSameSlotBonus(skillPointsController, slot);
			}
			return num;
		}

		private static bool CanExecuteSkill(orig_CanExecuteSkill orig, GenericCharacterMain self, GenericSkill skillSlot)
		{
			CharacterBody val = (Object.op_Implicit((Object)(object)((EntityState)self).outer) ? ((EntityState)self).outer.commonComponents.characterBody : null);
			if (Object.op_Implicit((Object)(object)val) && val.hasEffectiveAuthority && SkillsPlusPlus.ConVars.ConVars.disableOnBuy.value)
			{
				SkillPointsController skillPointsController = FromBody(val);
				if (Object.op_Implicit((Object)(object)skillPointsController) && skillPointsController.isSurvivorEnabled && skillPointsController.hasUnspentPoints && SkillOptions.IsBuyKeyHeld(val))
				{
					return false;
				}
			}
			return orig.Invoke(self, skillSlot);
		}
	}
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("com.cwmlolzlz.skills", "Skills", "0.9.2")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
	public sealed class SkillsPlugin : BaseUnityPlugin
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static StatHookEventHandler <0>__RecalculateStats_GetLunarStats;

			public static Action<HUD> <1>__HUD_onHudTargetChangedGlobal;

			public static hook_SetTooltipProvider <2>__TooltipController_SetTooltipProvider;

			public static hook_FromSkillSlot <3>__Row_FromSkillSlot;
		}

		public static SkillsPlugin Instance;

		private void Awake()
		{
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Expected O, but got Unknown
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Expected O, but got Unknown
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Expected O, but got Unknown
			Instance = this;
			LegacyResourcesAPI.Load<GameObject>("prefabs/charactermasters/CommandoMaster").EnsureComponent<SkillPointsController>();
			SkillsNetwork.Register();
			SkillPointsController.InstallHooks();
			SkillUpgrade.InstallHooks();
			SkillModifierManager.LoadSkillModifiers();
			SkillOptions.SetupGameplayOptions();
			object obj = <>O.<0>__RecalculateStats_GetLunarStats;
			if (obj == null)
			{
				StatHookEventHandler val = LunarModifiers.RecalculateStats_GetLunarStats;
				<>O.<0>__RecalculateStats_GetLunarStats = val;
				obj = (object)val;
			}
			RecalculateStatsAPI.GetStatCoefficients += (StatHookEventHandler)obj;
			HUD.onHudTargetChangedGlobal += HUD_onHudTargetChangedGlobal;
			object obj2 = <>O.<2>__TooltipController_SetTooltipProvider;
			if (obj2 == null)
			{
				hook_SetTooltipProvider val2 = TooltipController_SetTooltipProvider;
				<>O.<2>__TooltipController_SetTooltipProvider = val2;
				obj2 = (object)val2;
			}
			TooltipController.SetTooltipProvider += (hook_SetTooltipProvider)obj2;
			object obj3 = <>O.<3>__Row_FromSkillSlot;
			if (obj3 == null)
			{
				hook_FromSkillSlot val3 = Row_FromSkillSlot;
				<>O.<3>__Row_FromSkillSlot = val3;
				obj3 = (object)val3;
			}
			Row.FromSkillSlot += (hook_FromSkillSlot)obj3;
			InitConfig();
			CalmerDirector.Init(((BaseUnityPlugin)this).Config);
			SlotUpgrades.Init(((BaseUnityPlugin)this).Config);
			ProjectileTweaks.InstallHooks();
			Progression.Init(((BaseUnityPlugin)this).Config);
			SeamstressNeedles.Init();
		}

		private static void TooltipController_SetTooltipProvider(orig_SetTooltipProvider orig, TooltipController self, TooltipProvider provider)
		{
			orig.Invoke(self, provider);
			SkillUpgradeTooltipProvider provider2 = default(SkillUpgradeTooltipProvider);
			SkillsPlusPlusTooltipController skillsPlusPlusTooltipController = default(SkillsPlusPlusTooltipController);
			if (Object.op_Implicit((Object)(object)provider) && ((Component)provider).TryGetComponent<SkillUpgradeTooltipProvider>(ref provider2))
			{
				((Component)(object)self).EnsureComponent<SkillsPlusPlusTooltipController>().Show(provider2);
			}
			else if (((Component)self).TryGetComponent<SkillsPlusPlusTooltipController>(ref skillsPlusPlusTooltipController))
			{
				skillsPlusPlusTooltipController.Hide();
			}
		}

		private static Row Row_FromSkillSlot(orig_FromSkillSlot orig, LoadoutPanelController owner, BodyIndex bodyIndex, int skillSlotIndex, GenericSkill skillSlot)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			Row val = orig.Invoke(owner, bodyIndex, skillSlotIndex, skillSlot);
			if (val == null)
			{
				return null;
			}
			List<RowData> rowData = val.rowData;
			for (int i = 0; i < rowData.Count; i++)
			{
				Logger.Debug("Ensuring SkillsPlusPlusTooltipProvider({0})", i);
				RowData val2 = rowData[i];
				SkillDef val3 = ((skillSlot == null) ? null : skillSlot.skillFamily?.variants[i].skillDef);
				if ((Object)(object)val3 != (Object)null)
				{
					SkillUpgradeTooltipProvider skillUpgradeTooltipProvider = ((Component)val2.button).gameObject.EnsureComponent<SkillUpgradeTooltipProvider>();
					skillUpgradeTooltipProvider.skillName = SkillUpgrade.SkillName(val3);
					skillUpgradeTooltipProvider.skillDef = val3;
					SkillLocator val4 = (Object.op_Implicit((Object)(object)skillSlot) ? ((Component)skillSlot).GetComponent<SkillLocator>() : null);
					skillUpgradeTooltipProvider.slot = (SkillSlot)((!Object.op_Implicit((Object)(object)val4)) ? (-1) : ((int)val4.FindSkillSlot(skillSlot)));
				}
			}
			return val;
		}

		private void InitConfig()
		{
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Expected O, but got Unknown
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Expected O, but got Unknown
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Expected O, but got Unknown
			//IL_014e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: Expected O, but got Unknown
			ConfigEntry<float> levelsPerSkillPoint = ((BaseUnityPlugin)this).Config.Bind<float>("Skills++", "Levels per skill point", 5f, "The number of levels to reach to be rewarded with a skillpoint. Changes will not be applied during a run. In multiplayer runs the host's setting is used");
			levelsPerSkillPoint.SettingChanged += delegate
			{
				((IntConVar)SkillsPlusPlus.ConVars.ConVars.levelsPerSkillPoint).value = Mathf.RoundToInt(levelsPerSkillPoint.Value);
			};
			((IntConVar)SkillsPlusPlus.ConVars.ConVars.levelsPerSkillPoint).value = Mathf.RoundToInt(levelsPerSkillPoint.Value);
			ModSettingsManager.AddOption((BaseOption)new SliderOption(levelsPerSkillPoint, new SliderConfig
			{
				max = 50f,
				min = 1f,
				FormatString = "{0:0}"
			}));
			ConfigEntry<bool> disableInput = ((BaseUnityPlugin)this).Config.Bind<bool>("Skills++", "Disable Skills While Buying", true, "Should skills be disabled while the Buy Skills Input is pressed. (Disable this if you find yourself hitting the key by mistake)");
			disableInput.SettingChanged += delegate
			{
				SkillsPlusPlus.ConVars.ConVars.disableOnBuy.value = disableInput.Value;
			};
			SkillsPlusPlus.ConVars.ConVars.disableOnBuy.value = disableInput.Value;
			ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(disableInput));
			ConfigEntry<bool> multScalingLinear = ((BaseUnityPlugin)this).Config.Bind<bool>("Skills++", "Linear Skill Multipliers", false, "Should Multiplicative (+%) skill values use a linear value rather than an exponential one. (Useful for playing with low \"Levels per skill point\" values). In multiplayer runs the host's setting is used");
			multScalingLinear.SettingChanged += delegate
			{
				SkillsPlusPlus.ConVars.ConVars.multScalingLinear.value = multScalingLinear.Value;
			};
			SkillsPlusPlus.ConVars.ConVars.multScalingLinear.value = multScalingLinear.Value;
			ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(multScalingLinear));
		}

		[SystemInitializer(new Type[] { typeof(SurvivorCatalog) })]
		private static void OnCatalogInitializer()
		{
			ModdedSurvivorModifiers.Register();
			foreach (SurvivorDef allSurvivorDef in SurvivorCatalog.allSurvivorDefs)
			{
				Instance.PrepareSurvivor(allSurvivorDef);
			}
		}

		private void PrepareSurvivor(SurvivorDef survivorDef)
		{
			if (!Object.op_Implicit((Object)(object)survivorDef) || !Object.op_Implicit((Object)(object)survivorDef.bodyPrefab))
			{
				return;
			}
			SkillUpgrade[] components = survivorDef.bodyPrefab.GetComponents<SkillUpgrade>();
			for (int i = 0; i < components.Length; i++)
			{
				Object.Destroy((Object)(object)components[i]);
			}
			GenericSkill[] components2 = survivorDef.bodyPrefab.GetComponents<GenericSkill>();
			foreach (GenericSkill val in components2)
			{
				if (!((Object)(object)val == (Object)null))
				{
					survivorDef.bodyPrefab.AddComponent<SkillUpgrade>().targetGenericSkill = val;
				}
			}
		}

		private static void HUD_onHudTargetChangedGlobal(HUD hud)
		{
			SkillIcon[] componentsInChildren = ((Component)hud).GetComponentsInChildren<SkillIcon>(true);
			foreach (SkillIcon thisComponent in componentsInChildren)
			{
				((Component)(object)thisComponent).EnsureComponent<SkillUpgradeTooltipProvider>();
				((Component)(object)thisComponent).EnsureComponent<SkillLevelIconController>();
			}
		}

		private void Update()
		{
			if (Object.op_Implicit((Object)(object)Run.instance))
			{
				Progression.PollRespecKey();
			}
		}
	}
	[RequireComponent(typeof(CharacterBody))]
	public class SkillUpgrade : MonoBehaviour
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static hook_OnEnter <0>__OnBaseStateEnter;

			public static hook_OnExit <1>__OnBaseStateExit;
		}

		public int skillLevel;

		public GenericSkill targetGenericSkill;

		public string targetBaseSkillName;

		private CharacterBody characterBody;

		private string aliasedSkillName;

		public SkillPointsController skillPointsController { get; private set; }

		private bool isSurvivorEnabled
		{
			get
			{
				if (Object.op_Implicit((Object)(object)skillPointsController))
				{
					return skillPointsController.isSurvivorEnabled;
				}
				return false;
			}
		}

		private void Awake()
		{
			characterBody = ((Component)this).GetComponent<CharacterBody>();
			targetBaseSkillName = BaseSkillName(targetGenericSkill);
		}

		private void OnEnable()
		{
			if (Object.op_Implicit((Object)(object)targetGenericSkill))
			{
				targetGenericSkill.onSkillChanged += OnSkillChanged;
			}
			RefreshUpgrades();
		}

		private void OnDisable()
		{
			if (Object.op_Implicit((Object)(object)targetGenericSkill))
			{
				targetGenericSkill.onSkillChanged -= OnSkillChanged;
			}
		}

		public void SetSkillPointsController(SkillPointsController controller)
		{
			skillPointsController = controller;
			RefreshUpgrades();
		}

		private void OnSkillChanged(GenericSkill genericSkill)
		{
			targetBaseSkillName = BaseSkillName(genericSkill);
			RefreshUpgrades();
		}

		public void RefreshUpgrades()
		{
			UpdateOverrideAlias();
			skillLevel = (Object.op_Implicit((Object)(object)skillPointsController) ? skillPointsController.GetLevel(targetBaseSkillName) : 0);
			if (isSurvivorEnabled)
			{
				ApplyLevelLocally();
			}
		}

		private void UpdateOverrideAlias()
		{
			if (Object.op_Implicit((Object)(object)skillPointsController))
			{
				if (aliasedSkillName != null)
				{
					skillPointsController.ClearOverrideAlias(aliasedSkillName);
				}
				aliasedSkillName = null;
				string text = SkillName(GetActiveSkillDef(targetGenericSkill));
				if (!string.IsNullOrEmpty(text) && !string.IsNullOrEmpty(targetBaseSkillName) && !string.Equals(text, targetBaseSkillName, StringComparison.OrdinalIgnoreCase) && SkillModifierManager.HasSkillModifier(text))
				{
					skillPointsController.SetOverrideAlias(text, targetBaseSkillName);
					aliasedSkillName = text;
				}
			}
		}

		internal static string BaseSkillName(GenericSkill genericSkill)
		{
			if (!Object.op_Implicit((Object)(object)genericSkill))
			{
				return null;
			}
			return SkillName(Object.op_Implicit((Object)(object)genericSkill.baseSkill) ? genericSkill.baseSkill : genericSkill.skillDef);
		}

		private void ApplyLevelLocally()
		{
			if (!Object.op_Implicit((Object)(object)characterBody) || !characterBody.hasEffectiveAuthority)
			{
				return;
			}
			SkillDef activeSkillDef = GetActiveSkillDef(targetGenericSkill);
			if ((Object)(object)activeSkillDef == (Object)null)
			{
				return;
			}
			BaseSkillModifier skillModifier = SkillModifierManager.GetSkillModifier(activeSkillDef);
			if (skillModifier != null)
			{
				skillModifier.characterBody = characterBody;
				skillModifier.registeredSkill = this;
				skillModifier.OnSkillLeveledUp(skillLevel, characterBody, activeSkillDef);
				if (Object.op_Implicit((Object)(object)targetGenericSkill))
				{
					targetGenericSkill.RecalculateValues();
				}
			}
		}

		public void OnBuySkill()
		{
			if (Object.op_Implicit((Object)(object)skillPointsController) && CanUpgradeSkill())
			{
				skillPointsController.RequestBuy(targetBaseSkillName);
			}
		}

		public bool CanUpgradeSkill()
		{
			if (!isSurvivorEnabled || (Object)(object)targetGenericSkill == (Object)null)
			{
				return false;
			}
			if (!skillPointsController.hasUnspentPoints)
			{
				return false;
			}
			if (skillPointsController.IsAtMaxLevel(targetBaseSkillName))
			{
				return false;
			}
			return SlotUpgrades.CanUpgrade(targetBaseSkillName);
		}

		public static int GetLevel(CharacterBody body, params string[] skillNames)
		{
			SkillPointsController skillPointsController = SkillPointsController.FromBody(body);
			if (!Object.op_Implicit((Object)(object)skillPointsController))
			{
				return 0;
			}
			int num = 0;
			foreach (string skillName in skillNames)
			{
				num = Math.Max(num, skillPointsController.GetLevel(skillName));
			}
			return num;
		}

		public static int GetHighestLevelAmongPlayers(params string[] skillNames)
		{
			int num = 0;
			SkillPointsController skillPointsController = default(SkillPointsController);
			foreach (PlayerCharacterMasterController instance in PlayerCharacterMasterController.instances)
			{
				if (Object.op_Implicit((Object)(object)instance) && Object.op_Implicit((Object)(object)instance.master) && ((Component)instance.master).TryGetComponent<SkillPointsController>(ref skillPointsController))
				{
					foreach (string skillName in skillNames)
					{
						num = Math.Max(num, skillPointsController.GetLevel(skillName));
					}
				}
			}
			return num;
		}

		public static string SkillName(SkillDef skillDef)
		{
			if (!Object.op_Implicit((Object)(object)skillDef))
			{
				return null;
			}
			string name = ((Object)skillDef).name;
			if (!string.IsNullOrEmpty(name))
			{
				return name;
			}
			return skillDef.skillName;
		}

		private static SkillDef GetActiveSkillDef(GenericSkill genericSkill)
		{
			if ((Object)(object)genericSkill == (Object)null)
			{
				return null;
			}
			if (!Object.op_Implicit((Object)(object)genericSkill.skillDef))
			{
				return genericSkill.baseSkill;
			}
			return genericSkill.skillDef;
		}

		internal static void InstallHooks()
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Expected O, but got Unknown
			object obj = <>O.<0>__OnBaseStateEnter;
			if (obj == null)
			{
				hook_OnEnter val = OnBaseStateEnter;
				<>O.<0>__OnBaseStateEnter = val;
				obj = (object)val;
			}
			BaseState.OnEnter += (hook_OnEnter)obj;
			object obj2 = <>O.<1>__OnBaseStateExit;
			if (obj2 == null)
			{
				hook_OnExit val2 = OnBaseStateExit;
				<>O.<1>__OnBaseStateExit = val2;
				obj2 = (object)val2;
			}
			EntityState.OnExit += (hook_OnExit)obj2;
		}

		private static SkillUpgrade FindUpgradeForState(EntityState state, BaseSkillModifier modifier)
		{
			CharacterBody val = FindOwningCharacterBody(state);
			if (!Object.op_Implicit((Object)(object)val))
			{
				return null;
			}
			SkillUpgrade[] components = ((Component)val).GetComponents<SkillUpgrade>();
			foreach (SkillUpgrade skillUpgrade in components)
			{
				if (skillUpgrade.isSurvivorEnabled)
				{
					string text = SkillName(GetActiveSkillDef(skillUpgrade.targetGenericSkill));
					if (text != null && modifier.skillNames.Contains<string>(text, StringComparer.OrdinalIgnoreCase))
					{
						return skillUpgrade;
					}
				}
			}
			return null;
		}

		private static void OnBaseStateEnter(orig_OnEnter orig, BaseState self)
		{
			BaseSkillModifier baseSkillModifier = null;
			SkillUpgrade skillUpgrade = null;
			if (self != null)
			{
				BaseSkillModifier skillModifiersForEntityStateType = SkillModifierManager.GetSkillModifiersForEntityStateType(((object)self).GetType());
				if (skillModifiersForEntityStateType != null)
				{
					SkillUpgrade skillUpgrade2 = FindUpgradeForState((EntityState)(object)self, skillModifiersForEntityStateType);
					if (Object.op_Implicit((Object)(object)skillUpgrade2))
					{
						skillUpgrade2.ApplyLevelLocally();
						skillModifiersForEntityStateType.characterBody = skillUpgrade2.characterBody;
						skillModifiersForEntityStateType.registeredSkill = skillUpgrade2;
						try
						{
							skillModifiersForEntityStateType.OnSkillEnter(self, skillUpgrade2.skillLevel);
						}
						catch (Exception exception)
						{
							Logger.Error(exception);
						}
						baseSkillModifier = skillModifiersForEntityStateType;
						skillUpgrade = skillUpgrade2;
					}
				}
			}
			orig.Invoke(self);
			if (baseSkillModifier != null && Object.op_Implicit((Object)(object)skillUpgrade))
			{
				try
				{
					baseSkillModifier.characterBody = skillUpgrade.characterBody;
					baseSkillModifier.registeredSkill = skillUpgrade;
					baseSkillModifier.OnSkillEnterLate(self, skillUpgrade.skillLevel);
				}
				catch (Exception exception2)
				{
					Logger.Error(exception2);
				}
			}
		}

		private static void OnBaseStateExit(orig_OnExit orig, EntityState self)
		{
			BaseState val = (BaseState)(object)((self is BaseState) ? self : null);
			if (val != null)
			{
				BaseSkillModifier skillModifiersForEntityStateType = SkillModifierManager.GetSkillModifiersForEntityStateType(((object)val).GetType());
				if (skillModifiersForEntityStateType != null)
				{
					SkillUpgrade skillUpgrade = FindUpgradeForState((EntityState)(object)val, skillModifiersForEntityStateType);
					if (Object.op_Implicit((Object)(object)skillUpgrade))
					{
						skillModifiersForEntityStateType.characterBody = skillUpgrade.characterBody;
						skillModifiersForEntityStateType.registeredSkill = skillUpgrade;
						try
						{
							skillModifiersForEntityStateType.OnSkillExit(val, skillUpgrade.skillLevel);
						}
						catch (Exception exception)
						{
							Logger.Error(exception);
						}
					}
				}
			}
			orig.Invoke(self);
		}

		internal static CharacterBody FindOwningCharacterBody(EntityState state)
		{
			if (state == null || !Object.op_Implicit((Object)(object)state.outer))
			{
				return null;
			}
			EntityStateMachine outer = state.outer;
			CharacterBody val = default(CharacterBody);
			if (((Component)outer).TryGetComponent<CharacterBody>(ref val))
			{
				MinionOwnership val2 = default(MinionOwnership);
				if (Object.op_Implicit((Object)(object)val.master) && ((Component)val.master).TryGetComponent<MinionOwnership>(ref val2) && Object.op_Implicit((Object)(object)val2.ownerMaster))
				{
					return val2.ownerMaster.GetBody();
				}
				return val;
			}
			ProjectileController val3 = default(ProjectileController);
			if (((Component)outer).TryGetComponent<ProjectileController>(ref val3) && Object.op_Implicit((Object)(object)val3.owner))
			{
				return val3.owner.GetComponent<CharacterBody>();
			}
			MinionOwnership val4 = default(MinionOwnership);
			if (((Component)outer).TryGetComponent<MinionOwnership>(ref val4) && Object.op_Implicit((Object)(object)val4.ownerMaster))
			{
				return val4.ownerMaster.GetBody();
			}
			GenericOwnership val5 = default(GenericOwnership);
			if (((Component)outer).TryGetComponent<GenericOwnership>(ref val5) && Object.op_Implicit((Object)(object)val5.ownerObject))
			{
				return val5.ownerObject.GetComponent<CharacterBody>();
			}
			Deployable val6 = default(Deployable);
			if (((Component)outer).TryGetComponent<Deployable>(ref val6) && Object.op_Implicit((Object)(object)val6.ownerMaster))
			{
				return val6.ownerMaster.GetBody();
			}
			return null;
		}
	}
	public static class GameObjectExtension
	{
		public static bool TryGetComponent<T>(this GameObject gameObject, out T component) where T : Component
		{
			component = gameObject.GetComponent<T>();
			return (Object)(object)component != (Object)null;
		}

		public static bool TryGetComponentInChildren<T>(this GameObject gameObject, out T component) where T : Component
		{
			component = gameObject.GetComponentInChildren<T>();
			return (Object)(object)component != (Object)null;
		}

		public static T EnsureComponent<T>(this GameObject thisGameObject) where T : Component
		{
			T result = default(T);
			if (thisGameObject.TryGetComponent<T>(ref result))
			{
				return result;
			}
			return thisGameObject.AddComponent<T>();
		}
	}
	public static class ComponentExtension
	{
		public static bool TryGetComponent<T>(this Component thisComponent, out T component) where T : Component
		{
			component = thisComponent.GetComponent<T>();
			return (Object)(object)component != (Object)null;
		}

		public static bool TryGetComponentInChildren<T>(this Component thisComponent, out T component) where T : Component
		{
			component = thisComponent.GetComponentInChildren<T>();
			return (Object)(object)component != (Object)null;
		}

		public static T EnsureComponent<T>(this Component thisComponent) where T : Component
		{
			T result = default(T);
			if (thisComponent.TryGetComponent<T>(ref result))
			{
				return result;
			}
			return thisComponent.gameObject.AddComponent<T>();
		}
	}
	public class Logger
	{
		public enum LogLevel
		{
			None,
			Error,
			Warning,
			Debug
		}

		private static readonly string LOG_TAG = "Skills++";

		private static readonly ManualLogSource manualLogSource = Logger.CreateLogSource(LOG_TAG);

		public static LogLevel LOG_LEVEL = LogLevel.Warning;

		internal static void Debug(string message, params object[] formatArgs)
		{
			if (LOG_LEVEL >= LogLevel.Debug)
			{
				string text = "null";
				if (message != null)
				{
					text = string.Format(message, formatArgs);
				}
				manualLogSource.LogInfo((object)text);
			}
		}

		internal static void Debug(object message)
		{
			if (LOG_LEVEL >= LogLevel.Debug)
			{
				if (message == null)
				{
					message = "null";
				}
				manualLogSource.LogInfo(message);
			}
		}

		internal static void Warn(string message, params object[] formatArgs)
		{
			if (LOG_LEVEL >= LogLevel.Warning)
			{
				string text = "null";
				if (message != null)
				{
					text = string.Format(message, formatArgs);
				}
				manualLogSource.LogWarning((object)text);
			}
		}

		internal static void Warn(object message)
		{
			if (LOG_LEVEL >= LogLevel.Warning)
			{
				if (message == null)
				{
					message = "null";
				}
				manualLogSource.LogWarning(message);
			}
		}

		internal static void Error(string message, params object[] formatArgs)
		{
			if (LOG_LEVEL >= LogLevel.Error)
			{
				string text = "null";
				if (message != null)
				{
					text = string.Format(message, formatArgs);
				}
				manualLogSource.LogError((object)text);
			}
		}

		internal static void Error(Exception exception)
		{
			if (LOG_LEVEL >= LogLevel.Error)
			{
				manualLogSource.LogError((object)exception);
			}
		}
	}
}
namespace SkillsPlusPlus.Util
{
	internal static class ProjectileTweaks
	{
		private struct Entry
		{
			public string[] skillNames;

			public Action<GameObject, CharacterBody, int> tweak;
		}

		[CompilerGenerated]
		private static class <>O
		{
			public static hook_Start <0>__ProjectileController_Start;
		}

		private static readonly Dictionary<string, Entry> byPrefabName = new Dictionary<string, Entry>(StringComparer.Ordinal);

		private static readonly List<KeyValuePair<Type, Entry>> byComponent = new List<KeyValuePair<Type, Entry>>();

		internal static void RegisterByComponent(Type componentType, Action<GameObject, CharacterBody, int> tweak, params string[] skillNames)
		{
			if (!(componentType == null) && tweak != null)
			{
				byComponent.Add(new KeyValuePair<Type, Entry>(componentType, new Entry
				{
					skillNames = skillNames,
					tweak = tweak
				}));
			}
		}

		internal static void InstallHooks()
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			object obj = <>O.<0>__ProjectileController_Start;
			if (obj == null)
			{
				hook_Start val = ProjectileController_Start;
				<>O.<0>__ProjectileController_Start = val;
				obj = (object)val;
			}
			ProjectileController.Start += (hook_Start)obj;
		}

		internal static void Register(GameObject prefab, Action<GameObject, CharacterBody, int> tweak, params string[] skillNames)
		{
			if (Object.op_Implicit((Object)(object)prefab) && tweak != null)
			{
				byPrefabName[((Object)prefab).name] = new Entry
				{
					skillNames = skillNames,
					tweak = tweak
				};
			}
		}

		private static void ProjectileController_Start(orig_Start orig, ProjectileController self)
		{
			CharacterBody val = default(CharacterBody);
			if (NetworkServer.active && Object.op_Implicit((Object)(object)self) && Object.op_Implicit((Object)(object)self.owner) && byComponent.Count > 0 && self.owner.TryGetComponent<CharacterBody>(ref val))
			{
				foreach (KeyValuePair<Type, Entry> item in byComponent)
				{
					if (!Object.op_Implicit((Object)(object)((Component)self).GetComponent(item.Key)))
					{
						continue;
					}
					int level = SkillUpgrade.GetLevel(val, item.Value.skillNames);
					if (level > 0)
					{
						try
						{
							item.Value.tweak(((Component)self).gameObject, val, level);
						}
						catch (Exception exception)
						{
							Logger.Error(exception);
						}
					}
				}
			}
			if (NetworkServer.active && Object.op_Implicit((Object)(object)self) && Object.op_Implicit((Object)(object)self.owner) && byPrefabName.Count > 0)
			{
				string text = ((Object)((Component)self).gameObject).name;
				int num = text.IndexOf("(Clone)", StringComparison.Ordinal);
				if (num >= 0)
				{
					text = text.Substring(0, num);
				}
				CharacterBody val2 = default(CharacterBody);
				if (byPrefabName.TryGetValue(text, out var value) && self.owner.TryGetComponent<CharacterBody>(ref val2))
				{
					int level2 = SkillUpgrade.GetLevel(val2, value.skillNames);
					if (level2 > 0)
					{
						try
						{
							value.tweak(((Component)self).gameObject, val2, level2);
						}
						catch (Exception exception2)
						{
							Logger.Error(exception2);
						}
					}
				}
			}
			orig.Invoke(self);
		}
	}
	internal static class Originals
	{
		private static readonly Dictionary<string, float> floats = new Dictionary<string, float>();

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

		internal static float Get(string key, float current)
		{
			if (!floats.TryGetValue(key, out var value))
			{
				floats[key] = current;
				return current;
			}
			return value;
		}

		internal static int Get(string key, int current)
		{
			if (!ints.TryGetValue(key, out var value))
			{
				ints[key] = current;
				return current;
			}
			return value;
		}
	}
}
namespace SkillsPlusPlus.UI
{
	[RequireComponent(typeof(TooltipController))]
	internal class SkillsPlusPlusTooltipController : MonoBehaviour
	{
		private TooltipController tooltipController;

		private GameObject upgradeRect;

		private TextMeshProUGUI upgradeLabel;

		public string skillUpgradeToken;

		private void Awake()
		{
			tooltipController = ((Component)this).GetComponent<TooltipController>();
		}

		private void EnsureRect()
		{
			if (!Object.op_Implicit((Object)(object)upgradeRect) && Object.op_Implicit((Object)(object)tooltipController) && Object.op_Implicit((Object)(object)tooltipController.bodyLabel))
			{
				RectTransform tooltipFlipTransform = tooltipController.tooltipFlipTransform;
				GameObject gameObject = ((Component)((TMP_Text)tooltipController.bodyLabel).transform.parent).gameObject;
				upgradeRect = Object.Instantiate<GameObject>(gameObject, (Transform)(object)tooltipFlipTransform);
				upgradeRect.transform.SetSiblingIndex(Math.Max(0, ((Transform)tooltipFlipTransform).childCount - 2));
				upgradeLabel = upgradeRect.GetComponentInChildren<TextMeshProUGUI>();
			}
		}

		internal void Show(SkillUpgradeTooltipProvider provider)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			string skillName = provider.GetSkillName();
			skillUpgradeToken = SkillUpgradeTooltipProvider.SkillNameToToken(skillName);
			EnsureRect();
			if (Object.op_Implicit((Object)(object)upgradeRect))
			{
				string text = Describe(skillName, provider.GetSkillDef(), provider.GetSlot());
				upgradeRect.SetActive(text != null);
				if (text != null && Object.op_Implicit((Object)(object)upgradeLabel))
				{
					int level = provider.GetLevel();
					int maxLevel = provider.GetMaxLevel();
					string text2 = ((maxLevel > 0) ? $"{level}/{maxLevel}" : level.ToString());
					((TMP_Text)upgradeLabel).text = ((level > 0) ? Language.GetStringFormatted("TOOLTIP_UPGRADE_LEVEL_DESCRIPTION", new object[2] { text, text2 }) : Language.GetStringFormatted("TOOLTIP_UPGRADE_DESCRIPTION", new object[1] { text }));
				}
			}
		}

		internal void Hide()
		{
			if (Object.op_Implicit((Object)(object)upgradeRect))
			{
				upgradeRect.SetActive(false);
			}
		}

		private static string Describe(string skillName, SkillDef def, SkillSlot slot)
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Invalid comparison between Unknown and I4
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			if (string.IsNullOrEmpty(skillName))
			{
				return null;
			}
			List<string> list = new List<string>();
			string text = SkillUpgradeTooltipProvider.SkillNameToToken(skillName);
			if (SlotUpgrades.IsGeneric(skillName))
			{
				if ((int)slot == -1)
				{
					return null;
				}
				int num = Mathf.RoundToInt(SlotUpgrades.DefaultDamagePerLevel(slot) * 100f);
				if (num > 0)
				{
					list.Add(Language.GetStringFormatted("TOOLTIP_UPGRADE_GENERIC_DAMAGE", new object[1] { num }));
				}
			}
			else
			{
				if (Language.IsTokenInvalid(text))
				{
					return null;
				}
				list.Add(Language.GetString(text));
			}
			if (SlotUpgrades.GetsGenericCooldown(def))
			{
				list.Add(Language.GetStringFormatted("TOOLTIP_UPGRADE_GENERIC_COOLDOWN", new object[1] { Mathf.RoundToInt(SlotUpgrades.GenericCooldown.Value * 100f) }));
			}
			if (SlotUpgrades.GetsGenericStock(def))
			{
				list.Add(Language.GetStringFormatted("TOOLTIP_UPGRADE_GENERIC_STOCK", new object[1] { SlotUpgrades.GenericLevelsPerStock.Value }));
			}
			if (list.Count <= 0)
			{
				return null;
			}
			return string.Join(", ", list);
		}
	}
	internal class SkillUpgradeTooltipProvider : MonoBehaviour
	{
		public string skillName;

		public SkillDef skillDef;

		public SkillSlot slot = (SkillSlot)(-1);

		public SkillIcon skillIcon;

		private void Awake()
		{
			skillIcon = ((Component)this).GetComponent<SkillIcon>();
		}

		internal static string SkillNameToToken(string skillName)
		{
			if (skillName == null)
			{
				return null;
			}
			return (skillName + "_UPGRADE_DESCRIPTION").ToUpperInvariant();
		}

		internal SkillDef GetSkillDef()
		{
			if (Object.op_Implicit((Object)(object)skillIcon) && Object.op_Implicit((Object)(object)skillIcon.targetSkill))
			{
				return skillIcon.targetSkill.skillDef;
			}
			return skillDef;
		}

		internal string GetSkillName()
		{
			if (Object.op_Implicit((Object)(object)skillIcon) && Object.op_Implicit((Object)(object)skillIcon.targetSkill))
			{
				return SkillUpgrade.SkillName(skillIcon.targetSkill.skillDef);
			}
			return skillName ?? SkillUpgrade.SkillName(skillDef);
		}

		internal SkillSlot GetSlot()
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)skillIcon))
			{
				return skillIcon.targetSkillSlot;
			}
			return slot;
		}

		internal int GetLevel()
		{
			if (!Object.op_Implicit((Object)(object)skillIcon) || !Object.op_Implicit((Object)(object)skillIcon.targetSkill))
			{
				return -1;
			}
			return SkillUpgrade.GetLevel(skillIcon.targetSkill.characterBody, SkillUpgrade.BaseSkillName(skillIcon.targetSkill));
		}

		internal int GetMaxLevel()
		{
			if (!Object.op_Implicit((Object)(object)skillIcon) || !Object.op_Implicit((Object)(object)skillIcon.targetSkill))
			{
				return 0;
			}
			SkillPointsController skillPointsController = SkillPointsController.FromBody(skillIcon.targetSkill.characterBody);
			if (!Object.op_Implicit((Object)(object)skillPointsController))
			{
				return 0;
			}
			return skillPointsController.maxSkillLevel;
		}

		internal string GetToken()
		{
			return SkillNameToToken(GetSkillName());
		}
	}
}
namespace SkillsPlusPlus.Networking
{
	internal static class SkillsNetwork
	{
		internal static void Register()
		{
			NetworkingAPI.RegisterMessageType<SyncSkillPointsMessage>();
			NetworkingAPI.RegisterMessageType<BuySkillMessage>();
			NetworkingAPI.RegisterMessageType<RespecMessage>();
		}
	}
	internal class SyncSkillPointsMessage : INetMessage, ISerializableObject
	{
		private NetworkInstanceId masterId;

		private bool survivorEnabled;

		private int earned;

		private int unspent;

		private int levelsPerSkillPoint;

		private bool multScalingLinear;

		private int maxSkillLevel;

		private List<KeyValuePair<string, int>> levels = new List<KeyValuePair<string, int>>();

		public SyncSkillPointsMessage()
		{
		}

		internal SyncSkillPointsMessage(SkillPointsController controller)
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			masterId = controller.MasterNetId;
			survivorEnabled = controller.isSurvivorEnabled;
			earned = controller.earnedSkillPoints;
			unspent = controller.unspentSkillPoints;
			levelsPerSkillPoint = controller.levelsPerSkillPoint;
			multScalingLinear = controller.multScalingLinear;
			maxSkillLevel = controller.maxSkillLevel;
			levels = controller.GetAllLevels();
		}

		public void Serialize(NetworkWriter writer)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			writer.Write(masterId);
			writer.Write(survivorEnabled);
			writer.WritePackedUInt32((uint)earned);
			writer.WritePackedUInt32((uint)unspent);
			writer.WritePackedUInt32((uint)levelsPerSkillPoint);
			writer.Write(multScalingLinear);
			writer.WritePackedUInt32((uint)maxSkillLevel);
			writer.WritePackedUInt32((uint)levels.Count);
			foreach (KeyValuePair<string, int> level in levels)
			{
				writer.Write(level.Key);
				writer.WritePackedUInt32((uint)level.Value);
			}
		}

		public void Deserialize(NetworkReader reader)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			masterId = reader.ReadNetworkId();
			survivorEnabled = reader.ReadBoolean();
			earned = (int)reader.ReadPackedUInt32();
			unspent = (int)reader.ReadPackedUInt32();
			levelsPerSkillPoint = (int)reader.ReadPackedUInt32();
			multScalingLinear = reader.ReadBoolean();
			maxSkillLevel = (int)reader.ReadPackedUInt32();
			int num = (int)reader.ReadPackedUInt32();
			levels = new List<KeyValuePair<string, int>>(num);
			for (int i = 0; i < num; i++)
			{
				string key = reader.ReadString();
				int value = (int)reader.ReadPackedUInt32();
				levels.Add(new KeyValuePair<string, int>(key, value));
			}
		}

		public void OnReceived()
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			if (!NetworkServer.active)
			{
				GameObject val = Util.FindNetworkObject(masterId);
				SkillPointsController skillPointsController = default(SkillPointsController);
				if (!Object.op_Implicit((Object)(object)val) || !val.TryGetComponent<SkillPointsController>(ref skillPointsController))
				{
					Logger.Debug("SyncSkillPointsMessage: no controller for master {0}", masterId);
				}
				else
				{
					skillPointsController.ClientApplySync(survivorEnabled, earned, unspent, levelsPerSkillPoint, multScalingLinear, maxSkillLevel, levels);
				}
			}
		}
	}
	internal class BuySkillMessage : INetMessage, ISerializableObject
	{
		private NetworkInstanceId masterId;

		private string skillName;

		public BuySkillMessage()
		{
		}

		internal BuySkillMessage(NetworkInstanceId masterId, string skillName)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			this.masterId = masterId;
			this.skillName = skillName;
		}

		public void Serialize(NetworkWriter writer)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			writer.Write(masterId);
			writer.Write(skillName ?? string.Empty);
		}

		public void Deserialize(NetworkReader reader)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			masterId = reader.ReadNetworkId();
			skillName = reader.ReadString();
		}

		public void OnReceived()
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			if (NetworkServer.active)
			{
				GameObject val = Util.FindNetworkObject(masterId);
				SkillPointsController skillPointsController = default(SkillPointsController);
				if (Object.op_Implicit((Object)(object)val) && val.TryGetComponent<SkillPointsController>(ref skillPointsController))
				{
					skillPointsController.ServerTryBuy(skillName);
				}
			}
		}
	}
	internal class RespecMessage : INetMessage, ISerializableObject
	{
		private NetworkInstanceId masterId;

		public RespecMessage()
		{
		}

		internal RespecMessage(NetworkInstanceId masterId)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			this.masterId = masterId;
		}

		public void Serialize(NetworkWriter writer)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			writer.Write(masterId);
		}

		public void Deserialize(NetworkReader reader)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			masterId = reader.ReadNetworkId();
		}

		public void OnReceived()
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			if (NetworkServer.active)
			{
				GameObject val = Util.FindNetworkObject(masterId);
				SkillPointsController skillPointsController = default(SkillPointsController);
				if (Object.op_Implicit((Object)(object)val) && val.TryGetComponent<SkillPointsController>(ref skillPointsController))
				{
					Progression.AnnounceRespec(skillPointsController, skillPointsController.ServerTryRespec(out var reason), reason);
				}
			}
		}
	}
}
namespace SkillsPlusPlus.Source.Modifiers
{
	[SkillLevelModifier(new string[] { "ChefDice", "ChefDiceBoosted" }, new Type[] { typeof(Dice) })]
	internal class ChefDiceSkillModifier : BaseSkillModifier
	{
		private int locallevel;

		public override void OnSkillLeveledUp(int level, CharacterBody characterBody, SkillDef skillDef)
		{
			base.OnSkillLeveledUp(level, characterBody, skillDef);
		}

		public override void SetupSkill()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Expected O, but got Unknown
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Expected O, but got Unknown
			base.SetupSkill();
			CleaverProjectile.ChargeCleaver += new hook_ChargeCleaver(CleaverProjectileOnChargeCleaver);
			Dice.TrySpawnCleavers += new Manipulator(DiceOnTrySpawnCleavers);
		}

		private void DiceOnTrySpawnCleavers(ILContext il)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			int num = default(int);
			if (val.TryGotoNext(new Func<Instruction, bool>[2]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdfld<SkillLocator>(x, "primary"),
				(Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, ref num)
			}))
			{
				val.Index -= 10;
				val.Emit(OpCodes.Ldloc_2);
				val.Emit(OpCodes.Pop);
				val.Emit(OpCodes.Ldarg_0);
				val.EmitDelegate<Func<Dice, int[]>>((Func<Dice, int[]>)delegate(Dice cleaverProjectile)
				{
					num = 0;
					int[] array = new int[3] { 8, 4, 4 };
					Logger.Debug("1");
					SkillUpgrade[] components = ((Component)cleaverProjectile.chefController.characterBody).gameObject.GetComponents<SkillUpgrade>();
					Logger.Debug("2");
					if (components != null)
					{
						SkillUpgrade[] array2 = components;
						foreach (SkillUpgrade skillUpgrade in array2)
						{
							if (skillUpgrade.targetBaseSkillName != null && skillUpgrade.targetBaseSkillName == "ChefDiceBoosted")
							{
								num = skillUpgrade.skillLevel;
							}
						}
						Logger.Debug("2");
						array[0] = 8 + num * 2;
						array[1] = 4 + num;
						array[2] = 4 + num;
					}
					else
					{
						Logger.Debug("ooough ,.,.,.,. null skillupgrades .,.,., shouldnt hapen .,.,.");
					}
					return array;
				});
				val.Emit(OpCodes.Stloc_2);
			}
			else
			{
				Logger.Error(((MemberReference)il.Method).Name + " IL Hook failed!");
			}
			Logger.Debug("spawn cleavers = " + (object)il);
		}

		private void CleaverProjectileOnChargeCleaver(orig_ChargeCleaver orig, CleaverProjectile self)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			if (!self.charged)
			{
				Transform transform = ((Component)self.projectileOverlapAttack).transform;
				transform.localScale *= BaseSkillModifier.AdditiveScaling(1f, 0.3f, locallevel);
			}
			orig.Invoke(self);
		}

		public override void OnSkillEnter(BaseState skillState, int level)
		{
			base.OnSkillEnter(skillState, level);
			Dice val = (Dice)(object)((skillState is Dice) ? skillState : null);
			if (val != null)
			{
				Logger.Debug("Dice");
				Logger.Debug($"charge time be4 {val.cleaverController.holdChargeTime}");
				Logger.Debug($"charge damage coeff {val.cleaverController.chargedDamageCoefficient}");
				Logger.Debug($"prjectile damage  {val.damageCoefficient}");
				Logger.Debug($"boost prjectile damage  {val.boostedDamageCoefficient}");
				Logger.Debug($"travel distance {val.cleaverController.maxTravelDistance}");
				level += ((EntityState)val).characterBody.GetBuffCount(YesChefSkillModifier.levelupBuff);
				locallevel = level;
				val.cleaverController.maxTravelDistance = BaseSkillModifier.AdditiveScaling(55f, 10f, level);
				val.damageCoefficient = BaseSkillModifier.AdditiveScaling(2f, 0.5f, level);
				val.boostedDamageCoefficient = BaseSkillModifier.AdditiveScaling(4f, 0.5f, level);
				Logger.Debug($"travel distance after {val.cleaverController.maxTravelDistance}");
				Logger.Debug($"damage after {val.damageCoefficient}");
			}
		}

		public override void OnSkillExit(BaseState skillState, int level)
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			base.OnSkillExit(skillState, level);
			((EntityState)skillState).characterBody.SetBuffCount(YesChefSkillModifier.levelupBuff.buffIndex, 0);
		}
	}
	[SkillLevelModifier(new string[] { "ChefSear", "ChefSearBoosted" }, new Type[] { typeof(Sear) })]
	internal class ChefSearSkillModifier : BaseSkillModifier
	{
		public static BuffDef ChefAttackSpeedBuff;

		public override void OnSkillLeveledUp(int level, CharacterBody characterBody, SkillDef skillDef)
		{
			base.OnSkillLeveledUp(level, characterBody, skillDef);
		}

		public override void OnSkillEnter(BaseState skillState, int level)
		{
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			base.OnSkillEnter(skillState, level);
			Sear val = (Sear)(object)((skillState is Sear) ? skillState : null);
			if (val != null)
			{
				Logger.Debug($"Sear {val.tickDamageCoefficient}");
				Logger.Debug($"Sear {((BaseState)val).damageStat}");
				Logger.Debug($"Sear {val.boostedDamage}");
				Logger.Debug($"Sear {val.tickDamageCoefficient}");
				level += ((EntityState)val).characterBody.GetBuffCount(YesChefSkillModifier.levelupBuff);
				((EntityState)val).characterBody.SetBuffCount(ChefAttackSpeedBuff.buffIndex, level);
				((EntityState)val).characterBody.RecalculateStats();
				val.chefController = ((EntityState)val).GetComponent<ChefController>();
				if (val.chefController.isInYesChef)
				{
					val.boostedProjectilesFired = level * -1;
					Logger.Debug($"hasboost {val.chefController.isInYesChef}");
				}
				else
				{
					Logger.Debug("chefcontroller inull ");
				}
			}
		}

		public override void SetupSkill()
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Expected O, but got Unknown
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Expected O, but got Unknown
			base.SetupSkill();
			RegisterChefAttackSpeedBuff();
			RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(RecalculateStatsAPIOnGetStatCoefficients);
			HealthComponent.TakeDamage += new hook_TakeDamage(HealthComponentOnTakeDamage);
		}

		private void HealthComponentOnTakeDamage(orig_TakeDamage orig, HealthComponent self, DamageInfo damageInfo)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Invalid comparison between Unknown and I4
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Invalid comparison between Unknown and I4
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(self, damageInfo);
			if ((int)damageInfo.damageType.attackIdentityIndex == 1 || (int)damageInfo.damageType.attackIdentityIndex == 2)
			{
				GameObject attacker = damageInfo.attacker;
				CharacterBody val = ((attacker != null) ? attacker.GetComponent<CharacterBody>() : null);
				if ((Object)(object)val != (Object)null && val.GetBuffCount(ChefAttackSpeedBuff) > 0)
				{
					Logger.Debug(damageInfo.damageType);
					val.healthComponent.Heal(val.healthComponent.fullHealth * 0.005f * (float)val.GetBuffCount(ChefAttackSpeedBuff), default(ProcChainMask), true);
				}
			}
		}

		public void RegisterChefAttackSpeedBuff()
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			BuffDef obj = ScriptableObject.CreateInstance<BuffDef>();
			obj.buffColor = new Color(0.9f, 0.5f, 0.5f);
			obj.eliteDef = null;
			obj.canStack = true;
			obj.iconSprite = Addressables.LoadAssetAsync<BuffDef>((object)"RoR2/DLC2/Chef/Buffs/bdBoosted.asset").WaitForCompletion().iconSprite;
			obj.isDebuff = false;
			((Object)obj).name = "ChefAttackSpeedBuff";
			ChefAttackSpeedBuff = obj;
			ContentAddition.AddBuffDef(obj);
		}

		private void RecalculateStatsAPIOnGetStatCoefficients(CharacterBody sender, StatHookEventArgs args)
		{
			int buffCount = sender.GetBuffCount(ChefAttackSpeedBuff);
			if (buffCount > 0)
			{
				args.attackSpeedMultAdd += 0.25f * (float)buffCount;
			}
		}

		public override void OnSkillExit(BaseState skillState, int level)
		{
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			base.OnSkillExit(skillState, level);
			if (skillState is Sear)
			{
				Logger.Debug("Sear");
				((EntityState)skillState).characterBody.SetBuffCount(ChefAttackSpeedBuff.buffIndex, 0);
				((EntityState)skillState).characterBody.RecalculateStats();
				((EntityState)skillState).characterBody.SetBuffCount(YesChefSkillModifier.levelupBuff.buffIndex, 0);
			}
		}
	}
	[SkillLevelModifier(new string[] { "ChefRolyPoly", "ChefRolyPolyBoosted" }, new Type[]
	{
		typeof(RolyPoly),
		typeof(RolyPolyWeaponBlockingState),
		typeof(RolyPolyBoostedProjectileTimer)
	})]
	internal class ChefRolyPolySkillModifier : BaseSkillModifier
	{
		public override void OnSkillLeveledUp(int level, CharacterBody characterBody, SkillDef skillDef)
		{
			base.OnSkillLeveledUp(level, characterBody, skillDef);
		}

		public override void OnSkillEnter(BaseState skillState, int level)
		{
			//IL_0182: Unknown result type (might be due to invalid IL or missing references)
			base.OnSkillEnter(skillState, level);
			RolyPoly val = (RolyPoly)(object)((skillState is RolyPoly) ? skillState : null);
			if (val != null)
			{
				Logger.Debug("RolyPoly");
				Logger.Debug($"duration {val.duration}");
				Logger.Debug($"speedMultiplier {val.speedMultiplier}");
				Logger.Debug($"chargeDuration {val.chargeDuration}");
				Logger.Debug($"gearCharge {val.gearCharge}");
				Logger.Debug($"baseDuration {val.baseDuration}");
				Logger.Debug($"baseDurationLvlUp {val.baseDurationLvlUp}");
				Logger.Debug($"explosionDmgCoefficient {val.explosionDmgCoefficient}");
				Logger.Debug($"gearToChargeProgress {val.gearToChargeProgress}");
				level += ((EntityState)val).characterBody.GetBuffCount(YesChefSkillModifier.levelupBuff);
				val.speedMultiplier = BaseSkillModifier.MultScaling(val.speedMultiplier, 0.2f, level);
				val.baseDuration = BaseSkillModifier.MultScaling(val.baseDuration, 0.2f, level);
				val.chefController = ((EntityState)val).GetComponent<ChefController>();
				if (val.chefController.isInYesChef)
				{
					((EntityState)val).characterBody.SetBuffCount(ChefSearSkillModifier.ChefAttackSpeedBuff.buffIndex, level);
					((EntityState)val).characterBody.RecalculateStats();
				}
				else
				{
					Logger.Debug("chefcontroller inull ");
				}
				Logger.Debug($"speedMultiplier {val.speedMultiplier}");
				Logger.Debug($"baseDuration {val.baseDuration}");
				Logger.Debug($"gearToChargeProgress {val.gearToChargeProgress}");
				Logger.Debug("RolyPoly");
			}
			else if (skillState is RolyPolyWeaponBlockingState)
			{
				Logger.Debug("RolyPolyWeaponBlockingState");
			}
		}

		public override void OnSkillExit(BaseState skillState, int level)
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			base.OnSkillExit(skillState, level);
			if (skillState is RolyPoly)
			{
				((EntityState)skillState).characterBody.SetBuffCount(YesChefSkillModifier.levelupBuff.buffIndex, 0);
			}
		}
	}
	[SkillLevelModifier("ChefGlaze", new Type[] { typeof(Glaze) })]
	internal class ChefGlazeSkillModifier : BaseSkillModifier
	{
		public override void OnSkillLeveledUp(int level, CharacterBody characterBody, SkillDef skillDef)
		{
			base.OnSkillLeveledUp(level, characterBody, skillDef);
		}

		public override void OnSkillEnter(BaseState skillState, int level)
		{
			base.OnSkillEnter(skillState, level);
			Glaze val = (Glaze)(object)((skillState is Glaze) ? skillState : null);
			if (val != null)
			{
				Logger.Debug("Glaze");
				Logger.Debug($"duration {val.duration}");
				Logger.Debug($"grenadeCountmax {Glaze.grenadeCountMax}");
				val.grenadeCount = level * -3;
				Logger.Debug($"damageStat {((BaseState)val).damageStat}");
				Logger.Debug($"fireTimer {val.fireTimer}");
				Logger.Debug($"duration {val.duration}");
			}
		}
	}
	[SkillLevelModifier("YesChef", new Type[] { typeof(YesChef) })]
	internal class YesChefSkillModifier : BaseSkillModifier
	{
		public static BuffDef levelupBuff;

		public override void OnSkillLeveledUp(int level, CharacterBody characterBody, SkillDef skillDef)
		{
			base.OnSkillLeveledUp(level, characterBody, skillDef);
		}

		public override void OnSkillEnter(BaseState skillState, int level)
		{
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			base.OnSkillEnter(skillState, level);
			YesChef val = (YesChef)(object)((skillState is YesChef) ? skillState : null);
			if (val != null)
			{
				Logger.Debug("YesChef");
				((EntityState)val).characterBody.SetBuffCount(levelupBuff.buffIndex, level);
			}
		}

		public override void OnSkillExit(BaseState skillState, int level)
		{
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			base.OnSkillExit(skillState, level);
			YesChef val = (YesChef)(object)((skillState is YesChef) ? skillState : null);
			if (val != null)
			{
				Logger.Debug("YesChef");
				if (((EntityState)val).characterBody.HasBuff(levelupBuff))
				{
					((EntityState)val).characterBody.SetBuffCount(levelupBuff.buffIndex, 0);
				}
			}
		}

		public override void SetupSkill()
		{
			base.SetupSkill();
			RegisterYesChefLevelTemp();
		}

		public void RegisterYesChefLevelTemp()
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			BuffDef obj = ScriptableObject.CreateInstance<BuffDef>();
			obj.buffColor = new Color(0.9f, 0.9f, 0.5f);
			obj.eliteDef = null;
			obj.canStack = true;
			obj.iconSprite = Addressables.LoadAssetAsync<BuffDef>((object)"RoR2/DLC2/Chef/Buffs/bdBoosted.asset").WaitForCompletion().iconSprite;
			obj.isDebuff = false;
			((Object)obj).name = "ChefTemporaryLevelup";
			levelupBuff = obj;
			ContentAddition.AddBuffDef(obj);
		}
	}
	[SkillLevelModifier(new string[] { "ChefOilSpill", "ChefOilSpillBoosted" }, new Type[]
	{
		typeof(OilSpillBase),
		typeof(OilSpillV1),
		typeof(OilSpillV2)
	})]
	internal class ChefOilSpillSkillModifier : BaseSkillModifier
	{
		public override void SetupSkill()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Expected O, but got Unknown
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Expected O, but got Unknown
			base.SetupSkill();
			ChefOilSpillSkillDef.GetCurrentIcon += new hook_GetCurrentIcon(ChefOilSpillSkillDefOnGetCurrentIcon);
			OilController.OnEnable += new hook_OnEnable(OilControllerOnOnEnable);
		}

		private void OilControllerOnOnEnable(orig_OnEnable orig, OilController self)
		{
			orig.Invoke(self);
			((Component)self).gameObject.GetComponent<ProjectileController>().onInitialized += delegate(ProjectileController controller)
			{
				GameObject owner = controller.owner;
				SkillUpgrade[] array = ((owner != null) ? owner.GetComponents<SkillUpgrade>() : null);
				if (array != null)
				{
					Logger.Debug(array);
					SkillUpgrade[] array2 = array;
					foreach (SkillUpgrade skillUpgrade in array2)
					{
						Logger.Debug(skillUpgrade.targetBaseSkillName);
						if (skillUpgrade.targetBaseSkillName.Contains("ChefOilSpill"))
						{
							self.gasolineBlastDamage = BaseSkillModifier.MultScaling(self.gasolineBlastDamage, 0.3f, skillUpgrade.skillLevel);
							self.gasolineRadius = BaseSkillModifier.MultScaling(self.gasolineRadius, 0.15f, skillUpgrade.skillLevel);
						}
					}
				}
			};
		}

		private Sprite ChefOilSpillSkillDefOnGetCurrentIcon(orig_GetCurrentIcon orig, ChefOilSpillSkillDef self, GenericSkill skillSlot)
		{
			Sprite val = orig.Invoke(self, skillSlot);
			if (!((Object)(object)val == (Object)null))
			{
				return val;
			}
			return self.icons[0];
		}

		public override void OnSkillLeveledUp(int level, CharacterBody characterBody, SkillDef skillDef)
		{
			base.OnSkillLeveledUp(level, characterBody, skillDef);
		}

		public override void OnSkillEnter(BaseState skillState, int level)
		{
			base.OnSkillEnter(skillState, level);
			if (skillState is OilSpillV1)
			{
				Logger.Debug("OilSpillV1");
				return;
			}
			if (skillState is OilSpillV2)
			{
				Logger.Debug("OilSpillV2");
				return;
			}
			OilSpillBase val = (OilSpillBase)(object)((skillState is OilSpillBase) ? skillState : null);
			if (val != null)
			{
				Logger.Debug("OilSpillBase");
				level += ((EntityState)val).characterBody.GetBuffCount(YesChefSkillModifier.levelupBuff);
				val.extraBouncesUsed = BaseSkillModifier.AdditiveScaling(val.extraBouncesUsed, -2, level);
				GameObject meatballProjectile = val.meatballProjectile;
				if (!((Object)(object)((meatballProjectile != null) ? meatballProjectile.GetComponent<ProjectileImpactExplosion>() : null) != (Object)null))
				{
					Logger.Debug("oilcontroller null");
				}
			}
		}

		public override void OnSkillExit(BaseState skillState, int level)