def _buy_item_categories_build_callback(menu, player_index):
    """Buy Hero Categories menu's build_callback function."""

    player = Player(player_index)
    menu.entities = []

    for item in Item.get_subclasses():
        if (len(tuple(find_elements(player.hero.items, 'cid', item.cid)))
                >= item.limit):
            continue
        elif (item.allowed_players and player.steamid not in item.allowed_players):
            continue
        menu.entities.append(item)

    menu.clear()
    categories = dict()

    for entity in menu.entities:
        if entity.category not in categories:
            categories[entity.category] = [entity]
        else:
            categories[entity.category].append(entity)

    for category in categories:
        menu.append(PagedOption('{category} ({size})'.format(
            category=category,
            size=len(categories[category])
            ), categories[category]
        ))
Exemple #2
0
def _buy_item_categories_build_callback(menu, player_index):
    """Buy Hero Categories menu's build_callback function."""

    player = Player(player_index)
    menu.entities = []

    for item in Item.get_subclasses():
        if (len(tuple(find_elements(player.hero.items, 'cid', item.cid))) >=
                item.limit):
            continue
        elif (item.allowed_players
              and player.steamid not in item.allowed_players):
            continue
        menu.entities.append(item)

    menu.clear()
    categories = dict()

    for entity in menu.entities:
        if entity.category not in categories:
            categories[entity.category] = [entity]
        else:
            categories[entity.category].append(entity)

    for category in categories:
        menu.append(
            PagedOption(
                '{category} ({size})'.format(category=category,
                                             size=len(categories[category])),
                categories[category]))
def _give_item_build_callback(menu, player_index):

    menu.clear()

    for item in Item.get_subclasses():
        menu.append(
            PagedOption(item.name, (menu.obj, item))
            )
Exemple #4
0
def _give_item_build_callback(menu, player_index):

    menu.clear()

    for item in Item.get_subclasses():
        menu.append(PagedOption(item.name, (menu.obj, item)))