Hi, I was having some fps issues so I downloaded an addon monitoring addon and noticed that two small addons were showing high CPU usage relative to their size. Could anyone take a look for me?
Thanks.
1.
Lua Code:
local SET_TEXT = TARGET .. ": |cff%02x%02x%02x%s|r"
local MATCH_TEXT = "^" .. TARGET
local last
GameTooltip:HookScript("OnUpdate", function(self)
local name = UnitName("mouseovertarget")
if not name or name == "" or not self:GetUnit() then return end
last = name
local r, g, b
if UnitIsPlayer("mouseovertarget") then
local _, class = UnitClass("mouseovertarget")
local color = (CUSTOM_CLASS_COLORS or RAID_CLASS_COLORS)[class]
r, g, b = color.r, color.g, color.b
else
r, g, b = GameTooltip_UnitColor("mouseovertarget")
end
for i = 2, self:NumLines() do
local line = _G["GameTooltipTextLeft"..i]
if strfind(line:GetText() or "", MATCH_TEXT) then
line:SetFormattedText(SET_TEXT, r * 255, g * 255, b * 255, name)
return self:Show()
end
end
self:AddLine(format(SET_TEXT, r * 255, g * 255, b * 255, name))
self:Show()
end)
GameTooltip:HookScript("OnTooltipSetUnit", function(GameTooltip)
local _, unit = GameTooltip:GetUnit()
if UnitIsPlayer(unit) then
local _, class = UnitClass(unit)
local color = class and (CUSTOM_CLASS_COLORS or RAID_CLASS_COLORS)[class]
if color then
local text = GameTooltipTextLeft1:GetText()
GameTooltipTextLeft1:SetFormattedText("|cff%02x%02x%02x%s|r", color.r * 255, color.g * 255, color.b * 255, text:match("|cff\x\x\x\x\x\x(.+)|r") or text)
end
end
end)
2.
Lua Code:
hooksecurefunc('CooldownFrame_Set', function(self)
if self.currentCooldownType == COOLDOWN_TYPE_LOSS_OF_CONTROL then
self:SetCooldown(0,0)
end
end)
hooksecurefunc(getmetatable(CreateFrame('cooldown')).__index, 'SetCooldown', function(self)
self:SetDrawBling(false)
end)