View Single Post
02-14-13, 05:50 PM   #1
Syliha
A Flamescale Wyrmkin
 
Syliha's Avatar
AddOn Author - Click to view addons
Join Date: May 2009
Posts: 104
[WIP] Adjusting bunitframes to my taste and needs, help required!

Hey there,

I am currently on my journey into addons in WoW again
I have come decently far by using my little actuall lua knowledge but depend highly on just thinking about what i am seeing in the code and adjusting it to what i understand will do stuff that i want to change.

So in total my actuall knowledge if about nonexistence but with logically thinking i get somewhat far.

I want to try to adjust bunitframes to my likings and hope you may help me with that and maybe i may learn alot from that. But please keep it simple and clear so even someone like me - a totally noob - may understand why and what you are doing.

So my first few things i want to have happen are the followings:

1) remove total health value only from playerframe and remove total power value only from target frame:

I have done a very simple solution by just moving these values out of the way as my out commenting on the parts i did screwed up everything.

As i do not like such "bad code" in my addons i'd like to fix it "cleanly" by removing the parts i do not like instead of moving them out of my screen.

I have done:
Code:
		if self.panel then
			self.health.value = self.health.value or self.health:CreateFontString(fname..'healthbarvalue', 'OVERLAY', 'GameFontNormal')
			self.health.value:SetFont(defaultfont, (NATIVE_FONT_SIZE-1) * frameScale)
			if self.panel then
				if self.unit =='player' then
					self.health.value:SetPoint('LEFT', self.panel, 'LEFT', gap*2, 5000) -- 5000 was 0
				elseif self.unit == 'target' then
					self.health.value:SetPoint('RIGHT', self.panel, 'RIGHT', -gap*2, 0)
				else
					self.health.value:SetPoint('RIGHT', self.panel, 'RIGHT', -gap*2, 0)
				end
			else
				self.health.value:SetPoint('TOPLEFT', gap*2, 0)
				self.health.value:SetPoint('BOTTOMRIGHT', -gap*2, 0)
				self.health.value:SetJustifyH('RIGHT')
			end
		end
as well as:

Code:
			if self.panel then
				self.power.value = self.power.value or self.power:CreateFontString(fname..'powerbarvalue', 'OVERLAY', 'GameFontNormal')
				self.power.value:SetFont(defaultfont, NATIVE_FONT_SIZE * frameScale)
				if self:GetHeight() > 30 then
					if self.panel then
						self.power.value:SetFont(defaultfont, (NATIVE_FONT_SIZE-1) * frameScale)
						if self.unit =='player' then
							self.power.value:SetPoint('RIGHT', self.panel, 'RIGHT', -gap*2, 0)
						elseif self.unit == 'target' then
							self.power.value:SetPoint('RIGHT', self.health.value, 'LEFT', -gap*2, 5000) -- 5000 was 0
						else
							self.power.value:SetPoint('RIGHT', self.health.value, 'LEFT', -gap*2, 0)
						end
					else
						self.power.value:SetPoint('TOPLEFT', gap*2, 0)
						self.power.value:SetPoint('BOTTOMRIGHT', -gap*2, 1)
						self.power.value:SetJustifyH('RIGHT')
					end
				end
			end
2) I want to lift up the special power bar a bit (about 2-4 px)

I have done:
Code:
	if self.orbs == nil or self.orbs[vmax] == nil then
		self.orbs = self.orbs or CreateFrame('frame', 'bOrbs', self)
		local class_color = bUnitFrames.colors.class[class]
		self.orbs:SetSize(14*vmax, 16)
		for i=1, vmax do
			local fname = 'bOrbs'..i
			self.orbs[i] = self.orbs[i] or self.orbs:CreateTexture(fname..'tex', 'OVERLAY')
			self.orbs[i]:SetTexture('Interface\\FriendsFrame\\StatusIcon-Offline')
			self.orbs[i]:SetBlendMode('ADD')
			self.orbs[i]:SetVertexColor(class_color.r, class_color.g, class_color.b)
			if class == 'WARLOCK' then
				local c_color = bUnitFrames.colors.WarlockPower[spec]
				self.orbs[i]:SetVertexColor(c_color.r*1.3, c_color.g*1.3, c_color.b*1.3)
			end
			self.orbs[i]:SetSize(16, 16)
			self.orbs[i].bg = self.orbs[i].bg or self.orbs:CreateTexture(fname..'texbg', 'OVERLAY')
			self.orbs[i].bg:SetTexture('Interface\\FriendsFrame\\StatusIcon-Offline')
			self.orbs[i].bg:SetVertexColor(.1,.1,.1)
			self.orbs[i].bg:SetSize(16, 16)
			if i==1 then
				self.orbs[i]:SetPoint('LEFT')
				self.orbs[i].bg:SetPoint('LEFT')
			else
				self.orbs[i]:SetPoint('LEFT', self.orbs[i-1], 'RIGHT', -2, 4) -- defaultvalue = -2, 0
				self.orbs[i].bg:SetPoint('LEFT', self.orbs[i-1].bg, 'RIGHT', -2, 4) -- defaultvalue = -2, 0
			end
			self.orbs[i].bg:SetDrawLayer('OVERLAY', 6)
			self.orbs[i]:SetDrawLayer('OVERLAY', 7)
		end
		self.orbs:SetPoint('CENTER', self.power, 'TOP')
	end
Which gives me this:


And i do not know why.

I want to change more stuff but this will take some time so please keep checking back from time to time if you are willing to help me

Thx alot I appreciate your help immensly!
__________________
Balance is, when everyone is unhappy.

Last edited by Syliha : 02-14-13 at 05:53 PM.
  Reply With Quote