From bf46edded6e41eae50fd26ada91753e9097648ba Mon Sep 17 00:00:00 2001 From: "Johnny C. Lam" Date: Fri, 19 Jul 2013 05:33:17 +0000 Subject: [PATCH] Push more debugging output out of OvaleOptions into the relevant modules. git-svn-id: svn://svn.curseforge.net/wow/ovale/mainline/trunk@976 d5049fe3-3747-40f7-a4b5-f36d6801af5f --- Ovale.toc | 2 +- OvaleData.lua | 35 ++++++++++++++++++++++++----------- OvaleOptions.lua | 37 ++++++++++++++++++------------------- OvaleState.lua | 7 +++++++ 4 files changed, 50 insertions(+), 31 deletions(-) diff --git a/Ovale.toc b/Ovale.toc index 26d5f99..8a4c9eb 100644 --- a/Ovale.toc +++ b/Ovale.toc @@ -60,6 +60,7 @@ OvaleSwing.lua # OvaleAura.lua OvaleComboPoints.lua +OvaleOptions.lua # OvaleFuture.lua # @@ -67,7 +68,6 @@ OvaleDamageTaken.lua OvaleState.lua # OvaleCondition.lua -OvaleOptions.lua # OvaleBestAction.lua OvaleCompile.lua diff --git a/OvaleData.lua b/OvaleData.lua index 8ad7225..f85ff5b 100644 --- a/OvaleData.lua +++ b/OvaleData.lua @@ -442,17 +442,6 @@ function OvaleData:UpdateGlyphs() self:SendMessage("Ovale_GlyphsChanged") end -function OvaleData:DebugGlyphs() - local array = {} - for glyphId in pairs(self.glyphs) do - tinsert(array, self:GetSpellName(glyphId) .. ": " .. glyphId) - end - tsort(array) - for _, v in ipairs(array) do - Ovale:Print(v) - end -end - function OvaleData:ResetSpellInfo() self.spellInfo = {} end @@ -613,6 +602,18 @@ function OvaleData:GetTickLength(spellId) end end +-- Print out the list of active glyphs in alphabetical order. +function OvaleData:DebugGlyphs() + local array = {} + for glyphId in pairs(self.glyphs) do + tinsert(array, self:GetSpellName(glyphId) .. ": " .. glyphId) + end + tsort(array) + for _, v in ipairs(array) do + Ovale:Print(v) + end +end + -- Print out the list of known spells in alphabetical order. function OvaleData:DebugSpellList() local array = {} @@ -624,4 +625,16 @@ function OvaleData:DebugSpellList() Ovale:Print(v) end end + +-- Print out the list of talents in alphabetical order. +function OvaleData:DebugTalents() + local array = {} + for name, id in pairs(self.talentNameToId) do + tinsert(array, name .. " = " .. id) + end + tsort(array) + for _, v in ipairs(array) do + Ovale:Print(v) + end +end -- diff --git a/OvaleOptions.lua b/OvaleOptions.lua index 502264d..2322fce 100644 --- a/OvaleOptions.lua +++ b/OvaleOptions.lua @@ -15,12 +15,8 @@ Ovale.OvaleOptions = OvaleOptions -- local L = Ovale.L -local OvaleAura = Ovale.OvaleAura -local OvaleData = Ovale.OvaleData local OvalePaperDoll = Ovale.OvalePaperDoll local OvaleScripts = Ovale.OvaleScripts -local OvaleStance = Ovale.OvaleStance -local OvaleState = Ovale.OvaleState local strgmatch = string.gmatch local strgsub = string.gsub @@ -535,9 +531,8 @@ local self_options = order = -3, name = "Power", type = "execute", - func = function() - for i=1,10 do Ovale:Print(i.."="..UnitPower("player", i)) end - Ovale:Print(OvaleState.state.eclipse) + func = function() + if Ovale.OvaleState then Ovale.OvaleState:DebugPower() end end }, talent = @@ -545,10 +540,8 @@ local self_options = order = -4, name = "List talent id", type = "execute", - func = function() - for k,v in pairs(OvaleData.talentNameToId) do - Ovale:Print(k.."="..v) - end + func = function() + if Ovale.OvaleData then Ovale.OvaleData:DebugTalents() end end }, targetbuff = @@ -557,8 +550,11 @@ local self_options = name = "List target buffs and debuffs", type = "execute", func = function() - OvaleAura:DebugListAura("target", "HELPFUL") - OvaleAura:DebugListAura("target", "HARMFUL") + local OvaleAura = Ovale.OvaleAura + if OvaleAura then + OvaleAura:DebugListAura("target", "HELPFUL") + OvaleAura:DebugListAura("target", "HARMFUL") + end end }, buff = @@ -567,8 +563,11 @@ local self_options = name = "List player buffs and debuffs", type = "execute", func = function() - OvaleAura:DebugListAura("player", "HELPFUL") - OvaleAura:DebugListAura("player", "HARMFUL") + local OvaleAura = Ovale.OvaleAura + if OvaleAura then + OvaleAura:DebugListAura("player", "HELPFUL") + OvaleAura:DebugListAura("player", "HARMFUL") + end end }, glyph = @@ -577,7 +576,7 @@ local self_options = name = "List player glyphs", type = "execute", func = function() - OvaleData:DebugGlyphs() + if Ovale.OvaleData then Ovale.OvaleData:DebugGlyphs() end end }, spell = @@ -586,8 +585,8 @@ local self_options = name = "List player spells", type = "execute", func = function() - OvaleData:DebugSpellList() - end + if Ovale.OvaleData then Ovale.OvaleData:DebugSpellList() end + end }, stance = { @@ -595,7 +594,7 @@ local self_options = name = "List stances", type = "execute", func = function() - OvaleStance:DebugStances() + if Ovale.OvaleStance then Ovale.OvaleStance:DebugStances() end end }, } diff --git a/OvaleState.lua b/OvaleState.lua index 14f71fc..56b1faa 100644 --- a/OvaleState.lua +++ b/OvaleState.lua @@ -759,4 +759,11 @@ function OvaleState:GetRunesCooldown(blood, frost, unholy, death, nodeath) end return maxCD end + +-- Print out the levels of each power type in the current state. +function OvaleState:DebugPower() + for powerType in pairs(OvaleData.power) do + Ovale:FormatPrint("%s = %d", powerType, self.state[powerType]) + end +end -- -- 1.7.9.5