summaryrefslogtreecommitdiff
path: root/tools/genconst.js
blob: a2b923501839b2319f3502b622711dba1045d217 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
const data = require("../data.js")

function clean_name(s) {
	return s.toUpperCase()
		.replace(" - ", "_")
		.replace(/[ /-]/g, "_")
		.replace(/[!,*"'.]/g, "")
}

console.log("")

console.log("// SPACES")
for (let s of data.spaces) {
	console.log("const S_" + clean_name(s.ascii_name) + " = " + s.space_id)
}

console.log("")

console.log("// CARDS")
for (let c of data.cards) {
	if (c)
		console.log("const C_" + clean_name(c.name) + " = " + c.number)
}

console.log("")