示例#1
0
def get_from_coinach():
    # TODO: make an arg parser for non-default paths
    reader = coinach.CoinachReader(verbose=True)
    writer = coinach.CoinachWriter(verbose=True)
    if FFXIV_PATH:
        reader.ffxiv_path = FFXIV_PATH
    monsters = update(reader, writer)
    if CN_FFXIV_PATH:
        reader.ffxiv_path = CN_FFXIV_PATH
    monsters = update_cn(reader, writer, monsters)
    all_monsters = {}
    for (k, v) in monsters.items():
        all_monsters[v['name']['en']] = v
    writer.write(os.path.join('resources', _OUTPUT_FILE),
                 os.path.basename(os.path.abspath(__file__)), 'gMonster',
                 all_monsters)
示例#2
0
def get_from_coinach():
    reader = coinach.CoinachReader()
    monsters = {}
    update_coinach(monsters, reader)
    update_raw_csv(monsters, _BASE_GITHUB + _CN_GITHUB, 'cn')
    update_raw_csv(monsters, _BASE_GITHUB + _KO_GITHUB, 'ko')

    all_monsters = {}
    for (_, info) in monsters.items():
        all_monsters[info['name']['en']] = info

    writer = coinach.CoinachWriter()
    writer.write(
        os.path.join('resources', _OUTPUT_FILE),
        os.path.basename(os.path.abspath(__file__)),
        'gMonster',
        all_monsters)
示例#3
0
def get_from_coinach(_ffxiv_game_path, _saint_conainch_cmd_path,
                     _cactbot_path):
    reader = coinach.CoinachReader(coinach_path=_saint_conainch_cmd_path,
                                   ffxiv_path=_ffxiv_game_path)
    monsters = {}
    update_coinach(monsters, reader)
    update_raw_csv(monsters, "cn")
    update_raw_csv(monsters, "ko")

    all_monsters = {}
    for (_, info) in monsters.items():
        all_monsters[info["name"]["en"]] = info

    writer = coinach.CoinachWriter(cactbot_path=_cactbot_path)

    header = """import { LocaleObject } from '../types/trigger';

type LocaleTextOrArray = LocaleObject<string | string[]>;

export type Rank = 'S' | 'SS+' | 'SS-' | 'A' | 'B';

// Optional values are supported in `Options.CustomMonsters`.
export type HuntEntry = {
  id: string;
  name: LocaleTextOrArray | string | string[];
  rank?: Rank;
  regex?: RegExp;
  hp?: number;
};

export type HuntMap = {
  [huntName: string]: HuntEntry;
};"""

    writer.writeTypeScript(
        filename=os.path.join("resources", _OUTPUT_FILE),
        scriptname=os.path.basename(os.path.abspath(__file__)),
        header=header,
        type="HuntMap",
        as_const=False,
        data=all_monsters,
    )

    print(f"File '{_OUTPUT_FILE}' successfully created.")
示例#4
0
def get_from_coinach(_ffxiv_game_path, _saint_conainch_cmd_path, _cactbot_path):
    reader = coinach.CoinachReader(
        coinach_path=_saint_conainch_cmd_path, ffxiv_path=_ffxiv_game_path
    )
    monsters = {}
    update_coinach(monsters, reader)
    update_raw_csv(monsters, _BASE_GITHUB + _CN_GITHUB, "cn")
    update_raw_csv(monsters, _BASE_GITHUB + _KO_GITHUB, "ko")

    all_monsters = {}
    for (_, info) in monsters.items():
        all_monsters[info["name"]["en"]] = info

    writer = coinach.CoinachWriter(cactbot_path=_cactbot_path)
    writer.write(
        os.path.join("resources", _OUTPUT_FILE),
        os.path.basename(os.path.abspath(__file__)),
        "gMonster",
        all_monsters,
    )

    print(f"File '{_OUTPUT_FILE}' successfully created.")
示例#5
0
def get_from_coinach(_ffxiv_game_path, _saint_conainch_cmd_path,
                     _cactbot_path):
    reader = coinach.CoinachReader(coinach_path=_saint_conainch_cmd_path,
                                   ffxiv_path=_ffxiv_game_path)
    monsters = {}
    update_coinach(monsters, reader)
    update_raw_csv(monsters, "cn")
    update_raw_csv(monsters, "ko")

    all_monsters = {}
    for (_, info) in monsters.items():
        all_monsters[info["name"]["en"]] = info

    writer = coinach.CoinachWriter(cactbot_path=_cactbot_path)

    header = """import { LocaleObject } from '../types/trigger';
type LocaleTextOrArray = LocaleObject<string | string[]>;

type HuntData = {
  [huntName: string]: {
    readonly id: string;
    readonly name: LocaleTextOrArray;
    readonly rank: string;
  };
};"""

    writer.writeTypeScript(
        filename=os.path.join("resources", _OUTPUT_FILE),
        scriptname=os.path.basename(os.path.abspath(__file__)),
        header=header,
        type="HuntData",
        as_const=False,
        data=all_monsters,
    )

    print(f"File '{_OUTPUT_FILE}' successfully created.")
示例#6
0
            weather_name = row[i]
            if not weather_name:
                break
            weathers.append(weather_name)
            sum += int(row[i + 1])
            rates.append(sum)
        # add leading zeroes so they sort properly.
        all_rates["%04d" % int(row[0])] = {
            "weathers": weathers,
            "rates": rates,
        }
    return all_rates


def update(reader, writer):
    data = reader.exd("WeatherRate")
    all_rates = parse_data(data)
    writer.write(
        os.path.join("resources", _OUTPUT_FILE),
        os.path.basename(os.path.abspath(__file__)),
        "gWeatherRates",
        all_rates,
    )


if __name__ == "__main__":
    # TODO: make an arg parser for non-default paths
    reader = coinach.CoinachReader(verbose=True)
    writer = coinach.CoinachWriter(verbose=True)
    update(reader, writer)
示例#7
0
    parser = argparse.ArgumentParser(
        description="Generate fisher data from xivapi",
        epilog=example_usage,
        formatter_class=argparse.RawDescriptionHelpFormatter,
    )
    args = parser.parse_args()

    places, fishes, placefish = get_fish_data()
    tackle = get_tackle()
    tugs = get_tugs(fishes)
    append_special_place_names(places)

    cn_places, cn_fishes, cn_tackle = get_cn_data()
    tackle.update({"cn": cn_tackle["chs"]})
    places.update({"cn": cn_places["chs"]})
    fishes.update({"cn": cn_fishes["chs"]})

    data = {
        "tackle": tackle,
        "places": places,
        "fish": fishes,
        "placefish": placefish,
        "tugs": tugs,
    }

    filename = Path(
        __file__).resolve().parent.parent / "ui" / "fisher" / "static-data.js"
    writer = coinach.CoinachWriter()
    writer.write(filename, os.path.basename(os.path.abspath(__file__)),
                 "gFisherData", data)