feat: add Customize to Chara

This commit is contained in:
goat 2020-04-30 14:10:02 +02:00
parent 0800cc4e91
commit 520cd4bddc
6 changed files with 172 additions and 119 deletions

View file

@ -22,6 +22,11 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<DocumentationFile></DocumentationFile>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)'=='Release'">
<AppOutputBase>$(MSBuildProjectDirectory)\</AppOutputBase>
<PathMap>$(AppOutputBase)=C:\goatsoft\companysecrets\injector\</PathMap>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup>
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
<PackageIcon></PackageIcon>

View file

@ -11,6 +11,7 @@
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<DebugSymbols>true</DebugSymbols>
<DebugType>Portable</DebugType>
<DocumentationFile>$(SolutionDir)\bin\Dalamud.xml</DocumentationFile>
</PropertyGroup>
<PropertyGroup Label="Feature">
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
@ -21,17 +22,10 @@
<ItemGroup Label="Resources">
<None Include="$(SolutionDir)/Resources/**/*" CopyToOutputDirectory="PreserveNewest" Visible="false" />
</ItemGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DocumentationFile>$(SolutionDir)\bin\Dalamud.xml</DocumentationFile>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<DocumentationFile>$(SolutionDir)\bin\Dalamud.xml</DocumentationFile>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<DocumentationFile>$(SolutionDir)\bin\Dalamud.xml</DocumentationFile>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<DocumentationFile>$(SolutionDir)bin\Dalamud.xml</DocumentationFile>
<PropertyGroup Condition="'$(Configuration)'=='Release'">
<AppOutputBase>$(MSBuildProjectDirectory)\</AppOutputBase>
<PathMap>$(AppOutputBase)=C:\goatsoft\companysecrets\dalamud\</PathMap>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup>
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>

View file

@ -0,0 +1,41 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Dalamud.Game.ClientState.Actors
{
/// <summary>
/// This enum describes the indices of the Customize array.
/// </summary>
// TODO: This may need some rework since it may not be entirely accurate (stolen from Sapphire)
public enum CustomizeIndex {
Race = 0x00,
Gender = 0x01,
Tribe = 0x04,
Height = 0x03,
ModelType = 0x02, // Au Ra: changes horns/tails, everything else: seems to drastically change appearance (flip between two sets, odd/even numbers). sometimes retains hairstyle and other features
FaceType = 0x05,
HairStyle = 0x06,
HasHighlights = 0x07, // negative to enable, positive to disable
SkinColor = 0x08,
EyeColor = 0x09, // color of character's right eye
HairColor = 0x0A, // main color
HairColor2 = 0x0B, // highlights color
FaceFeatures = 0x0C, // seems to be a toggle, (-odd and +even for large face covering), opposite for small
FaceFeaturesColor = 0x0D,
Eyebrows = 0x0E,
EyeColor2 = 0x0F, // color of character's left eye
EyeShape = 0x10,
NoseShape = 0x11,
JawShape = 0x12,
LipStyle = 0x13, // lip colour depth and shape (negative values around -120 darker/more noticeable, positive no colour)
LipColor = 0x14,
RaceFeatureSize = 0x15,
RaceFeatureType = 0x16, // negative or out of range tail shapes for race result in no tail (e.g. Au Ra has max of 4 tail shapes), incorrect value can crash client
BustSize = 0x17, // char creator allows up to max of 100, i set to 127 cause who wouldnt but no visible difference
Facepaint = 0x18,
FacepaintColor = 0x19,
}
}

View file

@ -43,5 +43,10 @@ namespace Dalamud.Game.ClientState.Actors.Types {
/// The maximum MP of this Chara.
/// </summary>
public int MaxMp => this.actorStruct.MaxMp;
/// <summary>
/// Byte array describing the visual appearance of this Chara. Indexed by <see cref="CustomizeIndex"/>.
/// </summary>
public byte[] Customize => this.actorStruct.Customize;
}
}

View file

@ -13,7 +13,9 @@ namespace Dalamud.Game.ClientState.Structs
/// </summary>
[StructLayout(LayoutKind.Explicit)]
public struct Actor {
[FieldOffset(0x30)] [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 30)] public string Name;
[FieldOffset(0x30)] [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 30)]
public string Name;
[FieldOffset(116)] public int ActorId;
[FieldOffset(128)] public int DataId;
[FieldOffset(132)] public int OwnerId;
@ -24,9 +26,15 @@ namespace Dalamud.Game.ClientState.Structs
[FieldOffset(145)] public byte PlayerTargetStatus; // This is some kind of enum
[FieldOffset(146)] public byte YalmDistanceFromPlayerY; // and the other is z distance
[FieldOffset(160)] public Position3 Position;
[FieldOffset(0x17B8)] [MarshalAs(UnmanagedType.ByValArray, SizeConst = 28)] public byte[] Customize;
[FieldOffset(0x17F8)] public int TargetActorId;
// 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(0x17d0)] [MarshalAs(UnmanagedType.ByValArray, SizeConst = 7)]
public byte[] CompanyTag;
[FieldOffset(0x1868)] public int NameId;
[FieldOffset(0x1884)] public byte CurrentWorld;
[FieldOffset(0x1886)] public byte HomeWorld;

View file

@ -105,7 +105,7 @@ 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";
$" Level: {chara.Level} ClassJob: {chara.ClassJob.GameData.Name} CHP: {chara.CurrentHp} MHP: {chara.MaxHp} CMP: {chara.CurrentMp} MMP: {chara.MaxMp}\n Customize: {BitConverter.ToString(chara.Customize).Replace("-", " ")}\n";
if (actor is PlayerCharacter pc)
stateString +=