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:
RSS90
2024-05-03 18:20:54 +02:00
committed by GitHub
parent 5333f3b37a
commit acc582c1b7
3 changed files with 50 additions and 4 deletions
+46
View File
@@ -725,3 +725,49 @@ function TSMAPI:BulkQuery(items)
end end
end) 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
+2 -2
View File
@@ -420,7 +420,7 @@ local function GetItemSubClass(str, class)
end end
local function GetItemRarity(str) local function GetItemRarity(str)
for i=0, 4 do for i=0, 7 do
local text = _G["ITEM_QUALITY"..i.."_DESC"] local text = _G["ITEM_QUALITY"..i.."_DESC"]
if strlower(str) == strlower(text) then if strlower(str) == strlower(text) then
return i return i
@@ -586,4 +586,4 @@ end
function Search:GetCurrentSearchMode() function Search:GetCurrentSearchMode()
return private.mode return private.mode
end end
@@ -106,7 +106,7 @@ function private.Create(parent)
-- row 6 - rarity -- row 6 - rarity
y = y + 60 y = y + 60
local rarityList = {} 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, "") local rarityDropdown = TSMAPI.GUI:CreateDropdown(frame, rarityList, "")
rarityDropdown:SetLabel(L["Minimum Rarity"]) rarityDropdown:SetLabel(L["Minimum Rarity"])
rarityDropdown:SetPoint("TOPLEFT", 5, -y) rarityDropdown:SetPoint("TOPLEFT", 5, -y)
@@ -236,4 +236,4 @@ end
do do
TSM:AddSidebarFeature(L["Custom Filter"], private.Create) TSM:AddSidebarFeature(L["Custom Filter"], private.Create)
end end