LibRangeCheck-2.0
This library is deprecated. Development moved to the LibRangeCheck-3.0 fork.
A library to determine estimated range.
This library is deprecated. Development moved to the LibRangeCheck-3.0 fork.
A library to determine estimated range.
This library is no longer actively developed. It was forked and continued as LibRangeCheck-3.0.
So long, and thanks for all the fish!
Hi! why does this code not work correctly in combat?
function test()
local rc = LibStub("LibRangeCheck-2.0")
local minRange, maxRange = rc:GetRange('target')
if not minRange then
print("cannot get range estimate for target")
elseif not maxRange then
print("target is over " .. minRange .. " yards")
else
print("target is between " .. minRange .. " and " .. maxRange .. " yards")
end
if maxRange
and maxRange < 15
then
return true
end
end
I found an interesting issue, when trying to use the range checker on a nameplate target dummy I get maxRange = nil when in combat but on a regular mob it works. However if I use `target` as the unit it works both out of combat and in combat.
`target` works on a target dummy
`nameplate1` does not work on a target dummy
`target` works on a regular mob
`nameplate1` works on a regular mob
iam using this code on my nameplates:
code = "[Outline][if MaxRange >= 10 then MaxRange] [[HP]:VeryShort]"
but if iam infight, it produces lua errors:
1407x LibDogTag-3.0-20231107223907.20231107: Error with code "[Outline][if MaxRange >= 10 then MaxRange] [[HP]:VeryShort]" (Base;Unit). ...Display/libs/LibRangeCheck-2.0-10000000000002/LibRangeCheck-2.0.lua:441: IsSpellInRange(): Invalid spell slot
[string "@LibDogTag-3.0-20231107223907/LibDogTag-3.0.lua"]:304: in function <LibDogTag-3.0/LibDogTag-3.0.lua:290>
[string "@LibDogTag-3.0-20231107223907/Events.lua"]:688: in function <LibDogTag-3.0/Events.lua:555>
Locals:
fs = FontString {
0 = <userdata>
}
code = "[Outline][if MaxRange >= 10 then MaxRange] [[HP]:VeryShort]"
nsList = "Base;Unit"
kwargs = <table> {
unit = "nameplate5"
}
kwargTypes = <table> {
unit = "string"
}
func = <function> defined local _G = _G;
local DogTag = _G.LibStub("LibDogTag-3.0");
local colors = DogTag.__colors;
local NIL = DogTag.__NIL;
local mytonumber = DogTag.__mytonumber;
local tag_Outline = DogTag.Tags.Base["Outline"].code;
local tag_VeryShort = DogTag.Tags.Base["VeryShort"].code;
local tag_MaxRange_1 = DogTag.__functions.MaxRange_1;
local tag_HP = DogTag.Tags.Unit["HP"].code;
local tag_less = DogTag.Tags.Base["<"].code;
return function(kwargs)
local result;
local cache_MaxRange = NIL;
local arg1, arg2, arg3, arg4, arg5;
local kwargs_unit = kwargs["unit"];
if not DogTag.IsLegitimateUnit[kwargs_unit] then
return ("Bad unit: %q"):format(kwargs_unit or tostring(kwargs_unit)), nil;
end;
if kwargs_unit ~= "player" and not UnitExists(kwargs_unit) then
return nil, nil;
end;
do
do
arg1 = tag_Outline();
end;
end;
do
do
do
do
arg3 = tag_MaxRange_1(kwargs_unit);
cache_MaxRange = arg3;
end;
if arg3 then
arg2 = tag_less(arg3, (10));
end;
end;
if arg2 then
arg2 = nil;
else
arg2 = arg3;
end;
end;
if arg2 then
success = false
text = "...Display/libs/LibRangeCheck-2.0/LibRangeCheck-2.0.lua:441: IsSpellInRange(): Invalid spell slot"
opacity = nil
outline = nil
fsNeedUpdate = <table> {
}
fsNeedQuickUpdate = <table> {
= true
= true
= true
= true
= true
= true
}
fsToCode = <table> {
= "[Outline][if MaxRange >= 10 then MaxRange] [[HP]:VeryShort]"
= "[Outline][if MaxRange >= 10 then MaxRange] [[HP]:VeryShort]"
= "[Outline][if MaxRange >= 10 then MaxRange] [[HP]:VeryShort]"
= "[Outline][if MaxRange >= 10 then MaxRange] [[HP]:VeryShort]"
= "[Outline][if MaxRange >= 10 then MaxRange] [[HP]:VeryShort]"
= "[Outline][if MaxRange >= 10 then MaxRange] [[HP]:VeryShort]"
= "[Outline][if MaxRange >= 10 then MaxRange] [[HP]:VeryShort]"
= "[Outline][if PercentHP < 100 then [[PercentHP:Round:Percent]:HPColor]]"
= "[Outline][if MaxRange >= 10 then MaxRange] [[HP]:VeryShort]"
= "[Outline][if PercentHP < 100 then [[PercentHP:Round:Percent]:HPColor]]"
= "[Outline][if PercentHP < 100 then [[PercentHP:Round:Percent]:HPColor]]"
= "[Outline][if MaxRange >= 10 then MaxRange] [[HP]:VeryShort]"
}
fsToNSList = <table> {
= "Base;Unit"
= "Base;Unit"
= "Base;Unit"
= "Base;Unit"
= "Base;Unit"
= "Base;Unit"
= "Base;Unit"
= "Base;Unit"
= "Base;Unit"
= "Base;Unit"
= "Base;Unit"
= "Base;Unit"
}
fsToKwargs = <table> {
= <table> {
}
= <table> {
}
= <table> {
}
= <table> {
}
= <table> {
}
= <table> {
}
= <table> {
}
= <table> {
}
= <table> {
}
= <table> {
}
= <table> {
}
= <table> {
}
}
kwargsToKwargTypesWithTableCache = <table> {
= <table> {
}
= <table> {
}
= <table> {
}
= <table> {
}
= <table> {
}
= <table> {
}
= <table> {
}
= <table> {
}
= <table> {
}
= <table> {
}
= <table> {
}
}
codeToFunction = <table> {
Base;Unit = <table> {
}
}
DogTag = <table> {
unparse = <function> defined @LibDogTag-3.0/Parser.lua:1233
select2 = <function> defined @LibDogTag-3.0/Helpers.lua:155
callbackToFunction = <table> {
}
hasEvent = <function> defined @LibDogTag-3.0/Events.lua:185
callbackToExtraArg = <table> {
}
outline = "OUTLINE"
__colors = <table> {
}
Tags = <table> {
}
CleanCode = <function> defined @LibDogTag-3.0/Parser.lua:1595
codeToFunction = <table> {
}
newDict = <function> defined @LibDogTag-3.0/Helpers.lua:35
clearCodes = <function> defined @LibDogTag-3.0/Helpers.lua:516
TimerHandlers = <table> {
}
UnregisterCustomClassColors = <function> defined @LibDogTag-3.0/LibDogTag-3.0.lua:617
ADDON_LOADED = <function> defined @LibDogTag-3.0/LibDogTag-3.0.lua:519
PLAYER_LOGIN = <function> defined @LibDogTag-3.0/LibDogTag-3.0.lua:609
AddCallbac
1395x ...Display/libs/LibRangeCheck-2.0-10000000000002/LibRangeCheck-2.0.lua:441: IsSpellInRange(): Invalid spell slot
[string "=[C]"]: ?
[string "@RangeDisplay/libs/LibRangeCheck-2.0-10000000000002/LibRangeCheck-2.0.lua"]:441: in function <...Display/libs/LibRangeCheck-2.0/LibRangeCheck-2.0.lua:440>
[string "@RangeDisplay/libs/LibRangeCheck-2.0-10000000000002/LibRangeCheck-2.0.lua"]:558: in function `checker'
[string "@RangeDisplay/libs/LibRangeCheck-2.0-10000000000002/LibRangeCheck-2.0.lua"]:623: in function <...Display/libs/LibRangeCheck-2.0/LibRangeCheck-2.0.lua:615>
[string "=(tail call)"]: ?
[string "@RangeDisplay/RangeDisplay.lua"]:415: in function `update'
[string "@RangeDisplay/RangeDisplay.lua"]:477: in function <RangeDisplay/RangeDisplay.lua:472>
Locals:
(*temporary) = <function> defined @RangeDisplay/libs/LibRangeCheck-2.0/LibRangeCheck-2.0.lua:500
(*temporary) = "spell"
(*temporary) = nil
Any Idea how to fix this? it was working a few days ago
In reply to NavexEU:
Hello. A recent patch broke IsItemInRange in combat, which broke LibRangeCheck. It is mostly fixed now, but I'm not entirely sure it's fixed for the "special" checkers yet that DogTag may be using. I'll try looking into it a bit later
In reply to mitchnull:
I manage to fix this particular error, it's because of a missed argument on line 545.
`findMinRangeChecker` should read: (note `name` argument)
In reply to logicalhs:
thanks, fixed it in v5.1.1
Hi Mitchnull, LibRangeCheck-2.0 is raising an error on TBC beta, you can check if it's running TBC with
4x ...akAuras\Libs\LibRangeCheck-2.0\LibRangeCheck-2.0-100204.lua:1076: Attempt to register unknown event "PLAYER_TALENT_UPDATE"
[string "=[C]"]: in function `RegisterEvent'
[string "@WeakAuras\Libs\LibRangeCheck-2.0\LibRangeCheck-2.0-100204.lua"]:1076: in function `activate'
[string "@WeakAuras\Libs\LibRangeCheck-2.0\LibRangeCheck-2.0-100204.lua"]:1121: in main chunk
Locals:
(*temporary) = <unnamed> {
0 = <userdata>
}
(*temporary) = "PLAYER_TALENT_UPDATE"
In reply to MrBudsz:
yeah. i just updated:
local IsClassic = (WOW_PROJECT_ID == WOW_PROJECT_CLASSIC)
to
local IsClassic = (WOW_PROJECT_ID == WOW_PROJECT_CLASSIC) or (WOW_PROJECT_ID == WOW_PROJECT_BURNING_CRUSADE_CLASSIC)
and now everything is happy
Hello friend, I'd love to see item 9621, Mountain Giant Muisek Vessel, added to classic to allow for the checking of hostile units within a 10y range. Seems like it's missing, and I just came across it.
how to check range between targets ? i want to know the range between target and focus?
In reply to Forge_User_06710784:
Hello,
Unfortunately this is not possible with this addon, we only get the range to the target / focus, and not the direction or position.
I posted a patch (as an issue) to add some capabilities to this, and allow concurrent item checks (still using your throttling). The latter mainly because otherwise it takes too long for the complete list of ranges to be created (I have tested this, no problems in classic).
Classic has issue with non stop fire event "GET_ITEM_INFO_RECEIVED", mostly seen on TellMeWhen. I contacted Cybeloras#8758 and he said that any calls to GetItemInfo against itemIds that don't exist in classic must be removed when running on the classic client and he can't do anything on own side with it anymore.
In reply to tigjames:
Hello,
I've added handling of GET_ITEM_INFO_RECEIVED events to throttle the item queries. Give the latest release a try... (v4.3.2)​_
In reply to mitchnull:
Thanks, that fixed it :) Upd: ah it was false alarm, it's still here after some time of playing
In reply to tigjames:
Are you sure it is caused by LibRangeCheck? It does about 10-20 item queries at most, and only during startup. It shouldn't cause event storm, and especially not "after some time of playing"...
In reply to mitchnull:
I entered in-game with default TMW wihout configuration, fully default all settings. I checked events and went to afk for 20-30, after that I started trace events and found what GET_ITEM_INFO_RECEIVED started loop again.
For some reasons issue is not repeat able and happened with me only once after update to 4.3.2
The library worked on the classic stress test on 8th August. I had to delete (comment) the following lines:
948 -- function lib:PLAYER_TALENT_UPDATE()
949 -- self:scheduleInit()
950 -- end
1047 --frame:RegisterEvent("PLAYER_TALENT_UPDATE")
Exaplanation:
PLAYER_TALENT_UPDATE does not exist in classic (because it's mainly useful for dual spec). CHARACTER_POINTS_CHANGED handles the event of talent point allocation (which the library is subscribed to already).
Hello, WeakAuras use your lib for it's "Range Check" trigger, but LibRangeCheck-2.0 have issues on classic
On load it error while trying to register unknown event "PLAYER_TALENT_UPDATE"
Most items/spells used for range test didn't exists back then so results are not very accurate.
We have to disable integration of the lib in classic version of WeakAuras for now.
Please keep us updated if you plan to make it compatible.
Cheers.