Merge pull request #698 from daemitus/gauge

Gauge update (please test /xldata gauge pane)
This commit is contained in:
goaaats 2021-12-06 05:58:28 +01:00 committed by GitHub
commit f4f88418e7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 128 additions and 186 deletions

View file

@ -24,5 +24,25 @@ namespace Dalamud.Game.ClientState.JobGauge.Enums
/// Ruby carbuncle pet glam. /// Ruby carbuncle pet glam.
/// </summary> /// </summary>
RUBY = 3, RUBY = 3,
/// <summary>
/// Normal carbuncle pet glam.
/// </summary>
CARBUNCLE = 4,
/// <summary>
/// Ifrit Egi pet glam.
/// </summary>
IFRIT = 5,
/// <summary>
/// Titan Egi pet glam.
/// </summary>
TITAN = 6,
/// <summary>
/// Garuda Egi pet glam.
/// </summary>
GARUDA = 7,
} }
} }

View file

@ -11,18 +11,8 @@ namespace Dalamud.Game.ClientState.JobGauge.Enums
NONE = 0, NONE = 0,
/// <summary> /// <summary>
/// The summoned pet Ifrit. /// The summoned pet Carbuncle.
/// </summary> /// </summary>
IFRIT = 3, CARBUNCLE = 23,
/// <summary>
/// The summoned pet Titan.
/// </summary>
TITAN = 4,
/// <summary>
/// The summoned pet Garuda.
/// </summary>
GARUDA = 5,
} }
} }

View file

@ -1,4 +1,5 @@
using System; using System;
using System.Linq;
using Dalamud.Game.ClientState.JobGauge.Enums; using Dalamud.Game.ClientState.JobGauge.Enums;
@ -30,17 +31,16 @@ namespace Dalamud.Game.ClientState.JobGauge.Types
/// <returns>Currently drawn crown <see cref="CardType"/>.</returns> /// <returns>Currently drawn crown <see cref="CardType"/>.</returns>
public CardType DrawnCrownCard => (CardType)(this.Struct->Card - (this.Struct->Card % 10)); public CardType DrawnCrownCard => (CardType)(this.Struct->Card - (this.Struct->Card % 10));
/// <summary>
/// Gets the <see cref="SealType"/>s currently active.
/// </summary>
public SealType[] Seals => this.Struct->CurrentSeals.Cast<SealType>().ToArray();
/// <summary> /// <summary>
/// Check if a <see cref="SealType"/> is currently active on the divination gauge. /// Check if a <see cref="SealType"/> is currently active on the divination gauge.
/// </summary> /// </summary>
/// <param name="seal">The <see cref="SealType"/> to check for.</param> /// <param name="seal">The <see cref="SealType"/> to check for.</param>
/// <returns>If the given Seal is currently divined.</returns> /// <returns>If the given Seal is currently divined.</returns>
public unsafe bool ContainsSeal(SealType seal) public unsafe bool ContainsSeal(SealType seal) => this.Seals.Contains(seal);
{
if (this.Struct->Seals[0] == (byte)seal) return true;
if (this.Struct->Seals[1] == (byte)seal) return true;
if (this.Struct->Seals[2] == (byte)seal) return true;
return false;
}
} }
} }

View file

