示例#1
0
async def best(ctx, slot=None, enhancement=None):
    """Get the best enhancement item for a given slot. If multiple matches are found, matches will be shown in descending order."""
    if slot is None:
        txt = 'Enter: {}best [slot] [enhancement]'.format(command_prefix)
        await ctx.send(txt)
        return
    txt = command_prefix + 'best {} {}'.format(slot, enhancement)
    # write_log(txt, ctx.author, ctx.server)

    raw_text = mkt.load_item_design_raw()
    item_lookup = mkt.parse_item_designs(raw_text)
    df_items = mkt.rtbl2items(item_lookup)
    df_filter = mkt.filter_item(
        df_items,
        slot,
        enhancement,
        cols=['ItemDesignName', 'EnhancementValue', 'MarketPrice'])

    txt = mkt.itemfilter2txt(df_filter)
    if txt is None:
        await ctx.send('No entries found for {} slot, {} enhancement'.format(
            slot, enhancement))

        str_slots = ', '.join(df_items['ItemSubType'].value_counts().index)
        str_enhancements = ', '.join(
            df_items['EnhancementType'].value_counts().index)
        txt = 'Slots: {}\n'.format(str_slots)
        txt += 'Enhancements: {}'.format(str_enhancements)
        await ctx.send(txt)
    else:
        await ctx.send(txt)
示例#2
0
async def price(ctx, *, item_name=None):
    if item_name is None:
        await bot.say('Enter: {}price [item name]'.format(command_prefix))
    else:
        write_log(command_prefix + 'price {}'.format(item_name), ctx)
        raw_text = mkt.load_item_design_raw()
        rtbl = mkt.parse_item_designs(raw_text)
        market_txt = mkt.filter_item_designs(item_name, rtbl, filter='price')
        if market_txt is None:
            await bot.say('Could not find {}'.format(item_name))
        else:
            await bot.say(market_txt)
示例#3
0
async def item(ctx, *, name=None):
    if name is None:
        await bot.say('Enter: {}item [name]'.format(command_prefix))
        return

    write_log(command_prefix + 'item {}'.format(name), ctx)
    raw_text = mkt.load_item_design_raw()
    rtbl = mkt.parse_item_designs(raw_text)
    market_txt = mkt.filter_item_designs(name, rtbl, filter='stats')
    if market_txt is None:
        await bot.say('Could not find {}'.format(name))
    else:
        await bot.say(market_txt)
示例#4
0
async def price(ctx, *, item_name=None):
    """Get the average price in bux of the item(s) specified, as returned by the PSS API. Note that prices returned by the API may not reflect the real market value, due to transfers between alts/friends"""
    raw_text = mkt.load_item_design_raw()
    item_lookup = mkt.parse_item_designs(raw_text)
    real_name = mkt.get_real_name(item_name, item_lookup)
    if len(item_name) < 2 and real_name != 'U':
        await ctx.send("Please enter at least two characters for item name")
    elif real_name is not None:
        market_txt = mkt.filter_item_designs(item_name, item_lookup, filter='price')
        market_txt = "**Prices matching '{}'**\n".format(item_name) + market_txt
        market_txt += '\n\nNote: bux prices listed here may not always be accurate due to transfers between alts/friends or other reasons'
        await ctx.send(market_txt)
    else:
        await ctx.send("Could not find item name '{}'".format(item_name))