🗃️ Rendered 31-2 data, added shields

This commit is contained in:
zhbaor 2022-09-30 21:25:52 +08:00
parent 00e5928284
commit ac2a8e4d28
20 changed files with 98 additions and 8 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 85 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 65 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 71 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 71 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 71 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 105 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 76 KiB

View file

@ -14,7 +14,7 @@ with sync_playwright() as p:
browser = p.chromium.launch()
page = browser.new_page(device_scale_factor=3)
with db_session:
for m in Melee.select():
for m in [*Melee.select(), *Shield.select()]:
print(f"rendering {m.name}...")
page.goto(f"http://localhost:8080/{m.name}")
page.locator(".container").screenshot(path=f"./output/{m.name}.png")

View file

@ -18,10 +18,17 @@ db.generate_mapping()
def melee(name):
with db_session:
query = select(w for w in Melee if w.name == name)
weapon = query.first()
mechanism, _ = re.subn(
r"{(.*?)@(.*?)}", r"<span class='\2'>\1</span>", weapon.mechanism
)
if query.count() > 0:
weapon = query.first()
else:
query = select(w for w in Shield if w.name == name)
weapon = query.first()
if weapon.mechanism:
mechanism, _ = re.subn(
r"{(.*?)@(.*?)}", r"<span class='\2'>\1</span>", weapon.mechanism
)
else:
mechanism = ""
stats_map = {
1: "brutality",
2: "survival",
@ -35,7 +42,7 @@ def melee(name):
"icon": base64.b64encode(weapon.icon),
"mechanism": mechanism,
"description": weapon.description,
"stats": stats_map[weapon.stats]
"stats": stats_map[weapon.stats],
}