@ -1,13 +1,14 @@
using System; using System;
using Dalamud.Game.ClientState.JobGauge.Enums; using Dalamud.Game.ClientState.JobGauge.Enums;
using FFXIVClientStructs.FFXIV.Client.Game.Gauge;
namespace Dalamud.Game.ClientState.JobGauge.Types namespace Dalamud.Game.ClientState.JobGauge.Types
{ {
/// <summary> /// <summary>
/// In-memory SMN job gauge. /// In-memory SMN job gauge.
/// </summary> /// </summary>
public unsafe class SMNGauge : JobGaugeBase<FFXIVClientStructs.FFXIV.Client.Game.Gauge.SummonerGauge> public unsafe class SMNGauge : JobGaugeBase<SummonerGauge>
{ {
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="SMNGauge"/> class. /// Initializes a new instance of the <see cref="SMNGauge"/> class.
@ -21,40 +22,93 @@ namespace Dalamud.Game.ClientState.JobGauge.Types
/// <summary> /// <summary>
/// Gets the time remaining for the current summon. /// Gets the time remaining for the current summon.
/// </summary> /// </summary>
public short TimerRemaining => this.Struct->TimerRemaining; public ushort SummonTimerRemaining => this.Struct->SummonTimer;
/// <summary>
/// Gets the time remaining for the current attunement.
/// </summary>
public ushort AttunmentTimerRemaining => this.Struct->SummonTimer;
/// <summary> /// <summary>
/// Gets the summon that will return after the current summon expires. /// Gets the summon that will return after the current summon expires.
/// This maps to the <see cref="Lumina.Excel.GeneratedSheets.Pet"/> sheet.
/// </summary> /// </summary>
public SummonPet ReturnSummon => (SummonPet)this.Struct->ReturnSummon; public SummonPet ReturnSummon => (SummonPet)this.Struct->ReturnSummon;
/// <summary> /// <summary>
/// Gets the summon glam for the <see cref="ReturnSummon"/>. /// Gets the summon glam for the <see cref="ReturnSummon"/>.
/// This maps to the <see cref="Lumina.Excel.GeneratedSheets.PetMirage"/> sheet.
/// </summary> /// </summary>
public PetGlam ReturnSummonGlam => (PetGlam)this.Struct->ReturnSummonGlam; public PetGlam ReturnSummonGlam => (PetGlam)this.Struct->ReturnSummonGlam;
/// <summary>
/// Gets the amount of aspected Attunment remaining.
/// </summary>
public byte Attunement => this.Struct->Attunement;
/// <summary> /// <summary>
/// Gets the current aether flags. /// Gets the current aether flags.
/// Use the summon accessors instead. /// Use the summon accessors instead.
/// </summary> /// </summary>
public byte AetherFlags => this.Struct->AetherFlags; public AetherFlags AetherFlags => this.Struct->AetherFlags;
/// <summary>
/// Gets a value indicating whether if Phoenix is ready to be summoned.
/// </summary>
/// <returns><c>true</c> or <c>false</c>.</returns>
public bool IsPhoenixReady => (this.AetherFlags & 0x10) > 0;
/// <summary> /// <summary>
/// Gets a value indicating whether Bahamut is ready to be summoned. /// Gets a value indicating whether Bahamut is ready to be summoned.
/// </summary> /// </summary>
/// <returns><c>true</c> or <c>false</c>.</returns> /// <returns><c>true</c> or <c>false</c>.</returns>
public bool IsBahamutReady => (this.AetherFlags & 8) > 0; public bool IsBahamutReady => !this.AetherFlags.HasFlag(AetherFlags.PhoenixReady);
/// <summary>
/// Gets a value indicating whether if Phoenix is ready to be summoned.
/// </summary>
/// <returns><c>true</c> or <c>false</c>.</returns>
public bool IsPhoenixReady => this.AetherFlags.HasFlag(AetherFlags.PhoenixReady);
/// <summary>
/// Gets a value indicating whether if Ifrit is ready to be summoned.
/// </summary>
/// <returns><c>true</c> or <c>false</c>.</returns>
public bool IsIfritReady => this.AetherFlags.HasFlag(AetherFlags.IfritReady);
/// <summary>
/// Gets a value indicating whether if Titan is ready to be summoned.
/// </summary>
/// <returns><c>true</c> or <c>false</c>.</returns>
public bool IsTitanReady => this.AetherFlags.HasFlag(AetherFlags.TitanReady);
/// <summary>
/// Gets a value indicating whether if Garuda is ready to be summoned.
/// </summary>
/// <returns><c>true</c> or <c>false</c>.</returns>
public bool IsGarudaReady => this.AetherFlags.HasFlag(AetherFlags.GarudaReady);
/// <summary>
/// Gets a value indicating whether if Ifrit is currently attuned.
/// </summary>
/// <returns><c>true</c> or <c>false</c>.</returns>
public bool IsIfritAttuned => this.AetherFlags.HasFlag(AetherFlags.IfritAttuned) && !this.AetherFlags.HasFlag(AetherFlags.GarudaAttuned);
/// <summary>
/// Gets a value indicating whether if Titan is currently attuned.
/// </summary>
/// <returns><c>true</c> or <c>false</c>.</returns>
public bool IsTitanAttuned => this.AetherFlags.HasFlag(AetherFlags.TitanAttuned) && !this.AetherFlags.HasFlag(AetherFlags.GarudaAttuned);
/// <summary>
/// Gets a value indicating whether if Garuda is currently attuned.
/// </summary>
/// <returns><c>true</c> or <c>false</c>.</returns>
public bool IsGarudaAttuned => this.AetherFlags.HasFlag(AetherFlags.GarudaAttuned);
/// <summary> /// <summary>
/// Gets a value indicating whether there are any Aetherflow stacks available. /// Gets a value indicating whether there are any Aetherflow stacks available.
/// </summary> /// </summary>
/// <returns><c>true</c> or <c>false</c>.</returns> /// <returns><c>true</c> or <c>false</c>.</returns>
public bool HasAetherflowStacks => (this.AetherFlags & 3) > 0; public bool HasAetherflowStacks => this.AetherflowStacks > 0;
/// <summary>
/// Gets the amount of Aetherflow available.
/// </summary>
public byte AetherflowStacks => (byte)(this.AetherFlags & AetherFlags.Aetherflow);
} }
} }

