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
This commit is contained in:
parent
25ea8b4543
commit
3f865ee6fd
5 changed files with 15 additions and 9 deletions
|
|
@ -1,7 +1,7 @@
|
||||||
// ==UserScript==
|
// ==UserScript==
|
||||||
// @name HV Unified
|
// @name HV Unified
|
||||||
// @namespace hvunified
|
// @namespace hvunified
|
||||||
// @version 0.13.15
|
// @version 0.13.16
|
||||||
// @description HV Unified — battle automation, guidance, and UI enhancements for HentaiVerse
|
// @description HV Unified — battle automation, guidance, and UI enhancements for HentaiVerse
|
||||||
// @author GaboGG + Hermes
|
// @author GaboGG + Hermes
|
||||||
// @match *://*.hentaiverse.org/*
|
// @match *://*.hentaiverse.org/*
|
||||||
|
|
@ -17,7 +17,7 @@
|
||||||
// CONFIG — default settings
|
// CONFIG — default settings
|
||||||
// ═══════════════════════════════════════════════════════════════════════
|
// ═══════════════════════════════════════════════════════════════════════
|
||||||
|
|
||||||
const VERSION = '0.13.15';
|
const VERSION = '0.13.16';
|
||||||
|
|
||||||
const CFG = {
|
const CFG = {
|
||||||
// — Battle automation
|
// — Battle automation
|
||||||
|
|
@ -488,10 +488,12 @@ function parseBattleState() {
|
||||||
$$('img[onmouseover]', pane).forEach(img => {
|
$$('img[onmouseover]', pane).forEach(img => {
|
||||||
const omo = img.getAttribute('onmouseover') || '';
|
const omo = img.getAttribute('onmouseover') || '';
|
||||||
const dur = omo.match(/(\d+)\s*turns?\s*rem/);
|
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)
|
// 'permanent' means the buff lasts indefinitely (Absorb, autocast effects)
|
||||||
const isPermanent = omo.includes("'permanent'");
|
const isPermanent = omo.includes("'permanent'");
|
||||||
const name = (img.src || '').split('/').pop().replace('.png', '');
|
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;
|
STATE.buffs[name] = turns;
|
||||||
// Track the max duration seen for this buff (for fill-level calculation)
|
// Track the max duration seen for this buff (for fill-level calculation)
|
||||||
if (turns < 999 && turns > (STATE.maxBuffDur[name] || 0)) {
|
if (turns < 999 && turns > (STATE.maxBuffDur[name] || 0)) {
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
// ==UserScript==
|
// ==UserScript==
|
||||||
// @name HV Unified
|
// @name HV Unified
|
||||||
// @namespace hvunified
|
// @namespace hvunified
|
||||||
// @version 0.13.15
|
// @version 0.13.16
|
||||||
// @description HV Unified — battle automation, guidance, and UI enhancements for HentaiVerse
|
// @description HV Unified — battle automation, guidance, and UI enhancements for HentaiVerse
|
||||||
// @author GaboGG + Hermes
|
// @author GaboGG + Hermes
|
||||||
// @match *://*.hentaiverse.org/*
|
// @match *://*.hentaiverse.org/*
|
||||||
|
|
@ -17,7 +17,7 @@
|
||||||
// CONFIG — default settings
|
// CONFIG — default settings
|
||||||
// ═══════════════════════════════════════════════════════════════════════
|
// ═══════════════════════════════════════════════════════════════════════
|
||||||
|
|
||||||
const VERSION = '0.13.15';
|
const VERSION = '0.13.16';
|
||||||
|
|
||||||
const CFG = {
|
const CFG = {
|
||||||
// — Battle automation
|
// — Battle automation
|
||||||
|
|
@ -488,10 +488,12 @@ function parseBattleState() {
|
||||||
$$('img[onmouseover]', pane).forEach(img => {
|
$$('img[onmouseover]', pane).forEach(img => {
|
||||||
const omo = img.getAttribute('onmouseover') || '';
|
const omo = img.getAttribute('onmouseover') || '';
|
||||||
const dur = omo.match(/(\d+)\s*turns?\s*rem/);
|
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)
|
// 'permanent' means the buff lasts indefinitely (Absorb, autocast effects)
|
||||||
const isPermanent = omo.includes("'permanent'");
|
const isPermanent = omo.includes("'permanent'");
|
||||||
const name = (img.src || '').split('/').pop().replace('.png', '');
|
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;
|
STATE.buffs[name] = turns;
|
||||||
// Track the max duration seen for this buff (for fill-level calculation)
|
// Track the max duration seen for this buff (for fill-level calculation)
|
||||||
if (turns < 999 && turns > (STATE.maxBuffDur[name] || 0)) {
|
if (turns < 999 && turns > (STATE.maxBuffDur[name] || 0)) {
|
||||||
|
|
|
||||||
|
|
@ -146,10 +146,12 @@ function parseBattleState() {
|
||||||
$$('img[onmouseover]', pane).forEach(img => {
|
$$('img[onmouseover]', pane).forEach(img => {
|
||||||
const omo = img.getAttribute('onmouseover') || '';
|
const omo = img.getAttribute('onmouseover') || '';
|
||||||
const dur = omo.match(/(\d+)\s*turns?\s*rem/);
|
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)
|
// 'permanent' means the buff lasts indefinitely (Absorb, autocast effects)
|
||||||
const isPermanent = omo.includes("'permanent'");
|
const isPermanent = omo.includes("'permanent'");
|
||||||
const name = (img.src || '').split('/').pop().replace('.png', '');
|
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;
|
STATE.buffs[name] = turns;
|
||||||
// Track the max duration seen for this buff (for fill-level calculation)
|
// Track the max duration seen for this buff (for fill-level calculation)
|
||||||
if (turns < 999 && turns > (STATE.maxBuffDur[name] || 0)) {
|
if (turns < 999 && turns > (STATE.maxBuffDur[name] || 0)) {
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
// CONFIG — default settings
|
// CONFIG — default settings
|
||||||
// ═══════════════════════════════════════════════════════════════════════
|
// ═══════════════════════════════════════════════════════════════════════
|
||||||
|
|
||||||
const VERSION = '0.13.15';
|
const VERSION = '0.13.16';
|
||||||
|
|
||||||
const CFG = {
|
const CFG = {
|
||||||
// — Battle automation
|
// — Battle automation
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
// ==UserScript==
|
// ==UserScript==
|
||||||
// @name HV Unified
|
// @name HV Unified
|
||||||
// @namespace hvunified
|
// @namespace hvunified
|
||||||
// @version 0.13.15
|
// @version 0.13.16
|
||||||
// @description HV Unified — battle automation, guidance, and UI enhancements for HentaiVerse
|
// @description HV Unified — battle automation, guidance, and UI enhancements for HentaiVerse
|
||||||
// @author GaboGG + Hermes
|
// @author GaboGG + Hermes
|
||||||
// @match *://*.hentaiverse.org/*
|
// @match *://*.hentaiverse.org/*
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue