From 3f865ee6fd72c909b63851012ca6ee7c98a49740 Mon Sep 17 00:00:00 2001 From: GaboGG Date: Sun, 26 Jul 2026 14:05:29 -0400 Subject: [PATCH] v0.13.16 - Fix buff duration parsing for set_infopane_effect raw turn count - The regex only matched 'X turns remaining' text format - Buffs like channeling and freshly cast spells use the raw third parameter of set_infopane_effect('Name','desc',X) without 'turns rem' - These were defaulting to 50 turns, making all fresh buffs appear as having 50 turns when they really had 0-5 - Added fallback to parse the last numeric argument of the function call --- scripts/hv-unified.user.js | 8 +++++--- scripts/latest.user.js | 8 +++++--- src/battle-parser.js | 4 +++- src/config.js | 2 +- src/header.user.js | 2 +- 5 files changed, 15 insertions(+), 9 deletions(-) diff --git a/scripts/hv-unified.user.js b/scripts/hv-unified.user.js index f374ee3..9d89d1e 100644 --- a/scripts/hv-unified.user.js +++ b/scripts/hv-unified.user.js @@ -1,7 +1,7 @@ // ==UserScript== // @name HV Unified // @namespace hvunified -// @version 0.13.15 +// @version 0.13.16 // @description HV Unified — battle automation, guidance, and UI enhancements for HentaiVerse // @author GaboGG + Hermes // @match *://*.hentaiverse.org/* @@ -17,7 +17,7 @@ // CONFIG — default settings // ═══════════════════════════════════════════════════════════════════════ -const VERSION = '0.13.15'; +const VERSION = '0.13.16'; const CFG = { // — Battle automation @@ -488,10 +488,12 @@ function parseBattleState() { $$('img[onmouseover]', pane).forEach(img => { const omo = img.getAttribute('onmouseover') || ''; const dur = omo.match(/(\d+)\s*turns?\s*rem/); + // Also try to get turn count from the last parameter of set_infopane_effect + const rawDur = omo.match(/set_infopane_effect\([^,]+,\s*'[^']*',\s*(\d+)\s*\)/); // 'permanent' means the buff lasts indefinitely (Absorb, autocast effects) const isPermanent = omo.includes("'permanent'"); const name = (img.src || '').split('/').pop().replace('.png', ''); - const turns = isPermanent ? 999 : (dur ? parseInt(dur[1]) : 50); + const turns = isPermanent ? 999 : (dur ? parseInt(dur[1]) : (rawDur ? parseInt(rawDur[1]) : 50)); STATE.buffs[name] = turns; // Track the max duration seen for this buff (for fill-level calculation) if (turns < 999 && turns > (STATE.maxBuffDur[name] || 0)) { diff --git a/scripts/latest.user.js b/scripts/latest.user.js index f374ee3..9d89d1e 100644 --- a/scripts/latest.user.js +++ b/scripts/latest.user.js @@ -1,7 +1,7 @@ // ==UserScript== // @name HV Unified // @namespace hvunified -// @version 0.13.15 +// @version 0.13.16 // @description HV Unified — battle automation, guidance, and UI enhancements for HentaiVerse // @author GaboGG + Hermes // @match *://*.hentaiverse.org/* @@ -17,7 +17,7 @@ // CONFIG — default settings // ═══════════════════════════════════════════════════════════════════════ -const VERSION = '0.13.15'; +const VERSION = '0.13.16'; const CFG = { // — Battle automation @@ -488,10 +488,12 @@ function parseBattleState() { $$('img[onmouseover]', pane).forEach(img => { const omo = img.getAttribute('onmouseover') || ''; const dur = omo.match(/(\d+)\s*turns?\s*rem/); + // Also try to get turn count from the last parameter of set_infopane_effect + const rawDur = omo.match(/set_infopane_effect\([^,]+,\s*'[^']*',\s*(\d+)\s*\)/); // 'permanent' means the buff lasts indefinitely (Absorb, autocast effects) const isPermanent = omo.includes("'permanent'"); const name = (img.src || '').split('/').pop().replace('.png', ''); - const turns = isPermanent ? 999 : (dur ? parseInt(dur[1]) : 50); + const turns = isPermanent ? 999 : (dur ? parseInt(dur[1]) : (rawDur ? parseInt(rawDur[1]) : 50)); STATE.buffs[name] = turns; // Track the max duration seen for this buff (for fill-level calculation) if (turns < 999 && turns > (STATE.maxBuffDur[name] || 0)) { diff --git a/src/battle-parser.js b/src/battle-parser.js index decbecb..e635136 100644 --- a/src/battle-parser.js +++ b/src/battle-parser.js @@ -146,10 +146,12 @@ function parseBattleState() { $$('img[onmouseover]', pane).forEach(img => { const omo = img.getAttribute('onmouseover') || ''; const dur = omo.match(/(\d+)\s*turns?\s*rem/); + // Also try to get turn count from the last parameter of set_infopane_effect + const rawDur = omo.match(/set_infopane_effect\([^,]+,\s*'[^']*',\s*(\d+)\s*\)/); // 'permanent' means the buff lasts indefinitely (Absorb, autocast effects) const isPermanent = omo.includes("'permanent'"); const name = (img.src || '').split('/').pop().replace('.png', ''); - const turns = isPermanent ? 999 : (dur ? parseInt(dur[1]) : 50); + const turns = isPermanent ? 999 : (dur ? parseInt(dur[1]) : (rawDur ? parseInt(rawDur[1]) : 50)); STATE.buffs[name] = turns; // Track the max duration seen for this buff (for fill-level calculation) if (turns < 999 && turns > (STATE.maxBuffDur[name] || 0)) { diff --git a/src/config.js b/src/config.js index 9a98df4..dc586d9 100644 --- a/src/config.js +++ b/src/config.js @@ -2,7 +2,7 @@ // CONFIG — default settings // ═══════════════════════════════════════════════════════════════════════ -const VERSION = '0.13.15'; +const VERSION = '0.13.16'; const CFG = { // — Battle automation diff --git a/src/header.user.js b/src/header.user.js index df83265..61f5e99 100644 --- a/src/header.user.js +++ b/src/header.user.js @@ -1,7 +1,7 @@ // ==UserScript== // @name HV Unified // @namespace hvunified -// @version 0.13.15 +// @version 0.13.16 // @description HV Unified — battle automation, guidance, and UI enhancements for HentaiVerse // @author GaboGG + Hermes // @match *://*.hentaiverse.org/*