Decompiled source of AlmanacClassSystem v0.3.3

AlmanacClasses.dll

Decompiled 2 days ago
using System;
using System.Collections;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Serialization;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Cryptography;
using System.Security.Permissions;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using AlmanacClasses.Classes;
using AlmanacClasses.Classes.Abilities;
using AlmanacClasses.Data;
using AlmanacClasses.FileSystem;
using AlmanacClasses.LoadAssets;
using AlmanacClasses.Managers;
using AlmanacClasses.UI;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using JetBrains.Annotations;
using KG_Managers;
using Microsoft.CodeAnalysis;
using PieceManager;
using ServerSync;
using TMPro;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.Events;
using UnityEngine.UI;
using YamlDotNet.Core;
using YamlDotNet.Core.Events;
using YamlDotNet.Core.Tokens;
using YamlDotNet.Helpers;
using YamlDotNet.Serialization;
using YamlDotNet.Serialization.BufferedDeserialization;
using YamlDotNet.Serialization.BufferedDeserialization.TypeDiscriminators;
using YamlDotNet.Serialization.Converters;
using YamlDotNet.Serialization.EventEmitters;
using YamlDotNet.Serialization.NamingConventions;
using YamlDotNet.Serialization.NodeDeserializers;
using YamlDotNet.Serialization.NodeTypeResolvers;
using YamlDotNet.Serialization.ObjectFactories;
using YamlDotNet.Serialization.ObjectGraphTraversalStrategies;
using YamlDotNet.Serialization.ObjectGraphVisitors;
using YamlDotNet.Serialization.Schemas;
using YamlDotNet.Serialization.TypeInspectors;
using YamlDotNet.Serialization.TypeResolvers;
using YamlDotNet.Serialization.Utilities;
using YamlDotNet.Serialization.ValueDeserializers;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("AlmanacClasses")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyProduct("AlmanacClasses")]
[assembly: AssemblyCopyright("Copyright ©  2021")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("4358610B-F3F4-4843-B7AF-98B7BC60DCDE")]
[assembly: AssemblyFileVersion("0.3.5")]
[assembly: AssemblyCompany("RustyMods")]
[assembly: TargetFramework(".NETFramework,Version=v4.6.2", FrameworkDisplayName = ".NET Framework 4.6.2")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.3.5.0")]
[module: UnverifiableCode]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[<d762bb42-9529-4edf-94db-30df697f2043>Embedded]
	internal sealed class <d762bb42-9529-4edf-94db-30df697f2043>EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[<d762bb42-9529-4edf-94db-30df697f2043>Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class <f6442f0f-673c-492e-ad8c-a65f77e6488d>NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public <f6442f0f-673c-492e-ad8c-a65f77e6488d>NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public <f6442f0f-673c-492e-ad8c-a65f77e6488d>NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[<d762bb42-9529-4edf-94db-30df697f2043>Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class <29670a2c-1b04-46dc-8312-7721bf20b209>NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public <29670a2c-1b04-46dc-8312-7721bf20b209>NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
namespace PieceManager
{
	[<29670a2c-1b04-46dc-8312-7721bf20b209>NullableContext(1)]
	[<f6442f0f-673c-492e-ad8c-a65f77e6488d>Nullable(0)]
	[PublicAPI]
	public static class MaterialReplacer
	{
		[<29670a2c-1b04-46dc-8312-7721bf20b209>NullableContext(0)]
		public enum ShaderType
		{
			PieceShader,
			VegetationShader,
			RockShader,
			RugShader,
			GrassShader,
			CustomCreature,
			UseUnityShader
		}

		private static readonly Dictionary<GameObject, bool> ObjectToSwap;

		private static readonly Dictionary<string, Material> OriginalMaterials;

		private static readonly Dictionary<GameObject, ShaderType> ObjectsForShaderReplace;

		private static readonly HashSet<Shader> CachedShaders;

		private static bool hasRun;

		static MaterialReplacer()
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Expected O, but got Unknown
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Expected O, but got Unknown
			CachedShaders = new HashSet<Shader>();
			hasRun = false;
			OriginalMaterials = new Dictionary<string, Material>();
			ObjectToSwap = new Dictionary<GameObject, bool>();
			ObjectsForShaderReplace = new Dictionary<GameObject, ShaderType>();
			Harmony val = new Harmony("org.bepinex.helpers.PieceManager");
			val.Patch((MethodBase)AccessTools.DeclaredMethod(typeof(ZoneSystem), "Start", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(typeof(MaterialReplacer), "ReplaceAllMaterialsWithOriginal", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
		}

		public static void RegisterGameObjectForShaderSwap(GameObject go, ShaderType type)
		{
			if (!ObjectsForShaderReplace.ContainsKey(go))
			{
				ObjectsForShaderReplace.Add(go, type);
			}
		}

		public static void RegisterGameObjectForMatSwap(GameObject go, bool isJotunnMock = false)
		{
			if (!ObjectToSwap.ContainsKey(go))
			{
				ObjectToSwap.Add(go, isJotunnMock);
			}
		}

		private static void GetAllMaterials()
		{
			Material[] array = Resources.FindObjectsOfTypeAll<Material>();
			foreach (Material val in array)
			{
				OriginalMaterials[((Object)val).name] = val;
			}
		}

		[HarmonyPriority(700)]
		private static void ReplaceAllMaterialsWithOriginal()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Invalid comparison between Unknown and I4
			if ((int)SystemInfo.graphicsDeviceType == 4 || hasRun)
			{
				return;
			}
			if (OriginalMaterials.Count == 0)
			{
				GetAllMaterials();
			}
			foreach (KeyValuePair<GameObject, bool> item in ObjectToSwap)
			{
				GameObject key = item.Key;
				bool value = item.Value;
				ProcessGameObjectMaterials(key, value);
			}
			AssetBundle[] array = Resources.FindObjectsOfTypeAll<AssetBundle>();
			AssetBundle[] array2 = array;
			foreach (AssetBundle val in array2)
			{
				IEnumerable<Shader> enumerable3;
				try
				{
					IEnumerable<Shader> enumerable2;
					if (!val.isStreamedSceneAssetBundle || !Object.op_Implicit((Object)(object)val))
					{
						IEnumerable<Shader> enumerable = val.LoadAllAssets<Shader>();
						enumerable2 = enumerable;
					}
					else
					{
						enumerable2 = from shader in ((IEnumerable<string>)val.GetAllAssetNames()).Select((Func<string, Shader>)val.LoadAsset<Shader>)
							where (Object)(object)shader != (Object)null
							select shader;
					}
					enumerable3 = enumerable2;
				}
				catch (Exception)
				{
					continue;
				}
				if (enumerable3 == null)
				{
					continue;
				}
				foreach (Shader item2 in enumerable3)
				{
					CachedShaders.Add(item2);
				}
			}
			foreach (KeyValuePair<GameObject, ShaderType> item3 in ObjectsForShaderReplace)
			{
				GameObject key2 = item3.Key;
				ShaderType value2 = item3.Value;
				ProcessGameObjectShaders(key2, value2);
			}
			hasRun = true;
		}

		private static void ProcessGameObjectMaterials(GameObject go, bool isJotunnMock)
		{
			Renderer[] componentsInChildren = go.GetComponentsInChildren<Renderer>(true);
			Renderer[] array = componentsInChildren;
			foreach (Renderer val in array)
			{
				Material[] sharedMaterials = val.sharedMaterials.Select([<29670a2c-1b04-46dc-8312-7721bf20b209>NullableContext(0)] (Material material) => ReplaceMaterial(material, isJotunnMock)).ToArray();
				val.sharedMaterials = sharedMaterials;
			}
		}

		private static Material ReplaceMaterial(Material originalMaterial, bool isJotunnMock)
		{
			string text = (isJotunnMock ? "JVLmock_" : "_REPLACE_");
			if (!((Object)originalMaterial).name.StartsWith(text, StringComparison.Ordinal))
			{
				return originalMaterial;
			}
			string text2 = ((Object)originalMaterial).name.Replace(" (Instance)", "").Replace(text, "");
			if (OriginalMaterials.TryGetValue(text2, out var value))
			{
				return value;
			}
			Debug.LogWarning((object)("No suitable material found to replace: " + text2));
			return originalMaterial;
		}

		private static void ProcessGameObjectShaders(GameObject go, ShaderType shaderType)
		{
			Renderer[] componentsInChildren = go.GetComponentsInChildren<Renderer>(true);
			Renderer[] array = componentsInChildren;
			foreach (Renderer val in array)
			{
				Material[] sharedMaterials = val.sharedMaterials;
				foreach (Material val2 in sharedMaterials)
				{
					if ((Object)(object)val2 != (Object)null)
					{
						val2.shader = GetShaderForType(val2.shader, shaderType, ((Object)val2.shader).name);
					}
				}
			}
		}

		private static Shader GetShaderForType(Shader orig, ShaderType shaderType, string originalShaderName)
		{
			return (Shader)(shaderType switch
			{
				ShaderType.PieceShader => FindShaderWithName(orig, "Custom/Piece"), 
				ShaderType.VegetationShader => FindShaderWithName(orig, "Custom/Vegetation"), 
				ShaderType.RockShader => FindShaderWithName(orig, "Custom/StaticRock"), 
				ShaderType.RugShader => FindShaderWithName(orig, "Custom/Rug"), 
				ShaderType.GrassShader => FindShaderWithName(orig, "Custom/Grass"), 
				ShaderType.CustomCreature => FindShaderWithName(orig, "Custom/Creature"), 
				ShaderType.UseUnityShader => FindShaderWithName(orig, ((Object)(object)FindShaderWithName(orig, originalShaderName) != (Object)null) ? originalShaderName : "ToonDeferredShading2017"), 
				_ => FindShaderWithName(orig, "Standard"), 
			});
		}

		public static Shader FindShaderWithName(Shader origShader, string name)
		{
			foreach (Shader cachedShader in CachedShaders)
			{
				if (((Object)cachedShader).name == name)
				{
					return cachedShader;
				}
			}
			return origShader;
		}
	}
}
namespace KG_Managers
{
	[<29670a2c-1b04-46dc-8312-7721bf20b209>NullableContext(1)]
	[<f6442f0f-673c-492e-ad8c-a65f77e6488d>Nullable(0)]
	public static class AnimationReplaceManager
	{
		[<29670a2c-1b04-46dc-8312-7721bf20b209>NullableContext(0)]
		[HarmonyPatch(typeof(Player), "Start")]
		[HarmonyPriority(10000)]
		private static class Player_Start_Patch
		{
			[<29670a2c-1b04-46dc-8312-7721bf20b209>NullableContext(1)]
			private static void Postfix(ref Player __instance)
			{
				if (FirstInit)
				{
					return;
				}
				FirstInit = true;
				VanillaController = MakeAOC(new Dictionary<string, string>(), ((Character)__instance).m_animator.runtimeAnimatorController);
				((Object)VanillaController).name = "VanillaController";
				foreach (List<string> allAnimationSet in AllAnimationSets)
				{
					Dictionary<string, string> dictionary = new Dictionary<string, string>();
					for (int i = 0; i < allAnimationSet.Count; i++)
					{
						dictionary.Add($"Attack{i + 1}", allAnimationSet[i]);
					}
					RuntimeAnimatorController val = MakeAOC(dictionary, ((Character)__instance).m_animator.runtimeAnimatorController);
					((Object)val).name = AssemblyName();
					for (int j = 0; j < allAnimationSet.Count; j++)
					{
						Controllers[allAnimationSet[j]] = new KeyValuePair<RuntimeAnimatorController, string>(val, $"swing_longsword{j}");
					}
				}
			}
		}

		[<29670a2c-1b04-46dc-8312-7721bf20b209>NullableContext(0)]
		[HarmonyPatch(typeof(ZSyncAnimation), "RPC_SetTrigger")]
		private static class ZSyncAnimation_RPC_SetTrigger_Patch
		{
			[<29670a2c-1b04-46dc-8312-7721bf20b209>NullableContext(1)]
			private static bool Prefix(ZSyncAnimation __instance, string name)
			{
				if (Controllers.TryGetValue(name, out var value))
				{
					ReplacePlayerRAC(__instance.m_animator, value.Key);
					__instance.m_animator.SetTrigger(value.Value);
					return false;
				}
				if (((Object)__instance.m_animator.runtimeAnimatorController).name == AssemblyName())
				{
					ReplacePlayerRAC(__instance.m_animator, VanillaController);
				}
				return true;
			}
		}

		private static bool FirstInit;

		private static RuntimeAnimatorController VanillaController;

		[<f6442f0f-673c-492e-ad8c-a65f77e6488d>Nullable(new byte[] { 1, 1, 0, 1, 1 })]
		private static readonly Dictionary<string, KeyValuePair<RuntimeAnimatorController, string>> Controllers = new Dictionary<string, KeyValuePair<RuntimeAnimatorController, string>>();

		private static readonly Dictionary<string, AnimationClip> AllExternalAnimations = new Dictionary<string, AnimationClip>();

		private static readonly List<List<string>> AllAnimationSets = new List<List<string>>();

		private static string _asmName;

		private static string AssemblyName()
		{
			return _asmName ?? (_asmName = Assembly.GetExecutingAssembly().GetName().Name);
		}

		private static AssetBundle GetAssetBundle(string filename)
		{
			Assembly executingAssembly = Assembly.GetExecutingAssembly();
			string name = executingAssembly.GetManifestResourceNames().Single([<29670a2c-1b04-46dc-8312-7721bf20b209>NullableContext(0)] (string str) => str.EndsWith(filename));
			using Stream stream = executingAssembly.GetManifestResourceStream(name);
			return AssetBundle.LoadFromStream(stream);
		}

		public static void AddAnimationSet(string AssetBundle, string attack1, string attack2 = null, string attack3 = null)
		{
			AssetBundle val = AssetBundle.GetAllLoadedAssetBundles().FirstOrDefault((Func<AssetBundle, bool>)([<29670a2c-1b04-46dc-8312-7721bf20b209>NullableContext(0)] (AssetBundle x) => ((Object)x).name == AssetBundle)) ?? GetAssetBundle(AssetBundle);
			List<string> list = new List<string> { attack1 };
			AllExternalAnimations[attack1] = val.LoadAsset<AnimationClip>(attack1);
			if (attack2 != null)
			{
				list.Add(attack2);
			}
			if (attack3 != null)
			{
				list.Add(attack3);
			}
			if (attack2 != null)
			{
				AllExternalAnimations[attack2] = val.LoadAsset<AnimationClip>(attack2);
			}
			if (attack3 != null)
			{
				AllExternalAnimations[attack3] = val.LoadAsset<AnimationClip>(attack3);
			}
			AllAnimationSets.Add(list);
		}

		public static void AddAnimationSet(AnimationClip attack1, AnimationClip attack2 = null, AnimationClip attack3 = null)
		{
			List<string> list = new List<string> { ((Object)attack1).name };
			AllExternalAnimations[((Object)attack1).name] = attack1;
			if ((Object)(object)attack2 != (Object)null)
			{
				list.Add(((Object)attack2).name);
			}
			if ((Object)(object)attack3 != (Object)null)
			{
				list.Add(((Object)attack3).name);
			}
			if ((Object)(object)attack2 != (Object)null)
			{
				AllExternalAnimations[((Object)attack2).name] = attack2;
			}
			if ((Object)(object)attack3 != (Object)null)
			{
				AllExternalAnimations[((Object)attack3).name] = attack3;
			}
			AllAnimationSets.Add(list);
		}

		private static void ReplacePlayerRAC(Animator anim, RuntimeAnimatorController rac)
		{
			if (!((Object)(object)anim.runtimeAnimatorController == (Object)(object)rac))
			{
				anim.runtimeAnimatorController = rac;
				anim.Update(0f);
			}
		}

		private static RuntimeAnimatorController MakeAOC(Dictionary<string, string> replacement, RuntimeAnimatorController ORIGINAL)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			AnimatorOverrideController val = new AnimatorOverrideController(ORIGINAL);
			List<KeyValuePair<AnimationClip, AnimationClip>> list = new List<KeyValuePair<AnimationClip, AnimationClip>>();
			AnimationClip[] animationClips = ((RuntimeAnimatorController)val).animationClips;
			foreach (AnimationClip val2 in animationClips)
			{
				string name = ((Object)val2).name;
				if (replacement.TryGetValue(name, out var value))
				{
					AnimationClip value2 = Object.Instantiate<AnimationClip>(AllExternalAnimations[value]);
					list.Add(new KeyValuePair<AnimationClip, AnimationClip>(val2, value2));
				}
				else
				{
					list.Add(new KeyValuePair<AnimationClip, AnimationClip>(val2, val2));
				}
			}
			val.ApplyOverrides((IList<KeyValuePair<AnimationClip, AnimationClip>>)list);
			return (RuntimeAnimatorController)(object)val;
		}
	}
}
namespace AlmanacClasses
{
	[BepInPlugin("RustyMods.AlmanacClasses", "AlmanacClasses", "0.3.5")]
	[<f6442f0f-673c-492e-ad8c-a65f77e6488d>Nullable(0)]
	[<29670a2c-1b04-46dc-8312-7721bf20b209>NullableContext(1)]
	public class AlmanacClassesPlugin : BaseUnityPlugin
	{
		[<29670a2c-1b04-46dc-8312-7721bf20b209>NullableContext(0)]
		public enum Toggle
		{
			On = 1,
			Off = 0
		}

		[<29670a2c-1b04-46dc-8312-7721bf20b209>NullableContext(0)]
		private class ConfigurationManagerAttributes
		{
			[UsedImplicitly]
			public int? Order;

			[UsedImplicitly]
			public bool? Browsable;

			[UsedImplicitly]
			[<f6442f0f-673c-492e-ad8c-a65f77e6488d>Nullable(2)]
			public string Category;

			[<f6442f0f-673c-492e-ad8c-a65f77e6488d>Nullable(new byte[] { 2, 1 })]
			[UsedImplicitly]
			public Action<ConfigEntryBase> CustomDrawer;
		}

		internal const string ModName = "AlmanacClasses";

		internal const string ModVersion = "0.3.5";

		internal const string Author = "RustyMods";

		private const string ModGUID = "RustyMods.AlmanacClasses";

		private static readonly string ConfigFileName = "RustyMods.AlmanacClasses.cfg";

		private static readonly string ConfigFileFullPath;

		internal static string ConnectionError;

		private readonly Harmony _harmony = new Harmony("RustyMods.AlmanacClasses");

		public static readonly ManualLogSource AlmanacClassesLogger;

		public static readonly ConfigSync ConfigSync;

		public static readonly AssetBundle _AssetBundle;

		public static AlmanacClassesPlugin _Plugin;

		public static GameObject _Root;

		private static ConfigEntry<Toggle> _serverConfigLocked;

		public static ConfigEntry<int> _PrestigeThreshold;

		public static ConfigEntry<int> _ResetCost;

		public static ConfigEntry<Toggle> _DisplayExperience;

		public static ConfigEntry<Vector2> _ExperienceBarPos;

		public static ConfigEntry<float> _ExperienceBarScale;

		public static ConfigEntry<Toggle> _HudVisible;

		public static ConfigEntry<Vector2> _SpellBookPos;

		private static ConfigEntry<Toggle> _PanelBackground;

		public static ConfigEntry<int> _ExperienceMultiplier;

		public static ConfigEntry<int> _TalentPointPerLevel;

		public static ConfigEntry<int> _TalentPointsPerTenLevel;

		public static ConfigEntry<Vector2> _MenuTooltipPosition;

		public static ConfigEntry<int> _ChanceForOrb;

		public static ConfigEntry<int> _MaxEitr;

		public static ConfigEntry<int> _MaxHealth;

		public static ConfigEntry<int> _MaxStamina;

		public static ConfigEntry<int> _EitrRatio;

		public static ConfigEntry<int> _HealthRatio;

		public static ConfigEntry<int> _StaminaRatio;

		public static ConfigEntry<int> _DamageRatio;

		public static ConfigEntry<KeyCode> _SpellAlt;

		public static ConfigEntry<KeyCode> _Spell1;

		public static ConfigEntry<KeyCode> _Spell2;

		public static ConfigEntry<KeyCode> _Spell3;

		public static ConfigEntry<KeyCode> _Spell4;

		public static ConfigEntry<KeyCode> _Spell5;

		public static ConfigEntry<KeyCode> _Spell6;

		public static ConfigEntry<KeyCode> _Spell7;

		public static ConfigEntry<KeyCode> _Spell8;

		public static ConfigEntry<SpawnSystem.SpawnOptions> _RangerMeadowSpawn;

		public static ConfigEntry<SpawnSystem.SpawnOptions> _RangerBlackForestSpawn;

		public static ConfigEntry<SpawnSystem.SpawnOptions> _RangerSwampSpawn;

		public static ConfigEntry<SpawnSystem.SpawnOptions> _RangerMountainSpawn;

		public static ConfigEntry<SpawnSystem.SpawnOptions> _RangerPlainsSpawn;

		public static ConfigEntry<SpawnSystem.SpawnOptions> _RangerMistLandsSpawn;

		public static ConfigEntry<SpawnSystem.SpawnOptions> _RangerAshlandSpawn;

		public static ConfigEntry<SpawnSystem.SpawnOptions> _RangerDeepNorthSpawn;

		public static ConfigEntry<SpawnSystem.SpawnOptions> _RangerOceanSpawn;

		public static ConfigEntry<string> _HunterMeadows;

		public static ConfigEntry<string> _HunterBlackForest;

		public static ConfigEntry<string> _HunterSwamp;

		public static ConfigEntry<string> _HunterMountain;

		public static ConfigEntry<string> _HunterPlains;

		public static ConfigEntry<string> _HunterMistLands;

		public static ConfigEntry<string> _HunterAshLands;

		public static ConfigEntry<string> _HunterDeepNorth;

		public static ConfigEntry<string> _HunterOcean;

		public static ConfigEntry<SpawnSystem.SpawnOptions> _ShamanSpawn;

		public static ConfigEntry<float> _MasterChefIncrease;

		public static ConfigEntry<float> _LumberjackIncrease;

		public static ConfigEntry<Toggle> _UseBattleFury;

		public static ConfigEntry<Toggle> _BattleFuryFX;

		public static ConfigEntry<Toggle> _UseSurvivor;

		public static ConfigEntry<float> _SurvivorLength;

		public static ConfigEntry<Toggle> _SurvivorFX;

		public void Awake()
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			Localizer.Load();
			_Plugin = this;
			_Root = new GameObject("almanac_classes_root");
			Object.DontDestroyOnLoad((Object)(object)_Root);
			_Root.SetActive(false);
			InitConfigs();
			FilePaths.CreateFolders();
			LoadPieces.LoadClassAltar();
			AnimationReplaceManager.AddAnimationSet("classesbundle", "LutePlay");
			AnimationReplaceManager.AddAnimationSet("classesbundle", "StoneThrow");
			Assembly executingAssembly = Assembly.GetExecutingAssembly();
			_harmony.PatchAll(executingAssembly);
			SetupWatcher();
		}

		public void Update()
		{
			TalentBook.UpdateTalentBookUI();
			AbilityManager.CheckInput();
			SpellElementChange.UpdateSpellMouseElement();
			ExperienceBarMove.UpdateElement();
			SpellBarMove.UpdateElement();
		}

		private void OnDestroy()
		{
			((BaseUnityPlugin)this).Config.Save();
		}

		private static AssetBundle GetAssetBundle(string fileName)
		{
			Assembly executingAssembly = Assembly.GetExecutingAssembly();
			string name = executingAssembly.GetManifestResourceNames().Single([<29670a2c-1b04-46dc-8312-7721bf20b209>NullableContext(0)] (string str) => str.EndsWith(fileName));
			using Stream stream = executingAssembly.GetManifestResourceStream(name);
			return AssetBundle.LoadFromStream(stream);
		}

		private void SetupWatcher()
		{
			FileSystemWatcher fileSystemWatcher = new FileSystemWatcher(Paths.ConfigPath, ConfigFileName);
			fileSystemWatcher.Changed += ReadConfigValues;
			fileSystemWatcher.Created += ReadConfigValues;
			fileSystemWatcher.Renamed += ReadConfigValues;
			fileSystemWatcher.IncludeSubdirectories = true;
			fileSystemWatcher.SynchronizingObject = ThreadingHelper.SynchronizingObject;
			fileSystemWatcher.EnableRaisingEvents = true;
		}

		private void ReadConfigValues(object sender, FileSystemEventArgs e)
		{
			if (!File.Exists(ConfigFileFullPath))
			{
				return;
			}
			try
			{
				AlmanacClassesLogger.LogDebug((object)"ReadConfigValues called");
				((BaseUnityPlugin)this).Config.Reload();
			}
			catch
			{
				AlmanacClassesLogger.LogError((object)("There was an issue loading your " + ConfigFileName));
				AlmanacClassesLogger.LogError((object)"Please check your config entries for spelling and format!");
			}
		}

		private void InitConfigs()
		{
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Expected O, but got Unknown
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Expected O, but got Unknown
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Expected O, but got Unknown
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: Expected O, but got Unknown
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_0124: Expected O, but got Unknown
			//IL_014b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0156: Expected O, but got Unknown
			//IL_017a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0185: Expected O, but got Unknown
			//IL_02d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02de: Expected O, but got Unknown
			//IL_030c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0317: Expected O, but got Unknown
			//IL_04e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f2: Expected O, but got Unknown
			_serverConfigLocked = config("1 - General", "Lock Configuration", Toggle.On, "If on, the configuration is locked and can be changed by server admins only.");
			ConfigSync.AddLockingConfigEntry<Toggle>(_serverConfigLocked);
			InitSettingsConfigs();
			InitKeyCodeConfigs();
			_EitrRatio = config("4 - Characteristics", "1. Eitr Ratio", 2, new ConfigDescription("Set the amount of wisdom points required for 1 eitr", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 10), Array.Empty<object>()));
			_HealthRatio = config("4 - Characteristics", "3. Health Ratio", 1, new ConfigDescription("Set the amount of constitution points for 1 health", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 10), Array.Empty<object>()));
			_StaminaRatio = config("4 - Characteristics", "5. Stamina Ratio", 3, new ConfigDescription("Set the amount of dexterity points for 1 stamina", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 10), Array.Empty<object>()));
			_MaxEitr = config("4 - Characteristics", "2. Max Eitr", 100, new ConfigDescription("Set max amount of eitr that can be gained from characteristic points", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 500), Array.Empty<object>()));
			_MaxHealth = config("4 - Characteristics", "4. Max Health", 100, new ConfigDescription("Set max amount of health that can be gained from characteristic points", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 500), Array.Empty<object>()));
			_MaxStamina = config("4 - Characteristics", "6. Max Stamina", 100, new ConfigDescription("Set max amount of stamina that can be gained from characteristic points", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 500), Array.Empty<object>()));
			_DamageRatio = config("4 - Characteristics", "7. Damage Ratio", 10, new ConfigDescription("Set the ratio of strength, dexterity, intelligence to increased damage output of, melee, ranged and magic damage", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 20), Array.Empty<object>()));
			_RangerMeadowSpawn = config("Ranger - Creature Mask", "1. Meadows", SpawnSystem.SpawnOptions.Neck, "Set friendly spawn");
			_RangerBlackForestSpawn = config("Ranger - Creature Mask", "2. Black Forest", SpawnSystem.SpawnOptions.Greydwarf, "Set friendly spawn");
			_RangerSwampSpawn = config("Ranger - Creature Mask", "3. Swamp", SpawnSystem.SpawnOptions.Draugr, "Set friendly spawn");
			_RangerMountainSpawn = config("Ranger - Creature Mask", "4. Mountain", SpawnSystem.SpawnOptions.Ulv, "Set friendly spawn");
			_RangerPlainsSpawn = config("Ranger - Creature Mask", "5. Plains", SpawnSystem.SpawnOptions.Deathsquito, "Set friendly spawn");
			_RangerMistLandsSpawn = config("Ranger - Creature Mask", "6. Mistlands", SpawnSystem.SpawnOptions.Tick, "Set friendly spawn");
			_RangerAshlandSpawn = config("Ranger - Creature Mask", "7. Ashlands", SpawnSystem.SpawnOptions.Surtling, "Set friendly spawn");
			_RangerDeepNorthSpawn = config("Ranger - Creature Mask", "8. Deep North", SpawnSystem.SpawnOptions.Fenring_Cultist, "Set friendly spawn");
			_RangerOceanSpawn = config("Ranger - Creature Mask", "9. Ocean", SpawnSystem.SpawnOptions.Serpent, "Set friendly spawn");
			_ShamanSpawn = config("Shaman - Ghastly Ambitions", "Creature", SpawnSystem.SpawnOptions.Ghost, "Set friendly spawn");
			_MasterChefIncrease = config("General - Master Chef", "Food Boost", 1.1f, new ConfigDescription("Set the modifier for food benefit, multiplied by prestige level", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 2f), Array.Empty<object>()));
			_LumberjackIncrease = config("General - Lumberjack", "Chop Damage Boost", 1.1f, new ConfigDescription("Set the amount of chop damage increase, multiplied by prestige level", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 2f), Array.Empty<object>()));
			_HunterMeadows = config("Ranger - Hunter", "1. Meadows", "Deer", "Set the affected creature by the ability");
			_HunterBlackForest = config("Ranger - Hunter", "2. Black Forest", "Greydwarf", "Set the affected creature by the ability");
			_HunterSwamp = config("Ranger - Hunter", "3. Swamp", "Draugr", "Set the affected creature by the ability");
			_HunterMountain = config("Ranger - Hunter", "4. Mountains", "Wolf", "Set the affected creature by the ability");
			_HunterPlains = config("Ranger - Hunter", "5. Plains", "Lox", "Set the affected creature by the ability");
			_HunterMistLands = config("Ranger - Hunter", "6. Mistlands", "Hare", "Set the affected creature by the ability");
			_HunterAshLands = config("Ranger - Hunter", "7. Ashlands", "Surtling", "Set the affected creature by the ability");
			_HunterDeepNorth = config("Ranger - Hunter", "8. Deep North", "", "Set the affected creature by the ability");
			_HunterOcean = config("Ranger - Hunter", "9. Ocean", "Serpent", "Set the affected creature by the ability");
			_UseBattleFury = config("Warrior - Battle Fury", "Enabled", Toggle.Off, "If on, battle fury replaces monkey wrench");
			_UseBattleFury.SettingChanged += OnBattleFuryChange;
			_BattleFuryFX = config("Warrior - Battle Fury", "Visual Effects", Toggle.On, "If on, visual effects are active", synchronizedSetting: false);
			_UseSurvivor = config("Warrior - Survivor", "Enabled", Toggle.Off, "If on, survivor replaces dual wield");
			_UseSurvivor.SettingChanged += OnSurvivorChange;
			_SurvivorLength = config("Warrior - Survivor", "Duration", 100f, new ConfigDescription("Set duration of survivor damage reduction", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 1000f), Array.Empty<object>()));
			_SurvivorFX = config("Warrior - Survivor", "Visual Effects", Toggle.On, "If on, visual effects are active", synchronizedSetting: false);
		}

		private static void OnSurvivorChange(object sender, EventArgs e)
		{
			if (_UseSurvivor.Value == Toggle.On)
			{
				LoadUI.ChangeButton(TalentManager.AllTalents["Survivor"]);
			}
			else
			{
				LoadUI.ChangeButton(TalentManager.AllTalents["DualWield"], revert: true);
			}
			LoadUI.ResetTalents(command: true);
		}

		private static void OnBattleFuryChange(object sender, EventArgs e)
		{
			if (_UseBattleFury.Value == Toggle.On)
			{
				LoadUI.ChangeButton(TalentManager.AllTalents["BattleFury"]);
			}
			else
			{
				LoadUI.ChangeButton(TalentManager.AllTalents["MonkeyWrench"], revert: true);
			}
			LoadUI.ResetTalents(command: true);
		}

		private void InitSettingsConfigs()
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Expected O, but got Unknown
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Expected O, but got Unknown
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Expected O, but got Unknown
			//IL_015a: 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_01e2: Expected O, but got Unknown
			//IL_0205: Unknown result type (might be due to invalid IL or missing references)
			//IL_0210: Expected O, but got Unknown
			//IL_0233: Unknown result type (might be due to invalid IL or missing references)
			//IL_023e: Expected O, but got Unknown
			//IL_0258: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ad: Expected O, but got Unknown
			_PrestigeThreshold = config("2 - Settings", "Prestige Threshold", 60, new ConfigDescription("Minimum amount of talent points needed to spend to access prestige", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 101), Array.Empty<object>()));
			_ResetCost = config("2 - Settings", "Reset Cost", 999, new ConfigDescription("Set the cost to reset talents", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 999), Array.Empty<object>()));
			_DisplayExperience = config("2 - Settings", "Show Creature Experience", Toggle.Off, "If on, creature hover names will display the amount of experience they give");
			_ExperienceBarPos = config<Vector2>("2 - Settings", "XP Bar Position", new Vector2(300f, 25f), "Set the position of the experience bar", synchronizedSetting: false);
			_ExperienceBarPos.SettingChanged += LoadUI.OnChangeExperienceBarPosition;
			_ExperienceBarScale = config("2 - Settings", "XP Bar Scale", 100f, new ConfigDescription("Set the scale of the experience bar", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 100f), Array.Empty<object>()), synchronizedSetting: false);
			_ExperienceBarScale.SettingChanged += LoadUI.OnExperienceBarScaleChange;
			_HudVisible = config("2 - Settings", "XP Bar Visible", Toggle.On, "If on, experience bar is visible on HUD", synchronizedSetting: false);
			_HudVisible.SettingChanged += LoadUI.OnChangeExperienceBarVisibility;
			_SpellBookPos = config<Vector2>("2 - Settings", "Spell Bar Position", new Vector2(1500f, 100f), "Set the location of the spellbar", synchronizedSetting: false);
			_SpellBookPos.SettingChanged += SpellBook.OnSpellBarPosChange;
			_PanelBackground = config("2 - Settings", "UI Background", Toggle.On, "If on, panel is visible, else transparent", synchronizedSetting: false);
			_PanelBackground.SettingChanged += OnPanelBackgroundToggle;
			_ExperienceMultiplier = config("2 - Settings", "Experience Multiplier", 1, new ConfigDescription("Set experience multiplier to easily increase experience gains", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 10), Array.Empty<object>()));
			_TalentPointPerLevel = config("2 - Settings", "Talent Points Per Level", 3, new ConfigDescription("Set amount of talent points rewarded per level", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 10), Array.Empty<object>()));
			_TalentPointsPerTenLevel = config("2 - Settings", "Talent Points Per Ten Levels", 7, new ConfigDescription("Set extra talent points rewarded per 10 levels", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 10), Array.Empty<object>()));
			_MenuTooltipPosition = config<Vector2>("2 - Settings", "Menu Tooltip Position", new Vector2(0f, 150f), "Set position of spell bar tooltip, always attached to spell bar position", synchronizedSetting: false);
			_MenuTooltipPosition.SettingChanged += LoadUI.OnMenuInfoPanelConfigChange;
			_ChanceForOrb = config("2 - Settings", "Experience Orb Drop Rate", 1, new ConfigDescription("Set the drop chance to drop experience orbs", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>()));
		}

		private void InitKeyCodeConfigs()
		{
			_SpellAlt = config<KeyCode>("3 - Spell Keys", "Alt Key", (KeyCode)0, "Set the alt key code, If None, then it ignores", synchronizedSetting: false);
			_SpellAlt.SettingChanged += OnSpellAltKeyChange;
			_Spell1 = config<KeyCode>("3 - Spell Keys", "Spell 1", (KeyCode)257, "Set the key code for spell 1", synchronizedSetting: false);
			_Spell2 = config<KeyCode>("3 - Spell Keys", "Spell 2", (KeyCode)258, "Set the key code for spell 2", synchronizedSetting: false);
			_Spell3 = config<KeyCode>("3 - Spell Keys", "Spell 3", (KeyCode)259, "Set the key code for spell 3", synchronizedSetting: false);
			_Spell4 = config<KeyCode>("3 - Spell Keys", "Spell 4", (KeyCode)260, "Set the key code for spell 4", synchronizedSetting: false);
			_Spell5 = config<KeyCode>("3 - Spell Keys", "Spell 5", (KeyCode)261, "Set the key code for spell 5", synchronizedSetting: false);
			_Spell6 = config<KeyCode>("3 - Spell Keys", "Spell 6", (KeyCode)262, "Set the key code for spell 6", synchronizedSetting: false);
			_Spell7 = config<KeyCode>("3 - Spell Keys", "Spell 7", (KeyCode)263, "Set the key code for spell 7", synchronizedSetting: false);
			_Spell8 = config<KeyCode>("3 - Spell Keys", "Spell 8", (KeyCode)264, "Set the key code for spell 8", synchronizedSetting: false);
		}

		private static void OnPanelBackgroundToggle(object sender, EventArgs e)
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			((Graphic)LoadUI.PanelBackground).color = ((_PanelBackground.Value == Toggle.On) ? Color.white : Color.clear);
		}

		private static void OnSpellAltKeyChange(object sender, EventArgs e)
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			LoadUI.SpellBarHotKeyTooltip.text = $"Spell Book Alt Key: <color=orange>{_SpellAlt.Value}</color>";
		}

		public ConfigEntry<T> config<[<f6442f0f-673c-492e-ad8c-a65f77e6488d>Nullable(2)] T>(string group, string name, T value, ConfigDescription description, bool synchronizedSetting = true)
		{
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Expected O, but got Unknown
			ConfigDescription val = new ConfigDescription(description.Description + (synchronizedSetting ? " [Synced with Server]" : " [Not Synced with Server]"), description.AcceptableValues, description.Tags);
			ConfigEntry<T> val2 = ((BaseUnityPlugin)this).Config.Bind<T>(group, name, value, val);
			SyncedConfigEntry<T> syncedConfigEntry = ConfigSync.AddConfigEntry<T>(val2);
			syncedConfigEntry.SynchronizedConfig = synchronizedSetting;
			return val2;
		}

		public ConfigEntry<T> config<[<f6442f0f-673c-492e-ad8c-a65f77e6488d>Nullable(2)] T>(string group, string name, T value, string description, bool synchronizedSetting = true)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Expected O, but got Unknown
			return config(group, name, value, new ConfigDescription(description, (AcceptableValueBase)null, Array.Empty<object>()), synchronizedSetting);
		}

		static AlmanacClassesPlugin()
		{
			string configPath = Paths.ConfigPath;
			char directorySeparatorChar = Path.DirectorySeparatorChar;
			ConfigFileFullPath = configPath + directorySeparatorChar + ConfigFileName;
			ConnectionError = "";
			AlmanacClassesLogger = Logger.CreateLogSource("AlmanacClasses");
			ConfigSync = new ConfigSync("RustyMods.AlmanacClasses")
			{
				DisplayName = "AlmanacClasses",
				CurrentVersion = "0.3.5",
				MinimumRequiredVersion = "0.3.5"
			};
			_AssetBundle = GetAssetBundle("classesbundle");
			_Plugin = null;
			_Root = null;
			_serverConfigLocked = null;
			_PrestigeThreshold = null;
			_ResetCost = null;
			_DisplayExperience = null;
			_ExperienceBarPos = null;
			_ExperienceBarScale = null;
			_HudVisible = null;
			_SpellBookPos = null;
			_PanelBackground = null;
			_ExperienceMultiplier = null;
			_TalentPointPerLevel = null;
			_TalentPointsPerTenLevel = null;
			_MenuTooltipPosition = null;
			_ChanceForOrb = null;
			_MaxEitr = null;
			_MaxHealth = null;
			_MaxStamina = null;
			_EitrRatio = null;
			_HealthRatio = null;
			_StaminaRatio = null;
			_DamageRatio = null;
			_SpellAlt = null;
			_Spell1 = null;
			_Spell2 = null;
			_Spell3 = null;
			_Spell4 = null;
			_Spell5 = null;
			_Spell6 = null;
			_Spell7 = null;
			_Spell8 = null;
			_RangerMeadowSpawn = null;
			_RangerBlackForestSpawn = null;
			_RangerSwampSpawn = null;
			_RangerMountainSpawn = null;
			_RangerPlainsSpawn = null;
			_RangerMistLandsSpawn = null;
			_RangerAshlandSpawn = null;
			_RangerDeepNorthSpawn = null;
			_RangerOceanSpawn = null;
			_HunterMeadows = null;
			_HunterBlackForest = null;
			_HunterSwamp = null;
			_HunterMountain = null;
			_HunterPlains = null;
			_HunterMistLands = null;
			_HunterAshLands = null;
			_HunterDeepNorth = null;
			_HunterOcean = null;
			_ShamanSpawn = null;
			_MasterChefIncrease = null;
			_LumberjackIncrease = null;
			_UseBattleFury = null;
			_BattleFuryFX = null;
			_UseSurvivor = null;
			_SurvivorLength = null;
			_SurvivorFX = null;
		}
	}
	public static class KeyboardExtensions
	{
		public static bool IsKeyDown(this KeyboardShortcut shortcut)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			return (int)((KeyboardShortcut)(ref shortcut)).MainKey != 0 && Input.GetKeyDown(((KeyboardShortcut)(ref shortcut)).MainKey) && ((KeyboardShortcut)(ref shortcut)).Modifiers.All((Func<KeyCode, bool>)Input.GetKey);
		}

		public static bool IsKeyHeld(this KeyboardShortcut shortcut)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			return (int)((KeyboardShortcut)(ref shortcut)).MainKey != 0 && Input.GetKey(((KeyboardShortcut)(ref shortcut)).MainKey) && ((KeyboardShortcut)(ref shortcut)).Modifiers.All((Func<KeyCode, bool>)Input.GetKey);
		}
	}
	[HarmonyPatch(typeof(ZNet), "OnNewConnection")]
	public static class RegisterAndCheckVersion
	{
		[<29670a2c-1b04-46dc-8312-7721bf20b209>NullableContext(1)]
		private static void Prefix(ZNetPeer peer, ref ZNet __instance)
		{
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Expected O, but got Unknown
			AlmanacClassesPlugin.AlmanacClassesLogger.LogDebug((object)"Registering version RPC handler");
			peer.m_rpc.Register<ZPackage>("AlmanacClasses_VersionCheck", (Action<ZRpc, ZPackage>)RpcHandlers.RPC_AlmanacClasses_Version);
			AlmanacClassesPlugin.AlmanacClassesLogger.LogInfo((object)"Invoking version check");
			ZPackage val = new ZPackage();
			val.Write("0.3.5");
			peer.m_rpc.Invoke("AlmanacClasses_VersionCheck", new object[1] { val });
		}
	}
	[<f6442f0f-673c-492e-ad8c-a65f77e6488d>Nullable(0)]
	[HarmonyPatch(typeof(ZNet), "RPC_PeerInfo")]
	[<29670a2c-1b04-46dc-8312-7721bf20b209>NullableContext(1)]
	public static class VerifyClient
	{
		private static bool Prefix(ZRpc rpc, ZPackage pkg, ref ZNet __instance)
		{
			if (!__instance.IsServer() || RpcHandlers.ValidatedPeers.Contains(rpc))
			{
				return true;
			}
			AlmanacClassesPlugin.AlmanacClassesLogger.LogWarning((object)("Peer (" + rpc.m_socket.GetHostName() + ") never sent version or couldn't due to previous disconnect, disconnecting"));
			rpc.Invoke("Error", new object[1] { 3 });
			return false;
		}

		private static void Postfix(ZNet __instance)
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Expected O, but got Unknown
			ZRoutedRpc.instance.InvokeRoutedRPC(ZRoutedRpc.instance.GetServerPeerID(), "AlmanacClassesRequestAdminSync", new object[1] { (object)new ZPackage() });
		}
	}
	[HarmonyPatch(typeof(FejdStartup), "ShowConnectError")]
	public class ShowConnectionError
	{
		[<29670a2c-1b04-46dc-8312-7721bf20b209>NullableContext(1)]
		private static void Postfix(FejdStartup __instance)
		{
			if (__instance.m_connectionFailedPanel.activeSelf)
			{
				__instance.m_connectionFailedError.fontSizeMax = 25f;
				__instance.m_connectionFailedError.fontSizeMin = 15f;
				TMP_Text connectionFailedError = __instance.m_connectionFailedError;
				connectionFailedError.text = connectionFailedError.text + "\n" + AlmanacClassesPlugin.ConnectionError;
			}
		}
	}
	[HarmonyPatch(typeof(ZNet), "Disconnect")]
	public static class RemoveDisconnectedPeerFromVerified
	{
		[<29670a2c-1b04-46dc-8312-7721bf20b209>NullableContext(1)]
		private static void Prefix(ZNetPeer peer, ref ZNet __instance)
		{
			if (__instance.IsServer())
			{
				AlmanacClassesPlugin.AlmanacClassesLogger.LogInfo((object)("Peer (" + peer.m_rpc.m_socket.GetHostName() + ") disconnected, removing from validated list"));
				RpcHandlers.ValidatedPeers.Remove(peer.m_rpc);
			}
		}
	}
	[<f6442f0f-673c-492e-ad8c-a65f77e6488d>Nullable(0)]
	[<29670a2c-1b04-46dc-8312-7721bf20b209>NullableContext(1)]
	public static class RpcHandlers
	{
		public static readonly List<ZRpc> ValidatedPeers = new List<ZRpc>();

		public static void RPC_AlmanacClasses_Version(ZRpc rpc, ZPackage pkg)
		{
			string text = pkg.ReadString();
			AlmanacClassesPlugin.AlmanacClassesLogger.LogInfo((object)("Version check, local: 0.3.5,  remote: " + text));
			if (text != "0.3.5")
			{
				AlmanacClassesPlugin.ConnectionError = "AlmanacClasses Installed: 0.3.5\n Needed: " + text;
				if (ZNet.instance.IsServer())
				{
					AlmanacClassesPlugin.AlmanacClassesLogger.LogWarning((object)("Peer (" + rpc.m_socket.GetHostName() + ") has incompatible version, disconnecting..."));
					rpc.Invoke("Error", new object[1] { 3 });
				}
			}
			else if (!ZNet.instance.IsServer())
			{
				AlmanacClassesPlugin.AlmanacClassesLogger.LogInfo((object)"Received same version from server!");
			}
			else
			{
				AlmanacClassesPlugin.AlmanacClassesLogger.LogInfo((object)("Adding peer (" + rpc.m_socket.GetHostName() + ") to validated list"));
				ValidatedPeers.Add(rpc);
			}
		}

		public static string ComputeHashForMod()
		{
			using SHA256 sHA = SHA256.Create();
			byte[] array = sHA.ComputeHash(File.ReadAllBytes(Assembly.GetExecutingAssembly().Location));
			StringBuilder stringBuilder = new StringBuilder();
			byte[] array2 = array;
			foreach (byte b in array2)
			{
				stringBuilder.Append(b.ToString("X2"));
			}
			return stringBuilder.ToString();
		}
	}
}
namespace AlmanacClasses.UI
{
	public class ExperienceBarMove : MonoBehaviour, IPointerClickHandler, IEventSystemHandler
	{
		public static bool updateElement;

		public static void UpdateElement()
		{
			//IL_0023: 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)
			if (Input.GetKeyDown((KeyCode)27))
			{
				updateElement = false;
			}
			if (updateElement)
			{
				AlmanacClassesPlugin._ExperienceBarPos.Value = Vector2.op_Implicit(Input.mousePosition);
			}
		}

		[<29670a2c-1b04-46dc-8312-7721bf20b209>NullableContext(1)]
		public void OnPointerClick(PointerEventData eventData)
		{
			updateElement = !updateElement;
		}
	}
	[<29670a2c-1b04-46dc-8312-7721bf20b209>NullableContext(1)]
	[<f6442f0f-673c-492e-ad8c-a65f77e6488d>Nullable(0)]
	public static class LoadUI
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			[<f6442f0f-673c-492e-ad8c-a65f77e6488d>Nullable(0)]
			public static readonly <>c <>9 = new <>c();

			[<f6442f0f-673c-492e-ad8c-a65f77e6488d>Nullable(0)]
			public static UnityAction <>9__125_0;

			[<f6442f0f-673c-492e-ad8c-a65f77e6488d>Nullable(0)]
			public static UnityAction <>9__138_0;

			[<f6442f0f-673c-492e-ad8c-a65f77e6488d>Nullable(0)]
			public static Predicate<StatusEffect> <>9__139_0;

			[<f6442f0f-673c-492e-ad8c-a65f77e6488d>Nullable(0)]
			public static Func<string, bool> <>9__152_0;

			internal void <SetPrestigeButton>b__125_0()
			{
				int totalBoughtTalentPoints = TalentManager.GetTotalBoughtTalentPoints();
				Talent value;
				if (totalBoughtTalentPoints < AlmanacClassesPlugin._PrestigeThreshold.Value)
				{
					((Character)Player.m_localPlayer).Message((MessageType)2, "$msg_talent_required", 0, (Sprite)null);
				}
				else if (TalentManager.AllTalents.TryGetValue("PrestigeButton", out value))
				{
					int cost = value.m_cost;
					if (cost > TalentManager.GetAvailableTalentPoints())
					{
						((Character)Player.m_localPlayer).Message((MessageType)2, "$msg_not_enough_tp_to_prestige", 0, (Sprite)null);
						return;
					}
					totalBoughtTalentPoints += cost;
					PlayerManager.m_playerTalents[value.m_key] = value;
					PlayerManager.m_tempPlayerData.m_prestigePoints += totalBoughtTalentPoints;
					PlayerManager.m_tempPlayerData.m_prestige++;
					ResetTalents();
					TalentManager.PrestigeTalents(PlayerManager.m_tempPlayerData.m_prestige);
					((Character)Player.m_localPlayer).Message((MessageType)2, "$msg_prestiged " + PlayerManager.m_tempPlayerData.m_prestige, 0, (Sprite)null);
				}
			}

