v0.14.34 - Fix difficulty comparison case bug

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.
This commit is contained in:
GaboGG 2026-07-31 07:09:30 -04:00
parent 166539e845
commit 03cbccf703
5 changed files with 12 additions and 12 deletions

View file

@ -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)

View file

@ -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)

View file

@ -2,7 +2,7 @@
// CONFIG — default settings
// ═══════════════════════════════════════════════════════════════════════
const VERSION = '0.14.33';
const VERSION = '0.14.34';
const CFG = {
// — Battle automation

View file

@ -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)

View file

@ -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/*