From f67831c483aac413cec9f1def0bd5024d640003a Mon Sep 17 00:00:00 2001 From: ExInferi Date: Fri, 6 Dec 2024 12:08:16 +0100 Subject: [PATCH 1/4] fix: format total with locale string for better readability --- scripts/script.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/script.js b/scripts/script.js index 090c0d0..6f6e108 100644 --- a/scripts/script.js +++ b/scripts/script.js @@ -446,7 +446,7 @@ function getTotal(source) { // Function to display totals on top of the list function displayTotal(text, total) { - $('#item-list').append(`
  • ${text}: ${total}
  • `); + $('#item-list').append(`
  • ${text}: ${total.toLocaleString()}
  • `); } // Function to append items to the list below function appendItems(items) { From 21d6ea7bf99ae2464cd0a230722193d6c8fe286e Mon Sep 17 00:00:00 2001 From: ExInferi Date: Sun, 8 Dec 2024 21:46:50 +0100 Subject: [PATCH 2/4] fix: update regex for D&D tokens --- README.md | 6 +++++- scripts/script.js | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 8fd4af7..02b0b1e 100644 --- a/README.md +++ b/README.md @@ -41,9 +41,13 @@ Have fun tracking! ## Updates +**Update 8 December 2024, 20:45 Game Time**: + +* Fixed D&D Tokens not fully capturing within mystery gifts. + **Update 3 December 2024, 07:30 Game Time**: -* Added tracking of mystery gift contents +* Added tracking of mystery gift contents. **Update 2 December 2024, 20:45 Game Time**: diff --git a/scripts/script.js b/scripts/script.js index 6f6e108..d050595 100644 --- a/scripts/script.js +++ b/scripts/script.js @@ -280,8 +280,8 @@ function readChatbox() { }); } if (foundMystery) { - const regex = /(\[\d+:\d+:\d+\]) You unwrap your mystery gift and receive: \s?((?:\1 \d+[ x ][\w\s':+\-!()\d]+ ?)+)/g; - const itemRegex = /\[\d+:\d+:\d+\] (\d+)\s*x?\s*([\w\s'+:\-!()\d]*)/g; + const regex = /(\[\d+:\d+:\d+\]) You unwrap your mystery gift and receive: \s?((?:\1 \d+[ x ][\w\s':&+\-!()\d]+ ?)+)/g; + const itemRegex = /\[\d+:\d+:\d+\] (\d+)\s*x?\s*([\w\s'+&:\-!()\d]*)/g; const rewardRegex = new RegExp(regex.source); const rewards = chat.match(regex); const counter = `${APP_PREFIX}MysteryGifts`; From 81255d82635bb8bb089d870076c272d8bf0b83c5 Mon Sep 17 00:00:00 2001 From: ExInferi Date: Mon, 30 Dec 2024 02:32:35 +0100 Subject: [PATCH 3/4] fix: update regex to correctly match currency pouch messages --- scripts/script.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/script.js b/scripts/script.js index d050595..e01559a 100644 --- a/scripts/script.js +++ b/scripts/script.js @@ -218,7 +218,7 @@ function readChatbox() { let opts = reader.read() || []; let chat = ''; // CUSTOM: Ignore currency pouch - const ignoreLine = /\[\d+:\d+:\d+\] \d*,?\d* coins have been added to your money pouch.\s?/g; + const ignoreLine = /\[\d+:\d+:\d+\] [\d,]+ coins have been added to your money pouch.\s?/g; for (let a in opts) { chat += opts[a].text.replace(',', '') + ' '; } From db87b0081947e434308ec0eb67a7ea588a41102d Mon Sep 17 00:00:00 2001 From: ExInferi Date: Mon, 30 Dec 2024 02:32:35 +0100 Subject: [PATCH 4/4] fix: update regex --- scripts/script.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/script.js b/scripts/script.js index d050595..de45bbc 100644 --- a/scripts/script.js +++ b/scripts/script.js @@ -218,9 +218,9 @@ function readChatbox() { let opts = reader.read() || []; let chat = ''; // CUSTOM: Ignore currency pouch - const ignoreLine = /\[\d+:\d+:\d+\] \d*,?\d* coins have been added to your money pouch.\s?/g; + const ignoreLine = /\[\d+:\d+:\d+\] [\d,]+ coins have been added to your money pouch.\s?/g; for (let a in opts) { - chat += opts[a].text.replace(',', '') + ' '; + chat += opts[a].text.replace(/,/g, '') + ' '; } chat = chat.replace(ignoreLine, ''); // DEBUG: See chat and opts in console