LibRangeCheck-2.0

From WowAce Wiki
Jump to: navigation, search

:getRange(unit [, checkVisible])

Find the estimated range to unit.

Args

unit 
string - The unit to measure distance to, like "target" or "mouseover"
checkVisible
boolean - If set, a UnitIsVisible() check will also be done (so max range will be ~100 yd)

Returns

number, number - The range estimate as minRange, maxRange. minRange, nil if out of range, nil if invalid target.

Remarks

Melee range is returned as 0, 5.

Example

local rc = LibStub("LibRangeCheck-2.0")
local minRange, maxRange = rc:getRange("target")

:getRangeAsString(unit [, checkVisible, showOutOfRange])

Find the range estimate to unit, returned as a formatted string, like "20 - 28".

Args

unit 
string - The unit to measure distance to, like "target" or "mouseover".
checkVisible
boolean - If set, a UnitIsVisible() check will also be done (so max range will be ~100 yd)
showOutOfRange
boolean - If set, out of range will be returned as "minRange +", otherwise it'll be returned as nil

Returns

string - The range estimate as a string formatted like "minRange - maxRange". Nil if the unit is invalid (dead, nonexistent, etc).

Example

local rc = LibStub("LibRangeCheck-2.0")
local range = rc:getRangeAsString("target")

:init(forced)

Initialize the library, parse spell ranges, build checker tables.

Args

forced 
boolean - force an init even if the lib has been initialized before

Returns

none

Remarks

This method is called whenever necessary by the library, end users should not need to call it. It is called whenever talents are changed or new spells are learnt.

Example

local rc = LibStub("LibRangeCheck-2.0")
local rc:init(true) -- force a re-init