using System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using Agents; using GameData; using Gear; using Hikaria.CGHUDInfo.Utils; using Il2CppInterop.Runtime.InteropTypes; using Il2CppSystem.Collections.Generic; using Localization; using Player; using SNetwork; using TMPro; using TheArchive.Core; using TheArchive.Core.Attributes; using TheArchive.Core.Attributes.Feature.Members; using TheArchive.Core.Attributes.Feature.Patches; using TheArchive.Core.Attributes.Feature.Settings; using TheArchive.Core.FeaturesAPI; using TheArchive.Core.FeaturesAPI.Settings; using TheArchive.Core.Localization; using TheArchive.Interfaces; using TheArchive.Loader; using TheArchive.Utilities; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.0.0.0")] [module: UnverifiableCode] namespace Hikaria.CGHUDInfo { [ArchiveModule("Hikaria.CGHUDInfo", "ColorGradingHUDInfo", "1.0.1")] public class EntryPoint : IArchiveModule { public ILocalizationService LocalizationService { get; set; } public IArchiveLogger Logger { get; set; } public void Init() { Logs.Setup(Logger); } } internal static class Logs { private static IArchiveLogger _logger; public static void Setup(IArchiveLogger logger) { _logger = logger; } public static void LogDebug(object data) { _logger.Debug(data.ToString()); } public static void LogError(object data) { _logger.Error(data.ToString()); } public static void LogInfo(object data) { _logger.Info(data.ToString()); } public static void LogMessage(object data) { _logger.Msg(ConsoleColor.White, data.ToString()); } public static void LogWarning(object data) { _logger.Warning(data.ToString()); } public static void LogNotice(object data) { _logger.Notice(data.ToString()); } public static void LogSuccess(object data) { _logger.Success(data.ToString()); } public static void LogException(Exception ex) { _logger.Exception(ex); } } public static class PluginInfo { public const string GUID = "Hikaria.CGHUDInfo"; public const string NAME = "ColorGradingHUDInfo"; public const string VERSION = "1.0.1"; } } namespace Hikaria.CGHUDInfo.Utils { public class RatioColor { public Color Color; public float Ratio; public RatioColor(Color color, float ratio) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) Color = color; Ratio = ratio; } } public class RatioColorDeterminer { public List _colorGrades; public Color GetDeterminedColor(float ratio, float ratioScale = 1f) { //IL_0012: 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_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_008c: 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) //IL_0054: 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_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) ratioScale = Mathf.Clamp(ratioScale, 0.001f, 1f); Color result = Color.white; float num = 0f; Color val = Color.black; for (int i = 0; i < _colorGrades.Count; i++) { RatioColor ratioColor = _colorGrades[i]; if (i != 0) { float num2 = (ratio - num) / (ratioColor.Ratio * ratioScale - num); num = ratioColor.Ratio * ratioScale; result = Color.Lerp(val, ratioColor.Color, Mathf.Clamp01(num2)); if (num2 < 1f) { break; } } val = ratioColor.Color; } return result; } public string GetDeterminedColorHTML(float ratio, float ratioScale = 1f) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) return ColorUtility.ToHtmlStringRGBA(GetDeterminedColor(ratio, ratioScale)); } } public class TextEntity { private string m_text; public TextEntity(string text) { m_text = text; } public void AddColor(Color color) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) string text = ColorUtility.ToHtmlStringRGBA(color); m_text = "" + m_text + ""; } public void AddSize(float ratio) { m_text = "" + m_text + ""; } public static implicit operator string(TextEntity component) { return component.m_text; } } } namespace Hikaria.CGHUDInfo.Features { public class CGHUDInfo : Feature { public class CGHUDInfoSettings { [FSDisplayName("显示栏位")] public List ShowSlots { get; set; } = new List(); [FSDisplayName("隐藏空栏位")] public bool HideEmptySlots { get; set; } [FSDisplayName("瞄准时透明")] public bool TransparentWhenAim { get; set; } = true; [FSDisplayName("自动文本大小")] [FSDescription("跟据手持物品自动调整对应文本大小")] public bool AutoFontSizeUp { get; set; } = true; [FSDisplayName("自动隐藏文本")] [FSDescription("跟据手持物品自动隐藏无关内容")] public bool AutoHideText { get; set; } = true; [FSDisplayName("动态透明度")] public bool DynamicTrasparency { get; set; } = true; [FSDisplayName("信息常显")] public bool AlwaysVisible { get; set; } = true; [FSDisplayName("使用次数替代百分比")] public bool UseTimesInsteadOfPercentage { get; set; } = true; } [Localized] public enum HUDInfos { Health, Infection, GearStandard, GearSpecial, GearClass, ResourcePack, Consumable, BotLeader } [ArchivePatch(/*Could not decode attribute arguments.*/)] private class PlaceNavMarkerOnGO__PlaceMarker__Patch { private static void Postfix(PlaceNavMarkerOnGO __instance) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)__instance.m_marker != (Object)null && (int)__instance.type == 0) { ((TMP_Text)__instance.m_marker.m_playerName).alignment = (TextAlignmentOptions)1026; ((TMP_Text)__instance.m_marker.m_playerName).fontSizeMax = 30f; ((TMP_Text)__instance.m_marker.m_playerName).fontSizeMin = 25f; } } } [ArchivePatch(/*Could not decode attribute arguments.*/)] private class PlayerAgent__Setup__Patch { private static void Postfix(PlayerAgent __instance) { if (!((Agent)__instance).IsLocallyOwned && (Object)(object)((Component)__instance).GetComponent() == (Object)null) { ((Component)__instance).gameObject.AddComponent(); } } } [ArchivePatch(/*Could not decode attribute arguments.*/)] private class SentryGunInstance__OnSpawn__Patch { private static void Postfix(SentryGunInstance __instance) { if (Feature.CurrentGameState >= 10) { PlayerAgent owner = ((Item)__instance).Owner; SNet_Player val = ((owner != null) ? owner.Owner : null); if (!((Object)(object)val == (Object)null) && !val.IsLocal) { _sentryGunInstances[val.Lookup] = __instance; } } } } [ArchivePatch(/*Could not decode attribute arguments.*/)] private class SentryGunInstance__OnDespawn__Patch { private static void Prefix(SentryGunInstance __instance) { if (Feature.CurrentGameState >= 10) { PlayerAgent owner = ((Item)__instance).Owner; SNet_Player val = ((owner != null) ? owner.Owner : null); if (!((Object)(object)val == (Object)null) && !val.IsLocal) { _sentryGunInstances.Remove(val.Lookup); } } } } [ArchivePatch(/*Could not decode attribute arguments.*/)] private class PlayerInventoryLocal__DoWieldItem__Patch { private static void Postfix(PlayerInventoryLocal __instance) { PlaceNavMarkerOnGO__UpdateExtraInfo__Patch.UpdateSizeUp(((PlayerInventoryBase)__instance).Owner); } } [ArchivePatch(/*Could not decode attribute arguments.*/)] private class PlayerAgent__set_Alive__Patch { private static void Postfix(PlayerAgent __instance) { if (((Agent)__instance).IsLocallyOwned) { PlaceNavMarkerOnGO__UpdateExtraInfo__Patch.UpdateSizeUp(__instance); } } } [ArchivePatch(/*Could not decode attribute arguments.*/)] private class PlaceNavMarkerOnGO__UpdateExtraInfo__Patch { private enum eResourcePackType : byte { None, Health, AmmoWeapon, AmmoTool, Disinfection } private static bool healthSizeUp = false; private static bool weaponSizeUp = false; private static bool toolSizeUp = false; private static bool infectionSizeUp = false; private static bool hideHealth = false; private static bool hideWeaponAmmo = false; private static bool hideInfection = false; private static bool hideToolAmmo = false; private static bool hideOthers = false; private static eResourcePackType currentResourcePackType = eResourcePackType.None; private static StringBuilder sb = new StringBuilder(300); private static eResourcePackType GetPackType(eResourceContainerSpawnType spawnType) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected I4, but got Unknown //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Invalid comparison between Unknown and I4 switch ((int)spawnType) { default: if ((int)spawnType == 9) { return eResourcePackType.Disinfection; } return eResourcePackType.None; case 0: return eResourcePackType.Health; case 2: return eResourcePackType.AmmoTool; case 1: return eResourcePackType.AmmoWeapon; } } public static void UpdateSizeUp(PlayerAgent localPlayer) { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Invalid comparison between Unknown and I4 //IL_0057: Unknown result type (might be due to invalid IL or missing references) healthSizeUp = false; weaponSizeUp = false; toolSizeUp = false; infectionSizeUp = false; hideHealth = false; hideInfection = false; hideWeaponAmmo = false; hideToolAmmo = false; hideOthers = false; currentResourcePackType = (((int)localPlayer.Inventory.WieldedSlot == 4) ? GetPackType(((Il2CppObjectBase)localPlayer.Inventory.WieldedItem).Cast().m_packType) : eResourcePackType.None); if (!((Agent)localPlayer).Alive || currentResourcePackType == eResourcePackType.None) { return; } if (Settings.AutoHideText) { hideHealth = currentResourcePackType != eResourcePackType.Health; hideInfection = currentResourcePackType != eResourcePackType.Disinfection && currentResourcePackType != eResourcePackType.Health; hideWeaponAmmo = currentResourcePackType != eResourcePackType.AmmoWeapon; hideToolAmmo = currentResourcePackType != eResourcePackType.AmmoTool; hideOthers = true; } if (Settings.AutoFontSizeUp) { switch (currentResourcePackType) { case eResourcePackType.Health: healthSizeUp = true; break; case eResourcePackType.AmmoWeapon: weaponSizeUp = true; break; case eResourcePackType.AmmoTool: toolSizeUp = true; break; case eResourcePackType.Disinfection: infectionSizeUp = true; break; } } } private static bool Prefix(PlaceNavMarkerOnGO __instance) { //IL_0009: 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_0140: Invalid comparison between Unknown and I4 //IL_0ecb: Unknown result type (might be due to invalid IL or missing references) //IL_06f5: Unknown result type (might be due to invalid IL or missing references) //IL_03d4: Unknown result type (might be due to invalid IL or missing references) //IL_042d: Unknown result type (might be due to invalid IL or missing references) //IL_0433: Invalid comparison between Unknown and I4 //IL_032f: Unknown result type (might be due to invalid IL or missing references) //IL_06fd: Unknown result type (might be due to invalid IL or missing references) //IL_05db: Unknown result type (might be due to invalid IL or missing references) //IL_0634: Unknown result type (might be due to invalid IL or missing references) //IL_063a: Invalid comparison between Unknown and I4 //IL_0536: Unknown result type (might be due to invalid IL or missing references) //IL_09a4: Unknown result type (might be due to invalid IL or missing references) //IL_0c4b: Unknown result type (might be due to invalid IL or missing references) //IL_078e: Unknown result type (might be due to invalid IL or missing references) //IL_08a8: Unknown result type (might be due to invalid IL or missing references) //IL_08ae: Invalid comparison between Unknown and I4 //IL_0d6d: Unknown result type (might be due to invalid IL or missing references) //IL_0d73: Invalid comparison between Unknown and I4 //IL_0ac6: Unknown result type (might be due to invalid IL or missing references) //IL_0acc: Invalid comparison between Unknown and I4 //IL_0da4: Unknown result type (might be due to invalid IL or missing references) //IL_0daa: Invalid comparison between Unknown and I4 //IL_0afd: Unknown result type (might be due to invalid IL or missing references) //IL_0b03: Invalid comparison between Unknown and I4 if (!__instance.m_hasPlayer || (int)__instance.type != 0) { return true; } PlayerAgent player = __instance.Player; if ((Object)(object)player == (Object)null || ((Agent)player).IsLocallyOwned) { return true; } SNet_Player owner = player.Owner; if ((Object)(object)owner == (Object)null) { return true; } Dam_PlayerDamageBase damage = player.Damage; if ((Object)(object)damage == (Object)null) { return true; } if (!hideHealth && Settings.ShowSlots.Contains(HUDInfos.Health)) { float num = Mathf.Clamp01(((Dam_SyncedDamageBase)damage).GetHealthRel()); StringBuilder stringBuilder = sb; StringBuilder stringBuilder2 = stringBuilder; StringBuilder.AppendInterpolatedStringHandler handler = new StringBuilder.AppendInterpolatedStringHandler(41, 4, stringBuilder); handler.AppendLiteral(""); handler.AppendFormatted(Localization.GetById(1u, (string)null)); handler.AppendLiteral(" "); handler.AppendFormatted(num * 100f, "N0"); handler.AppendLiteral("%"); stringBuilder2.AppendLine(ref handler); if ((int)Localization.CurrentLanguage == 1) { stringBuilder = sb; StringBuilder stringBuilder3 = stringBuilder; handler = new StringBuilder.AppendInterpolatedStringHandler(16, 1, stringBuilder); handler.AppendLiteral(" "); stringBuilder3.AppendLine(ref handler); } } if (!hideInfection && Settings.ShowSlots.Contains(HUDInfos.Infection) && damage.Infection > 0.1f) { StringBuilder stringBuilder = sb; StringBuilder stringBuilder4 = stringBuilder; StringBuilder.AppendInterpolatedStringHandler handler = new StringBuilder.AppendInterpolatedStringHandler(40, 3, stringBuilder); handler.AppendLiteral(""); handler.AppendFormatted(Localization.GetById(2u, (string)null)); handler.AppendLiteral(" "); handler.AppendFormatted(damage.Infection * 100f, "N0"); handler.AppendLiteral("%"); stringBuilder4.AppendLine(ref handler); } PlayerBackpack playerBackpack = __instance.m_playerBackpack; if (playerBackpack != null) { PlayerAmmoStorage ammoStorage = playerBackpack.AmmoStorage; BackpackItem val = default(BackpackItem); if (!hideWeaponAmmo && Settings.ShowSlots.Contains(HUDInfos.GearStandard) && playerBackpack.TryGetBackpackItem((InventorySlot)1, ref val)) { ItemEquippable val2 = ((Il2CppObjectBase)val.Instance).TryCast(); if ((Object)(object)val2 != (Object)null) { if ((((Item)val2).ItemDataBlock != null && ((Item)val2).ItemDataBlock.GUIShowAmmoInfinite) || !((Item)val2).ItemDataBlock.GUIShowAmmoTotalRel) { StringBuilder stringBuilder = sb; StringBuilder stringBuilder5 = stringBuilder; StringBuilder.AppendInterpolatedStringHandler handler = new StringBuilder.AppendInterpolatedStringHandler(32, 3, stringBuilder); handler.AppendLiteral(""); handler.AppendFormatted(((Item)val2).ArchetypeName); handler.AppendLiteral(""); stringBuilder5.AppendLine(ref handler); } else { float relInPack = ammoStorage.StandardAmmo.RelInPack; StringBuilder stringBuilder = sb; StringBuilder stringBuilder6 = stringBuilder; StringBuilder.AppendInterpolatedStringHandler handler = new StringBuilder.AppendInterpolatedStringHandler(34, 5, stringBuilder); handler.AppendLiteral(""); handler.AppendFormatted(((Item)val2).ArchetypeName); handler.AppendLiteral(" "); handler.AppendFormatted(relInPack * 100f, "N0"); handler.AppendLiteral("%"); handler.AppendFormatted(((int)val.Status == 1) ? (" [" + Text.Get(2505980868u) + "]") : string.Empty); handler.AppendLiteral(""); stringBuilder6.AppendLine(ref handler); } } } BackpackItem val3 = default(BackpackItem); if (!hideWeaponAmmo && Settings.ShowSlots.Contains(HUDInfos.GearSpecial) && playerBackpack.TryGetBackpackItem((InventorySlot)2, ref val3)) { ItemEquippable val4 = ((Il2CppObjectBase)val3.Instance).TryCast(); if ((Object)(object)val4 != (Object)null) { if ((((Item)val4).ItemDataBlock != null && ((Item)val4).ItemDataBlock.GUIShowAmmoInfinite) || !((Item)val4).ItemDataBlock.GUIShowAmmoTotalRel) { StringBuilder stringBuilder = sb; StringBuilder stringBuilder7 = stringBuilder; StringBuilder.AppendInterpolatedStringHandler handler = new StringBuilder.AppendInterpolatedStringHandler(32, 3, stringBuilder); handler.AppendLiteral(""); handler.AppendFormatted(((Item)val4).ArchetypeName); handler.AppendLiteral(""); stringBuilder7.AppendLine(ref handler); } else { float relInPack2 = ammoStorage.SpecialAmmo.RelInPack; StringBuilder stringBuilder = sb; StringBuilder stringBuilder8 = stringBuilder; StringBuilder.AppendInterpolatedStringHandler handler = new StringBuilder.AppendInterpolatedStringHandler(34, 5, stringBuilder); handler.AppendLiteral(""); handler.AppendFormatted(((Item)val4).ArchetypeName); handler.AppendLiteral(" "); handler.AppendFormatted(relInPack2 * 100f, "N0"); handler.AppendLiteral("%"); handler.AppendFormatted(((int)val3.Status == 1) ? (" [" + Text.Get(2505980868u) + "]") : string.Empty); handler.AppendLiteral(""); stringBuilder8.AppendLine(ref handler); } } } BackpackItem val5 = default(BackpackItem); if (!hideToolAmmo && Settings.ShowSlots.Contains(HUDInfos.GearClass) && playerBackpack.TryGetBackpackItem((InventorySlot)3, ref val5) && val5 != null && (Object)(object)val5.Instance != (Object)null) { ItemEquippable val6 = ((Il2CppObjectBase)val5.Instance).TryCast(); if ((Object)(object)val6 != (Object)null) { string value = ((Item)val6).ArchetypeName; GearIDRange gearIDRange = val6.GearIDRange; uint compID = gearIDRange.GetCompID((eGearComponent)2); eWeaponFireMode val7 = (eWeaponFireMode)gearIDRange.GetCompID((eGearComponent)1); if (compID == 12) { ArchetypeDataBlock archetypeDataForFireMode = SentryGunInstance_Firing_Bullets.GetArchetypeDataForFireMode(val7); if (archetypeDataForFireMode != null) { value = LocalizedText.op_Implicit(archetypeDataForFireMode.PublicName); } } if ((((Item)val6).ItemDataBlock != null && ((Item)val6).ItemDataBlock.GUIShowAmmoInfinite) || !((Item)val6).ItemDataBlock.GUIShowAmmoTotalRel) { StringBuilder stringBuilder = sb; StringBuilder stringBuilder9 = stringBuilder; StringBuilder.AppendInterpolatedStringHandler handler = new StringBuilder.AppendInterpolatedStringHandler(32, 3, stringBuilder); handler.AppendLiteral(""); handler.AppendFormatted(value); handler.AppendLiteral(""); stringBuilder9.AppendLine(ref handler); } else { float num2 = ammoStorage.ClassAmmo.RelInPack; if (compID == 12 && _sentryGunInstances.TryGetValue(owner.Lookup, out var value2)) { num2 = value2.Ammo / value2.AmmoMaxCap; } StringBuilder stringBuilder = sb; StringBuilder stringBuilder10 = stringBuilder; StringBuilder.AppendInterpolatedStringHandler handler = new StringBuilder.AppendInterpolatedStringHandler(34, 5, stringBuilder); handler.AppendLiteral(""); handler.AppendFormatted(value); handler.AppendLiteral(" "); handler.AppendFormatted(num2 * 100f, "N0"); handler.AppendLiteral("%"); handler.AppendFormatted(((int)val5.Status == 1) ? (" [" + Text.Get(2505980868u) + "]") : string.Empty); handler.AppendLiteral(""); stringBuilder10.AppendLine(ref handler); } } } if (!hideOthers && Settings.ShowSlots.Contains(HUDInfos.ResourcePack)) { bool flag = false; BackpackItem val8 = default(BackpackItem); if (playerBackpack.TryGetBackpackItem((InventorySlot)4, ref val8) && val8 != null && (Object)(object)val8.Instance != (Object)null) { ItemEquippable val9 = ((Il2CppObjectBase)val8.Instance).TryCast(); if ((Object)(object)val9 != (Object)null) { if ((((Item)val9).ItemDataBlock != null && ((Item)val9).ItemDataBlock.GUIShowAmmoInfinite) || !((Item)val9).ItemDataBlock.GUIShowAmmoTotalRel) { StringBuilder stringBuilder = sb; StringBuilder stringBuilder11 = stringBuilder; StringBuilder.AppendInterpolatedStringHandler handler = new StringBuilder.AppendInterpolatedStringHandler(17, 2, stringBuilder); handler.AppendLiteral(""); handler.AppendFormatted(((Item)val9).ArchetypeName); handler.AppendLiteral(""); stringBuilder11.AppendLine(ref handler); flag = true; } else { float num3 = (Settings.UseTimesInsteadOfPercentage ? ((float)ammoStorage.ResourcePackAmmo.BulletsInPack) : (ammoStorage.ResourcePackAmmo.RelInPack * 100f)); if (num3 > 0f) { StringBuilder stringBuilder = sb; StringBuilder stringBuilder12 = stringBuilder; StringBuilder.AppendInterpolatedStringHandler handler = new StringBuilder.AppendInterpolatedStringHandler(18, 5, stringBuilder); handler.AppendLiteral(""); handler.AppendFormatted(((Item)val9).ArchetypeName); handler.AppendLiteral(" "); handler.AppendFormatted(num3, "N0"); handler.AppendFormatted(Settings.UseTimesInsteadOfPercentage ? (" " + Localization.GetById(7u, (string)null) + (((int)Localization.CurrentLanguage == 1 || num3 <= 1f) ? string.Empty : "s")) : "%"); handler.AppendLiteral(""); handler.AppendFormatted(((int)val8.Status == 1) ? (" [" + Text.Get(2505980868u) + "]") : string.Empty); stringBuilder12.AppendLine(ref handler); flag = true; } } } } if (!flag && !Settings.HideEmptySlots) { StringBuilder stringBuilder = sb; StringBuilder stringBuilder13 = stringBuilder; StringBuilder.AppendInterpolatedStringHandler handler = new StringBuilder.AppendInterpolatedStringHandler(23, 1, stringBuilder); handler.AppendLiteral(""); handler.AppendFormatted(Localization.GetById(3u, (string)null)); handler.AppendLiteral(""); stringBuilder13.AppendLine(ref handler); } } if (!hideOthers && Settings.ShowSlots.Contains(HUDInfos.Consumable)) { bool flag2 = false; BackpackItem val10 = default(BackpackItem); if (playerBackpack.TryGetBackpackItem((InventorySlot)5, ref val10) && val10 != null && (Object)(object)val10.Instance != (Object)null) { ItemEquippable val11 = ((Il2CppObjectBase)val10.Instance).TryCast(); if ((Object)(object)val11 != (Object)null) { if (((Item)val11).ItemDataBlock != null && (((Item)val11).ItemDataBlock.GUIShowAmmoInfinite || !((Item)val11).ItemDataBlock.GUIShowAmmoTotalRel)) { StringBuilder stringBuilder = sb; StringBuilder stringBuilder14 = stringBuilder; StringBuilder.AppendInterpolatedStringHandler handler = new StringBuilder.AppendInterpolatedStringHandler(17, 2, stringBuilder); handler.AppendLiteral(""); handler.AppendFormatted(((Item)val11).ArchetypeName); handler.AppendLiteral(""); stringBuilder14.AppendLine(ref handler); flag2 = true; } else { float num4 = (Settings.UseTimesInsteadOfPercentage ? ((float)ammoStorage.ConsumableAmmo.BulletsInPack) : (ammoStorage.ConsumableAmmo.RelInPack * 100f)); if (num4 > 0f) { StringBuilder stringBuilder = sb; StringBuilder stringBuilder15 = stringBuilder; StringBuilder.AppendInterpolatedStringHandler handler = new StringBuilder.AppendInterpolatedStringHandler(18, 5, stringBuilder); handler.AppendLiteral(""); handler.AppendFormatted(((Item)val11).ArchetypeName); handler.AppendLiteral(" "); handler.AppendFormatted(num4, "N0"); handler.AppendFormatted(Settings.UseTimesInsteadOfPercentage ? (" " + Localization.GetById(7u, (string)null) + (((int)Localization.CurrentLanguage == 1 || num4 <= 1f) ? string.Empty : "s")) : "%"); handler.AppendLiteral(""); handler.AppendFormatted(((int)val10.Status == 1) ? (" [" + Text.Get(2505980868u) + "]") : string.Empty); stringBuilder15.AppendLine(ref handler); flag2 = true; } } } } if (!flag2 && !Settings.HideEmptySlots) { StringBuilder stringBuilder = sb; StringBuilder stringBuilder16 = stringBuilder; StringBuilder.AppendInterpolatedStringHandler handler = new StringBuilder.AppendInterpolatedStringHandler(23, 1, stringBuilder); handler.AppendLiteral(""); handler.AppendFormatted(Localization.GetById(4u, (string)null)); handler.AppendLiteral(""); stringBuilder16.AppendLine(ref handler); } } } if (!hideOthers && Settings.ShowSlots.Contains(HUDInfos.BotLeader) && owner.IsBot) { PlayerAIBot component = ((Component)player).GetComponent(); if ((Object)(object)component != (Object)null) { PlayerAgent leader = component.SyncValues.Leader; if ((Object)(object)leader != (Object)null) { StringBuilder stringBuilder = sb; StringBuilder stringBuilder17 = stringBuilder; StringBuilder.AppendInterpolatedStringHandler handler = new StringBuilder.AppendInterpolatedStringHandler(18, 3, stringBuilder); handler.AppendFormatted(Localization.GetById(5u, (string)null)); handler.AppendLiteral(" "); handler.AppendFormatted(((Agent)leader).IsLocallyOwned ? (Localization.GetById(6u, (string)null) ?? "") : leader.Owner.NickName); handler.AppendLiteral(""); stringBuilder17.AppendLine(ref handler); } } } __instance.m_extraInfo = $"{sb}"; sb.Clear(); return false; } } private class PlayerHudDistanceModifier : MonoBehaviour { private PlayerAgent m_owner; private static PlayerAgent s_localPlayerAgent; private readonly float MAX_SIZE = 15f; private readonly float MIN_SIZE = 1.5f; private readonly float MAX_DISTANCE = 40f; private readonly float MIN_DISTANCE = 10f; private readonly float MIN_ANGLE_ALPHA_VALUE = 0.075f; private readonly float MAX_ANGLE_VALUE = 40f; private readonly float MIN_ANGLE_VALUE = 8f; private void Awake() { m_owner = ((Component)this).GetComponent(); } private void Update() { UpdateNavMarkerOnPlayer(); } private void OnDestroy() { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) PlaceNavMarkerOnGO navMarker = m_owner.NavMarker; if (!((Object)(object)navMarker == (Object)null)) { NavMarker marker = navMarker.m_marker; if (!((Object)(object)marker == (Object)null)) { ((Component)marker).transform.localScale = Vector3.one * 0.8412f; navMarker.m_isInfoDirty = true; } } } public void UpdateNavMarkerOnPlayer(bool manualUpdate = false) { //IL_0069: 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_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Invalid comparison between Unknown and I4 //IL_004e: 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_0156: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_016a: 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_0119: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Invalid comparison between Unknown and I4 //IL_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: 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_0131: Invalid comparison between Unknown and I4 PlaceNavMarkerOnGO navMarker = m_owner.NavMarker; if ((Object)(object)navMarker == (Object)null) { return; } NavMarker marker = navMarker.m_marker; if ((Object)(object)marker == (Object)null) { return; } if (manualUpdate) { navMarker.m_isInfoDirty = true; } if ((Object)(object)s_localPlayerAgent == (Object)null) { s_localPlayerAgent = PlayerManager.GetLocalPlayerAgent(); ((Component)marker).transform.localScale = Vector3.one * 0.8412f; return; } float num = Mathf.Clamp(Mathf.Clamp(Vector3.Distance(((Agent)m_owner).Position, ((Agent)s_localPlayerAgent).Position), MIN_DISTANCE, MAX_DISTANCE) / MAX_DISTANCE, MIN_SIZE, MAX_SIZE); ((Component)marker).transform.localScale = Vector3.one * num; if ((int)FocusStateManager.CurrentState == 11) { marker.SetAlpha(1f); } else if (Settings.TransparentWhenAim && (Object)(object)s_localPlayerAgent.Inventory.WieldedItem != (Object)null && s_localPlayerAgent.Inventory.WieldedItem.AimButtonHeld && (int)s_localPlayerAgent.Inventory.WieldedSlot >= 1 && (int)s_localPlayerAgent.Inventory.WieldedSlot <= 3) { marker.SetAlpha(MIN_ANGLE_ALPHA_VALUE); } else if (Settings.DynamicTrasparency) { Vector3 val = ((Agent)m_owner).EyePosition - ((Agent)s_localPlayerAgent).EyePosition; float num2 = Vector3.Angle(s_localPlayerAgent.FPSCamera.CameraRayDir, val); num2 = Mathf.Clamp(num2, MIN_ANGLE_VALUE, MAX_ANGLE_VALUE); float num3 = MIN_ANGLE_VALUE / num2; marker.SetAlpha(Mathf.Clamp(num3, MIN_ANGLE_ALPHA_VALUE, 1f)); } else { marker.SetAlpha(1f); } if (Settings.AlwaysVisible) { if (!navMarker.m_extraInfoVisible) { navMarker.m_extraInfoVisible = true; } } else if (!navMarker.m_extraInfoVisible) { ((Component)marker).transform.localScale = Vector3.one * 0.8412f; } navMarker.OnPlayerInfoUpdated(true); } } private static RatioColorDeterminer _determinerHealth = new RatioColorDeterminer { _colorGrades = new List { new RatioColor(Color.red, 0f), new RatioColor(Color.red, 0.2f), new RatioColor(Color.yellow, 0.5f), new RatioColor(Color.green, 0.8f), new RatioColor(Color.cyan, 1f) } }; private static RatioColorDeterminer _determineAmmoWeaponRelInPack = new RatioColorDeterminer { _colorGrades = new List { new RatioColor(Color.red, 0f), new RatioColor(Color.yellow, 0.5f), new RatioColor(Color.green, 0.8f), new RatioColor(Color.cyan, 1f) } }; private static RatioColorDeterminer _detemineAmmoResourceRelInPack = new RatioColorDeterminer { _colorGrades = new List { new RatioColor(ColorExt.Hex("FF8B47"), 0f), new RatioColor(Color.yellow, 0.2f), new RatioColor(Color.green, 0.4f), new RatioColor(Color.cyan, 1f) } }; private static Dictionary _sentryGunInstances = new Dictionary(); public override string Name => "HUD信息增强"; public override string Description => "使HUD信息更清晰易读"; public static ILocalizationService Localization { get; set; } [FeatureConfig] public static CGHUDInfoSettings Settings { get; set; } public override void Init() { ClassInjector.RegisterTypeInIl2Cpp(false); if (Settings.ShowSlots.Count == 0) { Settings.ShowSlots = new List { HUDInfos.Health, HUDInfos.Infection, HUDInfos.GearStandard, HUDInfos.GearSpecial, HUDInfos.GearClass, HUDInfos.ResourcePack, HUDInfos.Consumable, HUDInfos.BotLeader }; ((Feature)this).MarkSettingsDirty((object)Settings.ShowSlots); } } public override void OnEnable() { _sentryGunInstances.Clear(); if (Feature.CurrentGameState < 10) { return; } foreach (SentryGunInstance item in Object.FindObjectsOfType()) { PlayerAgent owner = ((Item)item).Owner; SNet_Player val = ((owner != null) ? owner.Owner : null); if ((Object)(object)val != (Object)null) { _sentryGunInstances[val.Lookup] = item; } } Enumerator enumerator2 = PlayerManager.PlayerAgentsInLevel.GetEnumerator(); while (enumerator2.MoveNext()) { PlayerAgent current2 = enumerator2.Current; if (!((Agent)current2).IsLocallyOwned && (Object)(object)((Component)current2).GetComponent() == (Object)null) { ((Component)current2).gameObject.AddComponent(); } } } public override void OnDisable() { foreach (PlayerHudDistanceModifier item in Object.FindObjectsOfType()) { SharedUtils.SafeDestroy((Component)(object)item); } _sentryGunInstances.Clear(); } public override void OnFeatureSettingChanged(FeatureSetting setting) { foreach (PlayerHudDistanceModifier item in Object.FindObjectsOfType()) { item.UpdateNavMarkerOnPlayer(manualUpdate: true); } } } }