using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyCompany("huoyan1231")]
[assembly: AssemblyTrademark("huoyan1231")]
[assembly: AssemblyFileVersion("1.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[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 UnlimitedPouch
{
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "com.huoyan1231.unlimitedpouch";
public const string PLUGIN_NAME = "UnlimitedPouch";
public const string PLUGIN_VERSION = "1.0.0";
}
[BepInPlugin("com.huoyan1231.unlimitedpouch", "UnlimitedPouch", "1.0.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class Plugin : BaseUnityPlugin
{
public static ManualLogSource Log;
private void Awake()
{
Log = ((BaseUnityPlugin)this).Logger;
Log.LogInfo((object)"[UnlimitedPouch] Loading v1.0.0...");
DisableLeaderboard();
ApplyHarmonyPatches();
Log.LogInfo((object)"[UnlimitedPouch] Loaded successfully!");
}
private void DisableLeaderboard()
{
Type type = AccessTools.TypeByName("WK_huoyan1231COMLib.LeaderboardManager");
if (type == null)
{
Log.LogWarning((object)"WK_huoyan1231COMLib not found, leaderboard will remain enabled.");
return;
}
MethodInfo methodInfo = AccessTools.Method(type, "DisableForThisRun", new Type[1] { typeof(string) }, (Type[])null);
if (methodInfo == null)
{
Log.LogWarning((object)"DisableForThisRun method not found.");
return;
}
methodInfo.Invoke(null, new object[1] { "com.huoyan1231.unlimitedpouch" });
Log.LogInfo((object)"Leaderboard uploads disabled for this session.");
}
private void ApplyHarmonyPatches()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Expected O, but got Unknown
Harmony val = new Harmony("com.huoyan1231.unlimitedpouch");
val.PatchAll();
Log.LogInfo((object)"Harmony patches applied.");
}
}
[HarmonyPatch(typeof(Inventory), "Initialize")]
public class InventoryInitializePatch
{
private static void Postfix(Inventory __instance)
{
UnlimitedPouchHelper.SetUnlimitedCapacity(__instance);
Plugin.Log.LogInfo((object)"Inventory initialized with unlimited capacity.");
}
}
[HarmonyPatch(typeof(Inventory), "CreatePouches")]
public class CreatePouchesPatch
{
private static void Postfix(Inventory __instance)
{
UnlimitedPouchHelper.SetUnlimitedCapacity(__instance);
Plugin.Log.LogInfo((object)"Pouches created with unlimited capacity.");
}
}
[HarmonyPatch(typeof(Pouch), "CanAddItemToPouch")]
public class CanAddItemToPouchPatch
{
}
public static class UnlimitedPouchHelper
{
public static void SetUnlimitedCapacity(Inventory inventory)
{
if ((Object)(object)inventory == (Object)null)
{
return;
}
FieldInfo fieldInfo = AccessTools.Field(typeof(Inventory), "pouchMaxCapacity");
if (fieldInfo != null)
{
fieldInfo.SetValue(inventory, 100);
Plugin.Log.LogInfo((object)"Set pouchMaxCapacity to 100");
}
FieldInfo fieldInfo2 = AccessTools.Field(typeof(Inventory), "pouches");
if (!(fieldInfo2 != null) || !(fieldInfo2.GetValue(inventory) is List<Pouch> list))
{
return;
}
foreach (Pouch item in list)
{
if (item != null)
{
item.maxCapacity = 100;
FieldInfo fieldInfo3 = AccessTools.Field(typeof(Pouch), "maxLargeCapacity");
if (fieldInfo3 != null)
{
fieldInfo3.SetValue(item, 100);
}
}
}
Plugin.Log.LogInfo((object)$"Set {list.Count} pouches to large capacity (100)");
}
}
}