mirror of
https://github.com/brues-code/pfUI.git
synced 2026-10-24 21:10:49 +00:00
use pfUI's GetColorGradient instead of Fizzle colors
This commit is contained in:
@@ -81,14 +81,6 @@ pfUI:RegisterSkin("Character", function ()
|
|||||||
"AmmoSlot"
|
"AmmoSlot"
|
||||||
}
|
}
|
||||||
|
|
||||||
local DURABILITY_THRESHOLD_COLORS = {
|
|
||||||
RED_FONT_COLOR,
|
|
||||||
ORANGE_THREAT_COLOR,
|
|
||||||
YELLOW_FONT_COLOR,
|
|
||||||
INVASION_FONT_COLOR,
|
|
||||||
PURE_GREEN_COLOR,
|
|
||||||
}
|
|
||||||
|
|
||||||
local function RefreshPetPosition()
|
local function RefreshPetPosition()
|
||||||
CharacterFrameTab3:ClearAllPoints()
|
CharacterFrameTab3:ClearAllPoints()
|
||||||
CharacterFrameTab3:SetPoint("LEFT", HasPetUI() and CharacterFrameTab2 or CharacterFrameTab1, "RIGHT", border*2 + 1, 0)
|
CharacterFrameTab3:SetPoint("LEFT", HasPetUI() and CharacterFrameTab2 or CharacterFrameTab1, "RIGHT", border*2 + 1, 0)
|
||||||
@@ -112,11 +104,10 @@ pfUI:RegisterSkin("Character", function ()
|
|||||||
if C.character.inventory.durability == "1" then
|
if C.character.inventory.durability == "1" then
|
||||||
local current, maximum = GetInventoryItemDurability(slotId)
|
local current, maximum = GetInventoryItemDurability(slotId)
|
||||||
if current and maximum and maximum > 0 then
|
if current and maximum and maximum > 0 then
|
||||||
local pct = math.floor((current / maximum) * 100)
|
local pct = floor((current / maximum) * 100)
|
||||||
slot.durabilityText:SetText(pct .. "%")
|
slot.durabilityText:SetText(pct .. "%")
|
||||||
-- 0-20% red, 20-40% orange, 40-60% yellow, 60-80% invasion, 80-100% green
|
local r, g, b = GetColorGradient(pct / 100)
|
||||||
local color = DURABILITY_THRESHOLD_COLORS[math.max(1, math.ceil(pct / 20))]
|
slot.durabilityText:SetTextColor(r, g, b)
|
||||||
slot.durabilityText:SetTextColor(color:GetRGB())
|
|
||||||
slot.durabilityText:Show()
|
slot.durabilityText:Show()
|
||||||
else
|
else
|
||||||
slot.durabilityText:SetText("")
|
slot.durabilityText:SetText("")
|
||||||
|
|||||||
Reference in New Issue
Block a user