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 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);
if (itemsStart == IntPtr.Zero) {
@ -94,7 +95,7 @@ namespace Glamaholic {
}
for (var i = 0; i < 400; i++) {
var glamItem = *(GlamourItem*) (itemsStart + i * 32);
var glamItem = *(GlamourItem*) (itemsStart + i * 28);
if (glamItem.ItemId == 0) {
continue;
}
@ -120,6 +121,7 @@ namespace Glamaholic {
var plate = new Dictionary<PlateSlot, SavedGlamourItem>();
foreach (var slot in (PlateSlot[]) Enum.GetValues(typeof(PlateSlot))) {
// Updated: 6.0
// from SetGlamourPlateSlot
var itemId = *(uint*) (editorInfo + 44 * (int) slot + 7956);
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) {
this._setGlamourPlateSlot((IntPtr) EditorAgent, source, glamId, itemId, stainId);
@ -175,6 +177,7 @@ namespace Glamaholic {
return;
}
// Updated: 6.0
var editorInfo = *(IntPtr*) ((IntPtr) agent + 0x28);
if (editorInfo == IntPtr.Zero) {
return;
@ -184,6 +187,7 @@ namespace Glamaholic {
var current = CurrentPlate;
var usedStains = new Dictionary<(uint, uint), uint>();
// Updated: 6.0
var slotPtr = (PlateSlot*) (editorInfo + 0x18);
var initialSlot = *slotPtr;
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 {
[FieldOffset(4)]
internal readonly uint Index;

View File

@ -52,18 +52,27 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="DalamudLinter" Version="1.0.3"/>
<PackageReference Include="DalamudPackager" Version="2.1.4"/>
<PackageReference Include="Fody" Version="6.6.0" PrivateAssets="all"/>
<PackageReference Include="Resourcer.Fody" Version="1.8.0" PrivateAssets="all"/>
<PackageReference Include="DalamudLinter"
Version="1.0.3" />
<PackageReference Include="DalamudPackager"
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>
<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>
<EmbeddedResource Include="help.txt"/>
<EmbeddedResource Include="help.txt" />
</ItemGroup>
</Project>

View File

@ -5,4 +5,4 @@ description: |
at once at the Glamour Dresser. Supports exporting and importing plates for
easy sharing.
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) {
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) {
*(byte*) (tryOnAgent + 0x2E2) = (byte) (save ? 1 : 0);
}

View File

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

View File

@ -42,13 +42,14 @@ namespace Glamaholic.Ui.Helpers {
}
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 items = new Dictionary<PlateSlot, SavedGlamourItem>();
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) {
continue;
}
@ -57,10 +58,10 @@ namespace Glamaholic.Ui.Helpers {
if (item->GlamourId != 0) {
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;
items[(PlateSlot) slot] =new SavedGlamourItem {
items[(PlateSlot) slot] = new SavedGlamourItem {
ItemId = itemId % Util.HqItemOffset,
StainId = item->StainId,
};
@ -69,7 +70,7 @@ namespace Glamaholic.Ui.Helpers {
return items;
}
[StructLayout(LayoutKind.Explicit, Size = 24)]
[StructLayout(LayoutKind.Explicit, Size = 28)]
private readonly struct TryOnItem {
[FieldOffset(0)]
internal readonly byte Slot;
@ -80,10 +81,10 @@ namespace Glamaholic.Ui.Helpers {
[FieldOffset(5)]
internal readonly byte UnknownByte;
[FieldOffset(8)]
[FieldOffset(12)]
internal readonly uint ItemId;
[FieldOffset(12)]
[FieldOffset(16)]
internal readonly uint GlamourId;
}
}