Thread Tools Display Modes
10-26-08, 06:31 AM   #161
p3lim
A Pyroguard Emberseer
 
p3lim's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2007
Posts: 1,710
Originally Posted by Balkeep View Post
So there is no way of forcing player, target, focus to update onthefly?

Also who can tell me why this function doesnt work? it supposed to determine if unit has certain buff or not...
Code:
local function Buffed(unit, auraName)
	local i = 1
	while false do
		if i == 73 then break end
		if auraName == select(1,UnitAura(unit, i)) then	return true end
		i = i +1
		end
	end
pfff... i feel that i need to start from basics cuz my usual research method is too slow for programming (figuring out how similar things work and adapting them for myself).
Why make another function?
Code:
if(UnitAura('player', 'Innervate')) then
 
10-26-08, 08:32 AM   #162
Balkeep
A Cyclonian
 
Balkeep's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2007
Posts: 43
OMG it works that way? thx =P

Last edited by Balkeep : 10-26-08 at 04:22 PM.
 
10-27-08, 03:23 AM   #163
zork
A Pyroguard Emberseer
 
zork's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 1,740
I am having problem with ComboPoints not properly resetting after fights or when tabbing. This is how I implemented it:

Code:
    if unit == "target" then
      self.CPoints = SetFontString(self.Health, d3font, 24, "THINOUTLINE")
      self.CPoints:SetPoint("LEFT", self.Name, "RIGHT", 5, -1)
      self.CPoints:SetTextColor(1, .5, 0)
    end
This didn't work, so I tried something dirty.

I added
Code:
      local mycombo = GetComboPoints("target") 
      if mycombo >= 1 then
        self.CPoints:SetText(mycombo)
      end
to the updatehealth func which finally reseted the Combo Points after a fight was over but tabbing still does not work.

GetComboPoints("player") does not seem to work properly too, it does not reset correctly. When I got out of a fight with 5 points it kept that 5 points.

Maybe its my oUF, haven't updated it for a while (Version 1.1.4).

cpoints.lua
Code:
local parent = debugstack():match[[\AddOns\(.-)\]]
local global = GetAddOnMetadata(parent, 'X-oUF')
assert(global, 'X-oUF needs to be defined in the parent add-on.')
local oUF = _G[global]

local wotlk = select(4, GetBuildInfo()) >= 3e4
local GetComboPoints = GetComboPoints
local MAX_COMBO_POINTS = MAX_COMBO_POINTS

local ename
if(wotlk) then
	ename = 'UNIT_COMBO_POINTS'
else
	ename = 'PLAYER_COMBO_POINTS'
end

-- TODO: This shouldn't be hardcoded in wotlk.
oUF[ename] = function(self, event, unit)
	if(wotlk and unit ~= 'player') then return end
	local cp = GetComboPoints('player', 'target')
	local cpoints = self.CPoints

	if(#cpoints == 0) then
		cpoints:SetText((cp > 0) and cp)
	else
		for i=1, MAX_COMBO_POINTS do
			if(i <= cp) then
				cpoints[i]:Show()
			else
				cpoints[i]:Hide()
			end
		end
	end
end

table.insert(oUF.subTypes, function(self, unit)
	if(self.CPoints and unit == "target") then
		self:RegisterEvent(ename)
	end
end)
oUF:RegisterSubTypeMapping(ename)
Oh...maybe I should have used
Code:
      local mycombo = GetComboPoints("player","target") 
      if mycombo >= 1 then
        self.CPoints:SetText(mycombo)
      end
but that is what cpoints.lua does and its not working.
__________________
| Simple is beautiful.
| WoWI AddOns | GitHub | Zork (WoW)

"I wonder what the non-pathetic people are doing tonight?" - Rajesh Koothrappali (The Big Bang Theory)

Last edited by zork : 10-27-08 at 03:28 AM.
 
10-27-08, 03:28 AM   #164
haste
Featured Artist
 
haste's Avatar
Premium Member
Featured
Join Date: Dec 2005
Posts: 1,027
Update your oUF, and add: self.CPoints.unit = 'player'.
 
10-27-08, 12:01 PM   #165
arnath_vp
A Murloc Raider
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 9
Can someone explain to me what the possible values of filter to UnitAura actually do? In particular, what do "PLAYER" and "RAID" do (e.g., is "PLAYER" buffs/debuffs the player casted or buffs/debuffs they can remove)?
 
10-27-08, 12:07 PM   #166
p3lim
A Pyroguard Emberseer
 
p3lim's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2007
Posts: 1,710
the one that has it
 
10-27-08, 01:22 PM   #167
Coldfury
A Deviate Faerie Dragon
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 18
Originally Posted by arnath_vp View Post
Can someone explain to me what the possible values of filter to UnitAura actually do? In particular, what do "PLAYER" and "RAID" do (e.g., is "PLAYER" buffs/debuffs the player casted or buffs/debuffs they can remove)?
wowwiki says:

filter
This parameter can be any of "HELPFUL", "HARMFUL", "PLAYER", "RAID", "CANCELABLE", "NOT_CANCELABLE". You can also specify several filters separated by a space or | character to chain multiple filters together (e.g. "HELPFUL|RAID" == helpful buffs that you can cast on your raid). By default UnitAura has "HELPFUL" as an implicit filter - you cannot get back BOTH helpful and harmful at the same time. Neither "HELPFUL" or "HARMFUL" have meaning for UnitBuff/UnitDebuff, and will be ignored.
 
10-27-08, 01:38 PM   #168
p3lim
A Pyroguard Emberseer
 
p3lim's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2007
Posts: 1,710
Originally Posted by Coldfury View Post
wowwiki says:

filter
This parameter can be any of "HELPFUL", "HARMFUL", "PLAYER", "RAID", "CANCELABLE", "NOT_CANCELABLE". You can also specify several filters separated by a space or | character to chain multiple filters together (e.g. "HELPFUL|RAID" == helpful buffs that you can cast on your raid). By default UnitAura has "HELPFUL" as an implicit filter - you cannot get back BOTH helpful and harmful at the same time. Neither "HELPFUL" or "HARMFUL" have meaning for UnitBuff/UnitDebuff, and will be ignored.
Thats the 3rd argument, I though you meant the first
 
10-27-08, 05:07 PM   #169
arnath_vp
A Murloc Raider
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 9
I read the WoWWiki documentation but it doesn't describe what "PLAYER" is and I wasn't sure from just the name whether it was auras the player casted or auras the player can remove.
 
10-29-08, 09:14 AM   #170
ObbleYeah
A Cobalt Mageweaver
AddOn Author - Click to view addons
Join Date: Sep 2008
Posts: 210
Is it possible to get my healthbars colour by gradiant, but have my 100% colour as class colors? I've attempted it by adding

Code:
	if(max ~= 0) then
	    local class, rclass = UnitClass(unit)
		color = ouf.color.class(unit)
		r, g, b = self.ColorGradient(min/max, .69,.31,.31, .71,.43,.27, color[1],color[2],color[3])
	end
to my Health update. But to no avail.
 
10-29-08, 09:34 AM   #171
zork
A Pyroguard Emberseer
 
zork's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 1,740
This should do it:
Code:
  
  --happiness table  
  
  local colors2 = {
    happiness = {
      [0] = {r = 1, g = 1, b = 1}, -- bla test
      [1] = {r = 1, g = 0, b = 0}, -- need.... | unhappy
      [2] = {r = 1, g = 1, b = 0}, -- new..... | content
      [3] = {r = 0, g = 1, b = 0}, -- colors.. | happy
    },
  }    
    
  --update health func
  
  local function updateHealth(self, event, unit, bar, min, max)
  
    local d = floor(min/max*100)
    local value = min/max
    
    local color, smooth_r, smooth_g, smooth_b
    
    -- gradient color        
    if(value > 0.5) then
      smooth_r = (1 - value) * 2
      smooth_g = 1
    else
      smooth_r = 1
      smooth_g = value * 2
    end
    smooth_b = 0
    
    --background color
    self.Health.bg:SetVertexColor(0.15,0.15,0.15,1)
    
    --if percentage = 100 
    if d == 100 then
    
      if UnitIsPlayer(unit) then
        if RAID_CLASS_COLORS[select(2, UnitClass(unit))] then
          color = RAID_CLASS_COLORS[select(2, UnitClass(unit))]
        end
      elseif unit == "pet" and UnitExists("pet") and GetPetHappiness() then
        local happiness, _, _ = GetPetHappiness()
        color = colors2.happiness[happiness]
      else
        color = FACTION_BAR_COLORS[UnitReaction(unit, "player")]
      end
      
      if color then
        self.Health:SetStatusBarColor(color.r,color.g,color.b)
        self.Name:SetTextColor(color.r,color.g,color.b)
        bar.value:SetTextColor(color.r,color.g,color.b)  
      end
    
    --if percentage < 100
    else
      self.Health:SetStatusBarColor(smooth_r,smooth_g,smooth_b)
      self.Name:SetTextColor(smooth_r,smooth_g,smooth_b)
      bar.value:SetTextColor(smooth_r,smooth_g,smooth_b)
      
    end
    
    --set hp value
    bar.value:SetText(d.."%")
  
  end
__________________
| Simple is beautiful.
| WoWI AddOns | GitHub | Zork (WoW)

"I wonder what the non-pathetic people are doing tonight?" - Rajesh Koothrappali (The Big Bang Theory)

Last edited by zork : 10-29-08 at 09:46 AM.
 
10-29-08, 12:13 PM   #172
ObbleYeah
A Cobalt Mageweaver
AddOn Author - Click to view addons
Join Date: Sep 2008
Posts: 210
Originally Posted by zork View Post
<snip>
I stuck this in my Healthupdate, and got some weird assed coloured bars (as seen here:http://i37.tinypic.com/15g71uu.jpg)

Here's the whole healthupdate i'm using

http://www.pastey.net/100070

I also wanted it to be more like a gradual change from the raid class colour to yellow to red, rather than a sudden change from the class colour to a vivid green. I couldn't work out how to change that from your code :<

Edit:Found i hadn't stuck an end in between 22-23. So the coloring is fixed now

Last edited by ObbleYeah : 10-29-08 at 12:35 PM.
 
10-29-08, 05:13 PM   #173
MiKE41
A Murloc Raider
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 4
border issue

I'm having a small issue with some simple border creation.

I started with oUF_P3lim. While modifying it to my liking I decided to add portraits with a gradient as their background and a one pixel border on every side, placed one pixel out from the gradient. This worked great for the player frame, however when I copied this code over to the target frame the border changed to 2px on the left and right sides, and stayed 1px on the top and bottom.

A screenshot of my issue can be seen http://mich431.com/wow/ui/problem.jpg there.

The code I am using can be found http://mich431.com/wow/ui/oUF_P3lim/oUF_P3lim.lua there.

The player portrait frame is found on lines 207 to 223, the targets portrait frame on lines 351 to 368.

I can't seem to find the problem.

Any help would be appreciated much,
Michael
 
10-29-08, 05:28 PM   #174
p3lim
A Pyroguard Emberseer
 
p3lim's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2007
Posts: 1,710
Originally Posted by MiKE41 View Post
I'm having a small issue with some simple border creation.

I started with oUF_P3lim. While modifying it to my liking I decided to add portraits with a gradient as their background and a one pixel border on every side, placed one pixel out from the gradient. This worked great for the player frame, however when I copied this code over to the target frame the border changed to 2px on the left and right sides, and stayed 1px on the top and bottom.

A screenshot of my issue can be seen http://mich431.com/wow/ui/problem.jpg there.

The code I am using can be found http://mich431.com/wow/ui/oUF_P3lim/oUF_P3lim.lua there.

The player portrait frame is found on lines 207 to 223, the targets portrait frame on lines 351 to 368.

I can't seem to find the problem.

Any help would be appreciated much,
Michael
That is one of the most ****ed up things about this game; Its hard to get the scale right!

Try adjusting your UI scale a little bit, could work
 
10-29-08, 05:35 PM   #175
MiKE41
A Murloc Raider
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 4
It is definitely having an effect, however its not quite working out exactly how I want it to. I will continue to mess around with it though, thanks!

Edit: Changing the edgesize to 2 and self.Portrait's y position to 51.25 fixed it. Thanks again for the tip P3lim!

Last edited by MiKE41 : 10-29-08 at 05:50 PM.
 
10-30-08, 03:18 AM   #176
Silviu
A Defias Bandit
AddOn Author - Click to view addons
Join Date: May 2006
Posts: 3
Hello, i`m trying to get the "old UnitReactionColor" functionality back to my updatename function but with no result Problem is i don`t really know so good LUA. The old function was after "RAID_CLASS_COLORS[select(2, UnitClass(unit))]"
Here is my updatename function
Code:
local updateName = function(self, event, unit)
	if(self.unit == unit or (not unit and self.unit)) then
		local unit = unit or self.unit
		local name = UnitName(unit)
		local index = GetRaidTargetIndex(self.unit)
		if(UnitIsTapped(unit) and not UnitIsTappedByPlayer(unit) or not UnitIsConnected(unit)) then
			self.Name:SetTextColor(.6, .6, .6)
		else
			local color = UnitIsPlayer(unit) and RAID_CLASS_COLORS[select(2, UnitClass(unit))]
			if(color) then self.Name:SetTextColor(color.r, color.g, color.b) end
		end
		self.Name:SetText(name)
	if unit == "target" then
		updateLevel(self, unit)
		end
	end
end
 
10-30-08, 05:05 AM   #177
zork
A Pyroguard Emberseer
 
zork's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 1,740
Originally Posted by Silviu View Post
Hello, i`m trying to get the "old UnitReactionColor" functionality back ...
Try this:

Code:
local updateName = function(self, event, unit)
  if(self.unit == unit or (not unit and self.unit)) then
    local unit = unit or self.unit
    local name = UnitName(unit)
    local index = GetRaidTargetIndex(self.unit)
    if(UnitIsTapped(unit) and not UnitIsTappedByPlayer(unit) or not UnitIsConnected(unit)) then
      self.Name:SetTextColor(.6, .6, .6)
    else
      local color
      --snip
      if UnitIsPlayer(unit) then
        color = RAID_CLASS_COLORS[select(2, UnitClass(unit))]
      else
        color = FACTION_BAR_COLORS[UnitReaction(unit, "player")]
      end
      --snip end
      if(color) then self.Name:SetTextColor(color.r, color.g, color.b) end
    end
    self.Name:SetText(name)
  if unit == "target" then
    updateLevel(self, unit)
    end
  end
end
__________________
| Simple is beautiful.
| WoWI AddOns | GitHub | Zork (WoW)

"I wonder what the non-pathetic people are doing tonight?" - Rajesh Koothrappali (The Big Bang Theory)
 
10-30-08, 05:33 AM   #178
Silviu
A Defias Bandit
AddOn Author - Click to view addons
Join Date: May 2006
Posts: 3
Originally Posted by zork View Post
Try this:
Thank u verry verry much works :P
 
10-30-08, 09:23 AM   #179
ObbleYeah
A Cobalt Mageweaver
AddOn Author - Click to view addons
Join Date: Sep 2008
Posts: 210
Just a quick note to say i got it working, thanks Roth <3

Finished healthupdate: http://www.pastey.net/100161

I still need to convert the oldschool style RAID_CLASS_COLORS to the new ouf color code, but i'm happy with it at the minute.
 
10-31-08, 05:56 PM   #180
zork
A Pyroguard Emberseer
 
zork's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 1,740
Is it possible to do 2D portraits?

3D portraits working just fine but it would add another option.

http://zorktdmog.zo.funpic.de/rothui...108_225210.jpg

I love oUF .
__________________
| Simple is beautiful.
| WoWI AddOns | GitHub | Zork (WoW)

"I wonder what the non-pathetic people are doing tonight?" - Rajesh Koothrappali (The Big Bang Theory)
 

WoWInterface » Featured Projects » oUF (Otravi Unit Frames) » oUF - Layout discussion


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off