mirror of
https://github.com/brues-code/pfUI.git
synced 2026-10-22 04:00:49 +00:00
libunitscan: fix docs and prevent bad level data
This commit is contained in:
@@ -21,11 +21,11 @@ setfenv(1, pfUI:GetEnvironment())
|
|||||||
-- player[Boolean] - Returns true if unit is a player
|
-- player[Boolean] - Returns true if unit is a player
|
||||||
--
|
--
|
||||||
-- Internal functions:
|
-- Internal functions:
|
||||||
-- libcast:AddData(db, name, class, level, elite)
|
-- libunitscan:AddData(db, name, class, level, elite)
|
||||||
-- Adds unit data to a given db. Where db should be either "players" or "mobs"
|
-- Adds unit data to a given db. Where db should be either "players" or "mobs"
|
||||||
--
|
--
|
||||||
|
|
||||||
-- return instantly when another librange is already active
|
-- return instantly when another libunitscan is already active
|
||||||
if pfUI.api.libunitscan then return end
|
if pfUI.api.libunitscan then return end
|
||||||
|
|
||||||
local units = { players = {}, mobs = {} }
|
local units = { players = {}, mobs = {} }
|
||||||
@@ -80,6 +80,8 @@ libunitscan:SetScript("OnEvent", function()
|
|||||||
for i = 1, GetNumFriends() do
|
for i = 1, GetNumFriends() do
|
||||||
name, level, class = GetFriendInfo(i)
|
name, level, class = GetFriendInfo(i)
|
||||||
class = L["class"][class] or nil
|
class = L["class"][class] or nil
|
||||||
|
-- friendlist updates due to friend going off-line return level 0, let's not overwrite good older values
|
||||||
|
level = level > 0 and level or nil
|
||||||
AddData("players", name, class, level)
|
AddData("players", name, class, level)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user