From 144616456392d727501a2057a7fc3916418ffddb Mon Sep 17 00:00:00 2001 From: Pinapelz Date: Mon, 2 Sep 2024 00:53:22 -0700 Subject: implement basic postmatch toast and chat message reports --- Malmstone/Windows/ConfigWindow.cs | 69 +++++++++++++++++++++++++++++++++++---- 1 file changed, 62 insertions(+), 7 deletions(-) (limited to 'Malmstone/Windows/ConfigWindow.cs') diff --git a/Malmstone/Windows/ConfigWindow.cs b/Malmstone/Windows/ConfigWindow.cs index 2c2895b..494c7cc 100644 --- a/Malmstone/Windows/ConfigWindow.cs +++ b/Malmstone/Windows/ConfigWindow.cs @@ -8,14 +8,15 @@ namespace Malmstone.Windows; public class ConfigWindow : Window, IDisposable { private Configuration Configuration; + private Plugin Plugin; - public ConfigWindow(Plugin plugin) : base("Malmstone Config") + public ConfigWindow(Plugin Plugin) : base("Malmstone Config") { Flags = ImGuiWindowFlags.NoResize | ImGuiWindowFlags.NoCollapse | ImGuiWindowFlags.NoScrollbar | ImGuiWindowFlags.NoScrollWithMouse; - - Size = new Vector2(232, 150); - Configuration = plugin.Configuration; + Size = new Vector2(350, 400); + Configuration = Plugin.Configuration; + this.Plugin = Plugin; } public void Dispose() { } @@ -33,14 +34,68 @@ public class ConfigWindow : Window, IDisposable if (savedTargetSeriesRank < 1) savedTargetSeriesRank = 1; if (savedTargetSeriesRank > 107397) savedTargetSeriesRank = 107397; Configuration.DefaultTargetRankProperty = savedTargetSeriesRank; + Configuration.Save(); } - ImGui.Spacing(); + ImGui.Separator(); + + ImGui.Text("Show XP to next level after PVP matches"); + var showProgressionToastPostMatch = Configuration.ShowProgressionToastPostMatch; + if (ImGui.Checkbox("##ShowProgressionToastPostMatch", ref showProgressionToastPostMatch)) + { + Configuration.ShowProgressionToastPostMatch = showProgressionToastPostMatch; + Configuration.Save(); + } + + ImGui.Separator(); + ImGui.Text("Show matches to next rank in chat postmatch"); + - if (ImGui.Button("Save and Close")) + var showCCMatchesRemainingPostGame = Configuration.ShowProgressionChatPostCC; + if (ImGui.Checkbox("##ShowCCMatchesRemainingPostGame", ref showCCMatchesRemainingPostGame)) { + Configuration.ShowProgressionChatPostCC = showCCMatchesRemainingPostGame; + if (showCCMatchesRemainingPostGame) + Plugin.PvPAddon.EnableCrystallineConflictPostMatch(); + else + Plugin.PvPAddon.DisableCrystallineConflictPostMatch(); Configuration.Save(); - IsOpen = false; } + ImGui.SameLine(); + ImGui.Text("Crystalline Conflict"); + + + var showFLMatchesRemainingPostGame = Configuration.ShowProgressionChatPostFL; + if (ImGui.Checkbox("##ShowFLMatchesRemainingPostGame", ref showFLMatchesRemainingPostGame)) + { + Configuration.ShowProgressionChatPostFL = showFLMatchesRemainingPostGame; + if (showFLMatchesRemainingPostGame) + Plugin.PvPAddon.EnableFrontlinePostMatch(); + else + Plugin.PvPAddon.DisableFrontlinePostMatch(); + Configuration.Save(); + } + ImGui.SameLine(); + ImGui.Text("Frontlines"); + + + var showRWMatchesRemainingPostGame = Configuration.ShowProgressionChatPostRW; + if (ImGui.Checkbox("##ShowRWMatchesRemainingPostGame", ref showRWMatchesRemainingPostGame)) + { + Configuration.ShowProgressionChatPostRW = showRWMatchesRemainingPostGame; + if (showRWMatchesRemainingPostGame) + Plugin.PvPAddon.EnableRivalWingsPostMatch(); + else + Plugin.PvPAddon.DisableRivalWingsPostMatch(); + Configuration.Save(); + } + ImGui.SameLine(); + ImGui.Text("Rival Wings"); + + + ImGui.Separator(); + ImGui.Spacing(); + ImGui.Text("Changes saved automatically"); + } } -- cgit v1.2.3 From fcecdca25688aca015d352602b7daf2610522d97 Mon Sep 17 00:00:00 2001 From: Pinapelz Date: Mon, 2 Sep 2024 20:34:32 -0700 Subject: add configuration options for showing different toast types --- Malmstone/Addons/PvPMatchAddon.cs | 24 ++++++++++++++++++++---- Malmstone/Configuration.cs | 1 + Malmstone/Plugin.cs | 14 +++++++++++--- Malmstone/Windows/ConfigWindow.cs | 24 +++++++++++++++++++++++- 4 files changed, 55 insertions(+), 8 deletions(-) (limited to 'Malmstone/Windows/ConfigWindow.cs') diff --git a/Malmstone/Addons/PvPMatchAddon.cs b/Malmstone/Addons/PvPMatchAddon.cs index 69c16e0..94d35b0 100644 --- a/Malmstone/Addons/PvPMatchAddon.cs +++ b/Malmstone/Addons/PvPMatchAddon.cs @@ -89,14 +89,30 @@ namespace Malmstone.Addons private void ShowSeriesProgressionToast(PvPSeriesInfo seriesInfo) { - Plugin.ToastGui.ShowNormal("Series Level " + seriesInfo.CurrentSeriesRank + - " " + seriesInfo.SeriesExperience + "/" + MalmstoneXPCalculator.GetXPTargetForCurrentLevel(seriesInfo.CurrentSeriesRank) + " EXP"); + switch (Plugin.Configuration.PostmatchProgressionToastType) + { + case 0: + Plugin.ToastGui.ShowNormal("Series Level " + seriesInfo.CurrentSeriesRank + + " " + seriesInfo.SeriesExperience + "/" + MalmstoneXPCalculator.GetXPTargetForCurrentLevel(seriesInfo.CurrentSeriesRank) + " EXP"); + break; + case 1: + Plugin.ToastGui.ShowQuest("Series Level " + seriesInfo.CurrentSeriesRank + + " " + seriesInfo.SeriesExperience + "/" + MalmstoneXPCalculator.GetXPTargetForCurrentLevel(seriesInfo.CurrentSeriesRank) + " EXP"); + break; + case 2: + Plugin.ToastGui.ShowError("Series Level " + seriesInfo.CurrentSeriesRank + + " " + seriesInfo.SeriesExperience + "/" + MalmstoneXPCalculator.GetXPTargetForCurrentLevel(seriesInfo.CurrentSeriesRank) + " EXP"); + break; + default: + Plugin.ToastGui.ShowNormal("Series Level " + seriesInfo.CurrentSeriesRank + + " " + seriesInfo.SeriesExperience + "/" + MalmstoneXPCalculator.GetXPTargetForCurrentLevel(seriesInfo.CurrentSeriesRank) + " EXP"); + break; + } + } private void ShowSeriesProgressionMessage(PvPSeriesInfo seriesInfo, PvPContentType contentType) { - Plugin.Chat.Print("Series Level " + seriesInfo.CurrentSeriesRank + - " - " + seriesInfo.SeriesExperience + "/" + MalmstoneXPCalculator.GetXPTargetForCurrentLevel(seriesInfo.CurrentSeriesRank) + " EXP"); var seString = new SeString(new List()); switch (contentType) { diff --git a/Malmstone/Configuration.cs b/Malmstone/Configuration.cs index a353e88..ce87dfd 100644 --- a/Malmstone/Configuration.cs +++ b/Malmstone/Configuration.cs @@ -10,6 +10,7 @@ public class Configuration : IPluginConfiguration public int Version { get; set; } = 0; public int DefaultTargetRankProperty { get; set; } = 1; + public int PostmatchProgressionToastType { get; set; } = 0; // 0 = normal, 1=quest, 2=error public bool ShowProgressionToastPostMatch { get; set; } = true; public bool ShowProgressionChatPostRW { get; set; } = true; public bool ShowProgressionChatPostCC { get; set; } = true; diff --git a/Malmstone/Plugin.cs b/Malmstone/Plugin.cs index 20c3ad7..4a387ec 100644 --- a/Malmstone/Plugin.cs +++ b/Malmstone/Plugin.cs @@ -43,10 +43,18 @@ public sealed class Plugin : IDalamudPlugin MainWindow = new MainWindow(this); PvPService = new PvPService(); PvPAddon = new PvPMatchAddon(this); - PvPAddon.EnableCrystallineConflictPostMatch(); - PvPAddon.EnableRivalWingsPostMatch(); + if (Configuration.ShowProgressionChatPostCC) + PvPAddon.EnableCrystallineConflictPostMatch(); + if (Configuration.ShowProgressionChatPostRW) + PvPAddon.EnableRivalWingsPostMatch(); + if (Configuration.ShowProgressionChatPostFL) + PvPAddon.EnableFrontlinePostMatch(); + if (Configuration.PostmatchProgressionToastType < 0 || Configuration.PostmatchProgressionToastType > 2) + { + Configuration.PostmatchProgressionToastType = 0; + } - WindowSystem.AddWindow(ConfigWindow); + WindowSystem.AddWindow(ConfigWindow); WindowSystem.AddWindow(MainWindow); CommandManager.AddHandler(CommandName, new CommandInfo(OnCommand) diff --git a/Malmstone/Windows/ConfigWindow.cs b/Malmstone/Windows/ConfigWindow.cs index 494c7cc..37b9490 100644 --- a/Malmstone/Windows/ConfigWindow.cs +++ b/Malmstone/Windows/ConfigWindow.cs @@ -9,6 +9,7 @@ public class ConfigWindow : Window, IDisposable { private Configuration Configuration; private Plugin Plugin; + private string[] ToastOptions = {"Normal", "Quest", "Error"}; public ConfigWindow(Plugin Plugin) : base("Malmstone Config") { @@ -40,6 +41,7 @@ public class ConfigWindow : Window, IDisposable ImGui.Separator(); ImGui.Text("Show XP to next level after PVP matches"); + ImGui.SameLine(); var showProgressionToastPostMatch = Configuration.ShowProgressionToastPostMatch; if (ImGui.Checkbox("##ShowProgressionToastPostMatch", ref showProgressionToastPostMatch)) { @@ -47,8 +49,28 @@ public class ConfigWindow : Window, IDisposable Configuration.Save(); } + ImGui.Text("Notification Type"); + int selectedPostMatchToastType = Configuration.PostmatchProgressionToastType; + if (ImGui.Combo("##MatchOptions", ref selectedPostMatchToastType, ToastOptions, ToastOptions.Length)) + { + switch (selectedPostMatchToastType) + { + case 0: + Plugin.ToastGui.ShowNormal("[Malmstone Calculator] Normal Toast Selected"); + break; + case 1: + Plugin.ToastGui.ShowQuest("[Malmstone Calculator] Quest Toast Selected"); + break; + case 2: + Plugin.ToastGui.ShowError("[Malmstone Calculator] Error Toast Selected"); + break; + } + Configuration.PostmatchProgressionToastType = selectedPostMatchToastType; + Configuration.Save(); + } + ImGui.Separator(); - ImGui.Text("Show matches to next rank in chat postmatch"); + ImGui.Text("Show matches until next rank in chat after"); var showCCMatchesRemainingPostGame = Configuration.ShowProgressionChatPostCC; -- cgit v1.2.3 From 49b0ad40b51845bbbde68a4133f2b15414cebade Mon Sep 17 00:00:00 2001 From: Pinapelz Date: Tue, 3 Sep 2024 12:07:00 -0700 Subject: window size and UI enhancements - reduce extra spacing in windows - make config window resizeable - move unclaimed reward notification to make main window more compact - remove addon trigger chat message --- Malmstone/Addons/PvPMatchAddon.cs | 5 +---- Malmstone/Windows/ConfigWindow.cs | 9 ++++++--- Malmstone/Windows/MainWindow.cs | 11 ++++++----- 3 files changed, 13 insertions(+), 12 deletions(-) (limited to 'Malmstone/Windows/ConfigWindow.cs') diff --git a/Malmstone/Addons/PvPMatchAddon.cs b/Malmstone/Addons/PvPMatchAddon.cs index bf5cc7d..7912665 100644 --- a/Malmstone/Addons/PvPMatchAddon.cs +++ b/Malmstone/Addons/PvPMatchAddon.cs @@ -39,7 +39,7 @@ namespace Malmstone.Addons public void DisableFrontlinePostMatch() { - Plugin.AddonLifeCycle.UnregisterListener(AddonEvent.PostSetup, "FrontlineRecord", OnFrontlineRecordTrigger); + Plugin.AddonLifeCycle.UnregisterListener(OnFrontlineRecordTrigger); } public void EnableRivalWingsPostMatch() @@ -55,7 +55,6 @@ namespace Malmstone.Addons // Runs on the result screen of the respective game mode private void OnCrystallineConflictRecordTrigger(AddonEvent eventType, AddonArgs addonInfo) { - Plugin.Chat.Print("Triggered MKS Record"); PvPSeriesInfo? seriesInfo = Plugin.PvPService.GetPvPSeriesInfo(); if (seriesInfo == null) return; if (Plugin.Configuration.ShowProgressionToastPostMatch) @@ -66,7 +65,6 @@ namespace Malmstone.Addons private void OnFrontlineRecordTrigger(AddonEvent eventType, AddonArgs addonInfo) { - Plugin.Chat.Print("Triggered Frontline Record"); PvPSeriesInfo? seriesInfo = Plugin.PvPService.GetPvPSeriesInfo(); if (seriesInfo == null) return; if (Plugin.Configuration.ShowProgressionToastPostMatch) @@ -77,7 +75,6 @@ namespace Malmstone.Addons private void OnRivalWingsRecordTrigger(AddonEvent eventType, AddonArgs addonInfo) { - Plugin.Chat.Print("Triggered Maneuvers Record"); PvPSeriesInfo? seriesInfo = Plugin.PvPService.GetPvPSeriesInfo(); if (seriesInfo == null) return; if (Plugin.Configuration.ShowProgressionToastPostMatch) diff --git a/Malmstone/Windows/ConfigWindow.cs b/Malmstone/Windows/ConfigWindow.cs index 37b9490..9858b7e 100644 --- a/Malmstone/Windows/ConfigWindow.cs +++ b/Malmstone/Windows/ConfigWindow.cs @@ -13,9 +13,12 @@ public class ConfigWindow : Window, IDisposable public ConfigWindow(Plugin Plugin) : base("Malmstone Config") { - Flags = ImGuiWindowFlags.NoResize | ImGuiWindowFlags.NoCollapse | ImGuiWindowFlags.NoScrollbar | - ImGuiWindowFlags.NoScrollWithMouse; - Size = new Vector2(350, 400); + Flags = ImGuiWindowFlags.NoCollapse | ImGuiWindowFlags.NoScrollbar | ImGuiWindowFlags.NoScrollWithMouse; + SizeConstraints = new WindowSizeConstraints + { + MinimumSize = new Vector2(350, 300), + MaximumSize = new Vector2(float.MaxValue, float.MaxValue) + }; Configuration = Plugin.Configuration; this.Plugin = Plugin; } diff --git a/Malmstone/Windows/MainWindow.cs b/Malmstone/Windows/MainWindow.cs index 6ead3a5..3cd53a4 100644 --- a/Malmstone/Windows/MainWindow.cs +++ b/Malmstone/Windows/MainWindow.cs @@ -24,7 +24,7 @@ namespace Malmstone.Windows { SizeConstraints = new WindowSizeConstraints { - MinimumSize = new Vector2(460, 530), + MinimumSize = new Vector2(460, 510), MaximumSize = new Vector2(float.MaxValue, float.MaxValue) }; @@ -110,13 +110,14 @@ namespace Malmstone.Windows ImGui.Separator(); ImGui.Spacing(); + if (ImGui.Button("Settings")) + Plugin.ToggleConfigUI(); + ImGui.SameLine(); if (pvpInfo.CurrentSeriesRank != pvpInfo.ClaimedSeriesRank) { - ImGui.SameLine(); - ImGui.Text("Don't forget to claim your rank rewards!"); + ImGui.Text("Don't forget to claim your Series Malmstone rewards!"); } - if (ImGui.Button("Settings")) - Plugin.ToggleConfigUI(); + } else { -- cgit v1.2.3 From 04b359033329d4bcd21b574e601601ffff135ff5 Mon Sep 17 00:00:00 2001 From: Pinapelz Date: Tue, 3 Sep 2024 16:36:53 -0700 Subject: move post match toast notification to record presetup - fixes and simplifies issue with managing different config combinations --- Malmstone/Addons/PvPMatchAddon.cs | 31 ++++++++++++++++++++----------- Malmstone/Plugin.cs | 2 ++ Malmstone/Windows/ConfigWindow.cs | 6 +++++- 3 files changed, 27 insertions(+), 12 deletions(-) (limited to 'Malmstone/Windows/ConfigWindow.cs') diff --git a/Malmstone/Addons/PvPMatchAddon.cs b/Malmstone/Addons/PvPMatchAddon.cs index 7912665..0acb617 100644 --- a/Malmstone/Addons/PvPMatchAddon.cs +++ b/Malmstone/Addons/PvPMatchAddon.cs @@ -22,6 +22,20 @@ namespace Malmstone.Addons this.Plugin = Plugin; } + public void EnablePostMatchProgressionToast() + { + Plugin.AddonLifeCycle.RegisterListener(AddonEvent.PreSetup, "MKSRecord", ShowSeriesProgressionToast); + Plugin.AddonLifeCycle.RegisterListener(AddonEvent.PreSetup, "FrontlineRecord", ShowSeriesProgressionToast); + Plugin.AddonLifeCycle.RegisterListener(AddonEvent.PreSetup, "ManeuversRecord", ShowSeriesProgressionToast); + } + + public void DisablePostMatchProgressionToast() + { + Plugin.AddonLifeCycle.UnregisterListener(AddonEvent.PreSetup, "MKSRecord", ShowSeriesProgressionToast); + Plugin.AddonLifeCycle.UnregisterListener(AddonEvent.PreSetup, "FrontlineRecord", ShowSeriesProgressionToast); + Plugin.AddonLifeCycle.UnregisterListener(AddonEvent.PreSetup, "ManeuversRecord", ShowSeriesProgressionToast); + } + public void EnableCrystallineConflictPostMatch() { Plugin.AddonLifeCycle.RegisterListener(AddonEvent.PostSetup, "MKSRecord", OnCrystallineConflictRecordTrigger); @@ -29,7 +43,7 @@ namespace Malmstone.Addons public void DisableCrystallineConflictPostMatch() { - Plugin.AddonLifeCycle.UnregisterListener(OnCrystallineConflictRecordTrigger); + Plugin.AddonLifeCycle.UnregisterListener(AddonEvent.PostSetup, "MKSRecord", OnCrystallineConflictRecordTrigger); } public void EnableFrontlinePostMatch() @@ -39,7 +53,7 @@ namespace Malmstone.Addons public void DisableFrontlinePostMatch() { - Plugin.AddonLifeCycle.UnregisterListener(OnFrontlineRecordTrigger); + Plugin.AddonLifeCycle.UnregisterListener(AddonEvent.PostSetup, "FrontlineRecord", OnFrontlineRecordTrigger); } public void EnableRivalWingsPostMatch() @@ -48,7 +62,7 @@ namespace Malmstone.Addons } public void DisableRivalWingsPostMatch() { - Plugin.AddonLifeCycle.UnregisterListener(OnRivalWingsRecordTrigger); + Plugin.AddonLifeCycle.UnregisterListener(AddonEvent.PostSetup, "ManeuversRecord", OnRivalWingsRecordTrigger); } @@ -57,8 +71,6 @@ namespace Malmstone.Addons { PvPSeriesInfo? seriesInfo = Plugin.PvPService.GetPvPSeriesInfo(); if (seriesInfo == null) return; - if (Plugin.Configuration.ShowProgressionToastPostMatch) - ShowSeriesProgressionToast(seriesInfo); if (Plugin.Configuration.ShowProgressionChatPostCC) ShowSeriesProgressionMessage(seriesInfo, PvPContentType.CrystallineConflict); } @@ -67,8 +79,6 @@ namespace Malmstone.Addons { PvPSeriesInfo? seriesInfo = Plugin.PvPService.GetPvPSeriesInfo(); if (seriesInfo == null) return; - if (Plugin.Configuration.ShowProgressionToastPostMatch) - ShowSeriesProgressionToast(seriesInfo); if (Plugin.Configuration.ShowProgressionChatPostFL) ShowSeriesProgressionMessage(seriesInfo, PvPContentType.RivalWings); } @@ -77,15 +87,14 @@ namespace Malmstone.Addons { PvPSeriesInfo? seriesInfo = Plugin.PvPService.GetPvPSeriesInfo(); if (seriesInfo == null) return; - if (Plugin.Configuration.ShowProgressionToastPostMatch) - ShowSeriesProgressionToast(seriesInfo); if (Plugin.Configuration.ShowProgressionChatPostRW) ShowSeriesProgressionMessage(seriesInfo, PvPContentType.RivalWings); } - - private void ShowSeriesProgressionToast(PvPSeriesInfo seriesInfo) + private void ShowSeriesProgressionToast(AddonEvent eventType, AddonArgs addonInfo) { + PvPSeriesInfo? seriesInfo = Plugin.PvPService.GetPvPSeriesInfo(); + if (seriesInfo == null) return; switch (Plugin.Configuration.PostmatchProgressionToastType) { case 0: diff --git a/Malmstone/Plugin.cs b/Malmstone/Plugin.cs index 4a387ec..b2cfde7 100644 --- a/Malmstone/Plugin.cs +++ b/Malmstone/Plugin.cs @@ -49,6 +49,8 @@ public sealed class Plugin : IDalamudPlugin PvPAddon.EnableRivalWingsPostMatch(); if (Configuration.ShowProgressionChatPostFL) PvPAddon.EnableFrontlinePostMatch(); + if (Configuration.ShowProgressionToastPostMatch) + PvPAddon.EnablePostMatchProgressionToast(); if (Configuration.PostmatchProgressionToastType < 0 || Configuration.PostmatchProgressionToastType > 2) { Configuration.PostmatchProgressionToastType = 0; diff --git a/Malmstone/Windows/ConfigWindow.cs b/Malmstone/Windows/ConfigWindow.cs index 9858b7e..e6376b3 100644 --- a/Malmstone/Windows/ConfigWindow.cs +++ b/Malmstone/Windows/ConfigWindow.cs @@ -43,12 +43,16 @@ public class ConfigWindow : Window, IDisposable ImGui.Separator(); - ImGui.Text("Show XP to next level after PVP matches"); + ImGui.Text("Show EXP progression after PVP matches"); ImGui.SameLine(); var showProgressionToastPostMatch = Configuration.ShowProgressionToastPostMatch; if (ImGui.Checkbox("##ShowProgressionToastPostMatch", ref showProgressionToastPostMatch)) { Configuration.ShowProgressionToastPostMatch = showProgressionToastPostMatch; + if (showProgressionToastPostMatch) + Plugin.PvPAddon.EnablePostMatchProgressionToast(); + else + Plugin.PvPAddon.DisablePostMatchProgressionToast(); Configuration.Save(); } -- cgit v1.2.3