mirror of
https://github.com/brues-code/pfUI.git
synced 2026-09-22 07:36:56 +00:00
Range Check: UnitXP mode
Added Range Check Mode dropdown (Vanilla / UnitXP) and UnitXP Range Threshold input field under the 40y-Range Check settings in the GUI
In UnitXP mode, UnitInRange bypasses librange entirely and queries UnitXP("distanceBetween") directly with the configured yard threshold
librange scan loop is disabled when UnitXP mode is active — no TargetUnit cycling, no spellbook scanning, no combat interruption
Fixed UnitInRange referencing librange as an undefined local instead of pfUI.api.librange, which caused silent nil returns
This commit is contained in:
+15
-2
@@ -141,9 +141,22 @@ function pfUI.api.UnitInRange(unit)
|
||||
return nil
|
||||
elseif CheckInteractDistance(unit, 4) then
|
||||
return 1
|
||||
else
|
||||
return librange:UnitInSpellRange(unit)
|
||||
end
|
||||
|
||||
-- UnitXP precise mode: skip librange entirely, use direct distance check
|
||||
if C.unitframes.rangecheck_mode == "unitxp" and _G.UnitXP then
|
||||
local threshold = tonumber(C.unitframes.rangecheck_distance) or 40
|
||||
local success, distance = pcall(_G.UnitXP, "distanceBetween", "player", unit)
|
||||
if success and distance then
|
||||
return distance <= threshold and 1 or nil
|
||||
end
|
||||
-- fallthrough to librange if UnitXP fails
|
||||
end
|
||||
|
||||
if pfUI.api.librange then
|
||||
return pfUI.api.librange:UnitInSpellRange(unit)
|
||||
end
|
||||
return nil
|
||||
end
|
||||
|
||||
-- [ RunOOC ]
|
||||
|
||||
Reference in New Issue
Block a user