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 +++++++++++++++++++++++++++++++ Malmstone/Configuration.cs | 4 + Malmstone/Plugin.cs | 8 ++ Malmstone/Utils/MalmstoneXPCalculator.cs | 10 +++ Malmstone/Windows/ConfigWindow.cs | 69 +++++++++++++-- 5 files changed, 224 insertions(+), 7 deletions(-) create mode 100644 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); + } + + + } +} diff --git a/Malmstone/Configuration.cs b/Malmstone/Configuration.cs index e0d5a3c..a353e88 100644 --- a/Malmstone/Configuration.cs +++ b/Malmstone/Configuration.cs @@ -10,6 +10,10 @@ public class Configuration : IPluginConfiguration public int Version { get; set; } = 0; public int DefaultTargetRankProperty { get; set; } = 1; + public bool ShowProgressionToastPostMatch { get; set; } = true; + public bool ShowProgressionChatPostRW { get; set; } = true; + public bool ShowProgressionChatPostCC { get; set; } = true; + public bool ShowProgressionChatPostFL { get; set; } = true; // the below exist just to make saving less cumbersome public void Save() diff --git a/Malmstone/Plugin.cs b/Malmstone/Plugin.cs index 6f5e50c..20c3ad7 100644 --- a/Malmstone/Plugin.cs +++ b/Malmstone/Plugin.cs @@ -11,6 +11,7 @@ using Dalamud.Game.Text.SeStringHandling.Payloads; using System.Collections.Generic; using System.Linq; using Malmstone.Utils; +using Malmstone.Addons; namespace Malmstone; @@ -20,6 +21,8 @@ public sealed class Plugin : IDalamudPlugin [PluginService] internal static ITextureProvider TextureProvider { get; private set; } = null!; [PluginService] internal static ICommandManager CommandManager { get; private set; } = null!; [PluginService] internal static IChatGui Chat { get; private set; } = null!; + [PluginService] internal static IAddonLifecycle AddonLifeCycle { get; private set; } = null!; + [PluginService] internal static IToastGui ToastGui { get; private set; } = null!; private const string CommandName = "/pmalm"; @@ -28,7 +31,9 @@ public sealed class Plugin : IDalamudPlugin public readonly WindowSystem WindowSystem = new("Malmstone"); private ConfigWindow ConfigWindow { get; init; } private MainWindow MainWindow { get; init; } + internal readonly PvPService PvPService; + internal PvPMatchAddon PvPAddon; public Plugin() { @@ -37,6 +42,9 @@ public sealed class Plugin : IDalamudPlugin ConfigWindow = new ConfigWindow(this); MainWindow = new MainWindow(this); PvPService = new PvPService(); + PvPAddon = new PvPMatchAddon(this); + PvPAddon.EnableCrystallineConflictPostMatch(); + PvPAddon.EnableRivalWingsPostMatch(); WindowSystem.AddWindow(ConfigWindow); WindowSystem.AddWindow(MainWindow); diff --git a/Malmstone/Utils/MalmstoneXPCalculator.cs b/Malmstone/Utils/MalmstoneXPCalculator.cs index ab6fcf9..cc555a6 100644 --- a/Malmstone/Utils/MalmstoneXPCalculator.cs +++ b/Malmstone/Utils/MalmstoneXPCalculator.cs @@ -108,6 +108,16 @@ namespace Malmstone.Utils }; } + public static int GetXPTargetForCurrentLevel(int currentLevel) + { + if (currentLevel >= PvpLevels.Length) + { + return InfinityLevelExp; + } + return PvpLevels[currentLevel]; + + } + private static int CalculateRemainingXpForLevels(int currentLevel, int goalLevel, int currentProgress) { int remainingXp = 0; 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 5e12dcba54bb04586069eb38d3300ec3c395be1e Mon Sep 17 00:00:00 2001 From: Pinapelz Date: Mon, 2 Sep 2024 20:32:56 -0700 Subject: add settings button to main window --- Malmstone/Windows/MainWindow.cs | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/Malmstone/Windows/MainWindow.cs b/Malmstone/Windows/MainWindow.cs index 39addd4..08550d4 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, 480), + MinimumSize = new Vector2(440, 510), MaximumSize = new Vector2(float.MaxValue, float.MaxValue) }; @@ -43,10 +43,6 @@ namespace Malmstone.Windows { ImGui.Text($"Current Series Level: {pvpInfo.CurrentSeriesRank}"); ImGui.Text($"Current Level Experience Progress: {pvpInfo.SeriesExperience} XP"); - if (pvpInfo.CurrentSeriesRank != pvpInfo.ClaimedSeriesRank) - { - ImGui.Text("Don't forget to claim your rank rewards!"); - } ImGui.Spacing(); ImGui.Text("Target Series Level:"); @@ -111,6 +107,16 @@ namespace Malmstone.Windows ImGui.Spacing(); ImGui.BulletText($"Win: {xpResult.RivalWingsWin} " + (xpResult.RivalWingsWin == 1 ? "time" : "times")); ImGui.BulletText($"Lose: {xpResult.RivalWingsLose} " + (xpResult.RivalWingsLose == 1 ? "time" : "times")); + + ImGui.Separator(); + ImGui.Spacing(); + if (pvpInfo.CurrentSeriesRank != pvpInfo.ClaimedSeriesRank) + { + ImGui.SameLine(); + ImGui.Text("Don't forget to claim your rank rewards!"); + } + if (ImGui.Button("Settings")) + Plugin.ToggleConfigUI(); } else { -- 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(-) 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(-) 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(-) 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(-) 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