Cleaned commentary lines
This commit is contained in:
@@ -1,47 +1,27 @@
|
||||
```lua
|
||||
------------------------------------------------------------
|
||||
-- pfUI-DQB
|
||||
-- core.lua
|
||||
--
|
||||
-- Main core and module system for pfUI-DQB.
|
||||
------------------------------------------------------------
|
||||
|
||||
local addonName = "pfUI-DQB"
|
||||
|
||||
|
||||
------------------------------------------------------------
|
||||
-- pfUI-DQB requires pfUI
|
||||
------------------------------------------------------------
|
||||
|
||||
if not pfUI then
|
||||
return
|
||||
end
|
||||
|
||||
|
||||
------------------------------------------------------------
|
||||
-- Main namespace
|
||||
------------------------------------------------------------
|
||||
|
||||
pfUI.dqb = pfUI.dqb or {}
|
||||
|
||||
local DQB = pfUI.dqb
|
||||
|
||||
|
||||
------------------------------------------------------------
|
||||
-- Basic information
|
||||
------------------------------------------------------------
|
||||
|
||||
DQB.name = addonName
|
||||
DQB.version = "0.1.1"
|
||||
|
||||
DQB.config = DQB.config or {}
|
||||
DQB.modules = DQB.modules or {}
|
||||
|
||||
|
||||
------------------------------------------------------------
|
||||
-- Module system
|
||||
------------------------------------------------------------
|
||||
|
||||
function DQB:RegisterModule(name, func)
|
||||
|
||||
if not name or not func then
|
||||
@@ -51,11 +31,7 @@ function DQB:RegisterModule(name, func)
|
||||
self.modules[name] = func
|
||||
end
|
||||
|
||||
|
||||
------------------------------------------------------------
|
||||
-- Configuration helpers
|
||||
------------------------------------------------------------
|
||||
|
||||
function DQB:GetGlobalConfig(key, default)
|
||||
|
||||
if not pfUI_config
|
||||
@@ -100,11 +76,7 @@ function DQB:SetConfig(module, key, value)
|
||||
pfUI_config.dqb[module][key] = value
|
||||
end
|
||||
|
||||
|
||||
------------------------------------------------------------
|
||||
-- Enable / Disable
|
||||
------------------------------------------------------------
|
||||
|
||||
function DQB:IsEnabled()
|
||||
|
||||
return self:GetConfig(
|
||||
@@ -138,11 +110,7 @@ function DQB:SetEnabled(enabled)
|
||||
|
||||
end
|
||||
|
||||
|
||||
------------------------------------------------------------
|
||||
-- Debug
|
||||
------------------------------------------------------------
|
||||
|
||||
function DQB:Debug(message)
|
||||
|
||||
if DEFAULT_CHAT_FRAME then
|
||||
@@ -156,11 +124,7 @@ function DQB:Debug(message)
|
||||
|
||||
end
|
||||
|
||||
|
||||
------------------------------------------------------------
|
||||
-- Initialize modules
|
||||
------------------------------------------------------------
|
||||
|
||||
function DQB:Initialize()
|
||||
|
||||
self:Debug(
|
||||
@@ -172,21 +136,13 @@ function DQB:Initialize()
|
||||
"status: "
|
||||
.. (self:IsEnabled() and "enabled" or "disabled")
|
||||
)
|
||||
|
||||
|
||||
--------------------------------------------------------
|
||||
-- Do not initialize modules when DQB is disabled
|
||||
--------------------------------------------------------
|
||||
|
||||
|
||||
-- Modules will not initialize when DQB is disabled
|
||||
if not self:IsEnabled() then
|
||||
return
|
||||
end
|
||||
|
||||
|
||||
--------------------------------------------------------
|
||||
|
||||
-- Load registered modules
|
||||
--------------------------------------------------------
|
||||
|
||||
for name, module in pairs(self.modules) do
|
||||
|
||||
if module then
|
||||
@@ -218,11 +174,7 @@ function DQB:Initialize()
|
||||
|
||||
end
|
||||
|
||||
|
||||
------------------------------------------------------------
|
||||
-- Initialize after SavedVariables are available
|
||||
------------------------------------------------------------
|
||||
|
||||
local loader = CreateFrame("Frame")
|
||||
|
||||
loader:RegisterEvent("VARIABLES_LOADED")
|
||||
@@ -230,57 +182,35 @@ loader:RegisterEvent("VARIABLES_LOADED")
|
||||
|
||||
loader:SetScript("OnEvent", function()
|
||||
|
||||
--------------------------------------------------------
|
||||
-- Make sure this is our expected event
|
||||
--------------------------------------------------------
|
||||
|
||||
|
||||
-- Make sure this is the expected event
|
||||
if event ~= "VARIABLES_LOADED" then
|
||||
return
|
||||
end
|
||||
|
||||
|
||||
--------------------------------------------------------
|
||||
|
||||
-- pfUI must exist
|
||||
--------------------------------------------------------
|
||||
|
||||
if not pfUI then
|
||||
return
|
||||
end
|
||||
|
||||
|
||||
--------------------------------------------------------
|
||||
|
||||
-- Initialize configuration
|
||||
--------------------------------------------------------
|
||||
|
||||
if DQB.InitializeConfig then
|
||||
|
||||
DQB:InitializeConfig()
|
||||
|
||||
end
|
||||
|
||||
|
||||
--------------------------------------------------------
|
||||
|
||||
-- Initialize GUI
|
||||
--------------------------------------------------------
|
||||
|
||||
if DQB.InitializeGUI then
|
||||
|
||||
DQB:InitializeGUI()
|
||||
|
||||
end
|
||||
|
||||
|
||||
--------------------------------------------------------
|
||||
|
||||
-- Initialize DQB modules
|
||||
--------------------------------------------------------
|
||||
|
||||
DQB:Initialize()
|
||||
|
||||
|
||||
--------------------------------------------------------
|
||||
|
||||
-- Only execute once
|
||||
--------------------------------------------------------
|
||||
|
||||
this:UnregisterAllEvents()
|
||||
|
||||
end)
|
||||
|
||||
Reference in New Issue
Block a user