Download
(3 Kb)
Download
Updated: 09-10-12 11:41 PM
Pictures
File Info
Compatibility:
Mists of Pandaria (5.0.4)
Updated:09-10-12 11:41 PM
Created:03-20-09 11:37 PM
Downloads:25,084
Favorites:119
MD5:
oUF SpellRange  Popular! (More than 5000 hits)
Version: 5.0.0.2
by: Saiket [More]
oUF SpellRange is an element plug-in for Haste's oUF unit frame framework that fades unit frames when out of casting range. Unlike the default oUF range fading, SpellRange works for any hostile or friendly targets, rather than group members only. You must have oUF and a compatible layout for oUF SpellRange to do anything.

Usage

The settings for implementing SpellRange are intentionally the same as the default Range element, because the two elements cannot work together. SpellRange will disable the Range element for frames where both are enabled.

To enable the SpellRange element:
Code:
self.SpellRange = {
	 -- At least one set of required properties, listed below
};
Either of the following sets of properties is required:
  • Code:
    --- Takes priority over .insideRange/.outsideRange, and fires when changing between them.
    function self.SpellRange.Update( self, InRange )
    	
    end
    OR
  • Code:
    self.SpellRange.insideAlpha = 1.0; -- Frame alpha when in range
    self.SpellRange.outsideAlpha = 0.4; -- Frame alpha when out of range
Don't forget to add oUF_SpellRange as an optional dependency of your layout.


Note: SpellRange is necessarily slower than the default Range element, so use it with caution for large groups like raids or parties. The default Range element will always work for "player", "pet", and any unit that passes UnitPlayerOrPetInParty/UnitPlayerOrPetInRaid, however it is limited to 38 yard range.
  • 5.0.0.2: Classes without helpful spells now display range to themselves and their pets properly while not in a raid.
  • 5.0.0.1: Bumped TOC for Mists of Pandaria.
  • 4.3.0.1: Bumped TOC for 4.3.
  • 4.2.0.1: Bumped TOC for 4.2.
  • 4.1.0.1: Bumped TOC for 4.1.
  • 4.0.0.1:
    • Now adds a :ForceUpdate method and .__owner property to .SpellRange elements to conform with the oUF 5 API. If you intend to use these, you can no longer recycle a generic .SpellRange element table.
    • Spells updated for Cataclysm pre-release patch 4.0.1.
  • 3.3.5.1:
    • Now checks for a .SpellRange table containing properties similar to oUF 1.4's updated Range element. Not backwards compatible!
    • Added support for multiple spells per class, choosing the first known spell from a list.
  • 3.3.0.2: Added support for embedded installs.
  • 3.3.0.1: Bumped TOC for 3.3.
  • 3.2.0.2: Removed "Raise Ally" as a range check spell for allies, since it only works for raid/party members.
  • 3.2.0.1: Uses the new IsSpellKnown API instead of constantly querying GetSpellInfo, as it is dramatically faster.
  • 3.0.9.6: Fixed error for classes that had no help or harm spell.
  • 3.0.9.5: Low level players that haven't trained their spells yet will now properly see 28 yard ranges.
  • 3.0.9.4:
    • No longer enables itself for frames that don't request SpellRange.
    • Now supports a :SpellRangeOverride( InRange ) method in place of the in and outside alpha properties.
  • 3.0.9.3: Correctly sorted priest spells into the HelpID and HarmID tables.
  • 3.0.9.2: Shows proper range of player and group members while on a flightpath for players with no ranged buff spells.
