-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSFT_Utils.lua
More file actions
42 lines (34 loc) · 1.14 KB
/
SFT_Utils.lua
File metadata and controls
42 lines (34 loc) · 1.14 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
local SFT = SamisFishTrackerAddon
SFT.utils = {}
local inventoryItemLinkCache = {
[BAG_BACKPACK] = {
fish = {},
},
[BAG_SUBSCRIBER_BANK] = {
perfectRoe = {},
},
}
function SFT.utils.cacheItemLink(bagId, slotIndex, itemLink)
if bagId == BAG_BACKPACK then
local itemType = GetItemLinkItemType(itemLink)
if itemType == ITEMTYPE_FISH then
inventoryItemLinkCache[BAG_BACKPACK].fish[slotIndex] = itemLink
end
elseif bagId == BAG_SUBSCRIBER_BANK then
local itemId = GetItemLinkItemId(itemLink)
if itemId == SFT.constants.perfectRoeItemId then
inventoryItemLinkCache[BAG_SUBSCRIBER_BANK].perfectRoe[slotIndex] = itemLink
end
end
end
function SFT.utils.cacheFish(fish)
inventoryItemLinkCache[BAG_BACKPACK].fish = fish
end
-- Function to get fish item link from cache based on slotIndex
function SFT.utils.getCachedFishItemLink(slotIndex)
return inventoryItemLinkCache[BAG_BACKPACK].fish[slotIndex]
end
-- Function to get perfect roe item link from cache based on slotIndex
function SFT.utils.getCachedPerfectRoeItemLink(slotIndex)
return inventoryItemLinkCache[BAG_SUBSCRIBER_BANK].perfectRoe[slotIndex]
end