Decompiled source of FalseSonM2Tweaks v1.0.2

plugins/FalseSonM2Tweaks.dll

Decompiled 2 days 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.Configuration;
using EntityStates.FalseSon;
using On.EntityStates.FalseSon;
using R2API.Utils;
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("FalseSonM2Tweaks")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("FalseSonM2Tweaks")]
[assembly: AssemblyTitle("FalseSonM2Tweaks")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace FalseSonM2Tweaks;

[BepInDependency("com.bepis.r2api", "5.1.1")]
[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
[BepInPlugin("com.toarch7.FalseSonM2Tweaks", "FalseSonM2Tweaks", "1.0.2")]
public class FalseSonM2Tweaks : BaseUnityPlugin
{
	[Serializable]
	[CompilerGenerated]
	private sealed class <>c
	{
		public static readonly <>c <>9 = new <>c();

		public static hook_OnEnter <>9__6_0;

		internal void <EnableHigherSpeed>b__6_0(orig_OnEnter orig, LunarSpikes self)
		{
			self.baseDuration = 0.25f;
			orig.Invoke(self);
		}
	}

	public const string ModGUID = "com.toarch7.FalseSonM2Tweaks";

	public const string ModName = "FalseSonM2Tweaks";

	public const string ModVersion = "1.0.2";

	private static ConfigEntry<bool> configEnableM2Agile;

	private static ConfigEntry<bool> configEnableM2SpeedBoost;

	private static void EnableAgile()
	{
		//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)
		GameObject val = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC2/FalseSon/FalseSonBody.prefab").WaitForCompletion();
		SkillLocator component = val.GetComponent<SkillLocator>();
		SkillFamily skillFamily = component.secondary.skillFamily;
		SkillDef skillDef = skillFamily.variants[0].skillDef;
		skillDef.cancelSprintingOnActivation = false;
	}

	private static void EnableHigherSpeed()
	{
		//IL_0015: Unknown result type (might be due to invalid IL or missing references)
		//IL_001a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0020: Expected O, but got Unknown
		object obj = <>c.<>9__6_0;
		if (obj == null)
		{
			hook_OnEnter val = delegate(orig_OnEnter orig, LunarSpikes self)
			{
				self.baseDuration = 0.25f;
				orig.Invoke(self);
			};
			<>c.<>9__6_0 = val;
			obj = (object)val;
		}
		LunarSpikes.OnEnter += (hook_OnEnter)obj;
	}

	public void Awake()
	{
		configEnableM2Agile = ((BaseUnityPlugin)this).Config.Bind<bool>("Settings", "EnableM2Agile", true, "Makes False Son's secondary skill \"agile\", disabling it from cancelling sprinting on activation");
		configEnableM2SpeedBoost = ((BaseUnityPlugin)this).Config.Bind<bool>("Settings", "EnableM2SpeedBoost", true, "Makes False Son's secondary skill perform shots much faster");
		if (configEnableM2Agile.Value)
		{
			EnableAgile();
		}
		if (configEnableM2SpeedBoost.Value)
		{
			EnableHigherSpeed();
		}
	}
}