mirror of
https://github.com/brues-code/pfUI.git
synced 2026-09-22 07:36:56 +00:00
Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 5815b9e81e | |||
| 60f953178f | |||
| 1dc10964a2 | |||
| 0fc08e77c0 | |||
| 7f3795b45b | |||
| 8eee766652 | |||
| 2b5288a688 |
+22
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"runtime": {
|
||||
"version": "Lua 5.1"
|
||||
},
|
||||
"diagnostics": {
|
||||
"disable": ["deprecated"],
|
||||
"globals": [
|
||||
"this",
|
||||
"event",
|
||||
"arg",
|
||||
"arg1",
|
||||
"arg2",
|
||||
"arg3",
|
||||
"arg4",
|
||||
"arg5",
|
||||
"arg6",
|
||||
"arg7",
|
||||
"arg8",
|
||||
"arg9"
|
||||
]
|
||||
}
|
||||
}
|
||||
+91
-21
@@ -63,6 +63,23 @@ pfUI:RegisterModule("chat", function ()
|
||||
return pfUI_cache["chathistory"][realm][player][id]
|
||||
end
|
||||
|
||||
-- [ Chat Panel Colors ]
|
||||
-- The panels normally inherit pfUI's global appearance theme; custom colors let chat
|
||||
-- deviate from it. CreateBackdrop is re-run first to restore the theme, so toggling
|
||||
-- custom colors back off doesn't leave the previous override behind.
|
||||
local function ApplyPanelColors(panel)
|
||||
if not panel then return end
|
||||
|
||||
CreateBackdrop(panel, default_border, nil, .8)
|
||||
if C.chat.global.custombg ~= "1" then return end
|
||||
|
||||
local r, g, b, a = GetStringColor(C.chat.global.background)
|
||||
panel.backdrop:SetBackdropColor(tonumber(r), tonumber(g), tonumber(b), tonumber(a))
|
||||
|
||||
local r, g, b, a = GetStringColor(C.chat.global.border)
|
||||
panel.backdrop:SetBackdropBorderColor(tonumber(r), tonumber(g), tonumber(b), tonumber(a))
|
||||
end
|
||||
|
||||
pfUI.chat = CreateFrame("Frame",nil,UIParent)
|
||||
|
||||
pfUI.chat.left = CreateFrame("Frame", "pfChatLeft", UIParent)
|
||||
@@ -76,19 +93,11 @@ pfUI:RegisterModule("chat", function ()
|
||||
pfUI.chat.left:SetPoint("BOTTOMLEFT", 2*default_border,2*default_border)
|
||||
pfUI.chat.left:SetScript("OnShow", function() pfUI.chat:RefreshChat() end)
|
||||
UpdateMovable(pfUI.chat.left)
|
||||
CreateBackdrop(pfUI.chat.left, default_border, nil, .8)
|
||||
ApplyPanelColors(pfUI.chat.left)
|
||||
if C.chat.global.frameshadow == "1" then
|
||||
CreateBackdropShadow(pfUI.chat.left)
|
||||
end
|
||||
|
||||
if C.chat.global.custombg == "1" then
|
||||
local r, g, b, a = GetStringColor(C.chat.global.background)
|
||||
pfUI.chat.left.backdrop:SetBackdropColor(tonumber(r), tonumber(g), tonumber(b), tonumber(a))
|
||||
|
||||
local r, g, b, a = GetStringColor(C.chat.global.border)
|
||||
pfUI.chat.left.backdrop:SetBackdropBorderColor(tonumber(r), tonumber(g), tonumber(b), tonumber(a))
|
||||
end
|
||||
|
||||
pfUI.chat.left.panelTop = CreateFrame("Frame", "leftChatPanelTop", pfUI.chat.left)
|
||||
pfUI.chat.left.panelTop:ClearAllPoints()
|
||||
pfUI.chat.left.panelTop:SetHeight(C.global.font_size+default_border*2)
|
||||
@@ -251,19 +260,11 @@ pfUI:RegisterModule("chat", function ()
|
||||
pfUI.chat.right:SetPoint("BOTTOMRIGHT", -2*default_border,2*default_border)
|
||||
pfUI.chat.right:SetScript("OnShow", function() pfUI.chat:RefreshChat() end)
|
||||
UpdateMovable(pfUI.chat.right)
|
||||
CreateBackdrop(pfUI.chat.right, default_border, nil, .8)
|
||||
ApplyPanelColors(pfUI.chat.right)
|
||||
if C.chat.global.frameshadow == "1" then
|
||||
CreateBackdropShadow(pfUI.chat.right)
|
||||
end
|
||||
|
||||
if C.chat.global.custombg == "1" then
|
||||
local r, g, b, a = GetStringColor(C.chat.global.background)
|
||||
pfUI.chat.right.backdrop:SetBackdropColor(tonumber(r), tonumber(g), tonumber(b), tonumber(a))
|
||||
|
||||
local r, g, b, a = GetStringColor(C.chat.global.border)
|
||||
pfUI.chat.right.backdrop:SetBackdropBorderColor(tonumber(r), tonumber(g), tonumber(b), tonumber(a))
|
||||
end
|
||||
|
||||
pfUI.chat.right.panelTop = CreateFrame("Frame", "rightChatPanelTop", pfUI.chat.right)
|
||||
pfUI.chat.right.panelTop:ClearAllPoints()
|
||||
pfUI.chat.right.panelTop:SetHeight(C.global.font_size+default_border*2)
|
||||
@@ -296,6 +297,68 @@ pfUI:RegisterModule("chat", function ()
|
||||
end
|
||||
end
|
||||
|
||||
-- [ Chat Background Alpha ]
|
||||
-- Blizzard's per-window transparency slider drives FCF_SetWindowAlpha, which only
|
||||
-- touches the ChatFrame*Background textures that pfUI hides on docked frames. Mirror
|
||||
-- the window's stored alpha onto the visible pfUI backdrop so the native slider
|
||||
-- controls it directly.
|
||||
local function ApplyChatBackgroundAlpha(panel, frame)
|
||||
if not (panel and panel.backdrop and frame) then return end
|
||||
local _, _, _, _, _, alpha = GetChatWindowInfo(frame:GetID())
|
||||
alpha = tonumber(alpha)
|
||||
if not alpha then return end
|
||||
local r, g, b = panel.backdrop:GetBackdropColor()
|
||||
panel.backdrop:SetBackdropColor(r, g, b, alpha)
|
||||
end
|
||||
|
||||
function pfUI.chat:RefreshBackgroundAlpha()
|
||||
-- Custom colors own the alpha. C.chat.global.background carries its own alpha, is
|
||||
-- set by profiles and is shared with the meter skins, so the native slider must not
|
||||
-- overwrite it -- doing so reverted the configured opacity on every refresh. The
|
||||
-- slider only drives the panel when the user hasn't opted into pfUI's chat colors.
|
||||
if C.chat.global.custombg == "1" then return end
|
||||
|
||||
-- left panel follows the currently selected docked tab
|
||||
local selected = SELECTED_CHAT_FRAME
|
||||
if not (selected and selected:GetParent() == pfUI.chat.left) then
|
||||
selected = ChatFrame1
|
||||
end
|
||||
ApplyChatBackgroundAlpha(pfUI.chat.left, selected)
|
||||
|
||||
if C.chat.right.enable == "1" then
|
||||
ApplyChatBackgroundAlpha(pfUI.chat.right, ChatFrame3)
|
||||
end
|
||||
end
|
||||
|
||||
-- live config apply, resolved by the gui as U["chat"]. Lets the color pickers
|
||||
-- take effect on the spot instead of waiting for a /reload.
|
||||
function pfUI.chat:UpdateConfig()
|
||||
ApplyPanelColors(pfUI.chat.left)
|
||||
ApplyPanelColors(pfUI.chat.right)
|
||||
pfUI.chat:RefreshBackgroundAlpha()
|
||||
end
|
||||
|
||||
function pfUI.chat:MigrateBackgroundAlpha()
|
||||
-- Runs once per character. The previous SetupPositions default stored a hard 0 window
|
||||
-- alpha, which now renders the pfUI backdrop fully transparent. Restore the historical
|
||||
-- 0.8 look for any pfUI-managed window still sitting at 0. Only existing installs that
|
||||
-- already ran chat setup carry that legacy 0; fresh installs get 0.8 from SetupPositions.
|
||||
if pfUI_init.chatbgalpha then return end
|
||||
if not pfUI_init["chat_position"] then return end
|
||||
pfUI_init.chatbgalpha = true
|
||||
|
||||
local frames = { ChatFrame1, ChatFrame2 }
|
||||
if C.chat.right.enable == "1" then table.insert(frames, ChatFrame3) end
|
||||
|
||||
for _, frame in ipairs(frames) do
|
||||
local _, _, _, _, _, alpha = GetChatWindowInfo(frame:GetID())
|
||||
alpha = tonumber(alpha)
|
||||
if alpha and alpha <= 0 then
|
||||
FCF_SetWindowAlpha(frame, 0.8)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function pfUI.chat:RefreshChat()
|
||||
local panelheight = C.global.font_size*1.5 + default_border*2 + 2
|
||||
|
||||
@@ -447,9 +510,13 @@ pfUI:RegisterModule("chat", function ()
|
||||
for index, value in pairs(DOCKED_CHAT_FRAMES) do
|
||||
FCF_UpdateButtonSide(value)
|
||||
end
|
||||
|
||||
pfUI.chat:RefreshBackgroundAlpha()
|
||||
end
|
||||
|
||||
hooksecurefunc("FCF_SaveDock", pfUI.chat.RefreshChat)
|
||||
hooksecurefunc("FCF_SetWindowAlpha", function() pfUI.chat:RefreshBackgroundAlpha() end)
|
||||
hooksecurefunc("FCF_SelectDockFrame", function() pfUI.chat:RefreshBackgroundAlpha() end)
|
||||
|
||||
if C.chat.global.tabmouse == "1" then
|
||||
pfUI.chat.mouseovertab = CreateFrame("Frame")
|
||||
@@ -500,7 +567,7 @@ pfUI:RegisterModule("chat", function ()
|
||||
FCF_SetLocked(ChatFrame1, 1)
|
||||
FCF_SetWindowName(ChatFrame1, GENERAL)
|
||||
FCF_SetWindowColor(ChatFrame1, 0, 0, 0)
|
||||
FCF_SetWindowAlpha(ChatFrame1, 0)
|
||||
FCF_SetWindowAlpha(ChatFrame1, 0.8)
|
||||
FCF_SetChatWindowFontSize(ChatFrame1, 12)
|
||||
ChatFrame1:SetUserPlaced(1)
|
||||
|
||||
@@ -508,7 +575,7 @@ pfUI:RegisterModule("chat", function ()
|
||||
FCF_SetLocked(ChatFrame2, 1)
|
||||
FCF_SetWindowName(ChatFrame2, COMBAT_LOG)
|
||||
FCF_SetWindowColor(ChatFrame2, 0, 0, 0)
|
||||
FCF_SetWindowAlpha(ChatFrame2, 0)
|
||||
FCF_SetWindowAlpha(ChatFrame2, 0.8)
|
||||
FCF_SetChatWindowFontSize(ChatFrame2, 12)
|
||||
ChatFrame2:SetUserPlaced(1)
|
||||
|
||||
@@ -518,7 +585,7 @@ pfUI:RegisterModule("chat", function ()
|
||||
FCF_SetLocked(ChatFrame3, 1)
|
||||
FCF_SetWindowName(ChatFrame3, T["Loot & Spam"])
|
||||
FCF_SetWindowColor(ChatFrame3, 0, 0, 0)
|
||||
FCF_SetWindowAlpha(ChatFrame3, 0)
|
||||
FCF_SetWindowAlpha(ChatFrame3, 0.8)
|
||||
FCF_SetChatWindowFontSize(ChatFrame3, 12)
|
||||
FCF_UnDockFrame(ChatFrame3)
|
||||
FCF_SetTabPosition(ChatFrame3, 0)
|
||||
@@ -566,6 +633,9 @@ pfUI:RegisterModule("chat", function ()
|
||||
end
|
||||
|
||||
pfUI.chat:SetScript("OnEvent", function()
|
||||
-- restore legacy chat windows stuck at 0 alpha before anything reads it
|
||||
pfUI.chat:MigrateBackgroundAlpha()
|
||||
|
||||
-- set the default chat
|
||||
FCF_SelectDockFrame(SELECTED_CHAT_FRAME)
|
||||
|
||||
|
||||
+3
-3
@@ -2880,9 +2880,9 @@ pfUI:RegisterModule("gui", function ()
|
||||
CreateConfig(nil, T["Only Show Chat Dock On Mouseover"], C.chat.global, "tabmouse", "checkbox")
|
||||
CreateConfig(nil, T["Enable Chat Tab Flashing"], C.chat.global, "chatflash", "checkbox")
|
||||
CreateConfig(nil, T["Enable Frame Shadow"], C.chat.global, "frameshadow", "checkbox")
|
||||
CreateConfig(nil, T["Enable Custom Colors"], C.chat.global, "custombg", "checkbox")
|
||||
CreateConfig(nil, T["Chat Background Color"], C.chat.global, "background", "color")
|
||||
CreateConfig(nil, T["Chat Border Color"], C.chat.global, "border", "color")
|
||||
CreateConfig(U["chat"], T["Enable Custom Colors"], C.chat.global, "custombg", "checkbox")
|
||||
CreateConfig(U["chat"], T["Chat Background Color"], C.chat.global, "background", "color")
|
||||
CreateConfig(U["chat"], T["Chat Border Color"], C.chat.global, "border", "color")
|
||||
CreateConfig(nil, T["Enable Custom Incoming Whispers Layout"], C.chat.global, "whispermod", "checkbox")
|
||||
CreateConfig(nil, T["Incoming Whispers Color"], C.chat.global, "whisper", "color")
|
||||
CreateConfig(nil, T["Enable Sticky Chat"], C.chat.global, "sticky", "checkbox")
|
||||
|
||||
+19
-10
@@ -1039,13 +1039,29 @@ nameplates:RegisterEvent("PLAYER_GUILD_UPDATE")
|
||||
local mouseover = plate.cachedGuid and plate.cachedGuid == frameState.mouseoverGuid or nil
|
||||
local unitstr = target and "target" or mouseover and "mouseover" or plate.cachedGuid or nil
|
||||
|
||||
-- target event sometimes fires too quickly, where nameplate identifiers are not
|
||||
-- yet updated. So while being inside this event, we cannot trust the unitstr.
|
||||
if event == "PLAYER_TARGET_CHANGED" then unitstr = nil end
|
||||
|
||||
-- remove unitstr when it doesn't resolve to this plate's unit (stale istarget,
|
||||
-- stale mouseover guid or a despawned unit). Must run before the cache fills
|
||||
-- below -- an unrelated unitstr would poison cache.player/minion with the
|
||||
-- *other* unit's answer, and the nil-gate would then never recompute it.
|
||||
if unitstr and UnitName(unitstr) ~= name then unitstr = nil end
|
||||
|
||||
-- resolve player vs npc from plate's own unit so libunitscan can't return
|
||||
-- a player record for an NPC sharing the same name (e.g. Chromie). Stored
|
||||
-- as true/false/nil so it doubles as the GetUnitInfo hint.
|
||||
if plate.cache.player == nil and unitstr then
|
||||
plate.cache.player = UnitIsPlayer(unitstr) and true or false
|
||||
end
|
||||
local class, ulevel, elite, player, guild = GetUnitInfo(name, true, plate.cache.player)
|
||||
if plate.cache.minion == nil and unitstr then
|
||||
plate.cache.minion = UnitIsMinion(unitstr) and true or false
|
||||
end
|
||||
local class, ulevel, elite, player, guild
|
||||
if not plate.cache.minion then
|
||||
class, ulevel, elite, player, guild = GetUnitInfo(name, true, plate.cache.player)
|
||||
end
|
||||
if plate.cache.player ~= nil then player = plate.cache.player or nil end
|
||||
|
||||
-- Use database level ONLY if current level is ?? (fixes ?? after reload, but doesn't override visible levels)
|
||||
@@ -1065,18 +1081,11 @@ nameplates:RegisterEvent("PLAYER_GUILD_UPDATE")
|
||||
if player and unittype == "ENEMY_NPC" then unittype = "ENEMY_PLAYER" end
|
||||
if player and unittype == "FRIENDLY_NPC" then unittype = "FRIENDLY_PLAYER" end
|
||||
elite = plate.original.levelicon:IsShown() and not player and "boss" or elite
|
||||
if not class then plate.wait_for_scan = true end
|
||||
if not class and not plate.cache.minion then plate.wait_for_scan = true end
|
||||
|
||||
-- skip data updates on invisible frames
|
||||
if not visible then return end
|
||||
|
||||
-- target event sometimes fires too quickly, where nameplate identifiers are not
|
||||
-- yet updated. So while being inside this event, we cannot trust the unitstr.
|
||||
if event == "PLAYER_TARGET_CHANGED" then unitstr = nil end
|
||||
|
||||
-- remove unitstr on unit name mismatch
|
||||
if unitstr and UnitName(unitstr) ~= name then unitstr = nil end
|
||||
|
||||
-- always make sure to keep plate visible
|
||||
plate:Show()
|
||||
|
||||
@@ -1551,7 +1560,7 @@ nameplates:RegisterEvent("PLAYER_GUILD_UPDATE")
|
||||
-- otherwise an NPC sharing a name with a known player flips wait_for_scan
|
||||
-- off here, then OnDataChanged re-sets it, every frame until the mob scan
|
||||
-- lands.
|
||||
if nameplate.wait_for_scan and GetUnitInfo(name, true, nameplate.cache.player) then
|
||||
if nameplate.wait_for_scan and not nameplate.cache.minion and GetUnitInfo(name, true, nameplate.cache.player) then
|
||||
nameplate.wait_for_scan = nil
|
||||
update = true
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user