using System; using System.Collections.Generic; using Dalamud.Bindings.ImGui; using Dalamud.Game.Text; using Dalamud.Interface; using Dalamud.Interface.Colors; using Dalamud.Interface.Utility.Raii; using Dalamud.Plugin; namespace Questionable.Windows.ConfigComponents; internal abstract class ConfigComponent { protected const string DutyClipboardSeparator = ";"; protected const string DutyWhitelistPrefix = "+"; protected const string DutyBlacklistPrefix = "-"; protected readonly string[] SupportedCfcOptions = new string[3] { $"{SeIconChar.Circle.ToIconChar()} Enabled (Default)", $"{SeIconChar.Circle.ToIconChar()} Enabled", $"{SeIconChar.Cross.ToIconChar()} Disabled" }; protected readonly string[] UnsupportedCfcOptions = new string[3] { $"{SeIconChar.Cross.ToIconChar()} Disabled (Default)", $"{SeIconChar.Circle.ToIconChar()} Enabled", $"{SeIconChar.Cross.ToIconChar()} Disabled" }; private readonly IDalamudPluginInterface _pluginInterface; protected Configuration Configuration { get; } protected ConfigComponent(IDalamudPluginInterface pluginInterface, Configuration configuration) { _pluginInterface = pluginInterface; Configuration = configuration; } public abstract void DrawTab(); protected void Save() { _pluginInterface.SavePluginConfig(Configuration); } protected static string FormatLevel(int level, bool includePrefix = true) { if (level == 0) { return string.Empty; } return $"{(includePrefix ? SeIconChar.LevelEn.ToIconString() : string.Empty)}{FormatLevel(level / 10, includePrefix: false)}{((SeIconChar)(57440 + level % 10)).ToIconChar()}"; } protected static void DrawNotes(bool enabledByDefault, IEnumerable notes) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Expected O, but got Unknown //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) ColorDisposable val = new ColorDisposable(); try { val.Push(ImGuiCol.TextDisabled, (!enabledByDefault) ? ImGuiColors.DalamudYellow : ImGuiColors.ParsedBlue, true); ImGui.SameLine(); FontDisposable val2 = ImRaii.PushFont(UiBuilder.IconFont, true); try { if (!enabledByDefault) { ImGui.TextDisabled(FontAwesomeIcon.ExclamationTriangle.ToIconString()); } else { ImGui.TextDisabled(FontAwesomeIcon.InfoCircle.ToIconString()); } } finally { ((IDisposable)val2)?.Dispose(); } if (!ImGui.IsItemHovered()) { return; } TooltipDisposable val3 = ImRaii.Tooltip(); try { ImGui.TextColored(ImGuiColors.DalamudYellow, "While testing, the following issues have been found:"); foreach (string note in notes) { ImGui.BulletText(note); } } finally { ((TooltipDisposable)(ref val3)).Dispose(); } } finally { ((IDisposable)val)?.Dispose(); } } }