diff --git a/XIVSlothCombo/Combos/PvE/WHM.cs b/XIVSlothCombo/Combos/PvE/WHM.cs index 24902c5e7..90844b016 100644 --- a/XIVSlothCombo/Combos/PvE/WHM.cs +++ b/XIVSlothCombo/Combos/PvE/WHM.cs @@ -203,7 +203,6 @@ protected override uint Invoke(uint actionID, uint lastComboMove, float comboTim } else ActionFound = StoneGlareList.Contains(actionID); //default handling - Svc.Log.Debug($"HERE"); if (ActionFound) { WHMGauge? gauge = GetJobGauge(); diff --git a/XIVSlothCombo/Data/CustomComboCache.cs b/XIVSlothCombo/Data/CustomComboCache.cs index 1edbce42f..1f78b82a3 100644 --- a/XIVSlothCombo/Data/CustomComboCache.cs +++ b/XIVSlothCombo/Data/CustomComboCache.cs @@ -5,6 +5,7 @@ using FFXIVClientStructs.FFXIV.Client.Game; using System; using System.Collections.Concurrent; +using System.Reflection; using DalamudStatus = Dalamud.Game.ClientState.Statuses; // conflicts with structs if not defined namespace XIVSlothCombo.Data @@ -26,6 +27,8 @@ internal partial class CustomComboCache : IDisposable private delegate IntPtr GetActionCooldownSlotDelegate(IntPtr actionManager, int cooldownGroup); + private unsafe IntPtr CSAddress => (nint)(JobGaugeManager.Instance()->CurrentGauge); + /// public void Dispose() => Svc.Framework.Update -= Framework_Update; @@ -34,8 +37,11 @@ internal partial class CustomComboCache : IDisposable /// The job gauge. internal T GetJobGauge() where T : JobGaugeBase { - if (!jobGaugeCache.TryGetValue(typeof(T), out JobGaugeBase? gauge)) - gauge = jobGaugeCache[typeof(T)] = Svc.Gauges.Get(); + //Lifted from Dalamud, using our own cache instead of theirs + if (!this.jobGaugeCache.TryGetValue(typeof(T), out var gauge) || gauge.Address != this.CSAddress) + { + gauge = this.jobGaugeCache[typeof(T)] = (T)Activator.CreateInstance(typeof(T), BindingFlags.NonPublic | BindingFlags.Instance, null, new object[] { this.CSAddress }, null); + } return (T)gauge; }