Mercurial > wow > itemauditor
changeset 13:8c83d5f6e306
OPTIONS! QuickAuctions is now an optional dependency. I have also added some configuration options for it. If you have QA but don't want IA to update your thresholds you can shut off the integration. I have also added other options so you can select your faction or the neutral AH and it will update the tooltip.
author | Asa Ayers <Asa.Ayers@Gmail.com> |
---|---|
date | Fri, 02 Jul 2010 21:39:24 -0700 |
parents | 6a6296dd249f |
children | 6fc9fbaa94b3 |
files | Core.lua ItemAuditor.toc Modules/Events.lua Modules/Options.lua Modules/Tooltip.lua |
diffstat | 5 files changed, 104 insertions(+), 69 deletions(-) [+] |
line wrap: on
line diff
--- a/Core.lua Wed Jun 30 22:59:37 2010 -0700 +++ b/Core.lua Fri Jul 02 21:39:24 2010 -0700 @@ -17,12 +17,13 @@ function addon:OnInitialize() local DB_defaults = { char = { - debug = false + debug = false, + ah = 1, + use_quick_auctions = false, }, factionrealm = { item_account = {}, items = {}, - AHCut = 0.05, }, } self.db = LibStub("AceDB-3.0"):New("ItemAuditorDB", DB_defaults, true) @@ -49,18 +50,11 @@ if self:GetItem(link).count == 0 or self:GetItem(link).invested == 0 then self:RemoveItem(link) end - -- addon:UpdateQAThreshold(link) end self:RefreshQAGroups() end -function addon:RefreshQAGroups() - for groupName in pairs(QAAPI:GetGroups()) do - self:UpdateQAGroup(groupName) - end -end - function addon:GetCurrentInventory() local i = {} local bagID @@ -254,39 +248,6 @@ end end -function addon:UpdateQAThreshold(link) - _, link= GetItemInfo(link) - - self:UpdateQAGroup(QAAPI:GetItemGroup(link)) -end - -function addon:UpdateQAGroup(groupName) - if groupName then - local threshold = 0 - - for link in pairs(QAAPI:GetItemsInGroup(groupName)) do - local _, itemCost= ItemAuditor:GetItemCost(link, 0) - - 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 AH Cut - local keep = 1 - self.db.factionrealm.AHCut - threshold = threshold/keep - - QAAPI:SetGroupThreshold(groupName, ceil(threshold)) - end -end local defaultBagDelay = 0.2
--- a/ItemAuditor.toc Wed Jun 30 22:59:37 2010 -0700 +++ b/ItemAuditor.toc Fri Jul 02 21:39:24 2010 -0700 @@ -4,7 +4,9 @@ ## Author: Asa Ayers <Asa.Ayers@Gmail.com> ## Version: 0.1 ## SavedVariables: ItemAuditorDB -## Dependencies: Altoholic, QuickAuctions +## Dependencies: Altoholic, +## OptionalDeps: QuickAuctions + embeds.xml @@ -12,6 +14,7 @@ Core.lua +Modules\QuickAuctions.lua Modules\Events.lua Modules\Tooltip.lua Modules\Options.lua
--- a/Modules/Events.lua Wed Jun 30 22:59:37 2010 -0700 +++ b/Modules/Events.lua Fri Jul 02 21:39:24 2010 -0700 @@ -8,7 +8,7 @@ self:RegisterEvent("UNIT_SPELLCAST_START") self:WatchBags() - addon:ConvertItems() + -- addon:ConvertItems() end function addon:MAIL_SHOW()
--- a/Modules/Options.lua Wed Jun 30 22:59:37 2010 -0700 +++ b/Modules/Options.lua Fri Jul 02 21:39:24 2010 -0700 @@ -3,29 +3,79 @@ local utils = addonTable.utils +local currentFaction = UnitFactionGroup("player") +local AHFactions = { currentFaction, 'Neutral' } + local options = { + handler = addon, name = "ItemAuditor", - handler = addon, type = 'group', args = { - dbg = { - type = "toggle", - name = "Debug", - desc = "Toggles debug messages in chat", - get = "GetDebug", - set = "SetDebug" + prices = { + name = "Prices", + desc = "Control how your minimum price is calculated.", + type = 'group', + args = { + auction_house = { + type = "select", + name = "Auction House", + desc = "", + values = { currentFaction, 'Neutral' }, + get = 'GetAH', + set = 'SetAH', + }, + }, }, - dump = { - type = "execute", - name = "dump", - desc = "dumps IA database", - func = "DumpInfo", + + + messages = { + name = "Messages", + desc = "Control which messages display in your chat window.", + type = 'group', + args = { + dbg = { + type = "toggle", + name = "Debug", + desc = "Toggles debug messages in chat", + get = "GetDebug", + set = "SetDebug", + order = 0, + }, + }, }, - refresh_qa = { - type = "execute", - name = "Refresh QA Thresholds", - desc = "Resets all Quick Auctions thresholds", - func = "RefreshQAGroups", + + qa_options = { + name = "QA Options", + desc = "Control how ItemAuditor integrates with QuickAuctions", + type = 'group', + -- disabled = (not addon.QA_compatibile), + disabled = function() return not ItemAuditor:IsQACompatible() end, + args = { + toggle_qa = { + type = "toggle", + name = "Enable Quick Auctions", + desc = "This will enable or disable Quick Auctions integration", + get = "IsQAEnabled", + set = "SetQAEnabled", + order = 0, + }, + --[[ + add_mail = { + type = "toggle", + name = "Add mail cost to QA Threshold", + get = "IsQAEnabled", + set = "SetQAEnabled", + order = 1, + }, + ]] + refresh_qa = { + type = "execute", + name = "Refresh QA Thresholds", + desc = "Resets all Quick Auctions thresholds", + func = "RefreshQAGroups", + disabled = 'IsQADisabled', + }, + } }, options = { type = "execute", @@ -56,6 +106,25 @@ return iter end +function addon:GetAH() + return ItemAuditor.db.char.ah +end + +function addon:SetAH(info, value) + ItemAuditor.db.char.ah = value +end + +function addon:GetAHCut() + if ItemAuditor.db.char.ah == 1 then + return 0.05 + end + return 0.15 +end + +function addon:GetAHFaction() + return AHFactions[ItemAuditor.db.char.ah] +end + function addon:DumpInfo() for itemName, value in pairsByKeys(self.db.factionrealm.item_account) do self:Print(itemName .. ": " .. utils:FormatMoney(value))
--- a/Modules/Tooltip.lua Wed Jun 30 22:59:37 2010 -0700 +++ b/Modules/Tooltip.lua Fri Jul 02 21:39:24 2010 -0700 @@ -13,22 +13,24 @@ local investedTotal, investedPerItem, count = ItemAuditor:GetItemCost(link) - local AHCut = ItemAuditor.db.factionrealm.AHCut - local keep = 1 - AHCut + local keep = 1 - addon:GetAHCut() 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))) + tip:AddDoubleLine("\124cffffffffIA: Minimum " .. addon:GetAHFaction() .. " 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 + + if addon:IsQAEnabled() then + local groupName = QAAPI:GetItemGroup(link) + if groupName then + local threshold = QAAPI:GetGroupThreshold(groupName) + tip:AddDoubleLine("\124cffffffffIA: QA Threshold: ", utils:FormatMoney(threshold)) + show = true + end end if show then