mirror of
https://github.com/brues-code/pfUI.git
synced 2026-10-26 05:50:50 +00:00
unitframes: add function to prepare level string
This commit is contained in:
+21
-20
@@ -1294,6 +1294,24 @@ function pfUI.uf:SetupBuffFilter()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function pfUI.uf:GetLevelString(unitstr)
|
||||||
|
local level = UnitLevel(unitstr)
|
||||||
|
if level == -1 then level = "??" end
|
||||||
|
|
||||||
|
local elite = UnitClassification(unitstr)
|
||||||
|
if elite == "worldboss" then
|
||||||
|
level = level .. "B"
|
||||||
|
elseif elite == "rareelite" then
|
||||||
|
level = level .. "R+"
|
||||||
|
elseif elite == "elite" then
|
||||||
|
level = level .. "+"
|
||||||
|
elseif elite == "rare" then
|
||||||
|
level = level .. "R"
|
||||||
|
end
|
||||||
|
|
||||||
|
return level
|
||||||
|
end
|
||||||
|
|
||||||
function pfUI.uf:GetStatusValue(unit, pos)
|
function pfUI.uf:GetStatusValue(unit, pos)
|
||||||
if not pos or not unit then return end
|
if not pos or not unit then return end
|
||||||
local config = unit.config["txt"..pos]
|
local config = unit.config["txt"..pos]
|
||||||
@@ -1306,30 +1324,13 @@ function pfUI.uf:GetStatusValue(unit, pos)
|
|||||||
end
|
end
|
||||||
|
|
||||||
if config == "unit" then
|
if config == "unit" then
|
||||||
local level = UnitLevel(unitstr)
|
local name = unit:GetColor("unit") .. UnitName(unitstr)
|
||||||
if level == -1 then level = "??" end
|
local level = unit:GetColor("level") .. pfUI.uf:GetLevelString(unitstr)
|
||||||
|
|
||||||
local name = UnitName(unitstr)
|
|
||||||
|
|
||||||
local elite = UnitClassification(unitstr)
|
|
||||||
if elite == "worldboss" then
|
|
||||||
level = level .. "B"
|
|
||||||
elseif elite == "rareelite" then
|
|
||||||
level = level .. "R+"
|
|
||||||
elseif elite == "elite" then
|
|
||||||
level = level .. "+"
|
|
||||||
elseif elite == "rare" then
|
|
||||||
level = level .. "R"
|
|
||||||
end
|
|
||||||
level = unit:GetColor("level") .. level
|
|
||||||
name = unit:GetColor("unit") .. name
|
|
||||||
|
|
||||||
return level .. " " .. name
|
return level .. " " .. name
|
||||||
|
|
||||||
elseif config == "name" then
|
elseif config == "name" then
|
||||||
return unit:GetColor("unit") .. UnitName(unitstr)
|
return unit:GetColor("unit") .. UnitName(unitstr)
|
||||||
elseif config == "level" then
|
elseif config == "level" then
|
||||||
return unit:GetColor("level") .. UnitLevel(unitstr)
|
return unit:GetColor("level") .. pfUI.uf:GetLevelString(unitstr)
|
||||||
elseif config == "class" then
|
elseif config == "class" then
|
||||||
return unit:GetColor("class") .. (UnitClass(unitstr) or UNKNOWN)
|
return unit:GetColor("class") .. (UnitClass(unitstr) or UNKNOWN)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user