aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPinapelz <yukais@pinapelz.com>2024-09-03 21:31:11 -0700
committerPinapelz <yukais@pinapelz.com>2024-09-03 21:35:52 -0700
commit14a3bd895f297bbf503cf3734b65b4957b0b4ebe (patch)
treea6186c85382d736c6ed137dce4c851099b54732e
parenteffd23c9e254792d636ac43b17cb712a3fd49b1b (diff)
add option to automatically open malmstone calculator when viewing series malmstone
-rw-r--r--Malmstone/Configuration.cs1
-rw-r--r--Malmstone/Plugin.cs20
-rw-r--r--Malmstone/Windows/ConfigWindow.cs15
-rw-r--r--Malmstone/Windows/MainWindow.cs11
4 files changed, 45 insertions, 2 deletions
diff --git a/Malmstone/Configuration.cs b/Malmstone/Configuration.cs
index ce87dfd..eac9c63 100644
--- a/Malmstone/Configuration.cs
+++ b/Malmstone/Configuration.cs
@@ -15,6 +15,7 @@ public class Configuration : IPluginConfiguration
public bool ShowProgressionChatPostRW { get; set; } = true;
public bool ShowProgressionChatPostCC { get; set; } = true;
public bool ShowProgressionChatPostFL { get; set; } = true;
+ public bool ShowMainWindowOnPVPReward { 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 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);
+ }
}
+
diff --git a/Malmstone/Windows/ConfigWindow.cs b/Malmstone/Windows/ConfigWindow.cs
index e6376b3..7d9e44e 100644
--- a/Malmstone/Windows/ConfigWindow.cs
+++ b/Malmstone/Windows/ConfigWindow.cs
@@ -16,7 +16,7 @@ public class ConfigWindow : Window, IDisposable
Flags = ImGuiWindowFlags.NoCollapse | ImGuiWindowFlags.NoScrollbar | ImGuiWindowFlags.NoScrollWithMouse;
SizeConstraints = new WindowSizeConstraints
{
- MinimumSize = new Vector2(350, 300),
+ MinimumSize = new Vector2(370, 330),
MaximumSize = new Vector2(float.MaxValue, float.MaxValue)
};
Configuration = Plugin.Configuration;
@@ -124,6 +124,19 @@ public class ConfigWindow : Window, IDisposable
ImGui.Separator();
ImGui.Spacing();
+
+ ImGui.Text("Show calculations when viewing Series Malmstones");
+ ImGui.SameLine();
+ var showMainWindowOnPVPReward = Configuration.ShowMainWindowOnPVPReward;
+ if(ImGui.Checkbox("##ShowMainWindowOnPVPReward", ref showMainWindowOnPVPReward)){
+ if(showMainWindowOnPVPReward)
+ Plugin.EnablePVPRewardWindowAddon();
+ else
+ Plugin.DisablePVPRewardWindowAddon();
+ Configuration.ShowMainWindowOnPVPReward = showMainWindowOnPVPReward;
+ Configuration.Save();
+ }
+
ImGui.Text("Changes saved automatically");
}
diff --git a/Malmstone/Windows/MainWindow.cs b/Malmstone/Windows/MainWindow.cs
index 3cd53a4..4d4ca4c 100644
--- a/Malmstone/Windows/MainWindow.cs
+++ b/Malmstone/Windows/MainWindow.cs
@@ -1,5 +1,7 @@
using System;
using System.Numerics;
+using Dalamud.Game.Addon.Lifecycle.AddonArgTypes;
+using Dalamud.Game.Addon.Lifecycle;
using Dalamud.Interface.Windowing;
using ImGuiNET;
using Malmstone.Services;
@@ -124,6 +126,15 @@ namespace Malmstone.Windows
ImGui.Text("PvP Profile is not loaded.");
}
}
+ public void OnOpenPVPRewardWindow(AddonEvent eventType, AddonArgs addonInfo)
+ {
+ IsOpen = true;
+ }
+
+ public void OnClosePVPRewardWindow(AddonEvent eventType, AddonArgs addonInfo)
+ {
+ IsOpen = false;
+ }
}
}
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage