From 925b6729a2934c36e70c466d64b40f922e0da4b8 Mon Sep 17 00:00:00 2001 From: "Johnny C. Lam" Date: Sat, 23 Mar 2013 21:37:51 +0000 Subject: [PATCH] Move debug method to dump unit auras to OvaleAura. git-svn-id: svn://svn.curseforge.net/wow/ovale/mainline/trunk@812 d5049fe3-3747-40f7-a4b5-f36d6801af5f --- Ovale.lua | 22 ---------------------- OvaleAura.lua | 20 ++++++++++++++++++++ OvaleOptions.lua | 13 +++++++------ 3 files changed, 27 insertions(+), 28 deletions(-) diff --git a/Ovale.lua b/Ovale.lua index ec3bf9a..7856a61 100644 --- a/Ovale.lua +++ b/Ovale.lua @@ -14,16 +14,12 @@ local Ovale = LibStub("AceAddon-3.0"):NewAddon(addonNamespace, "Ovale", "AceCons local L = LibStub("AceLocale-3.0"):GetLocale("Ovale") local OvaleOptions = nil -local ipairs = ipairs local pairs = pairs local strsplit = string.split -local tinsert = table.insert -local tsort = table.sort local wipe = table.wipe local API_GetTime = GetTime local API_RegisterAddonMessagePrefix = RegisterAddonMessagePrefix local API_SendAddonMessage = SendAddonMessage -local API_UnitAura = UnitAura local API_UnitCanAttack = UnitCanAttack local API_UnitExists = UnitExists local API_UnitHasVehicleUI = UnitHasVehicleUI @@ -76,24 +72,6 @@ function Ovale:DebugPrint(flag, ...) end end --- Print the auras matching the filter on the target in alphabetical order. -function Ovale:DebugListAura(target, filter) - local i = 1 - local array = {} - while true do - local name, _, _, _, _, _, _, _, _, _, spellId = API_UnitAura(target, i, filter) - if not name then - break - end - tinsert(array, name .. ": " .. spellId) - i = i + 1 - end - tsort(array) - for _, v in ipairs(array) do - Ovale:Print(v) - end -end - function Ovale:OnEnable() -- Called when the addon is enabled API_RegisterAddonMessagePrefix("Ovale") diff --git a/OvaleAura.lua b/OvaleAura.lua index 78c0194..aeb41fe 100644 --- a/OvaleAura.lua +++ b/OvaleAura.lua @@ -20,9 +20,12 @@ local OvaleGUID = Ovale.OvaleGUID local OvalePaperDoll = Ovale.OvalePaperDoll local OvalePool = Ovale.OvalePool +local ipairs = ipairs local pairs = pairs local select = select local strfind = string.find +local tinsert = table.insert +local tsort = table.sort local API_IsHarmfulSpell = IsHarmfulSpell local API_UnitAura = UnitAura @@ -414,4 +417,21 @@ function OvaleAura:Debug() end end end + +-- Print the auras matching the filter on the unit in alphabetical order. +function OvaleAura:DebugListAura(unitId, filter) + local guid = OvaleGUID:GetGUID(unitId) + if self_aura[guid] and self_aura[guid][filter] then + local array = {} + for spellId, whoseTable in pairs(self_aura[guid][filter]) do + for whose, aura in pairs(whoseTable) do + tinsert(array, aura.name .. ": " .. spellId) + end + end + tsort(array) + for _, v in ipairs(array) do + Ovale:Print(v) + end + end +end -- diff --git a/OvaleOptions.lua b/OvaleOptions.lua index 80a169b..0001e90 100644 --- a/OvaleOptions.lua +++ b/OvaleOptions.lua @@ -15,6 +15,7 @@ Ovale.OvaleOptions = OvaleOptions -- local L = Ovale.L +local OvaleAura = Ovale.OvaleAura local OvaleData = Ovale.OvaleData local OvalePaperDoll = Ovale.OvalePaperDoll local OvaleScripts = Ovale.OvaleScripts @@ -471,21 +472,21 @@ local self_options = targetbuff = { order = -5, - name = "List target buff and debuff spell id", + name = "List target buffs and debuffs", type = "execute", func = function() - Ovale:DebugListAura("target", "HELPFUL") - Ovale:DebugListAura("target", "HARMFUL") + OvaleAura:DebugListAura("target", "HELPFUL") + OvaleAura:DebugListAura("target", "HARMFUL") end }, buff = { order = -6, - name = "List player buff and debuff spell id", + name = "List player buffs and debuffs", type = "execute", func = function() - Ovale:DebugListAura("player", "HELPFUL") - Ovale:DebugListAura("player", "HARMFUL") + OvaleAura:DebugListAura("player", "HELPFUL") + OvaleAura:DebugListAura("player", "HARMFUL") end }, glyph = -- 1.7.9.5