using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("ItemStacker")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ItemStacker")]
[assembly: AssemblyCopyright("Copyright © 2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("d84dc32d-5a82-4aca-b99f-fdeea1621e92")]
[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.herrdummkopf.aleandtaletavern.itemstacker", "Item Stacker", "1.0.0")]
public class ItemStacker : BaseUnityPlugin
{
public static ManualLogSource LoggerInstance;
public static int ConfigStackSize;
private void Awake()
{
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Expected O, but got Unknown
LoggerInstance = ((BaseUnityPlugin)this).Logger;
ConfigStackSize = ((BaseUnityPlugin)this).Config.Bind<int>("Allgemein", "MaxStackSize", 99, "Maximale Stapelgröße für alle Items.").Value;
Harmony val = new Harmony("com.herrdummkopf.aleandtaletavern.itemstacker");
val.PatchAll();
((BaseUnityPlugin)this).Logger.LogInfo((object)$"[Item Stacker] Plugin geladen! (MaxStackSize: {ConfigStackSize})");
UpdateAllItemStacks();
}
private void UpdateAllItemStacks()
{
ItemData[] array = Resources.FindObjectsOfTypeAll<ItemData>();
int num = 0;
ItemData[] array2 = array;
foreach (ItemData val in array2)
{
try
{
val.maxStack = (ushort)ConfigStackSize;
num++;
}
catch (Exception ex)
{
LoggerInstance.LogWarning((object)("Fehler beim Anpassen eines Items: " + ex.Message));
}
}
LoggerInstance.LogInfo((object)$"[Item Stacker] {num} Items aktualisiert auf MaxStackSize = {ConfigStackSize}");
}
}