changeset 117:e16cd6ed3ba3 Release 2010-09-02

Merged: Fixed a bug introduced in r110 (2010-08-30) where the price an item should sell for was not being calculated.
author Asa Ayers <Asa.Ayers@Gmail.com>
date Thu, 02 Sep 2010 11:49:28 -0700
parents 79dc87430cb3 (diff) 44be3f350c9e (current diff)
children 92b66533c386
files CHANGELOG.txt
diffstat 7 files changed, 101 insertions(+), 22 deletions(-) [+]
line wrap: on
line diff
--- a/.hgtags	Thu Sep 02 11:45:47 2010 -0700
+++ b/.hgtags	Thu Sep 02 11:49:28 2010 -0700
@@ -7,3 +7,4 @@
 e9f7bc9199ca366a36c27ef4811c4e23e92d3a2a release 2010-08-05
 210bcf2185096dad0d964787268de0b71c9e1834 release 2010-08-06
 1f410255ebd81ac1b841008f393266d6755624a7 release 2010-08-20
+52e8cad9ccc443ea05776ebc362c0fbdef2939d5 Release 2010-09-01
--- a/CHANGELOG.txt	Thu Sep 02 11:45:47 2010 -0700
+++ b/CHANGELOG.txt	Thu Sep 02 11:49:28 2010 -0700
@@ -1,10 +1,16 @@
 2010-09-02  Asa Ayers  <Asa.Ayers@Gmail.com>
 
-- Fixed a bug introduced in r110 (2010-08-30) where the price an item should sell for was not being calculated.
+- Updated the ArkInventory rule and tooltip to work in QA is compatible instead of if its enabled in ItemAuditor.
+
+2010-09-01  Asa Ayers  <Asa.Ayers@Gmail.com>
+
+- Made some changes to begin migrating some QA functionality to QAManager (http://www.wowace.com/addons/qa-manager/)
+- Ticket 35 - I found a better solution to prevent bag scanning from interfering with mailing, so both can be done at the same time now.
 
 2010-08-30  Asa Ayers  <Asa.Ayers@Gmail.com>
 
 - Updated Total Cost in /ia crafting to include the AH cut based on the price column. This will also reduce the profit column to consider the additional cost.
+- Added an absolute Auction Threshold option. This will allow you to set your threshold at 10g (or whatever you choose) over your cost for all items.
 
 2010-08-27  Asa Ayers  <Asa.Ayers@Gmail.com>
 
--- a/Core.lua	Thu Sep 02 11:45:47 2010 -0700
+++ b/Core.lua	Thu Sep 02 11:49:28 2010 -0700
@@ -48,6 +48,7 @@
 		use_quick_auctions = false,
 		profitable_threshold = 10000,
 		auction_threshold = 0.15,
+		auction_threshold_value = 0,
 		qa_extra = 0,
 		output_chat_frame = nil,
 		cod_warnings = true,
@@ -99,6 +100,8 @@
 		self.db.char.crafting_threshold = nil
 	end
 
+	ItemAuditor:IsQACompatible()
+
 	--@debug@
 		-- ItemAuditor_DebugFrame:Show()
 		-- self:CreateFrame('tab_crafting')
@@ -506,6 +509,7 @@
 	
 	if realLink ~= nil then
 		ItemAuditor:UpdateQAThreshold(realLink)
+		self:SendMessage("IA_COST_CHANGED", realLink, unpack({ItemAuditor:GetItemCost(realLink)}))
 	end
 	UpdateInvestedData()
 end
--- a/Modules/ArkInventoryRules.lua	Thu Sep 02 11:45:47 2010 -0700
+++ b/Modules/ArkInventoryRules.lua	Thu Sep 02 11:49:28 2010 -0700
@@ -53,7 +53,7 @@
 				end
 				return false
 			elseif string.lower( strtrim( arg ) ) == 'qa' then
-				if ItemAuditor:IsQAEnabled() then
+				if ItemAuditor:IsQACompatible() then
 					local groupName = QAAPI:GetItemGroup(link)
 					if groupName then
 						return true
--- a/Modules/Events.lua	Thu Sep 02 11:45:47 2010 -0700
+++ b/Modules/Events.lua	Thu Sep 02 11:49:28 2010 -0700
@@ -24,7 +24,7 @@
  
  function ItemAuditor:MAIL_SHOW()
 	self:Debug("MAIL_SHOW")
-	self:UnwatchBags()
+	self.mailOpen = true
 	ItemAuditor:UpdateCurrentInventory()
 	self.lastMailScan = self:ScanMail()
 	
@@ -187,7 +187,7 @@
 	self:MAIL_INBOX_UPDATE()
 	self:UnregisterEvent("MAIL_INBOX_UPDATE")
 	self:RegisterEvent("MAIL_SHOW")
-	self:WatchBags()
+	self.mailOpen = nil
 end
 
 local storedCountDiff
@@ -310,7 +310,7 @@
 		]]
 	elseif diff.money > 0 and self:tcount(positive) > 0 and self:tcount(negative) == 0 then
 		self:Debug("loot")
