Exemple #1
0
def load_data(args):
    server = Server.from_str(args.server)

    if os.name != 'nt':
        fail_logger.addHandler(
            logging.FileHandler('/tmp/autodungeon_processor_issues.txt',
                                mode='w'))

    pad_db = merged_database.Database(server, args.input_dir)
    pad_db.load_database(skip_skills=True, skip_extra=True)

    with open(args.db_config) as f:
        db_config = json.load(f)

    dry_run = not args.doupdates
    db_wrapper = db_util.DbWrapper(dry_run)
    db_wrapper.connect(db_config)

    dungeons = identify_dungeons(pad_db, args.group)

    if server == Server.na:
        endpoint = pad_api.ServerEndpoint.NA
    elif server == Server.jp:
        endpoint = pad_api.ServerEndpoint.JA
    else:
        raise Exception('unexpected server:' + args.server)

    api_client = pad_api.PadApiClient(endpoint, args.user_uuid,
                                      args.user_intid)
    api_client.login()
    print('load_player_data')
    api_client.load_player_data()

    load_dungeons(args, db_wrapper, dungeons, api_client)
Exemple #2
0
    def __init__(
            self,
            id: int = None,
            pull_id: int = None,
            entry_id: int = None,
            server: str = None,
            dungeon_id: int = None,
            floor_id: int = None,
            stage: int = None,
            slot: int = None,
            spawn_type: int = None,
            monster_id: int = None,
            monster_level: int = None,
            drop_monster_id: int = None,
            drop_monster_level: int = None,
            plus_amount: int = None,
            monster: wave_data.WaveMonster = None,
            pull_time=None,  # Ignored
            leader_id: int = None,
            friend_id: int = None):
        self.id = id
        self.server = server
        self.dungeon_id = dungeon_id
        self.floor_id = floor_id  # ID starts at 1 for lowest
        self.stage = stage  # 0-indexed
        self.slot = slot  # 0-indexed

        self.spawn_type = spawn_type
        self.monster_id = monster_id
        self.monster_level = monster_level

        # If drop_monster_id == 9900, then drop_monster_level is the bonus gold amount
        self.drop_monster_id = drop_monster_id
        self.drop_monster_level = drop_monster_level
        self.plus_amount = plus_amount

        if monster:
            self.spawn_type = monster.spawn_type
            # Need to correct the drop/spawn IDs for NA vs JP
            mapping_fn = server_monster_id_fn(Server.from_str(self.server))
            self.monster_id = mapping_fn(monster.monster_id)
            self.monster_level = monster.monster_level
            self.drop_monster_id = mapping_fn(monster.drop_monster_id)
            self.drop_monster_level = monster.drop_monster_level
            self.plus_amount = monster.plus_amount

        self.pull_id = pull_id
        self.entry_id = entry_id

        self.leader_id = leader_id
        self.friend_id = friend_id
def load_data(args):
    server = Server.from_str(args.server)

    pad_db = merged_database.Database(server, args.input_dir)
    pad_db.load_database(skip_skills=True, skip_extra=True)

    with open(args.db_config) as f:
        db_config = json.load(f)

    dry_run = not args.doupdates
    db_wrapper = db_util.DbWrapper(dry_run)
    db_wrapper.connect(db_config)

    dungeons = identify_dungeons(pad_db, args.group)

    load_dungeons(args, db_wrapper, dungeons)
    yend = ystart + pheight - 1 - 1  # Stops one short of full height

    sattr_imgs[t] = templates_img.crop(box=(xstart, ystart, xend, yend))

card_types = []

attr_map = {
    -1: '',
    0: 'r',
    1: 'b',
    2: 'g',
    3: 'l',
    4: 'd',
}

server = Server.from_str(args.server)
pad_db = merged_database.Database(server, args.data_dir)
pad_db.load_database(skip_skills=True, skip_extra=True)

for merged_card in pad_db.cards:
    card = merged_card.card
    card_id = card.monster_no
    released = card.released_status

    # Prevent loading junk entries (fake enemies) and also limit to data which has
    # been officially released.
    if card_id > 9999 or not released:
        continue

    card_types.append(
        [card_id, attr_map[card.attr_id], attr_map[card.sub_attr_id]])