Decompiled source of SkillsPlusPlus v0.6.0

Skills.dll

Decompiled 6 hours ago
using System;
using System.Collections;
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.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.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.Seeker;
using EntityStates.Toolbot;
using EntityStates.Treebot;
using EntityStates.Treebot.TreebotFlower;
using EntityStates.Treebot.Weapon;
using EntityStates.VoidSurvivor;
using EntityStates.VoidSurvivor.Weapon;
using HG.Reflection;
using HarmonyLib;
using MonoMod.RuntimeDetour;
using On.EntityStates;
using On.EntityStates.Loader;
using On.EntityStates.Railgunner.Reload;
using On.RoR2;
using On.RoR2.Skills;
using On.RoR2.UI;
using R2API;
using R2API.Utils;
using Rewired;
using Rewired.Data;
using Rewired.Data.Mapping;
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 SkillsPlusPlus.Util;
using TMPro;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Events;
using UnityEngine.Networking;
using UnityEngine.SceneManagement;
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+79d7ca4a9097ef11e51949af599bd3d0226e0ff2")]
[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 static class SkillInput
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static hook_Start <>9__5_0;

			internal void <SetupCustomInput>b__5_0(orig_Start orig, SettingsPanelController self)
			{
				SetupGamepadSettingsControllerAwake(self);
				orig.Invoke(self);
			}
		}

		public static bool isControllerSupported;

		public const int BUY_SKILLS_ACTION_ID = 400;

		public const string BUY_SKILLS_ACTION_NAME = "BuySkills";

		private const string UI_TOKEN = "SKILLS_GAMEPAD_BUY_BTN";

		private const string UI_HOVER_TOKEN = "SKILLS_GAMEPAD_BUY_DESCRIPTION";

		private static bool bAlerted;

		internal static void SetupCustomInput()
		{
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Expected O, but got Unknown
			MethodInfo method = typeof(UserData).GetMethod("wVZZKoPFwEvodLvLcYNvVAPKpUj", BindingFlags.Instance | BindingFlags.NonPublic);
			if (method != null)
			{
				new Hook((MethodBase)method, (Delegate)new Action<Action<UserData>, UserData>(ReInput_wVZZKoPFwEvodLvLcYNvVAPKpUj));
				isControllerSupported = true;
			}
			else
			{
				Logger.Error("Unable to add extra action to controller bindings. Was not able to find the method \"wVZZKoPFwEvodLvLcYNvVAPKpUj\" in Rewired.UserData");
			}
			SceneManager.activeSceneChanged += OnFirstSceneLoad;
			object obj = <>c.<>9__5_0;
			if (obj == null)
			{
				hook_Start val = delegate(orig_Start orig, SettingsPanelController self)
				{
					SetupGamepadSettingsControllerAwake(self);
					orig.Invoke(self);
				};
				<>c.<>9__5_0 = val;
				obj = (object)val;
			}
			SettingsPanelController.Start += (hook_Start)obj;
		}

		private static void OnFirstSceneLoad(Scene _, Scene __)
		{
			SceneManager.activeSceneChanged -= OnFirstSceneLoad;
			try
			{
				InputCatalog.GetActionNameToken("BuySkills", (AxisRange)0);
			}
			catch
			{
				try
				{
					object key = Reflection.GetConstructorCached(Reflection.GetNestedTypeCached(typeof(InputCatalog), "ActionAxisPair"), new Type[2]
					{
						typeof(string),
						typeof(AxisRange)
					}).Invoke(new object[2]
					{
						"BuySkills",
						(object)(AxisRange)0
					});
					Reflection.GetFieldValue<IDictionary>(typeof(InputCatalog), "actionToToken")?.Add(key, "SKILLS_GAMEPAD_BUY_BTN");
				}
				catch (Exception exception)
				{
					Logger.Error(exception);
				}
			}
		}

		private static void ReInput_wVZZKoPFwEvodLvLcYNvVAPKpUj(Action<UserData> orig, UserData userData)
		{
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Expected O, but got Unknown
			int fieldValue = Reflection.GetFieldValue<int>((object)userData, "actionIdCounter");
			Logger.Debug(fieldValue);
			userData.InsertAction(0, 400);
			InputAction actionById = userData.GetActionById(fieldValue);
			Reflection.SetPropertyValue<int>((object)actionById, "id", 400);
			Reflection.SetPropertyValue<string>((object)actionById, "name", "BuySkills");
			userData.ChangeActionCategory(400, 2);
			userData.ChangeActionCategory(400, 0);
			int num = default(int);
			ControllerMap_Editor joystickMapById = userData.GetJoystickMapById(0, ref num);
			ActionElementMap item = new ActionElementMap(400, (ControllerElementType)1, 0);
			joystickMapById.actionElementMaps.Add(item);
			Logger.Debug("Delegating to original ReInput method");
			orig(userData);
		}

		private static void SetupGamepadSettingsControllerAwake(SettingsPanelController settingsPanelController)
		{
			if (isControllerSupported && (!(((Object)settingsPanelController).name != "SettingsSubPanel, Controls (M&KB)") || !(((Object)settingsPanelController).name != "SettingsSubPanel, Controls (Gamepad)")) && InputCatalog.GetActionNameToken("BuySkills", (AxisRange)0) != null)
			{
				Transform obj = ((Component)settingsPanelController).transform.Find("Scroll View/Viewport/VerticalLayout/SettingsEntryButton, Binding (Jump)");
				InputBindingControl component = ((Component)Object.Instantiate<Transform>(obj, obj.parent)).GetComponent<InputBindingControl>();
				component.actionName = "BuySkills";
				component.Awake();
			}
		}

		public static bool GenericSkill_CanExecute(orig_CanExecute orig, SkillDef self, GenericSkill skillSlot)
		{
			if (Object.op_Implicit((Object)(object)skillSlot))
			{
				CharacterBody characterBody = skillSlot.characterBody;
				object obj;
				if (characterBody == null)
				{
					obj = null;
				}
				else
				{
					CharacterMaster master = characterBody.master;
					obj = ((master != null) ? ((Component)master).GetComponent<PlayerCharacterMasterController>() : null);
				}
				PlayerCharacterMasterController val = (PlayerCharacterMasterController)obj;
				if (Object.op_Implicit((Object)(object)val))
				{
					LocalUser val2 = ((val == null) ? null : val.networkUser?.localUser);
					Player val3 = ((val2 != null) ? val2.inputPlayer : null);
					if (SkillsPlusPlus.ConVars.ConVars.disableOnBuy == null)
					{
						if (!bAlerted)
						{
							Logger.Error("DisableOnBuy ConVar has somehow broken. GenericSkill_CanExecute will abort unless things fix themselves.");
							bAlerted = true;
						}
						return orig.Invoke(self, skillSlot);
					}
					if (val2 != null && val3 != null)
					{
						if (SkillsPlusPlus.ConVars.ConVars.disableOnBuy.value && (Object)(object)skillSlot.characterBody == (Object)(object)PlayerCharacterMasterController.instances[0].master.GetBody() && val3.GetButton("BuySkills"))
						{
							return false;
						}
					}
					else if (!bAlerted)
					{
						if (val2 == null)
						{
							Logger.Error("localUser has somehow broken. GenericSkill_CanExecute will abort unless things fix themselves.");
							bAlerted = true;
						}
						if (val3 == null)
						{
							Logger.Error("inputPlayer has somehow broken. GenericSkill_CanExecute will abort unless things fix themselves.");
							bAlerted = true;
						}
					}
				}
			}
			return orig.Invoke(self, skillSlot);
		}
	}
	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;

		public GenericSkill genericSkill => skillIcon?.targetSkill;

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

		private void Update()
		{
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_0188: Unknown result type (might be due to invalid IL or missing references)
			//IL_018d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0192: Unknown result type (might be due to invalid IL or missing references)
			//IL_0195: Unknown result type (might be due to invalid IL or missing references)
			//IL_01af: Expected I4, but got Unknown
			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))
						{
							SkillDef skillDef = genericSkill.skillDef;
							string obj2 = ((skillDef != null) ? ((Object)skillDef).name : null);
							SkillDef skillDef2 = skillUpgrade.targetGenericSkill.skillDef;
							if (obj2 == ((skillDef2 != null) ? ((Object)skillDef2).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 obj3 = ((val == null) ? null : val.networkUser?.localUser);
			Player val2 = ((obj3 != null) ? obj3.inputPlayer : null);
			if (val2 != null && (Object)(object)skillIcon != (Object)null)
			{
				SkillSlot targetSkillSlot = skillIcon.targetSkillSlot;
				int num = 0;
				switch (targetSkillSlot - -1)
				{
				case 0:
					num = 0;
					break;
				case 1:
					num = 7;
					break;
				case 2:
					num = 8;
					break;
				case 3:
					num = 9;
					break;
				case 4:
					num = 10;
					break;
				}
				UpgradeButton.SetActive((flag && val2.GetButton("BuySkills")) || val2.GetButton(19));
				if (num != 0 && val2.GetButtonDown(num) && val2.GetButton("BuySkills"))
				{
					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();
						for (int j = 0; j < constructors.Length; j++)
						{
							Logger.Debug(constructors[j]);
						}
						continue;
					}
					foreach (SkillLevelModifierAttribute item in customAttributes)
					{
						object obj = constructor.Invoke(new object[0]);
						if (!(obj is BaseSkillModifier baseSkillModifier))
						{
							continue;
						}
						baseSkillModifier.SetupSkill();
						baseSkillModifier.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}", 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
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static hook_Start <>9__6_0;

			public static Predicate<CarouselController> <>9__7_0;

			internal void <SetupGameplayOptions>b__6_0(orig_Start orig, SettingsPanelController self)
			{
				orig.Invoke(self);
				SettingsPanelControllerAwake(self);
			}

			internal bool <SettingsPanelControllerAwake>b__7_0(CarouselController carouselController)
			{
				if (!((Object)(object)carouselController.leftArrowButton != (Object)null))
				{
					return (Object)(object)carouselController.rightArrowButton != (Object)null;
				}
				return true;
			}
		}

		private static GameObject carouselPrefab;

		private static GameObject boolPrefab;

		private static Transform gameplaySettingsPanelTransform;

		private static CarouselController levelsPerSkillPointCarousel;

		private static CarouselController multLinearScaleCarousel;

		private static CarouselController disableOnBuyCarousel;

		internal static void SetupGameplayOptions()
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Expected O, but got Unknown
			object obj = <>c.<>9__6_0;
			if (obj == null)
			{
				hook_Start val = delegate(orig_Start orig, SettingsPanelController self)
				{
					orig.Invoke(self);
					SettingsPanelControllerAwake(self);
				};
				<>c.<>9__6_0 = val;
				obj = (object)val;
			}
			SettingsPanelController.Start += (hook_Start)obj;
		}

		private static void SettingsPanelControllerAwake(SettingsPanelController settingsPanelController)
		{
			//IL_033c: 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_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0168: Unknown result type (might be due to invalid IL or missing references)
			//IL_019c: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)levelsPerSkillPointCarousel))
			{
				if (((Object)settingsPanelController).name == "SettingsSubPanel, Gameplay")
				{
					Logger.Debug("Got gameplay controller");
					gameplaySettingsPanelTransform = ((Component)((Component)settingsPanelController).GetComponentInChildren<BaseSettingsControl>(true)).transform.parent;
					CarouselController[] componentsInChildren = ((Component)((Component)settingsPanelController).transform.parent).GetComponentsInChildren<CarouselController>(true);
					Logger.Debug(componentsInChildren.Length);
					CarouselController? obj = Array.Find(componentsInChildren, (CarouselController carouselController) => (Object)(object)carouselController.leftArrowButton != (Object)null || (Object)(object)carouselController.rightArrowButton != (Object)null);
					carouselPrefab = ((obj != null) ? ((Component)obj).gameObject : null);
				}
				if ((Object)(object)gameplaySettingsPanelTransform != (Object)null && (Object)(object)carouselPrefab != (Object)null)
				{
					Logger.Debug("Adding option");
					GameObject obj2 = Object.Instantiate<GameObject>(carouselPrefab, gameplaySettingsPanelTransform);
					((Object)obj2).name = "SettingsEntryButton, Carousel (Skills++)";
					levelsPerSkillPointCarousel = obj2.GetComponent<CarouselController>();
					levelsPerSkillPointCarousel.forceValidChoice = false;
					((BaseSettingsControl)levelsPerSkillPointCarousel).settingSource = (SettingSource)0;
					((BaseSettingsControl)levelsPerSkillPointCarousel).settingName = ((BaseConVar)SkillsPlusPlus.ConVars.ConVars.levelsPerSkillPoint).name;
					((BaseSettingsControl)levelsPerSkillPointCarousel).nameToken = "LEVELS_PER_SKILLPOINT";
					((BaseSettingsControl)levelsPerSkillPointCarousel).nameLabel.token = "LEVELS_PER_SKILLPOINT";
					((Component)levelsPerSkillPointCarousel).GetComponent<HGButton>().hoverToken = ((BaseConVar)SkillsPlusPlus.ConVars.ConVars.levelsPerSkillPoint).helpText;
					List<Choice> list = new List<Choice>();
					for (int i = SkillsPlusPlus.ConVars.ConVars.levelsPerSkillPoint.minValue; i <= SkillsPlusPlus.ConVars.ConVars.levelsPerSkillPoint.maxValue; i++)
					{
						list.Add(new Choice
						{
							convarValue = (i.ToString() ?? ""),
							suboptionDisplayToken = (i.ToString() ?? "")
						});
					}
					levelsPerSkillPointCarousel.choices = list.ToArray();
					((Behaviour)levelsPerSkillPointCarousel).enabled = false;
					((Behaviour)levelsPerSkillPointCarousel).enabled = true;
				}
			}
			if (!Object.op_Implicit((Object)(object)multLinearScaleCarousel))
			{
				if (((Object)settingsPanelController).name == "SettingsSubPanel, Gameplay")
				{
					BaseSettingsControl[] settingsControllers = settingsPanelController.settingsControllers;
					foreach (BaseSettingsControl val in settingsControllers)
					{
						if (((Object)val).name.Contains(", Bool"))
						{
							boolPrefab = ((Component)val).gameObject;
							break;
						}
					}
				}
				if (Object.op_Implicit((Object)(object)boolPrefab))
				{
					GameObject obj3 = Object.Instantiate<GameObject>(boolPrefab, gameplaySettingsPanelTransform);
					((Object)obj3).name = "SettingsEntryButton, Bool (LinearSkill - Skills++)";
					multLinearScaleCarousel = obj3.GetComponent<CarouselController>();
					multLinearScaleCarousel.forceValidChoice = false;
					((BaseSettingsControl)multLinearScaleCarousel).settingSource = (SettingSource)0;
					((BaseSettingsControl)multLinearScaleCarousel).settingName = ((BaseConVar)SkillsPlusPlus.ConVars.ConVars.multScalingLinear).name;
					((BaseSettingsControl)multLinearScaleCarousel).nameToken = "MULT_SCALING_LINEAR";
					((BaseSettingsControl)multLinearScaleCarousel).nameLabel.token = "MULT_SCALING_LINEAR";
					((Component)multLinearScaleCarousel).GetComponent<HGButton>().hoverToken = ((BaseConVar)SkillsPlusPlus.ConVars.ConVars.multScalingLinear).helpText;
					((Behaviour)multLinearScaleCarousel).enabled = false;
					((Behaviour)multLinearScaleCarousel).enabled = true;
				}
			}
			if (!Object.op_Implicit((Object)(object)disableOnBuyCarousel) && Object.op_Implicit((Object)(object)boolPrefab))
			{
				GameObject obj4 = Object.Instantiate<GameObject>(boolPrefab, gameplaySettingsPanelTransform);
				((Object)obj4).name = "SettingsEntryButton, Bool (DisableOnBuy - Skills++)";
				disableOnBuyCarousel = obj4.GetComponent<CarouselController>();
				disableOnBuyCarousel.forceValidChoice = false;
				((BaseSettingsControl)disableOnBuyCarousel).settingSource = (SettingSource)0;
				((BaseSettingsControl)disableOnBuyCarousel).settingName = ((BaseConVar)SkillsPlusPlus.ConVars.ConVars.disableOnBuy).name;
				((BaseSettingsControl)disableOnBuyCarousel).nameToken = "DISABLE_SKILL_BUY_INPUT";
				((BaseSettingsControl)disableOnBuyCarousel).nameLabel.token = "DISABLE_SKILL_BUY_INPUT";
				((Component)disableOnBuyCarousel).GetComponent<HGButton>().hoverToken = ((BaseConVar)SkillsPlusPlus.ConVars.ConVars.disableOnBuy).helpText;
				((Behaviour)disableOnBuyCarousel).enabled = false;
				((Behaviour)disableOnBuyCarousel).enabled = true;
			}
		}
	}
	[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 = 5;

		[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()
		{
			levelsPerSkillPoint = ((IntConVar)SkillsPlusPlus.ConVars.ConVars.levelsPerSkillPoint).value;
			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>();
			for (int i = 0; i < components.Length; i++)
			{
				components[i].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>();
			foreach (SkillUpgrade skillUpgrade in components)
			{
				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)
		{
			if (isSurvivorEnabled && (Object)(object)body != (Object)null && (Object)(object)((EntityState)self).outer.commonComponents.characterBody == (Object)(object)body)
			{
				PlayerCharacterMasterController obj = playerCharacterMasterController;
				object obj2;
				if (obj == null)
				{
					obj2 = null;
				}
				else
				{
					NetworkUser networkUser = obj.networkUser;
					if (networkUser == null)
					{
						obj2 = null;
					}
					else
					{
						LocalUser localUser = networkUser.localUser;
						obj2 = ((localUser != null) ? localUser.inputPlayer : null);
					}
				}
				Player val = (Player)obj2;
				if (val != null && val.GetButtonDown(400))
				{
					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)
			{
				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.0")]
	[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
	public sealed class SkillsPlugin : BaseUnityPlugin
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static hook_SetTooltipProvider <>9__1_0;

			public static Action<SkillIcon> <>9__4_0;

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

			internal void <HUD_Awake>b__4_0(SkillIcon skillIcon)
			{
				((Component)(object)skillIcon).EnsureComponent<SkillUpgradeTooltipProvider>();
				((Component)(object)skillIcon).EnsureComponent<SkillLevelIconController>();
			}
		}

		private static SkillsPlugin Instance;

		private void Awake()
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Expected O, but got Unknown
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Expected O, but got Unknown
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Expected O, but got Unknown
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Expected O, but got Unknown
			Instance = this;
			CommandHelper.AddToConsoleWhenReady();
			RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(LunarModifiers.RecalculateStats_GetLunarStats);
			SkillDef.CanExecute += new hook_CanExecute(SkillInput.GenericSkill_CanExecute);
			SkillModifierManager.LoadSkillModifiers();
			SkillInput.SetupCustomInput();
			SkillOptions.SetupGameplayOptions();
			LegacyResourcesAPI.Load<GameObject>("prefabs/charactermasters/CommandoMaster").EnsureComponent<SkillPointsController>();
			LegacyResourcesAPI.Load<GameObject>("Prefabs/UI/Tooltip").EnsureComponent<SkillsPlusPlusTooltipController>();
			object obj = <>c.<>9__1_0;
			if (obj == null)
			{
				hook_SetTooltipProvider val = delegate(orig_SetTooltipProvider orig, TooltipController self, TooltipProvider provider)
				{
					orig.Invoke(self, provider);
					SkillUpgradeTooltipProvider skillUpgradeTooltipProvider = default(SkillUpgradeTooltipProvider);
					if (((Component)provider).TryGetComponent<SkillUpgradeTooltipProvider>(ref skillUpgradeTooltipProvider))
					{
						((Component)(object)self).EnsureComponent<SkillsPlusPlusTooltipController>().skillUpgradeToken = skillUpgradeTooltipProvider.GetToken();
					}
				};
				<>c.<>9__1_0 = val;
				obj = (object)val;
			}
			TooltipController.SetTooltipProvider += (hook_SetTooltipProvider)obj;
			Row.FromSkillSlot += new hook_FromSkillSlot(RowOnFromSkillSlot);
			HUD.Awake += new hook_Awake(HUD_Awake);
			Logger.Debug("Awake() SurvivorCatalog.allSurvivorDef: {0}", SurvivorCatalog.allSurvivorDefs);
			static object RowOnFromSkillSlot(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_0061: Unknown result type (might be due to invalid IL or missing references)
				//IL_0066: Unknown result type (might be due to invalid IL or missing references)
				//IL_0098: Unknown result type (might be due to invalid IL or missing references)
				object obj2 = orig.Invoke(owner, bodyindex, skillslotindex, skillslot);
				Row val2 = (Row)((obj2 is Row) ? obj2 : null);
				if (val2 != null)
				{
					List<RowData> rowData = val2.rowData;
					Logger.Debug("row " + rowData);
					for (int i = 0; i < rowData.Count; i++)
					{
						Logger.Debug("Ensuring SkillsPlusPlusTooltipProvider({0})", i);
						RowData val3 = rowData[i];
						SkillDef val4 = ((skillslot == null) ? null : skillslot.skillFamily?.variants[i].skillDef);
						if ((Object)(object)val4 != (Object)null)
						{
							((Component)val3.button).gameObject.EnsureComponent<SkillUpgradeTooltipProvider>().skillName = ((val4 != null) ? ((Object)val4).name : null);
							Logger.Debug((val4 != null) ? ((Object)val4).name : null);
						}
					}
				}
				else
				{
					Logger.Debug("row null ");
				}
				return val2;
			}
		}

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

		private void PrepareSurvivor(SurvivorDef survivorDef)
		{
			Logger.Debug("PrepareSurvivor({0})", survivorDef);
			if ((Object)(object)survivorDef == (Object)null)
			{
				return;
			}
			EnumerableExtensions.ForEachTry<SkillUpgrade>((IEnumerable<SkillUpgrade>)survivorDef.bodyPrefab.GetComponents<SkillUpgrade>(), (Action<SkillUpgrade>)Object.Destroy, (IDictionary<SkillUpgrade, Exception>)null);
			SkillLocator skillLocator = default(SkillLocator);
			if (!survivorDef.bodyPrefab.TryGetComponent<SkillLocator>(ref skillLocator))
			{
				return;
			}
			GenericSkill[] array = skillLocator.FindAllGenericSkills();
			foreach (GenericSkill val in array)
			{
				if (!((Object)(object)val == (Object)null))
				{
					survivorDef.bodyPrefab.AddComponent<SkillUpgrade>().targetGenericSkill = val;
					Logger.Debug("+ {0}", val.skillName);
				}
			}
		}

		private void HUD_Awake(orig_Awake orig, HUD self)
		{
			orig.Invoke(self);
			EnumerableExtensions.ForEachTry<SkillIcon>((IEnumerable<SkillIcon>)((Component)self).GetComponentsInChildren<SkillIcon>(true), (Action<SkillIcon>)delegate(SkillIcon skillIcon)
			{
				((Component)(object)skillIcon).EnsureComponent<SkillUpgradeTooltipProvider>();
				((Component)(object)skillIcon).EnsureComponent<SkillLevelIconController>();
			}, (IDictionary<SkillIcon, Exception>)null);
		}
	}
	[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.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>();
			foreach (SkillUpgrade skillUpgrade in components)
			{
				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))
					{
						if (flag)
						{
							Logger.Debug(((object)state).GetType().Name + ": Found MinionOwner in CharacterBody, returning " + val2.ownerMaster.GetBody().GetDisplayName());
						}
						return val2.ownerMaster.GetBody();
					}
					if (flag)
					{
						Logger.Debug(((object)state).GetType().Name + ": Found CharacterBody, returning " + val.GetDisplayName());
					}
					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))
				{
					if (flag)
					{
						Logger.Debug(((object)state).GetType().Name + ": Found MinionOwnership, returning " + val4.ownerMaster.GetBody().GetDisplayName());
					}
					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))
				{
					if (flag)
					{
						Logger.Debug(((object)state).GetType().Name + ": Found Deployable, returning " + val6.ownerMaster.GetBody().GetDisplayName());
					}
					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 (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);
							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.Util
{
	internal static class SkillLocatorExtension
	{
		public static GenericSkill FindGenericSkillBySkillDef(this SkillLocator skillLocator, string skillName, bool allowMatchBaseSkill = false)
		{
			return Array.Find(skillLocator.FindAllGenericSkills(), delegate(GenericSkill genericSkill)
			{
				if (!allowMatchBaseSkill || !(genericSkill.baseSkill.skillName == skillName))
				{
					SkillDef skillDef = genericSkill.skillDef;
					return ((skillDef != null) ? ((Object)skillDef).name : null) == skillName;
				}
				return true;
			});
		}

		public static GenericSkill[] FindAllGenericSkills(this SkillLocator skillLocator)
		{
			return ((Component)skillLocator).GetComponents<GenericSkill>();
		}
	}
}
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 val = Object.Instantiate<GameObject>(((Component)((TMP_Text)tooltipController.bodyLabel).transform.parent).gameObject, (Transform)(object)tooltipFlipTransform);
			val.transform.SetSiblingIndex(Math.Max(0, ((Transform)tooltipFlipTransform).childCount - 2));
			val.SetActive(skillUpgradeToken != null && !Language.IsTokenInvalid(skillUpgradeToken));
			if (skillUpgradeToken != null && !Language.IsTokenInvalid(skillUpgradeToken))
			{
				string @string = Language.GetString(skillUpgradeToken);
				((TMP_Text)val.GetComponentInChildren<TextMeshProUGUI>()).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("ChefDice", new Type[] { typeof(Dice) })]
	internal class ChefDiceSkillModifier : 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 Dice)
			{
				Logger.Debug("Dice");
			}
		}
	}
	[SkillLevelModifier("ChefSear", new Type[] { typeof(Sear) })]
	internal class ChefSearSkillModifier : 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 Sear)
			{
				Logger.Debug("FireCorruptHandBeam");
			}
		}
	}
	[SkillLevelModifier("ChefRolyPoly", new Type[]
	{
		typeof(RolyPoly),
		typeof(ChargeRolyPoly),
		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)
		{
			base.OnSkillEnter(skillState, level);
			if (skillState is RolyPoly)
			{
				Logger.Debug("RolyPoly");
			}
			else if (skillState is ChargeRolyPoly)
			{
				Logger.Debug("ChargeRolyPoly");
			}
			else if (skillState is RolyPolyWeaponBlockingState)
			{
				Logger.Debug("RolyPolyWeaponBlockingState");
			}
		}
	}
	[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);
			if (skillState is Glaze)
			{
				Logger.Debug("Glaze");
			}
		}
	}
	[SkillLevelModifier("YesChef", new Type[] { typeof(YesChef) })]
	internal class ChefYesChefSkillModifier : 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 YesChef)
			{
				Logger.Debug("YesChef");
			}
		}
	}
	[SkillLevelModifier("SeekerBodySpiritPunchCrosshair", new Type[] { typeof(SpiritPunch) })]
	internal class SeekerPunchSkillModifier : 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 SpiritPunch)
			{
				Logger.Debug("SpiritPunch");
			}
		}
	}
	[SkillLevelModifier("SeekerBodyUnseenHand", new Type[] { typeof(UnseenHand) })]
	internal class SeekerUnseenHandSkillModifier : 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 UnseenHand)
			{
				Logger.Debug("UnseenHand");
			}
		}
	}
	[SkillLevelModifier("SeekerBodySoulSpiral", new Type[] { typeof(SoulSpiral) })]
	internal class SeekerSoulSpiralSkillModifier : 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 SoulSpiral)
			{
				Logger.Debug("SoulSpiral");
			}
		}
	}
	[SkillLevelModifier("SeekerBodySojourn", new Type[]
	{
		typeof(Sojourn),
		typeof(SojournVehicle)
	})]
	internal class SeekerSojournSkillModifier : BaseSkillModifier
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static hook_OnPassengerEnter <>9__2_0;

			internal void <SetupSkill>b__2_0(orig_OnPassengerEnter orig, VehicleSeat self, GameObject passenger)
			{
				orig.Invoke(self, passenger);
				if (((Object)self).name.Contains("SojournVehicle"))
				{
					Logger.Debug("sojourn started !!!");
					SojournVehicle component = ((Component)self).GetComponent<SojournVehicle>();
					if ((Object)(object)component == (Object)null)
					{
						Logger.Debug("erm., ,. nvm ,.,..");
						return;
					}
					Logger.Debug("sojourn real !!");
					component.startingSpeedBoost = 100f;
				}
			}
		}

		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 Sojourn)
			{
				Logger.Debug("Sojourn");
			}
		}

		public override void SetupSkill()
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Expected O, but got Unknown
			base.SetupSkill();
			object obj = <>c.<>9__2_0;
			if (obj == null)
			{
				hook_OnPassengerEnter val = delegate(orig_OnPassengerEnter orig, VehicleSeat self, GameObject passenger)
				{
					orig.Invoke(self, passenger);
					if (((Object)self).name.Contains("SojournVehicle"))
					{
						Logger.Debug("sojourn started !!!");
						SojournVehicle component = ((Component)self).GetComponent<SojournVehicle>();
						if ((Object)(object)component == (Object)null)
						{
							Logger.Debug("erm., ,. nvm ,.,..");
						}
						else
						{
							Logger.Debug("sojourn real !!");
							component.startingSpeedBoost = 100f;
						}
					}
				};
				<>c.<>9__2_0 = val;
				obj = (object)val;
			}
			VehicleSeat.OnPassengerEnter += (hook_OnPassengerEnter)obj;
		}
	}
	[SkillLevelModifier("SeekerBodyMeditate2", new Type[]
	{
		typeof(Meditate),
		typeof(MeditationUI)
	})]
	internal class SeekerMeditateSkillModifier : 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 Meditate)
			{
				Logger.Debug("Meditate");
			}
			else if (skillState is MeditationUI)
			{
				Logger.Debug("MeditationUI");
			}
		}
	}
	internal class VoidFiendSkillModifiers
	{
	}
	[SkillLevelModifier("FireHandBeam", new Type[]
	{
		typeof(FireHandBeam),
		typeof(ChargeHandBeam)
	})]
	internal class VoidFiendHandBeamSkillModifier : 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 FireHandBeam)
			{
				Logger.Debug("FireHandBeam");
			}
			else if (skillState is ChargeHandBeam)
			{
				Logger.Debug("ChargeHandBeam");
			}
		}
	}
	[SkillLevelModifier("FireCorruptBeam", new Type[]
	{
		typeof(FireCorruptHandBeam),
		typeof(ChargeCorruptHandBeam)
	})]
	internal class VoidFiendCorruptHandBeamSkillModifier : 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 FireCorruptHandBeam)
			{
				Logger.Debug("FireCorruptHandBeam");
			}
			else if (skillState is ChargeCorruptHandBeam)
			{
				Logger.Debug("ChargeCorruptHandBeam");
			}
		}
	}
	[SkillLevelModifier("ChargeMegaBlaster", new Type[]
	{
		typeof(ChargeMegaBlaster),
		typeof(FireMegaBlasterBase),
		typeof(FireMegaBlasterBig),
		typeof(FireMegaBlasterSmall)
	})]
	internal class VoidFiendChargeMegaSkillModifier : BaseSkillModifier
	{
		public override void OnSkillEnter(BaseState skillState, int level)
		{
			if (skillState is ChargeMegaBlaster)
			{
				Logger.Debug("ChargeMegaBlaster");
			}
			else if (skillState is FireMegaBlasterBase)
			{
				Logger.Debug("FireMegaBlasterBase");
			}
			else if (skillState is FireMegaBlasterBig)
			{
				Logger.Debug("FireMegaBlasterBig");
			}
			else if (skillState is FireMegaBlasterSmall)
			{
				Logger.Debug("FireMegaBlasterSmall");
			}
		}
	}
	[SkillLevelModifier("FireCorruptDisk", new Type[] { typeof(FireCorruptDisks) })]
	internal class VoidFiendFireCorruptDiskSkillModifier : SimpleSkillModifier<FireCorruptDisks>
	{
		public override void OnSkillEnter(FireCorruptDisks skillState, int level)
		{
			Logger.Debug("FireCorruptDisks");
		}
	}
	[SkillLevelModifier("VoidBlinkUp", new Type[] { typeof(VoidBlinkUp) })]
	internal class VoidFiendVoidBlinkUpSkillModifier : SimpleSkillModifier<VoidBlinkUp>
	{
		public override void OnSkillEnter(VoidBlinkUp skillState, int level)
		{
			Logger.Debug("VoidBlinkUp");
		}
	}
	[SkillLevelModifier("VoidBlinkDown", new Type[] { typeof(VoidBlinkDown) })]
	internal class VoidFiendVoidBlinkDownSkillModifier : SimpleSkillModifier<VoidBlinkDown>
	{
		public override void OnSkillEnter(VoidBlinkDown skillState, int level)
		{
			Logger.Debug("VoidBlinkDown");
		}
	}
	[SkillLevelModifier("CrushCorruption", new Type[]
	{
		typeof(CrushCorruption),
		typeof(ChargeCrushCorruption)
	})]
	internal class VoidFiendCrushCorruptionSkillModifier : BaseSkillModifier
	{
		public override void OnSkillEnter(BaseState skillState, int level)
		{
			if (skillState is CrushCorruption)
			{
				Logger.Debug("CrushCorruption");
			}
			else if (skillState is ChargeCrushCorruption)
			{
				Logger.Debug("ChargeCrushCorruption");
			}
		}
	}
	[SkillLevelModifier("CrushHealth", new Type[]
	{
		typeof(CrushHealth),
		typeof(ChargeCrushHealth)
	})]
	internal class VoidFiendCrushHealthSkillModifier : BaseSkillModifier
	{
		public override void OnSkillEnter(BaseState skillState, int level)
		{
			if (skillState is CrushHealth)
			{
				Logger.Debug("CrushHealth");
			}
			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);
			_ = skillState is ChargeIcebomb;
			ThrowIcebomb val = (ThrowIcebomb)(object)((skillState is ThrowIcebomb) ? skillState : null);
			if (val != null)
			{
				((BaseThrowBombState)val).minDamageCoefficient = BaseSkillModifier.MultScaling(((BaseThrowBombState)val).minDamageCoefficient, 0.2f, level);
				((BaseThrowBombState)val).maxDamageCoefficient = BaseSkillModifier.MultScaling(((BaseThrowBombState)val).maxDamageCoefficient, 0.2f, level);
				((BaseThrowBombState)val).force = BaseSkillModifier.MultScaling(((BaseThrowBombState)val).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_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			base.OnSkillLeveledUp(level, characterBody, skillDef);
			Logger.Debug("baseDuration: {0}, damageCoefficient: {1}", PrepWall.baseDuration, PrepWall.damageCoefficient);
			PrepWall.damageCoefficient = BaseSkillModifier.AdditiveScaling(1f, 0.3f, level);
			ProjectileCharacterController val = default(ProjectileCharacterController);
			if (PrepWall.projectilePrefab.TryGetComponent<ProjectileCharacterController>(ref val))
			{
				val.lifetime = BaseSkillModifier.MultScaling(0.3f, 0.15f, level);
				Logger.Debug("projectileCharacterController.lifetime: {0}", val.lifetime);
			}
			float num = BaseSkillModifier.MultScaling(23.69f, 0.2f, level);
			PrepWall.areaIndicatorPrefab.transform.localScale = new Vector3(num, PrepWall.areaIndicatorPrefab.transform.localScale.y, PrepWall.areaIndicatorPrefab.transform.localScale.z);
			Logger.Debug("baseDuration: {0}, damageCoefficient: {1}", PrepWall.baseDuration, PrepWall.damageCoefficient);
		}
	}
	[SkillLevelModifier(new string[] { "MageBodyFlamethrower", "Dragon's Breath" }, new Type[] { typeof(Flamethrower) })]
	internal class MageFlamethrowerSkillModifier : SimpleSkillModifier<Flamethrower>
	{
		private float baseRadius = 2f;

		public override void OnSkillEnter(Flamethrower skillState, int level)
		{
			//IL_003a: 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)
			base.OnSkillEnter(skillState, level);
			Logger.Debug(skillState.maxDistance);
			skillState.maxDistance = BaseSkillModifier.MultScaling(skillState.maxDistance, 0.2f, level);
			Logger.Debug(skillState.flamethrowerEffectPrefab.transform.localScale);
			skillState.flamethrowerEffectPrefab.transform.localScale = new Vector3(Flamethrower.radius, Flamethrower.radius, (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 - baseFlamethrowerDuration: {0}, totalDamageCoefficient: {1}, radius: {2}", Flamethrower.baseFlamethrowerDuration, Flamethrower.totalDamageCoefficient, Flamethrower.radius);
			Flamethrower.radius = BaseSkillModifier.MultScaling(baseRadius, 0.25f, level);
			Flamethrower.totalDamageCoefficient = BaseSkillModifier.MultScaling(20f, 0.2f, level);
			Logger.Debug("Flamethrower stats - baseFlamethrowerDuration: {0}, totalDamageCoefficient: {1}, radius: {2}", Flamethrower.baseFlamethrowerDuration, Flamethrower.totalDamageCoefficient, Flamethrower.radius);
		}
	}
	[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 override void OnSkillEnter(Bandit2FireRifle skillState, int level)
		{
			base.OnSkillEnter(skillState, level);
			if (Mathf.Abs(baseBloom) < 0.01f)
			{
				baseBloom = ((GenericBulletBaseState)skillState).spreadBloomValue;
			}
			if (level > 0)
			{
				((GenericBulletBaseState)skillState).procCoefficient = BaseSkillModifier.AdditiveScaling(((GenericBulletBaseState)skillState).procCoefficient, 0.1f, level);
				((GenericBulletBaseState)skillState).damageCoefficient = BaseSkillModifier.MultScaling(((GenericBulletBaseState)skillState).damageCoefficient, 0.2f, level);
				((GenericBulletBaseState)skillState).spreadBloomValue = baseBloom * (4f / ((float)level + 4f));
			}
		}
	}
	[SkillLevelModifier("SlashBlade", new Type[] { typeof(SlashBlade) })]
	internal class BanditBladeSkillModifier : SimpleSkillModifier<SlashBlade>
	{
		private Vector3 originalHitboxScale = Vector3.zero;

		public override void OnSkillEnter(SlashBlade slash, int level)
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			((BasicMeleeAttack)slash).swingEffectPrefab.transform.localScale = new Vector3((float)(1 + level), (float)(1 + level), (float)(1 + level));
			base.OnSkillEnter(slash, level);
			((BasicMeleeAttack)slash).damageCoefficient = BaseSkillModifier.MultScaling(((BasicMeleeAttack)slash).damageCoefficient, 0.2f, level);
		}

		public override void OnSkillLeveledUp(int level, CharacterBody characterBody, SkillDef skillDef)
		{
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			base.OnSkillLeveledUp(level, characterBody, skillDef);
			HitBoxGroup component = ((Component)characterBody.modelLocator.modelTransform).GetComponent<HitBoxGroup>();
			if ((Object)(object)component == (Object)null || component.groupName != "SlashBlade")
			{
				Debug.LogWarning((object)"didn't get Bandit's slashHitbox. probably got changed?. aborting");
				return;
			}
			Transform transform = ((Component)component.hitBoxes[0]).transform;
			if (originalHitboxScale == Vector3.zero)
			{
				originalHitboxScale = transform.localScale;
			}
			transform.localScale = new Vector3(BaseSkillModifier.MultScaling(originalHitboxScale.x, 0.2f, level), BaseSkillModifier.MultScaling(originalHitboxScale.y, 0.2f, level), BaseSkillModifier.MultScaling(originalHitboxScale.z, 0.3f, level));
		}
	}
	[SkillLevelModifier("Bandit2SerratedShivs", new Type[] { typeof(Bandit2FireShiv) })]
	internal class BanditFireShivSkillModifier : SimpleSkillModifier<Bandit2FireShiv>
	{
		public override void OnSkillEnter(Bandit2FireShiv skillState, int level)
		{
			base.OnSkillEnter(skillState, level);
			skillState.maxShivCount = 1 + level / 2;
			skillState.baseDuration += skillState.baseDuration * (float)(level / 2) * 0.5f;
			skillState.damageCoefficient = BaseSkillModifier.MultScaling(skillState.damageCoefficient, 0.1f, level);
		}

		public override void OnSkillLeveledUp(int level, CharacterBody characterBody, SkillDef skillDef)
		{
			base.OnSkillLeveledUp(level, characterBody, skillDef);
		}
	}
	[SkillLevelModifier("ThrowSmokebomb", new Type[] { typeof(ThrowSmokebomb) })]
	internal class BanditSkillThrowSmokebombModifier : SimpleSkillModifier<ThrowSmokebomb>
	{
		private static float baseRadius;

		private static float baseDamage;

		private static BuffDef BanditSpeedBuff;

		public static void RegisterBanditSpeedBuff()
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			BuffDef obj = ScriptableObject.CreateInstance<BuffDef>();
			obj.buffColor = new Color(0.6f, 0.11f, 0.59f);
			obj.buffIndex = (BuffIndex)63;
			obj.canStack = true;
			obj.eliteDef = null;
			obj.iconSprite = Addressables.LoadAssetAsync<BuffDef>((object)"RoR2/Base/Bandit2/bdCloakSpeed.asset").WaitForCompletion().iconSprite;
			obj.isDebuff = false;
			((Object)obj).name = "BanditSpeedBuff";
			BanditSpeedBuff = obj;
			ContentAddition.AddBuffDef(obj);
		}

		public override void OnSkillEnter(ThrowSmokebomb skillState, int level)
		{
			base.OnSkillEnter(skillState, level);
			for (int i = 0; i < level; i++)
			{
				((EntityState)skillState).outer.commonComponents.characterBody.AddTimedBuff(BanditSpeedBuff, StealthMode.duration);
			}
		}

		public override void OnSkillLeveledUp(int level, CharacterBody characterBody, SkillDef skillDef)
		{
			if (Mathf.Abs(baseRadius - 0f) < 0.1f)
			{
				baseRadius = StealthMode.blastAttackRadius;
				baseDamage = StealthMode.blastAttackDamageCoefficient;
			}
			StealthMode.blastAttackRadius = BaseSkillModifier.MultScaling(baseRadius, 0.15f, level);
			StealthMode.blastAttackDamageCoefficient = BaseSkillModifier.MultScaling(baseDamage, 0.2f, level);
		}

		public static void RecalculateStats(CharacterBody sender, StatHookEventArgs args)
		{
			if (Object.op_Implicit((Object)(object)sender) && sender.HasBuff(BanditSpeedBuff))
			{
				args.baseMoveSpeedAdd += (float)sender.GetBuffCount(BanditSpeedBuff);
			}
		}

		public override void SetupSkill()
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			base.SetupSkill();
			RegisterBanditSpeedBuff();
			RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(RecalculateStats);
		}
	}
	[SkillLevelModifier("ResetRevolver", new Type[] { typeof(FireSidearmResetRevolver) })]
	internal class BanditSkillResetRevolverModifier : SimpleSkillModifier<FireSidearmResetRevolver>
	{
		private static SkillUpgrade resetSkill;

		public override void OnSkillEnter(FireSidearmResetRevolver skillState, int level)
		{
			base.OnSkillEnter(skillState, level);
		}

		public override void OnSkillLeveledUp(int level, CharacterBody characterBody, SkillDef skillDef)
		{
			base.OnSkillLeveledUp(level, characterBody, skillDef);
			if (!Object.op_Implicit((Object)(object)resetSkill))
			{
				resetSkill = registeredSkill;
			}
		}

		public static void HealthComponent_TakeDamage(orig_TakeDamage orig, HealthComponent self, DamageInfo di)
		{
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Invalid comparison between Unknown and I4
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Invalid comparison between Unknown and I4
			if ((Object)(object)resetSkill != (Object)null && (Object)(object)di.attacker != (Object)null && (Object)(object)self != (Object)null && (Object)(object)((Component)self).GetComponent<CharacterBody>() != (Object)null && (int)DamageTypeCombo.op_Implicit(di.damageType & DamageTypeCombo.op_Implicit((DamageType)524288)) == 524288 && (int)DamageTypeCombo.op_Implicit(di.damageType & DamageTypeCombo.op_Implicit((DamageType)4)) == 4)
			{
				di.damage *= Mathf.Lerp(1f + (float)resetSkill.skillLevel * 0.3f, 1f + (float)resetSkill.skillLevel * 0.1f, self.combinedHealthFraction);
			}
			orig.Invoke(self, di);
		}

		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();
			HealthComponent.TakeDamage += new hook_TakeDamage(HealthComponent_TakeDamage);
		}
	}
	[SkillLevelModifier("SkullRevolver", new Type[] { typeof(FireSidearmSkullRevolver) })]
	internal class BanditSkillSkullRevolverModifier : SimpleSkillModifier<FireSidearmSkullRevolver>
	{
		private static SkillUpgrade revolverSkill;

		public override void OnSkillLeveledUp(int level, CharacterBody characterBody, SkillDef skillDef)
		{
			base.OnSkillLeveledUp(level, characterBody, skillDef);
			if (!Object.op_Implicit((Object)(object)revolverSkill))
			{
				revolverSkill = registeredSkill;
			}
		}

		public override void OnSkillEnter(FireSidearmSkullRevolver skillState, int level)
		{
			base.OnSkillEnter(skillState, level);
		}

		public static void HealthComponent_TakeDamage(orig_TakeDamage orig, HealthComponent self, DamageInfo di)
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Invalid comparison between Unknown and I4
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)revolverSkill != (Object)null && di != null && (Object)(object)self != (Object)null && (int)DamageTypeCombo.op_Implicit(di.damageType & DamageTypeCombo.op_Implicit((DamageType)268435456)) == 268435456)
			{
				float num = self.combinedHealth - di.damage;
				if (num / self.fullCombinedHealth < (float)revolverSkill.skillLevel * 0.01f && num > 0f)
				{
					di.damage += num;
					di.damageType |= DamageTypeCombo.op_Implicit((DamageType)2);
				}
			}
			orig.Invoke(self, di);
		}

		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();
			HealthComponent.TakeDamage += new hook_TakeDamage(HealthComponent_TakeDamage);
		}
	}
	[SkillLevelModifier("CaptainShotgun", new Type[]
	{
		typeof(FireCaptainShotgun),
		typeof(ChargeCaptainShotgun)
	})]
	internal class CaptainShotgunSkillModifier : BaseSkillModifier
	{
		public override void OnSkillEnter(BaseState skillState, int level)
		{
			base.OnSkillEnter(skillState, level);
			FireCaptainShotgun val = (FireCaptainShotgun)(object)((skillState is FireCaptainShotgun) ? skillState : null);
			if (val != null)
			{
				((GenericBulletBaseState)val).bulletCount = (int)BaseSkillModifier.MultScaling(((GenericBulletBaseState)val).bulletCount, 0.2f, level);
				((GenericBulletBaseState)val).damageCoefficient = BaseSkillModifier.MultScaling(((GenericBulletBaseState)val).damageCoefficient, 0.1f, level);
			}
		}
	}
	[SkillLevelModifier("CaptainTazer", new Type[] { typeof(FireTazer) })]
	internal class CaptainTaserSkillModifier : SimpleSkillModifier<FireTazer>
	{
		public override void OnSkillEnter(FireTazer skillState, int level)
		{
			base.OnSkillEnter(skillState, level);
		}

		public override void OnSkillLeveledUp(int level, CharacterBody characterBody, SkillDef skillDef)
		{
			base.OnSkillLeveledUp(level, characterBody, skillDef);
			ProjectileImpactExplosion val = default(ProjectileImpactExplosion);
			if (FireTazer.projectilePrefab.TryGetComponent<ProjectileImpactExplosion>(ref val))
			{
				((ProjectileExplosion)val).blastRadius = BaseSkillModifier.MultScaling(2f, 0.4f, level);
				((ProjectileExplosion)val).blastDamageCoefficient = BaseSkillModifier.MultScaling(1f, 0.2f, level);
			}
		}
	}
	[SkillLevelModifier(new string[] { "PrepAirstrike", "21-Probe Salute" }, new Type[]
	{
		typeof(CallAirstrike1),
		typeof(CallAirstrike2),
		typeof(CallAirstrike3)
	})]
	internal class CaptainAirstrikeSkillModifier : SimpleSkillModifier<CallAirstrikeBase>
	{
		public override void OnSkillEnter(CallAirstrikeBase skillState, int level)
		{
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			base.OnSkillEnter(skillState, level);
			float num = BaseSkillModifier.MultScaling(8f, 0.2f, level);
			ProjectileImpactExplosion val = default(ProjectileImpactExplosion);
			if (((AimThrowableBase)skillState).projectilePrefab.TryGetComponent<ProjectileImpactExplosion>(ref val))
			{
				((ProjectileExplosion)val).blastRadius = num;
				((ProjectileExplosion)val).blastDamageCoefficient = BaseSkillModifier.MultScaling(1f, 0.2f, level);
			}
			ProjectileController val2 = default(ProjectileController);
			if (((AimThrowableBase)skillState).projectilePrefab.TryGetComponent<ProjectileController>(ref val2))
			{
				Transform val3 = val2.ghostPrefab.transform.Find("Expander");
				if ((Object)(object)val3 != (Object)null)
				{
					val3.localScale = Vector3.one * num;
				}
			}
		}
	}
	[SkillLevelModifier(new string[] { "PrepAirstrikeAlt" }, new Type[]
	{
		typeof(CallAirstrikeAlt),
		typeof(SetupAirstrikeAlt)
	})]
	internal class CaptainDiabloStrikeSkillModifier : BaseSkillModifier
	{
		private static int diabloStrikeProjectileCatalogIndex = -1337;

		private static float fuseDuration;

		private static SkillUpgrade diabloSkill;

		public override void OnSkillLeveledUp(int level, CharacterBody characterBody, SkillDef skillDef)
		{
			base.OnSkillLeveledUp(level, characterBody, skillDef);
			if (!Object.op_Implicit((Object)(object)diabloSkill))
			{
				diabloSkill = registeredSkill;
			}
			fuseDuration = Mathf.Clamp(20f - (float)level, 0f, 20f);
		}

		public override void OnSkillEnter(BaseState skillState, int level)
		{
			base.OnSkillEnter(skillState, level);
			CallAirstrikeAlt val = (CallAirstrikeAlt)(object)((skillState is CallAirstrikeAlt) ? skillState : null);
			ProjectileController val2 = default(ProjectileController);
			if (val == null || !((AimThrowableBase)val).projectilePrefab.TryGetComponent<ProjectileController>(ref val2) || !((Object)(object)registeredSkill != (Object)null))
			{
				return;
			}
			Transform val3 = val2.ghostPrefab.transform.Find("AreaIndicatorCenter");
			if (!((Object)(object)val3 != (Object)null))
			{
				return;
			}
			ObjectScaleCurve val4 = default(ObjectScaleCurve);
			ObjectTransformCurve val7 = default(ObjectTransformCurve);
			for (int i = 0; i < val3.childCount; i++)
			{
				Transform child = val3.GetChild(i);
				if (!((Object)(object)child != (Object)null) || !((Object)(object)((Component)child).gameObject != (Object)null))
				{
					continue;
				}
				if (((Component)child).TryGetComponent<ObjectScaleCurve>(ref val4))
				{
					val4.timeMax = fuseDuration;
					continue;
				}
				Transform val5 = child.Find("LaserVerticalOffset");
				if (Object.op_Implicit((Object)(object)val5))
				{
					Transform val6 = val5.Find("Laser");
					if (Object.op_Implicit((Object)(object)val6) && (Object)(object)val6 != (Object)null && ((Component)val6).gameObject.TryGetComponent<ObjectTransformCurve>(ref val7))
					{
						val7.timeMax = fuseDuration;
					}
				}
			}
		}

		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
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Expected O, but got Unknown
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Expected O, but got Unknown
			RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(RecalculateStats);
			AimThrowableBase.ModifyProjectile += new hook_ModifyProjectile(AimThrowableBase_ModifyProjectile);
			HealthComponent.TakeDamage += new hook_TakeDamage(HealthComponent_TakeDamage);
			base.SetupSkill();
		}

		private void RecalculateStats(CharacterBody sender, StatHookEventArgs args)
		{
			if (Object.op_Implicit((Object)(object)sender) && Object.op_Implicit((Object)(object)diabloSkill) && (Object)(object)sender == (Object)(object)PlayerCharacterMasterController.instances[0].master.GetBody())
			{
				args.utilityCooldownMultAdd -= 1f - 5f / ((float)diabloSkill.skillLevel + 5f);
			}
		}

		public static void AimThrowableBase_ModifyProjectile(orig_ModifyProjectile orig, AimThrowableBase self, ref FireProjectileInfo fireProjectileInfo)
		{
			orig.Invoke(self, ref fireProjectileInfo);
			if (self is CallAirstrikeAlt && (Object)(object)diabloSkill != (Object)null)
			{
				fireProjectileInfo.useFuseOverride = true;
				((FireProjectileInfo)(ref fireProjectileInfo)).fuseOverride = fuseDuration;
			}
		}

		public static void HealthComponent_TakeDamage(orig_TakeDamage orig, HealthComponent self, DamageInfo di)
		{
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_018c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0192: Unknown result type (might be due to invalid IL or missing references)
			//IL_0197: Unknown result type (might be due to invalid IL or missing references)
			//IL_019c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)diabloSkill != (Object)null && di != null && (Object)(object)self != (Object)null)
			{
				if (diabloStrikeProjectileCatalogIndex == -1337)
				{
					diabloStrikeProjectileCatalogIndex = ProjectileCatalog.FindProjectileIndex("CaptainAirstrikeAltProjectile");
				}
				ProjectileController val = default(ProjectileController);
				CharacterBody val2 = default(CharacterBody);
				if (Object.op_Implicit((Object)(object)di.inflictor) && di.inflictor.TryGetComponent<ProjectileController>(ref val) && val.catalogIndex == diabloStrikeProjectileCatalogIndex && Object.op_Implicit((Object)(object)di.attacker) && di.attacker.TryGetComponent<CharacterBody>(ref val2))
				{
					TeamIndex? obj;
					if (self == null)
					{
						obj = null;
					}
					else
					{
						CharacterBody body = self.body;
						if (body == null)
						{
							obj = null;
						}
						else
						{
							TeamComponent teamComponent = body.teamComponent;
							obj = ((teamComponent != null) ? new TeamIndex?(teamComponent.teamIndex) : null);
						}
					}
					TeamIndex? val3 = obj;
					TeamIndex? obj2;
					if (val2 == null)
					{
						obj2 = null;
					}
					else
					{
						TeamComponent teamComponent2 = val2.teamComponent;
						obj2 = ((teamComponent2 != null) ? new TeamIndex?(teamComponent2.teamIndex) : null);
					}
					if (val3 == obj2 && diabloSkill.skillLevel > 0)
					{
						float num = 25f / ((float)diabloSkill.skillLevel + 25f);
						if (self.combinedHealthFraction > num)
						{
							di.damage = (self.combinedHealth - (float)diabloSkill.skillLevel * 0.04f * self.fullCombinedHealth) * 2f;
							di.damageType |= DamageTypeCombo.op_Implicit((DamageType)2);
							di.damageType &= DamageTypeCombo.op_Implicit((DamageType)(-131073));
						}
					}
				}
			}
			orig.Invoke(self, di);
		}
	}
	[SkillLevelModifier(new string[] { "PrepSupplyDrop" }, new Type[]
	{
		typeof(SetupSupplyDrop),
		typeof(DeployState),
		typeof(HealZoneMainState),
		typeof(ShockZoneMainState),
		typeof(HackingMainState),
		typeof(HackingInProgressState),
		typeof(EquipmentRestockMainState)
	})]
	internal class CaptainSupplyDropHealingSkillModifier : BaseSkillModifier
	{
		public override void OnSkillEnter(BaseState skillState, int level)
		{
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			base.OnSkillEnter(skillState, level);
			DeployState val = (DeployState)(object)((skillState is DeployState) ? skillState : null);
			if (val != null)
			{
				ModelLocator val2 = ((EntityState)val).outer?.commonComponents.modelLocator;
				if ((Object)(object)val2 != (Object)null)
				{
					Transform modelTransform = va