View file

@ -769,164 +769,37 @@ namespace Dalamud.Interface.Internal.Windows
} }
var jobID = player.ClassJob.Id; var jobID = player.ClassJob.Id;
if (jobID == 19) JobGaugeBase? gauge = jobID switch
{ {
var gauge = jobGauges.Get<PLDGauge>(); 19 => jobGauges.Get<PLDGauge>(),
ImGui.Text($"Address: 0x{gauge.Address.ToInt64():X}"); 20 => jobGauges.Get<MNKGauge>(),
ImGui.Text($"{nameof(gauge.OathGauge)}: {gauge.OathGauge}"); 21 => jobGauges.Get<WARGauge>(),
} 22 => jobGauges.Get<DRGGauge>(),
else if (jobID == 20) 23 => jobGauges.Get<BRDGauge>(),
{ 24 => jobGauges.Get<WHMGauge>(),
var gauge = jobGauges.Get<MNKGauge>(); 25 => jobGauges.Get<BLMGauge>(),
ImGui.Text($"Address: 0x{gauge.Address.ToInt64():X}"); 27 => jobGauges.Get<SMNGauge>(),
ImGui.Text($"{nameof(gauge.Chakra)}: {gauge.Chakra}"); 28 => jobGauges.Get<SCHGauge>(),
} 30 => jobGauges.Get<NINGauge>(),
else if (jobID == 21) 31 => jobGauges.Get<MCHGauge>(),
{ 32 => jobGauges.Get<DRKGauge>(),
var gauge = jobGauges.Get<WARGauge>(); 33 => jobGauges.Get<ASTGauge>(),
ImGui.Text($"Address: 0x{gauge.Address.ToInt64():X}"); 34 => jobGauges.Get<SAMGauge>(),
ImGui.Text($"{nameof(gauge.BeastGauge)}: {gauge.BeastGauge}"); 35 => jobGauges.Get<RDMGauge>(),
} 37 => jobGauges.Get<GNBGauge>(),
else if (jobID == 22) 38 => jobGauges.Get<DNCGauge>(),
{ 39 => jobGauges.Get<RPRGauge>(),
var gauge = jobGauges.Get<DRGGauge>(); 40 => jobGauges.Get<SGEGauge>(),
ImGui.Text($"Address: 0x{gauge.Address.ToInt64():X}"); _ => null,
ImGui.Text($"{nameof(gauge.BOTDTimer)}: {gauge.BOTDTimer}"); };
ImGui.Text($"{nameof(gauge.BOTDState)}: {gauge.BOTDState}");
ImGui.Text($"{nameof(gauge.EyeCount)}: {gauge.EyeCount}"); if (gauge == null)
}
else if (jobID == 23)
{
var gauge = jobGauges.Get<BRDGauge>();
ImGui.Text($"Address: 0x{gauge.Address.ToInt64():X}");
ImGui.Text($"{nameof(gauge.SongTimer)}: {gauge.SongTimer}");
ImGui.Text($"{nameof(gauge.Repertoire)}: {gauge.Repertoire}");
ImGui.Text($"{nameof(gauge.SoulVoice)}: {gauge.SoulVoice}");
ImGui.Text($"{nameof(gauge.Song)}: {gauge.Song}");
}
else if (jobID == 24)
{
var gauge = jobGauges.Get<WHMGauge>();
ImGui.Text($"Address: 0x{gauge.Address.ToInt64():X}");
ImGui.Text($"{nameof(gauge.LilyTimer)}: {gauge.LilyTimer}");
ImGui.Text($"{nameof(gauge.Lily)}: {gauge.Lily}");
ImGui.Text($"{nameof(gauge.BloodLily)}: {gauge.BloodLily}");
}
else if (jobID == 25)
{
var gauge = jobGauges.Get<BLMGauge>();
ImGui.Text($"Address: 0x{gauge.Address.ToInt64():X}");
ImGui.Text($"{nameof(gauge.EnochianTimer)}: {gauge.EnochianTimer}");
ImGui.Text($"{nameof(gauge.ElementTimeRemaining)}: {gauge.ElementTimeRemaining}");
ImGui.Text($"{nameof(gauge.PolyglotStacks)}: {gauge.PolyglotStacks}");
ImGui.Text($"{nameof(gauge.UmbralHearts)}: {gauge.UmbralHearts}");
ImGui.Text($"{nameof(gauge.UmbralIceStacks)}: {gauge.UmbralIceStacks}");
ImGui.Text($"{nameof(gauge.AstralFireStacks)}: {gauge.AstralFireStacks}");
ImGui.Text($"{nameof(gauge.InUmbralIce)}: {gauge.InUmbralIce}");
ImGui.Text($"{nameof(gauge.InAstralFire)}: {gauge.InAstralFire}");
ImGui.Text($"{nameof(gauge.IsEnochianActive)}: {gauge.IsEnochianActive}");
}
else if (jobID == 27)
{
var gauge = jobGauges.Get<SMNGauge>();
ImGui.Text($"Address: 0x{gauge.Address.ToInt64():X}");
ImGui.Text($"{nameof(gauge.TimerRemaining)}: {gauge.TimerRemaining}");
ImGui.Text($"{nameof(gauge.ReturnSummon)}: {gauge.ReturnSummon}");
ImGui.Text($"{nameof(gauge.ReturnSummonGlam)}: {gauge.ReturnSummonGlam}");
ImGui.Text($"{nameof(gauge.AetherFlags)}: {gauge.AetherFlags}");
ImGui.Text($"{nameof(gauge.IsPhoenixReady)}: {gauge.IsPhoenixReady}");
ImGui.Text($"{nameof(gauge.IsBahamutReady)}: {gauge.IsBahamutReady}");
ImGui.Text($"{nameof(gauge.HasAetherflowStacks)}: {gauge.HasAetherflowStacks}");
}
else if (jobID == 28)
{
var gauge = jobGauges.Get<SCHGauge>();
ImGui.Text($"Address: 0x{gauge.Address.ToInt64():X}");
ImGui.Text($"{nameof(gauge.Aetherflow)}: {gauge.Aetherflow}");
ImGui.Text($"{nameof(gauge.FairyGauge)}: {gauge.FairyGauge}");
ImGui.Text($"{nameof(gauge.SeraphTimer)}: {gauge.SeraphTimer}");
ImGui.Text($"{nameof(gauge.DismissedFairy)}: {gauge.DismissedFairy}");
}
else if (jobID == 30)
{
var gauge = jobGauges.Get<NINGauge>();
ImGui.Text($"Address: 0x{gauge.Address.ToInt64():X}");
ImGui.Text($"{nameof(gauge.HutonTimer)}: {gauge.HutonTimer}");
ImGui.Text($"{nameof(gauge.Ninki)}: {gauge.Ninki}");
ImGui.Text($"{nameof(gauge.HutonManualCasts)}: {gauge.HutonManualCasts}");
}
else if (jobID == 31)
{
var gauge = jobGauges.Get<MCHGauge>();
ImGui.Text($"Address: 0x{gauge.Address.ToInt64():X}");
ImGui.Text($"{nameof(gauge.OverheatTimeRemaining)}: {gauge.OverheatTimeRemaining}");
ImGui.Text($"{nameof(gauge.SummonTimeRemaining)}: {gauge.SummonTimeRemaining}");
ImGui.Text($"{nameof(gauge.Heat)}: {gauge.Heat}");
ImGui.Text($"{nameof(gauge.Battery)}: {gauge.Battery}");
ImGui.Text($"{nameof(gauge.LastSummonBatteryPower)}: {gauge.LastSummonBatteryPower}");
ImGui.Text($"{nameof(gauge.IsOverheated)}: {gauge.IsOverheated}");
ImGui.Text($"{nameof(gauge.IsRobotActive)}: {gauge.IsRobotActive}");
}
else if (jobID == 32)
{
var gauge = jobGauges.Get<DRKGauge>();
ImGui.Text($"Address: 0x{gauge.Address.ToInt64():X}");
ImGui.Text($"{nameof(gauge.Blood)}: {gauge.Blood}");
ImGui.Text($"{nameof(gauge.DarksideTimeRemaining)}: {gauge.DarksideTimeRemaining}");
ImGui.Text($"{nameof(gauge.ShadowTimeRemaining)}: {gauge.ShadowTimeRemaining}");
ImGui.Text($"{nameof(gauge.HasDarkArts)}: {gauge.HasDarkArts}");
}
else if (jobID == 33)
{
var gauge = jobGauges.Get<ASTGauge>();
ImGui.Text($"Address: 0x{gauge.Address.ToInt64():X}");
ImGui.Text($"{nameof(gauge.DrawnCard)}: {gauge.DrawnCard}");
foreach (var seal in Enum.GetValues(typeof(SealType)).Cast<SealType>())
{
var sealName = Enum.GetName(typeof(SealType), seal);
ImGui.Text($"{nameof(gauge.ContainsSeal)}({sealName}): {gauge.ContainsSeal(seal)}");
}
}
else if (jobID == 34)
{
var gauge = jobGauges.Get<SAMGauge>();
ImGui.Text($"Address: 0x{gauge.Address.ToInt64():X}");
ImGui.Text($"{nameof(gauge.Kenki)}: {gauge.Kenki}");
ImGui.Text($"{nameof(gauge.MeditationStacks)}: {gauge.MeditationStacks}");
ImGui.Text($"{nameof(gauge.Sen)}: {gauge.Sen}");
ImGui.Text($"{nameof(gauge.HasSetsu)}: {gauge.HasSetsu}");
ImGui.Text($"{nameof(gauge.HasGetsu)}: {gauge.HasGetsu}");
ImGui.Text($"{nameof(gauge.HasKa)}: {gauge.HasKa}");
}
else if (jobID == 35)
{
var gauge = jobGauges.Get<RDMGauge>();
ImGui.Text($"Address: 0x{gauge.Address.ToInt64():X}");
ImGui.Text($"{nameof(gauge.WhiteMana)}: {gauge.WhiteMana}");
ImGui.Text($"{nameof(gauge.BlackMana)}: {gauge.BlackMana}");
}
else if (jobID == 37)
{
var gauge = jobGauges.Get<GNBGauge>();
ImGui.Text($"Address: 0x{gauge.Address.ToInt64():X}");
ImGui.Text($"{nameof(gauge.Ammo)}: {gauge.Ammo}");
ImGui.Text($"{nameof(gauge.MaxTimerDuration)}: {gauge.MaxTimerDuration}");
ImGui.Text($"{nameof(gauge.AmmoComboStep)}: {gauge.AmmoComboStep}");
}
else if (jobID == 38)
{
var gauge = jobGauges.Get<DNCGauge>();
ImGui.Text($"Address: 0x{gauge.Address.ToInt64():X}");
ImGui.Text($"{nameof(gauge.Feathers)}: {gauge.Feathers}");
ImGui.Text($"{nameof(gauge.Esprit)}: {gauge.Esprit}");
ImGui.Text($"{nameof(gauge.CompletedSteps)}: {gauge.CompletedSteps}");
ImGui.Text($"{nameof(gauge.NextStep)}: {gauge.NextStep}");
ImGui.Text($"{nameof(gauge.IsDancing)}: {gauge.IsDancing}");
}
else
{ {
ImGui.Text("No supported gauge exists for this job."); ImGui.Text("No supported gauge exists for this job.");
return;
} }
Util.ShowObject(gauge);
} }
private void DrawCommand() private void DrawCommand()

View file

@ -174,7 +174,12 @@ namespace Dalamud.Utility
foreach (var propertyInfo in type.GetProperties()) foreach (var propertyInfo in type.GetProperties())
{ {
ImGui.TextColored(ImGuiColors.DalamudOrange, $" {propertyInfo.Name}: {propertyInfo.GetValue(obj)}"); var value = propertyInfo.GetValue(obj);
var valueType = value?.GetType();
if (valueType == typeof(IntPtr))
ImGui.TextColored(ImGuiColors.DalamudOrange, $" {propertyInfo.Name}: 0x{value:X}");
else
ImGui.TextColored(ImGuiColors.DalamudOrange, $" {propertyInfo.Name}: {value}");
} }
ImGui.Unindent(); ImGui.Unindent();

@ -1 +1 @@
Subproject commit b4b577fce3710e03db6cf50724b1b3f39b60f368 Subproject commit 8a7333e6de43c3d315d757ea97dbd29ca5ef8f77