Exemple #1
0
def viewrivals() -> Response:
    frontend = ReflecBeatFrontend(g.data, g.config, g.cache)
    rivals, playerinfo = frontend.get_rivals(g.userID)

    # Reflec Beat 1 has no rivals support
    for no_rivals_support in NO_RIVAL_SUPPORT:
        if no_rivals_support in rivals:
            del rivals[no_rivals_support]

    return render_react(
        'Reflec Beat Rivals',
        'reflec/rivals.react.js',
        {
            'userid': str(g.userID),
            'rivals': rivals,
            'players': playerinfo,
            'versions': {version: name for (game, version, name) in frontend.all_games() if version not in NO_RIVAL_SUPPORT},
        },
        {
            'refresh': url_for('reflec_pages.listrivals'),
            'search': url_for('reflec_pages.searchrivals'),
            'player': url_for('reflec_pages.viewplayer', userid=-1),
            'addrival': url_for('reflec_pages.addrival'),
            'removerival': url_for('reflec_pages.removerival'),
        },
    )
Exemple #2
0
def viewrecords(userid: UserID) -> Response:
    frontend = ReflecBeatFrontend(g.data, g.config, g.cache)
    info = frontend.get_latest_player_info([userid]).get(userid)
    if info is None:
        abort(404)
    versions = {version: name for (game, version, name) in frontend.all_games()}

    return render_react(
        '{}\'s Reflec Beat Records'.format(info['name']),
        'reflec/records.react.js',
        {
            'records': frontend.get_records(userid),
            'songs': frontend.get_all_songs(),
            'players': {},
            'versions': versions,
            'shownames': False,
            'showpersonalsort': True,
            'filterempty': True,
        },
        {
            'refresh': url_for('reflec_pages.listrecords', userid=userid),
            'player': url_for('reflec_pages.viewplayer', userid=-1),
            'individual_score': url_for('reflec_pages.viewtopscores', musicid=-1),
        },
    )
Exemple #3
0
def viewsettings() -> Response:
    frontend = ReflecBeatFrontend(g.data, g.config, g.cache)
    userid = g.userID
    info = frontend.get_all_player_info([userid])[userid]
    if not info:
        abort(404)

    return render_react(
        'Reflec Beat Game Settings',
        'reflec/settings.react.js',
        {
            'player': info,
            'versions': {version: name for (game, version, name) in frontend.all_games()},
        },
        {
            'updatename': url_for('reflec_pages.updatename'),
        },
    )
Exemple #4
0
def viewplayer(userid: UserID) -> Response:
    frontend = ReflecBeatFrontend(g.data, g.config, g.cache)
    info = frontend.get_all_player_info([userid])[userid]
    if not info:
        abort(404)
    latest_version = sorted(info.keys(), reverse=True)[0]

    return render_react(
        '{}\'s Reflec Beat Profile'.format(info[latest_version]['name']),
        'reflec/player.react.js',
        {
            'playerid': userid,
            'own_profile': userid == g.userID,
            'player': info,
            'versions': {version: name for (game, version, name) in frontend.all_games()},
        },
        {
            'refresh': url_for('reflec_pages.listplayer', userid=userid),
            'records': url_for('reflec_pages.viewrecords', userid=userid),
            'scores': url_for('reflec_pages.viewscores', userid=userid),
        },
    )
Exemple #5
0
def viewnetworkrecords() -> Response:
    frontend = ReflecBeatFrontend(g.data, g.config, g.cache)
    network_records = frontend.get_network_records()
    versions = {version: name for (game, version, name) in frontend.all_games()}

    return render_react(
        'Global Reflec Beat Records',
        'reflec/records.react.js',
        {
            'records': network_records['records'],
            'songs': frontend.get_all_songs(),
            'players': network_records['players'],
            'versions': versions,
            'shownames': True,
            'showpersonalsort': False,
            'filterempty': False,
        },
        {
            'refresh': url_for('reflec_pages.listnetworkrecords'),
            'player': url_for('reflec_pages.viewplayer', userid=-1),
            'individual_score': url_for('reflec_pages.viewtopscores', musicid=-1),
        },
    )