Mercurial > wow > itemauditor
diff Modules/Crafting.lua @ 133:5eefa40e2a29
Trimmed trailing spaces
author | Asa Ayers <Asa.Ayers@Gmail.com> |
---|---|
date | Wed, 15 Sep 2010 21:34:57 -0700 |
parents | 78c6d905c2e1 |
children | a529a4a4ccbe |
line wrap: on
line diff
--- a/Modules/Crafting.lua Wed Sep 15 21:33:54 2010 -0700 +++ b/Modules/Crafting.lua Wed Sep 15 21:34:57 2010 -0700 @@ -76,7 +76,7 @@ if dest and queueDestinations[dest] then return queueDestinations[dest], dest end - -- If there is none selected or the selected option has + -- If there is none selected or the selected option has -- dissapeared, choose the first one in the list for name, func in pairs(queueDestinations) do if dest then @@ -85,7 +85,7 @@ ItemAuditor.db.profile.queue_destination = name return func, name end - + error('Unable to determine queue destination.') end @@ -122,7 +122,7 @@ else cellFrame.text:SetText("") end - + end end @@ -135,20 +135,20 @@ end end, }, - { name= "Cost Each", width = 100, align = "RIGHT", + { name= "Cost Each", width = 100, align = "RIGHT", ['DoCellUpdate'] = displayMoney, }, - { name= "Est Sale Each", width = 100, align = "RIGHT", + { name= "Est Sale Each", width = 100, align = "RIGHT", ['DoCellUpdate'] = displayMoney, }, { name= "Decided By", width = 125, align = "RIGHT", - + }, - { name= "craft", width = 50, align = "RIGHT", - + { name= "craft", width = 50, align = "RIGHT", + }, - { name= "Have Mats", width = 60, align = "RIGHT", - + { name= "Have Mats", width = 60, align = "RIGHT", + }, { name= "Profit Each", width = 100, align = "RIGHT", ['DoCellUpdate'] = displayMoney, @@ -158,7 +158,7 @@ function Crafting.ExportToSkillet(data) local skillString = select(3, string.find(data.recipeLink, "^|%x+|H(.+)|h%[.+%]")) local _, skillId = strsplit(":", skillString) - + ItemAuditor:AddToQueue(skillId,tradeSkillIndex, data.queue) end @@ -176,7 +176,7 @@ else error('destination must be a function or a string') end - + local index = 1 local data = ItemAuditor:GetCraftingRow(index) while data do @@ -185,7 +185,7 @@ end index = index + 1 data = ItemAuditor:GetCraftingRow(index) - + end end @@ -218,19 +218,19 @@ if craftingContent == false then local window = container.frame craftingContent = CreateFrame("Frame",nil,window) - craftingContent:SetBackdropColor(0, 0, 1, 0.5) + craftingContent:SetBackdropColor(0, 0, 1, 0.5) craftingContent:SetBackdropBorderColor(1, 0, 0, 1) - + craftingContent:SetPoint("TOPLEFT", window, 10, -50) craftingContent:SetPoint("BOTTOMRIGHT",window, -10, 10) - + craftingTable = ScrollingTable:CreateST(craftingCols, 22, nil, nil, craftingContent ) - - IAcc = craftingContent + + IAcc = craftingContent IAccWindow = window craftingTable.frame:SetPoint("TOPLEFT",craftingContent, 0,0) craftingTable.frame:SetPoint("BOTTOMRIGHT", craftingContent, 0, 30) - + craftingTable:RegisterEvents({ ["OnEnter"] = function (rowFrame, cellFrame, data, cols, row, realrow, column, scrollingTable, ...) if realrow then @@ -265,7 +265,7 @@ GameTooltip:Hide() end, }); - + local craftingView = CreateFrame("Button", nil, craftingContent, "UIPanelButtonTemplate") craftingView:SetText("View") craftingView:SetSize(50, 25) @@ -297,10 +297,10 @@ btnProcess = CreateFrame("Button", nil, craftingContent, "UIPanelButtonTemplate") btnProcess:SetText("Process") - btnProcess:SetSize(100, 25) + btnProcess:SetSize(100, 25) btnProcess:SetPoint("BOTTOMRIGHT", craftingContent, 0, 0) btnProcess:RegisterForClicks("LeftButtonUp"); - + local function UpdateProcessTooltip(btn) local data = ItemAuditor:GetCraftingRow(1) if data then @@ -335,7 +335,7 @@ return useVellum(vellumLevelMap[vellumID], idealVellum or vellumID) end end - + btnProcess:SetScript("OnClick", function (self, button, down) local data = ItemAuditor:GetCraftingRow(1) if data then @@ -344,7 +344,7 @@ if data.tradeskillName ~= tradeskillName then CastSpellByName(data.tradeskillName) end - + local queue = data.queue local vellumID = nil _, _, _, _, altVerb = GetTradeSkillInfo(data.tradeSkillIndex) @@ -367,37 +367,37 @@ btnProcess:SetScript("OnLeave", function() GameTooltip:Hide() end) - + btnSkillet = CreateFrame("Button", nil, craftingContent, "UIPanelButtonTemplate") - btnSkillet:SetSize(125, 25) + btnSkillet:SetSize(125, 25) btnSkillet:SetPoint("BOTTOMRIGHT", btnProcess, 'BOTTOMLEFT', 0, 0) btnSkillet:RegisterForClicks("LeftButtonUp"); btnSkillet:SetScript("OnClick", function (self, button, down) Crafting.Export() end) - + end local destination = select(2, Crafting.GetQueueDestination()) btnSkillet:SetText("Export to "..destination) - + craftingContent:Show() - + if container.parent then local width = 80 - for i, data in pairs(craftingCols) do + for i, data in pairs(craftingCols) do width = width + data.width end container.parent:SetWidth(width); end - + ItemAuditor:RegisterEvent("TRADE_SKILL_SHOW", function() if craftingContent and craftingContent:IsVisible() then ItemAuditor:UpdateCraftingTable() end end) ItemAuditor:UpdateCraftingTable() - + return craftingContent end @@ -410,7 +410,7 @@ function Crafting.RegisterCraftingDecider(name, decider, options) craftingDeciders[name] = decider - + ItemAuditor.Options.args.crafting_options.args['chk'..name] = { type = "toggle", name = "Enable "..name, @@ -418,7 +418,7 @@ set = function(info, value) ItemAuditor.db.profile.disabled_deciders[name] = not value end, order = 11, } - + if options then ItemAuditor.Options.args.crafting_options.args['decider_'..name] = { handler = {}, @@ -436,7 +436,7 @@ for name, decider in pairs(craftingDeciders) do if not ItemAuditor.db.profile.disabled_deciders[name] and name ~= lastWinner then newDecision, reason = decider(data) - + if newDecision > data.queue then data.queue = newDecision lastWinner = (reason or name) @@ -447,12 +447,12 @@ end end end - + winner = lastWinner lastWinner = "" - + data.queue = ceil(data.queue / GetTradeSkillNumMade(data.tradeSkillIndex)) - + return winner, data.queue end @@ -514,9 +514,9 @@ local tradeskillName = GetTradeSkillLine() Crafting.ClearProfession(tradeskillName) shoppingList = nil - + wipe(tableData) - + local profitableItems = {} local profitableIndex = 1 local numChecked = 0 @@ -525,12 +525,12 @@ if tradeskillName == 'UNKNOWN' then numTradeSkills = 0 end - + for i = 1, numTradeSkills do local itemLink = GetTradeSkillItemLink(i) local itemId = Utils.GetItemID(itemLink) local vellumID = nil - + local spellName = itemName --Figure out if its an enchant or not @@ -547,7 +547,7 @@ if recipeLink ~= nil and itemId ~= nil then local skillName, skillType, numAvailable, isExpanded, altVerb = GetTradeSkillInfo(i) local itemName, itemLink= GetItemInfo(itemId) - + -- This check has to be here for things like Inscription Research that don't produce an item. if itemLink then local count = ItemAuditor:GetItemCount(itemId) @@ -557,7 +557,7 @@ local reagentName, _, reagentCount = GetTradeSkillReagentInfo(i, reagentId); local reagentLink = GetTradeSkillReagentItemLink(i, reagentId) local reagentTotalCost = self:GetReagentCost(reagentLink, reagentCount) - + reagents[reagentId] = { link = reagentLink, itemID = Utils.GetItemID(reagentLink), @@ -603,7 +603,7 @@ winner = "", tradeskillName = tradeskillName, } - + data.winner, data.queue = Decide(data) --[[ If it wasn't vetoed we need to reduce the number by how many are owned @@ -612,8 +612,8 @@ if data.queue > 0 then data.queue = max(0, data.queue - count) end - - -- If a tradeskill makes 5 at a time and something asks for 9, we should only + + -- If a tradeskill makes 5 at a time and something asks for 9, we should only -- craft twice to get 10. data.queue = ceil(data.queue / GetTradeSkillNumMade(i)) @@ -674,7 +674,7 @@ } local slItem = shoppingList[reagent.itemID] - + if numOwned[reagent.link] < 0 and not vellumLevelMap[reagent.itemID] then reagent.need = min(reagent.count, abs(numOwned[reagent.link])) elseif numOwned[reagent.link] >= 0 then @@ -744,7 +744,7 @@ } end craftingTable:SetData(tableData, true) - + if self:GetCraftingRow(1) then btnProcess:Enable() else