From f6fc07d1c9fc1fdf9d95842d59879450b98fa721 Mon Sep 17 00:00:00 2001 From: yenatch Date: Wed, 17 Feb 2016 17:12:51 -0500 Subject: [PATCH] Assume pokemon pics are 7x7 if not in base stats. --- gfx.py | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/gfx.py b/gfx.py index b39d919ef..abd53c5b0 100644 --- a/gfx.py +++ b/gfx.py @@ -32,17 +32,22 @@ def get_base_stats(): return base_stats def get_pokemon_dimensions(name): - if name == 'egg': - return 5, 5 - if name.startswith('unown_'): - name = 'unown' - base_stats = get_base_stats() - start = base_stats.find('\tdb ' + name.upper()) - start = base_stats.find('\tdn ', start) - end = base_stats.find('\n', start) - line = base_stats[start:end].replace(',', ' ') - w, h = map(int, line.split()[1:3]) - return w, h + try: + if name == 'egg': + return 5, 5 + if name == 'questionmark': + return 7, 7 + if name.startswith('unown_'): + name = 'unown' + base_stats = get_base_stats() + start = base_stats.find('\tdb ' + name.upper()) + start = base_stats.find('\tdn ', start) + end = base_stats.find('\n', start) + line = base_stats[start:end].replace(',', ' ') + w, h = map(int, line.split()[1:3]) + return w, h + except: + return 7, 7 def filepath_rules(filepath): """Infer attributes of certain graphics by their location in the filesystem."""