Decompiled source of Grimoire v2.42.185

Grimoire.dll

Decompiled 2 weeks ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using System.Text.RegularExpressions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using Grimoire.Models;
using Grimoire.Services;
using Grimoire.UI;
using Grimoire.Utilities;
using HarmonyLib;
using Il2CppInterop.Runtime;
using Il2CppInterop.Runtime.Attributes;
using Il2CppInterop.Runtime.Injection;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppSystem;
using Il2CppSystem.Collections;
using Il2CppSystem.Collections.Generic;
using Il2CppSystem.Reflection;
using Microsoft.CodeAnalysis;
using ProjectM;
using ProjectM.Hybrid;
using ProjectM.Network;
using ProjectM.UI;
using Stunlock.Core;
using TMPro;
using Unity.Collections;
using Unity.Entities;
using Unity.Mathematics;
using Unity.Rendering;
using Unity.Transforms;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Utilities;
using UnityEngine.Rendering;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("Grimoire")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("2.42.185.0")]
[assembly: AssemblyInformationalVersion("2.42.185")]
[assembly: AssemblyProduct("Grimoire")]
[assembly: AssemblyTitle("Grimoire")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("2.42.185.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

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

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

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

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace Grimoire
{
	[BepInPlugin("io.grimoire", "Grimoire", "2.42.185")]
	internal sealed class Plugin : BasePlugin
	{
		internal static ManualLogSource LogSource = null;

		internal static Harmony Harmony = null;

		internal static ConfigEntry<KeyCode> ToggleKey = null;

		internal static ConfigEntry<KeyCode> CombatHudToggleKey = null;

		internal static ConfigEntry<KeyCode> LauncherToggleKey = null;

		internal static ConfigEntry<KeyCode> DpsToggleKey = null;

		internal static ConfigEntry<bool> LauncherVisible = null;

		internal static ConfigEntry<bool> HudEnabled = null;

		internal static ConfigEntry<bool> AutoCollapseHud = null;

		internal static ConfigEntry<float> ClosedRefreshSeconds = null;

		internal static ConfigEntry<float> OpenRefreshSeconds = null;

		internal static ConfigEntry<float> HudScale = null;

		internal static ConfigEntry<float> HudOpacity = null;

		internal static ConfigEntry<float> HudX = null;

		internal static ConfigEntry<float> HudY = null;

		internal static ConfigEntry<float> LauncherX = null;

		internal static ConfigEntry<float> LauncherY = null;

		internal static ConfigEntry<float> GrimoireWindowX = null;

		internal static ConfigEntry<float> GrimoireWindowY = null;

		internal static ConfigEntry<float> VoidfallWindowX = null;

		internal static ConfigEntry<float> VoidfallWindowY = null;

		internal static ConfigEntry<float> PerkShopWindowX = null;

		internal static ConfigEntry<float> PerkShopWindowY = null;

		internal static ConfigEntry<float> InvitePopupX = null;

		internal static ConfigEntry<float> InvitePopupY = null;

		internal static ConfigEntry<float> ReadyPopupX = null;

		internal static ConfigEntry<float> ReadyPopupY = null;

		internal static ConfigEntry<float> TrialPopupX = null;

		internal static ConfigEntry<float> TrialPopupY = null;

		internal static ConfigEntry<float> DpsX = null;

		internal static ConfigEntry<float> DpsY = null;

		internal static ConfigEntry<float> PartyDpsX = null;

		internal static ConfigEntry<float> PartyDpsY = null;

		internal static ConfigEntry<bool> ReducedMotion = null;

		internal static ConfigEntry<bool> HighContrast = null;

		internal static ConfigEntry<bool> LargeText = null;

		internal static ConfigEntry<bool> ShowNameplateTitles = null;

		internal static ConfigEntry<bool> ShowOverheadWorldTitles = null;

		internal static ConfigEntry<bool> ShowLocalNameplateTitle = null;

		internal static ConfigEntry<bool> ShowTargetPanelTitles = null;

		internal static ConfigEntry<string> NameplateTitleColor = null;

		internal static ConfigEntry<bool> UseTitleCategoryColors = null;

		internal static ConfigEntry<bool> EnableTitleGlow = null;

		internal static ConfigEntry<bool> GoldTitleGlow = null;

		internal static ConfigEntry<bool> HeirOfTheFallenGlow = null;

		internal static ConfigEntry<bool> HeirOfTheFallenPulse = null;

		internal static ConfigEntry<float> TitleGlowIntensity = null;

		internal static ConfigEntry<float> TitleGlowScale = null;

		internal static ConfigEntry<bool> EnableVoidfallVisuals = null;

		internal static ConfigEntry<bool> HideVoidfallTravelPrompt = null;

		internal static ConfigEntry<float> VoidfallGlowIntensity = null;

		internal static ConfigEntry<float> VoidfallEffectRadius = null;

		internal static ConfigEntry<float> WeaponAuraScale = null;

		internal static ConfigEntry<float> WeaponAuraRightOffset = null;

		internal static ConfigEntry<float> WeaponAuraUpOffset = null;

		internal static ConfigEntry<float> WeaponAuraForwardOffset = null;

		internal static ConfigEntry<string> MaskProfileGameVersion = null;

		internal static ConfigEntry<string> WeaponAuraVoidColor = null;

		internal static ConfigEntry<string> WeaponAuraBodyColor = null;

		internal static ConfigEntry<float> WeaponAuraEmissionIntensity = null;

		internal static ConfigEntry<bool> WeaponAuraDiagnostics = null;

		internal static ConfigEntry<string> WeaponAuraCertifications = null;

		private static GameObject? _host;

		private static GrimoireUiHost? _ui;

		private static VoidfallUiHost? _voidfallUi;

		private static PerkShopUiHost? _perkShopUi;

		private static ActivityPopupUiHost? _activityPopups;

		private static DamageMeterUiHost? _damageMeterUi;

		private static string _lastWeaponAuraError = "";

		private static int _lastUiTickFrame = -1;

		private bool _loaded;

		internal static bool IsUiOpen
		{
			get
			{
				if ((Object)(object)_ui != (Object)null)
				{
					return _ui.IsOpen;
				}
				return false;
			}
		}

		internal static bool IsPointerOverLauncherStrip => _ui?.IsPointerOverLauncherStrip ?? false;

		internal static bool IsVoidfallTextInputFocused => _voidfallUi?.IsTextInputFocused ?? false;

		internal static bool IsPointerOverUiPanel
		{
			get
			{
				if ((!((Object)(object)_ui != (Object)null) || !_ui.IsPointerOverPanel) && (!((Object)(object)_voidfallUi != (Object)null) || !_voidfallUi.IsPointerOverPanel) && (!((Object)(object)_perkShopUi != (Object)null) || !_perkShopUi.IsPointerOverPanel))
				{
					if ((Object)(object)_damageMeterUi != (Object)null)
					{
						return _damageMeterUi.IsPointerOverPanel;
					}
					return false;
				}
				return true;
			}
		}

		public override void Load()
		{
			//IL_00d8: 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_090d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0917: Expected O, but got Unknown
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: Invalid comparison between Unknown and I4
			//IL_011d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: Expected O, but got Unknown
			//IL_0137: Unknown result type (might be due to invalid IL or missing references)
			//IL_0152: Unknown result type (might be due to invalid IL or missing references)
			LogSource = ((BasePlugin)this).Log;
			if (Application.productName == "VRisingServer")
			{
				return;
			}
			MigrateLegacyConfig();
			ToggleKey = ((BasePlugin)this).Config.Bind<KeyCode>("Interface", "ToggleKey", (KeyCode)288, "Key used to open or close Grimoire.");
			CombatHudToggleKey = ((BasePlugin)this).Config.Bind<KeyCode>("Interface", "CombatHudToggleKey", (KeyCode)289, "Legacy combat-HUD shortcut setting; the Combat HUD button remains available, while F8 now toggles the launcher strip.");
			LauncherToggleKey = ((BasePlugin)this).Config.Bind<KeyCode>("Interface", "LauncherToggleKey", (KeyCode)289, "Key used to hide or show the entire Grimoire, Combat HUD, and Voidfall launcher strip.");
			DpsToggleKey = ((BasePlugin)this).Config.Bind<KeyCode>("Interface", "DpsToggleKey", (KeyCode)290, "Show or hide the personal DPS meter.");
			LauncherVisible = ((BasePlugin)this).Config.Bind<bool>("Interface", "LauncherVisible", true, "Whether the unified three-button launcher strip is visible in the world.");
			if (ToggleKey.Value == LauncherToggleKey.Value)
			{
				ToggleKey.Value = (KeyCode)(((int)LauncherToggleKey.Value == 288) ? 287 : 288);
				ManualLogSource logSource = LogSource;
				bool flag = default(bool);
				BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(80, 2, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Grimoire panel shortcut moved to ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<KeyCode>(ToggleKey.Value);
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" so ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<KeyCode>(LauncherToggleKey.Value);
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" can exclusively toggle the launcher strip.");
				}
				logSource.LogInfo(val);
			}
			HudEnabled = ((BasePlugin)this).Config.Bind<bool>("Interface", "HudEnabled", true, "Show the compact equipped-relic HUD.");
			AutoCollapseHud = ((BasePlugin)this).Config.Bind<bool>("Interface", "AutoCollapseHud", true, "Collapse the combat HUD while no relic event, cooldown, or proc activity is present.");
			ClosedRefreshSeconds = ((BasePlugin)this).Config.Bind<float>("Bridge", "ClosedRefreshSecondsV2", 10f, "Idle refresh interval while the panel is closed, clamped to 5–20 seconds. An active relic HUD refreshes at least every 5 seconds; opening the panel or taking an action refreshes promptly.");
			OpenRefreshSeconds = ((BasePlugin)this).Config.Bind<float>("Bridge", "OpenRefreshSeconds", 2f, "State refresh interval while the panel is open.");
			HudScale = ((BasePlugin)this).Config.Bind<float>("Appearance", "HudScale", 1f, "Combat HUD scale from 0.7 to 1.4.");
			HudOpacity = ((BasePlugin)this).Config.Bind<float>("Appearance", "HudOpacity", 0.9f, "Combat HUD background opacity from 0.25 to 1.0.");
			HudX = ((BasePlugin)this).Config.Bind<float>("Appearance", "HudX", 24f, "Combat HUD horizontal position at 1920x1080 reference resolution.");
			HudY = ((BasePlugin)this).Config.Bind<float>("Appearance", "HudY", -70f, "Combat HUD vertical position at 1920x1080 reference resolution.");
			LauncherX = ((BasePlugin)this).Config.Bind<float>("Appearance", "LauncherX", 24f, "Unified launcher-strip horizontal position at 1920x1080 reference resolution. Drag its grip to move it.");
			LauncherY = ((BasePlugin)this).Config.Bind<float>("Appearance", "LauncherY", -24f, "Unified launcher-strip vertical position at 1920x1080 reference resolution. Drag its grip to move it.");
			GrimoireWindowX = ((BasePlugin)this).Config.Bind<float>("Appearance", "GrimoireWindowX", 0f, "Grimoire menu horizontal offset from screen center; drag its header grip to move it.");
			GrimoireWindowY = ((BasePlugin)this).Config.Bind<float>("Appearance", "GrimoireWindowY", 0f, "Grimoire menu vertical offset from screen center.");
			VoidfallWindowX = ((BasePlugin)this).Config.Bind<float>("Appearance", "VoidfallWindowX", 0f, "Voidfall menu horizontal offset from screen center; drag its header grip to move it.");
			VoidfallWindowY = ((BasePlugin)this).Config.Bind<float>("Appearance", "VoidfallWindowY", 0f, "Voidfall menu vertical offset from screen center.");
			PerkShopWindowX = ((BasePlugin)this).Config.Bind<float>("Appearance", "PerkShopWindowX", 0f, "PerkShop menu horizontal offset from screen center; drag its header grip to move it.");
			PerkShopWindowY = ((BasePlugin)this).Config.Bind<float>("Appearance", "PerkShopWindowY", 0f, "PerkShop menu vertical offset from screen center.");
			InvitePopupX = ((BasePlugin)this).Config.Bind<float>("Appearance", "InvitePopupX", 550f, "Abyss party invite popup horizontal offset; drag its three-dot grip to move it.");
			InvitePopupY = ((BasePlugin)this).Config.Bind<float>("Appearance", "InvitePopupY", 250f, "Abyss party invite popup vertical offset.");
			ReadyPopupX = ((BasePlugin)this).Config.Bind<float>("Appearance", "ReadyPopupX", 550f, "Abyss ready-check popup horizontal offset; drag its three-dot grip to move it.");
			ReadyPopupY = ((BasePlugin)this).Config.Bind<float>("Appearance", "ReadyPopupY", 15f, "Abyss ready-check popup vertical offset.");
			TrialPopupX = ((BasePlugin)this).Config.Bind<float>("Appearance", "TrialPopupX", 550f, "Relic Trial popup horizontal offset; drag its three-dot grip to move it.");
			TrialPopupY = ((BasePlugin)this).Config.Bind<float>("Appearance", "TrialPopupY", -245f, "Relic Trial popup vertical offset.");
			DpsX = ((BasePlugin)this).Config.Bind<float>("Appearance", "DpsX", -24f, "Personal DPS meter horizontal offset from the upper right corner.");
			DpsY = ((BasePlugin)this).Config.Bind<float>("Appearance", "DpsY", -165f, "Personal DPS meter vertical offset from the upper right corner.");
			PartyDpsX = ((BasePlugin)this).Config.Bind<float>("Appearance", "PartyDpsX", -24f, "Abyss party DPS panel horizontal offset from the upper right corner.");
			PartyDpsY = ((BasePlugin)this).Config.Bind<float>("Appearance", "PartyDpsY", -425f, "Abyss party DPS panel vertical offset from the upper right corner.");
			ReducedMotion = ((BasePlugin)this).Config.Bind<bool>("Accessibility", "ReducedMotion", false, "Disable pulsing Energy animation.");
			HighContrast = ((BasePlugin)this).Config.Bind<bool>("Accessibility", "HighContrast", false, "Use brighter high-contrast combat colors.");
			LargeText = ((BasePlugin)this).Config.Bind<bool>("Accessibility", "LargeText", false, "Increase combat HUD text size.");
			ShowNameplateTitles = ((BasePlugin)this).Config.Bind<bool>("Titles", "ShowNameplateTitles", true, "Show equipped Reliquary titles beneath online player names in the world.");
			ShowOverheadWorldTitles = ((BasePlugin)this).Config.Bind<bool>("Titles", "ShowOverheadWorldTitlesV3", true, "Show equipped Reliquary titles as independent overlays above vanilla player names. This does not patch or modify V Rising's name components.");
			ShowLocalNameplateTitle = ((BasePlugin)this).Config.Bind<bool>("Titles", "ShowLocalNameplateTitle", true, "Show your own equipped title when your local nameplate is visible.");
			ShowTargetPanelTitles = ((BasePlugin)this).Config.Bind<bool>("Titles", "ShowTargetHoverTitles", true, "Show equipped Reliquary titles beneath player names in the top target-hover panel.");
			NameplateTitleColor = ((BasePlugin)this).Config.Bind<string>("Titles", "NameplateTitleColor", "D9B45B", "Six-digit RGB color used for overhead titles, without #.");
			UseTitleCategoryColors = ((BasePlugin)this).Config.Bind<bool>("Titles", "UseTitleCategoryColors", true, "Use the same achievement-category colors as the Hall of Titles; false uses NameplateTitleColor for every title.");
			EnableTitleGlow = ((BasePlugin)this).Config.Bind<bool>("TitleVisuals", "EnableTitleGlow", true, "Enable cached client-side glow layers for prestigious Reliquary titles.");
			GoldTitleGlow = ((BasePlugin)this).Config.Bind<bool>("TitleVisuals", "GoldTitleGlow", true, "Give Gold rarity titles a subtle static warm-gold aura.");
			HeirOfTheFallenGlow = ((BasePlugin)this).Config.Bind<bool>("TitleVisuals", "HeirOfTheFallenGlow", true, "Enable prestigious title glow for Heir of the Fallen and The Living Reliquary. The latter uses a distinct aurora-teal palette.");
			HeirOfTheFallenPulse = ((BasePlugin)this).Config.Bind<bool>("TitleVisuals", "HeirOfTheFallenPulse", true, "Use the same restrained slow pulse on prestigious title glows, including The Living Reliquary.");
			TitleGlowIntensity = ((BasePlugin)this).Config.Bind<float>("TitleVisuals", "TitleGlowIntensity", 1f, "Glow opacity multiplier, clamped from 0 to 2.");
			TitleGlowScale = ((BasePlugin)this).Config.Bind<float>("TitleVisuals", "TitleGlowScale", 1f, "Glow expansion multiplier, clamped from 0.5 to 1.5.");
			EnableVoidfallVisuals = ((BasePlugin)this).Config.Bind<bool>("Voidfall", "EnablePortalVisuals", true, "Render tracked purple Voidfall portal effects supplied by the server.");
			HideVoidfallTravelPrompt = ((BasePlugin)this).Config.Bind<bool>("Voidfall", "HideDraculaTravelPrompt", true, "Hide the Dracula travel prompt while near a tracked Voidfall portal.");
			VoidfallGlowIntensity = ((BasePlugin)this).Config.Bind<float>("Voidfall", "PortalGlowIntensity", 2.2f, "Purple point-light intensity for tracked Voidfall portals.");
			VoidfallEffectRadius = ((BasePlugin)this).Config.Bind<float>("Voidfall", "LocalEffectRadius", 85f, "Portal and enemy effects are dormant when the local player is farther than this many world units (30-150).");
			WeaponAuraScale = ((BasePlugin)this).Config.Bind<float>("VoidfallWeaponAura", "Scale", 1.35f, "Local weapon Aura scale, clamped from 0.6 to 2.5.");
			WeaponAuraDiagnostics = ((BasePlugin)this).Config.Bind<bool>("VoidfallWeaponAura", "VerboseDiagnostics", false, "Write detailed weapon-aura renderer and material audits. Enable only while troubleshooting; this can cause client stutter.");
			WeaponAuraRightOffset = ((BasePlugin)this).Config.Bind<float>("VoidfallWeaponAura", "RightOffset", 0.12f, "Player-space right offset used when no exact weapon render transform is available.");
			WeaponAuraUpOffset = ((BasePlugin)this).Config.Bind<float>("VoidfallWeaponAura", "UpOffset", 1.02f, "Player-space height used when no exact weapon render transform is available.");
			WeaponAuraForwardOffset = ((BasePlugin)this).Config.Bind<float>("VoidfallWeaponAura", "ForwardOffset", 0.02f, "Player-space forward offset used when no exact weapon render transform is available.");
			MaskProfileGameVersion = ((BasePlugin)this).Config.Bind<string>("VoidfallWeaponAura", "VerifiedAlphaMaskGameVersion", Application.version, "Game version associated with the manually verified MasterLit alpha profile. A game-version change disables alpha patching until revalidated.");
			VoidfallMaskAlphaService.Initialize();
			WeaponAuraBodyColor = ((BasePlugin)this).Config.Bind<string>("VoidfallWeaponAura", "PurpleBodyColor", "0.12,0.02,0.38", "Private material base RGB; native textures remain unchanged.");
			WeaponAuraVoidColor = ((BasePlugin)this).Config.Bind<string>("VoidfallWeaponAura", "PurpleBodyEmissionColor", "0.175,0.0225,0.5625", "Normalized emission RGB for the detailed-purple profile; separate from the earlier emission-only experiment.");
			WeaponAuraEmissionIntensity = ((BasePlugin)this).Config.Bind<float>("VoidfallWeaponAura", "PurpleBodyEmissionIntensity", 8f, "Surface HDR multiplier, clamped to 4–12. Default produces (1.4,0.18,4.5).");
			WeaponAuraCertifications = ((BasePlugin)this).Config.Bind<string>("VoidfallWeaponAura", "VisualCertifications", "Greatsword=.030;Reaper=.020;Spear=.015;Pistols=.010", "Player-confirmed class expansion values. Admin certification only; never inferred from readback.");
			WeaponAuraProfile.ValidateLegacyRegistry();
			ClassInjector.RegisterTypeInIl2Cpp<GrimoireUiHost>();
			ClassInjector.RegisterTypeInIl2Cpp<VoidfallUiHost>();
			ClassInjector.RegisterTypeInIl2Cpp<PerkShopUiHost>();
			ClassInjector.RegisterTypeInIl2Cpp<ActivityPopupUiHost>();
			ClassInjector.RegisterTypeInIl2Cpp<DamageMeterUiHost>();
			Harmony = new Harmony("io.grimoire");
			Harmony.PatchAll();
			CreateHost();
			_loaded = true;
			((BasePlugin)this).Log.LogInfo((object)"Grimoire 2.42.185 loaded. Master what you've claimed.");
		}

		private static void CreateHost()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Expected O, but got Unknown
			_host = new GameObject("Grimoire.Host");
			Object.DontDestroyOnLoad((Object)(object)_host);
			_ui = _host.AddComponent<GrimoireUiHost>();
			_ui.Initialize();
			_voidfallUi = _host.AddComponent<VoidfallUiHost>();
			_voidfallUi.Initialize();
			_perkShopUi = _host.AddComponent<PerkShopUiHost>();
			_perkShopUi.Initialize();
			_activityPopups = _host.AddComponent<ActivityPopupUiHost>();
			_activityPopups.Initialize();
			_damageMeterUi = _host.AddComponent<DamageMeterUiHost>();
			_damageMeterUi.Initialize();
		}

		internal static void TickUi()
		{
			//IL_0190: Unknown result type (might be due to invalid IL or missing references)
			//IL_0196: Expected O, but got Unknown
			//IL_01ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f4: Expected O, but got Unknown
			//IL_0250: Unknown result type (might be due to invalid IL or missing references)
			//IL_0257: Expected O, but got Unknown
			//IL_0354: Unknown result type (might be due to invalid IL or missing references)
			//IL_035b: Expected O, but got Unknown
			//IL_02f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f8: Expected O, but got Unknown
			int frameCount = Time.frameCount;
			if (_lastUiTickFrame == frameCount)
			{
				return;
			}
			_lastUiTickFrame = frameCount;
			bool flag = default(bool);
			try
			{
				if ((Object)(object)_host == (Object)null || (Object)(object)_ui == (Object)null || (Object)(object)_voidfallUi == (Object)null || (Object)(object)_perkShopUi == (Object)null || (Object)(object)_activityPopups == (Object)null || (Object)(object)_damageMeterUi == (Object)null)
				{
					try
					{
						_activityPopups?.Shutdown();
					}
					catch
					{
					}
					try
					{
						_damageMeterUi?.Shutdown();
					}
					catch
					{
					}
					try
					{
						_voidfallUi?.Shutdown();
					}
					catch
					{
					}
					try
					{
						_perkShopUi?.Shutdown();
					}
					catch
					{
					}
					try
					{
						_ui?.Shutdown();
					}
					catch
					{
					}
					if ((Object)(object)_host != (Object)null)
					{
						Object.Destroy((Object)(object)_host);
					}
					_ui = null;
					_voidfallUi = null;
					_perkShopUi = null;
					_activityPopups = null;
					_damageMeterUi = null;
					_host = null;
					LogSource.LogInfo((object)"Grimoire host was removed during a scene transition; recreating it now.");
					CreateHost();
				}
				_ui.Tick();
				_voidfallUi?.Tick();
				_perkShopUi?.Tick();
				_activityPopups?.Tick();
				_damageMeterUi?.Tick();
				VoidfallKeyboardCaptureService.Tick(_voidfallUi?.IsTextInputFocused ?? false);
			}
			catch (Exception ex)
			{
				ManualLogSource logSource = LogSource;
				BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(18, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("UI update failed: ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<Exception>(ex);
				}
				logSource.LogError(val);
			}
			try
			{
				VoidfallVisualPerformanceService.Measure("titles", delegate
				{
					NameplateTitleService.Tick();
				}, 16);
			}
			catch (Exception ex2)
			{
				ManualLogSource logSource2 = LogSource;
				BepInExDebugLogInterpolatedStringHandler val2 = new BepInExDebugLogInterpolatedStringHandler(32, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Nameplate title update skipped: ");
					((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(ex2.Message);
				}
				logSource2.LogDebug(val2);
			}
			try
			{
				VoidfallVisualPerformanceService.Measure("visual tick", VoidfallVisualService.Tick, 16);
			}
			catch (Exception ex3)
			{
				ManualLogSource logSource3 = LogSource;
				BepInExDebugLogInterpolatedStringHandler val2 = new BepInExDebugLogInterpolatedStringHandler(32, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Voidfall visual update skipped: ");
					((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(ex3.Message);
				}
				logSource3.LogDebug(val2);
			}
			try
			{
				VoidfallVisualPerformanceService.Measure("weapon aura local", VoidfallWeaponAuraService.Tick, 16);
			}
			catch (Exception ex4)
			{
				VoidfallWeaponAuraService.Clear();
				string text = ex4.GetType().Name + ":" + ex4.Message;
				if (text != _lastWeaponAuraError)
				{
					_lastWeaponAuraError = text;
					ManualLogSource logSource4 = LogSource;
					BepInExWarningLogInterpolatedStringHandler val3 = new BepInExWarningLogInterpolatedStringHandler(29, 1, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("[WeaponAura Runtime Failure] ");
						((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<Exception>(ex4);
					}
					logSource4.LogWarning(val3);
				}
			}
			try
			{
				VoidfallVisualPerformanceService.Measure("weapon aura remote", VoidfallRemoteWeaponAuraService.Tick, 16);
			}
			catch (Exception ex5)
			{
				VoidfallRemoteWeaponAuraService.Clear();
				ManualLogSource logSource5 = LogSource;
				BepInExDebugLogInterpolatedStringHandler val2 = new BepInExDebugLogInterpolatedStringHandler(44, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Voidfall remote weapon aura update skipped: ");
					((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(ex5.Message);
				}
				logSource5.LogDebug(val2);
			}
		}

		internal static void ToggleVoidfall()
		{
			_voidfallUi?.ToggleWindow();
		}

		internal static void TogglePerkShop()
		{
			_perkShopUi?.ToggleWindow();
		}

		internal static void ToggleDps()
		{
			_damageMeterUi?.TogglePersonal();
		}

		private void MigrateLegacyConfig()
		{
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Expected O, but got Unknown
			try
			{
				string text = Path.Combine(Paths.ConfigPath, "io.grimoire.cfg");
				string text2 = Path.Combine(Paths.ConfigPath, "io.vrelics.ui.cfg");
				if (!File.Exists(text) && File.Exists(text2))
				{
					File.Copy(text2, text, overwrite: false);
					((BasePlugin)this).Config.Reload();
					LogSource.LogInfo((object)"Copied legacy VRelicsUI settings into Grimoire. The old config was left unchanged.");
				}
			}
			catch (Exception ex)
			{
				ManualLogSource logSource = LogSource;
				bool flag = default(bool);
				BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(34, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Grimoire config migration failed: ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.Message);
				}
				logSource.LogWarning(val);
			}
		}

		public override bool Unload()
		{
			if (!_loaded)
			{
				return true;
			}
			Harmony harmony = Harmony;
			if (harmony != null)
			{
				harmony.UnpatchSelf();
			}
			CommandService.Reset();
			RelicStateService.Reset();
			NameplateTitleService.Reset();
			VoidfallVisualService.Reset();
			VoidfallMapIconService.Shutdown();
			VoidfallWeaponAuraService.Shutdown();
			VoidfallRemoteWeaponAuraService.Clear();
			VoidfallMaskAlphaService.Shutdown();
			VoidfallStateService.Reset();
			DamageMeterService.Reset();
			PerkShopStateService.Reset();
			VoidfallKeyboardCaptureService.Release();
			_voidfallUi?.Shutdown();
			_perkShopUi?.Shutdown();
			_activityPopups?.Shutdown();
			_damageMeterUi?.Shutdown();
			_ui?.Shutdown();
			if ((Object)(object)_host != (Object)null)
			{
				Object.Destroy((Object)(object)_host);
			}
			_ui = null;
			_voidfallUi = null;
			_perkShopUi = null;
			_activityPopups = null;
			_damageMeterUi = null;
			_host = null;
			_lastUiTickFrame = -1;
			_loaded = false;
			return true;
		}
	}
}
namespace Grimoire.Utilities
{
	internal static class EntityExtensions
	{
		internal static bool Has<T>(this Entity e, EntityManager em) where T : struct
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			if (e != Entity.Null && ((EntityManager)(ref em)).Exists(e))
			{
				return ((EntityManager)(ref em)).HasComponent<T>(e);
			}
			return false;
		}

		internal static T Read<T>(this Entity e, EntityManager em) where T : struct
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			return ((EntityManager)(ref em)).GetComponentData<T>(e);
		}
	}
}
namespace Grimoire.UI
{
	internal sealed class ActivityPopupUiHost : MonoBehaviour
	{
		private sealed class PopupPanel
		{
			internal GameObject Root;

			internal GameObject Grip;

			internal GameObject Primary;

			internal GameObject Secondary;

			internal Text Body;

			internal Text PrimaryLabel;

			internal ConfigEntry<float> X;

			internal ConfigEntry<float> Y;

			internal bool Dragging;

			internal Vector2 LastPointer;
		}

		private Canvas? _canvas;

		private PopupPanel? _invitePanel;

		private PopupPanel? _readyPanel;

		private PopupPanel? _trialPanel;

		private readonly Queue<(AbyssInvitePopupUiState Invite, float Until)> _inviteQueue = new Queue<(AbyssInvitePopupUiState, float)>();

		private readonly HashSet<string> _seenInvites = new HashSet<string>(StringComparer.Ordinal);

		private readonly HashSet<string> _seenReady = new HashSet<string>(StringComparer.Ordinal);

		private readonly HashSet<string> _seenTrials = new HashSet<string>(StringComparer.Ordinal);

		private AbyssInvitePopupUiState? _invite;

		private AbyssReadyPopupUiState? _ready;

		private string _trialKey = "";

		private string _trialName = "";

		private string _trialTargets = "";

		private string _trialDeadline = "";

		private string _lastTrialStatus = "";

		private float _inviteUntil;

		private float _readyUntil;

		private float _readyRetryAt;

		private float _nextCountdown;

		private int _inviteRevisionAtReceive;

		private int _readyRevisionAtReceive;

		private long _trialSequenceAtStart;

		private bool _readyClicked;

		private bool _readyConfirmed;

		internal void Initialize()
		{
			Build();
			VoidfallStateService.InvitePopupReceived += OnInvite;
			VoidfallStateService.ReadyPopupReceived += OnReady;
			VoidfallStateService.Changed += OnVoidfallChanged;
			RelicStateService.ActionMessageReceived += OnRelicAction;
			RelicStateService.Changed += OnRelicChanged;
			OnRelicChanged();
		}

		internal void Shutdown()
		{
			VoidfallStateService.InvitePopupReceived -= OnInvite;
			VoidfallStateService.ReadyPopupReceived -= OnReady;
			VoidfallStateService.Changed -= OnVoidfallChanged;
			RelicStateService.ActionMessageReceived -= OnRelicAction;
			RelicStateService.Changed -= OnRelicChanged;
			_inviteQueue.Clear();
			_seenInvites.Clear();
			_seenReady.Clear();
			_seenTrials.Clear();
			if ((Object)(object)_canvas != (Object)null)
			{
				Object.Destroy((Object)(object)((Component)_canvas).gameObject);
			}
			_canvas = null;
			_invitePanel = (_readyPanel = (_trialPanel = null));
		}

		internal void Tick()
		{
			Drag(_invitePanel);
			Drag(_readyPanel);
			Drag(_trialPanel);
			if (_invite == null && _ready == null)
			{
				return;
			}
			float unscaledTime = Time.unscaledTime;
			if (unscaledTime < _nextCountdown)
			{
				return;
			}
			_nextCountdown = unscaledTime + 1f;
			if (_invite != null)
			{
				if (unscaledTime >= _inviteUntil)
				{
					CloseInvite();
				}
				else
				{
					RenderInvite();
				}
			}
			if (_ready == null)
			{
				return;
			}
			if (unscaledTime >= _readyUntil)
			{
				CloseReady();
				return;
			}
			if (_readyClicked && !_readyConfirmed && unscaledTime >= _readyRetryAt)
			{
				_readyClicked = false;
			}
			RenderReady();
		}

		private static void Drag(PopupPanel? popup)
		{
			if (popup != null)
			{
				WindowDrag.Update(popup.Root, popup.Grip, ref popup.Dragging, ref popup.LastPointer, popup.X, popup.Y);
			}
		}

		private void Build()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Expected O, but got Unknown
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("Grimoire.ActivityPopups");
			_canvas = val.AddComponent<Canvas>();
			val.AddComponent<CanvasScaler>();
			val.AddComponent<GraphicRaycaster>();
			_canvas.renderMode = (RenderMode)0;
			_canvas.overrideSorting = true;
			_canvas.sortingOrder = 32767;
			CanvasScaler component = val.GetComponent<CanvasScaler>();
			component.uiScaleMode = (ScaleMode)1;
			component.referenceResolution = new Vector2(1920f, 1080f);
			component.screenMatchMode = (ScreenMatchMode)1;
			Object.DontDestroyOnLoad((Object)(object)val);
			_invitePanel = CreatePanel("ABYSS PARTY INVITE", 420f, 180f, Plugin.InvitePopupX, Plugin.InvitePopupY, AcceptInvite, DeclineInvite, CloseInvite);
			_readyPanel = CreatePanel("ABYSS READY CHECK", 440f, 210f, Plugin.ReadyPopupX, Plugin.ReadyPopupY, ReadyUp, CloseReady, CloseReady);
			_trialPanel = CreatePanel("RELIC TRIAL TARGETS", 460f, 260f, Plugin.TrialPopupX, Plugin.TrialPopupY, CloseTrial, CloseTrial, CloseTrial);
			_readyPanel.Secondary.GetComponentInChildren<Text>().text = "DISMISS";
			_trialPanel.Secondary.SetActive(false);
		}

		private PopupPanel CreatePanel(string title, float width, float height, ConfigEntry<float> x, ConfigEntry<float> y, Action primary, Action secondary, Action close)
		{
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: 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_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_0131: 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_0159: Unknown result type (might be due to invalid IL or missing references)
			//IL_0168: Unknown result type (might be due to invalid IL or missing references)
			//IL_0191: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0216: Unknown result type (might be due to invalid IL or missing references)
			//IL_0225: 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_027d: Unknown result type (might be due to invalid IL or missing references)
			PopupPanel obj = new PopupPanel
			{
				X = x,
				Y = y,
				Root = Box(((Component)_canvas).transform, "Popup." + title, new Vector2(0f, 0f), new Vector2(width, height), new Color(0.035f, 0.018f, 0.065f, 0.98f), new Vector2(0.5f, 0.5f))
			};
			WindowDrag.Restore(obj.Root, x, y);
			Label(obj.Root.transform, title, new Vector2(18f, -14f), new Vector2(width - 95f, 30f), 19, new Color(0.8f, 0.55f, 1f), (TextAnchor)0);
			Button(obj.Root.transform, "×", new Vector2(-17f, -14f), new Vector2(30f, 30f), close, (Vector2?)new Vector2(1f, 1f));
			obj.Grip = Box(obj.Root.transform, "DragGrip", new Vector2(-55f, -14f), new Vector2(30f, 30f), new Color(0.55f, 0.23f, 0.8f, 0.65f), new Vector2(1f, 1f));
			Label(obj.Grip.transform, "⋮", new Vector2(0f, 0f), new Vector2(30f, 30f), 19, Color.white, (TextAnchor)4);
			obj.Body = Label(obj.Root.transform, "", new Vector2(18f, -58f), new Vector2(width - 36f, height - 111f), 15, Color.white, (TextAnchor)0);
			obj.Primary = Button(obj.Root.transform, "ACCEPT", new Vector2(18f, 0f - height + 47f), new Vector2(125f, 32f), primary);
			obj.PrimaryLabel = obj.Primary.GetComponentInChildren<Text>();
			obj.Secondary = Button(obj.Root.transform, "DECLINE", new Vector2(151f, 0f - height + 47f), new Vector2(125f, 32f), secondary);
			obj.Root.SetActive(false);
			return obj;
		}

		private void OnInvite(AbyssInvitePopupUiState invite)
		{
			if (invite.Seconds > 0 && !string.IsNullOrWhiteSpace(invite.Id) && !string.IsNullOrWhiteSpace(invite.Leader) && _seenInvites.Add(invite.Id))
			{
				_inviteQueue.Enqueue((invite, Time.unscaledTime + (float)Math.Min(60, invite.Seconds)));
				if (_invite == null)
				{
					ShowNextInvite();
				}
			}
		}

		private void ShowNextInvite()
		{
			_invite = null;
			while (_inviteQueue.Count > 0)
			{
				(AbyssInvitePopupUiState, float) tuple = _inviteQueue.Dequeue();
				if (!(tuple.Item2 <= Time.unscaledTime))
				{
					_invite = tuple.Item1;
					_inviteUntil = tuple.Item2;
					_inviteRevisionAtReceive = VoidfallStateService.State.AbyssPartyRevision;
					_invitePanel.Root.SetActive(true);
					_invitePanel.Root.transform.SetAsLastSibling();
					RenderInvite();
					return;
				}
			}
			if (_invitePanel != null)
			{
				_invitePanel.Root.SetActive(false);
			}
		}

		private void RenderInvite()
		{
			if (_invite != null && _invitePanel != null)
			{
				int value = Math.Max(0, Mathf.CeilToInt(_inviteUntil - Time.unscaledTime));
				_invitePanel.Body.text = $"<color=#ffca72>{Escape(_invite.Leader)}</color> invited you to an Abyss party.\n\nExpires in <b>{value}s</b>.";
			}
		}

		private void AcceptInvite()
		{
			if (_invite != null)
			{
				CommandService.Send(".abyss partyaccept \"" + _invite.Leader.Replace("\"", string.Empty) + "\"");
				_inviteQueue.Clear();
				CloseInvite();
			}
		}

		private void DeclineInvite()
		{
			if (_invite != null)
			{
				CommandService.Send(".abyss partydecline \"" + _invite.Leader.Replace("\"", string.Empty) + "\"");
				CloseInvite();
			}
		}

		private void CloseInvite()
		{
			_invite = null;
			ShowNextInvite();
		}

		private void OnReady(AbyssReadyPopupUiState ready)
		{
			if (ready.Seconds > 0 && ready.Depth > 0 && !string.IsNullOrWhiteSpace(ready.Id) && _seenReady.Add(ready.Id))
			{
				_ready = ready;
				_readyClicked = (_readyConfirmed = ready.AlreadyReady);
				_readyUntil = Time.unscaledTime + (float)Math.Min(60, ready.Seconds);
				_readyRevisionAtReceive = VoidfallStateService.State.AbyssPartyRevision;
				_readyPanel.Root.SetActive(true);
				_readyPanel.Root.transform.SetAsLastSibling();
				RenderReady();
			}
		}

		private void RenderReady()
		{
			if (_ready != null && _readyPanel != null)
			{
				int value = Math.Max(0, Mathf.CeilToInt(_readyUntil - Time.unscaledTime));
				string value2 = string.Join(", ", _ready.Members.Select(Escape));
				string text = string.Join(", ", _ready.Ready.Select(Escape));
				_readyPanel.Body.text = $"<color=#ffca72>Depth {_ready.Depth}</color> · <b>{value}s</b> remaining\nParty: {value2}\nReady: {((text.Length == 0) ? "None" : text)}";
				_readyPanel.PrimaryLabel.text = (_readyClicked ? "WAITING..." : "READY UP");
				((Selectable)_readyPanel.Primary.GetComponent<Button>()).interactable = !_readyClicked;
			}
		}

		private void ReadyUp()
		{
			if (_ready != null && !_readyClicked)
			{
				_readyClicked = true;
				_readyRetryAt = Time.unscaledTime + 3f;
				CommandService.Send(".abyss ready");
				RenderReady();
			}
		}

		private void CloseReady()
		{
			_ready = null;
			if (_readyPanel != null)
			{
				_readyPanel.Root.SetActive(false);
			}
		}

		private void OnVoidfallChanged()
		{
			VoidfallUiState state = VoidfallStateService.State;
			if (!state.Supported)
			{
				_inviteQueue.Clear();
				_seenInvites.Clear();
				_seenReady.Clear();
				_invite = null;
				CloseReady();
				if (_invitePanel != null)
				{
					_invitePanel.Root.SetActive(false);
				}
				return;
			}
			if (_invite != null && state.AbyssPartyRevision > _inviteRevisionAtReceive && !state.AbyssPartyInvites.Any((string x) => x.Equals(_invite.Leader, StringComparison.OrdinalIgnoreCase)))
			{
				CloseInvite();
			}
			if (_ready != null && state.AbyssPartyRevision > _readyRevisionAtReceive)
			{
				if (state.AbyssReadyDepth == 0 || state.AbyssReadyDepth != _ready.Depth)
				{
					CloseReady();
					return;
				}
				_ready.Ready = state.AbyssReadyNames.ToArray();
				_readyConfirmed = state.AbyssAlreadyReady;
				_readyClicked = _readyConfirmed;
				RenderReady();
			}
		}

		private void OnRelicAction(string message, string severity)
		{
			if (severity.Equals("SUCCESS", StringComparison.OrdinalIgnoreCase) && TryTrialAction(message, out string name, out string targets, out string deadline))
			{
				ShowTrial(name, targets, deadline);
			}
		}

		private void OnRelicChanged()
		{
			string trialStatus = RelicStateService.State.TrialStatus;
			if (!(trialStatus == _lastTrialStatus))
			{
				_lastTrialStatus = trialStatus;
				if (TryTrialStatus(trialStatus, out string name, out string targets, out string deadline))
				{
					ShowTrial(name, targets, deadline);
				}
				else if (_trialKey.Length > 0 && RelicStateService.State.Sequence > _trialSequenceAtStart)
				{
					CloseTrial();
				}
			}
		}

		private void ShowTrial(string name, string targets, string deadline)
		{
			string text = name + "|" + deadline;
			if (_trialKey != text)
			{
				if (!_seenTrials.Add(text))
				{
					return;
				}
				_trialKey = text;
				_trialSequenceAtStart = RelicStateService.State.Sequence;
				_trialPanel.Root.SetActive(true);
				_trialPanel.Root.transform.SetAsLastSibling();
			}
			_trialName = name;
			_trialTargets = targets;
			_trialDeadline = deadline;
			RenderTrial();
		}

		private void RenderTrial()
		{
			if (_trialPanel != null && _trialKey.Length != 0)
			{
				string[] source = _trialTargets.Split(new string[1] { ", " }, StringSplitOptions.RemoveEmptyEntries);
				string value = string.Join("\n", source.Select((string x) => (!x.EndsWith(" [DONE]", StringComparison.Ordinal)) ? ("• " + Escape(x)) : ("<color=#9effb0>✓ " + Escape(x.Substring(0, x.Length - 7)) + "</color>")));
				_trialPanel.Body.text = $"<color=#ffca72>{Escape(_trialName)}</color>\n\n{value}\n\nExpires {_trialDeadline}";
				_trialPanel.PrimaryLabel.text = "CLOSE";
			}
		}

		private void CloseTrial()
		{
			_trialKey = "";
			if (_trialPanel != null)
			{
				_trialPanel.Root.SetActive(false);
			}
		}

		private static bool TryTrialAction(string message, out string name, out string targets, out string deadline)
		{
			name = (targets = (deadline = ""));
			int num = message.IndexOf(" Trial started. Defeat ", StringComparison.OrdinalIgnoreCase);
			if (num <= 0)
			{
				return false;
			}
			int num2 = num + " Trial started. Defeat ".Length;
			int num3 = message.IndexOf(" before ", num2, StringComparison.OrdinalIgnoreCase);
			if (num3 <= num2)
			{
				return false;
			}
			int num4 = num3 + 8;
			int num5 = message.IndexOf(". Keep", num4, StringComparison.OrdinalIgnoreCase);
			if (num5 < 0)
			{
				num5 = message.IndexOf('.', num4);
			}
			name = message.Substring(0, num).Trim();
			int num6 = num2;
			targets = message.Substring(num6, num3 - num6).Trim();
			string text2;
			if (num5 <= num4)
			{
				string text = message;
				num6 = num4;
				text2 = text.Substring(num6, text.Length - num6);
			}
			else
			{
				num6 = num4;
				text2 = message.Substring(num6, num5 - num6);
			}
			deadline = text2.Trim();
			if (name.Length > 0 && targets.Length > 0)
			{
				return deadline.Length > 0;
			}
			return false;
		}

		private static bool TryTrialStatus(string status, out string name, out string targets, out string deadline)
		{
			name = (targets = (deadline = ""));
			int num = status.IndexOf(" Trial: ", StringComparison.OrdinalIgnoreCase);
			int num2 = status.LastIndexOf(". Expires ", StringComparison.OrdinalIgnoreCase);
			if (num <= 0 || num2 <= num)
			{
				return false;
			}
			name = status.Substring(0, num).Trim();
			int num3 = num + 8;
			targets = status.Substring(num3, num2 - num3).Trim();
			string text = status;
			num3 = num2 + 10;
			deadline = text.Substring(num3, text.Length - num3).Trim().TrimEnd('.');
			if (name.Length > 0 && targets.Length > 0)
			{
				return deadline.Length > 0;
			}
			return false;
		}

		private static string Escape(string value)
		{
			return (value ?? "").Replace("&", "&amp;").Replace("<", "&lt;").Replace(">", "&gt;");
		}

		private static GameObject Box(Transform parent, string name, Vector2 pos, Vector2 size, Color color, Vector2 anchor)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Expected O, but got Unknown
			GameObject val = new GameObject(name);
			val.transform.SetParent(parent, false);
			RectTransform obj = val.AddComponent<RectTransform>();
			Vector2 val2 = (obj.pivot = anchor);
			Vector2 anchorMin = (obj.anchorMax = val2);
			obj.anchorMin = anchorMin;
			obj.anchoredPosition = pos;
			obj.sizeDelta = size;
			((Graphic)val.AddComponent<Image>()).color = color;
			return val;
		}

		private static Text Label(Transform parent, string value, Vector2 pos, Vector2 size, int fontSize, Color color, TextAnchor alignment)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("Text");
			val.transform.SetParent(parent, false);
			RectTransform obj = val.AddComponent<RectTransform>();
			Vector2 val2 = default(Vector2);
			((Vector2)(ref val2))..ctor(0f, 1f);
			obj.pivot = val2;
			Vector2 anchorMin = (obj.anchorMax = val2);
			obj.anchorMin = anchorMin;
			obj.anchoredPosition = pos;
			obj.sizeDelta = size;
			Text obj2 = val.AddComponent<Text>();
			obj2.font = Resources.GetBuiltinResource<Font>("Arial.ttf");
			obj2.fontSize = fontSize;
			obj2.text = value;
			((Graphic)obj2).color = color;
			obj2.alignment = alignment;
			obj2.supportRichText = true;
			((Graphic)obj2).raycastTarget = false;
			return obj2;
		}

		private static GameObject Button(Transform parent, string text, Vector2 pos, Vector2 size, Action action, Vector2? anchor = null)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: 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_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = Box(parent, "Button." + text, pos, size, new Color(0.46f, 0.14f, 0.78f, 0.96f), (Vector2)(((??)anchor) ?? new Vector2(0f, 1f)));
			Button obj = val.AddComponent<Button>();
			((Selectable)obj).targetGraphic = (Graphic)(object)val.GetComponent<Image>();
			((UnityEvent)obj.onClick).AddListener(UnityAction.op_Implicit(action));
			Text obj2 = Label(val.transform, text, Vector2.zero, size, 13, Color.white, (TextAnchor)4);
			((Graphic)obj2).rectTransform.anchorMin = Vector2.zero;
			((Graphic)obj2).rectTransform.anchorMax = Vector2.one;
			((Graphic)obj2).rectTransform.pivot = new Vector2(0.5f, 0.5f);
			((Graphic)obj2).rectTransform.anchoredPosition = Vector2.zero;
			((Graphic)obj2).rectTransform.sizeDelta = Vector2.zero;
			return val;
		}
	}
	internal sealed class DamageMeterUiHost : MonoBehaviour
	{
		private Canvas? _canvas;

		private GameObject? _personal;

		private GameObject? _party;

		private GameObject? _personalGrip;

		private GameObject? _partyGrip;

		private Text? _personalBody;

		private Text? _partyBody;

		private bool _showPersonal;

		private bool _partyDismissed;

		private bool _dragPersonal;

		private bool _dragParty;

		private bool _keyHeld;

		private string _seenRun = "";

		private Vector2 _personalPointer;

		private Vector2 _partyPointer;

		private int _renderedRevision = -1;

		private int _sourcePage;

		private DamageMeterService.Fight? _shownFight;

		private float _nextRender;

		internal bool IsPointerOverPanel
		{
			get
			{
				if (!Inside(_personal))
				{
					return Inside(_party);
				}
				return true;
			}
		}

		internal void Initialize()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Expected O, but got Unknown
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			//IL_0153: 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_0192: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_021d: Unknown result type (might be due to invalid IL or missing references)
			//IL_022c: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("Grimoire.DamageMeter");
			_canvas = val.AddComponent<Canvas>();
			val.AddComponent<CanvasScaler>();
			val.AddComponent<GraphicRaycaster>();
			_canvas.renderMode = (RenderMode)0;
			_canvas.overrideSorting = true;
			_canvas.sortingOrder = 32764;
			CanvasScaler component = val.GetComponent<CanvasScaler>();
			component.uiScaleMode = (ScaleMode)1;
			component.referenceResolution = new Vector2(1920f, 1080f);
			component.screenMatchMode = (ScreenMatchMode)1;
			Object.DontDestroyOnLoad((Object)(object)val);
			_personal = Panel("PERSONAL DPS", new Vector2(350f, 245f), Plugin.DpsX.Value, Plugin.DpsY.Value, out _personalGrip, out _personalBody);
			Button(_personal.transform, "×", new Vector2(-35f, -12f), new Vector2(27f, 27f), TogglePersonal);
			Button(_personal.transform, "RESET", new Vector2(-115f, -12f), new Vector2(72f, 27f), delegate
			{
				DamageMeterService.ClearFight();
				_sourcePage = 0;
				Render();
			});
			Button(_personal.transform, "◀", new Vector2(-100f, -212f), new Vector2(30f, 25f), delegate
			{
				_sourcePage = Math.Max(0, _sourcePage - 1);
				Render();
			});
			Button(_personal.transform, "▶", new Vector2(-18f, -212f), new Vector2(30f, 25f), delegate
			{
				_sourcePage++;
				Render();
			});
			_personal.SetActive(false);
			_party = Panel("ABYSS PARTY DPS", new Vector2(390f, 258f), Plugin.PartyDpsX.Value, Plugin.PartyDpsY.Value, out _partyGrip, out _partyBody);
			Button(_party.transform, "×", new Vector2(-35f, -12f), new Vector2(27f, 27f), delegate
			{
				_partyDismissed = true;
				GameObject? party = _party;
				if (party != null)
				{
					party.SetActive(false);
				}
			});
			_party.SetActive(false);
		}

		internal void Shutdown()
		{
			if ((Object)(object)_canvas != (Object)null)
			{
				Object.Destroy((Object)(object)((Component)_canvas).gameObject);
			}
			_canvas = null;
			_personal = (_party = (_personalGrip = (_partyGrip = null)));
			_personalBody = (_partyBody = null);
		}

		internal void TogglePersonal()
		{
			_showPersonal = !_showPersonal;
			if ((Object)(object)_personal != (Object)null)
			{
				_personal.SetActive(_showPersonal);
			}
			_renderedRevision = -1;
		}

		internal void Tick()
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			DamageMeterService.Tick();
			bool key = Input.GetKey(Plugin.DpsToggleKey.Value);
			if (key && !_keyHeld)
			{
				TogglePersonal();
			}
			_keyHeld = key;
			string runId = DamageMeterService.RunId;
			if (runId != _seenRun)
			{
				_seenRun = runId;
				_partyDismissed = false;
				if ((Object)(object)_party != (Object)null)
				{
					_party.SetActive(runId.Length > 0);
				}
				_renderedRevision = -1;
			}
			Drag(_personal, _personalGrip, ref _dragPersonal, ref _personalPointer, Plugin.DpsX, Plugin.DpsY);
			Drag(_party, _partyGrip, ref _dragParty, ref _partyPointer, Plugin.PartyDpsX, Plugin.PartyDpsY);
			if ((Object)(object)_party != (Object)null && !_partyDismissed && runId.Length > 0 && !_party.activeSelf)
			{
				_party.SetActive(true);
			}
			if (!(Time.unscaledTime < _nextRender) || _renderedRevision != DamageMeterService.Revision)
			{
				_nextRender = Time.unscaledTime + 0.4f;
				_renderedRevision = DamageMeterService.Revision;
				Render();
			}
		}

		private void Render()
		{
			if ((Object)(object)_personalBody != (Object)null && _showPersonal)
			{
				DamageMeterService.Fight fight = DamageMeterService.Current ?? DamageMeterService.Last;
				if (fight != _shownFight)
				{
					_shownFight = fight;
					_sourcePage = 0;
				}
				if (fight == null)
				{
					_personalBody.text = "<color=#aaa1af>Waiting for your next hit.\nFamiliars and minions count toward your total.</color>";
				}
				else
				{
					string value = ((DamageMeterService.Current == null) ? "LAST FIGHT" : "LIVE FIGHT");
					int num = Math.Max(1, (fight.Sources.Count + 3) / 4);
					_sourcePage = Math.Clamp(_sourcePage, 0, num - 1);
					IEnumerable<string> values = from x in fight.Sources.OrderByDescending<KeyValuePair<string, DamageMeterService.SourceLine>, double>((KeyValuePair<string, DamageMeterService.SourceLine> x) => x.Value.Damage).Skip(_sourcePage * 4).Take(4)
						select $"<color=#ddd4e5>{((x.Value.EstimatedDamage > 0.0) ? "~ " : "")}{Esc(x.Key)}</color>  <color=#e6b879>{x.Value.Damage:N0}</color>";
					_personalBody.text = $"<color=#c99cec>{value}</color>\n<size=24><b>{fight.Dps(Time.realtimeSinceStartupAsDouble):N0} DPS</b></size>  <color=#aaa1af>{fight.Damage:N0} damage</color>\n<color=#aaa1af>{fight.Duration(Time.realtimeSinceStartupAsDouble):N1}s  •  {fight.Hits} hits  •  {fight.Crits} crits</color>\n" + string.Join("\n", values) + $"\n<color=#817b8c><size=11>Sources {_sourcePage + 1}/{num}  •  ~ recent cast match</size></color>";
				}
			}
			if (!((Object)(object)_partyBody == (Object)null) && !((Object)(object)_party == (Object)null) && _party.activeSelf)
			{
				IReadOnlyList<DamageMeterService.PartyMember> party = DamageMeterService.Party;
				IEnumerable<string> values2 = party.OrderByDescending((DamageMeterService.PartyMember x) => x.Dps).Take(4).Select((DamageMeterService.PartyMember x, int i) => $"<color=#ad87c1>#{i + 1}</color>  <b>{Esc(x.Name)}</b>\n      <color=#e6b879>{x.Dps:N0} DPS</color>  <color=#a9a1af>{x.Damage:N0} total</color>");
				_partyBody.text = $"<color=#ad87c1>LIVE ABYSS RUN</color>\n<size=22><b>{DamageMeterService.PartyDps:N0} DPS</b></size>  <color=#a9a1af>party</color>\n\n" + ((party.Count == 0) ? "<color=#a9a1af>Waiting for party damage reports...</color>" : string.Join("\n", values2)) + "\n<color=#817b8c><size=11>Display only • reported by party clients</size></color>";
			}
		}

		private GameObject Panel(string title, Vector2 size, float x, float y, out GameObject grip, out Text body)
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			//IL_0132: Unknown result type (might be due to invalid IL or missing references)
			//IL_014a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0159: 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_0183: 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_0194: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a7: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = Box(((Component)_canvas).transform, "Panel." + title, new Vector2(x, y), size, new Color(0.035f, 0.025f, 0.053f, 0.95f), new Vector2(1f, 1f));
			Box(val.transform, "Accent", new Vector2(0f, 0f), new Vector2(size.x, 3f), new Color(0.65f, 0.38f, 0.78f), new Vector2(0f, 1f));
			Label(val.transform, title, new Vector2(15f, -13f), new Vector2(size.x - 130f, 26f), 16, new Color(0.83f, 0.64f, 0.95f), (TextAnchor)0);
			grip = Box(val.transform, "DragGrip", new Vector2(-71f, -12f), new Vector2(28f, 27f), new Color(0.25f, 0.17f, 0.32f), new Vector2(1f, 1f));
			Label(grip.transform, "⋮", Vector2.zero, new Vector2(28f, 27f), 17, Color.white, (TextAnchor)4);
			body = Label(val.transform, "", new Vector2(16f, -48f), new Vector2(size.x - 32f, size.y - 57f), 14, Color.white, (TextAnchor)0);
			return val;
		}

		private static bool Inside(GameObject? panel)
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)panel != (Object)null && panel.activeInHierarchy)
			{
				return RectTransformUtility.RectangleContainsScreenPoint(panel.GetComponent<RectTransform>(), Vector2.op_Implicit(Input.mousePosition));
			}
			return false;
		}

		private static void Drag(GameObject? panel, GameObject? grip, ref bool dragging, ref Vector2 last, ConfigEntry<float> x, ConfigEntry<float> y)
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0131: Unknown result type (might be due to invalid IL or missing references)
			//IL_013f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: 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_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)panel == (Object)null || (Object)(object)grip == (Object)null || !panel.activeInHierarchy)
			{
				dragging = false;
				return;
			}
			Vector2 val = Vector2.op_Implicit(Input.mousePosition);
			if (!dragging && Input.GetMouseButtonDown(0) && RectTransformUtility.RectangleContainsScreenPoint(grip.GetComponent<RectTransform>(), val))
			{
				dragging = true;
				last = val;
			}
			if (dragging && Input.GetMouseButton(0))
			{
				RectTransform component = panel.GetComponent<RectTransform>();
				Canvas componentInParent = panel.GetComponentInParent<Canvas>();
				float num = Mathf.Max(0.01f, (componentInParent != null) ? componentInParent.scaleFactor : 1f);
				Vector2 val2 = component.anchoredPosition + (val - last) / num;
				float x2 = val2.x;
				float num2 = (float)(-Screen.width) / num;
				Rect rect = component.rect;
				val2.x = Mathf.Clamp(x2, num2 + ((Rect)(ref rect)).width, 0f);
				float y2 = val2.y;
				float num3 = (float)(-Screen.height) / num;
				rect = component.rect;
				val2.y = Mathf.Clamp(y2, num3 + ((Rect)(ref rect)).height, 0f);
				component.anchoredPosition = val2;
				last = val;
			}
			if (dragging && !Input.GetMouseButton(0))
			{
				dragging = false;
				Vector2 anchoredPosition = panel.GetComponent<RectTransform>().anchoredPosition;
				x.Value = anchoredPosition.x;
				y.Value = anchoredPosition.y;
			}
		}

		private static string Esc(string value)
		{
			return (value ?? "").Replace("&", "&amp;").Replace("<", "&lt;").Replace(">", "&gt;");
		}

		private static GameObject Box(Transform parent, string name, Vector2 pos, Vector2 size, Color color, Vector2 anchor)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Expected O, but got Unknown
			GameObject val = new GameObject(name);
			val.transform.SetParent(parent, false);
			RectTransform obj = val.AddComponent<RectTransform>();
			Vector2 val2 = (obj.pivot = anchor);
			Vector2 anchorMin = (obj.anchorMax = val2);
			obj.anchorMin = anchorMin;
			obj.anchoredPosition = pos;
			obj.sizeDelta = size;
			((Graphic)val.AddComponent<Image>()).color = color;
			return val;
		}

		private static Text Label(Transform parent, string value, Vector2 pos, Vector2 size, int fontSize, Color color, TextAnchor alignment)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("Text");
			val.transform.SetParent(parent, false);
			RectTransform obj = val.AddComponent<RectTransform>();
			Vector2 val2 = default(Vector2);
			((Vector2)(ref val2))..ctor(0f, 1f);
			obj.pivot = val2;
			Vector2 anchorMin = (obj.anchorMax = val2);
			obj.anchorMin = anchorMin;
			obj.anchoredPosition = pos;
			obj.sizeDelta = size;
			Text obj2 = val.AddComponent<Text>();
			obj2.font = Resources.GetBuiltinResource<Font>("Arial.ttf");
			obj2.fontSize = fontSize;
			obj2.text = value;
			((Graphic)obj2).color = color;
			obj2.alignment = alignment;
			obj2.supportRichText = true;
			((Graphic)obj2).raycastTarget = false;
			return obj2;
		}

		private static void Button(Transform parent, string value, Vector2 pos, Vector2 size, Action action)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = Box(parent, "Button." + value, pos, size, new Color(0.15f, 0.1f, 0.19f, 0.98f), new Vector2(1f, 1f));
			Button obj = val.AddComponent<Button>();
			((Selectable)obj).targetGraphic = (Graphic)(object)val.GetComponent<Image>();
			((UnityEvent)obj.onClick).AddListener(UnityAction.op_Implicit(action));
			Text obj2 = Label(val.transform, value, Vector2.zero, size, 13, Color.white, (TextAnchor)4);
			((Graphic)obj2).rectTransform.anchorMin = Vector2.zero;
			((Graphic)obj2).rectTransform.anchorMax = Vector2.one;
			((Graphic)obj2).rectTransform.pivot = new Vector2(0.5f, 0.5f);
			((Graphic)obj2).rectTransform.anchoredPosition = Vector2.zero;
			((Graphic)obj2).rectTransform.sizeDelta = Vector2.zero;
		}
	}
	internal static class GrimoireSkin
	{
		private static Sprite? _ornateSprite;

		private static bool _ornateSpriteUnavailable;

		private static Sprite? _actionSprite;

		private static bool _actionSpriteUnavailable;

		private static Sprite? _voidfallStoneSprite;

		private static bool _voidfallStoneSpriteUnavailable;

		private static Sprite? _perkShopSurfaceSprite;

		private static bool _perkShopSurfaceSpriteUnavailable;

		internal static readonly Color Shell = new Color(0.022f, 0.026f, 0.029f, 0.98f);

		internal static readonly Color Surface = new Color(0.042f, 0.047f, 0.05f, 0.99f);

		internal static readonly Color Raised = new Color(0.066f, 0.067f, 0.064f, 0.99f);

		internal static readonly Color Inactive = new Color(0.078f, 0.08f, 0.079f, 0.98f);

		internal static readonly Color Text = new Color(0.94f, 0.91f, 0.95f, 1f);

		internal static readonly Color Muted = new Color(0.65f, 0.62f, 0.69f, 1f);

		internal static readonly Color Reliquary = new Color(0.7f, 0.48f, 0.82f, 1f);

		internal static readonly Color Voidfall = new Color(0.65f, 0.51f, 0.76f, 1f);

		internal static readonly Color PerkShop = new Color(0.93f, 0.68f, 0.36f, 1f);

		internal static void Window(GameObject panel, float width, float height, Color accent, Color? frameColor = null, Color? headerColor = null)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: 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_011b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_015d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0163: Unknown result type (might be due to invalid IL or missing references)
			//IL_0169: Unknown result type (might be due to invalid IL or missing references)
			//IL_0174: Unknown result type (might be due to invalid IL or missing references)
			//IL_0193: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c4: 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_01d8: 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_0205: Unknown result type (might be due to invalid IL or missing references)
			//IL_020a: Unknown result type (might be due to invalid IL or missing references)
			//IL_022a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0239: Unknown result type (might be due to invalid IL or missing references)
			//IL_023e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0259: 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_026d: Unknown result type (might be due to invalid IL or missing references)
			//IL_028a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0299: Unknown result type (might be due to invalid IL or missing references)
			//IL_029e: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0304: Unknown result type (might be due to invalid IL or missing references)
			//IL_031f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0330: Unknown result type (might be due to invalid IL or missing references)
			//IL_0335: Unknown result type (might be due to invalid IL or missing references)
			//IL_033b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0341: Unknown result type (might be due to invalid IL or missing references)
			//IL_034c: Unknown result type (might be due to invalid IL or missing references)
			//IL_036b: Unknown result type (might be due to invalid IL or missing references)
			//IL_037a: Unknown result type (might be due to invalid IL or missing references)
			//IL_037f: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			Color val = frameColor ?? accent;
			Color val2 = headerColor ?? accent;
			Image component = panel.GetComponent<Image>();
			if (component != null)
			{
				((Graphic)component).color = Shell;
			}
			Border(panel, new Color(val.r, val.g, val.b, 0.82f));
			Rule(panel.transform, "FrameTop", new Vector2(5f, -5f), new Vector2(width - 10f, 2f), new Color(val.r, val.g, val.b, 0.72f));
			Rule(panel.transform, "FrameBottom", new Vector2(5f, 0f - height + 7f), new Vector2(width - 10f, 2f), new Color(val.r, val.g, val.b, 0.61f));
			Rule(panel.transform, "FrameLeft", new Vector2(5f, -5f), new Vector2(2f, height - 12f), new Color(val.r, val.g, val.b, 0.61f));
			Rule(panel.transform, "FrameRight", new Vector2(width - 7f, -5f), new Vector2(2f, height - 12f), new Color(val.r, val.g, val.b, 0.61f));
			Rule(panel.transform, "CornerTL", new Vector2(3f, -3f), new Vector2(25f, 4f), val);
			Rule(panel.transform, "CornerTR", new Vector2(width - 28f, -3f), new Vector2(25f, 4f), val);
			Rule(panel.transform, "CornerBL", new Vector2(3f, 0f - height + 7f), new Vector2(25f, 4f), val);
			Rule(panel.transform, "CornerBR", new Vector2(width - 28f, 0f - height + 7f), new Vector2(25f, 4f), val);
			Rule(panel.transform, "CornerTLDown", new Vector2(3f, -7f), new Vector2(4f, 24f), val);
			Rule(panel.transform, "CornerTRDown", new Vector2(width - 7f, -7f), new Vector2(4f, 24f), val);
			Rule(panel.transform, "CornerBLUp", new Vector2(3f, 0f - height + 31f), new Vector2(4f, 24f), val);
			Rule(panel.transform, "CornerBRUp", new Vector2(width - 7f, 0f - height + 31f), new Vector2(4f, 24f), val);
			Rule(panel.transform, "HeaderRule", new Vector2(20f, -60f), new Vector2(width - 40f, 2f), new Color(val2.r, val2.g, val2.b, 0.84f));
			Rule(panel.transform, "HeaderMark", new Vector2(20f, -18f), new Vector2(4f, 30f), accent);
		}

		internal static GameObject SideRail(GameObject window, float width, float height, Color accent, string product)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0055: 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_0071: 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_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Expected O, but got Unknown
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: 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_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: 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_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_015f: 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_017c: Unknown result type (might be due to invalid IL or missing references)
			//IL_018d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0194: Unknown result type (might be due to invalid IL or missing references)
			//IL_019f: Expected O, but got Unknown
			GameObject val = new GameObject("GrimoireSkin.SideRail");
			val.transform.SetParent(window.transform, false);
			RectTransform obj = val.AddComponent<RectTransform>();
			Vector2 val2 = default(Vector2);
			((Vector2)(ref val2))..ctor(0f, 1f);
			obj.pivot = val2;
			Vector2 anchorMin = (obj.anchorMax = val2);
			obj.anchorMin = anchorMin;
			obj.anchoredPosition = new Vector2(12f, -12f);
			obj.sizeDelta = new Vector2(width, height - 24f);
			((Graphic)val.AddComponent<Image>()).color = new Color(0.027f, 0.03f, 0.032f, 0.99f);
			Border(val, new Color(accent.r, accent.g, accent.b, 0.42f));
			Rule(val.transform, "RailMark", new Vector2(14f, -18f), new Vector2(4f, 32f), accent);
			Rule(val.transform, "RailDivider", new Vector2(12f, -82f), new Vector2(width - 24f, 1f), new Color(accent.r, accent.g, accent.b, 0.35f));
			Label(val.transform, "GRIMOIRE", new Vector2(28f, -18f), new Vector2(width - 40f, 24f), 20, accent);
			Label(val.transform, product.ToUpperInvariant(), new Vector2(28f, -43f), new Vector2(width - 40f, 20f), 11, Muted);
			return val;
		}

		internal static void RailAccent(GameObject rail, Color accent)
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: 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)
			Outline component = rail.GetComponent<Outline>();
			if (component != null)
			{
				((Shadow)component).effectColor = new Color(0.5f, 0.5f, 0.56f, 0.68f);
			}
			foreach (Image componentsInChild in rail.GetComponentsInChildren<Image>(true))
			{
				if (((Object)((Component)componentsInChild).gameObject).name == "GrimoireSkin.RailMark")
				{
					((Graphic)componentsInChild).color = accent;
				}
				else if (((Object)((Component)componentsInChild).gameObject).name == "GrimoireSkin.RailDivider")
				{
					((Graphic)componentsInChild).color = new Color(accent.r, accent.g, accent.b, 0.35f);
				}
			}
			foreach (Text componentsInChild2 in rail.GetComponentsInChildren<Text>(true))
			{
				if (componentsInChild2.text == "GRIMOIRE")
				{
					((Graphic)componentsInChild2).color = accent;
				}
			}
		}

		internal static GameObject ContentRoot(GameObject window, float x, float width, float height)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Expected O, but got Unknown
			GameObject val = new GameObject("GrimoireSkin.ContentRoot");
			val.transform.SetParent(window.transform, false);
			RectTransform obj = val.AddComponent<RectTransform>();
			Vector2 val2 = default(Vector2);
			((Vector2)(ref val2))..ctor(0f, 1f);
			obj.pivot = val2;
			Vector2 anchorMin = (obj.anchorMax = val2);
			obj.anchorMin = anchorMin;
			obj.anchoredPosition = new Vector2(x, 0f);
			obj.sizeDelta = new Vector2(width, height);
			return val;
		}

		internal static void SidebarNavigation(GameObject panel, bool selected, Color accent)
		{
			//IL_00c8: 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_009a: 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_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: 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_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: 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_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			Image component = panel.GetComponent<Image>();
			if (component != null)
			{
				((Graphic)component).color = (selected ? new Color(accent.r * 0.2f, accent.g * 0.17f, accent.b * 0.23f, 0.99f) : new Color(0.055f, 0.044f, 0.069f, 0.97f));
			}
			Transform val = panel.transform.Find("GrimoireSkin.SideMark");
			if ((Object)(object)val == (Object)null)
			{
				Rule(panel.transform, "SideMark", new Vector2(0f, -1f), new Vector2(3f, 32f), accent);
				val = panel.transform.Find("GrimoireSkin.SideMark");
			}
			((Component)val).gameObject.SetActive(selected);
			((Graphic)((Component)val).GetComponent<Image>()).color = accent;
			foreach (Text componentsInChild in panel.GetComponentsInChildren<Text>(true))
			{
				((Graphic)componentsInChild).color = (selected ? Text : Muted);
				componentsInChild.alignment = (TextAnchor)3;
				RectTransform rectTransform = ((Graphic)componentsInChild).rectTransform;
				rectTransform.offsetMin = new Vector2(16f, rectTransform.offsetMin.y);
			}
		}

		internal static void Card(GameObject panel, Color accent)
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			Image component = panel.GetComponent<Image>();
			if (component != null)
			{
				((Graphic)component).color = Surface;
			}
			Border(panel, new Color(accent.r, accent.g, accent.b, 0.32f));
			float x = panel.GetComponent<RectTransform>().sizeDelta.x;
			Rule(panel.transform, "CardRule", new Vector2(1f, -1f), new Vector2(Math.Max(0f, x - 2f), 2f), new Color(accent.r, accent.g, accent.b, 0.54f));
		}

		internal static void Tray(GameObject panel, Color accent)
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			Image component = panel.GetComponent<Image>();
			if (component != null)
			{
				((Graphic)component).color = Raised;
			}
			Border(panel, new Color(accent.r, accent.g, accent.b, 0.36f));
		}

		internal static void ReliquaryCard(GameObject panel)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: 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_0065: Unknown result type (might be due to invalid IL or missing references)
			Card(panel, Reliquary);
			Color effectColor = default(Color);
			((Color)(ref effectColor))..ctor(0.53f, 0.54f, 0.6f, 0.59f);
			Outline component = panel.GetComponent<Outline>();
			if (component != null)
			{
				((Shadow)component).effectColor = effectColor;
			}
			Transform val = panel.transform.Find("GrimoireSkin.CardRule");
			if (val != null)
			{
				((Graphic)((Component)val).GetComponent<Image>()).color = new Color(0.62f, 0.62f, 0.67f, 0.64f);
			}
			Vector2 sizeDelta = panel.GetComponent<RectTransform>().sizeDelta;
			Rule(panel.transform, "CardFoot", new Vector2(4f, 0f - sizeDelta.y + 5f), new Vector2(sizeDelta.x - 8f, 1f), new Color(0.43f, 0.44f, 0.49f, 0.42f));
			Rule(panel.transform, "CardNotch", new Vector2(10f, -3f), new Vector2(42f, 2f), new Color(Reliquary.r, Reliquary.g, Reliquary.b, 0.75f));
		}

		internal static void RiftPanel(GameObject panel)
		{
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: 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_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: 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_011b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			Image component = panel.GetComponent<Image>();
			if (component != null)
			{
				((Graphic)component).color = new Color(0.025f, 0.041f, 0.051f, 0.99f);
			}
			Border(panel, new Color(0.29f, 0.63f, 0.69f, 0.72f));
			Vector2 sizeDelta = panel.GetComponent<RectTransform>().sizeDelta;
			Rule(panel.transform, "RiftTop", new Vector2(8f, -7f), new Vector2(sizeDelta.x - 16f, 2f), new Color(0.34f, 0.75f, 0.82f, 0.72f));
			Rule(panel.transform, "RiftLeft", new Vector2(8f, -10f), new Vector2(3f, sizeDelta.y - 20f), new Color(0.22f, 0.52f, 0.64f, 0.52f));
			Rule(panel.transform, "RiftCorner", new Vector2(sizeDelta.x - 40f, -7f), new Vector2(32f, 3f), new Color(0.65f, 0.39f, 0.88f, 0.85f));
		}

		internal static void VoidfallPanel(GameObject panel)
		{
			//IL_0044: 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_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: 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_0110: 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_0122: 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_014c: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			Image component = panel.GetComponent<Image>();
			if (component != null)
			{
				((Graphic)component).color = new Color(0.083f, 0.084f, 0.096f, 0.99f);
				VoidfallTexture(component);
			}
			Border(panel, new Color(0.48f, 0.5f, 0.56f, 0.78f));
			Vector2 sizeDelta = panel.GetComponent<RectTransform>().sizeDelta;
			Rule(panel.transform, "VoidfallTopGlow", new Vector2(12f, -7f), new Vector2(sizeDelta.x - 24f, 1f), new Color(0.6f, 0.62f, 0.68f, 0.58f));
			Rule(panel.transform, "VoidfallTopCore", new Vector2(22f, -8f), new Vector2(Math.Min(38f, sizeDelta.x - 44f), 2f), new Color(0.68f, 0.52f, 0.77f, 0.78f));
			Rule(panel.transform, "VoidfallFoot", new Vector2(12f, 0f - sizeDelta.y + 8f), new Vector2(sizeDelta.x - 24f, 1f), new Color(0.5f, 0.52f, 0.58f, 0.55f));
		}

		internal static void VoidfallTexture(GameObject panel)
		{
			Image component = panel.GetComponent<Image>();
			if (component != null)
			{
				VoidfallTexture(component);
			}
		}

		internal static void VoidfallInset(GameObject panel)
		{
			Image component = panel.GetComponent<Image>();
			if (component != null)
			{
				VoidfallTexture(component);
			}
		}

		private static void VoidfallTexture(Image image)
		{
			Sprite val = VoidfallStoneSprite();
			if (!((Object)(object)val == (Object)null))
			{
				image.sprite = val;
				image.type = (Type)2;
			}
		}

		private static Sprite? VoidfallStoneSprite()
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Expected O, but got Unknown
			//IL_0190: Unknown result type (might be due to invalid IL or missing references)
			//IL_019f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0145: Unknown result type (might be due to invalid IL or missing references)
			//IL_014a: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)_voidfallStoneSprite != (Object)null || _voidfallStoneSpriteUnavailable)
			{
				return _voidfallStoneSprite;
			}
			try
			{
				Texture2D val = new Texture2D(96, 96, (TextureFormat)4, false);
				((Texture)val).filterMode = (FilterMode)1;
				((Texture)val).wrapMode = (TextureWrapMode)0;
				Color32[] array = (Color32[])(object)new Color32[9216];
				for (int i = 0; i < 96; i++)
				{
					for (int j = 0; j < 96; j++)
					{
						uint num = (uint)(j * 374761393 + i * 668265263);
						num = (num ^ (num >> 13)) * 1274126177;
						int num2 = (int)((num & 0xF) - 8);
						int num3 = (int)((Mathf.Sin((float)j * 0.065f) + Mathf.Sin((float)i * 0.088f) + Mathf.Sin((float)(j + i) * 0.044f)) * 4f);
						int num4 = ((Mathf.Sin((float)j * 0.12f + Mathf.Sin((float)i * 0.075f) * 2.1f) 

GrimoireDraculaAugment.dll

Decompiled 2 weeks ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.UI;

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

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

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

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

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace GrimoireDraculaAugment
{
	[BepInPlugin("io.grimoire.draculaaugment", "Grimoire Dracula Augment", "1.0.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	internal sealed class Plugin : BasePlugin
	{
		private sealed class AugmentWindow
		{
			internal GameObject ParentPanel;

			internal GameObject CardButton;

			internal GameObject Panel;

			internal Text Body;

			internal string Current = string.Empty;

			internal string PendingChoice = string.Empty;
		}

		private static readonly ConditionalWeakTable<object, AugmentWindow> Windows = new ConditionalWeakTable<object, AugmentWindow>();

		private static ManualLogSource _log = null;

		private static MethodInfo _button = null;

		private static MethodInfo _box = null;

		private static MethodInfo _txt = null;

		private static MethodInfo _selected = null;

		private static MethodInfo _send = null;

		private static MethodInfo _scheduleRefresh = null;

		private Harmony? _harmony;

		public override void Load()
		{
			//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ab: Expected O, but got Unknown
			//IL_011b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0125: Expected O, but got Unknown
			//IL_0149: Unknown result type (might be due to invalid IL or missing references)
			//IL_0156: Expected O, but got Unknown
			//IL_017b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0188: Expected O, but got Unknown
			_log = ((BasePlugin)this).Log;
			try
			{
				Type type = AccessTools.TypeByName("Grimoire.UI.GrimoireUiHost") ?? throw new MissingMemberException("GrimoireUiHost");
				Type obj = AccessTools.TypeByName("Grimoire.Services.CommandService") ?? throw new MissingMemberException("CommandService");
				_button = AccessTools.Method(type, "Button", (Type[])null, (Type[])null) ?? throw new MissingMethodException("Grimoire button factory");
				_box = AccessTools.Method(type, "Box", (Type[])null, (Type[])null) ?? throw new MissingMethodException("Grimoire box factory");
				_txt = AccessTools.Method(type, "Txt", (Type[])null, (Type[])null) ?? throw new MissingMethodException("Grimoire text factory");
				_selected = AccessTools.Method(type, "Selected", (Type[])null, (Type[])null) ?? throw new MissingMethodException("Grimoire relic selection");
				_send = AccessTools.Method(obj, "Send", new Type[1] { typeof(string) }, (Type[])null) ?? throw new MissingMethodException("Grimoire command transport");
				_scheduleRefresh = AccessTools.Method(type, "ScheduleRefresh", (Type[])null, (Type[])null) ?? throw new MissingMethodException("Grimoire refresh scheduler");
				_harmony = new Harmony("io.grimoire.draculaaugment");
				_harmony.Patch((MethodBase)AccessTools.Method(type, "Build", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(typeof(Plugin), "AfterBuild", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
				_harmony.Patch((MethodBase)AccessTools.Method(type, "Render", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(typeof(Plugin), "AfterRender", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
				_log.LogInfo((object)"Dracula augment card window attached to Grimoire.");
			}
			catch (Exception ex)
			{
				ManualLogSource log = _log;
				bool flag = default(bool);
				BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(37, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Dracula augment UI was not attached: ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<Exception>(ex);
				}
				log.LogError(val);
			}
		}

		public override bool Unload()
		{
			Harmony? harmony = _harmony;
			if (harmony != null)
			{
				harmony.UnpatchSelf();
			}
			return true;
		}

		private static void AfterBuild(object __instance)
		{
			//IL_0353: Unknown result type (might be due to invalid IL or missing references)
			//IL_035a: Expected O, but got Unknown
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_014e: 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_0175: Unknown result type (might be due to invalid IL or missing references)
			//IL_017f: Expected O, but got Unknown
			//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_022c: Unknown result type (might be due to invalid IL or missing references)
			//IL_023b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0280: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0302: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				object? value = AccessTools.Field(__instance.GetType(), "_rightCard").GetValue(__instance);
				GameObject val = (GameObject)((value is GameObject) ? value : null);
				object? value2 = AccessTools.Field(__instance.GetType(), "_panel").GetValue(__instance);
				GameObject val2 = (GameObject)((value2 is GameObject) ? value2 : null);
				if ((Object)(object)val == (Object)null || (Object)(object)val2 == (Object)null)
				{
					return;
				}
				if (Windows.TryGetValue(__instance, out AugmentWindow value3))
				{
					if ((Object)(object)value3.ParentPanel == (Object)(object)val2 && (Object)(object)value3.CardButton != (Object)null)
					{
						return;
					}
					Windows.Remove(__instance);
				}
				AugmentWindow window = new AugmentWindow();
				window.ParentPanel = val2;
				window.CardButton = Button(__instance, val.transform, "AUGMENT", new Vector2(16f, -362f), 130f, delegate
				{
					Open(__instance);
				});
				window.CardButton.SetActive(false);
				window.Panel = (GameObject)_box.Invoke(null, new object[4]
				{
					val2.transform,
					(object)new Vector2(255f, -229f),
					(object)new Vector2(490f, 273f),
					null
				});
				((Graphic)window.Panel.GetComponent<Image>()).color = new Color(0.035f, 0.02f, 0.055f, 0.99f);
				((Graphic)Text(window.Panel.transform, "DRACULA  //  AUGMENT", 19, new Vector2(18f, -16f), new Vector2(450f, 27f))).color = new Color(0.82f, 0.59f, 1f, 1f);
				window.Body = Text(window.Panel.transform, string.Empty, 13, new Vector2(18f, -55f), new Vector2(454f, 153f));
				window.Body.alignment = (TextAnchor)0;
				Button(__instance, window.Panel.transform, "PHYSICAL", new Vector2(18f, -219f), 135f, delegate
				{
					Choose(__instance, "physical");
				});
				Button(__instance, window.Panel.transform, "SPELL", new Vector2(168f, -219f), 135f, delegate
				{
					Choose(__instance, "spell");
				});
				Button(__instance, window.Panel.transform, "CLOSE", new Vector2(337f, -219f), 135f, delegate
				{
					window.Panel.SetActive(false);
				});
				window.Panel.SetActive(false);
				Windows.Add(__instance, window);
			}
			catch (Exception ex)
			{
				ManualLogSource log = _log;
				bool flag = default(bool);
				BepInExErrorLogInterpolatedStringHandler val3 = new BepInExErrorLogInterpolatedStringHandler(40, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("Failed to build Dracula augment window: ");
					((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<Exception>(ex);
				}
				log.LogError(val3);
			}
		}

		private static void AfterRender(object __instance)
		{
			//IL_0160: Unknown result type (might be due to invalid IL or missing references)
			//IL_0167: Expected O, but got Unknown
			if (!Windows.TryGetValue(__instance, out AugmentWindow _))
			{
				AfterBuild(__instance);
			}
			if (!Windows.TryGetValue(__instance, out AugmentWindow value2) || (Object)(object)value2.CardButton == (Object)null)
			{
				return;
			}
			try
			{
				int num = (int)(AccessTools.Field(__instance.GetType(), "_tab").GetValue(__instance) ?? ((object)(-1)));
				object obj = _selected.Invoke(__instance, null);
				string text = ((obj == null) ? string.Empty : (((string)AccessTools.Property(obj.GetType(), "Id")?.GetValue(obj)) ?? string.Empty));
				int num2 = ((obj != null) ? ((int?)AccessTools.Property(obj.GetType(), "Copies")?.GetValue(obj)).GetValueOrDefault() : 0);
				bool flag = num == 0 && text.Equals("Dracula", StringComparison.OrdinalIgnoreCase) && num2 > 0;
				value2.CardButton.SetActive(flag);
				if (!flag)
				{
					value2.Panel.SetActive(false);
				}
				if (flag)
				{
					value2.Current = ((string)AccessTools.Property(obj.GetType(), "Description")?.GetValue(obj)) ?? string.Empty;
				}
				if (flag && value2.Panel.activeSelf)
				{
					RefreshBody(value2);
				}
			}
			catch (Exception ex)
			{
				ManualLogSource log = _log;
				bool flag2 = default(bool);
				BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(32, 1, ref flag2);
				if (flag2)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Dracula augment render skipped: ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.Message);
				}
				log.LogWarning(val);
			}
		}

		private static void Open(object host)
		{
			if (Windows.TryGetValue(host, out AugmentWindow value))
			{
				value.PendingChoice = string.Empty;
				RefreshBody(value);
				value.Panel.SetActive(true);
			}
		}

		private static void RefreshBody(AugmentWindow window)
		{
			string text = CurrentAugment(window);
			string text2 = ((window.PendingChoice.Length == 0) ? string.Empty : ("\n\nClick " + window.PendingChoice.ToUpperInvariant() + " again to confirm spending 5 Requiem Shards."));
			window.Body.text = "Current: " + text + "\n\nPHYSICAL: Power / Crit Chance / Crit Damage / Attack Speed\nSPELL: Power / Crit Chance / Crit Damage / Spell Cooldown\n\nOne school applies to the passive, Judgment, and Ascension.\nFirst choice free; respec 5 Shards (out of combat)." + text2;
		}

		private static string CurrentAugment(AugmentWindow window)
		{
			int num = window.Current.LastIndexOf("Augment: ", StringComparison.OrdinalIgnoreCase);
			if (num < 0)
			{
				return "Unknown (server update required)";
			}
			string current = window.Current;
			int num2 = num + 9;
			string text = current.Substring(num2, current.Length - num2).Trim().TrimEnd('.');
			bool flag;
			switch (text)
			{
			case "Physical":
			case "Spell":
			case "None":
				flag = true;
				break;
			default:
				flag = false;
				break;
			}
			if (!flag)
			{
				return "Unknown (server update required)";
			}
			return text;
		}

		private static void Choose(object host, string choice)
		{
			if (!Windows.TryGetValue(host, out AugmentWindow value))
			{
				return;
			}
			string text = CurrentAugment(value);
			if (!text.StartsWith("Unknown", StringComparison.Ordinal) && !text.Equals(choice, StringComparison.OrdinalIgnoreCase))
			{
				if (text != "None" && value.PendingChoice != choice)
				{
					value.PendingChoice = choice;
					RefreshBody(value);
					return;
				}
				_send.Invoke(null, new object[1] { ".relic augment " + choice });
				_scheduleRefresh.Invoke(host, null);
				value.PendingChoice = string.Empty;
				value.Panel.SetActive(false);
			}
		}

		private static GameObject Button(object host, Transform parent, string label, Vector2 position, float width, Action click)
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Expected O, but got Unknown
			return (GameObject)_button.Invoke(host, new object[5] { parent, label, position, width, click });
		}

		private static Text Text(Transform parent, string value, int size, Vector2 position, Vector2 dimensions)
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Expected O, but got Unknown
			return (Text)_txt.Invoke(null, new object[6] { parent, value, size, position, dimensions, null });
		}
	}
}