Asa@63
|
1 local ItemAuditor = select(2, ...)
|
Asa@63
|
2 local Crafting = ItemAuditor:NewModule("Crafting")
|
Asa@59
|
3
|
Asa@59
|
4 local AceGUI = LibStub("AceGUI-3.0")
|
Asa@59
|
5 local ScrollingTable = LibStub("ScrollingTable")
|
Asa@59
|
6
|
Asa@59
|
7 local validateMoney = ItemAuditor.validateMoney
|
Asa@59
|
8 local parseMoney = ItemAuditor.parseMoney
|
Asa@59
|
9
|
Asa@59
|
10 local realData = {}
|
Asa@59
|
11
|
Asa@67
|
12
|
Asa@68
|
13 local queueDestinations = {}
|
Asa@70
|
14 local displayCraftingDestinations = {}
|
Asa@68
|
15 function Crafting.RegisterQueueDestination(name, destination)
|
Asa@68
|
16 queueDestinations[name] = destination
|
Asa@70
|
17 displayCraftingDestinations[name] = name
|
Asa@70
|
18 end
|
Asa@70
|
19
|
Asa@70
|
20 function Crafting.UnRegisterQueueDestination(name)
|
Asa@70
|
21 queueDestinations[name] = nil
|
Asa@70
|
22 displayCraftingDestinations[name] = nil
|
Asa@70
|
23 end
|
Asa@70
|
24
|
Asa@70
|
25 function Crafting.GetQueueDestination()
|
Asa@70
|
26 local dest = ItemAuditor.db.profile.queue_destination
|
Asa@70
|
27 if dest and queueDestinations[dest] then
|
Asa@70
|
28 return queueDestinations[dest], dest
|
Asa@70
|
29 end
|
Asa@70
|
30 -- If there is none selected or the selected option has
|
Asa@70
|
31 -- dissapeared, choose the first one in the list
|
Asa@70
|
32 for name, func in pairs(queueDestinations) do
|
Asa@70
|
33 if dest then
|
Asa@70
|
34 ItemAuditor:Print("%s is no longer available as a queue destination. %s is the new default", dest, name)
|
Asa@70
|
35 end
|
Asa@70
|
36 ItemAuditor.db.profile.queue_destination = name
|
Asa@70
|
37 return func, name
|
Asa@70
|
38 end
|
Asa@70
|
39
|
Asa@70
|
40 error('Unable to determine queue destination.')
|
Asa@68
|
41 end
|
Asa@68
|
42
|
Asa@67
|
43 -- TODO: Convert this to a text field.
|
Asa@67
|
44 local craftingThresholds = {5000, 10000, 50000}
|
Asa@67
|
45 local craftingThresholdsDisplay = {}
|
Asa@67
|
46
|
Asa@67
|
47 for key, value in pairs(craftingThresholds) do
|
Asa@67
|
48 craftingThresholdsDisplay[key] = ItemAuditor:FormatMoney(value, '', true)
|
Asa@67
|
49 -- craftingThresholdsDisplay[key] = value
|
Asa@67
|
50 end
|
Asa@67
|
51
|
Asa@68
|
52 function ItemAuditor:GetCraftingThreshold()
|
Asa@68
|
53 local key = ItemAuditor.db.char.crafting_threshold
|
Asa@68
|
54 return craftingThresholds[key]
|
Asa@68
|
55 end
|
Asa@68
|
56
|
Asa@67
|
57 ItemAuditor.Options.args.crafting_options = {
|
Asa@70
|
58 name = "Crafting",
|
Asa@67
|
59 type = 'group',
|
Asa@67
|
60 args = {
|
Asa@67
|
61 crafting_threshold = {
|
Asa@67
|
62 type = "select",
|
Asa@67
|
63 name = "Crafting Threshold",
|
Asa@67
|
64 desc = "Don't create items that will make less than this amount of profit",
|
Asa@67
|
65 values = craftingThresholdsDisplay,
|
Asa@67
|
66 get = function() return ItemAuditor.db.char.crafting_threshold end,
|
Asa@67
|
67 set = function(info, value) ItemAuditor.db.char.crafting_threshold = value end,
|
Asa@72
|
68 order = 0,
|
Asa@67
|
69 },
|
Asa@70
|
70 queue_destination = {
|
Asa@70
|
71 type = "select",
|
Asa@70
|
72 name = "Queue Destination",
|
Asa@70
|
73 desc = "Select the addon who's queue you would like ItemAuditor to post to.",
|
Asa@70
|
74 values = displayCraftingDestinations,
|
Asa@70
|
75 get = function() return select(2, Crafting.GetQueueDestination()) end,
|
Asa@70
|
76 set = function(info, value) ItemAuditor.db.profile.queue_destination = value end,
|
Asa@72
|
77 order = 1,
|
Asa@70
|
78 },
|
Asa@72
|
79 deciders = {
|
Asa@72
|
80 type="header",
|
Asa@72
|
81 name="Crafting Deciders",
|
Asa@72
|
82 order = 10,
|
Asa@72
|
83 },
|
Asa@72
|
84
|
Asa@67
|
85 },
|
Asa@67
|
86 }
|
Asa@67
|
87
|
Asa@59
|
88 local function displayMoney(rowFrame, cellFrame, data, cols, row, realrow, column, fShow, table, ...)
|
Asa@59
|
89 if fShow == true then
|
Asa@59
|
90 local money = data[realrow][column]
|
Asa@59
|
91 if money then
|
Asa@59
|
92 cellFrame.text:SetText(ItemAuditor:FormatMoney(tonumber(money)))
|
Asa@59
|
93 else
|
Asa@59
|
94 cellFrame.text:SetText("")
|
Asa@59
|
95 end
|
Asa@59
|
96
|
Asa@59
|
97 end
|
Asa@59
|
98 end
|
Asa@59
|
99
|
Asa@59
|
100 local craftingCols = {
|
Asa@59
|
101 { name= "Item", width = 200, defaultsort = "desc",
|
Asa@59
|
102 ['DoCellUpdate'] = function(rowFrame, cellFrame, data, cols, row, realrow, column, fShow, table, ...)
|
Asa@59
|
103 if fShow == true then
|
Asa@59
|
104 local data = realData[realrow]
|
Asa@59
|
105 cellFrame.text:SetText(data.link)
|
Asa@59
|
106 end
|
Asa@59
|
107 end,
|
Asa@59
|
108 },
|
Asa@59
|
109 { name= "Cost Each", width = 100, align = "RIGHT",
|
Asa@59
|
110 ['DoCellUpdate'] = displayMoney,
|
Asa@59
|
111 },
|
Asa@59
|
112 { name= "Est Sale Each", width = 100, align = "RIGHT",
|
Asa@59
|
113 ['DoCellUpdate'] = displayMoney,
|
Asa@59
|
114 },
|
Asa@59
|
115 { name= "Decided By", width = 100, align = "RIGHT",
|
Asa@59
|
116
|
Asa@59
|
117 },
|
Asa@59
|
118 { name= "craft", width = 50, align = "RIGHT",
|
Asa@59
|
119
|
Asa@59
|
120 },
|
Asa@59
|
121 { name= "Total Profit", width = 100, align = "RIGHT",
|
Asa@59
|
122 ['DoCellUpdate'] = displayMoney,
|
Asa@59
|
123 },
|
Asa@59
|
124 }
|
Asa@59
|
125
|
Asa@68
|
126 function Crafting.ExportToSkillet(data)
|
Asa@68
|
127 local skillString = select(3, string.find(data.recipeLink, "^|%x+|H(.+)|h%[.+%]"))
|
Asa@68
|
128 local _, skillId = strsplit(":", skillString)
|
Asa@68
|
129
|
Asa@68
|
130 ItemAuditor:AddToQueue(skillId,tradeSkillIndex, data.queue)
|
Asa@68
|
131 end
|
Asa@68
|
132
|
Asa@68
|
133 Crafting.RegisterQueueDestination('Skillet', Crafting.ExportToSkillet)
|
Asa@68
|
134
|
Asa@68
|
135
|
Asa@68
|
136
|
Asa@68
|
137 function Crafting.Export(destination)
|
Asa@68
|
138 if type(destination) == 'function' then
|
Asa@68
|
139 -- do nothing
|
Asa@68
|
140 elseif destination == nil then
|
Asa@70
|
141 destination = Crafting.GetQueueDestination()
|
Asa@68
|
142 elseif type(destination) == 'string' then
|
Asa@68
|
143 destination = queueDestinations[destination]
|
Asa@68
|
144 else
|
Asa@68
|
145 error('destination must be a function or a string')
|
Asa@68
|
146 end
|
Asa@68
|
147
|
Asa@59
|
148 local index = 1
|
Asa@59
|
149 local data = ItemAuditor:GetCraftingRow(index)
|
Asa@59
|
150 while data do
|
Asa@68
|
151 if data.queue > 0 then
|
Asa@68
|
152 destination(data)
|
Asa@68
|
153 end
|
Asa@61
|
154 index = index + 1
|
Asa@61
|
155 data = ItemAuditor:GetCraftingRow(index)
|
Asa@59
|
156
|
Asa@59
|
157 end
|
Asa@59
|
158 end
|
Asa@59
|
159
|
Asa@59
|
160 local craftingContent = false
|
Asa@59
|
161 local craftingTable = false
|
Asa@60
|
162 local btnProcess = false
|
Asa@59
|
163 local function ShowCrafting(container)
|
Asa@59
|
164 if craftingContent == false then
|
Asa@59
|
165 local window = container.frame
|
Asa@59
|
166 craftingContent = CreateFrame("Frame",nil,window)
|
Asa@59
|
167 craftingContent:SetBackdropColor(0, 0, 1, 0.5)
|
Asa@59
|
168 craftingContent:SetBackdropBorderColor(1, 0, 0, 1)
|
Asa@59
|
169
|
Asa@59
|
170 craftingContent:SetPoint("TOPLEFT", window, 10, -50)
|
Asa@59
|
171 craftingContent:SetPoint("BOTTOMRIGHT",window, -10, 10)
|
Asa@59
|
172
|
Asa@59
|
173 craftingTable = ScrollingTable:CreateST(craftingCols, 22, nil, nil, craftingContent )
|
Asa@59
|
174
|
Asa@59
|
175 IAcc = craftingContent
|
Asa@59
|
176 IAccWindow = window
|
Asa@59
|
177 craftingTable.frame:SetPoint("TOPLEFT",craftingContent, 0,0)
|
Asa@59
|
178 craftingTable.frame:SetPoint("BOTTOMRIGHT", craftingContent, 0, 30)
|
Asa@59
|
179
|
Asa@59
|
180 craftingTable:RegisterEvents({
|
Asa@59
|
181 ["OnEnter"] = function (rowFrame, cellFrame, data, cols, row, realrow, column, scrollingTable, ...)
|
Asa@59
|
182 if realrow then
|
Asa@59
|
183 local data = realData[realrow]
|
Asa@59
|
184
|
Asa@59
|
185 GameTooltip:SetOwner(rowFrame, "ANCHOR_CURSOR")
|
Asa@59
|
186 GameTooltip:SetHyperlink(data.link)
|
Asa@59
|
187 GameTooltip:Show()
|
Asa@59
|
188 end
|
Asa@59
|
189 end,
|
Asa@59
|
190 ["OnLeave"] = function (rowFrame, cellFrame, data, cols, row, realrow, column, scrollingTable, ...)
|
Asa@59
|
191 GameTooltip:Hide()
|
Asa@59
|
192 end,
|
Asa@59
|
193 });
|
Asa@59
|
194
|
Asa@59
|
195
|
Asa@59
|
196 btnProcess = CreateFrame("Button", nil, craftingContent, "UIPanelButtonTemplate")
|
Asa@59
|
197 btnProcess:SetText("Process")
|
Asa@59
|
198 btnProcess:SetSize(100, 25)
|
Asa@59
|
199 btnProcess:SetPoint("BOTTOMRIGHT", craftingContent, 0, 0)
|
Asa@59
|
200 btnProcess:RegisterForClicks("LeftButtonUp");
|
Asa@59
|
201
|
Asa@60
|
202 local function UpdateProcessTooltip(btn)
|
Asa@59
|
203 local data = ItemAuditor:GetCraftingRow(1)
|
Asa@59
|
204 if data then
|
Asa@59
|
205 GameTooltip:SetOwner(this, "ANCHOR_CURSOR")
|
Asa@59
|
206 GameTooltip:SetText(format('Create %sx%s', data.link, data.queue))
|
Asa@59
|
207 GameTooltip:Show()
|
Asa@59
|
208 end
|
Asa@60
|
209 end
|
Asa@60
|
210 btnProcess:SetScript("OnClick", function (self, button, down)
|
Asa@60
|
211 local data = ItemAuditor:GetCraftingRow(1)
|
Asa@60
|
212 if data then
|
Asa@60
|
213 ItemAuditor:Print('Crafting %sx%s', data.link, data.queue)
|
Asa@60
|
214 DoTradeSkill(data.tradeSkillIndex, data.queue)
|
Asa@60
|
215 data.queue = 0
|
Asa@60
|
216 ItemAuditor:RefreshCraftingTable()
|
Asa@60
|
217 UpdateProcessTooltip()
|
Asa@60
|
218 end
|
Asa@59
|
219 end)
|
Asa@59
|
220
|
Asa@60
|
221 btnProcess:SetScript("OnEnter", UpdateProcessTooltip)
|
Asa@60
|
222
|
Asa@59
|
223 btnProcess:SetScript("OnLeave", function()
|
Asa@59
|
224 GameTooltip:Hide()
|
Asa@59
|
225 end)
|
Asa@59
|
226
|
Asa@59
|
227 btnSkillet = CreateFrame("Button", nil, craftingContent, "UIPanelButtonTemplate")
|
Asa@70
|
228
|
Asa@70
|
229
|
Asa@59
|
230 btnSkillet:SetSize(125, 25)
|
Asa@59
|
231 btnSkillet:SetPoint("BOTTOMRIGHT", btnProcess, 'BOTTOMLEFT', 0, 0)
|
Asa@59
|
232 btnSkillet:RegisterForClicks("LeftButtonUp");
|
Asa@59
|
233 btnSkillet:SetScript("OnClick", function (self, button, down)
|
Asa@70
|
234 Crafting.Export()
|
Asa@59
|
235 end)
|
Asa@59
|
236
|
Asa@59
|
237 end
|
Asa@70
|
238 local destination = select(2, Crafting.GetQueueDestination())
|
Asa@70
|
239 btnSkillet:SetText("Export to "..destination)
|
Asa@70
|
240
|
Asa@59
|
241 craftingContent:Show()
|
Asa@59
|
242
|
Asa@59
|
243 if container.parent then
|
Asa@59
|
244 local width = 80
|
Asa@59
|
245 for i, data in pairs(craftingCols) do
|
Asa@59
|
246 width = width + data.width
|
Asa@59
|
247 end
|
Asa@59
|
248 container.parent:SetWidth(width);
|
Asa@59
|
249 end
|
Asa@59
|
250
|
Asa@59
|
251 ItemAuditor:RegisterEvent("TRADE_SKILL_SHOW", function()
|
Asa@59
|
252 if craftingContent and craftingContent:IsVisible() then
|
Asa@59
|
253 ItemAuditor:UpdateCraftingTable()
|
Asa@59
|
254 end
|
Asa@59
|
255 end)
|
Asa@59
|
256 ItemAuditor:UpdateCraftingTable()
|
Asa@59
|
257
|
Asa@59
|
258 return craftingContent
|
Asa@59
|
259 end
|
Asa@59
|
260
|
Asa@59
|
261
|
Asa@59
|
262
|
Asa@59
|
263 ItemAuditor:RegisterTab('Crafting', 'tab_crafting', ShowCrafting)
|
Asa@59
|
264 function ItemAuditor:DisplayCrafting()
|
Asa@59
|
265 self:CreateFrame('tab_crafting')
|
Asa@59
|
266 end
|
Asa@59
|
267
|
Asa@59
|
268 local craftingDeciders = {}
|
Asa@59
|
269
|
Asa@72
|
270 function Crafting.RegisterCraftingDecider(name, decider, options)
|
Asa@59
|
271 craftingDeciders[name] = decider
|
Asa@72
|
272
|
Asa@72
|
273 ItemAuditor.Options.args.crafting_options.args['chk'..name] = {
|
Asa@72
|
274 type = "toggle",
|
Asa@72
|
275 name = "Enable "..name,
|
Asa@72
|
276 get = function() return not ItemAuditor.db.profile.disabled_deciders[name] end,
|
Asa@72
|
277 set = function(info, value) ItemAuditor.db.profile.disabled_deciders[name] = not value end,
|
Asa@72
|
278 order = 11,
|
Asa@72
|
279 }
|
Asa@72
|
280
|
Asa@72
|
281 if options then
|
Asa@72
|
282 ItemAuditor.Options.args.crafting_options.args['decider_'..name] = {
|
Asa@72
|
283 handler = {},
|
Asa@72
|
284 name = name,
|
Asa@72
|
285 type = 'group',
|
Asa@72
|
286 args = options,
|
Asa@72
|
287 }
|
Asa@72
|
288 end
|
Asa@59
|
289 end
|
Asa@59
|
290
|
Asa@59
|
291 local lastWinnder = ""
|
Asa@59
|
292 local function Decide(data)
|
Asa@59
|
293 local newDecision = 0
|
Asa@59
|
294 for name, decider in pairs(craftingDeciders) do
|
Asa@72
|
295 if not ItemAuditor.db.profile.disabled_deciders[name] and name ~= lastWinner then
|
Asa@59
|
296 newDecision = decider(data)
|
Asa@59
|
297 if newDecision > data.queue then
|
Asa@59
|
298 data.queue = newDecision
|
Asa@59
|
299 lastWinner = name
|
Asa@59
|
300 return Decide(data)
|
Asa@59
|
301 elseif newDecision < 0 then
|
Asa@59
|
302 lastWinner = ""
|
Asa@59
|
303 return 'VETO: '..name, 0
|
Asa@59
|
304 end
|
Asa@59
|
305 end
|
Asa@59
|
306 end
|
Asa@59
|
307
|
Asa@59
|
308 winner = lastWinner
|
Asa@59
|
309 lastWinner = ""
|
Asa@59
|
310
|
Asa@59
|
311 return winner, data.queue
|
Asa@59
|
312 end
|
Asa@59
|
313
|
Asa@59
|
314 local function isProfitable(data)
|
Asa@59
|
315 if data.profit > 0 and data.profit > ItemAuditor:GetCraftingThreshold() then
|
Asa@59
|
316 return 1
|
Asa@59
|
317 end
|
Asa@59
|
318 return -1
|
Asa@59
|
319 end
|
Asa@72
|
320
|
Asa@64
|
321 Crafting.RegisterCraftingDecider('Is Profitable', isProfitable)
|
Asa@59
|
322
|
Asa@59
|
323 local function tableFilter(self, row, ...)
|
Asa@59
|
324 -- column 5 is how many should be crafted
|
Asa@59
|
325 return row[5] > 0
|
Asa@59
|
326 end
|
Asa@59
|
327
|
Asa@59
|
328 local tableData = {}
|
Asa@59
|
329 function ItemAuditor:UpdateCraftingTable()
|
Asa@59
|
330 if LSW == nil then
|
Asa@59
|
331 self:Print("This feature requires LilSparky's Workshop.")
|
Asa@59
|
332 return
|
Asa@59
|
333 end
|
Asa@59
|
334 if Skillet == nil then
|
Asa@59
|
335 self:Print("This feature requires Skillet.")
|
Asa@59
|
336 return
|
Asa@59
|
337 end
|
Asa@59
|
338 if GetAuctionBuyout ~= nil then
|
Asa@59
|
339 elseif AucAdvanced and AucAdvanced.Version then
|
Asa@59
|
340 else
|
Asa@59
|
341 self:Print("This feature requires Auctionator, Auctioneer, AuctionLite, or AuctionMaster.")
|
Asa@59
|
342 return
|
Asa@59
|
343 end
|
Asa@59
|
344 wipe(realData)
|
Asa@59
|
345 wipe(tableData)
|
Asa@59
|
346
|
Asa@59
|
347 local profitableItems = {}
|
Asa@59
|
348 local profitableIndex = 1
|
Asa@59
|
349 local numChecked = 0
|
Asa@59
|
350 local row = 1
|
Asa@59
|
351
|
Asa@59
|
352 for i = 1, GetNumTradeSkills() do
|
Asa@59
|
353 local itemLink = GetTradeSkillItemLink(i)
|
Asa@59
|
354 local itemId = Skillet:GetItemIDFromLink(itemLink)
|
Asa@59
|
355
|
Asa@59
|
356 --Figure out if its an enchant or not
|
Asa@59
|
357 _, _, _, _, altVerb = GetTradeSkillInfo(i)
|
Asa@59
|
358 if LSW.scrollData[itemId] ~= nil and altVerb == 'Enchant' then
|
Asa@59
|
359 -- Ask LSW for the correct scroll
|
Asa@59
|
360 itemId = LSW.scrollData[itemId]["scrollID"]
|
Asa@59
|
361 end
|
Asa@59
|
362
|
Asa@59
|
363 local recipeLink = GetTradeSkillRecipeLink(i)
|
Asa@59
|
364 local stackSize = 1
|
Asa@59
|
365 if recipeLink ~= nil and itemId ~= nil then
|
Asa@59
|
366 local skillName, skillType, numAvailable, isExpanded, altVerb = GetTradeSkillInfo(i)
|
Asa@59
|
367 local itemName, itemLink= GetItemInfo(itemId)
|
Asa@59
|
368
|
Asa@59
|
369 local count = Altoholic:GetItemCount(itemId)
|
Asa@59
|
370 local reagents = {}
|
Asa@59
|
371 local totalCost = 0
|
Asa@59
|
372 for reagentId = 1, GetTradeSkillNumReagents(i) do
|
Asa@59
|
373 local reagentName, _, reagentCount = GetTradeSkillReagentInfo(i, reagentId);
|
Asa@59
|
374 local reagentLink = GetTradeSkillReagentItemLink(i, reagentId)
|
Asa@59
|
375
|
Asa@59
|
376 reagents[reagentId] = {
|
Asa@59
|
377 name = reagentName,
|
Asa@59
|
378 count = reagentCount,
|
Asa@59
|
379 price = self:GetReagentCost(reagentLink, reagentCount),
|
Asa@59
|
380 }
|
Asa@59
|
381 totalCost = totalCost + self:GetReagentCost(reagentLink, reagentCount)
|
Asa@59
|
382 end
|
Asa@59
|
383
|
Asa@59
|
384 local data = {
|
Asa@59
|
385 recipeLink = recipeLink,
|
Asa@59
|
386 link = itemLink,
|
Asa@59
|
387 name = itemName,
|
Asa@59
|
388 count = count,
|
Asa@59
|
389 price = (self:GetAuctionPrice(itemLink) or 0),
|
Asa@59
|
390 cost = totalCost,
|
Asa@59
|
391 profit = (self:GetAuctionPrice(itemLink) or 0) - totalCost,
|
Asa@59
|
392 reagents = reagents,
|
Asa@59
|
393 count = count,
|
Asa@59
|
394 tradeSkillIndex = i,
|
Asa@59
|
395 queue = 0,
|
Asa@59
|
396 winner = "",
|
Asa@59
|
397 }
|
Asa@59
|
398
|
Asa@59
|
399 data.winner, data.queue = Decide(data)
|
Asa@59
|
400 data.queue = data.queue - count
|
Asa@59
|
401
|
Asa@59
|
402 -- If a tradeskill makes 5 at a time and something asks for 9, we should only
|
Asa@59
|
403 -- craft twice to get 10.
|
Asa@59
|
404 data.queue = ceil(data.queue / GetTradeSkillNumMade(i))
|
Asa@59
|
405
|
Asa@59
|
406 realData[row] = data
|
Asa@59
|
407 row = row + 1
|
Asa@59
|
408 end
|
Asa@59
|
409 end
|
Asa@59
|
410 table.sort(realData, function(a, b) return a.profit*a.queue > b.profit*b.queue end)
|
Asa@68
|
411 if craftingTable then
|
Asa@68
|
412 craftingTable:SetFilter(tableFilter)
|
Asa@68
|
413 self:RefreshCraftingTable()
|
Asa@68
|
414 end
|
Asa@60
|
415 end
|
Asa@60
|
416
|
Asa@60
|
417 function ItemAuditor:RefreshCraftingTable()
|
Asa@59
|
418 for key, data in pairs(realData) do
|
Asa@59
|
419 tableData[key] = {
|
Asa@59
|
420 data.name,
|
Asa@59
|
421 data.cost,
|
Asa@59
|
422 data.price,
|
Asa@59
|
423 data.winner,
|
Asa@59
|
424 data.queue,
|
Asa@59
|
425 data.profit*data.queue,
|
Asa@59
|
426 }
|
Asa@59
|
427 end
|
Asa@60
|
428 craftingTable:SetData(tableData, true)
|
Asa@59
|
429
|
Asa@60
|
430 if self:GetCraftingRow(1) then
|
Asa@60
|
431 btnProcess:Enable()
|
Asa@60
|
432 else
|
Asa@60
|
433 btnProcess:Disable()
|
Asa@60
|
434 end
|
Asa@59
|
435 end
|
Asa@59
|
436
|
Asa@59
|
437 function ItemAuditor:GetCraftingRow(row)
|
Asa@59
|
438 if craftingTable then
|
Asa@59
|
439 for _, index in pairs(craftingTable.sorttable) do
|
Asa@59
|
440 local tableRow = tableData[index]
|
Asa@59
|
441 if tableFilter(nil, tableRow) then
|
Asa@59
|
442 row = row - 1
|
Asa@59
|
443 if row == 0 then
|
Asa@59
|
444 return realData[index]
|
Asa@59
|
445 end
|
Asa@59
|
446 end
|
Asa@59
|
447 end
|
Asa@59
|
448 elseif realData then
|
Asa@59
|
449 return realData[row]
|
Asa@59
|
450 end
|
Asa@59
|
451 return nil
|
Asa@59
|
452 end
|
Asa@67
|
453 ItemAuditor.Options.args.crafting = {
|
Asa@67
|
454 type = "execute",
|
Asa@67
|
455 name = "crafting",
|
Asa@67
|
456 desc = "This opens a window to configure a crafting queue.",
|
Asa@67
|
457 func = "DisplayCrafting",
|
Asa@67
|
458 guiHidden = false,
|
Asa@67
|
459 }
|