v0.14.2 - Double-check cooldown via img opacity:0.5 in hasReadySpell

- Some quickbar/deprecated elements retain onclick even when on cooldown
  if the cooldown indicator is only visual (img opacity:0.5) not structural
- Now also checks img.btqi / img style.opacity !== '0.5'
- This catches cases where the parent div has onclick but the inner image
  is visually dimmed (game cooldown)
This commit is contained in:
GaboGG 2026-07-27 14:08:48 -04:00
parent 7ae6e4855f
commit 205f1cd631
5 changed files with 30 additions and 12 deletions

View file

@ -1,7 +1,7 @@
// ==UserScript==
// @name HV Unified
// @namespace hvunified
// @version 0.14.1
// @version 0.14.2
// @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.1';
const VERSION = '0.14.2';
const CFG = {
// — Battle automation
@ -733,11 +733,17 @@ function hasSpell(name) {
return STATE.spellsKnown.some(s => s.n === name);
}
// Check if a spell is not on cooldown (has onclick in the DOM)
// Check if a spell is not on cooldown (has onclick in the DOM AND inner img isn't dimmed)
function hasReadySpell(name) {
const el = $$('.btsd, .btqs').find(e =>
(e.getAttribute('onmouseover') || '').includes(`set_infopane_spell('${name}'`));
return el ? el.hasAttribute('onclick') : false;
if (!el) return false;
if (!el.hasAttribute('onclick')) return false;
// Double-check: the inner img might have opacity:0.5 (cooldown tint)
// even if the parent has onclick from a previous parse
const img = el.querySelector('img.btqi, img');
if (img && img.style.opacity === '0.5') return false;
return true;
}
function findSpell(name) {

View file

@ -1,7 +1,7 @@
// ==UserScript==
// @name HV Unified
// @namespace hvunified
// @version 0.14.1
// @version 0.14.2
// @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.1';
const VERSION = '0.14.2';
const CFG = {
// — Battle automation
@ -733,11 +733,17 @@ function hasSpell(name) {
return STATE.spellsKnown.some(s => s.n === name);
}
// Check if a spell is not on cooldown (has onclick in the DOM)
// Check if a spell is not on cooldown (has onclick in the DOM AND inner img isn't dimmed)
function hasReadySpell(name) {
const el = $$('.btsd, .btqs').find(e =>
(e.getAttribute('onmouseover') || '').includes(`set_infopane_spell('${name}'`));
return el ? el.hasAttribute('onclick') : false;
if (!el) return false;
if (!el.hasAttribute('onclick')) return false;
// Double-check: the inner img might have opacity:0.5 (cooldown tint)
// even if the parent has onclick from a previous parse
const img = el.querySelector('img.btqi, img');
if (img && img.style.opacity === '0.5') return false;
return true;
}
function findSpell(name) {

View file

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

View file

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

View file

@ -8,11 +8,17 @@ function hasSpell(name) {
return STATE.spellsKnown.some(s => s.n === name);
}
// Check if a spell is not on cooldown (has onclick in the DOM)
// Check if a spell is not on cooldown (has onclick in the DOM AND inner img isn't dimmed)
function hasReadySpell(name) {
const el = $$('.btsd, .btqs').find(e =>
(e.getAttribute('onmouseover') || '').includes(`set_infopane_spell('${name}'`));
return el ? el.hasAttribute('onclick') : false;
if (!el) return false;
if (!el.hasAttribute('onclick')) return false;
// Double-check: the inner img might have opacity:0.5 (cooldown tint)
// even if the parent has onclick from a previous parse
const img = el.querySelector('img.btqi, img');
if (img && img.style.opacity === '0.5') return false;
return true;
}
function findSpell(name) {