聊天重做前缓存
This commit is contained in:
337
Units/Party.lua
337
Units/Party.lua
@@ -9,6 +9,9 @@ local PARTY_HORIZONTAL_GAP = 8
|
||||
local PARTY_UNIT_LOOKUP = { party1 = true, party2 = true, party3 = true, party4 = true }
|
||||
local PARTYPET_UNIT_LOOKUP = { partypet1 = true, partypet2 = true, partypet3 = true, partypet4 = true }
|
||||
|
||||
-- Pre-allocated table reused every UpdateAuras call
|
||||
local _partyDebuffColor = { r = 0, g = 0, b = 0 }
|
||||
|
||||
local function GetIncomingHeals(unit)
|
||||
return SFrames:GetIncomingHeals(unit)
|
||||
end
|
||||
@@ -36,6 +39,12 @@ local function Clamp(value, minValue, maxValue)
|
||||
return value
|
||||
end
|
||||
|
||||
local function SetTextureIfPresent(region, texturePath)
|
||||
if region and region.SetTexture and texturePath then
|
||||
region:SetTexture(texturePath)
|
||||
end
|
||||
end
|
||||
|
||||
function SFrames.Party:GetMetrics()
|
||||
local db = SFramesDB or {}
|
||||
|
||||
@@ -57,6 +66,34 @@ function SFrames.Party:GetMetrics()
|
||||
local powerHeight = tonumber(db.partyPowerHeight) or (height - healthHeight - 3)
|
||||
powerHeight = Clamp(math.floor(powerHeight + 0.5), 6, height - 6)
|
||||
|
||||
local gradientStyle = SFrames:IsGradientStyle()
|
||||
local availablePowerWidth = width - portraitWidth - 5
|
||||
if availablePowerWidth < 40 then
|
||||
availablePowerWidth = 40
|
||||
end
|
||||
|
||||
local rawPowerWidth = tonumber(db.partyPowerWidth)
|
||||
local legacyFullWidth = tonumber(db.partyFrameWidth) or width
|
||||
local legacyPowerWidth = width - portraitWidth - 3
|
||||
local defaultPowerWidth = gradientStyle and width or availablePowerWidth
|
||||
local maxPowerWidth = gradientStyle and width or availablePowerWidth
|
||||
local powerWidth
|
||||
if gradientStyle then
|
||||
-- 渐变风格:能量条始终与血条等宽(全宽)
|
||||
powerWidth = width
|
||||
elseif not rawPowerWidth
|
||||
or math.abs(rawPowerWidth - legacyFullWidth) < 0.5
|
||||
or math.abs(rawPowerWidth - legacyPowerWidth) < 0.5
|
||||
or math.abs(rawPowerWidth - availablePowerWidth) < 0.5 then
|
||||
powerWidth = defaultPowerWidth
|
||||
else
|
||||
powerWidth = rawPowerWidth
|
||||
end
|
||||
powerWidth = Clamp(math.floor(powerWidth + 0.5), 40, maxPowerWidth)
|
||||
|
||||
local powerOffsetX = Clamp(math.floor((tonumber(db.partyPowerOffsetX) or 0) + 0.5), -120, 120)
|
||||
local powerOffsetY = Clamp(math.floor((tonumber(db.partyPowerOffsetY) or 0) + 0.5), -80, 80)
|
||||
|
||||
if healthHeight + powerHeight + 3 > height then
|
||||
powerHeight = height - healthHeight - 3
|
||||
if powerHeight < 6 then
|
||||
@@ -81,16 +118,30 @@ function SFrames.Party:GetMetrics()
|
||||
local valueFont = tonumber(db.partyValueFontSize) or 10
|
||||
valueFont = Clamp(math.floor(valueFont + 0.5), 8, 18)
|
||||
|
||||
local healthFont = tonumber(db.partyHealthFontSize) or valueFont
|
||||
healthFont = Clamp(math.floor(healthFont + 0.5), 8, 18)
|
||||
|
||||
local powerFont = tonumber(db.partyPowerFontSize) or valueFont
|
||||
powerFont = Clamp(math.floor(powerFont + 0.5), 8, 18)
|
||||
|
||||
return {
|
||||
width = width,
|
||||
height = height,
|
||||
portraitWidth = portraitWidth,
|
||||
healthHeight = healthHeight,
|
||||
powerHeight = powerHeight,
|
||||
powerWidth = powerWidth,
|
||||
powerOffsetX = powerOffsetX,
|
||||
powerOffsetY = powerOffsetY,
|
||||
powerOnTop = db.partyPowerOnTop == true,
|
||||
horizontalGap = hgap,
|
||||
verticalGap = vgap,
|
||||
nameFont = nameFont,
|
||||
valueFont = valueFont,
|
||||
healthFont = healthFont,
|
||||
powerFont = powerFont,
|
||||
healthTexture = SFrames:ResolveBarTexture("partyHealthTexture", "barTexture"),
|
||||
powerTexture = SFrames:ResolveBarTexture("partyPowerTexture", "barTexture"),
|
||||
}
|
||||
end
|
||||
|
||||
@@ -142,8 +193,8 @@ function SFrames.Party:ApplyFrameStyle(frame, metrics)
|
||||
|
||||
if frame.power then
|
||||
frame.power:ClearAllPoints()
|
||||
frame.power:SetPoint("TOPLEFT", frame.health, "BOTTOMLEFT", 0, -1)
|
||||
frame.power:SetPoint("TOPRIGHT", frame.health, "BOTTOMRIGHT", 0, 0)
|
||||
frame.power:SetPoint("TOPLEFT", frame.health, "BOTTOMLEFT", metrics.powerOffsetX, -1 + metrics.powerOffsetY)
|
||||
frame.power:SetWidth(metrics.powerWidth)
|
||||
frame.power:SetHeight(metrics.powerHeight)
|
||||
end
|
||||
|
||||
@@ -153,14 +204,114 @@ function SFrames.Party:ApplyFrameStyle(frame, metrics)
|
||||
frame.powerBGFrame:SetPoint("BOTTOMRIGHT", frame.power, "BOTTOMRIGHT", 1, -1)
|
||||
end
|
||||
|
||||
local outline = (SFrames and SFrames.Media and SFrames.Media.fontOutline) or "OUTLINE"
|
||||
local fontPath = SFrames:GetFont()
|
||||
SFrames:ApplyStatusBarTexture(frame.health, "partyHealthTexture", "barTexture")
|
||||
SFrames:ApplyStatusBarTexture(frame.power, "partyPowerTexture", "barTexture")
|
||||
if frame.health and frame.power then
|
||||
local healthLevel = frame:GetFrameLevel() + 2
|
||||
local powerLevel = metrics.powerOnTop and (healthLevel + 1) or (healthLevel - 1)
|
||||
frame.health:SetFrameLevel(healthLevel)
|
||||
frame.power:SetFrameLevel(powerLevel)
|
||||
end
|
||||
SFrames:ApplyConfiguredUnitBackdrop(frame, "party")
|
||||
if frame.pbg then SFrames:ApplyConfiguredUnitBackdrop(frame.pbg, "party", true) end
|
||||
if frame.healthBGFrame then SFrames:ApplyConfiguredUnitBackdrop(frame.healthBGFrame, "party") end
|
||||
if frame.powerBGFrame then SFrames:ApplyConfiguredUnitBackdrop(frame.powerBGFrame, "party") end
|
||||
SetTextureIfPresent(frame.health and frame.health.bg, metrics.healthTexture)
|
||||
SetTextureIfPresent(frame.health and frame.health.healPredMine, metrics.healthTexture)
|
||||
SetTextureIfPresent(frame.health and frame.health.healPredOther, metrics.healthTexture)
|
||||
SetTextureIfPresent(frame.health and frame.health.healPredOver, metrics.healthTexture)
|
||||
SetTextureIfPresent(frame.power and frame.power.bg, metrics.powerTexture)
|
||||
|
||||
-- Gradient style preset
|
||||
if SFrames:IsGradientStyle() then
|
||||
-- Hide portrait & its backdrop
|
||||
if frame.portrait then frame.portrait:Hide() end
|
||||
if frame.pbg then SFrames:ClearBackdrop(frame.pbg); frame.pbg:Hide() end
|
||||
-- Strip backdrops
|
||||
SFrames:ClearBackdrop(frame)
|
||||
SFrames:ClearBackdrop(frame.healthBGFrame)
|
||||
SFrames:ClearBackdrop(frame.powerBGFrame)
|
||||
-- Health bar full width
|
||||
if frame.health then
|
||||
frame.health:ClearAllPoints()
|
||||
frame.health:SetPoint("TOPLEFT", frame, "TOPLEFT", 0, 0)
|
||||
frame.health:SetPoint("TOPRIGHT", frame, "TOPRIGHT", 0, 0)
|
||||
frame.health:SetHeight(metrics.healthHeight)
|
||||
end
|
||||
-- Power bar full width
|
||||
if frame.power then
|
||||
frame.power:ClearAllPoints()
|
||||
frame.power:SetPoint("TOPLEFT", frame.health, "BOTTOMLEFT", metrics.powerOffsetX, -2 + metrics.powerOffsetY)
|
||||
frame.power:SetWidth(metrics.powerWidth)
|
||||
frame.power:SetHeight(metrics.powerHeight)
|
||||
end
|
||||
-- Apply gradient overlays
|
||||
SFrames:ApplyGradientStyle(frame.health)
|
||||
SFrames:ApplyGradientStyle(frame.power)
|
||||
-- Flush BG frames
|
||||
if frame.healthBGFrame then
|
||||
frame.healthBGFrame:ClearAllPoints()
|
||||
frame.healthBGFrame:SetPoint("TOPLEFT", frame.health, "TOPLEFT", 0, 0)
|
||||
frame.healthBGFrame:SetPoint("BOTTOMRIGHT", frame.health, "BOTTOMRIGHT", 0, 0)
|
||||
end
|
||||
if frame.powerBGFrame then
|
||||
frame.powerBGFrame:ClearAllPoints()
|
||||
frame.powerBGFrame:SetPoint("TOPLEFT", frame.power, "TOPLEFT", 0, 0)
|
||||
frame.powerBGFrame:SetPoint("BOTTOMRIGHT", frame.power, "BOTTOMRIGHT", 0, 0)
|
||||
end
|
||||
-- Hide bar backgrounds (transparent)
|
||||
if frame.healthBGFrame then frame.healthBGFrame:Hide() end
|
||||
if frame.powerBGFrame then frame.powerBGFrame:Hide() end
|
||||
if frame.health and frame.health.bg then frame.health.bg:Hide() end
|
||||
if frame.power and frame.power.bg then frame.power.bg:Hide() end
|
||||
else
|
||||
SFrames:RemoveGradientStyle(frame.health)
|
||||
SFrames:RemoveGradientStyle(frame.power)
|
||||
-- Restore bar backgrounds
|
||||
if frame.healthBGFrame then frame.healthBGFrame:Show() end
|
||||
if frame.powerBGFrame then frame.powerBGFrame:Show() end
|
||||
if frame.health and frame.health.bg then frame.health.bg:Show() end
|
||||
if frame.power and frame.power.bg then frame.power.bg:Show() end
|
||||
|
||||
local use3D = not (SFramesDB and SFramesDB.partyPortrait3D == false)
|
||||
if use3D then
|
||||
if frame.portrait then frame.portrait:Show() end
|
||||
if frame.pbg then frame.pbg:Show() end
|
||||
else
|
||||
-- Hide portrait area and extend health/power bars to full width
|
||||
if frame.portrait then frame.portrait:Hide() end
|
||||
if frame.pbg then frame.pbg:Hide() end
|
||||
local fullWidth = metrics.width - 2
|
||||
if frame.health then
|
||||
frame.health:ClearAllPoints()
|
||||
frame.health:SetPoint("TOPLEFT", frame, "TOPLEFT", 1, -1)
|
||||
frame.health:SetPoint("TOPRIGHT", frame, "TOPRIGHT", -1, -1)
|
||||
frame.health:SetHeight(metrics.healthHeight)
|
||||
end
|
||||
if frame.healthBGFrame then
|
||||
frame.healthBGFrame:ClearAllPoints()
|
||||
frame.healthBGFrame:SetPoint("TOPLEFT", frame.health, "TOPLEFT", -1, 1)
|
||||
frame.healthBGFrame:SetPoint("BOTTOMRIGHT", frame.health, "BOTTOMRIGHT", 1, -1)
|
||||
end
|
||||
if frame.power then
|
||||
frame.power:SetWidth(fullWidth)
|
||||
end
|
||||
if frame.powerBGFrame then
|
||||
frame.powerBGFrame:ClearAllPoints()
|
||||
frame.powerBGFrame:SetPoint("TOPLEFT", frame.power, "TOPLEFT", -1, 1)
|
||||
frame.powerBGFrame:SetPoint("BOTTOMRIGHT", frame.power, "BOTTOMRIGHT", 1, -1)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if frame.nameText then
|
||||
frame.nameText:SetFont(fontPath, metrics.nameFont, outline)
|
||||
SFrames:ApplyFontString(frame.nameText, metrics.nameFont, "partyNameFontKey", "fontKey")
|
||||
end
|
||||
if frame.healthText then
|
||||
frame.healthText:SetFont(fontPath, metrics.valueFont, outline)
|
||||
SFrames:ApplyFontString(frame.healthText, metrics.healthFont, "partyHealthFontKey", "fontKey")
|
||||
end
|
||||
if frame.powerText then
|
||||
SFrames:ApplyFontString(frame.powerText, metrics.powerFont, "partyPowerFontKey", "fontKey")
|
||||
end
|
||||
end
|
||||
|
||||
@@ -250,12 +401,13 @@ function SFrames.Party:ApplyLayout()
|
||||
end
|
||||
end
|
||||
|
||||
local auraRowHeight = 24 -- 20px icon + 2px gap above + 2px padding
|
||||
if mode == "horizontal" then
|
||||
self.parent:SetWidth((metrics.width * 4) + (metrics.horizontalGap * 3))
|
||||
self.parent:SetHeight(metrics.height)
|
||||
self.parent:SetHeight(metrics.height + auraRowHeight)
|
||||
else
|
||||
self.parent:SetWidth(metrics.width)
|
||||
self.parent:SetHeight(metrics.height + ((metrics.height + metrics.verticalGap) * 3))
|
||||
self.parent:SetHeight(metrics.height + ((metrics.height + metrics.verticalGap) * 3) + auraRowHeight)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -432,11 +584,16 @@ function SFrames.Party:Initialize()
|
||||
|
||||
f.healthText = SFrames:CreateFontString(f.health, 10, "RIGHT")
|
||||
f.healthText:SetPoint("RIGHT", f.health, "RIGHT", -4, 0)
|
||||
|
||||
f.powerText = SFrames:CreateFontString(f.power, 9, "RIGHT")
|
||||
f.powerText:SetPoint("RIGHT", f.power, "RIGHT", -4, 0)
|
||||
|
||||
f.nameText:SetShadowColor(0, 0, 0, 1)
|
||||
f.nameText:SetShadowOffset(1, -1)
|
||||
f.healthText:SetShadowColor(0, 0, 0, 1)
|
||||
f.healthText:SetShadowOffset(1, -1)
|
||||
f.powerText:SetShadowColor(0, 0, 0, 1)
|
||||
f.powerText:SetShadowOffset(1, -1)
|
||||
|
||||
-- Leader / Master Looter overlay (high frame level so icons aren't hidden by portrait)
|
||||
local roleOvr = CreateFrame("Frame", nil, f)
|
||||
@@ -621,74 +778,79 @@ end
|
||||
|
||||
function SFrames.Party:CreateAuras(index)
|
||||
local f = self.frames[index].frame
|
||||
-- Use self.parent (plain Frame) as parent for aura buttons so they are
|
||||
-- never clipped by the party Button frame's boundaries.
|
||||
local auraParent = self.parent
|
||||
f.buffs = {}
|
||||
f.debuffs = {}
|
||||
local size = 20
|
||||
local spacing = 2
|
||||
|
||||
|
||||
-- Party Buffs
|
||||
for i = 1, 4 do
|
||||
local b = CreateFrame("Button", "SFramesParty"..index.."Buff"..i, f)
|
||||
local b = CreateFrame("Button", "SFramesParty"..index.."Buff"..i, auraParent)
|
||||
b:SetWidth(size)
|
||||
b:SetHeight(size)
|
||||
b:SetFrameLevel((f:GetFrameLevel() or 0) + 3)
|
||||
SFrames:CreateUnitBackdrop(b)
|
||||
|
||||
|
||||
b.icon = b:CreateTexture(nil, "ARTWORK")
|
||||
b.icon:SetAllPoints()
|
||||
b.icon:SetTexCoord(0.07, 0.93, 0.07, 0.93)
|
||||
|
||||
|
||||
b.cdText = SFrames:CreateFontString(b, 9, "CENTER")
|
||||
b.cdText:SetPoint("BOTTOM", b, "BOTTOM", 0, 1)
|
||||
b.cdText:SetTextColor(1, 0.82, 0)
|
||||
b.cdText:SetShadowColor(0, 0, 0, 1)
|
||||
b.cdText:SetShadowOffset(1, -1)
|
||||
|
||||
|
||||
b:SetScript("OnEnter", function()
|
||||
GameTooltip:SetOwner(this, "ANCHOR_BOTTOMRIGHT")
|
||||
GameTooltip:SetUnitBuff(f.unit, this:GetID())
|
||||
end)
|
||||
b:SetScript("OnLeave", function() GameTooltip:Hide() end)
|
||||
|
||||
-- Anchored BELOW the frame on the left side
|
||||
|
||||
-- Anchored BELOW the party frame on the left side
|
||||
if i == 1 then
|
||||
b:SetPoint("TOPLEFT", f, "BOTTOMLEFT", 0, -2)
|
||||
else
|
||||
b:SetPoint("LEFT", f.buffs[i-1], "RIGHT", spacing, 0)
|
||||
end
|
||||
|
||||
|
||||
b:Hide()
|
||||
f.buffs[i] = b
|
||||
end
|
||||
|
||||
|
||||
-- Debuffs (Starting right after Buffs to remain linear)
|
||||
for i = 1, 4 do
|
||||
local b = CreateFrame("Button", "SFramesParty"..index.."Debuff"..i, f)
|
||||
local b = CreateFrame("Button", "SFramesParty"..index.."Debuff"..i, auraParent)
|
||||
b:SetWidth(size)
|
||||
b:SetHeight(size)
|
||||
b:SetFrameLevel((f:GetFrameLevel() or 0) + 3)
|
||||
SFrames:CreateUnitBackdrop(b)
|
||||
|
||||
|
||||
b.icon = b:CreateTexture(nil, "ARTWORK")
|
||||
b.icon:SetAllPoints()
|
||||
b.icon:SetTexCoord(0.07, 0.93, 0.07, 0.93)
|
||||
|
||||
|
||||
b.cdText = SFrames:CreateFontString(b, 9, "CENTER")
|
||||
b.cdText:SetPoint("BOTTOM", b, "BOTTOM", 0, 1)
|
||||
b.cdText:SetTextColor(1, 0.82, 0)
|
||||
b.cdText:SetShadowColor(0, 0, 0, 1)
|
||||
b.cdText:SetShadowOffset(1, -1)
|
||||
|
||||
|
||||
b:SetScript("OnEnter", function()
|
||||
GameTooltip:SetOwner(this, "ANCHOR_BOTTOMRIGHT")
|
||||
GameTooltip:SetUnitDebuff(f.unit, this:GetID())
|
||||
end)
|
||||
b:SetScript("OnLeave", function() GameTooltip:Hide() end)
|
||||
|
||||
|
||||
if i == 1 then
|
||||
b:SetPoint("LEFT", f.buffs[4], "RIGHT", spacing * 4, 0)
|
||||
else
|
||||
b:SetPoint("LEFT", f.debuffs[i-1], "RIGHT", spacing, 0)
|
||||
end
|
||||
|
||||
|
||||
b:Hide()
|
||||
f.debuffs[i] = b
|
||||
end
|
||||
@@ -726,6 +888,7 @@ end
|
||||
|
||||
|
||||
function SFrames.Party:TickAuras(unit)
|
||||
if self.testing then return end
|
||||
local data = self:GetFrameByUnit(unit)
|
||||
if not data then return end
|
||||
local f = data.frame
|
||||
@@ -772,7 +935,10 @@ function SFrames.Party:UpdateAll()
|
||||
if inRaid and raidFramesEnabled then
|
||||
for i = 1, 4 do
|
||||
if self.frames[i] and self.frames[i].frame then
|
||||
self.frames[i].frame:Hide()
|
||||
local f = self.frames[i].frame
|
||||
f:Hide()
|
||||
if f.buffs then for j = 1, 4 do f.buffs[j]:Hide() end end
|
||||
if f.debuffs then for j = 1, 4 do f.debuffs[j]:Hide() end end
|
||||
end
|
||||
end
|
||||
if self._globalUpdateFrame then
|
||||
@@ -793,6 +959,8 @@ function SFrames.Party:UpdateAll()
|
||||
hasVisible = true
|
||||
else
|
||||
f:Hide()
|
||||
if f.buffs then for j = 1, 4 do f.buffs[j]:Hide() end end
|
||||
if f.debuffs then for j = 1, 4 do f.debuffs[j]:Hide() end end
|
||||
end
|
||||
end
|
||||
if self._globalUpdateFrame then
|
||||
@@ -812,11 +980,16 @@ function SFrames.Party:UpdateFrame(unit)
|
||||
if not data then return end
|
||||
local f = data.frame
|
||||
|
||||
f.portrait:SetUnit(unit)
|
||||
f.portrait:SetCamera(0)
|
||||
f.portrait:Hide()
|
||||
f.portrait:Show()
|
||||
|
||||
local use3D = not (SFramesDB and SFramesDB.partyPortrait3D == false)
|
||||
if use3D then
|
||||
f.portrait:SetUnit(unit)
|
||||
f.portrait:SetCamera(0)
|
||||
f.portrait:Hide()
|
||||
f.portrait:Show()
|
||||
else
|
||||
f.portrait:Hide()
|
||||
end
|
||||
|
||||
local name = UnitName(unit) or ""
|
||||
local level = UnitLevel(unit)
|
||||
if level == -1 then level = "??" end
|
||||
@@ -841,6 +1014,10 @@ function SFrames.Party:UpdateFrame(unit)
|
||||
f.nameText:SetTextColor(1, 1, 1)
|
||||
end
|
||||
end
|
||||
-- Re-apply gradient after color change
|
||||
if SFrames:IsGradientStyle() then
|
||||
SFrames:ApplyBarGradient(f.health)
|
||||
end
|
||||
|
||||
-- Update Leader/Master Looter
|
||||
if GetPartyLeaderIndex() == data.index then
|
||||
@@ -870,6 +1047,8 @@ function SFrames.Party:UpdatePortrait(unit)
|
||||
local data = self:GetFrameByUnit(unit)
|
||||
if not data then return end
|
||||
local f = data.frame
|
||||
local use3D = not (SFramesDB and SFramesDB.partyPortrait3D == false)
|
||||
if not use3D then return end
|
||||
f.portrait:SetUnit(unit)
|
||||
f.portrait:SetCamera(0)
|
||||
f.portrait:Hide()
|
||||
@@ -917,14 +1096,8 @@ function SFrames.Party:UpdateHealPrediction(unit)
|
||||
local predOther = f.health.healPredOther
|
||||
local predOver = f.health.healPredOver
|
||||
|
||||
local function HidePredictions()
|
||||
predMine:Hide()
|
||||
predOther:Hide()
|
||||
predOver:Hide()
|
||||
end
|
||||
|
||||
if not UnitExists(unit) or not UnitIsConnected(unit) then
|
||||
HidePredictions()
|
||||
predMine:Hide(); predOther:Hide(); predOver:Hide()
|
||||
return
|
||||
end
|
||||
|
||||
@@ -946,7 +1119,7 @@ function SFrames.Party:UpdateHealPrediction(unit)
|
||||
end
|
||||
|
||||
if maxHp <= 0 then
|
||||
HidePredictions()
|
||||
predMine:Hide(); predOther:Hide(); predOver:Hide()
|
||||
return
|
||||
end
|
||||
|
||||
@@ -963,7 +1136,7 @@ function SFrames.Party:UpdateHealPrediction(unit)
|
||||
end
|
||||
local missing = maxHp - hp
|
||||
if missing <= 0 and (mineIncoming <= 0 and othersIncoming <= 0) then
|
||||
HidePredictions()
|
||||
predMine:Hide(); predOther:Hide(); predOver:Hide()
|
||||
return
|
||||
end
|
||||
|
||||
@@ -971,13 +1144,19 @@ function SFrames.Party:UpdateHealPrediction(unit)
|
||||
local remaining = missing - mineShown
|
||||
local otherShown = math.min(math.max(0, othersIncoming), remaining)
|
||||
if mineIncoming <= 0 and othersIncoming <= 0 then
|
||||
HidePredictions()
|
||||
predMine:Hide(); predOther:Hide(); predOver:Hide()
|
||||
return
|
||||
end
|
||||
|
||||
local barWidth = f:GetWidth() - (f.portrait:GetWidth() + 4)
|
||||
local use3DForPred = not (SFramesDB and SFramesDB.partyPortrait3D == false)
|
||||
local barWidth
|
||||
if use3DForPred then
|
||||
barWidth = f:GetWidth() - (f.portrait:GetWidth() + 4)
|
||||
else
|
||||
barWidth = f:GetWidth() - 2
|
||||
end
|
||||
if barWidth <= 0 then
|
||||
HidePredictions()
|
||||
predMine:Hide(); predOther:Hide(); predOver:Hide()
|
||||
return
|
||||
end
|
||||
|
||||
@@ -1054,6 +1233,9 @@ function SFrames.Party:UpdatePowerType(unit)
|
||||
else
|
||||
f.power:SetStatusBarColor(0, 0, 1)
|
||||
end
|
||||
if SFrames:IsGradientStyle() then
|
||||
SFrames:ApplyBarGradient(f.power)
|
||||
end
|
||||
end
|
||||
|
||||
function SFrames.Party:UpdatePower(unit)
|
||||
@@ -1064,6 +1246,7 @@ function SFrames.Party:UpdatePower(unit)
|
||||
if not UnitIsConnected(unit) then
|
||||
f.power:SetMinMaxValues(0, 100)
|
||||
f.power:SetValue(0)
|
||||
if f.powerText then f.powerText:SetText("") end
|
||||
return
|
||||
end
|
||||
|
||||
@@ -1071,6 +1254,14 @@ function SFrames.Party:UpdatePower(unit)
|
||||
local maxPower = UnitManaMax(unit)
|
||||
f.power:SetMinMaxValues(0, maxPower)
|
||||
f.power:SetValue(power)
|
||||
if f.powerText then
|
||||
if maxPower and maxPower > 0 then
|
||||
f.powerText:SetText(SFrames:FormatCompactPair(power, maxPower))
|
||||
else
|
||||
f.powerText:SetText("")
|
||||
end
|
||||
end
|
||||
SFrames:UpdateRainbowBar(f.power, power, maxPower, unit)
|
||||
end
|
||||
|
||||
function SFrames.Party:UpdateRaidIcons()
|
||||
@@ -1106,6 +1297,7 @@ function SFrames.Party:UpdateRaidIcon(unit)
|
||||
end
|
||||
|
||||
function SFrames.Party:UpdateAuras(unit)
|
||||
if self.testing then return end
|
||||
local data = self:GetFrameByUnit(unit)
|
||||
if not data then return end
|
||||
local f = data.frame
|
||||
@@ -1114,7 +1306,9 @@ function SFrames.Party:UpdateAuras(unit)
|
||||
local showBuffs = not (SFramesDB and SFramesDB.partyShowBuffs == false)
|
||||
|
||||
local hasDebuff = false
|
||||
local debuffColor = {r=_A.slotBg[1], g=_A.slotBg[2], b=_A.slotBg[3]}
|
||||
_partyDebuffColor.r = _A.slotBg[1]
|
||||
_partyDebuffColor.g = _A.slotBg[2]
|
||||
_partyDebuffColor.b = _A.slotBg[3]
|
||||
|
||||
SFrames.Tooltip:SetOwner(UIParent, "ANCHOR_NONE")
|
||||
|
||||
@@ -1128,10 +1322,10 @@ function SFrames.Party:UpdateAuras(unit)
|
||||
if texture then
|
||||
if debuffType then
|
||||
hasDebuff = true
|
||||
if debuffType == "Magic" then debuffColor = {r=0.2, g=0.6, b=1}
|
||||
elseif debuffType == "Curse" then debuffColor = {r=0.6, g=0, b=1}
|
||||
elseif debuffType == "Disease" then debuffColor = {r=0.6, g=0.4, b=0}
|
||||
elseif debuffType == "Poison" then debuffColor = {r=0, g=0.6, b=0}
|
||||
if debuffType == "Magic" then _partyDebuffColor.r = 0.2; _partyDebuffColor.g = 0.6; _partyDebuffColor.b = 1
|
||||
elseif debuffType == "Curse" then _partyDebuffColor.r = 0.6; _partyDebuffColor.g = 0; _partyDebuffColor.b = 1
|
||||
elseif debuffType == "Disease" then _partyDebuffColor.r = 0.6; _partyDebuffColor.g = 0.4; _partyDebuffColor.b = 0
|
||||
elseif debuffType == "Poison" then _partyDebuffColor.r = 0; _partyDebuffColor.g = 0.6; _partyDebuffColor.b = 0
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1174,7 +1368,7 @@ function SFrames.Party:UpdateAuras(unit)
|
||||
end
|
||||
|
||||
if hasDebuff then
|
||||
f.health.bg:SetVertexColor(debuffColor.r, debuffColor.g, debuffColor.b, 1)
|
||||
f.health.bg:SetVertexColor(_partyDebuffColor.r, _partyDebuffColor.g, _partyDebuffColor.b, 1)
|
||||
else
|
||||
f.health.bg:SetVertexColor(_A.slotBg[1], _A.slotBg[2], _A.slotBg[3], _A.slotBg[4] or 1)
|
||||
end
|
||||
@@ -1254,10 +1448,38 @@ function SFrames.Party:TestMode()
|
||||
f.masterIcon:Show()
|
||||
end
|
||||
|
||||
-- Show one dummy debuff to test positioning
|
||||
f.debuffs[1].icon:SetTexture("Interface\\Icons\\Spell_Shadow_ShadowWordPain")
|
||||
f.debuffs[1]:Show()
|
||||
|
||||
-- Show test buffs (all 4)
|
||||
local testBuffIcons = {
|
||||
"Interface\\Icons\\Spell_Holy_PowerWordFortitude",
|
||||
"Interface\\Icons\\Spell_Holy_Renew",
|
||||
"Interface\\Icons\\Spell_Holy_GreaterHeal",
|
||||
"Interface\\Icons\\Spell_Nature_Abolishmagic",
|
||||
}
|
||||
for j = 1, 4 do
|
||||
local fakeTime = math.random(30, 300)
|
||||
f.buffs[j].icon:SetTexture(testBuffIcons[j])
|
||||
f.buffs[j].expirationTime = GetTime() + fakeTime
|
||||
f.buffs[j].cdText:SetText(SFrames:FormatTime(fakeTime))
|
||||
f.buffs[j]:Show()
|
||||
end
|
||||
|
||||
-- Show test debuffs (all 4, different types for color test)
|
||||
local testDebuffIcons = {
|
||||
"Interface\\Icons\\Spell_Shadow_ShadowWordPain", -- Magic (blue)
|
||||
"Interface\\Icons\\Spell_Shadow_Curse", -- Curse (purple)
|
||||
"Interface\\Icons\\Ability_Rogue_FeignDeath", -- Disease (brown)
|
||||
"Interface\\Icons\\Ability_Poisoning", -- Poison (green)
|
||||
}
|
||||
for j = 1, 4 do
|
||||
local debuffTime = math.random(5, 25)
|
||||
f.debuffs[j].icon:SetTexture(testDebuffIcons[j])
|
||||
f.debuffs[j].expirationTime = GetTime() + debuffTime
|
||||
f.debuffs[j].cdText:SetText(SFrames:FormatTime(debuffTime))
|
||||
f.debuffs[j]:Show()
|
||||
end
|
||||
-- Magic debuff background color
|
||||
f.health.bg:SetVertexColor(0.2, 0.6, 1, 1)
|
||||
|
||||
-- Test pet
|
||||
if f.petFrame then
|
||||
f.petFrame:Show()
|
||||
@@ -1268,9 +1490,18 @@ function SFrames.Party:TestMode()
|
||||
end
|
||||
end
|
||||
else
|
||||
self:UpdateAll()
|
||||
for i = 1, 4 do
|
||||
self.frames[i].frame.debuffs[1]:Hide()
|
||||
local f = self.frames[i].frame
|
||||
f.health.bg:SetVertexColor(_A.slotBg[1], _A.slotBg[2], _A.slotBg[3], _A.slotBg[4] or 1)
|
||||
for j = 1, 4 do
|
||||
f.buffs[j].expirationTime = nil
|
||||
f.buffs[j].cdText:SetText("")
|
||||
f.buffs[j]:Hide()
|
||||
f.debuffs[j].expirationTime = nil
|
||||
f.debuffs[j].cdText:SetText("")
|
||||
f.debuffs[j]:Hide()
|
||||
end
|
||||
end
|
||||
self:UpdateAll()
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user