diff --git a/README.md b/README.md index df73d6b..0567f60 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ Each addon works on its own, so copy only the ones you want. Vendor Flag and Que - Ship Routes' dock names and the list of which paths are transports are curated by hand in `ShipRoutes/tools/generate.py`, because the client doesn't record which ship sails which path. Lanes between continents follow hand-placed sea waypoints there too, since the ships teleport mid-ocean. The Zephras Isle airships have no line, since the island isn't on the world map, and they have no known faction, so they show in neutral gold. - Flight Finder learns which flight points you have only from a flight master's taxi map, since Forever's map lists every flight point as known. Until you talk to any flight master once on a character, every flight point shows. - Fish Key finds Fishing on Blizzard's action bars, `CLICK` bindings to addon buttons, and spell or macro bindings. It doesn't see bar addons that bind keys through their own override bindings, such as Bartender. While you fish it raises the interact range to 30 yards, so a closer NPC or object can be picked over the bobber. -- Windfury! can't read the combat log, which Forever keeps from addons. It reacts to the extra attack combat text event instead, whose spell name is hidden in combat, so Hand of Justice and Sword Specialization procs can set it off too. If it never fires, turn on Options > Combat > Scrolling Combat Text. +- Windfury! can't read the combat log, which Forever keeps from addons. It reacts to the extra attack combat text event instead, whose spell name is hidden in combat, so Hand of Justice and Sword Specialization procs can set it off too. The client only sends that event while Scrolling Combat Text is on, so if it's off the addon turns it on and hides Blizzard's floating text. To get Blizzard's text back, turn the setting off and on again with the addon disabled. ## Tests diff --git a/Windfury/Windfury.lua b/Windfury/Windfury.lua index 1e6f486..ed54bb6 100644 --- a/Windfury/Windfury.lua +++ b/Windfury/Windfury.lua @@ -215,6 +215,41 @@ events:SetScript("OnEvent", function(self, event, arg1) play() end) +-- Combat text --------------------------------------------------------------- +-- The client only sends combat COMBAT_TEXT_UPDATE events (damage, extra +-- attacks) while Scrolling Combat Text is on. If it was off, turn it on and +-- keep Blizzard's floating text hidden, so the screen looks the same. + +local function hideBlizzardText() + if not db.hideBlizzardText or not CombatText then return end + CombatText:Hide() + if not CombatText.windfuryHooked then + CombatText.windfuryHooked = true + CombatText:HookScript("OnShow", function(self) + if db.hideBlizzardText then self:Hide() end + end) + end +end + +local fct = CreateFrame("Frame") +fct:RegisterEvent("PLAYER_LOGIN") +fct:RegisterEvent("ADDON_LOADED") +fct:SetScript("OnEvent", function(_, event, name) + if event == "ADDON_LOADED" then + if name == "Blizzard_CombatText" then hideBlizzardText() end + return + end + if not C_CVar.GetCVarBool("enableFloatingCombatText") then + local ok, err = pcall(C_CVar.SetCVar, "enableFloatingCombatText", "1") + if ok and C_CVar.GetCVarBool("enableFloatingCombatText") then + db.hideBlizzardText = true + else + print("|cff66ccffWindfury!|r couldn't turn on Scrolling Combat Text: " .. tostring(err)) + end + end + hideBlizzardText() +end) + -- Debug log (temporary) ----------------------------------------------------- -- COMBAT_TEXT_UPDATE never saw a proc in game. Log the player's own casts and -- buffs gained, by readable name, to find another event that carries it. diff --git a/tests/test_wf.lua b/tests/test_wf.lua index 228774a..444ce82 100644 --- a/tests/test_wf.lua +++ b/tests/test_wf.lua @@ -9,6 +9,7 @@ local sounds = {} function PlaySound(id, channel) sounds[#sounds + 1] = id; assert(channel == "Master") end local fctOn = false C_CVar = { GetCVarBool = function(n) assert(n == "enableFloatingCombatText"); return fctOn end } +C_CVar.SetCVar = function(n, v) assert(n == "enableFloatingCombatText" and v == "1"); fctOn = true end local secrets = {} function issecretvalue(v) return secrets[v] == true end local spell @@ -54,7 +55,7 @@ dofile(arg[1]) local overlay = WindfuryOverlay local events -for _, fr in ipairs(frames) do if fr.events.ADDON_LOADED then events = fr end end +for _, fr in ipairs(frames) do if fr.events.ADDON_LOADED and not events then events = fr end end assert(overlay and events) local function fire(...) events.scripts.OnEvent(events, ...) end local function run(sec) @@ -138,6 +139,19 @@ assert(not printed[#printed]:find("Scrolling Combat Text")) -- Debug log: casts and auras by name; a "Windfury Attack" cast fires the show. C_Spell = { GetSpellName = function(id) return ({ [8517] = "Windfury Attack", [133] = "Fireball" })[id] end } +-- Login turns Scrolling Combat Text on and keeps Blizzard's text hidden. +fctOn = false +local fctFrame +for _, fr in ipairs(frames) do if fr.events.PLAYER_LOGIN and fr.events.ADDON_LOADED then fctFrame = fr end end +fctFrame.scripts.OnEvent(fctFrame, "PLAYER_LOGIN") +assert(fctOn and WindfuryDB.hideBlizzardText) +CombatText = CreateFrame("Frame") +function CombatText:HookScript(k, fn) local o = self[k]; self.onShow = fn end +fctFrame.scripts.OnEvent(fctFrame, "ADDON_LOADED", "Blizzard_CombatText") +assert(not CombatText.shown) +CombatText:Show(); CombatText.onShow(CombatText) +assert(not CombatText.shown) + local dbg for _, fr in ipairs(frames) do if fr.events.PLAYER_LOGIN then dbg = fr end end dbg.scripts.OnEvent(dbg, "PLAYER_LOGIN")