示例#1
0
def questControlMenu():
    player = db.getPlayer(session.get("discordId"))
    quests = [
        quest for quest in db.getAllQuests()
        if quest.dm and (quest.commander == player.discordId
                         or player.discordId in quest.players.keys())
    ]
    # Sort by date (no date after everything else)
    quests = sorted(quests, key=lambda x: x.date if x.date else float('inf'))
    currentQuestId = request.args.get("questId")
    currentQuest = None
    if currentQuestId == None:
        if len(
                quests
        ) > 0:  # If the quest id wasn't specified, default the first on the list
            currentQuest = quests[0]
    else:
        for quest in quests:  # Find the quest with the right id
            if quest.questId == currentQuestId:
                currentQuest = quest
    playerDict = {player.discordId: player for player in db.getAllPlayers()}
    return render_template("controlcenter.html",
                           player=player,
                           quests=quests,
                           currentQuest=currentQuest,
                           roles=Roles,
                           playerDict=playerDict)
示例#2
0
def dmCorner():
    player = db.getPlayer(session.get("discordId"))
    quests = db.getAllQuests()
    playerDict = {player.discordId: player for player in db.getAllPlayers()}
    return render_template("dmcorner.html",
                           player=player,
                           quests=quests,
                           playerDict=playerDict)
示例#3
0
def chronicle():
    player = db.getPlayer(session.get("discordId"))
    playerDict = {player.discordId: player for player in db.getAllPlayers()}
    pastQuests = db.getPastQuests()
    return render_template("thechronicle.html",
                           player=player,
                           playerDict=playerDict,
                           pastQuests=pastQuests,
                           roles=Roles)
示例#4
0
def index():
    player = db.getPlayer(session.get("discordId"))
    playerDict = {player.discordId: player for player in db.getAllPlayers()}
    quests = db.getAllQuests()
    quests = sorted(quests, key=lambda x: x.date if x.date else float('inf'))
    return render_template("questboard.html",
                           player=player,
                           quests=quests,
                           playerDict=playerDict,
                           roles=Roles)
示例#5
0
def questadmin():
    playerDict = {
        int(player.discordId): player
        for player in db.getAllPlayers()
    }
    quests = db.getAllQuests()
    player = db.getPlayer(session.get("discordId"))
    return render_template("questadmin.html",
                           player=player,
                           quests=quests,
                           playerDict=playerDict,
                           roles=Roles)
示例#6
0
def addQuestPageDM():
    player = db.getPlayer(session.get("discordId"))
    playerDict = {player.discordId: player for player in db.getAllPlayers()}
    if request.args.get("questId"):
        questId = request.args.get('questId')
        quest = db.getQuest(questId)
        if quest == None: return (f"Quest id {questId} not found", 404)
    else:
        quest = Quest()
    return render_template("addquest.html",
                           player=player,
                           prefill=quest,
                           DM=True,
                           playerDict=playerDict)
示例#7
0
def actionLogs():
    logs = subprocess.check_output(
        ['/usr/bin/tail', '-20', './logs/questactions.log'])
    logs = logs.decode("utf-8").splitlines()[::-1]
    players = db.getAllPlayers()
    quests = db.getAllQuests()
    for i, log in enumerate(logs):
        for player in players:
            logs[i] = logs[i].replace(
                str(player.discordId), f"""
            <div class="inlinediv discord-{player.discordId}">
                <div class="innerdiv nick">{player.nick}</div>
                <div class="innerdiv discordId">{player.discordId}</div>
            </div>
            """)
    player = db.getPlayer(session.get("discordId"))
    return render_template("serverlogs.html",
                           player=player,
                           players=players,
                           quests=quests,
                           logs=logs)
示例#8
0
def playeradmin():
    player = db.getPlayer(session.get("discordId"))
    return render_template("playeradmin.html",
                           player=player,
                           players=db.getAllPlayers(),
                           quests=db.getAllQuests())