Decompiled source of NoGreedTrials v1.0.0

plugins/NoInfernalGreed/NoInfernalGreed.dll

Decompiled a day ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using RoR2;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("NoInfernalGreed")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("NoInfernalGreed")]
[assembly: AssemblyTitle("NoInfernalGreed")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace NoInfernalGreed;

[BepInPlugin("paull.noinfernalgreed", "No Infernal Greed", "1.0.0")]
public sealed class Plugin : BaseUnityPlugin
{
	[HarmonyPatch(typeof(TrialVariantEventRelay), "IsAvailableServer")]
	private static class AvailabilityPatch
	{
		[HarmonyPostfix]
		private static void Postfix(TrialVariantEventRelay __instance, ref bool __result)
		{
			if (__result && string.Equals(__instance.trialVariantNotificationInfo.nameToken, "QUEST_TRIAL_SADISMMONEY_NAME", StringComparison.Ordinal))
			{
				__result = false;
				if (!loggedExclusion)
				{
					loggedExclusion = true;
					log.LogInfo((object)"Excluded Trial of Infernal Greed from the ritual pool.");
				}
			}
		}
	}

	public const string PluginGuid = "paull.noinfernalgreed";

	private Harmony harmony;

	private static bool loggedExclusion;

	private static ManualLogSource log;

	private void Awake()
	{
		//IL_0011: Unknown result type (might be due to invalid IL or missing references)
		//IL_001b: Expected O, but got Unknown
		log = ((BaseUnityPlugin)this).Logger;
		harmony = new Harmony("paull.noinfernalgreed");
		harmony.PatchAll(typeof(Plugin).Assembly);
		((BaseUnityPlugin)this).Logger.LogInfo((object)"No Infernal Greed loaded. Infernal Greed is excluded from random trial selection.");
	}

	private void OnDestroy()
	{
		Harmony obj = harmony;
		if (obj != null)
		{
			obj.UnpatchSelf();
		}
	}
}