Exemple #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)
def kill(game,pursuer,target):
  newTarget = str(util.getTarget(game,target))
  util.changeTarget(game,str(pursuer),newTarget)
  util.addKill(game,str(pursuer))
  util.setLive(game,str(target),False)
  util.setTarget(game,str(target),"")
  util.setPursuer(game,str(target),"")
  if newTarget == pursuer:
    return False
  return True
Exemple #3
0
def getTargetLocation():
    location = util.getLoc(session["game"], util.getTarget(session["game"], session["user"]));
    return json.dumps(location)
Exemple #4
0
def getTarget():
    target = util.getTarget(session["game"], session["user"])
    return json.dumps(target)