Decompiled source of GreenPrismFix v1.0.2

BepInEx/plugins/GreenPrismFix.dll

Decompiled 2 months ago
using System;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
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+1bd809068e13335c1269104237ccdc720974f5ea")]
[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;
		}
	}
}
[BepInPlugin("sparroh.greenprismfix", "GreenPrismFix", "1.0.2")]
public class Plugin : BaseUnityPlugin
{
	public const string PluginGUID = "sparroh.greenprismfix";

	public const string PluginName = "GreenPrismFix";

	public const string PluginVersion = "1.0.2";

	internal static ManualLogSource Logger;

	private void Awake()
	{
		//IL_0005: Unknown result type (might be due to invalid IL or missing references)
		new Harmony("sparroh.greenprismfix").PatchAll();
		Logger = ((BaseUnityPlugin)this).Logger;
		Logger.LogInfo((object)"GreenPrismFix loaded successfully.");
	}
}
[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;
	}
}
[CompilerGenerated]
[ExcludeFromCodeCoverage]
internal static class GitVersionInformation
{
	public const string AssemblySemFileVer = "0.0.1.0";

	public const string AssemblySemVer = "0.0.1.0";

	public const string BranchName = "master";

	public const string BuildMetaData = "";

	public const string CommitDate = "2025-10-17";

	public const string CommitsSinceVersionSource = "1";

	public const string EscapedBranchName = "master";

	public const string FullBuildMetaData = "Branch.master.Sha.1bd809068e13335c1269104237ccdc720974f5ea";

	public const string FullSemVer = "0.0.1-1";

	public const string InformationalVersion = "0.0.1-1+Branch.master.Sha.1bd809068e13335c1269104237ccdc720974f5ea";

	public const string Major = "0";

	public const string MajorMinorPatch = "0.0.1";

	public const string Minor = "0";

	public const string Patch = "1";

	public const string PreReleaseLabel = "";

	public const string PreReleaseLabelWithDash = "";

	public const string PreReleaseNumber = "1";

	public const string PreReleaseTag = "1";

	public const string PreReleaseTagWithDash = "-1";

	public const string SemVer = "0.0.1-1";

	public const string Sha = "1bd809068e13335c1269104237ccdc720974f5ea";

	public const string ShortSha = "1bd8090";

	public const string UncommittedChanges = "12";

	public const string VersionSourceSha = "";

	public const string WeightedPreReleaseNumber = "55001";
}
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 System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}