mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-15 21:24:16 +01:00
Merge pull request #1968 from KazWolfe/charamount
feat: Add new fields for a character's current mount and minion
This commit is contained in:
commit
7a5bdb6bde
1 changed files with 38 additions and 0 deletions
|
|
@ -93,6 +93,18 @@ 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>
|
||||
/// Gets the current minion summoned for this character. Will be <c>null</c> if the character doesn't have a minion.
|
||||
/// This method *will* return information about a spawned (but invisible) minion, e.g. if the character is riding a
|
||||
/// mount.
|
||||
/// </summary>
|
||||
public ExcelResolver<Companion>? CurrentMinion { get; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -172,6 +184,32 @@ 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; // just for safety.
|
||||
|
||||
var mountId = this.Struct->Mount.MountId;
|
||||
return mountId == 0 ? null : new ExcelResolver<Mount>(mountId);
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public ExcelResolver<Companion>? CurrentMinion
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.Struct->CompanionObject != null)
|
||||
return new ExcelResolver<Companion>(this.Struct->CompanionObject->BaseId);
|
||||
|
||||
// this is only present if a minion is summoned but hidden (e.g. the player's on a mount).
|
||||
var hiddenCompanionId = this.Struct->CompanionData.CompanionId;
|
||||
return hiddenCompanionId == 0 ? null : new ExcelResolver<Companion>(hiddenCompanionId);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the underlying structure.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue