The BepInEx console will not appear when launching like it does for other games on Thunderstore (you can turn it back on in your BepInEx.cfg file). If your PEAK crashes on startup, add -dx12 to your launch parameters.
Decompiled source of LHSAtaraxianFork v1.0.3
plugins/com.github.Mankirth.LowHealthJesus.dll
Decompiled 5 days agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; 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; using UnityEngine.Networking; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("com.github.Mankirth.LowHealthJesus")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.1.1.0")] [assembly: AssemblyInformationalVersion("1.1.1")] [assembly: AssemblyProduct("com.github.Mankirth.LowHealthJesus")] [assembly: AssemblyTitle("LowHealthJesus")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.1.1.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 BepInEx { [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] [Conditional("CodeGeneration")] internal sealed class BepInAutoPluginAttribute : Attribute { public BepInAutoPluginAttribute(string? id = null, string? name = null, string? version = null) { } } } namespace BepInEx.Preloader.Core.Patching { [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] [Conditional("CodeGeneration")] internal sealed class PatcherAutoPluginAttribute : Attribute { public PatcherAutoPluginAttribute(string? id = null, string? name = null, string? version = null) { } } } namespace LowHealthJesus { [BepInPlugin("com.github.Mankirth.LowHealthJesus", "LowHealthJesus", "1.1.1")] public class Plugin : BaseUnityPlugin { [HarmonyPatch(typeof(Character), "Update")] private class LowHealthPatch { [HarmonyPostfix] private static void PostFix(Character __instance) { //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Expected O, but got Unknown if (!__instance.IsLocal) { return; } bool flag = __instance.GetMaxStamina() / 1f <= _instance.activationPercentage.Value; if (_instance.activateOnRunOut.Value && __instance.data.isClimbingAnything) { flag = __instance.data.currentStamina / 1f <= _instance.activationPercentage.Value; } if (flag && !_isLowHealth && !__instance.data.dead) { _isLowHealth = true; if ((Object)(object)GUIManager.instance.hudCanvas != (Object)null) { GameObject val = new GameObject("LowHealthAudioPlayer", new Type[1] { typeof(RectTransform) }); val.transform.SetParent(((Component)GUIManager.instance.hudCanvas).transform); val.AddComponent<CanvasRenderer>(); _imageFlasher = val.AddComponent<ImageFlasher>(); ((BaseUnityPlugin)_instance).Logger.LogInfo((object)"Canvas found and image flasher added."); } else { ((BaseUnityPlugin)_instance).Logger.LogInfo((object)"Find is null."); } ((BaseUnityPlugin)_instance).Logger.LogInfo((object)"Started playing Fallen Down music."); } if ((!flag && _isLowHealth) || (__instance.data.dead && _isLowHealth)) { _isLowHealth = false; if ((Object)(object)_imageFlasher != (Object)null) { _imageFlasher.destroy = true; } ((BaseUnityPlugin)_instance).Logger.LogInfo((object)"Stopped playing Fallen Down music. "); } } } public static Plugin? _instance; private static AudioSourcePlayer? _audioPlayer; private static ImageFlasher? _imageFlasher; private static bool _isLowHealth; public ConfigEntry<float> activationCooldown; public ConfigEntry<bool> activateOnRunOut; [Range(0f, 1f)] public ConfigEntry<float> activationPercentage; public const string Id = "com.github.Mankirth.LowHealthJesus"; internal static ManualLogSource Log { get; private set; } public static string PluginFolderPath { get; private set; } public static string Name => "LowHealthJesus"; public static string Version => "1.1.1"; private void Awake() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Expected O, but got Unknown //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Expected O, but got Unknown _instance = this; PluginFolderPath = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location); Harmony val = new Harmony("com.mankuu.lowHealthJesus.harmony"); val.PatchAll(); activationCooldown = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Activation Cooldown", 0f, "The amount of cooldown between image activations (in seconds)"); activationPercentage = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Activation Percentage", 0.25f, "The amount of the full bar your stamina needs to fall under to activate the mod (0-1)"); activateOnRunOut = ((BaseUnityPlugin)this).Config.Bind<bool>("General.Toggle", "Activate On Stamina Run Out", false, "Also activate the mod when your climbing stamina goes below the threshold"); GameObject val2 = new GameObject("LowHealthManager"); Object.DontDestroyOnLoad((Object)(object)val2); _audioPlayer = val2.AddComponent<AudioSourcePlayer>(); val2.AddComponent<ImageLoader>(); Log = ((BaseUnityPlugin)this).Logger; Log.LogInfo((object)("Plugin " + Name + " is loaded!")); } } public class ImageLoader : MonoBehaviour { [CompilerGenerated] private sealed class <LoadImages>d__3 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public ImageLoader <>4__this; private int <i>5__2; private string[] <>7__wrap2; private int <>7__wrap3; private UnityWebRequest <request>5__5; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <LoadImages>d__3(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>7__wrap2 = null; <request>5__5 = null; <>1__state = -2; } private bool MoveNext() { int num = <>1__state; ImageLoader imageLoader = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; <i>5__2 = 1; <>7__wrap2 = Directory.GetFiles(Plugin.PluginFolderPath + "\\LowHealthImages"); <>7__wrap3 = 0; break; case 1: <>1__state = -1; if (<request>5__5.isNetworkError || <request>5__5.isHttpError) { Debug.LogError((object)("UnityWebRequest Error: " + <request>5__5.error)); } else { Texture2D content = DownloadHandlerTexture.GetContent(<request>5__5); if ((Object)(object)content != (Object)null) { imageLoader._images.Add(content); Debug.Log((object)("Successfully loaded Image #" + <i>5__2)); <i>5__2++; } else { Debug.LogError((object)"Failed to load image from request."); } } <request>5__5 = null; <>7__wrap3++; break; } if (<>7__wrap3 < <>7__wrap2.Length) { string text = <>7__wrap2[<>7__wrap3]; string text2 = "file://" + text; Debug.Log((object)("Attempting to load image from: " + text2)); <request>5__5 = UnityWebRequestTexture.GetTexture(text2); <>2__current = <request>5__5.SendWebRequest(); <>1__state = 1; return true; } <>7__wrap2 = null; 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 static ImageLoader _loaderInstance; public List<Texture2D> _images = new List<Texture2D>(); private void Awake() { _loaderInstance = this; ((MonoBehaviour)this).StartCoroutine(LoadImages()); } [IteratorStateMachine(typeof(<LoadImages>d__3))] private IEnumerator LoadImages() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <LoadImages>d__3(0) { <>4__this = this }; } } internal class ImageFlasher : MonoBehaviour { [CompilerGenerated] private sealed class <FadeOut>d__6 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public ImageFlasher <>4__this; private float <i>5__2; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <FadeOut>d__6(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) int num = <>1__state; ImageFlasher imageFlasher = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; ((MonoBehaviour)imageFlasher).StartCoroutine(AudioSourcePlayer._audioInstance.FadeOut()); imageFlasher._image.texture = (Texture)(object)imageFlasher._images[Random.Range(0, imageFlasher._images.Count)]; goto IL_00b6; case 1: <>1__state = -1; goto IL_00b6; case 2: { <>1__state = -1; <i>5__2 += Time.deltaTime; break; } IL_00b6: if (((Graphic)imageFlasher._image).color.a > 0f) { ((Graphic)imageFlasher._image).color = new Color(1f, 1f, 1f, ((Graphic)imageFlasher._image).color.a - Time.deltaTime / imageFlasher.fadeDuration); <>2__current = null; <>1__state = 1; return true; } <i>5__2 = 0f; break; } if (<i>5__2 < Plugin._instance.activationCooldown.Value) { <>2__current = null; <>1__state = 2; return true; } if (imageFlasher.destroy) { Object.Destroy((Object)(object)((Component)imageFlasher).gameObject); } else { ((Graphic)imageFlasher._image).color = new Color(1f, 1f, 1f, 1f); ((MonoBehaviour)imageFlasher).StartCoroutine(imageFlasher.FadeOut()); } 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(); } } private List<Texture2D> _images; private RawImage? _image; private RectTransform? _rect; public float fadeDuration = 1.75f; public bool destroy; private void Awake() { //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0048: 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_006e: 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_0094: Unknown result type (might be due to invalid IL or missing references) _rect = ((Component)this).gameObject.GetComponent<RectTransform>(); _image = ((Component)this).gameObject.AddComponent<RawImage>(); _images = ImageLoader._loaderInstance._images; _rect.anchorMin = Vector2.zero; _rect.anchorMax = Vector2.one; _rect.sizeDelta = Vector2.zero; _rect.anchoredPosition = new Vector2(_rect.sizeDelta.x / 2f, _rect.sizeDelta.y / 2f); ((MonoBehaviour)this).StartCoroutine(FadeOut()); } [IteratorStateMachine(typeof(<FadeOut>d__6))] private IEnumerator FadeOut() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <FadeOut>d__6(0) { <>4__this = this }; } } public class AudioSourcePlayer : MonoBehaviour { [CompilerGenerated] private sealed class <FadeOut>d__6 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public AudioSourcePlayer <>4__this; private float <startVolume>5__2; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <FadeOut>d__6(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { int num = <>1__state; AudioSourcePlayer audioSourcePlayer = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; audioSourcePlayer._audioSource.volume = audioSourcePlayer._originalVolume; audioSourcePlayer._audioSource.Play(); <startVolume>5__2 = audioSourcePlayer._audioSource.volume; break; case 1: <>1__state = -1; break; } if (audioSourcePlayer._audioSource.volume > 0f) { AudioSource audioSource = audioSourcePlayer._audioSource; audioSource.volume -= <startVolume>5__2 * Time.deltaTime / audioSourcePlayer.fadeDuration; <>2__current = null; <>1__state = 1; return true; } 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(); } } [CompilerGenerated] private sealed class <LoadAudio>d__5 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public AudioSourcePlayer <>4__this; private UnityWebRequest <request>5__2; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <LoadAudio>d__5(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <request>5__2 = null; <>1__state = -2; } private bool MoveNext() { int num = <>1__state; AudioSourcePlayer audioSourcePlayer = <>4__this; switch (num) { default: return false; case 0: { <>1__state = -1; string text = Path.Combine(Plugin.PluginFolderPath, "Bell Toll.ogg"); string text2 = "file://" + text; Debug.Log((object)("Attempting to load audio from: " + text2)); <request>5__2 = UnityWebRequestMultimedia.GetAudioClip(text2, (AudioType)14); <>2__current = <request>5__2.SendWebRequest(); <>1__state = 1; return true; } case 1: <>1__state = -1; if (<request>5__2.isNetworkError || <request>5__2.isHttpError) { Debug.LogError((object)("UnityWebRequest Error: " + <request>5__2.error)); } else { AudioClip content = DownloadHandlerAudioClip.GetContent(<request>5__2); if ((Object)(object)content != (Object)null) { audioSourcePlayer._audioSource.clip = content; Debug.Log((object)"Successfully loaded audio clip!"); } else { Debug.LogError((object)"Failed to get AudioClip from request."); } } 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 static AudioSourcePlayer _audioInstance; private AudioSource _audioSource; public float fadeDuration = 1.75f; private float _originalVolume; private void Awake() { _audioInstance = this; _audioSource = ((Component)this).gameObject.AddComponent<AudioSource>(); _audioSource.loop = false; _originalVolume = 1f; _audioSource.volume = _originalVolume; ((MonoBehaviour)this).StartCoroutine(LoadAudio()); } [IteratorStateMachine(typeof(<LoadAudio>d__5))] private IEnumerator LoadAudio() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <LoadAudio>d__5(0) { <>4__this = this }; } [IteratorStateMachine(typeof(<FadeOut>d__6))] public IEnumerator FadeOut() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <FadeOut>d__6(0) { <>4__this = this }; } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }