-
Notifications
You must be signed in to change notification settings - Fork 0
/
Init.lua
281 lines (255 loc) · 8.95 KB
/
Init.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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
-- Initialization file
_G.PileSeller = { __addonversion = "2.2.0" }
local PileSeller = _G.PileSeller
PileSeller.color = "6cafcc"
PileSeller.wishToTrack = "Do you wish to track the items in this run?"
-- Debug tools
function PileSeller:tablelength(T)
local count = 0
for _ in pairs(T) do count = count + 1 end
return count
end
GetItemInfo(19019)
function PileSeller:PrintTable(t, indent, done)
--print ( string.format ('PrintTable type %s', type(keys)) )
if type(t) ~= "table" then return end
done = done or {}
done[t] = true
indent = indent or 0
local l = {}
for k, v in pairs(t) do
table.insert(l, k)
end
--table.sort(l)
for k, v in ipairs(l) do
-- Ignore FDesc
if v ~= 'FDesc' then
local value = t[v]
if type(value) == "table" and not done[value] then
done [value] = true
print(string.rep (" ", indent)..tostring(v)..":")
PileSeller:PrintTable (value, indent + 2, done)
elseif type(value) == "userdata" and not done[value] then
done [value] = true
print(string.rep (" ", indent)..tostring(v)..": "..tostring(value))
PileSeller:PrintTable ((getmetatable(value) and getmetatable(value).__index) or getmetatable(value), indent + 2, done)
else
if t.FDesc and t.FDesc[v] then
print(string.rep (" ", indent)..tostring(t.FDesc[v]))
else
print(string.rep (" ", indent)..tostring(v)..": "..tostring(value))
end
end
end
end
end
--------------
-- This will be used both into the creation of the checkboxes and on the init of the settings
PileSeller.settings = {
[1] = {
name = "autoActivate",
default = false,
text = "Auto activate tracking by entering a raid or instance alone.",
sub = false,
},
[2] = {
name = "autoDeactivate",
default = false,
text = "Auto deactivate tracking when exiting a raid or an instance.",
},
[3] = {
name = "autoCloseSellingBox",
default = false,
text = "Auto close the item sold dialog when closing the vendor.",
sub = false
},
[4] = {
name = "confSetting",
default = true,
text = "Show confirmation before selling the loot.",
sub = false
},
[5] = {
name = "hideJunkSetting",
default = true,
text = "Don't show gray items in the selling list.",
sub = false
},
[6] = {
name = "sellJunkSetting",
default = true,
text = "Auto sell junk.",
sub = false
},
[7] = {
name = "repairSetting",
default = false,
text = "Auto repair gear.",
sub = false,
masterOf = "repairGuildSetting"
},
[8] = {
name = "repairGuildSetting",
default = false,
text = "Use guild funds.",
sub = true,
slaveOf = "repairSetting"
},
[9] = {
name = "showAlertSetting",
default = true,
text = "Always message me if tracking is on (|cFF00FF00Recommended|r).",
sub = false,
},
[10] = {
name = "disableInGarrison",
default = true,
text = "Always disable tracking when entering in garrison.",
sub = false,
},
[11] = {
name = "hideMinimapButton",
default = false,
text = "Hide minimap button. (You can type /pileseller or /ps to access the addon)",
sub = false,
f = function(self)
psSettings["hideMinimapButton"] = self:GetChecked()
PileSeller:HideMinimapButton(self:GetChecked())
end
},
[12] = {
name = "speedTweaker",
default = false,
text = "Tweak the speed while selling the items.",
sub = false,
f = function(self)
psSettings["speedTweaker"] = self:GetChecked()
self:GetParent().speedTweakerSlider:SetEnabled(self:GetChecked())
if self:GetChecked() then
self:GetParent().speedTweakerSlider.value:SetTextColor(253/255, 209/255, 22/255,1)
else
self:GetParent().speedTweakerSlider.value:SetTextColor(153/255, 153/255, 153/255, 1)
end
end
}
}
PileSeller.itemsToKeep = {
[1] = {
name = "keepTier",
default = false,
title = "Keep tiers",
tooltip = "Keep all the tokens you are able to use.",
icon = "Achievement_Dungeon_GloryoftheRaider"
},
[2] = {
name = "keepBoes",
default = false,
title = "Keep BoE",
tooltip = "Keep all the Bind on Equip items specified on the dropdown box above\n(checked = keep)\n|cFF00FF00Recipes are not in this category, use the recipe section|r.",
icon = "Ability_Priest_Evangelism"
},
[3] = {
name = "keepCraftingReagents",
default = false,
title = "Keep crafting reagents",
tooltip = "Keep all the crafting reagents.",
icon = "INV_Enchanting_WOD_crystalbundle"
},
[4] = {
name = "keepLockboxes",
default = false,
title = "Keep all lockboxes",
tooltip = "Keep all the dropped lockboxes.",
icon = "Garrison_BronzeChest"
},
[5] = {
name = "keepRecipes",
default = false,
title = "Keep all the recipes",
tooltip = "Keep all the recipes from various professions specified in the dropdown box above\n(checked = keep)",
icon = "inv_scroll_05"
},
[6] = {
name = "keepCompanions",
default = false,
title = "Keep all companions",
tooltip = "Keep all the items that let me learn companions.",
icon = "INV_MISC_PETMOONKINTA"
},
[7] = {
name = "keepItemLevel",
default = false,
title = "Keep items above item level",
tooltip = "Keep all the items above the item level specified in the textbox.\n(value included. ex: 600 is all items with item level >= 600)",
icon = "Achievement_General_Classact"
},
[8] = {
name = "keepItemQuality",
default = true,
title = "Keep items of a certain quality",
tooltip = "Keep all the items of the specified quality in the dropdown box above\n(checked = keep)",
icon = "Achievement_Garrison_Alliance_PVE"
},
[9] = {
name = "keepSpecials",
default = true,
title = "Keep all special items",
tooltip = "Special items are consumables such as Illusion scrolls, artifact power items, order hall upgrades and a lot of other cool stuff.\n|cFF00FF00Recommended|r",
icon = "INV_Misc_CelebrationCake_01"
}
}
function ToggleCheckAndText(ui, check, set)
ui[check]:SetEnabled(set)
if set then ui[check].lbl:SetTextColor(253/255, 209/255, 22/255,1)
else ui[check].lbl:SetTextColor(153/255, 153/255, 153/255, 1) end
end
if not psItems then psItems = {} end
if not psItemsSaved then psItemsSaved = {} end
if not psItemsSavedFound then psItemsSavedFound = {} end
if not psSettings then
psSettings = {}
for i = 1, PileSeller:tablelength(PileSeller.settings) do
local s = PileSeller.settings[i].name
local d = PileSeller.settings[i].default
psSettings[s] = d
end
for i = 1, PileSeller:tablelength(PileSeller.itemsToKeep) do
local s = PileSeller.itemsToKeep[i].name
local d = PileSeller.itemsToKeep[i].default
psSettings[s] = d
end
psSettings["minimapButtonPos"] = 175
psSettings["trackSetting"] = false
else
for i=1, PileSeller:tablelength(PileSeller.settings) do
local s = PileSeller.settings[i].name
local d = PileSeller.settings[i].default
if psSettings[s] == nil then psSettings[s] = d end
end
for i = 1, PileSeller:tablelength(PileSeller.itemsToKeep) do
local s = PileSeller.itemsToKeep[i].name
local d = PileSeller.itemsToKeep[i].default
if psSettings[s] == nil then psSettings[s] = d end
end
if psSettings["minimapButtonPos"] == nil then psSettings["minimapButtonPos"] = 175 end
if psSettings["trackSetting"] == nil then psSettings["trackSetting"] = false end
if psSettings["debug"] == nil then psSettings["debug"] = false end
end
if not psItemsAlert then psItemsAlert = {} end
if not psIgnoredZones then psIgnoredZones = {} end
if psTutorialDone == nil then psTutorialDone = false end
-------------- This is because these variables are now deprecated (Version 2.2.0)
if psSettings["keepTrasmogsNotOwned"] ~= nil then psSettings["keepTrasmogsNotOwned"] = nil end
if psSettings["keepTrasmogs"] ~= nil then psSettings["keepTrasmogs"] = nil end
function PileSeller:Reset()
psItems = nil
psItemsSaved = nil
psItemsSavedFound = nil
psItemsAlert = nil
psSettings = nil
ReloadUI()
print("|cFF" .. PileSeller.color "Pile|rSeller's variables reset.")
end
function PileSeller:debugprint(string)
if psSettings["debug"] then print(string) end
end