From 0a6ddacdb1758e49c305c280f8c59a9580c41d08 Mon Sep 17 00:00:00 2001 From: iainp5 Date: Sun, 15 Dec 2024 21:50:03 +0000 Subject: Update logging of Genscher --- rules.js | 68 ++++++++++++++++++++++++++++++++++++---------------------------- 1 file changed, 38 insertions(+), 30 deletions(-) diff --git a/rules.js b/rules.js index 71697ca..3d3d57d 100644 --- a/rules.js +++ b/rules.js @@ -4512,40 +4512,48 @@ function pop_summary_i() { game.summary = [] } */ - function pop_summary_i() { - if (game.summary.length > 0) { - // Create a map to group by space and track totals and details - let grouped_summary = new Map(); - - for (let [n, msg] of game.summary) { - // Extract the space identifier (e.g., %67) from the message - let space_match = msg.match(/%\d+/); - let space = space_match ? space_match[0] : "unknown"; - - // Extract any details (e.g., £CU to £CC) from the message - let details_match = msg.match(/\(.*?\)$/); - let details = details_match ? details_match[0] : ""; - - // Update or initialize the entry for the space - if (!grouped_summary.has(space)) { - grouped_summary.set(space, { total: 0, details }); - } - let entry = grouped_summary.get(space); - entry.total += n; - - // Always keep the most specific details (non-empty) - if (details) { - entry.details = details; - } +function pop_summary_i() { + if (game.summary.length > 0) { + // Create a map to group by space and track totals and details + let grouped_summary = new Map(); + let c63_logged = false; + + for (let [n, msg] of game.summary) { + if (msg === "-1 op due to C63") { + if (!c63_logged) { + logi(msg); + c63_logged = true; + } + continue; + } + // Extract the space identifier (e.g., %67) from the message + let space_match = msg.match(/%\d+/); + let space = space_match ? space_match[0] : "unknown"; + + // Extract any details (e.g., £CU to £CC) from the message + let details_match = msg.match(/\(.*?\)$/); + let details = details_match ? details_match[0] : ""; + + // Update or initialize the entry for the space + if (!grouped_summary.has(space)) { + grouped_summary.set(space, { total: 0, details }); } - - // Log the grouped results - for (let [space, { total, details }] of grouped_summary) { - logi(`${total} in ${space} ${details}`); + let entry = grouped_summary.get(space); + entry.total += n; + + // Always keep the most specific details (non-empty) + if (details) { + entry.details = details; } } - game.summary = []; + + // Log the grouped results + for (let [space, { total, details }] of grouped_summary) { + logi(`${total} in ${space} ${details}`); + } } + game.summary = []; +} -- cgit v1.2.3