From 4176c153def82cb6a7f618e71c1fad8ff04f8ee4 Mon Sep 17 00:00:00 2001 From: "Johnny C. Lam" Date: Thu, 28 Mar 2013 04:34:56 +0000 Subject: [PATCH] Begin cleanup to allow individual modules to register their own options. git-svn-id: svn://svn.curseforge.net/wow/ovale/mainline/trunk@844 d5049fe3-3747-40f7-a4b5-f36d6801af5f --- OvaleActionBar.lua | 6 ++++-- OvaleAura.lua | 5 +++-- OvaleBestAction.lua | 3 --- OvaleCompile.lua | 10 +++++++--- OvaleEnemies.lua | 8 +++++--- OvaleGUID.lua | 4 +++- 6 files changed, 22 insertions(+), 14 deletions(-) diff --git a/OvaleActionBar.lua b/OvaleActionBar.lua index 451009d..dce4f57 100644 --- a/OvaleActionBar.lua +++ b/OvaleActionBar.lua @@ -24,6 +24,8 @@ local self_actionSpell = {} local self_actionMacro = {} local self_actionItem = {} local self_keybind = {} + +local OVALE_ACTIONBAR_DEBUG = "action_bar" -- -- @@ -49,12 +51,12 @@ function OvaleActionBar:ACTIONBAR_SLOT_CHANGED(event, slot, unknown) elseif (slot) then -- on reçoit aussi si c'est une macro avec mouseover à chaque fois que la souris passe sur une cible! self:FillActionIndex(tonumber(slot)) - Ovale:DebugPrintf("action_bar", "Mapping button %s to spell/macro", slot) + Ovale:DebugPrintf(OVALE_ACTIONBAR_DEBUG, "Mapping button %s to spell/macro", slot) end end function OvaleActionBar:FillActionIndexes(event) - Ovale:DebugPrintf("action_bar", "Mapping buttons to spells/macros for %s", event) + Ovale:DebugPrintf(OVALE_ACTIONBAR_DEBUG, "Mapping buttons to spells/macros for %s", event) wipe(self_actionSpell) wipe(self_actionMacro) wipe(self_actionItem) diff --git a/OvaleAura.lua b/OvaleAura.lua index c32212a..a34d1a2 100644 --- a/OvaleAura.lua +++ b/OvaleAura.lua @@ -33,6 +33,7 @@ local self_pool = OvalePool:NewPool("OvaleAura_pool") local self_aura = {} local self_serial = 0 +local OVALE_AURA_DEBUG = "aura" -- Units for which UNIT_AURA is known to fire. local OVALE_UNIT_AURA_UNITS = {} do @@ -129,7 +130,7 @@ end local function RemoveAurasForGUID(guid) -- Return all auras for the given GUID to the aura pool. if not guid or not self_aura[guid] then return end - Ovale:DebugPrintf("aura", "Removing auras for guid %s", guid) + Ovale:DebugPrintf(OVALE_AURA_DEBUG, "Removing auras for guid %s", guid) for filter, auraList in pairs(self_aura[guid]) do for spellId, whoseTable in pairs(auraList) do for whose, aura in pairs(whoseTable) do @@ -205,7 +206,7 @@ function UpdateAuras(unitId, unitGUID) for spellId, whoseTable in pairs(auraList) do for whose, aura in pairs(whoseTable) do if aura.serial ~= self_serial then - Ovale:DebugPrintf("aura", "Removing %s %s from %s, serial=%d aura.serial=%d", filter, aura.name, whose, self_serial, aura.serial) + Ovale:DebugPrintf(OVALE_AURA_DEBUG, "Removing %s %s from %s, serial=%d aura.serial=%d", filter, aura.name, whose, self_serial, aura.serial) whoseTable[whose] = nil self_pool:Release(aura) end diff --git a/OvaleBestAction.lua b/OvaleBestAction.lua index c61b493..7ea4bdf 100644 --- a/OvaleBestAction.lua +++ b/OvaleBestAction.lua @@ -716,9 +716,6 @@ function OvaleBestAction:GetActionInfo(element) end actionCooldownStart, actionCooldownDuration, actionEnable = OvaleState:GetComputedSpellCD(spellId) - if not actionCooldownStart or not actionCooldownDuration then - Ovale:DebugPrintf("unknown_spells", "No cooldown data for spell %s\n", spellId) - end local si = OvaleData.spellInfo[spellId] if si then diff --git a/OvaleCompile.lua b/OvaleCompile.lua index 73f08f9..7d31024 100644 --- a/OvaleCompile.lua +++ b/OvaleCompile.lua @@ -47,6 +47,10 @@ local self_missingSpellList = {} -- Whether to trigger a script compilation if items or stances change. local self_compileOnItems = false local self_compileOnStances = false + +local OVALE_COMPILE_DEBUG = "compile" +local OVALE_MISSING_SPELL_DEBUG = "missing_spells" +local OVALE_UNKNOWN_SPELL_DEBUG = "unknown_spells" -- -- @@ -237,11 +241,11 @@ local function ParseFunction(prefix, func, params) end if spellName then if spellName == API_GetSpellInfo(spellName) then - Ovale:DebugPrintf("missing_spells", "Learning spell %s with ID %d", spellName, spellId) + Ovale:DebugPrintf(OVALE_MISSING_SPELL_DEBUG, "Learning spell %s with ID %d", spellName, spellId) self_missingSpellList[spellId] = spellName end else - Ovale:DebugPrintf("unknown_spells", "Unknown spell with ID %d", spellId) + Ovale:DebugPrintf(OVALE_UNKNOWN_SPELL_DEBUG, "Unknown spell with ID %d", spellId) end end end @@ -766,7 +770,7 @@ function OvaleCompile:OnDisable() end function OvaleCompile:EventHandler(event) - Ovale:DebugPrint("compile", event) + Ovale:DebugPrint(OVALE_COMPILE_DEBUG, event) self:Compile() end diff --git a/OvaleEnemies.lua b/OvaleEnemies.lua index bc00983..37f8ae0 100644 --- a/OvaleEnemies.lua +++ b/OvaleEnemies.lua @@ -29,6 +29,8 @@ local self_enemyName = {} -- timer for reaper function to remove inactive enemies local self_reaperTimer = nil local REAP_INTERVAL = 3 + +local OVALE_ENEMIES_DEBUG = "enemy" -- -- @@ -44,7 +46,7 @@ local function AddEnemy(guid, name, timestamp) self_enemyName[guid] = name if not seen then self.activeEnemies = self.activeEnemies + 1 - Ovale:DebugPrintf("enemy", "New enemy (%d total): %s (%s)", self.activeEnemies, guid, name) + Ovale:DebugPrintf(OVALE_ENEMIES_DEBUG, "New enemy (%d total): %s (%s)", self.activeEnemies, guid, name) Ovale.refreshNeeded["player"] = true end end @@ -60,9 +62,9 @@ local function RemoveEnemy(guid, isDead) self.activeEnemies = self.activeEnemies - 1 end if isDead then - Ovale:DebugPrintf("enemy", "Enemy died (%d total): %s (%s)", self.activeEnemies, guid, name) + Ovale:DebugPrintf(OVALE_ENEMIES_DEBUG, "Enemy died (%d total): %s (%s)", self.activeEnemies, guid, name) else - Ovale:DebugPrintf("enemy", "Enemy removed (%d total): %s (%s), last seen at %f", self.activeEnemies, guid, name, seen) + Ovale:DebugPrintf(OVALE_ENEMIES_DEBUG, "Enemy removed (%d total): %s (%s), last seen at %f", self.activeEnemies, guid, name, seen) end self:SendMessage("Ovale_InactiveUnit", guid) Ovale.refreshNeeded["player"] = true diff --git a/OvaleGUID.lua b/OvaleGUID.lua index 1669bcf..bb015cf 100644 --- a/OvaleGUID.lua +++ b/OvaleGUID.lua @@ -25,6 +25,8 @@ local self_unitId = {} local self_guid = {} local self_nameToGUID = {} local self_nameToUnit = {} + +local OVALE_GUID_DEBUG = "guid" -- -- @@ -69,7 +71,7 @@ function OvaleGUID:Update(unitId) if not self_unitId[guid] then self_unitId[guid] = {} end - Ovale:DebugPrintf("guid", "GUID %s is %s", guid, unitId) + Ovale:DebugPrintf(OVALE_GUID_DEBUG, "GUID %s is %s", guid, unitId) self_unitId[guid][unitId] = true end end -- 1.7.9.5