Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of HUD UI REPO WORLD v1.0.0
HudUiRepoWorld.dll
Decompiled 2 hours ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using Photon.Pun; using Photon.Realtime; using TMPro; using UnityEngine; using UnityEngine.Localization; using UnityEngine.Localization.Settings; using UnityEngine.SceneManagement; 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("Rehaan")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("HUD_UI_REPO_WORLD")] [assembly: AssemblyTitle("HudUiRepoWorld")] [assembly: AssemblyMetadata("AI_Assisted_Creation", "This assembly was partially or fully created with the assistance of Generative AI.")] [assembly: AssemblyMetadata("AI_Model_Vendor", "Anthropic (Claude)")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [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 HudWorld { internal static class GameHud { public static readonly Color Value = new Color(0.7882f, 0.9137f, 0.902f, 1f); public static readonly Color Label = new Color(0.7882f, 0.9137f, 0.902f, 0.86f); private static Material _greenGlow; private static Material _crispGreen; public static GameObject Root => GameObject.Find("Game Hud"); public static TMP_Text HaulText { get { GameObject val = GameObject.Find("Tax Haul"); if (!((Object)(object)val != (Object)null)) { return null; } return val.GetComponent<TMP_Text>(); } } public static Material GreenGlow => _greenGlow; public static string Hex(Color c) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) return ColorUtility.ToHtmlStringRGBA(c); } public static string Pair(string label, string value) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) return "<size=76%><color=#" + Hex(Label) + ">" + label.ToUpperInvariant() + "</color></size> <color=#" + Hex(Value) + ">" + value + "</color>"; } public static Material Shadowed(Material from, float dilate, float softness) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: 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_002a: Expected O, but got Unknown //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Expected O, but got Unknown //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Expected O, but got Unknown //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Expected O, but got Unknown //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Expected O, but got Unknown //IL_0063: Expected O, but got Unknown Material val = new Material(from); SetColor(val, ShaderUtilities.ID_UnderlayColor, new Color(0f, 0f, 0f, 0.72f)); SetFloat(val, ShaderUtilities.ID_UnderlayOffsetX, 0f); SetFloat(val, ShaderUtilities.ID_UnderlayOffsetY, -0.18f); SetFloat(val, ShaderUtilities.ID_UnderlayDilate, dilate); SetFloat(val, ShaderUtilities.ID_UnderlaySoftness, softness); return val; } public static Material Plain(Material from) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_000d: Expected O, but got Unknown Material val = new Material(from); MakePlain(val); return val; } public static void MakePlain(Material m) { //IL_0046: 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) SetFloat(m, ShaderUtilities.ID_UnderlayDilate, 0f); SetFloat(m, ShaderUtilities.ID_UnderlaySoftness, 0f); SetFloat(m, ShaderUtilities.ID_UnderlayOffsetX, 0f); SetFloat(m, ShaderUtilities.ID_UnderlayOffsetY, 0f); SetColor(m, ShaderUtilities.ID_UnderlayColor, Color.clear); SetFloat(m, ShaderUtilities.ID_GlowPower, 0f); SetFloat(m, ShaderUtilities.ID_OutlineWidth, 0f); SetFloat(m, ShaderUtilities.ID_OutlineSoftness, 0f); SetColor(m, ShaderUtilities.ID_OutlineColor, Color.clear); SetFloat(m, ShaderUtilities.ID_BevelAmount, 0f); m.DisableKeyword("OUTLINE_ON"); m.DisableKeyword("BEVEL_ON"); m.DisableKeyword("UNDERLAY_ON"); } public static Material GreenGlowForClock(Material from) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)from != (Object)null) { _greenGlow = new Material(from); SetColor(_greenGlow, ShaderUtilities.ID_UnderlayColor, new Color(0f, 0.35f, 0.08f, 0.72f)); SetFloat(_greenGlow, ShaderUtilities.ID_UnderlayDilate, 0.24f); SetFloat(_greenGlow, ShaderUtilities.ID_UnderlaySoftness, 0.18f); SetColor(_greenGlow, ShaderUtilities.ID_GlowColor, new Color(0f, 1f, 0.2f, 0.5f)); SetFloat(_greenGlow, ShaderUtilities.ID_GlowPower, 0.35f); } return _greenGlow; } public static Material CrispGreen(Material from) { //IL_003a: 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) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Expected O, but got Unknown //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Expected O, but got Unknown //IL_0060: 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_0084: Expected O, but got Unknown //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Expected O, but got Unknown //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Expected O, but got Unknown //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Expected O, but got Unknown //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Expected O, but got Unknown //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Expected O, but got Unknown //IL_00cb: Expected O, but got Unknown if ((Object)(object)from == (Object)null) { return _crispGreen; } if ((Object)(object)_crispGreen != (Object)null && (Object)(object)_crispGreen.mainTexture == (Object)(object)from.mainTexture) { return _crispGreen; } Material val = new Material(from) { name = "HudUiRepoWorld_ClassicListMaterial" }; MakePlain(val); SetFloat(val, ShaderUtilities.ID_FaceDilate, 0.08f); SetColor(val, ShaderUtilities.ID_UnderlayColor, new Color(0f, 0.08f, 0.02f, 0.9f)); SetFloat(val, ShaderUtilities.ID_UnderlayOffsetX, 0.08f); SetFloat(val, ShaderUtilities.ID_UnderlayOffsetY, -0.12f); SetFloat(val, ShaderUtilities.ID_UnderlayDilate, 0.1f); SetFloat(val, ShaderUtilities.ID_UnderlaySoftness, 0f); _crispGreen = val; return val; } public static void DropGreenGlow() { if ((Object)(object)_greenGlow != (Object)null) { Object.Destroy((Object)(object)_greenGlow); } _greenGlow = null; } public static void SetFloat(Material m, int id, float v) { if (m.HasProperty(id)) { m.SetFloat(id, v); } } public static void SetColor(Material m, int id, Color c) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) if (m.HasProperty(id)) { m.SetColor(id, c); } } } [BepInPlugin("Rehaan.HudUiRepoWorld", "HUD UI REPO WORLD", "1.0.0")] public sealed class HudWorldPlugin : BaseUnityPlugin { public const string Guid = "Rehaan.HudUiRepoWorld"; public const string Name = "HUD UI REPO WORLD"; public const string Version = "1.0.0"; internal static ManualLogSource Log; internal static Settings Options; internal static HudWorldPlugin Self; private Harmony _hud; private float _sinceRefresh; private bool _errorLogged; private bool _listMapUp; private static string _cutFrom; private static string _cutText; private void Awake() { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Expected O, but got Unknown //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Expected O, but got Unknown //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Expected O, but got Unknown ((Component)this).transform.parent = null; ((Object)((Component)this).gameObject).hideFlags = (HideFlags)61; Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject); Self = this; Log = ((BaseUnityPlugin)this).Logger; Application.logMessageReceived += new LogCallback(OnLogLine); Options = new Settings(((BaseUnityPlugin)this).Config, "HUD UI REPO WORLD", "1.0.0"); Hooks.Install(); NameMute.Install(); Options.UpgradeStyle.SettingChanged += delegate { Upgrades.Reapply(); }; Options.Enabled.SettingChanged += delegate { Upgrades.Reapply(); }; Options.UpgradeDebugBox.SettingChanged += delegate { Upgrades.DebugBox(Options); }; _hud = new Harmony("Rehaan.HudUiRepoWorld.hud"); MethodInfo methodInfo = AccessTools.Method(typeof(RoundDirector), "Update", (Type[])null, (Type[])null); if (methodInfo != null) { _hud.Patch((MethodBase)methodInfo, (HarmonyMethod)null, new HarmonyMethod(typeof(HudWorldPlugin), "AfterRoundUpdate", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } Upgrades.Install(_hud); ((Component)this).gameObject.AddComponent<SettingsPanel>(); Log.LogInfo((object)("HUD UI REPO WORLD 1.0.0 loaded. Settings panel: " + ((object)Options.PanelKey.Value/*cast due to .constrained prefix*/).ToString() + ".")); } private static void AfterRoundUpdate() { SilverHud.Tick(Options); } private void OnLogLine(string text, string stack, LogType type) { Session.ReadLogLine(text); } private void Update() { try { Frame(); } catch (Exception ex) { ResetShown(); if (!_errorLogged) { _errorLogged = true; Log.LogWarning((object)("HUD UI REPO WORLD update skipped after an error: " + ex.GetType().Name + ": " + ex.Message)); } } } private void Frame() { Settings options = Options; bool live = Session.Live; if (!options.Enabled.Value || !live) { if (Session.WasLive) { Session.WasLive = false; Money.Reset(); ResetShown(); } return; } Session.WasLive = true; Upgrades.Tick(options, null); Clock.Tick(options); _sinceRefresh += Time.deltaTime; Carts.Tick(Markers.CartsWanted(options), options); Vehicles.Tick(Markers.RidesWanted(options), options); bool flag = options.InfoOn.Value && options.Style.Value == HudStyle.RepoClassic; bool flag2 = flag && Session.MapUp; bool flag3 = flag2 != _listMapUp; _listMapUp = flag2; if (_sinceRefresh >= options.RefreshSeconds) { _sinceRefresh = 0f; InfoText.Rebuild(options); if (flag) { TextList.Refresh(options, ListText(flag2), InfoText.Text); } } else if (flag && flag3) { TextList.Refresh(options, ListText(flag2), InfoText.Text); } TextList.Show(flag && !string.IsNullOrWhiteSpace(ListText(flag2))); } private static string ListText(bool mapUp) { string text = InfoText.Text ?? string.Empty; int monsterLines = InfoText.MonsterLines; if (mapUp || monsterLines <= 0 || text.Length == 0) { return text; } if ((object)text == _cutFrom) { return _cutText; } string[] array = text.Split('\n'); int i; for (i = Mathf.Min(monsterLines, array.Length); i < array.Length && string.IsNullOrWhiteSpace(array[i]); i++) { } _cutFrom = text; _cutText = ((i >= array.Length) ? string.Empty : string.Join("\n", array, i, array.Length - i)); return _cutText; } private static void ResetShown() { InfoText.Clear(); Monsters.Forget(); Players.ForgetShown(); Registry.ForgetPrizeVerdicts(); Registry.AllowSweeps(); Carts.Forget(); Carts.Stale(); Vehicles.Stale(); Clock.Drop(); TextList.Show(on: false); } private void OnGUI() { if (Options != null) { Markers.Draw(Options); } } private void OnDestroy() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown Application.logMessageReceived -= new LogCallback(OnLogLine); if ((Object)(object)Self == (Object)(object)this) { Self = null; } Ledger.Forget(); Hooks.Uninstall(); NameMute.Uninstall(); Harmony hud = _hud; if (hud != null) { hud.UnpatchSelf(); } Registry.InHaul.Clear(); TextList.Destroy(); BasicLook.Destroy(); Upgrades.DropCanvas(); } } internal static class Session { private const float GraceSeconds = 4f; private static int _checkedFrame = -1; private static bool _inRun; private static bool _logSaysRun; private static bool _wasLive; private static float _lastSeenRun = -100f; public static int LevelNumber { get { try { return SemiFunc.RunGetLevelsCompleted() + 1; } catch { return 0; } } } public static bool InRun { get { int frameCount = Time.frameCount; if (frameCount != _checkedFrame) { _checkedFrame = frameCount; _inRun = Decide(); } return _inRun; } } public static bool Live { get { if (InRun) { _lastSeenRun = Time.unscaledTime; return true; } if (_wasLive) { return Time.unscaledTime - _lastSeenRun <= 4f; } return false; } } public static bool WasLive { get { return _wasLive; } set { _wasLive = value; } } public static bool SafeInRun { get { try { return InRun; } catch { return false; } } } public static bool MapUp { get { bool flag = false; MapToolController instance = MapToolController.instance; if ((Object)(object)instance != (Object)null) { flag = instance.mapToggled || instance.Active; } return SemiFunc.InputHold((InputKey)8) || flag; } } public static void ReadLogLine(string text) { if (string.IsNullOrEmpty(text)) { return; } string[] array = new string[2] { "Changed level to:", "updated level to:" }; foreach (string text2 in array) { int num = text.IndexOf(text2, StringComparison.OrdinalIgnoreCase); if (num >= 0) { _logSaysRun = PlayableName(text.Substring(num + text2.Length).Trim()); break; } } } private static bool Decide() { if (Try(() => SemiFunc.RunIsShop())) { return true; } Level val = (((Object)(object)RunManager.instance != (Object)null) ? RunManager.instance.levelCurrent : null); if ((Object)(object)val != (Object)null && (MenuName(((Object)val).name) || MenuName(val.NarrativeName))) { return false; } if (Try(delegate { //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) Scene activeScene = SceneManager.GetActiveScene(); return MenuName(((Scene)(ref activeScene)).name); })) { return false; } if ((Object)(object)GameDirector.instance != (Object)null) { return true; } if (Try(() => SemiFunc.RunIsLevel())) { return true; } if (_logSaysRun) { return true; } if ((Object)(object)val != (Object)null) { if (!PlayableName(((Object)val).name)) { return PlayableName(val.NarrativeName); } return true; } return false; } private static bool Try(Func<bool> check) { try { return check(); } catch { return false; } } private static bool MenuName(string name) { if (!string.IsNullOrWhiteSpace(name)) { if (!Has(name, "Menu")) { return Has(name, "Splash"); } return true; } return false; } private static bool PlayableName(string name) { if (string.IsNullOrWhiteSpace(name) || MenuName(name)) { return false; } if (!Has(name, "Level") && !Has(name, "Shop") && !Has(name, "Lobby") && !Has(name, "Rest")) { return Has(name, "Truck"); } return true; } private static bool Has(string text, string part) { return text.IndexOf(part, StringComparison.OrdinalIgnoreCase) >= 0; } } public enum HudStyle { Silver, RepoClassic, Basic } public enum UpgradeListStyle { Silver, RepoClassic, Native } public enum ClockStyle { Silver, RepoClassic, Basic } internal sealed class Settings { private const string HideFromModsMenu = "HideFromREPOConfig"; public ConfigEntry<HudStyle> Style; public ConfigEntry<UpgradeListStyle> UpgradeStyle; public ConfigEntry<bool> UpgradeDebugBox; public ConfigEntry<string> CompactShows; public ConfigEntry<bool> Enabled; public ConfigEntry<bool> ClockOn; public ConfigEntry<ClockStyle> ClockLook; public ConfigEntry<int> ClockSize; public ConfigEntry<int> ClockX; public ConfigEntry<int> ClockY; public ConfigEntry<bool> MatesOn; public ConfigEntry<bool> MatesDead; public ConfigEntry<bool> MatesDeadEdge; public ConfigEntry<bool> MatesAlive; public ConfigEntry<bool> MatesAliveEdge; public ConfigEntry<bool> MatesMeters; public ConfigEntry<int> MatesSize; public ConfigEntry<bool> CartsOn; public ConfigEntry<bool> CartsSmall; public ConfigEntry<bool> CartsBig; public ConfigEntry<bool> CartsMeters; public ConfigEntry<int> CartsSize; public ConfigEntry<bool> RidesOn; public ConfigEntry<bool> RidesKart; public ConfigEntry<bool> RidesCargo; public ConfigEntry<bool> RidesMeters; public ConfigEntry<int> RidesSize; public ConfigEntry<bool> TruckOn; public ConfigEntry<bool> TruckNearEnd; public ConfigEntry<bool> TruckAlways; public ConfigEntry<bool> InfoOn; public ConfigEntry<bool> InfoGaps; public ConfigEntry<int> InfoSize; public ConfigEntry<int> InfoOpacity; public ConfigEntry<float> InfoRefresh; public ConfigEntry<int> InfoX; public ConfigEntry<int> InfoY; public ConfigEntry<bool> MonstersOn; public ConfigEntry<bool> MonstersPerType; public ConfigEntry<bool> MonstersTotal; public ConfigEntry<bool> MonstersOnTop; public ConfigEntry<bool> ValuesOn; public ConfigEntry<bool> CosmeticBoxes; public ConfigEntry<bool> KartCount; public ConfigEntry<bool> CargoCount; public ConfigEntry<bool> SmallCartCount; public ConfigEntry<bool> BigCartCount; public ConfigEntry<bool> Progress; public ConfigEntry<bool> MapLeft; public ConfigEntry<bool> LevelLine; public ConfigEntry<bool> ListOn; public ConfigEntry<bool> ListDead; public ConfigEntry<bool> ListAlive; public ConfigEntry<bool> ListCounts; public ConfigEntry<KeyCode> PanelKey; public ConfigEntry<float> PanelScale; public ConfigEntry<float> PanelOpacity; public ConfigEntry<float> PanelX; public ConfigEntry<float> PanelY; public ConfigEntry<string> PanelTab; private ConfigEntry<string> _keyInfo; private readonly ConfigFile _file; public bool CompactShowsRemaining { get { if (CompactShows != null) { return CompactShows.Value == "Remaining"; } return true; } } public float RefreshSeconds { get { float num = ((InfoRefresh == null) ? 1.5f : InfoRefresh.Value); if (!float.IsNaN(num) && !float.IsInfinity(num)) { return Mathf.Max(0.1f, num); } return 0.1f; } } public float Opacity01 => (float)((InfoOpacity == null) ? 100 : Mathf.Clamp(InfoOpacity.Value, 1, 100)) / 100f; public bool CartLabelsWanted { get { if (CartsOn.Value) { if (!CartsBig.Value) { return CartsSmall.Value; } return true; } return false; } } public bool RideLabelsWanted { get { if (RidesOn.Value) { if (!RidesCargo.Value) { return RidesKart.Value; } return true; } return false; } } public Settings(ConfigFile file, string modName, string version) { //IL_0932: Unknown result type (might be due to invalid IL or missing references) //IL_093c: Expected O, but got Unknown _file = file; Style = Make("0. Master Mode", "Display Mode", "Bottom-right uses Silver style by default. Can switch to REPO Classic or Basic style.", HudStyle.Silver, null, 952, CycleDrawer<HudStyle>()); UpgradeStyle = Make("0. Master Mode", "Upgrade UI Mode", "Choose Upgrade UI: Silver (modern panel), REPO Classic (REPO green CRT style), or Native (original UI).", UpgradeListStyle.Silver, null, 951, CycleDrawer<UpgradeListStyle>()); UpgradeDebugBox = Make("0. Master Mode", "Debug Upgrade Background", "Show a red background around the Silver upgrades UI overlay.", defaultValue: false, null, 950); Info("Mod Name", modName, "Name of this mod."); Info("Mod Version", version, "Installed version of this mod."); Enabled = Make("B.Global", "Mod Enabled", "Disable to turn off all features (HUD, teammate/cart distance, monster stats, value tracking, all Harmony patches).", defaultValue: true, null, 990); ClockOn = Make("B.Global", "Timer Enabled", "Toggle level timer on or off. Starts when loading finishes & character control is gained; stops when level ends; resets each level.", defaultValue: true, null, 989); ClockLook = Make("B.Global", "Timer Style Mode", "Select timer style mode: Silver (CRT style), REPO Classic (REPO green), Basic (Flat white).", ClockStyle.Silver, null, 988); ClockSize = Make("B.Global", "Timer Font Size", "Font size of the level timer text.", 24, (AcceptableValueBase)(object)new AcceptableValueRange<int>(12, 48), 987); ClockX = Make("B.Global", "Timer Offset X (px)", "Horizontal offset of the level timer. Positive moves right, negative moves left.", 0, (AcceptableValueBase)(object)new AcceptableValueRange<int>(-1000, 1000), 986); ClockY = Make("B.Global", "Timer Offset Y (px)", "Vertical offset of the level timer. Positive moves up, negative moves down.", 0, (AcceptableValueBase)(object)new AcceptableValueRange<int>(-1000, 1000), 985); MatesOn = Make("C.Teammate Display", "Enabled", "Always show teammate names, distance and death status. Disable to fall back to the game's proximity-based name display.", defaultValue: true, null, 600); MatesDead = Make("C.Teammate Display", "Show Dead Teammates", "Show name and distance for dead teammates in the world.", defaultValue: true, null, 599); MatesDeadEdge = Make("C.Teammate Display", "Dead Teammate Edge Hint", "Show name and distance on left/right screen edges when a dead teammate is off-screen.", defaultValue: true, null, 598); MatesAlive = Make("C.Teammate Display", "Show Alive Teammates", "Show name and distance for alive teammates in the world.", defaultValue: true, null, 597); MatesAliveEdge = Make("C.Teammate Display", "Alive Teammate Edge Hint", "Show name and distance on left/right screen edges when an alive teammate is off-screen.", defaultValue: false, null, 596); MatesMeters = Make("C.Teammate Display", "Show Distance Meters", "Append distance in meters after teammate world labels and edge hints. Off by default.", defaultValue: false, null, 595); MatesSize = Make("C.Teammate Display", "Font Size", "Font size of teammate names. The game's native default is around 20; this value overrides it.", 22, (AcceptableValueBase)(object)new AcceptableValueRange<int>(10, 60), 590); CartsOn = Make("D1.Cart Display", "Enabled", "Disable to hide all cart world labels.", defaultValue: true, null, 530); CartsSmall = Make("D1.Cart Display", "Show Cart Small", "Show index and distance on small carts.", defaultValue: true, null, 520); CartsBig = Make("D1.Cart Display", "Show Cart Standard", "Show index and distance on large carts.", defaultValue: true, null, 518); CartsMeters = Make("D1.Cart Display", "Show Distance Meters", "Append distance in meters after cart labels. Off by default.", defaultValue: false, null, 517); CartsSize = Make("D1.Cart Display", "Font Size", "Font size of cart labels. Used as the near-distance maximum; far-distance labels shrink by a percentage.", 20, (AcceptableValueBase)(object)new AcceptableValueRange<int>(10, 36), 515); RidesOn = Make("D2.Vehicle Display", "Enabled", "Disable to hide all vehicle world labels.", defaultValue: true, null, 510); RidesKart = Make("D2.Vehicle Display", "Show Racing Vehicle", "Show label and distance on racing vehicles.", defaultValue: true, null, 508); RidesCargo = Make("D2.Vehicle Display", "Show Cargo Vehicle", "Show label and distance on cargo vehicles.", defaultValue: true, null, 506); RidesMeters = Make("D2.Vehicle Display", "Show Distance Meters", "Append distance in meters after vehicle labels. Off by default.", defaultValue: false, null, 504); RidesSize = Make("D2.Vehicle Display", "Font Size", "Font size of vehicle labels.", 20, (AcceptableValueBase)(object)new AcceptableValueRange<int>(10, 36), 502); TruckOn = Make("E. Truck Display", "Enabled", "Show truck location in the world.", defaultValue: true, null, 495); TruckNearEnd = Make("E. Truck Display", "Only Before Clear", "Only show truck location when remaining extraction points <= 1.", defaultValue: true, null, 490); TruckAlways = Make("E. Truck Display", "Show Always", "Show truck location throughout the entire round.", defaultValue: false, null, 485); InfoOn = Make("F1.Panel Basics", "Enabled", "Show extra info in the bottom-right corner.", defaultValue: true, null, 960); InfoGaps = Make("F1.Panel Basics", "Section Spacing", "Default on. Inserts a blank line between different info sections.", defaultValue: true, null, 955); InfoSize = Make("F1.Panel Basics", "Font Size", "Display font size.", 22, (AcceptableValueBase)(object)new AcceptableValueRange<int>(10, 28), 950); InfoOpacity = Make("F1.Panel Basics", "Text Opacity %", "Controls overall opacity of both text mode and native UI mode. Default 70.", 70, (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 100), 949); InfoRefresh = Make("F1.Panel Basics", "Refresh Interval (s)", "How many seconds between display refreshes.", 3f, (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 10f), 940); InfoX = Make("F1.Panel Basics", "Offset X (px)", "Horizontal offset of the bottom-right info. Positive moves left, negative moves right.", 0, (AcceptableValueBase)(object)new AcceptableValueRange<int>(-600, 600), 930); InfoY = Make("F1.Panel Basics", "Offset Y (px)", "Vertical offset of the bottom-right info. Positive moves up, negative moves down.", 0, (AcceptableValueBase)(object)new AcceptableValueRange<int>(-600, 600), 920); MonstersOn = Make("F2.Monster Stats", "Enabled", "Disable to hide the monster stats section.", defaultValue: true, null, 800); MonstersPerType = Make("F2.Monster Stats", "Show Breakdown", "Show count per monster type.", defaultValue: true, null, 790); MonstersTotal = Make("F2.Monster Stats", "Show Total", "Show total alive monster count.", defaultValue: true, null, 780); MonstersOnTop = Make("F2.Monster Stats", "Map Panel Monsters On Top", "Silver style, map open: show the monster list at the top right, above the game's haul and extraction counters, and the other info below them. Off = one list.", defaultValue: true, null, 775); ValuesOn = Make("F3.Value Stats", "Enabled", "Disable to hide the value stats section.", defaultValue: true, null, 770); CosmeticBoxes = Make("F3.Value Stats", "Show Cosmetic Boxes", "Show the number of cosmetic boxes (token machines, coin chests, etc.) in the current level.", defaultValue: true, null, 769); KartCount = Make("F3.Value Stats", "Show Kart Count", "Show kart (racing vehicle) count for the current level in the bottom-right.", defaultValue: false, null, 768); CargoCount = Make("F3.Value Stats", "Show Cargo Count", "Show cargo vehicle count for the current level in the bottom-right.", defaultValue: false, null, 767); SmallCartCount = Make("F3.Value Stats", "Show Cart Small Count", "Show small cart count for the current level in the bottom-right.", defaultValue: false, null, 766); BigCartCount = Make("F3.Value Stats", "Show Cart Standard Count", "Show large cart count for the current level in the bottom-right.", defaultValue: false, null, 765); Progress = Make("F3.Value Stats", "Show Extraction Progress", "Shows extraction progress as a percent of the map's initial total value. Items in extraction points or carts count as collected.", defaultValue: true, null, 760); MapLeft = Make("F3.Value Stats", "Show Map Remaining", "Shows remaining map value. Items already in extraction points are excluded; carts and uncollected items still count.", defaultValue: true, null, 740); LevelLine = Make("F3.Value Stats", "Show Level", "Show current level number and name, below shop stock.", defaultValue: true, null, 710); ListOn = Make("F4.Teammate Info", "Enabled", "Disable to hide the bottom-right teammate info section.", defaultValue: true, null, 670); ListDead = Make("F4.Teammate Info", "Show Dead Teammates Info", "Show dead teammate icon, name and distance at the top of the section. Closer teammates appear higher.", defaultValue: true, null, 660); ListAlive = Make("F4.Teammate Info", "Show Alive Teammates Info", "Show name and distance of each alive teammate. Closer teammates appear higher.", defaultValue: true, null, 650); ListCounts = Make("F4.Teammate Info", "Show Player Counts", "Show dead / alive / total player counts at the bottom of the teammate section.", defaultValue: true, null, 640); PanelKey = Hidden<KeyCode>("Panel Key", (KeyCode)283, "Key that opens / closes the HUD UI REPO WORLD settings panel (anywhere: main menu, lobby, shop, level).", null); PanelScale = Hidden("Panel Scale", 1f, "Size of the settings panel (text and controls).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.75f, 2f)); PanelOpacity = Hidden("Panel Opacity", 0.96f, "Background opacity of the settings panel.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.4f, 1f)); PanelX = Hidden("Panel X", 60f, "Last position of the panel (left).", null); PanelY = Hidden("Panel Y", 60f, "Last position of the panel (top).", null); PanelTab = Hidden("Panel Tab", "Modes", "Last page that was open in the panel.", null); _keyInfo = Info("Settings Panel", KeyLine(), "Key that opens the in-game settings panel."); PanelKey.SettingChanged += delegate { _keyInfo.Value = KeyLine(); }; bool saveOnConfigSet = file.SaveOnConfigSet; file.SaveOnConfigSet = false; CompactShows = file.Bind<string>("0. Master Mode", "Closed Map Display", "Remaining", new ConfigDescription("Choose which value the closed-map (compact) HUD shows.", (AcceptableValueBase)(object)new AcceptableValueList<string>(new string[2] { "Map", "Remaining" }), Array.Empty<object>())); file.Save(); file.SaveOnConfigSet = saveOnConfigSet; } private string KeyLine() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //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) if ((int)PanelKey.Value != 0) { return "Press " + ((object)PanelKey.Value/*cast due to .constrained prefix*/).ToString() + " anywhere"; } return "No key set (see the .cfg file)"; } private ConfigEntry<T> Make<T>(string section, string key, string description, T defaultValue, AcceptableValueBase range, int order, Action<ConfigEntryBase> drawer = null) { //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Expected O, but got Unknown ConfigurationManagerAttributes configurationManagerAttributes = new ConfigurationManagerAttributes { Category = section, DispName = key, Description = description, Order = order }; if (drawer != null) { configurationManagerAttributes.CustomDrawer = drawer; } return _file.Bind<T>(section, key, defaultValue, new ConfigDescription(description, range, new object[1] { configurationManagerAttributes })); } private ConfigEntry<T> Hidden<T>(string key, T defaultValue, string description, AcceptableValueBase range) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Expected O, but got Unknown return _file.Bind<T>("Z.Settings Panel", key, defaultValue, new ConfigDescription(description, range, new object[1] { "HideFromREPOConfig" })); } private ConfigEntry<string> Info(string key, string value, string description) { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Expected O, but got Unknown ConfigurationManagerAttributes configurationManagerAttributes = new ConfigurationManagerAttributes { ReadOnly = true, Category = "A.Mod Info", DispName = key, Description = description }; ConfigEntry<string> val = _file.Bind<string>("A.Mod Info", key, value, new ConfigDescription(description, (AcceptableValueBase)null, new object[1] { configurationManagerAttributes })); if (val.Value != value) { val.Value = value; } return val; } private static Action<ConfigEntryBase> CycleDrawer<T>() where T : struct, Enum { return delegate(ConfigEntryBase entry) { if (entry is ConfigEntry<T> val) { T[] array = (T[])Enum.GetValues(typeof(T)); int num = Array.IndexOf(array, val.Value); GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); GUILayout.Label(entry.Definition.Key, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) }); if (GUILayout.Button(val.Value.ToString(), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(140f) })) { val.Value = array[(num + 1) % array.Length]; } GUILayout.EndHorizontal(); } }; } } internal sealed class ConfigurationManagerAttributes { public bool? ShowRangeAsPercent; public Action<ConfigEntryBase> CustomDrawer; public bool? Browsable; public string Category; public object DefaultValue; public bool? HideDefaultButton; public bool? HideSettingName; public string Description; public string DispName; public int? Order; public bool? ReadOnly; public bool? IsAdvanced; public Func<object, string> ObjToStr; public Func<string, object> StrToObj; } internal static class BasicLook { private const string Resource = "HudUiRepoWorld.Resources.NotoSansBold.ttf"; private const string TempName = "HudUiRepoWorld_NotoSansBold.ttf"; private static bool _tried; private static Font _font; private static TMP_FontAsset _tmpFont; private static Canvas _canvas; public static Font Font { get { Load(); return _font; } } public static TMP_FontAsset TmpFont { get { Load(); return _tmpFont; } } public static Canvas Canvas { get { //IL_002b: 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_0036: Expected O, but got Unknown if ((Object)(object)_canvas != (Object)null) { return _canvas; } GameObject val = new GameObject("HudUiRepoWorld.BasicOverlayCanvas", new Type[1] { typeof(Canvas) }); Object.DontDestroyOnLoad((Object)val); _canvas = val.GetComponent<Canvas>(); _canvas.renderMode = (RenderMode)0; _canvas.sortingOrder = 500; return _canvas; } } [DllImport("gdi32.dll", CharSet = CharSet.Auto, SetLastError = true)] private static extern int AddFontResource(string path); public static void Destroy() { if ((Object)(object)_canvas != (Object)null) { Object.Destroy((Object)(object)((Component)_canvas).gameObject); } _canvas = null; } private static void Load() { //IL_004d: Unknown result type (might be due to invalid IL or missing references) if (_tried) { return; } _tried = true; try { byte[] array = ReadResource(); if (array == null || array.Length == 0) { HudWorldPlugin.Log.LogWarning((object)"HUD UI REPO WORLD: embedded Noto Sans Bold resource missing."); return; } string text = Path.Combine(Path.GetTempPath(), "HudUiRepoWorld_NotoSansBold.ttf"); Font font; bool flag = OpenThroughSystem(array, text, out font); Font val = (Font)(flag ? ((object)font) : ((object)new Font(text))); if ((Object)(object)val == (Object)null) { return; } if (flag) { _font = val; } TMP_FontAsset val2 = TMP_FontAsset.CreateFontAsset(val); if ((Object)(object)val2 != (Object)null) { ((Object)val2).name = "NotoSansBold_BasicAsset"; Material val3 = (((Object)(object)((TMP_Asset)val2).material != (Object)null) ? ((TMP_Asset)val2).material : (((Object)(object)TMP_Settings.defaultFontAsset != (Object)null) ? ((TMP_Asset)TMP_Settings.defaultFontAsset).material : null)); if ((Object)(object)val3 != (Object)null) { ((TMP_Asset)val2).material = GameHud.Plain(val3); } _tmpFont = val2; } if ((Object)(object)_tmpFont == (Object)null) { HudWorldPlugin.Log.LogWarning((object)("HUD UI REPO WORLD: Basic font asset could not be created from embedded Noto Sans Bold (dynamic=" + flag + ").")); } } catch (Exception ex) { HudWorldPlugin.Log.LogWarning((object)("HUD UI REPO WORLD failed to resolve Basic font: " + ex.GetType().Name + ": " + ex.Message)); } } private static byte[] ReadResource() { using Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("HudUiRepoWorld.Resources.NotoSansBold.ttf"); if (stream == null) { return null; } byte[] array = new byte[stream.Length]; int num; for (int i = 0; i < array.Length; i += num) { num = stream.Read(array, i, array.Length - i); if (num <= 0) { break; } } return array; } private static bool OpenThroughSystem(byte[] bytes, string path, out Font font) { font = null; try { bool flag = true; if (File.Exists(path)) { try { flag = new FileInfo(path).Length != bytes.Length; } catch { } } if (flag) { try { File.WriteAllBytes(path, bytes); } catch (IOException) { } } AddFontResource(path); string text = null; try { string[] array = Font.GetOSInstalledFontNames() ?? Array.Empty<string>(); foreach (string text2 in array) { if (!string.IsNullOrEmpty(text2) && text2.IndexOf("noto", StringComparison.OrdinalIgnoreCase) >= 0) { text = text2; break; } } } catch (Exception ex2) { HudWorldPlugin.Log.LogWarning((object)("HUD UI REPO WORLD: failed enumerating OS fonts for basic font: " + ex2.GetType().Name)); } if (string.IsNullOrEmpty(text)) { HudWorldPlugin.Log.LogWarning((object)"HUD UI REPO WORLD: embedded Noto Sans Bold not found in OS font list after registration."); return false; } font = Font.CreateDynamicFontFromOSFont(text, 90); if ((Object)(object)font == (Object)null) { HudWorldPlugin.Log.LogWarning((object)("HUD UI REPO WORLD: CreateDynamicFontFromOSFont returned null for '" + text + "'.")); return false; } ((Object)font).name = "NotoSansBold_Dynamic"; return true; } catch (Exception ex3) { HudWorldPlugin.Log.LogWarning((object)("HUD UI REPO WORLD: failed to resolve dynamic basic font: " + ex3.GetType().Name)); return false; } } } internal static class Clock { private static float _seconds; private static bool _running; private static bool _finished; private static int _level = -1; private static TextMeshProUGUI _hudText; private static TextMeshProUGUI _plainText; private static Material _hudMaterial; public static void Restart(int level) { _seconds = 0f; _running = false; _finished = false; _level = level; } public static void Tick(Settings s) { //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Invalid comparison between Unknown and I4 //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Invalid comparison between Unknown and I4 //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Invalid comparison between Unknown and I4 //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Invalid comparison between Unknown and I4 //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Invalid comparison between Unknown and I4 int levelNumber = Session.LevelNumber; if (levelNumber != _level) { Restart(levelNumber); } if (SemiFunc.RunIsLevel() && (Object)(object)GameDirector.instance != (Object)null) { GameDirector instance = GameDirector.instance; gameState currentState = instance.currentState; if ((int)currentState == 3 || (int)currentState == 4 || (int)currentState == 5 || (int)currentState == 6 || instance.LevelCompleted) { _running = false; _finished = true; } else if (!_finished && !_running && (int)currentState == 2 && !instance.DisableInput && (Object)(object)PlayerAvatar.instance != (Object)null && !PlayerAvatar.instance.isDisabled) { _running = true; } if (_running) { _seconds += Time.deltaTime; } } else { _running = false; } Draw(s); } public static void Drop() { if ((Object)(object)_hudText != (Object)null) { Object.Destroy((Object)(object)((Component)_hudText).gameObject); } _hudText = null; if ((Object)(object)_hudMaterial != (Object)null) { Object.Destroy((Object)(object)_hudMaterial); } _hudMaterial = null; GameHud.DropGreenGlow(); if ((Object)(object)_plainText != (Object)null) { Object.Destroy((Object)(object)((Component)_plainText).gameObject); } _plainText = null; } private static bool Visible(Settings s) { //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Invalid comparison between Unknown and I4 //IL_004e: Unknown result type (might be due to invalid IL or missing references) if (s.ClockOn == null || !s.ClockOn.Value || !SemiFunc.RunIsLevel()) { return false; } if (SemiFunc.RunIsLobbyMenu() || SemiFunc.RunIsLobby() || SemiFunc.IsMainMenu()) { return false; } GameDirector instance = GameDirector.instance; if ((Object)(object)instance != (Object)null && ((int)instance.currentState == 7 || (int)instance.currentState == 0)) { return false; } if ((Object)(object)MenuManager.instance != (Object)null && MenuManager.instance.currentMenuState == 0) { return false; } return !Session.MapUp; } private static void Draw(Settings s) { //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: 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) if (!Visible(s)) { Show(_hudText, on: false); Show(_plainText, on: false); } else { if (!Build()) { return; } string text = Format(_seconds); int num = ((s.ClockSize != null) ? s.ClockSize.Value : 24); float num2 = ((s.ClockX != null) ? ((float)s.ClockX.Value) : 0f); float num3 = ((s.ClockY != null) ? ((float)s.ClockY.Value) : 0f); int num4 = Mathf.RoundToInt((float)num * 1.5f); ClockStyle clockStyle = ((s.ClockLook != null) ? s.ClockLook.Value : ClockStyle.Silver); if (clockStyle == ClockStyle.Basic) { Show(_hudText, on: false); if ((Object)(object)_plainText != (Object)null) { Show(_plainText, on: true); Place(_plainText, new Vector2(-5f + num2, -15f + num3)); ((TMP_Text)_plainText).fontSize = Mathf.Max(6, Mathf.RoundToInt((float)num4 * 0.7225f)); ((Graphic)_plainText).color = Color.white; Write(_plainText, "<color=#FFFFFF>" + text + "</color>"); } return; } Show(_plainText, on: false); if (!((Object)(object)_hudText == (Object)null)) { Show(_hudText, on: true); Material val = ((clockStyle != ClockStyle.RepoClassic) ? _hudMaterial : (((Object)(object)GameHud.GreenGlow != (Object)null) ? GameHud.GreenGlow : _hudMaterial)); if ((Object)(object)val != (Object)null && (Object)(object)((TMP_Text)_hudText).fontSharedMaterial != (Object)(object)val) { ((TMP_Text)_hudText).fontSharedMaterial = val; } Place(_hudText, new Vector2(-5f + num2, 15f + num3)); ((TMP_Text)_hudText).fontSize = Mathf.Max(6, Mathf.RoundToInt((float)num4 / 3f * 1.25f)); Write(_hudText, (clockStyle == ClockStyle.RepoClassic) ? ("<color=#00FF00>" + text + "</color>") : ("<color=#" + GameHud.Hex(GameHud.Value) + ">" + text + "</color>")); } } } private static bool Build() { //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: 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_009b: Expected O, but got Unknown //IL_00b9: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_hudText == (Object)null) { GameObject root = GameHud.Root; TMP_Text haulText = GameHud.HaulText; if ((Object)(object)root != (Object)null && (Object)(object)haulText != (Object)null) { GameObject val = new GameObject("HudUiRepoWorld Timer Text Native", new Type[1] { typeof(RectTransform) }); val.transform.SetParent(root.transform, false); _hudText = val.AddComponent<TextMeshProUGUI>(); ((TMP_Text)_hudText).font = haulText.font; if ((Object)(object)haulText.fontSharedMaterial != (Object)null) { _hudMaterial = new Material(haulText.fontSharedMaterial); GameHud.SetColor(_hudMaterial, ShaderUtilities.ID_UnderlayColor, new Color(0f, 0f, 0f, 0.72f)); GameHud.SetFloat(_hudMaterial, ShaderUtilities.ID_UnderlayDilate, 0.24f); GameHud.SetFloat(_hudMaterial, ShaderUtilities.ID_UnderlaySoftness, 0.18f); GameHud.GreenGlowForClock(haulText.fontSharedMaterial); ((TMP_Text)_hudText).fontSharedMaterial = _hudMaterial; } ((TMP_Text)_hudText).alignment = (TextAlignmentOptions)258; ((Graphic)_hudText).raycastTarget = false; } } if ((Object)(object)_plainText == (Object)null) { Canvas canvas = BasicLook.Canvas; if ((Object)(object)canvas != (Object)null) { GameObject val2 = new GameObject("HudUiRepoWorld Timer Text Basic", new Type[1] { typeof(RectTransform) }); val2.transform.SetParent(((Component)canvas).transform, false); _plainText = val2.AddComponent<TextMeshProUGUI>(); if ((Object)(object)BasicLook.TmpFont != (Object)null) { ((TMP_Text)_plainText).font = BasicLook.TmpFont; } ((TMP_Text)_plainText).alignment = (TextAlignmentOptions)258; ((Graphic)_plainText).raycastTarget = false; } } if (!((Object)(object)_hudText != (Object)null)) { return (Object)(object)_plainText != (Object)null; } return true; } private static void Place(TextMeshProUGUI t, Vector2 at) { //IL_0011: 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_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0046: 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) RectTransform rectTransform = ((TMP_Text)t).rectTransform; rectTransform.anchorMin = new Vector2(0.5f, 1f); rectTransform.anchorMax = new Vector2(0.5f, 1f); rectTransform.pivot = new Vector2(0.5f, 1f); rectTransform.anchoredPosition = at; rectTransform.sizeDelta = new Vector2(400f, 60f); } private static void Show(TextMeshProUGUI t, bool on) { if ((Object)(object)t != (Object)null) { ((Component)t).gameObject.SetActive(on); } } private static void Write(TextMeshProUGUI t, string text) { if (!string.Equals(((TMP_Text)t).text, text, StringComparison.Ordinal)) { ((TMP_Text)t).SetText(text, true); } } public static string Format(float seconds) { TimeSpan timeSpan = TimeSpan.FromSeconds(Mathf.Max(0f, seconds)); if (!(timeSpan.TotalHours >= 1.0)) { return $"{timeSpan.Minutes:D2}:{timeSpan.Seconds:D2}"; } return $"{(int)timeSpan.TotalHours:D2}:{timeSpan.Minutes:D2}:{timeSpan.Seconds:D2}"; } } internal static class InfoText { private static readonly StringBuilder Out = new StringBuilder(1024); private static bool _anySection; private static bool _inSection; public static string Text { get; private set; } = string.Empty; public static int MonsterLines { get; private set; } public static void Clear() { Text = string.Empty; MonsterLines = 0; } public static void Rebuild(Settings s) { bool flag = s.MonstersOn == null || s.MonstersOn.Value; bool num = s.ValuesOn == null || s.ValuesOn.Value; bool flag2 = s.ListOn == null || s.ListOn.Value; bool flag3 = flag && s.MonstersPerType.Value; bool flag4 = flag && s.MonstersTotal.Value; bool flag5 = flag2 && ((s.ListDead != null && s.ListDead.Value) || (s.ListAlive != null && s.ListAlive.Value)); bool flag6 = flag2 && s.ListCounts.Value; Monsters.Survey(flag3 || flag4, flag3); List<Mate> list = (flag5 ? Players.Mates() : null); List<string> list2 = new List<string>(12); if (num) { bool flag7 = s.SmallCartCount != null && s.SmallCartCount.Value; bool flag8 = s.BigCartCount != null && s.BigCartCount.Value; if (flag7 || flag8) { Carts.Count(out var big, out var small); if (flag7) { list2.Add("Small Cart: " + small); } if (flag8) { list2.Add("Cart: " + big); } } bool flag9 = s.KartCount != null && s.KartCount.Value; bool flag10 = s.CargoCount != null && s.CargoCount.Value; if (flag9 || flag10) { Vehicles.Count(out var karts, out var cargo); if (flag9) { list2.Add("Kart: " + karts); } if (flag10) { list2.Add("Cargo: " + cargo); } } if (s.CosmeticBoxes != null && s.CosmeticBoxes.Value) { list2.Add("Cosmetic Boxes: " + Registry.PrizeBoxes); } AddMapValues(s, list2); if (s.LevelLine.Value) { list2.Add(LevelLine()); } } Out.Clear(); _anySection = false; _inSection = false; MonsterLines = (flag3 ? Monsters.Breakdown.Count : 0) + (flag4 ? 1 : 0); if (flag3) { foreach (KeyValuePair<string, int> item in Monsters.Breakdown) { Line(s, item.Key + ": " + item.Value); } } if (flag4) { Line(s, "Enemies: " + Monsters.Total); } _inSection = false; foreach (string item2 in list2) { Line(s, item2); } if (flag5 || flag6) { _inSection = false; if (s.ListDead.Value && list != null) { foreach (Mate item3 in list) { if (item3.Dead) { Line(s, item3.InfoLine); } } } if (s.ListAlive.Value && list != null) { foreach (Mate item4 in list) { if (!item4.Dead) { Line(s, item4.InfoLine); } } } if (s.ListCounts.Value) { Line(s, Players.CountLine()); } } Text = Out.ToString(); } private static void AddMapValues(Settings s, List<string> into) { bool value = s.Progress.Value; bool value2 = s.MapLeft.Value; if (!value && !value2) { return; } List<ValuableObject> live = World.Valuables(); if (!Ledger.Read(live, out var mapValue, out var startValue)) { if (value) { into.Add("Extraction Progress: 0%"); } if (value2) { into.Add("Map Remaining Funds: " + Money.Format(0f)); } return; } Haul.ReadHaulList(); float value3 = (value2 ? Progression.Remaining(live, mapValue) : mapValue); if (value) { Haul.ReadCarts(); into.Add("Extraction Progress: " + Progression.Percent(live, mapValue, startValue, out var _, out var _) + "%"); } if (value2) { into.Add("Map Remaining Funds: " + Money.Format(value3)); } } private static string LevelLine() { string text = "Unknown"; Level val = (((Object)(object)RunManager.instance != (Object)null) ? RunManager.instance.levelCurrent : null); if ((Object)(object)val != (Object)null && !string.IsNullOrWhiteSpace(val.NarrativeName)) { text = val.NarrativeName.Trim(); } return "Level: " + (SemiFunc.RunGetLevelsCompleted() + 1) + " - " + text; } private static void Line(Settings s, string line) { if (string.IsNullOrWhiteSpace(line)) { return; } if (_inSection) { Out.Append('\n'); } else { if (_anySection) { Out.Append('\n'); if (s.InfoGaps.Value) { Out.Append('\n'); } } _anySection = true; _inSection = true; } Out.Append(line); } } internal static class MapPanel { private const float RightInset = 25f; private const float Width = 565f; private const float TopInset = 88f; private const float BottomInset = 48f; private const float CounterGap = 12f; private const float BlockGap = 14f; private const float PlayersGap = 4f; private const float MinRegion = 60f; private const float FontMin = 10f; private const float FontMax = 16f; private const float LineSpacing = -6f; private static GameObject _panel; private static Image _backing; private static TextMeshProUGUI _info; private static TextMeshProUGUI _monsters; private static string _infoShown = string.Empty; private static string _monstersShown = string.Empty; private static bool _bandKnown; private static bool _bandHas; private static bool _candHas; private static float _bandLo; private static float _bandHi; private static float _candLo; private static float _candHi; private static float _candSince = -1f; private static Vector4 _infoRect = new Vector4(float.NaN, 0f, 0f, 0f); private static Vector4 _monstersRect = new Vector4(float.NaN, 0f, 0f, 0f); private static readonly StringBuilder Out = new StringBuilder(1024); private static readonly HashSet<string> TwoColumnNames = new HashSet<string>(StringComparer.OrdinalIgnoreCase); private static readonly List<KeyValuePair<string, string>> Waiting = new List<KeyValuePair<string, string>>(); public static bool Ready { get { if (Object.op_Implicit((Object)(object)_panel) && Object.op_Implicit((Object)(object)_backing) && Object.op_Implicit((Object)(object)_info)) { return Object.op_Implicit((Object)(object)_monsters); } return false; } } public static TextMeshProUGUI InfoLabel => _info; public static void Build(Transform parent, TMP_Text haul) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Expected O, but got Unknown //IL_0054: Unknown result type (might be due to invalid IL or missing references) _panel = new GameObject("Open Map Panel", new Type[2] { typeof(RectTransform), typeof(CanvasRenderer) }); _panel.transform.SetParent(parent, false); _backing = _panel.AddComponent<Image>(); ((Graphic)_backing).color = Color.clear; ((Graphic)_backing).raycastTarget = false; SilverHud.Fill(((Graphic)_backing).rectTransform); _info = NewText("Open Map Text", haul); _monsters = NewText("Open Map Monsters Text", haul); ForgetLayout(); } public static void Show(bool on) { if ((Object)(object)_panel != (Object)null) { _panel.SetActive(on); } } public static void Forget() { _panel = null; _backing = null; _info = null; _monsters = null; ForgetLayout(); } public static void ResetText() { _infoShown = string.Empty; _monstersShown = string.Empty; } public static void Update(Settings s) { if (!Ready) { return; } string[] array = (InfoText.Text ?? string.Empty).Split('\n'); int num = Mathf.Clamp(InfoText.MonsterLines, 0, array.Length); bool flag = s.MonstersOnTop == null || s.MonstersOnTop.Value; TwoColumnNames.Clear(); if (Monsters.Breakdown.Count > 3) { foreach (KeyValuePair<string, int> item in Monsters.Breakdown) { TwoColumnNames.Add(item.Key); } } string monsters = string.Empty; string info; if (flag && num > 0) { monsters = Format(array, 0, num); info = Format(array, num, array.Length); } else { info = Format(array, 0, array.Length); } Layout(s, ref monsters, ref info); if (!string.Equals(_monstersShown, monsters, StringComparison.Ordinal)) { ((TMP_Text)_monsters).SetText(monsters, true); _monstersShown = monsters; } if (!string.Equals(_infoShown, info, StringComparison.Ordinal)) { ((TMP_Text)_info).SetText(info, true); _infoShown = info; } } private static TextMeshProUGUI NewText(string name, TMP_Text haul) { //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0080: 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) TextMeshProUGUI obj = SilverHud.NewText(name, haul, _panel.transform, (TextAlignmentOptions)260, 0.2f, 0.16f); ((TMP_Text)obj).enableAutoSizing = true; ((TMP_Text)obj).fontSizeMin = 10f; ((TMP_Text)obj).fontSizeMax = 16f; ((TMP_Text)obj).fontSize = 16f; ((TMP_Text)obj).overflowMode = (TextOverflowModes)3; ((TMP_Text)obj).lineSpacing = -6f; RectTransform rectTransform = ((TMP_Text)obj).rectTransform; rectTransform.anchorMin = new Vector2(1f, 0f); rectTransform.anchorMax = new Vector2(1f, 0f); rectTransform.pivot = new Vector2(1f, 1f); return obj; } private static void ForgetLayout() { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) _bandKnown = false; _bandHas = false; _candHas = false; _candSince = -1f; _infoRect = new Vector4(float.NaN, 0f, 0f, 0f); _monstersRect = new Vector4(float.NaN, 0f, 0f, 0f); } private static string Format(string[] lines, int from, int to) { //IL_00b4: Unknown result type (might be due to invalid IL or missing references) Out.Clear(); Waiting.Clear(); bool pairing = TwoColumnNames.Count > 3; for (int i = from; i < to; i++) { string text = lines[i]; if (string.IsNullOrWhiteSpace(text)) { Flush(ref pairing); Out.Append('\n'); } else { if (text.IndexOf("PLAYERS", StringComparison.OrdinalIgnoreCase) >= 0 || text.Contains("m</color>") || text.Contains("m</color") || text.Contains("☠")) { continue; } int num = text.IndexOf(':'); if (num < 0) { Flush(ref pairing); Out.Append("<size=76%><color=#").Append(GameHud.Hex(GameHud.Label)).Append('>') .Append(text.Trim().ToUpperInvariant()) .Append("</color></size>\n"); continue; } string text2 = text.Substring(0, num).Trim(); string value = text.Substring(num + 1).Trim(); if (pairing && TwoColumnNames.Contains(text2)) { Waiting.Add(new KeyValuePair<string, string>(text2, value)); continue; } Flush(ref pairing); Out.Append(GameHud.Pair(text2, value)).Append('\n'); } } Flush(ref pairing); return Out.ToString().Trim('\n'); } private static void Flush(ref bool pairing) { if (Waiting.Count == 0) { return; } for (int i = 0; i < Waiting.Count; i += 2) { Out.Append(GameHud.Pair(Waiting[i].Key, Waiting[i].Value)); if (i + 1 < Waiting.Count) { Out.Append(" ").Append(GameHud.Pair(Waiting[i + 1].Key, Waiting[i + 1].Value)); } Out.Append('\n'); } Waiting.Clear(); pairing = false; } private static void Layout(Settings s, ref string monsters, ref string info) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: 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_01ff: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: Unknown result type (might be due to invalid IL or missing references) RectTransform rectTransform = ((Graphic)_backing).rectTransform; Rect rect = rectTransform.rect; float num = ((Rect)(ref rect)).xMax - 25f + (float)s.InfoX.Value; float left = num - 565f; float num2 = ((Rect)(ref rect)).yMax - 88f; float num3 = ((Rect)(ref rect)).yMin + 48f; float num4 = SilverHud.PlayersTopIn(rectTransform); if (!float.IsNaN(num4) && num4 + 4f < num3) { num3 = Mathf.Max(((Rect)(ref rect)).yMin, num4 + 4f); } MeasureCounters(rectTransform, left, num, rect); float num5 = num2; float num6 = num3; float num7 = num2; float num8 = num2; bool flag = monsters.Length > 0; if (_bandHas) { float num9 = Mathf.Min(num2, _bandHi + 12f); float num10 = Mathf.Max(num3, _bandLo - 12f); if (num10 - num3 >= 60f) { num5 = num10; } if (flag && num2 - num9 >= 60f) { num8 = num9; } else if (flag) { float num11 = num5 - num3; float num12 = Needed(_monsters, monsters); float num13 = ((info.Length > 0) ? Needed(_info, info) : 0f); float num14 = ((!(num13 <= 0f) && !(num12 + 14f + num13 <= num11)) ? (Mathf.Max(0f, num11 - 14f) * num12 / (num12 + num13)) : Mathf.Min(num12, num11)); num7 = num5; num8 = num5 - num14; num5 = num8 - 14f; } } else if (flag) { float num15 = Mathf.Clamp(Needed(_monsters, monsters), 60f, (num2 - num3) * 0.5f); num8 = num2 - num15; num5 = num8 - 14f; } ((Component)_monsters).gameObject.SetActive(flag); if (flag) { Put(_monsters, ref _monstersRect, rect, num, num7, num7 - num8); } Put(_info, ref _infoRect, rect, num, num5, num5 - num6); } private static float Needed(TextMeshProUGUI t, string text) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) float num = 0f; try { bool enableAutoSizing = ((TMP_Text)t).enableAutoSizing; ((TMP_Text)t).enableAutoSizing = false; ((TMP_Text)t).fontSize = 16f; num = ((TMP_Text)t).GetPreferredValues(text, 565f, 0f).y + 4f; ((TMP_Text)t).enableAutoSizing = enableAutoSizing; } catch { } if (num <= 8f) { num = (float)text.Split('\n').Length * 20f; } return num; } private static void Put(TextMeshProUGUI t, ref Vector4 last, Rect cr, float right, float top, float height) { //IL_002b: 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_0092: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: 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: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: 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_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) Vector4 val = default(Vector4); ((Vector4)(ref val))..ctor(right - ((Rect)(ref cr)).xMax, top - ((Rect)(ref cr)).yMin, 565f, Mathf.Max(0f, height)); if (!(Mathf.Abs(val.x - last.x) < 0.5f) || !(Mathf.Abs(val.y - last.y) < 0.5f) || !(Mathf.Abs(val.z - last.z) < 0.5f) || !(Mathf.Abs(val.w - last.w) < 0.5f)) { last = val; ((TMP_Text)t).rectTransform.anchoredPosition = new Vector2(val.x, val.y); ((TMP_Text)t).rectTransform.sizeDelta = new Vector2(val.z, val.w); } } private static void MeasureCounters(RectTransform box, float left, float right, Rect cr) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) float lo = float.MaxValue; float hi = float.MinValue; bool flag = Counter((SemiUI)(object)GoalUI.instance, box, left, right, cr, ref lo, ref hi); flag |= Counter((SemiUI)(object)HaulUI.instance, box, left, right, cr, ref lo, ref hi); if (!_bandKnown) { Take(flag, lo, hi); return; } if (Same(flag, lo, hi, _bandHas, _bandLo, _bandHi)) { _candSince = -1f; return; } float unscaledTime = Time.unscaledTime; if (_candSince < 0f || !Same(flag, lo, hi, _candHas, _candLo, _candHi)) { _candHas = flag; _candLo = lo; _candHi = hi; _candSince = unscaledTime; } else if (unscaledTime - _candSince >= 0.2f) { Take(flag, lo, hi); } } private static void Take(bool has, float lo, float hi) { _bandKnown = true; _bandHas = has; _bandLo = lo; _bandHi = hi; _candSince = -1f; } private static bool Same(bool hasA, float loA, float hiA, bool hasB, float loB, float hiB) { if (hasA == hasB) { if (hasA) { if (Mathf.Abs(loA - loB) <= 3f) { return Mathf.Abs(hiA - hiB) <= 3f; } return false; } return true; } return false; } internal static bool Counter(SemiUI ui, RectTransform box, float left, float right, Rect cr, ref float lo, ref float hi) { //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_0069: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: 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_00ef: 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_0135: 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_0155: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_01dc: Unknown result type (might be due to invalid IL or missing references) //IL_01ec: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) try { if ((Object)(object)ui == (Object)null || !((Behaviour)ui).isActiveAndEnabled) { return false; } TextMeshProUGUI uiText = ui.uiText; if ((Object)(object)uiText == (Object)null || !((Behaviour)uiText).enabled || !((Component)uiText).gameObject.activeInHierarchy || ui.hideTimer > 0f || string.IsNullOrEmpty(((TMP_Text)uiText).text)) { return false; } Bounds textBounds = ((TMP_Text)uiText).textBounds; if (((Bounds)(ref textBounds)).size.x <= 0.01f || ((Bounds)(ref textBounds)).size.y <= 0.01f) { return false; } Transform obj = (ui.animateTheEntireObject ? ((Component)ui).transform : (((Object)(object)ui.textRectTransform != (Object)null) ? ui.textRectTransform : ((Component)ui).transform)); Vector3 localPosition = obj.localPosition; Vector2 val = ui.showPosition + ui.scootPositionCurrent; Vector3 val2 = default(Vector3); ((Vector3)(ref val2))..ctor(val.x - localPosition.x, val.y - localPosition.y, 0f); Transform parent = obj.parent; float num = float.MaxValue; float num2 = float.MinValue; float num3 = float.MaxValue; float num4 = float.MinValue; Vector3 val3 = default(Vector3); for (int i = 0; i < 4; i++) { ((Vector3)(ref val3))..ctor(((i & 1) == 0) ? ((Bounds)(ref textBounds)).min.x : ((Bounds)(ref textBounds)).max.x, ((i & 2) == 0) ? ((Bounds)(ref textBounds)).min.y : ((Bounds)(ref textBounds)).max.y, ((Bounds)(ref textBounds)).center.z); Vector3 val4 = ((Transform)((TMP_Text)uiText).rectTransform).TransformPoint(val3); if ((Object)(object)parent != (Object)null) { val4 = parent.TransformPoint(parent.InverseTransformPoint(val4) + val2); } Vector3 val5 = ((Transform)box).InverseTransformPoint(val4); num = Mathf.Min(num, val5.x); num2 = Mathf.Max(num2, val5.x); num3 = Mathf.Min(num3, val5.y); num4 = Mathf.Max(num4, val5.y); } if (num2 < left || num > right || num4 < ((Rect)(ref cr)).yMin || num3 > ((Rect)(ref cr)).yMax) { return false; } lo = Mathf.Min(lo, num3); hi = Mathf.Max(hi, num4); return true; } catch { return false; } } } internal static class Markers { private sealed class EdgeTag { public int Meters; public float WantY; public float W; public float H; public string Plain; public string Rich; public GUIStyle Look; public GUIStyle Shade; } private static readonly Dictionary<int, GUIStyle> Bright = new Dictionary<int, GUIStyle>(); private static readonly Dictionary<int, GUIStyle> Shadow = new Dictionary<int, GUIStyle>(); private static readonly Dictionary<int, GUIStyle> BasicBright = new Dictionary<int, GUIStyle>(); private static readonly Dictionary<int, GUIStyle> BasicShadow = new Dictionary<int, GUIStyle>(); private static readonly Dictionary<(int, string), Vector2> Sizes = new Dictionary<(int, string), Vector2>(); private static readonly GUIContent Words = new GUIContent(); private static readonly List<EdgeTag> LeftEdge = new List<EdgeTag>(); private static readonly List<EdgeTag> RightEdge = new List<EdgeTag>(); public static bool CartsWanted(Settings s) { if (s.Enabled.Value && s.CartLabelsWanted) { return Session.Live; } return false; } public static bool RidesWanted(Settings s) { if (s.Enabled.Value && s.RideLabelsWanted) { return Session.Live; } return false; } private static bool MatesWanted(Settings s) { if (s.Enabled.Value && Session.Live && s.MatesOn.Value) { if (!s.MatesDead.Value) { return s.MatesAlive.Value; } return true; } return false; } private static bool TruckWanted(Settings s) { //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) if (!s.Enabled.Value || !Session.Live || !SemiFunc.RunIsLevel() || World.Truck == Vector3.zero || !s.TruckOn.Value) { return false; } int extractionsLeft = World.ExtractionsLeft; if (!s.TruckAlways.Value) { if (s.TruckNearEnd.Value) { return extractionsLeft <= 1; } return false; } return true; } public static void Draw(Settings s) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Invalid comparison between Unknown and I4 if (!s.Enabled.Value) { return; } Event current = Event.current; if (current == null || (int)current.type == 7) { bool basic = s.Style.Value == HudStyle.Basic; PlainList.Draw(s); if (CartsWanted(s)) { DrawCarts(s, basic); } if (RidesWanted(s)) { DrawRides(s, basic); } if (TruckWanted(s)) { DrawTruck(basic); } if (MatesWanted(s)) { DrawMates(s, basic); } } } private static void DrawCarts(Settings s, bool basic) { //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) Camera val = World.LabelCamera(); if ((Object)(object)val == (Object)null || Carts.Labels.Count == 0) { return; } int num = Mathf.Clamp((s.CartsSize == null) ? 20 : s.CartsSize.Value, 10, 36); bool meters = s.CartsMeters != null && s.CartsMeters.Value; foreach (CartTag label in Carts.Labels) { if (OnScreen(val, label.LabelAt, out var gui)) { Tag(gui, label.Plain(meters), label.Color, ShrinkWithDistance(num, label.Distance, 42), num, basic); } } } private static void DrawRides(Settings s, bool basic) { //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) Camera val = World.LabelCamera(); if ((Object)(object)val == (Object)null || Vehicles.Labels.Count == 0) { return; } int num = Mathf.Clamp((s.RidesSize == null) ? 20 : s.RidesSize.Value, 10, 36); bool meters = s.RidesMeters != null && s.RidesMeters.Value; foreach (RideTag label in Vehicles.Labels) { if (OnScreen(val, label.LabelAt, out var gui)) { Tag(gui, label.Plain(meters), label.Color, ShrinkWithDistance(num, label.Distance, 42), num, basic); } } } private static void DrawTruck(bool basic) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0022: 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_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) Camera val = World.LabelCamera(); if (!((Object)(object)val == (Object)null)) { Vector3 truck = World.Truck; if (OnScreen(val, truck + Vector3.up * 0.375f, out var gui)) { PlayerAvatar instance = PlayerAvatar.instance; float num = Vector3.Distance(Players.Origin(instance, Players.Alive(instance)), truck); int size = ShrinkWithDistance(20, num, 42); Tag(gui, "Truck " + Mathf.RoundToInt(num) + "m", "ffd84d", size, -1, basic); } } } private static void Tag(Vector2 at, string text, string color, int size, int fullSize, bool basic) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) GUIStyle val = ((basic && size != fullSize) ? Style(BasicBright, size, shadow: false, basic: true) : Style(Bright, size, shadow: false, basic: false)); GUIStyle val2 = Style(Shadow, size, shadow: true, basic: false); Vector2 val3 = Measure(size, text); float num = Mathf.Clamp(val3.x + 18f, 90f, 330f); float num2 = val3.y + 6f; Rect val4 = default(Rect); ((Rect)(ref val4))..ctor(at.x - num / 2f, at.y - num2 - 6f, num, num2); if (!basic) { GUI.Label(new Rect(((Rect)(ref val4)).x + 1f, ((Rect)(ref val4)).y + 1f, ((Rect)(ref val4)).width, ((Rect)(ref val4)).height), text, val2); } GUI.Label(val4, basic ? text : ("<color=#" + color + ">" + text + "</color>"), val); } private static void DrawMates(Settings s, bool basic) { //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_021b: Unknown result type (might be due to invalid IL or missing references) //IL_010e: 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) Camera val = World.LabelCamera(); if ((Object)(object)val == (Object)null) { return; } List<Mate> list = Players.Mates(); if (list == null || list.Count == 0) { return; } bool value = s.MatesDead.Value; bool value2 = s.MatesAlive.Value; bool flag = value && s.MatesDeadEdge.Value; bool flag2 = value2 && s.MatesAliveEdge.Value; bool meters = s.MatesMeters != null && s.MatesMeters.Value; LeftEdge.Clear(); RightEdge.Clear(); foreach (Mate item in list) { if (item == null || (item.IsMe && !item.Dead) || (item.Dead ? (!value) : (!value2))) { continue; } EdgeTag edgeTag = Fit(item, s, meters, basic); if (!OnScreen(val, item.LabelAt, out var gui)) { if ((item.Dead ? flag : flag2) && EdgePoint(val, item.LabelAt, out var gui2, out var left)) { edgeTag.Meters = item.Meters; edgeTag.WantY = Mathf.Clamp(gui2.y - edgeTag.H / 2f, 4f, Mathf.Max(4f, (float)Screen.height - edgeTag.H - 4f)); (left ? LeftEdge : RightEdge).Add(edgeTag); } } else { float num = Mathf.Clamp(gui.x - edgeTag.W / 2f, 4f, Mathf.Max(4f, (float)Screen.width - edgeTag.W - 4f)); float num2 = Mathf.Clamp(gui.y - edgeTag.H - 2f, 4f, Mathf.Max(4f, (float)Screen.height - edgeTag.H - 4f)); Paint(new Rect(num, num2, edgeTag.W, edgeTag.H), edgeTag, basic); } } Stack(LeftEdge, left: true, basic); Stack(RightEdge, left: false, basic); } private static EdgeTag Fit(Mate m, Settings s, bool meters, bool basic) { //IL_0043: 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_0085: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: 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_0051: 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) int num = ShrinkWithDistance(Mathf.Clamp(s.MatesSize.Value, 10, 60), m.Distance, 60); string text = m.Plain(meters); float num2 = Mathf.Max(120f, (float)Screen.width - 8f); Vector2 val = Measure(num, text); while (num > 10 && val.x + 14f > num2) { num--; val = Measure(num, text); } return new EdgeTag { Plain = text, Rich = m.Rich(meters), W = Mathf.Clamp(val.x + 14f, 72f, num2), H = val.y + 4f, Look = (basic ? Style(BasicBright, num, shadow: false, basic: true) : Style(Bright, num, shadow: false, basic: false)), Shade = Style(Shadow, num, shadow: true, basic: false) }; } private static void Paint(Rect r, EdgeTag t, bool basic) { //IL_0041: 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) if (!basic) { GUI.Label(new Rect(((Rect)(ref r)).x + 1f, ((Rect)(ref r)).y + 1f, ((Rect)(ref r)).width, ((Rect)(ref r)).height), t.Plain, t.Shade); } GUI.Label(r, basic ? t.Plain : t.Rich, t.Look); } private static void Stack(List<EdgeTag> tags, bool left, bool basic) { //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: 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) if (tags.Count == 0) { return; } tags.Sort(delegate(EdgeTag a, EdgeTag b) { int num7 = a.Meters.CompareTo(b.Meters); return (num7 == 0) ? a.WantY.CompareTo(b.WantY) : num7; }); Rect[] array = (Rect[])(object)new Rect[tags.Count]; float num = 4f; float num2 = 0f; for (int num3 = 0; num3 < tags.Count; num3++) { EdgeTag edgeTag = tags[num3]; float num4 = (left ? 8f : Mathf.Max(8f, (float)Screen.width - edgeTag.W - 8f)); float num5 = Mathf.Max(edgeTag.WantY, num); array[num3] = new Rect(num4, num5, edgeTag.W, edgeTag.H); num = num5 + edgeTag.H + 2f; num2 = Mathf.Max(num2, num - (float)Screen.height + 4f); } for (int num6 = 0; num6 < tags.Count; num6++) { if (num2 > 0f) { ((Rect)(ref array[num6])).y = Mathf.Max(4f, ((Rect)(ref array[num6])).y - num2); } Paint(array[num6], tags[num6], basic); } } private static int ShrinkWithDistance(int max, float distance, int hardMax) { int num = Mathf.Clamp(max, 8, hardMax); float num2 = Mathf.Clamp01(Mathf.Max(0f, distance) / 20f); return Mathf.Clamp(Mathf.RoundToInt((float)num * Mathf.Lerp(1.3f, 0.7f, num2)), 8, hardMax); } private static bool OnScreen(Camera cam, Vector3 world, out Vector2 gui) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //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_001e: Unknown result type (might be due to invalid IL or missing references) //IL_002d: 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_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) gui = Vector2.zero; if ((Object)(object)cam == (Object)null) { return false; } Vector3 val = cam.WorldToScreenPoint(world); if (val.z <= 0.05f) { return false; } float num = val.x; float num2 = val.y; RenderTexture targetTexture = cam.targetTexture; if ((Object)(object)targetTexture != (Object)null && ((Texture)targetTexture).width > 0 && ((Texture)targetTexture).height > 0) { num *= (float)Screen.width / (float)((Texture)targetTexture).width; num2 *= (float)Screen.height / (float)((Texture)targetTexture).height; } if (num < -80f || num > (float)Screen.width + 80f || num2 < -80f || num2 > (float)Screen.height + 80f) { return false; } gui = new Vector2(num, (float)Screen.height - num2); return true; } private static bool EdgePoint(Camera cam, Vector3 world, out Vector2 gui, out bool left) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: 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_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_0031: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) gui = Vector2.zero; left = false; if ((Object)(object)cam == (Object)null) { return false; } Vector3 val = cam.WorldToScreenPoint(world); bool flag = val.z <= 0.05f; float num = val.x; float num2 = val.y; if (flag) { num = (float)Screen.width - num; num2 = (float)Screen.height - num2; } float num3 = (float)Screen.height - num2; bool flag2 = num >= 0f && num <= (float)Screen.width && num3 >= 0f && num3 <= (float)Screen.height; if (!flag && flag2) { return false; } left = num <= (float)Screen.width * 0.5f; gui = new Vector2(left ? 0f : ((float)Screen.width), Mathf.Clamp(num3, 4f, Mathf.Max(4f, (float)Screen.height - 4f))); return true; } private static Vector2 Measure(int size, string text) { //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: 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) (int, string) key = (Mathf.Clamp(size, 8, 60), text ?? string.Empty); if (!Sizes.TryGetValue(key, out var value)) { Words.text = key.Item2; value = Style(Bright, key.Item1, shadow: false, basic: false).CalcSize(Words); Sizes[key] = value; } return value; } private static GUIStyle Style(Dictionary<int, GUIStyle> cache, int size, bool shadow, bool basic) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0098: 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_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004f: 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_005d: 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_006f: Expected O, but got Unknown int num = Mathf.Clamp(size, 8, 60); Color textColor = (Color)(shadow ? new Color(0f, 0f, 0f, 0.85f) : Color.white); if (!cache.TryGetValue(num, out var value)) { value = new GUIStyle(GUI.skin.label) { fontSize = num, fontStyle = (FontStyle)1, alignment = (TextAnchor)4, wordWrap = false, richText = !shadow }; if (basic && (Object)(object)BasicLook.Font != (Object)null) { value.font = BasicLook.Font; } cache[num] = value; } value.normal.textColor = textColor; return value; } } internal static class NameMute { private static Harmony _harmony; private static bool Muted { get { Settings options = HudWorldPlugin.Options; if (options != null && options.Enabled.Value && Session.SafeInRun && options.MatesOn != null) { return options.MatesOn.Value; } return false; } } public static void Install() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Expected O, but got Unknown try { _harmony = new Harmony("Rehaan.HudUiRepoWorld.names"); Skip(typeof(PlayerNameChecker), "Update", "CheckerUpdate"); Skip(typeof(WorldSpaceUIPlayerName), "Update", "LabelUpdate"); HudWorldPlugin.Log.LogInfo((object)"Native teammate name display suppression patched."); } catch (Exception ex) { HudWorldPlugin.Log.LogWarning((object)("Failed to patch native name display: " + ex)); } } public static void Uninstall() { Harmony harmony = _harmony; if (harmony != null) { harmony.UnpatchSelf(); } _harmony = null; } private static void Skip(Type type, string method, string hook) { //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Expected O, but got Unknown MethodInfo methodInfo = AccessTools.Method(type, method, (Type[])null, (Type[])null); MethodInfo methodInfo2 = AccessTools.Method(typeof(NameMute), hook, (Type[])null, (Type[])null); if (methodInfo == null || methodInfo2 == null) { HudWorldPlugin.Log.LogWarning((object)("Failed to find native name patch target: " + type.Name + "." + method)); } else { _harmony.Patch((MethodBase)methodInfo, new HarmonyMethod(methodInfo2), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } } private static bool CheckerUpdate() { return !Muted; } private static bool LabelUpdate(WorldSpaceUIPlayerName __instance) { //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) if (!Muted) { return true; } if ((Object)(object)__instance == (Object)null || (Object)(object)__instance.playerAvatar == (Object)null) { return true; } if ((Object)(object)__instance.text == (Object)null) { return false; } Color color = ((Graphic)__instance.text).color; color.a = 0f; ((Graphic)__instance.text).color = color; ((TMP_Text)__instance.text).richText = false; __instance.showTimer = 0f; return false; } } internal static class PlainList { private static GUIStyle _look; private static GUIStyle _shade; private static int _styleSize = -1; private static readonly GUIContent Words = new GUIContent(); private static string _forText; private static int _forSize = -1; private static int _forX = int.MinValue; private static int _forY = int.MinValue; private static int _forW = -1; private static int _forH = -1; private static bool _forWide; private static Rect _box; private static string _plain = string.Empty; public static void Draw(Settings s) { //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) string text = InfoText.Text; if (s.InfoOn.Value && s.Style.Value == HudStyle.Basic && !string.IsNullOrEmpty(text)) { int num = Mathf.Clamp(s.InfoSize.Value, 10, 28); Styles(num, s.Opacity01); bool flag = s.MonstersPerType != null && s.MonstersPerType.Value; int num2 = ((s.InfoX != null) ? s.InfoX.Value : 0); int num3 = ((s.InfoY != null) ? s.InfoY.Value : 0); if (!string.Equals(_forText, text) || _forSize != num || _forWide != flag || _forX != num2 || _forY != num3 || _forW != Screen.width || _forH != Screen.height) { float num4 = (flag ? 430f : 320f); Words.text = text; float num5 = _look.CalcHeight(Words, num4); _box = new Rect((float)Screen.width - num4 - 12f - (float)num2, (float)Screen.height - num5 - 26f - (float)num3, num4, num5); _plain = NoTags(text); _forText = text; _forSize = num; _forWide = flag; _forX = num2; _forY = num3; _forW = Screen.width; _forH = Screen.height; } GUI.Label(new Rect(((Rect)(ref _box)).x + 1f, ((Rect)(ref _box)).y + 1f, ((Rect)(ref _box)).width, ((Rect)(ref _box)).height), _plain, _shade); GUI.Label(_box, text, _look); } } private static void Styles(int size, float opacity) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: 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_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Expected O, but got Unknown //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005b: 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_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) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Expected O, but got Unknown //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) if (_look == null || _styleSize != size) { _styleSize = size; _look = new GUIStyle(GUI.skin.label) { fontSize = size, fontStyle = (FontStyle)1, alignment = (TextAnchor)8, wordWrap = false, richText = true }; _shade = new GUIStyle(GUI.skin.label) { fontSize = size, fontStyle = (FontStyle)1, alignment = (TextAnchor)8, wordWrap = false, richText = false }; } _look.normal.textColor = new Color(1f, 1f, 1f, opacity); _shade.normal.textColor = new Color(0f, 0f, 0f, Mathf.Min(0.85f, opacity)); } private static string NoTags(string text) { StringBuilder stringBuilder = new StringBuilder(text.Length); bool flag = false; foreach (char c in text) { if (c == '<') { flag = true; } else if (flag) { if (c == '>') { flag = false; } } else { stringBuilder.Append(c); } } return stringBuilder.ToString(); } } internal static class SilverHud { private struct Snapshot { public bool Show; public bool Compact; public bool Panel; public bool MapUp; public bool Remaining; public float Map; public float Left; public float Percent; public int Collected; public int Collectible; public int Alive; public int Dead; public int Total; public float Primary { get { if (!Remaining) { return Map; } return Left; } } public bool Same(Snapshot o) { if (Show == o.Show && Compact == o.Compact && Panel == o.Panel && MapUp == o.MapUp && Remaining == o.Remaining && Math.Abs(Map - o.Map) < 0.01f && Math.Abs(Left - o.Left) < 0.01f && Math.Abs(Percent - o.Percent) < 0.01f && Collected == o.Collected && Collectible == o.Collectible && Alive == o.Alive && Dead == o.Dead) { return Total == o.Total; } return false; } } private static GameObject _root; private static TextMeshProUGUI _compact; private static TextMeshProUGUI _players; private static string _compactShown = string.Empty; private static string _playersShown = string.Empty; private static Snapshot _last; private static bool _hasLast; public static GameObject Root => _root; public static void Tick(Settings s) { //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_013b: 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) //IL_0164: Unknown result type (might be due to invalid IL or missing references) if (s == null || !s.Enabled.Value || !SemiFunc.RunIsLevel() || (Object)(object)RoundDirector.instance == (Object)null || s.Style.Value != HudStyle.Silver) { Hide(); Upgrades.Tick(s, null); } else { if (!Build()) { return; } Snapshot last = Take(s); if (!last.Compact && !last.Panel) { Hide(); return; } bool mapUp = last.MapUp; LevelUI instance = LevelUI.instance; if ((Object)(object)instance != (Object)null) { if (!mapUp && !((Component)instance).gameObject.activeSelf) { Tuck(instance); } ((Component)instance).gameObject.SetActive(!mapUp); } if ((Object)(object)_compact == (Object)null || (Object)(object)_players == (Object)null || !MapPanel.Ready) { return; } MapPanel.Show(mapUp); ((Component)_compact).gameObject.SetActive(!mapUp); bool flag = !_hasLast || !last.Same(_last); if (mapUp) { MapPanel.Update(s); } else if (flag || !((Component)_compact).gameObject.activeSelf) { Place(((TMP_Text)_compact).rectTransform, CompactAt(s), new Vector2(1f, 0f), new Vector2(1f, 1f)); string text = "<color=#" + G