The BepInEx console will not appear when launching like it does for other games on Thunderstore. This is normal (and helps prevent crashes during startup). You can turn it back on in your BepInEx.cfg file.
Decompiled source of PeakStats v0.2.0
PeakStats.dll
Decompiled a month agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using DG.Tweening; using DG.Tweening.Core; using DG.Tweening.Plugins.Options; using HarmonyLib; using MonoMod.RuntimeDetour; using PeakStats.MonoBehaviours; using Photon.Pun; using TMPro; using UnityEngine; using UnityEngine.SceneManagement; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = "")] [assembly: AssemblyCompany("PeakStats")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("0.2.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("PeakStats")] [assembly: AssemblyTitle("PeakStats")] [assembly: AssemblyVersion("0.2.0.0")] namespace PeakStats { [BepInPlugin("nickklmao.peakstats", "PeakStats", "0.2.0")] internal sealed class Entry : BaseUnityPlugin { private const string MOD_NAME = "PeakStats"; internal static readonly ManualLogSource logger = Logger.CreateLogSource("PeakStats"); internal static ConfigEntry<bool> displayTimer; internal static ConfigEntry<bool> displayHeight; internal static ConfigEntry<bool> displayTeammateStaminaBars; internal static ConfigEntry<float> teammateStaminaBarProximity; private static void GUIManagerStartHook(Action<GUIManager> orig, GUIManager self) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) orig(self); Scene activeScene = SceneManager.GetActiveScene(); if (!(((Scene)(ref activeScene)).name == "Airport")) { CreateTimerAndHeightStats(); } FixBarGroup(); void CreateTimerAndHeightStats() { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002b: 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_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0044: 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_005c: Unknown result type (might be due to invalid IL or missing references) //IL_005d: 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_0064: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) Transform transform = ((Component)((Component)self).GetComponentInChildren<AscentUI>()).transform; RectTransform val2 = (RectTransform)Object.Instantiate<Transform>(transform, transform.parent); ((Object)val2).name = "Timer & Height UI"; Object.Destroy((Object)(object)((Component)val2).GetComponent<AscentUI>()); ((Component)val2).gameObject.AddComponent<TimerHeightStats>(); Vector2 val3 = default(Vector2); ((Vector2)(ref val3))..ctor(0.5f, 1f); val2.anchorMin = val3; Vector2 pivot = (val2.anchorMax = val3); val2.pivot = pivot; val2.anchoredPosition = Vector2.zero; } void FixBarGroup() { //IL_0015: 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) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0031: 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_0043: Unknown result type (might be due to invalid IL or missing references) RectTransform val = (RectTransform)((Component)self.bar).transform.parent; val.sizeDelta = new Vector2(600f, 600f); Vector2 anchoredPosition = val.anchoredPosition; anchoredPosition.y = 353f; val.anchoredPosition = anchoredPosition; ((HorizontalOrVerticalLayoutGroup)((Component)val).GetComponent<VerticalLayoutGroup>()).spacing = 25f; } } private void Awake() { //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Expected O, but got Unknown //IL_00dd: Unknown result type (might be due to invalid IL or missing references) logger.LogInfo((object)"Creating config entries"); displayTimer = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Display Timer", true, "Displays how long you've been climbing for, at the top of your screen"); displayHeight = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Display Height", true, "Displays how far you've climbed, in meters, at the top of your screen"); displayTeammateStaminaBars = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Display Teammate Stamina Bars", true, "Displays your teammates' stamina bars at the bottom left of your screen"); teammateStaminaBarProximity = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Teammate Stamina Bar Proximity", 10f, new ConfigDescription("How close you need to be to your teammate to see their stamina bar", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 10000f), Array.Empty<object>())); logger.LogMessage((object)"Hooking GUIManager.Start"); new Hook((MethodBase)AccessTools.Method(typeof(GUIManager), "Start", (Type[])null, (Type[])null), (Delegate)new Action<Action<GUIManager>, GUIManager>(GUIManagerStartHook)); PlayerHandler.OnCharacterRegistered = (Action<Character>)Delegate.Combine(PlayerHandler.OnCharacterRegistered, (Action<Character>)delegate(Character character) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) if (((MonoBehaviourPun)character).photonView.IsMine) { Scene activeScene = SceneManager.GetActiveScene(); if (!(((Scene)(ref activeScene)).name == "Airport")) { ((Component)character).gameObject.AddComponent<ProximityStaminaManager>(); } } }); } } } namespace PeakStats.MonoBehaviours { internal sealed class CharacterBarAffliction : MonoBehaviour { internal STATUSTYPE afflictionType; private RectTransform rectTransform; private CharacterStaminaBar characterStaminaBar; private float size; internal void FetchReferences() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown rectTransform = (RectTransform)((Component)this).transform; ((Component)((Component)this).transform.Find("Icon")).gameObject.SetActive(false); characterStaminaBar = ((Component)this).GetComponentInParent<CharacterStaminaBar>(); characterStaminaBar.AddCharacterBarAffliction(this); } internal void FetchDesiredSize() { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) Character val = characterStaminaBar?.observedCharacter; if (!Object.op_Implicit((Object)(object)val)) { return; } float currentStatus = val.refs.afflictions.GetCurrentStatus(afflictionType); size = characterStaminaBar.fullBarRectTransform.sizeDelta.x * currentStatus; if (currentStatus > 0.01f) { if (size < 15f) { size = 15f; } ((Component)this).gameObject.SetActive(true); } else { ((Component)this).gameObject.SetActive(false); } } internal void UpdateVisual() { //IL_000c: 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_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) RectTransform obj = rectTransform; Vector2 sizeDelta = rectTransform.sizeDelta; sizeDelta.x = Mathf.Lerp(rectTransform.sizeDelta.x, size, Mathf.Min(Time.deltaTime * 10f, 0.1f)); obj.sizeDelta = sizeDelta; } } internal sealed class CharacterStaminaBar : MonoBehaviour { private static readonly Color defaultBarColor = new Color(0.1035f, 0.2656f, 0.3019f, 1f); private static readonly Color outOfStaminaColor = new Color(0.566f, 0.0089f, 0.0089f, 1f); internal RectTransform fullBarRectTransform; internal RectTransform staminaBarRectTransform; internal RectTransform maxStaminaBarRectTransform; internal RectTransform staminaBarOutlineRectTransform; internal RectTransform staminaBarOutlineOverflowBar; private readonly List<CharacterBarAffliction> characterBarAfflictions = new List<CharacterBarAffliction>(); private Image barImage; private Image glowImage; private Coroutine animateDisableCoroutine; private Character _observedCharacter; private bool hadObservedCharacter; private bool outOfStamina; internal bool isEnabled; private float sinTime; internal Character observedCharacter { get { return _observedCharacter; } set { if ((Object)(object)value != (Object)null) { hadObservedCharacter = true; } _observedCharacter = value; } } internal void AddCharacterBarAffliction(CharacterBarAffliction characterBarAffliction) { characterBarAfflictions.Add(characterBarAffliction); } internal void AnimateEnable() { if (!isEnabled && animateDisableCoroutine == null) { isEnabled = true; ((Component)this).gameObject.SetActive(true); animateDisableCoroutine = ((MonoBehaviour)this).StartCoroutine(EnableIEnumerator()); } } internal void AnimateDisable() { if (isEnabled && animateDisableCoroutine == null) { isEnabled = false; animateDisableCoroutine = ((MonoBehaviour)this).StartCoroutine(DisableIEnumerator()); } } private void Awake() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Expected O, but got Unknown fullBarRectTransform = (RectTransform)((Component)this).transform.Find("FullBar"); maxStaminaBarRectTransform = (RectTransform)((Component)this).transform.Find("LayoutGroup/MaxStamina"); staminaBarOutlineRectTransform = (RectTransform)((Component)this).transform.Find("OutlineMask/Outline"); staminaBarOutlineOverflowBar = (RectTransform)((Component)this).transform.Find("OutlineOverflowLine"); barImage = ((Component)((Transform)maxStaminaBarRectTransform).Find("Back")).GetComponent<Image>(); staminaBarRectTransform = (RectTransform)((Component)barImage).transform.Find("Stamina"); glowImage = ((Component)((Transform)staminaBarRectTransform).Find("Glow")).GetComponent<Image>(); } private void Update() { //IL_0088: 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) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Unknown result type (might be due to invalid IL or missing references) //IL_0205: Unknown result type (might be due to invalid IL or missing references) //IL_020a: Unknown result type (might be due to invalid IL or missing references) //IL_0227: Unknown result type (might be due to invalid IL or missing references) //IL_025d: Unknown result type (might be due to invalid IL or missing references) //IL_0284: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)observedCharacter) || !((Component)observedCharacter).gameObject.activeSelf) { if (hadObservedCharacter) { Object.Destroy((Object)(object)((Component)this).gameObject); } return; } foreach (CharacterBarAffliction characterBarAffliction in characterBarAfflictions) { characterBarAffliction.FetchDesiredSize(); characterBarAffliction.UpdateVisual(); } float num = Mathf.Max(0f, observedCharacter.data.currentStamina * fullBarRectTransform.sizeDelta.x); if (observedCharacter.data.currentStamina <= 0.005f) { if (!outOfStamina) { outOfStamina = true; OutOfStaminaPulse(); } } else { outOfStamina = false; } float num2 = Time.deltaTime * 10f; RectTransform obj = staminaBarRectTransform; Vector2 sizeDelta = staminaBarRectTransform.sizeDelta; sizeDelta.x = Mathf.Lerp(staminaBarRectTransform.sizeDelta.x, num, num2); obj.sizeDelta = sizeDelta; float num3 = Mathf.Clamp01((staminaBarRectTransform.sizeDelta.x - num) * 0.5f); sinTime += num2 * num3; Image obj2 = glowImage; Color color = ((Graphic)glowImage).color; color.a = num3 * 0.4f - Mathf.Abs(Mathf.Sin(sinTime)) * 0.2f; ((Graphic)obj2).color = color; float x = fullBarRectTransform.sizeDelta.x; float num4 = Mathf.Max(0f, observedCharacter.GetMaxStamina() * x); RectTransform obj3 = maxStaminaBarRectTransform; sizeDelta = maxStaminaBarRectTransform.sizeDelta; sizeDelta.x = Mathf.Lerp(maxStaminaBarRectTransform.sizeDelta.x, num4, num2); obj3.sizeDelta = sizeDelta; float statusSum = observedCharacter.refs.afflictions.statusSum; RectTransform obj4 = staminaBarOutlineRectTransform; sizeDelta = staminaBarOutlineRectTransform.sizeDelta; sizeDelta.x = 14f + Mathf.Max(1f, statusSum) * x; obj4.sizeDelta = sizeDelta; ((Component)staminaBarOutlineOverflowBar).gameObject.SetActive((double)statusSum > 1.005); ((Component)staminaBarRectTransform).gameObject.SetActive(staminaBarRectTransform.sizeDelta.x > 0f); ((Component)maxStaminaBarRectTransform).gameObject.SetActive(maxStaminaBarRectTransform.sizeDelta.x > 0f); if (sinTime > MathF.PI * 2f) { sinTime -= MathF.PI * 2f; } } private void OutOfStaminaPulse() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) ((Graphic)barImage).color = outOfStaminaColor; DOTweenModuleUI.DOColor(barImage, defaultBarColor, 0.5f); } private IEnumerator EnableIEnumerator() { ((Component)this).transform.localScale = Vector3.zero; TweenSettingsExtensions.SetEase<TweenerCore<Vector3, Vector3, VectorOptions>>(ShortcutExtensions.DOScale(((Component)this).transform, 0.72f, 0.5f), (Ease)24); yield return (object)new WaitForSeconds(0.5f); animateDisableCoroutine = null; } private IEnumerator DisableIEnumerator() { ((Component)this).transform.localScale = Vector3.one * 0.72f; TweenSettingsExtensions.SetEase<TweenerCore<Vector3, Vector3, VectorOptions>>(ShortcutExtensions.DOScale(((Component)this).transform, 0f, 0.5f), (Ease)17); yield return (object)new WaitForSeconds(0.5f); ((Component)this).gameObject.SetActive(false); animateDisableCoroutine = null; } } internal sealed class ProximityStaminaManager : MonoBehaviour { private readonly Dictionary<Character, CharacterStaminaBar> staminaBars = new Dictionary<Character, CharacterStaminaBar>(); private static CharacterStaminaBar CreateStaminaBar(Character observedCharacter) { //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: 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_0109: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) Transform transform = ((Component)GUIManager.instance.bar).transform; Transform val = Object.Instantiate<Transform>(transform, transform.parent); val.SetAsFirstSibling(); Object.Destroy((Object)(object)((Component)val).GetComponent<StaminaBar>()); CharacterStaminaBar characterStaminaBar = ((Component)val).gameObject.AddComponent<CharacterStaminaBar>(); characterStaminaBar.observedCharacter = observedCharacter; BarAffliction[] componentsInChildren = ((Component)val).GetComponentsInChildren<BarAffliction>(true); foreach (BarAffliction val2 in componentsInChildren) { CharacterBarAffliction characterBarAffliction = ((Component)val2).gameObject.AddComponent<CharacterBarAffliction>(); characterBarAffliction.afflictionType = val2.afflictionType; characterBarAffliction.FetchReferences(); Object.Destroy((Object)(object)val2); } RectTransform val3 = (RectTransform)Object.Instantiate<Transform>(((Component)((Component)GUIManager.instance).GetComponentInChildren<AscentUI>()).transform, val); AscentUI component = ((Component)val3).GetComponent<AscentUI>(); TextMeshProUGUI text = component.text; Object.Destroy((Object)(object)component); string text2 = (((TMP_Text)text).text = observedCharacter.characterName); ((Object)val3).name = "Label: " + text2; ((TMP_Text)text).textWrappingMode = (TextWrappingModes)0; ((TMP_Text)text).fontSize = 32f; ((TMP_Text)text).autoSizeTextContainer = true; ((Graphic)text).color = observedCharacter.refs.customization.PlayerColor; ((TMP_Text)text).outlineColor = new Color32((byte)0, (byte)0, (byte)0, byte.MaxValue); ((TMP_Text)text).outlineWidth = 0.055f; Vector2 val4 = default(Vector2); ((Vector2)(ref val4))..ctor(0f, 1f); val3.anchorMin = val4; val3.anchorMax = val4; val3.pivot = Vector2.zero; val3.anchoredPosition = Vector2.zero; return characterStaminaBar; } private void Update() { //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)Character.localCharacter) || !Entry.displayTeammateStaminaBars.Value || Object.op_Implicit((Object)(object)MainCameraMovement.specCharacter)) { foreach (KeyValuePair<Character, CharacterStaminaBar> staminaBar in staminaBars) { staminaBar.Value.AnimateDisable(); } return; } foreach (Character allCharacter in Character.AllCharacters) { if (!allCharacter.IsLocal) { if (!staminaBars.TryGetValue(allCharacter, out var value)) { staminaBars.TryAdd(allCharacter, value = CreateStaminaBar(allCharacter)); } if (Vector3.Distance(Character.localCharacter.Center, allCharacter.Center) < Entry.teammateStaminaBarProximity.Value) { value.AnimateEnable(); } else { value.AnimateDisable(); } } } } } internal sealed class TimerHeightStats : MonoBehaviour { private TMP_Text tmpText; private static string GetTimeString(float totalSeconds) { int num = Mathf.FloorToInt(totalSeconds); int num2 = num / 3600; int num3 = num % 3600 / 60; int num4 = num % 60; return $"{num2}:{num3:00}:{num4:00}"; } private void Start() { //IL_0062: Unknown result type (might be due to invalid IL or missing references) tmpText = ((Component)this).GetComponent<TMP_Text>(); tmpText.autoSizeTextContainer = true; tmpText.textWrappingMode = (TextWrappingModes)0; tmpText.alignment = (TextAlignmentOptions)258; tmpText.lineSpacing = -40f; tmpText.fontSize = 28f; tmpText.outlineColor = new Color32((byte)0, (byte)0, (byte)0, byte.MaxValue); tmpText.outlineWidth = 0.055f; } private void Update() { //IL_0041: Unknown result type (might be due to invalid IL or missing references) Character localCharacter = Character.localCharacter; if (Object.op_Implicit((Object)(object)tmpText) && Object.op_Implicit((Object)(object)localCharacter)) { CharacterStats stats = localCharacter.refs.stats; string text = string.Empty; if (Entry.displayTimer.Value) { text = text + GetTimeString(Time.time - stats.GetFirstTimelineInfo().time) + "\n"; } if (Entry.displayHeight.Value) { text += $"{stats.heightInMeters}m"; } tmpText.text = text; } } } }