mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-12 18:27:23 +01:00
feat: make actor table log nicer
This commit is contained in:
parent
69859fa2dc
commit
dd3fd27f4d
7 changed files with 29 additions and 10 deletions
|
|
@ -109,9 +109,9 @@ namespace Dalamud.Game.ClientState.Actors {
|
|||
|
||||
switch (actorStruct.ObjectKind)
|
||||
{
|
||||
case ObjectKind.Player: return new PlayerCharacter(actorStruct, this.dalamud);
|
||||
case ObjectKind.BattleNpc: return new BattleNpc(actorStruct, this.dalamud);
|
||||
default: return new Actor(actorStruct, this.dalamud);
|
||||
case ObjectKind.Player: return new PlayerCharacter(offset, actorStruct, this.dalamud);
|
||||
case ObjectKind.BattleNpc: return new BattleNpc(offset, actorStruct, this.dalamud);
|
||||
default: return new Actor(offset, actorStruct, this.dalamud);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
using System;
|
||||
|
||||
namespace Dalamud.Game.ClientState.Actors.Types {
|
||||
/// <summary>
|
||||
/// This class represents a basic FFXIV actor.
|
||||
|
|
@ -10,14 +12,21 @@ namespace Dalamud.Game.ClientState.Actors.Types {
|
|||
|
||||
protected Dalamud dalamud;
|
||||
|
||||
/// <summary>
|
||||
/// The address of this actor in memory.
|
||||
/// </summary>
|
||||
public readonly IntPtr Address;
|
||||
|
||||
/// <summary>
|
||||
/// Initialize a representation of a basic FFXIV actor.
|
||||
/// </summary>
|
||||
/// <param name="actorStruct">The memory representation of the base actor.</param>
|
||||
/// <param name="dalamud">A dalamud reference needed to access game data in Resolvers.</param>
|
||||
public Actor(Structs.Actor actorStruct, Dalamud dalamud) {
|
||||
/// <param name="address">The address of this actor in memory.</param>
|
||||
public Actor(IntPtr address, Structs.Actor actorStruct, Dalamud dalamud) {
|
||||
this.actorStruct = actorStruct;
|
||||
this.dalamud = dalamud;
|
||||
this.Address = address;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
using System;
|
||||
using Dalamud.Game.ClientState.Actors.Resolvers;
|
||||
|
||||
namespace Dalamud.Game.ClientState.Actors.Types {
|
||||
|
|
@ -10,7 +11,8 @@ namespace Dalamud.Game.ClientState.Actors.Types {
|
|||
/// </summary>
|
||||
/// <param name="actorStruct">The memory representation of the base actor.</param>
|
||||
/// <param name="dalamud">A dalamud reference needed to access game data in Resolvers.</param>
|
||||
protected Chara(Structs.Actor actorStruct, Dalamud dalamud) : base(actorStruct, dalamud) { }
|
||||
/// <param name="address">The address of this actor in memory.</param>
|
||||
protected Chara(IntPtr address, Structs.Actor actorStruct, Dalamud dalamud) : base(address, actorStruct, dalamud) { }
|
||||
|
||||
/// <summary>
|
||||
/// The level of this Chara.
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
using System;
|
||||
|
||||
namespace Dalamud.Game.ClientState.Actors.Types.NonPlayer {
|
||||
/// <summary>
|
||||
/// This class represents a battle NPC.
|
||||
|
|
@ -8,7 +10,8 @@ namespace Dalamud.Game.ClientState.Actors.Types.NonPlayer {
|
|||
/// </summary>
|
||||
/// <param name="actorStruct">The memory representation of the base actor.</param>
|
||||
/// <param name="dalamud">A dalamud reference needed to access game data in Resolvers.</param>
|
||||
public BattleNpc(Structs.Actor actorStruct, Dalamud dalamud) : base(actorStruct, dalamud) { }
|
||||
/// <param name="address">The address of this actor in memory.</param>
|
||||
public BattleNpc(IntPtr address, Structs.Actor actorStruct, Dalamud dalamud) : base(address, actorStruct, dalamud) { }
|
||||
|
||||
/// <summary>
|
||||
/// The BattleNpc <see cref="BattleNpcSubKind" /> of this BattleNpc.
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
using System;
|
||||
|
||||
namespace Dalamud.Game.ClientState.Actors.Types.NonPlayer {
|
||||
/// <summary>
|
||||
/// This class represents a NPC.
|
||||
|
|
@ -8,7 +10,8 @@ namespace Dalamud.Game.ClientState.Actors.Types.NonPlayer {
|
|||
/// </summary>
|
||||
/// <param name="actorStruct">The memory representation of the base actor.</param>
|
||||
/// <param name="dalamud">A dalamud reference needed to access game data in Resolvers.</param>
|
||||
protected Npc(Structs.Actor actorStruct, Dalamud dalamud) : base(actorStruct, dalamud) { }
|
||||
/// <param name="address">The address of this actor in memory.</param>
|
||||
protected Npc(IntPtr address, Structs.Actor actorStruct, Dalamud dalamud) : base(address, actorStruct, dalamud) { }
|
||||
|
||||
/// <summary>
|
||||
/// The data ID of the NPC linking to their respective game data.
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
using System;
|
||||
using Dalamud.Game.ClientState.Actors.Resolvers;
|
||||
using SharpDX.Text;
|
||||
|
||||
|
|
@ -11,7 +12,8 @@ namespace Dalamud.Game.ClientState.Actors.Types {
|
|||
/// </summary>
|
||||
/// <param name="actorStruct">The memory representation of the base actor.</param>
|
||||
/// <param name="dalamud">A dalamud reference needed to access game data in Resolvers.</param>
|
||||
public PlayerCharacter(Structs.Actor actorStruct, Dalamud dalamud) : base(actorStruct, dalamud) { }
|
||||
/// <param name="address">The address of this actor in memory.</param>
|
||||
public PlayerCharacter(IntPtr address, Structs.Actor actorStruct, Dalamud dalamud) : base(address, actorStruct, dalamud) { }
|
||||
|
||||
/// <summary>
|
||||
/// The current <see cref="World">world</see> of the character.
|
||||
|
|
|
|||
|
|
@ -81,13 +81,13 @@ namespace Dalamud.Interface
|
|||
stateString += $"HomeWorldName: {this.dalamud.ClientState.LocalPlayer.HomeWorld.GameData.Name}\n";
|
||||
stateString += $"LocalCID: {this.dalamud.ClientState.LocalContentId:X}\n";
|
||||
stateString += $"LastLinkedItem: {this.dalamud.Framework.Gui.Chat.LastLinkedItemId.ToString()}\n";
|
||||
stateString += $"TerritoryType: {this.dalamud.ClientState.TerritoryType}\n";
|
||||
stateString += $"TerritoryType: {this.dalamud.ClientState.TerritoryType}\n\n";
|
||||
|
||||
for (var i = 0; i < this.dalamud.ClientState.Actors.Length; i++) {
|
||||
var actor = this.dalamud.ClientState.Actors[i];
|
||||
|
||||
stateString +=
|
||||
$" -> {actor.ActorId:X}[{i}] - {actor.ObjectKind} - {actor.Name} - {actor.Position.X} {actor.Position.Y} {actor.Position.Z}\n";
|
||||
$"{actor.Address.ToInt64():X}:{actor.ActorId:X}[{i}] - {actor.ObjectKind} - {actor.Name} - {actor.Position.X} {actor.Position.Y} {actor.Position.Z}\n";
|
||||
|
||||
if (actor is Npc npc)
|
||||
stateString += $" DataId: {npc.DataId} NameId:{npc.NameId}\n";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue