Thank you Phanx
I searched the forums before I posted and saw some similar responses, but I couldn't wrap my head around this anyhow. I don't know if it's because of oUF_Simple or my poor Lua knowledge, but probably a mix of the two
Anyhow, it's working! I'll post this here so people searching in the future might get something out of it. And, please, correct me if what I'm stating is wrong. It's based only on my poor Lua knowledge
oUF_Simple, like a lot of other layouts, has a core.lua that handles all the functions for the unitframes. These functions create castbars, healthbars and all that. Then we have the style.lua that "activates" all these for the different units aswell as some other options such as each units individual height and width, for example.
First, we need a function that handles the frame for Harmony using oUFs element ClassIcons.
This is what I added to my core.lua:
Lua Code:
lib.gen_ClassIcons = function(f)
local ci = CreateFrame("Frame", nil, f)
ci:SetPoint('CENTER', f.Health, 'TOP', 0, 1)
ci:SetSize(200, 16)
for i = 1, 5 do
ci[i] = CreateFrame("StatusBar", f:GetName().."_ClassBar"..i, f)
ci[i]:SetSize(36, 16)
ci[i]:SetStatusBarTexture(cfg.statusbar_texture)
ci[i]:SetFrameLevel(11)
ci[i].SetVertexColor = ci[i].SetStatusBarColor
CreateBorder(ci[i],12,1,1,1,2) -- !beautycase border
local h = CreateFrame("Frame", nil, ci[i])
h:SetFrameLevel(10)
h:SetPoint("TOPLEFT",-4,3)
h:SetPoint("BOTTOMRIGHT",4,-3)
lib.gen_backdrop(h)
if (i == 1) then
ci[i]:SetPoint('BOTTOMLEFT', f, 'TOPLEFT', -2, 7)
else
ci[i]:SetPoint('TOPLEFT', ci[i-1], "TOPRIGHT", 6, 0)
end
end
f.ClassIcons = ci
end
Here's what the player unit looked like in style.lua
before adding ClassIcons:
Lua Code:
--the player style
local function CreatePlayerStyle(self)
--style specific stuff
self.width = 200
self.height = 54
self.mystyle = "player"
init(self)
self.Health:SetStatusBarColor(.35,.35,.35)
self.Health.bg:SetVertexColor(.15,.15,.15)
self.Power.colorClass = true
self.Power.bg.multiplier = 0.2
self.Power.Smooth = true
self.Power.frequentUpdates = true
lib.gen_castbar(self)
lib.gen_portrait(self)
end
Simply add "lib.gen_ClassIcons(self)" which will attach ClassIcons to this unitframe:
Lua Code:
--the player style
local function CreatePlayerStyle(self)
--style specific stuff
self.width = 200
self.height = 54
self.mystyle = "player"
init(self)
self.Health:SetStatusBarColor(.35,.35,.35)
self.Health.bg:SetVertexColor(.15,.15,.15)
self.Power.colorClass = true
self.Power.bg.multiplier = 0.2
self.Power.Smooth = true
self.Power.frequentUpdates = true
lib.gen_ClassIcons(self)
lib.gen_castbar(self)
lib.gen_portrait(self)
end
I hope this makes sense and that it's somewhat well executed. I'm still learning, so any inputs are welcome
Thank you again Phanx.