fix: use dye previews when available

This commit is contained in:
Anna 2022-01-09 23:21:07 -05:00
parent 09c0f7e51d
commit 6ce6a530d4
Signed by: anna
GPG Key ID: 0B391D8F06FCD9E0
2 changed files with 15 additions and 4 deletions

View File

@ -153,8 +153,12 @@ namespace Glamaholic {
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);
var item = editorInfo + 44 * (int) slot + 7956;
var itemId = *(uint*) item;
var stainId = *(byte*) (item + 24);
var stainPreviewId = *(byte*) (item + 25);
var actualStainId = stainPreviewId == 0 ? stainId : stainPreviewId;
if (itemId == 0) {
continue;
@ -162,7 +166,7 @@ namespace Glamaholic {
plate[slot] = new SavedGlamourItem {
ItemId = itemId,
StainId = stainId,
StainId = actualStainId,
};
}

View File

@ -63,11 +63,15 @@ namespace Glamaholic.Ui.Helpers {
itemId = item->GlamourId;
}
var stainId = item->StainPreviewId == 0
? item->StainId
: item->StainPreviewId;
// 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 {
ItemId = itemId % Util.HqItemOffset,
StainId = item->StainId,
StainId = stainId,
};
}
@ -82,6 +86,9 @@ namespace Glamaholic.Ui.Helpers {
[FieldOffset(2)]
internal readonly byte StainId;
[FieldOffset(3)]
internal readonly byte StainPreviewId;
[FieldOffset(5)]
internal readonly byte UnknownByte;