using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
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: AssemblyTitle("ClassLibrary1")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ClassLibrary1")]
[assembly: AssemblyCopyright("Copyright © 2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("EAE73955-E546-4F6C-ABE4-8F7782AEF8C7")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.1", FrameworkDisplayName = "")]
[assembly: AssemblyVersion("1.0.0.0")]
[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;
}
}
}
[BepInPlugin("com.h3nw.infinitepopper", "Infinite Party Popper", "1.0.0")]
public class InfinitePopperPlugin : BaseUnityPlugin
{
private static ManualLogSource Log;
private readonly Harmony harmony = new Harmony("com.h3nw.infinitepopper");
public static ConfigEntry<bool> ModEnabled { get; private set; }
private void Awake()
{
Log = ((BaseUnityPlugin)this).Logger;
ModEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Enabled", true, "Enable infinite party popper uses.");
harmony.PatchAll();
((BaseUnityPlugin)this).Logger.LogInfo((object)"Infinite Party Popper loaded!");
}
}
[HarmonyPatch(typeof(PartyPopper), "Update")]
public class PartyPopperPatch
{
private static void Postfix(PartyPopper __instance, ref bool ___wasUsedOnConfig, ref bool ___wasConfig)
{
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006e: Expected O, but got Unknown
//IL_0075: Unknown result type (might be due to invalid IL or missing references)
//IL_007b: Expected O, but got Unknown
if (!InfinitePopperPlugin.ModEnabled.Value)
{
return;
}
FieldInfo fieldInfo = AccessTools.Field(typeof(PartyPopper), "usedEntry");
FieldInfo fieldInfo2 = AccessTools.Field(typeof(PartyPopper), "stashAbleEntry");
if (fieldInfo == null || fieldInfo2 == null)
{
return;
}
OnOffEntry val = (OnOffEntry)fieldInfo.GetValue(__instance);
StashAbleEntry val2 = (StashAbleEntry)fieldInfo2.GetValue(__instance);
if (val != null && val2 != null && (val.on & ___wasUsedOnConfig))
{
val.on = false;
((ItemDataEntry)val).SetDirty();
val2.isStashAble = true;
((ItemDataEntry)val2).SetDirty();
___wasUsedOnConfig = false;
object? obj = AccessTools.Field(typeof(PartyPopper), "chargesLeftGO")?.GetValue(__instance);
GameObject val3 = (GameObject)((obj is GameObject) ? obj : null);
if (val3 != null)
{
val3.SetActive(true);
}
}
}
}