示例#1
0
def viewsettings() -> Response:
    frontend = IIDXFrontend(g.data, g.config, g.cache)
    userid = g.userID
    djinfo = frontend.get_all_player_info([userid])[userid]
    if not djinfo:
        abort(404)
    versions = sorted(
        [version for (game, version, name) in frontend.all_games()],
        reverse=True,
    )
    return render_react(
        'IIDX Game Settings',
        'iidx/settings.react.js',
        {
            'player': djinfo,
            'versions':
            {version: name
             for (game, version, name) in frontend.all_games()},
            'qpros': frontend.get_all_items(versions),
        },
        {
            'updateqpro': url_for('iidx_pages.updateqpro'),
            'updateflags': url_for('iidx_pages.updateflags'),
            'updatesettings': url_for('iidx_pages.updatesettings'),
            'updatename': url_for('iidx_pages.updatename'),
            'updateprefecture': url_for('iidx_pages.updateprefecture'),
            'leavearcade': url_for('iidx_pages.leavearcade'),
        },
    )
示例#2
0
def viewplayer(userid: UserID) -> Response:
    frontend = IIDXFrontend(g.data, g.config, g.cache)
    djinfo = frontend.get_all_player_info([userid])[userid]
    if not djinfo:
        abort(404)
    latest_version = sorted(djinfo.keys(), reverse=True)[0]

    for version in djinfo:
        sp_rival = g.data.local.user.get_link(GameConstants.IIDX, version,
                                              g.userID, 'sp_rival', userid)
        dp_rival = g.data.local.user.get_link(GameConstants.IIDX, version,
                                              g.userID, 'dp_rival', userid)
        djinfo[version]['sp_rival'] = sp_rival is not None
        djinfo[version]['dp_rival'] = dp_rival is not None

    return render_react(
        f'dj {djinfo[latest_version]["name"]}\'s IIDX Profile',
        'iidx/player.react.js',
        {
            'playerid': userid,
            'own_profile': userid == g.userID,
            'player': djinfo,
            'versions':
            {version: name
             for (game, version, name) in frontend.all_games()},
        },
        {
            'refresh': url_for('iidx_pages.listplayer', userid=userid),
            'records': url_for('iidx_pages.viewrecords', userid=userid),
            'scores': url_for('iidx_pages.viewscores', userid=userid),
            'addrival': url_for('iidx_pages.addrival'),
            'removerival': url_for('iidx_pages.removerival'),
        },
    )
示例#3
0
def listplayer(userid: UserID) -> Dict[str, Any]:
    frontend = IIDXFrontend(g.data, g.config, g.cache)
    djinfo = frontend.get_all_player_info([userid])[userid]

    for version in djinfo:
        sp_rival = g.data.local.user.get_link(GameConstants.IIDX, version, g.userID, 'sp_rival', userid)
        dp_rival = g.data.local.user.get_link(GameConstants.IIDX, version, g.userID, 'dp_rival', userid)
        djinfo[version]['sp_rival'] = sp_rival is not None
        djinfo[version]['dp_rival'] = dp_rival is not None

    return {
        'player': djinfo,
    }
示例#4
0
def searchrivals() -> Dict[str, Any]:
    frontend = IIDXFrontend(g.data, g.config, g.cache)
    version = int(request.get_json()['version'])
    djname = request.get_json()['term']

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

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

    djinfo = frontend.get_all_player_info(list(matches), allow_remote=True)
    return {
        'results': djinfo,
    }