From 9953f6c2890a8d2bebb5d9fee26d5e7d09497aa7 Mon Sep 17 00:00:00 2001 From: Hamcha Date: Thu, 21 Nov 2019 18:00:30 +0100 Subject: [PATCH] Port over column filter to static cube generator --- cmd/cube.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/cmd/cube.ts b/cmd/cube.ts index 068c108..8b1c8c3 100644 --- a/cmd/cube.ts +++ b/cmd/cube.ts @@ -32,6 +32,16 @@ const colorNames = { URG: "Temur" }; +const columns: Record boolean> = { + W: c => colorid(c.colorIdentity) == "W", + U: c => colorid(c.colorIdentity) == "U", + B: c => colorid(c.colorIdentity) == "B", + R: c => colorid(c.colorIdentity) == "R", + G: c => colorid(c.colorIdentity) == "G", + MC: c => c.colorIdentity.length > 0, + CL: c => colorid(c.colorIdentity) == "CL" +}; + function wubrg(a: string, b: string) { const order = ["W", "U", "B", "R", "G"]; const indexA = order.indexOf(a); @@ -87,6 +97,7 @@ async function run() { const template = await ejs.renderFile("templates/cube.ejs", { user: uid, cards: valid, + columns, utils: { wubrg, colorNames, colorid } }); let cubeFile = `${uid}-cube.html`;