diff --git a/Changelog b/Changelog
index 593d0d6..616d019 100644
--- a/Changelog
+++ b/Changelog
@@ -1,5 +1,11 @@
Changelog
+v1.1
+ - Added some color
+ - Added price info to enchanting tooltip
+ - Added option to hide pricing info unless a key is pressed
+
+
v1.0
- Doing some housekeeping and removing items that cannot be parsed, in order to avoid errors when trying to calculate suggested price
diff --git a/PriceTracker.lua b/PriceTracker.lua
index 4895223..520c43c 100644
--- a/PriceTracker.lua
+++ b/PriceTracker.lua
@@ -8,7 +8,12 @@ PriceTracker = {
settingsVersion = 0.2,
icons = {
gold = "EsoUI/Art/currency/currency_gold.dds"
- }
+ },
+ colors = {
+ default = "|c" .. ZO_TOOLTIP_DEFAULT_COLOR:ToHex(),
+ title = "|c00B5FF",
+ },
+ selectedItem = {},
}
local PriceTracker = PriceTracker
@@ -19,8 +24,10 @@ function PriceTracker:OnLoad(eventCode, addOnName)
EVENT_MANAGER:RegisterForEvent("OnSearchResultsReceived", EVENT_TRADING_HOUSE_SEARCH_RESULTS_RECEIVED, function(...) self:OnSearchResultsReceived(...) end)
EVENT_MANAGER:RegisterForEvent("OnTradingHouseClosed", EVENT_CLOSE_TRADING_HOUSE, function(...) self:OnTradingHouseClosed(...) end)
- ZO_PreHookHandler(ItemTooltip, "OnUpdate", function() self:OnUpdateTooltip(moc()) end)
- ZO_PreHookHandler(ItemTooltip, "OnHide", function() self:OnHideTooltip() end)
+ ZO_PreHookHandler(ItemTooltip, "OnUpdate", function() self:OnUpdateTooltip(moc(), ItemTooltip) end)
+ ZO_PreHookHandler(ItemTooltip, "OnHide", function() self:OnHideTooltip(ItemTooltip) end)
+
+ PriceTracker.enchantingTable:OnLoad(eventCode, addOnName)
SLASH_COMMANDS["/pt"] = function(...) self:CommandHandler(...) end
SLASH_COMMANDS["/pricetracker"] = function(...) self:CommandHandler(...) end
@@ -29,7 +36,8 @@ function PriceTracker:OnLoad(eventCode, addOnName)
itemList = {},
algorithm = self.menu.algorithmTable[1],
showMinMax = true,
- showSeen = true
+ showSeen = true,
+ keyPress = self.menu.keyTable[1],
}
-- Load saved settings
@@ -91,9 +99,10 @@ function PriceTracker:Housekeeping()
end
end
-function PriceTracker:OnUpdateTooltip(item)
- if not item or not item.dataEntry or not item.dataEntry.data or self.selectedItem == item then return end
- self.selectedItem = item
+function PriceTracker:OnUpdateTooltip(item, tooltip)
+ if not tooltip then tooltip = ItemTooltip end
+ if not item or not item.dataEntry or not item.dataEntry.data or not self.menu:IsKeyPressed() or self.selectedItem[tooltip] == item then return end
+ self.selectedItem[tooltip] = item
local stackCount = item.dataEntry.data.stackCount or item.dataEntry.data.stack
if not stackCount then return end
@@ -103,28 +112,28 @@ function PriceTracker:OnUpdateTooltip(item)
local item = self:SuggestPrice(matches)
if not item then return end
- ZO_Tooltip_AddDivider(ItemTooltip)
- ItemTooltip:AddLine("Price Tracker", "ZoFontHeader2")
+ ZO_Tooltip_AddDivider(tooltip)
+ tooltip:AddLine("Price Tracker", "ZoFontHeader2")
local r, g, b = ZO_TOOLTIP_DEFAULT_COLOR:UnpackRGB()
- ItemTooltip:AddLine(self:FormatTooltipLine("Suggested price:", math.floor(item.purchasePrice / item.stackCount)), "ZoFontGame", r, g, b, CENTER, MODIFY_TEXT_TYPE_NONE, CENTER, true)
+ tooltip:AddLine(self:FormatTooltipLine("Suggested price:", math.floor(item.purchasePrice / item.stackCount)), "ZoFontGame", r, g, b, CENTER, MODIFY_TEXT_TYPE_NONE, CENTER, true)
if stackCount > 1 then
- ItemTooltip:AddLine(self:FormatTooltipLine("Stack price:", math.floor(item.purchasePrice / item.stackCount * stackCount)), "ZoFontGame", r, g, b, CENTER, MODIFY_TEXT_TYPE_NONE, CENTER, true)
+ tooltip:AddLine(self:FormatTooltipLine("Stack price:", math.floor(item.purchasePrice / item.stackCount * stackCount)), "ZoFontGame", r, g, b, CENTER, MODIFY_TEXT_TYPE_NONE, CENTER, true)
end
if self.settings.showMinMax then
local minItem = self.mathUtils:Min(matches)
local maxItem = self.mathUtils:Max(matches)
local minPrice = math.floor(minItem.purchasePrice / minItem.stackCount)
local maxPrice = math.floor(maxItem.purchasePrice / maxItem.stackCount)
- ItemTooltip:AddLine(self:FormatTooltipLine("Min (each / stack):", minPrice, minPrice * stackCount, minItem.guildName), "ZoFontGame", r, g, b, CENTER, MODIFY_TEXT_TYPE_NONE, CENTER, true)
- ItemTooltip:AddLine(self:FormatTooltipLine("Max (each / stack):", maxPrice, maxPrice * stackCount, maxItem.guildName), "ZoFontGame", r, g, b, CENTER, MODIFY_TEXT_TYPE_NONE, CENTER, true)
+ tooltip:AddLine(self:FormatTooltipLine("Min (each / stack):", minPrice, minPrice * stackCount, minItem.guildName), "ZoFontGame", r, g, b, CENTER, MODIFY_TEXT_TYPE_NONE, CENTER, true)
+ tooltip:AddLine(self:FormatTooltipLine("Max (each / stack):", maxPrice, maxPrice * stackCount, maxItem.guildName), "ZoFontGame", r, g, b, CENTER, MODIFY_TEXT_TYPE_NONE, CENTER, true)
end
if self.settings.showSeen then
- ItemTooltip:AddLine("Seen " .. #matches .. " times", "ZoFontGame", r, g, b, CENTER, MODIFY_TEXT_TYPE_NONE, CENTER, false)
+ tooltip:AddLine("Seen " .. #matches .. " times", "ZoFontGame", r, g, b, CENTER, MODIFY_TEXT_TYPE_NONE, CENTER, false)
end
end
-function PriceTracker:OnHideTooltip()
- self.selectedItem = nil
+function PriceTracker:OnHideTooltip(tooltip)
+ self.selectedItem[tooltip] = nil
end
function PriceTracker:OnScanPrices()
diff --git a/PriceTracker.txt b/PriceTracker.txt
index 3fa5076..e9bcd4a 100644
--- a/PriceTracker.txt
+++ b/PriceTracker.txt
@@ -8,6 +8,7 @@
PriceTracker.xml
PriceTracker.lua
PriceTrackerMenu.lua
+PriceTrackerEnchantingTable.lua
MathUtils.lua
lib/LibStub/LibStub.lua
lib/LibAddonMenu-1.0/LibAddonMenu-1.0
\ No newline at end of file
diff --git a/PriceTrackerEnchantingTable.lua b/PriceTrackerEnchantingTable.lua
new file mode 100644
index 0000000..2d69c85
--- /dev/null
+++ b/PriceTrackerEnchantingTable.lua
@@ -0,0 +1,63 @@
+if not PriceTracker then
+ return
+end
+
+local PriceTracker = PriceTracker
+local PriceTrackerEnchantingTable = {}
+PriceTracker.enchantingTable = PriceTrackerEnchantingTable
+
+PriceTrackerEnchantingTable.enchanting = ENCHANTING
+PriceTrackerEnchantingTable.enchantingRunes = {
+ potency = {
+ bagId = nil,
+ itemIndex = nil
+ },
+ essence = {
+ bagId = nil,
+ itemIndex = nil
+ },
+ aspect = {
+ bagId = nil,
+ itemIndex = nil
+ }
+}
+
+function PriceTrackerEnchantingTable:OnLoad(eventCode, addOnName)
+ if(addOnName ~= "PriceTracker") then return end
+
+ ZO_PreHookHandler(self.enchanting.runeSlots[1].control, "OnUpdate", function() self:OnUpdateEnchantingRune(self.enchanting.runeSlots[1], "aspect") end)
+ ZO_PreHookHandler(self.enchanting.runeSlots[2].control, "OnUpdate", function() self:OnUpdateEnchantingRune(self.enchanting.runeSlots[2], "essence") end)
+ ZO_PreHookHandler(self.enchanting.runeSlots[3].control, "OnUpdate", function() self:OnUpdateEnchantingRune(self.enchanting.runeSlots[3], "potency") end)
+ ZO_PreHookHandler(self.enchanting.resultTooltip, "OnHide", function() self:OnHideTooltip(self.enchanting.resultTooltip) end)
+end
+
+function PriceTrackerEnchantingTable:OnUpdateEnchantingRune(rune, runeType)
+ if rune.bagId == self.enchantingRunes[runeType].bagId and rune.slotIndex == self.enchantingRunes[runeType].itemIndex then return end
+
+ self.enchantingRunes[runeType].bagId = rune.bagId
+ self.enchantingRunes[runeType].itemIndex = rune.slotIndex
+ self:UpdateEnchantingTooltip()
+end
+
+function PriceTrackerEnchantingTable:UpdateEnchantingTooltip()
+ if not self.enchantingRunes.potency.bagId or not self.enchantingRunes.potency.itemIndex or
+ not self.enchantingRunes.essence.bagId or not self.enchantingRunes.essence.itemIndex or
+ not self.enchantingRunes.aspect.bagId or not self.enchantingRunes.aspect.itemIndex then return end
+ local name, icon, stack, sellPrice, meetsUsageRequirement, quality =
+ GetEnchantingResultingItemInfo(self.enchantingRunes.potency.bagId, self.enchantingRunes.potency.itemIndex,
+ self.enchantingRunes.essence.bagId, self.enchantingRunes.essence.itemIndex,
+ self.enchantingRunes.aspect.bagId, self.enchantingRunes.aspect.itemIndex)
+ local item = {
+ dataEntry = {
+ data = {
+ name = PriceTracker:NormalizeName(name),
+ stackCount = 1,
+ purchasePrice = sellPrice
+ }
+ }
+ }
+ if(meetsUsageRequirement) then
+ PriceTracker:OnUpdateTooltip(item, self.enchanting.resultTooltip)
+ end
+end
+
diff --git a/PriceTrackerMenu.lua b/PriceTrackerMenu.lua
index 793de94..ba8f33b 100644
--- a/PriceTrackerMenu.lua
+++ b/PriceTrackerMenu.lua
@@ -2,6 +2,7 @@ if not PriceTracker then
return
end
+local PriceTracker = PriceTracker
local PriceTrackerMenu = {}
PriceTracker.menu = PriceTrackerMenu
@@ -11,9 +12,17 @@ PriceTrackerMenu.algorithmTable = {
"Most Frequently Used"
}
+PriceTrackerMenu.keyTable = {
+ "None",
+ "Shift",
+ "Control",
+ "Alt",
+ "Command"
+}
+
function PriceTrackerMenu:InitAddonMenu(addOnName)
local LAM = LibStub:GetLibrary("LibAddonMenu-1.0")
- local addOnMenu = LAM:CreateControlPanel("PriceTrackerMenu", addOnName)
+ local addOnMenu = LAM:CreateControlPanel("PriceTrackerMenu", PriceTracker.colors.title .. addOnName)
-- Ensure compatibility
if PriceTracker.settings.showMinMax == nil then
@@ -35,4 +44,17 @@ function PriceTrackerMenu:InitAddonMenu(addOnName)
LAM:AddCheckbox(addOnMenu, addOnName .. "Seen", "Show 'Seen'", "Show how many times an item was seen in the guild stores",
function() return PriceTracker.settings.showSeen end,
function(check) PriceTracker.settings.showSeen = check end)
+ LAM:AddDropdown(addOnMenu, addOnName .. "KeyPress", "Show only if key is pressed",
+ "Show pricing on tooltip only if one of the following keys is pressed. This is useful if you have too many addons modifying your tooltips.",
+ self.keyTable,
+ function() return PriceTracker.settings.keyPress or self.keyTable[1] end,
+ function(key) PriceTracker.settings.keyPress = key end)
+end
+
+function PriceTrackerMenu:IsKeyPressed()
+ return PriceTracker.settings.keyPress == self.keyTable[1] or
+ (PriceTracker.settings.keyPress == self.keyTable[2] and IsShiftKeyDown()) or
+ (PriceTracker.settings.keyPress == self.keyTable[3] and IsControlKeyDown()) or
+ (PriceTracker.settings.keyPress == self.keyTable[4] and IsAltKeyDown()) or
+ (PriceTracker.settings.keyPress == self.keyTable[5] and IsCommandKeyDown())
end