mirror of
https://github.com/brues-code/pfUI.git
synced 2026-10-03 04:00:02 +00:00
castbar: add focus-frame castbar
This commit is contained in:
@@ -934,6 +934,11 @@ function pfUI:LoadConfig()
|
||||
pfUI:UpdateConfig("castbar", "target", "height", "-1")
|
||||
pfUI:UpdateConfig("castbar", "target", "showicon", "0")
|
||||
pfUI:UpdateConfig("castbar", "target", "showlag", "0")
|
||||
pfUI:UpdateConfig("castbar", "focus", "hide_pfui", "0")
|
||||
pfUI:UpdateConfig("castbar", "focus", "width", "-1")
|
||||
pfUI:UpdateConfig("castbar", "focus", "height", "-1")
|
||||
pfUI:UpdateConfig("castbar", "focus", "showicon", "0")
|
||||
pfUI:UpdateConfig("castbar", "focus", "showlag", "0")
|
||||
pfUI:UpdateConfig("castbar", nil, "use_unitfonts", "0")
|
||||
|
||||
pfUI:UpdateConfig("tooltip", nil, "position", "chat")
|
||||
|
||||
@@ -236,4 +236,39 @@ pfUI:RegisterModule("castbar", 20400, function ()
|
||||
|
||||
UpdateMovable(pfUI.castbar.target)
|
||||
end
|
||||
|
||||
-- [[ pfFocusCastbar ]] --
|
||||
if C.castbar.focus.hide_pfui == "0" and pfUI.uf.focus then
|
||||
pfUI.castbar.focus = CreateCastbar("pfFocusCastbar", UIParent)
|
||||
pfUI.castbar.focus.showicon = C.castbar.focus.showicon == "1" and true or nil
|
||||
pfUI.castbar.focus.showlag = C.castbar.focus.showlag == "1" and true or nil
|
||||
|
||||
local pspace = tonumber(C.unitframes.focus.pspace)
|
||||
local width = C.castbar.focus.width ~= "-1" and C.castbar.focus.width or pfUI.uf.focus:GetWidth()
|
||||
pfUI.castbar.focus:SetPoint("TOPLEFT", pfUI.uf.focus, "BOTTOMLEFT", 0, -default_border * 2 - pspace)
|
||||
pfUI.castbar.focus:SetWidth(width)
|
||||
|
||||
if C.castbar.focus.height ~= "-1" then
|
||||
pfUI.castbar.focus:SetHeight(C.castbar.focus.height)
|
||||
end
|
||||
|
||||
-- make sure the castbar is set to the same name as the focus frame is
|
||||
HookScript(pfUI.castbar.focus, "OnUpdate", function()
|
||||
-- remove unitname when focus unit changed
|
||||
if this.lastunit ~= pfUI.uf.focus.unitname then
|
||||
this.lastunit = pfUI.uf.focus.unitname
|
||||
pfUI.castbar.focus.unitname = nil
|
||||
end
|
||||
|
||||
-- attach a proper unitname as soon as we get a unitstr
|
||||
if not pfUI.castbar.focus.unitname and pfUI.uf.focus.unitname ~= "focus" and pfUI.uf.focus.label and pfUI.uf.focus.id then
|
||||
local unitstr = string.format("%s%s", pfUI.uf.focus.label, pfUI.uf.focus.id)
|
||||
if UnitExists(unitstr) and strlower(UnitName(unitstr)) == pfUI.uf.focus.unitname then
|
||||
pfUI.castbar.focus.unitname = UnitName(unitstr)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
UpdateMovable(pfUI.castbar.focus)
|
||||
end
|
||||
end)
|
||||
|
||||
@@ -1824,6 +1824,13 @@ pfUI:RegisterModule("gui", 20400, function ()
|
||||
CreateConfig(nil, T["Castbar Width"], C.castbar.target, "width")
|
||||
CreateConfig(nil, T["Castbar Height"], C.castbar.target, "height")
|
||||
CreateConfig(nil, T["Disable Target Castbar"], C.castbar.target, "hide_pfui", "checkbox")
|
||||
|
||||
CreateConfig(nil, T["Focus Castbar"], nil, nil, "header")
|
||||
CreateConfig(nil, T["Show Spell Icon"], C.castbar.focus, "showicon", "checkbox")
|
||||
CreateConfig(nil, T["Show Lag"], C.castbar.focus, "showlag", "checkbox")
|
||||
CreateConfig(nil, T["Castbar Width"], C.castbar.focus, "width")
|
||||
CreateConfig(nil, T["Castbar Height"], C.castbar.focus, "height")
|
||||
CreateConfig(nil, T["Disable Focus Castbar"], C.castbar.focus, "hide_pfui", "checkbox")
|
||||
end)
|
||||
|
||||
CreateGUIEntry(T["Chat"], nil, function()
|
||||
|
||||
Reference in New Issue
Block a user