using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
using UnityEngine;
using UnityEngine.SceneManagement;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("MoreStackSize")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("MoreStackSize")]
[assembly: AssemblyCopyright("Copyright © 2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("f4f28294-fe1f-48e0-b0d7-e91146fd8e08")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
[BepInPlugin("com.lan.junkstacksize", "同种类垃圾堆叠 --Stackable your sametype junk", "1.1.0")]
public class CustomFishStack : BaseUnityPlugin
{
[HarmonyPatch]
public static class ItemCrate_EnableDummyItems_Patch_Compatible
{
[HarmonyPrefix]
[HarmonyPatch(typeof(ItemCrate), "EnableDummyItems")]
public static void Prefix(ItemCrate __instance, ref int amount)
{
if (!((Object)(object)__instance.dummyItems == (Object)null))
{
int num = Mathf.Min(amount, __instance.dummyItems.childCount);
amount = num;
}
}
}
private ConfigEntry<int> JunkStackSize;
private readonly Harmony harmony = new Harmony("com.lan.junkstacksize");
private void Awake()
{
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Expected O, but got Unknown
ConfigDescription val = new ConfigDescription("同种类垃圾堆叠数量 --SameType Junk Stack Limit", (AcceptableValueBase)null, Array.Empty<object>());
JunkStackSize = ((BaseUnityPlugin)this).Config.Bind<int>("基本设置", "同类型垃圾堆叠数量 --SameType Junk Stack Limit", 10, val);
harmony.PatchAll(typeof(ItemCrate_EnableDummyItems_Patch_Compatible));
Debug.LogWarning((object)("设置同种类垃圾堆叠数量为 --Set SameType Junk Stack Limit to" + JunkStackSize.Value));
Debug.LogWarning((object)("垃圾堆叠1.1.0加载成功 --作者:她说缝上都不给我" + JunkStackSize.Value));
SceneManager.sceneLoaded += OnSceneLoaded;
}
private void OnSceneLoaded(Scene scene, LoadSceneMode mode)
{
List<ItemSO> list = Resources.FindObjectsOfTypeAll<ItemSO>().ToList();
if (list == null || list.Count == 0)
{
return;
}
for (int i = 0; i < list.Count; i++)
{
if (list[i].itemName.Equals("junk"))
{
list[i].stackSize = JunkStackSize.Value;
}
}
}
}