|
|
|
@ -127,6 +127,8 @@ function TSM:RegisterModule() |
|
|
|
{ key = "avgBuy", label = L["Avg Buy Price"], callback = "GetAvgBuyPrice" }, |
|
|
|
{ key = "avgBuy", label = L["Avg Buy Price"], callback = "GetAvgBuyPrice" }, |
|
|
|
{ key = "maxSell", label = L["Max Sell Price"], callback = "GetMaxSellPrice" }, |
|
|
|
{ key = "maxSell", label = L["Max Sell Price"], callback = "GetMaxSellPrice" }, |
|
|
|
{ key = "maxBuy", label = L["Max Buy Price"], callback = "GetMaxBuyPrice" }, |
|
|
|
{ key = "maxBuy", label = L["Max Buy Price"], callback = "GetMaxBuyPrice" }, |
|
|
|
|
|
|
|
{ key = "minSell", label = L["Min Sell Price"], callback = "GetMinSellPrice" }, |
|
|
|
|
|
|
|
{ key = "minBuy", label = L["Min Buy Price"], callback = "GetMinBuyPrice" }, |
|
|
|
} |
|
|
|
} |
|
|
|
TSM.tooltipOptions = { callback = "GUI:LoadTooltipOptions" } |
|
|
|
TSM.tooltipOptions = { callback = "GUI:LoadTooltipOptions" } |
|
|
|
|
|
|
|
|
|
|
|
@ -496,6 +498,22 @@ function TSM:GetMaxSellPrice(itemString) |
|
|
|
return TSM.cache[itemString].maxSellPrice |
|
|
|
return TSM.cache[itemString].maxSellPrice |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function TSM:GetMinSellPrice(itemString) |
|
|
|
|
|
|
|
itemString = TSMAPI:GetItemString(select(2, TSMAPI:GetSafeItemInfo(itemString))) |
|
|
|
|
|
|
|
if not (itemString and TSM.items[itemString] and #TSM.items[itemString].sales > 0) then return end |
|
|
|
|
|
|
|
TSM.cache[itemString] = TSM.cache[itemString] or {} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if not TSM.cache[itemString].minSellPrice then |
|
|
|
|
|
|
|
local minPrice = math.huge |
|
|
|
|
|
|
|
for _, record in ipairs(TSM.items[itemString].sales) do |
|
|
|
|
|
|
|
minPrice = min(minPrice, record.copper) |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
TSM.cache[itemString].minSellPrice = minPrice |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return TSM.cache[itemString].minSellPrice |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
function TSM:GetMaxBuyPrice(itemString) |
|
|
|
function TSM:GetMaxBuyPrice(itemString) |
|
|
|
itemString = TSMAPI:GetItemString(select(2, TSMAPI:GetSafeItemInfo(itemString))) |
|
|
|
itemString = TSMAPI:GetItemString(select(2, TSMAPI:GetSafeItemInfo(itemString))) |
|
|
|
if not (itemString and TSM.items[itemString] and #TSM.items[itemString].buys > 0) then return end |
|
|
|
if not (itemString and TSM.items[itemString] and #TSM.items[itemString].buys > 0) then return end |
|
|
|
@ -512,6 +530,22 @@ function TSM:GetMaxBuyPrice(itemString) |
|
|
|
return TSM.cache[itemString].maxBuyPrice |
|
|
|
return TSM.cache[itemString].maxBuyPrice |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function TSM:GetMinBuyPrice(itemString) |
|
|
|
|
|
|
|
itemString = TSMAPI:GetItemString(select(2, TSMAPI:GetSafeItemInfo(itemString))) |
|
|
|
|
|
|
|
if not (itemString and TSM.items[itemString] and #TSM.items[itemString].buys > 0) then return end |
|
|
|
|
|
|
|
TSM.cache[itemString] = TSM.cache[itemString] or {} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if not TSM.cache[itemString].minBuyPrice then |
|
|
|
|
|
|
|
local minPrice = math.huge |
|
|
|
|
|
|
|
for _, record in ipairs(TSM.items[itemString].buys) do |
|
|
|
|
|
|
|
minPrice = min(minPrice, record.copper) |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
TSM.cache[itemString].minBuyPrice = minPrice |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return TSM.cache[itemString].minBuyPrice |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
function TSM:Round(value, sig) |
|
|
|
function TSM:Round(value, sig) |
|
|
|
sig = sig or 1 |
|
|
|
sig = sig or 1 |
|
|
|
local gold = value / sig |
|
|
|
local gold = value / sig |
|
|
|
|