Decompiled source of Skill Upgrades Tree v1.0.0

patchers/SkillUpgradesTreePatcher.dll

Decompiled a day ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using Microsoft.CodeAnalysis;
using Mono.Cecil;
using UnityEngine;

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

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

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

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

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace SkillUpgradesTree
{
	public static class SkillUpgradesTreePatcher
	{
		public static IEnumerable<string> TargetDLLs
		{
			get
			{
				yield return "RoR2.dll";
			}
		}

		public static void Patch(AssemblyDefinition assembly)
		{
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Expected O, but got Unknown
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Expected O, but got Unknown
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Expected O, but got Unknown
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Expected O, but got Unknown
			TypeDefinition type = assembly.MainModule.GetType("RoR2.Loadout/BodyLoadoutManager/BodyInfo");
			TypeDefinition type2 = assembly.MainModule.GetType("RoR2.Loadout/BodyLoadoutManager/BodyLoadout");
			TypeDefinition type3 = assembly.MainModule.GetType("RoR2.SkillLocator");
			TypeDefinition type4 = assembly.MainModule.GetType("RoR2.UI.LoadoutPanelController");
			if (type != null)
			{
				type.Fields.Add(new FieldDefinition("sut_skillUpgrades", (FieldAttributes)6, assembly.MainModule.ImportReference(typeof(bool[]))));
			}
			if (type2 != null)
			{
				type2.Fields.Add(new FieldDefinition("sut_skillUpgrades", (FieldAttributes)6, assembly.MainModule.ImportReference(typeof(bool[]))));
			}
			if (type3 != null)
			{
				type3.Fields.Add(new FieldDefinition("sut_skillUpgrades", (FieldAttributes)6, assembly.MainModule.ImportReference(typeof(bool[]))));
			}
			if (type4 != null)
			{
				type4.Fields.Add(new FieldDefinition("sut_skillUpgradesTree", (FieldAttributes)6, assembly.MainModule.ImportReference(typeof(GameObject))));
			}
		}
	}
}

plugins/SkillUpgradesTree.dll

