🧐 Render melee cards

This commit is contained in:
zhbaor 2022-09-29 11:28:58 +08:00
parent c0fc97a578
commit 8c7e842d2e
78 changed files with 243 additions and 1 deletions

View file

@ -8,3 +8,4 @@ class Melee(db.Entity):
description = Optional(str)
mechanism = Optional(str)
icon = Required(bytes)
stats = Required(int)

View file

@ -51,9 +51,16 @@ with db_session:
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()
icon=region_arr.getbuffer().tobytes(),
stats=stats,
)