Add files via upload
This commit is contained in:
+215
@@ -0,0 +1,215 @@
|
||||
------------------------------------------------------------
|
||||
-- pfUI-DQB
|
||||
-- config.lua
|
||||
--
|
||||
-- Default configuration for DQB.
|
||||
-- GUI registration is handled by gui.lua.
|
||||
------------------------------------------------------------
|
||||
|
||||
local DQB = pfUI and pfUI.dqb
|
||||
|
||||
if not DQB then
|
||||
return
|
||||
end
|
||||
|
||||
------------------------------------------------------------
|
||||
-- Default configuration
|
||||
------------------------------------------------------------
|
||||
|
||||
function DQB:InitializeConfig()
|
||||
|
||||
--------------------------------------------------------
|
||||
-- Root
|
||||
--------------------------------------------------------
|
||||
|
||||
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
|
||||
|
||||
if questgossip.background_global == nil then
|
||||
questgossip.background_global = "1"
|
||||
end
|
||||
|
||||
if questgossip.background_color == nil then
|
||||
questgossip.background_color = "000000"
|
||||
end
|
||||
|
||||
if questgossip.background_alpha == nil then
|
||||
questgossip.background_alpha = "0.85"
|
||||
end
|
||||
|
||||
if questgossip.text_global == nil then
|
||||
questgossip.text_global = "1"
|
||||
end
|
||||
|
||||
if questgossip.text_font == nil then
|
||||
questgossip.text_font = "Arial"
|
||||
end
|
||||
|
||||
if questgossip.text_size == nil then
|
||||
questgossip.text_size = "12"
|
||||
end
|
||||
|
||||
if questgossip.text_style == nil then
|
||||
questgossip.text_style = ""
|
||||
end
|
||||
|
||||
if questgossip.text_color == nil then
|
||||
questgossip.text_color = "ffffff"
|
||||
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 = "000000"
|
||||
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 = "Arial"
|
||||
end
|
||||
|
||||
if questlog.text_size == nil then
|
||||
questlog.text_size = "12"
|
||||
end
|
||||
|
||||
if questlog.text_style == nil then
|
||||
questlog.text_style = ""
|
||||
end
|
||||
|
||||
if questlog.text_color == nil then
|
||||
questlog.text_color = "ffffff"
|
||||
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 = "000000"
|
||||
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 = "Arial"
|
||||
end
|
||||
|
||||
if itemtext.text_size == nil then
|
||||
itemtext.text_size = "12"
|
||||
end
|
||||
|
||||
if itemtext.text_style == nil then
|
||||
itemtext.text_style = ""
|
||||
end
|
||||
|
||||
if itemtext.text_color == nil then
|
||||
itemtext.text_color = "ffffff"
|
||||
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 = "000000"
|
||||
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 = "Arial"
|
||||
end
|
||||
|
||||
if merchant.text_size == nil then
|
||||
merchant.text_size = "12"
|
||||
end
|
||||
|
||||
if merchant.text_style == nil then
|
||||
merchant.text_style = ""
|
||||
end
|
||||
|
||||
if merchant.text_color == nil then
|
||||
merchant.text_color = "ffffff"
|
||||
end
|
||||
|
||||
end
|
||||
@@ -0,0 +1,174 @@
|
||||
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
|
||||
|
||||
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
|
||||
return
|
||||
end
|
||||
|
||||
self.modules[name] = func
|
||||
end
|
||||
|
||||
------------------------------------------------------------
|
||||
-- Configuration helpers
|
||||
------------------------------------------------------------
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
------------------------------------------------------------
|
||||
-- Enable / Disable
|
||||
------------------------------------------------------------
|
||||
|
||||
function DQB:IsEnabled()
|
||||
return self:GetConfig("general", "enable", "1") == "1"
|
||||
end
|
||||
|
||||
function DQB:SetEnabled(enabled)
|
||||
|
||||
if enabled then
|
||||
self:SetConfig("general", "enable", "1")
|
||||
else
|
||||
self:SetConfig("general", "enable", "0")
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
------------------------------------------------------------
|
||||
-- Debug
|
||||
------------------------------------------------------------
|
||||
|
||||
function DQB:Debug(message)
|
||||
|
||||
if DEFAULT_CHAT_FRAME then
|
||||
DEFAULT_CHAT_FRAME:AddMessage(
|
||||
"|cff33ffccpf|cffffffffUI-DQB|r: " .. tostring(message)
|
||||
)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
------------------------------------------------------------
|
||||
-- Initialization
|
||||
------------------------------------------------------------
|
||||
|
||||
function DQB:Initialize()
|
||||
|
||||
self:Debug(
|
||||
"initialized v" .. tostring(self.version)
|
||||
)
|
||||
|
||||
self:Debug(
|
||||
"status: " ..
|
||||
(self:IsEnabled() and "enabled" or "disabled")
|
||||
)
|
||||
|
||||
end
|
||||
|
||||
------------------------------------------------------------
|
||||
-- Initialize after SavedVariables 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
|
||||
|
||||
--------------------------------------------------------
|
||||
-- Initialize configuration
|
||||
--------------------------------------------------------
|
||||
|
||||
if DQB.InitializeConfig then
|
||||
DQB:InitializeConfig()
|
||||
end
|
||||
|
||||
--------------------------------------------------------
|
||||
-- Initialize GUI
|
||||
--------------------------------------------------------
|
||||
|
||||
if DQB.InitializeGUI then
|
||||
DQB:InitializeGUI()
|
||||
end
|
||||
|
||||
--------------------------------------------------------
|
||||
-- Initialize DQB
|
||||
--------------------------------------------------------
|
||||
|
||||
DQB:Initialize()
|
||||
|
||||
--------------------------------------------------------
|
||||
-- We only need this event once
|
||||
--------------------------------------------------------
|
||||
|
||||
this:UnregisterAllEvents()
|
||||
|
||||
end)
|
||||
@@ -0,0 +1,374 @@
|
||||
------------------------------------------------------------
|
||||
-- pfUI-DQB
|
||||
-- gui.lua
|
||||
--
|
||||
-- Registers DQB configuration inside pfUI's GUI.
|
||||
------------------------------------------------------------
|
||||
|
||||
local DQB = pfUI and pfUI.dqb
|
||||
|
||||
if not DQB then
|
||||
return
|
||||
end
|
||||
|
||||
|
||||
------------------------------------------------------------
|
||||
-- Create DQB configuration menu
|
||||
------------------------------------------------------------
|
||||
|
||||
function DQB:CreateGUI()
|
||||
|
||||
--------------------------------------------------------
|
||||
-- Make sure pfUI GUI is available
|
||||
--------------------------------------------------------
|
||||
|
||||
if not pfUI.gui then
|
||||
return
|
||||
end
|
||||
|
||||
--------------------------------------------------------
|
||||
-- Make sure our configuration exists
|
||||
--------------------------------------------------------
|
||||
|
||||
if self.InitializeConfig then
|
||||
self:InitializeConfig()
|
||||
end
|
||||
|
||||
if not pfUI_config or not pfUI_config.dqb then
|
||||
return
|
||||
end
|
||||
|
||||
--------------------------------------------------------
|
||||
-- pfUI GUI helpers
|
||||
--------------------------------------------------------
|
||||
|
||||
local CreateConfig = pfUI.gui.CreateConfig
|
||||
local CreateGUIEntry = pfUI.gui.CreateGUIEntry
|
||||
|
||||
if not CreateConfig or not CreateGUIEntry then
|
||||
return
|
||||
end
|
||||
|
||||
|
||||
--------------------------------------------------------
|
||||
-- GENERAL
|
||||
--------------------------------------------------------
|
||||
|
||||
CreateGUIEntry(
|
||||
"DQB",
|
||||
"General",
|
||||
function()
|
||||
|
||||
CreateConfig(
|
||||
nil,
|
||||
"Enable DQB",
|
||||
pfUI_config.dqb.general,
|
||||
"enable",
|
||||
"checkbox"
|
||||
)
|
||||
|
||||
end
|
||||
)
|
||||
|
||||
|
||||
--------------------------------------------------------
|
||||
-- QUEST & GOSSIP
|
||||
--------------------------------------------------------
|
||||
|
||||
CreateGUIEntry(
|
||||
"DQB",
|
||||
"Quest & Gossip",
|
||||
function()
|
||||
|
||||
------------------------------------------------
|
||||
-- Background
|
||||
------------------------------------------------
|
||||
|
||||
CreateConfig(
|
||||
nil,
|
||||
"Enable Background",
|
||||
pfUI_config.dqb.questgossip,
|
||||
"background_global",
|
||||
"checkbox"
|
||||
)
|
||||
|
||||
CreateConfig(
|
||||
nil,
|
||||
"Background Color",
|
||||
pfUI_config.dqb.questgossip,
|
||||
"background_color",
|
||||
"color"
|
||||
)
|
||||
|
||||
CreateConfig(
|
||||
nil,
|
||||
"Background Opacity",
|
||||
pfUI_config.dqb.questgossip,
|
||||
"background_alpha",
|
||||
"text"
|
||||
)
|
||||
|
||||
|
||||
------------------------------------------------
|
||||
-- Text
|
||||
------------------------------------------------
|
||||
|
||||
CreateConfig(
|
||||
nil,
|
||||
"Enable Text",
|
||||
pfUI_config.dqb.questgossip,
|
||||
"text_global",
|
||||
"checkbox"
|
||||
)
|
||||
|
||||
CreateConfig(
|
||||
nil,
|
||||
"Text Font",
|
||||
pfUI_config.dqb.questgossip,
|
||||
"text_font",
|
||||
"text"
|
||||
)
|
||||
|
||||
CreateConfig(
|
||||
nil,
|
||||
"Text Size",
|
||||
pfUI_config.dqb.questgossip,
|
||||
"text_size",
|
||||
"text"
|
||||
)
|
||||
|
||||
CreateConfig(
|
||||
nil,
|
||||
"Text Style",
|
||||
pfUI_config.dqb.questgossip,
|
||||
"text_style",
|
||||
"text"
|
||||
)
|
||||
|
||||
CreateConfig(
|
||||
nil,
|
||||
"Text Color",
|
||||
pfUI_config.dqb.questgossip,
|
||||
"text_color",
|
||||
"color"
|
||||
)
|
||||
|
||||
end
|
||||
)
|
||||
|
||||
|
||||
--------------------------------------------------------
|
||||
-- QUEST LOG
|
||||
--------------------------------------------------------
|
||||
|
||||
CreateGUIEntry(
|
||||
"DQB",
|
||||
"Quest Log",
|
||||
function()
|
||||
|
||||
------------------------------------------------
|
||||
-- Background
|
||||
------------------------------------------------
|
||||
|
||||
CreateConfig(
|
||||
nil,
|
||||
"Enable Background",
|
||||
pfUI_config.dqb.questlog,
|
||||
"background_global",
|
||||
"checkbox"
|
||||
)
|
||||
|
||||
CreateConfig(
|
||||
nil,
|
||||
"Background Color",
|
||||
pfUI_config.dqb.questlog,
|
||||
"background_color",
|
||||
"color"
|
||||
)
|
||||
|
||||
CreateConfig(
|
||||
nil,
|
||||
"Background Opacity",
|
||||
pfUI_config.dqb.questlog,
|
||||
"background_alpha",
|
||||
"text"
|
||||
)
|
||||
|
||||
|
||||
------------------------------------------------
|
||||
-- Text
|
||||
------------------------------------------------
|
||||
|
||||
CreateConfig(
|
||||
nil,
|
||||
"Enable Text",
|
||||
pfUI_config.dqb.questlog,
|
||||
"text_global",
|
||||
"checkbox"
|
||||
)
|
||||
|
||||
CreateConfig(
|
||||
nil,
|
||||
"Text Font",
|
||||
pfUI_config.dqb.questlog,
|
||||
"text_font",
|
||||
"text"
|
||||
)
|
||||
|
||||
CreateConfig(
|
||||
nil,
|
||||
"Text Size",
|
||||
pfUI_config.dqb.questlog,
|
||||
"text_size",
|
||||
"text"
|
||||
)
|
||||
|
||||
CreateConfig(
|
||||
nil,
|
||||
"Text Style",
|
||||
pfUI_config.dqb.questlog,
|
||||
"text_style",
|
||||
"text"
|
||||
)
|
||||
|
||||
CreateConfig(
|
||||
nil,
|
||||
"Text Color",
|
||||
pfUI_config.dqb.questlog,
|
||||
"text_color",
|
||||
"color"
|
||||
)
|
||||
|
||||
end
|
||||
)
|
||||
|
||||
|
||||
--------------------------------------------------------
|
||||
-- BOOKS
|
||||
--------------------------------------------------------
|
||||
--
|
||||
-- "Books" corresponds to the original pfUI itemtext.lua
|
||||
-- functionality.
|
||||
--------------------------------------------------------
|
||||
|
||||
CreateGUIEntry(
|
||||
"DQB",
|
||||
"Books",
|
||||
function()
|
||||
|
||||
------------------------------------------------
|
||||
-- Background
|
||||
------------------------------------------------
|
||||
|
||||
CreateConfig(
|
||||
nil,
|
||||
"Enable Background",
|
||||
pfUI_config.dqb.itemtext,
|
||||
"background_global",
|
||||
"checkbox"
|
||||
)
|
||||
|
||||
CreateConfig(
|
||||
nil,
|
||||
"Background Color",
|
||||
pfUI_config.dqb.itemtext,
|
||||
"background_color",
|
||||
"color"
|
||||
)
|
||||
|
||||
CreateConfig(
|
||||
nil,
|
||||
"Background Opacity",
|
||||
pfUI_config.dqb.itemtext,
|
||||
"background_alpha",
|
||||
"text"
|
||||
)
|
||||
|
||||
|
||||
------------------------------------------------
|
||||
-- Text
|
||||
------------------------------------------------
|
||||
|
||||
CreateConfig(
|
||||
nil,
|
||||
"Enable Text",
|
||||
pfUI_config.dqb.itemtext,
|
||||
"text_global",
|
||||
"checkbox"
|
||||
)
|
||||
|
||||
CreateConfig(
|
||||
nil,
|
||||
"Text Font",
|
||||
pfUI_config.dqb.itemtext,
|
||||
"text_font",
|
||||
"text"
|
||||
)
|
||||
|
||||
CreateConfig(
|
||||
nil,
|
||||
"Text Size",
|
||||
pfUI_config.dqb.itemtext,
|
||||
"text_size",
|
||||
"text"
|
||||
)
|
||||
|
||||
CreateConfig(
|
||||
nil,
|
||||
"Text Style",
|
||||
pfUI_config.dqb.itemtext,
|
||||
"text_style",
|
||||
"text"
|
||||
)
|
||||
|
||||
CreateConfig(
|
||||
nil,
|
||||
"Text Color",
|
||||
pfUI_config.dqb.itemtext,
|
||||
"text_color",
|
||||
"color"
|
||||
)
|
||||
|
||||
end
|
||||
)
|
||||
|
||||
end
|
||||
|
||||
|
||||
------------------------------------------------------------
|
||||
-- Compatibility with core.lua
|
||||
------------------------------------------------------------
|
||||
--
|
||||
-- core.lua currently calls InitializeGUI().
|
||||
-- Keep that name as a wrapper around CreateGUI().
|
||||
------------------------------------------------------------
|
||||
|
||||
function DQB:InitializeGUI()
|
||||
self:CreateGUI()
|
||||
end
|
||||
|
||||
|
||||
------------------------------------------------------------
|
||||
-- Initialize GUI after pfUI has loaded
|
||||
------------------------------------------------------------
|
||||
|
||||
local event = CreateFrame("Frame")
|
||||
|
||||
event:RegisterEvent("ADDON_LOADED")
|
||||
|
||||
event:SetScript("OnEvent", function()
|
||||
|
||||
if arg1 == "pfUI" then
|
||||
|
||||
if DQB.InitializeConfig then
|
||||
DQB:InitializeConfig()
|
||||
end
|
||||
|
||||
if DQB.CreateGUI then
|
||||
DQB:CreateGUI()
|
||||
end
|
||||
|
||||
event:UnregisterEvent("ADDON_LOADED")
|
||||
end
|
||||
|
||||
end)
|
||||
@@ -0,0 +1,10 @@
|
||||
## Interface: 11200
|
||||
## Title: |cff33ffccpf|cffffffffUI|cffaaaaaa [Dialog, QuestLog & Books]
|
||||
## Author: jKalfis
|
||||
## Notes: Quest & Gossip, Quest Log and Books visual enhancements for pfUI.
|
||||
## Version: 0.1.1
|
||||
## Dependencies: pfUI
|
||||
|
||||
core.lua
|
||||
config.lua
|
||||
gui.lua
|
||||
Reference in New Issue
Block a user