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 SeneaL UI v1.1.6
plugins/SeneaL-UI/SeneaL-UI.dll
Decompiled 20 hours 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.Diagnostics; using System.Globalization; using System.IO; using System.Linq.Expressions; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Serialization; using System.Runtime.Versioning; using System.Security.Cryptography; using System.Text; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using GUIFramework; using HarmonyLib; using SeneaLUI; using SeneaLUI.Components; using SeneaLUI.Core; using SeneaLUI.Hud; using SeneaLUI.Inv; using SeneaLUI.Map; using SeneaLUI.Mods; using SeneaLUI.Net; using SeneaLUI.Patches; using SeneaLUI.Theme; using Splatform; using TMPro; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.InputSystem; using UnityEngine.Rendering; using UnityEngine.TextCore; using UnityEngine.TextCore.LowLevel; using UnityEngine.UI; using UserManagement; using Valheim.SettingsGui; using Valheim.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("SeneaL-UI")] [assembly: AssemblyProduct("SeneaL-UI")] [assembly: AssemblyCompany("seneaL")] [assembly: AssemblyCopyright("seneaL")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("0.1.0.0")] [HarmonyPatch(typeof(Inventory), "StackAll")] public static class StackAllPatch { private static readonly FieldRef<Inventory, List<ItemData>> Items = AccessTools.FieldRefAccess<Inventory, List<ItemData>>("m_inventory"); private static readonly Stack<List<ItemData>> Pool = new Stack<List<ItemData>>(2); private static readonly Action<Inventory> Changed = BindChanged(); private static Action<Inventory> BindChanged() { MethodInfo m = AccessTools.Method(typeof(Inventory), "Changed", (Type[])null, (Type[])null); if (m == null) { return delegate(Inventory i) { i.m_onChanged?.Invoke(); }; } ParameterInfo[] parameters = m.GetParameters(); if (parameters.Length == 0) { return AccessTools.MethodDelegate<Action<Inventory>>(m, (object)null, true); } if (parameters.Length == 2 && parameters[0].ParameterType == typeof(bool) && parameters[1].ParameterType == typeof(bool)) { Action<Inventory, bool, bool> d = AccessTools.MethodDelegate<Action<Inventory, bool, bool>>(m, (object)null, true); return delegate(Inventory i) { d(i, arg2: false, arg3: false); }; } object[] args = new object[parameters.Length]; for (int num = 0; num < parameters.Length; num++) { args[num] = (parameters[num].HasDefaultValue ? parameters[num].DefaultValue : (parameters[num].ParameterType.IsValueType ? Activator.CreateInstance(parameters[num].ParameterType) : null)); } return delegate(Inventory i) { m.Invoke(i, args); }; } [HarmonyPriority(0)] private static bool Prefix(Inventory __instance, Inventory fromInventory, bool message, ref int __result) { Player localPlayer = Player.m_localPlayer; if (!Plugin.Active || !Object.op_Implicit((Object)(object)localPlayer) || fromInventory != ((Humanoid)localPlayer).GetInventory() || !Slots.Ready(fromInventory)) { return true; } List<ItemData> collection = Items.Invoke(fromInventory); List<ItemData> list = ((Pool.Count > 0) ? Pool.Pop() : new List<ItemData>(64)); list.AddRange(collection); int num = (message ? __instance.CountItems((string)null, -1, true) : 0); for (int i = 0; i < list.Count; i++) { ItemData val = list[i]; if (!Transfer.Keep(fromInventory, val) && !((Humanoid)localPlayer).IsItemEquiped(val) && __instance.ContainsItemByName(val.m_shared.m_name) && __instance.AddItem(val)) { fromInventory.RemoveItem(val); } } list.Clear(); Pool.Push(list); int num2 = __instance.CountItems((string)null, -1, true) - num; if (message) { ((Character)localPlayer).Message((MessageType)2, (num2 > 0) ? ("$msg_stackall " + num2) : "$msg_stackall_none", 0, (Sprite)null, false); } Changed(__instance); Changed(fromInventory); Game.instance.IncrementPlayerStat((PlayerStatType)82, 1f, false); __result = num2; return false; } } public static class ForeignKeyPatches { public static void Apply(Harmony h) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Expected O, but got Unknown HarmonyMethod val = new HarmonyMethod(typeof(ForeignKeyPatches), "Prefix", (Type[])null); foreach (MethodBase item in Targets()) { try { h.Patch(item, val, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } catch (Exception ex) { Plugin.Log.LogWarning((object)("SeneaL UI: key guard skipped " + item.Name + ": " + ex.Message)); } } } private static IEnumerable<MethodBase> Targets() { Type t = AccessTools.TypeByName("UnityEngine.Input"); if (t == null) { yield break; } string[] names = new string[3] { "GetKey", "GetKeyDown", "GetKeyUp" }; for (int i = 0; i < names.Length; i++) { MethodInfo methodInfo = AccessTools.Method(t, names[i], new Type[1] { typeof(KeyCode) }, (Type[])null); if (methodInfo != null) { yield return methodInfo; } MethodInfo methodInfo2 = AccessTools.Method(t, names[i], new Type[1] { typeof(string) }, (Type[])null); if (methodInfo2 != null) { yield return methodInfo2; } } Type k = typeof(KeyboardShortcut); string[] kn = new string[3] { "IsDown", "IsPressed", "IsUp" }; for (int i = 0; i < kn.Length; i++) { MethodInfo methodInfo3 = AccessTools.Method(k, kn[i], (Type[])null, (Type[])null); if (methodInfo3 != null) { yield return methodInfo3; } } } private static bool Prefix(ref bool __result) { if (!TypingPatches.Any || CraftView.Probe) { return true; } __result = false; return false; } } [HarmonyPatch] public static class FocusPatches { [HarmonyPostfix] [HarmonyPatch(typeof(Chat), "HasFocus")] private static void ChatFocus(ref bool __result) { if (!__result && TypingPatches.Any) { __result = true; } } [HarmonyPostfix] [HarmonyPatch(typeof(TextInput), "IsVisible")] private static void TextVisible(ref bool __result) { if (!__result && TypingPatches.Any) { __result = true; } } } [HarmonyPatch(typeof(ZInput))] public static class TypingPatches { private static readonly FieldRef<ZInput, Dictionary<string, ButtonDef>> Buttons = AccessTools.FieldRefAccess<ZInput, Dictionary<string, ButtonDef>>("m_buttons"); public static bool Any { get { if (!CraftView.Typing && !BuildMenuView.Typing && !MapView.Typing && !SettingsView.Capturing && !NoticeModal.Open && !TextInputView.Typing) { return ModsView.Open; } return true; } } [HarmonyPrefix] [HarmonyPatch("GetButtonDown")] private static bool ButtonDown(ref bool __result) { return Pass(ref __result); } [HarmonyPrefix] [HarmonyPatch("GetButton")] private static bool Button(ref bool __result) { return Pass(ref __result); } [HarmonyPrefix] [HarmonyPatch("GetButtonUp")] private static bool ButtonUp(ref bool __result) { return Pass(ref __result); } [HarmonyPrefix] [HarmonyPatch("GetKeyDown")] private static bool KeyDown(ref bool __result) { return Pass(ref __result); } [HarmonyPrefix] [HarmonyPatch("GetKey")] private static bool Key(ref bool __result) { return Pass(ref __result); } [HarmonyPrefix] [HarmonyPatch("GetKeyUp")] private static bool KeyUp(ref bool __result) { return Pass(ref __result); } [HarmonyPostfix] [HarmonyPatch(typeof(ZInput), "Update")] private static void MuteButtons() { if (!Any || ZInput.instance == null) { return; } Dictionary<string, ButtonDef> dictionary = Buttons.Invoke(ZInput.instance); if (dictionary == null) { return; } foreach (KeyValuePair<string, ButtonDef> item in dictionary) { if (!item.Key.StartsWith("Mouse", StringComparison.Ordinal)) { item.Value.ResetState(); } } } [HarmonyPostfix] [HarmonyPatch(typeof(PlayerController), "TakeInput")] private static void ControllerTakeInput(ref bool __result) { if (__result && Any) { __result = false; } } private static bool Pass(ref bool result) { if (!Any || CraftView.Probe) { return true; } result = false; return false; } } namespace SeneaLUI { [BepInPlugin("seneaL.valheim.ui", "SeneaL UI", "1.1.6")] public class Plugin : BaseUnityPlugin { public enum PinMode { All, Marked, None } public enum CursorKind { SeneaL, Game } public enum ModsKind { SeneaL, ConfigurationManager } public enum ZoomMode { Smooth, Fast, Instant } public enum NoticeMode { Capsule, Feed, Line } public enum PickupMode { Vanilla, TopDown, UnderHotbar } public const string Guid = "seneaL.valheim.ui"; public const string Name = "SeneaL UI"; public const string Version = "1.1.6"; public static readonly ConfigEntry<KeyboardShortcut>[] ChestKeys = new ConfigEntry<KeyboardShortcut>[4]; public static readonly ConfigEntry<KeyboardShortcut>[] StackKeys = new ConfigEntry<KeyboardShortcut>[3]; public static readonly ConfigEntry<KeyboardShortcut>[] QuickKeys = new ConfigEntry<KeyboardShortcut>[6]; public static readonly ConfigEntry<KeyboardShortcut>[] ActionKeys = new ConfigEntry<KeyboardShortcut>[8]; public static bool Active; public static bool Dedicated; public static int KeyVersion; public static ManualLogSource Log; private static readonly string[] Names = new string[6]; private static readonly string[] ActionNames = new string[8]; private Harmony _harmony; public static Harmony Harmony; private static readonly FieldRef<ZInput, Dictionary<string, ButtonDef>> Buttons = AccessTools.FieldRefAccess<ZInput, Dictionary<string, ButtonDef>>("m_buttons"); private static readonly Dictionary<string, string> KeyMap = new Dictionary<string, string>(64); private static int _keyMapVersion = -1; private static string _keyMapLang; private static float _keyMapTime = -100f; public static ConfigEntry<bool> CustomUi { get; private set; } public static ConfigEntry<bool> Profile { get; private set; } public static ConfigEntry<bool> SortHotbar { get; private set; } public static ConfigEntry<bool> TransferHotbar { get; private set; } public static ConfigEntry<bool> TransferQuick { get; private set; } public static ConfigEntry<bool> HudQuickSlots { get; private set; } public static ConfigEntry<NoticeMode> Notices { get; private set; } public static ConfigEntry<int> NoticeMax { get; private set; } public static ConfigEntry<float> NoticeHold { get; private set; } public static ConfigEntry<bool> NoticeSkills { get; private set; } public static ConfigEntry<bool> NoticeUnlocks { get; private set; } public static ConfigEntry<bool> NoticeStates { get; private set; } public static ConfigEntry<bool> StackMax { get; private set; } public static ConfigEntry<bool> HoverPanel { get; private set; } public static ConfigEntry<bool> ShowAllRecipes { get; private set; } public static ConfigEntry<KeyboardShortcut> ToggleQuickSlots { get; private set; } public static ConfigEntry<KeyboardShortcut> LockKey { get; private set; } public static ConfigEntry<KeyboardShortcut> SearchKey { get; private set; } public static ConfigEntry<KeyboardShortcut> TrashKey { get; private set; } public static ConfigEntry<KeyboardShortcut> AreaKey { get; private set; } public static ConfigEntry<bool> AreaPickup { get; private set; } public static ConfigEntry<float> AreaRadius { get; private set; } public static ConfigEntry<bool> AreaSame { get; private set; } public static ConfigEntry<bool> OverridePlantEasily { get; private set; } public static ConfigEntry<bool> OverrideEpi { get; private set; } public static ConfigEntry<bool> OverrideVesCells { get; private set; } public static ConfigEntry<bool> OverrideVesWindow { get; private set; } public static ConfigEntry<bool> OverrideVesGuide { get; private set; } public static ConfigEntry<bool> OverrideVesNotices { get; private set; } public static ConfigEntry<bool> VesFlash { get; private set; } public static ConfigEntry<ZoomMode> MapZoom { get; private set; } public static ConfigEntry<float> MapZoomIn { get; private set; } public static ConfigEntry<bool> StatusRight { get; private set; } public static ConfigEntry<bool> StatusSplit { get; private set; } public static ConfigEntry<bool> AlertFlash { get; private set; } public static ConfigEntry<bool> CenterWindows { get; private set; } public static ConfigEntry<float> WindowGap { get; private set; } public static ConfigEntry<bool> HideMinimap { get; private set; } public static ConfigEntry<ModsKind> ModsWindow { get; private set; } public static ConfigEntry<KeyboardShortcut> ModsKey { get; private set; } public static ConfigEntry<bool> MenuClickClose { get; private set; } public static ConfigEntry<CursorKind> CursorStyle { get; private set; } public static ConfigEntry<int> CursorSize { get; private set; } public static ConfigEntry<PinMode> CompassPins { get; private set; } public static ConfigEntry<bool> CompassNames { get; private set; } public static ConfigEntry<bool> CompassChecked { get; private set; } public static ConfigEntry<bool> BuildHighlight { get; private set; } public static ConfigEntry<bool> ConfirmTrash { get; private set; } public static ConfigEntry<bool> Trash { get; private set; } public static ConfigEntry<bool> FromChests { get; private set; } public static ConfigEntry<float> ChestRange { get; private set; } public static ConfigEntry<bool> BuildFromChests { get; private set; } public static ConfigEntry<float> BuildRange { get; private set; } public static ConfigEntry<bool> ChestLinks { get; private set; } public static ConfigEntry<bool> OverrideRunicCrafting { get; private set; } public static ConfigEntry<bool> OverridePlantTimers { get; private set; } public static ConfigEntry<bool> OverrideRunicStorage { get; private set; } public static ConfigEntry<float> StackRange { get; private set; } public static ConfigEntry<PickupMode> PickupOrder { get; private set; } public static ConfigEntry<int> QuickSlotCount { get; private set; } public static ConfigEntry<int> ActionSlotCount { get; private set; } public static ConfigEntry<int> KeySlotCount { get; private set; } public static ConfigEntry<bool> Wallet { get; private set; } public static ConfigEntry<bool> SlotKeys { get; private set; } public static ConfigEntry<bool> HudActionSlots { get; private set; } public static string LockName => KeyName(LockKey.Value); public static string SearchName => KeyName(SearchKey.Value); private void Start() { Epi.Init(); } private void Awake() { //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Expected O, but got Unknown //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_0303: Unknown result type (might be due to invalid IL or missing references) //IL_030d: Expected O, but got Unknown //IL_026a: Unknown result type (might be due to invalid IL or missing references) //IL_0263: Unknown result type (might be due to invalid IL or missing references) //IL_03c0: Unknown result type (might be due to invalid IL or missing references) //IL_0458: Unknown result type (might be due to invalid IL or missing references) //IL_0462: Expected O, but got Unknown //IL_04b2: Unknown result type (might be due to invalid IL or missing references) //IL_04bc: Expected O, but got Unknown //IL_05ff: Unknown result type (might be due to invalid IL or missing references) //IL_0609: Expected O, but got Unknown //IL_063c: Unknown result type (might be due to invalid IL or missing references) //IL_0646: Expected O, but got Unknown //IL_072b: Unknown result type (might be due to invalid IL or missing references) //IL_0782: Unknown result type (might be due to invalid IL or missing references) //IL_07df: Unknown result type (might be due to invalid IL or missing references) //IL_0833: Unknown result type (might be due to invalid IL or missing references) //IL_08d9: Unknown result type (might be due to invalid IL or missing references) //IL_0985: Unknown result type (might be due to invalid IL or missing references) //IL_09f0: Unknown result type (might be due to invalid IL or missing references) //IL_0a7b: Unknown result type (might be due to invalid IL or missing references) //IL_0a85: Expected O, but got Unknown //IL_0b18: Unknown result type (might be due to invalid IL or missing references) //IL_0b22: Expected O, but got Unknown //IL_0bde: Unknown result type (might be due to invalid IL or missing references) //IL_0be8: Expected O, but got Unknown //IL_0d04: Unknown result type (might be due to invalid IL or missing references) //IL_0d0e: Expected O, but got Unknown //IL_0d61: Unknown result type (might be due to invalid IL or missing references) //IL_0d6b: Expected O, but got Unknown //IL_0e79: Unknown result type (might be due to invalid IL or missing references) //IL_0e83: Expected O, but got Unknown //IL_113a: Unknown result type (might be due to invalid IL or missing references) //IL_1144: Expected O, but got Unknown //IL_1172: Unknown result type (might be due to invalid IL or missing references) //IL_117c: Expected O, but got Unknown //IL_1196: Unknown result type (might be due to invalid IL or missing references) //IL_119c: Invalid comparison between Unknown and I4 //IL_11df: Unknown result type (might be due to invalid IL or missing references) //IL_11e9: Expected O, but got Unknown Log = ((BaseUnityPlugin)this).Logger; Dedicated = Application.isBatchMode; Loc.Load(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location)); CustomUi = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "CustomUI", true, "Use the SeneaL interface. Uncheck to show the vanilla Valheim interface instead."); Active = CustomUi.Value && !Dedicated; CustomUi.SettingChanged += delegate { if (!Dedicated) { Active = CustomUi.Value; HudRoot.Apply(); CursorSkin.Apply(); } }; CursorStyle = ((BaseUnityPlugin)this).Config.Bind<CursorKind>("General", "Cursor", CursorKind.SeneaL, "Mouse cursor: SeneaL = the brass arrow of this mod, Game = the standard Valheim cursor."); CursorSize = ((BaseUnityPlugin)this).Config.Bind<int>("General", "CursorSize", 0, new ConfigDescription("Size of the SeneaL cursor in screen pixels. 0 = the system cursor size (hardware cursor, no lag); 24-64 = exactly that size, drawn by the game (it can trail the mouse by a frame).", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 64), Array.Empty<object>())); CursorStyle.SettingChanged += delegate { CursorSkin.Apply(); }; ModsWindow = ((BaseUnityPlugin)this).Config.Bind<ModsKind>("General", "ModSettingsWindow", ModsKind.SeneaL, "Window for the settings of all installed mods (F1 and Esc menu -> Mods): SeneaL = this mod's own window, ConfigurationManager = the BepInEx Configuration Manager if it is installed."); ModsKey = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Keys", "ModSettings", new KeyboardShortcut((KeyCode)282, Array.Empty<KeyCode>()), "Opens the settings of all installed mods."); MenuClickClose = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "MenuClickClose", false, "Close the Esc menu with a click on its empty space. Off = only Esc closes it, as in vanilla."); CursorSize.SettingChanged += delegate { CursorSkin.Apply(); }; SortHotbar = ((BaseUnityPlugin)this).Config.Bind<bool>("Inventory", "SortHotbar", false, "Include the hotbar row (slots 1-8) when sorting the inventory. Locked slots are never sorted."); TransferHotbar = ((BaseUnityPlugin)this).Config.Bind<bool>("Inventory", "TransferHotbar", false, "Include the hotbar row when using the container's Put all / Put similar buttons."); TransferQuick = ((BaseUnityPlugin)this).Config.Bind<bool>("Inventory", "TransferQuickSlots", false, "Let chest transfers take food from the quick slots: Put all / Put similar, quick stack to nearby chests and the game's hold-E stacking. Off keeps the quick slots, the hotbar (unless TransferHotbar) and locked slots out of all of them."); KeyCode[] array = new KeyCode[6]; RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/); KeyCode[] array2 = (KeyCode[])(object)array; for (int num = 0; num < 6; num++) { int n = num; QuickKeys[num] = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Inventory", "QuickSlot" + (num + 1), (KeyboardShortcut)(((int)array2[num] == 0) ? KeyboardShortcut.Empty : new KeyboardShortcut(array2[num], Array.Empty<KeyCode>())), "Eats the food in quick slot " + (num + 1) + "." + ((num >= 3) ? (" Used when [Inventory] QuickSlotCount is " + (num + 1) + " or more.") : "")); QuickKeys[num].SettingChanged += delegate { Names[n] = null; KeyVersion++; }; } QuickSlotCount = ((BaseUnityPlugin)this).Config.Bind<int>("Inventory", "QuickSlotCount", 3, new ConfigDescription("How many food quick slots the inventory has (0-6, 0 = off: the quick slots disappear from the inventory and the HUD). A server with this mod decides the most you may use ([Server] MaxQuickSlots); the backpack (Adventure Backpacks), rings (Epic Loot) and neck / finger slots (Jewelcrafting) use cells of the same row and can limit it. Lowering it moves the food out of the removed slots into the inventory.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 6), Array.Empty<object>())); QuickSlotCount.SettingChanged += delegate { KeyVersion++; }; HudQuickSlots = ((BaseUnityPlugin)this).Config.Bind<bool>("HUD", "QuickSlots", true, "Show the food quick slots next to the hotbar."); KeyCode[] array3 = new KeyCode[8]; RuntimeHelpers.InitializeArray(array3, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/); KeyCode[] array4 = (KeyCode[])(object)array3; for (int num2 = 0; num2 < 8; num2++) { int n2 = num2; ActionKeys[num2] = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Inventory", "ActionSlot" + (num2 + 1), new KeyboardShortcut(array4[num2], (KeyCode[])(object)new KeyCode[1] { (KeyCode)308 }), "Uses the item in action slot " + (num2 + 1) + " (any item: equips a weapon, tool or armor, drinks a mead, eats food, and so on). Used when [Inventory] ActionSlotCount is " + (num2 + 1) + " or more."); ActionKeys[num2].SettingChanged += delegate { ActionNames[n2] = null; KeyVersion++; }; } ActionSlotCount = ((BaseUnityPlugin)this).Config.Bind<int>("Inventory", "ActionSlotCount", 4, new ConfigDescription("How many action slots the inventory has (0-8, 0 = off): a row under the food quick slots for any item, each with its own key ([Inventory] ActionSlot1-8, Alt+Z/X/C/V/B/N/1/2 by default). A server with this mod decides the most you may use ([Server] MaxActionSlots). Lowering it moves the items out of the removed slots into the inventory.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 8), Array.Empty<object>())); ActionSlotCount.SettingChanged += delegate { KeyVersion++; }; KeySlotCount = ((BaseUnityPlugin)this).Config.Bind<int>("Inventory", "KeySlotCount", 2, new ConfigDescription("How many slots for dungeon and door keys sit next to the action slots (0-2, 0 = off); picked up keys go there first. Lowering it moves the keys out of the removed slots into the inventory. A server with this mod can forbid them ([Server] AllowKeySlots).", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 2), Array.Empty<object>())); Wallet = ((BaseUnityPlugin)this).Config.Bind<bool>("Inventory", "Wallet", true, "A wallet slot for coins with no stack limit next to the action slots; picked up and earned coins go there. On death the coins go into the grave in stacks of 999 and return to the wallet when you take them back. A server with this mod can forbid it ([Server] AllowWallet)."); KeySlotCount.SettingChanged += delegate { KeyVersion++; }; Wallet.SettingChanged += delegate { KeyVersion++; }; SlotKeys = ((BaseUnityPlugin)this).Config.Bind<bool>("Inventory", "SlotKeys", true, "Show the key of each food quick slot and action slot on the slot itself (in the inventory and on the HUD)."); SlotKeys.SettingChanged += delegate { KeyVersion++; }; HudActionSlots = ((BaseUnityPlugin)this).Config.Bind<bool>("HUD", "ActionSlots", true, "Show the action slots as a row under the hotbar."); StackMax = ((BaseUnityPlugin)this).Config.Bind<bool>("Inventory", "StackMax", true, "Show the stack size next to the amount in cells (5/50). Off: only the amount; a full stack is orange either way and the tooltip still shows the maximum."); Notices = ((BaseUnityPlugin)this).Config.Bind<NoticeMode>("Notifications", "Style", NoticeMode.Capsule, "Pickups and skill-ups: Capsule (grouped into one capsule under the hotbar while it keeps getting news), Feed (cards on the right) or Line (the single vanilla-style line)."); NoticeMax = ((BaseUnityPlugin)this).Config.Bind<int>("Notifications", "MaxLines", 5, new ConfigDescription("How many notices one capsule holds (or how many feed cards are shown) before a new one starts.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 10), Array.Empty<object>())); NoticeHold = ((BaseUnityPlugin)this).Config.Bind<float>("Notifications", "HoldSeconds", 4f, new ConfigDescription("How long a capsule or feed card waits for more notices after the last one before it fades.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 10f), Array.Empty<object>())); NoticeSkills = ((BaseUnityPlugin)this).Config.Bind<bool>("Notifications", "SkillUps", true, "Show skill level-ups in the capsule / feed too."); NoticeStates = ((BaseUnityPlugin)this).Config.Bind<bool>("Notifications", "States", true, "Show the other top-left messages (sheltered, rested, status effects starting and ending...) in their own capsule / feed cards too. Pickups, skill-ups and states never share a capsule."); NoticeUnlocks = ((BaseUnityPlugin)this).Config.Bind<bool>("Notifications", "Unlocks", false, "Show new items and recipes in the capsule / feed instead of the separate large cards."); HoverPanel = ((BaseUnityPlugin)this).Config.Bind<bool>("HUD", "HoverPanel", true, "Draw the crosshair hover text (object name and actions) inside a bordered glass panel. Off = plain text with a shadow."); ShowAllRecipes = ((BaseUnityPlugin)this).Config.Bind<bool>("Crafting", "ShowAll", false, "Crafting list filter: show all recipes (including not yet unlocked) instead of unlocked only. Toggled in the crafting panel."); ShowAllRecipes.SettingChanged += delegate { CraftView.Dirty = true; }; ToggleQuickSlots = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("HUD", "ToggleQuickSlots", new KeyboardShortcut((KeyCode)104, Array.Empty<KeyCode>()), "Shows or hides the quick slots on the HUD."); ToggleQuickSlots.SettingChanged += delegate { KeyVersion++; }; LockKey = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Keys", "LockSlot", new KeyboardShortcut((KeyCode)308, Array.Empty<KeyCode>()), "Held together with a left click on an inventory or chest slot to lock / unlock it."); LockKey.SettingChanged += delegate { KeyVersion++; }; SearchKey = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Keys", "Search", new KeyboardShortcut((KeyCode)102, (KeyCode[])(object)new KeyCode[1] { (KeyCode)306 }), "Focuses the search box in the crafting panel and the build menu."); SearchKey.SettingChanged += delegate { KeyVersion++; }; TrashKey = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Keys", "Trash", new KeyboardShortcut((KeyCode)127, Array.Empty<KeyCode>()), "Deletes the inventory or chest item under the cursor (same as dragging it onto the trash slot)."); TrashKey.SettingChanged += delegate { KeyVersion++; }; string[] array5 = new string[4] { "PutAll", "PutSimilar", "TakeAll", "TakeSimilar" }; string[] array6 = new string[4] { "Put all: every unlocked inventory item goes into the open chest.", "Put similar: inventory items that the open chest already holds go into it.", "Take all: everything from the open chest goes into the inventory.", "Take similar: chest items you already carry (inventory or equipped backpack) top up your stacks, the rest goes into free slots." }; for (int num3 = 0; num3 < 4; num3++) { ChestKeys[num3] = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Keys", array5[num3], KeyboardShortcut.Empty, array6[num3] + " Empty = no key."); ChestKeys[num3].SettingChanged += delegate { KeyVersion++; }; } string[] array7 = new string[3] { "QuickStack", "Restock", "Consolidate" }; string[] array8 = new string[3] { "Quick stack: inventory items that nearby chests already hold go into them (range [Inventory] StackRange), no chest has to be open.", "Restock: your stacks are topped up from nearby chests.", "Consolidate: split stacks in the inventory and an equipped backpack are merged." }; for (int num4 = 0; num4 < 3; num4++) { StackKeys[num4] = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Keys", array7[num4], KeyboardShortcut.Empty, array8[num4] + " Works with the inventory open or closed. Empty = no key."); StackKeys[num4].SettingChanged += delegate { KeyVersion++; }; } AreaKey = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Keys", "AreaPickup", new KeyboardShortcut((KeyCode)304, Array.Empty<KeyCode>()), "Held together with the use key on a berry bush, a crop, a mushroom or a beehive to pick everything of the kind around it ([Harvest] AreaPickup)."); AreaKey.SettingChanged += delegate { KeyVersion++; }; AreaPickup = ((BaseUnityPlugin)this).Config.Bind<bool>("Harvest", "AreaPickup", true, "Pick up everything around the target at once: hold [Keys] AreaPickup and press the use key on a pickable (berries, crops, mushrooms, flowers, stones...) or a beehive."); AreaRadius = ((BaseUnityPlugin)this).Config.Bind<float>("Harvest", "AreaRadius", 3f, new ConfigDescription("Radius around the target that area pickup collects from, meters.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 10f), Array.Empty<object>())); AreaSame = ((BaseUnityPlugin)this).Config.Bind<bool>("Harvest", "AreaSameOnly", false, "Area pickup only collects the same kind of thing as the target (only raspberries around a raspberry bush). Off = everything pickable around it."); BuildHighlight = ((BaseUnityPlugin)this).Config.Bind<bool>("HUD", "BuildHighlight", false, "Build menu: a green frame around the pieces you can build right now. The ones you cannot are always dimmed and hatched."); MapZoom = ((BaseUnityPlugin)this).Config.Bind<ZoomMode>("Map", "Zoom", ZoomMode.Smooth, "World map zoom animation: Smooth (default), Fast, or Instant (no animation)."); MapZoomIn = ((BaseUnityPlugin)this).Config.Bind<float>("Map", "ZoomIn", 1f, new ConfigDescription("How much closer the world map can be zoomed in than vanilla allows: 1 = vanilla limit, 4 = four times closer.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 4f), Array.Empty<object>())); StatusRight = ((BaseUnityPlugin)this).Config.Bind<bool>("HUD", "StatusRight", false, "Show the status effects on the right side of the screen, under the minimap, instead of the left."); StatusRight.SettingChanged += delegate { Prefs.Version++; }; StatusSplit = ((BaseUnityPlugin)this).Config.Bind<bool>("HUD", "StatusSplit", true, "Split the status effects panel in two capsules: conditions from the world (sheltered, by the fire, resting, rested, wet, cold, freezing, encumbered) on top, every other effect (Megingjord, meads, Forsaken powers, effects of other mods) under them."); CenterWindows = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "CenterWindows", true, "On wide screens lay the inventory, crafting panel / chest and character tabs out from the screen center instead of the left and right edges."); WindowGap = ((BaseUnityPlugin)this).Config.Bind<float>("General", "WindowGap", 24f, new ConfigDescription("Gap between the inventory and the crafting panel / chest when the windows are centered.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 4000f), Array.Empty<object>())); AlertFlash = ((BaseUnityPlugin)this).Config.Bind<bool>("HUD", "AlertFlash", true, "Screen and bar flashes: red vignette pulse at low health, red flash and shake when stamina or eitr runs out."); HideMinimap = ((BaseUnityPlugin)this).Config.Bind<bool>("HUD", "HideMinimap", false, "Hide the minimap completely (both SeneaL and vanilla), e.g. when a compass mod is used. The large map still opens."); HideMinimap.SettingChanged += delegate { Prefs.Version++; }; CompassPins = ((BaseUnityPlugin)this).Config.Bind<PinMode>("HUD", "CompassPins", PinMode.All, "Which map pins the compass shows: All, only those Marked for the compass in the pin dialog, or None."); CompassNames = ((BaseUnityPlugin)this).Config.Bind<bool>("HUD", "CompassNames", false, "Write pin names next to the distance on the compass."); CompassChecked = ((BaseUnityPlugin)this).Config.Bind<bool>("HUD", "CompassChecked", true, "Show crossed-out map pins on the compass (drawn crossed out and dimmed). Off hides them from the compass."); FromChests = ((BaseUnityPlugin)this).Config.Bind<bool>("Crafting", "FromChests", true, "Crafting and upgrading also take materials from nearby chests (public or your private ones). Chests can be excluded with the button in their header."); ChestRange = ((BaseUnityPlugin)this).Config.Bind<float>("Crafting", "ChestRange", 15f, new ConfigDescription("Distance from the crafting station within which chests are used for crafting, meters.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 100f), Array.Empty<object>())); BuildFromChests = ((BaseUnityPlugin)this).Config.Bind<bool>("Crafting", "BuildFromChests", true, "Building also takes materials from nearby chests."); BuildRange = ((BaseUnityPlugin)this).Config.Bind<float>("Crafting", "BuildRange", 30f, new ConfigDescription("Distance from you within which chests are used for building, meters.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 100f), Array.Empty<object>())); FromChests.SettingChanged += delegate { RunicCrafting.Strip(); Pov.Sync(); }; BuildFromChests.SettingChanged += delegate { RunicCrafting.Strip(); Pov.Sync(); }; ChestLinks = ((BaseUnityPlugin)this).Config.Bind<bool>("Crafting", "ChestLinks", true, "Draw links from a crafting station you look at to the chests it can take materials from."); ConfirmTrash = ((BaseUnityPlugin)this).Config.Bind<bool>("Inventory", "ConfirmTrash", true, "Ask for confirmation before an item is deleted via the trash slot or the Trash key."); Trash = ((BaseUnityPlugin)this).Config.Bind<bool>("Inventory", "Trash", true, "Trash slot in the inventory and the Trash key. Off = items cannot be deleted from the inventory or chests at all."); Trash.SettingChanged += delegate { KeyVersion++; }; StackRange = ((BaseUnityPlugin)this).Config.Bind<float>("Inventory", "StackRange", 10f, new ConfigDescription("Distance within which nearby chests are used by the quick stack / restock / consolidate buttons, meters.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 100f), Array.Empty<object>())); PickupOrder = ((BaseUnityPlugin)this).Config.Bind<PickupMode>("Inventory", "PickupOrder", PickupMode.UnderHotbar, "Where picked up items land in the inventory: Vanilla (weapons and tools from the top, everything else from the bottom row up), TopDown (everything from the top left, hotbar included) or UnderHotbar (weapons and tools as vanilla, everything else from the first row under the hotbar down, the hotbar last)."); OverrideRunicCrafting = ((BaseUnityPlugin)this).Config.Bind<bool>("Mods", "RunicCrafting", true, "Use this mod's own crafting/building (see [Crafting] FromChests, BuildFromChests) instead of Runic Crafting's, when either of those is on (off = Runic Crafting's own handling). Applies immediately either way."); OverrideRunicStorage = ((BaseUnityPlugin)this).Config.Bind<bool>("Mods", "RunicStorage", true, "Use this mod's own quick stack / restock / consolidate buttons instead of Runic Storage's (off = Runic Storage's own buttons and keybinds). Applies immediately either way."); OverrideRunicCrafting.SettingChanged += delegate { RunicCrafting.Strip(); Pov.Sync(); }; OverridePlantTimers = ((BaseUnityPlugin)this).Config.Bind<bool>("Mods", "PlantTimers", true, "Show this mod's own plant and bush timers (time left and progress) instead of Plant Everything's and Valharvest's, when either is installed (off = their own timers). Applies immediately."); OverridePlantTimers.SettingChanged += delegate { PlantTimers.Sync(); }; OverridePlantEasily = ((BaseUnityPlugin)this).Config.Bind<bool>("Mods", "PlantEasily", true, "Use this mod's own area pickup ([Harvest] AreaPickup) instead of PlantEasily's bulk harvest, when PlantEasily is installed (off = PlantEasily's own bulk harvest; its hints are then drawn in this mod's style). PlantEasily's planting and replanting keep working either way. Applies immediately."); OverrideEpi = ((BaseUnityPlugin)this).Config.Bind<bool>("Mods", "AzuEPI", true, "When AzuExtendedPlayerInventory (AzuEPI) is installed: true = this mod manages the player inventory (its equipment doll, quick slots, extra rows and panels) and AzuEPI's inventory rows, slots, quick bar, vanity, loadouts and stats panel are switched off, while its version check, console commands and API keep working; false = AzuEPI manages the inventory and this mod's inventory, chest, crafting and tab panels stay vanilla. Applies the next time you enter a world."); OverrideVesCells = ((BaseUnityPlugin)this).Config.Bind<bool>("Mods", "VesCells", true, "When Valheim Enchantment System is installed: true = this mod draws the enchant level on every slot (inventory, chests, hotbar, quick slots) as +N in the level's colour with a tinted frame, and VES's glowing slot overlay is switched off; false = VES draws its own overlay on the inventory and the vanilla hotbar. Applies immediately."); OverrideVesCells.SettingChanged += delegate { Ves.Sync(); }; OverrideVesWindow = ((BaseUnityPlugin)this).Config.Bind<bool>("Mods", "VesWindow", true, "When Valheim Enchantment System is installed: true = its enchantment window opens as this mod's panel in place of the crafting panel next to the inventory (item and next level, scroll, blessed scroll switch, chance with breakdown, progress on the button); false = its own floating window. Applies immediately."); OverrideVesWindow.SettingChanged += delegate { EnchantView.Request(on: false); }; OverrideVesGuide = ((BaseUnityPlugin)this).Config.Bind<bool>("Mods", "VesGuide", true, "When Valheim Enchantment System is installed: true = its guide (scroll requirements, stats and chances per level, opened with Guide in the enchantment window) is shown as this mod's dialog with tabs, search and item tooltips; false = its own guide window. Applies immediately."); OverrideVesNotices = ((BaseUnityPlugin)this).Config.Bind<bool>("Mods", "VesNotices", true, "When Valheim Enchantment System is installed: true = its enchantment announcements (a player enchanted or broke an item, filtered by its own Notifications settings; your own attempts in this mod's panel are always shown) appear as this mod's seal under the compass, or in the notification capsules with the compass off; false = its own banner. Applies immediately."); VesFlash = ((BaseUnityPlugin)this).Config.Bind<bool>("Mods", "VesFlash", true, "When Valheim Enchantment System is installed and [Mods] VesNotices is on: flash the screen edges when your own enchant from +8 succeeds (in the colour of the new level) or fails (red, when the seal cracks). Applies immediately."); Prefs.Bind(((BaseUnityPlugin)this).Config); Prefs.SettingsKey.SettingChanged += delegate { KeyVersion++; }; Profile = ((BaseUnityPlugin)this).Config.Bind<bool>("Debug", "Profile", false, "Debug mode: shows the mod's per-frame timings on screen (top left) and writes them to the BepInEx log every 5 seconds."); Perf.On = Profile.Value; Profile.SettingChanged += delegate { Perf.On = Profile.Value; }; ConfigEntry<int> obj = ((BaseUnityPlugin)this).Config.Bind<int>("Debug", "SkinScale", 1, new ConfigDescription("Resolution of the drawn panels, buttons and frames: 1 = native, 2 or 3 = supersampled with mipmaps. Needs a game restart.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 3), Array.Empty<object>())); ConfigEntry<float> val = ((BaseUnityPlugin)this).Config.Bind<float>("Debug", "EdgeGamma", 0f, new ConfigDescription("Shaping of the anti-aliased outer edge of panels and buttons (1 = linear coverage, higher = softer, thinner edge). 0 = automatic: 1.8 in linear color space, 1 in gamma. Needs a game restart.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 3f), Array.Empty<object>())); Skin.Ss = obj.Value; Skin.EdgeGamma = ((val.Value > 0f) ? val.Value : (((int)QualitySettings.activeColorSpace == 1) ? 1.8f : 1f)); Policy.Bind(((BaseUnityPlugin)this).Config); Integrity.Bind(((BaseUnityPlugin)this).Config); Chords.Cfg = ((BaseUnityPlugin)this).Config; _harmony = new Harmony("seneaL.valheim.ui"); Harmony = _harmony; if (Dedicated) { _harmony.PatchAll(typeof(SyncPatches)); Log.LogInfo((object)"SeneaL UI: dedicated server, only the [Server] rules are active."); return; } _harmony.PatchAll(); ForeignKeyPatches.Apply(_harmony); BuildBadge.Create(); CursorSkin.Apply(); ModsView.Create(); } public static string ActionKeyName(int i) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) string text = ActionNames[i]; if (text != null) { return text; } string[] actionNames = ActionNames; KeyboardShortcut value = ActionKeys[i].Value; return actionNames[i] = (((int)((KeyboardShortcut)(ref value)).MainKey == 0) ? "" : KeyName(ActionKeys[i].Value)); } public static string QuickKeyName(int i) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) string text = Names[i]; if (text != null) { return text; } string[] names = Names; KeyboardShortcut value = QuickKeys[i].Value; return names[i] = (((int)((KeyboardShortcut)(ref value)).MainKey == 0) ? "" : KeyName(QuickKeys[i].Value)); } public static string PhysicalKey(string shown) { //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Invalid comparison between Unknown and I4 //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_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) string stamp = Loc.Stamp; if (_keyMapVersion != KeyVersion || _keyMapLang != stamp || Time.unscaledTime - _keyMapTime > 10f) { _keyMapVersion = KeyVersion; _keyMapLang = stamp; _keyMapTime = Time.unscaledTime; KeyMap.Clear(); ZInput instance = ZInput.instance; if (instance != null) { foreach (KeyValuePair<string, ButtonDef> item in Buttons.Invoke(instance)) { ButtonDef value = item.Value; if ((int)value.Source == 180 || value.ButtonAction == null || value.ButtonAction.bindings.Count == 0) { continue; } InputBinding val = value.ButtonAction.bindings[0]; string text = ((InputBinding)(ref val)).effectivePath ?? ""; if (!text.StartsWith("<Keyboard>/")) { continue; } string text2 = text.Substring(11); if (text2.Length == 1) { string boundKeyString = Localization.instance.GetBoundKeyString(item.Key, true); if (boundKeyString.Length != 0) { KeyMap[boundKeyString] = text2.ToUpperInvariant(); } } } } } if (!KeyMap.TryGetValue(shown, out var value2)) { return shown; } return value2; } public static string BoundKeyName(string button) { //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_004f: 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_005e: 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_00e4: 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) ZInput instance = ZInput.instance; if (instance == null) { return "?"; } if (!Buttons.Invoke(instance).TryGetValue(button, out var value) || value.ButtonAction == null || value.ButtonAction.bindings.Count == 0) { return "?"; } InputBinding val = value.ButtonAction.bindings[0]; string text = ((InputBinding)(ref val)).effectivePath ?? ""; int num = text.LastIndexOf('/'); string text2 = ((num >= 0) ? text.Substring(num + 1) : text); if (text.StartsWith("<Mouse>")) { switch (text2) { case "leftButton": return KeyName(new KeyboardShortcut((KeyCode)323, Array.Empty<KeyCode>())); case "rightButton": return KeyName(new KeyboardShortcut((KeyCode)324, Array.Empty<KeyCode>())); case "middleButton": return KeyName(new KeyboardShortcut((KeyCode)325, Array.Empty<KeyCode>())); } } if (text2.Length == 1) { return text2.ToUpperInvariant(); } return char.ToUpperInvariant(text2[0]) + text2.Substring(1); } public static bool Held(KeyboardShortcut k) { //IL_0002: 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_004f: Unknown result type (might be due to invalid IL or missing references) if (!ZInput.GetKey(((KeyboardShortcut)(ref k)).MainKey, true)) { return false; } bool flag = false; foreach (KeyCode modifier in ((KeyboardShortcut)(ref k)).Modifiers) { flag = true; if (!ZInput.GetKey(modifier, true)) { return false; } } if (!flag) { return !Chords.Chorded(((KeyboardShortcut)(ref k)).MainKey); } return true; } public static bool Pressed(KeyboardShortcut k) { //IL_0002: 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_0060: 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) if (!ZInput.GetKeyDown(((KeyboardShortcut)(ref k)).MainKey, true)) { return false; } IEnumerable<KeyCode> modifiers = ((KeyboardShortcut)(ref k)).Modifiers; bool flag = false; using (IEnumerator<KeyCode> enumerator = modifiers.GetEnumerator()) { if (enumerator.MoveNext()) { _ = enumerator.Current; flag = true; } } if (!flag && (ZInput.GetKey((KeyCode)308, true) || ZInput.GetKey((KeyCode)307, true) || Chords.Chorded(((KeyboardShortcut)(ref k)).MainKey))) { return false; } foreach (KeyCode modifier in ((KeyboardShortcut)(ref k)).Modifiers) { if (!ZInput.GetKey(modifier, true)) { return false; } } return true; } public unsafe static string KeyName(KeyboardShortcut k) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: 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: Invalid comparison between Unknown and I4 //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected I4, but got Unknown //IL_000d: 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_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Expected I4, but got Unknown //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Invalid comparison between Unknown and I4 //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) KeyCode mainKey = ((KeyboardShortcut)(ref k)).MainKey; string text; if ((int)mainKey <= 32) { if ((int)mainKey == 0) { return "—"; } if ((int)mainKey != 32) { goto IL_0093; } text = "Space"; } else { switch (mainKey - 303) { case 2: case 3: goto IL_007b; case 0: case 1: goto IL_0083; case 4: case 5: goto IL_008b; } switch (mainKey - 323) { case 0: break; case 1: goto IL_006b; case 2: goto IL_0073; default: goto IL_0093; } text = Loc.LMB; } goto IL_00d7; IL_0073: text = Loc.MMB; goto IL_00d7; IL_0083: text = "Shift"; goto IL_00d7; IL_007b: text = "Ctrl"; goto IL_00d7; IL_008b: text = "Alt"; goto IL_00d7; IL_0093: text = ((object)(*(KeyCode*)(&mainKey))/*cast due to .constrained prefix*/).ToString(); if (text.StartsWith("Alpha")) { text = text.Substring(5); } else if (text.StartsWith("Keypad")) { text = "Num " + text.Substring(6); } goto IL_00d7; IL_00d7: foreach (KeyCode modifier in ((KeyboardShortcut)(ref k)).Modifiers) { text = KeyName(new KeyboardShortcut(modifier, Array.Empty<KeyCode>())) + "+" + text; } return text; IL_006b: text = Loc.RMB; goto IL_00d7; } private void OnDestroy() { Harmony harmony = _harmony; if (harmony != null) { harmony.UnpatchSelf(); } } } } namespace SeneaLUI.Theme { public static class Alerts { public const float LowStamina = 0.2f; public const float LowHealth = 0.25f; public const float StaggerWarn = 0.7f; public const float FlashTime = 0.7f; public const float UpgradeTime = 1.2f; public static readonly Color BloodTop = Palette.Hex(14837596); public static readonly Color BloodBottom = Palette.Hex(10693927); public static readonly Color BloodBright = Palette.Hex(16748416); public static readonly Color BloodDeep = Palette.Hex(13187632); public static readonly Color GoldTop = Palette.Hex(16179360); public static readonly Color GoldBottom = Palette.Hex(13212202); public static readonly Color RedTint = new Color(1f, 0.45f, 0.4f, 1f); public static readonly Color GoldTint = new Color(1f, 0.93f, 0.7f, 1f); public static float Pulse(float hz) { return 0.5f + 0.5f * Mathf.Sin(Time.time * hz * ((float)Math.PI * 2f)); } public static float Flash(float timer, float hz) { return Mathf.Abs(Mathf.Sin(timer * hz * (float)Math.PI)) * Mathf.Clamp01((0.7f - timer) / 0.25f); } public static float Shake(float timer) { return Mathf.Sin(timer * 60f) * 4f * Mathf.Clamp01((0.7f - timer) / 0.7f); } } public static class DamageStyle { private static Material _material; public static void Apply(TMP_Text t) { //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0095: 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_00a4: 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_0042: Unknown result type (might be due to invalid IL or missing references) if (Fonts.Ready) { if (!Object.op_Implicit((Object)(object)_material)) { _material = new TextStyle(Fonts.Forum, 16f, Palette.Parchment).Shadow(new Color(0f, 0f, 0f, 0.85f), 1.5f, 3f).Material; } t.font = Fonts.Forum; t.fontSharedMaterial = _material; t.fontSize *= 1.15f; Color color = ((Graphic)t).color; float a = color.a; Color color2 = Map(color); color2.a = a; ((Graphic)t).color = color2; } } private static Color Map(Color c) { //IL_0000: 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_000d: 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_003a: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_009b: 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_0047: 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_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_007e: 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_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: 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_00cc: 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) if (c.r > 0.9f && c.g > 0.9f && c.b > 0.9f) { return Palette.Parchment; } if (c.r > 0.9f && c.g < 0.1f && c.b < 0.1f) { return Palette.Hex(13191741); } if (c.r > 0.9f && c.g > 0.9f && c.b < 0.1f) { return Palette.Hex(14726463); } if (c.r > 0.9f && c.g > 0.5f && c.b < 0.4f) { return Palette.Hex(15770426); } if (c.g > 0.9f && c.r < 0.6f) { return Palette.Moss; } if (c.r > 0.75f && c.g < 0.75f) { return Palette.Linen; } return Palette.Ash; } } public static class Fonts { public static TMP_FontAsset Forum; public static TMP_FontAsset Regular; public static TMP_FontAsset Medium; public static TMP_FontAsset SemiBold; public static TMP_FontAsset Bold; public static TMP_FontAsset Italic; public static bool Ready; private static readonly HashSet<string> Warmed = new HashSet<string>(); public static void Load(TMP_FontAsset vanilla) { if (!Ready) { Forum = Create("Forum-Regular.ttf", 72, vanilla); Regular = Create("Alegreya-Regular.ttf", 64, vanilla); Medium = Create("Alegreya-Medium.ttf", 64, vanilla); SemiBold = Create("Alegreya-SemiBold.ttf", 64, vanilla); Bold = Create("Alegreya-Bold.ttf", 64, vanilla); Italic = Create("Alegreya-Italic.ttf", 64, vanilla); Ready = (Object)(object)Forum != (Object)null && (Object)(object)Regular != (Object)null; Add("АБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдеёжзийклмнопрстуфхцчшщъыьэюяABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 .,:;!?%/×·–—-+()[]«»\"'"); Warm(Loc.Current); } } private static void Add(string chars) { TMP_FontAsset[] array = (TMP_FontAsset[])(object)new TMP_FontAsset[6] { Forum, Regular, Medium, SemiBold, Bold, Italic }; foreach (TMP_FontAsset val in array) { if ((Object)(object)val != (Object)null && ((Object)val).name.StartsWith("SeneaLUI ")) { val.TryAddCharacters(chars, false); } } } public static void Warm(Lang lang) { if (Ready && lang != null && Warmed.Add(lang.Code)) { Add(lang.Chars()); } } private static TMP_FontAsset Create(string file, int sampling, TMP_FontAsset vanilla) { //IL_0070: 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_00a8: 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_0101: Expected O, but got Unknown string text = Res.FontPath(file); if (text == null) { return vanilla; } TMP_FontAsset val; try { val = TMP_FontAsset.CreateFontAsset(text, 0, sampling, 6, (GlyphRenderMode)4165, 1024, 1024); } catch (Exception ex) { Plugin.Log.LogError((object)("Font " + file + ": " + ex.Message)); return vanilla; } if ((Object)(object)val == (Object)null) { return vanilla; } ((Object)val).name = "SeneaLUI " + file; FaceInfo faceInfo = ((TMP_Asset)val).faceInfo; ((FaceInfo)(ref faceInfo)).strikethroughOffset = ((((FaceInfo)(ref faceInfo)).capLine > 0f) ? ((FaceInfo)(ref faceInfo)).capLine : (((FaceInfo)(ref faceInfo)).ascentLine * 0.7f)) * 0.46f; ((TMP_Asset)val).faceInfo = faceInfo; Material material = ((TMP_Asset)val).material; if ((Object)(object)material == (Object)null || (Object)(object)material.shader == (Object)null || !material.shader.isSupported || !((Object)material.shader).name.StartsWith("TextMeshPro/")) { material = new Material(((TMP_Asset)vanilla).material.shader); material.SetTexture(ShaderUtilities.ID_MainTex, (Texture)(object)val.atlasTexture); material.SetFloat(ShaderUtilities.ID_TextureWidth, 1024f); material.SetFloat(ShaderUtilities.ID_TextureHeight, 1024f); material.SetFloat(ShaderUtilities.ID_GradientScale, 7f); material.SetFloat(ShaderUtilities.ID_WeightNormal, 0f); material.SetFloat(ShaderUtilities.ID_WeightBold, 0.75f); ((TMP_Asset)val).material = material; } val.fallbackFontAssetTable = new List<TMP_FontAsset> { vanilla }; return val; } } public static class Icons { private static readonly Dictionary<string, Sprite> Cache = new Dictionary<string, Sprite>(16); private static Func<Texture2D, byte[], bool, bool> _load; public static Sprite Get(string name) { if (Cache.TryGetValue(name, out var value)) { return value; } byte[] array = Res.Bytes("SeneaLUI.Icons." + name + ".png"); if (array == null) { return null; } return Cache[name] = Decode(array); } public static bool Load(Texture2D tex, byte[] bytes) { if (_load == null) { MethodInfo methodInfo = AccessTools.Method("UnityEngine.ImageConversion:LoadImage", new Type[3] { typeof(Texture2D), typeof(byte[]), typeof(bool) }, (Type[])null); if (methodInfo == null) { return false; } _load = (Func<Texture2D, byte[], bool, bool>)Delegate.CreateDelegate(typeof(Func<Texture2D, byte[], bool, bool>), methodInfo); } return _load(tex, bytes, arg3: false); } public static Sprite Decode(byte[] bytes) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Expected O, but got Unknown //IL_005c: 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) Texture2D val = new Texture2D(2, 2, (TextureFormat)4, true); if (!Load(val, bytes)) { Object.Destroy((Object)(object)val); return null; } ((Texture)val).wrapMode = (TextureWrapMode)1; ((Texture)val).filterMode = (FilterMode)2; ((Texture)val).anisoLevel = 8; ((Texture)val).mipMapBias = -0.9f; val.Apply(true, true); return Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f), 100f, 0u, (SpriteMeshType)0); } } public sealed class RoundedFill : MaskableGraphic { private const int Seg = 6; private const int N = 28; private float _radius; private Color _top = Color.white; private Color _bottom = Color.white; private Color _glow; private float _glowW; private static readonly Vector2[] Ring = (Vector2[])(object)new Vector2[28]; public void Set(float radius, Color top, Color bottom) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) _radius = radius; _top = top; _bottom = bottom; ((Graphic)this).SetVerticesDirty(); } public void Set(float radius, Color fill) { //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) Set(radius, fill, fill); } public void SetGlow(Color glow, float width) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) _glow = glow; _glowW = width; ((Graphic)this).SetVerticesDirty(); } public void SetColors(Color top, Color bottom) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) _top = top; _bottom = bottom; ((Graphic)this).SetVerticesDirty(); } protected override void OnPopulateMesh(VertexHelper vh) { //IL_0007: 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_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: 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_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_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_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_014a: 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_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_012c: 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_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_01ff: 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_020e: Unknown result type (might be due to invalid IL or missing references) //IL_0213: Unknown result type (might be due to invalid IL or missing references) //IL_0218: Unknown result type (might be due to invalid IL or missing references) //IL_021d: Unknown result type (might be due to invalid IL or missing references) //IL_017d: 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_0198: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Unknown result type (might be due to invalid IL or missing references) vh.Clear(); Rect pixelAdjustedRect = ((Graphic)this).GetPixelAdjustedRect(); float width = ((Rect)(ref pixelAdjustedRect)).width; float height = ((Rect)(ref pixelAdjustedRect)).height; if (width <= 0f || height <= 0f) { return; } float r = Mathf.Min(_radius, Mathf.Min(width, height) * 0.5f); float num = Mathf.Min(_glowW, Mathf.Min(width, height) * 0.5f); bool flag = _glow.a > 0f && num > 0f; Color color = ((Graphic)this).color; float yMax = ((Rect)(ref pixelAdjustedRect)).yMax; Contour(pixelAdjustedRect, r, -1f); for (int i = 0; i < 28; i++) { vh.AddVert(Vector2.op_Implicit(Ring[i]), Color32.op_Implicit(Fade(Shade(Ring[i].y, yMax, height, color))), Vector4.op_Implicit(Vector2.zero)); } Contour(pixelAdjustedRect, r, 0f); for (int j = 0; j < 28; j++) { Color val = Shade(Ring[j].y, yMax, height, color); if (flag) { val = Mix(val, _glow); } vh.AddVert(Vector2.op_Implicit(Ring[j]), Color32.op_Implicit(val), Vector4.op_Implicit(Vector2.zero)); } Strip(vh, 0, 28); int num2 = 28; if (flag) { Contour(pixelAdjustedRect, r, num); for (int k = 0; k < 28; k++) { vh.AddVert(Vector2.op_Implicit(Ring[k]), Color32.op_Implicit(Shade(Ring[k].y, yMax, height, color)), Vector4.op_Implicit(Vector2.zero)); } Strip(vh, 28, 56); num2 = 56; } int currentVertCount = vh.currentVertCount; vh.AddVert(Vector2.op_Implicit(((Rect)(ref pixelAdjustedRect)).center), Color32.op_Implicit(Shade(((Rect)(ref pixelAdjustedRect)).center.y, yMax, height, color)), Vector4.op_Implicit(Vector2.zero)); for (int l = 0; l < 28; l++) { vh.AddTriangle(currentVertCount, num2 + l, num2 + (l + 1) % 28); } } private static void Strip(VertexHelper vh, int a, int b) { for (int i = 0; i < 28; i++) { int num = (i + 1) % 28; vh.AddTriangle(a + i, a + num, b + num); vh.AddTriangle(a + i, b + num, b + i); } } private static void Contour(Rect rc, float r, float t) { //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) float num = Mathf.Max(r - t, 0f); float num2 = Mathf.Max(r, t); float num3 = ((Rect)(ref rc)).xMin + num2; float num4 = ((Rect)(ref rc)).xMax - num2; float num5 = ((Rect)(ref rc)).yMin + num2; float num6 = ((Rect)(ref rc)).yMax - num2; int num7 = 0; for (int i = 0; i < 4; i++) { float num8 = ((i == 0 || i == 3) ? num4 : num3); float num9 = ((i < 2) ? num6 : num5); for (int j = 0; j <= 6; j++) { float num10 = ((float)i * 90f + (float)j * 90f / 6f) * ((float)Math.PI / 180f); Ring[num7++] = new Vector2(num8 + Mathf.Cos(num10) * num, num9 + Mathf.Sin(num10) * num); } } } private Color Shade(float y, float yMax, float h, Color mul) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0041: 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_004f: Unknown result type (might be due to invalid IL or missing references) Color val = Color.LerpUnclamped(_top, _bottom, (yMax - y) / h); return new Color(val.r * mul.r, val.g * mul.g, val.b * mul.b, val.a * mul.a); } private static Color Fade(Color c) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) c.a = 0f; return c; } private static Color Mix(Color b, Color g) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0007: 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_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0023: 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_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003f: 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_004f: Unknown result type (might be due to invalid IL or missing references) float a = g.a; return new Color(b.r + (g.r - b.r) * a, b.g + (g.g - b.g) * a, b.b + (g.b - b.b) * a, b.a); } } public struct Shadow { public float X; public float Y; public float Blur; public float Spread; public Color Color; public bool Inset; public Shadow(float x, float y, float blur, float spread, Color color, bool inset) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) X = x; Y = y; Blur = blur; Spread = spread; Color = color; Inset = inset; } public static Shadow Drop(float x, float y, float blur, Color c) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) return new Shadow(x, y, blur, 0f, c, inset: false); } public static Shadow Ring(float spread, Color c) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) return new Shadow(0f, 0f, 0f, spread, c, inset: false); } public static Shadow Glow(float blur, Color c) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) return new Shadow(0f, 0f, blur, 0f, c, inset: false); } public static Shadow In(float x, float y, float blur, Color c) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) return new Shadow(x, y, blur, 0f, c, inset: true); } } public sealed class BoxStyle { public float Radius; public Color FillTop; public Color FillBottom; public Color Border; public float BorderW; public float BorderBottomW; public float Stripe; public float Dash; public float DashGap; public float Hatch; public bool SquareL; public bool SquareR; public Shadow[] Shadows = Empty; private static readonly Shadow[] Empty = new Shadow[0]; private string _key; public int Pad { get { float num = 0f; for (int i = 0; i < Shadows.Length; i++) { Shadow shadow = Shadows[i]; if (!shadow.Inset) { float num2 = Mathf.Max(Mathf.Abs(shadow.X), Mathf.Abs(shadow.Y)) + shadow.Spread + shadow.Blur; if (num2 > num) { num = num2; } } } return Mathf.CeilToInt(num); } } public string Key { get { //IL_002b: 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_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) if (_key != null) { return _key; } StringBuilder stringBuilder = new StringBuilder(96); stringBuilder.Append(Radius).Append('|').Append(Col(FillTop)) .Append(Col(FillBottom)) .Append(Col(Border)) .Append(BorderW) .Append('|') .Append(BorderBottomW) .Append('|') .Append(Stripe) .Append('|') .Append(Dash) .Append(',') .Append(DashGap) .Append('|') .Append(Hatch) .Append(SquareL ? "L" : "") .Append(SquareR ? "R" : ""); for (int i = 0; i < Shadows.Length; i++) { Shadow shadow = Shadows[i]; stringBuilder.Append('|').Append(shadow.X).Append(',') .Append(shadow.Y) .Append(',') .Append(shadow.Blur) .Append(',') .Append(shadow.Spread) .Append(',') .Append(Col(shadow.Color)) .Append(shadow.Inset ? 'i' : 'o'); } return _key = stringBuilder.ToString(); } } public BoxStyle(float radius, Color fill, Color border, float borderW = 1f) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0021: 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_0028: Unknown result type (might be due to invalid IL or missing references) Radius = radius; FillTop = fill; FillBottom = fill; Border = border; BorderW = borderW; } public BoxStyle(float radius, Color fillTop, Color fillBottom, Color border, float borderW = 1f) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0021: 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_0029: Unknown result type (might be due to invalid IL or missing references) Radius = radius; FillTop = fillTop; FillBottom = fillBottom; Border = border; BorderW = borderW; } public BoxStyle Scaled(float k) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) return new BoxStyle(Radius * k, FillTop, FillBottom, Border, BorderW * k) { BorderBottomW = BorderBottomW * k, Stripe = Stripe, Dash = Dash * k, DashGap = DashGap * k, Hatch = Hatch * k }; } public BoxStyle With(params Shadow[] shadows) { Shadows = shadows; return this; } public BoxStyle Bottom(float bottomBorder) { BorderBottomW = bottomBorder; return this; } public BoxStyle Striped(float alpha) { Stripe = alpha; return this; } public BoxStyle Dashed(float dash, float gap) { Dash = dash; DashGap = gap; return this; } public BoxStyle Hatched(float alpha) { Hatch = alpha; return this; } public BoxStyle Clone() { //IL_0007: 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_0013: Unknown result type (might be due to invalid IL or missing references) return new BoxStyle(Radius, FillTop, FillBottom, Border, BorderW) { BorderBottomW = BorderBottomW, Stripe = Stripe, Dash = Dash, DashGap = DashGap, Hatch = Hatch, Shadows = Shadows, SquareL = SquareL, SquareR = SquareR }; } public BoxStyle Square(bool left, bool right) { BoxStyle boxStyle = Clone(); boxStyle.SquareL = left; boxStyle.SquareR = right; return boxStyle; } public BoxStyle Bordered(Color border) { //IL_0007: 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) BoxStyle boxStyle = Clone(); boxStyle.Border = border; return boxStyle; } private static string Col(Color c) { //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_0006: Unknown result type (might be due to invalid IL or missing references) Color32 val = Color32.op_Implicit(c); return val.r.ToString("x2") + val.g.ToString("x2") + val.b.ToString("x2") + val.a.ToString("x2"); } } public static class Skin { private static readonly Dictionary<string, Sprite> Cache = new Dictionary<string, Sprite>(64); public static float Ppu = 100f; public static int Ss = 1; public static float EdgeGamma = 1f; private const float Far = 10000f; private static float _rhx; private static float _rhy; private static float _fr; private static float _wm; private static float _th; public static void Prewarm() { int pad = Styles.SlotHasHover.Pad; int[] array = new int[6] { 64, 56, 60, 44, 40, 36 }; foreach (int num in array) { BoxStyle[] array2 = new BoxStyle[9] { Styles.SlotEmpty, Styles.SlotHas, Styles.SlotEq, Styles.SlotEmptyHover, Styles.SlotHasHover, Styles.SlotLockedEmpty, Styles.SlotLockedHas, Styles.SlotLockedEmptyHover, Styles.SlotLockedHasHover }; foreach (BoxStyle s in array2) { Box(num, num, s, pad); } } array = new int[9] { 24, 28, 30, 32, 36, 40, 48, 50, 64 }; foreach (int h in array) { Sliced(h, Styles.Panel); Sliced(h, Styles.Pill); Sliced(h, Styles.Glass78); Sliced(h, Styles.Key); Sliced(h, Styles.Tb); Sliced(h, Styles.TbHover); Sliced(h, Styles.Seg); Sliced(h, Styles.Req); Sliced(h, Styles.Chip); Sliced(h, Styles.ChipOff); } } public static Sprite Box(int w, int h, BoxStyle s, int pad = -1) { //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) if (pad < 0) { pad = s.Pad; } string key = w + "x" + h + "p" + pad + ":" + s.Key; if (Cache.TryGetValue(key, out var value)) { return value; } Texture2D val = Render(w * Ss, h * Ss, s, pad * Ss, Ss); value = Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f), Ppu * (float)Ss, 0u, (SpriteMeshType)0); Cache[key] = value; return value; } public static Sprite Sliced(int h, BoxStyle s, int pad = -1) { //IL_00df: 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_010d: Unknown result type (might be due to invalid IL or missing references) if (pad < 0) { pad = s.Pad; } string key = "s" + h + "p" + pad + ":" + s.Key; if (Cache.TryGetValue(key, out var value)) { return value; } int num = Mathf.CeilToInt(Mathf.Min(s.Radius, (float)h * 0.5f)); Texture2D val = Render((num * 2 + 4) * Ss, h * Ss, s, pad * Ss, Ss); int num2 = (pad + num + 1) * Ss; int num3 = Mathf.Min((pad + num + 1) * Ss, (((Texture)val).height - 2) / 2); value = Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f), Ppu * (float)Ss, 0u, (SpriteMeshType)0, new Vector4((float)num2, (float)num3, (float)num2, (float)num3)); Cache[key] = value; return value; } public static Sprite Circle(int d, BoxStyle s, int pad = -1) { s.Radius = (float)d * 0.5f; return Box(d, d, s, pad); } public static Sprite DashedCircle(int d, float width, Color color, float dash, float gap) { //IL_0035: 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_0199: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: 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_01e9: Expected O, but got Unknown //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_016d: 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_0174: Unknown result type (might be due to invalid IL or missing references) string key = "dc" + d + "|" + width + "|" + ((object)Color32.op_Implicit(color)/*cast due to .constrained prefix*/).ToString() + "|" + dash + "|" + gap; if (Cache.TryGetValue(key, out var value)) { return value; } Color32[] array = (Color32[])(object)new Color32[d * d]; float num = (float)d * 0.5f; float num2 = num - width * 0.5f; float num3 = dash + gap; for (int i = 0; i < d; i++) { int num4 = i * d; for (int j = 0; j < d; j++) { float num5 = (float)j + 0.5f - num; float num6 = (float)i + 0.5f - num; float num7 = Mathf.Sqrt(num5 * num5 + num6 * num6); float num8 = Sat(width * 0.5f + 0.5f - Mathf.Abs(num7 - num2)); if (!(num8 <= 0f)) { float num9 = (Mathf.Atan2(num6, num5) + (float)Math.PI) * num2; float num10 = num9 - Mathf.Floor(num9 / num3) * num3; float num11 = Sat(dash - num10 + 0.5f) * Sat(num10 + 0.5f); Color val = color; val.a *= num8 * num11; array[num4 + j] = Color32.op_Implicit(val); } } } Texture2D val2 = new Texture2D(d, d, (TextureFormat)4, false) { wrapMode = (TextureWrapMode)1, filterMode = (FilterMode)1 }; val2.SetPixels32(array); val2.Apply(false, true); value = Sprite.Create(val2, new Rect(0f, 0f, (float)d, (float)d), new Vector2(0.5f, 0.5f), Ppu, 0u, (SpriteMeshType)0); Cache[key] = value; return value; } public static Sprite Cone(int size, float halfAngle, Color color) { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Expected O, but got Unknown //IL_0113: 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_013b: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) string key = "cone" + size + "|" + halfAngle + "|" + ((object)Color32.op_Implicit(color)/*cast due to .constrained prefix*/).ToString(); if (Cache.TryGetValue(key, out var value)) { return value; } Color32[] array = (Color32[])(object)new Color32[size * size]; float num = (float)size * 0.5f; float num2 = num - 1f; float num3 = Mathf.Cos(halfAngle * ((float)Math.PI / 180f)); for (int i = 0; i < size; i++) { int num4 = i * size; for (int j = 0; j < size; j++) { float num5 = (float)j + 0.5f - num; float num6 = (float)i + 0.5f - num; float num7 = Mathf.Sqrt(num5 * num5 + num6 * num6); if (!(num7 <= 0f) && !(num7 > num2)) { float num8 = Sat(num2 - num7 + 0.5f); float num9 = Sat((num6 / num7 - num3) * num7 * 0.5f + 0.5f); float num10 = 1f - num7 / num2; Color val = color; val.a *= num8 * num9 * (0.35f + 0.65f * num10); array[num4 + j] = Color32.op_Implicit(val); } } } Texture2D val2 = new Texture2D(size, size, (TextureFormat)4, false) { wrapMode = (TextureWrapMode)1, filterMode = (FilterMode)1 }; val2.SetPixels32(array); val2.Apply(false, true); value = Sprite.Create(val2, new Rect(0f, 0f, (float)size, (float)size), new Vector2(0.5f, 0.5f), Ppu, 0u, (SpriteMeshType)0); Cache[key] = value; return value; } public static float SailFactor(float cosFrom) { float num = Mathf.Lerp(0.7f, 1f, 1f - Mathf.Abs(cosFrom)); float num2 = Mathf.Clamp01((cosFrom - 0.75f) / 0.05f); return num * (1f - num2); } public static Sprite WindZones(int d, float width, Color dead, Color good, Color ideal) { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_004c: 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_0064: 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_01f1: 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_01fd: Unknown result type (might be due to invalid IL or missing references) //IL_0204: Unknown result type (might be due to invalid IL or missing references) //IL_020b: Unknown result type (might be due to invalid IL or missing references) //IL_0221: Unknown result type (might be due to invalid IL or missing references) //IL_0230: Unknown result type (might be due to invalid IL or missing references) //IL_0247: Expected O, but got Unknown //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_018d: 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_01c5: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: Unknown result type (might be due to invalid IL or missing references) string key = "windzones" + d + "|" + width + "|" + ((object)Color32.op_Implicit(dead)/*cast due to .constrained prefix*/).ToString() + ((object)Color32.op_Implicit(good)/*cast due to .constrained prefix*/).ToString() + ((object)Color32.op_Implicit(ideal)/*cast due to .constrained prefix*/).ToString(); if (Cache.TryGetValue(key, out var value)) { return value; } int num = d * 3; Color32[] array = (Color32[])(object)new Color32[num * num]; float num2 = (float)num * 0.5f; float num3 = num2 - width * 3f * 0.5f - 3f; float num4 = width * 3f * 0.5f; for (int i = 0; i < num; i++) { int num5 = i * num; for (int j = 0; j < num; j++) { float num6 = (float)j + 0.5f - num2; float num7 = (float)i + 0.5f - num2; float num8 = Mathf.Sqrt(num6 * num6 + num7 * num7); if (!(num8 <= 0f)) { float num9 = Mathf.Clamp01(num4 + 0.5f - Mathf.Abs(num8 - num3)); if (!(num9 <= 0f)) { float num10 = SailFactor(num7 / num8); float num11 = Mathf.SmoothStep(0f, 1f, Mathf.Clamp01((num10 - 0.86f) / 0.08f)); float num12 = Mathf.Clamp01(num10 * 6f); Color val = Color.Lerp(Color.Lerp(dead, good, num12), ideal, num11); val.a *= num9 * Mathf.Lerp(0.85f, Mathf.Lerp(0.55f, 1f, num11), num12); array[num5 + j] = Color32.op_Implicit(val); } } } } Texture2D val2 = new Texture2D(num, num, (TextureFormat)4, true) { wrapMode = (TextureWrapMode)1, filterMode = (FilterMode)2 }; val2.SetPixels32(array); val2.Apply(true, true); value = Sprite.Create(val2, new Rect(0f, 0f, (float)num, (float)num), new Vector2(0.5f, 0.5f), Ppu * 3f, 0u, (SpriteMeshType)0); Cache[key] = value; return value; } private static float PathX(Vector2[] path, float ty) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_002d: 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_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0050: 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_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) for (int i = 1; i < path.Length; i++) { if (!(ty > path[i].y) || i >= path.Length - 1) { Vector2 val = path[i - 1]; Vector2 val2 = path[i]; float num = ((val2.y > val.y) ? Mathf.Clamp01((ty - val.y) / (val2.y - val.y)) : 0f); return val.x + (val2.x - val.x) * num; } } return path[^1].x; } private static Sprite Make(string key, int d, Color32[] px) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0010: 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_001e: 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_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown Texture2D val = new Texture2D(d, d, (TextureFormat)4, false) { wrapMode = (TextureWrapMode)1, filterMode = (FilterMode)1 }; val.SetPixels32(px); val.Apply(false, true); Sprite val2 = Sprite.Create(val, new Rect(0f, 0f, (float)d, (float)d), new Vector2(0.5f, 0.5f), Ppu, 0u, (SpriteMeshType)0); Cache[key] = val2; return val2; } public static Sprite Shard(string id, int d, Vector2[] path, bool left) { //IL_00b8: 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) string key = "shard" + id + d + (left ? "l" : "r"); if (Cache.TryGetValue(key, out var value)) { return value; } Color32[] array = (Color32[])(object)new Color32[d * d]; for (int i = 0; i < d; i++) { float num = PathX(path, 1f - ((float)i + 0.5f) / (float)d) * (float)d; for (int j = 0; j < d; j++) { float num2 = (left ? Sat(num - ((float)j + 0.5f) + 0.5f) : Sat((float)j + 0.5f - num + 0.5f)); array[i * d + j] = new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, (byte)(num2 * 255f)); } } return Make(key, d, array); } public static Sprite Crack(string id, int d, Vector2[] path, float width, float glow) { //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: 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_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: 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_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: 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_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0104: 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_01dd: Unknown result type (might be due to invalid IL or missing references) string key = "crack" + id + d + "|" + width + "|" + glow; if (Cache.TryGetValue(key, out var value)) { return value; } Color32[] array = (Color32[])(object)new Color32[d * d]; Vector2 val = default(Vector2); for (int i = 0; i < d; i++) { float num = (1f - ((float)i + 0.5f) / (float)d) * (float)d; for (int j = 0; j < d; j++) { ((Vector2)(ref val))..ctor((float)j + 0.5f, num); float num2 = float.MaxValue; for (int k = 1; k < path.Length; k++) { Vector2 val2 = path[k - 1] * (float)d; Vector2 val3 = path[k] * (float)d - val2; float num3 = Mathf.Clamp01(Vector2.Dot(val - val2, val3) / ((Vector2)(ref val3)).sqrMagnitude); Vector2 val4 = val2 + val3 * num3 - val; float sqrMagnitude = ((Vector2)(ref val4)).sqrMagnitude; if (sqrMagnitude < num2) { num2 = sqrMagnitude; } } float num4 = Mathf.Sqrt(num2); float num5 = Sat(width * 0.5f + 0.5f - num4); float num6 = ((glow > 0f) ? Mathf.Exp((0f - num4) * num4 / (glow * glow)) : 0f); float num7 = (float)j + 0.5f - (float)d * 0.5f; float num8 = num - (float)d * 0.5f; float num9 = Mathf.Max(num5, num6) * Sat((float)d * 0.5f - 1.5f - Mathf.Sqrt(num7 * num7 + num8 * num8)); array[i * d + j] = new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, (byte)(num9 * 255f)); } } return Make(key, d, array); } public static Sprite Radial(int d, Color color) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0122: 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_0142: Expected O, but got Unknown //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) string key = "rad" + d + "|" + ((object)Color32.op_Implicit(color)/*cast due to .constrained prefix*/).ToString(); if (Cache.TryGetValue(key, out var value)) { return value; } Color32[] array = (Color32[])(object)new Color32[d * d]; float num = (float)d * 0.5f; for (int