forked from astralguild/AstralKeys
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUnit Information.lua
63 lines (50 loc) · 1.27 KB
/
Unit Information.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
local e, L = unpack(select(2, ...))
local UNIT_LIST = {}
-- Sets a number to a unit for quicker access to table
-- @param unit Unit name and server
-- @param unitID integer value
function e.SetUnitID(unit, unitID)
UNIT_LIST[unit] = unitID
end
-- Retrieves ID number for associated unit
-- @param unit Unit name and server
function e.UnitID(unit)
return UNIT_LIST[unit] or nil
end
function e.UnitName(id)
return AstralKeys[id].unit:sub(1, AstralKeys[id].unit:find('-') - 1)
end
function e.Unit(id)
return AstralKeys[id].unit
end
function e.UnitBTag(id)
return AstralKeys[id].btag
end
function e.UnitGUID(unit)
return e.GuildMemberGuid(unit) or e.FriendGUID(unit)
end
function e.IsUnitOnline(unit)
return e.GuildMemberOnline(unit) or e.IsFriendOnline(unit)
end
-- Clears unit list
function e.WipeUnitList()
wipe(UNIT_LIST)
end
--Gets unit class from saved variables
-- @param id int ID number for the unit
function e.UnitClass(id)
if not id then return nil end
return AstralKeys[id].class
end
function e.UnitKeyLevel(id)
if not id then return nil end
return AstralKeys[id].key_level
end
function e.UnitMapID(id)
if not id then return nil end
return AstralKeys[id].dungeon_id
end
function e.UnitWeeklyBest(id)
if not id then return nil end
return AstralKeys[id].weekly_best
end