Exemplo n.º 1
0
def game(name):
    if request.method=="GET":
        if session["user"] == util.getCreator(name):
            return render_template("index.html",players=util.getPlayers(name),creator=True,started=util.gameStarted(name))
        else:
            return render_template("index.html",players=util.getPlayers(name),ceator=False)
    else:
        pending = request.form.keys()[0]
        if "tab" in pending:
            return handleTabs(pending)
        if request.form.has_key("startgame"):
            util.startGame(name)
            return render_template("index.html",players=util.getPlayers(name),creator=True,started=True)
        if request.form.has_key("checkin"):
            if util.gameStarted(session["game"]):
                util.callForForce(session["game"],util.getTarget(session["game"],session["user"]))
            if session["user"] == util.getCreator(name):
                return render_template("index.html",players=util.getPlayers(name),creator=True,started=util.gameStarted(name))
            else:
                return render_template("index.html",players=util.getPlayers(name),ceator=False)
        if request.form.has_key("kill"):
            if not util.tryKill(name,session["user"]):
                return redirect(url_for("home"))
            if session["user"] == util.getCreator(name):
                return render_template("index.html",players=util.getPlayers(name),creator=True,started=util.gameStarted(name))
            else:
                return render_template("index.html",players=util.getPlayers(name),ceator=False)
Exemplo n.º 2
0
def updatelocation():
    xcor = request.args.get('xcor', '-1',type=float)
    ycor = request.args.get('ycor', '-1',type=float)
    util.setLoc(session["game"] ,session["user"], [xcor, ycor])
    if session["user"] == util.getCreator(session["game"]):
        return render_template("index.html",players=util.getPlayers(session["game"]),creator=True,started=util.gameStarted(session["game"]))
    else:
        return render_template("index.html",player=util.getPlayers(session["game"]))