Fish Key: turn Interact Key on while fishing

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
rope 2026-11-11 17:02:47 +00:00
parent 6ae2b47bb1
commit 2d2b31aaf8
3 changed files with 46 additions and 18 deletions

View file

@ -38,7 +38,7 @@ function ClearOverrideBindings() overrides = {} end
local inCombat = false
function InCombatLockdown() return inCombat end
local cvars = { SoftTargetInteractRange = "10" }
local cvars = { SoftTargetInteract = "0", SoftTargetInteractRange = "10" }
local temp = {}
C_CVar = {
GetCVar = function(n) return temp[n] or cvars[n] end,
@ -78,10 +78,12 @@ check(overrides["BUTTON4"] == "INTERACTTARGET", "CLICK binding to an addon butto
check(overrides["G"] == nil and overrides["N"] == nil, "other spells untouched")
check(count(overrides) == 5, "only Fishing keys overridden")
check(C_CVar.GetCVar("SoftTargetInteractRange") == "30", "interact range raised while fishing")
check(C_CVar.GetCVar("SoftTargetInteract") == "3", "Interact Key turned on while fishing")
handler(nil, "UNIT_SPELLCAST_CHANNEL_STOP", "player", "guid", 7731)
check(count(overrides) == 0, "keys back to Fishing when the channel ends")
check(C_CVar.GetCVar("SoftTargetInteractRange") == "10", "range restored")
check(C_CVar.GetCVar("SoftTargetInteract") == "0", "Interact Key off again")
handler(nil, "UNIT_SPELLCAST_CHANNEL_START", "player", "guid", 133)
check(count(overrides) == 0, "other channels ignored")
@ -99,6 +101,18 @@ handler(nil, "UNIT_SPELLCAST_CHANNEL_START", "player", "guid", 7620)
check(temp.SoftTargetInteractRange == nil, "longer range left alone")
handler(nil, "UNIT_SPELLCAST_CHANNEL_STOP", "player", "guid", 7620)
cvars.SoftTargetInteract = "3"
handler(nil, "UNIT_SPELLCAST_CHANNEL_START", "player", "guid", 7620)
check(temp.SoftTargetInteract == nil, "Interact Key already on is left alone")
handler(nil, "UNIT_SPELLCAST_CHANNEL_STOP", "player", "guid", 7620)
cvars.SoftTargetInteract = "0"
C_CVar.SetTempCVar = function() error("secure cvar") end
handler(nil, "UNIT_SPELLCAST_CHANNEL_START", "player", "guid", 7620)
check(overrides["F"] == "INTERACTTARGET" and printed[#printed]:find("Settings", 1, true), "blocked setting warns, key still overridden")
handler(nil, "UNIT_SPELLCAST_CHANNEL_STOP", "player", "guid", 7620)
C_CVar.SetTempCVar = function(n, v) temp[n] = v end
SlashCmdList.FISHKEY("off")
check(FishKeyDB.enabled == false, "/fish off")
check(printed[#printed]:find("off", 1, true) and printed[#printed]:find("F, SHIFT-1", 1, true), "status lists keys")