View Single Post
09-28-09, 01:20 PM   #1202
Icerat
A Fallenroot Satyr
Join Date: Sep 2006
Posts: 28
At some point i swapped the reputation and experience code around for some reason and never noticed the loss of the pet experience bar, it was only after going through a few previous revision back ups that i noticed what i did, working code below:

Code:
-- REPUTATION BAR --		
	if(IsAddOnLoaded("oUF_Reputation")) then
			self.Reputation = CreateFrame("StatusBar", nil, self)
		if(IsAddOnLoaded("oUF_Experience") and UnitLevel("player") ~= MAX_PLAYER_LEVEL) then
				self.Reputation:SetPoint("BOTTOM", self, "TOP", 0, 12)
			else
				self.Reputation:SetPoint('BOTTOM', self, 'TOP', 0, 5) -- RepBar Position Once at max LvL
		end
			self.Reputation:SetHeight(3)
			self.Reputation:SetWidth(width)		
			self.Reputation:SetStatusBarTexture(texture2)
			self.Reputation:SetBackdrop(backdrop)
			self.Reputation:SetBackdropColor(0,0,0)	
			self.Reputation.PostUpdate = PostUpdateReputation
			
--			self.Reputation.Text = self.Reputation:CreateFontString(nil, 'OVERLAY', 'GameFontHighlightSmallOutline')
--			self.Reputation.Text:SetPoint('CENTER', self.Reputation)

			self.Reputation.bg = self.Reputation:CreateTexture(nil, "BORDER")
			self.Reputation.bg:SetAllPoints(self.Reputation)
			self.Reputation.bg:SetTexture(0.3, 0.3, 0.3)
			
			self.Reputation:SetScript ('OnEnter', function(self) self:SetAlpha(1) end)
			self.Reputation:SetScript ('OnLeave', function(self) self:SetAlpha(0) end)
			self.Reputation:SetAlpha(0)
			
			self.Reputation.Tooltip = true	
		end		
	end

-- EXPERIENCE BAR --
	if(IsAddOnLoaded('oUF_Experience') and (unit == 'player' or unit == 'pet')) then
			self.Experience = CreateFrame('StatusBar', nil, self)
			self.Experience:SetPoint('BOTTOMLEFT', self, 'TOPLEFT', 0, 5)
			self.Experience:SetPoint('BOTTOMRIGHT', self, 'TOPRIGHT', 0, 5)
				if(unit == "pet") then
					self.Experience:SetPoint("BOTTOMLEFT", self, "TOPLEFT", 0, -25)
				end
			self.Experience:SetHeight(3)
			self.Experience:SetStatusBarTexture(texture2)
			self.Experience:SetStatusBarColor(0.15, 0.7, 0.1)
			self.Experience.Tooltip = true
			
			self.Experience.Rested = CreateFrame('StatusBar', nil, self)
			self.Experience.Rested:SetParent(self.Experience)  -- Parent to the Experiance bar to get it to hide
			self.Experience.Rested:SetAllPoints(self.Experience)
			self.Experience.Rested:SetStatusBarTexture(texture2)
			self.Experience.Rested:SetStatusBarColor(0, 0.4, 1, 0.6)
			self.Experience.Rested:SetBackdrop(backdrop)
			self.Experience.Rested:SetBackdropColor(0, 0, 0)

--			self.Experience.Text = self.Experience:CreateFontString(nil, 'OVERLAY', 'GameFontHighlightSmallOutline')
--			self.Experience.Text:SetPoint('CENTER', self.Experience)

			self.Experience.bg = self.Experience.Rested:CreateTexture(nil, 'BORDER')
			self.Experience.bg:SetAllPoints(self.Experience)
			self.Experience.bg:SetTexture(0.3, 0.3, 0.3)
			
			self.Experience:SetScript ('OnEnter', function(self) self:SetAlpha(1) end)
			self.Experience:SetScript ('OnLeave', function(self) self:SetAlpha(0) end)
			self.Experience:SetAlpha(0)
	end
I don't understand fully why this made a difference but it did, i can only figure that it has something to do with the following in the Reputation bar code that sets the position of the rep bar at max lvl when the exp bar is no longer needed.
Code:
		if(IsAddOnLoaded("oUF_Experience") and UnitLevel("player") ~= MAX_PLAYER_LEVEL) then
				self.Reputation:SetPoint("BOTTOM", self, "TOP", 0, 12)
			else
				self.Reputation:SetPoint('BOTTOM', self, 'TOP', 0, 5) -- RepBar Position Once at max LvL
		end
As my knowledge improves I'm sure ill figure it out lol

Another question, whats the differeance between

Code:
self.Auras:SetPoint("BOTTOMRIGHT", self, 30, 0)
Code:
self.Auras:SetPoint("BOTTOMRIGHT", self, "TOPRIGHT", 30, 0)
From what I've observed the first put the aura icon where i want it 30 away from the bottom right edge of my target frame and the second puts it 30 away from the top right edge of the frame.

My question is why not use the first example, why do the various layouts I've looked at use the second example, whats the point of the "BOTTOMRIGHT" in the second example?

As always thanks for the responses and i look forward to learning from them.