Decompiled a day 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 System.Xml.Linq;
using BepInEx;
using EntityStates;
using EntityStates.Commando.CommandoWeapon;
using HG.Reflection;
using HarmonyLib;
using IL.RoR2.UI;
using Microsoft.CodeAnalysis;
using Mono.Cecil;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using On.EntityStates.Commando.CommandoWeapon;
using On.RoR2;
using On.RoR2.Skills;
using R2API.AddressReferencedAssets;
using Rewired;
using RoR2;
using RoR2.Skills;
using RoR2.UI;
using SkillUpgradesTree.Test;
using TMPro;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Events;
using UnityEngine.Networking;
using UnityEngine.Sprites;
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("SkillUpgradesTree")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("SkillUpgradesTree")]
[assembly: AssemblyTitle("SkillUpgradesTree")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
[module: UnverifiableCode]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace SkillUpgradesTree
{
	public class BezierPath
	{
		public int SegmentsPerCurve = 10;

		public float MINIMUM_SQR_DISTANCE = 0.01f;

		public float DIVISION_THRESHOLD = -0.99f;

		private List<Vector2> controlPoints;

		private int curveCount;

		public BezierPath()
		{
			controlPoints = new List<Vector2>();
		}

		public void SetControlPoints(List<Vector2> newControlPoints)
		{
			controlPoints.Clear();
			controlPoints.AddRange(newControlPoints);
			curveCount = (controlPoints.Count - 1) / 3;
		}

		public void SetControlPoints(Vector2[] newControlPoints)
		{
			controlPoints.Clear();
			controlPoints.AddRange(newControlPoints);
			curveCount = (controlPoints.Count - 1) / 3;
		}

		public List<Vector2> GetControlPoints()
		{
			return controlPoints;
		}

		public void Interpolate(List<Vector2> segmentPoints, float scale)
		{
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: 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_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			//IL_0125: Unknown result type (might be due to invalid IL or missing references)
			//IL_012a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0133: Unknown result type (might be due to invalid IL or missing references)
			//IL_0138: Unknown result type (might be due to invalid IL or missing references)
			//IL_013d: Unknown result type (might be due to invalid IL or missing references)
			//IL_013f: 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_0144: Unknown result type (might be due to invalid IL or missing references)
			//IL_0149: Unknown result type (might be due to invalid IL or missing references)
			//IL_014b: 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_0152: Unknown result type (might be due to invalid IL or missing references)
			//IL_015b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0160: Unknown result type (might be due to invalid IL or missing references)
			//IL_0165: Unknown result type (might be due to invalid IL or missing references)
			//IL_016d: Unknown result type (might be due to invalid IL or missing references)
			//IL_017b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0189: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			controlPoints.Clear();
			if (segmentPoints.Count < 2)
			{
				return;
			}
			for (int i = 0; i < segmentPoints.Count; i++)
			{
				if (i == 0)
				{
					Vector2 val = segmentPoints[i];
					Vector2 val2 = segmentPoints[i + 1];
					Vector2 val3 = val2 - val;
					Vector2 item = val + scale * val3;
					controlPoints.Add(val);
					controlPoints.Add(item);
					continue;
				}
				if (i == segmentPoints.Count - 1)
				{
					Vector2 val4 = segmentPoints[i - 1];
					Vector2 val5 = segmentPoints[i];
					Vector2 val6 = val5 - val4;
					Vector2 item2 = val5 - scale * val6;
					controlPoints.Add(item2);
					controlPoints.Add(val5);
					continue;
				}
				Vector2 val7 = segmentPoints[i - 1];
				Vector2 val8 = segmentPoints[i];
				Vector2 val9 = segmentPoints[i + 1];
				Vector2 val10 = val9 - val7;
				Vector2 normalized = ((Vector2)(ref val10)).normalized;
				Vector2 val11 = scale * normalized;
				val10 = val8 - val7;
				Vector2 item3 = val8 - val11 * ((Vector2)(ref val10)).magnitude;
				Vector2 val12 = scale * normalized;
				val10 = val9 - val8;
				Vector2 item4 = val8 + val12 * ((Vector2)(ref val10)).magnitude;
				controlPoints.Add(item3);
				controlPoints.Add(val8);
				controlPoints.Add(item4);
			}
			curveCount = (controlPoints.Count - 1) / 3;
		}

		public void SamplePoints(List<Vector2> sourcePoints, float minSqrDistance, float maxSqrDistance, float scale)
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: 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_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: 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_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			if (sourcePoints.Count < 2)
			{
				return;
			}
			Stack<Vector2> stack = new Stack<Vector2>();
			stack.Push(sourcePoints[0]);
			Vector2 val = sourcePoints[1];
			int num = 2;
			Vector2 val2;
			for (num = 2; num < sourcePoints.Count; num++)
			{
				val2 = val - sourcePoints[num];
				if (((Vector2)(ref val2)).sqrMagnitude > minSqrDistance)
				{
					val2 = stack.Peek() - sourcePoints[num];
					if (((Vector2)(ref val2)).sqrMagnitude > maxSqrDistance)
					{
						stack.Push(val);
					}
				}
				val = sourcePoints[num];
			}
			Vector2 val3 = stack.Pop();
			Vector2 val4 = stack.Peek();
			val2 = val4 - val;
			Vector2 normalized = ((Vector2)(ref val2)).normalized;
			val2 = val - val3;
			float magnitude = ((Vector2)(ref val2)).magnitude;
			val2 = val3 - val4;
			float magnitude2 = ((Vector2)(ref val2)).magnitude;
			val3 += normalized * ((magnitude2 - magnitude) / 2f);
			stack.Push(val3);
			stack.Push(val);
			Interpolate(new List<Vector2>(stack), scale);
		}

		public Vector2 CalculateBezierPoint(int curveIndex, float t)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			int num = curveIndex * 3;
			Vector2 p = controlPoints[num];
			Vector2 p2 = controlPoints[num + 1];
			Vector2 p3 = controlPoints[num + 2];
			Vector2 p4 = controlPoints[num + 3];
			return CalculateBezierPoint(t, p, p2, p3, p4);
		}

		public List<Vector2> GetDrawingPoints0()
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			List<Vector2> list = new List<Vector2>();
			for (int i = 0; i < curveCount; i++)
			{
				if (i == 0)
				{
					list.Add(CalculateBezierPoint(i, 0f));
				}
				for (int j = 1; j <= SegmentsPerCurve; j++)
				{
					float t = (float)j / (float)SegmentsPerCurve;
					list.Add(CalculateBezierPoint(i, t));
				}
			}
			return list;
		}

		public List<Vector2> GetDrawingPoints1()
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: 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_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: 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_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: 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_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: 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_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			List<Vector2> list = new List<Vector2>();
			for (int i = 0; i < controlPoints.Count - 3; i += 3)
			{
				Vector2 p = controlPoints[i];
				Vector2 p2 = controlPoints[i + 1];
				Vector2 p3 = controlPoints[i + 2];
				Vector2 p4 = controlPoints[i + 3];
				if (i == 0)
				{
					list.Add(CalculateBezierPoint(0f, p, p2, p3, p4));
				}
				for (int j = 1; j <= SegmentsPerCurve; j++)
				{
					float t = (float)j / (float)SegmentsPerCurve;
					list.Add(CalculateBezierPoint(t, p, p2, p3, p4));
				}
			}
			return list;
		}

		public List<Vector2> GetDrawingPoints2()
		{
			List<Vector2> list = new List<Vector2>();
			for (int i = 0; i < curveCount; i++)
			{
				List<Vector2> list2 = FindDrawingPoints(i);
				if (i != 0)
				{
					list2.RemoveAt(0);
				}
				list.AddRange(list2);
			}
			return list;
		}

		private List<Vector2> FindDrawingPoints(int curveIndex)
		{
			//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_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: 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)
			List<Vector2> list = new List<Vector2>();
			Vector2 item = CalculateBezierPoint(curveIndex, 0f);
			Vector2 item2 = CalculateBezierPoint(curveIndex, 1f);
			list.Add(item);
			list.Add(item2);
			FindDrawingPoints(curveIndex, 0f, 1f, list, 1);
			return list;
		}

		private int FindDrawingPoints(int curveIndex, float t0, float t1, List<Vector2> pointList, int insertionIndex)
		{
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: 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_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: 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_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_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: 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_0060: 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_006a: 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_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			Vector2 val = CalculateBezierPoint(curveIndex, t0);
			Vector2 val2 = CalculateBezierPoint(curveIndex, t1);
			Vector2 val3 = val - val2;
			if (((Vector2)(ref val3)).sqrMagnitude < MINIMUM_SQR_DISTANCE)
			{
				return 0;
			}
			float num = (t0 + t1) / 2f;
			Vector2 val4 = CalculateBezierPoint(curveIndex, num);
			val3 = val - val4;
			Vector2 normalized = ((Vector2)(ref val3)).normalized;
			val3 = val2 - val4;
			Vector2 normalized2 = ((Vector2)(ref val3)).normalized;
			if (Vector2.Dot(normalized, normalized2) > DIVISION_THRESHOLD || Mathf.Abs(num - 0.5f) < 0.0001f)
			{
				int num2 = 0;
				num2 += FindDrawingPoints(curveIndex, t0, num, pointList, insertionIndex);
				pointList.Insert(insertionIndex + num2, val4);
				num2++;
				return num2 + FindDrawingPoints(curveIndex, num, t1, pointList, insertionIndex + num2);
			}
			return 0;
		}

		private Vector2 CalculateBezierPoint(float t, Vector2 p0, Vector2 p1, Vector2 p2, Vector2 p3)
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//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_0039: 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_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: 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_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: 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_0064: 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_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			float num = 1f - t;
			float num2 = t * t;
			float num3 = num * num;
			float num4 = num3 * num;
			float num5 = num2 * t;
			Vector2 val = num4 * p0;
			val += 3f * num3 * t * p1;
			val += 3f * num * num2 * p2;
			return val + num5 * p3;
		}
	}
	[Serializable]
	public class CableCurve
	{
		[SerializeField]
		private Vector2 m_start;

		[SerializeField]
		private Vector2 m_end;

		[SerializeField]
		private float m_slack;

		[SerializeField]
		private int m_steps;

		[SerializeField]
		private bool m_regen;

		private static Vector2[] emptyCurve = (Vector2[])(object)new Vector2[2]
		{
			new Vector2(0f, 0f),
			new Vector2(0f, 0f)
		};

		[SerializeField]
		private Vector2[] points;

		public bool regenPoints
		{
			get
			{
				return m_regen;
			}
			set
			{
				m_regen = value;
			}
		}

		public Vector2 start
		{
			get
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				//IL_000a: Unknown result type (might be due to invalid IL or missing references)
				return m_start;
			}
			set
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				//IL_0003: 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_001a: Unknown result type (might be due to invalid IL or missing references)
				if (value != m_start)
				{
					m_regen = true;
				}
				m_start = value;
			}
		}

		public Vector2 end
		{
			get
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				//IL_000a: Unknown result type (might be due to invalid IL or missing references)
				return m_end;
			}
			set
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				//IL_0003: 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_001a: Unknown result type (might be due to invalid IL or missing references)
				if (value != m_end)
				{
					m_regen = true;
				}
				m_end = value;
			}
		}

		public float slack
		{
			get
			{
				return m_slack;
			}
			set
			{
				if (value != m_slack)
				{
					m_regen = true;
				}
				m_slack = Mathf.Max(0f, value);
			}
		}

		public int steps
		{
			get
			{
				return m_steps;
			}
			set
			{
				if (value != m_steps)
				{
					m_regen = true;
				}
				m_steps = Mathf.Max(2, value);
			}
		}

		public Vector2 midPoint
		{
			get
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				//IL_001c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0028: Unknown result type (might be due to invalid IL or missing references)
				//IL_002d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0037: Unknown result type (might be due to invalid IL or missing references)
				//IL_003c: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a9: 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_00ad: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
				//IL_0071: 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)
				//IL_0085: Unknown result type (might be due to invalid IL or missing references)
				//IL_008f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0094: Unknown result type (might be due to invalid IL or missing references)
				Vector2 result = Vector2.zero;
				if (m_steps == 2)
				{
					return (points[0] + points[1]) * 0.5f;
				}
				if (m_steps > 2)
				{
					int num = m_steps / 2;
					result = ((m_steps % 2 != 0) ? points[num] : ((points[num] + points[num + 1]) * 0.5f));
				}
				return result;
			}
		}

		public CableCurve()
		{
			//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: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			points = emptyCurve;
			m_start = Vector2.up;
			m_end = Vector2.up + Vector2.right;
			m_slack = 0.5f;
			m_steps = 20;
			m_regen = true;
		}

		public CableCurve(Vector2[] inputPoints)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: 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_0024: Unknown result type (might be due to invalid IL or missing references)
			points = inputPoints;
			m_start = inputPoints[0];
			m_end = inputPoints[1];
			m_slack = 0.5f;
			m_steps = 20;
			m_regen = true;
		}

		public CableCurve(List<Vector2> inputPoints)
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			points = inputPoints.ToArray();
			m_start = inputPoints[0];
			m_end = inputPoints[1];
			m_slack = 0.5f;
			m_steps = 20;
			m_regen = true;
		}

		public CableCurve(CableCurve v)
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: 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)
			points = v.Points();
			m_start = v.start;
			m_end = v.end;
			m_slack = v.slack;
			m_steps = v.steps;
			m_regen = v.regenPoints;
		}

		public Vector2[] Points()
		{
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_024b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0250: 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_029c: 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)
			if (!m_regen)
			{
				return points;
			}
			if (m_steps < 2)
			{
				return emptyCurve;
			}
			float num = Vector2.Distance(m_end, m_start);
			float num2 = Vector2.Distance(new Vector2(m_end.x, m_start.y), m_start);
			float num3 = num + Mathf.Max(0.0001f, m_slack);
			float num4 = 0f;
			float y = m_start.y;
			float num5 = num2;
			float y2 = end.y;
			if (num5 - num4 == 0f)
			{
				return emptyCurve;
			}
			float num6 = Mathf.Sqrt(Mathf.Pow(num3, 2f) - Mathf.Pow(y2 - y, 2f)) / (num5 - num4);
			int num7 = 30;
			int num8 = 0;
			int num9 = num7 * 10;
			bool flag = false;
			float num10 = 0f;
			float num11 = 0f;
			float num12 = 100f;
			float num13 = 0f;
			for (int i = 0; i < num7; i++)
			{
				for (int j = 0; j < 10; j++)
				{
					num8++;
					num11 = num10 + num12;
					num13 = (float)Math.Sinh(num11) / num11;
					if (!float.IsInfinity(num13))
					{
						if (num13 == num6)
						{
							flag = true;
							num10 = num11;
							break;
						}
						if (num13 > num6)
						{
							break;
						}
						num10 = num11;
						if (num8 > num9)
						{
							flag = true;
							break;
						}
					}
				}
				if (flag)
				{
					break;
				}
				num12 *= 0.1f;
			}
			float num14 = (num5 - num4) / 2f / num10;
			float num15 = (num4 + num5 - num14 * Mathf.Log((num3 + y2 - y) / (num3 - y2 + y))) / 2f;
			float num16 = (y2 + y - num3 * (float)Math.Cosh(num10) / (float)Math.Sinh(num10)) / 2f;
			points = (Vector2[])(object)new Vector2[m_steps];
			float num17 = m_steps - 1;
			for (int k = 0; k < m_steps; k++)
			{
				float num18 = (float)k / num17;
				Vector2 zero = Vector2.zero;
				zero.x = Mathf.Lerp(start.x, end.x, num18);
				zero.y = num14 * (float)Math.Cosh((num18 * num2 - num15) / num14) + num16;
				points[k] = zero;
			}
			m_regen = false;
			return points;
		}
	}
	[Serializable]
	[BepInPlugin("com.brynzananas.skillupgradestree", "Skill Upgrades Tree", "1.0.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class SkillUpgardesTreePlugin : BaseUnityPlugin
	{
		public const string ModGuid = "com.brynzananas.skillupgradestree";

		public const string ModName = "Skill Upgrades Tree";

		public const string ModVer = "1.0.0";

		private static SkillUpgardesTreePlugin _instance;

		public static SkillUpgardesTreePlugin instance => _instance;

		public void Awake()
		{
			_instance = this;
			SkillUpgradesTreeApi.Init();
		}

		public void OnDestroy()
		{
			SkillUpgradesTreeApi.UnsetHooks();
			TestClass.UnsetHooks();
		}
	}
	[Serializable]
	public class SkillUpgrade
	{
		[Serializable]
		public struct RequiredUpgrade
		{
			public string requiredSkillId;

			public RequiredUpgradeCondition condition;
		}

		public enum RequiredUpgradeCondition
		{
			Required,
			Selective
		}

		public string id;

		public string nameToken;

		public string descriptionToken;

		public string loreToken;

		public Sprite icon;

		internal SkillUpgradeIndex _skillUpgradeIndex;

		public List<RequiredUpgrade> requiredUpgrades = new List<RequiredUpgrade>();

		public int selectiveUpgradesRequired = 1;

		public List<string> mutuallyExclusiveWith = new List<string>();

		[HideInInspector]
		public bool isSelected;

		public SkillUpgradeIndex skillUpgradeIndex => _skillUpgradeIndex;

		public SkillUpgrade Clone()
		{
			return new SkillUpgrade
			{
				id = id,
				nameToken = nameToken,
				descriptionToken = descriptionToken,
				loreToken = loreToken,
				icon = icon,
				requiredUpgrades = requiredUpgrades,
				mutuallyExclusiveWith = mutuallyExclusiveWith.ToList(),
				_skillUpgradeIndex = skillUpgradeIndex,
				isSelected = false
			};
		}
	}
	public class SkillUpgradeButton : MonoBehaviour
	{
		public HGButton button;

		public Image iconImage;

		public Image borderImage;

		public Color lockedColor = Color.gray;

		public Color availableColor = Color.white;

		public Color unlockedColor = Color.green;

		private SkillUpgrade _skillUpgrade;

		private SkillUpgradesTreeController controller;

		private SkillUpgradesTreeUIViewer viewer;

		private bool pressed;

		public SkillUpgrade skillUpgrade => _skillUpgrade;

		public RectTransform RectTransform => ((Component)this).GetComponent<RectTransform>();

		public void Setup(SkillUpgrade data, SkillUpgradesTreeController treeController, SkillUpgradesTreeUIViewer uiViewer)
		{
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Expected O, but got Unknown
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Expected O, but got Unknown
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Expected O, but got Unknown
			_skillUpgrade = data;
			controller = treeController;
			viewer = uiViewer;
			if ((Object)(object)iconImage != (Object)null && (Object)(object)data.icon != (Object)null)
			{
				iconImage.sprite = data.icon;
			}
			((UnityEvent)((Button)button).onClick).AddListener(new UnityAction(OnNodeClicked));
			((MPButton)button).onSelect.AddListener(new UnityAction(OnPointerEnter));
			((MPButton)button).onDeselect.AddListener(new UnityAction(OnPointerExit));
			UpdateVisuals();
		}

		public void FixedUpdate()
		{
			if (pressed)
			{
				pressed = false;
			}
		}

		public void UpdateVisuals()
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			if (_skillUpgrade.isSelected)
			{
				((Graphic)borderImage).color = unlockedColor;
			}
			else if (controller.CanUnlockSkill(_skillUpgrade.id))
			{
				((Graphic)borderImage).color = availableColor;
			}
			else
			{
				((Graphic)borderImage).color = lockedColor;
			}
		}

		private void OnNodeClicked()
		{
			if (!pressed)
			{
				pressed = true;
				if (controller.TryUnlockSkill(_skillUpgrade.id))
				{
					_skillUpgrade.isSelected = controller.FindRuntimeSkill(_skillUpgrade.id).isSelected;
					viewer.RefreshAllNodes();
				}
			}
		}

		public void OnPointerEnter()
		{
			viewer.ShowNodeDetails(_skillUpgrade);
		}

		public void OnPointerExit()
		{
			viewer.ClearNodeDetails();
		}
	}
	public enum SkillUpgradeIndex
	{
		None = -1
	}
	public static class SkillUpgradesTreeApi
	{
		public class Row_AddButtonEvents
		{
			public LoadoutPanelController loadoutPanelController;

			public UserProfile userProfile;

			public SkillDef skillDef;

			public BodyIndex bodyIndex;

			public HGButton hGButton;

			public void OnClick()
			{
				//IL_0079: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
				if (Object.op_Implicit((Object)(object)loadoutPanelController.GetSkillUpgradesTree()))
				{
					GameObject skillUpgradesTree = loadoutPanelController.GetSkillUpgradesTree();
					Object.Destroy((Object)(object)skillUpgradesTree);
				}
				if (skillDefToSkillUpgradesTreeDef.TryGetValue(skillDef, out var value))
				{
					GameObject val = Object.Instantiate<GameObject>(SkillUpgradesTreePrefab, ((Component)loadoutPanelController).transform);
					val.transform.localPosition = new Vector3(717.1114f, 40.3184f, -47.6533f);
					SkillUpgradesTreeController component = val.GetComponent<SkillUpgradesTreeController>();
					component.skillTreeAsset = value;
					component.userProfile = userProfile;
					component.targetSkillDef = skillDef;
					component.bodyIndex = bodyIndex;
					component.Init();
					SkillUpgradesTreeUIViewer component2 = val.GetComponent<SkillUpgradesTreeUIViewer>();
					component2.skillButton = (Button)(object)hGButton;
					component2.Init();
					loadoutPanelController.SetSkillUpgradesTree(val);
				}
			}
		}

		[CompilerGenerated]
		private static class <>O
		{
			public static hook_SetSkillDefs <0>__SkillCatalog_SetSkillDefs;

			public static hook_Clone <1>__BodyLoadout_Clone;

			public static hook_Serialize <2>__BodyLoadout_Serialize;

			public static hook_Deserialize <3>__BodyLoadout_Deserialize;

			public static hook_ToXml <4>__BodyLoadout_ToXml;

			public static hook_FromXml <5>__BodyLoadout_FromXml;

			public static hook_ApplyLoadoutServer <6>__SkillLocator_ApplyLoadoutServer;

			public static Manipulator <7>__Row_FromSkillSlot;

			public static Manipulator <8>__Row_AddButton;

			public static Action <9>__AddLanguageTokens;

			public static Action<HGButton, LoadoutPanelController> <10>__AddButtonDelegate;
		}

		public static AssetBundle assetBundle;

		public static GameObject SkillUpgradesTreePrefab;

		public static GameObject SkillUpgradeButton;

		public static SkillUpgradesTreeDef TestDef;

		public static Material BlurMaterial;

		public static Sprite BorderSprite;

		public static Sprite PanelSprite;

		private static bool initialized;

		internal static List<SkillUpgradesTreeDef> skillUpgradesTreeDefs = new List<SkillUpgradesTreeDef>();

		private static SkillUpgrade[] _skillUpgrades = Array.Empty<SkillUpgrade>();

		private static int _skillUpgradesCount;

		private static Dictionary<SkillDef, SkillUpgradesTreeDef> skillDefToSkillUpgradesTreeDef = new Dictionary<SkillDef, SkillUpgradesTreeDef>();

		private static Dictionary<SkillDef, List<SkillUpgrade>> tempDict1 = new Dictionary<SkillDef, List<SkillUpgrade>>();

		private static Dictionary<string, SkillUpgradeIndex> idToIndex = new Dictionary<string, SkillUpgradeIndex>();

		private static bool _hooksSet;

		public static Action onSkillUpgradesRegistered;

		private static SkillDef WhyAddButtonJustDoesntPutSkillDefAsAnArgument;

		private static UserProfile ThisIsSoBad;

		private static BodyIndex IWantToCrackRockerSurvivorSoMuch;

		public static int skillUpgradesCount => _skillUpgradesCount;

		public static void Init()
		{
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			SetHooks();
			if (!initialized)
			{
				assetBundle = AssetBundle.LoadFromFileAsync(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)SkillUpgardesTreePlugin.instance).Info.Location), "assetbundles", "skillupgradestreeassets")).assetBundle;
				SkillUpgradesTreePrefab = assetBundle.LoadAsset<GameObject>("Assets/SkillUpgradesTree/SkillUpgradesTreePrefab.prefab");
				SkillUpgradeButton = assetBundle.LoadAsset<GameObject>("Assets/SkillUpgradesTree/SkillUpgradeButton.prefab");
				TestDef = assetBundle.LoadAsset<SkillUpgradesTreeDef>("Assets/SkillUpgradesTree/TestTree.asset");
				BlurMaterial = Addressables.LoadAssetAsync<Material>((object)"TranslucentImage/Default-Translucent.mat").WaitForCompletion();
				BorderSprite = Addressables.LoadAssetAsync<Sprite>((object)"RoR2/Base/UI/texUIHighlightHeader.png").WaitForCompletion();
				PanelSprite = Addressables.LoadAssetAsync<Sprite>((object)"RoR2/Base/UI/texUICleanPanel.png").WaitForCompletion();
				initialized = true;
			}
		}

		public static void SetHooks()
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Expected O, but got Unknown
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Expected O, but got Unknown
			//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_006c: Expected O, but got Unknown
			//IL_0082: 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_008d: Expected O, but got Unknown
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Expected O, but got Unknown
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Expected O, but got Unknown
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Expected O, but got Unknown
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Expected O, but got Unknown
			//IL_0127: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0132: Expected O, but got Unknown
			if (!_hooksSet)
			{
				object obj = <>O.<0>__SkillCatalog_SetSkillDefs;
				if (obj == null)
				{
					hook_SetSkillDefs val = SkillCatalog_SetSkillDefs;
					<>O.<0>__SkillCatalog_SetSkillDefs = val;
					obj = (object)val;
				}
				SkillCatalog.SetSkillDefs += (hook_SetSkillDefs)obj;
				object obj2 = <>O.<1>__BodyLoadout_Clone;
				if (obj2 == null)
				{
					hook_Clone val2 = BodyLoadout_Clone;
					<>O.<1>__BodyLoadout_Clone = val2;
					obj2 = (object)val2;
				}
				BodyLoadout.Clone += (hook_Clone)obj2;
				object obj3 = <>O.<2>__BodyLoadout_Serialize;
				if (obj3 == null)
				{
					hook_Serialize val3 = BodyLoadout_Serialize;
					<>O.<2>__BodyLoadout_Serialize = val3;
					obj3 = (object)val3;
				}
				BodyLoadout.Serialize += (hook_Serialize)obj3;
				object obj4 = <>O.<3>__BodyLoadout_Deserialize;
				if (obj4 == null)
				{
					hook_Deserialize val4 = BodyLoadout_Deserialize;
					<>O.<3>__BodyLoadout_Deserialize = val4;
					obj4 = (object)val4;
				}
				BodyLoadout.Deserialize += (hook_Deserialize)obj4;
				object obj5 = <>O.<4>__BodyLoadout_ToXml;
				if (obj5 == null)
				{
					hook_ToXml val5 = BodyLoadout_ToXml;
					<>O.<4>__BodyLoadout_ToXml = val5;
					obj5 = (object)val5;
				}
				BodyLoadout.ToXml += (hook_ToXml)obj5;
				object obj6 = <>O.<5>__BodyLoadout_FromXml;
				if (obj6 == null)
				{
					hook_FromXml val6 = BodyLoadout_FromXml;
					<>O.<5>__BodyLoadout_FromXml = val6;
					obj6 = (object)val6;
				}
				BodyLoadout.FromXml += (hook_FromXml)obj6;
				object obj7 = <>O.<6>__SkillLocator_ApplyLoadoutServer;
				if (obj7 == null)
				{
					hook_ApplyLoadoutServer val7 = SkillLocator_ApplyLoadoutServer;
					<>O.<6>__SkillLocator_ApplyLoadoutServer = val7;
					obj7 = (object)val7;
				}
				SkillLocator.ApplyLoadoutServer += (hook_ApplyLoadoutServer)obj7;
				object obj8 = <>O.<7>__Row_FromSkillSlot;
				if (obj8 == null)
				{
					Manipulator val8 = Row_FromSkillSlot;
					<>O.<7>__Row_FromSkillSlot = val8;
					obj8 = (object)val8;
				}
				Row.FromSkillSlot += (Manipulator)obj8;
				object obj9 = <>O.<8>__Row_AddButton;
				if (obj9 == null)
				{
					Manipulator val9 = Row_AddButton;
					<>O.<8>__Row_AddButton = val9;
					obj9 = (object)val9;
				}
				Row.AddButton += (Manipulator)obj9;
				RoR2Application.onLoadFinished = (Action)Delegate.Combine(RoR2Application.onLoadFinished, new Action(TestClass.AddLanguageTokens));
				_hooksSet = true;
			}
		}

		private static bool BodyLoadout_FromXml(orig_FromXml orig, BodyLoadout self, XElement element)
		{
			bool flag = orig.Invoke(self, element);
			if (!flag)
			{
				return flag;
			}
			bool[] array = new bool[skillUpgradesCount];
			foreach (XElement item in element.Elements("SkillUpgrade"))
			{
				string value = item.Value;
				if (value == null)
				{
					continue;
				}
				SkillUpgradeIndex skillUpgradeIndex = GetSkillUpgradeIndex(value);
				if (skillUpgradeIndex != SkillUpgradeIndex.None)
				{
					int num = (int)skillUpgradeIndex;
					if (num >= 0 && num < array.Length)
					{
						array[num] = true;
					}
				}
			}
			self.SetSkillUpgrades(array);
			return flag;
		}

		private static XElement BodyLoadout_ToXml(orig_ToXml orig, BodyLoadout self, string elementName)
		{
			XElement xElement = orig.Invoke(self, elementName);
			bool[] skillUpgrades = self.GetSkillUpgrades();
			if (skillUpgrades == null)
			{
				return xElement;
			}
			for (int i = 0; i < skillUpgrades.Length; i++)
			{
				if (skillUpgrades[i])
				{
					XElement content = new XElement("SkillUpgrade", GetSkillUpgrade(i).id);
					xElement.Add(content);
				}
			}
			return xElement;
		}

		public static void UnsetHooks()
		{
			//IL_0022: 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)
			//IL_002d: Expected O, but got Unknown
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Expected O, but got Unknown
			//IL_0064: 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_006f: Expected O, but got Unknown
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Expected O, but got Unknown
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Expected O, but got Unknown
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Expected O, but got Unknown
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Expected O, but got Unknown
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Expected O, but got Unknown
			//IL_012a: Unknown result type (might be due to invalid IL or missing references)
			//IL_012f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: Expected O, but got Unknown
			if (_hooksSet)
			{
				object obj = <>O.<0>__SkillCatalog_SetSkillDefs;
				if (obj == null)
				{
					hook_SetSkillDefs val = SkillCatalog_SetSkillDefs;
					<>O.<0>__SkillCatalog_SetSkillDefs = val;
					obj = (object)val;
				}
				SkillCatalog.SetSkillDefs -= (hook_SetSkillDefs)obj;
				object obj2 = <>O.<1>__BodyLoadout_Clone;
				if (obj2 == null)
				{
					hook_Clone val2 = BodyLoadout_Clone;
					<>O.<1>__BodyLoadout_Clone = val2;
					obj2 = (object)val2;
				}
				BodyLoadout.Clone -= (hook_Clone)obj2;
				object obj3 = <>O.<2>__BodyLoadout_Serialize;
				if (obj3 == null)
				{
					hook_Serialize val3 = BodyLoadout_Serialize;
					<>O.<2>__BodyLoadout_Serialize = val3;
					obj3 = (object)val3;
				}
				BodyLoadout.Serialize -= (hook_Serialize)obj3;
				object obj4 = <>O.<3>__BodyLoadout_Deserialize;
				if (obj4 == null)
				{
					hook_Deserialize val4 = BodyLoadout_Deserialize;
					<>O.<3>__BodyLoadout_Deserialize = val4;
					obj4 = (object)val4;
				}
				BodyLoadout.Deserialize -= (hook_Deserialize)obj4;
				object obj5 = <>O.<4>__BodyLoadout_ToXml;
				if (obj5 == null)
				{
					hook_ToXml val5 = BodyLoadout_ToXml;
					<>O.<4>__BodyLoadout_ToXml = val5;
					obj5 = (object)val5;
				}
				BodyLoadout.ToXml -= (hook_ToXml)obj5;
				object obj6 = <>O.<5>__BodyLoadout_FromXml;
				if (obj6 == null)
				{
					hook_FromXml val6 = BodyLoadout_FromXml;
					<>O.<5>__BodyLoadout_FromXml = val6;
					obj6 = (object)val6;
				}
				BodyLoadout.FromXml -= (hook_FromXml)obj6;
				object obj7 = <>O.<6>__SkillLocator_ApplyLoadoutServer;
				if (obj7 == null)
				{
					hook_ApplyLoadoutServer val7 = SkillLocator_ApplyLoadoutServer;
					<>O.<6>__SkillLocator_ApplyLoadoutServer = val7;
					obj7 = (object)val7;
				}
				SkillLocator.ApplyLoadoutServer -= (hook_ApplyLoadoutServer)obj7;
				object obj8 = <>O.<7>__Row_FromSkillSlot;
				if (obj8 == null)
				{
					Manipulator val8 = Row_FromSkillSlot;
					<>O.<7>__Row_FromSkillSlot = val8;
					obj8 = (object)val8;
				}
				Row.FromSkillSlot -= (Manipulator)obj8;
				object obj9 = <>O.<8>__Row_AddButton;
				if (obj9 == null)
				{
					Manipulator val9 = Row_AddButton;
					<>O.<8>__Row_AddButton = val9;
					obj9 = (object)val9;
				}
				Row.AddButton -= (Manipulator)obj9;
				RoR2Application.onLoadFinished = (Action)Delegate.Remove(RoR2Application.onLoadFinished, new Action(TestClass.AddLanguageTokens));
				_hooksSet = false;
			}
		}

		private static void SkillLocator_ApplyLoadoutServer(orig_ApplyLoadoutServer orig, SkillLocator self, Loadout loadout, BodyIndex bodyIndex)
		{
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(self, loadout, bodyIndex);
			bool[] skillUpgrades = loadout.bodyLoadoutManager.GetReadOnlyBodyLoadout(bodyIndex).GetSkillUpgrades();
			self.SetSkillUpgrades(skillUpgrades);
		}

		private static void BodyLoadout_Deserialize(orig_Deserialize orig, BodyLoadout self, NetworkReader reader)
		{
			orig.Invoke(self, reader);
			if (reader.ReadBoolean())
			{
				bool[] array = new bool[skillUpgradesCount];
				for (int i = 0; i < skillUpgradesCount; i++)
				{
					array[i] = reader.ReadBoolean();
				}
				self.SetSkillUpgrades(array);
			}
		}

		private static void BodyLoadout_Serialize(orig_Serialize orig, BodyLoadout self, NetworkWriter writer)
		{
			orig.Invoke(self, writer);
			bool[] skillUpgrades = self.GetSkillUpgrades();
			if (skillUpgrades == null)
			{
				writer.Write(false);
				return;
			}
			writer.Write(true);
			for (int i = 0; i < skillUpgradesCount; i++)
			{
				writer.Write(skillUpgrades[i]);
			}
		}

		private static BodyLoadout BodyLoadout_Clone(orig_Clone orig, BodyLoadout self)
		{
			BodyLoadout val = orig.Invoke(self);
			val.SetSkillUpgrades(self.GetSkillUpgrades());
			return val;
		}

		private static void Row_FromSkillSlot(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Expected O, but got Unknown
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			val.Emit(OpCodes.Ldarg_1);
			val.Emit(OpCodes.Stsfld, AccessTools.Field(typeof(SkillUpgradesTreeApi), "IWantToCrackRockerSurvivorSoMuch"));
			if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchNewobj(x, typeof(Row))
			}))
			{
				val.Emit(OpCodes.Dup);
				val.Emit(OpCodes.Ldfld, AccessTools.Field(typeof(Row), "userProfile"));
				val.Emit(OpCodes.Stsfld, AccessTools.Field(typeof(SkillUpgradesTreeApi), "ThisIsSoBad"));
			}
			else
			{
				Log(((MemberReference)il.Method).Name + " IL Hook 1 failed!");
			}
			val = new ILCursor(il);
			if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdfld(x, typeof(Variant), "skillDef")
			}))
			{
				val.Emit(OpCodes.Dup);
				val.Emit(OpCodes.Stsfld, AccessTools.Field(typeof(SkillUpgradesTreeApi), "WhyAddButtonJustDoesntPutSkillDefAsAnArgument"));
			}
			else
			{
				Log(((MemberReference)il.Method).Name + " IL Hook 2 failed!");
			}
		}

		private static void SkillCatalog_SetSkillDefs(orig_SetSkillDefs orig, SkillDef[] newSkillDefs)
		{
			orig.Invoke(newSkillDefs);
			int num = 0;
			List<SkillUpgrade> list = new List<SkillUpgrade>();
			if (skillUpgradesTreeDefs.Count == 0)
			{
				TestClass.Init();
			}
			foreach (SkillUpgradesTreeDef skillUpgradesTreeDef2 in skillUpgradesTreeDefs)
			{
				foreach (SkillUpgrade skill in skillUpgradesTreeDef2.skills)
				{
					if (!list.Contains(skill))
					{
						skill._skillUpgradeIndex = (SkillUpgradeIndex)num;
						list.Add(skill);
						idToIndex.Add(skill.id, skill.skillUpgradeIndex);
						num++;
					}
				}
				foreach (AddressReferencedAsset<SkillDef> item in skillUpgradesTreeDef2.skillsToApply)
				{
					SkillDef asset = item.Asset;
					if (tempDict1.ContainsKey(asset))
					{
						tempDict1[asset].AddRange(skillUpgradesTreeDef2.skills);
						continue;
					}
					List<SkillUpgrade> list2 = new List<SkillUpgrade>();
					list2.AddRange(skillUpgradesTreeDef2.skills);
					tempDict1.Add(asset, list2);
				}
			}
			_skillUpgrades = list.ToArray();
			_skillUpgradesCount = num;
			foreach (KeyValuePair<SkillDef, List<SkillUpgrade>> item2 in tempDict1)
			{
				SkillUpgradesTreeDef skillUpgradesTreeDef = ScriptableObject.CreateInstance<SkillUpgradesTreeDef>();
				((Object)skillUpgradesTreeDef).name = ((Object)item2.Key).name + "UpgradesTree";
				skillUpgradesTreeDef.skills = item2.Value;
				BesameRequiredSkills(skillUpgradesTreeDef.skills);
				skillDefToSkillUpgradesTreeDef.Add(item2.Key, skillUpgradesTreeDef);
			}
			onSkillUpgradesRegistered?.Invoke();
		}

		private static void BesameRequiredSkills(List<SkillUpgrade> skillUpgrades)
		{
			if (skillUpgrades == null || skillUpgrades.Count == 0)
			{
				return;
			}
			Dictionary<string, Dictionary<string, string>> dictionary = new Dictionary<string, Dictionary<string, string>>(StringComparer.Ordinal);
			foreach (SkillUpgrade skillUpgrade in skillUpgrades)
			{
				if (Utility.IsNullOrWhiteSpace(skillUpgrade.id))
				{
					continue;
				}
				if (!dictionary.TryGetValue(skillUpgrade.id, out var value))
				{
					value = new Dictionary<string, string>(StringComparer.Ordinal);
					dictionary[skillUpgrade.id] = value;
				}
				if (skillUpgrade.mutuallyExclusiveWith == null)
				{
					continue;
				}
				foreach (string item in skillUpgrade.mutuallyExclusiveWith)
				{
					if (!Utility.IsNullOrWhiteSpace(item))
					{
						value[item] = item;
					}
				}
			}
			foreach (KeyValuePair<string, Dictionary<string, string>> item2 in dictionary)
			{
				string key = item2.Key;
				Dictionary<string, string> value2 = item2.Value;
				foreach (KeyValuePair<string, string> item3 in value2)
				{
					string key2 = item3.Key;
					string value3 = item3.Value;
					if (dictionary.TryGetValue(key2, out var value4) && !value4.ContainsKey(key))
					{
						value4[key] = key;
					}
				}
			}
			foreach (SkillUpgrade skillUpgrade2 in skillUpgrades)
			{
				if (!Utility.IsNullOrWhiteSpace(skillUpgrade2.id) && dictionary.TryGetValue(skillUpgrade2.id, out var value5))
				{
					skillUpgrade2.mutuallyExclusiveWith.AddRange(value5.Values);
				}
			}
		}

		private static void Row_AddButton(ILContext il)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Expected O, but got Unknown
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			ILLabel val2 = null;
			int locid = 0;
			int num = default(int);
			if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[3]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref locid),
				(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref num),
				(Instruction x) => ILPatternMatchingExt.MatchStfld<HGButton>(x, "hoverToken")
			}))
			{
				val.Emit(OpCodes.Ldloc, locid);
				val.Emit(OpCodes.Ldarg_1);
				val.EmitDelegate<Action<HGButton, LoadoutPanelController>>((Action<HGButton, LoadoutPanelController>)AddButtonDelegate);
			}
			else
			{
				Log(((MemberReference)il.Method).Name + " IL Hook 1 failed!");
			}
		}

		private static void AddButtonDelegate(HGButton hGButton, LoadoutPanelController loadoutPanelController)
		{
			//IL_0025: 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_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Expected O, but got Unknown
			Row_AddButtonEvents row_AddButtonEvents = new Row_AddButtonEvents();
			row_AddButtonEvents.loadoutPanelController = loadoutPanelController;
			row_AddButtonEvents.skillDef = WhyAddButtonJustDoesntPutSkillDefAsAnArgument;
			row_AddButtonEvents.userProfile = ThisIsSoBad;
			row_AddButtonEvents.bodyIndex = IWantToCrackRockerSurvivorSoMuch;
			row_AddButtonEvents.hGButton = hGButton;
			((UnityEvent)((Button)hGButton).onClick).AddListener(new UnityAction(row_AddButtonEvents.OnClick));
		}

		public static void Log(object logMessage)
		{
			((BaseUnityPlugin)SkillUpgardesTreePlugin.instance).Logger.LogMessage(logMessage);
		}

		public static bool GetSkillUpgradeSelected(this BodyLoadout bodyLoadout, string upgradeId)
		{
			return bodyLoadout.GetSkillUpgradeSelected(GetSkillUpgradeIndex(upgradeId));
		}

		public static bool GetSkillUpgradeSelected(this BodyLoadout bodyLoadout, SkillUpgradeIndex skillUpgradeIndex)
		{
			if (bodyLoadout.GetSkillUpgrades() == null)
			{
				return false;
			}
			return bodyLoadout.GetSkillUpgrades()[(int)skillUpgradeIndex];
		}

		public static void SetSkillUpgradeSelected(this BodyLoadout bodyLoadout, SkillUpgradeIndex skillUpgradeIndex, bool selected)
		{
			bool[] array = bodyLoadout.GetSkillUpgrades();
			if (array == null)
			{
				array = new bool[skillUpgradesCount];
			}
			array[(int)skillUpgradeIndex] = selected;
			bodyLoadout.SetSkillUpgrades(array);
		}

		public static bool GetSkillUpgradeSelected(this BodyLoadoutManager bodyLoadoutManager, BodyIndex bodyIndex, string upgradeId)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			return bodyLoadoutManager.GetSkillUpgradeSelected(bodyIndex, GetSkillUpgradeIndex(upgradeId));
		}

		public static bool GetSkillUpgradeSelected(this BodyLoadoutManager bodyLoadoutManager, BodyIndex bodyIndex, SkillUpgradeIndex skillUpgradeIndex)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			return bodyLoadoutManager.GetReadOnlyBodyLoadout(bodyIndex).GetSkillUpgradeSelected(skillUpgradeIndex);
		}

		public static void SetSkillUpgradeSelected(this BodyLoadoutManager bodyLoadoutManager, BodyIndex bodyIndex, SkillUpgradeIndex skillUpgradeIndex, bool selected)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Invalid comparison between Unknown and I4
			//IL_0033: 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)
			//IL_001c: Expected I4, but got Unknown
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Expected I4, but got Unknown
			if ((int)bodyIndex >= BodyCatalog.bodyCount)
			{
				throw new ArgumentOutOfRangeException("bodyIndex", (int)bodyIndex, $"Value provided for 'bodyIndex' is outside range [0, {(int)bodyIndex}]");
			}
			BodyLoadout orCreateModifiedBodyLoadout = bodyLoadoutManager.GetOrCreateModifiedBodyLoadout(bodyIndex);
			orCreateModifiedBodyLoadout.SetSkillUpgradeSelected(skillUpgradeIndex, selected);
			bodyLoadoutManager.RemoveBodyLoadoutIfDefault(orCreateModifiedBodyLoadout);
		}

		public static bool GetSkillUpgradeSelected(this SkillLocator skillLocator, SkillUpgradeIndex skillUpgradeIndex)
		{
			if (skillLocator.GetSkillUpgrades() == null)
			{
				return false;
			}
			return skillLocator.GetSkillUpgrades()[(int)skillUpgradeIndex];
		}

		public static bool GetSkillUpgradeSelected(this SkillLocator skillLocator, string upgradeId)
		{
			return skillLocator.GetSkillUpgradeSelected(GetSkillUpgradeIndex(upgradeId));
		}

		public static void SetSkillUpgradeSelected(this SkillLocator skillLocator, SkillUpgradeIndex skillUpgradeIndex, bool selected)
		{
			bool[] array = skillLocator.GetSkillUpgrades();
			if (array == null)
			{
				array = new bool[skillUpgradesCount];
			}
			array[(int)skillUpgradeIndex] = selected;
			skillLocator.SetSkillUpgrades(array);
		}

		public static SkillUpgradeIndex GetSkillUpgradeIndex(string upgradeId)
		{
			SkillUpgradeIndex value;
			return idToIndex.TryGetValue(upgradeId, out value) ? value : SkillUpgradeIndex.None;
		}

		public static SkillUpgrade GetSkillUpgrade(SkillUpgradeIndex skillUpgradeIndex)
		{
			return GetSkillUpgrade((int)skillUpgradeIndex);
		}

		public static SkillUpgrade GetSkillUpgrade(int skillUpgradeIndex)
		{
			return _skillUpgrades[skillUpgradeIndex];
		}

		private static bool[] GetSkillUpgrades(this ref BodyInfo bodyInfo)
		{
			return SkillUpgradesTreeInterop.GetSkillUpgrades(ref bodyInfo);
		}

		private static void SetSkillUpgrades(this ref BodyInfo bodyInfo, bool[] bools)
		{
			SkillUpgradesTreeInterop.SetSkillUpgrades(ref bodyInfo, bools);
		}

		private static bool[] GetSkillUpgrades(this BodyLoadout bodyLoadout)
		{
			return SkillUpgradesTreeInterop.GetSkillUpgrades(bodyLoadout);
		}

		private static void SetSkillUpgrades(this BodyLoadout bodyLoadout, bool[] bools)
		{
			SkillUpgradesTreeInterop.SetSkillUpgrades(bodyLoadout, bools);
		}

		private static bool[] GetSkillUpgrades(this SkillLocator skillLocator)
		{
			return SkillUpgradesTreeInterop.GetSkillUpgrades(skillLocator);
		}

		private static void SetSkillUpgrades(this SkillLocator skillLocator, bool[] bools)
		{
			SkillUpgradesTreeInterop.SetSkillUpgrades(skillLocator, bools);
		}

		private static GameObject GetSkillUpgradesTree(this LoadoutPanelController loadoutPanelController)
		{
			return SkillUpgradesTreeInterop.GetSkillUpgradesTree(loadoutPanelController);
		}

		private static void SetSkillUpgradesTree(this LoadoutPanelController loadoutPanelController, GameObject gameObject)
		{
			SkillUpgradesTreeInterop.SetSkillUpgradesTree(loadoutPanelController, gameObject);
		}
	}
	public class SkillUpgradesTreeController : MonoBehaviour
	{
		public SkillUpgradesTreeDef skillTreeAsset;

		public List<SkillUpgrade> runtimeSkills = new List<SkillUpgrade>();

		public UserProfile userProfile;

		public SkillDef targetSkillDef;

		public BodyIndex bodyIndex;

		private bool initialized;

		public void Init()
		{
			if (!initialized)
			{
				InitializeTree();
				initialized = true;
			}
		}

		private void InitializeTree()
		{
			if (!Object.op_Implicit((Object)(object)skillTreeAsset))
			{
				return;
			}
			runtimeSkills.Clear();
			foreach (SkillUpgrade skill in skillTreeAsset.skills)
			{
				runtimeSkills.Add(skill.Clone());
			}
		}

		public bool CanUnlockSkill(string skillId)
		{
			SkillUpgrade skillUpgrade = FindRuntimeSkill(skillId);
			if (skillUpgrade == null)
			{
				return false;
			}
			if (skillUpgrade.isSelected)
			{
				foreach (SkillUpgrade runtimeSkill in runtimeSkills)
				{
					foreach (SkillUpgrade.RequiredUpgrade requiredUpgrade in runtimeSkill.requiredUpgrades)
					{
						if (Utility.IsNullOrWhiteSpace(requiredUpgrade.requiredSkillId) || requiredUpgrade.requiredSkillId != skillUpgrade.id || !runtimeSkill.isSelected)
						{
							continue;
						}
						return false;
					}
				}
			}
			if (!CheckParent(skillUpgrade))
			{
				return false;
			}
			foreach (string item in skillUpgrade.mutuallyExclusiveWith)
			{
				SkillUpgrade skillUpgrade2 = FindRuntimeSkill(item);
				if (skillUpgrade2 != null && skillUpgrade2.isSelected)
				{
					return false;
				}
			}
			return true;
		}

		public bool TryUnlockSkill(string skillId)
		{
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			if (CanUnlockSkill(skillId))
			{
				SkillUpgrade skillUpgrade = FindRuntimeSkill(skillId);
				skillUpgrade.isSelected = !skillUpgrade.isSelected;
				SkillUpgradesTreeApi.Log((skillUpgrade.isSelected ? "Selected" : "Deselected") + " skill: " + skillId);
				userProfile.loadout.bodyLoadoutManager.SetSkillUpgradeSelected(bodyIndex, skillUpgrade.skillUpgradeIndex, skillUpgrade.isSelected);
				userProfile.OnLoadoutChanged();
				return true;
			}
			return false;
		}

		public List<SkillUpgrade> GetActiveAndValidSkillsAsList()
		{
			List<SkillUpgrade> list = new List<SkillUpgrade>();
			foreach (SkillUpgrade runtimeSkill in runtimeSkills)
			{
				if (!runtimeSkill.isSelected || !CheckParent(runtimeSkill))
				{
					continue;
				}
				bool flag = false;
				foreach (string item in runtimeSkill.mutuallyExclusiveWith)
				{
					SkillUpgrade skillUpgrade = FindRuntimeSkill(item);
					if (skillUpgrade != null && skillUpgrade.isSelected)
					{
						flag = true;
						break;
					}
				}
				if (!flag)
				{
					list.Add(runtimeSkill);
				}
			}
			return list;
		}

		public bool[] GetActiveAndValidSkills()
		{
			bool[] array = new bool[SkillUpgradesTreeApi.skillUpgradesCount];
			foreach (SkillUpgrade runtimeSkill in runtimeSkills)
			{
				if (!runtimeSkill.isSelected || !CheckParent(runtimeSkill))
				{
					continue;
				}
				bool flag = false;
				foreach (string item in runtimeSkill.mutuallyExclusiveWith)
				{
					SkillUpgrade skillUpgrade = FindRuntimeSkill(item);
					if (skillUpgrade != null && skillUpgrade.isSelected)
					{
						flag = true;
						break;
					}
				}
				if (!flag)
				{
					array[(int)runtimeSkill.skillUpgradeIndex] = true;
				}
			}
			return array;
		}

		private bool CheckParent(SkillUpgrade skillUpgrade)
		{
			bool flag = false;
			int num = 0;
			bool flag2 = false;
			foreach (SkillUpgrade.RequiredUpgrade requiredUpgrade in skillUpgrade.requiredUpgrades)
			{
				if (Utility.IsNullOrWhiteSpace(requiredUpgrade.requiredSkillId))
				{
					continue;
				}
				SkillUpgrade skillUpgrade2 = FindRuntimeSkill(requiredUpgrade.requiredSkillId);
				if (skillUpgrade2 == null || !skillUpgrade2.isSelected)
				{
					switch (requiredUpgrade.condition)
					{
					case SkillUpgrade.RequiredUpgradeCondition.Required:
						flag = true;
						flag2 = true;
						break;
					case SkillUpgrade.RequiredUpgradeCondition.Selective:
						num++;
						flag2 = true;
						break;
					}
				}
			}
			if (flag2)
			{
				if (flag)
				{
					return false;
				}
				if (num < skillUpgrade.selectiveUpgradesRequired)
				{
					return false;
				}
			}
			return true;
		}

		public SkillUpgrade FindRuntimeSkill(string id)
		{
			return runtimeSkills.Find((SkillUpgrade s) => s.id == id);
		}
	}
	[CreateAssetMenu(menuName = "SkillUpgradesTree/SkillUpgradesTreeDef")]
	public class SkillUpgradesTreeDef : ScriptableObject
	{
		public List<AddressReferencedAsset<SkillDef>> skillsToApply;

		public List<SkillUpgrade> skills = new List<SkillUpgrade>();

		public SkillUpgrade FindSkill(string upgradeId)
		{
			return skills.Find((SkillUpgrade s) => s.id == upgradeId);
		}

		public void Register()
		{
			SkillUpgradesTreeApi.skillUpgradesTreeDefs.Add(this);
		}

		public SkillUpgradeIndex GetSkillUpgradeIndex(string upgradeId)
		{
			return skills.Find((SkillUpgrade s) => s.id == upgradeId).skillUpgradeIndex;
		}
	}
	public class SkillUpgradesTreeUIViewer : MonoBehaviour
	{
		private class CreateConnectingLinesForIncompatibleUpgradesDisplayClass
		{
			public SkillUpgradeButton skillUpgradeButton;

			public SkillUpgradesTreeUIViewer skillUpgradesTreeUIViewer;

			private List<GameObject> incompatibleLines = new List<GameObject>();

			public void CreateConnectingLinesForIncompatibleUpgrades()
			{
				//IL_006a: Unknown result type (might be due to invalid IL or missing references)
				foreach (string item in this.skillUpgradeButton.skillUpgrade.mutuallyExclusiveWith)
				{
					if (!Utility.IsNullOrWhiteSpace(item))
					{
						SkillUpgradeButton skillUpgradeButton = skillUpgradesTreeUIViewer.FindSkillButton(item);
						if (Object.op_Implicit((Object)(object)skillUpgradeButton))
						{
							incompatibleLines.Add(skillUpgradesTreeUIViewer.CreateConnectingLine(skillUpgradeButton.RectTransform, this.skillUpgradeButton.RectTransform, Color.red, 8f, skillUpgradesTreeUIViewer.verticalSpacing / 2f));
						}
					}
				}
			}

			public void DestroyConnectingLinesForIncompatibleUpgrades()
			{
				int count = incompatibleLines.Count;
				for (int i = 0; i < count; i++)
				{
					Object.Destroy((Object)(object)incompatibleLines[i]);
				}
				incompatibleLines.Clear();
			}
		}

		public SkillUpgradesTreeController controller;

		public ScrollRect scrollRect;

		public RectTransform mapContentContainer;

		public float scrollSpeed = 250f;

		public float horizontalSpacing = 150f;

		public float verticalSpacing = -150f;

		public float startYPosition = 400f;

		public float maxDirectionalAngle = 55f;

		public GameObject skillNodePrefab;

		public UILineRenderer linePrefab;

		public TextMeshProUGUI skillNameText;

		public TextMeshProUGUI skillDescriptionText;

		public TextMeshProUGUI skillLoreText;

		public Button btnUp;

		public Button btnDown;

		public Button btnLeft;

		public Button btnRight;

		[HideInInspector]
		public Button skillButton;

		private MPEventSystemLocator mPEventSystemLocator;

		private List<SkillUpgradeButton> spawnedNodes = new List<SkillUpgradeButton>();

		private Vector2 scrollVelocity;

		private Dictionary<string, Vector2> autoCalculatedPositions = new Dictionary<string, Vector2>();

		private bool inittialized;

		public static SkillUpgradesTreeUIViewer instance { get; private set; }

		public void Awake()
		{
			instance = this;
			mPEventSystemLocator = ((Component)this).GetComponent<MPEventSystemLocator>();
		}

		public void Init()
		{
			if (!inittialized)
			{
				SetMaterials();
				ClearNodeDetails();
				GenerateTreeUI();
				SetupNavigationButtons();
				SelectFirstButton();
				inittialized = true;
			}
		}

		private void SelectFirstButton()
		{
			SkillUpgradeButton skillUpgradeButton = spawnedNodes.First();
			if (Object.op_Implicit((Object)(object)skillUpgradeButton))
			{
				HGButton button = skillUpgradeButton.button;
				if (button != null)
				{
					((Selectable)button).Select();
				}
			}
		}

		private void SetMaterials()
		{
			((Graphic)((Component)((Component)this).transform.Find("blur")).GetComponent<Image>()).material = SkillUpgradesTreeApi.BlurMaterial;
			((Component)((Component)this).transform.Find("border")).GetComponent<Image>().sprite = SkillUpgradesTreeApi.BorderSprite;
			((Component)((Component)this).transform.Find("rightpanel")).GetComponent<Image>().sprite = SkillUpgradesTreeApi.PanelSprite;
		}

		private void Update()
		{
			if (inittialized)
			{
				HandleNavigationScroll();
			}
		}

		private void GenerateTreeUI()
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Expected O, but got Unknown
			//IL_015a: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: 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_01b7: Expected O, but got Unknown
			//IL_01cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d6: Expected O, but got Unknown
			//IL_029f: 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_02bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_032b: Unknown result type (might be due to invalid IL or missing references)
			Transform val = null;
			foreach (Transform item in (Transform)mapContentContainer)
			{
				Transform val2 = item;
				if (((Object)((Component)val2).gameObject).name == "core")
				{
					val = val2;
					Image component = ((Component)val).GetComponent<Image>();
					if (Object.op_Implicit((Object)(object)component))
					{
						component.sprite = controller.targetSkillDef.icon;
					}
				}
				else
				{
					Object.Destroy((Object)(object)((Component)val2).gameObject);
				}
			}
			spawnedNodes.Clear();
			autoCalculatedPositions.Clear();
			CalculateProceduralLayouts();
			foreach (SkillUpgrade runtimeSkill in controller.runtimeSkills)
			{
				GameObject val3 = Object.Instantiate<GameObject>(skillNodePrefab, (Transform)(object)mapContentContainer);
				RectTransform component2 = val3.GetComponent<RectTransform>();
				if (autoCalculatedPositions.ContainsKey(runtimeSkill.id))
				{
					component2.anchoredPosition = autoCalculatedPositions[runtimeSkill.id];
				}
				SkillUpgradeButton component3 = val3.GetComponent<SkillUpgradeButton>();
				component3.Setup(runtimeSkill, controller, this);
				if (controller.userProfile.loadout.bodyLoadoutManager.GetSkillUpgradeSelected(controller.bodyIndex, runtimeSkill.skillUpgradeIndex))
				{
					runtimeSkill.isSelected = true;
				}
				component3.UpdateVisuals();
				CreateConnectingLinesForIncompatibleUpgradesDisplayClass createConnectingLinesForIncompatibleUpgradesDisplayClass = new CreateConnectingLinesForIncompatibleUpgradesDisplayClass();
				createConnectingLinesForIncompatibleUpgradesDisplayClass.skillUpgradeButton = component3;
				createConnectingLinesForIncompatibleUpgradesDisplayClass.skillUpgradesTreeUIViewer = this;
				((MPButton)component3.button).onSelect.AddListener(new UnityAction(createConnectingLinesForIncompatibleUpgradesDisplayClass.CreateConnectingLinesForIncompatibleUpgrades));
				((MPButton)component3.button).onDeselect.AddListener(new UnityAction(createConnectingLinesForIncompatibleUpgradesDisplayClass.DestroyConnectingLinesForIncompatibleUpgrades));
				spawnedNodes.Add(component3);
			}
			foreach (SkillUpgradeButton spawnedNode in spawnedNodes)
			{
				SkillUpgrade skillUpgrade = spawnedNode.skillUpgrade;
				int num = 0;
				foreach (SkillUpgrade.RequiredUpgrade requiredUpgrade in skillUpgrade.requiredUpgrades)
				{
					if (Utility.IsNullOrWhiteSpace(requiredUpgrade.requiredSkillId))
					{
						continue;
					}
					SkillUpgradeButton skillUpgradeButton = spawnedNodes.Find((SkillUpgradeButton n) => n.skillUpgrade.id == requiredUpgrade.requiredSkillId);
					if (!((Object)(object)skillUpgradeButton == (Object)null))
					{
						num++;
						Color color = Color.white;
						SkillUpgrade.RequiredUpgradeCondition condition = requiredUpgrade.condition;
						SkillUpgrade.RequiredUpgradeCondition requiredUpgradeCondition = condition;
						if (requiredUpgradeCondition == SkillUpgrade.RequiredUpgradeCondition.Selective)
						{
							color = Color.gray;
						}
						CreateConnectingLine(skillUpgradeButton.RectTransform, spawnedNode.RectTransform, color, 4f, 0f);
					}
				}
				if (num == 0 && Object.op_Implicit((Object)(object)val))
				{
					CreateConnectingLine((RectTransform)(object)((val is RectTransform) ? val : null), spawnedNode.RectTransform, Color.white, 4f, 0f);
				}
			}
			ConfigureExplicitNavigation();
		}

		private void ConfigureExplicitNavigation()
		{
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: 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_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: 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_00c7: Unknown result type (might be due to invalid IL or missing references)
			foreach (SkillUpgradeButton spawnedNode in spawnedNodes)
			{
				Button component = ((Component)spawnedNode).GetComponent<Button>();
				if (Object.op_Implicit((Object)(object)component))
				{
					Vector2 anchoredPosition = spawnedNode.RectTransform.anchoredPosition;
					Button selectOnUp = FindClosestSkillUpgradeButtonInDirection(spawnedNode, anchoredPosition, Vector2.up);
					Button selectOnDown = FindClosestSkillUpgradeButtonInDirection(spawnedNode, anchoredPosition, Vector2.down);
					Button val = FindClosestSkillUpgradeButtonInDirection(spawnedNode, anchoredPosition, Vector2.left);
					Button selectOnRight = FindClosestSkillUpgradeButtonInDirection(spawnedNode, anchoredPosition, Vector2.right);
					Navigation val2 = default(Navigation);
					((Navigation)(ref val2)).mode = (Mode)4;
					((Navigation)(ref val2)).selectOnUp = (Selectable)(object)selectOnUp;
					((Navigation)(ref val2)).selectOnDown = (Selectable)(object)selectOnDown;
					((Navigation)(ref val2)).selectOnLeft = (Selectable)(object)(val ?? skillButton);
					((Navigation)(ref val2)).selectOnRight = (Selectable)(object)selectOnRight;
					Navigation navigation = val2;
					((Selectable)component).navigation = navigation;
				}
			}
		}

		private Button FindClosestSkillUpgradeButtonInDirection(SkillUpgradeButton originNode, Vector2 originPos, Vector2 targetDirection)
		{
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			SkillUpgradeButton skillUpgradeButton = null;
			float num = float.MaxValue;
			foreach (SkillUpgradeButton spawnedNode in spawnedNodes)
			{
				if ((Object)(object)spawnedNode == (Object)(object)originNode)
				{
					continue;
				}
				Vector2 anchoredPosition = spawnedNode.RectTransform.anchoredPosition;
				Vector2 val = anchoredPosition - originPos;
				float magnitude = ((Vector2)(ref val)).magnitude;
				float num2 = Vector2.Angle(targetDirection, ((Vector2)(ref val)).normalized);
				if (!(num2 <= maxDirectionalAngle) || !(magnitude < num))
				{
					continue;
				}
				if (!Utility.IsNullOrWhiteSpace(spawnedNode.skillUpgrade.id) && targetDirection == Vector2.up && originNode.skillUpgrade.requiredUpgrades != null && originNode.skillUpgrade.requiredUpgrades.Count > 0)
				{
					bool flag = false;
					foreach (SkillUpgrade.RequiredUpgrade requiredUpgrade in originNode.skillUpgrade.requiredUpgrades)
					{
						if (spawnedNode.skillUpgrade.id == requiredUpgrade.requiredSkillId)
						{
							flag = true;
							break;
						}
					}
					if (!flag)
					{
						continue;
					}
				}
				num = magnitude;
				skillUpgradeButton = spawnedNode;
			}
			return ((Object)(object)skillUpgradeButton != (Object)null) ? ((Component)skillUpgradeButton).GetComponent<Button>() : null;
		}

		private void CalculateProceduralLayouts()
		{
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			List<SkillUpgrade> list = controller.runtimeSkills.FindAll((SkillUpgrade s) => s.requiredUpgrades.Count == 0);
			float num = (float)(list.Count - 1) * horizontalSpacing;
			float num2 = (0f - num) / 2f;
			Vector2 assignedPosition = default(Vector2);
			for (int num3 = 0; num3 < list.Count; num3++)
			{
				float num4 = num2 + (float)num3 * horizontalSpacing;
				((Vector2)(ref assignedPosition))..ctor(num4, startYPosition);
				LayoutNodeAndChildren(list[num3], assignedPosition);
			}
		}

		private void LayoutNodeAndChildren(SkillUpgrade currentNode, Vector2 assignedPosition)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			autoCalculatedPositions[currentNode.id] = assignedPosition;
			List<SkillUpgrade> list = new List<SkillUpgrade>();
			foreach (SkillUpgrade runtimeSkill in controller.runtimeSkills)
			{
				foreach (SkillUpgrade.RequiredUpgrade requiredUpgrade in runtimeSkill.requiredUpgrades)
				{
					if (requiredUpgrade.requiredSkillId == currentNode.id)
					{
						list.Add(runtimeSkill);
					}
				}
			}
			if (list.Count != 0)
			{
				float num = (float)(list.Count - 1) * horizontalSpacing;
				float num2 = assignedPosition.x - num / 2f;
				float num3 = assignedPosition.y + verticalSpacing;
				Vector2 assignedPosition2 = default(Vector2);
				for (int i = 0; i < list.Count; i++)
				{
					float num4 = num2 + (float)i * horizontalSpacing;
					((Vector2)(ref assignedPosition2))..ctor(num4, num3);
					LayoutNodeAndChildren(list[i], assignedPosition2);
				}
			}
		}

		private GameObject CreateConnectingLine(RectTransform rectTransform1, RectTransform rectTransform2, Color color, float thickness, float addY)
		{
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = Object.Instantiate<GameObject>(((Component)linePrefab).gameObject, ((Component)scrollRect).transform);
			val.transform.SetSiblingIndex(0);
			UIZigZagLineRendererBetweenTransforms component = val.GetComponent<UIZigZagLineRendererBetweenTransforms>();
			component.addY = addY;
			component.startTarget = rectTransform1;
			component.endTarget = rectTransform2;
			((Graphic)component.lineRenderer).color = color;
			component.lineRenderer.LineThickness = thickness;
			return val;
		}

		public void RefreshAllNodes()
		{
			foreach (SkillUpgradeButton spawnedNode in spawnedNodes)
			{
				spawnedNode.UpdateVisuals();
			}
		}

		public void ShowNodeDetails(SkillUpgrade data)
		{
			((TMP_Text)skillNameText).text = ((!Utility.IsNullOrWhiteSpace(data.nameToken)) ? Language.GetString(data.nameToken) : "");
			((TMP_Text)skillDescriptionText).text = ((!Utility.IsNullOrWhiteSpace(data.nameToken)) ? Language.GetString(data.descriptionToken) : "");
			((TMP_Text)skillLoreText).text = ((!Utility.IsNullOrWhiteSpace(data.nameToken)) ? Language.GetString(data.loreToken) : "");
		}

		public void ClearNodeDetails()
		{
			((TMP_Text)skillNameText).text = "";
			((TMP_Text)skillDescriptionText).text = "";
			((TMP_Text)skillLoreText).text = "";
		}

		private void SetupNavigationButtons()
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Expected O, but got Unknown
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Expected O, but got Unknown
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Expected O, but got Unknown
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Expected O, but got Unknown
			((UnityEvent)btnUp.onClick).AddListener((UnityAction)delegate
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				ScrollDirectly(Vector3.down);
			});
			((UnityEvent)btnDown.onClick).AddListener((UnityAction)delegate
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				ScrollDirectly(Vector3.up);
			});
			((UnityEvent)btnLeft.onClick).AddListener((UnityAction)delegate
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				ScrollDirectly(Vector3.right);
			});
			((UnityEvent)btnRight.onClick).AddListener((UnityAction)delegate
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				ScrollDirectly(Vector3.left);
			});
		}

		private void ScrollDirectly(Vector3 direction)
		{
			//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_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)
			float num = 0.15f;
			RectTransform obj = mapContentContainer;
			((Transform)obj).position = ((Transform)obj).position + direction * num;
		}

		private void HandleNavigationScroll()
		{
			//IL_0085: 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_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_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)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_012e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0138: 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_0147: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)mPEventSystemLocator))
			{
				return;
			}
			MPEventSystem eventSystem = mPEventSystemLocator.eventSystem;
			if (!Object.op_Implicit((Object)(object)eventSystem))
			{
				return;
			}
			Player player = eventSystem.player;
			if (player != null)
			{
				Controller lastActiveController = player.controllers.GetLastActiveController((ControllerType)2);
				Vector2 val = ((lastActiveController == null) ? new Vector2(player.GetAxis(0), player.GetAxis(1)) : new Vector2(player.GetAxisRaw(16), player.GetAxisRaw(17)));
				Vector3 val2 = Vector2.op_Implicit(val);
				if (Input.GetKey((KeyCode)119))
				{
					val2.y += 1f;
				}
				if (Input.GetKey((KeyCode)115))
				{
					val2.y -= 1f;
				}
				if (Input.GetKey((KeyCode)97))
				{
					val2.x -= 1f;
				}
				if (Input.GetKey((KeyCode)100))
				{
					val2.x += 1f;
				}
				if (val2 != Vector3.zero)
				{
					RectTransform obj = mapContentContainer;
					((Transform)obj).position = ((Transform)obj).position + val2 * scrollSpeed * -1f * Time.deltaTime;
				}
			}
		}

		public SkillUpgradeButton FindSkillButton(string id)
		{
			return spawnedNodes.Find((SkillUpgradeButton s) => s.skillUpgrade.id == id);
		}
	}
	[AddComponentMenu("UI/Extensions/Primitives/UILineRenderer")]
	[RequireComponent(typeof(RectTransform))]
	public class UILineRenderer : UIPrimitiveBase
	{
		private enum SegmentType
		{
			Start,
			Middle,
			End,
			Full
		}

		public enum JoinType
		{
			Bevel,
			Miter
		}

		public enum BezierType
		{
			None,
			Quick,
			Basic,
			Improved,
			Catenary
		}

		private const float MIN_MITER_JOIN = MathF.PI / 12f;

		private const float MIN_BEVEL_NICE_JOIN = MathF.PI / 6f;

		private static Vector2 UV_TOP_LEFT;

		private static Vector2 UV_BOTTOM_LEFT;

		private static Vector2 UV_TOP_CENTER_LEFT;

		private static Vector2 UV_TOP_CENTER_RIGHT;

		private static Vector2 UV_BOTTOM_CENTER_LEFT;

		private static Vector2 UV_BOTTOM_CENTER_RIGHT;

		private static Vector2 UV_TOP_RIGHT;

		private static Vector2 UV_BOTTOM_RIGHT;

		private static Vector2[] startUvs;

		private static Vector2[] middleUvs;

		private static Vector2[] endUvs;

		private static Vector2[] fullUvs;

		[SerializeField]
		[Tooltip("Points to draw lines between\n Can be improved using the Resolution Option")]
		internal Vector2[] m_points;

		[SerializeField]
		[Tooltip("Segments to be drawn\n This is a list of arrays of points")]
		internal List<Vector2[]> m_segments;

		[SerializeField]
		[Tooltip("Thickness of the line")]
		internal float lineThickness = 2f;

		[SerializeField]
		[Tooltip("Use the relative bounds of the Rect Transform (0,0 -> 0,1) or screen space coordinates")]
		internal bool relativeSize;

		[SerializeField]
		[Tooltip("Do the points identify a single line or split pairs of lines")]
		internal bool lineList;

		[SerializeField]
		[Tooltip("Add end caps to each line\nMultiple caps when used with Line List")]
		internal bool lineCaps;

		[SerializeField]
		[Tooltip("Close the line by joining the last point back to the first\nCompletes the final corner for shapes like boxes")]
		internal bool closedLine;

		[SerializeField]
		[Tooltip("Resolution of the Bezier curve, different to line Resolution")]
		internal int bezierSegmentsPerCurve = 10;

		[Tooltip("The type of Join used between lines, Square/Mitre or Curved/Bevel")]
		public JoinType LineJoins = JoinType.Bevel;

		[Tooltip("Bezier method to apply to line, see docs for options\nCan't be used in conjunction with Resolution as Bezier already changes the resolution")]
		public BezierType BezierMode = BezierType.None;

		[HideInInspector]
		public bool drivenExternally = false;

		public float LineThickness
		{
			get
			{
				return lineThickness;
			}
			set
			{
				lineThickness = value;
				((Graphic)this).SetAllDirty();
			}
		}

		public bool RelativeSize
		{
			get
			{
				return relativeSize;
			}
			set
			{
				relativeSize = value;
				((Graphic)this).SetAllDirty();
			}
		}

		public bool LineList
		{
			get
			{
				return lineList;
			}
			set
			{
				lineList = value;
				((Graphic)this).SetAllDirty();
			}
		}

		public bool LineCaps
		{
			get
			{
				return lineCaps;
			}
			set
			{
				lineCaps = value;
				((Graphic)this).SetAllDirty();
			}
		}

		public bool LineClosed
		{
			get
			{
				return closedLine;
			}
			set
			{
				closedLine = value;
				((Graphic)this).SetAllDirty();
			}
		}

		public int BezierSegmentsPerCurve
		{
			get
			{
				return bezierSegmentsPerCurve;
			}
			set
			{
				bezierSegmentsPerCurve = value;
			}
		}

		public Vector2[] Points
		{
			get
			{
				return m_points;
			}
			set
			{
				if (m_points != value)
				{
					if (value == null || value.Length == 0)
					{
						m_points = (Vector2[])(object)new Vector2[1];
					}
					else
					{
						m_points = value;
					}
					((Graphic)this).SetAllDirty();
				}
			}
		}

		public List<Vector2[]> Segments
		{
			get
			{
				return m_segments;
			}
			set
			{
				m_segments = value;
				((Graphic)this).SetAllDirty();
			}
		}

		private void PopulateMesh(VertexHelper vh, Vector2[] pointsToDraw)
		{
			//IL_0128: 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_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_014b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0150: Unknown result type (might be due to invalid IL or missing references)
			//IL_016f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0174: Unknown result type (might be due to invalid IL or missing references)
			//IL_018b: Unknown result type (might be due to invalid IL or missing references)
			//IL_019f: Unknown result type (might be due to invalid IL or missing references)
			//IL_029f: 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_02a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_02da: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0202: Unknown result type (might be due to invalid IL or missing references)
			//IL_020d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0241: Unknown result type (might be due to invalid IL or missing references)
			//IL_0243: Unknown result type (might be due to invalid IL or missing references)
			//IL_022d: Unknown result type (might be due to invalid IL or missing references)
			//IL_022f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0262: Unknown result type (might be due to invalid IL or missing references)
			//IL_0264: Unknown result type (might be due to invalid IL or missing references)
			//IL_0320: Unknown result type (might be due to invalid IL or missing references)
			//IL_0322: Unknown result type (might be due to invalid IL or missing references)
			//IL_030c: Unknown result type (might be due to invalid IL or missing references)
			//IL_030e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0357: Unknown result type (might be due to invalid IL or missing references)
			//IL_0359: Unknown result type (might be due to invalid IL or missing references)
			if (BezierMode != BezierType.None && BezierMode != BezierType.Catenary && pointsToDraw.Length > 3)
			{
				BezierPath bezierPath = new BezierPath();
				bezierPath.SetControlPoints(pointsToDraw);
				bezierPath.SegmentsPerCurve = bezierSegmentsPerCurve;
				pointsToDraw = (BezierMode switch
				{
					BezierType.Basic => bezierPath.GetDrawingPoints0(), 
					BezierType.Improved => bezierPath.GetDrawingPoints1(), 
					_ => bezierPath.GetDrawingPoints2(), 
				}).ToArray();
			}
			if (BezierMode == BezierType.Catenary && pointsToDraw.Length == 2)
			{
				CableCurve cableCurve = new CableCurve(pointsToDraw);
				cableCurve.slack = base.Resolution;
				cableCurve.steps = BezierSegmentsPerCurve;
				pointsToDraw = cableCurve.Points();
			}
			if (base.ImproveResolution != ResolutionMode.None)
			{
				pointsToDraw = IncreaseResolution(pointsToDraw);
			}
			if (closedLine && !lineList && pointsToDraw.Length > 2 && pointsToDraw[0] != pointsToDraw[^1])
			{
				List<Vector2> list = new List<Vector2>(pointsToDraw);
				list.Add(pointsToDraw[0]);
				pointsToDraw = list.ToArray();
			}
			Rect rect;
			float num;
			if (relativeSize)
			{
				rect = ((Graphic)this).rectTransform.rect;
				num = ((Rect)(ref rect)).width;
			}
			else
			{
				num = 1f;
			}
			float num2 = num;
			float num3;
			if (relativeSize)
			{
				rect = ((Graphic)this).rectTransform.rect;
				num3 = ((Rect)(ref rect)).height;
			}
			else
			{
				num3 = 1f;
			}
			float num4 = num3;
			float num5 = (0f - ((Graphic)this).rectTransform.pivot.x) * num2;
			float num6 = (0f - ((Graphic)this).rectTransform.pivot.y) * num4;
			List<UIVertex[]> list2 = new List<UIVertex[]>();
			if (lineList)
			{
				for (int i = 1; i < pointsToDraw.Length; i += 2)
				{
					Vector2 val = pointsToDraw[i - 1];
					Vector2 val2 = pointsToDraw[i];
					((Vector2)(ref v

plugins/SkillUpgradesTreeInterop.dll

Decompiled a day ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using Microsoft.CodeAnalysis;
using RoR2;
using RoR2.UI;
using UnityEngine;

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

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

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

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

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace SkillUpgradesTree
{
	public static class SkillUpgradesTreeInterop
	{
		public static bool[] GetSkillUpgrades(ref BodyInfo bodyInfo)
		{
			return bodyInfo.sut_skillUpgrades;
		}

		public static void SetSkillUpgrades(ref BodyInfo bodyInfo, bool[] bools)
		{
			bodyInfo.sut_skillUpgrades = bools;
		}

		public static bool[] GetSkillUpgrades(BodyLoadout bodyLoadout)
		{
			return bodyLoadout.sut_skillUpgrades;
		}

		public static void SetSkillUpgrades(BodyLoadout bodyLoadout, bool[] bools)
		{
			bodyLoadout.sut_skillUpgrades = bools;
		}

		public static bool[] GetSkillUpgrades(SkillLocator skillLocator)
		{
			return skillLocator.sut_skillUpgrades;
		}

		public static void SetSkillUpgrades(SkillLocator skillLocator, bool[] bools)
		{
			skillLocator.sut_skillUpgrades = bools;
		}

		public static GameObject GetSkillUpgradesTree(LoadoutPanelController loadoutPanelController)
		{
			return loadoutPanelController.sut_skillUpgradesTree;
		}

		public static void SetSkillUpgradesTree(LoadoutPanelController loadoutPanelController, GameObject gameObject)
		{
			loadoutPanelController.sut_skillUpgradesTree = gameObject;
		}
	}
}