Decompiled source of Valheim Ascended v0.2.2

plugins\ValheimAscended.dll

Decompiled 5 days ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Text;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.Events;
using UnityEngine.Rendering;
using UnityEngine.UI;
using ValheimAscended.Abilities;
using ValheimAscended.Attributes;
using ValheimAscended.Classes;
using ValheimAscended.Commands;
using ValheimAscended.Config;
using ValheimAscended.Core;
using ValheimAscended.Enchanting;
using ValheimAscended.Patches;
using ValheimAscended.Progression;
using ValheimAscended.Resource;
using ValheimAscended.Shipwright;
using ValheimAscended.Smithing;
using ValheimAscended.Talents;
using ValheimAscended.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("ValheimAscended")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("ValheimAscended")]
[assembly: AssemblyTitle("ValheimAscended")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.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]
	[Microsoft.CodeAnalysis.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]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace ValheimAscended
{
	[BepInPlugin("com.valheimascended.mod", "Valheim Ascended", "0.2.2")]
	[BepInProcess("valheim.exe")]
	public class Plugin : BaseUnityPlugin
	{
		public const string PluginGUID = "com.valheimascended.mod";

		public const string PluginName = "Valheim Ascended";

		public const string PluginVersion = "0.2.2";

		public static ManualLogSource Log;

		private readonly Harmony _harmony = new Harmony("com.valheimascended.mod");

		private void Awake()
		{
			//IL_04c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c8: Expected O, but got Unknown
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Expected O, but got Unknown
			//IL_044f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0456: Expected O, but got Unknown
			//IL_0137: Unknown result type (might be due to invalid IL or missing references)
			//IL_013e: Expected O, but got Unknown
			//IL_03f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_03fd: Expected O, but got Unknown
			//IL_01a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ae: Expected O, but got Unknown
			//IL_0230: Unknown result type (might be due to invalid IL or missing references)
			//IL_0237: Expected O, but got Unknown
			//IL_024d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0254: Expected O, but got Unknown
			//IL_02c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c9: Expected O, but got Unknown
			//IL_02df: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e6: Expected O, but got Unknown
			//IL_02fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0303: Expected O, but got Unknown
			//IL_0325: Unknown result type (might be due to invalid IL or missing references)
			//IL_032c: Expected O, but got Unknown
			Log = ((BaseUnityPlugin)this).Logger;
			Log.LogInfo((object)"Valheim Ascended v0.2.2 loading...");
			ModConfig.Init(((BaseUnityPlugin)this).Config);
			MilestoneDefs.InitBossTalentPoints();
			AttributeSystem.Init();
			RenownSystem.Init();
			ClassSystem.Init();
			AbilitySystem.Init();
			RageSystem.Init();
			FocusSystem.Init();
			ComboSystem.Init();
			MageResourceSystem.Init();
			TalentEffectRegistry.Init();
			ShipModSystem.Init();
			IconLoader.Init();
			_harmony.PatchAll();
			Log.LogInfo((object)"[VA] PatchAll completed.");
			MethodInfo methodInfo = typeof(Character).Assembly.GetType("SE_Cooldown")?.GetMethod("UpdateStatusEffect", BindingFlags.Instance | BindingFlags.Public);
			if (methodInfo != null)
			{
				HarmonyMethod val = new HarmonyMethod(typeof(CooldownPatch).GetMethod("OnCooldownUpdate", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic));
				_harmony.Patch((MethodBase)methodInfo, val, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
				Log.LogInfo((object)"SE_Cooldown found — INT cooldown reduction patch applied.");
			}
			else
			{
				Log.LogInfo((object)"SE_Cooldown not found in this Valheim version — CDR patch skipped.");
			}
			MethodInfo method = typeof(Player).GetMethod("GetAttackDrawPercentage", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
			if (method != null)
			{
				HarmonyMethod val2 = new HarmonyMethod(typeof(DrawSpeedPatch).GetMethod("OnGetAttackDrawPercentage", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic));
				_harmony.Patch((MethodBase)method, (HarmonyMethod)null, val2, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
				Log.LogInfo((object)"Player.GetAttackDrawPercentage found — DrawSpeed talent patch applied.");
			}
			else
			{
				Log.LogWarning((object)"Player.GetAttackDrawPercentage not found — DrawSpeed talent bonus is display-only.");
			}
			MethodInfo method2 = typeof(ItemData).GetMethod("GetWeaponLoadingTime", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
			if (method2 != null)
			{
				HarmonyMethod val3 = new HarmonyMethod(typeof(ReloadSpeedPatch).GetMethod("OnGetWeaponLoadingTime", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic));
				_harmony.Patch((MethodBase)method2, (HarmonyMethod)null, val3, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
				Log.LogInfo((object)"ItemDrop.ItemData.GetWeaponLoadingTime found — Crossbow reload speed patch applied.");
			}
			else
			{
				Log.LogWarning((object)"GetWeaponLoadingTime not found — Crossbow Specialization reload speed is display-only.");
			}
			Type type = typeof(Character).Assembly.GetType("Humanoid");
			MethodInfo methodInfo2 = type?.GetMethod("BlockAttack", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
			if (methodInfo2 != null)
			{
				HarmonyMethod val4 = new HarmonyMethod(typeof(TalentPatch).GetMethod("OnBlockAttackPrefix", BindingFlags.Static | BindingFlags.Public));
				HarmonyMethod val5 = new HarmonyMethod(typeof(TalentPatch).GetMethod("OnBlockAttack", BindingFlags.Static | BindingFlags.Public));
				_harmony.Patch((MethodBase)methodInfo2, val4, val5, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
				Log.LogInfo((object)"Humanoid.BlockAttack found — parry detection patch applied.");
			}
			else
			{
				Log.LogWarning((object)"Humanoid.BlockAttack not found — war_be1 Blood Rage will not fire.");
			}
			try
			{
				MethodInfo methodInfo3 = type?.GetMethod("StartAttack", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
				if (methodInfo3 != null)
				{
					HarmonyMethod val6 = new HarmonyMethod(typeof(DualWieldPatch).GetMethod("OnStartAttackPrefix", BindingFlags.Static | BindingFlags.Public));
					HarmonyMethod val7 = new HarmonyMethod(typeof(DualWieldPatch).GetMethod("OnStartAttackPostfix", BindingFlags.Static | BindingFlags.Public));
					HarmonyMethod val8 = new HarmonyMethod(typeof(AbilitySystem).GetMethod("OnSiegeStartAttackPrefix", BindingFlags.Static | BindingFlags.Public));
					val8.priority = 601;
					HarmonyMethod val9 = new HarmonyMethod(typeof(TalentPatch).GetMethod("OnMageStartAttackPrefix", BindingFlags.Static | BindingFlags.Public));
					val9.priority = 602;
					_harmony.Patch((MethodBase)methodInfo3, val6, val7, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
					_harmony.Patch((MethodBase)methodInfo3, val8, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
					_harmony.Patch((MethodBase)methodInfo3, val9, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
					Log.LogInfo((object)"Humanoid.StartAttack found — dual-wield + siege + mage patches applied.");
				}
				else
				{
					Log.LogWarning((object)"Humanoid.StartAttack not found — dual-wield animations disabled.");
				}
			}
			catch (Exception ex)
			{
				Log.LogWarning((object)("Humanoid.StartAttack patch failed: " + ex.Message));
			}
			try
			{
				MethodInfo methodInfo4 = typeof(SmokeRenderer)?.GetMethod("LateUpdate", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
				if (methodInfo4 != null)
				{
					HarmonyMethod val10 = new HarmonyMethod(typeof(Plugin).GetMethod("SmokeRendererFinalizer", BindingFlags.Static | BindingFlags.Public));
					_harmony.Patch((MethodBase)methodInfo4, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, val10, (HarmonyMethod)null);
				}
			}
			catch (Exception)
			{
			}
			try
			{
				MethodInfo method3 = typeof(EnemyHud).GetMethod("UpdateHuds", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
				if (method3 != null)
				{
					HarmonyMethod val11 = new HarmonyMethod(typeof(EnemyHudPatch).GetMethod("Prefix", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic));
					_harmony.Patch((MethodBase)method3, val11, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
					Log.LogInfo((object)"EnemyHud.UpdateHuds found — Eagle Eye patch applied.");
				}
				else
				{
					Log.LogWarning((object)"EnemyHud.UpdateHuds not found — Eagle Eye talent has no effect.");
				}
			}
			catch (Exception ex3)
			{
				Log.LogWarning((object)("Eagle Eye patch failed: " + ex3.Message));
			}
			HarmonyMethod val12 = new HarmonyMethod(typeof(Plugin).GetMethod("OnTerrainDamagePrefix", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic));
			string[] array = new string[5] { "Destructible", "MineRock", "MineRock5", "TreeBase", "TreeLog" };
			foreach (string text in array)
			{
				try
				{
					Type type2 = typeof(Character).Assembly.GetType(text);
					if (type2 == null)
					{
						Log.LogWarning((object)(text + " type not found — terrain damage patch skipped."));
						continue;
					}
					MethodInfo method4 = type2.GetMethod("Damage", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
					if (method4 == null)
					{
						Log.LogWarning((object)(text + ".Damage not found — terrain damage patch skipped."));
						continue;
					}
					_harmony.Patch((MethodBase)method4, val12, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
					Log.LogInfo((object)(text + ".Damage found — terrain damage patch applied."));
				}
				catch (Exception ex4)
				{
					Log.LogWarning((object)(text + ".Damage patch failed: " + ex4.Message));
				}
			}
			Log.LogInfo((object)"Valheim Ascended loaded.");
		}

		public static void OnTerrainDamagePrefix(HitData hit)
		{
			//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)
			if (hit.m_damage.m_chop <= 0f && hit.m_damage.m_pickaxe <= 0f)
			{
				return;
			}
			Player localPlayer = Player.m_localPlayer;
			if (!((Object)(object)localPlayer == (Object)null) && !(hit.m_attacker != ((Character)localPlayer).GetZDOID()))
			{
				PlayerData orCreate = RenownSystem.GetOrCreate(localPlayer);
				if (orCreate != null)
				{
					float num = 1f + (float)orCreate.TotalSTR * ModConfig.StrTerrainDamagePerPoint.Value + SmithingData.GetRefineStat("RefineTerrainDmg");
					hit.m_damage.m_chop *= num;
					hit.m_damage.m_pickaxe *= num;
				}
			}
		}

		public static Exception SmokeRendererFinalizer(Exception __exception)
		{
			if (__exception is IndexOutOfRangeException)
			{
				return null;
			}
			return __exception;
		}

		private void OnDestroy()
		{
			_harmony.UnpatchSelf();
		}
	}
}
namespace ValheimAscended.UI
{
	[HarmonyPatch]
	internal static class AbilityBar
	{
		private struct BarSkinDef
		{
			public string BackId;

			public string FrontId;

			public Vector2 ImageSize;

			public Vector2[] SlotCenters;

			public int[] SlotMapping;
		}

		[CompilerGenerated]
		private static class <>O
		{
			public static UnityAction <0>__CloseDrawer;
		}

		private static bool _built;

		private static GameObject _root;

		private const int TotalSlots = 5;

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

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

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

		private static readonly GameObject[] _slotGOs = (GameObject[])(object)new GameObject[5];

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

		private static GameObject _skinBackGO;

		private static GameObject _skinFrontGO;

		private static string _activeSkin = "";

		private static GameObject _drawer;

		private static Transform _drawerContent;

		private static int _drawerSlot = -1;

		private static Text _drawerEmpty;

		private static GameObject _tooltipGO;

		private static RectTransform _tooltipRT;

		private static Text _tooltipDesc;

		private static int _tooltipSlot = -1;

		private static bool _tooltipShiftState;

		private static GameObject _castbarGO;

		private static RectTransform _castbarRT;

		private static RectTransform _castFillRT;

		private static Text _castLabel;

		private static GameObject _castbarAnchorGO;

		private static readonly GameObject[][] _surgePipRoots = new GameObject[5][];

		private static readonly Image[][] _surgePipFills = new Image[5][];

		private static readonly GameObject[][] _tempestPipRoots = new GameObject[5][];

		private static readonly Image[][] _tempestPipFills = new Image[5][];

		private static readonly GameObject[] _durationTimerRoots = (GameObject[])(object)new GameObject[5];

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

		private static readonly GameObject[] _wardHPRoots = (GameObject[])(object)new GameObject[5];

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

		private static bool _overchargeHolding;

		private static int _overchargeSlot = -1;

		private static float _overchargeStartTime;

		private static float _overchargeEitrDrained;

		private const float OverchargeFullDuration = 2f;

		private static readonly GameObject[] _overchargeBarRoots = (GameObject[])(object)new GameObject[5];

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

		private static GameObject[] _resonancePipRoots;

		private static Image[] _resonancePipFills;

		private static GameObject _resonancePipContainer;

		private static GameObject[] _zealPipRoots;

		private static Image[] _zealPipFills;

		private static GameObject _zealPipContainer;

		private static GameObject[] _judgmentPipRoots;

		private static Image[] _judgmentPipFills;

		private static GameObject _judgmentPipContainer;

		private static GameObject[] _arsenalHitPipRoots;

		private static Image[] _arsenalHitPipFills;

		private static GameObject[] _arsenalStrikePipRoots;

		private static Image[] _arsenalStrikePipFills;

		private static GameObject _arsenalPipContainer;

		private static readonly string[] _keys = new string[5] { "G", "H", "B", "LMB", "RMB" };

		private static readonly KeyCode[] _keyCodes;

		private static readonly Dictionary<string, BarSkinDef> _barSkins;

		private static bool _isMage;

		private static bool _spellbladeActive;

		private const float SlotSize = 64f;

		private const float SlotPad = 8f;

		private const float SlotStep = 72f;

		private static readonly float BarWidth3;

		private static readonly float BarWidth4;

		private static readonly float BarWidth5;

		private const float BarHeight = 74f;

		private static RectTransform _barRT;

		private static Image _barBgImg;

		private static readonly Color SurgePipBorder;

		private static readonly Color SurgePipBg;

		private static readonly Color SurgePipFill;

		private static readonly Color SurgePipEmpty;

		private static readonly Color TempestPipBorder;

		private static readonly Color TempestPipBg;

		private static readonly Color TempestPipFill;

		private static readonly Color TempestPipEmpty;

		private static readonly Vector2[] _drawerSlotCenters;

		private static readonly Vector2[] _drawerSizes;

		private static GameObject _drawerBlocker;

		private const float AbTTW = 220f;

		private const float AbTTPad = 8f;

		private const float AbTTInnerW = 204f;

		private const float AbTTMaxH = 260f;

		private const float AbTTFadeH = 20f;

		private static readonly Color AbTTBg;

		private static RectTransform _tooltipContentRT;

		private static Image _tooltipBgImg;

		private static float _ttScroll;

		private static GameObject _ttFadeTop;

		private static GameObject _ttFadeBot;

		private static Text _ttHintTop;

		private static Text _ttHintBot;

		private static Font _font;

		private static Sprite _filledSprite;

		public static void Cleanup()
		{
			_built = false;
			_isMage = false;
			_spellbladeActive = false;
			_drawerSlot = -1;
			_tooltipSlot = -1;
			_overchargeHolding = false;
			_overchargeSlot = -1;
			if ((Object)(object)_root != (Object)null)
			{
				Object.Destroy((Object)(object)_root);
				_root = null;
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(InventoryGui), "Show")]
		private static void OnInventoryShow()
		{
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			CloseDrawer();
			if ((Object)(object)_barBgImg != (Object)null)
			{
				((Graphic)_barBgImg).color = new Color(0.07f, 0.07f, 0.07f, 0.88f);
			}
			if ((Object)(object)_castbarAnchorGO != (Object)null)
			{
				_castbarAnchorGO.SetActive(true);
			}
			_activeSkin = "";
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(InventoryGui), "Hide")]
		private static void OnInventoryHide()
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			CloseDrawer();
			HideTooltip();
			if ((Object)(object)_barBgImg != (Object)null)
			{
				((Graphic)_barBgImg).color = Color.clear;
			}
			if ((Object)(object)_castbarAnchorGO != (Object)null)
			{
				_castbarAnchorGO.SetActive(false);
			}
		}

		private static string GetBarSkinId(PlayerClass cls, string subclass)
		{
			if (cls == PlayerClass.Warrior && subclass == "Berserker")
			{
				return "war_berserker";
			}
			if (cls == PlayerClass.Warrior && subclass == "Protector")
			{
				return "war_protector";
			}
			if (cls == PlayerClass.Rogue && subclass == "Assassin")
			{
				return "rog_assassin";
			}
			if (cls == PlayerClass.Rogue && subclass == "Blade Weaver")
			{
				return "rog_bladeweaver";
			}
			if (cls == PlayerClass.Hunter && subclass == "Marksman")
			{
				return "hun_marksman";
			}
			if (cls == PlayerClass.Hunter && subclass == "Storm Weaver")
			{
				return "hun_stormweaver";
			}
			if (cls == PlayerClass.Paladin && subclass == "Judicator")
			{
				return "pal_judicator";
			}
			if (cls == PlayerClass.Paladin && subclass == "Lightsmith")
			{
				return "pal_lightsmith";
			}
			if (cls == PlayerClass.Paladin && subclass == "Death Knight")
			{
				return "pal_deathknight";
			}
			if (cls == PlayerClass.Mage)
			{
				bool flag = TalentBonuses.Has("mag_cap1");
				switch (subclass)
				{
				case "Rime Sage":
					if (!flag)
					{
						return "mag_rimesage";
					}
					return "mag_rimesage_sb";
				case "Pyroclast":
					if (!flag)
					{
						return "mag_pyroclast";
					}
					return "mag_pyroclast_sb";
				case "Tempest Warden":
					if (!flag)
					{
						return "mag_tempest";
					}
					return "mag_tempest_sb";
				}
			}
			return cls switch
			{
				PlayerClass.Mage => "generic_mage", 
				PlayerClass.None => "", 
				_ => "generic", 
			};
		}

		private static void ApplyBarSkin(string skinId, string subclass)
		{
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_013c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: 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_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_0167: Unknown result type (might be due to invalid IL or missing references)
			//IL_0171: Expected O, but got Unknown
			//IL_0191: Unknown result type (might be due to invalid IL or missing references)
			//IL_019c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ee: Expected O, but got Unknown
			//IL_030e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0319: 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_0329: Unknown result type (might be due to invalid IL or missing references)
			//IL_032a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0331: Unknown result type (might be due to invalid IL or missing references)
			//IL_034a: Unknown result type (might be due to invalid IL or missing references)
			//IL_028c: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)_skinBackGO != (Object)null)
			{
				Object.Destroy((Object)(object)_skinBackGO);
				_skinBackGO = null;
			}
			if ((Object)(object)_skinFrontGO != (Object)null)
			{
				Object.Destroy((Object)(object)_skinFrontGO);
				_skinFrontGO = null;
			}
			_activeSkin = skinId;
			if (string.IsNullOrEmpty(skinId) || !_barSkins.TryGetValue(skinId, out var value))
			{
				if ((Object)(object)_barRT != (Object)null)
				{
					_barRT.sizeDelta = new Vector2(_isMage ? BarWidth5 : BarWidth3, 74f);
				}
				for (int i = 0; i < 3; i++)
				{
					if (!((Object)(object)_slotGOs[i] == (Object)null))
					{
						RectTransform component = _slotGOs[i].GetComponent<RectTransform>();
						component.anchoredPosition = new Vector2(8f + (float)i * 72f, -8f);
						component.sizeDelta = new Vector2(64f, 64f);
					}
				}
				if ((Object)(object)_barBgImg != (Object)null)
				{
					((Graphic)_barBgImg).color = Color.clear;
				}
				return;
			}
			Sprite panelIcon = IconLoader.GetPanelIcon(value.BackId);
			Sprite panelIcon2 = IconLoader.GetPanelIcon(value.FrontId);
			if ((Object)(object)panelIcon == (Object)null || (Object)(object)panelIcon2 == (Object)null)
			{
				return;
			}
			_barRT.sizeDelta = value.ImageSize;
			if ((Object)(object)_barBgImg != (Object)null)
			{
				((Graphic)_barBgImg).color = Color.clear;
			}
			_skinBackGO = new GameObject("SkinBack");
			_skinBackGO.transform.SetParent((Transform)(object)_barRT, false);
			RectTransform obj = _skinBackGO.AddComponent<RectTransform>();
			obj.anchorMin = Vector2.zero;
			obj.anchorMax = Vector2.one;
			Vector2 offsetMin = (obj.offsetMax = Vector2.zero);
			obj.offsetMin = offsetMin;
			Image obj2 = _skinBackGO.AddComponent<Image>();
			obj2.sprite = panelIcon;
			((Graphic)obj2).color = Color.white;
			((Graphic)obj2).raycastTarget = false;
			_skinBackGO.transform.SetAsFirstSibling();
			bool[] array = new bool[5];
			for (int j = 0; j < value.SlotCenters.Length; j++)
			{
				int num = ((value.SlotMapping != null && j < value.SlotMapping.Length) ? value.SlotMapping[j] : j);
				if (num < 5 && !((Object)(object)_slotGOs[num] == (Object)null))
				{
					_slotGOs[num].SetActive(true);
					array[num] = true;
					RectTransform component2 = _slotGOs[num].GetComponent<RectTransform>();
					float num2 = value.SlotCenters[j].x - 32f;
					float num3 = 0f - (value.SlotCenters[j].y - 32f);
					component2.anchoredPosition = new Vector2(num2, num3);
				}
			}
			for (int k = 0; k < 5; k++)
			{
				if (!array[k] && (Object)(object)_slotGOs[k] != (Object)null)
				{
					_slotGOs[k].SetActive(false);
				}
			}
			_skinFrontGO = new GameObject("SkinFront");
			_skinFrontGO.transform.SetParent((Transform)(object)_barRT, false);
			RectTransform obj3 = _skinFrontGO.AddComponent<RectTransform>();
			obj3.anchorMin = Vector2.zero;
			obj3.anchorMax = Vector2.one;
			offsetMin = (obj3.offsetMax = Vector2.zero);
			obj3.offsetMin = offsetMin;
			Image obj4 = _skinFrontGO.AddComponent<Image>();
			obj4.sprite = panelIcon2;
			((Graphic)obj4).color = Color.white;
			((Graphic)obj4).raycastTarget = false;
			_skinFrontGO.transform.SetAsLastSibling();
		}

		private static void RefreshMageSlots(Player player)
		{
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			bool isMage = _isMage;
			_isMage = ClassSystem.GetClass(player) == PlayerClass.Mage;
			if (_isMage == isMage || !string.IsNullOrEmpty(_activeSkin))
			{
				return;
			}
			bool flag = (_spellbladeActive = _isMage && TalentBonuses.Has("mag_cap1"));
			if ((Object)(object)_slotGOs[3] != (Object)null)
			{
				_slotGOs[3].SetActive(_isMage && !flag);
			}
			if ((Object)(object)_slotGOs[4] != (Object)null)
			{
				_slotGOs[4].SetActive(_isMage);
				if (_isMage && flag)
				{
					_slotGOs[4].GetComponent<RectTransform>().anchoredPosition = new Vector2(224f, -8f);
				}
			}
			float num = ((!_isMage) ? BarWidth3 : (flag ? BarWidth4 : BarWidth5));
			if ((Object)(object)_barRT != (Object)null)
			{
				_barRT.sizeDelta = new Vector2(num, 74f);
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(Hud), "Awake")]
		private static void OnHudAwake()
		{
			if (!_built)
			{
				Build();
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(Hud), "Update")]
		private static void OnHudUpdate()
		{
			//IL_0c78: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c7f: Invalid comparison between Unknown and I4
			Player localPlayer = Player.m_localPlayer;
			if ((Object)(object)localPlayer == (Object)null || !_built)
			{
				if ((Object)(object)_root != (Object)null)
				{
					_root.SetActive(false);
				}
			}
			else
			{
				if ((Object)(object)_root == (Object)null)
				{
					return;
				}
				bool flag = !((Character)localPlayer).IsDead();
				if (flag)
				{
					PlayerData orCreate = RenownSystem.GetOrCreate(localPlayer);
					if (orCreate == null || AbilitySystem.GetUnlockedAbilities(orCreate).Count == 0)
					{
						flag = false;
					}
				}
				_root.SetActive(flag);
				AbilitySystem.Tick(Time.deltaTime);
				BossKillPatch.Tick();
				MountedCrossbow.TickBolts();
				if (!flag)
				{
					return;
				}
				RefreshMageSlots(localPlayer);
				CastbarSystem.Tick(Time.deltaTime);
				RefreshCooldowns(localPlayer);
				RefreshCastbar();
				UpdateTooltipPosition();
				if (AbilitySystem.IsFrozenGraspTargeting)
				{
					if (Input.GetMouseButtonDown(0) || Input.GetMouseButtonDown(1) || !CanFire(localPlayer))
					{
						AbilitySystem.CancelFrozenGraspTargeting();
						return;
					}
					for (int i = 0; i < 3; i++)
					{
						if (Input.GetKeyUp(_keyCodes[i]))
						{
							AbilitySystem.ConfirmFrozenGraspTargeting(i, localPlayer);
							break;
						}
					}
				}
				else if (AbilitySystem.IsDisengageTargeting)
				{
					if (Input.GetMouseButtonDown(0) || Input.GetMouseButtonDown(1) || !CanFire(localPlayer))
					{
						AbilitySystem.CancelDisengageTargeting();
						return;
					}
					for (int j = 0; j < 3; j++)
					{
						if (Input.GetKeyUp(_keyCodes[j]))
						{
							AbilitySystem.ConfirmDisengageTargeting(j, localPlayer);
							break;
						}
					}
				}
				else if (AbilitySystem.IsChainLightningTargeting)
				{
					if (Input.GetMouseButtonDown(0) || Input.GetMouseButtonDown(1) || !CanFire(localPlayer))
					{
						AbilitySystem.CancelChainLightningTargeting();
						return;
					}
					for (int k = 0; k < 3; k++)
					{
						if (Input.GetKeyUp(_keyCodes[k]))
						{
							AbilitySystem.ConfirmChainLightningTargeting(k, localPlayer);
							break;
						}
					}
				}
				else if (AbilitySystem.IsPiercingShotTargeting)
				{
					if (Input.GetMouseButtonDown(0) || Input.GetMouseButtonDown(1) || !CanFire(localPlayer))
					{
						AbilitySystem.CancelPiercingShotTargeting();
						return;
					}
					for (int l = 0; l < 3; l++)
					{
						if (Input.GetKeyUp(_keyCodes[l]))
						{
							AbilitySystem.ConfirmPiercingShotTargeting(l, localPlayer);
							break;
						}
					}
				}
				else if (AbilitySystem.IsShadowAnchorTargeting)
				{
					if (Input.GetMouseButtonDown(0) || Input.GetMouseButtonDown(1) || !CanFire(localPlayer))
					{
						AbilitySystem.CancelShadowAnchorTargeting();
						return;
					}
					for (int m = 0; m < 3; m++)
					{
						if (Input.GetKeyUp(_keyCodes[m]))
						{
							AbilitySystem.ConfirmShadowAnchorTargeting(m, localPlayer);
							break;
						}
					}
				}
				else if (AbilitySystem.IsShadowStrikeTargeting)
				{
					if (Input.GetMouseButtonDown(0) || Input.GetMouseButtonDown(1) || !CanFire(localPlayer))
					{
						AbilitySystem.CancelShadowStrikeTargeting();
						return;
					}
					for (int n = 0; n < 3; n++)
					{
						if (Input.GetKeyUp(_keyCodes[n]))
						{
							AbilitySystem.ConfirmShadowStrikeTargeting(n, localPlayer);
							break;
						}
					}
				}
				else if (AbilitySystem.IsBladeDanceTargeting)
				{
					if (Input.GetMouseButtonDown(0) || Input.GetMouseButtonDown(1) || !CanFire(localPlayer))
					{
						AbilitySystem.CancelBladeDanceTargeting();
						return;
					}
					for (int num = 0; num < 3; num++)
					{
						if (Input.GetKeyUp(_keyCodes[num]))
						{
							AbilitySystem.ConfirmBladeDanceTargeting(num, localPlayer);
							break;
						}
					}
				}
				else if (AbilitySystem.IsBladeBarrageTargeting)
				{
					if (Input.GetMouseButtonDown(0) || Input.GetMouseButtonDown(1) || !CanFire(localPlayer))
					{
						AbilitySystem.CancelBladeBarrageTargeting();
						return;
					}
					for (int num2 = 0; num2 < 3; num2++)
					{
						if (Input.GetKeyUp(_keyCodes[num2]))
						{
							AbilitySystem.ConfirmBladeBarrageTargeting(num2, localPlayer);
							break;
						}
					}
				}
				else if (AbilitySystem.IsThrowingKnivesTargeting)
				{
					if (Input.GetMouseButtonDown(0) || Input.GetMouseButtonDown(1) || !CanFire(localPlayer))
					{
						AbilitySystem.CancelThrowingKnivesTargeting();
						return;
					}
					for (int num3 = 0; num3 < 3; num3++)
					{
						if (Input.GetKeyUp(_keyCodes[num3]))
						{
							AbilitySystem.ConfirmThrowingKnivesTargeting(num3, localPlayer);
							break;
						}
					}
				}
				else if (AbilitySystem.IsGroundSlamTargeting)
				{
					if (Input.GetMouseButtonDown(0) || Input.GetMouseButtonDown(1) || !CanFire(localPlayer))
					{
						AbilitySystem.CancelGroundSlamTargeting();
						return;
					}
					for (int num4 = 0; num4 < 3; num4++)
					{
						if (Input.GetKeyUp(_keyCodes[num4]))
						{
							AbilitySystem.ConfirmGroundSlamTargeting(num4, localPlayer);
							break;
						}
					}
				}
				else if (AbilitySystem.IsChargeTargeting)
				{
					if (Input.GetMouseButtonDown(0) || Input.GetMouseButtonDown(1) || !CanFire(localPlayer))
					{
						AbilitySystem.CancelChargeTargeting();
						return;
					}
					for (int num5 = 0; num5 < 3; num5++)
					{
						if (Input.GetKeyUp(_keyCodes[num5]))
						{
							AbilitySystem.ConfirmChargeTargeting(num5, localPlayer);
							break;
						}
					}
				}
				else if (AbilitySystem.IsWarCryTargeting)
				{
					if (Input.GetMouseButtonDown(0) || Input.GetMouseButtonDown(1) || !CanFire(localPlayer))
					{
						AbilitySystem.CancelWarCryTargeting();
						return;
					}
					for (int num6 = 0; num6 < 3; num6++)
					{
						if (Input.GetKeyUp(_keyCodes[num6]))
						{
							AbilitySystem.ConfirmWarCryTargeting(num6, localPlayer);
							break;
						}
					}
				}
				else if (AbilitySystem.IsWarStompTargeting)
				{
					if (Input.GetMouseButtonDown(0) || Input.GetMouseButtonDown(1) || !CanFire(localPlayer))
					{
						AbilitySystem.CancelWarStompTargeting();
						return;
					}
					for (int num7 = 0; num7 < 3; num7++)
					{
						if (Input.GetKeyUp(_keyCodes[num7]))
						{
							AbilitySystem.ConfirmWarStompTargeting(num7, localPlayer);
							break;
						}
					}
				}
				else if (AbilitySystem.IsWhirlwindTargeting)
				{
					if (Input.GetMouseButtonDown(0) || Input.GetMouseButtonDown(1) || !CanFire(localPlayer))
					{
						AbilitySystem.CancelWhirlwindTargeting();
						return;
					}
					for (int num8 = 0; num8 < 3; num8++)
					{
						if (Input.GetKeyUp(_keyCodes[num8]))
						{
							AbilitySystem.ConfirmWhirlwindTargeting(num8, localPlayer);
							break;
						}
					}
				}
				else if (AbilitySystem.IsRainTargeting)
				{
					if (Input.GetMouseButtonDown(0) || Input.GetMouseButtonDown(1) || !CanFire(localPlayer))
					{
						AbilitySystem.CancelRainTargeting();
						return;
					}
					for (int num9 = 0; num9 < 3; num9++)
					{
						if (Input.GetKeyUp(_keyCodes[num9]))
						{
							AbilitySystem.ConfirmRainTargeting(num9, localPlayer);
							break;
						}
					}
				}
				else if (AbilitySystem.IsBlizzardTargeting)
				{
					if (Input.GetMouseButtonDown(0) || Input.GetMouseButtonDown(1) || !CanFire(localPlayer))
					{
						AbilitySystem.CancelBlizzardTargeting();
						return;
					}
					for (int num10 = 0; num10 < 3; num10++)
					{
						if (Input.GetKeyUp(_keyCodes[num10]))
						{
							AbilitySystem.ConfirmBlizzardTargeting(num10, localPlayer);
							break;
						}
					}
				}
				else if (AbilitySystem.IsEruptionTargeting)
				{
					if (Input.GetMouseButtonDown(0) || Input.GetMouseButtonDown(1) || !CanFire(localPlayer))
					{
						AbilitySystem.CancelEruptionTargeting();
						return;
					}
					for (int num11 = 0; num11 < 3; num11++)
					{
						if (Input.GetKeyUp(_keyCodes[num11]))
						{
							AbilitySystem.ConfirmEruptionTargeting(num11, localPlayer);
							break;
						}
					}
				}
				else if (AbilitySystem.IsMeteorTargeting)
				{
					if (Input.GetMouseButtonDown(0) || Input.GetMouseButtonDown(1) || !CanFire(localPlayer))
					{
						AbilitySystem.CancelMeteorTargeting();
						return;
					}
					for (int num12 = 0; num12 < 3; num12++)
					{
						if (Input.GetKeyUp(_keyCodes[num12]))
						{
							AbilitySystem.ConfirmMeteorTargeting(num12, localPlayer);
							break;
						}
					}
				}
				else if (AbilitySystem.IsFlameWallTargeting)
				{
					if (Input.GetMouseButtonDown(0) || Input.GetMouseButtonDown(1) || !CanFire(localPlayer))
					{
						AbilitySystem.CancelFlameWallTargeting();
						return;
					}
					for (int num13 = 0; num13 < 3; num13++)
					{
						if (Input.GetKeyUp(_keyCodes[num13]))
						{
							AbilitySystem.ConfirmFlameWallTargeting(num13, localPlayer);
							break;
						}
					}
				}
				else if (AbilitySystem.IsLightningStormTargeting)
				{
					if (Input.GetMouseButtonDown(0) || Input.GetMouseButtonDown(1) || !CanFire(localPlayer))
					{
						AbilitySystem.CancelLightningStormTargeting();
						return;
					}
					for (int num14 = 0; num14 < 3; num14++)
					{
						if (Input.GetKeyUp(_keyCodes[num14]))
						{
							AbilitySystem.ConfirmLightningStormTargeting(num14, localPlayer);
							break;
						}
					}
				}
				else if (AbilitySystem.IsBlinkTargeting)
				{
					if (Input.GetMouseButtonDown(0) || Input.GetMouseButtonDown(1) || !CanFire(localPlayer))
					{
						AbilitySystem.CancelBlinkTargeting();
						return;
					}
					for (int num15 = 0; num15 < 3; num15++)
					{
						if (Input.GetKeyUp(_keyCodes[num15]))
						{
							AbilitySystem.ConfirmBlinkTargeting(num15, localPlayer);
							break;
						}
					}
				}
				else if (AbilitySystem.IsPaladinIndicatorActive)
				{
					if (Input.GetMouseButtonDown(0) || Input.GetMouseButtonDown(1) || !CanFire(localPlayer))
					{
						AbilitySystem.CancelPaladinIndicator();
						return;
					}
					for (int num16 = 0; num16 < 3; num16++)
					{
						if (Input.GetKeyUp(_keyCodes[num16]))
						{
							AbilitySystem.ConfirmPaladinIndicator(num16, localPlayer);
							break;
						}
					}
				}
				else
				{
					if (!CanFire(localPlayer))
					{
						return;
					}
					for (int num17 = 0; num17 < 3; num17++)
					{
						if (!Input.GetKeyDown(_keyCodes[num17]))
						{
							continue;
						}
						AbilityDef slotAbility = AbilitySystem.GetSlotAbility(num17, localPlayer);
						if (slotAbility != null && slotAbility.Id == "rain_of_arrows")
						{
							if (AbilitySystem.CheckEitr(slotAbility, localPlayer))
							{
								AbilitySystem.BeginRainTargeting(num17, localPlayer);
							}
						}
						else if (slotAbility != null && slotAbility.Id == "frost_nova")
						{
							AbilitySystem.BeginFrozenGraspTargeting(num17, localPlayer);
						}
						else if (slotAbility != null && slotAbility.Id == "blizzard")
						{
							AbilitySystem.BeginBlizzardTargeting(num17, localPlayer);
						}
						else if (slotAbility != null && slotAbility.Id == "eruption")
						{
							if (AbilitySystem.CheckEitr(slotAbility, localPlayer))
							{
								AbilitySystem.BeginEruptionTargeting(num17, localPlayer);
							}
						}
						else if (slotAbility != null && slotAbility.Id == "meteor")
						{
							if (AbilitySystem.CheckEitr(slotAbility, localPlayer))
							{
								AbilitySystem.BeginMeteorTargeting(num17, localPlayer);
							}
						}
						else if (slotAbility != null && slotAbility.Id == "flame_wall")
						{
							if (AbilitySystem.CheckEitr(slotAbility, localPlayer))
							{
								AbilitySystem.BeginFlameWallTargeting(num17, localPlayer);
							}
						}
						else if (slotAbility != null && slotAbility.Id == "lightning_storm")
						{
							if (AbilitySystem.CheckEitr(slotAbility, localPlayer))
							{
								AbilitySystem.BeginLightningStormTargeting(num17, localPlayer);
							}
						}
						else if (slotAbility != null && slotAbility.Id == "blink")
						{
							if (AbilitySystem.CheckEitr(slotAbility, localPlayer))
							{
								AbilitySystem.BeginBlinkTargeting(num17, localPlayer);
							}
						}
						else if (slotAbility != null && slotAbility.Id == "disengage")
						{
							AbilitySystem.BeginDisengageTargeting(num17, localPlayer);
						}
						else if (slotAbility != null && slotAbility.Id == "chain_lightning")
						{
							AbilitySystem.BeginChainLightningTargeting(num17, localPlayer);
						}
						else if (slotAbility != null && slotAbility.Id == "piercing_shot")
						{
							AbilitySystem.BeginPiercingShotTargeting(num17, localPlayer);
						}
						else if (slotAbility != null && slotAbility.Id == "shadowstrike")
						{
							AbilitySystem.BeginShadowStrikeTargeting(num17, localPlayer);
						}
						else if (slotAbility != null && slotAbility.Id == "blade_dance")
						{
							AbilitySystem.BeginBladeDanceTargeting(num17, localPlayer);
						}
						else if (slotAbility != null && slotAbility.Id == "blade_barrage")
						{
							AbilitySystem.BeginBladeBarrageTargeting(num17, localPlayer);
						}
						else if (slotAbility != null && slotAbility.Id == "throwing_knives")
						{
							AbilitySystem.BeginThrowingKnivesTargeting(num17, localPlayer);
						}
						else if (slotAbility != null && slotAbility.Id == "ground_slam")
						{
							AbilitySystem.BeginGroundSlamTargeting(num17, localPlayer);
						}
						else if (slotAbility != null && slotAbility.Id == "charge")
						{
							AbilitySystem.BeginChargeTargeting(num17, localPlayer);
						}
						else if (slotAbility != null && slotAbility.Id == "war_cry")
						{
							AbilitySystem.BeginWarCryTargeting(num17, localPlayer);
						}
						else if (slotAbility != null && slotAbility.Id == "war_stomp")
						{
							AbilitySystem.BeginWarStompTargeting(num17, localPlayer);
						}
						else if (slotAbility != null && slotAbility.Id == "whirlwind")
						{
							AbilitySystem.BeginWhirlwindTargeting(num17, localPlayer);
						}
						else if (slotAbility != null && (slotAbility.Id == "holy_strike" || slotAbility.Id == "consecration" || slotAbility.Id == "divine_judgement" || slotAbility.Id == "frost_reaping" || slotAbility.Id == "healing_light" || slotAbility.Id == "sanctified_barrage" || slotAbility.Id == "absolution" || slotAbility.Id == "divine_shield" || slotAbility.Id == "radiant_aura"))
						{
							AbilitySystem.BeginPaladinIndicator(num17, localPlayer);
						}
						else if (slotAbility != null && slotAbility.Id == "shadow_anchor")
						{
							if (AbilitySystem.ShadowAnchorActive)
							{
								AbilitySystem.ReactivateShadowAnchorPublic(localPlayer);
							}
							else
							{
								AbilitySystem.BeginShadowAnchorTargeting(num17, localPlayer);
							}
						}
						else if (slotAbility != null && slotAbility.Id == "surge" && AbilitySystem.IsSurgeActive)
						{
							if (AbilitySystem.IsSurgeRecastActive)
							{
								AbilitySystem.TryActivateSurgeRecast(localPlayer);
							}
						}
						else if (slotAbility != null && slotAbility.EitrCost > 0f && TalentBonuses.Has("mag_cap3") && AbilitySystem.GetOverchargeCategory(slotAbility.Id) != null && AbilitySystem.GetCooldownRemaining(num17) <= 0f)
						{
							if (AbilitySystem.CheckEitr(slotAbility, localPlayer))
							{
								_overchargeHolding = true;
								_overchargeSlot = num17;
								_overchargeStartTime = Time.time;
								_overchargeEitrDrained = 0f;
							}
						}
						else
						{
							AbilitySystem.TryActivate(num17, localPlayer);
						}
					}
					if (_isMage)
					{
						ItemData currentWeapon = ((Humanoid)localPlayer).GetCurrentWeapon();
						bool flag2 = currentWeapon != null && ((int)currentWeapon.m_shared.m_itemType == 19 || (Object)(object)currentWeapon.m_shared.m_buildPieces != (Object)null);
						if (Input.GetMouseButton(1) && !flag2 && !((Character)localPlayer).InPlaceMode() && !InventoryGui.IsVisible() && !Menu.IsVisible() && !Minimap.IsOpen())
						{
							if (!AbilitySystem.MageBlockActive)
							{
								AbilitySystem.MageBlockActive = true;
								AbilitySystem.MageBlockStartTime = Time.time;
								VfxHelper.BroadcastBuffVfx("spell_barrier", active: true);
							}
						}
						else if (AbilitySystem.MageBlockActive)
						{
							AbilitySystem.MageBlockActive = false;
							VfxHelper.BroadcastBuffVfx("spell_barrier", active: false);
						}
						if (!flag2 && !((Character)localPlayer).InPlaceMode() && !TalentBonuses.Has("mag_cap1") && Input.GetMouseButtonDown(0))
						{
							AbilitySystem.TryActivate(3, localPlayer);
						}
					}
					if (!_overchargeHolding || _overchargeSlot < 0)
					{
						return;
					}
					_ = Time.time;
					_ = _overchargeStartTime;
					AbilityDef slotAbility2 = AbilitySystem.GetSlotAbility(_overchargeSlot, localPlayer);
					if (slotAbility2 != null && slotAbility2.EitrCost > 0f)
					{
						float num18 = slotAbility2.EitrCost / 2f * Time.deltaTime;
						float value = Traverse.Create((object)localPlayer).Field("m_eitr").GetValue<float>();
						if (value < num18)
						{
							_overchargeHolding = false;
							AbilitySystem.IsOvercharged = false;
							AbilitySystem.TryActivate(_overchargeSlot, localPlayer);
							_overchargeSlot = -1;
						}
						else
						{
							Traverse.Create((object)localPlayer).Field("m_eitr").SetValue((object)(value - num18));
							_overchargeEitrDrained += num18;
						}
					}
					bool flag3 = false;
					if (_overchargeSlot < 3)
					{
						flag3 = Input.GetKeyUp(_keyCodes[_overchargeSlot]);
					}
					else if (_overchargeSlot == 3)
					{
						flag3 = Input.GetMouseButtonUp(0);
					}
					if (flag3)
					{
						AbilitySystem.IsOvercharged = (Time.time - _overchargeStartTime) / 2f >= 0.95f;
						_overchargeHolding = false;
						AbilitySystem.TryActivate(_overchargeSlot, localPlayer);
						_overchargeSlot = -1;
					}
				}
			}
		}

		private static bool CanFire(Player player)
		{
			if (CastbarSystem.IsCasting)
			{
				return false;
			}
			if (InventoryGui.IsVisible())
			{
				return false;
			}
			if ((Object)(object)Chat.instance != (Object)null && Chat.instance.HasFocus())
			{
				return false;
			}
			if (Console.IsVisible())
			{
				return false;
			}
			if (MountedCrossbow.IsLocalPlayerMounted)
			{
				return false;
			}
			return true;
		}

		private static void Build()
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Expected O, but got Unknown
			//IL_0055: 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_007e: Unknown result type (might be due to invalid IL or missing references)
			_built = true;
			_root = new GameObject("VA_AbilityBar");
			Object.DontDestroyOnLoad((Object)(object)_root);
			Canvas obj = _root.AddComponent<Canvas>();
			obj.renderMode = (RenderMode)0;
			obj.sortingOrder = 1400;
			CanvasScaler obj2 = _root.AddComponent<CanvasScaler>();
			obj2.uiScaleMode = (ScaleMode)1;
			obj2.referenceResolution = new Vector2(1920f, 1080f);
			_root.AddComponent<GraphicRaycaster>();
			_root.transform.localScale = Vector3.one * 0.875f;
			_root.SetActive(false);
			BuildBar(_root.transform);
			BuildCastbar(_root.transform);
			BuildDrawer(_root.transform);
			BuildTooltip(_root.transform);
		}

		private static void BuildBar(Transform canvas)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Expected O, but got Unknown
			//IL_003e: 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_0059: 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_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: Expected O, but got Unknown
			//IL_0141: Unknown result type (might be due to invalid IL or missing references)
			//IL_0147: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: Unknown result type (might be due to invalid IL or missing references)
			//IL_016a: Unknown result type (might be due to invalid IL or missing references)
			//IL_017e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f5: 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_0206: Unknown result type (might be due to invalid IL or missing references)
			//IL_020c: Unknown result type (might be due to invalid IL or missing references)
			//IL_021b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0243: Unknown result type (might be due to invalid IL or missing references)
			//IL_0248: Unknown result type (might be due to invalid IL or missing references)
			//IL_0256: Unknown result type (might be due to invalid IL or missing references)
			//IL_025d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0268: Unknown result type (might be due to invalid IL or missing references)
			//IL_0273: Unknown result type (might be due to invalid IL or missing references)
			//IL_0278: Unknown result type (might be due to invalid IL or missing references)
			//IL_0279: Unknown result type (might be due to invalid IL or missing references)
			//IL_027f: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_030b: Unknown result type (might be due to invalid IL or missing references)
			//IL_034a: Unknown result type (might be due to invalid IL or missing references)
			//IL_039f: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_03dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_03fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0401: Unknown result type (might be due to invalid IL or missing references)
			//IL_0414: Unknown result type (might be due to invalid IL or missing references)
			//IL_042f: Unknown result type (might be due to invalid IL or missing references)
			//IL_044a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0455: Unknown result type (might be due to invalid IL or missing references)
			//IL_0469: Unknown result type (might be due to invalid IL or missing references)
			//IL_0473: Expected O, but got Unknown
			//IL_047a: Unknown result type (might be due to invalid IL or missing references)
			//IL_047f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0481: Unknown result type (might be due to invalid IL or missing references)
			//IL_0488: Expected O, but got Unknown
			//IL_04ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_04bc: Expected O, but got Unknown
			GameObject val = new GameObject("Bar");
			val.transform.SetParent(canvas, false);
			_barRT = val.AddComponent<RectTransform>();
			RectTransform barRT = _barRT;
			RectTransform barRT2 = _barRT;
			Vector2 val2 = default(Vector2);
			((Vector2)(ref val2))..ctor(0.5f, 0f);
			barRT2.anchorMax = val2;
			barRT.anchorMin = val2;
			_barRT.pivot = new Vector2(0.5f, 0f);
			_barRT.anchoredPosition = new Vector2(400f, 90f);
			_barRT.sizeDelta = new Vector2(BarWidth3, 74f);
			_barBgImg = val.AddComponent<Image>();
			((Graphic)_barBgImg).color = Color.clear;
			((Graphic)_barBgImg).raycastTarget = true;
			HudDrag hudDrag = val.AddComponent<HudDrag>();
			hudDrag.Target = _barRT;
			hudDrag.PanelId = "hud_abilities";
			Transform transform = val.transform;
			for (int i = 0; i < 5; i++)
			{
				int capture = i;
				float num = 8f + (float)i * 72f;
				GameObject val3 = new GameObject($"Slot{i}");
				val3.transform.SetParent(transform, false);
				RectTransform obj = val3.AddComponent<RectTransform>();
				((Vector2)(ref val2))..ctor(0f, 1f);
				obj.anchorMax = val2;
				obj.anchorMin = val2;
				obj.pivot = new Vector2(0f, 1f);
				obj.anchoredPosition = new Vector2(num, -8f);
				obj.sizeDelta = new Vector2(64f, 64f);
				((Graphic)val3.AddComponent<Image>()).color = new Color(0.14f, 0.14f, 0.14f, 1f);
				_slotGOs[i] = val3;
				if (i >= 3)
				{
					val3.SetActive(false);
				}
				Transform transform2 = val3.transform;
				GameObject val4 = new GameObject("Icon");
				val4.transform.SetParent(transform2, false);
				RectTransform obj2 = val4.AddComponent<RectTransform>();
				obj2.anchorMin = Vector2.zero;
				obj2.anchorMax = Vector2.one;
				val2 = (obj2.offsetMin = (obj2.offsetMax = Vector2.zero));
				Image val6 = val4.AddComponent<Image>();
				((Graphic)val6).color = Color.white;
				val6.preserveAspect = true;
				((Behaviour)val6).enabled = false;
				_slotIcons[i] = val6;
				GameObject val7 = new GameObject("CD");
				val7.transform.SetParent(transform2, false);
				RectTransform obj3 = val7.AddComponent<RectTransform>();
				obj3.anchorMin = Vector2.zero;
				obj3.anchorMax = Vector2.one;
				val2 = (obj3.offsetMin = (obj3.offsetMax = Vector2.zero));
				Image val9 = val7.AddComponent<Image>();
				((Graphic)val9).color = new Color(0.15f, 0.15f, 0.15f, 0.7f);
				val9.type = (Type)3;
				val9.fillMethod = (FillMethod)4;
				val9.fillOrigin = 2;
				val9.fillClockwise = false;
				val9.fillAmount = 0f;
				val9.sprite = CreateFilledSprite();
				_cdOverlay[i] = val9;
				_nameLabels[i] = MakeTxt(transform2, $"Name{i}", "Empty", 8, Color.gray, 2f, -2f, 60f, 26f, (TextAnchor)1);
				_cdLabels[i] = MakeTxt(transform2, $"CD{i}", "", 9, Color.white, 0f, -24f, 64f, 16f, (TextAnchor)4);
				int size = ((i >= 3) ? 7 : 9);
				Outline obj4 = ((Component)MakeTxt(transform2, $"Key{i}", _keys[i], size, new Color(0.9f, 0.8f, 0.2f), 0f, -50f, 64f, 14f, (TextAnchor)4)).gameObject.AddComponent<Outline>();
				((Shadow)obj4).effectColor = Color.black;
				((Shadow)obj4).effectDistance = new Vector2(1f, -1f);
				Button obj5 = val3.AddComponent<Button>();
				((Selectable)obj5).targetGraphic = (Graphic)(object)val3.GetComponent<Image>();
				ColorBlock colors = ((Selectable)obj5).colors;
				((ColorBlock)(ref colors)).normalColor = new Color(0.14f, 0.14f, 0.14f);
				((ColorBlock)(ref colors)).highlightedColor = new Color(0.22f, 0.22f, 0.22f);
				((ColorBlock)(ref colors)).pressedColor = new Color(0.08f, 0.08f, 0.08f);
				((Selectable)obj5).colors = colors;
				((UnityEvent)obj5.onClick).AddListener((UnityAction)delegate
				{
					OpenDrawer(capture);
				});
				EventTrigger obj6 = val3.AddComponent<EventTrigger>();
				Entry val10 = new Entry
				{
					eventID = (EventTriggerType)0
				};
				((UnityEvent<BaseEventData>)(object)val10.callback).AddListener((UnityAction<BaseEventData>)delegate
				{
					ShowSlotTooltip(capture);
				});
				obj6.triggers.Add(val10);
				Entry val11 = new Entry
				{
					eventID = (EventTriggerType)1
				};
				((UnityEvent<BaseEventData>)(object)val11.callback).AddListener((UnityAction<BaseEventData>)delegate
				{
					HideTooltip();
				});
				obj6.triggers.Add(val11);
				BuildSurgePips(transform2, capture);
				BuildTempestPips(transform2, capture);
				BuildDurationTimer(transform2, capture);
				BuildWardHPBar(transform2, capture);
				BuildOverchargeBar(transform2, capture);
			}
			BuildResonancePips(val.transform);
			BuildZealPips(val.transform);
			BuildJudgmentPips(val.transform);
			BuildArsenalPips(val.transform);
		}

		private static void BuildSurgePips(Transform slotTransform, int slotIndex)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Expected O, but got Unknown
			//IL_0031: 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_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Expected O, but got Unknown
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: 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_0148: Unknown result type (might be due to invalid IL or missing references)
			//IL_0161: 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_018b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_01be: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f9: 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_0217: Unknown result type (might be due to invalid IL or missing references)
			//IL_021c: Unknown result type (might be due to invalid IL or missing references)
			//IL_022f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0236: Unknown result type (might be due to invalid IL or missing references)
			//IL_0241: Unknown result type (might be due to invalid IL or missing references)
			//IL_0256: Unknown result type (might be due to invalid IL or missing references)
			//IL_026a: Unknown result type (might be due to invalid IL or missing references)
			//IL_027d: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("SurgePips");
			val.transform.SetParent(slotTransform, false);
			RectTransform obj = val.AddComponent<RectTransform>();
			Vector2 val2 = default(Vector2);
			((Vector2)(ref val2))..ctor(0.5f, 0f);
			obj.anchorMax = val2;
			obj.anchorMin = val2;
			obj.pivot = new Vector2(0.5f, 1f);
			obj.anchoredPosition = new Vector2(0f, -2f);
			obj.sizeDelta = new Vector2(64f, 12f);
			val.SetActive(false);
			_surgePipRoots[slotIndex] = (GameObject[])(object)new GameObject[3];
			_surgePipFills[slotIndex] = (Image[])(object)new Image[3];
			float num = 8f;
			float num2 = 4f;
			float num3 = (0f - (3f * num + 2f * num2)) / 2f + num / 2f;
			for (int i = 0; i < 3; i++)
			{
				GameObject val3 = new GameObject($"Pip{i}");
				val3.transform.SetParent(val.transform, false);
				RectTransform obj2 = val3.AddComponent<RectTransform>();
				((Vector2)(ref val2))..ctor(0.5f, 0.5f);
				obj2.anchorMax = val2;
				obj2.anchorMin = val2;
				obj2.pivot = new Vector2(0.5f, 0.5f);
				obj2.anchoredPosition = new Vector2(num3 + (float)i * (num + num2), 0f);
				obj2.sizeDelta = new Vector2(num + 2f, num + 2f);
				((Transform)obj2).localRotation = Quaternion.Euler(0f, 0f, 45f);
				((Graphic)val3.AddComponent<Image>()).color = SurgePipBorder;
				_surgePipRoots[slotIndex][i] = val3;
				GameObject val4 = new GameObject("Bg");
				val4.transform.SetParent(val3.transform, false);
				RectTransform obj3 = val4.AddComponent<RectTransform>();
				obj3.anchorMin = Vector2.zero;
				obj3.anchorMax = Vector2.one;
				obj3.offsetMin = new Vector2(1f, 1f);
				obj3.offsetMax = new Vector2(-1f, -1f);
				((Graphic)val4.AddComponent<Image>()).color = SurgePipBg;
				GameObject val5 = new GameObject("Fill");
				val5.transform.SetParent(val3.transform, false);
				RectTransform obj4 = val5.AddComponent<RectTransform>();
				obj4.anchorMin = Vector2.zero;
				obj4.anchorMax = Vector2.one;
				obj4.offsetMin = new Vector2(1.5f, 1.5f);
				obj4.offsetMax = new Vector2(-1.5f, -1.5f);
				Image val6 = val5.AddComponent<Image>();
				((Graphic)val6).color = SurgePipFill;
				((Behaviour)val6).enabled = false;
				_surgePipFills[slotIndex][i] = val6;
			}
		}

		private static void BuildTempestPips(Transform slotTransform, int slotIndex)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			//IL_0037: 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_0050: 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_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Expected O, but got Unknown
			//IL_0119: 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_0132: Unknown result type (might be due to invalid IL or missing references)
			//IL_014c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0165: Unknown result type (might be due to invalid IL or missing references)
			//IL_017e: Unknown result type (might be due to invalid IL or missing references)
			//IL_018f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_01af: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_020c: Unknown result type (might be due to invalid IL or missing references)
			//IL_021b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0220: Unknown result type (might be due to invalid IL or missing references)
			//IL_0233: Unknown result type (might be due to invalid IL or missing references)
			//IL_023a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0245: Unknown result type (might be due to invalid IL or missing references)
			//IL_025a: Unknown result type (might be due to invalid IL or missing references)
			//IL_026e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0281: Unknown result type (might be due to invalid IL or missing references)
			int tempestMaxStrikesPublic = AbilitySystem.TempestMaxStrikesPublic;
			GameObject val = new GameObject("TempestPips");
			val.transform.SetParent(slotTransform, false);
			RectTransform obj = val.AddComponent<RectTransform>();
			Vector2 val2 = default(Vector2);
			((Vector2)(ref val2))..ctor(0.5f, 0f);
			obj.anchorMax = val2;
			obj.anchorMin = val2;
			obj.pivot = new Vector2(0.5f, 1f);
			obj.anchoredPosition = new Vector2(0f, -2f);
			obj.sizeDelta = new Vector2(64f, 12f);
			val.SetActive(false);
			_tempestPipRoots[slotIndex] = (GameObject[])(object)new GameObject[tempestMaxStrikesPublic];
			_tempestPipFills[slotIndex] = (Image[])(object)new Image[tempestMaxStrikesPublic];
			float num = 8f;
			float num2 = 4f;
			float num3 = (0f - ((float)tempestMaxStrikesPublic * num + (float)(tempestMaxStrikesPublic - 1) * num2)) / 2f + num / 2f;
			for (int i = 0; i < tempestMaxStrikesPublic; i++)
			{
				GameObject val3 = new GameObject($"Pip{i}");
				val3.transform.SetParent(val.transform, false);
				RectTransform obj2 = val3.AddComponent<RectTransform>();
				((Vector2)(ref val2))..ctor(0.5f, 0.5f);
				obj2.anchorMax = val2;
				obj2.anchorMin = val2;
				obj2.pivot = new Vector2(0.5f, 0.5f);
				obj2.anchoredPosition = new Vector2(num3 + (float)i * (num + num2), 0f);
				obj2.sizeDelta = new Vector2(num + 2f, num + 2f);
				((Transform)obj2).localRotation = Quaternion.Euler(0f, 0f, 45f);
				((Graphic)val3.AddComponent<Image>()).color = TempestPipBorder;
				_tempestPipRoots[slotIndex][i] = val3;
				GameObject val4 = new GameObject("Bg");
				val4.transform.SetParent(val3.transform, false);
				RectTransform obj3 = val4.AddComponent<RectTransform>();
				obj3.anchorMin = Vector2.zero;
				obj3.anchorMax = Vector2.one;
				obj3.offsetMin = new Vector2(1f, 1f);
				obj3.offsetMax = new Vector2(-1f, -1f);
				((Graphic)val4.AddComponent<Image>()).color = TempestPipBg;
				GameObject val5 = new GameObject("Fill");
				val5.transform.SetParent(val3.transform, false);
				RectTransform obj4 = val5.AddComponent<RectTransform>();
				obj4.anchorMin = Vector2.zero;
				obj4.anchorMax = Vector2.one;
				obj4.offsetMin = new Vector2(1.5f, 1.5f);
				obj4.offsetMax = new Vector2(-1.5f, -1.5f);
				Image val6 = val5.AddComponent<Image>();
				((Graphic)val6).color = TempestPipFill;
				((Behaviour)val6).enabled = false;
				_tempestPipFills[slotIndex][i] = val6;
			}
		}

		private static void BuildDurationTimer(Transform slotTransform, int slotIndex)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Expected O, but got Unknown
			//IL_0029: 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_0053: 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_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_00d5: 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_00e7: 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_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)
			GameObject val = new GameObject("DurationTimer");
			val.transform.SetParent(slotTransform, false);
			RectTransform obj = val.AddComponent<RectTransform>();
			obj.anchorMin = new Vector2(0f, 1f);
			obj.anchorMax = new Vector2(1f, 1f);
			obj.pivot = new Vector2(0.5f, 0f);
			obj.anchoredPosition = new Vector2(0f, 2f);
			obj.sizeDelta = new Vector2(0f, 4f);
			((Graphic)val.AddComponent<Image>()).color = new Color(0.05f, 0.05f, 0.12f, 0.8f);
			val.SetActive(false);
			_durationTimerRoots[slotIndex] = val;
			GameObject val2 = new GameObject("Fill");
			val2.transform.SetParent(val.transform, false);
			RectTransform obj2 = val2.AddComponent<RectTransform>();
			obj2.anchorMin = Vector2.zero;
			obj2.anchorMax = Vector2.one;
			obj2.offsetMin = new Vector2(1f, 1f);
			obj2.offsetMax = new Vector2(-1f, -1f);
			Image val3 = val2.AddComponent<Image>();
			((Graphic)val3).color = new Color(0.3f, 0.5f, 1f, 0.9f);
			_durationTimerFills[slotIndex] = val3;
		}

		private static void BuildWardHPBar(Transform slotTransform, int slotIndex)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Expected O, but got Unknown
			//IL_0029: 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_0053: 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_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_00d5: 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_00e7: 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_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)
			GameObject val = new GameObject("WardHP");
			val.transform.SetParent(slotTransform, false);
			RectTransform obj = val.AddComponent<RectTransform>();
			obj.anchorMin = new Vector2(0f, 1f);
			obj.anchorMax = new Vector2(1f, 1f);
			obj.pivot = new Vector2(0.5f, 0f);
			obj.anchoredPosition = new Vector2(0f, 7f);
			obj.sizeDelta = new Vector2(0f, 6f);
			((Graphic)val.AddComponent<Image>()).color = new Color(0.05f, 0.05f, 0.12f, 0.8f);
			val.SetActive(false);
			_wardHPRoots[slotIndex] = val;
			GameObject val2 = new GameObject("Fill");
			val2.transform.SetParent(val.transform, false);
			RectTransform obj2 = val2.AddComponent<RectTransform>();
			obj2.anchorMin = Vector2.zero;
			obj2.anchorMax = Vector2.one;
			obj2.offsetMin = new Vector2(1f, 1f);
			obj2.offsetMax = new Vector2(-1f, -1f);
			Image val3 = val2.AddComponent<Image>();
			((Graphic)val3).color = new Color(0.3f, 0.6f, 1f, 0.95f);
			_wardHPFills[slotIndex] = val3;
		}

		private static void BuildOverchargeBar(Transform slotTransform, int slotIndex)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Expected O, but got Unknown
			//IL_0029: 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_0053: 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_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_00d5: 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_00e7: 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_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)
			GameObject val = new GameObject("OverchargeBar");
			val.transform.SetParent(slotTransform, false);
			RectTransform obj = val.AddComponent<RectTransform>();
			obj.anchorMin = new Vector2(0f, 1f);
			obj.anchorMax = new Vector2(1f, 1f);
			obj.pivot = new Vector2(0.5f, 0f);
			obj.anchoredPosition = new Vector2(0f, 14f);
			obj.sizeDelta = new Vector2(0f, 4f);
			((Graphic)val.AddComponent<Image>()).color = new Color(0.1f, 0.08f, 0.02f, 0.8f);
			val.SetActive(false);
			_overchargeBarRoots[slotIndex] = val;
			GameObject val2 = new GameObject("Fill");
			val2.transform.SetParent(val.transform, false);
			RectTransform obj2 = val2.AddComponent<RectTransform>();
			obj2.anchorMin = Vector2.zero;
			obj2.anchorMax = Vector2.one;
			obj2.offsetMin = new Vector2(1f, 1f);
			obj2.offsetMax = new Vector2(-1f, -1f);
			Image val3 = val2.AddComponent<Image>();
			((Graphic)val3).color = new Color(0.85f, 0.7f, 0.2f, 0.9f);
			_overchargeBarFills[slotIndex] = val3;
		}

		private static void BuildResonancePips(Transform barTransform)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Expected O, but got Unknown
			//IL_0029: 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_0053: 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_007c: 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_00d1: Expected O, but got Unknown
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: 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_0143: 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_0186: 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_019a: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ac: 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_01be: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_020e: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("ResonancePips");
			val.transform.SetParent(barTransform, false);
			RectTransform obj = val.AddComponent<RectTransform>();
			obj.anchorMin = new Vector2(0.5f, 0f);
			obj.anchorMax = new Vector2(0.5f, 0f);
			obj.pivot = new Vector2(0.5f, 1f);
			obj.anchoredPosition = new Vector2(0f, -2f);
			obj.sizeDelta = new Vector2(127f, 10f);
			val.SetActive(false);
			_resonancePipContainer = val;
			_resonancePipRoots = (GameObject[])(object)new GameObject[10];
			_resonancePipFills = (Image[])(object)new Image[10];
			for (int i = 0; i < 10; i++)
			{
				float num = (float)i * 13f;
				GameObject val2 = new GameObject($"Pip{i}");
				val2.transform.SetParent(val.transform, false);
				RectTransform obj2 = val2.AddComponent<RectTransform>();
				obj2.anchorMin = new Vector2(0f, 0.5f);
				obj2.anchorMax = new Vector2(0f, 0.5f);
				obj2.pivot = new Vector2(0f, 0.5f);
				obj2.anchoredPosition = new Vector2(num, 0f);
				obj2.sizeDelta = new Vector2(10f, 10f);
				val2.transform.localRotation = Quaternion.Euler(0f, 0f, 45f);
				((Graphic)val2.AddComponent<Image>()).color = new Color(0.6f, 0.5f, 0.8f, 0.9f);
				GameObject val3 = new GameObject("Fill");
				val3.transform.SetParent(val2.transform, false);
				RectTransform obj3 = val3.AddComponent<RectTransform>();
				obj3.anchorMin = Vector2.zero;
				obj3.anchorMax = Vector2.one;
				obj3.offsetMin = new Vector2(1f, 1f);
				obj3.offsetMax = new Vector2(-1f, -1f);
				Image val4 = val3.AddComponent<Image>();
				((Graphic)val4).color = new Color(0.2f, 0.2f, 0.2f, 0.5f);
				_resonancePipRoots[i] = val2;
				_resonancePipFills[i] = val4;
			}
		}

		private static void BuildPipRow(Transform parent, string name, int count, float pipSize, Color borderColor, Vector2 containerPos, out GameObject container, out GameObject[] roots, out Image[] fills)
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Expected O, but got Unknown
			//IL_003d: 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_0067: 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_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Expected O, but got Unknown
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_0127: Unknown result type (might be due to invalid IL or missing references)
			//IL_0133: Unknown result type (might be due to invalid IL or missing references)
			//IL_0153: Unknown result type (might be due to invalid IL or missing references)
			//IL_0164: Unknown result type (might be due to invalid IL or missing references)
			//IL_0170: Unknown result type (might be due to invalid IL or missing references)
			//IL_0175: Unknown result type (might be due to invalid IL or missing references)
			//IL_0188: Unknown result type (might be due to invalid IL or missing references)
			//IL_018f: Unknown result type (might be due to invalid IL or missing references)
			//IL_019a: Unknown result type (might be due to invalid IL or missing references)
			//IL_01af: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
			float num = pipSize + 3f;
			float num2 = (float)count * pipSize + (float)(count - 1) * 3f;
			GameObject val = new GameObject(name);
			val.transform.SetParent(parent, false);
			RectTransform obj = val.AddComponent<RectTransform>();
			obj.anchorMin = new Vector2(0.5f, 0f);
			obj.anchorMax = new Vector2(0.5f, 0f);
			obj.pivot = new Vector2(0.5f, 1f);
			obj.anchoredPosition = containerPos;
			obj.sizeDelta = new Vector2(num2, pipSize);
			val.SetActive(false);
			container = val;
			roots = (GameObject[])(object)new GameObject[count];
			fills = (Image[])(object)new Image[count];
			for (int i = 0; i < count; i++)
			{
				float num3 = (float)i * num;
				GameObject val2 = new GameObject($"Pip{i}");
				val2.transform.SetParent(val.transform, false);
				RectTransform obj2 = val2.AddComponent<RectTransform>();
				obj2.anchorMin = new Vector2(0f, 0.5f);
				obj2.anchorMax = new Vector2(0f, 0.5f);
				obj2.pivot = new Vector2(0f, 0.5f);
				obj2.anchoredPosition = new Vector2(num3, 0f);
				obj2.sizeDelta = new Vector2(pipSize, pipSize);
				val2.transform.localRotation = Quaternion.Euler(0f, 0f, 45f);
				((Graphic)val2.AddComponent<Image>()).color = borderColor;
				GameObject val3 = new GameObject("Fill");
				val3.transform.SetParent(val2.transform, false);
				RectTransform obj3 = val3.AddComponent<RectTransform>();
				obj3.anchorMin = Vector2.zero;
				obj3.anchorMax = Vector2.one;
				obj3.offsetMin = new Vector2(1f, 1f);
				obj3.offsetMax = new Vector2(-1f, -1f);
				Image val4 = val3.AddComponent<Image>();
				((Graphic)val4).color = new Color(0.2f, 0.2f, 0.2f, 0.5f);
				roots[i] = val2;
				fills[i] = val4;
			}
		}

		private static void BuildZealPips(Transform barTransform)
		{
			//IL_0021: 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)
			BuildPipRow(barTransform, "ZealPips", 10, 10f, new Color(0.8f, 0.65f, 0.15f, 0.9f), new Vector2(0f, -2f), out _zealPipContainer, out _zealPipRoots, out _zealPipFills);
		}

		private static void BuildJudgmentPips(Transform barTransform)
		{
			//IL_0020: 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)
			BuildPipRow(barTransform, "JudgmentPips", 5, 10f, new Color(0.9f, 0.8f, 0.5f, 0.9f), new Vector2(0f, -2f), out _judgmentPipContainer, out _judgmentPipRoots, out _judgmentPipFills);
		}

		private static void BuildArsenalPips(Transform barTransform)
		{
			//IL_0020: 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_0072: 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)
			BuildPipRow(barTransform, "ArsenalHitPips", 4, 8f, new Color(0.7f, 0.75f, 0.8f, 0.9f), new Vector2(0f, -2f), out _arsenalPipContainer, out _arsenalHitPipRoots, out _arsenalHitPipFills);
			BuildPipRow(_arsenalPipContainer.transform, "ArsenalStrikePips", 12, 8f, new Color(0.8f, 0.65f, 0.15f, 0.9f), new Vector2(0f, -12f), out GameObject _, out _arsenalStrikePipRoots, out _arsenalStrikePipFills);
		}

		private static void RefreshZealPips()
		{
			//IL_008f: 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)
			if (_zealPipRoots == null || (Object)(object)_zealPipContainer == (Object)null)
			{
				return;
			}
			bool flag = TalentBonuses.Has("pal_cap3") && DamagePatch.ZealStacks > 0;
			_zealPipContainer.SetActive(flag);
			if (!flag)
			{
				return;
			}
			int zealStacks = DamagePatch.ZealStacks;
			for (int i = 0; i < 10; i++)
			{
				if ((Object)(object)_zealPipFills[i] != (Object)null)
				{
					((Graphic)_zealPipFills[i]).color = ((i < zealStacks) ? new Color(1f, 0.85f, 0.2f, 0.95f) : new Color(0.2f, 0.2f, 0.2f, 0.5f));
				}
			}
		}

		private static void RefreshJudgmentPips()
		{
			//IL_00aa: 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)
			if (_judgmentPipRoots == null || (Object)(object)_judgmentPipContainer == (Object)null)
			{
				return;
			}
			int num = 0;
			int lastMarkedTargetId = DamagePatch.LastMarkedTargetId;
			if (lastMarkedTargetId != 0 && DamagePatch.JudgmentMarks.TryGetValue(lastMarkedTargetId, out (int, float) value))
			{
				(num, _) = value;
			}
			bool flag = TalentBonuses.Has("pal_cap2") && num > 0;
			_judgmentPipContainer.SetActive(flag);
			if (!flag)
			{
				return;
			}
			for (int i = 0; i < 5; i++)
			{
				if ((Object)(object)_judgmentPipFills[i] != (Object)null)
				{
					((Graphic)_judgmentPipFills[i]).color = ((i < num) ? new Color(1f, 0.95f, 0.7f, 0.95f) : new Color(0.2f, 0.2f, 0.2f, 0.5f));
				}
			}
		}

		private static void RefreshArsenalPips()
		{
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_0198: Unknown result type (might be due to invalid IL or missing references)
			//IL_0161: Unknown result type (might be due to invalid IL or missing references)
			//IL_0146: Unknown result type (might be due to invalid IL or missing references)
			if (_arsenalHitPipRoots == null || (Object)(object)_arsenalPipContainer == (Object)null)
			{
				return;
			}
			bool flag = TalentBonuses.Has("pal_cap1") && (DamagePatch.ArsenalHitCount > 0 || DamagePatch.ArsenalBonusStrikes > 0 || DamagePatch.IsAscended);
			_arsenalPipContainer.SetActive(flag);
			if (!flag)
			{
				return;
			}
			int arsenalHitCount = DamagePatch.ArsenalHitCount;
			bool isAscended = DamagePatch.IsAscended;
			for (int i = 0; i < 4; i++)
			{
				if ((Object)(object)_arsenalHitPipFills[i] != (Object)null)
				{
					((Graphic)_arsenalHitPipFills[i]).color = (isAscended ? new Color(1f, 0.9f, 0.3f, 0.7f + 0.3f * Mathf.PingPong(Time.time * 2f, 1f)) : ((i < arsenalHitCount) ? new Color(0.8f, 0.85f, 0.9f, 0.95f) : new Color(0.2f, 0.2f, 0.2f, 0.5f)));
				}
			}
			int arsenalBonusStrikes = DamagePatch.ArsenalBonusStrikes;
			for (int j = 0; j < 12; j++)
			{
				if ((Object)(object)_arsenalStrikePipFills[j] != (Object)null)
				{
					((Graphic)_arsenalStrikePipFills[j]).color = (isAscended ? new Color(1f, 0.9f, 0.3f, 0.7f + 0.3f * Mathf.PingPong(Time.time * 2f, 1f)) : ((j < arsenalBonusStrikes) ? new Color(1f, 0.85f, 0.2f, 0.95f) : new Color(0.2f, 0.2f, 0.2f, 0.5f)));
				}
			}
		}

		private static void BuildDrawer(Transform canvas)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Expected O, but got Unknown
			//IL_003d: 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_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: 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_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: 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_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			_drawer = new GameObject("Drawer");
			_drawer.transform.SetParent(canvas, false);
			RectTransform obj = _drawer.AddComponent<RectTransform>();
			Vector2 val = default(Vector2);
			((Vector2)(ref val))..ctor(0.5f, 0f);
			obj.anchorMax = val;
			obj.anchorMin = val;
			obj.pivot = new Vector2(0.5f, 0f);
			obj.anchoredPosition = new Vector2(400f, 174f);
			obj.sizeDelta = new Vector2(152f, 112f);
			((Graphic)_drawer.AddComponent<Image>()).color = Color.clear;
			_drawer.SetActive(false);
			GameObject val2 = new GameObject("Content");
			val2.transform.SetParent(_drawer.transform, false);
			RectTransform obj2 = val2.AddComponent<RectTransform>();
			obj2.anchorMin = Vector2.zero;
			obj2.anchorMax = Vector2.one;
			val = (obj2.offsetMin = (obj2.offsetMax = Vector2.zero));
			_drawerContent = val2.transform;
		}

		private static void OpenDrawer(int slot)
		{
			//IL_005a: 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_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: 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_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: Expected O, but got Unknown
			//IL_012a: 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_0140: Unknown result type (might be due to invalid IL or missing references)
			//IL_0145: Unknown result type (might be due to invalid IL or missing references)
			//IL_0146: Unknown result type (might be due to invalid IL or missing references)
			//IL_014d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0160: 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_0195: Unknown result type (might be due to invalid IL or missing references)
			//IL_019b: Expected O, but got Unknown
			_drawerSlot = slot;
			RebuildDrawerContent();
			if ((Object)(object)_drawer != (Object)null && (Object)(object)_barRT != (Object)null)
			{
				RectTransform component = _drawer.GetComponent<RectTransform>();
				if ((Object)(object)_slotGOs[slot] != (Object)null)
				{
					RectTransform component2 = _slotGOs[slot].GetComponent<RectTransform>();
					float x = _barRT.sizeDelta.x;
					float y = _barRT.sizeDelta.y;
					float x2 = _barRT.anchoredPosition.x;
					float y2 = _barRT.anchoredPosition.y;
					float num = x2 - x * 0.5f + component2.anchoredPosition.x + 32f;
					float num2 = y2 + y + component2.anchoredPosition.y;
					component.anchoredPosition = new Vector2(num, num2 + 4f);
				}
				if ((Object)(object)_drawerBlocker != (Object)null)
				{
					Object.Destroy((Object)(object)_drawerBlocker);
				}
				_drawerBlocker = new GameObject("DrawerBlocker");
				_drawerBlocker.transform.SetParent(_drawer.transform.parent, false);
				RectTransform obj = _drawerBlocker.AddComponent<RectTransform>();
				obj.anchorMin = Vector2.zero;
				obj.anchorMax = Vector2.one;
				Vector2 offsetMin = (obj.offsetMax = Vector2.zero);
				obj.offsetMin = offsetMin;
				Image val = _drawerBlocker.AddComponent<Image>();
				((Graphic)val).color = Color.clear;
				Button obj2 = _drawerBlocker.AddComponent<Button>();
				((Selectable)obj2).targetGraphic = (Graphic)(object)val;
				ButtonClickedEvent onClick = obj2.onClick;
				object obj3 = <>O.<0>__CloseDrawer;
				if (obj3 == null)
				{
					UnityAction val2 = CloseDrawer;
					<>O.<0>__CloseDrawer = val2;
					obj3 = (object)val2;
				}
				((UnityEvent)onClick).AddListener((UnityAction)obj3);
				_drawerBlocker.transform.SetAsLastSibling();
				_drawer.SetActive(true);
				_drawer.transform.SetAsLastSibling();
			}
		}

		private static void RebuildDrawerContent()
		{
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_0184: Unknown result type (might be due to invalid IL or missing references)
			//IL_0189: Unknown result type (might be due to invalid IL or missing references)
			//IL_019c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a3: Expected O, but got Unknown
			//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01da: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0204: Unknown result type (might be due to invalid IL or missing references)
			//IL_0218: Unknown result type (might be due to invalid IL or missing references)
			//IL_026d: Unknown result type (might be due to invalid IL or missing references)
			//IL_028b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0250: Unknown result type (might be due to invalid IL or missing references)
			//IL_0407: Unknown result type (might be due to invalid IL or missing references)
			//IL_040c: Unknown result type (might be due to invalid IL or missing references)
			//IL_041d: Unknown result type (might be due to invalid IL or missing references)
			//IL_042e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0443: Unknown result type (might be due to invalid IL or missing references)
			//IL_0458: Unknown result type (might be due to invalid IL or missing references)
			//IL_046d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0481: Unknown result type (might be due to invalid IL or missing references)
			//IL_048b: Unknown result type (might be due to invalid IL or missing references)
			//IL_04d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_04fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_050b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0510: Unknown result type (might be due to invalid IL or missing references)
			//IL_0521: Unknown result type (might be due to invalid IL or missing references)
			//IL_0532: Unknown result type (might be due to invalid IL or missing references)
			//IL_0547: Unknown result type (might be due to invalid IL or missing references)
			//IL_055c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0571: Unknown result type (might be due to invalid IL or missing references)
			//IL_0585: Unknown result type (might be due to invalid IL or missing references)
			//IL_058f: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b9: 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_03cb: 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)
			//IL_03ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d1: Expected O, but got Unknown
			//IL_02e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ef: Expected O, but got Unknown
			//IL_0315: Unknown result type (might be due to invalid IL or missing references)
			//IL_031a: 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_0323: Expected O, but got Unknown
			//IL_05d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_05b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0601: Unknown result type (might be due to invalid IL or missing references)
			//IL_0606: Unknown result type (might be due to invalid IL or missing references)
			//IL_060c: Expected O, but got Unknown
			if ((Object)(object)_drawerContent != (Object)null)
			{
				for (int num = _drawerContent.childCount - 1; num >= 0; num--)
				{
					Object.Destroy((Object)(object)((Component)_drawerContent.GetChild(num)).gameObject);
				}
			}
			Player localPlayer = Player.m_localPlayer;
			if ((Object)(object)localPlayer == (Object)null)
			{
				return;
			}
			PlayerData orCreate = RenownSystem.GetOrCreate(localPlayer);
			List<AbilityDef> unlockedAbilities = AbilitySystem.GetUnlockedAbilities(orCreate);
			if (unlockedAbilities.Count == 0)
			{
				return;
			}
			int num2 = Mathf.Clamp((unlockedAbilities.Count + 3 - 1) / 3, 1, 3) - 1;
			_drawer.GetComponent<RectTransform>().sizeDelta = _drawerSizes[num2];
			Sprite panelIcon = IconLoader.GetPanelIcon(num2 switch
			{
				1 => "drawer_back_2", 
				0 => "drawer_back_1", 
				_ => "drawer_back_3", 
			});
			if ((Object)(object)panelIcon != (Object)null)
			{
				GameObject val = new GameObject("Back");
				val.transform.SetParent(_drawerContent, false);
				RectTransform obj = val.AddComponent<RectTransform>();
				obj.anchorMin = Vector2.zero;
				obj.anchorMax = Vector2.one;
				Vector2 offsetMin = (obj.offsetMax = Vector2.zero);
				obj.offsetMin = offsetMin;
				val.AddComponent<Image>().sprite = panelIcon;
				((Graphic)val.GetComponent<Image>()).raycastTarget = false;
				val.transform.SetAsFirstSibling();
			}
			bool isDK = (orCreate?.ChosenSubclass ?? "") == "Death Knight";
			Vector2 val4 = default(Vector2);
			for (int i = 0; i < unlockedAbilities.Count && i < 9; i++)
			{
				string capturedId = unlockedAbilities[i].Id;
				AbilityDef abilityDef = unlockedAbilities[i];
				Vector2 val2 = _drawerSlotCenters[i];
				GameObject val3 = new GameObject($"Icon{i}");
				val3.transform.SetParent(_drawerContent, false);
				RectTransform obj2 = val3.AddComponent<RectTransform>();
				((Vector2)(ref val4))..ctor(0f, 1f);
				obj2.pivot = val4;
				Vector2 offsetMin = (obj2.anchorMax = val4);
				obj2.anchorMin = offsetMin;
				obj2.anchoredPosition = new Vector2(val2.x - 18f, 0f - (val2.y - 18f));
				obj2.sizeDelta = new Vector2(36f, 36f);
				Image val6 = val3.AddComponent<Image>();
				Sprite abilityIcon = IconLoader.GetAbilityIcon(capturedId, isDK);
				if ((Object)(object)abilityIcon != (Object)null)
				{
					val6.sprite = abilityIcon;
					((Graphic)val6).color = Color.white;
				}
				else
				{
					((Graphic)val6).color = new Color(0.2f, 0.2f, 0.2f);
					MakeTxt(val3.transform, "Lbl", abilityDef.Name, 7, Color.white, 0f, 0f, 36f, 36f, (TextAnchor)4);
				}
				Button obj3 = val3.AddComponent<Button>();
				((Selectable)obj3).targetGraphic = (Graphic)(object)val6;
				((UnityEvent)obj3.onClick).AddListener((UnityAction)delegate
				{
					AssignAndClose(_drawerSlot, capturedId);
				});
				EventTrigger obj4 = val3.AddComponent<EventTrigger>();
				AbilityDef defCapture = abilityDef;
				Entry val7 = new Entry
				{
					eventID = (EventTriggerType)0
				};
				((UnityEvent<BaseEventData>)(object)val7.callback).AddListener((UnityAction<BaseEventData>)delegate
				{
					ShowDrawerAbilityTooltip(defCapture);
				});
				obj4.triggers.Add(val7);
				Entry val8 = new Entry
				{
					eventID = (EventTriggerType)1
				};
				((UnityEvent<BaseEventData>)(object)val8.callback).AddListener((UnityAction<BaseEventData>)delegate
				{
					HideTooltip();
				});
				obj4.triggers.Add(val8);
			}
			Sprite panelIcon2 = IconLoader.GetPanelIcon(num2 switch
			{
				1 => "drawer_front_2", 
				0 => "drawer_front_1", 
				_ => "drawer_front_3", 
			});
			if ((Object)(object)panelIcon2 != (Object)null)
			{
				GameObject val9 = new GameObject("Front");
				val9.transform.SetParent(_drawerContent, false);
				RectTransform obj5 = val9.AddComponent<RectTransform>();