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 SemibotMalfunction v1.0.3
SemibotMalfunction.dll
Decompiled a year agousing System; using System.Collections; using System.Collections.Generic; 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 BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; 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: IgnoresAccessChecksTo("")] [assembly: AssemblyCompany("TheASMRsonist")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("SemibotMalfunction")] [assembly: AssemblyTitle("SemibotMalfunction")] [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.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [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 SemibotMalfunction { [HarmonyPatch(typeof(PlayerController))] internal static class ExamplePlayerControllerPatch { [HarmonyPrefix] [HarmonyPatch("Start")] private static void Start_Prefix(PlayerController __instance) { SemibotMalfunction.Logger.LogDebug((object)$"{__instance} Start Prefix"); } [HarmonyPostfix] [HarmonyPatch("Start")] private static void Start_Postfix(PlayerController __instance) { SemibotMalfunction.Logger.LogDebug((object)$"{__instance} Start Postfix"); } } [HarmonyPatch] public static class OneHpPatch { [HarmonyPostfix] [HarmonyPatch(typeof(PlayerHealth), "Start")] public static void AfterPlayerHealthStart(PlayerHealth __instance) { if (SemibotMalfunction.EnableOneHpMode.Value) { SemibotMalfunction.OneHpEnforcer oneHpEnforcer = ((Component)__instance).gameObject.AddComponent<SemibotMalfunction.OneHpEnforcer>(); oneHpEnforcer.StartEnforce(__instance); } } [HarmonyPostfix] [HarmonyPatch(typeof(PlayerHealth), "Awake")] public static void OnAwake(PlayerHealth __instance) { if (SemibotMalfunction.EnableOneHpMode.Value) { __instance.health = 1; __instance.maxHealth = 1; } } [HarmonyPostfix] [HarmonyPatch(typeof(PlayerHealth), "Start")] public static void OnStart(PlayerHealth __instance) { if (SemibotMalfunction.EnableOneHpMode.Value) { __instance.health = 1; __instance.maxHealth = 1; } } [HarmonyPostfix] [HarmonyPatch(typeof(PlayerHealth), "Heal")] public static void AfterHeal(PlayerHealth __instance) { if (SemibotMalfunction.EnableOneHpMode.Value) { __instance.health = 1; __instance.maxHealth = 1; } } [HarmonyPrefix] [HarmonyPatch(typeof(StatsManager), "GetPlayerHealth")] public static bool ForceOneHpOnNewGame(ref int __result) { if (!SemibotMalfunction.EnableOneHpMode.Value) { return true; } __result = 1; return false; } [HarmonyPrefix] [HarmonyPatch(typeof(StatsManager), "GetPlayerMaxHealth")] public static bool ForcemaxHealthToOne(ref int __result) { if (!SemibotMalfunction.EnableOneHpMode.Value) { return true; } __result = 1; return false; } } [BepInPlugin("TheASMRsonist.SemibotMalfunction", "SemibotMalfunction", "1.0.2")] public class SemibotMalfunction : BaseUnityPlugin { public class OneHpEnforcer : MonoBehaviour { [CompilerGenerated] private sealed class <Enforce>d__1 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public PlayerHealth ph; public OneHpEnforcer <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <Enforce>d__1(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(1f); <>1__state = 1; return true; case 1: <>1__state = -1; ph.maxHealth = 1; ph.health = Mathf.Min(ph.health, 1); return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } public void StartEnforce(PlayerHealth ph) { ((MonoBehaviour)this).StartCoroutine(Enforce(ph)); } [IteratorStateMachine(typeof(<Enforce>d__1))] private IEnumerator Enforce(PlayerHealth ph) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <Enforce>d__1(0) { <>4__this = this, ph = ph }; } } internal static ConfigEntry<bool> EnableOneHpMode; internal static ConfigEntry<bool> EnableOneHpUI; private GUIStyle? boxStyle; private GUIStyle? labelStyle; private GUIStyle? buttonStyle; private bool showUI = false; internal static SemibotMalfunction Instance { get; private set; } internal static ManualLogSource Logger => Instance._logger; private ManualLogSource _logger => ((BaseUnityPlugin)this).Logger; internal Harmony? Harmony { get; set; } private void Awake() { Instance = this; ((Component)this).gameObject.transform.parent = null; ((Object)((Component)this).gameObject).hideFlags = (HideFlags)61; EnableOneHpMode = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "EnableOneHpMode", true, "Enable or disable the mod. Takes effect after reload (modman or Gale) or instant (MenuLib)."); EnableOneHpUI = ((BaseUnityPlugin)this).Config.Bind<bool>("UI", "EnableOneHpUI", true, "Enables a UI, which will include many more things in the future, but now, only shows weither to turn on or off the mod."); Patch(); Logger.LogInfo((object)$"\r\n ( * \r\n )\\ ) ) ) ( ` ( ( ) \r\n(()/( ( ) ( ( /( ( /( )\\))( ) )\\ )\\ ) ( ( /(( \r\n /(_)) ))\\ ( )\\ )\\()) ( )\\()|(_)()\\ ( /(((_|()/( ))\\ ( ( )\\())\\ ( ( \r\n(_)) /((_) )\\ '((_|(_)\\ )\\(_))/(_()((_))(_))_ /(_))/((_) )\\ ) )\\(_))((_) )\\ )\\ ) \r\n/ __|(_)) _((_)) (_) |(_) ((_) |_ | \\/ ((_)_| |(_) _(_))( _(_/( ((_) |_ (_)((_)_(_/( \r\n\\__ \\/ -_) ' \\() | | '_ \\/ _ \\ _|| |\\/| / _` | | | _| || | ' \\)) _|| _|| / _ \\ ' \\))\r\n|___/\\___|_|_|_| |_|_.__/\\___/\\__||_| |_\\__,_|_| |_| \\_,_|_||_|\\__| \\__||_\\___/_||_| \r\n version v{((BaseUnityPlugin)this).Info.Metadata.Version} has loaded!"); } internal void Patch() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Expected O, but got Unknown //IL_0026: Expected O, but got Unknown if (Harmony == null) { Harmony val = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID); Harmony val2 = val; Harmony = val; } Harmony.PatchAll(); } internal void Unpatch() { Harmony? harmony = Harmony; if (harmony != null) { harmony.UnpatchSelf(); } } private void Update() { if (EnableOneHpUI.Value && Input.GetKeyDown((KeyCode)92)) { showUI = !showUI; } } private void OnGUI() { //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005e: 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_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Expected O, but got Unknown //IL_00af: Expected O, but got Unknown //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Expected O, but got Unknown //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_00ff: 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_0116: Expected O, but got Unknown //IL_011c: Expected O, but got Unknown if (EnableOneHpUI.Value && showUI) { if (boxStyle == null) { GUIStyle val = new GUIStyle(GUI.skin.box) { fontSize = 16, alignment = (TextAnchor)1 }; val.normal.textColor = Color.white; val.normal.background = MakeTex(2, 2, new Color(0f, 0f, 0f, 0.8f)); val.padding = new RectOffset(10, 10, 10, 10); boxStyle = val; GUIStyle val2 = new GUIStyle(GUI.skin.label) { fontSize = 14, alignment = (TextAnchor)4 }; val2.normal.textColor = Color.white; labelStyle = val2; buttonStyle = new GUIStyle(GUI.skin.button) { fontSize = 14, alignment = (TextAnchor)4, padding = new RectOffset(6, 6, 4, 4) }; } float num = 400f; float num2 = 140f; float num3 = ((float)Screen.width - num) / 2f; float num4 = 10f; GUILayout.BeginArea(new Rect(num3, num4, num, num2), boxStyle); GUILayout.Label("Semibot Malfunction", labelStyle, Array.Empty<GUILayoutOption>()); GUILayout.Space(10f); GUILayout.Label("One HP Mode: <b>" + (EnableOneHpMode.Value ? "ENABLED" : "DISABLED") + "</b>", labelStyle, Array.Empty<GUILayoutOption>()); GUILayout.Space(10f); if (GUILayout.Button(EnableOneHpMode.Value ? "Disable One HP Mode" : "Enable One HP Mode", buttonStyle, Array.Empty<GUILayoutOption>())) { EnableOneHpMode.Value = !EnableOneHpMode.Value; } GUILayout.Space(5f); GUILayout.Label("Press \\ to hide this menu", labelStyle, Array.Empty<GUILayoutOption>()); GUILayout.EndArea(); } } private Texture2D MakeTex(int width, int height, Color col) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Expected O, but got Unknown Color[] array = (Color[])(object)new Color[width * height]; for (int i = 0; i < array.Length; i++) { array[i] = col; } Texture2D val = new Texture2D(width, height); val.SetPixels(array); val.Apply(); return val; } } }