Decompiled source of HarrisonEpicSkillSystem v0.0.31

BepInEx/plugins/HarrisonEpicSkillSystem/HarrisonEpicSkillSystem.dll

Decompiled a day ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Serialization;
using System.Runtime.Serialization.Json;
using System.Runtime.Versioning;
using System.Text;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using HarrisonEpicSkillSystem.Combat;
using HarrisonEpicSkillSystem.Compatibility;
using HarrisonEpicSkillSystem.Runtime;
using HarrisonEpicSkillSystem.Skills;
using HarrisonEpicSkillSystem.Tree;
using HarrisonEpicSkillSystem.UI;
using Jotunn.Entities;
using Jotunn.Managers;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.Events;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyCompany("HarrisonEpicSkillSystem")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("0.0.31.0")]
[assembly: AssemblyInformationalVersion("0.0.31")]
[assembly: AssemblyProduct("HarrisonEpicSkillSystem")]
[assembly: AssemblyTitle("HarrisonEpicSkillSystem")]
[assembly: AssemblyVersion("0.0.31.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

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

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

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

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace HarrisonEpicSkillSystem
{
	[BepInPlugin("com.harrison.valheim.epicskillsystem", "HarrisonEpicSkillSystem", "0.0.31")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public sealed class HarrisonEpicSkillSystemPlugin : BaseUnityPlugin
	{
		private static HarrisonEpicSkillSystemPlugin? Instance;

		public const string ModGuid = "com.harrison.valheim.epicskillsystem";

		public const string ModName = "HarrisonEpicSkillSystem";

		public const string ModVersion = "0.0.31";

		public const string ClassModGuid = "com.harrison.valheim.epicclasssystem";

		public const string WackyModGuid = "WackyMole.EpicMMOSystem";

		private readonly SkillRegistry _registry = new SkillRegistry();

		private IClassStateProvider? _classes;

		private bool _ready;

		private MmoSkillMenu? _skillMenu;

		private BaseSkillController? _controller;

		private SkillTreeService? _tree;

		private TreeStatHooks? _treeStats;

		private TreeYieldHooks? _yield;

		private SkillEffectsCompendium? _compendium;

		private SkillHud? _hud;

		private SkillCastVfx? _vfx;

		private VanillaAssetCache? _vanillaAssets;

		private CustomVfxRegistry? _customVfx;

		private SkillPresentationNetwork? _presentationNetwork;

		private SkillMotionLock? _motionLock;

		private SkillCastSequencer? _sequencer;

		private SkillLoadoutService? _loadout;

		private PassiveCombatHooks? _passives;

		private void Awake()
		{
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Expected O, but got Unknown
			Instance = this;
			try
			{
				if (!Chainloader.PluginInfos.TryGetValue("com.harrison.valheim.epicclasssystem", out var value) || (Object)(object)value.Instance == (Object)null)
				{
					throw new InvalidOperationException("Required HarrisonEpicClassSystem is missing.");
				}
				if (value.Metadata.Version < new Version("0.0.21"))
				{
					throw new InvalidOperationException($"Requires Class mod 0.0.21 or newer; found {value.Metadata.Version}.");
				}
				if (!Chainloader.PluginInfos.TryGetValue("WackyMole.EpicMMOSystem", out var value2) || (Object)(object)value2.Instance == (Object)null)
				{
					throw new InvalidOperationException("Required WackyEpicMMOSystem is missing.");
				}
				_classes = new ReflectionClassStateProvider(((object)value.Instance).GetType().Assembly);
				ConfigFile val = new ConfigFile(Path.Combine(Paths.ConfigPath, "HarrisonEpicSkillSystem.cfg"), true, ((BaseUnityPlugin)this).Info.Metadata)
				{
					SaveOnConfigSet = false
				};
				BaseClassCatalog.Register(val, this, _registry);
				TieredSkillCatalog.Register(val, _registry);
				_registry.SealAndValidate();
				_registry.ValidateTreeBindings(new TreeModel());
				SkillCastEvents.Log = ((BaseUnityPlugin)this).Logger;
				SkillCastEvents.Cast += OnCast;
				_presentationNetwork = new SkillPresentationNetwork(_registry.Skills.Select((ActiveSkill skill) => skill.Id).ToList(), ((BaseUnityPlugin)this).Logger);
				_ready = !GUIManager.IsHeadless();
				if (_ready)
				{
					_tree = new SkillTreeService(val, ((object)value2.Instance).GetType().Assembly, _classes, ((BaseUnityPlugin)this).Logger);
					_treeStats = new TreeStatHooks(_tree);
					_yield = new TreeYieldHooks(_tree);
					foreach (ActiveSkill skill in _registry.Skills)
					{
						ActiveSkill captured = skill;
						skill.UnlockCheck = () => _tree.Ready && _tree.IsSkillUnlocked(captured);
						skill.StaminaCostScale = () => 1f - (_tree.Ready ? _tree.Bonuses.AttackCostReduction : 0f);
						skill.EitrCostScale = () => 1f - (_tree.Ready ? Mathf.Clamp(_tree.Bonuses.EitrCostReduction, 0f, 0.5f) : 0f);
					}
					_loadout = new SkillLoadoutService(val, _registry, _tree);
					_controller = new BaseSkillController(val, this, _classes, _registry.Skills, () => _skillMenu?.IsMmoVisible ?? false, _tree, _loadout);
					_skillMenu = new MmoSkillMenu(((object)value2.Instance).GetType().Assembly, ((object)value.Instance).GetType().Assembly, _classes, _registry.Skills, ((BaseUnityPlugin)this).Logger, _tree, _loadout);
					_skillMenu.BindingLabel = _controller.BindingLabel;
					_compendium = new SkillEffectsCompendium(_tree, _registry.Skills, _controller.BindingLabel, _controller.AssignedSkill);
					_vanillaAssets = new VanillaAssetCache(((BaseUnityPlugin)this).Logger);
					_vanillaAssets.Initialize();
					_customVfx = new CustomVfxRegistry(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location) ?? Paths.PluginPath, ((BaseUnityPlugin)this).Logger);
					_motionLock = new SkillMotionLock();
					_sequencer = new SkillCastSequencer(val, this, _motionLock, _registry.Skills, ((BaseUnityPlugin)this).Logger);
					_vfx = new SkillCastVfx(val, _registry.Skills, _vanillaAssets, _presentationNetwork, _customVfx, ((BaseUnityPlugin)this).Logger);
					_passives = new PassiveCombatHooks(val, this, _classes, _tree, ((BaseUnityPlugin)this).Logger);
					_hud = new SkillHud(val, _tree, _controller.BindingLabel, _controller.AssignedSkill, () => _skillMenu.IsMmoVisible || _classes.IsClassMenuOpen || Menu.IsVisible() || InventoryGui.IsVisible() || Minimap.IsOpen() || Console.IsVisible());
				}
				else
				{
					_yield = new TreeYieldHooks(null);
				}
				val.Save();
				val.SaveOnConfigSet = true;
				((BaseUnityPlugin)this).Logger.LogInfo((object)string.Format("{0} initialized; {1} skill(s). Config: {2}", "HarrisonEpicSkillSystem", _registry.Skills.Count, val.ConfigFilePath));
			}
			catch (Exception arg)
			{
				_ready = false;
				_compendium?.Dispose();
				_compendium = null;
				_hud?.Dispose();
				_hud = null;
				_passives?.Dispose();
				_passives = null;
				_yield?.Dispose();
				_yield = null;
				_vfx?.Dispose();
				_vfx = null;
				_sequencer?.Dispose();
				_sequencer = null;
				_motionLock?.Dispose();
				_motionLock = null;
				_customVfx?.Dispose();
				_customVfx = null;
				_vanillaAssets?.Dispose();
				_vanillaAssets = null;
				_presentationNetwork?.Dispose();
				_presentationNetwork = null;
				_treeStats?.Dispose();
				_treeStats = null;
				_controller?.Dispose();
				_controller = null;
				_skillMenu?.Dispose();
				_skillMenu = null;
				((Behaviour)this).enabled = false;
				SkillCastEvents.Cast -= OnCast;
				((BaseUnityPlugin)this).Logger.LogError((object)string.Format("{0} initialization aborted safely: {1}", "HarrisonEpicSkillSystem", arg));
			}
		}

		public static bool SetUltimateQuestCompleted(Player player, bool completed, out string reason)
		{
			reason = "Skill system is not ready.";
			HarrisonEpicSkillSystemPlugin instance = Instance;
			if (instance?._tree == null || (Object)(object)player == (Object)null || (Object)(object)player != (Object)(object)Player.m_localPlayer || !((Character)player).IsOwner())
			{
				return false;
			}
			return instance._tree.SetUltimateQuestCompleted(completed, out reason);
		}

		public static bool AssignAttack(Player player, SkillSlot slot, string skillId, out string reason)
		{
			reason = "Skill system is not ready.";
			HarrisonEpicSkillSystemPlugin instance = Instance;
			if (instance?._tree == null || instance._loadout == null || (Object)(object)player == (Object)null || (Object)(object)player != (Object)(object)Player.m_localPlayer || !((Character)player).IsOwner() || !instance._tree.TryGetClassState(out var state))
			{
				return false;
			}
			return instance._loadout.AssignAttack(state, slot, skillId, out reason);
		}

		private void Update()
		{
			try
			{
				_presentationNetwork?.Tick();
				if (_ready && _classes != null)
				{
					_tree?.Tick();
					_treeStats?.Tick();
					_yield?.Tick();
					_skillMenu?.Tick();
					_controller?.Tick();
					_motionLock?.Tick();
					_vfx?.Tick();
					_hud?.Tick();
				}
			}
			catch (Exception arg)
			{
				_ready = false;
				_compendium?.Dispose();
				_compendium = null;
				_hud?.Dispose();
				_hud = null;
				_passives?.Dispose();
				_passives = null;
				_yield?.Dispose();
				_yield = null;
				_vfx?.Dispose();
				_vfx = null;
				_sequencer?.Dispose();
				_sequencer = null;
				_motionLock?.Dispose();
				_motionLock = null;
				_customVfx?.Dispose();
				_customVfx = null;
				_vanillaAssets?.Dispose();
				_vanillaAssets = null;
				_presentationNetwork?.Dispose();
				_presentationNetwork = null;
				_treeStats?.Dispose();
				_treeStats = null;
				_controller?.Dispose();
				_controller = null;
				((BaseUnityPlugin)this).Logger.LogError((object)$"Skill input disabled after runtime failure: {arg}");
			}
		}

		private void OnCast(string skill, Player player, ClassState state)
		{
			ActiveSkill skill2;
			string text = ((_registry.TryGet(skill, out skill2) && (skill2 is BaseClassSkill || BerserkerSkillRules.IsFirstAwakeAttack(skill2.Id) || GladiatorSkillRules.IsFirstAwakeAttack(skill2.Id) || ProtectorSkillRules.IsFirstAwakeAttack(skill2.Id) || ElementalistSkillRules.IsFirstAwakeAttack(skill2.Id) || WarlockSkillRules.IsFirstAwakeAttack(skill2.Id) || SorcererSkillRules.IsFirstAwakeAttack(skill2.Id) || RangerSkillRules.IsFirstAwakeAttack(skill2.Id) || BeastmasterSkillRules.IsFirstAwakeAttack(skill2.Id) || MarksmanSkillRules.IsFirstAwakeAttack(skill2.Id) || AssassinSkillRules.IsFirstAwakeAttack(skill2.Id) || DuelistSkillRules.IsFirstAwakeAttack(skill2.Id) || TricksterSkillRules.IsFirstAwakeAttack(skill2.Id) || TemplarSkillRules.IsFirstAwakeAttack(skill2.Id) || InquisitorSkillRules.IsFirstAwakeAttack(skill2.Id) || ClericKnightSkillRules.IsFirstAwakeAttack(skill2.Id) || SecondWarriorSkillRules.IsSecondAttack(skill2.Id) || SecondMageSkillRules.IsSecondAttack(skill2.Id) || SecondHunterSkillRules.IsSecondAttack(skill2.Id) || SecondRogueSkillRules.IsSecondAttack(skill2.Id) || SecondPaladinSkillRules.IsSecondAttack(skill2.Id) || MythicWarriorSkillRules.IsUltimate(skill2.Id) || MythicMageSkillRules.IsUltimate(skill2.Id) || MythicHunterSkillRules.IsUltimate(skill2.Id) || MythicRogueSkillRules.IsUltimate(skill2.Id) || MythicPaladinSkillRules.IsUltimate(skill2.Id))) ? skill2.DisplayName : skill);
			((Character)player).Message((MessageType)2, text + "!", 0, (Sprite)null, false);
		}

		private void OnDestroy()
		{
			_ready = false;
			_compendium?.Dispose();
			_compendium = null;
			_hud?.Dispose();
			_hud = null;
			_passives?.Dispose();
			_passives = null;
			_yield?.Dispose();
			_yield = null;
			_vfx?.Dispose();
			_vfx = null;
			_sequencer?.Dispose();
			_sequencer = null;
			_motionLock?.Dispose();
			_motionLock = null;
			_customVfx?.Dispose();
			_customVfx = null;
			_vanillaAssets?.Dispose();
			_vanillaAssets = null;
			_presentationNetwork?.Dispose();
			_presentationNetwork = null;
			_treeStats?.Dispose();
			_treeStats = null;
			_controller?.Dispose();
			_controller = null;
			_skillMenu?.Dispose();
			_skillMenu = null;
			SkillCastEvents.Cast -= OnCast;
			_classes = null;
			SkillVisualAssets.Dispose();
			if ((Object)(object)Instance == (Object)(object)this)
			{
				Instance = null;
			}
		}
	}
}
namespace HarrisonEpicSkillSystem.UI
{
	internal static class ActiveSkillIconIndex
	{
		private static readonly Dictionary<string, string> Names = new Dictionary<string, string>(StringComparer.Ordinal)
		{
			["Cleaving Strike"] = "base_warrior_1",
			["Brace"] = "base_warrior_2",
			["Arcane Bolt"] = "base_mage_1",
			["Arcane Ward"] = "base_mage_2",
			["Piercing Shot"] = "base_hunter_1",
			["Trail Step"] = "base_hunter_2",
			["Quick Cut"] = "base_rogue_1",
			["Smoke Step"] = "base_rogue_2",
			["Shield Strike"] = "base_paladin_1",
			["Steadfast"] = "base_paladin_2",
			["Greater Cleave"] = "base_warrior_3",
			["Iron Guard"] = "base_warrior_4",
			["Charged Arcane Bolt"] = "base_mage_3",
			["Greater Ward"] = "base_mage_4",
			["Power Shot"] = "base_hunter_3",
			["Fleet Retreat"] = "base_hunter_4",
			["Shadow Cut"] = "base_rogue_3",
			["Deep Smoke"] = "base_rogue_4",
			["Judgment Strike"] = "base_paladin_3",
			["Divine Resolve"] = "base_paladin_4",
			["warrior_berserker.1"] = "warrior_berserker_rank1_1",
			["warrior_berserker.2"] = "warrior_berserker_rank1_2",
			["warrior_berserker.3"] = "warrior_berserker_rank1_3",
			["warrior_berserker.4"] = "warrior_berserker_rank1_4",
			["warrior_gladiator.1"] = "warrior_gladiator_rank1_1",
			["warrior_gladiator.2"] = "warrior_gladiator_rank1_2",
			["warrior_gladiator.3"] = "warrior_gladiator_rank1_3",
			["warrior_gladiator.4"] = "warrior_gladiator_rank1_4",
			["warrior_protector.1"] = "warrior_protector_rank1_1",
			["warrior_protector.2"] = "warrior_protector_rank1_2",
			["warrior_protector.3"] = "warrior_protector_rank1_3",
			["warrior_protector.4"] = "warrior_protector_rank1_4",
			["mage_elementalist.1"] = "mage_elementalist_rank1_1",
			["mage_elementalist.2"] = "mage_elementalist_rank1_2",
			["mage_elementalist.3"] = "mage_elementalist_rank1_3",
			["mage_elementalist.4"] = "mage_elementalist_rank1_4",
			["mage_warlock.1"] = "mage_warlock_rank1_1",
			["mage_warlock.2"] = "mage_warlock_rank1_2",
			["mage_warlock.3"] = "mage_warlock_rank1_3",
			["mage_warlock.4"] = "mage_warlock_rank1_4",
			["mage_sorcerer.1"] = "mage_sorcerer_rank1_1",
			["mage_sorcerer.2"] = "mage_sorcerer_rank1_2",
			["mage_sorcerer.3"] = "mage_sorcerer_rank1_3",
			["mage_sorcerer.4"] = "mage_sorcerer_rank1_4",
			["hunter_ranger.1"] = "hunter_ranger_rank1_1",
			["hunter_ranger.2"] = "hunter_ranger_rank1_2",
			["hunter_ranger.3"] = "hunter_ranger_rank1_3",
			["hunter_ranger.4"] = "hunter_ranger_rank1_4",
			["hunter_beastmaster.1"] = "hunter_beastmaster_rank1_1",
			["hunter_beastmaster.2"] = "hunter_beastmaster_rank1_2",
			["hunter_beastmaster.3"] = "hunter_beastmaster_rank1_3",
			["hunter_beastmaster.4"] = "hunter_beastmaster_rank1_4",
			["hunter_marksman.1"] = "hunter_marksman_rank1_1",
			["hunter_marksman.2"] = "hunter_marksman_rank1_2",
			["hunter_marksman.3"] = "hunter_marksman_rank1_3",
			["hunter_marksman.4"] = "hunter_marksman_rank1_4",
			["rogue_assassin.1"] = "rogue_assassin_rank1_1",
			["rogue_assassin.2"] = "rogue_assassin_rank1_2",
			["rogue_assassin.3"] = "rogue_assassin_rank1_3",
			["rogue_assassin.4"] = "rogue_assassin_rank1_4",
			["rogue_duelist.1"] = "rogue_duelist_rank1_1",
			["rogue_duelist.2"] = "rogue_duelist_rank1_2",
			["rogue_duelist.3"] = "rogue_duelist_rank1_3",
			["rogue_duelist.4"] = "rogue_duelist_rank1_4",
			["rogue_trickster.1"] = "rogue_trickster_rank1_1",
			["rogue_trickster.2"] = "rogue_trickster_rank1_2",
			["rogue_trickster.3"] = "rogue_trickster_rank1_3",
			["rogue_trickster.4"] = "rogue_trickster_rank1_4",
			["paladin_templar.1"] = "paladin_templar_rank1_1",
			["paladin_templar.2"] = "paladin_templar_rank1_2",
			["paladin_templar.3"] = "paladin_templar_rank1_3",
			["paladin_templar.4"] = "paladin_templar_rank1_4",
			["paladin_inquisitor.1"] = "paladin_inquisitor_rank1_1",
			["paladin_inquisitor.2"] = "paladin_inquisitor_rank1_2",
			["paladin_inquisitor.3"] = "paladin_inquisitor_rank1_3",
			["paladin_inquisitor.4"] = "paladin_inquisitor_rank1_4",
			["paladin_clericknight.1"] = "paladin_clericknight_rank1_1",
			["paladin_clericknight.2"] = "paladin_clericknight_rank1_2",
			["paladin_clericknight.3"] = "paladin_clericknight_rank1_3",
			["paladin_clericknight.4"] = "paladin_clericknight_rank1_4",
			["warrior_berserker.rank2.1"] = "warrior_berserker_rank2_1",
			["warrior_berserker.rank2.2"] = "warrior_berserker_rank2_2",
			["warrior_berserker.rank2.3"] = "warrior_berserker_rank2_3",
			["warrior_berserker.rank2.4"] = "warrior_berserker_rank2_4",
			["warrior_gladiator.rank2.1"] = "warrior_gladiator_rank2_1",
			["warrior_gladiator.rank2.2"] = "warrior_gladiator_rank2_2",
			["warrior_gladiator.rank2.3"] = "warrior_gladiator_rank2_3",
			["warrior_gladiator.rank2.4"] = "warrior_gladiator_rank2_4",
			["warrior_protector.rank2.1"] = "warrior_protector_rank2_1",
			["warrior_protector.rank2.2"] = "warrior_protector_rank2_2",
			["warrior_protector.rank2.3"] = "warrior_protector_rank2_3",
			["warrior_protector.rank2.4"] = "warrior_protector_rank2_4",
			["mage_elementalist.rank2.1"] = "mage_elementalist_rank2_1",
			["mage_elementalist.rank2.2"] = "mage_elementalist_rank2_2",
			["mage_elementalist.rank2.3"] = "mage_elementalist_rank2_3",
			["mage_elementalist.rank2.4"] = "mage_elementalist_rank2_4",
			["mage_warlock.rank2.1"] = "mage_warlock_rank2_1",
			["mage_warlock.rank2.2"] = "mage_warlock_rank2_2",
			["mage_warlock.rank2.3"] = "mage_warlock_rank2_3",
			["mage_warlock.rank2.4"] = "mage_warlock_rank2_4",
			["mage_sorcerer.rank2.1"] = "mage_sorcerer_rank2_1",
			["mage_sorcerer.rank2.2"] = "mage_sorcerer_rank2_2",
			["mage_sorcerer.rank2.3"] = "mage_sorcerer_rank2_3",
			["mage_sorcerer.rank2.4"] = "mage_sorcerer_rank2_4",
			["hunter_ranger.rank2.1"] = "hunter_ranger_rank2_1",
			["hunter_ranger.rank2.2"] = "hunter_ranger_rank2_2",
			["hunter_ranger.rank2.3"] = "hunter_ranger_rank2_3",
			["hunter_ranger.rank2.4"] = "hunter_ranger_rank2_4",
			["hunter_beastmaster.rank2.1"] = "hunter_beastmaster_rank2_1",
			["hunter_beastmaster.rank2.2"] = "hunter_beastmaster_rank2_2",
			["hunter_beastmaster.rank2.3"] = "hunter_beastmaster_rank2_3",
			["hunter_beastmaster.rank2.4"] = "hunter_beastmaster_rank2_4",
			["hunter_marksman.rank2.1"] = "hunter_marksman_rank2_1",
			["hunter_marksman.rank2.2"] = "hunter_marksman_rank2_2",
			["hunter_marksman.rank2.3"] = "hunter_marksman_rank2_3",
			["hunter_marksman.rank2.4"] = "hunter_marksman_rank2_4",
			["rogue_assassin.rank2.1"] = "rogue_assassin_rank2_1",
			["rogue_assassin.rank2.2"] = "rogue_assassin_rank2_2",
			["rogue_assassin.rank2.3"] = "rogue_assassin_rank2_3",
			["rogue_assassin.rank2.4"] = "rogue_assassin_rank2_4",
			["rogue_duelist.rank2.1"] = "rogue_duelist_rank2_1",
			["rogue_duelist.rank2.2"] = "rogue_duelist_rank2_2",
			["rogue_duelist.rank2.3"] = "rogue_duelist_rank2_3",
			["rogue_duelist.rank2.4"] = "rogue_duelist_rank2_4",
			["rogue_trickster.rank2.1"] = "rogue_trickster_rank2_1",
			["rogue_trickster.rank2.2"] = "rogue_trickster_rank2_2",
			["rogue_trickster.rank2.3"] = "rogue_trickster_rank2_3",
			["rogue_trickster.rank2.4"] = "rogue_trickster_rank2_4",
			["paladin_templar.rank2.1"] = "paladin_templar_rank2_1",
			["paladin_templar.rank2.2"] = "paladin_templar_rank2_2",
			["paladin_templar.rank2.3"] = "paladin_templar_rank2_3",
			["paladin_templar.rank2.4"] = "paladin_templar_rank2_4",
			["paladin_inquisitor.rank2.1"] = "paladin_inquisitor_rank2_1",
			["paladin_inquisitor.rank2.2"] = "paladin_inquisitor_rank2_2",
			["paladin_inquisitor.rank2.3"] = "paladin_inquisitor_rank2_3",
			["paladin_inquisitor.rank2.4"] = "paladin_inquisitor_rank2_4",
			["paladin_clericknight.rank2.1"] = "paladin_clericknight_rank2_1",
			["paladin_clericknight.rank2.2"] = "paladin_clericknight_rank2_2",
			["paladin_clericknight.rank2.3"] = "paladin_clericknight_rank2_3",
			["paladin_clericknight.rank2.4"] = "paladin_clericknight_rank2_4",
			["warrior_berserker.rank3.1"] = "warrior_berserker_rank3_1",
			["warrior_berserker.rank3.2"] = "warrior_berserker_rank3_2",
			["warrior_berserker.rank3.3"] = "warrior_berserker_rank3_3",
			["warrior_berserker.rank3.4"] = "warrior_berserker_rank3_4",
			["warrior_gladiator.rank3.1"] = "warrior_gladiator_rank3_1",
			["warrior_gladiator.rank3.2"] = "warrior_gladiator_rank3_2",
			["warrior_gladiator.rank3.3"] = "warrior_gladiator_rank3_3",
			["warrior_gladiator.rank3.4"] = "warrior_gladiator_rank3_4",
			["warrior_protector.rank3.1"] = "warrior_protector_rank3_1",
			["warrior_protector.rank3.2"] = "warrior_protector_rank3_2",
			["warrior_protector.rank3.3"] = "warrior_protector_rank3_3",
			["warrior_protector.rank3.4"] = "warrior_protector_rank3_4",
			["mage_elementalist.rank3.1"] = "mage_elementalist_rank3_1",
			["mage_elementalist.rank3.2"] = "mage_elementalist_rank3_2",
			["mage_elementalist.rank3.3"] = "mage_elementalist_rank3_3",
			["mage_elementalist.rank3.4"] = "mage_elementalist_rank3_4",
			["mage_warlock.rank3.1"] = "mage_warlock_rank3_1",
			["mage_warlock.rank3.2"] = "mage_warlock_rank3_2",
			["mage_warlock.rank3.3"] = "mage_warlock_rank3_3",
			["mage_warlock.rank3.4"] = "mage_warlock_rank3_4",
			["mage_sorcerer.rank3.1"] = "mage_sorcerer_rank3_1",
			["mage_sorcerer.rank3.2"] = "mage_sorcerer_rank3_2",
			["mage_sorcerer.rank3.3"] = "mage_sorcerer_rank3_3",
			["mage_sorcerer.rank3.4"] = "mage_sorcerer_rank3_4",
			["hunter_ranger.rank3.1"] = "hunter_ranger_rank3_1",
			["hunter_ranger.rank3.2"] = "hunter_ranger_rank3_2",
			["hunter_ranger.rank3.3"] = "hunter_ranger_rank3_3",
			["hunter_ranger.rank3.4"] = "hunter_ranger_rank3_4",
			["hunter_beastmaster.rank3.1"] = "hunter_beastmaster_rank3_1",
			["hunter_beastmaster.rank3.2"] = "hunter_beastmaster_rank3_2",
			["hunter_beastmaster.rank3.3"] = "hunter_beastmaster_rank3_3",
			["hunter_beastmaster.rank3.4"] = "hunter_beastmaster_rank3_4",
			["hunter_marksman.rank3.1"] = "hunter_marksman_rank3_1",
			["hunter_marksman.rank3.2"] = "hunter_marksman_rank3_2",
			["hunter_marksman.rank3.3"] = "hunter_marksman_rank3_3",
			["hunter_marksman.rank3.4"] = "hunter_marksman_rank3_4",
			["rogue_assassin.rank3.1"] = "rogue_assassin_rank3_1",
			["rogue_assassin.rank3.2"] = "rogue_assassin_rank3_2",
			["rogue_assassin.rank3.3"] = "rogue_assassin_rank3_3",
			["rogue_assassin.rank3.4"] = "rogue_assassin_rank3_4",
			["rogue_duelist.rank3.1"] = "rogue_duelist_rank3_1",
			["rogue_duelist.rank3.2"] = "rogue_duelist_rank3_2",
			["rogue_duelist.rank3.3"] = "rogue_duelist_rank3_3",
			["rogue_duelist.rank3.4"] = "rogue_duelist_rank3_4",
			["rogue_trickster.rank3.1"] = "rogue_trickster_rank3_1",
			["rogue_trickster.rank3.2"] = "rogue_trickster_rank3_2",
			["rogue_trickster.rank3.3"] = "rogue_trickster_rank3_3",
			["rogue_trickster.rank3.4"] = "rogue_trickster_rank3_4",
			["paladin_templar.rank3.1"] = "paladin_templar_rank3_1",
			["paladin_templar.rank3.2"] = "paladin_templar_rank3_2",
			["paladin_templar.rank3.3"] = "paladin_templar_rank3_3",
			["paladin_templar.rank3.4"] = "paladin_templar_rank3_4",
			["paladin_inquisitor.rank3.1"] = "paladin_inquisitor_rank3_1",
			["paladin_inquisitor.rank3.2"] = "paladin_inquisitor_rank3_2",
			["paladin_inquisitor.rank3.3"] = "paladin_inquisitor_rank3_3",
			["paladin_inquisitor.rank3.4"] = "paladin_inquisitor_rank3_4",
			["paladin_clericknight.rank3.1"] = "paladin_clericknight_rank3_1",
			["paladin_clericknight.rank3.2"] = "paladin_clericknight_rank3_2",
			["paladin_clericknight.rank3.3"] = "paladin_clericknight_rank3_3",
			["paladin_clericknight.rank3.4"] = "paladin_clericknight_rank3_4"
		};

		public static bool TryGetName(string id, out string name)
		{
			return Names.TryGetValue(id, out name);
		}
	}
	internal sealed class MmoHudVisibility : IDisposable
	{
		private readonly List<FieldInfo> _fields = new List<FieldInfo>();

		private readonly Dictionary<GameObject, bool> _previous = new Dictionary<GameObject, bool>();

		private bool _hidden;

		public MmoHudVisibility(Assembly assembly)
		{
			string[] array = new string[3] { "EpicMMOSystem.MyUI", "EpicMMOSystem.view", "EpicMMOSystem.View" };
			foreach (string text in array)
			{
				Type type = assembly.GetType(text);
				if (type == null)
				{
					continue;
				}
				string[] array2 = ((!text.EndsWith("MyUI")) ? new string[3] { "Active", "HUD", "hud" } : new string[2] { "expPanelRoot", "expPanelBackground" });
				foreach (string name in array2)
				{
					FieldInfo field = type.GetField(name, BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
					if (field != null && (typeof(GameObject).IsAssignableFrom(field.FieldType) || typeof(Component).IsAssignableFrom(field.FieldType)))
					{
						_fields.Add(field);
					}
				}
			}
		}

		public void SetHidden(bool hidden, GameObject? protectedCanvas, bool refresh = false)
		{
			if (!hidden)
			{
				if (!_hidden)
				{
					return;
				}
				foreach (KeyValuePair<GameObject, bool> previou in _previous)
				{
					if ((Object)(object)previou.Key != (Object)null)
					{
						previou.Key.SetActive(previou.Value);
					}
				}
				_previous.Clear();
				_hidden = false;
				return;
			}
			if (!_hidden || refresh)
			{
				foreach (FieldInfo field in _fields)
				{
					object value = field.GetValue(null);
					object obj = ((value is GameObject) ? value : null);
					if (obj == null)
					{
						object obj2 = ((value is Component) ? value : null);
						obj = ((obj2 != null) ? ((Component)obj2).gameObject : null);
					}
					GameObject val = (GameObject)obj;
					if (!((Object)(object)val == (Object)null) && (!((Object)(object)protectedCanvas != (Object)null) || !protectedCanvas.transform.IsChildOf(val.transform)) && !_previous.ContainsKey(val))
					{
						_previous.Add(val, val.activeSelf);
					}
				}
			}
			_hidden = true;
			foreach (KeyValuePair<GameObject, bool> previou2 in _previous)
			{
				if ((Object)(object)previou2.Key != (Object)null && previou2.Key.activeSelf)
				{
					previou2.Key.SetActive(false);
				}
			}
		}

		public void Dispose()
		{
			SetHidden(hidden: false, null);
		}
	}
	internal sealed class MmoSkillMenu : IDisposable
	{
		private static MmoSkillMenu? _current;

		private readonly Harmony _harmony;

		private readonly ManualLogSource _log;

		private readonly IClassStateProvider _classes;

		private readonly IReadOnlyList<ActiveSkill> _skills;

		private readonly FieldInfo _rootField;

		private readonly FieldInfo _navigationField;

		private readonly FieldInfo _templateField;

		private readonly Func<bool> _visible;

		private readonly List<(RectTransform Rect, Vector2 Position)> _moved = new List<(RectTransform, Vector2)>();

		private GameObject? _button;

		private GameObject? _panel;

		private double _nextRefresh;

		private readonly SkillTreeService _tree;

		private readonly SkillLoadoutService _loadout;

		private readonly MmoHudVisibility _hud;

		private SkillTreeView? _treeView;

		public bool IsOpen
		{
			get
			{
				if ((Object)(object)_panel != (Object)null)
				{
					return _panel.activeInHierarchy;
				}
				return false;
			}
		}

		public bool IsMmoVisible => _visible();

		public Func<int, string>? BindingLabel { get; set; }

		public MmoSkillMenu(Assembly assembly, Assembly classAssembly, IClassStateProvider classes, IReadOnlyList<ActiveSkill> skills, ManualLogSource log, SkillTreeService tree, SkillLoadoutService loadout)
		{
			//IL_0173: Unknown result type (might be due to invalid IL or missing references)
			//IL_017d: Expected O, but got Unknown
			//IL_019b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a8: Expected O, but got Unknown
			//IL_01d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e2: Expected O, but got Unknown
			//IL_0249: Unknown result type (might be due to invalid IL or missing references)
			//IL_0256: Expected O, but got Unknown
			//IL_02b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c6: Expected O, but got Unknown
			//IL_0306: Unknown result type (might be due to invalid IL or missing references)
			//IL_0313: Expected O, but got Unknown
			_classes = classes;
			_skills = skills;
			_loadout = loadout;
			_log = log;
			_tree = tree;
			_hud = new MmoHudVisibility(assembly);
			Type type = assembly.GetType("EpicMMOSystem.MyUI", throwOnError: true);
			_rootField = RequireField(type, "UI", typeof(GameObject), BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
			_navigationField = RequireField(type, "navigationPanel", typeof(GameObject), BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
			_templateField = RequireField(type, "buttonFriendsList", typeof(Transform), BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
			MethodInfo method = RequireMethod(type, "IsPanelVisible", typeof(bool), BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
			_visible = (Func<bool>)Delegate.CreateDelegate(typeof(Func<bool>), method);
			MethodInfo methodInfo = RequireMethod(type, "InitNavigationPanel", typeof(void), BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
			List<MethodInfo> list = new List<MethodInfo>();
			string[] array = new string[7] { "Hide", "CloseAllUI", "ClickButtonLevelSystem", "ClickButtonFriendsList", "ClickButtonButtonGuilds", "ClickQuestPanel", "ClickProfessionsPanel" };
			foreach (string name in array)
			{
				list.Add(RequireMethod(type, name, typeof(void), BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic));
			}
			_harmony = new Harmony("com.harrison.valheim.epicskillsystem.mmo-menu");
			_current = this;
			try
			{
				_harmony.Patch((MethodBase)methodInfo, (HarmonyMethod)null, new HarmonyMethod(typeof(MmoSkillMenu), "AfterNavigationInit", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
				foreach (MethodInfo item in list)
				{
					_harmony.Patch((MethodBase)item, (HarmonyMethod)null, new HarmonyMethod(typeof(MmoSkillMenu), "AfterOtherMenu", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
				}
				Type type2 = classAssembly.GetType("HarrisonEpicClassSystem.Core.ClassEvents", throwOnError: true);
				MethodInfo methodInfo2 = type2.GetMethod("RaiseAwakeningCompleted", BindingFlags.Static | BindingFlags.NonPublic) ?? throw new MissingMethodException(type2.FullName, "RaiseAwakeningCompleted");
				_harmony.Patch((MethodBase)methodInfo2, (HarmonyMethod)null, new HarmonyMethod(typeof(MmoSkillMenu), "AfterAwakeningCompleted", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
				Type type3 = classAssembly.GetType("HarrisonEpicClassSystem.UI.ClassAltarUI", throwOnError: true);
				MethodInfo methodInfo3 = type3.GetMethod("Open", BindingFlags.Static | BindingFlags.Public, null, new Type[1] { typeof(Player) }, null) ?? throw new MissingMethodException(type3.FullName, "Open(Player)");
				_harmony.Patch((MethodBase)methodInfo3, (HarmonyMethod)null, new HarmonyMethod(typeof(MmoSkillMenu), "AfterAltarOpen", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
				MethodInfo methodInfo4 = type3.GetMethod("CloseImmediate", BindingFlags.Static | BindingFlags.NonPublic) ?? throw new MissingMethodException(type3.FullName, "CloseImmediate");
				_harmony.Patch((MethodBase)methodInfo4, (HarmonyMethod)null, new HarmonyMethod(typeof(MmoSkillMenu), "AfterAltarClose", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
				AttachSafely();
			}
			catch
			{
				Dispose();
				throw;
			}
		}

		private static FieldInfo RequireField(Type type, string name, Type expected, BindingFlags flags)
		{
			FieldInfo? obj = type.GetField(name, flags) ?? throw new MissingFieldException(type.FullName, name);
			if (obj.FieldType != expected)
			{
				throw new InvalidOperationException("Unsupported MMO field: " + name);
			}
			return obj;
		}

		private static MethodInfo RequireMethod(Type type, string name, Type expected, BindingFlags flags)
		{
			MethodInfo? obj = type.GetMethod(name, flags, null, Type.EmptyTypes, null) ?? throw new MissingMethodException(type.FullName, name);
			if (obj.ReturnType != expected)
			{
				throw new InvalidOperationException("Unsupported MMO method: " + name);
			}
			return obj;
		}

		private static void AfterNavigationInit()
		{
			_current?.AttachSafely();
			_current?._hud.SetHidden(_current.IsOpen || _current._classes.IsClassMenuOpen, _current._panel, refresh: true);
		}

		private static void AfterAltarOpen()
		{
			AfterAwakeningCompleted();
			_current?._hud.SetHidden(hidden: true, _current._panel, refresh: true);
		}

		private static void AfterAltarClose()
		{
			_current?._hud.SetHidden(_current.IsOpen, _current._panel);
		}

		private static void AfterAwakeningCompleted()
		{
			try
			{
				_current?.RebuildSkillTree();
			}
			catch (Exception arg)
			{
				MmoSkillMenu? current = _current;
				if (current != null)
				{
					current._log.LogError((object)$"Awakening skill UI refresh failed: {arg}");
				}
			}
		}

		public void RebuildSkillTree()
		{
			if (_treeView != null)
			{
				_treeView.RebuildSkillTree();
			}
			else
			{
				_tree.RefreshClassState();
			}
		}

		private static void AfterOtherMenu()
		{
			_current?.Close();
		}

		private void AttachSafely()
		{
			try
			{
				Attach();
			}
			catch (Exception arg)
			{
				RemoveObjects();
				_log.LogError((object)$"Could not attach Skills to MMO navigation: {arg}");
			}
		}

		private void Attach()
		{
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Expected O, but got Unknown
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Expected O, but got Unknown
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: Unknown result type (might be due to invalid IL or missing references)
			//IL_0185: Unknown result type (might be due to invalid IL or missing references)
			//IL_0194: Unknown result type (might be due to invalid IL or missing references)
			//IL_0210: Unknown result type (might be due to invalid IL or missing references)
			//IL_021a: Expected O, but got Unknown
			//IL_0238: Unknown result type (might be due to invalid IL or missing references)
			//IL_023d: Unknown result type (might be due to invalid IL or missing references)
			//IL_023e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0248: Unknown result type (might be due to invalid IL or missing references)
			//IL_0249: Unknown result type (might be due to invalid IL or missing references)
			//IL_0253: Unknown result type (might be due to invalid IL or missing references)
			//IL_0254: Unknown result type (might be due to invalid IL or missing references)
			//IL_0255: Unknown result type (might be due to invalid IL or missing references)
			//IL_025a: Unknown result type (might be due to invalid IL or missing references)
			//IL_025b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0262: Unknown result type (might be due to invalid IL or missing references)
			//IL_0269: Unknown result type (might be due to invalid IL or missing references)
			//IL_029d: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02de: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0300: Unknown result type (might be due to invalid IL or missing references)
			//IL_0301: Unknown result type (might be due to invalid IL or missing references)
			//IL_030b: Unknown result type (might be due to invalid IL or missing references)
			//IL_030c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0316: Unknown result type (might be due to invalid IL or missing references)
			//IL_0317: Unknown result type (might be due to invalid IL or missing references)
			//IL_031c: Unknown result type (might be due to invalid IL or missing references)
			//IL_031d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0324: Unknown result type (might be due to invalid IL or missing references)
			//IL_032b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0346: Unknown result type (might be due to invalid IL or missing references)
			//IL_0398: Unknown result type (might be due to invalid IL or missing references)
			//IL_039d: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_03bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_03cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_03db: Unknown result type (might be due to invalid IL or missing references)
			//IL_03dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e3: Unknown result type (might be due to invalid IL or missing references)
			object? value = _rootField.GetValue(null);
			GameObject val = (GameObject)((value is GameObject) ? value : null);
			object? value2 = _navigationField.GetValue(null);
			GameObject val2 = (GameObject)((value2 is GameObject) ? value2 : null);
			object? value3 = _templateField.GetValue(null);
			Transform val3 = (Transform)((value3 is Transform) ? value3 : null);
			if ((Object)(object)val == (Object)null || (Object)(object)val2 == (Object)null || (Object)(object)val3 == (Object)null || ((Object)(object)_button != (Object)null && (Object)(object)_button.transform.parent == (Object)(object)val3.parent))
			{
				return;
			}
			RemoveObjects();
			_button = Object.Instantiate<GameObject>(((Component)val3).gameObject, val3.parent, false);
			((Object)_button).name = "HESS_ButtonSkills";
			Button obj = _button.GetComponent<Button>() ?? throw new InvalidOperationException("MMO button template has no Button.");
			obj.onClick = new ButtonClickedEvent();
			((UnityEvent)obj.onClick).AddListener(new UnityAction(Toggle));
			Graphic targetGraphic = ((Selectable)obj).targetGraphic;
			Image val4 = (Image)(object)((targetGraphic is Image) ? targetGraphic : null);
			if (val4 != null)
			{
				val4.sprite = SkillVisualAssets.Menu;
				val4.type = (Type)0;
				val4.preserveAspect = true;
				((Graphic)val4).color = Color.white;
			}
			foreach (Transform item in _button.transform)
			{
				((Component)item).gameObject.SetActive(false);
			}
			CreateText(_button.transform, "Label", "Skills", new Vector2(0f, -28f), new Vector2(90f, 18f), 11);
			_button.SetActive(true);
			_button.transform.SetAsLastSibling();
			LayoutButton(val3.parent);
			Transform val5 = val.transform.Find("Canvas") ?? throw new InvalidOperationException("MMO Canvas is missing.");
			_panel = new GameObject("HESS_SkillMenu", new Type[2]
			{
				typeof(RectTransform),
				typeof(Image)
			});
			_panel.transform.SetParent(val5, false);
			RectTransform val6 = (RectTransform)_panel.transform;
			val6.anchorMin = Vector2.zero;
			val6.anchorMax = Vector2.one;
			Vector2 offsetMin = (val6.offsetMax = Vector2.zero);
			val6.offsetMin = offsetMin;
			((Transform)val6).localScale = Vector3.one;
			ApplyCompatibility();
			Image component = _panel.GetComponent<Image>();
			component.sprite = SkillVisualAssets.BlurredBackground;
			component.type = (Type)0;
			component.preserveAspect = false;
			((Graphic)component).color = Color.white;
			GameObject val7 = new GameObject("BackgroundDarken", new Type[3]
			{
				typeof(RectTransform),
				typeof(Image),
				typeof(CanvasGroup)
			});
			val7.transform.SetParent(_panel.transform, false);
			RectTransform val8 = (RectTransform)val7.transform;
			val8.anchorMin = Vector2.zero;
			val8.anchorMax = Vector2.one;
			offsetMin = (val8.offsetMax = Vector2.zero);
			val8.offsetMin = offsetMin;
			Image component2 = val7.GetComponent<Image>();
			((Graphic)component2).color = new Color(0f, 0f, 0f, 0.75f);
			((Graphic)component2).raycastTarget = false;
			CanvasGroup component3 = val7.GetComponent<CanvasGroup>();
			component3.alpha = 1f;
			component3.interactable = false;
			component3.blocksRaycasts = false;
			GameObject val9 = new GameObject("TreeVignette", new Type[2]
			{
				typeof(RectTransform),
				typeof(TreeVignetteGraphic)
			});
			val9.transform.SetParent(_panel.transform, false);
			RectTransform val10 = (RectTransform)val9.transform;
			val10.anchorMin = Vector2.zero;
			val10.anchorMax = Vector2.one;
			offsetMin = (val10.offsetMax = Vector2.zero);
			val10.offsetMin = offsetMin;
			((Graphic)val9.GetComponent<TreeVignetteGraphic>()).raycastTarget = false;
			Text componentInChildren = val.GetComponentInChildren<Text>(true);
			Font font = (((Object)(object)componentInChildren != (Object)null && (Object)(object)componentInChildren.font != (Object)null) ? componentInChildren.font : Resources.GetBuiltinResource<Font>("Arial.ttf"));
			_treeView = new SkillTreeView(_panel.transform, _tree, _skills, _loadout, font, (int slot) => BindingLabel?.Invoke(slot) ?? "", Close);
			_panel.SetActive(false);
			_log.LogInfo((object)"Skills button attached to WackyEpicMMOSystem navigation.");
		}

		private Text CreateText(Transform parent, string name, string value, Vector2 position, Vector2 size, int fontSize)
		{
			//IL_0021: 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_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject(name, new Type[2]
			{
				typeof(RectTransform),
				typeof(Text)
			});
			val.transform.SetParent(parent, false);
			RectTransform val2 = (RectTransform)val.transform;
			val2.sizeDelta = size;
			val2.anchoredPosition = position;
			Text component = val.GetComponent<Text>();
			object? value2 = _rootField.GetValue(null);
			GameObject val3 = (GameObject)((value2 is GameObject) ? value2 : null);
			Text val4 = (((Object)(object)val3 != (Object)null) ? val3.GetComponentInChildren<Text>(true) : null);
			component.font = (((Object)(object)val4 != (Object)null && (Object)(object)val4.font != (Object)null) ? val4.font : Resources.GetBuiltinResource<Font>("Arial.ttf"));
			component.text = value;
			component.fontSize = fontSize;
			((Graphic)component).color = new Color(0.95f, 0.82f, 0.57f);
			component.alignment = (TextAnchor)4;
			((Graphic)component).raycastTarget = false;
			component.supportRichText = false;
			return component;
		}

		private void LayoutButton(Transform parent)
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Expected O, but got Unknown
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Expected O, but got Unknown
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			//IL_0139: Unknown result type (might be due to invalid IL or missing references)
			//IL_0151: Unknown result type (might be due to invalid IL or missing references)
			//IL_0156: Unknown result type (might be due to invalid IL or missing references)
			//IL_0162: Unknown result type (might be due to invalid IL or missing references)
			//IL_016e: Unknown result type (might be due to invalid IL or missing references)
			//IL_017a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0196: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0124: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)((Component)parent).GetComponent<LayoutGroup>() != (Object)null)
			{
				LayoutRebuilder.MarkLayoutForRebuild((RectTransform)parent);
				return;
			}
			List<RectTransform> list = new List<RectTransform>();
			foreach (Transform item in parent)
			{
				Transform val = item;
				if (((Component)val).gameObject.activeSelf && (Object)(object)((Component)val).GetComponent<Button>() != (Object)null)
				{
					RectTransform val2 = (RectTransform)(object)((val is RectTransform) ? val : null);
					if (val2 != null)
					{
						list.Add(val2);
					}
				}
			}
			if (list.Count < 2)
			{
				return;
			}
			RectTransform val3 = (RectTransform)(object)((parent is RectTransform) ? parent : null);
			if (val3 == null)
			{
				return;
			}
			Rect rect = val3.rect;
			float num = ((Rect)(ref rect)).width;
			if (num <= 0f)
			{
				rect = ((RectTransform)_button.transform).rect;
				num = ((Rect)(ref rect)).width * (float)list.Count + (float)(16 * (list.Count - 1));
			}
			float num2 = num / (float)list.Count;
			for (int i = 0; i < list.Count; i++)
			{
				RectTransform val4 = list[i];
				if ((Object)(object)((Component)val4).gameObject != (Object)(object)_button)
				{
					_moved.Add((val4, val4.anchoredPosition));
				}
				rect = val3.rect;
				float num3 = ((Rect)(ref rect)).xMin + num2 * ((float)i + 0.5f);
				rect = val3.rect;
				float num4 = ((Rect)(ref rect)).xMin + num * Mathf.Lerp(val4.anchorMin.x, val4.anchorMax.x, val4.pivot.x);
				val4.anchoredPosition = new Vector2(num3 - num4, val4.anchoredPosition.y);
			}
		}

		private void Toggle()
		{
			if ((Object)(object)_panel == (Object)null || (Object)(object)Player.m_localPlayer == (Object)null || _classes.IsClassMenuOpen)
			{
				return;
			}
			_panel.SetActive(!_panel.activeSelf);
			ApplyCompatibility();
			_hud.SetHidden(IsOpen || _classes.IsClassMenuOpen, _panel);
			if (!_panel.activeSelf)
			{
				return;
			}
			string[] array = new string[2] { "levelSystemPanel", "friendsListPanel" };
			foreach (string name in array)
			{
				object? obj = _rootField.DeclaringType.GetField(name, BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic)?.GetValue(null);
				GameObject val = (GameObject)((obj is GameObject) ? obj : null);
				if (val != null)
				{
					val.SetActive(false);
				}
			}
			_panel.transform.SetAsLastSibling();
			RebuildSkillTree();
			Refresh();
		}

		public void Tick()
		{
			_hud.SetHidden(IsOpen || _classes.IsClassMenuOpen, _panel);
			if (!((Object)(object)_panel == (Object)null))
			{
				Player localPlayer = Player.m_localPlayer;
				if (!IsMmoVisible || (Object)(object)localPlayer == (Object)null || ((Character)localPlayer).IsDead() || ((Character)localPlayer).IsTeleporting() || _classes.IsClassMenuOpen)
				{
					Close();
				}
				else if (IsOpen && Time.realtimeSinceStartupAsDouble >= _nextRefresh)
				{
					_nextRefresh = Time.realtimeSinceStartupAsDouble + 0.5;
					Refresh();
				}
			}
		}

		private void ApplyCompatibility()
		{
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Expected O, but got Unknown
			if (!((Object)(object)_panel == (Object)null))
			{
				BetterUiCompatibility.ApplyCanvas(_panel, interactive: true);
				BetterUiCompatibility.FitToScreen((RectTransform)_panel.transform);
			}
		}

		private void Refresh()
		{
			ApplyCompatibility();
			_treeView?.Tick();
		}

		private void Close()
		{
			ApplyCompatibility();
			if ((Object)(object)_panel != (Object)null)
			{
				_panel.SetActive(false);
			}
			_hud.SetHidden(_classes.IsClassMenuOpen, _panel);
		}

		private void RemoveObjects()
		{
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			foreach (var item in _moved)
			{
				if ((Object)(object)item.Rect != (Object)null)
				{
					item.Rect.anchoredPosition = item.Position;
				}
			}
			_moved.Clear();
			if ((Object)(object)_button != (Object)null)
			{
				Object.Destroy((Object)(object)_button);
			}
			if ((Object)(object)_panel != (Object)null)
			{
				Object.Destroy((Object)(object)_panel);
			}
			_button = (_panel = null);
			_treeView = null;
		}

		public void Dispose()
		{
			if (_current == this)
			{
				_current = null;
			}
			_harmony.UnpatchSelf();
			_hud.Dispose();
			RemoveObjects();
		}
	}
	public sealed class SkillBezierLineGraphic : MaskableGraphic
	{
		public readonly struct Curve
		{
			public readonly Vector2 Start;

			public readonly Vector2 FirstControl;

			public readonly Vector2 SecondControl;

			public readonly Vector2 End;

			public Curve(Vector2 start, Vector2 firstControl, Vector2 secondControl, Vector2 end)
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_0008: Unknown result type (might be due to invalid IL or missing references)
				//IL_0009: Unknown result type (might be due to invalid IL or missing references)
				//IL_000f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0010: Unknown result type (might be due to invalid IL or missing references)
				//IL_0016: Unknown result type (might be due to invalid IL or missing references)
				//IL_0018: Unknown result type (might be due to invalid IL or missing references)
				Start = start;
				FirstControl = firstControl;
				SecondControl = secondControl;
				End = end;
			}
		}

		public Curve[]? Route;

		public Vector2 StartPoint;

		public Vector2 ControlPoint1;

		public Vector2 ControlPoint2;

		public Vector2 EndPoint;

		public float Width = 2f;

		public float Glow;

		private const int Segments = 24;

		public void SetState(Color stateColor, float width, float glow)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			if (!(((Graphic)this).color == stateColor) || Width != width || Glow != glow)
			{
				((Graphic)this).color = stateColor;
				Width = width;
				Glow = glow;
				((Graphic)this).SetVerticesDirty();
			}
		}

		protected override void OnPopulateMesh(VertexHelper mesh)
		{
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			mesh.Clear();
			if (Glow > 0.001f)
			{
				Color color = ((Graphic)this).color;
				color.a *= 0.16f * Glow;
				AddStrip(mesh, Width + 7f * Glow, color);
			}
			AddStrip(mesh, Width, ((Graphic)this).color);
		}

		private void AddStrip(VertexHelper mesh, float width, Color stripColor)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: 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_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_0136: Unknown result type (might be due to invalid IL or missing references)
			//IL_0138: Unknown result type (might be due to invalid IL or missing references)
			int currentVertCount = mesh.currentVertCount;
			Vector2 val = Point(0f);
			Curve[]? route = Route;
			int num = 24 * ((route == null) ? 1 : route.Length);
			Vector2 val5 = default(Vector2);
			for (int i = 0; i <= num; i++)
			{
				float t = (float)i / (float)num;
				Vector2 val2 = ((i == 0) ? val : Point(t));
				Vector2 val3 = ((i == num) ? val2 : Point((float)(i + 1) / (float)num));
				Vector2 val4 = ((i == 0) ? (val3 - val2) : ((i == num) ? (val2 - val) : (val3 - val)));
				if (((Vector2)(ref val4)).sqrMagnitude < 0.0001f)
				{
					val4 = Vector2.right;
				}
				((Vector2)(ref val4)).Normalize();
				((Vector2)(ref val5))..ctor(0f - val4.y, val4.x);
				val5 *= width * 0.5f;
				mesh.AddVert(Vector2.op_Implicit(val2 + val5), Color32.op_Implicit(stripColor), Vector4.op_Implicit(Vector2.zero));
				mesh.AddVert(Vector2.op_Implicit(val2 - val5), Color32.op_Implicit(stripColor), Vector4.op_Implicit(Vector2.zero));
				if (i > 0)
				{
					int num2 = currentVertCount + i * 2;
					mesh.AddTriangle(num2 - 2, num2, num2 - 1);
					mesh.AddTriangle(num2, num2 + 1, num2 - 1);
				}
				val = val2;
			}
		}

		private Vector2 Point(float t)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			Vector2 val = StartPoint;
			Vector2 val2 = ControlPoint1;
			Vector2 val3 = ControlPoint2;
			Vector2 val4 = EndPoint;
			if (Route != null && Route.Length != 0)
			{
				float num = t * (float)Route.Length;
				int num2 = Mathf.Min(Route.Length - 1, Mathf.FloorToInt(num));
				t = num - (float)num2;
				Curve curve = Route[num2];
				val = curve.Start;
				val2 = curve.FirstControl;
				val3 = curve.SecondControl;
				val4 = curve.End;
			}
			float num3 = 1f - t;
			return num3 * num3 * num3 * val + 3f * num3 * num3 * t * val2 + 3f * num3 * t * t * val3 + t * t * t * val4;
		}
	}
	internal sealed class SkillEffectsCompendium : IDisposable
	{
		private const string Topic = "Harrison Skill Effects";

		private static SkillEffectsCompendium? _current;

		private readonly Harmony _harmony;

		private readonly SkillTreeService _tree;

		private readonly IReadOnlyList<ActiveSkill> _skills;

		private readonly Func<int, string> _binding;

		private readonly Func<int, ActiveSkill?> _resolve;

		public SkillEffectsCompendium(SkillTreeService tree, IReadOnlyList<ActiveSkill> skills, Func<int, string> binding, Func<int, ActiveSkill?> resolve)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Expected O, but got Unknown
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Expected O, but got Unknown
			_tree = tree;
			_skills = skills;
			_binding = binding;
			_resolve = resolve;
			_harmony = new Harmony("com.harrison.valheim.epicskillsystem.compendium");
			_current = this;
			try
			{
				_harmony.Patch((MethodBase)AccessTools.Method(typeof(Player), "GetKnownTexts", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(typeof(SkillEffectsCompendium), "AddEntry", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
			}
			catch
			{
				Dispose();
				throw;
			}
		}

		private static void AddEntry(Player __instance, ref List<KeyValuePair<string, string>> __result)
		{
			if (_current != null && !((Object)(object)__instance != (Object)(object)Player.m_localPlayer))
			{
				_current._tree.Tick();
				__result = __result.Where<KeyValuePair<string, string>>((KeyValuePair<string, string> p) => p.Key != "Harrison Skill Effects").ToList();
				__result.Add(new KeyValuePair<string, string>("Harrison Skill Effects", _current.BuildText()));
			}
		}

		private string BuildText()
		{
			if (!_tree.Ready)
			{
				return "Select a class at the Harrison Class Altar.\n" + _tree.Status;
			}
			TreeBonuses bonuses = _tree.Bonuses;
			StringBuilder text = new StringBuilder();
			text.AppendLine($"Class: {_tree.Data.Class}\nAwakening: {_tree.CurrentTier}\nMMO level: {_tree.Level}\nAvailable points: {_tree.Model.Available(_tree.Data)}\n");
			text.AppendLine("SKILL TREE BONUSES");
			Flat("Maximum health", bonuses.Health);
			Flat("Maximum stamina", bonuses.Stamina);
			Flat("Maximum eitr", bonuses.Eitr);
			Flat("Armor", bonuses.Armor);
			Flat("Carry weight", bonuses.Carry);
			Percent("Physical class-path damage", bonuses.PhysicalDamage);
			Percent("Thorns damage reflection", bonuses.Thorns);
			Percent("Block stamina cost reduction", bonuses.BlockCostReduction);
			Percent("Class-appropriate attack damage", bonuses.Damage);
			Percent("Elemental/blood magic damage", bonuses.MagicDamage);
			Percent("Movement speed", bonuses.MoveSpeed);
			Percent("Gathering skill experience", bonuses.LifeExperience);
			Percent("Woodcutting/mining damage", bonuses.GatheringDamage);
			Percent("Wood yield", bonuses.WoodYield);
			Percent("Ore yield", bonuses.OreYield);
			Percent("Harvest yield", bonuses.HarvestYield);
			Percent("Health regeneration", bonuses.HealthRegen);
			Percent("Stamina regeneration", bonuses.StaminaRegen);
			Percent("Eitr regeneration", bonuses.EitrRegen);
			Percent("Attack stamina cost", bonuses.AttackCostReduction, reduction: true);
			Percent("Eitr cost", bonuses.EitrCostReduction, reduction: true);
			Percent("Running stamina drain", bonuses.RunCostReduction, reduction: true);
			Percent("Fall damage", bonuses.FallReduction, reduction: true);
			text.AppendLine("\nLEARNED ACTIVE SKILLS");
			bool flag = false;
			for (int i = 1; i <= 5; i++)
			{
				ActiveSkill activeSkill = _resolve(i);
				if (activeSkill != null && _tree.IsSkillUnlocked(activeSkill))
				{
					flag = true;
					string text2 = ((activeSkill is BaseClassSkill || BerserkerSkillRules.IsFirstAwakeAttack(activeSkill.Id) || GladiatorSkillRules.IsFirstAwakeAttack(activeSkill.Id) || ProtectorSkillRules.IsFirstAwakeAttack(activeSkill.Id) || ElementalistSkillRules.IsFirstAwakeAttack(activeSkill.Id) || WarlockSkillRules.IsFirstAwakeAttack(activeSkill.Id) || SorcererSkillRules.IsFirstAwakeAttack(activeSkill.Id) || RangerSkillRules.IsFirstAwakeAttack(activeSkill.Id) || BeastmasterSkillRules.IsFirstAwakeAttack(activeSkill.Id) || MarksmanSkillRules.IsFirstAwakeAttack(activeSkill.Id) || AssassinSkillRules.IsFirstAwakeAttack(activeSkill.Id) || DuelistSkillRules.IsFirstAwakeAttack(activeSkill.Id) || TricksterSkillRules.IsFirstAwakeAttack(activeSkill.Id) || TemplarSkillRules.IsFirstAwakeAttack(activeSkill.Id) || InquisitorSkillRules.IsFirstAwakeAttack(activeSkill.Id) || ClericKnightSkillRules.IsFirstAwakeAttack(activeSkill.Id) || SecondWarriorSkillRules.IsSecondAttack(activeSkill.Id) || SecondMageSkillRules.IsSecondAttack(activeSkill.Id) || SecondHunterSkillRules.IsSecondAttack(activeSkill.Id) || SecondRogueSkillRules.IsSecondAttack(activeSkill.Id) || SecondPaladinSkillRules.IsSecondAttack(activeSkill.Id) || MythicWarriorSkillRules.IsUltimate(activeSkill.Id) || MythicMageSkillRules.IsUltimate(activeSkill.Id) || MythicHunterSkillRules.IsUltimate(activeSkill.Id) || MythicRogueSkillRules.IsUltimate(activeSkill.Id) || MythicPaladinSkillRules.IsUltimate(activeSkill.Id)) ? activeSkill.DisplayName : activeSkill.Id);
					text.AppendLine($"\nSkill {i}: {text2} [{activeSkill.Tier}]\nHotkey: {_binding(i)}\n{activeSkill.Description}");
					text.AppendLine($"Stamina: {activeSkill.StaminaCost.Value * (activeSkill.StaminaCostScale?.Invoke() ?? 1f):0.##} | Eitr: {activeSkill.EitrCost.Value * (activeSkill.EitrCostScale?.Invoke() ?? 1f):0.##}");
					text.AppendLine(string.Format("Cooldown: {0:0.##} seconds\nEnabled: {1}", activeSkill.Cooldown.Value, activeSkill.Enabled.Value ? "Yes" : "No"));
				}
			}
			if (!flag)
			{
				text.AppendLine("No active skills learned yet.");
			}
			text.AppendLine("\nValues reflect current tree investments and configuration when the Compendium is opened. Temporary cast buffs are described under each learned skill.");
			return text.ToString();
			void Flat(string name, float value)
			{
				text.AppendLine($"{name}: +{value:0.##}");
			}
			void Percent(string name, float value, bool reduction = false)
			{
				text.AppendLine(string.Format("{0}: {1}{2:0.##}%", name, reduction ? "-" : "+", value * 100f));
			}
		}

		public void Dispose()
		{
			if (_current == this)
			{
				_current = null;
			}
			_harmony.UnpatchSelf();
		}
	}
	internal sealed class SkillHud : IDisposable
	{
		private readonly SkillTreeService _tree;

		private readonly Func<int, string> _binding;

		private readonly Func<int, ActiveSkill?> _resolve;

		private readonly Func<bool> _hidden;

		private readonly ConfigEntry<bool> _enabled;

		private readonly ConfigEntry<float> _x;

		private readonly ConfigEntry<float> _y;

		private readonly ConfigEntry<float> _scale;

		private GameObject? _root;

		private readonly Image[] _icons = (Image[])(object)new Image[5];

		private readonly Image[] _frames = (Image[])(object)new Image[5];

		private readonly Image[] _covers = (Image[])(object)new Image[5];

		private readonly Text[] _keys = (Text[])(object)new Text[5];

		private readonly Text[] _timers = (Text[])(object)new Text[5];

		private readonly Text[] _names = (Text[])(object)new Text[5];

		private readonly Text[] _tiers = (Text[])(object)new Text[5];

		private readonly ActiveSkill?[] _assigned = new ActiveSkill[5];

		private Sprite? _white;

		private double _nextUpdate;

		public SkillHud(ConfigFile config, SkillTreeService tree, Func<int, string> binding, Func<int, ActiveSkill?> resolve, Func<bool> hidden)
		{
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Expected O, but got Unknown
			_tree = tree;
			_binding = binding;
			_resolve = resolve;
			_hidden = hidden;
			_enabled = config.Bind<bool>("Skill HUD", "Enabled", true, "Show four standard slots plus the quest-unlocked Mythic slot, bindings and cooldowns.");
			_x = config.Bind<float>("Skill HUD", "OffsetX", 0f, "Horizontal offset from bottom centre, in canvas units.");
			_y = config.Bind<float>("Skill HUD", "OffsetY", 110f, "Vertical offset from bottom centre, in canvas units.");
			_scale = config.Bind<float>("Skill HUD", "Scale", 1f, new ConfigDescription("HUD scale.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.5f, 2f), Array.Empty<object>()));
		}

		private static Image Box(Transform parent, string name, Vector2 position, Vector2 size)
		{
			//IL_0021: 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_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject(name, new Type[2]
			{
				typeof(RectTransform),
				typeof(Image)
			});
			val.transform.SetParent(parent, false);
			RectTransform val2 = (RectTransform)val.transform;
			val2.anchoredPosition = position;
			val2.sizeDelta = size;
			Image component = val.GetComponent<Image>();
			((Graphic)component).raycastTarget = false;
			return component;
		}

		private static Text Label(Transform parent, Font font, Vector2 position, Vector2 size, int fontSize)
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Expected O, but got Unknown
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("Label", new Type[2]
			{
				typeof(RectTransform),
				typeof(Text)
			});
			val.transform.SetParent(parent, false);
			RectTransform val2 = (RectTransform)val.transform;
			val2.anchoredPosition = position;
			val2.sizeDelta = size;
			Text component = val.GetComponent<Text>();
			component.font = font;
			component.fontSize = fontSize;
			component.alignment = (TextAnchor)4;
			((Graphic)component).color = new Color(1f, 0.89f, 0.6f);
			((Graphic)component).raycastTarget = false;
			component.supportRichText = false;
			Outline obj = val.AddComponent<Outline>();
			((Shadow)obj).effectColor = Color.black;
			((Shadow)obj).effectDistance = new Vector2(1f, -1f);
			return component;
		}

		private void Build()
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Expected O, but got Unknown
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Expected O, but got Unknown
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_012f: Unknown result type (might be due to invalid IL or missing references)
			//IL_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0162: Unknown result type (might be due to invalid IL or missing references)
			//IL_0171: Unknown result type (might be due to invalid IL or missing references)
			//IL_0195: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0208: Unknown result type (might be due to invalid IL or missing references)
			//IL_0227: Unknown result type (might be due to invalid IL or missing references)
			//IL_0236: Unknown result type (might be due to invalid IL or missing references)
			//IL_0262: Unknown result type (might be due to invalid IL or missing references)
			//IL_0271: Unknown result type (might be due to invalid IL or missing references)
			//IL_029d: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e7: Unknown result type (might be due to invalid IL or missing references)
			_root = new GameObject("HESS_SkillHUD", new Type[1] { typeof(RectTransform) });
			_root.transform.SetParent(GUIManager.CustomGUIFront.transform, false);
			BetterUiCompatibility.ApplyCanvas(_root, interactive: false);
			RectTransform val = (RectTransform)_root.transform;
			Vector2 val2 = default(Vector2);
			((Vector2)(ref val2))..ctor(0.5f, 0f);
			val.anchorMax = val2;
			val.anchorMin = val2;
			val.sizeDelta = new Vector2(430f, 100f);
			Font builtinResource = Resources.GetBuiltinResource<Font>("Arial.ttf");
			if ((Object)(object)_white != (Object)null)
			{
				Object.Destroy((Object)(object)_white);
			}
			_white = Sprite.Create(Texture2D.whiteTexture, new Rect(0f, 0f, (float)((Texture)Texture2D.whiteTexture).width, (float)((Texture)Texture2D.whiteTexture).height), Vector2.one * 0.5f);
			for (int i = 0; i < 5; i++)
			{
				_frames[i] = Box((Transform)(object)val, "Slot" + (i + 1), new Vector2(((float)i - 2f) * 84f, 0f), new Vector2(66f, 66f));
				_icons[i] = Box(((Component)_frames[i]).transform, "Icon", Vector2.zero, new Vector2(60f, 60f));
				_covers[i] = Box(((Component)_frames[i]).transform, "Cooldown", Vector2.zero, new Vector2(60f, 60f));
				_covers[i].sprite = _white;
				_covers[i].type = (Type)3;
				_covers[i].fillMethod = (FillMethod)4;
				_covers[i].fillOrigin = 2;
				((Graphic)_covers[i]).color = new Color(0f, 0f, 0f, 0.75f);
				_timers[i] = Label(((Component)_frames[i]).transform, builtinResource, Vector2.zero, new Vector2(64f, 30f), 20);
				_keys[i] = Label(((Component)_frames[i]).transform, builtinResource, new Vector2(0f, -44f), new Vector2(82f, 25f), 13);
				_names[i] = Label(((Component)_frames[i]).transform, builtinResource, new Vector2(0f, 49f), new Vector2(82f, 34f), 10);
				_tiers[i] = Label(((Component)_frames[i]).transform, builtinResource, new Vector2(22f, 22f), new Vector2(20f, 18f), 12);
				_assigned[i] = null;
				_icons[i].sprite = SkillVisualAssets.Menu;
				_names[i].text = "Unassigned";
			}
		}

		public void Tick()
		{
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Expected O, but got Unknown
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_0120: Unknown result type (might be due to invalid IL or missing references)
			//IL_038c: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0425: Unknown result type (might be due to invalid IL or missing references)
			//IL_040f: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e3: Unknown result type (might be due to invalid IL or missing references)
			Player localPlayer = Player.m_localPlayer;
			bool flag = _enabled.Value && (Object)(object)localPlayer != (Object)null && !((Character)localPlayer).IsDead() && !((Character)localPlayer).InCutscene() && !((Character)localPlayer).IsTeleporting() && _tree.Ready && !_hidden();
			if ((Object)(object)_root == (Object)null)
			{
				if (!flag || (Object)(object)GUIManager.CustomGUIFront == (Object)null)
				{
					return;
				}
				Build();
			}
			_root.SetActive(flag);
			if (!flag || Time.realtimeSinceStartupAsDouble < _nextUpdate)
			{
				return;
			}
			_nextUpdate = Time.realtimeSinceStartupAsDouble + 0.05;
			RectTransform val = (RectTransform)_root.transform;
			val.anchoredPosition = new Vector2(_x.Value, _y.Value);
			((Transform)val).localScale = ((BetterUiCompatibility.IsLoaded && (Object)(object)((Transform)val).parent != (Object)null) ? BetterUiCompatibility.ScaleInParent(((Transform)val).parent, _scale.Value * BetterUiCompatibility.ScreenScale) : (Vector3.one * _scale.Value));
			for (int i = 0; i < 5; i++)
			{
				bool flag2 = i < 4 || (_tree.Data != null && _tree.Model.Rank(_tree.Data, "attack.ultimate") > 0);
				((Component)_frames[i]).gameObject.SetActive(flag2);
				if (flag2)
				{
					ActiveSkill activeSkill = _resolve(i + 1);
					if (_assigned[i] != activeSkill)
					{
						_assigned[i] = activeSkill;
						_icons[i].sprite = ((activeSkill == null) ? SkillVisualAssets.Menu : SkillVisualAssets.Icon(activeSkill));
						_names[i].text = activeSkill?.DisplayName ?? ((i == 4) ? "Mythic" : "Unassigned");
						Text val2 = _tiers[i];
						string text = ((activeSkill != null) ? (activeSkill.Tier switch
						{
							AwakeningTier.FirstAwake => "I", 
							AwakeningTier.SecondAwake => "II", 
							AwakeningTier.MythicAwake => "M", 
							_ => "", 
						}) : "");
						val2.text = text;
					}
					_keys[i].text = _binding(i + 1).Replace("Blocking + ", "Block+").Replace("Mouse 5", "M5").Replace("Mouse 4", "M4");
					bool flag3 = activeSkill != null && activeSkill.Enabled.Value && _tree.IsSkillUnlocked(activeSkill);
					double num = activeSkill?.RemainingCooldown(localPlayer.GetPlayerID()) ?? 0.0;
					float num2 = ((activeSkill == null) ? 0f : (activeSkill.StaminaCost.Value * (activeSkill.StaminaCostScale?.Invoke() ?? 1f)));
					float num3 = ((activeSkill == null) ? 0f : (activeSkill.EitrCost.Value * (activeSkill.EitrCostScale?.Invoke() ?? 1f)));
					bool flag4 = activeSkill != null && localPlayer.GetStamina() >= num2 && localPlayer.GetEitr() >= num3;
					((Graphic)_icons[i]).color = (Color)((!flag3) ? new Color(0.32f, 0.32f, 0.32f) : (flag4 ? Color.white : new Color(1f, 0.45f, 0.4f)));
					((Graphic)_frames[i]).color = ((!flag3) ? new Color(0.25f, 0.25f, 0.25f) : ((num > 0.0) ? new Color(0.45f, 0.36f, 0.22f) : (flag4 ? new Color(0.95f, 0.72f, 0.22f) : new Color(0.7f, 0.2f, 0.15f))));
					_covers[i].fillAmount = ((flag3 && activeSkill != null && activeSkill.Cooldown.Value > 0f) ? Mathf.Clamp01((float)num / activeSkill.Cooldown.Value) : 0f);
					_timers[i].text = ((!flag3) ? "LOCK" : ((num > 0.0) ? Math.Ceiling(num).ToString("0") : ""));
				}
			}
		}

		public void Dispose()
		{
			if ((Object)(object)_root != (Object)null)
			{
				Object.Destroy((Object)(object)_root);
			}
			if ((Object)(object)_white != (Object)null)
			{
				Object.Destroy((Object)(object)_white);
			}
			_root = null;
		}
	}
	public sealed class SkillNodeFrameGraphic : MaskableGraphic
	{
		public TreeNodeKind Kind;

		public bool Selected;

		public bool Hovered;

		public bool Learned;

		public void SetState(Color stateColor, bool learned, bool selected)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			((Graphic)this).color = stateColor;
			Learned = learned;
			Selected = selected;
			((Graphic)this).SetVerticesDirty();
		}

		public void SetHovered(bool hovered)
		{
			Hovered = hovered;
			((Graphic)this).SetVerticesDirty();
		}

		protected override void OnPopulateMesh(VertexHelper mesh)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_0139: Unknown result type (might be due to invalid IL or missing references)
			//IL_016f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0190: Unknown result type (might be due to invalid IL or missing references)
			//IL_019d: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_01df: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0200: Unknown result type (might be due to invalid IL or missing references)
			//IL_0205: Unknown result type (might be due to invalid IL or missing references)
			//IL_0251: Unknown result type (might be due to invalid IL or missing references)
			//IL_024e: Unknown result type (might be due to invalid IL or missing references)
			//IL_025c: Unknown result type (might be due to invalid IL or missing references)
			mesh.Clear();
			Rect rect = ((Graphic)this).rectTransform.rect;
			float width = ((Rect)(ref rect)).width;
			rect = ((Graphic)this).rectTransform.rect;
			float num = Mathf.Min(width, ((Rect)(ref rect)).height) * 0.5f;
			Color val = default(Color);
			((Color)(ref val))..ctor(0.1f, 0.11f, 0.12f, 0.98f);
			Color val2 = default(Color);
			((Color)(ref val2))..ctor(0.2f, 0.2f, 0.19f, 0.98f);
			Color val3 = ((Graphic)this).color;
			if (Selected || Hovered)
			{
				val3 = Color.Lerp(val3, new Color(1f, 0.78f, 0.3f, 1f), 0.7f);
			}
			if (Hovered)
			{
				Color fill = val3;
				fill.a = 0.18f;
				AddPolygon(mesh, Polygon(Kind, num * 0.99f), fill);
			}
			if (Kind == TreeNodeKind.Active)
			{
				AddQuad(mesh, new Vector2((0f - num) * 0.88f, (0f - num) * 0.88f), new Vector2(num * 0.88f, num * 0.88f), val);
				AddRectRing(mesh, num * 0.88f, 5f, new Color(0.24f, 0.21f, 0.16f, 1f));
				AddRectRing(mesh, num * 0.73f, (Learned || Selected || Hovered) ? 3.2f : 2.2f, val3);
				float num2 = num * 0.16f;
				float num3 = num * 0.94f;
				AddQuad(mesh, new Vector2(0f - num3, num3 - num2), new Vector2(0f - num3 + num2, num3), val3);
				AddQuad(mesh, new Vector2(num3 - num2, num3 - num2), new Vector2(num3, num3), val3);
				AddQuad(mesh, new Vector2(0f - num3, 0f - num3), new Vector2(0f - num3 + num2, 0f - num3 + num2), val3);
				AddQuad(mesh, new Vector2(num3 - num2, 0f - num3), new Vector2(num3, 0f - num3 + num2), val3);
			}
			else
			{
				Vector2[] array = Polygon(Kind, num * 0.88f);
				Vector2[] inner = Polygon(Kind, num * ((Kind == TreeNodeKind.Star) ? 0.6f : 0.65f));
				AddPolygon(mesh, array, (Kind == TreeNodeKind.Star) ? val2 : val);
				AddPolygonRing(mesh, array, inner, val3);
			}
		}

		private static Vector2[] Polygon(TreeNodeKind kind, float radius)
		{
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_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)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			if (kind != TreeNodeKind.Star)
			{
				return (Vector2[])(object)new Vector2[7]
				{
					new Vector2((0f - radius) * 0.58f, radius),
					new Vector2(radius * 0.58f, radius),
					new Vector2(radius, radius * 0.48f),
					new Vector2(radius * 0.83f, (0f - radius) * 0.45f),
					new Vector2(0f, 0f - radius),
					new Vector2((0f - radius) * 0.83f, (0f - radius) * 0.45f),
					new Vector2(0f - radius, radius * 0.48f)
				};
			}
			return (Vector2[])(object)new Vector2[4]
			{
				new Vector2(0f, radius),
				new Vector2(radius, 0f),
				new Vector2(0f, 0f - radius),
				new Vector2(0f - radius, 0f)
			};
		}

		private static void AddPolygon(VertexHelper mesh, Vector2[] points, Color fill)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			int currentVertCount = mesh.currentVertCount;
			mesh.AddVert(Vector3.zero, Color32.op_Implicit(fill), Vector4.op_Implicit(Vector2.zero));
			foreach (Vector2 val in points)
			{
				mesh.AddVert(Vector2.op_Implicit(val), Color32.op_Implicit(fill), Vector4.op_Implicit(Vector2.zero));
			}
			for (int j = 0; j < points.Length; j++)
			{
				mesh.AddTriangle(currentVertCount, currentVertCount + j + 1, currentVertCount + (j + 1) % points.Length + 1);
			}
		}

		private static void AddPolygonRing(VertexHelper mesh, Vector2[] outer, Vector2[] inner, Color border)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			int currentVertCount = mesh.currentVertCount;
			for (int i = 0; i < outer.Length; i++)
			{
				mesh.AddVert(Vector2.op_Implicit(outer[i]), Color32.op_Implicit(border), Vector4.op_Implicit(Vector2.zero));
				mesh.AddVert(Vector2.op_Implicit(inner[i]), Color32.op_Implicit(border), Vector4.op_Implicit(Vector2.zero));
			}
			for (int j = 0; j < outer.Length; j++)
			{
				int num = (j + 1) % outer.Length;
				mesh.AddTriangle(currentVertCount + j * 2, currentVertCount + num * 2, currentVertCount + j * 2 + 1);
				mesh.AddTriangle(currentVertCount + num * 2, currentVertCount + num * 2 + 1, currentVertCount + j * 2 + 1);
			}
		}

		private static void AddRectRing(VertexHelper mesh, float half, float thickness, Color border)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			AddQuad(mesh, new Vector2(0f - half, half - thickness), new Vector2(half, half), border);
			AddQuad(mesh, new Vector2(0f - half, 0f - half), new Vector2(half, 0f - half + thickness), border);
			AddQuad(mesh, new Vector2(0f - half, 0f - half), new Vector2(0f - half + thickness, half), border);
			AddQuad(mesh, new Vector2(half - thickness, 0f - half), new Vector2(half, half), border);
		}

		private static void AddQuad(VertexHelper mesh, Vector2 min, Vector2 max, Color fill)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			int currentVertCount = mesh.currentVertCount;
			mesh.AddVert(new Vector3(min.x, min.y), Color32.op_Implicit(fill), Vector4.op_Implicit(Vector2.zero));
			mesh.AddVert(new Vector3(min.x, max.y), Color32.op_Implicit(fill), Vector4.op_Implicit(Vector2.zero));
			mesh.AddVert(new Vector3(max.x, max.y), Color32.op_Implicit(fill), Vector4.op_Implicit(Vector2.zero));
			mesh.AddVert(new Vector3(max.x, min.y), Color32.op_Implicit(fill), Vector4.op_Implicit(Vector2.zero));
			mesh.AddTriangle(currentVertCount, currentVertCount + 1, currentVertCount + 2);
			mesh.AddTriangle(currentVertCount, currentVertCount + 2, currentVertCount + 3);
		}
	}
	public sealed class SkillNodeHover : MonoBehaviour, IPointerEnterHandler, IEventSystemHandler, IPointerExitHandler
	{
		public SkillNodeFrameGraphic Frame;

		public bool Learnable;

		private bool _hovered;

		public void OnPointerEnter(PointerEventData eventData)
		{
			_hovered = true;
			Frame?.SetHovered(Learnable);
		}

		public void OnPointerExit(PointerEventData eventData)
		{
			_hovered = false;
			Frame?.SetHovered(hovered: false);
		}

		public void SetLearnable(bool value)
		{
			Learnable = value;
			if (!value)
			{
				Frame?.SetHovered(hovered: false);
			}
		}

		private void Update()
		{
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			float num = ((_hovered && Learnable) ? (1.07f + Mathf.Sin(Time.unscaledTime * 5.5f) * 0.03f) : 1f);
			((Component)this).transform.localScale = Vector3.one * Mathf.Lerp(((Component)this).transform.localScale.x, num, 1f - Mathf.Exp(-12f * Time.unscaledDeltaTime));
		}

		private void OnDisable()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			_hovered = false;
			((Component)this).transform.localScale = Vector3.one;
			Frame?.SetHovered(hovered: false);
		}
	}
	internal static class SkillTreeLayout
	{
		public const float ColumnSpacing = 350f;

		public const float BaseHeight = 720f;

		public const float TierHeight = 220f;

		public static float ColumnX(TreeBranch branch)
		{
			return (float)(branch - 2) * 350f;
		}

		public static float Height(AwakeningTier tier)
		{
			return 720f + (float)tier * 220f;
		}

		public static float TierTop(AwakeningTier tier)
		{
			float num = (float)(tier - 1) * 220f;
			return 720f + num;
		}

		public static Vector2 Position(TreeNode node, int pathIndex, int pathCount)
		{
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_015b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0185: Unknown result type (might be due to invalid IL or missing references)
			//IL_0136: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			float num = ColumnX(node.Branch);
			if (node.MinimumTier > AwakeningTier.Base)
			{
				float num2 = (node.Id.EndsWith("a") ? (-82f) : (node.Id.EndsWith("b") ? 82f : 0f));
				return new Vector2(num + num2, 0f - TierTop(node.MinimumTier) - 98f);
			}
			if (node.Path.Length > 0)
			{
				float num3 = ((pathCount == 4) ? (-108f + (float)pathIndex * 72f) : (-66f + (float)pathIndex * 132f));
				if (node.Branch == TreeBranch.Life)
				{
					return new Vector2(num + num3, 0f - ((node.Position <= 5) ? (35f + (float)(node.Position - 1) * 90f) : 485f));
				}
				return new Vector2(num + num3, 0f - node.Position switch
				{
					1 => 35f, 
					2 => 85f, 
					3 => 300f, 
					4 => 345f, 
					5 => 390f, 
					_ => 450f, 
				});
			}
			if (node.Kind == TreeNodeKind.Active)
			{
				return new Vector2(num, (node.Position == 2) ? (-220f) : (-610f));
			}
			if (node.Branch == TreeBranch.Life)
			{
				return new Vector2(num + ((node.Position == 4) ? (-108f) : (-36f)), -590f);
			}
			return new Vector2(num, (node.Position == 4) ? (-140f) : (-520f));
		}
	}
	public sealed class SkillTreeReveal : MonoBehaviour
	{
		private CanvasGroup _group;

		private float _elapsed;

		private bool _revealing;

		public void Reveal(bool animate)
		{
			_group = ((Component)this).GetComponent<CanvasGroup>();
			_elapsed = 0f;
			_revealing = animate;
			_group.alpha = (animate ? 0f : 1f);
			_group.interactable = !animate;
			_group.blocksRaycasts = !animate;
			((Behaviour)this).enabled = animate;
		}

		private void Update()
		{
			if (_revealing)
			{
				_elapsed += Time.unscaledDeltaTime;
				float num = Mathf.Clamp01(_elapsed / 0.4f);
				_group.alpha = num * num * (3f - 2f * num);
				if (!(num < 1f))
				{
					_group.interactable = true;
					_group.blocksRaycasts = true;
					_revealing = false;
					((Behaviour)this).enabled = false;
				}
			}
		}
	}
	internal sealed class SkillTreeView
	{
		private sealed class NodeView
		{
			public Button Button;

			public TreeNodeGraphic Glyph;

			public SkillNodeFrameGraphic Frame;

			public Text Rank;

			public Text? Title;

			public SkillNodeHover Hover;
		}

		private readonly SkillTreeService _tree;

		private readonly IReadOnlyList<ActiveSkill> _skills;

		private readonly Func<int, string> _binding;

		private readonly Font _font;

		private readonly Transform _root;

		private readonly Text _header;

		private read