Download
(182Kb)
Download
Updated: 02-05-15 07:20 PM
Compatibility:
Warlords of Draenor (6.0.3)
Updated:02-05-15 07:20 PM
Created:01-07-13 08:00 PM
Downloads:4,245
Favorites:0
MD5:

oUF Fail new power values

Version: oUF_Fail_Test Party pets 1.6.4d
by: Sauerkraut, MiRai

- For testing purposes only - Should not be downloaded -
Just for you Sp_i_ke

Post A Reply Comment Options
Unread 01-08-13, 04:13 AM  
MiRai
A Warpwood Thunder Caller

Forum posts: 96
File comments: 104
Uploads: 0
Alright, so I've kinda gone through your default oUF_Fail layout and made my own adjustments to suit my needs, so rather than just d/l this version and try it out, I'm copying & pasting chunks of code from this lib/core.lua into my current files.

So, I now have this in my lib.lua file:
Lua Code:
  1. lib.setArrowColor = function(self)
  2.     local _, pType = UnitPowerType("player")
  3.     local pcolor = oUF.colors.power[pType] or {.3,.45,.65}
  4.     self.Power.arrow:SetVertexColor(unpack(pcolor))
  5. end
  6.  
  7. lib.setTargetArrowColor = function(self)
  8.     local _, cType = UnitClass("target")
  9.     local ccolor = oUF.colors.class[cType] or {.3,.45,.65}
  10.     self.Power.arrow:SetVertexColor(unpack(ccolor))
  11. end
  12.  
  13. lib.setFocusArrowColor = function(self)
  14.     local _, dType = UnitClass("focus")
  15.     local dcolor = oUF.colors.class[dType] or {.3,.45,.65}
  16.     self.Power.arrow:SetVertexColor(unpack(dcolor))
  17. end
  18.  
  19. lib.setFocusTargetArrowColor = function(self)
  20.     local _, eType = UnitPowerType("focustarget")
  21.     local ecolor = oUF.colors.power[eType] or {.3,.45,.65}
  22.     self.Power.arrow:SetVertexColor(unpack(ecolor))
  23. end

...and I'm trying to create a power-colored arrow for my focus target frame. Changing the 'c' in cType and ccolor to 'd' seemed to work for my focus frame (although it still suffers from the same missing event (?) as the target frame where the arrow is initially white), so I figured I would just change the 'p' in pType and pcolor to 'e'.

Then I added this in the "focustarget" section of the core.lua file:

Lua Code:
  1. self.Power.arrow.colorPower = true
  2. self.Power.arrow.PostUpdate = lib.setFocusTargetArrowColor
  3.  
  4. self:RegisterEvent("PLAYER_LOGIN", lib.setFocusTargetArrowColor)
  5. self:RegisterEvent("UNIT_FOCUSTARGET", lib.setFocusTargetArrowColor)
  6. self:RegisterEvent("PLAYER_TARGET_CHANGED", lib.setFocusTargetArrowColor)
  7. self:RegisterEvent("PLAYER_ENTERING_WORLD", lib.setFocusTargetArrowColor)
  8. self:RegisterEvent("UNIT_DISPLAYPOWER", lib.setFocusTargetArrowColor)

...but I cannot get the arrow to change from white to the actual power color.





It's super late (way past my bedtime) and I'll give it another shot tomorrow. There must be a way to combine 'frames' into each type of arrow For example:

local _, pType = UnitPowerType("player") or UnitPowerType("focustarget")

...but I don't think you can just throw an 'or' statement in there.



Finally got a chance to do some dungeons with the new arrows and realized that by using...

Code:
if f.mystle ~= "tot"
...then that adds arrows to the party frames (and raid frames) as well. I will say that I like the arrows on the party frames and will keep them if I can work this power color issue out.


I also noticed that when targeting most NPCs their power arrow seems to inherit the player's class color.





I guess I'm not entirely sure if it's inheriting the player's class color or if it just defaults to the Warrior color. Is it possible to remove the arrow from NPCs that don't necessarily have power w/o adding a boat load of code?

I don't mean to stump you with these questions and, if you'd like, we can move this into the oUF forum to see if any of those gurus have an answer for this stuff. I would also like to apologize for my wall of text replies, but I'm just trying to be thorough and give you as much information as I can regarding what code I'm using, where I'm using it, and what I'm seeing on my screen.


Thanks!
Report comment to moderator  
Reply With Quote
Unread 01-08-13, 05:52 AM  
Sauerkraut
A Wyrmkin Dreamwalker
 
Sauerkraut's Avatar
AddOn Author - Click to view AddOns