-	elseif abs(diff.money) > 0 and self:tcount(diff.items) == 1 then
+	elseif abs(diff.money) > 0 and self:tcount(diff.items) == 1 and not self.mailOpen then
 		self:Debug("purchase or sale")
 		
 		for link, count in pairs(diff.items) do
--- a/Modules/QuickAuctions.lua	Thu Sep 02 11:45:47 2010 -0700
+++ b/Modules/QuickAuctions.lua	Thu Sep 02 11:49:28 2010 -0700
@@ -27,6 +27,25 @@
 
 
 function ItemAuditor:IsQACompatible()
+	local qam = GetAddOnInfo('QAManager')
+	if qam then
+		ItemAuditor.Options.args.qa_options.disabled = true
+		if ItemAuditor.db.char.use_quick_auctions then
+			ItemAuditor.db.char.use_quick_auctions = false
+			StaticPopupDialogs["ItemAuditor_QAOptionsReplaced"] = {
+				text = "The ability to have ItemAuditor adjust your QA thresholds is being moved to QAManager. If you have to use the options within ItemAuditor you can disable QAManager to restore them for now, but this option will change in the future.",
+				button1 = "OK",
+				timeout = 0,
+				whileDead = true,
+				hideOnEscape = true,
+				OnAccept = function()
+					-- StaticPopupDialogs["ItemAuditor_QAOptionsReplaced"] = nil
+				end,
+			}
+			StaticPopup_Show('ItemAuditor_QAOptionsReplaced')
+		end
+		return false
+	 end
 	return (QAAPI ~= nil and QAAPI.GetGroupConfig ~= nil)
 end
 
@@ -67,7 +86,9 @@
 	
 	-- add my minimum profit margin
 	-- GetAuctionThreshold returns a percent as a whole number. This will convert 25 to 1.25
-	copper = copper *  (1+ItemAuditor:GetAuctionThreshold())
+	local min_by_percent = copper *  (1+ItemAuditor:GetAuctionThreshold())
+	local min_by_value = copper + ItemAuditor.db.char.auction_threshold_value
+	copper = max(min_by_percent, min_by_value)
 	
 	-- add AH Cut
 	local keep = 1 - ItemAuditor:GetAHCut()
@@ -118,7 +139,27 @@
 	end
 	return 0
 end
-Crafting.RegisterCraftingDecider('IA QuickAuctions', isProfitable)
+
+local QADeciderOptions = {
+	extra = {
+		type = "range",
+		name = "Create Extra",
+		desc = "This is the amount of an item that should be created above what you sell in one post in QuickAuctions."..
+			"If you sell 4 stacks of 5 of an item and your extra is 25%, it will queue enough for you to have 25 of that item.",
+		min = 0.0,
+		max = 1.0,
+		step = 0.01,
+		isPercent = true,
+		get = function() return ItemAuditor.db.char.qa_extra end,
+		set = function(info, value)
+			ItemAuditor.db.char.qa_extra = value
+		end,
+		handler = ItemAuditor,
+		disabled = 'IsQACompatible',
+		order = 10,
+	},
+}
+Crafting.RegisterCraftingDecider('IA QuickAuctions', isProfitable, QADeciderOptions)
 
 
 function ItemAuditor:Queue()
