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/Addons/PvPMatchAddon.cs | 140 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 140 insertions(+) create mode 100644 Malmstone/Addons/PvPMatchAddon.cs (limited to 'Malmstone/Addons/PvPMatchAddon.cs') diff --git a/Malmstone/Addons/PvPMatchAddon.cs b/Malmstone/Addons/PvPMatchAddon.cs new file mode 100644 index 0000000..69c16e0 --- /dev/null +++ b/Malmstone/Addons/PvPMatchAddon.cs @@ -0,0 +1,140 @@ +using Dalamud.Game.Addon.Lifecycle.AddonArgTypes; +using Dalamud.Game.Addon.Lifecycle; +using Malmstone.Services; +using Malmstone.Utils; +using Dalamud.Game.Text.SeStringHandling; +using System.Collections.Generic; +using Dalamud.Game.Text.SeStringHandling.Payloads; + +namespace Malmstone.Addons +{ + internal class PvPMatchAddon + { + private Plugin Plugin; + private enum PvPContentType + { + CrystallineConflict = 1, + RivalWings = 2, + Frontlines = 3, + } + public PvPMatchAddon(Plugin Plugin) + { + this.Plugin = Plugin; + } + + public void EnableCrystallineConflictPostMatch() + { + Plugin.AddonLifeCycle.RegisterListener(AddonEvent.PostSetup, "MKSRecord", OnCrystallineConflictRecordTrigger); + } + + public void DisableCrystallineConflictPostMatch() + { + Plugin.AddonLifeCycle.UnregisterListener(OnCrystallineConflictRecordTrigger); + } + + public void EnableRivalWingsPostMatch() + { + Plugin.AddonLifeCycle.RegisterListener(AddonEvent.PostSetup, "ManeuversRecord", OnRivalWingsRecordTrigger); + } + public void EnableFrontlinePostMatch() + { + Plugin.AddonLifeCycle.RegisterListener(AddonEvent.PostSetup, "FrontlineRecord", OnRivalWingsRecordTrigger); + } + + public void DisableFrontlinePostMatch() + { + Plugin.AddonLifeCycle.UnregisterListener(AddonEvent.PostSetup, "FrontlineRecord", OnRivalWingsRecordTrigger); + } + + public void DisableRivalWingsPostMatch() + { + Plugin.AddonLifeCycle.UnregisterListener(OnRivalWingsRecordTrigger); + } + + + // 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) + ShowSeriesProgressionToast(seriesInfo); + if (Plugin.Configuration.ShowProgressionChatPostCC) + ShowSeriesProgressionMessage(seriesInfo, PvPContentType.CrystallineConflict); + } + + 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) + ShowSeriesProgressionToast(seriesInfo); + if (Plugin.Configuration.ShowProgressionChatPostFL) + ShowSeriesProgressionMessage(seriesInfo, PvPContentType.RivalWings); + } + + 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) + ShowSeriesProgressionToast(seriesInfo); + if (Plugin.Configuration.ShowProgressionChatPostRW) + ShowSeriesProgressionMessage(seriesInfo, PvPContentType.RivalWings); + } + + + private void ShowSeriesProgressionToast(PvPSeriesInfo seriesInfo) + { + Plugin.ToastGui.ShowNormal("Series Level " + seriesInfo.CurrentSeriesRank + + " " + seriesInfo.SeriesExperience + "/" + MalmstoneXPCalculator.GetXPTargetForCurrentLevel(seriesInfo.CurrentSeriesRank) + " EXP"); + } + + 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) + { + case PvPContentType.CrystallineConflict: + MalmstoneXPCalculator.XpCalculationResult ccResultData = MalmstoneXPCalculator.CalculateCrystallineConflictMatches( + seriesInfo.CurrentSeriesRank, seriesInfo.CurrentSeriesRank + 1, seriesInfo.SeriesExperience); + if (ccResultData.CrystallineConflictLose == 0) break; + seString.Append(new TextPayload("[Crystalline Conflict to Level " + (seriesInfo.CurrentSeriesRank + 1) + "]\n")); + seString.Append(new UIForegroundPayload(35)); + seString.Append(new TextPayload($"Win: {ccResultData.CrystallineConflictWin} " + (ccResultData.CrystallineConflictWin == 1 ? "time" : "times") + "\n")); + seString.Append(new TextPayload($"Lose: {ccResultData.CrystallineConflictLose} " + (ccResultData.CrystallineConflictLose == 1 ? "time" : "times"))); + seString.Append(UIForegroundPayload.UIForegroundOff); + break; + case PvPContentType.Frontlines: + MalmstoneXPCalculator.XpCalculationResult flResultData = MalmstoneXPCalculator.CalculateCrystallineConflictMatches( + seriesInfo.CurrentSeriesRank, seriesInfo.CurrentSeriesRank + 1, seriesInfo.SeriesExperience); + if (flResultData.FrontlineDailyLose3rd == 0) break; + seString.Append(new TextPayload("[Frontlines to Level " + (seriesInfo.CurrentSeriesRank + 1) + "]\n")); + seString.Append(new UIForegroundPayload(518)); + seString.Append(new TextPayload($"Take 1st Place: {flResultData.FrontlineWin} " + (flResultData.FrontlineWin == 1 ? "time" : "times") +" (" + (flResultData.FrontlineDailyWin) + ")\n")); + seString.Append(new TextPayload($"Take 2nd Place: {flResultData.FrontlineWin} " + (flResultData.FrontlineWin == 1 ? "time" : "times") + " (" + (flResultData.FrontlineDailyLose2nd) + ")\n")); + seString.Append(new TextPayload($"Take 3rd Place: {flResultData.FrontlineWin} " + (flResultData.FrontlineWin == 1 ? "time" : "times") + " (" + (flResultData.FrontlineDailyLose3rd) + ")\n")); + seString.Append(UIForegroundPayload.UIForegroundOff); + break; + case PvPContentType.RivalWings: + MalmstoneXPCalculator.XpCalculationResult rwResultData = MalmstoneXPCalculator.CalculateRivalWingsMatches( + seriesInfo.CurrentSeriesRank, seriesInfo.CurrentSeriesRank + 1, seriesInfo.SeriesExperience); + if (rwResultData.RivalWingsLose == 0) break; + seString.Append(new TextPayload("[Rival Wings to Level " + (seriesInfo.CurrentSeriesRank + 1) + "]\n")); + seString.Append(new UIForegroundPayload(43)); + seString.Append(new TextPayload($"Win: {rwResultData.RivalWingsWin} " + (rwResultData.RivalWingsWin == 1 ? "time" : "times") + "\n")); + seString.Append(new TextPayload($"Lose: {rwResultData.RivalWingsLose} " + (rwResultData.RivalWingsLose == 1 ? "time" : "times"))); + seString.Append(UIForegroundPayload.UIForegroundOff); + break; + } + Plugin.Chat.Print(seString); + } + + + } +} -- 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/Addons/PvPMatchAddon.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 6d32f281e5d826fb7777580420a1eb301ca4baea Mon Sep 17 00:00:00 2001 From: Pinapelz Date: Tue, 3 Sep 2024 11:36:17 -0700 Subject: fix: frontline record trigger calling wrong function --- Malmstone/Addons/PvPMatchAddon.cs | 12 ++++++------ Malmstone/Windows/MainWindow.cs | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'Malmstone/Addons/PvPMatchAddon.cs') diff --git a/Malmstone/Addons/PvPMatchAddon.cs b/Malmstone/Addons/PvPMatchAddon.cs index 94d35b0..bf5cc7d 100644 --- a/Malmstone/Addons/PvPMatchAddon.cs +++ b/Malmstone/Addons/PvPMatchAddon.cs @@ -32,20 +32,20 @@ namespace Malmstone.Addons Plugin.AddonLifeCycle.UnregisterListener(OnCrystallineConflictRecordTrigger); } - public void EnableRivalWingsPostMatch() - { - Plugin.AddonLifeCycle.RegisterListener(AddonEvent.PostSetup, "ManeuversRecord", OnRivalWingsRecordTrigger); - } public void EnableFrontlinePostMatch() { - Plugin.AddonLifeCycle.RegisterListener(AddonEvent.PostSetup, "FrontlineRecord", OnRivalWingsRecordTrigger); + Plugin.AddonLifeCycle.RegisterListener(AddonEvent.PostSetup, "FrontlineRecord", OnFrontlineRecordTrigger); } public void DisableFrontlinePostMatch() { - Plugin.AddonLifeCycle.UnregisterListener(AddonEvent.PostSetup, "FrontlineRecord", OnRivalWingsRecordTrigger); + Plugin.AddonLifeCycle.UnregisterListener(AddonEvent.PostSetup, "FrontlineRecord", OnFrontlineRecordTrigger); } + public void EnableRivalWingsPostMatch() + { + Plugin.AddonLifeCycle.RegisterListener(AddonEvent.PostSetup, "ManeuversRecord", OnRivalWingsRecordTrigger); + } public void DisableRivalWingsPostMatch() { Plugin.AddonLifeCycle.UnregisterListener(OnRivalWingsRecordTrigger); diff --git a/Malmstone/Windows/MainWindow.cs b/Malmstone/Windows/MainWindow.cs index 08550d4..6ead3a5 100644 --- a/Malmstone/Windows/MainWindow.cs +++ b/Malmstone/Windows/MainWindow.cs @@ -24,7 +24,7 @@ namespace Malmstone.Windows { SizeConstraints = new WindowSizeConstraints { - MinimumSize = new Vector2(440, 510), + MinimumSize = new Vector2(460, 530), MaximumSize = new Vector2(float.MaxValue, float.MaxValue) }; -- 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/Addons/PvPMatchAddon.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/Addons/PvPMatchAddon.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