using System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; 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.azen.dangerCursor")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("0.1.0.0")] [assembly: AssemblyInformationalVersion("0.1.0")] [assembly: AssemblyProduct("com.azen.dangerCursor")] [assembly: AssemblyTitle("DangerCursor")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.1.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 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 DangerCursor { [BepInPlugin("com.azen.dangerCursor", "DangerCursor", "0.1.0")] public class Plugin : BaseUnityPlugin { private static float _injury; private static float _healthAvailable; private static float _fallDist; private static bool _isActive; private static Color _cachedColor; private static string _cachedLabelText = string.Empty; private static GUIContent _guiContent; private static GUIStyle _labelStyle; private static Camera _cachedCam; private static LayerMask _physMask; private static Texture2D _pixel; private static int _warmupFrames = 10; public const string Id = "com.azen.dangerCursor"; public static string Name => "DangerCursor"; public static string Version => "0.1.0"; private void Awake() { //IL_0005: 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_001b: Expected O, but got Unknown //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Expected O, but got Unknown //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Expected O, but got Unknown //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) new Harmony("com.azen.dangerCursor").PatchAll(); _pixel = new Texture2D(1, 1); _pixel.SetPixel(0, 0, Color.white); _pixel.Apply(); _guiContent = new GUIContent(); _labelStyle = new GUIStyle(); _labelStyle.fontSize = 14; _labelStyle.fontStyle = (FontStyle)1; _labelStyle.alignment = (TextAnchor)3; _labelStyle.richText = false; _labelStyle.normal.textColor = Color.white; _physMask = LayerMask.op_Implicit(LayerMask.GetMask(new string[4] { "Terrain", "Map", "Default", "Rope" })); } private void Start() { _cachedCam = HelperFunctions.GetMainCamera(); } private void OnGUI() { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_008e: 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_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) if (_warmupFrames > 0) { _warmupFrames--; _labelStyle.normal.textColor = Color.clear; GUI.Label(new Rect(-1000f, -1000f, 10f, 10f), "WARMUP_RESOURCES_INIT", _labelStyle); } else if (_isActive && !string.IsNullOrEmpty(_cachedLabelText)) { Character localCharacter = Character.localCharacter; if (Object.op_Implicit((Object)(object)localCharacter) && !localCharacter.data.dead && !localCharacter.data.fullyPassedOut) { float x = Input.mousePosition.x; float num = (float)Screen.height - Input.mousePosition.y; _labelStyle.normal.textColor = _cachedColor; _guiContent.text = _cachedLabelText; GUI.Label(new Rect(x + 22f, num - 10f, 400f, 25f), _guiContent, _labelStyle); } } } public static void Tick() { //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_038f: Unknown result type (might be due to invalid IL or missing references) //IL_0394: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_022f: Unknown result type (might be due to invalid IL or missing references) //IL_0234: Unknown result type (might be due to invalid IL or missing references) //IL_02f3: Unknown result type (might be due to invalid IL or missing references) //IL_02f8: Unknown result type (might be due to invalid IL or missing references) //IL_0366: Unknown result type (might be due to invalid IL or missing references) //IL_036b: Unknown result type (might be due to invalid IL or missing references) //IL_033d: Unknown result type (might be due to invalid IL or missing references) //IL_0342: Unknown result type (might be due to invalid IL or missing references) Character localCharacter = Character.localCharacter; if (!Object.op_Implicit((Object)(object)localCharacter)) { _isActive = false; _cachedCam = null; return; } if ((Object)(object)_cachedCam == (Object)null) { _cachedCam = HelperFunctions.GetMainCamera(); if ((Object)(object)_cachedCam == (Object)null) { return; } } _isActive = !localCharacter.data.dead && !localCharacter.data.fullyPassedOut && Input.GetMouseButton(1); if (!_isActive) { _injury = 0f; return; } _healthAvailable = Mathf.Max(0.001f, 1f - localCharacter.refs.afflictions.statusSum); if (localCharacter.data.isInvincible) { _injury = 0f; _cachedColor = Color.cyan; _cachedLabelText = "INVINCIBLE (MILK/SHIELD)"; return; } Vector3 position = ((Component)_cachedCam).transform.position; Vector3 forward = ((Component)_cachedCam).transform.forward; RaycastHit val = default(RaycastHit); if (Physics.Raycast(position, forward, ref val, 1000f, LayerMask.op_Implicit(_physMask), (QueryTriggerInteraction)1)) { float num = ((Component)localCharacter.refs.hip).transform.position.y - 0.85f; float num2 = (_fallDist = num - ((RaycastHit)(ref val)).point.y); float balloonFloatMultiplier = localCharacter.refs.movement.balloonFloatMultiplier; if (balloonFloatMultiplier <= 0f) { _cachedColor = Color.white; _cachedLabelText = "FLOATING (BALLOONS)"; _injury = 0f; return; } float num3 = 13f * balloonFloatMultiplier; float num4 = Mathf.Sqrt(2f * Mathf.Max(0f, num2) / num3); if (localCharacter.data.sinceGrounded - localCharacter.data.sinceJump > -0.05f) { num4 -= 0.5f; } int currentBalloonCount = localCharacter.refs.balloons.currentBalloonCount; if (currentBalloonCount > 0) { float num5 = Mathf.Clamp(2f - 0.2f * (float)currentBalloonCount, 0.5f, 2f); num4 = Mathf.Min(num4, num5); } if (num4 < 1.48f || num2 < 1.8f) { _injury = 0f; _cachedColor = Color.white; _cachedLabelText = string.Empty; return; } float num6 = Mathf.Pow(Mathf.InverseLerp(1.5f, 3f, num4), 1.5f); float num7 = Mathf.Sqrt(2f * (20f * balloonFloatMultiplier) * num2); float num8 = Mathf.Pow(Mathf.InverseLerp(10f, 20f, num7), 1.5f); _injury = Mathf.Min(num6, num8); _injury *= Ascents.fallDamageMultiplier; _injury /= Ascents.etcDamageMultiplier; if (localCharacter.data.isSkeleton) { _injury *= 8f; } if (_injury >= _healthAvailable * 0.95f) { _cachedColor = Color.red; _cachedLabelText = _fallDist.ToString("F1") + "m ! FATAL"; } else if (_injury >= _healthAvailable * 0.45f) { _cachedColor = new Color(1f, 0.5f, 0f); _cachedLabelText = _fallDist.ToString("F1") + "m ! DANGER"; } else { _cachedColor = Color.yellow; _cachedLabelText = _fallDist.ToString("F1") + "m ! INJURY"; } } else { _cachedColor = Color.white; _cachedLabelText = string.Empty; _injury = 0f; } } public static Color GetCurrentColor() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) if (!_isActive) { return new Color(1f, 1f, 1f, 0.5f); } return _cachedColor; } } [HarmonyPatch(typeof(Character), "Update")] public static class CharacterUpdatePatch { [HarmonyPostfix] public static void Postfix(Character __instance) { if ((Object)(object)__instance == (Object)(object)Character.localCharacter) { Plugin.Tick(); } } } [HarmonyPatch(typeof(GUIManager), "UpdateReticle")] public static class UpdateReticlePatch { [HarmonyPostfix] public static void Postfix(GUIManager __instance) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: 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_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0062: 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_007a: 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_0092: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) Color currentColor = Plugin.GetCurrentColor(); if ((Object)(object)__instance.reticleDefaultImage != (Object)null) { ((Graphic)__instance.reticleDefaultImage).color = currentColor; } TryUpdateColor(__instance.reticleClimb, currentColor); TryUpdateColor(__instance.reticleReach, currentColor); TryUpdateColor(__instance.reticleClimbTry, currentColor); TryUpdateColor(__instance.reticleRope, currentColor); TryUpdateColor(__instance.reticleVine, currentColor); TryUpdateColor(__instance.reticleGrasp, currentColor); TryUpdateColor(__instance.reticleSpike, currentColor); TryUpdateColor(__instance.reticleShoot, currentColor); TryUpdateColor(__instance.reticleKick, currentColor); TryUpdateColor(__instance.reticleBoost, currentColor); } private static void TryUpdateColor(GameObject go, Color c) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)go != (Object)null && go.activeSelf) { Image val = go.GetComponent() ?? go.GetComponentInChildren(); if (Object.op_Implicit((Object)(object)val)) { ((Graphic)val).color = c; } } } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }