using System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Text; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using TMPro; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.SceneManagement; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("DamageMeterExtended")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("DamageMeterExtended")] [assembly: AssemblyCopyright("Copyright © 2025")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("270aebea-c90a-4ad5-b6e1-e3b046c8758a")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("1.0.0.0")] [BepInPlugin("Scallorn-Dev-Judah.SimpleDamageMeter", "Damage Meter Tracker", "0.1.1")] public class DPSMeterPlugin : BaseUnityPlugin { internal static ConfigEntry PosX; internal static ConfigEntry PosY; internal static ConfigEntry Width; internal static ConfigEntry Height; internal static ConfigEntry ResetHotkey; internal static DPSMeterPlugin Instance { get; private set; } private void Awake() { //IL_00af: 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_00ce: Expected O, but got Unknown //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Expected O, but got Unknown Instance = this; PosX = ((BaseUnityPlugin)this).Config.Bind("UI", "PosX", 550f, "Meter X position"); PosY = ((BaseUnityPlugin)this).Config.Bind("UI", "PosY", -10f, "Meter Y position"); Width = ((BaseUnityPlugin)this).Config.Bind("UI", "Width", 260f, "Meter width"); Height = ((BaseUnityPlugin)this).Config.Bind("UI", "Height", 120f, "Meter height"); ResetHotkey = ((BaseUnityPlugin)this).Config.Bind("Controls", "ResetHotkey", new KeyboardShortcut((KeyCode)104, Array.Empty()), "Reset counters hotkey"); Harmony val = new Harmony("com.Judah.dpsmod"); val.PatchAll(); GameObject val2 = new GameObject("CombatLogDPSUpdater"); val2.AddComponent(); Object.DontDestroyOnLoad((Object)(object)val2); } } public static class CombatCounters { public static Dictionary ByName = new Dictionary(); public static void AddDamage(string who, long dmg) { if (ByName.ContainsKey(who)) { ByName[who] += dmg; } else { ByName[who] = dmg; } } public static void Reset() { ByName.Clear(); } } [HarmonyPatch(typeof(Character), "CreditDPS")] internal static class CreditDPS_Patch { private static void Postfix(int _incDmg, Character __instance) { if (_incDmg > 0) { string text = __instance?.MyStats?.MyName; if (!string.IsNullOrEmpty(text) && IsPartyMember(__instance)) { CombatCounters.AddDamage(text, _incDmg); } } } private static bool IsPartyMember(Character c) { string myName = c.MyStats.MyName; if (GameData.PlayerStats?.MyName == myName) { return true; } if (GameData.GroupMember1?.MyAvatar?.MyStats?.MyName == myName) { return true; } if (GameData.GroupMember2?.MyAvatar?.MyStats?.MyName == myName) { return true; } if (GameData.GroupMember3?.MyAvatar?.MyStats?.MyName == myName) { return true; } return false; } } public class DPSUpdater : MonoBehaviour { private TextMeshProUGUI _headerLabel; private TextMeshProUGUI _nameColumn; private TextMeshProUGUI _valueColumn; private GameObject _container; private float _timer; private void Start() { SceneManager.sceneLoaded += delegate { TryAttachUI(); }; TryAttachUI(); } private void Update() { //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) _timer += Time.deltaTime; if (_timer >= 1f) { _timer = 0f; RefreshUI(); } KeyboardShortcut value = DPSMeterPlugin.ResetHotkey.Value; if (((KeyboardShortcut)(ref value)).IsDown()) { CombatCounters.Reset(); RefreshUI(); Debug.Log((object)"[CombatLogDPS] Fully reset."); } } private void TryAttachUI() { //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Expected O, but got Unknown //IL_00b0: 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_00d6: 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_0113: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_019f: 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_01cb: Unknown result type (might be due to invalid IL or missing references) //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_01e9: 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_0215: Unknown result type (might be due to invalid IL or missing references) //IL_0224: Unknown result type (might be due to invalid IL or missing references) //IL_0233: Unknown result type (might be due to invalid IL or missing references) //IL_0250: 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_026e: Unknown result type (might be due to invalid IL or missing references) //IL_027d: Unknown result type (might be due to invalid IL or missing references) //IL_02a3: Unknown result type (might be due to invalid IL or missing references) //IL_02aa: Expected O, but got Unknown //IL_02e8: Unknown result type (might be due to invalid IL or missing references) //IL_02ed: Unknown result type (might be due to invalid IL or missing references) //IL_0322: Unknown result type (might be due to invalid IL or missing references) //IL_0339: Unknown result type (might be due to invalid IL or missing references) //IL_0350: Unknown result type (might be due to invalid IL or missing references) //IL_0367: Unknown result type (might be due to invalid IL or missing references) //IL_037e: Unknown result type (might be due to invalid IL or missing references) //IL_03a1: Unknown result type (might be due to invalid IL or missing references) //IL_03a8: Expected O, but got Unknown //IL_03e6: Unknown result type (might be due to invalid IL or missing references) //IL_03eb: Unknown result type (might be due to invalid IL or missing references) //IL_042b: Unknown result type (might be due to invalid IL or missing references) //IL_0433: Unknown result type (might be due to invalid IL or missing references) //IL_0435: Unknown result type (might be due to invalid IL or missing references) //IL_0436: Unknown result type (might be due to invalid IL or missing references) //IL_043e: Unknown result type (might be due to invalid IL or missing references) //IL_0452: Unknown result type (might be due to invalid IL or missing references) //IL_0469: Unknown result type (might be due to invalid IL or missing references) //IL_048c: Unknown result type (might be due to invalid IL or missing references) //IL_0493: Expected O, but got Unknown //IL_04d1: Unknown result type (might be due to invalid IL or missing references) //IL_04d6: Unknown result type (might be due to invalid IL or missing references) //IL_0516: Unknown result type (might be due to invalid IL or missing references) //IL_051e: Unknown result type (might be due to invalid IL or missing references) //IL_0520: Unknown result type (might be due to invalid IL or missing references) //IL_0521: Unknown result type (might be due to invalid IL or missing references) //IL_0529: Unknown result type (might be due to invalid IL or missing references) //IL_053d: Unknown result type (might be due to invalid IL or missing references) //IL_0554: Unknown result type (might be due to invalid IL or missing references) //IL_0591: Unknown result type (might be due to invalid IL or missing references) //IL_0598: Expected O, but got Unknown //IL_05cc: Unknown result type (might be due to invalid IL or missing references) //IL_05d1: Unknown result type (might be due to invalid IL or missing references) //IL_05fa: Unknown result type (might be due to invalid IL or missing references) //IL_0602: Unknown result type (might be due to invalid IL or missing references) //IL_0616: Unknown result type (might be due to invalid IL or missing references) //IL_062d: Unknown result type (might be due to invalid IL or missing references) //IL_0644: Unknown result type (might be due to invalid IL or missing references) Color32 borderColor; if (!((Object)(object)_container != (Object)null)) { Canvas val = Object.FindObjectOfType(); if ((Object)(object)val == (Object)null) { Debug.LogWarning((object)"No Canvas found for DPS meter."); return; } _container = new GameObject("CombatLogContainer", new Type[3] { typeof(RectTransform), typeof(UIDragHandler), typeof(Image) }); _container.transform.SetParent(((Component)val).transform, false); RectTransform component = _container.GetComponent(); component.pivot = new Vector2(0f, 1f); Vector2 val2 = default(Vector2); ((Vector2)(ref val2))..ctor(0f, 1f); component.anchorMax = val2; component.anchorMin = val2; component.anchoredPosition = new Vector2(DPSMeterPlugin.PosX.Value, DPSMeterPlugin.PosY.Value); component.sizeDelta = new Vector2(DPSMeterPlugin.Width.Value, DPSMeterPlugin.Height.Value); Image component2 = _container.GetComponent(); ((Graphic)component2).color = new Color(0f, 0f, 0f, 0.25f); borderColor = new Color32((byte)0, byte.MaxValue, (byte)0, byte.MaxValue); CreateBorder("BorderTop", new Vector2(0f, 1f), new Vector2(1f, 1f), new Vector2(0.5f, 1f), new Vector2(0f, 2f)); CreateBorder("BorderBottom", new Vector2(0f, 0f), new Vector2(1f, 0f), new Vector2(0.5f, 0f), new Vector2(0f, 2f)); CreateBorder("BorderLeft", new Vector2(0f, 0f), new Vector2(0f, 1f), new Vector2(0f, 0.5f), new Vector2(2f, 0f)); CreateBorder("BorderRight", new Vector2(1f, 0f), new Vector2(1f, 1f), new Vector2(1f, 0.5f), new Vector2(2f, 0f)); GameObject val3 = new GameObject("HeaderLabel", new Type[1] { typeof(RectTransform) }); val3.transform.SetParent(_container.transform, false); _headerLabel = val3.AddComponent(); ((TMP_Text)_headerLabel).fontSize = 16f; ((Graphic)_headerLabel).color = Color32.op_Implicit(borderColor); ((TMP_Text)_headerLabel).alignment = (TextAlignmentOptions)258; RectTransform rectTransform = ((TMP_Text)_headerLabel).rectTransform; rectTransform.pivot = new Vector2(0.5f, 1f); rectTransform.anchorMin = new Vector2(0f, 1f); rectTransform.anchorMax = new Vector2(1f, 1f); rectTransform.anchoredPosition = new Vector2(0f, -4f); rectTransform.sizeDelta = new Vector2(0f, 20f); GameObject val4 = new GameObject("NameColumn", new Type[1] { typeof(RectTransform) }); val4.transform.SetParent(_container.transform, false); _nameColumn = val4.AddComponent(); ((TMP_Text)_nameColumn).fontSize = 16f; ((Graphic)_nameColumn).color = Color32.op_Implicit(borderColor); ((TMP_Text)_nameColumn).alignment = (TextAlignmentOptions)257; RectTransform rectTransform2 = ((TMP_Text)_nameColumn).rectTransform; Vector2 val5 = default(Vector2); ((Vector2)(ref val5))..ctor(0f, 1f); rectTransform2.anchorMax = val5; val2 = (rectTransform2.pivot = (rectTransform2.anchorMin = val5)); rectTransform2.anchoredPosition = new Vector2(10f, -28f); rectTransform2.sizeDelta = new Vector2(100f, 0f); GameObject val8 = new GameObject("ValueColumn", new Type[1] { typeof(RectTransform) }); val8.transform.SetParent(_container.transform, false); _valueColumn = val8.AddComponent(); ((TMP_Text)_valueColumn).fontSize = 16f; ((Graphic)_valueColumn).color = Color32.op_Implicit(borderColor); ((TMP_Text)_valueColumn).alignment = (TextAlignmentOptions)257; RectTransform rectTransform3 = ((TMP_Text)_valueColumn).rectTransform; ((Vector2)(ref val5))..ctor(0f, 1f); rectTransform3.anchorMax = val5; val2 = (rectTransform3.pivot = (rectTransform3.anchorMin = val5)); rectTransform3.anchoredPosition = new Vector2(100f, -28f); rectTransform3.sizeDelta = new Vector2(100f, 0f); GameObject val11 = new GameObject("ResizeHandle", new Type[3] { typeof(RectTransform), typeof(Image), typeof(UIDragResizer) }); val11.transform.SetParent(_container.transform, false); Image component3 = val11.GetComponent(); ((Graphic)component3).color = Color32.op_Implicit(new Color32((byte)0, (byte)128, byte.MaxValue, (byte)200)); RectTransform component4 = val11.GetComponent(); ((Vector2)(ref val2))..ctor(1f, 0f); component4.anchorMax = val2; component4.anchorMin = val2; component4.pivot = new Vector2(1f, 0f); component4.sizeDelta = new Vector2(12f, 12f); component4.anchoredPosition = new Vector2(-4f, 4f); RefreshUI(); } void CreateBorder(string name, Vector2 aMin, Vector2 aMax, Vector2 pivot, Vector2 sizeDelta) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Expected O, but got Unknown //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0062: 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_0072: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) GameObject val12 = new GameObject(name, new Type[2] { typeof(RectTransform), typeof(Image) }); val12.transform.SetParent(_container.transform, false); Image component5 = val12.GetComponent(); ((Graphic)component5).color = Color32.op_Implicit(borderColor); RectTransform component6 = val12.GetComponent(); component6.anchorMin = aMin; component6.anchorMax = aMax; component6.pivot = pivot; component6.sizeDelta = sizeDelta; component6.anchoredPosition = Vector2.zero; } } private void RefreshUI() { if ((Object)(object)_headerLabel == (Object)null) { return; } ((TMP_Text)_headerLabel).text = "[Damage Done]"; StringBuilder stringBuilder = new StringBuilder(); StringBuilder stringBuilder2 = new StringBuilder(); foreach (KeyValuePair item in CombatCounters.ByName) { stringBuilder.AppendLine(item.Key + ":"); stringBuilder2.AppendLine($"{item.Value:N0}"); } ((TMP_Text)_nameColumn).text = stringBuilder.ToString(); ((TMP_Text)_valueColumn).text = stringBuilder2.ToString(); } } public class UIDragHandler : MonoBehaviour, IPointerDownHandler, IEventSystemHandler, IDragHandler { private Vector2 _offs; private RectTransform _rt; private void Awake() { _rt = ((Component)this).GetComponent(); } public void OnPointerDown(PointerEventData e) { //IL_0034: 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_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_0059: Unknown result type (might be due to invalid IL or missing references) if (Input.GetKey((KeyCode)304) || Input.GetKey((KeyCode)303)) { Transform parent = ((Transform)_rt).parent; Vector2 val = default(Vector2); RectTransformUtility.ScreenPointToLocalPointInRectangle((RectTransform)(object)((parent is RectTransform) ? parent : null), e.position, e.pressEventCamera, ref val); _offs = _rt.anchoredPosition - val; } } public void OnDrag(PointerEventData e) { //IL_0037: 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_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) Vector2 val = default(Vector2); if ((Input.GetKey((KeyCode)304) || Input.GetKey((KeyCode)303)) && RectTransformUtility.ScreenPointToLocalPointInRectangle((RectTransform)/*isinst with value type is only supported in some contexts*/, e.position, e.pressEventCamera, ref val)) { _rt.anchoredPosition = val + _offs; DPSMeterPlugin.PosX.Value = _rt.anchoredPosition.x; DPSMeterPlugin.PosY.Value = _rt.anchoredPosition.y; ((BaseUnityPlugin)DPSMeterPlugin.Instance).Config.Save(); } } } public class UIDragResizer : MonoBehaviour, IDragHandler, IEventSystemHandler { private bool _inited; private Vector2 _startSize; private Vector2 _startPointer; private RectTransform _parent; public void OnDrag(PointerEventData e) { //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //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_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) if (Input.GetKey((KeyCode)304) || Input.GetKey((KeyCode)303)) { if (!_inited) { ref RectTransform parent = ref _parent; Transform parent2 = ((Component)this).transform.parent; parent = (RectTransform)(object)((parent2 is RectTransform) ? parent2 : null); RectTransformUtility.ScreenPointToLocalPointInRectangle(_parent, e.position, e.pressEventCamera, ref _startPointer); _startSize = _parent.sizeDelta; _inited = true; } Vector2 val = default(Vector2); RectTransformUtility.ScreenPointToLocalPointInRectangle(_parent, e.position, e.pressEventCamera, ref val); Vector2 val2 = val - _startPointer; float num = Mathf.Max(60f, _startSize.x + val2.x); float num2 = Mathf.Max(40f, _startSize.y - val2.y); _parent.sizeDelta = new Vector2(num, num2); DPSMeterPlugin.Width.Value = num; DPSMeterPlugin.Height.Value = num2; ((BaseUnityPlugin)DPSMeterPlugin.Instance).Config.Save(); } } }