using System; using System.Collections; using System.Collections.Concurrent; using System.Collections.Generic; using System.Collections.ObjectModel; using System.ComponentModel; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.IO; using System.IO.Compression; using System.Linq; using System.Linq.Expressions; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Serialization; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using System.Text.RegularExpressions; using System.Threading; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using JetBrains.Annotations; using LocalizationManager; using Microsoft.CodeAnalysis; using ServerSync; using TMPro; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.UI; using YamlDotNet.Core; using YamlDotNet.Core.Events; using YamlDotNet.Core.ObjectPool; using YamlDotNet.Core.Tokens; using YamlDotNet.Helpers; using YamlDotNet.Serialization; using YamlDotNet.Serialization.BufferedDeserialization; using YamlDotNet.Serialization.BufferedDeserialization.TypeDiscriminators; using YamlDotNet.Serialization.Callbacks; using YamlDotNet.Serialization.Converters; using YamlDotNet.Serialization.EventEmitters; using YamlDotNet.Serialization.NamingConventions; using YamlDotNet.Serialization.NodeDeserializers; using YamlDotNet.Serialization.NodeTypeResolvers; using YamlDotNet.Serialization.ObjectFactories; using YamlDotNet.Serialization.ObjectGraphTraversalStrategies; using YamlDotNet.Serialization.ObjectGraphVisitors; using YamlDotNet.Serialization.Schemas; using YamlDotNet.Serialization.TypeInspectors; using YamlDotNet.Serialization.TypeResolvers; using YamlDotNet.Serialization.Utilities; using YamlDotNet.Serialization.ValueDeserializers; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("InventorySlots")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("sighsorry")] [assembly: AssemblyProduct("InventorySlots")] [assembly: AssemblyCopyright("Copyright © 2026")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("A57F2112-F59E-48EF-9D76-F2E4580F7401")] [assembly: AssemblyFileVersion("1.0.4")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.4.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace LocalizationManager { internal static class Localizer { [CompilerGenerated] private sealed class d__15 : IEnumerable, IEnumerable, IEnumerator, IDisposable, IEnumerator { private int <>1__state; private string <>2__current; private int <>l__initialThreadId; private string language; public string <>3__language; private string 5__2; private IEnumerator <>7__wrap2; private string 5__4; private string[] <>7__wrap4; private int <>7__wrap5; private string[] <>7__wrap6; private int <>7__wrap7; string IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__15(int <>1__state) { this.<>1__state = <>1__state; <>l__initialThreadId = Environment.CurrentManagedThreadId; } [DebuggerHidden] void IDisposable.Dispose() { int num = <>1__state; if (num == -3 || num == 1) { try { } finally { <>m__Finally1(); } } 5__2 = null; <>7__wrap2 = null; 5__4 = null; <>7__wrap4 = null; <>7__wrap6 = null; <>1__state = -2; } private bool MoveNext() { try { int num = <>1__state; if (num != 0) { if (num != 1) { return false; } <>1__state = -3; <>7__wrap7++; goto IL_011f; } <>1__state = -1; if ((Object)(object)_plugin == (Object)null) { return false; } 5__2 = _plugin.Info.Metadata.Name; <>7__wrap2 = GetExternalTranslationRoots().GetEnumerator(); <>1__state = -3; goto IL_0165; IL_011f: if (<>7__wrap7 < <>7__wrap6.Length) { string text = <>7__wrap6[<>7__wrap7]; <>2__current = text; <>1__state = 1; return true; } <>7__wrap6 = null; <>7__wrap5++; goto IL_0144; IL_0144: if (<>7__wrap5 < <>7__wrap4.Length) { string text2 = <>7__wrap4[<>7__wrap5]; string searchPattern = 5__2 + "." + language + text2; <>7__wrap6 = Directory.GetFiles(5__4, searchPattern, SearchOption.AllDirectories); <>7__wrap7 = 0; goto IL_011f; } <>7__wrap4 = null; 5__4 = null; goto IL_0165; IL_0165: do { if (<>7__wrap2.MoveNext()) { 5__4 = <>7__wrap2.Current; continue; } <>m__Finally1(); <>7__wrap2 = null; return false; } while (!Directory.Exists(5__4)); <>7__wrap4 = FileExtensions; <>7__wrap5 = 0; goto IL_0144; } catch { //try-fault ((IDisposable)this).Dispose(); throw; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } private void <>m__Finally1() { <>1__state = -1; if (<>7__wrap2 != null) { <>7__wrap2.Dispose(); } } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } [DebuggerHidden] IEnumerator IEnumerable.GetEnumerator() { d__15 d__; if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId) { <>1__state = 0; d__ = this; } else { d__ = new d__15(0); } d__.language = <>3__language; return d__; } [DebuggerHidden] IEnumerator IEnumerable.GetEnumerator() { return ((IEnumerable)this).GetEnumerator(); } } [CompilerGenerated] private sealed class d__16 : IEnumerable, IEnumerable, IEnumerator, IDisposable, IEnumerator { private int <>1__state; private string <>2__current; private int <>l__initialThreadId; string IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__16(int <>1__state) { this.<>1__state = <>1__state; <>l__initialThreadId = Environment.CurrentManagedThreadId; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; if (!string.IsNullOrWhiteSpace(Paths.PluginPath)) { <>2__current = Paths.PluginPath; <>1__state = 1; return true; } goto IL_0049; case 1: <>1__state = -1; goto IL_0049; case 2: { <>1__state = -1; break; } IL_0049: if ((Object)(object)_plugin != (Object)null) { <>2__current = Path.Combine(Paths.ConfigPath, _plugin.Info.Metadata.GUID + "Translations"); <>1__state = 2; return true; } break; } return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } [DebuggerHidden] IEnumerator IEnumerable.GetEnumerator() { if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId) { <>1__state = 0; return this; } return new d__16(0); } [DebuggerHidden] IEnumerator IEnumerable.GetEnumerator() { return ((IEnumerable)this).GetEnumerator(); } } private static readonly string[] FileExtensions = new string[2] { ".yml", ".json" }; private static readonly ManualLogSource Log = Logger.CreateLogSource("InventorySlots.Localization"); private static BaseUnityPlugin? _plugin; private static bool _loaded; public static event Action? OnLocalizationComplete; public static void Load(BaseUnityPlugin plugin) { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Expected O, but got Unknown _plugin = plugin; if (_loaded) { TryLoadCurrentLanguage(); return; } _loaded = true; PatchLocalization(new Harmony(plugin.Info.Metadata.GUID + ".LocalizationManager")); TryLoadCurrentLanguage(); } private static void PatchLocalization(Harmony harmony) { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Expected O, but got Unknown //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Expected O, but got Unknown MethodInfo methodInfo = AccessTools.DeclaredMethod(typeof(Localization), "SetupLanguage", (Type[])null, (Type[])null); if (methodInfo != null) { harmony.Patch((MethodBase)methodInfo, (HarmonyMethod)null, new HarmonyMethod(typeof(Localizer), "LocalizationSetupLanguagePostfix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } MethodInfo methodInfo2 = AccessTools.DeclaredMethod(typeof(FejdStartup), "SetupGui", (Type[])null, (Type[])null); if (methodInfo2 != null) { harmony.Patch((MethodBase)methodInfo2, (HarmonyMethod)null, new HarmonyMethod(typeof(Localizer), "FejdStartupSetupGuiPostfix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } } private static void LocalizationSetupLanguagePostfix(Localization __instance, string language) { LoadLocalization(__instance, language); } private static void FejdStartupSetupGuiPostfix() { TryLoadCurrentLanguage(); } private static void TryLoadCurrentLanguage() { if (Localization.instance != null) { LoadLocalization(Localization.instance, Localization.instance.GetSelectedLanguage()); } } private static void LoadLocalization(Localization localization, string language) { if ((Object)(object)_plugin == (Object)null || localization == null) { return; } Dictionary dictionary = LoadLanguageDictionary("English"); if (!string.Equals(language, "English", StringComparison.OrdinalIgnoreCase)) { Merge(dictionary, LoadLanguageDictionary(language)); } foreach (KeyValuePair item in dictionary) { localization.AddWord(item.Key, item.Value); } Localizer.OnLocalizationComplete?.Invoke(); } private static Dictionary LoadLanguageDictionary(string language) { Dictionary dictionary = new Dictionary(StringComparer.OrdinalIgnoreCase); Merge(dictionary, LoadEmbeddedLanguage(language)); foreach (string item in FindExternalTranslationFiles(language)) { try { Merge(dictionary, ParseTranslations(File.ReadAllText(item), item)); } catch (Exception ex) { Log.LogWarning((object)("Failed to load localization file " + item + ": " + ex.Message)); } } return dictionary; } private static Dictionary LoadEmbeddedLanguage(string language) { string[] fileExtensions = FileExtensions; foreach (string text in fileExtensions) { byte[] array = ReadEmbeddedFileBytes("translations." + language + text); if (array != null) { return ParseTranslations(Encoding.UTF8.GetString(array), language + text); } } if (string.Equals(language, "English", StringComparison.OrdinalIgnoreCase)) { Log.LogWarning((object)"Found no embedded English localization for InventorySlots."); } return new Dictionary(StringComparer.OrdinalIgnoreCase); } [IteratorStateMachine(typeof(d__15))] private static IEnumerable FindExternalTranslationFiles(string language) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__15(-2) { <>3__language = language }; } [IteratorStateMachine(typeof(d__16))] private static IEnumerable GetExternalTranslationRoots() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__16(-2); } private static Dictionary ParseTranslations(string text, string source) { try { return new DeserializerBuilder().IgnoreFields().Build().Deserialize>(text) ?? new Dictionary(StringComparer.OrdinalIgnoreCase); } catch (Exception ex) { Log.LogWarning((object)("Failed to parse localization source " + source + ": " + ex.Message)); return new Dictionary(StringComparer.OrdinalIgnoreCase); } } private static void Merge(Dictionary target, Dictionary source) { foreach (KeyValuePair item in source) { target[item.Key] = item.Value; } } private static byte[]? ReadEmbeddedFileBytes(string resourceFileName) { string resourceFileName2 = resourceFileName; if ((Object)(object)_plugin == (Object)null) { return null; } Assembly assembly = ((object)_plugin).GetType().Assembly; string text = assembly.GetManifestResourceNames().FirstOrDefault((string name) => name.EndsWith(resourceFileName2, StringComparison.OrdinalIgnoreCase)); if (text == null) { return null; } using Stream stream = assembly.GetManifestResourceStream(text); if (stream == null) { return null; } using MemoryStream memoryStream = new MemoryStream(); stream.CopyTo(memoryStream); return (memoryStream.Length == 0L) ? null : memoryStream.ToArray(); } } } namespace InventorySlots { [BepInPlugin("sighsorry.InventorySlots", "InventorySlots", "1.0.4")] [BepInIncompatibility("Azumatt.AzuExtendedPlayerInventory")] [BepInIncompatibility("shudnal.ExtraSlots")] [BepInIncompatibility("shudnal.ExtraSlotsCustomSlots")] [BepInIncompatibility("randyknapp.mods.equipmentandquickslots")] [BepInIncompatibility("com.bruce.valheim.comfyquickslots")] [BepInIncompatibility("goldenrevolver.quick_stack_store")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public sealed class InventorySlotsPlugin : BaseUnityPlugin { private sealed class AzuCraftyBoxesApi { private readonly MethodInfo _getNearbyContainersMethod; private readonly MethodInfo _canItemBePulledMethod; private readonly MethodInfo? _shouldPreventMethod; private readonly FieldInfo? _rangeField; private readonly FieldInfo? _leaveOneField; private readonly FieldInfo? _resourceStringField; private readonly FieldInfo? _flashColorField; private readonly FieldInfo? _unFlashColorField; private readonly Dictionary _getPrefabNameMethods = new Dictionary(); private readonly Dictionary _itemCountMethods = new Dictionary(); private ConfigEntryBase? _rangeConfig; private ConfigEntryBase? _leaveOneConfig; private ConfigEntryBase? _resourceStringConfig; private ConfigEntryBase? _flashColorConfig; private ConfigEntryBase? _unFlashColorConfig; private AzuCraftyBoxesApi(MethodInfo getNearbyContainersMethod, MethodInfo canItemBePulledMethod, MethodInfo? shouldPreventMethod, FieldInfo? rangeField, FieldInfo? leaveOneField, FieldInfo? resourceStringField, FieldInfo? flashColorField, FieldInfo? unFlashColorField) { _getNearbyContainersMethod = getNearbyContainersMethod; _canItemBePulledMethod = canItemBePulledMethod; _shouldPreventMethod = shouldPreventMethod; _rangeField = rangeField; _leaveOneField = leaveOneField; _resourceStringField = resourceStringField; _flashColorField = flashColorField; _unFlashColorField = unFlashColorField; } public static bool TryCreate(Assembly assembly, out AzuCraftyBoxesApi? api, out string detail) { api = null; Type type = assembly.GetType("AzuCraftyBoxes.API"); Type type2 = assembly.GetType("AzuCraftyBoxes.AzuCraftyBoxesPlugin"); Type type3 = assembly.GetType("AzuCraftyBoxes.Util.Functions.MiscFunctions"); MethodInfo methodInfo = (type?.GetMethods(BindingFlags.Static | BindingFlags.Public).FirstOrDefault((MethodInfo method) => method.Name == "GetNearbyContainers" && method.IsGenericMethodDefinition && method.GetParameters().Length == 2))?.MakeGenericMethod(typeof(Player)); MethodInfo methodInfo2 = type?.GetMethod("CanItemBePulled", BindingFlags.Static | BindingFlags.Public, null, new Type[2] { typeof(string), typeof(string) }, null); if (methodInfo == null || methodInfo2 == null) { detail = "required API methods were not found"; return false; } api = new AzuCraftyBoxesApi(methodInfo, methodInfo2, type3?.GetMethod("ShouldPrevent", BindingFlags.Static | BindingFlags.NonPublic), type2?.GetField("mRange", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic), type2?.GetField("leaveOne", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic), type2?.GetField("resourceString", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic), type2?.GetField("flashColor", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic), type2?.GetField("unFlashColor", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic)); detail = ""; return true; } public IEnumerable? GetNearbyContainers(Player player, float range) { return _getNearbyContainersMethod.Invoke(null, new object[2] { player, range }) as IEnumerable; } public bool CanItemBePulled(string containerPrefab, string itemPrefab) { try { object obj = _canItemBePulledMethod.Invoke(null, new object[2] { containerPrefab, itemPrefab }); return obj is bool && (bool)obj; } catch { return false; } } public bool ShouldPrevent() { if (_shouldPreventMethod == null) { return false; } try { object obj = _shouldPreventMethod.Invoke(null, null); return obj is bool && (bool)obj; } catch { return false; } } public float GetRange() { object cachedConfigEntryValue = GetCachedConfigEntryValue(_rangeField, ref _rangeConfig); if (cachedConfigEntryValue == null) { return 20f; } try { return Convert.ToSingle(cachedConfigEntryValue); } catch { return 20f; } } public bool GetLeaveOne() { string a = GetCachedConfigEntryValue(_leaveOneField, ref _leaveOneConfig)?.ToString() ?? ""; if (!string.Equals(a, "On", StringComparison.OrdinalIgnoreCase)) { return string.Equals(a, "True", StringComparison.OrdinalIgnoreCase); } return true; } public string InvokeString(object instance, string methodName) { Type type = instance.GetType(); if (!_getPrefabNameMethods.TryGetValue(type, out MethodInfo value)) { value = type.GetMethod(methodName, BindingFlags.Instance | BindingFlags.Public); _getPrefabNameMethods[type] = value; } try { return (value?.Invoke(instance, null) as string) ?? ""; } catch { return ""; } } public int InvokeInt(object instance, string methodName, string argument) { Type type = instance.GetType(); if (!_itemCountMethods.TryGetValue(type, out MethodInfo value)) { value = type.GetMethod(methodName, BindingFlags.Instance | BindingFlags.Public, null, new Type[1] { typeof(string) }, null); _itemCountMethods[type] = value; } try { return (value?.Invoke(instance, new object[1] { argument }) is int num) ? num : 0; } catch { return 0; } } public bool TryFormatRequirementAmount(int available, int required, out string text) { text = ""; string text2 = (GetCachedConfigEntryValue(_resourceStringField, ref _resourceStringConfig) as string) ?? ""; if (string.IsNullOrWhiteSpace(text2)) { text = required.ToString(); return true; } try { text = string.Format(text2, FormatThousands(available), required); return true; } catch { text = $"{FormatThousands(available)}/{required}"; return true; } } public bool TryGetRequirementFlashColor(out Color color) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0061: 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_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) color = default(Color); FieldInfo fieldInfo = ((Mathf.Sin(Time.time * 10f) > 0f) ? _flashColorField : _unFlashColorField); if (((fieldInfo == _flashColorField) ? GetCachedConfigEntryValue(fieldInfo, ref _flashColorConfig) : GetCachedConfigEntryValue(fieldInfo, ref _unFlashColorConfig)) is Color val) { color = val; return true; } return false; } private object? GetCachedConfigEntryValue(FieldInfo? field, ref ConfigEntryBase? config) { if (field == null) { return null; } try { if (config == null) { object? value = field.GetValue(null); config = (ConfigEntryBase?)((value is ConfigEntryBase) ? value : null); } ConfigEntryBase? obj = config; return (obj != null) ? obj.BoxedValue : null; } catch { config = null; return null; } } private static string FormatThousands(int number) { if (number >= 1000000) { return ((double)number / 1000000.0).ToString("0.#") + "M"; } if (number < 1000) { return number.ToString(); } return ((double)number / 1000.0).ToString("0.#") + "K"; } } private sealed class AdventureBackpacksApi { private readonly MethodInfo _isBackpackMethod; private readonly MethodInfo? _equipItemPostfixMethod; private readonly MethodInfo? _unequipItemPrefixMethod; private readonly MethodInfo? _isBackpackEquippedMethod; private readonly MethodInfo? _isThisBackpackEquippedMethod; private readonly MethodInfo? _getEquippedBackpackMethod; private readonly FieldInfo? _backpackEquippedField; private AdventureBackpacksApi(MethodInfo isBackpackMethod, MethodInfo? equipItemPostfixMethod, MethodInfo? unequipItemPrefixMethod, MethodInfo? isBackpackEquippedMethod, MethodInfo? isThisBackpackEquippedMethod, MethodInfo? getEquippedBackpackMethod, FieldInfo? backpackEquippedField) { _isBackpackMethod = isBackpackMethod; _equipItemPostfixMethod = equipItemPostfixMethod; _unequipItemPrefixMethod = unequipItemPrefixMethod; _isBackpackEquippedMethod = isBackpackEquippedMethod; _isThisBackpackEquippedMethod = isThisBackpackEquippedMethod; _getEquippedBackpackMethod = getEquippedBackpackMethod; _backpackEquippedField = backpackEquippedField; } public static bool TryCreate(Assembly assembly, out AdventureBackpacksApi? api, out string detail) { api = null; MethodInfo methodInfo = assembly.GetType("AdventureBackpacks.API.ABAPI")?.GetMethod("IsBackpack", BindingFlags.Static | BindingFlags.Public, null, new Type[1] { typeof(ItemData) }, null); if (methodInfo == null) { detail = "AdventureBackpacks.API.ABAPI.IsBackpack was not found"; return false; } Type? type = assembly.GetType("AdventureBackpacks.Patches.HumanoidPatches"); Type type2 = type?.GetNestedType("HumanoidEquipItemPatch", BindingFlags.NonPublic); Type type3 = type?.GetNestedType("HumanoidUnequipItemPatch", BindingFlags.NonPublic); Type type4 = assembly.GetType("AdventureBackpacks.Extensions.PlayerExtensions"); Type type5 = assembly.GetType("AdventureBackpacks.Patches.InventoryGuiPatches"); api = new AdventureBackpacksApi(methodInfo, type2?.GetMethod("Postfix", BindingFlags.Static | BindingFlags.NonPublic), type3?.GetMethod("Prefix", BindingFlags.Static | BindingFlags.NonPublic), type4?.GetMethod("IsBackpackEquipped", BindingFlags.Static | BindingFlags.Public), type4?.GetMethod("IsThisBackpackEquipped", BindingFlags.Static | BindingFlags.Public), type4?.GetMethod("GetEquippedBackpack", BindingFlags.Static | BindingFlags.Public), type5?.GetField("BackpackEquipped", BindingFlags.Static | BindingFlags.Public)); detail = ""; return true; } public bool IsBackpack(ItemData? item) { if (item == null) { return false; } try { object obj = _isBackpackMethod.Invoke(null, new object[1] { item }); return obj is bool && (bool)obj; } catch { return false; } } public bool IsBackpackEquippedFlagSet() { try { object obj = _backpackEquippedField?.GetValue(null); return obj is bool && (bool)obj; } catch { return false; } } public void OnCustomBackpackEquipped(Player player, ItemData item) { if ((Object)(object)player == (Object)null || item == null || !IsBackpack(item)) { return; } try { _equipItemPostfixMethod?.Invoke(null, new object[2] { item, true }); _backpackEquippedField?.SetValue(null, true); } catch (Exception ex) { Log.LogDebug((object)("AdventureBackpacks equip sync failed: " + ex.Message)); } } public void OnCustomBackpackUnequipping(Player player, ItemData item) { if ((Object)(object)player == (Object)null || item == null || !IsBackpack(item)) { return; } ItemData shoulderItem = ((Humanoid)player).m_shoulderItem; try { ((Humanoid)player).m_shoulderItem = item; _unequipItemPrefixMethod?.Invoke(null, new object[1] { item }); } catch (Exception ex) { Log.LogDebug((object)("AdventureBackpacks unequip sync failed: " + ex.Message)); } finally { ((Humanoid)player).m_shoulderItem = shoulderItem; } } public void ApplyPatches(Harmony harmony) { PatchOptional(harmony, _isBackpackEquippedMethod, null, "AdventureBackpackIsBackpackEquippedPostfix", "AdventureBackpacks IsBackpackEquipped"); PatchOptional(harmony, _isThisBackpackEquippedMethod, null, "AdventureBackpackIsThisBackpackEquippedPostfix", "AdventureBackpacks IsThisBackpackEquipped"); PatchOptional(harmony, _getEquippedBackpackMethod, "AdventureBackpackGetEquippedBackpackPrefix", "AdventureBackpackGetEquippedBackpackPostfix", "AdventureBackpacks GetEquippedBackpack"); } private static void PatchOptional(Harmony harmony, MethodInfo? target, string? prefix = null, string? postfix = null, string? label = null) { //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) if (harmony != null && !(target == null)) { MethodInfo methodInfo = ((prefix == null) ? null : AccessTools.Method(typeof(InventorySlotsPlugin), prefix, (Type[])null, (Type[])null)); MethodInfo methodInfo2 = ((postfix == null) ? null : AccessTools.Method(typeof(InventorySlotsPlugin), postfix, (Type[])null, (Type[])null)); harmony.Patch((MethodBase)target, (methodInfo == null) ? ((HarmonyMethod)null) : new HarmonyMethod(methodInfo), (methodInfo2 == null) ? ((HarmonyMethod)null) : new HarmonyMethod(methodInfo2), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); Log.LogDebug((object)((label ?? target.Name) + " compatibility patch applied.")); } } } private sealed class SmoothbrainBackpacksApi { private readonly MethodInfo _validateBackpackMethod; private readonly FieldInfo _visualsField; private readonly FieldInfo _equippedBackpackItemField; private readonly FieldInfo? _currentBackpackItemHashField; private readonly MethodInfo? _setBackpackItemMethod; private readonly MethodInfo? _forceSetBackpackEquippedMethod; private SmoothbrainBackpacksApi(MethodInfo validateBackpackMethod, FieldInfo visualsField, FieldInfo equippedBackpackItemField, FieldInfo? currentBackpackItemHashField, MethodInfo? setBackpackItemMethod, MethodInfo? forceSetBackpackEquippedMethod) { _validateBackpackMethod = validateBackpackMethod; _visualsField = visualsField; _equippedBackpackItemField = equippedBackpackItemField; _currentBackpackItemHashField = currentBackpackItemHashField; _setBackpackItemMethod = setBackpackItemMethod; _forceSetBackpackEquippedMethod = forceSetBackpackEquippedMethod; } public static bool TryCreate(Assembly assembly, out SmoothbrainBackpacksApi? api, out string detail) { api = null; Type? type = assembly.GetType("Backpacks.Backpacks"); Type type2 = assembly.GetType("Backpacks.Visual"); MethodInfo methodInfo = type?.GetMethod("validateBackpack", BindingFlags.Static | BindingFlags.NonPublic, null, new Type[1] { typeof(ItemData) }, null); FieldInfo fieldInfo = type2?.GetField("visuals", BindingFlags.Static | BindingFlags.Public); FieldInfo fieldInfo2 = type2?.GetField("equippedBackpackItem", BindingFlags.Instance | BindingFlags.Public); if (methodInfo == null || fieldInfo == null || fieldInfo2 == null) { detail = "validateBackpack or Visual fields were not found"; return false; } api = new SmoothbrainBackpacksApi(methodInfo, fieldInfo, fieldInfo2, type2?.GetField("currentBackpackItemHash", BindingFlags.Instance | BindingFlags.Public), type2?.GetMethod("setBackpackItem", BindingFlags.Instance | BindingFlags.NonPublic), type2?.GetMethod("forceSetBackpackEquipped", BindingFlags.Instance | BindingFlags.Public)); detail = ""; return true; } public bool IsBackpack(ItemData? item) { if (item == null) { return false; } try { object obj = _validateBackpackMethod.Invoke(null, new object[1] { item }); return obj is bool && (bool)obj; } catch { return false; } } public void SyncEquippedBackpack(Player player, ItemData? item) { if ((Object)(object)player == (Object)null || IsUnityNull((Object?)(object)((Humanoid)player).m_visEquipment) || !TryGetVisual(((Humanoid)player).m_visEquipment, out object visual) || visual == null) { return; } try { string text = (((Object)(object)item?.m_dropPrefab != (Object)null) ? ((Object)item.m_dropPrefab).name : ""); int num = ((!string.IsNullOrWhiteSpace(text)) ? StringExtensionMethods.GetStableHashCode(text) : 0); if (_equippedBackpackItemField.GetValue(visual) != item) { _equippedBackpackItemField.SetValue(visual, item); } _setBackpackItemMethod?.Invoke(visual, new object[1] { text }); if (_forceSetBackpackEquippedMethod != null && GetCurrentHash(visual) != num) { _forceSetBackpackEquippedMethod.Invoke(visual, new object[1] { num }); } } catch (Exception ex) { Log.LogDebug((object)("Smoothbrain Backpacks visual sync failed: " + ex.Message)); } } private bool TryGetVisual(VisEquipment visEquipment, out object? visual) { visual = null; if (!(_visualsField.GetValue(null) is IDictionary dictionary) || !dictionary.Contains(visEquipment)) { return false; } visual = dictionary[visEquipment]; return visual != null; } private int GetCurrentHash(object visual) { try { return (_currentBackpackItemHashField?.GetValue(visual) is int num) ? num : 0; } catch { return 0; } } } private sealed class RustyBagsApi { private readonly MethodInfo _isBagMethod; private readonly MethodInfo _isQuiverMethod; private readonly Type _bagEquipmentType; private readonly Type _bagType; private readonly Type _quiverType; private readonly MethodInfo _getBagMethod; private readonly MethodInfo _getQuiverMethod; private readonly MethodInfo _setBagMethod; private readonly MethodInfo _setQuiverMethod; private RustyBagsApi(MethodInfo isBagMethod, MethodInfo isQuiverMethod, Type bagEquipmentType, Type bagType, Type quiverType, MethodInfo getBagMethod, MethodInfo getQuiverMethod, MethodInfo setBagMethod, MethodInfo setQuiverMethod) { _isBagMethod = isBagMethod; _isQuiverMethod = isQuiverMethod; _bagEquipmentType = bagEquipmentType; _bagType = bagType; _quiverType = quiverType; _getBagMethod = getBagMethod; _getQuiverMethod = getQuiverMethod; _setBagMethod = setBagMethod; _setQuiverMethod = setQuiverMethod; } public static bool TryCreate(Assembly assembly, out RustyBagsApi? api, out string detail) { api = null; Type type = assembly.GetType("RustyBags.API"); Type type2 = assembly.GetType("RustyBags.BagEquipment"); Type type3 = assembly.GetType("RustyBags.Bag"); Type type4 = assembly.GetType("RustyBags.Quiver"); MethodInfo methodInfo = type?.GetMethod("IsBag", BindingFlags.Static | BindingFlags.Public, null, new Type[1] { typeof(string) }, null); MethodInfo methodInfo2 = type?.GetMethod("IsQuiver", BindingFlags.Static | BindingFlags.Public, null, new Type[1] { typeof(string) }, null); MethodInfo methodInfo3 = type2?.GetMethod("GetBag", BindingFlags.Instance | BindingFlags.Public); MethodInfo methodInfo4 = type2?.GetMethod("GetQuiver", BindingFlags.Instance | BindingFlags.Public); MethodInfo methodInfo5 = type2?.GetMethod("SetBag", BindingFlags.Instance | BindingFlags.NonPublic); MethodInfo methodInfo6 = type2?.GetMethod("SetQuiver", BindingFlags.Instance | BindingFlags.Public); if (methodInfo == null || methodInfo2 == null || type2 == null || type3 == null || type4 == null || methodInfo3 == null || methodInfo4 == null || methodInfo5 == null || methodInfo6 == null) { detail = "RustyBags API or BagEquipment methods were not found"; return false; } api = new RustyBagsApi(methodInfo, methodInfo2, type2, type3, type4, methodInfo3, methodInfo4, methodInfo5, methodInfo6); detail = ""; return true; } public bool IsBag(ItemData? item) { if (item?.m_shared == null) { return false; } try { object obj = _isBagMethod.Invoke(null, new object[1] { item.m_shared.m_name }); return obj is bool && (bool)obj; } catch { return false; } } public bool IsQuiver(ItemData? item) { if (item?.m_shared == null) { return false; } try { object obj = _isQuiverMethod.Invoke(null, new object[1] { item.m_shared.m_name }); return obj is bool && (bool)obj; } catch { return false; } } public void SyncBag(Player player, ItemData? item) { if (item == null || _bagType.IsInstanceOfType(item)) { InvokeEquipmentSetter(player, _setBagMethod, item); } } public void SyncQuiver(Player player, ItemData? item) { if (item == null || _quiverType.IsInstanceOfType(item)) { InvokeEquipmentSetter(player, _setQuiverMethod, item); } } public void ClearBagIfCurrent(Player player, ItemData item) { object bagEquipment = GetBagEquipment(player); if (bagEquipment != null && _getBagMethod.Invoke(bagEquipment, Array.Empty()) == item) { _setBagMethod.Invoke(bagEquipment, new object[1]); } } public void ClearQuiverIfCurrent(Player player, ItemData item) { object bagEquipment = GetBagEquipment(player); if (bagEquipment != null && _getQuiverMethod.Invoke(bagEquipment, Array.Empty()) == item) { _setQuiverMethod.Invoke(bagEquipment, new object[1]); } } private void InvokeEquipmentSetter(Player player, MethodInfo setter, ItemData? item) { object bagEquipment = GetBagEquipment(player); if (bagEquipment == null) { return; } try { setter.Invoke(bagEquipment, new object[1] { item }); } catch (Exception ex) { Log.LogDebug((object)("RustyBags equipment sync failed: " + ex.Message)); } } private object? GetBagEquipment(Player player) { if ((Object)(object)player == (Object)null) { return null; } try { return ((Component)player).GetComponent(_bagEquipmentType); } catch { return null; } } } private sealed class BetterArcheryQuiverApi { private readonly FieldInfo _quiverEnabledField; private readonly FieldInfo _quiverRowIndexField; private ConfigEntry? _quiverEnabledConfig; private bool _quiverRowIndexResolved; private int _quiverRowIndex; private BetterArcheryQuiverApi(FieldInfo quiverEnabledField, FieldInfo quiverRowIndexField) { _quiverEnabledField = quiverEnabledField; _quiverRowIndexField = quiverRowIndexField; } public static bool TryCreate(Assembly assembly, out BetterArcheryQuiverApi? api, out string detail) { api = null; Type type = assembly.GetTypes().FirstOrDefault((Type candidate) => candidate.IsClass && candidate.Name == "BetterArchery"); if (type == null) { detail = "BetterArchery type was not found"; return false; } FieldInfo[] fields = type.GetFields(BindingFlags.Static | BindingFlags.Public); FieldInfo fieldInfo = fields.FirstOrDefault((FieldInfo field) => string.Equals(field.Name, "ConfigQuiverEnabled", StringComparison.OrdinalIgnoreCase)); FieldInfo fieldInfo2 = fields.FirstOrDefault((FieldInfo field) => string.Equals(field.Name, "QuiverRowIndex", StringComparison.OrdinalIgnoreCase)); if (fieldInfo == null || fieldInfo2 == null) { detail = "quiver config fields were not found"; return false; } api = new BetterArcheryQuiverApi(fieldInfo, fieldInfo2); detail = ""; return true; } public bool IsQuiverCell(Vector2i pos, bool includeRestockableSlots) { //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) try { if (_quiverEnabledConfig == null) { _quiverEnabledConfig = _quiverEnabledField.GetValue(null) as ConfigEntry; } } catch { _quiverEnabledConfig = null; } if (_quiverEnabledConfig == null || !_quiverEnabledConfig.Value) { return false; } if (!_quiverRowIndexResolved || _quiverRowIndex == 0) { try { _quiverRowIndex = ((_quiverRowIndexField.GetValue(null) is int num) ? num : 0); } catch { _quiverRowIndex = 0; } _quiverRowIndexResolved = _quiverRowIndex != 0; } if (_quiverRowIndex == 0) { return false; } if (pos.y == _quiverRowIndex - 1) { return true; } if (pos.y == _quiverRowIndex) { if (!includeRestockableSlots) { return pos.x > 2; } return true; } return false; } } private delegate bool CompatApiFactory(Assembly assembly, out TApi? api, out string detail) where TApi : class; private enum CompatCapabilityState { Unknown, Unavailable, Available, MissingApi, Failed } private sealed class CompatApiRuntimeState where TApi : class { public TApi? Api; public bool ReflectionFailed; public CompatCapabilityState CapabilityState; } private sealed class CompatRuntimeState { public bool MyLittleUICraftingCompatibilityApplied; public bool JewelcraftingSlotStateInitialized; public bool AdventureBackpacksPatchesApplied; public bool LastJewelcraftingRingSlotEnabled; public bool LastJewelcraftingNecklaceSlotEnabled; public ItemData? LastAdventureBackpackCompatItem; public ItemData? LastSmoothbrainBackpackCompatItem; public ItemData? LastRustyBagCompatItem; public ItemData? LastRustyQuiverCompatItem; public ItemData? LastMagicSupremacyBeltCompatItem; public readonly CompatApiRuntimeState AzuCraftyBoxes = new CompatApiRuntimeState(); public readonly CompatApiRuntimeState JewelcraftingTooltip = new CompatApiRuntimeState(); public readonly CompatApiRuntimeState JewelcraftingGem = new CompatApiRuntimeState(); public readonly CompatApiRuntimeState JewelcraftingSlot = new CompatApiRuntimeState(); public readonly CompatApiRuntimeState JewelcraftingCraftingSocketUi = new CompatApiRuntimeState(); public readonly CompatApiRuntimeState JewelcraftingGemCutting = new CompatApiRuntimeState(); public readonly CompatApiRuntimeState JewelcraftingVisual = new CompatApiRuntimeState(); public readonly CompatApiRuntimeState ItemRequiresSkillLevel = new CompatApiRuntimeState(); public readonly CompatApiRuntimeState RecycleNReclaim = new CompatApiRuntimeState(); public readonly CompatApiRuntimeState AdventureBackpacks = new CompatApiRuntimeState(); public readonly CompatApiRuntimeState SmoothbrainBackpacks = new CompatApiRuntimeState(); public readonly CompatApiRuntimeState RustyBags = new CompatApiRuntimeState(); public readonly CompatApiRuntimeState MagicSupremacy = new CompatApiRuntimeState(); public readonly CompatApiRuntimeState BetterArcheryQuiver = new CompatApiRuntimeState(); } private readonly struct SfxVolumeMemberCache { public FieldInfo[] Fields { get; } public PropertyInfo[] Properties { get; } public SfxVolumeMemberCache(FieldInfo[] fields, PropertyInfo[] properties) { Fields = fields; Properties = properties; } } private enum ContainerTakeStacksMode { CurrentContainerMatchingStacks, AreaFavoriteRestock } private sealed class ControllerActionOption { public ControllerHotkeyAction Action { get; } public string Label { get; } public ControllerActionOption(ControllerHotkeyAction action, string label) { Action = action; Label = label; } } private sealed class CustomEquipmentVisualState { public string SlotId { get; } public int ItemHash { get; } public int Variant { get; } public string PrefabName { get; } public ItemType ItemType { get; } public CustomEquipmentVisualState(string slotId, int itemHash, int variant, string prefabName, ItemType itemType) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) SlotId = slotId; ItemHash = itemHash; Variant = variant; PrefabName = prefabName; ItemType = itemType; } } private sealed class CustomEquipmentVisual { private readonly List _instances = new List(); public string Key { get; } public VisEquipment Owner { get; } public string PrefabName { get; } public int Variant { get; } public CustomEquipmentVisual(string key, VisEquipment owner, string prefabName, int variant) { Key = key; Owner = owner; PrefabName = prefabName; Variant = variant; } public bool Matches(VisEquipment owner, string prefabName, int variant) { if (!IsUnityNull((Object?)(object)Owner) && (Object)(object)Owner == (Object)(object)owner && string.Equals(PrefabName, prefabName, StringComparison.Ordinal)) { return Variant == variant; } return false; } public bool IsOwnedBy(VisEquipment owner) { if (!IsUnityNull((Object?)(object)Owner)) { return (Object)(object)Owner == (Object)(object)owner; } return false; } public void Add(GameObject? instance) { if (!IsUnityNull((Object?)(object)instance)) { _instances.Add(instance); } } public void AddRange(IEnumerable? instances) { if (instances == null) { return; } foreach (GameObject instance in instances) { Add(instance); } } public void AddActiveInstancesTo(List roots) { foreach (GameObject instance in _instances) { if (!IsUnityNull((Object?)(object)instance)) { roots.Add(instance); } } } public void Destroy() { foreach (GameObject instance in _instances) { if (!IsUnityNull((Object?)(object)instance)) { if (!IsUnityNull((Object?)(object)Owner) && !IsUnityNull((Object?)(object)Owner.m_lodGroup)) { Utils.RemoveFromLodgroup(Owner.m_lodGroup, instance); } Object.Destroy((Object)(object)instance); } } _instances.Clear(); } } private readonly struct CraftingRequirementAvailabilityCacheEntry { public int Amount { get; } public float ExpiresAt { get; } public CraftingRequirementAvailabilityCacheEntry(int amount, float expiresAt) { Amount = amount; ExpiresAt = expiresAt; } } private sealed class CraftingRequirementRuntimeState { public readonly Dictionary AvailabilityCache = new Dictionary(StringComparer.OrdinalIgnoreCase); public readonly List VisibleRequirements = new List(); public readonly List VisibleRequirementCandidates = new List(); public readonly List OwnedSlots = new List(); public int AvailabilityVersion; } private sealed class CraftingRecipeRuntimeState { public readonly List GridCells = new List(); public readonly List View = new List(); public readonly Dictionary ViewIndexByOriginal = new Dictionary(); public readonly List GroupPanels = new List(); public readonly List GroupButtons = new List(); public readonly Dictionary Variants = new Dictionary(); public readonly Dictionary SearchTextCache = new Dictionary(); public readonly Dictionary HoverTooltipContentCache = new Dictionary(StringComparer.Ordinal); public readonly List HoverGemIconCache = new List(); public readonly Dictionary EnglishLocalizationCache = new Dictionary(StringComparer.OrdinalIgnoreCase); public readonly Dictionary EnglishLocalizationIndex = new Dictionary(StringComparer.OrdinalIgnoreCase); public readonly Dictionary SortKeyCache = new Dictionary(); public readonly Dictionary> GroupMatchCache = new Dictionary>(); public readonly List SelectableGroupFilterCache = new List(); public readonly Dictionary GroupHasRecipesCache = new Dictionary(StringComparer.OrdinalIgnoreCase); } private sealed class CraftingGridRuntimeState { public RectTransform? RecipeGrid; public bool RecipeGridDirty = true; public int RecipePage; public string RecipeGridSignature = ""; public string RecipeGridLayoutSignature = ""; public int RecipeGridCellCapacity = -1; } private sealed class CraftingScrollbarRuntimeState { public RectTransform? RecipeScrollbar; public Scrollbar? RecipeScrollbarComponent; public bool UpdatingRecipeScrollbar; public bool RecipeScrollbarDirty = true; public string RecipeScrollbarSignature = ""; } private sealed class CraftingQueueRuntimeState { public bool ContinuingQueue; public int QueueTotal; public int QueueRemaining; public int QueueVariant; public int ProgressLabelCount; public int ProgressLabelVariant; public Recipe? QueueRecipe; public Recipe? ProgressLabelRecipe; } private sealed class CraftingUiRuntimeState { public GameObject? HoverTooltip; public RectTransform? HoverTooltipPanel; public TMP_Text? HoverTooltipTopic; public TMP_Text? HoverTooltipText; public readonly ScrollableTooltipBodyState HoverTooltipTextScroll = new ScrollableTooltipBodyState(); public RectTransform? TooltipRecipeOverlay; public RectTransform? TooltipExpandedPanel; public RectTransform? TooltipGemIconRow; public TMP_InputField? SearchInput; public RectTransform? SearchInputRect; public RectTransform? RecipeGridZoomHint; public TMP_Text? RecipeGridZoomHintText; public bool SearchInputDirty = true; public int HoveredRecipeIndex = -1; public string SearchInputSignature = ""; public string RecipeGridZoomHintSignature = ""; public string HoverTooltipSignature = ""; public string HoverTooltipContentKey = ""; public string HoverTooltipLayoutSignature = ""; public string HoverTooltipVisualSignature = ""; public string HoverGemIconSignature = ""; public float HoverTooltipScrollOffset; public float HoverTooltipMaxScroll; } private static class CraftingController { public static int HoveredRecipeIndex => CraftingUi.HoveredRecipeIndex; public static bool NeedsModelRefresh(CraftingPanelUpdateReason reason, bool firstApply) { if (!firstApply && reason == CraftingPanelUpdateReason.FrameTick && !_craftingRecipeViewDirty && !_craftingRecipeGridDirty && !_craftingRecipeScrollbarDirty) { return _craftingGroupRailDirty; } return true; } public static void MarkRecipeViewDirty() { _craftingRecipeViewDirty = true; _craftingRecipeViewSignature = ""; } public static void MarkRecipeGridDirty() { _craftingRecipeGridDirty = true; _craftingRecipeGridSignature = ""; } public static void MarkRecipeScrollbarDirty() { _craftingRecipeScrollbarDirty = true; _craftingRecipeScrollbarSignature = ""; } public static void MarkGroupRailDirty() { _craftingGroupRailDirty = true; _craftingGroupRailSignature = ""; } public static void MarkBottomControlsDirty() { _craftingBottomControlsDirty = true; _craftingBottomControlsSignature = ""; } public static void MarkSearchInputDirty() { CraftingUi.SearchInputDirty = true; CraftingUi.SearchInputSignature = ""; } public static void MarkRecipeViewDirtyCascade() { MarkRecipeViewDirty(); MarkRecipeGridDirty(); MarkRecipeScrollbarDirty(); MarkGroupRailDirty(); MarkBottomControlsDirty(); } public static void MarkRecipeGridLayoutDirty() { MarkRecipeGridDirty(); MarkRecipeScrollbarDirty(); MarkBottomControlsDirty(); } public static void SetHoveredRecipe(int index) { CraftingUi.HoveredRecipeIndex = index; } public static void ClearHoveredRecipe() { CraftingUi.HoveredRecipeIndex = -1; } public static bool IsHoveredRecipe(int index) { return CraftingUi.HoveredRecipeIndex == index; } public static void InvalidateRecipeGridZoomHint() { CraftingUi.RecipeGridZoomHintSignature = ""; } public static void ClearHoverTooltipContentKey() { CraftingUi.HoverTooltipContentKey = ""; } } private sealed class CraftingTooltipNativePanelLayoutState : MonoBehaviour { public float AppliedOffsetMinYDelta; } internal sealed class KeepOnDeathItemState { public ItemData Item { get; } public Vector2i OriginalGridPos { get; } public string OriginalSlotId { get; } public SlotKind? OriginalSlotKind { get; } public bool WasQuickSlot => OriginalSlotKind.GetValueOrDefault() == SlotKind.Quick; public bool WasSpecialSlot => OriginalSlotKind.HasValue; public KeepOnDeathItemState(ItemData item, Vector2i originalGridPos, string originalSlotId, SlotKind? originalSlotKind) { //IL_000e: 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) Item = item; OriginalGridPos = originalGridPos; OriginalSlotId = originalSlotId; OriginalSlotKind = originalSlotKind; } } private sealed class ItemClassification { public readonly Dictionary BuiltInGroupMatches = new Dictionary(StringComparer.OrdinalIgnoreCase); public bool BigGroupResolved; public string BigGroupId = ""; } private sealed class ItemClassifierRuntimeState { public readonly Dictionary Cache = new Dictionary(StringComparer.OrdinalIgnoreCase); public string Signature = ""; } private enum FoodStat { None, Health, Stamina, Eitr } private static class ItemClassifierController { public static string GetInventoryItemBigGroupId(ItemClassifierRuntimeState state, ItemData item, IReadOnlyList groupFilters) { if (item?.m_shared == null) { return ""; } ItemClassification itemClassification = GetItemClassification(state, item); if (itemClassification.BigGroupResolved) { return itemClassification.BigGroupId; } for (int i = 0; i < groupFilters.Count; i++) { CraftingRecipeGroupFilter craftingRecipeGroupFilter = groupFilters[i]; if (craftingRecipeGroupFilter.Id != "favorite" && craftingRecipeGroupFilter.Matches(item)) { itemClassification.BigGroupId = craftingRecipeGroupFilter.Id; itemClassification.BigGroupResolved = true; return itemClassification.BigGroupId; } } itemClassification.BigGroupId = ""; itemClassification.BigGroupResolved = true; return itemClassification.BigGroupId; } public static bool ItemMatchesBuiltInPredefinedGroup(ItemClassifierRuntimeState state, ItemData item, string groupId) { string text = NormalizeGroupId(groupId); if (item?.m_shared == null || string.IsNullOrWhiteSpace(text)) { return false; } ItemClassification itemClassification = GetItemClassification(state, item); if (itemClassification.BuiltInGroupMatches.TryGetValue(text, out var value)) { return value; } bool flag = ItemMatchesBuiltInPredefinedGroupUncached(item, text); itemClassification.BuiltInGroupMatches[text] = flag; return flag; } public static void ClearCaches(ItemClassifierRuntimeState state) { state.Cache.Clear(); state.Signature = ""; } private static ItemClassification GetItemClassification(ItemClassifierRuntimeState state, ItemData item) { EnsureCacheFresh(state); string itemClassifierCacheKey = GetItemClassifierCacheKey(item); if (state.Cache.TryGetValue(itemClassifierCacheKey, out ItemClassification value)) { return value; } if (state.Cache.Count >= 2048) { state.Cache.Clear(); } ItemClassification itemClassification = new ItemClassification(); state.Cache[itemClassifierCacheKey] = itemClassification; return itemClassification; } private static void EnsureCacheFresh(ItemClassifierRuntimeState state) { string itemClassifierCacheSignature = GetItemClassifierCacheSignature(); if (!string.Equals(state.Signature, itemClassifierCacheSignature, StringComparison.Ordinal)) { state.Cache.Clear(); state.Signature = itemClassifierCacheSignature; } } } private static class ItemSortController { public static void EnsureRecipeOutputLookupCache(InventorySortRuntimeState state) { string recipeOutputLookupSignature = GetRecipeOutputLookupSignature(); if (string.Equals(state.RecipeOutputLookupSignature, recipeOutputLookupSignature, StringComparison.Ordinal)) { return; } state.RecipeOutputLookupCache.Clear(); state.RecipeOutputLookupSignature = recipeOutputLookupSignature; if (ObjectDB.instance?.m_recipes == null) { return; } foreach (Recipe recipe in ObjectDB.instance.m_recipes) { AddRecipeOutputLookup(recipe); } } public static void ClearCaches(InventorySortRuntimeState state) { state.RecipeOutputLookupCache.Clear(); state.RecipeOutputLookupSignature = ""; } } private sealed class JewelcraftingCraftingSocketUiApi { private readonly FieldInfo _socketIconsField; private readonly FieldInfo? _socketingButtonField; private readonly FieldInfo? _socketTabField; private readonly FieldInfo? _socketCostField; private readonly MethodInfo? _socketTabOpenMethod; private JewelcraftingCraftingSocketUiApi(FieldInfo socketIconsField, FieldInfo? socketingButtonField, FieldInfo? socketTabField, FieldInfo? socketCostField, MethodInfo? socketTabOpenMethod) { _socketIconsField = socketIconsField; _socketingButtonField = socketingButtonField; _socketTabField = socketTabField; _socketCostField = socketCostField; _socketTabOpenMethod = socketTabOpenMethod; } public static bool TryCreate(Assembly assembly, out JewelcraftingCraftingSocketUiApi? api, out string detail) { api = null; Type type = assembly.GetType("Jewelcrafting.GemStones+AddSocketIcons"); Type type2 = assembly.GetType("Jewelcrafting.GemStones+AddSocketAddingTab"); Type type3 = assembly.GetType("Jewelcrafting.Jewelcrafting"); FieldInfo fieldInfo = type?.GetField("socketIcons", BindingFlags.Static | BindingFlags.Public); if (fieldInfo == null) { detail = "AddSocketIcons.socketIcons was not found"; return false; } api = new JewelcraftingCraftingSocketUiApi(fieldInfo, type?.GetField("socketingButton", BindingFlags.Static | BindingFlags.Public), type2?.GetField("tab", BindingFlags.Static | BindingFlags.Public), type3?.GetField("socketCost", BindingFlags.Static | BindingFlags.Public), type2?.GetMethod("TabOpen", BindingFlags.Static | BindingFlags.Public)); detail = ""; return true; } public Array? GetSocketIcons() { return _socketIconsField.GetValue(null) as Array; } public Button? GetSocketingButton() { object? obj = _socketingButtonField?.GetValue(null); return (Button?)((obj is Button) ? obj : null); } public Transform? GetSocketTab() { object? obj = _socketTabField?.GetValue(null); return (Transform?)((obj is Transform) ? obj : null); } public string GetSocketCostMode() { try { object? obj = _socketCostField?.GetValue(null); ConfigEntryBase val = (ConfigEntryBase)((obj is ConfigEntryBase) ? obj : null); return (val == null) ? "" : (val.BoxedValue?.ToString() ?? ""); } catch { return ""; } } public bool IsSocketTabOpen() { try { object obj = _socketTabOpenMethod?.Invoke(null, null); return obj is bool && (bool)obj; } catch { return false; } } } private enum JewelcraftingSocketTabState { Unavailable, PrimaryCraftingTab, Closed, Selected } private sealed class JewelcraftingGemCuttingApi { private readonly FieldInfo _gemUpgradeChancesField; private JewelcraftingGemCuttingApi(FieldInfo gemUpgradeChancesField) { _gemUpgradeChancesField = gemUpgradeChancesField; } public static bool TryCreate(Assembly assembly, out JewelcraftingGemCuttingApi? api, out string detail) { api = null; FieldInfo fieldInfo = assembly.GetType("Jewelcrafting.Jewelcrafting")?.GetField("gemUpgradeChances", BindingFlags.Static | BindingFlags.Public); if (fieldInfo == null) { detail = "Jewelcrafting.gemUpgradeChances was not found"; return false; } api = new JewelcraftingGemCuttingApi(fieldInfo); detail = ""; return true; } public bool IsGemCuttingRecipe(Recipe recipe) { string text = (((Object)(object)recipe.m_item != (Object)null) ? (recipe.m_item.m_itemData.m_shared.m_name ?? "") : ""); if (string.IsNullOrWhiteSpace(text)) { return false; } try { return _gemUpgradeChancesField.GetValue(null) is IDictionary dictionary && dictionary.Contains(text); } catch { return false; } } } private sealed class JewelcraftingGemApi { private readonly MethodInfo _getGemsMethod; private readonly MethodInfo? _itemDataMethod; private readonly MethodInfo? _itemInfoGetSocketableMethod; private readonly FieldInfo? _socketedGemsField; private readonly FieldInfo? _socketNameField; private readonly FieldInfo? _socketSeedField; private readonly FieldInfo? _effectPowersField; private readonly FieldInfo? _effectNamesField; private readonly MethodInfo? _getGemLocationMethod; private readonly MethodInfo? _getItemGemLocationMethod; private readonly MethodInfo? _displayGemEffectPowerMethod; private readonly FieldInfo? _openEquipmentField; private readonly FieldInfo? _openInventoryField; private readonly PropertyInfo? _itemInfoItemDataProperty; private readonly MethodInfo? _itemInfoGetAllSocketSeedsMethod; private readonly PropertyInfo? _socketSeedSeedProperty; private readonly Dictionary _gemSpriteMembers = new Dictionary(); private readonly Dictionary _gemPrefabMembers = new Dictionary(); private readonly Dictionary _gemEffectsMembers = new Dictionary(); private JewelcraftingGemApi(MethodInfo getGemsMethod, MethodInfo? itemDataMethod, MethodInfo? itemInfoGetSocketableMethod, FieldInfo? socketedGemsField, FieldInfo? socketNameField, FieldInfo? socketSeedField, FieldInfo? effectPowersField, FieldInfo? effectNamesField, MethodInfo? getGemLocationMethod, MethodInfo? getItemGemLocationMethod, MethodInfo? displayGemEffectPowerMethod, FieldInfo? openEquipmentField, FieldInfo? openInventoryField, PropertyInfo? itemInfoItemDataProperty, MethodInfo? itemInfoGetAllSocketSeedsMethod, PropertyInfo? socketSeedSeedProperty) { _getGemsMethod = getGemsMethod; _itemDataMethod = itemDataMethod; _itemInfoGetSocketableMethod = itemInfoGetSocketableMethod; _socketedGemsField = socketedGemsField; _socketNameField = socketNameField; _socketSeedField = socketSeedField; _effectPowersField = effectPowersField; _effectNamesField = effectNamesField; _getGemLocationMethod = getGemLocationMethod; _getItemGemLocationMethod = getItemGemLocationMethod; _displayGemEffectPowerMethod = displayGemEffectPowerMethod; _openEquipmentField = openEquipmentField; _openInventoryField = openInventoryField; _itemInfoItemDataProperty = itemInfoItemDataProperty; _itemInfoGetAllSocketSeedsMethod = itemInfoGetAllSocketSeedsMethod; _socketSeedSeedProperty = socketSeedSeedProperty; } public static bool TryCreate(Assembly assembly, out JewelcraftingGemApi? api, out string detail) { api = null; MethodInfo methodInfo = assembly.GetType("Jewelcrafting.API")?.GetMethod("GetGems", BindingFlags.Static | BindingFlags.Public, null, new Type[1] { typeof(ItemData) }, null); if (methodInfo == null) { detail = "API.GetGems was not found"; return false; } Type? type = assembly.GetType("ItemDataManager.ItemExtensions"); Type type2 = assembly.GetType("ItemDataManager.ItemInfo"); Type type3 = assembly.GetType("Jewelcrafting.Socketable"); Type type4 = assembly.GetType("Jewelcrafting.SocketItem"); Type type5 = assembly.GetType("Jewelcrafting.Jewelcrafting"); Type type6 = assembly.GetType("Jewelcrafting.GemEffects.EffectDef"); Type type7 = assembly.GetType("Jewelcrafting.Utils"); Type type8 = assembly.GetType("Jewelcrafting.GemEffects.EffectPower"); Type type9 = assembly.GetType("Jewelcrafting.GemStones+AddFakeSocketsContainer"); Type type10 = assembly.GetType("Jewelcrafting.SocketSeed"); MethodInfo itemDataMethod = type?.GetMethod("Data", BindingFlags.Static | BindingFlags.Public, null, new Type[1] { typeof(ItemData) }, null); MethodInfo itemInfoGetAllSocketSeedsMethod = null; MethodInfo itemInfoGetSocketableMethod = null; if (type2 != null) { MethodInfo[] methods = type2.GetMethods(BindingFlags.Instance | BindingFlags.Public); foreach (MethodInfo methodInfo2 in methods) { if (type3 != null && methodInfo2.Name == "Get" && methodInfo2.IsGenericMethodDefinition && methodInfo2.GetParameters().Length == 1) { itemInfoGetSocketableMethod = methodInfo2.MakeGenericMethod(type3); } else if (type10 != null && methodInfo2.Name == "GetAll" && methodInfo2.IsGenericMethodDefinition && methodInfo2.GetParameters().Length == 0) { itemInfoGetAllSocketSeedsMethod = methodInfo2.MakeGenericMethod(type10); } } } MethodInfo displayGemEffectPowerMethod = null; if (type7 != null && type8 != null) { MethodInfo[] methods = type7.GetMethods(BindingFlags.Static | BindingFlags.Public); foreach (MethodInfo methodInfo3 in methods) { if (methodInfo3.Name == "DisplayGemEffectPower" && methodInfo3.GetParameters().Length == 5) { displayGemEffectPowerMethod = methodInfo3; break; } } } api = new JewelcraftingGemApi(methodInfo, itemDataMethod, itemInfoGetSocketableMethod, type3?.GetField("socketedGems", BindingFlags.Instance | BindingFlags.Public), type4?.GetField("Name", BindingFlags.Instance | BindingFlags.Public), type4?.GetField("Seed", BindingFlags.Instance | BindingFlags.Public), type5?.GetField("EffectPowers", BindingFlags.Static | BindingFlags.Public), type6?.GetField("EffectNames", BindingFlags.Static | BindingFlags.Public), type7?.GetMethod("GetGemLocation", BindingFlags.Static | BindingFlags.Public, null, new Type[2] { typeof(SharedData), typeof(Player) }, null), type7?.GetMethod("GetItemGemLocation", BindingFlags.Static | BindingFlags.Public, null, new Type[1] { typeof(ItemData) }, null), displayGemEffectPowerMethod, type9?.GetField("openEquipment", BindingFlags.Static | BindingFlags.Public), type9?.GetField("openInventory", BindingFlags.Static | BindingFlags.Public), type2?.GetProperty("ItemData", BindingFlags.Instance | BindingFlags.Public), itemInfoGetAllSocketSeedsMethod, type10?.GetProperty("Seed", BindingFlags.Instance | BindingFlags.Public)); detail = ""; return true; } public object? GetGems(ItemData item) { return _getGemsMethod.Invoke(null, new object[1] { item }); } public ItemData? GetOpenSocketContainerItem() { if (_openEquipmentField == null || _itemInfoItemDataProperty == null) { return null; } try { object value = _openEquipmentField.GetValue(null); return (ItemData?)((value != null) ? /*isinst with value type is only supported in some contexts*/: null); } catch { return null; } } public Inventory? GetOpenSocketContainerInventory() { if (_openInventoryField == null) { return null; } try { object? value = _openInventoryField.GetValue(null); return (Inventory?)((value is Inventory) ? value : null); } catch { return null; } } public bool TryGetGemIconData(object gem, out Sprite? sprite, out string prefabName) { sprite = null; prefabName = ""; if (gem == null) { return false; } Type type = gem.GetType(); if (!_gemSpriteMembers.TryGetValue(type, out MemberInfo value)) { value = FindGemMember(type, typeof(Sprite), "gemSprite", "GemSprite", "sprite", "Sprite", "icon", "Icon", "gemIcon", "GemIcon"); _gemSpriteMembers[type] = value; } if (!_gemPrefabMembers.TryGetValue(type, out MemberInfo value2)) { value2 = FindGemMember(type, null, "gemPrefab", "GemPrefab", "prefab", "Prefab", "prefabName", "PrefabName", "name", "Name"); _gemPrefabMembers[type] = value2; } object? gemMemberValue = GetGemMemberValue(value, gem); sprite = (Sprite?)((gemMemberValue is Sprite) ? gemMemberValue : null); object gemMemberValue2 = GetGemMemberValue(value2, gem); object obj = gemMemberValue2; string text2; if (!(obj is string text)) { GameObject val = (GameObject)((obj is GameObject) ? obj : null); if (val == null) { ItemDrop val2 = (ItemDrop)((obj is ItemDrop) ? obj : null); if (val2 == null || !((Object)(object)val2 != (Object)null) || IsUnityNull((Object?)(object)val2)) { goto IL_017e; } text2 = ((Object)((Component)val2).gameObject).name; } else { if (!((Object)(object)val != (Object)null) || IsUnityNull((Object?)(object)val)) { goto IL_017e; } text2 = ((Object)val).name; } } else { text2 = text; } goto IL_0195; IL_0195: prefabName = text2; if (!((Object)(object)sprite != (Object)null)) { return !string.IsNullOrWhiteSpace(prefabName); } return true; IL_017e: text2 = gemMemberValue2?.ToString() ?? ""; goto IL_0195; } public bool TryGetGemTooltipData(object gem, out Sprite? sprite, out string prefabName, out List> effects) { effects = new List>(); if (!TryGetGemIconData(gem, out sprite, out prefabName) && string.IsNullOrWhiteSpace(prefabName)) { return false; } Type type = gem.GetType(); if (!_gemEffectsMembers.TryGetValue(type, out MemberInfo value)) { value = FindGemMember(type, typeof(IDictionary), "gemEffects", "GemEffects", "effects", "Effects"); _gemEffectsMembers[type] = value; } if (!(GetGemMemberValue(value, gem) is IDictionary dictionary)) { return true; } foreach (DictionaryEntry item in dictionary) { string text = item.Key?.ToString() ?? ""; if (string.IsNullOrWhiteSpace(text)) { continue; } float result; if (item.Value is float value2) { effects.Add(new KeyValuePair(text, value2)); } else if (item.Value is IConvertible convertible) { try { effects.Add(new KeyValuePair(text, convertible.ToSingle(CultureInfo.InvariantCulture))); } catch { } } else if (item.Value != null && float.TryParse(item.Value.ToString(), NumberStyles.Float, CultureInfo.InvariantCulture, out result)) { effects.Add(new KeyValuePair(text, result)); } } return true; } public List GetSocketGemData(ItemData item) { List list = new List(); if (_itemDataMethod == null || _itemInfoGetSocketableMethod == null || _socketedGemsField == null || _socketNameField == null) { return list; } try { object obj = _itemDataMethod.Invoke(null, new object[1] { item }); object obj2 = ((obj != null) ? _itemInfoGetSocketableMethod.Invoke(obj, new object[1] { "" }) : null); if (obj2 == null || !(_socketedGemsField.GetValue(obj2) is IEnumerable enumerable)) { return list; } foreach (object item2 in enumerable) { if (item2 == null) { list.Add(new JewelcraftingSocketGemData("", null)); continue; } string prefabName = (_socketNameField.GetValue(item2) as string) ?? ""; Dictionary seeds = CopySocketSeeds(_socketSeedField?.GetValue(item2)); list.Add(new JewelcraftingSocketGemData(prefabName, seeds)); } } catch (Exception ex) { Log.LogDebug((object)("Jewelcrafting direct socket read failed for " + GetItemPrefabName(item) + ": " + ex.Message)); } return list; } public List GetOpenSocketGemData(ItemData item) { List list = new List(); ItemData openSocketContainerItem = GetOpenSocketContainerItem(); Inventory openSocketContainerInventory = GetOpenSocketContainerInventory(); if (openSocketContainerItem?.m_shared == null || openSocketContainerInventory == null || !IsSameOpenSocketContainerItem(item, openSocketContainerItem)) { return list; } int num = Math.Max(1, openSocketContainerInventory.m_width); int num2 = Math.Max(0, num * Math.Max(0, openSocketContainerInventory.m_height)); for (int i = 0; i < num2; i++) { list.Add(new JewelcraftingSocketGemData("", null)); } foreach (ItemData item2 in openSocketContainerInventory.m_inventory) { if (item2?.m_shared != null) { int num3 = item2.m_gridPos.x + item2.m_gridPos.y * num; if (num3 >= 0 && num3 < list.Count) { string prefabName = (((Object)(object)item2.m_dropPrefab != (Object)null && !IsUnityNull((Object?)(object)item2.m_dropPrefab)) ? ((Object)item2.m_dropPrefab).name : GetItemPrefabName(item2)); list[num3] = new JewelcraftingSocketGemData(prefabName, GetSocketSeedData(item2)); } } } return list; } public string GetSocketDebugSummary(ItemData item) { List socketGemData = GetSocketGemData(item); List list = new List(); foreach (JewelcraftingSocketGemData item2 in socketGemData) { list.Add(string.IsNullOrWhiteSpace(item2.PrefabName) ? "" : item2.PrefabName); } return "directSockets=" + socketGemData.Count + ", directNames=" + string.Join("/", list); } public string GetOpenSocketDebugSummary(ItemData item) { List openSocketGemData = GetOpenSocketGemData(item); List list = new List(); foreach (JewelcraftingSocketGemData item2 in openSocketGemData) { list.Add(string.IsNullOrWhiteSpace(item2.PrefabName) ? "" : item2.PrefabName); } return "openSockets=" + openSocketGemData.Count + ", openNames=" + string.Join("/", list); } public string BuildSocketEffectText(ItemData item, JewelcraftingSocketGemData socket) { if (!socket.HasGem || _effectPowersField == null || _effectNamesField == null || _getGemLocationMethod == null || _getItemGemLocationMethod == null || _displayGemEffectPowerMethod == null || !(_effectPowersField.GetValue(null) is IDictionary dictionary) || !(_effectNamesField.GetValue(null) is IDictionary dictionary2)) { return ""; } object location = _getGemLocationMethod.Invoke(null, new object[2] { item.m_shared, Player.m_localPlayer }); object location2 = _getItemGemLocationMethod.Invoke(null, new object[1] { item }); List list = new List(); int stableHashCode = StringExtensionMethods.GetStableHashCode(socket.PrefabName); if (dictionary.Contains(stableHashCode) && dictionary[stableHashCode] is IDictionary locationPowers) { AddLocationPowers(locationPowers, location, list); AddLocationPowers(locationPowers, location2, list); } if (list.Count == 0) { return "$jc_effect_no_effect"; } List list2 = new List(); foreach (object item2 in list) { object obj = item2.GetType().GetField("Effect", BindingFlags.Instance | BindingFlags.Public)?.GetValue(item2); string text = ((obj == null || !dictionary2.Contains(obj)) ? (obj?.ToString() ?? "") : (dictionary2[obj]?.ToString() ?? obj.ToString() ?? "")); string text2 = ""; try { text2 = (_displayGemEffectPowerMethod.Invoke(null, new object[5] { item2, null, 0, socket.Seeds, false }) as string) ?? ""; } catch { } if (!string.IsNullOrWhiteSpace(text)) { list2.Add("$jc_effect_" + text.ToLowerInvariant() + (string.IsNullOrWhiteSpace(text2) ? "" : (" " + text2))); } } return string.Join("\n", list2); } private static void AddLocationPowers(IDictionary locationPowers, object? location, List powers) { if (location == null || !locationPowers.Contains(location) || !(locationPowers[location] is IEnumerable enumerable)) { return; } foreach (object item in enumerable) { if (item != null) { powers.Add(item); } } } private static Dictionary? CopySocketSeeds(object? seedObject) { if (!(seedObject is IDictionary dictionary) || dictionary.Count == 0) { return null; } Dictionary dictionary2 = new Dictionary(); foreach (DictionaryEntry item in dictionary) { string text = item.Key?.ToString() ?? ""; if (!string.IsNullOrWhiteSpace(text)) { uint result; if (item.Value is uint value) { dictionary2[text] = value; } else if (item.Value != null && uint.TryParse(item.Value.ToString(), NumberStyles.Integer, CultureInfo.InvariantCulture, out result)) { dictionary2[text] = result; } } } if (dictionary2.Count <= 0) { return null; } return dictionary2; } private Dictionary? GetSocketSeedData(ItemData gem) { if (_itemDataMethod == null || _itemInfoGetAllSocketSeedsMethod == null || _socketSeedSeedProperty == null) { return null; } try { object obj = _itemDataMethod.Invoke(null, new object[1] { gem }); if (!(((obj != null) ? _itemInfoGetAllSocketSeedsMethod.Invoke(obj, null) : null) is IDictionary dictionary) || dictionary.Count == 0) { return null; } Dictionary dictionary2 = new Dictionary(); foreach (DictionaryEntry item in dictionary) { string text = item.Key?.ToString() ?? ""; if (!string.IsNullOrWhiteSpace(text) && item.Value != null) { object value = _socketSeedSeedProperty.GetValue(item.Value); uint result; if (value is uint value2) { dictionary2[text] = value2; } else if (value != null && uint.TryParse(value.ToString(), NumberStyles.Integer, CultureInfo.InvariantCulture, out result)) { dictionary2[text] = result; } } } return (dictionary2.Count > 0) ? dictionary2 : null; } catch { return null; } } private static bool IsSameOpenSocketContainerItem(ItemData item, ItemData openItem) { if (item == openItem) { return true; } if (item.m_shared != null && openItem.m_shared != null && string.Equals(GetItemPrefabName(item), GetItemPrefabName(openItem), StringComparison.Ordinal) && string.Equals(item.m_shared.m_name, openItem.m_shared.m_name, StringComparison.Ordinal) && item.m_variant == openItem.m_variant && item.m_quality == openItem.m_quality && item.m_gridPos.x == openItem.m_gridPos.x) { return item.m_gridPos.y == openItem.m_gridPos.y; } return false; } public string GetGemDebugSummary(object gem) { if (gem == null) { return "null"; } Type type = gem.GetType(); List list = new List { type.FullName ?? type.Name }; MemberInfo[] members = type.GetMembers(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); foreach (MemberInfo memberInfo in members) { if (!(memberInfo is FieldInfo) && !(memberInfo is PropertyInfo)) { continue; } object gemMemberValue = GetGemMemberValue(memberInfo, gem); string text; if (gemMemberValue != null) { Sprite val = (Sprite)((gemMemberValue is Sprite) ? gemMemberValue : null); if (val == null) { GameObject val2 = (GameObject)((gemMemberValue is GameObject) ? gemMemberValue : null); text = ((val2 != null) ? ("GameObject:" + ((Object)val2).name) : ((!(gemMemberValue is IDictionary dictionary)) ? (gemMemberValue.ToString() ?? "") : ("Dictionary:" + dictionary.Count))); } else { text = "Sprite:" + ((Object)val).name; } } else { text = "null"; } string text2 = text; if (text2.Length > 80) { text2 = text2.Substring(0, 80) + "..."; } list.Add(memberInfo.Name + "=" + text2); if (list.Count >= 8) { break; } } return string.Join(";", list); } private static MemberInfo? FindGemMember(Type type, Type? targetType, params string[] names) { foreach (string name in names) { FieldInfo field = type.GetField(name, BindingFlags.IgnoreCase | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field != null && (targetType == null || targetType.IsAssignableFrom(field.FieldType) || (targetType == typeof(IDictionary) && typeof(IDictionary).IsAssignableFrom(field.FieldType)))) { return field; } PropertyInfo property = type.GetProperty(name, BindingFlags.IgnoreCase | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if ((object)property != null && property.GetIndexParameters().Length == 0 && (targetType == null || targetType.IsAssignableFrom(property.PropertyType) || (targetType == typeof(IDictionary) && typeof(IDictionary).IsAssignableFrom(property.PropertyType)))) { return property; } } FieldInfo[] fields = type.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); foreach (FieldInfo fieldInfo in fields) { if (targetType != null && (targetType.IsAssignableFrom(fieldInfo.FieldType) || (targetType == typeof(IDictionary) && typeof(IDictionary).IsAssignableFrom(fieldInfo.FieldType)))) { return fieldInfo; } } return null; } private static object? GetGemMemberValue(MemberInfo? member, object instance) { try { return (member is FieldInfo fieldInfo) ? fieldInfo.GetValue(instance) : ((!(member is PropertyInfo propertyInfo) || !propertyInfo.CanRead || propertyInfo.GetIndexParameters().Length != 0) ? null : propertyInfo.GetValue(instance)); } catch { return null; } } } private readonly struct JewelcraftingGemIconData { public readonly Sprite Sprite; public readonly string DisplayName; public JewelcraftingGemIconData(Sprite sprite, string displayName) { Sprite = sprite; DisplayName = displayName; } } private readonly struct JewelcraftingSocketGemData { public readonly string PrefabName; public readonly Dictionary? Seeds; public bool HasGem => !string.IsNullOrWhiteSpace(PrefabName); public JewelcraftingSocketGemData(string prefabName, Dictionary? seeds) { PrefabName = prefabName ?? ""; Seeds = seeds; } } private sealed class JewelcraftingSlotApi { private readonly FieldInfo _ringSlotField; private readonly FieldInfo _necklaceSlotField; private readonly MethodInfo? _isJewelryEquippedMethod; private ConfigEntryBase? _ringSlotConfig; private ConfigEntryBase? _necklaceSlotConfig; private JewelcraftingSlotApi(FieldInfo ringSlotField, FieldInfo necklaceSlotField, MethodInfo? isJewelryEquippedMethod) { _ringSlotField = ringSlotField; _necklaceSlotField = necklaceSlotField; _isJewelryEquippedMethod = isJewelryEquippedMethod; } public static bool TryCreate(Assembly assembly, out JewelcraftingSlotApi? api, out string detail) { api = null; Type? type = assembly.GetType("Jewelcrafting.Jewelcrafting"); Type type2 = assembly.GetType("Jewelcrafting.API"); FieldInfo fieldInfo = type?.GetField("ringSlot", BindingFlags.Static | BindingFlags.Public); FieldInfo fieldInfo2 = type?.GetField("necklaceSlot", BindingFlags.Static | BindingFlags.Public); if (fieldInfo == null || fieldInfo2 == null) { detail = "ringSlot or necklaceSlot config field was not found"; return false; } MethodInfo isJewelryEquippedMethod = type2?.GetMethod("IsJewelryEquipped", BindingFlags.Static | BindingFlags.Public, null, new Type[2] { typeof(Player), typeof(string) }, null); api = new JewelcraftingSlotApi(fieldInfo, fieldInfo2, isJewelryEquippedMethod); detail = ""; return true; } public bool IsRingEnabled() { return GetCompatConfigEntryToggleOn(_ringSlotField, ref _ringSlotConfig); } public bool IsNecklaceEnabled() { return GetCompatConfigEntryToggleOn(_necklaceSlotField, ref _necklaceSlotConfig); } public bool TryGetIsJewelryEquippedMethod(out MethodBase? method) { method = _isJewelryEquippedMethod; return method != null; } } private sealed class JewelcraftingTooltipApi { private readonly MethodInfo _fillItemContainerTooltipMethod; private readonly FieldInfo _socketTooltipField; private readonly FieldInfo? _advancedTooltipKeyField; private JewelcraftingTooltipApi(MethodInfo fillItemContainerTooltipMethod, FieldInfo socketTooltipField, FieldInfo? advancedTooltipKeyField) { _fillItemContainerTooltipMethod = fillItemContainerTooltipMethod; _socketTooltipField = socketTooltipField; _advancedTooltipKeyField = advancedTooltipKeyField; } public static bool TryCreate(Assembly assembly, out JewelcraftingTooltipApi? api, out string detail) { api = null; Type? type = assembly.GetType("Jewelcrafting.API"); Type type2 = assembly.GetType("Jewelcrafting.GemStoneSetup"); Type type3 = assembly.GetType("Jewelcrafting.Jewelcrafting"); MethodInfo methodInfo = type?.GetMethod("FillItemContainerTooltip", BindingFlags.Static | BindingFlags.Public, null, new Type[3] { typeof(ItemData), typeof(Transform), typeof(bool) }, null); FieldInfo fieldInfo = type2?.GetField("SocketTooltip", BindingFlags.Static | BindingFlags.Public); if (methodInfo == null || fieldInfo == null) { detail = "required API members were not found"; return false; } api = new JewelcraftingTooltipApi(methodInfo, fieldInfo, type3?.GetField("advancedTooltipKey", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic)); detail = ""; return true; } public void FillItemContainerTooltip(ItemData item, RectTransform root, bool showInteract) { _fillItemContainerTooltipMethod.Invoke(null, new object[3] { item, root, showInteract }); } public GameObject? GetSocketTooltip() { object? value = _socketTooltipField.GetValue(null); return (GameObject?)((value is GameObject) ? value : null); } public bool TryIsAdvancedTooltipPressed(out bool pressed) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) pressed = false; if (!(_advancedTooltipKeyField?.GetValue(null) is ConfigEntry val)) { return false; } KeyboardShortcut value = val.Value; pressed = ((KeyboardShortcut)(ref value)).IsPressed(); return true; } } private sealed class JewelcraftingVisualApi { private readonly FieldInfo _visualsField; private readonly FieldInfo _equippedFingerItemField; private readonly FieldInfo _equippedNeckItemField; private readonly FieldInfo? _currentFingerItemHashField; private readonly FieldInfo? _currentNeckItemHashField; private readonly MethodInfo? _setFingerItemMethod; private readonly MethodInfo? _setNeckItemMethod; private readonly MethodInfo? _setFingerEquippedMethod; private readonly MethodInfo? _setNeckEquippedMethod; private JewelcraftingVisualApi(FieldInfo visualsField, FieldInfo equippedFingerItemField, FieldInfo equippedNeckItemField, FieldInfo? currentFingerItemHashField, FieldInfo? currentNeckItemHashField, MethodInfo? setFingerItemMethod, MethodInfo? setNeckItemMethod, MethodInfo? setFingerEquippedMethod, MethodInfo? setNeckEquippedMethod) { _visualsField = visualsField; _equippedFingerItemField = equippedFingerItemField; _equippedNeckItemField = equippedNeckItemField; _currentFingerItemHashField = currentFingerItemHashField; _currentNeckItemHashField = currentNeckItemHashField; _setFingerItemMethod = setFingerItemMethod; _setNeckItemMethod = setNeckItemMethod; _setFingerEquippedMethod = setFingerEquippedMethod; _setNeckEquippedMethod = setNeckEquippedMethod; } public static bool TryCreate(Assembly assembly, out JewelcraftingVisualApi? api, out string detail) { api = null; Type type = assembly.GetType("Jewelcrafting.Visual"); FieldInfo fieldInfo = type?.GetField("visuals", BindingFlags.Static | BindingFlags.Public); FieldInfo fieldInfo2 = type?.GetField("equippedFingerItem", BindingFlags.Instance | BindingFlags.Public); FieldInfo fieldInfo3 = type?.GetField("equippedNeckItem", BindingFlags.Instance | BindingFlags.Public); if (fieldInfo == null || fieldInfo2 == null || fieldInfo3 == null) { detail = "Visual fields were not found"; return false; } api = new JewelcraftingVisualApi(fieldInfo, fieldInfo2, fieldInfo3, type?.GetField("currentFingerItemHash", BindingFlags.Instance | BindingFlags.Public), type?.GetField("currentNeckItemHash", BindingFlags.Instance | BindingFlags.Public), type?.GetMethod("setFingerItem", BindingFlags.Instance | BindingFlags.NonPublic), type?.GetMethod("setNeckItem", BindingFlags.Instance | BindingFlags.NonPublic), type?.GetMethod("setFingerEquipped", BindingFlags.Instance | BindingFlags.NonPublic), type?.GetMethod("setNeckEquipped", BindingFlags.Instance | BindingFlags.NonPublic)); detail = ""; return true; } public bool TryGetVisual(VisEquipment visEquipment, out object? visual) { visual = null; if (!(_visualsField.GetValue(null) is IDictionary dictionary) || !dictionary.Contains(visEquipment)) { return false; } visual = dictionary[visEquipment]; return visual != null; } public void ClearSlot(object visual, bool isRing) { FieldInfo fieldInfo = (isRing ? _equippedFingerItemField : _equippedNeckItemField); FieldInfo fieldInfo2 = (isRing ? _currentFingerItemHashField : _currentNeckItemHashField); MethodInfo? obj = (isRing ? _setFingerItemMethod : _setNeckItemMethod); MethodInfo methodInfo = (isRing ? _setFingerEquippedMethod : _setNeckEquippedMethod); fieldInfo.SetValue(visual, null); obj?.Invoke(visual, new object[1] { "" }); if (methodInfo != null) { methodInfo.Invoke(visual, new object[1] { 0 }); } else { fieldInfo2?.SetValue(visual, 0); } } } internal enum InventoryStateEnsureReason { Unknown, PeriodicAudit, PlayerAwake, PlayerSpawned, PlayerLoad, PlayerSave, InventoryChanged, EquipmentChanged, InventoryLoad, InventoryMove, Tombstone, GuiShow, SlotAction, BackupRestore, YamlReload, JewelcraftingSlotRefresh, ConfigChanged, ReentrantFollowUp } internal enum InventoryStateAuditLevel { None, HeightOnly, SlotLight, FullIntegrity } private sealed class InventoryPanelRuntimeState { public readonly Dictionary CustomSlotPanels = new Dictionary(); public readonly Dictionary QuickSlotPanels = new Dictionary(); public readonly List MovedPlayerStatPanels = new List(); public readonly Dictionary QuickSlotPanelOutroStartPositions = new Dictionary(); public readonly Dictionary FavoriteKeyHintObjects = new Dictionary(); public readonly Dictionary PinnedTooltipKeyHintObjects = new Dictionary(); public RectTransform? QuickSlotsHotkeyBarRect; public HotkeyBar? QuickSlotsHotkeyBar; public RectTransform? PlayerStatPanelHost; public RectTransform? InventorySortPanel; public RectTransform? CurrencyPocketPanel; public Button? ContainerRestockButton; public Button? ContainerStoreAllButton; public Button? ContainerSortButton; public RectTransformSnapshot? TakeAllButtonOriginal; public RectTransformSnapshot? StackAllButtonOriginal; public RectTransform? PlayerInventoryScrollbar; public Scrollbar? PlayerInventoryScrollbarComponent; public RectTransform? PlayerInventoryResizeHandle; public TMP_Text? PlayerInventoryResizeHandleLabel; public RectTransform? TrackedContainerPanel; public RectTransform? TrackedContainerWeightPanel; public Vector3 ContainerPanelBasePosition; public Vector3 ContainerPanelAppliedOffset; public Vector3 ContainerWeightPanelBasePosition; public float ContainerWeightPanelAppliedYOffset; public RectTransform? DraggedInventoryPanel; public Vector3 InventoryPanelDragStartMouse; public Vector2 InventoryPanelDragStartOffset; public bool UpdatingPlayerInventoryScrollbar; public bool PlayerInventoryRowsDragging; public bool ContainerPanelBasePositionSet; public bool ContainerWeightPanelBasePositionSet; public bool DraggingQuickSlotsPanelOffset; public bool DraggingEquipmentSlotsPanelOffset; public Vector2 EquipmentSlotsPanelRuntimeOffset = EquipmentSlotsPanelFixedOffset; public Vector2 QuickSlotsPanelRuntimeOffset = QuickSlotsPanelFixedOffset; public Vector3 PlayerInventoryRowsDragStartMouse; public int PlayerInventoryRowsDragStartRows; public int LastExpandableInventoryRows = 4; public int PlayerInventoryScrollOffset; public int PlayerInventoryMaxScroll; public float QuickSlotPanelIntroStartTime = -1f; public float QuickSlotPanelIntroDuration = 0.25f; public float QuickSlotPanelOutroStartTime = -1f; public float QuickSlotPanelOutroDuration = 0.25f; public float QuickSlotHudElementSpace = 70f; public Container? ContainerRestockHoldContainer; public float ContainerRestockHoldStartTime = -1f; public bool ContainerRestockHoldTriggered; public bool QuickSlotPanelIntroActive; public bool QuickSlotPanelOutroActive; public bool QuickSlotHudAnchorValid; public bool LastExpandableInventoryRowsLoaded; public Vector3 QuickSlotHudAnchoredPosition; } private sealed class InventorySafetyRuntimeState { public readonly Dictionary PendingSlotEquips = new Dictionary(); public readonly Dictionary PendingSlotUnequips = new Dictionary(); public readonly HashSet SlotRecoveryWarnings = new HashSet(StringComparer.OrdinalIgnoreCase); public readonly HashSet ForeignSlotPreservationWarnings = new HashSet(StringComparer.OrdinalIgnoreCase); public readonly Dictionary EnsureCounts = new Dictionary(); public readonly Dictionary SlotUnequipToInventoryRequests = new Dictionary(); public bool RoutingEquipToDedicatedSlot; public bool RestoringSlotBackup; public bool EnsuringInventoryState; public InventoryStateEnsureReason PendingEnsureReason; public InventoryStateAuditLevel PendingAuditLevel; public InventoryStateEnsureReason DeferredEnsureReason; public InventoryStateAuditLevel DeferredAuditLevel; public int LastFullIntegrityAuditSignature = int.MinValue; public bool SlotUnequipInProgress; public bool SuppressSlotAutoEquip; public bool HandlingSlotDropOutside; } private sealed class InventoryContainerRuntimeState { public readonly List KnownContainers = new List(); } private sealed class InventoryDefinitionRuntimeState { public readonly List SlotDefinitions = new List(); public readonly List CustomPanelSlotCache = new List(); public readonly List QuickPanelSlotCache = new List(); public readonly Dictionary QuickSlotDefinitionCache = new Dictionary(); public readonly Dictionary PredefinedGroupDefinitions = new Dictionary(StringComparer.OrdinalIgnoreCase); public readonly List PredefinedGroupOrder = new List(); public readonly Dictionary> PredefinedGroupOrders = new Dictionary>(StringComparer.OrdinalIgnoreCase); public readonly Dictionary ResourceTierByToken = new Dictionary(StringComparer.OrdinalIgnoreCase); public readonly HashSet CookingStationInputTokens = new HashSet(StringComparer.OrdinalIgnoreCase); public readonly HashSet CraftingRecipeFoodInputTokens = new HashSet(StringComparer.OrdinalIgnoreCase); public readonly HashSet CraftingRecipeHealthFoodInputTokens = new HashSet(StringComparer.OrdinalIgnoreCase); public readonly HashSet CraftingRecipeStaminaFoodInputTokens = new HashSet(StringComparer.OrdinalIgnoreCase); public readonly HashSet CraftingRecipeEitrFoodInputTokens = new HashSet(StringComparer.OrdinalIgnoreCase); public readonly HashSet CookingStationFoodInputTokens = new HashSet(StringComparer.OrdinalIgnoreCase); public readonly HashSet CookingStationHealthFoodInputTokens = new HashSet(StringComparer.OrdinalIgnoreCase); public readonly HashSet CookingStationStaminaFoodInputTokens = new HashSet(StringComparer.OrdinalIgnoreCase); public readonly HashSet CookingStationEitrFoodInputTokens = new HashSet(StringComparer.OrdinalIgnoreCase); public readonly HashSet FermenterInputTokens = new HashSet(StringComparer.OrdinalIgnoreCase); public readonly HashSet FermenterOutputTokens = new HashSet(StringComparer.OrdinalIgnoreCase); public readonly HashSet FermenterFoodInputTokens = new HashSet(StringComparer.OrdinalIgnoreCase); public readonly HashSet FermenterHealthFoodInputTokens = new HashSet(StringComparer.OrdinalIgnoreCase); public readonly HashSet FermenterStaminaFoodInputTokens = new HashSet(StringComparer.OrdinalIgnoreCase); public readonly HashSet FermenterEitrFoodInputTokens = new HashSet(StringComparer.OrdinalIgnoreCase); public readonly Dictionary ItemNameTokens = new Dictionary(StringComparer.OrdinalIgnoreCase); public Dictionary RestockTargetStackLimits = new Dictionary(StringComparer.OrdinalIgnoreCase); public int SlotDefinitionVersion; public int CustomPanelSlotCacheVersion = -1; public int QuickPanelSlotCacheVersion = -1; public int QuickPanelSlotCacheUnlockedCount = -1; public int QuickSlotDefinitionCacheVersion = -1; public int CachedObjectDbItemCount = -1; public int CachedStationInputObjectDbItemCount = -1; public int CachedStationInputPrefabCount = -1; public int CachedStationInputRecipeCount = -1; public bool StationInputTokensInitialized; } private sealed class InventoryClientRuntimeState { public bool ClientStateLoaded; public string LoadedFavoritesPlayerId = ""; public InventorySlotsClientState ClientState = new InventorySlotsClientState(); public readonly HashSet FavoriteSlots = new HashSet(); } private sealed class EquipmentVisualRuntimeState { public readonly Dictionary Visuals = new Dictionary(StringComparer.Ordinal); public readonly HashSet StatusEffects = new HashSet(); public readonly Dictionary StatusEffectLevels = new Dictionary(); } private sealed class InventorySortRuntimeState { public readonly Dictionary RecipeOutputLookupCache = new Dictionary(StringComparer.OrdinalIgnoreCase); public string RecipeOutputLookupSignature = ""; } private static class InventoryDefinitionController { public static bool TryGetSlotAtGridPos(InventoryDefinitionRuntimeState state, Inventory inventory, Vector2i pos, int fixedRegularRows, out SlotDefinition? slot) { //IL_000b: 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_0020: Unknown result type (might be due to invalid IL or missing references) slot = null; int width = inventory.GetWidth(); if (pos.y < fixedRegularRows) { return false; } int num = (pos.y - fixedRegularRows) * width + pos.x; if (num < 0 || num >= state.SlotDefinitions.Count) { return false; } slot = state.SlotDefinitions[num]; return true; } public static bool TryGetSlotById(InventoryDefinitionRuntimeState state, string id, out SlotDefinition? slot) { slot = null; for (int i = 0; i < state.SlotDefinitions.Count; i++) { SlotDefinition slotDefinition = state.SlotDefinitions[i]; if (string.Equals(slotDefinition.Id, id, StringComparison.Ordinal)) { slot = slotDefinition; return true; } } return false; } public static List GetCustomPanelSlots(InventoryDefinitionRuntimeState state) { if (state.CustomPanelSlotCacheVersion == state.SlotDefinitionVersion) { return state.CustomPanelSlotCache; } state.CustomPanelSlotCache.Clear(); for (int i = 0; i < state.SlotDefinitions.Count; i++) { SlotDefinition slotDefinition = state.SlotDefinitions[i]; if (slotDefinition.Kind != SlotKind.Quick) { state.CustomPanelSlotCache.Add(slotDefinition); } } state.CustomPanelSlotCacheVersion = state.SlotDefinitionVersion; return state.CustomPanelSlotCache; } public static List GetQuickPanelSlots(InventoryDefinitionRuntimeState state, int unlockedCount) { if (state.QuickPanelSlotCacheVersion == state.SlotDefinitionVersion && state.QuickPanelSlotCacheUnlockedCount == unlockedCount) { return state.QuickPanelSlotCache; } state.QuickPanelSlotCache.Clear(); for (int i = 0; i < state.SlotDefinitions.Count; i++) { SlotDefinition slotDefinition = state.SlotDefinitions[i]; if (slotDefinition.Kind == SlotKind.Quick && slotDefinition.QuickSlotIndex >= 0 && slotDefinition.QuickSlotIndex < unlockedCount) { state.QuickPanelSlotCache.Add(slotDefinition); } } state.QuickPanelSlotCacheVersion = state.SlotDefinitionVersion; state.QuickPanelSlotCacheUnlockedCount = unlockedCount; return state.QuickPanelSlotCache; } public static bool TryGetQuickSlotDefinition(InventoryDefinitionRuntimeState state, int quickSlotIndex, out SlotDefinition? slot) { if (state.QuickSlotDefinitionCacheVersion != state.SlotDefinitionVersion) { state.QuickSlotDefinitionCache.Clear(); for (int i = 0; i < state.SlotDefinitions.Count; i++) { SlotDefinition slotDefinition = state.SlotDefinitions[i]; if (slotDefinition.Kind == SlotKind.Quick && slotDefinition.QuickSlotIndex >= 0) { state.QuickSlotDefinitionCache[slotDefinition.QuickSlotIndex] = slotDefinition; } } state.QuickSlotDefinitionCacheVersion = state.SlotDefinitionVersion; } return state.QuickSlotDefinitionCache.TryGetValue(quickSlotIndex, out slot); } public static Vector2i GetSlotGridPos(InventoryDefinitionRuntimeState state, Inventory inventory, SlotDefinition slot, int fixedRegularRows) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) int num = state.SlotDefinitions.IndexOf(slot); int width = inventory.GetWidth(); return new Vector2i(num % width, fixedRegularRows + num / width); } public static int GetSlotTailRows(InventoryDefinitionRuntimeState state, int width) { if (state.SlotDefinitions.Count == 0) { return 0; } return Mathf.CeilToInt((float)state.SlotDefinitions.Count / (float)Mathf.Max(1, width)); } public static void InvalidateCaches(InventoryDefinitionRuntimeState state) { state.SlotDefinitionVersion++; state.CustomPanelSlotCacheVersion = -1; state.QuickPanelSlotCacheVersion = -1; state.QuickPanelSlotCacheUnlockedCount = -1; state.QuickSlotDefinitionCacheVersion = -1; state.CustomPanelSlotCache.Clear(); state.QuickPanelSlotCache.Clear(); state.QuickSlotDefinitionCache.Clear(); } } private sealed class ItemRequiresSkillLevelApi { private readonly MethodInfo _tryGetReqForItemMethod; private readonly MethodInfo _tryGetReqForPrefabNameMethod; private readonly MethodInfo _getTextEquipMethod; private readonly MethodInfo _getTextCraftMethod; private ItemRequiresSkillLevelApi(MethodInfo tryGetReqForItemMethod, MethodInfo tryGetReqForPrefabNameMethod, MethodInfo getTextEquipMethod, MethodInfo getTextCraftMethod) { _tryGetReqForItemMethod = tryGetReqForItemMethod; _tryGetReqForPrefabNameMethod = tryGetReqForPrefabNameMethod; _getTextEquipMethod = getTextEquipMethod; _getTextCraftMethod = getTextCraftMethod; } public static bool TryCreate(Assembly assembly, out ItemRequiresSkillLevelApi? api, out string detail) { api = null; Type? type = assembly.GetType("ItemRequiresSkillLevel.Patches"); MethodInfo methodInfo = type?.GetMethod("TryGetReqForItem", BindingFlags.Static | BindingFlags.NonPublic); MethodInfo methodInfo2 = type?.GetMethod("TryGetReqForPrefabName", BindingFlags.Static | BindingFlags.NonPublic); MethodInfo methodInfo3 = type?.GetMethod("GetTextEquip", BindingFlags.Static | BindingFlags.Public); MethodInfo methodInfo4 = type?.GetMethod("GetTextCraft", BindingFlags.Static | BindingFlags.Public); if (type == null || methodInfo == null || methodInfo2 == null || methodInfo3 == null || methodInfo4 == null) { detail = "ItemRequiresSkillLevel tooltip methods were not found"; return false; } api = new ItemRequiresSkillLevelApi(methodInfo, methodInfo2, methodInfo3, methodInfo4); detail = ""; return true; } public string GetTooltipText(ItemData? item, string? prefabName, bool includeEquip, bool includeCraft) { if (!includeEquip && !includeCraft) { return ""; } if (!TryGetRequirement(item, prefabName, out object requirement) || requirement == null) { return ""; } StringBuilder stringBuilder = new StringBuilder(); if (includeEquip) { stringBuilder.Append(GetText(_getTextEquipMethod, requirement)); } if (includeCraft) { stringBuilder.Append(GetText(_getTextCraftMethod, requirement)); } return stringBuilder.ToString(); } private bool TryGetRequirement(ItemData? item, string? prefabName, out object? requirement) { requirement = null; if (item != null && TryGetRequirementForItem(item, out requirement)) { return true; } if (!string.IsNullOrWhiteSpace(prefabName)) { return TryGetRequirementForPrefabName(prefabName, out requirement); } return false; } private bool TryGetRequirementForItem(ItemData item, out object? requirement) { requirement = null; try { object[] array = new object[2] { item, null }; object obj = _tryGetReqForItemMethod.Invoke(null, array); bool num = obj is bool && (bool)obj; requirement = array[1]; return num && requirement != null; } catch { requirement = null; return false; } } private bool TryGetRequirementForPrefabName(string prefabName, out object? requirement) { requirement = null; try { object[] array = new object[2] { prefabName, null }; object obj = _tryGetReqForPrefabNameMethod.Invoke(null, array); bool num = obj is bool && (bool)obj; requirement = array[1]; return num && requirement != null; } catch { requirement = null; return false; } } private static string GetText(MethodInfo method, object requirement) { try { return (method.Invoke(null, new object[1] { requirement }) as string) ?? ""; } catch { return ""; } } } private sealed class MagicSupremacyApi { private readonly MethodInfo _getMatchingSlotDefinitionMethod; private readonly MethodInfo _getDefinitionBySlotIdMethod; private readonly MethodInfo _getEquippedItemMethod; private readonly MethodInfo _setEquippedItemMethod; private readonly MethodInfo _getOrCreateItemGuidMethod; private readonly MethodInfo _setSavedEquippedGuidMethod; private readonly MethodInfo _clearSavedEquippedGuidMethod; private readonly FieldInfo _slotIdField; private object? _beltDefinition; private MagicSupremacyApi(MethodInfo getMatchingSlotDefinitionMethod, MethodInfo getDefinitionBySlotIdMethod, MethodInfo getEquippedItemMethod, MethodInfo setEquippedItemMethod, MethodInfo getOrCreateItemGuidMethod, MethodInfo setSavedEquippedGuidMethod, MethodInfo clearSavedEquippedGuidMethod, FieldInfo slotIdField) { _getMatchingSlotDefinitionMethod = getMatchingSlotDefinitionMethod; _getDefinitionBySlotIdMethod = getDefinitionBySlotIdMethod; _getEquippedItemMethod = getEquippedItemMethod; _setEquippedItemMethod = setEquippedItemMethod; _getOrCreateItemGuidMethod = getOrCreateItemGuidMethod; _setSavedEquippedGuidMethod = setSavedEquippedGuidMethod; _clearSavedEquippedGuidMethod = clearSavedEquippedGuidMethod; _slotIdField = slotIdField; } public static bool TryCreate(Assembly assembly, out MagicSupremacyApi? api, out string detail) { api = null; Type type = assembly.GetType("Magic_Supremacy.CustomSlotSystem"); Type type2 = type?.GetNestedType("CustomSlotDefinition", BindingFlags.Public | BindingFlags.NonPublic); MethodInfo methodInfo = type?.GetMethod("GetMatchingSlotDefinition", BindingFlags.Static | BindingFlags.Public, null, new Type[1] { typeof(ItemData) }, null); MethodInfo methodInfo2 = type?.GetMethod("GetDefinitionBySlotId", BindingFlags.Static | BindingFlags.NonPublic, null, new Type[1] { typeof(string) }, null); MethodInfo methodInfo3 = type?.GetMethod("GetEquippedItem", BindingFlags.Static | BindingFlags.Public, null, new Type[2] { typeof(Humanoid), typeof(string) }, null); MethodInfo methodInfo4 = type?.GetMethod("SetEquippedItem", BindingFlags.Static | BindingFlags.Public, null, new Type[3] { typeof(Humanoid), typeof(string), typeof(ItemData) }, null); MethodInfo methodInfo5 = type?.GetMethod("GetOrCreateItemGuid", BindingFlags.Static | BindingFlags.NonPublic, null, new Type[1] { typeof(ItemData) }, null); MethodInfo methodInfo6 = FindMethod(type, "SetSavedEquippedGuid", 3); MethodInfo methodInfo7 = FindMethod(type, "ClearSavedEquippedGuid", 2); FieldInfo fieldInfo = type2?.GetField("SlotId", BindingFlags.Instance | BindingFlags.Public); if (type == null || type2 == null || methodInfo == null || methodInfo2 == null || methodInfo3 == null || methodInfo4 == null || methodInfo5 == null || methodInfo6 == null || methodInfo7 == null || fieldInfo == null) { detail = "Magic_Supremacy.CustomSlotSystem belt slot methods were not found"; return false; } api = new MagicSupremacyApi(methodInfo, methodInfo2, methodInfo3, methodInfo4, methodInfo5, methodInfo6, methodInfo7, fieldInfo); detail = ""; return true; } public bool IsBeltItem(ItemData? item) { if (item == null) { return false; } try { object definition = _getMatchingSlotDefinitionMethod.Invoke(null, new object[1] { item }); return IsBeltDefinition(definition); } catch { return false; } } public bool IsBeltEquipped(Player player, ItemData item) { if ((Object)(object)player == (Object)null || item == null) { return false; } try { return _getEquippedItemMethod.Invoke(null, new object[2] { player, "belt" }) == item; } catch { return false; } } public void SyncBelt(Player player, ItemData item) { if ((Object)(object)player == (Object)null || item == null || !IsBeltItem(item)) { return; } try { object beltDefinition = GetBeltDefinition(); if (beltDefinition != null) { if (_getOrCreateItemGuidMethod.Invoke(null, new object[1] { item }) is string text && !string.IsNullOrWhiteSpace(text)) { _setSavedEquippedGuidMethod.Invoke(null, new object[3] { player, beltDefinition, text }); } _setEquippedItemMethod.Invoke(null, new object[3] { player, "belt", item }); } } catch (Exception ex) { Log.LogDebug((object)("Magic Supremacy belt sync failed: " + ex.Message)); } } public void ClearBeltIfCurrent(Player player, ItemData item) { if ((Object)(object)player == (Object)null || item == null) { return; } try { object obj = _getEquippedItemMethod.Invoke(null, new object[2] { player, "belt" }); if (obj == null || obj == item) { object beltDefinition = GetBeltDefinition(); _setEquippedItemMethod.Invoke(null, new object[3] { player, "belt", null }); if (beltDefinition != null) { _clearSavedEquippedGuidMethod.Invoke(null, new object[2] { player, beltDefinition }); } } } catch (Exception ex) { Log.LogDebug((object)("Magic Supremacy belt clear failed: " + ex.Message)); } } private object? GetBeltDefinition() { if (_beltDefinition != null) { return _beltDefinition; } _beltDefinition = _getDefinitionBySlotIdMethod.Invoke(null, new object[1] { "belt" }); if (!IsBeltDefinition(_beltDefinition)) { return null; } return _beltDefinition; } private bool IsBeltDefinition(object? definition) { if (definition == null) { return false; } try { return _slotIdField.GetValue(definition) is string a && string.Equals(a, "belt", StringComparison.Ordinal); } catch { return false; } } private static MethodInfo? FindMethod(Type? type, string name, int parameterCount) { if (type == null) { return null; } MethodInfo[] methods = type.GetMethods(BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); foreach (MethodInfo methodInfo in methods) { if (methodInfo.Name == name && methodInfo.GetParameters().Length == parameterCount) { return methodInfo; } } return null; } } private enum InventoryPlacementScope { General, LocalPlayer, LoadPreservation } private sealed class InventoryHoverTooltipRuntimeState { public GameObject? HoverTooltip; public RectTransform? HoverTooltipPanel; public TMP_Text? HoverTooltipTopic; public TMP_Text? HoverTooltipText; public readonly ScrollableTooltipBodyState HoverTooltipTextScroll = new ScrollableTooltipBodyState(); public readonly TooltipSourceCacheCore HoverTooltipItems = new TooltipSourceCacheCore(64); public string HoverTooltipSignature = ""; public string HoverTooltipLayoutSignature = ""; public float HoverTooltipScrollOffset; public float HoverTooltipMaxScroll; public bool HoverTooltipNeedsScroll; public RectTransform? HoverJewelcraftingTooltipRoot; public string HoverJewelcraftingTooltipSignature = ""; public GameObject? SimpleNameTooltip; public RectTransform? SimpleNameTooltipRect; public TMP_Text? SimpleNameTooltipText; public string SimpleNameTooltipValue = ""; public SimpleNameTooltipPlacement SimpleNameTooltipPlacement; public readonly SimpleTooltipOwnershipCore SimpleNameTooltipOwner = new SimpleTooltipOwnershipCore(); public readonly object SimpleNameTooltipFallbackOwner = new object(); public object? PinnedGemNameTooltipOwner; public float PinnedGemNameTooltipHoldUntil = -1000f; public UITooltip? ContainerHoverTooltipSource; public UITooltip? OwnedHoverTooltipSource; public bool LateUpdateExceptionLogged; } private enum SimpleNameTooltipPlacement { RightOfCursor, LeftOfCursor } private readonly struct InventoryHoverTooltipItemSource { public InventoryGrid? Grid { get; } public ItemData Item { get; } public InventoryHoverTooltipItemSource(InventoryGrid? grid, ItemData item) { Grid = grid; Item = item; } } private readonly struct PlayerInventoryPanelBackgroundSnapshot { public bool ActiveSelf { get; } public bool ImageEnabled { get; } public Sprite? Sprite { get; } public Type Type { get; } public float PixelsPerUnitMultiplier { get; } public Material? Material { get; } public Color Color { get; } public Vector2 AnchorMax { get; } public Vector2 Pivot { get; } public Vector2 OffsetMin { get; } public Vector2 OffsetMax { get; } public Vector2 AnchoredPosition { get; } public Vector2 SizeDelta { get; } public Vector3 LocalScale { get; } public Quaternion LocalRotation { get; } public PlayerInventoryPanelBackgroundSnapshot(bool activeSelf, bool imageEnabled, Sprite? sprite, Type type, float pixelsPerUnitMultiplier, Material? material, Color color, Vector2 anchorMax, Vector2 pivot, Vector2 offsetMin, Vector2 offsetMax, Vector2 anchoredPosition, Vector2 sizeDelta, Vector3 localScale, Quaternion localRotation) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0036: 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_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0058: 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_0060: 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_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) ActiveSelf = activeSelf; ImageEnabled = imageEnabled; Sprite = sprite; Type = type; PixelsPerUnitMultiplier = pixelsPerUnitMultiplier; Material = material; Color = color; AnchorMax = anchorMax; Pivot = pivot; OffsetMin = offsetMin; OffsetMax = offsetMax; AnchoredPosition = anchoredPosition; SizeDelta = sizeDelta; LocalScale = localScale; LocalRotation = localRotation; } } private enum PinnedTooltipContext { None, InventoryContainer, CraftingCraft, CraftingUpgrade } private readonly struct PinnedTooltipVerticalFrame { public readonly float TopY; public readonly float BottomY; public readonly float Height; public PinnedTooltipVerticalFrame(float topY, float bottomY) { TopY = topY; BottomY = bottomY; Height = Mathf.Max(1f, topY - bottomY); } } private readonly struct InventoryPinnedTooltipTarget { public InventoryGrid Grid { get; } public Vector2i Pos { get; } public ItemData Item { get; } public InventoryPinnedTooltipTarget(InventoryGrid grid, Vector2i pos, ItemData item) { //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) Grid = grid; Pos = pos; Item = item; } } private sealed class RestockTargetLimitEditorRow { public string Item { get; set; } public string Amount { get; set; } public RestockTargetLimitEditorRow(string item, string amount) { Item = item; Amount = amount; } } private readonly struct RecycleNReclaimYieldTextEntry { public string Name { get; } public int Amount { get; } public ItemData? Item { get; } public RecycleNReclaimYieldTextEntry(string name, int amount, ItemData? item = null) { Name = name; Amount = amount; Item = item; } } private sealed class RecycleNReclaimApi { private readonly PropertyInfo _recyclingTabButtonHolderProperty; private readonly MethodInfo _inRecycleTabMethod; private readonly MethodInfo? _updateRecipeMethod; private readonly FieldInfo? _recyclingAnalysisContextsField; private readonly PropertyInfo? _recyclingImpedimentsProperty; private readonly PropertyInfo? _entriesProperty; private readonly FieldInfo? _entryRecipeItemDataField; private readonly FieldInfo? _entryAmountField; private RecycleNReclaimApi(PropertyInfo recyclingTabButtonHolderProperty, MethodInfo inRecycleTabMethod, MethodInfo? updateRecipeMethod, FieldInfo? recyclingAnalysisContextsField, PropertyInfo? recyclingImpedimentsProperty, PropertyInfo? entriesProperty, FieldInfo? entryRecipeItemDataField, FieldInfo? entryAmountField) { _recyclingTabButtonHolderProperty = recyclingTabButtonHolderProperty; _inRecycleTabMethod = inRecycleTabMethod; _updateRecipeMethod = updateRecipeMethod; _recyclingAnalysisContextsField = recyclingAnalysisContextsField; _recyclingImpedimentsProperty = recyclingImpedimentsProperty; _entriesProperty = entriesProperty; _entryRecipeItemDataField = entryRecipeItemDataField; _entryAmountField = entryAmountField; } public static bool TryCreate(Assembly assembly, out RecycleNReclaimApi? api, out string detail) { api = null; Type? type = assembly.GetType("Recycle_N_Reclaim.Recycle_N_ReclaimPlugin"); Type type2 = assembly.GetType("Recycle_N_Reclaim.GamePatches.UI.StationRecyclingTabHolder"); PropertyInfo propertyInfo = type?.GetProperty("RecyclingTabButtonHolder", BindingFlags.Static | BindingFlags.Public); MethodInfo methodInfo = type2?.GetMethod("InRecycleTab", BindingFlags.Instance | BindingFlags.Public); if (propertyInfo == null || type2 == null || methodInfo == null) { detail = "Recycle_N_Reclaim tab holder API was not found"; return false; } FieldInfo field = type2.GetField("_recyclingAnalysisContexts", BindingFlags.Instance | BindingFlags.NonPublic); Type? type3 = assembly.GetType("Recycle_N_Reclaim.GamePatches.Recycling.RecyclingAnalysisContext"); Type type4 = type3?.GetNestedType("ReclaimingYieldEntry", BindingFlags.Public); PropertyInfo recyclingImpedimentsProperty = type3?.GetProperty("RecyclingImpediments", BindingFlags.Instance | BindingFlags.Public); PropertyInfo entriesProperty = type3?.GetProperty("Entries", BindingFlags.Instance | BindingFlags.Public); api = new RecycleNReclaimApi(propertyInfo, methodInfo, type2.GetMethod("UpdateRecipe", BindingFlags.Instance | BindingFlags.Public, null, new Type[2] { typeof(Player), typeof(float) }, null), field, recyclingImpedimentsProperty, entriesProperty, type4?.GetField("RecipeItemData", BindingFlags.Instance | BindingFlags.Public), type4?.GetField("Amount", BindingFlags.Instance | BindingFlags.Public)); detail = ""; return true; } public bool IsRecycleTabActive() { object holder = GetHolder(); if (holder == null) { return false; } try { object obj = _inRecycleTabMethod.Invoke(holder, null); return obj is bool && (bool)obj; } catch { return false; } } public bool TryRefreshSelectedRecipeUi() { if (_updateRecipeMethod == null || (Object)(object)Player.m_localPlayer == (Object)null) { return false; } object holder = GetHolder(); if (holder == null) { return false; } try { _updateRecipeMethod.Invoke(holder, new object[2] { Player.m_localPlayer, 0f }); return true; } catch { return false; } } public bool TryGetRecyclingImpedimentCount(int index, out int count) { count = 0; if (_recyclingImpedimentsProperty == null || !TryGetContext(index, out object context)) { return false; } try { if (!(_recyclingImpedimentsProperty.GetValue(context, null) is ICollection collection)) { return false; } count = collection.Count; return true; } catch { count = 0; return false; } } public bool TryGetReclaimSummary(int index, List impediments, List yields) { impediments.Clear(); yields.Clear(); if (!TryGetContext(index, out object context)) { return false; } try { if (_recyclingImpedimentsProperty?.GetValue(context, null) is IEnumerable enumerable) { foreach (object item in enumerable) { string text = item?.ToString() ?? ""; if (!string.IsNullOrWhiteSpace(text)) { impediments.Add(text); } } } if (!(_entriesProperty?.GetValue(context, null) is IEnumerable enumerable2) || _entryRecipeItemDataField == null || _entryAmountField == null) { return true; } foreach (object item2 in enumerable2) { if (item2 == null) { continue; } int num2 = ((_entryAmountField.GetValue(item2) is int num) ? num : 0); if (num2 > 0) { object? value = _entryRecipeItemDataField.GetValue(item2); ItemData val = (ItemData)((value is ItemData) ? value : null); if (val != null && val.m_shared != null) { yields.Add(new RecycleNReclaimYieldTextEntry(val.m_shared.m_name ?? "", num2, val)); } } } return true; } catch { return false; } } public string GetContextSignature() { object holder = GetHolder(); if (holder == null || _recyclingAnalysisContextsField == null) { return "no-context"; } try { if (!(_recyclingAnalysisContextsField.GetValue(holder) is IList list)) { return "no-list"; } int num = 17; for (int i = 0; i < list.Count; i++) { object obj = list[i]; num = num * 31 + ((obj != null) ? RuntimeHelpers.GetHashCode(obj) : 0); if (_recyclingImpedimentsProperty?.GetValue(obj, null) is ICollection collection) { num = num * 31 + collection.Count; } } return $"{list.Count}:{num}"; } catch { return "error"; } } private object? GetHolder() { try { return _recyclingTabButtonHolderProperty.GetValue(null, null); } catch { return null; } } private bool TryGetContext(int index, out object? context) { context = null; if (index < 0 || _recyclingAnalysisContextsField == null) { return false; } object holder = GetHolder(); if (holder == null) { return false; } try { if (!(_recyclingAnalysisContextsField.GetValue(holder) is IList list) || index >= list.Count) { return false; } context = list[index]; return context != null; } catch { context = null; return false; } } } public enum Toggle { Off, On } public enum InventoryRowsDisplayMode { Fixed, Expandable } public enum PinnedTooltipSlotMode { One = 1, Two, Three } public enum GamepadUiScrollSource { RightStickY, DPadVertical, RightStickYOrDPadVertical } public enum ControllerDPadHotkeyMode { InventoryNavigation, Hotkeys, HotkeysWhileHoldingModifier } public enum ControllerHotkeyAction { Off, JoyButtonA, JoyButtonB, JoyButtonX, JoyButtonY, JoyLBumper, JoyRBumper, JoyLTrigger, JoyRTrigger, JoyBack, JoyStart, JoyLStick, JoyRStick, JoyDPadUp, JoyDPadDown, JoyDPadLeft, JoyDPadRight, JoyHotbarUse, JoyAltKeys, AltPlace, JoyUse } private sealed class AcceptableShortcuts : AcceptableValueBase { public AcceptableShortcuts() : base(typeof(KeyboardShortcut)) { } public override object Clamp(object value) { return value; } public override bool IsValid(object value) { return true; } public override string ToDescriptionString() { return "# Acceptable values: " + string.Join(", ", UnityInput.Current.SupportedKeyCodes); } } private sealed class ConfigurationManagerAttributes { public int? Order { get; set; } public bool? Browsable { get; set; } public Action? CustomDrawer { get; set; } } private sealed class SlotEquipItemSnapshot { public ItemData Item { get; } public bool WasInInventory { get; } public Vector2i GridPos { get; } public bool Equipped { get; } public Dictionary CustomData { get; } public SlotEquipItemSnapshot(ItemData item, bool wasInInventory) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) Item = item; WasInInventory = wasInInventory; GridPos = item.m_gridPos; Equipped = item.m_equipped; CustomData = new Dictionary(item.m_customData); } } private sealed class HumanoidEquipmentSnapshot { public ItemData? RightItem { get; } public ItemData? LeftItem { get; } public ItemData? ChestItem { get; } public ItemData? LegItem { get; } public ItemData? AmmoItem { get; } public ItemData? HelmetItem { get; } public ItemData? ShoulderItem { get; } public ItemData? UtilityItem { get; } public ItemData? TrinketItem { get; } public HumanoidEquipmentSnapshot(Humanoid humanoid) { RightItem = humanoid.m_rightItem; LeftItem = humanoid.m_leftItem; ChestItem = humanoid.m_chestItem; LegItem = humanoid.m_legItem; AmmoItem = humanoid.m_ammoItem; HelmetItem = humanoid.m_helmetItem; ShoulderItem = humanoid.m_shoulderItem; UtilityItem = humanoid.m_utilityItem; TrinketItem = humanoid.m_trinketItem; } } private readonly struct TooltipCanvasGroupVisualSnapshot { public bool HadCanvasGroup { get; } public float Alpha { get; } public bool Interactable { get; } public bool BlocksRaycasts { get; } public bool IgnoreParentGroups { get; } public TooltipCanvasGroupVisualSnapshot(bool hadCanvasGroup, float alpha, bool interactable, bool blocksRaycasts, bool ignoreParentGroups) { HadCanvasGroup = hadCanvasGroup; Alpha = alpha; Interactable = interactable; BlocksRaycasts = blocksRaycasts; IgnoreParentGroups = ignoreParentGroups; } } private sealed class InventoryPinnedTooltipRuntimeState { public readonly RectTransform?[] Panels = (RectTransform?[])(object)new RectTransform[3]; public readonly Image?[] Icons = (Image?[])(object)new Image[3]; public readonly TMP_Text?[] Texts = (TMP_Text?[])(object)new TMP_Text[3]; public readonly RectTransform?[] JewelcraftingTooltipRoots = (RectTransform?[])(object)new RectTransform[3]; public readonly ItemData?[] Items = (ItemData?[])(object)new ItemData[3]; public readonly InventoryGrid?[] Grids = (InventoryGrid?[])(object)new InventoryGrid[3]; public readonly Vector2i[] Positions = Enumerable.Repeat(new Vector2i(-1, -1), 3).ToArray(); public InventoryGrid? HoveredGrid; public Vector2i HoveredPos = new Vector2i(-1, -1); } private sealed class CraftingPinnedTooltipRuntimeState { public readonly RectTransform?[] Panels = (RectTransform?[])(object)new RectTransform[3]; public readonly Image?[] Icons = (Image?[])(object)new Image[3]; public readonly TMP_Text?[] Texts = (TMP_Text?[])(object)new TMP_Text[3]; public readonly RectTransform?[] JewelcraftingTooltipRoots = (RectTransform?[])(object)new RectTransform[3]; public readonly RectTransform?[] GemIconRows = (RectTransform?[])(object)new RectTransform[3]; public readonly int[] RecipeIndices = Enumerable.Repeat(-1, 3).ToArray(); } private sealed class PinnedTooltipRuntimeState { public readonly InventoryPinnedTooltipRuntimeState Inventory = new InventoryPinnedTooltipRuntimeState(); public readonly CraftingPinnedTooltipRuntimeState Crafting = new CraftingPinnedTooltipRuntimeState(); public PinnedTooltipContext ActiveContext; public float NextDebugTime; public string LastDebugSignature = ""; } private sealed class TooltipUiRuntimeState { public RectTransform? HotbarSwitchHudHint; public TMP_Text? HotbarSwitchHudHintText; public RectTransform? InventoryWheelHint; public TMP_Text? InventoryWheelHintText; public TMP_FontAsset? DefaultFontAsset; public Material? DefaultFontMaterial; public Sprite? SolidUiSprite; public Sprite? MouseWheelHintSprite; } private static class TooltipController { public static PinnedTooltipContext ActivePinnedContext => PinnedTooltips.ActiveContext; public static void SetPinnedContext(PinnedTooltipContext context) { if (PinnedTooltips.ActiveContext != context) { PinnedTooltipContext activeContext = PinnedTooltips.ActiveContext; PinnedTooltips.ActiveContext = context; switch (activeContext) { case PinnedTooltipContext.InventoryContainer: HideInventoryPinnedTooltips(); break; case PinnedTooltipContext.CraftingCraft: case PinnedTooltipContext.CraftingUpgrade: HideCraftingPinnedTooltips(); break; } } } public static void SyncCraftingPinnedContext(PinnedTooltipContext current) { if ((PinnedTooltips.ActiveContext == PinnedTooltipContext.CraftingCraft || PinnedTooltips.ActiveContext == PinnedTooltipContext.CraftingUpgrade) && PinnedTooltips.ActiveContext != current) { HideCraftingPinnedTooltips(); PinnedTooltips.ActiveContext = current; } } public static bool IsCraftingPinnedContext() { if (PinnedTooltips.ActiveContext != PinnedTooltipContext.CraftingCraft) { return PinnedTooltips.ActiveContext == PinnedTooltipContext.CraftingUpgrade; } return true; } public static bool IsInventoryPinnedContext() { return PinnedTooltips.ActiveContext == PinnedTooltipContext.InventoryContainer; } public static void SetInventoryHover(InventoryGrid grid, Vector2i pos) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) PinnedTooltips.Inventory.HoveredGrid = grid; PinnedTooltips.Inventory.HoveredPos = pos; } public static void ClearInventoryHover() { //IL_001c: 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) PinnedTooltips.Inventory.HoveredGrid = null; PinnedTooltips.Inventory.HoveredPos = new Vector2i(-1, -1); } public static bool IsInventoryHover(InventoryGrid grid, Vector2i pos) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)PinnedTooltips.Inventory.HoveredGrid == (Object)(object)grid) { return PinnedTooltips.Inventory.HoveredPos == pos; } return false; } public static bool TryGetInventoryHover(out InventoryGrid? grid, out Vector2i pos) { //IL_001c: 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) grid = PinnedTooltips.Inventory.HoveredGrid; pos = PinnedTooltips.Inventory.HoveredPos; if ((Object)(object)grid != (Object)null && pos.x >= 0) { return pos.y >= 0; } return false; } } private enum UiScrollInputMode { Discrete, Continuous } private sealed class YamlApplySnapshot { public YamlRoot Config { get; } public List SlotDefinitions { get; } public Dictionary PredefinedGroupDefinitions { get; } public List PredefinedGroupOrder { get; } public Dictionary> PredefinedGroupOrders { get; } public Dictionary ResourceTierByToken { get; } public HashSet CookingStationInputTokens { get; } public HashSet CraftingRecipeFoodInputTokens { get; } public HashSet CraftingRecipeHealthFoodInputTokens { get; } public HashSet CraftingRecipeStaminaFoodInputTokens { get; } public HashSet CraftingRecipeEitrFoodInputTokens { get; } public HashSet CookingStationFoodInputTokens { get; } public HashSet CookingStationHealthFoodInputTokens { get; } public HashSet CookingStationStaminaFoodInputTokens { get; } public HashSet CookingStationEitrFoodInputTokens { get; } public HashSet FermenterInputTokens { get; } public HashSet FermenterOutputTokens { get; } public HashSet FermenterFoodInputTokens { get; } public HashSet FermenterHealthFoodInputTokens { get; } public HashSet FermenterStaminaFoodInputTokens { get; } public HashSet FermenterEitrFoodInputTokens { get; } public bool StationInputTokensInitialized { get; } public int CachedStationInputObjectDbItemCount { get; } public int CachedStationInputPrefabCount { get; } public int CachedStationInputRecipeCount { get; } public YamlApplySnapshot(YamlRoot config, List slotDefinitions, Dictionary predefinedGroupDefinitions, List predefinedGroupOrder, Dictionary> predefinedGroupOrders, Dictionary resourceTierByToken, HashSet cookingStationInputTokens, HashSet craftingRecipeFoodInputTokens, HashSet craftingRecipeHealthFoodInputTokens, HashSet craftingRecipeStaminaFoodInputTokens, HashSet craftingRecipeEitrFoodInputTokens, HashSet cookingStationFoodInputTokens, HashSet cookingStationHealthFoodInputTokens, HashSet cookingStationStaminaFoodInputTokens, HashSet cookingStationEitrFoodInputTokens, HashSet fermenterInputTokens, HashSet fermenterOutputTokens, HashSet fermenterFoodInputTokens, HashSet fermenterHealthFoodInputTokens, HashSet fermenterStaminaFoodInputTokens, HashSet fermenterEitrFoodInputTokens, bool stationInputTokensInitialized, int cachedStationInputObjectDbItemCount, int cachedStationInputPrefabCount, int cachedStationInputRecipeCount) { Config = config; SlotDefinitions = slotDefinitions; PredefinedGroupDefinitions = predefinedGroupDefinitions; PredefinedGroupOrder = predefinedGroupOrder; PredefinedGroupOrders = predefinedGroupOrders; ResourceTierByToken = resourceTierByToken; CookingStationInputTokens = cookingStationInputTokens; CraftingRecipeFoodInputTokens = craftingRecipeFoodInputTokens; CraftingRecipeHealthFoodInputTokens = craftingRecipeHealthFoodInputTokens; CraftingRecipeStaminaFoodInputTokens = craftingRecipeStaminaFoodInputTokens; CraftingRecipeEitrFoodInputTokens = craftingRecipeEitrFoodInputTokens; CookingStationFoodInputTokens = cookingStationFoodInputTokens; CookingStationHealthFoodInputTokens = cookingStationHealthFoodInputTokens; CookingStationStaminaFoodInputTokens = cookingStationStaminaFoodInputTokens; CookingStationEitrFoodInputTokens = cookingStationEitrFoodInputTokens; FermenterInputTokens = fermenterInputTokens; FermenterOutputTokens = fermenterOutputTokens; FermenterFoodInputTokens = fermenterFoodInputTokens; FermenterHealthFoodInputTokens = fermenterHealthFoodInputTokens; FermenterStaminaFoodInputTokens = fermenterStaminaFoodInputTokens; FermenterEitrFoodInputTokens = fermenterEitrFoodInputTokens; StationInputTokensInitialized = stationInputTokensInitialized; CachedStationInputObjectDbItemCount = cachedStationInputObjectDbItemCount; CachedStationInputPrefabCount = cachedStationInputPrefabCount; CachedStationInputRecipeCount = cachedStationInputRecipeCount; } } [CompilerGenerated] private static class <>O { public static CompatApiFactory <0>__TryCreate; public static Func <1>__IsAdventureBackpackItem; public static Func <2>__IsSmoothbrainBackpackItem; public static Func <3>__IsRustyBagItem; public static Func <4>__IsRustyQuiverItem; public static CompatApiFactory <5>__TryCreate; public static CompatApiFactory <6>__TryCreate; public static CompatApiFactory <7>__TryCreate; public static CompatApiFactory <8>__TryCreate; public static Func <9>__GetInventoryItemSortKey; public static Func <10>__IsPendingUpgradeFavoriteItem; public static UnityAction <11>__UpdateCraftingSearchQuery; public static Func <12>__IsDigit; public static Comparison <13>__CompareCraftingRecipeViewEntries; public static UnityAction <14>__OnCraftingRecipeScrollbarChanged; public static Func <15>__IsJewelcraftingNecklaceItem; public static Func <16>__IsJewelcraftingRingItem; public static CompatApiFactory <17>__TryCreate; public static CompatApiFactory <18>__TryCreate; public static CompatApiFactory <19>__TryCreate; public static CompatApiFactory <20>__TryCreate; public static CompatApiFactory <21>__TryCreate; public static CompatApiFactory <22>__TryCreate; public static CompatApiFactory <23>__TryCreate; public static Func <24>__IsMagicSupremacyBeltItem; public static CompatApiFactory <25>__TryCreate; public static Func <26>__IsKeyHintText; public static UnityAction <27>__OnPlayerInventoryScrollbarChanged; public static UnityAction <28>__TryClickInventoryTrashPanel; public static Action <29>__HandleInventoryGridTooltipPointerEnter; public static Action <30>__HandleInventoryGridTooltipPointerExit; public static CompatApiFactory <31>__TryCreate; public static Func <32>__SanitizeRecycleNReclaimHudText; public static Action <33>__DrawRestockTargetStackLimitsConfig; public static Action <34>__HandleLocalizationComplete; public static Action <35>__DrawControllerHotkeyConfig; public static Func <36>__NormalizeGroupId; public static Func <37>__QuickSlotAcceptsItem; } [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static Func <>9__8_0; public static Func <>9__9_0; public static Func <>9__10_0; public static Func <>9__11_0; public static Comparison<(Container Container, float DistanceSq)> <>9__144_0; public static Func <>9__164_0; public static Func <>9__164_1; public static Comparison <>9__174_1; public static Func <>9__176_0; public static Func <>9__176_1; public static Comparison <>9__177_1; public static Comparison <>9__188_1; public static Func <>9__205_0; public static Func <>9__211_0; public static Func <>9__211_1; public static Func <>9__213_0; public static Funcf__AnonymousType0> <>9__213_1; public static Funcf__AnonymousType0, ItemData>, List> <>9__213_2; public static Func <>9__213_3; public static Func <>9__216_0; public static Comparison <>9__216_1; public static Func <>9__218_1; public static Func <>9__218_2; public static Func <>9__269_0; public static Func <>9__270_0; public static Func <>9__272_0; public static Func <>9__272_1; public static UnityAction <>9__300_0; public static Func <>9__332_0; public static Func <>9__332_1; public static EventHandler <>9__346_0; public static EventHandler <>9__346_1; public static EventHandler <>9__346_2; public static EventHandler <>9__346_3; public static EventHandler <>9__346_4; public static EventHandler <>9__346_5; public static Func <>9__409_0; public static Func <>9__412_0; public static Func <>9__413_0; public static Func <>9__413_1; public static Func <>9__414_0; public static Func <>9__414_1; public static Action <>9__443_0; public static Action <>9__443_1; public static Action <>9__443_2; public static Action <>9__443_3; public static Action <>9__458_0; public static Func <>9__558_0; public static Action <>9__569_0; public static Func <>9__588_0; public static Func <>9__630_0; public static Func <>9__654_0; public static Func <>9__655_0; public static Func <>9__689_0; public static Func <>9__699_0; public static Func <>9__930_0; public static Func <>9__930_2; public static Func <>9__1110_0; public static Func <>9__1110_1; public static Func <>9__1121_0; public static Func <>9__1121_1; public static Func <>9__1216_0; public static Func <>9__1216_1; public static Func <>9__1216_2; public static Func <>9__1216_3; public static Func <>9__1373_0; public static Func <>9__1429_0; public static UnityAction <>9__1489_0; public static UnityAction <>9__1489_1; public static UnityAction <>9__1491_0; public static UnityAction <>9__1498_0; public static Func, string> <>9__1529_0; public static Func, string> <>9__1529_1; public static Func <>9__1550_0; public static Func <>9__1550_1; public static Func <>9__1550_2; public static Func <>9__1560_0; public static Func <>9__1577_0; public static Func <>9__1700_0; public static Func <>9__1786_0; public static Func <>9__1819_0; public static Func <>9__1819_1; public static Func <>9__1819_2; public static Action <>9__1825_0; public static Action <>9__1825_1; public static Action <>9__1868_0; public static Action <>9__1868_1; public static Action <>9__1939_0; public static Action <>9__1939_1; public static Action <>9__1953_0; public static Action <>9__1953_1; public static Func <>9__1966_0; public static Func <>9__1966_1; public static Func <>9__2102_0; public static Func <>9__2102_1; public static Func <>9__2151_0; public static Func <>9__2152_0; public static Func <>9__2153_0; public static Func <>9__2153_1; public static Func <>9__2154_0; public static Func <>9__2154_1; public static EventHandler <>9__2258_0; public static EventHandler <>9__2258_1; public static EventHandler <>9__2258_2; public static EventHandler <>9__2258_3; public static EventHandler <>9__2258_4; public static EventHandler <>9__2258_5; public static Func <>9__2299_0; public static Func <>9__2302_0; public static Action <>9__2427_0; public static FileSystemEventHandler <>9__2429_0; public static RenamedEventHandler <>9__2429_1; public static ErrorEventHandler <>9__2429_2; public static Func>, string> <>9__2437_0; public static Func>, List> <>9__2437_1; public static Func <>9__2443_0; public static Func <>9__2443_1; public static Func <>9__2443_2; public static Func <>9__2443_3; public static Func <>9__2449_0; public static Func <>9__2449_1; public static Func <>9__2449_2; public static Func <>9__2449_3; public static Func <>9__2449_4; public static Func <>9__2449_5; public static Func <>9__2454_0; public static Func <>9__2454_1; public static Func <>9__2466_0; internal bool b__8_0(ItemData? item) { return IsAdventureBackpackItem(item); } internal bool b__9_0(ItemData? item) { return IsSmoothbrainBackpackItem(item); } internal bool b__10_0(ItemData? item) { return IsRustyBagItem(item); } internal bool b__11_0(ItemData? item) { return IsRustyQuiverItem(item); } internal int b__144_0((Container Container, float DistanceSq) left, (Container Container, float DistanceSq) right) { return left.DistanceSq.CompareTo(right.DistanceSq); } internal bool b__164_0(FieldInfo field) { if (field.FieldType == typeof(float) && IsSfxVolumeMemberName(field.Name)) { return !IsUnsupportedSfxVolumeMemberName(field.Name); } return false; } internal bool b__164_1(PropertyInfo property) { if (property.PropertyType == typeof(float) && property.CanRead && property.CanWrite && property.GetIndexParameters().Length == 0 && IsSfxVolumeMemberName(property.Name)) { return !IsUnsupportedSfxVolumeMemberName(property.Name); } return false; } internal int b__174_1(ItemData a, ItemData b) { //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) return -CompareGridOrder(a.m_gridPos, b.m_gridPos); } internal bool b__176_0(ItemData item) { return item?.m_shared != null; } internal string b__176_1(ItemData item) { return item.m_shared.m_name; } internal int b__177_1(ItemData a, ItemData b) { //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) return CompareGridOrder(a.m_gridPos, b.m_gridPos); } internal int b__188_1(ItemData a, ItemData b) { //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) return -CompareGridOrder(a.m_gridPos, b.m_gridPos); } internal bool b__205_0(ItemData item) { return item?.m_shared != null; } internal ItemData b__211_0(ItemData item) { return item; } internal ItemData b__211_1(ItemData item) { return item; } internal bool b__213_0(ItemData item) { if (item?.m_shared != null && item.m_stack < item.m_shared.m_maxStackSize) { return CanUseContainerActionStacking(item); } return false; } internal global::<>f__AnonymousType0 b__213_1(ItemData item) { return new { item.m_shared.m_name, item.m_quality }; } internal List b__213_2(IGroupingf__AnonymousType0, ItemData> grouping) { return grouping.ToList(); } internal int b__213_3(ItemData item) { return item.m_stack; } internal bool b__216_0(ItemData item) { return item?.m_shared != null; } internal int b__216_1(ItemData left, ItemData right) { //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) return CompareGridOrder(left.m_gridPos, right.m_gridPos); } internal int b__218_1(ItemData target) { return target.m_gridPos.y; } internal int b__218_2(ItemData target) { return target.m_gridPos.x; } internal bool b__269_0(SlotDefinition slot) { return slot.Kind == SlotKind.CustomEquipment; } internal bool b__270_0(SlotDefinition slot) { return slot.Kind == SlotKind.CustomEquipment; } internal VisEquipment b__272_0(CustomEquipmentVisual visual) { return visual.Owner; } internal bool b__272_1(VisEquipment owner) { return !IsUnityNull((Object?)(object)owner); } internal void b__300_0(string value) { SetCraftingCount(ParseCraftingCount(value)); } internal bool b__332_0(TMP_Text text) { if (!((Object)(object)text == (Object)null)) { return IsUnityNull((Object?)(object)text); } return true; } internal bool b__332_1(Text text) { if (!((Object)(object)text == (Object)null)) { return IsUnityNull((Object?)(object)text); } return true; } internal void b__346_0(object _, EventArgs _) { InvalidateCraftingRecipeGridLayout(); InvalidateCraftingRecipeGridZoomHint(); } internal void b__346_1(object _, EventArgs _) { InvalidateCraftingRecipeGridZoomHint(); } internal void b__346_2(object _, EventArgs _) { MarkCraftingGroupRailDirty(); } internal void b__346_3(object _, EventArgs _) { InvalidateCraftingRecipeGridZoomHint(); } internal void b__346_4(object _, EventArgs _) { _craftingSortModeButtonsSignature = ""; InvalidateCraftingRecipeView(); } internal void b__346_5(object _, EventArgs _) { InvalidateCraftingRecipeGridLayout(); } internal string b__409_0() { return Guid.NewGuid().ToString("N"); } internal bool b__412_0(ItemData item) { return item?.m_customData != null; } internal bool b__413_0(string recipe) { return !string.IsNullOrWhiteSpace(recipe); } internal bool b__413_1(string itemId) { return !string.IsNullOrWhiteSpace(itemId); } internal string b__414_0(string recipe) { return recipe; } internal string b__414_1(string itemId) { return itemId; } internal void b__443_0(UIInputHandler handler) { CraftingRecipeGridMarker component = ((Component)handler).GetComponent(); SetCraftingRecipeHover(component?.Index ?? (-1), component?.Tooltip); } internal void b__443_1(UIInputHandler handler) { CraftingRecipeGridMarker component = ((Component)handler).GetComponent(); ClearCraftingRecipeHover(component?.Index ?? (-1), component?.Tooltip); } internal void b__443_2(UIInputHandler handler) { CraftingRecipeGridMarker component = ((Component)handler).GetComponent(); int num = component?.Index ?? (-1); ClearCraftingRecipeHover(num, component?.Tooltip); if (!TryToggleCraftingRecipeFavorite(num)) { SelectCraftingRecipeFromGrid(num); } } internal void b__443_3(UIInputHandler handler) { CraftingRecipeGridMarker component = ((Component)handler).GetComponent(); int num = component?.Index ?? (-1); ClearCraftingRecipeHover(num, component?.Tooltip); if (!TryToggleCraftingRecipeFavorite(num)) { SelectCraftingRecipeFromGrid(num); } } internal void b__458_0(UIInputHandler handler) { ShowCraftingRecipeStyleDialog(((Component)handler).GetComponent()); } internal bool b__558_0(CraftingRecipeGroupFilter filter) { return filter.Id != _selectedCraftingGroupId; } internal void b__569_0(UIInputHandler handler) { ToggleCraftingGroupFilter(((Component)handler).GetComponent()?.FilterId ?? ""); } internal string b__588_0(CraftingRecipeGroupFilter filter) { return filter.Id; } internal bool b__630_0(ItemData _) { return false; } internal bool b__654_0(char c) { return !char.IsWhiteSpace(c); } internal bool b__655_0(char c) { return !char.IsWhiteSpace(c); } internal bool b__689_0(CraftingRecipeGroupFilter group) { return group.Id == _selectedCraftingGroupId; } internal Transform b__699_0(Image image) { return ((Component)image).transform; } internal bool b__930_0(SlotDefinition slot) { return slot.Kind == SlotKind.Quick; } internal bool b__930_2(SlotDefinition slot) { return slot.Kind != SlotKind.Quick; } internal bool b__1110_0(SlotDefinition slot) { return slot.Id != "jewelcrafting.necklace"; } internal bool b__1110_1(SlotDefinition slot) { return slot.Id != "jewelcrafting.ring"; } internal bool b__1121_0(SlotDefinition slot) { if (slot.Id == "jewelcrafting.ring") { return slot.Kind == SlotKind.CustomEquipment; } return false; } internal bool b__1121_1(SlotDefinition slot) { if (slot.Id == "jewelcrafting.necklace") { return slot.Kind == SlotKind.CustomEquipment; } return false; } internal bool b__1216_0(Graphic graphic) { if (!((Object)(object)graphic == (Object)null)) { return IsUnityNull((Object?)(object)graphic); } return true; } internal bool b__1216_1(TMP_Text text) { if (!((Object)(object)text == (Object)null)) { return IsUnityNull((Object?)(object)text); } return true; } internal bool b__1216_2(LayoutGroup group) { if (!((Object)(object)group == (Object)null)) { return IsUnityNull((Object?)(object)group); } return true; } internal bool b__1216_3(ContentSizeFitter fitter) { if (!((Object)(object)fitter == (Object)null)) { return IsUnityNull((Object?)(object)fitter); } return true; } internal bool b__1373_0(SlotDefinition existing) { return existing.Id == "magicsupremacy.belt"; } internal bool b__1429_0(int x, int y) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) return !IsExternalReservedForCompat(new Vector2i(x, y)); } internal void b__1489_0() { StoreAllToCurrentContainer(Player.m_localPlayer); } internal void b__1489_1() { RestockFromCurrentContainer(Player.m_localPlayer); } internal void b__1491_0() { SortPlayerInventory(Player.m_localPlayer); } internal void b__1498_0() { SortCurrentContainer(Player.m_localPlayer); } internal string b__1529_0(KeyValuePair pair) { return pair.Key; } internal string b__1529_1(KeyValuePair pair) { return pair.Key + "=" + pair.Value; } internal int b__1550_0(Vector2i slot) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) return slot.y; } internal int b__1550_1(Vector2i slot) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) return slot.x; } internal InventorySlotsFavoriteSlot b__1550_2(Vector2i slot) { //IL_0006: 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) return new InventorySlotsFavoriteSlot { X = slot.x, Y = slot.y }; } internal bool b__1560_0(Transform child) { if (((Object)child).name.StartsWith("key_bkg", StringComparison.OrdinalIgnoreCase)) { return (Object)(object)((Component)child).GetComponent() != (Object)null; } return false; } internal bool b__1577_0(TMP_FontAsset fontAsset) { if ((Object)(object)fontAsset != (Object)null && !IsUnityNull((Object?)(object)fontAsset)) { return (((Object)fontAsset).name ?? "").IndexOf("LiberationSans", StringComparison.OrdinalIgnoreCase) < 0; } return false; } internal bool b__1700_0(UITooltip tooltip, InventoryHoverTooltipItemSource source) { return !IsInventoryHoverTooltipSourceValid(tooltip, source); } internal bool b__1786_0(TMP_Text text) { return !IsKeyHintText(text); } internal bool b__1819_0(AnimationClip c) { if ((Object)(object)c != (Object)null && c.length > 0.05f) { return c.length < 2f; } return false; } internal bool b__1819_1(AnimationClip c) { return IsLikelyInventoryOpenClip(((Object)c).name); } internal float b__1819_2(AnimationClip c) { return Mathf.Abs(c.length - 0.25f); } internal void b__1825_0(UIInputHandler handler) { SelectQuickHudSlot(((Component)handler).GetComponentInParent()); } internal void b__1825_1(UIInputHandler handler) { UseQuickHudSlot(((Component)handler).GetComponentInParent()); } internal void b__1868_0(UIInputHandler _) { StartPlayerInventoryRowsDrag(); } internal void b__1868_1(UIInputHandler _) { StopPlayerInventoryRowsDrag(); } internal void b__1939_0(UIInputHandler handler) { StartInventoryPanelDrag(((Component)handler).GetComponent()); } internal void b__1939_1(UIInputHandler _) { StopInventoryPanelDrag(); } internal void b__1953_0(UIInputHandler handler) { StartInventoryPanelDrag(((Component)handler).GetComponent()); } internal void b__1953_1(UIInputHandler _) { StopInventoryPanelDrag(); } internal int b__1966_0(MovedPlayerStatPanel panel) { return panel.SortOrder; } internal PlayerStatPanelKind b__1966_1(MovedPlayerStatPanel panel) { return panel.Kind; } internal bool b__2102_0(RestockTargetLimitEditorRow row) { if (string.IsNullOrWhiteSpace(row.Item)) { return !string.IsNullOrWhiteSpace(row.Amount); } return true; } internal string b__2102_1(RestockTargetLimitEditorRow row) { return row.Item.Trim() + ": " + row.Amount.Trim(); } internal string b__2151_0(RecycleNReclaimYieldTextEntry entry) { return $"{LocalizeUi(entry.Name, entry.Name)} x{entry.Amount}"; } internal bool b__2152_0(RectTransform slot) { if ((Object)(object)slot != (Object)null && !IsUnityNull((Object?)(object)slot)) { return ((Component)slot).gameObject.activeSelf; } return false; } internal bool b__2153_0(string part) { return !string.IsNullOrWhiteSpace(part); } internal string b__2153_1(string part) { return part.Trim(); } internal string b__2154_0(string line) { return line.Trim(); } internal bool b__2154_1(string line) { return !string.IsNullOrWhiteSpace(line); } internal void b__2258_0(object _, EventArgs _) { InvalidatePinnedTooltipUi(); } internal void b__2258_1(object _, EventArgs _) { RefreshPinnedTooltipBackgrounds(); } internal void b__2258_2(object _, EventArgs _) { RefreshCraftingHoverTooltipBackground(); } internal void b__2258_3(object _, EventArgs _) { RefreshInventoryContainerHoverTooltipBackground(); } internal void b__2258_4(object _, EventArgs _) { OnInventoryTrashPanelConfigChanged(); } internal void b__2258_5(object _, EventArgs _) { RefreshRestockTargetStackLimits(); } internal bool b__2299_0(ItemData item) { if (item != null) { return item.m_gridPos.y >= GetFixedRegularRows(); } return false; } internal bool b__2302_0(ItemData item) { if (item != null) { return item.m_gridPos.y >= GetFixedRegularRows(); } return false; } internal void b__2427_0() { ApplyYaml(_syncedYaml.Value, fromSync: true); } internal void b__2429_0(object _, FileSystemEventArgs _) { QueueYamlReload(); } internal void b__2429_1(object _, RenamedEventArgs _) { QueueYamlReload(); } internal void b__2429_2(object _, ErrorEventArgs _) { QueueYamlReload(); } internal string b__2437_0(KeyValuePair> entry) { return entry.Key; } internal List b__2437_1(KeyValuePair> entry) { return entry.Value.ToList(); } internal bool b__2443_0(string value) { return !string.IsNullOrWhiteSpace(value); } internal string b__2443_1(string value) { return value.Trim(); } internal bool b__2443_2(string value) { return !string.IsNullOrWhiteSpace(value); } internal bool b__2443_3(string value) { return !string.IsNullOrWhiteSpace(value); } internal bool b__2449_0(ItemData? item) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Invalid comparison between Unknown and I4 if (item == null) { return false; } return (int)(item.m_shared?.m_itemType).GetValueOrDefault() == 6; } internal bool b__2449_1(ItemData? item) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Invalid comparison between Unknown and I4 if (item == null) { return false; } return (int)(item.m_shared?.m_itemType).GetValueOrDefault() == 7; } internal bool b__2449_2(ItemData? item) { //IL_001a: 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_002e: Invalid comparison between Unknown and I4 if (item == null) { return false; } return (int)(item.m_shared?.m_itemType).GetValueOrDefault() == 11; } internal bool b__2449_3(ItemData? item) { //IL_001a: 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_002e: Invalid comparison between Unknown and I4 if (item == null) { return false; } return (int)(item.m_shared?.m_itemType).GetValueOrDefault() == 17; } internal bool b__2449_4(ItemData? item) { //IL_0018: 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_002c: Invalid comparison between Unknown and I4 if (item != null && (int)(item.m_shared?.m_itemType).GetValueOrDefault() == 18) { return !IsJewelcraftingDedicatedJewelryItem(item); } return false; } internal bool b__2449_5(ItemData? item) { //IL_001a: 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_002e: Invalid comparison between Unknown and I4 if (item == null) { return false; } return (int)(item.m_shared?.m_itemType).GetValueOrDefault() == 24; } internal bool b__2454_0(string value) { return !string.IsNullOrWhiteSpace(value); } internal string b__2454_1(string value) { return value.Trim(); } internal bool b__2466_0(string value) { return !string.IsNullOrWhiteSpace(value); } } [CompilerGenerated] private sealed class d__923 : IEnumerable, IEnumerable, IEnumerator, IDisposable, IEnumerator { private int <>1__state; private Image <>2__current; private int <>l__initialThreadId; private InventoryGui gui; public InventoryGui <>3__gui; private Transform[] <>7__wrap1; private int <>7__wrap2; private Transform 5__4; private Transform 5__5; private Transform 5__6; private Image[] <>7__wrap6; private int <>7__wrap7; Image IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__923(int <>1__state) { this.<>1__state = <>1__state; <>l__initialThreadId = Environment.CurrentManagedThreadId; } [DebuggerHidden] void IDisposable.Dispose() { <>7__wrap1 = null; 5__4 = null; 5__5 = null; 5__6 = null; <>7__wrap6 = null; <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>7__wrap1 = (Transform[])(object)new Transform[4] { (Transform)gui.m_recipeListRoot, ((Object)(object)gui.m_recipeListScroll != (Object)null) ? ((Component)gui.m_recipeListScroll).transform : null, ((Object)(object)gui.m_minStationLevelIcon != (Object)null) ? ((Component)gui.m_minStationLevelIcon).transform : null, ((Object)(object)gui.m_minStationLevelText != (Object)null) ? gui.m_minStationLevelText.transform : null }; <>7__wrap2 = 0; goto IL_027f; case 1: <>1__state = -1; goto IL_0134; case 2: { <>1__state = -1; goto IL_01fd; } IL_027f: if (<>7__wrap2 < <>7__wrap1.Length) { 5__4 = <>7__wrap1[<>7__wrap2]; 5__5 = 5__4; goto IL_023a; } <>7__wrap1 = null; return false; IL_01fd: <>7__wrap7++; goto IL_020b; IL_0134: <>7__wrap7++; goto IL_0142; IL_023a: if ((Object)(object)5__5 != (Object)null && (Object)(object)5__5 != (Object)(object)gui.m_crafting) { <>7__wrap6 = ((Component)5__5).GetComponents(); <>7__wrap7 = 0; goto IL_0142; } 5__5 = null; 5__4 = null; <>7__wrap2++; goto IL_027f; IL_0222: 5__5 = 5__5.parent; 5__6 = null; goto IL_023a; IL_0142: if (<>7__wrap7 < <>7__wrap6.Length) { Image image = <>7__wrap6[<>7__wrap7]; if (ShouldHideCraftingPanelBackgroundImage(gui, image)) { <>2__current = image; <>1__state = 1; return true; } goto IL_0134; } <>7__wrap6 = null; 5__6 = 5__5.parent; if ((Object)(object)5__6 != (Object)null && (Object)(object)5__6 != (Object)(object)gui.m_crafting) { <>7__wrap6 = ((Component)5__6).GetComponentsInChildren(true); <>7__wrap7 = 0; goto IL_020b; } goto IL_0222; IL_020b: if (<>7__wrap7 < <>7__wrap6.Length) { Image val = <>7__wrap6[<>7__wrap7]; if (ShouldHideCraftingPanelBackgroundImage(gui, val) && IsNearCraftingFieldBackground(5__4, ((Component)val).transform, 5__6)) { <>2__current = val; <>1__state = 2; return true; } goto IL_01fd; } <>7__wrap6 = null; goto IL_0222; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } [DebuggerHidden] IEnumerator IEnumerable.GetEnumerator() { d__923 d__; if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId) { <>1__state = 0; d__ = this; } else { d__ = new d__923(0); } d__.gui = <>3__gui; return d__; } [DebuggerHidden] IEnumerator IEnumerable.GetEnumerator() { return ((IEnumerable)this).GetEnumerator(); } } [CompilerGenerated] private sealed class d__922 : IEnumerable, IEnumerable, IEnumerator, IDisposable, IEnumerator { private int <>1__state; private Image <>2__current; private int <>l__initialThreadId; private InventoryGui gui; public InventoryGui <>3__gui; private string[] <>7__wrap1; private int <>7__wrap2; private Transform 5__4; private Image 5__5; private Image[] <>7__wrap5; private int <>7__wrap6; Image IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__922(int <>1__state) { this.<>1__state = <>1__state; <>l__initialThreadId = Environment.CurrentManagedThreadId; } [DebuggerHidden] void IDisposable.Dispose() { <>7__wrap1 = null; 5__4 = null; 5__5 = null; <>7__wrap5 = null; <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>7__wrap1 = new string[3] { "RecipeList", "Decription", "Description" }; <>7__wrap2 = 0; goto IL_0180; case 1: <>1__state = -1; goto IL_00d6; case 2: { <>1__state = -1; goto IL_013f; } IL_0180: if (<>7__wrap2 < <>7__wrap1.Length) { string text = <>7__wrap1[<>7__wrap2]; 5__4 = ((Transform)gui.m_crafting).Find(text); if (!((Object)(object)5__4 == (Object)null)) { 5__5 = ((Component)5__4).GetComponent(); if ((Object)(object)5__5 != (Object)null && ShouldHideCraftingPanelBackgroundImage(gui, 5__5)) { <>2__current = 5__5; <>1__state = 1; return true; } goto IL_00d6; } goto IL_0172; } <>7__wrap1 = null; return false; IL_00d6: <>7__wrap5 = ((Component)5__4).GetComponentsInChildren(true); <>7__wrap6 = 0; goto IL_014d; IL_014d: if (<>7__wrap6 < <>7__wrap5.Length) { Image val = <>7__wrap5[<>7__wrap6]; if ((Object)(object)val != (Object)(object)5__5 && ShouldHideCraftingPanelBackgroundImage(gui, val) && IsCraftingBackgroundLikeImage(((Component)val).transform)) { <>2__current = val; <>1__state = 2; return true; } goto IL_013f; } <>7__wrap5 = null; 5__4 = null; 5__5 = null; goto IL_0172; IL_0172: <>7__wrap2++; goto IL_0180; IL_013f: <>7__wrap6++; goto IL_014d; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } [DebuggerHidden] IEnumerator IEnumerable.GetEnumerator() { d__922 d__; if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId) { <>1__state = 0; d__ = this; } else { d__ = new d__922(0); } d__.gui = <>3__gui; return d__; } [DebuggerHidden] IEnumerator IEnumerable.GetEnumerator() { return ((IEnumerable)this).GetEnumerator(); } } [CompilerGenerated] private sealed class d__511 : IEnumerable, IEnumerable, IEnumerator, IDisposable, IEnumerator { private int <>1__state; private RectTransform <>2__current; private int <>l__initialThreadId; private InventoryGui gui; public InventoryGui <>3__gui; private int 5__2; RectTransform IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__511(int <>1__state) { this.<>1__state = <>1__state; <>l__initialThreadId = Environment.CurrentManagedThreadId; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { int num = <>1__state; if (num != 0) { if (num != 1) { return false; } <>1__state = -1; goto IL_0079; } <>1__state = -1; if ((Object)(object)gui.m_crafting == (Object)null) { return false; } 5__2 = 0; goto IL_0089; IL_0079: 5__2++; goto IL_0089; IL_0089: if (5__2 >= ((Transform)gui.m_crafting).childCount) { return false; } Transform child = ((Transform)gui.m_crafting).GetChild(5__2); RectTransform val = (RectTransform)(object)((child is RectTransform) ? child : null); if (val != null && ShouldProtectCraftingPanelResizeChild(gui, val)) { <>2__current = val; <>1__state = 1; return true; } goto IL_0079; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } [DebuggerHidden] IEnumerator IEnumerable.GetEnumerator() { d__511 d__; if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId) { <>1__state = 0; d__ = this; } else { d__ = new d__511(0); } d__.gui = <>3__gui; return d__; } [DebuggerHidden] IEnumerator IEnumerable.GetEnumerator() { return ((IEnumerable)this).GetEnumerator(); } } [CompilerGenerated] private sealed class d__921 : IEnumerable, IEnumerable, IEnumerator, IDisposable, IEnumerator { private int <>1__state; private Image <>2__current; private int <>l__initialThreadId; private InventoryGui gui; public InventoryGui <>3__gui; private HashSet 5__2; private IEnumerator <>7__wrap2; Image IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__921(int <>1__state) { this.<>1__state = <>1__state; <>l__initialThreadId = Environment.CurrentManagedThreadId; } [DebuggerHidden] void IDisposable.Dispose() { switch (<>1__state) { case -3: case 1: try { } finally { <>m__Finally1(); } break; case -4: case 2: try { } finally { <>m__Finally2(); } break; } 5__2 = null; <>7__wrap2 = null; <>1__state = -2; } private bool MoveNext() { try { switch (<>1__state) { default: return false; case 0: <>1__state = -1; if ((Object)(object)gui.m_crafting == (Object)null) { return false; } 5__2 = new HashSet(); <>7__wrap2 = FindCraftingPanelNamedBackgroundImages(gui).GetEnumerator(); <>1__state = -3; goto IL_00a3; case 1: <>1__state = -3; goto IL_00a3; case 2: { <>1__state = -4; break; } IL_00a3: while (<>7__wrap2.MoveNext()) { Image current = <>7__wrap2.Current; if (5__2.Add(current)) { <>2__current = current; <>1__state = 1; return true; } } <>m__Finally1(); <>7__wrap2 = null; <>7__wrap2 = FindCraftingPanelFieldBackgroundImages(gui).GetEnumerator(); <>1__state = -4; break; } while (<>7__wrap2.MoveNext()) { Image current2 = <>7__wrap2.Current; if (5__2.Add(current2)) { <>2__current = current2; <>1__state = 2; return true; } } <>m__Finally2(); <>7__wrap2 = null; return false; } catch { //try-fault ((IDisposable)this).Dispose(); throw; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } private void <>m__Finally1() { <>1__state = -1; if (<>7__wrap2 != null) { <>7__wrap2.Dispose(); } } private void <>m__Finally2() { <>1__state = -1; if (<>7__wrap2 != null) { <>7__wrap2.Dispose(); } } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } [DebuggerHidden] IEnumerator IEnumerable.GetEnumerator() { d__921 d__; if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId) { <>1__state = 0; d__ = this; } else { d__ = new d__921(0); } d__.gui = <>3__gui; return d__; } [DebuggerHidden] IEnumerator IEnumerable.GetEnumerator() { return ((IEnumerable)this).GetEnumerator(); } } [CompilerGenerated] private sealed class d__1036 : IEnumerable, IEnumerable, IEnumerator, IDisposable, IEnumerator { private int <>1__state; private string <>2__current; private int <>l__initialThreadId; private ItemData item; public ItemData <>3__item; private string[] <>7__wrap1; private int <>7__wrap2; string IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__1036(int <>1__state) { this.<>1__state = <>1__state; <>l__initialThreadId = Environment.CurrentManagedThreadId; } [DebuggerHidden] void IDisposable.Dispose() { <>7__wrap1 = null; <>1__state = -2; } private bool MoveNext() { int num = <>1__state; if (num != 0) { if (num != 1) { return false; } <>1__state = -1; goto IL_0090; } <>1__state = -1; string itemPrefabName = GetItemPrefabName(item); string text = item.m_shared.m_name ?? ""; <>7__wrap1 = new string[3] { itemPrefabName, NormalizeResourceToken(itemPrefabName), text }; <>7__wrap2 = 0; goto IL_009e; IL_009e: if (<>7__wrap2 < <>7__wrap1.Length) { string value = <>7__wrap1[<>7__wrap2]; if (!string.IsNullOrWhiteSpace(value)) { <>2__current = value; <>1__state = 1; return true; } goto IL_0090; } <>7__wrap1 = null; return false; IL_0090: <>7__wrap2++; goto IL_009e; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } [DebuggerHidden] IEnumerator IEnumerable.GetEnumerator() { d__1036 d__; if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId) { <>1__state = 0; d__ = this; } else { d__ = new d__1036(0); } d__.item = <>3__item; return d__; } [DebuggerHidden] IEnumerator IEnumerable.GetEnumerator() { return ((IEnumerable)this).GetEnumerator(); } } [CompilerGenerated] private sealed class d__1094 : IEnumerable, IEnumerable, IEnumerator, IDisposable, IEnumerator { private int <>1__state; private string <>2__current; private int <>l__initialThreadId; private ItemData item; public ItemData <>3__item; private string 5__2; string IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__1094(int <>1__state) { this.<>1__state = <>1__state; <>l__initialThreadId = Environment.CurrentManagedThreadId; } [DebuggerHidden] void IDisposable.Dispose() { 5__2 = null; <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: { <>1__state = -1; string itemPrefabName = GetItemPrefabName(item); 5__2 = item.m_shared.m_name ?? ""; if (!string.IsNullOrWhiteSpace(itemPrefabName)) { <>2__current = GetRecipeOutputLookupKey("prefab", itemPrefabName); <>1__state = 1; return true; } goto IL_0076; } case 1: <>1__state = -1; goto IL_0076; case 2: { <>1__state = -1; break; } IL_0076: if (!string.IsNullOrWhiteSpace(5__2)) { <>2__current = GetRecipeOutputLookupKey("name", 5__2); <>1__state = 2; return true; } break; } return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } [DebuggerHidden] IEnumerator IEnumerable.GetEnumerator() { d__1094 d__; if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId) { <>1__state = 0; d__ = this; } else { d__ = new d__1094(0); } d__.item = <>3__item; return d__; } [DebuggerHidden] IEnumerator IEnumerable.GetEnumerator() { return ((IEnumerable)this).GetEnumerator(); } } [CompilerGenerated] private sealed class d__909 : IEnumerable, IEnumerable, IEnumerator, IDisposable, IEnumerator { private int <>1__state; private Transform? <>2__current; private int <>l__initialThreadId; private InventoryGui gui; public InventoryGui <>3__gui; Transform IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__909(int <>1__state) { this.<>1__state = <>1__state; <>l__initialThreadId = Environment.CurrentManagedThreadId; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (((Object)(object)gui.m_recipeListScroll != (Object)null) ? ((Component)gui.m_recipeListScroll).transform : null); <>1__state = 1; return true; case 1: <>1__state = -1; <>2__current = (((Object)(object)gui.m_recipeIcon != (Object)null) ? ((Component)gui.m_recipeIcon).transform : null); <>1__state = 2; return true; case 2: <>1__state = -1; <>2__current = (((Object)(object)gui.m_recipeName != (Object)null) ? gui.m_recipeName.transform : null); <>1__state = 3; return true; case 3: <>1__state = -1; <>2__current = (((Object)(object)gui.m_recipeDecription != (Object)null) ? gui.m_recipeDecription.transform : null); <>1__state = 4; return true; case 4: <>1__state = -1; <>2__current = (((Object)(object)gui.m_itemCraftType != (Object)null) ? gui.m_itemCraftType.transform : null); <>1__state = 5; return true; case 5: <>1__state = -1; <>2__current = (((Object)(object)gui.m_variantButton != (Object)null) ? ((Component)gui.m_variantButton).transform : null); <>1__state = 6; return true; case 6: <>1__state = -1; <>2__current = (((Object)(object)gui.m_minStationLevelIcon != (Object)null) ? ((Component)gui.m_minStationLevelIcon).transform : null); <>1__state = 7; return true; case 7: <>1__state = -1; <>2__current = (((Object)(object)gui.m_minStationLevelText != (Object)null) ? gui.m_minStationLevelText.transform : null); <>1__state = 8; return true; case 8: <>1__state = -1; <>2__current = (((Object)(object)gui.m_craftButton != (Object)null) ? ((Component)gui.m_craftButton).transform : null); <>1__state = 9; return true; case 9: <>1__state = -1; <>2__current = (((Object)(object)gui.m_repairButton != (Object)null) ? ((Component)gui.m_repairButton).transform : null); <>1__state = 10; return true; case 10: <>1__state = -1; <>2__current = (((Object)(object)gui.m_repairButtonGlow != (Object)null) ? ((Component)gui.m_repairButtonGlow).transform : null); <>1__state = 11; return true; case 11: <>1__state = -1; <>2__current = (((Object)(object)gui.m_tabCraft != (Object)null) ? ((Component)gui.m_tabCraft).transform : null); <>1__state = 12; return true; case 12: <>1__state = -1; <>2__current = (((Object)(object)gui.m_tabUpgrade != (Object)null) ? ((Component)gui.m_tabUpgrade).transform : null); <>1__state = 13; return true; case 13: <>1__state = -1; return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } [DebuggerHidden] IEnumerator IEnumerable.GetEnumerator() { d__909 d__; if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId) { <>1__state = 0; d__ = this; } else { d__ = new d__909(0); } d__.gui = <>3__gui; return d__; } [DebuggerHidden] IEnumerator IEnumerable.GetEnumerator() { return ((IEnumerable)this).GetEnumerator(); } } [CompilerGenerated] private sealed class d__672 : IEnumerable, IEnumerable, IEnumerator, IDisposable, IEnumerator { private int <>1__state; private string <>2__current; private int <>l__initialThreadId; private ItemDrop itemDrop; public ItemDrop <>3__itemDrop; private string[] <>7__wrap1; private int <>7__wrap2; string IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__672(int <>1__state) { this.<>1__state = <>1__state; <>l__initialThreadId = Environment.CurrentManagedThreadId; } [DebuggerHidden] void IDisposable.Dispose() { <>7__wrap1 = null; <>1__state = -2; } private bool MoveNext() { int num = <>1__state; if (num != 0) { if (num != 1) { return false; } <>1__state = -1; goto IL_00d6; } <>1__state = -1; string text = CleanPrefabName(((Object)itemDrop).name); string itemPrefabName = GetItemPrefabName(itemDrop.m_itemData); string text2 = itemDrop.m_itemData.m_shared.m_name ?? ""; string text3 = ((Localization.instance != null) ? Localization.instance.Localize(text2) : text2); <>7__wrap1 = new string[5] { text, itemPrefabName, text2, StripLocalizationToken(text2), text3 }; <>7__wrap2 = 0; goto IL_00e4; IL_00e4: if (<>7__wrap2 < <>7__wrap1.Length) { string value = NormalizeResourceToken(<>7__wrap1[<>7__wrap2]); if (!string.IsNullOrWhiteSpace(value)) { <>2__current = value; <>1__state = 1; return true; } goto IL_00d6; } <>7__wrap1 = null; return false; IL_00d6: <>7__wrap2++; goto IL_00e4; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } [DebuggerHidden] IEnumerator IEnumerable.GetEnumerator() { d__672 d__; if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId) { <>1__state = 0; d__ = this; } else { d__ = new d__672(0); } d__.itemDrop = <>3__itemDrop; return d__; } [DebuggerHidden] IEnumerator IEnumerable.GetEnumerator() { return ((IEnumerable)this).GetEnumerator(); } } [CompilerGenerated] private sealed class d__201 : IEnumerable, IEnumerable, IEnumerator, IDisposable, IEnumerator { private int <>1__state; private string? <>2__current; private int <>l__initialThreadId; private ItemData item; public ItemData <>3__item; private string 5__2; string IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__201(int <>1__state) { this.<>1__state = <>1__state; <>l__initialThreadId = Environment.CurrentManagedThreadId; } [DebuggerHidden] void IDisposable.Dispose() { 5__2 = null; <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; if (item == null) { return false; } <>2__current = GetItemPrefabName(item); <>1__state = 1; return true; case 1: <>1__state = -1; if (!IsUnityNull((Object?)(object)item.m_dropPrefab)) { <>2__current = ((Object)item.m_dropPrefab).name; <>1__state = 2; return true; } goto IL_0091; case 2: <>1__state = -1; goto IL_0091; case 3: <>1__state = -1; <>2__current = StripLocalizationToken(5__2); <>1__state = 4; return true; case 4: <>1__state = -1; if (Localization.instance != null && !string.IsNullOrWhiteSpace(5__2)) { <>2__current = Localization.instance.Localize(5__2); <>1__state = 5; return true; } break; case 5: { <>1__state = -1; break; } IL_0091: 5__2 = item.m_shared?.m_name ?? ""; <>2__current = 5__2; <>1__state = 3; return true; } return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } [DebuggerHidden] IEnumerator IEnumerable.GetEnumerator() { d__201 d__; if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId) { <>1__state = 0; d__ = this; } else { d__ = new d__201(0); } d__.item = <>3__item; return d__; } [DebuggerHidden] IEnumerator IEnumerable.GetEnumerator() { return ((IEnumerable)this).GetEnumerator(); } } [CompilerGenerated] private sealed class d__1929 : IEnumerable, IEnumerable, IEnumerator, IDisposable, IEnumerator { private int <>1__state; private string <>2__current; private int <>l__initialThreadId; private string value; public string <>3__value; private string[] <>7__wrap1; private int <>7__wrap2; string IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__1929(int <>1__state) { this.<>1__state = <>1__state; <>l__initialThreadId = Environment.CurrentManagedThreadId; } [DebuggerHidden] void IDisposable.Dispose() { <>7__wrap1 = null; <>1__state = -2; } private bool MoveNext() { int num = <>1__state; if (num != 0) { if (num != 1) { return false; } <>1__state = -1; goto IL_0084; } <>1__state = -1; if (string.IsNullOrWhiteSpace(value)) { return false; } <>7__wrap1 = value.Split(new char[3] { ',', ';', '|' }, StringSplitOptions.RemoveEmptyEntries); <>7__wrap2 = 0; goto IL_0092; IL_0084: <>7__wrap2++; goto IL_0092; IL_0092: if (<>7__wrap2 < <>7__wrap1.Length) { string text = <>7__wrap1[<>7__wrap2].Trim(); if (!string.IsNullOrWhiteSpace(text)) { <>2__current = text; <>1__state = 1; return true; } goto IL_0084; } <>7__wrap1 = null; return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } [DebuggerHidden] IEnumerator IEnumerable.GetEnumerator() { d__1929 d__; if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId) { <>1__state = 0; d__ = this; } else { d__ = new d__1929(0); } d__.value = <>3__value; return d__; } [DebuggerHidden] IEnumerator IEnumerable.GetEnumerator() { return ((IEnumerable)this).GetEnumerator(); } } private const string ServerCharactersGuid = "org.bepinex.plugins.servercharacters"; private const string MultiUserChestGuid = "com.maxsch.valheim.MultiUserChest"; private const string BetterArcheryGuid = "ishid4.mods.betterarchery"; private const string AzuCraftyBoxesGuid = "Azumatt.AzuCraftyBoxes"; private const string EpicLootGuid = "randyknapp.mods.epicloot"; private const string TooltipExpansionGuid = "Azumatt.TooltipExpansion"; private const string JewelcraftingGuid = "org.bepinex.plugins.jewelcrafting"; private const string ItemRequiresSkillLevelGuid = "WackyMole.ItemRequiresSkillLevel"; private const string AdventureBackpacksGuid = "vapok.mods.adventurebackpacks"; private const string SmoothbrainBackpacksGuid = "org.bepinex.plugins.backpacks"; private const string RustyBagsGuid = "RustyMods.RustyBags"; private const string MagicSupremacyGuid = "Dreanegade.Magic_Supremacy"; private const string CurrencyPocketGuid = "Azumatt.CurrencyPocket"; private const string MyLittleUIGuid = "shudnal.MyLittleUI"; private const string RecycleNReclaimGuid = "Azumatt.Recycle_N_Reclaim"; private static readonly CompatRuntimeState CompatRuntime = new CompatRuntimeState(); private static readonly ConfigSync ConfigSync = new ConfigSync("sighsorry.InventorySlots") { DisplayName = "InventorySlots", CurrentVersion = "1.0.4", MinimumRequiredVersion = "1.0.4" }; private static ConfigEntry _serverConfigLocked = null; private static ConfigEntry _progressiveRowsEnabled = null; private static ConfigEntry _maxExtraRows = null; private static ConfigEntry[] _rowUnlockItems = null; private static ConfigEntry _quickSlotCount = null; private static ConfigEntry _quickSlotProgressionEnabled = null; private static ConfigEntry[] _quickSlotRowUnlockItems = null; private static ConfigEntry _deathKeepRulesEnabled = null; private static ConfigEntry _areaQuickStackRange = null; private static ConfigEntry _areaRestockRange = null; private static ConfigEntry _restockTargetStackLimitsConfig = null; private static ConfigEntry _hotbarSwitchKey = null; private static ConfigEntry _containerRestockKey = null; private static ConfigEntry _showHotbarSwitchHint = null; private static ConfigEntry _inventoryRowsDisplayMode = null; private static ConfigEntry _showInventoryWheelButton = null; private static ConfigEntry _enableInventoryTrashPanel = null; private static ConfigEntry _pinnedTooltipSlots = null; private static ConfigEntry _pinnedTooltipKey = null; private static ConfigEntry _pinnedTooltipBackgroundAlpha = null; private static ConfigEntry _craftingHoverTooltipBackgroundAlpha = null; private static ConfigEntry _inventoryContainerHoverTooltipBackgroundAlpha = null; private static ConfigEntry _containerActionSuccessFxMode = null; private static ConfigEntry _containerActionSuccessFxVolume = null; private static ConfigEntry _inventorySortMode = null; private static ConfigEntry _mouseUiScrollMultiplier = null; private static ConfigEntry _enableGamepadUiScroll = null; private static ConfigEntry _gamepadUiScrollSource = null; private static ConfigEntry _gamepadUiScrollSensitivity = null; private static ConfigEntry _gamepadUiScrollRepeatDelay = null; private static ConfigEntry _gamepadUiScrollDeadzone = null; private static ConfigEntry _enableControllerHotkeys = null; private static ConfigEntry _controllerDPadHotkeyMode = null; private static ConfigEntry _controllerDPadModifierButton = null; private static ConfigEntry _controllerCraftingGridZoomModifierButton = null; private static ConfigEntry _controllerPinnedTooltipButton = null; private static ConfigEntry _controllerFavoriteModifierButton = null; private static ConfigEntry _controllerClearCraftingFavoritesButton = null; private static ConfigEntry _controllerHotbarSwitchButton = null; private static ConfigEntry _controllerContainerRestockButton = null; private static ConfigEntry[] _controllerQuickSlotButtons = null; private static ConfigEntry _favoriteModifierKey = null; private static ConfigEntry[] _quickSlotHotkeys = null; private static YamlRoot _yamlConfig = new YamlRoot(); private const string ContainerActionSuccessFxPrefabName = "fx_HildirChest_Unlock"; private const int ContainerActionSuccessFxMaxMode = 12; private static readonly Dictionary SfxVolumeMembersByType = new Dictionary(); private const float ControllerHotkeyCaptureSeconds = 8f; private static readonly HashSet ExpandedControllerHotkeyPresetDrawers = new HashSet(); private static string _controllerHotkeyCaptureEntryKey = ""; private static float _controllerHotkeyCaptureEndTime; private static readonly ControllerActionOption[] ControllerActionOptions = new ControllerActionOption[21] { new ControllerActionOption(ControllerHotkeyAction.Off, "Off"), new ControllerActionOption(ControllerHotkeyAction.JoyButtonA, "A"), new ControllerActionOption(ControllerHotkeyAction.JoyButtonB, "B"), new ControllerActionOption(ControllerHotkeyAction.JoyButtonX, "X"), new ControllerActionOption(ControllerHotkeyAction.JoyButtonY, "Y"), new ControllerActionOption(ControllerHotkeyAction.JoyLBumper, "LB"), new ControllerActionOption(ControllerHotkeyAction.JoyRBumper, "RB"), new ControllerActionOption(ControllerHotkeyAction.JoyLTrigger, "LT"), new ControllerActionOption(ControllerHotkeyAction.JoyRTrigger, "RT"), new ControllerActionOption(ControllerHotkeyAction.JoyBack, "Back"), new ControllerActionOption(ControllerHotkeyAction.JoyStart, "Start"), new ControllerActionOption(ControllerHotkeyAction.JoyLStick, "L Stick"), new ControllerActionOption(ControllerHotkeyAction.JoyRStick, "R Stick"), new ControllerActionOption(ControllerHotkeyAction.JoyDPadUp, "DPad Up"), new ControllerActionOption(ControllerHotkeyAction.JoyDPadDown, "DPad Down"), new ControllerActionOption(ControllerHotkeyAction.JoyDPadLeft, "DPad Left"), new ControllerActionOption(ControllerHotkeyAction.JoyDPadRight, "DPad Right"), new ControllerActionOption(ControllerHotkeyAction.JoyHotbarUse, "Hotbar Use"), new ControllerActionOption(ControllerHotkeyAction.JoyAltKeys, "Alt Keys"), new ControllerActionOption(ControllerHotkeyAction.AltPlace, "Alt Place"), new ControllerActionOption(ControllerHotkeyAction.JoyUse, "Use") }; private static readonly Dictionary UnityJoystickButtonToControllerAction = new Dictionary { [0] = ControllerHotkeyAction.JoyButtonA, [1] = ControllerHotkeyAction.JoyButtonB, [2] = ControllerHotkeyAction.JoyButtonX, [3] = ControllerHotkeyAction.JoyButtonY, [4] = ControllerHotkeyAction.JoyLBumper, [5] = ControllerHotkeyAction.JoyRBumper, [6] = ControllerHotkeyAction.JoyBack, [7] = ControllerHotkeyAction.JoyStart, [8] = ControllerHotkeyAction.JoyLStick, [9] = ControllerHotkeyAction.JoyRStick, [10] = ControllerHotkeyAction.JoyDPadLeft, [11] = ControllerHotkeyAction.JoyDPadRight, [12] = ControllerHotkeyAction.JoyDPadUp, [13] = ControllerHotkeyAction.JoyDPadDown, [14] = ControllerHotkeyAction.JoyLTrigger, [15] = ControllerHotkeyAction.JoyRTrigger, [16] = ControllerHotkeyAction.JoyButtonA, [17] = ControllerHotkeyAction.JoyButtonB, [18] = ControllerHotkeyAction.JoyButtonX, [19] = ControllerHotkeyAction.JoyButtonY }; private static readonly List CustomEquippedItemsCache = new List(); private static readonly Dictionary CustomEquipmentSetCountCache = new Dictionary(StringComparer.Ordinal); private static Player? _customEquipmentCachePlayer; private static Inventory? _customEquipmentCacheInventory; private static string _customEquipmentCachePlayerId = ""; private static int _customEquipmentCacheVersion; private static int _customEquipmentCacheBuiltVersion = -1; private static float _customEquipmentCacheWeight; private static float _customEquipmentCacheEitrRegen; private static float _customEquipmentCacheArmor; private static float[]? _customEquipmentModifierValuesCache; private const string CustomEquipmentVisualItemZdoPrefix = "InventorySlots_CustomEquipmentVisual_Item_"; private const string CustomEquipmentVisualVariantZdoPrefix = "InventorySlots_CustomEquipmentVisual_Variant_"; private static ConfigEntry _craftingRecipeGridSize = null; private static ConfigEntry _craftingRecipeGridZoomModifier = null; private static ConfigEntry _craftingClearFavoritesKey = null; private static ConfigEntry _showCraftingRecipeGridZoomHint = null; private static ConfigEntry _craftingRecipeSortMode = null; private static ConfigEntry _craftingRecipeCraftableBackgroundColor = null; private const string CraftingRecipeGridName = "InventorySlots_CraftingRecipeGrid"; private const string CraftingPinnedTooltipNamePrefix = "InventorySlots_CraftingPinnedTooltip_"; private const string CraftingGemIconRowName = "InventorySlots_CraftingGemIconRow"; private const string CraftingTooltipRecipeOverlayName = "InventorySlots_CraftingTooltipRecipeOverlay"; private const string CraftingCountInputName = "InventorySlots_CraftingCountInput"; private const string CraftingUpgradeProgressionName = "InventorySlots_CraftingUpgradeProgression"; private const string CraftingSearchInputName = "InventorySlots_CraftingSearchInput"; private const string CraftingSortModeButtonGroupName = "InventorySlots_CraftingSortModeButtons"; private const string CraftingGroupFirstSortButtonName = "InventorySlots_CraftingGroupFirstSortButton"; private const string CraftingTierFirstSortButtonName = "InventorySlots_CraftingTierFirstSortButton"; private const string CraftingRecipeScrollbarName = "InventorySlots_CraftingRecipeScrollbar"; private const string CraftingControlsBackgroundName = "InventorySlots_CraftingControlsBackground"; private const string CraftingGroupRailName = "InventorySlots_CraftingGroupRail"; private const string CraftingGroupPanelNamePrefix = "InventorySlots_CraftingGroupPanel_"; private const string CraftingGroupButtonNamePrefix = "InventorySlots_CraftingGroupButton_"; private const string CraftingRecipeGridCellNamePrefix = "InventorySlots_CraftingRecipeCell_"; private const string CraftingRecipeStyleButtonName = "InventorySlots_CraftingRecipeStyleButton"; private const string CraftingCountWheelIconName = "InventorySlots_CraftingCountWheelIcon"; private const string CraftingRequirementSlotNamePrefix = "InventorySlots_CraftingRequirementSlot_"; private const string CraftingRequirementHitboxName = "InventorySlots_CraftingRequirementHitbox"; private const string CraftingRequiredStationHitboxName = "InventorySlots_CraftingRequiredStationHitbox"; private const string CraftingRecipeGridZoomHintName = "InventorySlots_CraftingRecipeGridZoomHint"; private const string CraftingFavoriteBorderName = "InventorySlots_CraftingFavoriteBorder"; private const string CraftingSelectedRecipeBorderName = "InventorySlots_CraftingSelectedRecipeBorder"; private const string CraftingPinnedTooltipMarkerName = "InventorySlots_CraftingPinnedTooltipMarker"; private const string CraftingSocketWarningName = "InventorySlots_CraftingSocketWarning"; private const int CraftingRecipeGridMinDimension = 4; private const int CraftingRecipeGridMaxDimension = 8; private const int CraftingRecipeGridColumns = 8; private const int CraftingRecipeGridRows = 9; private const int CraftingRecipeIconRows = 8; private const int CraftingBottomControlRow = 8; private const int CraftingSocketWarningRow = 9; private const int CraftingVisibleRequirementSlots = 4; private const float CraftingRecipeGridCellSize = 64f; private const float CraftingRecipeGridCellSpace = 72f; private const float CraftingSocketWarningHeight = 58f; private const float CraftingRecipeGridZoomHintFixedSize = 16f; private const float CraftingRecipeGridZoomHintFixedTextIconGap = 16f; private const float CraftingSearchInputWidth = 136f; private const int CraftingTooltipRecipeSlotCount = 5; private const int CraftingQueueMaxCount = 99; private static readonly Vector2 CraftingRecipeGridFixedOffset = new Vector2(0f, -100f); private static readonly Vector2 CraftingRecipeGridZoomHintFixedOffset = new Vector2(256f, -16f); private const float CraftingPanelBottomFixedExtension = 84f; private static readonly Vector2 CraftingRecipeScrollbarFixedOffset = new Vector2(4f, 0f); private static readonly Vector2 CraftingGroupRailFixedOffset = new Vector2(-66f, -96f); private const float CraftingGroupIconBlockFixedSize = 60f; private const float CraftingGroupIconFixedPadding = 3f; private static readonly Vector2 CraftingSearchInputFixedOffset = new Vector2(0f, 3f); private const float CraftingSortModeButtonGap = 4f; private static readonly Vector2 CraftingSortModeButtonsFixedOffset = new Vector2(0f, 4f); private static readonly Vector2 CraftingBottomControlsFixedOffset = new Vector2(0f, 8f); private static readonly Vector2 CraftingCraftButtonFixedOffset = new Vector2(0f, -4f); private static readonly Vector2 CraftingCountInputFixedOffset = new Vector2(0f, -4f); private static readonly Color CraftingRecipeUnavailableBackgroundColor = new Color(0.055f, 0.035f, 0.025f, 0.42f); private static readonly Color CraftingRecipeDefaultCraftableBackgroundColor = new Color(1f, 0.58f, 0.16f, 0.44f); private static readonly Color CraftingRecipeSelectedBackgroundColor = new Color(0.42f, 0.68f, 0.92f, 0.62f); private static Sprite? _craftingFavoriteGroupIcon; private const float CraftingRequirementAvailabilityCacheSeconds = 0.25f; private static readonly CraftingRecipeRuntimeState CraftingRecipes = new CraftingRecipeRuntimeState(); private static readonly CraftingRequirementRuntimeState CraftingRequirements = new CraftingRequirementRuntimeState(); private static readonly CraftingGridRuntimeState CraftingGrid = new CraftingGridRuntimeState(); private static readonly CraftingScrollbarRuntimeState CraftingScrollbar = new CraftingScrollbarRuntimeState(); private static readonly CraftingQueueRuntimeState CraftingQueue = new CraftingQueueRuntimeState(); private static readonly CraftingUiRuntimeState CraftingUi = new CraftingUiRuntimeState(); private static readonly Dictionary CraftingVanillaPanelBackgroundStates = new Dictionary(); private static readonly Dictionary CraftingPanelResizeProtectedSnapshots = new Dictionary(); private static readonly List CraftingRecipeGroupFilters = CreateCraftingRecipeGroupFilters(); private static readonly HashSet FavoriteCraftingRecipeKeys = new HashSet(StringComparer.OrdinalIgnoreCase); private static readonly HashSet FavoriteUpgradeItemKeys = new HashSet(StringComparer.OrdinalIgnoreCase); private static RectTransform? _craftingGroupRail; private static TMP_InputField? _craftingCountInput; private static RectTransform? _craftingCountInputRect; private static RectTransform? _craftingCountInputViewport; private static RectTransform? _craftingUpgradeProgressionRect; private static TMP_Text? _craftingUpgradeProgressionText; private static RectTransform? _craftingSortModeButtonGroup; private static RectTransform? _craftingControlsBackground; private static RectTransform? _craftingSocketWarningRect; private static TMP_Text? _craftingSocketWarningText; private static Transform? _craftingRequiredStationLevelOriginalRoot; private static RectTransform? _craftingRequiredStationLevelHitbox; private static RectTransformSnapshot? _craftingPanelRootSnapshot; private static Vector2 _craftingPanelOriginalSizeDelta; private static bool _craftingRedesignApplied; private static bool _craftingRecipeViewDirty = true; private static bool _craftingGroupRailDirty = true; private static bool _craftingBottomControlsDirty = true; private static bool _craftingVanillaRecipeElementsHidden; private static bool _craftingVanillaDetailHidden; private static bool _craftingVanillaRecipeScrollbarsHidden; private static bool _craftingVanillaPanelBackgroundsHidden; private static bool _craftingEnglishLocalizationIndexBuilt; private static int _lastCraftingSelectedVariant = -1; private static int _craftingRecipeVariantVersion; private static int _craftingFavoritesVersion; private static int _craftingGroupAvailabilityVersion; private static int _craftingGroupAvailabilityBuiltVersion = -1; private static int _uiLocalizationVersion; private static string _loadedCraftingFavoritesPlayerId = ""; private static string _selectedCraftingGroupId = ""; private static string _craftingSearchQuery = ""; private static string _craftingRecipeViewSignature = ""; private static string _craftingGroupRailSignature = ""; private static string _craftingGroupAvailabilitySignature = ""; private static string _craftingGroupAvailabilityContextSignature = ""; private static string _craftingSelectableGroupFilterIdsSignature = ""; private static string _craftingPanelExtensionSignature = ""; private static string _craftingBottomControlsSignature = ""; private static string _craftingSocketWarningSignature = ""; private static string _craftingSortModeButtonsSignature = ""; private static string _craftingFrameFastPathSignature = ""; private static string _craftingRecipeListChangeSignature = ""; private static string _craftingSelectedRecipeChangeSignature = ""; private static string _pendingUpgradeFavoriteItemId = ""; private static string _pendingUpgradeFavoritePrefab = ""; private static int _pendingUpgradeFavoriteQuality = -1; private static int _pendingUpgradeFavoriteVariant = -1; private static int _visibleRecycleNReclaimTabFrame = -1; private static int _visibleRecycleNReclaimTabGuiId = -1; private static Vector2i _pendingUpgradeFavoriteGridPos = new Vector2i(-1, -1); private static bool _visibleRecycleNReclaimTabValue; private static Recipe? _lastCraftingSelectedRecipe; private static object? _craftingGroupAvailabilityRecipeListRef; private static int _craftingGroupAvailabilityRecipeCount = -1; private const float CraftingHoverRecipeOverlayBottomPadding = 6f; private const float CraftingHoverTooltipScrollbarWidth = 3f; private const float CraftingHoverTooltipScrollbarOutsideOffset = 2f; private const float CraftingHoverTooltipScrollSensitivity = 96f; private const float CraftingHoverTooltipMinBodyHeight = 80f; private const float CraftingHoverTooltipMaxPanelHeight = 720f; private static bool? _epicLootLoaded; private static int _epicLootInventoryGridTooltipUiPatchScope; private static GameObject? _epicLootSuppressedOnHoverTooltip; private static bool _epicLootComparisonTooltipReflectionResolved; private static FieldInfo? _epicLootComparisonTooltipField; private static FieldInfo? _epicLootComparisonAddedField; private const int MaxItemClassifierCacheItems = 2048; private static readonly ItemClassifierRuntimeState ItemClassifierRuntime = new ItemClassifierRuntimeState(); private const string JewelcraftingGemcutterStationPrefabName = "op_transmution_table"; private const float InventoryPinnedJewelcraftingScrollGap = 12f; private const float InventoryPinnedJewelcraftingRowPadding = 12f; private const float InventoryPinnedJewelcraftingIconGap = 8f; private const float InventoryPinnedJewelcraftingNativeIconSize = 42f; private const float InventoryPinnedJewelcraftingNativeIconInset = 4f; private const float InventoryPinnedJewelcraftingNativeRowGap = 10f; private const float InventoryPinnedJewelcraftingNativeInteractGap = 8f; private const float InventoryPinnedJewelcraftingNativeTextPadding = 4f; private const float InventoryPinnedJewelcraftingNativeBottomPadding = 32f; private static CustomSyncedValue _syncedYaml = null; private static FileSystemWatcher? _yamlWatcher; private static readonly object YamlReloadLock = new object(); private static readonly InventoryPanelRuntimeState InventoryPanels = new InventoryPanelRuntimeState(); private static readonly InventorySafetyRuntimeState InventorySafety = new InventorySafetyRuntimeState(); private static readonly InventoryContainerRuntimeState InventoryContainers = new InventoryContainerRuntimeState(); private static readonly InventoryDefinitionRuntimeState InventoryDefinitions = new InventoryDefinitionRuntimeState(); private static readonly InventoryClientRuntimeState InventoryClient = new InventoryClientRuntimeState(); private static readonly EquipmentVisualRuntimeState EquipmentVisuals = new EquipmentVisualRuntimeState(); private static readonly InventorySortRuntimeState InventorySort = new InventorySortRuntimeState(); private static readonly string[] PlayerStatPanelExtraNames = new string[2] { "Jewelcrafting Synergy", "Trash" }; private static readonly string[] QuickStackStoreMiniButtonNames = new string[4] { "sortInventoryButton", "restockAreaButton", "quickStackAreaButton", "favoritingTogglingButton" }; private float _nextRefreshTime; private float _nextLightAuditTime; private float _nextHeavyAuditTime; private static bool _yamlReloadQueued; private static DateTime _yamlReloadAfterUtc; private const float MyLittleUICraftingObjectScanInterval = 0.5f; private static readonly string[] MyLittleUIConflictingPatchTypeNames = new string[19] { "MyLittleUI.CraftFilter+StoreGui_Awake_InitializePanel", "MyLittleUI.CraftFilter+InventoryGui_Show_ClearCache", "MyLittleUI.CraftFilter+InventoryGui_OnDestroy_ClearCache", "MyLittleUI.CraftFilter+Chat_HasFocus_FocusOverride", "MyLittleUI.CraftFilter+Player_GetAvailableRecipes_FilterRecipeList", "MyLittleUI.CraftFilter+InventoryGui_UpdateRecipe_HandleFieldFocus", "MyLittleUI.CraftSort+Game_SpawnPlayer_InitializePanel", "MyLittleUI.CraftSort+InventoryGui_Update_SortingPanelVisibility", "MyLittleUI.CraftSort+InventoryGui_UpdateCraftingPanel_HideWithOtherMods", "MyLittleUI.CraftSort+InventoryGui_Update_HideWithOtherMods", "MyLittleUI.CraftSort+InventoryGui_UpdateRecipeList_FilteringAndSorting", "MyLittleUI.CraftSort+InventoryGui_Update_GamepadControls", "MyLittleUI.MultiCraft+InventoryGui_UpdateRecipe_MulticraftShowButtons", "MyLittleUI.MultiCraft+InventoryGui_Awake_MulticraftCreateButtons", "MyLittleUI.MultiCraft+InventoryGui_SetRecipe_ResetMulticraftAfterRecipeChange", "MyLittleUI.Crafting.CraftNew+InventoryGui_UpdateRecipeList_CraftNewRecipeMark", "MyLittleUI.MyLittleUI+InventoryGui_SetupRequirement_AddAvailableAmount", "MyLittleUI.ItemTooltip+ItemDropItemData_GetTooltip_ItemTooltip", "MyLittleUI.ItemTooltip+InventoryGui_Awake_ItemTooltipCraftingFontSize" }; private static readonly string[] MyLittleUICraftingObjectNames = new string[3] { "MLUI_FilterField", "MLUI_SortingPanels", "MLUI_Multicraft" }; private static readonly string[] MyLittleUICraftingObjectPrefixes = new string[2] { "MLUI_SortingPanel_", "selected (MLUI_SortingPanel_" }; private static readonly List CachedMyLittleUICraftingObjects = new List(); private static int _myLittleUICraftingObjectRootSignature; private static float _nextMyLittleUICraftingObjectScanTime; private static bool _myLittleUIInventoryVisibleLastFrame; private static bool _myLittleUIPluginPresenceResolved; private static bool _myLittleUIPluginDetected; private static bool _myLittleUICraftingSuppressionActive; private static string _myLittleUICraftingSuppressionSignature = ""; private static readonly Stack InventoryAddItemDataStackLookupItems = new Stack(); private static readonly Dictionary LoadPreservationInventoryDepth = new Dictionary(); private const float InventoryHoverTooltipWidth = 410f; private const float InventoryHoverTooltipPadding = 8f; private const float InventoryHoverTooltipTopicGap = 6f; private const float InventoryHoverTooltipScrollbarWidth = 3f; private const float InventoryHoverTooltipScrollbarOutsideOffset = 2f; private const float InventoryHoverTooltipScrollSensitivity = 120f; private const float InventoryHoverTooltipMinBodyHeight = 80f; private const float InventoryHoverTooltipMaxPanelHeight = 720f; private const float InventoryHoverTooltipScrollbarThresholdHeight = 600f; private const int InventoryHoverTooltipSourceCacheLimit = 64; private static readonly InventoryHoverTooltipRuntimeState InventoryHoverTooltipRuntime = new InventoryHoverTooltipRuntimeState(); private const float InventoryTrashPanelGap = 8f; private const string InventoryTrashButtonName = "InventorySlots_TrashButton"; private const string InventoryTrashIconName = "InventorySlots_TrashIcon"; private const string InventoryTrashConfirmDialogName = "InventorySlots_TrashConfirmDialog"; private static RectTransform? _inventoryTrashPanel; private static Sprite? _inventoryTrashIconSprite; private static GameObject? _inventoryTrashConfirmDialog; private static Inventory? _inventoryTrashPendingInventory; private static ItemData? _inventoryTrashPendingItem; private static int _inventoryTrashPendingAmount; private static string QuickSlotProgressionCachePlayerId = ""; private static int QuickSlotProgressionCachedRows; private static readonly Dictionary PlayerInventoryPanelBackgroundSnapshots = new Dictionary(StringComparer.Ordinal); private const float PinnedTooltipScrollbarWidth = 3f; private const float PinnedTooltipScrollbarOutsideOffset = 2f; private const float PinnedTooltipDebugInterval = 0.75f; private const float PinnedTooltipScrollSensitivity = 240f; private const float CraftingPinnedTooltipTextScrollPadding = 0f; private const float PinnedTooltipScrollOverflowThreshold = 8f; private const float PinnedTooltipTopOffset = -12f; private const float PinnedTooltipBottomOffset = 60f; private const float PinnedTooltipInventoryStartOffset = 6f; private const float PinnedTooltipCraftingStartOffset = -80f; private static readonly List RestockTargetLimitEditorRows = new List(); private static string _restockTargetLimitEditorLastValue = ""; private const string RecycleNReclaimCompatibilityCapability = "Recycle_N_Reclaim reclaim tab"; private const float RecycleNReclaimSignatureCacheSeconds = 0.1f; private static int _recycleNReclaimActiveFrame = -1; private static bool _recycleNReclaimActiveFrameValue; private static float _recycleNReclaimContextSignatureExpiresAt; private static string _recycleNReclaimContextSignature = ""; private const string RecycleNReclaimHudName = "InventorySlots_RecycleNReclaimHud"; private const int RecycleNReclaimYieldColumn = 2; private const int RecycleNReclaimYieldColumns = 6; private static readonly List RecycleNReclaimHudImpediments = new List(); private static readonly List RecycleNReclaimHudYields = new List(); private static RectTransform? _recycleNReclaimHudRect; private static TMP_Text? _recycleNReclaimHudText; private static string _recycleNReclaimHudSignature = ""; private static object? _recycleNReclaimRecipeListSignatureListRef; private static int _recycleNReclaimRecipeListSignatureCount = -1; private static float _recycleNReclaimRecipeListSignatureExpiresAt; private static string _recycleNReclaimRecipeListSignature = ""; private const int BaseRows = 4; private const int InventoryWidth = 8; private const int MaxSupportedExtraRows = 5; private const int MaxSupportedQuickSlots = 9; private const string SlotIdKey = "InventorySlotsSlotId"; private const string EquippedByKey = "InventorySlotsEquippedBy"; private const string BackupKey = "InventorySlotsBackup"; private const string UpgradeFavoriteItemIdKey = "InventorySlotsUpgradeFavoriteId"; private const string ExtraSlotsEquippedByKey = "ExtraSlotsEquippedBy"; private const string ExtraSlotsEquippedSlotKey = "ExtraSlotsEquippedSlot"; private const string ExtraSlotsEquippedWeaponShieldKey = "ExtraSlotsEquippedWeaponShield"; private const string JewelcraftingRingSlotId = "jewelcrafting.ring"; private const string JewelcraftingNecklaceSlotId = "jewelcrafting.necklace"; private const string AdventureBackpackSlotId = "adventurebackpacks.backpack"; private const string SmoothbrainBackpackSlotId = "smoothbrainbackpacks.backpack"; private const string RustyBagSlotId = "rustybags.bag"; private const string RustyQuiverSlotId = "rustybags.quiver"; private const string MagicSupremacyBeltSlotId = "magicsupremacy.belt"; private const string MagicSupremacyNativeBeltSlotId = "belt"; private const string MultiUserChestIgnoreZdoKey = "MUC_Ignore"; private const string YamlFileName = "InventorySlots.yml"; private const string ClientStateFileName = "InventorySlots.Client.yml"; private const string CustomSlotPanelName = "InventorySlots_CustomSlotPanel"; private const string QuickSlotPanelName = "InventorySlots_QuickSlotPanel"; private const string SlotPanelDragBorderName = "InventorySlots_DragBorder"; private const string PlayerStatPanelHostName = "InventorySlots_PlayerStatPanelHost"; private const string InventorySortPanelName = "InventorySlots_InventorySortPanel"; private const string InventoryTrashPanelName = "InventorySlots_TrashPanel"; private const string CurrencyPocketPanelName = "CoinPocketUI"; private const int CurrencyPocketInventoryRow = 4; private const float CurrencyPocketOutsideGap = 6f; private const string QuickSlotsHotkeyBarName = "InventorySlots_QuickSlotsHotKeyBar"; private const string FavoriteKeyHintName = "InventorySlots_FavoriteKeyHint"; private const string PinnedTooltipKeyHintName = "InventorySlots_PinnedTooltipKeyHint"; private const string InventoryPinnedTooltipNamePrefix = "InventorySlots_InventoryPinnedTooltip_"; private const string InventoryPinnedJewelcraftingTooltipRootName = "InventorySlots_JewelcraftingTooltipRoot"; private const string InventoryPinnedTooltipMarkerName = "InventorySlots_PinnedTooltipMarker"; private const string FavoriteBorderName = "InventorySlots_FavoriteBorder"; private const float FavoriteBorderThickness = 2f; private const float QuickSlotsHudSlotBackgroundAlpha = 0.25f; private const string RpcRequestSort = "InventorySlots_RequestSort"; private const int CustomSlotPanelRows = 3; private const int QuickSlotPanelColumns = 3; private const int QuickSlotPanelRows = 3; private const float EquipmentPanelGapRows = 0.35f; private const float SidePanelGapColumns = 1.45f; private const float SidePanelBackgroundPadding = 16f; private const float PlayerStatPanelGap = -8f; private const int HotbarRowsToSwitch = 2; private static readonly bool LeaveEmptyFavoriteSlots = false; private static readonly bool TombstoneSafeguardsEnabled = true; private const float ContainerActionPairButtonWidthMultiplier = 1f; private const float SortButtonOutsideGap = 1f; private const float QuickSlotPanelIntroFallbackDuration = 0.25f; private const float ContainerRestockHoldDuration = 0.5f; private const int PinnedTooltipSlotCount = 3; private const float PinnedTooltipFixedPanelGap = 15f; private static readonly bool SlotBackupEnabled = true; private static readonly bool PeriodicInventorySafetyAuditEnabled = true; private const float InventoryMaintenanceInterval = 1f; private const float LightSafetyAuditInterval = 5f; private const float HeavySafetyAuditInterval = 30f; private const int MaxInventoryStateAuditPasses = 3; private const float PendingSlotActionTimeout = 30f; private const float InventoryPinnedJewelcraftingReservedHeight = 190f; private const string ProgressiveSlotsConfigSection = "2 - Progressive Slots"; private const string ClientConfigSection = "3 - Client"; private const string ClientKeysConfigSection = "4 - Client Keys"; private const string RestockConfigSection = "5 - Restock"; private const string ControllerInputConfigSection = "6 - Controller Input"; private static readonly Vector2 HotbarSwitchHintOffset = new Vector2(-50f, -32f); private static readonly Color HotbarSwitchHintColor = new Color(58f / 85f, 0.8784314f, 1f, 1f); private const float HotbarSwitchHintSize = 64f; private const float HotbarSwitchHintFontSize = 16f; private static readonly Vector2 InventoryWheelHintOffset = new Vector2(0f, -32f); private static readonly Color InventoryWheelHintColor = new Color(58f / 85f, 0.8784314f, 1f, 1f); private const float InventoryWheelHintSize = 0f; private static readonly Vector2 PinnedTooltipFixedPanelSize = new Vector2(345f, 600f); private static readonly Vector2 InventoryPinnedTooltipFixedOffset = new Vector2(828f, -384f); private static readonly Vector2 CraftingPinnedTooltipFixedOffset = new Vector2(-900f, 0f); private static readonly Vector2 QuickSlotsPanelFixedOffset = new Vector2(-80f, -552f); private static readonly Vector2 QuickSlotsHudFallbackPosition = new Vector2(64f, -520f); private static readonly Vector2 EquipmentSlotsPanelFixedOffset = new Vector2(-80f, 0f); private static readonly Vector2 PlayerStatPanelsFixedOffset = Vector2.zero; private static readonly Vector2 ArmorPanelFixedOffset = new Vector2(-5f, 15f); private static readonly Vector2 WeightPanelFixedOffset = new Vector2(-5f, -5f); private static readonly Vector2 SynergyPanelFixedOffset = new Vector2(-5f, -25f); private static readonly Vector2 InventorySortButtonFixedOffset = new Vector2(2f, 2f); private static readonly Vector2 ContainerSortButtonFixedOffset = Vector2.zero; private const float ContainerWeightPanelFixedYOffset = 200f; internal static readonly ManualLogSource Log = Logger.CreateLogSource("InventorySlots"); private readonly Harmony _harmony = new Harmony("sighsorry.InventorySlots"); private static InventorySlotsPlugin _instance = null; internal const string ModName = "InventorySlots"; internal const string ModVersion = "1.0.4"; internal const string Author = "sighsorry"; internal const string ModGUID = "sighsorry.InventorySlots"; internal static string ConnectionError = ""; private static readonly List StationTokenCookingStations = new List(); private static readonly List StationTokenFermenters = new List(); private static readonly Dictionary VanillaTooltipVisualSnapshots = new Dictionary(); private static readonly Dictionary VanillaTooltipChildCanvasGroupSnapshots = new Dictionary(); private static readonly PinnedTooltipRuntimeState PinnedTooltips = new PinnedTooltipRuntimeState(); private static readonly TooltipUiRuntimeState TooltipUi = new TooltipUiRuntimeState(); private static float _nextGamepadUiScrollStepTime; private static bool HasServerCharactersActive { get { if (!ZNet.IsSinglePlayer) { return HasPlugin("org.bepinex.plugins.servercharacters"); } return false; } } private static bool HasMultiUserChestActive => HasPlugin("com.maxsch.valheim.MultiUserChest"); private static bool HasJewelcraftingActive => HasPlugin("org.bepinex.plugins.jewelcrafting"); private static RectTransform? _craftingRecipeGrid { get { return CraftingGrid.RecipeGrid; } set { CraftingGrid.RecipeGrid = value; } } private static RectTransform? _craftingRecipeScrollbar { get { return CraftingScrollbar.RecipeScrollbar; } set { CraftingScrollbar.RecipeScrollbar = value; } } private static Scrollbar? _craftingRecipeScrollbarComponent { get { return CraftingScrollbar.RecipeScrollbarComponent; } set { CraftingScrollbar.RecipeScrollbarComponent = value; } } private static bool _continuingCraftingQueue { get { return CraftingQueue.ContinuingQueue; } set { CraftingQueue.ContinuingQueue = value; } } private static bool _updatingCraftingRecipeScrollbar { get { return CraftingScrollbar.UpdatingRecipeScrollbar; } set { CraftingScrollbar.UpdatingRecipeScrollbar = value; } } private static bool _craftingRecipeGridDirty { get { return CraftingGrid.RecipeGridDirty; } set { CraftingGrid.RecipeGridDirty = value; } } private static bool _craftingRecipeScrollbarDirty { get { return CraftingScrollbar.RecipeScrollbarDirty; } set { CraftingScrollbar.RecipeScrollbarDirty = value; } } private static int _craftingRecipePage { get { return CraftingGrid.RecipePage; } set { CraftingGrid.RecipePage = value; } } private static int _craftingQueueTotal { get { return CraftingQueue.QueueTotal; } set { CraftingQueue.QueueTotal = value; } } private static int _craftingQueueRemaining { get { return CraftingQueue.QueueRemaining; } set { CraftingQueue.QueueRemaining = value; } } private static int _craftingQueueVariant { get { return CraftingQueue.QueueVariant; } set { CraftingQueue.QueueVariant = value; } } private static int _craftingProgressLabelCount { get { return CraftingQueue.ProgressLabelCount; } set { CraftingQueue.ProgressLabelCount = value; } } private static int _craftingProgressLabelVariant { get { return CraftingQueue.ProgressLabelVariant; } set { CraftingQueue.ProgressLabelVariant = value; } } private static string _craftingRecipeGridSignature { get { return CraftingGrid.RecipeGridSignature; } set { CraftingGrid.RecipeGridSignature = value; } } private static string _craftingRecipeScrollbarSignature { get { return CraftingScrollbar.RecipeScrollbarSignature; } set { CraftingScrollbar.RecipeScrollbarSignature = value; } } private static string _craftingRecipeGridLayoutSignature { get { return CraftingGrid.RecipeGridLayoutSignature; } set { CraftingGrid.RecipeGridLayoutSignature = value; } } private static int _craftingRecipeGridCellCapacity { get { return CraftingGrid.RecipeGridCellCapacity; } set { CraftingGrid.RecipeGridCellCapacity = value; } } private static Recipe? _craftingQueueRecipe { get { return CraftingQueue.QueueRecipe; } set { CraftingQueue.QueueRecipe = value; } } private static Recipe? _craftingProgressLabelRecipe { get { return CraftingQueue.ProgressLabelRecipe; } set { CraftingQueue.ProgressLabelRecipe = value; } } private static List SlotDefinitions => InventoryDefinitions.SlotDefinitions; private static List CustomPanelSlotCache => InventoryDefinitions.CustomPanelSlotCache; private static List QuickPanelSlotCache => InventoryDefinitions.QuickPanelSlotCache; private static Dictionary QuickSlotDefinitionCache => InventoryDefinitions.QuickSlotDefinitionCache; private static Dictionary PredefinedGroupDefinitions => InventoryDefinitions.PredefinedGroupDefinitions; private static List PredefinedGroupOrder => InventoryDefinitions.PredefinedGroupOrder; private static Dictionary> PredefinedGroupOrders => InventoryDefinitions.PredefinedGroupOrders; private static Dictionary ResourceTierByToken => InventoryDefinitions.ResourceTierByToken; private static HashSet CookingStationInputTokens => InventoryDefinitions.CookingStationInputTokens; private static HashSet CraftingRecipeFoodInputTokens => InventoryDefinitions.CraftingRecipeFoodInputTokens; private static HashSet CraftingRecipeHealthFoodInputTokens => InventoryDefinitions.CraftingRecipeHealthFoodInputTokens; private static HashSet CraftingRecipeStaminaFoodInputTokens => InventoryDefinitions.CraftingRecipeStaminaFoodInputTokens; private static HashSet CraftingRecipeEitrFoodInputTokens => InventoryDefinitions.CraftingRecipeEitrFoodInputTokens; private static HashSet CookingStationFoodInputTokens => InventoryDefinitions.CookingStationFoodInputTokens; private static HashSet CookingStationHealthFoodInputTokens => InventoryDefinitions.CookingStationHealthFoodInputTokens; private static HashSet CookingStationStaminaFoodInputTokens => InventoryDefinitions.CookingStationStaminaFoodInputTokens; private static HashSet CookingStationEitrFoodInputTokens => InventoryDefinitions.CookingStationEitrFoodInputTokens; private static HashSet FermenterInputTokens => InventoryDefinitions.FermenterInputTokens; private static HashSet FermenterOutputTokens => InventoryDefinitions.FermenterOutputTokens; private static HashSet FermenterFoodInputTokens => InventoryDefinitions.FermenterFoodInputTokens; private static HashSet FermenterHealthFoodInputTokens => InventoryDefinitions.FermenterHealthFoodInputTokens; private static HashSet FermenterStaminaFoodInputTokens => InventoryDefinitions.FermenterStaminaFoodInputTokens; private static HashSet FermenterEitrFoodInputTokens => InventoryDefinitions.FermenterEitrFoodInputTokens; private static Dictionary ItemNameTokens => InventoryDefinitions.ItemNameTokens; private static Dictionary RestockTargetStackLimits { get { return InventoryDefinitions.RestockTargetStackLimits; } set { InventoryDefinitions.RestockTargetStackLimits = value; } } private static int _slotDefinitionVersion { get { return InventoryDefinitions.SlotDefinitionVersion; } set { InventoryDefinitions.SlotDefinitionVersion = value; } } private static int _customPanelSlotCacheVersion { get { return InventoryDefinitions.CustomPanelSlotCacheVersion; } set { InventoryDefinitions.CustomPanelSlotCacheVersion = value; } } private static int _quickPanelSlotCacheVersion { get { return InventoryDefinitions.QuickPanelSlotCacheVersion; } set { InventoryDefinitions.QuickPanelSlotCacheVersion = value; } } private static int _quickPanelSlotCacheUnlockedCount { get { return InventoryDefinitions.QuickPanelSlotCacheUnlockedCount; } set { InventoryDefinitions.QuickPanelSlotCacheUnlockedCount = value; } } private static int _quickSlotDefinitionCacheVersion { get { return InventoryDefinitions.QuickSlotDefinitionCacheVersion; } set { InventoryDefinitions.QuickSlotDefinitionCacheVersion = value; } } private static int _cachedObjectDbItemCount { get { return InventoryDefinitions.CachedObjectDbItemCount; } set { InventoryDefinitions.CachedObjectDbItemCount = value; } } private static int _cachedStationInputObjectDbItemCount { get { return InventoryDefinitions.CachedStationInputObjectDbItemCount; } set { InventoryDefinitions.CachedStationInputObjectDbItemCount = value; } } private static int _cachedStationInputPrefabCount { get { return InventoryDefinitions.CachedStationInputPrefabCount; } set { InventoryDefinitions.CachedStationInputPrefabCount = value; } } private static int _cachedStationInputRecipeCount { get { return InventoryDefinitions.CachedStationInputRecipeCount; } set { InventoryDefinitions.CachedStationInputRecipeCount = value; } } private static bool _stationInputTokensInitialized { get { return InventoryDefinitions.StationInputTokensInitialized; } set { InventoryDefinitions.StationInputTokensInitialized = value; } } private static bool _clientStateLoaded { get { return InventoryClient.ClientStateLoaded; } set { InventoryClient.ClientStateLoaded = value; } } private static string _loadedFavoritesPlayerId { get { return InventoryClient.LoadedFavoritesPlayerId; } set { InventoryClient.LoadedFavoritesPlayerId = value; } } private static InventorySlotsClientState _clientState { get { return InventoryClient.ClientState; } set { InventoryClient.ClientState = value; } } private static HashSet FavoriteSlots => InventoryClient.FavoriteSlots; internal static bool IsCompletingSlotUnequip => InventorySafety.SlotUnequipInProgress; internal static bool IsHandlingSlotDropOutside => InventorySafety.HandlingSlotDropOutside; internal static IReadOnlyList Slots => SlotDefinitions; private static GameObject? _inventoryHoverTooltip { get { return InventoryHoverTooltipRuntime.HoverTooltip; } set { InventoryHoverTooltipRuntime.HoverTooltip = value; } } private static RectTransform? _inventoryHoverTooltipPanel { get { return InventoryHoverTooltipRuntime.HoverTooltipPanel; } set { InventoryHoverTooltipRuntime.HoverTooltipPanel = value; } } private static TMP_Text? _inventoryHoverTooltipTopic { get { return InventoryHoverTooltipRuntime.HoverTooltipTopic; } set { InventoryHoverTooltipRuntime.HoverTooltipTopic = value; } } private static TMP_Text? _inventoryHoverTooltipText { get { return InventoryHoverTooltipRuntime.HoverTooltipText; } set { InventoryHoverTooltipRuntime.HoverTooltipText = value; } } private static ScrollableTooltipBodyState InventoryHoverTooltipTextScroll => InventoryHoverTooltipRuntime.HoverTooltipTextScroll; private static TooltipSourceCacheCore InventoryHoverTooltipItems => InventoryHoverTooltipRuntime.HoverTooltipItems; private static string _inventoryHoverTooltipSignature { get { return InventoryHoverTooltipRuntime.HoverTooltipSignature; } set { InventoryHoverTooltipRuntime.HoverTooltipSignature = value; } } private static string _inventoryHoverTooltipLayoutSignature { get { return InventoryHoverTooltipRuntime.HoverTooltipLayoutSignature; } set { InventoryHoverTooltipRuntime.HoverTooltipLayoutSignature = value; } } private static float _inventoryHoverTooltipScrollOffset { get { return InventoryHoverTooltipRuntime.HoverTooltipScrollOffset; } set { InventoryHoverTooltipRuntime.HoverTooltipScrollOffset = value; } } private static float _inventoryHoverTooltipMaxScroll { get { return InventoryHoverTooltipRuntime.HoverTooltipMaxScroll; } set { InventoryHoverTooltipRuntime.HoverTooltipMaxScroll = value; } } private static bool _inventoryHoverTooltipNeedsScroll { get { return InventoryHoverTooltipRuntime.HoverTooltipNeedsScroll; } set { InventoryHoverTooltipRuntime.HoverTooltipNeedsScroll = value; } } private static RectTransform? _inventoryHoverJewelcraftingTooltipRoot { get { return InventoryHoverTooltipRuntime.HoverJewelcraftingTooltipRoot; } set { InventoryHoverTooltipRuntime.HoverJewelcraftingTooltipRoot = value; } } private static string _inventoryHoverJewelcraftingTooltipSignature { get { return InventoryHoverTooltipRuntime.HoverJewelcraftingTooltipSignature; } set { InventoryHoverTooltipRuntime.HoverJewelcraftingTooltipSignature = value; } } private static GameObject? _inventorySimpleNameTooltip { get { return InventoryHoverTooltipRuntime.SimpleNameTooltip; } set { InventoryHoverTooltipRuntime.SimpleNameTooltip = value; } } private static RectTransform? _inventorySimpleNameTooltipRect { get { return InventoryHoverTooltipRuntime.SimpleNameTooltipRect; } set { InventoryHoverTooltipRuntime.SimpleNameTooltipRect = value; } } private static TMP_Text? _inventorySimpleNameTooltipText { get { return InventoryHoverTooltipRuntime.SimpleNameTooltipText; } set { InventoryHoverTooltipRuntime.SimpleNameTooltipText = value; } } private static string _inventorySimpleNameTooltipValue { get { return InventoryHoverTooltipRuntime.SimpleNameTooltipValue; } set { InventoryHoverTooltipRuntime.SimpleNameTooltipValue = value; } } private static SimpleNameTooltipPlacement _inventorySimpleNameTooltipPlacement { get { return InventoryHoverTooltipRuntime.SimpleNameTooltipPlacement; } set { InventoryHoverTooltipRuntime.SimpleNameTooltipPlacement = value; } } private static SimpleTooltipOwnershipCore InventorySimpleNameTooltipOwner => InventoryHoverTooltipRuntime.SimpleNameTooltipOwner; private static object InventorySimpleNameTooltipFallbackOwner => InventoryHoverTooltipRuntime.SimpleNameTooltipFallbackOwner; private static object? _pinnedGemNameTooltipOwner { get { return InventoryHoverTooltipRuntime.PinnedGemNameTooltipOwner; } set { InventoryHoverTooltipRuntime.PinnedGemNameTooltipOwner = value; } } private static float _pinnedGemNameTooltipHoldUntil { get { return InventoryHoverTooltipRuntime.PinnedGemNameTooltipHoldUntil; } set { InventoryHoverTooltipRuntime.PinnedGemNameTooltipHoldUntil = value; } } private static UITooltip? _inventoryContainerHoverTooltipSource { get { return InventoryHoverTooltipRuntime.ContainerHoverTooltipSource; } set { InventoryHoverTooltipRuntime.ContainerHoverTooltipSource = value; } } private static UITooltip? _inventorySlotsOwnedHoverTooltipSource { get { return InventoryHoverTooltipRuntime.OwnedHoverTooltipSource; } set { InventoryHoverTooltipRuntime.OwnedHoverTooltipSource = value; } } private static bool _tooltipLateUpdateExceptionLogged { get { return InventoryHoverTooltipRuntime.LateUpdateExceptionLogged; } set { InventoryHoverTooltipRuntime.LateUpdateExceptionLogged = value; } } internal static bool IsDedicatedServer { get { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Invalid comparison between Unknown and I4 if ((int)SystemInfo.graphicsDeviceType != 4) { if (Application.isBatchMode) { return string.Equals(Paths.ProcessName, "valheim_server", StringComparison.OrdinalIgnoreCase); } return false; } return true; } } private static string YamlFilePath => Path.Combine(Paths.ConfigPath, "InventorySlots.yml"); private static string ClientStateFilePath => Path.Combine(Paths.ConfigPath, "InventorySlots.Client.yml"); internal static string DefaultYaml => "# Slot labels and custom equipment slot definitions. The six vanilla equipment\n# slot ids are fixed and only their names can be changed here.\n# Built-in compatibility slot ids are fixed as well; keep the id values unchanged.\n# Compatibility slots are created when the matching mod/API is loaded. Some\n# compatibility slots also support a non-empty items list as a custom fallback.\n# Other ids create custom equipment slots in the listed order.\nSlots:\n - id: helmet\n name: Helmet\n - id: chest\n name: Chest\n - id: legs\n name: Legs\n - id: cape\n name: Cape\n - id: utility\n name: Utility\n - id: trinket\n name: Trinket\n# - id: circlet\n# name: Circlet\n# items:\n# - HelmetDverger\n# - id: wishbone\n# name: Wishbone\n# items:\n# - Wishbone\n# - id: demister\n# name: Demister\n# items:\n# - Demister\n - id: jewelcrafting.necklace\n name: Necklace\n items: []\n - id: jewelcrafting.ring\n name: Ring\n items: []\n - id: smoothbrainbackpacks.backpack\n name: Backpack\n items: []\n - id: adventurebackpacks.backpack\n name: Backpack\n items: []\n - id: rustybags.bag\n name: Bag\n items: []\n - id: rustybags.quiver\n name: Quiver\n items: []\n - id: magicsupremacy.belt\n name: MagicBelt\n items: []\n\n# Item groups control subgroup order for crafting, inventory, and container\n# sorting. Melee/Ranged/Magic/Equipment/Food/Consumable/Meadbase/Misc are\n# fixed top-level sections. Other keys define custom prefab groups, which can be\n# inserted into those sections or referenced by KeepOnDeath and QuickSlots.\nGroups:\n Melee:\n - sword\n - axe\n - club\n - knife\n - spear\n - polearm\n - fists\n - shield\n - pickaxe\n - tool\n Ranged:\n - bow\n - arrow\n - crossbow\n - bolt\n - ammo\n - bomb\n Magic:\n - elementalmagic\n - bloodmagic\n Equipment:\n - helmet\n - chest\n - legs\n - cape\n - utility\n - trinket\n# - customgroup\n Food:\n - healthfood\n - staminafood\n - eitrfood\n# - randomrandom\n Consumable:\n - mead\n - potion\n Meadbase: []\n Misc:\n - trophy\n - valuable\n# customgroup:\n# - customprefab\n# - prefabwhat\n# randomrandom:\n# - randomprefab\n# - prefabprefab\n\n# Items matching these built-in groups, custom groups, or exact prefab/internal\n# names stay in the player inventory instead of moving to the tombstone.\nKeepOnDeath:\n - Melee\n - Ranged\n - Magic\n - Equipment\n\n# Items matching these top-level groups, subgroups, custom groups, or exact\n# prefab/internal names can be placed in quick slots.\nQuickSlots:\n - Melee\n - Ranged\n - Magic\n - healthfood\n - staminafood\n - eitrfood\n - mead\n - potion\n#\n# Resource tier map for crafting recipe sorting. The lowest tier should be\n# listed first by default; InventorySlots sorts higher tiers first in the grid.\nresourceMap:\n - biome: Meadows\n materials:\n - Wood\n - Stone\n - Resin\n - Dandelion\n - Flint\n - LeatherScraps\n - BoneFragments\n - Honey\n - Raspberry\n - Blueberries\n - DeerHide\n - DeerMeat\n - Feathers\n - GreydwarfEye\n - RawMeat\n - biome: BlackForest\n materials:\n - HardAntler\n - Bronze\n - BronzeNails\n - Copper\n - Tin\n - Ectoplasm\n - SurtlingCore\n - TrollHide\n - BjornHide\n - FineWood\n - AncientSeed\n - Carrot\n - BjornMeat\n - BjornPaw\n - RoundLog\n - Thistle\n - biome: Swamp\n materials:\n - Iron\n - Ooze\n - Entrails\n - Guck\n - Bloodbag\n - Chain\n - ElderBark\n - IronNails\n - Root\n - Turnip\n - WitheredBone\n - CuredSquirrelHamstring\n - biome: Ocean\n materials:\n - Chitin\n - Resin\n - SerpentScale\n - SerpentMeat\n - biome: Mountain\n materials:\n - Silver\n - Crystal\n - DragonEgg\n - JuteRed\n - Obsidian\n - WolfClaw\n - WolfFang\n - WolfHairBundle\n - WolfMeat\n - WolfPelt\n - biome: Plains\n materials:\n - UndeadBjornRibcage\n - BlackMetal\n - DragonTear\n - Barley\n - BarleyFlour\n - BoneFragments\n - ChickenEgg\n - ChickenMeat\n - Flax\n - GoblinTotem\n - LinenThread\n - LoxMeat\n - LoxPelt\n - Needle\n - Tar\n - biome: Mistlands\n materials:\n - Eitr\n - Bilebag\n - BlackCore\n - BlackMarble\n - BugMeat\n - Carapace\n - DvergrKeyFragment\n - DvergrNeedle\n - GiantBloodSack\n - HareMeat\n - JuteBlue\n - Mandible\n - Sap\n - ScaleHide\n - Softtissue\n - Wisp\n - YagluthDrop\n - YggdrasilWood\n - biome: AshLands\n materials:\n - FlametalNew\n - AskBladder\n - AskHide\n - AsksvinEgg\n - AsksvinMeat\n - Blackwood\n - BoneMawSerpentMeat\n - BonemawSerpentTooth\n - CelestialFeather\n - CeramicPlate\n - CharcoalResin\n - CharredBone\n - CharredCogwheel\n - Charredskull\n - Grausten\n - MoltenCore\n - MorgenHeart\n - MorgenSinew\n - ProustitePowder\n - SulfurStone\n - VoltureEgg\n - VoltureMeat"; private static int GetAzuCraftyBoxesAvailableCraftingRequirementAmount(Requirement requirement, string sharedName) { Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null || (Object)(object)requirement.m_resItem == (Object)null || !TryGetAzuCraftyBoxesApi(out AzuCraftyBoxesApi api) || api == null || api.ShouldPrevent()) { return 0; } try { IEnumerable nearbyContainers = api.GetNearbyContainers(localPlayer, api.GetRange()); if (nearbyContainers == null) { return 0; } string prefabNameForAzuCraftyBoxes = GetPrefabNameForAzuCraftyBoxes(((Object)requirement.m_resItem).name); bool leaveOne = api.GetLeaveOne(); int num = 0; foreach (object item in nearbyContainers) { if (item == null) { continue; } string text = api.InvokeString(item, "GetPrefabName"); if (!string.IsNullOrWhiteSpace(text) && api.CanItemBePulled(text, prefabNameForAzuCraftyBoxes)) { int num2 = api.InvokeInt(item, "ItemCount", sharedName); if (leaveOne && num2 > 0) { num2--; } if (num2 > 0) { num += num2; } } } return num; } catch (Exception ex) { Log.LogDebug((object)("AzuCraftyBoxes compatibility count failed: " + ex.Message)); return 0; } } private static bool TryGetAzuCraftyBoxesApi(out AzuCraftyBoxesApi? api) { return TryGetCompatApi("Azumatt.AzuCraftyBoxes", "AzuCraftyBoxes", CompatRuntime.AzuCraftyBoxes, AzuCraftyBoxesApi.TryCreate, "AzuCraftyBoxes compatibility disabled", out api); } private static bool TryFormatAzuCraftyBoxesRequirementAmount(int available, int required, out string text) { text = ""; if (!TryGetAzuCraftyBoxesApi(out AzuCraftyBoxesApi api) || api == null || api.ShouldPrevent()) { return false; } return api.TryFormatRequirementAmount(available, required, out text); } private static bool TryGetAzuCraftyBoxesRequirementFlashColor(out Color color) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) color = default(Color); if (!TryGetAzuCraftyBoxesApi(out AzuCraftyBoxesApi api) || api == null || api.ShouldPrevent()) { return false; } return api.TryGetRequirementFlashColor(out color); } private static string GetPrefabNameForAzuCraftyBoxes(string name) { if (string.IsNullOrWhiteSpace(name)) { return ""; } int num = name.IndexOfAny(new char[2] { '(', ' ' }); if (num < 0) { return name; } return name.Substring(0, num); } private static void InitializeBackpackCompatibility() { if (!CompatRuntime.AdventureBackpacksPatchesApplied && TryGetAdventureBackpacksApi(out AdventureBackpacksApi api) && api != null) { api.ApplyPatches(_instance._harmony); CompatRuntime.AdventureBackpacksPatchesApplied = true; } TryGetSmoothbrainBackpacksApi(out SmoothbrainBackpacksApi _); TryGetRustyBagsApi(out RustyBagsApi _); } private static bool TryAddBackpackCompatSlot(YamlSlot slot, string id) { return NormalizeSlotId(id) switch { "adventurebackpacks.backpack" => TryAddAdventureBackpackSlot(slot), "smoothbrainbackpacks.backpack" => TryAddSmoothbrainBackpackSlot(slot), "rustybags.bag" => TryAddRustyBagSlot(slot), "rustybags.quiver" => TryAddRustyQuiverSlot(slot), _ => false, }; } private static bool TryAddAdventureBackpackSlot(YamlSlot slot) { AdventureBackpacksApi api; bool hasApi = TryGetAdventureBackpacksApi(out api) && api != null; return TryAddBackpackCompatSlot(slot, "adventurebackpacks.backpack", "Backpack", hasApi, (ItemData? item) => IsAdventureBackpackItem(item)); } private static bool TryAddSmoothbrainBackpackSlot(YamlSlot slot) { SmoothbrainBackpacksApi api; bool hasApi = TryGetSmoothbrainBackpacksApi(out api) && api != null; return TryAddBackpackCompatSlot(slot, "smoothbrainbackpacks.backpack", "Backpack", hasApi, (ItemData? item) => IsSmoothbrainBackpackItem(item)); } private static bool TryAddRustyBagSlot(YamlSlot slot) { RustyBagsApi api; bool hasApi = TryGetRustyBagsApi(out api) && api != null; return TryAddBackpackCompatSlot(slot, "rustybags.bag", "Bag", hasApi, (ItemData? item) => IsRustyBagItem(item)); } private static bool TryAddRustyQuiverSlot(YamlSlot slot) { RustyBagsApi api; bool hasApi = TryGetRustyBagsApi(out api) && api != null; return TryAddBackpackCompatSlot(slot, "rustybags.quiver", "Quiver", hasApi, (ItemData? item) => IsRustyQuiverItem(item)); } private static bool TryAddBackpackCompatSlot(YamlSlot slot, string id, string fallbackName, bool hasApi, Func accepts) { string id2 = id; Func accepts2 = accepts; if (SlotDefinitions.Any((SlotDefinition existing) => existing.Id == id2)) { return true; } List items = GetSlotItems(slot); if (!hasApi && items.Count == 0) { return true; } string name = (string.IsNullOrWhiteSpace(slot.Name) ? fallbackName : slot.Name.Trim()); SlotDefinitions.Add(new SlotDefinition(id2, name, SlotKind.CustomEquipment, (ItemData? item) => accepts2(item) || (items.Count > 0 && ItemMatchesSlotItems(item, items)))); return true; } private static bool IsAdventureBackpackItem(ItemData? item) { if (item != null && TryGetAdventureBackpacksApi(out AdventureBackpacksApi api) && api != null) { return api.IsBackpack(item); } return false; } private static bool IsSmoothbrainBackpackItem(ItemData? item) { if (item != null && TryGetSmoothbrainBackpacksApi(out SmoothbrainBackpacksApi api) && api != null) { return api.IsBackpack(item); } return false; } private static bool IsRustyBagItem(ItemData? item) { if (item != null && TryGetRustyBagsApi(out RustyBagsApi api) && api != null && api.IsBag(item)) { return !api.IsQuiver(item); } return false; } private static bool IsRustyQuiverItem(ItemData? item) { if (item != null && TryGetRustyBagsApi(out RustyBagsApi api) && api != null) { return api.IsQuiver(item); } return false; } private static void SyncBackpackCompatState(Player player) { if (!((Object)(object)player == (Object)null)) { SyncAdventureBackpackCompatState(player); SyncSmoothbrainBackpackCompatState(player); SyncRustyBagsCompatState(player); } } private static void OnCustomEquipmentCompatEquipped(Player player, ItemData item) { if ((Object)(object)player == (Object)null || item == null) { return; } if (IsAdventureBackpackItem(item) && TryGetAdventureBackpacksApi(out AdventureBackpacksApi api) && api != null) { if (CompatRuntime.LastAdventureBackpackCompatItem != item || !api.IsBackpackEquippedFlagSet()) { api.OnCustomBackpackEquipped(player, item); } CompatRuntime.LastAdventureBackpackCompatItem = item; } if (IsSmoothbrainBackpackItem(item) && TryGetSmoothbrainBackpacksApi(out SmoothbrainBackpacksApi api2) && api2 != null) { api2.SyncEquippedBackpack(player, item); CompatRuntime.LastSmoothbrainBackpackCompatItem = item; } if (TryGetRustyBagsApi(out RustyBagsApi api3) && api3 != null) { if (IsRustyBagItem(item)) { api3.SyncBag(player, item); CompatRuntime.LastRustyBagCompatItem = item; } else if (IsRustyQuiverItem(item)) { api3.SyncQuiver(player, item); CompatRuntime.LastRustyQuiverCompatItem = item; } } OnMagicSupremacyBeltEquipped(player, item); } private static void OnCustomEquipmentCompatUnequipping(Player? player, ItemData item) { if (player == null) { player = Player.m_localPlayer; } if ((Object)(object)player == (Object)null || item == null) { return; } if ((CompatRuntime.LastAdventureBackpackCompatItem == item || IsAdventureBackpackItem(item)) && TryGetAdventureBackpacksApi(out AdventureBackpacksApi api) && api != null) { api.OnCustomBackpackUnequipping(player, item); if (CompatRuntime.LastAdventureBackpackCompatItem == item) { CompatRuntime.LastAdventureBackpackCompatItem = null; } } if ((CompatRuntime.LastSmoothbrainBackpackCompatItem == item || IsSmoothbrainBackpackItem(item)) && TryGetSmoothbrainBackpacksApi(out SmoothbrainBackpacksApi api2) && api2 != null) { api2.SyncEquippedBackpack(player, null); if (CompatRuntime.LastSmoothbrainBackpackCompatItem == item) { CompatRuntime.LastSmoothbrainBackpackCompatItem = null; } } if (TryGetRustyBagsApi(out RustyBagsApi api3) && api3 != null) { if (CompatRuntime.LastRustyBagCompatItem == item || IsRustyBagItem(item)) { api3.ClearBagIfCurrent(player, item); if (CompatRuntime.LastRustyBagCompatItem == item) { CompatRuntime.LastRustyBagCompatItem = null; } } if (CompatRuntime.LastRustyQuiverCompatItem == item || IsRustyQuiverItem(item)) { api3.ClearQuiverIfCurrent(player, item); if (CompatRuntime.LastRustyQuiverCompatItem == item) { CompatRuntime.LastRustyQuiverCompatItem = null; } } } OnMagicSupremacyBeltUnequipping(player, item); } private static void SyncAdventureBackpackCompatState(Player player) { if (!TryGetAdventureBackpacksApi(out AdventureBackpacksApi api) || api == null) { CompatRuntime.LastAdventureBackpackCompatItem = null; return; } ItemData val = FindCustomEquippedItem(player, IsAdventureBackpackItem); if (val != CompatRuntime.LastAdventureBackpackCompatItem) { if (CompatRuntime.LastAdventureBackpackCompatItem != null) { api.OnCustomBackpackUnequipping(player, CompatRuntime.LastAdventureBackpackCompatItem); } CompatRuntime.LastAdventureBackpackCompatItem = val; if (val != null) { api.OnCustomBackpackEquipped(player, val); } } else if (val != null && !api.IsBackpackEquippedFlagSet()) { api.OnCustomBackpackEquipped(player, val); } } private static void SyncSmoothbrainBackpackCompatState(Player player) { if (!TryGetSmoothbrainBackpacksApi(out SmoothbrainBackpacksApi api) || api == null) { CompatRuntime.LastSmoothbrainBackpackCompatItem = null; return; } ItemData val = FindCustomEquippedItem(player, IsSmoothbrainBackpackItem); api.SyncEquippedBackpack(player, val); CompatRuntime.LastSmoothbrainBackpackCompatItem = val; } private static void SyncRustyBagsCompatState(Player player) { if (!TryGetRustyBagsApi(out RustyBagsApi api) || api == null) { CompatRuntime.LastRustyBagCompatItem = null; CompatRuntime.LastRustyQuiverCompatItem = null; return; } ItemData val = FindCustomEquippedItem(player, IsRustyBagItem); ItemData val2 = FindCustomEquippedItem(player, IsRustyQuiverItem); api.SyncBag(player, val); api.SyncQuiver(player, val2); CompatRuntime.LastRustyBagCompatItem = val; CompatRuntime.LastRustyQuiverCompatItem = val2; } private static ItemData? FindCustomEquippedItem(Player player, Func predicate) { Func predicate2 = predicate; if ((Object)(object)player == (Object)null) { return null; } return ((IEnumerable)GetCustomEquippedItems(player)).FirstOrDefault((Func)((ItemData item) => item != null && predicate2(item))); } private static bool TryGetAdventureBackpacksApi(out AdventureBackpacksApi? api) { return TryGetCompatApi("vapok.mods.adventurebackpacks", "AdventureBackpacks", CompatRuntime.AdventureBackpacks, AdventureBackpacksApi.TryCreate, "AdventureBackpacks compatibility disabled", out api); } private static bool TryGetSmoothbrainBackpacksApi(out SmoothbrainBackpacksApi? api) { return TryGetCompatApi("org.bepinex.plugins.backpacks", "Smoothbrain Backpacks", CompatRuntime.SmoothbrainBackpacks, SmoothbrainBackpacksApi.TryCreate, "Smoothbrain Backpacks compatibility disabled", out api); } private static bool TryGetRustyBagsApi(out RustyBagsApi? api) { return TryGetCompatApi("RustyMods.RustyBags", "RustyBags", CompatRuntime.RustyBags, RustyBagsApi.TryCreate, "RustyBags compatibility disabled", out api); } private static void AdventureBackpackIsBackpackEquippedPostfix(Player player, ref bool __result) { if (!__result && (Object)(object)player != (Object)null && FindCustomEquippedItem(player, IsAdventureBackpackItem) != null) { __result = true; } } private static void AdventureBackpackIsThisBackpackEquippedPostfix(Player player, ItemData itemData, ref bool __result) { ItemData itemData2 = itemData; if (!__result && !((Object)(object)player == (Object)null) && itemData2 != null && IsAdventureBackpackItem(itemData2)) { __result = GetCustomEquippedItems(player).Any((ItemData item) => item == itemData2); } } private static void AdventureBackpackGetEquippedBackpackPrefix(Player player, ref ItemData? __state) { if ((Object)(object)player == (Object)null) { return; } __state = ((Humanoid)player).m_shoulderItem; if (!IsAdventureBackpackItem(((Humanoid)player).m_shoulderItem)) { ItemData val = FindCustomEquippedItem(player, IsAdventureBackpackItem); if (val != null) { ((Humanoid)player).m_shoulderItem = val; } } } private static void AdventureBackpackGetEquippedBackpackPostfix(Player player, ItemData? __state) { if ((Object)(object)player != (Object)null) { ((Humanoid)player).m_shoulderItem = __state; } } private static bool IsBetterArcheryQuiverCell(Vector2i pos, bool includeRestockableSlots) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) if (!TryGetBetterArcheryQuiverApi(out BetterArcheryQuiverApi api) || api == null) { return false; } try { return api.IsQuiverCell(pos, includeRestockableSlots); } catch (Exception ex) { return MarkCompatReflectionFailed(CompatRuntime.BetterArcheryQuiver, "BetterArchery quiver", ex.Message, "BetterArchery quiver compatibility disabled"); } } private static bool TryGetBetterArcheryQuiverApi(out BetterArcheryQuiverApi? api) { return TryGetCompatApi("ishid4.mods.betterarchery", "BetterArchery quiver", CompatRuntime.BetterArcheryQuiver, BetterArcheryQuiverApi.TryCreate, "BetterArchery quiver compatibility disabled", out api); } private static bool TryGetCompatApi(string guid, string capability, ref TApi? cachedApi, ref bool reflectionFailed, ref CompatCapabilityState state, CompatApiFactory factory, string warningPrefix, out TApi? api) where TApi : class { api = cachedApi; if (api != null) { return SetCompatCapabilityState(ref state, CompatCapabilityState.Available, capability); } if (!TryGetCompatAssembly(guid, capability, ref reflectionFailed, ref state, out Assembly assembly)) { api = null; return false; } try { if (!factory(assembly, out api, out var detail) || api == null) { return MarkCompatMissingApi(ref reflectionFailed, ref state, capability, detail, warningPrefix + ": " + detail + "."); } cachedApi = api; return SetCompatCapabilityState(ref state, CompatCapabilityState.Available, capability); } catch (Exception ex) { api = null; return MarkCompatReflectionFailed(ref reflectionFailed, ref state, capability, ex.Message, warningPrefix); } } private static bool TryGetCompatApi(string guid, string capability, CompatApiRuntimeState runtime, CompatApiFactory factory, string warningPrefix, out TApi? api) where TApi : class { api = runtime.Api; if (api != null) { return SetCompatCapabilityState(ref runtime.CapabilityState, CompatCapabilityState.Available, capability); } if (!TryGetCompatAssembly(guid, capability, runtime, out Assembly assembly)) { api = null; return false; } try { if (!factory(assembly, out api, out var detail) || api == null) { return MarkCompatMissingApi(runtime, capability, detail, warningPrefix + ": " + detail + "."); } runtime.Api = api; return SetCompatCapabilityState(ref runtime.CapabilityState, CompatCapabilityState.Available, capability); } catch (Exception ex) { api = null; return MarkCompatReflectionFailed(runtime, capability, ex.Message, warningPrefix); } } private static bool TryGetCompatAssembly(string guid, string capability, ref bool reflectionFailed, ref CompatCapabilityState state, out Assembly? assembly) { assembly = null; if (!HasPlugin(guid)) { return SetCompatCapabilityState(ref state, CompatCapabilityState.Unavailable, capability); } if (reflectionFailed) { if (state != CompatCapabilityState.MissingApi) { return SetCompatCapabilityState(ref state, CompatCapabilityState.Failed, capability); } return false; } try { assembly = ((object)Chainloader.PluginInfos[guid].Instance).GetType().Assembly; return true; } catch (Exception ex) { return MarkCompatReflectionFailed(ref reflectionFailed, ref state, capability, ex.Message, capability + " compatibility disabled"); } } private static bool TryGetCompatAssembly(string guid, string capability, CompatApiRuntimeState runtime, out Assembly? assembly) where TApi : class { assembly = null; if (!HasPlugin(guid)) { return SetCompatCapabilityState(ref runtime.CapabilityState, CompatCapabilityState.Unavailable, capability); } if (runtime.ReflectionFailed) { if (runtime.CapabilityState != CompatCapabilityState.MissingApi) { return SetCompatCapabilityState(ref runtime.CapabilityState, CompatCapabilityState.Failed, capability); } return false; } try { assembly = ((object)Chainloader.PluginInfos[guid].Instance).GetType().Assembly; return true; } catch (Exception ex) { return MarkCompatReflectionFailed(runtime, capability, ex.Message, capability + " compatibility disabled"); } } private static bool MarkCompatMissingApi(ref bool reflectionFailed, ref CompatCapabilityState state, string capability, string detail, string warning) { reflectionFailed = true; SetCompatCapabilityState(ref state, CompatCapabilityState.MissingApi, capability, detail); Log.LogWarning((object)warning); return false; } private static bool MarkCompatMissingApi(CompatApiRuntimeState runtime, string capability, string detail, string warning) where TApi : class { runtime.ReflectionFailed = true; SetCompatCapabilityState(ref runtime.CapabilityState, CompatCapabilityState.MissingApi, capability, detail); Log.LogWarning((object)warning); return false; } private static bool MarkCompatReflectionFailed(ref bool reflectionFailed, ref CompatCapabilityState state, string capability, string detail, string warningPrefix) { reflectionFailed = true; SetCompatCapabilityState(ref state, CompatCapabilityState.Failed, capability, detail); Log.LogWarning((object)(warningPrefix + ": " + detail)); return false; } private static bool MarkCompatReflectionFailed(CompatApiRuntimeState runtime, string capability, string detail, string warningPrefix) where TApi : class { runtime.ReflectionFailed = true; SetCompatCapabilityState(ref runtime.CapabilityState, CompatCapabilityState.Failed, capability, detail); Log.LogWarning((object)(warningPrefix + ": " + detail)); return false; } private static object? GetCompatConfigEntryValue(FieldInfo? field) { if (field == null) { return null; } try { object? value = field.GetValue(null); ConfigEntryBase val = (ConfigEntryBase)((value is ConfigEntryBase) ? value : null); return (val != null) ? val.BoxedValue : null; } catch { return null; } } private static bool GetCompatConfigEntryToggleOn(FieldInfo field, ref ConfigEntryBase? config) { try { if (config == null) { object? value = field.GetValue(null); config = (ConfigEntryBase?)((value is ConfigEntryBase) ? value : null); } ConfigEntryBase? obj = config; object obj2 = ((obj != null) ? obj.BoxedValue : null); return obj2 != null && (string.Equals(obj2.ToString(), Toggle.On.ToString(), StringComparison.OrdinalIgnoreCase) || string.Equals(obj2.ToString(), bool.TrueString, StringComparison.OrdinalIgnoreCase)); } catch { return false; } } private static bool HasPlugin(string guid) { if (!string.IsNullOrWhiteSpace(guid)) { return Chainloader.PluginInfos.ContainsKey(guid); } return false; } private static bool IsControllerHotkeyDown(ConfigEntry? entry) { return IsControllerHotkeyActive(entry, down: true, respectDPadMode: true); } private static bool IsControllerHotkeyHeld(ConfigEntry? entry) { return IsControllerHotkeyActive(entry, down: false, respectDPadMode: true); } private static bool IsControllerHotkeyConfigured(ConfigEntry? entry) { if (entry != null && entry.Value != 0) { return IsControllerActionAllowedByDPadMode(entry.Value, forDisplay: true); } return false; } private static bool IsControllerHotkeyActive(ConfigEntry? entry, bool down, bool respectDPadMode) { if (_enableControllerHotkeys == null || _enableControllerHotkeys.Value.IsOff() || entry == null || entry.Value == ControllerHotkeyAction.Off || !IsGamepadActiveSafe()) { return false; } ControllerHotkeyAction value = entry.Value; if (respectDPadMode && !IsControllerActionAllowedByDPadMode(value, forDisplay: false)) { return false; } string controllerHotkeyActionName = GetControllerHotkeyActionName(value); if (string.IsNullOrWhiteSpace(controllerHotkeyActionName)) { return false; } try { return down ? ZInput.GetButtonDown(controllerHotkeyActionName) : ZInput.GetButton(controllerHotkeyActionName); } catch { return false; } } private static string GetControllerHotkeyDisplayText(ConfigEntry? entry) { return GetControllerHotkeyDisplayText(entry, respectDPadMode: true); } private static string GetControllerHotkeyDisplayText(ConfigEntry? entry, bool respectDPadMode) { if (entry == null || entry.Value == ControllerHotkeyAction.Off) { return ""; } ControllerHotkeyAction value = entry.Value; if (respectDPadMode && !IsControllerActionAllowedByDPadMode(value, forDisplay: true)) { return ""; } string text = GetControllerHotkeyDisplayText(value); if (respectDPadMode && IsControllerDPadAction(value) && (_controllerDPadHotkeyMode?.Value ?? ControllerDPadHotkeyMode.InventoryNavigation) == ControllerDPadHotkeyMode.HotkeysWhileHoldingModifier) { string controllerHotkeyDisplayText = GetControllerHotkeyDisplayText(_controllerDPadModifierButton, respectDPadMode: false); if (!string.IsNullOrWhiteSpace(controllerHotkeyDisplayText)) { text = controllerHotkeyDisplayText + " + " + text; } } return text; } private static string GetControllerHotkeyDisplayText(ControllerHotkeyAction action) { if (action != 0) { return GetControllerActionDisplayText(GetControllerHotkeyActionName(action)); } return ""; } private static string GetControllerActionDisplayText(string action) { if (string.IsNullOrWhiteSpace(action)) { return ""; } try { string text = ((ZInput.instance != null) ? ZInput.instance.GetBoundKeyString(action, true) : ""); if (!string.IsNullOrWhiteSpace(text)) { return text; } } catch { } return action; } private static string GetControllerHotkeyActionName(ControllerHotkeyAction action) { if (action != 0) { return action.ToString(); } return ""; } private static bool IsControllerActionAllowedByDPadMode(ControllerHotkeyAction action, bool forDisplay) { if (!IsControllerDPadAction(action)) { return true; } return (_controllerDPadHotkeyMode?.Value ?? ControllerDPadHotkeyMode.InventoryNavigation) switch { ControllerDPadHotkeyMode.Hotkeys => true, ControllerDPadHotkeyMode.HotkeysWhileHoldingModifier => forDisplay ? IsControllerHotkeyConfiguredIgnoringDPadMode(_controllerDPadModifierButton) : IsControllerHotkeyActive(_controllerDPadModifierButton, down: false, respectDPadMode: false), _ => false, }; } private static bool IsControllerHotkeyConfiguredIgnoringDPadMode(ConfigEntry? entry) { if (entry != null) { return entry.Value != ControllerHotkeyAction.Off; } return false; } private static bool IsControllerDPadAction(ControllerHotkeyAction action) { if ((uint)(action - 13) <= 3u) { return true; } return false; } private static bool CanHandleContainerRestock(Player player, Container container) { if ((Object)(object)player != (Object)null && !player.m_isLoading && (Object)(object)container != (Object)null && container.m_inventory != null && CanMutateContainerDirectly(container, allowLocalWithoutZNetView: true)) { return HasContainerPlayerAccess(player, container, flashGuardStone: false); } return false; } private static bool IsAreaContainerAllowed(Player player, Container container, Container? currentContainer, Vector3 playerPosition, float rangeSq, out float distanceSq) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) if (!IsAreaContainerCandidate(player, container, currentContainer, playerPosition, rangeSq, out distanceSq) || !CanMutateContainerDirectly(container) || !HasContainerPlayerAccess(player, container, flashGuardStone: true)) { return false; } if ((Object)(object)container.m_piece != (Object)null && !container.m_piece.IsPlacedByPlayer()) { return false; } if (!HasMultiUserChestActive) { return !IsContainerInUse(container); } return true; } private static bool IsAreaContainerCandidate(Player player, Container container, Container? currentContainer, Vector3 playerPosition, float rangeSq, out float distanceSq) { //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) distanceSq = float.MaxValue; if ((Object)(object)player == (Object)null || (Object)(object)container == (Object)null || (Object)(object)container == (Object)(object)currentContainer || container.m_inventory == null || (Object)(object)container.m_nview == (Object)null) { return false; } Vector3 val = ((Component)container).transform.position - playerPosition; distanceSq = ((Vector3)(ref val)).sqrMagnitude; if (distanceSq > rangeSq) { return false; } if ((Object)(object)((Component)container).GetComponent() == (Object)null && (Object)(object)((Component)container).GetComponentInParent() == (Object)null && (Object)(object)((Component)container.m_nview).GetComponent() == (Object)null) { return (Object)(object)((Component)((Component)container).transform.root).GetComponentInChildren() == (Object)null; } return false; } private static bool HasContainerPlayerAccess(Player player, Container container, bool flashGuardStone) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)player == (Object)null || (Object)(object)container == (Object)null) { return false; } if (container.m_checkGuardStone && !PrivateArea.CheckAccess(((Component)container).transform.position, 0f, flashGuardStone, false)) { return false; } return container.CheckAccess(player.GetPlayerID()); } private static bool IsContainerInUse(Container container) { if ((Object)(object)container == (Object)null) { return true; } if (container.IsInUse() || ((Object)(object)container.m_wagon != (Object)null && container.m_wagon.InUse())) { return true; } ZDO val = (((Object)(object)container.m_nview != (Object)null) ? container.m_nview.GetZDO() : null); if (val != null) { return val.GetInt("InUse", 0) == 1; } return false; } private static bool CanUseContainerThroughOwnerOrMultiUserChest(Container container, bool allowLocalWithoutZNetView = false) { if ((Object)(object)container == (Object)null) { return false; } if ((Object)(object)container.m_nview == (Object)null || !container.m_nview.IsValid()) { return allowLocalWithoutZNetView; } if (container.m_nview.IsOwner()) { return true; } if (HasMultiUserChestActive) { return !IsMultiUserChestIgnored(container); } return false; } private static bool CanMutateContainerDirectly(Container container, bool allowLocalWithoutZNetView = false) { if ((Object)(object)container == (Object)null) { return false; } if ((Object)(object)container.m_nview == (Object)null || !container.m_nview.IsValid()) { return allowLocalWithoutZNetView; } return container.m_nview.IsOwner(); } private static bool CanProcessContainerSortRpc(Container container, long sender, long requesterPlayerId) { if (sender != 0L && requesterPlayerId != 0L && sender == requesterPlayerId && CanMutateContainerDirectly(container)) { return container.CheckAccess(sender); } return false; } private static bool IsMultiUserChestIgnored(Container container) { ZDO val = (((Object)(object)container?.m_nview != (Object)null) ? container.m_nview.GetZDO() : null); if (val != null) { return val.GetBool("MUC_Ignore", false); } return false; } private static bool IsRemoteMultiUserChestInventory(Inventory inventory) { Inventory inventory2 = inventory; if (inventory2 != null && HasMultiUserChestActive) { return InventoryContainers.KnownContainers.Any((Container container) => (Object)(object)container != (Object)null && container.m_inventory == inventory2 && (Object)(object)container.m_nview != (Object)null && container.m_nview.IsValid() && !container.m_nview.IsOwner() && !IsMultiUserChestIgnored(container)); } return false; } private static List GetActionContainers(Player player, Container currentContainer, bool areaForQuickStack) { //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) List list = new List(); HashSet hashSet = new HashSet(); if ((Object)(object)currentContainer != (Object)null && currentContainer.m_inventory != null && hashSet.Add(currentContainer)) { list.Add(currentContainer); } float num = ((!areaForQuickStack) ? (_areaRestockRange?.Value ?? 0f) : (_areaQuickStackRange?.Value ?? 0f)); if (num <= 0f) { return list; } if ((Object)(object)currentContainer == (Object)null || IsUnityNull((Object?)(object)currentContainer)) { return list; } Vector3 position = ((Component)currentContainer).transform.position; float rangeSq = num * num; List<(Container, float)> list2 = new List<(Container, float)>(); for (int num2 = InventoryContainers.KnownContainers.Count - 1; num2 >= 0; num2--) { Container val = InventoryContainers.KnownContainers[num2]; float distanceSq; if ((Object)(object)val == (Object)null || IsUnityNull((Object?)(object)val)) { InventoryContainers.KnownContainers.RemoveAt(num2); } else if (!hashSet.Contains(val) && IsAreaContainerAllowed(player, val, currentContainer, position, rangeSq, out distanceSq)) { list2.Add((val, distanceSq)); hashSet.Add(val); } } list2.Sort(((Container Container, float DistanceSq) left, (Container Container, float DistanceSq) right) => left.DistanceSq.CompareTo(right.DistanceSq)); foreach (var item2 in list2) { Container item = item2.Item1; list.Add(item); } return list; } private static List GetPlayerActionSlots(Player player, Inventory inventory, bool includeHotbar, bool blockFavorites = false) { //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) List list = new List(); int num = Math.Min(GetFixedRegularRows(), inventory.GetHeight()); HashSet hashSet = (blockFavorites ? GetFavoriteBlockedSlots(player, inventory) : new HashSet()); Vector2i val = default(Vector2i); for (int i = 0; i < num; i++) { for (int j = 0; j < inventory.GetWidth(); j++) { ((Vector2i)(ref val))..ctor(j, i); if (!hashSet.Contains(val)) { InventoryCellKind inventoryCellKind = GetInventoryCellKind(player, inventory, val); if (inventoryCellKind == InventoryCellKind.RegularUnlocked || (includeHotbar && inventoryCellKind == InventoryCellKind.Hotbar)) { list.Add(val); } } } } return list; } private static HashSet GetFavoriteBlockedSlots(Player player, Inventory inventory) { //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) HashSet hashSet = new HashSet(); if (!AreFavoritesEnabled()) { return hashSet; } EnsureFavoritesLoaded(player); if (LeaveEmptyFavoriteSlots) { hashSet.UnionWith(FavoriteSlots); return hashSet; } foreach (ItemData item in inventory.m_inventory) { if (item?.m_shared != null && FavoriteSlots.Contains(item.m_gridPos)) { hashSet.Add(item.m_gridPos); } } return hashSet; } private static bool TryGetActionContext(Player? player, out Player localPlayer, out Inventory playerInventory, out Container container, out Inventory containerInventory) { localPlayer = null; playerInventory = null; container = null; containerInventory = null; if ((Object)(object)player == (Object)null || player.m_isLoading || (Object)(object)InventoryGui.instance == (Object)null) { return false; } Container currentContainer = InventoryGui.instance.m_currentContainer; if ((Object)(object)currentContainer == (Object)null || currentContainer.m_inventory == null) { ShowActionResult(player, LocalizeUi("$inventoryslots_action_container", "Container"), 0); return false; } if (!CanMutateContainerDirectly(currentContainer, allowLocalWithoutZNetView: true)) { ((Character)player).Message((MessageType)2, LocalizeUi("$inventoryslots_container_not_ready", "Container is not ready."), 0, (Sprite)null); return false; } Inventory inventory = ((Humanoid)player).GetInventory(); if (inventory == null) { return false; } localPlayer = player; playerInventory = inventory; container = currentContainer; containerInventory = currentContainer.m_inventory; return true; } private static bool HasNoCustomData(ItemData item) { if (item.m_customData != null) { return item.m_customData.Count == 0; } return true; } private static bool CanUseContainerActionStacking(ItemData item) { if (item?.m_shared != null) { if (!HasNoCustomData(item)) { return IsTrustedCustomDataStackingItem(item); } return true; } return false; } private static bool IsTrustedCustomDataStackingItem(ItemData? item) { if (!IsJewelcraftingOrbItem(item)) { return IsEpicLootStackableMaterial(item); } return true; } private static bool IsJewelcraftingOrbItem(ItemData? item) { if (item?.m_shared == null || !HasPlugin("org.bepinex.plugins.jewelcrafting")) { return false; } string itemPrefabName = GetItemPrefabName(item); if (itemPrefabName.StartsWith("JC_Orb_", StringComparison.OrdinalIgnoreCase)) { return true; } string text = item.m_shared.m_name ?? ""; if (!text.StartsWith("$jc_orb_", StringComparison.OrdinalIgnoreCase)) { if (text.IndexOf("orb_of_", StringComparison.OrdinalIgnoreCase) >= 0) { return itemPrefabName.StartsWith("JC_", StringComparison.OrdinalIgnoreCase); } return false; } return true; } private static bool IsEpicLootStackableMaterial(ItemData? item) { if (item?.m_shared == null || !HasPlugin("randyknapp.mods.epicloot")) { return false; } if (IsEpicLootStackableMaterialToken(GetItemPrefabName(item))) { return true; } if (!IsUnityNull((Object?)(object)item.m_dropPrefab) && IsEpicLootStackableMaterialToken(((Object)item.m_dropPrefab).name)) { return true; } return IsEpicLootStackableMaterialToken(item.m_shared.m_name ?? ""); } private static bool IsEpicLootStackableMaterialToken(string token) { if (!token.StartsWith("Shard", StringComparison.OrdinalIgnoreCase) && !token.StartsWith("Essence", StringComparison.OrdinalIgnoreCase) && !token.StartsWith("Dust", StringComparison.OrdinalIgnoreCase)) { return token.StartsWith("Reagent", StringComparison.OrdinalIgnoreCase); } return true; } private static int CountMovedFromContainerSource(Inventory sourceInventory, ItemData sourceItem, int before, int requestedAmount, bool moveSucceeded, out bool remotePending) { int num = (sourceInventory.m_inventory.Contains(sourceItem) ? sourceItem.m_stack : 0); int num2 = Math.Max(0, before - num); remotePending = false; if (num2 == 0 && moveSucceeded && IsRemoteMultiUserChestInventory(sourceInventory)) { remotePending = true; num2 = requestedAmount; } return num2; } private static void RemoveItemIfStillOwned(Inventory inventory, ItemData item) { if (inventory != null && item != null && inventory.m_inventory.Contains(item)) { inventory.RemoveItem(item); } } private static int CompareGridOrder(Vector2i a, Vector2i b) { //IL_0007: 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) int num = a.y.CompareTo(b.y); if (num == 0) { return a.x.CompareTo(b.x); } return num; } private static void ShowActionResult(Player player, string action, int moved) { if (!((Object)(object)player == (Object)null)) { string text = LocalizeUi("$inventoryslots_action_result_format", "{action}: {count}").Replace("{action}", action).Replace("{count}", moved.ToString()); ((Character)player).Message((MessageType)2, text, 0, (Sprite)null); } } private static int GetContainerActionSuccessFxMode() { return Mathf.Clamp((_containerActionSuccessFxMode == null) ? 1 : _containerActionSuccessFxMode.Value, 0, 12); } private static float GetContainerActionSuccessFxVolume() { return Mathf.Clamp01((_containerActionSuccessFxVolume != null) ? _containerActionSuccessFxVolume.Value : 1f); } private static int TryPlayChangedContainerActionSuccessFx(Player player, Container container, int mode, int played) { if (mode < 2 || played >= mode) { return played; } PlayContainerActionSuccessFx(player, container); return played + 1; } private static void PlayContainerActionSuccessFx(Player player, Container container) { //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)player == (Object)null) && !IsUnityNull((Object?)(object)player) && !((Object)(object)container == (Object)null) && !IsUnityNull((Object?)(object)container) && !((Object)(object)ZNetScene.instance == (Object)null)) { GameObject prefab = ZNetScene.instance.GetPrefab("fx_HildirChest_Unlock"); if (!((Object)(object)prefab == (Object)null) && !IsUnityNull((Object?)(object)prefab)) { Vector3 position = ((Component)container).transform.position; Quaternion rotation = ((Component)container).transform.rotation; ApplyContainerActionSuccessFxVolume(Object.Instantiate(prefab, position, rotation)); } } } private static void ApplyContainerActionSuccessFxVolume(GameObject instance) { float containerActionSuccessFxVolume = GetContainerActionSuccessFxVolume(); if ((Object)(object)instance == (Object)null || IsUnityNull((Object?)(object)instance) || containerActionSuccessFxVolume >= 0.999f) { return; } Component[] componentsInChildren = instance.GetComponentsInChildren(true); foreach (Component val in componentsInChildren) { if ((Object)(object)val != (Object)null && !IsUnityNull((Object?)(object)val)) { ScaleSfxComponentVolume(val, containerActionSuccessFxVolume); } } } private static void ScaleSfxComponentVolume(Component component, float volumeScale) { Type type = ((object)component).GetType(); if (IsUnityAudioSource(type)) { ScaleUnityAudioSourceVolume(component, type, volumeScale); } else { if (!IsLikelySfxComponent(type)) { return; } SfxVolumeMemberCache sfxVolumeMemberCache = GetSfxVolumeMemberCache(type); FieldInfo[] fields = sfxVolumeMemberCache.Fields; foreach (FieldInfo fieldInfo in fields) { try { fieldInfo.SetValue(component, Mathf.Max(0f, (float)fieldInfo.GetValue(component) * volumeScale)); } catch { } } PropertyInfo[] properties = sfxVolumeMemberCache.Properties; foreach (PropertyInfo propertyInfo in properties) { try { propertyInfo.SetValue(component, Mathf.Max(0f, (float)propertyInfo.GetValue(component) * volumeScale)); } catch { } } } } private static SfxVolumeMemberCache GetSfxVolumeMemberCache(Type type) { if (SfxVolumeMembersByType.TryGetValue(type, out var value)) { return value; } value = new SfxVolumeMemberCache((from field in type.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic) where field.FieldType == typeof(float) && IsSfxVolumeMemberName(field.Name) && !IsUnsupportedSfxVolumeMemberName(field.Name) select field).ToArray(), (from property in type.GetProperties(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic) where property.PropertyType == typeof(float) && property.CanRead && property.CanWrite && property.GetIndexParameters().Length == 0 && IsSfxVolumeMemberName(property.Name) && !IsUnsupportedSfxVolumeMemberName(property.Name) select property).ToArray()); SfxVolumeMembersByType[type] = value; return value; } private static bool IsLikelySfxComponent(Type type) { string name = type.Name; if (name.IndexOf("SFX", StringComparison.OrdinalIgnoreCase) < 0) { return name.IndexOf("Audio", StringComparison.OrdinalIgnoreCase) >= 0; } return true; } private static bool IsSfxVolumeMemberName(string name) { if (name.IndexOf("volume", StringComparison.OrdinalIgnoreCase) < 0) { return name.IndexOf("vol", StringComparison.OrdinalIgnoreCase) >= 0; } return true; } private static bool IsUnsupportedSfxVolumeMemberName(string name) { if (!string.Equals(name, "minVolume", StringComparison.OrdinalIgnoreCase)) { return string.Equals(name, "maxVolume", StringComparison.OrdinalIgnoreCase); } return true; } private static bool IsUnityAudioSource(Type type) { return string.Equals(type.FullName, "UnityEngine.AudioSource", StringComparison.Ordinal); } private static void ScaleUnityAudioSourceVolume(Component component, Type type, float volumeScale) { PropertyInfo property = type.GetProperty("volume", BindingFlags.Instance | BindingFlags.Public); if (property == null || !property.CanRead || !property.CanWrite) { return; } try { property.SetValue(component, Mathf.Max(0f, (float)property.GetValue(component) * volumeScale)); } catch { } } internal static bool TryHandleVanillaPlaceStacks(InventoryGui gui) { if ((Object)(object)gui == (Object)null || (Object)(object)gui.m_currentContainer == (Object)null) { return false; } if (!CanMutateContainerDirectly(gui.m_currentContainer, allowLocalWithoutZNetView: true)) { return false; } QuickStackCurrentContainer(Player.m_localPlayer); return true; } internal static bool TryHandleContainerStackAll(Container container) { if (ShouldSuppressContainerStackAllForRestock(container)) { return true; } Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null || localPlayer.m_isLoading || (Object)(object)container == (Object)null || container.m_inventory == null) { return false; } if (!CanMutateContainerDirectly(container, allowLocalWithoutZNetView: true)) { return false; } Inventory inventory = ((Humanoid)localPlayer).GetInventory(); if (inventory == null) { return false; } QuickStackIntoContainers(localPlayer, inventory, container, includeArea: true); return true; } internal static void QuickStackCurrentContainer(Player? player) { if (TryGetActionContext(player, out Player localPlayer, out Inventory playerInventory, out Container container, out Inventory _)) { QuickStackIntoContainers(localPlayer, playerInventory, container, includeArea: false); } } private static void QuickStackIntoContainers(Player localPlayer, Inventory playerInventory, Container container, bool includeArea) { Player localPlayer2 = localPlayer; Inventory playerInventory2 = playerInventory; List list = playerInventory2.m_inventory.Where((ItemData item) => ShouldQuickStackItem(localPlayer2, playerInventory2, item, includeHotbar: false)).ToList(); list.Sort((ItemData a, ItemData b) => -CompareGridOrder(a.m_gridPos, b.m_gridPos)); InventoryGui instance = InventoryGui.instance; if (instance != null) { instance.SetupDragItem((ItemData)null, (Inventory)null, 0); } int num = 0; int num2 = (includeArea ? GetContainerActionSuccessFxMode() : 0); int played = 0; foreach (Container item in (List)(includeArea ? ((IList)GetActionContainers(localPlayer2, container, areaForQuickStack: true)) : ((IList)new List { container }))) { int num3 = QuickStackItemsIntoContainer(playerInventory2, item.m_inventory, list); num += num3; if (num3 > 0) { played = TryPlayChangedContainerActionSuccessFx(localPlayer2, item, num2, played); } } if (num > 0) { playerInventory2.Changed(); ClearCraftingRequirementAvailabilityCache(); if (num2 == 1) { PlayContainerActionSuccessFx(localPlayer2, container); } } ShowActionResult(localPlayer2, LocalizeUi("$inventoryslots_action_stack", "Stack"), num); } private static bool ShouldQuickStackItem(Player player, Inventory inventory, ItemData item, bool includeHotbar) { if (item?.m_shared != null && item.m_shared.m_maxStackSize > 1 && IsRegularActionItem(player, inventory, item, includeHotbar) && !IsFavoriteProtected(player, inventory, item)) { return CanUseContainerActionStacking(item); } return false; } private static int QuickStackItemsIntoContainer(Inventory playerInventory, Inventory containerInventory, List candidates) { if (containerInventory == null || candidates.Count == 0) { return 0; } HashSet hashSet = new HashSet(from item in containerInventory.m_inventory where item?.m_shared != null select item.m_shared.m_name, StringComparer.OrdinalIgnoreCase); if (hashSet.Count == 0) { return 0; } int num = 0; foreach (ItemData candidate in candidates) { if (playerInventory.m_inventory.Contains(candidate) && candidate?.m_shared != null && hashSet.Contains(candidate.m_shared.m_name) && containerInventory.AddItem(candidate)) { RemoveItemIfStillOwned(playerInventory, candidate); num++; } } if (num > 0) { containerInventory.Changed(); } return num; } private static void StoreAllToCurrentContainer(Player? player) { if (!TryGetActionContext(player, out Player localPlayer, out Inventory playerInventory, out Container _, out Inventory containerInventory)) { return; } List list = playerInventory.m_inventory.Where((ItemData item) => ShouldStoreAllItem(localPlayer, playerInventory, item, includeHotbar: false, includeEquipped: false)).ToList(); list.Sort((ItemData a, ItemData b) => CompareGridOrder(a.m_gridPos, b.m_gridPos)); InventoryGui.instance.SetupDragItem((ItemData)null, (Inventory)null, 0); int num = 0; foreach (ItemData item in list) { if (playerInventory.m_inventory.Contains(item) && containerInventory.AddItem(item)) { RemoveItemIfStillOwned(playerInventory, item); num++; if (item.m_equipped) { ((Humanoid)localPlayer).RemoveEquipAction(item); ((Humanoid)localPlayer).UnequipItem(item, false); } } } if (num > 0) { playerInventory.Changed(); containerInventory.Changed(); ClearCraftingRequirementAvailabilityCache(); } ShowActionResult(localPlayer, LocalizeUi("$inventoryslots_action_place_all", "Place All"), num); } private static bool ShouldStoreAllItem(Player player, Inventory inventory, ItemData item, bool includeHotbar, bool includeEquipped) { if (item?.m_shared != null && IsRegularActionItem(player, inventory, item, includeHotbar) && !IsFavoriteProtected(player, inventory, item)) { if (!includeEquipped) { return !item.m_equipped; } return true; } return false; } private static void RefreshRestockTargetStackLimits() { RestockTargetStackLimits = RestockTargetLimitCore.Parse(_restockTargetStackLimitsConfig?.Value); } private static void RestockFromCurrentContainer(Player? player) { if (TryGetActionContext(player, out Player localPlayer, out Inventory playerInventory, out Container container, out Inventory _)) { RestockFromContainer(localPlayer, playerInventory, container, ContainerTakeStacksMode.CurrentContainerMatchingStacks); } } private static void HandleContainerRestockHotkey(Player player) { if (!TryGetContainerRestockHotkeyContext(player, out Container container)) { ResetContainerRestockHold(); return; } if (IsUnityNull((Object?)(object)InventoryPanels.ContainerRestockHoldContainer) || (Object)(object)InventoryPanels.ContainerRestockHoldContainer != (Object)(object)container) { InventoryPanels.ContainerRestockHoldContainer = container; InventoryPanels.ContainerRestockHoldStartTime = Time.time; InventoryPanels.ContainerRestockHoldTriggered = false; } if (!InventoryPanels.ContainerRestockHoldTriggered && !(Time.time - InventoryPanels.ContainerRestockHoldStartTime < 0.5f)) { if (TryRestockFromHoveredContainer(player, container)) { InventoryPanels.ContainerRestockHoldTriggered = true; } else { ResetContainerRestockHold(); } } } internal static bool ShouldSuppressContainerInteractForRestock(Container container, Humanoid character) { Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null || (Object)(object)character != (Object)(object)localPlayer || InventoryGui.IsVisible() || !IsContainerRestockShortcutHeld()) { return false; } if ((Object)(object)GetHoveredContainer(localPlayer) == (Object)(object)container) { return CanHandleContainerRestock(localPlayer, container); } return false; } private static bool ShouldSuppressContainerStackAllForRestock(Container container) { Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null || localPlayer.m_isLoading || InventoryGui.IsVisible() || !IsContainerRestockShortcutHeld()) { return false; } return (Object)(object)GetHoveredContainer(localPlayer) == (Object)(object)container; } internal static void AppendContainerRestockHoverText(Container container, ref string text) { Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null || localPlayer.m_isLoading || string.IsNullOrWhiteSpace(text) || !IsContainerRestockKeyConfigured() || !CanHandleContainerRestock(localPlayer, container)) { return; } string text2 = LocalizeUi("$inventoryslots_hold_to_restock", "Hold to restock"); if (text.IndexOf("Hold to restock", StringComparison.OrdinalIgnoreCase) < 0 && text.IndexOf(text2, StringComparison.OrdinalIgnoreCase) < 0) { string containerRestockKeyDisplayText = GetContainerRestockKeyDisplayText(); if (!string.IsNullOrWhiteSpace(containerRestockKeyDisplayText)) { text = text + "\n[" + containerRestockKeyDisplayText + "] (" + text2 + ")"; } } } private static bool TryGetContainerRestockHotkeyContext(Player player, out Container container) { container = null; if ((Object)(object)player == (Object)null || InventoryGui.IsVisible() || ShouldBlockGlobalHotkeys(player) || !IsContainerRestockShortcutHeld()) { return false; } Container hoveredContainer = GetHoveredContainer(player); if ((Object)(object)hoveredContainer == (Object)null || !CanHandleContainerRestock(player, hoveredContainer)) { return false; } container = hoveredContainer; return true; } private static bool TryRestockFromHoveredContainer(Player player, Container container) { if (!CanHandleContainerRestock(player, container)) { return false; } Inventory inventory = ((Humanoid)player).GetInventory(); if (inventory == null) { return false; } RestockFromContainer(player, inventory, container, ContainerTakeStacksMode.AreaFavoriteRestock); return true; } private static void RestockFromContainer(Player localPlayer, Inventory playerInventory, Container container, ContainerTakeStacksMode mode) { Player localPlayer2 = localPlayer; Inventory playerInventory2 = playerInventory; if ((Object)(object)localPlayer2 == (Object)null || playerInventory2 == null || (Object)(object)container == (Object)null || container.m_inventory == null) { return; } bool num = mode == ContainerTakeStacksMode.AreaFavoriteRestock; List list = playerInventory2.m_inventory.Where((ItemData item) => ShouldTakeStacksTarget(localPlayer2, playerInventory2, item, includeHotbar: false, mode)).ToList(); list.Sort((ItemData a, ItemData b) => -CompareGridOrder(a.m_gridPos, b.m_gridPos)); InventoryGui instance = InventoryGui.instance; if (instance != null) { instance.SetupDragItem((ItemData)null, (Inventory)null, 0); } int num2 = 0; int num3 = (num ? GetContainerActionSuccessFxMode() : 0); int played = 0; foreach (Container item in (List)(num ? ((IList)GetActionContainers(localPlayer2, container, areaForQuickStack: false)) : ((IList)new List { container }))) { int num4 = RestockTargetsFromContainer(playerInventory2, item.m_inventory, list, mode); num2 += num4; if (num4 > 0) { played = TryPlayChangedContainerActionSuccessFx(localPlayer2, item, num3, played); } } if (num2 > 0) { playerInventory2.Changed(); ClearCraftingRequirementAvailabilityCache(); if (num3 == 1) { PlayContainerActionSuccessFx(localPlayer2, container); } } ShowActionResult(localPlayer2, LocalizeUi("$inventoryslots_action_take_stacks", "Take stacks"), num2); } private static Container? GetHoveredContainer(Player player) { GameObject val = (((Object)(object)player != (Object)null) ? ((Humanoid)player).GetHoverObject() : null); if (!IsUnityNull((Object?)(object)val)) { return val.GetComponentInParent(); } return null; } private static bool IsContainerRestockKeyConfigured() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) if (_containerRestockKey != null) { KeyboardShortcut value = _containerRestockKey.Value; if ((int)((KeyboardShortcut)(ref value)).MainKey != 0) { return true; } } return IsControllerHotkeyConfigured(_controllerContainerRestockButton); } private static bool IsContainerRestockShortcutHeld() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) if (!IsContainerRestockKeyConfigured() || !IsShortcutHeldAllowingAltPair(_containerRestockKey.Value)) { return IsControllerHotkeyHeld(_controllerContainerRestockButton); } return true; } private static void ResetContainerRestockHold() { InventoryPanels.ContainerRestockHoldContainer = null; InventoryPanels.ContainerRestockHoldStartTime = -1f; InventoryPanels.ContainerRestockHoldTriggered = false; } private static string GetContainerRestockKeyDisplayText() { //IL_0015: 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_001d: 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_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_004f: 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) List list = new List(); if (_containerRestockKey != null) { KeyboardShortcut value = _containerRestockKey.Value; if ((int)((KeyboardShortcut)(ref value)).MainKey != 0) { KeyboardShortcut value2 = _containerRestockKey.Value; List list2 = new List(); foreach (KeyCode modifier in ((KeyboardShortcut)(ref value2)).Modifiers) { AddContainerRestockKeyPart(list2, FormatContainerRestockKey(modifier)); } AddContainerRestockKeyPart(list2, FormatContainerRestockKey(((KeyboardShortcut)(ref value2)).MainKey)); AddContainerRestockKeyPart(list, string.Join(" + ", list2)); } } AddContainerRestockKeyPart(list, GetControllerHotkeyDisplayText(_controllerContainerRestockButton)); return string.Join("/", list); } private static void AddContainerRestockKeyPart(List parts, string value) { if (!string.IsNullOrWhiteSpace(value) && !parts.Contains(value)) { parts.Add(value); } } private static string FormatContainerRestockKey(KeyCode key) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Invalid comparison between Unknown and I4 //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Invalid comparison between Unknown and I4 //IL_0005: 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) //IL_006d: Expected I4, but got Unknown //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Expected I4, but got Unknown //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Expected I4, but got Unknown if ((int)key <= 57) { if ((int)key == 0) { return ""; } switch (key - 48) { case 0: return "0"; case 1: return "1"; case 2: return "2"; case 3: return "3"; case 4: return "4"; case 5: return "5"; case 6: return "6"; case 7: return "7"; case 8: return "8"; case 9: return "9"; } } else { if ((int)key == 96) { return "`"; } switch (key - 303) { case 4: case 5: return "Alt"; case 2: case 3: return "Ctrl"; case 0: case 1: return "Shift"; } switch (key - 323) { case 0: return "Mouse-1"; case 1: return "Mouse-2"; case 2: return "Mouse-3"; case 3: return "Mouse-4"; case 4: return "Mouse-5"; } } return ((object)(KeyCode)(ref key)).ToString(); } private static bool ShouldTakeStacksTarget(Player player, Inventory inventory, ItemData item, bool includeHotbar, ContainerTakeStacksMode mode) { if (mode != ContainerTakeStacksMode.AreaFavoriteRestock) { return ShouldTakeMatchingStackItem(player, inventory, item, includeHotbar); } return ShouldRestockItem(player, inventory, item, includeHotbar); } private static bool ShouldRestockItem(Player player, Inventory inventory, ItemData item, bool includeHotbar) { if (item?.m_shared == null || !IsRegularActionItem(player, inventory, item, includeHotbar) || !IsFavoriteRestockTarget(player, item) || !CanUseContainerActionStacking(item)) { return false; } int maxStackSize = item.m_shared.m_maxStackSize; int restockTargetStack = GetRestockTargetStack(item); if (maxStackSize > 1) { return item.m_stack < restockTargetStack; } return false; } private static bool ShouldTakeMatchingStackItem(Player player, Inventory inventory, ItemData item, bool includeHotbar) { if (item?.m_shared != null && IsRegularActionItem(player, inventory, item, includeHotbar) && !IsFavoriteRestockTarget(player, item) && CanUseContainerActionStacking(item) && item.m_shared.m_maxStackSize > 1) { return item.m_stack < item.m_shared.m_maxStackSize; } return false; } private static bool IsFavoriteRestockTarget(Player player, ItemData item) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) if (AreFavoritesEnabled()) { return IsFavoriteSlot(player, item.m_gridPos); } return false; } private static int GetRestockTargetStack(ItemData item) { if (item?.m_shared != null) { return RestockTargetLimitCore.ResolveTargetStackLimit(RestockTargetStackLimits, GetRestockTargetLookupTokens(item), item.m_shared.m_maxStackSize); } return 0; } [IteratorStateMachine(typeof(d__201))] private static IEnumerable GetRestockTargetLookupTokens(ItemData item) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__201(-2) { <>3__item = item }; } private static bool CanRestockFromContainerItem(ItemData target, ItemData source) { if (target?.m_shared != null && source?.m_shared != null && CanUseContainerActionStacking(target) && CanUseContainerActionStacking(source) && string.Equals(target.m_shared.m_name, source.m_shared.m_name, StringComparison.OrdinalIgnoreCase)) { return target.m_quality == source.m_quality; } return false; } private static int RestockTargetsFromContainer(Inventory playerInventory, Inventory containerInventory, List targets, ContainerTakeStacksMode mode) { if (containerInventory == null || targets.Count == 0) { return 0; } int num = 0; foreach (ItemData target in targets) { if (!playerInventory.m_inventory.Contains(target)) { continue; } int num2 = ((mode == ContainerTakeStacksMode.AreaFavoriteRestock) ? GetRestockTargetStack(target) : target.m_shared.m_maxStackSize); int num3 = target.m_stack; int num4 = containerInventory.m_inventory.Count - 1; while (num4 >= 0 && num3 < num2) { ItemData val = containerInventory.m_inventory[num4]; if (CanRestockFromContainerItem(target, val)) { int num5 = Math.Min(num2 - num3, val.m_stack); if (num5 > 0) { int stack = val.m_stack; bool moveSucceeded = playerInventory.MoveItemToThis(containerInventory, val, num5, target.m_gridPos.x, target.m_gridPos.y); bool remotePending; int num6 = CountMovedFromContainerSource(containerInventory, val, stack, num5, moveSucceeded, out remotePending); num3 += num6; num += num6; } } num4--; } } if (num > 0) { containerInventory.Changed(); } return num; } private static void SortCurrentContainer(Player? player) { if (!((Object)(object)player == (Object)null) && !player.m_isLoading && !((Object)(object)InventoryGui.instance == (Object)null)) { Container currentContainer = InventoryGui.instance.m_currentContainer; if ((Object)(object)currentContainer == (Object)null || currentContainer.m_inventory == null) { ShowActionResult(player, LocalizeUi("$inventoryslots_action_container", "Container"), 0); } else if (CanMutateContainerDirectly(currentContainer, allowLocalWithoutZNetView: true)) { int moved = SortContainerInventory(currentContainer); ShowActionResult(player, LocalizeUi("$inventoryslots_action_sort", "Sort"), moved); } else if (!CanUseContainerThroughOwnerOrMultiUserChest(currentContainer)) { ((Character)player).Message((MessageType)2, LocalizeUi("$inventoryslots_container_not_ready", "Container is not ready."), 0, (Sprite)null); } else { currentContainer.m_nview.InvokeRPC("InventorySlots_RequestSort", new object[1] { player.GetPlayerID() }); ((Character)player).Message((MessageType)2, LocalizeUi("$inventoryslots_action_sort_requested", "Sort requested."), 0, (Sprite)null); } } } private static int SortContainerInventory(Container container) { if ((Object)(object)container == (Object)null || container.m_inventory == null) { return 0; } List allInventorySlots = GetAllInventorySlots(container.m_inventory); return SortInventoryInternal(container.m_inventory, allInventorySlots, (ItemData item) => item?.m_shared != null); } internal static void RegisterContainer(Container container) { if (!((Object)(object)container == (Object)null)) { if (!InventoryContainers.KnownContainers.Contains(container)) { InventoryContainers.KnownContainers.Add(container); } RegisterContainerRpcs(container); } } internal static void UnregisterContainer(Container container) { if ((Object)(object)container != (Object)null) { InventoryContainers.KnownContainers.Remove(container); } } private static void RegisterContainerRpcs(Container container) { Container container2 = container; if ((Object)(object)container2 == (Object)null) { return; } if ((Object)(object)container2.m_nview == (Object)null) { container2.m_nview = (((Object)(object)container2.m_rootObjectOverride != (Object)null) ? ((Component)container2.m_rootObjectOverride).GetComponent() : ((Component)container2).GetComponent()); } if (!((Object)(object)container2.m_nview == (Object)null)) { container2.m_nview.Unregister("InventorySlots_RequestSort"); container2.m_nview.Register("InventorySlots_RequestSort", (Action)delegate(long sender, long requesterPlayerId) { RPC_RequestSort(container2, sender, requesterPlayerId); }); } } private static void RPC_RequestSort(Container container, long sender, long requesterPlayerId) { if (CanProcessContainerSortRpc(container, sender, requesterPlayerId)) { SortContainerInventory(container); } } private static void SortPlayerInventory(Player? player) { Player player2 = player; if ((Object)(object)player2 == (Object)null || player2.m_isLoading) { return; } Inventory inventory = ((Humanoid)player2).GetInventory(); if (inventory != null) { List playerActionSlots = GetPlayerActionSlots(player2, inventory, includeHotbar: false, blockFavorites: true); HashSet allowedSet = new HashSet(playerActionSlots); InventoryGui.instance.SetupDragItem((ItemData)null, (Inventory)null, 0); int moved = SortInventoryInternal(inventory, playerActionSlots, (ItemData item) => item?.m_shared != null && allowedSet.Contains(item.m_gridPos) && !IsFavoriteProtected(player2, inventory, item)); ShowActionResult(player2, LocalizeUi("$inventoryslots_action_sort_inventory", "Sort Inv"), moved); } } private static int SortInventoryInternal(Inventory inventory, List allowedSlots, Func shouldSort) { //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) if (inventory == null || allowedSlots.Count == 0) { return 0; } List list = inventory.m_inventory.Where(shouldSort).ToList(); if (list.Count == 0) { return 0; } bool flag = MergeSortableStacks(list, inventory); Dictionary sortKeys = list.ToDictionary((ItemData item) => item, GetInventoryItemSortKey); int inventoryWidth = Mathf.Max(1, inventory.GetWidth()); Dictionary originalIndices = list.ToDictionary((ItemData item) => item, (ItemData item) => GetInventoryOriginalSortIndex(item, inventoryWidth)); list.Sort((ItemData a, ItemData b) => CompareItemsForSort(a, b, sortKeys[a], sortKeys[b], originalIndices[a], originalIndices[b])); int num = 0; int num2 = Math.Min(list.Count, allowedSlots.Count); for (int i = 0; i < num2; i++) { if (list[i].m_gridPos != allowedSlots[i]) { num++; flag = true; list[i].m_gridPos = allowedSlots[i]; } } if (flag) { inventory.Changed(); } return num; } private static int GetInventoryOriginalSortIndex(ItemData item, int inventoryWidth) { return item.m_gridPos.y * inventoryWidth + item.m_gridPos.x; } private static bool MergeSortableStacks(List toMerge, Inventory inventory) { bool result = false; foreach (List item in (from item in toMerge where item?.m_shared != null && item.m_stack < item.m_shared.m_maxStackSize && CanUseContainerActionStacking(item) group item by new { item.m_shared.m_name, item.m_quality } into grouping select grouping.ToList()).ToList()) { if (item.Count <= 1) { continue; } int num = item.Sum((ItemData item) => item.m_stack); int maxStackSize = item[0].m_shared.m_maxStackSize; foreach (ItemData item2 in item) { if (num <= 0) { if (item2.m_stack != 0) { item2.m_stack = 0; result = true; } inventory.RemoveItem(item2); toMerge.Remove(item2); result = true; } else { int num2 = Math.Min(maxStackSize, num); if (item2.m_stack != num2) { item2.m_stack = num2; result = true; } num -= item2.m_stack; } } } return result; } private static List GetAllInventorySlots(Inventory inventory) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) List list = new List(); for (int i = 0; i < inventory.GetHeight(); i++) { for (int j = 0; j < inventory.GetWidth(); j++) { list.Add(new Vector2i(j, i)); } } return list; } internal static bool TryHandleSafeTakeAll(InventoryGui gui) { Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null || localPlayer.m_isLoading || (Object)(object)gui == (Object)null || (Object)(object)gui.m_currentContainer == (Object)null || gui.m_currentContainer.m_inventory == null) { return false; } Container currentContainer = gui.m_currentContainer; if (!CanMutateContainerDirectly(currentContainer, allowLocalWithoutZNetView: true)) { ((Character)localPlayer).Message((MessageType)2, LocalizeUi("$inventoryslots_container_not_ready", "Container is not ready."), 0, (Sprite)null); return true; } Inventory inventory = ((Humanoid)localPlayer).GetInventory(); Inventory inventory2 = currentContainer.m_inventory; if (inventory == null || inventory2 == null) { return false; } TombStone component = ((Component)currentContainer).GetComponent(); bool num = (Object)(object)component != (Object)null; gui.SetupDragItem((ItemData)null, (Inventory)null, 0); int num2 = SafeTakeAllItems(localPlayer, inventory, inventory2, includeHotbar: false); if (num2 > 0) { inventory.Changed(); inventory2.Changed(); ClearCraftingRequirementAvailabilityCache(); } if (num && inventory2.NrOfItems() == 0) { component.OnTakeAllSuccess(); } ShowActionResult(localPlayer, LocalizeUi("$inventoryslots_action_take_all", "Take All"), num2); return true; } private static int SafeTakeAllItems(Player player, Inventory playerInventory, Inventory containerInventory, bool includeHotbar) { List playerActionSlots = GetPlayerActionSlots(player, playerInventory, includeHotbar, blockFavorites: true); HashSet allowedSlots = new HashSet(playerActionSlots); List safeTakeAllEmptySlots = GetSafeTakeAllEmptySlots(playerInventory, playerActionSlots); List list = containerInventory.m_inventory.Where((ItemData item) => item?.m_shared != null).ToList(); list.Sort((ItemData left, ItemData right) => CompareGridOrder(left.m_gridPos, right.m_gridPos)); int num = 0; foreach (ItemData item in list) { if (containerInventory.m_inventory.Contains(item)) { int stack = item.m_stack; if (MoveContainerItemSafelyToPlayer(playerInventory, containerInventory, item, safeTakeAllEmptySlots, allowedSlots) > 0 && (!containerInventory.m_inventory.Contains(item) || item.m_stack < stack)) { num++; } } } return num; } private static int MoveContainerItemSafelyToPlayer(Inventory playerInventory, Inventory containerInventory, ItemData source, List emptySlots, HashSet allowedSlots) { //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_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) int num = 0; if (CanMergeForSafeMove(source)) { foreach (ItemData safeTakeAllStackTarget in GetSafeTakeAllStackTargets(playerInventory, source, allowedSlots)) { if (!containerInventory.m_inventory.Contains(source) || source.m_stack <= 0) { break; } int num2 = Math.Min(safeTakeAllStackTarget.m_shared.m_maxStackSize - safeTakeAllStackTarget.m_stack, source.m_stack); if (num2 > 0) { int stack = source.m_stack; bool moveSucceeded = playerInventory.MoveItemToThis(containerInventory, source, num2, safeTakeAllStackTarget.m_gridPos.x, safeTakeAllStackTarget.m_gridPos.y); bool remotePending; int num3 = CountMovedFromContainerSource(containerInventory, source, stack, num2, moveSucceeded, out remotePending); num += num3; if (remotePending) { return num; } } } } while (containerInventory.m_inventory.Contains(source) && source.m_stack > 0 && emptySlots.Count > 0) { Vector2i val = emptySlots[0]; emptySlots.RemoveAt(0); int stack2 = source.m_stack; int stack3 = source.m_stack; bool moveSucceeded2 = playerInventory.MoveItemToThis(containerInventory, source, stack3, val.x, val.y); bool remotePending2; int num4 = CountMovedFromContainerSource(containerInventory, source, stack2, stack3, moveSucceeded2, out remotePending2); num += num4; if (num4 == 0 || remotePending2) { break; } } return num; } private static List GetSafeTakeAllStackTargets(Inventory playerInventory, ItemData source, HashSet allowedSlots) { HashSet allowedSlots2 = allowedSlots; ItemData source2 = source; return (from target in playerInventory.m_inventory where target?.m_shared != null && allowedSlots2.Contains(target.m_gridPos) && CanMergeForSafeMove(target) && string.Equals(target.m_shared.m_name, source2.m_shared.m_name, StringComparison.OrdinalIgnoreCase) && target.m_quality == source2.m_quality && target.m_stack < target.m_shared.m_maxStackSize orderby target.m_gridPos.y, target.m_gridPos.x select target).ToList(); } private static List GetSafeTakeAllEmptySlots(Inventory playerInventory, List actionSlots) { Inventory playerInventory2 = playerInventory; return actionSlots.Where((Vector2i slot) => playerInventory2.GetItemAt(slot.x, slot.y) == null).ToList(); } private static bool CanMergeForSafeMove(ItemData item) { if (item?.m_shared != null && item.m_shared.m_maxStackSize > 1) { return CanUseContainerActionStacking(item); } return false; } private static void DrawControllerHotkeyConfig(ConfigEntryBase entry) { string configDrawerEntryKey = GetConfigDrawerEntryKey(entry); ControllerHotkeyAction controllerHotkeyAction = GetControllerHotkeyConfigValue(entry); bool flag = IsCapturingControllerHotkey(configDrawerEntryKey); GUILayout.BeginVertical(Array.Empty()); GUILayout.BeginHorizontal(Array.Empty()); string controllerHotkeyDisplayText = GetControllerHotkeyDisplayText(controllerHotkeyAction); GUILayout.Label("Current: " + (string.IsNullOrWhiteSpace(controllerHotkeyDisplayText) ? "Off" : controllerHotkeyDisplayText), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) }); if (GUILayout.Button(flag ? "Stop" : "Capture", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(70f) })) { if (flag) { StopControllerHotkeyCapture(); } else { StartControllerHotkeyCapture(configDrawerEntryKey); } } if (GUILayout.Button("Clear", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(48f) })) { SetControllerHotkeyConfigValue(entry, ControllerHotkeyAction.Off); controllerHotkeyAction = ControllerHotkeyAction.Off; } GUILayout.EndHorizontal(); DrawControllerHotkeyStatus(entry, controllerHotkeyAction, flag); if (GUILayout.Button(ExpandedControllerHotkeyPresetDrawers.Contains(configDrawerEntryKey) ? "Hide Presets" : "Presets", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(110f) }) && !ExpandedControllerHotkeyPresetDrawers.Add(configDrawerEntryKey)) { ExpandedControllerHotkeyPresetDrawers.Remove(configDrawerEntryKey); } if (ExpandedControllerHotkeyPresetDrawers.Contains(configDrawerEntryKey)) { DrawControllerHotkeyPresetButtons(entry, controllerHotkeyAction); } GUILayout.EndVertical(); } private static void DrawControllerHotkeyStatus(ConfigEntryBase entry, ControllerHotkeyAction currentValue, bool isCapturing) { if (IsControllerDPadAction(currentValue)) { ConfigEntry controllerDPadHotkeyMode = _controllerDPadHotkeyMode; if (controllerDPadHotkeyMode == null || controllerDPadHotkeyMode.Value == ControllerDPadHotkeyMode.InventoryNavigation) { GUILayout.Label("DPad actions are ignored until Controller DPad Hotkey Mode allows hotkeys.", Array.Empty()); } } if (isCapturing) { ControllerHotkeyAction controllerHotkeyAction = TryCaptureControllerHotkeyAction(); if (controllerHotkeyAction != 0) { SetControllerHotkeyConfigValue(entry, controllerHotkeyAction); StopControllerHotkeyCapture(); } else { float num = Mathf.Max(0f, _controllerHotkeyCaptureEndTime - Time.unscaledTime); GUILayout.Label($"Listening for controller input... {num:0.0}s", Array.Empty()); } } } private static void DrawControllerHotkeyPresetButtons(ConfigEntryBase entry, ControllerHotkeyAction currentValue) { for (int i = 0; i < ControllerActionOptions.Length; i++) { if (i % 4 == 0) { GUILayout.BeginHorizontal(Array.Empty()); } ControllerActionOption controllerActionOption = ControllerActionOptions[i]; if (GUILayout.Button((currentValue == controllerActionOption.Action) ? ("* " + controllerActionOption.Label) : controllerActionOption.Label, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(88f) })) { SetControllerHotkeyConfigValue(entry, controllerActionOption.Action); } if (i % 4 == 3 || i == ControllerActionOptions.Length - 1) { GUILayout.EndHorizontal(); } } } private static ControllerHotkeyAction TryCaptureControllerHotkeyAction() { for (int i = 0; i < ControllerActionOptions.Length; i++) { ControllerHotkeyAction action = ControllerActionOptions[i].Action; if (action == ControllerHotkeyAction.Off) { continue; } try { if (ZInput.GetButtonDown(GetControllerHotkeyActionName(action))) { return action; } } catch { } } for (int j = 0; j <= 19; j++) { try { if (Input.GetKeyDown((KeyCode)(330 + j)) && UnityJoystickButtonToControllerAction.TryGetValue(j, out var value)) { return value; } } catch { return ControllerHotkeyAction.Off; } } return ControllerHotkeyAction.Off; } private static ControllerHotkeyAction GetControllerHotkeyConfigValue(ConfigEntryBase entry) { object boxedValue = entry.BoxedValue; if (boxedValue is ControllerHotkeyAction) { return (ControllerHotkeyAction)boxedValue; } return ControllerHotkeyAction.Off; } private static void SetControllerHotkeyConfigValue(ConfigEntryBase entry, ControllerHotkeyAction value) { if (!object.Equals(entry.BoxedValue, value)) { entry.BoxedValue = value; } } private static bool IsCapturingControllerHotkey(string entryKey) { if (!string.Equals(_controllerHotkeyCaptureEntryKey, entryKey, StringComparison.Ordinal)) { return false; } if (Time.unscaledTime <= _controllerHotkeyCaptureEndTime) { return true; } StopControllerHotkeyCapture(); return false; } private static void StartControllerHotkeyCapture(string entryKey) { _controllerHotkeyCaptureEntryKey = entryKey; _controllerHotkeyCaptureEndTime = Time.unscaledTime + 8f; } private static void StopControllerHotkeyCapture() { _controllerHotkeyCaptureEntryKey = ""; _controllerHotkeyCaptureEndTime = 0f; } private static string GetConfigDrawerEntryKey(ConfigEntryBase entry) { return entry.Definition.Section + "\n" + entry.Definition.Key; } private static void InvalidateCustomEquipmentProjectionCache() { _customEquipmentCacheVersion++; } private static IReadOnlyList GetCustomEquippedItems(Player player) { EnsureCustomEquipmentProjectionCache(player); return CustomEquippedItemsCache; } private static float GetCachedCustomEquipmentWeight(Player player) { EnsureCustomEquipmentProjectionCache(player); return _customEquipmentCacheWeight; } private static float GetCachedCustomEquipmentEitrRegen(Player player) { EnsureCustomEquipmentProjectionCache(player); return _customEquipmentCacheEitrRegen; } private static float GetCachedCustomEquipmentArmor(Player player) { EnsureCustomEquipmentProjectionCache(player); return _customEquipmentCacheArmor; } private static float[]? GetCachedCustomEquipmentModifierValues(Player player) { EnsureCustomEquipmentProjectionCache(player); return _customEquipmentModifierValuesCache; } private static int GetCachedCustomEquipmentSetCount(Player player, string setName) { EnsureCustomEquipmentProjectionCache(player); if (!CustomEquipmentSetCountCache.TryGetValue(setName, out var value)) { return 0; } return value; } private static void EnsureCustomEquipmentProjectionCache(Player player) { if ((Object)(object)player == (Object)null) { ClearCustomEquipmentProjectionCache(); return; } Inventory inventory = ((Humanoid)player).GetInventory(); string playerId = GetPlayerId(player); if (inventory != null && (Object)(object)_customEquipmentCachePlayer == (Object)(object)player && _customEquipmentCacheInventory == inventory && string.Equals(_customEquipmentCachePlayerId, playerId, StringComparison.Ordinal) && _customEquipmentCacheBuiltVersion == _customEquipmentCacheVersion) { return; } ClearCustomEquipmentProjectionCache(); _customEquipmentCachePlayer = player; _customEquipmentCacheInventory = inventory; _customEquipmentCachePlayerId = playerId; _customEquipmentCacheBuiltVersion = _customEquipmentCacheVersion; if (inventory == null) { return; } foreach (ItemData item in inventory.m_inventory) { if (item == null || !IsInventorySlotsCustomEquipped(item) || !item.m_customData.TryGetValue("InventorySlotsEquippedBy", out var value) || value != playerId) { continue; } CustomEquippedItemsCache.Add(item); if (item.m_shared != null) { _customEquipmentCacheWeight += item.m_shared.m_weight; _customEquipmentCacheEitrRegen += item.m_shared.m_eitrRegenModifier; if (item.m_shared.m_armor > 0f) { _customEquipmentCacheArmor += item.GetArmor(); } string setName = item.m_shared.m_setName; if (!string.IsNullOrEmpty(setName)) { CustomEquipmentSetCountCache.TryGetValue(setName, out var value2); CustomEquipmentSetCountCache[setName] = value2 + 1; } AddCachedCustomEquipmentModifierValues(item); } } } private static void AddCachedCustomEquipmentModifierValues(ItemData item) { FieldInfo[] s_equipmentModifierSourceFields = Player.s_equipmentModifierSourceFields; if (s_equipmentModifierSourceFields == null || item.m_shared == null) { return; } if (_customEquipmentModifierValuesCache == null || _customEquipmentModifierValuesCache.Length != s_equipmentModifierSourceFields.Length) { _customEquipmentModifierValuesCache = new float[s_equipmentModifierSourceFields.Length]; } for (int i = 0; i < s_equipmentModifierSourceFields.Length; i++) { if (s_equipmentModifierSourceFields[i].GetValue(item.m_shared) is float num) { _customEquipmentModifierValuesCache[i] += num; } } } private static void ClearCustomEquipmentProjectionCache() { CustomEquippedItemsCache.Clear(); CustomEquipmentSetCountCache.Clear(); _customEquipmentCachePlayer = null; _customEquipmentCacheInventory = null; _customEquipmentCachePlayerId = ""; _customEquipmentCacheBuiltVersion = -1; _customEquipmentCacheWeight = 0f; _customEquipmentCacheEitrRegen = 0f; _customEquipmentCacheArmor = 0f; if (_customEquipmentModifierValuesCache != null) { Array.Clear(_customEquipmentModifierValuesCache, 0, _customEquipmentModifierValuesCache.Length); } } internal static void PrepareCustomEquipmentStatusEffects(Humanoid humanoid, Player player) { EquipmentVisuals.StatusEffects.Clear(); EquipmentVisuals.StatusEffectLevels.Clear(); if ((Object)(object)humanoid == (Object)null || (Object)(object)player == (Object)null) { return; } foreach (ItemData customEquippedItem in GetCustomEquippedItems(player)) { PrepareCustomEquipmentStatusEffect(customEquippedItem.m_shared.m_equipStatusEffect, customEquippedItem.m_quality); if (humanoid.HaveSetEffect(customEquippedItem)) { PrepareCustomEquipmentStatusEffect(customEquippedItem.m_shared.m_setStatusEffect, customEquippedItem.m_quality); } } } private static void PrepareCustomEquipmentStatusEffect(StatusEffect? statusEffect, int itemLevel) { if (!IsUnityNull((Object?)(object)statusEffect)) { EquipmentVisuals.StatusEffects.Add(statusEffect); EquipmentVisuals.StatusEffectLevels.TryGetValue(statusEffect, out var value); EquipmentVisuals.StatusEffectLevels[statusEffect] = Math.Max(value, itemLevel); } } internal static void ApplyPreparedCustomEquipmentStatusEffects(Humanoid humanoid) { if ((Object)(object)humanoid == (Object)null) { ClearPreparedCustomEquipmentStatusEffects(); return; } foreach (StatusEffect statusEffect in EquipmentVisuals.StatusEffects) { if (!IsUnityNull((Object?)(object)statusEffect)) { EquipmentVisuals.StatusEffectLevels.TryGetValue(statusEffect, out var value); ((Character)humanoid).m_seman.AddStatusEffect(statusEffect, false, value, 0f); humanoid.m_equipmentStatusEffects.Add(statusEffect); } } ClearPreparedCustomEquipmentStatusEffects(); } internal static void ClearPreparedCustomEquipmentStatusEffects() { EquipmentVisuals.StatusEffects.Clear(); EquipmentVisuals.StatusEffectLevels.Clear(); } internal static bool ShouldPreventCustomEquipmentStatusRemoval(SEMan seMan, int nameHash) { if (nameHash == 0 || EquipmentVisuals.StatusEffects.Count == 0) { return false; } Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null || seMan != ((Character)localPlayer).m_seman) { return false; } return EquipmentVisuals.StatusEffects.Any((StatusEffect statusEffect) => !IsUnityNull((Object?)(object)statusEffect) && statusEffect.NameHash() == nameHash); } internal static float GetCustomEquipmentArmor(Player player) { if (!((Object)(object)player == (Object)null)) { return GetCachedCustomEquipmentArmor(player); } return 0f; } internal static void ApplyCustomEquipmentDamageModifiers(Player player, ref DamageModifiers modifiers) { if ((Object)(object)player == (Object)null) { return; } foreach (ItemData customEquippedItem in GetCustomEquippedItems(player)) { if (customEquippedItem?.m_shared != null && customEquippedItem.m_shared.m_damageModifiers.Count > 0) { ((DamageModifiers)(ref modifiers)).Apply(customEquippedItem.m_shared.m_damageModifiers); } } } internal static void UpdateCustomEquipmentVisuals(Player player) { if (IsDedicatedServer || IsUnityNull((Object?)(object)player) || player.m_isLoading) { if (!IsUnityNull((Object?)(object)((Humanoid)(player?)).m_visEquipment)) { ClearCustomEquipmentVisuals(((Humanoid)player).m_visEquipment); } return; } VisEquipment visEquipment = ((Humanoid)player).m_visEquipment; if (IsUnityNull((Object?)(object)visEquipment) || IsUnityNull((Object?)(object)ObjectDB.instance)) { if (!IsUnityNull((Object?)(object)visEquipment)) { ClearCustomEquipmentVisuals(visEquipment); } return; } Inventory inventory = ((Humanoid)player).GetInventory(); if (inventory == null) { ClearCustomEquipmentVisuals(visEquipment); return; } SyncBackpackCompatState(player); SyncMagicSupremacyCompatState(player); List states = BuildCustomEquipmentVisualStatesFromInventory(player, inventory, visEquipment); SuppressJewelcraftingNativeVisualSlots(player, inventory); ApplyCustomEquipmentVisualStates(visEquipment, states); } internal static void UpdateCustomEquipmentVisualsFromZdo(VisEquipment visEquipment) { //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) if (IsDedicatedServer || IsUnityNull((Object?)(object)visEquipment) || IsUnityNull((Object?)(object)ObjectDB.instance)) { return; } ZDO val = (((Object)(object)visEquipment.m_nview != (Object)null && visEquipment.m_nview.IsValid()) ? visEquipment.m_nview.GetZDO() : null); if (val == null) { ClearCustomEquipmentVisuals(visEquipment); return; } List list = new List(); foreach (SlotDefinition item in SlotDefinitions.Where((SlotDefinition slot) => slot.Kind == SlotKind.CustomEquipment)) { int @int = val.GetInt(GetCustomEquipmentVisualItemZdoKey(item.Id), 0); if (@int == 0) { continue; } GameObject itemPrefab = ObjectDB.instance.GetItemPrefab(@int); if (!IsUnityNull((Object?)(object)itemPrefab)) { ItemDrop component = itemPrefab.GetComponent(); if (!IsUnityNull((Object?)(object)component) && component.m_itemData?.m_shared != null && ShouldAttachCustomEquipmentVisual(component.m_itemData.m_shared.m_itemType)) { int int2 = val.GetInt(GetCustomEquipmentVisualVariantZdoKey(item.Id), 0); list.Add(new CustomEquipmentVisualState(item.Id, @int, int2, ((Object)itemPrefab).name, component.m_itemData.m_shared.m_itemType)); } } } ApplyCustomEquipmentVisualStates(visEquipment, list); } private static List BuildCustomEquipmentVisualStatesFromInventory(Player player, Inventory inventory, VisEquipment visEquipment) { //IL_008e: Unknown result type (might be due to invalid IL or missing references) List list = new List(); foreach (SlotDefinition item in SlotDefinitions.Where((SlotDefinition slot) => slot.Kind == SlotKind.CustomEquipment)) { ItemData val = FindItemForSlot(player, inventory, item); int itemHash = 0; int variant = 0; if (val != null && ShouldAttachCustomEquipmentVisual(val)) { itemHash = StringExtensionMethods.GetStableHashCode(((Object)val.m_dropPrefab).name); variant = val.m_variant; list.Add(new CustomEquipmentVisualState(item.Id, itemHash, variant, ((Object)val.m_dropPrefab).name, val.m_shared.m_itemType)); } SetCustomEquipmentVisualZdoValue(visEquipment, item.Id, itemHash, variant); } return list; } private static void ApplyCustomEquipmentVisualStates(VisEquipment visEquipment, IEnumerable states) { HashSet hashSet = new HashSet(StringComparer.Ordinal); bool flag = false; foreach (CustomEquipmentVisualState state in states) { string customEquipmentVisualKey = GetCustomEquipmentVisualKey(visEquipment, state); hashSet.Add(customEquipmentVisualKey); if (!EquipmentVisuals.Visuals.TryGetValue(customEquipmentVisualKey, out CustomEquipmentVisual value) || !value.Matches(visEquipment, state.PrefabName, state.Variant)) { value?.Destroy(); EquipmentVisuals.Visuals[customEquipmentVisualKey] = CreateCustomEquipmentVisual(visEquipment, state, customEquipmentVisualKey); flag = true; } } foreach (string item in EquipmentVisuals.Visuals.Keys.ToList()) { if (EquipmentVisuals.Visuals[item].IsOwnedBy(visEquipment) && !hashSet.Contains(item)) { EquipmentVisuals.Visuals[item].Destroy(); EquipmentVisuals.Visuals.Remove(item); flag = true; } } if (flag) { RefreshVisEquipmentLodGroup(visEquipment); } } internal static void ClearCustomEquipmentVisuals() { List list = (from visual in EquipmentVisuals.Visuals.Values select visual.Owner into owner where !IsUnityNull((Object?)(object)owner) select owner).Distinct().ToList(); foreach (CustomEquipmentVisual value in EquipmentVisuals.Visuals.Values) { value.Destroy(); } EquipmentVisuals.Visuals.Clear(); foreach (VisEquipment item in list) { RefreshVisEquipmentLodGroup(item); } } private static void ClearCustomEquipmentVisuals(VisEquipment visEquipment) { bool flag = false; foreach (string item in EquipmentVisuals.Visuals.Keys.ToList()) { if (EquipmentVisuals.Visuals[item].IsOwnedBy(visEquipment)) { EquipmentVisuals.Visuals[item].Destroy(); EquipmentVisuals.Visuals.Remove(item); flag = true; } } if (flag) { RefreshVisEquipmentLodGroup(visEquipment); } } private static void RefreshVisEquipmentLodGroup(VisEquipment visEquipment) { if (!IsUnityNull((Object?)(object)visEquipment) && !IsUnityNull((Object?)(object)visEquipment.m_lodGroup)) { visEquipment.UpdateLodgroup(); } } private static bool ShouldAttachCustomEquipmentVisual(ItemData item) { //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Invalid comparison between Unknown and I4 //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Invalid comparison between Unknown and I4 //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Invalid comparison between Unknown and I4 if (item?.m_shared == null || IsUnityNull((Object?)(object)item.m_dropPrefab)) { return false; } if (IsSmoothbrainBackpackItem(item)) { return false; } if (IsRustyBagItem(item) || IsRustyQuiverItem(item)) { return false; } if (IsMagicSupremacyBeltItem(item)) { return false; } ItemType itemType = item.m_shared.m_itemType; if ((int)itemType == 6 || itemType - 17 <= 1 || (int)itemType == 24) { return true; } return false; } private static bool ShouldAttachCustomEquipmentVisual(ItemType itemType) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Invalid comparison between Unknown and I4 //IL_0004: 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_0009: Invalid comparison between Unknown and I4 //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Invalid comparison between Unknown and I4 if ((int)itemType == 6 || itemType - 17 <= 1 || (int)itemType == 24) { return true; } return false; } private static string GetCustomEquipmentVisualKey(VisEquipment visEquipment, CustomEquipmentVisualState state) { return $"{((Object)visEquipment).GetInstanceID()}:{state.SlotId}:{state.ItemHash}"; } private static CustomEquipmentVisual CreateCustomEquipmentVisual(VisEquipment visEquipment, CustomEquipmentVisualState state, string key) { //IL_0015: 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_001b: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Invalid comparison between Unknown and I4 //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_0024: Invalid comparison between Unknown and I4 //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Invalid comparison between Unknown and I4 CustomEquipmentVisual customEquipmentVisual = new CustomEquipmentVisual(key, visEquipment, state.PrefabName, state.Variant); try { ItemType itemType = state.ItemType; if ((int)itemType != 6) { if (itemType - 17 <= 1 || (int)itemType == 24) { List instances = visEquipment.AttachArmor(state.ItemHash, state.Variant); customEquipmentVisual.AddRange(instances); } } else if (!IsUnityNull((Object?)(object)visEquipment.m_helmet)) { GameObject instance = visEquipment.AttachItem(state.ItemHash, state.Variant, visEquipment.m_helmet, true, false); customEquipmentVisual.Add(instance); } } catch (Exception ex) { Log.LogWarning((object)("Failed to attach custom equipment visual for " + state.PrefabName + ": " + ex.Message)); } return customEquipmentVisual; } internal static bool TryGetCustomEquipmentVisualRootsForApi(VisEquipment visEquipment, ItemData item, List roots) { roots.Clear(); if (IsUnityNull((Object?)(object)visEquipment) || item == null || IsUnityNull((Object?)(object)item.m_dropPrefab)) { return false; } string name = ((Object)item.m_dropPrefab).name; foreach (CustomEquipmentVisual value in EquipmentVisuals.Visuals.Values) { if (value.Matches(visEquipment, name, item.m_variant)) { value.AddActiveInstancesTo(roots); } } return roots.Count > 0; } private static void SetCustomEquipmentVisualZdoValue(VisEquipment visEquipment, string slotId, int itemHash, int variant) { if (IsUnityNull((Object?)(object)visEquipment) || (Object)(object)visEquipment.m_nview == (Object)null || !visEquipment.m_nview.IsValid() || !visEquipment.m_nview.IsOwner()) { return; } ZDO zDO = visEquipment.m_nview.GetZDO(); if (zDO != null) { int customEquipmentVisualItemZdoKey = GetCustomEquipmentVisualItemZdoKey(slotId); int customEquipmentVisualVariantZdoKey = GetCustomEquipmentVisualVariantZdoKey(slotId); if (zDO.GetInt(customEquipmentVisualItemZdoKey, 0) != itemHash) { zDO.Set(customEquipmentVisualItemZdoKey, itemHash, false); } if (zDO.GetInt(customEquipmentVisualVariantZdoKey, 0) != variant) { zDO.Set(customEquipmentVisualVariantZdoKey, variant, false); } } } private static int GetCustomEquipmentVisualItemZdoKey(string slotId) { return StringExtensionMethods.GetStableHashCode("InventorySlots_CustomEquipmentVisual_Item_" + slotId); } private static int GetCustomEquipmentVisualVariantZdoKey(string slotId) { return StringExtensionMethods.GetStableHashCode("InventorySlots_CustomEquipmentVisual_Variant_" + slotId); } private static void LayoutCraftingBottomControls(InventoryGui gui, RectTransform grid) { //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_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_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_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: 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_0130: 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_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) HideRecycleNReclaimHud(); if (CraftingRecipes.View.Count == 0 || FindCraftingRecipeViewIndex(gui.GetSelectedRecipeIndex(false)) < 0) { HideCraftingRedesignBottomControls(gui); HideCraftingSocketWarning(); if ((Object)(object)_craftingCountInputRect != (Object)null) { ((Component)_craftingCountInputRect).gameObject.SetActive(false); } MarkCraftingBottomControlsDirty(); return; } bool num = IsJewelcraftingSocketTabActive(gui); Vector2 craftingBottomControlsFixedOffset = CraftingBottomControlsFixedOffset; Vector2 val = default(Vector2); ((Vector2)(ref val))..ctor(136f, 42f); Vector2 val2 = default(Vector2); ((Vector2)(ref val2))..ctor(64f, 42f); Vector2 craftPosition = GetCraftingGridCenteredPosition(grid, 0, 8, val, 2) + craftingBottomControlsFixedOffset + CraftingCraftButtonFixedOffset; Vector2 countPosition = GetCraftingGridCenteredPosition(grid, 2, 8, val2) + craftingBottomControlsFixedOffset + CraftingCountInputFixedOffset; Vector2 requirementPosition = GetCraftingGridCellPosition(grid, 3, 8) + craftingBottomControlsFixedOffset; Vector2 requiredStationPosition = GetCraftingGridCellPosition(grid, 7, 8) + craftingBottomControlsFixedOffset; RectTransform countRect = (num ? null : EnsureCraftingCountInput(gui)); RectTransform upgradeProgressionRect = (num ? null : EnsureCraftingUpgradeProgression(gui)); List visibleCraftingRequirements = GetVisibleCraftingRequirements(gui); string craftingBottomControlsLayoutSignature = GetCraftingBottomControlsLayoutSignature(gui, grid, countRect, upgradeProgressionRect, visibleCraftingRequirements.Count); bool updateLayout = _craftingBottomControlsDirty || !string.Equals(_craftingBottomControlsSignature, craftingBottomControlsLayoutSignature, StringComparison.Ordinal); UpdateCraftingActionControls(gui, countRect, upgradeProgressionRect, craftPosition, countPosition, val, val2, updateLayout); UpdateCraftingStationAndWarningControls(gui, grid, requiredStationPosition, updateLayout); UpdateCraftingRequirementStrip(gui, requirementPosition, visibleCraftingRequirements, updateLayout); _craftingBottomControlsSignature = craftingBottomControlsLayoutSignature; _craftingBottomControlsDirty = false; } private static void HideCraftingRedesignBottomControls(InventoryGui gui) { SuppressCraftingRequiredStationLevelOriginalBackground(gui); if ((Object)(object)gui.m_craftButton != (Object)null) { ((Component)gui.m_craftButton).gameObject.SetActive(false); } Transform craftProgressPanel = gui.m_craftProgressPanel; RectTransform val = (RectTransform)(object)((craftProgressPanel is RectTransform) ? craftProgressPanel : null); if (val != null) { ((Component)val).gameObject.SetActive(false); } if ((Object)(object)gui.m_minStationLevelIcon != (Object)null) { ((Component)gui.m_minStationLevelIcon).gameObject.SetActive(false); } if ((Object)(object)gui.m_minStationLevelText != (Object)null) { ((Component)gui.m_minStationLevelText).gameObject.SetActive(false); } HideCraftingRequiredStationLevelTooltip(); if ((Object)(object)gui.m_itemCraftType != (Object)null) { ((Component)gui.m_itemCraftType).gameObject.SetActive(false); } HideCraftingSocketWarning(); if ((Object)(object)_craftingUpgradeProgressionRect != (Object)null) { ((Component)_craftingUpgradeProgressionRect).gameObject.SetActive(false); } HideCraftingVanillaRequirementSlots(gui); HideOwnedCraftingRequirementSlots(); MarkCraftingBottomControlsDirty(); } private static string GetCraftingBottomControlsLayoutSignature(InventoryGui gui, RectTransform grid, RectTransform? countRect, RectTransform? upgradeProgressionRect, int visibleRequirementCount) { //IL_0030: 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) return $"{((Object)gui.m_crafting).GetInstanceID()}|{((Object)grid).GetInstanceID()}|{grid.anchoredPosition.x:0.###}|{grid.anchoredPosition.y:0.###}|{GetUnityObjectId((Object?)(object)gui.m_craftButton)}|{GetUnityObjectId((Object?)(object)gui.m_craftProgressPanel)}|{GetUnityObjectId((Object?)(object)countRect)}|{GetUnityObjectId((Object?)(object)upgradeProgressionRect)}|{GetUnityObjectId((Object?)(object)gui.m_minStationLevelIcon)}|{GetUnityObjectId((Object?)(object)gui.m_minStationLevelText)}|{visibleRequirementCount}|ownedReq={CraftingRequirements.OwnedSlots.Count}|{64f:0.###}|{72f:0.###}|socket={IsJewelcraftingSocketTabActive(gui)}"; } private static List GetVisibleCraftingRequirements(InventoryGui gui) { //IL_0056: Unknown result type (might be due to invalid IL or missing references) CraftingRequirements.VisibleRequirements.Clear(); CraftingRequirements.VisibleRequirementCandidates.Clear(); Recipe recipe = ((RecipeDataPair)(ref gui.m_selectedRecipe)).Recipe; int selectedCraftingQuality = GetSelectedCraftingQuality(gui); if ((Object)(object)recipe == (Object)null || recipe.m_resources == null) { return CraftingRequirements.VisibleRequirements; } if (IsJewelcraftingSocketTabActive(gui) && ShouldHideJewelcraftingSocketRequirements(gui.m_selectedRecipe)) { return CraftingRequirements.VisibleRequirements; } Player localPlayer = Player.m_localPlayer; Requirement[] resources = recipe.m_resources; foreach (Requirement val in resources) { if (val != null && !((Object)(object)val.m_resItem == (Object)null) && val.GetAmount(selectedCraftingQuality) > 0 && (!recipe.m_requireOnlyOneIngredient || !((Object)(object)localPlayer != (Object)null) || val.m_resItem.m_itemData?.m_shared == null || localPlayer.IsKnownMaterial(val.m_resItem.m_itemData.m_shared.m_name))) { CraftingRequirements.VisibleRequirementCandidates.Add(val); } } int num = 0; if (CraftingRequirements.VisibleRequirementCandidates.Count > 4) { int num2 = Mathf.CeilToInt((float)CraftingRequirements.VisibleRequirementCandidates.Count / 4f); num = (int)Time.fixedTime % Mathf.Max(1, num2) * 4; } for (int j = num; j < CraftingRequirements.VisibleRequirementCandidates.Count; j++) { if (CraftingRequirements.VisibleRequirements.Count >= 4) { break; } CraftingRequirements.VisibleRequirements.Add(CraftingRequirements.VisibleRequirementCandidates[j]); } return CraftingRequirements.VisibleRequirements; } private static bool ShouldShowCraftingStatusHud(InventoryGui gui) { if (ShouldShowUpgradeCraftingStatusHud(gui)) { return true; } if (IsJewelcraftingSocketTabActive(gui)) { return true; } if (IsJewelcraftingGemcutterStationActive() && IsCraftingCraftTabSelected(gui)) { return IsJewelcraftingGemCuttingRecipe(((RecipeDataPair)(ref gui.m_selectedRecipe)).Recipe); } return false; } private static bool ShouldShowUpgradeCraftingStatusHud(InventoryGui gui) { if (gui.InUpradeTab() && !IsJewelcraftingSocketTabActive(gui) && !IsRecycleNReclaimReclaimTabActive(gui) && ((RecipeDataPair)(ref gui.m_selectedRecipe)).ItemData?.m_shared != null) { return (Object)(object)((RecipeDataPair)(ref gui.m_selectedRecipe)).Recipe != (Object)null; } return false; } private static void LayoutCraftingStatusHud(InventoryGui gui, RectTransform grid, bool updateLayout) { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: 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_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) string craftingStatusHudText = GetCraftingStatusHudText(gui); if (string.IsNullOrWhiteSpace(craftingStatusHudText)) { HideCraftingSocketWarning(); return; } RectTransform val = EnsureCraftingSocketWarning(gui); if (!((Object)(object)val == (Object)null) && !((Object)(object)_craftingSocketWarningText == (Object)null)) { Vector2 val2 = GetCraftingGridCellPosition(grid, 0, 9) + CraftingBottomControlsFixedOffset; Vector2 val3 = default(Vector2); ((Vector2)(ref val3))..ctor(568f, 58f); string text = $"{((Object)gui.m_crafting).GetInstanceID()}|{((Object)grid).GetInstanceID()}|{val2.x:0.###}|{val2.y:0.###}|{val3.x:0.###}|{val3.y:0.###}|{craftingStatusHudText}"; if (updateLayout || !string.Equals(_craftingSocketWarningSignature, text, StringComparison.Ordinal)) { SetCraftingTopLeftRect(gui.m_crafting, val, val2, val3); ConfigureCraftingSocketWarningText(_craftingSocketWarningText, craftingStatusHudText); _craftingSocketWarningSignature = text; } ((Transform)val).SetAsLastSibling(); ((Component)val).gameObject.SetActive(true); } } private static string GetCraftingStatusHudText(InventoryGui gui) { if (ShouldShowUpgradeCraftingStatusHud(gui)) { return GetUpgradeCraftingStatusText(gui); } return StripRichText(((Object)(object)gui.m_itemCraftType != (Object)null && !IsUnityNull((Object?)(object)gui.m_itemCraftType)) ? (gui.m_itemCraftType.text ?? "") : "").Trim(); } private static string GetUpgradeCraftingStatusText(InventoryGui gui) { ItemData itemData = ((RecipeDataPair)(ref gui.m_selectedRecipe)).ItemData; if (itemData?.m_shared == null) { return ""; } int num = Mathf.Max(1, itemData.m_quality); int num2 = Mathf.Max(num, itemData.m_shared.m_maxQuality); if (num >= num2) { if (Localization.instance == null) { return "Max quality"; } return Localization.instance.Localize("$inventory_maxquality"); } string localizedItemName = GetLocalizedItemName(itemData); string text = (num + 1).ToString(); if (Localization.instance == null) { return "Upgrade " + localizedItemName + " quality to " + text; } return Localization.instance.Localize("$inventory_upgrade", new string[2] { localizedItemName, text }); } private static RectTransform? EnsureCraftingSocketWarning(InventoryGui gui) { //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Expected O, but got Unknown if ((Object)(object)gui.m_crafting == (Object)null) { return null; } if ((Object)(object)_craftingSocketWarningRect != (Object)null && !IsUnityNull((Object?)(object)_craftingSocketWarningRect) && (Object)(object)((Transform)_craftingSocketWarningRect).parent == (Object)(object)gui.m_crafting) { return _craftingSocketWarningRect; } Transform val = ((Transform)gui.m_crafting).Find("InventorySlots_CraftingSocketWarning"); _craftingSocketWarningRect = (((Object)(object)val != (Object)null) ? ((Component)val).GetComponent() : null); if ((Object)(object)_craftingSocketWarningRect == (Object)null) { _craftingSocketWarningRect = new GameObject("InventorySlots_CraftingSocketWarning", new Type[1] { typeof(RectTransform) }).GetComponent(); } ((Transform)_craftingSocketWarningRect).SetParent((Transform)(object)gui.m_crafting, false); Image val2 = default(Image); if (((Component)_craftingSocketWarningRect).TryGetComponent(ref val2)) { ((Behaviour)val2).enabled = false; ((Graphic)val2).raycastTarget = false; } Transform val3 = ((Transform)_craftingSocketWarningRect).Find("Text"); RectTransform rect; if ((Object)(object)val3 != (Object)null) { TMP_Text component = ((Component)val3).GetComponent(); if (component != null) { rect = (RectTransform)val3; _craftingSocketWarningText = component; goto IL_011a; } } rect = CreateTextRect("Text", (Transform)(object)_craftingSocketWarningRect, out _craftingSocketWarningText); goto IL_011a; IL_011a: SetStretchRectLayoutCached(rect, new Vector2(12f, 5f), new Vector2(-12f, -5f), "crafting-socket-warning-text"); ConfigureCraftingSocketWarningText(_craftingSocketWarningText, _craftingSocketWarningText.text); return _craftingSocketWarningRect; } private static void ConfigureCraftingSocketWarningText(TMP_Text text, string warning) { //IL_0034: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)text == (Object)null) && !IsUnityNull((Object?)(object)text)) { ApplyDefaultFontAsset(text); text.text = warning; ((Graphic)text).color = new Color(1f, 0.72f, 0.28f, 1f); text.alignment = (TextAlignmentOptions)514; text.textWrappingMode = (TextWrappingModes)1; text.overflowMode = (TextOverflowModes)3; text.enableAutoSizing = true; text.fontSizeMin = 12f; text.fontSizeMax = 18f; ((Graphic)text).raycastTarget = false; } } private static void HideCraftingSocketWarning() { if ((Object)(object)_craftingSocketWarningRect != (Object)null && !IsUnityNull((Object?)(object)_craftingSocketWarningRect)) { ((Component)_craftingSocketWarningRect).gameObject.SetActive(false); } _craftingSocketWarningSignature = ""; } private static int GetSelectedCraftingQuality(InventoryGui gui) { if (IsJewelcraftingSocketTabActive(gui)) { return 1; } if (((RecipeDataPair)(ref gui.m_selectedRecipe)).ItemData != null) { return ((RecipeDataPair)(ref gui.m_selectedRecipe)).ItemData.m_quality + 1; } return 1; } private static Vector2 GetCraftingGridCellPosition(RectTransform grid, int column, int row) { //IL_0001: 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_001c: Unknown result type (might be due to invalid IL or missing references) return grid.anchoredPosition + new Vector2((float)column * 72f, (float)(-row) * 72f); } private static Vector2 GetCraftingGridCenteredPosition(RectTransform grid, int column, int row, Vector2 size, int columnSpan = 1) { //IL_001b: 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_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) float num = (float)(Mathf.Max(1, columnSpan) - 1) * 72f + 64f; return GetCraftingGridCellPosition(grid, column, row) + new Vector2((num - size.x) * 0.5f, (0f - (64f - size.y)) * 0.5f); } private static RectTransform? EnsureCraftingCountInput(InventoryGui gui) { //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_craftingCountInputRect != (Object)null && !IsUnityNull((Object?)(object)_craftingCountInputRect) && (Object)(object)((Transform)_craftingCountInputRect).parent == (Object)(object)gui.m_crafting) { return _craftingCountInputRect; } Transform val = ((Transform)gui.m_crafting).Find("InventorySlots_CraftingCountInput"); _craftingCountInputRect = (((Object)(object)val != (Object)null) ? ((Component)val).GetComponent() : null); if ((Object)(object)_craftingCountInputRect == (Object)null) { _craftingCountInputRect = new GameObject("InventorySlots_CraftingCountInput", new Type[3] { typeof(RectTransform), typeof(Image), typeof(TMP_InputField) }).GetComponent(); ((Transform)_craftingCountInputRect).SetParent((Transform)(object)gui.m_crafting, false); Image component = ((Component)_craftingCountInputRect).GetComponent(); component.sprite = GetSolidUiSprite(); ((Graphic)component).color = new Color(0f, 0f, 0f, 0.46f); ((Graphic)component).raycastTarget = true; RectTransform component2 = new GameObject("Text Area", new Type[2] { typeof(RectTransform), typeof(RectMask2D) }).GetComponent(); ((Transform)component2).SetParent((Transform)(object)_craftingCountInputRect, false); SetStretchRectLayoutCached(component2, new Vector2(22f, 3f), new Vector2(-4f, -3f), "crafting-count-input-viewport"); _craftingCountInputViewport = component2; SetStretchRectLayoutCached(CreateTextRect("Text", (Transform)(object)component2, out TMP_Text text), Vector2.zero, Vector2.zero, "crafting-count-input-text"); text.fontSize = 22f; text.alignment = (TextAlignmentOptions)514; ((Graphic)text).color = Color.white; text.textWrappingMode = (TextWrappingModes)0; _craftingCountInput = ((Component)_craftingCountInputRect).GetComponent(); _craftingCountInput.textViewport = component2; _craftingCountInput.textComponent = text; ((Selectable)_craftingCountInput).targetGraphic = (Graphic)(object)component; _craftingCountInput.contentType = (ContentType)2; _craftingCountInput.characterValidation = (CharacterValidation)2; _craftingCountInput.lineType = (LineType)0; _craftingCountInput.characterLimit = 2; _craftingCountInput.SetTextWithoutNotify("1"); ((UnityEvent)(object)_craftingCountInput.onEndEdit).AddListener((UnityAction)delegate(string value) { SetCraftingCount(ParseCraftingCount(value)); }); } else { _craftingCountInput = ((Component)_craftingCountInputRect).GetComponent(); TMP_InputField? craftingCountInput = _craftingCountInput; _craftingCountInputViewport = ((craftingCountInput != null) ? craftingCountInput.textViewport : null); if ((Object)(object)_craftingCountInputViewport == (Object)null || IsUnityNull((Object?)(object)_craftingCountInputViewport)) { Transform obj = ((Transform)_craftingCountInputRect).Find("Text Area"); _craftingCountInputViewport = (RectTransform?)(object)((obj is RectTransform) ? obj : null); } } EnsureCraftingCountWheelIcon(_craftingCountInputRect, locked: false); return _craftingCountInputRect; } private static RectTransform? EnsureCraftingUpgradeProgression(InventoryGui gui) { //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_craftingUpgradeProgressionRect != (Object)null && !IsUnityNull((Object?)(object)_craftingUpgradeProgressionRect) && (Object)(object)((Transform)_craftingUpgradeProgressionRect).parent == (Object)(object)gui.m_crafting) { return _craftingUpgradeProgressionRect; } Transform val = ((Transform)gui.m_crafting).Find("InventorySlots_CraftingUpgradeProgression"); _craftingUpgradeProgressionRect = (((Object)(object)val != (Object)null) ? ((Component)val).GetComponent() : null); if ((Object)(object)_craftingUpgradeProgressionRect == (Object)null) { _craftingUpgradeProgressionRect = new GameObject("InventorySlots_CraftingUpgradeProgression", new Type[3] { typeof(RectTransform), typeof(Image), typeof(UITooltip) }).GetComponent(); ((Transform)_craftingUpgradeProgressionRect).SetParent((Transform)(object)gui.m_crafting, false); Image component = ((Component)_craftingUpgradeProgressionRect).GetComponent(); component.sprite = GetSolidUiSprite(); ((Graphic)component).color = new Color(0f, 0f, 0f, 0.42f); ((Graphic)component).raycastTarget = true; SetStretchRectLayoutCached(CreateTextRect("Text", (Transform)(object)_craftingUpgradeProgressionRect, out _craftingUpgradeProgressionText), new Vector2(4f, 3f), new Vector2(-4f, -3f), "crafting-upgrade-progression-text"); _craftingUpgradeProgressionText.fontSize = 20f; _craftingUpgradeProgressionText.alignment = (TextAlignmentOptions)514; ((Graphic)_craftingUpgradeProgressionText).color = new Color(1f, 0.84f, 0.42f, 1f); _craftingUpgradeProgressionText.textWrappingMode = (TextWrappingModes)0; _craftingUpgradeProgressionText.overflowMode = (TextOverflowModes)0; ((Graphic)_craftingUpgradeProgressionText).raycastTarget = false; } else { Transform obj = ((Transform)_craftingUpgradeProgressionRect).Find("Text"); _craftingUpgradeProgressionText = ((obj != null) ? ((Component)obj).GetComponent() : null); } return _craftingUpgradeProgressionRect; } private static void UpdateCraftingUpgradeProgression(InventoryGui gui) { if ((Object)(object)_craftingUpgradeProgressionRect == (Object)null) { return; } ItemData itemData = ((RecipeDataPair)(ref gui.m_selectedRecipe)).ItemData; Recipe recipe = ((RecipeDataPair)(ref gui.m_selectedRecipe)).Recipe; bool flag = itemData?.m_shared != null && (Object)(object)recipe != (Object)null; ((Component)_craftingUpgradeProgressionRect).gameObject.SetActive(flag); if (!flag) { return; } int num = Mathf.Max(1, itemData.m_quality); int num2 = Mathf.Max(num, itemData.m_shared.m_maxQuality); int num3 = Mathf.Min(num + 1, num2); string text = ((num < num2) ? $"{num} > {num3}" : LocalizeUi("$inventoryslots_max", "Max")); if ((Object)(object)_craftingUpgradeProgressionText != (Object)null) { string text2 = $"{text}|{_craftingUpgradeProgressionText.fontSizeMax:0.###}"; CraftingTextCacheState craftingTextCache = GetCraftingTextCache(((Component)_craftingUpgradeProgressionRect).gameObject); if (!string.Equals(craftingTextCache.LastTextSignature, text2, StringComparison.Ordinal)) { ApplyDefaultFontAsset(_craftingUpgradeProgressionText); _craftingUpgradeProgressionText.text = text; _craftingUpgradeProgressionText.enableAutoSizing = true; _craftingUpgradeProgressionText.fontSizeMin = 10f; _craftingUpgradeProgressionText.fontSizeMax = 20f; craftingTextCache.LastTextSignature = text2; } } ConfigureSimpleTooltip(((Component)_craftingUpgradeProgressionRect).gameObject, GetLocalizedItemName(itemData) + " " + text, enabled: true); } private static void EnsureCraftingCountWheelIcon(RectTransform countRect, bool locked) { //IL_0016: 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_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_006a: 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_0080: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) RectTransform obj = EnsureHintImage(countRect, "InventorySlots_CraftingCountWheelIcon"); obj.anchorMin = new Vector2(0f, 0.5f); obj.anchorMax = new Vector2(0f, 0.5f); obj.pivot = new Vector2(0f, 0.5f); obj.anchoredPosition = new Vector2(5f, 0f); obj.sizeDelta = new Vector2(13f, 19f); ((Transform)obj).localScale = Vector3.one; ((Transform)obj).localRotation = Quaternion.identity; ((Transform)obj).SetAsLastSibling(); Image component = ((Component)obj).GetComponent(); component.sprite = GetMouseWheelHintSprite(); component.type = (Type)0; component.preserveAspect = true; ((Graphic)component).raycastTarget = false; ((Graphic)component).color = (locked ? new Color(0.68f, 0.88f, 1f, 0.32f) : new Color(0.68f, 0.88f, 1f, 0.82f)); RectTransform val = _craftingCountInputViewport; if ((Object)(object)val == (Object)null || IsUnityNull((Object?)(object)val) || (Object)(object)((Transform)val).parent != (Object)(object)countRect) { Transform obj2 = ((Transform)countRect).Find("Text Area"); val = (_craftingCountInputViewport = (RectTransform?)(object)((obj2 is RectTransform) ? obj2 : null)); } if ((Object)(object)val != (Object)null && !IsUnityNull((Object?)(object)val)) { SetStretchRectLayoutCached(val, new Vector2(22f, 3f), new Vector2(-4f, -3f), "crafting-count-input-viewport"); } } private static void UpdateCraftingRequiredStationLevel(InventoryGui gui, Vector2 anchoredPosition, bool updateLayout) { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Expected O, but got Unknown //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Expected O, but got Unknown //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0139: 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_0156: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_0288: Unknown result type (might be due to invalid IL or missing references) //IL_02ab: Unknown result type (might be due to invalid IL or missing references) //IL_028f: Unknown result type (might be due to invalid IL or missing references) Recipe recipe = ((RecipeDataPair)(ref gui.m_selectedRecipe)).Recipe; if ((Object)(object)gui.m_minStationLevelIcon == (Object)null || (Object)(object)gui.m_minStationLevelText == (Object)null) { return; } RectTransform val = (RectTransform)((Component)gui.m_minStationLevelIcon).transform; RectTransform val2 = (RectTransform)gui.m_minStationLevelText.transform; SuppressCraftingRequiredStationLevelOriginalBackground(gui, val, val2); if ((Object)(object)recipe == (Object)null) { ((Component)gui.m_minStationLevelIcon).gameObject.SetActive(false); ((Component)gui.m_minStationLevelText).gameObject.SetActive(false); HideCraftingRequiredStationLevelTooltip(); return; } int num = ((((RecipeDataPair)(ref gui.m_selectedRecipe)).ItemData == null) ? 1 : (((RecipeDataPair)(ref gui.m_selectedRecipe)).ItemData.m_quality + 1)); bool flag = num <= recipe.m_item.m_itemData.m_shared.m_maxQuality; CraftingStation requiredStation = recipe.GetRequiredStation(num); if ((Object)(object)requiredStation == (Object)null || !flag) { ((Component)gui.m_minStationLevelIcon).gameObject.SetActive(false); ((Component)gui.m_minStationLevelText).gameObject.SetActive(false); HideCraftingRequiredStationLevelTooltip(); return; } int requiredStationLevel = recipe.GetRequiredStationLevel(num); Vector2 val3 = anchoredPosition + new Vector2(10f, -10f); if (updateLayout) { SetCraftingTopLeftRect(gui.m_crafting, val, val3, new Vector2(44f, 44f)); SetCraftingTopLeftRect(gui.m_crafting, val2, val3 + new Vector2(0f, -24f), new Vector2(44f, 20f)); } if ((Object)(object)requiredStation.m_icon != (Object)null) { gui.m_minStationLevelIcon.sprite = requiredStation.m_icon; gui.m_minStationLevelIcon.overrideSprite = requiredStation.m_icon; } ((Graphic)gui.m_minStationLevelIcon).color = Color.white; ((Component)gui.m_minStationLevelIcon).gameObject.SetActive(true); ApplyDefaultFontAsset(gui.m_minStationLevelText); gui.m_minStationLevelText.text = requiredStationLevel.ToString(); gui.m_minStationLevelText.alignment = (TextAlignmentOptions)1028; gui.m_minStationLevelText.enableAutoSizing = true; gui.m_minStationLevelText.fontSizeMin = 12f; gui.m_minStationLevelText.fontSizeMax = 18f; CraftingStation val4 = (((Object)(object)Player.m_localPlayer != (Object)null) ? Player.m_localPlayer.GetCurrentCraftingStation() : null); bool flag2 = (Object)(object)val4 == (Object)null || val4.GetLevel(true) < requiredStationLevel; ((Graphic)gui.m_minStationLevelText).color = ((flag2 && !ZoneSystem.instance.GetGlobalKey((GlobalKeys)20) && Mathf.Sin(Time.time * 10f) > 0f) ? Color.red : gui.m_minStationLevelBasecolor); ((Component)gui.m_minStationLevelText).gameObject.SetActive(true); RectTransform val5 = EnsureCraftingRequiredStationLevelHitbox(gui, val3, 44f); if ((Object)(object)val5 != (Object)null) { ConfigureSimpleTooltip(((Component)val5).gameObject, GetCraftingStationDisplayName(requiredStation), enabled: true); } } private static RectTransform? EnsureCraftingRequiredStationLevelHitbox(InventoryGui gui, Vector2 iconPosition, float iconSize) { //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: 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) if ((Object)(object)gui.m_crafting == (Object)null) { return null; } RectTransform val = _craftingRequiredStationLevelHitbox; if ((Object)(object)val == (Object)null || IsUnityNull((Object?)(object)val) || (Object)(object)((Transform)val).parent != (Object)(object)gui.m_crafting) { Transform obj = ((Transform)gui.m_crafting).Find("InventorySlots_CraftingRequiredStationHitbox"); val = (RectTransform)(object)((obj is RectTransform) ? obj : null); if ((Object)(object)val == (Object)null || IsUnityNull((Object?)(object)val)) { val = new GameObject("InventorySlots_CraftingRequiredStationHitbox", new Type[2] { typeof(RectTransform), typeof(Image) }).GetComponent(); } _craftingRequiredStationLevelHitbox = val; } SetCraftingTopLeftRect(gui.m_crafting, val, iconPosition, new Vector2(iconSize, iconSize)); ((Component)val).gameObject.SetActive(true); Image obj2 = ((Component)val).GetComponent() ?? ((Component)val).gameObject.AddComponent(); obj2.sprite = GetSolidUiSprite(); ((Graphic)obj2).color = new Color(0f, 0f, 0f, 0f); ((Graphic)obj2).raycastTarget = true; if ((Object)(object)((Transform)val).parent != (Object)null && ((Transform)val).GetSiblingIndex() != ((Transform)val).parent.childCount - 1) { ((Transform)val).SetAsLastSibling(); } return val; } private static void HideCraftingRequiredStationLevelTooltip() { RectTransform craftingRequiredStationLevelHitbox = _craftingRequiredStationLevelHitbox; if ((Object)(object)craftingRequiredStationLevelHitbox == (Object)null || IsUnityNull((Object?)(object)craftingRequiredStationLevelHitbox)) { _craftingRequiredStationLevelHitbox = null; return; } ConfigureSimpleTooltip(((Component)craftingRequiredStationLevelHitbox).gameObject, "", enabled: false); ((Component)craftingRequiredStationLevelHitbox).gameObject.SetActive(false); } private static void SuppressCraftingRequiredStationLevelOriginalBackground(InventoryGui gui) { //IL_0029: 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_0043: Expected O, but got Unknown //IL_0043: Expected O, but got Unknown if (!((Object)(object)gui.m_minStationLevelIcon == (Object)null) && !((Object)(object)gui.m_minStationLevelText == (Object)null)) { SuppressCraftingRequiredStationLevelOriginalBackground(gui, (RectTransform)((Component)gui.m_minStationLevelIcon).transform, (RectTransform)gui.m_minStationLevelText.transform); } } private static void SuppressCraftingRequiredStationLevelOriginalBackground(InventoryGui gui, RectTransform iconRect, RectTransform textRect) { HideCraftingRequiredStationLevelOriginalBackground(gui, iconRect, textRect); } private static void HideCraftingRequiredStationLevelOriginalBackground(InventoryGui gui, RectTransform iconRect, RectTransform textRect) { if ((Object)(object)gui.m_crafting == (Object)null) { return; } if ((Object)(object)_craftingRequiredStationLevelOriginalRoot == (Object)null || IsUnityNull((Object?)(object)_craftingRequiredStationLevelOriginalRoot)) { _craftingRequiredStationLevelOriginalRoot = FindCraftingRequiredStationLevelOriginalRoot(gui, iconRect, textRect); } Transform craftingRequiredStationLevelOriginalRoot = _craftingRequiredStationLevelOriginalRoot; if ((Object)(object)craftingRequiredStationLevelOriginalRoot == (Object)null || IsUnityNull((Object?)(object)craftingRequiredStationLevelOriginalRoot) || (Object)(object)craftingRequiredStationLevelOriginalRoot == (Object)(object)gui.m_crafting || !craftingRequiredStationLevelOriginalRoot.IsChildOf((Transform)(object)gui.m_crafting)) { _craftingRequiredStationLevelOriginalRoot = FindCraftingRequiredStationLevelOriginalRoot(gui, iconRect, textRect); craftingRequiredStationLevelOriginalRoot = _craftingRequiredStationLevelOriginalRoot; if ((Object)(object)craftingRequiredStationLevelOriginalRoot == (Object)null || IsUnityNull((Object?)(object)craftingRequiredStationLevelOriginalRoot) || (Object)(object)craftingRequiredStationLevelOriginalRoot == (Object)(object)gui.m_crafting || !craftingRequiredStationLevelOriginalRoot.IsChildOf((Transform)(object)gui.m_crafting)) { _craftingRequiredStationLevelOriginalRoot = null; return; } } Image[] componentsInChildren = ((Component)craftingRequiredStationLevelOriginalRoot).GetComponentsInChildren(true); foreach (Image val in componentsInChildren) { if (!((Object)(object)val == (Object)null) && !IsUnityNull((Object?)(object)val) && !((Object)(object)val == (Object)(object)gui.m_minStationLevelIcon) && !IsOwnedCraftingUiTransform(((Component)val).transform)) { if (!CraftingVanillaPanelBackgroundStates.ContainsKey(val)) { CraftingVanillaPanelBackgroundStates[val] = ((Behaviour)val).enabled; } ((Behaviour)val).enabled = false; ((Graphic)val).raycastTarget = false; } } } private static Transform? FindCraftingRequiredStationLevelOriginalRoot(InventoryGui gui, RectTransform iconRect, RectTransform textRect) { Transform parent = ((Transform)iconRect).parent; Transform parent2 = ((Transform)textRect).parent; if ((Object)(object)parent != (Object)null && (Object)(object)parent != (Object)(object)gui.m_crafting && (Object)(object)parent2 != (Object)null && ((Object)(object)parent2 == (Object)(object)parent || parent2.IsChildOf(parent))) { return parent; } if ((Object)(object)parent2 != (Object)null && (Object)(object)parent2 != (Object)(object)gui.m_crafting && (Object)(object)parent != (Object)null && parent.IsChildOf(parent2)) { return parent2; } if (!((Object)(object)parent != (Object)null) || !((Object)(object)parent != (Object)(object)gui.m_crafting)) { return null; } return parent; } private static void UpdateCraftingCountInputState(InventoryGui gui) { //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)_craftingCountInput == (Object)null) && !((Object)(object)_craftingCountInputRect == (Object)null)) { bool flag = IsCraftingCountInputLocked(gui); ((Selectable)_craftingCountInput).interactable = !flag; _craftingCountInput.readOnly = flag; Image val = default(Image); if (((Component)_craftingCountInputRect).TryGetComponent(ref val)) { ((Graphic)val).color = (flag ? new Color(0f, 0f, 0f, 0.28f) : new Color(0f, 0f, 0f, 0.46f)); } EnsureCraftingCountWheelIcon(_craftingCountInputRect, flag); } } private static void UpdateCraftingCraftButtonLabel(InventoryGui gui) { if ((Object)(object)gui.m_craftButton == (Object)null || (Object)(object)((RecipeDataPair)(ref gui.m_selectedRecipe)).Recipe == (Object)null) { return; } string text = (IsJewelcraftingSocketTabActive(gui) ? LocalizeUi("$jc_add_socket_button", "Socket") : ((((RecipeDataPair)(ref gui.m_selectedRecipe)).ItemData != null) ? LocalizeUi("$inventory_upgradebutton", "Upgrade") : LocalizeUi("$inventory_craftbutton", "Craft"))); int effectiveCraftingCount = GetEffectiveCraftingCount(gui); if (((RecipeDataPair)(ref gui.m_selectedRecipe)).ItemData == null && effectiveCraftingCount > 1) { text = FormatCraftingCountLabel("$inventoryslots_craft_button_count_format", "{label} x{count}", text, effectiveCraftingCount); } CraftingTextCacheState craftingTextCache = GetCraftingTextCache(((Component)gui.m_craftButton).gameObject); string text2 = "craft|" + text + "|" + craftingTextCache.ChildSignature; if (string.Equals(craftingTextCache.LastTextSignature, text2, StringComparison.Ordinal) && TextCacheMatches(craftingTextCache, text)) { ApplyCraftingActionButtonTextStateColor(gui.m_craftButton, ((Selectable)gui.m_craftButton).interactable); return; } TMP_Text[] tmpTexts = craftingTextCache.TmpTexts; foreach (TMP_Text val in tmpTexts) { if (!((Object)(object)val == (Object)null) && !IsUnityNull((Object?)(object)val)) { ApplyDefaultFontAsset(val); if (val.text != text) { val.text = text; } } } Text[] legacyTexts = craftingTextCache.LegacyTexts; foreach (Text val2 in legacyTexts) { if ((Object)(object)val2 != (Object)null && !IsUnityNull((Object?)(object)val2) && val2.text != text) { val2.text = text; } } craftingTextCache.LastTextSignature = text2; SetActionButtonTextAutoSize(gui.m_craftButton); ApplyCraftingActionButtonTextStateColor(gui.m_craftButton, ((Selectable)gui.m_craftButton).interactable); } private static void UpdateJewelcraftingSocketCraftButtonState(InventoryGui gui) { //IL_0018: 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) if (IsJewelcraftingSocketTabActive(gui) && !((Object)(object)gui.m_craftButton == (Object)null)) { bool flag = CanAffordJewelcraftingSocketAttempt(gui.m_selectedRecipe); bool flag2 = CanAttemptJewelcraftingSocket(gui.m_selectedRecipe); ((Selectable)gui.m_craftButton).interactable = flag2; ApplyCraftingActionButtonTextStateColor(gui.m_craftButton, flag2); UITooltip component = ((Component)gui.m_craftButton).GetComponent(); if (!((Object)(object)component == (Object)null) && !IsUnityNull((Object?)(object)component)) { component.m_text = ((flag2 || flag) ? "" : LocalizeUi("$msg_missingrequirement", "Missing requirement")); } } } private static void ApplyCraftingActionButtonTextStateColor(Button button, bool interactable) { //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_002a: 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_0046: 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_007f: 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_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) Color craftingActionButtonTextStateColor = GetCraftingActionButtonTextStateColor(button, interactable); CraftingTextCacheState craftingTextCache = GetCraftingTextCache(((Component)button).gameObject); string text = $"{interactable}|{craftingActionButtonTextStateColor.r:0.###}|{craftingActionButtonTextStateColor.g:0.###}|{craftingActionButtonTextStateColor.b:0.###}|{craftingActionButtonTextStateColor.a:0.###}|{craftingTextCache.ChildSignature}"; if (string.Equals(craftingTextCache.LastColorSignature, text, StringComparison.Ordinal) && TextColorCacheMatches(craftingTextCache, craftingActionButtonTextStateColor)) { return; } TMP_Text[] tmpTexts = craftingTextCache.TmpTexts; foreach (TMP_Text val in tmpTexts) { if (!((Object)(object)val == (Object)null) && !IsUnityNull((Object?)(object)val) && !ColorsApproximatelyEqual(((Graphic)val).color, craftingActionButtonTextStateColor)) { ((Graphic)val).color = craftingActionButtonTextStateColor; } } Text[] legacyTexts = craftingTextCache.LegacyTexts; foreach (Text val2 in legacyTexts) { if (!((Object)(object)val2 == (Object)null) && !IsUnityNull((Object?)(object)val2) && !ColorsApproximatelyEqual(((Graphic)val2).color, craftingActionButtonTextStateColor)) { ((Graphic)val2).color = craftingActionButtonTextStateColor; } } craftingTextCache.LastColorSignature = text; } private static Color GetCraftingActionButtonTextStateColor(Button button, bool interactable) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0015: 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_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_004b: 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) ColorBlock colors = ((Selectable)button).colors; Color val = (interactable ? ((ColorBlock)(ref colors)).normalColor : ((ColorBlock)(ref colors)).disabledColor); if (interactable && Mathf.Max(new float[3] { val.r, val.g, val.b }) < 0.65f) { val = Color.white; } if (val.a < 0.25f) { val.a = 1f; } return val; } private static bool TextCacheMatches(CraftingTextCacheState cache, string label) { bool result = false; TMP_Text[] tmpTexts = cache.TmpTexts; foreach (TMP_Text val in tmpTexts) { if (!((Object)(object)val == (Object)null) && !IsUnityNull((Object?)(object)val)) { result = true; if (!string.Equals(val.text, label, StringComparison.Ordinal)) { return false; } } } Text[] legacyTexts = cache.LegacyTexts; foreach (Text val2 in legacyTexts) { if (!((Object)(object)val2 == (Object)null) && !IsUnityNull((Object?)(object)val2)) { result = true; if (!string.Equals(val2.text, label, StringComparison.Ordinal)) { return false; } } } return result; } private static bool TextColorCacheMatches(CraftingTextCacheState cache, Color color) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) bool result = false; TMP_Text[] tmpTexts = cache.TmpTexts; foreach (TMP_Text val in tmpTexts) { if (!((Object)(object)val == (Object)null) && !IsUnityNull((Object?)(object)val)) { result = true; if (!ColorsApproximatelyEqual(((Graphic)val).color, color)) { return false; } } } Text[] legacyTexts = cache.LegacyTexts; foreach (Text val2 in legacyTexts) { if (!((Object)(object)val2 == (Object)null) && !IsUnityNull((Object?)(object)val2)) { result = true; if (!ColorsApproximatelyEqual(((Graphic)val2).color, color)) { return false; } } } return result; } private static void UpdateCraftingProgressLabel(InventoryGui gui) { Transform craftProgressPanel = gui.m_craftProgressPanel; RectTransform val = (RectTransform)(object)((craftProgressPanel is RectTransform) ? craftProgressPanel : null); if (val == null || !((Component)val).gameObject.activeInHierarchy) { return; } CraftingTextCacheState craftingProgressTextCache = GetCraftingProgressTextCache(val); string text = GetCraftingProgressBaseLabel(craftingProgressTextCache); if (TryGetCraftingProgressLabelCount(gui, out var count)) { text = FormatCraftingCountLabel("$inventoryslots_crafting_progress_count_format", "{label} x{count}", text, count); } string text2 = "progress|" + text + "|" + craftingProgressTextCache.ChildSignature; if (string.Equals(craftingProgressTextCache.LastTextSignature, text2, StringComparison.Ordinal) && TextCacheMatches(craftingProgressTextCache, text)) { return; } TMP_Text[] tmpTexts = craftingProgressTextCache.TmpTexts; foreach (TMP_Text val2 in tmpTexts) { if (!((Object)(object)val2 == (Object)null) && !IsUnityNull((Object?)(object)val2)) { ApplyDefaultFontAsset(val2); if (val2.text != text) { val2.text = text; } val2.enableAutoSizing = true; val2.fontSizeMin = 10f; val2.fontSizeMax = Mathf.Min(Mathf.Max(val2.fontSizeMax, 14f), 18f); val2.alignment = (TextAlignmentOptions)514; } } Text[] legacyTexts = craftingProgressTextCache.LegacyTexts; foreach (Text val3 in legacyTexts) { if ((Object)(object)val3 != (Object)null && !IsUnityNull((Object?)(object)val3) && val3.text != text) { val3.text = text; } } craftingProgressTextCache.LastTextSignature = text2; } private static bool TryGetCraftingProgressLabelCount(InventoryGui gui, out int count) { count = 0; if (gui.m_craftTimer < 0f || (Object)(object)((RecipeDataPair)(ref gui.m_selectedRecipe)).Recipe == (Object)null || ((RecipeDataPair)(ref gui.m_selectedRecipe)).ItemData != null) { return false; } if (_craftingQueueTotal > 1 && (Object)(object)((RecipeDataPair)(ref gui.m_selectedRecipe)).Recipe == (Object)(object)_craftingQueueRecipe && gui.m_selectedVariant == _craftingQueueVariant) { int num = ((gui.m_craftTimer >= 0f) ? 1 : 0); count = Mathf.Clamp(_craftingQueueRemaining + num, 1, _craftingQueueTotal); return true; } if (gui.m_multiCrafting && gui.m_multiCraftAmount > 1) { count = Mathf.Clamp(gui.m_multiCraftAmount, 1, 99); return true; } if (_craftingProgressLabelCount > 1 && (Object)(object)((RecipeDataPair)(ref gui.m_selectedRecipe)).Recipe == (Object)(object)_craftingProgressLabelRecipe && gui.m_selectedVariant == _craftingProgressLabelVariant) { count = Mathf.Clamp(_craftingProgressLabelCount, 1, 99); return true; } int craftingCount = GetCraftingCount(); if (craftingCount <= 1) { return false; } count = craftingCount; return true; } private static CraftingTextCacheState GetCraftingProgressTextCache(RectTransform progressPanel) { CraftingTextCacheState craftingTextCache = GetCraftingTextCache(((Component)progressPanel).gameObject); Transform obj = ((Transform)progressPanel).Find("Text"); TMP_Text val = ((obj != null) ? ((Component)obj).GetComponent() : null); Transform obj2 = ((Transform)progressPanel).Find("Text"); Text val2 = ((obj2 != null) ? ((Component)obj2).GetComponent() : null); bool flag = false; if ((Object)(object)val != (Object)null && !IsUnityNull((Object?)(object)val) && !craftingTextCache.TmpTexts.Contains(val)) { craftingTextCache.TmpTexts = craftingTextCache.TmpTexts.Concat((IEnumerable)(object)new TMP_Text[1] { val }).ToArray(); flag = true; } if ((Object)(object)val2 != (Object)null && !IsUnityNull((Object?)(object)val2) && !craftingTextCache.LegacyTexts.Contains(val2)) { craftingTextCache.LegacyTexts = craftingTextCache.LegacyTexts.Concat((IEnumerable)(object)new Text[1] { val2 }).ToArray(); flag = true; } if (craftingTextCache.TmpTexts.Length == 0 && craftingTextCache.LegacyTexts.Length == 0) { TMP_Text val3 = EnsureCraftingProgressLabel(progressPanel); if ((Object)(object)val3 != (Object)null && !IsUnityNull((Object?)(object)val3)) { craftingTextCache.TmpTexts = (TMP_Text[])(object)new TMP_Text[1] { val3 }; flag = true; } } if (flag) { craftingTextCache.LastTextSignature = ""; craftingTextCache.ProgressBaseLabel = ""; } return craftingTextCache; } private static TMP_Text? EnsureCraftingProgressLabel(RectTransform progressPanel) { //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) Transform val = ((Transform)progressPanel).Find("Text"); if ((Object)(object)val != (Object)null) { TMP_Text component = ((Component)val).GetComponent(); if ((Object)(object)component != (Object)null && !IsUnityNull((Object?)(object)component)) { return component; } } RectTransform val2 = (RectTransform)(((object)((val is RectTransform) ? val : null)) ?? ((object)new GameObject("Text", new Type[1] { typeof(RectTransform) }).GetComponent())); ((Transform)val2).SetParent((Transform)(object)progressPanel, false); val2.anchorMin = Vector2.zero; val2.anchorMax = Vector2.one; val2.offsetMin = Vector2.zero; val2.offsetMax = Vector2.zero; ((Transform)val2).localScale = Vector3.one; object obj = ((object)((Component)val2).GetComponent()) ?? ((object)((Component)val2).gameObject.AddComponent()); ApplyDefaultFontAsset((TMP_Text?)obj); ((TMP_Text)obj).text = LocalizeUi("$inventory_crafting", "Crafting"); ((TMP_Text)obj).alignment = (TextAlignmentOptions)514; ((TMP_Text)obj).enableAutoSizing = true; ((TMP_Text)obj).fontSizeMin = 10f; ((TMP_Text)obj).fontSizeMax = 18f; ((Graphic)obj).raycastTarget = false; return (TMP_Text?)obj; } private static string GetCraftingProgressBaseLabel(CraftingTextCacheState cache) { if (!string.IsNullOrWhiteSpace(cache.ProgressBaseLabel)) { return cache.ProgressBaseLabel; } TMP_Text[] tmpTexts = cache.TmpTexts; foreach (TMP_Text val in tmpTexts) { if (!((Object)(object)val == (Object)null) && !IsUnityNull((Object?)(object)val)) { string text = StripCraftingProgressCounter(val.text); if (!string.IsNullOrWhiteSpace(text)) { cache.ProgressBaseLabel = text; return cache.ProgressBaseLabel; } } } Text[] legacyTexts = cache.LegacyTexts; foreach (Text val2 in legacyTexts) { if (!((Object)(object)val2 == (Object)null) && !IsUnityNull((Object?)(object)val2)) { string text2 = StripCraftingProgressCounter(val2.text); if (!string.IsNullOrWhiteSpace(text2)) { cache.ProgressBaseLabel = text2; return cache.ProgressBaseLabel; } } } cache.ProgressBaseLabel = LocalizeUi("$inventory_crafting", "Crafting"); return cache.ProgressBaseLabel; } private static string FormatCraftingCountLabel(string token, string fallback, string label, int count) { return LocalizeUi(token, fallback).Replace("{label}", label).Replace("{count}", count.ToString()); } private static string StripCraftingProgressCounter(string value) { value = value.Trim(); int num = value.LastIndexOf(' '); if (num <= 0) { return value; } if (IsCraftingProgressCounterSuffix(value.Substring(num + 1))) { return value.Substring(0, num); } return value; } private static bool IsCraftingProgressCounterSuffix(string suffix) { int num = suffix.IndexOf('/'); int result; if (num > 0 && num < suffix.Length - 1) { if (int.TryParse(suffix.Substring(0, num), out result)) { return int.TryParse(suffix.Substring(num + 1), out result); } return false; } if (suffix.Length > 1 && (suffix[0] == 'x' || suffix[0] == 'X')) { return int.TryParse(suffix.Substring(1), out result); } return false; } private static string LocalizeUi(string token, string fallback) { string text = ((Localization.instance != null) ? Localization.instance.Localize(token) : token); if (!string.IsNullOrWhiteSpace(text) && !(text == token)) { return text; } return fallback; } private static string GetRequirementDisplayName(Requirement requirement) { if ((Object)(object)requirement.m_resItem == (Object)null) { return ""; } ItemData itemData = requirement.m_resItem.m_itemData; return LocalizeUi(itemData.m_shared.m_name, itemData.m_shared.m_name); } private static string GetCraftingStationDisplayName(CraftingStation station) { if (!((Object)(object)station == (Object)null)) { return LocalizeUi(station.m_name, station.m_name); } return ""; } private static void ConfigureSimpleTooltip(GameObject target, string topic, bool enabled) { ConfigureSimpleTooltip(target, topic, "", enabled); } private static void ConfigureSimpleTooltip(GameObject target, string topic, string text, bool enabled) { if ((Object)(object)target == (Object)null || IsUnityNull((Object?)(object)target)) { return; } UITooltip component = target.GetComponent(); CraftingTooltipState craftingTooltipState = target.GetComponent() ?? target.AddComponent(); if (!enabled || string.IsNullOrWhiteSpace(topic)) { if (!string.IsNullOrEmpty(craftingTooltipState.Signature) || !((Object)(object)component == (Object)null)) { if ((Object)(object)component != (Object)null) { component.m_topic = ""; component.m_text = ""; ((Behaviour)component).enabled = false; } InventorySlotsSimpleTooltipHover component2 = target.GetComponent(); if ((Object)(object)component2 != (Object)null && !IsUnityNull((Object?)(object)component2)) { component2.Configure("", ""); } craftingTooltipState.Signature = ""; } } else { if ((Object)(object)component != (Object)null) { component.m_topic = ""; component.m_text = ""; ((Behaviour)component).enabled = false; } string text2 = topic + "|" + text; if (!string.Equals(craftingTooltipState.Signature, text2, StringComparison.Ordinal)) { (target.GetComponent() ?? target.AddComponent()).Configure(topic, text); craftingTooltipState.Signature = text2; } } } private static CraftingTextCacheState GetCraftingTextCache(GameObject root) { CraftingTextCacheState craftingTextCacheState = root.GetComponent() ?? root.AddComponent(); string text = root.transform.childCount.ToString(); if (string.Equals(craftingTextCacheState.ChildSignature, text, StringComparison.Ordinal) && !HasInvalidTextCache(craftingTextCacheState)) { return craftingTextCacheState; } craftingTextCacheState.ChildSignature = text; craftingTextCacheState.LastTextSignature = ""; craftingTextCacheState.LastColorSignature = ""; craftingTextCacheState.ProgressBaseLabel = ""; craftingTextCacheState.TmpTexts = root.GetComponentsInChildren(true); craftingTextCacheState.LegacyTexts = root.GetComponentsInChildren(true); return craftingTextCacheState; } private static bool HasInvalidTextCache(CraftingTextCacheState cache) { if (!cache.TmpTexts.Any((TMP_Text text) => (Object)(object)text == (Object)null || IsUnityNull((Object?)(object)text))) { return cache.LegacyTexts.Any((Text text) => (Object)(object)text == (Object)null || IsUnityNull((Object?)(object)text)); } return true; } private static bool IsCraftingCountInputLocked(InventoryGui? gui) { if (_craftingQueueRemaining <= 0) { if ((Object)(object)gui != (Object)null) { return gui.m_craftTimer >= 0f; } return false; } return true; } private static int GetUnityObjectId(Object? obj) { if (!(obj != (Object)null) || IsUnityNull(obj)) { return 0; } return obj.GetInstanceID(); } private static void SetCraftingTopLeftRect(RectTransform parent, RectTransform rect, Vector2 anchoredPosition, Vector2 size) { //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) SetTopLeftRectLayout(parent, rect, anchoredPosition, size); } private static void ConfigureCompactCraftingRequirement(InventoryGui gui, RectTransform rect, Requirement requirement, int quality, int craftMultiplier) { //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: 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_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: 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_021f: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0294: Unknown result type (might be due to invalid IL or missing references) //IL_0299: Unknown result type (might be due to invalid IL or missing references) //IL_02a2: Unknown result type (might be due to invalid IL or missing references) //IL_02df: Unknown result type (might be due to invalid IL or missing references) //IL_02c4: Unknown result type (might be due to invalid IL or missing references) CraftingRequirementUiMarker craftingRequirementUiMarker = GetCraftingRequirementUiMarker(rect); HideCraftingRequirementSlotBackground(craftingRequirementUiMarker); string text = $"{64f:0.###}"; bool flag = !string.Equals(craftingRequirementUiMarker.LayoutSignature, text, StringComparison.Ordinal); if ((Object)(object)craftingRequirementUiMarker.Name != (Object)null && !IsUnityNull((Object?)(object)craftingRequirementUiMarker.Name)) { ((Component)craftingRequirementUiMarker.Name).gameObject.SetActive(false); } if ((Object)(object)craftingRequirementUiMarker.Icon != (Object)null && !IsUnityNull((Object?)(object)craftingRequirementUiMarker.Icon)) { RectTransform icon = craftingRequirementUiMarker.Icon; ((Component)icon).gameObject.SetActive(true); if (flag) { icon.anchorMin = new Vector2(0f, 1f); icon.anchorMax = new Vector2(0f, 1f); icon.pivot = new Vector2(0f, 1f); icon.anchoredPosition = new Vector2(10f, -10f); icon.sizeDelta = new Vector2(44f, 44f); ((Transform)icon).localScale = Vector3.one; } if ((Object)(object)craftingRequirementUiMarker.IconImage != (Object)null && !IsUnityNull((Object?)(object)craftingRequirementUiMarker.IconImage)) { craftingRequirementUiMarker.IconImage.sprite = requirement.m_resItem.m_itemData.GetIcon(); ((Graphic)craftingRequirementUiMarker.IconImage).color = Color.white; ((Graphic)craftingRequirementUiMarker.IconImage).raycastTarget = false; } ConfigureSimpleTooltip(((Component)icon).gameObject, "", enabled: false); } if ((Object)(object)craftingRequirementUiMarker.Amount != (Object)null && !IsUnityNull((Object?)(object)craftingRequirementUiMarker.Amount)) { RectTransform amount = craftingRequirementUiMarker.Amount; ((Component)amount).gameObject.SetActive(true); if (flag) { amount.anchorMin = new Vector2(0.5f, 0f); amount.anchorMax = new Vector2(0.5f, 0f); amount.pivot = new Vector2(0.5f, 0f); amount.anchoredPosition = new Vector2(0f, 4f); amount.sizeDelta = new Vector2(60f, 20f); ((Transform)amount).localScale = Vector3.one; } if ((Object)(object)craftingRequirementUiMarker.AmountText != (Object)null && !IsUnityNull((Object?)(object)craftingRequirementUiMarker.AmountText)) { TMP_Text amountText = craftingRequirementUiMarker.AmountText; int num = Mathf.Max(0, requirement.GetAmount(quality) * Mathf.Max(1, craftMultiplier)); int availableCraftingRequirementAmount = GetAvailableCraftingRequirementAmount(requirement); bool availableEnough = HasNoCraftCost() || availableCraftingRequirementAmount >= num; string text2 = FormatCompactRequirementAmount(availableCraftingRequirementAmount, num); Color compactRequirementAmountColor = GetCompactRequirementAmountColor(availableEnough); string text3 = $"{text2}|{compactRequirementAmountColor}"; if (!string.Equals(craftingRequirementUiMarker.AmountSignature, text3, StringComparison.Ordinal) || !RequirementAmountTextMatches(amountText, text2, compactRequirementAmountColor)) { ApplyDefaultFontAsset(amountText); amountText.text = text2; ((Graphic)amountText).color = compactRequirementAmountColor; craftingRequirementUiMarker.AmountSignature = text3; } if (flag) { amountText.alignment = (TextAlignmentOptions)1026; amountText.enableAutoSizing = true; amountText.fontSizeMin = 10f; amountText.fontSizeMax = 16f; amountText.textWrappingMode = (TextWrappingModes)0; amountText.overflowMode = (TextOverflowModes)0; } } } RectTransform val = EnsureCraftingRequirementHitbox(rect, craftingRequirementUiMarker); DisableCompetingCraftingRequirementTooltips(rect, val, craftingRequirementUiMarker); ConfigureCraftingRequirementTooltip(gui, ((Component)val).gameObject, requirement, quality, craftMultiplier); craftingRequirementUiMarker.LayoutSignature = text; } private static void UpdateCraftingActionControls(InventoryGui gui, RectTransform? countRect, RectTransform? upgradeProgressionRect, Vector2 craftPosition, Vector2 countPosition, Vector2 craftButtonSize, Vector2 countInputSize, bool updateLayout) { //IL_00cb: 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_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Expected O, but got Unknown //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_craftingCountInputRect != (Object)null && (Object)(object)countRect == (Object)null) { ((Component)_craftingCountInputRect).gameObject.SetActive(false); } if ((Object)(object)_craftingUpgradeProgressionRect != (Object)null && (Object)(object)upgradeProgressionRect == (Object)null) { ((Component)_craftingUpgradeProgressionRect).gameObject.SetActive(false); } if ((Object)(object)gui.m_craftButton != (Object)null) { ((Component)gui.m_craftButton).gameObject.SetActive((Object)(object)((RecipeDataPair)(ref gui.m_selectedRecipe)).Recipe != (Object)null && gui.m_craftTimer < 0f); if (updateLayout) { RectTransform rect = (RectTransform)((Component)gui.m_craftButton).transform; SetCraftingTopLeftRect(gui.m_crafting, rect, craftPosition, craftButtonSize); } } Transform craftProgressPanel = gui.m_craftProgressPanel; RectTransform val = (RectTransform)(object)((craftProgressPanel is RectTransform) ? craftProgressPanel : null); if (val != null && updateLayout) { SetCraftingTopLeftRect(gui.m_crafting, val, craftPosition, craftButtonSize); GuiBar craftProgressBar = gui.m_craftProgressBar; if (craftProgressBar != null) { craftProgressBar.SetWidth(craftButtonSize.x); } } if ((Object)(object)countRect != (Object)null) { if (updateLayout) { SetCraftingTopLeftRect(gui.m_crafting, countRect, countPosition, countInputSize); } ((Component)countRect).gameObject.SetActive((Object)(object)((RecipeDataPair)(ref gui.m_selectedRecipe)).Recipe != (Object)null && ((RecipeDataPair)(ref gui.m_selectedRecipe)).ItemData == null); UpdateCraftingCountInputState(gui); } if ((Object)(object)upgradeProgressionRect != (Object)null) { if (updateLayout) { SetCraftingTopLeftRect(gui.m_crafting, upgradeProgressionRect, countPosition, countInputSize); } UpdateCraftingUpgradeProgression(gui); } UpdateCraftingCraftButtonLabel(gui); UpdateJewelcraftingSocketCraftButtonState(gui); UpdateCraftingProgressLabel(gui); } private static void UpdateCraftingStationAndWarningControls(InventoryGui gui, RectTransform grid, Vector2 requiredStationPosition, bool updateLayout) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) if (ShouldShowCraftingStatusHud(gui)) { LayoutCraftingStatusHud(gui, grid, updateLayout); } else { HideCraftingSocketWarning(); } UpdateCraftingRequiredStationLevel(gui, requiredStationPosition, updateLayout); } private static void UpdateCraftingRequirementStrip(InventoryGui gui, Vector2 requirementPosition, List visibleRequirements, bool updateLayout) { //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: 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) int selectedCraftingQuality = GetSelectedCraftingQuality(gui); int effectiveCraftingCount = GetEffectiveCraftingCount(gui); HideCraftingVanillaRequirementSlots(gui); int num = Mathf.Max(4, CraftingRequirements.OwnedSlots.Count); for (int i = 0; i < num; i++) { if (i >= 4 || i >= visibleRequirements.Count) { if (i < CraftingRequirements.OwnedSlots.Count) { RectTransform val = CraftingRequirements.OwnedSlots[i]; if (val != null && !IsUnityNull((Object?)(object)val)) { ((Component)val).gameObject.SetActive(false); } } } else { RectTransform val2 = EnsureOwnedCraftingRequirementSlot(gui, i); if (!((Object)(object)val2 == (Object)null) && !IsUnityNull((Object?)(object)val2)) { ((Component)val2).gameObject.SetActive(true); SetCraftingTopLeftRect(gui.m_crafting, val2, requirementPosition + new Vector2((float)i * 72f, 0f), new Vector2(64f, 64f)); ConfigureCompactCraftingRequirement(gui, val2, visibleRequirements[i], selectedCraftingQuality, effectiveCraftingCount); } } } } private static void BindCraftingClientConfigs() { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Expected O, but got Unknown //IL_0045: 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_0064: Expected O, but got Unknown //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Expected O, but got Unknown //IL_01b8: Unknown result type (might be due to invalid IL or missing references) _craftingRecipeGridSize = OrderedConfigEntry("3 - Client", "Crafting Recipe Grid Size", 6, new ConfigDescription("Recipe icon grid size inside the fixed 8x8 recipe area. 8 means 8x8 small icons; 4 means 4x4 large icons.", (AcceptableValueBase)(object)new AcceptableValueRange(4, 8), Array.Empty()), 590, synchronizedSetting: false); _craftingRecipeGridZoomModifier = ConfigEntry("4 - Client Keys", "Crafting Recipe Grid Zoom Modifier", new KeyboardShortcut((KeyCode)308, Array.Empty()), new ConfigDescription("Hold this key while using the mouse wheel over the crafting recipe grid to zoom between 8x8 and 4x4. Plain mouse wheel changes pages. Alt accepts both LeftAlt and RightAlt.", (AcceptableValueBase)(object)new AcceptableShortcuts(), Array.Empty()), synchronizedSetting: false); _craftingClearFavoritesKey = ConfigEntry("4 - Client Keys", "Clear Crafting Favorites Key", new KeyboardShortcut((KeyCode)325, Array.Empty()), new ConfigDescription("Key used while hovering the favorite group icon to clear crafting or upgrade favorites for the current crafting tab.", (AcceptableValueBase)(object)new AcceptableShortcuts(), Array.Empty()), synchronizedSetting: false); _showCraftingRecipeGridZoomHint = OrderedConfigEntry("3 - Client", "Show Crafting Recipe Grid Zoom Hint", Toggle.On, "Show the Alt + mouse wheel hint above the crafting recipe grid. Not synced with server.", 580, synchronizedSetting: false); _craftingRecipeGridSize.SettingChanged += delegate { InvalidateCraftingRecipeGridLayout(); InvalidateCraftingRecipeGridZoomHint(); }; _craftingRecipeGridZoomModifier.SettingChanged += delegate { InvalidateCraftingRecipeGridZoomHint(); }; _craftingClearFavoritesKey.SettingChanged += delegate { MarkCraftingGroupRailDirty(); }; _showCraftingRecipeGridZoomHint.SettingChanged += delegate { InvalidateCraftingRecipeGridZoomHint(); }; _craftingRecipeSortMode = OrderedConfigEntry("3 - Client", "Crafting Recipe Sort Mode", CraftingRecipeSortMode.TierThenGroup, "Sorting mode used by crafting station recipe grids. Crafting still keeps favorites and craftable recipes first. TierThenGroup sorts biome/resource tier first, then predefined group. GroupThenTier sorts predefined group first, then biome/resource tier.", 530, synchronizedSetting: false); _craftingRecipeSortMode.SettingChanged += delegate { _craftingSortModeButtonsSignature = ""; InvalidateCraftingRecipeView(); }; _craftingRecipeCraftableBackgroundColor = OrderedConfigEntry("3 - Client", "Craftable Recipe Background Color", CraftingRecipeDefaultCraftableBackgroundColor, "Advanced color for recipe grid cells that can currently be crafted. Not synced with server.", 510, synchronizedSetting: false); _craftingRecipeCraftableBackgroundColor.SettingChanged += delegate { InvalidateCraftingRecipeGridLayout(); }; } private static bool TryToggleCraftingRecipeFavorite(int originalIndex) { //IL_004a: Unknown result type (might be due to invalid IL or missing references) if (IsRecycleNReclaimReclaimTabActive(InventoryGui.instance)) { return false; } if (!AreFavoritesEnabled() || !IsFavoriteModifierHeld()) { return false; } InventoryGui instance = InventoryGui.instance; Player localPlayer = Player.m_localPlayer; if ((Object)(object)instance == (Object)null || (Object)(object)localPlayer == (Object)null || !TryGetCraftingRecipePair(instance, originalIndex, out var pair)) { return true; } ToggleCraftingRecipeFavorite(localPlayer, pair); InvalidateCraftingRecipeView(); UpdateCraftingRecipeView(instance); EnsureSelectedCraftingRecipeVisible(instance); UpdateCraftingPanelRedesign(instance, CraftingPanelUpdateReason.StateChanged); return true; } private static void ToggleCraftingRecipeFavorite(Player player, RecipeDataPair pair) { //IL_0006: 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) EnsureCraftingFavoritesLoaded(player); bool flag = IsUpgradeFavoritePair(pair); string text = (flag ? GetOrCreateUpgradeFavoriteItemKey(((RecipeDataPair)(ref pair)).ItemData) : GetCraftingRecipeFavoriteKey(pair)); if (string.IsNullOrWhiteSpace(text)) { return; } HashSet hashSet = (flag ? FavoriteUpgradeItemKeys : FavoriteCraftingRecipeKeys); if (!hashSet.Add(text)) { hashSet.Remove(text); if (flag && ((RecipeDataPair)(ref pair)).ItemData != null) { RemoveUpgradeFavoriteItemKey(((RecipeDataPair)(ref pair)).ItemData); Inventory inventory = ((Humanoid)player).GetInventory(); if (inventory != null) { inventory.Changed(); } } } else if (flag) { Inventory inventory2 = ((Humanoid)player).GetInventory(); if (inventory2 != null) { inventory2.Changed(); } } _craftingFavoritesVersion++; ClearCraftingGroupAvailabilityCache(); SaveCraftingFavorites(player); } private static bool ClearCraftingFavorites(Player? player, bool upgradeFavorites) { if (!AreFavoritesEnabled() || (Object)(object)player == (Object)null) { return false; } EnsureCraftingFavoritesLoaded(player); HashSet hashSet = (upgradeFavorites ? FavoriteUpgradeItemKeys : FavoriteCraftingRecipeKeys); if (hashSet.Count == 0) { return false; } if (upgradeFavorites) { RemoveUpgradeFavoriteItemKeysFromInventory(player, hashSet); } hashSet.Clear(); _craftingFavoritesVersion++; ClearCraftingGroupAvailabilityCache(); SaveCraftingFavorites(player); return true; } private static bool IsFavoriteCraftingRecipe(RecipeDataPair pair) { //IL_0021: 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) if (!AreFavoritesEnabled()) { return false; } if (IsRecycleNReclaimReclaimTabActive(InventoryGui.instance)) { return false; } EnsureCraftingFavoritesLoaded(Player.m_localPlayer); if (IsUpgradeFavoritePair(pair)) { string upgradeFavoriteItemKey = GetUpgradeFavoriteItemKey(((RecipeDataPair)(ref pair)).ItemData); if (!string.IsNullOrWhiteSpace(upgradeFavoriteItemKey)) { return FavoriteUpgradeItemKeys.Contains(upgradeFavoriteItemKey); } return false; } string craftingRecipeFavoriteKey = GetCraftingRecipeFavoriteKey(pair); if (!string.IsNullOrWhiteSpace(craftingRecipeFavoriteKey)) { return FavoriteCraftingRecipeKeys.Contains(craftingRecipeFavoriteKey); } return false; } private static bool IsUpgradeFavoritePair(RecipeDataPair pair) { return ((RecipeDataPair)(ref pair)).ItemData != null; } private static string GetCraftingRecipeFavoriteKey(RecipeDataPair pair) { ItemDrop val = (((Object)(object)((RecipeDataPair)(ref pair)).Recipe != (Object)null) ? ((RecipeDataPair)(ref pair)).Recipe.m_item : null); if ((Object)(object)val == (Object)null) { return ""; } string text = (((Object)(object)val.m_itemData.m_dropPrefab != (Object)null) ? ((Object)val.m_itemData.m_dropPrefab).name : ((Object)val).name); return CleanPrefabName((!string.IsNullOrWhiteSpace(text)) ? text : val.m_itemData.m_shared.m_name); } private static string GetUpgradeFavoriteItemKey(ItemData? item) { return UpgradeFavoriteCore.GetItemId(item?.m_customData, "InventorySlotsUpgradeFavoriteId"); } private static string GetOrCreateUpgradeFavoriteItemKey(ItemData? item) { if (item == null) { return ""; } if (item.m_customData == null) { item.m_customData = new Dictionary(); } return UpgradeFavoriteCore.GetOrCreateItemId(item.m_customData, "InventorySlotsUpgradeFavoriteId", FavoriteUpgradeItemKeys, () => Guid.NewGuid().ToString("N")); } private static void SetUpgradeFavoriteItemKey(ItemData? item, string id) { if (item != null && !string.IsNullOrWhiteSpace(id)) { if (item.m_customData == null) { item.m_customData = new Dictionary(); } UpgradeFavoriteCore.SetItemId(item.m_customData, "InventorySlotsUpgradeFavoriteId", id); } } private static void RemoveUpgradeFavoriteItemKey(ItemData? item) { UpgradeFavoriteCore.RemoveItemId(item?.m_customData, "InventorySlotsUpgradeFavoriteId"); } private static void RemoveUpgradeFavoriteItemKeysFromInventory(Player player, HashSet favoriteKeys) { Inventory inventory = ((Humanoid)player).GetInventory(); if (inventory == null) { return; } bool flag = false; foreach (ItemData item in inventory.m_inventory.Where((ItemData item) => item?.m_customData != null)) { string upgradeFavoriteItemKey = GetUpgradeFavoriteItemKey(item); if (!string.IsNullOrWhiteSpace(upgradeFavoriteItemKey) && favoriteKeys.Contains(upgradeFavoriteItemKey)) { UpgradeFavoriteCore.RemoveItemId(item.m_customData, "InventorySlotsUpgradeFavoriteId"); flag = true; } } if (flag) { inventory.Changed(); } } private static void EnsureCraftingFavoritesLoaded(Player? player) { if (!AreFavoritesEnabled() || (Object)(object)player == (Object)null) { return; } string playerId = GetPlayerId(player); if (string.Equals(_loadedCraftingFavoritesPlayerId, playerId, StringComparison.Ordinal)) { return; } FavoriteCraftingRecipeKeys.Clear(); FavoriteUpgradeItemKeys.Clear(); _loadedCraftingFavoritesPlayerId = playerId; _craftingFavoritesVersion++; ClearCraftingGroupAvailabilityCache(); try { InventorySlotsClientPlayerState clientPlayerState = GetClientPlayerState(playerId, create: false); if (clientPlayerState == null) { return; } foreach (string item in clientPlayerState.CraftingFavorites.Where((string recipe) => !string.IsNullOrWhiteSpace(recipe))) { FavoriteCraftingRecipeKeys.Add(item.Trim()); } foreach (string item2 in clientPlayerState.UpgradeFavorites.Where((string itemId) => !string.IsNullOrWhiteSpace(itemId))) { FavoriteUpgradeItemKeys.Add(item2.Trim()); } _craftingFavoritesVersion++; ClearCraftingGroupAvailabilityCache(); } catch (Exception ex) { Log.LogWarning((object)("Failed to load InventorySlots crafting favorites from " + ClientStateFilePath + ": " + ex.Message)); } } private static void SaveCraftingFavorites(Player player) { if ((Object)(object)player == (Object)null) { return; } string playerId = (_loadedCraftingFavoritesPlayerId = GetPlayerId(player)); try { InventorySlotsClientPlayerState? clientPlayerState = GetClientPlayerState(playerId, create: true); clientPlayerState.CraftingFavorites = FavoriteCraftingRecipeKeys.OrderBy((string recipe) => recipe, StringComparer.OrdinalIgnoreCase).ToList(); clientPlayerState.UpgradeFavorites = FavoriteUpgradeItemKeys.OrderBy((string itemId) => itemId, StringComparer.OrdinalIgnoreCase).ToList(); SaveClientState(); } catch (Exception ex) { Log.LogWarning((object)("Failed to save InventorySlots crafting favorites: " + ex.Message)); } } internal static void CaptureUpgradeFavoriteBeforeCrafting(InventoryGui gui) { //IL_0022: 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_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) _pendingUpgradeFavoriteItemId = ""; _pendingUpgradeFavoritePrefab = ""; _pendingUpgradeFavoriteQuality = -1; _pendingUpgradeFavoriteVariant = -1; _pendingUpgradeFavoriteGridPos = new Vector2i(-1, -1); ItemData val = gui?.m_craftUpgradeItem; string upgradeFavoriteItemKey = GetUpgradeFavoriteItemKey(val); if (val?.m_shared != null && !string.IsNullOrWhiteSpace(upgradeFavoriteItemKey)) { _pendingUpgradeFavoriteItemId = upgradeFavoriteItemKey; _pendingUpgradeFavoritePrefab = GetItemPrefabName(val); _pendingUpgradeFavoriteQuality = val.m_quality + 1; _pendingUpgradeFavoriteVariant = val.m_variant; _pendingUpgradeFavoriteGridPos = val.m_gridPos; } } internal static void RestoreUpgradeFavoriteAfterCrafting(InventoryGui gui, Player player) { string pendingUpgradeFavoriteItemId = _pendingUpgradeFavoriteItemId; if (string.IsNullOrWhiteSpace(pendingUpgradeFavoriteItemId)) { return; } _pendingUpgradeFavoriteItemId = ""; Inventory val = ((player != null) ? ((Humanoid)player).GetInventory() : null); ItemData val2 = ((val != null) ? val.GetItemAt(_pendingUpgradeFavoriteGridPos.x, _pendingUpgradeFavoriteGridPos.y) : null); if (!IsPendingUpgradeFavoriteItem(val2)) { val2 = ((IEnumerable)val?.m_inventory).FirstOrDefault((Func)IsPendingUpgradeFavoriteItem); } if (val2 != null) { SetUpgradeFavoriteItemKey(val2, pendingUpgradeFavoriteItemId); if (val != null) { val.Changed(); } _craftingFavoritesVersion++; ClearCraftingGroupAvailabilityCache(); InvalidateCraftingRecipeView(); if ((Object)(object)gui != (Object)null) { UpdateCraftingPanelRedesign(gui, CraftingPanelUpdateReason.StateChanged); } } } private static bool IsPendingUpgradeFavoriteItem(ItemData? item) { if (item?.m_shared != null && item.m_quality == _pendingUpgradeFavoriteQuality && item.m_variant == _pendingUpgradeFavoriteVariant) { return string.Equals(GetItemPrefabName(item), _pendingUpgradeFavoritePrefab, StringComparison.OrdinalIgnoreCase); } return false; } private static bool TryRunCraftingPanelFrameFastPath(InventoryGui gui, CraftingTabAdapterState adapter) { if (!CanRunCraftingPanelFrameFastPath()) { return false; } string craftingFrameFastPathSignature = GetCraftingFrameFastPathSignature(gui, adapter); if (!string.Equals(_craftingFrameFastPathSignature, craftingFrameFastPathSignature, StringComparison.Ordinal)) { _craftingFrameFastPathSignature = craftingFrameFastPathSignature; return false; } RectTransform craftingRecipeGrid = _craftingRecipeGrid; if ((Object)(object)craftingRecipeGrid == (Object)null || IsUnityNull((Object?)(object)craftingRecipeGrid)) { return false; } if (HandleCraftingPanelFastPathInput(gui, craftingRecipeGrid)) { return false; } RefreshCraftingPanelDynamicFrameUi(gui, craftingRecipeGrid, adapter); return true; } private static bool CanRunCraftingPanelFrameFastPath() { if (_craftingRedesignApplied && (Object)(object)_craftingRecipeGrid != (Object)null && !IsUnityNull((Object?)(object)_craftingRecipeGrid) && !HasCraftingPanelRebuildWork() && !CraftingUi.SearchInputDirty && (Object)(object)_craftingQueueRecipe == (Object)null) { return !_continuingCraftingQueue; } return false; } private static bool HasCraftingPanelRebuildWork() { if (!_craftingRecipeViewDirty && !_craftingRecipeGridDirty && !_craftingRecipeScrollbarDirty && !_craftingGroupRailDirty) { return _craftingBottomControlsDirty; } return true; } private static bool HandleCraftingPanelFastPathInput(InventoryGui gui, RectTransform grid) { if (HandleCraftingCountWheel()) { MarkCraftingBottomControlsDirty(); return true; } HandleCraftingGroupFavoriteClearShortcut(); if (HasCraftingPanelRebuildWork()) { return true; } if (!HandleCraftingPinnedTooltipWheel() && !HandleCraftingHoverTooltipWheel() && !HandleCraftingRecipeGridZoomWheel(gui, grid) && !HandleCraftingRecipeGridWheel(gui, grid)) { return HasCraftingPanelRebuildWork(); } return true; } private static void RefreshCraftingPanelDynamicFrameUi(InventoryGui gui, RectTransform grid, CraftingTabAdapterState adapter) { SuppressCraftingTabAdapterFrameResidue(gui, adapter); LayoutCraftingTabAdapterBottomControls(gui, grid, adapter); UpdateCraftingRecipeGridZoomHint(gui, grid); UpdateCraftingTooltipRecipeOverlay(gui); if (HasActiveCraftingPinnedTooltip()) { RepairCraftingPinnedTooltipTextVisibility(); } } private static void StoreCraftingFrameFastPathSignature(InventoryGui gui, CraftingTabAdapterState adapter) { if (!_craftingRedesignApplied || (Object)(object)_craftingRecipeGrid == (Object)null || IsUnityNull((Object?)(object)_craftingRecipeGrid) || HasCraftingPanelRebuildWork() || CraftingUi.SearchInputDirty || (Object)(object)_craftingQueueRecipe != (Object)null || _continuingCraftingQueue) { _craftingFrameFastPathSignature = ""; } else { _craftingFrameFastPathSignature = GetCraftingFrameFastPathSignature(gui, adapter); } } private static string GetCraftingFrameFastPathSignature(InventoryGui gui, CraftingTabAdapterState adapter) { InventoryGui gui2 = gui; RectTransform craftingRecipeGrid = _craftingRecipeGrid; int selectedCraftingRecipeIndexSafe = GetSelectedCraftingRecipeIndexSafe(gui2); return string.Join("|", ((Object)gui2).GetInstanceID(), ((Object)(object)gui2.m_crafting != (Object)null && !IsUnityNull((Object?)(object)gui2.m_crafting)) ? ((Object)gui2.m_crafting).GetInstanceID().ToString() : "0", ((Object)(object)craftingRecipeGrid != (Object)null && !IsUnityNull((Object?)(object)craftingRecipeGrid)) ? ((Object)craftingRecipeGrid).GetInstanceID().ToString() : "0", adapter.Kind.ToString(), SafeReadBool(() => gui2.InCraftTab()), SafeReadBool(() => gui2.InUpradeTab()), GetCraftingRecipeViewSignature(gui2), selectedCraftingRecipeIndexSafe.ToString(), _craftingRecipePage.ToString(), GetCraftingRecipeGridDimension().ToString(), CraftingRequirements.AvailabilityVersion.ToString(), HasNoCraftCost().ToString(), GetCraftingPinnedTooltipGridSignature(), _craftingRecipeVariantVersion.ToString(), _craftingFavoritesVersion.ToString(), _selectedCraftingGroupId, _craftingSearchQuery, CraftingController.HoveredRecipeIndex.ToString(), Screen.width.ToString(), Screen.height.ToString()); } private static bool HasActiveCraftingPinnedTooltip() { for (int i = 0; i < PinnedTooltips.Crafting.Panels.Length; i++) { RectTransform val = PinnedTooltips.Crafting.Panels[i]; if ((Object)(object)val != (Object)null && !IsUnityNull((Object?)(object)val) && ((Component)val).gameObject.activeInHierarchy) { return true; } } return false; } private static bool HandleCraftingRecipeGridWheel(InventoryGui gui, RectTransform grid) { if (IsCraftingRecipeGridZoomModifierHeld()) { return false; } int craftingRecipePageCount = GetCraftingRecipePageCount(gui); bool flag = IsCraftingRecipeGridScrollTargetActive(grid); float uiScrollDelta = GetUiScrollDelta(UiScrollInputMode.Discrete); if (craftingRecipePageCount <= 1 || !flag) { return false; } if (Mathf.Abs(uiScrollDelta) < 0.01f) { return false; } int num = ((uiScrollDelta < 0f) ? 1 : (-1)); int craftingRecipePage = _craftingRecipePage; _craftingRecipePage = Mathf.Clamp(_craftingRecipePage + num, 0, craftingRecipePageCount - 1); if (_craftingRecipePage == craftingRecipePage) { return false; } CraftingController.ClearHoveredRecipe(); InvalidateCraftingRecipeGridLayout(); int num2 = _craftingRecipePage * GetCraftingRecipeGridCapacity(); if (num2 >= 0 && num2 < CraftingRecipes.View.Count) { SetCraftingRecipeWithStoredVariant(gui, CraftingRecipes.View[num2].OriginalIndex, center: false); } return true; } private static bool HandleCraftingRecipeGridZoomWheel(InventoryGui gui, RectTransform grid) { bool num = IsCraftingRecipeGridScrollTargetActive(grid); bool flag = IsCraftingRecipeGridZoomModifierHeld(); float uiScrollDelta = GetUiScrollDelta(UiScrollInputMode.Discrete); if (!num) { return false; } if (!flag || Mathf.Abs(uiScrollDelta) < 0.01f) { return false; } int craftingRecipeGridDimension = GetCraftingRecipeGridDimension(); int num2 = Mathf.Clamp(craftingRecipeGridDimension + ((!(uiScrollDelta > 0f)) ? 1 : (-1)), 4, 8); if (num2 == craftingRecipeGridDimension) { return true; } if (_craftingRecipeGridSize != null) { _craftingRecipeGridSize.Value = num2; } int num3 = FindCraftingRecipeViewIndex(gui.GetSelectedRecipeIndex(false)); if (num3 >= 0) { _craftingRecipePage = Mathf.Clamp(num3 / GetCraftingRecipeGridCapacity(), 0, Mathf.Max(0, GetCraftingRecipePageCount(gui) - 1)); } else { ClampCraftingRecipePage(gui); } EnsureCraftingRecipeCells(gui, grid); InvalidateCraftingRecipeGridLayout(); MarkCraftingRecipeScrollbarDirty(); CraftingController.ClearHoveredRecipe(); return true; } private static bool IsCraftingRecipeGridScrollTargetActive(RectTransform grid) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) if (!RectContainsCraftingRecipeIconArea(grid, GetUiMousePosition())) { return IsGamepadUiScrollActive(); } return true; } private static bool IsCraftingRecipeGridZoomModifierHeld() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) if (_craftingRecipeGridZoomModifier == null || !IsShortcutHeldAllowingAltPair(_craftingRecipeGridZoomModifier.Value)) { return IsGamepadCraftingRecipeGridZoomModifierHeld(); } return true; } private static bool IsGamepadCraftingRecipeGridZoomModifierHeld() { if (!IsGamepadActiveSafe()) { return false; } try { return IsControllerHotkeyHeld(_controllerCraftingGridZoomModifierButton); } catch { return false; } } private static void InvalidateCraftingRecipeGridZoomHint() { CraftingController.InvalidateRecipeGridZoomHint(); } private static void UpdateCraftingRecipeGridZoomHint(InventoryGui gui, RectTransform grid) { //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004a: 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_0171: 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_0178: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_020a: Unknown result type (might be due to invalid IL or missing references) //IL_021a: Unknown result type (might be due to invalid IL or missing references) //IL_0324: Unknown result type (might be due to invalid IL or missing references) //IL_0326: Unknown result type (might be due to invalid IL or missing references) //IL_034c: Unknown result type (might be due to invalid IL or missing references) //IL_0353: Expected O, but got Unknown //IL_041a: Unknown result type (might be due to invalid IL or missing references) //IL_0453: Unknown result type (might be due to invalid IL or missing references) //IL_0468: Unknown result type (might be due to invalid IL or missing references) //IL_047d: Unknown result type (might be due to invalid IL or missing references) //IL_0492: Unknown result type (might be due to invalid IL or missing references) //IL_049f: Unknown result type (might be due to invalid IL or missing references) //IL_04aa: Unknown result type (might be due to invalid IL or missing references) //IL_04b5: Unknown result type (might be due to invalid IL or missing references) //IL_04ea: Unknown result type (might be due to invalid IL or missing references) //IL_0372: Unknown result type (might be due to invalid IL or missing references) //IL_0388: Unknown result type (might be due to invalid IL or missing references) //IL_039e: Unknown result type (might be due to invalid IL or missing references) //IL_03aa: Unknown result type (might be due to invalid IL or missing references) //IL_03ba: Unknown result type (might be due to invalid IL or missing references) //IL_03c6: Unknown result type (might be due to invalid IL or missing references) //IL_03d2: Unknown result type (might be due to invalid IL or missing references) //IL_0289: Unknown result type (might be due to invalid IL or missing references) //IL_0298: Unknown result type (might be due to invalid IL or missing references) //IL_02a7: Unknown result type (might be due to invalid IL or missing references) //IL_02ac: Unknown result type (might be due to invalid IL or missing references) //IL_02ae: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)gui?.m_crafting == (Object)null) && !((Object)(object)grid == (Object)null) && _showCraftingRecipeGridZoomHint != null && !_showCraftingRecipeGridZoomHint.Value.IsOff() && _craftingRecipeGridZoomModifier != null) { KeyboardShortcut value = _craftingRecipeGridZoomModifier.Value; if ((int)((KeyboardShortcut)(ref value)).MainKey != 0) { string craftingRecipeGridZoomModifierDisplayText = GetCraftingRecipeGridZoomModifierDisplayText(); if (string.IsNullOrWhiteSpace(craftingRecipeGridZoomModifierDisplayText)) { CraftingController.InvalidateRecipeGridZoomHint(); SetHintActive(CraftingUi.RecipeGridZoomHint, active: false); return; } CraftingUi.RecipeGridZoomHint = EnsureInventoryHintLabel(gui.m_crafting, "InventorySlots_CraftingRecipeGridZoomHint", ref CraftingUi.RecipeGridZoomHintText); if ((Object)(object)CraftingUi.RecipeGridZoomHint == (Object)null || (Object)(object)CraftingUi.RecipeGridZoomHintText == (Object)null) { return; } float num = 16f; float num2 = Mathf.Clamp(num * 1.35f, 14f, 42f); float num3 = Mathf.Max(10f, num2 * 0.72f); float num4 = 16f; string text = craftingRecipeGridZoomModifierDisplayText + "+"; float num5 = Mathf.Max(num2, num * 1.45f); float num6 = Mathf.Ceil(Mathf.Max(num * 1.4f, CraftingUi.RecipeGridZoomHintText.GetPreferredValues(text, 1000f, num2).x + 1f)); float num7 = num6 + num4 + num3; Vector2 val = default(Vector2); ((Vector2)(ref val))..ctor(num7, num5); Vector2 craftingRecipeGridZoomHintPosition = GetCraftingRecipeGridZoomHintPosition(grid, val); string text2 = $"v2|{((Object)gui.m_crafting).GetInstanceID()}|{((Object)grid).GetInstanceID()}|{grid.anchoredPosition.x:0.###}|{grid.anchoredPosition.y:0.###}|{text}|{num:0.###}|{num3:0.###}|{num2:0.###}|{num4:0.###}|{craftingRecipeGridZoomHintPosition.x:0.###}|{craftingRecipeGridZoomHintPosition.y:0.###}|{InventoryWheelHintColor}"; if (((Component)CraftingUi.RecipeGridZoomHint).gameObject.activeSelf && string.Equals(CraftingUi.RecipeGridZoomHintSignature, text2, StringComparison.Ordinal) && (Object)(object)((Transform)CraftingUi.RecipeGridZoomHint).parent == (Object)(object)gui.m_crafting && RectLayoutMatches(CraftingUi.RecipeGridZoomHint, new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), craftingRecipeGridZoomHintPosition, val)) { ((Transform)CraftingUi.RecipeGridZoomHint).SetAsLastSibling(); return; } CraftingUi.RecipeGridZoomHintText.text = text; CraftingUi.RecipeGridZoomHintText.fontSize = num; if ((Object)(object)((Transform)CraftingUi.RecipeGridZoomHint).parent != (Object)(object)gui.m_crafting) { ((Transform)CraftingUi.RecipeGridZoomHint).SetParent((Transform)(object)gui.m_crafting, false); } SetCenteredRectLayout(CraftingUi.RecipeGridZoomHint, craftingRecipeGridZoomHintPosition, val); ((Transform)CraftingUi.RecipeGridZoomHint).SetAsLastSibling(); RectTransform val2 = (RectTransform)CraftingUi.RecipeGridZoomHintText.transform; if ((Object)(object)val2 != (Object)(object)CraftingUi.RecipeGridZoomHint) { val2.anchorMin = new Vector2(0f, 0.5f); val2.anchorMax = new Vector2(0f, 0.5f); val2.pivot = new Vector2(0f, 0.5f); val2.anchoredPosition = Vector2.zero; val2.sizeDelta = new Vector2(num6, num5); ((Transform)val2).localScale = Vector3.one; ((Transform)val2).localRotation = Quaternion.identity; } CraftingUi.RecipeGridZoomHintText.alignment = (TextAlignmentOptions)513; CraftingUi.RecipeGridZoomHintText.textWrappingMode = (TextWrappingModes)0; CraftingUi.RecipeGridZoomHintText.overflowMode = (TextOverflowModes)0; ((Graphic)CraftingUi.RecipeGridZoomHintText).color = InventoryWheelHintColor; ((Graphic)CraftingUi.RecipeGridZoomHintText).raycastTarget = false; RectTransform obj = EnsureHintImage(CraftingUi.RecipeGridZoomHint, "MouseWheelIcon"); obj.anchorMin = new Vector2(0f, 0.5f); obj.anchorMax = new Vector2(0f, 0.5f); obj.pivot = new Vector2(0f, 0.5f); obj.anchoredPosition = new Vector2(num6 + num4, 0f); obj.sizeDelta = new Vector2(num3, num2); ((Transform)obj).localScale = Vector3.one; ((Transform)obj).localRotation = Quaternion.identity; ((Transform)obj).SetAsLastSibling(); Image component = ((Component)obj).GetComponent(); component.sprite = GetMouseWheelHintSprite(); component.type = (Type)0; component.preserveAspect = true; ((Graphic)component).raycastTarget = false; ((Graphic)component).color = InventoryWheelHintColor; CraftingUi.RecipeGridZoomHintSignature = text2; SetHintActive(CraftingUi.RecipeGridZoomHint, active: true); return; } } CraftingController.InvalidateRecipeGridZoomHint(); SetHintActive(CraftingUi.RecipeGridZoomHint, active: false); } private static Vector2 GetCraftingRecipeGridZoomHintPosition(RectTransform grid, Vector2 size) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) return CraftingRecipeGridZoomHintFixedOffset; } private static string GetCraftingRecipeGridZoomModifierDisplayText() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) if (_craftingRecipeGridZoomModifier == null) { return ""; } string displayText = _craftingRecipeGridZoomModifier.Value.GetDisplayText(); if (string.IsNullOrWhiteSpace(displayText)) { return ""; } return displayText.Replace("LeftAlt", "Alt").Replace("RightAlt", "Alt").Replace("LeftControl", "Ctrl") .Replace("RightControl", "Ctrl") .Replace("LeftShift", "Shift") .Replace("RightShift", "Shift") .Replace("Left Alt", "Alt") .Replace("Right Alt", "Alt") .Replace("Left Control", "Ctrl") .Replace("Right Control", "Ctrl") .Replace("Left Shift", "Shift") .Replace("Right Shift", "Shift") .Replace(" + ", "+") .Replace("+ ", "+") .Replace(" +", "+"); } private static void SyncCraftingRecipePageToSelected(InventoryGui gui) { int selectedRecipeIndex = gui.GetSelectedRecipeIndex(false); if (selectedRecipeIndex < 0) { int craftingRecipePage = _craftingRecipePage; _craftingRecipePage = 0; if (_craftingRecipePage != craftingRecipePage) { InvalidateCraftingRecipeGridLayout(); } return; } int num = FindCraftingRecipeViewIndex(selectedRecipeIndex); int craftingRecipePage2 = _craftingRecipePage; _craftingRecipePage = ((num >= 0) ? Mathf.Clamp(num / GetCraftingRecipeGridCapacity(), 0, Mathf.Max(0, GetCraftingRecipePageCount(gui) - 1)) : 0); if (_craftingRecipePage != craftingRecipePage2) { InvalidateCraftingRecipeGridLayout(); } } private static void ClampCraftingRecipePage(InventoryGui gui) { int craftingRecipePage = _craftingRecipePage; _craftingRecipePage = Mathf.Clamp(_craftingRecipePage, 0, Mathf.Max(0, GetCraftingRecipePageCount(gui) - 1)); if (_craftingRecipePage != craftingRecipePage) { InvalidateCraftingRecipeGridLayout(); } } private static int GetCraftingRecipePageCount(InventoryGui gui) { int count = CraftingRecipes.View.Count; if (count > 0) { return Mathf.CeilToInt((float)count / (float)GetCraftingRecipeGridCapacity()); } return 1; } private static void LayoutCraftingRecipeGrid(InventoryGui gui, RectTransform grid) { //IL_00fd: Unknown result type (might be due to invalid IL or missing references) int craftingRecipeGridDimension = GetCraftingRecipeGridDimension(); int num = _craftingRecipePage * GetCraftingRecipeGridCapacity(); int selectedRecipeIndex = gui.GetSelectedRecipeIndex(false); int craftingRecipeGridAvailabilityHash = GetCraftingRecipeGridAvailabilityHash(gui, num); string text = $"{craftingRecipeGridDimension}|{num}|{selectedRecipeIndex}|{craftingRecipeGridAvailabilityHash}|{GetCraftingPinnedTooltipGridSignature()}|{CraftingRecipes.View.Count}|{_craftingRecipeVariantVersion}"; if (!_craftingRecipeGridDirty && string.Equals(_craftingRecipeGridSignature, text, StringComparison.Ordinal)) { return; } EnsureCraftingRecipeCells(gui, grid); for (int i = 0; i < CraftingRecipes.GridCells.Count; i++) { CraftingRecipeGridCell cell = CraftingRecipes.GridCells[i]; int num2 = num + i; if (num2 < 0 || num2 >= CraftingRecipes.View.Count) { SetCraftingRecipeCellVisible(cell, visible: false); continue; } CraftingRecipeViewEntry craftingRecipeViewEntry = CraftingRecipes.View[num2]; ConfigureCraftingRecipeCell(gui, cell, craftingRecipeViewEntry.Pair, craftingRecipeViewEntry.OriginalIndex, i, IsCraftingRecipeTooltipPinned(craftingRecipeViewEntry.OriginalIndex), craftingRecipeViewEntry.OriginalIndex == selectedRecipeIndex); } _craftingRecipeGridSignature = text; _craftingRecipeGridDirty = false; } private static void SetCraftingRecipeCellVisible(CraftingRecipeGridCell cell, bool visible) { if (!visible) { ClearCurrentCraftingRecipeTooltip(cell.Tooltip); } if ((Object)(object)cell.Go != (Object)null && !IsUnityNull((Object?)(object)cell.Go)) { cell.Go.SetActive(visible); } } private static void ConfigureCraftingRecipeCell(InventoryGui gui, CraftingRecipeGridCell cell, RecipeDataPair pair, int index, int slotIndex, bool tooltipPinned, bool craftingSelected) { //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: 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_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: 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_01da: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)cell.Go == (Object)null || IsUnityNull((Object?)(object)cell.Go)) { return; } cell.Go.SetActive(true); RectTransform rect = cell.Rect; int craftingRecipeGridDimension = GetCraftingRecipeGridDimension(); float craftingRecipeDynamicCellSpace = GetCraftingRecipeDynamicCellSpace(); float craftingRecipeDynamicCellSize = GetCraftingRecipeDynamicCellSize(craftingRecipeDynamicCellSpace); int num = slotIndex % craftingRecipeGridDimension; int num2 = slotIndex / craftingRecipeGridDimension; rect.anchorMin = new Vector2(0f, 1f); rect.anchorMax = new Vector2(0f, 1f); rect.pivot = new Vector2(0f, 1f); rect.sizeDelta = new Vector2(craftingRecipeDynamicCellSize, craftingRecipeDynamicCellSize); rect.anchoredPosition = new Vector2((float)num * craftingRecipeDynamicCellSpace, (float)(-num2) * craftingRecipeDynamicCellSpace); ((Transform)rect).localScale = Vector3.one; ((Transform)rect).localRotation = Quaternion.identity; ConfigureCraftingRecipeCellOverlays(cell, craftingRecipeDynamicCellSize); if ((Object)(object)cell.Background != (Object)null) { bool flag = IsCraftingRecipeActionAvailable(gui, pair, index); ((Graphic)cell.Background).raycastTarget = true; ((Graphic)cell.Background).color = (craftingSelected ? CraftingRecipeSelectedBackgroundColor : (flag ? GetCraftingRecipeCraftableBackgroundColor() : CraftingRecipeUnavailableBackgroundColor)); } ConfigureCraftingRecipeCellIcon(cell.Icon, pair, craftingRecipeDynamicCellSize); ConfigureCraftingRecipeCellAmountText(cell.Amount, GetCraftingRecipeCellAmountText(gui, pair), craftingRecipeDynamicCellSize); ConfigureCraftingRecipeCellQualityText(cell.Quality, (((RecipeDataPair)(ref pair)).ItemData != null) ? ((RecipeDataPair)(ref pair)).ItemData.m_quality.ToString() : "", craftingRecipeDynamicCellSize); ConfigureCraftingRecipeStyleButton(gui, cell, pair, index, craftingRecipeDynamicCellSize); SetCraftingRecipeCellChild(cell.Selected, active: false); SetCraftingRecipeCellChild(cell.Equipped, active: false); SetCraftingRecipeCellChild(cell.Queued, active: false); SetCraftingRecipeCellChild(cell.NoTeleport, active: false); SetCraftingRecipeCellChild(cell.Food, active: false); SetCraftingRecipeCellChild(cell.Durability, active: false); SetCraftingRecipeFavoriteBorder(cell, IsFavoriteCraftingRecipe(pair), IsUpgradeFavoritePair(pair)); SetCraftingRecipeSelectedBorder(cell, active: false); SetCraftingRecipePinnedTooltipMarker(cell, tooltipPinned, craftingRecipeDynamicCellSize); ConfigureCraftingRecipeVneiTooltip(cell.Tooltip, pair); CraftingRecipeGridMarker marker = cell.Marker; marker.Index = index; marker.Tooltip = cell.Tooltip; if (!marker.Initialized) { UIInputHandler input = cell.Input; input.m_onPointerEnter = (Action)Delegate.Combine(input.m_onPointerEnter, (Action)delegate(UIInputHandler handler) { CraftingRecipeGridMarker component4 = ((Component)handler).GetComponent(); SetCraftingRecipeHover(component4?.Index ?? (-1), component4?.Tooltip); }); input.m_onPointerExit = (Action)Delegate.Combine(input.m_onPointerExit, (Action)delegate(UIInputHandler handler) { CraftingRecipeGridMarker component3 = ((Component)handler).GetComponent(); ClearCraftingRecipeHover(component3?.Index ?? (-1), component3?.Tooltip); }); input.m_onLeftClick = (Action)Delegate.Combine(input.m_onLeftClick, (Action)delegate(UIInputHandler handler) { CraftingRecipeGridMarker component2 = ((Component)handler).GetComponent(); int num4 = component2?.Index ?? (-1); ClearCraftingRecipeHover(num4, component2?.Tooltip); if (!TryToggleCraftingRecipeFavorite(num4)) { SelectCraftingRecipeFromGrid(num4); } }); input.m_onRightClick = (Action)Delegate.Combine(input.m_onRightClick, (Action)delegate(UIInputHandler handler) { CraftingRecipeGridMarker component = ((Component)handler).GetComponent(); int num3 = component?.Index ?? (-1); ClearCraftingRecipeHover(num3, component?.Tooltip); if (!TryToggleCraftingRecipeFavorite(num3)) { SelectCraftingRecipeFromGrid(num3); } }); marker.Initialized = true; } ((Behaviour)cell.Tooltip).enabled = false; } private static string GetCraftingRecipeCellAmountText(InventoryGui gui, RecipeDataPair pair) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) string recycleNReclaimRecipeCellAmountText = GetRecycleNReclaimRecipeCellAmountText(gui, pair); if (!string.IsNullOrEmpty(recycleNReclaimRecipeCellAmountText)) { return recycleNReclaimRecipeCellAmountText; } if (!((Object)(object)((RecipeDataPair)(ref pair)).Recipe != (Object)null) || ((RecipeDataPair)(ref pair)).Recipe.m_amount <= 1) { return ""; } return ((RecipeDataPair)(ref pair)).Recipe.m_amount.ToString(); } private static Color GetCraftingRecipeCraftableBackgroundColor() { //IL_000f: 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) return _craftingRecipeCraftableBackgroundColor?.Value ?? CraftingRecipeDefaultCraftableBackgroundColor; } private static void SelectCraftingRecipeFromGrid(int index) { InventoryGui instance = InventoryGui.instance; if (!((Object)(object)instance == (Object)null) && TryGetCraftingRecipePair(instance, index, out var _)) { SetCraftingRecipeWithStoredVariant(instance, index, center: false); } } private static void SetCraftingRecipeHover(int index, UITooltip? tooltip) { if (CraftingController.IsHoveredRecipe(index)) { SetCurrentCraftingRecipeTooltip(tooltip); return; } CraftingController.SetHoveredRecipe(index); SetCurrentCraftingRecipeTooltip(tooltip); } private static void ClearCraftingRecipeHover(int index, UITooltip? tooltip) { if (!CraftingController.IsHoveredRecipe(index)) { ClearCurrentCraftingRecipeTooltip(tooltip); return; } CraftingController.ClearHoveredRecipe(); ClearCurrentCraftingRecipeTooltip(tooltip); HideCraftingTooltipRecipeOverlay(); } private static void SetCurrentCraftingRecipeTooltip(UITooltip? tooltip) { if (!((Object)(object)tooltip == (Object)null) && !IsUnityNull((Object?)(object)tooltip) && !string.IsNullOrWhiteSpace(tooltip.m_topic)) { UITooltip.m_current = tooltip; } } private static void ClearCurrentCraftingRecipeTooltip(UITooltip? tooltip) { if ((Object)(object)tooltip != (Object)null && !IsUnityNull((Object?)(object)tooltip) && (Object)(object)UITooltip.m_current == (Object)(object)tooltip) { UITooltip.m_current = null; } } private static void ConfigureCraftingRecipeVneiTooltip(UITooltip tooltip, RecipeDataPair pair) { //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) string craftingRecipeVneiItemToken = GetCraftingRecipeVneiItemToken(pair); string craftingRecipeVneiDisplayText = GetCraftingRecipeVneiDisplayText(pair, craftingRecipeVneiItemToken); tooltip.m_topic = craftingRecipeVneiItemToken; tooltip.m_text = craftingRecipeVneiDisplayText; (((Component)tooltip).GetComponent() ?? ((Component)tooltip).gameObject.AddComponent()).Configure(craftingRecipeVneiItemToken, craftingRecipeVneiDisplayText, ""); } private static string GetCraftingRecipeVneiItemToken(RecipeDataPair pair) { if (((RecipeDataPair)(ref pair)).ItemData != null) { string itemPrefabName = GetItemPrefabName(((RecipeDataPair)(ref pair)).ItemData); object obj; if (string.IsNullOrWhiteSpace(itemPrefabName)) { obj = ((RecipeDataPair)(ref pair)).ItemData.m_shared?.m_name; if (obj == null) { return ""; } } else { obj = itemPrefabName; } return (string)obj; } ItemDrop val = ((RecipeDataPair)(ref pair)).Recipe?.m_item; if ((Object)(object)val == (Object)null) { return ""; } string text = (((Object)(object)val.m_itemData.m_dropPrefab != (Object)null) ? ((Object)val.m_itemData.m_dropPrefab).name : ((Object)val).name); object obj2; if (string.IsNullOrWhiteSpace(text)) { obj2 = val.m_itemData.m_shared?.m_name; if (obj2 == null) { return ""; } } else { obj2 = CleanPrefabName(text); } return (string)obj2; } private static string GetCraftingRecipeVneiDisplayText(RecipeDataPair pair, string fallback) { string text = ((RecipeDataPair)(ref pair)).ItemData?.m_shared?.m_name ?? ((RecipeDataPair)(ref pair)).Recipe?.m_item?.m_itemData.m_shared?.m_name ?? ""; if (string.IsNullOrWhiteSpace(text)) { return fallback; } if (Localization.instance == null) { return text; } return Localization.instance.Localize(text); } private static string StripRichText(string text) { if (string.IsNullOrEmpty(text)) { return ""; } int num = 0; char[] array = new char[text.Length]; int length = 0; foreach (char c in text) { switch (c) { case '<': num++; continue; case '>': if (num > 0) { num--; continue; } break; } if (num == 0) { array[length++] = c; } } return new string(array, 0, length); } private static void ConfigureCraftingRecipeCellOverlays(CraftingRecipeGridCell cell, float cellSize) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown //IL_00dd: 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_0107: 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_011f: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) foreach (Transform item in (Transform)cell.Rect) { Transform val = item; string text = ((Object)val).name.ToLowerInvariant(); bool flag = !text.Contains("bkg") && !text.Contains("background") && !text.Contains("border") && !text.Contains("frame"); if (flag) { bool flag2; switch (text) { case "selected": case "equiped": case "queued": case "noteleport": case "foodicon": case "durability": flag2 = true; break; default: flag2 = false; break; } flag = !flag2; } if (!flag) { RectTransform val2 = (RectTransform)(object)((val is RectTransform) ? val : null); if (val2 != null) { val2.anchorMin = new Vector2(0f, 1f); val2.anchorMax = new Vector2(0f, 1f); val2.pivot = new Vector2(0f, 1f); val2.anchoredPosition = Vector2.zero; val2.sizeDelta = new Vector2(cellSize, cellSize); ((Transform)val2).localScale = Vector3.one; ((Transform)val2).localRotation = Quaternion.identity; } } } } private static void ConfigureCraftingRecipeCellIcon(Image? icon, RecipeDataPair pair, float cellSize) { //IL_0085: 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_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)icon == (Object)null)) { ItemDrop val = (((Object)(object)((RecipeDataPair)(ref pair)).Recipe != (Object)null) ? ((RecipeDataPair)(ref pair)).Recipe.m_item : null); ((Component)icon).gameObject.SetActive((Object)(object)val != (Object)null); if (((Component)icon).gameObject.activeSelf) { RectTransform rectTransform = ((Graphic)icon).rectTransform; float num = Mathf.Clamp(cellSize * 0.08f, 5f, 12f); float num2 = Mathf.Max(16f, cellSize - num * 2f); rectTransform.anchorMin = new Vector2(0f, 1f); rectTransform.anchorMax = new Vector2(0f, 1f); rectTransform.pivot = new Vector2(0f, 1f); rectTransform.anchoredPosition = new Vector2(num, 0f - num); rectTransform.sizeDelta = new Vector2(num2, num2); ((Transform)rectTransform).localScale = Vector3.one; ((Transform)rectTransform).localRotation = Quaternion.identity; icon.sprite = GetCraftingRecipeIcon(pair); ((Graphic)icon).color = (Color)(((RecipeDataPair)(ref pair)).CanCraft ? Color.white : new Color(0.68f, 0.68f, 0.68f, 0.72f)); ((Graphic)icon).raycastTarget = false; } } } private static void ConfigureCraftingRecipeStyleButton(InventoryGui gui, CraftingRecipeGridCell cell, RecipeDataPair pair, int originalIndex, float cellSize) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: 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_00d0: 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_01a4: 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_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_01ea: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: Unknown result type (might be due to invalid IL or missing references) RectTransform val = EnsureCraftingRecipeStyleButton(gui, cell); if ((Object)(object)val == (Object)null) { return; } bool flag = GetCraftingRecipeVariantCount(pair) > 1 && ((RecipeDataPair)(ref pair)).ItemData == null; ((Component)val).gameObject.SetActive(flag); if (flag) { float num = Mathf.Clamp(cellSize * 0.224f, 14f, 21f); float num2 = Mathf.Clamp(cellSize * 0.476f, 31f, 50f); val.anchorMin = new Vector2(0f, 1f); val.anchorMax = new Vector2(0f, 1f); val.pivot = new Vector2(0f, 1f); val.anchoredPosition = new Vector2(cellSize - num2 - 2f, -2f); val.sizeDelta = new Vector2(num2, num); ((Transform)val).localScale = Vector3.one; ((Transform)val).localRotation = Quaternion.identity; ((Transform)val).SetAsLastSibling(); Image component = ((Component)val).GetComponent(); if (component != null) { ApplyVanillaButtonImage(gui.m_variantButton, component); ((Graphic)component).raycastTarget = true; } Transform obj = ((Transform)val).Find("Label"); TMP_Text val2 = ((obj != null) ? ((Component)obj).GetComponent() : null); if ((Object)(object)val2 != (Object)null) { ApplyDefaultFontAsset(val2); val2.text = LocalizeUi("$inventoryslots_style", "Style"); val2.alignment = (TextAlignmentOptions)514; val2.enableAutoSizing = true; val2.fontSizeMin = 7f; val2.fontSizeMax = Mathf.Clamp(num * 0.66f, 9f, 12f); val2.textWrappingMode = (TextWrappingModes)0; val2.overflowMode = (TextOverflowModes)3; ((Graphic)val2).color = GetVanillaButtonTextColor(gui.m_variantButton); ((Graphic)val2).raycastTarget = false; RectTransform rectTransform = val2.rectTransform; rectTransform.anchorMin = Vector2.zero; rectTransform.anchorMax = Vector2.one; rectTransform.offsetMin = Vector2.zero; rectTransform.offsetMax = Vector2.zero; ((Transform)rectTransform).localScale = Vector3.one; ((Transform)rectTransform).localRotation = Quaternion.identity; } CraftingRecipeStyleButtonMarker obj2 = ((Component)val).GetComponent() ?? ((Component)val).gameObject.AddComponent(); obj2.Index = originalIndex; obj2.Gui = gui; } } private static RectTransform? EnsureCraftingRecipeStyleButton(InventoryGui gui, CraftingRecipeGridCell cell) { //IL_008c: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)cell.Rect == (Object)null || IsUnityNull((Object?)(object)cell.Rect)) { return null; } Transform val = ((Transform)cell.Rect).Find("InventorySlots_CraftingRecipeStyleButton"); RectTransform val2 = (((Object)(object)val != (Object)null) ? ((Component)val).GetComponent() : null); if ((Object)(object)val2 == (Object)null) { val2 = new GameObject("InventorySlots_CraftingRecipeStyleButton", new Type[4] { typeof(RectTransform), typeof(Image), typeof(UIInputHandler), typeof(CraftingRecipeStyleButtonMarker) }).GetComponent(); ((Transform)val2).SetParent((Transform)(object)cell.Rect, false); CreateTextRect("Label", (Transform)(object)val2); UIInputHandler component = ((Component)val2).GetComponent(); component.m_onLeftClick = (Action)Delegate.Combine(component.m_onLeftClick, (Action)delegate(UIInputHandler handler) { ShowCraftingRecipeStyleDialog(((Component)handler).GetComponent()); }); } return val2; } private static void ApplyVanillaButtonImage(Button? source, Image target) { //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) Image val = (((Object)(object)source != (Object)null && !IsUnityNull((Object?)(object)source)) ? ((Selectable)source).image : null); if ((Object)(object)val != (Object)null) { target.sprite = val.sprite; target.type = val.type; ((Graphic)target).material = ((Graphic)val).material; target.pixelsPerUnitMultiplier = val.pixelsPerUnitMultiplier; ((Graphic)target).color = ((Graphic)val).color; } else { target.sprite = GetSolidUiSprite(); target.type = (Type)1; ((Graphic)target).color = new Color(0.02f, 0.015f, 0.01f, 0.76f); } } private static Color GetVanillaButtonTextColor(Button? button) { //IL_0037: 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) if ((Object)(object)button != (Object)null && !IsUnityNull((Object?)(object)button)) { TMP_Text componentInChildren = ((Component)button).GetComponentInChildren(true); if (componentInChildren != null) { return ((Graphic)componentInChildren).color; } } return new Color(1f, 0.84f, 0.32f, 1f); } private static void ShowCraftingRecipeStyleDialog(CraftingRecipeStyleButtonMarker? marker) { //IL_0061: Unknown result type (might be due to invalid IL or missing references) InventoryGui val = (InventoryGui)(((Object)(object)marker != (Object)null && (Object)(object)marker.Gui != (Object)null && !IsUnityNull((Object?)(object)marker.Gui)) ? ((object)marker.Gui) : ((object)InventoryGui.instance)); if (!((Object)(object)val == (Object)null) && TryGetCraftingRecipePair(val, marker?.Index ?? (-1), out var pair) && !((Object)(object)((RecipeDataPair)(ref pair)).Recipe == (Object)null) && GetCraftingRecipeVariantCount(pair) > 1) { SetCraftingRecipeWithStoredVariant(val, marker.Index, center: false); val.OnShowVariantSelection(); } } internal static void OnCraftingRecipeVariantSelected(InventoryGui gui, int variant) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)gui == (Object)null) && ShouldShowCraftingPanelRedesign(gui)) { RecipeDataPair selectedRecipe = gui.m_selectedRecipe; Recipe recipe = ((RecipeDataPair)(ref selectedRecipe)).Recipe; if (!((Object)(object)recipe == (Object)null) && ((RecipeDataPair)(ref selectedRecipe)).ItemData == null && GetCraftingRecipeVariantCount(selectedRecipe) > 1) { SetCraftingRecipeVariant(recipe, variant); InvalidateCraftingRecipeGridLayout(); UpdateCraftingPanelRedesign(gui, CraftingPanelUpdateReason.StateChanged); } } } private static void SetCraftingRecipeWithStoredVariant(InventoryGui gui, int index, bool center) { gui.SetRecipe(index, center); ApplyCraftingRecipeVariantToGui(gui, index); } private static void ApplyCraftingRecipeVariantToGui(InventoryGui gui, int index) { //IL_002d: 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) if (!((Object)(object)gui == (Object)null) && TryGetCraftingRecipePair(gui, index, out var pair) && !((Object)(object)((RecipeDataPair)(ref pair)).Recipe == (Object)null) && ((RecipeDataPair)(ref pair)).ItemData == null) { if (GetCraftingRecipeVariantCount(pair) <= 1) { gui.m_selectedVariant = 0; } else { gui.m_selectedVariant = GetCraftingRecipeVariant(pair); } } } private static int GetCraftingRecipeVariant(RecipeDataPair pair) { //IL_0017: 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_0063: Unknown result type (might be due to invalid IL or missing references) if (((RecipeDataPair)(ref pair)).ItemData != null) { return Mathf.Clamp(((RecipeDataPair)(ref pair)).ItemData.m_variant, 0, Mathf.Max(0, GetCraftingRecipeVariantCount(pair) - 1)); } if ((Object)(object)((RecipeDataPair)(ref pair)).Recipe == (Object)null || GetCraftingRecipeVariantCount(pair) <= 1) { return 0; } int value; return Mathf.Clamp(CraftingRecipes.Variants.TryGetValue(((RecipeDataPair)(ref pair)).Recipe, out value) ? value : 0, 0, GetCraftingRecipeVariantCount(pair) - 1); } private static void SetCraftingRecipeVariant(Recipe recipe, int variant) { if (!((Object)(object)recipe == (Object)null)) { int recipeVariantCount = GetRecipeVariantCount(recipe); int num = Mathf.Clamp(variant, 0, Mathf.Max(0, recipeVariantCount - 1)); if (!CraftingRecipes.Variants.TryGetValue(recipe, out var value) || value != num) { CraftingRecipes.Variants[recipe] = num; _craftingRecipeVariantVersion++; } } } private static int GetCraftingRecipeVariantCount(RecipeDataPair pair) { if (!((Object)(object)((RecipeDataPair)(ref pair)).Recipe != (Object)null)) { return 1; } return GetRecipeVariantCount(((RecipeDataPair)(ref pair)).Recipe); } private static int GetRecipeVariantCount(Recipe recipe) { ItemData val = (((Object)(object)recipe?.m_item != (Object)null) ? recipe.m_item.m_itemData : null); if (val?.m_shared == null || val.m_shared.m_icons == null) { return 1; } int num = Mathf.Max(1, val.m_shared.m_icons.Length); int num2 = Mathf.Max(1, val.m_shared.m_variants); return Mathf.Min(num, num2); } private static Sprite? GetCraftingRecipeIcon(RecipeDataPair pair) { //IL_0045: Unknown result type (might be due to invalid IL or missing references) if (((RecipeDataPair)(ref pair)).ItemData != null) { return ((RecipeDataPair)(ref pair)).ItemData.GetIcon(); } if ((Object)(object)((RecipeDataPair)(ref pair)).Recipe?.m_item == (Object)null) { return null; } ItemData itemData = ((RecipeDataPair)(ref pair)).Recipe.m_item.m_itemData; int craftingRecipeVariant = GetCraftingRecipeVariant(pair); if (itemData.m_shared?.m_icons != null && craftingRecipeVariant >= 0 && craftingRecipeVariant < itemData.m_shared.m_icons.Length) { return itemData.m_shared.m_icons[craftingRecipeVariant]; } return itemData.GetIcon(); } private static void ConfigureCraftingRecipeCellAmountText(TMP_Text? text, string value, float cellSize) { //IL_0012: 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_0030: Unknown result type (might be due to invalid IL or missing references) ConfigureCraftingRecipeCellText(text, value, cellSize, (TextAlignmentOptions)1026, new Vector2(0.5f, 0f), new Vector2(0.5f, 0f), new Vector2(0f, 1f)); } private static void ConfigureCraftingRecipeCellQualityText(TMP_Text? text, string value, float cellSize) { //IL_0012: 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_0030: Unknown result type (might be due to invalid IL or missing references) ConfigureCraftingRecipeCellText(text, value, cellSize, (TextAlignmentOptions)260, new Vector2(1f, 1f), new Vector2(1f, 1f), new Vector2(-1f, -1f)); } private static void ConfigureCraftingRecipeCellText(TMP_Text? text, string value, float cellSize, TextAlignmentOptions alignment, Vector2 anchor, Vector2 pivot, Vector2 direction) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: 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_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)text == (Object)null)) { ApplyDefaultFontAsset(text); text.text = value; ((Component)text).gameObject.SetActive(!string.IsNullOrEmpty(value)); text.alignment = alignment; text.textWrappingMode = (TextWrappingModes)0; ((Graphic)text).raycastTarget = false; text.fontSize = Mathf.Clamp(cellSize * 0.28f, 16f, 34f); RectTransform rectTransform = text.rectTransform; rectTransform.anchorMin = anchor; rectTransform.anchorMax = anchor; rectTransform.pivot = pivot; float num = Mathf.Clamp(cellSize * 0.06f, 4f, 10f); float num2 = Mathf.Clamp(cellSize * 0.32f, 20f, 42f); rectTransform.anchoredPosition = new Vector2(direction.x * num, direction.y * num); rectTransform.sizeDelta = new Vector2(cellSize - num * 2f, num2); ((Transform)rectTransform).localScale = Vector3.one; ((Transform)rectTransform).localRotation = Quaternion.identity; } } private static void SetCraftingRecipeCellChild(GameObject? child, bool active) { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0050: 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) if ((Object)(object)child == (Object)null) { return; } Image val = default(Image); if (string.Equals(((Object)child).name, "selected", StringComparison.OrdinalIgnoreCase) && child.TryGetComponent(ref val)) { if (!child.activeSelf) { child.SetActive(true); } ((Behaviour)val).enabled = true; Color color = ((Graphic)val).color; color.a = (active ? Mathf.Max(color.a, 0.38f) : 0f); ((Graphic)val).color = color; } else if (child.activeSelf != active) { child.SetActive(active); } } private static void SetCraftingRecipeFavoriteBorder(CraftingRecipeGridCell cell, bool active, bool upgradeFavorite) { //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) RectTransform val = EnsureCraftingRecipeFavoriteBorder(cell); if (!((Object)(object)val == (Object)null)) { Image[] componentsInChildren = ((Component)val).GetComponentsInChildren(true); for (int i = 0; i < componentsInChildren.Length; i++) { ((Graphic)componentsInChildren[i]).color = (upgradeFavorite ? new Color(0.2f, 0.95f, 0.38f, 0.96f) : new Color(1f, 0.82f, 0.1f, 0.96f)); } ((Component)val).gameObject.SetActive(active); if (active) { ((Transform)val).SetAsLastSibling(); } } } private static void SetCraftingRecipeSelectedBorder(CraftingRecipeGridCell cell, bool active) { //IL_0071: Unknown result type (might be due to invalid IL or missing references) object obj2; if (!active) { if ((Object)(object)cell.Rect != (Object)null && !IsUnityNull((Object?)(object)cell.Rect)) { Transform obj = ((Transform)cell.Rect).Find("InventorySlots_CraftingSelectedRecipeBorder"); RectTransform val = (RectTransform)(object)((obj is RectTransform) ? obj : null); if (val != null) { obj2 = val; goto IL_0043; } } obj2 = null; } else { obj2 = EnsureCraftingRecipeSelectedBorder(cell); } goto IL_0043; IL_0043: RectTransform val2 = (RectTransform)obj2; if (!((Object)(object)val2 == (Object)null)) { Image[] componentsInChildren = ((Component)val2).GetComponentsInChildren(true); for (int i = 0; i < componentsInChildren.Length; i++) { ((Graphic)componentsInChildren[i]).color = new Color(1f, 1f, 1f, 0.98f); } ((Component)val2).gameObject.SetActive(active); if (active) { ((Transform)val2).SetAsLastSibling(); } } } private static void SetCraftingRecipePinnedTooltipMarker(CraftingRecipeGridCell cell, bool active, float cellSize) { RectTransform val = EnsureCraftingRecipePinnedTooltipMarker(cell); if (!((Object)(object)val == (Object)null)) { ConfigureCraftingRecipePinnedTooltipMarker(val, cellSize); ((Component)val).gameObject.SetActive(active); if (active) { ((Transform)val).SetAsLastSibling(); } } } private static RectTransform? EnsureCraftingRecipePinnedTooltipMarker(CraftingRecipeGridCell cell) { if ((Object)(object)cell.Rect == (Object)null || IsUnityNull((Object?)(object)cell.Rect)) { return null; } Transform val = ((Transform)cell.Rect).Find("InventorySlots_CraftingPinnedTooltipMarker"); RectTransform val2 = (((Object)(object)val != (Object)null) ? ((Component)val).GetComponent() : null); if ((Object)(object)val2 == (Object)null) { val2 = CreateTextRect("InventorySlots_CraftingPinnedTooltipMarker", (Transform)(object)cell.Rect, out TMP_Text text, active: false); text.text = "T"; } return val2; } private static void ConfigureCraftingRecipePinnedTooltipMarker(RectTransform marker, float cellSize) { //IL_00a7: 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_00c5: 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_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)marker == (Object)null || IsUnityNull((Object?)(object)marker)) { return; } float num = Mathf.Clamp(cellSize * 0.06f, 4f, 8f); float num2 = Mathf.Clamp(cellSize * 0.34f, 20f, 28f); float num3 = Mathf.Clamp(cellSize * 0.28f, 16f, 24f); string text = $"{num:0.###}|{num2:0.###}|{num3:0.###}"; CraftingPinnedTooltipMarkerState craftingPinnedTooltipMarkerState = ((Component)marker).GetComponent() ?? ((Component)marker).gameObject.AddComponent(); if (!string.Equals(craftingPinnedTooltipMarkerState.LayoutSignature, text, StringComparison.Ordinal)) { SetRectLayout(marker, new Vector2(1f, 0f), new Vector2(1f, 0f), new Vector2(1f, 0f), new Vector2(0f - num, num), new Vector2(num2, num2)); TMP_Text component = ((Component)marker).GetComponent(); if ((Object)(object)component == (Object)null) { craftingPinnedTooltipMarkerState.LayoutSignature = text; return; } ApplyDefaultFontAsset(component); component.text = "T"; component.alignment = (TextAlignmentOptions)1028; component.textWrappingMode = (TextWrappingModes)0; component.fontSize = num3; ((Graphic)component).color = Color.white; component.outlineColor = new Color32((byte)0, (byte)0, (byte)0, (byte)230); component.outlineWidth = 0.18f; ((Graphic)component).raycastTarget = false; craftingPinnedTooltipMarkerState.LayoutSignature = text; } } private static RectTransform? EnsureCraftingRecipeSelectedBorder(CraftingRecipeGridCell cell) { //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Expected O, but got Unknown //IL_006a: 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_0080: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: 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_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: 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) //IL_01d1: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)cell.Rect == (Object)null || IsUnityNull((Object?)(object)cell.Rect)) { return null; } Transform obj = ((Transform)cell.Rect).Find("InventorySlots_CraftingSelectedRecipeBorder"); RectTransform val = (RectTransform)(object)((obj is RectTransform) ? obj : null); if (val != null) { return val; } GameObject val2 = new GameObject("InventorySlots_CraftingSelectedRecipeBorder", new Type[1] { typeof(RectTransform) }); RectTransform component = val2.GetComponent(); ((Transform)component).SetParent((Transform)(object)cell.Rect, false); component.anchorMin = Vector2.zero; component.anchorMax = Vector2.one; component.offsetMin = Vector2.zero; component.offsetMax = Vector2.zero; ((Transform)component).localScale = Vector3.one; ((Transform)component).localRotation = Quaternion.identity; CreateFavoriteBorderSide(component, "Top", new Vector2(0f, 1f), new Vector2(1f, 1f), new Vector2(0.5f, 1f), new Vector2(0f, 2f), Vector2.zero); CreateFavoriteBorderSide(component, "Bottom", new Vector2(0f, 0f), new Vector2(1f, 0f), new Vector2(0.5f, 0f), new Vector2(0f, 2f), Vector2.zero); CreateFavoriteBorderSide(component, "Left", new Vector2(0f, 0f), new Vector2(0f, 1f), new Vector2(0f, 0.5f), new Vector2(2f, 0f), Vector2.zero); CreateFavoriteBorderSide(component, "Right", new Vector2(1f, 0f), new Vector2(1f, 1f), new Vector2(1f, 0.5f), new Vector2(2f, 0f), Vector2.zero); val2.SetActive(false); return component; } private static RectTransform? EnsureCraftingRecipeFavoriteBorder(CraftingRecipeGridCell cell) { //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Expected O, but got Unknown //IL_006a: 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_0080: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: 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_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: 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) //IL_01d1: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)cell.Rect == (Object)null || IsUnityNull((Object?)(object)cell.Rect)) { return null; } Transform obj = ((Transform)cell.Rect).Find("InventorySlots_CraftingFavoriteBorder"); RectTransform val = (RectTransform)(object)((obj is RectTransform) ? obj : null); if (val != null) { return val; } GameObject val2 = new GameObject("InventorySlots_CraftingFavoriteBorder", new Type[1] { typeof(RectTransform) }); RectTransform component = val2.GetComponent(); ((Transform)component).SetParent((Transform)(object)cell.Rect, false); component.anchorMin = Vector2.zero; component.anchorMax = Vector2.one; component.offsetMin = Vector2.zero; component.offsetMax = Vector2.zero; ((Transform)component).localScale = Vector3.one; ((Transform)component).localRotation = Quaternion.identity; CreateFavoriteBorderSide(component, "Top", new Vector2(0f, 1f), new Vector2(1f, 1f), new Vector2(0.5f, 1f), new Vector2(0f, 2f), Vector2.zero); CreateFavoriteBorderSide(component, "Bottom", new Vector2(0f, 0f), new Vector2(1f, 0f), new Vector2(0.5f, 0f), new Vector2(0f, 2f), Vector2.zero); CreateFavoriteBorderSide(component, "Left", new Vector2(0f, 0f), new Vector2(0f, 1f), new Vector2(0f, 0.5f), new Vector2(2f, 0f), Vector2.zero); CreateFavoriteBorderSide(component, "Right", new Vector2(1f, 0f), new Vector2(1f, 1f), new Vector2(1f, 0.5f), new Vector2(2f, 0f), Vector2.zero); val2.SetActive(false); return component; } private static bool RectContainsCraftingRecipeIconArea(RectTransform grid, Vector2 screenPoint) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) if (!TryGetLocalPointInRect(grid, screenPoint, out var localPoint)) { return false; } Rect val = default(Rect); ((Rect)(ref val))..ctor(0f, -576f, 576f, 576f); return ((Rect)(ref val)).Contains(localPoint); } private static int GetCraftingRecipeGridAvailabilityHash(InventoryGui gui, int pageStart) { //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) int num = 17; int craftingRecipeGridCapacity = GetCraftingRecipeGridCapacity(); for (int i = 0; i < craftingRecipeGridCapacity; i++) { int num2 = pageStart + i; if (num2 < 0 || num2 >= CraftingRecipes.View.Count) { num = num * 31 - 1; continue; } RecipeDataPair pair = CraftingRecipes.View[num2].Pair; int originalIndex = CraftingRecipes.View[num2].OriginalIndex; num = num * 31 + originalIndex; num = num * 31 + (((Object)(object)((RecipeDataPair)(ref pair)).Recipe != (Object)null && ((RecipeDataPair)(ref pair)).Recipe.m_enabled) ? 1 : 0); num = num * 31 + (((RecipeDataPair)(ref pair)).CanCraft ? 1 : 0); num = num * 31 + (IsCraftingRecipeActionAvailable(gui, pair, originalIndex) ? 1 : 0); if (IsRecycleNReclaimReclaimTabActive(gui) && TryGetRecycleNReclaimRecyclingImpedimentCount(originalIndex, out var count)) { num = num * 31 + count; } } return num; } private static RectTransform? EnsureOwnedCraftingRequirementSlot(InventoryGui gui, int index) { if ((Object)(object)gui.m_crafting == (Object)null || IsUnityNull((Object?)(object)gui.m_crafting)) { return null; } while (CraftingRequirements.OwnedSlots.Count <= index) { CraftingRequirements.OwnedSlots.Add(null); } RectTransform val = CraftingRequirements.OwnedSlots[index]; if ((Object)(object)val != (Object)null && !IsUnityNull((Object?)(object)val) && (Object)(object)((Transform)val).parent == (Object)(object)gui.m_crafting) { return val; } string text = string.Format("{0}{1}", "InventorySlots_CraftingRequirementSlot_", index); Transform obj = ((Transform)gui.m_crafting).Find(text); RectTransform val2 = (RectTransform)(object)((obj is RectTransform) ? obj : null); RectTransform val3 = (RectTransform)(((Object)(object)val2 != (Object)null && !IsUnityNull((Object?)(object)val2)) ? ((object)val2) : ((object)CreateOwnedCraftingRequirementSlot(gui, text))); ((Object)val3).name = text; ((Transform)val3).SetParent((Transform)(object)gui.m_crafting, false); CraftingRequirements.OwnedSlots[index] = val3; return val3; } private static RectTransform CreateOwnedCraftingRequirementSlot(InventoryGui gui, string name) { GameObject craftingRequirementTemplate = GetCraftingRequirementTemplate(gui); GameObject val = (GameObject)(((Object)(object)craftingRequirementTemplate != (Object)null && !IsUnityNull((Object?)(object)craftingRequirementTemplate)) ? ((object)Object.Instantiate(craftingRequirementTemplate, (Transform)(object)gui.m_crafting, false)) : ((object)CreateFallbackCraftingRequirementSlot(name, (Transform)(object)gui.m_crafting))); ((Object)val).name = name; val.SetActive(false); return val.GetComponent() ?? val.AddComponent(); } private static GameObject? GetCraftingRequirementTemplate(InventoryGui gui) { if (gui.m_recipeRequirementList == null) { return null; } GameObject[] recipeRequirementList = gui.m_recipeRequirementList; foreach (GameObject val in recipeRequirementList) { if ((Object)(object)val != (Object)null && !IsUnityNull((Object?)(object)val)) { return val; } } return null; } private static GameObject CreateFallbackCraftingRequirementSlot(string name, Transform parent) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown //IL_006e: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject(name, new Type[2] { typeof(RectTransform), typeof(Image) }); val.transform.SetParent(parent, false); Image component = val.GetComponent(); ((Behaviour)component).enabled = false; ((Graphic)component).raycastTarget = false; RectTransform component2 = new GameObject("res_icon", new Type[2] { typeof(RectTransform), typeof(Image) }).GetComponent(); ((Transform)component2).SetParent(val.transform, false); Image component3 = ((Component)component2).GetComponent(); RectTransform name2 = CreateTextRect("res_name", val.transform, active: false); TMP_Text text; RectTransform amount = CreateTextRect("res_amount", val.transform, out text); CraftingRequirementUiMarker craftingRequirementUiMarker = val.AddComponent(); craftingRequirementUiMarker.ChildSignature = val.transform.childCount.ToString(); craftingRequirementUiMarker.Name = (Transform?)(object)name2; craftingRequirementUiMarker.Icon = component2; craftingRequirementUiMarker.IconImage = component3; craftingRequirementUiMarker.Amount = amount; craftingRequirementUiMarker.AmountText = text; craftingRequirementUiMarker.BackgroundImages = (Image[])(object)new Image[1] { component }; return val; } private static void HideOwnedCraftingRequirementSlots() { foreach (RectTransform ownedSlot in CraftingRequirements.OwnedSlots) { if ((Object)(object)ownedSlot != (Object)null && !IsUnityNull((Object?)(object)ownedSlot)) { ((Component)ownedSlot).gameObject.SetActive(false); } } } private static void HideCraftingVanillaRequirementSlots(InventoryGui gui) { if (gui.m_recipeRequirementList == null) { return; } GameObject[] recipeRequirementList = gui.m_recipeRequirementList; foreach (GameObject val in recipeRequirementList) { if ((Object)(object)val != (Object)null && !IsUnityNull((Object?)(object)val)) { val.SetActive(false); } } } private static string FormatCompactRequirementAmount(int available, int required) { return $"{available}/{required}"; } private static Color GetCompactRequirementAmountColor(bool availableEnough) { //IL_0003: 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_0031: 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) if (availableEnough) { return Color.white; } if (TryGetAzuCraftyBoxesRequirementFlashColor(out var color)) { return color; } if (!(Mathf.Sin(Time.time * 10f) > 0f)) { return Color.white; } return Color.red; } private static bool RequirementAmountTextMatches(TMP_Text text, string label, Color color) { //IL_0010: 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) if (string.Equals(text.text, label, StringComparison.Ordinal)) { return ColorsApproximatelyEqual(((Graphic)text).color, color); } return false; } private static bool ColorsApproximatelyEqual(Color left, Color right) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0019: 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_0032: 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_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) if (Mathf.Abs(left.r - right.r) <= 0.001f && Mathf.Abs(left.g - right.g) <= 0.001f && Mathf.Abs(left.b - right.b) <= 0.001f) { return Mathf.Abs(left.a - right.a) <= 0.001f; } return false; } private static CraftingRequirementUiMarker GetCraftingRequirementUiMarker(RectTransform rect) { CraftingRequirementUiMarker craftingRequirementUiMarker = ((Component)rect).GetComponent() ?? ((Component)rect).gameObject.AddComponent(); string text = ((Transform)rect).childCount.ToString(); if (string.Equals(craftingRequirementUiMarker.ChildSignature, text, StringComparison.Ordinal) && (Object)(object)craftingRequirementUiMarker.Name != (Object)null && (Object)(object)craftingRequirementUiMarker.Icon != (Object)null && (Object)(object)craftingRequirementUiMarker.Amount != (Object)null && !IsUnityNull((Object?)(object)craftingRequirementUiMarker.Name) && !IsUnityNull((Object?)(object)craftingRequirementUiMarker.Icon) && !IsUnityNull((Object?)(object)craftingRequirementUiMarker.Amount)) { return craftingRequirementUiMarker; } craftingRequirementUiMarker.Name = ((Transform)rect).Find("res_name"); Transform obj = ((Transform)rect).Find("res_icon"); craftingRequirementUiMarker.Icon = (RectTransform?)(object)((obj is RectTransform) ? obj : null); craftingRequirementUiMarker.IconImage = (((Object)(object)craftingRequirementUiMarker.Icon != (Object)null && !IsUnityNull((Object?)(object)craftingRequirementUiMarker.Icon)) ? ((Component)craftingRequirementUiMarker.Icon).GetComponent() : null); Transform obj2 = ((Transform)rect).Find("res_amount"); craftingRequirementUiMarker.Amount = (RectTransform?)(object)((obj2 is RectTransform) ? obj2 : null); craftingRequirementUiMarker.AmountText = (((Object)(object)craftingRequirementUiMarker.Amount != (Object)null && !IsUnityNull((Object?)(object)craftingRequirementUiMarker.Amount)) ? ((Component)craftingRequirementUiMarker.Amount).GetComponent() : null); Transform obj3 = ((Transform)rect).Find("InventorySlots_CraftingRequirementHitbox"); craftingRequirementUiMarker.Hitbox = (RectTransform?)(object)((obj3 is RectTransform) ? obj3 : null); craftingRequirementUiMarker.BackgroundImages = FindCraftingRequirementBackgroundImages(rect); craftingRequirementUiMarker.CompetingTooltipSignature = ""; craftingRequirementUiMarker.CompetingTooltips = Array.Empty(); craftingRequirementUiMarker.ChildSignature = text; craftingRequirementUiMarker.LayoutSignature = ""; craftingRequirementUiMarker.AmountSignature = ""; return craftingRequirementUiMarker; } private static Image[] FindCraftingRequirementBackgroundImages(RectTransform rect) { RectTransform rect2 = rect; return (from image in ((Component)rect2).GetComponentsInChildren(true) where IsCraftingRequirementBackgroundImage(rect2, image) select image).ToArray(); } private static bool IsCraftingRequirementBackgroundImage(RectTransform root, Image image) { if ((Object)(object)image == (Object)null || IsUnityNull((Object?)(object)image)) { return false; } Transform transform = ((Component)image).transform; string text = ((Object)transform).name.ToLowerInvariant(); if (text == "res_icon" || text == "res_amount" || string.Equals(((Object)transform).name, "InventorySlots_CraftingRequirementHitbox", StringComparison.Ordinal)) { return false; } if (!((Object)(object)transform == (Object)(object)root) && !text.Contains("bkg") && !text.Contains("background") && !text.Contains("border")) { return text.Contains("frame"); } return true; } private static void HideCraftingRequirementSlotBackground(CraftingRequirementUiMarker marker) { Image[] backgroundImages = marker.BackgroundImages; foreach (Image val in backgroundImages) { if (!((Object)(object)val == (Object)null) && !IsUnityNull((Object?)(object)val)) { ((Behaviour)val).enabled = false; ((Graphic)val).raycastTarget = false; } } } private static RectTransform EnsureCraftingRequirementHitbox(RectTransform rect, CraftingRequirementUiMarker marker) { //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) RectTransform val = marker.Hitbox; if ((Object)(object)val == (Object)null || IsUnityNull((Object?)(object)val)) { Transform obj = ((Transform)rect).Find("InventorySlots_CraftingRequirementHitbox"); val = (RectTransform)(object)((obj is RectTransform) ? obj : null); } RectTransform val2 = (((Object)(object)val != (Object)null && !IsUnityNull((Object?)(object)val)) ? val : new GameObject("InventorySlots_CraftingRequirementHitbox", new Type[2] { typeof(RectTransform), typeof(Image) }).GetComponent()); if ((Object)(object)((Transform)val2).parent != (Object)(object)rect) { ((Transform)val2).SetParent((Transform)(object)rect, false); } marker.Hitbox = val2; SetStretchRectLayoutCached(val2, Vector2.zero, Vector2.zero, "crafting-requirement-hitbox"); ((Transform)val2).SetAsLastSibling(); Image component = ((Component)val2).GetComponent(); component.sprite = GetSolidUiSprite(); ((Graphic)component).color = new Color(0f, 0f, 0f, 0f); ((Graphic)component).raycastTarget = true; return val2; } private static void ConfigureCraftingRequirementTooltip(InventoryGui gui, GameObject target, Requirement requirement, int quality, int craftMultiplier) { if (!((Object)(object)target == (Object)null) && !IsUnityNull((Object?)(object)target) && !((Object)(object)requirement.m_resItem == (Object)null)) { ConfigureSimpleTooltip(target, GetRequirementDisplayName(requirement), enabled: true); } } private static void DisableCompetingCraftingRequirementTooltips(RectTransform root, RectTransform allowed, CraftingRequirementUiMarker marker) { RectTransform allowed2 = allowed; string text = $"{((Transform)root).childCount}|{((Object)allowed2).GetInstanceID()}"; if (!string.Equals(marker.CompetingTooltipSignature, text, StringComparison.Ordinal)) { marker.CompetingTooltips = (from tooltip in ((Component)root).GetComponentsInChildren(true) where (Object)(object)tooltip != (Object)null && !IsUnityNull((Object?)(object)tooltip) && (Object)(object)((Component)tooltip).transform != (Object)(object)allowed2 select tooltip).ToArray(); marker.CompetingTooltipSignature = text; } UITooltip[] competingTooltips = marker.CompetingTooltips; CraftingTooltipState craftingTooltipState = default(CraftingTooltipState); foreach (UITooltip val in competingTooltips) { if (!((Object)(object)val == (Object)null) && !IsUnityNull((Object?)(object)val)) { val.m_topic = ""; val.m_text = ""; ((Behaviour)val).enabled = false; if (((Component)val).TryGetComponent(ref craftingTooltipState)) { craftingTooltipState.Signature = ""; } } } } private static int GetAvailableCraftingRequirementAmount(Requirement requirement) { Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null || (Object)(object)requirement.m_resItem == (Object)null || requirement.m_resItem.m_itemData?.m_shared == null) { return 0; } string name = requirement.m_resItem.m_itemData.m_shared.m_name; if (string.IsNullOrWhiteSpace(name)) { return 0; } string craftingRequirementAvailabilityCacheKey = GetCraftingRequirementAvailabilityCacheKey(localPlayer, requirement, name); float unscaledTime = Time.unscaledTime; if (CraftingRequirements.AvailabilityCache.TryGetValue(craftingRequirementAvailabilityCacheKey, out var value) && value.ExpiresAt >= unscaledTime) { return value.Amount; } Inventory inventory = ((Humanoid)localPlayer).GetInventory(); int num = ((inventory != null) ? inventory.CountItems(name, -1, true) : 0); num += GetAzuCraftyBoxesAvailableCraftingRequirementAmount(requirement, name); CraftingRequirements.AvailabilityCache[craftingRequirementAvailabilityCacheKey] = new CraftingRequirementAvailabilityCacheEntry(num, unscaledTime + 0.25f); return num; } private static string GetCraftingRequirementAvailabilityCacheKey(Player player, Requirement requirement, string sharedName) { string arg = (((Object)(object)requirement.m_resItem != (Object)null) ? GetPrefabNameForAzuCraftyBoxes(((Object)requirement.m_resItem).name) : ""); long num = (((Object)(object)player != (Object)null) ? player.GetPlayerID() : 0); return $"{num}|{arg}|{sharedName}"; } private static void ClearCraftingRequirementAvailabilityCache() { CraftingRequirements.AvailabilityCache.Clear(); CraftingRequirements.AvailabilityVersion++; } private static bool HasNoCraftCost() { if (!((Object)(object)Player.m_localPlayer != (Object)null) || !Player.m_localPlayer.NoCostCheat()) { if ((Object)(object)ZoneSystem.instance != (Object)null) { return ZoneSystem.instance.GetGlobalKey((GlobalKeys)20); } return false; } return true; } internal static void UpdateCraftingPanelRedesign(InventoryGui gui, CraftingPanelUpdateReason reason = CraftingPanelUpdateReason.FrameTick) { PrepareCraftingTabAdapterPreflight(gui); CraftingTabAdapterState craftingTabAdapterState = GetCraftingTabAdapterState(gui); if (reason == CraftingPanelUpdateReason.RecipeListChanged) { ClearCraftingRecipeCaches(); InvalidateCraftingRecipeView(); InvalidateCraftingVanillaHiddenState(); } if (!ShouldShowCraftingPanelRedesign(gui, craftingTabAdapterState)) { UpdateCraftingTabAdapterSuppression(gui, shouldSuppress: false, craftingTabAdapterState); if (_craftingRedesignApplied) { HideCraftingPanelRedesign(); } if (craftingTabAdapterState.IsForeign) { HideForeignCraftingRedesignResidue(gui); } return; } UpdateCraftingTabAdapterSuppression(gui, shouldSuppress: true, craftingTabAdapterState); if (reason == CraftingPanelUpdateReason.FrameTick && TryRunCraftingPanelFrameFastPath(gui, craftingTabAdapterState)) { return; } bool firstApply = !_craftingRedesignApplied; bool flag = CraftingController.NeedsModelRefresh(reason, firstApply); RectTransform val = EnsureCraftingRecipeGrid(gui, flag); if (!((Object)(object)val == (Object)null)) { if (flag) { RebuildStationInputTokens(); } _craftingRedesignApplied = true; SyncPinnedTooltipContextWithCraftingTab(gui); EnsureCraftingVanillaRecipeElementsHidden(gui); ApplyCraftingTabAdapterVisibility(gui, craftingTabAdapterState); UpdateCraftingPanelHeightExtension(gui); ResetCraftingCountIfSelectionChanged(gui); HandleCraftingCountWheel(); UpdateCraftingQueueLifecycle(gui); TryContinueCraftingQueue(gui); EnsureCraftingFavoritesLoaded(Player.m_localPlayer); UpdateCraftingSearchInput(gui, val); UpdateCraftingSortModeButtons(gui, val); if (craftingTabAdapterState.UsesDefaultGroupRail) { UpdateCraftingGroupRail(gui, val); } else { HideCraftingGroupRail(); } HandleCraftingGroupFavoriteClearShortcut(); bool viewChanged = UpdateCraftingRecipeView(gui); EnsureSelectedCraftingRecipeVisible(gui); if (!HandleCraftingPinnedTooltipWheel() && !HandleCraftingHoverTooltipWheel() && !HandleCraftingRecipeGridZoomWheel(gui, val) && !HandleCraftingRecipeGridWheel(gui, val)) { SyncCraftingRecipePageToSelected(gui); } ClampCraftingRecipePage(gui); UpdateCraftingGridLayering(gui, val); LayoutCraftingRecipeGrid(gui, val); UpdateCraftingRecipeScrollbar(gui, val); UpdateCraftingTooltipRecipeOverlay(gui); LayoutCraftingTabAdapterBottomControls(gui, val, craftingTabAdapterState); UpdateCraftingRecipeGridZoomHint(gui, val); RepairCraftingPinnedTooltipTextVisibility(); FinalizeCraftingTabAdapterFrame(gui, craftingTabAdapterState, firstApply, reason, viewChanged); StoreCraftingFrameFastPathSignature(gui, craftingTabAdapterState); } } private static void UpdateCraftingPanelHeightExtension(InventoryGui gui) { if (!((Object)(object)gui.m_crafting == (Object)null)) { float num = 84f; if (num <= 0.01f) { RestoreCraftingPanelExtension(gui); } else { ApplyCraftingPanelExtension(gui, num); } } } private static void RestoreCraftingPanelHeightExtension(InventoryGui? gui = null) { RestoreCraftingPanelExtension(gui); } private static void ApplyCraftingPanelExtension(InventoryGui gui, float extension) { //IL_0021: 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_0030: 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_0028: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) RectTransform crafting = gui.m_crafting; Vector2 val = ((_craftingPanelRootSnapshot != null && (Object)(object)_craftingPanelRootSnapshot.Rect == (Object)(object)crafting) ? _craftingPanelOriginalSizeDelta : crafting.sizeDelta); Vector2 val2 = default(Vector2); ((Vector2)(ref val2))..ctor(val.x, val.y + extension); string text = $"{((Object)crafting).GetInstanceID()}|{extension:0.###}|{((Transform)crafting).childCount}"; Vector2 val3; if (_craftingPanelRootSnapshot != null && (Object)(object)_craftingPanelRootSnapshot.Rect == (Object)(object)crafting && string.Equals(_craftingPanelExtensionSignature, text, StringComparison.Ordinal)) { val3 = crafting.sizeDelta - val2; if (((Vector2)(ref val3)).sqrMagnitude <= 0.0001f) { return; } } if (_craftingPanelRootSnapshot == null || (Object)(object)_craftingPanelRootSnapshot.Rect != (Object)(object)crafting) { _craftingPanelRootSnapshot = new RectTransformSnapshot(crafting); _craftingPanelOriginalSizeDelta = crafting.sizeDelta; val = _craftingPanelOriginalSizeDelta; ((Vector2)(ref val2))..ctor(val.x, val.y + extension); CraftingPanelResizeProtectedSnapshots.Clear(); CaptureCraftingPanelResizeProtectedSnapshots(gui); } else { CaptureCraftingPanelResizeProtectedSnapshots(gui); } Dictionary dictionary = CaptureCraftingPanelResizeProtectedWorldPositions(gui); val3 = crafting.sizeDelta - val2; if (((Vector2)(ref val3)).sqrMagnitude > 0.0001f) { crafting.sizeDelta = val2; } foreach (KeyValuePair item in dictionary) { RectTransform key = item.Key; if (!((Object)(object)key == (Object)null) && !IsUnityNull((Object?)(object)key)) { ((Transform)key).position = item.Value; } } _craftingPanelExtensionSignature = text; } private static void RestoreCraftingPanelExtension(InventoryGui? gui) { //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) if (_craftingPanelRootSnapshot != null && ((Object)(object)gui == (Object)null || (Object)(object)gui.m_crafting == (Object)null || (Object)(object)_craftingPanelRootSnapshot.Rect == (Object)(object)gui.m_crafting)) { _craftingPanelRootSnapshot.Restore(); } foreach (RectTransformSnapshot value in CraftingPanelResizeProtectedSnapshots.Values) { value.Restore(); } CraftingPanelResizeProtectedSnapshots.Clear(); _craftingPanelRootSnapshot = null; _craftingPanelOriginalSizeDelta = Vector2.zero; _craftingPanelExtensionSignature = ""; } private static void CaptureCraftingPanelResizeProtectedSnapshots(InventoryGui gui) { foreach (RectTransform item in FindCraftingPanelResizeProtectedChildren(gui)) { if (!((Object)(object)item == (Object)null) && !IsUnityNull((Object?)(object)item) && !CraftingPanelResizeProtectedSnapshots.ContainsKey(item)) { CraftingPanelResizeProtectedSnapshots[item] = new RectTransformSnapshot(item); } } } private static Dictionary CaptureCraftingPanelResizeProtectedWorldPositions(InventoryGui gui) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) Dictionary dictionary = new Dictionary(); foreach (RectTransform item in FindCraftingPanelResizeProtectedChildren(gui)) { if (!((Object)(object)item == (Object)null) && !IsUnityNull((Object?)(object)item)) { dictionary[item] = ((Transform)item).position; } } return dictionary; } [IteratorStateMachine(typeof(d__511))] private static IEnumerable FindCraftingPanelResizeProtectedChildren(InventoryGui gui) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__511(-2) { <>3__gui = gui }; } private static bool ShouldProtectCraftingPanelResizeChild(InventoryGui gui, RectTransform rect) { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)rect == (Object)null || IsUnityNull((Object?)(object)rect) || (Object)(object)rect == (Object)(object)gui.m_crafting || IsOwnedCraftingUiTransform((Transform)(object)rect) || IsCraftingPanelStretchBackground(rect)) { return false; } if (!(rect.anchorMin.y < 0.999f)) { return rect.anchorMax.y < 0.999f; } return true; } private static bool IsCraftingPanelStretchBackground(RectTransform rect) { //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) string text = ((Object)rect).name.ToLowerInvariant(); bool flag; switch (text) { case "bkg": case "darken": case "selected_frame": flag = true; break; default: flag = false; break; } if (flag) { return true; } if (!(rect.anchorMin.y <= 0.001f) || !(rect.anchorMax.y >= 0.999f)) { return false; } if ((Object)(object)((Component)rect).GetComponent() == (Object)null) { if (!text.Contains("background") && !text.Contains("panel")) { return text.Contains("frame"); } return true; } if (!text.Contains("bkg") && !text.Contains("background") && !text.Contains("darken") && !text.Contains("panel")) { return text.Contains("frame"); } return true; } internal static void InvalidateCraftingRecipeView() { CraftingController.MarkRecipeViewDirtyCascade(); } internal static void ClearCraftingRecipeCaches() { CraftingRecipes.SearchTextCache.Clear(); CraftingRecipes.HoverTooltipContentCache.Clear(); CraftingController.ClearHoverTooltipContentKey(); CraftingRecipes.SortKeyCache.Clear(); CraftingRecipes.GroupMatchCache.Clear(); ClearInventorySortCaches(); ClearItemClassifierCaches(); ClearCraftingRequirementAvailabilityCache(); ClearCraftingGroupAvailabilityCache(); ClearRecycleNReclaimSignatureCaches(); } private static void InvalidateCraftingRecipeGridLayout() { CraftingController.MarkRecipeGridLayoutDirty(); } private static void MarkCraftingRecipeViewDirty() { CraftingController.MarkRecipeViewDirty(); } private static void MarkCraftingRecipeGridDirty() { CraftingController.MarkRecipeGridDirty(); } private static void MarkCraftingRecipeScrollbarDirty() { CraftingController.MarkRecipeScrollbarDirty(); } private static void MarkCraftingGroupRailDirty() { CraftingController.MarkGroupRailDirty(); } private static void MarkCraftingBottomControlsDirty() { CraftingController.MarkBottomControlsDirty(); } private static void MarkCraftingSearchInputDirty() { CraftingController.MarkSearchInputDirty(); } internal static void HideCraftingPanelRedesign() { InventoryGui instance = InventoryGui.instance; CraftingTabAdapterState craftingTabAdapterState = GetCraftingTabAdapterState(instance); bool isForeign = craftingTabAdapterState.IsForeign; HideOwnedCraftingRedesignUi(); UpdateMyLittleUICraftingObjectSuppression(instance, shouldSuppress: false, craftingTabAdapterState); if ((Object)(object)instance != (Object)null) { bool flag = isForeign && ShouldPreserveForeignCraftingControls(instance); RestoreCraftingPanelHeightExtension(instance); RestoreCraftingVanillaState(instance, !isForeign || flag); if (flag) { ForceRestoreForeignCraftingVanillaState(instance); RestoreJewelcraftingCraftingSocketUiForVanilla(instance); } else if (isForeign) { HideCraftingRedesignBottomControls(instance); } } CraftingController.ClearHoveredRecipe(); _craftingRecipeListChangeSignature = ""; _craftingSelectedRecipeChangeSignature = ""; CraftingRecipes.View.Clear(); CraftingRecipes.ViewIndexByOriginal.Clear(); InvalidateCraftingRecipeView(); ClearCraftingQueue(); _craftingRedesignApplied = false; } private static void HideForeignCraftingRedesignResidue(InventoryGui gui) { HideOwnedCraftingRedesignUi(); RestoreCraftingPanelHeightExtension(gui); if (ShouldPreserveForeignCraftingControls(gui)) { RestoreCraftingVanillaState(gui, restoreRecipeUi: true); ForceRestoreForeignCraftingVanillaState(gui); RestoreJewelcraftingCraftingSocketUiForVanilla(gui); } else { HideCraftingRedesignBottomControls(gui); } } private static void ForceRestoreForeignCraftingVanillaState(InventoryGui gui) { if ((Object)(object)gui.m_crafting != (Object)null && !((Component)gui.m_crafting).gameObject.activeSelf) { ((Component)gui.m_crafting).gameObject.SetActive(true); } SetCraftingVanillaRecipeElementsVisible(gui, visible: true); SetCraftingVanillaDetailVisible(gui, visible: true); SetCraftingVanillaRecipeScrollbarsVisible(gui, visible: true); SetCraftingVanillaPanelBackgroundsVisible(gui, visible: true); _craftingVanillaRecipeElementsHidden = false; _craftingVanillaDetailHidden = false; _craftingVanillaRecipeScrollbarsHidden = false; _craftingVanillaPanelBackgroundsHidden = false; } private static void RestoreCraftingVanillaState(InventoryGui gui, bool restoreRecipeUi) { if (_craftingVanillaPanelBackgroundsHidden || CraftingVanillaPanelBackgroundStates.Count > 0) { SetCraftingVanillaPanelBackgroundsVisible(gui, visible: true); } if (restoreRecipeUi) { if (_craftingVanillaRecipeElementsHidden) { SetCraftingVanillaRecipeElementsVisible(gui, visible: true); _craftingVanillaRecipeElementsHidden = false; } if (_craftingVanillaDetailHidden) { SetCraftingVanillaDetailVisible(gui, visible: true); _craftingVanillaDetailHidden = false; } if (_craftingVanillaRecipeScrollbarsHidden) { SetCraftingVanillaRecipeScrollbarsVisible(gui, visible: true); _craftingVanillaRecipeScrollbarsHidden = false; } } } private static void HideOwnedCraftingRedesignUi() { if ((Object)(object)_craftingRecipeGrid != (Object)null) { ((Component)_craftingRecipeGrid).gameObject.SetActive(false); } HideCraftingTooltipRecipeOverlay(); if ((Object)(object)_craftingCountInputRect != (Object)null) { ((Component)_craftingCountInputRect).gameObject.SetActive(false); } if ((Object)(object)CraftingUi.SearchInputRect != (Object)null) { ((Component)CraftingUi.SearchInputRect).gameObject.SetActive(false); } if ((Object)(object)_craftingSortModeButtonGroup != (Object)null) { ((Component)_craftingSortModeButtonGroup).gameObject.SetActive(false); } if ((Object)(object)_craftingRecipeScrollbar != (Object)null) { ((Component)_craftingRecipeScrollbar).gameObject.SetActive(false); } if ((Object)(object)_craftingGroupRail != (Object)null) { ((Component)_craftingGroupRail).gameObject.SetActive(false); } HideCraftingPinnedTooltips(); HideRecycleNReclaimHud(); HideOwnedCraftingRequirementSlots(); if ((Object)(object)_craftingControlsBackground != (Object)null) { ((Component)_craftingControlsBackground).gameObject.SetActive(false); } if ((Object)(object)CraftingUi.RecipeGridZoomHint != (Object)null) { ((Component)CraftingUi.RecipeGridZoomHint).gameObject.SetActive(false); } InvalidateCraftingRecipeGridZoomHint(); HideCraftingSocketWarning(); } internal static void PrepareCraftingQueue(InventoryGui gui) { if (_continuingCraftingQueue) { return; } ClearCraftingQueue(); if (ShouldShowCraftingPanelRedesign(gui) && !((Object)(object)((RecipeDataPair)(ref gui.m_selectedRecipe)).Recipe == (Object)null) && ((RecipeDataPair)(ref gui.m_selectedRecipe)).ItemData == null) { bool num = IsVanillaMultiCraftModifierHeld(); int num2 = (num ? Mathf.Max(1, gui.m_multiCraftAmount) : GetCraftingCount()); CaptureCraftingProgressLabelCount(gui, num2); if (!num && num2 > 1) { _craftingQueueRemaining = num2 - 1; _craftingQueueTotal = num2; _craftingQueueRecipe = ((RecipeDataPair)(ref gui.m_selectedRecipe)).Recipe; _craftingQueueVariant = gui.m_selectedVariant; } } } internal static void ValidateCraftingQueueStarted(InventoryGui gui) { if (!_continuingCraftingQueue && _craftingQueueRemaining > 0 && gui.m_craftTimer < 0f) { ClearCraftingQueue(clearProgressLabel: false); } } internal static void TryContinueCraftingQueue(InventoryGui gui) { if (_continuingCraftingQueue || _craftingQueueRemaining <= 0 || gui.m_craftTimer >= 0f) { return; } if (!CanContinueCraftingQueue(gui)) { ClearCraftingQueue(); return; } _craftingQueueRemaining--; _continuingCraftingQueue = true; int multiCraftAmount = gui.m_multiCraftAmount; try { gui.m_multiCraftAmount = 1; gui.OnCraftPressed(); gui.m_multiCrafting = false; if (gui.m_craftTimer < 0f) { ClearCraftingQueue(); } } finally { gui.m_multiCraftAmount = multiCraftAmount; _continuingCraftingQueue = false; } } internal static void ClearCraftingQueue(bool clearProgressLabel = true) { _craftingQueueTotal = 0; _craftingQueueRemaining = 0; _craftingQueueRecipe = null; _craftingQueueVariant = 0; if (clearProgressLabel) { ClearCraftingProgressLabelCount(); } } private static void UpdateCraftingQueueLifecycle(InventoryGui gui) { UpdateCraftingProgressLabelLifecycle(gui); if (!((Object)(object)_craftingQueueRecipe == (Object)null)) { if ((Object)(object)((RecipeDataPair)(ref gui.m_selectedRecipe)).Recipe != (Object)(object)_craftingQueueRecipe || ((RecipeDataPair)(ref gui.m_selectedRecipe)).ItemData != null || gui.m_selectedVariant != _craftingQueueVariant) { ClearCraftingQueue(); } else if (_craftingQueueRemaining <= 0 && gui.m_craftTimer < 0f) { ClearCraftingQueue(); } } } private static void CaptureCraftingProgressLabelCount(InventoryGui gui, int count) { if (count <= 1 || (Object)(object)((RecipeDataPair)(ref gui.m_selectedRecipe)).Recipe == (Object)null || ((RecipeDataPair)(ref gui.m_selectedRecipe)).ItemData != null) { ClearCraftingProgressLabelCount(); return; } _craftingProgressLabelCount = Mathf.Clamp(count, 1, 99); _craftingProgressLabelRecipe = ((RecipeDataPair)(ref gui.m_selectedRecipe)).Recipe; _craftingProgressLabelVariant = gui.m_selectedVariant; } private static void ClearCraftingProgressLabelCount() { _craftingProgressLabelCount = 0; _craftingProgressLabelRecipe = null; _craftingProgressLabelVariant = 0; } private static void UpdateCraftingProgressLabelLifecycle(InventoryGui gui) { if (!((Object)(object)_craftingProgressLabelRecipe == (Object)null)) { bool num = (Object)(object)((RecipeDataPair)(ref gui.m_selectedRecipe)).Recipe == (Object)(object)_craftingProgressLabelRecipe && ((RecipeDataPair)(ref gui.m_selectedRecipe)).ItemData == null && gui.m_selectedVariant == _craftingProgressLabelVariant; bool flag = (Object)(object)_craftingQueueRecipe == (Object)(object)_craftingProgressLabelRecipe && _craftingQueueRemaining > 0; if (!num || (gui.m_craftTimer < 0f && !flag)) { ClearCraftingProgressLabelCount(); } } } private static void ResetCraftingCountIfSelectionChanged(InventoryGui gui) { Recipe recipe = ((RecipeDataPair)(ref gui.m_selectedRecipe)).Recipe; int selectedVariant = gui.m_selectedVariant; if (!((Object)(object)recipe == (Object)(object)_lastCraftingSelectedRecipe) || selectedVariant != _lastCraftingSelectedVariant) { _lastCraftingSelectedRecipe = recipe; _lastCraftingSelectedVariant = selectedVariant; if (!((Object)(object)recipe == (Object)null)) { ClearCraftingQueue(); SetCraftingCount(1); } } } private static bool ShouldShowCraftingPanelRedesign(InventoryGui? gui) { return ShouldShowCraftingPanelRedesign(gui, GetCraftingTabAdapterState(gui)); } private static bool ShouldShowCraftingPanelRedesign(InventoryGui? gui, CraftingTabAdapterState adapter) { if (!IsDedicatedServer && (Object)(object)gui != (Object)null && (Object)(object)gui.m_crafting != (Object)null && ((Component)gui.m_crafting).gameObject.activeInHierarchy) { return adapter.IsRedesign; } return false; } private static bool IsCraftingRedesignTab(InventoryGui gui) { return GetCraftingTabAdapterState(gui).IsRedesign; } private static bool IsForeignCraftingTab(InventoryGui? gui) { return GetCraftingTabAdapterState(gui).IsForeign; } private static bool ShouldPreserveForeignCraftingControls(InventoryGui gui) { return ShouldPreserveJewelcraftingForeignCraftingControls(gui); } private static bool HasActiveForeignCraftingTab(InventoryGui gui) { if ((Object)(object)gui.m_tabCraft == (Object)null || (Object)(object)gui.m_tabUpgrade == (Object)null) { return false; } Transform parent = ((Component)gui.m_tabCraft).transform.parent; if ((Object)(object)parent == (Object)null) { return false; } Button[] componentsInChildren = ((Component)parent).GetComponentsInChildren