Download
(2 Kb)
Download
Updated: 08-30-08 06:54 AM
Addon for:
oUF.
Pictures
File Info
Updated:08-30-08 06:54 AM
Created:unknown
Downloads:2,404
Favorites:8
MD5:
oUF Fader - Obsolete
Version: 1.2
by: Slakah [More]
Description
This is a plugin for oUF, which will set the alpha of your oUF frames depending on conditions, the difference between this and oUF_BarFader is oUF_Fader handles custom conditions and a lot more conditions.

How to use.
To use this in your oUF layout you will need a Fader table in your oUF unit object:
e.g.
Code:
self.Fader = {
        [1] = {UnitNotMaxHealth = 1, Flying = 0.5},
        [2] = {Resting = 0.2}, 
        [3] = {PlayerTarget = 0.5}, 
        [4] = {notCombat = 0.7}
    }
You will also need to add oUF_Fader as an optional dep in your layout.

The numbers in red represents the priority of the condition, the lower the number the higher the priority, so Flying will always be priorotised over Resting. If 2 conditions are met and have the same priority then the one with the highest alpha will be chosen
The numbers in blue represents the alpha to be used when the condition is met.
The string in green represent conditions which have to be met for the alpha to be changed.

Also put a NormalAlpha value in your object table so oUF_Fader knows what the alpha of the frame should be when no conditions are met.

e.g.
Code:
self.NormalAlpha = 1
If NormalAlpha is not supplied then the alpha of the frame at creation is used.


Built in Conditions


PlayerHostileTarget: If player can attack target.
UnitHostileTarget: If the unit of the frame can attack it's target.
PlayerTarget: If player has a target.
UnitTarget: If the unit of the frame has a target.
PlayerTaxi: If player is on a taxi (windrider).
UnitTaxi: If the unit of the frame is on a taxi.
PlayerMaxHealth: If player is on maximum health.
UnitMaxHealth: If the unit of the frame is on maximum health.
PlayerMaxMana: If player is on maximum mana.
UnitMaxMana: If the unit of the frame is on maximum mana.
Stealth: If player is stealthed.
Flying: If player is on a flying mount.
Resting: If the player is in a City or Inn.
Combat: If the player is in Combat.

Prefixing a condition with a not outputs the reverse of the condition, i.e. notStealth = .5 would set the alpha to .5 when the player isn't stealthed.


Creating your own Conditions
You can create your own conditions to change alpha.

You can create your own condition by using this function
oUF.Fader:RegisterCondition(name, func, event)
Arguments
name - the name of the condition to be used to in the object (string)
func - the function to access whether the condition has been met, the function has to arguments arg1 = the unit frame obj, arg2 = the unit (function)
event - any events which will fire when the condition has changed, for multiple events seperate with a ":" (string)

Example
Somewhere at the top of your file.
Code:
oUF.Fader:RegisterCondition("Combat", function()    return InCombatLockdown() end, "PLAYER_REGEN_ENABLED:PLAYER_REGEN_DISABLED")
1.1 - Can't remember.
1.2 - Added oUF.Fader:RegisterCondition(), added metatables to handle not.
Post A Reply Comment Options
Unread 08-29-08, 08:27 AM  
DJJoeJoe
A Murloc Raider
 
DJJoeJoe's Avatar
AddOn Compiler - Click to view compilations

Forum posts: 5
File comments: 168
Uploads: 1
depending on conditions
Perhaps some examples?
__________________

Joetest - Ner'Zhul - Disciples of Death
DJJoeJoe is offline Report comment to moderator  
Reply With Quote
Unread 10-12-08, 07:26 AM  
Blt
A Defias Bandit
AddOn Author - Click to view AddOns

Forum posts: 2
File comments: 24
Uploads: 2
I'm a little confused by the syntax to create your own conditions. I want to create one based on range, but I'm not sure if it's even viable the way the feature is set up?

First for the syntax. I THINK this is how such a function should look, but I'm not completely sure:

oUF.Fader:RegisterCondition("inRange", function() return IsSpellInRange(spellName,unit) end, "ACTIONBAR_UPDATE_USABLE")


Yeah i know this won't work, but it's more about the syntax (unless I'm missing something oUF has been pretty terribly documented so far. I've had to read through the code to figure anything out ). To start I don't think USABLE works for things like range (Can't test it right now, i'm away from my WoW account, but I don't think it does), and even if it did it would only really work on my target. Beyond that, IsSpellInRange can also return nil, and I haven't looked through your code to see if that would play well or not.

