Mercurial > wow > itemauditor
changeset 12:6a6296dd249f
Removed dependency on DevTools, completed chaning over the database to use links instead of names, Added integration with my version of QuickAuctions3 (I need to make this optional soon)
| author | Asa Ayers <Asa.Ayers@Gmail.com> |
|---|---|
| date | Wed, 30 Jun 2010 22:59:37 -0700 |
| parents | 03e2d9edc344 |
| children | 8c83d5f6e306 |
| files | Core.lua ItemAuditor.toc Modules/Options.lua Modules/Tooltip.lua |
| diffstat | 4 files changed, 52 insertions(+), 31 deletions(-) [+] |
line wrap: on
line diff
--- a/Core.lua Wed Jun 30 22:56:06 2010 -0700 +++ b/Core.lua Wed Jun 30 22:59:37 2010 -0700 @@ -52,6 +52,10 @@ -- addon:UpdateQAThreshold(link) end + self:RefreshQAGroups() +end + +function addon:RefreshQAGroups() for groupName in pairs(QAAPI:GetGroups()) do self:UpdateQAGroup(groupName) end @@ -118,8 +122,10 @@ results[mailType] = (results[mailType] or {}) - if mailType == "NonAHMail" and msgCOD > 0 then + if mailType == "NonAHMail" then --[[ + and msgCOD > 0 + mailType = 'COD' results[mailType] = (results[mailType] or {}) @@ -170,14 +176,16 @@ local itemName = nil if self:GetSafeLink(link) == nil then itemName = link + link = self:GetSafeLink(link) else link = self:GetSafeLink(link) itemName = GetItemInfo(link) end + if self.db.factionrealm.item_account[itemName] ~= nil then self.items[link] = { - count = Altoholic:GetItemCount(utils:GetIDFromLink(link)), + count = Altoholic:GetItemCount(self:GetIDFromLink(link)), invested = abs(self.db.factionrealm.item_account[itemName] or 0), } self.db.factionrealm.item_account[itemName] = nil @@ -211,13 +219,7 @@ self.items[link] = nil end end ---[[ -ItemAuditor:SaveValue('Scroll of Enchant Weapon - Exceptional Spellpower', 1) - DevTools_Dump(ItemAuditor.db.factionrealm.item_account) - - = ItemAuditor:GetItem('Scroll of Enchant Weapon - Exceptional Spellpower', true).invested -]] function addon:SaveValue(link, value) local item = nil local realLink = self:GetSafeLink(link) @@ -234,24 +236,24 @@ if abs(value) > 0 then self:Debug("Updated price of " .. itemName .. " to " .. utils:FormatMoney(item.invested) .. "(change: " .. utils:FormatMoney(value) .. ")") - end - - if abs(value) > 0 and item.invested <= 0 then - self:Debug("Updated price of " .. itemName .. " to " .. utils:FormatMoney(0)) - self:RemoveItem(link) - elseif item.count == 0 and ItemAuditor:GetCurrentInventory() > 0 then - self:Print("You ran out of " .. itemName .. " and never recovered " .. utils:FormatMoney(item.invested)) - self:RemoveItem(link) + + if item.invested <= 0 then + self:Debug("Updated price of " .. itemName .. " to " .. utils: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:RemoveItem(link) + ]] + end end if realLink ~= nil then addon:UpdateQAThreshold(realLink) end end ---[[ - - ItemAuditor:UpdateQAThreshold("item:42646") -]] + function addon:UpdateQAThreshold(link) _, link= GetItemInfo(link) @@ -260,22 +262,24 @@ function addon:UpdateQAGroup(groupName) if groupName then - local threshold = 10000 + local threshold = 0 for link in pairs(QAAPI:GetItemsInGroup(groupName)) do - local totalCost, itemCost, itemCount = ItemAuditor:GetItemCost(link, 0) + local _, itemCost= ItemAuditor:GetItemCost(link, 0) - if itemCost > threshold then - threshold = itemCost - end + threshold = max(threshold, itemCost) end + if threshold == 0 then + threshold = 10000 + end + + -- add my minimum profit margin + threshold = threshold * 1.10 + -- Adding the cost of mailing every item once. threshold = threshold + 30 - -- add my minimum profit margin 15% - threshold = threshold * 1.15 - -- add AH Cut local keep = 1 - self.db.factionrealm.AHCut threshold = threshold/keep
--- a/ItemAuditor.toc Wed Jun 30 22:56:06 2010 -0700 +++ b/ItemAuditor.toc Wed Jun 30 22:59:37 2010 -0700 @@ -4,7 +4,7 @@ ## Author: Asa Ayers <Asa.Ayers@Gmail.com> ## Version: 0.1 ## SavedVariables: ItemAuditorDB -## Dependencies: Altoholic, DevTools, QuickAuctions +## Dependencies: Altoholic, QuickAuctions embeds.xml
--- a/Modules/Options.lua Wed Jun 30 22:56:06 2010 -0700 +++ b/Modules/Options.lua Wed Jun 30 22:59:37 2010 -0700 @@ -8,11 +8,10 @@ handler = addon, type = 'group', args = { - debug = { + dbg = { type = "toggle", name = "Debug", desc = "Toggles debug messages in chat", - handler = utils, get = "GetDebug", set = "SetDebug" }, @@ -22,6 +21,12 @@ desc = "dumps IA database", func = "DumpInfo", }, + refresh_qa = { + type = "execute", + name = "Refresh QA Thresholds", + desc = "Resets all Quick Auctions thresholds", + func = "RefreshQAGroups", + }, options = { type = "execute", name = "options",
--- a/Modules/Tooltip.lua Wed Jun 30 22:56:06 2010 -0700 +++ b/Modules/Tooltip.lua Wed Jun 30 22:59:37 2010 -0700 @@ -15,11 +15,23 @@ local AHCut = ItemAuditor.db.factionrealm.AHCut local keep = 1 - AHCut + 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 faction AH Price: ", utils:FormatMoney(ceil(investedPerItem/keep))) + show = true + + end + local groupName = QAAPI:GetItemGroup(link) + if groupName then + local threshold = QAAPI:GetGroupThreshold(groupName) + tip:AddDoubleLine("\124cffffffffIA: QA Threshold: ", utils:FormatMoney(threshold)) + show = true + end + + if show then tip:Show() end end
