fix bug in image related requests
This commit is contained in:
parent
1f39b6dc4d
commit
acdae93ac3
@ -120,7 +120,7 @@ class Game:
|
||||
"""
|
||||
if npc_id not in self.reaction_table.keys():
|
||||
return 0
|
||||
reaction_id = self.reaction_table[npc_id][int(reaction)]
|
||||
reaction_id = self.reaction_table[npc_id]
|
||||
return read_image(f"./truthseeker/static/images/npc/{npc_id}/{reaction_id}.png")
|
||||
|
||||
def get_player_results(self, responses: dict) -> None:
|
||||
|
@ -120,8 +120,11 @@ def get_data():
|
||||
@routes_api.route("/getNpcImage", methods=["GET", "POST"])
|
||||
def getNpcImage():
|
||||
npc_id = flask.request.values.get("npcid")
|
||||
if npc_id is None:
|
||||
return {"error": 1, "msg": "no npc was given"}
|
||||
image = game_logic.get_npc_image(npc_id)
|
||||
|
||||
if image is None:
|
||||
return {"error": 1, "msg": "npc not found"}
|
||||
response = flask.make_response(image)
|
||||
response.headers.set('Content-Type', 'image/png')
|
||||
response.headers.set(
|
||||
@ -194,6 +197,7 @@ def checkAnwser():
|
||||
if game.has_finished():
|
||||
jsonGameResults = game.generate_game_results()
|
||||
APP.socketio_app.emit("gamefinshed",jsonGameResults,room="game."+game.game_id)
|
||||
#TODO desctruct game
|
||||
response = {"error": 0}
|
||||
return response
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user