Fish Key: quiet all but sound effects while fishing
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
25e3aa4fec
commit
38e942ac1d
3 changed files with 59 additions and 6 deletions
|
|
@ -34,6 +34,22 @@ local FISHING_CVARS = {
|
|||
{ name = "ActionButtonUseKeyHeldSpell", value = 0, mode = "max" },
|
||||
}
|
||||
|
||||
-- Quiet everything but sound effects so the splash stands out (/fish sound).
|
||||
-- There is no per-sound volume, so other effects (spells, footsteps) still play.
|
||||
local SOUND_CVARS = {
|
||||
{ name = "Sound_EnableMusic", value = 0, mode = "max" },
|
||||
{ name = "Sound_EnableAmbience", value = 0, mode = "max" },
|
||||
{ name = "Sound_EnableDialog", value = 0, mode = "max" },
|
||||
{ name = "Sound_EnablePetSounds", value = 0, mode = "max" },
|
||||
{ name = "Sound_EnableErrorSpeech", value = 0, mode = "max" },
|
||||
{ name = "Sound_EnableSFX", value = 1, mode = "min" },
|
||||
{ name = "Sound_SFXVolume", value = 1, mode = "min" },
|
||||
-- Keep hearing it while another window has focus.
|
||||
{ name = "Sound_EnableSoundWhenGameIsInBG", value = 1, mode = "min" },
|
||||
-- Distant sounds are muffled; the bobber is 15-20 yards out.
|
||||
{ name = "Sound_EnablePositionalLowPassFilter", value = 0, mode = "max" },
|
||||
}
|
||||
|
||||
local owner = CreateFrame("Frame")
|
||||
local overridden = false
|
||||
local clearAfterCombat = false
|
||||
|
|
@ -156,8 +172,8 @@ local function AnyKeyHeld()
|
|||
return false
|
||||
end
|
||||
|
||||
local function ChangeCVars()
|
||||
for _, cvar in ipairs(FISHING_CVARS) do
|
||||
local function ChangeList(list)
|
||||
for _, cvar in ipairs(list) do
|
||||
local current = tonumber(C_CVar.GetCVar(cvar.name))
|
||||
local wrong = current and (cvar.mode == "min" and current < cvar.value or cvar.mode == "max" and current > cvar.value)
|
||||
if wrong and not changedCVars[cvar.name] then
|
||||
|
|
@ -171,6 +187,13 @@ local function ChangeCVars()
|
|||
end
|
||||
end
|
||||
|
||||
local function ChangeCVars()
|
||||
ChangeList(FISHING_CVARS)
|
||||
if FishKeyDB.sound then
|
||||
ChangeList(SOUND_CVARS)
|
||||
end
|
||||
end
|
||||
|
||||
local function RestoreCVars()
|
||||
for name in pairs(changedCVars) do
|
||||
pcall(C_CVar.RemoveTempCVar, name)
|
||||
|
|
@ -272,6 +295,9 @@ owner:SetScript("OnEvent", function(_, event, arg1, _, spellID)
|
|||
if FishKeyDB.enabled == nil then
|
||||
FishKeyDB.enabled = true
|
||||
end
|
||||
if FishKeyDB.sound == nil then
|
||||
FishKeyDB.sound = true
|
||||
end
|
||||
end
|
||||
elseif event == "UNIT_SPELLCAST_CHANNEL_START" then
|
||||
if IsFishing(spellID) then
|
||||
|
|
@ -318,11 +344,15 @@ SlashCmdList.FISHKEY = function(msg)
|
|||
if not FishKeyDB.enabled then
|
||||
Restore()
|
||||
end
|
||||
elseif msg == "sound on" or msg == "sound off" then
|
||||
-- Takes effect from the next cast.
|
||||
FishKeyDB.sound = msg == "sound on"
|
||||
elseif msg ~= "" then
|
||||
Print("/fish shows status, /fish on, /fish off")
|
||||
Print("/fish shows status, /fish on|off, /fish sound on|off")
|
||||
return
|
||||
end
|
||||
local keys = FishingKeys()
|
||||
local where = #keys > 0 and table.concat(keys, ", ") or "no key bound to Fishing"
|
||||
Print((FishKeyDB.enabled and "on" or "off") .. " (" .. where .. ")")
|
||||
Print((FishKeyDB.enabled and "on" or "off") .. " (" .. where .. "), quiet sound "
|
||||
.. (FishKeyDB.sound and "on" or "off"))
|
||||
end
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ Eight small quality-of-life addons for WoW Forever (client 1.60.1, Interface 160
|
|||
| Dungeon Pre-Quest | Marks dungeon quests and quests whose chain leads to one, in the quest log, NPC quest lists and the quest offer window, with a purple "!" on the minimap for ones you can pick up now. | `/dpq <questID>` |
|
||||
| Ship Routes | Draws every boat, zeppelin and airship route on the world map, coloured by faction. Hover a dock marker to see where it sails and light up its route, click it to open the destination's map. On a continent or zone map, a route that sails off it ends in a marker at the edge naming where it goes. | `/routes`, `/routes mine`, `/routes all` |
|
||||
| Flight Finder | Marks the flight masters you haven't discovered yet on zone and continent maps, coloured by faction. Click one to set a waypoint. | `/ff` toggles and counts |
|
||||
| Fish Key | While you fish, the key you cast Fishing with clicks the bobber instead. It casts Fishing again once the fish is looted and the key is released. For the cast it turns the Interact Key setting on and press and hold casting off, then puts both back. | `/fish`, `/fish on`, `/fish off` |
|
||||
| Fish Key | While you fish, the key you cast Fishing with clicks the bobber instead. It casts Fishing again once the fish is looted and the key is released. For the cast it turns the Interact Key setting on and press and hold casting off, then puts both back. It also turns off music, ambience and dialog and turns sound effects to full, so the splash stands out. | `/fish`, `/fish on`, `/fish off`, `/fish sound on`, `/fish sound off` |
|
||||
|
||||
## Install
|
||||
|
||||
|
|
|
|||
|
|
@ -68,7 +68,13 @@ local function advance(sec)
|
|||
clock = target
|
||||
end
|
||||
|
||||
local cvars = { SoftTargetInteract = "0", SoftTargetInteractRange = "10", ActionButtonUseKeyHeldSpell = "1" }
|
||||
local cvars = {
|
||||
SoftTargetInteract = "0", SoftTargetInteractRange = "10", ActionButtonUseKeyHeldSpell = "1",
|
||||
Sound_EnableMusic = "1", Sound_EnableAmbience = "1", Sound_EnableDialog = "0",
|
||||
Sound_EnablePetSounds = "1", Sound_EnableErrorSpeech = "1", Sound_EnableSFX = "1",
|
||||
Sound_SFXVolume = "0.6", Sound_EnableSoundWhenGameIsInBG = "0",
|
||||
Sound_EnablePositionalLowPassFilter = "1",
|
||||
}
|
||||
local temp = {}
|
||||
C_CVar = {
|
||||
GetCVar = function(n) return temp[n] or cvars[n] end,
|
||||
|
|
@ -116,8 +122,15 @@ check(C_CVar.GetCVar("SoftTargetInteract") == "3", "Interact Key turned on while
|
|||
local function restored()
|
||||
return count(overrides) == 0 and C_CVar.GetCVar("SoftTargetInteract") == "0"
|
||||
and C_CVar.GetCVar("SoftTargetInteractRange") == "10" and C_CVar.GetCVar("ActionButtonUseKeyHeldSpell") == "1"
|
||||
and C_CVar.GetCVar("Sound_EnableMusic") == "1" and C_CVar.GetCVar("Sound_SFXVolume") == "0.6"
|
||||
end
|
||||
check(C_CVar.GetCVar("ActionButtonUseKeyHeldSpell") == "0", "press and hold casting off while fishing")
|
||||
check(C_CVar.GetCVar("Sound_EnableMusic") == "0" and C_CVar.GetCVar("Sound_EnableAmbience") == "0"
|
||||
and C_CVar.GetCVar("Sound_EnablePetSounds") == "0" and C_CVar.GetCVar("Sound_EnableErrorSpeech") == "0",
|
||||
"music, ambience, pets and error speech off while fishing")
|
||||
check(C_CVar.GetCVar("Sound_SFXVolume") == "1" and C_CVar.GetCVar("Sound_EnableSoundWhenGameIsInBG") == "1"
|
||||
and C_CVar.GetCVar("Sound_EnablePositionalLowPassFilter") == "0", "effects full, background sound on, no muffling")
|
||||
check(temp.Sound_EnableDialog == nil and temp.Sound_EnableSFX == nil, "settings already right are left alone")
|
||||
|
||||
local function press() C_PlayerInteractionManager.InteractUnit("anyinteract") end
|
||||
|
||||
|
|
@ -222,6 +235,16 @@ handler(nil, "UNIT_SPELLCAST_CHANNEL_START", "player", "guid", 7620)
|
|||
check(count(overrides) == 0, "nothing when off")
|
||||
SlashCmdList.FISHKEY("on")
|
||||
check(FishKeyDB.enabled == true, "/fish on")
|
||||
finish()
|
||||
|
||||
SlashCmdList.FISHKEY("sound off")
|
||||
check(FishKeyDB.sound == false and printed[#printed]:find("quiet sound off", 1, true), "/fish sound off")
|
||||
handler(nil, "UNIT_SPELLCAST_CHANNEL_START", "player", "guid", 7620)
|
||||
check(overrides["F"] == "INTERACTTARGET" and C_CVar.GetCVar("Sound_EnableMusic") == "1"
|
||||
and C_CVar.GetCVar("SoftTargetInteract") == "3", "sound off: key still works, sound untouched")
|
||||
finish()
|
||||
SlashCmdList.FISHKEY("sound on")
|
||||
check(FishKeyDB.sound == true, "/fish sound on")
|
||||
|
||||
print(failures == 0 and "all passed" or (failures .. " failed"))
|
||||
os.exit(failures == 0 and 0 or 1)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue