Decompiled source of GreenPrismFix v1.0.0

BepInEx/plugins/GreenPrismFix.dll

Decompiled 3 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 BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Pigeon.Math;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyCompany("GreenPrismFix")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("0.0.0.0")]
[assembly: AssemblyInformationalVersion("0.0.0-alpha.0")]
[assembly: AssemblyProduct("GreenPrismFix")]
[assembly: AssemblyTitle("GreenPrismFix")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.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 GreenPrismFix
{
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "GreenPrismFix";

		public const string PLUGIN_NAME = "GreenPrismFix";

		public const string PLUGIN_VERSION = "0.0.0";
	}
}
namespace MycopunkModTemplate
{
	[BepInPlugin("yourname.mycopunk.greenprismfix", "GreenPrismFix", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		internal static ManualLogSource Logger;

		private void Awake()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Expected O, but got Unknown
			Harmony val = new Harmony("yourname.mycopunk.greenprismfix");
			val.PatchAll();
			Logger = ((BaseUnityPlugin)this).Logger;
			Logger.LogInfo((object)("Plugin " + val.Id + " is loaded!"));
		}
	}
	[HarmonyPatch]
	public class MiniCannonPrismPatch
	{
		private static MethodInfo TargetMethod()
		{
			return AccessTools.Method(typeof(UpgradeProperty_MiniCannon_Prism), "Apply", new Type[3]
			{
				typeof(IGear),
				typeof(UpgradeInstance),
				typeof(Random).MakeByRefType()
			}, (Type[])null);
		}

		private static bool Prefix(UpgradeProperty_MiniCannon_Prism __instance, IGear gear, UpgradeInstance upgrade, ref Random rand)
		{
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0142: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: Expected I4, but got Unknown
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0183: Unknown result type (might be due to invalid IL or missing references)
			//IL_018a: Unknown result type (might be due to invalid IL or missing references)
			//IL_018f: Unknown result type (might be due to invalid IL or missing references)
			MiniCannon val = (MiniCannon)(object)((gear is MiniCannon) ? gear : null);
			if ((Object)(object)val == (Object)null)
			{
				return true;
			}
			Rarity val2 = (Rarity)AccessTools.Field(typeof(UpgradeProperty_MiniCannon_Prism), "rarity").GetValue(__instance);
			int num = (int)AccessTools.Method(typeof(UpgradeProperty_MiniCannon_Prism), "GetConnectedPrismCountRecursive", new Type[2]
			{
				typeof(IGear),
				typeof(UpgradeInstance)
			}, (Type[])null).Invoke(__instance, new object[2] { gear, upgrade });
			float num2;
			try
			{
				num2 = (float)AccessTools.Method(((object)upgrade).GetType(), "GetValue", new Type[1] { typeof(Random).MakeByRefType() }, (Type[])null).Invoke(upgrade, new object[1] { rand });
			}
			catch
			{
				object value = AccessTools.Field(typeof(UpgradeProperty_MiniCannon_Prism), "value").GetValue(__instance);
				num2 = (float)AccessTools.Method(value.GetType(), "GetValue", new Type[1] { typeof(Random).MakeByRefType() }, (Type[])null).Invoke(value, new object[1] { rand });
			}
			float num3 = 1f + (float)num * num2;
			switch ((int)val2)
			{
			case 0:
				((Gun)val).GunData.rangeData.maxDamageRange *= num3;
				break;
			case 1:
			{
				ref Vector2 spreadSize = ref ((Gun)val).GunData.spreadData.spreadSize;
				spreadSize *= num3;
				break;
			}
			case 2:
				((Gun)val).GunData.fireInterval *= 1f / num3;
				break;
			case 3:
				((Gun)val).GunData.damage *= num3;
				break;
			}
			return false;
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}