Created
November 9, 2018 15:56
-
-
Save kfelter/dd61aafc56d88b0c287a264b613a519e to your computer and use it in GitHub Desktop.
This is a method for getting objects from hashes specifically using sqlite3 for the Destiny 2 API
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sqlite3 | |
con = sqlite3.connect('Manifest.content') | |
cur = con.cursor() | |
def getItemName(itemHash): | |
#create id from hash | |
if (itemHash & (1 << (32 - 1))) != 0: | |
itemHash = itemHash - (1 << 32) | |
cur.execute("SELECT json FROM DestinyInventoryItemDefinition WHERE id=?", (itemHash,)) | |
#print(cur.fetchall()) | |
item = json.dumps(cur.fetchall()[0]) | |
item = json.loads(json.loads(item)[0]) | |
print(itemHash,item) | |
return item.get('displayProperties', {}).get('name', 'NA') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment