-- Windfury!: every Windfury proc slams a huge "WINDFURY!" onto the screen with -- a lightning flash, a storm glow at the edges, a spinning Windfury icon, a -- burst of icons and a raid warning horn. Procs close together build a combo -- that makes it bigger, longer and shakier. -- -- Forever's combat log is secure-only, so addons can't read it. Extra attacks -- still reach addons as COMBAT_TEXT_UPDATE("EXTRA_ATTACKS"). Its spell name is -- a secret value in combat: when it can be read and isn't Windfury (Hand of -- Justice, Sword Specialization) the proc is skipped, otherwise it counts. local COMBO_WINDOW = 8 -- seconds between procs that keep a combo going local SHOW_TIME = 1.3 -- base length of the show, +0.1s per combo step local PARTICLES = 14 local ICON = "Interface\\Icons\\Spell_Nature_Cyclone" local SOUND_PROC = (SOUNDKIT and SOUNDKIT.RAID_WARNING) or 8959 local SOUND_COMBO = (SOUNDKIT and SOUNDKIT.UI_RAID_BOSS_WHISPER_WARNING) or 37666 local COMBO_TEXT = { [2] = "DOUBLE WINDFURY", [3] = "TRIPLE WINDFURY", [4] = "QUADRA WINDFURY", [5] = "WINDFURY RAMPAGE", [6] = "UNSTOPPABLE", } local COMBO_MAX_TEXT = "GODLIKE" local function secret(v) return issecretvalue ~= nil and issecretvalue(v) end local db local combo, lastProc = 0, -math.huge -- Frames -------------------------------------------------------------------- local f = CreateFrame("Frame", "WindfuryOverlay", UIParent) f:SetFrameStrata("FULLSCREEN_DIALOG") f:SetAllPoints(UIParent) f:EnableMouse(false) f:Hide() local flash = f:CreateTexture(nil, "BACKGROUND") flash:SetAllPoints() flash:SetColorTexture(1, 1, 1, 1) flash:SetBlendMode("ADD") flash:SetVertexColor(0.55, 0.85, 1) local edge = f:CreateTexture(nil, "BORDER") edge:SetAllPoints() edge:SetTexture("Interface\\FullScreenTextures\\LowHealth") edge:SetBlendMode("ADD") edge:SetVertexColor(0.2, 0.7, 1) local function roundIcon(parent, layer, size) local t = parent:CreateTexture(nil, layer) t:SetTexture(ICON) t:SetSize(size, size) t:SetBlendMode("ADD") local m = parent:CreateMaskTexture() m:SetTexture("Interface\\CharacterFrame\\TempPortraitAlphaMask", "CLAMPTOBLACKADDITIVE", "CLAMPTOBLACKADDITIVE") m:SetAllPoints(t) t:AddMaskTexture(m) return t end local vortex = roundIcon(f, "ARTWORK", 256) vortex:SetPoint("CENTER", 0, 120) local particles = {} for i = 1, PARTICLES do local p = roundIcon(f, "ARTWORK", 40) p.angle = (i / PARTICLES) * 2 * math.pi particles[i] = p end -- The title sits in its own frame so it can be scaled as a whole. Two tinted -- copies jitter behind it for a glitchy, chromatic look. local title = CreateFrame("Frame", nil, f) title:SetSize(1, 1) local function titleText(r, g, b, a, layer) local s = title:CreateFontString(nil, layer) s:SetFont(STANDARD_TEXT_FONT, 72, "THICKOUTLINE") s:SetText("WINDFURY!") s:SetTextColor(r, g, b, a) return s end local ghostRed = titleText(1, 0.15, 0.3, 0.7, "ARTWORK") local ghostCyan = titleText(0.1, 1, 1, 0.7, "ARTWORK") local main = titleText(0.85, 0.97, 1, 1, "OVERLAY") main:SetPoint("CENTER") main:SetShadowOffset(4, -4) main:SetShadowColor(0, 0.2, 0.6, 1) local comboText = f:CreateFontString(nil, "OVERLAY") comboText:SetFont(STANDARD_TEXT_FONT, 32, "THICKOUTLINE") comboText:SetTextColor(1, 0.85, 0.1) -- Animation ----------------------------------------------------------------- local t, duration = 0, SHOW_TIME local function clamp(x) return x < 0 and 0 or (x > 1 and 1 or x) end local function easeOut(x) x = clamp(x); return 1 - (1 - x) * (1 - x) end local function jitter(n) return (math.random() * 2 - 1) * n end local function render() local shake = (6 + 4 * combo) * (1 - clamp(t / duration)) flash:SetAlpha(0.5 * (1 - clamp(t / 0.25)) + ((t > 0.1 and t < 0.18) and 0.35 or 0)) edge:SetAlpha(0.9 * (1 - clamp(t / duration))) local v = clamp(t / 0.7) vortex:SetRotation(-t * 8) local vs = 128 + 640 * easeOut(v) vortex:SetSize(vs, vs) vortex:SetAlpha(0.6 * (1 - v)) local pt = clamp(t / 0.8) local dist = (350 + 40 * combo) * easeOut(pt) for _, p in ipairs(particles) do p:ClearAllPoints() p:SetPoint("CENTER", f, "CENTER", math.cos(p.angle) * dist, 120 + math.sin(p.angle) * dist) p:SetRotation(t * 10) p:SetAlpha(1 - pt) end -- Slam in, hold with a throb and shake, then blow out. local scale, alpha local outStart = duration - 0.3 if t < 0.12 then local x = 1 - t / 0.12 scale, alpha = 1 + 3 * x * x, 1 - x elseif t < outStart then scale, alpha = 1 + 0.06 * math.sin(t * 30), 1 else local x = clamp((t - outStart) / 0.3) scale, alpha = 1 + 0.8 * x, 1 - x end scale = scale * (1 + 0.08 * math.min(combo - 1, 5)) title:SetScale(scale) title:SetAlpha(alpha) title:ClearAllPoints() title:SetPoint("CENTER", f, "CENTER", jitter(shake) / scale, (120 + jitter(shake)) / scale) local g = 3 + combo ghostRed:ClearAllPoints() ghostRed:SetPoint("CENTER", jitter(g), jitter(g)) ghostCyan:ClearAllPoints() ghostCyan:SetPoint("CENTER", jitter(g), jitter(g)) comboText:SetAlpha(alpha) comboText:ClearAllPoints() comboText:SetPoint("CENTER", f, "CENTER", jitter(shake / 2), 40 + jitter(shake / 2)) end f:SetScript("OnUpdate", function(self, elapsed) t = t + elapsed if t >= duration then self:Hide() return end render() end) local function play() local now = GetTime() combo = (now - lastProc <= COMBO_WINDOW) and combo + 1 or 1 lastProc = now t = 0 duration = SHOW_TIME + 0.1 * math.min(combo - 1, 5) if combo >= 2 then comboText:SetText(string.format("%s x%d", COMBO_TEXT[combo] or COMBO_MAX_TEXT, combo)) comboText:Show() else comboText:Hide() end render() f:Show() if db.sound then PlaySound(SOUND_PROC, "Master") if combo >= 3 then PlaySound(SOUND_COMBO, "Master") end end end -- Events -------------------------------------------------------------------- local function isWindfury(name) if name == nil or secret(name) then return true end db.names[name] = (db.names[name] or 0) + 1 return name:find("Windfury") ~= nil end local events = CreateFrame("Frame") events:RegisterEvent("ADDON_LOADED") events:SetScript("OnEvent", function(self, event, arg1) if event == "ADDON_LOADED" then if arg1 ~= "Windfury" then return end WindfuryDB = WindfuryDB or {} db = WindfuryDB if db.enabled == nil then db.enabled = true end if db.sound == nil then db.sound = true end db.procs = db.procs or 0 -- Every combat text type seen, and readable extra attack names, so a -- silent addon can be diagnosed from SavedVariables. db.types = db.types or {} db.names = db.names or {} self:UnregisterEvent("ADDON_LOADED") self:RegisterEvent("COMBAT_TEXT_UPDATE") return end if arg1 == nil or secret(arg1) then return end db.types[arg1] = (db.types[arg1] or 0) + 1 if arg1 ~= "EXTRA_ATTACKS" or not db.enabled then return end if not isWindfury((C_CombatText.GetCurrentEventInfo())) then return end db.procs = db.procs + 1 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. -- A cast named "Windfury Attack" fires the show right away. local function count(t, key) t[key] = (t[key] or 0) + 1 end local function readable(v) return v ~= nil and not secret(v) end local debug = CreateFrame("Frame") debug:RegisterEvent("PLAYER_LOGIN") debug:SetScript("OnEvent", function(self, event, unit, a2, a3) if event == "PLAYER_LOGIN" then db.debug = { fct = C_CVar.GetCVarBool("enableFloatingCombatText"), casts = {}, auras = {} } self:RegisterUnitEvent("UNIT_SPELLCAST_SUCCEEDED", "player") self:RegisterUnitEvent("UNIT_AURA", "player") return end if event == "UNIT_SPELLCAST_SUCCEEDED" then local id = a3 if not readable(id) then count(db.debug.casts, "secret"); return end local name = C_Spell.GetSpellName(id) if not readable(name) then name = "?" end count(db.debug.casts, id .. " " .. name) if db.enabled and name == "Windfury Attack" then db.procs = db.procs + 1 play() end elseif event == "UNIT_AURA" then local info = a2 if not readable(info) or not info.addedAuras then return end for _, aura in ipairs(info.addedAuras) do local id, name = aura.spellId, aura.name if readable(id) and readable(name) then count(db.debug.auras, id .. " " .. name) else count(db.debug.auras, "secret") end end end end) -- Slash command ------------------------------------------------------------- local function say(msg) print("|cff66ccffWindfury!|r " .. msg) end SLASH_WINDFURY1 = "/wf" SlashCmdList.WINDFURY = function(msg) msg = (msg or ""):lower():gsub("^%s+", ""):gsub("%s+$", "") if msg == "on" or msg == "off" then db.enabled = msg == "on" say(db.enabled and "on." or "off.") elseif msg == "sound on" or msg == "sound off" then db.sound = msg == "sound on" say(db.sound and "sound on." or "sound off.") else play() say(string.format("%s, sound %s, %d procs so far. /wf on|off, /wf sound on|off", db.enabled and "on" or "off", db.sound and "on" or "off", db.procs)) if not C_CVar.GetCVarBool("enableFloatingCombatText") then say("If procs never show, turn on Options > Combat > Scrolling Combat Text.") end end end