Decompiled source of PolyluteNerf v1.1.2

PolyluteNerf.dll

Decompiled 7 months ago
using System;
using System.Collections.Generic;
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.Logging;
using IL.RoR2;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using R2API;
using RoR2;
using RoR2.Orbs;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("PolyluteNerf")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("PolyluteNerf")]
[assembly: AssemblyTitle("PolyluteNerf")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace PolyluteNerf
{
	[BepInPlugin("OakPrime.PolyluteNerf", "PolyluteNerf", "1.1.2")]
	public class PolyluteNerf : BaseUnityPlugin
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static Func<Instruction, bool> <>9__5_1;

			public static Func<Instruction, bool> <>9__5_2;

			public static Func<Instruction, bool> <>9__5_3;

			public static Func<Instruction, bool> <>9__5_4;

			public static Func<Instruction, bool> <>9__5_5;

			public static Func<Instruction, bool> <>9__5_6;

			public static Func<Instruction, bool> <>9__5_7;

			public static Func<Instruction, bool> <>9__5_8;

			public static Func<int, int> <>9__5_9;

			public static Manipulator <>9__5_0;

			internal void <Awake>b__5_0(ILContext il)
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_0008: Expected O, but got Unknown
				ILCursor val = new ILCursor(il);
				ILLabel val2 = default(ILLabel);
				int num4 = default(int);
				val.TryGotoNext(new Func<Instruction, bool>[3]
				{
					(Instruction x) => ILPatternMatchingExt.MatchBrfalse(x, ref val2),
					(Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, 0.6f),
					(Instruction x) => ILPatternMatchingExt.MatchStloc(x, ref num4)
				});
				int index = val.Index;
				val.Index = index + 1;
				val.Next.Operand = 0.4f;
				int num3 = default(int);
				int num2 = default(int);
				int num = default(int);
				val.TryGotoNext(new Func<Instruction, bool>[5]
				{
					(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref num3),
					(Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, ref num2),
					(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref num),
					(Instruction x) => ILPatternMatchingExt.MatchMul(x),
					(Instruction x) => ILPatternMatchingExt.MatchStfld<VoidLightningOrb>(x, "totalStrikes")
				});
				val.Index += 4;
				val.EmitDelegate<Func<int, int>>((Func<int, int>)((int totalStrikes) => (totalStrikes > 3) ? (totalStrikes - totalStrikes / 3 + 1) : totalStrikes));
			}

			internal bool <Awake>b__5_1(Instruction x)
			{
				ILLabel val = default(ILLabel);
				return ILPatternMatchingExt.MatchBrfalse(x, ref val);
			}

			internal bool <Awake>b__5_2(Instruction x)
			{
				return ILPatternMatchingExt.MatchLdcR4(x, 0.6f);
			}

			internal bool <Awake>b__5_3(Instruction x)
			{
				int num = default(int);
				return ILPatternMatchingExt.MatchStloc(x, ref num);
			}

			internal bool <Awake>b__5_4(Instruction x)
			{
				int num = default(int);
				return ILPatternMatchingExt.MatchLdloc(x, ref num);
			}

			internal bool <Awake>b__5_5(Instruction x)
			{
				int num = default(int);
				return ILPatternMatchingExt.MatchLdcI4(x, ref num);
			}

			internal bool <Awake>b__5_6(Instruction x)
			{
				int num = default(int);
				return ILPatternMatchingExt.MatchLdloc(x, ref num);
			}

			internal bool <Awake>b__5_7(Instruction x)
			{
				return ILPatternMatchingExt.MatchMul(x);
			}

			internal bool <Awake>b__5_8(Instruction x)
			{
				return ILPatternMatchingExt.MatchStfld<VoidLightningOrb>(x, "totalStrikes");
			}

			internal int <Awake>b__5_9(int totalStrikes)
			{
				if (totalStrikes > 3)
				{
					return totalStrikes - totalStrikes / 3 + 1;
				}
				return totalStrikes;
			}
		}

		public const string PluginGUID = "OakPrime.PolyluteNerf";

		public const string PluginAuthor = "OakPrime";

		public const string PluginName = "PolyluteNerf";

		public const string PluginVersion = "1.1.2";

		private readonly Dictionary<string, string> DefaultLanguage = new Dictionary<string, string>();

		public void Awake()
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Expected O, but got Unknown
			try
			{
				object obj = <>c.<>9__5_0;
				if (obj == null)
				{
					Manipulator val = delegate(ILContext il)
					{
						//IL_0002: Unknown result type (might be due to invalid IL or missing references)
						//IL_0008: Expected O, but got Unknown
						ILCursor val2 = new ILCursor(il);
						ILLabel val3 = default(ILLabel);
						int num4 = default(int);
						val2.TryGotoNext(new Func<Instruction, bool>[3]
						{
							(Instruction x) => ILPatternMatchingExt.MatchBrfalse(x, ref val3),
							(Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, 0.6f),
							(Instruction x) => ILPatternMatchingExt.MatchStloc(x, ref num4)
						});
						int index = val2.Index;
						val2.Index = index + 1;
						val2.Next.Operand = 0.4f;
						int num3 = default(int);
						int num2 = default(int);
						int num = default(int);
						val2.TryGotoNext(new Func<Instruction, bool>[5]
						{
							(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref num3),
							(Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, ref num2),
							(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref num),
							(Instruction x) => ILPatternMatchingExt.MatchMul(x),
							(Instruction x) => ILPatternMatchingExt.MatchStfld<VoidLightningOrb>(x, "totalStrikes")
						});
						val2.Index += 4;
						val2.EmitDelegate<Func<int, int>>((Func<int, int>)((int totalStrikes) => (totalStrikes > 3) ? (totalStrikes - totalStrikes / 3 + 1) : totalStrikes));
					};
					<>c.<>9__5_0 = val;
					obj = (object)val;
				}
				GlobalEventManager.OnHitEnemy += (Manipulator)obj;
				ReplacePolyluteText();
			}
			catch (Exception ex)
			{
				((BaseUnityPlugin)this).Logger.LogError((object)(ex.Message + " - " + ex.StackTrace));
			}
		}

		private void ReplacePolyluteText()
		{
			ReplaceString("ITEM_CHAINLIGHTNINGVOID_DESC", "<style=cIsDamage>25%</style> chance to fire <style=cIsDamage>lightning</style>for <style=cIsDamage>40%</style> TOTAL damage up to <style=cIsDamage>3</style> <style=cStack>(+2 per stack)</style>times. <style=cIsVoid>Corrupts all Ukeleles</style>.");
		}

		private void ReplaceString(string token, string newText)
		{
			DefaultLanguage[token] = Language.GetString(token);
			LanguageAPI.Add(token, newText);
		}
	}
}
namespace ExamplePlugin
{
	internal static class Log
	{
		internal static ManualLogSource _logSource;

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

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

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

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

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

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

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