using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Text; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using Microsoft.CodeAnalysis; using TMPro; using UnityEngine; using UnityEngine.SceneManagement; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyCompany("Zichen-MoreUI")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+fbb1a4d755192614516015fd42e4c7a90e32abef")] [assembly: AssemblyProduct("Zichen-MoreUI")] [assembly: AssemblyTitle("Zichen-MoreUI")] [assembly: AssemblyVersion("1.0.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } public enum TeammateDisplayMode { 常显, 按键显示 } public enum DisplayMode { 文字显示, 原生UI显示 } public enum DisplayLanguage { 中文, English } [BepInPlugin("zichen.moreui", "A.MoreUI", "1.2.1")] public class Plugin : BaseUnityPlugin { public const string PluginGuid = "zichen.moreui"; public const string PluginVersion = "1.2.1"; public const string PluginName = "A.MoreUI"; private static Plugin Instance; private const float MinimumRefreshIntervalSeconds = 0.1f; private const float ProximityAutoShowLingerSeconds = 5f; private const float EnemyProximityPopSeconds = 1.2f; private const float EnemyProximityPopFontMultiplier = 2f; private const float RunLevelInactiveGraceSeconds = 4f; private const int PlayerHeadTopColorSlot = 5; private const float PlayerColorCacheRefreshSeconds = 0.2f; private const string TeammateIcon = "\ud83e\udd16"; private const string CartIcon = "\ud83d\uded2"; private const string ContactConfigSection = "模组信息"; private const string LanguageConfigSection = "A.全局设置"; private const string TeammateConfigSection = "B.好友局内显示"; private const string EnemyWorldConfigSection = "C.敌人局内显示"; private const string CartWorldConfigSection = "D.购物车局内显示"; private static readonly FieldInfo PlayerDeadSetField = typeof(PlayerAvatar).GetField("deadSet", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); private static readonly FieldInfo PlayerIsDisabledField = typeof(PlayerAvatar).GetField("isDisabled", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); private static readonly FieldInfo PlayerNameField = typeof(PlayerAvatar).GetField("playerName", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); private static readonly FieldInfo PlayerIsLocalField = typeof(PlayerAvatar).GetField("isLocal", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); private static readonly FieldInfo PlayerCosmeticsColorsEquippedField = typeof(PlayerCosmetics).GetField("colorsEquipped", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); private static readonly FieldInfo PlayerTransformField = typeof(PlayerAvatar).GetField("playerTransform", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); private static readonly FieldInfo PlayerDeathSpotField = typeof(PlayerAvatar).GetField("deathSpot", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); private static readonly FieldInfo PlayerDeathHeadField = typeof(PlayerAvatar).GetField("playerDeathHead", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); private static readonly FieldInfo PlayerLastNavmeshPositionField = typeof(PlayerAvatar).GetField("LastNavmeshPosition", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); private static readonly FieldInfo DeathHeadPhysGrabObjectField = typeof(PlayerDeathHead).GetField("physGrabObject", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); private static readonly FieldInfo DeathHeadTriggeredPositionField = typeof(PlayerDeathHead).GetField("triggeredPosition", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); private static readonly FieldInfo DeathHeadOverridePositionTransformField = typeof(PlayerDeathHead).GetField("overridePositionTransform", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); private static readonly FieldInfo SpectateCameraInstanceField = typeof(SpectateCamera).GetField("instance", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); private static readonly FieldInfo SpectateCameraPlayerField = typeof(SpectateCamera).GetField("player", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); private static readonly FieldInfo SpectateCameraPlayerOverrideField = typeof(SpectateCamera).GetField("playerOverride", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); private static readonly FieldInfo SpectateCameraMainCameraField = typeof(SpectateCamera).GetField("MainCamera", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); private static readonly FieldInfo EnemyParentField = typeof(Enemy).GetField("EnemyParent", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); private static readonly FieldInfo EnemyTypeField = typeof(Enemy).GetField("Type", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); private static readonly FieldInfo EnemyCenterTransformField = typeof(Enemy).GetField("CenterTransform", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); private static readonly FieldInfo EnemyParentNameField = typeof(EnemyParent).GetField("enemyName", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); private static readonly FieldInfo EnemyParentLocalizedNameField = typeof(EnemyParent).GetField("enemyNameLocalized", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); private static readonly MethodInfo LocalizedAssetGetStringMethod = typeof(LocalizedAsset).GetMethod("GetLocalizedString", Type.EmptyTypes); private static readonly FieldInfo EnemyParentSpawnedField = typeof(EnemyParent).GetField("Spawned", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); private static readonly FieldInfo EnemyHealthField = typeof(Enemy).GetField("Health", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); private static readonly FieldInfo EnemyHealthDeadField = typeof(EnemyHealth).GetField("dead", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); private static readonly FieldInfo GoalUiTextField = typeof(GoalUI).GetField("Text", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic) ?? typeof(GoalUI).GetField("uiText", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); private static readonly GUIContent ReusableGuiContent = new GUIContent(); private static readonly CultureInfo MoneyCulture = CultureInfo.GetCultureInfo("en-US"); private static readonly HashSet BoundsVisitedBuffer = new HashSet(); private static readonly List BoundsRendererBuffer = new List(); private static readonly List BoundsColliderBuffer = new List(); private static readonly Dictionary PlayerAliveFrameCache = new Dictionary(); private static int playerAliveFrameCacheFrame = -1; private static readonly FieldInfo ValuableOriginalValueField = typeof(ValuableObject).GetField("dollarValueOriginal", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); private static readonly FieldInfo ValuableCurrentValueField = typeof(ValuableObject).GetField("dollarValueCurrent", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); private static readonly FieldInfo ValuableValueSetField = typeof(ValuableObject).GetField("dollarValueSet", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); private static readonly FieldInfo ValuablePhotonViewField = typeof(ValuableObject).GetField("photonView", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); private static readonly FieldInfo ValuablePhysGrabObjectField = typeof(ValuableObject).GetField("physGrabObject", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); private static readonly FieldInfo PhysGrabCartItemsInCartField = typeof(PhysGrabCart).GetField("itemsInCart", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); private static readonly FieldInfo PhysGrabCartInCartField = typeof(PhysGrabCart).GetField("physGrabInCart", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); private static readonly FieldInfo PhysGrabInCartObjectsField = typeof(PhysGrabInCart).GetField("inCartObjects", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); private static readonly FieldInfo PhysGrabInCartCartObjectPhysGrabObjectField = typeof(PhysGrabInCart).GetNestedType("CartObject", BindingFlags.Public | BindingFlags.NonPublic)?.GetField("physGrabObject", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); private static readonly FieldInfo PhysGrabCartCurrentStateField = typeof(PhysGrabCart).GetField("currentState", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); private static readonly FieldInfo PhysGrabCartBeingPulledField = typeof(PhysGrabCart).GetField("cartBeingPulled", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); private static readonly FieldInfo PhysGrabCartActiveField = typeof(PhysGrabCart).GetField("cartActive", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); private static readonly FieldInfo PhysGrabCartIsSmallCartField = typeof(PhysGrabCart).GetField("isSmallCart", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); private static readonly FieldInfo PhysGrabCartItemEquippableField = typeof(PhysGrabCart).GetField("itemEquippable", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); private static readonly FieldInfo PhysGrabCartPhysGrabObjectField = typeof(PhysGrabCart).GetField("physGrabObject", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); private static readonly FieldInfo PhysGrabCartGrabPointField = typeof(PhysGrabCart).GetField("cartGrabPoint", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); private static readonly FieldInfo ItemEquippableCurrentStateField = typeof(ItemEquippable).GetField("currentState", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); private static readonly FieldInfo ItemEquippableIsEquippedField = typeof(ItemEquippable).GetField("isEquipped", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); private static readonly FieldInfo ItemEquippableIsEquippingField = typeof(ItemEquippable).GetField("isEquipping", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); private static readonly Dictionary EnemyBreakdownRankTable = new Dictionary(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 readonly FieldInfo PhysGrabObjectGrabbedField = typeof(PhysGrabObject).GetField("grabbed", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); private static readonly FieldInfo PhysGrabObjectPlayerGrabbingField = typeof(PhysGrabObject).GetField("playerGrabbing", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); private static readonly FieldInfo PhysGrabberGrabbedPhysGrabObjectField = typeof(PhysGrabber).GetField("grabbedPhysGrabObject", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); private static readonly FieldInfo PhysGrabberGrabbedField = typeof(PhysGrabber).GetField("grabbed", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); private static readonly FieldInfo PhysGrabberIsPushingField = typeof(PhysGrabber).GetField("isPushing", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); private static readonly FieldInfo PhysGrabberIsPullingField = typeof(PhysGrabber).GetField("isPulling", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); private static readonly FieldInfo RoundDirectorInstanceField = typeof(RoundDirector).GetField("instance", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); private static readonly FieldInfo RoundDirectorDollarHaulListField = typeof(RoundDirector).GetField("dollarHaulList", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); private static readonly FieldInfo RoundDirectorCurrentHaulField = typeof(RoundDirector).GetField("currentHaul", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); 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 ConfigEntry keyCaptureEntry; private static readonly HashSet valuablesCurrentlyInDollarHaul = new HashSet(); private static readonly Dictionary PhotonViewIdPropertyCache = new Dictionary(); private static readonly Dictionary PhotonViewIdFieldCache = new Dictionary(); private static readonly Dictionary PhotonViewOwnerPropertyCache = new Dictionary(); private static readonly Dictionary PhotonOwnerNickNamePropertyCache = new Dictionary(); private ConfigEntry moduleNameInfo; private ConfigEntry moduleVersionInfo; private ConfigEntry contactInfo; private ConfigEntry modEnabled; private ConfigEntry overlayEnabled; private ConfigEntry sectionSpacing; private ConfigEntry displayLanguage; private ConfigEntry enemyNicknameEnabled; private ConfigEntry displayMode; private ConfigEntry fontSize; private ConfigEntry updateInterval; private ConfigEntry overlayOffsetX; private ConfigEntry overlayOffsetY; private ConfigEntry showEnemySection; private ConfigEntry showBreakdown; private ConfigEntry showTotalEnemyCount; private ConfigEntry showValueSection; private ConfigEntry showMapLostValue; private ConfigEntry showExplorationProgress; private ConfigEntry showMapTotalValue; private ConfigEntry showCurrentRunSubmittedFunds; private ConfigEntry showShopRemainingFunds; private ConfigEntry showLevelInfo; private ConfigEntry showTeammateInfoSection; private ConfigEntry showDeadTeammates; private ConfigEntry showAliveTeammates; private ConfigEntry showPlayerCounts; private ConfigEntry teammateOverlayEnabled; private ConfigEntry teammateAliveOverlayEnabled; private ConfigEntry teammateDeadOverlayEnabled; private ConfigEntry teammateFontSize; private ConfigEntry teammateLabelHeightOffset; private ConfigEntry teammateFarFontShrinkPercent; private ConfigEntry teammateUpdateInterval; private ConfigEntry teammateDisplayMode; private ConfigEntry teammateToggleKey; private ConfigEntry teammateHoldSeconds; private ConfigEntry teammateProximityAutoShowEnabled; private ConfigEntry teammateProximityAutoShowDistance; private ConfigEntry enemyOverlayEnabled; private ConfigEntry enemyFontSize; private ConfigEntry enemyFarFontShrinkPercent; private ConfigEntry enemyUpdateInterval; private ConfigEntry enemyDisplayMode; private ConfigEntry enemyToggleKey; private ConfigEntry enemyHoldSeconds; private ConfigEntry enemyProximityAutoShowEnabled; private ConfigEntry enemyProximityAutoShowDistance; private ConfigEntry cartSectionEnabled; private ConfigEntry cartOverlayEnabled; private ConfigEntry smallCartOverlayEnabled; private ConfigEntry cartFontSize; private ConfigEntry cartFarFontShrinkPercent; private ConfigEntry cartLabelHeightOffset; private ConfigEntry cartUpdateInterval; private GameObject overlayObject; private GameObject overlayCanvasObject; private Canvas overlayCanvas; private RectTransform overlayRect; private TextMeshProUGUI overlayLabel; private Harmony valuableHaulHarmony; 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 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 enemyLabels = new List(); private readonly List cartDistanceCache = new List(); private readonly Dictionary enemyProximityPopTimers = new Dictionary(); private readonly HashSet enemiesInsideProximityRange = new HashSet(); private readonly HashSet currentEnemiesInsideProximityRange = new HashSet(); private readonly List reusableIntKeys = new List(); private readonly List reusableSnapshotKeys = new List(); private readonly HashSet liveValuableKeys = new HashSet(); private readonly Dictionary largeCartLabelIndices = new Dictionary(); private readonly Dictionary smallCartLabelIndices = new Dictionary(); private readonly Dictionary smallCartTypeCache = new Dictionary(); private readonly Dictionary centeredRichLabelStyleCache = new Dictionary(); private readonly Dictionary centeredShadowLabelStyleCache = new Dictionary(); private readonly Dictionary overlayRichStyleCache = new Dictionary(); private readonly Dictionary overlayShadowStyleCache = new Dictionary(); private readonly List activeEnemyBuffer = new List(); private readonly Dictionary enemyBreakdownBuffer = new Dictionary(); private readonly Dictionary enemyBreakdownRankBuffer = new Dictionary(); private readonly List> orderedEnemyBreakdownBuffer = new List>(); private readonly List enemyBreakdownLineBuffer = new List(); private readonly List monsterSectionPartsBuffer = new List(); private readonly List valueSectionPartsBuffer = new List(); private readonly List teammateSectionPartsBuffer = new List(); private readonly List evacuatedFundsLineBuffer = new List(); private readonly List overlayPartsBuffer = new List(); private readonly List currentDollarHaulObjectsBuffer = new List(); private readonly List currentCartObjectsBuffer = new List(); private readonly HashSet haulReferenceSetBuffer = new HashSet(ReferenceObjectComparer.Instance); private readonly HashSet cartReferenceSetBuffer = new HashSet(ReferenceObjectComparer.Instance); private readonly List activeCartBuffer = new List(); private readonly List cartLabelCandidateBuffer = new List(); private Enemy[] enemyObjectsFrameCache = Array.Empty(); private PhysGrabCart[] cartObjectsFrameCache = Array.Empty(); private PhysGrabber[] grabberObjectsFrameCache = Array.Empty(); private ValuableObject[] valuableObjectsFrameCache = Array.Empty(); private List playerObjectsFrameCache; private readonly Dictionary enemyDisplayNameCache = new Dictionary(); private readonly Dictionary playerNameCache = new Dictionary(); private readonly Dictionary playerColorCache = new Dictionary(); private readonly Dictionary playerLabelYOffsetCache = new Dictionary(); private readonly Dictionary enemyLabelYOffsetCache = new Dictionary(); private readonly Dictionary cartLabelYOffsetCache = new Dictionary(); private DisplayLanguage cachedEnemyDisplayNameLanguage; private bool cachedEnemyNicknameEnabled; private bool hasCachedEnemyDisplayNameLanguage; private float refreshTimer; private float keyNormalizeTimer; private float teammateVisibleTimer; private float teammateProximityVisibleTimer; private float teammateProximityRefreshTimer; private float enemyRefreshTimer; private float enemyProximityRefreshTimer; private float enemyVisibleTimer; private float enemyProximityVisibleTimer; 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 playerNameCacheFrame = -1; private bool cartDistanceCacheValid; private int cartLabelIndexLevelNumber = -1; private int nextLargeCartLabelIndex = 1; private int nextSmallCartLabelIndex = 1; private int trackedLevelNumber = -1; 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 valuableSnapshots = new Dictionary(); private DisplayLanguage CurrentLanguage { get { if (displayLanguage != null) { return displayLanguage.Value; } return DisplayLanguage.中文; } } private bool UseEnemyNicknameNames { get { if (CurrentLanguage == DisplayLanguage.中文 && enemyNicknameEnabled != null) { return enemyNicknameEnabled.Value; } return false; } } private void Awake() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Expected O, but got Unknown //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Expected O, but got Unknown //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Expected O, but got Unknown //IL_0323: Unknown result type (might be due to invalid IL or missing references) //IL_032d: Expected O, but got Unknown //IL_037a: Unknown result type (might be due to invalid IL or missing references) //IL_0384: Expected O, but got Unknown //IL_044d: Unknown result type (might be due to invalid IL or missing references) //IL_0457: Expected O, but got Unknown //IL_04f8: Unknown result type (might be due to invalid IL or missing references) //IL_0502: Expected O, but got Unknown //IL_05a4: Unknown result type (might be due to invalid IL or missing references) //IL_05ae: Expected O, but got Unknown //IL_0677: Unknown result type (might be due to invalid IL or missing references) //IL_0681: Expected O, but got Unknown //IL_0722: Unknown result type (might be due to invalid IL or missing references) //IL_072c: Expected O, but got Unknown //IL_0824: Unknown result type (might be due to invalid IL or missing references) //IL_082e: Expected O, but got Unknown //IL_0938: Unknown result type (might be due to invalid IL or missing references) //IL_0942: Expected O, but got Unknown //IL_096d: Unknown result type (might be due to invalid IL or missing references) //IL_0977: Expected O, but got Unknown //IL_09ab: Unknown result type (might be due to invalid IL or missing references) //IL_09b5: Expected O, but got Unknown //IL_09e5: Unknown result type (might be due to invalid IL or missing references) //IL_09ef: Expected O, but got Unknown //IL_0a1f: Unknown result type (might be due to invalid IL or missing references) //IL_0a29: Expected O, but got Unknown Instance = this; MakePluginHostPersistent(); Application.logMessageReceived += new LogCallback(OnUnityLogMessageReceived); moduleNameInfo = ((BaseUnityPlugin)this).Config.Bind("模组信息", "模组名称", "更多的UI显示", new ConfigDescription("当前模组的中文名称。此处只是提示,不影响功能。", (AcceptableValueBase)null, new object[1] { new ConfigurationManagerAttributes { Order = 1000, CustomDrawer = DrawContactInfo, ReadOnly = true } })); moduleNameInfo.Value = "更多的UI显示"; moduleVersionInfo = ((BaseUnityPlugin)this).Config.Bind("模组信息", "模组版本号", "1.2.1", new ConfigDescription("当前模组版本号。此处只是提示,不影响功能。", (AcceptableValueBase)null, new object[1] { new ConfigurationManagerAttributes { Order = 990, CustomDrawer = DrawContactInfo, ReadOnly = true } })); moduleVersionInfo.Value = "1.2.1"; contactInfo = ((BaseUnityPlugin)this).Config.Bind("模组信息", "REPO交流QQ群", "824639225", new ConfigDescription("REPO游戏交流、BUG反馈、优化建议、功能请求请加QQ群。此处只是提示,不影响功能。", (AcceptableValueBase)null, new object[1] { new ConfigurationManagerAttributes { Order = 980, CustomDrawer = DrawContactInfo, ReadOnly = true } })); contactInfo.Value = "824639225"; modEnabled = ((BaseUnityPlugin)this).Config.Bind("A.全局设置", "模组启用", true, ConfigDescriptionWithOrder("关闭后整个模组所有UI显示功能都不生效,包括右下角显示、队友/敌人距离、购物车距离、怪物统计和价值统计。", 990)); displayLanguage = ((BaseUnityPlugin)this).Config.Bind("A.全局设置", "语言/Language", DisplayLanguage.中文, ConfigDescriptionWithOrder("选择游戏内显示文本的语言。默认中文,English 会把怪物名称和右下角字段名切换为英文。", 980)); enemyNicknameEnabled = ((BaseUnityPlugin)this).Config.Bind("A.全局设置", "敌人名字优化", true, ConfigDescriptionWithOrder("默认开启。仅在语言为中文时生效,会把直接翻译的敌人名称优化成更顺口、更好辨认的中文名字;语言为 English 时始终显示英文。", 970)); teammateOverlayEnabled = ((BaseUnityPlugin)this).Config.Bind("B.好友局内显示", "启用", true, ConfigDescriptionWithOrder("在局内显示好友名字、距离和死亡状态。", 600)); teammateDeadOverlayEnabled = ((BaseUnityPlugin)this).Config.Bind("B.好友局内显示", "死亡好友显示", true, ConfigDescriptionWithOrder("开启后,局内显示死亡好友的名字和距离。", 599)); teammateAliveOverlayEnabled = ((BaseUnityPlugin)this).Config.Bind("B.好友局内显示", "存活好友显示", true, ConfigDescriptionWithOrder("开启后,局内显示存活好友的名字和距离。", 598)); teammateFontSize = ((BaseUnityPlugin)this).Config.Bind("B.好友局内显示", "字体大小", 22, ConfigDescriptionWithOrder("好友局内文字的字体大小。近距离显示不超过这个大小,远距离会按变小百分比缩小。", new AcceptableValueRange(8, 42), 590)); teammateFarFontShrinkPercent = ((BaseUnityPlugin)this).Config.Bind("B.好友局内显示", "远处字体变小/%", 30, new ConfigDescription("好友距离较远时,局内文字最多变小多少百分比。默认30表示最远显示为字体大小的70%。", (AcceptableValueBase)(object)new AcceptableValueRange(0, 75), new object[1] { new ConfigurationManagerAttributes { Order = 589 } })); teammateLabelHeightOffset = ((BaseUnityPlugin)this).Config.Bind("B.好友局内显示", "显示高度/米", 0.05f, new ConfigDescription("好友文字距离角色模型顶部额外抬高多少米。默认0.05米,数值越大文字越高。", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 0.5f), new object[1] { new ConfigurationManagerAttributes { Order = 585 } })); teammateDisplayMode = ((BaseUnityPlugin)this).Config.Bind("B.好友局内显示", "显示方式", TeammateDisplayMode.常显, ConfigDescriptionWithOrder("常显,或按键后显示一段时间。", 580)); teammateUpdateInterval = ((BaseUnityPlugin)this).Config.Bind("B.好友局内显示", "刷新间隔/秒", 0.5f, ConfigDescriptionWithOrder("每隔多少秒刷新一次好友局内信息。", new AcceptableValueRange(0.1f, 5f), 570)); teammateToggleKey = ((BaseUnityPlugin)this).Config.Bind("B.好友局内显示", "显示按键", "f", new ConfigDescription("按键显示模式下,按下后显示好友局内信息。可以填写 f、t、g、f1、mouse3 这类 KeyCode 名称。", (AcceptableValueBase)null, new object[1] { new ConfigurationManagerAttributes { Order = 560, CustomDrawer = DrawKeyBinding } })); teammateHoldSeconds = ((BaseUnityPlugin)this).Config.Bind("B.好友局内显示", "按键显示持续/秒", 5, ConfigDescriptionWithOrder("按下好友显示按键后,好友距离显示持续多少秒。", new AcceptableValueRange(1, 30), 550)); teammateProximityAutoShowEnabled = ((BaseUnityPlugin)this).Config.Bind("B.好友局内显示", "启用靠近自动显示", true, ConfigDescriptionWithOrder("开启后,只要有好友进入指定距离内,就会临时常显好友信息;好友离开范围后5秒恢复原显示方式。", 540)); teammateProximityAutoShowDistance = ((BaseUnityPlugin)this).Config.Bind("B.好友局内显示", "靠近自动显示距离/米", 20, new ConfigDescription("好友距离你多少米以内时自动临时常显。默认20米。", (AcceptableValueBase)(object)new AcceptableValueRange(1, 100), new object[1] { new ConfigurationManagerAttributes { Order = 530 } })); enemyOverlayEnabled = ((BaseUnityPlugin)this).Config.Bind("C.敌人局内显示", "启用", true, ConfigDescriptionWithOrder("在局内显示敌人名字和距离,统一使用红色。", 540)); enemyFontSize = ((BaseUnityPlugin)this).Config.Bind("C.敌人局内显示", "字体大小", 22, ConfigDescriptionWithOrder("敌人局内文字的字体大小。近距离显示不超过这个大小,远距离会按变小百分比缩小。", new AcceptableValueRange(8, 42), 530)); enemyFarFontShrinkPercent = ((BaseUnityPlugin)this).Config.Bind("C.敌人局内显示", "远处字体变小/%", 30, new ConfigDescription("敌人距离较远时,局内文字最多变小多少百分比。默认30表示最远显示为字体大小的70%。", (AcceptableValueBase)(object)new AcceptableValueRange(0, 75), new object[1] { new ConfigurationManagerAttributes { Order = 525 } })); enemyDisplayMode = ((BaseUnityPlugin)this).Config.Bind("C.敌人局内显示", "显示方式", TeammateDisplayMode.按键显示, ConfigDescriptionWithOrder("常显,或按键后显示一段时间。", 520)); enemyUpdateInterval = ((BaseUnityPlugin)this).Config.Bind("C.敌人局内显示", "刷新间隔/秒", 0.5f, ConfigDescriptionWithOrder("每隔多少秒刷新一次敌人局内信息。", new AcceptableValueRange(0.1f, 5f), 510)); enemyToggleKey = ((BaseUnityPlugin)this).Config.Bind("C.敌人局内显示", "显示按键", "f", new ConfigDescription("按键显示模式下,按下后显示敌人局内信息。可以填写 f、t、y、g、f1、mouse3 这类 KeyCode 名称。", (AcceptableValueBase)null, new object[1] { new ConfigurationManagerAttributes { Order = 500, CustomDrawer = DrawKeyBinding } })); enemyHoldSeconds = ((BaseUnityPlugin)this).Config.Bind("C.敌人局内显示", "按键显示持续/秒", 5, ConfigDescriptionWithOrder("按下敌人显示按键后,敌人局内信息显示持续多少秒。", new AcceptableValueRange(1, 30), 490)); enemyProximityAutoShowEnabled = ((BaseUnityPlugin)this).Config.Bind("C.敌人局内显示", "启用靠近自动显示", true, ConfigDescriptionWithOrder("开启后,只要有敌人进入指定距离内,就会临时常显敌人信息;敌人离开范围后5秒恢复原显示方式。", 480)); enemyProximityAutoShowDistance = ((BaseUnityPlugin)this).Config.Bind("C.敌人局内显示", "靠近自动显示距离/米", 20, new ConfigDescription("敌人距离你多少米以内时自动临时常显。默认20米。", (AcceptableValueBase)(object)new AcceptableValueRange(1, 100), new object[1] { new ConfigurationManagerAttributes { Order = 470 } })); cartSectionEnabled = ((BaseUnityPlugin)this).Config.Bind("D.购物车局内显示", "启用", true, ConfigDescriptionWithOrder("关闭后购物车局内显示全部不显示。", 530)); cartOverlayEnabled = ((BaseUnityPlugin)this).Config.Bind("D.购物车局内显示", "显示大购物车", true, ConfigDescriptionWithOrder("在大购物车上显示编号和距离。", 520)); smallCartOverlayEnabled = ((BaseUnityPlugin)this).Config.Bind("D.购物车局内显示", "显示小购物车", true, ConfigDescriptionWithOrder("在小购物车上显示编号和距离。", 518)); cartFontSize = ((BaseUnityPlugin)this).Config.Bind("D.购物车局内显示", "字体大小", 22, ConfigDescriptionWithOrder("购物车局内文字的字体大小。近距离显示不超过这个大小,远距离会按变小百分比缩小。", new AcceptableValueRange(8, 42), 515)); cartFarFontShrinkPercent = ((BaseUnityPlugin)this).Config.Bind("D.购物车局内显示", "远处字体变小/%", 30, new ConfigDescription("购物车距离较远时,局内文字最多变小多少百分比。默认30表示最远显示为字体大小的70%。", (AcceptableValueBase)(object)new AcceptableValueRange(0, 75), new object[1] { new ConfigurationManagerAttributes { Order = 513 } })); cartLabelHeightOffset = ((BaseUnityPlugin)this).Config.Bind("D.购物车局内显示", "显示高度/米", 0f, ConfigDescriptionWithOrder("购物车文字相对购物车模型底部的上下偏移。默认0米,显示在模型最底部。", new AcceptableValueRange(-0.5f, 0.5f), 510)); cartUpdateInterval = ((BaseUnityPlugin)this).Config.Bind("D.购物车局内显示", "刷新间隔/秒", 0.5f, ConfigDescriptionWithOrder("每隔多少秒刷新一次购物车位置和距离。数值越小越实时,数值越大越省性能。", new AcceptableValueRange(0.1f, 2f), 508)); overlayEnabled = ((BaseUnityPlugin)this).Config.Bind("E1.右下角基础设置", "启用", true, "是否在右下角显示额外信息。"); sectionSpacing = ((BaseUnityPlugin)this).Config.Bind("E1.右下角基础设置", "不同分区空行", true, "默认开启。开启后不同信息分区之间会插入一行空白。"); displayMode = ((BaseUnityPlugin)this).Config.Bind("E1.右下角基础设置", "显示模式", DisplayMode.文字显示, new ConfigDescription("可切换为文字显示或更贴近游戏的原生UI显示。", (AcceptableValueBase)null, new object[1] { new ConfigurationManagerAttributes { CustomDrawer = DrawDisplayMode } })); fontSize = ((BaseUnityPlugin)this).Config.Bind("E1.右下角基础设置", "字体大小", 22, new ConfigDescription("显示文字的字体大小。", (AcceptableValueBase)(object)new AcceptableValueRange(10, 36), Array.Empty())); updateInterval = ((BaseUnityPlugin)this).Config.Bind("E1.右下角基础设置", "刷新间隔/秒", 1.5f, new ConfigDescription("每隔多少秒刷新一次显示。", (AcceptableValueBase)(object)new AcceptableValueRange(0.1f, 10f), Array.Empty())); overlayOffsetX = ((BaseUnityPlugin)this).Config.Bind("E1.右下角基础设置", "右下角X偏移/像素", 0, new ConfigDescription("右下角信息的水平偏移。正数向左移动,负数向右移动。", (AcceptableValueBase)(object)new AcceptableValueRange(-600, 600), Array.Empty())); overlayOffsetY = ((BaseUnityPlugin)this).Config.Bind("E1.右下角基础设置", "右下角Y偏移/像素", 0, new ConfigDescription("右下角信息的垂直偏移。正数向上移动,负数向下移动。", (AcceptableValueBase)(object)new AcceptableValueRange(-600, 600), Array.Empty())); showEnemySection = ((BaseUnityPlugin)this).Config.Bind("E2.右下角怪物统计", "启用", true, "关闭后右下角怪物统计分区全部不显示。"); showBreakdown = ((BaseUnityPlugin)this).Config.Bind("E2.右下角怪物统计", "显示怪物明细", true, "显示每种怪物当前数量。"); showTotalEnemyCount = ((BaseUnityPlugin)this).Config.Bind("E2.右下角怪物统计", "显示怪物总数", true, "显示当前存活怪物总数。"); showValueSection = ((BaseUnityPlugin)this).Config.Bind("E3.右下角价值统计", "启用", true, ConfigDescriptionWithOrder("关闭后右下角价值统计分区全部不显示。", 770)); showExplorationProgress = ((BaseUnityPlugin)this).Config.Bind("E3.右下角价值统计", "显示已提取进度", true, ConfigDescriptionWithOrder("单独显示已提取进度。进度按地图初始总价值计算,已放到提取点或购物车的物资也算作已提取。", 760)); showMapLostValue = ((BaseUnityPlugin)this).Config.Bind("E3.右下角价值统计", "显示本局损失资金", true, ConfigDescriptionWithOrder("显示本局中已摔坏或丢失造成的资金损失。", 750)); showMapTotalValue = ((BaseUnityPlugin)this).Config.Bind("E3.右下角价值统计", "显示地图剩余资金", true, ConfigDescriptionWithOrder("显示当前地图剩余资金。已放到提取点的物品会被排除,购物车里和地图上未提取的物品仍会计入。", 740)); showCurrentRunSubmittedFunds = ((BaseUnityPlugin)this).Config.Bind("E3.右下角价值统计", "显示本局提交资金", true, ConfigDescriptionWithOrder("显示本局已经成功带走并结算的资金。仅放进提取点但未提取成功时不会计入。", 730)); showShopRemainingFunds = ((BaseUnityPlugin)this).Config.Bind("E3.右下角价值统计", "显示商店剩余资金", true, ConfigDescriptionWithOrder("显示商店剩余资金。此值只在每局开始读取一次快照,当前关卡提交物品不会让它上涨。", 720)); showLevelInfo = ((BaseUnityPlugin)this).Config.Bind("E3.右下角价值统计", "显示关卡信息", true, ConfigDescriptionWithOrder("显示当前关卡编号和名称,位于商店剩余资金下面。", 710)); showTeammateInfoSection = ((BaseUnityPlugin)this).Config.Bind("E4.右下角好友信息", "启用", true, ConfigDescriptionWithOrder("关闭后右下角好友信息分区全部不显示。", 670)); showDeadTeammates = ((BaseUnityPlugin)this).Config.Bind("E4.右下角好友信息", "显示死亡好友信息", true, ConfigDescriptionWithOrder("在右下角好友信息分区顶部显示死亡好友图标、名字和距离,距离越近越靠上。", 660)); showAliveTeammates = ((BaseUnityPlugin)this).Config.Bind("E4.右下角好友信息", "显示存活好友信息", true, ConfigDescriptionWithOrder("在右下角好友信息分区显示每个存活好友的名字和距离,距离越近越靠上。", 650)); showPlayerCounts = ((BaseUnityPlugin)this).Config.Bind("E4.右下角好友信息", "显示玩家数量", true, ConfigDescriptionWithOrder("在右下角好友信息分区最底部显示死亡、存活和总玩家数量。", 640)); NormalizeKeyConfigEntries(); ApplyValuableHaulPatch(); MoreUiApi.IsLoaded = true; ((BaseUnityPlugin)this).Logger.LogInfo((object)"moreui loaded."); } private void Update() { try { UpdateCore(); } catch (Exception ex) { ResetRuntimeDisplayState(); if (!hasLoggedUpdateError) { hasLoggedUpdateError = true; ((BaseUnityPlugin)this).Logger.LogWarning((object)("moreui update skipped after an error: " + ex.GetType().Name + ": " + ex.Message)); } } } private void UpdateCore() { keyNormalizeTimer += Time.deltaTime; if (keyNormalizeTimer >= 0.5f) { keyNormalizeTimer = 0f; NormalizeKeyConfigEntries(); } bool flag = IsRuntimeSessionActive(); if (!IsModEnabled() || !flag) { if (runtimeWasActive) { runtimeWasActive = false; ResetLossTracking(); MoreUiApi.ResetSnapshot(); ResetRuntimeDisplayState(); } return; } runtimeWasActive = true; refreshTimer += Time.deltaTime; UpdateTeammateOverlayState(); UpdateEnemyOverlayState(); UpdateCartDistanceCache(); bool flag2 = overlayEnabled.Value && displayMode.Value == DisplayMode.原生UI显示; if (refreshTimer >= ClampRefreshInterval((updateInterval == null) ? 1.5f : updateInterval.Value)) { refreshTimer = 0f; string text = BuildOverlayText(); overlayText = (overlayEnabled.Value ? text : string.Empty); if (flag2) { UpdateNativeOverlay(); } } if (flag2) { 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() { try { ((Component)this).transform.parent = null; ((Object)((Component)this).gameObject).hideFlags = (HideFlags)61; Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject); } catch (Exception ex) { ((BaseUnityPlugin)this).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 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"); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Valuable haul tracking patched."); } catch (Exception arg) { ((BaseUnityPlugin)this).Logger.LogWarning((object)$"Failed to patch valuable haul tracking: {arg}"); } } private void PatchValuableHaulMethod(string originalName, string postfixName) { //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0065: 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) { ((BaseUnityPlugin)this).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_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005e: 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) { ((BaseUnityPlugin)this).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) { if (!((Object)(object)__instance == (Object)null)) { valuablesCurrentlyInDollarHaul.Add(GetValuableKey(__instance)); } } private static void ValuableDollarHaulRemovePostfix(ValuableObject __instance) { if (!((Object)(object)__instance == (Object)null)) { valuablesCurrentlyInDollarHaul.Remove(GetValuableKey(__instance)); } } private static void ValuableDollarValueSetLogicPostfix(ValuableObject __instance) { if (IsRunLevelSafe()) { WzcMapValueService.RegisterValueSet(__instance, GetCurrentMapValueLevelNumber()); } } private static void ValuableDollarValueSetRpcPostfix(ValuableObject __instance, float value) { if (IsRunLevelSafe()) { WzcMapValueService.RegisterValueSet(__instance, value, GetCurrentMapValueLevelNumber()); } } private static void ValuableBreakPostfix(float valueLost, PhysGrabObjectImpactDetector __instance, bool _loseValue) { if (_loseValue && IsRunLevelSafe()) { WzcMapValueService.RegisterBreak(((Object)(object)__instance == (Object)null) ? null : ((Component)__instance).GetComponent(), valueLost, GetCurrentMapValueLevelNumber()); } } private static void ValuableDestroyPhysGrabObjectPostfix(PhysGrabObject __instance) { if (!((Object)(object)__instance == (Object)null) && IsRunLevelSafe()) { WzcMapValueService.RegisterDestroy(((Component)__instance).GetComponent(), GetCurrentMapValueLevelNumber()); } } private static void RoundDirectorExtractionCompletedPostfix() { if (IsRunLevelSafe()) { WzcMapValueService.SyncFromLiveValuables(GetValuableObjectsCachedForFrameStatic(), GetCurrentMapValueLevelNumber()); } } private static void LevelGeneratorStartRoomGenerationPrefix() { if ((Object)(object)Instance != (Object)null) { Instance.ResetLossTracking(); Instance.ClearCartLabelIndices(); Instance.ClearCartDistanceCache(); } else { valuablesCurrentlyInDollarHaul.Clear(); WzcMapValueService.Reset(); } } private static void LevelGeneratorGenerateDonePostfix() { WzcMapValueService.SyncFromLiveValuables(GetValuableObjectsCachedForFrameStatic(), GetCurrentMapValueLevelNumber()); } private string BuildOverlayText() { Enemy[] enemyObjectsCachedForFrame = GetEnemyObjectsCachedForFrame(); activeEnemyBuffer.Clear(); if (enemyObjectsCachedForFrame != null) { Enemy[] array = enemyObjectsCachedForFrame; foreach (Enemy val in array) { if (IsEnemyCountable(val)) { activeEnemyBuffer.Add(val); } } } List teammateInfos = CreateTeammateDistanceInfos(); enemyBreakdownBuffer.Clear(); enemyBreakdownRankBuffer.Clear(); foreach (Enemy item in activeEnemyBuffer) { string cachedEnemyDisplayName = GetCachedEnemyDisplayName(item); if (!string.IsNullOrWhiteSpace(cachedEnemyDisplayName)) { enemyBreakdownBuffer.TryGetValue(cachedEnemyDisplayName, out var value); enemyBreakdownBuffer[cachedEnemyDisplayName] = value + 1; int enemyBreakdownRank = GetEnemyBreakdownRank(item); if (!enemyBreakdownRankBuffer.TryGetValue(cachedEnemyDisplayName, out var value2) || enemyBreakdownRank < value2) { enemyBreakdownRankBuffer[cachedEnemyDisplayName] = enemyBreakdownRank; } } } orderedEnemyBreakdownBuffer.Clear(); foreach (KeyValuePair item2 in enemyBreakdownBuffer) { orderedEnemyBreakdownBuffer.Add(item2); } orderedEnemyBreakdownBuffer.Sort(CompareEnemyBreakdownEntry); DisplayLanguage currentLanguage = CurrentLanguage; bool flag = showEnemySection == null || showEnemySection.Value; bool flag2 = showValueSection == null || showValueSection.Value; bool flag3 = showTeammateInfoSection == null || showTeammateInfoSection.Value; string text = string.Empty; if (flag && showBreakdown.Value && orderedEnemyBreakdownBuffer.Count > 0) { enemyBreakdownLineBuffer.Clear(); foreach (KeyValuePair item3 in orderedEnemyBreakdownBuffer) { enemyBreakdownLineBuffer.Add($"{item3.Key}: {item3.Value}"); } text = string.Join("\n", enemyBreakdownLineBuffer); } string text2 = ((flag && showTotalEnemyCount.Value) ? $"{HudText.EnemyTotal(currentLanguage)}: {activeEnemyBuffer.Count}" : string.Empty); string text3 = string.Empty; string text4 = string.Empty; string text5 = string.Empty; string text6 = string.Empty; string empty = string.Empty; float mapValue = 0f; float initialMapValue = 0f; ValuableObject[] valuables = null; int num; if (flag2) { if (!showMapLostValue.Value && !showExplorationProgress.Value) { num = (showMapTotalValue.Value ? 1 : 0); if (num == 0) { goto IL_02ef; } } else { num = 1; } valuables = GetValuableObjectsCachedForFrame(); } else { num = 0; } goto IL_02ef; IL_02ef: int levelNumber = SemiFunc.RunGetLevelsCompleted() + 1; bool flag4 = num != 0 && WzcMapValueService.TryGetValues(valuables, levelNumber, out mapValue, out initialMapValue); float num2 = 0f; int num3 = 0; float unexploredValue = 0f; bool hasLiveValuableData = false; if (flag2 && flag4) { bool value3 = showMapLostValue.Value; bool value4 = showExplorationProgress.Value; bool value5 = showMapTotalValue.Value; float num4 = mapValue; if (value3 || value4 || value5) { FillCurrentDollarHaulObjects(currentDollarHaulObjectsBuffer); FillReferenceSet(currentDollarHaulObjectsBuffer, haulReferenceSetBuffer); if (value5) { num4 = CalculateRemainingMapValue(mapValue, valuables, haulReferenceSetBuffer); } if (value3) { num2 = UpdateAndGetLostMapValue(mapValue, valuables, haulReferenceSetBuffer); } if (value4) { FillCurrentCartObjects(currentCartObjectsBuffer); FillReferenceSet(currentCartObjectsBuffer, cartReferenceSetBuffer); num3 = CalculateExplorationProgress(mapValue, initialMapValue, valuables, haulReferenceSetBuffer, cartReferenceSetBuffer, out unexploredValue, out hasLiveValuableData); } } text3 = (showMapLostValue.Value ? (HudText.MapLostValue(currentLanguage) + ": " + FormatMoney(num2)) : string.Empty); text4 = (showExplorationProgress.Value ? BuildExplorationProgressLine(currentLanguage, num3) : string.Empty); text5 = (showExplorationProgress.Value ? BuildUnextractedFundsLine(currentLanguage, CalculateUnextractedFunds(initialMapValue, num3, unexploredValue, hasLiveValuableData)) : string.Empty); mapValue = num4; text6 = (showMapTotalValue.Value ? BuildMapValueLine(currentLanguage, mapValue) : string.Empty); } else if (flag2 && (showMapLostValue.Value || showExplorationProgress.Value || showMapTotalValue.Value)) { text4 = (showExplorationProgress.Value ? BuildExplorationProgressLine(currentLanguage, 0) : string.Empty); text5 = (showExplorationProgress.Value ? BuildUnextractedFundsLine(currentLanguage, 0f) : string.Empty); text3 = (showMapLostValue.Value ? (HudText.MapLostValue(currentLanguage) + ": " + FormatMoney(0f)) : string.Empty); text6 = (showMapTotalValue.Value ? BuildMapValueLine(currentLanguage, 0f) : string.Empty); empty = string.Empty; } float shopRemainingFunds = (flag2 ? GetShopRemainingFundsSnapshot() : 0f); float currentLevelFunds = (flag2 ? GetCurrentLevelSubmittedValue() : 0f); evacuatedFundsLineBuffer.Clear(); if (flag2) { BuildEvacuatedFundsLines(currentLanguage, shopRemainingFunds, currentLevelFunds, evacuatedFundsLineBuffer); } string text7 = ((flag2 && showLevelInfo.Value) ? BuildLevelLine() : string.Empty); monsterSectionPartsBuffer.Clear(); valueSectionPartsBuffer.Clear(); teammateSectionPartsBuffer.Clear(); if (flag3) { BuildRightBottomTeammateInfoParts(teammateInfos, teammateSectionPartsBuffer); } if (!string.IsNullOrWhiteSpace(text)) { monsterSectionPartsBuffer.Add(text); } if (!string.IsNullOrWhiteSpace(text2)) { monsterSectionPartsBuffer.Add(text2); } if (!string.IsNullOrWhiteSpace(text4)) { valueSectionPartsBuffer.Add(text4); } if (!string.IsNullOrWhiteSpace(text5)) { valueSectionPartsBuffer.Add(text5); } if (!string.IsNullOrWhiteSpace(text6)) { valueSectionPartsBuffer.Add(text6); } if (!string.IsNullOrWhiteSpace(empty)) { valueSectionPartsBuffer.Add(empty); } if (!string.IsNullOrWhiteSpace(text3)) { valueSectionPartsBuffer.Add(text3); } if (evacuatedFundsLineBuffer.Count > 0) { valueSectionPartsBuffer.AddRange(evacuatedFundsLineBuffer); } if (!string.IsNullOrWhiteSpace(text7)) { valueSectionPartsBuffer.Add(text7); } overlayPartsBuffer.Clear(); AppendSection(overlayPartsBuffer, monsterSectionPartsBuffer); AppendSection(overlayPartsBuffer, valueSectionPartsBuffer); AppendSection(overlayPartsBuffer, teammateSectionPartsBuffer); string text8 = string.Join("\n", overlayPartsBuffer); UpdateApiSnapshot(currentLanguage, text8, activeEnemyBuffer.Count, enemyBreakdownBuffer, flag4, mapValue, initialMapValue, unexploredValue, hasLiveValuableData, num3, num2, currentLevelFunds, shopRemainingFunds, teammateInfos, activeEnemyBuffer); return text8; } private int CompareEnemyBreakdownEntry(KeyValuePair left, KeyValuePair right) { int value; int num = (enemyBreakdownRankBuffer.TryGetValue(left.Key, out value) ? value : int.MaxValue); int value2; int value3 = (enemyBreakdownRankBuffer.TryGetValue(right.Key, out value2) ? value2 : int.MaxValue); int num2 = num.CompareTo(value3); if (num2 != 0) { return num2; } return string.Compare(left.Key, right.Key, StringComparison.Ordinal); } private void UpdateApiSnapshot(DisplayLanguage language, string overlayTextValue, int enemyTotalCount, Dictionary enemyBreakdown, bool mapValueAvailable, float mapValue, float initialMapValue, float unexploredMapValue, bool hasLiveValuableData, int explorationProgressPercent, float lostValue, float currentLevelFunds, float shopRemainingFunds, List teammateInfos, List activeEnemies) { GetLevelInfo(language, out var levelNumber, out var levelName); GetPlayerCountsFromTeammateInfos(teammateInfos, out var totalPlayers, out var alivePlayers, out var deadPlayers); int capacity = teammateInfos?.Count ?? 0; List list = new List(capacity); List list2 = new List(capacity); if (teammateInfos != null) { foreach (MoreUiPlayerDistance teammateInfo in teammateInfos) { if (teammateInfo != null) { if (teammateInfo.IsDead) { list2.Add(teammateInfo); } else { list.Add(teammateInfo); } } } } MoreUiApi.UpdateSnapshot(new MoreUiSnapshot { IsInRun = true, Language = language.ToString(), DisplayMode = ((displayMode != null) ? displayMode.Value : DisplayMode.文字显示).ToString(), OverlayText = (overlayTextValue ?? string.Empty), EnemyTotalCount = enemyTotalCount, EnemyBreakdown = ((enemyBreakdown == null) ? new Dictionary() : new Dictionary(enemyBreakdown)), MapValueAvailable = mapValueAvailable, MapValue = mapValue, InitialMapValue = initialMapValue, UnexploredMapValue = unexploredMapValue, HasLiveValuableData = hasLiveValuableData, ExplorationProgressPercent = explorationProgressPercent, LostMapValue = lostValue, CurrentRunEvacuatedFunds = currentLevelFunds, CurrentRunSubmittedFunds = currentLevelFunds, WarehouseFunds = shopRemainingFunds, ShopRemainingFunds = shopRemainingFunds, LevelNumber = levelNumber, LevelName = (levelName ?? string.Empty), TotalPlayerCount = totalPlayers, AlivePlayerCount = alivePlayers, DeadPlayerCount = deadPlayers, AliveTeammates = list, DeadTeammates = list2, Enemies = CreateEnemyDistanceInfos(activeEnemies), Carts = new List(cartDistanceCache), Settings = CreateApiSettings(), UpdatedFrame = Time.frameCount, UpdatedAtUtc = DateTime.UtcNow }); } private void GetPlayerCountsFromTeammateInfos(List teammateInfos, out int totalPlayers, out int alivePlayers, out int deadPlayers) { List playerObjectsCachedForFrame = GetPlayerObjectsCachedForFrame(); PlayerAvatar localPlayer = GetLocalPlayer(playerObjectsCachedForFrame); if (playerObjectsCachedForFrame == null || (Object)(object)localPlayer == (Object)null || teammateInfos == null) { GetPlayerCounts(out totalPlayers, out alivePlayers, out deadPlayers); return; } totalPlayers = playerObjectsCachedForFrame.Count; deadPlayers = 0; foreach (MoreUiPlayerDistance teammateInfo in teammateInfos) { if (teammateInfo != null && teammateInfo.IsDead) { deadPlayers++; } } alivePlayers = Math.Max(0, totalPlayers - deadPlayers); } private MoreUiDisplaySettings CreateApiSettings() { return new MoreUiDisplaySettings { ModEnabled = IsModEnabled(), OverlayEnabled = (overlayEnabled != null && overlayEnabled.Value), SectionSpacing = (sectionSpacing != null && sectionSpacing.Value), Language = CurrentLanguage.ToString(), EnemyNicknameNamesEnabled = UseEnemyNicknameNames, DisplayMode = ((displayMode != null) ? displayMode.Value : DisplayMode.文字显示).ToString(), FontSize = ((fontSize == null) ? 22 : fontSize.Value), UpdateIntervalSeconds = ClampRefreshInterval((updateInterval == null) ? 0.5f : updateInterval.Value), OverlayOffsetX = ((overlayOffsetX != null) ? overlayOffsetX.Value : 0), OverlayOffsetY = ((overlayOffsetY != null) ? overlayOffsetY.Value : 0), ShowEnemySection = (showEnemySection == null || showEnemySection.Value), ShowEnemyBreakdown = (showBreakdown != null && showBreakdown.Value), ShowEnemyTotal = (showTotalEnemyCount != null && showTotalEnemyCount.Value), ShowValueSection = (showValueSection == null || showValueSection.Value), ShowMapLostValue = (showMapLostValue != null && showMapLostValue.Value), ShowExplorationProgress = (showExplorationProgress != null && showExplorationProgress.Value), ShowMapTotalValue = (showMapTotalValue != null && showMapTotalValue.Value), ShowCurrentRunSubmittedFunds = (showCurrentRunSubmittedFunds != null && showCurrentRunSubmittedFunds.Value), ShowShopRemainingFunds = (showShopRemainingFunds != null && showShopRemainingFunds.Value), ShowEvacuatedFunds = ((showCurrentRunSubmittedFunds != null && showCurrentRunSubmittedFunds.Value) || (showShopRemainingFunds != null && showShopRemainingFunds.Value)), ShowLevelInfo = (showLevelInfo != null && showLevelInfo.Value), ShowTeammateInfoSection = (showTeammateInfoSection == null || showTeammateInfoSection.Value), ShowDeadTeammates = (showDeadTeammates != null && showDeadTeammates.Value), ShowAliveTeammates = (showAliveTeammates != null && showAliveTeammates.Value), ShowPlayerCounts = (showPlayerCounts != null && showPlayerCounts.Value), TeammateOverlayEnabled = (teammateOverlayEnabled != null && teammateOverlayEnabled.Value), TeammateAliveOverlayEnabled = (teammateAliveOverlayEnabled == null || teammateAliveOverlayEnabled.Value), TeammateDeadOverlayEnabled = (teammateDeadOverlayEnabled == null || teammateDeadOverlayEnabled.Value), TeammateFontSize = ((teammateFontSize == null) ? 22 : teammateFontSize.Value), TeammateLabelHeightOffsetMeters = ((teammateLabelHeightOffset == null) ? 0.05f : teammateLabelHeightOffset.Value), TeammateFarFontShrinkPercent = ((teammateFarFontShrinkPercent == null) ? 30 : teammateFarFontShrinkPercent.Value), TeammateUpdateIntervalSeconds = ClampRefreshInterval((teammateUpdateInterval == null) ? 0.2f : teammateUpdateInterval.Value), TeammateDisplayMode = ((teammateDisplayMode != null) ? teammateDisplayMode.Value : TeammateDisplayMode.常显).ToString(), TeammateToggleKey = ((teammateToggleKey == null) ? "f" : SanitizeConfiguredKeyName(teammateToggleKey.Value)), TeammateHoldSeconds = ((teammateHoldSeconds == null) ? 5 : teammateHoldSeconds.Value), TeammateProximityAutoShowEnabled = (teammateProximityAutoShowEnabled != null && teammateProximityAutoShowEnabled.Value), TeammateProximityAutoShowDistanceMeters = ((teammateProximityAutoShowDistance == null) ? 20 : teammateProximityAutoShowDistance.Value), EnemyOverlayEnabled = (enemyOverlayEnabled != null && enemyOverlayEnabled.Value), EnemyFontSize = ((enemyFontSize == null) ? 22 : enemyFontSize.Value), EnemyFarFontShrinkPercent = ((enemyFarFontShrinkPercent == null) ? 30 : enemyFarFontShrinkPercent.Value), EnemyUpdateIntervalSeconds = ClampRefreshInterval((enemyUpdateInterval == null) ? 0.2f : enemyUpdateInterval.Value), EnemyDisplayMode = ((enemyDisplayMode == null) ? TeammateDisplayMode.按键显示 : enemyDisplayMode.Value).ToString(), EnemyToggleKey = ((enemyToggleKey == null) ? "f" : SanitizeConfiguredKeyName(enemyToggleKey.Value)), EnemyHoldSeconds = ((enemyHoldSeconds == null) ? 5 : enemyHoldSeconds.Value), EnemyProximityAutoShowEnabled = (enemyProximityAutoShowEnabled != null && enemyProximityAutoShowEnabled.Value), EnemyProximityAutoShowDistanceMeters = ((enemyProximityAutoShowDistance == null) ? 20 : enemyProximityAutoShowDistance.Value), CartSectionEnabled = (cartSectionEnabled == null || cartSectionEnabled.Value), CartOverlayEnabled = (cartOverlayEnabled != null && cartOverlayEnabled.Value), SmallCartOverlayEnabled = (smallCartOverlayEnabled != null && smallCartOverlayEnabled.Value), CartFontSize = ((cartFontSize == null) ? 22 : cartFontSize.Value), CartFarFontShrinkPercent = ((cartFarFontShrinkPercent == null) ? 30 : cartFarFontShrinkPercent.Value), CartLabelHeightOffsetMeters = ((cartLabelHeightOffset == null) ? 0f : cartLabelHeightOffset.Value), CartUpdateIntervalSeconds = ClampRefreshInterval((cartUpdateInterval == null) ? 0.5f : cartUpdateInterval.Value) }; } private void BuildRightBottomTeammateInfoParts(List teammateInfos, List parts) { string text = (showPlayerCounts.Value ? BuildPlayerCountLine() : string.Empty); if (showDeadTeammates.Value) { AppendTeammateDistanceLines(teammateInfos, deadOnly: true, parts); } if (showAliveTeammates.Value) { AppendTeammateDistanceLines(teammateInfos, deadOnly: false, parts); } if (!string.IsNullOrWhiteSpace(text)) { parts.Add(text); } } private void UpdateTeammateOverlayState() { if (!teammateOverlayEnabled.Value) { teammateVisibleTimer = 0f; teammateProximityVisibleTimer = 0f; teammateProximityRefreshTimer = 0f; return; } if (teammateDisplayMode.Value == TeammateDisplayMode.按键显示 && IsConfiguredKeyDown(teammateToggleKey.Value)) { teammateVisibleTimer = Mathf.Max(0.1f, (float)teammateHoldSeconds.Value); } if (teammateDisplayMode.Value == TeammateDisplayMode.按键显示 && teammateVisibleTimer > 0f) { teammateVisibleTimer -= Time.deltaTime; } UpdateTeammateProximityAutoShowState(); } private void UpdateEnemyOverlayState() { if (!enemyOverlayEnabled.Value) { enemyLabels.Clear(); ClearEnemyProximityTracking(); enemyVisibleTimer = 0f; enemyProximityVisibleTimer = 0f; return; } if (enemyDisplayMode.Value == TeammateDisplayMode.按键显示 && IsConfiguredKeyDown(enemyToggleKey.Value)) { enemyVisibleTimer = Mathf.Max(0.1f, (float)enemyHoldSeconds.Value); } if (enemyDisplayMode.Value == TeammateDisplayMode.按键显示 && enemyVisibleTimer > 0f) { enemyVisibleTimer -= Time.deltaTime; } bool flag = UpdateEnemyProximityAutoShowState(); UpdateEnemyProximityPopTimers(); if (!(enemyDisplayMode.Value == TeammateDisplayMode.常显 || enemyVisibleTimer > 0f || flag)) { enemyLabels.Clear(); return; } enemyRefreshTimer += Time.deltaTime; if (enemyRefreshTimer >= ClampRefreshInterval((enemyUpdateInterval == null) ? 0.5f : enemyUpdateInterval.Value)) { enemyRefreshTimer = 0f; RefreshEnemyLabels(); } } private void UpdateTeammateProximityAutoShowState() { if (teammateProximityAutoShowEnabled == null || !teammateProximityAutoShowEnabled.Value) { teammateProximityVisibleTimer = 0f; teammateProximityRefreshTimer = 0f; return; } bool num = teammateAliveOverlayEnabled == null || teammateAliveOverlayEnabled.Value; bool flag = teammateDeadOverlayEnabled == null || teammateDeadOverlayEnabled.Value; if (!num && !flag) { teammateProximityVisibleTimer = 0f; teammateProximityRefreshTimer = 0f; return; } teammateProximityRefreshTimer += Time.deltaTime; float num2 = ClampRefreshInterval((teammateUpdateInterval == null) ? 0.5f : teammateUpdateInterval.Value); if (teammateProximityRefreshTimer >= num2) { teammateProximityRefreshTimer = 0f; if (HasTeammateWithinDistance(teammateProximityAutoShowDistance.Value)) { teammateProximityVisibleTimer = 5f; } else if (teammateProximityVisibleTimer > 0f) { teammateProximityVisibleTimer -= num2; } } else if (teammateProximityVisibleTimer > 0f) { teammateProximityVisibleTimer -= Time.deltaTime; } } private bool UpdateEnemyProximityAutoShowState() { if (enemyProximityAutoShowEnabled == null || !enemyProximityAutoShowEnabled.Value) { enemyProximityVisibleTimer = 0f; ClearEnemyProximityTracking(); return false; } enemyProximityRefreshTimer += Time.deltaTime; float num = ClampRefreshInterval((enemyUpdateInterval == null) ? 0.5f : enemyUpdateInterval.Value); bool flag = false; bool flag2 = enemiesInsideProximityRange.Count > 0; if (enemyProximityRefreshTimer >= num) { enemyProximityRefreshTimer = 0f; flag = true; flag2 = UpdateEnemiesWithinProximityDistance(enemyProximityAutoShowDistance.Value); } if (flag2) { enemyProximityVisibleTimer = 5f; } else if (enemyProximityVisibleTimer > 0f && flag) { enemyProximityVisibleTimer -= num; } return enemyProximityVisibleTimer > 0f; } private bool HasTeammateWithinDistance(float distance) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) if (distance <= 0f) { return false; } List playerObjectsCachedForFrame = GetPlayerObjectsCachedForFrame(); PlayerAvatar localPlayer = GetLocalPlayer(playerObjectsCachedForFrame); if (playerObjectsCachedForFrame == null || (Object)(object)localPlayer == (Object)null) { return false; } Vector3 playerDistanceOrigin = GetPlayerDistanceOrigin(localPlayer, IsPlayerAlive(localPlayer)); float num = distance * distance; bool flag = teammateAliveOverlayEnabled == null || teammateAliveOverlayEnabled.Value; bool flag2 = teammateDeadOverlayEnabled == null || teammateDeadOverlayEnabled.Value; foreach (PlayerAvatar item in playerObjectsCachedForFrame) { if ((Object)(object)item == (Object)null || item == localPlayer) { continue; } bool flag3 = IsPlayerAlive(item); if ((!flag3 || flag) && (flag3 || flag2)) { Vector3 val = GetPlayerReferencePosition(item, !flag3) - playerDistanceOrigin; if (((Vector3)(ref val)).sqrMagnitude <= num) { return true; } } } return false; } private bool UpdateEnemiesWithinProximityDistance(float distance) { //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) if (distance <= 0f) { enemiesInsideProximityRange.Clear(); return false; } if (!TryGetEnemyDistanceOrigin(out var origin)) { enemiesInsideProximityRange.Clear(); return false; } Enemy[] enemyObjectsCachedForFrame = GetEnemyObjectsCachedForFrame(); if (enemyObjectsCachedForFrame == null || enemyObjectsCachedForFrame.Length == 0) { enemiesInsideProximityRange.Clear(); return false; } float num = distance * distance; currentEnemiesInsideProximityRange.Clear(); Enemy[] array = enemyObjectsCachedForFrame; foreach (Enemy enemy in array) { if (!IsEnemyCountable(enemy)) { continue; } Vector3 val = GetEnemyReferencePosition(enemy) - origin; if (((Vector3)(ref val)).sqrMagnitude <= num) { int enemyKey = GetEnemyKey(enemy); currentEnemiesInsideProximityRange.Add(enemyKey); if (!enemiesInsideProximityRange.Contains(enemyKey)) { enemyProximityPopTimers[enemyKey] = 1.2f; } } } enemiesInsideProximityRange.Clear(); foreach (int item in currentEnemiesInsideProximityRange) { enemiesInsideProximityRange.Add(item); } bool result = currentEnemiesInsideProximityRange.Count > 0; currentEnemiesInsideProximityRange.Clear(); return result; } private void UpdateEnemyProximityPopTimers() { if (enemyProximityPopTimers.Count == 0) { return; } reusableIntKeys.Clear(); foreach (int key in enemyProximityPopTimers.Keys) { reusableIntKeys.Add(key); } foreach (int reusableIntKey in reusableIntKeys) { float num = enemyProximityPopTimers[reusableIntKey] - Time.deltaTime; if (num <= 0f) { enemyProximityPopTimers.Remove(reusableIntKey); } else { enemyProximityPopTimers[reusableIntKey] = num; } } } private void ClearEnemyProximityTracking() { enemyProximityRefreshTimer = 0f; enemyProximityPopTimers.Clear(); enemiesInsideProximityRange.Clear(); currentEnemiesInsideProximityRange.Clear(); } private void UpdateCartDistanceCache() { if (!ShouldDrawCartWorldLabels()) { ClearCartDistanceCache(); return; } cartRefreshTimer += Time.deltaTime; float num = ClampRefreshInterval((cartUpdateInterval == null) ? 0.25f : cartUpdateInterval.Value); if (!cartDistanceCacheValid || !(cartRefreshTimer < num)) { cartRefreshTimer = 0f; cartDistanceCache.Clear(); FillCartDistanceInfos(cartDistanceCache); cartDistanceCacheValid = true; } } private void ClearCartDistanceCache() { cartRefreshTimer = 0f; cartDistanceCacheValid = false; cartDistanceCache.Clear(); } private Enemy[] GetEnemyObjectsCachedForFrame() { int frameCount = Time.frameCount; if (enemyObjectsFrameCacheFrame == frameCount && enemyObjectsFrameCache != null) { return enemyObjectsFrameCache; } enemyObjectsFrameCacheFrame = frameCount; enemyObjectsFrameCache = Resources.FindObjectsOfTypeAll() ?? Array.Empty(); return enemyObjectsFrameCache; } private PhysGrabCart[] GetCartObjectsCachedForFrame() { int frameCount = Time.frameCount; if (cartObjectsFrameCacheFrame == frameCount && cartObjectsFrameCache != null) { return cartObjectsFrameCache; } cartObjectsFrameCacheFrame = frameCount; cartObjectsFrameCache = Object.FindObjectsOfType(true) ?? Array.Empty(); return cartObjectsFrameCache; } private PhysGrabber[] GetGrabberObjectsCachedForFrame() { int frameCount = Time.frameCount; if (grabberObjectsFrameCacheFrame == frameCount && grabberObjectsFrameCache != null) { return grabberObjectsFrameCache; } grabberObjectsFrameCacheFrame = frameCount; grabberObjectsFrameCache = Object.FindObjectsOfType(true) ?? Array.Empty(); return grabberObjectsFrameCache; } private ValuableObject[] GetValuableObjectsCachedForFrame() { int frameCount = Time.frameCount; if (valuableObjectsFrameCacheFrame == frameCount && valuableObjectsFrameCache != null) { return valuableObjectsFrameCache; } valuableObjectsFrameCacheFrame = frameCount; valuableObjectsFrameCache = Object.FindObjectsOfType() ?? Array.Empty(); return valuableObjectsFrameCache; } private static ValuableObject[] GetValuableObjectsCachedForFrameStatic() { ValuableObject[] array; if (!((Object)(object)Instance != (Object)null)) { array = Object.FindObjectsOfType(); if (array == null) { return Array.Empty(); } } else { array = Instance.GetValuableObjectsCachedForFrame(); } return array; } private List GetPlayerObjectsCachedForFrame() { int frameCount = Time.frameCount; if (playerObjectsFrameCacheFrame == frameCount) { return playerObjectsFrameCache; } playerObjectsFrameCacheFrame = frameCount; try { playerObjectsFrameCache = SemiFunc.PlayerGetAll(); } catch { playerObjectsFrameCache = null; } return playerObjectsFrameCache; } private static int GetEnemyKey(Enemy enemy) { if (!((Object)(object)enemy == (Object)null)) { return ((Object)enemy).GetInstanceID(); } return 0; } private bool TryGetEnemyDistanceOrigin(out Vector3 origin) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) try { PlayerAvatar localPlayer = GetLocalPlayer(GetPlayerObjectsCachedForFrame()); if ((Object)(object)localPlayer != (Object)null) { origin = GetPlayerDistanceOrigin(localPlayer, IsPlayerAlive(localPlayer)); return true; } } catch { } Camera worldLabelCamera = GetWorldLabelCamera(); if ((Object)(object)worldLabelCamera != (Object)null) { origin = ((Component)worldLabelCamera).transform.position; return true; } origin = Vector3.zero; return false; } private static int GetEnemyBreakdownRank(Enemy enemy) { string key = NormalizeEnemyBreakdownKey(GetEnemyRawSortName(enemy)); if (!EnemyBreakdownRankTable.TryGetValue(key, out var value)) { return 999; } return value; } private static string GetEnemyRawSortName(Enemy enemy) { if ((Object)(object)enemy == (Object)null) { return string.Empty; } try { if (TryGetEnemyParentDisplayName(((Component)enemy).GetComponentInParent(), out var name)) { return name; } } catch { } try { Type type = ((object)enemy).GetType(); if (type != null && !string.IsNullOrWhiteSpace(type.Name)) { return type.Name.Replace("(Clone)", string.Empty).Trim(); } } catch { } if (!string.IsNullOrWhiteSpace(((Object)enemy).name)) { return ((Object)enemy).name.Replace("(Clone)", string.Empty).Trim(); } return string.Empty; } private static string NormalizeEnemyBreakdownKey(string value) { if (string.IsNullOrWhiteSpace(value)) { return string.Empty; } return ReplaceIgnoreCase(ReplaceIgnoreCase(ReplaceIgnoreCase(ReplaceIgnoreCase(ReplaceIgnoreCase(ReplaceIgnoreCase(ReplaceIgnoreCase(ReplaceIgnoreCase(ReplaceIgnoreCase(ReplaceIgnoreCase(ReplaceIgnoreCase(ReplaceIgnoreCase(value.Replace("(Clone)", string.Empty).Trim(), "Enemy ", string.Empty), "Peeper Ceiling Eye", "Peeper"), "Headgrab", "Head Grabber"), "Headman", "Head"), "Bomb Thrower", "Cleanup Crew"), "Banger", "Bang"), "Runner", "Reaper"), "Clown", "Beamer"), "Chef", "Cleanup Crew"), "Frog", "Cleanup Crew"), "Tumbler", "Cleanup Crew"), "Huntsman", "Hunter").Trim(); } private static string ReplaceIgnoreCase(string source, string oldValue, string newValue) { if (string.IsNullOrEmpty(source) || string.IsNullOrEmpty(oldValue)) { return source; } for (int num = source.IndexOf(oldValue, StringComparison.OrdinalIgnoreCase); num >= 0; num = source.IndexOf(oldValue, num + (newValue?.Length ?? 0), StringComparison.OrdinalIgnoreCase)) { source = source.Remove(num, oldValue.Length).Insert(num, newValue ?? string.Empty); } return source; } private void AppendSection(List parts, List sectionItems) { if (sectionItems != null && sectionItems.Count != 0) { if (parts.Count > 0 && sectionSpacing.Value) { parts.Add(string.Empty); } parts.AddRange(sectionItems); } } private static string ColorOverlayLine(string text, string colorHex) { if (string.IsNullOrWhiteSpace(text)) { return text; } string text2 = (string.IsNullOrWhiteSpace(colorHex) ? "ffffff" : colorHex.TrimStart(new char[1] { '#' })); return "" + text + ""; } private static int GetDistanceScaledFontSize(int maxFontSize, float shrinkPercent, float distance, float fullShrinkDistance, int hardMaxFontSize) { int num = Mathf.Clamp(maxFontSize, 8, hardMaxFontSize); float num2 = Mathf.Clamp(shrinkPercent, 0f, 75f) / 100f; float num3 = (float)num * (1f - num2); float num4 = Mathf.Max(1f, fullShrinkDistance); float num5 = Mathf.Clamp01(distance / num4); return Mathf.Clamp(Mathf.RoundToInt(Mathf.Lerp((float)num, num3, num5)), 8, hardMaxFontSize); } private static Vector2 CalcLabelSize(GUIStyle style, string text) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) ReusableGuiContent.text = text ?? string.Empty; return style.CalcSize(ReusableGuiContent); } private static float CalcLabelHeight(GUIStyle style, string text, float width) { ReusableGuiContent.text = text ?? string.Empty; return style.CalcHeight(ReusableGuiContent, width); } private GUIStyle GetCenteredLabelStyle(int fontSize, bool shadow) { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Expected O, but got Unknown //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) Dictionary dictionary = (shadow ? centeredShadowLabelStyleCache : centeredRichLabelStyleCache); int key = Mathf.Clamp(fontSize, 8, 60); if (dictionary.TryGetValue(key, out var value)) { return value; } value = new GUIStyle(GUI.skin.label) { fontSize = key, fontStyle = (FontStyle)1, alignment = (TextAnchor)4, wordWrap = false, richText = !shadow }; value.normal.textColor = (Color)(shadow ? new Color(0f, 0f, 0f, 0.85f) : Color.white); dictionary[key] = value; return value; } private GUIStyle GetOverlayLabelStyle(int fontSize, bool shadow) { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Expected O, but got Unknown //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) Dictionary dictionary = (shadow ? overlayShadowStyleCache : overlayRichStyleCache); int key = Mathf.Clamp(fontSize, 10, 28); if (dictionary.TryGetValue(key, out var value)) { return value; } value = new GUIStyle(GUI.skin.label) { fontSize = key, fontStyle = (FontStyle)1, alignment = (TextAnchor)8, wordWrap = false, richText = !shadow }; value.normal.textColor = (Color)(shadow ? new Color(0f, 0f, 0f, 0.85f) : Color.white); dictionary[key] = value; return value; } private void UpdateNativeOverlay() { //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: Unknown result type (might be due to invalid IL or missing references) if (displayMode.Value != DisplayMode.原生UI显示 || string.IsNullOrWhiteSpace(overlayText)) { return; } EnsureNativeOverlay(); if (!((Object)(object)overlayLabel == (Object)null) && !((Object)(object)overlayRect == (Object)null)) { int num = Mathf.Clamp(fontSize.Value, 10, 28); if (!string.Equals(lastNativeOverlayText, overlayText, StringComparison.Ordinal) || lastNativeOverlayFontSize != num || lastNativeOverlayOffsetX != overlayOffsetX.Value || lastNativeOverlayOffsetY != overlayOffsetY.Value || lastNativeOverlayShowBreakdown != showBreakdown.Value) { ((TMP_Text)overlayLabel).text = overlayText; ((TMP_Text)overlayLabel).fontSize = num; ((Graphic)overlayLabel).color = Color.white; ((TMP_Text)overlayLabel).enableWordWrapping = false; ((TMP_Text)overlayLabel).alignment = (TextAlignmentOptions)1028; ((TMP_Text)overlayLabel).overflowMode = (TextOverflowModes)0; ((TMP_Text)overlayLabel).horizontalAlignment = (HorizontalAlignmentOptions)4; ((TMP_Text)overlayLabel).verticalAlignment = (VerticalAlignmentOptions)1024; float num2 = (showBreakdown.Value ? 460f : 320f); overlayRect.anchorMin = new Vector2(1f, 0f); overlayRect.anchorMax = new Vector2(1f, 0f); overlayRect.pivot = new Vector2(1f, 0f); overlayRect.anchoredPosition = new Vector2(-18f - (float)overlayOffsetX.Value, 18f + (float)overlayOffsetY.Value); overlayRect.sizeDelta = new Vector2(num2, 720f); lastNativeOverlayText = overlayText; lastNativeOverlayFontSize = num; lastNativeOverlayOffsetX = overlayOffsetX.Value; lastNativeOverlayOffsetY = overlayOffsetY.Value; lastNativeOverlayShowBreakdown = showBreakdown.Value; } } } private void EnsureNativeOverlay() { //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Expected O, but got Unknown //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Expected O, but got Unknown if (!((Object)(object)overlayObject != (Object)null) || !((Object)(object)overlayLabel != (Object)null) || !((Object)(object)overlayRect != (Object)null)) { if ((Object)(object)overlayCanvasObject == (Object)null || (Object)(object)overlayCanvas == (Object)null) { overlayCanvasObject = new GameObject("moreui.Canvas", new Type[3] { typeof(Canvas), typeof(CanvasScaler), typeof(GraphicRaycaster) }); overlayCanvas = overlayCanvasObject.GetComponent(); overlayCanvas.renderMode = (RenderMode)0; overlayCanvas.sortingOrder = 32767; overlayCanvas.pixelPerfect = false; CanvasScaler component = overlayCanvasObject.GetComponent(); component.uiScaleMode = (ScaleMode)1; component.referenceResolution = new Vector2(1920f, 1080f); component.screenMatchMode = (ScreenMatchMode)0; component.matchWidthOrHeight = 0.5f; Object.DontDestroyOnLoad((Object)(object)overlayCanvasObject); } overlayObject = new GameObject("moreui.NativeOverlay", new Type[1] { typeof(RectTransform) }); overlayObject.transform.SetParent(((Component)overlayCanvas).transform, false); overlayObject.transform.SetAsLastSibling(); overlayRect = overlayObject.GetComponent(); overlayLabel = overlayObject.AddComponent(); ((Graphic)overlayLabel).raycastTarget = false; ((TMP_Text)overlayLabel).richText = true; ((TMP_Text)overlayLabel).enableWordWrapping = false; ((TMP_Text)overlayLabel).alignment = (TextAlignmentOptions)1028; TryCopyGoalUiStyle(overlayLabel); } } private static void TryCopyGoalUiStyle(TextMeshProUGUI target) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0071: 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_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)target == (Object)null) { return; } GoalUI val = Object.FindObjectOfType(); if ((Object)(object)val == (Object)null || GoalUiTextField == null) { ((Graphic)target).color = Color.white; return; } object? value = GoalUiTextField.GetValue(val); TextMeshProUGUI val2 = (TextMeshProUGUI)((value is TextMeshProUGUI) ? value : null); if ((Object)(object)val2 == (Object)null) { ((Graphic)target).color = Color.white; return; } ((TMP_Text)target).font = ((TMP_Text)val2).font; ((TMP_Text)target).fontSharedMaterial = ((TMP_Text)val2).fontSharedMaterial; ((Graphic)target).color = Color.white; ((TMP_Text)target).outlineColor = ((TMP_Text)val2).outlineColor; ((TMP_Text)target).outlineWidth = ((TMP_Text)val2).outlineWidth; ((TMP_Text)target).enableVertexGradient = ((TMP_Text)val2).enableVertexGradient; ((TMP_Text)target).fontStyle = ((TMP_Text)val2).fontStyle; ((TMP_Text)target).characterSpacing = ((TMP_Text)val2).characterSpacing; ((TMP_Text)target).lineSpacing = ((TMP_Text)val2).lineSpacing; ((TMP_Text)target).margin = ((TMP_Text)val2).margin; } private float UpdateAndGetLostMapValue(float currentMapValue, ValuableObject[] valuables, HashSet haulObjects) { int num = SemiFunc.RunGetLevelsCompleted() + 1; if (trackedLevelNumber != num || previousExtractedValue < 0f) { trackedLevelNumber = num; previousExtractedValue = 0f; accumulatedLostValue = 0f; valuableSnapshots.Clear(); UpdateValuableLossSnapshots(extractionJustChanged: false, valuables, haulObjects); return accumulatedLostValue; } UpdateValuableLossSnapshots(extractionJustChanged: false, valuables, haulObjects); return accumulatedLostValue; } private void ResetLossTracking() { trackedLevelNumber = -1; previousExtractedValue = -1f; accumulatedLostValue = 0f; submittedFundsSnapshotLevelNumber = -1; submittedFundsBaselineTotalHaul = -1f; submittedFundsSnapshot = 0f; shopRemainingSnapshotLevelNumber = -1; shopRemainingFundsSnapshot = -1f; valuableSnapshots.Clear(); valuablesCurrentlyInDollarHaul.Clear(); WzcMapValueService.Reset(); } private void UpdateValuableLossSnapshots(bool extractionJustChanged, ValuableObject[] valuables, HashSet haulObjects) { valuables = valuables ?? Array.Empty(); haulObjects = haulObjects ?? new HashSet(ReferenceObjectComparer.Instance); liveValuableKeys.Clear(); ValuableObject[] array = valuables; foreach (ValuableObject val in array) { if (!((Object)(object)val == (Object)null) && IsValuableReady(val)) { int valuableKey = GetValuableKey(val); float floatField = GetFloatField(ValuableOriginalValueField, val); float floatField2 = GetFloatField(ValuableCurrentValueField, val); float num = Mathf.Max(0f, floatField - floatField2); object physGrabObject = ValuablePhysGrabObjectField?.GetValue(val); bool flag = IsValuableMarkedInHaul(valuableKey) || IsValuableInReferenceSet(val, physGrabObject, haulObjects); liveValuableKeys.Add(valuableKey); if (!valuableSnapshots.TryGetValue(valuableKey, out var value)) { ValuableSnapshot valuableSnapshot = default(ValuableSnapshot); valuableSnapshot.CountedLostValue = 0f; value = valuableSnapshot; } value.OriginalValue = floatField; value.CurrentValue = floatField2; value.CurrentDamage = num; value.WasInHaul = flag; float num2 = Mathf.Clamp(num, 0f, Mathf.Max(0f, floatField)); if (!flag && num2 > value.CountedLostValue + 0.01f) { accumulatedLostValue += num2 - value.CountedLostValue; value.CountedLostValue = num2; } valuableSnapshots[valuableKey] = value; } } reusableSnapshotKeys.Clear(); foreach (int key in valuableSnapshots.Keys) { reusableSnapshotKeys.Add(key); } foreach (int reusableSnapshotKey in reusableSnapshotKeys) { if (!liveValuableKeys.Contains(reusableSnapshotKey)) { ValuableSnapshot snapshot = valuableSnapshots[reusableSnapshotKey]; if (!snapshot.WasInHaul && !extractionJustChanged) { accumulatedLostValue += CalculateRemovedValuableLoss(snapshot); } valuableSnapshots.Remove(reusableSnapshotKey); } } liveValuableKeys.Clear(); } private static float CalculateRemovedValuableLoss(ValuableSnapshot snapshot) { float num = Mathf.Max(0f, snapshot.OriginalValue); return Mathf.Max(0f, num - snapshot.CountedLostValue); } private static float GetCurrentExtractedValue() { try { return (float)SemiFunc.StatGetRunCurrency() * 1000f; } catch { try { return (float)SemiFunc.StatGetRunTotalHaul() * 1000f; } catch { return 0f; } } } private static float GetShopRemainingFundsValue() { try { return (float)SemiFunc.StatGetRunCurrency() * 1000f; } catch { return 0f; } } private float GetShopRemainingFundsSnapshot() { int num = SemiFunc.RunGetLevelsCompleted() + 1; if (shopRemainingSnapshotLevelNumber != num || shopRemainingFundsSnapshot < 0f) { shopRemainingSnapshotLevelNumber = num; shopRemainingFundsSnapshot = GetShopRemainingFundsValue(); } return shopRemainingFundsSnapshot; } private static float GetRunTotalHaulValue() { try { return (float)SemiFunc.StatGetRunTotalHaul() * 1000f; } catch { return 0f; } } private float GetCurrentLevelSubmittedValue() { int submittedFundsLevelKey = GetSubmittedFundsLevelKey(); if (submittedFundsSnapshotLevelNumber != submittedFundsLevelKey || submittedFundsBaselineTotalHaul < 0f) { submittedFundsSnapshotLevelNumber = submittedFundsLevelKey; submittedFundsBaselineTotalHaul = GetRunTotalHaulValue(); submittedFundsSnapshot = 0f; } float num = Mathf.Max(0f, GetRunTotalHaulValue() - submittedFundsBaselineTotalHaul); submittedFundsSnapshot = Mathf.Max(submittedFundsSnapshot, num); return submittedFundsSnapshot; } private static int GetSubmittedFundsLevelKey() { int num = SemiFunc.RunGetLevelsCompleted(); try { return SemiFunc.RunIsShop() ? num : (num + 1); } catch { return num + 1; } } private static float GetRoundDirectorCurrentHaulValue() { object obj = RoundDirectorInstanceField?.GetValue(null); if (obj != null && RoundDirectorCurrentHaulField != null) { return Mathf.Max(0f, GetFloatField(RoundDirectorCurrentHaulField, obj)); } return 0f; } private static bool IsValuableReady(ValuableObject valuable) { if (ValuableValueSetField == null) { return true; } object value = ValuableValueSetField.GetValue(valuable); bool flag = default(bool); int num; if (value is bool) { flag = (bool)value; num = ((1 == 0) ? 1 : 0); } else { num = 1; } return (byte)((uint)num | (flag ? 1u : 0u)) != 0; } private static int GetValuableKey(ValuableObject valuable) { object obj = ValuablePhotonViewField?.GetValue(valuable); if (obj != null) { Type type = obj.GetType(); if (GetCachedPhotonViewIdProperty(type)?.GetValue(obj, null) is int num && num != 0) { return num; } if (GetCachedPhotonViewIdField(type)?.GetValue(obj) is int num2 && num2 != 0) { return num2; } } return ((Object)valuable).GetInstanceID(); } private static PropertyInfo GetCachedPhotonViewIdProperty(Type photonViewType) { if (photonViewType == null) { return null; } if (!PhotonViewIdPropertyCache.TryGetValue(photonViewType, out var value)) { value = photonViewType.GetProperty("ViewID", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); PhotonViewIdPropertyCache[photonViewType] = value; } return value; } private static FieldInfo GetCachedPhotonViewIdField(Type photonViewType) { if (photonViewType == null) { return null; } if (!PhotonViewIdFieldCache.TryGetValue(photonViewType, out var value)) { value = photonViewType.GetField("viewID", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic) ?? photonViewType.GetField("ViewID", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); PhotonViewIdFieldCache[photonViewType] = value; } return value; } private static PropertyInfo GetCachedPhotonViewOwnerProperty(Type photonViewType) { if (photonViewType == null) { return null; } if (!PhotonViewOwnerPropertyCache.TryGetValue(photonViewType, out var value)) { value = photonViewType.GetProperty("Owner", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); PhotonViewOwnerPropertyCache[photonViewType] = value; } return value; } private static PropertyInfo GetCachedPhotonOwnerNickNameProperty(Type ownerType) { if (ownerType == null) { return null; } if (!PhotonOwnerNickNamePropertyCache.TryGetValue(ownerType, out var value)) { value = ownerType.GetProperty("NickName", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); PhotonOwnerNickNamePropertyCache[ownerType] = value; } return value; } private static float GetFloatField(FieldInfo field, object instance) { if (field == null || instance == null) { return 0f; } object value = field.GetValue(instance); if (value != null) { return Convert.ToSingle(value, CultureInfo.InvariantCulture); } return 0f; } private static void FillCurrentDollarHaulObjects(List result) { if (result == null) { return; } result.Clear(); object obj = RoundDirectorInstanceField?.GetValue(null); if (!(((obj == null) ? null : RoundDirectorDollarHaulListField?.GetValue(obj)) is IEnumerable enumerable)) { return; } foreach (object item in enumerable) { if (item != null) { result.Add(item); } } } private void FillCurrentCartObjects(List result) { if (result == null) { return; } result.Clear(); PhysGrabCart[] cartObjectsCachedForFrame = GetCartObjectsCachedForFrame(); if (cartObjectsCachedForFrame == null || cartObjectsCachedForFrame.Length == 0) { return; } PhysGrabCart[] array = cartObjectsCachedForFrame; foreach (PhysGrabCart val in array) { if ((Object)(object)val == (Object)null) { continue; } AddEnumerableObjects(result, PhysGrabCartItemsInCartField?.GetValue(val)); object obj = PhysGrabCartInCartField?.GetValue(val); if (!(((obj == null) ? null : PhysGrabInCartObjectsField?.GetValue(obj)) is IEnumerable enumerable)) { continue; } foreach (object item in enumerable) { object obj2 = PhysGrabInCartCartObjectPhysGrabObjectField?.GetValue(item); if (obj2 != null) { result.Add(obj2); } } } } private static void AddEnumerableObjects(List result, object rawList) { if (!(rawList is IEnumerable enumerable)) { return; } foreach (object item in enumerable) { if (item != null) { result.Add(item); } } } private static void FillReferenceSet(List list, HashSet result) { if (result == null) { return; } result.Clear(); if (list == null || list.Count == 0) { return; } foreach (object item in list) { if (item != null) { result.Add(item); } } } private static bool IsReferenceInSet(HashSet set, object target) { if (target != null && set != null) { return set.Contains(target); } return false; } private static bool IsValuableMarkedInHaul(int key) { if (key != 0) { return valuablesCurrentlyInDollarHaul.Contains(key); } return false; } private static bool IsValuableInReferenceSet(ValuableObject valuable, object physGrabObject, HashSet set) { if ((Object)(object)valuable == (Object)null || set == null || set.Count == 0) { return false; } GameObject gameObject = ((Component)valuable).gameObject; GameObject objectGameObject = GetObjectGameObject(physGrabObject); foreach (object item in set) { if (item != null) { if (item == valuable || item == gameObject || item == physGrabObject || item == objectGameObject) { return true; } GameObject objectGameObject2 = GetObjectGameObject(item); if ((Object)(object)objectGameObject2 != (Object)null && (objectGameObject2 == gameObject || objectGameObject2 == objectGameObject)) { return true; } } } return false; } private static GameObject GetObjectGameObject(object value) { GameObject val = (GameObject)((value is GameObject) ? value : null); if (val != null) { return val; } Component val2 = (Component)((value is Component) ? value : null); if (val2 != null) { return val2.gameObject; } return null; } private string BuildLevelLine() { DisplayLanguage currentLanguage = CurrentLanguage; GetLevelInfo(currentLanguage, out var levelNumber, out var levelName); return $"{HudText.Level(currentLanguage)}: {levelNumber} - {levelName}"; } private string BuildPlayerCountLine() { DisplayLanguage currentLanguage = CurrentLanguage; GetPlayerCounts(out var totalPlayers, out var alivePlayers, out var deadPlayers); return $"{HudText.PlayerCounts(currentLanguage)}: {HudText.Dead(currentLanguage)} {deadPlayers} | {HudText.Alive(currentLanguage)} {alivePlayers} | {HudText.Total(currentLanguage)} {totalPlayers}"; } private static void GetLevelInfo(DisplayLanguage language, out int levelNumber, out string levelName) { levelNumber = SemiFunc.RunGetLevelsCompleted() + 1; levelName = HudText.UnknownLevel(language); if ((Object)(object)RunManager.instance != (Object)null && (Object)(object)RunManager.instance.levelCurrent != (Object)null) { string narrativeName = RunManager.instance.levelCurrent.NarrativeName; if (!string.IsNullOrWhiteSpace(narrativeName)) { levelName = LevelNameLocalizer.Translate(narrativeName.Trim(), language); } } } private void GetPlayerCounts(out int totalPlayers, out int alivePlayers, out int deadPlayers) { List playerObjectsCachedForFrame = GetPlayerObjectsCachedForFrame(); totalPlayers = playerObjectsCachedForFrame?.Count ?? 0; alivePlayers = 0; if (playerObjectsCachedForFrame != null) { foreach (PlayerAvatar item in playerObjectsCachedForFrame) { if (IsPlayerAlive(item)) { alivePlayers++; } } } deadPlayers = Math.Max(0, totalPlayers - alivePlayers); } private static void AppendTeammateDistanceLines(List teammates, bool deadOnly, List lines) { if (teammates == null || teammates.Count == 0) { return; } foreach (MoreUiPlayerDistance teammate in teammates) { if (teammate != null && teammate.IsDead == deadOnly) { string text = (teammate.IsDead ? $"☠ {teammate.Name} {teammate.DistanceMeters}m" : string.Format("{0} {1} {2}m", "\ud83e\udd16", teammate.Name, teammate.DistanceMeters)); lines.Add(ColorOverlayLine(text, teammate.ColorHex)); } } } private List CreateTeammateDistanceInfos() { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) List playerObjectsCachedForFrame = GetPlayerObjectsCachedForFrame(); PlayerAvatar localPlayer = GetLocalPlayer(playerObjectsCachedForFrame); if (playerObjectsCachedForFrame == null || playerObjectsCachedForFrame.Count == 0 || (Object)(object)localPlayer == (Object)null) { return new List(); } Vector3 playerDistanceOrigin = GetPlayerDistanceOrigin(localPlayer, IsPlayerAlive(localPlayer)); List list = new List(playerObjectsCachedForFrame.Count); foreach (PlayerAvatar item in playerObjectsCachedForFrame) { if (!((Object)(object)item == (Object)null)) { bool flag = item == localPlayer; bool flag2 = IsPlayerAlive(item); if (!(flag && flag2)) { Vector3 playerReferencePosition = GetPlayerReferencePosition(item, !flag2); int distanceMeters = Mathf.RoundToInt(Vector3.Distance(playerDistanceOrigin, playerReferencePosition)); list.Add(new MoreUiPlayerDistance { Name = GetCachedPlayerName(item), DistanceMeters = distanceMeters, IsDead = !flag2, IsLocalPlayer = flag, ColorHex = GetCachedPlayerColorHex(item) }); } } } list.Sort(ComparePlayerDistanceInfo); return list; } private static int ComparePlayerDistanceInfo(MoreUiPlayerDistance left, MoreUiPlayerDistance right) { if (left == right) { return 0; } if (left == null) { return 1; } if (right == null) { return -1; } int num = ((!left.IsDead) ? 1 : 0).CompareTo((!right.IsDead) ? 1 : 0); if (num != 0) { return num; } int num2 = left.DistanceMeters.CompareTo(right.DistanceMeters); if (num2 == 0) { return string.Compare(left.Name, right.Name, StringComparison.Ordinal); } return num2; } private List CreateEnemyDistanceInfos(List enemies) { //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) if (!TryGetEnemyDistanceOrigin(out var origin)) { return new List(); } if (enemies == null) { return new List(); } float num = ((enemyProximityAutoShowDistance == null) ? 20f : Mathf.Max(0f, (float)enemyProximityAutoShowDistance.Value)); float num2 = num * num; List list = new List(enemies.Count); foreach (Enemy enemy in enemies) { if (!((Object)(object)enemy == (Object)null)) { Vector3 enemyReferencePosition = GetEnemyReferencePosition(enemy); Vector3 val = enemyReferencePosition - origin; float sqrMagnitude = ((Vector3)(ref val)).sqrMagnitude; int enemyKey = GetEnemyKey(enemy); list.Add(new MoreUiEnemyDistance { Name = GetCachedEnemyDisplayName(enemy), DistanceMeters = Mathf.RoundToInt(Mathf.Sqrt(sqrMagnitude)), ColorHex = "ff3333", IsInsideProximityRange = (num > 0f && sqrMagnitude <= num2), HasPopEffect = enemyProximityPopTimers.ContainsKey(enemyKey), ReferencePosition = enemyReferencePosition, LabelPosition = enemyReferencePosition + Vector3.up * GetCachedEnemyLabelYOffset(enemy, enemyReferencePosition) }); } } list.Sort(CompareEnemyDistanceInfo); return list; } private static int CompareEnemyDistanceInfo(MoreUiEnemyDistance left, MoreUiEnemyDistance right) { if (left == right) { return 0; } if (left == null) { return 1; } if (right == null) { return -1; } int num = left.DistanceMeters.CompareTo(right.DistanceMeters); if (num == 0) { return string.Compare(left.Name, right.Name, StringComparison.Ordinal); } return num; } private void FillCartDistanceInfos(List result) { //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: Unknown result type (might be due to invalid IL or missing references) if (result == null) { return; } result.Clear(); if (!TryGetEnemyDistanceOrigin(out var origin)) { return; } PhysGrabCart[] cartObjectsCachedForFrame = GetCartObjectsCachedForFrame(); if (cartObjectsCachedForFrame == null || cartObjectsCachedForFrame.Length == 0) { return; } EnsureCartLabelIndexLevel(); activeCartBuffer.Clear(); PhysGrabCart[] array = cartObjectsCachedForFrame; foreach (PhysGrabCart val in array) { if (IsCartCountable(val) && ShouldDisplayCart(val)) { activeCartBuffer.Add(val); } } AssignCartLabelIndices(activeCartBuffer); activeCartBuffer.Sort(CompareCartForLabelOrder); PhysGrabber[] grabbers = ((activeCartBuffer.Count == 0) ? Array.Empty() : GetGrabberObjectsCachedForFrame()); foreach (PhysGrabCart item in activeCartBuffer) { bool isSmallCart = IsSmallCartObject(item); Vector3 cartReferencePosition = GetCartReferencePosition(item); bool flag = IsCartBeingPushed(item, grabbers); int num = Mathf.RoundToInt(Vector3.Distance(origin, cartReferencePosition)); string cartDisplayName = GetCartDisplayName(item, isSmallCart); string text = (flag ? "44ff66" : "ffd84d"); string text2 = string.Format("{0} {1} {2}m", "\ud83d\uded2", cartDisplayName, num); result.Add(new MoreUiCartDistance { Name = cartDisplayName, Index = GetOrCreateCartLabelIndex(item, isSmallCart), IsSmallCart = isSmallCart, DistanceMeters = num, IsBeingPushed = flag, ColorHex = text, PlainText = text2, RichText = "" + text2 + "", ReferencePosition = cartReferencePosition, LabelPosition = cartReferencePosition + Vector3.up * GetCachedCartLabelYOffset(item, cartReferencePosition) }); } result.Sort(CompareCartDistanceInfo); } private int CompareCartForLabelOrder(PhysGrabCart left, PhysGrabCart right) { bool flag = IsSmallCartObject(left); bool flag2 = IsSmallCartObject(right); int num = (flag ? 1 : 0).CompareTo(flag2 ? 1 : 0); if (num != 0) { return num; } return GetOrCreateCartLabelIndex(left, flag).CompareTo(GetOrCreateCartLabelIndex(right, flag2)); } private static int CompareCartDistanceInfo(MoreUiCartDistance left, MoreUiCartDistance right) { if (left == right) { return 0; } if (left == null) { return 1; } if (right == null) { return -1; } int num = (left.IsSmallCart ? 1 : 0).CompareTo(right.IsSmallCart ? 1 : 0); if (num == 0) { return left.Index.CompareTo(right.Index); } return num; } private bool IsCartCountable(PhysGrabCart cart) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)cart == (Object)null) && !((Object)(object)((Component)cart).gameObject == (Object)null)) { Scene scene = ((Component)cart).gameObject.scene; if (((Scene)(ref scene)).IsValid()) { if (!((Component)cart).gameObject.activeInHierarchy) { return false; } if (IsSmallCartObject(cart) && IsSmallCartStored(cart)) { return false; } return true; } } return false; } private bool ShouldDisplayCart(PhysGrabCart cart) { if (cartSectionEnabled != null && !cartSectionEnabled.Value) { return false; } if (!IsSmallCartObject(cart)) { if (cartOverlayEnabled != null) { return cartOverlayEnabled.Value; } return false; } if (smallCartOverlayEnabled != null) { return smallCartOverlayEnabled.Value; } return false; } private bool IsSmallCartObject(PhysGrabCart cart) { if ((Object)(object)cart == (Object)null) { return false; } int instanceID = ((Object)cart).GetInstanceID(); if (smallCartTypeCache.TryGetValue(instanceID, out var value)) { return value; } if (PhysGrabCartIsSmallCartField?.GetValue(cart) is bool flag) { smallCartTypeCache[instanceID] = flag; return flag; } string hierarchyName = GetHierarchyName(((Object)(object)cart == (Object)null) ? null : ((Component)cart).transform); if (string.IsNullOrEmpty(hierarchyName)) { smallCartTypeCache[instanceID] = false; return false; } string text = hierarchyName.ToLowerInvariant().Replace("_", " ").Replace("-", " "); bool flag2 = text.Contains("cart small") || text.Contains("small cart") || text.Contains("item cart small") || text.Contains("cartsmall"); smallCartTypeCache[instanceID] = flag2; return flag2; } private static bool IsSmallCartStored(PhysGrabCart cart) { if ((Object)(object)cart == (Object)null) { return false; } object? obj = PhysGrabCartItemEquippableField?.GetValue(cart); ItemEquippable val = (ItemEquippable)((obj is ItemEquippable) ? obj : null); if ((Object)(object)val == (Object)null) { val = ((Component)cart).GetComponent(); } if ((Object)(object)val == (Object)null) { return false; } object obj2 = ItemEquippableIsEquippedField?.GetValue(val); bool flag = default(bool); int num; if (obj2 is bool) { flag = (bool)obj2; num = 1; } else { num = 0; } if (((uint)num & (flag ? 1u : 0u)) != 0) { return true; } obj2 = ItemEquippableIsEquippingField?.GetValue(val); bool flag2 = default(bool); int num2; if (obj2 is bool) { flag2 = (bool)obj2; num2 = 1; } else { num2 = 0; } if (((uint)num2 & (flag2 ? 1u : 0u)) != 0) { return true; } object obj3 = ItemEquippableCurrentStateField?.GetValue(val); if (obj3 == null) { return false; } string text = obj3.ToString(); if (text.IndexOf("Equipped", StringComparison.OrdinalIgnoreCase) < 0) { return text.IndexOf("Equipping", StringComparison.OrdinalIgnoreCase) >= 0; } return true; } private static string GetHierarchyName(Transform transform) { if ((Object)(object)transform == (Object)null) { return string.Empty; } StringBuilder stringBuilder = new StringBuilder(); Transform val = transform; int num = 0; while ((Object)(object)val != (Object)null && num < 8) { if (stringBuilder.Length > 0) { stringBuilder.Append(' '); } stringBuilder.Append(((Object)val).name); val = val.parent; num++; } return stringBuilder.ToString(); } private void EnsureCartLabelIndexLevel() { int num = SemiFunc.RunGetLevelsCompleted() + 1; if (cartLabelIndexLevelNumber != num) { cartLabelIndexLevelNumber = num; largeCartLabelIndices.Clear(); smallCartLabelIndices.Clear(); smallCartTypeCache.Clear(); nextLargeCartLabelIndex = 1; nextSmallCartLabelIndex = 1; } } private void ClearCartLabelIndices() { largeCartLabelIndices.Clear(); smallCartLabelIndices.Clear(); smallCartTypeCache.Clear(); cartLabelYOffsetCache.Clear(); nextLargeCartLabelIndex = 1; nextSmallCartLabelIndex = 1; cartLabelIndexLevelNumber = -1; } private void AssignCartLabelIndices(List carts) { if (carts != null && carts.Count != 0) { AssignCartLabelIndicesForGroup(carts, targetSmallCart: false, largeCartLabelIndices, ref nextLargeCartLabelIndex); AssignCartLabelIndicesForGroup(carts, targetSmallCart: true, smallCartLabelIndices, ref nextSmallCartLabelIndex); } } private void AssignCartLabelIndicesForGroup(List carts, bool targetSmallCart, Dictionary labelIndices, ref int nextIndex) { //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) cartLabelCandidateBuffer.Clear(); foreach (PhysGrabCart cart in carts) { if (!((Object)(object)cart == (Object)null) && IsSmallCartObject(cart) == targetSmallCart) { int instanceID = ((Object)cart).GetInstanceID(); if (!labelIndices.ContainsKey(instanceID)) { cartLabelCandidateBuffer.Add(new CartLabelCandidate { Id = instanceID, Position = GetCartReferencePosition(cart) }); } } } cartLabelCandidateBuffer.Sort(CompareCartLabelCandidate); foreach (CartLabelCandidate item in cartLabelCandidateBuffer) { labelIndices[item.Id] = nextIndex++; } } private static int CompareCartLabelCandidate(CartLabelCandidate left, CartLabelCandidate right) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) int num = left.Position.x.CompareTo(right.Position.x); if (num != 0) { return num; } int num2 = left.Position.z.CompareTo(right.Position.z); if (num2 == 0) { return left.Id.CompareTo(right.Id); } return num2; } private int GetOrCreateCartLabelIndex(PhysGrabCart cart, bool isSmallCart) { if ((Object)(object)cart == (Object)null) { return 0; } Dictionary obj = (isSmallCart ? smallCartLabelIndices : largeCartLabelIndices); int instanceID = ((Object)cart).GetInstanceID(); if (!obj.TryGetValue(instanceID, out var value)) { if (isSmallCart) { value = nextSmallCartLabelIndex++; smallCartLabelIndices[instanceID] = value; } else { value = nextLargeCartLabelIndex++; largeCartLabelIndices[instanceID] = value; } } return value; } private string GetCartDisplayName(PhysGrabCart cart, bool isSmallCart) { string arg = ((CurrentLanguage != DisplayLanguage.English) ? (isSmallCart ? "小购物车" : "购物车") : (isSmallCart ? "Small Cart" : "Cart")); return $"{arg}{GetOrCreateCartLabelIndex(cart, isSmallCart)}"; } private static Vector3 GetCartReferencePosition(PhysGrabCart cart) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)cart == (Object)null) { return Vector3.zero; } object? obj = PhysGrabCartPhysGrabObjectField?.GetValue(cart); Component val = (Component)((obj is Component) ? obj : null); Vector3 anchorPosition = (((Object)(object)val == (Object)null) ? ((Component)cart).transform.position : val.transform.position); if (TryGetObjectCenterNear((IEnumerable)(object)new Component[2] { val, (Component)cart }, anchorPosition, 4f, out var centerPosition)) { return centerPosition; } if ((Object)(object)val != (Object)null) { return val.transform.position; } return ((Component)cart).transform.position; } private Vector3 GetCartLabelPosition(PhysGrabCart cart, Vector3 referencePosition) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) object? obj = PhysGrabCartPhysGrabObjectField?.GetValue(cart); Component val = (Component)((obj is Component) ? obj : null); if (TryGetObjectVisualBottomNear((IEnumerable)(object)new Component[2] { (Component)cart, val }, referencePosition, 4f, out var bottomPosition) || TryGetObjectBottomNear((IEnumerable)(object)new Component[2] { (Component)cart, val }, referencePosition, 4f, out bottomPosition)) { return bottomPosition + Vector3.up * Mathf.Clamp((cartLabelHeightOffset == null) ? 0f : cartLabelHeightOffset.Value, -1f, 1f); } return referencePosition + Vector3.up * Mathf.Clamp((cartLabelHeightOffset == null) ? 0f : cartLabelHeightOffset.Value, -1f, 1f); } private float GetCachedCartLabelYOffset(PhysGrabCart cart, Vector3 referencePosition) { //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)cart == (Object)null) { return Mathf.Clamp((cartLabelHeightOffset == null) ? 0f : cartLabelHeightOffset.Value, -1f, 1f); } int instanceID = ((Object)cart).GetInstanceID(); float time = Time.time; float num = Mathf.Max(0.5f, (cartUpdateInterval == null) ? 1f : (cartUpdateInterval.Value * 4f)); if (cartLabelYOffsetCache.TryGetValue(instanceID, out var value) && time - value.UpdatedAt <= num) { return value.YOffset + Mathf.Clamp((cartLabelHeightOffset == null) ? 0f : cartLabelHeightOffset.Value, -1f, 1f); } Vector3 cartLabelPosition = GetCartLabelPosition(cart, referencePosition); float num2 = Mathf.Clamp((cartLabelHeightOffset == null) ? 0f : cartLabelHeightOffset.Value, -1f, 1f); float num3 = cartLabelPosition.y - referencePosition.y - num2; cartLabelYOffsetCache[instanceID] = new LabelYOffsetCache { YOffset = num3, UpdatedAt = time }; return num3 + num2; } private static bool IsCartBeingPushed(PhysGrabCart cart, PhysGrabber[] grabbers) { if ((Object)(object)cart == (Object)null) { return false; } object? obj = PhysGrabCartPhysGrabObjectField?.GetValue(cart); PhysGrabObject val = (PhysGrabObject)((obj is PhysGrabObject) ? obj : null); if ((Object)(object)val == (Object)null) { return false; } if (PhysGrabObjectPlayerGrabbingField?.GetValue(val) is IEnumerable enumerable) { foreach (object item in enumerable) { if (IsLiveGrabberObject(item)) { return true; } } } object obj2 = PhysGrabCartBeingPulledField?.GetValue(cart); bool flag = default(bool); int num; if (obj2 is bool) { flag = (bool)obj2; num = 1; } else { num = 0; } if (((uint)num & (flag ? 1u : 0u)) != 0) { return true; } if (IsActiveCartState(PhysGrabCartCurrentStateField?.GetValue(cart))) { return true; } obj2 = PhysGrabObjectGrabbedField?.GetValue(val); bool flag2 = default(bool); int num2; if (obj2 is bool) { flag2 = (bool)obj2; num2 = 1; } else { num2 = 0; } if (((uint)num2 & (flag2 ? 1u : 0u)) != 0) { return true; } if (grabbers != null && grabbers.Length != 0) { bool flag3 = default(bool); bool flag4 = default(bool); bool flag6 = default(bool); foreach (PhysGrabber val2 in grabbers) { if (!((Object)(object)val2 == (Object)null) && PhysGrabberGrabbedPhysGrabObjectField?.GetValue(val2) == val) { obj2 = PhysGrabberGrabbedField?.GetValue(val2); int num3; if (obj2 is bool) { flag3 = (bool)obj2; num3 = 1; } else { num3 = 0; } int num4 = num3 & (flag3 ? 1 : 0); obj2 = PhysGrabberIsPushingField?.GetValue(val2); int num5; if (obj2 is bool) { flag4 = (bool)obj2; num5 = 1; } else { num5 = 0; } bool flag5 = (byte)((uint)num5 & (flag4 ? 1u : 0u)) != 0; obj2 = PhysGrabberIsPullingField?.GetValue(val2); int num6; if (obj2 is bool) { flag6 = (bool)obj2; num6 = 1; } else { num6 = 0; } bool flag7 = (byte)((uint)num6 & (flag6 ? 1u : 0u)) != 0; if (((uint)num4 | (flag5 ? 1u : 0u) | (flag7 ? 1u : 0u)) != 0) { return true; } } } } return false; } private static bool IsActiveCartState(object state) { if (state == null) { return false; } string a = state.ToString(); if (!string.Equals(a, "Dragged", StringComparison.OrdinalIgnoreCase)) { return string.Equals(a, "Handled", StringComparison.OrdinalIgnoreCase); } return true; } private static bool IsLiveGrabberObject(object playerGrabber) { if (playerGrabber == null) { return false; } Behaviour val = (Behaviour)((playerGrabber is Behaviour) ? playerGrabber : null); if (val != null) { return val.isActiveAndEnabled; } Component val2 = (Component)((playerGrabber is Component) ? playerGrabber : null); if (val2 != null) { if ((Object)(object)val2.gameObject != (Object)null) { return val2.gameObject.activeInHierarchy; } return false; } return true; } private static string BuildExplorationProgressLine(DisplayLanguage language, int progress) { return $"{HudText.ExplorationProgress(language)}: {Mathf.Clamp(progress, 0, 100)}%"; } private static string BuildUnextractedFundsLine(DisplayLanguage language, float value) { return HudText.UnextractedFunds(language) + ": " + FormatMoney(value); } private static float CalculateUnextractedFunds(float initialMapValue, int explorationProgressPercent, float unexploredMapValue, bool hasLiveValuableData) { if (initialMapValue <= 0f) { return 0f; } if (hasLiveValuableData) { return Mathf.Clamp(unexploredMapValue, 0f, initialMapValue); } float num = Mathf.Clamp(100f - (float)explorationProgressPercent, 0f, 100f) / 100f; return Mathf.Clamp(initialMapValue * num, 0f, initialMapValue); } private static float CalculateRemainingMapValue(float fallbackMapValue, ValuableObject[] valuables, HashSet haulObjects) { if (!TryGetRemainingMapValue(valuables, haulObjects, out var remainingValue)) { return Mathf.Max(0f, fallbackMapValue); } return Mathf.Max(0f, remainingValue); } private static bool TryGetRemainingMapValue(ValuableObject[] valuables, HashSet haulObjects, out float remainingValue) { remainingValue = 0f; valuables = valuables ?? Array.Empty(); if (valuables.Length == 0) { return false; } haulObjects = haulObjects ?? new HashSet(ReferenceObjectComparer.Instance); bool result = false; ValuableObject[] array = valuables; foreach (ValuableObject val in array) { if (!((Object)(object)val == (Object)null) && IsValuableReady(val)) { result = true; object physGrabObject = ValuablePhysGrabObjectField?.GetValue(val); if (!IsValuableMarkedInHaul(GetValuableKey(val)) && !IsValuableInReferenceSet(val, physGrabObject, haulObjects)) { remainingValue += Mathf.Max(0f, GetFloatField(ValuableCurrentValueField, val)); } } } return result; } private static int CalculateExplorationProgress(float mapValue, float initialMapValue, ValuableObject[] valuables, HashSet haulObjects, HashSet cartObjects, out float unexploredValue, out bool hasLiveValuableData) { if (initialMapValue <= 0f) { unexploredValue = 0f; hasLiveValuableData = false; return 0; } hasLiveValuableData = TryGetUnexploredMapValue(valuables, haulObjects, cartObjects, out unexploredValue); float num2; if (!hasLiveValuableData) { float num = Mathf.Clamp(mapValue / initialMapValue * 100f, 0f, 100f); num2 = 100f - num; } else { float num3 = Mathf.Clamp(unexploredValue / initialMapValue * 100f, 0f, 100f); num2 = 100f - num3; } return Mathf.RoundToInt(Mathf.Clamp(num2, 0f, 100f)); } private static bool TryGetUnexploredMapValue(ValuableObject[] valuables, HashSet haulObjects, HashSet cartObjects, out float unexploredValue) { unexploredValue = 0f; valuables = valuables ?? Array.Empty(); if (valuables == null || valuables.Length == 0) { return false; } haulObjects = haulObjects ?? new HashSet(ReferenceObjectComparer.Instance); cartObjects = cartObjects ?? new HashSet(ReferenceObjectComparer.Instance); bool result = false; ValuableObject[] array = valuables; foreach (ValuableObject val in array) { if (!((Object)(object)val == (Object)null) && IsValuableReady(val)) { result = true; object physGrabObject = ValuablePhysGrabObjectField?.GetValue(val); if (!IsValuableInReferenceSet(val, physGrabObject, haulObjects) && !IsValuableInReferenceSet(val, physGrabObject, cartObjects)) { unexploredValue += Mathf.Max(0f, GetFloatField(ValuableCurrentValueField, val)); } } } return result; } private static string BuildMapValueLine(DisplayLanguage language, float mapValue) { return HudText.MapTotalValue(language) + ": " + FormatMoney(mapValue); } private void BuildEvacuatedFundsLines(DisplayLanguage language, float shopRemainingFunds, float currentLevelFunds, List lines) { if (lines != null) { if (showCurrentRunSubmittedFunds.Value) { lines.Add(HudText.CurrentRunEvacuatedFunds(language) + ": " + FormatMoney(currentLevelFunds)); } if (showShopRemainingFunds.Value) { lines.Add(HudText.WarehouseFunds(language) + ": " + FormatMoney(shopRemainingFunds)); } } } private void RefreshEnemyLabels() { //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) enemyLabels.Clear(); Enemy[] enemyObjectsCachedForFrame = GetEnemyObjectsCachedForFrame(); if (enemyObjectsCachedForFrame == null || enemyObjectsCachedForFrame.Length == 0) { return; } Enemy[] array = enemyObjectsCachedForFrame; foreach (Enemy enemy in array) { if (IsEnemyCountable(enemy)) { Transform enemyReferenceTransform = GetEnemyReferenceTransform(enemy); Vector3 referencePosition = (((Object)(object)enemyReferenceTransform == (Object)null) ? Vector3.zero : enemyReferenceTransform.position); enemyLabels.Add(new EnemyLabelInfo { Enemy = enemy, Name = GetCachedEnemyDisplayName(enemy), LabelYOffset = GetCachedEnemyLabelYOffset(enemy, referencePosition), ReferenceTransform = enemyReferenceTransform }); } } } private static bool IsPlayerAlive(PlayerAvatar player) { if ((Object)(object)player == (Object)null) { return false; } int frameCount = Time.frameCount; if (playerAliveFrameCacheFrame != frameCount) { playerAliveFrameCacheFrame = frameCount; PlayerAliveFrameCache.Clear(); } int instanceID = ((Object)player).GetInstanceID(); if (PlayerAliveFrameCache.TryGetValue(instanceID, out var value)) { return value; } bool flag = IsPlayerAliveUncached(player); PlayerAliveFrameCache[instanceID] = flag; return flag; } private static bool IsPlayerAliveUncached(PlayerAvatar player) { bool flag = default(bool); int num; if (PlayerDeadSetField != null) { object value = PlayerDeadSetField.GetValue(player); if (value is bool) { flag = (bool)value; num = 1; } else { num = 0; } } else { num = 0; } int num2 = num & (flag ? 1 : 0); bool flag2 = default(bool); int num3; if (PlayerIsDisabledField != null) { object value = PlayerIsDisabledField.GetValue(player); if (value is bool) { flag2 = (bool)value; num3 = 1; } else { num3 = 0; } } else { num3 = 0; } bool flag3 = (byte)((uint)num3 & (flag2 ? 1u : 0u)) != 0; if (num2 == 0 && !flag3) { return true; } if (HasPlayerDeathMarker(player)) { return false; } Transform playerTransform; return TryGetPlayerLiveTransform(player, requireActive: true, out playerTransform); } private static PlayerAvatar GetLocalPlayer(List players) { int frameCount = Time.frameCount; if (cachedLocalPlayerFrame == frameCount) { return cachedLocalPlayer; } cachedLocalPlayerFrame = frameCount; cachedLocalPlayer = null; try { PlayerAvatar val = SemiFunc.PlayerAvatarLocal(); if ((Object)(object)val != (Object)null) { cachedLocalPlayer = val; return cachedLocalPlayer; } } catch { } if (players == null || players.Count == 0) { return cachedLocalPlayer; } PlayerAvatar val2 = null; bool flag = default(bool); foreach (PlayerAvatar player in players) { if (!((Object)(object)player == (Object)null)) { if ((Object)(object)val2 == (Object)null) { val2 = player; } object obj2 = PlayerIsLocalField?.GetValue(player); int num; if (obj2 is bool) { flag = (bool)obj2; num = 1; } else { num = 0; } if (((uint)num & (flag ? 1u : 0u)) != 0) { cachedLocalPlayer = player; return cachedLocalPlayer; } } } cachedLocalPlayer = val2; return cachedLocalPlayer; } private string GetCachedPlayerName(PlayerAvatar player) { if ((Object)(object)player == (Object)null) { return "未知玩家"; } int frameCount = Time.frameCount; if (playerNameCacheFrame != frameCount) { playerNameCacheFrame = frameCount; playerNameCache.Clear(); } int instanceID = ((Object)player).GetInstanceID(); if (playerNameCache.TryGetValue(instanceID, out var value)) { return value; } string playerName = GetPlayerName(player); playerNameCache[instanceID] = playerName; return playerName; } private string GetCachedPlayerColorHex(PlayerAvatar player) { if ((Object)(object)player == (Object)null) { return "ffffff"; } int instanceID = ((Object)player).GetInstanceID(); int playerHeadTopColorIndex = GetPlayerHeadTopColorIndex(player); float unscaledTime = Time.unscaledTime; if (playerHeadTopColorIndex >= 0 && playerColorCache.TryGetValue(instanceID, out var value) && value.ColorIndex == playerHeadTopColorIndex && unscaledTime - value.UpdatedAt <= 0.2f && !string.IsNullOrWhiteSpace(value.ColorHex)) { return value.ColorHex; } string playerHeadTopColorHex = GetPlayerHeadTopColorHex(player); if (playerHeadTopColorIndex >= 0) { playerColorCache[instanceID] = new PlayerColorCacheEntry { ColorIndex = playerHeadTopColorIndex, ColorHex = playerHeadTopColorHex, UpdatedAt = unscaledTime }; } if (!string.IsNullOrWhiteSpace(playerHeadTopColorHex)) { return playerHeadTopColorHex; } return "ffffff"; } private static string GetPlayerName(PlayerAvatar player) { if ((Object)(object)player == (Object)null) { return "未知玩家"; } string text = PlayerNameField?.GetValue(player) as string; if (!string.IsNullOrWhiteSpace(text)) { return text.Trim(); } try { object photonView = player.photonView; object obj = ((photonView == null) ? null : GetCachedPhotonViewOwnerProperty(photonView.GetType()))?.GetValue(photonView, null); string text2 = ((obj == null) ? null : GetCachedPhotonOwnerNickNameProperty(obj.GetType()))?.GetValue(obj, null) as string; if (!string.IsNullOrWhiteSpace(text2)) { return text2.Trim(); } } catch { } try { string text3 = SemiFunc.PlayerGetName(player); if (!string.IsNullOrWhiteSpace(text3)) { return text3.Trim(); } } catch { } if (!string.IsNullOrWhiteSpace(((Object)player).name)) { return ((Object)player).name.Replace("(Clone)", string.Empty).Trim(); } return "未知玩家"; } private static string GetPlayerHeadTopColorHex(PlayerAvatar player) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) if (TryGetPlayerHeadTopColor(player, out var color)) { color.a = 1f; return ColorUtility.ToHtmlStringRGB(color).ToLowerInvariant(); } return "ffffff"; } private static bool TryGetPlayerHeadTopColor(PlayerAvatar player, out Color color) { //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_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) color = Color.white; if ((Object)(object)player == (Object)null) { return false; } try { color = SemiFunc.PlayerGetColorMain(player); return color.a > 0.01f; } catch { return false; } } private static int GetPlayerHeadTopColorIndex(PlayerAvatar player) { if ((Object)(object)player == (Object)null || (Object)(object)player.playerCosmetics == (Object)null) { return -1; } try { if (PlayerCosmeticsColorsEquippedField?.GetValue(player.playerCosmetics) is int[] array && array.Length > 5) { return array[5]; } } catch { } return -1; } private static Vector3 GetPlayerDistanceOrigin(PlayerAvatar localPlayer, bool localAlive) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)localPlayer == (Object)null) { return Vector3.zero; } if (localAlive) { return GetPlayerReferencePosition(localPlayer, preferDeathPosition: false); } if (TryGetSpectateOrigin(localPlayer, out var position)) { return position; } return GetPlayerReferencePosition(localPlayer, preferDeathPosition: true); } private static bool TryGetSpectateOrigin(PlayerAvatar localPlayer, 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_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) position = Vector3.zero; object? obj = SpectateCameraInstanceField?.GetValue(null); SpectateCamera val = (SpectateCamera)((obj is SpectateCamera) ? obj : null); if ((Object)(object)val == (Object)null) { return TryGetMainCameraPosition(out position); } object? obj2 = SpectateCameraPlayerOverrideField?.GetValue(val); PlayerAvatar val2 = (PlayerAvatar)(((obj2 is PlayerAvatar) ? obj2 : null) ?? ((object)/*isinst with value type is only supported in some contexts*/)); if ((Object)(object)val2 != (Object)null && (Object)(object)val2 != (Object)(object)localPlayer && IsPlayerAlive(val2)) { position = GetPlayerReferencePosition(val2, preferDeathPosition: false); return true; } object? obj3 = SpectateCameraMainCameraField?.GetValue(val); Camera val3 = (Camera)((obj3 is Camera) ? obj3 : null); if (val3 != null && (Object)(object)val3 != (Object)null) { position = ((Component)val3).transform.position; return true; } return TryGetMainCameraPosition(out position); } private static bool TryGetMainCameraPosition(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_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) position = Vector3.zero; Camera main = Camera.main; if ((Object)(object)main == (Object)null) { return false; } position = ((Component)main).transform.position; return true; } private static Color EnsureReadableColor(Color color) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) if (color.a <= 0f) { return Color.white; } if (color.r * 0.299f + color.g * 0.587f + color.b * 0.114f < 0.35f) { color = Color.Lerp(color, Color.white, 0.35f); } color.a = 1f; return color; } private static Vector3 GetPlayerReferencePosition(PlayerAvatar player, bool preferDeathPosition) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)player == (Object)null) { return Vector3.zero; } if (preferDeathPosition) { object? obj = PlayerDeathHeadField?.GetValue(player); PlayerDeathHead val = (PlayerDeathHead)((obj is PlayerDeathHead) ? obj : null); if (val != null && (Object)(object)val != (Object)null) { object? obj2 = DeathHeadPhysGrabObjectField?.GetValue(val); Component val2 = (Component)((obj2 is Component) ? obj2 : null); if (val2 != null && (Object)(object)val2 != (Object)null) { return val2.transform.position; } object? obj3 = DeathHeadOverridePositionTransformField?.GetValue(val); Transform val3 = (Transform)((obj3 is Transform) ? obj3 : null); if (val3 != null && (Object)(object)val3 != (Object)null) { return val3.position; } if (TryGetVector3Field(DeathHeadTriggeredPositionField, val, out var position)) { return position; } return ((Component)val).transform.position; } object? obj4 = PlayerDeathSpotField?.GetValue(player); GameObject val4 = (GameObject)((obj4 is GameObject) ? obj4 : null); if (val4 != null && (Object)(object)val4 != (Object)null) { return val4.transform.position; } if (TryGetVector3Field(PlayerLastNavmeshPositionField, player, out var position2)) { return position2; } } if (TryGetPlayerLiveTransform(player, !preferDeathPosition, out var playerTransform) || TryGetPlayerLiveTransform(player, requireActive: false, out playerTransform)) { return playerTransform.position; } return ((Component)player).transform.position; } private Vector3 GetPlayerLabelPosition(PlayerAvatar player, Vector3 fallbackPosition, bool preferDeathPosition, float aliveHeightOffset) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)player == (Object)null) { return fallbackPosition; } if (preferDeathPosition) { return fallbackPosition + Vector3.up * 0.05f; } Component val = null; val = (Component)((!TryGetPlayerLiveTransform(player, requireActive: true, out var playerTransform) && !TryGetPlayerLiveTransform(player, requireActive: false, out playerTransform)) ? ((object)player) : ((object)playerTransform)); int key = (((Object)(object)val == (Object)null || (Object)(object)val.gameObject == (Object)null) ? ((Object)player).GetInstanceID() : ((Object)val.gameObject).GetInstanceID()); float time = Time.time; float num = Mathf.Clamp(aliveHeightOffset, 0f, 1f); if (playerLabelYOffsetCache.TryGetValue(key, out var value) && time - value.UpdatedAt <= ClampRefreshInterval((teammateUpdateInterval == null) ? 0.5f : teammateUpdateInterval.Value)) { return fallbackPosition + Vector3.up * (value.YOffset + num); } if (TryGetObjectTopNear((IEnumerable)(object)new Component[2] { val, (Component)player }, fallbackPosition, 3f, out var topPosition)) { float num2 = Mathf.Max(0.1f, topPosition.y - fallbackPosition.y); playerLabelYOffsetCache[key] = new LabelYOffsetCache { YOffset = num2, UpdatedAt = time }; return fallbackPosition + Vector3.up * (num2 + num); } return fallbackPosition + Vector3.up * 1.7f; } private static bool HasPlayerDeathMarker(PlayerAvatar player) { if ((Object)(object)player == (Object)null) { return false; } object? obj = PlayerDeathHeadField?.GetValue(player); PlayerDeathHead val = (PlayerDeathHead)((obj is PlayerDeathHead) ? obj : null); if (val != null && (Object)(object)val != (Object)null && IsUsableTransform(((Component)val).transform, requireActive: true)) { return true; } object? obj2 = PlayerDeathSpotField?.GetValue(player); GameObject val2 = (GameObject)((obj2 is GameObject) ? obj2 : null); if (val2 != null && (Object)(object)val2 != (Object)null && IsUsableTransform(val2.transform, requireActive: true)) { return true; } return false; } private static bool TryGetPlayerLiveTransform(PlayerAvatar player, bool requireActive, out Transform playerTransform) { playerTransform = null; if ((Object)(object)player == (Object)null) { return false; } object? obj = PlayerTransformField?.GetValue(player); Transform val = (Transform)((obj is Transform) ? obj : null); if (val != null && IsUsableTransform(val, requireActive)) { playerTransform = val; return true; } if (IsUsableTransform(((Component)player).transform, requireActive)) { playerTransform = ((Component)player).transform; return true; } return false; } private static bool IsUsableTransform(Transform transform, bool requireActive) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)transform == (Object)null) && !((Object)(object)((Component)transform).gameObject == (Object)null)) { Scene scene = ((Component)transform).gameObject.scene; if (((Scene)(ref scene)).IsValid()) { if (requireActive) { return ((Component)transform).gameObject.activeInHierarchy; } return true; } } return false; } private static bool TryGetVector3Field(FieldInfo field, object instance, 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_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) position = Vector3.zero; if (field == null || instance == null) { return false; } if (!(field.GetValue(instance) is Vector3 val)) { return false; } position = val; return ((Vector3)(ref val)).sqrMagnitude > 0.001f; } private static Vector3 GetEnemyReferencePosition(Enemy enemy) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) Transform enemyReferenceTransform = GetEnemyReferenceTransform(enemy); if (!((Object)(object)enemyReferenceTransform == (Object)null)) { return enemyReferenceTransform.position; } return Vector3.zero; } private static Transform GetEnemyReferenceTransform(Enemy enemy) { Transform enemyCenterTransform = GetEnemyCenterTransform(enemy); if ((Object)(object)enemyCenterTransform != (Object)null) { return enemyCenterTransform; } Component enemyRootComponent = GetEnemyRootComponent(enemy); if ((Object)(object)enemyRootComponent != (Object)null) { return enemyRootComponent.transform; } Component enemyParentComponent = GetEnemyParentComponent(enemy); if (!((Object)(object)enemyParentComponent == (Object)null)) { return enemyParentComponent.transform; } return null; } private static Vector3 GetEnemyLabelPosition(Enemy enemy, Vector3 fallbackPosition) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0020: 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) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) Component enemyRootComponent = GetEnemyRootComponent(enemy); Transform enemyCenterTransform = GetEnemyCenterTransform(enemy); Vector3 val = (((Object)(object)enemyCenterTransform == (Object)null) ? fallbackPosition : enemyCenterTransform.position); if (TryGetObjectTopNear((IEnumerable)(object)new Component[3] { (Component)enemyCenterTransform, enemyRootComponent, (Component)enemy }, val, 6f, out var topPosition)) { return topPosition + Vector3.up * 0.1f; } return val + Vector3.up * 1.1f; } private float GetCachedEnemyLabelYOffset(Enemy enemy, Vector3 referencePosition) { //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)enemy == (Object)null) { return 1.1f; } int enemyKey = GetEnemyKey(enemy); float time = Time.time; float num = Mathf.Max(0.5f, (enemyUpdateInterval == null) ? 1f : (enemyUpdateInterval.Value * 4f)); if (enemyLabelYOffsetCache.TryGetValue(enemyKey, out var value) && time - value.UpdatedAt <= num) { return value.YOffset; } Vector3 enemyLabelPosition = GetEnemyLabelPosition(enemy, referencePosition); float num2 = Mathf.Max(0.1f, enemyLabelPosition.y - referencePosition.y); enemyLabelYOffsetCache[enemyKey] = new LabelYOffsetCache { YOffset = num2, UpdatedAt = time }; return num2; } private static bool TryGetObjectTop(IEnumerable roots, out Vector3 topPosition) { //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_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) topPosition = Vector3.zero; if (roots == null) { return false; } Bounds bounds = default(Bounds); bool hasBounds = false; HashSet boundsVisitedBuffer = BoundsVisitedBuffer; boundsVisitedBuffer.Clear(); foreach (Component root in roots) { if ((Object)(object)root == (Object)null || (Object)(object)root.gameObject == (Object)null) { continue; } Scene scene = root.gameObject.scene; if (!((Scene)(ref scene)).IsValid()) { continue; } int instanceID = ((Object)root.gameObject).GetInstanceID(); if (!boundsVisitedBuffer.Add(instanceID)) { continue; } FillChildRenderers(root); foreach (Renderer item in BoundsRendererBuffer) { if (!((Object)(object)item == (Object)null) && item.enabled) { EncapsulateBounds(ref bounds, ref hasBounds, item.bounds); } } FillChildColliders(root); foreach (Collider item2 in BoundsColliderBuffer) { if (!((Object)(object)item2 == (Object)null) && item2.enabled) { EncapsulateBounds(ref bounds, ref hasBounds, item2.bounds); } } } if (hasBounds) { topPosition = new Vector3(((Bounds)(ref bounds)).center.x, ((Bounds)(ref bounds)).max.y, ((Bounds)(ref bounds)).center.z); boundsVisitedBuffer.Clear(); return true; } boundsVisitedBuffer.Clear(); return false; } private static bool TryGetObjectTopNear(IEnumerable roots, Vector3 anchorPosition, float maxHorizontalDistance, out Vector3 topPosition) { //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_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) topPosition = Vector3.zero; if (roots == null) { return false; } Bounds bounds = default(Bounds); bool hasBounds = false; HashSet boundsVisitedBuffer = BoundsVisitedBuffer; boundsVisitedBuffer.Clear(); float maxDistanceSquared = maxHorizontalDistance * maxHorizontalDistance; foreach (Component root in roots) { if ((Object)(object)root == (Object)null || (Object)(object)root.gameObject == (Object)null) { continue; } Scene scene = root.gameObject.scene; if (!((Scene)(ref scene)).IsValid()) { continue; } int instanceID = ((Object)root.gameObject).GetInstanceID(); if (!boundsVisitedBuffer.Add(instanceID)) { continue; } FillChildRenderers(root); foreach (Renderer item in BoundsRendererBuffer) { if (!((Object)(object)item == (Object)null) && item.enabled && IsBoundsNear(item.bounds, anchorPosition, maxDistanceSquared)) { EncapsulateBounds(ref bounds, ref hasBounds, item.bounds); } } FillChildColliders(root); foreach (Collider item2 in BoundsColliderBuffer) { if (!((Object)(object)item2 == (Object)null) && item2.enabled && IsBoundsNear(item2.bounds, anchorPosition, maxDistanceSquared)) { EncapsulateBounds(ref bounds, ref hasBounds, item2.bounds); } } } if (hasBounds) { topPosition = new Vector3(anchorPosition.x, ((Bounds)(ref bounds)).max.y, anchorPosition.z); boundsVisitedBuffer.Clear(); return true; } boundsVisitedBuffer.Clear(); return false; } private static bool TryGetObjectBottomNear(IEnumerable roots, Vector3 anchorPosition, float maxHorizontalDistance, out Vector3 bottomPosition) { //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_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) bottomPosition = Vector3.zero; if (roots == null) { return false; } Bounds bounds = default(Bounds); bool hasBounds = false; HashSet boundsVisitedBuffer = BoundsVisitedBuffer; boundsVisitedBuffer.Clear(); float maxDistanceSquared = maxHorizontalDistance * maxHorizontalDistance; foreach (Component root in roots) { if ((Object)(object)root == (Object)null || (Object)(object)root.gameObject == (Object)null) { continue; } Scene scene = root.gameObject.scene; if (!((Scene)(ref scene)).IsValid()) { continue; } int instanceID = ((Object)root.gameObject).GetInstanceID(); if (!boundsVisitedBuffer.Add(instanceID)) { continue; } FillChildRenderers(root); foreach (Renderer item in BoundsRendererBuffer) { if (!((Object)(object)item == (Object)null) && item.enabled && IsBoundsNear(item.bounds, anchorPosition, maxDistanceSquared)) { EncapsulateBounds(ref bounds, ref hasBounds, item.bounds); } } FillChildColliders(root); foreach (Collider item2 in BoundsColliderBuffer) { if (!((Object)(object)item2 == (Object)null) && item2.enabled && IsBoundsNear(item2.bounds, anchorPosition, maxDistanceSquared)) { EncapsulateBounds(ref bounds, ref hasBounds, item2.bounds); } } } if (hasBounds) { bottomPosition = new Vector3(((Bounds)(ref bounds)).center.x, ((Bounds)(ref bounds)).min.y, ((Bounds)(ref bounds)).center.z); boundsVisitedBuffer.Clear(); return true; } boundsVisitedBuffer.Clear(); return false; } private static bool TryGetObjectVisualBottomNear(IEnumerable roots, Vector3 anchorPosition, float maxHorizontalDistance, out Vector3 bottomPosition) { //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_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) bottomPosition = Vector3.zero; if (roots == null) { return false; } Bounds bounds = default(Bounds); bool hasBounds = false; HashSet boundsVisitedBuffer = BoundsVisitedBuffer; boundsVisitedBuffer.Clear(); float maxDistanceSquared = maxHorizontalDistance * maxHorizontalDistance; foreach (Component root in roots) { if ((Object)(object)root == (Object)null || (Object)(object)root.gameObject == (Object)null) { continue; } Scene scene = root.gameObject.scene; if (!((Scene)(ref scene)).IsValid()) { continue; } int instanceID = ((Object)root.gameObject).GetInstanceID(); if (!boundsVisitedBuffer.Add(instanceID)) { continue; } FillChildRenderers(root); foreach (Renderer item in BoundsRendererBuffer) { if (!((Object)(object)item == (Object)null) && item.enabled && IsBoundsNear(item.bounds, anchorPosition, maxDistanceSquared)) { EncapsulateBounds(ref bounds, ref hasBounds, item.bounds); } } } if (hasBounds) { bottomPosition = new Vector3(((Bounds)(ref bounds)).center.x, ((Bounds)(ref bounds)).min.y, ((Bounds)(ref bounds)).center.z); boundsVisitedBuffer.Clear(); return true; } boundsVisitedBuffer.Clear(); return false; } private static bool TryGetObjectCenterNear(IEnumerable roots, Vector3 anchorPosition, float maxHorizontalDistance, out Vector3 centerPosition) { //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_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) centerPosition = Vector3.zero; if (roots == null) { return false; } Bounds bounds = default(Bounds); bool hasBounds = false; HashSet boundsVisitedBuffer = BoundsVisitedBuffer; boundsVisitedBuffer.Clear(); float maxDistanceSquared = maxHorizontalDistance * maxHorizontalDistance; foreach (Component root in roots) { if ((Object)(object)root == (Object)null || (Object)(object)root.gameObject == (Object)null) { continue; } Scene scene = root.gameObject.scene; if (!((Scene)(ref scene)).IsValid()) { continue; } int instanceID = ((Object)root.gameObject).GetInstanceID(); if (!boundsVisitedBuffer.Add(instanceID)) { continue; } FillChildRenderers(root); foreach (Renderer item in BoundsRendererBuffer) { if (!((Object)(object)item == (Object)null) && item.enabled && IsBoundsNear(item.bounds, anchorPosition, maxDistanceSquared)) { EncapsulateBounds(ref bounds, ref hasBounds, item.bounds); } } } if (!hasBounds) { boundsVisitedBuffer.Clear(); return TryGetObjectCenterFromCollidersNear(roots, anchorPosition, maxHorizontalDistance, out centerPosition); } centerPosition = ((Bounds)(ref bounds)).center; boundsVisitedBuffer.Clear(); return true; } private static bool TryGetObjectCenterFromCollidersNear(IEnumerable roots, Vector3 anchorPosition, float maxHorizontalDistance, out Vector3 centerPosition) { //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_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) centerPosition = Vector3.zero; if (roots == null) { return false; } Bounds bounds = default(Bounds); bool hasBounds = false; HashSet boundsVisitedBuffer = BoundsVisitedBuffer; boundsVisitedBuffer.Clear(); float maxDistanceSquared = maxHorizontalDistance * maxHorizontalDistance; foreach (Component root in roots) { if ((Object)(object)root == (Object)null || (Object)(object)root.gameObject == (Object)null) { continue; } Scene scene = root.gameObject.scene; if (!((Scene)(ref scene)).IsValid()) { continue; } int instanceID = ((Object)root.gameObject).GetInstanceID(); if (!boundsVisitedBuffer.Add(instanceID)) { continue; } FillChildColliders(root); foreach (Collider item in BoundsColliderBuffer) { if (!((Object)(object)item == (Object)null) && item.enabled && IsBoundsNear(item.bounds, anchorPosition, maxDistanceSquared)) { EncapsulateBounds(ref bounds, ref hasBounds, item.bounds); } } } if (hasBounds) { centerPosition = ((Bounds)(ref bounds)).center; boundsVisitedBuffer.Clear(); return true; } boundsVisitedBuffer.Clear(); return false; } private static bool IsBoundsNear(Bounds bounds, Vector3 anchorPosition, float maxDistanceSquared) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) Vector2 val = new Vector2(((Bounds)(ref bounds)).center.x, ((Bounds)(ref bounds)).center.z); Vector2 val2 = default(Vector2); ((Vector2)(ref val2))..ctor(anchorPosition.x, anchorPosition.z); Vector2 val3 = val - val2; return ((Vector2)(ref val3)).sqrMagnitude <= maxDistanceSquared; } private static void FillChildRenderers(Component root) { BoundsRendererBuffer.Clear(); if ((Object)(object)root != (Object)null) { root.GetComponentsInChildren(false, BoundsRendererBuffer); } } private static void FillChildColliders(Component root) { BoundsColliderBuffer.Clear(); if ((Object)(object)root != (Object)null) { root.GetComponentsInChildren(false, BoundsColliderBuffer); } } private static void EncapsulateBounds(ref Bounds bounds, ref bool hasBounds, Bounds nextBounds) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) if (!hasBounds) { bounds = nextBounds; hasBounds = true; } else { ((Bounds)(ref bounds)).Encapsulate(nextBounds); } } private static Component GetEnemyRootComponent(Enemy enemy) { if ((Object)(object)enemy == (Object)null) { return null; } return (Component)(object)enemy; } private static Transform GetEnemyCenterTransform(Enemy enemy) { if ((Object)(object)enemy == (Object)null) { return null; } object? obj = EnemyCenterTransformField?.GetValue(enemy); return (Transform)((obj is Transform) ? obj : null); } private static Component GetEnemyParentComponent(Enemy enemy) { if ((Object)(object)enemy == (Object)null) { return null; } object? obj = EnemyParentField?.GetValue(enemy); return (Component)((obj is Component) ? obj : null); } private static bool IsEnemyCountable(Enemy enemy) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)enemy == (Object)null) && !((Object)(object)((Component)enemy).gameObject == (Object)null)) { Scene scene = ((Component)enemy).gameObject.scene; if (((Scene)(ref scene)).IsValid()) { if (EnemyHealthField != null && EnemyHealthDeadField != null) { object value = EnemyHealthField.GetValue(enemy); bool flag = default(bool); int num; if (value != null) { object value2 = EnemyHealthDeadField.GetValue(value); if (value2 is bool) { flag = (bool)value2; num = 1; } else { num = 0; } } else { num = 0; } if (((uint)num & (flag ? 1u : 0u)) != 0) { return false; } } if (EnemyParentField != null && EnemyParentSpawnedField != null) { object value3 = EnemyParentField.GetValue(enemy); if (value3 != null) { object value2 = EnemyParentSpawnedField.GetValue(value3); if (value2 is bool && !(bool)value2) { return false; } } } return true; } } return false; } private static bool IsEnemyDrawableFast(Enemy enemy) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)enemy != (Object)null && (Object)(object)((Component)enemy).gameObject != (Object)null) { Scene scene = ((Component)enemy).gameObject.scene; if (((Scene)(ref scene)).IsValid()) { return ((Component)enemy).gameObject.activeInHierarchy; } } return false; } private string GetCachedEnemyDisplayName(Enemy enemy) { if ((Object)(object)enemy == (Object)null) { return GetEnemyDisplayName(enemy); } DisplayLanguage currentLanguage = CurrentLanguage; bool useEnemyNicknameNames = UseEnemyNicknameNames; if (!hasCachedEnemyDisplayNameLanguage || cachedEnemyDisplayNameLanguage != currentLanguage || cachedEnemyNicknameEnabled != useEnemyNicknameNames) { enemyDisplayNameCache.Clear(); cachedEnemyDisplayNameLanguage = currentLanguage; cachedEnemyNicknameEnabled = useEnemyNicknameNames; hasCachedEnemyDisplayNameLanguage = true; } int enemyKey = GetEnemyKey(enemy); if (enemyDisplayNameCache.TryGetValue(enemyKey, out var value)) { return value; } string enemyDisplayName = GetEnemyDisplayName(enemy); enemyDisplayNameCache[enemyKey] = enemyDisplayName; return enemyDisplayName; } private string GetEnemyDisplayName(Enemy enemy) { if ((Object)(object)enemy == (Object)null) { return string.Empty; } if (EnemyParentField != null && TryGetEnemyParentDisplayName(EnemyParentField.GetValue(enemy), out var name)) { return EnemyNameLocalizer.Translate(name, CurrentLanguage, UseEnemyNicknameNames); } if (EnemyTypeField != null) { object value = EnemyTypeField.GetValue(enemy); if (value != null) { string text = value.ToString(); if (!string.IsNullOrWhiteSpace(text)) { return EnemyNameLocalizer.Translate(text.Trim(), CurrentLanguage, UseEnemyNicknameNames); } } } if (!string.IsNullOrWhiteSpace(((Object)enemy).name)) { return EnemyNameLocalizer.Translate(((Object)enemy).name.Replace("(Clone)", string.Empty).Trim(), CurrentLanguage, UseEnemyNicknameNames); } return HudText.UnknownEnemy(CurrentLanguage); } private static bool TryGetEnemyParentDisplayName(object parent, out string name) { name = string.Empty; if (parent == null) { return false; } string text = EnemyParentNameField?.GetValue(parent) as string; if (!IsInternalEnemyName(text)) { name = text.Trim(); return true; } object obj = EnemyParentLocalizedNameField?.GetValue(parent); if (obj != null && LocalizedAssetGetStringMethod != null) { try { string text2 = LocalizedAssetGetStringMethod.Invoke(obj, null) as string; if (!string.IsNullOrWhiteSpace(text2) && !IsInternalEnemyName(text2)) { name = text2.Trim(); return true; } } catch { } } return false; } private static bool IsInternalEnemyName(string name) { if (string.IsNullOrWhiteSpace(name)) { return true; } string a = name.Trim(); if (!string.Equals(a, "ENM", StringComparison.OrdinalIgnoreCase)) { return string.Equals(a, "Enemy", StringComparison.OrdinalIgnoreCase); } return true; } private static string FormatMoney(float value) { return "$" + Mathf.RoundToInt(value).ToString("N0", MoneyCulture); } private void SetNativeOverlayVisible(bool visible) { if ((Object)(object)overlayObject != (Object)null && overlayObject.activeSelf != visible) { overlayObject.SetActive(visible); } } private void OnGUI() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Invalid comparison between Unknown and I4 if (!IsModEnabled()) { return; } Event current = Event.current; if (current == null || (int)current.type == 7) { if (overlayEnabled.Value && displayMode.Value == DisplayMode.文字显示 && !string.IsNullOrEmpty(overlayText)) { DrawMainTextOverlay(); } if (enemyLabels.Count > 0) { DrawEnemyWorldLabels(); } if (ShouldDrawTeammateWorldLabels()) { DrawTeammateWorldLabels(); } if (ShouldDrawCartWorldLabels()) { DrawCartWorldLabels(); } } } private bool ShouldDrawTeammateWorldLabels() { if (!IsModEnabled() || !teammateOverlayEnabled.Value || !IsRuntimeSessionActive()) { return false; } if (teammateDisplayMode.Value != 0 && !(teammateVisibleTimer > 0f)) { return teammateProximityVisibleTimer > 0f; } return true; } private bool ShouldDrawCartWorldLabels() { if (IsModEnabled() && (cartSectionEnabled == null || cartSectionEnabled.Value) && ((cartOverlayEnabled != null && cartOverlayEnabled.Value) || (smallCartOverlayEnabled != null && smallCartOverlayEnabled.Value))) { return IsRuntimeSessionActive(); } return false; } private bool ShouldLimitTeammateLabelsToProximity() { if (teammateProximityAutoShowEnabled != null && teammateProximityAutoShowEnabled.Value && teammateDisplayMode.Value != 0 && teammateVisibleTimer <= 0f) { return teammateProximityVisibleTimer > 0f; } return false; } private bool ShouldLimitEnemyLabelsToProximity() { if (enemyProximityAutoShowEnabled != null && enemyProximityAutoShowEnabled.Value && enemyDisplayMode.Value != 0 && enemyVisibleTimer <= 0f) { return enemyProximityVisibleTimer > 0f; } return false; } private void DrawMainTextOverlay() { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) int overlayFontSize = Mathf.Clamp(fontSize.Value, 10, 28); GUIStyle overlayLabelStyle = GetOverlayLabelStyle(overlayFontSize, shadow: false); GUIStyle overlayLabelStyle2 = GetOverlayLabelStyle(overlayFontSize, shadow: true); EnsureTextOverlayLayout(overlayLabelStyle, overlayFontSize); GUI.Label(cachedTextOverlayShadowRect, cachedTextOverlayPlainText, overlayLabelStyle2); GUI.Label(cachedTextOverlayRect, overlayText, overlayLabelStyle); } private void EnsureTextOverlayLayout(GUIStyle mainStyle, int overlayFontSize) { //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) bool flag = showBreakdown != null && showBreakdown.Value; int num = ((overlayOffsetX != null) ? overlayOffsetX.Value : 0); int num2 = ((overlayOffsetY != null) ? overlayOffsetY.Value : 0); if (!string.Equals(lastTextOverlaySource, overlayText, StringComparison.Ordinal) || lastTextOverlayFontSize != overlayFontSize || lastTextOverlayShowBreakdown != flag || lastTextOverlayOffsetX != num || lastTextOverlayOffsetY != num2 || lastTextOverlayScreenWidth != Screen.width || lastTextOverlayScreenHeight != Screen.height) { cachedTextOverlayWidth = (flag ? 430f : 320f); float num3 = CalcLabelHeight(mainStyle, overlayText, cachedTextOverlayWidth); float num4 = (float)Screen.width - cachedTextOverlayWidth - 12f - (float)num; float num5 = (float)Screen.height - num3 - 26f - (float)num2; cachedTextOverlayRect = new Rect(num4, num5, cachedTextOverlayWidth, num3); cachedTextOverlayShadowRect = new Rect(num4 + 1f, num5 + 1f, cachedTextOverlayWidth, num3); cachedTextOverlayPlainText = GetPlainOverlayText(); lastTextOverlaySource = overlayText; lastTextOverlayFontSize = overlayFontSize; lastTextOverlayShowBreakdown = flag; lastTextOverlayOffsetX = num; lastTextOverlayOffsetY = num2; lastTextOverlayScreenWidth = Screen.width; lastTextOverlayScreenHeight = Screen.height; } } private string GetPlainOverlayText() { if (string.Equals(lastPlainOverlaySource, overlayText, StringComparison.Ordinal)) { return lastPlainOverlayText; } lastPlainOverlaySource = overlayText; lastPlainOverlayText = StripRichText(overlayText); return lastPlainOverlayText; } private void DrawTeammateWorldLabels() { //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_0262: Unknown result type (might be due to invalid IL or missing references) //IL_0267: Unknown result type (might be due to invalid IL or missing references) //IL_0291: Unknown result type (might be due to invalid IL or missing references) //IL_02a3: Unknown result type (might be due to invalid IL or missing references) //IL_02ec: Unknown result type (might be due to invalid IL or missing references) //IL_02fa: Unknown result type (might be due to invalid IL or missing references) bool flag = teammateAliveOverlayEnabled == null || teammateAliveOverlayEnabled.Value; bool flag2 = teammateDeadOverlayEnabled == null || teammateDeadOverlayEnabled.Value; if (!flag && !flag2) { return; } List playerObjectsCachedForFrame = GetPlayerObjectsCachedForFrame(); if (playerObjectsCachedForFrame == null || playerObjectsCachedForFrame.Count == 0) { return; } Camera worldLabelCamera = GetWorldLabelCamera(); if ((Object)(object)worldLabelCamera == (Object)null) { return; } PlayerAvatar localPlayer = GetLocalPlayer(playerObjectsCachedForFrame); bool flag3 = IsPlayerAlive(localPlayer); Vector3 playerDistanceOrigin = GetPlayerDistanceOrigin(localPlayer, flag3); bool flag4 = ShouldLimitTeammateLabelsToProximity(); float num = Mathf.Max(0f, (float)teammateProximityAutoShowDistance.Value); num *= num; int num2 = Mathf.Clamp(teammateFontSize.Value, 10, 36); GUIStyle centeredLabelStyle = GetCenteredLabelStyle(num2, shadow: false); GUIStyle centeredLabelStyle2 = GetCenteredLabelStyle(num2, shadow: true); bool flag5 = !flag3; Rect val5 = default(Rect); foreach (PlayerAvatar item in playerObjectsCachedForFrame) { if ((Object)(object)item == (Object)null || (!flag5 && (Object)(object)item == (Object)(object)localPlayer)) { continue; } bool flag6 = IsPlayerAlive(item); if ((flag6 && !flag) || (!flag6 && !flag2) || ((Object)(object)item == (Object)(object)localPlayer && flag3)) { continue; } Vector3 playerReferencePosition = GetPlayerReferencePosition(item, !flag6); Vector3 val = playerReferencePosition - playerDistanceOrigin; float sqrMagnitude = ((Vector3)(ref val)).sqrMagnitude; if (!flag4 || !(sqrMagnitude > num)) { Vector3 playerLabelPosition = GetPlayerLabelPosition(item, playerReferencePosition, !flag6, teammateLabelHeightOffset.Value); if (TryWorldToGuiPoint(worldLabelCamera, playerLabelPosition, out var guiPosition)) { int num3 = Mathf.RoundToInt(Mathf.Sqrt(sqrMagnitude)); string cachedPlayerColorHex = GetCachedPlayerColorHex(item); string arg = (flag6 ? "\ud83e\udd16 " : "☠ "); string text = $"{arg}{GetCachedPlayerName(item)} {num3}m"; string text2 = "" + text + ""; int num4 = (flag6 ? GetDistanceScaledFontSize(num2, teammateFarFontShrinkPercent.Value, num3, teammateProximityAutoShowDistance.Value, 42) : num2); GUIStyle val2 = ((num4 == num2) ? centeredLabelStyle : GetCenteredLabelStyle(num4, shadow: false)); GUIStyle val3 = ((num4 == num2) ? centeredLabelStyle2 : GetCenteredLabelStyle(num4, shadow: true)); Vector2 val4 = CalcLabelSize(val2, text); float num5 = Mathf.Clamp(val4.x + 18f, 80f, 320f); float num6 = val4.y + 6f; float num7 = guiPosition.x - num5 / 2f; float num8 = guiPosition.y - num6 - 6f; ((Rect)(ref val5))..ctor(num7, num8, num5, num6); GUI.Label(new Rect(((Rect)(ref val5)).x + 1f, ((Rect)(ref val5)).y + 1f, ((Rect)(ref val5)).width, ((Rect)(ref val5)).height), text, val3); GUI.Label(val5, text2, val2); } } } } private void DrawCartWorldLabels() { //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01f5: Unknown result type (might be due to invalid IL or missing references) //IL_0203: Unknown result type (might be due to invalid IL or missing references) Camera worldLabelCamera = GetWorldLabelCamera(); if ((Object)(object)worldLabelCamera == (Object)null) { return; } List list = cartDistanceCache; if (list.Count == 0) { return; } int num = Mathf.Clamp((cartFontSize == null) ? 20 : cartFontSize.Value, 10, 36); int num2 = ((cartFarFontShrinkPercent == null) ? 30 : cartFarFontShrinkPercent.Value); float fullShrinkDistance = 20f; GUIStyle centeredLabelStyle = GetCenteredLabelStyle(num, shadow: false); GUIStyle centeredLabelStyle2 = GetCenteredLabelStyle(num, shadow: true); Rect val4 = default(Rect); foreach (MoreUiCartDistance item in list) { if (TryWorldToGuiPoint(worldLabelCamera, item.LabelPosition, out var guiPosition)) { int distanceScaledFontSize = GetDistanceScaledFontSize(num, num2, item.DistanceMeters, fullShrinkDistance, 42); GUIStyle val = ((distanceScaledFontSize == num) ? centeredLabelStyle : GetCenteredLabelStyle(distanceScaledFontSize, shadow: false)); GUIStyle val2 = ((distanceScaledFontSize == num) ? centeredLabelStyle2 : GetCenteredLabelStyle(distanceScaledFontSize, shadow: true)); string text = (string.IsNullOrEmpty(item.PlainText) ? string.Format("{0} {1} {2}m", "\ud83d\uded2", item.Name, item.DistanceMeters) : item.PlainText); string text2 = (string.IsNullOrEmpty(item.RichText) ? ("" + text + "") : item.RichText); Vector2 val3 = CalcLabelSize(val, text); float num3 = Mathf.Clamp(val3.x + 18f, 90f, 330f); float num4 = val3.y + 6f; float num5 = guiPosition.x - num3 / 2f; float num6 = guiPosition.y - num4 - 6f; ((Rect)(ref val4))..ctor(num5, num6, num3, num4); GUI.Label(new Rect(((Rect)(ref val4)).x + 1f, ((Rect)(ref val4)).y + 1f, ((Rect)(ref val4)).width, ((Rect)(ref val4)).height), text, val2); GUI.Label(val4, text2, val); } } } private void DrawEnemyWorldLabels() { //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_02b0: Unknown result type (might be due to invalid IL or missing references) //IL_02b5: Unknown result type (might be due to invalid IL or missing references) //IL_02df: Unknown result type (might be due to invalid IL or missing references) //IL_02f1: Unknown result type (might be due to invalid IL or missing references) //IL_033a: Unknown result type (might be due to invalid IL or missing references) //IL_0348: Unknown result type (might be due to invalid IL or missing references) Camera worldLabelCamera = GetWorldLabelCamera(); if ((Object)(object)worldLabelCamera == (Object)null) { return; } PlayerAvatar localPlayer = GetLocalPlayer(GetPlayerObjectsCachedForFrame()); Vector3 val = (((Object)(object)localPlayer == (Object)null) ? ((Component)worldLabelCamera).transform.position : GetPlayerDistanceOrigin(localPlayer, IsPlayerAlive(localPlayer))); bool flag = ShouldLimitEnemyLabelsToProximity(); float num = Mathf.Max(0f, (float)enemyProximityAutoShowDistance.Value); num *= num; int num2 = Mathf.Clamp(enemyFontSize.Value, 10, 36); GUIStyle centeredLabelStyle = GetCenteredLabelStyle(num2, shadow: false); GUIStyle centeredLabelStyle2 = GetCenteredLabelStyle(num2, shadow: true); Rect val7 = default(Rect); for (int i = 0; i < enemyLabels.Count; i++) { EnemyLabelInfo enemyLabelInfo = enemyLabels[i]; Enemy enemy = enemyLabelInfo.Enemy; if (!IsEnemyDrawableFast(enemy)) { continue; } Vector3 val2 = (((Object)(object)enemyLabelInfo.ReferenceTransform == (Object)null) ? GetEnemyReferencePosition(enemy) : enemyLabelInfo.ReferenceTransform.position); Vector3 val3 = val2 - val; float sqrMagnitude = ((Vector3)(ref val3)).sqrMagnitude; if (flag && sqrMagnitude > num) { continue; } float num3 = ((enemyLabelInfo.LabelYOffset > 0.01f) ? enemyLabelInfo.LabelYOffset : 1.1f); Vector3 worldPosition = val2 + Vector3.up * num3; if (TryWorldToGuiPoint(worldLabelCamera, worldPosition, out var guiPosition)) { int num4 = Mathf.RoundToInt(Mathf.Sqrt(sqrMagnitude)); string text = (string.IsNullOrWhiteSpace(enemyLabelInfo.Name) ? GetCachedEnemyDisplayName(enemy) : enemyLabelInfo.Name); int enemyKey = GetEnemyKey(enemy); if (flag && sqrMagnitude <= num && !enemiesInsideProximityRange.Contains(enemyKey) && !enemyProximityPopTimers.ContainsKey(enemyKey)) { enemyProximityPopTimers[enemyKey] = 1.2f; } float value; float num5 = (enemyProximityPopTimers.TryGetValue(enemyKey, out value) ? Mathf.Clamp01(value / 1.2f) : 0f); int distanceScaledFontSize = GetDistanceScaledFontSize(num2, enemyFarFontShrinkPercent.Value, num4, enemyProximityAutoShowDistance.Value, 42); float num6 = Mathf.SmoothStep(0f, 1f, num5); float num7 = (float)Mathf.Max(distanceScaledFontSize, num2) * 2f; int num8 = Mathf.Clamp(Mathf.RoundToInt((num5 > 0f) ? Mathf.Lerp((float)distanceScaledFontSize, num7, num6) : ((float)distanceScaledFontSize)), 8, 72); GUIStyle val4 = centeredLabelStyle; GUIStyle val5 = centeredLabelStyle2; if (num8 != num2) { val4 = GetCenteredLabelStyle(num8, shadow: false); val5 = GetCenteredLabelStyle(num8, shadow: true); } string arg = "ff3333"; string text2 = $"\ud83d\udc79 {text} {num4}m"; string text3 = $"{text} {num4}m"; Vector2 val6 = CalcLabelSize(val4, text3); float num9 = Mathf.Clamp(val6.x + 18f, 80f, 390f); float num10 = val6.y + 6f; float num11 = guiPosition.x - num9 / 2f; float num12 = guiPosition.y - num10 - 6f; ((Rect)(ref val7))..ctor(num11, num12, num9, num10); GUI.Label(new Rect(((Rect)(ref val7)).x + 1f, ((Rect)(ref val7)).y + 1f, ((Rect)(ref val7)).width, ((Rect)(ref val7)).height), text3, val5); GUI.Label(val7, text2, val4); } } } private static bool TryWorldToGuiPoint(Camera camera, Vector3 worldPosition, out Vector2 guiPosition, float margin = 80f) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) guiPosition = Vector2.zero; if ((Object)(object)camera == (Object)null) { return false; } Vector3 val = camera.WorldToScreenPoint(worldPosition); if (val.z <= 0.05f) { return false; } float num = val.x; float num2 = val.y; RenderTexture targetTexture = camera.targetTexture; if ((Object)(object)targetTexture != (Object)null && ((Texture)targetTexture).width > 0 && ((Texture)targetTexture).height > 0) { num *= (float)Screen.width / (float)((Texture)targetTexture).width; num2 *= (float)Screen.height / (float)((Texture)targetTexture).height; } if (num < 0f - margin || num > (float)Screen.width + margin || num2 < 0f - margin || num2 > (float)Screen.height + margin) { return false; } guiPosition = new Vector2(num, (float)Screen.height - num2); return true; } private static Camera GetWorldLabelCamera() { int frameCount = Time.frameCount; if (cachedWorldLabelCameraFrame == frameCount) { return cachedWorldLabelCamera; } Camera main = Camera.main; if ((Object)(object)main != (Object)null) { cachedWorldLabelCameraFrame = frameCount; cachedWorldLabelCamera = main; return cachedWorldLabelCamera; } object? obj = SpectateCameraInstanceField?.GetValue(null); SpectateCamera val = (SpectateCamera)((obj is SpectateCamera) ? obj : null); if ((Object)(object)val != (Object)null) { object? obj2 = SpectateCameraMainCameraField?.GetValue(val); Camera val2 = (Camera)((obj2 is Camera) ? obj2 : null); if (val2 != null && (Object)(object)val2 != (Object)null) { cachedWorldLabelCameraFrame = frameCount; cachedWorldLabelCamera = val2; return cachedWorldLabelCamera; } } cachedWorldLabelCameraFrame = frameCount; cachedWorldLabelCamera = null; return cachedWorldLabelCamera; } private static string StripRichText(string text) { if (string.IsNullOrEmpty(text)) { return string.Empty; } StringBuilder stringBuilder = new StringBuilder(text.Length); bool flag = false; foreach (char c in text) { if (c == '<') { flag = true; } else if (flag) { if (c == '>') { flag = false; } } else { stringBuilder.Append(c); } } return stringBuilder.ToString(); } private static ConfigDescription ConfigDescriptionWithOrder(string description, int order) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown return new ConfigDescription(description, (AcceptableValueBase)null, new object[1] { new ConfigurationManagerAttributes { Order = order } }); } private static ConfigDescription ConfigDescriptionWithOrder(string description, AcceptableValueRange range, int order) where T : IComparable { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown return new ConfigDescription(description, (AcceptableValueBase)(object)range, new object[1] { new ConfigurationManagerAttributes { Order = order } }); } private static bool IsConfiguredKeyDown(string keyName) { //IL_000d: 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) if (!TryParseConfiguredKey(keyName, out var keyCode)) { keyCode = (KeyCode)102; } return Input.GetKeyDown(keyCode); } private void NormalizeKeyConfigEntries() { NormalizeKeyConfigEntry(teammateToggleKey, "f"); NormalizeKeyConfigEntry(enemyToggleKey, "f"); } private static void NormalizeKeyConfigEntry(ConfigEntry entry, string fallbackValue) { if (entry != null) { string text = SanitizeConfiguredKeyName(entry.Value); if (string.IsNullOrWhiteSpace(text)) { text = fallbackValue; } if (!string.Equals(entry.Value, text, StringComparison.Ordinal)) { entry.Value = text; } } } private static bool TryParseConfiguredKey(string keyName, out KeyCode keyCode) { keyCode = (KeyCode)0; if (string.IsNullOrWhiteSpace(keyName)) { return false; } string text = SanitizeConfiguredKeyName(keyName); if (string.IsNullOrWhiteSpace(text)) { return false; } switch (text.ToLowerInvariant()) { case "左键": case "鼠标左键": case "leftmouse": keyCode = (KeyCode)323; return true; case "右键": case "鼠标右键": case "rightmouse": keyCode = (KeyCode)324; return true; case "中键": case "鼠标中键": case "middlemouse": keyCode = (KeyCode)325; return true; default: return Enum.TryParse(text, ignoreCase: true, out keyCode); } } private static string SanitizeConfiguredKeyName(string keyName) { if (string.IsNullOrWhiteSpace(keyName)) { return string.Empty; } string text = keyName.Trim().Replace(" ", string.Empty); text = text.Replace("KeyCode.", string.Empty); text = text.Replace("keycode.", string.Empty); text = text.Replace("/", string.Empty); text = text.Replace("/", string.Empty); text = text.Replace("Keyboard/", string.Empty); text = text.Replace("keyboard/", string.Empty); if (text.Equals("左键", StringComparison.OrdinalIgnoreCase) || text.Equals("鼠标左键", StringComparison.OrdinalIgnoreCase)) { return "mouse0"; } if (text.Equals("右键", StringComparison.OrdinalIgnoreCase) || text.Equals("鼠标右键", StringComparison.OrdinalIgnoreCase)) { return "mouse1"; } if (text.Equals("中键", StringComparison.OrdinalIgnoreCase) || text.Equals("鼠标中键", StringComparison.OrdinalIgnoreCase)) { return "mouse2"; } if (text.StartsWith("按键", StringComparison.OrdinalIgnoreCase)) { text = text.Substring(2); } else if (text.StartsWith("按", StringComparison.OrdinalIgnoreCase)) { text = text.Substring(1); } if (text.EndsWith("键", StringComparison.OrdinalIgnoreCase) && text.Length > 1) { text = text.Substring(0, text.Length - 1); } if (text.EndsWith("Key", StringComparison.OrdinalIgnoreCase) && text.Length > 3) { text = text.Substring(0, text.Length - 3); } return CanonicalizeConfiguredKeyName(text.Trim()); } private static string CanonicalizeConfiguredKeyName(string keyName) { if (string.IsNullOrWhiteSpace(keyName)) { return string.Empty; } string text = keyName.Trim(); if (IsSingleLetterKey(text) || IsFunctionKeyName(text) || text.StartsWith("Mouse", StringComparison.OrdinalIgnoreCase)) { return text.ToLowerInvariant(); } return text; } private static bool IsSingleLetterKey(string value) { if (value != null && value.Length == 1 && value[0] >= 'A') { return value[0] <= 'Z'; } return false; } private static bool IsFunctionKeyName(string value) { if (string.IsNullOrEmpty(value) || value.Length < 2 || value.Length > 3 || value[0] != 'F') { return false; } int num = 0; for (int i = 1; i < value.Length; i++) { char c = value[i]; if (c < '0' || c > '9') { return false; } num = num * 10 + (c - 48); } if (num >= 1) { return num <= 24; } return false; } private void OnDestroy() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown Application.logMessageReceived -= new LogCallback(OnUnityLogMessageReceived); if (Instance == this) { Instance = null; } MoreUiApi.IsLoaded = false; MoreUiApi.ResetSnapshot(); WzcMapValueService.Reset(); if (valuableHaulHarmony != null) { valuableHaulHarmony.UnpatchSelf(); valuableHaulHarmony = null; } valuablesCurrentlyInDollarHaul.Clear(); if ((Object)(object)overlayObject != (Object)null) { Object.Destroy((Object)(object)overlayObject); overlayObject = null; overlayRect = null; overlayLabel = null; } if ((Object)(object)overlayCanvasObject != (Object)null) { Object.Destroy((Object)(object)overlayCanvasObject); overlayCanvasObject = null; overlayCanvas = null; } } private static void DrawKeyBinding(ConfigEntryBase entry) { if (entry is ConfigEntry val) { GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label(entry.Definition.Key, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) }); string text = SanitizeConfiguredKeyName(val.Value); if (!string.Equals(val.Value, text, StringComparison.Ordinal)) { val.Value = text; } string text2 = GUILayout.TextField(text, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(70f) }); if (text2 != text) { val.Value = SanitizeConfiguredKeyName(text2); } bool flag = keyCaptureEntry == val; if (GUILayout.Button(flag ? "按下按键..." : "录入按键", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(95f) })) { keyCaptureEntry = (flag ? null : val); } if (flag) { CaptureKeyInput(val); } GUILayout.EndHorizontal(); } } private static void DrawContactInfo(ConfigEntryBase entry) { GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label(entry.Definition.Key, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) }); GUILayout.Label(entry.BoxedValue?.ToString() ?? "824639225", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(160f) }); GUILayout.EndHorizontal(); } private static void CaptureKeyInput(ConfigEntry keyEntry) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Invalid comparison between Unknown and I4 //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Invalid comparison between Unknown and I4 //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) Event current = Event.current; if (current == null) { return; } if ((int)current.type == 4 && (int)current.keyCode != 0) { if ((int)current.keyCode != 27) { KeyCode keyCode = current.keyCode; keyEntry.Value = SanitizeConfiguredKeyName(((object)(KeyCode)(ref keyCode)).ToString()); } keyCaptureEntry = null; current.Use(); } else if ((int)current.type == 0) { keyEntry.Value = "mouse" + current.button; keyCaptureEntry = null; current.Use(); } } private static void DrawDisplayMode(ConfigEntryBase entry) { if (entry is ConfigEntry val) { GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label(entry.Definition.Key, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) }); DisplayMode value = val.Value; if (GUILayout.Button(ConfigText.TranslateDisplayMode(value), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(140f) })) { val.Value = ((value == DisplayMode.文字显示) ? DisplayMode.原生UI显示 : DisplayMode.文字显示); } 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; enemyLabels.Clear(); enemyDisplayNameCache.Clear(); playerNameCache.Clear(); playerColorCache.Clear(); playerLabelYOffsetCache.Clear(); enemyLabelYOffsetCache.Clear(); cartLabelYOffsetCache.Clear(); enemyObjectsFrameCache = Array.Empty(); cartObjectsFrameCache = Array.Empty(); grabberObjectsFrameCache = Array.Empty(); valuableObjectsFrameCache = Array.Empty(); playerObjectsFrameCache = null; enemyObjectsFrameCacheFrame = -1; cartObjectsFrameCacheFrame = -1; grabberObjectsFrameCacheFrame = -1; valuableObjectsFrameCacheFrame = -1; playerObjectsFrameCacheFrame = -1; ClearCartLabelIndices(); ClearCartDistanceCache(); ClearEnemyProximityTracking(); teammateVisibleTimer = 0f; teammateProximityVisibleTimer = 0f; teammateProximityRefreshTimer = 0f; enemyVisibleTimer = 0f; enemyProximityVisibleTimer = 0f; 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_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) try { if (SemiFunc.RunIsShop()) { return true; } } catch { } try { if ((Object)(object)RunManager.instance != (Object)null && (Object)(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)(object)instance != (Object)null && instance.levelTransitionLogIndicatesRun) { return true; } try { if ((Object)(object)RunManager.instance != (Object)null && (Object)(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() { if ((Object)(object)GameDirector.instance == (Object)null) { return false; } switch (((object)(gameState)(ref GameDirector.instance.currentState)).ToString()) { case "Main": case "Outro": case "End": case "EndWait": case "Death": return true; default: return false; } } 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() { Plugin instance = Instance; if (!((Object)(object)instance == (Object)null)) { return instance.IsModEnabled(); } return true; } } internal sealed class ReferenceObjectComparer : IEqualityComparer { public static readonly ReferenceObjectComparer Instance = new ReferenceObjectComparer(); private ReferenceObjectComparer() { } public new bool Equals(object x, object y) { return x == y; } public int GetHashCode(object obj) { if (obj != null) { return RuntimeHelpers.GetHashCode(obj); } return 0; } } public static class MoreUiApi { private static MoreUiSnapshot snapshot = new MoreUiSnapshot(); public static bool IsLoaded { get; internal set; } public static MoreUiSnapshot Snapshot => snapshot; public static bool IsInRun => snapshot.IsInRun; public static string OverlayText => snapshot.OverlayText; public static string Language => snapshot.Language; public static string DisplayMode => snapshot.DisplayMode; public static int EnemyTotalCount => snapshot.EnemyTotalCount; public static IReadOnlyDictionary EnemyBreakdown => snapshot.EnemyBreakdown; public static bool MapValueAvailable => snapshot.MapValueAvailable; public static float MapValue => snapshot.MapValue; public static float InitialMapValue => snapshot.InitialMapValue; public static float UnexploredMapValue => snapshot.UnexploredMapValue; public static bool HasLiveValuableData => snapshot.HasLiveValuableData; public static int ExplorationProgressPercent => snapshot.ExplorationProgressPercent; public static float LostMapValue => snapshot.LostMapValue; public static float CurrentRunEvacuatedFunds => snapshot.CurrentRunEvacuatedFunds; public static float CurrentRunSubmittedFunds => snapshot.CurrentRunSubmittedFunds; public static float WarehouseFunds => snapshot.WarehouseFunds; public static float ShopRemainingFunds => snapshot.ShopRemainingFunds; public static int LevelNumber => snapshot.LevelNumber; public static string LevelName => snapshot.LevelName; public static int TotalPlayerCount => snapshot.TotalPlayerCount; public static int AlivePlayerCount => snapshot.AlivePlayerCount; public static int DeadPlayerCount => snapshot.DeadPlayerCount; public static IReadOnlyList AliveTeammates => snapshot.AliveTeammates; public static IReadOnlyList DeadTeammates => snapshot.DeadTeammates; public static IReadOnlyList Enemies => snapshot.Enemies; public static IReadOnlyList Carts => snapshot.Carts; public static MoreUiDisplaySettings Settings => snapshot.Settings; public static bool TeammateAliveOverlayEnabled => snapshot.Settings.TeammateAliveOverlayEnabled; public static bool TeammateDeadOverlayEnabled => snapshot.Settings.TeammateDeadOverlayEnabled; internal static void UpdateSnapshot(MoreUiSnapshot value) { snapshot = value ?? new MoreUiSnapshot(); } internal static void ResetSnapshot() { snapshot = new MoreUiSnapshot(); } } public sealed class MoreUiSnapshot { public bool IsInRun { get; internal set; } public string Language { get; internal set; } = string.Empty; public string DisplayMode { get; internal set; } = string.Empty; public string OverlayText { get; internal set; } = string.Empty; public int EnemyTotalCount { get; internal set; } public IReadOnlyDictionary EnemyBreakdown { get; internal set; } = new Dictionary(); public bool MapValueAvailable { get; internal set; } public float MapValue { get; internal set; } public float InitialMapValue { get; internal set; } public float UnexploredMapValue { get; internal set; } public bool HasLiveValuableData { get; internal set; } public int ExplorationProgressPercent { get; internal set; } public float LostMapValue { get; internal set; } public float CurrentRunEvacuatedFunds { get; internal set; } public float CurrentRunSubmittedFunds { get; internal set; } public float WarehouseFunds { get; internal set; } public float ShopRemainingFunds { get; internal set; } public int LevelNumber { get; internal set; } public string LevelName { get; internal set; } = string.Empty; public int TotalPlayerCount { get; internal set; } public int AlivePlayerCount { get; internal set; } public int DeadPlayerCount { get; internal set; } public IReadOnlyList AliveTeammates { get; internal set; } = new List(); public IReadOnlyList DeadTeammates { get; internal set; } = new List(); public IReadOnlyList Enemies { get; internal set; } = new List(); public IReadOnlyList Carts { get; internal set; } = new List(); public MoreUiDisplaySettings Settings { get; internal set; } = new MoreUiDisplaySettings(); public int UpdatedFrame { get; internal set; } public DateTime UpdatedAtUtc { get; internal set; } = DateTime.MinValue; } public sealed class MoreUiPlayerDistance { public string Name { get; internal set; } = string.Empty; public int DistanceMeters { get; internal set; } public bool IsDead { get; internal set; } public bool IsLocalPlayer { get; internal set; } public string ColorHex { get; internal set; } = "FFFFFF"; } public sealed class MoreUiEnemyDistance { public string Name { get; internal set; } = string.Empty; public int DistanceMeters { get; internal set; } public string ColorHex { get; internal set; } = "ff3333"; public bool IsInsideProximityRange { get; internal set; } public bool HasPopEffect { get; internal set; } public Vector3 ReferencePosition { get; internal set; } public Vector3 LabelPosition { get; internal set; } } 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 bool IsBeingPushed { get; internal set; } public string ColorHex { get; internal set; } = "ffd84d"; public string PlainText { 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 MoreUiDisplaySettings { public bool ModEnabled { get; internal set; } public bool OverlayEnabled { get; internal set; } public bool SectionSpacing { get; internal set; } public string Language { get; internal set; } = string.Empty; public bool EnemyNicknameNamesEnabled { get; internal set; } public string DisplayMode { get; internal set; } = string.Empty; public int FontSize { get; internal set; } public float UpdateIntervalSeconds { get; internal set; } public int OverlayOffsetX { get; internal set; } public int OverlayOffsetY { get; internal set; } public bool ShowEnemySection { get; internal set; } public bool ShowEnemyBreakdown { get; internal set; } public bool ShowEnemyTotal { get; internal set; } public bool ShowValueSection { get; internal set; } public bool ShowMapLostValue { get; internal set; } public bool ShowExplorationProgress { get; internal set; } public bool ShowMapTotalValue { get; internal set; } public bool ShowCurrentRunSubmittedFunds { get; internal set; } public bool ShowShopRemainingFunds { get; internal set; } public bool ShowEvacuatedFunds { get; internal set; } public bool ShowLevelInfo { get; internal set; } public bool ShowTeammateInfoSection { get; internal set; } public bool ShowDeadTeammates { get; internal set; } public bool ShowAliveTeammates { get; internal set; } public bool ShowPlayerCounts { get; internal set; } public bool TeammateOverlayEnabled { get; internal set; } public bool TeammateAliveOverlayEnabled { get; internal set; } public bool TeammateDeadOverlayEnabled { get; internal set; } public int TeammateFontSize { get; internal set; } public float TeammateLabelHeightOffsetMeters { get; internal set; } public int TeammateFarFontShrinkPercent { get; internal set; } public float TeammateUpdateIntervalSeconds { get; internal set; } public string TeammateDisplayMode { get; internal set; } = string.Empty; public string TeammateToggleKey { get; internal set; } = string.Empty; public int TeammateHoldSeconds { get; internal set; } public bool TeammateProximityAutoShowEnabled { get; internal set; } public int TeammateProximityAutoShowDistanceMeters { get; internal set; } public bool EnemyOverlayEnabled { get; internal set; } public int EnemyFontSize { get; internal set; } public int EnemyFarFontShrinkPercent { get; internal set; } public float EnemyUpdateIntervalSeconds { get; internal set; } public string EnemyDisplayMode { get; internal set; } = string.Empty; public string EnemyToggleKey { get; internal set; } = string.Empty; public int EnemyHoldSeconds { get; internal set; } public bool EnemyProximityAutoShowEnabled { get; internal set; } public int EnemyProximityAutoShowDistanceMeters { get; internal set; } public bool CartSectionEnabled { get; internal set; } public bool CartOverlayEnabled { get; internal set; } public bool SmallCartOverlayEnabled { get; internal set; } public int CartFontSize { get; internal set; } public int CartFarFontShrinkPercent { get; internal set; } public float CartLabelHeightOffsetMeters { get; internal set; } public float CartUpdateIntervalSeconds { get; internal set; } } 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 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 static class ConfigText { public const string SectionBasic = "E1.右下角基础设置"; public const string SectionEnemy = "E2.右下角怪物统计"; public const string SectionValue = "E3.右下角价值统计"; public const string SectionOther = "E4.右下角其他信息"; public const string SectionTeammateInfo = "E4.右下角好友信息"; public const string Enabled = "启用"; public const string ContactInfo = "REPO交流QQ群"; public const string ModuleName = "模组名称"; public const string ModuleVersion = "模组版本号"; public const string ModEnabled = "模组启用"; public const string SectionSpacing = "不同分区空行"; public const string DisplayLanguage = "语言/Language"; public const string EnemyNicknameNames = "敌人名字优化"; public const string DisplayMode = "显示模式"; public const string FontSize = "字体大小"; public const string UpdateInterval = "刷新间隔/秒"; public const string OverlayOffsetX = "右下角X偏移/像素"; public const string OverlayOffsetY = "右下角Y偏移/像素"; public const string ShowEnemySection = "启用"; public const string ShowEnemyBreakdown = "显示怪物明细"; public const string ShowEnemyTotal = "显示怪物总数"; public const string ShowValueSection = "启用"; public const string ShowMapLostValue = "显示本局损失资金"; public const string ShowExplorationProgress = "显示已提取进度"; public const string ShowMapTotalValue = "显示地图剩余资金"; public const string ShowCurrentRunSubmittedFunds = "显示本局提交资金"; public const string ShowShopRemainingFunds = "显示商店剩余资金"; public const string ShowLevelInfo = "显示关卡信息"; public const string ShowTeammateInfoSection = "启用"; public const string ShowPlayerCounts = "显示玩家数量"; public const string ShowAliveTeammates = "显示存活好友信息"; public const string ShowDeadTeammates = "显示死亡好友信息"; public const string EnabledDescription = "是否在右下角显示额外信息。"; public const string ContactInfoDescription = "REPO游戏交流、BUG反馈、优化建议、功能请求请加QQ群。此处只是提示,不影响功能。"; public const string ModuleNameDescription = "当前模组的中文名称。此处只是提示,不影响功能。"; public const string ModuleVersionDescription = "当前模组版本号。此处只是提示,不影响功能。"; public const string ModEnabledDescription = "关闭后整个模组所有UI显示功能都不生效,包括右下角显示、队友/敌人距离、购物车距离、怪物统计和价值统计。"; public const string SectionSpacingDescription = "默认开启。开启后不同信息分区之间会插入一行空白。"; public const string DisplayLanguageDescription = "选择游戏内显示文本的语言。默认中文,English 会把怪物名称和右下角字段名切换为英文。"; public const string EnemyNicknameNamesDescription = "默认开启。仅在语言为中文时生效,会把直接翻译的敌人名称优化成更顺口、更好辨认的中文名字;语言为 English 时始终显示英文。"; public const string DisplayModeDescription = "可切换为文字显示或更贴近游戏的原生UI显示。"; public const string FontSizeDescription = "显示文字的字体大小。"; public const string UpdateIntervalDescription = "每隔多少秒刷新一次显示。"; public const string OverlayOffsetXDescription = "右下角信息的水平偏移。正数向左移动,负数向右移动。"; public const string OverlayOffsetYDescription = "右下角信息的垂直偏移。正数向上移动,负数向下移动。"; public const string ShowEnemySectionDescription = "关闭后右下角怪物统计分区全部不显示。"; public const string ShowEnemyBreakdownDescription = "显示每种怪物当前数量。"; public const string ShowEnemyTotalDescription = "显示当前存活怪物总数。"; public const string ShowValueSectionDescription = "关闭后右下角价值统计分区全部不显示。"; public const string ShowMapLostValueDescription = "显示本局中已摔坏或丢失造成的资金损失。"; public const string ShowExplorationProgressDescription = "单独显示已提取进度。进度按地图初始总价值计算,已放到提取点或购物车的物资也算作已提取。"; public const string ShowMapTotalValueDescription = "显示当前地图剩余资金。已放到提取点的物品会被排除,购物车里和地图上未提取的物品仍会计入。"; public const string ShowCurrentRunSubmittedFundsDescription = "显示本局已经成功带走并结算的资金。仅放进提取点但未提取成功时不会计入。"; public const string ShowShopRemainingFundsDescription = "显示商店剩余资金。此值只在每局开始读取一次快照,当前关卡提交物品不会让它上涨。"; public const string ShowLevelInfoDescription = "显示当前关卡编号和名称,位于商店剩余资金下面。"; public const string ShowTeammateInfoSectionDescription = "关闭后右下角好友信息分区全部不显示。"; public const string ShowPlayerCountsDescription = "在右下角好友信息分区最底部显示死亡、存活和总玩家数量。"; public const string ShowAliveTeammatesDescription = "在右下角好友信息分区显示每个存活好友的名字和距离,距离越近越靠上。"; public const string ShowDeadTeammatesDescription = "在右下角好友信息分区顶部显示死亡好友图标、名字和距离,距离越近越靠上。"; public static string TranslateDisplayMode(DisplayMode mode) { if (mode == global::DisplayMode.原生UI显示) { return "原生UI显示"; } return "文字显示"; } } internal static class EnemyNameLocalizer { private static readonly Dictionary NameMap = new Dictionary(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 NicknameMap = new Dictionary(StringComparer.OrdinalIgnoreCase) { ["Animal"] = "小六子", ["Enemy Animal"] = "小六子", ["Dog"] = "摸摸小狗", ["Elsa"] = "摸摸小狗", ["Enemy Elsa"] = "摸摸小狗" }; private static readonly Dictionary ChineseNicknameMap = new Dictionary(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 activeMap = (useNicknames ? NicknameMap : NameMap); if (TryGetTranslatedName(activeMap, text, out var 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, "^(?\\d+)\\s+(?.+)$"); 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 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 var 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 LevelNameLocalizer { private static readonly Dictionary NameMap = new Dictionary(StringComparer.OrdinalIgnoreCase) { ["Swiftbroom Academy"] = "迅帚学院", ["Headman Manor"] = "黑德曼庄园", ["McJannek Station"] = "麦詹内克站", ["Service Station"] = "服务站", ["The Factory"] = "工厂", ["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 var value)) { return text; } return value; } } internal sealed class ConfigurationManagerAttributes { public int? Order; public Action CustomDrawer; public bool? ReadOnly; } internal struct ValuableSnapshot { public float OriginalValue; public float CurrentValue; public float CurrentDamage; public float CountedLostValue; public bool WasInHaul; } internal struct CartLabelCandidate { public int Id; public Vector3 Position; } internal struct LabelYOffsetCache { public float YOffset; public float UpdatedAt; } internal struct PlayerColorCacheEntry { public int ColorIndex; public string ColorHex; public float UpdatedAt; } internal sealed class EnemyLabelInfo { public Enemy Enemy; public string Name; public float LabelYOffset; public Transform ReferenceTransform; } internal static class WzcMapValueService { private static readonly FieldInfo ValuableCurrentValueField = typeof(ValuableObject).GetField("dollarValueCurrent", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); private static readonly FieldInfo ValuableOriginalValueField = typeof(ValuableObject).GetField("dollarValueOriginal", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); private static readonly FieldInfo ValuableValueSetField = typeof(ValuableObject).GetField("dollarValueSet", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); private static int builtInLevelNumber = -1; private static float builtInInitialValue; private static bool hasBuiltInInitialValue; private static readonly Dictionary trackedCurrentValues = new Dictionary(); private static readonly Dictionary trackedOriginalValues = new Dictionary(); public static void Reset() { builtInLevelNumber = -1; builtInInitialValue = 0f; hasBuiltInInitialValue = false; trackedCurrentValues.Clear(); trackedOriginalValues.Clear(); } public static void RegisterValueSet(ValuableObject valuable, float value, int levelNumber) { EnsureLevel(levelNumber); if (!((Object)(object)valuable == (Object)null) && !(value <= 0f)) { TrackValue(valuable, value, Mathf.Max(value, GetValuableOriginalValue(valuable))); } } public static void RegisterValueSet(ValuableObject valuable, int levelNumber) { EnsureLevel(levelNumber); if (!((Object)(object)valuable == (Object)null)) { float valuableCurrentValue = GetValuableCurrentValue(valuable); if (!(valuableCurrentValue <= 0f)) { TrackValue(valuable, valuableCurrentValue, Mathf.Max(valuableCurrentValue, GetValuableOriginalValue(valuable))); } } } public static void RegisterBreak(ValuableObject valuable, float valueLost, int levelNumber) { EnsureLevel(levelNumber); if (!((Object)(object)valuable == (Object)null) && !(valueLost <= 0f)) { int key = GetKey(valuable); if (trackedCurrentValues.TryGetValue(key, out var value)) { trackedCurrentValues[key] = Mathf.Max(0f, value - valueLost); } else { RegisterValueSet(valuable, levelNumber); } } } public static void RegisterDestroy(ValuableObject valuable, int levelNumber) { EnsureLevel(levelNumber); if (!((Object)(object)valuable == (Object)null)) { int key = GetKey(valuable); trackedCurrentValues.Remove(key); trackedOriginalValues.Remove(key); } } public static void SyncFromLiveValuables(ValuableObject[] valuables, int levelNumber) { EnsureLevel(levelNumber); trackedCurrentValues.Clear(); trackedOriginalValues.Clear(); if (valuables == null || valuables.Length == 0) { return; } foreach (ValuableObject valuable in valuables) { if (IsValuableReady(valuable)) { TrackValue(valuable, GetValuableCurrentValue(valuable), GetValuableOriginalValue(valuable)); } } } public static bool TryGetValues(ValuableObject[] valuables, int levelNumber, out float mapValue, out float initialMapValue) { mapValue = 0f; initialMapValue = 0f; EnsureLevel(levelNumber); if (valuables == null) { valuables = Object.FindObjectsOfType(); } if (valuables == null) { valuables = Array.Empty(); } float num = 0f; float num2 = 0f; bool flag = false; ValuableObject[] array = valuables; foreach (ValuableObject valuable in array) { if (IsValuableReady(valuable)) { flag = true; float valuableCurrentValue = GetValuableCurrentValue(valuable); float valuableOriginalValue = GetValuableOriginalValue(valuable); num += valuableCurrentValue; num2 += valuableOriginalValue; TrackValue(valuable, valuableCurrentValue, valuableOriginalValue); } } float num3 = SumValues(trackedCurrentValues); float num4 = SumValues(trackedOriginalValues); if (!flag && num3 <= 0f && num4 <= 0f) { return false; } num = Mathf.Max(num, num3); num2 = Mathf.Max(num2, num4); float num5 = Mathf.Max(num, num2); if (!hasBuiltInInitialValue || num5 > builtInInitialValue) { builtInInitialValue = num5; hasBuiltInInitialValue = builtInInitialValue > 0f; } if (!hasBuiltInInitialValue) { return false; } mapValue = Mathf.Max(0f, num); initialMapValue = Mathf.Max(mapValue, builtInInitialValue); return true; } private static bool IsValuableReady(ValuableObject valuable) { if ((Object)(object)valuable == (Object)null) { return false; } if (ValuableValueSetField != null) { object value = ValuableValueSetField.GetValue(valuable); if (value is bool && !(bool)value) { return false; } } float @float = GetFloat(ValuableCurrentValueField, valuable); float float2 = GetFloat(ValuableOriginalValueField, valuable); if (!(@float > 0f)) { return float2 > 0f; } return true; } private static void EnsureLevel(int levelNumber) { if (levelNumber != builtInLevelNumber) { builtInLevelNumber = levelNumber; builtInInitialValue = 0f; hasBuiltInInitialValue = false; trackedCurrentValues.Clear(); trackedOriginalValues.Clear(); } } private static void TrackValue(ValuableObject valuable, float currentValue, float originalValue) { if (!((Object)(object)valuable == (Object)null)) { int key = GetKey(valuable); if (currentValue <= 0f) { trackedCurrentValues.Remove(key); trackedOriginalValues.Remove(key); } else { trackedCurrentValues[key] = Mathf.Max(0f, currentValue); trackedOriginalValues[key] = Mathf.Max(Mathf.Max(0f, originalValue), trackedCurrentValues[key]); } } } private static float SumValues(Dictionary values) { float num = 0f; foreach (float value in values.Values) { num += Mathf.Max(0f, value); } return num; } private static int GetKey(ValuableObject valuable) { if (!((Object)(object)valuable == (Object)null)) { return ((Object)valuable).GetInstanceID(); } return 0; } private static float GetValuableCurrentValue(ValuableObject valuable) { return Mathf.Max(0f, GetFloat(ValuableCurrentValueField, valuable)); } private static float GetValuableOriginalValue(ValuableObject valuable) { return Mathf.Max(0f, GetFloat(ValuableOriginalValueField, valuable)); } private static float GetFloat(FieldInfo field, object instance) { if (field == null || instance == null) { return 0f; } object value = field.GetValue(instance); if (value == null) { return 0f; } try { return Convert.ToSingle(value, CultureInfo.InvariantCulture); } catch { return 0f; } } }