Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: missing items due to index '0' being falsy #2176

Merged
merged 1 commit into from
Jul 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions native/app/store/Account/AccountSlice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -748,12 +748,12 @@ export function getItemDefinition(itemHash: ItemHash): DestinyItemDefinition {
return definitionItem;
}

if (itemDef?.i) {
if (itemDef.i !== undefined) {
const icon = Icons[itemDef.i];
definitionItem.icon = `${iconUrl}${icon}`;
}

if (itemDef?.itd) {
if (itemDef.itd !== undefined) {
definitionItem.itemTypeDisplayName = ItemTypeDisplayName[itemDef.itd]!;
definitionItem.search = `${definitionItem.itemTypeDisplayName.toLowerCase()} ${definitionItem.search}`;
}
Expand All @@ -762,7 +762,7 @@ export function getItemDefinition(itemHash: ItemHash): DestinyItemDefinition {
definitionItem.screenshot = `${screenshotUrl}${itemDef.s}`;
}

if (itemDef?.iw) {
if (itemDef.iw !== undefined) {
const waterMark = IconWaterMarks[itemDef.iw];
definitionItem.watermark = `${iconUrl}${waterMark}`;
}
Expand All @@ -775,7 +775,7 @@ export function getItemDefinition(itemHash: ItemHash): DestinyItemDefinition {
definitionItem.flavorText = itemDef.f;
}

if (itemDef?.d) {
if (itemDef.d !== undefined) {
definitionItem.description = Descriptions[itemDef.d] ?? "";
}

Expand Down Expand Up @@ -814,7 +814,7 @@ export function getItemDefinition(itemHash: ItemHash): DestinyItemDefinition {

const traitIds: string[] = [];
const traitDef = itemDef?.tI;
if (traitDef) {
if (traitDef !== undefined) {
for (const trait of traitDef) {
const traitIndex = trait;
const traitId = TraitIds[traitIndex]!;
Expand All @@ -826,11 +826,11 @@ export function getItemDefinition(itemHash: ItemHash): DestinyItemDefinition {
definitionItem.traitIds = traitIds;

const statGroupHashIndex = itemDef.st?.sgs;
if (statGroupHashIndex) {
if (statGroupHashIndex !== undefined) {
definitionItem.statGroupHash = StatGroupHash[statGroupHashIndex]!;
}
const bucketTypeIndex = itemDef.b;
if (bucketTypeIndex) {
if (bucketTypeIndex !== undefined) {
definitionItem.recoveryBucketHash = BucketTypeHashArray[bucketTypeIndex] ?? (0 as BucketHash);
}
definitionItem.name = itemDef?.n ?? "";
Expand Down