diff --git a/pack.xml b/pack.xml
index faf6800..1dbe3a6 100644
--- a/pack.xml
+++ b/pack.xml
@@ -5,6 +5,7 @@
+
diff --git a/units.lua b/units.lua
new file mode 100644
index 0000000..30db977
--- /dev/null
+++ b/units.lua
@@ -0,0 +1,80 @@
+local addonName, addon = ...
+local childName = addon['childName']
+local child = addon[childName]
+local events = child['events']
+local ClassColorUnits = {
+ ["target"] = {
+ ["name"] = "TargetFrame",
+ ["back"] = "TargetFrame",
+ ["x-offset"] = -104,
+ ["y-offset"] = 60,
+ ["x-offset2"] = 6,
+ ["y-offset2"] = -22,
+ },
+ ["player"] = {
+ ["name"] = "PlayerFrame",
+ ["back"] = "PlayerFrameBackground",
+ ["x-offset"] = 0,
+ ["y-offset"] = 22,
+ ["x-offset2"] = 0,
+ ["y-offset2"] = 0,
+ },
+ ["focus"] = {
+ ["name"] = "FocusFrame",
+ ["back"] = "FocusFrame",
+ ["x-offset"] = -104,
+ ["y-offset"] = 60,
+ ["x-offset2"] = 6,
+ ["y-offset2"] = -22,
+ },
+}
+local function updateClassColor(unit)
+ if(unit and UnitExists(unit)) then
+ local _,class = UnitClass(unit)
+ if(class and RAID_CLASS_COLORS[class]) then
+ if(ClassColorUnits[unit]) then
+ local uf = _G[ClassColorUnits[unit]['name']]
+ local bg = _G[ClassColorUnits[unit]['back']]
+ if(not uf['unitClassColorBack']) then
+ uf['unitClassColorBack'] = uf:CreateTexture(nil, "ARTWORK")
+ uf['unitClassColorBack']:SetPoint("TOPLEFT", bg, ClassColorUnits[unit]['x-offset2'], ClassColorUnits[unit]['y-offset2'])
+ uf['unitClassColorBack']:SetPoint("BOTTOMRIGHT", bg, ClassColorUnits[unit]['x-offset'], ClassColorUnits[unit]['y-offset'])
+ uf['unitClassColorBack']:SetTexture("Interface\\TargetingFrame\\UI-StatusBar")
+ end
+ local col = RAID_CLASS_COLORS[class]
+ if(not UnitIsPlayer(unit)) then
+ uf['unitClassColorBack']:SetVertexColor(0, 0, 0, 0)
+ else
+ uf['unitClassColorBack']:SetVertexColor(col['r'], col['g'], col['b'],1)
+ end
+ end
+ end
+ end
+end
+function events:PLAYER_TARGET_CHANGED()
+ updateClassColor("target")
+end
+function events:PLAYER_FOCUS_CHANGED()
+ updateClassColor("focus")
+end
+local init = {
+ Setup = function(self, childName, event)
+ if(PlayerFrame:IsUserPlaced()) then
+ PlayerFrame:SetMoveable(false)
+ else
+ PlayerFrame:SetUserPlaced(true)
+ PlayerFrame:ClearAllPoints()
+ PlayerFrame:SetPoint("RIGHT", UIParent, "CENTER", 0, -140)
+ end
+
+ if(not TargetFrame:IsUserPlaced()) then
+ TargetFrame:SetUserPlaced(true)
+ TargetFrame:ClearAllPoints()
+ TargetFrame:SetPoint("TOPLEFT", PlayerFrame, "TOPRIGHT",0,0)
+ else
+ TargetFrame:SetMoveable(false)
+ end
+ updateClassColor("player")
+ end
+}
+addon.RegisterCallback(init, format("Init%s", childName), 'Setup', childName)
\ No newline at end of file