Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of RarityHUD v1.0.0
RarityHUD.dll
Decompiled 2 weeks ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections.Generic; using System.Diagnostics; 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.Configuration; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using RoR2; using RoR2.Stats; using RoR2.UI; using TMPro; using UnityEngine; using UnityEngine.Networking; using UnityEngine.Rendering; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("RarityHUD")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("RarityHUD")] [assembly: AssemblyTitle("RarityHUD")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace RarityHUD { internal static class Attacher { private class Marker : MonoBehaviour { public readonly HashSet<string> Done = new HashSet<string>(); public readonly Dictionary<string, int> Attempts = new Dictionary<string, int>(); } private struct Feature { public string Name; public string ObjectName; public Action<HUD> Attach; } private const int MaxAttempts = 3; private static readonly Feature[] Features = new Feature[4] { new Feature { Name = "Stats", ObjectName = "RarityHUD_StatsPanel", Attach = StatsPanel.Attach }, new Feature { Name = "Friend DPS", ObjectName = "RarityHUD_DpsOverlay", Attach = DpsOverlay.Attach }, new Feature { Name = "Chat hider", ObjectName = "RarityHUD_ChatHider", Attach = ChatHider.Attach }, new Feature { Name = "Boss bubbles", ObjectName = "RarityHUD_BossBubbles", Attach = BossBubbles.Attach } }; private static readonly HashSet<string> reported = new HashSet<string>(); public static void AttachAll(HUD hud) { if (!Object.op_Implicit((Object)(object)hud) || !Object.op_Implicit((Object)(object)hud.mainContainer)) { return; } Marker marker = ((Component)hud).GetComponent<Marker>(); if (Object.op_Implicit((Object)(object)marker) && marker.Done.Count == Features.Length) { return; } if (!Object.op_Implicit((Object)(object)marker)) { marker = ((Component)hud).gameObject.AddComponent<Marker>(); } List<string> list = null; Feature[] features = Features; for (int i = 0; i < features.Length; i++) { Feature feature = features[i]; if (marker.Done.Contains(feature.Name)) { continue; } marker.Attempts.TryGetValue(feature.Name, out var value); if (value < 3) { marker.Attempts[feature.Name] = value + 1; try { feature.Attach(hud); marker.Done.Add(feature.Name); (list ?? (list = new List<string>())).Add(feature.Name); } catch (Exception ex) { RemovePartial(hud, feature.ObjectName); bool flag = value + 1 >= 3; Plugin.Log.LogError((object)string.Format("[{0}] setup failed (attempt {1}/{2}{3}):\n{4}", feature.Name, value + 1, 3, flag ? ", giving up on this HUD" : ", will retry", ex)); } } } if (list != null) { Plugin.Log.LogInfo((object)("Attached to HUD '" + ((Object)hud).name + "': " + string.Join(", ", list))); } } private static void RemovePartial(HUD hud, string objectName) { try { Transform[] componentsInChildren = ((Component)hud).GetComponentsInChildren<Transform>(true); foreach (Transform val in componentsInChildren) { if (Object.op_Implicit((Object)(object)val) && ((Object)val).name == objectName) { Object.Destroy((Object)(object)((Component)val).gameObject); } } } catch (Exception ex) { Plugin.Log.LogWarning((object)("Couldn't clean up '" + objectName + "': " + ex.Message)); } } public static void ErrorOnce(string where, Exception e) { string item = where + ":" + e.GetType().Name + ":" + e.Message; if (reported.Add(item)) { Plugin.Log.LogError((object)$"[{where}] error (shown once):\n{e}"); } } } internal static class BackdropBlur { private class State { public Camera Cam; public CommandBuffer Cmd; public RenderTexture Result; public readonly List<RenderTexture> Chain = new List<RenderTexture>(); public int Users; public int BuiltW; public int BuiltH; public int BuiltStrength; } private static readonly Dictionary<Camera, State> states = new Dictionary<Camera, State>(); private static readonly List<Camera> deadCams = new List<Camera>(); private static int Strength => Mathf.Clamp(Plugin.BossBubbleBlurStrength.Value, 1, 5); public static Texture TextureFor(Camera sceneCam) { if (!Object.op_Implicit((Object)(object)sceneCam) || !states.TryGetValue(sceneCam, out var value)) { return null; } return (Texture)(object)value.Result; } public static void Acquire(Camera sceneCam) { if (Object.op_Implicit((Object)(object)sceneCam)) { DropDeadCameras(); if (!states.TryGetValue(sceneCam, out var value)) { Dictionary<Camera, State> dictionary = states; State obj = new State { Cam = sceneCam }; value = obj; dictionary[sceneCam] = obj; } value.Users++; Ensure(sceneCam); } } public static void Release(Camera sceneCam) { if (!Object.op_Implicit((Object)(object)sceneCam) || !states.TryGetValue(sceneCam, out var value)) { DropDeadCameras(); return; } value.Users = Mathf.Max(0, value.Users - 1); if (value.Users == 0) { Teardown(value); states.Remove(sceneCam); } } public static void Ensure(Camera sceneCam) { if (Object.op_Implicit((Object)(object)sceneCam) && states.TryGetValue(sceneCam, out var value) && value.Users > 0 && (value.Cmd == null || value.BuiltW != Screen.width || value.BuiltH != Screen.height || value.BuiltStrength != Strength)) { Rebuild(value); } } private static void DropDeadCameras() { deadCams.Clear(); foreach (KeyValuePair<Camera, State> state in states) { if (!Object.op_Implicit((Object)(object)state.Key)) { deadCams.Add(state.Key); } } foreach (Camera deadCam in deadCams) { Teardown(states[deadCam]); states.Remove(deadCam); } deadCams.Clear(); } private static void Rebuild(State s) { //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Expected O, but got Unknown //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) Teardown(s); s.BuiltW = Screen.width; s.BuiltH = Screen.height; s.BuiltStrength = Strength; int num = Mathf.Max(8, s.BuiltW / 2); int num2 = Mathf.Max(8, s.BuiltH / 2); for (int i = 0; i < s.BuiltStrength + 1; i++) { s.Chain.Add(NewRT(num, num2)); num = Mathf.Max(4, num / 2); num2 = Mathf.Max(4, num2 / 2); } s.Result = NewRT(Mathf.Max(8, s.BuiltW / 4), Mathf.Max(8, s.BuiltH / 4)); s.Cmd = new CommandBuffer { name = "RarityHUD backdrop blur" }; s.Cmd.Blit(RenderTargetIdentifier.op_Implicit((BuiltinRenderTextureType)1), RenderTargetIdentifier.op_Implicit((Texture)(object)s.Chain[0])); for (int j = 1; j < s.Chain.Count; j++) { s.Cmd.Blit((Texture)(object)s.Chain[j - 1], RenderTargetIdentifier.op_Implicit((Texture)(object)s.Chain[j])); } for (int num3 = s.Chain.Count - 2; num3 >= 1; num3--) { s.Cmd.Blit((Texture)(object)s.Chain[num3 + 1], RenderTargetIdentifier.op_Implicit((Texture)(object)s.Chain[num3])); } s.Cmd.Blit((Texture)(object)s.Chain[Mathf.Min(1, s.Chain.Count - 1)], RenderTargetIdentifier.op_Implicit((Texture)(object)s.Result)); s.Cam.AddCommandBuffer((CameraEvent)19, s.Cmd); } private static RenderTexture NewRT(int w, int h) { //IL_0004: 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_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown RenderTexture val = new RenderTexture(w, h, 0, (RenderTextureFormat)0) { filterMode = (FilterMode)1, wrapMode = (TextureWrapMode)1, name = "RarityHUD_Blur" }; val.Create(); return val; } private static void Teardown(State s) { if (Object.op_Implicit((Object)(object)s.Cam) && s.Cmd != null) { s.Cam.RemoveCommandBuffer((CameraEvent)19, s.Cmd); } CommandBuffer cmd = s.Cmd; if (cmd != null) { cmd.Release(); } s.Cmd = null; foreach (RenderTexture item in s.Chain) { if (Object.op_Implicit((Object)(object)item)) { item.Release(); Object.Destroy((Object)(object)item); } } s.Chain.Clear(); if (Object.op_Implicit((Object)(object)s.Result)) { s.Result.Release(); Object.Destroy((Object)(object)s.Result); } s.Result = null; } } internal class BackdropBlurImage : MonoBehaviour { private RawImage img; private HUD hud; private Camera acquiredCam; private readonly Vector3[] corners = (Vector3[])(object)new Vector3[4]; private Camera SceneCam { get { if (!Object.op_Implicit((Object)(object)hud)) { hud = ((Component)this).GetComponentInParent<HUD>(); } if (!Object.op_Implicit((Object)(object)hud) || !Object.op_Implicit((Object)(object)hud.cameraRigController)) { return null; } return hud.cameraRigController.sceneCam; } } private bool HoldsCam => acquiredCam != null; public static void AddTo(Transform bubble, Sprite roundedShape) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Expected O, but got Unknown //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_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_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_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_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: 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_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: 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_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("BlurMask", new Type[1] { typeof(RectTransform) }); val.transform.SetParent(bubble, false); val.transform.SetAsFirstSibling(); val.AddComponent<LayoutElement>().ignoreLayout = true; RectTransform val2 = (RectTransform)val.transform; val2.anchorMin = Vector2.zero; val2.anchorMax = Vector2.one; Vector2 offsetMin = (val2.offsetMax = Vector2.zero); val2.offsetMin = offsetMin; Image obj = val.AddComponent<Image>(); obj.sprite = roundedShape; obj.type = (Type)1; ((Graphic)obj).raycastTarget = false; val.AddComponent<Mask>().showMaskGraphic = false; GameObject val3 = new GameObject("Blur", new Type[1] { typeof(RectTransform) }); val3.transform.SetParent(val.transform, false); RectTransform val4 = (RectTransform)val3.transform; val4.anchorMin = Vector2.zero; val4.anchorMax = Vector2.one; offsetMin = (val4.offsetMax = Vector2.zero); val4.offsetMin = offsetMin; RawImage val5 = val3.AddComponent<RawImage>(); ((Graphic)val5).raycastTarget = false; ((Graphic)val5).color = Color.white; val3.AddComponent<BackdropBlurImage>().img = val5; } private void OnEnable() { Sync(); } private void OnDisable() { if (HoldsCam) { BackdropBlur.Release(acquiredCam); } acquiredCam = null; } private void Sync() { Camera val = (Plugin.BossBubbleBlur.Value ? SceneCam : null); if (!Object.op_Implicit((Object)(object)val)) { val = null; } if (val != acquiredCam || (HoldsCam && !Object.op_Implicit((Object)(object)acquiredCam))) { if (HoldsCam) { BackdropBlur.Release(acquiredCam); } acquiredCam = val; if (HoldsCam) { BackdropBlur.Acquire(acquiredCam); } } } private void LateUpdate() { //IL_009c: 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_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: 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_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0117: 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_0127: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) try { Sync(); if (!Object.op_Implicit((Object)(object)img)) { return; } if (!Object.op_Implicit((Object)(object)acquiredCam)) { ((Behaviour)img).enabled = false; return; } BackdropBlur.Ensure(acquiredCam); Texture val = BackdropBlur.TextureFor(acquiredCam); ((Behaviour)img).enabled = Object.op_Implicit((Object)(object)val); if (Object.op_Implicit((Object)(object)val)) { img.texture = val; Canvas val2 = (Object.op_Implicit((Object)(object)hud) ? hud.canvas : null); Camera obj = ((Object.op_Implicit((Object)(object)val2) && (int)val2.renderMode != 0) ? val2.worldCamera : null); ((RectTransform)((Component)this).transform).GetWorldCorners(corners); Vector2 val3 = RectTransformUtility.WorldToScreenPoint(obj, corners[0]); Vector2 val4 = RectTransformUtility.WorldToScreenPoint(obj, corners[2]); float num = Mathf.Max(1, Screen.width); float num2 = Mathf.Max(1, Screen.height); Rect uvRect = default(Rect); ((Rect)(ref uvRect))..ctor(val3.x / num, val3.y / num2, (val4.x - val3.x) / num, (val4.y - val3.y) / num2); if (Plugin.BubbleBlurFlip.Value) { ((Rect)(ref uvRect))..ctor(((Rect)(ref uvRect)).x, 1f - ((Rect)(ref uvRect)).y, ((Rect)(ref uvRect)).width, 0f - ((Rect)(ref uvRect)).height); } img.uvRect = uvRect; } } catch (Exception e) { Attacher.ErrorOnce("Backdrop blur", e); } } } internal class ChatHider : MonoBehaviour { private HUD hud; private ChatBox chat; private bool shown; private bool wasHidden; private float lastPress = -10f; private readonly List<Graphic> graphics = new List<Graphic>(); private bool graphicsDirty = true; private void OnEnable() { Chat.onChatChanged += MarkDirty; } private void OnDisable() { Chat.onChatChanged -= MarkDirty; } private void MarkDirty() { graphicsDirty = true; } public static void Attach(HUD hud) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)hud) && Object.op_Implicit((Object)(object)hud.mainContainer)) { GameObject val = new GameObject("RarityHUD_ChatHider"); val.transform.SetParent(hud.mainContainer.transform, false); val.AddComponent<ChatHider>().hud = hud; } } private void LateUpdate() { //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) try { if (!Object.op_Implicit((Object)(object)chat)) { chat = (Object.op_Implicit((Object)(object)hud) ? ((Component)hud).GetComponentInChildren<ChatBox>(true) : null); graphicsDirty = true; } if (!Object.op_Implicit((Object)(object)chat)) { return; } if (((Component)chat).transform.localScale != Vector3.one) { ((Component)chat).transform.localScale = Vector3.one; } KeyboardShortcut value = Plugin.ChatToggleKey.Value; if (((KeyboardShortcut)(ref value)).IsDown()) { float unscaledTime = Time.unscaledTime; if (unscaledTime - lastPress <= Plugin.ChatDoublePressWindow.Value) { shown = !shown; lastPress = -10f; } else { lastPress = unscaledTime; } } bool flag = chat.showInput || (Object.op_Implicit((Object)(object)chat.inputField) && chat.inputField.isFocused); bool flag2 = Plugin.ChatHiddenByDefault.Value && !shown && !flag; if (flag2) { if (graphicsDirty) { ((Component)chat).GetComponentsInChildren<Graphic>(true, graphics); graphicsDirty = false; } foreach (Graphic graphic in graphics) { if (Object.op_Implicit((Object)(object)graphic) && Object.op_Implicit((Object)(object)graphic.canvasRenderer)) { graphic.canvasRenderer.SetAlpha(0f); } } } else if (wasHidden) { ((Component)chat).GetComponentsInChildren<Graphic>(true, graphics); foreach (Graphic graphic2 in graphics) { if (Object.op_Implicit((Object)(object)graphic2) && Object.op_Implicit((Object)(object)graphic2.canvasRenderer)) { graphic2.canvasRenderer.SetAlpha(1f); } } } wasHidden = flag2; } catch (Exception e) { Attacher.ErrorOnce("Chat hider", e); } } private void OnDestroy() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)chat)) { return; } ((Component)chat).transform.localScale = Vector3.one; ((Component)chat).GetComponentsInChildren<Graphic>(true, graphics); foreach (Graphic graphic in graphics) { if (Object.op_Implicit((Object)(object)graphic) && Object.op_Implicit((Object)(object)graphic.canvasRenderer)) { graphic.canvasRenderer.SetAlpha(1f); } } } } internal class BossBubbles : MonoBehaviour { private class Bubble { public GameObject Speaker; public RectTransform Rt; public CanvasGroup Group; public TextMeshProUGUI Text; public float Life; public float Age; public float Reveal; public int Total; public GameObject Tail; } private static readonly List<BossBubbles> instances = new List<BossBubbles>(); private HUD hud; private RectTransform layer; private TMP_FontAsset font; private readonly List<Bubble> bubbles = new List<Bubble>(); private static Sprite frosted; private float slotTimer; private float slotCenterX; private float slotBottomY; private float slotWidth = 560f; private bool slotValid; internal static Sprite Frosted() { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Expected O, but got Unknown //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)frosted)) { return frosted; } Texture2D val = new Texture2D(64, 64, (TextureFormat)4, false) { filterMode = (FilterMode)1, wrapMode = (TextureWrapMode)1, name = "RarityHUD_Frosted" }; Color[] array = (Color[])(object)new Color[4096]; for (int i = 0; i < 64; i++) { for (int j = 0; j < 64; j++) { float num = Mathf.Clamp((float)j + 0.5f, 18f, 46f); float num2 = Mathf.Clamp((float)i + 0.5f, 18f, 46f); float num3 = Mathf.Sqrt(((float)j + 0.5f - num) * ((float)j + 0.5f - num) + ((float)i + 0.5f - num2) * ((float)i + 0.5f - num2)); array[i * 64 + j] = new Color(1f, 1f, 1f, Mathf.Clamp01((18f - num3) / 4f)); } } val.SetPixels(array); val.Apply(false, true); return frosted = Sprite.Create(val, new Rect(0f, 0f, 64f, 64f), new Vector2(0.5f, 0.5f), 100f, 0u, (SpriteMeshType)0, new Vector4(24f, 24f, 24f, 24f)); } private static string NameStyle(string name, GameObject speaker) { //IL_0032: Unknown result type (might be due to invalid IL or missing references) string text = (name ?? "").ToLowerInvariant(); CharacterBody val = (Object.op_Implicit((Object)(object)speaker) ? speaker.GetComponent<CharacterBody>() : null); string text2 = ((!Object.op_Implicit((Object)(object)val)) ? "" : (BodyCatalog.GetBodyName(val.bodyIndex)?.ToLowerInvariant() ?? "")); if (text.Contains("mithrix") || text2.StartsWith("brother")) { return "{shake}{fancy}<size=115%>" + name + "</size>{/fancy}{/shake}"; } if (text.Contains("false son") || text2.Contains("falseson")) { return "{wave}{pulse}<size=112%>" + name + "</size>{/pulse}{/wave}"; } if (text.Contains("alloy hunter") || text2.Contains("hunter")) { return "{robot}{glitch}" + name + "{/glitch}{/robot}"; } if (text.Contains("solus heart") || text.Contains("heart")) { return "{glitch}{robot}<size=110%>" + name.ToUpperInvariant() + "</size>{/robot}{/glitch}"; } return "{wave}" + name + "{/wave}"; } internal static void ApplyFrostedStyle(Transform bubble) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) ApplyFrostedStyle(bubble, BubbleAccent()); } internal static void ApplyFrostedStyle(Transform bubble, Color accent) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) ApplyFrostedStyle(bubble, accent, Plugin.BossBubbleOpacity.Value); } internal static void ApplyFrostedStyle(Transform bubble, Color accent, float frost) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) ApplyFrostedStyle(bubble, accent, frost, null); } internal static void ApplyFrostedStyle(Transform bubble, Color accent, float frost, Color? solid) { //IL_0012: 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_001e: 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_0057: 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_008b: 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_00bd: 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) //IL_00ce: 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) float num = Mathf.Clamp01(frost); Image obj = Layer(bubble, "Tint", Frosted(), new Color(accent.r, accent.g, accent.b, num * 0.35f)); Layer(bubble, "Shade", Frosted(), new Color(0f, 0f, 0f, num * 0.6f)); if (solid.HasValue) { Color value = solid.Value; value.a = 1f; Layer(bubble, "Solid", Frosted(), value); } else if (Plugin.BossBubbleBlur.Value) { BackdropBlurImage.AddTo(bubble, Frosted()); } Outline obj2 = ((Component)obj).gameObject.AddComponent<Outline>(); ((Shadow)obj2).effectColor = new Color(accent.r, accent.g, accent.b, 0.9f); ((Shadow)obj2).effectDistance = new Vector2(1.5f, -1.5f); } internal static Color BubbleAccent() { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) Color result = default(Color); if (!ColorUtility.TryParseHtmlString(Plugin.BubbleAccentColor.Value, ref result)) { return new Color(0.64f, 0.64f, 0.64f); } return result; } internal static Image Layer(Transform parent, string name, Sprite sprite, Color color, Material mat = null) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0026: 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_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0054: 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_005f: 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_0065: 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_0091: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject(name, new Type[1] { typeof(RectTransform) }); val.transform.SetParent(parent, false); val.transform.SetAsFirstSibling(); val.AddComponent<LayoutElement>().ignoreLayout = true; RectTransform val2 = (RectTransform)val.transform; val2.anchorMin = Vector2.zero; val2.anchorMax = Vector2.one; Vector2 offsetMin = (val2.offsetMax = Vector2.zero); val2.offsetMin = offsetMin; Image val3 = val.AddComponent<Image>(); val3.sprite = sprite; val3.type = (Type)(Object.op_Implicit((Object)(object)sprite) ? 1 : 0); ((Graphic)val3).color = color; ((Graphic)val3).raycastTarget = false; if (Object.op_Implicit((Object)(object)mat)) { ((Graphic)val3).material = mat; } return val3; } public static void Attach(HUD hud) { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Expected O, but got Unknown //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)hud) && Object.op_Implicit((Object)(object)hud.mainContainer)) { GameObject val = new GameObject("RarityHUD_BossBubbles", new Type[1] { typeof(RectTransform) }); val.transform.SetParent(hud.mainContainer.transform, false); RectTransform val2 = (RectTransform)val.transform; val2.anchorMin = Vector2.zero; val2.anchorMax = Vector2.one; Vector2 offsetMin = (val2.offsetMax = Vector2.zero); val2.offsetMin = offsetMin; BossBubbles bossBubbles = val.AddComponent<BossBubbles>(); bossBubbles.hud = hud; bossBubbles.layer = val2; TextMeshProUGUI componentInChildren = ((Component)hud).GetComponentInChildren<TextMeshProUGUI>(true); if (Object.op_Implicit((Object)(object)componentInChildren)) { bossBubbles.font = ((TMP_Text)componentInChildren).font; } } } private void OnEnable() { instances.Add(this); } private void OnDisable() { instances.Remove(this); } public static bool Show(GameObject speaker, string name, string line) { if (string.IsNullOrWhiteSpace(line)) { return false; } bool result = false; BossBubbles[] array = instances.ToArray(); foreach (BossBubbles bossBubbles in array) { try { bossBubbles.Add(speaker, name, line); result = true; } catch (Exception e) { Attacher.ErrorOnce("Boss bubbles", e); } } return result; } private TextMeshProUGUI Label(Transform parent, float size, Color color) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("Text", new Type[1] { typeof(RectTransform) }); val.transform.SetParent(parent, false); TextMeshProUGUI val2 = val.AddComponent<TextMeshProUGUI>(); if (Object.op_Implicit((Object)(object)font)) { ((TMP_Text)val2).font = font; } ((TMP_Text)val2).fontSize = size; ((Graphic)val2).color = color; ((TMP_Text)val2).richText = true; ((TMP_Text)val2).enableWordWrapping = true; ((Graphic)val2).raycastTarget = false; ((TMP_Text)val2).alignment = (TextAlignmentOptions)257; return val2; } private void Add(GameObject speaker, string name, string line) { //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Expected O, but got Unknown //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Expected O, but got Unknown //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: 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_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Expected O, but got Unknown //IL_017d: 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_023b: Unknown result type (might be due to invalid IL or missing references) //IL_02a1: Unknown result type (might be due to invalid IL or missing references) //IL_02a8: Expected O, but got Unknown //IL_02cf: Unknown result type (might be due to invalid IL or missing references) //IL_02d4: Unknown result type (might be due to invalid IL or missing references) //IL_02d5: Unknown result type (might be due to invalid IL or missing references) //IL_02e7: Unknown result type (might be due to invalid IL or missing references) //IL_02ee: Unknown result type (might be due to invalid IL or missing references) //IL_02f5: Unknown result type (might be due to invalid IL or missing references) //IL_0300: Unknown result type (might be due to invalid IL or missing references) //IL_030a: Unknown result type (might be due to invalid IL or missing references) //IL_0315: Unknown result type (might be due to invalid IL or missing references) //IL_032e: Unknown result type (might be due to invalid IL or missing references) //IL_033f: Unknown result type (might be due to invalid IL or missing references) //IL_0344: Unknown result type (might be due to invalid IL or missing references) //IL_0347: Unknown result type (might be due to invalid IL or missing references) //IL_034e: Unknown result type (might be due to invalid IL or missing references) //IL_0355: Unknown result type (might be due to invalid IL or missing references) //IL_0363: Unknown result type (might be due to invalid IL or missing references) //IL_0266: Unknown result type (might be due to invalid IL or missing references) for (int num = bubbles.Count - 1; num >= 0; num--) { if ((Object)(object)bubbles[num].Speaker == (Object)(object)speaker && Object.op_Implicit((Object)(object)speaker)) { Object.Destroy((Object)(object)((Component)bubbles[num].Rt).gameObject); bubbles.RemoveAt(num); } } float value = Plugin.BossBubbleScale.Value; GameObject val = new GameObject("Bubble", new Type[1] { typeof(RectTransform) }); val.transform.SetParent((Transform)(object)layer, false); RectTransform val2 = (RectTransform)val.transform; Vector2 val3 = default(Vector2); ((Vector2)(ref val3))..ctor(0.5f, 0.5f); val2.anchorMax = val3; val2.anchorMin = val3; val2.pivot = new Vector2(0.5f, 0f); ((Transform)val2).localScale = Vector3.one * value; float num2 = Mathf.Clamp01(Plugin.BossBubbleOpacity.Value); ApplyFrostedStyle(val.transform); CanvasGroup val4 = val.AddComponent<CanvasGroup>(); val4.blocksRaycasts = false; VerticalLayoutGroup obj = val.AddComponent<VerticalLayoutGroup>(); ((LayoutGroup)obj).padding = new RectOffset(22, 22, 14, 18); ((HorizontalOrVerticalLayoutGroup)obj).spacing = 6f; ((HorizontalOrVerticalLayoutGroup)obj).childControlWidth = true; ((HorizontalOrVerticalLayoutGroup)obj).childControlHeight = true; ((HorizontalOrVerticalLayoutGroup)obj).childForceExpandWidth = true; ((HorizontalOrVerticalLayoutGroup)obj).childForceExpandHeight = false; ContentSizeFitter obj2 = val.AddComponent<ContentSizeFitter>(); obj2.horizontalFit = (FitMode)0; obj2.verticalFit = (FitMode)2; val2.sizeDelta = new Vector2(560f, 100f); if (string.IsNullOrWhiteSpace(name)) { name = "???"; } TextMeshProUGUI val5 = Label(val.transform, 24f, Color.white); ((TMP_Text)val5).fontStyle = (FontStyles)1; ((TMP_Text)val5).enableWordWrapping = false; if (Plugin.BossNameEffects.Value) { TextFx.ScanFonts(font); TextFx textFx = ((Component)val5).gameObject.AddComponent<TextFx>(); textFx.Bind(val5); textFx.Enabled = () => Plugin.BossNameEffects.Value; textFx.CharsPerSecond = 10000f; textFx.Show(NameStyle(name, speaker)); } else { ((TMP_Text)val5).text = name; } TextMeshProUGUI val6 = Label(val.transform, 30f, Color.white); if (((Behaviour)val6).isActiveAndEnabled) { ((TMP_Text)val6).outlineWidth = 0.18f; ((TMP_Text)val6).outlineColor = new Color32((byte)0, (byte)0, (byte)0, (byte)220); } ((TMP_Text)val6).text = line; ((TMP_Text)val6).maxVisibleCharacters = 0; ((TMP_Text)val6).ForceMeshUpdate(false, false); GameObject val7 = new GameObject("Tail", new Type[1] { typeof(RectTransform) }); val7.transform.SetParent(val.transform, false); val7.AddComponent<LayoutElement>().ignoreLayout = true; RectTransform val8 = (RectTransform)val7.transform; ((Vector2)(ref val3))..ctor(0.5f, 0f); val8.anchorMax = val3; val8.anchorMin = val3; val8.sizeDelta = new Vector2(22f, 22f); val8.anchoredPosition = new Vector2(0f, -2f); ((Transform)val8).localRotation = Quaternion.Euler(0f, 0f, 45f); Image obj3 = val7.AddComponent<Image>(); Color val9 = BubbleAccent(); ((Graphic)obj3).color = new Color(val9.r, val9.g, val9.b, num2 * 0.35f); ((Graphic)obj3).raycastTarget = false; int characterCount = ((TMP_Text)val6).textInfo.characterCount; bubbles.Add(new Bubble { Speaker = speaker, Rt = val2, Group = val4, Text = val6, Total = characterCount, Tail = val7, Life = Mathf.Max(3f, Plugin.BossBubbleSeconds.Value + (float)characterCount / 16f) }); } private void Update() { try { Tick(); } catch (Exception e) { Attacher.ErrorOnce("Boss bubbles", e); } } private bool Corners(Component c, out Vector2 min, out Vector2 max) { //IL_0004: 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_000b: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000d: 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_005f: 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_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_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_0095: 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_009c: 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_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: 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_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_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) min = (max = default(Vector2)); RectTransform val = (RectTransform)(Object.op_Implicit((Object)(object)c) ? /*isinst with value type is only supported in some contexts*/: null); if (!Object.op_Implicit((Object)(object)val) || !((Component)val).gameObject.activeInHierarchy) { return false; } Vector3[] array = (Vector3[])(object)new Vector3[4]; val.GetWorldCorners(array); min = new Vector2(float.MaxValue, float.MaxValue); max = new Vector2(float.MinValue, float.MinValue); Vector3[] array2 = array; foreach (Vector3 val2 in array2) { Vector2 val3 = Vector2.op_Implicit(((Transform)layer).InverseTransformPoint(val2)); min = Vector2.Min(min, val3); max = Vector2.Max(max, val3); } return true; } private void UpdateSlot() { //IL_0006: 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_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: 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_00e5: Unknown result type (might be due to invalid IL or missing references) Rect rect = layer.rect; Transform c = null; if (hud.skillIcons != null) { SkillIcon[] skillIcons = hud.skillIcons; foreach (SkillIcon val in skillIcons) { if (Object.op_Implicit((Object)(object)val)) { c = ((Component)val).transform.parent; break; } } } Vector2 min; Vector2 max; bool num = Corners((Component)(object)hud.healthBar, out min, out max); Vector2 min2; Vector2 max2; bool flag = Corners((Component)(object)c, out min2, out max2); if (num && flag && min2.x - max.x > 240f) { float num2 = max.x + 24f; float num3 = min2.x - 24f; slotCenterX = (num2 + num3) * 0.5f; slotWidth = Mathf.Clamp(num3 - num2, 260f, 640f); slotBottomY = Mathf.Min(min.y, min2.y) + 8f; } else { slotCenterX = ((Rect)(ref rect)).center.x; slotWidth = 560f; slotBottomY = ((Rect)(ref rect)).yMin + ((Rect)(ref rect)).height * 0.06f; } slotValid = true; } private void Tick() { //IL_0066: 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_0082: Unknown result type (might be due to invalid IL or missing references) //IL_01de: Unknown result type (might be due to invalid IL or missing references) //IL_0236: Unknown result type (might be due to invalid IL or missing references) //IL_028b: Unknown result type (might be due to invalid IL or missing references) //IL_0290: Unknown result type (might be due to invalid IL or missing references) //IL_02a0: Unknown result type (might be due to invalid IL or missing references) //IL_025f: Unknown result type (might be due to invalid IL or missing references) //IL_0269: Unknown result type (might be due to invalid IL or missing references) //IL_0443: Unknown result type (might be due to invalid IL or missing references) //IL_0448: Unknown result type (might be due to invalid IL or missing references) //IL_0390: Unknown result type (might be due to invalid IL or missing references) //IL_0395: Unknown result type (might be due to invalid IL or missing references) //IL_03b0: Unknown result type (might be due to invalid IL or missing references) //IL_03b5: Unknown result type (might be due to invalid IL or missing references) //IL_03c5: Unknown result type (might be due to invalid IL or missing references) //IL_03d4: Unknown result type (might be due to invalid IL or missing references) //IL_0407: Unknown result type (might be due to invalid IL or missing references) //IL_032d: Unknown result type (might be due to invalid IL or missing references) //IL_0332: Unknown result type (might be due to invalid IL or missing references) //IL_034a: Unknown result type (might be due to invalid IL or missing references) //IL_034f: Unknown result type (might be due to invalid IL or missing references) //IL_0354: Unknown result type (might be due to invalid IL or missing references) //IL_0357: Unknown result type (might be due to invalid IL or missing references) //IL_0359: Unknown result type (might be due to invalid IL or missing references) //IL_035e: Unknown result type (might be due to invalid IL or missing references) //IL_0360: Unknown result type (might be due to invalid IL or missing references) //IL_046c: Unknown result type (might be due to invalid IL or missing references) //IL_0374: Unknown result type (might be due to invalid IL or missing references) //IL_0376: Unknown result type (might be due to invalid IL or missing references) //IL_0385: Unknown result type (might be due to invalid IL or missing references) //IL_0387: Unknown result type (might be due to invalid IL or missing references) if (bubbles.Count == 0) { return; } Camera val = ((Object.op_Implicit((Object)(object)hud) && Object.op_Implicit((Object)(object)hud.cameraRigController)) ? hud.cameraRigController.sceneCam : null); Canvas val2 = (Object.op_Implicit((Object)(object)hud) ? hud.canvas : null); Camera val3 = ((Object.op_Implicit((Object)(object)val2) && (int)val2.renderMode != 0) ? val2.worldCamera : null); Rect rect = layer.rect; float unscaledDeltaTime = Time.unscaledDeltaTime; bool flag = Plugin.BossBubblePlacement.Value == Plugin.BubblePlacement.BetweenHealthAndSkills; slotTimer -= unscaledDeltaTime; if (flag && (!slotValid || slotTimer <= 0f)) { UpdateSlot(); slotTimer = 0.5f; } float num = slotBottomY; Vector2 val4 = default(Vector2); Vector2 val8 = default(Vector2); for (int num2 = bubbles.Count - 1; num2 >= 0; num2--) { Bubble bubble = bubbles[num2]; if (!Object.op_Implicit((Object)(object)bubble.Rt)) { bubbles.RemoveAt(num2); } else { bubble.Age += unscaledDeltaTime; if (bubble.Age >= bubble.Life) { Object.Destroy((Object)(object)((Component)bubble.Rt).gameObject); bubbles.RemoveAt(num2); } else { bubble.Reveal += unscaledDeltaTime * 40f; ((TMP_Text)bubble.Text).maxVisibleCharacters = Mathf.Min(bubble.Total, Mathf.FloorToInt(bubble.Reveal)); bubble.Group.alpha = Mathf.Min(Mathf.Clamp01(bubble.Age / 0.2f), Mathf.Clamp01((bubble.Life - bubble.Age) / 0.5f)); float x = ((Transform)bubble.Rt).localScale.x; Rect rect2; if (flag) { if (Object.op_Implicit((Object)(object)bubble.Tail) && bubble.Tail.activeSelf) { bubble.Tail.SetActive(false); } float num3 = slotWidth / Mathf.Max(0.01f, x); if (Mathf.Abs(bubble.Rt.sizeDelta.x - num3) > 0.5f) { bubble.Rt.sizeDelta = new Vector2(num3, bubble.Rt.sizeDelta.y); } ((Vector2)(ref val4))..ctor(slotCenterX, num); float num4 = num; rect2 = bubble.Rt.rect; num = num4 + (((Rect)(ref rect2)).height * ((Transform)bubble.Rt).localScale.y + 8f); } else { if (Object.op_Implicit((Object)(object)bubble.Tail) && !bubble.Tail.activeSelf) { bubble.Tail.SetActive(true); } ((Vector2)(ref val4))..ctor(0f, ((Rect)(ref rect)).height * 0.28f); CharacterBody val5 = (Object.op_Implicit((Object)(object)bubble.Speaker) ? bubble.Speaker.GetComponent<CharacterBody>() : null); if (Object.op_Implicit((Object)(object)val5) && Object.op_Implicit((Object)(object)val)) { Vector3 val6 = val5.corePosition + Vector3.up * (val5.radius * 1.6f + 2.5f); Vector3 val7 = val.WorldToScreenPoint(val6); if (val7.z > 0f && RectTransformUtility.ScreenPointToLocalPointInRectangle(layer, Vector2.op_Implicit(val7), val3, ref val8)) { val4 = val8; } } rect2 = bubble.Rt.rect; float num5 = ((Rect)(ref rect2)).width * x * 0.5f; rect2 = bubble.Rt.rect; float num6 = ((Rect)(ref rect2)).height * ((Transform)bubble.Rt).localScale.y; val4.x = Mathf.Clamp(val4.x, ((Rect)(ref rect)).xMin + num5 + 20f, ((Rect)(ref rect)).xMax - num5 - 20f); val4.y = Mathf.Clamp(val4.y, ((Rect)(ref rect)).yMin + 40f, ((Rect)(ref rect)).yMax - num6 - 20f); } bubble.Rt.anchoredPosition = Vector2.Lerp(bubble.Rt.anchoredPosition, val4, (bubble.Age < 0.05f) ? 1f : Mathf.Clamp01(unscaledDeltaTime * 12f)); } } } } } internal class DpsOverlay : MonoBehaviour { private HUD hud; private RectTransform overheadRoot; private TMP_FontAsset font; private float scanTimer; private readonly Dictionary<AllyCardController, TextMeshProUGUI> cardLabels = new Dictionary<AllyCardController, TextMeshProUGUI>(); private readonly Dictionary<CharacterMaster, TextMeshProUGUI> overheadLabels = new Dictionary<CharacterMaster, TextMeshProUGUI>(); private readonly List<AllyCardController> cardScratch = new List<AllyCardController>(); private readonly List<AllyCardController> goneCards = new List<AllyCardController>(); private readonly HashSet<CharacterMaster> seen = new HashSet<CharacterMaster>(); private readonly List<CharacterMaster> deadMasters = new List<CharacterMaster>(); private bool overheadHidden = true; private const float TextInterval = 0.2f; private float overheadTextTimer; private static readonly Color DpsColor = new Color(1f, 0.82f, 0.35f); private bool CardsOn { get { if (Plugin.DpsEnabled.Value) { if (Plugin.FriendDps.Value != Plugin.FriendDpsMode.AllyCards) { return Plugin.FriendDps.Value == Plugin.FriendDpsMode.Both; } return true; } return false; } } private bool OverheadOn { get { if (Plugin.DpsEnabled.Value) { if (Plugin.FriendDps.Value != Plugin.FriendDpsMode.Overhead) { return Plugin.FriendDps.Value == Plugin.FriendDpsMode.Both; } return true; } return false; } } public static void Attach(HUD hud) { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Expected O, but got Unknown //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)hud) && Object.op_Implicit((Object)(object)hud.mainContainer)) { GameObject val = new GameObject("RarityHUD_DpsOverlay", new Type[1] { typeof(RectTransform) }); val.transform.SetParent(hud.mainContainer.transform, false); RectTransform val2 = (RectTransform)val.transform; val2.anchorMin = Vector2.zero; val2.anchorMax = Vector2.one; Vector2 offsetMin = (val2.offsetMax = Vector2.zero); val2.offsetMin = offsetMin; ((Transform)val2).SetAsFirstSibling(); DpsOverlay dpsOverlay = val.AddComponent<DpsOverlay>(); dpsOverlay.hud = hud; dpsOverlay.overheadRoot = val2; TextMeshProUGUI componentInChildren = ((Component)hud).GetComponentInChildren<TextMeshProUGUI>(true); if (Object.op_Implicit((Object)(object)componentInChildren)) { dpsOverlay.font = ((TMP_Text)componentInChildren).font; } } } private TextMeshProUGUI MakeLabel(Transform parent, string name, float size) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_004d: 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) GameObject val = new GameObject(name, new Type[1] { typeof(RectTransform) }); val.transform.SetParent(parent, false); TextMeshProUGUI val2 = val.AddComponent<TextMeshProUGUI>(); if (Object.op_Implicit((Object)(object)font)) { ((TMP_Text)val2).font = font; } ((TMP_Text)val2).fontSize = size; ((Graphic)val2).color = DpsColor; ((TMP_Text)val2).enableWordWrapping = false; ((TMP_Text)val2).overflowMode = (TextOverflowModes)0; ((Graphic)val2).raycastTarget = false; if (((Behaviour)val2).isActiveAndEnabled) { ((TMP_Text)val2).outlineWidth = 0.25f; } ((TMP_Text)val2).outlineColor = new Color32((byte)0, (byte)0, (byte)0, (byte)220); return val2; } private void Update() { try { UpdateInner(); } catch (Exception e) { Attacher.ErrorOnce("Friend DPS", e); } } private void UpdateInner() { scanTimer -= Time.unscaledDeltaTime; if (scanTimer <= 0f) { scanTimer = 0.25f; UpdateCards(); } UpdateOverhead(); } private void UpdateCards() { //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: 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_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: Unknown result type (might be due to invalid IL or missing references) //IL_01ff: Unknown result type (might be due to invalid IL or missing references) goneCards.Clear(); foreach (KeyValuePair<AllyCardController, TextMeshProUGUI> cardLabel in cardLabels) { if (!Object.op_Implicit((Object)(object)cardLabel.Key) || !Object.op_Implicit((Object)(object)cardLabel.Value)) { goneCards.Add(cardLabel.Key); } } foreach (AllyCardController goneCard in goneCards) { cardLabels.Remove(goneCard); } goneCards.Clear(); if (!CardsOn) { foreach (TextMeshProUGUI value2 in cardLabels.Values) { if (((Component)value2).gameObject.activeSelf) { ((Component)value2).gameObject.SetActive(false); } } return; } ((Component)hud).GetComponentsInChildren<AllyCardController>(false, cardScratch); foreach (AllyCardController item in cardScratch) { CharacterMaster sourceMaster = item.sourceMaster; if (!Object.op_Implicit((Object)(object)sourceMaster)) { continue; } bool num = Object.op_Implicit((Object)(object)sourceMaster.playerCharacterMasterController); if (!cardLabels.TryGetValue(item, out var value)) { value = MakeLabel(((Component)item).transform, "RarityHUD_Dps", 18f); if (Object.op_Implicit((Object)(object)item.nameLabel)) { ((TMP_Text)value).font = ((TMP_Text)item.nameLabel).font; } RectTransform rectTransform = ((TMP_Text)value).rectTransform; Vector2 anchorMin = (rectTransform.anchorMax = new Vector2(1f, 0.5f)); rectTransform.anchorMin = anchorMin; rectTransform.pivot = new Vector2(0f, 0.5f); rectTransform.anchoredPosition = new Vector2(8f, 0f); rectTransform.sizeDelta = new Vector2(120f, 24f); ((TMP_Text)value).alignment = (TextAlignmentOptions)513; cardLabels[item] = value; } float dps = (num ? DpsTracker.GetDps(sourceMaster) : DpsTracker.GetOwnDps(sourceMaster)); if (!((Component)value).gameObject.activeSelf) { ((Component)value).gameObject.SetActive(true); } SetText(value, DpsTracker.Format(dps) + " DPS"); } cardScratch.Clear(); } private static void SetText(TextMeshProUGUI label, string s) { if (((TMP_Text)label).text != s) { ((TMP_Text)label).text = s; } } private void UpdateOverhead() { //IL_00bc: 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_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_01e1: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: Unknown result type (might be due to invalid IL or missing references) //IL_01ff: Unknown result type (might be due to invalid IL or missing references) //IL_0204: Unknown result type (might be due to invalid IL or missing references) //IL_0206: Unknown result type (might be due to invalid IL or missing references) //IL_0276: Unknown result type (might be due to invalid IL or missing references) //IL_028b: Unknown result type (might be due to invalid IL or missing references) //IL_0290: Unknown result type (might be due to invalid IL or missing references) //IL_0291: Unknown result type (might be due to invalid IL or missing references) //IL_0298: Unknown result type (might be due to invalid IL or missing references) //IL_02b7: Unknown result type (might be due to invalid IL or missing references) //IL_02b9: Unknown result type (might be due to invalid IL or missing references) //IL_02d2: Unknown result type (might be due to invalid IL or missing references) //IL_033b: Unknown result type (might be due to invalid IL or missing references) Camera val = (Object.op_Implicit((Object)(object)hud.cameraRigController) ? hud.cameraRigController.sceneCam : null); if (!OverheadOn || !Object.op_Implicit((Object)(object)val)) { if (overheadHidden) { return; } foreach (TextMeshProUGUI value3 in overheadLabels.Values) { if (Object.op_Implicit((Object)(object)value3) && ((Component)value3).gameObject.activeSelf) { ((Component)value3).gameObject.SetActive(false); } } overheadHidden = true; return; } overheadHidden = false; Canvas canvas = hud.canvas; Camera val2 = ((Object.op_Implicit((Object)(object)canvas) && (int)canvas.renderMode != 0) ? canvas.worldCamera : null); CharacterMaster targetMaster = hud.targetMaster; Vector3 position = ((Component)val).transform.position; float value = Plugin.DpsOverheadMaxDistance.Value; overheadTextTimer -= Time.unscaledDeltaTime; bool flag = overheadTextTimer <= 0f; if (flag) { overheadTextTimer = 0.2f; } seen.Clear(); Vector2 anchoredPosition = default(Vector2); foreach (PlayerCharacterMasterController instance in PlayerCharacterMasterController.instances) { CharacterMaster val3 = (Object.op_Implicit((Object)(object)instance) ? instance.master : null); if (!Object.op_Implicit((Object)(object)val3) || (Object)(object)val3 == (Object)(object)targetMaster) { continue; } CharacterBody body = val3.GetBody(); if (!Object.op_Implicit((Object)(object)body) || !Object.op_Implicit((Object)(object)body.healthComponent) || !body.healthComponent.alive) { continue; } Vector3 val4 = body.corePosition + Vector3.up * (body.radius + 1.6f + Plugin.DpsOverheadHeight.Value); float num = Vector3.Distance(position, val4); if (value > 0f && num > value) { continue; } Vector3 val5 = val.WorldToScreenPoint(val4); if (val5.z <= 0f) { continue; } bool flag2 = false; if (!overheadLabels.TryGetValue(val3, out var value2) || !Object.op_Implicit((Object)(object)value2)) { value2 = MakeLabel((Transform)(object)overheadRoot, "Dps_" + instance.GetDisplayName(), 20f); ((TMP_Text)value2).alignment = (TextAlignmentOptions)514; RectTransform rectTransform = ((TMP_Text)value2).rectTransform; rectTransform.sizeDelta = new Vector2(160f, 26f); Vector2 anchorMin = (rectTransform.anchorMax = new Vector2(0.5f, 0.5f)); rectTransform.anchorMin = anchorMin; overheadLabels[val3] = value2; flag2 = true; } if (RectTransformUtility.ScreenPointToLocalPointInRectangle(overheadRoot, Vector2.op_Implicit(val5), val2, ref anchoredPosition)) { ((TMP_Text)value2).rectTransform.anchoredPosition = anchoredPosition; if (flag || flag2 || !((Component)value2).gameObject.activeSelf) { SetText(value2, DpsTracker.Format(DpsTracker.GetDps(val3)) + " DPS"); } float num2 = Mathf.Clamp(30f / Mathf.Max(num, 1f), 0.6f, 1.1f); ((Transform)((TMP_Text)value2).rectTransform).localScale = new Vector3(num2, num2, num2); if (!((Component)value2).gameObject.activeSelf) { ((Component)value2).gameObject.SetActive(true); } seen.Add(val3); } } deadMasters.Clear(); foreach (KeyValuePair<CharacterMaster, TextMeshProUGUI> overheadLabel in overheadLabels) { if (!Object.op_Implicit((Object)(object)overheadLabel.Key) || !Object.op_Implicit((Object)(object)overheadLabel.Value)) { if (Object.op_Implicit((Object)(object)overheadLabel.Value)) { Object.Destroy((Object)(object)((Component)overheadLabel.Value).gameObject); } deadMasters.Add(overheadLabel.Key); } else if (!seen.Contains(overheadLabel.Key) && ((Component)overheadLabel.Value).gameObject.activeSelf) { ((Component)overheadLabel.Value).gameObject.SetActive(false); } } foreach (CharacterMaster deadMaster in deadMasters) { overheadLabels.Remove(deadMaster); } deadMasters.Clear(); } } internal static class DpsTracker { private class Window { public readonly Queue<KeyValuePair<float, float>> Hits = new Queue<KeyValuePair<float, float>>(); public float Sum; } private static readonly Dictionary<CharacterMaster, Window> windows = new Dictionary<CharacterMaster, Window>(); private static readonly Dictionary<CharacterMaster, Window> ownWindows = new Dictionary<CharacterMaster, Window>(); private static readonly List<CharacterMaster> scratch = new List<CharacterMaster>(); private static float WindowSeconds => Mathf.Max(0.5f, Plugin.DpsWindow.Value); public static void Init() { GlobalEventManager.onServerDamageDealt += OnServerDamage; GlobalEventManager.onClientDamageNotified += OnClientDamage; Run.onRunDestroyGlobal += delegate { Clear(); }; Stage.onStageStartGlobal += delegate { Prune(); }; Plugin.DpsEnabled.SettingChanged += delegate { if (!Plugin.DpsEnabled.Value) { Clear(); } }; } private static void Clear() { windows.Clear(); ownWindows.Clear(); } private static void OnServerDamage(DamageReport report) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) if (Plugin.DpsEnabled.Value && NetworkServer.active && report != null && report.victimTeamIndex != report.attackerTeamIndex) { AddOwn(report.attackerMaster, report.damageDealt); Add((Object.op_Implicit((Object)(object)report.attackerOwnerMaster) && Plugin.DpsIncludeMinions.Value) ? report.attackerOwnerMaster : report.attackerMaster, report.damageDealt); } } private static void OnClientDamage(DamageDealtMessage msg) { //IL_005a: 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_0081: Unknown result type (might be due to invalid IL or missing references) if (!Plugin.DpsEnabled.Value || NetworkServer.active || msg == null || !Object.op_Implicit((Object)(object)msg.attacker)) { return; } CharacterBody component = msg.attacker.GetComponent<CharacterBody>(); if (!Object.op_Implicit((Object)(object)component) || !Object.op_Implicit((Object)(object)component.master)) { return; } if (Object.op_Implicit((Object)(object)msg.victim)) { TeamIndex objectTeam = TeamComponent.GetObjectTeam(msg.victim); TeamComponent teamComponent = component.teamComponent; if ((TeamIndex?)objectTeam == ((teamComponent != null) ? new TeamIndex?(teamComponent.teamIndex) : ((TeamIndex?)null))) { return; } } CharacterMaster val = component.master; AddOwn(val, msg.damage); if (Plugin.DpsIncludeMinions.Value && Object.op_Implicit((Object)(object)val.minionOwnership) && Object.op_Implicit((Object)(object)val.minionOwnership.ownerMaster)) { val = val.minionOwnership.ownerMaster; } Add(val, msg.damage); } private static bool Valid(float dmg) { if (dmg > 0f && !float.IsInfinity(dmg)) { return !float.IsNaN(dmg); } return false; } private static void Add(CharacterMaster master, float dmg) { if (Object.op_Implicit((Object)(object)master) && Valid(dmg) && Object.op_Implicit((Object)(object)master.playerCharacterMasterController)) { Push(windows, master, dmg); } } private static void AddOwn(CharacterMaster master, float dmg) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Invalid comparison between Unknown and I4 if (Object.op_Implicit((Object)(object)master) && Valid(dmg) && (int)master.teamIndex == 1) { Push(ownWindows, master, dmg); } } private static void Push(Dictionary<CharacterMaster, Window> map, CharacterMaster master, float dmg) { if (!map.TryGetValue(master, out var value)) { value = (map[master] = new Window()); } float time = Time.time; Expire(value, time - WindowSeconds); value.Hits.Enqueue(new KeyValuePair<float, float>(time, dmg)); value.Sum += dmg; } private static void Expire(Window w, float cutoff) { while (w.Hits.Count > 0 && w.Hits.Peek().Key < cutoff) { w.Sum -= w.Hits.Dequeue().Value; } if (w.Hits.Count == 0) { w.Sum = 0f; } } public static float GetOwnDps(CharacterMaster master) { if (!Object.op_Implicit((Object)(object)master) || !ownWindows.TryGetValue(master, out var value)) { return 0f; } return Rate(value); } public static float GetDps(CharacterMaster master) { if (!Object.op_Implicit((Object)(object)master) || !windows.TryGetValue(master, out var value)) { return 0f; } return Rate(value); } private static float Rate(Window w) { float windowSeconds = WindowSeconds; Expire(w, Time.time - windowSeconds); return Mathf.Max(0f, w.Sum) / windowSeconds; } private static void Prune() { PruneMap(windows); PruneMap(ownWindows); } private static void PruneMap(Dictionary<CharacterMaster, Window> map) { scratch.Clear(); foreach (CharacterMaster key in map.Keys) { if (!Object.op_Implicit((Object)(object)key)) { scratch.Add(key); } } foreach (CharacterMaster item in scratch) { map.Remove(item); } scratch.Clear(); } public static string Format(float dps) { return NumberFormat.Format(dps, "0"); } } internal static class ItemSorter { private static readonly Dictionary<ItemTier, int> tierRank = new Dictionary<ItemTier, int>(); private const int UnlistedRank = 10000; public static void Init() { RebuildRanks(); Plugin.TierOrder.SettingChanged += delegate { RebuildRanks(); }; Plugin.SortReverse.SettingChanged += delegate { RebuildRanks(); }; } private static void RebuildRanks() { //IL_004b: 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) tierRank.Clear(); string[] array = Plugin.TierOrder.Value.Split(new char[3] { ',', ';', ' ' }, StringSplitOptions.RemoveEmptyEntries); int num = 0; string[] array2 = array; foreach (string text in array2) { if (Enum.TryParse<ItemTier>(text.Trim(), ignoreCase: true, out ItemTier result) && !tierRank.ContainsKey(result)) { tierRank[result] = num++; } else { Plugin.Log.LogWarning((object)("TierOrder: unknown or duplicate tier '" + text + "' ignored.")); } } } private static int Rank(ItemIndex idx) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) ItemDef itemDef = ItemCatalog.GetItemDef(idx); if ((Object)(object)itemDef == (Object)null) { return 10001; } int value; int num = (tierRank.TryGetValue(itemDef.tier, out value) ? value : (10000 + itemDef.tier)); if (Plugin.SortReverse.Value && num < 10000) { num = -num; } return num; } private static int Compare(ItemIndex a, ItemIndex b, int[] stacks) { //IL_0000: 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_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Invalid comparison between Unknown and I4 //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Invalid comparison between Unknown and I4 //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Invalid comparison between Unknown and I4 //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Invalid comparison between Unknown and I4 //IL_0049: Unknown result type (might be due to invalid IL or missing references) int num = Rank(a).CompareTo(Rank(b)); if (num != 0) { return num; } if (Plugin.WithinTier.Value == Plugin.WithinTierMode.StackCountDescending && stacks != null) { int value = (((int)a >= 0 && (int)a < stacks.Length) ? stacks[a] : 0); return (((int)b >= 0 && (int)b < stacks.Length) ? stacks[b] : 0).CompareTo(value); } return 0; } public static void Sort(ItemIndex[] order, int count, int[] stacks) { //IL_001a: 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_0044: Expected I4, but got Unknown //IL_0034: Unknown result type (might be due to invalid IL or missing references) if (order == null || count < 2) { return; } if (count > order.Length) { count = order.Length; } for (int i = 1; i < count; i++) { ItemIndex val = order[i]; int num = i - 1; while (num >= 0 && Compare(order[num], val, stacks) > 0) { order[num + 1] = order[num]; num--; } order[num + 1] = (ItemIndex)(int)val; } } } internal static class NumberFormat { private static readonly string[] Suffixes = new string[4] { "k", "M", "B", "T" }; public static string Format(float v, string fmt) { if (!Plugin.ShortenNumbers.Value || Math.Abs(v) < Plugin.ShortenThreshold.Value || Math.Abs(v) < 1000f) { return v.ToString(fmt); } return string.Concat(fmt.StartsWith("'x'") ? "x" : "", str2: fmt.Contains("'%'") ? "%" : "", str1: Short(v)); } public static string Short(float v) { double num = Math.Abs((double)v); if (num < 1000.0) { return v.ToString("0"); } int num2 = -1; while (num >= 1000.0 && num2 < Suffixes.Length - 1) { num /= 1000.0; num2++; } if (num >= 999.5 && num2 < Suffixes.Length - 1) { num /= 1000.0; num2++; } string text = ((num < 99.95) ? num.ToString("0.0") : num.ToString("0")); return ((v < 0f) ? "-" : "") + text + Suffixes[num2]; } } [BepInPlugin("RarityHUD", "RarityHUD", "1.0.0")] public class Plugin : BaseUnityPlugin { public enum PanelStyle { Grouped, Compact, Inline, Classic } public enum BubblePlacement { BetweenHealthAndSkills, AboveSpeaker } public enum FriendDpsMode { Off, AllyCards, Overhead, Both } public enum WithinTierMode { AcquisitionOrder, StackCountDescending } public enum ScreenSide { Left, Right } public const string Guid = "RarityHUD"; public const string Name = "RarityHUD"; public const string Version = "1.0.0"; internal static Plugin Instance; internal static ManualLogSource Log; internal static ConfigEntry<bool> SortEnabled; internal static ConfigEntry<string> TierOrder; internal static ConfigEntry<bool> SortReverse; internal static ConfigEntry<WithinTierMode> WithinTier; internal static ConfigEntry<bool> StatsEnabled; internal static ConfigEntry<ScreenSide> StatsSide; internal static ConfigEntry<float> StatsVertical; internal static ConfigEntry<float> StatsPadding; internal static ConfigEntry<float> StatsScale; internal static ConfigEntry<float> StatsOpacity; internal static ConfigEntry<string> StatsList; internal static ConfigEntry<string> StatsTitle; internal static ConfigEntry<PanelStyle> StatsPanelStyle; internal static ConfigEntry<string> StatsValueColor; internal static ConfigEntry<bool> ShowDeltas; internal static ConfigEntry<float> DeltaDuration; internal static ConfigEntry<KeyboardShortcut> ToggleKey; internal static ConfigEntry<bool> ShortenNumbers; internal static ConfigEntry<float> ShortenThreshold; internal static ConfigEntry<bool> DpsEnabled; internal static ConfigEntry<float> DpsWindow; internal static ConfigEntry<bool> DpsIncludeMinions; internal static ConfigEntry<bool> StatsInObjectives; internal static ConfigEntry<bool> StatsShortNames; internal static ConfigEntry<bool> ChatHiddenByDefault; internal static ConfigEntry<KeyboardShortcut> ChatToggleKey; internal static ConfigEntry<float> ChatDoublePressWindow; internal static ConfigEntry<bool> BossBubblesEnabled; internal static ConfigEntry<bool> BossHideFromChat; internal static ConfigEntry<float> BossBubbleScale; internal static ConfigEntry<float> BossBubbleSeconds; internal static ConfigEntry<float> BossBubbleOpacity; internal static ConfigEntry<bool> BossBubbleBlur; internal static ConfigEntry<int> BossBubbleBlurStrength; internal static ConfigEntry<bool> BubbleBlurFlip; internal static ConfigEntry<string> BubbleAccentColor; internal static ConfigEntry<bool> BossNameEffects; internal static ConfigEntry<BubblePlacement> BossBubblePlacement; internal static ConfigEntry<bool> StatsColorByType; internal static ConfigEntry<float> StatsTextScale; internal static ConfigEntry<FriendDpsMode> FriendDps; internal static ConfigEntry<float> DpsOverheadHeight; internal static ConfigEntry<float> DpsOverheadMaxDistance; internal static ConfigEntry<float> TextEffectSpeed; internal static ConfigEntry<string> MascotRobotFont; internal static ConfigEntry<string> MascotFancyFont; private float hudCheckTimer; private void Awake() { //IL_0048: 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_00f8: Expected O, but got Unknown //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Expected O, but got Unknown //IL_01c0: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Expected O, but got Unknown //IL_0325: Unknown result type (might be due to invalid IL or missing references) //IL_032f: Expected O, but got Unknown //IL_0386: Unknown result type (might be due to invalid IL or missing references) //IL_0390: Expected O, but got Unknown //IL_03c3: Unknown result type (might be due to invalid IL or missing references) //IL_03cd: Expected O, but got Unknown //IL_0484: Unknown result type (might be due to invalid IL or missing references) //IL_048e: Expected O, but got Unknown //IL_0559: Unknown result type (might be due to invalid IL or missing references) //IL_05ff: Unknown result type (might be due to invalid IL or missing references) //IL_0609: Expected O, but got Unknown //IL_06c4: Unknown result type (might be due to invalid IL or missing references) //IL_06ce: Expected O, but got Unknown //IL_072a: Unknown result type (might be due to invalid IL or missing references) Instance = this; Log = ((BaseUnityPlugin)this).Logger; ChatHiddenByDefault = ((BaseUnityPlugin)this).Config.Bind<bool>("4. Chat", "HiddenByDefault", true, "Keep the chat box hidden until you double-press the toggle key. It always shows while you're typing."); ChatToggleKey = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("4. Chat", "ToggleKey", new KeyboardShortcut((KeyCode)13, Array.Empty<KeyCode>()), "Double-press this key to show/hide the chat box."); ChatDoublePressWindow = ((BaseUnityPlugin)this).Config.Bind<float>("4. Chat", "DoublePressSeconds", 0.35f, "Max time between the two presses of a double-press."); BossBubblesEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("4. Chat", "BossSpeechBubbles", true, "Show what bosses and other NPCs say in big speech bubbles above them."); BossHideFromChat = ((BaseUnityPlugin)this).Config.Bind<bool>("4. Chat", "BossLinesOnlyInBubbles", true, "Don't also put boss/NPC lines in the chat box (only when a bubble was shown)."); BossBubbleScale = ((BaseUnityPlugin)this).Config.Bind<float>("4. Chat", "BossBubbleSize", 1f, new ConfigDescription("Size of the boss speech bubbles.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.5f, 2f), Array.Empty<object>())); BossBubbleOpacity = ((BaseUnityPlugin)this).Config.Bind<float>("4. Chat", "BossBubbleFrost", 0.45f, new ConfigDescription("Frost strength of boss speech bubbles. 0 = fully see-through.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>())); BossBubbleBlur = ((BaseUnityPlugin)this).Config.Bind<bool>("4. Chat", "BubbleBackdropBlur", true, "Blur the game world behind boss speech bubbles. Off = frosted panel only."); BubbleAccentColor = ((BaseUnityPlugin)this).Config.Bind<string>("4. Chat", "BossBubbleColor", "#a3a3a3", "Border and tint colour of boss speech bubbles, as hex (default transparent grey)."); BubbleBlurFlip = ((BaseUnityPlugin)this).Config.Bind<bool>("4. Chat", "BubbleBlurFlipVertical", false, "Turn on if the blurred backdrop inside bubbles looks upside down."); BossBubbleBlurStrength = ((BaseUnityPlugin)this).Config.Bind<int>("4. Chat", "BubbleBlurStrength", 3, new ConfigDescription("How blurry the backdrop is (1 = light, 5 = very soft).", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 5), Array.Empty<object>())); BossBubblePlacement = ((BaseUnityPlugin)this).Config.Bind<BubblePlacement>("4. Chat", "BossBubblePlacement", BubblePlacement.BetweenHealthAndSkills, "Where boss speech bubbles appear: in the free space between the health bar and the skills, or above the speaker."); BossNameEffects = ((BaseUnityPlugin)this).Config.Bind<bool>("4. Chat", "BossNameEffects", true, "Animated names in boss bubbles: Mithrix shakes, False Son waves and pulses, Alloy Hunter and Solus Heart glitch, others wave."); BossBubbleSeconds = ((BaseUnityPlugin)this).Config.Bind<float>("4. Chat", "BossBubbleSeconds", 3f, "Base time a bubble stays up (longer lines stay longer)."); SortEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("1. Item Sorting", "Enabled", true, "Sort the item bar (and scoreboard / run report) by rarity."); TierOrder = ((BaseUnityPlugin)this).Config.Bind<string>("1. Item Sorting", "TierOrder", "Tier1,Tier2,Tier3,Boss,Lunar,VoidTier1,VoidTier2,VoidTier3,VoidBoss,FoodTier,Cursed,Page,Hex,NoTier", "Comma-separated tier order, first = leftmost. Tier1=white, Tier2=green, Tier3=red, Boss=yellow. Tiers not listed (including modded tiers) go at the end."); SortReverse = ((BaseUnityPlugin)this).Config.Bind<bool>("1. Item Sorting", "Reverse", false, "Reverse the tier order (e.g. reds first)."); WithinTier = ((BaseUnityPlugin)this).Config.Bind<WithinTierMode>("1. Item Sorting", "WithinTier", WithinTierMode.AcquisitionOrder, "How items of the same tier are ordered."); StatsEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("2. Stats Panel", "Enabled", true, "Show the stats list."); StatsSide = ((BaseUnityPlugin)this).Config.Bind<ScreenSide>("2. Stats Panel", "Side", ScreenSide.Left, "Which side of the screen the panel sits on."); StatsVertical = ((BaseUnityPlugin)this).Config.Bind<float>("2. Stats Panel", "VerticalPosition", 0.58f, new ConfigDescription("0 = bottom of screen, 1 = top. Panel is centred on this point.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>())); StatsPadding = ((BaseUnityPlugin)this).Config.Bind<float>("2. Stats Panel", "EdgePadding", 24f, "Distance from the screen edge, in HUD pixels."); StatsScale = ((BaseUnityPlugin)this).Config.Bind<float>("2. Stats Panel", "Scale", 1f, new ConfigDescription("Panel size multiplier.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.5f, 3f), Array.Empty<object>())); StatsOpacity = ((BaseUnityPlugin)this).Config.Bind<float>("2. Stats Panel", "Opacity", 0.9f, new ConfigDescription("Panel opacity.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 1f), Array.Empty<object>())); StatsList = ((BaseUnityPlugin)this).Config.Bind<string>("2. Stats Panel", "Lines", "Damage,AttackSpeed,Crit,Armor,Regen,MoveSpeed,Jumps", "Comma-separated, top to bottom. Available: Damage, AttackSpeed, Crit, CritDamage, Bleed (offense); Armor, MaxHealth, Shield, Regen, MoveSpeed, Jumps (survival & mobility); Luck, Level, Kills, MountainShrines (run); DPS. DPS is added at the top automatically while DPS is enabled."); StatsPanelStyle = ((BaseUnityPlugin)this).Config.Bind<PanelStyle>("2. Stats Panel", "Style", PanelStyle.Grouped, "Look of the stats panel. Grouped = big DPS row, small group labels (Offense, Survival & Mobility, Run), values in a right-aligned column. Compact = same columns without group labels or the big DPS row. Inline = \"Damage: 41.9\", value right after its name. Classic = a \"Stats\" header with short \"Name: value\" lines (Armor: 20 | 17%, Jumps: 1/2)."); StatsInObjectives = ((BaseUnityPlugin)this).Config.Bind<bool>("2. Stats Panel", "InsideObjectives", true, "Show the stats inside the game's objective panel, under its own heading. Off = a separate list on the side of the screen."); StatsShortNames = ((BaseUnityPlugin)this).Config.Bind<bool>("2. Stats Panel", "ShortNames", true, "Use short names (Atk Speed, Crit, Max HP...) to keep the list compact."); StatsTextScale = ((BaseUnityPlugin)this).Config.Bind<float>("2. Stats Panel", "TextSize", 0.8f, new ConfigDescription("Size of the stat lines relative to objective text.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.5f, 1.5f), Array.Empty<object>())); StatsTitle = ((BaseUnityPlugin)this).Config.Bind<string>("2. Stats Panel", "SectionTitle", "", "Optional header above the stats. Empty = a thin divider line instead (or \"Stats\" in the Classic style)."); StatsColorByType = ((BaseUnityPlugin)this).Config.Bind<bool>("2. Stats Panel", "ColorByType", true, "Colour values by type: gold = offense, blue = defense/utility, green = healing, red = counters, orange = DPS. Off = use ValueColor for all."); StatsValueColor = ((BaseUnityPlugin)this).Config.Bind<string>("2. Stats Panel", "ValueColor", "#ff6b6b", "Colour of the stat values (hex). Default matches the red highlight the objective text uses."); ShowDeltas = ((BaseUnityPlugin)this).Config.Bind<bool>("2. Stats Panel", "ShowChanges", true, "Briefly show +/- next to a stat when it changes."); DeltaDuration = ((BaseUnityPlugin)this).Config.Bind<float>("2. Stats Panel", "ChangeDisplaySeconds", 2.5f, "How long the +/- change indicator stays visible."); ToggleKey = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("2. Stats Panel", "ToggleKey", new KeyboardShortcut((KeyCode)288, Array.Empty<KeyCode>()), "Key to show/hide the stats panel in-game."); ShortenNumbers = ((BaseUnityPlugin)this).Config.Bind<bool>("2. Stats Panel", "ShortenNumbers", true, "Shorten big numbers: 1234 -> 1.2k, 1500000 -> 1.5M. Applies to stats, +/- changes and DPS."); ShortenThreshold = ((BaseUnityPlugin)this).Config.Bind<float>("2. Stats Panel", "ShortenFrom", 1000f, "Numbers at or above this get shortened (minimum 1000)."); DpsEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("3. DPS", "Enabled", true, "Track and show DPS for you and other players."); DpsWindow = ((BaseUnityPlugin)this).Config.Bind<float>("3. DPS", "WindowSeconds", 5f, new ConfigDescription("DPS is averaged over this many seconds.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.5f, 60f), Array.Empty<object>())); DpsIncludeMinions = ((BaseUnityPlugin)this).Config.Bind<bool>("3. DPS", "IncludeMinions", true, "Count damage from drones, turrets and other minions towards their owner."); FriendDps = ((BaseUnityPlugin)this).Config.Bind<FriendDpsMode>("3. DPS", "FriendDps", FriendDpsMode.Both, "Where teammates' DPS is shown: next to their ally cards on the left of the HUD, floating above their characters, both, or off."); DpsOverheadHeight = ((BaseUnityPlugin)this).Config.Bind<float>("3. DPS", "OverheadExtraHeight", 0f, "Extra height (metres) for the floating DPS label above teammates."); DpsOverheadMaxDistance = ((BaseUnityPlugin)this).Config.Bind<float>("3. DPS", "OverheadMaxDistance", 0f, "Hide floating labels for teammates further than this (metres). 0 = no limit."); TextEffectSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("4. Chat", "TextEffectSpeed", 0.45f, new ConfigDescription("How fast the animated boss names move. 1 = original speed.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 2f), Array.Empty<object>())); MascotRobotFont = ((BaseUnityPlugin)this).Config.Bind<string>("4. Chat", "RobotFont", "", "Font used for {robot} text. Empty = pick a monospace font automatically. Available font names are listed in the BepInEx log."); MascotFancyFont = ((BaseUnityPlugin)this).Config.Bind<string>("4. Chat", "FancyFont", "", "Font used for {fancy} text. Empty = pick automatically. Available font names are listed in the BepInEx log."); ItemSorter.Init(); DpsTracker.Init(); new Harmony("RarityHUD").PatchAll(typeof(Patches)); Log.LogInfo((object)"RarityHUD 1.0.0 loaded."); } private void Update() { hudCheckTimer -= Time.unscaledDeltaTime; if (hudCheckTimer > 0f) { return; } hudCheckTimer = 1f; try { foreach (HUD readOnlyInstance in HUD.readOnlyInstanceList) { Attacher.AttachAll(readOnlyInstance); } } catch (Exception e) { Attacher.ErrorOnce("HUD check", e); } } } [HarmonyPatch] internal static class Patches { [HarmonyPrefix] [HarmonyPatch(typeof(ItemInventoryDisplay), "UpdateDisplay")] private static void SortBeforeDisplay(ItemIndex[] ___itemOrder, int ___itemOrderCount, int[] ___itemStacks) { if (!Plugin.SortEnabled.Value) { return; } try { ItemSorter.Sort(___itemOrder, ___itemOrderCount, ___itemStacks); } catch (Exception ex) { Plugin.Log.LogError((object)("Item sort failed: " + ex)); } } [HarmonyPrefix] [HarmonyPatch(typeof(Chat), "AddMessage", new Type[] { typeof(ChatMessageBase) })] private static bool NpcLineToBubble(ChatMessageBase message) { if (Plugin.BossBubblesEnabled.Value) { NpcChatMessage val = (NpcChatMessage)(object)((message is NpcChatMessage) ? message : null); if (val != null) { try { string line = Language.GetString(val.baseToken); string text = (Object.op_Implicit((Object)(object)val.sender) ? Util.GetBestBodyName(val.sender) : ""); if (string.IsNullOrWhiteSpace(text)) { text = NameFromToken(val.baseToken); } text = Regex.Replace(text ?? "", "<.*?>", "").Trim(); if (!BossBubbles.Show(val.sender, text, line) || !Plugin.BossHideFromChat.Value) { return true; } try { ((ChatMessageBase)val).OnProcessed(); } catch (Exception e) { Attacher.ErrorOnce("Boss line sound", e); } return false; } catch (Exception e2) { Attacher.ErrorOnce("Boss bubbles", e2); return true; } } } return true; } private static string NameFromToken(string token) { if (string.IsNullOrEmpty(token)) { return ""; } string[] array = token.Split('_'); for (int num = array.Length - 1; num >= 1; num--) { string text = string.Join("_", array, 0, num) + "_BODY_NAME"; string text2 = Language.GetString(text); if (!string.IsNullOrEmpty(text2) && text2 != text) { return text2; } } return ""; } [HarmonyPostfix] [HarmonyPatch(typeof(HUD), "Awake")] private static void AttachStatsPanel(HUD __instance) { Attacher.AttachAll(__instance); } } internal class StatsPanel : MonoBehaviour { private enum Kind { Offense, Defense, Sustain, Utility, Counter, Dps } private enum Group { Lead, Offense, Survival, Run } private class StatDef { public string Key; public string Name; public string Short; public string Format; public string Suffix = ""; public string DeltaSuffix = ""; public Kind Kind; public Group Group; public Func<CharacterBody, float> Get; public Func<CharacterBody, float, string> Show; public bool NoDelta; public Func<float, string> Custom; public string ClassicShort; public string ClassicSuffix; public Func<CharacterBody, float, string> ClassicShow; } private class Row { public StatDef Def; public GameObject Go; public TextMeshProUGUI Name; public TextMeshProUGUI Value; public TextMeshProUGUI Delta; public float Last = float.NaN; public float PendingDelta; public float DeltaTimer; } private class Style { public TMP_FontAsset HeaderFont; public TMP_FontAsset RowFont; public float HeaderSize = 20f; public float RowSize = 17f; public Color HeaderColor = Color.white; public Color RowColor = new Color(0.9f, 0.9f, 0.9f); public FontStyles HeaderStyle; public Material HeaderMat; public Material RowMat; } private static readonly Dictionary<Group, string> GroupTitles = new Dictionary<Group, string> { { Group.Offense, "Offense" }, { Group.Survival, "Survival & Mobility" }, { Group.Run, "Run" } }; private static readonly StatDef DpsStat = new StatDef { Key = "DPS", Name = "DPS", Short = "DPS", Format = "0", Kind = Kind.Dps, Group = Group.Lead, NoDelta = true, Get = (CharacterBody b) => DpsTracker.GetDps(b.master), Custom = DpsTracker.Format }; private static readonly List<StatDef> AllStats = new List<StatDef> { new StatDef { Key = "Damage", Name = "Damage", Short = "Damage", Format = "0.0", Kind = Kind.Offense, Group = Group.Offense, Get = (CharacterBody b) => b.damage }, new StatDef { Key = "AttackSpeed", Name = "Attack Speed", Short = "Atk Speed", Format = "0.00", Kind = Kind.Offense, Group = Group.Offense, Suffix = "x", DeltaSuffix = "x", Get = (CharacterBody b) => b.attackSpeed }, new StatDef { Key = "Crit", Name = "Crit Chance", Short = "Crit", Format = "0", Kind = Kind.Offense, Group = Group.Offense, Suffix = "%", DeltaSuffix = "%", Get = (CharacterBody b) => b.crit }, new StatDef { Key = "CritDamage", Name = "Crit Damage", Short = "Crit Dmg", Format = "0.0", Kind = Kind.Offense, Group = Group.Offense, Suffix = "x", DeltaSuffix = "x", Get = (CharacterBody b) => b.critMultiplier }, new StatDef { Key = "Bleed", Name = "Bleed Chance", Short = "Bleed", Format = "0", Kind = Kind.Offense, Group = Group.Offense, Suffix = "%", DeltaSuffix = "%", Get = (CharacterBody b) => b.bleedChance }, new StatDef { Key = "Armor", Name = "Armor", Short = "Armor", Format = "0", Kind = Kind.Defense, Group = Group.Survival, Get = (CharacterBody b) => b.armor, Show = (CharacterBody b, float v) => ArmorText(v), ClassicShow = (CharacterBody b, float v) => ArmorClassic(v) }, new StatDef { Key = "MaxHealth", Name = "Max Health", Short = "Max HP", Format = "0", Kind = Kind.Defense, Group = Group.Survival, Get = (CharacterBody b) => b.maxHealth }, new StatDef { Key = "Shield", Name = "Shield", Short = "Shield", Format = "0", Kind = Kind.Defense, Group = Group.Survival, Get = (CharacterBody b) => b.maxShield }, new StatDef { Key = "Regen", Name = "Regen", Short = "Regen", Format = "0.0", Kind = Kind.Sustain, Group = Group.Survival, Suffix = " HP/s", DeltaSuffix = "/s", ClassicSuffix = "/s", Get = (CharacterBody b) => b.regen }, new StatDef { Key = "MoveSpeed", Name = "Move Speed", Short = "Move Speed", Format = "0.0", Kind = Kind.Utility, Group = Group.Survival, Suffix = " m/s", ClassicShort = "Speed", ClassicSuffix = "", Get = (CharacterBody b) => b.moveSpeed }, new StatDef { Key = "Jumps", Name = "Jumps Left", Short = "Jumps left", Format = "0", Kind = Kind.Utility, Group = Group.Survival, NoDelta = true, Get = (CharacterBody b) => Mathf.Max(0, b.maxJumpCount - (Object.op_Implicit((Object)(object)b.characterMotor) ? b.characterMotor.jumpCount : 0)), Show = (CharacterBody b, float v) => $"{v:0} of {b.maxJumpCount}", ClassicShort = "Jumps", ClassicShow = (CharacterBody b, float v) => $"{v:0}/{b.maxJumpCount}" }, new StatDef { Key = "Luck", Name = "Luck", Short = "Luck", Format = "0", Kind = Kind.Utility, Group = Group.Run, Get = (CharacterBody b) => (!Object.op_Implicit((Object)(object)b.master)) ? 0f : b.master.luck }, new StatDef { Key = "Level", Name = "Level", Short = "Level", Format = "0", Kind = Kind.Utility, Group = Group.Run, Get = (CharacterBody b) => b.level }, new StatDef { Key = "Kills", Name = "Kills", Short = "Kills", Format = "0", Kind = Kind.Counter, Group = Group.Run, NoDelta = true, Get = Kills }, new StatDef { Key = "MountainShrines", Name = "Mountain Shrines", Short = "Mountain Shrines", Format = "0", Kind = Kind.Counter, Group = Group.Run, Get = (CharacterBody b) => (!Object.op_Implicit((Object)(object)TeleporterInteraction.instance)) ? 0f : ((float)TeleporterInteraction.instance.shrineBonusStacks) }, DpsStat }; private static readonly Dictionary<Kind, Color> KindColors = new Dictionary<Kind, Color> { { Kind.Offense, new Color(1f, 0.82f, 0.42f) }, { Kind.Defense, new Color(0.56f, 0.83f, 1f) }, { Kind.Sustain, new Color(0.55f, 1f, 0.55f) }, { Kind.Utility, new Color(0.56f, 0.83f, 1f) }, { Kind.Counter, new Color(1f, 0.48f, 0.42f) }, { Kind.Dps, new Color(1f, 0.62f, 0.26f) } }; private static readonly Color Good = new Color(0.45f, 1f, 0.45f); private static readonly Color Bad = new Color(1f, 0.4f, 0.4f); private HUD hud; private RectTransform root; private RectTransform rowContainer; private CanvasGroup group; private TextMeshProUGUI header; private Style style; private readonly List<Row> rows = new List<Row>(); private readonly List<GameObject> extras = new List<GameObject>(); private CharacterBody lastBody; private float pollTimer; private bool userHidden; private const float Width = 270f; private bool embedded; private static Style cachedStyle; private bool built; private GameObject topDivider; private CharacterBody textBody; private static bool Classic => Plugin.StatsPanelStyle.Value == Plugin.PanelStyle.Classic; private float RowSize => style.RowSize * Plugin.StatsTextScale.Value; private static string ArmorClassic(float armor) { float num = ((armor >= 0f) ? (armor / (100f + armor) * 100f) : ((0f - (1f - 100f / (100f - armor))) * 100f)); return string.Format("{0} | {1:0}%", NumberFormat.Format(armor, "0"), num); } private static string ArmorText(float armor) { string arg = NumberFormat.Format(armor, "0"); if (armor >= 0f) { return $"{arg} ({armor / (100f + armor) * 100f:0}% reduction)"; } float num = (1f - 100f / (100f - armor)) * 100f; return $"{arg} ({num:0}% more damage)"; } private static float Kills(CharacterBody b) { StatSheet val = ((Object.op_Implicit((Object)(object)b.master) && Object.op_Implicit((Object)(object)b.master.playerStatsComponent)) ? b.master.playerStatsComponent.currentStats : null); if (val == null) { return 0f; } return val.GetStatValueULong(StatDef.totalKills); } private static Color ColorFor(StatDef d) { //IL_0020: 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 (!Plugin.StatsColorByType.Value || !KindColors.TryGetValue(d.Kind, out var value)) { return ValueColor(); } return value; } public static void Attach(HUD hud) { //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)hud) || !Object.op_Implicit((Object)(object)hud.mainContainer)) { return; } Transform val = hud.mainContainer.transform; bool flag = false; if (Plugin.StatsInObjectives.Value) { ObjectivePanelController componentInChildren = ((Component)hud).GetComponentInChildren<ObjectivePanelController>(true); if (Object.op_Implicit((Object)(object)componentInChildren) && Object.op_Implicit((Object)(object)componentInChildren.objectiveTrackerContainer)) { val = (Transform)(object)componentInChildren.objectiveTrackerContainer; flag = true; } else { Plugin.Log.LogWarning((object)"Objective panel not found; sho