Decompiled source of PolyluteNerf v1.2.1

PolyluteNerf.dll

Decompiled 2 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.1", 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.2.1")]
	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<int, int> <>9__5_6;

			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);
				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 * 2 / 3));
			}

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

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

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

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

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

			internal int <Awake>b__5_6(int totalStrikes)
			{
				return totalStrikes * 2 / 3;
			}
		}

		public const string PluginGUID = "OakPrime.PolyluteNerf";

		public const string PluginAuthor = "OakPrime";

		public const string PluginName = "PolyluteNerf";

		public const string PluginVersion = "1.2.1";

		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);
						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 * 2 / 3));
					};
					<>c.<>9__5_0 = val;
					obj = (object)val;
				}
				GlobalEventManager.ProcessHitEnemy += (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>60%</style> TOTAL damage up to <style=cIsDamage>2</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);
		}
	}
}