Decompiled source of NoSpoil v1.0.0

NoSpoil.dll

Decompiled a week ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using HarmonyLib;
using Microsoft.CodeAnalysis;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("NoSpoil")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("NoSpoil")]
[assembly: AssemblyTitle("NoSpoil")]
[assembly: AssemblyVersion("1.0.0.0")]
[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 NoSpoil
{
	[BepInPlugin("com.nospoil.outward", "NoSpoil", "1.0.0")]
	public class NoSpoilPlugin : BasePlugin
	{
		public static ManualLogSource PluginLog;

		public override void Load()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Expected O, but got Unknown
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Expected O, but got Unknown
			PluginLog = ((BasePlugin)this).Log;
			Harmony val = new Harmony("com.nospoil.outward");
			try
			{
				MethodInfo methodInfo = AccessTools.Method(typeof(Perishable), "Update", (Type[])null, (Type[])null);
				MethodInfo methodInfo2 = AccessTools.Method(typeof(PerishableUpdatePatch), "Prefix", (Type[])null, (Type[])null);
				if (methodInfo != null && methodInfo2 != null)
				{
					val.Patch((MethodBase)methodInfo, new HarmonyMethod(methodInfo2), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
					((BasePlugin)this).Log.LogInfo((object)"NoSpoil: Perishable.Update patched");
				}
				else
				{
					((BasePlugin)this).Log.LogError((object)"NoSpoil: could not find Perishable.Update");
				}
			}
			catch (Exception ex)
			{
				((BasePlugin)this).Log.LogError((object)("NoSpoil patch error: " + ex.Message));
			}
			((BasePlugin)this).Log.LogInfo((object)"NoSpoil loaded");
		}
	}
	public static class PerishableUpdatePatch
	{
		private static bool logged;

		public static bool Prefix()
		{
			if (!logged)
			{
				logged = true;
				NoSpoilPlugin.PluginLog.LogInfo((object)"Perishable.Update blocked");
			}
			return false;
		}
	}
}