-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtest.lua
70 lines (58 loc) · 2.54 KB
/
test.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
64
65
66
67
68
69
70
local LibFilters = LibStub("LibFilters-2.0")
LibFilters:InitializeLibFilters()
LibFilters.test = {}
SLASH_COMMANDS["/testfilters"] = function()
local filterTag = "TEST"
local filterTypes = {
LF_INVENTORY, LF_BANK_WITHDRAW, LF_BANK_DEPOSIT, LF_GUILDBANK_WITHDRAW,
LF_GUILDBANK_DEPOSIT, LF_VENDOR_BUY, LF_VENDOR_SELL, LF_VENDOR_BUYBACK,
LF_VENDOR_REPAIR, LF_GUILDSTORE_SELL, LF_MAIL_SEND, LF_TRADE,
LF_SMITHING_REFINE, LF_SMITHING_DECONSTRUCT, LF_SMITHING_IMPROVEMENT,
LF_SMITHING_RESEARCH, LF_ALCHEMY_CREATION, LF_ENCHANTING_CREATION,
LF_ENCHANTING_EXTRACTION, LF_FENCE_SELL, LF_FENCE_LAUNDER, LF_CRAFTBAG,
LF_QUICKSLOT, LF_RETRAIT,
}
for _, filterType in pairs(filterTypes) do
LibFilters.test[filterType] = {}
local function filterCallback(...)
table.insert(LibFilters.test[filterType], {...})
return false
end
if LibFilters:IsFilterRegistered(filterTag, filterType) then
d("Unregistering " .. filterType)
LibFilters:UnregisterFilter(filterTag, filterType)
LibFilters:RequestUpdate(filterType)
else
d("Registering " .. filterType)
LibFilters:RegisterFilter(filterTag, filterType, filterCallback)
LibFilters:RequestUpdate(filterType)
end
end
end
--depends on Item Saver by Randactyl
SLASH_COMMANDS["/testenchant"] = function()
local filterTag = "TestEnchant"
local isRegistered = LibFilters:IsFilterRegistered(filterTag, LF_ENCHANTING_CREATION)
local function filterCallback(slotOrBagId, slotIndex)
local bagId
if type(slotOrBagId) == "number" then
if not slotIndex then return false end
bagId = slotOrBagId
else
bagId, slotIndex = ItemSaver.util.GetInfoFromRowControl(slotOrBagId)
end
local isSaved, savedSet = ItemSaver_IsItemSaved(bagId, slotIndex)
return not isSaved
end
if not isRegistered then
LibFilters:RegisterFilter(filterTag, LF_ENCHANTING_CREATION, filterCallback)
LibFilters:RequestUpdate(LF_ENCHANTING_CREATION)
LibFilters:RegisterFilter(filterTag, LF_ENCHANTING_EXTRACTION, filterCallback)
LibFilters:RequestUpdate(LF_ENCHANTING_EXTRACTION)
else
LibFilters:UnregisterFilter(filterTag, LF_ENCHANTING_CREATION)
LibFilters:RequestUpdate(LF_ENCHANTING_CREATION)
LibFilters:UnregisterFilter(filterTag, LF_ENCHANTING_EXTRACTION)
LibFilters:RequestUpdate(LF_ENCHANTING_EXTRACTION)
end
end