From 03cbccf703450fa9927c0097c6edc63d6db85384 Mon Sep 17 00:00:00 2001 From: GaboGG Date: Fri, 31 Jul 2026 07:09:30 -0400 Subject: [PATCH] v0.14.34 - Fix difficulty comparison case bug MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bug: difficulties.indexOf(difficulty.toUpperCase()) — the array has 'Nintendo' (mixed case) but toUpperCase() gives 'NINTENDO' which doesn't match, so currentIdx = -1 and -1 < suggestedIdx always true. The suggestion kept firing even when already on Nintendo. (IWBTH worked by luck since uppercase == itself.) Fix: case-insensitive findIndex comparison on both sides. --- scripts/hv-unified.user.js | 8 ++++---- scripts/latest.user.js | 8 ++++---- src/config.js | 2 +- src/guidance.js | 4 ++-- src/header.user.js | 2 +- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/scripts/hv-unified.user.js b/scripts/hv-unified.user.js index f547d58..fd45412 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.14.33 +// @version 0.14.34 // @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.14.33'; +const VERSION = '0.14.34'; const CFG = { // — Battle automation @@ -2554,8 +2554,8 @@ function getDifficultyAdvice() { reason = ''; } - const currentIdx = difficulties.indexOf(difficulty.toUpperCase()); - const suggestedIdx = difficulties.indexOf(suggested); + const currentIdx = difficulties.findIndex(d => d.toLowerCase() === (difficulty || '').toLowerCase()); + const suggestedIdx = difficulties.findIndex(d => d.toLowerCase() === suggested.toLowerCase()); // Only warn if current difficulty is LOWER than suggested // (don't nag if you're already on a higher difficulty) diff --git a/scripts/latest.user.js b/scripts/latest.user.js index f547d58..fd45412 100644 --- a/scripts/latest.user.js +++ b/scripts/latest.user.js @@ -1,7 +1,7 @@ // ==UserScript== // @name HV Unified // @namespace hvunified -// @version 0.14.33 +// @version 0.14.34 // @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.14.33'; +const VERSION = '0.14.34'; const CFG = { // — Battle automation @@ -2554,8 +2554,8 @@ function getDifficultyAdvice() { reason = ''; } - const currentIdx = difficulties.indexOf(difficulty.toUpperCase()); - const suggestedIdx = difficulties.indexOf(suggested); + const currentIdx = difficulties.findIndex(d => d.toLowerCase() === (difficulty || '').toLowerCase()); + const suggestedIdx = difficulties.findIndex(d => d.toLowerCase() === suggested.toLowerCase()); // Only warn if current difficulty is LOWER than suggested // (don't nag if you're already on a higher difficulty) diff --git a/src/config.js b/src/config.js index b24256f..ce060fe 100644 --- a/src/config.js +++ b/src/config.js @@ -2,7 +2,7 @@ // CONFIG — default settings // ═══════════════════════════════════════════════════════════════════════ -const VERSION = '0.14.33'; +const VERSION = '0.14.34'; const CFG = { // — Battle automation diff --git a/src/guidance.js b/src/guidance.js index 9bdc84e..2b10fcf 100644 --- a/src/guidance.js +++ b/src/guidance.js @@ -62,8 +62,8 @@ function getDifficultyAdvice() { reason = ''; } - const currentIdx = difficulties.indexOf(difficulty.toUpperCase()); - const suggestedIdx = difficulties.indexOf(suggested); + const currentIdx = difficulties.findIndex(d => d.toLowerCase() === (difficulty || '').toLowerCase()); + const suggestedIdx = difficulties.findIndex(d => d.toLowerCase() === suggested.toLowerCase()); // Only warn if current difficulty is LOWER than suggested // (don't nag if you're already on a higher difficulty) diff --git a/src/header.user.js b/src/header.user.js index 023514d..87fc706 100644 --- a/src/header.user.js +++ b/src/header.user.js @@ -1,7 +1,7 @@ // ==UserScript== // @name HV Unified // @namespace hvunified -// @version 0.14.33 +// @version 0.14.34 // @description HV Unified — battle automation, guidance, and UI enhancements for HentaiVerse // @author GaboGG + Hermes // @match *://*.hentaiverse.org/*