diff --git a/extras/crystal.py b/extras/crystal.py index a5673c613..0b2da3636 100644 --- a/extras/crystal.py +++ b/extras/crystal.py @@ -236,21 +236,11 @@ def get_pokemon_constant_by_id(id): if id == 0: return None return pokemon_constants[id] -from item_constants import item_constants - -def find_item_label_by_id(id): - if id in item_constants.keys(): - return item_constants[id] - else: return None - -def generate_item_constants(): - """make a list of items to put in constants.asm""" - output = "" - for (id, item) in item_constants.items(): - val = ("$%.2x"%id).upper() - while len(item)<13: item+= " " - output += item + " EQU " + val + "\n" - return output +from item_constants import ( + item_constants, + find_item_label_by_id, + generate_item_constants, +) def command_debug_information(command_byte=None, map_group=None, map_id=None, address=0, info=None, long_info=None, pksv_name=None): "used to help debug in parse_script_engine_script_at" diff --git a/extras/item_constants.py b/extras/item_constants.py index d60dfb1f3..a0506375d 100644 --- a/extras/item_constants.py +++ b/extras/item_constants.py @@ -1,4 +1,7 @@ -item_constants = {1: 'MASTER_BALL', +# -*- coding: utf-8 -*- + +item_constants = { +1: 'MASTER_BALL', 2: 'ULTRA_BALL', 3: 'BRIGHTPOWDER', 4: 'GREAT_BALL', @@ -219,4 +222,20 @@ item_constants = {1: 'MASTER_BALL', 246: 'HM_04', 247: 'HM_05', 248: 'HM_06', -249: 'HM_07'} +249: 'HM_07', +} + +def find_item_label_by_id(id): + if id in item_constants.keys(): + return item_constants[id] + else: return None + +def generate_item_constants(): + """make a list of items to put in constants.asm""" + output = "" + for (id, item) in item_constants.items(): + val = ("$%.2x"%id).upper() + while len(item)<13: item+= " " + output += item + " EQU " + val + "\n" + return output + diff --git a/extras/tests.py b/extras/tests.py index 8e2fc2001..ce4d4663f 100644 --- a/extras/tests.py +++ b/extras/tests.py @@ -12,6 +12,12 @@ from romstr import RomStr from interval_map import IntervalMap from chars import chars, jap_chars +from item_constants import ( + item_constants, + find_item_label_by_id, + generate_item_constants, +) + from crystal import ( rom, load_rom, @@ -56,8 +62,6 @@ from crystal import ( get_id_for_map_constant_label, AsmList, pksv_crystal, - generate_item_constants, - find_item_label_by_id, calculate_pointer_from_bytes_at, isolate_incbins, remove_quoted_text,