The goal is to have my raid frames fade if the unit is not in range to heal. It came in big help prioritizing heals during fights like Illidan where you have to spread out, and not everyone might be in range. However, this might be outside the current scope of the mod and not be possible without some sort of scheduler? If this is the case, I ask that this as a feature be added, i'm new to the WoW API and I have a feeling i'd make a mess of things if I tried to write one myself.
Last edited by Blt : 10-12-08 at 07:27 AM.
Blt is offline Report comment to moderator  
Reply With Quote
Unread 10-12-08, 12:21 PM  
Slakah
A Molten Giant
 
Slakah's Avatar
AddOn Author - Click to view AddOns

Forum posts: 863
File comments: 146
Uploads: 26
Originally posted by Blt
I'm a little confused by the syntax to create your own conditions. I want to create one based on range, but I'm not sure if it's even viable the way the feature is set up?

First for the syntax. I THINK this is how such a function should look, but I'm not completely sure:

oUF.Fader:RegisterCondition("inRange", function() return IsSpellInRange(spellName,unit) end, "ACTIONBAR_UPDATE_USABLE")


Yeah i know this won't work, but it's more about the syntax (unless I'm missing something oUF has been pretty terribly documented so far. I've had to read through the code to figure anything out ). To start I don't think USABLE works for things like range (Can't test it right now, i'm away from my WoW account, but I don't think it does), and even if it did it would only really work on my target. Beyond that, IsSpellInRange can also return nil, and I haven't looked through your code to see if that would play well or not.

The goal is to have my raid frames fade if the unit is not in range to heal. It came in big help prioritizing heals during fights like Illidan where you have to spread out, and not everyone might be in range. However, this might be outside the current scope of the mod and not be possible without some sort of scheduler? If this is the case, I ask that this as a feature be added, i'm new to the WoW API and I have a feeling i'd make a mess of things if I tried to write one myself.
Out of range alpha is built in to oUF take a look at http://ixo.no/git/oUF.git/tree/elements/range.lua.

i.e. put in your spawn function:

Code:
self.outsideRangeAlpha = 0.7
self.inRangeAlpha = 1
The purpose of this module is to handle fading when for different conditions such as when you have aggro etc.

Hope this helps.
Slakah is offline Report comment to moderator  
Reply With Quote
Unread 10-12-08, 04:16 PM  
Blt
A Defias Bandit
AddOn Author - Click to view AddOns

Forum posts: 2
File comments: 24
Uploads: 2
It does, I feel silly now. Thanks.
Blt is offline Report comment to moderator  
Reply With Quote
Unread 10-13-08, 01:31 PM  
dafire
Premium Member
Premium Member
AddOn Author - Click to view AddOns

Forum posts: 216
File comments: 39
Uploads: 3
i think you got a bug in two conditions:

Code:
PlayerMaxHealth = function() return unit and not UnitIsDeadOrGhost("player") and UnitHealth("player") == UnitHealthMax("player") end,

PlayerMaxMana = function() return unit and not UnitIsDeadOrGhost("player") and UnitMana("player") == UnitManaMax("player") end,
the problem is that those functions don't get unit as parameter.. so it's always nil before the first and.
Last edited by dafire : 10-13-08 at 01:33 PM.
dafire is offline Report comment to moderator  
Reply With Quote
Unread 02-26-09, 01:31 PM  
PProvost
A Deviate Faerie Dragon
AddOn Author - Click to view AddOns

Forum posts: 13
File comments: 126
Uploads: 24
Originally posted by dafire
i think you got a bug in two conditions:

Code:
PlayerMaxHealth = function() return unit and not UnitIsDeadOrGhost("player") and UnitHealth("player") == UnitHealthMax("player") end,

PlayerMaxMana = function() return unit and not UnitIsDeadOrGhost("player") and UnitMana("player") == UnitManaMax("player") end,
the problem is that those functions don't get unit as parameter.. so it's always nil before the first and.
CONFIRMED! Pull out the "unit and" from those two conditions and they work properly.
PProvost is offline Report comment to moderator  
Reply With Quote
Unread 02-26-09, 02:08 PM  
PProvost
A Deviate Faerie Dragon
AddOn Author - Click to view AddOns

Forum posts: 13
File comments: 126
Uploads: 24
PlayerCasting condition

Here's a little custom condition I made today. Feel free to include in your next drop if you want:

Code:
oUF.Fader:RegisterCondition("PlayerCasting", 
function(self, unit)
  return UnitCastingInfo("player") ~= nil
end, 
"UNIT_SPELLCAST_START:UNIT_SPELLCAST_FAILED:UNIT_SPELLCAST_STOP:UNIT_SPELLCAST_CHANNEL_START:UNIT_SPELLCAST_CHANNEL_UPDATE:UNIT_SPELLCAST_CHANNEL_STOP:UNIT_SPELLCAST_CHANNEL_STOP"
)
PProvost is offline Report comment to moderator  
Reply With Quote
Post A Reply



Category Jump: