-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAuctionatorVendor.lua
executable file
·80 lines (58 loc) · 2.18 KB
/
AuctionatorVendor.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
75
76
77
78
79
80
local addonName, addonTable = ...
local ZT = addonTable.ztt.ZT
local zc = addonTable.zc
local zz = zc.md
local _
ATR_CAN_BE_AUCTIONED = 0
ATR_BIND_ON_PICKUP = 1
ATR_BINDS_TO_ACCOUNT = 2
ATR_QUEST_ITEM = 4
ATR_BINDTYPE_UNKNOWN = -1
local AtrBindTypeCache = {}
-----------------------------------------
function AtrReadBindText(itemID, txt)
-- zz (itemID, txt);
if (txt) then
if txt == ITEM_BIND_ON_EQUIP then return ATR_CAN_BE_AUCTIONED end
if txt == ITEM_BIND_ON_USE then return ATR_CAN_BE_AUCTIONED end
if txt == ITEM_BIND_ON_PICKUP then return ATR_BIND_ON_PICKUP end
if txt == ITEM_BIND_TO_ACCOUNT then return ATR_BINDS_TO_ACCOUNT end
if txt == ITEM_BIND_TO_BNETACCOUNT then
return ATR_BINDS_TO_ACCOUNT
end
if txt == ITEM_BIND_QUEST then return ATR_QUEST_ITEM end
end
return ATR_BINDTYPE_UNKNOWN
end
-----------------------------------------
function Atr_AddBondTypeToCache(itemID)
-- patch submitted by @teyasio (unable to reproduce offending bug)
if itemID == nil then return end
if not AtrBindTypeToolTip then
CreateFrame('GameTooltip', 'AtrBindTypeToolTip', UIParent,
'GameTooltipTemplate')
end
local tt = AtrBindTypeToolTip
tt:SetOwner(UIParent, 'ANCHOR_NONE')
tt:SetItemByID(itemID)
local result = ATR_BINDTYPE_UNKNOWN
if AtrBindTypeToolTip:NumLines() > 1 then
result = AtrReadBindText(itemID, AtrBindTypeToolTipTextLeft2:GetText())
if (result == ATR_BINDTYPE_UNKNOWN) then
result = AtrReadBindText(itemID,
AtrBindTypeToolTipTextLeft3:GetText())
end
end
tt:Hide()
if (result == ATR_BINDTYPE_UNKNOWN) then
AtrBindTypeCache[itemID] = ATR_CAN_BE_AUCTIONED
else
AtrBindTypeCache[itemID] = result
end
-- zz ("Adding to cache: ", itemID, AtrBindTypeCache[itemID]);
end
-----------------------------------------
function Atr_GetBondType(itemID)
if (AtrBindTypeCache[itemID] == nil) then Atr_AddBondTypeToCache(itemID) end
return AtrBindTypeCache[itemID]
end