mirror of
https://github.com/brues-code/pfUI.git
synced 2026-09-29 18:56:02 +00:00
castbar: add option to display lag
This commit is contained in:
@@ -767,10 +767,12 @@ 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", "showlag", "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", "showlag", "0")
|
||||
pfUI:UpdateConfig("castbar", nil, "use_unitfonts", "0")
|
||||
|
||||
pfUI:UpdateConfig("tooltip", nil, "position", "chat")
|
||||
|
||||
@@ -62,6 +62,11 @@ pfUI:RegisterModule("castbar", 20400, function ()
|
||||
cb.bar.right:SetText("right")
|
||||
cb.bar.right:SetJustifyH("right")
|
||||
|
||||
cb.bar.lag = cb.bar:CreateTexture(nil, "OVERLAY")
|
||||
cb.bar.lag:SetPoint("TOPRIGHT", cb.bar, "TOPRIGHT", 0, 0)
|
||||
cb.bar.lag:SetPoint("BOTTOMRIGHT", cb.bar, "BOTTOMRIGHT", 0, 0)
|
||||
cb.bar.lag:SetTexture(1,.2,.2,.2)
|
||||
|
||||
cb:SetScript("OnUpdate", function()
|
||||
if this.drag and this.drag:IsShown() then
|
||||
this:SetAlpha(1)
|
||||
@@ -116,6 +121,14 @@ pfUI:RegisterModule("castbar", 20400, function ()
|
||||
this.bar:SetPoint("TOPLEFT", this, 0, 0)
|
||||
this.icon:Hide()
|
||||
end
|
||||
|
||||
if this.showlag then
|
||||
local _, _, lag = GetNetStats()
|
||||
local width = duration / this:GetWidth() * lag/100
|
||||
this.bar.lag:SetWidth(width)
|
||||
else
|
||||
this.bar.lag:Hide()
|
||||
end
|
||||
end
|
||||
|
||||
if channel then
|
||||
@@ -178,6 +191,7 @@ pfUI:RegisterModule("castbar", 20400, 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.showlag = C.castbar.player.showlag == "1" and true or nil
|
||||
|
||||
if pfUI.uf.player then
|
||||
local pspace = tonumber(C.unitframes.player.pspace)
|
||||
@@ -201,6 +215,7 @@ pfUI:RegisterModule("castbar", 20400, 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.showlag = C.castbar.target.showlag == "1" and true or nil
|
||||
|
||||
if pfUI.uf.target then
|
||||
local pspace = tonumber(C.unitframes.target.pspace)
|
||||
|
||||
@@ -1784,12 +1784,14 @@ pfUI:RegisterModule("gui", 20400, function ()
|
||||
|
||||
CreateConfig(nil, T["Player Castbar"], nil, nil, "header")
|
||||
CreateConfig(nil, T["Show Spell Icon"], C.castbar.player, "showicon", "checkbox")
|
||||
CreateConfig(nil, T["Show Lag"], C.castbar.player, "showlag", "checkbox")
|
||||
CreateConfig(nil, T["Castbar Width"], C.castbar.player, "width")
|
||||
CreateConfig(nil, T["Castbar Height"], C.castbar.player, "height")
|
||||
CreateConfig(nil, T["Disable Player Castbar"], C.castbar.player, "hide_pfui", "checkbox")
|
||||
|
||||
CreateConfig(nil, T["Target Castbar"], nil, nil, "header")
|
||||
CreateConfig(nil, T["Show Spell Icon"], C.castbar.target, "showicon", "checkbox")
|
||||
CreateConfig(nil, T["Show Lag"], C.castbar.target, "showlag", "checkbox")
|
||||
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")
|
||||
|
||||
Reference in New Issue
Block a user