Exemplo n.º 1
0
def listplayer(userid: UserID) -> Dict[str, Any]:
    frontend = PopnMusicFrontend(g.data, g.config, g.cache)
    info = frontend.get_all_player_info([userid])[userid]

    return {
        'player': info,
    }
Exemplo n.º 2
0
def viewsettings() -> Response:
    frontend = PopnMusicFrontend(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(
        'Pop\'n Music Game Settings',
        'popn/settings.react.js',
        {
            'player': info,
            'versions': {version: name for (game, version, name) in frontend.all_games()},
        },
        {
            'updatename': url_for('popn_pages.updatename'),
        },
    )
Exemplo n.º 3
0
def searchrivals() -> Dict[str, Any]:
    frontend = PopnMusicFrontend(g.data, g.config, g.cache)
    version = int(request.get_json()['version'])
    name = request.get_json()['term']
    print(name)

    # Try to treat the term as an extid
    extid = ID.parse_extid(name)

    matches = set()
    profiles = g.data.remote.user.get_all_profiles(GameConstants.POPN_MUSIC, version)
    for (userid, profile) in profiles:
        if profile.get_int('extid') == extid or profile.get_str('name').lower() == name.lower():
            matches.add(userid)

    playerinfo = frontend.get_all_player_info(list(matches), allow_remote=True)
    return {
        'results': playerinfo,
    }
Exemplo n.º 4
0
def viewplayer(userid: UserID) -> Response:
    frontend = PopnMusicFrontend(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(
        f'{info[latest_version]["name"]}\'s Pop\'n Music Profile',
        'popn/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('popn_pages.listplayer', userid=userid),
            'records': url_for('popn_pages.viewrecords', userid=userid),
            'scores': url_for('popn_pages.viewscores', userid=userid),
        },
    )