Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of SeekerAutoChores v1.1.2
plugins/SeekerAutoChores.dll
Decompiled 11 months agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using EntityStates.Seeker; using HarmonyLib; using On.EntityStates.Seeker; using R2API.Utils; 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("SeekerAutoChores")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("SeekerAutoChores")] [assembly: AssemblyTitle("SeekerAutoChores")] [assembly: AssemblyVersion("1.0.0.0")] namespace SeekerAutoChores; [BepInDependency("com.bepis.r2api", "5.1.5")] [NetworkCompatibility(/*Could not decode attribute arguments.*/)] [BepInPlugin("com.toarch7.SeekerAutoChores", "SeekerAutoChores", "1.1.1")] public class SeekerAutoChores : BaseUnityPlugin { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static hook_Update <>9__11_0; internal void <Awake>b__11_0(orig_Update orig, Meditate self) { //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Expected O, but got Unknown Type typeFromHandle = typeof(Meditate); BindingFlags bindingAttr = BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy; if ((bool)typeFromHandle.GetProperty("isAuthority", bindingAttr).GetValue(self) && IsNextInputAvailable()) { if (self.seekerController.meditationInputStep < 5) { GameObject val = (GameObject)typeFromHandle.GetProperty("gameObject", bindingAttr).GetValue(self); Util.PlaySound("Play_seeker_skill4_combo_correct", val); SeekerController seekerController = self.seekerController; sbyte meditationInputStep = seekerController.meditationInputStep; seekerController.meditationInputStep = (sbyte)(meditationInputStep + 1); } float num = configInputDelayValue.Value; if (configRandomizeInputMultiplier.Value != 0) { float num2 = 1f + (float)(configRandomizeInputMultiplier.Value / 100); num *= Random.Range(num2, 1f); if (num < 20f) { num = 20f; } } SetNextInputTime(num); } orig.Invoke(self); } } public const string ModGUID = "com.toarch7.SeekerAutoChores"; public const string ModName = "SeekerAutoChores"; public const string ModVersion = "1.1.1"; private static float nextAutoInput; private static ConfigEntry<int> configRandomizeInputMultiplier; private static ConfigEntry<int> configInputDelayValue; private const int configInputDelayMin = 20; private const int configInputDelayMax = 1000; public static bool IsNextInputAvailable() { return nextAutoInput <= Time.time; } public static void SetNextInputTime(float duration) { nextAutoInput = Time.time + duration / 1000f; } private void ValidateConfigurations() { configInputDelayValue.Value = Math.Clamp(configInputDelayValue.Value, 20, 1000); configRandomizeInputMultiplier.Value = Math.Clamp(configRandomizeInputMultiplier.Value, -100, 100); } public void Awake() { //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Expected O, but got Unknown configRandomizeInputMultiplier = ((BaseUnityPlugin)this).Config.Bind<int>("Settings", "RandomizeAmount", 20, "Input delay randomization amount (min -100% max 100%)"); configInputDelayValue = ((BaseUnityPlugin)this).Config.Bind<int>("Settings", "InputDelay", 300, $"Delay between each automated QTE input in miliseconds (min {20}, max {1000})"); ValidateConfigurations(); object obj = <>c.<>9__11_0; if (obj == null) { hook_Update val = delegate(orig_Update orig, Meditate self) { //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Expected O, but got Unknown Type typeFromHandle = typeof(Meditate); BindingFlags bindingAttr = BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy; if ((bool)typeFromHandle.GetProperty("isAuthority", bindingAttr).GetValue(self) && IsNextInputAvailable()) { if (self.seekerController.meditationInputStep < 5) { GameObject val2 = (GameObject)typeFromHandle.GetProperty("gameObject", bindingAttr).GetValue(self); Util.PlaySound("Play_seeker_skill4_combo_correct", val2); SeekerController seekerController = self.seekerController; sbyte meditationInputStep = seekerController.meditationInputStep; seekerController.meditationInputStep = (sbyte)(meditationInputStep + 1); } float num = configInputDelayValue.Value; if (configRandomizeInputMultiplier.Value != 0) { float num2 = 1f + (float)(configRandomizeInputMultiplier.Value / 100); num *= Random.Range(num2, 1f); if (num < 20f) { num = 20f; } } SetNextInputTime(num); } orig.Invoke(self); }; <>c.<>9__11_0 = val; obj = (object)val; } Meditate.Update += (hook_Update)obj; new Harmony("com.toarch7.SeekerAutoChores").PatchAll(); } } [HarmonyPatch(typeof(Meditate), "Update")] public class AutoChoresPatch { private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions) { //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Expected O, but got Unknown //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Expected O, but got Unknown List<CodeInstruction> list = new List<CodeInstruction>(instructions); int num = -1; for (int i = 0; i < list.Count; i++) { if (list[i].opcode == OpCodes.Ldc_I4_3 && list[i + 1].opcode == OpCodes.Stloc_0 && list[i + 3].opcode == OpCodes.Ldfld) { num = i + 3; break; } } if (num != -1) { list.Insert(num, new CodeInstruction(OpCodes.Ldc_I4_M1, (object)null)); list.Insert(num + 1, new CodeInstruction(OpCodes.Stloc_0, (object)null)); } return list.AsEnumerable(); } }