Update for 6.0

This commit is contained in:
Ottermandias 2021-12-10 10:25:53 +01:00
parent 5d3a39110a
commit 7e01fe52f4
10 changed files with 252 additions and 266 deletions

View file

@ -51,12 +51,12 @@ namespace Glamourer.Customization
public Menu[] Menus { get; set; } = new Menu[NumMenus]; public Menu[] Menus { get; set; } = new Menu[NumMenus];
public byte[] Voices { get; set; } = new byte[NumVoices]; public byte[] Voices { get; set; } = new byte[NumVoices];
public FacialFeatures[] FacialFeatureByFace { get; set; } = new FacialFeatures[NumFaces]; public FacialFeatures[] FacialFeatureByFace { get; set; } = new FacialFeatures[NumFaces];
public CharaMakeType.UnkStruct3347Struct[] Equip { get; set; } = new CharaMakeType.UnkStruct3347Struct[NumEquip]; public CharaMakeType.CharaMakeTypeUnkData3347Obj[] Equip { get; set; } = new CharaMakeType.CharaMakeTypeUnkData3347Obj[NumEquip];
public override void PopulateData(RowParser parser, Lumina.GameData gameData, Language language) public override void PopulateData(RowParser parser, Lumina.GameData gameData, Language language)
{ {
RowId = parser.Row; RowId = parser.RowId;
SubRowId = parser.SubRow; SubRowId = parser.SubRowId;
Race = new LazyRow<Race>(gameData, parser.ReadColumn<uint>(0), language); Race = new LazyRow<Race>(gameData, parser.ReadColumn<uint>(0), language);
Tribe = new LazyRow<Tribe>(gameData, parser.ReadColumn<uint>(1), language); Tribe = new LazyRow<Tribe>(gameData, parser.ReadColumn<uint>(1), language);
Gender = parser.ReadColumn<sbyte>(2); Gender = parser.ReadColumn<sbyte>(2);
@ -101,7 +101,7 @@ namespace Glamourer.Customization
for (var i = 0; i < NumEquip; ++i) for (var i = 0; i < NumEquip; ++i)
{ {
Equip[i] = new CharaMakeType.UnkStruct3347Struct Equip[i] = new CharaMakeType.CharaMakeTypeUnkData3347Obj()
{ {
Helmet = parser.ReadColumn<ulong>( Helmet = parser.ReadColumn<ulong>(
3 + (MaxNumValues + 7 + NumGraphics) * NumMenus + NumVoices + NumFaces * NumFeatures + i * 7 + 0), 3 + (MaxNumValues + 7 + NumGraphics) * NumMenus + NumVoices + NumFaces * NumFeatures + i * 7 + 0),

View file

@ -23,7 +23,7 @@ namespace Glamourer.Customization
[StructLayout(LayoutKind.Sequential, Pack = 1)] [StructLayout(LayoutKind.Sequential, Pack = 1)]
public struct CharacterCustomization public struct CharacterCustomization
{ {
public const int CustomizationOffset = 0x1898; public const int CustomizationOffset = 0xDD8;
public const int CustomizationBytes = 26; public const int CustomizationBytes = 26;
public static CharacterCustomization Default = new() public static CharacterCustomization Default = new()

View file

@ -3,30 +3,28 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using Penumbra.GameData.Enums; using Penumbra.GameData.Enums;
namespace Glamourer.Customization namespace Glamourer.Customization;
public class CustomizationSet
{ {
public class CustomizationSet
{
public const int DefaultAvailable = public const int DefaultAvailable =
(1 << (int) CustomizationId.Height) (1 << (int)CustomizationId.Height)
| (1 << (int) CustomizationId.Hairstyle) | (1 << (int)CustomizationId.Hairstyle)
| (1 << (int) CustomizationId.SkinColor) | (1 << (int)CustomizationId.SkinColor)
| (1 << (int) CustomizationId.EyeColorR) | (1 << (int)CustomizationId.EyeColorR)
| (1 << (int) CustomizationId.EyeColorL) | (1 << (int)CustomizationId.EyeColorL)
| (1 << (int) CustomizationId.HairColor) | (1 << (int)CustomizationId.HairColor)
| (1 << (int) CustomizationId.HighlightColor) | (1 << (int)CustomizationId.HighlightColor)
| (1 << (int) CustomizationId.FacialFeaturesTattoos) | (1 << (int)CustomizationId.FacialFeaturesTattoos)
| (1 << (int) CustomizationId.TattooColor) | (1 << (int)CustomizationId.TattooColor)
| (1 << (int) CustomizationId.LipColor) | (1 << (int)CustomizationId.LipColor)
| (1 << (int) CustomizationId.Height); | (1 << (int)CustomizationId.Height);
internal CustomizationSet(SubRace clan, Gender gender) internal CustomizationSet(SubRace clan, Gender gender)
{ {
Gender = gender; Gender = gender;
Clan = clan; Clan = clan;
_settingAvailable = _settingAvailable = clan.ToRace() == Race.Hrothgar && gender == Gender.Female
clan.ToRace() == Race.Viera && gender == Gender.Male
|| clan.ToRace() == Race.Hrothgar && gender == Gender.Female
? 0 ? 0
: DefaultAvailable; : DefaultAvailable;
} }
@ -40,10 +38,10 @@ namespace Glamourer.Customization
private int _settingAvailable; private int _settingAvailable;
internal void SetAvailable(CustomizationId id) internal void SetAvailable(CustomizationId id)
=> _settingAvailable |= 1 << (int) id; => _settingAvailable |= 1 << (int)id;
public bool IsAvailable(CustomizationId id) public bool IsAvailable(CustomizationId id)
=> (_settingAvailable & (1 << (int) id)) != 0; => (_settingAvailable & (1 << (int)id)) != 0;
public int NumEyebrows { get; internal set; } public int NumEyebrows { get; internal set; }
public int NumEyeShapes { get; internal set; } public int NumEyeShapes { get; internal set; }
@ -72,7 +70,7 @@ namespace Glamourer.Customization
public IReadOnlyList<CharaMakeParams.MenuType> Types { get; internal set; } = null!; public IReadOnlyList<CharaMakeParams.MenuType> Types { get; internal set; } = null!;
public string Option(CustomizationId id) public string Option(CustomizationId id)
=> OptionName[(int) id]; => OptionName[(int)id];
public Customization FacialFeature(int faceIdx, int idx) public Customization FacialFeature(int faceIdx, int idx)
=> FeaturesTattoos[faceIdx - 1][idx]; => FeaturesTattoos[faceIdx - 1][idx];
@ -129,8 +127,8 @@ namespace Glamourer.Customization
switch (id.ToType()) switch (id.ToType())
{ {
case CharaMakeParams.MenuType.Percentage: return new Customization(id, (byte) idx, 0, (ushort) idx); case CharaMakeParams.MenuType.Percentage: return new Customization(id, (byte)idx, 0, (ushort)idx);
case CharaMakeParams.MenuType.ListSelector: return new Customization(id, (byte) idx, 0, (ushort) idx); case CharaMakeParams.MenuType.ListSelector: return new Customization(id, (byte)idx, 0, (ushort)idx);
} }
return id switch return id switch
@ -154,7 +152,7 @@ namespace Glamourer.Customization
} }
public CharaMakeParams.MenuType Type(CustomizationId id) public CharaMakeParams.MenuType Type(CustomizationId id)
=> Types[(int) id]; => Types[(int)id];
public int Count(CustomizationId id) public int Count(CustomizationId id)
@ -189,5 +187,4 @@ namespace Glamourer.Customization
_ => throw new ArgumentOutOfRangeException(nameof(id), id, null), _ => throw new ArgumentOutOfRangeException(nameof(id), id, null),
}; };
} }
}
} }

Binary file not shown.

View file

@ -1,20 +1,20 @@
using Dalamud.Game.ClientState.Objects.Types; using Dalamud.Game.ClientState.Objects.Types;
namespace Glamourer namespace Glamourer;
public static class CharacterExtensions
{ {
public static class CharacterExtensions public const int WetnessOffset = 0x19E4;
{ public const byte WetnessFlag = 0x08;
public const int WetnessOffset = 0x19A5; public const int StateFlagsOffset = 0xDF6;
public const byte WetnessFlag = 0x10;
public const int StateFlagsOffset = 0x106C;
public const byte HatHiddenFlag = 0x01; public const byte HatHiddenFlag = 0x01;
public const byte VisorToggledFlag = 0x10; public const byte VisorToggledFlag = 0x10;
public const int AlphaOffset = 0x182C; public const int AlphaOffset = 0x18B8;
public const int WeaponHiddenOffset = 0xF64; public const int WeaponHiddenOffset = 0xCD4;
public const byte WeaponHiddenFlag = 0x02; public const byte WeaponHiddenFlag = 0x02;
public static unsafe bool IsWet(this Character a) public static unsafe bool IsWet(this Character a)
=> (*((byte*) a.Address + WetnessOffset) & WetnessFlag) != 0; => (*((byte*)a.Address + WetnessOffset) & WetnessFlag) != 0;
public static unsafe bool SetWetness(this Character a, bool value) public static unsafe bool SetWetness(this Character a, bool value)
{ {
@ -23,14 +23,14 @@ namespace Glamourer
return false; return false;
if (value) if (value)
*((byte*) a.Address + WetnessOffset) = (byte) (*((byte*) a.Address + WetnessOffset) | WetnessFlag); *((byte*)a.Address + WetnessOffset) = (byte)(*((byte*)a.Address + WetnessOffset) | WetnessFlag);
else else
*((byte*) a.Address + WetnessOffset) = (byte) (*((byte*) a.Address + WetnessOffset) & ~WetnessFlag); *((byte*)a.Address + WetnessOffset) = (byte)(*((byte*)a.Address + WetnessOffset) & ~WetnessFlag);
return true; return true;
} }
public static unsafe ref byte StateFlags(this Character a) public static unsafe ref byte StateFlags(this Character a)
=> ref *((byte*) a.Address + StateFlagsOffset); => ref *((byte*)a.Address + StateFlagsOffset);
public static bool SetStateFlag(this Character a, bool value, byte flag) public static bool SetStateFlag(this Character a, bool value, byte flag)
{ {
@ -40,9 +40,9 @@ namespace Glamourer
return false; return false;
if (value) if (value)
a.StateFlags() = (byte) (current | flag); a.StateFlags() = (byte)(current | flag);
else else
a.StateFlags() = (byte) (current & ~flag); a.StateFlags() = (byte)(current & ~flag);
return true; return true;
} }
@ -51,7 +51,7 @@ namespace Glamourer
public static unsafe bool IsWeaponHidden(this Character a) public static unsafe bool IsWeaponHidden(this Character a)
=> (a.StateFlags() & WeaponHiddenFlag) != 0 => (a.StateFlags() & WeaponHiddenFlag) != 0
&& (*((byte*) a.Address + WeaponHiddenOffset) & WeaponHiddenFlag) != 0; && (*((byte*)a.Address + WeaponHiddenOffset) & WeaponHiddenFlag) != 0;
public static bool IsVisorToggled(this Character a) public static bool IsVisorToggled(this Character a)
=> (a.StateFlags() & VisorToggledFlag) != 0; => (a.StateFlags() & VisorToggledFlag) != 0;
@ -62,11 +62,11 @@ namespace Glamourer
public static unsafe bool SetWeaponHidden(this Character a, bool value) public static unsafe bool SetWeaponHidden(this Character a, bool value)
{ {
var ret = SetStateFlag(a, value, WeaponHiddenFlag); var ret = SetStateFlag(a, value, WeaponHiddenFlag);
var val = *((byte*) a.Address + WeaponHiddenOffset); var val = *((byte*)a.Address + WeaponHiddenOffset);
if (value) if (value)
*((byte*) a.Address + WeaponHiddenOffset) = (byte) (val | WeaponHiddenFlag); *((byte*)a.Address + WeaponHiddenOffset) = (byte)(val | WeaponHiddenFlag);
else else
*((byte*) a.Address + WeaponHiddenOffset) = (byte) (val & ~WeaponHiddenFlag); *((byte*)a.Address + WeaponHiddenOffset) = (byte)(val & ~WeaponHiddenFlag);
return ret || (val & WeaponHiddenFlag) != 0 != value; return ret || (val & WeaponHiddenFlag) != 0 != value;
} }
@ -74,6 +74,5 @@ namespace Glamourer
=> SetStateFlag(a, value, VisorToggledFlag); => SetStateFlag(a, value, VisorToggledFlag);
public static unsafe ref float Alpha(this Character a) public static unsafe ref float Alpha(this Character a)
=> ref *(float*) ((byte*) a.Address + AlphaOffset); => ref *(float*)((byte*)a.Address + AlphaOffset);
}
} }

View file

@ -5,8 +5,8 @@
<PlatformTarget>x64</PlatformTarget> <PlatformTarget>x64</PlatformTarget>
<RootNamespace>Glamourer</RootNamespace> <RootNamespace>Glamourer</RootNamespace>
<AssemblyName>Glamourer</AssemblyName> <AssemblyName>Glamourer</AssemblyName>
<FileVersion>0.0.6.2</FileVersion> <FileVersion>0.0.7.0</FileVersion>
<AssemblyVersion>0.0.6.2</AssemblyVersion> <AssemblyVersion>0.0.7.0</AssemblyVersion>
<Company>SoftOtter</Company> <Company>SoftOtter</Company>
<Product>Glamourer</Product> <Product>Glamourer</Product>
<Copyright>Copyright © 2020</Copyright> <Copyright>Copyright © 2020</Copyright>

View file

@ -5,10 +5,10 @@
"Description": "Adds functionality to change and store appearance of players, customization and equip. Requires Penumbra to be installed and activated to work. Can also add preview options to the Changed Items tab for Penumbra.", "Description": "Adds functionality to change and store appearance of players, customization and equip. Requires Penumbra to be installed and activated to work. Can also add preview options to the Changed Items tab for Penumbra.",
"Tags": [ "Appearance", "Glamour", "Race", "Outfit", "Armor", "Clothes", "Skins", "Customization", "Design", "Character" ], "Tags": [ "Appearance", "Glamour", "Race", "Outfit", "Armor", "Clothes", "Skins", "Customization", "Design", "Character" ],
"InternalName": "Glamourer", "InternalName": "Glamourer",
"AssemblyVersion": "0.0.6.2", "AssemblyVersion": "0.0.7.0",
"RepoUrl": "https://github.com/Ottermandias/Glamourer", "RepoUrl": "https://github.com/Ottermandias/Glamourer",
"ApplicableVersion": "any", "ApplicableVersion": "any",
"DalamudApiLevel": 4, "DalamudApiLevel": 5,
"LoadPriority": -100, "LoadPriority": -100,
"ImageUrls": null, "ImageUrls": null,
"IconUrl": "https://raw.githubusercontent.com/Ottermandias/Glamourer/master/images/icon.png" "IconUrl": "https://raw.githubusercontent.com/Ottermandias/Glamourer/master/images/icon.png"

View file

@ -352,13 +352,7 @@ namespace Glamourer.Gui
ImGui.PushFont(UiBuilder.IconFont); ImGui.PushFont(UiBuilder.IconFont);
var icon = customization.Gender == Gender.Male ? FontAwesomeIcon.Mars : FontAwesomeIcon.Venus; var icon = customization.Gender == Gender.Male ? FontAwesomeIcon.Mars : FontAwesomeIcon.Venus;
var restricted = false; var restricted = false;
if (customization.Race == Race.Viera) if (customization.Race == Race.Hrothgar)
{
ImGui.PushStyleVar(ImGuiStyleVar.Alpha, 0.25f);
icon = FontAwesomeIcon.VenusDouble;
restricted = true;
}
else if (customization.Race == Race.Hrothgar)
{ {
ImGui.PushStyleVar(ImGuiStyleVar.Alpha, 0.25f); ImGui.PushStyleVar(ImGuiStyleVar.Alpha, 0.25f);
icon = FontAwesomeIcon.MarsDouble; icon = FontAwesomeIcon.MarsDouble;

View file

@ -63,12 +63,8 @@ namespace Glamourer.Gui
customization.Race = race; customization.Race = race;
customization.Clan = clan; customization.Clan = clan;
customization.Gender = race switch if (race == Race.Hrothgar)
{ customization.Gender = Gender.Male;
Race.Hrothgar => Gender.Male,
Race.Viera => Gender.Female,
_ => customization.Gender,
};
FixUpAttributes(ref customization); FixUpAttributes(ref customization);

View file

@ -6,11 +6,11 @@
"Description": "Adds functionality to change and store appearance of players, customization and equip. Requires Penumbra to be installed and activated to work. Can also add preview options to the Changed Items tab for Penumbra.", "Description": "Adds functionality to change and store appearance of players, customization and equip. Requires Penumbra to be installed and activated to work. Can also add preview options to the Changed Items tab for Penumbra.",
"Tags": [ "Appearance", "Glamour", "Race", "Outfit", "Armor", "Clothes", "Skins", "Customization", "Design", "Character" ], "Tags": [ "Appearance", "Glamour", "Race", "Outfit", "Armor", "Clothes", "Skins", "Customization", "Design", "Character" ],
"InternalName": "Glamourer", "InternalName": "Glamourer",
"AssemblyVersion": "0.0.6.2", "AssemblyVersion": "0.0.7.0",
"TestingAssemblyVersion": "0.0.6.2", "TestingAssemblyVersion": "0.0.7.0",
"RepoUrl": "https://github.com/Ottermandias/Glamourer", "RepoUrl": "https://github.com/Ottermandias/Glamourer",
"ApplicableVersion": "any", "ApplicableVersion": "any",
"DalamudApiLevel": 4, "DalamudApiLevel": 5,
"IsHide": "False", "IsHide": "False",
"IsTestingExclusive": "false", "IsTestingExclusive": "false",
"DownloadCount": 1, "DownloadCount": 1,