From 42034aec772ef5f7f1a663a0e5bf2bf9db4711c0 Mon Sep 17 00:00:00 2001 From: Alexandre Colella Date: Fri, 22 Nov 2019 16:25:25 +0100 Subject: [PATCH 1/3] only card, no quantity --- js/decklist/decklist.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/js/decklist/decklist.js b/js/decklist/decklist.js index 3c9afbc..464ef13 100644 --- a/js/decklist/decklist.js +++ b/js/decklist/decklist.js @@ -24,10 +24,12 @@ var Decklist = { main: [ /^\s*(\d+)\s+\[.*\]\s+(.+?)\s*$/, // MWS, what an ugly format /^\s*(\d+)x*\s(.+?)\s*$/, // MTGO deck format (4 Brainstorm) also TCG (4x Brainstorm) + /^\s*()?(.+?)\s*$/, // Single card ], side: [ /^\s*SB:\s*(\d+)\s+\[.*\]\s(.+?)\s*$/, // MWS, what an ugly format /^\s*SB:\s+(\d+)\s(.+?)\s*$/, // Sideboard lines begin with SB: + /^\s*()?(.+?)\s*$/, // Single card ], }; @@ -76,7 +78,7 @@ var Decklist = { } let result = re.exec(line), - quantity = parseInt(result[1]), + quantity = parseInt(result[1]) ? parseInt(result[1]) : 1, cardName = result[2], card = getCard(cardName); // add quantity field to card object From 641cce559782a8e0e69beed78c049a9861e69546 Mon Sep 17 00:00:00 2001 From: Alexandre Colella Date: Fri, 22 Nov 2019 17:14:33 +0100 Subject: [PATCH 2/3] Update js/decklist/decklist.js Co-Authored-By: Jordan --- js/decklist/decklist.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/decklist/decklist.js b/js/decklist/decklist.js index 464ef13..e9f3253 100644 --- a/js/decklist/decklist.js +++ b/js/decklist/decklist.js @@ -29,7 +29,7 @@ var Decklist = { side: [ /^\s*SB:\s*(\d+)\s+\[.*\]\s(.+?)\s*$/, // MWS, what an ugly format /^\s*SB:\s+(\d+)\s(.+?)\s*$/, // Sideboard lines begin with SB: - /^\s*()?(.+?)\s*$/, // Single card + /^\s*()?(.+?)\s*$/, // Single card ], }; From 9c5930734c8dda8f4c45d24c9745c463bcea3cf1 Mon Sep 17 00:00:00 2001 From: Alexandre Colella Date: Fri, 22 Nov 2019 17:14:39 +0100 Subject: [PATCH 3/3] Update js/decklist/decklist.js Co-Authored-By: Jordan --- js/decklist/decklist.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/decklist/decklist.js b/js/decklist/decklist.js index e9f3253..21db520 100644 --- a/js/decklist/decklist.js +++ b/js/decklist/decklist.js @@ -78,7 +78,7 @@ var Decklist = { } let result = re.exec(line), - quantity = parseInt(result[1]) ? parseInt(result[1]) : 1, + quantity = parseInt(result[1]) || 1, cardName = result[2], card = getCard(cardName); // add quantity field to card object