From 13a5843bba442fa5b671dde1db0dbc6b15c5fd86 Mon Sep 17 00:00:00 2001 From: Dusk-92 Date: Mon, 24 Aug 2026 08:20:10 +0200 Subject: [PATCH] Phase 2: expose ClassicAPI item sell prices --- api.lua | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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()