Files
pfUI/modules/sellvalue.lua
T
Brues 802d47312f pfSellData: drop sell column, use C_Item.GetItemSellPriceByID
Each pfSellData entry was a "sell,buy" string. The sell price duplicates
what C_Item.GetItemSellPriceByID returns from the engine's item DBC, so
it's redundant in our table — only the buy price (curated from real
vendor encounters, not a static item property) needs to live here.

Transformed every [id]="X,Y" entry across env/tables.lua, compat/tbc.lua,
and modules/turtle-wow.lua to [id]=Y via sed. Format is now itemid →
buyPrice (number, copper).

sellvalue.lua: reads sell from C_Item.GetItemSellPriceByID(id), reads
buy from pfSellData[id]. Items that have only a sell price (not in
pfSellData) now display sell-only — previously they got no tooltip
addition because the lookup gated on table membership. Items with
buy-only (sell == 0 in old data) still display buy correctly.

autovendor.lua: replaces the pfSellData[id] gate (which only checked
table membership and unused the parsed sell/buy) with a direct
C_Item.GetItemSellPriceByID > 0 check — the engine's canonical
"is this item sellable to a vendor" answer.
2026-05-21 17:19:29 -05:00

55 lines
1.9 KiB
Lua

pfUI:RegisterModule("sellvalue", "vanilla:tbc", function ()
local function AddVendorPrices(frame, id, count)
if not id then return end
-- Sell price comes from the engine (item DBC); buy price from pfSellData
-- (curated vendor data, since vendor purchase prices aren't a static field).
local sell = C_Item.GetItemSellPriceByID(id) or 0
local buy = pfSellData[id]
if sell == 0 and not buy then return end
if not MerchantFrame:IsShown() and sell > 0 then
SetTooltipMoney(frame, sell * count)
end
if IsShiftKeyDown() or C.tooltip.vendor.showalways == "1" then
frame:AddLine(" ")
if sell > 0 then
if count > 1 then
frame:AddDoubleLine(T["Sell"] .. ":", CreateGoldString(sell) .. "|cff555555 // " .. CreateGoldString(sell*count), 1, 1, 1)
else
frame:AddDoubleLine(T["Sell"] .. ":", CreateGoldString(sell), 1, 1, 1)
end
end
if buy then
if count > 1 then
frame:AddDoubleLine(T["Buy"] .. ":", CreateGoldString(buy) .. "|cff555555 // " .. CreateGoldString(buy*count), 1, 1, 1)
else
frame:AddDoubleLine(T["Buy"] .. ":", CreateGoldString(buy), 1, 1, 1)
end
end
end
frame:Show()
end
pfUI.sellvalue = CreateFrame("Frame", "pfGameTooltip", GameTooltip)
pfUI.sellvalue:SetScript("OnShow", function()
if GameTooltip:HasItem() then
local _, _, id = GameTooltip:GetItem()
if id then
local count = tonumber(libtooltip:GetItemCount()) or 1
AddVendorPrices(GameTooltip, id, math.max(count, 1))
end
end
end)
hooksecurefunc("SetItemRef", function()
if IsAltKeyDown() or IsShiftKeyDown() or IsControlKeyDown() then return end
if ItemRefTooltip:HasItem() then
local _, _, id = ItemRefTooltip:GetItem()
if id then AddVendorPrices(ItemRefTooltip, id, 1) end
end
end)
end)