Decompiled source of AutoSeekerQTE v1.0.2

plugins/AutoSeekerQTE.dll

Decompiled 2 months ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using EntityStates.Seeker;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using RiskOfOptions;
using RiskOfOptions.OptionConfigs;
using RiskOfOptions.Options;
using RoR2;
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("AutoSeekerQTE")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("AutoSeekerQTE")]
[assembly: AssemblyTitle("AutoSeekerQTE")]
[assembly: AssemblyVersion("1.0.0.0")]
[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 AutoSeekerQTE
{
	[BepInPlugin("com.Arachneko.AutoSeekerQTE", "Auto Seeker QTE", "1.0.2")]
	public class AutoSeekerQTE : BaseUnityPlugin
	{
		[HarmonyPatch(typeof(SeekerController), "RandomizeMeditationInputs")]
		public static class QTEStartTimeReset
		{
			public static void Postfix()
			{
				nextAutoInputTime = Time.time + (float)inputDelayMs.Value / 1000f;
			}
		}

		[HarmonyPatch(typeof(Meditate), "Update")]
		public static class AutoInputPatch
		{
			public static void Postfix(Meditate __instance)
			{
				SeekerController seekerController = __instance.seekerController;
				if (!((Object)(object)seekerController == (Object)null) && seekerController.meditationInputStep < 5 && Time.time >= nextAutoInputTime)
				{
					sbyte meditationInputStep = seekerController.meditationInputStep;
					seekerController.meditationInputStep = (sbyte)(meditationInputStep + 1);
					nextAutoInputTime = Time.time + (float)inputDelayMs.Value / 1000f;
				}
			}
		}

		private static ConfigEntry<int> inputDelayMs;

		private static float nextAutoInputTime;

		public void Awake()
		{
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Expected O, but got Unknown
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Expected O, but got Unknown
			inputDelayMs = ((BaseUnityPlugin)this).Config.Bind<int>("Settings", "InputDelayMs", 600, new ConfigDescription("入力ディレイ(ms)", (AcceptableValueBase)(object)new AcceptableValueRange<int>(100, 950), Array.Empty<object>()));
			new Harmony("com.Arachneko.AutoSeekerQTE").PatchAll();
			if (Chainloader.PluginInfos.ContainsKey("com.rune580.riskofoptions"))
			{
				ModSettingsManager.AddOption((BaseOption)new IntSliderOption(inputDelayMs, new IntSliderConfig
				{
					min = 100,
					max = 950
				}));
			}
		}
	}
}