完成焦点等开发
This commit is contained in:
332
Units/Target.lua
332
Units/Target.lua
@@ -186,13 +186,30 @@ local DIST_BASE_WIDTH = 80
|
||||
local DIST_BASE_HEIGHT = 24
|
||||
local DIST_BASE_FONTSIZE = 14
|
||||
|
||||
-- Check if UnitXP SP3 distance API is available
|
||||
local hasUnitXP = nil -- nil = not checked yet, true/false = cached result
|
||||
local function IsUnitXPAvailable()
|
||||
if hasUnitXP ~= nil then return hasUnitXP end
|
||||
hasUnitXP = (type(UnitXP) == "function") and (pcall(UnitXP, "nop", "nop"))
|
||||
return hasUnitXP
|
||||
end
|
||||
|
||||
function SFrames.Target:GetDistance(unit)
|
||||
if not UnitExists(unit) then return nil end
|
||||
if UnitIsUnit(unit, "player") then return "0 码" end
|
||||
-- Using multiple "scale rulers" (rungs) for better precision in 1.12
|
||||
if CheckInteractDistance(unit, 2) then return "< 8 码" -- Trade
|
||||
elseif CheckInteractDistance(unit, 3) then return "8-10 码" -- Duel
|
||||
elseif CheckInteractDistance(unit, 4) then return "10-28 码" -- Follow
|
||||
|
||||
-- Prefer UnitXP precise distance when available
|
||||
if IsUnitXPAvailable() then
|
||||
local ok, dist = pcall(UnitXP, "distanceBetween", "player", unit)
|
||||
if ok and type(dist) == "number" and dist >= 0 then
|
||||
return string.format("%.1f 码", dist)
|
||||
end
|
||||
end
|
||||
|
||||
-- Fallback: CheckInteractDistance rough ranges
|
||||
if CheckInteractDistance(unit, 2) then return "< 8 码"
|
||||
elseif CheckInteractDistance(unit, 3) then return "8-10 码"
|
||||
elseif CheckInteractDistance(unit, 4) then return "10-28 码"
|
||||
elseif UnitIsVisible(unit) then return "28-100 码"
|
||||
else return "> 100 码" end
|
||||
end
|
||||
@@ -255,6 +272,15 @@ function SFrames.Target:ApplyConfig()
|
||||
f:SetHeight(cfg.height)
|
||||
f:SetAlpha(frameAlpha)
|
||||
|
||||
local bgA = tonumber(db.targetBgAlpha) or 0.9
|
||||
local _A = SFrames.ActiveTheme
|
||||
if _A and _A.panelBg and bgA < 0.89 then
|
||||
if f.SetBackdropColor then f:SetBackdropColor(_A.panelBg[1], _A.panelBg[2], _A.panelBg[3], bgA) end
|
||||
if f.healthBGFrame and f.healthBGFrame.SetBackdropColor then f.healthBGFrame:SetBackdropColor(_A.panelBg[1], _A.panelBg[2], _A.panelBg[3], bgA) end
|
||||
if f.powerBGFrame and f.powerBGFrame.SetBackdropColor then f.powerBGFrame:SetBackdropColor(_A.panelBg[1], _A.panelBg[2], _A.panelBg[3], bgA) end
|
||||
if f.portraitBG and f.portraitBG.SetBackdropColor then f.portraitBG:SetBackdropColor(_A.panelBg[1], _A.panelBg[2], _A.panelBg[3], bgA) end
|
||||
end
|
||||
|
||||
if showPortrait then
|
||||
if f.portrait then
|
||||
f.portrait:SetWidth(cfg.portraitWidth)
|
||||
@@ -362,7 +388,13 @@ function SFrames.Target:ApplyDistanceScale(scale)
|
||||
if f.text then
|
||||
local fontPath = SFrames:GetFont()
|
||||
local outline = (SFrames.Media and SFrames.Media.fontOutline) or "OUTLINE"
|
||||
local fontSize = math.max(8, math.floor(DIST_BASE_FONTSIZE * scale + 0.5))
|
||||
local customSize = SFramesDB and tonumber(SFramesDB.targetDistanceFontSize)
|
||||
local fontSize
|
||||
if customSize and customSize >= 8 and customSize <= 24 then
|
||||
fontSize = math.floor(customSize + 0.5)
|
||||
else
|
||||
fontSize = math.max(8, math.floor(DIST_BASE_FONTSIZE * scale + 0.5))
|
||||
end
|
||||
f.text:SetFont(fontPath, fontSize, outline)
|
||||
end
|
||||
end
|
||||
@@ -405,6 +437,13 @@ function SFrames.Target:InitializeDistanceFrame()
|
||||
f.text:SetShadowColor(0, 0, 0, 1)
|
||||
f.text:SetShadowOffset(1, -1)
|
||||
|
||||
-- Behind indicator text (shown next to distance)
|
||||
f.behindText = SFrames:CreateFontString(f, fontSize, "LEFT")
|
||||
f.behindText:SetPoint("LEFT", f.text, "RIGHT", 4, 0)
|
||||
f.behindText:SetShadowColor(0, 0, 0, 1)
|
||||
f.behindText:SetShadowOffset(1, -1)
|
||||
f.behindText:Hide()
|
||||
|
||||
SFrames.Target.distanceFrame = f
|
||||
f:Hide()
|
||||
|
||||
@@ -416,6 +455,7 @@ function SFrames.Target:InitializeDistanceFrame()
|
||||
end
|
||||
if not UnitExists("target") then
|
||||
if this:IsShown() then this:Hide() end
|
||||
if this.behindText then this.behindText:Hide() end
|
||||
return
|
||||
end
|
||||
this.timer = this.timer + (arg1 or 0)
|
||||
@@ -424,6 +464,28 @@ function SFrames.Target:InitializeDistanceFrame()
|
||||
local dist = SFrames.Target:GetDistance("target")
|
||||
this.text:SetText(dist or "---")
|
||||
if not this:IsShown() then this:Show() end
|
||||
|
||||
-- Behind indicator
|
||||
if this.behindText then
|
||||
local showBehind = not SFramesDB or SFramesDB.Tweaks == nil
|
||||
or SFramesDB.Tweaks.behindIndicator ~= false
|
||||
if showBehind and IsUnitXPAvailable() then
|
||||
local ok, isBehind = pcall(UnitXP, "behind", "player", "target")
|
||||
if ok and isBehind then
|
||||
this.behindText:SetText("背后")
|
||||
this.behindText:SetTextColor(0.2, 1.0, 0.3)
|
||||
this.behindText:Show()
|
||||
elseif ok then
|
||||
this.behindText:SetText("正面")
|
||||
this.behindText:SetTextColor(1.0, 0.35, 0.3)
|
||||
this.behindText:Show()
|
||||
else
|
||||
this.behindText:Hide()
|
||||
end
|
||||
else
|
||||
this.behindText:Hide()
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
end
|
||||
@@ -476,7 +538,23 @@ function SFrames.Target:Initialize()
|
||||
|
||||
f:RegisterForClicks("LeftButtonUp", "RightButtonUp")
|
||||
f:SetScript("OnClick", function()
|
||||
DEFAULT_CHAT_FRAME:AddMessage("|cff00ff00[Nanami] OnClick fired: " .. tostring(arg1) .. "|r")
|
||||
if arg1 == "LeftButton" then
|
||||
-- Shift+左键 = 设为焦点
|
||||
if IsShiftKeyDown() then
|
||||
DEFAULT_CHAT_FRAME:AddMessage("|cff00ff00[Nanami] Shift+LeftButton -> SetFocus|r")
|
||||
if SFrames.Focus and SFrames.Focus.SetFromTarget then
|
||||
local ok, err = pcall(SFrames.Focus.SetFromTarget, SFrames.Focus)
|
||||
if ok then
|
||||
DEFAULT_CHAT_FRAME:AddMessage("|cff00ff00[Nanami] Focus set OK|r")
|
||||
else
|
||||
DEFAULT_CHAT_FRAME:AddMessage("|cffff4444[Nanami] Focus error: " .. tostring(err) .. "|r")
|
||||
end
|
||||
else
|
||||
DEFAULT_CHAT_FRAME:AddMessage("|cffff4444[Nanami] SFrames.Focus missing!|r")
|
||||
end
|
||||
return
|
||||
end
|
||||
if TryDropCursorOnUnit(this.unit) then
|
||||
return
|
||||
end
|
||||
@@ -484,15 +562,132 @@ function SFrames.Target:Initialize()
|
||||
SpellTargetUnit(this.unit)
|
||||
end
|
||||
elseif arg1 == "RightButton" then
|
||||
if SpellIsTargeting() then
|
||||
DEFAULT_CHAT_FRAME:AddMessage("|cff00ff00[Nanami] RightButton hit|r")
|
||||
if SpellIsTargeting and SpellIsTargeting() then
|
||||
SpellStopTargeting()
|
||||
return
|
||||
end
|
||||
HideDropDownMenu(1)
|
||||
TargetFrameDropDown.unit = "target"
|
||||
TargetFrameDropDown.name = UnitName("target")
|
||||
TargetFrameDropDown.initialize = TargetFrameDropDown_Initialize
|
||||
ToggleDropDownMenu(1, nil, TargetFrameDropDown, "SFramesTargetFrame", 120, 10)
|
||||
if not UnitExists("target") then
|
||||
DEFAULT_CHAT_FRAME:AddMessage("|cffff4444[Nanami] No target, abort|r")
|
||||
return
|
||||
end
|
||||
if not SFrames.Target.dropDown then
|
||||
DEFAULT_CHAT_FRAME:AddMessage("|cff00ff00[Nanami] Creating dropdown...|r")
|
||||
local ok1, err1 = pcall(function()
|
||||
SFrames.Target.dropDown = CreateFrame("Frame", "SFramesTargetDropDown", UIParent, "UIDropDownMenuTemplate")
|
||||
end)
|
||||
if not ok1 then
|
||||
DEFAULT_CHAT_FRAME:AddMessage("|cffff4444[Nanami] CreateFrame failed: " .. tostring(err1) .. "|r")
|
||||
return
|
||||
end
|
||||
SFrames.Target.dropDown.displayMode = "MENU"
|
||||
SFrames.Target.dropDown.initialize = function()
|
||||
DEFAULT_CHAT_FRAME:AddMessage("|cff00ff00[Nanami] initialize() called|r")
|
||||
local dd = SFrames.Target.dropDown
|
||||
local name = dd.targetName
|
||||
if not name then
|
||||
DEFAULT_CHAT_FRAME:AddMessage("|cffff4444[Nanami] initialize: no targetName|r")
|
||||
return
|
||||
end
|
||||
|
||||
local info = {}
|
||||
info.text = name
|
||||
info.isTitle = 1
|
||||
info.notCheckable = 1
|
||||
UIDropDownMenu_AddButton(info)
|
||||
|
||||
if UnitIsPlayer("target") and UnitIsFriend("player", "target") and not UnitIsUnit("target", "player") then
|
||||
-- 悄悄话
|
||||
info = {}
|
||||
info.text = "悄悄话"
|
||||
info.notCheckable = 1
|
||||
info.func = function() ChatFrame_SendTell(name) end
|
||||
UIDropDownMenu_AddButton(info)
|
||||
|
||||
-- 组队相关(动态)
|
||||
local inParty = UnitInParty("target")
|
||||
local isLeader = IsPartyLeader()
|
||||
if inParty and isLeader then
|
||||
info = {}
|
||||
info.text = "提升为队长"
|
||||
info.notCheckable = 1
|
||||
info.func = function() PromoteToLeader(name) end
|
||||
UIDropDownMenu_AddButton(info)
|
||||
|
||||
info = {}
|
||||
info.text = "取消邀请"
|
||||
info.notCheckable = 1
|
||||
info.func = function() UninviteByName(name) end
|
||||
UIDropDownMenu_AddButton(info)
|
||||
end
|
||||
|
||||
-- 观察
|
||||
info = {}
|
||||
info.text = "观察"
|
||||
info.notCheckable = 1
|
||||
info.func = function() InspectUnit("target") end
|
||||
UIDropDownMenu_AddButton(info)
|
||||
|
||||
-- 交易
|
||||
info = {}
|
||||
info.text = "交易"
|
||||
info.notCheckable = 1
|
||||
info.func = function() InitiateTrade("target") end
|
||||
UIDropDownMenu_AddButton(info)
|
||||
|
||||
-- 邀请组队(不在队伍中时显示)
|
||||
if not inParty then
|
||||
info = {}
|
||||
info.text = "邀请组队"
|
||||
info.notCheckable = 1
|
||||
info.func = function() InviteByName(name) end
|
||||
UIDropDownMenu_AddButton(info)
|
||||
end
|
||||
|
||||
-- 跟随
|
||||
info = {}
|
||||
info.text = "跟随"
|
||||
info.notCheckable = 1
|
||||
info.func = function() FollowUnit("target") end
|
||||
UIDropDownMenu_AddButton(info)
|
||||
|
||||
-- 决斗(不在队伍中时显示,节省按钮数)
|
||||
if not inParty then
|
||||
info = {}
|
||||
info.text = "决斗"
|
||||
info.notCheckable = 1
|
||||
info.func = function() StartDuel("target") end
|
||||
UIDropDownMenu_AddButton(info)
|
||||
end
|
||||
end
|
||||
|
||||
if SFrames.Focus and SFrames.Focus.GetFocusName then
|
||||
info = {}
|
||||
local ok2, curFocus = pcall(SFrames.Focus.GetFocusName, SFrames.Focus)
|
||||
local isSameTarget = ok2 and curFocus and curFocus == name
|
||||
if isSameTarget then
|
||||
info.text = "取消焦点"
|
||||
info.func = function() pcall(SFrames.Focus.Clear, SFrames.Focus) end
|
||||
else
|
||||
info.text = "设为焦点"
|
||||
info.func = function() pcall(SFrames.Focus.SetFromTarget, SFrames.Focus) end
|
||||
end
|
||||
info.notCheckable = 1
|
||||
UIDropDownMenu_AddButton(info)
|
||||
end
|
||||
|
||||
-- 取消按钮不添加,点击菜单外部即可关闭(节省按钮位)
|
||||
end
|
||||
DEFAULT_CHAT_FRAME:AddMessage("|cff00ff00[Nanami] Dropdown created OK|r")
|
||||
end
|
||||
SFrames.Target.dropDown.targetName = UnitName("target")
|
||||
DEFAULT_CHAT_FRAME:AddMessage("|cff00ff00[Nanami] Calling ToggleDropDownMenu...|r")
|
||||
local ok3, err3 = pcall(ToggleDropDownMenu, 1, nil, SFrames.Target.dropDown, "cursor")
|
||||
if not ok3 then
|
||||
DEFAULT_CHAT_FRAME:AddMessage("|cffff4444[Nanami] ToggleDropDownMenu failed: " .. tostring(err3) .. "|r")
|
||||
else
|
||||
DEFAULT_CHAT_FRAME:AddMessage("|cff00ff00[Nanami] ToggleDropDownMenu OK|r")
|
||||
end
|
||||
end
|
||||
end)
|
||||
f:SetScript("OnReceiveDrag", function()
|
||||
@@ -540,15 +735,23 @@ function SFrames.Target:Initialize()
|
||||
f.health.bg:SetVertexColor(_A.slotBg[1], _A.slotBg[2], _A.slotBg[3], _A.slotBg[4] or 1)
|
||||
|
||||
-- Heal prediction overlay (incoming heals)
|
||||
f.health.healPredMine = f.health:CreateTexture(nil, "OVERLAY")
|
||||
f.health.healPredMine = f.health:CreateTexture(nil, "ARTWORK")
|
||||
f.health.healPredMine:SetTexture(SFrames:GetTexture())
|
||||
f.health.healPredMine:SetVertexColor(0.4, 1.0, 0.55, 0.78)
|
||||
f.health.healPredMine:SetDrawLayer("ARTWORK", 2)
|
||||
f.health.healPredMine:Hide()
|
||||
|
||||
f.health.healPredOther = f.health:CreateTexture(nil, "OVERLAY")
|
||||
f.health.healPredOther = f.health:CreateTexture(nil, "ARTWORK")
|
||||
f.health.healPredOther:SetTexture(SFrames:GetTexture())
|
||||
f.health.healPredOther:SetVertexColor(0.2, 0.9, 0.35, 0.5)
|
||||
f.health.healPredOther:SetDrawLayer("ARTWORK", 2)
|
||||
f.health.healPredOther:Hide()
|
||||
|
||||
f.health.healPredOver = f.health:CreateTexture(nil, "OVERLAY")
|
||||
f.health.healPredOver:SetTexture(SFrames:GetTexture())
|
||||
f.health.healPredOver:SetVertexColor(1.0, 0.3, 0.3, 0.6)
|
||||
f.health.healPredOver:SetDrawLayer("OVERLAY", 7)
|
||||
f.health.healPredOver:Hide()
|
||||
|
||||
-- Power Bar
|
||||
f.power = SFrames:CreateStatusBar(f, "SFramesTargetPower")
|
||||
@@ -645,11 +848,13 @@ function SFrames.Target:Initialize()
|
||||
|
||||
f.unit = "target"
|
||||
f:SetScript("OnEnter", function()
|
||||
if SetMouseoverUnit then SetMouseoverUnit(this.unit) end
|
||||
GameTooltip_SetDefaultAnchor(GameTooltip, this)
|
||||
GameTooltip:SetUnit(this.unit)
|
||||
GameTooltip:Show()
|
||||
end)
|
||||
f:SetScript("OnLeave", function()
|
||||
if SetMouseoverUnit then SetMouseoverUnit() end
|
||||
GameTooltip:Hide()
|
||||
end)
|
||||
|
||||
@@ -1012,13 +1217,15 @@ function SFrames.Target:UpdateHealth()
|
||||
end
|
||||
|
||||
function SFrames.Target:UpdateHealPrediction()
|
||||
if not (self.frame and self.frame.health and self.frame.health.healPredMine and self.frame.health.healPredOther) then return end
|
||||
if not (self.frame and self.frame.health and self.frame.health.healPredMine and self.frame.health.healPredOther and self.frame.health.healPredOver) then return end
|
||||
local predMine = self.frame.health.healPredMine
|
||||
local predOther = self.frame.health.healPredOther
|
||||
local predOver = self.frame.health.healPredOver
|
||||
|
||||
local function HidePredictions()
|
||||
predMine:Hide()
|
||||
predOther:Hide()
|
||||
predOver:Hide()
|
||||
end
|
||||
|
||||
if not UnitExists("target") then
|
||||
@@ -1028,14 +1235,39 @@ function SFrames.Target:UpdateHealPrediction()
|
||||
|
||||
local hp = UnitHealth("target") or 0
|
||||
local maxHp = UnitHealthMax("target") or 0
|
||||
if maxHp <= 0 or hp >= maxHp then
|
||||
|
||||
if CheckSuperWow then
|
||||
local ok, hasSW = pcall(CheckSuperWow)
|
||||
if ok and hasSW then
|
||||
local ok2, realHp = pcall(UnitHealth, "target")
|
||||
if ok2 then
|
||||
hp = realHp or hp
|
||||
end
|
||||
local ok3, realMaxHp = pcall(UnitHealthMax, "target")
|
||||
if ok3 then
|
||||
maxHp = realMaxHp or maxHp
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if maxHp <= 0 then
|
||||
HidePredictions()
|
||||
return
|
||||
end
|
||||
|
||||
local _, mineIncoming, othersIncoming = GetIncomingHeals("target")
|
||||
if CheckSuperWow then
|
||||
local ok, hasSW = pcall(CheckSuperWow)
|
||||
if ok and hasSW then
|
||||
local ok2, _, realMine, realOther = pcall(GetIncomingHeals, "target")
|
||||
if ok2 then
|
||||
mineIncoming = realMine or mineIncoming
|
||||
othersIncoming = realOther or othersIncoming
|
||||
end
|
||||
end
|
||||
end
|
||||
local missing = maxHp - hp
|
||||
if missing <= 0 then
|
||||
if missing <= 0 and (mineIncoming <= 0 and othersIncoming <= 0) then
|
||||
HidePredictions()
|
||||
return
|
||||
end
|
||||
@@ -1043,34 +1275,39 @@ function SFrames.Target:UpdateHealPrediction()
|
||||
local mineShown = math.min(math.max(0, mineIncoming), missing)
|
||||
local remaining = missing - mineShown
|
||||
local otherShown = math.min(math.max(0, othersIncoming), remaining)
|
||||
if mineShown <= 0 and otherShown <= 0 then
|
||||
if mineShown <= 0 and otherShown <= 0 and (mineIncoming <= 0 and othersIncoming <= 0) then
|
||||
HidePredictions()
|
||||
return
|
||||
end
|
||||
|
||||
local barWidth = self.frame.health:GetWidth() or 0
|
||||
local showPortrait = SFramesDB and SFramesDB.targetShowPortrait ~= false
|
||||
local barWidth = self.frame:GetWidth() - (showPortrait and (self.frame.portrait:GetWidth() + 2) or 2)
|
||||
if barWidth <= 0 then
|
||||
HidePredictions()
|
||||
return
|
||||
end
|
||||
|
||||
local currentWidth = math.floor((hp / maxHp) * barWidth + 0.5)
|
||||
local currentWidth = (hp / maxHp) * barWidth
|
||||
if currentWidth < 0 then currentWidth = 0 end
|
||||
if currentWidth > barWidth then currentWidth = barWidth end
|
||||
|
||||
local availableWidth = barWidth - currentWidth
|
||||
if availableWidth <= 0 then
|
||||
if availableWidth <= 0 and (mineIncoming <= 0 and othersIncoming <= 0) then
|
||||
HidePredictions()
|
||||
return
|
||||
end
|
||||
|
||||
local mineWidth = math.floor((mineShown / maxHp) * barWidth + 0.5)
|
||||
local otherWidth = math.floor((otherShown / maxHp) * barWidth + 0.5)
|
||||
if mineWidth < 0 then mineWidth = 0 end
|
||||
if otherWidth < 0 then otherWidth = 0 end
|
||||
if mineWidth > availableWidth then mineWidth = availableWidth end
|
||||
if otherWidth > (availableWidth - mineWidth) then
|
||||
otherWidth = availableWidth - mineWidth
|
||||
local mineWidth = 0
|
||||
local otherWidth = 0
|
||||
if missing > 0 then
|
||||
mineWidth = (mineShown / missing) * availableWidth
|
||||
otherWidth = (otherShown / missing) * availableWidth
|
||||
if mineWidth < 0 then mineWidth = 0 end
|
||||
if otherWidth < 0 then otherWidth = 0 end
|
||||
if mineWidth > availableWidth then mineWidth = availableWidth end
|
||||
if otherWidth > (availableWidth - mineWidth) then
|
||||
otherWidth = availableWidth - mineWidth
|
||||
end
|
||||
end
|
||||
|
||||
if mineWidth > 0 then
|
||||
@@ -1078,6 +1315,7 @@ function SFrames.Target:UpdateHealPrediction()
|
||||
predMine:SetPoint("TOPLEFT", self.frame.health, "TOPLEFT", currentWidth, 0)
|
||||
predMine:SetPoint("BOTTOMLEFT", self.frame.health, "BOTTOMLEFT", currentWidth, 0)
|
||||
predMine:SetWidth(mineWidth)
|
||||
predMine:SetHeight(self.frame.health:GetHeight())
|
||||
predMine:Show()
|
||||
else
|
||||
predMine:Hide()
|
||||
@@ -1088,10 +1326,29 @@ function SFrames.Target:UpdateHealPrediction()
|
||||
predOther:SetPoint("TOPLEFT", self.frame.health, "TOPLEFT", currentWidth + mineWidth, 0)
|
||||
predOther:SetPoint("BOTTOMLEFT", self.frame.health, "BOTTOMLEFT", currentWidth + mineWidth, 0)
|
||||
predOther:SetWidth(otherWidth)
|
||||
predOther:SetHeight(self.frame.health:GetHeight())
|
||||
predOther:Show()
|
||||
else
|
||||
predOther:Hide()
|
||||
end
|
||||
|
||||
local totalIncoming = mineIncoming + othersIncoming
|
||||
local overHeal = totalIncoming - missing
|
||||
if overHeal > 0 then
|
||||
local overWidth = math.floor((overHeal / maxHp) * barWidth + 0.5)
|
||||
if overWidth > 0 then
|
||||
predOver:ClearAllPoints()
|
||||
predOver:SetPoint("TOPLEFT", self.frame.health, "TOPRIGHT", 0, 0)
|
||||
predOver:SetPoint("BOTTOMLEFT", self.frame.health, "BOTTOMRIGHT", 0, 0)
|
||||
predOver:SetWidth(overWidth)
|
||||
predOver:SetHeight(self.frame.health:GetHeight())
|
||||
predOver:Show()
|
||||
else
|
||||
predOver:Hide()
|
||||
end
|
||||
else
|
||||
predOver:Hide()
|
||||
end
|
||||
end
|
||||
|
||||
function SFrames.Target:UpdatePowerType()
|
||||
@@ -1155,7 +1412,7 @@ function SFrames.Target:CreateAuras()
|
||||
self.frame.debuffs = {}
|
||||
|
||||
-- Target Buffs (Top left to right)
|
||||
for i = 1, 16 do
|
||||
for i = 1, 32 do
|
||||
local b = CreateFrame("Button", "SFramesTargetBuff"..i, self.frame)
|
||||
b:SetWidth(AURA_SIZE)
|
||||
b:SetHeight(AURA_SIZE)
|
||||
@@ -1191,7 +1448,7 @@ function SFrames.Target:CreateAuras()
|
||||
end
|
||||
|
||||
-- Target Debuffs (Bottom left to right)
|
||||
for i = 1, 16 do
|
||||
for i = 1, 32 do
|
||||
local b = CreateFrame("Button", "SFramesTargetDebuff"..i, self.frame)
|
||||
b:SetWidth(AURA_SIZE)
|
||||
b:SetHeight(AURA_SIZE)
|
||||
@@ -1256,7 +1513,7 @@ function SFrames.Target:TickAuras()
|
||||
end
|
||||
|
||||
-- Buffs
|
||||
for i = 1, 16 do
|
||||
for i = 1, 32 do
|
||||
local b = self.frame.buffs[i]
|
||||
if b:IsShown() and b.expirationTime then
|
||||
local timeLeft = b.expirationTime - timeNow
|
||||
@@ -1275,7 +1532,7 @@ function SFrames.Target:TickAuras()
|
||||
end
|
||||
|
||||
-- Debuffs: re-query SpellDB for live-accurate timers
|
||||
for i = 1, 16 do
|
||||
for i = 1, 32 do
|
||||
local b = self.frame.debuffs[i]
|
||||
if b:IsShown() then
|
||||
local timeLeft = nil
|
||||
@@ -1316,14 +1573,17 @@ end
|
||||
function SFrames.Target:UpdateAuras()
|
||||
if not UnitExists("target") then return end
|
||||
|
||||
local hasSuperWoW = SFrames.superwow_active and SpellInfo
|
||||
local numBuffs = 0
|
||||
-- Buffs
|
||||
for i = 1, 16 do
|
||||
local texture = UnitBuff("target", i)
|
||||
for i = 1, 32 do
|
||||
local texture, swAuraID = UnitBuff("target", i)
|
||||
local b = self.frame.buffs[i]
|
||||
b:SetID(i) -- Ensure ID is set for tooltips
|
||||
if texture then
|
||||
b.icon:SetTexture(texture)
|
||||
-- Store aura ID when SuperWoW is available
|
||||
b.auraID = hasSuperWoW and swAuraID or nil
|
||||
|
||||
SFrames.Tooltip:SetOwner(UIParent, "ANCHOR_NONE")
|
||||
SFrames.Tooltip:ClearLines()
|
||||
@@ -1364,12 +1624,14 @@ function SFrames.Target:UpdateAuras()
|
||||
local hasNP = NanamiPlates_SpellDB and NanamiPlates_SpellDB.UnitDebuff
|
||||
local npFormat = NanamiPlates_Auras and NanamiPlates_Auras.FormatTime
|
||||
|
||||
for i = 1, 16 do
|
||||
local texture = UnitDebuff("target", i)
|
||||
for i = 1, 32 do
|
||||
local texture, dbCount, dbType, swDebuffAuraID = UnitDebuff("target", i)
|
||||
local b = self.frame.debuffs[i]
|
||||
b:SetID(i)
|
||||
if texture then
|
||||
b.icon:SetTexture(texture)
|
||||
-- Store aura ID when SuperWoW is available
|
||||
b.auraID = hasSuperWoW and swDebuffAuraID or nil
|
||||
|
||||
local timeLeft = 0
|
||||
local effectName = nil
|
||||
|
||||
Reference in New Issue
Block a user