Decompiled source of LeapSkills v1.0.4

LeapSkills.dll

Decompiled a week 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 EntityStates;
using EntityStates.Croco;
using Microsoft.CodeAnalysis;
using On.EntityStates.Croco;
using RoR2;
using RoR2.Skills;
using UnityEngine;
using UnityEngine.AddressableAssets;

[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("LeapSkills")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("LeapSkills")]
[assembly: AssemblyTitle("LeapSkills")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.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 LeapSkills
{
	[BepInPlugin("HIFU.LeapSkills", "LeapSkills", "1.0.4")]
	public class Main : BaseUnityPlugin
	{
		public const string PluginGUID = "HIFU.LeapSkills";

		public const string PluginAuthor = "HIFU";

		public const string PluginName = "LeapSkills";

		public const string PluginVersion = "1.0.4";

		public void Awake()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0161: Unknown result type (might be due to invalid IL or missing references)
			//IL_016b: Expected O, but got Unknown
			//IL_0173: Unknown result type (might be due to invalid IL or missing references)
			//IL_017d: Expected O, but got Unknown
			GameObject val = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Croco/CrocoBody.prefab").WaitForCompletion();
			EntityStateMachine[] components = val.GetComponents<EntityStateMachine>();
			foreach (EntityStateMachine val2 in components)
			{
				if (val2.customName == "Leap")
				{
					return;
				}
			}
			EntityStateMachine val3 = val.AddComponent<EntityStateMachine>();
			val3.customName = "Leap";
			val3.initialStateType = new SerializableEntityStateType(typeof(Idle));
			val3.mainStateType = new SerializableEntityStateType(typeof(Idle));
			SkillDef val4 = Addressables.LoadAssetAsync<SkillDef>((object)"RoR2/Base/Croco/CrocoLeap.asset").WaitForCompletion();
			val4.activationStateMachineName = "Leap";
			SkillDef val5 = Addressables.LoadAssetAsync<SkillDef>((object)"RoR2/Base/Croco/CrocoChainableLeap.asset").WaitForCompletion();
			val5.activationStateMachineName = "Leap";
			EntityStateMachine val6 = val.AddComponent<EntityStateMachine>();
			val6.customName = "Neurotoxin";
			val6.initialStateType = new SerializableEntityStateType(typeof(Idle));
			val6.mainStateType = new SerializableEntityStateType(typeof(Idle));
			NetworkStateMachine component = val.GetComponent<NetworkStateMachine>();
			Array.Resize(ref component.stateMachines, component.stateMachines.Length + 1);
			component.stateMachines[component.stateMachines.Length - 2] = val3;
			component.stateMachines[component.stateMachines.Length - 1] = val6;
			BaseLeap.OnEnter += new hook_OnEnter(BaseLeap_OnEnter);
			BaseLeap.OnExit += new hook_OnExit(BaseLeap_OnExit);
		}

		private void BaseLeap_OnExit(orig_OnExit orig, BaseLeap self)
		{
			SkillLocator skillLocator = ((EntityState)self).skillLocator;
			if (Object.op_Implicit((Object)(object)skillLocator))
			{
				GenericSkill primary = skillLocator.primary;
				if (Object.op_Implicit((Object)(object)primary) && !primary.skillDef.canceledFromSprinting)
				{
					primary.skillDef.canceledFromSprinting = true;
				}
			}
			orig.Invoke(self);
			if (Object.op_Implicit((Object)(object)((EntityState)self).characterBody))
			{
				((EntityState)self).characterBody.isSprinting = true;
			}
		}

		private void BaseLeap_OnEnter(orig_OnEnter orig, BaseLeap self)
		{
			SkillLocator skillLocator = ((EntityState)self).skillLocator;
			if (Object.op_Implicit((Object)(object)skillLocator))
			{
				GenericSkill primary = skillLocator.primary;
				if (Object.op_Implicit((Object)(object)primary) && primary.skillDef.canceledFromSprinting)
				{
					primary.skillDef.canceledFromSprinting = false;
				}
			}
			orig.Invoke(self);
		}
	}
}