Fix FavoriteAetherytes

This commit is contained in:
Haselnussbomber 2025-10-06 01:38:35 +02:00
parent a55c8ca773
commit bcf651b5c1
No known key found for this signature in database
GPG key ID: BB905BB49E7295D1
2 changed files with 7 additions and 4 deletions

View file

@ -118,15 +118,18 @@ internal unsafe class PlayerState : IServiceType, IPlayerState
public RowRef<Aetheryte> HomeAetheryte => this.IsLoaded ? LuminaUtils.CreateRef<Aetheryte>(CSPlayerState.Instance()->HomeAetheryteId) : default; public RowRef<Aetheryte> HomeAetheryte => this.IsLoaded ? LuminaUtils.CreateRef<Aetheryte>(CSPlayerState.Instance()->HomeAetheryteId) : default;
/// <inheritdoc/> /// <inheritdoc/>
public ReadOnlySpan<RowRef<Aetheryte>> FavouriteAetherytes public ReadOnlySpan<RowRef<Aetheryte>> FavoriteAetherytes
{ {
get get
{ {
var playerState = CSPlayerState.Instance(); var playerState = CSPlayerState.Instance();
if (playerState->IsLoaded || playerState->FavouriteAetheryteCount == 0) if (!playerState->IsLoaded)
return []; return default;
var count = playerState->FavouriteAetheryteCount; var count = playerState->FavouriteAetheryteCount;
if (count == 0)
return default;
var array = new RowRef<Aetheryte>[count]; var array = new RowRef<Aetheryte>[count];
for (var i = 0; i < count; i++) for (var i = 0; i < count; i++)

View file

@ -149,7 +149,7 @@ public interface IPlayerState
/// <summary> /// <summary>
/// Gets a span of Aetheryte rows for the local player's favourite aetherytes. /// Gets a span of Aetheryte rows for the local player's favourite aetherytes.
/// </summary> /// </summary>
ReadOnlySpan<RowRef<Aetheryte>> FavouriteAetherytes { get; } ReadOnlySpan<RowRef<Aetheryte>> FavoriteAetherytes { get; }
/// <summary> /// <summary>
/// Gets the Aetheryte row for the local player's free aetheryte. /// Gets the Aetheryte row for the local player's free aetheryte.