Decompiled source of Infinite Shrine Of Chance v1.0.0

plugins/InfiniteShrineOfChance.dll

Decompiled 2 days ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using HG.Reflection;
using IL.RoR2;
using Microsoft.CodeAnalysis;
using Mono.Cecil;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using RoR2;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: OptIn]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("InfiniteShrineOfChance")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("InfiniteShrineOfChance")]
[assembly: AssemblyTitle("InfiniteShrineOfChance")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
[module: UnverifiableCode]
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;
		}
	}
}
namespace InfiniteShrineOfChance
{
	[Serializable]
	[BepInPlugin("com.brynzananas.infiniteshrineofchance", "Infinite Shrine Of Chance", "1.0.0")]
	public class Main : BaseUnityPlugin
	{
		public const string ModGuid = "com.brynzananas.infiniteshrineofchance";

		public const string ModName = "Infinite Shrine Of Chance";

		public const string ModVer = "1.0.0";

		public void Awake()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			ShrineChanceBehavior.AddShrineStack += new Manipulator(ShrineChanceBehavior_AddShrineStack);
		}

		private void ShrineChanceBehavior_AddShrineStack(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[6]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0),
				(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0),
				(Instruction x) => ILPatternMatchingExt.MatchLdfld<ShrineChanceBehavior>(x, "successfulPurchaseCount"),
				(Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, 1),
				(Instruction x) => ILPatternMatchingExt.MatchAdd(x),
				(Instruction x) => ILPatternMatchingExt.MatchStfld<ShrineChanceBehavior>(x, "successfulPurchaseCount")
			}))
			{
				val.Emit(OpCodes.Ldarg_0);
				val.EmitDelegate<Action<ShrineChanceBehavior>>((Action<ShrineChanceBehavior>)ThisIsDumb);
			}
			else
			{
				Debug.LogError((object)(((MemberReference)il.Method).Name + " IL Hook failed!"));
			}
			static void ThisIsDumb(ShrineChanceBehavior shrineChanceBehavior)
			{
				shrineChanceBehavior.successfulPurchaseCount--;
			}
		}
	}
}