-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
config.lua
155 lines (149 loc) · 4.41 KB
/
config.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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
---@class ns
local addon = select(2, ...)
-- BetterBags namespace
-----------------------------------------------------------
---@class BetterBags: AceAddon
local BetterBags = LibStub('AceAddon-3.0'):GetAddon("BetterBags")
---@class Categories: AceModule
---@field CreateCategory fun(self: Categories, ctx: Context, category: CustomCategoryFilter): nil
---@field DeleteCategory fun(self: Categories, ctx: Context, name: string): nil
---@field WipeCategory fun(self: Categories, ctx: Context, name: string): nil
---@field ReprocessAllItems fun(self: Categories, ctx: Context): nil
local Categories = BetterBags:GetModule('Categories')
---@class Localization: AceModule
local L = BetterBags:GetModule('Localization')
---@class Events: AceModule
---@field SendMessage fun(self: Events, message: string, ...: any): nil
local Events = BetterBags:GetModule('Events')
---@class Items: AceModule
local Items = BetterBags:GetModule('Items')
addon.options = {
boundOptions = {
type = "group",
name = L:G("BoE & BoA"),
order = 0,
inline = true,
args = {
enableBoe = {
type = "toggle",
order = 0,
name = L:G("Category: BoE"),
desc = L:G("If enabled, will categorize BoE items."),
get = function()
return addon.db.enableBoe
end,
set = function(_, value)
addon.db.enableBoe = value
if (addon.db.enableBoe) then
Categories:CreateCategory(addon.ctx:Copy(), {
name = L:G(addon.S_BOE),
itemList = {},
save = false,
})
Categories:ReprocessAllItems(addon.ctx:Copy())
else
Categories:DeleteCategory(addon.ctx:Copy(), L:G(addon.S_BOE))
end
end,
},
enableWue = {
type = "toggle",
order = 1,
name = L:G("Category: WuE"),
desc = L:G("If enabled, will categorize WuE items."),
get = function()
return addon.db.enableWue
end,
set = function(_, value)
addon.db.enableWue = value
if (addon.db.enableWue) then
Categories:CreateCategory(addon.ctx:Copy(), {
name = L:G(addon.S_WUE),
itemList = {},
save = false,
})
Categories:ReprocessAllItems(addon.ctx:Copy())
else
Categories:DeleteCategory(addon.ctx:Copy(), L:G(addon.S_WUE))
end
end,
},
enableBoa = {
type = "toggle",
order = 2,
name = L:G("Category: BoA"),
desc = L:G("If enabled, will categorize BoA items."),
get = function()
return addon.db.enableBoa
end,
set = function(_, value)
addon.db.enableBoa = value
if (addon.db.enableBoa) then
Categories:CreateCategory(addon.ctx:Copy(), {
name = L:G(addon.S_BOA),
itemList = {},
save = false,
})
Categories:ReprocessAllItems(addon.ctx:Copy())
else
Categories:DeleteCategory(addon.ctx:Copy(), L:G(addon.S_BOA))
end
end,
},
enableBop = {
type= "toggle",
order = 3,
name = L:G("Category: Soulbound"),
desc = L:G("If enabled, will categorize BoP items."),
get = function()
return addon.db.enableBop
end,
set = function(_, value)
addon.db.enableBop = value
if (addon.db.enableBop) then
Categories:CreateCategory(addon.ctx:Copy(), {
name = L:G(addon.S_BOP),
itemList = {},
save = true,
})
Categories:ReprocessAllItems(addon.ctx:Copy())
else
Categories:DeleteCategory(addon.ctx:Copy(), L:G(addon.S_BOP))
end
end,
},
onlyEquippable = {
type = "toggle",
width = "full",
order = 10,
name = L:G("Only Equippable"),
desc = L:G("Only categorize equippable items. This prevents a multitude of items from being lumped into \"Warbound\"."),
get = function()
return addon.db.onlyEquippable
end,
set = function(_, value)
addon.db.onlyEquippable = value
if (addon.db.onlyEquippable) then
Categories:WipeCategory(addon.ctx:Copy(), L:G(addon.S_BOA))
Categories:WipeCategory(addon.ctx:Copy(), L:G(addon.S_BOE))
Categories:WipeCategory(addon.ctx:Copy(), L:G(addon.S_WUE))
Categories:ReprocessAllItems(addon.ctx:Copy())
end
end,
},
wipeOnLoad = {
type = "toggle",
width = "full",
order = 20,
name = L:G("Wipe Categories"),
desc = L:G("Wipe categories on load. This prevent equipped items from being categorized as Bound still. Only affects the next reload/login."),
get = function()
return addon.db.wipeOnLoad
end,
set = function(_, value)
addon.db.wipeOnLoad = value
end,
},
}
}
}