Files
pfUI/modules/sellvalue.lua
T
shagu a5df9db348 libtooltip: add tooltop library for extended infos
Add tooltip library, based on the sellvalue item hooks,
in order to obtain extended gametooltip data, that can be used
to query the current GameTooltip for ItemLink and ItemID.
2019-12-05 21:49:12 +01:00

37 lines
1.3 KiB
Lua

pfUI:RegisterModule("sellvalue", "vanilla:tbc", function ()
pfUI.sellvalue = CreateFrame( "Frame" , "pfGameTooltip", GameTooltip )
pfUI.sellvalue:SetScript("OnShow", function()
if libtooltip:GetItemLink() then
local itemID = libtooltip:GetItemID()
local count = libtooltip:GetItemCount() or 1
if pfSellData[itemID] then
local _, _, sell, buy = strfind(pfSellData[itemID], "(.*),(.*)")
sell = tonumber(sell)
buy = tonumber(buy)
if not MerchantFrame:IsShown() then
if sell > 0 then SetTooltipMoney(GameTooltip, sell * count) end
end
if IsShiftKeyDown() or C.tooltip.vendor.showalways == "1" then
GameTooltip:AddLine(" ")
if count > 1 then
GameTooltip:AddDoubleLine(T["Sell"] .. ":", CreateGoldString(sell) .. "|cff555555 // " .. CreateGoldString(sell*count), 1, 1, 1);
else
GameTooltip:AddDoubleLine(T["Sell"] .. ":", CreateGoldString(sell * count), 1, 1, 1);
end
if count > 1 then
GameTooltip:AddDoubleLine(T["Buy"] .. ":", CreateGoldString(buy) .. "|cff555555 // " .. CreateGoldString(buy*count), 1, 1, 1);
else
GameTooltip:AddDoubleLine(T["Buy"] .. ":", CreateGoldString(buy), 1, 1, 1);
end
end
GameTooltip:Show()
end
end
end)
end)