feat: show sell price on item tooltips in gold/silver/copper format

Item tooltips now display the vendor sell price at the bottom, formatted
as "Sell Price: 12g 50s 30c". Uses the vendorPrice field from GetItemInfo
(field 11, sourced from SMSG_ITEM_QUERY_SINGLE_RESPONSE sellPrice).

Helps players quickly assess item value when looting or sorting bags.
This commit is contained in:
Kelsi 2026-03-22 18:17:21 -07:00
parent 5678de562f
commit 22f8b721c7

View file

@ -5372,6 +5372,17 @@ void LuaEngine::registerCoreAPI() {
" -- Flavor text\n"
" if data.description then self:AddLine('\"'..data.description..'\"', 1, 0.82, 0) end\n"
" end\n"
" -- Sell price from GetItemInfo\n"
" if sellPrice and sellPrice > 0 then\n"
" local gold = math.floor(sellPrice / 10000)\n"
" local silver = math.floor((sellPrice % 10000) / 100)\n"
" local copper = sellPrice % 100\n"
" local parts = {}\n"
" if gold > 0 then table.insert(parts, gold..'g') end\n"
" if silver > 0 then table.insert(parts, silver..'s') end\n"
" if copper > 0 then table.insert(parts, copper..'c') end\n"
" if #parts > 0 then self:AddLine('Sell Price: '..table.concat(parts, ' '), 1, 1, 1) end\n"
" end\n"
" self.__itemId = itemId\n"
" return true\n"
"end\n"