From 14a3bd895f297bbf503cf3734b65b4957b0b4ebe Mon Sep 17 00:00:00 2001 From: Pinapelz Date: Tue, 3 Sep 2024 21:31:11 -0700 Subject: add option to automatically open malmstone calculator when viewing series malmstone --- Malmstone/Plugin.cs | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'Malmstone/Plugin.cs') diff --git a/Malmstone/Plugin.cs b/Malmstone/Plugin.cs index 3a4c679..be9858a 100644 --- a/Malmstone/Plugin.cs +++ b/Malmstone/Plugin.cs @@ -12,6 +12,7 @@ using System.Collections.Generic; using System.Linq; using Malmstone.Utils; using Malmstone.Addons; +using Dalamud.Game.Addon.Lifecycle; namespace Malmstone; @@ -51,12 +52,15 @@ public sealed class Plugin : IDalamudPlugin PvPAddon.EnableFrontlinePostMatch(); if (Configuration.ShowProgressionToastPostMatch) PvPAddon.EnablePostMatchProgressionToast(); + if (Configuration.ShowMainWindowOnPVPReward) + EnablePVPRewardWindowAddon(); + 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) @@ -84,6 +88,8 @@ public sealed class Plugin : IDalamudPlugin PvPAddon.DisableFrontlinePostMatch(); if (Configuration.ShowProgressionToastPostMatch) PvPAddon.DisablePostMatchProgressionToast(); + if(Configuration.ShowMainWindowOnPVPReward) + DisablePVPRewardWindowAddon(); CommandManager.RemoveHandler(CommandName); } @@ -237,4 +243,16 @@ private void OnCommand(string command, string args) public void ToggleConfigUI() => ConfigWindow.Toggle(); public void ToggleMainUI() => MainWindow.Toggle(); + + public void EnablePVPRewardWindowAddon() + { + AddonLifeCycle.RegisterListener(AddonEvent.PostSetup, "PvpReward", MainWindow.OnOpenPVPRewardWindow); + AddonLifeCycle.RegisterListener(AddonEvent.PreFinalize, "PvpReward", MainWindow.OnClosePVPRewardWindow); + } + public void DisablePVPRewardWindowAddon() + { + AddonLifeCycle.UnregisterListener(AddonEvent.PostSetup, "PvpReward", MainWindow.OnOpenPVPRewardWindow); + AddonLifeCycle.UnregisterListener(AddonEvent.PreFinalize, "PvpReward", MainWindow.OnClosePVPRewardWindow); + } } + -- cgit v1.2.3