summaryrefslogtreecommitdiff
path: root/tools/gendata.js
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2023-12-14 19:17:01 +0100
committerTor Andersson <tor@ccxvii.net>2024-01-08 16:36:48 +0100
commit759b5f2c7ece5e5e5140dd3c8048495e29330b35 (patch)
tree66bb8a12d50940e58347d28eb158af3b6c274a23 /tools/gendata.js
parentb92d2be9b166530b015a9ac0e610d20b25f23232 (diff)
downloadtable-battles-759b5f2c7ece5e5e5140dd3c8048495e29330b35.tar.gz
WIP reference card page
Diffstat (limited to 'tools/gendata.js')
-rw-r--r--tools/gendata.js32
1 files changed, 31 insertions, 1 deletions
diff --git a/tools/gendata.js b/tools/gendata.js
index e593eac..f471387 100644
--- a/tools/gendata.js
+++ b/tools/gendata.js
@@ -15,7 +15,10 @@ var result = [
<style>
body{background-color:dimgray;color:whitesmoke;max-width:1600px;margin:0 auto;padding:20px;background-image:url(../images/background.png)}
h1{color: white}
-.list{display:flex;flex-wrap:wrap;gap:20px;}
+.list{display:flex;flex-wrap:no-wrap;gap:20px;margin:60px 0;width:fit-content}
+.list{display:grid;grid-auto-flow:column;grid-template-rows:auto auto;}
+.list{display:grid;grid-auto-flow:row;grid-template-columns:auto auto;}
+.ref{display:block;height:338;border-radius:10px;}
</style>
</head>
<body>
@@ -33,12 +36,34 @@ var card_index = {}
var cards_show = [ ]
var scenarios = []
+var a_seq = 0
+var b_seq = 0
+
+function remap(x) {
+ if (x >= 42 && x <= 50) return (x - 42) + 51
+ if (x >= 51) x += 9
+ if (x >= 91 && x <= 99) return -1
+ if (x >= 99) x -= 9
+ if (x >= 216 && x <= 224) return x - 216 + 42
+ if (x >= 224) x -= 5
+ return x
+}
+
+let last_wing = null
+
for (let c of card_records) {
if (!c.number) {
result.push(`</div><h2>${c.scenario}</h2><div class="list">`)
+ last_wing = null
continue
}
+ if ((c.wing === "blue" || c.wing === "dkblue") && (last_wing === "red" || last_wing === "pink"))
+ result.push(`</div><div class="list">`)
+ if ((last_wing === "blue" || last_wing === "dkblue") && (c.wing === "red" || c.wing === "pink"))
+ result.push(`</div><div class="list">`)
+ last_wing = c.wing
+
if (!c.name)
continue
@@ -231,6 +256,11 @@ for (let c of card_records) {
result.push(`<div class="extra">${WING_ICON[card.wing]}</div>`)
result.push(`</div>`)
+
+ if (c.number.endsWith("A"))
+ result.push(`<img class="ref" height="338" src="/table-battles/ref2/sliced/card_A${remap(a_seq++)}.jpg">`)
+ else
+ result.push(`<img class="ref" height="338" src="/table-battles/ref2/sliced/card_B${remap(b_seq++)}.jpg">`)
}
function find_card(scenario, name) {