Bungie-net / api

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

How to get name, slot, rarity, type, and icon of every weapon available in Destiny 2 with Python? #1462

Closed hardbody595 closed 3 years ago

hardbody595 commented 3 years ago

I'm brand new to the Bungie API and APIs in general.

I've downloaded the manifest and I want to get started by making a simple list of every weapon in just Destiny 2 in a format similar to light.gg. Looking through an entry in DestinyInventoryItemDefinition, I wasn't able to find the slot the weapons equips to explicitly stated.

How would I do this in Python?

ace51689 commented 3 years ago

Can't help with Python since I just started learning, but as far as where to find the information you're looking for:

Name: displayProperties.name

Slot: itemCategoryHashes[0] will give you a hash that relates to kinetic(2)/energy(3)/power(4)

Rarity: summaryItemHash (3520001075 denotes legendary gear, I haven't been working with rare or exotic so you'll have to look that up)

Type: itemTypeDisplayName (returns a string like, "Auto Rifle". There are other ways to do this using some other keys provided but this is the way I've been doing it.)

Icon: displayProperties.icon (this is part of the url for the icon. You need the prefix of "https://www.bungie.net")

Destiny Sets has a great tool for searching the api for specific items and figuring out how the data looks and what you could possibly do with it. They also have an API explorer that helps when you need to test out different api endpoints.

Hope this stuff helps.