Hello,
I'm trying to figure out a way I can create addons out of scripts from a addon I installed. When I use the addon however, it breaks other addons of mine which aren't very convenient. So I'd like to simply extract these two scripts from the addon; one gives Class Colours to names on the player & target frames, the other Removes the background behind the players name on the target frame.
Code for Class Coloured Names:
Lua Code:
function RunClassColorsOnHealthBars()
-- Включение цвета классов на полосах здоровья
local UnitIsPlayer, UnitIsConnected, UnitClass, RAID_CLASS_COLORS = UnitIsPlayer, UnitIsConnected, UnitClass,
RAID_CLASS_COLORS
local _, class, c
local function colour(statusbar, unit)
if UnitIsPlayer(unit) and UnitIsConnected(unit) and unit == statusbar.unit and UnitClass(unit) then
_, class = UnitClass(unit)
c = CUSTOM_CLASS_COLORS and CUSTOM_CLASS_COLORS[class] or RAID_CLASS_COLORS[class]
statusbar:SetStatusBarColor(c.r, c.g, c.b)
end
end
hooksecurefunc("UnitFrameHealthBar_Update", colour)
hooksecurefunc("HealthBar_OnValueChanged", function(self)
colour(self, self.unit)
end)
end
Code for removing bar behind the target frame name:
Lua Code:
function RunBlackNameBackground()
-- Изменяет бэкграунд на фреймах таргета и фокуса
hooksecurefunc("TargetFrame_CheckFaction",
function(self)
self.nameBackground:SetVertexColor(0.0, 0.0, 0.0, 0.01);
end)
end
Any idea on how I can make these into addons?