using System.Collections; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Logging; using HarmonyLib; using PluginConfig.API; using PluginConfig.API.Fields; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("UKMod template")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("UKMod template")] [assembly: AssemblyCopyright("Copyright © 2026")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("3d018c2f-f5bc-47be-a844-3e9888579d1f")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.0.0.0")] namespace DynamicHP; [BepInPlugin("com.nico.dynamichp", "Dynamic HP", "0.1.0")] public class Plugin : BaseUnityPlugin { public const string PluginGuid = "com.nico.dynamichp"; public const string PluginName = "Dynamic HP"; public const string PluginVersion = "0.1.0"; internal static ManualLogSource Log; private PluginConfigurator config; private BoolField enabledField; private IntField fps100Field; private IntField fps0Field; private IntField updateRateField; private int tick; private void Awake() { //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Expected O, but got Unknown //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Expected O, but got Unknown //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Expected O, but got Unknown //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Expected O, but got Unknown //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Expected O, but got Unknown Log = ((BaseUnityPlugin)this).Logger; Log.LogInfo((object)"Dynamic HP loaded!"); config = PluginConfigurator.Create("Dynamic HP", "com.nico.dynamichp"); enabledField = new BoolField(config.rootPanel, "Enabled", "enabled", true); fps100Field = new IntField(config.rootPanel, "FPS for 100 HP", "fps100", 60); fps0Field = new IntField(config.rootPanel, "FPS for 0 HP", "fps0", 30); updateRateField = new IntField(config.rootPanel, "Update Rate", "update_rate", 1); fps100Field.minimumValue = 1; fps0Field.minimumValue = 0; updateRateField.minimumValue = 1; ((MonoBehaviour)this).StartCoroutine(HealthLoop()); Harmony val = new Harmony("com.nico.dynamichp"); val.PatchAll(); } private IEnumerator HealthLoop() { while (true) { tick++; if (tick >= updateRateField.value) { tick = 0; UpdateHealth(); } yield return null; } } private void UpdateHealth() { if (enabledField.value && !((Object)(object)MonoSingleton.Instance == (Object)null)) { float num = 1f / Time.unscaledDeltaTime; NewMovement instance = MonoSingleton.Instance; if (num <= (float)fps0Field.value) { instance.hp = 0; instance.GetHurt(9999, false, 1f, false, false, 0.35f, false); } else { float num2 = Mathf.InverseLerp((float)fps0Field.value, (float)fps100Field.value, num) * 100f; num2 = Mathf.Clamp(num2, 0f, 200f); instance.hp = Mathf.RoundToInt(num2); } } } }