fix: update for 6.0

This commit is contained in:
Anna 2021-12-06 18:14:33 -05:00
parent 6fa3023ae0
commit a2965505ba
6 changed files with 37 additions and 24 deletions

View File

@ -86,7 +86,8 @@ namespace Glamaholic {
var list = new List<GlamourItem>(); var list = new List<GlamourItem>();
var agents = Framework.Instance()->GetUiModule()->GetAgentModule(); var agents = Framework.Instance()->GetUiModule()->GetAgentModule();
var dresserAgent = agents->GetAgentByInternalId(AgentId.MiragePrismPrismBox); // TODO: replace with AgentId.MiragePrismPrismBox when ClientStructs is updated
var dresserAgent = agents->GetAgentByInternalId((AgentId) 292);
var itemsStart = *(IntPtr*) ((IntPtr) dresserAgent + 0x28); var itemsStart = *(IntPtr*) ((IntPtr) dresserAgent + 0x28);
if (itemsStart == IntPtr.Zero) { if (itemsStart == IntPtr.Zero) {
@ -94,7 +95,7 @@ namespace Glamaholic {
} }
for (var i = 0; i < 400; i++) { for (var i = 0; i < 400; i++) {
var glamItem = *(GlamourItem*) (itemsStart + i * 32); var glamItem = *(GlamourItem*) (itemsStart + i * 28);
if (glamItem.ItemId == 0) { if (glamItem.ItemId == 0) {
continue; continue;
} }
@ -120,6 +121,7 @@ namespace Glamaholic {
var plate = new Dictionary<PlateSlot, SavedGlamourItem>(); var plate = new Dictionary<PlateSlot, SavedGlamourItem>();
foreach (var slot in (PlateSlot[]) Enum.GetValues(typeof(PlateSlot))) { foreach (var slot in (PlateSlot[]) Enum.GetValues(typeof(PlateSlot))) {
// Updated: 6.0
// from SetGlamourPlateSlot // from SetGlamourPlateSlot
var itemId = *(uint*) (editorInfo + 44 * (int) slot + 7956); var itemId = *(uint*) (editorInfo + 44 * (int) slot + 7956);
var stainId = *(byte*) (editorInfo + 44 * (int) slot + 7980); var stainId = *(byte*) (editorInfo + 44 * (int) slot + 7980);
@ -138,7 +140,7 @@ namespace Glamaholic {
} }
} }
private static unsafe AgentInterface* EditorAgent => Framework.Instance()->GetUiModule()->GetAgentModule()->GetAgentByInternalId((AgentId) 293); private static unsafe AgentInterface* EditorAgent => Framework.Instance()->GetUiModule()->GetAgentModule()->GetAgentByInternalId((AgentId) 294);
internal unsafe void SetGlamourPlateSlot(MirageSource source, int glamId, uint itemId, byte stainId) { internal unsafe void SetGlamourPlateSlot(MirageSource source, int glamId, uint itemId, byte stainId) {
this._setGlamourPlateSlot((IntPtr) EditorAgent, source, glamId, itemId, stainId); this._setGlamourPlateSlot((IntPtr) EditorAgent, source, glamId, itemId, stainId);
@ -175,6 +177,7 @@ namespace Glamaholic {
return; return;
} }
// Updated: 6.0
var editorInfo = *(IntPtr*) ((IntPtr) agent + 0x28); var editorInfo = *(IntPtr*) ((IntPtr) agent + 0x28);
if (editorInfo == IntPtr.Zero) { if (editorInfo == IntPtr.Zero) {
return; return;
@ -184,6 +187,7 @@ namespace Glamaholic {
var current = CurrentPlate; var current = CurrentPlate;
var usedStains = new Dictionary<(uint, uint), uint>(); var usedStains = new Dictionary<(uint, uint), uint>();
// Updated: 6.0
var slotPtr = (PlateSlot*) (editorInfo + 0x18); var slotPtr = (PlateSlot*) (editorInfo + 0x18);
var initialSlot = *slotPtr; var initialSlot = *slotPtr;
foreach (var (slot, item) in plate.Items) { foreach (var (slot, item) in plate.Items) {
@ -378,7 +382,7 @@ namespace Glamaholic {
} }
} }
[StructLayout(LayoutKind.Explicit, Size = 32)] [StructLayout(LayoutKind.Explicit, Size = 28)]
internal readonly struct GlamourItem { internal readonly struct GlamourItem {
[FieldOffset(4)] [FieldOffset(4)]
internal readonly uint Index; internal readonly uint Index;

View File

@ -52,18 +52,27 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="DalamudLinter" Version="1.0.3"/> <PackageReference Include="DalamudLinter"
<PackageReference Include="DalamudPackager" Version="2.1.4"/> Version="1.0.3" />
<PackageReference Include="Fody" Version="6.6.0" PrivateAssets="all"/> <PackageReference Include="DalamudPackager"
<PackageReference Include="Resourcer.Fody" Version="1.8.0" PrivateAssets="all"/> Version="2.1.5" />
<PackageReference Include="Fody"
Version="6.6.0"
PrivateAssets="all" />
<PackageReference Include="Resourcer.Fody"
Version="1.8.0"
PrivateAssets="all" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Content Include="..\icon.png" Link="images/icon.png" CopyToOutputDirectory="PreserveNewest" Visible="false"/> <Content Include="..\icon.png"
Link="images/icon.png"
CopyToOutputDirectory="PreserveNewest"
Visible="false" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<EmbeddedResource Include="help.txt"/> <EmbeddedResource Include="help.txt" />
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@ -5,4 +5,4 @@ description: |
at once at the Glamour Dresser. Supports exporting and importing plates for at once at the Glamour Dresser. Supports exporting and importing plates for
easy sharing. easy sharing.
punchline: Save and swap your glamour plates. punchline: Save and swap your glamour plates.
repo_url: https://git.sr.ht/~jkcclemens/Glamaholic repo_url: https://git.annaclemens.io/ascclemens/Glamaholic

View File

@ -94,7 +94,8 @@ namespace Glamaholic {
internal unsafe void TryOn(IEnumerable<SavedGlamourItem> items) { internal unsafe void TryOn(IEnumerable<SavedGlamourItem> items) {
void SetTryOnSave(bool save) { void SetTryOnSave(bool save) {
var tryOnAgent = (IntPtr) Framework.Instance()->GetUiModule()->GetAgentModule()->GetAgentByInternalId(AgentId.Tryon); // TODO: replace with AgentId.Tryon once ClientStructs is updated for new agents
var tryOnAgent = (IntPtr) Framework.Instance()->GetUiModule()->GetAgentModule()->GetAgentByInternalId((AgentId) 147);
if (tryOnAgent != IntPtr.Zero) { if (tryOnAgent != IntPtr.Zero) {
*(byte*) (tryOnAgent + 0x2E2) = (byte) (save ? 1 : 0); *(byte*) (tryOnAgent + 0x2E2) = (byte) (save ? 1 : 0);
} }

View File

@ -58,9 +58,7 @@ namespace Glamaholic.Ui.Helpers {
var stainId = item.Stain; var stainId = item.Stain;
// TODO: remove this logic in endwalker items[(PlateSlot) i] = new SavedGlamourItem {
var slot = i > 5 ? i - 1 : i;
items[(PlateSlot) slot] = new SavedGlamourItem {
ItemId = itemId, ItemId = itemId,
StainId = stainId, StainId = stainId,
}; };

View File

@ -42,13 +42,14 @@ namespace Glamaholic.Ui.Helpers {
} }
private static unsafe Dictionary<PlateSlot, SavedGlamourItem> GetTryOnItems() { private static unsafe Dictionary<PlateSlot, SavedGlamourItem> GetTryOnItems() {
var agent = (IntPtr) Framework.Instance()->GetUiModule()->GetAgentModule()->GetAgentByInternalId(AgentId.Tryon); // TODO: replace with AgentId.Tryon once ClientStructs is updated for new agents
var agent = (IntPtr) Framework.Instance()->GetUiModule()->GetAgentModule()->GetAgentByInternalId((AgentId) 147);
var firstItem = agent + 0x2E8; var firstItem = agent + 0x2E8;
var items = new Dictionary<PlateSlot, SavedGlamourItem>(); var items = new Dictionary<PlateSlot, SavedGlamourItem>();
for (var i = 0; i < 12; i++) { for (var i = 0; i < 12; i++) {
var item = (TryOnItem*) (firstItem + i * 24); var item = (TryOnItem*) (firstItem + i * 28);
if (item->Slot == 14 || item->ItemId == 0) { if (item->Slot == 14 || item->ItemId == 0) {
continue; continue;
} }
@ -57,10 +58,10 @@ namespace Glamaholic.Ui.Helpers {
if (item->GlamourId != 0) { if (item->GlamourId != 0) {
itemId = item->GlamourId; itemId = item->GlamourId;
} }
// TODO: remove this logic in endwalker // for some reason, this still accounts for belts in EW
var slot = item->Slot > 5 ? item->Slot - 1 : item->Slot; var slot = item->Slot > 5 ? item->Slot - 1 : item->Slot;
items[(PlateSlot) slot] =new SavedGlamourItem { items[(PlateSlot) slot] = new SavedGlamourItem {
ItemId = itemId % Util.HqItemOffset, ItemId = itemId % Util.HqItemOffset,
StainId = item->StainId, StainId = item->StainId,
}; };
@ -69,7 +70,7 @@ namespace Glamaholic.Ui.Helpers {
return items; return items;
} }
[StructLayout(LayoutKind.Explicit, Size = 24)] [StructLayout(LayoutKind.Explicit, Size = 28)]
private readonly struct TryOnItem { private readonly struct TryOnItem {
[FieldOffset(0)] [FieldOffset(0)]
internal readonly byte Slot; internal readonly byte Slot;
@ -80,10 +81,10 @@ namespace Glamaholic.Ui.Helpers {
[FieldOffset(5)] [FieldOffset(5)]
internal readonly byte UnknownByte; internal readonly byte UnknownByte;
[FieldOffset(8)] [FieldOffset(12)]
internal readonly uint ItemId; internal readonly uint ItemId;
[FieldOffset(12)] [FieldOffset(16)]
internal readonly uint GlamourId; internal readonly uint GlamourId;
} }
} }