Decompiled source of GokuKamehamehaSlotFix v1.0.1

GokuKamehamehaSlotFix.dll

Decompiled 17 hours ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using EntityStates;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using NS_Goku;
using RoR2;
using UnityEngine;

[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("GokuKamehamehaSlotFix")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("GokuKamehamehaSlotFix")]
[assembly: AssemblyTitle("GokuKamehamehaSlotFix")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[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 GokuKamehamehaSlotFix
{
	[BepInPlugin("com.yourname.GokuKamehamehaSlotFix", "Goku Kamehameha Slot Fix", "1.0.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class GokuKamehamehaSlotFixPlugin : BaseUnityPlugin
	{
		public const string PluginGUID = "com.yourname.GokuKamehamehaSlotFix";

		public const string PluginName = "Goku Kamehameha Slot Fix";

		public const string PluginVersion = "1.0.0";

		private Harmony _harmony;

		private void Awake()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Expected O, but got Unknown
			_harmony = new Harmony("com.yourname.GokuKamehamehaSlotFix");
			_harmony.PatchAll(Assembly.GetExecutingAssembly());
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Goku Kamehameha Slot Fix v1.0.0 loaded - KamehamehaSkill will now charge correctly in any skill slot.");
		}

		private void OnDestroy()
		{
			Harmony harmony = _harmony;
			if (harmony != null)
			{
				harmony.UnpatchSelf();
			}
		}
	}
	[HarmonyPatch(typeof(KamehamehaSkill), "ChildCanFireBeam")]
	public static class KamehamehaSkill_ChildCanFireBeam_Patch
	{
		private static readonly PropertyInfo ActivatorSkillSlotProp = AccessTools.Property(typeof(BaseSkillState), "activatorSkillSlot");

		private static readonly PropertyInfo InputBankProp = AccessTools.Property(typeof(EntityState), "inputBank");

		public static bool Prefix(KamehamehaSkill __instance, ref bool __result)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Expected O, but got Unknown
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Expected I4, but got Unknown
			SkillSlot val = (SkillSlot)ActivatorSkillSlotProp.GetValue(__instance, null);
			InputBankTest val2 = (InputBankTest)InputBankProp.GetValue(__instance, null);
			if ((Object)(object)val2 == (Object)null)
			{
				__result = false;
				return false;
			}
			__result = (int)val switch
			{
				0 => val2.skill1.down ? 1 : 0, 
				1 => val2.skill2.down ? 1 : 0, 
				2 => val2.skill3.down ? 1 : 0, 
				_ => val2.skill4.down ? 1 : 0, 
			} == 0;
			return false;
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "GokuKamehamehaSlotFix";

		public const string PLUGIN_NAME = "GokuKamehamehaSlotFix";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}