mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-12 18:27:23 +01:00
* Refactor and upgrade to new excel design * Obsolete ExcelResolver<T> and use only RowRef<T> * Better benchmarking for Lumina * Add custom game-supported RSV provider * Refactor and move Lazy<T> and nullable/cached row objects to RowRefs * Convert IRSVProvider to delegate, resolve strings by default * Split IExcelRow into IExcelSubrow * Extra lumina documentation * Minor RSV CS fixes * Fix UIGlowPayload warning * Fix rebase * Update to Lumina 5
68 lines
2 KiB
C#
68 lines
2 KiB
C#
using Dalamud.Data;
|
|
using Dalamud.Game.ClientState.Objects;
|
|
using Dalamud.Game.ClientState.Objects.Types;
|
|
using Dalamud.Game.Network.Structures.InfoProxy;
|
|
|
|
using FFXIVClientStructs.FFXIV.Client.UI.Agent;
|
|
|
|
using Lumina.Excel;
|
|
using Lumina.Excel.Sheets;
|
|
|
|
namespace Dalamud.Game.Gui.ContextMenu;
|
|
|
|
/// <summary>
|
|
/// Target information on a default context menu.
|
|
/// </summary>
|
|
public sealed unsafe class MenuTargetDefault : MenuTarget
|
|
{
|
|
/// <summary>
|
|
/// Initializes a new instance of the <see cref="MenuTargetDefault"/> class.
|
|
/// </summary>
|
|
/// <param name="context">The agent associated with the context menu.</param>
|
|
internal MenuTargetDefault(AgentContext* context)
|
|
{
|
|
this.Context = context;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Gets the name of the target.
|
|
/// </summary>
|
|
public string TargetName => this.Context->TargetName.ToString();
|
|
|
|
/// <summary>
|
|
/// Gets the object id of the target.
|
|
/// </summary>
|
|
public ulong TargetObjectId => this.Context->TargetObjectId;
|
|
|
|
/// <summary>
|
|
/// Gets the target object.
|
|
/// </summary>
|
|
public IGameObject? TargetObject => Service<ObjectTable>.Get().SearchById(this.TargetObjectId);
|
|
|
|
/// <summary>
|
|
/// Gets the content id of the target.
|
|
/// </summary>
|
|
public ulong TargetContentId => this.Context->TargetContentId;
|
|
|
|
/// <summary>
|
|
/// Gets the home world id of the target.
|
|
/// </summary>
|
|
public RowRef<World> TargetHomeWorld => LuminaUtils.CreateRef<World>((uint)this.Context->TargetHomeWorldId);
|
|
|
|
/// <summary>
|
|
/// Gets the currently targeted character. Only shows up for specific targets, like friends, party finder listings, or party members.
|
|
/// Just because this is <see langword="null"/> doesn't mean the target isn't a character.
|
|
/// </summary>
|
|
public CharacterData? TargetCharacter
|
|
{
|
|
get
|
|
{
|
|
var target = this.Context->CurrentContextMenuTarget;
|
|
if (target != null)
|
|
return new(target);
|
|
return null;
|
|
}
|
|
}
|
|
|
|
private AgentContext* Context { get; }
|
|
}
|