From ccbeb29af68f25598c40b162276afa30db520051 Mon Sep 17 00:00:00 2001 From: jKalfis Date: Thu, 3 Sep 2026 21:35:28 +0100 Subject: [PATCH] Add files via upload --- config.lua | 241 +++++++ core.lua | 287 ++++++++ gui.lua | 660 ++++++++++++++++++ modules/gossipquest.lua | 1449 +++++++++++++++++++++++++++++++++++++++ pfUI-DQB.toc | 11 + 5 files changed, 2648 insertions(+) create mode 100644 config.lua create mode 100644 core.lua create mode 100644 gui.lua create mode 100644 modules/gossipquest.lua create mode 100644 pfUI-DQB.toc diff --git a/config.lua b/config.lua new file mode 100644 index 0000000..fce3777 --- /dev/null +++ b/config.lua @@ -0,0 +1,241 @@ +------------------------------------------------------------ +-- 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 + + + -------------------------------------------------------- + -- Presets + -------------------------------------------------------- + + if questgossip.pfui_style == nil then + questgossip.pfui_style = "0" + end + + if questgossip.fix_fonts == nil then + questgossip.fix_fonts = "0" + end + + + -------------------------------------------------------- + -- Custom + -------------------------------------------------------- + + if not questgossip.custom then + questgossip.custom = {} + end + + local custom = questgossip.custom + + if custom.remove_parchment == nil then + custom.remove_parchment = "1" + end + + if custom.background_color == nil then + custom.background_color = "0,0,0,0.85" + end + + if custom.background_alpha == nil then + custom.background_alpha = "0.85" + end + + if custom.font == nil then + custom.font = "Interface\\AddOns\\pfUI\\fonts\\Myriad-Pro.ttf" + end + + if custom.title_color == nil then + custom.title_color = "1,0.84,0" + end + + if custom.text_color == nil then + custom.text_color = "1,1,1" + end + + + -------------------------------------------------------- + -- QUEST LOG + -------------------------------------------------------- + + if not pfUI_config.dqb.questlog then + pfUI_config.dqb.questlog = {} + end + + local questlog = pfUI_config.dqb.questlog + + + -------------------------------------------------------- + -- Presets + -------------------------------------------------------- + + if questlog.pfui_style == nil then + questlog.pfui_style = "0" + end + + if questlog.fix_fonts == nil then + questlog.fix_fonts = "0" + end + + + -------------------------------------------------------- + -- Custom + -------------------------------------------------------- + + if not questlog.custom then + questlog.custom = {} + end + + local custom = questlog.custom + + if custom.remove_parchment == nil then + custom.remove_parchment = "1" + end + + if custom.background_color == nil then + custom.background_color = "0,0,0,0.85" + end + + if custom.background_alpha == nil then + custom.background_alpha = "0.85" + end + + if custom.font == nil then + custom.font = "Interface\\AddOns\\pfUI\\fonts\\Myriad-Pro.ttf" + end + + if custom.title_color == nil then + custom.title_color = "1,0.84,0" + end + + if custom.text_color == nil then + custom.text_color = "1,1,1" + end + + + -------------------------------------------------------- + -- BOOKS + -------------------------------------------------------- + -- + -- Books corresponds to the original pfUI itemtext.lua. + -------------------------------------------------------- + + if not pfUI_config.dqb.books then + pfUI_config.dqb.books = {} + end + + local books = pfUI_config.dqb.books + + + -------------------------------------------------------- + -- Presets + -------------------------------------------------------- + + if books.pfui_style == nil then + books.pfui_style = "0" + end + + if books.fix_fonts == nil then + books.fix_fonts = "0" + end + + + -------------------------------------------------------- + -- Custom + -------------------------------------------------------- + + if not books.custom then + books.custom = {} + end + + local custom = books.custom + + if custom.remove_parchment == nil then + custom.remove_parchment = "1" + end + + if custom.background_color == nil then + custom.background_color = "0,0,0,0.85" + end + + if custom.background_alpha == nil then + custom.background_alpha = "0.85" + end + + if custom.font == nil then + custom.font = "Interface\\AddOns\\pfUI\\fonts\\Myriad-Pro.ttf" + end + + if custom.title_color == nil then + custom.title_color = "1,0.84,0" + end + + if custom.text_color == nil then + custom.text_color = "1,1,1" + end + + + -------------------------------------------------------- + -- MERCHANT + -------------------------------------------------------- + -- + -- Kept untouched for now. + -------------------------------------------------------- + + if not pfUI_config.dqb.merchant then + pfUI_config.dqb.merchant = {} + end + +end \ No newline at end of file diff --git a/core.lua b/core.lua new file mode 100644 index 0000000..a3b6f5e --- /dev/null +++ b/core.lua @@ -0,0 +1,287 @@ +```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 + 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 + + +------------------------------------------------------------ +-- Initialize modules +------------------------------------------------------------ + +function DQB:Initialize() + + self:Debug( + "initialized v" .. tostring(self.version) + ) + + + self:Debug( + "status: " + .. (self:IsEnabled() and "enabled" or "disabled") + ) + + + -------------------------------------------------------- + -- Do not initialize modules 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 + + local success, errorMessage = pcall(module) + + if not success then + + self:Debug( + "module '" .. + tostring(name) .. + "' failed: " .. + tostring(errorMessage) + ) + + else + + self:Debug( + "module '" .. + tostring(name) .. + "' loaded" + ) + + end + + end + + end + +end + + +------------------------------------------------------------ +-- Initialize after SavedVariables are available +------------------------------------------------------------ + +local loader = CreateFrame("Frame") + +loader:RegisterEvent("VARIABLES_LOADED") + + +loader:SetScript("OnEvent", function() + + -------------------------------------------------------- + -- Make sure this is our 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) +``` diff --git a/gui.lua b/gui.lua new file mode 100644 index 0000000..8040b6c --- /dev/null +++ b/gui.lua @@ -0,0 +1,660 @@ +------------------------------------------------------------ +-- 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 + + + -------------------------------------------------------- + -- CUSTOM OPACITY SLIDER + -------------------------------------------------------- + -- + -- pfUI's CreateConfig does not provide a slider widget. + -- We therefore create the normal pfUI configuration row + -- first and replace its EditBox with our own Slider. + -- + -- This keeps the exact same positioning/layout used by + -- the rest of pfUI's GUI. + -------------------------------------------------------- + + local function CreateOpacitySlider(caption, category, config) + + ---------------------------------------------------- + -- Create the normal pfUI config row. + ---------------------------------------------------- + + local frame = CreateConfig( + nil, + caption, + category, + config, + "text" + ) + + if not frame then + return + end + + ---------------------------------------------------- + -- Hide the normal text input. + ---------------------------------------------------- + + if frame.input then + frame.input:Hide() + end + + + ---------------------------------------------------- + -- Create slider. + ---------------------------------------------------- + + local slider = CreateFrame( + "Slider", + nil, + frame + ) + + slider:SetWidth(180) + slider:SetHeight(10) + + slider:SetOrientation("HORIZONTAL") + + slider:SetMinMaxValues(0, 1) + + ---------------------------------------------------- + -- IMPORTANT: + -- Set the thumb texture BEFORE GetThumbTexture(). + ---------------------------------------------------- + + if pfUI.media and pfUI.media["img:col"] then + slider:SetThumbTexture( + pfUI.media["img:col"] + ) + end + + ---------------------------------------------------- + -- Position slider. + ---------------------------------------------------- + + slider:SetPoint( + "RIGHT", + frame, + "RIGHT", + -38, + 0 + ) + + + ---------------------------------------------------- + -- Try to apply pfUI slider skin. + -- + -- SkinSlider expects a valid thumb texture. + -- If anything is unavailable, we simply keep the + -- normal slider instead of generating an error. + ---------------------------------------------------- + + if pfUI.api and pfUI.api.SkinSlider then + local thumb = slider:GetThumbTexture() + + if thumb then + pfUI.api.SkinSlider(slider) + end + end + + + ---------------------------------------------------- + -- Current value. + ---------------------------------------------------- + + local value = tonumber(category[config]) + + if not value then + value = 0.85 + end + + if value < 0 then + value = 0 + elseif value > 1 then + value = 1 + end + + slider:SetValue(value) + + + ---------------------------------------------------- + -- Value text. + ---------------------------------------------------- + + local valueText = frame:CreateFontString( + nil, + "OVERLAY" + ) + + valueText:SetFont( + pfUI.font_default, + pfUI_config.global.font_size - 1, + "OUTLINE" + ) + + valueText:SetJustifyH("RIGHT") + + valueText:SetWidth(34) + + valueText:SetPoint( + "RIGHT", + frame, + "RIGHT", + 0, + 0 + ) + + valueText:SetText( + math.floor(value * 100 + 0.5) .. "%" + ) + + + ---------------------------------------------------- + -- Slider value changed. + ---------------------------------------------------- + + slider:SetScript( + "OnValueChanged", + function() + + local raw = this:GetValue() + + ------------------------------------------------ + -- Round to 5%. + ------------------------------------------------ + + local newValue = + math.floor(raw * 20 + 0.5) / 20 + + if newValue < 0 then + newValue = 0 + elseif newValue > 1 then + newValue = 1 + end + + + ------------------------------------------------ + -- Prevent unnecessary recursion. + ------------------------------------------------ + + if math.abs(raw - newValue) > 0.001 then + + this:SetValue(newValue) + + return + end + + + ------------------------------------------------ + -- Save value. + ------------------------------------------------ + + category[config] = string.format( + "%.2f", + newValue + ) + + + ------------------------------------------------ + -- Update visible percentage. + ------------------------------------------------ + + if valueText then + valueText:SetText( + math.floor(newValue * 100 + 0.5) + .. "%" + ) + end + + + ------------------------------------------------ + -- Tell pfUI that configuration changed. + ------------------------------------------------ + + if pfUI.events + and pfUI.events.TriggerEvent then + + pfUI.events:TriggerEvent( + "config:changed", + category, + config + ) + + else + + pfUI.gui.settingChanged = true + + end + + end + ) + + + ---------------------------------------------------- + -- Mouse wheel support. + ---------------------------------------------------- + + slider:EnableMouseWheel(true) + + slider:SetScript( + "OnMouseWheel", + function() + + local current = this:GetValue() + + local step = 0.05 + + if arg1 > 0 then + current = current + step + else + current = current - step + end + + if current < 0 then + current = 0 + elseif current > 1 then + current = 1 + end + + this:SetValue(current) + + end + ) + + + ---------------------------------------------------- + -- Store references. + ---------------------------------------------------- + + frame.input = slider + frame.value = valueText + + return frame + + end + + + -------------------------------------------------------- + -- GENERAL + -------------------------------------------------------- + + CreateGUIEntry( + "DQB", + "General", + function() + + CreateConfig( + nil, + "Enable DQB", + pfUI_config.dqb.general, + "enable", + "checkbox" + ) + + end + ) + + + -------------------------------------------------------- + -- QUEST & GOSSIP + -------------------------------------------------------- + + CreateGUIEntry( + "DQB", + "Quest & Gossip", + function() + + ------------------------------------------------ + -- PRESETS + ------------------------------------------------ + + CreateConfig( + nil, + "Remove Blizzard Skin and apply pfUI Style", + pfUI_config.dqb.questgossip, + "pfui_style", + "checkbox" + ) + + CreateConfig( + nil, + "Fix Fonts", + pfUI_config.dqb.questgossip, + "fix_fonts", + "checkbox" + ) + + + ------------------------------------------------ + -- CUSTOM + ------------------------------------------------ + + CreateConfig( + nil, + "Remove Blizzard Parchment Texture", + pfUI_config.dqb.questgossip.custom, + "remove_parchment", + "checkbox" + ) + + CreateConfig( + nil, + "Background Color", + pfUI_config.dqb.questgossip.custom, + "background_color", + "color" + ) + + CreateOpacitySlider( + "Background Opacity", + pfUI_config.dqb.questgossip.custom, + "background_alpha" + ) + + ------------------------------------------------ + -- USE PFUI FONT DROPDOWN + ------------------------------------------------ + + CreateConfig( + nil, + "Fonts", + pfUI_config.dqb.questgossip.custom, + "font", + "dropdown", + pfUI.gui.dropdowns.fonts + ) + + CreateConfig( + nil, + "Title Color", + pfUI_config.dqb.questgossip.custom, + "title_color", + "color" + ) + + CreateConfig( + nil, + "Text Color", + pfUI_config.dqb.questgossip.custom, + "text_color", + "color" + ) + + end + ) + + + -------------------------------------------------------- + -- QUEST LOG + -------------------------------------------------------- + + CreateGUIEntry( + "DQB", + "Quest Log", + function() + + ------------------------------------------------ + -- PRESETS + ------------------------------------------------ + + CreateConfig( + nil, + "Remove Blizzard Skin and apply pfUI Style", + pfUI_config.dqb.questlog, + "pfui_style", + "checkbox" + ) + + CreateConfig( + nil, + "Fix Fonts", + pfUI_config.dqb.questlog, + "fix_fonts", + "checkbox" + ) + + + ------------------------------------------------ + -- CUSTOM + ------------------------------------------------ + + CreateConfig( + nil, + "Remove Blizzard Parchment Texture", + pfUI_config.dqb.questlog.custom, + "remove_parchment", + "checkbox" + ) + + CreateConfig( + nil, + "Background Color", + pfUI_config.dqb.questlog.custom, + "background_color", + "color" + ) + + CreateOpacitySlider( + "Background Opacity", + pfUI_config.dqb.questlog.custom, + "background_alpha" + ) + + ------------------------------------------------ + -- USE PFUI FONT DROPDOWN + ------------------------------------------------ + + CreateConfig( + nil, + "Fonts", + pfUI_config.dqb.questlog.custom, + "font", + "dropdown", + pfUI.gui.dropdowns.fonts + ) + + CreateConfig( + nil, + "Title Color", + pfUI_config.dqb.questlog.custom, + "title_color", + "color" + ) + + CreateConfig( + nil, + "Text Color", + pfUI_config.dqb.questlog.custom, + "text_color", + "color" + ) + + end + ) + + + -------------------------------------------------------- + -- BOOKS + -------------------------------------------------------- + -- + -- Books corresponds to the original pfUI itemtext.lua. + -------------------------------------------------------- + + CreateGUIEntry( + "DQB", + "Books", + function() + + ------------------------------------------------ + -- PRESETS + ------------------------------------------------ + + CreateConfig( + nil, + "Remove Blizzard Skin and apply pfUI Style", + pfUI_config.dqb.books, + "pfui_style", + "checkbox" + ) + + CreateConfig( + nil, + "Fix Fonts", + pfUI_config.dqb.books, + "fix_fonts", + "checkbox" + ) + + + ------------------------------------------------ + -- CUSTOM + ------------------------------------------------ + + CreateConfig( + nil, + "Remove Blizzard Parchment Texture", + pfUI_config.dqb.books.custom, + "remove_parchment", + "checkbox" + ) + + CreateConfig( + nil, + "Background Color", + pfUI_config.dqb.books.custom, + "background_color", + "color" + ) + + CreateOpacitySlider( + "Background Opacity", + pfUI_config.dqb.books.custom, + "background_alpha" + ) + + ------------------------------------------------ + -- USE PFUI FONT DROPDOWN + ------------------------------------------------ + + CreateConfig( + nil, + "Fonts", + pfUI_config.dqb.books.custom, + "font", + "dropdown", + pfUI.gui.dropdowns.fonts + ) + + CreateConfig( + nil, + "Title Color", + pfUI_config.dqb.books.custom, + "title_color", + "color" + ) + + CreateConfig( + nil, + "Text Color", + pfUI_config.dqb.books.custom, + "text_color", + "color" + ) + + end + ) + + + -------------------------------------------------------- + -- MERCHANT + -------------------------------------------------------- + -- + -- Intentionally not configured yet. + -- Merchant remains untouched for now. + -------------------------------------------------------- + +end + + +------------------------------------------------------------ +-- Compatibility with core.lua +------------------------------------------------------------ + +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) \ No newline at end of file diff --git a/modules/gossipquest.lua b/modules/gossipquest.lua new file mode 100644 index 0000000..bb72d17 --- /dev/null +++ b/modules/gossipquest.lua @@ -0,0 +1,1449 @@ +```lua +------------------------------------------------------------ +-- pfUI-DQB +-- modules/gossipquest.lua +-- +-- DQB Quest & Gossip module. +-- +-- This module is based on the original pfUI +-- "Gossip and Quest" skin, but is completely controlled +-- by pfUI-DQB configuration. +-- +-- The original pfUI files are NOT modified. +------------------------------------------------------------ + + +local DQB = pfUI and pfUI.dqb + +if not DQB then + return +end + + +------------------------------------------------------------ +-- Register module +------------------------------------------------------------ + +DQB:RegisterModule("GossipQuest", function() + + -------------------------------------------------------- + -- Make sure pfUI is available + -------------------------------------------------------- + + if not pfUI then + return + end + + + -------------------------------------------------------- + -- Configuration + -------------------------------------------------------- + + local config = pfUI_config + and pfUI_config.dqb + and pfUI_config.dqb.questgossip + + + if not config then + return + end + + + -------------------------------------------------------- + -- Custom configuration + -------------------------------------------------------- + + local custom = config.custom or {} + + + -------------------------------------------------------- + -- Presets + -------------------------------------------------------- + + local usePfUIStyle = + config.pfui_style == "1" + + local fixFonts = + config.fix_fonts == "1" + + + -------------------------------------------------------- + -- Custom options + -------------------------------------------------------- + + local removeParchment = + custom.remove_parchment == "1" + + local backgroundColor = + custom.background_color or "000000" + + local backgroundAlpha = + tonumber(custom.background_alpha) or 0.85 + + local customFont = + custom.font + + local titleColor = + custom.title_color or "ffd700" + + local textColor = + custom.text_color or "ffffff" + + + -------------------------------------------------------- + -- Convert hex color to RGB + -------------------------------------------------------- + + local function HexToRGB(hex) + + if not hex then + return 1, 1, 1 + end + + hex = string.gsub(hex, "#", "") + + if string.len(hex) ~= 6 then + return 1, 1, 1 + end + + local r = tonumber( + string.sub(hex, 1, 2), + 16 + ) + + local g = tonumber( + string.sub(hex, 3, 4), + 16 + ) + + local b = tonumber( + string.sub(hex, 5, 6), + 16 + ) + + if not r or not g or not b then + return 1, 1, 1 + end + + return r / 255, + g / 255, + b / 255 + + end + + + -------------------------------------------------------- + -- Colors + -------------------------------------------------------- + + local titleR, + titleG, + titleB = + HexToRGB(titleColor) + + + local textR, + textG, + textB = + HexToRGB(textColor) + + + local bgR, + bgG, + bgB = + HexToRGB(backgroundColor) + + + -------------------------------------------------------- + -- Frames + -------------------------------------------------------- + + local frames = { + "Quest", + "Gossip" + } + + + -------------------------------------------------------- + -- Panels + -------------------------------------------------------- + + local panels = { + "Greeting", + "Detail", + "Progress", + "Reward" + } + + + -------------------------------------------------------- + -- Buttons + -------------------------------------------------------- + + local buttons = { + + QuestFrameGreetingGoodbyeButton, + GossipFrameGreetingGoodbyeButton, + + QuestFrameDeclineButton, + QuestFrameAcceptButton, + + QuestFrameGoodbyeButton, + QuestFrameCompleteButton, + + QuestFrameCancelButton, + QuestFrameCompleteQuestButton + + } + + + -------------------------------------------------------- + -- Text helpers + -------------------------------------------------------- + + local function SetTextColor( + text, + r, + g, + b + ) + + if not text then + return + end + + text:SetTextColor( + r, + g, + b, + 1 + ) + + text:SetShadowColor( + 0, + 0, + 0, + 1 + ) + + text:SetShadowOffset( + 1, + -1 + ) + + end + + + -------------------------------------------------------- + -- White text + -------------------------------------------------------- + + local function SetWhite(text) + + SetTextColor( + text, + textR, + textG, + textB + ) + + end + + + -------------------------------------------------------- + -- Gold/title text + -------------------------------------------------------- + + local function SetGold(text) + + SetTextColor( + text, + titleR, + titleG, + titleB + ) + + end + + + -------------------------------------------------------- + -- Apply configured font + -------------------------------------------------------- + + local function SetFont(text) + + if not text then + return + end + + if not customFont + or customFont == "" then + + return + end + + local currentSize + + if text.GetFont then + + local font, + size, + flags = + text:GetFont() + + currentSize = size + + if not currentSize then + currentSize = 12 + end + + text:SetFont( + customFont, + currentSize, + flags or "" + ) + + end + + end + + + -------------------------------------------------------- + -- Apply font + text color + -------------------------------------------------------- + + local function SetConfiguredText(text) + + if not text then + return + end + + SetWhite(text) + + SetFont(text) + + end + + + -------------------------------------------------------- + -- Button text + -------------------------------------------------------- + + local function SetButtonText(button) + + if not button then + return + end + + + local text = + button:GetFontString() + + + if text then + + SetConfiguredText(text) + + end + + + if button.normalText then + + SetConfiguredText( + button.normalText + ) + + end + + + if button.highlightText then + + SetConfiguredText( + button.highlightText + ) + + end + + + if button.disabledText then + + SetConfiguredText( + button.disabledText + ) + + end + + + local regions = { + button:GetRegions() + } + + + for _, region in pairs(regions) do + + if region + and region:GetObjectType() + == "FontString" then + + SetConfiguredText(region) + + end + + end + + end + + + -------------------------------------------------------- + -- Gossip / Quest buttons + -------------------------------------------------------- + + local function SetGossipButtons() + + for i = 1, 32 do + + SetButtonText( + _G["GossipTitleButton" .. i] + ) + + SetButtonText( + _G["QuestTitleButton" .. i] + ) + + end + + end + + + -------------------------------------------------------- + -- Detect "Objectives" title + -------------------------------------------------------- + + local function SetObjectivesTitle(frame) + + if not frame then + return + end + + + local regions = { + frame:GetRegions() + } + + + for _, region in pairs(regions) do + + if region + and region:GetObjectType() + == "FontString" then + + local text = + region:GetText() + + + if text then + + local lower = + string.lower(text) + + + if string.find( + lower, + "quest objectives" + ) + or lower == "objectives:" + or lower == "objectives" then + + SetGold(region) + + if fixFonts then + SetFont(region) + end + + end + + end + + end + + end + + + local children = { + frame:GetChildren() + } + + + for _, child in pairs(children) do + + SetObjectivesTitle(child) + + end + + end + + + -------------------------------------------------------- + -- Detect "Rewards" title + -------------------------------------------------------- + + local function SetRewardsTitle(frame) + + if not frame then + return + end + + + local regions = { + frame:GetRegions() + } + + + for _, region in pairs(regions) do + + if region + and region:GetObjectType() + == "FontString" then + + local text = + region:GetText() + + + if text then + + local lower = + string.lower(text) + + + if lower == "rewards" + or lower == "rewards:" then + + SetGold(region) + + if fixFonts then + SetFont(region) + end + + end + + end + + end + + end + + + local children = { + frame:GetChildren() + } + + + for _, child in pairs(children) do + + SetRewardsTitle(child) + + end + + end + + + -------------------------------------------------------- + -- Quest text + -------------------------------------------------------- + + local function SetQuestText() + + ---------------------------------------------------- + -- Titles + ---------------------------------------------------- + + SetGold(QuestTitleText) + SetGold(QuestProgressTitleText) + SetGold(QuestRewardTitleText) + + SetGold(QuestProgressRequiredItemsText) + + + ---------------------------------------------------- + -- Normal text + ---------------------------------------------------- + + SetConfiguredText( + QuestDescriptionText + ) + + SetConfiguredText( + QuestProgressText + ) + + SetConfiguredText( + QuestProgressRequiredMoneyText + ) + + SetConfiguredText( + QuestRewardText + ) + + SetConfiguredText( + QuestRewardRewardTitleText + ) + + SetConfiguredText( + QuestRewardItemChooseText + ) + + SetConfiguredText( + QuestRewardItemReceiveText + ) + + SetConfiguredText( + QuestRewardSpellLearnText + ) + + SetConfiguredText( + QuestDetailItemReceiveText + ) + + SetConfiguredText( + QuestDetailSpellLearnText + ) + + SetConfiguredText( + GreetingText + ) + + SetConfiguredText( + GossipGreetingText + ) + + SetConfiguredText( + CurrentQuestsText + ) + + SetConfiguredText( + AvailableQuestsText + ) + + SetConfiguredText( + QuestObjectiveText + ) + + SetConfiguredText( + QuestObjectivesText + ) + + SetConfiguredText( + QuestObjectiveTitleText + ) + + SetConfiguredText( + QuestObjectivesTitleText + ) + + + ---------------------------------------------------- + -- NPC names + ---------------------------------------------------- + + SetConfiguredText( + QuestFrameNpcNameText + ) + + SetConfiguredText( + GossipFrameNpcNameText + ) + + + ---------------------------------------------------- + -- Gossip buttons + ---------------------------------------------------- + + SetGossipButtons() + + + ---------------------------------------------------- + -- Special titles + ---------------------------------------------------- + + SetObjectivesTitle( + QuestFrame + ) + + SetObjectivesTitle( + GossipFrame + ) + + SetRewardsTitle( + QuestFrame + ) + + SetRewardsTitle( + GossipFrame + ) + + end + + + -------------------------------------------------------- + -- Skin buttons + -------------------------------------------------------- + + if usePfUIStyle then + + for _, button in pairs(buttons) do + + if button then + SkinButton(button) + end + + end + + end + + + -------------------------------------------------------- + -- Quest reward highlight + -------------------------------------------------------- + + local QuestRewardItemHighlight + + + if usePfUIStyle + and QuestRewardScrollChildFrame then + + if QuestRewardItemHighlight then + QuestRewardItemHighlight:Hide() + end + + + if _G["QuestRewardItemHighlight"] then + + StripTextures( + _G["QuestRewardItemHighlight"] + ) + + end + + + QuestRewardItemHighlight = + CreateFrame( + "Frame", + nil, + QuestRewardScrollChildFrame + ) + + + local bg = + QuestRewardItemHighlight:CreateTexture( + nil, + "OVERLAY" + ) + + + bg:SetTexture( + 1, + 1, + 1, + 0.2 + ) + + + bg:SetAllPoints() + + + QuestRewardItemHighlight.bg = + bg + + + QuestRewardItemHighlight:Hide() + + end + + + -------------------------------------------------------- + -- Quest update hook + -------------------------------------------------------- + + if QuestRewardItemHighlight then + + hooksecurefunc( + "QuestFrameItems_Update", + function() + + QuestRewardItemHighlight:Hide() + + SetQuestText() + + end + ) + + else + + hooksecurefunc( + "QuestFrameItems_Update", + function() + + SetQuestText() + + end + ) + + end + + + -------------------------------------------------------- + -- Quest reward click + -------------------------------------------------------- + + if QuestRewardItemHighlight then + + hooksecurefunc( + "QuestRewardItem_OnClick", + function() + + if this + and this.type == "choice" then + + if this.backdrop then + + QuestRewardItemHighlight:SetAllPoints( + this.backdrop + ) + + QuestRewardItemHighlight:Show() + + end + + end + + end + ) + + end + + + -------------------------------------------------------- + -- Blizzard quest color hooks + -------------------------------------------------------- + + if QuestFrame_SetTextColor then + + hooksecurefunc( + "QuestFrame_SetTextColor", + function(text) + + SetConfiguredText(text) + + end + ) + + end + + + if QuestFrame_SetTitleTextColor then + + hooksecurefunc( + "QuestFrame_SetTitleTextColor", + function(text) + + SetConfiguredText(text) + + end + ) + + end + + + -------------------------------------------------------- + -- Quest information update + -------------------------------------------------------- + + if QuestInfo_Display then + + hooksecurefunc( + "QuestInfo_Display", + function() + + SetQuestText() + + end + ) + + end + + + -------------------------------------------------------- + -- Gossip updates + -------------------------------------------------------- + + if GossipFrameUpdate then + + hooksecurefunc( + "GossipFrameUpdate", + function() + + SetQuestText() + SetGossipButtons() + + end + ) + + end + + + if GossipFrameAvailableQuestsUpdate then + + hooksecurefunc( + "GossipFrameAvailableQuestsUpdate", + function() + + SetGossipButtons() + + end + ) + + end + + + if GossipFrameActiveQuestsUpdate then + + hooksecurefunc( + "GossipFrameActiveQuestsUpdate", + function() + + SetGossipButtons() + + end + ) + + end + + + if GossipFrameOptionsUpdate then + + hooksecurefunc( + "GossipFrameOptionsUpdate", + function() + + SetGossipButtons() + + end + ) + + end + + + -------------------------------------------------------- + -- Quest panel hooks + -------------------------------------------------------- + + if QuestFrameGreetingPanel_OnShow then + + hooksecurefunc( + "QuestFrameGreetingPanel_OnShow", + function() + + SetQuestText() + SetGossipButtons() + + end + ) + + end + + + if QuestFrameDetailPanel_OnShow then + + hooksecurefunc( + "QuestFrameDetailPanel_OnShow", + function() + + SetQuestText() + + end + ) + + end + + + if QuestFrameProgressPanel_OnShow then + + hooksecurefunc( + "QuestFrameProgressPanel_OnShow", + function() + + SetQuestText() + + end + ) + + end + + + if QuestFrameRewardPanel_OnShow then + + hooksecurefunc( + "QuestFrameRewardPanel_OnShow", + function() + + SetQuestText() + + SetRewardsTitle( + QuestRewardScrollChildFrame + ) + + SetRewardsTitle( + QuestFrameRewardPanel + ) + + end + ) + + end + + + -------------------------------------------------------- + -- Quest item frames + -------------------------------------------------------- + + if usePfUIStyle then + + for _, baseName in pairs({ + + "QuestProgressItem", + "QuestDetailItem", + "QuestRewardItem" + + }) do + + for i = 1, 6 do + + local name = + baseName .. i + + + local item = + _G[name] + + local icon = + _G[name .. "IconTexture"] + + local count = + _G[name .. "Count"] + + local title = + _G[name .. "Name"] + + + if item + and icon + and count + and title then + + local xsize = + item:GetWidth() - 12 + + local ysize = + item:GetHeight() - 12 + + + item:SetWidth(xsize) + + + StripTextures(item) + + + CreateBackdrop( + item, + nil, + nil, + 0.75 + ) + + + SetAllPointsOffset( + item.backdrop, + item, + 4 + ) + + + SetHighlight(item) + + + icon:SetWidth(ysize) + icon:SetHeight(ysize) + + + icon:ClearAllPoints() + + + icon:SetPoint( + "LEFT", + 6, + 0 + ) + + + icon:SetTexCoord( + 0.08, + 0.92, + 0.08, + 0.92 + ) + + + icon:SetParent( + item.backdrop + ) + + + icon:SetDrawLayer( + "OVERLAY" + ) + + + count:SetParent( + item.backdrop + ) + + + count:SetDrawLayer( + "OVERLAY" + ) + + + title:SetParent( + item.backdrop + ) + + + title:SetDrawLayer( + "OVERLAY" + ) + + + SetConfiguredText(title) + + end + + end + + end + + end + + + -------------------------------------------------------- + -- Frame styling + -------------------------------------------------------- + + if usePfUIStyle then + + for _, frameName in pairs(frames) do + + local frame = + _G[frameName .. "Frame"] + + + if frame then + + local NPCName = + _G[ + frame:GetName() + .. "NpcNameText" + ] + + + ------------------------------------------------ + -- Main frame + ------------------------------------------------ + + CreateBackdrop( + frame, + nil, + nil, + 0.75 + ) + + + CreateBackdropShadow(frame) + + + frame.backdrop:SetPoint( + "TOPLEFT", + 12, + -18 + ) + + + frame.backdrop:SetPoint( + "BOTTOMRIGHT", + -28, + 66 + ) + + + frame:SetHitRectInsets( + 12, + 28, + 18, + 66 + ) + + + EnableMovable(frame) + + + ------------------------------------------------ + -- Close button + ------------------------------------------------ + + local closeButton = + _G[ + frame:GetName() + .. "CloseButton" + ] + + + if closeButton then + + SkinCloseButton( + closeButton, + frame.backdrop, + -6, + -6 + ) + + end + + + ------------------------------------------------ + -- Portrait + ------------------------------------------------ + + local portrait = + _G[ + frame:GetName() + .. "Portrait" + ] + + + if portrait then + portrait:Hide() + end + + + ------------------------------------------------ + -- NPC name + ------------------------------------------------ + + if NPCName then + + NPCName:ClearAllPoints() + + + NPCName:SetPoint( + "TOP", + frame.backdrop, + "TOP", + 0, + -10 + ) + + + SetConfiguredText( + NPCName + ) + + end + + + ------------------------------------------------ + -- Panels + ------------------------------------------------ + + for _, panelName in pairs(panels) do + + if frameName == "Gossip" + and panelName ~= "Greeting" then + + break + + end + + + local fname = + frame:GetName() + .. panelName + .. "Panel" + + + local panel = + _G[fname] + + + if panel then + + StripTextures(panel) + + + local scroll = + _G[ + frameName + .. panelName + .. "ScrollFrame" + ] + + + if scroll then + + scroll:SetHeight(330) + + + local scrollbar = + _G[ + scroll:GetName() + .. "ScrollBar" + ] + + + if scrollbar then + + SkinScrollbar( + scrollbar + ) + + end + + + CreateBackdrop( + scroll, + nil, + true, + 0 + ) + + + ------------------------------------------------ + -- Custom background + ------------------------------------------------ + + local bg = + scroll:CreateTexture( + nil, + "LOW" + ) + + + bg:SetAllPoints() + + + if removeParchment then + + bg:SetTexture( + bgR, + bgG, + bgB, + backgroundAlpha + ) + + else + + bg:SetTexture( + 0, + 0, + 0, + backgroundAlpha + ) + + end + + + scroll.dqbBackground = + bg + + + ------------------------------------------------ + -- Remove Blizzard parchment pieces + ------------------------------------------------ + + local topLeft = + _G[ + fname + .. "MaterialTopLeft" + ] + + local topRight = + _G[ + fname + .. "MaterialTopRight" + ] + + local botLeft = + _G[ + fname + .. "MaterialBotLeft" + ] + + local botRight = + _G[ + fname + .. "MaterialBotRight" + ] + + + if removeParchment then + + if topLeft then + topLeft:Hide() + end + + if topRight then + topRight:Hide() + end + + if botLeft then + botLeft:Hide() + end + + if botRight then + botRight:Hide() + end + + end + + end + + end + + end + + end + + end + + end + + + -------------------------------------------------------- + -- Initial text pass + -------------------------------------------------------- + + SetQuestText() + + + -------------------------------------------------------- + -- Debug + -------------------------------------------------------- + + if DQB.Debug then + + DQB:Debug( + "GossipQuest module applied" + ) + + end + +end) +``` diff --git a/pfUI-DQB.toc b/pfUI-DQB.toc new file mode 100644 index 0000000..aacd737 --- /dev/null +++ b/pfUI-DQB.toc @@ -0,0 +1,11 @@ +## 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 +modules\gossipquest.lua \ No newline at end of file