feat: Add helper to get the character's current mount

This commit is contained in:
Kaz Wolfe 2024-07-24 13:23:54 -07:00
parent 4ddd9c99fb
commit 56f7da5e0c
No known key found for this signature in database
GPG key ID: 258813F53A16EBB4

View file

@ -93,6 +93,11 @@ public interface ICharacter : IGameObject
/// Gets the status flags.
/// </summary>
public StatusFlags StatusFlags { get; }
/// <summary>
/// Gets the current mount for this character. Will be <c>null</c> if the character doesn't have a mount.
/// </summary>
public ExcelResolver<Mount>? CurrentMount { get; }
}
/// <summary>
@ -172,6 +177,18 @@ internal unsafe class Character : GameObject, ICharacter
(this.Struct->IsAllianceMember ? StatusFlags.AllianceMember : StatusFlags.None) |
(this.Struct->IsFriend ? StatusFlags.Friend : StatusFlags.None) |
(this.Struct->IsCasting ? StatusFlags.IsCasting : StatusFlags.None);
/// <inheritdoc />
public ExcelResolver<Mount>? CurrentMount
{
get
{
if (this.Struct->IsNotMounted()) return null; // safety i guess?
var mountId = this.Struct->Mount.MountId;
return mountId == 0 ? null : new ExcelResolver<Mount>(mountId);
}
}
/// <summary>
/// Gets the underlying structure.