Decompiled source of NoRefundsForPortals v1.0.0

NoRefundsForPortals.dll

Decompiled a day 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 UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("NoRefundsForPortals")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("NoRefundsForPortals")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("ed849cff-f4ca-43e8-9e76-2f35230bd3b0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace NoRefundsForPortals;

[BepInPlugin("dinoturds.noportalrefunds", "No Refunds for Portals", "1.0.0")]
public class NoRefundsForPortals : BaseUnityPlugin
{
	[HarmonyPatch(typeof(Piece), "DropResources")]
	private static class Piece_DropResources_NoPortalRefund
	{
		private static bool Prefix(Piece __instance)
		{
			if ((Object)(object)__instance == (Object)null)
			{
				return true;
			}
			if ((Object)(object)((Component)__instance).GetComponent<TeleportWorld>() != (Object)null)
			{
				ManualLogSource log = Log;
				if (log != null)
				{
					log.LogDebug((object)("Blocking refund (TeleportWorld): " + ((Object)((Component)__instance).gameObject).name));
				}
				return false;
			}
			return true;
		}
	}

	internal static ManualLogSource Log;

	private Harmony _harmony;

	private void Awake()
	{
		//IL_0023: Unknown result type (might be due to invalid IL or missing references)
		//IL_002d: Expected O, but got Unknown
		Log = ((BaseUnityPlugin)this).Logger;
		((BaseUnityPlugin)this).Logger.LogInfo((object)"No Refunds for Portals loaded successfully.");
		_harmony = new Harmony("dinoturds.noportalrefunds");
		_harmony.PatchAll();
	}
}