Archived Files (16)
File Name
Version
Size
Author
Date
5.0.0.1
3kB
Saiket
08-28-12 09:41 AM
4.3.0.1
3kB
Saiket
11-29-11 05:10 PM
4.2.0.1
3kB
Saiket
06-28-11 02:01 PM
4.1.0.1
3kB
Saiket
04-26-11 11:01 AM
4.0.0.1
3kB
Saiket
10-12-10 03:59 PM
3.3.5.1
3kB
Saiket
07-10-10 11:32 PM
3.3.0.2
3kB
Saiket
01-16-10 04:54 PM
3.3.0.1
3kB
Saiket
12-08-09 01:48 PM
3.2.0.2
3kB
Saiket
08-08-09 03:57 PM
3.2.0.1
3kB
Saiket
08-04-09 04:37 PM
3.0.9.6
3kB
Saiket
04-05-09 02:08 AM
3.0.9.5
3kB
Saiket
04-04-09 01:49 PM
3.0.9.4
2kB
Saiket
03-22-09 04:54 AM
3.0.9.3
2kB
Saiket
03-22-09 02:14 AM
3.0.9.2
2kB
Saiket
03-21-09 03:04 AM
3.0.9.1
2kB
Saiket
03-20-09 11:37 PM


Post A Reply Comment Options
Old 10-20-11, 03:01 PM  
Saiket
A Chromatic Dragonspawn
 
Saiket's Avatar
AddOn Author - Click to view AddOns

Forum posts: 152
File comments: 329
Uploads: 21
Originally posted by lastgamer
Hi,How make the castbar like 'quartz' ,that: if IsSpellInRange,castbar is the normal color, then target won't be outside,the castbar will be another color.
It make me know the spelling can't be successful.
thanks.
You can use the Update callback to change your castbar's color instead of fading the unitframe out, like this:
Code:
self.SpellRange = {};
function self.SpellRange:Update( InRange )
	if ( InRange ) then
		self.Castbar:SetStatusBarColor( 0, 1, 0 ); -- Green
	else
		self.Castbar:SetStatusBarColor( 1, 0, 0 ); -- Red
	end
end
Saiket is offline Report comment to moderator  
Reply With Quote
Old 10-20-11, 09:32 AM  
lastgamer
A Deviate Faerie Dragon

Forum posts: 11
File comments: 23
Uploads: 0
Hi,How make the castbar like 'quartz' ,that: if IsSpellInRange,castbar is the normal color, then target won't be outside,the castbar will be another color.
It make me know the spelling can't be successful.
thanks.
lastgamer is offline Report comment to moderator  
Reply With Quote
Old 05-28-11, 08:20 AM  
Forage
A Murloc Raider

Forum posts: 6
File comments: 28
Uploads: 0
Originally posted by Saiket
Did you add Rebuke and Pummel to both HelpIDs and HarmIDs at the bottom of oUF_SpellRange.lua? Make sure you only add those interrupts to the HarmIDs list, since WoW always considers attacks on a friendly to be "out of range". The HelpIDs list is only for spells you can cast on allies, but if the class doesn't have any (like warriors), the mod defaults to a standard 28 yard check.
I was using Intervene for help and pummel for hard and then salv for help and rebuke for harm so I thought I got those right but apparently something else is going on somewhere.

I'll double check the code in the harm/help and make sure I didn't create the issue.
Forage is offline Report comment to moderator  
Reply With Quote
Old 05-27-11, 08:34 PM  
Saiket
A Chromatic Dragonspawn
 
Saiket's Avatar
AddOn Author - Click to view AddOns

Forum posts: 152
File comments: 329
Uploads: 21
Originally posted by Forage
I've added spell range to my unit frames and it's perfect for making sure I'm in range to focus pummel/rebuke which was quite important but now I've noticed another issue and I'm not sure what it is.



Picture of me next to player



Picture of me next to target dummy in range



Picture of me next to target dummy out of range


So The target dummy in and out of range works exactly like I intended but the player frame it just shows out of range no matter how close I am. Is this likely to be a code issue of something I have done or is there a way to resolve this?
Did you add Rebuke and Pummel to both HelpIDs and HarmIDs at the bottom of oUF_SpellRange.lua? Make sure you only add those interrupts to the HarmIDs list, since WoW always considers attacks on a friendly to be "out of range". The HelpIDs list is only for spells you can cast on allies, but if the class doesn't have any (like warriors), the mod defaults to a standard 28 yard check.
Saiket is offline Report comment to moderator  
Reply With Quote
Old 05-27-11, 07:31 PM  
Forage
A Murloc Raider

