feat: handle hidden transmog items (#26)

This commit is contained in:
Axel Cocat 2022-06-27 23:25:28 +02:00 committed by GitHub
parent 0e4fa65d3c
commit 58ca06d1e0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 10 deletions

View file

@ -437,18 +437,23 @@ export class CharacterController {
if (appearance === undefined) { if (appearance === undefined) {
continue; continue;
} }
appearance = { ...appearance };
let invType = this.itemInventoryTypes[equipment.itemEntry]; let invType = this.itemInventoryTypes[equipment.itemEntry];
items.push([invType, appearance.itemDisplayInfoId]); items.push([invType, appearance.itemDisplayInfoId]);
if (transmogOut !== undefined) { if (transmogOut !== undefined) {
if (equipment.transmog !== undefined) { if (equipment.transmog !== undefined) {
const modifiedAppearance = await this.armory.dbc.itemModifiedAppearance().find((row) => row.itemId === equipment.transmog); if (equipment.transmog === 1) {
if (modifiedAppearance !== undefined) { appearance.itemDisplayInfoId = -1; // Hidden gear piece from transmog
const tmogAppearance = await this.armory.dbc.itemAppearance().find((row) => row.id === modifiedAppearance.itemAppearanceId); } else {
if (tmogAppearance !== undefined) { const modifiedAppearance = await this.armory.dbc.itemModifiedAppearance().find((row) => row.itemId === equipment.transmog);
appearance = tmogAppearance; if (modifiedAppearance !== undefined) {
invType = this.itemInventoryTypes[equipment.transmog]; const tmogAppearance = await this.armory.dbc.itemAppearance().find((row) => row.id === modifiedAppearance.itemAppearanceId);
if (tmogAppearance !== undefined) {
appearance = tmogAppearance;
invType = this.itemInventoryTypes[equipment.transmog];
}
} }
} }
} }

View file

@ -155,7 +155,7 @@
$("#list-transmogs-container").show(); $("#list-transmogs-container").show();
for (const item of charData.equipment) { for (const item of charData.equipment) {
if (item.transmog !== undefined) { if (item.transmog !== undefined && item.transmog !== 1) {
const $li = $("<li>").appendTo("#list-transmogs ul"); const $li = $("<li>").appendTo("#list-transmogs ul");
$("<a>") $("<a>")
.attr("href", `{{aowow}}/?item=${item.transmog}`) .attr("href", `{{aowow}}/?item=${item.transmog}`)
@ -173,7 +173,7 @@
const hideHelm = $("#cb-hide-helmet").prop("checked"); const hideHelm = $("#cb-hide-helmet").prop("checked");
const hideCloak = $("#cb-hide-cloak").prop("checked"); const hideCloak = $("#cb-hide-cloak").prop("checked");
const hideTabard = $("#cb-hide-tabard").prop("checked"); const hideTabard = $("#cb-hide-tabard").prop("checked");
setItems(items.filter(item => !((item[0] === 1 && hideHelm) || (item[0] === 16 && hideCloak) || (item[0] === 19 && hideTabard)))); setItems(items.filter(item => !((item[0] === 1 && hideHelm) || (item[0] === 16 && hideCloak) || (item[0] === 19 && hideTabard)) && item[1] !== -1));
}); });
let viewer; let viewer;
@ -198,7 +198,11 @@
const items = transmogged ? charData.characterModelTransmogs : charData.characterModelItems; const items = transmogged ? charData.characterModelTransmogs : charData.characterModelItems;
const item = items.find(([sl, appearance]) => sl === slot); const item = items.find(([sl, appearance]) => sl === slot);
if (item !== undefined) { if (item !== undefined) {
setItems([item]); if (item[1] === -1) {
clearSlots([slot]);
} else {
setItems([item]);
}
} }
} else { } else {
clearSlots([slot]); clearSlots([slot]);
@ -416,7 +420,8 @@
sheathOff: -1, sheathOff: -1,
}, },
cls: charData.class, cls: charData.class,
items: (charData.characterModelTransmogs ?? charData.characterModelItems).filter(item => !((item[0] === 1 && hideHelm) || (item[0] === 16 && hideCloak))), items: (charData.characterModelTransmogs ?? charData.characterModelItems)
.filter(item => !((item[0] === 1 && hideHelm) || (item[0] === 16 && hideCloak)) && item[1] !== -1),
models: { models: {
type: ZamModelViewer.Wow.Types.CHARACTER, type: ZamModelViewer.Wow.Types.CHARACTER,
id: `${races[charData.race]}${genders[charData.gender]}`, id: `${races[charData.race]}${genders[charData.gender]}`,