refactor error message for npc reaction
This commit is contained in:
parent
5745c30147
commit
7a2a23729d
@ -134,7 +134,7 @@ class Game:
|
||||
"""
|
||||
print(self.reaction_table)
|
||||
if npc_id not in self.reaction_table:
|
||||
return 0
|
||||
return None
|
||||
trait_id = self.reaction_table[npc_id]
|
||||
|
||||
reaction = db.session.execute(
|
||||
|
@ -147,9 +147,8 @@ def get_npc_reaction():
|
||||
npc_id = flask.request.values.get("npcid")
|
||||
|
||||
image = game.get_npc_reaction(npc_id)
|
||||
errors = ["npc not in game","error reading file"]
|
||||
if image in [0,1]:
|
||||
return {"error": 1, "msg": errors[image]}
|
||||
if image == None:
|
||||
return {"error": 1, "msg": "npc not in game"}
|
||||
|
||||
response = flask.make_response(image)
|
||||
response.headers.set('Content-Type', 'image/png')
|
||||
|
Loading…
Reference in New Issue
Block a user