✨ Outfits
This commit is contained in:
parent
775c833f28
commit
3e6871fb34
127 changed files with 17420 additions and 2 deletions
|
@ -30,6 +30,15 @@ class Ranged(db.Entity):
|
|||
stats = Required(int)
|
||||
|
||||
|
||||
class Outfit(db.Entity):
|
||||
name = Required(str)
|
||||
name_en = Required(str)
|
||||
description = Optional(str)
|
||||
icon = Required(bytes)
|
||||
preview = Optional(bytes)
|
||||
cell_cost = Required(int)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
db.bind(provider="sqlite", filename="../../clean/31-2/data.sqlite3")
|
||||
db.generate_mapping(create_tables=True)
|
||||
|
|
49
data/convert/31-2/outfits.py
Executable file
49
data/convert/31-2/outfits.py
Executable file
|
@ -0,0 +1,49 @@
|
|||
#!/usr/bin/env python3
|
||||
# # -*- coding: utf-8 -*-
|
||||
|
||||
import json
|
||||
import re
|
||||
import io
|
||||
from db import *
|
||||
from PIL import Image
|
||||
|
||||
with open("../../extraction/raw-31-2/data.cdb.json") as f:
|
||||
raw = json.load(f)
|
||||
with open("../../clean/31-2/main.zh.mo.json") as f:
|
||||
trans = json.load(f)
|
||||
with open("../../clean/31-2/main.en.mo.json") as f:
|
||||
trans_en = json.load(f)
|
||||
img = Image.open("../../extraction/raw-31-2/cardIcons.png")
|
||||
|
||||
db.bind(provider="sqlite", filename="../../clean/31-2/data.sqlite3")
|
||||
db.generate_mapping()
|
||||
|
||||
lines = raw["sheets"][1]["lines"]
|
||||
|
||||
with db_session:
|
||||
for i in lines:
|
||||
if i["group"] == 13:
|
||||
if not i["name"]:
|
||||
continue
|
||||
if i["id"] == "KingsHandBoss":
|
||||
continue
|
||||
raw_name = i["name"].strip()
|
||||
i["name"] = trans[raw_name]["msgstr"][0]
|
||||
i["name"] = re.sub(r"。", r"", i["name"])
|
||||
i["name_en"] = trans_en[raw_name]["msgstr"][0]
|
||||
i["name_en"] = re.sub(r"outfit", r"Outfit", i["name_en"])
|
||||
i["gameplayDesc"] = trans[i["gameplayDesc"].strip()]["msgstr"][0]
|
||||
x = i["icon"]["x"] * 24
|
||||
y = i["icon"]["y"] * 24
|
||||
box = (x, y, x + 24, y + 24)
|
||||
region = img.crop(box)
|
||||
region_arr = io.BytesIO()
|
||||
region.save(region_arr, format="PNG")
|
||||
|
||||
Outfit(
|
||||
name=i["name"],
|
||||
name_en=i["name_en"],
|
||||
description=i["gameplayDesc"],
|
||||
icon=region_arr.getbuffer().tobytes(),
|
||||
cell_cost=i["cellCost"],
|
||||
)
|
Loading…
Add table
Add a link
Reference in a new issue