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 UI ultra plus v1.0.1
UIUltraPlus.dll
Decompiled 15 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.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using Photon.Pun; using Photon.Realtime; using TMPro; using UIUltraPlus; using UIUltraPlus.Config; using UnityEngine; 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("UIUltraPlus")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.1.0")] [assembly: AssemblyInformationalVersion("1.0.1+4fd7a68438857c4d53908419869742676e2fa405")] [assembly: AssemblyProduct("UI ultra+")] [assembly: AssemblyTitle("UIUltraPlus")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.1.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [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; } } } public enum BoundsPosition { Center, Bottom } internal struct CartComponentCache { public PhysGrabCart Cart; public PhysGrabObject PhysGrabObject; public Component PhysGrabObjectComponent; public ItemEquippable ItemEquippable; } internal struct CartLabelCandidate { public int Id; public Vector3 Position; } internal sealed class ConfigurationManagerAttributes { public int? Order; public Action<ConfigEntryBase> CustomDrawer; public bool? ReadOnly; public bool? Browsable; public bool? HideDefaultButton; public string Category; public string DispName; public string Description; } public enum DisplayLanguage { 中文, English } public enum DisplayMode { Ultra, Classic } internal static class EnemyNameLocalizer { private static readonly Dictionary<string, string> NameMap = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase) { ["Animal"] = "蟑螂", ["Enemy Animal"] = "蟑螂", ["Apex Predator"] = "邪恶鸭子", ["Bang"] = "炸弹骷髅", ["Banger"] = "炸弹骷髅", ["Enemy Bang"] = "炸弹骷髅", ["Baby"] = "扔东西小孩", ["Beamer"] = "激光小丑", ["Enemy Beamer"] = "激光小丑", ["Bella"] = "三轮车", ["Birthday Boy"] = "生日男孩", ["Enemy Birthday Boy"] = "生日男孩", ["Bomb Thrower"] = "疯狂厨师青蛙", ["Enemy Bomb Thrower"] = "疯狂厨师青蛙", ["Bowtie"] = "尖叫大白", ["Enemy Bowtie"] = "尖叫大白", ["Ceiling Eye"] = "邪恶大眼", ["Enemy Ceiling Eye"] = "邪恶大眼", ["Chef"] = "疯狂厨师青蛙", ["Cleanup Crew"] = "清洁工", ["Clown"] = "激光小丑", ["Dog"] = "小狗", ["Duck"] = "邪恶鸭子", ["Enemy Duck"] = "邪恶鸭子", ["Elsa"] = "小狗", ["Enemy Elsa"] = "小狗", ["Floater"] = "外星人", ["Enemy Floater"] = "外星人", ["Frog"] = "疯狂厨师青蛙", ["Gambit"] = "赌盘怪", ["Gnome"] = "红帽子侏儒", ["Gnomes"] = "红帽子侏儒", ["Enemy Gnome"] = "红帽子侏儒", ["Head"] = "咬人骷髅头", ["Enemy Head"] = "咬人骷髅头", ["Head Grabber"] = "抢头怪", ["Enemy Head Grabber"] = "抢头怪", ["Headgrab"] = "抢头怪", ["Headman"] = "咬人骷髅头", ["Heart Hugger"] = "爱心花", ["Enemy Heart Hugger"] = "爱心花", ["Hidden"] = "隐身怪", ["Enemy Hidden"] = "隐身怪", ["Hunter"] = "猎人", ["Huntsman"] = "猎人", ["Enemy Hunter"] = "猎人", ["Loom"] = "拍手女", ["Mentalist"] = "外星人", ["Oogly"] = "绿灯怪", ["Enemy Oogly"] = "绿灯怪", ["Peeper"] = "邪恶大眼", ["Peeper Ceiling Eye"] = "邪恶大眼", ["Reaper"] = "电锯小丑", ["Robe"] = "长袍无脸男", ["Enemy Robe"] = "长袍无脸男", ["Rugrat"] = "熊孩子", ["Runner"] = "电锯小丑", ["Enemy Runner"] = "电锯小丑", ["Shadow"] = "拍手女", ["Enemy Shadow"] = "拍手女", ["Shadow Child"] = "娃娃脸小孩", ["Slow Mouth"] = "呕吐怪", ["Enemy Slow Mouth"] = "呕吐怪", ["Slow Walker"] = "大锤版钟馗", ["Enemy Slow Walker"] = "大锤版钟馗", ["Spewer"] = "呕吐怪", ["Spinny"] = "赌盘怪", ["Enemy Spinny"] = "赌盘怪", ["Thin Man"] = "娃娃脸小孩", ["Enemy Thin Man"] = "娃娃脸小孩", ["Tick"] = "吸血虫", ["Enemy Tick"] = "吸血虫", ["Tricycle"] = "三轮车", ["Enemy Tricycle"] = "三轮车", ["Trudge"] = "大锤版钟馗", ["Tumbler"] = "疯狂厨师青蛙", ["Enemy Tumbler"] = "疯狂厨师青蛙", ["Upscream"] = "尖叫", ["Enemy Upscream"] = "尖叫", ["Valuable Thrower"] = "熊孩子", ["Enemy Valuable Thrower"] = "熊孩子" }; private static readonly Dictionary<string, string> NicknameMap = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase) { ["Animal"] = "小六子", ["Enemy Animal"] = "小六子", ["Dog"] = "摸摸小狗", ["Elsa"] = "摸摸小狗", ["Enemy Elsa"] = "摸摸小狗" }; private static readonly Dictionary<string, string> ChineseNicknameMap = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase) { ["蟑螂"] = "小六子", ["邪恶鸭子"] = "暴走鸭", ["炸弹骷髅"] = "东方快递", ["扔东西小孩"] = "败家小子", ["激光小丑"] = "激光哥", ["三轮车"] = "鬼火少年", ["生日男孩"] = "气球哥", ["疯狂厨师青蛙"] = "青蛙厨神", ["尖叫大白"] = "白色电风扇", ["邪恶大眼"] = "大眼哥", ["清洁工"] = "丢头哥", ["小狗"] = "摸摸小狗", ["外星人"] = "外星人", ["赌盘怪"] = "转转乐", ["红帽子侏儒"] = "地精矿工", ["咬人骷髅头"] = "大头鬼", ["抢头怪"] = "抢头哥", ["爱心花"] = "心动花花", ["隐身怪"] = "隐身老六", ["猎人"] = "男枪", ["拍手女"] = "老奶奶", ["绿灯怪"] = "夜店绿苍蝇", ["电锯小丑"] = "双刀妹", ["长袍无脸男"] = "无脸鬼手男", ["熊孩子"] = "败家小子", ["娃娃脸小孩"] = "末影人", ["呕吐怪"] = "口水哥", ["大锤版钟馗"] = "大锤哥", ["吸血虫"] = "面包虫", ["尖叫"] = "尖叫鸡" }; public static string Translate(string rawName, DisplayLanguage language) { return Translate(rawName, language, useNicknames: false); } public static string Translate(string rawName, DisplayLanguage language, bool useNicknames) { if (string.IsNullOrWhiteSpace(rawName)) { return string.Empty; } string text = rawName.Trim(); if (language == DisplayLanguage.English) { return NormalizeEnglishName(text); } Dictionary<string, string> activeMap = (useNicknames ? NicknameMap : NameMap); if (TryGetTranslatedName(activeMap, text, out string translated)) { return translated; } string text2 = NormalizeKey(text); if (TryGetTranslatedName(activeMap, text2, out translated)) { return translated; } string text3 = SimplifyEnemyComponentName(text2); if (!string.Equals(text3, text2, StringComparison.OrdinalIgnoreCase) && TryGetTranslatedName(activeMap, text3, out translated)) { return translated; } Match match = Regex.Match(text2, "^(?<count>\\d+)\\s+(?<name>.+)$"); if (match.Success) { string value = match.Groups["count"].Value; string text4 = match.Groups["name"].Value.Trim(); string text5 = (text4.EndsWith("s", StringComparison.OrdinalIgnoreCase) ? text4.Substring(0, text4.Length - 1) : text4); if (TryGetTranslatedName(activeMap, text4, out translated)) { return value + " " + translated; } if (TryGetTranslatedName(activeMap, text5, out translated)) { return value + " " + translated; } string key = SimplifyEnemyComponentName(text4); if (TryGetTranslatedName(activeMap, key, out translated)) { return value + " " + translated; } string key2 = SimplifyEnemyComponentName(text5); if (TryGetTranslatedName(activeMap, key2, out translated)) { return value + " " + translated; } } return text; } private static bool TryGetTranslatedName(Dictionary<string, string> activeMap, string key, out string translated) { if (activeMap.TryGetValue(key, out translated)) { return true; } if (activeMap != NameMap && NameMap.TryGetValue(key, out translated)) { if (ChineseNicknameMap.TryGetValue(translated, out string value)) { translated = value; } return true; } translated = null; return false; } private static string NormalizeEnglishName(string rawName) { string text = NormalizeKey(rawName); string text2 = SimplifyEnemyComponentName(text); if (!string.IsNullOrWhiteSpace(text2)) { return text2; } return text; } private static string NormalizeKey(string rawName) { return Regex.Replace(Regex.Replace(Regex.Replace(rawName.Replace("(Clone)", string.Empty).Replace("Enemy Group - ", string.Empty).Replace("Enemy - ", string.Empty) .Replace("_", " ") .Replace("-", " ") .Trim(), "(?<=[a-z])(?=[A-Z])", " "), "^Enemy\\s+", string.Empty, RegexOptions.IgnoreCase), "\\s+", " ").Trim(); } private static string SimplifyEnemyComponentName(string cleaned) { if (string.IsNullOrWhiteSpace(cleaned)) { return string.Empty; } string text = Regex.Replace(cleaned, "\\b(Anim|Animation System|Always Active|Attaching|Bot Tilt|Bomb|Camera Visuals|Catch Cutscene|Chase Offset|Controller|Cute Face|Director|Explosion|Eye|Eye Idle|Eye Target|Eye Tilt|Eye Tremble|Float|Fuse|Gas Checker|Gas Guider|Hair|Hair Lean|Hair Target|Hair Tilt|Heal Aura|Hive Attack|Lean|Local Camera|Loop|Old|Particle|Particle Puke Collision|Player Avatar Attached|Pupil|Screen Vein Effect|Sphere Effect|Stun Fly|Tentacle|Tilt|Up|Visual|Visuals)\\b.*$", string.Empty, RegexOptions.IgnoreCase).Trim(); if (!string.IsNullOrWhiteSpace(text)) { return text; } return cleaned; } } internal static class HudText { public static string UnknownLevel(DisplayLanguage language) { if (!IsEnglish(language)) { return "未知"; } return "Unknown"; } public static string UnknownEnemy(DisplayLanguage language) { if (!IsEnglish(language)) { return "未知怪物"; } return "Unknown Enemy"; } public static string Danger(DisplayLanguage language) { if (!IsEnglish(language)) { return "危险"; } return "DANGER"; } public static string EnemyTotal(DisplayLanguage language) { if (!IsEnglish(language)) { return "怪物总数"; } return "Enemies"; } public static string TokenBoxCount(DisplayLanguage language) { if (!IsEnglish(language)) { return "装饰箱"; } return "Lottery Boxes"; } public static string MapLostValue(DisplayLanguage language) { if (!IsEnglish(language)) { return "损坏宝物"; } return "Run Lost Funds"; } public static string ExplorationProgress(DisplayLanguage language) { if (!IsEnglish(language)) { return "收集进度"; } return "Extraction Progress"; } public static string UnextractedFunds(DisplayLanguage language) { if (!IsEnglish(language)) { return "未收集"; } return "Unextracted Funds"; } public static string MapTotalValue(DisplayLanguage language) { if (!IsEnglish(language)) { return "地图库存"; } return "Map Remaining Funds"; } public static string ValueUnavailable(DisplayLanguage language) { if (!IsEnglish(language)) { return "无法加载"; } return "Unavailable"; } public static string MapValueDataUnavailable(DisplayLanguage language) { if (!IsEnglish(language)) { return "地图价值数据暂不可用"; } return "Map value data is temporarily unavailable"; } public static string EvacuatedFunds(DisplayLanguage language) { if (!IsEnglish(language)) { return "提交/商店资金"; } return "Submitted / Shop Funds"; } public static string CurrentRunEvacuatedFunds(DisplayLanguage language) { if (!IsEnglish(language)) { return "提交资金"; } return "Run Submitted Funds"; } public static string WarehouseFunds(DisplayLanguage language) { if (!IsEnglish(language)) { return "商店库存"; } return "Shop Remaining Funds"; } public static string Level(DisplayLanguage language) { if (!IsEnglish(language)) { return "关卡"; } return "Level"; } public static string DeadTeammates(DisplayLanguage language) { if (!IsEnglish(language)) { return "死亡队友"; } return "Dead Teammates"; } public static string PlayerCounts(DisplayLanguage language) { if (!IsEnglish(language)) { return "玩家"; } return "Players"; } public static string Dead(DisplayLanguage language) { if (!IsEnglish(language)) { return "死亡"; } return "Dead"; } public static string Alive(DisplayLanguage language) { if (!IsEnglish(language)) { return "存活"; } return "Alive"; } public static string Total(DisplayLanguage language) { if (!IsEnglish(language)) { return "总数"; } return "Total"; } private static bool IsEnglish(DisplayLanguage language) { return language == DisplayLanguage.English; } } internal readonly struct LabelSizeCacheKey : IEquatable<LabelSizeCacheKey> { public readonly int FontSize; public readonly string Text; public LabelSizeCacheKey(int fontSize, string text) { FontSize = fontSize; Text = text ?? string.Empty; } public bool Equals(LabelSizeCacheKey other) { if (FontSize == other.FontSize) { return string.Equals(Text, other.Text, StringComparison.Ordinal); } return false; } public override bool Equals(object obj) { if (obj is LabelSizeCacheKey other) { return Equals(other); } return false; } public override int GetHashCode() { return (FontSize * 397) ^ ((Text != null) ? Text.GetHashCode() : 0); } } internal struct LabelYOffsetCache { public float YOffset; public float UpdatedAt; } internal static class LevelNameLocalizer { private static readonly Dictionary<string, string> NameMap = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase) { ["Swiftbroom Academy"] = "迅帚学院", ["Headman Manor"] = "黑德曼庄园", ["McJannek Station"] = "麦詹内克站", ["Service Station"] = "服务站", ["The Factory"] = "工厂", ["Museum of Human Art"] = "人类艺术博物馆", ["Arena"] = "竞技场", ["Lobby"] = "大厅", ["Shop"] = "商店", ["Tutorial"] = "教程" }; public static string Translate(string rawName, DisplayLanguage language) { if (string.IsNullOrWhiteSpace(rawName)) { return HudText.UnknownLevel(language); } string text = rawName.Trim(); if (language == DisplayLanguage.English) { return text; } if (!NameMap.TryGetValue(text, out string value)) { return text; } return value; } } public sealed class MoreUiCartDistance { public string Name { get; internal set; } = string.Empty; public int Index { get; internal set; } public bool IsSmallCart { get; internal set; } public int DistanceMeters { get; internal set; } public float DistanceValue { get; internal set; } public bool IsBeingPushed { get; internal set; } public string ColorHex { get; internal set; } = "ffd84d"; public string PlainTextNoDistance { get; internal set; } = string.Empty; public string PlainText { get; internal set; } = string.Empty; public string RichTextNoDistance { get; internal set; } = string.Empty; public string RichText { get; internal set; } = string.Empty; public Vector3 ReferencePosition { get; internal set; } public Vector3 LabelPosition { get; internal set; } } public sealed class MoreUiPlayerDistance { public string Name { get; internal set; } = string.Empty; public int DistanceMeters { get; internal set; } public float DistanceValue { get; internal set; } public bool IsDead { get; internal set; } public bool IsLocalPlayer { get; internal set; } public string ColorHex { get; internal set; } = "FFFFFF"; public string PlainTextNoDistance { get; internal set; } = string.Empty; public string PlainText { get; internal set; } = string.Empty; public string RichTextNoDistance { get; internal set; } = string.Empty; public string RichText { get; internal set; } = string.Empty; public string OverlayLine { get; internal set; } = string.Empty; public Vector3 LabelPosition { get; internal set; } } internal sealed class MoreUiTrackedObjectNotifier : MonoBehaviour { private ValuableObject trackedValuable; private PhysGrabCart trackedCart; private Enemy trackedEnemy; private ValuableDiscoverCustom trackedCustomDiscoverable; private CosmeticShopMachine trackedCosmeticShopMachine; private ItemVehicle trackedVehicle; internal void TrackValuable(ValuableObject valuable) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown if ((Object)valuable != (Object)null) { trackedValuable = valuable; } } internal void TrackCart(PhysGrabCart cart) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown if ((Object)cart != (Object)null) { trackedCart = cart; } } internal void TrackEnemy(Enemy enemy) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown if ((Object)enemy != (Object)null) { trackedEnemy = enemy; } } internal void TrackCustomDiscoverable(ValuableDiscoverCustom customDiscoverable) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown if ((Object)customDiscoverable != (Object)null) { trackedCustomDiscoverable = customDiscoverable; } } internal void TrackCosmeticShopMachine(CosmeticShopMachine machine) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown if ((Object)machine != (Object)null) { trackedCosmeticShopMachine = machine; } } internal void TrackVehicle(ItemVehicle vehicle) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown if ((Object)vehicle != (Object)null) { trackedVehicle = vehicle; } } private void OnDestroy() { Plugin.NotifyTrackedObjectDestroyed(trackedValuable, trackedCart, trackedEnemy, trackedCustomDiscoverable, trackedCosmeticShopMachine, trackedVehicle); } } public sealed class MoreUiVehicleDistance { public string Name { get; internal set; } = string.Empty; public int Index { get; internal set; } public bool IsRacingVehicle { get; internal set; } public int DistanceMeters { get; internal set; } public float DistanceValue { get; internal set; } public bool HasRider { get; internal set; } public string ColorHex { get; internal set; } = "ffd84d"; public string PlainTextNoDistance { get; internal set; } = string.Empty; public string PlainText { get; internal set; } = string.Empty; public string RichTextNoDistance { get; internal set; } = string.Empty; public string RichText { get; internal set; } = string.Empty; public Vector3 LabelPosition { get; internal set; } } internal struct NativeOverlayLineState { public bool Active; public bool RichText; public int FontSize; public string Text; public Color32 Color; public float Width; public float BaseY; public float Height; } internal struct PlayerColorCacheEntry { public int ColorIndex; public string ColorHex; public float UpdatedAt; } internal struct PlayerPositionCache { public Vector3 Position; public float UpdatedAt; } [BepInPlugin("scarlet.UIUltraPlus", "UI Ultra Plus", "1.0.1")] public class Plugin : BaseUnityPlugin { internal sealed class CfgI18N { public string SectionCN; public string SectionEN; public string KeyCN; public string KeyEN; public string DisplayEN; public string DescCN; public string DescEN; public ConfigurationManagerAttributes Attrs; public string ValueEN; public string ValueCN; public ConfigEntry<string> ReadOnlyEntry; public ConfigEntryBase Entry; public bool ChineseOnly; } internal sealed class LiveLabel { public WeakReference<TextMeshProUGUI> Tmp; public CfgI18N I18N; public bool IsSection; } internal sealed class LiveValue { public WeakReference<Object> InputField; public CfgI18N I18N; } internal sealed class LiveSliderOptions { public WeakReference<Object> Slider; public CfgI18N I18N; public string[] OptionsCN; public string[] OptionsEN; } internal sealed class LiveToggleButtons { public WeakReference<TextMeshProUGUI> LeftTmp; public WeakReference<TextMeshProUGUI> RightTmp; } public const string PluginGuid = "scarlet.UIUltraPlus"; public const string PluginVersion = "1.0.1"; public const string PluginName = "UI Ultra Plus"; internal static ManualLogSource Logger; public static Plugin Instance; private const float MinimumRefreshIntervalSeconds = 0.1f; private const float RunLevelInactiveGraceSeconds = 4f; private const int PlayerHeadTopColorSlot = 5; private const float PlayerColorCacheRefreshSeconds = 0.2f; private const float PlayerPositionCacheSeconds = 0.15f; private const string TeammateIcon = "\ud83e\udd16"; private const string CartIcon = ""; private const float CartCacheInterval = 0.15f; private const float CartFarFontShrinkPercent = 30f; private const float TrackedObjectCleanupIntervalSeconds = 0.5f; private static readonly GUIContent ReusableGuiContent = new GUIContent(); private static readonly CultureInfo MoneyCulture = CultureInfo.GetCultureInfo("en-US"); private static readonly HashSet<int> BoundsVisitedBuffer = new HashSet<int>(); private static readonly List<Renderer> BoundsRendererBuffer = new List<Renderer>(); private static readonly List<Collider> BoundsColliderBuffer = new List<Collider>(); private static readonly Dictionary<int, Renderer[]> CachedChildRenderers = new Dictionary<int, Renderer[]>(); private static readonly Dictionary<int, Collider[]> CachedChildColliders = new Dictionary<int, Collider[]>(); private static readonly Dictionary<int, bool> PlayerAliveFrameCache = new Dictionary<int, bool>(); private static readonly HashSet<int> TrackedEnemyKeyBuffer = new HashSet<int>(); private static int playerAliveFrameCacheFrame = -1; private static readonly Dictionary<string, int> EnemyBreakdownRankTable = new Dictionary<string, int>(StringComparer.OrdinalIgnoreCase) { ["Apex Predator"] = 10, ["Bang"] = 11, ["Gnome"] = 12, ["Peeper"] = 13, ["Shadow Child"] = 14, ["Spewer"] = 15, ["Tick"] = 16, ["Bella"] = 17, ["Birthday Boy"] = 18, ["Elsa"] = 19, ["Animal"] = 20, ["Bowtie"] = 21, ["Head Grabber"] = 22, ["Heart Hugger"] = 23, ["Mentalist"] = 24, ["Oogly"] = 25, ["Rugrat"] = 26, ["Upscream"] = 27, ["Head"] = 30, ["Hidden"] = 31, ["Hunter"] = 32, ["Loom"] = 33, ["Reaper"] = 34, ["Robe"] = 35, ["Slow Mouth"] = 36, ["Slow Walker"] = 37, ["Trudge"] = 38, ["Cleanup Crew"] = 39, ["Beamer"] = 40, ["Gambit"] = 41 }; private static int cachedWorldLabelCameraFrame = -1; private static Camera cachedWorldLabelCamera; private static int cachedRunLevelActiveFrame = -1; private static bool cachedRunLevelActive; private static int cachedLocalPlayerFrame = -1; private static PlayerAvatar cachedLocalPlayer; private static readonly HashSet<int> valuablesCurrentlyInDollarHaul = new HashSet<int>(); private static readonly List<ValuableObject> trackedValuables = new List<ValuableObject>(); private static readonly HashSet<object> trackedValuableSet = new HashSet<object>(ReferenceObjectComparer.Instance); private static readonly List<PhysGrabCart> trackedCarts = new List<PhysGrabCart>(); private static readonly HashSet<object> trackedCartSet = new HashSet<object>(ReferenceObjectComparer.Instance); private static readonly List<ItemVehicle> trackedVehicles = new List<ItemVehicle>(); private static readonly HashSet<object> trackedVehicleSet = new HashSet<object>(ReferenceObjectComparer.Instance); private static readonly List<ItemVehicle> preservedTrackedVehiclesBuffer = new List<ItemVehicle>(); private static readonly List<Enemy> trackedEnemies = new List<Enemy>(); private static readonly HashSet<object> trackedEnemySet = new HashSet<object>(ReferenceObjectComparer.Instance); private static readonly List<PhysGrabber> trackedGrabbers = new List<PhysGrabber>(); private static readonly HashSet<object> trackedGrabberSet = new HashSet<object>(ReferenceObjectComparer.Instance); private static readonly List<ItemAttributes> trackedItems = new List<ItemAttributes>(); private static readonly List<ItemAttributes> trackedTokenBoxItems = new List<ItemAttributes>(); private static readonly List<ValuableDiscoverCustom> trackedCustomDiscoverables = new List<ValuableDiscoverCustom>(); private static readonly List<CosmeticShopMachine> trackedCosmeticShopMachines = new List<CosmeticShopMachine>(); private static readonly Dictionary<int, int> trackedTokenBoxObjectRefCounts = new Dictionary<int, int>(); private static readonly HashSet<object> EmptyReferenceSet = new HashSet<object>(ReferenceObjectComparer.Instance); private static readonly List<PhysGrabCart> preservedTrackedCartsBuffer = new List<PhysGrabCart>(); private static readonly List<ItemAttributes> preservedTrackedItemsBuffer = new List<ItemAttributes>(); private static readonly List<ValuableDiscoverCustom> preservedTrackedCustomDiscoverablesBuffer = new List<ValuableDiscoverCustom>(); private static readonly List<CosmeticShopMachine> preservedTrackedCosmeticShopMachinesBuffer = new List<CosmeticShopMachine>(); private static int trackedTokenBoxObjectCount; private static float nextTrackedValuableCleanupAt; private static float nextTrackedCartCleanupAt; private static float nextTrackedVehicleCleanupAt; private static float nextTrackedEnemyCleanupAt; private static float nextTrackedGrabberCleanupAt; private static float nextTrackedTokenItemCleanupAt; private static float nextTrackedCustomDiscoverableCleanupAt; private static float nextTrackedCosmeticShopMachineCleanupAt; private ConfigEntry<bool> modEnabled; public ConfigEntry<bool> overlayEnabled; private ConfigEntry<bool> sectionSpacing; private ConfigEntry<DisplayLanguage> displayLanguage; private ConfigEntry<bool> enemyNicknameEnabled; internal ConfigEntry<DisplayMode> displayMode; private ConfigEntry<int> fontSize; private ConfigEntry<int> overlayTextOpacityPercent; private ConfigEntry<float> updateInterval; private ConfigEntry<int> overlayOffsetX; private ConfigEntry<int> overlayOffsetY; private ConfigEntry<bool> showEnemySection; private ConfigEntry<bool> showBreakdown; private ConfigEntry<bool> showTotalEnemyCount; private ConfigEntry<bool> showTokenBoxCount; private ConfigEntry<bool> showValueSection; private ConfigEntry<bool> showMapLostValue; private ConfigEntry<bool> showExplorationProgress; private ConfigEntry<bool> showMapTotalValue; private ConfigEntry<bool> showCurrentRunSubmittedFunds; private ConfigEntry<bool> showShopRemainingFunds; private ConfigEntry<bool> showLevelInfo; private ConfigEntry<bool> showTeammateInfoSection; private ConfigEntry<bool> showDeadTeammates; private ConfigEntry<bool> showAliveTeammates; private ConfigEntry<bool> showPlayerCounts; private ConfigEntry<bool> teammateOverlayEnabled; private ConfigEntry<bool> teammateAliveOverlayEnabled; private ConfigEntry<bool> teammateDeadOverlayEnabled; private ConfigEntry<bool> teammateAliveEdgeOverlayEnabled; private ConfigEntry<bool> teammateDeadEdgeOverlayEnabled; private ConfigEntry<bool> teammateDistanceEnabled; private ConfigEntry<int> teammateFontSize; private ConfigEntry<bool> cartSectionEnabled; private ConfigEntry<bool> cartOverlayEnabled; private ConfigEntry<bool> smallCartOverlayEnabled; private ConfigEntry<bool> cartDistanceEnabled; private ConfigEntry<int> cartFontSize; private ConfigEntry<bool> showLargeCartCount; private ConfigEntry<bool> showSmallCartCount; private ConfigEntry<bool> showKartCount; private ConfigEntry<bool> showCargoCount; private ConfigEntry<bool> vehicleSectionEnabled; private ConfigEntry<bool> vehicleOverlayEnabled; private ConfigEntry<bool> racingVehicleOverlayEnabled; private ConfigEntry<bool> vehicleDistanceEnabled; private ConfigEntry<int> vehicleFontSize; private ConfigEntry<bool> truckSectionEnabled; private ConfigEntry<bool> truckOnlyBeforeClear; private ConfigEntry<bool> truckShowAlways; private static Vector3 cachedTruckPosition = Vector3.zero; private static int cachedRemainingExtractions = 999; private static float lastExtractionsUpdateAt = -1f; private static float lastTruckCheckTime = -1f; private static Camera lastResolvedCamera = null; private static float lastCameraResolveTime = -999f; private GameObject overlayObject; private RectTransform overlayRect; private TextMeshProUGUI overlayLabel; private readonly List<TextMeshProUGUI> nativeOverlayLineLabels = new List<TextMeshProUGUI>(); private readonly List<RectTransform> nativeOverlayLineRects = new List<RectTransform>(); private readonly List<NativeOverlayLineState> nativeOverlayLineStates = new List<NativeOverlayLineState>(); private readonly List<string> nativeOverlayLineTextBuffer = new List<string>(); private TMP_FontAsset nativeOverlayStableFont; private Material nativeOverlayStableMaterial; private bool nativeOverlayStableFontResolved; private Harmony valuableHaulHarmony; private Harmony nativeNameHarmony; private string overlayText = string.Empty; private string lastNativeOverlayText; private int lastNativeOverlayFontSize = -1; private int lastNativeOverlayOffsetX = int.MinValue; private int lastNativeOverlayOffsetY = int.MinValue; private bool lastNativeOverlayShowBreakdown; private float lastNativeOverlayOpacity = -1f; private Transform lastNativeOverlayParent; private string lastPlainOverlaySource; private string lastPlainOverlayText = string.Empty; private string lastTextOverlaySource; private int lastTextOverlayFontSize = -1; private bool lastTextOverlayShowBreakdown; private int lastTextOverlayOffsetX = int.MinValue; private int lastTextOverlayOffsetY = int.MinValue; private int lastTextOverlayScreenWidth = -1; private int lastTextOverlayScreenHeight = -1; private Rect cachedTextOverlayRect; private Rect cachedTextOverlayShadowRect; private float cachedTextOverlayWidth; private string cachedTextOverlayPlainText = string.Empty; private readonly List<MoreUiCartDistance> cartDistanceCache = new List<MoreUiCartDistance>(); private readonly List<MoreUiCartDistance> cartDistancePool = new List<MoreUiCartDistance>(); private readonly List<MoreUiVehicleDistance> vehicleDistanceCache = new List<MoreUiVehicleDistance>(); private readonly List<MoreUiVehicleDistance> vehicleDistancePool = new List<MoreUiVehicleDistance>(); private readonly List<int> reusableSnapshotKeys = new List<int>(); private readonly Dictionary<int, int> largeCartLabelIndices = new Dictionary<int, int>(); private readonly Dictionary<int, int> smallCartLabelIndices = new Dictionary<int, int>(); private readonly Dictionary<int, bool> smallCartTypeCache = new Dictionary<int, bool>(); private readonly Dictionary<int, GUIStyle> centeredRichLabelStyleCache = new Dictionary<int, GUIStyle>(); private readonly Dictionary<int, GUIStyle> centeredShadowLabelStyleCache = new Dictionary<int, GUIStyle>(); private readonly Dictionary<int, GUIStyle> overlayRichStyleCache = new Dictionary<int, GUIStyle>(); private readonly Dictionary<int, GUIStyle> overlayShadowStyleCache = new Dictionary<int, GUIStyle>(); private readonly Dictionary<LabelSizeCacheKey, Vector2> centeredLabelSizeCache = new Dictionary<LabelSizeCacheKey, Vector2>(); private readonly StringBuilder reusableOverlayTextBuilder = new StringBuilder(512); private readonly StringBuilder reusableItemSearchTextBuilder = new StringBuilder(256); private readonly StringBuilder reusableNativeOverlayTagStripBuilder = new StringBuilder(256); private readonly List<Enemy> activeEnemyBuffer = new List<Enemy>(); private readonly Dictionary<string, int> enemyBreakdownBuffer = new Dictionary<string, int>(); private readonly Dictionary<string, int> enemyBreakdownRankBuffer = new Dictionary<string, int>(); private readonly Dictionary<int, int> enemyBreakdownRankCache = new Dictionary<int, int>(); private readonly Dictionary<string, int> enemyBreakdownRawNameRankCache = new Dictionary<string, int>(StringComparer.OrdinalIgnoreCase); private readonly List<KeyValuePair<string, int>> orderedEnemyBreakdownBuffer = new List<KeyValuePair<string, int>>(); private readonly List<object> currentDollarHaulObjectsBuffer = new List<object>(); private readonly List<object> currentCartObjectsBuffer = new List<object>(); private readonly HashSet<object> haulReferenceSetBuffer = new HashSet<object>(ReferenceObjectComparer.Instance); private readonly HashSet<object> cartReferenceSetBuffer = new HashSet<object>(ReferenceObjectComparer.Instance); private readonly List<PhysGrabCart> activeCartBuffer = new List<PhysGrabCart>(); private readonly List<CartLabelCandidate> cartLabelCandidateBuffer = new List<CartLabelCandidate>(); private readonly List<MoreUiPlayerDistance> teammateDistanceBuffer = new List<MoreUiPlayerDistance>(); private readonly List<MoreUiPlayerDistance> teammateDistancePool = new List<MoreUiPlayerDistance>(); private readonly List<TeammateEdgeLabelDrawInfo> leftEdgeTeammateLabelBuffer = new List<TeammateEdgeLabelDrawInfo>(); private readonly List<TeammateEdgeLabelDrawInfo> rightEdgeTeammateLabelBuffer = new List<TeammateEdgeLabelDrawInfo>(); private readonly List<Rect> leftEdgeTeammateRectBuffer = new List<Rect>(); private readonly List<Rect> rightEdgeTeammateRectBuffer = new List<Rect>(); private readonly Component[] cartBoundsRootBuffer = (Component[])(object)new Component[2]; private readonly Dictionary<int, CartComponentCache> cartComponentCache = new Dictionary<int, CartComponentCache>(); private readonly Dictionary<int, string> itemSearchTextCache = new Dictionary<int, string>(); private readonly Dictionary<int, bool> itemTokenBoxCandidateCache = new Dictionary<int, bool>(); private List<PlayerAvatar> playerObjectsFrameCache; private readonly Dictionary<int, string> enemyDisplayNameCache = new Dictionary<int, string>(); private readonly Dictionary<int, string> playerNameCache = new Dictionary<int, string>(); private int cachedHostPlayerId; private readonly HashSet<int> knownPlayerIds = new HashSet<int>(); private readonly Dictionary<int, PlayerColorCacheEntry> playerColorCache = new Dictionary<int, PlayerColorCacheEntry>(); private readonly Dictionary<int, LabelYOffsetCache> cartLabelYOffsetCache = new Dictionary<int, LabelYOffsetCache>(); private readonly Dictionary<int, PlayerPositionCache> playerPositionCache = new Dictionary<int, PlayerPositionCache>(); private DisplayLanguage cachedEnemyDisplayNameLanguage; private bool cachedEnemyNicknameEnabled; private bool hasCachedEnemyDisplayNameLanguage; private float refreshTimer; private float cartRefreshTimer; private int enemyObjectsFrameCacheFrame = -1; private int cartObjectsFrameCacheFrame = -1; private int grabberObjectsFrameCacheFrame = -1; private int valuableObjectsFrameCacheFrame = -1; private int playerObjectsFrameCacheFrame = -1; private int teammateDistanceCacheFrame = -1; private int playerCountsFrame = -1; private int cachedTotalPlayers; private int cachedAlivePlayers; private int cachedDeadPlayers; private bool cartDistanceCacheValid; private bool vehicleDistanceCacheValid; private float vehicleRefreshTimer; private int cartLabelIndexLevelNumber = -1; private int nextLargeCartLabelIndex = 1; private int nextSmallCartLabelIndex = 1; private int trackedLevelNumber = -1; private int valuableSnapshotGeneration; private float previousExtractedValue = -1f; private float accumulatedLostValue; private bool hasLoggedUpdateError; private bool runtimeWasActive; private bool levelTransitionLogIndicatesRun; private float lastConfirmedRunLevelTime = -999f; private int submittedFundsSnapshotLevelNumber = -1; private float submittedFundsBaselineTotalHaul = -1f; private float submittedFundsSnapshot; private int shopRemainingSnapshotLevelNumber = -1; private float shopRemainingFundsSnapshot = -1f; private readonly Dictionary<int, ValuableSnapshot> valuableSnapshots = new Dictionary<int, ValuableSnapshot>(); private static readonly FieldRef<PlayerAvatar, bool> PlayerDeadSetRef = CreateFieldRef<PlayerAvatar, bool>("deadSet"); private static readonly FieldRef<PlayerAvatar, bool> PlayerIsDisabledRef = CreateFieldRef<PlayerAvatar, bool>("isDisabled"); private static readonly FieldRef<PlayerAvatar, string> PlayerNameRef = CreateFieldRef<PlayerAvatar, string>("playerName"); private static readonly FieldRef<PlayerAvatar, bool> PlayerIsLocalRef = CreateFieldRef<PlayerAvatar, bool>("isLocal"); private static readonly FieldRef<PlayerCosmetics, int[]> PlayerCosmeticsColorsEquippedRef = CreateFieldRef<PlayerCosmetics, int[]>("colorsEquipped"); private static readonly FieldRef<PlayerAvatar, PlayerDeathHead> PlayerDeathHeadRef = CreateFieldRef<PlayerAvatar, PlayerDeathHead>("playerDeathHead"); private static readonly FieldRef<PlayerAvatar, Vector3> PlayerLastNavmeshPositionRef = CreateFieldRef<PlayerAvatar, Vector3>("LastNavmeshPosition"); private static readonly FieldRef<PlayerDeathHead, PhysGrabObject> DeathHeadPhysGrabObjectRef = CreateFieldRef<PlayerDeathHead, PhysGrabObject>("physGrabObject"); private static readonly FieldRef<PlayerDeathHead, Vector3> DeathHeadTriggeredPositionRef = CreateFieldRef<PlayerDeathHead, Vector3>("triggeredPosition"); private static readonly FieldRef<PlayerDeathHead, Transform> DeathHeadOverridePositionTransformRef = CreateFieldRef<PlayerDeathHead, Transform>("overridePositionTransform"); private static readonly FieldRef<SpectateCamera, PlayerAvatar> SpectateCameraPlayerRef = CreateFieldRef<SpectateCamera, PlayerAvatar>("player"); private static readonly FieldRef<SpectateCamera, PlayerAvatar> SpectateCameraPlayerOverrideRef = CreateFieldRef<SpectateCamera, PlayerAvatar>("playerOverride"); private static readonly FieldRef<SpectateCamera, Camera> SpectateCameraMainCameraRef = CreateFieldRef<SpectateCamera, Camera>("MainCamera"); private static readonly FieldRef<Enemy, EnemyParent> EnemyParentRef = CreateFieldRef<Enemy, EnemyParent>("EnemyParent"); private static readonly FieldRef<Enemy, EnemyHealth> EnemyHealthRef = CreateFieldRef<Enemy, EnemyHealth>("Health"); private static readonly FieldRef<EnemyHealth, bool> EnemyHealthDeadRef = CreateFieldRef<EnemyHealth, bool>("dead"); private static readonly FieldRef<EnemyParent, bool> EnemyParentSpawnedRef = CreateFieldRef<EnemyParent, bool>("Spawned"); private static readonly FieldRef<EnemyParent, Enemy> EnemyParentEnemyRef = CreateFieldRef<EnemyParent, Enemy>("Enemy"); private static readonly FieldRef<ValuableObject, float> ValuableOriginalValueRef = CreateFieldRef<ValuableObject, float>("dollarValueOriginal"); private static readonly FieldRef<ValuableObject, float> ValuableCurrentValueRef = CreateFieldRef<ValuableObject, float>("dollarValueCurrent"); private static readonly FieldRef<ValuableObject, bool> ValuableValueSetRef = CreateFieldRef<ValuableObject, bool>("dollarValueSet"); private static readonly FieldRef<ValuableObject, PhotonView> ValuablePhotonViewRef = CreateFieldRef<ValuableObject, PhotonView>("photonView"); private static readonly FieldRef<ValuableObject, PhysGrabObject> ValuablePhysGrabObjectRef = CreateFieldRef<ValuableObject, PhysGrabObject>("physGrabObject"); private static readonly FieldRef<PhysGrabCart, List<PhysGrabObject>> PhysGrabCartItemsInCartRef = CreateFieldRef<PhysGrabCart, List<PhysGrabObject>>("itemsInCart"); private static readonly FieldRef<PhysGrabCart, PhysGrabObject> PhysGrabCartPhysGrabObjectRef = CreateFieldRef<PhysGrabCart, PhysGrabObject>("physGrabObject"); private static readonly FieldRef<PhysGrabCart, bool> PhysGrabCartBeingPulledRef = CreateFieldRef<PhysGrabCart, bool>("cartBeingPulled"); private static readonly FieldRef<PhysGrabCart, State> PhysGrabCartCurrentStateRef = CreateFieldRef<PhysGrabCart, State>("currentState"); private static readonly FieldRef<PhysGrabCart, ItemEquippable> PhysGrabCartItemEquippableRef = CreateFieldRef<PhysGrabCart, ItemEquippable>("itemEquippable"); private static readonly FieldRef<PhysGrabInCart, List<CartObject>> PhysGrabInCartObjectsRef = CreateFieldRef<PhysGrabInCart, List<CartObject>>("inCartObjects"); private static readonly FieldRef<ItemEquippable, ItemState> ItemEquippableCurrentStateRef = CreateFieldRef<ItemEquippable, ItemState>("currentState"); private static readonly FieldRef<PhysGrabber, PhysGrabObject> PhysGrabberGrabbedPhysGrabObjectRef = CreateFieldRef<PhysGrabber, PhysGrabObject>("grabbedPhysGrabObject"); private static readonly FieldRef<PhysGrabber, bool> PhysGrabberIsPushingRef = CreateFieldRef<PhysGrabber, bool>("isPushing"); private static readonly FieldRef<PhysGrabber, bool> PhysGrabberIsPullingRef = CreateFieldRef<PhysGrabber, bool>("isPulling"); private static readonly FieldRef<PlayerAvatar, WorldSpaceUIPlayerName> PlayerWorldSpaceUIPlayerNameRef = CreateFieldRef<PlayerAvatar, WorldSpaceUIPlayerName>("worldSpaceUIPlayerName"); private static readonly FieldRef<WorldSpaceUIPlayerName, PlayerAvatar> WsUiPlayerAvatarRef = CreateFieldRef<WorldSpaceUIPlayerName, PlayerAvatar>("playerAvatar"); private static readonly FieldRef<WorldSpaceUIPlayerName, float> WsUiShowTimerRef = CreateFieldRef<WorldSpaceUIPlayerName, float>("showTimer"); private static readonly FieldRef<ItemAttributes, string> ItemAttribNameRef = CreateFieldRef<ItemAttributes, string>("itemName"); private static readonly FieldRef<ItemAttributes, string> ItemAttribPromptNameRef = CreateFieldRef<ItemAttributes, string>("promptName"); private static readonly FieldRef<ItemAttributes, string> ItemAttribAssetNameRef = CreateFieldRef<ItemAttributes, string>("itemAssetName"); private static readonly FieldRef<ItemAttributes, string> ItemAttribInstanceNameRef = CreateFieldRef<ItemAttributes, string>("instanceName"); private static readonly FieldRef<ItemAttributes, string> ItemAttribTagRef = CreateFieldRef<ItemAttributes, string>("itemTag"); private static readonly FieldRef<ItemAttributes, itemType> ItemAttribTypeRef = CreateFieldRef<ItemAttributes, itemType>("itemType"); private static readonly FieldRef<ItemVehicle, VehicleSeat[]> ItemVehicleSeatsRef = CreateFieldRef<ItemVehicle, VehicleSeat[]>("seats"); private static readonly FieldRef<ItemVehicle, bool> ItemVehicleIsRacingRef = CreateFieldRef<ItemVehicle, bool>("isRacingVehicle"); private static readonly FieldRef<RoundDirector, int> RoundDirectorExtractionPointsRef = CreateFieldRef<RoundDirector, int>("extractionPoints"); private static readonly FieldRef<RoundDirector, int> RoundDirectorExtractionPointsCompletedRef = CreateFieldRef<RoundDirector, int>("extractionPointsCompleted"); internal static readonly Dictionary<string, CfgI18N> _cfgByEnSection = new Dictionary<string, CfgI18N>(StringComparer.Ordinal); internal static readonly Dictionary<string, CfgI18N> _cfgByEnKey = new Dictionary<string, CfgI18N>(StringComparer.Ordinal); internal static readonly Dictionary<string, List<CfgI18N>> _cfgByKeyOnly = new Dictionary<string, List<CfgI18N>>(StringComparer.Ordinal); private static readonly List<CfgI18N> _cfgI18Ns = new List<CfgI18N>(64); private static readonly string[] _chineseModKeywords = new string[6] { "chinese", "简体", "繁體", "繁体", "汉化", "中文" }; private static readonly string[] _chineseEnvironmentPluginGuids = new string[1] { "gravydevsupreme.xunity.autotranslator" }; private static readonly List<LiveLabel> _liveLabels = new List<LiveLabel>(64); private static readonly List<LiveValue> _liveValues = new List<LiveValue>(8); private static readonly List<LiveSliderOptions> _liveSliderOptions = new List<LiveSliderOptions>(4); private static readonly List<LiveToggleButtons> _liveToggleButtons = new List<LiveToggleButtons>(16); private static readonly Dictionary<Type, FieldInfo> _labelTmpFieldCache = new Dictionary<Type, FieldInfo>(8); private static readonly Dictionary<Type, PropertyInfo> _sliderStringOptionsPropCache = new Dictionary<Type, PropertyInfo>(4); private static readonly Dictionary<Type, FieldInfo> _toggleLeftTmpCache = new Dictionary<Type, FieldInfo>(4); private static readonly Dictionary<Type, FieldInfo> _toggleRightTmpCache = new Dictionary<Type, FieldInfo>(4); private static readonly Dictionary<string, int> _pendingKeyMatchIndex = new Dictionary<string, int>(StringComparer.Ordinal); internal static string _currentRenderingConfigFilePath; internal static bool _createModEntriesPatchInstalled; private static readonly Dictionary<Type, FieldInfo> _inputStringSystemFieldCache = new Dictionary<Type, FieldInfo>(4); private static readonly Dictionary<Type, MethodInfo> _inputStringSystemSetValueCache = new Dictionary<Type, MethodInfo>(4); private static readonly Dictionary<string, string> _enumNameCNtoEN = new Dictionary<string, string>(StringComparer.Ordinal) { ["中文"] = "Chinese" }; private static readonly Dictionary<string, string> _enumNameENtoCN = new Dictionary<string, string>(StringComparer.Ordinal) { ["English"] = "英语", ["Chinese"] = "中文" }; private const float NativeOverlayRightMargin = -2f; private const float NativeOverlayBottomMargin = -2f; private const float NativeOverlayCompactLineSpacing = -4f; private const float NativeOverlayCompactParagraphSpacing = -1f; private const float NativeOverlayBreakdownWidth = 430f; private const float NativeOverlaySummaryWidth = 320f; private float tokenBoxCountLastUpdate = -1f; private const float TokenBoxCountCacheSeconds = 1f; private static readonly Dictionary<int, int> vehicleLabelIndices = new Dictionary<int, int>(); private static int nextVehicleLabelIndex = 1; private static int vehicleLabelIndexLevelNumber = -1; private static readonly List<ItemVehicle> activeVehicleBuffer = new List<ItemVehicle>(); private DisplayLanguage CurrentLanguage { get { if (displayLanguage != null) { return displayLanguage.Value; } return DisplayLanguage.English; } } private bool UseEnemyNicknameNames { get { if (CurrentLanguage == DisplayLanguage.中文 && enemyNicknameEnabled != null) { return enemyNicknameEnabled.Value; } return false; } } private void Awake() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Expected O, but got Unknown //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Expected O, but got Unknown DetachFromManager(); Instance = this; Logger = ((BaseUnityPlugin)this).Logger; MakePluginHostPersistent(); Application.logMessageReceived += new LogCallback(OnUnityLogMessageReceived); ResetConfigIfVersionChanged(); BindConfig(); RefreshAllI18N(); Harmony val = new Harmony("zichen.moreui"); ApplyValuableHaulPatch(); ApplyNativeNamePatch(); TryHookREPOConfig(val); if (displayLanguage != null) { displayLanguage.SettingChanged += delegate { RefreshAllI18N(); }; } new UIUltraPlusPlugin().Init(Logger, ((BaseUnityPlugin)this).Config); Logger.LogInfo((object)"UI Ultra Plus loaded."); } private void BindConfig() { //IL_02e7: Unknown result type (might be due to invalid IL or missing references) //IL_02fd: Expected O, but got Unknown //IL_040d: Unknown result type (might be due to invalid IL or missing references) //IL_0423: Expected O, but got Unknown //IL_0533: Unknown result type (might be due to invalid IL or missing references) //IL_0549: Expected O, but got Unknown //IL_0691: Unknown result type (might be due to invalid IL or missing references) //IL_06a7: Expected O, but got Unknown //IL_06d6: Unknown result type (might be due to invalid IL or missing references) //IL_06ec: Expected O, but got Unknown //IL_0725: Unknown result type (might be due to invalid IL or missing references) //IL_073b: Expected O, but got Unknown //IL_0770: Unknown result type (might be due to invalid IL or missing references) //IL_0786: Expected O, but got Unknown //IL_07bb: Unknown result type (might be due to invalid IL or missing references) //IL_07d1: Expected O, but got Unknown DisplayLanguage defaultVal = DetectDefaultLanguage(); displayMode = BindI18N("0. Master Mode", "0. Master Mode", "Display Mode", "显示模式", "Bottom-right uses Ultra style by default. Can switch to Classic (native) style.", "右下角默认使用 Ultra 样式,也可切换为 Classic 样式。", DisplayMode.Ultra, null, 952, DrawDisplayMode); displayLanguage = BindI18N("A.Mod Info", "A.模组信息", "UI Ultra Plus Language", "语言", "Switch display language.", "切换显\ufffd\ufffd\ufffd语言。", defaultVal, null, 980, null, "Language"); BindReadOnlyI18N("A.Mod Info", "A.模组信息", "Mod Name", "模组名称", "UI Ultra Plus", "UI Ultra Plus", 1000, null, "Mod Name"); BindReadOnlyI18N("A.Mod Info", "A.模组信息", "Mod Version", "模组版本号", "1.2.3", "1.2.3", 990, null, "Mod Version"); modEnabled = BindI18N("B.Global", "B.全局设置", "Mod Enabled", "模组启用", "Disable to turn off all features (HUD, teammate/cart distance, monster stats, value tracking, all Harmony patches).", "关闭后整个模组所有UI显示功能都不生效,包括右下角显示、队友/敌人距离、推车距离、怪物统计和价值统计。", defaultVal: true, null, 990); enemyNicknameEnabled = BindI18N("B.Global", "B.全局设置", "Enemy Nicknames", "敌人名字优化", "Default on. Only affects Chinese mode: replaces literal translations with friendlier nicknames. English mode always uses English.", "默认开启。仅在语言为中文时生效,会把直接翻译的敌人名称优化成更顺口、更好辨认的中文名字;语言为 English 时始终显示英文。", defaultVal: true, null, 970); teammateOverlayEnabled = BindI18N("C.Teammate Display", "C.好友局内显示", "Enabled", "启用", "Always show teammate names, distance and death status. Disable to fall back to the game's proximity-based name display.", "开启后始终显示好友名字、距离和死亡状态。关闭后使用游戏自带的靠近检测显示逻辑。", defaultVal: true, null, 600); teammateDeadOverlayEnabled = BindI18N("C.Teammate Display", "C.好友局内显示", "Show Dead Teammates", "死亡好友显示", "Show name and distance for dead teammates in the world.", "开启后,局内显示死亡好友的名字和距离。", defaultVal: true, null, 599); teammateDeadEdgeOverlayEnabled = BindI18N("C.Teammate Display", "C.好友局内显示", "Dead Teammate Edge Hint", "死亡好友离屏边缘提示", "Show name and distance on left/right screen edges when a dead teammate is off-screen.", "开启后,死亡好友离开屏幕时会在左/右边缘显示名字和距离。", defaultVal: true, null, 598); teammateAliveOverlayEnabled = BindI18N("C.Teammate Display", "C.好友局内显示", "Show Alive Teammates", "存活好友显示", "Show name and distance for alive teammates in the world.", "开启后,局内显示存活好友的名字和距离。", defaultVal: true, null, 597); teammateAliveEdgeOverlayEnabled = BindI18N("C.Teammate Display", "C.好友局内显示", "Alive Teammate Edge Hint", "存活好友离屏边缘提示", "Show name and distance on left/right screen edges when an alive teammate is off-screen.", "开启后,存活好友离开屏幕时会在左/右边缘显示名字和距离。", defaultVal: false, null, 596); teammateDistanceEnabled = BindI18N("C.Teammate Display", "C.好友局内显示", "Show Distance Meters", "显示米数", "Append distance in meters after teammate world labels and edge hints. Off by default.", "开启后,好友局内标签和离屏边缘提示会显示距离米数。默认关闭。", defaultVal: false, null, 595); teammateFontSize = BindI18N("C.Teammate Display", "C.好友局内显示", "Font Size", "字体大小", "Font size of teammate names. The game's native default is around 20; this value overrides it.", "好友名字的字体大小。游戏原生默认约20,此值会覆盖原生大小。", 22, (AcceptableValueBase)new AcceptableValueRange<int>(10, 60), 590); cartSectionEnabled = BindI18N("D1.Cart Display", "D1.推车局内显示", "Enabled", "启用", "Disable to hide all cart world labels.", "关闭后推车局内显示全部不显示。", defaultVal: true, null, 530); smallCartOverlayEnabled = BindI18N("D1.Cart Display", "D1.推车局内显示", "Show Cart Small", "显示小推车", "Show index and distance on small carts.", "在小推车上显示编号和距离。", defaultVal: true, null, 520); cartOverlayEnabled = BindI18N("D1.Cart Display", "D1.推车局内显示", "Show Cart Standard", "显示推车", "Show index and distance on large carts.", "在推车上显示编号和距离。", defaultVal: true, null, 518); cartDistanceEnabled = BindI18N("D1.Cart Display", "D1.推车局内显示", "Show Distance Meters", "显示米数", "Append distance in meters after cart labels. Off by default.", "开启后,在推车局内标签后面追加距离米数。默认关闭。", defaultVal: false, null, 517); cartFontSize = BindI18N("D1.Cart Display", "D1.推车局内显示", "Font Size", "字体大小", "Font size of cart labels. Used as the near-distance maximum; far-distance labels shrink by a percentage.", "推车局内文字的字体大小。近距离显示不超过这个大小,远距离会按变小百分比缩小。", 20, (AcceptableValueBase)new AcceptableValueRange<int>(10, 36), 515); vehicleSectionEnabled = BindI18N("D2.Vehicle Display", "D2.载具局内显示", "Enabled", "启用", "Disable to hide all vehicle world labels.", "关闭后载具局内显示全部不显示。", defaultVal: true, null, 510); racingVehicleOverlayEnabled = BindI18N("D2.Vehicle Display", "D2.载具局内显示", "Show Racing Vehicle", "显示赛车", "Show label and distance on racing vehicles.", "在赛车上显示标签和距离。", defaultVal: true, null, 508); vehicleOverlayEnabled = BindI18N("D2.Vehicle Display", "D2.载具局内显示", "Show Cargo Vehicle", "显示载货车", "Show label and distance on cargo vehicles.", "在载货车上显示标签和距离。", defaultVal: true, null, 506); vehicleDistanceEnabled = BindI18N("D2.Vehicle Display", "D2.载具局内显示", "Show Distance Meters", "显示米数", "Append distance in meters after vehicle labels. Off by default.", "开启后,在载具局内标签后面追加距离米数。默认关闭。", defaultVal: false, null, 504); vehicleFontSize = BindI18N("D2.Vehicle Display", "D2.载具局内显示", "Font Size", "字体大小", "Font size of vehicle labels.", "载具局内文字的字体大小。", 20, (AcceptableValueBase)new AcceptableValueRange<int>(10, 36), 502); truckSectionEnabled = BindI18N("E. Truck Display", "E. 卡车位置局内显示", "Enabled", "启用", "Show truck location in the world.", "在局内显示卡车位置。", defaultVal: true, null, 495); truckOnlyBeforeClear = BindI18N("E. Truck Display", "E. 卡车位置局内显示", "Only Before Clear", "仅通关前显示", "Only show truck location when remaining extraction points <= 1.", "仅在剩余提取点 <= 1 时显示卡车位置(已通关或仅剩最后 1 个提取点时)。", defaultVal: true, null, 490); truckShowAlways = BindI18N("E. Truck Display", "E. 卡车位置局内显示", "Show Always", "整局显示", "Show truck location throughout the entire round.", "整局游戏始终显示卡车位置。", defaultVal: false, null, 485); overlayEnabled = BindI18N("F1.Panel Basics", "F1.右下角基础设置", "Enabled", "启用", "Show extra info in the bottom-right corner.", "是否在右下角显示额外信息。", defaultVal: true, null, 960); sectionSpacing = BindI18N("F1.Panel Basics", "F1.右下角基础设置", "Section Spacing", "不同分区空行", "Default on. Inserts a blank line between different info sections.", "默认开启。开启后不同信息分区之间会插入一行空白。", defaultVal: true, null, 955); fontSize = BindI18N("F1.Panel Basics", "F1.右下角基础设置", "Font Size", "字体大小", "Display font size.", "显示文字的字体大小。", 22, (AcceptableValueBase)new AcceptableValueRange<int>(10, 28), 950); overlayTextOpacityPercent = BindI18N("F1.Panel Basics", "F1.右下角基础设置", "Text Opacity %", "文字透明度/%", "Controls overall opacity of both text mode and native UI mode. Default 70.", "右下角默认以文字显示为主时,这里控制文字显示和原生UI显示的整体透明度,默认 70%。", 70, (AcceptableValueBase)new AcceptableValueRange<int>(1, 100), 949); updateInterval = BindI18N("F1.Panel Basics", "F1.右下角基础设置", "Refresh Interval (s)", "刷新间隔/秒", "How many seconds between display refreshes.", "每隔多少秒刷新一次显示。", 3f, (AcceptableValueBase)new AcceptableValueRange<float>(0.1f, 10f), 940); overlayOffsetX = BindI18N("F1.Panel Basics", "F1.右下角基础设置", "Offset X (px)", "右下角X偏移/像素", "Horizontal offset of the bottom-right info. Positive moves left, negative moves right.", "右下角信息的水平偏移。正数向左移动,负数向右移动。", 0, (AcceptableValueBase)new AcceptableValueRange<int>(-600, 600), 930); overlayOffsetY = BindI18N("F1.Panel Basics", "F1.右下角基础设置", "Offset Y (px)", "右下角Y偏移/像素", "Vertical offset of the bottom-right info. Positive moves up, negative moves down.", "右下角信息的垂直偏移。正数向上移动,负数向下移动。", 0, (AcceptableValueBase)new AcceptableValueRange<int>(-600, 600), 920); showEnemySection = BindI18N("F2.Monster Stats", "F2.右下角怪物统计", "Enabled", "启用", "Disable to hide the monster stats section.", "关闭后右下角怪物统计分区全部不显示。", defaultVal: true, null, 800); showBreakdown = BindI18N("F2.Monster Stats", "F2.右下角怪物统计", "Show Breakdown", "显示怪物明细", "Show count per monster type.", "显示每种怪物当前数量。", defaultVal: true, null, 790); showTotalEnemyCount = BindI18N("F2.Monster Stats", "F2.右下角怪物统计", "Show Total", "显示怪物总数", "Show total alive monster count.", "显示当前存活怪物总数。", defaultVal: true, null, 780); showValueSection = BindI18N("F3.Value Stats", "F3.右下角价值统计", "Enabled", "启用", "Disable to hide the value stats section.", "关闭后右下角价值统计分区全部不显示。", defaultVal: true, null, 770); showTokenBoxCount = BindI18N("F3.Value Stats", "F3.右下角价值统计", "Show Lottery Boxes", "显示装饰箱", "Show the number of lottery / decor boxes (token machines, coin chests, etc.) in the current level.", "显示当前关卡中装饰箱的数量(包括投币机、硬币宝箱、代币箱等)。", defaultVal: true, null, 769); showKartCount = BindI18N("F3.Value Stats", "F3.右下角价值统计", "Show Kart Count", "显示赛车数量", "Show kart (racing vehicle) count for the current level in the bottom-right.", "在右下角显示当前关卡的赛车数量。", defaultVal: false, null, 768); showCargoCount = BindI18N("F3.Value Stats", "F3.右下角价值统计", "Show Cargo Count", "显示载货车数量", "Show cargo vehicle count for the current level in the bottom-right.", "在右下角显示当前关卡的载货车数量。", defaultVal: false, null, 767); showSmallCartCount = BindI18N("F3.Value Stats", "F3.右下角价值统计", "Show Cart Small Count", "显示小推车数量", "Show small cart count for the current level in the bottom-right.", "在右下角显示当前关卡的小推车数量。", defaultVal: false, null, 766); showLargeCartCount = BindI18N("F3.Value Stats", "F3.右下角价值统计", "Show Cart Standard Count", "显示推车数量", "Show large cart count for the current level in the bottom-right.", "在右下角显示当前关卡的推车数量。", defaultVal: false, null, 765); showExplorationProgress = BindI18N("F3.Value Stats", "F3.右下角价值统计", "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.", "单独显示收集进度。进度按地图初始总价值计算,已放到提取点或推车的物资也算作已收集。", defaultVal: true, null, 760); showMapLostValue = BindI18N("F3.Value Stats", "F3.右下角价值统计", "Show Run Lost Funds", "显示损坏宝物", "Show value lost from broken or destroyed valuables in this run.", "显示本局中已摔坏或丢失造成的宝物损失。", defaultVal: true, null, 750); showMapTotalValue = BindI18N("F3.Value Stats", "F3.右下角价值统计", "Show Map Remaining", "显示地图库存", "Shows remaining map value. Items already in extraction points are excluded; carts and uncollected items still count.", "显示当前地图库存。已放到提取点的物品会被排除,推车里和地图上未收集的物品仍会计入。", defaultVal: true, null, 740); showCurrentRunSubmittedFunds = BindI18N("F3.Value Stats", "F3.右下角价值统计", "Show Submitted Funds", "显示提交资金", "Show funds successfully extracted and settled this run. Items only placed at the extraction point but not yet finalized do not count.", "显示本局已经成功带走并结算的提交资金。仅放进提取点但未提取成功时不会计入。", defaultVal: true, null, 730); showShopRemainingFunds = BindI18N("F3.Value Stats", "F3.右下角价值统计", "Show Shop Stock", "显示商店库存", "Shows shop remaining funds. Snapshot taken once per run start; submissions in the current level do not increase this.", "显示商店库存。此值只在每局开始读取一次快照,当前关卡提交物品不会让它上涨。", defaultVal: true, null, 720); showLevelInfo = BindI18N("F3.Value Stats", "F3.右下角价值统计", "Show Level", "显示关卡", "Show current level number and name, below shop stock.", "显示当前关卡编号和名称,位于商店库存下面。", defaultVal: true, null, 710); showTeammateInfoSection = BindI18N("F4.Teammate Info", "F4.右下角好友信息", "Enabled", "启用", "Disable to hide the bottom-right teammate info section.", "关闭后右下角好友信息分区全部不显示。", defaultVal: true, null, 670); showDeadTeammates = BindI18N("F4.Teammate Info", "F4.右下角好友信息", "Show Dead Teammates Info", "显示死亡好友信息", "Show dead teammate icon, name and distance at the top of the section. Closer teammates appear higher.", "在右下角好友信息分区顶部显示死亡好友图标、名字和距离,距离越近越靠上。", defaultVal: true, null, 660); showAliveTeammates = BindI18N("F4.Teammate Info", "F4.右下角好友信息", "Show Alive Teammates Info", "显示存活好友信息", "Show name and distance of each alive teammate. Closer teammates appear higher.", "在右下角好友信息分区显示每个存活好友的名字和距离,距离越近越靠上。", defaultVal: true, null, 650); showPlayerCounts = BindI18N("F4.Teammate Info", "F4.右下角好友信息", "Show Player Counts", "显示玩家", "Show dead / alive / total player counts at the bottom of the teammate section.", "在右下角好友信息分区最底部显示死亡、存活和总玩家。", defaultVal: true, null, 640); } private void ResetConfigIfVersionChanged() { try { string configFilePath = ((BaseUnityPlugin)this).Config.ConfigFilePath; if (File.Exists(configFilePath)) { string text = ReadConfigPluginVersion(configFilePath); if (!(text == "1.2.3")) { ResetConfigFileToDefaults(configFilePath); Logger.LogWarning((object)(string.IsNullOrWhiteSpace(text) ? "Old config without Mod Version, reset to defaults." : ("Config version " + text + " -> 1.2.3, reset to defaults."))); } } } catch (Exception ex) { Logger.LogWarning((object)("Failed to reset config by version: " + ex.Message)); } } private static string ReadConfigPluginVersion(string configPath) { if (!File.Exists(configPath)) { return null; } Match match = Regex.Match(File.ReadAllText(configPath), "(?m)^Mod Version\\s*=\\s*(.+?)\\s*$"); if (!match.Success) { return null; } return match.Groups[1].Value.Trim(); } private void ResetConfigFileToDefaults(string configPath) { ((BaseUnityPlugin)this).Config.Clear(); if (File.Exists(configPath)) { File.Delete(configPath); } ((BaseUnityPlugin)this).Config.Reload(); } private void Update() { try { UpdateCore(); } catch (Exception ex) { ResetRuntimeDisplayState(); if (!hasLoggedUpdateError) { hasLoggedUpdateError = true; Logger.LogWarning((object)("moreui update skipped after an error: " + ex.GetType().Name + ": " + ex.Message)); } } } private void UpdateCore() { bool flag = IsRuntimeSessionActive(); if (!IsModEnabled() || !flag) { if (runtimeWasActive) { runtimeWasActive = false; ResetLossTracking(); ResetRuntimeDisplayState(); } return; } runtimeWasActive = true; refreshTimer += Time.deltaTime; UpdateCartDistanceCache(); UpdateVehicleDistanceCache(); bool flag2 = overlayEnabled.Value && displayMode.Value == DisplayMode.Classic; if (refreshTimer >= ClampRefreshInterval((updateInterval == null) ? 1.5f : updateInterval.Value)) { refreshTimer = 0f; overlayText = BuildOverlayText(); if (flag2) { UpdateNativeOverlay(); } } if (flag2 && !string.IsNullOrWhiteSpace(overlayText)) { SetNativeOverlayVisible(visible: true); } else { SetNativeOverlayVisible(visible: false); } } private static float ClampRefreshInterval(float value) { if (float.IsNaN(value) || float.IsInfinity(value)) { return 0.1f; } return Mathf.Max(0.1f, value); } private void MakePluginHostPersistent() { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Expected O, but got Unknown try { ((Component)this).transform.parent = null; ((Object)((Component)this).gameObject).hideFlags = (HideFlags)61; Object.DontDestroyOnLoad((Object)((Component)this).gameObject); } catch (Exception ex) { Logger.LogWarning((object)("Failed to mark plugin host persistent: " + ex.GetType().Name + ": " + ex.Message)); } } private void OnUnityLogMessageReceived(string condition, string stackTrace, LogType type) { if (!string.IsNullOrEmpty(condition)) { int num = condition.IndexOf("Changed level to:", StringComparison.OrdinalIgnoreCase); int length = "Changed level to:".Length; if (num < 0) { num = condition.IndexOf("updated level to:", StringComparison.OrdinalIgnoreCase); length = "updated level to:".Length; } if (num >= 0) { string name = condition.Substring(num + length).Trim(); levelTransitionLogIndicatesRun = LooksLikePlayableSessionName(name); } } } private void DetachFromManager() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Expected O, but got Unknown ((Component)this).gameObject.transform.parent = null; ((Object)((Component)this).gameObject).hideFlags = (HideFlags)61; Object.DontDestroyOnLoad((Object)((Component)this).gameObject); } private void OnDestroy() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Expected O, but got Unknown //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Expected O, but got Unknown Application.logMessageReceived -= new LogCallback(OnUnityLogMessageReceived); if ((Object)(object)Instance == (Object)(object)this) { Instance = null; } ZichenMapValueService.Reset(); if (valuableHaulHarmony != null) { valuableHaulHarmony.UnpatchSelf(); valuableHaulHarmony = null; } if (nativeNameHarmony != null) { nativeNameHarmony.UnpatchSelf(); nativeNameHarmony = null; } valuablesCurrentlyInDollarHaul.Clear(); if ((Object)overlayObject != (Object)null) { Object.Destroy((Object)overlayObject); overlayObject = null; overlayRect = null; overlayLabel = null; lastNativeOverlayParent = null; } } private static void DrawDisplayMode(ConfigEntryBase entry) { if (entry is ConfigEntry<DisplayMode> val) { GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); GUILayout.Label(entry.Definition.Key, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) }); DisplayMode value = val.Value; if (GUILayout.Button((value == DisplayMode.Classic) ? "Classic" : "Ultra", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(140f) })) { val.Value = ((value == DisplayMode.Ultra) ? DisplayMode.Classic : DisplayMode.Ultra); } GUILayout.EndHorizontal(); } } private bool IsModEnabled() { if (modEnabled != null) { return modEnabled.Value; } return true; } private bool IsRuntimeSessionActive() { if (IsRunLevelActive()) { lastConfirmedRunLevelTime = Time.unscaledTime; return true; } if (runtimeWasActive && Time.unscaledTime - lastConfirmedRunLevelTime <= 4f) { return true; } return false; } private void ResetRuntimeDisplayState() { overlayText = string.Empty; lastTextOverlaySource = null; lastTextOverlayFontSize = -1; lastTextOverlayScreenWidth = -1; lastTextOverlayScreenHeight = -1; cachedTextOverlayPlainText = string.Empty; enemyDisplayNameCache.Clear(); enemyBreakdownRankCache.Clear(); enemyBreakdownRawNameRankCache.Clear(); playerNameCache.Clear(); playerColorCache.Clear(); cartLabelYOffsetCache.Clear(); cartComponentCache.Clear(); itemSearchTextCache.Clear(); itemTokenBoxCandidateCache.Clear(); playerPositionCache.Clear(); playerObjectsFrameCache = null; cachedLocalPlayer = null; cachedLocalPlayerFrame = -1; playerCountsFrame = -1; cachedTotalPlayers = 0; cachedAlivePlayers = 0; cachedDeadPlayers = 0; ResetTrackedObjectCleanupSchedule(); enemyObjectsFrameCacheFrame = -1; cartObjectsFrameCacheFrame = -1; grabberObjectsFrameCacheFrame = -1; valuableObjectsFrameCacheFrame = -1; playerObjectsFrameCacheFrame = -1; ClearCartLabelIndices(); ClearCartDistanceCache(); ClearVehicleDistanceCache(); SetNativeOverlayVisible(visible: false); } private static bool IsRunLevelSafe() { try { return IsRunLevelActive(); } catch { return false; } } private static int GetCurrentMapValueLevelNumber() { try { return SemiFunc.RunGetLevelsCompleted() + 1; } catch { return 0; } } private static bool IsRunLevelActive() { int frameCount = Time.frameCount; if (cachedRunLevelActiveFrame == frameCount) { return cachedRunLevelActive; } cachedRunLevelActiveFrame = frameCount; cachedRunLevelActive = IsRunLevelActiveUncached(); return cachedRunLevelActive; } private static bool IsRunLevelActiveUncached() { //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Expected O, but got Unknown //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007d: 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_003b: Expected O, but got Unknown //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Expected O, but got Unknown //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Expected O, but got Unknown try { if (SemiFunc.RunIsShop()) { return true; } } catch { } try { if ((Object)RunManager.instance != (Object)null && (Object)RunManager.instance.levelCurrent != (Object)null) { string name = ((Object)RunManager.instance.levelCurrent).name; string narrativeName = RunManager.instance.levelCurrent.NarrativeName; if (IsNonPlayableLevelName(name) || IsNonPlayableLevelName(narrativeName)) { return false; } } } catch { } try { Scene activeScene = SceneManager.GetActiveScene(); if (IsNonPlayableLevelName(((Scene)(ref activeScene)).name)) { return false; } } catch { } try { if (IsGameDirectorSessionStateActive()) { return true; } } catch { } try { if (SemiFunc.RunIsLevel()) { return true; } } catch { } Plugin instance = Instance; if ((Object)instance != (Object)null && instance.levelTransitionLogIndicatesRun) { return true; } try { if ((Object)RunManager.instance != (Object)null && (Object)RunManager.instance.levelCurrent != (Object)null) { string name2 = ((Object)RunManager.instance.levelCurrent).name; string narrativeName2 = RunManager.instance.levelCurrent.NarrativeName; return LooksLikePlayableSessionName(name2) || LooksLikePlayableSessionName(narrativeName2); } } catch { } return false; } private static bool IsGameDirectorSessionStateActive() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown if ((Object)GameDirector.instance == (Object)null) { return false; } switch (((object)Unsafe.As<gameState, gameState>(ref GameDirector.instance.currentState)/*cast due to .constrained prefix*/).ToString()) { case "Menu": case "Intro": case "None": return false; default: return true; } } private static bool LooksLikePlayableSessionName(string name) { if (string.IsNullOrWhiteSpace(name) || IsNonPlayableLevelName(name)) { return false; } if (name.IndexOf("Level", StringComparison.OrdinalIgnoreCase) < 0 && name.IndexOf("Shop", StringComparison.OrdinalIgnoreCase) < 0 && name.IndexOf("Lobby", StringComparison.OrdinalIgnoreCase) < 0 && name.IndexOf("Rest", StringComparison.OrdinalIgnoreCase) < 0) { return name.IndexOf("Truck", StringComparison.OrdinalIgnoreCase) >= 0; } return true; } private static bool IsNonPlayableLevelName(string name) { if (string.IsNullOrWhiteSpace(name)) { return false; } if (name.IndexOf("Menu", StringComparison.OrdinalIgnoreCase) < 0) { return name.IndexOf("Splash", StringComparison.OrdinalIgnoreCase) >= 0; } return true; } private static bool IsStaticModEnabled() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown Plugin instance = Instance; if (!((Object)instance == (Object)null)) { return instance.IsModEnabled(); } return true; } private bool IsCartFeatureEnabled() { if (cartSectionEnabled != null && cartSectionEnabled.Value) { if (cartOverlayEnabled == null || !cartOverlayEnabled.Value) { if (smallCartOverlayEnabled != null) { return smallCartOverlayEnabled.Value; } return false; } return true; } return false; } private bool IsVehicleFeatureEnabled() { if (vehicleSectionEnabled != null && vehicleSectionEnabled.Value) { if (vehicleOverlayEnabled == null || !vehicleOverlayEnabled.Value) { if (racingVehicleOverlayEnabled != null) { return racingVehicleOverlayEnabled.Value; } return false; } return true; } return false; } internal static void NotifyTrackedObjectDestroyed(ValuableObject valuable, PhysGrabCart cart, Enemy enemy, ValuableDiscoverCustom customDiscoverable, CosmeticShopMachine machine, ItemVehicle vehicle = null) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Expected O, but got Unknown UnregisterTrackedValuable(valuable); UnregisterTrackedCart(cart); UnregisterTrackedEnemy(enemy); UnregisterTrackedCustomDiscoverable(customDiscoverable); UnregisterTrackedCosmeticShopMachine(machine); if ((Object)vehicle != (Object)null) { UnregisterTrackedVehicle(vehicle); } } private static FieldRef<TInstance, TField> CreateFieldRef<TInstance, TField>(string fieldName) where TInstance : class { try { return AccessTools.FieldRefAccess<TInstance, TField>(fieldName); } catch { return null; } } internal static bool GetPlayerDeadSetFast(PlayerAvatar player) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown if ((Object)player != (Object)null && PlayerDeadSetRef != null) { return PlayerDeadSetRef.Invoke(player); } return false; } internal static bool GetPlayerIsDisabledFast(PlayerAvatar player) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown if ((Object)player != (Object)null && PlayerIsDisabledRef != null) { return PlayerIsDisabledRef.Invoke(player); } return false; } internal static bool GetPlayerIsLocalFast(PlayerAvatar player) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown if ((Object)player != (Object)null && PlayerIsLocalRef != null) { return PlayerIsLocalRef.Invoke(player); } return false; } internal static string GetPlayerInternalNameFast(PlayerAvatar player) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown if (!((Object)player == (Object)null) && PlayerNameRef != null) { return PlayerNameRef.Invoke(player); } return null; } internal static int[] GetPlayerCosmeticsColorsFast(PlayerCosmetics cosmetics) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown if (!((Object)cosmetics == (Object)null) && PlayerCosmeticsColorsEquippedRef != null) { return PlayerCosmeticsColorsEquippedRef.Invoke(cosmetics); } return null; } internal static PlayerDeathHead GetPlayerDeathHeadFast(PlayerAvatar player) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown if (!((Object)player == (Object)null) && PlayerDeathHeadRef != null) { return PlayerDeathHeadRef.Invoke(player); } return null; } internal static bool TryGetPlayerLastNavmeshPositionFast(PlayerAvatar player, out Vector3 position) { //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: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) position = Vector3.zero; if ((Object)player == (Object)null || PlayerLastNavmeshPositionRef == null) { return false; } position = PlayerLastNavmeshPositionRef.Invoke(player); return ((Vector3)(ref position)).sqrMagnitude > 0.001f; } internal static PhysGrabObject GetDeathHeadPhysGrabObjectFast(PlayerDeathHead deathHead) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown if (!((Object)deathHead == (Object)null) && DeathHeadPhysGrabObjectRef != null) { return DeathHeadPhysGrabObjectRef.Invoke(deathHead); } return null; } internal static Transform GetDeathHeadOverridePositionTransformFast(PlayerDeathHead deathHead) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown if (!((Object)deathHead == (Object)null) && DeathHeadOverridePositionTransformRef != null) { return DeathHeadOverridePositionTransformRef.Invoke(deathHead); } return null; } internal static bool TryGetDeathHeadTriggeredPositionFast(PlayerDeathHead deathHead, out Vector3 position) { //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: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) position = Vector3.zero; if ((Object)deathHead == (Object)null || DeathHeadTriggeredPositionRef == null) { return false; } position = DeathHeadTriggeredPositionRef.Invoke(deathHead); return ((Vector3)(ref position)).sqrMagnitude > 0.001f; } internal static PlayerAvatar GetSpectateCameraPlayerFast(SpectateCamera spectateCamera) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown if (!((Object)spectateCamera == (Object)null) && SpectateCameraPlayerRef != null) { return SpectateCameraPlayerRef.Invoke(spectateCamera); } return null; } internal static PlayerAvatar GetSpectateCameraPlayerOverrideFast(SpectateCamera spectateCamera) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown if (!((Object)spectateCamera == (Object)null) && SpectateCameraPlayerOverrideRef != null) { return SpectateCameraPlayerOverrideRef.Invoke(spectateCamera); } return null; } internal static Camera GetSpectateCameraMainCameraFast(SpectateCamera spectateCamera) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown if (!((Object)spectateCamera == (Object)null) && SpectateCameraMainCameraRef != null) { return SpectateCameraMainCameraRef.Invoke(spectateCamera); } return null; } internal static EnemyParent GetEnemyParentFast(Enemy enemy) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown if (!((Object)enemy == (Object)null) && EnemyParentRef != null) { return EnemyParentRef.Invoke(enemy); } return null; } internal static EnemyHealth GetEnemyHealthFast(Enemy enemy) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown if (!((Object)enemy == (Object)null) && EnemyHealthRef != null) { return EnemyHealthRef.Invoke(enemy); } return null; } internal static bool GetEnemyHealthDeadFast(EnemyHealth health) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown if ((Object)health != (Object)null && EnemyHealthDeadRef != null) { return EnemyHealthDeadRef.Invoke(health); } return false; } internal static bool GetEnemyParentSpawnedFast(EnemyParent parent) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown if (!((Object)parent == (Object)null) && EnemyParentSpawnedRef != null) { return EnemyParentSpawnedRef.Invoke(parent); } return true; } internal static Enemy GetEnemyParentEnemyFast(EnemyParent parent) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown if (!((Object)parent == (Object)null) && EnemyParentEnemyRef != null) { return EnemyParentEnemyRef.Invoke(parent); } return null; } internal static float GetValuableOriginalValueFast(ValuableObject valuable) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown if (!((Object)valuable == (Object)null) && ValuableOriginalValueRef != null) { return Mathf.Max(0f, ValuableOriginalValueRef.Invoke(valuable)); } return 0f; } internal static float GetValuableCurrentValueFast(ValuableObject valuable) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown if (!((Object)valuable == (Object)null) && ValuableCurrentValueRef != null) { return Mathf.Max(0f, ValuableCurrentValueRef.Invoke(valuable)); } return 0f; } internal static bool IsValuableValueSetFast(ValuableObject valuable) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown if ((Object)valuable != (Object)null) { if (ValuableValueSetRef != null) { return ValuableValueSetRef.Invoke(valuable); } return true; } return false; } internal static PhotonView GetValuablePhotonViewFast(ValuableObject valuable) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown if (!((Object)valuable == (Object)null) && ValuablePhotonViewRef != null) { return ValuablePhotonViewRef.Invoke(valuable); } return null; } internal static PhysGrabObject GetValuablePhysGrabObjectFast(ValuableObject valuable) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown if (!((Object)valuable == (Object)null) && ValuablePhysGrabObjectRef != null) { return ValuablePhysGrabObjectRef.Invoke(valuable); } return null; } internal static List<PhysGrabObject> GetCartItemsInCartFast(PhysGrabCart cart) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown if (!((Object)cart == (Object)null) && PhysGrabCartItemsInCartRef != null) { return PhysGrabCartItemsInCartRef.Invoke(cart); } return null; } internal static PhysGrabObject GetCartPhysGrabObjectFast(PhysGrabCart cart) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown if (!((Object)cart == (Object)null) && PhysGrabCartPhysGrabObjectRef != null) { return PhysGrabCartPhysGrabObjectRef.Invoke(cart); } return null; } internal static bool GetCartBeingPulledFast(PhysGrabCart cart) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown if ((Object)cart != (Object)null && PhysGrabCartBeingPulledRef != null) { return PhysGrabCartBeingPulledRef.Invoke(cart); } return false; } internal static State? GetCartStateFast(PhysGrabCart cart) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown if ((Object)cart == (Object)null || PhysGrabCartCurrentStateRef == null) { return null; } return PhysGrabCartCurrentStateRef.Invoke(cart); } internal static ItemEquippable GetCartItemEquippableFast(PhysGrabCart cart) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown if (!((Object)cart == (Object)null) && PhysGrabCartItemEquippableRef != null) { return PhysGrabCartItemEquippableRef.Invoke(cart); } return null; } internal static List<CartObject> GetPhysGrabInCartObjectsFast(PhysGrabInCart inCart) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown if (!((Object)inCart == (Object)null) && PhysGrabInCartObjectsRef != null) { return PhysGrabInCartObjectsRef.Invoke(inCart); } return null; } internal static ItemState? GetItemEquippableStateFast(ItemEquippable itemEquippable) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown if ((Object)itemEquippable == (Object)null || ItemEquippableCurrentStateRef == null) { return null; } return ItemEquippableCurrentStateRef.Invoke(itemEquippable); } internal static PhysGrabObject GetGrabberHeldObjectFast(PhysGrabber grabber) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown if (!((Object)grabber == (Object)null) && PhysGrabberGrabbedPhysGrabObjectRef != null) { return PhysGrabberGrabbedPhysGrabObjectRef.Invoke(grabber); } return null; } internal static bool GetGrabberIsPushingFast(PhysGrabber grabber) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown if ((Object)grabber != (Object)null && PhysGrabberIsPushingRef != null) { return PhysGrabberIsPushingRef.Invoke(grabber); } return false; } internal static bool GetGrabberIsPullingFast(PhysGrabber grabber) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown if ((Object)grabber != (Object)null && PhysGrabberIsPullingRef != null) { return PhysGrabberIsPullingRef.Invoke(grabber); } return false; } internal static WorldSpaceUIPlayerName GetPlayerWorldSpaceUiFast(PlayerAvatar player) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown if (!((Object)player == (Object)null) && PlayerWorldSpaceUIPlayerNameRef != null) { return PlayerWorldSpaceUIPlayerNameRef.Invoke(player); } return null; } internal static PlayerAvatar GetWorldSpaceUiPlayerAvatarFast(WorldSpaceUIPlayerName nameUi) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown if (!((Object)nameUi == (Object)null) && WsUiPlayerAvatarRef != null) { return WsUiPlayerAvatarRef.Invoke(nameUi); } return null; } internal static void SetWorldSpaceUiShowTimerFast(WorldSpaceUIPlayerName nameUi, float value) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown if (!((Object)nameUi == (Object)null) && WsUiShowTimerRef != null) { WsUiShowTimerRef.Invoke(nameUi) = value; } } internal static string GetItemAttribNameFast(ItemAttributes item) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown if (!((Object)item == (Object)null) && ItemAttribNameRef != null) { return ItemAttribNameRef.Invoke(item); } return null; } internal static string GetItemAttribPromptNameFast(ItemAttributes item) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown if (!((Object)item == (Object)null) && ItemAttribPromptNameRef != null) { return ItemAttribPromptNameRef.Invoke(item); } return null; } internal static string GetItemAttribAssetNameFast(ItemAttributes item) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown if (!((Object)item == (Object)null) && ItemAttribAssetNameRef != null) { return ItemAttribAssetNameRef.Invoke(item); } return null; } internal static string GetItemAttribInstanceNameFast(ItemAttributes item) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown if (!((Object)item == (Object)null) && ItemAttribInstanceNameRef != null) { return ItemAttribInstanceNameRef.Invoke(item); } return null; } internal static string GetItemAttribTagFast(ItemAttributes item) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown if (!((Object)item == (Object)null) && ItemAttribTagRef != null) { return ItemAttribTagRef.Invoke(item); } return null; } internal static string GetItemAttribTypeNameFast(ItemAttributes item) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown if ((Object)item == (Object)null || ItemAttribTypeRef == null) { return null; } return ((object)Unsafe.As<itemType, itemType>(ref ItemAttribTypeRef.Invoke(item))/*cast due to .constrained prefix*/).ToString(); } internal static VehicleSeat[] GetVehicleSeatsFast(ItemVehicle vehicle) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown if (!((Object)vehicle == (Object)null) && ItemVehicleSeatsRef != null) { return ItemVehicleSeatsRef.Invoke(vehicle); } return null; } internal static bool GetVehicleIsRacingFast(ItemVehicle vehicle) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown if ((Object)vehicle == (Object)null || ItemVehicleIsRacingRef == null) { return false; } return ItemVehicleIsRacingRef.Invoke(vehicle); } internal static bool GetVehicleHasRider(ItemVehicle vehicle) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown if ((Object)vehicle == (Object)null) { return false; } VehicleSeat[] vehicleSeatsFast = GetVehicleSeatsFast(vehicle); if (vehicleSeatsFast == null) { return false; } for (int i = 0; i < vehicleSeatsFast.Length; i++) { if (vehicleSeatsFast[i] != null && (Object)vehicleSeatsFast[i].seatedPlayer != (Object)null) { return true; } } return false; } internal static int GetRoundDirectorExtractionPointsFast(RoundDirector rd) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown if (!((Object)rd == (Object)null) && RoundDirectorExtractionPointsRef != null) { return RoundDirectorExtractionPointsRef.Invoke(rd); } return 0; } internal static int GetRoundDirectorExtractionPointsCompletedFast(RoundDirector rd) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown if (!((Object)rd == (Object)null) && RoundDirectorExtractionPointsCompletedRef != null) { return RoundDirectorExtractionPointsCompletedRef.Invoke(rd); } return 0; } private void ApplyValuableHaulPatch() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown try { valuableHaulHarmony = new Harmony("zichen.moreui.valuablehaul"); PatchValuableHaulMethod("AddToDollarHaulList", "ValuableDollarHaulAddPostfix"); PatchValuableHaulMethod("AddToDollarHaulListRPC", "ValuableDollarHaulAddPostfix"); PatchValuableHaulMethod("RemoveFromDollarHaulList", "ValuableDollarHaulRemovePostfix"); PatchValuableHaulMethod("RemoveFromDollarHaulListRPC", "ValuableDollarHaulRemovePostfix"); PatchValuableTrackingMethod(typeof(ValuableObject), "DollarValueSetLogic", "ValuableDollarValueSetLogicPostfix"); PatchValuableTrackingMethod(typeof(ValuableObject), "DollarValueSetRPC", "ValuableDollarValueSetRpcPostfix"); PatchValuableTrackingMethod(typeof(PhysGrabObjectImpactDetector), "BreakRPC", "ValuableBreakPostfix"); PatchValuableTrackingMethod(typeof(PhysGrabObject), "DestroyPhysGrabObjectRPC", "ValuableDestroyPhysGrabObjectPostfix"); PatchValuableTrackingMethod(typeof(RoundDirector), "ExtractionCompleted", "RoundDirectorExtractionCompletedPostfix"); PatchValuableTrackingMethod(typeof(LevelGenerator), "StartRoomGeneration", "LevelGeneratorStartRoomGenerationPrefix", prefix: true); PatchValuableTrackingMethod(typeof(LevelGenerator), "GenerateDone", "LevelGeneratorGenerateDonePostfix"); PatchValuableTrackingMethod(typeof(ValuableObject), "Start", "ValuableObjectStartPostfix"); PatchValuableTrackingMethod(typeof(PhysGrabCart), "Start", "PhysGrabCartStartPostfix"); PatchValuableTrackingMethod(typeof(ItemVehicle), "Start", "ItemVehicleStartPostfix"); PatchValuableTrackingMethod(typeof(PhysGrabber), "Start", "PhysGrabberStartPostfix"); PatchValuableTrackingMethod(typeof(PhysGrabber), "OnDestroy", "PhysGrabberOnDestroyPrefix", prefix: true); PatchValuableTrackingMethod(typeof(EnemyParent), "Awake", "EnemyParentAwakePostfix"); PatchValuableTrackingMethod(typeof(ItemAttributes), "Start", "ItemAttributesStartPostfix"); PatchValuableTrackingMethod(typeof(ItemAttributes), "OnDestroy", "ItemAttributesOnDestroyPrefix", prefix: true); PatchValuableTrackingMethod(typeof(ValuableDiscoverCustom), "Awake", "ValuableDiscoverCustomAwakePostfix"); PatchValuableTrackingMethod(typeof(CosmeticShopMachine), "Awake", "CosmeticShopMachineAwakePostfix"); Logger.LogInfo((object)"Valuable haul tracking patched."); } catch (Exception arg) { Logger.LogWarning((object)$"Failed to patch valuable haul tracking: {arg}"); } } private void PatchValuableHaulMethod(string originalName, string postfixName) { //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Expected O, but got Unknown MethodInfo methodInfo = AccessTools.Method(typeof(ValuableObject), originalName, (Type[])null, (Type[])null); MethodInfo methodInfo2 = AccessTools.Method(typeof(Plugin), postfixName, (Type[])null, (Type[])null); if (methodInfo == null || methodInfo2 == null) { Logger.LogWarning((object)("Failed to find valuable haul method patch target: " + originalName)); } else { valuableHaulHarmony.Patch((MethodBase)methodInfo, (HarmonyMethod)null, new HarmonyMethod(methodInfo2), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } } private void PatchValuableTrackingMethod(Type originalType, string originalName, string patchName, bool prefix = false) { //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Expected O, but got Unknown MethodInfo methodInfo = AccessTools.Method(originalType, originalName, (Type[])null, (Type[])null); MethodInfo methodInfo2 = AccessTools.Method(typeof(Plugin), patchName, (Type[])null, (Type[])null); if (methodInfo == null || methodInfo2 == null) { Logger.LogWarning((object)("Failed to find valuable tracking patch target: " + originalType?.Name + "." + originalName)); return; } HarmonyMethod val = new HarmonyMethod(methodInfo2); if (prefix) { valuableHaulHarmony.Patch((MethodBase)methodInfo, val, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } else { valuableHaulHarmony.Patch((MethodBase)methodInfo, (HarmonyMethod)null, val, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } } private static void ValuableDollarHaulAddPostfix(ValuableObject __instance) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown if (!((Object)__instance == (Object)null) && IsStaticModEnabled()) { valuablesCurrentlyInDollarHaul.Add(GetValuableKey(__instance)); } } private static void ValuableDollarHaulRemovePostfix(ValuableObject __instance) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown if (!((Object)__instance == (Object)null)