From 85e508a7ce96ae718e81b8a0dc0d9e1a1b53e4fe Mon Sep 17 00:00:00 2001 From: Ethan Henderson Date: Sun, 22 Sep 2024 11:48:06 -0600 Subject: [PATCH 01/11] Bump ECommons to get `AddRepo()` --- ECommons | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ECommons b/ECommons index d77c9db19..bfef0ebd2 160000 --- a/ECommons +++ b/ECommons @@ -1 +1 @@ -Subproject commit d77c9db195056fca9e855c7d142bc6cd8566258f +Subproject commit bfef0ebd25785940fdbae020a0c80488907595c2 From dafe41c24b700c24a82970058b2244c2a07d7fbc Mon Sep 17 00:00:00 2001 From: Ethan Henderson Date: Sun, 22 Sep 2024 11:49:11 -0600 Subject: [PATCH 02/11] Add Migration popup with instructions to move to Wrath Combo --- XIVSlothCombo/Window/Migration.cs | 252 ++++++++++++++++++++++++++++++ XIVSlothCombo/XIVSlothCombo.cs | 8 +- 2 files changed, 259 insertions(+), 1 deletion(-) create mode 100644 XIVSlothCombo/Window/Migration.cs diff --git a/XIVSlothCombo/Window/Migration.cs b/XIVSlothCombo/Window/Migration.cs new file mode 100644 index 000000000..23f082ce2 --- /dev/null +++ b/XIVSlothCombo/Window/Migration.cs @@ -0,0 +1,252 @@ +#region + +using System; +using System.Diagnostics; +using System.Linq; +using System.Numerics; +using System.Runtime.InteropServices; +using Dalamud.Interface; +using Dalamud.Interface.Utility; +using Dalamud.Interface.Utility.Raii; +using ECommons.DalamudServices; +using ECommons.Reflection; +using ImGuiNET; + +#endregion + +namespace XIVSlothCombo.Window; + +internal class MigrationWindow : Dalamud.Interface.Windowing.Window +{ + /// + /// The repository URL for WrathCombo. + /// + private const string RepoURL = "https://love.puni.sh/ment.json"; + + /// + /// Whether WrathCombo is installed. + /// + private readonly bool _wrathInstalled; + + /// + /// Open the migration window. + /// + /// + /// With a variety of flags and methods to bring it front and center; + /// + public MigrationWindow() : base("XIVSlothCombo to WrathCombo Migration") + { + IsOpen = true; + BringToFront(); + + Flags = ImGuiWindowFlags.NoMove + | ImGuiWindowFlags.AlwaysAutoResize + | ImGuiWindowFlags.NoResize + | ImGuiWindowFlags.NoScrollWithMouse + | ImGuiWindowFlags.NoScrollbar; + + var wrathPlugins = Svc.PluginInterface.InstalledPlugins + .Where(x => x.Name.ToLower().Replace(" ", "") == "wrathcombo") + .ToArray(); + _wrathInstalled = wrathPlugins.Length > 0; + } + + /// + /// Set up the large WindowPadding to center the content. + /// + public override void PreDraw() + { + ImGui.PushStyleVar(ImGuiStyleVar.WindowPadding, new Vector2(60, 60)); + } + + /// + /// Draw the migration window. + /// + public override void Draw() + { + #region Leading Text + + CenterText("XIVSlothCombo is now WrathCombo!"); + CenterText( + "Please follow the steps below to migrate to WrathCombo to continue receiving updates."); + CenterDisabledText("(WrathCombo will automatically import your settings)"); + + #endregion + + ImGui.Dummy(new Vector2(0, 30)); + + #region Installation Steps + + if (!_wrathInstalled) + using (ImRaii.Table("WrathMigrationSteps", 3)) + { + ImGui.TableNextRow(); + ImGui.TableSetColumnIndex(0); + + #region "Manual" Install Step #1 + + ImGui.Text("1. "); + ImGui.SameLine(); + if (ImGui.Button("Click to automatically Add the New Repository")) + { + DalamudReflector.AddRepo(RepoURL, true); + DalamudReflector.ReloadPluginMasters(); + } + + ImGui.Dummy(new Vector2(40, 0)); + ImGui.SameLine(); + ImGui.TextDisabled($"({RepoURL})"); + + #endregion + + #region "Manual" Install Step #2 + + ImGui.Text("2. "); + ImGui.SameLine(); + if (ImGui.Button("Open the Plugin Installer")) + Svc.PluginInterface.OpenPluginInstallerTo( + PluginInstallerOpenKind.AllPlugins, "WrathCombo"); + ImGui.SameLine(); + ImGui.Text("and install WrathCombo"); + + #endregion + + #region Separator + + ImGui.TableSetColumnIndex(1); + ImGui.Dummy(new Vector2(0, ImGui.CalcTextSize("W").Y * 1.5f)); + ImGui.Dummy(new Vector2(30, 0)); + ImGui.SameLine(); + ImGui.Text(" OR"); + ImGui.SameLine(); + ImGui.Dummy(new Vector2(30, 0)); + ImGui.TableSetColumnIndex(2); + + #endregion + + // A larger padding for the big, easy button + ImGui.PushStyleVar(ImGuiStyleVar.FramePadding, + new Vector2(ImGui.CalcTextSize("W").X * 2, + ImGui.CalcTextSize("W").Y * 1.75f)); + + if (ImGui.Button("\u002B Install WrathCombo for me")) + { + // Add the repository if it doesn't exist + if (!DalamudReflector.HasRepo(RepoURL)) + { + DalamudReflector.AddRepo(RepoURL, true); + DalamudReflector.ReloadPluginMasters(); + } + + //todo: use ECommons to install WrathCombo + } + + ImGui.PopStyleVar(); + } + + #endregion + + if (!_wrathInstalled) + ImGui.Dummy(new Vector2(0, 30)); + + #region Final Step + + CenterButtonAndText("Open the Plugin Installer", + "and disable then uninstall XIVSlothCombo", + () => Svc.PluginInterface.OpenPluginInstallerTo( + PluginInstallerOpenKind.InstalledPlugins, "XIVSlothCombo")); + + CenterDisabledText("XIVSlothCombo will not receive any further updates."); + + #endregion + + Center(); + } + + /// + /// Remove the large WindowPadding added in . + /// + public override void PostDraw() + { + ImGui.PopStyleVar(); // Remove the WindowPadding + } + + #region Content Centering + + private static void CenterText(string text) => ImGuiHelpers.CenteredText(text); + + private static void CenterDisabledText(string text) + { + ImGuiHelpers.CenterCursorForText(text); + ImGui.TextDisabled(text); + } + + private static void CenterButtonAndText(string buttonText, string text, + Action onClick) + { + var offset = (ImGui.GetContentRegionAvail().X + - ImGuiHelpers.GetButtonSize(buttonText).X + - ImGui.GetStyle().ItemSpacing.X + - ImGui.CalcTextSize(text).X) + / 2; + + ImGui.SetCursorPosX(ImGui.GetCursorPosX() + offset); + if (ImGui.Button(buttonText + "##" + buttonText + text)) onClick(); + ImGui.SameLine(); + ImGui.Text(text); + } + + #endregion + + #region Window Centering + + [DllImport("user32.dll")] + [return: MarshalAs(UnmanagedType.Bool)] + private static extern bool GetWindowRect(HandleRef hWnd, out Rect lpRect); + + + [StructLayout(LayoutKind.Sequential)] + private struct Rect + { + public int Left; // x position of upper-left corner + public int Top; // y position of upper-left corner + public int Right; // x position of lower-right corner + public int Bottom; // y position of lower-right corner + public Vector2 Position => new Vector2(Left, Top); + public Vector2 Size => new Vector2(Right - Left, Bottom - Top); + + internal bool Contains(Vector2 v) => v.X > Position.X && + v.X < Position.X + Size.X && + v.Y > Position.Y && + v.Y < Position.Y + Size.Y; + } + + /// + /// Centers the GUI window to the game window. + /// + private void Center() + { + // Get the pointer to the window handle. + var hWnd = IntPtr.Zero; + foreach (var pList in Process.GetProcesses()) + if (pList.ProcessName is "ffxiv_dx11" or "ffxiv") + hWnd = pList.MainWindowHandle; + + // If failing to get the handle then abort. + if (hWnd == IntPtr.Zero) + return; + + // Get the game window rectangle + GetWindowRect(new HandleRef(null, hWnd), out var rGameWindow); + + // Get the size of the current window. + var vThisSize = ImGui.GetWindowSize(); + + // Set the position. + Position = rGameWindow.Position + new Vector2( + rGameWindow.Size.X / 2 - vThisSize.X / 2, + rGameWindow.Size.Y / 2 - vThisSize.Y / 2); + } + + #endregion +} diff --git a/XIVSlothCombo/XIVSlothCombo.cs b/XIVSlothCombo/XIVSlothCombo.cs index 8e21ca3a3..59b5c2d2a 100644 --- a/XIVSlothCombo/XIVSlothCombo.cs +++ b/XIVSlothCombo/XIVSlothCombo.cs @@ -34,6 +34,7 @@ public sealed partial class XIVSlothCombo : IDalamudPlugin private const string Command = "/scombo"; private readonly ConfigWindow ConfigWindow; + private readonly MigrationWindow MigrationWindow; private readonly TargetHelper TargetHelper; internal readonly AboutUs AboutUs; internal static XIVSlothCombo? P = null!; @@ -106,10 +107,12 @@ public XIVSlothCombo(IDalamudPluginInterface pluginInterface) ActionWatching.Enable(); Combos.JobHelpers.AST.Init(); + MigrationWindow = new MigrationWindow(); ConfigWindow = new ConfigWindow(); TargetHelper = new(); AboutUs = new(); ws = new(); + ws.AddWindow(MigrationWindow); ws.AddWindow(ConfigWindow); ws.AddWindow(TargetHelper); @@ -191,7 +194,10 @@ private static void ResetFeatures() Service.Configuration.ResetFeatures("v3.1.1.0_DRGRework", Enumerable.Range(6000, 800).ToArray()); } - private void DrawUI() => ConfigWindow.Draw(); + private void DrawUI() { + MigrationWindow.Draw(); + ConfigWindow.Draw(); + } private void PrintLoginMessage() { From aedf4e77f1b2ec6a1923ff1ded45a7dd990e30e9 Mon Sep 17 00:00:00 2001 From: Ethan Henderson Date: Sun, 22 Sep 2024 12:41:38 -0600 Subject: [PATCH 03/11] Constrain migration popup to Sloth, in case this is merged to Wrath for some reason --- XIVSlothCombo/XIVSlothCombo.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/XIVSlothCombo/XIVSlothCombo.cs b/XIVSlothCombo/XIVSlothCombo.cs index 59b5c2d2a..0540f0a49 100644 --- a/XIVSlothCombo/XIVSlothCombo.cs +++ b/XIVSlothCombo/XIVSlothCombo.cs @@ -195,7 +195,8 @@ private static void ResetFeatures() } private void DrawUI() { - MigrationWindow.Draw(); + if (Svc.PluginInterface.InternalName == "XIVSlothCombo") + MigrationWindow.Draw(); ConfigWindow.Draw(); } From 313566240de8f8ddcb38aea61b8b95e15c1277ba Mon Sep 17 00:00:00 2001 From: Ethan Henderson Date: Sun, 22 Sep 2024 13:31:59 -0600 Subject: [PATCH 04/11] Correctly Constrain migration popup to Sloth --- XIVSlothCombo/Window/Migration.cs | 6 ++++-- XIVSlothCombo/XIVSlothCombo.cs | 5 ++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/XIVSlothCombo/Window/Migration.cs b/XIVSlothCombo/Window/Migration.cs index 23f082ce2..8e743e217 100644 --- a/XIVSlothCombo/Window/Migration.cs +++ b/XIVSlothCombo/Window/Migration.cs @@ -16,7 +16,7 @@ namespace XIVSlothCombo.Window; -internal class MigrationWindow : Dalamud.Interface.Windowing.Window +public class MigrationWindow : Dalamud.Interface.Windowing.Window { /// /// The repository URL for WrathCombo. @@ -36,7 +36,9 @@ internal class MigrationWindow : Dalamud.Interface.Windowing.Window /// public MigrationWindow() : base("XIVSlothCombo to WrathCombo Migration") { - IsOpen = true; + if (Svc.PluginInterface.InternalName == "XIVSlothCombo") + IsOpen = true; + BringToFront(); Flags = ImGuiWindowFlags.NoMove diff --git a/XIVSlothCombo/XIVSlothCombo.cs b/XIVSlothCombo/XIVSlothCombo.cs index 0540f0a49..8bbc3bc77 100644 --- a/XIVSlothCombo/XIVSlothCombo.cs +++ b/XIVSlothCombo/XIVSlothCombo.cs @@ -34,7 +34,7 @@ public sealed partial class XIVSlothCombo : IDalamudPlugin private const string Command = "/scombo"; private readonly ConfigWindow ConfigWindow; - private readonly MigrationWindow MigrationWindow; + public readonly MigrationWindow MigrationWindow; private readonly TargetHelper TargetHelper; internal readonly AboutUs AboutUs; internal static XIVSlothCombo? P = null!; @@ -195,8 +195,7 @@ private static void ResetFeatures() } private void DrawUI() { - if (Svc.PluginInterface.InternalName == "XIVSlothCombo") - MigrationWindow.Draw(); + MigrationWindow.Draw(); ConfigWindow.Draw(); } From fc72793ffda597f86fc55ddaf686a0c7c3024829 Mon Sep 17 00:00:00 2001 From: Ethan Henderson Date: Sun, 22 Sep 2024 13:32:35 -0600 Subject: [PATCH 05/11] Add warning to main window that opens Migration popup --- XIVSlothCombo/Window/ConfigWindow.cs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/XIVSlothCombo/Window/ConfigWindow.cs b/XIVSlothCombo/Window/ConfigWindow.cs index 26d2badac..62bcbd889 100644 --- a/XIVSlothCombo/Window/ConfigWindow.cs +++ b/XIVSlothCombo/Window/ConfigWindow.cs @@ -8,6 +8,7 @@ using System.Collections.Generic; using System.Linq; using System.Numerics; +using Dalamud.Interface.Colors; using XIVSlothCombo.Attributes; using XIVSlothCombo.Combos; using XIVSlothCombo.Combos.PvE; @@ -150,6 +151,24 @@ public override void Draw() ImGui.Spacing(); #endif + + if (Svc.PluginInterface.InternalName == "XIVSlothCombo") + { + ImGui.Spacing(); + ImGui.Spacing(); + + var smoothChangeColor = GradientColor.Get(ImGuiColors.DalamudRed, ImGuiColors.DalamudYellow, 1500); + ImGui.PushStyleColor(ImGuiCol.Text, smoothChangeColor); + if (ImGui.Selectable("No Longer Updated!")) + { + if (P.MigrationWindow.IsOpen) + P.MigrationWindow.BringToFront(); + else + P.MigrationWindow.IsOpen = true; + } + ImGui.PopStyleColor(); + } + } ImGui.PopStyleVar(); From 8757f6146f3d468666a3d15160e36c8b849c9c0b Mon Sep 17 00:00:00 2001 From: Ethan Henderson Date: Wed, 13 Nov 2024 06:53:04 -0700 Subject: [PATCH 06/11] Call the new EC `AddPlugin()` method, give feedback to user --- XIVSlothCombo/Window/Migration.cs | 47 +++++++++++++++++++++++++++---- 1 file changed, 42 insertions(+), 5 deletions(-) diff --git a/XIVSlothCombo/Window/Migration.cs b/XIVSlothCombo/Window/Migration.cs index 8e743e217..452f8520e 100644 --- a/XIVSlothCombo/Window/Migration.cs +++ b/XIVSlothCombo/Window/Migration.cs @@ -5,6 +5,7 @@ using System.Linq; using System.Numerics; using System.Runtime.InteropServices; +using System.Threading.Tasks; using Dalamud.Interface; using Dalamud.Interface.Utility; using Dalamud.Interface.Utility.Raii; @@ -23,6 +24,18 @@ public class MigrationWindow : Dalamud.Interface.Windowing.Window /// private const string RepoURL = "https://love.puni.sh/ment.json"; + /// + /// The status of the automatic installation process. + /// + public static string AutomaticInstallStatus = ""; + + /// + /// The task for the automatic installation process, + /// or null after its result is read to update + /// . + /// + private static Task? _automaticInstallTask; + /// /// Whether WrathCombo is installed. /// @@ -98,6 +111,7 @@ public override void Draw() ImGui.Dummy(new Vector2(40, 0)); ImGui.SameLine(); ImGui.TextDisabled($"({RepoURL})"); + //ImGuiHelpers.ClickToCopyText($"({RepoURL})", RepoURL); #endregion @@ -126,6 +140,8 @@ public override void Draw() #endregion + #region "Automatic" Install + // A larger padding for the big, easy button ImGui.PushStyleVar(ImGuiStyleVar.FramePadding, new Vector2(ImGui.CalcTextSize("W").X * 2, @@ -133,17 +149,38 @@ public override void Draw() if (ImGui.Button("\u002B Install WrathCombo for me")) { - // Add the repository if it doesn't exist - if (!DalamudReflector.HasRepo(RepoURL)) + DalamudReflector.AddPlugin(RepoURL, "WrathCombo"); + AutomaticInstallStatus = "Being installed..."; + } + + #region Installation Status + + if (_automaticInstallTask is { IsCompleted: true }) + { + // Get the result of the task + var success = ((Task)_automaticInstallTask).Result; + + // Give the user feedback + if (success) { - DalamudReflector.AddRepo(RepoURL, true); - DalamudReflector.ReloadPluginMasters(); + AutomaticInstallStatus = "Installed!"; + Svc.Commands.ProcessCommand("/wrath"); // Open WrathCombo + } + else + { + AutomaticInstallStatus = "Installation Failed."; } - //todo: use ECommons to install WrathCombo + _automaticInstallTask = null; // Allow retrying } + ImGui.Text(AutomaticInstallStatus); + + #endregion + ImGui.PopStyleVar(); + + #endregion } #endregion From 620f37af02f9d5ccecdbbbd23ac7b440a876eb29 Mon Sep 17 00:00:00 2001 From: Ethan Henderson Date: Wed, 13 Nov 2024 10:16:38 -0700 Subject: [PATCH 07/11] Fully report on automatic installation success or failure --- XIVSlothCombo/Window/Migration.cs | 36 ++++++++++++++++++++++++------- 1 file changed, 28 insertions(+), 8 deletions(-) diff --git a/XIVSlothCombo/Window/Migration.cs b/XIVSlothCombo/Window/Migration.cs index 452f8520e..73e4e6fcb 100644 --- a/XIVSlothCombo/Window/Migration.cs +++ b/XIVSlothCombo/Window/Migration.cs @@ -7,6 +7,8 @@ using System.Runtime.InteropServices; using System.Threading.Tasks; using Dalamud.Interface; +using Dalamud.Interface.Colors; +using Dalamud.Interface.Style; using Dalamud.Interface.Utility; using Dalamud.Interface.Utility.Raii; using ECommons.DalamudServices; @@ -17,6 +19,14 @@ namespace XIVSlothCombo.Window; +public class MigrationAutoInstallStatus +{ + public const string None = ""; + public const string Installing = "Being installed..."; + public const string Installed = "Installed Successfully"; + public const string Failed = "Installation Failed"; +} + public class MigrationWindow : Dalamud.Interface.Windowing.Window { /// @@ -27,7 +37,7 @@ public class MigrationWindow : Dalamud.Interface.Windowing.Window /// /// The status of the automatic installation process. /// - public static string AutomaticInstallStatus = ""; + public static string AutomaticInstallStatus = MigrationAutoInstallStatus.None; /// /// The task for the automatic installation process, @@ -92,7 +102,7 @@ public override void Draw() #region Installation Steps - if (!_wrathInstalled) + if (!_wrathInstalled && AutomaticInstallStatus != MigrationAutoInstallStatus.Installed) using (ImRaii.Table("WrathMigrationSteps", 3)) { ImGui.TableNextRow(); @@ -111,7 +121,6 @@ public override void Draw() ImGui.Dummy(new Vector2(40, 0)); ImGui.SameLine(); ImGui.TextDisabled($"({RepoURL})"); - //ImGuiHelpers.ClickToCopyText($"({RepoURL})", RepoURL); #endregion @@ -149,8 +158,8 @@ public override void Draw() if (ImGui.Button("\u002B Install WrathCombo for me")) { - DalamudReflector.AddPlugin(RepoURL, "WrathCombo"); - AutomaticInstallStatus = "Being installed..."; + _automaticInstallTask = DalamudReflector.AddPlugin(RepoURL, "WrathCombo"); + AutomaticInstallStatus = MigrationAutoInstallStatus.Installing; } #region Installation Status @@ -163,18 +172,23 @@ public override void Draw() // Give the user feedback if (success) { - AutomaticInstallStatus = "Installed!"; + AutomaticInstallStatus = MigrationAutoInstallStatus.Installed; Svc.Commands.ProcessCommand("/wrath"); // Open WrathCombo } else { - AutomaticInstallStatus = "Installation Failed."; + AutomaticInstallStatus = MigrationAutoInstallStatus.Failed; } _automaticInstallTask = null; // Allow retrying } - ImGui.Text(AutomaticInstallStatus); + ImGui.Dummy(new Vector2(40, 0)); + ImGui.SameLine(); + if (AutomaticInstallStatus != MigrationAutoInstallStatus.Failed) + ImGui.Text(AutomaticInstallStatus); + else + ImGui.TextColored(ImGuiColors.DalamudRed, AutomaticInstallStatus); #endregion @@ -185,6 +199,12 @@ public override void Draw() #endregion + if (AutomaticInstallStatus == MigrationAutoInstallStatus.Installed) + { + var successText = "WrathCombo has been installed successfully!"; + ImGuiHelpers.CenterCursorForText(successText); + ImGui.TextColored(ImGuiColors.HealerGreen, successText); + } if (!_wrathInstalled) ImGui.Dummy(new Vector2(0, 30)); From 9cd6231d1684531ff0384e9f1325637b16482cf5 Mon Sep 17 00:00:00 2001 From: Ethan Henderson Date: Wed, 13 Nov 2024 10:23:42 -0700 Subject: [PATCH 08/11] Fix Type --- XIVSlothCombo/Window/Migration.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/XIVSlothCombo/Window/Migration.cs b/XIVSlothCombo/Window/Migration.cs index 73e4e6fcb..2fd37a782 100644 --- a/XIVSlothCombo/Window/Migration.cs +++ b/XIVSlothCombo/Window/Migration.cs @@ -201,7 +201,7 @@ public override void Draw() if (AutomaticInstallStatus == MigrationAutoInstallStatus.Installed) { - var successText = "WrathCombo has been installed successfully!"; + var successText = "Wrath Combo has been installed successfully!"; ImGuiHelpers.CenterCursorForText(successText); ImGui.TextColored(ImGuiColors.HealerGreen, successText); } From 99b7c2df667c603bf9b20b06a50d6036563a10f6 Mon Sep 17 00:00:00 2001 From: Ethan Henderson Date: Wed, 13 Nov 2024 11:54:00 -0700 Subject: [PATCH 09/11] Automatically mark Sloth for deletion after auto install, and add button to delete Sloth immediately --- XIVSlothCombo/Window/Migration.cs | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/XIVSlothCombo/Window/Migration.cs b/XIVSlothCombo/Window/Migration.cs index 2fd37a782..c97c04ad1 100644 --- a/XIVSlothCombo/Window/Migration.cs +++ b/XIVSlothCombo/Window/Migration.cs @@ -174,6 +174,9 @@ public override void Draw() { AutomaticInstallStatus = MigrationAutoInstallStatus.Installed; Svc.Commands.ProcessCommand("/wrath"); // Open WrathCombo + object localPlugin; + DalamudReflector.TryGetLocalPlugin(out localPlugin, out _, out _); + localPlugin.Call("ScheduleDeletion", [true]); } else { @@ -204,16 +207,19 @@ public override void Draw() var successText = "Wrath Combo has been installed successfully!"; ImGuiHelpers.CenterCursorForText(successText); ImGui.TextColored(ImGuiColors.HealerGreen, successText); + CenterDisabledText("(XIVSlothCombo has been marked for deletion next restart)"); } if (!_wrathInstalled) ImGui.Dummy(new Vector2(0, 30)); #region Final Step - CenterButtonAndText("Open the Plugin Installer", - "and disable then uninstall XIVSlothCombo", + CenterButtonAndTextAndButton("Open the Plugin Installer", + "and disable then", () => Svc.PluginInterface.OpenPluginInstallerTo( - PluginInstallerOpenKind.InstalledPlugins, "XIVSlothCombo")); + PluginInstallerOpenKind.InstalledPlugins, "XIVSlothCombo"), + "uninstall XIVSlothCombo", + DalamudReflector.RemoveCurrentPlugin); CenterDisabledText("XIVSlothCombo will not receive any further updates."); @@ -240,11 +246,13 @@ private static void CenterDisabledText(string text) ImGui.TextDisabled(text); } - private static void CenterButtonAndText(string buttonText, string text, - Action onClick) + private static void CenterButtonAndTextAndButton(string buttonText, string text, + Action onClick, string button2Text, Action onClick2) { var offset = (ImGui.GetContentRegionAvail().X - ImGuiHelpers.GetButtonSize(buttonText).X + - ImGuiHelpers.GetButtonSize(button2Text).X + - ImGui.GetStyle().ItemSpacing.X - ImGui.GetStyle().ItemSpacing.X - ImGui.CalcTextSize(text).X) / 2; @@ -253,6 +261,8 @@ private static void CenterButtonAndText(string buttonText, string text, if (ImGui.Button(buttonText + "##" + buttonText + text)) onClick(); ImGui.SameLine(); ImGui.Text(text); + ImGui.SameLine(); + if (ImGui.Button(button2Text + "##" + button2Text + text)) onClick2(); } #endregion From 9feaccc5d34bc812730829d633c2f0b34349118c Mon Sep 17 00:00:00 2001 From: Ethan Henderson Date: Wed, 13 Nov 2024 12:41:41 -0700 Subject: [PATCH 10/11] Bump ECommons to latest to include the required `AddPlugin()`,etc methods --- ECommons | 2 +- XIVSlothCombo/Window/Migration.cs | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/ECommons b/ECommons index 0e0cc76e4..c60397180 160000 --- a/ECommons +++ b/ECommons @@ -1 +1 @@ -Subproject commit 0e0cc76e4197e28b2576502f8a059815ce0a3aa4 +Subproject commit c603971801d2fc922dba39ff0970ffa890116e33 diff --git a/XIVSlothCombo/Window/Migration.cs b/XIVSlothCombo/Window/Migration.cs index c97c04ad1..e10386a0a 100644 --- a/XIVSlothCombo/Window/Migration.cs +++ b/XIVSlothCombo/Window/Migration.cs @@ -8,7 +8,6 @@ using System.Threading.Tasks; using Dalamud.Interface; using Dalamud.Interface.Colors; -using Dalamud.Interface.Style; using Dalamud.Interface.Utility; using Dalamud.Interface.Utility.Raii; using ECommons.DalamudServices; From ab54d25d5d49047cbe9d6536b9662d9f1faadd2c Mon Sep 17 00:00:00 2001 From: Ethan Henderson Date: Sun, 17 Nov 2024 10:01:20 -0700 Subject: [PATCH 11/11] RIP PunishXIV/WrathCombo#3 --- XIVSlothCombo/Window/Migration.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/XIVSlothCombo/Window/Migration.cs b/XIVSlothCombo/Window/Migration.cs index e10386a0a..f288f0724 100644 --- a/XIVSlothCombo/Window/Migration.cs +++ b/XIVSlothCombo/Window/Migration.cs @@ -93,7 +93,7 @@ public override void Draw() CenterText("XIVSlothCombo is now WrathCombo!"); CenterText( "Please follow the steps below to migrate to WrathCombo to continue receiving updates."); - CenterDisabledText("(WrathCombo will automatically import your settings)"); + //CenterDisabledText("(WrathCombo will automatically import your settings)"); #endregion