using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using CommonAPI;
using CommonAPI.Systems;
using DysonSphereMods.Shared;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("Valoneu")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyCopyright("Copyright © 2026")]
[assembly: AssemblyDescription("Multiplies the maximum stack size of all items and buildings.")]
[assembly: AssemblyFileVersion("1.1.0.0")]
[assembly: AssemblyInformationalVersion("1.1.0+31b1750490d034965cde15adfc56e59a7ba9b23f")]
[assembly: AssemblyProduct("DysonSphereMods")]
[assembly: AssemblyTitle("StacksizeMultiplier")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.1.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace DysonSphereMods.Shared
{
public static class Log
{
private static ManualLogSource _logger;
public static void Init(ManualLogSource logger)
{
_logger = logger;
}
public static void Debug(object data)
{
ManualLogSource logger = _logger;
if (logger != null)
{
logger.LogDebug(data);
}
}
public static void Info(object data)
{
ManualLogSource logger = _logger;
if (logger != null)
{
logger.LogInfo(data);
}
}
public static void Warning(object data)
{
ManualLogSource logger = _logger;
if (logger != null)
{
logger.LogWarning(data);
}
}
public static void Error(object data)
{
ManualLogSource logger = _logger;
if (logger != null)
{
logger.LogError(data);
}
}
public static void Fatal(object data)
{
ManualLogSource logger = _logger;
if (logger != null)
{
logger.LogFatal(data);
}
}
public static void Message(object data)
{
ManualLogSource logger = _logger;
if (logger != null)
{
logger.LogMessage(data);
}
}
public static void LogOnce(string msg, ref bool flag, params object[] args)
{
if (flag)
{
return;
}
flag = true;
try
{
string[] array = ((args == null) ? Array.Empty<string>() : args.Select((object arg) => (arg != null) ? ((!(arg is int) && !(arg is string) && !arg.GetType().IsPrimitive) ? JsonUtility.ToJson(arg) : arg.ToString()) : "null").ToArray());
object[] args2 = array;
Info(string.Format(msg, args2));
}
catch (Exception arg2)
{
Warning($"LogOnce failed to format message: {msg}. Exception: {arg2}");
}
}
}
public static class MultiplierService
{
private static readonly Dictionary<string, float> _multipliers = new Dictionary<string, float>();
private static bool _isDirty;
public static event Action OnMultipliersChanged;
public static void SetMultiplier(string key, float value)
{
if (!_multipliers.TryGetValue(key, out var value2) || Math.Abs(value2 - value) > 0.0001f)
{
_multipliers[key] = value;
_isDirty = true;
}
}
public static float GetMultiplier(string key, float defaultValue = 1f)
{
if (!_multipliers.TryGetValue(key, out var value))
{
return defaultValue;
}
return value;
}
public static void CommitChanges()
{
if (_isDirty)
{
_isDirty = false;
MultiplierService.OnMultipliersChanged?.Invoke();
}
}
}
public static class TickManager
{
private static long _lastSlowTick = -1L;
private static long _lastLazyTick = -1L;
private static bool _patched = false;
public static event Action OnSlowTick;
public static event Action OnLazyTick;
public static void Patch(Harmony harmony)
{
if (!_patched)
{
_patched = true;
harmony.PatchAll(typeof(TickManager));
}
}
[HarmonyPatch(typeof(GameMain), "Begin")]
[HarmonyPostfix]
public static void Init()
{
_lastSlowTick = -1L;
_lastLazyTick = -1L;
}
[HarmonyPatch(typeof(GameLogic), "LogicFrame")]
[HarmonyPostfix]
public static void GameTick()
{
long gameTick = GameMain.gameTick;
if (gameTick / 60 > _lastSlowTick)
{
_lastSlowTick = gameTick / 60;
TickManager.OnSlowTick?.Invoke();
}
if (gameTick / 600 > _lastLazyTick)
{
_lastLazyTick = gameTick / 600;
TickManager.OnLazyTick?.Invoke();
}
}
}
public abstract class WindowBase
{
public Rect WindowRect;
protected Vector2 ScrollPos;
private bool _isResizing;
private Rect _resizeRect = new Rect(0f, 0f, 15f, 15f);
public Vector2 MinSize = new Vector2(300f, 200f);
public int WindowId { get; protected set; }
public string Title { get; set; }
public bool IsVisible { get; set; }
protected WindowBase(int windowId, string title, Rect defaultRect)
{
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: 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_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
WindowId = windowId;
Title = title;
WindowRect = defaultRect;
}
public virtual void OnGUI()
{
//IL_001d: 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_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Expected O, but got Unknown
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
if (IsVisible)
{
GUI.backgroundColor = new Color(0.08f, 0.12f, 0.22f, 0.95f);
WindowRect = GUILayout.Window(WindowId, WindowRect, new WindowFunction(DrawWindowInternal), Title, Array.Empty<GUILayoutOption>());
GUI.backgroundColor = Color.white;
((Rect)(ref WindowRect)).x = Mathf.Clamp(((Rect)(ref WindowRect)).x, 0f - ((Rect)(ref WindowRect)).width + 50f, (float)(Screen.width - 50));
((Rect)(ref WindowRect)).y = Mathf.Clamp(((Rect)(ref WindowRect)).y, -20f, (float)(Screen.height - 50));
}
}
private void DrawWindowInternal(int id)
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_0086: Unknown result type (might be due to invalid IL or missing references)
//IL_009a: Unknown result type (might be due to invalid IL or missing references)
//IL_009f: Unknown result type (might be due to invalid IL or missing references)
//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
//IL_00af: Unknown result type (might be due to invalid IL or missing references)
//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
//IL_00d8: Expected O, but got Unknown
//IL_00dd: Expected O, but got Unknown
//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
//IL_0115: Unknown result type (might be due to invalid IL or missing references)
//IL_011b: Invalid comparison between Unknown and I4
//IL_00f4: 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_0130: Invalid comparison between Unknown and I4
//IL_01cd: Unknown result type (might be due to invalid IL or missing references)
//IL_014d: Unknown result type (might be due to invalid IL or missing references)
//IL_016a: Unknown result type (might be due to invalid IL or missing references)
DrawWindowHeader();
ScrollPos = GUILayout.BeginScrollView(ScrollPos, Array.Empty<GUILayoutOption>());
DrawWindowContent();
GUILayout.EndScrollView();
DrawWindowFooter();
((Rect)(ref _resizeRect)).x = ((Rect)(ref WindowRect)).width - 20f;
((Rect)(ref _resizeRect)).y = ((Rect)(ref WindowRect)).height - 20f;
((Rect)(ref _resizeRect)).width = 20f;
((Rect)(ref _resizeRect)).height = 20f;
GUI.Label(_resizeRect, "↘", new GUIStyle(GUI.skin.label)
{
alignment = (TextAnchor)4,
fontSize = 20,
normal = new GUIStyleState
{
textColor = new Color(0.6f, 0.6f, 0.6f, 0.8f)
}
});
Event current = Event.current;
bool flag = false;
if ((int)current.type == 0 && ((Rect)(ref _resizeRect)).Contains(current.mousePosition))
{
_isResizing = true;
flag = true;
current.Use();
}
else if ((int)current.type == 1)
{
_isResizing = false;
}
else if ((int)current.type == 3 && _isResizing)
{
ref Rect windowRect = ref WindowRect;
((Rect)(ref windowRect)).width = ((Rect)(ref windowRect)).width + current.delta.x;
ref Rect windowRect2 = ref WindowRect;
((Rect)(ref windowRect2)).height = ((Rect)(ref windowRect2)).height + current.delta.y;
((Rect)(ref WindowRect)).width = Mathf.Max(MinSize.x, ((Rect)(ref WindowRect)).width);
((Rect)(ref WindowRect)).height = Mathf.Max(MinSize.y, ((Rect)(ref WindowRect)).height);
current.Use();
}
if ((int)current.type == 0 && !flag)
{
GUIUtility.keyboardControl = 0;
}
GUI.DragWindow();
}
protected virtual void DrawWindowHeader()
{
}
protected abstract void DrawWindowContent();
protected virtual void DrawWindowFooter()
{
}
public virtual void Toggle()
{
IsVisible = !IsVisible;
}
}
}
namespace StacksizeMultiplier
{
[BepInPlugin("com.Valoneu.StacksizeMultiplier", "StacksizeMultiplier", "1.1.0")]
[BepInProcess("DSPGAME.exe")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[CommonAPISubmoduleDependency(new string[] { "ProtoRegistry", "CustomKeyBindSystem" })]
public class StacksizeMultiplierPlugin : BaseUnityPlugin
{
public const string MOD_GUID = "com.Valoneu.StacksizeMultiplier";
public const string MOD_NAME = "StacksizeMultiplier";
public const string MOD_VERSION = "1.1.0";
public static ConfigEntry<float> GlobalItemMultiplier;
public static ConfigEntry<float> GlobalBuildingMultiplier;
public static ConfigEntry<float> GlobalUsefulMultiplier;
public static ConfigEntry<string> ItemOverridesRaw;
public static ConfigEntry<float> WindowX;
public static ConfigEntry<float> WindowY;
public static ConfigEntry<float> WindowW;
public static ConfigEntry<float> WindowH;
private StacksizeMultiplierWindow _window;
private static Dictionary<int, int> _originalStackSizes = new Dictionary<int, int>();
private static Dictionary<int, float> _itemOverrides = new Dictionary<int, float>();
private bool _lastKeyState;
private void Awake()
{
//IL_013c: Unknown result type (might be due to invalid IL or missing references)
//IL_0183: Unknown result type (might be due to invalid IL or missing references)
GlobalItemMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("Internal", "GlobalItemMultiplier", 1f, "Global multiplier for non-building items.");
GlobalBuildingMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("Internal", "GlobalBuildingMultiplier", 1f, "Global multiplier for buildings/facilities.");
GlobalUsefulMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("Internal", "GlobalUsefulMultiplier", 1f, "Global multiplier for drones and vessels.");
ItemOverridesRaw = ((BaseUnityPlugin)this).Config.Bind<string>("Internal", "ItemOverrides", "", "Stored per-item overrides (ID:Value,ID:Value)");
WindowX = ((BaseUnityPlugin)this).Config.Bind<float>("UI", "WindowX", 100f, "Window X position.");
WindowY = ((BaseUnityPlugin)this).Config.Bind<float>("UI", "WindowY", 100f, "Window Y position.");
WindowW = ((BaseUnityPlugin)this).Config.Bind<float>("UI", "WindowW", 450f, "Window width.");
WindowH = ((BaseUnityPlugin)this).Config.Bind<float>("UI", "WindowH", 600f, "Window height.");
LoadOverrides();
RegisterKeyBinds();
Log.Init(((BaseUnityPlugin)this).Logger);
new Harmony("com.Valoneu.StacksizeMultiplier").PatchAll(typeof(StacksizeMultiplierPlugin));
_window = new StacksizeMultiplierWindow(9933, "Stacksize Multiplier", new Rect(WindowX.Value, WindowY.Value, WindowW.Value, WindowH.Value), ApplyMultiplier, SaveOverrides, _originalStackSizes, _itemOverrides, IsUsefulItem);
Log.Info("StacksizeMultiplier v1.1.0 loaded!");
}
private void RegisterKeyBinds()
{
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
if (!CustomKeyBindSystem.HasKeyBind("ToggleStacksizeUI"))
{
BuiltinKey val = default(BuiltinKey);
val.id = 1230;
val.key = new CombineKey(258, (byte)2, (ECombineKeyAction)0, false);
val.conflictGroup = 0;
val.name = "ToggleStacksizeUI";
val.canOverride = true;
CustomKeyBindSystem.RegisterKeyBind<PressKeyBind>(val);
}
ProtoRegistry.RegisterString("ToggleStacksizeUI", "Toggle Stacksize Multiplier UI");
}
private void LoadOverrides()
{
_itemOverrides.Clear();
string value = ItemOverridesRaw.Value;
if (string.IsNullOrEmpty(value))
{
return;
}
string[] array = value.Split(new char[1] { ',' }, StringSplitOptions.RemoveEmptyEntries);
for (int i = 0; i < array.Length; i++)
{
string[] array2 = array[i].Split(':');
if (array2.Length == 2 && int.TryParse(array2[0], out var result) && float.TryParse(array2[1], out var result2))
{
_itemOverrides[result] = result2;
}
}
}
public static void SaveOverrides()
{
string value = string.Join(",", _itemOverrides.Select((KeyValuePair<int, float> kvp) => $"{kvp.Key}:{kvp.Value:F1}"));
ItemOverridesRaw.Value = value;
if (GlobalItemMultiplier != null && ((ConfigEntryBase)GlobalItemMultiplier).ConfigFile != null)
{
((ConfigEntryBase)GlobalItemMultiplier).ConfigFile.Save();
}
}
private void Update()
{
bool keyValue = CustomKeyBindSystem.GetKeyBind("ToggleStacksizeUI").keyValue;
if (keyValue && !_lastKeyState)
{
Log.Info("ToggleStacksizeUI keybind pressed!");
_window.Toggle();
}
_lastKeyState = keyValue;
}
[HarmonyPostfix]
[HarmonyPatch(typeof(VFPreload), "InvokeOnLoadWorkEnded")]
public static void VFPreload_InvokeOnLoadWorkEnded_Postfix()
{
ApplyMultiplier();
}
public static void ApplyMultiplier()
{
if ((Object)(object)LDB.items == (Object)null)
{
return;
}
ItemProto[] dataArray;
if (_originalStackSizes.Count == 0)
{
dataArray = ((ProtoSet<ItemProto>)(object)LDB.items).dataArray;
foreach (ItemProto val in dataArray)
{
if (val != null)
{
_originalStackSizes[((Proto)val).ID] = val.StackSize;
}
}
Log.Info($"Captured {_originalStackSizes.Count} original stack sizes.");
}
float value = GlobalItemMultiplier.Value;
float value2 = GlobalBuildingMultiplier.Value;
float value3 = GlobalUsefulMultiplier.Value;
int num = 0;
dataArray = ((ProtoSet<ItemProto>)(object)LDB.items).dataArray;
foreach (ItemProto val2 in dataArray)
{
if (val2 != null && _originalStackSizes.TryGetValue(((Proto)val2).ID, out var value4))
{
float num2 = ((!IsUsefulItem(val2)) ? (val2.CanBuild ? value2 : value) : value3);
float value5;
float num3 = (_itemOverrides.TryGetValue(((Proto)val2).ID, out value5) ? value5 : num2);
int num4 = Mathf.RoundToInt((float)value4 * num3);
if (num4 < 1)
{
num4 = 1;
}
if (num4 > 1000000)
{
num4 = 1000000;
}
if (val2.StackSize != num4)
{
val2.StackSize = num4;
num++;
}
if (StorageComponent.itemStackCount != null && ((Proto)val2).ID < StorageComponent.itemStackCount.Length)
{
StorageComponent.itemStackCount[((Proto)val2).ID] = num4;
}
}
}
Log.Info($"Applied multiplier to {num} items.");
if (GameMain.mainPlayer != null && GameMain.mainPlayer.package != null)
{
StorageComponent package = GameMain.mainPlayer.package;
for (int j = 0; j < package.size; j++)
{
int itemId = package.grids[j].itemId;
if (itemId > 0)
{
ItemProto val3 = ((ProtoSet<ItemProto>)(object)LDB.items).Select(itemId);
if (val3 != null)
{
package.grids[j].stackSize = val3.StackSize;
}
}
}
package.NotifyStorageChange();
}
if ((Object)(object)UIRoot.instance != (Object)null && (Object)(object)UIRoot.instance.uiGame != (Object)null && (Object)(object)UIRoot.instance.uiGame.inventoryWindow != (Object)null && ((ManualBehaviour)UIRoot.instance.uiGame.inventoryWindow).active)
{
((ManualBehaviour)UIRoot.instance.uiGame.inventoryWindow)._OnUpdate();
}
}
public static bool IsUsefulItem(ItemProto item)
{
if (((Proto)item).ID == 5001 || ((Proto)item).ID == 5002)
{
return true;
}
if (((Proto)item).ID >= 5101 && ((Proto)item).ID <= 5111)
{
return true;
}
return false;
}
private void OnGUI()
{
_window.OnGUI();
}
}
public class StacksizeMultiplierWindow : WindowBase
{
private string _searchText = "";
private string _lastSearch;
private List<ItemProto> _displayItems = new List<ItemProto>();
private int _displayColumns = 1;
private float _lastWidth;
private readonly Action _applyMultiplier;
private readonly Action _saveOverrides;
private readonly Dictionary<int, int> _originalStackSizes;
private readonly Dictionary<int, float> _itemOverrides;
private readonly Func<ItemProto, bool> _isUsefulItem;
public StacksizeMultiplierWindow(int windowId, string title, Rect defaultRect, Action applyMultiplier, Action saveOverrides, Dictionary<int, int> originalStackSizes, Dictionary<int, float> itemOverrides, Func<ItemProto, bool> isUsefulItem)
: base(windowId, title, defaultRect)
{
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
_applyMultiplier = applyMultiplier;
_saveOverrides = saveOverrides;
_originalStackSizes = originalStackSizes;
_itemOverrides = itemOverrides;
_isUsefulItem = isUsefulItem;
}
protected override void DrawWindowContent()
{
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Invalid comparison between Unknown and I4
//IL_0156: Unknown result type (might be due to invalid IL or missing references)
//IL_015b: Unknown result type (might be due to invalid IL or missing references)
//IL_0163: Expected O, but got Unknown
//IL_0164: 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_0171: Expected O, but got Unknown
//IL_0186: Unknown result type (might be due to invalid IL or missing references)
//IL_01cd: 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_05bc: Unknown result type (might be due to invalid IL or missing references)
//IL_070e: Unknown result type (might be due to invalid IL or missing references)
//IL_076c: Unknown result type (might be due to invalid IL or missing references)
float num = 280f;
if ((int)Event.current.type == 8 && (_lastSearch != _searchText || Mathf.Abs(_lastWidth - ((Rect)(ref WindowRect)).width) > 5f || _displayItems.Count == 0))
{
_lastSearch = _searchText;
_lastWidth = ((Rect)(ref WindowRect)).width;
if ((Object)(object)LDB.items != (Object)null && ((ProtoSet<ItemProto>)(object)LDB.items).dataArray != null)
{
List<ItemProto> list = ((ProtoSet<ItemProto>)(object)LDB.items).dataArray.Where((ItemProto i) => i != null && ((Proto)i).ID > 0).ToList();
string searchLower = _searchText?.ToLower() ?? "";
if (!string.IsNullOrEmpty(searchLower))
{
_displayItems = list.Where((ItemProto i) => ((Proto)i).name.ToLower().Contains(searchLower)).ToList();
}
else
{
_displayItems = list;
}
}
_displayColumns = Mathf.Max(1, Mathf.FloorToInt((((Rect)(ref WindowRect)).width - 40f) / num));
}
GUIStyle val = new GUIStyle(GUI.skin.label)
{
richText = true
};
GUIStyle val2 = new GUIStyle(val)
{
fontStyle = (FontStyle)1
};
val2.normal.textColor = new Color(0.4f, 0.7f, 1f);
GUILayout.BeginVertical(Array.Empty<GUILayoutOption>());
GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
GUILayout.Label("GLOBAL SETTINGS", val2, Array.Empty<GUILayoutOption>());
GUILayout.FlexibleSpace();
GUI.backgroundColor = new Color(0.2f, 0.8f, 0.2f, 0.8f);
if (GUILayout.Button("REFRESH ALL STACKS", (GUILayoutOption[])(object)new GUILayoutOption[2]
{
GUILayout.Width(150f),
GUILayout.Height(22f)
}))
{
_applyMultiplier?.Invoke();
}
GUI.backgroundColor = Color.white;
GUILayout.EndHorizontal();
GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
GUILayout.Label($"Items Multiplier: {StacksizeMultiplierPlugin.GlobalItemMultiplier.Value:F1}x", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(160f) });
float num2 = GUILayout.HorizontalSlider(StacksizeMultiplierPlugin.GlobalItemMultiplier.Value, 1f, 10f, Array.Empty<GUILayoutOption>());
if (Mathf.Abs(num2 - StacksizeMultiplierPlugin.GlobalItemMultiplier.Value) > 0.01f)
{
StacksizeMultiplierPlugin.GlobalItemMultiplier.Value = Mathf.Round(num2 * 2f) / 2f;
_applyMultiplier?.Invoke();
((ConfigEntryBase)StacksizeMultiplierPlugin.GlobalItemMultiplier).ConfigFile.Save();
}
GUILayout.EndHorizontal();
GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
GUILayout.Label($"Buildings Multiplier: {StacksizeMultiplierPlugin.GlobalBuildingMultiplier.Value:F1}x", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(160f) });
float num3 = GUILayout.HorizontalSlider(StacksizeMultiplierPlugin.GlobalBuildingMultiplier.Value, 1f, 10f, Array.Empty<GUILayoutOption>());
if (Mathf.Abs(num3 - StacksizeMultiplierPlugin.GlobalBuildingMultiplier.Value) > 0.01f)
{
StacksizeMultiplierPlugin.GlobalBuildingMultiplier.Value = Mathf.Round(num3 * 2f) / 2f;
_applyMultiplier?.Invoke();
((ConfigEntryBase)StacksizeMultiplierPlugin.GlobalBuildingMultiplier).ConfigFile.Save();
}
GUILayout.EndHorizontal();
GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
GUILayout.Label($"Useful Items Multiplier: {StacksizeMultiplierPlugin.GlobalUsefulMultiplier.Value:F1}x", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(160f) });
float num4 = GUILayout.HorizontalSlider(StacksizeMultiplierPlugin.GlobalUsefulMultiplier.Value, 1f, 10f, Array.Empty<GUILayoutOption>());
if (Mathf.Abs(num4 - StacksizeMultiplierPlugin.GlobalUsefulMultiplier.Value) > 0.01f)
{
StacksizeMultiplierPlugin.GlobalUsefulMultiplier.Value = Mathf.Round(num4 * 2f) / 2f;
_applyMultiplier?.Invoke();
((ConfigEntryBase)StacksizeMultiplierPlugin.GlobalUsefulMultiplier).ConfigFile.Save();
}
GUILayout.EndHorizontal();
GUILayout.Space(10f);
GUILayout.Label("INDIVIDUAL OVERRIDES", val2, Array.Empty<GUILayoutOption>());
GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
GUILayout.Label("Search:", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(50f) });
_searchText = GUILayout.TextField(_searchText, Array.Empty<GUILayoutOption>());
if (GUILayout.Button("Clear", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(50f) }))
{
_searchText = "";
}
GUILayout.EndHorizontal();
GUILayout.Space(5f);
for (int j = 0; j < _displayItems.Count; j += _displayColumns)
{
GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
for (int k = 0; j + k < _displayItems.Count && k < _displayColumns; k++)
{
ItemProto val3 = _displayItems[j + k];
if (!_originalStackSizes.TryGetValue(((Proto)val3).ID, out var value))
{
continue;
}
float value2;
bool flag = _itemOverrides.TryGetValue(((Proto)val3).ID, out value2);
bool flag2 = _isUsefulItem(val3);
float num5 = (flag2 ? StacksizeMultiplierPlugin.GlobalUsefulMultiplier.Value : (val3.CanBuild ? StacksizeMultiplierPlugin.GlobalBuildingMultiplier.Value : StacksizeMultiplierPlugin.GlobalItemMultiplier.Value));
float num6 = (flag ? value2 : num5);
GUILayout.BeginHorizontal(GUI.skin.box, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(num) });
Sprite iconSprite = val3.iconSprite;
if ((Object)(object)((iconSprite != null) ? iconSprite.texture : null) != (Object)null)
{
GUI.DrawTexture(GUILayoutUtility.GetRect(32f, 32f), (Texture)(object)val3.iconSprite.texture);
}
GUILayout.BeginVertical(Array.Empty<GUILayoutOption>());
string text = (flag2 ? "<color=#ffff00>[U]</color>" : (val3.CanBuild ? "<color=#00ffaa>[B]</color>" : "<color=#aaaaaa>[I]</color>"));
GUILayout.Label("<b>" + ((Proto)val3).name + "</b> " + text, val, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MaxWidth(num - 60f) });
GUILayout.Label($"<color=#aaaaaa>{value} -> </color><color=#66b2ff><b>{val3.StackSize}</b></color>", val, Array.Empty<GUILayoutOption>());
GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
float num7 = Mathf.Round(GUILayout.HorizontalSlider(num6, 1f, 10f, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(100f) }) * 2f) / 2f;
if (Mathf.Abs(num7 - num6) > 0.01f)
{
_itemOverrides[((Proto)val3).ID] = num7;
_applyMultiplier?.Invoke();
_saveOverrides?.Invoke();
}
GUILayout.Label($"{num6:F1}x", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(40f) });
if (flag)
{
GUI.backgroundColor = Color.red;
if (GUILayout.Button("X", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(25f) }))
{
_itemOverrides.Remove(((Proto)val3).ID);
_applyMultiplier?.Invoke();
_saveOverrides?.Invoke();
}
GUI.backgroundColor = Color.white;
}
GUILayout.EndHorizontal();
GUILayout.EndVertical();
GUILayout.EndHorizontal();
}
GUILayout.EndHorizontal();
}
GUILayout.EndVertical();
}
protected override void DrawWindowFooter()
{
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
GUILayout.Space(5f);
GUI.backgroundColor = new Color(0.8f, 0.4f, 0.1f, 0.8f);
if (GUILayout.Button("CLOSE", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) }))
{
base.IsVisible = false;
}
GUI.backgroundColor = Color.white;
}
public override void OnGUI()
{
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Invalid comparison between Unknown and I4
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Invalid comparison between Unknown and I4
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
if (base.IsVisible && (!((Object)(object)Camera.current != (Object)null) || (int)Camera.current.cameraType == 1) && !GameMain.isPaused && (int)UIGame.viewMode != 6)
{
GUI.backgroundColor = new Color(0.12f, 0.15f, 0.2f, 0.95f);
base.OnGUI();
if (Mathf.Abs(((Rect)(ref WindowRect)).x - StacksizeMultiplierPlugin.WindowX.Value) > 0.1f || Mathf.Abs(((Rect)(ref WindowRect)).y - StacksizeMultiplierPlugin.WindowY.Value) > 0.1f)
{
StacksizeMultiplierPlugin.WindowX.Value = ((Rect)(ref WindowRect)).x;
StacksizeMultiplierPlugin.WindowY.Value = ((Rect)(ref WindowRect)).y;
StacksizeMultiplierPlugin.WindowW.Value = ((Rect)(ref WindowRect)).width;
StacksizeMultiplierPlugin.WindowH.Value = ((Rect)(ref WindowRect)).height;
((ConfigEntryBase)StacksizeMultiplierPlugin.WindowX).ConfigFile.Save();
}
}
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "com.Valoneu.StacksizeMultiplier";
public const string PLUGIN_NAME = "StacksizeMultiplier";
public const string PLUGIN_VERSION = "1.1.0";
}
}