Add interfaces to non public/sealed classes referenced in public interfaces (#1808)

* Add interfaces to non public/sealed classes referenced in public interfaces

* Fixed inheritdocs + made most classes internal

* Add missing properties to IFate and Fate, fix documentation

---------

Co-authored-by: goat <16760685+goaaats@users.noreply.github.com>
This commit is contained in:
Blair 2024-06-29 07:05:34 +10:00 committed by GitHub
parent 3994f528b8
commit 7947b896ea
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
55 changed files with 1466 additions and 584 deletions

View file

@ -10,7 +10,7 @@ namespace Dalamud.Game.ClientState.Fates;
/// <summary>
/// This class represents an FFXIV Fate.
/// </summary>
public unsafe partial class Fate : IEquatable<Fate>
internal unsafe partial class Fate
{
/// <summary>
/// Initializes a new instance of the <see cref="Fate"/> class.
@ -21,9 +21,7 @@ public unsafe partial class Fate : IEquatable<Fate>
this.Address = address;
}
/// <summary>
/// Gets the address of this Fate in memory.
/// </summary>
/// <inheritdoc />
public IntPtr Address { get; }
private FFXIVClientStructs.FFXIV.Client.Game.Fate.FateContext* Struct => (FFXIVClientStructs.FFXIV.Client.Game.Fate.FateContext*)this.Address;
@ -63,10 +61,10 @@ public unsafe partial class Fate : IEquatable<Fate>
public bool IsValid() => IsValid(this);
/// <inheritdoc/>
bool IEquatable<Fate>.Equals(Fate other) => this.FateId == other?.FateId;
bool IEquatable<IFate>.Equals(IFate other) => this.FateId == other?.FateId;
/// <inheritdoc/>
public override bool Equals(object obj) => ((IEquatable<Fate>)this).Equals(obj as Fate);
public override bool Equals(object obj) => ((IEquatable<IFate>)this).Equals(obj as IFate);
/// <inheritdoc/>
public override int GetHashCode() => this.FateId.GetHashCode();
@ -75,60 +73,171 @@ public unsafe partial class Fate : IEquatable<Fate>
/// <summary>
/// This class represents an FFXIV Fate.
/// </summary>
public unsafe partial class Fate
internal unsafe partial class Fate : IFate
{
/// <summary>
/// Gets the Fate ID of this <see cref="Fate" />.
/// </summary>
/// <inheritdoc/>
public ushort FateId => this.Struct->FateId;
/// <summary>
/// Gets game data linked to this Fate.
/// </summary>
/// <inheritdoc/>
public Lumina.Excel.GeneratedSheets.Fate GameData => Service<DataManager>.Get().GetExcelSheet<Lumina.Excel.GeneratedSheets.Fate>().GetRow(this.FateId);
/// <summary>
/// Gets the time this <see cref="Fate"/> started.
/// </summary>
/// <inheritdoc/>
public int StartTimeEpoch => this.Struct->StartTimeEpoch;
/// <summary>
/// Gets how long this <see cref="Fate"/> will run.
/// </summary>
/// <inheritdoc/>
public short Duration => this.Struct->Duration;
/// <summary>
/// Gets the remaining time in seconds for this <see cref="Fate"/>.
/// </summary>
/// <inheritdoc/>
public long TimeRemaining => this.StartTimeEpoch + this.Duration - DateTimeOffset.Now.ToUnixTimeSeconds();
/// <summary>
/// Gets the displayname of this <see cref="Fate" />.
/// </summary>
/// <inheritdoc/>
public SeString Name => MemoryHelper.ReadSeString(&this.Struct->Name);
/// <summary>
/// Gets the state of this <see cref="Fate"/> (Running, Ended, Failed, Preparation, WaitingForEnd).
/// </summary>
/// <inheritdoc/>
public SeString Description => MemoryHelper.ReadSeString(&this.Struct->Description);
/// <inheritdoc/>
public SeString Objective => MemoryHelper.ReadSeString(&this.Struct->Objective);
/// <inheritdoc/>
public FateState State => (FateState)this.Struct->State;
/// <summary>
/// Gets the progress amount of this <see cref="Fate"/>.
/// </summary>
/// <inheritdoc/>
public byte HandInCount => this.Struct->HandInCount;
/// <inheritdoc/>
public byte Progress => this.Struct->Progress;
/// <summary>
/// Gets the level of this <see cref="Fate"/>.
/// </summary>
/// <inheritdoc/>
public bool HasExpBonus => this.Struct->IsExpBonus;
/// <inheritdoc/>
public uint IconId => this.Struct->IconId;
/// <inheritdoc/>
public byte Level => this.Struct->Level;
/// <summary>
/// Gets the position of this <see cref="Fate"/>.
/// </summary>
/// <inheritdoc/>
public byte MaxLevel => this.Struct->MaxLevel;
/// <inheritdoc/>
public Vector3 Position => this.Struct->Location;
/// <inheritdoc/>
public float Radius => this.Struct->Radius;
/// <inheritdoc/>
public uint MapIconId => this.Struct->MapIconId;
/// <summary>
/// Gets the territory this <see cref="Fate"/> is located in.
/// </summary>
public ExcelResolver<Lumina.Excel.GeneratedSheets.TerritoryType> TerritoryType => new(this.Struct->TerritoryId);
}
/// <summary>
/// Interface representing an fate entry that can be seen in the current area.
/// </summary>
public interface IFate : IEquatable<IFate>
{
/// <summary>
/// Gets the Fate ID of this <see cref="Fate" />.
/// </summary>
ushort FateId { get; }
/// <summary>
/// Gets game data linked to this Fate.
/// </summary>
Lumina.Excel.GeneratedSheets.Fate GameData { get; }
/// <summary>
/// Gets the time this <see cref="Fate"/> started.
/// </summary>
int StartTimeEpoch { get; }
/// <summary>
/// Gets how long this <see cref="Fate"/> will run.
/// </summary>
short Duration { get; }
/// <summary>
/// Gets the remaining time in seconds for this <see cref="Fate"/>.
/// </summary>
long TimeRemaining { get; }
/// <summary>
/// Gets the displayname of this <see cref="Fate" />.
/// </summary>
SeString Name { get; }
/// <summary>
/// Gets the description of this <see cref="Fate" />.
/// </summary>
SeString Description { get; }
/// <summary>
/// Gets the objective of this <see cref="Fate" />.
/// </summary>
SeString Objective { get; }
/// <summary>
/// Gets the state of this <see cref="Fate"/> (Running, Ended, Failed, Preparation, WaitingForEnd).
/// </summary>
FateState State { get; }
/// <summary>
/// Gets the hand in count of this <see cref="Fate"/>.
/// </summary>
byte HandInCount { get; }
/// <summary>
/// Gets the progress amount of this <see cref="Fate"/>.
/// </summary>
byte Progress { get; }
/// <summary>
/// Gets a value indicating whether or not this <see cref="Fate"/> has a EXP bonus.
/// </summary>
bool HasExpBonus { get; }
/// <summary>
/// Gets the icon id of this <see cref="Fate"/>.
/// </summary>
uint IconId { get; }
/// <summary>
/// Gets the level of this <see cref="Fate"/>.
/// </summary>
byte Level { get; }
/// <summary>
/// Gets the max level level of this <see cref="Fate"/>.
/// </summary>
byte MaxLevel { get; }
/// <summary>
/// Gets the position of this <see cref="Fate"/>.
/// </summary>
Vector3 Position { get; }
/// <summary>
/// Gets the radius of this <see cref="Fate"/>.
/// </summary>
float Radius { get; }
/// <summary>
/// Gets the map icon id of this <see cref="Fate"/>.
/// </summary>
uint MapIconId { get; }
/// <summary>
/// Gets the territory this <see cref="Fate"/> is located in.
/// </summary>
ExcelResolver<Lumina.Excel.GeneratedSheets.TerritoryType> TerritoryType { get; }
/// <summary>
/// Gets the address of this Fate in memory.
/// </summary>
IntPtr Address { get; }
}