aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPinapelz <yukais@pinapelz.com>2024-09-16 21:48:11 -0700
committerPinapelz <yukais@pinapelz.com>2024-09-16 21:48:11 -0700
commit745b939bb15bf41725d4e86e65366a1a8793bbc7 (patch)
tree07b190c52400d8bd6ac960d8b8b21e9e779e0952
parent481ec3932c98771310cf9d834ebad8446b01f5c4 (diff)
add option to replace in game UI series level with plugin tracked series level (tracking for series level above 30)
-rw-r--r--Malmstone/Configuration.cs2
-rw-r--r--Malmstone/Plugin.cs34
-rw-r--r--Malmstone/Utils/UIChanger.cs49
-rw-r--r--Malmstone/Windows/ConfigWindow.cs40
4 files changed, 118 insertions, 7 deletions
diff --git a/Malmstone/Configuration.cs b/Malmstone/Configuration.cs
index bd4de22..e20dd1e 100644
--- a/Malmstone/Configuration.cs
+++ b/Malmstone/Configuration.cs
@@ -24,6 +24,8 @@ public class Configuration : IPluginConfiguration
public bool IsPrimedForBuff { get; set; } = false;
public bool OverrideShowMatchesToDefaultTargetGoal { get; set; } = false;
public Dictionary<ulong, int> ExtraLevelsMap { get; set; } = new Dictionary<ulong, int>();
+ public bool ShowTrueSeriesLevelPVPReward { get; set; } = true;
+ public bool ShowTrueSeriesLevelPVPProfile { 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 8277b93..bd1df32 100644
--- a/Malmstone/Plugin.cs
+++ b/Malmstone/Plugin.cs
@@ -38,6 +38,7 @@ public sealed class Plugin : IDalamudPlugin
internal readonly PvPService PvPService;
internal PvPMatchAddon PvPAddon;
+ internal UIChanger UIChanger;
internal int CachedSeriesLevel;
public Plugin()
@@ -48,6 +49,7 @@ public sealed class Plugin : IDalamudPlugin
MainWindow = new MainWindow(this);
PvPService = new PvPService();
PvPAddon = new PvPMatchAddon(this);
+ UIChanger = new UIChanger(this);
if (Configuration.ShowProgressionChatPostCC)
PvPAddon.EnableCrystallineConflictPostMatch();
if (Configuration.ShowProgressionChatPostRW)
@@ -56,8 +58,12 @@ public sealed class Plugin : IDalamudPlugin
PvPAddon.EnableFrontlinePostMatch();
if (Configuration.ShowProgressionToastPostMatch)
PvPAddon.EnablePostMatchProgressionToast();
- if (Configuration.ShowMainWindowOnPVPReward)
- EnablePVPRewardWindowAddon();
+ if(Configuration.ShowTrueSeriesLevelPVPProfile)
+ EnablePVPProfileReplaceSeriesLevel();
+ if(Configuration.ShowTrueSeriesLevelPVPReward)
+ EnablePVPRewardReplaceSeriesLevel();
+
+ EnablePVPRewardWindowAddon();
if (Configuration.IsPrimedForBuff)
PvPService.ConsecutiveThirdPlaceFrontline = 1;
@@ -98,8 +104,11 @@ public sealed class Plugin : IDalamudPlugin
PvPAddon.DisableFrontlinePostMatch();
if (Configuration.ShowProgressionToastPostMatch)
PvPAddon.DisablePostMatchProgressionToast();
- if(Configuration.ShowMainWindowOnPVPReward)
- DisablePVPRewardWindowAddon();
+ if (Configuration.ShowTrueSeriesLevelPVPProfile)
+ DisablePVPProfileReplaceSeriesLevel();
+ if (Configuration.ShowTrueSeriesLevelPVPReward)
+ DisablePVPRewardReplaceSeriesLevel();
+ DisablePVPRewardWindowAddon();
CommandManager.RemoveHandler(CommandName);
}
@@ -281,8 +290,9 @@ private void OnCommand(string command, string args)
public void OnOpenPVPRewardWindow(AddonEvent eventType, AddonArgs addonInfo)
{
- if(PvPService.GetPvPSeriesInfo() != null)
- CachedSeriesLevel = PvPService.GetPvPSeriesInfo().CurrentSeriesRank;
+ PvPSeriesInfo? PvPSeriesInfo = PvPService.GetPvPSeriesInfo();
+ if(PvPSeriesInfo != null)
+ CachedSeriesLevel = PvPSeriesInfo.CurrentSeriesRank;
Logger.Debug("PVPRewardWindow Open, Current Series Level Cached: " + CachedSeriesLevel);
MainWindow.OnOpenPVPRewardWindow();
}
@@ -294,13 +304,18 @@ private void OnCommand(string command, string args)
{
if (PvPService.GetPvPSeriesInfo() != null)
{
+ // TODO NEED TESTING!!!
// If player claimed Extra Level reward (above Level 30) and we detect a decrease in Series level
- if(PvPService.GetPvPSeriesInfo().CurrentSeriesRank < CachedSeriesLevel && CachedSeriesLevel > 30)
+ PvPSeriesInfo? PvPSeriesInfo = PvPService.GetPvPSeriesInfo();
+ if (PvPSeriesInfo == null)
+ return;
+ if(PvPSeriesInfo.CurrentSeriesRank < CachedSeriesLevel && CachedSeriesLevel > 30)
{
var extraLevels = CachedSeriesLevel - 30;
Logger.Debug("Player claimed extra levels: " + extraLevels+ ", new ExtraLevels is " + GetSavedExtraLevels() + extraLevels);
IncrementExtraLevels(extraLevels);
Configuration.Save();
+
}
else
{
@@ -357,6 +372,11 @@ private void OnCommand(string command, string args)
AddonLifeCycle.UnregisterListener(AddonEvent.PostRefresh, "PvpReward", UpdateExtraLevels);
AddonLifeCycle.UnregisterListener(AddonEvent.PreFinalize, "PvpReward", OnClosePVPRewardWindow);
}
+
+ public void EnablePVPProfileReplaceSeriesLevel() => AddonLifeCycle.RegisterListener(AddonEvent.PostDraw, "PvpProfile", UIChanger.ReplacePVPProfileWindowSeriesRank);
+ public void DisablePVPProfileReplaceSeriesLevel() => AddonLifeCycle.UnregisterListener(AddonEvent.PostDraw, "PvpProfile", UIChanger.ReplacePVPProfileWindowSeriesRank);
+ public void EnablePVPRewardReplaceSeriesLevel() => AddonLifeCycle.RegisterListener(AddonEvent.PostDraw, "PvpReward", UIChanger.ReplacePVPRewardWindowSeriesRank);
+ public void DisablePVPRewardReplaceSeriesLevel() => AddonLifeCycle.UnregisterListener(AddonEvent.PostDraw, "PvpReward", UIChanger.ReplacePVPRewardWindowSeriesRank);
}
diff --git a/Malmstone/Utils/UIChanger.cs b/Malmstone/Utils/UIChanger.cs
new file mode 100644
index 0000000..d764a83
--- /dev/null
+++ b/Malmstone/Utils/UIChanger.cs
@@ -0,0 +1,49 @@
+using Dalamud.Game.Addon.Lifecycle;
+using Dalamud.Game.Addon.Lifecycle.AddonArgTypes;
+using FFXIVClientStructs.FFXIV.Component.GUI;
+using Malmstone.Services;
+
+namespace Malmstone.Utils;
+
+public class UIChanger
+{
+ private Plugin Plugin;
+ public UIChanger(Plugin Plugin)
+ {
+ this.Plugin = Plugin;
+ }
+
+ public void ReplacePVPRewardWindowSeriesRank(AddonEvent eventType, AddonArgs addonInfo)
+ {
+ unsafe
+ {
+ var PvpRewardWindow = (AtkUnitBase*)addonInfo.Addon;
+ var SeriesLevelTextNode = PvpRewardWindow->GetTextNodeById(16);
+ PvPSeriesInfo? PvPSeriesInfo = Plugin.PvPService.GetPvPSeriesInfo();
+ if (SeriesLevelTextNode != null && PvPSeriesInfo != null)
+ {
+ var CurrentSeriesRank = PvPSeriesInfo.CurrentSeriesRank +
+ Plugin.GetSavedExtraLevels();
+ SeriesLevelTextNode->SetText(CurrentSeriesRank.ToString());
+ }
+ }
+ }
+
+ public void ReplacePVPProfileWindowSeriesRank(AddonEvent eventType, AddonArgs addonInfo)
+ {
+ unsafe
+ {
+ var PvpProfileWindow = (AtkUnitBase*)addonInfo.Addon;
+ var SeriesLevelTextNode = PvpProfileWindow->GetTextNodeById(24);
+ PvPSeriesInfo? PvPSeriesInfo = Plugin.PvPService.GetPvPSeriesInfo();
+ if (PvPSeriesInfo == null)
+ return;
+ var CurrentSeriesRank = PvPSeriesInfo.CurrentSeriesRank +
+ Plugin.GetSavedExtraLevels();
+ if (SeriesLevelTextNode != null)
+ {
+ SeriesLevelTextNode->SetText(CurrentSeriesRank.ToString());
+ }
+ }
+ }
+}
diff --git a/Malmstone/Windows/ConfigWindow.cs b/Malmstone/Windows/ConfigWindow.cs
index 3d3bd4e..1174940 100644
--- a/Malmstone/Windows/ConfigWindow.cs
+++ b/Malmstone/Windows/ConfigWindow.cs
@@ -280,6 +280,46 @@ public class ConfigWindow : Window, IDisposable
}
ImGui.SameLine();
ImGui.Text("Show calculations when viewing Series Malmstones");
+ ImGui.Separator();
+ var showTrueSeriesLevelPVPReward = Configuration.ShowTrueSeriesLevelPVPReward;
+ if (ImGui.Checkbox("##ShowTrueSeriesLevelPVPReward", ref showTrueSeriesLevelPVPReward))
+ {
+ if (showTrueSeriesLevelPVPReward)
+ Plugin.EnablePVPRewardReplaceSeriesLevel();
+ else
+ Plugin.DisablePVPRewardReplaceSeriesLevel();
+ Configuration.ShowTrueSeriesLevelPVPReward = showTrueSeriesLevelPVPReward;
+ Configuration.Save();
+ }
+ if (ImGui.IsItemHovered())
+ {
+ ImGui.BeginTooltip();
+ ImGui.Text("Show plugin tracked Series Level in the PVP Reward window (supports Series Levels above 30)");
+ ImGui.EndTooltip();
+ }
+ ImGui.SameLine();
+ ImGui.Text("Show true Series Level in PVP Reward window");
+
+ var showTrueSeriesLevelPVPProfile = Configuration.ShowTrueSeriesLevelPVPProfile;
+ if (ImGui.Checkbox("##ShowTrueSeriesLevelPVPProfile", ref showTrueSeriesLevelPVPProfile))
+ {
+ if (showTrueSeriesLevelPVPProfile)
+ Plugin.EnablePVPProfileReplaceSeriesLevel();
+ else
+ Plugin.DisablePVPProfileReplaceSeriesLevel();
+ Configuration.ShowTrueSeriesLevelPVPProfile = showTrueSeriesLevelPVPProfile;
+ Configuration.Save();
+ }
+ if (ImGui.IsItemHovered())
+ {
+ ImGui.BeginTooltip();
+ ImGui.Text("Show plugin tracked Series Level in the PVP Profile window (supports Series Levels above 30)");
+ ImGui.EndTooltip();
+ }
+ ImGui.SameLine();
+ ImGui.Text("Show true Series Level in PVP Profile window");
+
+
ImGui.EndTabItem();
}
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage