Decompiled source of SkillsPlusPlus v0.6.4

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.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using EntityStates;
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.Croco;
using EntityStates.Drifter;
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.GlobalSkills.LunarDetonator;
using EntityStates.GlobalSkills.LunarNeedle;
using EntityStates.Huntress;
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.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 Mono.Cecil;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using On;
using On.EntityStates;
using On.EntityStates.Loader;
using On.EntityStates.Railgunner.Reload;
using On.RoR2;
using On.RoR2.Projectile;
using On.RoR2.Skills;
using On.RoR2.UI;
using R2API;
using R2API.Utils;
using Rebindables;
using Rewired;
using RiskOfOptions;
using RiskOfOptions.OptionConfigs;
using RiskOfOptions.Options;
using RoR2;
using RoR2.CharacterAI;
using RoR2.ConVar;
using RoR2.Projectile;
using RoR2.Skills;
using RoR2.UI;
using SkillsPlusPlus.ConVars;
using SkillsPlusPlus.Modifiers;
using SkillsPlusPlus.UI;
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: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("CWMlolzlz")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+0086913c85ef3058e21dd70cb551d1e420f18911")]
[assembly: AssemblyProduct("Skills")]
[assembly: AssemblyTitle("Skills")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://gitlab.com/cwmlolzlz/ror2skillsplusplus")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
namespace SkillsPlusPlus
{
	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_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: Expected O, but got Unknown
			//IL_0124: Unknown result type (might be due to invalid IL or missing references)
			//IL_0150: Unknown result type (might be due to invalid IL or missing references)
			//IL_018d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0197: Expected O, but got Unknown
			//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01af: Expected O, but got Unknown
			//IL_021a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0249: Unknown result type (might be due to invalid IL or missing references)
			//IL_0255: Unknown result type (might be due to invalid IL or missing references)
			//IL_025a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0266: Unknown result type (might be due to invalid IL or missing references)
			//IL_0272: Unknown result type (might be due to invalid IL or missing references)
			//IL_027e: Unknown result type (might be due to invalid IL or missing references)
			//IL_028a: 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_02ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b7: Expected O, but got Unknown
			//IL_0324: Unknown result type (might be due to invalid IL or missing references)
			//IL_0365: Unknown result type (might be due to invalid IL or missing references)
			//IL_036f: Expected O, but got Unknown
			//IL_0378: Unknown result type (might be due to invalid IL or missing references)
			//IL_0384: Unknown result type (might be due to invalid IL or missing references)
			//IL_0389: Unknown result type (might be due to invalid IL or missing references)
			//IL_0395: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ef: 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 val = LevelBackgroundPanel.AddComponent<RectTransform>();
			val.offsetMin = Vector2.zero;
			val.offsetMax = Vector2.zero;
			val.anchorMin = new Vector2(0.5f, 0.25f);
			val.anchorMax = new Vector2(0.5f, 0.25f);
			val.ForceUpdateRectTransforms();
			RawImage val2 = LevelBackgroundPanel.AddComponent<RawImage>();
			Texture2D val3 = new Texture2D(1, 1);
			((Texture)val3).wrapMode = (TextureWrapMode)0;
			val3.SetPixel(0, 0, Color.white);
			val3.Apply();
			val2.texture = (Texture)(object)val3;
			((Graphic)val2).color = new Color(0f, 0f, 0f, 0.7f);
			((Graphic)val2).SetNativeSize();
			ContentSizeFitter val4 = LevelBackgroundPanel.AddComponent<ContentSizeFitter>();
			val4.horizontalFit = (FitMode)2;
			val4.verticalFit = (FitMode)2;
			HorizontalLayoutGroup val5 = LevelBackgroundPanel.AddComponent<HorizontalLayoutGroup>();
			((LayoutGroup)val5).padding = new RectOffset(4, 4, 0, 0);
			((LayoutGroup)val5).childAlignment = (TextAnchor)4;
			LevelText = new GameObject("LevelIndicator");
			LevelText.transform.parent = LevelBackgroundPanel.transform;
			LevelText.AddComponent<CanvasRenderer>();
			RectTransform val6 = 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;
			val6.ForceUpdateRectTransforms();
			((Transform)val6).localScale = Vector3.one;
			((Transform)val6).localPosition = Vector2.op_Implicit(Vector2.zero);
			val6.anchorMin = Vector2.zero;
			val6.anchorMax = Vector2.one;
			val6.sizeDelta = Vector2.zero;
			val6.offsetMin = Vector2.zero;
			val6.offsetMax = Vector2.zero;
			val6.ForceUpdateRectTransforms();
			UpgradeButton = new GameObject("BuySkillButton");
			UpgradeButton.transform.parent = ((Component)skillIcon).transform;
			UpgradeButton.AddComponent<CanvasRenderer>();
			RectTransform val7 = UpgradeButton.AddComponent<RectTransform>();
			MPEventSystemLocator val8 = UpgradeButton.AddComponent<MPEventSystemLocator>();
			HGTextMeshProUGUI val9 = UpgradeButton.AddComponent<HGTextMeshProUGUI>();
			((TMP_Text)val9).text = Language.GetString(BUY_TOKEN);
			((TMP_Text)val9).fontSize = 18f;
			((Graphic)val9).color = Color.yellow;
			((TMP_Text)val9).alignment = (TextAlignmentOptions)514;
			((TMP_Text)val9).enableWordWrapping = false;
			buyButton = UpgradeButton.AddComponent<HGButton>();
			((UnityEvent)((Button)buyButton).onClick).AddListener(new UnityAction(OnBuySkill));
			val7.ForceUpdateRectTransforms();
			((Transform)val7).localScale = Vector3.one;
			((Transform)val7).localPosition = Vector2.op_Implicit(Vector2.zero);
			val7.anchorMin = Vector2.zero;
			val7.anchorMax = Vector2.one;
			val7.anchoredPosition = new Vector2(0f, 0f);
			val7.sizeDelta = Vector2.zero;
			val7.offsetMin = new Vector2(0f, 0f);
			val7.offsetMax = new Vector2(0f, 0f);
			val7.ForceUpdateRectTransforms();
		}

		private void Update()
		{
			//IL_0124: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cd: Expected I4, but got Unknown
			//IL_01f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0205: Unknown result type (might be due to invalid IL or missing references)
			//IL_0231: Unknown result type (might be due to invalid IL or missing references)
			//IL_0244: Unknown result type (might be due to invalid IL or missing references)
			if (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 val2 = ((val == null) ? null : val.networkUser?.localUser);
			Player val3 = ((val2 != null) ? val2.inputPlayer : null);
			InputBankTest inputBank = val.body.inputBank;
			if (val3 != 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)) || val3.GetButton(19));
				if (num != 0 && val3.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>();

		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();
						foreach (ConstructorInfo message in constructors)
						{
							Logger.Debug(message);
						}
						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 BaseSkillModifier GetSkillModifier(SkillDef skillDef)
		{
			if ((Object)(object)skillDef == (Object)null)
			{
				return null;
			}
			return GetSkillModifierByName((skillDef != null) ? ((Object)skillDef).name : null);
		}

		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((skillDef != null) ? ((Object)skillDef).name : null);
		}

		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 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))]
	[RequireComponent(typeof(NetworkIdentity))]
	public sealed class SkillPointsController : NetworkBehaviour
	{
		private PlayerCharacterMasterController playerCharacterMasterController;

		[SyncVar]
		public bool isSurvivorEnabled;

		[SyncVar]
		private int earnedSkillPoints;

		[SyncVar]
		private int unspentSkillPoints;

		[SyncVar]
		private int levelsPerSkillPoint = ((IntConVar)SkillsPlusPlus.ConVars.ConVars.levelsPerSkillPoint).value;

		[SyncVar]
		public bool multScalingLinear;

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

		private bool bMorphedToHeretic;

		private CharacterBody body
		{
			get
			{
				CharacterMaster master = playerCharacterMasterController.master;
				if (master == null)
				{
					return null;
				}
				return master.GetBody();
			}
		}

		private SkillLocator skillLocator
		{
			get
			{
				CharacterBody obj = body;
				if (obj == null)
				{
					return null;
				}
				return obj.skillLocator;
			}
		}

		private TeamIndex PlayerTeamIndex
		{
			get
			{
				//IL_0027: Unknown result type (might be due to invalid IL or missing references)
				if (playerCharacterMasterController.master.hasBody)
				{
					return playerCharacterMasterController.master.GetBody().teamComponent.teamIndex;
				}
				return (TeamIndex)(-1);
			}
		}

		public bool hasUnspentPoints => unspentSkillPoints > 0;

		private void Awake()
		{
			multScalingLinear = SkillsPlusPlus.ConVars.ConVars.multScalingLinear.value;
			Logger.Debug("levelsPerSkillPoint: {0}", levelsPerSkillPoint);
			playerCharacterMasterController = ((Component)this).GetComponent<PlayerCharacterMasterController>();
		}

		private void OnEnable()
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Expected O, but got Unknown
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Expected O, but got Unknown
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Expected O, but got Unknown
			playerCharacterMasterController.master.onBodyStart += OnBodyStart;
			CharacterMaster.GetDeployableSameSlotLimit += new hook_GetDeployableSameSlotLimit(GetDeployableSameSlotLimit);
			GenericCharacterMain.CanExecuteSkill += new hook_CanExecuteSkill(GenericCharacterMain_CanExecuteSkill);
			if (NetworkServer.active)
			{
				CharacterBody.RecalculateStats += new hook_RecalculateStats(OnRecalculateStats);
			}
		}

		private void OnDisable()
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Expected O, but got Unknown
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Expected O, but got Unknown
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Expected O, but got Unknown
			playerCharacterMasterController.master.onBodyStart -= OnBodyStart;
			CharacterMaster.GetDeployableSameSlotLimit -= new hook_GetDeployableSameSlotLimit(GetDeployableSameSlotLimit);
			GenericCharacterMain.CanExecuteSkill -= new hook_CanExecuteSkill(GenericCharacterMain_CanExecuteSkill);
			CharacterBody.RecalculateStats -= new hook_RecalculateStats(OnRecalculateStats);
		}

		[Server]
		internal void PersistUpgrade(int skillLevel, string targetBaseSkillName)
		{
			if (targetBaseSkillName != null)
			{
				transferrableSkillUpgrades[targetBaseSkillName] = skillLevel;
			}
		}

		private void OnBodyStart(CharacterBody body)
		{
			isSurvivorEnabled = !SkillsPlusPlus.ConVars.ConVars.disabledSurvivors.value.Contains(body.GetDisplayName());
			Logger.Debug("OnBodyStart({0})", body);
			SkillUpgrade[] components = ((Component)body).GetComponents<SkillUpgrade>();
			SkillUpgrade[] array = components;
			foreach (SkillUpgrade skillUpgrade in array)
			{
				skillUpgrade.SetSkillPointsController(this);
			}
			TransferSkillUpgrades(body);
		}

		[Server]
		private void TransferSkillUpgrades(CharacterBody body)
		{
			unspentSkillPoints = SkillPointsAtLevel((int)body.level);
			bool flag = body.baseNameToken == "HERETIC_BODY_NAME" && !bMorphedToHeretic;
			SkillUpgrade[] components = ((Component)body).GetComponents<SkillUpgrade>();
			SkillUpgrade[] array = components;
			foreach (SkillUpgrade skillUpgrade in array)
			{
				if (!isSurvivorEnabled)
				{
					break;
				}
				if (skillUpgrade.targetBaseSkillName != null && transferrableSkillUpgrades.ContainsKey(skillUpgrade.targetBaseSkillName))
				{
					skillUpgrade.skillLevel = ((!flag) ? transferrableSkillUpgrades[skillUpgrade.targetBaseSkillName] : 0);
					unspentSkillPoints -= skillUpgrade.skillLevel;
					transferrableSkillUpgrades.Remove(skillUpgrade.targetBaseSkillName);
				}
			}
			if (flag)
			{
				bMorphedToHeretic = true;
			}
		}

		private bool GenericCharacterMain_CanExecuteSkill(orig_CanExecuteSkill orig, GenericCharacterMain self, GenericSkill skillSlot)
		{
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			if (isSurvivorEnabled && (Object)(object)body != (Object)null && (Object)(object)((EntityState)self).outer.commonComponents.characterBody == (Object)(object)body)
			{
				PlayerCharacterMasterController obj = playerCharacterMasterController;
				InputBankTest val = ((obj != null) ? obj.body.inputBank : null);
				if ((Object)(object)val != (Object)null && (KeyboardShortcutExtensions.IsPressedInclusive(SkillsPlusPlus.ConVars.ConVars.buySkillsKeybind) || InputBankExtensions.GetButtonState(val, SkillOptions.hotkey).down) && SkillsPlusPlus.ConVars.ConVars.disableOnBuy.value && unspentSkillPoints > 0)
				{
					return false;
				}
			}
			return orig.Invoke(self, skillSlot);
		}

		private int GetDeployableSameSlotLimit(orig_GetDeployableSameSlotLimit orig, CharacterMaster self, DeployableSlot slot)
		{
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			int num = 0;
			if (isSurvivorEnabled && (Object)(object)self == (Object)(object)playerCharacterMasterController.master)
			{
				num = EngiSkillModifier.GetDeployableSameSlotBonus(slot);
			}
			return orig.Invoke(self, slot) + num;
		}

		private void OnRecalculateStats(orig_RecalculateStats orig, CharacterBody self)
		{
			orig.Invoke(self);
			if ((Object)(object)self == (Object)(object)body)
			{
				OnLevelChanged();
			}
		}

		private void Update()
		{
		}

		public void DeductSkillPoints(int amount)
		{
			unspentSkillPoints -= amount;
		}

		[Server]
		public void OnLevelChanged()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Invalid comparison between Unknown and I4
			int teamLevel = (int)TeamManager.instance.GetTeamLevel(PlayerTeamIndex);
			if ((int)PlayerTeamIndex != -1)
			{
				levelsPerSkillPoint = ((IntConVar)SkillsPlusPlus.ConVars.ConVars.levelsPerSkillPoint).value;
				int num = Math.Max(0, SkillPointsAtLevel(teamLevel) - earnedSkillPoints);
				earnedSkillPoints += num;
				unspentSkillPoints += num;
			}
		}

		[Command]
		[Server]
		private void CmdGiveSkillPoint()
		{
			Logger.Debug("Giving points");
			earnedSkillPoints++;
			unspentSkillPoints++;
		}

		private int SkillPointsAtLevel(int characterLevel)
		{
			if (levelsPerSkillPoint <= 1)
			{
				return characterLevel - 1;
			}
			return characterLevel / levelsPerSkillPoint;
		}
	}
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("com.cwmlolzlz.skills", "Skills", "0.6.4")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
	public sealed class SkillsPlugin : BaseUnityPlugin
	{
		public static SkillsPlugin Instance;

		private void Awake()
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Expected O, but got Unknown
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Expected O, but got Unknown
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Expected O, but got Unknown
			Instance = this;
			GameObject thisGameObject = LegacyResourcesAPI.Load<GameObject>("prefabs/charactermasters/CommandoMaster");
			thisGameObject.EnsureComponent<SkillPointsController>();
			SkillModifierManager.LoadSkillModifiers();
			SkillOptions.SetupGameplayOptions();
			RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(LunarModifiers.RecalculateStats_GetLunarStats);
			HUD.onHudTargetChangedGlobal += HUD_onHudTargetChangedGlobal;
			TooltipController.SetTooltipProvider += new hook_SetTooltipProvider(TooltipController_SetTooltipProvider);
			Row.FromSkillSlot += new hook_FromSkillSlot(Row_FromSkillSlot);
			InitConfig();
		}

		private static void TooltipController_SetTooltipProvider(orig_SetTooltipProvider orig, TooltipController self, TooltipProvider provider)
		{
			orig.Invoke(self, provider);
			SkillUpgradeTooltipProvider skillUpgradeTooltipProvider = default(SkillUpgradeTooltipProvider);
			if (((Component)provider).TryGetComponent<SkillUpgradeTooltipProvider>(ref skillUpgradeTooltipProvider))
			{
				SkillsPlusPlusTooltipController skillsPlusPlusTooltipController = ((Component)(object)self).EnsureComponent<SkillsPlusPlusTooltipController>();
				skillsPlusPlusTooltipController.skillUpgradeToken = skillUpgradeTooltipProvider.GetToken();
			}
		}

		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)
			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 = ((val3 != null) ? ((Object)val3).name : null);
					Logger.Debug((val3 != null) ? ((Object)val3).name : null);
				}
			}
			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()
		{
			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))
				{
					SkillUpgrade skillUpgrade = survivorDef.bodyPrefab.AddComponent<SkillUpgrade>();
					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>();
			}
		}
	}
	[RequireComponent(typeof(CharacterBody))]
	public class SkillUpgrade : NetworkBehaviour
	{
		[SyncVar(hook = "OnSkillLevelChanged")]
		public int skillLevel;

		public GenericSkill targetGenericSkill;

		public string targetBaseSkillName;

		private CharacterBody characterBody;

		private static List<EntityState> pastStates = new List<EntityState>();

		public SkillPointsController skillPointsController { get; private set; }

		private bool isSurvivorEnabled => skillPointsController?.isSurvivorEnabled ?? false;

		private void Awake()
		{
			characterBody = ((Component)this).GetComponent<CharacterBody>();
			SkillDef skillDef = targetGenericSkill.skillDef;
			targetBaseSkillName = ((skillDef != null) ? ((Object)skillDef).name : null);
			Logger.Debug("Awake() targetBaseSkillName: {0}", targetBaseSkillName);
		}

		private void OnEnable()
		{
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Expected O, but got Unknown
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Expected O, but got Unknown
			Logger.Debug("OnEnable() targetBaseSkillName: {0}", targetBaseSkillName);
			targetGenericSkill.onSkillChanged += OnSkillChanged;
			BaseState.OnEnter += new hook_OnEnter(OnBaseStateEnter);
			EntityState.OnExit += new hook_OnExit(OnBaseStateExit);
			RefreshUpgrades();
		}

		private void OnDisable()
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Expected O, but got Unknown
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Expected O, but got Unknown
			Logger.Debug("OnDisable() targetBaseSkillName: {0}", targetBaseSkillName);
			BaseState.OnEnter -= new hook_OnEnter(OnBaseStateEnter);
			EntityState.OnExit -= new hook_OnExit(OnBaseStateExit);
			if (Object.op_Implicit((Object)(object)targetGenericSkill))
			{
				targetGenericSkill.onSkillChanged -= OnSkillChanged;
			}
			if (Object.op_Implicit((Object)(object)skillPointsController))
			{
				skillPointsController.PersistUpgrade(skillLevel, targetBaseSkillName);
			}
		}

		public void SetSkillPointsController(SkillPointsController skillPointsController)
		{
			if (Object.op_Implicit((Object)(object)this.skillPointsController))
			{
				Logger.Warn("Setting the skill points controller a second time is irregular behaviour. It should be added just once when the character body enables");
			}
			this.skillPointsController = skillPointsController;
			RefreshUpgrades();
		}

		private void OnSkillChanged(GenericSkill genericSkill)
		{
			SkillDef skillDef = genericSkill.skillDef;
			targetBaseSkillName = ((skillDef != null) ? ((Object)skillDef).name : null);
			Logger.Debug("OnSkillChanged({0})", targetBaseSkillName);
			RefreshUpgrades();
		}

		[Client]
		private void OnSkillLevelChanged(int newSkillLevel)
		{
			Logger.Debug("OnSkillLevelChanged({0})", newSkillLevel);
			skillLevel = newSkillLevel;
			RefreshUpgrades();
		}

		private void RefreshUpgrades()
		{
			if (!isSurvivorEnabled)
			{
				Logger.Debug("Couldn't refresh upgrades because the survivor is disabled. targetBaseSkillName: {0}", targetBaseSkillName);
				return;
			}
			SkillDef activeSkillDef = GetActiveSkillDef(targetGenericSkill);
			if ((Object)(object)activeSkillDef == (Object)null)
			{
				Logger.Debug("Couldn't refresh upgrades because there is no active skill. targetBaseSkillName: {0}", targetBaseSkillName);
				return;
			}
			object[] array = new object[1];
			array[0] = ((activeSkillDef != null) ? ((Object)activeSkillDef).name : null);
			Logger.Debug("RefreshUpgrades() activeSkillDef: {0}", array);
			BaseSkillModifier skillModifier = SkillModifierManager.GetSkillModifier(activeSkillDef);
			if (skillModifier != null)
			{
				skillModifier.characterBody = characterBody;
				skillModifier.OnSkillLeveledUp(skillLevel, characterBody, activeSkillDef);
				if (Object.op_Implicit((Object)(object)targetGenericSkill))
				{
					targetGenericSkill.RecalculateValues();
				}
			}
		}

		public void OnBuySkill()
		{
			CmdOnBuySkill(targetBaseSkillName);
		}

		[Command]
		[Server]
		private void CmdOnBuySkill(string targetSkillName)
		{
			if (!isSurvivorEnabled)
			{
				return;
			}
			SkillUpgrade[] components = ((Component)this).GetComponents<SkillUpgrade>();
			SkillUpgrade[] array = components;
			foreach (SkillUpgrade skillUpgrade in array)
			{
				if (skillUpgrade.targetBaseSkillName == targetSkillName && Object.op_Implicit((Object)(object)skillPointsController) && skillUpgrade.CanUpgradeSkill())
				{
					skillPointsController.DeductSkillPoints(1);
					skillUpgrade.skillLevel++;
					Logger.Debug("CmdOnBuySkill({0}): skillLevel: {1}", skillUpgrade.targetBaseSkillName, skillUpgrade.skillLevel);
					skillUpgrade.RefreshUpgrades();
				}
			}
		}

		public bool CanUpgradeSkill()
		{
			if (!isSurvivorEnabled)
			{
				return false;
			}
			if ((Object)(object)targetGenericSkill == (Object)null)
			{
				return false;
			}
			if (Object.op_Implicit((Object)(object)skillPointsController) && !skillPointsController.hasUnspentPoints)
			{
				return false;
			}
			return SkillModifierManager.HasSkillModifier(targetBaseSkillName);
		}

		private CharacterBody FindOwningCharacterBody(EntityState state)
		{
			if (state == null)
			{
				Logger.Debug("State was null, returning.");
				return null;
			}
			bool flag = !pastStates.Contains(state);
			if (flag)
			{
				pastStates.Add(state);
			}
			if (Object.op_Implicit((Object)(object)state.outer))
			{
				CharacterBody val = default(CharacterBody);
				if (((Component)state.outer).TryGetComponent<CharacterBody>(ref val))
				{
					MinionOwnership val2 = default(MinionOwnership);
					if (Object.op_Implicit((Object)(object)val.master) && ((Component)val.master).gameObject.TryGetComponent<MinionOwnership>(ref val2) && Object.op_Implicit((Object)(object)val2.ownerMaster))
					{
						CharacterBody body = val2.ownerMaster.GetBody();
						if (flag)
						{
							Logger.Debug(((object)state).GetType().Name + ": Found MinionOwner in CharacterBody, returning " + (((body != null) ? body.GetDisplayName() : null) ?? "[INVALID/REMOVED]"));
						}
						return val2.ownerMaster.GetBody();
					}
					if (flag)
					{
						Logger.Debug(((object)state).GetType().Name + ": Found CharacterBody, returning " + val.GetDisplayName());
					}
					RefreshUpgrades();
					return val;
				}
				ProjectileController val3 = default(ProjectileController);
				if (((Component)state.outer).TryGetComponent<ProjectileController>(ref val3) && Object.op_Implicit((Object)(object)val3.owner))
				{
					if (flag)
					{
						Logger.Debug(((object)state).GetType().Name + ": Found ProjectileController, returning " + val3.owner.GetComponent<CharacterBody>().GetDisplayName());
					}
					return val3.owner.GetComponent<CharacterBody>();
				}
				MinionOwnership val4 = default(MinionOwnership);
				if (((Component)state.outer).TryGetComponent<MinionOwnership>(ref val4) && Object.op_Implicit((Object)(object)val4.ownerMaster))
				{
					CharacterBody body2 = val4.ownerMaster.GetBody();
					if (flag)
					{
						Logger.Debug(((object)state).GetType().Name + ": Found MinionOwnership, returning " + (((body2 != null) ? body2.GetDisplayName() : null) ?? "[INVALID/REMOVED]"));
					}
					return val4.ownerMaster.GetBody();
				}
				GenericOwnership val5 = default(GenericOwnership);
				if (((Component)state.outer).TryGetComponent<GenericOwnership>(ref val5) && Object.op_Implicit((Object)(object)val5.ownerObject))
				{
					if (flag)
					{
						Logger.Debug(((object)state).GetType().Name + ": Found GenericOwnership, returning " + val5.ownerObject.GetComponent<CharacterBody>().GetDisplayName());
					}
					return val5.ownerObject.GetComponent<CharacterBody>();
				}
				Deployable val6 = default(Deployable);
				if (((Component)state.outer).TryGetComponent<Deployable>(ref val6) && Object.op_Implicit((Object)(object)val6.ownerMaster))
				{
					CharacterBody body3 = val6.ownerMaster.GetBody();
					if (flag)
					{
						Logger.Debug(((object)state).GetType().Name + ": Found Deployable, returning " + (((body3 != null) ? body3.GetDisplayName() : null) ?? "[INVALID/REMOVED]"));
					}
					return val6.ownerMaster.GetBody();
				}
			}
			return null;
		}

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

		private void OnBaseStateEnter(orig_OnEnter orig, BaseState self)
		{
			if (self == null)
			{
				orig.Invoke(self);
				return;
			}
			if (isSurvivorEnabled)
			{
				CharacterBody obj = FindOwningCharacterBody((EntityState)(object)self);
				if ((Object)(object)((obj != null) ? ((Component)obj).gameObject : null) == (Object)(object)((Component)this).gameObject && self != null)
				{
					BaseSkillModifier skillModifiersForEntityStateType = SkillModifierManager.GetSkillModifiersForEntityStateType(((object)self).GetType());
					SkillDef activeSkillDef = GetActiveSkillDef(targetGenericSkill);
					if (skillModifiersForEntityStateType != null && (Object)(object)activeSkillDef != (Object)null)
					{
						if (skillModifiersForEntityStateType.skillNames.Contains((activeSkillDef != null) ? ((Object)activeSkillDef).name : null))
						{
							skillModifiersForEntityStateType.OnSkillEnter(self, skillLevel);
							Logger.Debug("skill level = " + skillLevel);
							orig.Invoke(self);
							return;
						}
					}
				}
			}
			orig.Invoke(self);
		}

		private void OnBaseStateExit(orig_OnExit orig, EntityState self)
		{
			if (isSurvivorEnabled)
			{
				BaseState val = (BaseState)(object)((self is BaseState) ? self : null);
				if (val != null)
				{
					CharacterBody obj = FindOwningCharacterBody(self);
					if ((Object)(object)((obj != null) ? ((Component)obj).gameObject : null) == (Object)(object)((Component)this).gameObject)
					{
						BaseSkillModifier skillModifiersForEntityStateType = SkillModifierManager.GetSkillModifiersForEntityStateType(((object)val).GetType());
						SkillDef activeSkillDef = GetActiveSkillDef(targetGenericSkill);
						if (skillModifiersForEntityStateType != null && (Object)(object)activeSkillDef != (Object)null)
						{
							if (skillModifiersForEntityStateType.skillNames.Contains((activeSkillDef != null) ? ((Object)activeSkillDef).name : null))
							{
								skillModifiersForEntityStateType.OnSkillExit(val, skillLevel);
								orig.Invoke(self);
								return;
							}
						}
					}
				}
			}
			orig.Invoke(self);
		}
	}
	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.UI
{
	[RequireComponent(typeof(TooltipController))]
	internal class SkillsPlusPlusTooltipController : MonoBehaviour
	{
		private TooltipController tooltipController;

		public string skillUpgradeToken;

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

		private void Start()
		{
			RectTransform tooltipFlipTransform = tooltipController.tooltipFlipTransform;
			GameObject gameObject = ((Component)((TMP_Text)tooltipController.bodyLabel).transform.parent).gameObject;
			GameObject val = Object.Instantiate<GameObject>(gameObject, (Transform)(object)tooltipFlipTransform);
			val.transform.SetSiblingIndex(Math.Max(0, ((Transform)tooltipFlipTransform).childCount - 2));
			Logger.Debug("token = " + skillUpgradeToken);
			val.SetActive(skillUpgradeToken != null && !Language.IsTokenInvalid(skillUpgradeToken));
			if (skillUpgradeToken != null && !Language.IsTokenInvalid(skillUpgradeToken))
			{
				string @string = Language.GetString(skillUpgradeToken);
				TextMeshProUGUI componentInChildren = val.GetComponentInChildren<TextMeshProUGUI>();
				((TMP_Text)componentInChildren).text = Language.GetStringFormatted("TOOLTIP_UPGRADE_DESCRIPTION", new object[1] { @string });
			}
		}
	}
	internal class SkillUpgradeTooltipProvider : MonoBehaviour
	{
		public string skillName;

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

		internal string GetToken()
		{
			if (skillName != null)
			{
				return SkillNameToToken(skillName);
			}
			if (Object.op_Implicit((Object)(object)skillIcon))
			{
				GenericSkill targetSkill = skillIcon.targetSkill;
				SkillDef obj = ((targetSkill != null) ? targetSkill.skillDef : null);
				string text = ((obj != null) ? ((Object)obj).name : null);
				if (text != null)
				{
					return SkillNameToToken(text);
				}
			}
			return null;
		}
	}
}
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 num2 = default(int);
			if (val.TryGotoNext(new Func<Instruction, bool>[2]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdfld<SkillLocator>(x, "primary"),
				(Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, ref num2)
			}))
			{
				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)
				{
					int 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;

		private DamageTypeCombo SearDamageTypeCombo = new DamageTypeCombo(DamageTypeCombo.op_Implicit((DamageType)128), (DamageTypeExtended)2097152, (DamageSource)2);

		private DamageTypeCombo BoostedSearDamageTypeCombo = new DamageTypeCombo(DamageTypeCombo.op_Implicit((DamageType)128), (DamageTypeExtended)69206016, (DamageSource)2);

		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_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(self, damageInfo);
			if (DamageTypeCombo.op_Implicit(damageInfo.damageType) == DamageTypeCombo.op_Implicit(SearDamageTypeCombo) || DamageTypeCombo.op_Implicit(damageInfo.damageType) == DamageTypeCombo.op_Implicit(BoostedSearDamageTypeCombo))
			{
				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_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			BuffDef val = ScriptableObject.CreateInstance<BuffDef>();
			val.buffColor = new Color(0.9f, 0.5f, 0.5f);
			val.eliteDef = null;
			val.canStack = true;
			val.iconSprite = Addressables.LoadAssetAsync<BuffDef>((object)"RoR2/DLC2/Chef/Buffs/bdBoosted.asset").WaitForCompletion().iconSprite;
			val.isDebuff = false;
			((Object)val).name = "ChefAttackSpeedBuff";
			ChefAttackSpeedBuff = val;
			ContentAddition.AddBuffDef(val);
		}

		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_001d: Unknown result type (might be due to invalid IL or missing references)
			base.OnSkillExit(skillState, level);
			RolyPoly val = (RolyPoly)(object)((skillState is RolyPoly) ? skillState : null);
			if (val != null)
			{
				((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_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			BuffDef val = ScriptableObject.CreateInstance<BuffDef>();
			val.buffColor = new Color(0.9f, 0.9f, 0.5f);
			val.eliteDef = null;
			val.canStack = true;
			val.iconSprite = Addressables.LoadAssetAsync<BuffDef>((object)"RoR2/DLC2/Chef/Buffs/bdBoosted.asset").WaitForCompletion().iconSprite;
			val.isDebuff = false;
			((Object)val).name = "ChefTemporaryLevelup";
			levelupBuff = val;
			ContentAddition.AddBuffDef(val);
		}
	}
	[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, 1.3f, skillUpgrade.skillLevel);
							self.gasolineRadius = BaseSkillModifier.MultScaling(self.gasolineRadius, 1.3f, 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;
				ProjectileImpactExplosion val2 = ((meatballProjectile != null) ? meatballProjectile.GetComponent<ProjectileImpactExplosion>() : null);
				if (!((Object)(object)val2 != (Object)null))
				{
					Logger.Debug("oilcontroller null");
				}
			}
		}

		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[] { "ChefIceBox", "ChefIceBoxBoosted" }, new Type[] { typeof(IceBox) })]
	internal class ChefIceBoxSkillModifier : 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);
			if (skillState is IceBox)
			{
				Logger.Debug("IceBox");
			}
		}
	}
	[SkillLevelModifier("Salvage", new Type[] { typeof(Salvage) })]
	internal class DrifterSalvageSkillModifier : BaseSkillModifier
	{
		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
			base.SetupSkill();
			Salvage.OnEnter += new Manipulator(SalvageOnOnEnter);
		}

		private void SalvageOnOnEnter(ILContext il)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			ILCursor val = new ILCursor(il);
			if (val.TryGotoNext(new Func<Instruction, bool>[3]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0),
				(Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, 4),
				(Instruction x) => ILPatternMatchingExt.MatchStfld<Salvage>(x, "itemsToDrop")
			}))
			{
				val.RemoveRange(3);
			}
			else
			{
				Logger.Error(((MemberReference)il.Method).Name + " IL Hook failed!");
			}
			Logger.Debug("salvage = " + ((object)il).ToString());
		}

		public override void OnSkillEnter(BaseState skillState, int level)
		{
			base.OnSkillEnter(skillState, level);
			Salvage val = (Salvage)(object)((skillState is Salvage) ? skillState : null);
			if (val != null)
			{
				Logger.Debug("Salvage");
				val.itemsToDrop = BaseSkillModifier.AdditiveScaling(4, 1, level);
				val.delayBetweenDrops = val.delayBetweenDrops * 4f / (float)val.itemsToDrop;
				Logger.Debug("Salvage delay = " + val.delayBetweenDrops);
			}
		}
	}
	[SkillLevelModifier("Tinker", new Type[] { typeof(CastTinker) })]
	internal class DrifterTinkerSkillModifier : BaseSkillModifier
	{
		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();
			TinkerProjectile.ManageMonster += new Manipulator(TinkerProjectileOnManageMonster);
			TinkerProjectile.TransmuteTargetObject += new Manipulator(TinkerProjectileOnTransmuteTargetObject);
		}

		private void TinkerProjectileOnTransmuteTargetObject(ILContext il)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_016d: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			if (val.TryGotoNext(new Func<Instruction, bool>[3]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdloca(x, 7),
				(Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, 1f),
				(Instruction x) => ILPatternMatchingExt.MatchStfld(x, typeof(UniquePickup), "decayValue")
			}))
			{
				val.Index += 1;
				val.Remove();
				val.Emit(OpCodes.Ldarg_0);
				val.EmitDelegate<Func<TinkerProjectile, float>>((Func<TinkerProjectile, float>)delegate(TinkerProjectile tinkerProjectile)
				{
					int num3 = 0;
					float num4 = 1f;
					SkillUpgrade[] components2 = ((Component)tinkerProjectile.ownerBody).gameObject.GetComponents<SkillUpgrade>();
					SkillUpgrade[] array2 = components2;
					foreach (SkillUpgrade skillUpgrade2 in array2)
					{
						Logger.Debug(skillUpgrade2.targetBaseSkillName);
						if (skillUpgrade2.targetBaseSkillName == "Tinker")
						{
							num3 = skillUpgrade2.skillLevel;
						}
					}
					if (num3 >= 2)
					{
						num4 += 0.25f * (float)(num3 - num3 % 2);
					}
					Logger.Debug("decayvalue time = " + num4);
					return num4;
				});
			}
			else
			{
				Logger.Error(((MemberReference)il.Method).Name + " IL Hook failed!");
			}
			if (val.TryGotoNext(new Func<Instruction, bool>[3]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdloca(x, 6),
				(Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, 1f),
				(Instruction x) => ILPatternMatchingExt.MatchStfld(x, typeof(UniquePickup), "decayValue")
			}))
			{
				val.Index += 1;
				val.Remove();
				val.Emit(OpCodes.Ldarg_0);
				val.EmitDelegate<Func<TinkerProjectile, float>>((Func<TinkerProjectile, float>)delegate(TinkerProjectile tinkerProjectile)
				{
					int num = 0;
					float num2 = 1f;
					SkillUpgrade[] components = ((Component)tinkerProjectile.ownerBody).gameObject.GetComponents<SkillUpgrade>();
					SkillUpgrade[] array = components;
					foreach (SkillUpgrade skillUpgrade in array)
					{
						Logger.Debug(skillUpgrade.targetBaseSkillName);
						if (skillUpgrade.targetBaseSkillName == "Tinker")
						{
							num = skillUpgrade.skillLevel;
						}
					}
					if (num >= 2)
					{
						num2 += 0.25f * (float)(num - num % 2);
					}
					Logger.Debug("decayvalue else time = " + num2);
					return num2;
				});
			}
			else
			{
				Logger.Error(((MemberReference)il.Method).Name + " IL Hook failed!");
			}
			Logger.Debug("managemonster = " + ((object)il).ToString());
		}

		private void TinkerProjectileOnManageMonster(ILContext il)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			if (val.TryGotoNext(new Func<Instruction, bool>[4]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, 0),
				(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, 1),
				(Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, 4f),
				(Instruction x) => ILPatternMatchingExt.MatchCallvirt(x, typeof(CharacterBody), "AddTimedBuff")
			}))
			{
				val.Index += 2;
				val.Remove();
				val.Emit(OpCodes.Ldarg_0);
				val.EmitDelegate<Func<TinkerProjectile, float>>((Func<TinkerProjectile, float>)delegate(TinkerProjectile tinkerProjectile)
				{
					int level = 0;
					SkillUpgrade[] components = ((Component)tinkerProjectile.ownerBody).gameObject.GetComponents<SkillUpgrade>();
					SkillUpgrade[] array = components;
					foreach (SkillUpgrade skillUpgrade in array)
					{
						Logger.Debug(skillUpgrade.targetBaseSkillName);
						if (skillUpgrade.targetBaseSkillName == "Tinker")
						{
							level = skillUpgrade.skillLevel;
						}
					}
					Logger.Debug("debuff time = " + BaseSkillModifier.MultScaling(4f, 0.25f, level));
					return BaseSkillModifier.MultScaling(4f, 0.25f, level);
				});
			}
			else
			{
				Logger.Error(((MemberReference)il.Method).Name + " IL Hook failed!");
			}
			Logger.Debug("managemonster = " + ((object)il).ToString());
		}

		public override void OnSkillEnter(BaseState skillState, int level)
		{
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			base.OnSkillEnter(skillState, level);
			CastTinker val = (CastTinker)(object)((skillState is CastTinker) ? skillState : null);
			if (val != null)
			{
				Logger.Debug("CastTinker");
				((GenericProjectileBaseState)val).projectilePrefab.transform.localScale = new Vector3(BaseSkillModifier.MultScaling(1f, 0.25f, level), BaseSkillModifier.MultScaling(1f, 0.25f, level), BaseSkillModifier.MultScaling(1f, 0.25f, level));
				Vector3 localScale = ((GenericProjectileBaseState)val).projectilePrefab.transform.localScale;
				Logger.Debug("scale = " + ((object)(Vector3)(ref localScale)).ToString());
			}
		}
	}
	internal class VoidFiendSkillModifiers
	{
	}
	[SkillLevelModifier(new string[] { "FireHandBeam", "ChargeHandBeam", "FireCorruptBeam", "ChargeCorruptHandBeam" }, new Type[]
	{
		typeof(FireHandBeam),
		typeof(ChargeHandBeam),
		typeof(FireCorruptHandBeam),
		typeof(ChargeCorruptHandBeam)
	})]
	internal class VoidFiendHandBeamSkillModifier : BaseSkillModifier
	{
		private CharacterBody surv;

		private int debuffTimerAdd;

		public BuffDef VoidFiendSpeedBuff;

		private int survlevel;

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

		public override void OnSkillEnter(BaseState skillState, int level)
		{
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			base.OnSkillEnter(skillState, level);
			Logger.Debug("OnSkillEnter: " + ((object)skillState).GetType().Name);
			FireHandBeam val = (FireHandBeam)(object)((skillState is FireHandBeam) ? skillState : null);
			if (val != null)
			{
				Logger.Debug(debuffTimerAdd);
				val.damageCoefficient = BaseSkillModifier.MultScaling(val.damageCoefficient, 0.1f, level);
				debuffTimerAdd = level;
				return;
			}
			FireCorruptHandBeam val2 = (FireCorruptHandBeam)(object)((skillState is FireCorruptHandBeam) ? skillState : null);
			if (val2 != null)
			{
				val2.beamVfxPrefab.transform.localScale = new Vector3(val2.beamVfxPrefab.transform.localScale.x, val2.beamVfxPrefab.transform.localScale.y, BaseSkillModifier.MultScaling(1f, 0.3f, level));
				Logger.Debug("FireCorruptHandBeam" + val2.maxDistance);
				val2.maxDistance = BaseSkillModifier.MultScaling(val2.maxDistance, 0.25f, level);
				val2.minDistance = BaseSkillModifier.MultScaling(val2.minDistance, 0.25f, level);
				Logger.Debug("FireCorruptHandBeam" + val2.maxDistance);
				Logger.Debug("firecorruptmanged " + val2.damageCoefficientPerSecond);
				val2.damageCoefficientPerSecond = BaseSkillModifier.MultScaling(val2.damageCoefficientPerSecond, 0.1f, level);
				Logger.Debug("firecorruptmanged " + val2.damageCoefficientPerSecond);
				if (Object.op_Implicit((Object)(object)surv) && Object.op_Implicit((Object)(object)VoidFiendSpeedBuff) && level > 0)
				{
					surv.AddBuff(VoidFiendSpeedBuff);
					return;
				}
				Logger.Debug(surv);
				Logger.Debug(VoidFiendSpeedBuff);
			}
		}

		public override void OnSkillExit(BaseState skillState, int level)
		{
			base.OnSkillExit(skillState, level);
			FireCorruptHandBeam val = (FireCorruptHandBeam)(object)((skillState is FireCorruptHandBeam) ? skillState : null);
			if (val != null && Object.op_Implicit((Object)(object)surv) && Object.op_Implicit((Object)(object)VoidFiendSpeedBuff))
			{
				surv.RemoveBuff(VoidFiendSpeedBuff);
			}
		}

		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
			RegisterSpeedBuff();
			GlobalEventManager.OnHitEnemy += new hook_OnHitEnemy(GlobalEventManagerOnOnHitEnemy);
			RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(RecalculateStatsAPIOnGetStatCoefficients);
			base.SetupSkill();
		}

		private void RecalculateStatsAPIOnGetStatCoefficients(CharacterBody sender, StatHookEventArgs args)
		{
			if (sender.HasBuff(VoidFiendSpeedBuff))
			{
				args.baseMoveSpeedAdd += BaseSkillModifier.MultScaling(0.2f, 0.1f, survlevel);
			}
		}

		public void RegisterSpeedBuff()
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			BuffDef val = ScriptableObject.CreateInstance<BuffDef>();
			val.buffColor = new Color(0.9f, 0.6f, 0.9f);
			val.canStack = false;
			val.eliteDef = null;
			val.iconSprite = Addressables.LoadAssetAsync<BuffDef>((object)"RoR2/Base/SprintOutOfCombat/bdWhipBoost.asset").WaitForCompletion().iconSprite;
			val.isDebuff = false;
			((Object)val).name = "VoidFiendSpeedBuff";
			VoidFiendSpeedBuff = val;
			ContentAddition.AddBuffDef(val);
		}

		private void GlobalEventManagerOnOnHitEnemy(orig_OnHitEnemy orig, GlobalEventManager self, DamageInfo damageinfo, GameObject victim)
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Invalid comparison between Unknown and I4
			orig.Invoke(self, damageinfo, victim);
			VoidSurvivorController val = default(VoidSurvivorController);
			if (Object.op_Implicit((Object)(object)surv) && damageinfo != null && (int)damageinfo.damageType.damageSource == 1 && !((Object)(object)damageinfo.attacker != (Object)(object)((Component)surv).gameObject) && debuffTimerAdd != 0 && (!((Component)surv).TryGetComponent<VoidSurvivorController>(ref val) || !val.isCorrupted))
			{
				Logger.Debug(debuffTimerAdd + " debuffing longer");
				CharacterBody val2 = default(CharacterBody);
				if (victim.TryGetComponent<CharacterBody>(ref val2))
				{
					val2.AddTimedBuff(Buffs.Slow50, (float)(3 + debuffTimerAdd));
				}
			}
		}
	}
	[SkillLevelModifier("ChargeMegaBlaster", new Type[]
	{
		typeof(ChargeMegaBlaster),
		typeof(FireMegaBlasterBase),
		typeof(FireMegaBlasterBig),
		typeof(FireMegaBlasterSmall)
	})]
	internal class VoidFiendChargeMegaSkillModifier : BaseSkillModifier
	{
		public override void OnSkillEnter(BaseState skillState, int level)
		{
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: Unknown result type (might be due to invalid IL or missing references)
			ChargeMegaBlaster val = (ChargeMegaBlaster)(object)((skillState is ChargeMegaBlaster) ? skillState : null);
			if (val != null)
			{
				Logger.Debug("ChargeMegaBlaster");
				val.baseDuration = BaseSkillModifier.MultScaling(2f, -0.15f, level);
				return;
			}
			FireMegaBlasterBase val2 = (FireMegaBlasterBase)(object)((skillState is FireMegaBlasterBase) ? skillState : null);
			if (val2 != null)
			{
				Logger.Debug("FireMegaBlasterBase");
				val2.projectilePrefab.transform.localScale = new Vector3(BaseSkillModifier.MultScaling(1f, 0.15f, level), BaseSkillModifier.MultScaling(1f, 0.15f, level), BaseSkillModifier.MultScaling(1f, 0.15f, level));
				Logger.Debug(val2.projectilePrefab.tag);
				ProjectileImpactExplosion val3 = default(ProjectileImpactExplosion);
				if (val2.projectilePrefab.TryGetComponent<ProjectileImpactExplosion>(ref val3))
				{
					((ProjectileExplosion)val3).blastRadius = BaseSkillModifier.MultScaling(5f, 0.15f, level);
					((ProjectileExplosion)val3).blastDamageCoefficient = BaseSkillModifier.MultScaling(1f, 0.1f, level);
					val3.impactEffect.transform.localScale = new Vector3(BaseSkillModifier.MultScaling(1f, 0.15f, level), BaseSkillModifier.MultScaling(1f, 0.15f, level), BaseSkillModifier.MultScaling(1f, 0.15f, level));
				}
			}
		}
	}
	[SkillLevelModifier("FireCorruptDisk", new Type[] { typeof(FireCorruptDisks) })]
	internal class VoidFiendFireCorruptDiskSkillModifier : SimpleSkillModifier<FireCorruptDisks>
	{
		private CharacterBody surv;

		public float stockamount;

		public int skilllevel;

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

		public override void OnSkillEnter(FireCorruptDisks skillState, int level)
		{
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			if (skillState != null)
			{
				Logger.Debug("FireCorruptDisks");
				skillState.projectilePrefab.transform.localScale = new Vector3(BaseSkillModifier.MultScaling(1f, 0.1f, level), BaseSkillModifier.MultScaling(1f, 0.1f, level), BaseSkillModifier.MultScaling(1f, 0.1f, level));
				Logger.Debug(skillState.projectilePrefab.tag);
				ProjectileImpactExplosion val = default(ProjectileImpactExplosion);
				if (skillState.projectilePrefab.TryGetComponent<ProjectileImpactExplosion>(ref val))
				{
					((ProjectileExplosion)val).blastDamageCoefficient = BaseSkillModifier.MultScaling(1f, 0.15f, level);
				}
			}
		}

		public override void SetupSkill()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(RecalculateStatsAPIOnGetStatCoefficients);
			base.SetupSkill();
		}

		private void RecalculateStatsAPIOnGetStatCoefficients(CharacterBody sender, StatHookEventArgs args)
		{
			if (!((Object)(object)sender != (Object)(object)surv))
			{
				Logger.Debug(((Component)sender).gameObject);
				Logger.Debug(surv);
				VoidSurvivorController val = default(VoidSurvivorController);
				if (((Component)surv).TryGetComponent<VoidSurvivorController>(ref val) && val.isCorrupted)
				{
					args.secondaryCooldownMultAdd -= 1f - BaseSkillModifier.MultScaling(1f, -0.1f, skilllevel);
				}
				Logger.Debug(1f - BaseSkillModifier.MultScaling(1f, -0.1f, skilllevel));
			}
		}
	}
	[SkillLevelModifier("VoidBlinkUp", new Type[] { typeof(VoidBlinkUp) })]
	internal class VoidFiendVoidBlinkUpSkillModifier : SimpleSkillModifier<VoidBlinkUp>
	{
		private BuffDef VoidFiendArmorBuff;

		private CharacterBody surv;

		private int skilllevel;

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

		public override void OnSkillExit(VoidBlinkUp skillState, int level)
		{
			Logger.Debug("VoidBlinkUp");
			if (level > 0)
			{
				surv.AddTimedBuff(VoidFiendArmorBuff, 3f);
			}
		}

		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
			RegisterArmorBuff();
			RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(RecalculateStatsAPIOnGetStatCoefficients);
			base.SetupSkill();
		}

		public void RegisterArmorBuff()
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			BuffDef val = ScriptableObject.CreateInstance<BuffDef>();
			val.buffColor = new Color(0.9f, 0.4f, 0.7f);
			val.canStack = false;
			val.eliteDef = null;
			val.iconSprite = Addressables.LoadAssetAsync<BuffDef>((object)"RoR2/Base/Common/bdHiddenInvincibility.asset").WaitForCompletion().iconSprite;
			val.isDebuff = false;
			((Object)val).name = "VoidFiendDamageSpeedBuff";
			VoidFiendArmorBuff = val;
			ContentAddition.AddBuffDef(val);
		}

		private void RecalculateStatsAPIOnGetStatCoefficients(CharacterBody sender, StatHookEventArgs args)
		{
			if (sender.HasBuff(VoidFiendArmorBuff))
			{
				args.armorAdd += (float)BaseSkillModifier.AdditiveScaling(0, 50, skilllevel);
			}
		}
	}
	[SkillLevelModifier("VoidBlinkDown", new Type[] { typeof(VoidBlinkDown) })]
	internal class VoidFiendVoidBlinkDownSkillModifier : SimpleSkillModifier<VoidBlinkDown>
	{
		private BuffDef VoidFiendDamageSpeedBuff;

		private CharacterBody surv;

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

		public override void OnSkillExit(VoidBlinkDown skillState, int level)
		{
			Logger.Debug("VoidBlinkDown");
			if (level > 0)
			{
				surv.AddTimedBuff(VoidFiendDamageSpeedBuff, (float)(level + 1));
			}
		}

		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
			RegisterDamageSpeedBuff();
			RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(RecalculateStatsAPIOnGetStatCoefficients);
			base.SetupSkill();
		}

		private void RecalculateStatsAPIOnGetStatCoefficients(CharacterBody sender, StatHookEventArgs args)
		{
			if (sender.HasBuff(VoidFiendDamageSpeedBuff))
			{
				args.attackSpeedMultAdd += 0.2f;
				args.moveSpeedMultAdd += 0.2f;
			}
		}

		public void RegisterDamageSpeedBuff()
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			BuffDef val = ScriptableObject.CreateInstance<BuffDef>();
			val.buffColor = new Color(0.9f, 0.4f, 0.7f);
			val.canStack = false;
			val.eliteDef = null;
			val.iconSprite = Addressables.LoadAssetAsync<BuffDef>((object)"RoR2/Base/SprintOutOfCombat/bdWhipBoost.asset").WaitForCompletion().iconSprite;
			val.isDebuff = false;
			((Object)val).name = "VoidFiendDamageSpeedBuff";
			VoidFiendDamageSpeedBuff = val;
			ContentAddition.AddBuffDef(val);
		}
	}
	[SkillLevelModifier("CrushCorruption", new Type[]
	{
		typeof(CrushCorruption),
		typeof(ChargeCrushCorruption)
	})]
	internal class VoidFiendCrushCorruptionSkillModifier : BaseSkillModifier
	{
		public override void OnSkillEnter(BaseState skillState, int level)
		{
			CrushCorruption val = (CrushCorruption)(object)((skillState is CrushCorruption) ? skillState : null);
			if (val != null)
			{
				Logger.Debug("CrushCorruption");
				((CrushBase)val).selfHealFraction = BaseSkillModifier.AdditiveScaling(((CrushBase)val).selfHealFraction, 0.15f, level);
			}
		}
	}
	[SkillLevelModifier("CrushHealth", new Type[]
	{
		typeof(CrushHealth),
		typeof(ChargeCrushHealth)
	})]
	internal class VoidFiendCrushHealthSkillModifier : BaseSkillModifier
	{
		private CharacterBody surv;

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

		public override void OnSkillEnter(BaseState skillState, int level)
		{
			CrushHealth val = (CrushHealth)(object)((skillState is CrushHealth) ? skillState : null);
			if (val != null)
			{
				Logger.Debug("CrushHealth");
				((CrushBase)val).corruptionChange = BaseSkillModifier.AdditiveScaling(((CrushBase)val).corruptionChange, 15f, level);
			}
			else if (skillState is ChargeCrushHealth)
			{
				Logger.Debug("ChargeCrushHealth");
			}
		}
	}
}
namespace SkillsPlusPlus.Modifiers
{
	[SkillLevelModifier("MageBodyFireFirebolt", new Type[] { typeof(FireFireBolt) })]
	internal class ArtificerFireBoltSkillModifier : SimpleSkillModifier<FireFireBolt>
	{
		public override void OnSkillLeveledUp(int level, CharacterBody characterBody, SkillDef skillDef)
		{
			base.OnSkillLeveledUp(level, characterBody, skillDef);
			Logger.Debug("FireFirebolt before - baseMaxStock: {0}, baseRechargeInterval: {1}", skillDef.baseMaxStock, skillDef.baseRechargeInterval);
			skillDef.baseMaxStock = BaseSkillModifier.AdditiveScaling(4, 2, level);
			skillDef.baseRechargeInterval = BaseSkillModifier.MultScaling(1.3f, -0.1f, level);
			Logger.Debug("FireFirebolt after - baseMaxStock: {0}, baseRechargeInterval: {1}", skillDef.baseMaxStock, skillDef.baseRechargeInterval);
		}
	}
	[SkillLevelModifier("MageBodyFireLightningBolt", new Type[] { typeof(FireLightningBolt) })]
	internal class ArtificerLightningBoltSkillModifier : SimpleSkillModifier<FireLightningBolt>
	{
		public override void OnSkillLeveledUp(int level, CharacterBody characterBody, SkillDef skillDef)
		{
			base.OnSkillLeveledUp(level, characterBody, skillDef);
			Logger.Debug("FireFirebolt before - baseMaxStock: {0}, baseRechargeInterval: {1}", skillDef.baseMaxStock, skillDef.baseRechargeInterval);
			skillDef.baseMaxStock = BaseSkillModifier.AdditiveScaling(4, 2, level);
			skillDef.baseRechargeInterval = BaseSkillModifier.MultScaling(1.3f, -0.1f, level);
			Logger.Debug("FireFirebolt after - baseMaxStock: {0}, baseRechargeInterval: {1}", skillDef.baseMaxStock, skillDef.baseRechargeInterval);
		}
	}
	[SkillLevelModifier("MageBodyNovaBomb", new Type[]
	{
		typeof(ChargeNovabomb),
		typeof(ThrowNovabomb)
	})]
	internal class MageNovaBombSkillModifier : BaseSkillModifier
	{
		public override void OnSkillEnter(BaseState skillState, int level)
		{
			base.OnSkillEnter(skillState, level);
			ChargeNovabomb val = (ChargeNovabomb)(object)((skillState is ChargeNovabomb) ? skillState : null);
			if (val != null)
			{
				((BaseChargeBombState)val).baseDuration = BaseSkillModifier.MultScaling(((BaseChargeBombState)val).baseDuration, 0.1f, level);
			}
			ThrowNovabomb val2 = (ThrowNovabomb)(object)((skillState is ThrowNovabomb) ? skillState : null);
			ProjectileImpactExplosion val3 = default(ProjectileImpactExplosion);
			if (val2 != null && ((BaseThrowBombState)val2).projectilePrefab.TryGetComponent<ProjectileImpactExplosion>(ref val3))
			{
				((ProjectileExplosion)val3).blastRadius = BaseSkillModifier.MultScaling(14f, 0.1f, level);
				EffectComponent val4 = default(EffectComponent);
				if (Object.op_Implicit((Object)(object)val3.impactEffect) && val3.impactEffect.TryGetComponent<EffectComponent>(ref val4))
				{
					val4.applyScale = true;
				}
				((BaseThrowBombState)val2).minDamageCoefficient = BaseSkillModifier.MultScaling(((BaseThrowBombState)val2).minDamageCoefficient, 0.2f, level);
				((BaseThrowBombState)val2).maxDamageCoefficient = BaseSkillModifier.MultScaling(((BaseThrowBombState)val2).maxDamageCoefficient, 0.25f, level);
				((BaseThrowBombState)val2).force = BaseSkillModifier.MultScaling(((BaseThrowBombState)val2).force, 0.2f, level);
			}
		}
	}
	[SkillLevelModifier("MageBodyIceBomb", new Type[]
	{
		typeof(ChargeIcebomb),
		typeof(ThrowIcebomb)
	})]
	internal class MageIceBombSkillModifier : BaseSkillModifier
	{
		public override void OnSkillEnter(BaseState skillState, int level)
		{
			base.OnSkillEnter(skillState, level);
			ChargeIcebomb val = (ChargeIcebomb)(object)((skillState is ChargeIcebomb) ? skillState : null);
			ThrowIcebomb val2 = (ThrowIcebomb)(object)((skillState is ThrowIcebomb) ? skillState : null);
			if (val2 != null)
			{
				((BaseThrowBombState)val2).minDamageCoefficient = BaseSkillModifier.MultScaling(((BaseThrowBombState)val2).minDamageCoefficient, 0.2f, level);
				((BaseThrowBombState)val2).maxDamageCoefficient = BaseSkillModifier.MultScaling(((BaseThrowBombState)val2).maxDamageCoefficient, 0.2f, level);
				((BaseThrowBombState)val2).force = BaseSkillModifier.MultScaling(((BaseThrowBombState)val2).force, 0.2f, level);
			}
		}
	}
	[SkillLevelModifier("MageBodyWall", new Type[] { typeof(PrepWall) })]
	internal class MageWallSkillModifier : SimpleSkillModifier<PrepWall>
	{
		public override void OnSkillLeveledUp(int level, CharacterBody characterBody, SkillDef skillDef)
		{
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			base.OnSkillLeveledUp(level, characterBody, skillDef);
			if (!((Object)(object)skillDef != (Object)(object)characterBody.skillLocator.utility.skillDef))
			{
				Logger.Debug("upgraded util");
				Logger.Debug("baseDuration: {0}, damageCoefficient: {1}", PrepWall.baseDuration, PrepWall.damageCoefficient);
				PrepWall.damageCoefficient = BaseSkillModifier.AdditiveScaling(1f, 0.3f, level);
				ProjectileMageFirewallWalkerController val = default(ProjectileMageFirewallWalkerController);
				if (PrepWall.projectilePrefab.TryGetComponent<ProjectileMageFirewallWalkerController>(ref val))
				{
					val.totalProjectiles = BaseSkillModifier.AdditiveScaling(6, 1, level);
					Logger.Debug("projectileMageFirewallWalkerController.totalProjectiles: {0}", val.totalProjectiles);
				}
				float num = BaseSkillModifier.AdditiveScaling(23.69f, 7.896667f, level);
				PrepWall.areaIndicatorPrefab.transform.localScale = new Vector3(num, PrepWall.areaIndicatorPrefab.transform.localScale.y, PrepWall.areaIndicatorPrefab.transform.localScale.z);
				PrepWall.areaIndicatorPrefab = PrefabAPI.InstantiateClone(PrepWall.areaIndicatorPrefab.gameObject, ((Object)PrepWall.areaIndicatorPrefab.gameObject).name);
				Logger.Debug("baseDuration: {0}, damageCoefficient: {1}", PrepWall.baseDuration, PrepWall.damageCoefficient);
				Logger.Debug(((Object)PrepWall.projectilePrefab).name);
			}
		}
	}
	[SkillLevelModifier(new string[] { "MageBodyFlamethrower", "Dragon's Breath" }, new Type[] { typeof(Flamethrower) })]
	internal class MageFlamethrowerSkillModifier : SimpleSkillModifier<Flamethrower>
	{
		private float baseRadius = 2f;

		private float newRadius = 2f;

		private float totalDamageCoeff = 20f;

		public override void OnSkillEnter(Flamethrower skillState, int level)
		{
			//IL_003a: 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)
			base.OnSkillEnter(skillState, level);
			Logger.Debug(skillState.maxDistance);
			skillState.maxDistance = BaseSkillModifier.MultScaling(skillState.maxDistance, 0.2f, level);
			Logger.Debug(skillState.flamethrowerEffectPrefab.transform.localScale);
			skillState.totalDamageCoefficient = totalDamageCoeff;
			skillState.flamethrowerEffectPrefab.transform.localScale = new Vector3(baseRadius, baseRadius, (float)BaseSkillModifier.AdditiveScaling(1, 1, level));
			Logger.Debug(skillState.maxDistance);
		}

		public override void OnSkillLeveledUp(int level, CharacterBody characterBody, SkillDef skillDef)
		{
			base.OnSkillLeveledUp(level, characterBody, skillDef);
			Logger.Debug("Flamethrower stats - totalDamageCoefficient: {0}, radius: {1}", totalDamageCoeff, baseRadius);
			baseRadius = BaseSkillModifier.MultScaling(2f, 0.25f, level);
			totalDamageCoeff = BaseSkillModifier.MultScaling(20f, 0.2f, level);
			Logger.Debug("Flamethrower stats - totalDamageCoefficient: {0}, radius: {1}", totalDamageCoeff, baseRadius);
		}
	}
	[SkillLevelModifier(new string[] { "MageBodyFlyUp", "Antimatter Surge" }, new Type[] { typeof(FlyUpState) })]
	internal class MageFlyUpSkillModifier : SimpleSkillModifier<FlyUpState>
	{
		public override void OnSkillEnter(FlyUpState skillState, int level)
		{
			base.OnSkillEnter(skillState, level);
		}

		public override void OnSkillLeveledUp(int level, CharacterBody characterBody, SkillDef skillDef)
		{
			base.OnSkillLeveledUp(level, characterBody, skillDef);
			Logger.Debug("FlyUpState stats - duration: {0}, blastAttackDamageCoefficient: {1}, blastAttackRadius: {2}, blastAttackProcCoefficient: {3}", FlyUpState.duration, FlyUpState.blastAttackDamageCoefficient, FlyUpState.blastAttackRadius, FlyUpState.blastAttackProcCoefficient);
			FlyUpState.blastAttackDamageCoefficient = BaseSkillModifier.MultScaling(8f, 0.25f, level);
			FlyUpState.blastAttackRadius = BaseSkillModifier.MultScaling(8f, 0.3f, level);
			Logger.Debug("FlyUpState stats - duration: {0}, blastAttackDamageCoefficient: {1}, blastAttackRadius: {2}, blastAttackProcCoefficient: {3}", FlyUpState.duration, FlyUpState.blastAttackDamageCoefficient, FlyUpState.blastAttackRadius, FlyUpState.blastAttackProcCoefficient);
		}
	}
	[SkillLevelModifier("FireShotgun2", new Type[] { typeof(FireShotgun2) })]
	internal class BanditFireShotgunSkillModifier : SimpleSkillModifier<FireShotgun2>
	{
		public override void OnSkillEnter(FireShotgun2 skillState, int level)
		{
			base.OnSkillEnter(skillState, level);
			((GenericBulletBaseState)skillState).bulletCount = ((GenericBulletBaseState)skillState).bulletCount + level;
			((GenericBulletBaseState)skillState).damageCoefficient = BaseSkillModifier.MultScaling(((GenericBulletBaseState)skillState).damageCoefficient, 0.05f, level);
			skillState.minFixedSpreadYaw += (float)level * 0.5f;
			skillState.maxFixedSpreadYaw += (float)level;
		}
	}
	[SkillLevelModifier("Bandit2Blast", new Type[] { typeof(Bandit2FireRifle) })]
	internal class BanditFireRifleSkillModifier : SimpleSkillModifier<Bandit2FireRifle>
	{
		private float baseBloom;

		public