Decompiled source of LethalHUD v1.3.9
plugins/LethalHUD/LethalHUD.dll
Decompiled 5 days ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using BetterScanVision; using GameNetcodeStuff; using GoodItemScan; using HarmonyLib; using LethalConfig; using LethalConfig.ConfigItems; using LethalConfig.ConfigItems.Options; using LethalHUD.Compats; using LethalHUD.Configs; using LethalHUD.HUD; using LethalHUD.Misc; using LethalHUD.NetcodePatcher; using LethalHUD.Scan; using Microsoft.CodeAnalysis; using SoftMasking; using TMPro; using Unity.Netcode; using Unity.Netcode.Transports.UTP; using UnityEngine; using UnityEngine.InputSystem; using UnityEngine.InputSystem.Controls; using UnityEngine.Rendering; using UnityEngine.Rendering.HighDefinition; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: IgnoresAccessChecksTo("BepInEx")] [assembly: IgnoresAccessChecksTo("BetterScanVision")] [assembly: IgnoresAccessChecksTo("EladsHUD")] [assembly: IgnoresAccessChecksTo("GoodItemScan")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("s1ckboy")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyCopyright("Copyright © 2025 s1ckboy")] [assembly: AssemblyFileVersion("1.3.9.0")] [assembly: AssemblyInformationalVersion("1.3.9+0cd1d637c85371823ddfcfdd85dea70ae8904a92")] [assembly: AssemblyProduct("LethalHUD")] [assembly: AssemblyTitle("LethalHUD")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.3.9.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] [module: NetcodePatchedAssembly] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace LethalHUD { public static class Enums { public enum BillboardGradientMode { Static, Animated } public enum SlotEnums { None, Rainbow, Summer, Winter, Vaporwave, Deepmint, Radioactive, TideEmber } public enum ItemValue { Default, Dollar } public enum ScanMode { Default, Hold, Toggle } public enum ScanLines { Default, Circles, Hexagons, Circuit, Noisy, Scifi, Bol, Chu } public enum ScanNodeShape { Default, Triangle, Target, Web, Idk } public enum WeightUnit { Pounds, Kilograms, Manuls } public enum WeightUnitDisplay { OnlyOne, KgAndPounds, PoundsAndManuls, KgAndManuls, KgPoundsAndManuls } public enum WeightDecimalFormat { Rounded, TwoDecimalsDot, TwoDecimalsComma } public enum MTColorMode { Solid, Gradient } public enum SprintStyle { Solid, Shades, Gradient } public enum ClockStyle { Regular, Compact } public enum HPDisplayMode { Plain, Percent, Label } public enum FPSPingLayout { Vertical, Horizontal } public enum TotalValuePrefix { Full, Short, None } internal static Color solarFlare = new Color(1f, 0.8f, 0.3f); internal static Color moltenCore = new Color(1f, 0.2f, 0f); internal static Color skyWave = new Color(0.4f, 0.65f, 1f); internal static Color moonlitMist = new Color(0.8f, 0.8f, 1f); internal static Color pinkPrism = new Color(1f, 0.4f, 1f); internal static Color aquaPulse = new Color(0.4f, 1f, 1f); internal static Color mintWave = new Color(0.5647f, 0.8706f, 0.7843f); internal static Color deepTeal = new Color(0.1608f, 0.2863f, 0.2549f); internal static Color neonLime = new Color(0.443f, 0.78f, 0f); internal static Color lemonGlow = new Color(0.941f, 1f, 0.471f); internal static Color crimsonSpark = new Color(1f, 0.27f, 0f); internal static Color deepOcean = new Color(0f, 0.48f, 0.54f); private static readonly float _baseIntensity = 352.08f; private static readonly float _customBaseIntensity = 100f; internal static void DirtIntensityHandlerByScanLine() { Bloom scanBloom = ScanController.ScanBloom; if (!((Object)(object)scanBloom == (Object)null)) { if (Plugins.ConfigEntries.SelectedScanlineMode.Value == ScanLines.Default) { ((VolumeParameter<float>)(object)scanBloom.dirtIntensity).Override(Mathf.Max(0f, _baseIntensity + Plugins.ConfigEntries.DirtIntensity.Value)); } else { ((VolumeParameter<float>)(object)scanBloom.dirtIntensity).Override(Mathf.Max(0f, _customBaseIntensity + Plugins.ConfigEntries.DirtIntensity.Value)); } } } } internal class Loggers { private static void Log(LogLevel logLevel, object data) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) Plugins.Logger.Log(logLevel, data); } internal static void Info(object data) { Log((LogLevel)16, data); } internal static void Debug(object data) { Log((LogLevel)32, data); } internal static void Message(object data) { Log((LogLevel)8, data); } internal static void Warning(object data) { Log((LogLevel)4, data); } internal static void Error(object data) { Log((LogLevel)2, data); } internal static void Fatal(object data) { Log((LogLevel)1, data); } } [BepInPlugin("LethalHUD", "LethalHUD", "1.3.9")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugins : BaseUnityPlugin { internal struct ScanNodeTextures { public Sprite Outer; public Sprite Inner; } internal static Dictionary<Enums.ScanLines, Texture2D> ScanlineTextures = new Dictionary<Enums.ScanLines, Texture2D>(); internal static Dictionary<Enums.ScanNodeShape, ScanNodeTextures> ScanNodeSprites = new Dictionary<Enums.ScanNodeShape, ScanNodeTextures>(); internal static Plugins Instance { get; private set; } internal static Harmony Harmony { get; private set; } internal static ManualLogSource Logger { get; private set; } internal static ConfigFile Config { get; private set; } internal static ConfigEntries ConfigEntries { get; private set; } public void Awake() { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown if ((Object)(object)Instance == (Object)null) { Instance = this; } Harmony = new Harmony("LethalHUD"); Logger = Logger.CreateLogSource("LethalHUD"); SerializeNetworkVariables(); ConfigFile val = ConfigUtils.CreateLocalConfigFile((BaseUnityPlugin)(object)this, "bootstrap", saveOnInit: true); ConfigEntry<bool> val2 = val.Bind<bool>("Main", "Use Local Config", false, "If enabled, uses a local config file instead of the global config. Requires restart."); Config = (val2.Value ? ConfigUtils.CreateLocalConfigFile((BaseUnityPlugin)(object)this) : ConfigUtils.CreateGlobalConfigFile((BaseUnityPlugin)(object)this)); ConfigEntries = new ConfigEntries(); string directoryName = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location); string text = Path.Combine(directoryName, "incomprehensibleandalsoridiculousoriginalassetbundlenameforlethalhud"); AssetBundle val3 = AssetBundle.LoadFromFile(text); if ((Object)(object)val3 == (Object)null) { Loggers.Error("Failed to load unfathomablyridiculousoriginalassetbundlenameforlethalhud assetbundle."); return; } foreach (Enums.ScanLines value in Enum.GetValues(typeof(Enums.ScanLines))) { string text2 = value.ToString(); Texture2D val4 = val3.LoadAsset<Texture2D>(text2); if ((Object)(object)val4 != (Object)null) { ScanlineTextures[value] = val4; } else { Loggers.Warning("Texture '" + text2 + "' not found in asset bundle."); } } foreach (Enums.ScanNodeShape value2 in Enum.GetValues(typeof(Enums.ScanNodeShape))) { string text3 = $"{value2}_Outer"; string text4 = $"{value2}_Inner"; Sprite val5 = val3.LoadAsset<Sprite>(text3); Sprite val6 = val3.LoadAsset<Sprite>(text4); if ((Object)(object)val5 == (Object)null) { Logger.LogWarning((object)("ScanNode texture '" + text3 + "' not found.")); } if ((Object)(object)val6 == (Object)null) { Logger.LogWarning((object)("ScanNode texture '" + text4 + "' not found.")); } ScanNodeSprites[value2] = new ScanNodeTextures { Outer = val5, Inner = val6 }; } Harmony.PatchAll(); val.Save(); Loggers.Info("Plugin LethalHUD loaded!"); } private static void SerializeNetworkVariables() { NetworkVariableSerializationTypes.InitializeSerializer_UnmanagedByMemcpy<PlayerColorInfo>(); NetworkVariableSerializationTypes.InitializeEqualityChecker_UnmanagedIEquatable<PlayerColorInfo>(); } } public static class MyPluginInfo { public const string PLUGIN_GUID = "LethalHUD"; public const string PLUGIN_NAME = "LethalHUD"; public const string PLUGIN_VERSION = "1.3.9"; } } namespace LethalHUD.Scan { internal static class ScanController { private const float ScanDuration = 1.3f; private static Texture2D _lastRecoloredTexture; private static MeshRenderer _scanRenderer; private static Volume _cachedScanVolume; private static Material _scanMat; private static MeshRenderer ScanRenderer { get { if ((Object)(object)_scanRenderer == (Object)null && (Object)(object)HUDManager.Instance != (Object)null) { Animator scanEffectAnimator = HUDManager.Instance.scanEffectAnimator; if ((Object)(object)scanEffectAnimator != (Object)null) { _scanRenderer = ((Component)scanEffectAnimator).GetComponent<MeshRenderer>(); } } return _scanRenderer; } } private static Volume ScanVolume { get { if ((Object)(object)_cachedScanVolume == (Object)null) { GameObject val = GameObject.Find("Systems/Rendering/ScanSphere/ScanVolume"); if ((Object)(object)val != (Object)null) { _cachedScanVolume = val.GetComponent<Volume>(); } } return _cachedScanVolume; } } private static Vignette ScanVignette { get { if ((Object)(object)ScanVolume == (Object)null) { return null; } if ((Object)(object)ScanVolume.profile == (Object)null) { return null; } return ScanVolume.profile.components?.OfType<Vignette>().FirstOrDefault(); } } internal static Bloom ScanBloom { get { if ((Object)(object)ScanVolume == (Object)null) { return null; } if ((Object)(object)ScanVolume.profile == (Object)null) { return null; } return ScanVolume.profile.components?.OfType<Bloom>().FirstOrDefault(); } } private static float ScanProgress { get { if ((Object)(object)HUDManager.Instance == (Object)null) { return 0f; } return (HUDManager.Instance.playerPingingScan + 1f) / 1.3f; } } private static bool IsInspecting { get { if ((Object)(object)StartOfRound.Instance == (Object)null) { return false; } if ((Object)(object)StartOfRound.Instance.localPlayerController == (Object)null) { return false; } return StartOfRound.Instance.localPlayerController.IsInspectingItem; } } private static Material ScanMaterial { get { if ((Object)(object)_scanMat == (Object)null && (Object)(object)ScanRenderer != (Object)null) { _scanMat = ((Renderer)ScanRenderer).sharedMaterial; } return _scanMat; } } private static void SetScanColorAlpha(float alpha) { //IL_0013: 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_0026: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)ScanMaterial == (Object)null)) { Color color = ScanMaterial.color; color.a = alpha; ScanMaterial.color = color; } } internal static void SetScanColor(Color? overrideColor = null) { //IL_001a: 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) //IL_001f: 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_0059: 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 (!IsInspecting) { Color val = (overrideColor.HasValue ? overrideColor.Value : ConfigHelper.GetScanColor()); if (ModCompats.IsBetterScanVisionPresent) { BetterScanVisionProxy.OverrideNightVisionColor(); } if ((Object)(object)ScanMaterial != (Object)null) { ScanMaterial.color = val; } Vignette scanVignette = ScanVignette; if ((Object)(object)scanVignette != (Object)null) { ((VolumeParameter<Color>)(object)scanVignette.color).Override(val); UpdateVignetteIntensity(); } Bloom scanBloom = ScanBloom; if ((Object)(object)scanBloom != (Object)null) { ((VolumeParameter<Color>)(object)scanBloom.tint).Override(val); UpdateScanTexture(); } } } internal static void UpdateScanAlpha() { if (!((Object)(object)HUDManager.Instance == (Object)null) && !((Object)(object)ScanRenderer == (Object)null) && !IsInspecting) { float value = Plugins.ConfigEntries.Alpha.Value; float num = value; if (Plugins.ConfigEntries.FadeOut.Value && HUDManager.Instance.playerPingingScan > -1f) { num *= ScanProgress; } SetScanColorAlpha(num); } } internal static void UpdateVignetteIntensity() { if (!IsInspecting) { Vignette scanVignette = ScanVignette; if ((Object)(object)scanVignette != (Object)null) { ((VolumeParameter<float>)(object)scanVignette.intensity).Override(Plugins.ConfigEntries.VignetteIntensity.Value); } } } internal static void UpdateScanTexture() { //IL_003e: Unknown result type (might be due to invalid IL or missing references) Bloom scanBloom = ScanBloom; if ((Object)(object)scanBloom == (Object)null || IsInspecting) { return; } Enums.DirtIntensityHandlerByScanLine(); Texture2D selectedTexture = GetSelectedTexture(); if (!((Object)(object)selectedTexture == (Object)null)) { if (Plugins.ConfigEntries.RecolorScanLines.Value) { RecolorAndApplyTexture(ConfigHelper.GetScanColor(), selectedTexture); } else { ((VolumeParameter<Texture>)(object)scanBloom.dirtTexture).Override((Texture)(object)selectedTexture); } } } private static void RecolorAndApplyTexture(Color color, Texture2D baseTex) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Expected O, but got Unknown //IL_0022: Unknown result type (might be due to invalid IL or missing references) Texture2D texture = new Texture2D(((Texture)baseTex).width, ((Texture)baseTex).height, (TextureFormat)4, true); texture.SetPixels(baseTex.GetPixels()); HUDUtils.RecolorTexture(ref texture, color); texture.Apply(true, false); if ((Object)(object)_lastRecoloredTexture != (Object)null) { Object.Destroy((Object)(object)_lastRecoloredTexture); } _lastRecoloredTexture = texture; Bloom scanBloom = ScanBloom; if ((Object)(object)scanBloom != (Object)null) { ((VolumeParameter<Texture>)(object)scanBloom.dirtTexture).Override((Texture)(object)_lastRecoloredTexture); } } private static Texture2D GetSelectedTexture() { Enums.ScanLines value = Plugins.ConfigEntries.SelectedScanlineMode.Value; if (Plugins.ScanlineTextures.TryGetValue(value, out var value2) && (Object)(object)value2 != (Object)null) { return value2; } Loggers.Warning($"Scanline texture '{value}' missing. Falling back to Default."); if (value != 0 && Plugins.ScanlineTextures.TryGetValue(Enums.ScanLines.Default, out var value3) && (Object)(object)value3 != (Object)null) { return value3; } Loggers.Error("No scanline textures could be applied."); return null; } } internal static class ScanNodeController { internal static float lifetime = Plugins.ConfigEntries.ScanNodeLifetime.Value; internal static float fadeDuration = Plugins.ConfigEntries.ScanNodeFadeDuration.Value; private static readonly Dictionary<ScanNodeProperties, float> _nodeAppearTimes = new Dictionary<ScanNodeProperties, float>(); private static readonly AnimationCurve _fadeCurve = AnimationCurve.EaseInOut(0f, 1f, 1f, 0f); internal static void UpdateTimers(RectTransform[] scanElements, Dictionary<RectTransform, ScanNodeProperties> scanNodes) { foreach (RectTransform val in scanElements) { if ((Object)(object)val == (Object)null) { continue; } if (!scanNodes.TryGetValue(val, out var value) || (Object)(object)value == (Object)null) { CleanInvalidNodes(); continue; } if (!_nodeAppearTimes.ContainsKey(value)) { _nodeAppearTimes[value] = Time.time; } float num = Time.time - _nodeAppearTimes[value]; if (num >= lifetime + fadeDuration) { RemoveNode(val, value, scanNodes); continue; } float alpha = ((num > lifetime) ? _fadeCurve.Evaluate((num - lifetime) / fadeDuration) : 1f); CanvasGroup component = ((Component)val).GetComponent<CanvasGroup>(); component.alpha = alpha; } } internal static void UpdateGoodItemScanNodes() { if (!ModCompats.IsGoodItemScanPresent || GoodItemScan.scanner == null) { return; } Scanner scanner = GoodItemScan.scanner; List<ScanNodeProperties> list = scanner._scanNodes.Keys.ToList(); foreach (ScanNodeProperties item in list) { if (!GoodItemScanProxy.TryGetRectTransform(item, out var rectTransform) || (Object)(object)rectTransform == (Object)null) { _nodeAppearTimes.Remove(item); continue; } if (!((Component)rectTransform).gameObject.activeInHierarchy) { _nodeAppearTimes.Remove(item); continue; } if (!_nodeAppearTimes.ContainsKey(item)) { _nodeAppearTimes[item] = Time.time; } float num = Time.time - _nodeAppearTimes[item]; float num2 = ((num > lifetime) ? _fadeCurve.Evaluate((num - lifetime) / fadeDuration) : 1f); CanvasGroup component = ((Component)rectTransform).GetComponent<CanvasGroup>(); if ((Object)(object)component != (Object)null) { component.alpha = num2; } ((Component)rectTransform).gameObject.SetActive(num2 > 0f); } } internal static void ResetGoodItemScanNodes() { if (!ModCompats.IsGoodItemScanPresent || GoodItemScan.scanner == null) { return; } Scanner scanner = GoodItemScan.scanner; if (scanner == null || scanner._scannedNodes == null) { return; } foreach (KeyValuePair<ScanNodeProperties, int> scanNode in scanner._scanNodes) { if (GoodItemScanProxy.TryGetRectTransform(scanNode.Key, out var rectTransform) && !((Object)(object)rectTransform == (Object)null)) { _nodeAppearTimes[scanNode.Key] = Time.time; ((Component)rectTransform).gameObject.SetActive(true); CanvasGroup component = ((Component)rectTransform).GetComponent<CanvasGroup>(); if ((Object)(object)component != (Object)null) { component.alpha = 1f; } } } } private static void RemoveNode(RectTransform element, ScanNodeProperties node, Dictionary<RectTransform, ScanNodeProperties> scanNodes) { ((Component)element).gameObject.SetActive(false); scanNodes.Remove(element); _nodeAppearTimes.Remove(node); } private static void CleanInvalidNodes() { List<ScanNodeProperties> list = new List<ScanNodeProperties>(); foreach (KeyValuePair<ScanNodeProperties, float> nodeAppearTime in _nodeAppearTimes) { if ((Object)(object)nodeAppearTime.Key == (Object)null) { list.Add(nodeAppearTime.Key); } } foreach (ScanNodeProperties item in list) { _nodeAppearTimes.Remove(item); } } } internal static class ScanNodeTextureManager { private static readonly Dictionary<GameObject, Color> _nodeColors = new Dictionary<GameObject, Color>(); internal static void Tick() { //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Expected O, but got Unknown GameObject val = GameObject.Find("UI/Canvas/ObjectScanner"); if ((Object)(object)val == (Object)null) { return; } Enums.ScanNodeShape value = Plugins.ConfigEntries.ScanNodeShapeChoice.Value; if (!Plugins.ScanNodeSprites.TryGetValue(value, out var value2)) { return; } Sprite inner = value2.Inner; Sprite outer = value2.Outer; foreach (Transform item in val.transform) { Transform val2 = item; if (((Object)val2).name.StartsWith("ScanObject")) { ApplySpritesToScanObject(((Component)val2).gameObject, inner, outer); } } } private static void ApplySpritesToScanObject(GameObject scanObject, Sprite innerSprite, Sprite outerSprite) { //IL_007d: 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_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)scanObject == (Object)null || !scanObject.activeInHierarchy) { return; } Transform obj = scanObject.transform.Find("Circle/Inner"); Image val = ((obj != null) ? ((Component)obj).GetComponent<Image>() : null); Transform obj2 = scanObject.transform.Find("Circle/Outer"); Image val2 = ((obj2 != null) ? ((Component)obj2).GetComponent<Image>() : null); if (!((Object)(object)val == (Object)null) && !((Object)(object)val2 == (Object)null)) { if (!_nodeColors.ContainsKey(((Component)val).gameObject)) { _nodeColors[((Component)val).gameObject] = ((Graphic)val).color; } if (!_nodeColors.ContainsKey(((Component)val2).gameObject)) { _nodeColors[((Component)val2).gameObject] = ((Graphic)val2).color; } val.sprite = innerSprite; val2.sprite = outerSprite; ((Graphic)val).color = _nodeColors[((Component)val).gameObject]; ((Graphic)val2).color = _nodeColors[((Component)val2).gameObject]; } } internal static void ForceRefresh() { Tick(); } internal static void ClearDestroyedObjects() { List<GameObject> list = new List<GameObject>(); foreach (KeyValuePair<GameObject, Color> nodeColor in _nodeColors) { if ((Object)(object)nodeColor.Key == (Object)null) { list.Add(nodeColor.Key); } } foreach (GameObject item in list) { _nodeColors.Remove(item); } } } } namespace LethalHUD.Patches { [HarmonyPatch(typeof(GameNetworkManager))] internal static class GameNetworkManagerPatch { [HarmonyPrefix] [HarmonyPatch("NoPunctuation")] private static bool NoPunctuation_Prefix(string input, ref string __result) { if (string.IsNullOrEmpty(input)) { __result = "Nameless"; } else { __result = ChatController.NoPunctuation(input); } return false; } } [HarmonyPatch(typeof(HUDManager))] internal static class HUDManagerPatch { [CompilerGenerated] private sealed class <ScanTextureRoutine>d__20 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <ScanTextureRoutine>d__20(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown int num = <>1__state; if (num != 0) { if (num != 1) { return false; } <>1__state = -1; } else { <>1__state = -1; } ScanNodeTextureManager.Tick(); ScanNodeTextureManager.ClearDestroyedObjects(); <>2__current = (object)new WaitForSeconds(1f); <>1__state = 1; return true; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <ToggleScanRoutine>d__23 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public HUDManager __instance; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <ToggleScanRoutine>d__23(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { int num = <>1__state; if (num != 0) { if (num != 1) { return false; } <>1__state = -1; } else { <>1__state = -1; } TryPerformScan(__instance); <>2__current = null; <>1__state = 1; return true; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private static InputAction _pingScanAction; private static CallbackContext _pingScan; private static bool _isScanToggled; private static Coroutine _toggleCoroutine; private static int lastSlotCount; [HarmonyPrefix] [HarmonyPatch("PingScan_performed")] private static void OnScanTriggered(ref CallbackContext context) { //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) _pingScan = context; if (ModCompats.IsGoodItemScanPresent) { ScanNodeController.ResetGoodItemScanNodes(); } } [HarmonyPrefix] [HarmonyPatch("UseSignalTranslatorClientRpc")] private static void OnHUDManagerUseSignalTranslatorClientRpc(ref string signalMessage) { SignalTranslatorController.SetSignalText(signalMessage); } [HarmonyPrefix] [HarmonyPatch("DisableAllScanElements")] private static void OnHUDManagerDisabledAllScanElements() { if (ModCompats.IsGoodItemScanPresent) { ScanNodeController.ResetGoodItemScanNodes(); } } [HarmonyPrefix] [HarmonyPatch("SetClockVisible")] private static void OnHUDManagerSetClockVisible(ref bool visible) { ClockController.UpdateClockVisibility(ref visible); ClockController.ApplyClockAlpha(); } [HarmonyPostfix] [HarmonyPatch("Start")] private static void OnHUDManagerStart(HUDManager __instance) { _pingScanAction = IngamePlayerSettings.Instance.playerInput.actions.FindAction("PingScan", false); ScanController.SetScanColor(); ScanController.UpdateScanTexture(); PlayerHPDisplay.Init(); ScrapValueDisplay.Init(); ClockController.ApplyClockAppearance(); PlanetInfoDisplay.ApplyColors(); SpectatorHUDController.ApplyColors(); if (ModCompats.IsBetterScanVisionPresent) { BetterScanVisionProxy.OverrideNightVisionColor(); } ((MonoBehaviour)__instance).StartCoroutine(ScanTextureRoutine()); } [HarmonyPostfix] [HarmonyPatch("OnEnable")] private static void OnHUDManagerEnable(HUDManager __instance) { if ((Object)(object)((Component)__instance).gameObject.GetComponent<LethalHUDMono>() == (Object)null) { ((Component)__instance).gameObject.AddComponent<LethalHUDMono>(); } if ((Object)(object)((Component)__instance).gameObject.GetComponent<StatsDisplay>() == (Object)null) { ((Component)__instance).gameObject.AddComponent<StatsDisplay>(); } ChatController.ColorChatInputField(HUDManager.Instance.chatTextField, Time.time * 0.25f); } [HarmonyPrefix] [HarmonyPatch(typeof(HUDManager), "DisplaySignalTranslatorMessage")] private static bool OnHUDManagerDisplaySignalTranslatorMessage(string signalMessage, int seed, SignalTranslator signalTranslator, ref IEnumerator __result) { if ((Object)(object)signalTranslator != (Object)null && !string.IsNullOrEmpty(signalMessage)) { __result = SignalTranslatorController.DisplaySignalTranslatorMessage(signalMessage, seed, signalTranslator); return false; } return true; } [HarmonyPostfix] [HarmonyPatch("DisplayNewScrapFound")] private static void OnHUDManagerDisplayNewScrapFound() { InventoryFrames.SetSlotColors(); } [HarmonyPostfix] [HarmonyPatch("SetClock")] private static void OnHUDManagerSetClock(HUDManager __instance, float timeNormalized, float numberOfHours) { ClockController.TryOverrideClock(__instance, timeNormalized, numberOfHours); } [HarmonyPostfix] [HarmonyPatch("Update")] private static void OnHUDManagerUpdate(HUDManager __instance) { //IL_004e: Unknown result type (might be due to invalid IL or missing references) ScanController.UpdateScanAlpha(); PlayerHPDisplay.UpdateNumber(); WeightController.UpdateWeightDisplay(); switch (Plugins.ConfigEntries.ScanModeType.Value) { case Enums.ScanMode.Default: StopToggleScan(__instance); break; case Enums.ScanMode.Hold: StopToggleScan(__instance); if (_pingScanAction.IsPressed()) { __instance.PingScan_performed(_pingScan); } break; case Enums.ScanMode.Toggle: if (_pingScanAction.WasPressedThisFrame()) { if (_isScanToggled) { StopToggleScan(__instance); } else { StartToggleScan(__instance); } } break; } int num = __instance.itemSlotIconFrames.Length; if (num != lastSlotCount) { ScrapValueDisplay.RefreshSlots(); lastSlotCount = num; } } [HarmonyPostfix] [HarmonyPatch("UpdateScanNodes")] private static void OnHUDManagerUpdateScanNodes(HUDManager __instance) { if (Plugins.ConfigEntries.ScanNodeFade.Value) { ScanNodeController.UpdateTimers(__instance.scanElements, __instance.scanNodes); } } [HarmonyPostfix] [HarmonyPatch("AddChatMessage")] private static void OnHUDManagerAddChatMessage(HUDManager __instance, string chatMessage, string nameOfUserWhoTyped, int playerWhoSent) { if (string.IsNullOrEmpty(chatMessage)) { return; } int num = __instance.ChatMessageHistory.Count - 1; if (num >= 0) { string text = __instance.ChatMessageHistory[num]; Match match = Regex.Match(chatMessage, "^(<[^>]+>)+"); string text2 = ""; string message = chatMessage; if (match.Success) { text2 = match.Value; int length = match.Length; message = chatMessage.Substring(length, chatMessage.Length - length); } string text3 = ((chatMessage.Contains("<color=") || chatMessage.Contains("<gradient=")) ? chatMessage : (text2 + ChatController.GetColoredChatMessage(message))); string value; if (!string.IsNullOrEmpty(nameOfUserWhoTyped)) { string coloredPlayerName = ChatController.GetColoredPlayerName(nameOfUserWhoTyped, playerWhoSent); value = coloredPlayerName + ": " + text3; } else { value = text3; } __instance.ChatMessageHistory[num] = value; StringBuilder stringBuilder = new StringBuilder(); for (int i = 0; i < __instance.ChatMessageHistory.Count; i++) { stringBuilder.Append('\n'); stringBuilder.Append(__instance.ChatMessageHistory[i]); } ((TMP_Text)__instance.chatText).text = stringBuilder.ToString(); __instance.PingHUDElement(__instance.Chat, Plugins.ConfigEntries.ChatFadeDelayTime.Value, 1f, 0f); } } [HarmonyPostfix] [HarmonyPatch("OpenMenu_performed")] private static void OnHUDManagerOpenMenu_performed(HUDManager __instance) { __instance.PingHUDElement(__instance.Chat, Plugins.ConfigEntries.ChatFadeDelayTime.Value, 1f, 0f); } [HarmonyPostfix] [HarmonyPatch("ChangeControlTipMultiple")] private static void AfterChangeControlTipMultiple() { ControlTipController.ApplyColor(); } [HarmonyPostfix] [HarmonyPatch("ClearControlTips")] private static void AfterClearControlTips() { ControlTipController.ApplyColor(); } [IteratorStateMachine(typeof(<ScanTextureRoutine>d__20))] private static IEnumerator ScanTextureRoutine() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <ScanTextureRoutine>d__20(0); } private static void StartToggleScan(HUDManager __instance) { if (_toggleCoroutine == null) { _isScanToggled = true; _toggleCoroutine = ((MonoBehaviour)__instance).StartCoroutine(ToggleScanRoutine(__instance)); } } private static void StopToggleScan(HUDManager __instance) { if (_toggleCoroutine != null) { ((MonoBehaviour)__instance).StopCoroutine(_toggleCoroutine); _toggleCoroutine = null; _isScanToggled = false; } } [IteratorStateMachine(typeof(<ToggleScanRoutine>d__23))] private static IEnumerator ToggleScanRoutine(HUDManager __instance) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <ToggleScanRoutine>d__23(0) { __instance = __instance }; } private static void TryPerformScan(HUDManager __instance) { //IL_004d: Unknown result type (might be due to invalid IL or missing references) PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController; if (!((Object)(object)localPlayerController == (Object)null)) { float playerPingingScan = __instance.playerPingingScan; if (playerPingingScan <= -1f && __instance.CanPlayerScan()) { __instance.playerPingingScan = 0.3f; ((Component)__instance.scanEffectAnimator).transform.position = ((Component)localPlayerController.gameplayCamera).transform.position; __instance.scanEffectAnimator.SetTrigger("scan"); __instance.PingHUDElement(__instance.Compass, 1f, 0.8f, 0.12f); __instance.UIAudio.PlayOneShot(__instance.scanSFX); } } } } [HarmonyPatch(typeof(PlayerControllerB))] internal static class PlayerControllerBPatch { [HarmonyPrefix] [HarmonyPatch("Awake")] private static void OnPlayerControllerBAwake(PlayerControllerB __instance) { PlayerColorNetworker playerColorNetworker = default(PlayerColorNetworker); if (!((Component)__instance).TryGetComponent<PlayerColorNetworker>(ref playerColorNetworker)) { ((Component)__instance).gameObject.AddComponent<PlayerColorNetworker>(); } PlayerBillboardGradient playerBillboardGradient = default(PlayerBillboardGradient); if (!((Component)__instance).TryGetComponent<PlayerBillboardGradient>(ref playerBillboardGradient)) { ((Component)__instance).gameObject.AddComponent<PlayerBillboardGradient>(); } } [HarmonyPrefix] [HarmonyPatch("BeginGrabObject")] private static void OnPlayerControllerBBeginGrabObject() { InventoryFrames.HandsFull(); } [HarmonyPrefix] [HarmonyPatch("NoPunctuation")] private static bool OnPlayerControllerBNoPunctuation(string input, ref string __result) { if (string.IsNullOrEmpty(input)) { __result = "Nameless"; } else { __result = ChatController.NoPunctuation(input); } return false; } [HarmonyPostfix] [HarmonyPatch("SwitchToItemSlot")] private static void OnPlayerControllerBSwitchToItemSlot(PlayerControllerB __instance, int slot) { if ((Object)(object)__instance != (Object)(object)GameNetworkManager.Instance.localPlayerController) { return; } if (!Plugins.ConfigEntries.ShowItemValue.Value && ScrapValueDisplay.slotTexts != null) { ScrapValueDisplay.Hide(slot); } if (ScrapValueDisplay.slotTexts != null && slot >= 0 && slot < ScrapValueDisplay.slotTexts.Length) { if ((Object)(object)__instance.ItemSlots[slot] != (Object)null) { int scrapValue = __instance.ItemSlots[slot].scrapValue; ScrapValueDisplay.UpdateSlot(slot, scrapValue); } else { ScrapValueDisplay.UpdateSlot(slot, 0); } if (__instance.twoHanded) { HUDManager.Instance.PingHUDElement(HUDManager.Instance.Inventory, Plugins.ConfigEntries.SlotFadeDelayTime.Value / 2f, Math.Clamp(Plugins.ConfigEntries.SlotFade.Value + 0.25f, 0f, 1f), Plugins.ConfigEntries.SlotFade.Value); } else { HUDManager.Instance.PingHUDElement(HUDManager.Instance.Inventory, Plugins.ConfigEntries.SlotFadeDelayTime.Value, 1f, Plugins.ConfigEntries.SlotFade.Value); } } } [HarmonyPostfix] [HarmonyPatch("DespawnHeldObject")] private static void OnPlayerControllerBDespawnHeldObject(PlayerControllerB __instance) { ScrapValueDisplay.UpdateSlot(__instance.currentItemSlot, 0); } [HarmonyPostfix] [HarmonyPatch("DiscardHeldObject")] private static void OnPlayerControllerBDiscardHeldObject(PlayerControllerB __instance) { ScrapValueDisplay.UpdateSlot(__instance.currentItemSlot, 0); } [HarmonyPostfix] [HarmonyPatch("DestroyItemInSlot")] private static void OnPlayerControllerBDestroyItemInSlot(PlayerControllerB __instance) { ScrapValueDisplay.UpdateSlot(__instance.currentItemSlot, 0); } [HarmonyPostfix] [HarmonyPatch("DropAllHeldItems")] private static void OnPlayerControllerBDiscardAllHelditems(PlayerControllerB __instance) { ScrapValueDisplay.UpdateSlot(__instance.currentItemSlot, 0); } [HarmonyPostfix] [HarmonyPatch("DamagePlayer")] private static void OnPlayerControllerBDamagePlayer(PlayerControllerB __instance) { PlayerHPDisplay.ShakeOnHit(__instance); } [HarmonyPostfix] [HarmonyPatch("SpawnPlayerAnimation")] private static void OnPlayerControllerBSpawnPlayerAnimation() { ScrapValueDisplay.ClearItemSlots(); } [HarmonyPostfix] [HarmonyPatch("LateUpdate")] private static void OnPlayerLateUpdate(PlayerControllerB __instance) { if (__instance.isTypingChat) { ChatController.PlayerTypingIndicator(); } SprintMeterController.UpdateSprintMeterColor(); } } [HarmonyPatch(typeof(Terminal))] internal static class TerminalPatch { [HarmonyPostfix] [HarmonyPatch("BeginUsingTerminal")] private static void OnTerminalBeginUsingTerminal() { HUDManager.Instance.PingHUDElement(HUDManager.Instance.Inventory, Plugins.ConfigEntries.TerminalFadeDelaysTime.Value, Plugins.ConfigEntries.SlotFade.Value, 0f); HUDManager.Instance.PingHUDElement(HUDManager.Instance.Chat, Plugins.ConfigEntries.TerminalFadeDelaysTime.Value, 0.13f, 0.01f); HUDManager.Instance.PingHUDElement(HUDManager.Instance.Compass, Plugins.ConfigEntries.TerminalFadeDelaysTime.Value, 0.8f, 0.01f); } [HarmonyPostfix] [HarmonyPatch("QuitTerminal")] private static void OnTerminalQuitTerminal() { HUDManager.Instance.PingHUDElement(HUDManager.Instance.Inventory, Plugins.ConfigEntries.TerminalFadeDelaysTime.Value, 0.13f, Plugins.ConfigEntries.SlotFade.Value); HUDManager.Instance.PingHUDElement(HUDManager.Instance.Chat, Plugins.ConfigEntries.TerminalFadeDelaysTime.Value, 0.13f, 0f); HUDManager.Instance.PingHUDElement(HUDManager.Instance.Compass, Plugins.ConfigEntries.TerminalFadeDelaysTime.Value, 0.8f, 0.12f); } } [HarmonyPatch(typeof(TimeOfDay))] internal static class TimeOfDayPatch { [HarmonyPostfix] [HarmonyPatch("MoveTimeOfDay")] private static void OnTimeOfDayMoveTimeOfDay() { ClockController.ApplyRealtimeClock(); } } } namespace LethalHUD.Misc { internal static class ControlTipController { private static readonly Color DefaultColorA = Color.white; private static readonly Color DefaultColorB = Color.white; private static TMP_Text[] _lastTips; private static string[] _lastTipTexts; private static string _lastHexA; private static string _lastHexB; private static Enums.MTColorMode _lastMode; internal static void ApplyColor() { //IL_0076: 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_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) HUDManager instance = HUDManager.Instance; if (instance?.controlTipLines == null || instance.controlTipLines.Length == 0 || (instance.controlTipLines == _lastTips && !HasConfigChanged() && !HasTextChanged(instance))) { return; } string value = Plugins.ConfigEntries.MTColorGradientA.Value; string value2 = Plugins.ConfigEntries.MTColorGradientB.Value; switch (Plugins.ConfigEntries.MTColorSelection.Value) { case Enums.MTColorMode.Solid: ApplySingleColor(instance, value, DefaultColorA); break; case Enums.MTColorMode.Gradient: if (HUDUtils.HasCustomGradient(value, value2)) { ApplyGradient(instance, value, value2, DefaultColorA, DefaultColorB); } else { ApplySingleColor(instance, value, DefaultColorA); } break; } CacheState(instance); } private static bool HasConfigChanged() { Enums.MTColorMode value = Plugins.ConfigEntries.MTColorSelection.Value; string value2 = Plugins.ConfigEntries.MTColorGradientA.Value; string value3 = Plugins.ConfigEntries.MTColorGradientB.Value; if (value == _lastMode && !(value2 != _lastHexA)) { return value3 != _lastHexB; } return true; } private static bool HasTextChanged(HUDManager hud) { if (_lastTipTexts == null || _lastTipTexts.Length != hud.controlTipLines.Length) { return true; } for (int i = 0; i < hud.controlTipLines.Length; i++) { TextMeshProUGUI val = hud.controlTipLines[i]; if (!((Object)(object)val == (Object)null)) { string text = ((TMP_Text)val).text; if (_lastTipTexts[i] != text) { return true; } } } return false; } private static void CacheState(HUDManager hud) { TMP_Text[] controlTipLines = (TMP_Text[])(object)hud.controlTipLines; _lastTips = controlTipLines; _lastMode = Plugins.ConfigEntries.MTColorSelection.Value; _lastHexA = Plugins.ConfigEntries.MTColorGradientA.Value; _lastHexB = Plugins.ConfigEntries.MTColorGradientB.Value; _lastTipTexts = new string[hud.controlTipLines.Length]; for (int i = 0; i < hud.controlTipLines.Length; i++) { string[] lastTipTexts = _lastTipTexts; int num = i; TextMeshProUGUI obj = hud.controlTipLines[i]; lastTipTexts[num] = ((obj != null) ? ((TMP_Text)obj).text : null); } } private static void ApplySingleColor(HUDManager hud, string hex, Color fallback) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) Color color = HUDUtils.ParseHexColor(hex, fallback); TextMeshProUGUI[] controlTipLines = hud.controlTipLines; foreach (TextMeshProUGUI val in controlTipLines) { if ((Object)(object)val != (Object)null) { ((Graphic)val).color = color; } } } private static void ApplyGradient(HUDManager hud, string hexA, string hexB, Color fallbackA, Color fallbackB) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: 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) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: 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_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00de: 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_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: 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_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0105: 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_010c: Unknown result type (might be due to invalid IL or missing references) Color val = HUDUtils.ParseHexColor(hexA, fallbackA); Color val2 = HUDUtils.ParseHexColor(hexB, fallbackB); TextMeshProUGUI[] controlTipLines = hud.controlTipLines; foreach (TextMeshProUGUI val3 in controlTipLines) { if ((Object)(object)val3 == (Object)null) { continue; } ((TMP_Text)val3).ForceMeshUpdate(false, false); TMP_TextInfo textInfo = ((TMP_Text)val3).textInfo; int characterCount = textInfo.characterCount; if (characterCount == 0) { continue; } for (int j = 0; j < characterCount; j++) { TMP_CharacterInfo val4 = textInfo.characterInfo[j]; if (val4.isVisible) { float num = ((characterCount > 1) ? ((float)j / (float)(characterCount - 1)) : 0f); Color val5 = Color.Lerp(val, val2, num); int vertexIndex = val4.vertexIndex; TMP_MeshInfo val6 = textInfo.meshInfo[val4.materialReferenceIndex]; val6.colors32[vertexIndex] = Color32.op_Implicit(val5); val6.colors32[vertexIndex + 1] = Color32.op_Implicit(val5); val6.colors32[vertexIndex + 2] = Color32.op_Implicit(val5); val6.colors32[vertexIndex + 3] = Color32.op_Implicit(val5); } } for (int k = 0; k < ((TMP_Text)val3).textInfo.meshInfo.Length; k++) { ((TMP_Text)val3).textInfo.meshInfo[k].mesh.colors32 = ((TMP_Text)val3).textInfo.meshInfo[k].colors32; ((TMP_Text)val3).UpdateGeometry(((TMP_Text)val3).textInfo.meshInfo[k].mesh, k); } } } } [DisallowMultipleComponent] internal class PlayerBillboardGradient : MonoBehaviour { private PlayerControllerB _player; private TextMeshProUGUI _text; private CanvasGroup _canvasAlpha; private PlayerColorNetworker _networker; [Header("Performance Options")] public float maxUpdateDistance = 30f; public float updateInterval = 0.033f; private float _timeSinceLastUpdate; private PlayerColorInfo _currentColors; private bool _hasColors; private void Awake() { _player = ((Component)this).GetComponent<PlayerControllerB>(); if (!((Object)(object)_player == (Object)null)) { _text = _player.usernameBillboardText; _canvasAlpha = _player.usernameAlpha; _networker = ((Component)_player).GetComponent<PlayerColorNetworker>(); if ((Object)(object)_text != (Object)null) { ((TMP_Text)_text).enableVertexGradient = true; } } } private void Start() { //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_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 (!((Object)(object)_networker == (Object)null)) { _currentColors = _networker._syncedPlayerColors.Value; _hasColors = true; NetworkVariable<PlayerColorInfo> syncedPlayerColors = _networker._syncedPlayerColors; syncedPlayerColors.OnValueChanged = (OnValueChangedDelegate<PlayerColorInfo>)(object)Delegate.Combine((Delegate?)(object)syncedPlayerColors.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate<PlayerColorInfo>(OnPlayerColorsChanged)); HUDUtils.ApplyVertexGradient(_text, Color32.op_Implicit(_currentColors.colorA), Color32.op_Implicit(_currentColors.colorB), Time.time); } } private void OnPlayerColorsChanged(PlayerColorInfo previous, PlayerColorInfo current) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0020: 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) _currentColors = current; _hasColors = true; HUDUtils.ApplyVertexGradient(_text, Color32.op_Implicit(current.colorA), Color32.op_Implicit(current.colorB), Time.time); } private void LateUpdate() { //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_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_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_018f: 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_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_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) if (!ChatController.ColoringEnabled) { ResetBillboardToDefault(); return; } if (!((TMP_Text)_text).enableVertexGradient) { ((TMP_Text)_text).enableVertexGradient = true; } if (!_hasColors || (Object)(object)_player == (Object)null || (Object)(object)_text == (Object)null || (Object)(object)_canvasAlpha == (Object)null || !((Component)_player.usernameCanvas).gameObject.activeSelf || _canvasAlpha.alpha < 0.95f || (Object)(object)GameNetworkManager.Instance?.localPlayerController == (Object)null) { return; } Vector3 val = ((Component)_player).transform.position - ((Component)GameNetworkManager.Instance.localPlayerController).transform.position; float sqrMagnitude = ((Vector3)(ref val)).sqrMagnitude; if (sqrMagnitude > maxUpdateDistance * maxUpdateDistance) { return; } _timeSinceLastUpdate += Time.deltaTime; if (!(_timeSinceLastUpdate < updateInterval)) { _timeSinceLastUpdate = 0f; _currentColors = _networker._syncedPlayerColors.Value; if (Plugins.ConfigEntries.BillboardMode.Value == Enums.BillboardGradientMode.Animated) { HUDUtils.ApplyVertexGradient(_text, Color32.op_Implicit(_currentColors.colorA), Color32.op_Implicit(_currentColors.colorB), Time.time / 2f); } else { HUDUtils.ApplyStaticVertexGradient(_text, Color32.op_Implicit(_currentColors.colorA), Color32.op_Implicit(_currentColors.colorB)); } } } private void ResetBillboardToDefault() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)_text == (Object)null)) { ((TMP_Text)_text).enableVertexGradient = false; ((Graphic)_text).color = Color.white; } } } internal static class SpectatorHUDController { internal static void ApplyColors() { HUDManager instance = HUDManager.Instance; if (!((Object)(object)instance == (Object)null)) { ConfigEntries configEntries = Plugins.ConfigEntries; ApplyColorPreserveAlpha(instance.spectatorTipText, configEntries.SpectatorTipColor.Value); ApplyColorPreserveAlpha(instance.spectatingPlayerText, configEntries.SpectatingPlayerColor.Value); ApplyColorPreserveAlpha(instance.holdButtonToEndGameEarlyText, configEntries.HoldEndGameColor.Value); ApplyColorPreserveAlpha(instance.holdButtonToEndGameEarlyVotesText, configEntries.HoldEndGameVotesColor.Value); } } private static void ApplyColorPreserveAlpha(TextMeshProUGUI text, string hexColor) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0012: 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_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)text == (Object)null)) { Color color = ((Graphic)text).color; Color color2 = HUDUtils.ParseHexColor(hexColor, color); color2.a = color.a; ((Graphic)text).color = color2; } } } public class StatsDisplay : NetworkBehaviour { private float _deltaTime; private ulong _currentPing; private float _pingTimer; private TextMeshProUGUI _statsText; private UnityTransport _transport; private string _lastText = ""; private Enums.MTColorMode _lastMode; private string _lastHexA = ""; private string _lastHexB = ""; private bool _lastSplit; private string _lastSeparateHex = ""; private void Start() { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown //IL_00b6: 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) //IL_0128: 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_0167: Unknown result type (might be due to invalid IL or missing references) ref UnityTransport transport = ref _transport; NetworkTransport networkTransport = NetworkManager.Singleton.NetworkConfig.NetworkTransport; transport = (UnityTransport)(object)((networkTransport is UnityTransport) ? networkTransport : null); GameObject val = new GameObject("StatsDisplay"); GameObject val2 = GameObject.Find("Systems/UI/Canvas/IngamePlayerHUD/"); val.transform.SetParent(val2.transform, false); _statsText = val.AddComponent<TextMeshProUGUI>(); ((TMP_Text)_statsText).font = ((TMP_Text)HUDManager.Instance.chatText).font; ((TMP_Text)_statsText).fontSize = 12f; ((TMP_Text)_statsText).richText = true; ((TMP_Text)_statsText).alignment = (TextAlignmentOptions)257; Material val3 = Object.Instantiate<Material>(((TMP_Text)_statsText).fontMaterial); val3.EnableKeyword("UNDERLAY_ON"); val3.SetColor("_UnderlayColor", Color.black); val3.SetFloat("_UnderlayOffsetX", 1.2f); val3.SetFloat("_UnderlayOffsetY", -1.2f); val3.SetFloat("_UnderlaySoftness", 0.35f); ((TMP_Text)_statsText).fontMaterial = val3; RectTransform rectTransform = ((TMP_Text)_statsText).rectTransform; rectTransform.anchorMin = new Vector2(0f, 1f); rectTransform.anchorMax = new Vector2(0f, 1f); rectTransform.pivot = new Vector2(0f, 1f); rectTransform.anchoredPosition = new Vector2(Plugins.ConfigEntries.FPSCounterX.Value, 0f - Plugins.ConfigEntries.FPSCounterY.Value); } private void Update() { _deltaTime += (Time.unscaledDeltaTime - _deltaTime) * 0.1f; HandlePing(); UpdateStatsText(); } private void HandlePing() { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) if (((NetworkBehaviour)this).IsOwner && !((Object)(object)_transport == (Object)null)) { _pingTimer += Time.deltaTime; if (_pingTimer >= 0.5f) { _pingTimer = 0f; RequestPingServerRpc(); } } } private void UpdateStatsText() { //IL_020a: Unknown result type (might be due to invalid IL or missing references) if (!Plugins.ConfigEntries.ShowFPSDisplay.Value && !Plugins.ConfigEntries.ShowPingDisplay.Value && !Plugins.ConfigEntries.ShowSeedDisplay.Value) { ((TMP_Text)_statsText).text = ""; _lastText = ""; return; } List<string> list = new List<string>(); if (Plugins.ConfigEntries.ShowFPSDisplay.Value) { int num = Mathf.RoundToInt(1f / _deltaTime); list.Add($"FPS: {num}"); } if (Plugins.ConfigEntries.ShowPingDisplay.Value) { list.Add($"Ping: {_currentPing} ms"); } if (Plugins.ConfigEntries.ShowSeedDisplay.Value && (Object)(object)StartOfRound.Instance != (Object)null && !StartOfRound.Instance.inShipPhase) { list.Add($"Seed: {StartOfRound.Instance.randomMapSeed}"); } string separator = ((Plugins.ConfigEntries.MiscLayoutEnum.Value == Enums.FPSPingLayout.Vertical) ? "\n─────────\n" : " | "); string text = string.Join(separator, list); bool value = Plugins.ConfigEntries.SplitAdditionalMTFromToolTips.Value; string value2 = Plugins.ConfigEntries.SeperateAdditionalMiscToolsColors.Value; if (text != _lastText || Plugins.ConfigEntries.MTColorSelection.Value != _lastMode || Plugins.ConfigEntries.MTColorGradientA.Value != _lastHexA || Plugins.ConfigEntries.MTColorGradientB.Value != _lastHexB || value != _lastSplit || value2 != _lastSeparateHex) { ((TMP_Text)_statsText).text = text; ((TMP_Text)_statsText).alignment = (TextAlignmentOptions)257; ((TMP_Text)_statsText).rectTransform.anchoredPosition = new Vector2(Plugins.ConfigEntries.FPSCounterX.Value, 0f - Plugins.ConfigEntries.FPSCounterY.Value); ((TMP_Text)_statsText).enableWordWrapping = false; ApplyTextColor(_statsText); _lastText = text; _lastMode = Plugins.ConfigEntries.MTColorSelection.Value; _lastHexA = Plugins.ConfigEntries.MTColorGradientA.Value; _lastHexB = Plugins.ConfigEntries.MTColorGradientB.Value; _lastSplit = value; _lastSeparateHex = value2; } } private void ApplyTextColor(TextMeshProUGUI tmp) { //IL_0072: 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_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) bool value = Plugins.ConfigEntries.SplitAdditionalMTFromToolTips.Value; string text = (value ? Plugins.ConfigEntries.SeperateAdditionalMiscToolsColors.Value : Plugins.ConfigEntries.MTColorGradientA.Value); string text2 = (value ? Plugins.ConfigEntries.SeperateAdditionalMiscToolsColors.Value : Plugins.ConfigEntries.MTColorGradientB.Value); switch (Plugins.ConfigEntries.MTColorSelection.Value) { case Enums.MTColorMode.Solid: ((Graphic)tmp).color = HUDUtils.ParseHexColor(text, Color.white); break; case Enums.MTColorMode.Gradient: if (HUDUtils.HasCustomGradient(text, text2) && !value) { ApplyGradient(tmp, text, text2); } else { ((Graphic)tmp).color = HUDUtils.ParseHexColor(text, Color.white); } break; } } private void ApplyGradient(TextMeshProUGUI tmp, string hexA, string hexB) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: 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_0042: 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_0049: Unknown result type (might be due to invalid IL or missing references) //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_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_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0082: 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) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: 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) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //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) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) ((TMP_Text)tmp).ForceMeshUpdate(false, false); TMP_TextInfo textInfo = ((TMP_Text)tmp).textInfo; int characterCount = textInfo.characterCount; if (characterCount == 0) { return; } Color val = HUDUtils.ParseHexColor(hexA, Color.white); Color val2 = HUDUtils.ParseHexColor(hexB, Color.white); for (int i = 0; i < characterCount; i++) { TMP_CharacterInfo val3 = textInfo.characterInfo[i]; if (val3.isVisible) { float num = ((characterCount > 1) ? ((float)i / (float)(characterCount - 1)) : 0f); Color val4 = Color.Lerp(val, val2, num); TMP_MeshInfo val5 = textInfo.meshInfo[val3.materialReferenceIndex]; int vertexIndex = val3.vertexIndex; val5.colors32[vertexIndex] = Color32.op_Implicit(val4); val5.colors32[vertexIndex + 1] = Color32.op_Implicit(val4); val5.colors32[vertexIndex + 2] = Color32.op_Implicit(val4); val5.colors32[vertexIndex + 3] = Color32.op_Implicit(val4); } } for (int j = 0; j < ((TMP_Text)tmp).textInfo.meshInfo.Length; j++) { ((TMP_Text)tmp).textInfo.meshInfo[j].mesh.colors32 = ((TMP_Text)tmp).textInfo.meshInfo[j].colors32; ((TMP_Text)tmp).UpdateGeometry(((TMP_Text)tmp).textInfo.meshInfo[j].mesh, j); } } [ServerRpc(RequireOwnership = false)] private void RequestPingServerRpc(ServerRpcParams rpcParams = default(ServerRpcParams)) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Invalid comparison between Unknown and I4 //IL_005f: 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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: 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) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(1694769970u, rpcParams, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val, 1694769970u, rpcParams, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; if (!((Object)(object)_transport == (Object)null)) { ulong senderClientId = rpcParams.Receive.SenderClientId; ulong currentRtt = ((NetworkTransport)_transport).GetCurrentRtt(senderClientId); SendPingClientRpc(currentRtt, new ClientRpcParams { Send = new ClientRpcSendParams { TargetClientIds = new <>z__ReadOnlySingleElementList<ulong>(senderClientId) } }); } } } [ClientRpc] private void SendPingClientRpc(ulong ping, ClientRpcParams rpcParams = default(ClientRpcParams)) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Invalid comparison between Unknown and I4 //IL_005f: 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_006d: 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_0089: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(3343597132u, rpcParams, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val, ping); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 3343597132u, rpcParams, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; _currentPing = ping; } } } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } protected override void __initializeRpcs() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown ((NetworkBehaviour)this).__registerRpc(1694769970u, new RpcReceiveHandler(__rpc_handler_1694769970), "RequestPingServerRpc"); ((NetworkBehaviour)this).__registerRpc(3343597132u, new RpcReceiveHandler(__rpc_handler_3343597132), "SendPingClientRpc"); ((NetworkBehaviour)this).__initializeRpcs(); } private static void __rpc_handler_1694769970(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: 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_003e: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { ServerRpcParams server = rpcParams.Server; target.__rpc_exec_stage = (__RpcExecStage)1; ((StatsDisplay)(object)target).RequestPingServerRpc(server); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3343597132(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: 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) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { ulong ping = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref ping); ClientRpcParams client = rpcParams.Client; target.__rpc_exec_stage = (__RpcExecStage)1; ((StatsDisplay)(object)target).SendPingClientRpc(ping, client); target.__rpc_exec_stage = (__RpcExecStage)0; } } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "StatsDisplay"; } } } namespace LethalHUD.HUD { internal static class ChatController { internal static bool ColoringEnabled => Plugins.ConfigEntries.ColoredNames.Value; internal static string NoPunctuation(string input) { return new string(new ReadOnlySpan<char>(input.Where((char c) => char.IsLetterOrDigit(c) || c == '_' || c == '.').ToArray())); } internal static string GetColoredPlayerName(string playerName, int playerId = -1) { //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005b: 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) if (string.IsNullOrEmpty(playerName)) { return playerName; } if (ColoringEnabled && playerId < StartOfRound.Instance.allPlayerScripts.Length) { PlayerControllerB val = ((playerId >= 0) ? StartOfRound.Instance.allPlayerScripts[playerId] : GameNetworkManager.Instance.localPlayerController); PlayerColorNetworker playerColorNetworker = default(PlayerColorNetworker); if (((Component)val).TryGetComponent<PlayerColorNetworker>(ref playerColorNetworker)) { PlayerColorInfo playerColors = playerColorNetworker.PlayerColors; return HUDUtils.ApplyStaticGradient(playerName, Color32.op_Implicit(playerColors.colorA), Color32.op_Implicit(playerColors.colorB)); } } return "<color=#FF0000>" + playerName + "</color>"; } internal static string GetColoredChatMessage(string message) { //IL_0068: 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) if (string.IsNullOrWhiteSpace(message)) { return null; } message = message.Trim(); Color startColor = default(Color); Color endColor = default(Color); if (HUDUtils.HasCustomGradient(Plugins.ConfigEntries.GradientMessageColorA.Value, Plugins.ConfigEntries.GradientMessageColorB.Value) && ColorUtility.TryParseHtmlString(Plugins.ConfigEntries.GradientMessageColorA.Value, ref startColor) && ColorUtility.TryParseHtmlString(Plugins.ConfigEntries.GradientMessageColorB.Value, ref endColor)) { return HUDUtils.ApplyStaticGradient(message, startColor, endColor); } return "<color=" + Plugins.ConfigEntries.ChatMessageColor.Value + ">" + message + "</color>"; } internal static void PlayerTypingIndicator() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: 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_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //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) TextMeshProUGUI typingIndicator = HUDManager.Instance.typingIndicator; ((TMP_Text)typingIndicator).enableVertexGradient = true; ((Graphic)typingIndicator).color = Color.white; if ((Object)(object)typingIndicator == (Object)null) { return; } Color startColor = default(Color); Color endColor = default(Color); if (HUDUtils.HasCustomGradient(Plugins.ConfigEntries.GradientColorA.Value, Plugins.ConfigEntries.GradientColorB.Value) && ColorUtility.TryParseHtmlString(Plugins.ConfigEntries.GradientColorA.Value, ref startColor) && ColorUtility.TryParseHtmlString(Plugins.ConfigEntries.GradientColorB.Value, ref endColor)) { HUDUtils.ApplyVertexGradient(typingIndicator, startColor, endColor, Time.time * 0.2f); return; } switch (InventoryFrames.CurrentSlotColorMode) { case Enums.SlotEnums.Rainbow: HUDUtils.ApplyRainbowGradient(typingIndicator, Time.time * 0.25f); break; case Enums.SlotEnums.None: ((TMP_Text)typingIndicator).colorGradient = new VertexGradient(ConfigHelper.GetSlotColor()); break; default: HUDUtils.ApplyVertexGradient(typingIndicator, InventoryFrames.CurrentGradientStartColor, InventoryFrames.CurrentGradientEndColor, Time.time * 0.25f); break; } } internal static void ColorChatInputField(TMP_InputField inputField, float time) { //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_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: 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_0085: 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_008d: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: 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_018d: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: 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_0196: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: 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_01c0: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0157: 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_016a: 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_0175: Unknown result type (might be due to invalid IL or missing references) Color val3; if (HUDUtils.HasCustomGradient(Plugins.ConfigEntries.GradientColorA.Value, Plugins.ConfigEntries.GradientColorB.Value)) { Color val = default(Color); Color val2 = default(Color); if (ColorUtility.TryParseHtmlString(Plugins.ConfigEntries.GradientColorA.Value, ref val) && ColorUtility.TryParseHtmlString(Plugins.ConfigEntries.GradientColorB.Value, ref val2)) { float num = Mathf.SmoothStep(0f, 1f, Mathf.Sin(time * MathF.PI * 2f) * 0.5f + 0.5f); val3 = Color.Lerp(val, val2, num); } else { val3 = ConfigHelper.GetSlotColor(); } } else { switch (InventoryFrames.CurrentSlotColorMode) { case Enums.SlotEnums.Rainbow: { float num3 = 0.5f; float num4 = time * num3 % 1f; val3 = Color.HSVToRGB(num4, 1f, 1f); break; } case Enums.SlotEnums.None: val3 = ConfigHelper.GetSlotColor(); break; default: { float num2 = Mathf.SmoothStep(0f, 1f, Mathf.Sin(time * MathF.PI * 2f) * 0.5f + 0.5f); val3 = Color.Lerp(InventoryFrames.CurrentGradientStartColor, InventoryFrames.CurrentGradientEndColor, num2); break; } } } inputField.caretColor = val3; if ((Object)(object)inputField.textComponent != (Object)null) { Color color = (Color)(InventoryFrames.CurrentSlotColorMode switch { Enums.SlotEnums.Rainbow => new Color(1f - val3.r, 1f - val3.g, 1f - val3.b, val3.a), Enums.SlotEnums.None => HUDUtils.ParseHexColor(Plugins.ConfigEntries.ChatInputText.Value), _ => new Color(1f - val3.r, 1f - val3.g, 1f - val3.b, val3.a), }); ((Graphic)inputField.textComponent).color = color; } Graphic placeholder = inputField.placeholder; TMP_Text val4 = (TMP_Text)(object)((placeholder is TMP_Text) ? placeholder : null); if (val4 != null) { ((Graphic)val4).color = val3; } } } internal static class ClockController { private static readonly HashSet<SelectableLevel> DisabledClockLevels = new HashSet<SelectableLevel>(); private static TextMeshProUGUI _clockNumber; private static Image _clockIcon; private static Transform _clockParent; private static Image _boxImage; private static bool _skipAlphaCheck; private static bool _defaultsCached; private static Vector3 _defaultClockPos; private static Vector3 _defaultIconPos; private static Vector2 _defaultParentSize; private static Vector2 _defaultIconSize; private static bool _defaultWordWrap; internal static void CacheDefaultLayout() { //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_005e: 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_0072: 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)_clockParent == (Object)null) && !((Object)(object)_clockNumber == (Object)null) && !((Object)(object)_clockIcon == (Object)null)) { RectTransform component = ((Component)_clockParent).GetComponent<RectTransform>(); RectTransform component2 = ((Component)_clockIcon).GetComponent<RectTransform>(); _defaultParentSize = component.sizeDelta; _defaultIconSize = component2.sizeDelta; _defaultClockPos = ((TMP_Text)_clockNumber).transform.localPosition; _defaultIconPos = ((Component)_clockIcon).transform.localPosition; _defaultWordWrap = ((TMP_Text)_clockNumber).enableWordWrapping; } } internal static void ApplyClockAppearance() { //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: 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_0153: 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) if (!((Object)(object)HUDManager.Instance == (Object)null)) { _clockNumber = HUDManager.Instance.clockNumber; _clockIcon = HUDManager.Instance.clockIcon; _clockParent = ((TMP_Text)_clockNumber).transform.parent; _boxImage = ((Component)_clockParent).GetComponent<Image>(); if ((Object)(object)_clockNumber != (Object)null) { ((Graphic)_clockNumber).color = HUDUtils.ParseHexColor(Plugins.ConfigEntries.ClockNumberColor.Value, Color.white); } if ((Object)(object)_boxImage != (Object)null) { ((Graphic)_boxImage).color = HUDUtils.ParseHexColor(Plugins.ConfigEntries.ClockBoxColor.Value, Color.white); } if ((Object)(object)_clockIcon != (Object)null) { ((Graphic)_clockIcon).color = HUDUtils.ParseHexColor(Plugins.ConfigEntries.ClockIconColor.Value, new Color(1f, 0.31f, 0f)); } if ((Object)(object)HUDManager.Instance.shipLeavingEarlyIcon != (Object)null) { ((Graphic)HUDManager.Instance.shipLeavingEarlyIcon).color = HUDUtils.ParseHexColor(Plugins.ConfigEntries.ClockShipLeaveColor.Value, Color.white); } Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(-0.5893304f, 0.5893304f, 0.5893303f); _clockParent.localScale = val * Plugins.ConfigEntries.ClockSizeMultiplier.Value; if (!_defaultsCached) { CacheDefaultLayout(); _defaultsCached = true; } if (Plugins.ConfigEntries.ClockFormat.Value == Enums.ClockStyle.Compact) { ApplyCompactLayout(); } else { ApplyRegularLayout(); } } } internal static void TryOverrideClock(HUDManager hud, float timeNormalized, float numberOfHours) { if ((Object)(object)hud == (Object)null || (Object)(object)hud.clockNumber == (Object)null) { return; } int num = (int)(timeNormalized * (60f * numberOfHours)) + 360; int num2 = num / 60; int num3 = num % 60; string text; if (Plugins.ConfigEntries.NormalHumanBeingClock.Value) { text = $"{num2 % 24:00}:{num3:00}"; } else { int num4 = num2 % 12; if (num4 == 0) { num4 = 12; } string text2 = ((Plugins.ConfigEntries.ClockFormat.Value == Enums.ClockStyle.Compact) ? " " : "\n"); string text3 = ((num2 >= 12) ? "PM" : "AM"); text = $"{num4:00}:{num3:00}{text2}{text3}"; } ((TMP_Text)hud.clockNumber).text = text; if (Plugins.ConfigEntries.ClockFormat.Value == Enums.ClockStyle.Compact) { ApplyCompactLayout(); } else { ApplyRegularLayout(); } } internal static void ApplyCompactLayout() { //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0108: 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_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: 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_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) if (!((Object)(object)_clockParent == (Object)null) && !((Object)(object)_clockNumber == (Object)null) && !((Object)(object)_clockIcon == (Object)null)) { RectTransform component = ((Component)_clockParent).GetComponent<RectTransform>(); component.sizeDelta = new Vector2(component.sizeDelta.x, 50f); ((TMP_Text)_clockNumber).enableWordWrapping = false; RectTransform component2 = ((Component)_clockIcon).GetComponent<RectTransform>(); component2.sizeDelta = _defaultIconSize * 0.6f; if (Plugins.ConfigEntries.NormalHumanBeingClock.Value) { ((TMP_Text)_clockNumber).transform.localPosition = _defaultClockPos + new Vector3(-10f, 0f, 0f); ((Component)_clockIcon).transform.localPosition = _defaultIconPos + new Vector3(-10f, 0f, 0f); } else { ((TMP_Text)_clockNumber).transform.localPosition = _defaultClockPos + new Vector3(10f, 0f, 0f); ((Component)_clockIcon).transform.localPosition = _defaultIconPos + new Vector3(-25f, 0f, 0f); } } } internal static void ApplyRegularLayout() { //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_005e: 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) if (!((Object)(object)_clockParent == (Object)null) && !((Object)(object)_clockNumber == (Object)null) && !((Object)(object)_clockIcon == (Object)null)) { RectTransform component = ((Component)_clockParent).GetComponent<RectTransform>(); RectTransform component2 = ((Component)_clockIcon).GetComponent<RectTransform>(); component.sizeDelta = _defaultParentSize; component2.sizeDelta = _defaultIconSize; ((TMP_Text)_clockNumber).transform.localPosition = _defaultClockPos; ((Component)_clockIcon).transform.localPosition = _defaultIconPos; ((TMP_Text)_clockNumber).enableWordWrapping = _defaultWordWrap; } } internal static void UpdateClockVisibility(ref bool visible) { if (visible) { _skipAlphaCheck = true; return; } PlayerControllerB localPlayerController = StartOfRound.Instance.localPlayerController; if ((Object)(object)localPlayerController == (Object)null) { return; } if (localPlayerController.inTerminalMenu) { visible = false; return; } if (!Plugins.ConfigEntries.ShowClockInShip.Value && localPlayerController.isInHangarShipRoom) { visible = false; return; } if (!Plugins.ConfigEntries.ShowClockInFacility.Value && localPlayerController.isInsideFactory) { visible = false; return; } SelectableLevel currentLevel = StartOfRound.Instance.currentLevel; if (DisabledClockLevels.Contains(currentLevel)) { visible = false; } else { visible = true; } } internal static void ApplyClockAlpha() { if (!((Object)(object)HUDManager.Instance == (Object)null)) { CanvasGroup val = ((Component)_clockParent).GetComponent<CanvasGroup>() ?? ((Component)_clockParent).gameObject.AddComponent<CanvasGroup>(); float targetAlpha = GetTargetAlpha(); val.alpha = targetAlpha; } } private static float GetTargetAlpha() { if (_skipAlphaCheck) { _skipAlphaCheck = false; return 1f; } PlayerControllerB localPlayerController = StartOfRound.Instance.localPlayerController; if ((Object)(object)localPlayerController == (Object)null) { return 1f; } if (localPlayerController.isInsideFactory) { return Plugins.ConfigEntries.ClockVisibilityInFacility.Value; } if (localPlayerController.isInHangarShipRoom) { return Plugins.ConfigEntries.ClockVisibilityInShip.Value; } return 1f; } internal static void ApplyRealtimeClock() { if (Plugins.ConfigEntries.RealtimeClock.Value && (Object)(object)TimeOfDay.Instance != (Object)null) { TimeOfDay.Instance.changeHUDTimeInterval = 4f; } } } internal static class CompassController { internal static RawImage CompassImage => HUDManager.Instance?.compassImage; internal static void SetCompassColor(Color? overrideColor = null) { //IL_003e: 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_0043: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)CompassImage == (Object)null)) { PlayerControllerB val = StartOfRound.Instance?.localPlayerController; if (!((Object)(object)val == (Object)null)) { Color color = (Color)(((??)overrideColor) ?? ConfigHelper.GetSlotColor()); color.a = (val.isPlayerDead ? 0f : Plugins.ConfigEntries.CompassAlpha.Value); ((Graphic)CompassImage).color = color; } } } internal static void SetCompassWavyGradient() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) PlayerControllerB val = StartOfRound.Instance?.localPlayerController; if (!((Object)(object)val == (Object)null) && !val.isPlayerDead) { HUDUtils.ApplyCompassWavyGradient(InventoryFrames.CurrentGradientStartColor, InventoryFrames.CurrentGradientEndColor); } } internal static void SoftMaskStuff() { //IL_00bc: 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_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_0087: 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_0091: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)CompassImage == (Object)null) { return; } PlayerControllerB val = StartOfRound.Instance?.localPlayerController; if ((Object)(object)val == (Object)null) { return; } SoftMask componentInParent = ((Component)CompassImage).GetComponentInParent<SoftMask>(); if (!((Object)(object)componentInParent == (Object)null)) { bool value = Plugins.ConfigEntries.CompassInvertMask.Value; bool value2 = Plugins.ConfigEntries.CompassInvertOutsides.Value; float value3 = Plugins.ConfigEntries.CompassAlpha.Value; if (val.isPlayerDead) { componentInParent.invertMask = false; componentInParent.invertOutsides = false; Vector4 val2 = Color.op_Implicit(componentInParent.channelWeights); val2.w = 0f; componentInParent.channelWeights = Color.op_Implicit(val2); } else { componentInParent.invertMask = value; componentInParent.invertOutsides = value2; Vector4 val3 = Color.op_Implicit(componentInParent.channelWeights); val3.w = value3; componentInParent.channelWeights = Color.op_Implicit(val3); } } } } internal static class HUDUtils { private static float _rainbowTime; private static float _gradientWaveTime; private static float _loadingOffset; private static RawImage CompassImage => CompassController.CompassImage; internal static Color ParseHexColor(string hex) { //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0016: 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) Color val = default(Color); if (ColorUtility.TryParseHtmlString(hex, ref val)) { return new Color(val.r, val.g, val.b); } Loggers.Warning("Invalid HEX color: " + hex + ". Defaulting to original blue."); return new Color(0f, 0.047f, 1f); } internal static Color ParseHexColor(string hex, Color fallback) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) if (string.IsNullOrWhiteSpace(hex)) { return fallback; } Color result = default(Color); if (ColorUtility.TryParseHtmlString(hex, ref result)) { return result; } Loggers.Warning("Invalid HEX color: " + hex + ". Defaulting to original blue."); return fallback; } internal static bool HasCustomGradient(string a, string b) { if (!string.IsNullOrWhiteSpace(a) && !string.IsNullOrWhiteSpace(b)) { return !string.Equals(a, b, StringComparison.OrdinalIgnoreCase); } return false; } internal static void RecolorTexture(ref Texture2D texture, Color color) { //IL_0000: 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_000d: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_005b: 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_0080: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: 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_00c3: Unknown result type (might be due to invalid IL or missing references) float num = color.r + color.g + color.b; List<Color> list = texture.GetPixels().ToList(); Loggers.Debug("ScanTexture pixel count: " + list.Count); for (int num2 = list.Count - 1; num2 >= 0; num2--) { float num3 = list[num2].r + list[num2].g + list[num2].b; if (!(num3 < 0.05f) && !(list[num2].a < 0.05f)) { float num4 = ((num == 0f) ? 0f : (num3 / num)); list[num2] = new Color(color.r * num4, color.g * num4, color.b * num4); } } texture.SetPixels(list.ToArray()); } internal static string ApplyStaticGradient(string input, Color startColor, Color endColor, float minBrightness = 0.15f) { //IL_0022: 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_0025: 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_0031: 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_004c: 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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) string text = ""; int length = input.Length; for (int i = 0; i < length; i++) { float num = (float)i / (float)Mathf.Max(1, length - 1); Color val = Color.Lerp(startColor, endColor, num); float num2 = 0.299f * val.r + 0.587f * val.g + 0.114f * val.b; if (num2 < minBrightness) { float num3 = Mathf.Clamp01((minBrightness - num2) * 0.5f); val = Color.Lerp(val, Color.white, num3); } string arg = ColorUtility.ToHtmlStringRGB(val); text += $"<color=#{arg}>{input[i]}</color>"; } return text; }