Example #1
0
    def run(self, argv):
        exclude_names = app.config.grass_on_aog.exclude
        self.logger.info('不刷以下材料:', exclude_names)
        self.logger.info('加载库存信息...')
        aog_cache = load_aog_cache()
        my_items = self.load_inventory()
        all_items = arkplanner.get_all_items()

        l = []
        for item in all_items:
            if item['itemType'] in ['MATERIAL'] and item['name'] not in exclude_names and item['rarity'] == 2 \
                    and len(item['itemId']) > 4:
                l.append({
                    'name': item['name'],
                    'itemId': item['itemId'],
                    'count': my_items.get(item['itemId'], 0),
                    'rarity': item['rarity']
                })
        l = sorted(l, key=lambda x: x['count'])
        print('require item: %s, owned: %s' % (l[0]['name'], l[0]['count']))
        aog_items = aog_cache['aog']
        t3_items = aog_items['tier']['t3']
        stage = ''
        for t3_item in t3_items:
            if t3_item['name'] == l[0]['name']:
                # print(t3_item)
                stage_info = order_stage(t3_item)
                stage = stage_info['code']
                self.logger.info('aog stage:', stage)
                break
        self.addon(StageNavigator).navigate_and_combat(stage, 1000)
Example #2
0
    def run(self, **kwargs):
        print('加载库存信息...')
        aog_cache = load_aog_cache()
        my_items = self.load_inventory()
        all_items = arkplanner.get_all_items()

        l = []
        for item in all_items:
            if item['itemType'] in ['MATERIAL'] and item['name'] not in exclude_names and item['rarity'] == 2 \
                    and len(item['itemId']) > 4:
                l.append({
                    'name': item['name'],
                    'itemId': item['itemId'],
                    'count': my_items.get(item['itemId'], 0),
                    'rarity': item['rarity']
                })
        l = sorted(l, key=lambda x: x['count'])
        print('require item: %s, owned: %s' % (l[0]['name'], l[0]['count']))
        aog_items = aog_cache['aog']
        t3_items = aog_items['tier']['t3']
        stage = ''
        for t3_item in t3_items:
            if t3_item['name'] == l[0]['name']:
                # print(t3_item)
                normal_stage_info = t3_item['lowest_ap_stages']['normal'][0]
                stage = normal_stage_info['code']
                print('aog stage:', stage)
                break
        self.helper.module_battle(stage, 1000)
Example #3
0
    def run(self, **kwargs):
        print('加载库存信息...')
        aog_cache = load_aog_cache()
        my_items = self.load_inventory()
        all_items = arkplanner.get_all_items()

        l = []
        for item in all_items:
            if item['itemType'] in ['MATERIAL'] and item['name'] not in exclude_names and item['rarity'] == 2 \
                    and len(item['itemId']) > 4:
                l.append({
                    'name': item['name'],
                    'itemId': item['itemId'],
                    'count': my_items.get(item['itemId'], 0),
                    'rarity': item['rarity']
                })
        l = sorted(l, key=lambda x: x['count'])
        print('require item: %s, owned: %s' % (l[0]['name'], l[0]['count']))
        aog_items = aog_cache['aog']
        t3_items = aog_items['tier']['t3']
        stage = ''
        for t3_item in t3_items:
            if t3_item['name'] == l[0]['name']:
                # print(t3_item)
                stage_info = order_stage(t3_item)
                stage = stage_info['code']
                print('aog stage:', stage)
                break
        try:
            self.helper.module_battle(stage, 1000)
        except Exception as e:
            if use_start_sp_stage:
                from addons.start_sp_stage import StartSpStageAddon
                logger.info('尝试进入活动关卡')
                StartSpStageAddon(self.helper).run(stage, 1000)
            else:
                raise e
Example #4
0
                return data
    return update_inventory()


def update_inventory():
    data = helper.get_inventory_items(True)
    data['cacheTime'] = datetime.now().strftime(cache_key)
    with open('inventory_items_cache.json', 'w') as f:
        json.dump(data, f)
    return data


if __name__ == '__main__':
    print('加载库存信息...')
    my_items = load_inventory()
    all_items = arkplanner.get_all_items()

    l = []
    for item in all_items:
        if item['itemType'] in ['MATERIAL'] and item['name'] not in exclude_names and item['rarity'] == 2 \
                and len(item['itemId']) > 4:
            l.append({
                'name': item['name'],
                'itemId': item['itemId'],
                'count': my_items.get(item['itemId'], 0),
                'rarity': item['rarity']
            })
    l = sorted(l, key=lambda x: x['count'])
    print('require item: %s, owned: %s' % (l[0]['name'], l[0]['count']))
    aog_items = aog_cache['aog']
    t3_items = aog_items['tier']['t3']