initial hardcore tables
This commit is contained in:
@@ -4,15 +4,20 @@ import re
|
||||
from pathlib import Path
|
||||
|
||||
NEWSERV = Path.home() / ".local/share/github/psopeeps-newserv"
|
||||
OUT = Path("site/generated/drops/peeps")
|
||||
PEEPS_OUT = Path("site/generated/drops/peeps")
|
||||
HARDCORE_OUT = Path("site/generated/drops/hardcore")
|
||||
|
||||
TABLES = {
|
||||
PEEPS_TABLES = {
|
||||
"v1": NEWSERV / "system/tables/rare-table-v1.json",
|
||||
"v2": NEWSERV / "system/tables/rare-table-v2.json",
|
||||
"v3": NEWSERV / "system/tables/rare-table-v3.json",
|
||||
"bb": NEWSERV / "system/tables/rare-table-v4.json",
|
||||
}
|
||||
|
||||
HARDCORE_TABLES = {
|
||||
"bb": Path("source-drops/hardcore/rare-table-v4.json"),
|
||||
}
|
||||
|
||||
def strip_json_comments(text):
|
||||
out = []
|
||||
in_str = False
|
||||
@@ -142,23 +147,23 @@ def flatten_table(version, table):
|
||||
|
||||
return rows
|
||||
|
||||
def main():
|
||||
OUT.mkdir(parents=True, exist_ok=True)
|
||||
def write_group(mode, label, tables, out_dir):
|
||||
out_dir.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
index = {
|
||||
"mode": "peeps",
|
||||
"label": "Peeps",
|
||||
"mode": mode,
|
||||
"label": label,
|
||||
"tables": [],
|
||||
}
|
||||
|
||||
labels = {"v1": "V1", "v2": "V2", "v3": "V3", "bb": "BB"}
|
||||
|
||||
for version, src in TABLES.items():
|
||||
for version, src in tables.items():
|
||||
table = load_newserv_jsonish(src)
|
||||
rows = flatten_table(version, table)
|
||||
|
||||
out_name = f"{version}.json"
|
||||
out_path = OUT / out_name
|
||||
out_path = out_dir / out_name
|
||||
out_path.write_text(json.dumps(rows, indent=2, sort_keys=True) + "\n")
|
||||
|
||||
index["tables"].append({
|
||||
@@ -168,11 +173,15 @@ def main():
|
||||
"rows": len(rows),
|
||||
})
|
||||
|
||||
print(f"{version}: {len(rows)} rows -> {out_path}")
|
||||
print(f"{mode} {version}: {len(rows)} rows -> {out_path}")
|
||||
|
||||
index_path = OUT / "index.json"
|
||||
index_path = out_dir / "index.json"
|
||||
index_path.write_text(json.dumps(index, indent=2, sort_keys=True) + "\n")
|
||||
print(f"index -> {index_path}")
|
||||
print(f"{mode} index -> {index_path}")
|
||||
|
||||
def main():
|
||||
write_group("peeps", "Peeps", PEEPS_TABLES, PEEPS_OUT)
|
||||
write_group("hardcore", "Hardcore", HARDCORE_TABLES, HARDCORE_OUT)
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
||||
Reference in New Issue
Block a user