From 8c21920d4b7fa4461ec8be35e1f2dedc36dac249 Mon Sep 17 00:00:00 2001 From: GaboGG Date: Sun, 26 Jul 2026 15:17:27 -0400 Subject: [PATCH] v0.13.25 - Debounce Q key to prevent spam on held-key repeat MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Added _lastQTime debounce (300ms) to the Q key handler - Holding Q now fires at most ~3 actions per second instead of ~20, preventing duplicate actions from stale state reads - The previous issue: 6 identical Haste casts, then 8 identical Spark casts, then 12 identical Heartseeker casts — all from state not yet updated by the game --- scripts/hv-unified.user.js | 12 ++++++++++-- scripts/latest.user.js | 12 ++++++++++-- src/config.js | 2 +- src/header.user.js | 2 +- src/keybindings.js | 8 ++++++++ 5 files changed, 30 insertions(+), 6 deletions(-) diff --git a/scripts/hv-unified.user.js b/scripts/hv-unified.user.js index e3a8bba..d444f87 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.13.24 +// @version 0.13.25 // @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.13.24'; +const VERSION = '0.13.25'; const CFG = { // — Battle automation @@ -1549,6 +1549,8 @@ function setupHover() { // ═══════════════════════════════════════════════════════════════════════ let keybindingsSetup = false; +let _lastQTime = 0; +const Q_DEBOUNCE_MS = 300; // Ignore Q repeats faster than this function setupKeybindings() { if (keybindingsSetup) return; @@ -1559,6 +1561,7 @@ function setupKeybindings() { if (e.keyCode === KEYS.COMMA) { if (isBattlePage()) { e.preventDefault(); + STATE.settingsVisible = !STATE.settingsVisible; toggleSettings(); return; } @@ -1567,6 +1570,11 @@ function setupKeybindings() { // Main action hotkey (default: Q) if (e.code === CFG.hotkey && !e.ctrlKey && !e.altKey && !e.metaKey) { if (!isInputFocused() && isBattlePage()) { + // Debounce: ignore key-repeats until game processes the action + const now = Date.now(); + if (now - _lastQTime < Q_DEBOUNCE_MS) return; + _lastQTime = now; + console.log('%c[HV] Q pressed — checking action...', 'color:#888'); parseBattleState(); // Debug: show active buffs and channeling status diff --git a/scripts/latest.user.js b/scripts/latest.user.js index e3a8bba..d444f87 100644 --- a/scripts/latest.user.js +++ b/scripts/latest.user.js @@ -1,7 +1,7 @@ // ==UserScript== // @name HV Unified // @namespace hvunified -// @version 0.13.24 +// @version 0.13.25 // @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.13.24'; +const VERSION = '0.13.25'; const CFG = { // — Battle automation @@ -1549,6 +1549,8 @@ function setupHover() { // ═══════════════════════════════════════════════════════════════════════ let keybindingsSetup = false; +let _lastQTime = 0; +const Q_DEBOUNCE_MS = 300; // Ignore Q repeats faster than this function setupKeybindings() { if (keybindingsSetup) return; @@ -1559,6 +1561,7 @@ function setupKeybindings() { if (e.keyCode === KEYS.COMMA) { if (isBattlePage()) { e.preventDefault(); + STATE.settingsVisible = !STATE.settingsVisible; toggleSettings(); return; } @@ -1567,6 +1570,11 @@ function setupKeybindings() { // Main action hotkey (default: Q) if (e.code === CFG.hotkey && !e.ctrlKey && !e.altKey && !e.metaKey) { if (!isInputFocused() && isBattlePage()) { + // Debounce: ignore key-repeats until game processes the action + const now = Date.now(); + if (now - _lastQTime < Q_DEBOUNCE_MS) return; + _lastQTime = now; + console.log('%c[HV] Q pressed — checking action...', 'color:#888'); parseBattleState(); // Debug: show active buffs and channeling status diff --git a/src/config.js b/src/config.js index b829d83..75ad03b 100644 --- a/src/config.js +++ b/src/config.js @@ -2,7 +2,7 @@ // CONFIG — default settings // ═══════════════════════════════════════════════════════════════════════ -const VERSION = '0.13.24'; +const VERSION = '0.13.25'; const CFG = { // — Battle automation diff --git a/src/header.user.js b/src/header.user.js index 1bd55c6..bdfda2b 100644 --- a/src/header.user.js +++ b/src/header.user.js @@ -1,7 +1,7 @@ // ==UserScript== // @name HV Unified // @namespace hvunified -// @version 0.13.24 +// @version 0.13.25 // @description HV Unified — battle automation, guidance, and UI enhancements for HentaiVerse // @author GaboGG + Hermes // @match *://*.hentaiverse.org/* diff --git a/src/keybindings.js b/src/keybindings.js index 6024979..2ab4da5 100644 --- a/src/keybindings.js +++ b/src/keybindings.js @@ -3,6 +3,8 @@ // ═══════════════════════════════════════════════════════════════════════ let keybindingsSetup = false; +let _lastQTime = 0; +const Q_DEBOUNCE_MS = 300; // Ignore Q repeats faster than this function setupKeybindings() { if (keybindingsSetup) return; @@ -13,6 +15,7 @@ function setupKeybindings() { if (e.keyCode === KEYS.COMMA) { if (isBattlePage()) { e.preventDefault(); + STATE.settingsVisible = !STATE.settingsVisible; toggleSettings(); return; } @@ -21,6 +24,11 @@ function setupKeybindings() { // Main action hotkey (default: Q) if (e.code === CFG.hotkey && !e.ctrlKey && !e.altKey && !e.metaKey) { if (!isInputFocused() && isBattlePage()) { + // Debounce: ignore key-repeats until game processes the action + const now = Date.now(); + if (now - _lastQTime < Q_DEBOUNCE_MS) return; + _lastQTime = now; + console.log('%c[HV] Q pressed — checking action...', 'color:#888'); parseBattleState(); // Debug: show active buffs and channeling status