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 System.Text.RegularExpressions; 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("2.7.0.0")] [assembly: AssemblyInformationalVersion("2.7.0")] [assembly: AssemblyProduct("RepoStatsUI")] [assembly: AssemblyTitle("RepoStatsUI")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("2.7.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.9.3")] public class Plugin : BaseUnityPlugin { public static ConfigEntry StaminaMult; public static ConfigEntry ClimbMult; public static ConfigEntry TabPosX; public static ConfigEntry TabPosY; public static ConfigEntry TabFontSize; public static ConfigEntry ShowAll; public static ConfigEntry ShowUpgrades; public static ConfigEntry ShowMapProgress; public static ConfigEntry AccentColor; private void Awake() { //IL_013b: 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."); ClimbMult = ((BaseUnityPlugin)this).Config.Bind("1. Logic", "ClimbSecondsPerLevel", 2f, "Seconds of climbing per level."); TabPosX = ((BaseUnityPlugin)this).Config.Bind("2. TAB Panel", "OffsetX", 40f, "Horizontal offset."); TabPosY = ((BaseUnityPlugin)this).Config.Bind("2. TAB Panel", "OffsetY", 260f, "Vertical offset."); TabFontSize = ((BaseUnityPlugin)this).Config.Bind("2. TAB Panel", "FontSize", 18, "Font size."); ShowAll = ((BaseUnityPlugin)this).Config.Bind("2. TAB Panel", "ShowAll", false, "Show stats even if level is 0."); ShowUpgrades = ((BaseUnityPlugin)this).Config.Bind("2. TAB Panel", "ShowUpgrades", true, "Show upgrades list."); ShowMapProgress = ((BaseUnityPlugin)this).Config.Bind("2. TAB Panel", "ShowMapProgress", true, "Show map haul progress."); AccentColor = ((BaseUnityPlugin)this).Config.Bind("3. Visuals", "AccentColor", "#8DFF8D", "Accent color (HEX)."); new Harmony("com.repo.statsui").PatchAll(); ((Component)this).gameObject.AddComponent(); } } [HarmonyPatch(typeof(ItemInfoUI), "ItemInfoText")] public class ItemInfoUI_StorePatch { private static void Prefix(ItemAttributes _itemAttributes, ref string message) { if (!((Object)(object)_itemAttributes == (Object)null) && (string.IsNullOrEmpty(message) || message == "prev")) { PlayerController instance = PlayerController.instance; float num = Plugin.StaminaMult.Value * 10f; float num2 = (((Object)(object)instance != (Object)null) ? (instance.EnergySprintDrain + instance.SprintSpeedUpgrades) : 1.1f); if (Object.op_Implicit((Object)(object)((Component)_itemAttributes).GetComponent())) { message = $"+ {10f / num2 * num:F1}S SPRINT DURATION"; } else if (Object.op_Implicit((Object)(object)((Component)_itemAttributes).GetComponent())) { message = "+ 20 MAX HEALTH"; } else if (Object.op_Implicit((Object)(object)((Component)_itemAttributes).GetComponent())) { message = $"+ {Plugin.ClimbMult.Value:F1}S CLIMB DURATION"; } else if (Object.op_Implicit((Object)(object)((Component)_itemAttributes).GetComponent())) { message = "+ 0.2 GRAB STRENGTH"; } else if (Object.op_Implicit((Object)(object)((Component)_itemAttributes).GetComponent())) { message = "+ 1.0M GRAB RANGE"; } else if (Object.op_Implicit((Object)(object)((Component)_itemAttributes).GetComponent())) { message = "+ 1.0S FLIGHT TIME"; } } } } [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_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) PlayerController instance = PlayerController.instance; if (!((Object)(object)instance == (Object)null)) { float num = instance.EnergySprintDrain + instance.SprintSpeedUpgrades; if (num <= 0f) { num = 1f; } float num2 = Plugin.StaminaMult.Value * 10f; ((TMP_Text)TextCurrentRef.Invoke(__instance)).text = $"{instance.EnergyCurrent / num * num2:F1}S"; ((TMP_Text)TextMaxRef.Invoke(__instance)).text = $"/{instance.EnergyStart / num * num2:F1}S"; float num3 = ((TMP_Text)TextCurrentRef.Invoke(__instance)).preferredWidth - 32f; ((TMP_Text)TextMaxRef.Invoke(__instance)).transform.localPosition = BasePosRef.Invoke(__instance) + new Vector3(num3, 0f, 0f); } } } public class StatsTooltipRenderer : MonoBehaviour { private Camera _cam; private string _cachedInfo; private float _rayTimer; private float _mapTimer; private int _cachedTotalMap; private int _cachedHaul; private int _cachedInCarts; private int _cachedRemaining; private int _cachedQuota; private bool _isDragging = false; private void Update() { _rayTimer -= Time.deltaTime; if (_rayTimer <= 0f) { _cachedInfo = GetUpgradeInfo(); _rayTimer = 0.1f; } } private void OnGUI() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Invalid comparison between Unknown and I4 //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Invalid comparison between Unknown and I4 //IL_0045: 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_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Invalid comparison between Unknown and I4 //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0103: 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_0115: Expected O, but got Unknown //IL_0132: Unknown result type (might be due to invalid IL or missing references) if ((int)Event.current.type == 3 && Event.current.button == 0 && Input.GetKey((KeyCode)308) && Input.GetKey((KeyCode)9)) { ConfigEntry tabPosX = Plugin.TabPosX; tabPosX.Value -= Event.current.delta.x; ConfigEntry tabPosY = Plugin.TabPosY; tabPosY.Value -= Event.current.delta.y; _isDragging = true; } else if ((int)Event.current.rawType == 1 && _isDragging) { _isDragging = false; ((ConfigEntryBase)Plugin.TabPosX).ConfigFile.Save(); } if ((int)Event.current.type == 7) { 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_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_0091: 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_00a3: Expected O, but got Unknown //IL_05cb: Unknown result type (might be due to invalid IL or missing references) //IL_05d7: Unknown result type (might be due to invalid IL or missing references) //IL_05dc: Unknown result type (might be due to invalid IL or missing references) //IL_05f6: Unknown result type (might be due to invalid IL or missing references) //IL_0607: Expected O, but got Unknown //IL_062f: Unknown result type (might be due to invalid IL or missing references) //IL_068b: Unknown result type (might be due to invalid IL or missing references) //IL_0697: Unknown result type (might be due to invalid IL or missing references) //IL_069c: Unknown result type (might be due to invalid IL or missing references) //IL_06b6: Unknown result type (might be due to invalid IL or missing references) //IL_06c7: Expected O, but got Unknown //IL_06ef: Unknown result type (might be due to invalid IL or missing references) PlayerController instance = PlayerController.instance; StatsManager instance2 = StatsManager.instance; RoundDirector instance3 = RoundDirector.instance; ValuableDirector instance4 = ValuableDirector.instance; if ((Object)(object)instance == (Object)null || (Object)(object)instance2 == (Object)null || (Object)(object)instance3 == (Object)null) { return; } string playerSteamID = instance.playerSteamID; float num = Plugin.StaminaMult.Value * 10f; float num2 = instance.EnergySprintDrain + instance.SprintSpeedUpgrades; GUIStyle val = new GUIStyle(GUI.skin.label) { fontSize = Plugin.TabFontSize.Value, fontStyle = (FontStyle)1, richText = true, alignment = (TextAnchor)2 }; string text = ""; string text2 = ""; List list = new List(); if (Plugin.ShowUpgrades.Value) { int lvl = GetLvl(instance2.playerUpgradeStamina, playerSteamID); int lvl2 = GetLvl(instance2.playerUpgradeHealth, playerSteamID); int lvl3 = GetLvl(instance2.playerUpgradeTumbleClimb, playerSteamID); int lvl4 = GetLvl(instance2.playerUpgradeRange, playerSteamID); int lvl5 = GetLvl(instance2.playerUpgradeStrength, playerSteamID); if (Plugin.ShowAll.Value || lvl > 0) { list.Add($"STAMINA {text}{instance.EnergyStart / num2 * num:F1}S{text2}"); } if (Plugin.ShowAll.Value || lvl2 > 0) { list.Add($"HEALTH {text}{100 + lvl2 * 20}{text2}"); } if (Plugin.ShowAll.Value || lvl5 > 0) { list.Add($"STRENGTH {text}{1f + (float)lvl5 * 0.2f:F1}X{text2}"); } if (Plugin.ShowAll.Value || lvl4 > 0) { list.Add($"GRAB RANGE {text}{4f + (float)lvl4:F1}M{text2}"); } if (Plugin.ShowAll.Value || lvl3 > 0) { list.Add($"CLIMB {text}{(float)lvl3 * Plugin.ClimbMult.Value:F1}S{text2}"); } } List list2 = new List(); if (Plugin.ShowMapProgress.Value) { _mapTimer -= Time.deltaTime; if (_mapTimer <= 0f) { _mapTimer = 1f; int num3 = 0; int num4 = 0; if ((Object)(object)instance4 != (Object)null && instance4.valuableList != null) { for (int num5 = instance4.valuableList.Count - 1; num5 >= 0; num5--) { ValuableObject val2 = instance4.valuableList[num5]; if (!((Object)(object)val2 == (Object)null)) { int num6 = (int)val2.dollarValueCurrent; num3 += num6; if ((Object)(object)val2.physGrabObject != (Object)null && (Object)(object)val2.physGrabObject.impactDetector != (Object)null && val2.physGrabObject.impactDetector.inCart && (Object)(object)val2.roomVolumeCheck != (Object)null && !val2.roomVolumeCheck.inExtractionPoint) { num4 += num6; } } } } ItemValuableBox[] array = Object.FindObjectsOfType(); foreach (ItemValuableBox val3 in array) { num3 += (int)val3.CurrentValue; PhysGrabObject component = ((Component)val3).GetComponent(); if ((Object)(object)component != (Object)null && (Object)(object)component.impactDetector != (Object)null && component.impactDetector.inCart) { num4 += (int)val3.CurrentValue; } } _cachedTotalMap = num3; _cachedHaul = instance3.currentHaul; _cachedQuota = instance3.haulGoal; _cachedInCarts = num4; _cachedRemaining = _cachedTotalMap - _cachedHaul - _cachedInCarts; } list2.Add("TOTAL VALUE " + text + "$" + SemiFunc.DollarGetString(_cachedTotalMap) + text2); list2.Add("HAUL " + text + "$" + SemiFunc.DollarGetString(_cachedHaul) + text2); list2.Add("IN CARTS $" + SemiFunc.DollarGetString(_cachedInCarts) + ""); list2.Add("ON GROUND $" + SemiFunc.DollarGetString(_cachedRemaining) + ""); list2.Add("GOAL (HUD) $" + SemiFunc.DollarGetString(_cachedQuota) + ""); } float num7 = 400f; float num8 = (float)(list.Count + list2.Count + 2) * ((float)val.fontSize * 1.5f) + 60f; float num9 = (float)Screen.width - num7 - Plugin.TabPosX.Value; float num10 = (float)Screen.height - num8 - Plugin.TabPosY.Value; float num11 = num10; if (list.Count > 0) { Rect rect = new Rect(num9, num11, num7, 30f); GUIStyle val4 = new GUIStyle(val); val4.normal.textColor = new Color(0.5f, 0.5f, 0.5f, 0.8f); DrawShadowText(rect, "YOUR STATS", val4, 1); num11 += 30f; DrawShadowText(new Rect(num9, num11, num7, (float)(list.Count * val.fontSize) * 1.5f), string.Join("\n", list), val, 1); num11 += (float)(list.Count * val.fontSize) * 1.5f + 10f; } if (list2.Count > 0) { Rect rect2 = new Rect(num9, num11, num7, 30f); GUIStyle val5 = new GUIStyle(val); val5.normal.textColor = new Color(0.5f, 0.5f, 0.5f, 0.8f); DrawShadowText(rect2, "MAP PROGRESS", val5, 1); num11 += 30f; DrawShadowText(new Rect(num9, num11, num7, (float)(list2.Count * val.fontSize) * 1.5f), string.Join("\n", list2), val, 1); } } 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) { PlayerController instance = PlayerController.instance; float num = Plugin.StaminaMult.Value * 10f; float num2 = (((Object)(object)instance != (Object)null) ? (instance.EnergySprintDrain + instance.SprintSpeedUpgrades) : 1.1f); if (Object.op_Implicit((Object)(object)((Component)componentInParent).GetComponent())) { return $"{10f / num2 * num:F1}S SPRINT DURATION"; } if (Object.op_Implicit((Object)(object)((Component)componentInParent).GetComponent())) { return $"{Plugin.ClimbMult.Value:F1}S CLIMB DURATION"; } if (Object.op_Implicit((Object)(object)((Component)componentInParent).GetComponent())) { return "20 MAX HEALTH"; } if (Object.op_Implicit((Object)(object)((Component)componentInParent).GetComponent())) { return "0.2 GRAB STRENGTH"; } if (Object.op_Implicit((Object)(object)((Component)componentInParent).GetComponent())) { return "1.0M GRAB RANGE"; } } } 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_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0067: 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_0081: Unknown result type (might be due to invalid IL or missing references) string text2 = Regex.Replace(text, "<.*?>", string.Empty); 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), text2, style); style.normal.textColor = textColor; GUI.Label(rect, text, style); } } }