Skip to content

Instantly share code, notes, and snippets.

@tcprescott
Last active December 12, 2018 07:05
Show Gist options
  • Save tcprescott/29db93adbf232af505a0b2d56880b50f to your computer and use it in GitHub Desktop.
Save tcprescott/29db93adbf232af505a0b2d56880b50f to your computer and use it in GitHub Desktop.
import requests
import json
req = requests.post(
url="https://alttpr.com/seed",
data=json.dumps({
"difficulty": "normal",
"enemizer": "false",
"logic": "NoGlitches",
"mode": "open",
"spoilers": 'false',
"tournament": 'true',
"variation": "key-sanity",
"weapons": "uncle",
})
)
seed_data = json.loads(req.text)
code_map = {
0: 'Bow',
1: 'Boomerang',
2: 'Hookshot',
3: 'Bombs',
4: 'Mushroom',
5: 'Magic Powder',
6: 'Ice Rod',
7: 'Pendant',
8: 'Bombos',
9: 'Ether',
10: 'Quake',
11: 'Lamp',
12: 'Hammer',
13: 'Shovel',
14: 'Flute',
15: 'Bugnet',
16: 'Book',
17: 'Empty Bottle',
18: 'Green Potion',
19: 'Somaria',
20: 'Cape',
21: 'Mirror',
22: 'Boots',
23: 'Gloves',
24: 'Flippers',
25: 'Moon Pearl',
26: 'Shield',
27: 'Tunic',
28: 'Heart',
29: 'Map',
30: 'Compass',
31: 'Big Key'
}
print("Permalink: https://alttpr.com/h/{hash}".format(
hash = seed_data['hash']
))
#this only works with python 3, you'll need to change "if offset in patch" for python 2 support
def search_for_offset(offset):
for patch in seed_data['patch']:
if offset in patch:
return patch.get(offset)
code_display_offset=search_for_offset('1573395')
print(
"Code: {one}/{two}/{three}/{four}/{five}".format(
one=code_map[code_display_offset[2]],
two=code_map[code_display_offset[3]],
three=code_map[code_display_offset[4]],
four=code_map[code_display_offset[5]],
five=code_map[code_display_offset[6]],
)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment