diff --git a/Dalamud/Game/ClientState/ClientState.cs b/Dalamud/Game/ClientState/ClientState.cs index 4af069e36..e12d542b1 100644 --- a/Dalamud/Game/ClientState/ClientState.cs +++ b/Dalamud/Game/ClientState/ClientState.cs @@ -38,6 +38,11 @@ namespace Dalamud.Game.ClientState /// public ulong LocalContentId => (ulong) Marshal.ReadInt64(Address.LocalContentId); + /// + /// The class facilitating Job Gauge data access + /// + public JobGauges JobGauges; + /// /// Set up client state access. /// @@ -52,6 +57,8 @@ namespace Dalamud.Game.ClientState this.ClientLanguage = startInfo.Language; this.Actors = new ActorTable(Address); + + this.JobGauges = new JobGauges(Address); } } } diff --git a/Dalamud/Game/ClientState/ClientStateAddressResolver.cs b/Dalamud/Game/ClientState/ClientStateAddressResolver.cs index 37d1fde18..afa5ef597 100644 --- a/Dalamud/Game/ClientState/ClientStateAddressResolver.cs +++ b/Dalamud/Game/ClientState/ClientStateAddressResolver.cs @@ -10,10 +10,12 @@ namespace Dalamud.Game.ClientState public sealed class ClientStateAddressResolver : BaseAddressResolver { public IntPtr ActorTable { get; private set; } public IntPtr LocalContentId { get; private set; } + public IntPtr JobGaugeData { get; set; } protected override void Setup64Bit(SigScanner sig) { ActorTable = sig.Module.BaseAddress + 0x1B29B40; LocalContentId = sig.Module.BaseAddress + 0x1B58B60; + JobGaugeData = sig.Module.BaseAddress + 0x1B2D4B4; } } } diff --git a/Dalamud/Game/ClientState/JobGauge.cs b/Dalamud/Game/ClientState/JobGauge.cs index e91b342fe..3e458fffc 100644 --- a/Dalamud/Game/ClientState/JobGauge.cs +++ b/Dalamud/Game/ClientState/JobGauge.cs @@ -8,18 +8,17 @@ using System.Text; using System.Threading.Tasks; namespace Dalamud.Game.ClientState { - public static class JobGauge { + public class JobGauges { + private ClientStateAddressResolver Address { get; } - private static IntPtr gaugeStart; - - public static void Init(ProcessModule module) { - gaugeStart = module.BaseAddress + 0x1b2d4b4; + public JobGauges(ClientStateAddressResolver addressResolver) { + Address = addressResolver; } // Should only be called with the gauge types in // ClientState.Structs.JobGauge - public static T Gauge() { - return Marshal.PtrToStructure(gaugeStart); + public T Get() { + return Marshal.PtrToStructure(Address.ActorTable); } } } diff --git a/Dalamud/Game/Internal/Gui/IconReplacer.cs b/Dalamud/Game/Internal/Gui/IconReplacer.cs index 869ac04f6..9de2c94b3 100644 --- a/Dalamud/Game/Internal/Gui/IconReplacer.cs +++ b/Dalamud/Game/Internal/Gui/IconReplacer.cs @@ -24,8 +24,6 @@ namespace Dalamud.Game.Internal.Gui { this.address = new IconReplacerAddressResolver(); this.address.Setup(scanner); - JobGauge.Init(module); - this.byteBase = scanner.Module.BaseAddress; this.jobInfo = byteBase + 0x1b2d4b4; this.comboTimer = byteBase + 0x1AE1B10; @@ -321,7 +319,7 @@ namespace Dalamud.Game.Internal.Gui { // Or with Heat Blast when overheated. // For some reason the shots use their unheated IDs as combo moves if (actionID == 7413) { - if (JobGauge.Gauge().IsOverheated() && level >= 35) return 7410; + if (this.dalamud.ClientState.JobGauges.Get().IsOverheated() && level >= 35) return 7410; if (comboTime > 0) { if (lastMove == 2866) return 7412; if (lastMove == 2868) return 7413; @@ -331,7 +329,7 @@ namespace Dalamud.Game.Internal.Gui { // Replace Spread Shot with Auto Crossbow when overheated. if (actionID == 2870) { - if (JobGauge.Gauge().IsOverheated() && level >= 52) return 16497; + if (this.dalamud.ClientState.JobGauges.Get().IsOverheated() && level >= 52) return 16497; return 2870; } @@ -339,7 +337,7 @@ namespace Dalamud.Game.Internal.Gui { // Enochian changes to B4 or F4 depending on stance. if (actionID == 3575) { - BLMGauge jobInfo = JobGauge.Gauge(); + BLMGauge jobInfo = this.dalamud.ClientState.JobGauges.Get(); if (jobInfo.IsEnoActive) { if (jobInfo.InUmbralIce()) return 3576; return 3577; @@ -349,7 +347,7 @@ namespace Dalamud.Game.Internal.Gui { // Umbral Soul and Transpose if (actionID == 149) { - if (JobGauge.Gauge().InUmbralIce() && level >= 76) return 16506; + if (this.dalamud.ClientState.JobGauges.Get().InUmbralIce() && level >= 76) return 16506; return 149; } @@ -414,7 +412,7 @@ namespace Dalamud.Game.Internal.Gui { // Standard Step is one button. if (actionID == 15997) { - DNCGauge gauge = JobGauge.Gauge(); + DNCGauge gauge = this.dalamud.ClientState.JobGauges.Get(); if (gauge.IsDancing()) { if (gauge.NumCompleteSteps == 2) { return 16192; @@ -429,7 +427,7 @@ namespace Dalamud.Game.Internal.Gui { // Technical Step is one button. if (actionID == 15998) { - DNCGauge gauge = JobGauge.Gauge(); + DNCGauge gauge = this.dalamud.ClientState.JobGauges.Get(); if (gauge.IsDancing()) { if (gauge.NumCompleteSteps == 4) { return 16196;