🔥 monster and spell files no longer part
This commit is contained in:
@ -26,7 +26,7 @@ def monsterFunc(command):
|
||||
# Opens "mensters.json"
|
||||
data = json.load(open('resources/monsters.json', encoding = "utf8"))
|
||||
for monster in data:
|
||||
if str(command) == monster["name"]:
|
||||
if "name" in monster and str(command) == monster["name"]:
|
||||
logThis("Found it!")
|
||||
|
||||
# Looks at the information about the monster and returns that information
|
||||
|
@ -158,6 +158,29 @@ def makeFiles():
|
||||
finally:
|
||||
f.close()
|
||||
|
||||
# Creates monsters.json if it doesn't exist
|
||||
try:
|
||||
f = open("resources/monsters.json","r")
|
||||
except:
|
||||
logThis("monsters.json didn't exist. Making it now.")
|
||||
with open("resources/lookupExamples.json") as f:
|
||||
data = json.load(f)["monster"]
|
||||
with open("resources/monsters.json","w") as f:
|
||||
json.dump(data,f,indent = 4)
|
||||
finally:
|
||||
f.close()
|
||||
|
||||
# Creates spells.json if it doesn't exist
|
||||
try:
|
||||
f = open("resources/spells.json","r")
|
||||
except:
|
||||
logThis("spells.json didn't exist. Making it now.")
|
||||
with open("resources/lookupExamples.json") as f:
|
||||
data = json.load(f)["spell"]
|
||||
with open("resources/spells.json","w") as f:
|
||||
json.dump(data,f,indent = 4)
|
||||
finally:
|
||||
f.close()
|
||||
|
||||
# Creates destinyPoints.txt if it doesn't exist
|
||||
try:
|
||||
|
Reference in New Issue
Block a user