- Support API version 100009

Yaron Kfir [09-18-14 - 03:33]
 - Support API version 100009
 - Added optional sound notification when search is complete
Filename
Changelog
PriceTracker.lua
PriceTracker.txt
PriceTrackerMenu.lua
diff --git a/Changelog b/Changelog
index 39b8a36..414fb13 100644
--- a/Changelog
+++ b/Changelog
@@ -1,5 +1,9 @@
 Changelog

+v2.2
+ - Support API version 100009
+ - Added optional sound notification when search is complete
+
 v2.1
  - Fixed crashing error when a tabard was showing in the guild store

diff --git a/PriceTracker.lua b/PriceTracker.lua
index fd3f679..a77e8fa 100644
--- a/PriceTracker.lua
+++ b/PriceTracker.lua
@@ -47,7 +47,10 @@ function PriceTracker:OnLoad(eventCode, addOnName)
 		algorithm = self.menu.algorithmTable[1],
 		showMinMax = true,
 		showSeen = true,
+		ignoreFewItems = false,
 		keyPress = self.menu.keyTable[1],
+		isPlaySound = false,
+		playSound = 1,
 	}

 	-- Load saved settings
@@ -138,6 +141,7 @@ function PriceTracker:OnUpdateTooltip(item, tooltip)
 		if item.dataEntry and item.dataEntry.data and item.dataEntry.data.itemId then
 			itemId = item.dataEntry.data.itemId
 			level = tonumber(item.dataEntry.data.level)
+			d(itemId .. " |--| " .. level)
 		else
 			return
 		end
@@ -215,6 +219,9 @@ function PriceTracker:OnSearchResultsReceived(eventId, guildId, numItemsOnPage,
 			zo_callLater(function() SelectTradingHouseGuildId(self.currentGuild) end, self.queryDelay)
 			zo_callLater(function() ExecuteTradingHouseSearch(0, TRADING_HOUSE_SORT_SALE_PRICE, true) end, GetTradingHouseCooldownRemaining() + 1000)
 		else
+			if self.settings.isPlaySound then
+				PlaySound(self.settings.playSound)
+			end
 			self:OnTradingHouseClosed()
 		end
 	end
@@ -326,7 +333,9 @@ function PriceTracker:GetMatches(itemId, itemLevel)
 			end
 		end
 	end
-	if #matches == 0 then return nil end
+	local minSeen = 0
+	if self.settings.ignoreFewItems then minSeen = 2 end
+	if #matches <= minSeen then return nil end
 	return matches
 end

diff --git a/PriceTracker.txt b/PriceTracker.txt
index 6906665..0f55c56 100644
--- a/PriceTracker.txt
+++ b/PriceTracker.txt
@@ -1,8 +1,8 @@
 ## Title: PriceTracker
 ## Author: Barvazon
-## Version: 2.1
+## Version: 2.2
 ## SavedVariables: PriceTrackerSettings
-## APIVersion: 100008
+## APIVersion: 100009
 ## OptionalDependsOn: LibAddonMenu-2.0

 PriceTracker.xml
diff --git a/PriceTrackerMenu.lua b/PriceTrackerMenu.lua
index c25d60e..f31937d 100644
--- a/PriceTrackerMenu.lua
+++ b/PriceTrackerMenu.lua
@@ -20,6 +20,13 @@ PriceTrackerMenu.keyTable = {
 	"Command"
 }

+PriceTrackerMenu.soundTable = {
+	SOUNDS.BOOK_ACQUIRED,
+	SOUNDS.ACHIEVEMENT_AWARDED,
+	SOUNDS.FRIEND_REQUEST_ACCEPTED,
+	SOUNDS.GUILD_SELF_JOINED
+}
+
 function PriceTrackerMenu:InitAddonMenu(addOnName)
 	local panelData = {
 		type = "panel",
@@ -88,6 +95,32 @@ function PriceTrackerMenu:InitAddonMenu(addOnName)
 			setFunc = function(...) self:setLimitToGuild(...) end,
 			default = self:GetGuildList()[1]
 		},
+		[9] = {
+			type = "checkbox",
+			name = "Ignore infrequent items",
+			tooltip = "Ignore items that were seen only once or twice, as their price statistics may be inaccurate",
+			getFunc = function() return PriceTracker.settings.ignoreFewItems end,
+			setFunc = function(check) PriceTracker.settings.ignoreFewItems = check end,
+			default = false
+		},
+		[10] = {
+			type = "checkbox",
+			name = "Audible notification",
+			tooltip = "Play an audio notification when item scan is complete",
+			getFunc = function() return PriceTracker.settings.isPlaySound end,
+			setFunc = function(check) PriceTracker.settings.isPlaySound = check end,
+			default = false
+		},
+		[11] = {
+			type = "dropdown",
+			name = "Sound type",
+			tooltip = "Select which sound to play upon scan completion",
+			choices = self.soundTable,
+			getFunc = function() return PriceTracker.settings.playSound or self.soundTable[1] end,
+			setFunc = function(value) PriceTracker.settings.playSound = value end,
+			disabled = function() return not PriceTracker.settings.isPlaySound end,
+			default = self.soundTable[1]
+		},
 	}

 	local LAM2 = LibStub:GetLibrary("LibAddonMenu-2.0")