2024-07-01 10:26:54 +00:00
|
|
|
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)
|
2024-07-03 13:52:13 +00:00
|
|
|
|
|
|
|
def get_creature_list(self):
|
|
|
|
"""Returns a list of all creatures."""
|
|
|
|
return sorted(list(self.creatures.keys()))
|