-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathAutoBarSearchUtil.lua
More file actions
51 lines (31 loc) · 1.24 KB
/
AutoBarSearchUtil.lua
File metadata and controls
51 lines (31 loc) · 1.24 KB
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
local _ADDON_NAME, AB = ... -- Pulls back the Addon-Local Variables and store them locally.
--These 2 maps are a bi-directional map, so you can find the location of an item by it's ID
-- or an ID by it's location
-- It tracks items, spells, and macros (and soon toys)
AutoBarGlobalDataObject.LocationToIDMap = {}
AutoBarGlobalDataObject.IDToLocationMap = {}
--local aliases for shorter typing
local LocationToIDMap = AutoBarGlobalDataObject.LocationToIDMap
local IDToLocationMap = AutoBarGlobalDataObject.IDToLocationMap
local function initialize_maps()
LocationToIDMap.bags = {}
for bag = 0, 4, 1 do
LocationToIDMap.bags[bag] = {}
end
LocationToIDMap.inventory = {}
LocationToIDMap.spells = {}
LocationToIDMap.toys = {}
end
function AB.Search_AddSpell(p_spell_id, p_spell_name)
LocationToIDMap.spells[p_spell_name] = p_spell_id
--TODO: AutoBarSearch.found:Add(itemId, bag, slot, spell)
end
function AB.Search_AddInventoryItem(p_item_id, p_slot)
LocationToIDMap.inventory[p_slot] = p_item_id
--TODO: AutoBarSearch.found:Add(itemId, bag, slot, spell)
end
function AB.Search_AddBagItem(p_item_id, p_bag, p_slot)
local bag = LocationToIDMap.bags[p_bag]
bag[p_slot] = p_item_id
--TODO: AutoBarSearch.found:Add(itemId, bag, slot, spell)
end