Johnny C. Lam [12-13-12 - 03:51]
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
--</private-static-properties>
@@ -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")
--<private-static-properties>
-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
--</public-static-methods>
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
}
}