20 lines
512 B
Python
20 lines
512 B
Python
import json
|
|
|
|
|
|
class Creatures:
|
|
creatures = None
|
|
|
|
@staticmethod
|
|
def load_creature_data():
|
|
"""Loads the monsters data from a JSON file"""
|
|
with open('app/tables/creatures.json') as f:
|
|
Creatures.creatures = json.load(f)
|
|
|
|
def __init__(self):
|
|
if not Creatures.creatures:
|
|
self.load_creature_data()
|
|
|
|
def get_creature(self, creature_name):
|
|
"""Returns the dictionary of the specified creature."""
|
|
return self.creatures.get(creature_name)
|