# HG changeset patch # User Asa Ayers # Date 1278168001 25200 # Node ID 44e70a3fdb19c1a96bd068f45ee19717ecf3808d # Parent 6fc9fbaa94b32180c9a595a63b7e6c58cb0e2c6b Merged utils into ItemAuditor. diff -r 6fc9fbaa94b3 -r 44e70a3fdb19 Core.lua --- a/Core.lua Sat Jul 03 07:28:40 2010 -0700 +++ b/Core.lua Sat Jul 03 07:40:01 2010 -0700 @@ -37,7 +37,7 @@ function addon:ConvertItems() for itemName, value in pairs(self.db.factionrealm.item_account) do - local itemID = utils:GetItemID(itemName) + local itemID = self:GetItemID(itemName) if itemID ~= nil then self:GetItem('item:' .. itemID) end @@ -112,7 +112,7 @@ local results = {} for mailIndex = 1, GetInboxNumItems() or 0 do local sender, msgSubject, msgMoney, msgCOD, _, msgItem, _, _, msgText, _, isGM = select(3, GetInboxHeaderInfo(mailIndex)) - local mailType = utils:GetMailType(msgSubject) + local mailType = self:GetMailType(msgSubject) results[mailType] = (results[mailType] or {}) @@ -131,7 +131,7 @@ end end - if utils:tcount(itemTypes) == 1 then + if self:tcount(itemTypes) == 1 then for itemName, count in pairs(itemTypes) do results[mailType][itemName] = (results[mailType][itemName] or 0) - msgCOD end @@ -229,15 +229,15 @@ end if abs(value) > 0 then - self:Debug("Updated price of " .. itemName .. " to " .. utils:FormatMoney(item.invested) .. "(change: " .. utils:FormatMoney(value) .. ")") + self:Debug("Updated price of " .. itemName .. " to " .. self:FormatMoney(item.invested) .. "(change: " .. self:FormatMoney(value) .. ")") if item.invested <= 0 then - self:Debug("Updated price of " .. itemName .. " to " .. utils:FormatMoney(0)) + self:Debug("Updated price of " .. itemName .. " to " ..self:FormatMoney(0)) 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 Altoholic:GetItemCount(self:GetIDFromLink(realLink)) then - self:Print("You ran out of " .. itemName .. " and never recovered " .. utils:FormatMoney(item.invested)) + self:Print("You ran out of " .. itemName .. " and never recovered " .. self:FormatMoney(item.invested)) self:RemoveItem(link) ]] end @@ -272,9 +272,6 @@ end end -function addon:GetItemID(itemName) - return utils:GetItemID(itemName) -end function addon:GetSafeLink(link) local newLink = nil diff -r 6fc9fbaa94b3 -r 44e70a3fdb19 ItemAuditor.toc --- a/ItemAuditor.toc Sat Jul 03 07:28:40 2010 -0700 +++ b/ItemAuditor.toc Sat Jul 03 07:40:01 2010 -0700 @@ -10,10 +10,9 @@ embeds.xml -Modules\Utils.lua Core.lua - +Modules\Utils.lua Modules\QuickAuctions.lua Modules\Events.lua Modules\Tooltip.lua diff -r 6fc9fbaa94b3 -r 44e70a3fdb19 Modules/Events.lua --- a/Modules/Events.lua Sat Jul 03 07:28:40 2010 -0700 +++ b/Modules/Events.lua Sat Jul 03 07:40:01 2010 -0700 @@ -98,19 +98,19 @@ end end - if diff.money > 0 and utils:tcount(positive) > 0 and utils:tcount(negative) == 0 then - -- self:Debug("loot") - elseif utils:tcount(diff.items) == 1 then - -- self:Debug("purchase or sale") + if diff.money > 0 and self:tcount(positive) > 0 and self:tcount(negative) == 0 then + self:Debug("loot") + elseif self:tcount(diff.items) == 1 then + self:Debug("purchase or sale") for link, count in pairs(diff.items) do self:SaveValue(link, 0 - diff.money) end - elseif utils:tcount(diff.items) > 1 then + elseif self:tcount(diff.items) > 1 then - if utils:tcount(positive) > 0 and utils:tcount(negative) > 0 then + if self:tcount(positive) > 0 and self:tcount(negative) > 0 then -- we must have created/converted something - -- self:Debug("conversion") + self:Debug("conversion") local totalChange = 0 for link, change in pairs(negative) do diff -r 6fc9fbaa94b3 -r 44e70a3fdb19 Modules/Options.lua --- a/Modules/Options.lua Sat Jul 03 07:28:40 2010 -0700 +++ b/Modules/Options.lua Sat Jul 03 07:40:01 2010 -0700 @@ -127,7 +127,7 @@ function addon:DumpInfo() for itemName, value in pairsByKeys(self.db.factionrealm.item_account) do - self:Print(itemName .. ": " .. utils:FormatMoney(value)) + self:Print(itemName .. ": " .. self:FormatMoney(value)) end end diff -r 6fc9fbaa94b3 -r 44e70a3fdb19 Modules/Tooltip.lua --- a/Modules/Tooltip.lua Sat Jul 03 07:28:40 2010 -0700 +++ b/Modules/Tooltip.lua Sat Jul 03 07:40:01 2010 -0700 @@ -17,9 +17,9 @@ local show = false if investedTotal > 0 then - tip:AddDoubleLine("\124cffffffffIA: Total Invested", utils:FormatMoney(investedTotal)); - tip:AddDoubleLine("\124cffffffffIA: Invested/Item (" .. count .. ")", utils:FormatMoney(ceil(investedPerItem))); - tip:AddDoubleLine("\124cffffffffIA: Minimum " .. addon:GetAHFaction() .. " AH Price: ", utils:FormatMoney(ceil(investedPerItem/keep))) + tip:AddDoubleLine("\124cffffffffIA: Total Invested", addon:FormatMoney(investedTotal)); + tip:AddDoubleLine("\124cffffffffIA: Invested/Item (" .. count .. ")", addon:FormatMoney(ceil(investedPerItem))); + tip:AddDoubleLine("\124cffffffffIA: Minimum " .. addon:GetAHFaction() .. " AH Price: ", addon:FormatMoney(ceil(investedPerItem/keep))) show = true end @@ -28,7 +28,7 @@ local groupName = QAAPI:GetItemGroup(link) if groupName then local threshold = QAAPI:GetGroupThreshold(groupName) - tip:AddDoubleLine("\124cffffffffIA: QA Threshold: ", utils:FormatMoney(threshold)) + tip:AddDoubleLine("\124cffffffffIA: QA Threshold: ", addon:FormatMoney(threshold)) show = true end end diff -r 6fc9fbaa94b3 -r 44e70a3fdb19 Modules/Utils.lua --- a/Modules/Utils.lua Sat Jul 03 07:28:40 2010 -0700 +++ b/Modules/Utils.lua Sat Jul 03 07:40:01 2010 -0700 @@ -1,8 +1,5 @@ local addonName, addonTable = ...; -local addon = {} - -local AceConsole = LibStub("AceConsole-3.0") -AceConsole:Embed(addon) +local addon = _G[addonName] addonTable.utils = addon IAUtils = addon