feat: CompanyTag field on PlayerCharacter

This commit is contained in:
goat 2020-03-29 23:44:16 +09:00
parent 5f1ce6bfab
commit b5b9e6d8e1
3 changed files with 16 additions and 3 deletions

View file

@ -1,4 +1,5 @@
using Dalamud.Game.ClientState.Actors.Resolvers;
using SharpDX.Text;
namespace Dalamud.Game.ClientState.Actors.Types {
/// <summary>
@ -21,5 +22,10 @@ namespace Dalamud.Game.ClientState.Actors.Types {
/// The home <see cref="World">world</see> of the character.
/// </summary>
public World HomeWorld => new World(this.actorStruct.HomeWorld, this.dalamud);
/// <summary>
/// The Free Company tag of this player.
/// </summary>
public string CompanyTag => Encoding.UTF8.GetString(this.actorStruct.CompanyTag).Substring(2).Replace("\0", "");
}
}

View file

@ -21,8 +21,12 @@ namespace Dalamud.Game.ClientState.Structs
[FieldOffset(141)] public byte SubKind;
[FieldOffset(142)] public bool IsFriendly;
[FieldOffset(160)] public Position3 Position;
[FieldOffset(6276)] public byte CurrentWorld;
[FieldOffset(6278)] public byte HomeWorld;
// This field can't be correctly aligned, so we have to cut it manually.
[FieldOffset(0x17d0)] [MarshalAs(UnmanagedType.ByValArray, SizeConst = 7)] public byte[] CompanyTag;
[FieldOffset(0x1884)] public byte CurrentWorld;
[FieldOffset(0x1886)] public byte HomeWorld;
[FieldOffset(6328)] public int CurrentHp;
[FieldOffset(6332)] public int MaxHp;
[FieldOffset(6336)] public int CurrentMp;

View file

@ -95,7 +95,10 @@ namespace Dalamud.Interface
if (actor is Chara chara)
stateString +=
$" Level: {chara.Level} ClassJob: {chara.ClassJob.GameData.Name} CHP: {chara.CurrentHp} MHP: {chara.MaxHp} CMP: {chara.CurrentMp} MMP: {chara.MaxMp}\n";
;
if (actor is PlayerCharacter pc)
stateString +=
$" HomeWorld: {pc.HomeWorld.GameData.Name} CurrentWorld: {pc.CurrentWorld.GameData.Name} FC: {pc.CompanyTag}\n";
}
}