Decompiled source of Skills Hot Swapper v2.0.3

plugins/SkillHotSwapper.dll

Decompiled 2 weeks ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using HG.Reflection;
using Microsoft.CodeAnalysis;
using On.RoR2;
using R2API;
using RiskOfOptions;
using RiskOfOptions.Options;
using RoR2;
using RoR2.Skills;
using RoR2.UI;
using TMPro;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.Networking;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: OptIn]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("SkillHotSwapper")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("SkillHotSwapper")]
[assembly: AssemblyTitle("SkillHotSwapper")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
[module: UnverifiableCode]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace SkillPicker
{
	[Serializable]
	[BepInPlugin("com.brynzananas.skillhotswapper", "Skill Hot Swapper", "2.0.3")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Main : BaseUnityPlugin
	{
		public class RadialLayout : LayoutGroup
		{
			public float fDistance;

			[Range(0f, 360f)]
			public float MinAngle;

			[Range(0f, 360f)]
			public float MaxAngle;

			[Range(0f, 360f)]
			public float StartAngle;

			public bool OnlyLayoutVisible = false;

			public override void OnEnable()
			{
				((LayoutGroup)this).OnEnable();
				CalculateRadial();
			}

			public override void SetLayoutHorizontal()
			{
			}

			public override void SetLayoutVertical()
			{
			}

			public override void CalculateLayoutInputVertical()
			{
				CalculateRadial();
			}

			public override void CalculateLayoutInputHorizontal()
			{
				CalculateRadial();
			}

			public override void OnDisable()
			{
				((DrivenRectTransformTracker)(ref base.m_Tracker)).Clear();
				LayoutRebuilder.MarkLayoutForRebuild(((LayoutGroup)this).rectTransform);
			}

			private void CalculateRadial()
			{
				//IL_0046: Unknown result type (might be due to invalid IL or missing references)
				//IL_004d: Expected O, but got Unknown
				//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d2: Expected O, but got Unknown
				//IL_013a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0142: Unknown result type (might be due to invalid IL or missing references)
				//IL_0164: Unknown result type (might be due to invalid IL or missing references)
				//IL_016c: Unknown result type (might be due to invalid IL or missing references)
				//IL_016e: Unknown result type (might be due to invalid IL or missing references)
				//IL_016f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0177: Unknown result type (might be due to invalid IL or missing references)
				((DrivenRectTransformTracker)(ref base.m_Tracker)).Clear();
				if (((Component)this).transform.childCount == 0)
				{
					return;
				}
				int num = 0;
				if (OnlyLayoutVisible)
				{
					for (int i = 0; i < ((Component)this).transform.childCount; i++)
					{
						RectTransform val = (RectTransform)((Component)this).transform.GetChild(i);
						if ((Object)(object)val != (Object)null && ((Component)val).gameObject.activeSelf)
						{
							num++;
						}
					}
				}
				else
				{
					num = ((Component)this).transform.childCount;
				}
				float num2 = (MaxAngle - MinAngle) / (float)num;
				float num3 = StartAngle;
				Vector3 val3 = default(Vector3);
				Vector2 val4 = default(Vector2);
				for (int j = 0; j < ((Component)this).transform.childCount; j++)
				{
					RectTransform val2 = (RectTransform)((Component)this).transform.GetChild(j);
					if ((Object)(object)val2 != (Object)null && (!OnlyLayoutVisible || ((Component)val2).gameObject.activeSelf))
					{
						((DrivenRectTransformTracker)(ref base.m_Tracker)).Add((Object)(object)this, val2, (DrivenTransformProperties)52998);
						((Vector3)(ref val3))..ctor(Mathf.Cos(num3 * (MathF.PI / 180f)), Mathf.Sin(num3 * (MathF.PI / 180f)), 0f);
						((Transform)val2).localPosition = val3 * fDistance;
						((Vector2)(ref val4))..ctor(0.5f, 0.5f);
						val2.pivot = val4;
						Vector2 anchorMin = (val2.anchorMax = val4);
						val2.anchorMin = anchorMin;
						num3 += num2;
					}
				}
			}
		}

		public class StupidThing : MonoBehaviour, IPointerEnterHandler, IEventSystemHandler, IPointerExitHandler
		{
			public SkillPickerComponent skillPickerComponent;

			public void OnPointerEnter(PointerEventData eventData)
			{
				skillPickerComponent.eventSystem.SetSelectedObject(((Component)this).gameObject);
			}

			public void OnPointerExit(PointerEventData eventData)
			{
				skillPickerComponent.eventSystem.SetSelectedObject((GameObject)null);
			}

			public void OnDisable()
			{
				skillPickerComponent.eventSystem.SetSelectedObject((GameObject)null);
			}
		}

		public class SkillPickerComponent : MonoBehaviour
		{
			public Dictionary<SkillInFamilyComponent, SkillFamilyComponent> SkillFamilies = new Dictionary<SkillInFamilyComponent, SkillFamilyComponent>();

			public List<SkillFamilyComponent> skillFamilyComponents = new List<SkillFamilyComponent>();

			public MPEventSystem eventSystem;

			public bool switchOff = false;

			public void OnDestroy()
			{
				if (Object.op_Implicit((Object)(object)eventSystem) && switchOff)
				{
					MPEventSystem obj = eventSystem;
					int cursorOpenerCount = obj.cursorOpenerCount;
					obj.cursorOpenerCount = cursorOpenerCount - 1;
					MPEventSystem obj2 = eventSystem;
					cursorOpenerCount = obj2.cursorOpenerForGamepadCount;
					obj2.cursorOpenerForGamepadCount = cursorOpenerCount - 1;
					switchOff = false;
				}
			}
		}

		public class SkillFamilyComponent : MonoBehaviour
		{
			public SkillPickerComponent skillPickerComponent;

			public Dictionary<SkillDef, GameObject> Skills = new Dictionary<SkillDef, GameObject>();

			public List<SkillComponent> skillComponents = new List<SkillComponent>();
		}

		public class SkillInFamilyComponent : MonoBehaviour, IPointerClickHandler, IEventSystemHandler, IPointerEnterHandler, IPointerExitHandler
		{
			public SkillPickerComponent skillPickerComponent;

			public SkillFamilyComponent skillFamilyComponent;

			public Image ownImage;

			public Image skillImage;

			public void Awake()
			{
				ownImage = ((Component)this).GetComponent<Image>();
			}

			public void OnPointerClick(PointerEventData eventData)
			{
				foreach (SkillFamilyComponent skillFamilyComponent in skillPickerComponent.skillFamilyComponents)
				{
					((Component)skillFamilyComponent).gameObject.SetActive(false);
				}
				((Component)this.skillFamilyComponent).gameObject.SetActive(true);
				((Component)((Component)this).transform.parent).gameObject.SetActive(false);
			}

			public void OnPointerEnter(PointerEventData eventData)
			{
				//IL_0016: Unknown result type (might be due to invalid IL or missing references)
				//IL_0027: Unknown result type (might be due to invalid IL or missing references)
				((Component)this).transform.localScale = new Vector3(1.1f, 1.1f, 1.1f);
				((Graphic)ownImage).color = activeColor;
				skillPickerComponent.eventSystem.SetSelectedObject(((Component)this).gameObject);
			}

			public void OnPointerExit(PointerEventData eventData)
			{
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				//IL_0018: Unknown result type (might be due to invalid IL or missing references)
				((Component)this).transform.localScale = Vector3.one;
				((Graphic)ownImage).color = Color.white;
				skillPickerComponent.eventSystem.SetSelectedObject((GameObject)null);
			}

			public void OnDisable()
			{
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				//IL_0018: Unknown result type (might be due to invalid IL or missing references)
				((Component)this).transform.localScale = Vector3.one;
				((Graphic)ownImage).color = Color.white;
				skillPickerComponent.eventSystem.SetSelectedObject((GameObject)null);
			}
		}

		public class SkillComponent : MonoBehaviour, IPointerClickHandler, IEventSystemHandler, IPointerEnterHandler, IPointerExitHandler
		{
			public SkillFamilyComponent skillFamilyComponent;

			public SkillInFamilyComponent skillInFamilyComponent;

			public GenericSkill genericSkill;

			public SkillDef skillDef;

			public void OnPointerClick(PointerEventData eventData)
			{
				bool flag = false;
				if ((Object)(object)genericSkill.baseSkill == (Object)(object)skillDef)
				{
					flag = true;
				}
				genericSkill.baseSkill = skillDef;
				skillInFamilyComponent.skillImage.sprite = skillDef.icon;
				if (!flag && genericSkill.skillOverrides.Count() <= 0)
				{
					genericSkill.SetSkillInternal(skillDef);
					genericSkill.stock = 0;
					genericSkill.rechargeStopwatch = 0f;
				}
				foreach (SkillFamilyComponent skillFamilyComponent in skillFamilyComponent.skillPickerComponent.skillFamilyComponents)
				{
					((Component)skillFamilyComponent).gameObject.SetActive(false);
				}
				((Component)((Component)this.skillFamilyComponent.skillPickerComponent).transform.GetChild(1)).gameObject.SetActive(true);
				((Component)this.skillFamilyComponent.skillPickerComponent).gameObject.SetActive(false);
				if (Object.op_Implicit((Object)(object)this.skillFamilyComponent.skillPickerComponent.eventSystem))
				{
					MPEventSystem eventSystem = this.skillFamilyComponent.skillPickerComponent.eventSystem;
					int cursorOpenerCount = eventSystem.cursorOpenerCount;
					eventSystem.cursorOpenerCount = cursorOpenerCount - 1;
					MPEventSystem eventSystem2 = this.skillFamilyComponent.skillPickerComponent.eventSystem;
					cursorOpenerCount = eventSystem2.cursorOpenerForGamepadCount;
					eventSystem2.cursorOpenerForGamepadCount = cursorOpenerCount - 1;
				}
				((Component)this.skillFamilyComponent.skillPickerComponent).GetComponent<SkillPickerComponent>().switchOff = false;
			}

			public void OnPointerEnter(PointerEventData eventData)
			{
				//IL_0016: Unknown result type (might be due to invalid IL or missing references)
				((Component)this).transform.localScale = new Vector3(1.1f, 1.1f, 1.1f);
				skillInFamilyComponent.skillPickerComponent.eventSystem.SetSelectedObject(((Component)this).gameObject);
			}

			public void OnPointerExit(PointerEventData eventData)
			{
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				((Component)this).transform.localScale = Vector3.one;
				skillInFamilyComponent.skillPickerComponent.eventSystem.SetSelectedObject((GameObject)null);
			}

			public void OnDisable()
			{
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				((Component)this).transform.localScale = Vector3.one;
				skillInFamilyComponent.skillPickerComponent.eventSystem.SetSelectedObject((GameObject)null);
			}
		}

		public const string ModGuid = "com.brynzananas.skillhotswapper";

		public const string ModName = "Skill Hot Swapper";

		public const string ModVer = "2.0.3";

		private static bool emotesEnabled;

		public static AssetBundle Assets;

		public static GameObject SkillPicker;

		public static GameObject SkillFamily;

		public static GameObject SkillInFamily;

		public static GameObject Skill;

		public static ConfigEntry<KeyboardShortcut> OpenCloseKey;

		public static Color activeColor = new Color(1f, 8f, 0f);

		public MPEventSystem eventSystem;

		public GameObject hud;

		public GameObject currentSkillPicker;

		public static PluginInfo PInfo { get; private set; }

		public static bool isSKillsApiEnabled { get; private set; }

		public void Awake()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c0: Expected O, but got Unknown
			//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d2: Expected O, but got Unknown
			//IL_01da: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e4: Expected O, but got Unknown
			PInfo = ((BaseUnityPlugin)this).Info;
			OpenCloseKey = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("General", "Open/Close", new KeyboardShortcut((KeyCode)107, Array.Empty<KeyCode>()), "Key open/close skill hotswapper");
			Assets = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(PInfo.Location), "assetbundles", "skillpicker"));
			SkillPicker = Assets.LoadAsset<GameObject>("Assets/SkillPicker/SkillPicker.prefab");
			SkillPicker.AddComponent<SkillPickerComponent>();
			RadialLayout radialLayout = ((Component)SkillPicker.transform.GetChild(1)).gameObject.AddComponent<RadialLayout>();
			radialLayout.fDistance = 64f;
			radialLayout.MaxAngle = 360f;
			radialLayout.StartAngle = 90f;
			((Component)SkillPicker.transform.GetChild(0)).gameObject.AddComponent<StupidThing>();
			((Component)SkillPicker.transform.GetChild(0)).gameObject.AddComponent<UIInputPassthrough>().OnlyAllowMovement = true;
			SkillFamily = Assets.LoadAsset<GameObject>("Assets/SkillPicker/SkillFamily.prefab");
			SkillFamily.AddComponent<SkillFamilyComponent>();
			radialLayout = ((Component)SkillFamily.transform.GetChild(0)).gameObject.AddComponent<RadialLayout>();
			radialLayout.fDistance = 64f;
			radialLayout.MaxAngle = 360f;
			radialLayout.StartAngle = 90f;
			SkillInFamily = Assets.LoadAsset<GameObject>("Assets/SkillPicker/SkillInFamily.prefab");
			SkillInFamily.AddComponent<SkillInFamilyComponent>();
			SkillInFamily.AddComponent<UIInputPassthrough>().OnlyAllowMovement = true;
			Skill = Assets.LoadAsset<GameObject>("Assets/SkillPicker/Skill.prefab");
			Skill.AddComponent<SkillComponent>();
			Skill.AddComponent<UIInputPassthrough>().OnlyAllowMovement = true;
			PlayerCharacterMasterController.OnBodyStart += new hook_OnBodyStart(PlayerCharacterMasterController_OnBodyStart);
			PlayerCharacterMasterController.Update += new hook_Update(PlayerCharacterMasterController_Update);
			PlayerCharacterMasterController.OnBodyDeath += new hook_OnBodyDeath(PlayerCharacterMasterController_OnBodyDeath);
			isSKillsApiEnabled = Chainloader.PluginInfos.ContainsKey("com.bepis.r2api.skills");
			if (Chainloader.PluginInfos.ContainsKey("com.rune580.riskofoptions"))
			{
				ModCompatabilities.RiskOfOptionsCompatability.Init();
			}
		}

		private void PlayerCharacterMasterController_OnBodyDeath(orig_OnBodyDeath orig, PlayerCharacterMasterController self)
		{
			orig.Invoke(self);
			if (Object.op_Implicit((Object)(object)currentSkillPicker))
			{
				Object.DestroyImmediate((Object)(object)currentSkillPicker);
			}
		}

		private void PlayerCharacterMasterController_Update(orig_Update orig, PlayerCharacterMasterController self)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(self);
			KeyboardShortcut value = OpenCloseKey.Value;
			if (Input.GetKeyDown(((KeyboardShortcut)(ref value)).MainKey) && Object.op_Implicit((Object)(object)currentSkillPicker))
			{
				if (currentSkillPicker.activeSelf)
				{
					currentSkillPicker.SetActive(false);
					currentSkillPicker.GetComponent<SkillPickerComponent>().switchOff = false;
					if (Object.op_Implicit((Object)(object)eventSystem))
					{
						MPEventSystem obj = eventSystem;
						int cursorOpenerCount = obj.cursorOpenerCount;
						obj.cursorOpenerCount = cursorOpenerCount - 1;
						MPEventSystem obj2 = eventSystem;
						cursorOpenerCount = obj2.cursorOpenerForGamepadCount;
						obj2.cursorOpenerForGamepadCount = cursorOpenerCount - 1;
					}
				}
				else
				{
					currentSkillPicker.SetActive(true);
					currentSkillPicker.GetComponent<SkillPickerComponent>().switchOff = true;
					if (Object.op_Implicit((Object)(object)eventSystem))
					{
						MPEventSystem obj3 = eventSystem;
						int cursorOpenerCount = obj3.cursorOpenerCount;
						obj3.cursorOpenerCount = cursorOpenerCount + 1;
						MPEventSystem obj4 = eventSystem;
						cursorOpenerCount = obj4.cursorOpenerForGamepadCount;
						obj4.cursorOpenerForGamepadCount = cursorOpenerCount + 1;
					}
				}
			}
			if (Input.GetKeyDown((KeyCode)27) && Object.op_Implicit((Object)(object)currentSkillPicker) && currentSkillPicker.activeSelf)
			{
				currentSkillPicker.SetActive(false);
				currentSkillPicker.GetComponent<SkillPickerComponent>().switchOff = false;
				if (Object.op_Implicit((Object)(object)eventSystem))
				{
					MPEventSystem obj5 = eventSystem;
					int cursorOpenerCount = obj5.cursorOpenerCount;
					obj5.cursorOpenerCount = cursorOpenerCount - 1;
					MPEventSystem obj6 = eventSystem;
					cursorOpenerCount = obj6.cursorOpenerForGamepadCount;
					obj6.cursorOpenerForGamepadCount = cursorOpenerCount - 1;
				}
			}
		}

		private void PlayerCharacterMasterController_OnBodyStart(orig_OnBodyStart orig, PlayerCharacterMasterController self)
		{
			//IL_0517: Unknown result type (might be due to invalid IL or missing references)
			//IL_0299: Unknown result type (might be due to invalid IL or missing references)
			//IL_029e: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ed: Expected I4, but got Unknown
			//IL_03c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0402: Unknown result type (might be due to invalid IL or missing references)
			//IL_041f: Unknown result type (might be due to invalid IL or missing references)
			//IL_046b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0493: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(self);
			if (!((NetworkBehaviour)self).hasAuthority || !Object.op_Implicit((Object)(object)self.master))
			{
				return;
			}
			CharacterBody body = self.master.GetBody();
			if ((Object)(object)body == (Object)null)
			{
				return;
			}
			NetworkUser networkUser = self.networkUser;
			if (!Object.op_Implicit((Object)(object)networkUser))
			{
				return;
			}
			LocalUser localUser = networkUser.localUser;
			if (localUser == null)
			{
				return;
			}
			eventSystem = localUser.eventSystem;
			if ((Object)(object)eventSystem == (Object)null)
			{
				return;
			}
			CameraRigController cameraRigController = localUser.cameraRigController;
			if (!Object.op_Implicit((Object)(object)cameraRigController))
			{
				return;
			}
			HUD val = cameraRigController.hud;
			if ((Object)(object)val == (Object)null)
			{
				return;
			}
			hud = ((Component)val).gameObject;
			if (Object.op_Implicit((Object)(object)currentSkillPicker))
			{
				Object.DestroyImmediate((Object)(object)currentSkillPicker);
			}
			currentSkillPicker = Object.Instantiate<GameObject>(SkillPicker, hud.transform.GetChild(0));
			StupidThing component = ((Component)currentSkillPicker.transform.Find("background")).gameObject.GetComponent<StupidThing>();
			SkillPickerComponent component2 = currentSkillPicker.GetComponent<SkillPickerComponent>();
			component2.eventSystem = eventSystem;
			component.skillPickerComponent = component2;
			SkillLocator skillLocator = body.skillLocator;
			if (!Object.op_Implicit((Object)(object)skillLocator))
			{
				return;
			}
			int num = 0;
			GenericSkill[] allSkills = skillLocator.allSkills;
			foreach (GenericSkill val2 in allSkills)
			{
				GameObject val3 = Object.Instantiate<GameObject>(SkillFamily, currentSkillPicker.transform);
				((Object)val3).name = "SkillFamily" + num;
				SkillFamilyComponent component3 = val3.GetComponent<SkillFamilyComponent>();
				component3.skillPickerComponent = component2;
				component2.skillFamilyComponents.Add(component3);
				GameObject val4 = Object.Instantiate<GameObject>(SkillInFamily, currentSkillPicker.transform.GetChild(1));
				Image component4 = ((Component)val4.transform.GetChild(0)).GetComponent<Image>();
				component4.sprite = val2.baseSkill.icon;
				TextMeshProUGUI component5 = ((Component)val4.transform.GetChild(1)).GetComponent<TextMeshProUGUI>();
				string text = null;
				if (isSKillsApiEnabled)
				{
					text = ModCompatabilities.SkillsApiCompatability.GetCustomToken(val2);
				}
				if (string.IsNullOrWhiteSpace(text))
				{
					text = val2.loadoutTitleToken;
					if (string.IsNullOrWhiteSpace(text))
					{
						SkillSlot val5 = skillLocator.FindSkillSlot(val2);
						SkillSlot val6 = val5;
						text = (val6 - -1) switch
						{
							0 => "LOADOUT_SKILL_MISC", 
							1 => "LOADOUT_SKILL_PRIMARY", 
							2 => "LOADOUT_SKILL_SECONDARY", 
							3 => "LOADOUT_SKILL_UTILITY", 
							4 => "LOADOUT_SKILL_SPECIAL", 
							12 => "EXTRA_SKILL_SLOTS_FIRST_EXTRA_SKILL", 
							13 => "EXTRA_SKILL_SLOTS_SECOND_EXTRA_SKILL", 
							14 => "EXTRA_SKILL_SLOTS_THIRD_EXTRA_SKILL", 
							15 => "EXTRA_SKILL_SLOTS_FOURTH_EXTRA_SKILL", 
							_ => "LOADOUT_SKILL_MISC", 
						};
					}
				}
				((TMP_Text)component5).text = Language.GetString(text);
				SkillInFamilyComponent component6 = val4.GetComponent<SkillInFamilyComponent>();
				component6.skillFamilyComponent = component3;
				component6.skillPickerComponent = component2;
				component6.skillImage = component4;
				SkillFamily skillFamily = val2.skillFamily;
				component2.SkillFamilies.Add(component6, component3);
				if ((Object)(object)skillFamily != (Object)null)
				{
					Variant[] variants = skillFamily.variants;
					foreach (Variant val7 in variants)
					{
						if (Object.op_Implicit((Object)(object)val7.skillDef))
						{
							GameObject val8 = Object.Instantiate<GameObject>(Skill, ((Component)val3.transform).transform.GetChild(0));
							((Object)val8).name = val7.skillDef.skillName;
							SkillComponent component7 = val8.GetComponent<SkillComponent>();
							component7.skillDef = val7.skillDef;
							component7.skillFamilyComponent = component3;
							component7.genericSkill = val2;
							component7.skillInFamilyComponent = component6;
							component3.skillComponents.Add(component7);
							Image component8 = ((Component)val8.transform.GetChild(0)).GetComponent<Image>();
							component8.sprite = val7.skillDef.icon;
							TextMeshProUGUI component9 = ((Component)val8.transform.GetChild(1)).GetComponent<TextMeshProUGUI>();
							((TMP_Text)component9).text = Language.GetString(val7.skillDef.skillNameToken);
							val8.SetActive(true);
						}
					}
				}
				val4.SetActive(true);
				val3.SetActive(false);
				num++;
			}
			currentSkillPicker.SetActive(false);
			currentSkillPicker.transform.localScale = new Vector3(2f, 2f, 2f);
		}
	}
	public static class ModCompatabilities
	{
		public static class RiskOfOptionsCompatability
		{
			public const string GUID = "com.rune580.riskofoptions";

			public static void Init()
			{
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				//IL_0010: Expected O, but got Unknown
				ModSettingsManager.AddOption((BaseOption)new KeyBindOption(Main.OpenCloseKey));
				ModSettingsManager.SetModIcon(Main.Assets.LoadAsset<Sprite>("Assets/SkillPicker/UltrakillWeaponWheel.png"));
			}

			public static void AddConfig<T>(T config) where T : ConfigEntryBase
			{
				//IL_001f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0029: Expected O, but got Unknown
				//IL_0049: Unknown result type (might be due to invalid IL or missing references)
				//IL_0053: Expected O, but got Unknown
				//IL_0073: Unknown result type (might be due to invalid IL or missing references)
				//IL_007d: Expected O, but got Unknown
				//IL_009d: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a7: Expected O, but got Unknown
				if (config is ConfigEntry<float>)
				{
					ModSettingsManager.AddOption((BaseOption)new FloatFieldOption(config as ConfigEntry<float>));
				}
				if (config is ConfigEntry<bool>)
				{
					ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(config as ConfigEntry<bool>));
				}
				if (config is ConfigEntry<int>)
				{
					ModSettingsManager.AddOption((BaseOption)new IntFieldOption(config as ConfigEntry<int>));
				}
				if (config is ConfigEntry<string>)
				{
					ModSettingsManager.AddOption((BaseOption)new StringInputFieldOption(config as ConfigEntry<string>));
				}
			}
		}

		public static class SkillsApiCompatability
		{
			public const string GUID = "com.bepis.r2api.skills";

			public static string GetCustomToken(GenericSkill genericSkill)
			{
				return SkillsAPI.GetLoadoutTitleTokenOverride(genericSkill);
			}
		}
	}
}