initial commit

This commit is contained in:
Gitea
2020-11-13 14:13:12 -05:00
commit 05df49ff60
368 changed files with 128754 additions and 0 deletions

View File

@@ -0,0 +1,45 @@
-- ------------------------------------------------------------------------------ --
-- TradeSkillMaster --
-- https://tradeskillmaster.com --
-- All Rights Reserved - Detailed license information included with addon. --
-- ------------------------------------------------------------------------------ --
local _, TSM = ...
local GreatDealsSearch = TSM.Shopping:NewPackage("GreatDealsSearch")
local Vararg = TSM.Include("Util.Vararg")
local ItemInfo = TSM.Include("Service.ItemInfo")
local private = {
filter = nil,
}
-- ============================================================================
-- Module Functions
-- ============================================================================
function GreatDealsSearch.OnEnable()
local appData = TSMAPI.AppHelper and TSMAPI.AppHelper:FetchData("SHOPPING_SEARCHES")
if not appData then
return
end
for _, info in pairs(appData) do
local realmName, data = unpack(info)
if TSMAPI.AppHelper:IsCurrentRealm(realmName) then
private.filter = assert(loadstring(data))().greatDeals
if private.filter == "" then
break
end
-- populate item info cache
for _, item in Vararg.Iterator(strsplit(";", private.filter)) do
item = strsplit("/", item)
ItemInfo.FetchInfo(item)
end
break
end
end
end
function GreatDealsSearch.GetFilter()
return private.filter
end