			internal void <LoadResetButton>b__138_0()
			{
				if (((Humanoid)Player.m_localPlayer).GetInventory().CountItems("$item_coins", -1, true) < AlmanacClassesPlugin._ResetCost.Value)
				{
					((Character)Player.m_localPlayer).Message((MessageType)2, $"Cost {AlmanacClassesPlugin._ResetCost.Value} $item_coins to reset talents", 0, (Sprite)null);
					return;
				}
				((Humanoid)Player.m_localPlayer).GetInventory().RemoveItem("$item_coins", AlmanacClassesPlugin._ResetCost.Value, -1, true);
				ResetTalents();
			}

			[<29670a2c-1b04-46dc-8312-7721bf20b209>NullableContext(0)]
			internal bool <ResetTalents>b__139_0(StatusEffect x)
			{
				return x is StatusEffectManager.Data.TalentEffect;
			}

			[<29670a2c-1b04-46dc-8312-7721bf20b209>NullableContext(0)]
			internal bool <CanBuyEndAbility>b__152_0(string requirement)
			{
				<>c__DisplayClass152_0 CS$<>8__locals0 = new <>c__DisplayClass152_0
				{
					requirement = requirement
				};
				return Object.op_Implicit((Object)(object)CheckedTalents.Find((Button x) => ((Object)x).name == CS$<>8__locals0.requirement));
			}
		}

		[CompilerGenerated]
		private sealed class <>c__DisplayClass152_0
		{
			[<f6442f0f-673c-492e-ad8c-a65f77e6488d>Nullable(0)]
			public string requirement;

			internal bool <CanBuyEndAbility>b__1(Button x)
			{
				return ((Object)x).name == requirement;
			}
		}

		public static readonly List<Selectable> TalentButtons = new List<Selectable>();

		private static ButtonSfx sfx = null;

		private static Button buttonComponent = null;

		public static GameObject SkillTree_UI = null;

		private static GameObject ExperienceBarHUD = null;

		private static RectTransform ExpBarRect = null;

		private static Image ExpHudFillBar = null;

		private static Text ExpHudText = null;

		public static GameObject InfoHoverElement = null;

		public static GameObject SpellBarHoverName = null;

		public static Image PanelBackground = null;

		public static Text PointsUsed = null;

		public static Text RequiredPoints = null;

		public static Text PrestigeText = null;

		public static Text LevelText = null;

		public static Text ExperienceText = null;

		public static Text TalentPointsText = null;

		public static Text TalentName = null;

		public static Text TalentDescription = null;

		public static Text TalentCost = null;

		public static Text ActivePassive = null;

		public static Text ConstitutionText = null;

		public static Text DexterityText = null;

		public static Text IntelligenceText = null;

		public static Text StrengthText = null;

		public static Text WisdomText = null;

		public static Text SpellBarHotKeyTooltip = null;

		public static Image ExperienceBarFill = null;

		public static GameObject MenuInfoPanel = null;

		private static Button CenterButton = null;

		public static bool m_initLineFillSet;

		public static readonly Dictionary<string, Button> ButtonMap = new Dictionary<string, Button>();

		public static readonly Dictionary<Button, Dictionary<string, Image>> ButtonFillLineMap = new Dictionary<Button, Dictionary<string, Image>>();

		public static readonly Dictionary<Button, float> ButtonCoreLineAmountMap = new Dictionary<Button, float>();

		private static readonly List<Button> CheckedTalents = new List<Button>();

		private static Image LineCoreUp = null;

		private static Image LineUp1Right = null;

		private static Image LineUp1Left = null;

		private static Image LineUp2Right = null;

		private static Image LineUp2Left = null;

		private static Image LineUp3Right = null;

		private static Image LineUp3RightUp = null;

		private static Image LineUp4Left = null;

		private static Image LineUp4LeftUp = null;

		private static Image LineCoreBard = null;

		private static Image LineBard1Right = null;

		private static Image LineBard1Left = null;

		private static Image LineBard2Right = null;

		private static Image LineBard2Left = null;

		private static Image LineBard3Right = null;

		private static Image LineBard3RightUp = null;

		private static Image LineBard4Left = null;

		private static Image LineBard4LeftUp = null;

		private static Image LineCoreShaman = null;

		private static Image LineShaman1Right = null;

		private static Image LineShaman1Left = null;

		private static Image LineShaman2Right = null;

		private static Image LineShaman2Left = null;

		private static Image LineShaman3Right = null;

		private static Image LineShaman3RightUp = null;

		private static Image LineShaman4Left = null;

		private static Image LineShaman4LeftUp = null;

		private static Image LineCoreSage = null;

		private static Image LineSage1Right = null;

		private static Image LineSage1Left = null;

		private static Image LineSage2Right = null;

		private static Image LineSage2Left = null;

		private static Image LineSage3Right = null;

		private static Image LineSage3RightUp = null;

		private static Image LineSage4Left = null;

		private static Image LineSage4LeftUp = null;

		private static Image LineCoreDown = null;

		private static Image LineDown1Right = null;

		private static Image LineDown1Left = null;

		private static Image LineDown2Right = null;

		private static Image LineDown2Left = null;

		private static Image LineDown3Right = null;

		private static Image LineDown3RightDown = null;

		private static Image LineDown4Left = null;

		private static Image LineDown4LeftDown = null;

		private static Image LineCoreRanger = null;

		private static Image LineRanger1Right = null;

		private static Image LineRanger1Left = null;

		private static Image LineRanger2Right = null;

		private static Image LineRanger2Left = null;

		private static Image LineRanger3Right = null;

		private static Image LineRanger3RightUp = null;

		private static Image LineRanger4Left = null;

		private static Image LineRanger4LeftUp = null;

		private static Image LineCoreRogue = null;

		private static Image LineRogue1Right = null;

		private static Image LineRogue1Left = null;

		private static Image LineRogue2Right = null;

		private static Image LineRogue2Left = null;

		private static Image LineRogue3Right = null;

		private static Image LineRogue3RightUp = null;

		private static Image LineRogue4Left = null;

		private static Image LineRogue4LeftUp = null;

		private static Image LineCoreWarrior = null;

		private static Image LineWarrior1Right = null;

		private static Image LineWarrior1Left = null;

		private static Image LineWarrior2Right = null;

		private static Image LineWarrior2Left = null;

		private static Image LineWarrior3Right = null;

		private static Image LineWarrior3RightUp = null;

		private static Image LineWarrior4Left = null;

		private static Image LineWarrior4LeftUp = null;

		private static Image LineRadial1 = null;

		private static Image LineRadial2 = null;

		private static Image LineRadial3 = null;

		private static Image LineRadial4 = null;

		private static Image LineRadial5 = null;

		private static Image LineRadial6 = null;

		private static Image LineRadial7 = null;

		private static Image LineRadial8 = null;

		private static readonly List<Image> AllLines = new List<Image>();

		private static readonly Dictionary<string, List<string>> EndTalents = new Dictionary<string, List<string>>
		{
			{
				"$button_chef",
				new List<string> { "$button_core_1", "$button_core_2", "$button_lumberjack" }
			},
			{
				"$button_bard_talent_5",
				new List<string> { "$button_bard_1", "$button_bard_2", "$button_bard_talent_2" }
			},
			{
				"$button_shaman_talent_5",
				new List<string> { "$button_shaman_1", "$button_shaman_2", "$button_shaman_talent_2" }
			},
			{
				"$button_sage_talent_5",
				new List<string> { "$button_sage_1", "$button_sage_2", "$button_sage_talent_4" }
			},
			{
				"$button_sail",
				new List<string> { "$button_core_7", "$button_core_8", "$button_treasure" }
			},
			{
				"$button_ranger_talent_5",
				new List<string> { "$button_ranger_1", "$button_ranger_2", "$button_ranger_talent_2" }
			},
			{
				"$button_rogue_talent_5",
				new List<string> { "$button_rogue_1", "$button_rogue_2", "$button_rogue_talent_2" }
			},
			{
				"$button_warrior_talent_5",
				new List<string> { "$button_warrior_1", "$button_warrior_2", "$button_warrior_talent_2" }
			}
		};

		private static bool IsEXPBarVisible()
		{
			return Object.op_Implicit((Object)(object)ExperienceBarHUD) && ExperienceBarHUD.activeInHierarchy;
		}

		public static void InitHudExperienceBar(Hud instance)
		{
			//IL_0068: 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_0177: Unknown result type (might be due to invalid IL or missing references)
			//IL_0181: Unknown result type (might be due to invalid IL or missing references)
			//IL_0186: 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_01a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ae: Expected O, but got Unknown
			ExperienceBarHUD = Object.Instantiate<GameObject>(AlmanacClassesPlugin._AssetBundle.LoadAsset<GameObject>("Experience_Bar"), ((Component)instance).transform, false);
			ExperienceBarHUD.AddComponent<ExperienceBarMove>();
			ExperienceBarHUD.SetActive(AlmanacClassesPlugin._HudVisible.Value == AlmanacClassesPlugin.Toggle.On);
			ExpBarRect = ExperienceBarHUD.GetComponent<RectTransform>();
			((Transform)ExpBarRect).SetAsLastSibling();
			ExpBarRect.anchoredPosition = AlmanacClassesPlugin._ExperienceBarPos.Value;
			float num = AlmanacClassesPlugin._ExperienceBarScale.Value / 100f;
			((Transform)ExpBarRect).localScale = new Vector3(num, num, num);
			ExpHudFillBar = ((Component)ExperienceBarHUD.transform.Find("FillBar")).GetComponent<Image>();
			ExpHudText = ((Component)ExperienceBarHUD.transform.Find("$text_experience")).GetComponent<Text>();
			ExpHudFillBar.fillAmount = 0f;
			ExpHudText.text = "";
			InfoHoverElement = AlmanacClassesPlugin._AssetBundle.LoadAsset<GameObject>("ElementHover_UI");
			Text[] componentsInChildren = InfoHoverElement.GetComponentsInChildren<Text>();
			Text[] componentsInChildren2 = ExperienceBarHUD.GetComponentsInChildren<Text>();
			Font font = GetFont("Norsebold");
			AddFonts(componentsInChildren2, font);
			AddFonts(componentsInChildren, font);
			SpellBook.LoadElements();
			MenuInfoPanel = Object.Instantiate<GameObject>(InfoHoverElement, ((Component)Hud.instance).transform, false);
			MenuInfoPanel.transform.SetAsFirstSibling();
			MenuInfoPanel.transform.position = Vector2.op_Implicit(AlmanacClassesPlugin._SpellBookPos.Value + AlmanacClassesPlugin._MenuTooltipPosition.Value);
			MenuInfoPanel.SetActive(false);
			GameObject val = new GameObject("title");
			val.AddComponent<RectTransform>();
			Text val2 = val.AddComponent<Text>();
			val2.font = font;
			val2.fontSize = 20;
			val2.alignment = (TextAnchor)4;
			val2.supportRichText = true;
			val2.horizontalOverflow = (HorizontalWrapMode)1;
			val2.verticalOverflow = (VerticalWrapMode)1;
			((Graphic)val2).raycastTarget = false;
			SpellBarHoverName = val;
		}

		public static void OnExperienceBarScaleChange(object sender, EventArgs e)
		{
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			if (sender is ConfigEntry<float> val)
			{
				float num = val.Value / 100f;
				((Transform)ExpBarRect).localScale = new Vector3(num, num, num);
			}
		}

		public static void OnMenuInfoPanelConfigChange(object sender, EventArgs e)
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			if (sender is ConfigEntry<Vector2> val)
			{
				MenuInfoPanel.transform.position = Vector2.op_Implicit(AlmanacClassesPlugin._SpellBookPos.Value + val.Value);
			}
		}

		public static void InitSkillTree(InventoryGui instance)
		{
			//IL_0246: Unknown result type (might be due to invalid IL or missing references)
			AlmanacClassesPlugin.AlmanacClassesLogger.LogDebug((object)"Client: Initializing talent UI");
			Transform val = Utils.FindChild(Utils.FindChild(((Component)instance).transform, "TrophiesFrame", (IterativeSearchType)0), "Closebutton", (IterativeSearchType)0);
			sfx = ((Component)val).GetComponent<ButtonSfx>();
			buttonComponent = ((Component)val).GetComponent<Button>();
			SkillTree_UI = Object.Instantiate<GameObject>(AlmanacClassesPlugin._AssetBundle.LoadAsset<GameObject>("Almanac_SkillTree"), ((Component)instance).transform, false);
			SkillTree_UI.SetActive(false);
			PanelBackground = SkillTree_UI.GetComponent<Image>();
			SetTextFont();
			PrestigeText = ((Component)Utils.FindChild(SkillTree_UI.transform, "$text_prestige", (IterativeSearchType)0)).GetComponent<Text>();
			LevelText = ((Component)Utils.FindChild(SkillTree_UI.transform, "$text_level", (IterativeSearchType)0)).GetComponent<Text>();
			ExperienceText = ((Component)Utils.FindChild(SkillTree_UI.transform, "$text_experience", (IterativeSearchType)0)).GetComponent<Text>();
			TalentPointsText = ((Component)Utils.FindChild(SkillTree_UI.transform, "$text_talent_points", (IterativeSearchType)0)).GetComponent<Text>();
			TalentName = ((Component)Utils.FindChild(SkillTree_UI.transform, "$text_name", (IterativeSearchType)0)).GetComponent<Text>();
			TalentDescription = ((Component)Utils.FindChild(SkillTree_UI.transform, "$text_description", (IterativeSearchType)0)).GetComponent<Text>();
			TalentCost = ((Component)Utils.FindChild(SkillTree_UI.transform, "$text_cost", (IterativeSearchType)0)).GetComponent<Text>();
			ActivePassive = ((Component)Utils.FindChild(SkillTree_UI.transform, "$text_active_passive", (IterativeSearchType)0)).GetComponent<Text>();
			ConstitutionText = ((Component)Utils.FindChild(SkillTree_UI.transform, "$text_constitution", (IterativeSearchType)0)).GetComponent<Text>();
			DexterityText = ((Component)Utils.FindChild(SkillTree_UI.transform, "$text_dexterity", (IterativeSearchType)0)).GetComponent<Text>();
			IntelligenceText = ((Component)Utils.FindChild(SkillTree_UI.transform, "$text_intelligence", (IterativeSearchType)0)).GetComponent<Text>();
			StrengthText = ((Component)Utils.FindChild(SkillTree_UI.transform, "$text_strength", (IterativeSearchType)0)).GetComponent<Text>();
			WisdomText = ((Component)Utils.FindChild(SkillTree_UI.transform, "$text_wisdom", (IterativeSearchType)0)).GetComponent<Text>();
			SpellBarHotKeyTooltip = ((Component)Utils.FindChild(SkillTree_UI.transform, "$part_hotkey_tooltip", (IterativeSearchType)0)).GetComponent<Text>();
			SpellBarHotKeyTooltip.text = $"Alt Spell Book Key: <color=orange>{AlmanacClassesPlugin._SpellAlt.Value}</color>";
			ExperienceBarFill = ((Component)Utils.FindChild(SkillTree_UI.transform, "$image_experience_fill", (IterativeSearchType)0)).GetComponent<Image>();
			PointsUsed = ((Component)Utils.FindChild(SkillTree_UI.transform, "$text_used_points", (IterativeSearchType)0)).GetComponent<Text>();
			RequiredPoints = ((Component)Utils.FindChild(SkillTree_UI.transform, "$text_prestige_needed", (IterativeSearchType)0)).GetComponent<Text>();
			((Component)Utils.FindChild(SkillTree_UI.transform, "$text_title", (IterativeSearchType)0)).GetComponent<Text>().text = "$title_talents";
			((Component)Utils.FindChild(SkillTree_UI.transform, "$text_constitution_title", (IterativeSearchType)0)).GetComponent<Text>().text = Localization.instance.Localize("$almanac_constitution");
			((Component)Utils.FindChild(SkillTree_UI.transform, "$text_dexterity_title", (IterativeSearchType)0)).GetComponent<Text>().text = Localization.instance.Localize("$almanac_dexterity");
			((Component)Utils.FindChild(SkillTree_UI.transform, "$text_intelligence_title", (IterativeSearchType)0)).GetComponent<Text>().text = Localization.instance.Localize("$almanac_intelligence");
			((Component)Utils.FindChild(SkillTree_UI.transform, "$text_strength_title", (IterativeSearchType)0)).GetComponent<Text>().text = Localization.instance.Localize("$almanac_strength");
			((Component)Utils.FindChild(SkillTree_UI.transform, "$text_wisdom_title", (IterativeSearchType)0)).GetComponent<Text>().text = Localization.instance.Localize("$almanac_wisdom");
			LoadCloseButton();
			LoadResetButton();
			AddSFXToTalentButtons();
			SetPrestigeButton();
			SetLineFill();
			SetAllButtonEvents();
		}

		public static void OnChangeExperienceBarPosition(object sender, EventArgs e)
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			if (sender is ConfigEntry<Vector2> val)
			{
				ExpBarRect.anchoredPosition = val.Value;
			}
		}

		public static void OnChangeExperienceBarVisibility(object sender, EventArgs e)
		{
			if (sender is ConfigEntry<AlmanacClassesPlugin.Toggle> val)
			{
				ExperienceBarHUD.SetActive(val.Value == AlmanacClassesPlugin.Toggle.On);
			}
		}

		public static void UpdateExperienceBarHud()
		{
			if (IsEXPBarVisible())
			{
				int experience = PlayerManager.m_tempPlayerData.m_experience;
				int playerLevel = PlayerManager.GetPlayerLevel(experience);
				int requiredExperience = PlayerManager.GetRequiredExperience(playerLevel + 1);
				float fillAmount = (float)experience / (float)requiredExperience;
				ExpHudText.text = $"{experience} / {requiredExperience}";
				ExpHudFillBar.fillAmount = fillAmount;
			}
		}

		private static void SetPrestigeButton()
		{
			//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_003f: Expected O, but got Unknown
			ButtonClickedEvent onClick = ((Component)Utils.FindChild(SkillTree_UI.transform, "$button_center", (IterativeSearchType)0)).GetComponent<Button>().onClick;
			object obj = <>c.<>9__125_0;
			if (obj == null)
			{
				UnityAction val = delegate
				{
					int totalBoughtTalentPoints = TalentManager.GetTotalBoughtTalentPoints();
					Talent value;
					if (totalBoughtTalentPoints < AlmanacClassesPlugin._PrestigeThreshold.Value)
					{
						((Character)Player.m_localPlayer).Message((MessageType)2, "$msg_talent_required", 0, (Sprite)null);
					}
					else if (TalentManager.AllTalents.TryGetValue("PrestigeButton", out value))
					{
						int cost = value.m_cost;
						if (cost > TalentManager.GetAvailableTalentPoints())
						{
							((Character)Player.m_localPlayer).Message((MessageType)2, "$msg_not_enough_tp_to_prestige", 0, (Sprite)null);
						}
						else
						{
							totalBoughtTalentPoints += cost;
							PlayerManager.m_playerTalents[value.m_key] = value;
							PlayerManager.m_tempPlayerData.m_prestigePoints += totalBoughtTalentPoints;
							PlayerManager.m_tempPlayerData.m_prestige++;
							ResetTalents();
							TalentManager.PrestigeTalents(PlayerManager.m_tempPlayerData.m_prestige);
							((Character)Player.m_localPlayer).Message((MessageType)2, "$msg_prestiged " + PlayerManager.m_tempPlayerData.m_prestige, 0, (Sprite)null);
						}
					}
				};
				<>c.<>9__125_0 = val;
				obj = (object)val;
			}
			((UnityEvent)onClick).AddListener((UnityAction)obj);
		}

		public static void SetInitialFillLines()
		{
			if (m_initLineFillSet)
			{
				return;
			}
			CheckedTalents.Clear();
			CheckedTalents.Add(CenterButton);
			foreach (KeyValuePair<string, Talent> playerTalent in PlayerManager.m_playerTalents)
			{
				string buttonName = playerTalent.Value.m_buttonName;
				if (!ButtonMap.TryGetValue(buttonName, out var value))
				{
					continue;
				}
				CheckedTalents.Add(value);
				if (!ButtonFillLineMap.TryGetValue(value, out var value2) || !ButtonCoreLineAmountMap.TryGetValue(value, out var value3))
				{
					continue;
				}
				Dictionary<string, Image> dictionary = new Dictionary<string, Image>();
				foreach (Button checkedTalent in CheckedTalents)
				{
					if (value2.TryGetValue(((Object)checkedTalent).name, out var value4))
					{
						dictionary[((Object)checkedTalent).name] = value4;
					}
				}
				if (dictionary.Count == 0)
				{
					return;
				}
				Transform val = Utils.FindChild(((Component)value).transform, "Checkmark", (IterativeSearchType)0);
				((Component)val).gameObject.SetActive(true);
				foreach (KeyValuePair<string, Image> item in dictionary)
				{
					item.Value.fillAmount = ((((Object)((Component)item.Value).transform.parent).name == "$line_core") ? value3 : 1f);
				}
			}
			m_initLineFillSet = true;
		}

		private static void SetLineFill()
		{
			AllLines.Clear();
			Transform val = Utils.FindChild(SkillTree_UI.transform, "$part_lines", (IterativeSearchType)0);
			SetLineUp(val);
			SetLineBard(val);
			SetLineShaman(val);
			SetLineSage(val);
			SetLineDown(val);
			SetLineRanger(val);
			SetLineRogue(val);
			SetLineWarrior(val);
			SetLineRadial(val);
		}

		private static void SetLineUp(Transform lines)
		{
			Transform val = Utils.FindChild(lines, "$part_lines_up", (IterativeSearchType)0);
			LineCoreUp = ((Component)val.Find("$line_core/LineFill")).GetComponent<Image>();
			LineUp1Right = ((Component)val.Find("$line_1/$part_right/LineFill")).GetComponent<Image>();
			LineUp1Left = ((Component)val.Find("$line_1/$part_left/LineFill")).GetComponent<Image>();
			LineUp2Right = ((Component)val.Find("$line_2/$part_right/LineFill")).GetComponent<Image>();
			LineUp2Left = ((Component)val.Find("$line_2/$part_left/LineFill")).GetComponent<Image>();
			LineUp3Right = ((Component)val.Find("$line_3/$part_right/LineFill")).GetComponent<Image>();
			LineUp3RightUp = ((Component)val.Find("$line_3/$part_right_up/LineFill")).GetComponent<Image>();
			LineUp4Left = ((Component)val.Find("$line_4/$part_left/LineFill")).GetComponent<Image>();
			LineUp4LeftUp = ((Component)val.Find("$line_4/$part_left_up/LineFill")).GetComponent<Image>();
			AllLines.Add(LineCoreUp);
			AllLines.Add(LineUp1Right);
			AllLines.Add(LineUp1Left);
			AllLines.Add(LineUp2Right);
			AllLines.Add(LineUp2Left);
			AllLines.Add(LineUp3Right);
			AllLines.Add(LineUp3RightUp);
			AllLines.Add(LineUp4Left);
			AllLines.Add(LineUp4LeftUp);
		}

		private static void SetLineBard(Transform lines)
		{
			Transform val = Utils.FindChild(lines, "$part_lines_up_right", (IterativeSearchType)0);
			LineCoreBard = ((Component)val.Find("$line_core/LineFill")).GetComponent<Image>();
			LineBard1Right = ((Component)val.Find("$line_1/$part_right/LineFill")).GetComponent<Image>();
			LineBard1Left = ((Component)val.Find("$line_1/$part_left/LineFill")).GetComponent<Image>();
			LineBard2Right = ((Component)val.Find("$line_2/$part_right/LineFill")).GetComponent<Image>();
			LineBard2Left = ((Component)val.Find("$line_2/$part_left/LineFill")).GetComponent<Image>();
			LineBard3Right = ((Component)val.Find("$line_3/$part_right/LineFill")).GetComponent<Image>();
			LineBard3RightUp = ((Component)val.Find("$line_3/$part_right_up/LineFill")).GetComponent<Image>();
			LineBard4Left = ((Component)val.Find("$line_4/$part_left/LineFill")).GetComponent<Image>();
			LineBard4LeftUp = ((Component)val.Find("$line_4/$part_left_up/LineFill")).GetComponent<Image>();
			AllLines.Add(LineCoreBard);
			AllLines.Add(LineBard1Right);
			AllLines.Add(LineBard1Left);
			AllLines.Add(LineBard2Right);
			AllLines.Add(LineBard2Left);
			AllLines.Add(LineBard3Right);
			AllLines.Add(LineBard3RightUp);
			AllLines.Add(LineBard4Left);
			AllLines.Add(LineBard4LeftUp);
		}

		private static void SetLineShaman(Transform lines)
		{
			Transform val = Utils.FindChild(lines, "$part_lines_right", (IterativeSearchType)0);
			LineCoreShaman = ((Component)val.Find("$line_core/LineFill")).GetComponent<Image>();
			LineShaman1Right = ((Component)val.Find("$line_1/$part_right/LineFill")).GetComponent<Image>();
			LineShaman1Left = ((Component)val.Find("$line_1/$part_left/LineFill")).GetComponent<Image>();
			LineShaman2Right = ((Component)val.Find("$line_2/$part_right/LineFill")).GetComponent<Image>();
			LineShaman2Left = ((Component)val.Find("$line_2/$part_left/LineFill")).GetComponent<Image>();
			LineShaman3Right = ((Component)val.Find("$line_3/$part_right/LineFill")).GetComponent<Image>();
			LineShaman3RightUp = ((Component)val.Find("$line_3/$part_right_up/LineFill")).GetComponent<Image>();
			LineShaman4Left = ((Component)val.Find("$line_4/$part_left/LineFill")).GetComponent<Image>();
			LineShaman4LeftUp = ((Component)val.Find("$line_4/$part_left_up/LineFill")).GetComponent<Image>();
			AllLines.Add(LineCoreShaman);
			AllLines.Add(LineShaman1Right);
			AllLines.Add(LineShaman1Left);
			AllLines.Add(LineShaman2Right);
			AllLines.Add(LineShaman2Left);
			AllLines.Add(LineShaman3Right);
			AllLines.Add(LineShaman3RightUp);
			AllLines.Add(LineShaman4Left);
			AllLines.Add(LineShaman4LeftUp);
		}

		private static void SetLineSage(Transform lines)
		{
			Transform val = Utils.FindChild(lines, "$part_lines_down_right", (IterativeSearchType)0);
			LineCoreSage = ((Component)val.Find("$line_core/LineFill")).GetComponent<Image>();
			LineSage1Right = ((Component)val.Find("$line_1/$part_right/LineFill")).GetComponent<Image>();
			LineSage1Left = ((Component)val.Find("$line_1/$part_left/LineFill")).GetComponent<Image>();
			LineSage2Right = ((Component)val.Find("$line_2/$part_right/LineFill")).GetComponent<Image>();
			LineSage2Left = ((Component)val.Find("$line_2/$part_left/LineFill")).GetComponent<Image>();
			LineSage3Right = ((Component)val.Find("$line_3/$part_right/LineFill")).GetComponent<Image>();
			LineSage3RightUp = ((Component)val.Find("$line_3/$part_right_up/LineFill")).GetComponent<Image>();
			LineSage4Left = ((Component)val.Find("$line_4/$part_left/LineFill")).GetComponent<Image>();
			LineSage4LeftUp = ((Component)val.Find("$line_4/$part_left_up/LineFill")).GetComponent<Image>();
			AllLines.Add(LineCoreSage);
			AllLines.Add(LineSage1Right);
			AllLines.Add(LineSage1Left);
			AllLines.Add(LineSage2Right);
			AllLines.Add(LineSage2Left);
			AllLines.Add(LineSage3Right);
			AllLines.Add(LineSage3RightUp);
			AllLines.Add(LineSage4Left);
			AllLines.Add(LineSage4LeftUp);
		}

		private static void SetLineDown(Transform lines)
		{
			Transform val = lines.Find("$part_lines_down");
			LineCoreDown = ((Component)val.Find("$line_core/LineFill")).GetComponent<Image>();
			LineDown1Right = ((Component)val.Find("$line_1/$part_right/LineFill")).GetComponent<Image>();
			LineDown1Left = ((Component)val.Find("$line_1/$part_left/LineFill")).GetComponent<Image>();
			LineDown2Right = ((Component)val.Find("$line_2/$part_right/LineFill")).GetComponent<Image>();
			LineDown2Left = ((Component)val.Find("$line_2/$part_left/LineFill")).GetComponent<Image>();
			LineDown3Right = ((Component)val.Find("$line_3/$part_right/LineFill")).GetComponent<Image>();
			LineDown3RightDown = ((Component)val.Find("$line_3/$part_right_up/LineFill")).GetComponent<Image>();
			LineDown4Left = ((Component)val.Find("$line_4/$part_left/LineFill")).GetComponent<Image>();
			LineDown4LeftDown = ((Component)val.Find("$line_4/$part_left_up/LineFill")).GetComponent<Image>();
			AllLines.Add(LineCoreDown);
			AllLines.Add(LineDown1Right);
			AllLines.Add(LineDown1Left);
			AllLines.Add(LineDown2Right);
			AllLines.Add(LineDown2Left);
			AllLines.Add(LineDown3Right);
			AllLines.Add(LineDown3RightDown);
			AllLines.Add(LineDown4Left);
			AllLines.Add(LineDown4LeftDown);
		}

		private static void SetLineRanger(Transform lines)
		{
			Transform val = Utils.FindChild(lines, "$part_lines_down_left", (IterativeSearchType)0);
			LineCoreRanger = ((Component)val.Find("$line_core/LineFill")).GetComponent<Image>();
			LineRanger1Right = ((Component)val.Find("$line_1/$part_right/LineFill")).GetComponent<Image>();
			LineRanger1Left = ((Component)val.Find("$line_1/$part_left/LineFill")).GetComponent<Image>();
			LineRanger2Right = ((Component)val.Find("$line_2/$part_right/LineFill")).GetComponent<Image>();
			LineRanger2Left = ((Component)val.Find("$line_2/$part_left/LineFill")).GetComponent<Image>();
			LineRanger3Right = ((Component)val.Find("$line_3/$part_right/LineFill")).GetComponent<Image>();
			LineRanger3RightUp = ((Component)val.Find("$line_3/$part_right_up/LineFill")).GetComponent<Image>();
			LineRanger4Left = ((Component)val.Find("$line_4/$part_left/LineFill")).GetComponent<Image>();
			LineRanger4LeftUp = ((Component)val.Find("$line_4/$part_left_up/LineFill")).GetComponent<Image>();
			AllLines.Add(LineCoreRanger);
			AllLines.Add(LineRanger1Right);
			AllLines.Add(LineRanger1Left);
			AllLines.Add(LineRanger2Right);
			AllLines.Add(LineRanger2Left);
			AllLines.Add(LineRanger3Right);
			AllLines.Add(LineRanger3RightUp);
			AllLines.Add(LineRanger4Left);
			AllLines.Add(LineRanger4LeftUp);
		}

		private static void SetLineRogue(Transform lines)
		{
			Transform val = Utils.FindChild(lines, "$part_lines_left", (IterativeSearchType)0);
			LineCoreRogue = ((Component)val.Find("$line_core/LineFill")).GetComponent<Image>();
			LineRogue1Right = ((Component)val.Find("$line_1/$part_right/LineFill")).GetComponent<Image>();
			LineRogue1Left = ((Component)val.Find("$line_1/$part_left/LineFill")).GetComponent<Image>();
			LineRogue2Right = ((Component)val.Find("$line_2/$part_right/LineFill")).GetComponent<Image>();
			LineRogue2Left = ((Component)val.Find("$line_2/$part_left/LineFill")).GetComponent<Image>();
			LineRogue3Right = ((Component)val.Find("$line_3/$part_right/LineFill")).GetComponent<Image>();
			LineRogue3RightUp = ((Component)val.Find("$line_3/$part_right_up/LineFill")).GetComponent<Image>();
			LineRogue4Left = ((Component)val.Find("$line_4/$part_left/LineFill")).GetComponent<Image>();
			LineRogue4LeftUp = ((Component)val.Find("$line_4/$part_left_up/LineFill")).GetComponent<Image>();
			AllLines.Add(LineCoreRogue);
			AllLines.Add(LineRogue1Right);
			AllLines.Add(LineRogue1Left);
			AllLines.Add(LineRogue2Right);
			AllLines.Add(LineRogue2Left);
			AllLines.Add(LineRogue3Right);
			AllLines.Add(LineRogue3RightUp);
			AllLines.Add(LineRogue4Left);
			AllLines.Add(LineRogue4LeftUp);
		}

		private static void SetLineWarrior(Transform lines)
		{
			Transform val = Utils.FindChild(lines, "$part_lines_up_left", (IterativeSearchType)0);
			LineCoreWarrior = ((Component)val.Find("$line_core/LineFill")).GetComponent<Image>();
			LineWarrior1Right = ((Component)val.Find("$line_1/$part_right/LineFill")).GetComponent<Image>();
			LineWarrior1Left = ((Component)val.Find("$line_1/$part_left/LineFill")).GetComponent<Image>();
			LineWarrior2Right = ((Component)val.Find("$line_2/$part_right/LineFill")).GetComponent<Image>();
			LineWarrior2Left = ((Component)val.Find("$line_2/$part_left/LineFill")).GetComponent<Image>();
			LineWarrior3Right = ((Component)val.Find("$line_3/$part_right/LineFill")).GetComponent<Image>();
			LineWarrior3RightUp = ((Component)val.Find("$line_3/$part_right_up/LineFill")).GetComponent<Image>();
			LineWarrior4Left = ((Component)val.Find("$line_4/$part_left/LineFill")).GetComponent<Image>();
			LineWarrior4LeftUp = ((Component)val.Find("$line_4/$part_left_up/LineFill")).GetComponent<Image>();
			AllLines.Add(LineCoreWarrior);
			AllLines.Add(LineWarrior1Right);
			AllLines.Add(LineWarrior1Left);
			AllLines.Add(LineWarrior2Right);
			AllLines.Add(LineWarrior2Left);
			AllLines.Add(LineWarrior3Right);
			AllLines.Add(LineWarrior3RightUp);
			AllLines.Add(LineWarrior4Left);
			AllLines.Add(LineWarrior4LeftUp);
		}

		private static void SetLineRadial(Transform lines)
		{
			Transform val = Utils.FindChild(lines, "$part_lines_radial", (IterativeSearchType)0);
			LineRadial1 = ((Component)val.Find("$line_1/$part_line/LineFill")).GetComponent<Image>();
			LineRadial2 = ((Component)val.Find("$line_2/$part_line/LineFill")).GetComponent<Image>();
			LineRadial3 = ((Component)val.Find("$line_3/$part_line/LineFill")).GetComponent<Image>();
			LineRadial4 = ((Component)val.Find("$line_4/$part_line/LineFill")).GetComponent<Image>();
			LineRadial5 = ((Component)val.Find("$line_5/$part_line/LineFill")).GetComponent<Image>();
			LineRadial6 = ((Component)val.Find("$line_6/$part_line/LineFill")).GetComponent<Image>();
			LineRadial7 = ((Component)val.Find("$line_7/$part_line/LineFill")).GetComponent<Image>();
			LineRadial8 = ((Component)val.Find("$line_8/$part_line/LineFill")).GetComponent<Image>();
			AllLines.Add(LineRadial1);
			AllLines.Add(LineRadial2);
			AllLines.Add(LineRadial3);
			AllLines.Add(LineRadial4);
			AllLines.Add(LineRadial5);
			AllLines.Add(LineRadial6);
			AllLines.Add(LineRadial7);
			AllLines.Add(LineRadial8);
		}

		private static void LoadCloseButton()
		{
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Expected O, but got Unknown
			Transform val = Utils.FindChild(SkillTree_UI.transform, "$button_close", (IterativeSearchType)0);
			Button val2 = default(Button);
			if (((Component)val).TryGetComponent<Button>(ref val2))
			{
				((Selectable)val2).transition = (Transition)2;
				((Selectable)val2).spriteState = ((Selectable)buttonComponent).spriteState;
				((UnityEvent)val2.onClick).AddListener(new UnityAction(TalentBook.HideUI));
			}
			((Component)val).gameObject.AddComponent<ButtonSfx>().m_sfxPrefab = sfx.m_sfxPrefab;
		}

		private static void LoadResetButton()
		{
			//IL_0032: 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_0062: Expected O, but got Unknown
			Transform val = Utils.FindChild(SkillTree_UI.transform, "$button_reset", (IterativeSearchType)0);
			Button val2 = default(Button);
			if (((Component)val).TryGetComponent<Button>(ref val2))
			{
				((Selectable)val2).transition = (Transition)2;
				((Selectable)val2).spriteState = ((Selectable)buttonComponent).spriteState;
				ButtonClickedEvent onClick = val2.onClick;
				object obj = <>c.<>9__138_0;
				if (obj == null)
				{
					UnityAction val3 = delegate
					{
						if (((Humanoid)Player.m_localPlayer).GetInventory().CountItems("$item_coins", -1, true) < AlmanacClassesPlugin._ResetCost.Value)
						{
							((Character)Player.m_localPlayer).Message((MessageType)2, $"Cost {AlmanacClassesPlugin._ResetCost.Value} $item_coins to reset talents", 0, (Sprite)null);
						}
						else
						{
							((Humanoid)Player.m_localPlayer).GetInventory().RemoveItem("$item_coins", AlmanacClassesPlugin._ResetCost.Value, -1, true);
							ResetTalents();
						}
					};
					<>c.<>9__138_0 = val3;
					obj = (object)val3;
				}
				((UnityEvent)onClick).AddListener((UnityAction)obj);
			}
			((Component)val).gameObject.AddComponent<ButtonSfx>().m_sfxPrefab = sfx.m_sfxPrefab;
		}

		public static void ResetTalents(bool command = false)
		{
			LoadTwoHanded.ResetTwoHandedWeapons();
			SpellBook.DestroyElements();
			SpellBook.m_abilities.Clear();
			List<StatusEffect> list = ((Character)Player.m_localPlayer).GetSEMan().GetStatusEffects().FindAll([<29670a2c-1b04-46dc-8312-7721bf20b209>NullableContext(0)] (StatusEffect x) => x is StatusEffectManager.Data.TalentEffect);
			foreach (StatusEffect item in list)
			{
				((Character)Player.m_localPlayer).GetSEMan().RemoveStatusEffect(item, false);
			}
			PlayerManager.m_tempPlayerData.m_boughtTalents.Clear();
			foreach (Button checkedTalent in CheckedTalents)
			{
				Transform val = Utils.FindChild(((Component)checkedTalent).transform, "Checkmark", (IterativeSearchType)0);
				if (Object.op_Implicit((Object)(object)val))
				{
					((Component)val).gameObject.SetActive(false);
				}
			}
			CheckedTalents.Clear();
			CheckedTalents.Add(CenterButton);
			foreach (Image allLine in AllLines)
			{
				allLine.fillAmount = 0f;
			}
			PlayerManager.m_playerTalents.Clear();
			PlayerManager.m_tempPlayerData.m_boughtTalents.Clear();
			CharacteristicManager.ReloadCharacteristics();
			if (!command)
			{
				TalentBook.ShowUI();
			}
		}

		private static void AddSFXToTalentButtons()
		{
			TalentButtons.Clear();
			Transform val = Utils.FindChild(SkillTree_UI.transform, "$part_talents", (IterativeSearchType)0);
			Button[] componentsInChildren = ((Component)val).GetComponentsInChildren<Button>();
			Button[] array = componentsInChildren;
			foreach (Button val2 in array)
			{
				TalentButtons.Add((Selectable)(object)val2);
				ButtonMap[((Object)val2).name] = val2;
				((Component)val2).gameObject.AddComponent<ButtonSfx>().m_sfxPrefab = sfx.m_sfxPrefab;
			}
		}

		private static void SetAllButtonEvents()
		{
			ButtonFillLineMap.Clear();
			ButtonCoreLineAmountMap.Clear();
			CheckedTalents.Clear();
			CenterButton = ((Component)Utils.FindChild(SkillTree_UI.transform, "$button_center", (IterativeSearchType)0)).GetComponent<Button>();
			CheckedTalents.Add(CenterButton);
			SetCoreButtonsEvents();
			SetBardButtonEvents();
			SetShamanButtonEvents();
			SetSageButtonEvents();
			SetRangerButtonEvents();
			SetRogueButtonEvents();
			SetWarriorButtonEvents();
		}

		private static void SetCoreButtonsEvents()
		{
			Transform parent = Utils.FindChild(SkillTree_UI.transform, "$part_core_characteristics", (IterativeSearchType)0);
			Transform parent2 = Utils.FindChild(SkillTree_UI.transform, "$part_core_talents", (IterativeSearchType)0);
			SetButton(parent, "$button_core_1", new Dictionary<string, Image>
			{
				{ "$button_center", LineCoreUp },
				{ "$button_bard_talent_1", LineUp1Left },
				{ "$button_warrior_talent_1", LineUp1Right }
			}, 0.4f, "Core1");
			SetButton(parent, "$button_core_2", new Dictionary<string, Image> { { "$button_core_1", LineCoreUp } }, 0.53f, "Core2");
			SetButton(parent, "$button_core_3", new Dictionary<string, Image> { { "$button_core_2", LineUp2Right } }, 1f, "Core3");
			SetButton(parent, "$button_core_4", new Dictionary<string, Image> { { "$button_core_2", LineUp2Left } }, 1f, "Core4");
			SetButton(parent, "$button_core_5", new Dictionary<string, Image>
			{
				{ "$button_lumberjack", LineUp3Right },
				{ "$button_warrior_6", LineRadial8 }
			}, 1f, "Core5");
			SetButton(parent, "$button_core_6", new Dictionary<string, Image>
			{
				{ "$button_lumberjack", LineUp4Left },
				{ "$button_bard_5", LineRadial1 }
			}, 1f, "Core6");
			SetButton(parent2, "$button_lumberjack", new Dictionary<string, Image>
			{
				{ "$button_core_2", LineCoreUp },
				{ "$button_core_6", LineUp4Left },
				{ "$button_core_5", LineUp3Right }
			}, 0.7f, "CoreComfort1");
			SetButton(parent2, "$button_chef", new Dictionary<string, Image> { { "$button_lumberjack", LineCoreUp } }, 1f, "CoreChef");
			SetButton(parent2, "$button_comfort_1", new Dictionary<string, Image> { { "$button_core_5", LineUp3RightUp } }, 1f, "CoreLumberjack");
			SetButton(parent2, "$button_comfort_2", new Dictionary<string, Image> { { "$button_core_6", LineUp4LeftUp } }, 1f, "CoreComfort2");
			SetButton(parent, "$button_core_7", new Dictionary<string, Image>
			{
				{ "$button_center", LineCoreDown },
				{ "$button_sneak", LineDown1Right },
				{ "$button_merchant", LineDown1Left }
			}, 0.4f, "Core7");
			SetButton(parent, "$button_core_8", new Dictionary<string, Image> { { "$button_core_7", LineCoreDown } }, 0.53f, "Core8");
			SetButton(parent, "$button_core_9", new Dictionary<string, Image> { { "$button_core_8", LineDown2Right } }, 1f, "Core9");
			SetButton(parent, "$button_core_10", new Dictionary<string, Image> { { "$button_core_8", LineDown2Left } }, 1f, "Core10");
			SetButton(parent, "$button_core_11", new Dictionary<string, Image>
			{
				{ "$button_treasure", LineDown3Right },
				{ "$button_sage_6", LineRadial4 }
			}, 1f, "Core11");
			SetButton(parent, "$button_core_12", new Dictionary<string, Image>
			{
				{ "$button_treasure", LineDown4Left },
				{ "$button_ranger_5", LineRadial5 }
			}, 1f, "Core12");
			SetButton(parent2, "$button_treasure", new Dictionary<string, Image>
			{
				{ "$button_core_8", LineCoreDown },
				{ "$button_core_11", LineDown3Right },
				{ "$button_core_12", LineDown4Left }
			}, 0.7f, "CoreTreasure");
			SetButton(parent2, "$button_sneak", new Dictionary<string, Image>
			{
				{ "$button_core_7", LineDown1Right },
				{ "$button_sage_1", LineSage1Left }
			}, 1f, "CoreSneak");
			SetButton(parent2, "$button_merchant", new Dictionary<string, Image>
			{
				{ "$button_core_7", LineDown1Left },
				{ "$button_ranger_1", LineRanger1Right }
			}, 1f, "CoreMerchant");
			SetButton(parent2, "$button_shield", new Dictionary<string, Image> { { "$button_core_11", LineDown3RightDown } }, 1f, "CoreCarry");
			SetButton(parent2, "$button_rain", new Dictionary<string, Image> { { "$button_core_12", LineDown4LeftDown } }, 1f, "RainProof");
			SetButton(parent2, "$button_sail", new Dictionary<string, Image> { { "$button_treasure", LineCoreDown } }, 1f, "CoreSail");
		}

		private static void SetBardButtonEvents()
		{
			Transform parent = Utils.FindChild(SkillTree_UI.transform, "$part_bard_talents", (IterativeSearchType)0);
			Transform parent2 = Utils.FindChild(SkillTree_UI.transform, "$part_bard_characteristics", (IterativeSearchType)0);
			SetButton(parent2, "$button_bard_1", new Dictionary<string, Image>
			{
				{ "$button_center", LineCoreBard },
				{ "$button_bard_talent_1", LineBard1Right },
				{ "$button_shaman_1", LineBard1Left }
			}, 0.4f, "Bard1");
			SetButton(parent2, "$button_bard_2", new Dictionary<string, Image> { { "$button_bard_1", LineCoreBard } }, 0.53f, "Bard2");
			SetButton(parent2, "$button_bard_3", new Dictionary<string, Image> { { "$button_bard_2", LineBard2Right } }, 1f, "Bard3");
			SetButton(parent2, "$button_bard_4", new Dictionary<string, Image> { { "$button_bard_2", LineBard2Left } }, 1f, "Bard4");
			SetButton(parent2, "$button_bard_5", new Dictionary<string, Image>
			{
				{ "$button_bard_talent_2", LineBard3Right },
				{ "$button_core_6", LineRadial1 }
			}, 1f, "Bard5");
			SetButton(parent2, "$button_bard_6", new Dictionary<string, Image>
			{
				{ "$button_bard_talent_2", LineBard4Left },
				{ "$button_shaman_5", LineRadial2 }
			}, 1f, "Bard6");
			SetButton(parent, "$button_bard_talent_1", new Dictionary<string, Image>
			{
				{ "$button_core_1", LineUp1Left },
				{ "$button_bard_1", LineBard1Right }
			}, 1f, "SongOfSpeed");
			SetButton(parent, "$button_bard_talent_2", new Dictionary<string, Image>
			{
				{ "$button_bard_2", LineCoreBard },
				{ "$button_bard_5", LineBard3Right },
				{ "$button_bard_6", LineBard4Left }
			}, 0.7f, "SongOfVitality");
			SetButton(parent, "$button_bard_talent_3", new Dictionary<string, Image> { { "$button_bard_5", LineBard3RightUp } }, 1f, "SongOfDamage");
			SetButton(parent, "$button_bard_talent_4", new Dictionary<string, Image> { { "$button_bard_6", LineBard4LeftUp } }, 1f, "SongOfHealing");
			SetButton(parent, "$button_bard_talent_5", new Dictionary<string, Image> { { "$button_bard_talent_2", LineCoreBard } }, 1f, "SongOfSpirit");
		}

		private static void SetShamanButtonEvents()
		{
			Transform parent = Utils.FindChild(SkillTree_UI.transform, "$part_shaman_talents", (IterativeSearchType)0);
			Transform parent2 = Utils.FindChild(SkillTree_UI.transform, "$part_shaman_characteristics", (IterativeSearchType)0);
			SetButton(parent2, "$button_shaman_1", new Dictionary<string, Image>
			{
				{ "$button_center", LineCoreShaman },
				{ "$button_shaman_talent_1", LineShaman1Right },
				{ "$button_sage_talent_1", LineShaman1Left }
			}, 0.4f, "Shaman1");
			SetButton(parent2, "$button_shaman_2", new Dictionary<string, Image> { { "$button_shaman_1", LineCoreShaman } }, 0.53f, "Shaman2");
			SetButton(parent2, "$button_shaman_3", new Dictionary<string, Image> { { "$button_shaman_2", LineShaman2Right } }, 1f, "Shaman3");
			SetButton(parent2, "$button_shaman_4", new Dictionary<string, Image> { { "$button_shaman_2", LineShaman2Left } }, 1f, "Shaman4");
			SetButton(parent2, "$button_shaman_5", new Dictionary<string, Image>
			{
				{ "$button_shaman_talent_2", LineShaman3Right },
				{ "$button_bard_6", LineRadial2 }
			}, 1f, "Shaman5");
			SetButton(parent2, "$button_shaman_6", new Dictionary<string, Image>
			{
				{ "$button_shaman_talent_2", LineShaman4Left },
				{ "$button_sage_5", LineRadial3 }
			}, 1f, "Shaman6");
			SetButton(parent, "$button_shaman_talent_1", new Dictionary<string, Image>
			{
				{ "$button_bard_1", LineBard1Left },
				{ "$button_shaman_1", LineShaman1Right }
			}, 1f, "ShamanHeal");
			SetButton(parent, "$button_shaman_talent_2", new Dictionary<string, Image>
			{
				{ "$button_shaman_2", LineCoreShaman },
				{ "$button_shaman_5", LineShaman3Right },
				{ "$button_shaman_6", LineShaman4Left }
			}, 0.7f, "RootBeam");
			SetButton(parent, "$button_shaman_talent_3", new Dictionary<string, Image> { { "$button_shaman_5", LineShaman3RightUp } }, 1f, "ShamanGhosts");
			SetButton(parent, "$button_shaman_talent_4", new Dictionary<string, Image> { { "$button_shaman_6", LineShaman4LeftUp } }, 1f, "ShamanRegeneration");
			SetButton(parent, "$button_shaman_talent_5", new Dictionary<string, Image> { { "$button_shaman_talent_2", LineCoreShaman } }, 1f, "ShamanShield");
		}

		private static void SetSageButtonEvents()
		{
			Transform parent = Utils.FindChild(SkillTree_UI.transform, "$part_sage_talents", (IterativeSearchType)0);
			Transform parent2 = Utils.FindChild(SkillTree_UI.transform, "$part_sage_characteristics", (IterativeSearchType)0);
			SetButton(parent2, "$button_sage_1", new Dictionary<string, Image>
			{
				{ "$button_center", LineCoreSage },
				{ "$button_sage_talent_1", LineSage1Right },
				{ "$button_sneak", LineSage1Left }
			}, 0.4f, "Sage1");
			SetButton(parent2, "$button_sage_2", new Dictionary<string, Image> { { "$button_sage_1", LineCoreSage } }, 0.53f, "Sage2");
			SetButton(parent2, "$button_sage_3", new Dictionary<string, Image> { { "$button_sage_2", LineSage2Right } }, 1f, "Sage3");
			SetButton(parent2, "$button_sage_4", new Dictionary<string, Image> { { "$button_sage_2", LineSage2Left } }, 1f, "Sage4");
			SetButton(parent2, "$button_sage_5", new Dictionary<string, Image>
			{
				{ "$button_sage_talent_4", LineSage3Right },
				{ "$button_shaman_6", LineRadial3 }
			}, 1f, "Sage5");
			SetButton(parent2, "$button_sage_6", new Dictionary<string, Image>
			{
				{ "$button_sage_talent_4", LineSage4Left },
				{ "$button_core_11", LineRadial4 }
			}, 1f, "Sage6");
			SetButton(parent, "$button_sage_talent_1", new Dictionary<string, Image>
			{
				{ "$button_shaman_1", LineShaman1Left },
				{ "$button_sage_1", LineSage1Right }
			}, 1f, "StoneThrow");
			SetButton(parent, "$button_sage_talent_4", new Dictionary<string, Image>
			{
				{ "$button_sage_2", LineCoreSage },
				{ "$button_sage_6", LineSage4Left },
				{ "$button_sage_5", LineSage3Right }
			}, 0.7f, "CallOfLightning");
			SetButton(parent, "$button_sage_talent_3", new Dictionary<string, Image> { { "$button_sage_6", LineSage4LeftUp } }, 1f, "MeteorStrike");
			SetButton(parent, "$button_sage_talent_2", new Dictionary<string, Image> { { "$button_sage_5", LineSage3RightUp } }, 1f, "GoblinBeam");
			SetButton(parent, "$button_sage_talent_5", new Dictionary<string, Image> { { "$button_sage_talent_4", LineCoreSage } }, 1f, "IceBreath");
		}

		private static void SetRangerButtonEvents()
		{
			Transform parent = Utils.FindChild(SkillTree_UI.transform, "$part_ranger_talents", (IterativeSearchType)0);
			Transform parent2 = Utils.FindChild(SkillTree_UI.transform, "$part_ranger_characteristics", (IterativeSearchType)0);
			SetButton(parent2, "$button_ranger_1", new Dictionary<string, Image>
			{
				{ "$button_center", LineCoreRanger },
				{ "$button_ranger_talent_1", LineRanger1Left },
				{ "$button_merchant", LineRanger1Right }
			}, 0.4f, "Ranger1");
			SetButton(parent2, "$button_ranger_2", new Dictionary<string, Image> { { "$button_ranger_1", LineCoreRanger } }, 0.53f, "Ranger2");
			SetButton(parent2, "$button_ranger_3", new Dictionary<string, Image> { { "$button_ranger_2", LineRanger2Right } }, 1f, "Ranger3");
			SetButton(parent2, "$button_ranger_4", new Dictionary<string, Image> { { "$button_ranger_2", LineRanger2Left } }, 1f, "Ranger4");
			SetButton(parent2, "$button_ranger_5", new Dictionary<string, Image>
			{
				{ "$button_ranger_talent_2", LineRanger3Right },
				{ "$button_core_12", LineRadial5 }
			}, 1f, "Ranger5");
			SetButton(parent2, "$button_ranger_6", new Dictionary<string, Image>
			{
				{ "$button_ranger_talent_2", LineRanger4Left },
				{ "$button_rogue_5", LineRadial6 }
			}, 1f, "Ranger6");
			SetButton(parent, "$button_ranger_talent_1", new Dictionary<string, Image>
			{
				{ "$button_rogue_1", LineRogue1Right },
				{ "$button_ranger_1", LineRanger1Left }
			}, 1f, "DeerHunter");
			SetButton(parent, "$button_ranger_talent_2", new Dictionary<string, Image>
			{
				{ "$button_ranger_2", LineCoreRanger },
				{ "$button_ranger_5", LineRanger3Right },
				{ "$button_ranger_6", LineRanger4Left }
			}, 0.7f, "LuckyShot");
			SetButton(parent, "$button_ranger_talent_3", new Dictionary<string, Image> { { "$button_ranger_5", LineRanger3RightUp } }, 1f, "RangerTamer");
			SetButton(parent, "$button_ranger_talent_4", new Dictionary<string, Image> { { "$button_ranger_6", LineRanger4LeftUp } }, 1f, "RangerTrap");
			SetButton(parent, "$button_ranger_talent_5", new Dictionary<string, Image> { { "$button_ranger_talent_2", LineCoreRanger } }, 1f, "QuickShot");
		}

		private static void SetRogueButtonEvents()
		{
			Transform parent = Utils.FindChild(SkillTree_UI.transform, "$part_rogue_talents", (IterativeSearchType)0);
			Transform parent2 = Utils.FindChild(SkillTree_UI.transform, "$part_rogue_characteristics", (IterativeSearchType)0);
			SetButton(parent2, "$button_rogue_1", new Dictionary<string, Image>
			{
				{ "$button_center", LineCoreRogue },
				{ "$button_ranger_talent_1", LineRogue1Right },
				{ "$button_rogue_talent_1", LineRogue1Left }
			}, 0.4f, "Rogue1");
			SetButton(parent2, "$button_rogue_2", new Dictionary<string, Image> { { "$button_rogue_1", LineCoreRogue } }, 0.53f, "Rogue2");
			SetButton(parent2, "$button_rogue_3", new Dictionary<string, Image> { { "$button_rogue_2", LineRogue2Right } }, 1f, "Rogue3");
			SetButton(parent2, "$button_rogue_4", new Dictionary<string, Image> { { "$button_rogue_2", LineRogue2Left } }, 1f, "Rogue4");
			SetButton(parent2, "$button_rogue_5", new Dictionary<string, Image>
			{
				{ "$button_rogue_talent_2", LineRogue3Right },
				{ "$button_ranger_6", LineRadial6 }
			}, 1f, "Rogue5");
			SetButton(parent2, "$button_rogue_6", new Dictionary<string, Image>
			{
				{ "$button_rogue_talent_2", LineRogue4Left },
				{ "$button_warrior_5", LineRadial7 }
			}, 1f, "Rogue6");
			SetButton(parent, "$button_rogue_talent_1", new Dictionary<string, Image>
			{
				{ "$button_rogue_1", LineRogue1Left },
				{ "$button_warrior_1", LineWarrior1Right }
			}, 1f, "RogueSpeed");
			SetButton(parent, "$button_rogue_talent_2", new Dictionary<string, Image>
			{
				{ "$button_rogue_2", LineCoreRogue },
				{ "$button_rogue_5", LineRogue3Right },
				{ "$button_rogue_6", LineRogue4Left }
			}, 0.7f, "RogueReflect");
			SetButton(parent, "$button_rogue_talent_3", new Dictionary<string, Image> { { "$button_rogue_5", LineRogue3RightUp } }, 1f, "RogueDamage");
			SetButton(parent, "$button_rogue_talent_4", new Dictionary<string, Image> { { "$button_rogue_6", LineRogue4LeftUp } }, 1f, "RogueStamina");
			SetButton(parent, "$button_rogue_talent_5", new Dictionary<string, Image> { { "$button_rogue_talent_2", LineCoreRogue } }, 1f, "RogueBleed");
		}

		private static void SetWarriorButtonEvents()
		{
			Transform parent = Utils.FindChild(SkillTree_UI.transform, "$part_warrior_talents", (IterativeSearchType)0);
			Transform parent2 = Utils.FindChild(SkillTree_UI.transform, "$part_warrior_characteristics", (IterativeSearchType)0);
			SetButton(parent2, "$button_warrior_1", new Dictionary<string, Image>
			{
				{ "$button_center", LineCoreWarrior },
				{ "$button_rogue_talent_1", LineWarrior1Left },
				{ "$button_warrior_talent_1", LineWarrior1Right }
			}, 0.4f, "Warrior1");
			SetButton(parent2, "$button_warrior_2", new Dictionary<string, Image> { { "$button_warrior_1", LineCoreWarrior } }, 0.53f, "Warrior2");
			SetButton(parent2, "$button_warrior_3", new Dictionary<string, Image> { { "$button_warrior_2", LineWarrior2Right } }, 1f, "War