Forum posts: 52
File comments: 267
Uploads: 8
I think the NPCs class is indeterminate so it would have to go by reaction I guess. I'll have to look through the API stuff again to see if there is a simple way to do it.

Code:
local _, pType = UnitPowerType("player") or UnitPowerType("focustarget")
That may work but I think it would have to be focus-target since that is what the API would return.

Code:
self:RegisterEvent("UNIT_FOCUSTARGET", lib.setFocusTargetArrowColor)
WOW doesn't have an event named UNIT_FOCUSTARGET so that won't do anything. You can check the events here: http://wowprogramming.com/docs/events.

This thread http://www.wowinterface.com/forums/s...ad.php?t=40293 has all the discussion on how I got the coloring to work in the first place.

Lots to do still but the progress is good
Report comment to moderator  
Reply With Quote
Unread 01-08-13, 12:43 PM  
Sauerkraut
A Wyrmkin Dreamwalker
 
Sauerkraut's Avatar
AddOn Author - Click to view AddOns

Forum posts: 52
File comments: 267
Uploads: 8
MiRai I've added you as a contributor so you can upload files if you like. Just tag them oUF_Fail2_MiRai or something so we can keep the branches. I'll be able to look at it more tonight when I get home from work. See if I can't figure out the right event trigger and the focus target.
Report comment to moderator  
Reply With Quote
Unread 01-08-13, 12:53 PM  
MiRai
A Warpwood Thunder Caller

Forum posts: 96
File comments: 104
Uploads: 0
Originally Posted by Sauerkraut
Code:
local _, pType = UnitPowerType("player") or UnitPowerType("focustarget")
That may work but I think it would have to be focus-target since that is what the API would return.
Adding the or seems to force the arrow to the RGB color specified in the {}'s. If I change it to this:

Lua Code:
  1. lib.setPowerArrowColor = function(self)
  2.     local _, pType = UnitPowerType("player") or UnitPowerType("focus-target")
  3.     local pcolor = oUF.colors.power[pType]
  4.     self.Power.arrow:SetVertexColor(pcolor)
  5. end

...then the arrow just ends up being colored black.


Originally Posted by Sauerkraut
WOW doesn't have an event named UNIT_FOCUSTARGET so that won't do anything. You can check the events here: http://wowprogramming.com/docs/events.
Looking through the events listed there I added "UNIT_POWER" to the Target's events and that seems to make the arrow grab the correct class color upon the initial targeting but, there is about a one second delay before the arrow changes from white to the correct class color. This, however, isn't working for me on the Focus frame and I am still required to change targets before the arrow updates to the correct class color.

I also tried adding the undocumented event "UNIT_POWER_BAR_SHOW", but that doesn't seem to change anything.


Originally Posted by Sauerkraut
This thread http://www.wowinterface.com/forums/s...ad.php?t=40293 has all the discussion on how I got the coloring to work in the first place.
Man... some of the stuff that those guys say in that thread is waaaay over my head. One day I'll get to that level, but first, baby steps.

Originally Posted by Sauerkraut
MiRai I've added you as a contributor so you can upload files if you like. Just tag them oUF_Fail2_MiRai or something so we can keep the branches. I'll be able to look at it more tonight when I get home from work. See if I can't figure out the right event trigger and the focus target.
Sorry, saw your reply late (had been typing out my long reply). Thanks. My attention on this for the next few days may be short as I've got some work-related stuff I really need to take care of, but I'll be keep checking up on this.
Last edited by MiRai : 01-08-13 at 12:57 PM.
Report comment to moderator  
Reply With Quote
Unread 01-08-13, 03:46 PM  
Sauerkraut
A Wyrmkin Dreamwalker
 
Sauerkraut's Avatar
AddOn Author - Click to view AddOns

Forum posts: 52
File comments: 267
Uploads: 8
Try and upload your working copy for me so I can see everything that is going on. If you have a chance.
Report comment to moderator  
Reply With Quote
Unread 01-08-13, 05:39 PM  
MiRai
A Warpwood Thunder Caller

Forum posts: 96
File comments: 104
Uploads: 0
Alright, I think I correctly uploaded what I've got (never done this before) and I disabled the version warning (not sure if that's a big deal or not). There's kind of a lot of hacking and slashing going in those files since I'm constantly tweaking the layout and I'm sure you'll notice a lot of things that could be possibly coded much more efficiently.