Forum posts: 6
File comments: 28
Uploads: 0
I've added spell range to my unit frames and it's perfect for making sure I'm in range to focus pummel/rebuke which was quite important but now I've noticed another issue and I'm not sure what it is.



Picture of me next to player



Picture of me next to target dummy in range



Picture of me next to target dummy out of range


So The target dummy in and out of range works exactly like I intended but the player frame it just shows out of range no matter how close I am. Is this likely to be a code issue of something I have done or is there a way to resolve this?
Forage is offline Report comment to moderator  
Reply With Quote
Old 07-10-10, 11:37 PM  
Saiket
A Chromatic Dragonspawn
 
Saiket's Avatar
AddOn Author - Click to view AddOns

Forum posts: 152
File comments: 329
Uploads: 21
3.3.5.1 Change

Just a note for users, the following error from version 3.3.5.1+ must be handled by the author of your oUF layout:
Code:
oUF layout addon using invalid SpellRange element.
Please point them to this download page, which has instructions on how they can update their layout.
Saiket is offline Report comment to moderator  
Reply With Quote
Old 06-17-10, 12:20 PM  
neverg
A Cobalt Mageweaver
 
neverg's Avatar
AddOn Author - Click to view AddOns

Forum posts: 241
File comments: 334
Uploads: 8
Originally posted by Saiket
I just downloaded version 0.3 from your WowInterface page and it looks like that block of code is in an if unit == "player" then block. What you have there should work once it's taken out of that test.
Ah damn, might be it! Forgot to check that! ;P

Will report if it works! ^^

Thanks for the quick response mate.

EDIT - Ye, it was it. What a nub error... :S
Last edited by neverg : 06-17-10 at 12:50 PM.
neverg is offline Report comment to moderator  
Reply With Quote
Old 06-17-10, 12:18 PM  
Saiket
A Chromatic Dragonspawn
 
Saiket's Avatar
AddOn Author - Click to view AddOns

Forum posts: 152
File comments: 329
Uploads: 21
Originally posted by neverg
I'm trying to add support of SpellRange to my UnitFrames (oUF_Lumen) and somehow I'm not getting it. It should work fairly simple but it just doesn't.

I've added this:

Code:
	-- oUF_SpellRange
	if IsAddOnLoaded("oUF_SpellRange") then	
		if(unit) then 
		self.SpellRange = true
		self.inRangeAlpha = 1
		self.outsideRangeAlpha = 0.3
		end	
	end
The result is, nothing happens. If I change the inRangeAlpha to less than 1 I will see my frame (player) change because I'm in range (duoh), but the target never changes. Any clues to the why of this behavior?
I just downloaded version 0.3 from your WowInterface page and it looks like that block of code is in an if unit == "player" then block. What you have there should work once it's taken out of that test.
Saiket is offline Report comment to moderator  
Reply With Quote
Old 06-17-10, 10:37 AM  
neverg
A Cobalt Mageweaver
 
neverg's Avatar
AddOn Author - Click to view AddOns

Forum posts: 241
File comments: 334
Uploads: 8
I'm trying to add support of SpellRange to my UnitFrames (oUF_Lumen) and somehow I'm not getting it. It should work fairly simple but it just doesn't.

I've added this:

Code:
	-- oUF_SpellRange
	if IsAddOnLoaded("oUF_SpellRange") then	
		if(unit) then 
		self.SpellRange = true
		self.inRangeAlpha = 1
		self.outsideRangeAlpha = 0.3
		end	
	end
