castbar: add options to hide spell names and timers

This commit is contained in:
Pizzahawaiii
2022-12-26 10:36:55 +01:00
committed by GitHub
parent 2cae10c82a
commit 0011dab2fb
3 changed files with 26 additions and 8 deletions
+6
View File
@@ -589,18 +589,24 @@ function pfUI:LoadConfig()
pfUI:UpdateConfig("castbar", "player", "width", "-1")
pfUI:UpdateConfig("castbar", "player", "height", "-1")
pfUI:UpdateConfig("castbar", "player", "showicon", "0")
pfUI:UpdateConfig("castbar", "player", "showname", "1")
pfUI:UpdateConfig("castbar", "player", "showtimer", "1")
pfUI:UpdateConfig("castbar", "player", "showlag", "0")
pfUI:UpdateConfig("castbar", "player", "showrank", "0")
pfUI:UpdateConfig("castbar", "target", "hide_pfui", "0")
pfUI:UpdateConfig("castbar", "target", "width", "-1")
pfUI:UpdateConfig("castbar", "target", "height", "-1")
pfUI:UpdateConfig("castbar", "target", "showicon", "0")
pfUI:UpdateConfig("castbar", "target", "showname", "1")
pfUI:UpdateConfig("castbar", "target", "showtimer", "1")
pfUI:UpdateConfig("castbar", "target", "showlag", "0")
pfUI:UpdateConfig("castbar", "target", "showrank", "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", "showname", "1")
pfUI:UpdateConfig("castbar", "focus", "showtimer", "1")
pfUI:UpdateConfig("castbar", "focus", "showlag", "0")
pfUI:UpdateConfig("castbar", "focus", "showrank", "0")
pfUI:UpdateConfig("castbar", nil, "use_unitfonts", "0")
+14 -8
View File
@@ -45,7 +45,6 @@ pfUI:RegisterModule("castbar", "vanilla:tbc", function ()
cb.bar.left:SetFontObject(GameFontWhite)
cb.bar.left:SetTextColor(1,1,1,1)
cb.bar.left:SetFont(font, font_size, "OUTLINE")
cb.bar.left:SetText("left")
cb.bar.left:SetJustifyH("left")
-- text right
@@ -57,7 +56,6 @@ pfUI:RegisterModule("castbar", "vanilla:tbc", function ()
cb.bar.right:SetFontObject(GameFontWhite)
cb.bar.right:SetTextColor(1,1,1,1)
cb.bar.right:SetFont(font, font_size, "OUTLINE")
cb.bar.right:SetText("right")
cb.bar.right:SetJustifyH("right")
cb.bar.lag = cb.bar:CreateTexture(nil, "OVERLAY")
@@ -104,7 +102,7 @@ pfUI:RegisterModule("castbar", "vanilla:tbc", function ()
if this.endTime ~= endTime then
this.bar:SetStatusBarColor(strsplit(",", C.appearance.castbar[(channel and "channelcolor" or "castbarcolor")]))
this.bar:SetMinMaxValues(0, duration / 1000)
this.bar.left:SetText(cast .. rank)
this.bar.left:SetText(this.showname and cast or "" .. rank)
this.fadeout = nil
this.endTime = endTime
@@ -139,11 +137,13 @@ pfUI:RegisterModule("castbar", "vanilla:tbc", function ()
this.bar:SetValue(cur)
if this.delay and this.delay > 0 then
local delay = "|cffffaaaa" .. (channel and "-" or "+") .. round(this.delay,1) .. " |r "
this.bar.right:SetText(delay .. string.format("%.1f",cur) .. " / " .. round(max,1))
else
this.bar.right:SetText(string.format("%.1f",cur) .. " / " .. round(max,1))
if this.showtimer then
if this.delay and this.delay > 0 then
local delay = "|cffffaaaa" .. (channel and "-" or "+") .. round(this.delay,1) .. " |r "
this.bar.right:SetText(delay .. string.format("%.1f",cur) .. " / " .. round(max,1))
else
this.bar.right:SetText(string.format("%.1f",cur) .. " / " .. round(max,1))
end
end
this.fadeout = nil
@@ -196,6 +196,8 @@ pfUI:RegisterModule("castbar", "vanilla:tbc", function ()
if C.castbar.player.hide_pfui == "0" then
pfUI.castbar.player = CreateCastbar("pfPlayerCastbar", UIParent, "player")
pfUI.castbar.player.showicon = C.castbar.player.showicon == "1" and true or nil
pfUI.castbar.player.showname = C.castbar.player.showname == "1" and true or nil
pfUI.castbar.player.showtimer = C.castbar.player.showtimer == "1" and true or nil
pfUI.castbar.player.showlag = C.castbar.player.showlag == "1" and true or nil
pfUI.castbar.player.showrank = C.castbar.player.showrank == "1" and true or nil
pfUI.castbar.player.spacing = default_border * 2 + tonumber(C.unitframes.player.pspace) * GetPerfectPixel()
@@ -221,6 +223,8 @@ pfUI:RegisterModule("castbar", "vanilla:tbc", function ()
if C.castbar.target.hide_pfui == "0" then
pfUI.castbar.target = CreateCastbar("pfTargetCastbar", UIParent, "target")
pfUI.castbar.target.showicon = C.castbar.target.showicon == "1" and true or nil
pfUI.castbar.target.showname = C.castbar.target.showname == "1" and true or nil
pfUI.castbar.target.showtimer = C.castbar.target.showtimer == "1" and true or nil
pfUI.castbar.target.showlag = C.castbar.target.showlag == "1" and true or nil
pfUI.castbar.target.showrank = C.castbar.target.showrank == "1" and true or nil
pfUI.castbar.target.spacing = default_border * 2 + tonumber(C.unitframes.target.pspace) * GetPerfectPixel()
@@ -246,6 +250,8 @@ pfUI:RegisterModule("castbar", "vanilla:tbc", function ()
if C.castbar.focus.hide_pfui == "0" and pfUI.uf.focus then
pfUI.castbar.focus = CreateCastbar("pfFocusCastbar", UIParent, "focus")
pfUI.castbar.focus.showicon = C.castbar.focus.showicon == "1" and true or nil
pfUI.castbar.focus.showname = C.castbar.focus.showname == "1" and true or nil
pfUI.castbar.focus.showtimer = C.castbar.focus.showtimer == "1" and true or nil
pfUI.castbar.focus.showlag = C.castbar.focus.showlag == "1" and true or nil
pfUI.castbar.focus.showrank = C.castbar.focus.showrank == "1" and true or nil
pfUI.castbar.focus.spacing = default_border * 2 + tonumber(C.unitframes.focus.pspace) * GetPerfectPixel()
+6
View File
@@ -2106,6 +2106,8 @@ pfUI:RegisterModule("gui", "vanilla:tbc", function ()
CreateConfig(nil, T["Player Castbar"], nil, nil, "header")
CreateConfig(nil, T["Show Spell Icon"], C.castbar.player, "showicon", "checkbox")
CreateConfig(nil, T["Show Spell Name"], C.castbar.player, "showname", "checkbox")
CreateConfig(nil, T["Show Timer"], C.castbar.player, "showtimer", "checkbox")
CreateConfig(nil, T["Show Lag"], C.castbar.player, "showlag", "checkbox")
CreateConfig(nil, T["Show Rank"], C.castbar.player, "showrank", "checkbox")
CreateConfig(nil, T["Castbar Width"], C.castbar.player, "width")
@@ -2114,6 +2116,8 @@ pfUI:RegisterModule("gui", "vanilla:tbc", function ()
CreateConfig(nil, T["Target Castbar"], nil, nil, "header")
CreateConfig(nil, T["Show Spell Icon"], C.castbar.target, "showicon", "checkbox")
CreateConfig(nil, T["Show Spell Name"], C.castbar.target, "showname", "checkbox")
CreateConfig(nil, T["Show Timer"], C.castbar.target, "showtimer", "checkbox")
CreateConfig(nil, T["Show Lag"], C.castbar.target, "showlag", "checkbox")
CreateConfig(nil, T["Show Rank"], C.castbar.target, "showrank", "checkbox")
CreateConfig(nil, T["Castbar Width"], C.castbar.target, "width")
@@ -2122,6 +2126,8 @@ pfUI:RegisterModule("gui", "vanilla:tbc", function ()
CreateConfig(nil, T["Focus Castbar"], nil, nil, "header")
CreateConfig(nil, T["Show Spell Icon"], C.castbar.focus, "showicon", "checkbox")
CreateConfig(nil, T["Show Spell Name"], C.castbar.focus, "showname", "checkbox")
CreateConfig(nil, T["Show Timer"], C.castbar.focus, "showtimer", "checkbox")
CreateConfig(nil, T["Show Lag"], C.castbar.focus, "showlag", "checkbox")
CreateConfig(nil, T["Show Rank"], C.castbar.focus, "showrank", "checkbox")
CreateConfig(nil, T["Castbar Width"], C.castbar.focus, "width")