Fish Key: no wait after a miss
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
02c88282cf
commit
db73c215bb
2 changed files with 93 additions and 18 deletions
|
|
@ -46,6 +46,13 @@ end
|
|||
|
||||
local clock, timers = 0, {}
|
||||
C_Timer = { After = function(sec, fn) timers[#timers + 1] = { at = clock + sec, fn = fn } end }
|
||||
function GetTime() return clock end
|
||||
function GetNetStats() return 0, 0, 20, 50 end
|
||||
function hooksecurefunc(t, name, fn)
|
||||
local orig = t[name]
|
||||
t[name] = function(...) local r = orig(...); fn(...); return r end
|
||||
end
|
||||
C_PlayerInteractionManager = { InteractUnit = function() return true end }
|
||||
local function advance(sec)
|
||||
local target = clock + sec
|
||||
while true do
|
||||
|
|
@ -112,8 +119,11 @@ local function restored()
|
|||
end
|
||||
check(C_CVar.GetCVar("ActionButtonUseKeyHeldSpell") == "0", "press and hold casting off while fishing")
|
||||
|
||||
local function press() C_PlayerInteractionManager.InteractUnit("anyinteract") end
|
||||
|
||||
-- Catch with the key held through the loot (press and hold, slow release).
|
||||
held["F"] = true
|
||||
press()
|
||||
handler(nil, "UNIT_SPELLCAST_CHANNEL_STOP", "player", "guid", 7731)
|
||||
check(overrides["F"] == "INTERACTTARGET", "still interact right after the channel ends")
|
||||
handler(nil, "LOOT_OPENED")
|
||||
|
|
@ -126,31 +136,52 @@ held["F"] = nil
|
|||
advance(0.1)
|
||||
check(restored(), "key and settings restored once looted and released")
|
||||
|
||||
-- Miss: no loot window.
|
||||
-- Cast ends with no press (timeout, moved): back at once.
|
||||
handler(nil, "UNIT_SPELLCAST_CHANNEL_START", "player", "guid", 7620)
|
||||
stop()
|
||||
advance(1)
|
||||
check(overrides["F"] == "INTERACTTARGET", "waits a moment for loot after a miss")
|
||||
advance(1)
|
||||
check(restored(), "restored after a miss")
|
||||
check(restored(), "no press: restored immediately")
|
||||
|
||||
-- Loot arrives before the channel stop, modifier key held.
|
||||
-- An early press long before the timeout doesn't count.
|
||||
handler(nil, "UNIT_SPELLCAST_CHANNEL_START", "player", "guid", 7620)
|
||||
handler(nil, "LOOT_OPENED")
|
||||
press()
|
||||
advance(10)
|
||||
stop()
|
||||
check(restored(), "old press: restored immediately")
|
||||
|
||||
-- Pressed with nothing hooked: the error message ends the wait.
|
||||
handler(nil, "UNIT_SPELLCAST_CHANNEL_START", "player", "guid", 7620)
|
||||
press()
|
||||
stop()
|
||||
check(overrides["F"] == "INTERACTTARGET", "press: waits for loot")
|
||||
handler(nil, "UI_ERROR_MESSAGE", 1, "No fish are hooked.")
|
||||
check(restored(), "error message: restored immediately")
|
||||
|
||||
-- Pressed, no loot and no error: short latency-based wait (0.25 + 2 x 50ms).
|
||||
handler(nil, "UNIT_SPELLCAST_CHANNEL_START", "player", "guid", 7620)
|
||||
press()
|
||||
stop()
|
||||
advance(0.3)
|
||||
check(overrides["F"] == "INTERACTTARGET", "still waiting at 0.3s")
|
||||
advance(0.1)
|
||||
check(restored(), "restored after 0.35s")
|
||||
|
||||
-- Loot arrives and closes before the channel stop, modifier key held.
|
||||
handler(nil, "UNIT_SPELLCAST_CHANNEL_START", "player", "guid", 7620)
|
||||
press()
|
||||
handler(nil, "LOOT_OPENED")
|
||||
held["1"] = true
|
||||
handler(nil, "LOOT_CLOSED")
|
||||
stop()
|
||||
advance(0.2)
|
||||
check(overrides["SHIFT-1"] == "INTERACTTARGET", "held SHIFT-1 counts as held")
|
||||
held["1"] = nil
|
||||
advance(0.1)
|
||||
check(restored(), "restored after loot that came first")
|
||||
advance(0.06)
|
||||
check(restored(), "restored after loot that came first, no extra wait")
|
||||
|
||||
-- A stale miss timer must not cut short the next cast.
|
||||
-- A stale loot timer must not cut short the next cast.
|
||||
handler(nil, "UNIT_SPELLCAST_CHANNEL_START", "player", "guid", 7620)
|
||||
handler(nil, "LOOT_OPENED")
|
||||
press()
|
||||
stop()
|
||||
handler(nil, "LOOT_CLOSED")
|
||||
handler(nil, "UNIT_SPELLCAST_CHANNEL_START", "player", "guid", 7620)
|
||||
advance(2)
|
||||
check(overrides["F"] == "INTERACTTARGET", "old timer leaves the new cast alone")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue