changeset 133:5eefa40e2a29

Trimmed trailing spaces
author Asa Ayers <Asa.Ayers@Gmail.com>
date Wed, 15 Sep 2010 21:34:57 -0700
parents 0eaec1b52a63
children a529a4a4ccbe
files Core.lua Modules/Crafting.lua
diffstat 2 files changed, 102 insertions(+), 100 deletions(-) [+]
line wrap: on
line diff
--- a/Core.lua	Wed Sep 15 21:33:54 2010 -0700
+++ b/Core.lua	Wed Sep 15 21:34:57 2010 -0700
@@ -83,10 +83,10 @@
 	myMailbox = allMailboxes[UnitName("player")]
 
 	self.optionsFrame = LibStub("AceConfigDialog-3.0"):AddToBlizOptions("ItemAuditor", "ItemAuditor")
-	
+
 	LibStub("AceConfig-3.0"):RegisterOptionsTable("ItemAuditor", ItemAuditor.Options, {"ia"})
 	ItemAuditor:RegisterFrame(ItemAuditor_DebugFrame)
-	
+
 	LibStub("AceConsole-3.0"):RegisterChatCommand('rl', ReloadUI)
 
 	if self.db.char.crafting_threshold then
@@ -98,7 +98,7 @@
 		elseif threshold == 3 then
 			self.db.char.profitable_threshold = 50000
 		end
-	
+
 		self.db.char.crafting_threshold = nil
 	end
 
@@ -116,7 +116,7 @@
 
 
 local registeredEvents = {}
-local originalRegisterEvent = ItemAuditor.RegisterEvent 
+local originalRegisterEvent = ItemAuditor.RegisterEvent
 function ItemAuditor:RegisterEvent(event, callback, arg)
 	registeredEvents[event] = true
 	if arg ~= nil then
@@ -163,18 +163,18 @@
 			self.db.factionrealm.item_account[itemName] = nil
 		end
 	end
-	
+
 	for link, data in pairs(self.db.factionrealm.items) do
 		if self:GetItem(link).count == 0 or self:GetItem(link).invested == 0 then
 			self:RemoveItem(link)
 		end
 	end
-	
+
 	self:RefreshQAGroups()
 end
 
--- Options doesn't exist when this file is created the first time, so getOptions will 
--- make one call to :GetModule and return the result and replace itself with a 
+-- Options doesn't exist when this file is created the first time, so getOptions will
+-- make one call to :GetModule and return the result and replace itself with a
 -- function that simply returns the same object. The permanent solution will probably be
 -- to move :Print to a different module.
 local function getOptions()
@@ -212,18 +212,18 @@
 	local i = {}
 	local bagID
 	local slotID
-	
+
 	for bagID = 0, NUM_BAG_SLOTS do
 		scanBag(bagID, i)
 	end
-	
+
 	if bankOpen then
 		scanBag(BANK_CONTAINER, i)
 		for bagID = NUM_BAG_SLOTS+1, NUM_BANKBAGSLOTS do
 			scanBag(bagID, i)
 		end
 	end
-	
+
 	return {items = i, money = GetMoney()}
 end
 
@@ -239,17 +239,17 @@
 			self:Debug("1 diff[" .. link .. "]=" .. diff[link])
 		elseif count - pastInventory.items[link] ~= 0 then
 			diff[link] = count - pastInventory.items[link]
-			self:Debug("2 diff[" .. link .. "]=" .. diff[link])        
-		end    
+			self:Debug("2 diff[" .. link .. "]=" .. diff[link])
+		end
 	end
 
 	for link, count in pairs(pastInventory.items) do
 		if current.items[link] == nil then
 			diff[link] = -count
-			self:Debug("3 diff[" .. link .. "]=" .. diff[link])                
+			self:Debug("3 diff[" .. link .. "]=" .. diff[link])
 		elseif current.items[link] - count ~= 0 then
 			diff[link] = current.items[link] - pastInventory.items[link]
-			self:Debug("4 diff[" .. link .. "]=" .. diff[link])        
+			self:Debug("4 diff[" .. link .. "]=" .. diff[link])
 		end
 	end
 
@@ -266,21 +266,21 @@
 function ItemAuditor:ScanMail()
 	local results = {}
 	local CODPaymentRegex = gsub(COD_PAYMENT, "%%s", "(.*)")
