You've already forked pokecrystal-board
mirror of
https://gitlab.com/xCrystal/pokecrystal-board.git
synced 2025-09-08 08:13:02 -07:00
Generalize get_base_stats.
This commit is contained in:
15
gfx.py
15
gfx.py
@@ -12,12 +12,17 @@ pics = [
|
|||||||
'gfx/shrink2',
|
'gfx/shrink2',
|
||||||
]
|
]
|
||||||
|
|
||||||
base_stats = None
|
cache = {}
|
||||||
|
def get_cache(filename):
|
||||||
|
global cache
|
||||||
|
cached = cache.get(filename)
|
||||||
|
if cached == None:
|
||||||
|
cached = open(filename).read()
|
||||||
|
cache[filename] = cached
|
||||||
|
return cached
|
||||||
|
|
||||||
def get_base_stats():
|
def get_base_stats():
|
||||||
global base_stats
|
return get_cache('data/base_stats.asm')
|
||||||
if not base_stats:
|
|
||||||
base_stats = open('data/base_stats.asm').read()
|
|
||||||
return base_stats
|
|
||||||
|
|
||||||
def get_pokemon_dimensions(name):
|
def get_pokemon_dimensions(name):
|
||||||
if name == 'egg':
|
if name == 'egg':
|
||||||
|
Reference in New Issue
Block a user