-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Compat.lua
74 lines (68 loc) · 1.93 KB
/
Compat.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
local VP = VendorPrice
if not VP.isVanilla and not VP.isCata then
return
end
local function SetPrice(tt, count, item)
VP:SetPrice(tt, false, "Compat", count, item, true)
end
local function GetMouseFoc()
if GetMouseFoci then
return GetMouseFoci()[1]
elseif GetMouseFocus then
return GetMouseFocus()
end
end
function VP:IsShown(frame)
return frame and frame:IsVisible() and frame:IsMouseOver()
end
local Auctioneer = {
AucAdvAppraiserFrame = function(tt)
local itemID = select(2, tt:GetItem()):match("item:(%d+)")
for _, v in pairs(AucAdvAppraiserFrame.list) do
if v[1] == itemID then
SetPrice(tt, v[6])
break
end
end
end,
AucAdvSearchUiAuctionFrame = function(tt)
local row = tt:GetOwner():GetID()
local count = AucAdvanced.Modules.Util.SearchUI.Private.gui.sheet.rows[row][4]
SetPrice(tt, tonumber(count:GetText()))
end,
AucAdvSimpFrame = function(tt)
SetPrice(tt, AucAdvSimpFrame.detail[1])
end,
}
GameTooltip:HookScript("OnTooltipSetItem", function(tt)
if AucAdvanced and VP:IsShown(AuctionFrame) then
for frame, func in pairs(Auctioneer) do
if VP:IsShown(_G[frame]) then
func(tt)
break
end
end
elseif AuctionFaster and VP:IsShown(AuctionFrame) and AuctionFrame.selectedTab >= 4 then
local count
if AuctionFrame.selectedTab == 4 then -- sell
local item = tt:GetOwner().item
count = item and item.count
elseif AuctionFrame.selectedTab == 5 then -- buy
local hoverRowData = AuctionFaster.hoverRowData
count = hoverRowData and hoverRowData.count -- provided by AuctionFaster
end
SetPrice(tt, count)
elseif AtlasLoot and VP:IsShown(_G["AtlasLoot_GUI-Frame"]) then
SetPrice(tt)
else -- Chatter, Prat: check for active chat windows
local mouseFocus = GetMouseFoc()
if mouseFocus and mouseFocus:GetObjectType() == "FontString" then
for i = 1, FCF_GetNumActiveChatFrames() do
if _G["ChatFrame"..i]:IsMouseOver() then
SetPrice(tt)
break
end
end
end
end
end)