The result is, nothing happens. If I change the inRangeAlpha to less than 1 I will see my frame (player) change because I'm in range (duoh), but the target never changes. Any clues to the why of this behavior?
neverg is offline Report comment to moderator  
Reply With Quote
Old 03-19-10, 01:54 PM  
Noggog
A Kobold Labourer

Forum posts: 0
File comments: 4
Uploads: 0
MMMMMMWAH! 8*

I love you
__________________


www.PeachyKeenGuild.com
Noggog is offline Report comment to moderator  
Reply With Quote
Old 01-17-10, 10:46 AM  
Saiket
A Chromatic Dragonspawn
 
Saiket's Avatar
AddOn Author - Click to view AddOns

Forum posts: 152
File comments: 329
Uploads: 21
Originally posted by recluse
Using oUF/oUF_Caellian - After today's upgrade, I get the following error. Would this be an issue with SpellRange, or the layout? The layout is not being reported in any way, though "parent addon" makes it sound like it might be the layout?

Code:
Message: ..\AddOns\oUF_SpellRange\oUF_SpellRange.lua line 16:
   X-oUF metadata missing in parent addon.
Debug:
   (tail call): ?
   [C]: ?
   [C]: assert()
   oUF_SpellRange\oUF_SpellRange.lua:16: in main chunk
Make sure to restart the game after the update. "Parent addon" means oUF_SpellRange; It should work fine with oUF_Caellian once the game re-reads SpellRange's TOC file.
Saiket is offline Report comment to moderator  
Reply With Quote
Old 01-17-10, 12:25 AM  
Recluse
A Cliff Giant
 
Recluse's Avatar
AddOn Author - Click to view AddOns

Forum posts: 70
File comments: 112
Uploads: 14
Using oUF/oUF_Caellian - After today's upgrade, I get the following error. Would this be an issue with SpellRange, or the layout? The layout is not being reported in any way, though "parent addon" makes it sound like it might be the layout?

Code:
Message: ..\AddOns\oUF_SpellRange\oUF_SpellRange.lua line 16:
   X-oUF metadata missing in parent addon.
Debug:
   (tail call): ?
   [C]: ?
   [C]: assert()
   oUF_SpellRange\oUF_SpellRange.lua:16: in main chunk
__________________
We'd be together, but only diamonds last forever...
Recluse is offline Report comment to moderator  
Reply With Quote
Old 08-26-09, 11:35 AM  
Saiket
A Chromatic Dragonspawn
 
Saiket's Avatar
AddOn Author - Click to view AddOns

Forum posts: 152
File comments: 329
Uploads: 21
Originally posted by nailertn
The oUF Range element does not have a Disable function implemented, it just works on the oUF.objects table. So DisableElement( "Range" ) in your code just fails silently. What prevents the default function from executing is you nilling object.Range. Frankly it should work like all the other elements, will possibly post a feature request for Haste soon.
Yeah, I just added that call in case Haste ever actually implements that.
Saiket is offline Report comment to moderator  
Reply With Quote
Old 08-26-09, 09:25 AM  
nailertn
An Aku'mai Servant

Forum posts: 33
File comments: 15
Uploads: 0
The oUF Range element does not have a Disable function implemented, it just works on the oUF.objects table. So DisableElement( "Range" ) in your code just fails silently. What prevents the default function from executing is you nilling object.Range. Frankly it should work like all the other elements, will possibly post a feature request for Haste soon.
Last edited by nailertn : 08-26-09 at 09:25 AM.
nailertn is offline Report comment to moderator  
Reply With Quote
Old 08-09-09, 09:00 AM  
Caeth88
A Kobold Labourer

Forum posts: 0
File comments: 18
Uploads: 0
Edit: The new version 3.2.0.2 should fix this. [/b]
It did, Thanks.
Caeth88 is offline Report comment to moderator  
Reply With Quote
Post A Reply



Category Jump:

Support AddOn Development!

You have just downloaded by the author . If you like this AddOn why not consider supporting the author? This author has set up a donation account. Donations ensure that authors can continue to develop useful tools for everyone.