Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of Core v1.0.1
meadworks.core.dll
Decompiled 10 minutes ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Diagnostics; using System.Globalization; using System.IO; using System.IO.Compression; using System.Linq; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.ExceptionServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security; using System.Security.Cryptography; using System.Security.Permissions; using System.Text; using System.Text.RegularExpressions; using System.Threading; using System.Threading.Tasks; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using GUIFramework; using HarmonyLib; using MeadWorks.Core; using MeadWorks.UI; using Microsoft.CodeAnalysis; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using Splatform; using TMPro; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.InputSystem; using UnityEngine.InputSystem.Controls; using UnityEngine.InputSystem.Utilities; using UnityEngine.Rendering; using UnityEngine.SceneManagement; using UnityEngine.UI; using Valheim.SettingsGui; using Valheim.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: IgnoresAccessChecksTo("assembly_guiutils")] [assembly: IgnoresAccessChecksTo("assembly_utils")] [assembly: IgnoresAccessChecksTo("assembly_valheim")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyCompany("expDARE")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyCopyright("Copyright (c) 2026 expDARE")] [assembly: AssemblyFileVersion("1.0.1.0")] [assembly: AssemblyInformationalVersion("1.0.1")] [assembly: AssemblyProduct("meadworks.core")] [assembly: AssemblyTitle("meadworks.core")] [assembly: InternalsVisibleTo("MeadWorks.Core.Tests")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.1.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace MeadWorks.UI { public static class VirtualListRules { public static float ContentHeight(int count, float height) { return (float)Math.Max(0, count) * height; } public static float ClampOffset(float offset, int count, float viewport, float height) { return Math.Max(0f, Math.Min(Math.Max(0f, ContentHeight(count, height) - viewport), offset)); } public static int PoolSize(int count, float viewport, float height) { return Math.Min(Math.Max(0, count), Math.Max(1, (int)Math.Ceiling(Math.Max(0f, viewport) / height)) + 2); } public static int First(int count, int pool, float offset, float height) { return Math.Max(0, Math.Min(Math.Max(0, count - pool), (int)(Math.Max(0f, offset) / height) - 1)); } } public static class KeyHints { [DefaultExecutionOrder(-100)] private sealed class HudHintScale : MonoBehaviour { private void LateUpdate() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //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_0064: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0076: 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_007c: 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_008d: 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) RectTransform val = (RectTransform)((Component)this).transform; Transform val2 = ((HudShell.Active && (Object)(object)Hud.instance != (Object)null) ? Hud.instance.m_rootObject.transform : null); float num = (((Object)(object)val2 != (Object)null) ? HudMatchRules.RelativeScale(val2.lossyScale.y, ((Transform)val).parent.lossyScale.y) : 1f); Vector3 val3 = Vector3.one * num; Vector3 val4 = ((Transform)val).localScale - val3; if (((Vector3)(ref val4)).sqrMagnitude > 1E-06f) { ((Transform)val).localScale = val3; } float num2 = 28f * num; if (Mathf.Abs(val.anchoredPosition.y - num2) > 0.01f) { val.anchoredPosition = new Vector2(0f, num2); } } } private static class Patches { [HarmonyPostfix] [HarmonyPatch(typeof(KeyHints), "Awake")] private static void Rebuilt() { RestoreRows(); HintGraphics.Clear(); } [HarmonyPostfix] [HarmonyPatch(typeof(KeyHints), "ApplySettings")] private static void Bindings() { HintGraphics.Clear(); RefreshBuildBindings(); } [HarmonyPostfix] [HarmonyPatch(typeof(ZInput), "GetBoundKeyString")] private static void BoundKey(ZInput __instance, string name, ref string __result) { //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) if (__result == null || !__result.StartsWith("MISSING KEY BINDING", StringComparison.Ordinal)) { return; } __result = ""; if (__instance == null || name == null || !__instance.m_buttons.TryGetValue(name, out var value) || value.ButtonAction == null) { return; } Enumerator<InputBinding> enumerator = value.ButtonAction.bindings.GetEnumerator(); try { while (enumerator.MoveNext()) { InputBinding current = enumerator.Current; if (!((InputBinding)(ref current)).isComposite && !((InputBinding)(ref current)).isPartOfComposite && !string.IsNullOrEmpty(((InputBinding)(ref current)).effectivePath)) { __result = ((InputBinding)(ref current)).ToDisplayString((DisplayStringOptions)4, (InputControl)null); break; } } } finally { ((IDisposable)enumerator/*cast due to .constrained prefix*/).Dispose(); } } [HarmonyPostfix] [HarmonyPatch(typeof(KeyHints), "OnDestroy")] private static void Destroyed() { RestoreRows(); HintGraphics.Clear(); _showBuild = false; if (_drawn == "build") { Reconcile(); } } [HarmonyPatch(typeof(KeyHints), "UpdateHints")] [HarmonyPostfix] private static void Update(KeyHints __instance) { bool flag = Enabled && __instance.m_buildHints.activeSelf && (_buildApplies?.Invoke() ?? false); if (flag != _showBuild || _buildDirty) { _showBuild = flag; Reconcile(); } CentreRows(__instance); Pump(); bool visible = Visible; VeilRows[0] = __instance.m_buildHints; VeilRows[1] = __instance.m_combatHints; VeilRows[2] = __instance.m_fishingHints; VeilRows[3] = __instance.m_barberHints; VeilRows[4] = __instance.m_radialHints; VeilRows[5] = __instance.m_inventoryHints; VeilRows[6] = __instance.m_inventoryWithContainerHints; for (int i = 0; i < VeilRows.Length; i++) { Veil(ref Veils[i], VeilRows[i], visible); } } } private const string RootName = "MeadWorks.KeyHints"; private const float BottomMargin = 28f; private const string BuildSignature = "build"; private static readonly Dictionary<RectTransform, Vector2> Shifted = new Dictionary<RectTransform, Vector2>(); private static readonly GameObject[] HintRows = (GameObject[])(object)new GameObject[6]; private static readonly GameObject[] VeilRows = (GameObject[])(object)new GameObject[7]; private static readonly RowVeil<GameObject>[] Veils = new RowVeil<GameObject>[7]; private static readonly Vector3[] Corners = (Vector3[])(object)new Vector3[4]; private static readonly KeyHintStack Stack = new KeyHintStack(); private static readonly List<KitPanel> Panels = new List<KitPanel>(); private static WindowHintContext _context; private static Setting<bool> _on; private static GameObject _root; private static string _drawn; private static float _checked; private static Harmony _harmony; private static Func<bool> _buildApplies; private static Func<Func<string, string>, List<string[]>[]> _buildRows; private static bool _showBuild; private static bool _buildDirty; public static bool Visible { get { if ((Object)(object)_root != (Object)null) { return _root.activeSelf; } return false; } } public static bool Enabled { get { if (_on != null) { return _on.Value; } return false; } } internal static GameObject HintRoot => _root; private static bool ShowBuild { get { if (_showBuild && !Stack.Any) { return _context == WindowHintContext.None; } return false; } } private static bool HammerHints { get { Player localPlayer = Player.m_localPlayer; return WindowHintRules.Hammer((localPlayer == null) ? null : ((Humanoid)localPlayer).GetCurrentWeapon()?.m_shared?.m_name); } } public static void Init(SettingsPage page) { //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Expected O, but got Unknown _on = page.Toggle("key_hints", "Key hints", value: true); _on.Changed += Reconcile; Keys.BindingsChanged += RefreshBuildBindings; Localization.OnLanguageChange = (Action)Delegate.Combine(Localization.OnLanguageChange, new Action(RefreshBuildBindings)); _harmony = new Harmony("expdare.meadworks.core.keyhints"); _harmony.PatchAll(typeof(Patches)); LedgerTrack.Patch(_harmony, "key hint bar"); Ledger.Add("key hint bar", delegate { RestoreRows(); for (int i = 0; i < Veils.Length; i++) { Veil(ref Veils[i], Veils[i].Row, hidden: false); } HintGraphics.Clear(); if (_on != null) { _on.Changed -= Reconcile; } _on = null; Keys.BindingsChanged -= RefreshBuildBindings; Localization.OnLanguageChange = (Action)Delegate.Remove(Localization.OnLanguageChange, new Action(RefreshBuildBindings)); _buildApplies = null; _buildRows = null; _showBuild = false; Stack.Clear(); Panels.Clear(); _context = WindowHintContext.None; Remove(); }); } public static void Show(string owner, IEnumerable<KeyHint> entries) { Stack.Show(owner, entries); Reconcile(); } public static void Hide(string owner) { if (Stack.Hide(owner)) { Reconcile(); } } public static void ReplaceBuildHints(Func<bool> applies, Func<Func<string, string>, List<string[]>[]> rows) { _buildApplies = applies; _buildRows = rows; Ledger.Add("build hint replacement", delegate { _buildApplies = null; _buildRows = null; _showBuild = false; if (_drawn == "build") { Reconcile(); } }); } public static bool Shows(string owner) { return Stack.Has(owner); } public static List<string[]> Rows() { if (ShowBuild) { List<string[]> list = new List<string[]>(); List<string[]>[] array = _buildRows(KeyText); foreach (List<string[]> collection in array) { list.AddRange(collection); } return list; } return KeyHintMath.Format(Stack.Any ? Stack.Top : WindowHintRules.Entries(_context, ZInput.IsGamepadActive(), KitTextField.Typing), KeyText); } private static string KeyText(string id) { if (id.StartsWith("native:", StringComparison.Ordinal)) { ZInput instance = ZInput.instance; string text = ((instance != null) ? instance.GetBoundKeyString(id.Substring(7), true) : null); if (text == null || Localization.instance == null) { return text; } return Localization.instance.Localize(text); } return Keys.BindingText(id); } private static void RefreshBuildBindings() { if (_drawn == "build") { _buildDirty = true; } } private static void Reconcile() { if (Enabled && ShowBuild) { if (_drawn == "build" && !_buildDirty) { return; } Remove(); _drawn = "build"; _buildDirty = false; List<string[]>[] array = _buildRows(KeyText); if (Array.TrueForAll(array, (List<string[]> line) => line.Count == 0)) { return; } RectTransform val = TipParts.Stack(Root.Transform, "BuildHints", horizontal: false, 6f); VerticalLayoutGroup component = ((Component)val).GetComponent<VerticalLayoutGroup>(); ((HorizontalOrVerticalLayoutGroup)component).childForceExpandWidth = false; ((LayoutGroup)component).childAlignment = (TextAnchor)7; List<string[]>[] array2 = array; foreach (List<string[]> list in array2) { if (list.Count != 0) { Row((Transform)(object)val, list, strip: true); } } Build(val); return; } if (_on == null || !_on.Value || (!Stack.Any && _context == WindowHintContext.None)) { Remove(); return; } List<string[]> list2 = Rows(); string text = Stack.TopOwner + "\u001d" + KeyHintMath.Signature(list2); if (!((Object)(object)_root != (Object)null) || !(text == _drawn)) { Remove(); if (list2.Count != 0) { Build(Row(Root.Transform, list2, strip: true)); _drawn = text; } } } private static void Remove() { HintGraphics.Forget(_root); if ((Object)(object)_root != (Object)null) { _root.SetActive(false); Object.Destroy((Object)(object)_root); } _root = null; _drawn = null; _buildDirty = false; } private static void Build(RectTransform bar) { //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_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) ((Object)((Component)bar).gameObject).name = "MeadWorks.KeyHints"; _root = ((Component)bar).gameObject; _root.AddComponent<HudHintScale>(); CanvasGroup obj = _root.AddComponent<CanvasGroup>(); bool interactable = (obj.blocksRaycasts = false); obj.interactable = interactable; Vector2 val = default(Vector2); ((Vector2)(ref val))..ctor(0.5f, 0f); bar.anchorMax = val; bar.anchorMin = val; bar.pivot = new Vector2(0.5f, 0f); bar.anchoredPosition = new Vector2(0f, 28f); ContentSizeFitter obj2 = ((Component)bar).gameObject.AddComponent<ContentSizeFitter>(); FitMode horizontalFit = (FitMode)2; obj2.verticalFit = (FitMode)2; obj2.horizontalFit = horizontalFit; LayoutRebuilder.ForceRebuildLayoutImmediate(bar); } internal static void Register(KitPanel panel) { if (!Panels.Contains(panel)) { Panels.Add(panel); } _checked = 0f; } internal static void Unregister(KitPanel panel) { Panels.Remove(panel); _checked = 0f; } internal static void Pump() { if (_on != null && !(Time.unscaledTime < _checked)) { _checked = Time.unscaledTime + 0.25f; _context = Context(); Reconcile(); } } public static void RefreshNativeGraphics() { HintGraphics.Clear(); } private static WindowHintContext Context() { if ((Object)(object)Player.m_localPlayer != (Object)null && ((Character)Player.m_localPlayer).InPlaceMode() && !HammerHints) { return WindowHintContext.None; } if (KitBackdrop.AnyOpen) { return WindowHintContext.Window; } bool flag = false; foreach (KitPanel panel in Panels) { if ((Object)(object)panel != (Object)null && ((Component)panel).gameObject.activeInHierarchy && !panel.Hud && (Object)(object)((Component)panel).GetComponentInChildren<Selectable>() != (Object)null) { flag = true; break; } } if (!flag) { return WindowHintContext.None; } if (MapHide.MapOpen) { return WindowHintContext.None; } if (InventoryGui.IsVisible()) { InventoryGui instance = InventoryGui.instance; if (!instance.IsSkillsPanelOpen && !instance.IsTrophisPanelOpen && !instance.IsAchievementsPanelOpen && !instance.IsTextPanelOpen) { return WindowHintContext.Inventory; } return WindowHintContext.Window; } if (Hud.IsPieceSelectionVisible()) { return WindowHintContext.Build; } if (!((Object)(object)FejdStartup.instance != (Object)null)) { return WindowHintContext.Window; } return WindowHintContext.Characters; } public static RectTransform Row(Transform parent, IList<string[]> rows, bool strip = false) { //IL_0010: 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_0016: Expected O, but got Unknown //IL_00c0: Unknown result type (might be due to invalid IL or missing references) RectOffset padding = (strip ? new RectOffset(16, 16, 0, 0) : new RectOffset()); RectTransform val = TipParts.Stack(parent, "MeadWorks.Hints", horizontal: true, 18f, padding); ((HorizontalOrVerticalLayoutGroup)((Component)val).GetComponent<HorizontalLayoutGroup>()).childForceExpandWidth = false; if (strip) { TipParts.Size((Component)(object)val, 0f, 0f, 44f); } if (rows == null) { return val; } foreach (string[] row in rows) { if (row != null && row.Length >= 2) { RectTransform val2 = TipParts.Stack((Transform)(object)val, "Hint", horizontal: true, 6f); ((HorizontalOrVerticalLayoutGroup)((Component)val2).GetComponent<HorizontalLayoutGroup>()).childForceExpandWidth = false; if (!string.IsNullOrEmpty(row[1])) { TipParts.Label((Transform)(object)val2, "Text", Lang.Derived("hint." + LangRules.Slug(row[1]), row[1]), 18f, Theme.Text, bold: false, italic: false, wrap: false, (TextAlignmentOptions)4097); } Cap((Transform)(object)val2, KeyHintMath.ChipCap(row[0])); } } HudText.StyleChildren((Transform)(object)val); return val; } public static RectTransform Cap(Transform parent, string text) { //IL_0017: 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_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Expected O, but got Unknown //IL_0066: Expected O, but got Unknown KitChip kitChip = Kit.Chip(parent, KeyHintMath.ChipCap(text), null); kitChip.Readout = true; Navigation navigation = default(Navigation); ((Navigation)(ref navigation)).mode = (Mode)0; ((Selectable)kitChip).navigation = navigation; ((Component)kitChip).gameObject.AddComponent<CanvasGroup>().blocksRaycasts = false; RectTransform val = (RectTransform)((Component)kitChip).transform; TipParts.Size((Component)val, 0f, 0f, 26f).minWidth = 26f; return val; } public static RectTransform Caps(Transform parent, string combo) { RectTransform val = TipParts.Stack(parent, "Caps", horizontal: true, 3f); ((HorizontalOrVerticalLayoutGroup)((Component)val).GetComponent<HorizontalLayoutGroup>()).childForceExpandWidth = false; string[] array = KeyHintMath.Caps(combo); foreach (string text in array) { Cap((Transform)(object)val, text); } return val; } private static void RestoreRows() { //IL_002d: Unknown result type (might be due to invalid IL or missing references) foreach (KeyValuePair<RectTransform, Vector2> item in Shifted) { if ((Object)(object)item.Key != (Object)null) { item.Key.anchoredPosition = item.Value; } } Shifted.Clear(); } private static bool Veiled(GameObject row) { for (int i = 0; i < Veils.Length; i++) { if (row == Veils[i].Row) { return true; } } return false; } private static void Veil(ref RowVeil<GameObject> veil, GameObject row, bool hidden) { if (!veil.Changed(row, hidden) || (Object)(object)row == (Object)null) { return; } CanvasGroup val = row.GetComponent<CanvasGroup>(); if ((Object)(object)val == (Object)null) { if (!hidden) { return; } val = row.AddComponent<CanvasGroup>(); } val.alpha = (hidden ? 0f : 1f); val.blocksRaycasts = !hidden; } internal static bool Shown(GameObject row) { if ((Object)(object)row == (Object)null || !row.activeInHierarchy) { return false; } CanvasGroup component = row.GetComponent<CanvasGroup>(); if (!((Object)(object)component == (Object)null)) { return component.alpha > 0f; } return true; } private static void CentreRows(KeyHints hints) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0180: 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_02e1: Unknown result type (might be due to invalid IL or missing references) //IL_02e6: Unknown result type (might be due to invalid IL or missing references) //IL_02c4: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: Unknown result type (might be due to invalid IL or missing references) //IL_01e9: Unknown result type (might be due to invalid IL or missing references) //IL_01ee: Unknown result type (might be due to invalid IL or missing references) //IL_01f3: Unknown result type (might be due to invalid IL or missing references) //IL_01fe: Unknown result type (might be due to invalid IL or missing references) //IL_0203: Unknown result type (might be due to invalid IL or missing references) //IL_0207: Unknown result type (might be due to invalid IL or missing references) //IL_020c: Unknown result type (might be due to invalid IL or missing references) //IL_0211: Unknown result type (might be due to invalid IL or missing references) if (!HudShell.Active || (Object)(object)Hud.instance == (Object)null) { if (Shifted.Count > 0) { RestoreRows(); } return; } ((RectTransform)Hud.instance.m_rootObject.transform).GetWorldCorners(Corners); float num = (Corners[0].x + Corners[2].x) * 0.5f; HintRows[0] = hints.m_buildHints; HintRows[1] = hints.m_combatHints; HintRows[2] = hints.m_fishingHints; HintRows[3] = hints.m_barberHints; HintRows[4] = hints.m_inventoryHints; HintRows[5] = hints.m_inventoryWithContainerHints; for (int i = 0; i < HintRows.Length; i++) { GameObject val = HintRows[i]; RectTransform val2 = (RectTransform)(((Object)(object)val != (Object)null) ? /*isinst with value type is only supported in some contexts*/: null); if ((Object)(object)val2 == (Object)null) { continue; } if (i == 0 && !HammerHints) { if (Shifted.TryGetValue(val2, out var value)) { val2.anchoredPosition = value; Shifted.Remove(val2); } } else { if (!val.activeInHierarchy || (Visible && Veiled(val))) { continue; } float num2 = float.MaxValue; float num3 = float.MinValue; Graphic[] array = HintGraphics.Of(val); foreach (Graphic val3 in array) { if ((Object)(object)val3 == (Object)null || !((Behaviour)val3).isActiveAndEnabled || val3.color.a < 0.05f) { continue; } TMP_Text val4 = (TMP_Text)(object)((val3 is TMP_Text) ? val3 : null); float x; float x2; if ((Object)(object)val4 != (Object)null) { if (string.IsNullOrEmpty(val4.text)) { continue; } Bounds textBounds = val4.textBounds; if (((Bounds)(ref textBounds)).size.x <= 0f) { continue; } RectTransform rectTransform = val4.rectTransform; textBounds = val4.textBounds; Vector3 val5 = ((Transform)rectTransform).TransformPoint(((Bounds)(ref textBounds)).min); RectTransform rectTransform2 = val4.rectTransform; textBounds = val4.textBounds; Vector3 val6 = ((Transform)rectTransform2).TransformPoint(((Bounds)(ref textBounds)).max); x = val5.x; x2 = val6.x; } else { val3.rectTransform.GetWorldCorners(Corners); x = Corners[0].x; x2 = Corners[2].x; } num2 = Mathf.Min(num2, Mathf.Min(x, x2)); num3 = Mathf.Max(num3, Mathf.Max(x, x2)); } if (num2 > num3) { continue; } float num4 = num - (num2 + num3) * 0.5f; if (Mathf.Abs(num4) >= 1f) { if (!Shifted.ContainsKey(val2)) { Shifted[val2] = val2.anchoredPosition; } ((Transform)val2).position = ((Transform)val2).position + new Vector3(num4, 0f, 0f); } } } } } public static class BackdropMath { public const float Full = 1f; public const float None = 0f; public static float Alpha(float theme, IList<float> requests) { float num = 0f; if (requests != null) { foreach (float request in requests) { num = Math.Max(num, Clamp01(request)); } } return Clamp01(theme) * num; } public static bool Modal(float request) { return request > 0f; } public static bool BlocksInput(IList<float> requests) { if (requests != null) { foreach (float request in requests) { if (Modal(request)) { return true; } } } return false; } public static bool ClosesOnOutsideClick(IList<int> order, IList<float> requests) { int num = Top(order); if (num >= 0 && requests != null && num < requests.Count) { return Modal(requests[num]); } return false; } public static int Top(IList<int> order) { int num = -1; if (order == null) { return num; } for (int i = 0; i < order.Count; i++) { if (num < 0 || order[i] > order[num]) { num = i; } } return num; } public static bool Blocks(float alpha) { return alpha > 0f; } public static int Behind(IList<int> order, IList<float> requests) { int num = -1; if (order == null || requests == null) { return num; } for (int i = 0; i < order.Count && i < requests.Count; i++) { if (!(requests[i] <= 0f) && (num < 0 || order[i] < order[num])) { num = i; } } return num; } private static float Clamp01(float v) { if (!(v < 0f)) { if (!(v > 1f)) { return v; } return 1f; } return 0f; } } internal static class BindDispatchRules { internal static IEnumerable<CodeInstruction> Rewrite(IEnumerable<CodeInstruction> instructions, FieldInfo field, MethodInfo read) { int found = 0; foreach (CodeInstruction instruction in instructions) { if (instruction.opcode == OpCodes.Ldsfld && object.Equals(instruction.operand, field)) { instruction.opcode = OpCodes.Call; instruction.operand = read; found++; } yield return instruction; } if (found != 1) { throw new InvalidOperationException("Chat bind dispatch changed: expected one binding table read, found " + found); } } } internal static class BoundCommands { private static readonly Dictionary<KeyCode, List<string>> None = new Dictionary<KeyCode, List<string>>(); private static Dictionary<KeyCode, List<string>> ReadBindings() { if (!TypingRules.DispatchBindings(KitTextField.Typing)) { return None; } return Terminal.m_binds; } internal static IEnumerable<CodeInstruction> Rewrite(IEnumerable<CodeInstruction> instructions) { FieldInfo field = AccessTools.Field(typeof(Terminal), "m_binds"); MethodInfo read = AccessTools.Method(typeof(BoundCommands), "ReadBindings", (Type[])null, (Type[])null); return BindDispatchRules.Rewrite(instructions, field, read); } } internal static class CameraZoomRules { internal static float Scroll(float value, bool menuVisible) { if (!menuVisible) { return value; } return 0f; } internal static IEnumerable<CodeInstruction> Rewrite(IEnumerable<CodeInstruction> instructions, MethodInfo read, MethodInfo guard) { List<CodeInstruction> list = instructions.ToList(); if (list.Count((CodeInstruction i) => CodeInstructionExtensions.Calls(i, read)) != 2) { throw new InvalidOperationException("Camera zoom changed: expected two scroll reads"); } foreach (CodeInstruction instruction in list) { yield return instruction; if (CodeInstructionExtensions.Calls(instruction, read)) { yield return new CodeInstruction(OpCodes.Call, (object)guard); } } } } public static class ClipMaskRules { public const int SweepFrames = 8; public const int MovedPasses = 1; public const int RedrawnPasses = 2; public static int Owe(int owed, int passes) { if (owed <= passes) { return passes; } return owed; } public static int Paid(int owed) { if (owed <= 0) { return 0; } return owed - 1; } public static bool Due(bool readable, bool asked, int owed, bool moved, int frame, int swept) { if (!readable || asked || owed > 0 || moved) { return true; } if (frame >= swept) { return frame - swept >= 8; } return true; } public static int Numbers(int masks) { return ((masks >= 0) ? masks : 0) * 10 + 6; } } internal static class CompactTipCard { private const float Width = 370f; private const float MaxComparisonWidth = 460f; private const float ColumnGap = 12f; private const float StatGap = 4f; private const float ContentWidth = 338f; internal static void Draw(RectTransform background, ItemTooltip item, ItemTooltip comparison) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: 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_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0088: 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_0127: 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_0136: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) Color tip = Theme.Tip; tip.a = 1f; ItemTipFrame.Prepare((Transform)(object)background, tip); RectTransform obj = TipParts.Stack((Transform)(object)background, "MeadWorks.Tip", horizontal: false, 3f); RectTransform val = Header((Transform)(object)obj, item); RectTransform val2 = null; RectTransform val3 = null; if (comparison != null) { val2 = TipParts.Card((Transform)(object)background, "MeadWorks.Tip.Compare", 370f); ((Component)val2).GetComponent<LayoutElement>().ignoreLayout = true; ((Graphic)((Component)val2).GetComponent<Image>()).color = tip; ((HorizontalOrVerticalLayoutGroup)((Component)val2).GetComponent<VerticalLayoutGroup>()).spacing = 3f; ContentSizeFitter obj2 = ((Component)val2).gameObject.AddComponent<ContentSizeFitter>(); FitMode horizontalFit = (FitMode)2; obj2.verticalFit = (FitMode)2; obj2.horizontalFit = horizontalFit; val3 = Header((Transform)(object)val2, comparison); } float num = Stats((Transform)(object)obj, item, (Transform)(object)val2, comparison); TipParts.Size((Component)(object)obj, 0f, num); Details((Transform)(object)obj, item); if ((Object)(object)val2 != (Object)null) { TipParts.Size((Component)(object)val2, 0f, num + 32f); Details((Transform)(object)val2, comparison); } Graphic[] componentsInChildren = ((Component)background).GetComponentsInChildren<Graphic>(true); for (int i = 0; i < componentsInChildren.Length; i++) { componentsInChildren[i].raycastTarget = false; } LayoutRebuilder.ForceRebuildLayoutImmediate(background); if ((Object)(object)val2 == (Object)null) { return; } LayoutRebuilder.ForceRebuildLayoutImmediate(val2); Rect rect = val.rect; float height = ((Rect)(ref rect)).height; rect = val3.rect; if (height < ((Rect)(ref rect)).height) { rect = val3.rect; TipParts.Size((Component)(object)val, 0f, 0f, ((Rect)(ref rect)).height); LayoutRebuilder.ForceRebuildLayoutImmediate(background); } else { rect = val3.rect; float height2 = ((Rect)(ref rect)).height; rect = val.rect; if (height2 < ((Rect)(ref rect)).height) { RectTransform c = val3; rect = val.rect; TipParts.Size((Component)(object)c, 0f, 0f, ((Rect)(ref rect)).height); LayoutRebuilder.ForceRebuildLayoutImmediate(val2); } } ItemTipFrame.PlaceCompare((Transform)(object)background); } private static RectTransform Header(Transform parent, ItemTooltip tip) { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Expected O, but got Unknown //IL_0084: 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_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_0264: Unknown result type (might be due to invalid IL or missing references) //IL_0238: Unknown result type (might be due to invalid IL or missing references) //IL_0231: Unknown result type (might be due to invalid IL or missing references) float size = Theme.TextSize(TextRole.Meta); float size2 = Theme.TextSize(TextRole.Subheading); RectTransform val = TipParts.Stack(parent, "Heading", horizontal: false, 3f); if (!string.IsNullOrEmpty(tip.Context)) { Label((Transform)(object)val, "Comparison context", tip.Context, size, Theme.Faint); } RectTransform parent2 = TipParts.Stack((Transform)(object)val, "Header", horizontal: true, 8f); if ((Object)(object)tip.Icon != (Object)null) { RectTransform obj = TipParts.Stack((Transform)(object)parent2, "Icon", horizontal: false, 0f, new RectOffset(4, 4, 4, 4)); HudShell.Box((Transform)(object)obj, Theme.Slot, Theme.Line, Theme.Radius, 1f); TipParts.Size((Component)(object)obj, 0f, 44f, 44f).minWidth = 44f; Icon((Transform)(object)obj, "Item icon", tip.Icon, Color.white, 36f); } RectTransform obj2 = TipParts.Stack((Transform)(object)parent2, "Titles", horizontal: false, 1f); TipParts.Size((Component)(object)obj2, 1f); Label((Transform)(object)obj2, "Item name", string.Concat(str1: (tip.Quality > 0) ? (" ★" + tip.Quality) : "", str0: tip.Name), size2, Theme.ItemName); List<string> list = new List<string>(4); if (!string.IsNullOrEmpty(tip.Rarity)) { list.Add(tip.RarityColor.HasValue ? Colored(tip.Rarity, tip.RarityColor.Value) : Escape(tip.Rarity)); } if (!string.IsNullOrEmpty(tip.Kind)) { list.Add(Escape(tip.Kind)); } if (!string.IsNullOrEmpty(tip.Hands)) { list.Add(Escape(tip.Hands)); } if (tip.ShowWeight) { string text = Escape(ItemTooltipNative.Weight(tip.Weight)); if (Math.Abs(tip.WeightComparison) >= 0.05f) { text = text + " " + Colored(ItemTooltipText.Signed(tip.WeightComparison) + " kg", (tip.WeightComparison < 0f) ? Theme.Good : Theme.Bad); } list.Add(text); } ((TMP_Text)Label((Transform)(object)obj2, "Item details", string.Join(" · ", list), size, Theme.TextDim)).richText = true; return val; } private static float Stats(Transform main, ItemTooltip item, Transform card, ItemTooltip comparison) { List<(RectTransform, RectTransform, float)> list = new List<(RectTransform, RectTransform, float)>(); float body = Theme.TextSize(TextRole.List); float small = Theme.TextSize(TextRole.Meta); float num = 338f; float height = 0f; foreach (var item4 in StatPairs(item.Stats, comparison?.Stats)) { float required; RectTransform item2 = Stat(main, item4.Hovered, body, small, out required, ref height); float required2; RectTransform item3 = Stat(card, item4.Worn, body, small, out required2, ref height); float num2 = Math.Max(required, required2); list.Add((item2, item3, num2)); if ((Object)(object)card != (Object)null) { num = ComparisonContentWidth(num, num2); } } if (list.Count == 0) { return num; } Divider(main); if ((Object)(object)card != (Object)null) { Divider(card); } RectTransform val = null; RectTransform row = null; foreach (var item5 in list) { float num3 = StatWidth(item5.Item3, num); bool flag = num3 == num; if ((Object)(object)val == (Object)null || flag) { val = TipParts.Stack(main, "Stat row", horizontal: true, 12f); if ((Object)(object)card != (Object)null) { row = TipParts.Stack(card, "Stat row", horizontal: true, 12f); } } AddStat(val, item5.Item1, num3, ((Object)(object)card == (Object)null) ? 0f : height); if ((Object)(object)card != (Object)null) { AddStat(row, item5.Item2, num3, height); } if (flag || ((Transform)val).childCount == 2) { val = null; } } return num; } internal static IEnumerable<(TooltipStat Hovered, TooltipStat Worn)> StatPairs(List<TooltipStat> hovered, List<TooltipStat> worn) { List<TooltipStat> unmatched = ((worn == null) ? new List<TooltipStat>() : new List<TooltipStat>(worn)); foreach (TooltipStat stat in hovered) { int num = unmatched.FindIndex((TooltipStat other) => other.Key == stat.Key); TooltipStat item = ((num < 0) ? null : unmatched[num]); if (num >= 0) { unmatched.RemoveAt(num); } yield return (Hovered: stat, Worn: item); } foreach (TooltipStat item2 in unmatched) { yield return (Hovered: null, Worn: item2); } } private static void AddStat(RectTransform row, RectTransform cell, float width, float height) { if ((Object)(object)cell == (Object)null) { cell = Parts.Rect("Empty stat", (Transform)(object)row); } else { ((Transform)cell).SetParent((Transform)(object)row, false); } TipParts.Size((Component)(object)cell, 0f, width, height).minWidth = width; } private static void Details(Transform root, ItemTooltip tip) { //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: Unknown result type (might be due to invalid IL or missing references) //IL_024d: Unknown result type (might be due to invalid IL or missing references) //IL_0273: Unknown result type (might be due to invalid IL or missing references) float size = Theme.TextSize(TextRole.Meta); if (tip.Bonuses.Count > 0 || tip.Enchantments.Count > 0) { Divider(root); } foreach (var bonuse in tip.Bonuses) { Bonus(root, bonuse.Name, bonuse.Effect, size); } string text = null; Color color = default(Color); foreach (var enchantment in tip.Enchantments) { if (text != null && text != enchantment.Hex) { TipParts.Gap(root, 2f); } text = enchantment.Hex; RectTransform parent = TipParts.Stack(root, "Enchantment", horizontal: true, 6f); if (ColorUtility.TryParseHtmlString("#" + enchantment.Hex, ref color)) { ((Graphic)Kit.Swatch((Transform)(object)parent)).color = color; } LayoutElement obj = TipParts.Size((Component)(object)Bonus((Transform)(object)parent, enchantment.Name, enchantment.Effect, size), 1f); float minWidth = (obj.preferredWidth = 0f); obj.minWidth = minWidth; } if (tip.EmptySockets > 0 || tip.Gems.Count > 0) { RectTransform parent2 = TipParts.Stack(root, "Sockets", horizontal: true, 5f); Icon((Transform)(object)parent2, "Socket", Glyphs.Get("diamond"), Theme.TextDim, size); List<string> list = new List<string>(tip.Gems); if (tip.EmptySockets > 0) { list.Add((tip.EmptySockets == 1) ? Lang.T("core.tooltip_socket_empty", "1 empty socket") : Lang.T("core.tooltip_sockets_empty", "{0} empty sockets", tip.EmptySockets)); } TipParts.Size((Component)(object)Label((Transform)(object)parent2, "Socket state", string.Join(" · ", list), size, Theme.TextDim), 1f); } if (tip.Footer.Count > 0) { TipParts.Gap(root, 2f); Label(root, "Footer", string.Join(" · ", tip.Footer), size, Theme.Faint); } if (!string.IsNullOrEmpty(tip.AppendedText)) { Label(root, "Appended tooltip", tip.AppendedText, size, Theme.TextDim); } } private static TextMeshProUGUI Bonus(Transform parent, string name, string effect, float size) { //IL_0048: 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) string value = (string.IsNullOrEmpty(name) ? Escape(effect) : (Escape(name) + (string.IsNullOrEmpty(effect) ? "" : (" " + Colored(effect, Theme.TextDim))))); TextMeshProUGUI obj = Label(parent, "Bonus", value, size, Theme.Text); ((TMP_Text)obj).richText = true; return obj; } internal static float ComparisonContentWidth(float current, float required) { float num = 2f * required + 12f; if (!(num <= 428f)) { return current; } return Math.Max(current, num); } internal static float StatWidth(float required, float contentWidth = 338f) { float num = (contentWidth - 12f) / 2f; if (!(required <= num)) { return contentWidth; } return num; } private static RectTransform Stat(Transform root, TooltipStat stat, float body, float small, out float required, ref float height) { //IL_002d: 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_0078: 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_007d: 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_0108: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0160: 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) required = 0f; if (stat == null) { return null; } RectTransform val = TipParts.Stack(root, "Stat", horizontal: true, 4f); TipParts.Size((Component)(object)Label((Transform)(object)val, "Label", stat.Label, body, Theme.TextDim, wrap: false), 1f); Color color = ((!stat.Tinted) ? Theme.Text : ((stat.Amount > 0f == stat.HigherIsBetter) ? Theme.Good : Theme.Bad)); Label((Transform)(object)val, "Value", stat.Value, body, color, wrap: false); if (!string.IsNullOrEmpty(stat.Range)) { Label((Transform)(object)val, "Skill range", stat.Range, small, Theme.TextDim, wrap: false); } if (Math.Abs(stat.Comparison) >= 0.005f) { bool flag = stat.Comparison > 0f == stat.HigherIsBetter; Label((Transform)(object)val, "Comparison", ItemTooltipText.Signed(stat.Comparison) + stat.Unit, small, flag ? Theme.Good : Theme.Bad, wrap: false); } else if (Math.Abs(stat.Change) >= 0.5f) { Label((Transform)(object)val, "Upgrade", ItemTooltipText.Signed((float)Math.Round(stat.Change, MidpointRounding.AwayFromZero)) + "%", small, (stat.Change > 0f) ? Theme.Good : Theme.Bad, wrap: false); } required = 4f * (float)(((Transform)val).childCount - 1); for (int i = 0; i < ((Transform)val).childCount; i++) { TMP_Text component = ((Component)((Transform)val).GetChild(i)).GetComponent<TMP_Text>(); required += Parts.Width(component); height = Math.Max(height, component.preferredHeight); } return val; } private static void Divider(Transform root) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) Image obj = Parts.Flat("Divider", root); ((Graphic)obj).color = Theme.Line; TipParts.Size((Component)(object)obj, 1f, 0f, 1f); } private static void Icon(Transform parent, string name, Sprite sprite, Color color, float size) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) Image obj = Parts.Flat(name, parent); obj.sprite = sprite; obj.preserveAspect = true; ((Graphic)obj).color = color; TipParts.Size((Component)(object)obj, 0f, size, size).minWidth = size; } private static TextMeshProUGUI Label(Transform parent, string name, string value, float size, Color color, bool wrap = true) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) TextMeshProUGUI obj = TipParts.Label(parent, name, value, size, color, bold: false, italic: false, wrap, (TextAlignmentOptions)4097); ((TMP_Text)obj).richText = false; return obj; } private static string Escape(string text) { return (text ?? "").Replace("<", "‹").Replace(">", "›"); } private static string Colored(string text, Color color) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) return "<color=#" + ColorUtility.ToHtmlStringRGB(color) + ">" + Escape(text) + "</color>"; } } public enum ButtonSize { Normal, Compact, Large } public static class ButtonMath { public const float Glyph = 16f; public const float LegacyWidth = 144f; public const float RowWidth = 72f; public static float Height(ButtonSize s) { return s switch { ButtonSize.Large => 44f, ButtonSize.Compact => 28f, _ => 34f, }; } public static float PadX(ButtonSize s) { return s switch { ButtonSize.Large => 28f, ButtonSize.Compact => 9f, _ => 14f, }; } public static float FontSize(ButtonSize s) { return s switch { ButtonSize.Large => 18f, ButtonSize.Compact => 15f, _ => 16f, }; } public static float Gap(ButtonSize s) { if (s != ButtonSize.Compact) { return 7f; } return 6f; } public static float Width(ButtonSize s, bool square, float label, bool glyph) { if (square) { return Height(s); } float num = 2f * PadX(s) + Math.Max(0f, label); if (glyph) { num += 16f + ((label > 0f) ? Gap(s) : 0f); } return num; } } public static class ChipMath { public const float Height = 26f; public const float Border = 1f; public const float PadX = 10f; public const float Gap = 6f; public const float FontSize = 16f; public const float CountSize = 14f; public const float Radius = 6f; public static float Width(float label, float count) { return 20f + Math.Max(0f, label) + ((count > 0f) ? (6f + count) : 0f); } public static string Count(int? count) { if (!count.HasValue) { return ""; } return Math.Max(0, count.Value).ToString(CultureInfo.InvariantCulture); } } public static class PlateMath { public const float Radius = 6f; public const float Border = 1f; public const float Inset = 1f; public static void Place(float width, float height, out float x, out float y, out float w, out float h) { x = 1f; y = 1f; w = Math.Max(0f, width - 2f); h = Math.Max(0f, height - 2f); } public static bool Inside(float width, float height) { Place(width, height, out var x, out var y, out var w, out var h); if (width > 0f && height > 0f && w > 0f && h > 0f && x >= 0f && y >= 0f && x + w <= width) { return y + h <= height; } return false; } } public static class SegmentedMath { public const float Height = 26f; public const float PadX = 10f; public const float FontSize = 16f; public const float Radius = 6f; public static float SegmentWidth(float label) { return 20f + Math.Max(0f, label); } public static float Width(IList<float> labels) { float num = 0f; if (labels != null) { foreach (float label in labels) { num += SegmentWidth(label); } } return num; } public static int Clamp(int index, int count) { if (count <= 0) { return -1; } if (index >= 0) { if (index < count) { return index; } return count - 1; } return 0; } public static int IndexAt(float x, IList<float> labels) { if (labels == null || x < 0f) { return -1; } float num = 0f; for (int i = 0; i < labels.Count; i++) { float num2 = SegmentWidth(labels[i]); if (x < num + num2) { return i; } num += num2; } return -1; } public static int Step(int index, int count, int delta) { return Clamp(index + delta, count); } } public static class StepperMath { public const float ValueWidth = 30f; public const float ValueSize = 16f; public const float Gap = 6f; public static int Clamp(int value, int min, int max) { if (max < min) { max = min; } if (value >= min) { if (value <= max) { return value; } return max; } return min; } public static int Step(int value, int delta, int min, int max) { long num = (long)value + (long)delta; if (num < int.MinValue) { num = -2147483648L; } if (num > int.MaxValue) { num = 2147483647L; } return Clamp((int)num, min, max); } public static bool CanDown(int value, int min) { return value > min; } public static bool CanUp(int value, int max) { return value < max; } public static float Width(float button, bool max, float maxButton) { return button + 6f + 30f + 6f + button + (max ? (6f + maxButton) : 0f); } } public static class DialogMath { public const float Width = 420f; public const float ButtonGap = 8f; public const float RowGap = 10f; public const float BodySize = 18f; public const float CounterSize = 14f; public static List<int> ButtonOrder(IList<bool> primary) { List<int> list = new List<int>(); if (primary == null) { return list; } int num = PrimaryIndex(primary); for (int i = 0; i < primary.Count; i++) { if (i != num) { list.Add(i); } } if (num >= 0) { list.Add(num); } return list; } public static int PrimaryIndex(IList<bool> primary) { if (primary == null) { return -1; } for (int i = 0; i < primary.Count; i++) { if (primary[i]) { return i; } } return -1; } public static string Counter(int length, int max) { if (max <= 0) { return ""; } return Math.Max(0, length).ToString(CultureInfo.InvariantCulture) + " / " + max.ToString(CultureInfo.InvariantCulture); } public static bool AtLimit(int length, int max) { if (max > 0) { return length >= max; } return false; } public static string Limit(string text, int max) { text = text ?? ""; if (max <= 0 || text.Length <= max) { return text; } return text.Substring(0, max); } public static bool Accepts(string text, int max, bool required) { text = text ?? ""; if (max > 0 && text.Length > max) { return false; } if (required) { return text.Trim().Length > 0; } return true; } } public static class ToastMath { public const float Height = 32f; public const float PadX = 12f; public const float Gap = 8f; public const float FontSize = 18f; public const float Hold = 2.5f; public const float Fade = 0.4f; public static float Alpha(float age, float hold = 2.5f, float fade = 0.4f) { if (age <= hold) { return 1f; } if (fade <= 0f) { return 0f; } return Math.Max(0f, 1f - (age - hold) / fade); } public static bool Done(float age, float hold = 2.5f, float fade = 0.4f) { return age >= hold + Math.Max(0f, fade); } public static float Width(float text, bool glyph) { return 24f + Math.Max(0f, text) + (glyph ? 24f : 0f); } } public static class MenuTextMath { public const float Size = 30f; public const float LowSize = 21f; public const float Gap = 6f; public static bool Chosen(bool hover, bool focused, bool pressed) { return hover || focused || pressed; } public static float Height(int entries, int lowEntries) { int num = Math.Max(0, entries) + Math.Max(0, lowEntries); if (num == 0) { return 0f; } return (float)entries * 30f * 1.25f + (float)lowEntries * 21f * 1.25f + (float)(num - 1) * 6f; } } public static class DurationText { public static string Format(float seconds) { if (float.IsNaN(seconds) || float.IsInfinity(seconds) || seconds < 0f) { return null; } double num = Math.Round(seconds, 2, MidpointRounding.AwayFromZero); if (num < 60.0) { return WithUnit(num, "s"); } double num2 = Math.Floor(num / 60.0); if (num2 >= 60.0) { return WithUnit(Math.Floor(num2 / 60.0), "h") + Remainder(num2 % 60.0, "min"); } return WithUnit(num2, "min") + Remainder(num % 60.0, "s"); } private static string WithUnit(double value, string unit) { return value.ToString("0.##", CultureInfo.InvariantCulture) + " " + unit; } private static string Remainder(double value, string unit) { if (!(value > 0.0)) { return ""; } return " " + WithUnit(value, unit); } } public static class EquipMark { public const float Leg = 15.75f; public const float Grid = 56f; public static Action Apply(Image mark, float radius, TMP_Text number) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0090: 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_00a1: 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_00e5: 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_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0107: 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) RectTransform rt = ((Graphic)mark).rectTransform; Vector2 anchorMin = rt.anchorMin; Vector2 anchorMax = rt.anchorMax; Vector2 offsetMin = rt.offsetMin; Vector2 offsetMax = rt.offsetMax; int index = ((Transform)rt).GetSiblingIndex(); Sprite sprite = mark.sprite; Type type = mark.type; Color color = ((Graphic)mark).color; float ppu = mark.pixelsPerUnitMultiplier; float num = 9f / 32f; rt.anchorMin = new Vector2(0f, 1f - num); rt.anchorMax = new Vector2(num, 1f); RectTransform obj = rt; Vector2 offsetMin2 = (rt.offsetMax = Vector2.zero); obj.offsetMin = offsetMin2; mark.sprite = Shapes.Corner(radius, 15.75f); mark.type = (Type)0; mark.pixelsPerUnitMultiplier = 1f; ((Graphic)mark).color = Theme.Worn; ((Graphic)mark).raycastTarget = false; if ((Object)(object)number != (Object)null && (Object)(object)number.transform.parent == (Object)(object)((Transform)rt).parent && number.transform.GetSiblingIndex() < ((Transform)rt).GetSiblingIndex()) { ((Transform)rt).SetSiblingIndex(number.transform.GetSiblingIndex()); } return delegate { //IL_0016: 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_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_007c: 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) if (!((Object)(object)mark == (Object)null)) { rt.anchorMin = anchorMin; rt.anchorMax = anchorMax; rt.offsetMin = offsetMin; rt.offsetMax = offsetMax; ((Transform)rt).SetSiblingIndex(index); mark.sprite = sprite; mark.type = type; ((Graphic)mark).color = color; mark.pixelsPerUnitMultiplier = ppu; } }; } } public sealed class FocusHistory<T> where T : class { private readonly List<T> _previous = new List<T>(); public void Remember(T selection) { if (selection != null) { _previous.Remove(selection); _previous.Add(selection); } } public T Take(Func<T, bool> eligible) { for (int num = _previous.Count - 1; num >= 0; num--) { T val = _previous[num]; if (eligible(val)) { _previous.RemoveRange(num, _previous.Count - num); return val; } } return null; } public void Clear() { _previous.Clear(); } } public static class FocusRules { public static bool Preview(bool usable, bool pointer, bool focused) { if (usable) { return pointer || focused; } return false; } public static bool Takes(bool usable, bool hasAction) { return usable && hasAction; } public static bool Fires(bool usable, bool hasAction) { return Takes(usable, hasAction); } public static bool Lifts(bool hover, bool focused, bool hairline) { if (!focused) { if (hover) { return !hairline; } return false; } return true; } public static SlotEdge Edge(bool chosen, bool hit, bool focused) { return SlotMath.Edge(chosen, hit || focused); } } public static class GearEffects { public static Func<Player, KeyValuePair<string, string>[]> Read; } public static class GlyphMath { public const float Grid = 24f; public static readonly string[] Names = new string[31] { "head", "chest", "legs", "cape", "utility", "trinket", "mainhand", "offhand", "ammo", "weight", "fire", "frost", "poison", "lightning", "spirit", "blunt", "slash", "pierce", "chop", "pickaxe", "chests", "here", "restock", "merge", "sort", "lock", "unlock", "close", "diamond", "key", "keyring" }; public const float LineStroke = 1.7f; public const float EdgeStroke = 3.2f; public static readonly string[] LineNames = new string[49] { "search", "star", "list", "grid", "trash", "take", "put", "similar", "fill", "wrench", "target", "check", "plus", "minus", "caret", "left", "right", "undo", "pen", "disk", "eye", "pin", "house", "skull", "crown", "portal", "bed", "coin", "cloud", "leaf", "heading", "user", "hammer", "book", "trophy", "antler", "scroll", "cog", "fish", "medal", "swords", "ring", "bag", "lantern", "gem", "food", "mead", "starsolid", "staredge" }; public static float[][] Paths(string name) { return name switch { "head" => new float[3][] { new float[26] { 8.5f, 20.5f, 5f, 17f, 5f, 12f, 5.53f, 9.32f, 7.05f, 7.05f, 9.32f, 5.53f, 12f, 5f, 14.68f, 5.53f, 16.95f, 7.05f, 18.47f, 9.32f, 19f, 12f, 19f, 17f, 15.5f, 20.5f }, new float[4] { 5f, 13f, 19f, 13f }, new float[4] { 12f, 13f, 12f, 19.5f } }, "chest" => new float[2][] { new float[24] { 8f, 4f, 4f, 7f, 5.5f, 11f, 8f, 10f, 8f, 20f, 16f, 20f, 16f, 10f, 18.5f, 11f, 20f, 7f, 16f, 4f, 12f, 8.5f, 8f, 4f }, new float[4] { 8f, 15.5f, 16f, 15.5f } }, "legs" => new float[2][] { new float[16] { 7f, 3f, 17f, 3f, 16f, 21f, 13f, 21f, 12f, 10f, 11f, 21f, 8f, 21f, 7f, 3f }, new float[4] { 7.25f, 6.5f, 16.75f, 6.5f } }, "cape" => new float[3][] { new float[4] { 9f, 4f, 15f, 4f }, new float[14] { 9f, 4f, 5f, 20f, 8.5f, 18.5f, 12f, 20f, 15.5f, 18.5f, 19f, 20f, 15f, 4f }, new float[6] { 9f, 4f, 12f, 7.5f, 15f, 4f } }, "utility" => new float[6][] { new float[8] { 6.5f, 9.5f, 3f, 9.5f, 3f, 14.5f, 6.5f, 14.5f }, new float[26] { 10.25f, 7f, 11.13f, 7.37f, 11.5f, 8.25f, 11.5f, 15.75f, 11.13f, 16.63f, 10.25f, 17f, 7.75f, 17f, 6.87f, 16.63f, 6.5f, 15.75f, 6.5f, 8.25f, 6.87f, 7.37f, 7.75f, 7f, 10.25f, 7f }, new float[4] { 6.5f, 12f, 10.25f, 12f }, new float[10] { 11.5f, 9.5f, 18.5f, 9.5f, 21.5f, 12f, 18.5f, 14.5f, 11.5f, 14.5f }, new float[4] { 14.75f, 12f, 14.76f, 12f }, new float[4] { 17.75f, 12f, 17.76f, 12f } }, "trinket" => new float[2][] { new float[6] { 5.5f, 3.5f, 12f, 11f, 18.5f, 3.5f }, new float[10] { 12f, 11f, 15.5f, 15.5f, 12f, 20.5f, 8.5f, 15.5f, 12f, 11f } }, "mainhand" => new float[3][] { new float[4] { 8f, 16f, 20f, 4f }, new float[4] { 5f, 13f, 11f, 19f }, new float[4] { 4f, 20f, 6.5f, 17.5f } }, "offhand" => new float[2][] { new float[18] { 12f, 3f, 19f, 5.5f, 19f, 11.5f, 17.5f, 16f, 12f, 21f, 6.5f, 16f, 5f, 11.5f, 5f, 5.5f, 12f, 3f }, Circle(12f, 11f, 2.25f) }, "ammo" => new float[4][] { new float[4] { 4.5f, 19.5f, 19.5f, 4.5f }, new float[6] { 13.5f, 4.5f, 19.5f, 4.5f, 19.5f, 10.5f }, new float[4] { 8f, 16f, 4f, 16f }, new float[4] { 8f, 16f, 8f, 20f } }, "weight" => new float[2][] { new float[10] { 6.5f, 10f, 17.5f, 10f, 20.5f, 20.5f, 3.5f, 20.5f, 6.5f, 10f }, Circle(12f, 6.25f, 2.75f) }, "fire" => new float[2][] { new float[28] { 12f, 2.5f, 14.5f, 6f, 17.5f, 9.5f, 18.5f, 13.5f, 17.5f, 17.5f, 15f, 20.5f, 12f, 21.5f, 9f, 20.5f, 6.5f, 17.5f, 5.5f, 13.5f, 6.5f, 10f, 8.5f, 12.5f, 9.5f, 8.5f, 12f, 2.5f }, new float[14] { 12f, 11.5f, 14.5f, 15f, 13.75f, 17.5f, 12f, 18.25f, 10.25f, 17.5f, 9.5f, 15.25f, 12f, 11.5f } }, "frost" => new float[12][] { new float[4] { 12f, 12f, 12f, 3f }, new float[6] { 9.75f, 5f, 12f, 7.25f, 14.25f, 5f }, new float[4] { 12f, 12f, 19.79f, 7.5f }, new float[6] { 16.94f, 6.55f, 16.11f, 9.62f, 19.19f, 10.45f }, new float[4] { 12f, 12f, 19.79f, 16.5f }, new float[6] { 19.19f, 13.55f, 16.11f, 14.38f, 16.94f, 17.45f }, new float[4] { 12f, 12f, 12f, 21f }, new float[6] { 14.25f, 19f, 12f, 16.75f, 9.75f, 19f }, new float[4] { 12f, 12f, 4.21f, 16.5f }, new float[6] { 7.06f, 17.45f, 7.89f, 14.38f, 4.81f, 13.55f }, new float[4] { 12f, 12f, 4.21f, 7.5f }, new float[6] { 4.81f, 10.45f, 7.89f, 9.62f, 7.06f, 6.55f } }, "poison" => new float[2][] { new float[28] { 12f, 3f, 17.2f, 12f, 17.94f, 14.15f, 17.83f, 16.41f, 16.89f, 18.48f, 15.24f, 20.05f, 13.14f, 20.89f, 10.86f, 20.89f, 8.76f, 20.05f, 7.11f, 18.48f, 6.17f, 16.41f, 6.06f, 14.15f, 6.8f, 12f, 12f, 3f }, Circle(12f, 15.25f, 2.25f) }, "lightning" => new float[1][] { new float[14] { 13.5f, 2.5f, 6f, 13.5f, 11.5f, 13.5f, 10f, 21.5f, 18f, 10f, 12.5f, 10f, 13.5f, 2.5f } }, "spirit" => new float[3][] { new float[34] { 6f, 20.5f, 6f, 11f, 6.46f, 8.7f, 7.76f, 6.76f, 9.7f, 5.46f, 12f, 5f, 14.3f, 5.46f, 16.24f, 6.76f, 17.54f, 8.7f, 18f, 11f, 18f, 20.5f, 16f, 18.5f, 14f, 20.5f, 12f, 18.5f, 10f, 20.5f, 8f, 18.5f, 6f, 20.5f }, new float[4] { 9.75f, 10.25f, 9.75f, 12.5f }, new float[4] { 14.25f, 10.25f, 14.25f, 12.5f } }, "blunt" => new float[5][] { Circle(14.5f, 9.5f, 4f), new float[4] { 11.7f, 12.3f, 4f, 20f }, new float[4] { 17.33f, 6.67f, 19.5f, 4.5f }, new float[4] { 17.33f, 12.33f, 19.5f, 14.5f }, new float[4] { 11.67f, 6.67f, 9.5f, 4.5f } }, "slash" => new float[3][] { new float[14] { 13.19f, 19.73f, 13.68f, 18.18f, 14.45f, 16.75f, 15.49f, 15.49f, 16.75f, 14.45f, 18.18f, 13.68f, 19.73f, 13.19f }, new float[14] { 8.78f, 18.8f, 9.53f, 16.42f, 10.72f, 14.23f, 12.31f, 12.31f, 14.23f, 10.72f, 16.42f, 9.53f, 18.8f, 8.78f }, new float[14] { 4.38f, 17.86f, 5.39f, 14.66f, 6.99f, 11.71f, 9.13f, 9.13f, 11.71f, 6.99f, 14.66f, 5.39f, 17.86f, 4.38f } }, "pierce" => new float[3][] { new float[10] { 12f, 2.5f, 15.5f, 8f, 12f, 12f, 8.5f, 8f, 12f, 2.5f }, new float[4] { 12f, 12f, 12f, 21.5f }, new float[4] { 9.5f, 14.5f, 14.5f, 14.5f } }, "chop" => new float[3][] { new float[4] { 10.53f, 3.69f, 19.07f, 18.47f }, new float[32] { 10.65f, 3.89f, 7.96f, 5.01f, 5.49f, 5.54f, 2.79f, 5.66f, 2.48f, 6.95f, 2.41f, 8.29f, 2.61f, 9.6f, 3.05f, 10.86f, 3.71f, 12f, 4.58f, 13.01f, 5.62f, 13.83f, 6.81f, 14.44f, 8.08f, 14.82f, 8.95f, 11.54f, 10.22f, 8.92f, 12.34f, 6.81f }, new float[8] { 10.53f, 3.69f, 13.03f, 2.25f, 14.95f, 5.58f, 12.45f, 7.02f } }, "pickaxe" => new float[2][] { new float[22] { 3.4f, 9.48f, 4.71f, 7.95f, 6.28f, 6.69f, 8.07f, 5.76f, 10f, 5.19f, 12f, 5f, 14f, 5.19f, 15.93f, 5.76f, 17.72f, 6.69f, 19.29f, 7.95f, 20.6f, 9.48f }, new float[4] { 12f, 5f, 12f, 21.5f } }, "chests" => new float[5][] { new float[10] { 4f, 21f, 4f, 13f, 20f, 13f, 20f, 21f, 4f, 21f }, new float[12] { 4f, 13f, 4f, 11.5f, 5.5f, 10f, 18.5f, 10f, 20f, 11.5f, 20f, 13f }, new float[4] { 12f, 13f, 12f, 16.5f }, new float[4] { 12f, 2.5f, 12f, 7f }, new float[6] { 9.5f, 4.75f, 12f, 7.25f, 14.5f, 4.75f } }, "here" => new float[3][] { new float[4] { 12f, 3f, 12f, 14.5f }, new float[6] { 7.5f, 10f, 12f, 14.5f, 16.5f, 10f }, new float[4] { 4f, 19.5f, 20f, 19.5f } }, "restock" => new float[5][] { new float[10] { 4f, 21f, 4f, 13f, 20f, 13f, 20f, 21f, 4f, 21f }, new float[12] { 4f, 13f, 4f, 11.5f, 5.5f, 10f, 18.5f, 10f, 20f, 11.5f, 20f, 13f }, new float[4] { 12f, 13f, 12f, 16.5f }, new float[4] { 12f, 7.5f, 12f, 2.75f }, new float[6] { 9.5f, 5.25f, 12f, 2.75f, 14.5f, 5.25f } }, "merge" => new float[6][] { new float[26] { 6.75f, 3f, 7.63f, 3.37f, 8f, 4.25f, 8f, 7.25f, 7.63f, 8.13f, 6.75f, 8.5f, 3.75f, 8.5f, 2.87f, 8.13f, 2.5f, 7.25f, 2.5f, 4.25f, 2.87f, 3.37f, 3.75f, 3f, 6.75f, 3f }, new float[26] { 6.75f, 15.5f, 7.63f, 15.87f, 8f, 16.75f, 8f, 19.75f, 7.63f, 20.63f, 6.75f, 21f, 3.75f, 21f, 2.87f, 20.63f, 2.5f, 19.75f, 2.5f, 16.75f, 2.87f, 15.87f, 3.75f, 15.5f, 6.75f, 15.5f }, new float[6] { 10f, 6f, 13.5f, 12f, 10f, 18f }, new float[26] { 20.25f, 4.5f, 21.13f, 4.87f, 21.5f, 5.75f, 21.5f, 18.25f, 21.13f, 19.13f, 20.25f, 19.5f, 16.75f, 19.5f, 15.87f, 19.13f, 15.5f, 18.25f, 15.5f, 5.75f, 15.87f, 4.87f, 16.75f, 4.5f, 20.25f, 4.5f }, new float[4] { 15.5f, 9.5f, 21.5f, 9.5f }, new float[4] { 15.5f, 14.5f, 21.5f, 14.5f } }, "sort" => new float[5][] { new float[4] { 6f, 4f, 6f, 20f }, new float[6] { 3f, 17f, 6f, 20f, 9f, 17f }, new float[4] { 12f, 6f, 15f, 6f }, new float[4] { 12f, 12f, 18f, 12f }, new float[4] { 12f, 18f, 21f, 18f } }, "lock" => new float[3][] { new float[26] { 17f, 11f, 18.41f, 11.59f, 19f, 13f, 19f, 19f, 18.41f, 20.41f, 17f, 21f, 7f, 21f, 5.59f, 20.41f, 5f, 19f, 5f, 13f, 5.59f, 11.59f, 7f, 11f, 17f, 11f }, new float[22] { 8f, 11f, 8f, 8f, 8.3f, 6.47f, 9.17f, 5.17f, 10.47f, 4.3f, 12f, 4f, 13.53f, 4.3f, 14.83f, 5.17f, 15.7f, 6.47f, 16f, 8f, 16f, 11f }, new float[4] { 12f, 14.5f, 12f, 17.5f } }, "unlock" => new float[3][] { Paths("lock")[0], new float[22] { 11f, 6.5f, 11f, 6f, 11.3f, 4.47f, 12.17f, 3.17f, 13.47f, 2.3f, 15f, 2f, 16.53f, 2.3f, 17.83f, 3.17f, 18.7f, 4.47f, 19f, 6f, 19f, 11f }, Paths("lock")[2] }, "close" => new float[2][] { new float[4] { 6.5f, 6.5f, 17.5f, 17.5f }, new float[4] { 17.5f, 6.5f, 6.5f, 17.5f } }, "diamond" => new float[2][] { new float[10] { 12f, 3f, 21f, 12f, 12f, 21f, 3f, 12f, 12f, 3f }, new float[10] { 12f, 8.5f, 15.5f, 12f, 12f, 15.5f, 8.5f, 12f, 12f, 8.5f } }, "key" => new float[4][] { Circle(8f, 8f, 4.5f), new float[4] { 11.25f, 11.25f, 20f, 20f }, new float[4] { 17f, 17f, 19.5f, 14.5f }, new float[4] { 14f, 14f, 16f, 12f } }, "keyring" => new float[5][] { Circle(8f, 8f, 5f), Circle(13.75f, 13.75f, 3f), new float[4] { 15.9f, 15.9f, 21f, 21f }, new float[4] { 19f, 19f, 21f, 17f }, new float[4] { 16.9f, 16.9f, 18.4f, 15.4f } }, _ => Lines(name), }; } internal static float[] Circle(float cx, float cy, float r) { float[] array = new float[42]; for (int i = 0; i <= 20; i++) { double num = (double)i * Math.PI * 2.0 / 20.0; array[i * 2] = cx + (float)Math.Cos(num) * r; array[i * 2 + 1] = cy + (float)Math.Sin(num) * r; } return array; } public static byte[] Rasterize(string name, int size, float stroke) { float[][] array = Paths(name); bool flag = Solid(name); float num = (float)size / 24f; float num2 = stroke * num / 2f; byte[] array2 = new byte[size * size]; for (int i = 0; i < size; i++) { for (int j = 0; j < size; j++) { float num3 = float.MaxValue; float[][] array3 = array; foreach (float[] array4 in array3) { for (int l = 0; l + 3 < array4.Length; l += 2) { float num4 = Segment(((float)j + 0.5f) / num, ((float)i + 0.5f) / num, array4[l], array4[l + 1], array4[l + 2], array4[l + 3]); if (num4 < num3) { num3 = num4; } } } float num5 = Math.Max(0f, Math.Min(1f, num2 - num3 * num + 0.5f)); if (flag && Inside(((float)j + 0.5f) / num, ((float)i + 0.5f) / num, array[0])) { num5 = 1f; } array2[i * size + j] = (byte)(num5 * 255f + 0.5f); } } return array2; } public static bool Solid(string name) { if (!(name == "starsolid")) { return name == "staredge"; } return true; } public static float StrokeOf(string name) { if (!(name == "staredge")) { return 1.7f; } return 3.2f; } public static bool Inside(float px, float py, float[] path) { bool flag = false; int i = 0; int num = path.Length - 2; for (; i + 1 < path.Length; i += 2) { float num2 = path[i]; float num3 = path[i + 1]; float num4 = path[num]; float num5 = path[num + 1]; if (num3 > py != num5 > py && px < (num4 - num2) * (py - num3) / (num5 - num3) + num2) { flag = !flag; } num = i; } return flag; } public static float Segment(float px, float py, float ax, float ay, float bx, float by) { float num = bx - ax; float num2 = by - ay; float num3 = num * num + num2 * num2; float num4 = ((num3 <= 0f) ? 0f : Math.Max(0f, Math.Min(1f, ((px - ax) * num + (py - ay) * num2) / num3))); float num5 = ax + num * num4 - px; float num6 = ay + num2 * num4 - py; return (float)Math.Sqrt(num5 * num5 + num6 * num6); } private static float[][] Lines(string name) { switch (name) { case "heading": return new float[1][] { new float[10] { 12f, 3f, 4.5f, 20f, 12f, 16f, 19.5f, 20f, 12f, 3f } }; case "search": return new float[2][] { Circle(10.5f, 10.5f, 6f), new float[4] { 15f, 15f, 20.5f, 20.5f } }; case "star": case "starsolid": case "staredge": return new float[1][] { new float[22] { 12f, 3.5f, 14.35f, 9.51f, 20.8f, 9.89f, 15.8f, 13.99f, 17.44f, 20.23f, 12f, 16.75f, 6.56f, 20.23f, 8.2f, 13.99f, 3.2f, 9.89f, 9.65f, 9.51f, 12f, 3.5f } }; case "list": return new float[6][] { new float[4] { 9f, 6f, 20f, 6f }, new float[4] { 9f, 12f, 20f, 12f }, new float[4] { 9f, 18f, 20f, 18f }, new float[4] { 4.5f, 6f, 4.51f, 6f }, new float[4] { 4.5f, 12f, 4.51f, 12f }, new float[4] { 4.5f, 18f, 4.51f, 18f } }; case "grid": return new float[4][] { new float[26] { 9.25f, 4f, 10.13f, 4.37f, 10.5f, 5.25f, 10.5f, 9.25f, 10.13f, 10.13f, 9.25f, 10.5f, 5.25f, 10.5f, 4.37f, 10.13f, 4f, 9.25f, 4f, 5.25f, 4.37f, 4.37f, 5.25f, 4f, 9.25f, 4f }, new float[26] { 18.75f, 4f, 19.63f, 4.37f, 20f, 5.25f, 20f, 9.25f, 19.63f, 10.13f, 18.75f, 10.5f, 14.75f, 10.5f, 13.87f, 10.13f, 13.5f, 9.25f, 13.5f, 5.25f, 13.87f, 4.37f, 14.75f, 4f, 18.75f, 4f }, new float[26] { 9.25f, 13.5f, 10.13f, 13.87f, 10.5f, 14.75f, 10.5f, 18.75f, 10.13f, 19.63f, 9.25f, 20f, 5.25f, 20f, 4.37f, 19.63f, 4f, 18.75f, 4f, 14.75f, 4.37f, 13.87f, 5.25f, 13.5f, 9.25f, 13.5f }, new float[26] { 18.75f, 13.5f, 19.63f, 13.87f, 20f, 14.75f, 20f, 18.75f, 19.63f, 19.63f, 18.75f, 20f, 14.75f, 20f, 13.87f, 19.63f, 13.5f, 18.75f, 13.5f, 14.75f, 13.87f, 13.87f, 14.75f, 13.5f, 18.75f, 13.5f } }; case "trash": return new float[5][] { new float[4] { 4f, 7f, 20f, 7f }, new float[8] { 9.5f, 7f, 9.5f, 4f, 14.5f, 4f, 14.5f, 7f }, new float[16] { 6f, 7f, 7f, 19f, 7.59f, 20.41f, 9f, 21f, 15f, 21f, 16.41f, 20.41f, 17f, 19f, 18f, 7f }, new float[4] { 10f, 10.5f, 10.25f, 17f }, new float[4] { 14f, 10.5f, 13.75f, 17f } }; case "take": return new float[3][] { new float[4] { 12f, 15f, 12f, 3.5f }, new float[6] { 8f, 7.5f, 12f, 3.5f, 16f, 7.5f }, new float[16] { 4f, 14f, 4f, 18.5f, 4.44f, 19.56f, 5.5f, 20f, 18.5f, 20f, 19.56f, 19.56f, 20f, 18.5f, 20f, 14f } }; case "put": return new float[3][] { new float[4] { 12f, 3.5f, 12f, 15f }, new float[6] { 8f, 11f, 12f, 15f, 16f, 11f }, new float[16] { 4f, 14f, 4f, 18.5f, 4.44f, 19.56f, 5.5f, 20f, 18.5f, 20f, 19.56f, 19.56f, 20f, 18.5f, 20f, 14f } }; case "similar": return new float[2][] { new float[26] { 12f, 3.5f, 13.06f, 3.94f, 13.5f, 5f, 13.5f, 12f, 13.06f, 13.06f, 12f, 13.5f, 5f, 13.5f, 3.94f, 13.06f, 3.5f, 12f, 3.5f, 5f, 3.94f, 3.94f, 5f, 3.5f, 12f, 3.5f }, new float[16] { 16.5f, 10.5f, 19f, 10.5f, 20.5f, 12f, 20.5f, 19f, 19f, 20.5f, 12f, 20.5f, 10.5f, 19f, 10.5f, 16.5f } }; case "fill": return new float[3][] { new float[26] { 17f, 3.5f, 18.41f, 4.09f, 19f, 5.5f, 19f, 18.5f, 18.41f, 19.91f, 17f, 20.5f, 7f, 20.5f, 5.59f, 19.91f, 5f, 18.5f, 5f, 5.5f, 5.59f, 4.09f, 7f, 3.5f, 17f, 3.5f }, new float[4] { 5f, 12f, 19f, 12f }, new float[4] { 8.5f, 16f, 15.5f, 16f } }; case "wrench": return new float[1][] { new float[36] { 19.95f, 6.52f, 17.13f, 9.35f, 14.65f, 6.87f, 17.48f, 4.05f, 15.18f, 3.16f, 12.71f, 4.22f, 11.29f, 6.7f, 12f, 9.53f, 4.93f, 16.6f, 4.41f, 17.83f, 4.93f, 19.07f, 6.17f, 19.59f, 7.4f, 19.07f, 14.47f, 12f, 17.3f, 12.71f, 19.78f, 11.29f, 20.84f, 8.82f, 19.95f, 6.52f } }; case "target": return new float[6][] { Circle(12f, 12f, 7.5f), Circle(12f, 12f, 2.75f), new float[4] { 12f, 2.5f, 12f, 5f }, new float[4] { 12f, 19f, 12f, 21.5f }, new float[4] { 2.5f, 12f, 5f, 12f }, new float[4] { 19f, 12f, 21.5f, 12f } }; case "check": return new float[1][] { new float[6] { 5f, 12.5f, 10f, 17.5f, 19f, 7f } }; case "plus": return new float[2][] { new float[4] { 12f, 5f, 12f, 19f }, new float[4] { 5f, 12f, 19f, 12f } }; case "minus": return new float[1][] { new float[4] { 5f, 12f, 19f, 12f } }; case "caret": return new float[1][] { new float[6] { 6f, 9f, 12f, 15f, 18f, 9f } }; case "left": return new float[1][] { new float[6] { 14.5f, 5f, 7.5f, 12f, 14.5f, 19f } }; case "right": return new float[1][] { new float[6] { 9.5f, 5f, 16.5f, 12f, 9.5f, 19f } }; case "undo": return new float[2][] { new float[22] { 7.5f, 7f, 12.5f, 7f, 14.8f, 7.46f, 16.74f, 8.76f, 18.04f, 10.7f, 18.5f, 13f, 18.04f, 15.3f, 16.74f, 17.24f, 14.8f, 18.54f, 12.5f, 19f, 8f, 19f }, new float[6] { 10.5f, 4f, 7.5f, 7f, 10.5f, 10f } }; case "pen": return new float[2][] { new float[12] { 4.5f, 19.5f, 5.5f, 15.5f, 15.5f, 5.5f, 18.5f, 8.5f, 8.5f, 18.5f, 4.5f, 19.5f }, new float[4] { 13.25f, 7.75f, 16.25f, 10.75f } }; case "disk": return new float[3][] { new float[18] { 4f, 5.5f, 5.5f, 4f, 17f, 4f, 20f, 7f, 20f, 18.5f, 18.5f, 20f, 5.5f, 20f, 4f, 18.5f, 4f, 5.5f }, new float[8] { 8f, 4f, 8f, 8.5f, 15f, 8.5f, 15f, 4f }, new float[8] { 7.5f, 20f, 7.5f, 14f, 16.5f, 14f, 16.5f, 20f } }; case "eye": return new float[2][] { new float[26] { 2.5f, 12f, 5.5f, 8.5f, 9f, 6.5f, 12f, 6f, 15f, 6.5f, 18.5f, 8.5f, 21.5f, 12f, 18.5f, 15.5f, 15f, 17.5f, 12f, 18f, 9f, 17.5f, 5.5f, 15.5f, 2.5f, 12f }, Circle(12f, 12f, 2.75f) }; case "pin": return new float[2][] { new float[28] { 12f, 21.5f, 17.12f, 13.13f, 17.92f, 10.98f, 17.85f, 8.68f, 16.93f, 6.58f, 15.28f, 4.97f, 13.15f, 4.11f, 10.85f, 4.11f, 8.72f, 4.97f, 7.07f, 6.58f, 6.15f, 8.68f, 6.08f, 10.98f, 6.88f, 13.13f, 12f, 21.5f }, Circle(12f, 10f, 2.25f) }; case "house": return new float[3][] { new float[6] { 3.5f, 12f, 12f, 4f, 20.5f, 12f }, new float[8] { 6f, 10f, 6f, 20f, 18f, 20f, 18f, 10f }, new float[8] { 10f, 20f, 10f, 15f, 14f, 15f, 14f, 20f } }; case "skull": return new float[4][] { new float[40] { 6.64f, 15f, 5.42f, 12.89f, 5f, 10.5f, 5.42f, 8.11f, 6.64f, 6f, 8.5f, 4.44f, 10.78f, 3.61f, 13.22f, 3.61f, 15.5f, 4.44f, 17.36f, 6f, 18.58f, 8.11f, 19f, 10.5f, 18.58f, 12.89f, 17.36f, 15f, 17.4f, 15f, 16f, 16.5f, 16f, 20f, 8f, 20f, 8f, 16.5f, 6.64f, 15f }, Circle(9.25f, 11f, 1.6f), Circle(14.75f, 11f, 1.6f), new float[4] { 12f, 20f, 12f, 17.75f } }; case "crown": return new float[2][] { new float[4] { 4f, 19.5f, 20f, 19.5f }, new float[16] { 4.5f, 16f, 3.5f, 7.5f, 8f, 11.5f, 12f, 4.5f, 16f, 11.5f, 20.5f, 7.5f, 19.5f, 16f, 4.5f, 16f } }; case "portal": return new float[3][] { new float[22] { 5.5f, 20.5f, 5.5f, 10.5f, 5.99f, 8.01f, 7.4f, 5.9f, 9.51f, 4.49f, 12f, 4f, 14.49f, 4.49f, 16.6f, 5.9f, 18.01f, 8.01f, 18.5f, 10.5f, 18.5f, 20.5f }, new float[22] { 9f, 20.5f, 9f, 13f, 9.23f, 11.85f, 9.88f, 10.88f, 10.85f, 10.23f, 12f, 10f, 13.15f, 10.23f, 14.12f, 10.88f, 14.77f, 11.85f, 15f, 13f, 15f, 20.5f }, new float[4] { 3f, 20.5f, 21f, 20.5f } }; case "bed": return new float[4][] { new float[4] { 3.5f, 6.5f, 3.5f, 19.5f }, new float[6] { 3.5f, 15f, 20.5f, 15f, 20.5f, 19.5f }, new float[26] { 9f, 10.5f, 9.71f, 10.79f, 10f, 11.5f, 10f, 14f, 9.71f, 14.71f, 9f, 15f, 6.5f, 15f, 5.79f, 14.71f, 5.5f, 14f, 5.5f, 11.5f, 5.79f, 10.79f, 6.5f, 10.5f, 9f, 10.5f }, new float[10] { 12f, 15f, 12f, 11f, 19f, 11f, 20.5f, 12.5f, 20.5f, 15f } }; case "coin": return new float[6][] { new float[34] { 19f, 7f, 18.47f, 8.15f, 16.95f, 9.12f, 14.68f, 9.77f, 12f, 10f, 9.32f, 9.77f, 7.05f, 9.12f, 5.53f, 8.15f, 5f, 7f, 5.53f, 5.85f, 7.05f, 4.88f, 9.32f, 4.23f, 12f, 4f, 14.68f, 4.23f, 16.95f, 4.88f, 18.47f, 5.85f, 19f, 7f }, new float[4] { 5f, 7f, 5f, 17f }, new float[4] { 19f, 7f, 19f, 17f }, new float[18] { 19f, 10.5f, 18.47f, 11.65f, 16.95f, 12.62f, 14.68f, 13.27f, 12f, 13.5f, 9.32f, 13.27f, 7.05f, 12.62f, 5.53f, 11.65f, 5f, 10.5f }, new float[18] { 19f, 14f, 18.47f, 15.15f, 16.95f, 16.12f, 14.68f, 16.77f, 12f, 17f, 9.32f, 16.77f, 7.05f, 16.12f, 5.53f, 15.15f, 5f, 14f }, new float[18] { 19f, 17f, 18.47f, 18.15f, 16.95f, 19.12f, 14.68f, 19.77f, 12f, 20f, 9.32f, 19.77f, 7.05f, 19.12f, 5.53f, 18.15f, 5f, 17f } }; case "cloud": return new float[1][] { new float[50] { 8f, 18f, 6.8f, 17.79f, 5.75f, 17.18f, 4.97f, 16.25f, 4.55f, 15.11f, 4.55f, 13.89f, 4.97f, 12.75f, 5.75f, 11.82f, 7.97f, 9.89f, 9.07f, 8.36f, 10.65f, 7.35f, 12.5f, 7f, 14.35f, 7.35f, 15.93f, 8.36f, 17.03f, 9.89f, 17.7f, 11.21f, 18.75f, 11.82f, 19.53f, 12.75f, 19.95f, 13.89f, 19.95f, 15.11f, 19.53f, 16.25f, 18.75f, 17.18f, 17.7f, 17.79f, 16.5f, 18f, 8f, 18f } }; case "leaf": return new float[4][] { new float[34] { 5f, 19f, 8.3f, 18.68f, 11.38f, 18.12f, 14.03f, 17.16f, 16.14f, 15.64f, 17.66f, 13.53f, 18.62f, 10.88f, 19.18f, 7.8f, 19.5f, 4.5f, 16.2f, 4.82f, 13.12f, 5.38f, 10.47f, 6.34f, 8.36f, 7.86f, 6.84f, 9.97f, 5.88f, 12.62f, 5.32f, 15.7f, 5f, 19f }, new float[4] { 5f, 19f, 15f, 9f }, new float[4] { 9.5f, 14.5f, 9.5f, 11f }, new float[4] { 12.5f, 11.5f, 15.5f, 11.75f } }; case "user": return new float[2][] { Circle(12f, 8f, 4f), new float[18] { 4.5f, 21f, 5.07f, 18.13f, 6.7f, 15.7f, 9.13f, 14.07f, 12f, 13.5f, 14.87f, 14.07f, 17.3f, 15.7f, 18.93f, 18.13f, 19.5f, 21f } }; case "hammer": return new float[2][] { new float[26] { 21.41f, 9.53f, 21.75f, 10.35f, 21.41f, 11.18f, 18.77f, 13.81f, 17.94f, 14.16f, 17.12f, 13.81f, 10.19f, 6.88f, 9.84f, 6.06f, 10.19f, 5.23f, 12.82f, 2.59f, 13.65f, 2.25f, 14.47f, 2.59f, 21.41f, 9.53f }, new float[4] { 13.65f, 10.35f, 5.4f, 18.6f } }; case "book": return new float[2][] { new float[22] { 12f, 6f, 8f, 4.5f, 3.5f, 4.5f, 3.5f, 18.5f, 8f, 18.5f, 12f, 20f, 16f, 18.5f, 20.5f, 18.5f, 20.5f, 4.5f, 16f, 4.5f, 12f, 6f }, new float[4] { 12f, 6f, 12f, 20f } }; case "trophy": return new float[6][] { new float[24] { 7.5f, 4f, 16.5f, 4f, 16.5f, 9f, 16.16f, 10.72f, 15.18f, 12.18f, 13.72f, 13.16f, 12f, 13.5f, 10.28f, 13.16f, 8.82f, 12.18f, 7.84f, 10.72f, 7.5f, 9f, 7.5f, 4f }, new float[8] { 7.5f, 6f, 4.5f, 6f, 4.5f, 8f, 7.75f, 11f }, new float[8] { 16.5f, 6f, 19.5f, 6f, 19.5f, 8f, 16.25f, 11f }, new float[4] { 12f, 13.5f, 12f, 17.5f }, new float[4] { 8f, 20f, 16f, 20f }, new float[8] { 9.5f, 20f, 10f, 17.5f, 14f, 17.5f, 14.5f, 20f } }; case "antler": return new float[7][] { new float[10] { 10f, 20.5f, 7.5f, 17f, 5.5f, 13f, 4.5f, 8.5f, 4.5f, 3.5f }, new float[4] { 6.25f, 15f, 9.5f, 11f }, new float[4] { 4.75f, 10f, 7.75f, 6f }, new float[10] { 14f, 20.5f, 16.5f, 17f, 18.5f, 13f, 19.5f, 8.5f, 19.5f, 3.5f }, new float[4] { 17.75f, 15f, 14.5f, 11f }, new float[4] { 19.25f, 10f, 16.25f, 6f }, new float[4] { 10f, 20.5f, 14f, 20.5f } }; case "scroll": return new float[6][] { new float[26] { 18.75f, 3.5f, 19.99f, 4.01f, 20.5f, 5.25f, 20.5f, 5.25f, 19.99f, 6.49f, 18.75f, 7f, 5.25f, 7f, 4.01f, 6.49f, 3.5f, 5.25f, 3.5f, 5.25f, 4.01f, 4.01f, 5.25f, 3.5f, 18.75f, 3.5f }, new float[26] { 18.75f, 17f, 19.99f, 17.51f, 20.5f, 18.75f, 20.5f, 18.75f, 19.99f, 19.99f, 18.75f, 20.5f, 5.25f, 20.5f, 4.01f, 19.99f, 3.5f, 18.75f, 3.5f, 18.75f, 4.01f, 17.51f, 5.25f, 17f, 18.75f, 17f }, new float[4] { 6f, 7f, 6f, 17f }, new float[4] { 18f, 7f, 18f, 17f }, new float[4] { 9f, 10.75f, 15f, 10.75f }, new float[4] { 9f, 13.75f, 13.5f, 13.75f } }; case "cog": return new float[2][] { new float[66] { 18.68f, 13f, 20.96f, 14.32f, 19.97f, 16.69f, 17.43f, 16.02f, 16.02f, 17.43f, 16.69f, 19.97f, 14.32f, 20.96f, 13f, 18.68f, 11f, 18.68f, 9.68f, 20.96f, 7.31f, 19.97f, 7.98f, 17.43f, 6.57f, 16.02f, 4.03f, 16.69f, 3.04f, 14.32f, 5.32f, 13f, 5.32f, 11f, 3.04f, 9.68f, 4.03f, 7.31f, 6.57f, 7.98f, 7.98f, 6.57f, 7.31f, 4.03f, 9.68f, 3.04f, 11f, 5.32f, 13f, 5.32f, 14.32f, 3.04f, 16.69f, 4.03f, 16.02f, 6.57f, 17.43f, 7.98f, 19.97f, 7.31f, 20.96f, 9.68f, 18.68f, 11f, 18.68f, 13f }, Circle(12f, 12f, 2.75f) }; case "fish": return new float[4][] { new float[16] { 19f, 12f, 14.5f, 8f, 8.5f, 8.5f, 6f, 11f, 6f, 13f, 8.5f, 15.5f, 14.5f, 16f, 19f, 12f }, new float[4] { 6f, 11f, 3f, 7.5f }, new float[4] { 6f, 13f, 3f, 16.5f }, new float[4] { 15f, 11.2f, 15.01f, 11.2f } }; case "medal": return new float[3][] { Circle(12f, 9.25f, 4.5f), new float[6] { 9.6f, 13.4f, 8f, 20.5f, 11.2f, 16.8f }, new float[6] { 14.4f, 13.4f, 16f, 20.5f, 12.8f, 16.8f } }; case "swords": return new float[6][] { new float[4] { 4.5f, 4.5f, 15f, 15f }, new float[4] { 13f, 17f, 17f, 13f }, new float[4] { 15f, 15f, 19.5f, 19.5f }, new float[4] { 19.5f, 4.5f, 9f, 15f }, new float[4] { 11f, 17f, 7f, 13f }, new float[4] { 9f, 15f, 4.5f, 19.5f } }; case "ring": return new float[2][] { Circle(12f, 14.5f, 5.5f), new float[8] { 9.5f, 9.5f, 12f, 5f, 14.5f, 9.5f, 9.5f, 9.5f } }; case "bag": return new float[3][] { new float[8] { 9.5f, 8f, 8f, 4f, 16f, 4f, 14.5f, 8f }, new float[4] { 8.5f, 8f, 15.5f, 8f }, new float[16] { 9.5f, 8f, 6f, 12f, 5f, 16.5f, 7f, 20f, 17f, 20f, 19f, 16.5f, 18f, 12f, 14.5f, 8f } }; case "lantern": return new float[4][] { new float[10] { 8.5f, 8f, 15.5f, 8f, 16.5f, 18f, 7.5f, 18f, 8.5f, 8f }, new float[18] { 9.5f, 8f, 9.5f, 6.5f, 9.83f, 5.25f, 10.75f, 4.33f, 12f, 4f, 13.25f, 4.33f, 14.17f, 5.25f, 14.5f, 6.5f, 14.5f, 8f }, new float[4] { 6.5f, 20.5f, 17.5f, 20.5f }, new float[4] { 12f, 11.5f, 12f, 14.5f } }; case "gem": return new float[4][] { new float[12] { 7f, 5f, 17f, 5f, 21f, 10f, 12f, 20.5f, 3f, 10f, 7f, 5f }, new float[4] { 3f, 10f, 21f, 10f }, new float[6] { 9.5f, 10f, 12f, 20.5f, 14.5f, 10f }, new float[6] { 9.5f, 10f, 12f, 5f, 14.5f, 10f } }; case "food": return new float[4][] { new float[30] { 16f, 16f, 8.87f, 15.22f, 6.82f, 14.59f, 5.15f, 13.26f, 4.08f, 11.41f, 3.75f, 9.29f, 4.23f, 7.2f, 5.43f, 5.43f, 7.2f, 4.23f, 9.29f, 3.75f, 11.41f, 4.08f, 13.26f, 5.15f, 14.59f, 6.82f, 15.22f, 8.87f, 16f, 16f }, new float[4] { 16f, 16f, 18.25f, 18.25f }, Circle(19.6f, 17.6f, 1.5f), Circle(17.6f, 19.6f, 1.5f) }; case "mead": return new float[4][] { new float[8] { 6.5f, 9f, 7f, 20f, 15f, 20f, 15.5f, 9f }, new float[50] { 6f, 9.5f, 6f, 8f, 6.12f, 7.36f, 6.47f, 6.81f, 6.99f, 6.42f, 7.62f, 6.25f, 8.27f, 6.33f, 8.84f, 6.63f, 9.27f, 7.12f, 9.27f, 6f, 9.71f, 5.47f, 10.32f, 5.12f, 11f, 5f, 11.68f, 5.12f, 12.29f, 5.47f, 12.73f, 6f, 12.73f, 7.12f, 13.16f, 6.63f, 13.73f, 6.33f, 14.38f, 6.25f, 15.01f, 6.42f, 15.53f, 6.81f, 15.88f, 7.36f, 16f, 8f, 16f, 9.5f }, new float[12] { 15.5f, 11f, 18.5f, 11f, 19.5f, 12f, 19.5f, 15f, 18.5f, 16.5f, 15.25f, 16.5f }, new float[4] { 6.75f, 14.5f, 15.25f, 14.5f } }; default: return new float[0][]; } } } public static class Glyphs { private const int Size = 56; private static readonly Dictionary<string, Sprite> Cache = new Dictionary<string, Sprite>(); public static Sprite Get(string name) { //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Expected O, but got Unknown //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) if (Cache.TryGetValue(name, out var value) && (Object)(object)value != (Object)null) { return value; } byte[] array = GlyphMath.Rasterize(name, 56, GlyphMath.StrokeOf(name)); Color32[] array2 = (Color32[])(object)new Color32[3136]; for (int i = 0; i < 56; i++) { for (int j = 0; j < 56; j++) { array2[(55 - i) * 56 + j] = new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, array[i * 56 + j]); } } Texture2D val = new Texture2D(56, 56, (TextureFormat)4, true); ((Object)val).name = "MeadWorks.Glyph." + name; ((Texture)val).filterMode = (FilterMode)2; ((Texture)val).wrapMode = (TextureWrapMode)1; val.SetPixels32(array2); val.Apply(true, true); value = Sprite.Create(val, new Rect(0f, 0f, 56f, 56f), new Vector2(0.5f, 0.5f), 100f, 0u, (SpriteMeshType)0); ((Object)value).name = ((Object)val).name; LedgerTrack.Object<Texture2D>(val, "glyph texture"); LedgerTrack.Object<Sprite>(value, "glyph sprite"); Cache[name] = value; return value; } } public static class HostStripLayoutRules { public static float Font => 15f; public static float Pad => TabStripRules.Pad; public static float RowHeight => TabStripRules.Height; public static float Gap => TabStripRules.Gap; public static float Height(IEnumerable<float> widths, float available) { int rows = 1; float used = 0f; foreach (float width in widths) { Place(width, available, ref rows, ref used); } return Height(rows); } public static float Height(List<float> widths, float available) { int rows = 1; float used = 0f; for (int i = 0; i < widths.Count; i++) { Place(widths[i], available, ref rows, ref used); } return Height(rows); } public static bool Refit(float built, float last, float now) { if (built >= 0f && Math.Abs(now - built) > 1f) { return Math.Abs(now - last) < 0.5f; } return false; } private static void Place(float width, float available, ref int rows, ref float used) { float num = Math.Max(0f, width); if (used > 0f && used + Gap + num > Math.Max(1f, available)) { rows++; used = 0f; } used += ((used > 0f) ? Gap : 0f) + num; } private static float Height(int rows) { return Math.Max(52f, (float)rows * RowHeight + (float)(rows - 1) * Gap + 8f); } } internal sealed class HostTabEntry { private Action _undo; internal void File(string label, Action unregister) { Withdraw(); _undo = delegate { _undo = null; unregister(); }; Ledger.Add(label, _undo); } internal void Withdraw() { Action undo = _undo; _undo = null; if (undo != null) { Ledger.Remove(undo); } } } internal static class HostTabRules { internal static bool RebuildOnActivation(bool visible, Func<bool> resume) { if (resume != null) { if (visible) { return !resume(); } return false; } return true; } internal static void Hide(ref string active, Action deactivate, Action<string> hide, Action clear) { if (active == null) { return; } string obj = active; deactivate(); active = null; try { hide(obj); } finally { clear(); } } } internal sealed class HostTabActivation { private int? _frame; internal void Request(int frame) { _frame = frame; } internal bool Take(int frame) { if (!_frame.HasValue || _frame.Value == frame) { return false; } _frame = null; return true; } } public static class HoverNameRules { public const float Delay = 0.5f; public const float Gap = 6f; public const float Inset = 4f; public const float Radius = 8f; public static bool Replaces(bool currentIsInside) { return !currentIsInside; } public static (float Left, float Bottom) Place(float center, float top, float width, float height, float left, float bottom, float right, float ceiling) { return (Left: Clamp(center - width / 2f, left, right - width), Bottom: Clamp(top + 6f, bottom, ceiling - height)); } public static (float Left, float Bottom, float Width) Beside(float targetLeft, float targetRight, float rowCenter, float width, float height, float left, float bottom, float right, float ceiling) { float num = Math.Max(0f, right - targetRight - 6f); float num2 = Math.Max(0f, targetLeft - 6f - left); bool flag = num >= width || num >= num2; width = Math.Min(width, flag ? num : num2); return (Left: flag ? (targetRight + 6f) : (targetLeft - 6f - width), Bottom: Clamp(rowCenter - height / 2f, bottom, ceiling - height), Width: width); } private static float Clamp(float value, float min, float max) { return Math.Max(min, Math.Min(value, Math.Max(min, max))); } } public static class ItemSlotSizing { private static readonly Dictionary<InventoryGrid, float> Grids = new Dictionary<InventoryGrid, float>(); private static readonly Dictionary<Transform, Action> Cells = new Dictionary<Transform, Action>(); private static readonly List<Transform> Dead = new List<Transform>(); public static void Grid(InventoryGrid grid) { if (!Grids.ContainsKey(grid)) { Grids.Add(grid, grid.m_elementSpace); } if (!(Mathf.Abs(grid.m_elementSpace - 62f) < 0.001f)) { grid.m_elementSpace = 62f; grid.m_width = -1; } } public static void CellsIn(InventoryGrid grid) { foreach (InventoryElement element in grid.m_elements) { if ((Object)(object)element != (Object)null) { Cell(((Component)element).transform); } } } public static void Cell(Transform slot) { if ((Object)(object)slot == (Object)null || Cells.ContainsKey(slot)) { return; } foreach (KeyValuePair<Transform, Action> cell in Cells) { if ((Object)(object)cell.Key == (Object)null) { Dead.Add(cell.Key); } } foreach (Transform item in Dead) { Cells.Remove(item); } Dead.Clear(); Cells.Add(slot, Resize(slot)); } public static Action Resize(Transform slot) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown //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_0038: 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_00e9: 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_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_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_0128: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) RectTransform root = (RectTransform)slot; Vector2 oldSize = root.sizeDelta; Rect rect = root.rect; float num = 56f / Mathf.Max(1f, ((Rect)(ref rect)).width); List<Action> undo = new List<Action>(); GuiBar[] componentsInChildren = ((Component)slot).GetComponentsInChildren<GuiBar>(true); float[] array = new float[componentsInChildren.Length]; for (int i = 0; i < componentsInChildren.Length; i++) { array[i] = ((componentsInChildren[i].m_width > 0f) ? componentsInChildren[i].m_width : componentsInChildren[i].m_bar.sizeDelta.x); } RectTransform[] componentsInChildren2 = ((Component)slot).GetComponentsInChildren<RectTransform>(true); foreach (RectTransform child in componentsInChildren2) { if ((Object)(object)child == (Object)(object)root) { continue; } Vector2 size = child.sizeDelta; Vector2 position = child.anchoredPosition; child.sizeDelta = size * num; child.anchoredPosition = position * num; undo.Add(delegate { //IL_0015: 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) if ((Object)(object)child != (Object)null) { child.sizeDelta = size; child.anchoredPosition = position; } }); } TMP_Text[] componentsInChildren3 = ((Component)slot).GetComponentsInChildren<TMP_Text>(true); foreach (TMP_Text text in componentsInChildren3) { float size2 = text.fontSize; float min = text.fontSizeMin; float max = text.fontSizeMax; bool number = ((Object)text).name == "binding"; text.fontSize = SlotMath.ScaledText(size2, num, number); text.fontSizeMin = SlotMath.ScaledText(min, num, number); text.fontSizeMax = Mathf.Max(text.fontSize, max * num); undo.Add(delegate { if ((Object)(object)text != (Object)null) { text.fontSize = size2; text.fontSizeMin = min; text.fontSizeMax = max; } }); } for (int num2 = 0; num2 < componentsInChildren.Length; num2++) { GuiBar bar = componentsInChildren[num2]; float width = array[num2]; bar.SetWidth(width * num); undo.Add(delegate { if ((Object)(object)bar != (Object)null) { bar.SetWidth(width); } }); } root.SetSizeWithCurrentAnchors((Axis)0, 56f); root.SetSizeWithCurrentAnchors((Axis)1, 56f); return delegate { //IL_003e: Unknown result type (might be due to invalid IL or missing refere