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 JustRetry v1.0.2
JustRetry.dll
Decompiled a year agousing System; using System.Collections; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using Mono.Cecil.Cil; using MonoMod.Cil; using MonoMod.RuntimeDetour; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("JustRetry")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("JustRetry")] [assembly: AssemblyTitle("JustRetry")] [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 JustRetry { [BepInPlugin("nickklmao.justretry", "Just Retry", "1.0.2")] internal sealed class Entry : BaseUnityPlugin { [CompilerGenerated] private static class <>O { public static Manipulator <0>__RunManager_ChangeLevelILHook; public static Action<Action<RoundDirector, int>, RoundDirector, int> <1>__RoundDirector_StartRoundLogicHook; } private const string MOD_NAME = "Just Retry"; internal static readonly ManualLogSource logger = Logger.CreateLogSource("Just Retry"); private static readonly FieldInfo playerHealthHealthFieldInfo = AccessTools.Field(typeof(PlayerHealth), "health"); private static ConfigEntry<bool> enabled; private static ConfigEntry<int> retryHP; private static bool isRestarting; private static void RunManager_ChangeLevelILHook(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); val.GotoNext(new Func<Instruction, bool>[1] { (Instruction instruction) => ILPatternMatchingExt.MatchStfld<RunManager>(instruction, "gameOver") }); val.Index -= 2; int index = val.Index; val.Emit(OpCodes.Ldarg_2); val.EmitDelegate<Func<bool, bool>>((Func<bool, bool>)delegate(bool levelFailed) { if (!levelFailed || !enabled.Value) { return false; } isRestarting = true; RunManager.instance.RestartScene(); return true; }); ILLabel val2 = val.DefineLabel(); val.Emit(OpCodes.Brfalse_S, (object)val2); val.Emit(OpCodes.Ret); val.MarkLabel(val2); val.Index -= 8; ILLabel val3 = val.DefineLabel(); val.Remove(); val.Emit(OpCodes.Brfalse_S, (object)val3); val.Index = index; val.MarkLabel(val3); } private static void RoundDirector_StartRoundLogicHook(Action<RoundDirector, int> orig, RoundDirector self, int value) { orig(self, value); if (isRestarting && SemiFunc.IsMasterClientOrSingleplayer()) { ((MonoBehaviour)self).StartCoroutine(HealPlayers()); isRestarting = false; } static IEnumerator HealPlayers() { yield return (object)new WaitForSeconds(5f); foreach (PlayerHealth item in from player in SemiFunc.PlayerGetAll() select player.playerHealth) { int num = (int)playerHealthHealthFieldInfo.GetValue(item); if (num < retryHP.Value) { item.HealOther(retryHP.Value - num, true); } } } } private void Awake() { //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Expected O, but got Unknown //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: 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_008f: Expected O, but got Unknown //IL_00d5: Unknown result type (might be due to invalid IL or missing references) enabled = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Enabled", true, (ConfigDescription)null); retryHP = ((BaseUnityPlugin)this).Config.Bind<int>("General", "Retry HP", 100, new ConfigDescription("The health you'll respawn with after retrying", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 100), Array.Empty<object>())); logger.LogDebug((object)"Hooking `RunManager.ChangeLevel`"); MethodInfo methodInfo = AccessTools.Method(typeof(RunManager), "ChangeLevel", (Type[])null, (Type[])null); object obj = <>O.<0>__RunManager_ChangeLevelILHook; if (obj == null) { Manipulator val = RunManager_ChangeLevelILHook; <>O.<0>__RunManager_ChangeLevelILHook = val; obj = (object)val; } new ILHook((MethodBase)methodInfo, (Manipulator)obj); logger.LogDebug((object)"Hooking `RoundDirector.StartRoundLogic`"); new Hook((MethodBase)AccessTools.Method(typeof(RoundDirector), "StartRoundLogic", (Type[])null, (Type[])null), (Delegate)new Action<Action<RoundDirector, int>, RoundDirector, int>(RoundDirector_StartRoundLogicHook)); } } }