diff --git a/MaelstromAlert/MaelstromAlert.lua b/MaelstromAlert/MaelstromAlert.lua new file mode 100644 index 0000000..cbfe0fc --- /dev/null +++ b/MaelstromAlert/MaelstromAlert.lua @@ -0,0 +1,263 @@ +-- Maelstrom Alert: a big pulsing Maelstrom Weapon icon with a chime when it +-- reaches 5 stacks, gone again when they're spent. +-- +-- Aura data turns secret in combat unless Blizzard flags the buff as never +-- secret, and then the stacks can't be read. While they can't, three signals +-- stand in: the "Maelstrom Ready" combat text (type SPELL_ACTIVE, whose text +-- is secret in combat but whose type isn't; a shaman has no other reactive +-- spell), the proc overlay, and the glow on the spells 5 stacks make instant. +-- The combat text has no "gone" event, so casting one of those spells or +-- READY_TIME passing clears it. MaelstromAlertDB.log counts which sources +-- were seen, so a silent addon can be diagnosed from SavedVariables. + +local NAME = "Maelstrom Weapon" +local STACKS = 5 +local POLL = 0.1 +local PREVIEW = 3 +local READY_TIME = 30 -- how long the buff lasts, for the combat text signal +local ICON = "Interface\\Icons\\Spell_Shaman_MaelstromWeapon" +local SOUND = (SOUNDKIT and SOUNDKIT.ALARM_CLOCK_WARNING_3) or 12889 +-- Spells 5 stacks make instant: their glow means ready, casting one spends it. +local SPENDERS = { + ["Lightning Bolt"] = true, ["Chain Lightning"] = true, ["Healing Wave"] = true, + ["Lesser Healing Wave"] = true, ["Chain Heal"] = true, +} + +local function secret(v) return issecretvalue ~= nil and issecretvalue(v) end +local function readable(v) return v ~= nil and not secret(v) end +local function count(t, k) t[k] = (t[k] or 0) + 1 end + +local db +local st = { + shaman = false, + stacks = nil, -- readable stack count, 0 = no buff, nil = can't tell + overlay = false, -- Maelstrom proc overlay showing + glow = {}, -- glowing spell IDs from GLOW_SPELLS + textUntil = 0, -- "Maelstrom Ready" combat text seen, counts until then + ready = false, + previewUntil = 0, +} + +-- Reading ------------------------------------------------------------------- + +local function spellName(id) + if not readable(id) or not C_Spell or not C_Spell.GetSpellName then return nil end + local n = C_Spell.GetSpellName(id) + return readable(n) and n or nil +end + +local function aurasSecret() + if not C_Secrets then return false end + if db.spellID then + local ok, s = pcall(C_Secrets.ShouldSpellAuraBeSecret, db.spellID) + if ok and readable(s) then return s end + end + local ok, s = pcall(C_Secrets.ShouldAurasBeSecret) + return ok and readable(s) and s or false +end + +local function readStacks() + local ok, aura = pcall(C_UnitAuras.GetAuraDataBySpellName, "player", NAME, "HELPFUL") + if not ok then return nil end + if aura == nil then + -- No answer means no buff, unless auras are secret right now. + if aurasSecret() then return nil end + return 0 + end + if not readable(aura) or not readable(aura.applications) then return nil end + if readable(aura.spellId) and db.spellID ~= aura.spellId then + db.spellID = aura.spellId + if C_Secrets and C_Secrets.GetSpellAuraSecrecy then + local ok2, lvl = pcall(C_Secrets.GetSpellAuraSecrecy, aura.spellId) + if ok2 and readable(lvl) then db.log.secrecy = lvl end -- 0 never, 1 always, 2 contextually + end + end + if readable(aura.icon) then db.icon = aura.icon end + return math.max(aura.applications, 1) +end + +-- Display ------------------------------------------------------------------- + +local f = CreateFrame("Frame", "MaelstromAlertFrame", UIParent) +f:SetSize(72, 72) +f:SetFrameStrata("HIGH") +f:SetMovable(true) +f:SetClampedToScreen(true) +f:EnableMouse(false) +f:RegisterForDrag("LeftButton") +f:Hide() + +local glow = f:CreateTexture(nil, "BACKGROUND") +glow:SetTexture("Interface\\Buttons\\UI-ActionButton-Border") +glow:SetBlendMode("ADD") +glow:SetVertexColor(0.45, 0.6, 1) +glow:SetSize(170, 170) +glow:SetPoint("CENTER") + +local icon = f:CreateTexture(nil, "ARTWORK") +icon:SetAllPoints() +icon:SetTexCoord(0.07, 0.93, 0.07, 0.93) + +local label = f:CreateFontString(nil, "OVERLAY") +label:SetFont(STANDARD_TEXT_FONT, 24, "THICKOUTLINE") +label:SetTextColor(0.75, 0.85, 1) +label:SetPoint("TOP", f, "BOTTOM", 0, -6) + +local function place() + f:ClearAllPoints() + local p = db.point + if p then f:SetPoint(p[1], UIParent, p[2], p[3], p[4]) else f:SetPoint("CENTER", UIParent, "CENTER", 0, 90) end +end + +f:SetScript("OnDragStart", function(self) self:StartMoving() end) +f:SetScript("OnDragStop", function(self) + self:StopMovingOrSizing() + local p, _, rp, x, y = self:GetPoint() + db.point = { p, rp, x, y } +end) + +local t = 0 +f:SetScript("OnUpdate", function(self, elapsed) + t = t + elapsed + -- Slam in over 0.15s, then throb. + local scale = t < 0.15 and 1 + 0.8 * (1 - t / 0.15) or 1 + 0.05 * math.sin(t * 12) + self:SetScale(scale) + glow:SetAlpha(0.55 + 0.45 * math.sin(t * 12)) +end) + +local function render(ready, preview) + if ready or preview or (db and db.moving) then + if not f:IsShown() then t = 0 end + icon:SetTexture(db.icon or ICON) + label:SetText(st.stacks and st.stacks >= STACKS and ("MAELSTROM " .. st.stacks) or "MAELSTROM") + f:Show() + else + f:Hide() + end +end + +-- State --------------------------------------------------------------------- + +local function update() + if not db then return end + st.stacks = readStacks() + if st.stacks == 0 then st.textUntil = 0 end + local ready + if not db.enabled or not st.shaman or UnitIsDeadOrGhost("player") then + ready = false + elseif st.stacks ~= nil then + ready = st.stacks >= STACKS + else + ready = st.overlay or next(st.glow) ~= nil or GetTime() < st.textUntil + end + if InCombatLockdown() then + count(db.log.reads, st.stacks == nil and "secret" or (st.stacks == 0 and "none" or "readable")) + end + if ready and not st.ready then + db.procs = db.procs + 1 + if db.sound then PlaySound(SOUND, "Master") end + end + st.ready = ready + render(ready, GetTime() < st.previewUntil) +end + +-- Events -------------------------------------------------------------------- + +local ev = CreateFrame("Frame") +ev:RegisterEvent("ADDON_LOADED") +ev:SetScript("OnEvent", function(self, event, a1, _, a3) + if event == "ADDON_LOADED" then + if a1 ~= "MaelstromAlert" then return end + MaelstromAlertDB = MaelstromAlertDB or {} + db = MaelstromAlertDB + if db.enabled == nil then db.enabled = true end + if db.sound == nil then db.sound = true end + db.procs = db.procs or 0 + db.log = db.log or {} + db.log.reads = db.log.reads or {} + db.log.overlays = db.log.overlays or {} + db.log.glows = db.log.glows or {} + db.log.text = db.log.text or {} + db.moving = nil + place() + self:UnregisterEvent("ADDON_LOADED") + for _, e in ipairs({ "PLAYER_ENTERING_WORLD", "PLAYER_DEAD", "COMBAT_TEXT_UPDATE", + "SPELL_ACTIVATION_OVERLAY_SHOW", "SPELL_ACTIVATION_OVERLAY_HIDE", + "SPELL_ACTIVATION_OVERLAY_GLOW_SHOW", "SPELL_ACTIVATION_OVERLAY_GLOW_HIDE" }) do + pcall(self.RegisterEvent, self, e) + end + self:RegisterUnitEvent("UNIT_AURA", "player") + self:RegisterUnitEvent("UNIT_SPELLCAST_SUCCEEDED", "player") + local acc = 0 + self:SetScript("OnUpdate", function(_, elapsed) + acc = acc + elapsed + if acc >= POLL then acc = 0; update() end + end) + return + end + if event == "PLAYER_ENTERING_WORLD" then + st.shaman = select(2, UnitClass("player")) == "SHAMAN" + st.overlay, st.glow, st.textUntil = false, {}, 0 + elseif event == "PLAYER_DEAD" then + st.overlay, st.glow, st.textUntil = false, {}, 0 + elseif event == "COMBAT_TEXT_UPDATE" then + if not readable(a1) or a1 ~= "SPELL_ACTIVE" then return end + local text = C_CombatText.GetCurrentEventInfo() + if readable(text) then + count(db.log.text, text) + if not text:find("Maelstrom", 1, true) then return end + else + count(db.log.text, "secret") + end + st.textUntil = GetTime() + READY_TIME + elseif event == "UNIT_SPELLCAST_SUCCEEDED" then + local name = spellName(a3) + if not (name and SPENDERS[name]) then return end + st.textUntil = 0 + elseif event == "SPELL_ACTIVATION_OVERLAY_SHOW" or event == "SPELL_ACTIVATION_OVERLAY_HIDE" then + local name = spellName(a1) + if event == "SPELL_ACTIVATION_OVERLAY_SHOW" then count(db.log.overlays, readable(a1) and (a1 .. " " .. (name or "?")) or "secret") end + if a1 == nil then st.overlay = false -- hide with no spell = all overlays gone + elseif readable(a1) and (name == NAME or a1 == db.spellID) then + st.overlay = event == "SPELL_ACTIVATION_OVERLAY_SHOW" + end + elseif event == "SPELL_ACTIVATION_OVERLAY_GLOW_SHOW" or event == "SPELL_ACTIVATION_OVERLAY_GLOW_HIDE" then + local name = spellName(a1) + if event == "SPELL_ACTIVATION_OVERLAY_GLOW_SHOW" then count(db.log.glows, readable(a1) and (a1 .. " " .. (name or "?")) or "secret") end + if readable(a1) and name and SPENDERS[name] then + st.glow[a1] = event == "SPELL_ACTIVATION_OVERLAY_GLOW_SHOW" or nil + end + end + update() +end) + +-- Slash command ------------------------------------------------------------- + +local function say(msg) print("|cff7799ffMaelstrom Alert|r " .. msg) end + +SLASH_MAELSTROMALERT1 = "/mw" +SlashCmdList.MAELSTROMALERT = 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.") + elseif msg == "move" then + db.moving = not db.moving + f:EnableMouse(db.moving) + say(db.moving and "drag it, then /mw move again." or "locked.") + elseif msg == "reset" then + db.point = nil + place() + say("position reset.") + else + st.previewUntil = GetTime() + PREVIEW + if db.sound then PlaySound(SOUND, "Master") end + say(string.format("%s, sound %s, %d procs. Stacks: %s. /mw on|off, sound on|off, move, reset", + db.enabled and "on" or "off", db.sound and "on" or "off", db.procs, + st.stacks == nil and "hidden" or tostring(st.stacks))) + end + update() +end diff --git a/MaelstromAlert/MaelstromAlert.toc b/MaelstromAlert/MaelstromAlert.toc new file mode 100644 index 0000000..c48c4cd --- /dev/null +++ b/MaelstromAlert/MaelstromAlert.toc @@ -0,0 +1,7 @@ +## Interface: 16001 +## Title: Maelstrom Alert +## Notes: Lights up at 5 stacks of Maelstrom Weapon. +## Version: 1.0 +## SavedVariables: MaelstromAlertDB + +MaelstromAlert.lua diff --git a/README.md b/README.md index 2c7792a..947018b 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # WoW Forever addons -Ten small addons for WoW Forever (client 1.60.1, Interface 16001). +Eleven small addons for WoW Forever (client 1.60.1, Interface 16001). | Addon | What it does | Check command | | --- | --- | --- | @@ -14,10 +14,11 @@ Ten small addons for WoW Forever (client 1.60.1, Interface 16001). | 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` | | Windfury! | Every Windfury proc slams a huge "WINDFURY!" onto the screen with a lightning flash, a storm glow, a burst of Windfury icons and a raid warning horn. Procs within 8 seconds build a combo that gets bigger and shakier. | `/wf` plays it once, `/wf on`, `/wf off`, `/wf sound on`, `/wf sound off` | | Windfury Reminder | A pulsing Windfury icon at the top of the screen while your shaman's main hand has no Windfury, from Windfury Weapon or Windfury Totem, with a horn when a fight starts without it. Counts down the last 30 seconds of Windfury Weapon. Hidden in rest areas out of combat, while dead and on flights. | `/wfr` previews and shows status, `/wfr on`, `/wfr off`, `/wfr sound on`, `/wfr sound off`, `/wfr move`, `/wfr reset` | +| Maelstrom Alert | A big pulsing Maelstrom Weapon icon and a chime at 5 stacks, gone once you spend them. | `/mw` previews and shows status, `/mw on`, `/mw off`, `/mw sound on`, `/mw sound off`, `/mw move`, `/mw reset` | ## Install -Copy the ten addon folders into `World of Warcraft/_forever_/Interface/AddOns/`, then type `/reload` in game. +Copy the eleven addon folders into `World of Warcraft/_forever_/Interface/AddOns/`, then type `/reload` in game. Each addon works on its own, so copy only the ones you want. Vendor Flag and Quest Shopping List stay disabled unless Auctionator is installed. ## Known limits @@ -33,6 +34,7 @@ Each addon works on its own, so copy only the ones you want. Vendor Flag and Que - 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. 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. - Windfury Reminder spots Windfury by the "Windfury" line on the main hand tooltip, so it needs an English client. It checks the main hand only. +- Maelstrom Alert can only read the stack count out of combat, since Forever hides buff details in combat. In combat it goes by the "Maelstrom Ready" combat text, the proc overlay and the glow on Lightning Bolt and the heals. Those need Scrolling Combat Text on. A "Maelstrom Ready" that is never spent clears after 30 seconds. ## Tests @@ -50,6 +52,7 @@ lua tests/test_fk.lua FishKey/FishKey.lua lua tests/test_ff.lua FlightFinder lua tests/test_wf.lua Windfury/Windfury.lua lua tests/test_wfr.lua WindfuryReminder/WindfuryReminder.lua +lua tests/test_mw.lua MaelstromAlert/MaelstromAlert.lua ``` ## Regenerating Dungeon Pre-Quest's data diff --git a/tests/test_mw.lua b/tests/test_mw.lua new file mode 100644 index 0000000..b0070a8 --- /dev/null +++ b/tests/test_mw.lua @@ -0,0 +1,209 @@ +-- Runs MaelstromAlert.lua against a mock of the WoW API. +-- arg[1] = addon file + +local clock = 100 +function GetTime() return clock end +STANDARD_TEXT_FONT = "Fonts\\FRIZQT__.TTF" +SOUNDKIT = { ALARM_CLOCK_WARNING_3 = 12889 } +local sounds = 0 +function PlaySound(id, channel) assert(id == 12889 and channel == "Master"); sounds = sounds + 1 end +local secrets = {} +function issecretvalue(v) return secrets[v] == true end +local function newSecret() local s = {}; secrets[s] = true; return s end +local printed = {} +function print(s) printed[#printed + 1] = s end +SlashCmdList = {} + +local class, dead, combat = "SHAMAN", false, false +local aura -- nil = no buff; table = buff +local aurasSecret = false +local ctText -- what C_CombatText.GetCurrentEventInfo returns +function UnitClass() return "Shaman", class end +function UnitIsDeadOrGhost() return dead end +function InCombatLockdown() return combat end +local names = { [403] = "Lightning Bolt", [421] = "Chain Lightning", [8004] = "Lesser Healing Wave", + [408505] = "Maelstrom Weapon", [17364] = "Stormstrike", [16246] = "Clearcasting" } +C_Spell = { GetSpellName = function(id) return names[id] end } +C_UnitAuras = { GetAuraDataBySpellName = function(unit, name, filter) + assert(unit == "player" and name == "Maelstrom Weapon" and filter == "HELPFUL") + if aurasSecret then return nil end -- RequiresNonSecretAura: no values + return aura +end } +C_Secrets = { + ShouldAurasBeSecret = function() return aurasSecret end, + ShouldSpellAuraBeSecret = function(id) assert(id == 408505); return aurasSecret end, + GetSpellAuraSecrecy = function() return 2 end, +} +C_CombatText = { GetCurrentEventInfo = function() return ctText end } + +local frames = {} +local function region() + local r = { shown = true, alpha = 1, scale = 1 } + function r:Show() self.shown = true end + function r:Hide() self.shown = false end + function r:IsShown() return self.shown end + function r:SetText(t) self.text = t end + function r:SetTexture(t) self.texture = t end + function r:SetScale(s) assert(s > 0); self.scale = s end + function r:SetAlpha(a) assert(a >= -1e-9 and a <= 1 + 1e-9); self.alpha = a end + function r:EnableMouse(m) self.mouse = m end + function r:GetPoint() return "CENTER", UIParent, "CENTER", 0, 50 end + local noop = function() end + for _, k in ipairs({ "SetPoint", "ClearAllPoints", "SetAllPoints", "SetSize", "SetBlendMode", "SetVertexColor", + "SetFont", "SetTextColor", "SetFrameStrata", "SetMovable", "SetClampedToScreen", "RegisterForDrag", + "SetTexCoord", "StartMoving", "StopMovingOrSizing" }) do + r[k] = r[k] or noop + end + return r +end +local fontStrings = {} +function CreateFrame(_, name) + local fr = region() + fr.scripts, fr.events = {}, {} + function fr:SetScript(k, fn) self.scripts[k] = fn end + function fr:RegisterEvent(e) self.events[e] = true end + function fr:RegisterUnitEvent(e) self.events[e] = true end + function fr:UnregisterEvent(e) self.events[e] = nil end + function fr:CreateTexture() return region() end + function fr:CreateFontString() local s = region(); fontStrings[#fontStrings + 1] = s; return s end + frames[#frames + 1] = fr + if name then _G[name] = fr end + return fr +end +UIParent = region() + +dofile(arg[1]) + +local frame = MaelstromAlertFrame +local ev +for _, fr in ipairs(frames) do if fr.events.ADDON_LOADED then ev = fr end end +local label = fontStrings[1] +local function fire(...) ev.scripts.OnEvent(ev, ...) end +local function tick(sec) + for _ = 1, math.floor(sec / 0.1 + 0.5) do + clock = clock + 0.1 + ev.scripts.OnUpdate(ev, 0.1) + if frame.shown then frame.scripts.OnUpdate(frame, 0.1) end + end +end +local function stacks(n) aura = n and { applications = n, spellId = 408505, icon = 136048 } or nil end + +fire("ADDON_LOADED", "Other") +assert(MaelstromAlertDB == nil) +fire("ADDON_LOADED", "MaelstromAlert") +assert(ev.events.COMBAT_TEXT_UPDATE and ev.events.UNIT_SPELLCAST_SUCCEEDED) +fire("PLAYER_ENTERING_WORLD") +tick(0.2) +assert(not frame.shown) + +-- Readable stacks: nothing at 4, alert + one chime at 5, gone when spent. +for n = 1, 4 do stacks(n); tick(0.1) end +assert(not frame.shown and sounds == 0) +stacks(5); tick(0.1) +assert(frame.shown and sounds == 1 and label.text == "MAELSTROM 5", tostring(label.text)) +assert(frame.texture == nil and MaelstromAlertDB.spellID == 408505) +tick(2) +assert(sounds == 1, "chime once") +stacks(nil); tick(0.1) +assert(not frame.shown) + +-- Secret in combat: "Maelstrom Ready" combat text with a secret text. +combat, aurasSecret = true, true +fire("COMBAT_TEXT_UPDATE", "DAMAGE") +ctText = newSecret() +tick(0.1) +assert(not frame.shown) +fire("COMBAT_TEXT_UPDATE", "SPELL_ACTIVE") +assert(frame.shown and sounds == 2 and label.text == "MAELSTROM") +assert(MaelstromAlertDB.log.text.secret == 1) +-- Other casts don't spend it; Lightning Bolt does. +fire("UNIT_SPELLCAST_SUCCEEDED", "player", "guid", 17364) +assert(frame.shown) +fire("UNIT_SPELLCAST_SUCCEEDED", "player", "guid", 403) +assert(not frame.shown) +-- Unspent, it runs out after the buff's 30s. +fire("COMBAT_TEXT_UPDATE", "SPELL_ACTIVE") +tick(29) +assert(frame.shown) +tick(1.2) +assert(not frame.shown) +-- A secret event type is ignored without touching it. +fire("COMBAT_TEXT_UPDATE", newSecret()) +assert(not frame.shown) +-- Readable reactive text that isn't Maelstrom is ignored and logged. +ctText = "Overpower" +fire("COMBAT_TEXT_UPDATE", "SPELL_ACTIVE") +assert(not frame.shown and MaelstromAlertDB.log.text.Overpower == 1) +ctText = "Maelstrom Ready" +fire("COMBAT_TEXT_UPDATE", "SPELL_ACTIVE") +assert(frame.shown) +fire("UNIT_SPELLCAST_SUCCEEDED", "player", "guid", 421) +assert(not frame.shown) + +-- Spell glow on a spender while secret. +fire("SPELL_ACTIVATION_OVERLAY_GLOW_SHOW", 8004) +assert(frame.shown) +fire("SPELL_ACTIVATION_OVERLAY_GLOW_HIDE", 8004) +assert(not frame.shown) +-- Glow on something else doesn't count, but is logged. +fire("SPELL_ACTIVATION_OVERLAY_GLOW_SHOW", 17364) +assert(not frame.shown and MaelstromAlertDB.log.glows["17364 Stormstrike"] == 1) +-- A secret glow ID is skipped. +fire("SPELL_ACTIVATION_OVERLAY_GLOW_SHOW", newSecret()) +assert(not frame.shown and MaelstromAlertDB.log.glows.secret == 1) + +-- Proc overlay for Maelstrom Weapon; a bare hide clears every overlay. +fire("SPELL_ACTIVATION_OVERLAY_SHOW", 16246) +assert(not frame.shown) +fire("SPELL_ACTIVATION_OVERLAY_SHOW", 408505) +assert(frame.shown) +fire("SPELL_ACTIVATION_OVERLAY_HIDE", nil) +assert(not frame.shown) + +-- Back to readable: the aura wins over stale signals. +fire("COMBAT_TEXT_UPDATE", "SPELL_ACTIVE") +assert(frame.shown) +combat, aurasSecret = false, false +stacks(nil); tick(0.1) +assert(not frame.shown, "readable no-buff clears the combat text signal") +aurasSecret = true; tick(0.1) +assert(not frame.shown, "cleared, not just masked") +aurasSecret = false + +-- Combat reads are counted for diagnosis. +assert(MaelstromAlertDB.log.reads.secret > 0) + +-- Death and other classes. +stacks(5); tick(0.1); assert(frame.shown) +dead = true; tick(0.1); assert(not frame.shown); dead = false +class = "WARRIOR"; fire("PLAYER_ENTERING_WORLD"); assert(not frame.shown) +class = "SHAMAN"; fire("PLAYER_ENTERING_WORLD"); assert(frame.shown) +stacks(nil); tick(0.1) + +-- Slash commands. +local before = sounds +SlashCmdList.MAELSTROMALERT("") +assert(frame.shown and sounds == before + 1 and printed[#printed]:find("on, sound on")) +tick(3.2) +assert(not frame.shown, "preview ends") +SlashCmdList.MAELSTROMALERT("off") +stacks(5); tick(0.1) +assert(not frame.shown) +SlashCmdList.MAELSTROMALERT("on") +assert(frame.shown) +stacks(nil); tick(0.1) +SlashCmdList.MAELSTROMALERT("sound off") +before = sounds +stacks(5); tick(0.1) +assert(frame.shown and sounds == before) +stacks(nil); tick(0.1) +SlashCmdList.MAELSTROMALERT("move") +assert(frame.shown and frame.mouse) +frame.scripts.OnDragStop(frame) +assert(MaelstromAlertDB.point[4] == 50) +SlashCmdList.MAELSTROMALERT("move") +assert(not frame.shown and not frame.mouse) +SlashCmdList.MAELSTROMALERT("reset") +assert(MaelstromAlertDB.point == nil) + +io.write("ok\n")