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 DPSMeter v1.1.5
plugins/DPSMeter/DPSMeter.dll
Decompiled 2 days agousing System; using System.CodeDom.Compiler; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Diagnostics; using System.Drawing; using System.Drawing.Imaging; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using DPSMeter.Properties; using HarmonyLib; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using RiskOfOptions; using RiskOfOptions.OptionConfigs; using RiskOfOptions.Options; using RoR2; using RoR2.ConVar; using RoR2.UI; using TMPro; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.Events; 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("DPSMeter")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("DPSMeter")] [assembly: AssemblyCopyright("Copyright © 2024")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("c9836844-3885-4cd3-b034-12e8a2a55709")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.0.0.0")] namespace DPSMeter { [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("bulletbot.dpsmeter", "DPSMeter", "1.1.5")] public class Plugin : BaseUnityPlugin { private class ColorJsonConverter : JsonConverter { public override bool CanConvert(Type objectType) { return objectType == typeof(Color); } public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) { return null; } public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) writer.WriteValue("#" + ColorUtility.ToHtmlStringRGBA((Color)value)); } } private static class RiskOfOptions { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static UnityAction <>9__2_0; internal void <OnAwake>b__2_0() { //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_030b: Unknown result type (might be due to invalid IL or missing references) //IL_0310: Unknown result type (might be due to invalid IL or missing references) //IL_0340: Unknown result type (might be due to invalid IL or missing references) //IL_0347: Expected O, but got Unknown if (!Directory.Exists(instance.presetsPath)) { Directory.CreateDirectory(instance.presetsPath); } int num = 0; Regex regex = new Regex("Preset(\\d+)\\.json"); string[] files = Directory.GetFiles(instance.presetsPath, "Preset*.json"); foreach (string path in files) { if (File.Exists(path)) { Match match = regex.Match(Path.GetFileName(path)); if (match.Success && int.TryParse(match.Groups[1].Value, out var result) && result > num) { num = result; } } } string text = $"Preset{num + 1}"; Preset preset = new Preset(text) { timeSpan = instance.timeSpan.Value, calculationMode = instance.calculationMode.Value, toggleVisibility = instance.toggleVisibility.Value, isVisible = instance.isVisible.Value, hideWhenChatboxActive = instance.hideWhenChatboxActive.Value, hideBackground = instance.hideBackground.Value, backgroundColor = instance.backgroundColor.Value, hudScaling = instance.hudScaling.Value, parent = instance.parent.Value, sizeX = instance.sizeX.Value, sizeY = instance.sizeY.Value, anglesX = instance.anglesX.Value, anglesY = instance.anglesY.Value, anglesZ = instance.anglesZ.Value, pivotX = instance.pivotX.Value, pivotY = instance.pivotY.Value, anchorPositionX = instance.anchorPositionX.Value, anchorPositionY = instance.anchorPositionY.Value, anchorMinX = instance.anchorMinX.Value, anchorMinY = instance.anchorMinY.Value, anchorMaxX = instance.anchorMaxX.Value, anchorMaxY = instance.anchorMaxY.Value, textFormat = instance.textFormat.Value, textSpacingX = instance.textSpacingX.Value, textSpacingY = instance.textSpacingY.Value, textAlignment = instance.textAlignment.Value, textColor = instance.textColor.Value, useCommas = instance.useCommas.Value, useWholeNumbers = instance.useWholeNumbers.Value }; JsonSerializerSettings val = new JsonSerializerSettings(); val.Converters.Add((JsonConverter)(object)new ColorJsonConverter()); File.WriteAllText(Path.Combine(instance.presetsPath, text + ".json"), JsonConvert.SerializeObject((object)preset, (Formatting)1, val)); instance.logger.LogMessage((object)("Preset successfully exported: \"" + text + "\"")); } } public const string modGUID = "com.rune580.riskofoptions"; public static bool IsLoaded() { return Chainloader.PluginInfos.ContainsKey("com.rune580.riskofoptions"); } public static void OnAwake() { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown //IL_0064: 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_0091: 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_00a1: 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_00b8: Expected O, but got Unknown //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_00c5: Expected O, but got Unknown //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Expected O, but got Unknown //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Expected O, but got Unknown //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Expected O, but got Unknown //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Expected O, but got Unknown //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Expected O, but got Unknown //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Expected O, but got Unknown //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Expected O, but got Unknown //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Expected O, but got Unknown //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Expected O, but got Unknown //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Expected O, but got Unknown //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Expected O, but got Unknown //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01c1: Expected O, but got Unknown //IL_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: Expected O, but got Unknown //IL_01e1: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: Expected O, but got Unknown //IL_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_0201: Expected O, but got Unknown //IL_020d: Unknown result type (might be due to invalid IL or missing references) //IL_0217: Expected O, but got Unknown //IL_0222: Unknown result type (might be due to invalid IL or missing references) //IL_022c: Expected O, but got Unknown //IL_0237: Unknown result type (might be due to invalid IL or missing references) //IL_0241: Expected O, but got Unknown //IL_024d: Unknown result type (might be due to invalid IL or missing references) //IL_0257: Expected O, but got Unknown //IL_0263: Unknown result type (might be due to invalid IL or missing references) //IL_026d: Expected O, but got Unknown //IL_0279: Unknown result type (might be due to invalid IL or missing references) //IL_0283: Expected O, but got Unknown //IL_028f: Unknown result type (might be due to invalid IL or missing references) //IL_0299: Expected O, but got Unknown //IL_02a5: Unknown result type (might be due to invalid IL or missing references) //IL_02af: Expected O, but got Unknown //IL_02ba: Unknown result type (might be due to invalid IL or missing references) //IL_02c4: Expected O, but got Unknown //IL_02cf: Unknown result type (might be due to invalid IL or missing references) //IL_02d9: Expected O, but got Unknown //IL_02e4: Unknown result type (might be due to invalid IL or missing references) //IL_02ee: Expected O, but got Unknown //IL_02f9: Unknown result type (might be due to invalid IL or missing references) //IL_0303: Expected O, but got Unknown //IL_030e: Unknown result type (might be due to invalid IL or missing references) //IL_0318: Expected O, but got Unknown //IL_0323: Unknown result type (might be due to invalid IL or missing references) //IL_032d: Expected O, but got Unknown //IL_0361: Unknown result type (might be due to invalid IL or missing references) //IL_036b: Expected O, but got Unknown //IL_0356: Unknown result type (might be due to invalid IL or missing references) //IL_035b: Unknown result type (might be due to invalid IL or missing references) //IL_0361: Expected O, but got Unknown //IL_03b8: Unknown result type (might be due to invalid IL or missing references) //IL_03c2: Expected O, but got Unknown //IL_03bd: Unknown result type (might be due to invalid IL or missing references) //IL_03c7: Expected O, but got Unknown Bitmap icon = Resources.icon; using (MemoryStream memoryStream = new MemoryStream()) { ((Image)icon).Save((Stream)memoryStream, ImageFormat.Png); Texture2D val = new Texture2D(((Image)icon).Width, ((Image)icon).Height, (TextureFormat)5, false, false); ImageConversion.LoadImage(val, memoryStream.ToArray()); ((Texture)val).filterMode = (FilterMode)0; ModSettingsManager.SetModIcon(Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f))); } StepSliderConfig val2 = new StepSliderConfig { min = 0f, max = 1f, increment = 0.01f }; InputFieldConfig val3 = new InputFieldConfig { richText = false }; ModSettingsManager.AddOption((BaseOption)new FloatFieldOption(instance.timeSpan)); ModSettingsManager.AddOption((BaseOption)new StringInputFieldOption(instance.calculationMode)); ModSettingsManager.AddOption((BaseOption)new KeyBindOption(instance.toggleVisibility)); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(instance.isVisible)); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(instance.hideWhenChatboxActive)); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(instance.hideBackground)); ModSettingsManager.AddOption((BaseOption)new ColorOption(instance.backgroundColor)); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(instance.hudScaling)); ModSettingsManager.AddOption((BaseOption)new StringInputFieldOption(instance.parent, val3)); ModSettingsManager.AddOption((BaseOption)new FloatFieldOption(instance.sizeX)); ModSettingsManager.AddOption((BaseOption)new FloatFieldOption(instance.sizeY)); ModSettingsManager.AddOption((BaseOption)new FloatFieldOption(instance.anglesX)); ModSettingsManager.AddOption((BaseOption)new FloatFieldOption(instance.anglesY)); ModSettingsManager.AddOption((BaseOption)new FloatFieldOption(instance.anglesZ)); ModSettingsManager.AddOption((BaseOption)new StepSliderOption(instance.pivotX, val2)); ModSettingsManager.AddOption((BaseOption)new StepSliderOption(instance.pivotY, val2)); ModSettingsManager.AddOption((BaseOption)new FloatFieldOption(instance.anchorPositionX)); ModSettingsManager.AddOption((BaseOption)new FloatFieldOption(instance.anchorPositionY)); ModSettingsManager.AddOption((BaseOption)new StepSliderOption(instance.anchorMinX, val2)); ModSettingsManager.AddOption((BaseOption)new StepSliderOption(instance.anchorMinY, val2)); ModSettingsManager.AddOption((BaseOption)new StepSliderOption(instance.anchorMaxX, val2)); ModSettingsManager.AddOption((BaseOption)new StepSliderOption(instance.anchorMaxY, val2)); ModSettingsManager.AddOption((BaseOption)new StringInputFieldOption(instance.textFormat, val3)); ModSettingsManager.AddOption((BaseOption)new FloatFieldOption(instance.textSpacingX)); ModSettingsManager.AddOption((BaseOption)new FloatFieldOption(instance.textSpacingY)); ModSettingsManager.AddOption((BaseOption)new StringInputFieldOption(instance.textAlignment)); ModSettingsManager.AddOption((BaseOption)new ColorOption(instance.textColor)); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(instance.useCommas)); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(instance.useWholeNumbers)); object obj = <>c.<>9__2_0; if (obj == null) { UnityAction val4 = delegate { //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_030b: Unknown result type (might be due to invalid IL or missing references) //IL_0310: Unknown result type (might be due to invalid IL or missing references) //IL_0340: Unknown result type (might be due to invalid IL or missing references) //IL_0347: Expected O, but got Unknown if (!Directory.Exists(instance.presetsPath)) { Directory.CreateDirectory(instance.presetsPath); } int num = 0; Regex regex = new Regex("Preset(\\d+)\\.json"); string[] files = Directory.GetFiles(instance.presetsPath, "Preset*.json"); foreach (string path in files) { if (File.Exists(path)) { Match match = regex.Match(Path.GetFileName(path)); if (match.Success && int.TryParse(match.Groups[1].Value, out var result) && result > num) { num = result; } } } string text = $"Preset{num + 1}"; Preset preset = new Preset(text) { timeSpan = instance.timeSpan.Value, calculationMode = instance.calculationMode.Value, toggleVisibility = instance.toggleVisibility.Value, isVisible = instance.isVisible.Value, hideWhenChatboxActive = instance.hideWhenChatboxActive.Value, hideBackground = instance.hideBackground.Value, backgroundColor = instance.backgroundColor.Value, hudScaling = instance.hudScaling.Value, parent = instance.parent.Value, sizeX = instance.sizeX.Value, sizeY = instance.sizeY.Value, anglesX = instance.anglesX.Value, anglesY = instance.anglesY.Value, anglesZ = instance.anglesZ.Value, pivotX = instance.pivotX.Value, pivotY = instance.pivotY.Value, anchorPositionX = instance.anchorPositionX.Value, anchorPositionY = instance.anchorPositionY.Value, anchorMinX = instance.anchorMinX.Value, anchorMinY = instance.anchorMinY.Value, anchorMaxX = instance.anchorMaxX.Value, anchorMaxY = instance.anchorMaxY.Value, textFormat = instance.textFormat.Value, textSpacingX = instance.textSpacingX.Value, textSpacingY = instance.textSpacingY.Value, textAlignment = instance.textAlignment.Value, textColor = instance.textColor.Value, useCommas = instance.useCommas.Value, useWholeNumbers = instance.useWholeNumbers.Value }; JsonSerializerSettings val5 = new JsonSerializerSettings(); val5.Converters.Add((JsonConverter)(object)new ColorJsonConverter()); File.WriteAllText(Path.Combine(instance.presetsPath, text + ".json"), JsonConvert.SerializeObject((object)preset, (Formatting)1, val5)); instance.logger.LogMessage((object)("Preset successfully exported: \"" + text + "\"")); }; <>c.<>9__2_0 = val4; obj = (object)val4; } ModSettingsManager.AddOption((BaseOption)new GenericButtonOption("New Preset", "Presets", "Exports the current settings to the \"Presets\" folder.\n\nNote: Restarting the game will only reload all presets since Risk of Options does not have implementation for adding/removing UI elements.", "Export", (UnityAction)obj)); foreach (Preset preset2 in instance.presets) { ModSettingsManager.AddOption((BaseOption)new GenericButtonOption(preset2.name, "Presets", "Applies the settings from the preset called \"" + preset2.name + "\".", "Apply", new UnityAction(preset2.Apply))); } } } private static class WolfoQoL { public const string modGUID = "Wolfo.WolfoQoL_Client"; public static bool IsLoaded() { return Chainloader.PluginInfos.ContainsKey("Wolfo.WolfoQoL_Client"); } public static void OnAwake() { instance.PatchAll("WolfoQoLPatches"); } } public enum CalculationMode { RampUp, RollingAverage } private class Preset { [JsonIgnore] public string name; public float timeSpan = 5f; public string calculationMode = CalculationMode.RampUp.ToString(); public KeyboardShortcut toggleVisibility = new KeyboardShortcut((KeyCode)120, Array.Empty<KeyCode>()); public bool isVisible = true; public bool hideWhenChatboxActive = true; public bool hideBackground = false; public Color backgroundColor = new Color(0.6668f, 0.7341f, 0.7642f, 0.1961f); public bool hudScaling = true; public string parent = instance.parents[1]; public float sizeX = 0f; public float sizeY = 45f; public float anglesX = 0f; public float anglesY = -6f; public float anglesZ = 0f; public float pivotX = 0f; public float pivotY = 0f; public float anchorPositionX = 0f; public float anchorPositionY = 135f; public float anchorMinX = 0f; public float anchorMinY = 0f; public float anchorMaxX = 1f; public float anchorMaxY = 0f; public string textFormat = "DPS: [character+minion]"; public float textSpacingX = -12f; public float textSpacingY = -12f; public string textAlignment; public Color textColor; public bool useCommas; public bool useWholeNumbers; public Preset(string name) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) TextAlignmentOptions val = (TextAlignmentOptions)4097; textAlignment = ((object)(TextAlignmentOptions)(ref val)).ToString(); textColor = Color.white; useCommas = true; useWholeNumbers = true; base..ctor(); this.name = name; } public void Apply() { //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0248: Unknown result type (might be due to invalid IL or missing references) instance.timeSpan.Value = timeSpan; instance.calculationMode.Value = calculationMode; instance.toggleVisibility.Value = toggleVisibility; instance.isVisible.Value = isVisible; instance.hideWhenChatboxActive.Value = hideWhenChatboxActive; instance.hideBackground.Value = hideBackground; instance.backgroundColor.Value = backgroundColor; instance.hudScaling.Value = hudScaling; instance.parent.Value = parent; instance.sizeX.Value = sizeX; instance.sizeY.Value = sizeY; instance.anglesX.Value = anglesX; instance.anglesY.Value = anglesY; instance.anglesZ.Value = anglesZ; instance.pivotX.Value = pivotX; instance.pivotY.Value = pivotY; instance.anchorPositionX.Value = anchorPositionX; instance.anchorPositionY.Value = anchorPositionY; instance.anchorMinX.Value = anchorMinX; instance.anchorMinY.Value = anchorMinY; instance.anchorMaxX.Value = anchorMaxX; instance.anchorMaxY.Value = anchorMaxY; instance.textFormat.Value = textFormat; instance.textSpacingX.Value = textSpacingX; instance.textSpacingY.Value = textSpacingY; instance.textAlignment.Value = textAlignment; instance.textColor.Value = textColor; instance.useCommas.Value = useCommas; instance.useWholeNumbers.Value = useWholeNumbers; instance.UpdateSettings(); } } internal class DPSCalculator { internal class DamageData { public float time; public float damage; public GameObject victim; public DamageData(float damage, GameObject victim = null) { time = Time.time; this.damage = damage; this.victim = victim; } } public string name; public string example; private List<DamageData> damageDatas = new List<DamageData>(); private float currentDamage; public float calculatedDamage; public float percentageDamage; public float maxDamage; public int currentKills; public int maxKills; private CharacterBody characterBody; public DPSCalculator(string name, string example) { this.name = name; this.example = example; } public void ClearStage() { damageDatas.Clear(); currentDamage = 0f; } public void ClearRun() { maxDamage = 0f; maxKills = 0; } public void Add(DamageData damageData) { damageDatas.Add(damageData); currentDamage += damageData.damage; UpdateComboKills(); } public void Update() { float currentTime = instance.currentTime; float value = instance.timeSpan.Value; for (int num = damageDatas.Count - 1; num >= 0; num--) { DamageData damageData = damageDatas[num]; if (damageData.time < currentTime - value) { currentDamage -= damageData.damage; damageDatas.RemoveAt(num); UpdateComboKills(); } } if (damageDatas.Count != 0) { if (!Enum.TryParse<CalculationMode>(instance.calculationMode.Value, ignoreCase: false, out var result)) { result = (CalculationMode)Enum.Parse(typeof(CalculationMode), (string)((ConfigEntryBase)instance.calculationMode).DefaultValue, ignoreCase: false); } if (result == CalculationMode.RollingAverage) { calculatedDamage = currentDamage / value; } else { calculatedDamage = currentDamage / Mathf.Min(Mathf.Max(1f, currentTime - damageDatas.First().time), value); } } else { calculatedDamage = 0f; } if (maxDamage < calculatedDamage) { maxDamage = calculatedDamage; } if (name == "character") { if ((Object)(object)characterBody == (Object)null) { characterBody = LocalUserManager.GetFirstLocalUser().cachedBody; } percentageDamage = calculatedDamage * 100f / characterBody.damage; } } private void UpdateComboKills() { currentKills = (from x in damageDatas where (Object)(object)x.victim != (Object)null select ((Object)x.victim).GetInstanceID()).Distinct().Count(); if (maxKills < currentKills) { maxKills = currentKills; } } } private const string modGUID = "bulletbot.dpsmeter"; private const string modName = "DPSMeter"; private const string modVer = "1.1.5"; public static Plugin instance; public ManualLogSource logger; private readonly Harmony harmony = new Harmony("bulletbot.dpsmeter"); private ConfigEntry<float> timeSpan; private ConfigEntry<string> calculationMode; private ConfigEntry<KeyboardShortcut> toggleVisibility; private ConfigEntry<bool> isVisible; private ConfigEntry<bool> hideWhenChatboxActive; private ConfigEntry<bool> hideBackground; private ConfigEntry<Color> backgroundColor; private ConfigEntry<bool> hudScaling; private ConfigEntry<string> parent; private ConfigEntry<float> sizeX; private ConfigEntry<float> sizeY; private ConfigEntry<float> anglesX; private ConfigEntry<float> anglesY; private ConfigEntry<float> anglesZ; private ConfigEntry<float> pivotX; private ConfigEntry<float> pivotY; private ConfigEntry<float> anchorPositionX; private ConfigEntry<float> anchorPositionY; private ConfigEntry<float> anchorMinX; private ConfigEntry<float> anchorMinY; private ConfigEntry<float> anchorMaxX; private ConfigEntry<float> anchorMaxY; private ConfigEntry<string> textFormat; private ConfigEntry<float> textSpacingX; private ConfigEntry<float> textSpacingY; private ConfigEntry<string> textAlignment; private ConfigEntry<Color> textColor; private ConfigEntry<bool> useCommas; private ConfigEntry<bool> useWholeNumbers; private string presetsPath; private readonly List<Preset> presets = new List<Preset>(); private readonly List<string> parents = new List<string> { "None", "BottomLeftCluster", "UpperRightCluster", "BottomRightCluster", "UpperLeftCluster", "BottomCenterCluster", "TopCenterCluster", "LeftCluster", "RightCluster" }; private RectTransform dpsMeterTransform; private HGTextMeshProUGUI dpsMeterText; private bool previousVisible; private bool previousChatBoxActive; private bool chatBoxActive; private Vector3 currentScale; private float currentHUDScale; public ChatBox currentChatBox; private HUD currentHUD; internal List<DPSCalculator> dpsCalculators; public float currentTime; private void Awake() { //IL_0246: 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_07cf: Unknown result type (might be due to invalid IL or missing references) //IL_07d4: Unknown result type (might be due to invalid IL or missing references) //IL_0857: Unknown result type (might be due to invalid IL or missing references) //IL_0903: Unknown result type (might be due to invalid IL or missing references) //IL_090d: Expected O, but got Unknown instance = this; logger = Logger.CreateLogSource("DPSMeter"); presetsPath = Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)instance).Info.Location), "Presets"); Preset preset = new Preset("Default"); presets.Add(preset); if (Directory.Exists(presetsPath)) { string[] files = Directory.GetFiles(presetsPath, "*.json"); foreach (string path in files) { if (File.Exists(path)) { string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(path); Preset preset2 = new Preset(fileNameWithoutExtension); if (IsValidJson(File.ReadAllText(path), preset2)) { presets.Add(preset2); logger.LogMessage((object)("Preset successfully loaded: \"" + fileNameWithoutExtension + "\"")); } } } } dpsCalculators = new List<DPSCalculator> { new DPSCalculator("character", "You"), new DPSCalculator("minion", "Summoned by your character"), new DPSCalculator("player", "Other players"), new DPSCalculator("team", "Same team as your character") }; string text = "General"; timeSpan = ((BaseUnityPlugin)this).Config.Bind<float>(text, "Timespan", preset.timeSpan, "Measures how much damage is dealt over a specific duration."); string text2 = "Determines how the DPS is calculated.\n\nOptions:"; foreach (CalculationMode value2 in Enum.GetValues(typeof(CalculationMode))) { text2 = text2 + "\n" + value2; } calculationMode = ((BaseUnityPlugin)this).Config.Bind<string>(text, "Calculation Mode", preset.calculationMode, text2); calculationMode.SettingChanged += OnSettingChanged; toggleVisibility = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("General", "Toggle Visibility", preset.toggleVisibility, "The keybind to toggle the visibility of the UI."); toggleVisibility.SettingChanged += OnSettingChanged; isVisible = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Is Visible", true, "Determines whether the UI is currently visible."); hideWhenChatboxActive = ((BaseUnityPlugin)this).Config.Bind<bool>(text, "Hide When Chatbox Active", preset.hideWhenChatboxActive, "Determines whether to hide the UI when the chatbox is active."); hideWhenChatboxActive.SettingChanged += OnSettingChanged; hideBackground = ((BaseUnityPlugin)this).Config.Bind<bool>(text, "Hide Background", preset.hideBackground, "Determines whether to hide the background of the UI."); hideBackground.SettingChanged += OnSettingChanged; backgroundColor = ((BaseUnityPlugin)this).Config.Bind<Color>(text, "Background Color", preset.backgroundColor, "The background color of the UI."); backgroundColor.SettingChanged += OnSettingChanged; hudScaling = ((BaseUnityPlugin)this).Config.Bind<bool>(text, "HUD Scaling", preset.hudScaling, "Determines if the UI scales according to the setting (Settings -> Video -> HUD Scale)."); hudScaling.SettingChanged += OnSettingChanged; string text3 = "The parent object name of the UI.\n\nOptions:"; foreach (string parent in parents) { text3 = text3 + "\n" + parent; } this.parent = ((BaseUnityPlugin)this).Config.Bind<string>(text, "Parent", preset.parent, text3); this.parent.SettingChanged += OnSettingChanged; sizeX = ((BaseUnityPlugin)this).Config.Bind<float>(text, "Size X", preset.sizeX, "The width of the UI."); sizeX.SettingChanged += OnSettingChanged; sizeY = ((BaseUnityPlugin)this).Config.Bind<float>(text, "Size Y", preset.sizeY, "The height of the UI."); sizeY.SettingChanged += OnSettingChanged; anglesX = ((BaseUnityPlugin)this).Config.Bind<float>(text, "Rotation Angle X", preset.anglesX, "The X rotation angle of the UI."); anglesX.SettingChanged += OnSettingChanged; anglesY = ((BaseUnityPlugin)this).Config.Bind<float>(text, "Rotation Angle Y", preset.anglesY, "The Y rotation angle of the UI."); anglesY.SettingChanged += OnSettingChanged; anglesZ = ((BaseUnityPlugin)this).Config.Bind<float>(text, "Rotation Angle Z", preset.anglesZ, "The Z rotation angle of the UI."); anglesZ.SettingChanged += OnSettingChanged; pivotX = ((BaseUnityPlugin)this).Config.Bind<float>(text, "Pivot X", preset.pivotX, "The X pivot point of the UI."); pivotX.SettingChanged += OnSettingChanged; pivotY = ((BaseUnityPlugin)this).Config.Bind<float>(text, "Pivot Y", preset.pivotY, "The Y pivot point of the UI."); pivotY.SettingChanged += OnSettingChanged; anchorPositionX = ((BaseUnityPlugin)this).Config.Bind<float>(text, "Anchor Position X", preset.anchorPositionX, "The X anchor position of the UI."); anchorPositionX.SettingChanged += OnSettingChanged; anchorPositionY = ((BaseUnityPlugin)this).Config.Bind<float>(text, "Anchor Position Y", preset.anchorPositionY, "The Y anchor position of the UI."); anchorPositionY.SettingChanged += OnSettingChanged; anchorMinX = ((BaseUnityPlugin)this).Config.Bind<float>(text, "Anchor Min X", preset.anchorMinX, "The minimum X anchor of the UI."); anchorMinX.SettingChanged += OnSettingChanged; anchorMinY = ((BaseUnityPlugin)this).Config.Bind<float>(text, "Anchor Min Y", preset.anchorMinY, "The minimum Y anchor of the UI."); anchorMinY.SettingChanged += OnSettingChanged; anchorMaxX = ((BaseUnityPlugin)this).Config.Bind<float>(text, "Anchor Max X", preset.anchorMaxX, "The maximum X anchor of the UI."); anchorMaxX.SettingChanged += OnSettingChanged; anchorMaxY = ((BaseUnityPlugin)this).Config.Bind<float>(text, "Anchor Max Y", preset.anchorMaxY, "The maximum Y anchor of the UI."); anchorMaxY.SettingChanged += OnSettingChanged; string textFormatDescription = "The format for displaying text. Supports rich text.\n\nOptions:"; dpsCalculators.ForEach(delegate(DPSCalculator x) { textFormatDescription = textFormatDescription + "\n" + x.name + " - " + x.example; }); textFormat = ((BaseUnityPlugin)this).Config.Bind<string>(text, "Text Format", preset.textFormat, textFormatDescription); textSpacingX = ((BaseUnityPlugin)this).Config.Bind<float>(text, "Text Spacing X", preset.textSpacingX, "The horizontal text spacing of the UI text."); textSpacingX.SettingChanged += OnSettingChanged; textSpacingY = ((BaseUnityPlugin)this).Config.Bind<float>(text, "Text Spacing Y", preset.textSpacingY, "The vertical text spacing of the UI text."); textSpacingY.SettingChanged += OnSettingChanged; string text4 = "The alignment of the UI text.\n\nOptions:"; foreach (TextAlignmentOptions value3 in Enum.GetValues(typeof(TextAlignmentOptions))) { TextAlignmentOptions val = value3; text4 = text4 + "\n" + ((object)(TextAlignmentOptions)(ref val)).ToString(); } textAlignment = ((BaseUnityPlugin)this).Config.Bind<string>(text, "Text Alignment", preset.textAlignment, text4); textAlignment.SettingChanged += OnSettingChanged; textColor = ((BaseUnityPlugin)this).Config.Bind<Color>(text, "Text Color", preset.textColor, "The color of the UI text."); textColor.SettingChanged += OnSettingChanged; useCommas = ((BaseUnityPlugin)this).Config.Bind<bool>(text, "Use Commas", preset.useCommas, "Determines whether the numbers are with commas for thousands."); useWholeNumbers = ((BaseUnityPlugin)this).Config.Bind<bool>(text, "Use Whole Numbers", preset.useWholeNumbers, "Determines whether the numbers should display as whole numbers."); if (RiskOfOptions.IsLoaded()) { RiskOfOptions.OnAwake(); } GlobalEventManager.onClientDamageNotified += delegate(DamageDealtMessage message) { //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) try { DPSCalculator dPSCalculator2 = null; CharacterMaster cachedMaster = LocalUserManager.GetFirstLocalUser().cachedMaster; CharacterBody component2 = message.attacker.GetComponent<CharacterBody>(); if ((Object)(object)component2 != (Object)null) { if ((Object)(object)component2 == (Object)(object)cachedMaster.GetBody()) { dPSCalculator2 = dpsCalculators.First((DPSCalculator x) => x.name == "character"); } else if (component2.isPlayerControlled) { dPSCalculator2 = dpsCalculators.First((DPSCalculator x) => x.name == "player"); } else { CharacterMaster master = component2.master; if ((Object)(object)master != (Object)null) { if (Object.op_Implicit((Object)(object)master.minionOwnership) && (Object)(object)master.minionOwnership.ownerMaster == (Object)(object)cachedMaster) { dPSCalculator2 = dpsCalculators.First((DPSCalculator x) => x.name == "minion"); } else if (master.teamIndex == cachedMaster.teamIndex) { dPSCalculator2 = dpsCalculators.First((DPSCalculator x) => x.name == "team"); } } } } if (dPSCalculator2 != null) { GameObject val7 = message.victim; if ((Object)(object)val7 != (Object)null) { HealthComponent component3 = val7.GetComponent<HealthComponent>(); if ((Object)(object)component3 == (Object)null || ((Object)(object)component3 != (Object)null && component3.alive)) { val7 = null; } } dPSCalculator2.Add(new DPSCalculator.DamageData(message.damage, val7)); } } catch { } }; Stage.onStageStartGlobal += delegate { previousVisible = !isVisible.Value; previousChatBoxActive = false; chatBoxActive = false; dpsCalculators.ForEach(delegate(DPSCalculator x) { x.ClearStage(); }); }; HUD.shouldHudDisplay += (ShouldHudDisplayDelegate)delegate(HUD hud, ref bool _) { //IL_0699: Unknown result type (might be due to invalid IL or missing references) //IL_06a0: Expected O, but got Unknown //IL_06b7: Unknown result type (might be due to invalid IL or missing references) //IL_06be: Expected O, but got Unknown //IL_0716: Unknown result type (might be due to invalid IL or missing references) //IL_0723: Unknown result type (might be due to invalid IL or missing references) //IL_0730: Unknown result type (might be due to invalid IL or missing references) //IL_073d: Unknown result type (might be due to invalid IL or missing references) //IL_074a: 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_026e: Unknown result type (might be due to invalid IL or missing references) //IL_027e: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)currentHUD == (Object)null) { currentHUD = hud; } else { currentTime = Time.time; dpsCalculators.ForEach(delegate(DPSCalculator x) { x.Update(); }); if ((Object)(object)dpsMeterTransform != (Object)null && (Object)(object)dpsMeterText != (Object)null) { if ((Object)(object)currentChatBox != (Object)null) { chatBoxActive = ((UIBehaviour)currentChatBox.inputField).IsActive(); } if (!PauseManager.isPaused && !chatBoxActive) { KeyboardShortcut value = toggleVisibility.Value; if (((KeyboardShortcut)(ref value)).IsDown()) { isVisible.Value = !isVisible.Value; } } if (previousVisible != isVisible.Value) { previousVisible = isVisible.Value; ((Component)dpsMeterTransform).gameObject.SetActive(isVisible.Value); UpdateChatBox(currentChatBox); } else if (hideWhenChatboxActive.Value && previousChatBoxActive != chatBoxActive) { previousChatBoxActive = chatBoxActive; if (isVisible.Value) { ((Component)dpsMeterTransform).gameObject.SetActive(!previousChatBoxActive); } } BaseConVar val2 = Console.instance.FindConVar("hud_scale"); float num = default(float); if ((val2 != null && TextSerialization.TryParseInvariant(val2.GetString(), ref num) && currentHUDScale != num) || currentScale != ((Transform)dpsMeterTransform).localScale) { UpdateSettings(); } if (isVisible.Value || !chatBoxActive) { string text5 = textFormat.Value; int num2 = 0; while (num2 < text5.Length) { int num3 = text5.IndexOf("[", num2, StringComparison.Ordinal); if (num3 < 0) { break; } int num4 = text5.IndexOf("]", num3 + "[".Length, StringComparison.Ordinal); if (num4 < 0) { break; } string text6 = text5.Substring(num3 + "[".Length, num4 - (num3 + "[".Length)); if (!"-*/%^".Any(((IEnumerable<char>)text6).Contains<char>)) { string text7 = text5.Substring(num3, num4 - num3 + "]".Length); try { string text8 = (useCommas.Value ? "N" : "F") + (useWholeNumbers.Value ? "0" : "1"); bool flag = false; string[] array = text6.Split(new char[1] { '+' }); string[] array2 = array; foreach (string text9 in array2) { string[] array3 = text9.Split(new char[1] { '_' }); string actualName = text9; if (array3.Length > 1) { actualName = array3[0]; } DPSCalculator dPSCalculator = dpsCalculators.FirstOrDefault((DPSCalculator x) => x.name == actualName); if (dPSCalculator != null) { if (text9 == actualName + "_currentKills") { text6 = text6.Replace(text9, dPSCalculator.currentKills.ToString()); } else if (text9 == actualName + "_maxDamage") { text6 = text6.Replace(text9, dPSCalculator.maxDamage.ToString(CultureInfo.InvariantCulture)); flag = true; } else if (text9 == actualName + "_maxKills") { text6 = text6.Replace(text9, dPSCalculator.maxKills.ToString()); } else if (text9 == actualName + "_percentageDamage") { text6 = text6.Replace(text9, dPSCalculator.percentageDamage.ToString(CultureInfo.InvariantCulture)); flag = true; } else if (text9 == dPSCalculator.name) { text6 = text6.Replace(text9, dPSCalculator.calculatedDamage.ToString(CultureInfo.InvariantCulture)); flag = true; } } } text6 = ((!float.TryParse(new DataTable().Compute(text6, "").ToString(), out var result)) ? text7 : result.ToString(flag ? text8 : null)); } catch { text6 = text7; } } text5 = text5.Substring(0, num3) + text6 + text5.Substring(num4 + "]".Length); num2 = num3 + text6.Length; } ((TMP_Text)dpsMeterText).text = text5; } } else if ((Object)(object)currentHUD.mainContainer != (Object)null && (Object)(object)currentHUD.mainUIPanel != (Object)null) { GameObject val3 = new GameObject("DPSMeter"); dpsMeterTransform = val3.AddComponent<RectTransform>(); GameObject val4 = new GameObject("Text"); RectTransform val5 = val4.AddComponent<RectTransform>(); dpsMeterText = val4.AddComponent<HGTextMeshProUGUI>(); ((TMP_Text)dpsMeterText).enableAutoSizing = true; ((TMP_Text)dpsMeterText).fontSizeMax = 256f; ((Transform)val5).SetParent((Transform)(object)dpsMeterTransform); ((Transform)val5).localPosition = Vector3.zero; ((Transform)val5).localScale = Vector3.one; val5.anchorMin = Vector2.zero; val5.anchorMax = Vector2.one; val5.anchoredPosition = Vector2.zero; Image component = ((Component)currentHUD.itemInventoryDisplay).gameObject.GetComponent<Image>(); if ((Object)(object)component != (Object)null) { Image val6 = val3.AddComponent<Image>(); val6.sprite = component.sprite; val6.type = (Type)1; } UpdateSettings(); } } }; PatchAll("Patches"); if (WolfoQoL.IsLoaded()) { WolfoQoL.OnAwake(); } void OnSettingChanged(object sender, EventArgs e) { UpdateSettings(); } } private void PatchAll(string name) { (from x in Assembly.GetExecutingAssembly().GetTypes() where x.Namespace == typeof(Plugin).Namespace + "." + name select x).ToList().ForEach(delegate(Type x) { harmony.PatchAll(x); }); } private bool IsValidJson(string data, Preset preset) { Preset obj = presets[0]; Dictionary<string, object> dictionary = JsonConvert.DeserializeObject<Dictionary<string, object>>(data); FieldInfo[] fields = typeof(Preset).GetFields(BindingFlags.Instance | BindingFlags.Public); foreach (FieldInfo fieldInfo in fields) { if (fieldInfo.GetCustomAttribute(typeof(JsonIgnoreAttribute)) != null) { continue; } if (!dictionary.ContainsKey(fieldInfo.Name)) { fieldInfo.SetValue(preset, fieldInfo.GetValue(obj)); continue; } object validValue = GetValidValue(dictionary[fieldInfo.Name], fieldInfo.FieldType); if (validValue == null) { logger.LogMessage((object)("Failed to load preset: \"" + preset.name + "\" - Error: Invalid type at field called \"" + fieldInfo.Name + "\"")); return false; } fieldInfo.SetValue(preset, validValue); } return true; } private object GetValidValue(object value, Type type) { //IL_006d: 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) if (type == typeof(float) && value is double num) { return (float)num; } Color val = default(Color); if (type == typeof(Color) && value is string text && ColorUtility.TryParseHtmlString(text, ref val)) { return val; } if (type == typeof(KeyboardShortcut)) { try { JObject val2 = JObject.Parse(value.ToString()); JToken val3 = default(JToken); JToken val4 = default(JToken); if (val2 != null && val2.ContainsKey("MainKey") && val2.TryGetValue("MainKey", ref val3) && val2.ContainsKey("Modifiers") && val2.TryGetValue("Modifiers", ref val4)) { return (object)new KeyboardShortcut((KeyCode)Extensions.Value<long>((IEnumerable<JToken>)val3), (from x in val4.Values<long>() select (KeyCode)x).ToArray()); } } catch { } } if (value != null && value.GetType() == type) { return value; } return null; } public void UpdateSettings() { //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_014b: 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_0165: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: Unknown result type (might be due to invalid IL or missing references) //IL_0232: Unknown result type (might be due to invalid IL or missing references) //IL_0264: 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_02b2: Unknown result type (might be due to invalid IL or missing references) //IL_02d9: 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_032c: Unknown result type (might be due to invalid IL or missing references) //IL_020a: Unknown result type (might be due to invalid IL or missing references) //IL_0380: Unknown result type (might be due to invalid IL or missing references) //IL_0394: Unknown result type (might be due to invalid IL or missing references) //IL_0399: Unknown result type (might be due to invalid IL or missing references) //IL_0373: Unknown result type (might be due to invalid IL or missing references) //IL_0378: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)dpsMeterTransform == (Object)null) && !((Object)(object)dpsMeterText == (Object)null)) { bool flag = parents[0] == parent.Value || !parents.Contains(parent.Value); if ((Object)(object)((Transform)dpsMeterTransform).parent == (Object)null || parent.Value != ((Object)((Transform)dpsMeterTransform).parent).name) { Transform val = currentHUD.mainUIPanel.transform.Find("SpringCanvas"); ((Transform)dpsMeterTransform).SetParent(flag ? val : val.Find(parent.Value)); } Vector3 one = Vector3.one; float num = 100f; BaseConVar val2 = Console.instance.FindConVar("hud_scale"); if (val2 != null) { TextSerialization.TryParseInvariant(val2.GetString(), ref num); } if (!hudScaling.Value && !flag) { Vector3 localScale = ((Transform)dpsMeterTransform).parent.localScale; ((Vector3)(ref one))..ctor(1f / localScale.x, 1f / localScale.y, 1f / localScale.z); } else if (hudScaling.Value && flag) { ((Vector3)(ref one))..ctor(num / 100f, num / 100f, num / 100f); } ((Transform)dpsMeterTransform).localScale = one; currentScale = one; currentHUDScale = num; ((Transform)dpsMeterTransform).localPosition = Vector3.zero; Image component = ((Component)dpsMeterTransform).GetComponent<Image>(); if ((Object)(object)component != (Object)null) { ((Behaviour)component).enabled = !hideBackground.Value; ((Graphic)component).color = backgroundColor.Value; } dpsMeterTransform.sizeDelta = new Vector2(sizeX.Value, sizeY.Value); ((Transform)dpsMeterTransform).eulerAngles = new Vector3(anglesX.Value, anglesY.Value, anglesZ.Value); dpsMeterTransform.pivot = new Vector2(pivotX.Value, pivotY.Value); dpsMeterTransform.anchoredPosition = new Vector2(anchorPositionX.Value, anchorPositionY.Value); dpsMeterTransform.anchorMin = new Vector2(anchorMinX.Value, anchorMinY.Value); dpsMeterTransform.anchorMax = new Vector2(anchorMaxX.Value, anchorMaxY.Value); ((Component)dpsMeterText).GetComponent<RectTransform>().sizeDelta = new Vector2(textSpacingX.Value, textSpacingY.Value); if (!Enum.TryParse<TextAlignmentOptions>(textAlignment.Value, ignoreCase: false, out TextAlignmentOptions result)) { result = (TextAlignmentOptions)Enum.Parse(typeof(TextAlignmentOptions), (string)((ConfigEntryBase)textAlignment).DefaultValue, ignoreCase: false); } ((TMP_Text)dpsMeterText).alignment = result; ((TMP_Text)dpsMeterText).faceColor = Color32.op_Implicit(textColor.Value); UpdateChatBox(currentChatBox); } } public void UpdateChatBox(ChatBox chatBox) { //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)chatBox != (Object)null && WolfoQoL.IsLoaded() && (Object)(object)Run.instance != (Object)null) { RectTransform component = ((Component)((Transform)((Component)chatBox).gameObject.GetComponent<RectTransform>()).GetChild(2)).GetComponent<RectTransform>(); if (hideWhenChatboxActive.Value && isVisible.Value) { component.offsetMin = new Vector2(-10f, 49f); component.offsetMax = new Vector2(120f, 0f); } else { component.offsetMin = new Vector2(-10f, 0f); component.offsetMax = new Vector2(120f, -6f); } AccessTools.Method(typeof(ChatBox), "RebuildChatRects", (Type[])null, (Type[])null).Invoke(chatBox, null); } } } } namespace DPSMeter.Properties { [GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] [DebuggerNonUserCode] [CompilerGenerated] internal class Resources { private static ResourceManager resourceMan; private static CultureInfo resourceCulture; [EditorBrowsable(EditorBrowsableState.Advanced)] internal static ResourceManager ResourceManager { get { if (resourceMan == null) { ResourceManager resourceManager = new ResourceManager("DPSMeter.Properties.Resources", typeof(Resources).Assembly); resourceMan = resourceManager; } return resourceMan; } } [EditorBrowsable(EditorBrowsableState.Advanced)] internal static CultureInfo Culture { get { return resourceCulture; } set { resourceCulture = value; } } internal static Bitmap icon { get { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown object @object = ResourceManager.GetObject("icon", resourceCulture); return (Bitmap)@object; } } internal Resources() { } } } namespace DPSMeter.WolfoQoLPatches { [HarmonyPatch] internal class UI_StuffPatch { [HarmonyTargetMethod] private static MethodBase TargetMethod() { Type type = AccessTools.TypeByName("WolfoQoL_Client.UI_Stuff"); return AccessTools.Method(type, "AllowMoreChatMessages", (Type[])null, (Type[])null); } [HarmonyPostfix] private static void Postfix(object[] __args) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown Plugin.instance.UpdateChatBox((ChatBox)__args[1]); } } } namespace DPSMeter.Patches { [HarmonyPatch(typeof(Run))] internal class RunPatch { [HarmonyPatch("OnEnable")] [HarmonyPostfix] private static void OnEnable() { Plugin.instance.dpsCalculators.ForEach(delegate(Plugin.DPSCalculator x) { x.ClearRun(); }); } } [HarmonyPatch(typeof(ChatBox))] internal class ChatBoxPatch { [HarmonyPatch("Start")] [HarmonyPostfix] private static void Start(ChatBox __instance) { Plugin.instance.currentChatBox = __instance; } } }