using System; using System.Collections; using System.Collections.Generic; using System.Collections.Specialized; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using ImprovedBeltBag.Networking; using ImprovedBeltBag.Patches; using ImprovedBeltBag.Utils; using Microsoft.CodeAnalysis; using Unity.Collections; using Unity.Netcode; using UnityEngine; using UnityEngine.Events; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: IgnoresAccessChecksTo("AmazingAssets.TerrainToMesh")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: IgnoresAccessChecksTo("ClientNetworkTransform")] [assembly: IgnoresAccessChecksTo("com.olegknyazev.softmask")] [assembly: IgnoresAccessChecksTo("DissonanceVoip")] [assembly: IgnoresAccessChecksTo("DunGen")] [assembly: IgnoresAccessChecksTo("DunGen.Integration.ASPP")] [assembly: IgnoresAccessChecksTo("DunGen.Integration.UnityNav")] [assembly: IgnoresAccessChecksTo("EasyTextEffects")] [assembly: IgnoresAccessChecksTo("Facepunch Transport for Netcode for GameObjects")] [assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")] [assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")] [assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging")] [assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging.DocCodeExamples")] [assembly: IgnoresAccessChecksTo("Unity.Burst")] [assembly: IgnoresAccessChecksTo("Unity.Burst.Unsafe")] [assembly: IgnoresAccessChecksTo("Unity.Collections")] [assembly: IgnoresAccessChecksTo("Unity.Collections.LowLevel.ILSupport")] [assembly: IgnoresAccessChecksTo("Unity.InputSystem")] [assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")] [assembly: IgnoresAccessChecksTo("Unity.Jobs")] [assembly: IgnoresAccessChecksTo("Unity.Mathematics")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.Common")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.MetricTypes")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStats")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Component")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Configuration")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Implementation")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsReporting")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkProfiler.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkSolutionInterface")] [assembly: IgnoresAccessChecksTo("Unity.Netcode.Components")] [assembly: IgnoresAccessChecksTo("Unity.Netcode.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.Networking.Transport")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Csg")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.KdTree")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Poly2Tri")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Stl")] [assembly: IgnoresAccessChecksTo("Unity.Profiling.Core")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Config.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")] [assembly: IgnoresAccessChecksTo("Unity.Services.Authentication")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Analytics")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Components")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Configuration")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Device")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments.Internal")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Internal")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Networking")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Registration")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Scheduler")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Telemetry")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Threading")] [assembly: IgnoresAccessChecksTo("Unity.Services.QoS")] [assembly: IgnoresAccessChecksTo("Unity.Services.Relay")] [assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")] [assembly: IgnoresAccessChecksTo("Unity.Timeline")] [assembly: IgnoresAccessChecksTo("Unity.VisualEffectGraph.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.XR.CoreUtils")] [assembly: IgnoresAccessChecksTo("Unity.XR.Management")] [assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR")] [assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR.Features.ConformanceAutomation")] [assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR.Features.MetaQuestSupport")] [assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR.Features.MockRuntime")] [assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR.Features.OculusQuestSupport")] [assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR.Features.RuntimeDebugger")] [assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.SpatialTracking")] [assembly: IgnoresAccessChecksTo("UnityEngine.UI")] [assembly: IgnoresAccessChecksTo("UnityEngine.XR.LegacyInputHelpers")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("Iron.ImprovedBeltBag")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("ImprovedBeltBag")] [assembly: AssemblyTitle("Iron.ImprovedBeltBag")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace ImprovedBeltBag { internal static class ItemClassifier { public static bool IsShotgun(GrabbableObject g) { if (!HasClass(g, "ShotgunItem")) { return NameIs(g, "shotgun"); } return true; } public static bool IsKnife(GrabbableObject g) { if (!HasClass(g, "KnifeItem")) { return NameContains(g, "knife"); } return true; } public static bool IsSign(GrabbableObject g) { string text = Name(g); if (text == "stop sign" || text == "yield sign") { return true; } if (HasClass(g, "Shovel") && (Object)(object)g.itemProperties != (Object)null) { return g.itemProperties.isScrap; } return false; } private static string Name(GrabbableObject g) { if (!((Object)(object)g.itemProperties != (Object)null) || g.itemProperties.itemName == null) { return ""; } return g.itemProperties.itemName.Trim().ToLowerInvariant(); } private static bool NameIs(GrabbableObject g, string s) { return Name(g) == s; } private static bool NameContains(GrabbableObject g, string s) { return Name(g).Contains(s); } private static bool HasClass(GrabbableObject g, string simpleName) { Type type = ((object)g).GetType(); while (type != null && type != typeof(GrabbableObject)) { if (type.Name == simpleName) { return true; } type = type.BaseType; } return false; } } [BepInPlugin("Iron.ImprovedBeltBag", "ImprovedBeltBag", "1.0.0")] public class Plugin : BaseUnityPlugin { public const string PLUGIN_GUID = "Iron.ImprovedBeltBag"; public const string PLUGIN_NAME = "ImprovedBeltBag"; public const string PLUGIN_VERSION = "1.0.0"; private Harmony _harmony; internal static Plugin Instance { get; private set; } internal static ManualLogSource Log { get; private set; } private void Awake() { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Expected O, but got Unknown Instance = this; Log = ((BaseUnityPlugin)this).Logger; try { PluginConfig.Init(((BaseUnityPlugin)this).Config); _harmony = new Harmony("Iron.ImprovedBeltBag"); _harmony.PatchAll(typeof(Plugin).Assembly); Log.LogInfo((object)"ImprovedBeltBag v1.0.0 loaded."); } catch (Exception arg) { Log.LogError((object)$"Failed to initialize; the mod is inactive: {arg}"); } } } internal static class PluginConfig { internal interface ICategoryConfig { string CategoryName { get; } bool Allow { get; } int Limit { get; } } internal sealed class StaticCategoryConfig : ICategoryConfig { public string CategoryName { get; } public bool Allow { get; } public int Limit { get; } public StaticCategoryConfig(string name, bool allow, int limit) { CategoryName = name; Allow = allow; Limit = limit; } } internal sealed class CategoryConfig : ICategoryConfig { private readonly ConfigEntry _allow; private readonly ConfigEntry _limit; public string CategoryName { get; } public bool Allow => _allow.Value; public int Limit => _limit.Value; public CategoryConfig(ConfigFile cfg, string name, bool allowDefault, string desc) { //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Expected O, but got Unknown CategoryName = name; _allow = cfg.Bind("Category." + name, "Allow", allowDefault, "Allow storing " + name + ". " + desc); _limit = cfg.Bind("Category." + name, "Max Amount", -1, new ConfigDescription("Max number of " + name + " at once (-1 = only limited by Capacity).", (AcceptableValueBase)(object)new AcceptableValueRange(-1, 100), Array.Empty())); } } internal const string ToolsCategory = "Tools"; internal const string ShotgunCategory = "Shotgun"; internal const string KnifeCategory = "Knife"; internal const string SignsCategory = "Signs"; internal const string OneHandedScrapCategory = "One Handed Scrap"; internal const string TwoHandedScrapCategory = "Two Handed Scrap"; internal const string DenyCategory = "Deny"; internal static ConfigEntry Enabled; internal static ConfigEntry Capacity; internal static ConfigEntry ResizeSlotUI; internal static ConfigEntry SlotsPerRow; internal static ConfigEntry ItemCategories; internal static StringDictionary Associations = new StringDictionary(); internal static readonly Dictionary CategoryConfigs = new Dictionary(); internal static ConfigEntry WeightEnabled; internal static ConfigEntry WeightMultiplier; internal static ConfigEntry GrabRange; internal static ConfigEntry Tooltip; internal static ConfigEntry DropAll; internal static ConfigEntry EnforceCapacity; internal static ConfigEntry EnforceCategory; internal static ConfigEntry EnforceRange; internal static void Init(ConfigFile cfg) { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Expected O, but got Unknown //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Expected O, but got Unknown //IL_01fd: Unknown result type (might be due to invalid IL or missing references) //IL_0207: Expected O, but got Unknown //IL_0235: Unknown result type (might be due to invalid IL or missing references) //IL_023f: Expected O, but got Unknown Enabled = cfg.Bind("General", "Enabled", true, "Master switch for the whole mod."); Capacity = cfg.Bind("Slots", "Capacity", 15, new ConfigDescription("How many items the bag can hold.", (AcceptableValueBase)(object)new AcceptableValueRange(1, 100), Array.Empty())); ResizeSlotUI = cfg.Bind("Slots", "Resize Inventory UI", true, "Rebuild the belt bag inventory grid so the number of visible slot squares matches Capacity."); SlotsPerRow = cfg.Bind("Slots", "Slots Per Row", 5, new ConfigDescription("How many slot squares per row when the UI is rebuilt.", (AcceptableValueBase)(object)new AcceptableValueRange(1, 20), Array.Empty())); ItemCategories = cfg.Bind("Items", "Per-Item Overrides", "Body: Deny, Apparatus: Deny", "Comma-separated 'ItemName: CategoryName' overrides, e.g. 'Zap gun: Deny, Gold bar: Scrap'. Any category name you use here is auto-created below with Allow/Max settings."); CategoryConfigs["Tools"] = new CategoryConfig(cfg, "Tools", allowDefault: true, "Non-scrap tools/equipment: flashlight, walkie-talkie, zap gun, extension ladder, shovel, etc."); CategoryConfigs["Shotgun"] = new CategoryConfig(cfg, "Shotgun", allowDefault: true, "The Shotgun."); CategoryConfigs["Knife"] = new CategoryConfig(cfg, "Knife", allowDefault: true, "The Kitchen knife."); CategoryConfigs["Signs"] = new CategoryConfig(cfg, "Signs", allowDefault: true, "Stop sign / Yield sign."); CategoryConfigs["One Handed Scrap"] = new CategoryConfig(cfg, "One Handed Scrap", allowDefault: false, "Generic ONE-handed sellable scrap / metal loot (not knife/signs). OFF by default. Use 'Max Amount' to cap how many one-handed junk items fit."); CategoryConfigs["Two Handed Scrap"] = new CategoryConfig(cfg, "Two Handed Scrap", allowDefault: false, "Generic TWO-handed sellable scrap / large metal loot (not shotgun). OFF by default. Use 'Max Amount' to cap how many two-handed junk items fit."); CategoryConfigs["Deny"] = new StaticCategoryConfig("Deny", allow: false, 0); RebuildAssociations(); ItemCategories.SettingChanged += delegate { RebuildAssociations(); }; WeightEnabled = cfg.Bind("Weight", "Enabled", true, "Make the bag weigh you down by the weight of its contents (vanilla bags are weightless)."); WeightMultiplier = cfg.Bind("Weight", "Multiplier", 1f, new ConfigDescription("Fraction of each stored item's weight that is applied while you carry the bag.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 2f), Array.Empty())); GrabRange = cfg.Bind("Misc", "Grab Range", 4f, new ConfigDescription("Max range to grab items into the bag.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 20f), Array.Empty())); Tooltip = cfg.Bind("Misc", "Tooltips", true, "Show a HUD tip when an item can't be stored (full / not allowed / limit reached)."); DropAll = cfg.Bind("Misc", "Empty Bag Action", true, "Right-interact while holding the bag empties it onto the ground."); EnforceCapacity = cfg.Bind("Host", "Enforce Capacity", true, "Server-side capacity check (prevents clients exceeding the host's Capacity)."); EnforceCategory = cfg.Bind("Host", "Enforce Restrictions", true, "Server-side item-restriction check (prevents clients bagging items the host disallows)."); EnforceRange = cfg.Bind("Host", "Enforce Range", true, "Server-side grab-range check."); ((Dictionary)(typeof(ConfigFile).GetProperty("OrphanedEntries", BindingFlags.Instance | BindingFlags.NonPublic)?.GetValue(cfg)))?.Clear(); cfg.Save(); } private static void RebuildAssociations() { StringDictionary stringDictionary = new StringDictionary(); string[] array = ItemCategories.Value.Split(','); for (int i = 0; i < array.Length; i++) { string text = array[i].Trim(); if (text.Length != 0) { string[] array2 = text.Split(':'); if (array2.Length != 2) { Plugin.Log.LogError((object)("Per-Item Overrides: malformed entry '" + text + "'")); } else { stringDictionary[array2[0].Trim()] = array2[1].Trim(); } } } Associations = stringDictionary; foreach (string value in stringDictionary.Values) { if (!CategoryConfigs.ContainsKey(value)) { CategoryConfigs[value] = new CategoryConfig(((BaseUnityPlugin)Plugin.Instance).Config, value, allowDefault: true, "Custom category."); } } } internal static ICategoryConfig CategoryOf(GrabbableObject grabbable) { string itemName = grabbable.itemProperties.itemName; if (itemName != null && Associations.ContainsKey(itemName) && CategoryConfigs.TryGetValue(Associations[itemName], out var value)) { return value; } if (ItemClassifier.IsShotgun(grabbable)) { return CategoryConfigs["Shotgun"]; } if (ItemClassifier.IsKnife(grabbable)) { return CategoryConfigs["Knife"]; } if (ItemClassifier.IsSign(grabbable)) { return CategoryConfigs["Signs"]; } if (!grabbable.itemProperties.isScrap) { return CategoryConfigs["Tools"]; } if (!grabbable.itemProperties.twoHanded) { return CategoryConfigs["One Handed Scrap"]; } return CategoryConfigs["Two Handed Scrap"]; } } } namespace ImprovedBeltBag.Utils { internal static class NgoUtils { internal static bool IsRpcServerStage(this NetworkBehaviour self) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Invalid comparison between Unknown and I4 NetworkManager networkManager = self.NetworkManager; if ((Object)(object)networkManager == (Object)null || !networkManager.IsListening) { return false; } if ((int)self.__rpc_exec_stage != 1) { return false; } if (!networkManager.IsServer) { return networkManager.IsHost; } return true; } } } namespace ImprovedBeltBag.Patches { [HarmonyPatch] internal static class BagUiPatch { private static string _iconPath; private static bool _captured; private static Vector2 _cellSize; private static float _xStep; private static float _yStep; private static Vector2 _center; [HarmonyPrefix] [HarmonyPatch(typeof(BeltBagInventoryUI), "FillSlots")] private static void BeforeFillSlots(BeltBagInventoryUI __instance) { if (!BeltBagPatch.Enabled || !PluginConfig.Enabled.Value || !PluginConfig.ResizeSlotUI.Value) { return; } try { EnsureSlots(__instance); } catch (Exception arg) { Plugin.Log.LogError((object)$"Belt bag UI resize failed (harmless): {arg}"); } } private static void EnsureSlots(BeltBagInventoryUI ui) { GameObject[] inventorySlots = ui.inventorySlots; Image[] inventorySlotIcons = ui.inventorySlotIcons; if (inventorySlots == null || inventorySlots.Length == 0 || inventorySlotIcons == null || inventorySlotIcons.Length == 0) { return; } int num = Mathf.Clamp(PluginConfig.Capacity.Value, 1, 100); int num2 = inventorySlots.Length; if (num2 == num) { return; } GameObject val = inventorySlots[0]; Transform parent = val.transform.parent; if (_iconPath == null) { _iconPath = RelativePath(inventorySlots[0].transform, ((Component)inventorySlotIcons[0]).transform); } CaptureMetrics(inventorySlots); DisableLayoutGroups(parent); GameObject[] array = (GameObject[])(object)new GameObject[num]; Image[] array2 = (Image[])(object)new Image[num]; for (int i = 0; i < num; i++) { GameObject val2; Image val3; if (i < num2 && (Object)(object)inventorySlots[i] != (Object)null) { val2 = inventorySlots[i]; val3 = inventorySlotIcons[i]; } else { val2 = Object.Instantiate(val, parent); ((Object)val2).name = $"BeltBagSlot({i})"; val3 = ResolveIcon(val2); RewireClick(ui, val2, i); } val2.SetActive(true); if ((Object)(object)val3 != (Object)null) { ((Behaviour)val3).enabled = false; } array[i] = val2; array2[i] = val3; } for (int j = num; j < num2; j++) { if ((Object)(object)inventorySlots[j] != (Object)null) { inventorySlots[j].SetActive(false); } } ui.inventorySlots = array; ui.inventorySlotIcons = array2; LayoutSlots(array); } private static void CaptureMetrics(GameObject[] slots) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_013c: 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_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: 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_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) if (_captured) { return; } RectTransform component = slots[0].GetComponent(); Rect rect = component.rect; _cellSize = ((Rect)(ref rect)).size; float y = component.anchoredPosition.y; int num = 0; float num2 = float.MaxValue; float num3 = float.MinValue; float num4 = float.MaxValue; float num5 = float.MinValue; RectTransform val = null; RectTransform val2 = null; for (int i = 0; i < slots.Length; i++) { RectTransform component2 = slots[i].GetComponent(); Vector2 anchoredPosition = component2.anchoredPosition; if (Mathf.Abs(anchoredPosition.y - y) < 1f) { num++; if ((Object)(object)val == (Object)null && anchoredPosition.x > component.anchoredPosition.x + 1f) { val = component2; } } else if ((Object)(object)val2 == (Object)null) { val2 = component2; } num2 = Mathf.Min(num2, anchoredPosition.x); num3 = Mathf.Max(num3, anchoredPosition.x); num4 = Mathf.Min(num4, anchoredPosition.y); num5 = Mathf.Max(num5, anchoredPosition.y); } _xStep = (((Object)(object)val != (Object)null) ? Mathf.Abs(val.anchoredPosition.x - component.anchoredPosition.x) : Mathf.Max(1f, _cellSize.x * 1.15f)); _yStep = (((Object)(object)val2 != (Object)null) ? Mathf.Abs(val2.anchoredPosition.y - y) : Mathf.Max(1f, _cellSize.y * 1.15f)); _center = new Vector2((num2 + num3) * 0.5f, (num4 + num5) * 0.5f); _captured = true; } private static void LayoutSlots(GameObject[] slots) { //IL_00b0: 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) if (!_captured) { return; } int num = slots.Length; int num2 = Mathf.Max(1, PluginConfig.SlotsPerRow.Value); float num3 = (float)(Mathf.CeilToInt((float)num / (float)num2) - 1) * _yStep; for (int i = 0; i < num; i++) { int num4 = i / num2; int num5 = i % num2; float num6 = (float)(Mathf.Min(num2, num - num4 * num2) - 1) * _xStep; float num7 = _center.x - num6 * 0.5f + (float)num5 * _xStep; float num8 = _center.y + num3 * 0.5f - (float)num4 * _yStep; RectTransform component = slots[i].GetComponent(); if ((Object)(object)component != (Object)null) { component.anchoredPosition = new Vector2(num7, num8); if (((Vector2)(ref _cellSize)).sqrMagnitude > 0.01f) { component.sizeDelta = _cellSize; } } } } private static void DisableLayoutGroups(Transform container) { LayoutGroup[] components = ((Component)container).GetComponents(); for (int i = 0; i < components.Length; i++) { ((Behaviour)components[i]).enabled = false; } ContentSizeFitter[] components2 = ((Component)container).GetComponents(); for (int i = 0; i < components2.Length; i++) { ((Behaviour)components2[i]).enabled = false; } } private static Image ResolveIcon(GameObject slotClone) { if (string.IsNullOrEmpty(_iconPath)) { return slotClone.GetComponent(); } Transform val = slotClone.transform.Find(_iconPath); if (!((Object)(object)val != (Object)null)) { return slotClone.GetComponentInChildren(true); } return ((Component)val).GetComponent(); } private static void RewireClick(BeltBagInventoryUI ui, GameObject slot, int index) { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Expected O, but got Unknown Button componentInChildren = slot.GetComponentInChildren