跟随版本 0.8.19

This commit is contained in:
rucky
2026-03-24 15:56:28 +08:00
parent 40d37dc8c4
commit c0f1ecc713
19 changed files with 2227 additions and 259 deletions

View File

@@ -1613,13 +1613,24 @@ function SFrames.Player:CastbarStart(spellName, duration)
cb:SetMinMaxValues(0, cb.maxValue)
cb:SetValue(0)
cb.text:SetText(spellName)
local texture
local _UnitCastingInfo = UnitCastingInfo or (ShaguTweaks and ShaguTweaks.UnitCastingInfo)
if _UnitCastingInfo then
local _, _, _, tex = _UnitCastingInfo("player")
texture = tex
end
if not texture and SFrames.castdb and UnitGUID then
local guid = UnitGUID("player")
if guid and SFrames.castdb[guid] and SFrames.castdb[guid].icon then
texture = SFrames.castdb[guid].icon
end
end
if (not texture or texture == "Interface\\Icons\\INV_Misc_QuestionMark")
and SFrames.GetSpellIcon then
texture = SFrames.GetSpellIcon(spellName) or texture
end
if texture then
cb.icon:SetTexture(texture)
cb.icon:Show()
@@ -1650,13 +1661,24 @@ function SFrames.Player:CastbarChannelStart(duration, spellName)
cb:SetMinMaxValues(0, cb.maxValue)
cb:SetValue(cb.maxValue)
cb.text:SetText(spellName)
local texture
local _UnitChannelInfo = UnitChannelInfo or (ShaguTweaks and ShaguTweaks.UnitChannelInfo)
if _UnitChannelInfo then
local _, _, _, tex = _UnitChannelInfo("player")
texture = tex
end
if not texture and SFrames.castdb and UnitGUID then
local guid = UnitGUID("player")
if guid and SFrames.castdb[guid] and SFrames.castdb[guid].icon then
texture = SFrames.castdb[guid].icon
end
end
if (not texture or texture == "Interface\\Icons\\INV_Misc_QuestionMark")
and SFrames.GetSpellIcon then
texture = SFrames.GetSpellIcon(spellName) or texture
end
if texture then
cb.icon:SetTexture(texture)
cb.icon:Show()
@@ -1714,6 +1736,9 @@ function SFrames.Player:CastbarOnUpdate()
end
cb:SetValue(elapsed)
cb.time:SetText(string.format("%.1f", math.max(cb.maxValue - elapsed, 0)))
if not cb.icon:IsShown() then
self:CastbarTryResolveIcon()
end
elseif cb.channeling then
local timeRemaining = cb.endTime - GetTime()
if timeRemaining <= 0 then
@@ -1724,6 +1749,9 @@ function SFrames.Player:CastbarOnUpdate()
end
cb:SetValue(timeRemaining)
cb.time:SetText(string.format("%.1f", timeRemaining))
if not cb.icon:IsShown() then
self:CastbarTryResolveIcon()
end
elseif cb.fadeOut then
local alpha = cb:GetAlpha() - 0.05
if alpha > 0 then
@@ -1740,3 +1768,41 @@ function SFrames.Player:CastbarOnUpdate()
end
end
end
function SFrames.Player:CastbarTryResolveIcon()
local cb = self.frame.castbar
local spellName = cb.text:GetText()
local texture
if SFrames.castdb and UnitGUID then
local guid = UnitGUID("player")
if guid and SFrames.castdb[guid] then
local entry = SFrames.castdb[guid]
if entry.icon and entry.icon ~= "Interface\\Icons\\INV_Misc_QuestionMark" then
texture = entry.icon
end
end
end
if not texture and NanamiPlates and NanamiPlates.castDB and UnitGUID then
local guid = UnitGUID("player")
if guid and NanamiPlates.castDB[guid] then
local entry = NanamiPlates.castDB[guid]
if entry.icon and entry.icon ~= "Interface\\Icons\\INV_Misc_QuestionMark" then
texture = entry.icon
end
end
end
if not texture and SFrames.GetSpellIcon then
texture = SFrames.GetSpellIcon(spellName)
end
if texture then
cb.icon:SetTexture(texture)
cb.icon:SetAlpha(1)
cb.ibg:SetAlpha(1)
cb.icon:Show()
cb.ibg:Show()
end
end