Merge pull request #106 from ThomasRubini/fix

This commit is contained in:
Thomas Rubini 2023-03-19 12:08:50 +01:00 committed by GitHub
commit 04fb04c7df
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 4 deletions

View File

@ -134,7 +134,7 @@ class Game:
""" """
print(self.reaction_table) print(self.reaction_table)
if npc_id not in self.reaction_table: if npc_id not in self.reaction_table:
return 0 return None
trait_id = self.reaction_table[npc_id] trait_id = self.reaction_table[npc_id]
reaction = db.session.execute( reaction = db.session.execute(

View File

@ -147,9 +147,8 @@ def get_npc_reaction():
npc_id = flask.request.values.get("npcid") npc_id = flask.request.values.get("npcid")
image = game.get_npc_reaction(npc_id) image = game.get_npc_reaction(npc_id)
errors = ["npc not in game","error reading file"] if image == None:
if image in [0,1]: return {"error": 1, "msg": "npc not in game"}
return {"error": 1, "msg": errors[image]}
response = flask.make_response(image) response = flask.make_response(image)
response.headers.set('Content-Type', 'image/png') response.headers.set('Content-Type', 'image/png')