Decompiled source of MoreGetCosmeticBox v1.0.0

MoreGetCosmeticBox.dll

Decompiled 2 days ago
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 Photon.Pun;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("MoreGetCosmeticBox")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("MoreGetCosmeticBox")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("00f868ca-2c37-4fcf-948f-4d5922de9bfb")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace MoreGetCosmeticBox;

[BepInPlugin("com.sunwu.more_get_cosmetic_box", "More Get Cosmetic Box", "1.0.0")]
public class MoreGetCosmeticBoxPlugin : BaseUnityPlugin
{
	internal static ManualLogSource Logger;

	private void Awake()
	{
		//IL_0010: Unknown result type (might be due to invalid IL or missing references)
		Logger = ((BaseUnityPlugin)this).Logger;
		new Harmony("com.sunwu.more_get_cosmetic_box").PatchAll();
		Logger.LogInfo((object)"MoreGetCosmeticBox patch applied.");
	}
}
[HarmonyPatch(typeof(CosmeticWorldObject), "ExtractRPC")]
public static class MoreGetCosmeticBox_ExtractRPC_Patch
{
	private static readonly FieldInfo DebugField = AccessTools.Field(typeof(ValuableDirector), "cosmeticWorldObjectDebug");

	private static object savedDebug;

	[HarmonyPrefix]
	private static void Prefix(CosmeticWorldObject __instance)
	{
		if (PhotonNetwork.IsConnected && !PhotonNetwork.IsMasterClient)
		{
			Traverse.Create((object)__instance).Field("inExtraction").SetValue((object)true);
		}
		savedDebug = null;
		ValuableDirector instance = ValuableDirector.instance;
		if (!((Object)(object)instance == (Object)null) && !(DebugField == null))
		{
			savedDebug = DebugField.GetValue(instance);
			DebugField.SetValue(instance, (object)(CosmeticWorldObjectDebug)2);
		}
	}

	[HarmonyFinalizer]
	private static void Finalizer()
	{
		if (savedDebug != null)
		{
			ValuableDirector instance = ValuableDirector.instance;
			if ((Object)(object)instance != (Object)null)
			{
				DebugField.SetValue(instance, savedDebug);
			}
			savedDebug = null;
		}
	}
}
[HarmonyPatch(typeof(ResultScreenUI), "StateCloseDoor")]
public static class MoreGetCosmeticBox_StateCloseDoor_Patch
{
	[HarmonyPrefix]
	private static void Prefix()
	{
		if ((Object)(object)RunManager.instance != (Object)null)
		{
			Traverse.Create((object)RunManager.instance).Field("cosmeticWorldObjectCooldown").SetValue((object)0f);
		}
	}
}