aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPinapelz <yukais@pinapelz.com>2024-09-09 21:59:06 -0700
committerPinapelz <yukais@pinapelz.com>2024-09-09 21:59:06 -0700
commit0f327ab73f43324943440ba075023e84581faf5d (patch)
tree4bf93b2809c43fbbd08fe77c0b7b9e28c152c1f2
parent98b1736f9f578f4d66698de321ae7cc85a534ce3 (diff)
fix: initial cache is occuring when client is not fully loaded
-rw-r--r--Malmstone/Addons/PvPMatchAddon.cs2
-rw-r--r--Malmstone/Plugin.cs21
2 files changed, 21 insertions, 2 deletions
diff --git a/Malmstone/Addons/PvPMatchAddon.cs b/Malmstone/Addons/PvPMatchAddon.cs
index 44679c4..b416f16 100644
--- a/Malmstone/Addons/PvPMatchAddon.cs
+++ b/Malmstone/Addons/PvPMatchAddon.cs
@@ -164,6 +164,8 @@ namespace Malmstone.Addons
Plugin.Configuration.Save();
}
Plugin.PvPService.UpdateFrontlineResultCache();
+ Plugin.Logger.Debug("Frontline Record Re-cached As: " + Plugin.PvPService.CachedFrontlineResults.FirstPlace +
+ " Second: " + Plugin.PvPService.CachedFrontlineResults.SecondPlace + " Third: " + Plugin.PvPService.CachedFrontlineResults.ThirdPlace);
}
private void ShowSeriesProgressionToast(AddonEvent eventType, AddonArgs addonInfo)
diff --git a/Malmstone/Plugin.cs b/Malmstone/Plugin.cs
index 66171b0..ffa1ea9 100644
--- a/Malmstone/Plugin.cs
+++ b/Malmstone/Plugin.cs
@@ -13,18 +13,20 @@ using System.Linq;
using Malmstone.Utils;
using Malmstone.Addons;
using Dalamud.Game.Addon.Lifecycle;
+using FFXIVClientStructs.FFXIV.Client.System.Framework;
namespace Malmstone;
public sealed class Plugin : IDalamudPlugin
{
[PluginService] internal static IDalamudPluginInterface PluginInterface { get; private set; } = null!;
- [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!;
[PluginService] internal static IPluginLog Logger { get; set; } = default!;
+ [PluginService] internal static IClientState ClientState { get; private set; } = null!;
+ [PluginService] internal static IFramework Framework { get; private set; } = null!;
private const string CommandName = "/pmalm";
@@ -56,7 +58,7 @@ public sealed class Plugin : IDalamudPlugin
if (Configuration.ShowMainWindowOnPVPReward)
EnablePVPRewardWindowAddon();
- PvPService.UpdateFrontlineResultCache();
+ Logger.Debug("Initial Cache: " + PvPService.CachedFrontlineResults.FirstPlace + " " + PvPService.CachedFrontlineResults.SecondPlace + " " + PvPService.CachedFrontlineResults.ThirdPlace);
if (Configuration.IsPrimedForBuff)
PvPService.ConsecutiveThirdPlaceFrontline = 1;
@@ -76,6 +78,7 @@ public sealed class Plugin : IDalamudPlugin
PluginInterface.UiBuilder.Draw += DrawUI;
PluginInterface.UiBuilder.OpenConfigUi += ToggleConfigUI;
PluginInterface.UiBuilder.OpenMainUi += ToggleMainUI;
+ Framework.Update += CheckPlayerLoaded;
}
public void Dispose()
@@ -243,6 +246,20 @@ private void OnCommand(string command, string args)
}
+ private void CheckPlayerLoaded(IFramework framework)
+ {
+ if(ClientState.LocalPlayer != null)
+ {
+ if (Configuration.TrackFrontlineBonus)
+ {
+ Logger.Debug("Player has loaded in. Attempting to get Frontline PVP Profile Data");
+ PvPService.UpdateFrontlineResultCache();
+ Logger.Debug("Initial Frontline Data Cached As: First: " + PvPService.CachedFrontlineResults.FirstPlace +
+ " Second: " + PvPService.CachedFrontlineResults.SecondPlace + " Third: " + PvPService.CachedFrontlineResults.ThirdPlace);
+ Framework.Update -= CheckPlayerLoaded;
+ }
+ }
+ }
private void DrawUI() => WindowSystem.Draw();
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage