Decompiled source of LiveWireDive v1.3.0

LiveWireDive.dll

Decompiled 2 weeks 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.Movement;
using UnityEngine;

[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 = ".NET Standard 2.1")]
[assembly: AssemblyCompany("DBR")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.1.0")]
[assembly: AssemblyInformationalVersion("1.0.1")]
[assembly: AssemblyProduct("Live Wire Dive")]
[assembly: AssemblyTitle("LiveWireDive")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.1.0")]
[module: UnverifiableCode]
[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 LiveWireDive
{
	[MycoMod(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("DBR.LiveWireDive", "LiveWireDive", "1.3.0")]
	public class Plugin : BaseUnityPlugin
	{
		[HarmonyPatch(typeof(NoseDiveUpgrade), "TriggerNoseDive")]
		public static class TriggerNoseDivePatch
		{
			[HarmonyPrefix]
			public static void Prefix()
			{
				//IL_0023: Unknown result type (might be due to invalid IL or missing references)
				//IL_0028: Unknown result type (might be due to invalid IL or missing references)
				//IL_0029: Unknown result type (might be due to invalid IL or missing references)
				//IL_006c: Unknown result type (might be due to invalid IL or missing references)
				//IL_008c: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
				IGear throwableGear = Player.LocalPlayer.ThrowableGear;
				VoltaicGrenade val = (VoltaicGrenade)(object)((throwableGear is VoltaicGrenade) ? throwableGear : null);
				if (val == null)
				{
					return;
				}
				Data grenadeData = val.GrenadeData;
				if (grenadeData.selfGrenadeDuration > 0f)
				{
					float num = SelfGrenadeTimer.Invoke(val);
					if (num >= 0f)
					{
						SelfGrenadeTimer.Invoke(val) = num + grenadeData.selfGrenadeExplodeInterval - SelfGrenadeExplosionTimer.Invoke(val);
						SelfGrenadeExplosionTimer.Invoke(val) = grenadeData.selfGrenadeExplodeInterval;
						((Throwable)val).Player.UpdateStackDisplay((object)typeof(UpgradeProperty_VoltaicGrenade_Livewire), TextBlocks.GetString("Livewire", 0), LiveWireIcon.Invoke(val), grenadeData.selfGrenadesApplied, grenadeData.selfGrenadeDuration - SelfGrenadeTimer.Invoke(val));
					}
				}
			}
		}

		internal static ManualLogSource Logger;

		public const string PLUGIN_GUID = "DBR.LiveWireDive";

		public const string PLUGIN_NAME = "LiveWireDive";

		public const string PLUGIN_VERSION = "1.3.0";

		private static readonly FieldRef<VoltaicGrenade, float> SelfGrenadeExplosionTimer = AccessTools.FieldRefAccess<VoltaicGrenade, float>("selfGrenadeExplosionTimer");

		private static readonly FieldRef<VoltaicGrenade, Sprite> LiveWireIcon = AccessTools.FieldRefAccess<VoltaicGrenade, Sprite>("livewireIcon");

		private static readonly FieldRef<VoltaicGrenade, float> SelfGrenadeTimer = AccessTools.FieldRefAccess<VoltaicGrenade, float>("selfGrenadeTimer");

		private void Awake()
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Expected O, but got Unknown
			Logger = ((BaseUnityPlugin)this).Logger;
			Logger.LogInfo((object)"Plugin DBR.LiveWireDive is loaded");
			Harmony val = new Harmony("DBR.LiveWireDive");
			try
			{
				val.PatchAll();
			}
			catch (Exception ex)
			{
				Logger.LogError((object)("Error applying patches: " + ex.Message));
			}
		}
	}
}