TSMAPI extension + support for Vanity Item search (#14)
* GetItemPrice TSMAPI-Extension * Itemfilter Vanity Item Support * Rarity search extended up to heirloom * Rarity search extended up to heirloom
This commit is contained in:
@@ -725,3 +725,49 @@ function TSMAPI:BulkQuery(items)
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
-- GetItemPrice TSMAPI-Extension
|
||||
function TSMAPI:GetItemPrices(itemLink)
|
||||
if not itemLink then return nil end
|
||||
|
||||
local prices = {}
|
||||
|
||||
-- Get ItemString from ItemLink
|
||||
local itemString = TSMAPI:GetItemString(itemLink)
|
||||
if not itemString then return nil end
|
||||
|
||||
-- Use TSM:GetCustomPrice to get DBMarket price
|
||||
prices.DBMarket = TSM:GetCustomPrice("DBMarket", itemString) or 0
|
||||
|
||||
-- Use TSM:GetCustomPrice to get DBMinBuyout price
|
||||
prices.DBMinBuyout = TSM:GetCustomPrice("DBMinBuyout", itemString) or 0
|
||||
|
||||
-- Use TSM:GetCustomPrice to get avgBuy price
|
||||
prices.avgBuy = TSM:GetCustomPrice("avgBuy", itemString) or 0
|
||||
|
||||
-- Use TSM:GetCustomPrice to get avgSell price
|
||||
prices.avgSell = TSM:GetCustomPrice("avgSell", itemString) or 0
|
||||
|
||||
-- Use TSM:GetCustomPrice to get maxBuy price
|
||||
prices.maxBuy = TSM:GetCustomPrice("maxBuy", itemString) or 0
|
||||
|
||||
-- Use TSM:GetCustomPrice to get maxSell price
|
||||
prices.maxSell = TSM:GetCustomPrice("maxSell", itemString) or 0
|
||||
|
||||
-- Use TSM:GetCustomPrice to get minBuy price
|
||||
prices.minBuy = TSM:GetCustomPrice("minBuy", itemString) or 0
|
||||
|
||||
-- Use TSM:GetCustomPrice to get minSell price
|
||||
prices.minSell = TSM:GetCustomPrice("minSell", itemString) or 0
|
||||
|
||||
-- Use TSM:GetCustomPrice to get Disenchant price
|
||||
prices.Disenchant = TSM:GetCustomPrice("Disenchant", itemString) or 0
|
||||
|
||||
-- Use TSM:GetCustomPrice to get vendorBuy price
|
||||
prices.vendorBuy = TSM:GetCustomPrice("vendorBuy", itemString) or 0
|
||||
|
||||
-- Use TSM:GetCustomPrice to get vendorSell price
|
||||
prices.vendorSell = TSM:GetCustomPrice("vendorSell", itemString) or 0
|
||||
|
||||
return prices
|
||||
end
|
||||
|
||||
@@ -420,7 +420,7 @@ local function GetItemSubClass(str, class)
|
||||
end
|
||||
|
||||
local function GetItemRarity(str)
|
||||
for i=0, 4 do
|
||||
for i=0, 7 do
|
||||
local text = _G["ITEM_QUALITY"..i.."_DESC"]
|
||||
if strlower(str) == strlower(text) then
|
||||
return i
|
||||
@@ -586,4 +586,4 @@ end
|
||||
|
||||
function Search:GetCurrentSearchMode()
|
||||
return private.mode
|
||||
end
|
||||
end
|
||||
|
||||
@@ -106,7 +106,7 @@ function private.Create(parent)
|
||||
-- row 6 - rarity
|
||||
y = y + 60
|
||||
local rarityList = {}
|
||||
for i = 1, 4 do tinsert(rarityList, _G["ITEM_QUALITY"..i.."_DESC"]) end
|
||||
for i = 1, 7 do tinsert(rarityList, _G["ITEM_QUALITY"..i.."_DESC"]) end
|
||||
local rarityDropdown = TSMAPI.GUI:CreateDropdown(frame, rarityList, "")
|
||||
rarityDropdown:SetLabel(L["Minimum Rarity"])
|
||||
rarityDropdown:SetPoint("TOPLEFT", 5, -y)
|
||||
@@ -236,4 +236,4 @@ end
|
||||
|
||||
do
|
||||
TSM:AddSidebarFeature(L["Custom Filter"], private.Create)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user