Add files via upload
This commit is contained in:
+259
@@ -0,0 +1,259 @@
|
||||
--[[
|
||||
pfUI-DQB
|
||||
Configuration
|
||||
]]
|
||||
|
||||
if not pfUI or not pfUI.dqb then
|
||||
return
|
||||
end
|
||||
|
||||
local DQB = pfUI.dqb
|
||||
|
||||
--------------------------------------------------
|
||||
-- Default configuration
|
||||
--------------------------------------------------
|
||||
|
||||
function DQB:InitializeConfig()
|
||||
|
||||
-- Make sure the DQB root exists.
|
||||
if not pfUI_config then
|
||||
pfUI_config = {}
|
||||
end
|
||||
|
||||
if not pfUI_config.dqb then
|
||||
pfUI_config.dqb = {}
|
||||
end
|
||||
|
||||
------------------------------------------------
|
||||
-- General
|
||||
------------------------------------------------
|
||||
|
||||
if not pfUI_config.dqb.general then
|
||||
pfUI_config.dqb.general = {}
|
||||
end
|
||||
|
||||
local general = pfUI_config.dqb.general
|
||||
|
||||
if general.enable == nil then
|
||||
general.enable = "1"
|
||||
end
|
||||
|
||||
------------------------------------------------
|
||||
-- Quest & Gossip
|
||||
------------------------------------------------
|
||||
|
||||
if not pfUI_config.dqb.questgossip then
|
||||
pfUI_config.dqb.questgossip = {}
|
||||
end
|
||||
|
||||
local questgossip = pfUI_config.dqb.questgossip
|
||||
|
||||
-- Background
|
||||
if questgossip.background_global == nil then
|
||||
questgossip.background_global = "1"
|
||||
end
|
||||
|
||||
if questgossip.background_color == nil then
|
||||
questgossip.background_color = "0,0,0,1"
|
||||
end
|
||||
|
||||
if questgossip.background_alpha == nil then
|
||||
questgossip.background_alpha = "0.85"
|
||||
end
|
||||
|
||||
-- Text
|
||||
if questgossip.text_global == nil then
|
||||
questgossip.text_global = "1"
|
||||
end
|
||||
|
||||
if questgossip.text_font == nil then
|
||||
questgossip.text_font = ""
|
||||
end
|
||||
|
||||
if questgossip.text_size == nil then
|
||||
questgossip.text_size = ""
|
||||
end
|
||||
|
||||
if questgossip.text_style == nil then
|
||||
questgossip.text_style = ""
|
||||
end
|
||||
|
||||
if questgossip.text_color == nil then
|
||||
questgossip.text_color = "1,1,1,1"
|
||||
end
|
||||
|
||||
------------------------------------------------
|
||||
-- Quest Log
|
||||
------------------------------------------------
|
||||
|
||||
if not pfUI_config.dqb.questlog then
|
||||
pfUI_config.dqb.questlog = {}
|
||||
end
|
||||
|
||||
local questlog = pfUI_config.dqb.questlog
|
||||
|
||||
if questlog.background_global == nil then
|
||||
questlog.background_global = "1"
|
||||
end
|
||||
|
||||
if questlog.background_color == nil then
|
||||
questlog.background_color = "0,0,0,1"
|
||||
end
|
||||
|
||||
if questlog.background_alpha == nil then
|
||||
questlog.background_alpha = "0.85"
|
||||
end
|
||||
|
||||
if questlog.text_global == nil then
|
||||
questlog.text_global = "1"
|
||||
end
|
||||
|
||||
if questlog.text_font == nil then
|
||||
questlog.text_font = ""
|
||||
end
|
||||
|
||||
if questlog.text_size == nil then
|
||||
questlog.text_size = ""
|
||||
end
|
||||
|
||||
if questlog.text_style == nil then
|
||||
questlog.text_style = ""
|
||||
end
|
||||
|
||||
if questlog.text_color == nil then
|
||||
questlog.text_color = "1,1,1,1"
|
||||
end
|
||||
|
||||
------------------------------------------------
|
||||
-- Item Text
|
||||
------------------------------------------------
|
||||
|
||||
if not pfUI_config.dqb.itemtext then
|
||||
pfUI_config.dqb.itemtext = {}
|
||||
end
|
||||
|
||||
local itemtext = pfUI_config.dqb.itemtext
|
||||
|
||||
if itemtext.background_global == nil then
|
||||
itemtext.background_global = "1"
|
||||
end
|
||||
|
||||
if itemtext.background_color == nil then
|
||||
itemtext.background_color = "0,0,0,1"
|
||||
end
|
||||
|
||||
if itemtext.background_alpha == nil then
|
||||
itemtext.background_alpha = "0.85"
|
||||
end
|
||||
|
||||
if itemtext.text_global == nil then
|
||||
itemtext.text_global = "1"
|
||||
end
|
||||
|
||||
if itemtext.text_font == nil then
|
||||
itemtext.text_font = ""
|
||||
end
|
||||
|
||||
if itemtext.text_size == nil then
|
||||
itemtext.text_size = ""
|
||||
end
|
||||
|
||||
if itemtext.text_style == nil then
|
||||
itemtext.text_style = ""
|
||||
end
|
||||
|
||||
if itemtext.text_color == nil then
|
||||
itemtext.text_color = "1,1,1,1"
|
||||
end
|
||||
|
||||
------------------------------------------------
|
||||
-- Merchant
|
||||
------------------------------------------------
|
||||
|
||||
if not pfUI_config.dqb.merchant then
|
||||
pfUI_config.dqb.merchant = {}
|
||||
end
|
||||
|
||||
local merchant = pfUI_config.dqb.merchant
|
||||
|
||||
if merchant.background_global == nil then
|
||||
merchant.background_global = "1"
|
||||
end
|
||||
|
||||
if merchant.background_color == nil then
|
||||
merchant.background_color = "0,0,0,1"
|
||||
end
|
||||
|
||||
if merchant.background_alpha == nil then
|
||||
merchant.background_alpha = "0.85"
|
||||
end
|
||||
|
||||
if merchant.text_global == nil then
|
||||
merchant.text_global = "1"
|
||||
end
|
||||
|
||||
if merchant.text_font == nil then
|
||||
merchant.text_font = ""
|
||||
end
|
||||
|
||||
if merchant.text_size == nil then
|
||||
merchant.text_size = ""
|
||||
end
|
||||
|
||||
if merchant.text_style == nil then
|
||||
merchant.text_style = ""
|
||||
end
|
||||
|
||||
if merchant.text_color == nil then
|
||||
merchant.text_color = "1,1,1,1"
|
||||
end
|
||||
end
|
||||
|
||||
--------------------------------------------------
|
||||
-- pfUI GUI integration
|
||||
--------------------------------------------------
|
||||
|
||||
function DQB:InitializeGUI()
|
||||
|
||||
if not pfUI.gui then
|
||||
return
|
||||
end
|
||||
|
||||
if not pfUI.gui.CreateGUIEntry then
|
||||
return
|
||||
end
|
||||
|
||||
-- Prevent duplicate creation.
|
||||
if self.guiInitialized then
|
||||
return
|
||||
end
|
||||
|
||||
self.guiInitialized = true
|
||||
|
||||
------------------------------------------------
|
||||
-- DQB
|
||||
------------------------------------------------
|
||||
|
||||
local CreateGUIEntry = pfUI.gui.CreateGUIEntry
|
||||
|
||||
------------------------------------------------
|
||||
-- General
|
||||
------------------------------------------------
|
||||
|
||||
CreateGUIEntry(
|
||||
"DQB",
|
||||
nil,
|
||||
function()
|
||||
local CreateConfig = pfUI.gui.CreateConfig
|
||||
|
||||
CreateConfig(
|
||||
nil,
|
||||
"Enable DQB",
|
||||
pfUI_config.dqb.general,
|
||||
"enable",
|
||||
"checkbox"
|
||||
)
|
||||
end
|
||||
)
|
||||
|
||||
end
|
||||
@@ -0,0 +1,110 @@
|
||||
--[[
|
||||
pfUI-DQB
|
||||
Dialog, QuestLog & Books pfUI Style
|
||||
|
||||
Core
|
||||
]]
|
||||
|
||||
local addonName = "pfUI-DQB"
|
||||
|
||||
-- Make sure pfUI exists.
|
||||
if not pfUI then
|
||||
return
|
||||
end
|
||||
|
||||
-- DQB namespace
|
||||
pfUI.dqb = pfUI.dqb or {}
|
||||
local DQB = pfUI.dqb
|
||||
|
||||
DQB.name = addonName
|
||||
DQB.version = "0.1.0"
|
||||
|
||||
-- Configuration root
|
||||
DQB.config = DQB.config or {}
|
||||
|
||||
-- Runtime state
|
||||
DQB.modules = DQB.modules or {}
|
||||
|
||||
-- Register a DQB module.
|
||||
function DQB:RegisterModule(name, func)
|
||||
if not name or not func then
|
||||
return
|
||||
end
|
||||
|
||||
self.modules[name] = func
|
||||
end
|
||||
|
||||
-- Safely get a pfUI global configuration value.
|
||||
function DQB:GetGlobalConfig(key, default)
|
||||
if not pfUI_config
|
||||
or not pfUI_config.global
|
||||
or pfUI_config.global[key] == nil then
|
||||
return default
|
||||
end
|
||||
|
||||
return pfUI_config.global[key]
|
||||
end
|
||||
|
||||
-- Safely get DQB configuration.
|
||||
function DQB:GetConfig(module, key, default)
|
||||
if not pfUI_config
|
||||
or not pfUI_config.dqb
|
||||
or not pfUI_config.dqb[module]
|
||||
or pfUI_config.dqb[module][key] == nil then
|
||||
return default
|
||||
end
|
||||
|
||||
return pfUI_config.dqb[module][key]
|
||||
end
|
||||
|
||||
-- Set DQB configuration.
|
||||
function DQB:SetConfig(module, key, value)
|
||||
if not pfUI_config then
|
||||
pfUI_config = {}
|
||||
end
|
||||
|
||||
if not pfUI_config.dqb then
|
||||
pfUI_config.dqb = {}
|
||||
end
|
||||
|
||||
if not pfUI_config.dqb[module] then
|
||||
pfUI_config.dqb[module] = {}
|
||||
end
|
||||
|
||||
pfUI_config.dqb[module][key] = value
|
||||
end
|
||||
|
||||
-- Simple debug helper.
|
||||
function DQB:Debug(message)
|
||||
if DEFAULT_CHAT_FRAME then
|
||||
DEFAULT_CHAT_FRAME:AddMessage(
|
||||
"|cff33ffccpf|cffffffffUI-DQB|r: " .. tostring(message)
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
-- Wait until pfUI's configuration and GUI are available.
|
||||
local loader = CreateFrame("Frame")
|
||||
|
||||
loader:RegisterEvent("VARIABLES_LOADED")
|
||||
loader:SetScript("OnEvent", function()
|
||||
if event ~= "VARIABLES_LOADED" then
|
||||
return
|
||||
end
|
||||
|
||||
if not pfUI then
|
||||
return
|
||||
end
|
||||
|
||||
-- The actual DQB configuration is initialized by config.lua.
|
||||
if DQB.InitializeConfig then
|
||||
DQB:InitializeConfig()
|
||||
end
|
||||
|
||||
-- Build the pfUI configuration entries.
|
||||
if DQB.InitializeGUI then
|
||||
DQB:InitializeGUI()
|
||||
end
|
||||
|
||||
this:UnregisterAllEvents()
|
||||
end)
|
||||
Reference in New Issue
Block a user