mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-22 16:39:19 +01:00
Add SearchByEntityId (#1935)
This commit is contained in:
parent
f5ab8d5e98
commit
d966e5338a
2 changed files with 24 additions and 0 deletions
|
|
@ -98,6 +98,23 @@ internal sealed partial class ObjectTable : IServiceType, IObjectTable
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc/>
|
||||||
|
public IGameObject? SearchByEntityId(uint entityId)
|
||||||
|
{
|
||||||
|
_ = this.WarnMultithreadedUsage();
|
||||||
|
|
||||||
|
if (entityId is 0 or 0xE0000000)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
foreach (var e in this.cachedObjectTable)
|
||||||
|
{
|
||||||
|
if (e.Update() is { } o && o.EntityId == entityId)
|
||||||
|
return o;
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public unsafe nint GetObjectAddress(int index)
|
public unsafe nint GetObjectAddress(int index)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,13 @@ public interface IObjectTable : IEnumerable<IGameObject>
|
||||||
/// <returns>A game object or null.</returns>
|
/// <returns>A game object or null.</returns>
|
||||||
public IGameObject? SearchById(ulong gameObjectId);
|
public IGameObject? SearchById(ulong gameObjectId);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Search for a game object by the Entity ID.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="entityId">Entity ID to find.</param>
|
||||||
|
/// <returns>A game object or null.</returns>
|
||||||
|
public IGameObject? SearchByEntityId(uint entityId);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the address of the game object at the specified index of the object table.
|
/// Gets the address of the game object at the specified index of the object table.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue