From f222eeeae493dc04cb0bc56bb991e763037192a1 Mon Sep 17 00:00:00 2001 From: Christopher Gwynn <31748254+Bacon1153@users.noreply.github.com> Date: Sat, 20 Feb 2021 07:09:25 -0500 Subject: better health updates --- index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 9b85ae3..51d08d4 100644 --- a/index.js +++ b/index.js @@ -35,12 +35,12 @@ function setPresence() { } // Get health - const healthRegex = new RegExp(/WizClientGameEf (.+): Updating health globe \(new health: (\d+), new health max: (\d+)\)/gm); + const healthRegex = new RegExp(/Updating health globe \(new health: (\d+), new health max: (\d+)\)\r\n(?!(.+)called for a player that is not this client's!)/gm); // /Updating health globe \(new health: (\d+), new health max: (\d+)\)\n(?!(.+)called for a player that is not this client's!)/gm let tempHealth = logChunk.match(healthRegex); if(tempHealth) { health = healthRegex.exec(tempHealth[tempHealth.length - 1]); - health = health[3] < health[2] ? [health[2], health[2]] : [health[2], health[3]]; + health = health[2] < health[1] ? [health[1], health[1]] : [health[1], health[2]]; } // Check if the game has been quit -- cgit v1.2.3