コード例 #1
0
def removerival() -> Dict[str, Any]:
    frontend = IIDXFrontend(g.data, g.config, g.cache)
    version = int(request.get_json()['version'])
    rivaltype = request.get_json()['type']
    other_userid = UserID(int(request.get_json()['userid']))
    userid = g.userID

    # Remove this rival link
    if rivaltype != 'sp_rival' and rivaltype != 'dp_rival':
        raise Exception(f'Invalid rival type {rivaltype}!')

    g.data.local.user.destroy_link(
        GameConstants.IIDX,
        version,
        userid,
        rivaltype,
        other_userid,
    )

    # Now return updated rival info
    rivals, djinfo = frontend.get_rivals(userid)

    return {
        'rivals': rivals,
        'players': djinfo,
    }
コード例 #2
0
def addrival() -> Dict[str, Any]:
    frontend = IIDXFrontend(g.data, g.config, g.cache)
    version = int(request.get_json()['version'])
    rivaltype = request.get_json()['type']
    other_userid = UserID(int(request.get_json()['userid']))
    userid = g.userID

    # Add this rival link
    if rivaltype != 'sp_rival' and rivaltype != 'dp_rival':
        raise Exception(f'Invalid rival type {rivaltype}!')
    profile = g.data.remote.user.get_profile(GameConstants.IIDX, version,
                                             other_userid)
    if profile is None:
        raise Exception('Unable to find profile for rival!')

    g.data.local.user.put_link(
        GameConstants.IIDX,
        version,
        userid,
        rivaltype,
        other_userid,
        {},
    )

    # Now return updated rival info
    rivals, djinfo = frontend.get_rivals(userid)

    return {
        'rivals': rivals,
        'players': djinfo,
    }
コード例 #3
0
def listrivals() -> Dict[str, Any]:
    frontend = IIDXFrontend(g.data, g.config, g.cache)
    rivals, djinfo = frontend.get_rivals(g.userID)

    return {
        'rivals': rivals,
        'players': djinfo,
    }
コード例 #4
0
ファイル: endpoints.py プロジェクト: wolskiCN/bemaniutils
def viewrivals() -> Response:
    frontend = IIDXFrontend(g.data, g.config, g.cache)
    rivals, djinfo = frontend.get_rivals(g.userID)

    return render_react(
        'IIDX Rivals',
        'iidx/rivals.react.js',
        {
            'userid': str(g.userID),
            'rivals': rivals,
            'players': djinfo,
            'versions': {version: name for (game, version, name) in frontend.all_games()},
        },
        {
            'refresh': url_for('iidx_pages.listrivals'),
            'search': url_for('iidx_pages.searchrivals'),
            'player': url_for('iidx_pages.viewplayer', userid=-1),
            'addrival': url_for('iidx_pages.addrival'),
            'removerival': url_for('iidx_pages.removerival'),
        },
    )