更新配置相关显示等

This commit is contained in:
rucky
2026-03-20 14:04:51 +08:00
parent 923a1f9ce2
commit 63337b14d2
14 changed files with 886 additions and 98 deletions

View File

@@ -187,6 +187,28 @@ function SFrames:GetAuraTimeLeft(unit, index, isBuff)
end
end
end
-- Nanami-Plates SpellDB: combat log + spell DB tracking (most accurate for debuffs)
if not isBuff and NanamiPlates_SpellDB and NanamiPlates_SpellDB.UnitDebuff then
local effect, rank, tex, stacks, dtype, duration, timeleft, isOwn = NanamiPlates_SpellDB:UnitDebuff(unit, index)
if timeleft and timeleft > 0 then
return timeleft, effect
end
if effect and effect ~= "" and duration and duration > 0
and NanamiPlates_Auras and NanamiPlates_Auras.timers then
local unitKey = (UnitGUID and UnitGUID(unit)) or UnitName(unit) or ""
local cached = NanamiPlates_Auras.timers[unitKey .. "_" .. effect]
if not cached and UnitName(unit) then
cached = NanamiPlates_Auras.timers[UnitName(unit) .. "_" .. effect]
end
if cached and cached.startTime and cached.duration then
local remaining = cached.duration - (GetTime() - cached.startTime)
if remaining > 0 then
return remaining, effect
end
end
end
end
-- Fallback to ShaguTweaks libdebuff if available (Debuffs only usually)
if ShaguTweaks and ShaguTweaks.libdebuff then
@@ -374,6 +396,43 @@ function SFrames:InitSlashCommands()
else
SFrames:Print("ActionBars module unavailable.")
end
elseif cmd == "debugbuffs" or cmd == "db" then
local hex = SFrames.Theme and SFrames.Theme:GetAccentHex() or "ffffb3d9"
DEFAULT_CHAT_FRAME:AddMessage("|c" .. hex .. "[Nanami-UI]|r 当前所有 Buff")
for i = 0, 31 do
local buffIndex = GetPlayerBuff(i, "HELPFUL")
if buffIndex and buffIndex >= 0 then
local name = SFrames:GetBuffName(buffIndex)
local tex = GetPlayerBuffTexture(buffIndex) or "?"
local tl = GetPlayerBuffTimeLeft(buffIndex)
local timeStr = (tl and tl > 0 and tl < 99999) and string.format("%.1fs", tl) or "N/A"
local hidden = SFrames:IsBuffHidden(buffIndex) and "|cffff4444[隐藏]|r" or ""
DEFAULT_CHAT_FRAME:AddMessage(string.format(" #%d: |cffffd100%s|r %s %s", i, name or "(nil)", timeStr, hidden))
end
end
elseif cmd == "hidebuff" or cmd == "hb" then
if args == "" then
SFrames:Print("用法: /nui hidebuff <buff名称>")
else
if not SFramesDB.hiddenBuffs then SFramesDB.hiddenBuffs = {} end
SFramesDB.hiddenBuffs[args] = true
SFrames:Print("已隐藏 Buff: |cffffd100" .. args .. "|r")
end
elseif cmd == "unhidebuff" or cmd == "uhb" then
if args == "" then
SFrames:Print("用法: /nui unhidebuff <buff名称>")
else
if SFramesDB.hiddenBuffs then SFramesDB.hiddenBuffs[args] = nil end
SFrames:Print("已取消隐藏 Buff: |cffffd100" .. args .. "|r")
end
elseif cmd == "listhidden" or cmd == "lh" then
local hex = SFrames.Theme and SFrames.Theme:GetAccentHex() or "ffffb3d9"
DEFAULT_CHAT_FRAME:AddMessage("|c" .. hex .. "[Nanami-UI]|r 已隐藏的 Buff 列表:")
if SFramesDB.hiddenBuffs then
for name, _ in pairs(SFramesDB.hiddenBuffs) do
DEFAULT_CHAT_FRAME:AddMessage(" |cffffd100" .. name .. "|r (用户自定义)")
end
end
elseif cmd == "config" or cmd == "" then
if SFrames.ConfigUI and SFrames.ConfigUI.Build then SFrames.ConfigUI:Build("ui") end
else