diff --git a/Dalamud/Game/PlayerState/PlayerState.Wrapper.cs b/Dalamud/Game/PlayerState/PlayerState.Wrapper.cs index 54b2b2d1b..a36f09ad4 100644 --- a/Dalamud/Game/PlayerState/PlayerState.Wrapper.cs +++ b/Dalamud/Game/PlayerState/PlayerState.Wrapper.cs @@ -16,33 +16,19 @@ namespace Dalamud.Game.PlayerState; /// internal unsafe partial class PlayerState : IInternalDisposableService, IPlayerState { - /// - /// Gets a value indicating whether the local character is loaded. - /// - /// - /// This is equivalent with being logged in.
- /// The actual GameObject will not immediately exist when this changes to true. - ///
+ /// public bool IsLoaded => CSPlayerState.Instance()->IsLoaded == 1; - /// - /// Gets the name of the local character. - /// + /// public string CharacterName => this.IsLoaded ? CSPlayerState.Instance()->CharacterNameString : string.Empty; - /// - /// Gets the entity ID of the local character. - /// + /// public uint EntityId => this.IsLoaded ? CSPlayerState.Instance()->EntityId : default; - /// - /// Gets the content ID of the local character. - /// + /// public ulong ContentId => this.IsLoaded ? CSPlayerState.Instance()->ContentId : default; - /// - /// Gets the World row for the local character's current world. - /// + /// public RowRef CurrentWorld { get @@ -54,9 +40,7 @@ internal unsafe partial class PlayerState : IInternalDisposableService, IPlayerS } } - /// - /// Gets the World row for the local character's home world. - /// + /// public RowRef HomeWorld { get @@ -68,109 +52,67 @@ internal unsafe partial class PlayerState : IInternalDisposableService, IPlayerS } } - /// - /// Gets the sex of the local character. - /// + /// public Sex Sex => this.IsLoaded ? (Sex)CSPlayerState.Instance()->Sex : default; - /// - /// Gets the Race row for the local character. - /// + /// public RowRef Race => this.IsLoaded ? LuminaUtils.CreateRef(CSPlayerState.Instance()->Race) : default; - /// - /// Gets the Tribe row for the local character. - /// + /// public RowRef Tribe => this.IsLoaded ? LuminaUtils.CreateRef(CSPlayerState.Instance()->Tribe) : default; - /// - /// Gets the ClassJob row for the local character's current class/job. - /// + /// public RowRef ClassJob => this.IsLoaded ? LuminaUtils.CreateRef(CSPlayerState.Instance()->CurrentClassJobId) : default; - /// - /// Gets the current class/job's level of the local character. - /// + /// public short Level => this.IsLoaded ? CSPlayerState.Instance()->CurrentLevel : default; - /// - /// Gets a value indicating whether the local character's level is synced. - /// + /// public bool IsLevelSynced => this.IsLoaded && CSPlayerState.Instance()->IsLevelSynced == 1; - /// - /// Gets the effective level of the local character. - /// + /// public short EffectiveLevel => this.IsLoaded ? (this.IsLevelSynced ? CSPlayerState.Instance()->SyncedLevel : CSPlayerState.Instance()->CurrentLevel) : default; - /// - /// Gets the GuardianDeity row for the local character. - /// + /// public RowRef GuardianDeity => this.IsLoaded ? LuminaUtils.CreateRef(CSPlayerState.Instance()->GuardianDeity) : default; - /// - /// Gets the birth month of the local character. - /// + /// public byte BirthMonth => this.IsLoaded ? CSPlayerState.Instance()->BirthMonth : default; - /// - /// Gets the birth day of the local character. - /// + /// public byte BirthDay => this.IsLoaded ? CSPlayerState.Instance()->BirthDay : default; - /// - /// Gets the ClassJob row for the local character's starting class. - /// + /// public RowRef FirstClass => this.IsLoaded ? LuminaUtils.CreateRef(CSPlayerState.Instance()->FirstClass) : default; - /// - /// Gets the Town row for the local character's starting town. - /// + /// public RowRef StartTown => this.IsLoaded ? LuminaUtils.CreateRef(CSPlayerState.Instance()->StartTown) : default; - /// - /// Gets the base strength of the local character. - /// + /// public int BaseStrength => this.IsLoaded ? CSPlayerState.Instance()->BaseStrength : default; - /// - /// Gets the base dexterity of the local character. - /// + /// public int BaseDexterity => this.IsLoaded ? CSPlayerState.Instance()->BaseDexterity : default; - /// - /// Gets the base vitality of the local character. - /// + /// public int BaseVitality => this.IsLoaded ? CSPlayerState.Instance()->BaseVitality : default; - /// - /// Gets the base intelligence of the local character. - /// + /// public int BaseIntelligence => this.IsLoaded ? CSPlayerState.Instance()->BaseIntelligence : default; - /// - /// Gets the base mind of the local character. - /// + /// public int BaseMind => this.IsLoaded ? CSPlayerState.Instance()->BaseMind : default; - /// - /// Gets the piety mind of the local character. - /// + /// public int BasePiety => this.IsLoaded ? CSPlayerState.Instance()->BasePiety : default; - /// - /// Gets the GrandCompany row for the local character's current Grand Company affiliation. - /// + /// public RowRef GrandCompany => this.IsLoaded ? LuminaUtils.CreateRef(CSPlayerState.Instance()->GrandCompany) : default; - /// - /// Gets the Aetheryte row for the local character's home aetheryte. - /// + /// public RowRef HomeAetheryte => this.IsLoaded ? LuminaUtils.CreateRef(CSPlayerState.Instance()->HomeAetheryteId) : default; - /// - /// Gets a span of Aetheryte rows for the local character's favourite aetherytes. - /// + /// public ReadOnlySpan> FavouriteAetherytes { get @@ -189,43 +131,25 @@ internal unsafe partial class PlayerState : IInternalDisposableService, IPlayerS } } - /// - /// Gets the Aetheryte row for the local character's free aetheryte. - /// + /// public RowRef FreeAetheryte => this.IsLoaded ? LuminaUtils.CreateRef(CSPlayerState.Instance()->FreeAetheryteId) : default; - /// - /// Gets the amount of received player commendations of the local character. - /// + /// public uint BaseRestedExperience => this.IsLoaded ? CSPlayerState.Instance()->BaseRestedExperience : default; - /// - /// Gets the amount of received player commendations of the local character. - /// + /// public short PlayerCommendations => this.IsLoaded ? CSPlayerState.Instance()->PlayerCommendations : default; - /// - /// Gets the Carrier Level of Delivery Moogle Quests of the local character. - /// + /// public byte DeliveryLevel => this.IsLoaded ? CSPlayerState.Instance()->DeliveryLevel : default; - /// - /// Gets the mentor version of the local character. - /// + /// public MentorVersion MentorVersion => this.IsLoaded ? (MentorVersion)CSPlayerState.Instance()->MentorVersion : default; - /// - /// Gets the value of an attribute of the local character. - /// - /// The attribute to check. - /// The value of the specific attribute. + /// public int GetAttribute(PlayerAttribute attribute) => this.IsLoaded ? CSPlayerState.Instance()->Attributes[(int)attribute] : default; - /// - /// Gets the Grand Company rank of the local character. - /// - /// The Grand Company to check. - /// The Grand Company rank of the local character. + /// public byte GetGrandCompanyRank(GrandCompany grandCompany) { var playerState = CSPlayerState.Instance(); @@ -241,18 +165,10 @@ internal unsafe partial class PlayerState : IInternalDisposableService, IPlayerS }; } - /// - /// Gets the level of the local character's class/job. - /// - /// The ClassJob row to check. - /// The level of the requested class/job. + /// public short GetClassJobLevel(ClassJob classJob) => this.IsLoaded ? CSPlayerState.Instance()->ClassJobLevels[classJob.ExpArrayIndex] : default; - /// - /// Gets the experience of the local character's class/job. - /// - /// The ClassJob row to check. - /// The experience of the requested class/job. + /// public int GetClassJobExperience(ClassJob classJob) { var playerState = CSPlayerState.Instance(); @@ -262,11 +178,7 @@ internal unsafe partial class PlayerState : IInternalDisposableService, IPlayerS return playerState->ClassJobExperience[classJob.ExpArrayIndex]; } - /// - /// Gets the desynthesis level of the local character's crafter job. - /// - /// The ClassJob row to check. - /// The desynthesis level of the requested crafter job. + /// public float GetDesynthesisLevel(ClassJob classJob) { if (classJob.ExpArrayIndex == -1)