-
Notifications
You must be signed in to change notification settings - Fork 3
/
vendorprice.lua
36 lines (33 loc) · 1.25 KB
/
vendorprice.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
if WOW_PROJECT_ID ~= WOW_PROJECT_CLASSIC then return end
local SELL_PRICE_TEXT = format("%s:", SELL_PRICE)
local function SetGameToolTipPrice(tt)
if not MerchantFrame:IsShown() then
local itemLink = select(2, tt:GetItem())
if itemLink then
local itemSellPrice = select(11, GetItemInfo(itemLink))
if itemSellPrice and itemSellPrice > 0 then
local container = GetMouseFocus()
local object = container:GetObjectType()
local count
if object == "Button" then -- ContainerFrameItem, QuestInfoItem, PaperDollItem
count = container.count
elseif object == "CheckButton" then -- MailItemButton or ActionButton
count = container.count or tonumber(container.Count:GetText())
end
local cost = (type(count) == "number" and count or 1) * itemSellPrice
SetTooltipMoney(tt, cost, nil, SELL_PRICE_TEXT)
end
end
end
end
local function SetItemRefToolTipPrice(tt)
local itemLink = select(2, tt:GetItem())
if itemLink then
local itemSellPrice = select(11, GetItemInfo(itemLink))
if itemSellPrice and itemSellPrice > 0 then
SetTooltipMoney(tt, itemSellPrice, nil, SELL_PRICE_TEXT)
end
end
end
GameTooltip:HookScript("OnTooltipSetItem", SetGameToolTipPrice)
ItemRefTooltip:HookScript("OnTooltipSetItem", SetItemRefToolTipPrice)