v0.14.41 - Fix gear slot detection: 'gi' was matching inside 'leggings'

Root cause: gearDetectSlot used substring matching. The Body keyword
'gi' (for gi/jacket) appears inside the word 'leggings' (l-e-g-g-i-n-g-s),
so EVERY leggings item was classified as Body:
  - Legs slot showed '(no data)' — its equipped item was mis-detected
  - Body slot showed leggings items as top candidates (176 score)

Fix: word-boundary regex match (\bgi\b) so 'gi' only matches as a
standalone word. Also protects against 'cap' in 'capacity' etc.
This commit is contained in:
GaboGG 2026-07-31 10:59:17 -04:00
parent 641363b5b0
commit e935e34ae1
5 changed files with 15 additions and 9 deletions

View file

@ -1,7 +1,7 @@
// ==UserScript==
// @name HV Unified
// @namespace hvunified
// @version 0.14.40
// @version 0.14.41
// @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.40';
const VERSION = '0.14.41';
const CFG = {
// — Battle automation
@ -3777,7 +3777,9 @@ function gearDetectSlot(item) {
const name = ((item.name || '') + ' ' + (item.category || '')).toLowerCase();
for (const [slot, kws] of Object.entries(GEAR_SLOT_KEYWORDS)) {
for (const kw of kws) {
if (name.includes(kw)) return slot;
// Word-boundary match: prevents 'gi' matching inside 'leggings',
// 'cap' inside 'capacity', etc.
if (new RegExp('\\b' + kw + '\\b').test(name)) return slot;
}
}
return null;

View file

@ -1,7 +1,7 @@
// ==UserScript==
// @name HV Unified
// @namespace hvunified
// @version 0.14.40
// @version 0.14.41
// @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.40';
const VERSION = '0.14.41';
const CFG = {
// — Battle automation
@ -3777,7 +3777,9 @@ function gearDetectSlot(item) {
const name = ((item.name || '') + ' ' + (item.category || '')).toLowerCase();
for (const [slot, kws] of Object.entries(GEAR_SLOT_KEYWORDS)) {
for (const kw of kws) {
if (name.includes(kw)) return slot;
// Word-boundary match: prevents 'gi' matching inside 'leggings',
// 'cap' inside 'capacity', etc.
if (new RegExp('\\b' + kw + '\\b').test(name)) return slot;
}
}
return null;

View file

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

View file

@ -69,7 +69,9 @@ function gearDetectSlot(item) {
const name = ((item.name || '') + ' ' + (item.category || '')).toLowerCase();
for (const [slot, kws] of Object.entries(GEAR_SLOT_KEYWORDS)) {
for (const kw of kws) {
if (name.includes(kw)) return slot;
// Word-boundary match: prevents 'gi' matching inside 'leggings',
// 'cap' inside 'capacity', etc.
if (new RegExp('\\b' + kw + '\\b').test(name)) return slot;
}
}
return null;

View file

@ -1,7 +1,7 @@
// ==UserScript==
// @name HV Unified
// @namespace hvunified
// @version 0.14.40
// @version 0.14.41
// @description HV Unified — battle automation, guidance, and UI enhancements for HentaiVerse
// @author GaboGG + Hermes
// @match *://*.hentaiverse.org/*