🎨 Maintain multi-version structure
BIN
data/clean/31-2/data.sqlite3
Normal file
17046
data/clean/31-2/main.zh.mo.json
Normal file
11
data/convert/31-2/db.py
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
from pony.orm import *
|
||||||
|
|
||||||
|
db = Database()
|
||||||
|
|
||||||
|
|
||||||
|
class Melee(db.Entity):
|
||||||
|
name = Required(str)
|
||||||
|
description = Optional(str)
|
||||||
|
mechanism = Optional(str)
|
||||||
|
icon = Required(bytes)
|
||||||
|
stats = Required(int)
|
66
data/convert/31-2/melee.py
Executable file
|
@ -0,0 +1,66 @@
|
||||||
|
#!/usr/bin/env python3
|
||||||
|
# # -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
import json
|
||||||
|
import re
|
||||||
|
import io
|
||||||
|
from db import *
|
||||||
|
from PIL import Image
|
||||||
|
from playwright.sync_api import sync_playwright
|
||||||
|
|
||||||
|
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)
|
||||||
|
img = Image.open("../../extraction/raw-31-2/cardIcons.png")
|
||||||
|
|
||||||
|
db.bind(provider="sqlite", filename="../../clean/31-2/data.sqlite3")
|
||||||
|
db.generate_mapping(create_tables=True)
|
||||||
|
|
||||||
|
lines = raw["sheets"][1]["lines"]
|
||||||
|
|
||||||
|
with db_session:
|
||||||
|
for i in lines:
|
||||||
|
if i["group"] == 4:
|
||||||
|
i["name"] = trans[i["name"]]["msgstr"][0]
|
||||||
|
if "ambiantDesc" in i:
|
||||||
|
i["ambiantDesc"] = trans[i["ambiantDesc"].strip()]["msgstr"][0]
|
||||||
|
else:
|
||||||
|
i["ambiantDesc"] = ""
|
||||||
|
if "gameplayDesc" in i:
|
||||||
|
i["gameplayDesc"] = trans[i["gameplayDesc"].strip()]["msgstr"][0]
|
||||||
|
if i["props"]:
|
||||||
|
|
||||||
|
def replace_props(m):
|
||||||
|
result = i["props"][m.group(1)]
|
||||||
|
if isinstance(result, list):
|
||||||
|
result = result[0]
|
||||||
|
if not isinstance(result, str):
|
||||||
|
result = str(result)
|
||||||
|
return result
|
||||||
|
|
||||||
|
i["gameplayDesc"], _ = re.subn(
|
||||||
|
r"::\+?(.*?)::", replace_props, i["gameplayDesc"]
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
i["gameplayDesc"] = ""
|
||||||
|
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")
|
||||||
|
|
||||||
|
stats_map = {"Brutality": 1, "Survival": 2, "Tactic": 4}
|
||||||
|
stats = 0
|
||||||
|
for t in ["tier1", "tier2"]:
|
||||||
|
if t in i:
|
||||||
|
stats += stats_map[i[t]]
|
||||||
|
|
||||||
|
Melee(
|
||||||
|
name=i["name"],
|
||||||
|
description=i["ambiantDesc"],
|
||||||
|
mechanism=i["gameplayDesc"],
|
||||||
|
icon=region_arr.getbuffer().tobytes(),
|
||||||
|
stats=stats,
|
||||||
|
)
|
Before Width: | Height: | Size: 79 KiB After Width: | Height: | Size: 79 KiB |
Before Width: | Height: | Size: 69 KiB After Width: | Height: | Size: 69 KiB |
Before Width: | Height: | Size: 58 KiB After Width: | Height: | Size: 58 KiB |
Before Width: | Height: | Size: 57 KiB After Width: | Height: | Size: 57 KiB |
Before Width: | Height: | Size: 48 KiB After Width: | Height: | Size: 48 KiB |
Before Width: | Height: | Size: 59 KiB After Width: | Height: | Size: 59 KiB |
Before Width: | Height: | Size: 62 KiB After Width: | Height: | Size: 62 KiB |
Before Width: | Height: | Size: 58 KiB After Width: | Height: | Size: 58 KiB |
Before Width: | Height: | Size: 90 KiB After Width: | Height: | Size: 90 KiB |
Before Width: | Height: | Size: 72 KiB After Width: | Height: | Size: 72 KiB |
Before Width: | Height: | Size: 63 KiB After Width: | Height: | Size: 63 KiB |
Before Width: | Height: | Size: 58 KiB After Width: | Height: | Size: 58 KiB |
Before Width: | Height: | Size: 59 KiB After Width: | Height: | Size: 59 KiB |
Before Width: | Height: | Size: 65 KiB After Width: | Height: | Size: 65 KiB |
Before Width: | Height: | Size: 56 KiB After Width: | Height: | Size: 56 KiB |
Before Width: | Height: | Size: 76 KiB After Width: | Height: | Size: 76 KiB |
Before Width: | Height: | Size: 84 KiB After Width: | Height: | Size: 84 KiB |
Before Width: | Height: | Size: 102 KiB After Width: | Height: | Size: 102 KiB |
Before Width: | Height: | Size: 61 KiB After Width: | Height: | Size: 61 KiB |
Before Width: | Height: | Size: 43 KiB After Width: | Height: | Size: 43 KiB |
Before Width: | Height: | Size: 45 KiB After Width: | Height: | Size: 45 KiB |
Before Width: | Height: | Size: 89 KiB After Width: | Height: | Size: 89 KiB |
Before Width: | Height: | Size: 50 KiB After Width: | Height: | Size: 50 KiB |
Before Width: | Height: | Size: 46 KiB After Width: | Height: | Size: 46 KiB |
Before Width: | Height: | Size: 80 KiB After Width: | Height: | Size: 80 KiB |
Before Width: | Height: | Size: 100 KiB After Width: | Height: | Size: 100 KiB |
Before Width: | Height: | Size: 55 KiB After Width: | Height: | Size: 55 KiB |
Before Width: | Height: | Size: 62 KiB After Width: | Height: | Size: 62 KiB |
Before Width: | Height: | Size: 70 KiB After Width: | Height: | Size: 70 KiB |
Before Width: | Height: | Size: 90 KiB After Width: | Height: | Size: 90 KiB |
Before Width: | Height: | Size: 91 KiB After Width: | Height: | Size: 91 KiB |
Before Width: | Height: | Size: 62 KiB After Width: | Height: | Size: 62 KiB |
Before Width: | Height: | Size: 57 KiB After Width: | Height: | Size: 57 KiB |
Before Width: | Height: | Size: 77 KiB After Width: | Height: | Size: 77 KiB |
Before Width: | Height: | Size: 54 KiB After Width: | Height: | Size: 54 KiB |
Before Width: | Height: | Size: 81 KiB After Width: | Height: | Size: 81 KiB |
Before Width: | Height: | Size: 74 KiB After Width: | Height: | Size: 74 KiB |
Before Width: | Height: | Size: 80 KiB After Width: | Height: | Size: 80 KiB |
Before Width: | Height: | Size: 42 KiB After Width: | Height: | Size: 42 KiB |
Before Width: | Height: | Size: 72 KiB After Width: | Height: | Size: 72 KiB |
Before Width: | Height: | Size: 59 KiB After Width: | Height: | Size: 59 KiB |
Before Width: | Height: | Size: 63 KiB After Width: | Height: | Size: 63 KiB |
Before Width: | Height: | Size: 99 KiB After Width: | Height: | Size: 99 KiB |
Before Width: | Height: | Size: 54 KiB After Width: | Height: | Size: 54 KiB |
Before Width: | Height: | Size: 55 KiB After Width: | Height: | Size: 55 KiB |
Before Width: | Height: | Size: 84 KiB After Width: | Height: | Size: 84 KiB |
Before Width: | Height: | Size: 87 KiB After Width: | Height: | Size: 87 KiB |
Before Width: | Height: | Size: 54 KiB After Width: | Height: | Size: 54 KiB |
Before Width: | Height: | Size: 70 KiB After Width: | Height: | Size: 70 KiB |
Before Width: | Height: | Size: 57 KiB After Width: | Height: | Size: 57 KiB |
Before Width: | Height: | Size: 77 KiB After Width: | Height: | Size: 77 KiB |
Before Width: | Height: | Size: 46 KiB After Width: | Height: | Size: 46 KiB |
Before Width: | Height: | Size: 41 KiB After Width: | Height: | Size: 41 KiB |
Before Width: | Height: | Size: 60 KiB After Width: | Height: | Size: 60 KiB |
Before Width: | Height: | Size: 60 KiB After Width: | Height: | Size: 60 KiB |
Before Width: | Height: | Size: 93 KiB After Width: | Height: | Size: 93 KiB |
Before Width: | Height: | Size: 73 KiB After Width: | Height: | Size: 73 KiB |
Before Width: | Height: | Size: 61 KiB After Width: | Height: | Size: 61 KiB |
Before Width: | Height: | Size: 78 KiB After Width: | Height: | Size: 78 KiB |
Before Width: | Height: | Size: 55 KiB After Width: | Height: | Size: 55 KiB |
Before Width: | Height: | Size: 72 KiB After Width: | Height: | Size: 72 KiB |
Before Width: | Height: | Size: 80 KiB After Width: | Height: | Size: 80 KiB |
|
@ -4,10 +4,10 @@
|
||||||
import sys
|
import sys
|
||||||
from playwright.sync_api import sync_playwright
|
from playwright.sync_api import sync_playwright
|
||||||
|
|
||||||
sys.path.append("../convert/31-0")
|
sys.path.append("../../convert/31-0")
|
||||||
from db import *
|
from db import *
|
||||||
|
|
||||||
db.bind(provider="sqlite", filename="../clean/31-0/data.sqlite3")
|
db.bind(provider="sqlite", filename="../../clean/31-0/data.sqlite3")
|
||||||
db.generate_mapping()
|
db.generate_mapping()
|
||||||
|
|
||||||
with sync_playwright() as p:
|
with sync_playwright() as p:
|
|
@ -6,10 +6,10 @@ import base64
|
||||||
import re
|
import re
|
||||||
from bottle import route, run, static_file, view
|
from bottle import route, run, static_file, view
|
||||||
|
|
||||||
sys.path.append("../convert/31-0")
|
sys.path.append("../../convert/31-0")
|
||||||
from db import *
|
from db import *
|
||||||
|
|
||||||
db.bind(provider="sqlite", filename="../clean/31-0/data.sqlite3")
|
db.bind(provider="sqlite", filename="../../clean/31-0/data.sqlite3")
|
||||||
db.generate_mapping()
|
db.generate_mapping()
|
||||||
|
|
||||||
|
|
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
Before Width: | Height: | Size: 1 KiB After Width: | Height: | Size: 1 KiB |
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 25 KiB |
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 25 KiB |
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 25 KiB |
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 25 KiB |
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 25 KiB |
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 25 KiB |
BIN
data/render/31-2/output/串刺之剑.png
Normal file
After Width: | Height: | Size: 79 KiB |
BIN
data/render/31-2/output/冥河提灯.png
Normal file
After Width: | Height: | Size: 69 KiB |
BIN
data/render/31-2/output/利润匕首.png
Normal file
After Width: | Height: | Size: 58 KiB |
BIN
data/render/31-2/output/刺剑.png
Normal file
After Width: | Height: | Size: 57 KiB |
BIN
data/render/31-2/output/刺客匕首.png
Normal file
After Width: | Height: | Size: 48 KiB |
BIN
data/render/31-2/output/化境.png
Normal file
After Width: | Height: | Size: 59 KiB |
BIN
data/render/31-2/output/双匕首.png
Normal file
After Width: | Height: | Size: 62 KiB |
BIN
data/render/31-2/output/双截锅.png
Normal file
After Width: | Height: | Size: 58 KiB |
BIN
data/render/31-2/output/固化光剑.png
Normal file
After Width: | Height: | Size: 90 KiB |
BIN
data/render/31-2/output/均衡之刃.png
Normal file
After Width: | Height: | Size: 72 KiB |
BIN
data/render/31-2/output/墓碑.png
Normal file
After Width: | Height: | Size: 63 KiB |
BIN
data/render/31-2/output/夜歌(手持).png
Normal file
After Width: | Height: | Size: 58 KiB |
BIN
data/render/31-2/output/大剑.png
Normal file
After Width: | Height: | Size: 59 KiB |
BIN
data/render/31-2/output/对称长枪.png
Normal file
After Width: | Height: | Size: 65 KiB |
BIN
data/render/31-2/output/巨人杀手.png
Normal file
After Width: | Height: | Size: 56 KiB |
BIN
data/render/31-2/output/巨镰利爪.png
Normal file
After Width: | Height: | Size: 76 KiB |
BIN
data/render/31-2/output/巨镰左爪.png
Normal file
After Width: | Height: | Size: 84 KiB |
BIN
data/render/31-2/output/带刃双拐.png
Normal file
After Width: | Height: | Size: 102 KiB |
BIN
data/render/31-2/output/平底锅.png
Normal file
After Width: | Height: | Size: 61 KiB |
BIN
data/render/31-2/output/开发者武器.png
Normal file
After Width: | Height: | Size: 43 KiB |
BIN
data/render/31-2/output/弩柄攻击.png
Normal file
After Width: | Height: | Size: 45 KiB |
BIN
data/render/31-2/output/怨恨之刃.png
Normal file
After Width: | Height: | Size: 89 KiB |