Bungie-net / api

Resources for the Bungie.net API
Other
1.22k stars 92 forks source link

The API's handling of uninstanced item perks doesn't seem to work #1860

Open ChiriVulpes opened 1 year ago

ChiriVulpes commented 1 year ago

It breaks the companion app, too:

In-game: image

Companion app: image

Using data from these API fields: 1. perks from DestinyBaseItemComponentSetOfuint32 (both ProfileResponse and CharacterResponse)

2. uninstancedItemPerks from DestinyCharacterProgressionComponent

const perkRefs = undefined
    // only applies to instanced items
    ?? profile.itemComponents?.perks.data?.[itemInstanceId]?.perks
    // 1. `perks`
    ?? (profile.characterUninstancedItemComponents && Object.values(profile.characterUninstancedItemComponents))
        ?.find(uninstancedItemComponents => uninstancedItemComponents?.perks?.data?.[itemHash]?.perks)
        ?.perks?.data?.[itemHash]?.perks
    // 2. `uninstancedItemPerks` 
    ?? (profile.characterProgressions?.data && Object.values(profile.characterProgressions.data))
        ?.find(progression => progression.uninstancedItemPerks[itemHash])
        ?.uninstancedItemPerks[itemHash].perks;

For more example items that aren't working: Defiant Keys & Deep Dive Keys. Afaik the correct way to handle the perks is to hide them by default due to perkVisibility: 2, and in that case only show them if the perk reference has visible: true. But I can't get perk reference info for these ones