FYI - I use the outdated oUF_Fader plug-in for oUF and you'll see those settings listed in core.lua -- They don't seem to throw any errors if you don't have the plug-in loaded so I just left those lines in there. However, if you do happen to load up oUF_Fader, you're going to get a taint error when you first enter combat after entering the world or after a /reload (only happens once -- I've just been living with the taint error forever now since p3lim does not seem interested in updating his plug-in).

In my version (just off the top of my head -- haven't really kept a changelog):
  • X,Y positions changes for numerous frames
  • Some castbars moved
  • Stripped some text from the frames
  • BG countdown timer is now the same as the mirror castbar -- Had this change done back in Cataclysm by Choonster on the WoW UI forum (Choonstertwo on WoWI) and you're more than welcome to keep this if you like it although it has a slight blemish that I just accept (can explain this further if you're interested).
  • lib.lua contains the newest attempt at making arrows the correct color
  • core.lua reflects most of that change (no idea how to get party working)
  • Debuffs moved up for all classes now since the power arrow on the target frame is present (will need to figure something to do with combo points // will cross that bridge when I get there)

Would like to:
  • Move the ToT and FocusTarget frames just a few pixels to the right from the frames they are parented to -- When the power arrows are at 100% they overlap with those frames.
  • Correctly color the arrow for the FocusTarget & Party frames (possibly arena frames in the future)
  • Correctly color the arrow for the Focus frame w/o the need to switch targets
  • Possibly figure out why the arrow for the target frame has a 1 second delay picking up the class-color for the initial target after entering the world or a /reload

Again, this list was just off the top of my head and I'm sure I'm forgetting little changes I've made throughout the last 6+ months while using your layout.

EDIT: Apologies, but I just noticed that the focus target power arrow lib.lua is showing "focustarget". I can assure you that I did indeed try out "focus-target" like you suggested before. Also realized the ToT frame actually has it's X,Y listed in the cfg file (/facepalm).
Last edited by MiRai : 01-08-13 at 05:54 PM.
Report comment to moderator  
Reply With Quote
Unread 01-08-13, 06:45 PM  
MiRai
A Warpwood Thunder Caller

Forum posts: 96
File comments: 104
Uploads: 0
Just noticed the target's power arrow can default to the RGB blue color if you clear your target and reacquire it too quickly (e.g. target yourself with F1, then press Escape to clear and quickly press F1 again to re-target yourself -- 50/50 shot that you get the class color or the default blue).

Also, I'm noticing that the target power arrow is...... kinda useless in PvE because trash either dies too fast to matter or bosses have almost infinite power/mana so the arrow never moves (and I could care less about the power arrow on friendly NPCs). So, I wanted to try and remove the target's power arrow if the target was not a player using:

Lua Code:
  1. if UnitIsPlayer("target") then
  2.     lib.setTargetArrowColor = function(self)
  3.         local _, cType = UnitClass("target")
  4.         local ccolor = oUF.colors.class[cType] or {.3,.45,.65}
  5.         self.Power.arrow:SetVertexColor(unpack(ccolor))
  6.     end
  7. end

and

Lua Code:
  1. lib.setTargetArrowColor = function(self)
  2.     if UnitIsPlayer("target") then
  3.         local _, cType = UnitClass("target")
  4.         local ccolor = oUF.colors.class[cType] or {.3,.45,.65}
  5.         self.Power.arrow:SetVertexColor(unpack(ccolor))
  6.     end
  7. end

...but neither seem to be working (although I'm getting no errors) and the arrow is spawning on the NPC target frame anyway. Perhaps I'm lacking an IF statement in the core somewhere?

This is working for debuffs, though:

Lua Code:
  1. if UnitIsPlayer("target") then
  2.     b:SetPoint("BOTTOMLEFT", f, "TOPLEFT", 0, 17)
  3. else
  4.     b:SetPoint("BOTTOMLEFT", f, "TOPLEFT", 0, 6)
  5. end
Report comment to moderator  
Reply With Quote
Unread 01-09-13, 02:48 PM  
MiRai
A Warpwood Thunder Caller

Forum posts: 96
File comments: 104
Uploads: 0
Alright, so I feel dumb because my lack of Lua, and coding knowledge in general, are showing.

Lua Code:
  1. lib.setTargetArrowColor = function(self)
  2.     if UnitIsPlayer("target") then
  3.         local _, cType = UnitClass("target")
  4.         local ccolor = oUF.colors.class[cType] or {.3,.45,.65}
  5.         self.Power.arrow:SetVertexColor(unpack(ccolor))
  6.     else
  7.         self.Power.arrow:Hide()
  8.     end
  9. end

This works... kind of. The power arrow will show when a player is being targeted and hide when an NPC is being targeted, however, the arrow will no longer show on a player at all once an NPC has been targeted until after a /reload.

I won't get a chance to look at this until a little later, but will a loop come in handy at this point?

EDIT: It actually disappears after I clear my target and reacquire one, regardless of whether I've targeted an NPC or not. =\

EDIT: HA! Once you hide it, it needs to be shown again! Adding self.Power.arrow:Show() has done the trick.
Last edited by MiRai : 01-09-13 at 03:02 PM.
Report comment to moderator  
Reply With Quote
Unread 01-10-13, 11:45 AM  
MiRai
A Warpwood Thunder Caller

Forum posts: 96
File comments: 104
Uploads: 0
Well...






It's working great without and gimmicks (can't test out party at the moment) and I can't take any credit for it. It's still using the old, less elegant, code and I will update this later today.
Report comment to moderator  
Reply With Quote
Unread 01-10-13, 12:01 PM  
Sauerkraut
A Wyrmkin Dreamwalker
 
Sauerkraut's Avatar
AddOn Author - Click to view AddOns

Forum posts: 52
File comments: 267
Uploads: 8
Nice work can't wait to see how it was done.
Report comment to moderator  
Reply With Quote
Unread 01-10-13, 12:32 PM  
MiRai
A Warpwood Thunder Caller

Forum posts: 96
File comments: 104
Uploads: 0
Phanx's more elegant solution from the oUF thread was missing one little tiny adjustment:

Code:
self.Power.arrow
...should be:

Code:
self.arrow


Here is the final code for the lib:

Code:
local arrow = {[[Interface\Addons\oUF_Fail\media\textureArrow]]}
local arrowDefaultColor = {.3,.45,.65}

lib.setPowerArrowColor = function(self)
	if UnitIsPlayer(self.__owner.unit) then
		local _, powerType = UnitPowerType(self.__owner.unit)
		self.arrow:SetVertexColor(unpack(oUF.colors.power[powerType] or arrowDefaultColor))
		self.arrow:Show()
	else
		self.arrow:Hide()
	end
end

lib.setClassArrowColor = function(self)
	if UnitIsPlayer(self.__owner.unit) then
		local _, class = UnitClass(self.__owner.unit)
		self.arrow:SetVertexColor(unpack(oUF.colors.class[class] or arrowDefaultColor))
		self.arrow:Show()
	else
		self.arrow:Hide()
	end
end




EDIT: I've yet to upload my working version since I'd like to make some other adjustments to it before I do.
Last edited by MiRai : 01-10-13 at 12:50 PM.
Report comment to moderator  
Reply With Quote
Unread 01-10-13, 06:29 PM  
MiRai
A Warpwood Thunder Caller

Forum posts: 96
File comments: 104
Uploads: 0
I just realized that the pic I have in the post below doesn't have a player power arrow. I don't know why that is, but I can guarantee that it is indeed still working.

I've been trying to get fancy with the arrow's code and threw up another post in the oUF thread. Once I get this fixed I'll upload another alpha/beta version of this layout.
Report comment to moderator  
Reply With Quote
Unread 01-10-13, 06:45 PM  
Sauerkraut
A Wyrmkin Dreamwalker
 
Sauerkraut's Avatar
AddOn Author - Click to view AddOns

Forum posts: 52
File comments: 267
Uploads: 8
You can over ride the color given to rage at the top of the lib.lua file. Go to http://html-color-codes.info/ and pick your shade. Use the second color picker. You'll get three values in the R G B. They will need to either be converted to a decimal. Take the number and divide by 255. Or you can just put them in as R/255, G/255, B/255.

So currently it is
Code:
  oUF.colors.power['RAGE'] = {1.0,0,0}
try
Code:
  oUF.colors.power['RAGE'] = {0.56,0,0}
It will make it a darker red.
Last edited by Sauerkraut : 01-10-13 at 06:48 PM.
Report comment to moderator  
Reply With Quote
Unread 01-11-13, 08:06 AM  
MiRai
A Warpwood Thunder Caller

Forum posts: 96
File comments: 104
Uploads: 0
Well, I wanted a different color of rage only on the focus target frame because the default bright red color was kind of distracting. Phanx threw out a fix in that oUF thread which seems to be working out good so far.

(Meant to post this last night, but I must have not pressed the submit button.)
Report comment to moderator  
Reply With Quote
Unread 01-11-13, 11:29 AM  
Sauerkraut
A Wyrmkin Dreamwalker
 
Sauerkraut's Avatar
AddOn Author - Click to view AddOns

Forum posts: 52
File comments: 267
Uploads: 8
Phanx posted an excellent solution I'm glad it worked. I have one question for you now. I've been playing around with the code Phanx posted and looking through what you posted, but I don't see where you are calling lib.setPowerArrowColor to color your arrow.
Report comment to moderator  
Reply With Quote
Post A Reply



Category Jump: