From 9d5f357dd2dd674ab83fbe08773e26447280df81 Mon Sep 17 00:00:00 2001 From: "Johnny C. Lam" Date: Thu, 13 Dec 2012 03:51:53 +0000 Subject: [PATCH] Print aura and spell lists alphabetically as suggested in ticket 188. git-svn-id: svn://svn.curseforge.net/wow/ovale/mainline/trunk@660 d5049fe3-3747-40f7-a4b5-f36d6801af5f --- Ovale.lua | 12 +++++++++--- OvaleData.lua | 15 +++++++++++++-- OvaleOptions.lua | 4 +--- 3 files changed, 23 insertions(+), 8 deletions(-) diff --git a/Ovale.lua b/Ovale.lua index 7dca23a..f72a138 100644 --- a/Ovale.lua +++ b/Ovale.lua @@ -14,7 +14,7 @@ local L = LibStub("AceLocale-3.0"):GetLocale("Ovale") local Recount = Recount local Skada = Skada -local pairs, strsplit = pairs, string.split +local ipairs, pairs, strsplit, tinsert, tsort = ipairs, pairs, string.split, table.insert, table.sort local SendAddonMessage, UnitAura, UnitCanAttack = SendAddonMessage, UnitAura, UnitCanAttack local UnitExists, UnitHasVehicleUI, UnitIsDead = UnitExists, UnitHasVehicleUI, UnitIsDead -- @@ -74,16 +74,22 @@ function Ovale:Debug() self:Print(OvaleCompile:DebugNode(self.masterNodes[1])) 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, rank, icon, count, debuffType, duration, expirationTime, unitCaster, isStealable, shouldConsolidate, spellId = UnitAura(target, i, filter) + local name, _, _, _, _, _, _, _, _, _, spellId = UnitAura(target, i, filter) if not name then break end - Ovale:Print(name..": "..spellId) + tinsert(array, name .. ": " .. spellId) i = i + 1 end + tsort(array) + for _, v in ipairs(array) do + Ovale:Print(v) + end end function Ovale:CompileAll() diff --git a/OvaleData.lua b/OvaleData.lua index 2e7c08f..95a6ea4 100644 --- a/OvaleData.lua +++ b/OvaleData.lua @@ -10,7 +10,7 @@ OvaleData = LibStub("AceAddon-3.0"):NewAddon("OvaleData", "AceEvent-3.0") -- -local pairs, tonumber, tostring = pairs, tonumber, tostring +local ipairs, pairs, tinsert, tonumber, tostring, tsort = ipairs, pairs, table.insert, tonumber, tostring, table.sort local GetShapeshiftForm, GetSpellBookItemInfo, GetSpellBookItemName = GetShapeshiftForm, GetSpellBookItemInfo, GetSpellBookItemName local GetSpellInfo, GetSpellTabInfo, GetTalentInfo = GetSpellInfo, GetSpellTabInfo, GetTalentInfo local HasPetSpells, UnitBuff, UnitClass = HasPetSpells, UnitBuff, UnitClass @@ -511,7 +511,6 @@ function OvaleData:GetGCD(spellId) end end - --Compute the spell Cooldown function OvaleData:GetComputedSpellCD(spellId) local actionCooldownStart, actionCooldownDuration, actionEnable @@ -604,4 +603,16 @@ function OvaleData:GetTickLength(spellId, spellHaste) return nil end end + +-- Print out the list of known spells in alphabetical order. +function OvaleData:DebugSpellList() + local array = {} + for k, v in pairs(self.spellList) do + tinsert(array, v .. ": " .. k) + end + tsort(array) + for _, v in ipairs(array) do + Ovale:Print(v) + end +end -- diff --git a/OvaleOptions.lua b/OvaleOptions.lua index a254032..a1cc6c1 100644 --- a/OvaleOptions.lua +++ b/OvaleOptions.lua @@ -439,9 +439,7 @@ local options = name = "List player spells", type = "execute", func = function() - for k,v in pairs(OvaleData.spellList) do - Ovale:Print(k ..":" .. v) - end + OvaleData:DebugSpellList() end } } -- 1.7.9.5