added solo game flag
This commit is contained in:
parent
62ddcff733
commit
8873e1a14a
@ -63,6 +63,7 @@ class Game:
|
||||
self.gamedata = {}
|
||||
self.reaction_table = {}
|
||||
self.creatation_timestamp = int(time.time())
|
||||
self.is_solo = False
|
||||
|
||||
def set_owner(self, username: str) -> Member:
|
||||
"""
|
||||
@ -102,6 +103,8 @@ class Game:
|
||||
# TODO Get language from player
|
||||
self.gamedata, self.reaction_table = generate_game_data("FR")
|
||||
self.gamedata["game_id"] = self.game_id
|
||||
if self.is_solo:
|
||||
self.gamedata["solo"] = True
|
||||
|
||||
def get_member(self, username: str) -> Union[Member, None]:
|
||||
"""
|
||||
|
@ -39,9 +39,12 @@ def create_game():
|
||||
return {"error": 1, "msg": "invalid username"}
|
||||
if len(game_logic.games_list) >= int(os.getenv("GAME_LIMIT")):
|
||||
return {"error": 1, "msg": "Game limit reach"}
|
||||
is_solo = flask.request.values.get("solo")
|
||||
response = {}
|
||||
response["error"] = 0
|
||||
game = game_logic.create_game(owner=username)
|
||||
if is_solo == "true":
|
||||
game.is_solo = True
|
||||
response["game_id"] = game.game_id
|
||||
|
||||
flask.session["game_id"] = game.game_id
|
||||
|
@ -219,6 +219,7 @@ async function startSoloGame(){
|
||||
username = document.getElementById("game_username").value;
|
||||
let data = {}
|
||||
data["username"] = username;
|
||||
data["solo"] = true;
|
||||
await makeAPIRequest("createGame",data);
|
||||
start = makeAPIRequest("startGame");
|
||||
start.then(()=>{
|
||||
|
Loading…
Reference in New Issue
Block a user