mirror of
https://github.com/brues-code/pfUI.git
synced 2026-10-02 03:39:59 +00:00
Version 6.1.1 - Chat & Nameplate Level Fixes
Bugfixes: - Fixed targeting high-level players overwriting known level with -1 - Chat now shows "??" instead of -1 for unknown levels - Nameplates now use stored level from database after reload - Nameplate level color now uses difficulty color when loaded from DB Config Changes: - Chat player level display now disabled by default
This commit is contained in:
+5
-1
@@ -797,11 +797,15 @@ pfUI:RegisterModule("chat", "vanilla:tbc", function ()
|
||||
local real, _ = strsplit(":", name)
|
||||
local level = GetPlayerLevel(real)
|
||||
|
||||
if level then
|
||||
if level and level > 0 then
|
||||
local levelcolor = rgbhex(GetDifficultyColor(level))
|
||||
-- Add level after the player name, before the closing bracket
|
||||
text = string.gsub(text, "(|Hplayer:" .. name .. "|h.-|h|r)" .. right,
|
||||
"%1 " .. levelcolor .. level .. "|r" .. right)
|
||||
elseif level and level <= 0 then
|
||||
-- Show ?? for unknown levels (e.g. -1 from UnitLevel)
|
||||
text = string.gsub(text, "(|Hplayer:" .. name .. "|h.-|h|r)" .. right,
|
||||
"%1 |cffff0000??|r" .. right)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -664,6 +664,14 @@ pfUI:RegisterModule("nameplates", "vanilla", function ()
|
||||
local name = plate.original.name:GetText()
|
||||
local level = plate.original.level:IsShown() and plate.original.level:GetObjectType() == "FontString" and tonumber(plate.original.level:GetText()) or "??"
|
||||
local class, ulevel, elite, player, guild = GetUnitData(name, true)
|
||||
|
||||
-- Use database level if available and valid (fixes ?? after reload)
|
||||
local levelFromDB = false
|
||||
if ulevel and ulevel > 0 then
|
||||
level = ulevel
|
||||
levelFromDB = true
|
||||
end
|
||||
|
||||
local target = plate.istarget
|
||||
local mouseover = UnitExists("mouseover") and plate.original.glow:IsShown() or nil
|
||||
local unitstr = target and "target" or mouseover and "mouseover" or nil
|
||||
@@ -787,6 +795,12 @@ pfUI:RegisterModule("nameplates", "vanilla", function ()
|
||||
|
||||
plate.name:SetText(GetNameString(name))
|
||||
plate.level:SetText(string.format("%s%s", level, (elitestrings[elite] or "")))
|
||||
|
||||
-- Set level color from GetDifficultyColor when using DB level
|
||||
if levelFromDB and type(level) == "number" then
|
||||
local color = GetDifficultyColor(level)
|
||||
plate.level:SetTextColor(color.r + 0.3, color.g + 0.3, color.b + 0.3, 1)
|
||||
end
|
||||
|
||||
if guild and C.nameplates.showguildname == "1" then
|
||||
plate.guild:SetText(guild)
|
||||
|
||||
Reference in New Issue
Block a user