示例#1
0
def kill():
    if 'username' in session:
        if base.gameONcheck():
            uid = base.getID(session['username'])
            tid = base.getTargetID(uid)
            lat1 = base.getLat(uid)
            long1 = base.getLong(uid)
            lat2 = base.getLat(tid)
            long2 = base.getLong(tid)
            #print lat1
            #print long1
            #print lat2
            #print long2
            if (base.killCheck(lat1, long1, lat2, long2)):
                base.kill(tid)
                if (base.checkWin(uid)):
                    flash("You have won! Congrats!", "success")
                    return redirect(url_for("switch"))

                else:
                    base.assignTargets()
                    flash(
                        "You have killed your target! You have been assigned another target.",
                        "success")
                    return redirect(url_for("game"))

            else:
                flash("You have failed to kill your target.", "error")
                return redirect(url_for("game"))
        else:
            flash("Anathema has yet to begin", "error")
            return redirect(url_for("index"))
    else:
        flash("You are not logged in", "error")
        return redirect(url_for("index"))
示例#2
0
def kill():
    if 'username' in session:
        if base.gameONcheck():
            uid = base.getID(session['username'])
            tid = base.getTargetID(uid)
            lat1 = base.getLat(uid)
            long1 = base.getLong(uid)
            lat2 = base.getLat(tid)
            long2 = base.getLong(tid)
            #print lat1
            #print long1
            #print lat2
            #print long2
            if (base.killCheck (lat1, long1, lat2, long2)):
                base.kill(tid)
                if ( base.checkWin(uid)):
                    flash ("You have won! Congrats!", "success")
                    return redirect (url_for ("switch"))
                
                else:
                    base.assignTargets()
                    flash ("You have killed your target! You have been assigned another target.", "success")
                    return redirect (url_for ("game"))
                    
            else: 
                flash ("You have failed to kill your target.", "error")
                return redirect (url_for ("game"))
        else: 
            flash("Anathema has yet to begin", "error")
            return redirect(url_for("index"))
    else:
        flash("You are not logged in", "error")
        return redirect(url_for("index"))
示例#3
0
def target():
    if 'username' in session:
        print "AFTER LOAD GAME"
        uid = base.getID(session['username'])
        mylat = request.args.get('mylat')
        mylong = request.args.get('mylng')  ##replace and run
        base.updateLat(uid, mylat)  #will upload into mongo
        base.updateLong(uid, mylong)
        base.printData()
    return "hi"
示例#4
0
def target():
    if 'username' in session:
        print "AFTER LOAD GAME"
        uid = base.getID(session['username'])      
        mylat = request.args.get('mylat')
        mylong = request.args.get('mylng') ##replace and run
        base.updateLat (uid, mylat) #will upload into mongo
        base.updateLong (uid, mylong)
        base.printData()
    return "hi"
示例#5
0
def game():
    if 'username' in session:
        if base.gameONcheck():
            print "BEFORE UPDATE"
            base.printData()
            uid = base.getID(session['username'])
            tid = base.getTargetID(uid)
            if (base.checkStatus(uid)):
                return render_template("game.html",
                                       corner=session['username'],
                                       username=session['username'],
                                       target=base.getName(tid))
            else:
                flash("You have been killed", "error")
                return redirect(url_for("index"))
        else:
            flash("Anathema has yet to begin", "error")
            return redirect(url_for("index"))
    else:
        flash("You are not logged in", "error")
        return redirect(url_for("index"))
示例#6
0
def game():
    if 'username' in session:
        if base.gameONcheck():
            print "BEFORE UPDATE"
            base.printData()
            uid = base.getID(session['username'])
            tid = base.getTargetID(uid)
            if (base.checkStatus(uid)):
                return render_template ("game.html",
                                        corner = session['username'],
                                        username = session['username'], 
                                        target = base.getName(tid))
            else:
                flash ("You have been killed", "error")
                return redirect (url_for ("index"))
        else:
            flash("Anathema has yet to begin", "error")
            return redirect(url_for("index"))
    else:
        flash("You are not logged in", "error")
        return redirect(url_for("index"))
示例#7
0
def status():
    if 'username' in session:
        if base.gameONcheck():
            print "AFTER UPDATE"
            base.printData()
            uid = base.getID(session['username'])
            tid = base.getTargetID(uid)
            print tid
            u = base.checkStatus(uid)
            t = base.checkStatus(tid)
            us = ""
            ts = ""
            if (u):
                us = "Alive"
            else:
                flash("You have been killed", "error")
                return redirect(url_for("index"))
                #us = "Dead"

            if (t):
                ts = "Alive"
            else:
                #flash ("Sorry, you have been killed")
                #return redirect (url_for("index"))
                ts = "Dead"
            #print u
            #print t
            return render_template("status.html",
                                   corner=session['username'],
                                   user_status=us,
                                   target_status=ts)
        else:
            flash("Anathema has yet to begin", "error")
            return redirect(url_for("index"))
    else:
        flash("You are not logged in", "error")
        return redirect(url_for("index"))
示例#8
0
def status ():
    if 'username' in session:
        if base.gameONcheck():
            print "AFTER UPDATE"
            base.printData()
            uid = base.getID(session['username'])
            tid = base.getTargetID(uid)
            print tid
            u = base.checkStatus(uid)
            t = base.checkStatus(tid)
            us = ""
            ts = ""
            if (u):
                us = "Alive"
            else:
                flash ("You have been killed", "error")
                return redirect (url_for("index"))
                #us = "Dead"
            
            if (t):
                ts = "Alive"
            else:
                #flash ("Sorry, you have been killed")
                #return redirect (url_for("index"))
                ts = "Dead"
            #print u
            #print t
            return render_template ("status.html", 
                            corner = session['username'],
                            user_status = us,
                            target_status = ts)
        else: 
            flash("Anathema has yet to begin", "error")
            return redirect(url_for("index"))
    else:
        flash("You are not logged in", "error")
        return redirect(url_for("index"))