Decompiled source of ExtraSlots v1.1.3
ExtraSlots.dll
Decompiled 3 days ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.IO.Compression; using System.Linq; using System.Reflection; using System.Reflection.Emit; 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 BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using ExtraSlots.Compatibility; using ExtraSlots.HotBars; using HarmonyLib; using JetBrains.Annotations; using LocalizationManager; using Microsoft.CodeAnalysis; using ServerSync; using TMPro; using UnityEngine; using UnityEngine.InputSystem; using UnityEngine.InputSystem.LowLevel; using UnityEngine.UI; using YamlDotNet.Serialization; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("ExtraSlots")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("ExtraSlots")] [assembly: AssemblyCopyright("Copyright © 2024")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("7e559c9a-ba1c-45b5-a260-ec3a1455248b")] [assembly: AssemblyFileVersion("1.1.3")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.1.3.0")] [module: UnverifiableCode] 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; } } } namespace LocalizationManager { [PublicAPI] public class Localizer { private const string defaultLanguage = "English"; private static readonly Dictionary<string, Dictionary<string, Func<string>>> PlaceholderProcessors; private static readonly Dictionary<string, Dictionary<string, string>> loadedTexts; private static readonly ConditionalWeakTable<Localization, string> localizationLanguage; private static readonly List<WeakReference<Localization>> localizationObjects; private static BaseUnityPlugin? _plugin; private static readonly List<string> fileExtensions; private static BaseUnityPlugin Plugin { get { //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Expected O, but got Unknown if (_plugin == null) { IEnumerable<TypeInfo> source; try { source = Assembly.GetExecutingAssembly().DefinedTypes.ToList(); } catch (ReflectionTypeLoadException ex) { source = from t in ex.Types where t != null select t.GetTypeInfo(); } _plugin = (BaseUnityPlugin)Chainloader.ManagerObject.GetComponent((Type)source.First((TypeInfo t) => t.IsClass && typeof(BaseUnityPlugin).IsAssignableFrom(t))); } return _plugin; } } private static void UpdatePlaceholderText(Localization localization, string key) { localizationLanguage.TryGetValue(localization, out string value); string text = loadedTexts[value][key]; if (PlaceholderProcessors.TryGetValue(key, out Dictionary<string, Func<string>> value2)) { text = value2.Aggregate(text, (string current, KeyValuePair<string, Func<string>> kv) => current.Replace("{" + kv.Key + "}", kv.Value())); } localization.AddWord(key, text); } public static void AddPlaceholder<T>(string key, string placeholder, ConfigEntry<T> config, Func<T, string>? convertConfigValue = null) where T : notnull { string key2 = key; string placeholder2 = placeholder; Func<T, string> convertConfigValue2 = convertConfigValue; ConfigEntry<T> config2 = config; if (convertConfigValue2 == null) { convertConfigValue2 = (T val) => val.ToString(); } if (!PlaceholderProcessors.ContainsKey(key2)) { PlaceholderProcessors[key2] = new Dictionary<string, Func<string>>(); } config2.SettingChanged += delegate { UpdatePlaceholder(); }; if (loadedTexts.ContainsKey(Localization.instance.GetSelectedLanguage())) { UpdatePlaceholder(); } void UpdatePlaceholder() { PlaceholderProcessors[key2][placeholder2] = () => convertConfigValue2(config2.Value); UpdatePlaceholderText(Localization.instance, key2); } } public static void AddText(string key, string text) { List<WeakReference<Localization>> list = new List<WeakReference<Localization>>(); foreach (WeakReference<Localization> localizationObject in localizationObjects) { if (localizationObject.TryGetTarget(out var target)) { Dictionary<string, string> dictionary = loadedTexts[localizationLanguage.GetOrCreateValue(target)]; if (!target.m_translations.ContainsKey(key)) { dictionary[key] = text; target.AddWord(key, text); } } else { list.Add(localizationObject); } } foreach (WeakReference<Localization> item in list) { localizationObjects.Remove(item); } } public static void Load() { if (string.IsNullOrEmpty(PlayerPrefs.GetString("language", ""))) { PlayerPrefs.SetString("language", "English"); } LoadLocalization(Localization.instance, Localization.instance.GetSelectedLanguage()); } private static void LoadLocalization(Localization __instance, string language) { //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Expected O, but got Unknown //IL_0256: Unknown result type (might be due to invalid IL or missing references) //IL_0260: Expected O, but got Unknown if (!localizationLanguage.Remove(__instance)) { localizationObjects.Add(new WeakReference<Localization>(__instance)); } localizationLanguage.Add(__instance, language); Dictionary<string, string> dictionary = new Dictionary<string, string>(); foreach (string item in from f in Directory.GetFiles(Path.GetDirectoryName(Paths.PluginPath), Plugin.Info.Metadata.Name + ".*", SearchOption.AllDirectories) where fileExtensions.IndexOf(Path.GetExtension(f)) >= 0 select f) { string text = Path.GetFileNameWithoutExtension(item).Split('.')[1]; if (dictionary.ContainsKey(text)) { Debug.LogWarning((object)("Duplicate key " + text + " found for " + Plugin.Info.Metadata.Name + ". The duplicate file found at " + item + " will be skipped.")); } else { dictionary[text] = item; } } byte[] array = LoadTranslationFromAssembly("English"); if (array == null) { throw new Exception("Found no English localizations in mod " + Plugin.Info.Metadata.Name + ". Expected an embedded resource Translations/English.json or Translations/English.yml."); } Dictionary<string, string> dictionary2 = ((BuilderSkeleton<DeserializerBuilder>)new DeserializerBuilder()).IgnoreFields().Build().Deserialize<Dictionary<string, string>>(Encoding.UTF8.GetString(array)); if (dictionary2 == null) { throw new Exception("Localization for mod " + Plugin.Info.Metadata.Name + " failed: Localization file was empty."); } string text2 = null; if (language != "English") { if (dictionary.ContainsKey(language)) { text2 = File.ReadAllText(dictionary[language]); } else { byte[] array2 = LoadTranslationFromAssembly(language); if (array2 != null) { text2 = Encoding.UTF8.GetString(array2); } } } if (text2 == null && dictionary.ContainsKey("English")) { text2 = File.ReadAllText(dictionary["English"]); } if (text2 != null) { foreach (KeyValuePair<string, string> item2 in ((BuilderSkeleton<DeserializerBuilder>)new DeserializerBuilder()).IgnoreFields().Build().Deserialize<Dictionary<string, string>>(text2) ?? new Dictionary<string, string>()) { dictionary2[item2.Key] = item2.Value; } } loadedTexts[language] = dictionary2; foreach (KeyValuePair<string, string> item3 in dictionary2) { UpdatePlaceholderText(__instance, item3.Key); } } static Localizer() { //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Expected O, but got Unknown //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Expected O, but got Unknown PlaceholderProcessors = new Dictionary<string, Dictionary<string, Func<string>>>(); loadedTexts = new Dictionary<string, Dictionary<string, string>>(); localizationLanguage = new ConditionalWeakTable<Localization, string>(); localizationObjects = new List<WeakReference<Localization>>(); fileExtensions = new List<string> { ".json", ".yml" }; Harmony val = new Harmony("org.bepinex.helpers.LocalizationManager"); val.Patch((MethodBase)AccessTools.DeclaredMethod(typeof(Localization), "LoadCSV", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(AccessTools.DeclaredMethod(typeof(Localizer), "LoadLocalization", (Type[])null, (Type[])null)), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } private static byte[]? LoadTranslationFromAssembly(string language) { foreach (string fileExtension in fileExtensions) { byte[] array = ReadEmbeddedFileBytes("Translations." + language + fileExtension); if (array != null) { return array; } } return null; } public static byte[]? ReadEmbeddedFileBytes(string resourceFileName, Assembly? containingAssembly = null) { string resourceFileName2 = resourceFileName; using MemoryStream memoryStream = new MemoryStream(); if ((object)containingAssembly == null) { containingAssembly = Assembly.GetCallingAssembly(); } string text = containingAssembly.GetManifestResourceNames().FirstOrDefault((string str) => str.EndsWith(resourceFileName2, StringComparison.Ordinal)); if (text != null) { containingAssembly.GetManifestResourceStream(text)?.CopyTo(memoryStream); } return (memoryStream.Length == 0L) ? null : memoryStream.ToArray(); } } } namespace ExtraSlots { internal static class DebugLogging { [HarmonyPatch(typeof(Player), "CreateTombStone")] internal static class Player_CreateTombstone_LoggingItems { [HarmonyPriority(800)] private static void Prefix(Player __instance) { if (IsDebugEnabled && Slots.IsValidPlayer((Character)(object)__instance)) { ExtraSlots.LogDebug("Player.CreateTombStone:Prefix Player Item List:"); ((Humanoid)__instance).GetInventory().LogInventory(); } } [HarmonyPriority(0)] private static void Finalizer(Player __instance) { if (IsDebugEnabled && Slots.IsValidPlayer((Character)(object)__instance)) { ExtraSlots.LogDebug("Player.CreateTombStone:Finalizer Player Item List:"); ((Humanoid)__instance).GetInventory().LogInventory(); } } } [HarmonyPatch(typeof(Inventory), "MoveInventoryToGrave")] internal static class Inventory_MoveInventoryToGrave_LoggingItems { [HarmonyPriority(800)] private static void Prefix(Inventory __instance, Inventory original) { if (IsDebugEnabled) { ExtraSlots.LogDebug("Inventory.MoveInventoryToGrave:Prefix"); ExtraSlots.LogDebug("From inventory " + GetInventoryState(original)); original.LogInventory(); ExtraSlots.LogDebug("To inventory " + GetInventoryState(__instance)); __instance.LogInventory(); } } [HarmonyPriority(0)] private static void Finalizer(Inventory __instance, Inventory original) { if (IsDebugEnabled) { ExtraSlots.LogDebug("Inventory.MoveInventoryToGrave:Finalizer"); ExtraSlots.LogDebug("From inventory " + GetInventoryState(original)); original.LogInventory(); ExtraSlots.LogDebug("To inventory " + GetInventoryState(__instance)); __instance.LogInventory(); } } } internal static bool IsDebugEnabled => ExtraSlots.loggingEnabled.Value && ExtraSlots.loggingDebugEnabled.Value; internal static void LogItem(ItemData item) { //IL_0012: 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) string text = $"{item.m_shared.m_name} {item.m_gridPos} "; Slots.Slot itemSlot = Slots.GetItemSlot(item); ExtraSlots.LogDebug(text + ((itemSlot != null) ? $"slot: {itemSlot} {itemSlot.GridPosition}" : "")); } internal static string GetInventoryState(Inventory inventory) { object[] obj = new object[6] { inventory.m_name, null, null, null, null, null }; Player localPlayer = Player.m_localPlayer; obj[1] = ((localPlayer != null) ? ((Humanoid)localPlayer).GetInventory() : null) == inventory; obj[2] = inventory.m_width; obj[3] = inventory.m_height; obj[4] = inventory.m_totalWeight; obj[5] = inventory.m_inventory.Count; return string.Format("name:{0} isPlayer:{1} size:{2}x{3} weight:{4} items:{5}", obj); } internal static void LogInventory(this Inventory inventory) { CollectionExtensions.Do<ItemData>((IEnumerable<ItemData>)inventory.GetAllItemsInGridOrder(), (Action<ItemData>)LogItem); } } public static class ItemNameTokens { [HarmonyPatch(typeof(Player), "Load")] private static class Player_Load_UpdateRegisters { private static void Prefix() { UpdateRegisters(); } } public static readonly Dictionary<string, string> itemNames = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase); public static void UpdateRegisters() { if (!Object.op_Implicit((Object)(object)ObjectDB.instance)) { return; } foreach (GameObject item in ObjectDB.instance.m_items) { if ((Object)(object)item == (Object)null) { continue; } ItemDrop component = item.GetComponent<ItemDrop>(); if (component == null) { continue; } ItemData itemData = component.m_itemData; if (itemData != null) { SharedData shared = itemData.m_shared; if (shared != null && shared.m_name.StartsWith("$")) { itemNames[((Object)item).name] = shared.m_name; itemNames[shared.m_name] = shared.m_name; } } } } public static string GetItemName(this string input) { return CollectionExtensions.GetValueOrDefault<string, string>((IReadOnlyDictionary<string, string>)itemNames, input.Trim(), input); } } public static class LightenedSlots { private static readonly List<int> m_affectedRows = new List<int>(); public static bool IsEnabled => ExtraSlots.lightenedSlotsStartIndex.Value != 0; public static float WeightFactor => ExtraSlots.lightenedSlotsWeightFactor.Value; public static bool IsRowAffected(int row) { return IsEnabled && m_affectedRows.Contains(row); } public static void UpdateState() { UpdateAffectedRows(); InventoryInteraction.UpdateTotalWeight(); } public static void UpdateAffectedRows() { m_affectedRows.Clear(); if (!IsEnabled || !SlotsProgression.IsPlayerKeyItemConditionMet(ExtraSlots.lightenedSlotsPlayerKey.Value, ExtraSlots.lightenedSlotsItemDiscovered.Value)) { return; } for (int i = 0; i < Slots.InventoryHeightPlayer; i++) { if (!ExtraSlots.lightenedSlotsOnlyExtraRows.Value || i >= 4) { if (ExtraSlots.lightenedSlotsStartIndex.Value < 0 && i >= ExtraSlots.lightenedSlotsStartIndex.Value + Slots.InventoryHeightPlayer) { m_affectedRows.Add(i); } else if (ExtraSlots.lightenedSlotsStartIndex.Value > 0 && i >= ExtraSlots.lightenedSlotsStartIndex.Value - 1) { m_affectedRows.Add(i); } } } } } internal class CustomConfigs { internal class ConfigurationManagerAttributes { [UsedImplicitly] public Action<ConfigEntryBase>? CustomDrawer; } internal static object? configManager; internal static Type? configManagerStyles; internal static GUIStyle GetStyle(GUIStyle other) { //IL_0034: 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_0051: Expected O, but got Unknown if (configManagerStyles == null) { return other; } FieldInfo fieldInfo = AccessTools.Field(configManagerStyles, "fontSize"); if (fieldInfo == null) { return other; } return new GUIStyle(other) { fontSize = (int)fieldInfo.GetValue(configManagerStyles) }; } internal static void Awake() { Assembly assembly = AppDomain.CurrentDomain.GetAssemblies().FirstOrDefault((Assembly a) => a.GetName().Name == "ConfigurationManager"); Type type = assembly?.GetType("ConfigurationManager.ConfigurationManager"); configManager = ((type == null) ? null : Chainloader.ManagerObject.GetComponent(type)); configManagerStyles = assembly?.GetType("ConfigurationManager.ConfigurationManagerStyles"); } internal static Action<ConfigEntryBase> DrawSeparatedStrings(string splitString) { string splitString2 = splitString; return delegate(ConfigEntryBase cfg) { //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Expected O, but got Unknown //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Expected O, but got Unknown bool valueOrDefault = cfg.Description.Tags.Select((object a) => (a.GetType().Name == "ConfigurationManagerAttributes") ? ((bool?)a.GetType().GetField("ReadOnly")?.GetValue(a)) : null).FirstOrDefault((bool? v) => v.HasValue).GetValueOrDefault(); bool flag = false; GUILayout.BeginVertical(Array.Empty<GUILayoutOption>()); List<string> list = new List<string>(); List<string> list2 = ((string)cfg.BoxedValue).Split(new string[1] { splitString2 }, StringSplitOptions.None).ToList(); for (int i = 0; i < list2.Count; i++) { GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); string text = list2[i]; string text2 = GUILayout.TextField(text, GetStyle(GUI.skin.textArea), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) }); if (text2 != text && !valueOrDefault) { flag = true; } if (GUILayout.Button("x", new GUIStyle(GetStyle(GUI.skin.button)) { fixedWidth = 21f }, Array.Empty<GUILayoutOption>()) && !valueOrDefault) { flag = true; } else { list.Add(text2); } if (GUILayout.Button("+", new GUIStyle(GetStyle(GUI.skin.button)) { fixedWidth = 21f }, Array.Empty<GUILayoutOption>()) && !valueOrDefault) { flag = true; list.Add(""); } GUILayout.EndHorizontal(); } GUILayout.EndVertical(); if (flag) { cfg.BoxedValue = string.Join(splitString2, list); } }; } internal static Action<ConfigEntryBase> DrawOrderedFixedStrings(string splitString) { string splitString2 = splitString; return delegate(ConfigEntryBase cfg) { //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Expected O, but got Unknown //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Expected O, but got Unknown bool valueOrDefault = cfg.Description.Tags.Select((object a) => (a.GetType().Name == "ConfigurationManagerAttributes") ? ((bool?)a.GetType().GetField("ReadOnly")?.GetValue(a)) : null).FirstOrDefault((bool? v) => v.HasValue).GetValueOrDefault(); bool flag = false; GUILayout.BeginVertical(Array.Empty<GUILayoutOption>()); string[] array = ((string)cfg.BoxedValue).Split(new string[1] { splitString2 }, StringSplitOptions.None).ToArray(); for (int i = 0; i < array.Length; i++) { GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); string text = array[i]; GUILayout.Label(text, GetStyle(GUI.skin.textArea), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) }); if (GUILayout.Button("ʌ", new GUIStyle(GetStyle(GUI.skin.button)) { fixedWidth = 21f }, Array.Empty<GUILayoutOption>()) && !valueOrDefault && (flag = i > 0)) { ref string reference = ref array[i]; ref string reference2 = ref array[i - 1]; string text2 = array[i - 1]; string text3 = array[i]; reference = text2; reference2 = text3; } if (GUILayout.Button("v", new GUIStyle(GetStyle(GUI.skin.button)) { fixedWidth = 21f }, Array.Empty<GUILayoutOption>()) && !valueOrDefault && (flag = i < array.Length - 1)) { ref string reference = ref array[i]; ref string reference3 = ref array[i + 1]; string text3 = array[i + 1]; string text2 = array[i]; reference = text3; reference3 = text2; } GUILayout.EndHorizontal(); } GUILayout.EndVertical(); if (flag) { cfg.BoxedValue = string.Join(splitString2, array); } }; } } public static class EquipmentPanel { public class SidePanelDefaults { public bool active; public Vector2 anchoredPosition = Vector2.zero; public Vector2 anchorMin = Vector2.zero; public Vector2 anchorMax = Vector2.zero; } private static class SlotPositions { private static int Column(int i) { return i / 3; } private static int Row(int i) { return i % 3; } private static int LastEquipmentRow() { return Row(equipmentSlotsCount - 1); } internal static int LastEquipmentColumn() { return Column(equipmentSlotsCount - 1); } internal static Vector2 GetEquipmentTileOffset(int i) { //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) int x = Column(i) * 4 + ((ExtraSlots.equipmentSlotsAlignment.Value == ExtraSlots.SlotsAlignment.VerticalTopHorizontalMiddle && Row(i) > LastEquipmentRow()) ? 1 : 0) * 2 + Math.Max(quickSlotsCount - 1 - LastEquipmentColumn(), 0) * 2; int y = Row(i) * 4 + Math.Max((ExtraSlots.equipmentSlotsAlignment.Value == ExtraSlots.SlotsAlignment.VerticalMiddleHorizontalLeft && Column(i) == LastEquipmentColumn()) ? (2 - LastEquipmentRow()) : 0, 0) * 2; return GetSlotPosition(x, y); } internal static Vector2 GetQuickSlotTileOffset(int i) { //IL_0034: 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_003c: Unknown result type (might be due to invalid IL or missing references) int x = i * 4 + Math.Max(ExtraSlots.quickSlotsAlignmentCenter.Value ? (LastEquipmentColumn() + 1 - quickSlotsCount) : 0, 0); int y = EquipmentHeight * 4 + 1; return GetSlotPosition(x, y); } internal static Vector2 GetFoodSlotTileOffset(int i) { //IL_001d: 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_0025: Unknown result type (might be due to invalid IL or missing references) int x = Math.Max(LastEquipmentColumn() + 1, quickSlotsCount) * 4 + 1; int y = i * 4; return GetSlotPosition(x, y); } internal static Vector2 GetAmmoSlotTileOffset(int i) { //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_0031: Unknown result type (might be due to invalid IL or missing references) int x = Math.Max(LastEquipmentColumn() + 1, quickSlotsCount) * 4 + 1 + (Slots.IsFoodSlotAvailable() ? 4 : 0); int y = i * 4; return GetSlotPosition(x, y); } internal static Vector2 GetMiscSlotTileOffset(int i) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) int x = Math.Max(LastEquipmentColumn() + 1, quickSlotsCount) * 4 + i * 4 + 1; int y = EquipmentHeight * 4 + 1; return GetSlotPosition(x, y); } private static Vector2 GetSlotPosition(int x, int y) { //IL_0000: 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_0027: Unknown result type (might be due to invalid IL or missing references) return PanelPosition + new Vector2((float)x * 70f / 4f, (float)(-y) * 70f / 4f); } } [HarmonyPatch(typeof(InventoryGui), "Show")] private static class InventoryGui_Show_UpdatePanel { private static void Postfix() { if (!((Object)(object)Player.m_localPlayer == (Object)null)) { UpdatePanel(); } } } [HarmonyPatch(typeof(InventoryGui), "OnDestroy")] private static class InventoryGui_OnDestroy_ClearObjects { private static void Postfix() { ClearPanel(); } } [HarmonyPatch(typeof(InventoryGui), "Update")] private static class InventoryGui_Update_UpdateEquipmentPanel { private static void Postfix() { if (Object.op_Implicit((Object)(object)Player.m_localPlayer) && InventoryGui.IsVisible()) { UpdateEquipmentBackground(); } } } [HarmonyPatch(typeof(InventoryGrid), "UpdateGui")] internal static class InventoryGrid_UpdateGui_UpdateSlotsOnDirty { private static void Prefix(InventoryGrid __instance, ref int __state) { if (!((Object)(object)__instance != (Object)(object)InventoryGui.instance.m_playerGrid)) { __state = __instance.m_elements.Count; } } private static void Postfix(InventoryGrid __instance, int __state) { if (!((Object)(object)__instance != (Object)(object)InventoryGui.instance.m_playerGrid)) { if (__state != __instance.m_elements.Count) { MarkDirty(); } UpdateInventorySlots(); } } } [HarmonyPatch(typeof(InventoryGui), "SetupDragItem")] private static class InventoryGui_SetupDragItem_UpdateSlotsOnItemDrag { private static void Prefix(InventoryGui __instance, ref bool __state) { __state = Object.op_Implicit((Object)(object)__instance.m_dragGo); } private static void Postfix(InventoryGui __instance, bool __state) { MarkDirty(); if (!Object.op_Implicit((Object)(object)__instance.m_dragGo) && __state) { UpdateSidePanels(); } } } [HarmonyPatch(typeof(InventoryGrid), "UpdateGamepad")] public static class InventoryGrid_UpdateGamepad_GamepadSupport { public static Vector2i FindEquipmentSlot(int row = -1, Slots.Slot slotRow = null, int col = -1, Slots.Slot slotCol = null, bool right = false, Slots.Slot before = null, Slots.Slot after = null) { //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) Slots.Slot[] equipmentSlots = Slots.GetEquipmentSlots(); if (row == -1 && slotRow != null) { row = Array.IndexOf(equipmentSlots, slotRow) % 3; } if (col == -1 && slotCol != null) { col = Array.IndexOf(equipmentSlots, slotCol) / 3; } int num = ((before == null) ? (-1) : Array.IndexOf(equipmentSlots, before)); int num2 = ((after == null) ? (-1) : Array.IndexOf(equipmentSlots, after)); int num3 = (right ? equipmentSlots.Length : (-1)); while (true) { num3 = ((!right) ? (num3 + 1) : (num3 - 1)); if (num3 < 0 || num3 == equipmentSlots.Length) { break; } if ((num <= -1 || num3 < num) && (num2 <= -1 || num3 > num2)) { if (row == -1 && col == -1) { return equipmentSlots[num3].GridPosition; } if ((row != -1 && row == num3 % 3) || (col != -1 && col == num3 / 3)) { return equipmentSlots[num3].GridPosition; } } } return Slots.emptyPosition; } private static bool Prefix(InventoryGrid __instance) { //IL_0034: 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_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_0367: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_014c: 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_0157: 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_0176: Unknown result type (might be due to invalid IL or missing references) //IL_04f1: Unknown result type (might be due to invalid IL or missing references) //IL_02f7: Unknown result type (might be due to invalid IL or missing references) //IL_02fc: Unknown result type (might be due to invalid IL or missing references) //IL_01ec: 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_01c0: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_0797: Unknown result type (might be due to invalid IL or missing references) //IL_049c: Unknown result type (might be due to invalid IL or missing references) //IL_04a1: Unknown result type (might be due to invalid IL or missing references) //IL_04a3: Unknown result type (might be due to invalid IL or missing references) //IL_04a5: Unknown result type (might be due to invalid IL or missing references) //IL_032b: Unknown result type (might be due to invalid IL or missing references) //IL_0330: Unknown result type (might be due to invalid IL or missing references) //IL_020f: Unknown result type (might be due to invalid IL or missing references) //IL_0214: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_055d: Unknown result type (might be due to invalid IL or missing references) //IL_04b6: Unknown result type (might be due to invalid IL or missing references) //IL_04b8: Unknown result type (might be due to invalid IL or missing references) //IL_065e: Unknown result type (might be due to invalid IL or missing references) //IL_0663: Unknown result type (might be due to invalid IL or missing references) //IL_0514: Unknown result type (might be due to invalid IL or missing references) //IL_0519: Unknown result type (might be due to invalid IL or missing references) //IL_0405: Unknown result type (might be due to invalid IL or missing references) //IL_040a: Unknown result type (might be due to invalid IL or missing references) //IL_09de: Unknown result type (might be due to invalid IL or missing references) //IL_07ee: Unknown result type (might be due to invalid IL or missing references) //IL_07f3: Unknown result type (might be due to invalid IL or missing references) //IL_05d3: Unknown result type (might be due to invalid IL or missing references) //IL_0831: Unknown result type (might be due to invalid IL or missing references) //IL_0836: Unknown result type (might be due to invalid IL or missing references) //IL_075b: Unknown result type (might be due to invalid IL or missing references) //IL_0760: Unknown result type (might be due to invalid IL or missing references) //IL_0580: Unknown result type (might be due to invalid IL or missing references) //IL_0585: Unknown result type (might be due to invalid IL or missing references) //IL_0471: Unknown result type (might be due to invalid IL or missing references) //IL_0476: Unknown result type (might be due to invalid IL or missing references) //IL_0458: Unknown result type (might be due to invalid IL or missing references) //IL_045d: Unknown result type (might be due to invalid IL or missing references) //IL_0296: Unknown result type (might be due to invalid IL or missing references) //IL_029b: Unknown result type (might be due to invalid IL or missing references) //IL_0281: Unknown result type (might be due to invalid IL or missing references) //IL_0286: Unknown result type (might be due to invalid IL or missing references) //IL_0982: Unknown result type (might be due to invalid IL or missing references) //IL_0987: Unknown result type (might be due to invalid IL or missing references) //IL_0919: Unknown result type (might be due to invalid IL or missing references) //IL_091e: Unknown result type (might be due to invalid IL or missing references) //IL_06d0: Unknown result type (might be due to invalid IL or missing references) //IL_06d5: Unknown result type (might be due to invalid IL or missing references) //IL_0644: Unknown result type (might be due to invalid IL or missing references) //IL_0649: Unknown result type (might be due to invalid IL or missing references) //IL_02de: Unknown result type (might be due to invalid IL or missing references) //IL_02e3: Unknown result type (might be due to invalid IL or missing references) //IL_02c7: Unknown result type (might be due to invalid IL or missing references) //IL_02cc: Unknown result type (might be due to invalid IL or missing references) //IL_0bd1: Unknown result type (might be due to invalid IL or missing references) //IL_09a2: Unknown result type (might be due to invalid IL or missing references) //IL_09a7: Unknown result type (might be due to invalid IL or missing references) //IL_093f: Unknown result type (might be due to invalid IL or missing references) //IL_0944: Unknown result type (might be due to invalid IL or missing references) //IL_08b9: Unknown result type (might be due to invalid IL or missing references) //IL_08ae: Unknown result type (might be due to invalid IL or missing references) //IL_08b3: Unknown result type (might be due to invalid IL or missing references) //IL_05f6: Unknown result type (might be due to invalid IL or missing references) //IL_05fb: Unknown result type (might be due to invalid IL or missing references) //IL_095f: Unknown result type (might be due to invalid IL or missing references) //IL_0964: Unknown result type (might be due to invalid IL or missing references) //IL_0888: Unknown result type (might be due to invalid IL or missing references) //IL_088d: Unknown result type (might be due to invalid IL or missing references) //IL_0732: Unknown result type (might be due to invalid IL or missing references) //IL_0737: Unknown result type (might be due to invalid IL or missing references) //IL_0a3d: Unknown result type (might be due to invalid IL or missing references) //IL_08de: Unknown result type (might be due to invalid IL or missing references) //IL_08e3: Unknown result type (might be due to invalid IL or missing references) //IL_0b51: Unknown result type (might be due to invalid IL or missing references) //IL_0b1e: Unknown result type (might be due to invalid IL or missing references) //IL_0b23: Unknown result type (might be due to invalid IL or missing references) //IL_0aeb: Unknown result type (might be due to invalid IL or missing references) //IL_0af0: Unknown result type (might be due to invalid IL or missing references) //IL_0b45: Unknown result type (might be due to invalid IL or missing references) //IL_0b4a: Unknown result type (might be due to invalid IL or missing references) //IL_0aa2: Unknown result type (might be due to invalid IL or missing references) //IL_0aa7: Unknown result type (might be due to invalid IL or missing references) //IL_0b95: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)__instance != (Object)(object)InventoryGui.instance.m_playerGrid || !__instance.m_uiGroup.IsActive || Console.IsVisible()) { return true; } Slots.Slot slotInGrid = Slots.GetSlotInGrid(__instance.m_selected); if (ZInput.GetButtonDown("JoyDPadLeft") || ZInput.GetButtonDown("JoyLStickLeft")) { ExtraSlots.LogDebug($"From {__instance.m_selected} {slotInGrid} left"); if (slotInGrid != null) { if (slotInGrid.IsAmmoSlot) { __instance.m_selected.x += 3; Slots.Slot slotInGrid2 = Slots.GetSlotInGrid(__instance.m_selected); if (slotInGrid2 == null || !slotInGrid2.IsActive) { int num = __instance.m_selected.x % 3; __instance.m_selected = FindEquipmentSlot(num, null, -1, null, right: true); if (__instance.m_selected == Slots.emptyPosition) { __instance.m_selected = new Vector2i(Slots.InventoryWidth - 1, num); } } } else if (slotInGrid.IsFoodSlot) { int num2 = __instance.m_selected.x % 3; __instance.m_selected = FindEquipmentSlot(num2, null, -1, null, right: true); if (__instance.m_selected == Slots.emptyPosition) { __instance.m_selected = new Vector2i(Slots.InventoryWidth - 1, num2); } } else if (slotInGrid.IsQuickSlot) { __instance.m_selected.x--; if (__instance.m_selected.x < 0) { __instance.m_selected = new Vector2i(Slots.InventoryWidth - 1, 3); } } else if (slotInGrid.IsMiscSlot) { __instance.m_selected.x--; Slots.Slot slotInGrid3 = Slots.GetSlotInGrid(__instance.m_selected); if (slotInGrid3 == null) { __instance.m_selected = new Vector2i(Slots.InventoryWidth - 1, 3); } else if (!slotInGrid3.IsActive) { if (slotInGrid3.IsQuickSlot) { IEnumerable<Slots.Slot> source = from slot in Slots.GetQuickSlots() where slot.IsActive select slot; if (source.Any()) { __instance.m_selected = source.Last().GridPosition; } else { __instance.m_selected = new Vector2i(Slots.InventoryWidth - 1, 3); } } else if (slotInGrid3.IsMiscSlot && quickSlotsCount == 0) { __instance.m_selected = new Vector2i(Slots.InventoryWidth - 1, 3); } else { __instance.m_selected = new Vector2i(Slots.InventoryWidth - 1, 3); } } } else { __instance.m_selected = FindEquipmentSlot(-1, slotInGrid, -1, null, right: true, slotInGrid); if (__instance.m_selected.x < 0) { __instance.m_selected = new Vector2i(Slots.InventoryWidth - 1, Array.IndexOf(Slots.GetEquipmentSlots(), slotInGrid) % 3); } } return false; } } if (ZInput.GetButtonDown("JoyDPadRight") || ZInput.GetButtonDown("JoyLStickRight")) { ExtraSlots.LogDebug($"From {__instance.m_selected} {slotInGrid} right"); if (slotInGrid != null) { if (slotInGrid.IsFoodSlot) { Slots.Slot slotInGrid4 = Slots.GetSlotInGrid(new Vector2i(__instance.m_selected.x - 3, __instance.m_selected.y)); if (slotInGrid4 != null && slotInGrid4.IsActive) { __instance.m_selected = slotInGrid4.GridPosition; } } else { if (slotInGrid.IsAmmoSlot) { return false; } if (slotInGrid.IsMiscSlot) { Slots.Slot slotInGrid5 = Slots.GetSlotInGrid(new Vector2i(__instance.m_selected.x + 1, __instance.m_selected.y)); if (slotInGrid5 != null && slotInGrid5.IsActive) { __instance.m_selected = slotInGrid5.GridPosition; } } else if (slotInGrid.IsQuickSlot) { if (__instance.m_selected.x < quickSlotsCount - 1) { Slots.Slot slotInGrid6 = Slots.GetSlotInGrid(new Vector2i(__instance.m_selected.x + 1, __instance.m_selected.y)); if (slotInGrid6 != null && slotInGrid6.IsActive) { __instance.m_selected = slotInGrid6.GridPosition; } } else { IEnumerable<Slots.Slot> source2 = from slot in Slots.GetMiscSlots() where slot.IsActive select slot; if (source2.Any()) { __instance.m_selected = source2.First().GridPosition; } } } else { __instance.m_selected = FindEquipmentSlot(-1, slotInGrid, -1, null, right: false, null, slotInGrid); if (__instance.m_selected.x < 0) { Slots.Slot[] array = (from slot in Slots.GetFoodSlots() where slot.IsActive select slot).ToArray(); if (array.Length == 3) { __instance.m_selected = array[Array.IndexOf(Slots.GetEquipmentSlots(), slotInGrid) % 3].GridPosition; return false; } Slots.Slot[] array2 = (from slot in Slots.GetAmmoSlots() where slot.IsActive select slot).ToArray(); if (array2.Length == 3) { __instance.m_selected = array2[Array.IndexOf(Slots.GetEquipmentSlots(), slotInGrid) % 3].GridPosition; return false; } } if (__instance.m_selected.x < 0) { __instance.m_selected = slotInGrid.GridPosition; } } } return false; } if (__instance.m_selected.x >= Slots.InventoryWidth - 1) { if (__instance.m_selected.y > 2) { IEnumerable<Slots.Slot> source3 = from slot in Slots.GetQuickSlots() where slot.IsActive select slot; if (source3.Any()) { __instance.m_selected = source3.First().GridPosition; return false; } IEnumerable<Slots.Slot> source4 = from slot in Slots.GetMiscSlots() where slot.IsActive select slot; if (source4.Any()) { __instance.m_selected = source4.First().GridPosition; return false; } __instance.m_selected = new Vector2i(0, Slots.InventoryHeightPlayer); } else { Vector2i val = FindEquipmentSlot(Math.Min(__instance.m_selected.y, equipmentSlotsCount - 1)); if (val != Slots.emptyPosition) { __instance.m_selected = val; } } return false; } } if (ZInput.GetButtonDown("JoyDPadUp") || ZInput.GetButtonDown("JoyLStickUp")) { ExtraSlots.LogDebug($"From {__instance.m_selected} {slotInGrid} up"); if (slotInGrid != null) { if (slotInGrid.IsFoodSlot) { __instance.m_selected.x--; if (__instance.m_selected.x < 3) { __instance.m_selected = slotInGrid.GridPosition; } } else if (slotInGrid.IsAmmoSlot) { __instance.m_selected.x--; if (__instance.m_selected.x < 0) { __instance.m_selected = slotInGrid.GridPosition; } } else if (slotInGrid.IsMiscSlot) { if (slotInGrid.Index == 6) { Slots.Slot slot2 = Slots.GetFoodSlots().Last(); __instance.m_selected = ((slot2 != null && slot2.IsActive) ? slot2 : Slots.GetAmmoSlots().Last()).GridPosition; } else if (slotInGrid.Index == 7) { __instance.m_selected = Slots.GetAmmoSlots().Last().GridPosition; } Slots.Slot slotInGrid7 = Slots.GetSlotInGrid(__instance.m_selected); if (slotInGrid7 == null || !slotInGrid7.IsActive) { __instance.m_selected = slotInGrid.GridPosition; } } else if (slotInGrid.IsQuickSlot) { __instance.m_selected = FindEquipmentSlot(-1, null, Math.Min(__instance.m_selected.x, equipmentSlotsCount / 3), null, right: true); if (__instance.m_selected.x < 0) { __instance.m_selected = FindEquipmentSlot(-1, null, -1, null, right: true); } if (__instance.m_selected.x < 0) { __instance.m_selected = slotInGrid.GridPosition; } } else { __instance.m_selected = FindEquipmentSlot(-1, null, Array.IndexOf(Slots.GetEquipmentSlots(), slotInGrid) / 3, null, right: true, slotInGrid); if (__instance.m_selected.x < 0) { __instance.m_selected = slotInGrid.GridPosition; } } return false; } } if (ZInput.GetButtonDown("JoyDPadDown") || ZInput.GetButtonDown("JoyLStickDown")) { ExtraSlots.LogDebug($"From {__instance.m_selected} {slotInGrid} down"); if (slotInGrid != null) { if (slotInGrid.IsQuickSlot || slotInGrid.IsMiscSlot) { if (!__instance.jumpToNextContainer) { return false; } __instance.OnMoveToLowerInventoryGrid?.Invoke(__instance.m_selected); return false; } if (slotInGrid.IsAmmoSlot) { __instance.m_selected.x++; if (__instance.m_selected.x > 2) { Slots.Slot slot3 = Slots.GetMiscSlots()[1]; __instance.m_selected = ((slot3 != null && slot3.IsActive) ? slot3 : Slots.GetMiscSlots()[0]).GridPosition; } } else if (slotInGrid.IsFoodSlot) { __instance.m_selected.x++; if (__instance.m_selected.x > 5) { __instance.m_selected = Slots.GetMiscSlots()[0].GridPosition; } } else if (slotInGrid.IsEquipmentSlot) { int num3 = Array.IndexOf(Slots.GetEquipmentSlots(), slotInGrid) / 3; __instance.m_selected = FindEquipmentSlot(-1, null, num3, null, right: false, null, slotInGrid); if (__instance.m_selected.x < 0) { __instance.m_selected = Slots.GetQuickSlots()[num3].GridPosition; } } Slots.Slot slotInGrid8 = Slots.GetSlotInGrid(__instance.m_selected); if (slotInGrid8 == null || !slotInGrid8.IsActive) { if (!__instance.jumpToNextContainer) { return false; } __instance.OnMoveToLowerInventoryGrid?.Invoke(__instance.m_selected); } return false; } if (__instance.m_selected.y >= Slots.InventoryHeightPlayer - 1) { __instance.OnMoveToLowerInventoryGrid?.Invoke(__instance.m_selected); return false; } } return true; } private static void Postfix(InventoryGrid __instance, bool __runOriginal) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) if (!__runOriginal) { ExtraSlots.LogDebug($"Selected {__instance.m_selected}"); } } } [HarmonyPatch(typeof(InventoryGrid), "SetSelection")] public static class InventoryGrid_SetSelection_GamepadSupport { private static void Postfix(Vector2i pos) { //IL_0003: 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) pos.y = Math.Min(pos.y, Slots.InventoryHeightPlayer - 1); ExtraSlots.LogDebug($"SetSelection {pos}"); } } [HarmonyPatch(typeof(RectTransformUtility), "RectangleContainsScreenPoint", new Type[] { typeof(RectTransform), typeof(Vector2) })] public static class RectTransformUtility_RectangleContainsScreenPoint_BackpacksCompat { private static void Postfix(RectTransform rect, Vector2 screenPoint, ref bool __result) { //IL_0059: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)InventoryGui.instance) || (Object)(object)rect != (Object)(object)InventoryGui.instance.m_playerGrid.m_gridRoot) { return; } for (int i = 0; i < Math.Min(Slots.slots.Length, InventoryGui.instance.m_playerGrid.m_elements.Count - Slots.InventorySizePlayer); i++) { Transform transform = InventoryGui.instance.m_playerGrid.m_elements[Slots.InventorySizePlayer + i].m_go.transform; if (RectTransformUtility.RectangleContainsScreenPoint((RectTransform)(object)((transform is RectTransform) ? transform : null), screenPoint)) { __result = true; break; } } } } private const string BackgroundName = "ExtraSlotsEquipmentPanel"; private const float tileSpace = 6f; private const float tileSize = 70f; private const float interslotSpaceInTiles = 0.25f; private const float inventoryPanelOffset = 100f; private static int equipmentSlotsCount = 0; internal static int quickSlotsCount = 0; public static RectTransform inventoryDarken = null; public static RectTransform inventoryBackground = null; public static Image inventoryBackgroundImage = null; public static RectTransform equipmentBackground = null; public static Image equipmentBackgroundImage = null; public static RectTransform selectedFrame = null; public static RectTransform inventorySelectedFrame = null; private static bool isDirty = true; private static int updateSidePanelsInFrames; private static int updateSidePanelsPreviousExtraRows = -10; private static Color normalColor = Color.clear; private static Color highlightedColor = Color.clear; private static Color normalColorUnfit = Color.clear; private static Color highlightedColorUnfit = Color.clear; private static Material iconMaterial; private static Vector3 originalScale = Vector3.zero; private static Vector2 originalTooltipPosition = Vector2.zero; internal static Sprite ammoSlot; internal static Sprite miscSlot; internal static Sprite quickSlot; internal static Sprite lightenedSlot; internal static Sprite background; private static readonly Dictionary<string, SidePanelDefaults> defaultPositionsSidePanels = new Dictionary<string, SidePanelDefaults>(); private static float InventoryPanelWidth { get { //IL_001d: 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) float result; if (!Object.op_Implicit((Object)(object)InventoryGui.instance)) { result = 0f; } else { Rect rect = InventoryGui.instance.m_player.rect; result = ((Rect)(ref rect)).width; } return result; } } private static float PanelWidth => ((float)Math.Max(quickSlotsCount, SlotPositions.LastEquipmentColumn() + 1) + FoodAmmoSlotsWidthInTiles) * 70f + 3f; private static float PanelHeight => (((quickSlotsCount > 0 || Slots.IsFirstMiscSlotAvailable()) ? 1.25f : 0f) + (float)EquipmentHeight) * 70f + 3f; private static Vector2 PanelOffset => new Vector2(ExtraSlots.equipmentPanelOffset.Value.x, 0f - ExtraSlots.equipmentPanelOffset.Value.y); private static Vector2 PanelPosition => new Vector2(InventoryPanelWidth + 100f, 0f) + PanelOffset; private static float FoodAmmoSlotsWidthInTiles => ((Slots.IsFoodSlotAvailable() || Slots.IsAmmoSlotAvailable()) ? 0.25f : 0f) + (Slots.IsFoodSlotAvailable() ? 1f : 0f) + (Slots.IsAmmoSlotAvailable() ? 1f : 0f); private static int EquipmentHeight => (equipmentSlotsCount > 3 || Slots.IsFoodSlotAvailable() || Slots.IsAmmoSlotAvailable()) ? 3 : equipmentSlotsCount; private static RectTransform SelectedFrameArmor { get { Transform obj = ((Transform)InventoryGui.instance.m_player).Find("selected_frame/selected (2)"); return (RectTransform)(object)((obj is RectTransform) ? obj : null); } } private static RectTransform SelectedFrameWeight { get { Transform obj = ((Transform)InventoryGui.instance.m_player).Find("selected_frame/selected (3)"); return (RectTransform)(object)((obj is RectTransform) ? obj : null); } } public static void MarkDirty() { isDirty = true; } public static void UpdateSidePanels() { updateSidePanelsInFrames = 3; } internal static void UpdateSlotsCount() { equipmentSlotsCount = Slots.GetEquipmentSlotsCount(); quickSlotsCount = Slots.GetQuickSlotsCount(); } internal static void ReorderVanillaSlots() { string[] newSlotsOrder = (from str in ExtraSlots.vanillaSlotsOrder.Value.Split(',') select str.Trim()).Distinct().ToArray(); Slots.Slot[] array = Slots.slots.Where((Slots.Slot slot) => slot?.IsVanillaEquipment() ?? false).ToArray(); int i; for (i = 0; i < Mathf.Min(newSlotsOrder.Length, array.Length); i++) { int num = Array.FindIndex(Slots.slots, (Slots.Slot slot) => slot.ID == newSlotsOrder[i]); if (num >= 0) { int num2 = Array.IndexOf(Slots.slots, array[i]); if (num2 >= 0) { Slots.SwapSlots(num, num2); } } } SetSlotsPositions(); } internal static void UpdatePanel() { UpdateSlotsCount(); UpdateBackground(); SetSlotsPositions(); MarkDirty(); UpdateSidePanels(); } internal static void UpdateInventorySlots() { //IL_002d: 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_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_02ea: Unknown result type (might be due to invalid IL or missing references) //IL_02ef: Unknown result type (might be due to invalid IL or missing references) //IL_031d: Unknown result type (might be due to invalid IL or missing references) //IL_0322: Unknown result type (might be due to invalid IL or missing references) //IL_030e: Unknown result type (might be due to invalid IL or missing references) //IL_0313: Unknown result type (might be due to invalid IL or missing references) //IL_0377: Unknown result type (might be due to invalid IL or missing references) //IL_0381: Unknown result type (might be due to invalid IL or missing references) //IL_0390: Unknown result type (might be due to invalid IL or missing references) //IL_039b: Unknown result type (might be due to invalid IL or missing references) //IL_03a0: Unknown result type (might be due to invalid IL or missing references) //IL_0341: Unknown result type (might be due to invalid IL or missing references) //IL_0356: Unknown result type (might be due to invalid IL or missing references) //IL_035b: Unknown result type (might be due to invalid IL or missing references) InventoryGui.instance.m_playerGrid.m_gridRoot.SetSizeWithCurrentAnchors((Axis)1, (float)Slots.InventoryHeightPlayer * InventoryGui.instance.m_playerGrid.m_elementSpace); if (originalScale == Vector3.zero && InventoryGui.instance.m_playerGrid.m_elements.Count > 0) { Image icon = InventoryGui.instance.m_playerGrid.m_elements[0].m_icon; if (icon != null && (Object)(object)((Graphic)icon).material != (Object)null) { originalScale = ((Component)icon).transform.localScale; } } int inventorySizePlayer = Slots.InventorySizePlayer; for (int i = 0; i < Math.Min(Slots.slots.Length, InventoryGui.instance.m_playerGrid.m_elements.Count - inventorySizePlayer); i++) { SetSlotBackgroundImage(InventoryGui.instance.m_playerGrid.m_elements[inventorySizePlayer + i], Slots.slots[i]); } for (int j = 0; j < Math.Min(inventorySizePlayer, InventoryGui.instance.m_playerGrid.m_elements.Count); j++) { SetInventorySlotBackgroundImage(InventoryGui.instance.m_playerGrid.m_elements[j], LightenedSlots.IsRowAffected(j / Slots.InventoryWidth)); } if (!isDirty || Slots.PlayerInventory == null || !Object.op_Implicit((Object)(object)InventoryGui.instance.m_playerGrid)) { return; } bool flag = InventoryGui.instance.m_dragItem != null && ((Humanoid)Slots.CurrentPlayer).IsItemEquiped(InventoryGui.instance.m_dragItem) && Slots.IsItemInEquipmentSlot(InventoryGui.instance.m_dragItem); for (int k = 0; k < Math.Min(InventoryGui.instance.m_playerGrid.m_elements.Count, inventorySizePlayer); k++) { Element obj = InventoryGui.instance.m_playerGrid.m_elements[k]; object button; if (obj == null) { button = null; } else { GameObject go = obj.m_go; button = ((go != null) ? go.GetComponent<Button>() : null); } SetSlotColor((Button)button, flag); } for (int l = 0; l < Math.Min(Slots.slots.Length, InventoryGui.instance.m_playerGrid.m_elements.Count - inventorySizePlayer); l++) { SetSlotElement(InventoryGui.instance.m_playerGrid.m_elements[inventorySizePlayer + l], Slots.slots[l], flag); } for (int m = inventorySizePlayer + Slots.slots.Length; m < InventoryGui.instance.m_playerGrid.m_elements.Count; m++) { Element obj2 = InventoryGui.instance.m_playerGrid.m_elements[m]; if (obj2 != null) { GameObject go2 = obj2.m_go; if (go2 != null) { go2.SetActive(false); } } } if (originalTooltipPosition == Vector2.zero) { originalTooltipPosition = InventoryGui.instance.m_playerGrid.m_tooltipAnchor.anchoredPosition; } if (ExtraSlots.equipmentPanelTooltipOffset.Value == Vector2.zero) { InventoryGui.instance.m_playerGrid.m_tooltipAnchor.anchoredPosition = originalTooltipPosition - new Vector2(0f, PanelHeight + 21f); } else { InventoryGui.instance.m_playerGrid.m_tooltipAnchor.anchoredPosition = originalTooltipPosition + new Vector2(ExtraSlots.equipmentPanelTooltipOffset.Value.x, 0f - ExtraSlots.equipmentPanelTooltipOffset.Value.y); } isDirty = false; } public static void UpdateBackground() { //IL_0026: 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_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)equipmentBackground)) { equipmentBackground.sizeDelta = new Vector2(PanelWidth, PanelHeight); equipmentBackground.anchoredPosition = PanelPosition + new Vector2(PanelWidth / 2f, (0f - PanelHeight) / 2f); if (Object.op_Implicit((Object)(object)selectedFrame)) { selectedFrame.sizeDelta = equipmentBackground.sizeDelta + Vector2.one * 26f; selectedFrame.anchoredPosition = equipmentBackground.anchoredPosition; } } } internal static void SetSlotElement(Element element, Slots.Slot slot, bool regularInventoryUnfitsForDragItem) { //IL_0039: Unknown result type (might be due to invalid IL or missing references) GameObject val = element?.m_go; if (Object.op_Implicit((Object)(object)val)) { val.gameObject.SetActive(slot.IsActive); val.GetComponent<RectTransform>().anchoredPosition = slot.Position; SetSlotLabel(val.transform.Find("binding"), slot); SetSlotColor(val.GetComponent<Button>(), InventoryGui.instance.m_dragItem != null && slot.IsActive && (!slot.ItemFits(InventoryGui.instance.m_dragItem) || (!slot.IsEquipmentSlot && regularInventoryUnfitsForDragItem))); SetSlotStackColor(element.m_amount, slot); } } internal static void SetSlotLabel(Transform binding, Slots.Slot slot, bool hotbarElement = false) { if (Object.op_Implicit((Object)(object)binding) && slot.IsActive) { SetSlotLabel(((Component)binding).GetComponent<RectTransform>(), ((Component)binding).GetComponent<TMP_Text>(), slot, hotbarElement); } } internal static void SetSlotLabel(RectTransform rectTransform, TMP_Text textComponent, Slots.Slot slot, bool hotbarElement = false) { //IL_0002: 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_001a: 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_0032: 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_0095: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: 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_0107: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: Unknown result type (might be due to invalid IL or missing references) //IL_01f0: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: Unknown result type (might be due to invalid IL or missing references) rectTransform.anchorMin = Vector2.zero; rectTransform.anchorMax = Vector2.one; rectTransform.offsetMin = Vector2.zero; rectTransform.offsetMax = Vector2.zero; rectTransform.sizeDelta = Vector2.zero; rectTransform.anchoredPosition = Vector2.zero; textComponent.enableAutoSizing = true; textComponent.text = ((!hotbarElement) ? slot.Name : (ZInput.IsGamepadActive() ? "" : slot.GetShortcutText())); ((Behaviour)textComponent).enabled = true; textComponent.overflowMode = (TextOverflowModes)0; textComponent.fontSizeMin = ((!slot.IsHotkeySlot) ? ExtraSlots.equipmentSlotLabelFontSize.Value.x : (slot.IsAmmoSlot ? ExtraSlots.ammoSlotLabelFontSize.Value.x : ExtraSlots.quickSlotLabelFontSize.Value.x)); textComponent.fontSizeMax = ((!slot.IsHotkeySlot) ? ExtraSlots.equipmentSlotLabelFontSize.Value.y : (slot.IsAmmoSlot ? ExtraSlots.ammoSlotLabelFontSize.Value.y : ExtraSlots.quickSlotLabelFontSize.Value.y)); ((Graphic)textComponent).color = ((!slot.IsHotkeySlot) ? ExtraSlots.equipmentSlotLabelFontColor.Value : (slot.IsAmmoSlot ? ExtraSlots.ammoSlotLabelFontColor.Value : ExtraSlots.quickSlotLabelFontColor.Value)); textComponent.margin = ((!slot.IsHotkeySlot) ? ExtraSlots.equipmentSlotLabelMargin.Value : (slot.IsAmmoSlot ? ExtraSlots.ammoSlotLabelMargin.Value : ExtraSlots.quickSlotLabelMargin.Value)); textComponent.textWrappingMode = ((!slot.IsHotkeySlot) ? ExtraSlots.equipmentSlotLabelWrappingMode.Value : (slot.IsAmmoSlot ? ExtraSlots.ammoSlotLabelWrappingMode.Value : ExtraSlots.quickSlotLabelWrappingMode.Value)); textComponent.horizontalAlignment = ((!slot.IsHotkeySlot) ? ExtraSlots.equipmentSlotLabelAlignment.Value : (slot.IsAmmoSlot ? ExtraSlots.ammoSlotLabelAlignment.Value : ExtraSlots.quickSlotLabelAlignment.Value)); textComponent.verticalAlignment = (VerticalAlignmentOptions)256; } internal static void SetSlotColor(Button button, bool useUnfitColor) { //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_0039: 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_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_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_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005c: 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_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009d: 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_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: 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_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)button)) { ColorBlock colors; if (normalColor == Color.clear) { colors = ((Selectable)button).colors; normalColor = ((ColorBlock)(ref colors)).normalColor; } if (highlightedColor == Color.clear) { colors = ((Selectable)button).colors; highlightedColor = ((ColorBlock)(ref colors)).highlightedColor; } if (normalColorUnfit == Color.clear) { colors = ((Selectable)button).colors; normalColorUnfit = ((ColorBlock)(ref colors)).normalColor + new Color(0.3f, 0f, 0f, 0.1f); } if (highlightedColorUnfit == Color.clear) { colors = ((Selectable)button).colors; highlightedColorUnfit = ((ColorBlock)(ref colors)).highlightedColor + new Color(0.3f, 0f, 0f, 0.1f); } ColorBlock colors2 = ((Selectable)button).colors; ((ColorBlock)(ref colors2)).normalColor = (useUnfitColor ? normalColorUnfit : normalColor); ((ColorBlock)(ref colors2)).highlightedColor = (useUnfitColor ? highlightedColorUnfit : highlightedColor); ((Selectable)button).colors = colors2; } } private static void SetInventorySlotBackgroundImage(Element element, bool weightReduction) { //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_010e: 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_012c: 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_0193: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: 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) if ((Object)(object)iconMaterial == (Object)null && (Object)(object)((Graphic)element.m_icon).material != (Object)null) { iconMaterial = ((Graphic)element.m_icon).material; } if ((Object)(object)((Graphic)element.m_icon).material == (Object)null) { ((Graphic)element.m_icon).material = iconMaterial; } if (element.m_used || !weightReduction) { ((Graphic)element.m_icon).material = iconMaterial; ((Component)element.m_icon).transform.localScale = ((originalScale == Vector3.zero) ? Vector3.one : originalScale); return; } ((Behaviour)element.m_icon).enabled = ExtraSlots.lightenedSlotsShowHintImage.Value; ((Graphic)element.m_icon).material = null; element.m_icon.sprite = lightenedSlot; ((Component)element.m_icon).transform.localScale = Vector3.one * 0.7f; ((Graphic)element.m_icon).color = Color.grey - new Color(0f, 0f, 0f, 0.7f); if (ExtraSlots.lightenedSlotsShowTooltip.Value) { element.m_tooltip.Set("$exsl_slot_lightened", Localization.instance.Localize("$exsl_slot_lightened_desc", new string[1] { $"{1f - LightenedSlots.WeightFactor:P0}" }), InventoryGui.instance.m_playerGrid.m_tooltipAnchor, default(Vector2)); } } private static void SetSlotBackgroundImage(Element element, Slots.Slot slot) { //IL_00e1: 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_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_0251: Unknown result type (might be due to invalid IL or missing references) //IL_025b: Unknown result type (might be due to invalid IL or missing references) //IL_026c: Unknown result type (might be due to invalid IL or missing references) //IL_0285: Unknown result type (might be due to invalid IL or missing references) //IL_028a: Unknown result type (might be due to invalid IL or missing references) //IL_01ee: 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) //IL_00f9: 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_033e: Unknown result type (might be due to invalid IL or missing references) //IL_0348: Unknown result type (might be due to invalid IL or missing references) //IL_0359: 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_0377: Unknown result type (might be due to invalid IL or missing references) //IL_02db: Unknown result type (might be due to invalid IL or missing references) //IL_02e1: Unknown result type (might be due to invalid IL or missing references) //IL_042b: Unknown result type (might be due to invalid IL or missing references) //IL_0435: Unknown result type (might be due to invalid IL or missing references) //IL_0446: Unknown result type (might be due to invalid IL or missing references) //IL_045f: Unknown result type (might be due to invalid IL or missing references) //IL_0464: Unknown result type (might be due to invalid IL or missing references) //IL_03c8: Unknown result type (might be due to invalid IL or missing references) //IL_03ce: Unknown result type (might be due to invalid IL or missing references) //IL_04e2: Unknown result type (might be due to invalid IL or missing references) //IL_04fb: Unknown result type (might be due to invalid IL or missing references) //IL_0500: Unknown result type (might be due to invalid IL or missing references) //IL_04a0: Unknown result type (might be due to invalid IL or missing references) //IL_04a6: Unknown result type (might be due to invalid IL or missing references) //IL_0551: Unknown result type (might be due to invalid IL or missing references) //IL_0557: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)iconMaterial == (Object)null && (Object)(object)((Graphic)element.m_icon).material != (Object)null) { iconMaterial = ((Graphic)element.m_icon).material; } if ((Object)(object)((Graphic)element.m_icon).material == (Object)null) { ((Graphic)element.m_icon).material = iconMaterial; } bool isFree = slot.IsFree; if (!isFree) { ItemData item = slot.Item; if (element.m_tooltip.m_topic.IndexOf(item.m_shared.m_name, StringComparison.OrdinalIgnoreCase) == -1) { element.m_tooltip.Set(item.m_shared.m_name, item.GetTooltip(-1), InventoryGui.instance.m_playerGrid.m_tooltipAnchor, default(Vector2)); } ((Component)element.m_icon).transform.localScale = ((originalScale == Vector3.zero) ? Vector3.one : originalScale); ((Graphic)element.m_icon).material = iconMaterial; if (!slot.IsEquipmentSlot || !EpicLootCompat.isEnabled || ExtraSlots.epicLootMagicItemUnequippedAlpha.Value == 1f || item.m_equipped) { return; } Transform val = element.m_go.transform.Find("magicItem"); if (val != null) { Image component = ((Component)val).GetComponent<Image>(); if (component != null) { ((Graphic)component).color = new Color(((Graphic)component).color.r, ((Graphic)component).color.g, ((Graphic)component).color.b, ExtraSlots.epicLootMagicItemUnequippedAlpha.Value); } } } else if (slot.IsEquipmentSlot) { if (ExtraSlots.equipmentSlotsShowTooltip.Value) { element.m_tooltip.Set("$exsl_slot_equipment", "$exsl_slot_equipment_desc", InventoryGui.instance.m_playerGrid.m_tooltipAnchor, default(Vector2)); } } else if (slot.IsAmmoSlot) { ((Behaviour)element.m_icon).enabled = ExtraSlots.ammoSlotsShowHintImage.Value; ((Graphic)element.m_icon).material = null; element.m_icon.sprite = ammoSlot; ((Component)element.m_icon).transform.localScale = Vector3.one * 0.8f; ((Graphic)element.m_icon).color = Color.grey - new Color(0f, 0f, 0f, 0.1f); if (ExtraSlots.ammoSlotsShowTooltip.Value) { element.m_tooltip.Set(string.Format(ExtraSlots.ammoSlotsTooltipNameFormat.Value, "$exsl_slot_ammo", slot.GetShortcutText()), "$exsl_slot_ammo_desc", InventoryGui.instance.m_playerGrid.m_tooltipAnchor, default(Vector2)); } } else if (slot.IsQuickSlot) { ((Behaviour)element.m_icon).enabled = ExtraSlots.quickSlotsShowHintImage.Value; ((Graphic)element.m_icon).material = null; element.m_icon.sprite = quickSlot; ((Component)element.m_icon).transform.localScale = Vector3.one * 0.6f; ((Graphic)element.m_icon).color = Color.grey - new Color(0f, 0f, 0f, 0.6f); if (ExtraSlots.quickSlotsShowTooltip.Value) { element.m_tooltip.Set(string.Format(ExtraSlots.quickSlotsTooltipNameFormat.Value, "$exsl_slot_quick", slot.GetShortcutText()), "$exsl_slot_quick_desc", InventoryGui.instance.m_playerGrid.m_tooltipAnchor, default(Vector2)); } } else if (slot.IsMiscSlot) { ((Behaviour)element.m_icon).enabled = ExtraSlots.miscSlotsShowHintImage.Value; ((Graphic)element.m_icon).material = null; element.m_icon.sprite = miscSlot; ((Component)element.m_icon).transform.localScale = Vector3.one * 0.8f; ((Graphic)element.m_icon).color = Color.grey - new Color(0f, 0f, 0f, 0.75f); if (ExtraSlots.miscSlotsShowTooltip.Value) { element.m_tooltip.Set("$exsl_slot_misc", "$exsl_slot_misc_desc", InventoryGui.instance.m_playerGrid.m_tooltipAnchor, default(Vector2)); } } else if (slot.IsFoodSlot && isFree) { ((Behaviour)element.m_food).enabled = ExtraSlots.foodSlotsShowHintImage.Value; ((Graphic)element.m_food).color = Color.grey - new Color(0f, 0f, 0f, 0.5f); if (ExtraSlots.foodSlotsShowTooltip.Value) { element.m_tooltip.Set(string.Format(ExtraSlots.foodSlotsTooltipNameFormat.Value, "$exsl_slot_food", slot.GetShortcutText()), "$exsl_slot_food_desc", InventoryGui.instance.m_playerGrid.m_tooltipAnchor, default(Vector2)); } } } private static void SetSlotStackColor(TMP_Text text, Slots.Slot slot) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: 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) Color slotStackSizeColor = GetSlotStackSizeColor(slot); if (slotStackSizeColor != Color.clear) { ((Graphic)text).color = slotStackSizeColor; } } internal static void SetSlotsPositions() { SetPosition(Slots.GetEquipmentSlots(), SlotPositions.GetEquipmentTileOffset); SetPosition(Slots.GetQuickSlots(), SlotPositions.GetQuickSlotTileOffset); SetPosition(Slots.GetFoodSlots(), SlotPositions.GetFoodSlotTileOffset); SetPosition(Slots.GetAmmoSlots(), SlotPositions.GetAmmoSlotTileOffset); SetPosition(Slots.GetMiscSlots(), SlotPositions.GetMiscSlotTileOffset); static void SetPosition(Slots.Slot[] collection, Func<int, Vector2> offsetFunc) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < collection.Length; i++) { collection[i].SetPosition(offsetFunc(i)); } } } private static Color GetSlotStackSizeColor(Slots.Slot slot) { //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) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0067: 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_0043: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) if (slot.IsMiscSlot) { return ExtraSlots.miscSlotsStackColor.Value; } if (slot.IsFoodSlot) { return ExtraSlots.foodSlotsStackColor.Value; } if (slot.IsAmmoSlot) { return ExtraSlots.ammoSlotsStackColor.Value; } if (slot.IsQuickSlot) { return ExtraSlots.quickSlotsStackColor.Value; } return Color.clear; } internal static void UpdateEquipmentBackground() { //IL_03dc: Unknown result type (might be due to invalid IL or missing references) //IL_035a: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_045f: Unknown result type (might be due to invalid IL or missing references) //IL_0401: Unknown result type (might be due to invalid IL or missing references) //IL_0426: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01de: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_0285: Unknown result type (might be due to invalid IL or missing references) //IL_029a: Unknown result type (might be due to invalid IL or missing references) //IL_02af: Unknown result type (might be due to invalid IL or missing references) //IL_02c4: Unknown result type (might be due to invalid IL or missing references) //IL_02d9: Unknown result type (might be due to invalid IL or missing references) //IL_02ee: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)InventoryGui.instance)) { return; } if (inventoryBackground == null) { RectTransform player = InventoryGui.instance.m_player; object obj; if (player == null) { obj = null; } else { Transform obj2 = ((Transform)player).Find("Bkg"); obj = ((obj2 != null) ? ((Component)obj2).GetComponent<RectTransform>() : null); } inventoryBackground = (RectTransform)obj; } if ((Object)(object)inventoryBackground == (Object)null) { return; } if (!Object.op_Implicit((Object)(object)equipmentBackground) && Object.op_Implicit((Object)(object)InventoryGui.instance.m_player)) { UIGroupHandler component = ((Component)InventoryGui.instance.m_player).GetComponent<UIGroupHandler>(); Transform val = ((component != null) ? component.m_enableWhenActiveAndGamepad.transform : null); inventoryDarken = ((Component)((Transform)InventoryGui.instance.m_player).Find("Darken")).GetComponent<RectTransform>(); equipmentBackground = new GameObject("ExtraSlotsEquipmentPanel", new Type[1] { typeof(RectTransform) }).GetComponent<RectTransform>(); ((Component)equipmentBackground).gameObject.layer = ((Component)inventoryBackground).gameObject.layer; ((Transform)equipmentBackground).SetParent((Transform)(object)InventoryGui.instance.m_player, false); ((Transform)equipmentBackground).SetSiblingIndex(1 + (((Object)(object)val == (Object)null) ? ((Transform)inventoryDarken).GetSiblingIndex() : val.GetSiblingIndex())); equipmentBackground.offsetMin = Vector2.zero; equipmentBackground.offsetMax = Vector2.zero; equipmentBackground.sizeDelta = Vector2.zero; equipmentBackground.anchoredPosition = Vector2.zero; equipmentBackground.anchorMin = new Vector2(0f, 1f); equipmentBackground.anchorMax = new Vector2(0f, 1f); RectTransform val2 = Object.Instantiate<RectTransform>(inventoryDarken, (Transform)(object)equipmentBackground); ((Object)val2).name = "Darken"; val2.sizeDelta = Vector2.one * 70f; Transform val3 = Object.Instantiate<Transform>(((Component)inventoryBackground).transform, (Transform)(object)equipmentBackground); ((Object)val3).name = "Bkg"; equipmentBackgroundImage = ((Component)val3).GetComponent<Image>(); inventoryBackgroundImage = ((Component)((Component)inventoryBackground).transform).GetComponent<Image>(); if ((Object)(object)val != (Object)null) { Transform child = val.GetChild(0); inventorySelectedFrame = (RectTransform)(object)((child is RectTransform) ? child : null); selectedFrame = Object.Instantiate<RectTransform>(inventorySelectedFrame, val); ((Object)selectedFrame).name = "selected (ExtraSlots)"; selectedFrame.offsetMin = equipmentBackground.offsetMin; selectedFrame.offsetMax = equipmentBackground.offsetMax; selectedFrame.sizeDelta = equipmentBackground.sizeDelta; selectedFrame.anchoredPosition = equipmentBackground.anchoredPosition; selectedFrame.anchorMin = equipmentBackground.anchorMin; selectedFrame.anchorMax = equipmentBackground.anchorMax; } UpdateBackground(); } if (Object.op_Implicit((Object)(object)equipmentBackgroundImage)) { if (Object.op_Implicit((Object)(object)inventoryBackgroundImage)) { equipmentBackgroundImage.sprite = inventoryBackgroundImage.sprite; equipmentBackgroundImage.overrideSprite = inventoryBackgroundImage.overrideSprite; ((Graphic)equipmentBackgroundImage).color = ((Graphic)inventoryBackgroundImage).color; } if (Object.op_Implicit((Object)(object)background)) { equipmentBackgroundImage.sprite = background; equipmentBackgroundImage.overrideSprite = background; } } int extraRowsPlayer = Slots.ExtraRowsPlayer; if (Object.op_Implicit((Object)(object)inventoryBackground)) { inventoryBackground.anchorMin = new Vector2(0f, -1f * ((float)extraRowsPlayer / 4f - 0.01f * (float)Math.Max(extraRowsPlayer - 1, 0))); if (Object.op_Implicit((Object)(object)inventorySelectedFrame)) { inventorySelectedFrame.anchorMin = inventoryBackground.anchorMin; } if (Object.op_Implicit((Object)(object)inventoryDarken)) { inventoryDarken.anchorMin = inventoryBackground.anchorMin; } } if (ExtraSlots.fixContainerPosition.Value) { InventoryGui.instance.m_container.pivot = new Vector2(0f, 1f + (float)extraRowsPlayer * 0.2f); } if (updateSidePanelsInFrames >= 0) { updateSidePanelsInFrames--; } if (updateSidePanelsInFrames != 0) { return; } if (updateSidePanelsPreviousExtraRows == -10) { UpdateSidePanelsDefaultPositions(); updateSidePanelsPreviousExtraRows = extraRowsPlayer; } bool num; if (updateSidePanelsPreviousExtraRows >= extraRowsPlayer) { num = extraRowsPlayer < 0; } else { if (extraRowsPlayer <= 0) { goto IL_04d6; } num = updateSidePanelsPreviousExtraRows < 0; } if (num) { goto IL_04d6; } goto IL_04dd; IL_04d6: MoveSidePanels(extraRowsPlayer); goto IL_04dd; IL_04dd: updateSidePanelsPreviousExtraRows = extraRowsPlayer; } private static void MoveSidePanels(int extraRows) { //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_012a: 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_036f: Unknown result type (might be due to invalid IL or missing references) //IL_037d: Unknown result type (might be due to invalid IL or missing references) //IL_038b: Unknown result type (might be due to invalid IL or missing references) //IL_039a: Unknown result type (might be due to invalid IL or missing references) //IL_039f: Unknown result type (might be due to invalid IL or missing references) //IL_015d: 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_01d9: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: 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_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_03e5: Unknown result type (might be due to invalid IL or missing references) //IL_03f3: Unknown result type (might be due to invalid IL or missing references) //IL_0401: Unknown result type (might be due to invalid IL or missing references) //IL_0410: Unknown result type (might be due to invalid IL or missing references) //IL_0415: Unknown result type (might be due to invalid IL or missing references) //IL_02a8: Unknown result type (might be due to invalid IL or missing references) //IL_02b7: 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_0297: Unknown result type (might be due to invalid IL or missing references) //IL_0210: 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_025b: Unknown result type (might be due to invalid IL or missing references) //IL_026a: Unknown result type (might be due to invalid IL or missing references) //IL_023b: Unknown result type (might be due to invalid IL or missing references) //IL_024a: Unknown result type (might be due to invalid IL or missing references) List<List<RectTransform>> list = new List<List<RectTransform>>(); AddPanelGroup(list, ExtraSlots.reducedInventoryPanel1.Value); AddPanelGroup(list, ExtraSlots.reducedInventoryPanel2.Value); AddPanelGroup(list, ExtraSlots.reducedInventoryPanel3.Value); if (extraRows >= 0) { CollectionExtensions.Do<List<RectTransform>>((IEnumerable<List<RectTransform>>)list, (Action<List<RectTransform>>)delegate(List<RectTransform> group) { CollectionExtensions.Do<RectTransform>((IEnumerable<RectTransform>)group, (Action<RectTransform>)RestorePositionAndVisibility); }); RestorePositionAndVisibility(SelectedFrameArmor); RestorePositionAndVisibility(SelectedFrameWeight); return; } CollectionExtensions.Do<List<RectTransform>>((IEnumerable<List<RectTransform>>)list, (Action<List<RectTransform>>)delegate(List<RectTransform> group) { CollectionExtensions.Do<RectTransform>((IEnumerable<RectTransform>)group, (Action<RectTransform>)CheckVisibility); }); list.RemoveAll((List<RectTransform> group) => !group.Any((RectTransform g) => ((Component)g).gameObject.activeSelf)); RectTransform val = null; RectTransform val2 = null; for (int i = 0; i < list.Count; i++) { for (int j = 0; j < list[i].Count; j++) { RectTransform val3 = list[i][j]; if (extraRows == -3) { val3.anchorMin = Vector2.one; val3.anchorMax = Vector2.one; val3.anchoredPosition = new Vector2(val3.anchoredPosition.x, -37f); } else if (extraRows == -2) { val3.anchorMin = Vector2.one; val3.anchorMax = Vector2.one; if (i == 0) { val3.anchoredPosition = new Vector2(val3.anchoredPosition.x, -37f); } else { val3.anchoredPosition = new Vector2(val3.anchoredPosition.x, -107f); } } else if (extraRows == -1) { val3.anchorMin = Vector2.one; val3.anchorMax = Vector2.one; if (list.Count == 3) { switch (i) { case 0: val3.anchoredPosition = new Vector2(val3.anchoredPosition.x, -33f); break; case 1: val3.anchoredPosition = new Vector2(val3.anchoredPosition.x, -107f); break; default: val3.anchoredPosition = new Vector2(val3.anchoredPosition.x, -183f); break; } } else if (i == 0) { val3.anchoredPosition = new Vector2(val3.anchoredPosition.x, -42f); } else { val3.anchoredPosition = new Vector2(val3.anchoredPosition.x, -172f); } } if (((Object)val3).name == "Armor") { val = val3; } else if (((Object)val3).name == "Weight") { val2 = val3; } } } if ((Object)(object)val != (Object)null) { RectTransform selectedFrameArmor = SelectedFrameArmor; if (selectedFrameArmor != null) { ((Component)selectedFrameArmor).gameObject.SetActive(((Component)val).gameObject.activeSelf); selectedFrameArmor.anchorMin = val.anchorMin; selectedFrameArmor.anchorMax = val.anchorMax; selectedFrameArmor.anchoredPosition = val.anchoredPosition + new Vector2(-2f, 0f); } } if ((Object)(object)val2 != (Object)null) { RectTransform selectedFrameWeight = SelectedFrameWeight; if (selectedFrameWeight != null) { ((Component)selectedFrameWeight).gameObject.SetActive(((Component)val2).gameObject.activeSelf); selectedFrameWeight.anchorMin = val2.anchorMin; selectedFrameWeight.anchorMax = val2.anchorMax; selectedFrameWeight.anchoredPosition = val2.anchoredPosition + new Vector2(1f, 0f); } } void CheckVisibility(RectTransform panel) { bool flag = true; if (defaultPositionsSidePanels.TryGetValue(((Object)panel).name, out var value)) { flag = value.active; } if (extraRows < -2) { flag = flag && ExtraSlots.reducedInventoryPanelVisibility1.Value.Split(',').Contains<string>(((Object)panel).name, StringComparer.OrdinalIgnoreCase); } else if (extraRows < -1) { flag = flag && ExtraSlots.reducedInventoryPanelVisibility2.Value.Split(',').Contains<string>(((Object)panel).name, StringComparer.OrdinalIgnoreCase); } else if (extraRows < 0) { flag = flag && ExtraSlots.reducedInventoryPanelVisibility3.Value.Split(',').Contains<string>(((Object)panel).name, StringComparer.OrdinalIgnoreCase); } ((Component)panel).gameObject.SetActive(flag); } } private static void RestorePositionAndVisibility(RectTransform panel) { //IL_002b: 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_0045: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)panel == (Object)null) && defaultPositionsSidePanels.TryGetValue(((Object)panel).name, out var value)) { panel.anchorMin = value.anchorMin; panel.anchorMax = value.anchorMax; panel.anchoredPosition = value.anchoredPosition; ((Component)panel).gameObject.SetActive(value.active); } } private static void AddPanelGroup(List<List<RectTransform>> groups, string config) { List<RectTransform> list = new List<RectTransform>(); string[] array = config.Split(',', StringSplitOptions.RemoveEmptyEntries); foreach (string text in array) { if (!string.IsNullOrWhiteSpace(text)) { Transform obj = ((Transform)InventoryGui.instance.m_player).Find(text); RectTransform val = (RectTransform)(object)((obj is RectTransform) ? obj : null); if (val != null) { list.Add(val); } } } if (list.Count > 0) { groups.Add(list); } } private static void UpdateSidePanelsDefaultPositions() { //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: 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_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_015d: 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_0169: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: 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_01c4: 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) defaultPositionsSidePanels.Clear(); if (!Object.op_Implicit((Object)(object)InventoryGui.instance.m_player)) { return; } List<string> list = new List<string>(); list.AddRange(ExtraSlots.reducedInventoryPanel1.Value.Split(',')); list.AddRange(ExtraSlots.reducedInventoryPanel2.Value.Split(',')); list.AddRange(ExtraSlots.reducedInventoryPanel3.Value.Split(',')); foreach (string item in list) { Transform obj = ((Transform)InventoryGui.instance.m_player).Find(item); RectTransform val = (RectTransform)(object)((obj is RectTransform) ? obj : null); if (val != null) { defaultPositionsSidePanels[item] = new SidePanelDefaults { active = ((Component)val).gameObject.activeSelf, anchoredPosition = val.anchoredPosition, anchorMax = val.anchorMax, anchorMin = val.anchorMin }; } } RectTransform selectedFrameArmor = SelectedFrameArmor; if (selectedFrameArmor != null) { defaultPositionsSidePanels[((Object)selectedFrameArmor).name] = new SidePanelDefaults { active = ((Component)selectedFrameArmor).gameObject.activeSelf, anchoredPosition = selectedFrameArmor.anchoredPosition, anchorMax = selectedFrameArmor.anchorMax, anchorMin = selectedFrameArmor.anchorMin }; } RectTransform selectedFrameWeight = SelectedFrameWeight; if (selectedFrameWeight != null) { defaultPositionsSidePanels[((Object)selectedFrameWeight).name] = new SidePanelDefaults { active = ((Component)selectedFrameWeight).gameObject.activeSelf, anchoredPosition = selectedFrameWeight.anchoredPosition, anchorMax = selectedFrameWeight.anchorMax, anchorMin = selectedFrameWeight.anchorMin }; } } internal static void ClearPanel() { //IL_002b: 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_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing reference