Decompiled source of ChronicExpansionBeepBeGone v1.0.0

ChronicExpansionBlinkBeGone.dll

Decompiled 3 weeks 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 BepInEx.Configuration;
using BepInEx.Logging;
using IL.RoR2;
using Microsoft.CodeAnalysis;
using Mono.Cecil.Cil;
using MonoMod.Cil;
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("ChronicExpansionBlinkBeGone")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("ChronicExpansionBlinkBeGone")]
[assembly: AssemblyTitle("ChronicExpansionBlinkBeGone")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
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 ExamplePlugin
{
	internal static class Log
	{
		private static ManualLogSource _logSource;

		internal static void Init(ManualLogSource logSource)
		{
			_logSource = logSource;
		}

		internal static void Debug(object data)
		{
			_logSource.LogDebug(data);
		}

		internal static void Error(object data)
		{
			_logSource.LogError(data);
		}

		internal static void Fatal(object data)
		{
			_logSource.LogFatal(data);
		}

		internal static void Info(object data)
		{
			_logSource.LogInfo(data);
		}

		internal static void Message(object data)
		{
			_logSource.LogMessage(data);
		}

		internal static void Warning(object data)
		{
			_logSource.LogWarning(data);
		}
	}
}
namespace ChronicExpansionBlinkBeGone
{
	[BepInPlugin("com.jeffdev.chronicexpansionblinkbegone", "Chronic Expansion Blink Be Gone", "1.0.0")]
	public class ChronicExpansionBlinkBeGone : BaseUnityPlugin
	{
		private ConfigEntry<float> blinkBelowConfig;

		public void Awake()
		{
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			blinkBelowConfig = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Blink Time", 0f, "The amount of time the chronic expansion beep should go for before it disables itself. 3 is the vanilla value, 0 disables it entirely.");
			IncreaseDamageOnMultiKillItemDisplayUpdater.ctor += new Manipulator(ConstructorILPatch);
		}

		private void ConstructorILPatch(ILContext il)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			ILCursor val = new ILCursor(il);
			float num = default(float);
			if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[3]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0),
				(Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, ref num),
				(Instruction x) => ILPatternMatchingExt.MatchStfld<IncreaseDamageOnMultiKillItemDisplayUpdater>(x, "blinkBelow")
			}))
			{
				int index = val.Index;
				val.Index = index - 1;
				val.EmitDelegate<Func<float, float>>((Func<float, float>)((float _) => blinkBelowConfig.Value));
			}
			else
			{
				((BaseUnityPlugin)this).Logger.LogError((object)"Could not find the blinkBelow assignment in the constructor!");
			}
		}
	}
}