using System; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Logging; using HarmonyLib; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("Shitty Health")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Shitty Health")] [assembly: AssemblyCopyright("Copyright © 2026")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("8f42c847-0c69-47cd-b8e7-42c6384263d3")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("1.0.0.0")] namespace ShittyHealth; [BepInPlugin("com.2011XPlayz.ShittyHealth", "ShittyHealth", "1.6.3")] public class Plugin : BaseUnityPlugin { internal static ManualLogSource Log; internal static Material Mat; internal static float Intensity; private static int logTimer; private void Awake() { //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Expected O, but got Unknown //IL_00f3: Unknown result type (might be due to invalid IL or missing references) Log = ((BaseUnityPlugin)this).Logger; try { AssetBundle val = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "shittyhealth")); if ((Object)(object)val == (Object)null) { Log.LogError((object)"Bundle failed."); return; } Shader val2 = null; Material val3 = val.LoadAsset("ShittyHealthMat"); if ((Object)(object)val3 != (Object)null) { val2 = val3.shader; } if ((Object)(object)val2 == (Object)null) { val2 = val.LoadAsset("ShittyHealthSelectiveRed"); } if ((Object)(object)val2 == (Object)null) { Log.LogError((object)"No shader in bundle."); return; } Mat = new Material(val2); ((Object)Mat).hideFlags = (HideFlags)61; Mat.SetFloat("_FlipY", 0f); Log.LogInfo((object)("Shader ready: " + ((Object)val2).name)); } catch (Exception ex) { Log.LogError((object)ex.ToString()); return; } new Harmony("com.2011XPlayz.ShittyHealth").PatchAll(); Log.LogInfo((object)"ShittyHealth 1.6.3 ready."); } private static Camera FindOverlayCamera() { Camera[] allCameras = Camera.allCameras; Camera val = null; Camera val2 = null; Camera result = null; float num = float.NegativeInfinity; foreach (Camera val3 in allCameras) { if (!((Object)(object)val3 == (Object)null) && ((Behaviour)val3).enabled) { if (((Object)val3).name == "Virtual Camera") { val = val3; } if (((Object)val3).name == "HUD Camera") { val2 = val3; } if (val3.depth >= num) { num = val3.depth; result = val3; } } } if ((Object)(object)val != (Object)null) { return val; } if ((Object)(object)val2 != (Object)null) { return val2; } return result; } private void Update() { if ((Object)(object)Mat == (Object)null) { return; } NewMovement instance = MonoSingleton.Instance; if ((Object)(object)instance == (Object)null || instance.hp <= 0) { Intensity = 0f; return; } float num = Mathf.Clamp((float)instance.hp, 0f, 100f); if (num >= 100f) { Intensity = 0f; } else { Intensity = Mathf.Clamp01((100f - num) / 80f); } Mat.SetFloat("_Intensity", Intensity); Camera val = FindOverlayCamera(); if (!((Object)(object)val == (Object)null)) { if ((Object)(object)((Component)val).GetComponent() == (Object)null) { ((Component)val).gameObject.AddComponent(); Log.LogInfo((object)("Filter on overlay: " + ((Object)val).name + " depth=" + val.depth)); } logTimer++; if (logTimer % 120 == 0 && Intensity > 0.01f) { Log.LogInfo((object)("HP=" + instance.hp + " intensity=" + Intensity.ToString("0.00"))); } } } } public class SelectiveRedFilter : MonoBehaviour { private bool logged; private void OnRenderImage(RenderTexture src, RenderTexture dest) { if (!logged) { Plugin.Log.LogInfo((object)("OnRenderImage on " + ((Object)this).name)); logged = true; } if ((Object)(object)Plugin.Mat == (Object)null || Plugin.Intensity <= 0.001f) { Graphics.Blit((Texture)(object)src, dest); return; } Plugin.Mat.SetFloat("_Intensity", Plugin.Intensity); Graphics.Blit((Texture)(object)src, dest, Plugin.Mat); } }