From e0f8308b003b4f6611748d6187df82cde6b09332 Mon Sep 17 00:00:00 2001 From: Ben Hollis Date: Wed, 5 Feb 2025 11:27:33 -0800 Subject: [PATCH] Fix missing item category hashes as well --- docs/CHANGELOG.md | 2 ++ src/app/inventory/store/d2-item-factory.ts | 19 ++++++++++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 2ad0701b9..21d9169f3 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -1,5 +1,7 @@ ## Next +* Also fixed armor not showing up in Organizer due to the Bungie data bug that had all armor as "unknown" class instead of Hunter/Titan/Warlock. + ## 8.57.2 (2025-02-05) * Worked around a bug in the Bungie data that had all armor as "unknown" class instead of Hunter/Titan/Warlock. diff --git a/src/app/inventory/store/d2-item-factory.ts b/src/app/inventory/store/d2-item-factory.ts index 14bfc98bb..632b18b8e 100644 --- a/src/app/inventory/store/d2-item-factory.ts +++ b/src/app/inventory/store/d2-item-factory.ts @@ -437,6 +437,8 @@ export function makeItem( } } + let itemCategoryHashes = getItemCategoryHashes(itemDef); + let classType = itemDef.classType; // We cannot trust the defined class of redacted items, @@ -482,6 +484,21 @@ export function makeItem( // Obviously a subclass is compatible with the Guardian holding it. classType = owner.classType; } + if (classType !== DestinyClass.Unknown) { + switch (classType) { + case DestinyClass.Hunter: + itemCategoryHashes = [...itemCategoryHashes, ItemCategoryHashes.Hunter]; + break; + case DestinyClass.Titan: + itemCategoryHashes = [...itemCategoryHashes, ItemCategoryHashes.Titan]; + break; + case DestinyClass.Warlock: + itemCategoryHashes = [...itemCategoryHashes, ItemCategoryHashes.Warlock]; + break; + default: + break; + } + } } const createdItem: DimItem = { @@ -493,7 +510,7 @@ export function makeItem( // The bucket the item normally resides in (even though it may be in the vault/postmaster) bucket: normalBucket, hash: item.itemHash, - itemCategoryHashes: getItemCategoryHashes(itemDef), + itemCategoryHashes, tier: D2ItemTiers[itemDef.inventory!.tierType] || 'Common', isExotic: itemDef.inventory!.tierType === TierType.Exotic, name,