@@ -197,35 +238,62 @@
 			set = "SetQAEnabled",
 			order = 0,
 		},
+		enable_percent = {
+			type = "toggle",
+			name = "Use percent to calculate threshold.",
+			get = function() return ItemAuditor.db.char.auction_threshold > 0 end,
+			set = function(info, value)
+				value = value and 0.15 or 0
+				ItemAuditor.db.char.auction_threshold = value
+			end,
+			order = 1,
+		},
 		auction_threshold = {
 			type = "range",
 			name = "Auction Threshold",
-			desc = "Don't create items that will make less than this amount of profit",
+			desc = "Don't sell items for less than this amount of profit.",
 			min = 0.0,
 			max = 1.0,
 			isPercent = true,
+			hidden = function() return ItemAuditor.db.char.auction_threshold == 0 end,
 			get = function() return ItemAuditor.db.char.auction_threshold end,
 			set = function(info, value)
 				ItemAuditor.db.char.auction_threshold = value
 				-- ItemAuditor:RefreshQAGroups()
 			end,
 			disabled = 'IsQADisabled',
-			order = 1,
+			order = 2,
 		},
-		extra = {
-			type = "range",
-			name = "Create Extra",
-			desc = "This is the amount of an item that should be created above what you sell in one post in QuickAuctions."..
-				"If you sell 4 stacks of 5 of an item and your extra is 25%, it will queue enough for you to have 25 of that item.",
-			min = 0.0,
-			max = 1.0,
-			isPercent = true,
-			get = function() return ItemAuditor.db.char.qa_extra end,
+		enable_absolute = {
+			type = "toggle",
+			name = "Use value to calculate threshold.",
+			get = function() return ItemAuditor.db.char.auction_threshold_value > 0 end,
 			set = function(info, value)
-				ItemAuditor.db.char.qa_extra = value
+				value = value and 100000 or 0
+				ItemAuditor.db.char.auction_threshold_value = value
 			end,
+			order = 3,
+		},
+		auction_threshold_absolute = {
+			type = "input",
+			name = "Auction Threshold",
+			desc = "Don't sell items for less than this amount of profit.",
+			hidden = function() return ItemAuditor.db.char.auction_threshold_value == 0 end,
+			get = function() return
+				Utils.FormatMoney(ItemAuditor.db.char.auction_threshold_value , '', true)
+			end,
+			validate = function(info, value)
+				if not Utils.validateMoney(value) then
+					return "Invalid money format"
+				end
+				return true
+			end,
+			set = function(info, value)
+				ItemAuditor.db.char.auction_threshold_value = Utils.parseMoney(value)
+			end,
+			usage = "###g ##s ##c",
 			disabled = 'IsQADisabled',
-			order = 1,
+			order = 4,
 		},
 		refresh_qa = {
 			type = "execute",
@@ -233,7 +301,7 @@
 			desc = "Resets all Quick Auctions thresholds",
 			func = "RefreshQAGroups",
 			disabled = 'IsQADisabled',
-			order = 9,
+			order = 15,
 		},
 	}
 }
--- a/Modules/Tooltip.lua	Thu Sep 02 11:45:47 2010 -0700
+++ b/Modules/Tooltip.lua	Thu Sep 02 11:49:28 2010 -0700
@@ -33,7 +33,7 @@
 		
 	end
 	
-	if ItemAuditor:IsQAEnabled() then
+	if ItemAuditor:IsQACompatible() then
 		local groupName = QAAPI:GetItemGroup(link)
 		if groupName then
 			local threshold = QAAPI:GetGroupConfig(groupName)