-	
+
 	for mailIndex = 1, GetInboxNumItems() or 0 do
 		local sender, msgSubject, msgMoney, msgCOD, daysLeft, msgItem, _, _, msgText, _, isGM = select(3, GetInboxHeaderInfo(mailIndex))
 		local mailType = self:GetMailType(msgSubject)
-		
+
 		local mailSignature = msgSubject .. '-' .. msgMoney .. '-' .. msgCOD .. '-' .. daysLeft
-		
+
 		results[mailType] = (results[mailType] or {})
-		
+
 		if skipMail[mailSignature] ~= nil then
 			-- do nothing
 		elseif mailType == "NonAHMail" and msgCOD > 0 then
 			mailType = 'COD'
 			results[mailType] = (results[mailType] or {})
-			
+
 			local itemTypes = {}
 			for itemIndex = 1, ATTACHMENTS_MAX_RECEIVE do
 				local itemName, _, count, _, _= GetInboxItem(mailIndex, itemIndex)
@@ -288,25 +288,25 @@
 					itemTypes[itemName] = (itemTypes[itemName] or 0) + count
 				end
 			end
-			
+
 			if self:tcount(itemTypes) == 1 then
 				for itemName, count in pairs(itemTypes) do
 					results[mailType][itemName] = (results[mailType][itemName] or {total=0,count=0})
 					results[mailType][itemName].total = results[mailType][itemName].total + msgCOD
-					
+
 					if inboundCOD[mailSignature] == nil then
 						results[mailType][itemName].count = results[mailType][itemName].count + count
 						inboundCOD[mailSignature] = (inboundCOD[mailSignature] or 0) + count
 					else
 						results[mailType][itemName].count = inboundCOD[mailSignature]
 					end
-					
-					
+
+
 				end
 			else
 				self:Debug("Don't know what to do with more than one item type on COD mail.")
 			end
-		elseif mailType == "CODPayment" then	
+		elseif mailType == "CODPayment" then
 			-- /dump ItemAuditor.db.factionrealm.outbound_cod
 			self:Debug(msgSubject)
 			self:Debug(CODPaymentRegex)
@@ -315,7 +315,7 @@
 			if outboundSubject ~= nil then
 				self:Debug(outboundSubject)
 				trackID = select(3, outboundSubject:find('[[]IA: (%d*)[]]'))
-				
+
 				if trackID ~= nil then
 					trackID = tonumber(trackID)
 					self:Debug('COD ID: %s', trackID)
@@ -325,31 +325,31 @@
 						self:Print("WARNING: {%s} has an invalid ItemAuditor tracking number.", msgSubject)
 					else
 						itemName = trackID .. "|" .. cod['link']
-						
-						
+
+
 						results[mailType][itemName] = (results[mailType][itemName] or {total=0,count=0})
 						results[mailType][itemName].total = results[mailType][itemName].total - msgMoney
 						results[mailType][itemName].count = results[mailType][itemName].count - cod.count
 					end
 				end
 			end
-			
+
 			if trackID == nil then
 				skipMail[mailSignature] = true
 				self:Print("WARNING: {%s} is a COD payment but doesn't have an ItemAuditor tracking number.", msgSubject)
 			end
-			
+
 		elseif mailType == "AHSuccess" then
 			local invoiceType, itemName, playerName, bid, buyout, deposit, consignment = GetInboxInvoiceInfo(mailIndex);
 			results[mailType][itemName] = (results[mailType][itemName] or {total=0,count=0})
 			results[mailType][itemName].total = results[mailType][itemName].total - deposit - buyout + consignment
-			
+
 
 		elseif mailType == "AHWon" then
 			local invoiceType, itemName, playerName, bid, buyout, deposit, consignment = GetInboxInvoiceInfo(mailIndex);
 			results[mailType][itemName] = (results[mailType][itemName] or {total=0,count=0})
 			results[mailType][itemName].total = results[mailType][itemName].total + bid
-			
+
 			local count = select(3, GetInboxItem(mailIndex,1))
 			results[mailType][itemName].count = results[mailType][itemName].count + count
 		elseif mailType == "AHExpired" or mailType == "AHCancelled" or mailType == "AHOutbid" then
@@ -372,7 +372,7 @@
 			-- self:Print(format("|cFF00FF00MailScan|r: %s - %s - %s x %s", mailType, item, data.total, data.count))
 		end
 	end
-	return results   
+	return results
 end
 
 local realm = GetRealmName()
@@ -411,7 +411,7 @@
 	if viewOnly == nil then
 		viewOnly = false
 	end
-	
+
 	local itemName = nil
 	if self:GetSafeLink(link) == nil then
 		itemName = link
@@ -419,8 +419,8 @@
 		link = self:GetSafeLink(link)
 		itemName = GetItemInfo(link)
 	end
-	
-	
+
+
 	if self.db.factionrealm.item_account[itemName] ~= nil then
 		self.db.factionrealm.items[link] = {
 			count = ItemAuditor:GetItemCount(self:GetIDFromLink(link)),
@@ -428,33 +428,33 @@
 		}
 		self.db.factionrealm.item_account[itemName] = nil
 	end
-	
+
 	if viewOnly == false and self.db.factionrealm.items[link] == nil then
-		
+
 		self.db.factionrealm.items[link] = {
 			count =  ItemAuditor:GetItemCount(self:GetIDFromLink(link)),
 			invested = abs(self.db.factionrealm.item_account[itemName] or 0),
 		}
-		
+
 	end
-	
+
 	if self.db.factionrealm.items[link] ~= nil then
 		self.db.factionrealm.items[link].count =  ItemAuditor:GetItemCount(self:GetIDFromLink(link))
-		
+
 		if self.db.factionrealm.items[link].invested == nil then
 			self.db.factionrealm.items[link].invested = 0
 		end
 	end
-	
+
 	if viewOnly == true and self.db.factionrealm.items[link] == nil then
 		return {count = 0, invested = 0}
 	elseif viewOnly == true then
-		
+
 		return {count = self.db.factionrealm.items[link].count, invested = self.db.factionrealm.items[link].invested}
 	end
-	
-	
-	
+
+
+
 	return self.db.factionrealm.items[link]
 end
 
@@ -481,19 +481,19 @@
 		self.db.factionrealm.item_account[itemName] = (self.db.factionrealm.item_account[itemName] or 0) + value
 		item = {invested = self.db.factionrealm.item_account[itemName], count = 1}
 	else
-		
+
 		item = self:GetItem(realLink)
 		item.invested = item.invested + value
 		itemName = GetItemInfo(realLink)
 	end
-	
+
 	if value > 0 and countChange > 0 and item.invested == value and item.count ~= countChange then
 		local costPerItem = value / countChange
 		value = costPerItem * item.count
 		item.invested = value
 		self:Print("You already owned %s %s with an unknown price, so they have also been updated to %s each", (item.count - countChange), itemName, self:FormatMoney(costPerItem))
 	end
-	
+
 	if abs(value) > 0 then
 		if  item.invested < 0 then
 			if self.db.profile.messages.cost_updates then
@@ -502,7 +502,7 @@
 			self:RemoveItem(link)
 		-- This doesn't work when you mail the only copy of an item you have to another character.
 		--[[
-		elseif item.count == 0 and realLink and ItemAuditor:GetItemCount(self:GetIDFromLink(realLink)) then 
+		elseif item.count == 0 and realLink and ItemAuditor:GetItemCount(self:GetIDFromLink(realLink)) then
 			self:Print("You ran out of " .. itemName .. " and never recovered " .. self:FormatMoney(item.invested))
 			self:RemoveItem(link)
 		]]
@@ -512,7 +512,7 @@
 			end
 		end
 	end
-	
+
 	if realLink ~= nil then
 		ItemAuditor:UpdateQAThreshold(realLink)
 		self:SendMessage("IA_COST_CHANGED", realLink, unpack({ItemAuditor:GetItemCost(realLink)}))
@@ -564,11 +564,11 @@
 
 	if item.invested > 0 then
 		local count = item.count
-		
+
 		if countModifier ~= nil then
 			count = count - countModifier
 		end
-		if count > 0 then 
+		if count > 0 then
 			return ceil(item.invested), ceil(item.invested/count), count
 		end
 		return ceil(item.invested), 0, count
--- 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