Decompiled source of EchoSpikeFix v1.0.0

EchoSpikeFix.dll

Decompiled 2 weeks ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.6.2", FrameworkDisplayName = ".NET Framework 4.6.2")]
[assembly: AssemblyVersion("0.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 EchoSpikeFix
{
	[BepInPlugin("local.echospikefix", "Echo Spike Fix", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		internal static ConfigEntry<bool> Enabled;

		private void Awake()
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			Enabled = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Enabled", true, "Give Echo Spike's area effect an owner so it no longer damages players. Set to false to disable the fix.");
			new Harmony("local.echospikefix").PatchAll();
		}
	}
	internal static class PendingOwner
	{
		public static Character Owner;
	}
	[HarmonyPatch(typeof(Projectile), "SpawnOnHit")]
	internal static class SpawnOnHitPatch
	{
		private static void Prefix(Projectile __instance, Character ___m_owner)
		{
			if (Plugin.Enabled.Value && ((Object)__instance).name.Contains("OrbofAhri"))
			{
				PendingOwner.Owner = ___m_owner;
			}
		}

		private static void Finalizer()
		{
			PendingOwner.Owner = null;
		}
	}
	[HarmonyPatch(typeof(Aoe), "Awake")]
	internal static class AoeAwakePatch
	{
		private static void Postfix(Aoe __instance)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			Character owner = PendingOwner.Owner;
			if (!((Object)(object)owner == (Object)null) && ((Object)((Component)__instance).transform.root).name.Contains("staff_OrbofAhri"))
			{
				__instance.Setup(owner, Vector3.zero, 0f, (HitData)null, (ItemData)null, (ItemData)null);
			}
		}
	}
}