diff --git a/api.lua b/api.lua index 695709e..633c3eb 100644 --- a/api.lua +++ b/api.lua @@ -28,6 +28,9 @@ API.spellinfo = type(_G.GetSpellInfo) == "function" API.inventory = type(_G.C_Container) == "table" and type(_G.C_Container.GetContainerNumFreeSlots) == "function" +API.itemprice = type(_G.C_Item) == "table" + and type(_G.C_Item.GetItemSellPriceByID) == "function" + API.merchant = type(_G.C_MerchantFrame) == "table" and type(_G.C_MerchantFrame.GetNumJunkItems) == "function" and type(_G.C_MerchantFrame.SellAllJunkItems) == "function" @@ -141,6 +144,15 @@ API.GetContainerNumFreeSlots = function(bag) return 0, 0 end +-- Returns the live vendor sell price in copper when the client has the item +-- cached. ClassicAPI warms uncached item data itself and returns nil until the +-- cache fill completes, allowing callers to keep an immediate legacy fallback. +API.GetItemSellPriceByID = function(itemID) + if API.itemprice and itemID then + return _G.C_Item.GetItemSellPriceByID(itemID) + end +end + API.GetNumJunkItems = function() if API.merchant then return _G.C_MerchantFrame.GetNumJunkItems()