mirror of
https://github.com/brues-code/pfUI.git
synced 2026-09-27 18:06:02 +00:00
performance update
This commit is contained in:
+23
-3
@@ -1,4 +1,4 @@
|
||||
pfUI:RegisterModule("chat", "vanilla:tbc", function ()
|
||||
pfUI:RegisterModule("chat", "vanilla", function ()
|
||||
local panelfont = C.panel.use_unitfonts == "1" and pfUI.font_unit or pfUI.font_default
|
||||
local panelfont_size = C.panel.use_unitfonts == "1" and C.global.font_unit_size or C.global.font_size
|
||||
local rawborder, default_border = GetBorderSize("chat")
|
||||
@@ -727,6 +727,12 @@ pfUI:RegisterModule("chat", "vanilla:tbc", function ()
|
||||
end
|
||||
end)
|
||||
|
||||
local function GetPlayerLevel(name)
|
||||
if not pfUI_playerDB then return nil end
|
||||
if not pfUI_playerDB[name] then return nil end
|
||||
return pfUI_playerDB[name].level
|
||||
end
|
||||
|
||||
local function ScanWhoName(name)
|
||||
-- abort if another query is ongoing
|
||||
if who_query.pending then return end
|
||||
@@ -747,8 +753,7 @@ pfUI:RegisterModule("chat", "vanilla:tbc", function ()
|
||||
end
|
||||
|
||||
-- Remove prat CLINKs
|
||||
text = gsub(text, "{CLINK:(%x+):([%d-]-:[%d-]-:[%d-]-:[%d-]-:[%d-]-:[%d-]-:[%d-]-:[%d-]-):([^}]-)}", "|c%1|Hitem:%2|h[%3]|h|r") -- tbc
|
||||
text = gsub(text, "{CLINK:(%x+):([%d-]-:[%d-]-:[%d-]-:[%d-]-):([^}]-)}", "|c%1|Hitem:%2|h[%3]|h|r") -- vanilla
|
||||
text = gsub(text, "{CLINK:(%x+):([%d-]-:[%d-]-:[%d-]-:[%d-]-):([^}]-)}", "|c%1|Hitem:%2|h[%3]|h|r")
|
||||
|
||||
-- Remove chatter CLINKs
|
||||
text = gsub(text, "{CLINK:item:(%x+):([%d-]-:[%d-]-:[%d-]-:[%d-]-:[%d-]-:[%d-]-:[%d-]-:[%d-]-):([^}]-)}", "|c%1|Hitem:%2|h[%3]|h|r")
|
||||
@@ -785,6 +790,21 @@ pfUI:RegisterModule("chat", "vanilla:tbc", function ()
|
||||
end
|
||||
end
|
||||
|
||||
-- display player levels if available
|
||||
if C.chat.text.playerlevel == "1" then
|
||||
for name in gfind(text, "|Hplayer:(.-)|h") do
|
||||
local real, _ = strsplit(":", name)
|
||||
local level = GetPlayerLevel(real)
|
||||
|
||||
if level 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)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- reduce channel name to number
|
||||
if C.chat.text.channelnumonly == "1" then
|
||||
local channel = string.gsub(text, ".*%[(.-)%]%s+(.*|Hplayer).+", "%1")
|
||||
|
||||
Reference in New Issue
Block a user