using System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using Microsoft.CodeAnalysis; using TMPro; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("RepoStatsUI")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("RepoStatsUI")] [assembly: AssemblyTitle("RepoStatsUI")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.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.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace RepoStatsUI { [BepInPlugin("com.repo.statsui", "Repo Stats UI", "2.5.9")] public class Plugin : BaseUnityPlugin { public static ConfigEntry StaminaMult; public static ConfigEntry TabPosX; public static ConfigEntry TabPosY; public static ConfigEntry TabFontSize; public static ConfigEntry ShowAll; private void Awake() { //IL_00b3: Unknown result type (might be due to invalid IL or missing references) StaminaMult = ((BaseUnityPlugin)this).Config.Bind("1. Logic", "StaminaMultiplier", 0.1f, "Points-to-seconds multiplier."); TabPosX = ((BaseUnityPlugin)this).Config.Bind("2. TAB Panel", "OffsetX", 40f, "X Offset"); TabPosY = ((BaseUnityPlugin)this).Config.Bind("2. TAB Panel", "OffsetY", 260f, "Y Offset"); TabFontSize = ((BaseUnityPlugin)this).Config.Bind("2. TAB Panel", "FontSize", 18, "Font size"); ShowAll = ((BaseUnityPlugin)this).Config.Bind("2. TAB Panel", "ShowAll", false, "Show all upgrades"); new Harmony("com.repo.statsui").PatchAll(); ((Component)this).gameObject.AddComponent(); } } [HarmonyPatch(typeof(EnergyUI), "Update")] public class EnergyUI_Patch { private static readonly FieldRef TextCurrentRef = AccessTools.FieldRefAccess("Text"); private static readonly FieldRef TextMaxRef = AccessTools.FieldRefAccess("textEnergyMax"); private static readonly FieldRef BasePosRef = AccessTools.FieldRefAccess("maxEnergyBasePosition"); private static void Postfix(EnergyUI __instance) { //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) PlayerController instance = PlayerController.instance; if ((Object)(object)instance == (Object)null) { return; } TextMeshProUGUI val = TextCurrentRef.Invoke(__instance); TextMeshProUGUI val2 = TextMaxRef.Invoke(__instance); if (!((Object)(object)val == (Object)null) && !((Object)(object)val2 == (Object)null)) { float num = instance.EnergySprintDrain + instance.SprintSpeedUpgrades; if (num <= 0f) { num = 1f; } float num2 = Plugin.StaminaMult.Value * 10f; float num3 = instance.EnergyCurrent / num * num2; float num4 = instance.EnergyStart / num * num2; ((TMP_Text)val).text = $"{num3:F1}S"; ((TMP_Text)val2).text = $"/{num4:F1}S"; float num5 = ((TMP_Text)val).preferredWidth - 32f; ((TMP_Text)val2).transform.localPosition = BasePosRef.Invoke(__instance) + new Vector3(num5, 0f, 0f); } } } public class StatsTooltipRenderer : MonoBehaviour { private Camera _cam; private string _cachedInfo; private float _rayTimer; private static readonly FieldRef ItemAttrRef = AccessTools.FieldRefAccess("itemAttributes"); private void Update() { _rayTimer -= Time.deltaTime; if (_rayTimer <= 0f) { _cachedInfo = GetUpgradeInfo(); _rayTimer = 0.1f; } } private void OnGUI() { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0034: 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_0045: Expected O, but got Unknown //IL_0062: Unknown result type (might be due to invalid IL or missing references) if (!string.IsNullOrEmpty(_cachedInfo)) { GUIStyle style = new GUIStyle(GUI.skin.label) { fontSize = 24, fontStyle = (FontStyle)1, alignment = (TextAnchor)4, richText = true }; DrawShadowText(new Rect(0f, (float)(Screen.height - 280), (float)Screen.width, 100f), "+ " + _cachedInfo.ToUpper() + "", style, 2); } if (Input.GetKey((KeyCode)9)) { DrawTabMenu(); } } private void DrawTabMenu() { //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Expected O, but got Unknown //IL_05fb: Unknown result type (might be due to invalid IL or missing references) //IL_0600: Unknown result type (might be due to invalid IL or missing references) //IL_0610: Unknown result type (might be due to invalid IL or missing references) //IL_062a: Unknown result type (might be due to invalid IL or missing references) //IL_0637: Expected O, but got Unknown //IL_0643: Unknown result type (might be due to invalid IL or missing references) //IL_0665: Unknown result type (might be due to invalid IL or missing references) PlayerController instance = PlayerController.instance; StatsManager instance2 = StatsManager.instance; if (!((Object)(object)instance == (Object)null) && !((Object)(object)instance2 == (Object)null)) { string playerSteamID = instance.playerSteamID; float num = Plugin.StaminaMult.Value * 10f; int lvl = GetLvl(instance2.playerUpgradeStamina, playerSteamID); int lvl2 = GetLvl(instance2.playerUpgradeSpeed, playerSteamID); int lvl3 = GetLvl(instance2.playerUpgradeHealth, playerSteamID); int lvl4 = GetLvl(instance2.playerUpgradeTumbleClimb, playerSteamID); int lvl5 = GetLvl(instance2.playerUpgradeStrength, playerSteamID); int lvl6 = GetLvl(instance2.playerUpgradeRange, playerSteamID); int lvl7 = GetLvl(instance2.playerUpgradeThrow, playerSteamID); int lvl8 = GetLvl(instance2.playerUpgradeTumbleWings, playerSteamID); int lvl9 = GetLvl(instance2.playerUpgradeExtraJump, playerSteamID); int lvl10 = GetLvl(instance2.playerUpgradeLaunch, playerSteamID); int lvl11 = GetLvl(instance2.playerUpgradeCrouchRest, playerSteamID); float num2 = instance.EnergyStart - (float)lvl * 10f; float energySprintDrain = instance.EnergySprintDrain; float num3 = energySprintDrain + instance.SprintSpeedUpgrades; float num4 = num2 / energySprintDrain * num; float num5 = instance.EnergyStart / num3 * num; GUIStyle val = new GUIStyle(GUI.skin.label) { fontSize = Plugin.TabFontSize.Value, fontStyle = (FontStyle)1, richText = true, alignment = (TextAnchor)2 }; List list = new List(); string text = ""; string text2 = ""; string text3 = ""; if (Plugin.ShowAll.Value || lvl > 0) { list.Add($"{text}{lvl}{text3} STAMINA {num4:F1}S > {text2}{num5:F1}S{text3}"); } if (Plugin.ShowAll.Value || lvl2 > 0) { list.Add($"{text}{lvl2}{text3} SPRINT SPEED 0.0 > {text2}{instance.SprintSpeedUpgrades:F1}{text3}"); } if (Plugin.ShowAll.Value || lvl3 > 0) { list.Add($"{text}{lvl3}{text3} HEALTH 100 > {text2}{lvl3 * 20 + 100}{text3}"); } if (Plugin.ShowAll.Value || lvl6 > 0) { list.Add($"{text}{lvl6}{text3} RANGE 4M > {text2}{lvl6 + 4}{text3}M"); } if (Plugin.ShowAll.Value || lvl4 > 0) { list.Add($"{text}{lvl4}{text3} CLIMB 8.0S > {text2}{8f / Mathf.Pow(0.95f, (float)lvl4):F1}S{text3}"); } if (Plugin.ShowAll.Value || lvl5 > 0) { list.Add($"{text}{lvl5}{text3} STRENGTH 1.0 > {text2}{(float)lvl5 * 0.2f + 1f:F1}{text3}"); } if (Plugin.ShowAll.Value || lvl7 > 0) { list.Add($"{text}{lvl7}{text3} THROW 0.0 > {text2}{(float)lvl7 * 0.3f:F1}{text3}"); } if (Plugin.ShowAll.Value || lvl10 > 0) { list.Add($"{text}{lvl10}{text3} TUMBLE LAUNCH 0 > {text2}{lvl10}{text3}"); } if (Plugin.ShowAll.Value || lvl8 > 0) { list.Add($"{text}{lvl8}{text3} TUMBLE WINGS 0.0S > {text2}{lvl8:F1}S{text3}"); } if (Plugin.ShowAll.Value || lvl9 > 0) { list.Add($"{text}{lvl9}{text3} EXTRA JUMP 0 > {text2}{lvl9}{text3}"); } if (Plugin.ShowAll.Value || lvl11 > 0) { list.Add($"{text}{lvl11}{text3} CROUCH REST 0 > {text2}{lvl11}{text3}"); } if (list.Count != 0) { float num6 = 400f; float num7 = (float)list.Count * ((float)val.fontSize * 1.5f) + 40f; float num8 = (float)Screen.width - num6 - Plugin.TabPosX.Value; float num9 = (float)Screen.height - num7 - Plugin.TabPosY.Value; GUIStyle val2 = new GUIStyle(val) { fontSize = val.fontSize + 2 }; val2.normal.textColor = new Color(0.65f, 0.65f, 0.65f, 0.9f); GUIStyle style = val2; DrawShadowText(new Rect(num8, num9, num6, 30f), "YOUR STATS", style, 2); DrawShadowText(new Rect(num8, num9 + 35f, num6, num7), string.Join("\n", list), val, 2); } } } private string GetUpgradeInfo() { //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_cam == (Object)null) { _cam = Camera.main; } if ((Object)(object)_cam == (Object)null) { return null; } RaycastHit val = default(RaycastHit); if (Physics.Raycast(_cam.ViewportPointToRay(new Vector3(0.5f, 0.5f, 0f)), ref val, 5f)) { ItemUpgrade componentInParent = ((Component)((RaycastHit)(ref val)).collider).GetComponentInParent(); if ((Object)(object)componentInParent != (Object)null) { ItemAttributes val2 = ItemAttrRef.Invoke(componentInParent); if ((Object)(object)val2?.item != (Object)null) { string text = ((Object)val2.item).name.ToLower(); if (text.Contains("stamina")) { return "10 energy points"; } if (text.Contains("speed")) { return "1.0 speed (drain up)"; } if (text.Contains("climb")) { return "climb duration"; } if (text.Contains("strength")) { return "0.2 strength"; } if (text.Contains("range")) { return "1m range"; } if (text.Contains("throw")) { return "0.3 throw force"; } if (text.Contains("health")) { return "20 health"; } if (text.Contains("wings")) { return "1s flight time"; } } } } return null; } private int GetLvl(Dictionary dict, string id) { int value; return (dict != null && id != null && dict.TryGetValue(id, out value)) ? value : 0; } private void DrawShadowText(Rect rect, string text, GUIStyle style, int offset) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0027: 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_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) Color textColor = style.normal.textColor; style.normal.textColor = new Color(0f, 0f, 0f, 1f); GUI.Label(new Rect(((Rect)(ref rect)).x + (float)offset, ((Rect)(ref rect)).y + (float)offset, ((Rect)(ref rect)).width, ((Rect)(ref rect)).height), text, style); style.normal.textColor = textColor; GUI.Label(rect, text, style); } } }