Added new throttle option for nameplate castbar

This commit is contained in:
Meow
2026-03-21 08:05:45 +01:00
parent 1402818e62
commit a7bfff5d33
3 changed files with 52 additions and 4 deletions
+2
View File
@@ -33,6 +33,7 @@ libthrottle.presetNames = {
libthrottle.defaults = {
nameplates = "custom",
nameplates_target = "custom",
nameplates_castbar = "custom",
nameplates_mass = "custom",
tooltip_cursor = "custom",
chat_tab = "custom",
@@ -159,6 +160,7 @@ libthrottle:SetScript("OnEvent", function()
-- Set defaults for custom fields if missing
if not _G.pfUI_throttle.nameplates_target_custom then _G.pfUI_throttle.nameplates_target_custom = "50" end
if not _G.pfUI_throttle.nameplates_custom then _G.pfUI_throttle.nameplates_custom = "10" end
if not _G.pfUI_throttle.nameplates_castbar_custom then _G.pfUI_throttle.nameplates_castbar_custom = "50" end
if not _G.pfUI_throttle.nameplates_mass_custom then _G.pfUI_throttle.nameplates_mass_custom = "7" end
if not _G.pfUI_throttle.tooltip_cursor_custom then _G.pfUI_throttle.tooltip_cursor_custom = "10" end
if not _G.pfUI_throttle.chat_tab_custom then _G.pfUI_throttle.chat_tab_custom = "10" end
+37 -1
View File
@@ -1765,7 +1765,43 @@ pfUI:RegisterModule("gui", "vanilla:tbc", function ()
local spacer2 = CreateConfig(nil, " ", nil, nil, "header")
spacer2:GetParent().objectCount = spacer2:GetParent().objectCount - 1
spacer2:SetHeight(5)
local castbarCustom
CreateConfig(function()
if castbarCustom and castbarCustom.input then
local isCustom = pfUI.throttle:IsCustom("nameplates_castbar")
if not isCustom then
castbarCustom.input:EnableMouse(false)
castbarCustom.input:EnableKeyboard(false)
castbarCustom.input:ClearFocus()
castbarCustom.input:SetTextColor(.5,.5,.5,1)
castbarCustom.input:SetText(tostring(pfUI.throttle:GetFps("nameplates_castbar")))
else
castbarCustom.input:EnableMouse(true)
castbarCustom.input:EnableKeyboard(true)
castbarCustom.input:SetTextColor(.2,1,.8,1)
if _G.pfUI_throttle.nameplates_castbar_custom then
castbarCustom.input:SetText(_G.pfUI_throttle.nameplates_castbar_custom)
end
end
end
end, T["Castbar Plates"], _G.pfUI_throttle, "nameplates_castbar", "dropdown", {
"very_slow:" .. T["Very Slow"] .. " (2 FPS)",
"slow:" .. T["Slow"] .. " (5 FPS)",
"normal:" .. T["Normal"] .. " (10 FPS)",
"fast:" .. T["Fast"] .. " (20 FPS)",
"very_fast:" .. T["Very Fast"] .. " (30 FPS)",
"fastest:" .. T["Fastest"] .. " (50 FPS)",
"custom:" .. T["Custom"],
})
castbarCustom = CreateConfig(nil, T["Custom FPS"], _G.pfUI_throttle, "nameplates_castbar_custom")
local spacer3 = CreateConfig(nil, " ", nil, nil, "header")
spacer3:GetParent().objectCount = spacer3:GetParent().objectCount - 1
spacer3:SetHeight(5)
local massCustom
CreateConfig(function()
+13 -3
View File
@@ -1279,17 +1279,27 @@ nameplates:RegisterEvent("ZONE_CHANGED_NEW_AREA")
local isCasting = nameplate.castbar and nameplate.castbar:IsShown()
local throttle
if target or isCasting then
if target then
throttle = pfUI.throttle:Get("nameplates_target") -- Default: 50 FPS
elseif visiblePlateCount > 20 then
throttle = pfUI.throttle:Get("nameplates_mass") -- Default: 7 FPS for mass pulls
else
throttle = pfUI.throttle:Get("nameplates") -- Default: 10 FPS
end
-- castbar has its own throttle (independent of target throttle)
local castbarThrottle = pfUI.throttle:Get("nameplates_castbar") -- Default: 20 FPS
local castbarReady = (nameplate.castLastTick or 0) + castbarThrottle <= now
if nameplate.castUpdate and castbarReady then
nameplate.castLastTick = now
elseif nameplate.castUpdate and not castbarReady then
nameplate.castUpdate = nil -- defer castUpdate until castbar throttle allows it
end
-- Check for pending event updates (these bypass throttle for immediate response)
-- castUpdate is now handled by its own throttle above, not the general bypass
local hasEventUpdate = nameplate.eventcache or nameplate.auraUpdate or nameplate.castUpdate or nameplate.targetUpdate or nameplate.comboUpdate
-- Event updates bypass throttle
if not hasEventUpdate and (nameplate.lasttick or 0) + throttle > now then return end
nameplate.lasttick = now