v0.13.25 - Debounce Q key to prevent spam on held-key repeat
- 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
This commit is contained in:
parent
86968f531c
commit
8c21920d4b
5 changed files with 30 additions and 6 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
// CONFIG — default settings
|
||||
// ═══════════════════════════════════════════════════════════════════════
|
||||
|
||||
const VERSION = '0.13.24';
|
||||
const VERSION = '0.13.25';
|
||||
|
||||
const CFG = {
|
||||
// — Battle automation
|
||||
|
|
|
|||
|
|
@ -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/*
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue