forked from TheMouseNest/Auctionator
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAuctionatorAPI.lua
More file actions
executable file
·156 lines (104 loc) · 3.1 KB
/
AuctionatorAPI.lua
File metadata and controls
executable file
·156 lines (104 loc) · 3.1 KB
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
local addonName, addonTable = ...;
local ZT = addonTable.ztt.ZT;
local zc = addonTable.zc;
local zz = zc.md;
local _
-----------------------------------------
local origGetSellValue = GetSellValue;
local origGetAuctionBuyout = GetAuctionBuyout;
-----------------------------------------
function GetSellValue (item) -- Tekkub's API
return Atr_GetSellValue(item);
end
-----------------------------------------
function GetAuctionBuyout (item) -- Tekkub's API
return Atr_GetAuctionBuyout(item);
end
-----------------------------------------
function Atr_GetSellValue (item) -- Just like Tekkub's API but for when you want to be sure you're calling Auctionator's version of it
local sellval = select (11, GetItemInfo(item));
if (sellval ~= nil) then
return sellval;
end
if (origGetSellValue) then
return origGetSellValue(item);
end
return 0;
end
-----------------------------------------
function Atr_GetAuctionBuyout (item) -- Just like Tekkub's API but for when you want to be sure you're calling Auctionator's version of it
local sellval;
if (type(item) == "string") then
sellval = Atr_GetAuctionPrice(item);
end
if (sellval == nil) then
local name = GetItemInfo(item);
if (name) then
sellval = Atr_GetAuctionPrice(name);
end
end
if (sellval) then
return sellval;
end
if (origGetAuctionBuyout) then
return origGetAuctionBuyout(item);
end
return nil;
end
-----------------------------------------
function Atr_GetDisenchantValue (item)
local itemName, itemLink, quality, iLevel, _, itemType, sSubType, _, _, _, _, itemClass, itemSubClass = GetItemInfo(item);
if (itemLink) then
return Atr_CalcDisenchantPrice( itemClass, itemRarity, itemLevel )
end
return nil;
end
-----------------------------------------
function Atr_SearchAH (shoppingListName, items, itemType)
if (shoppingListName == nil) then
shoppingListName = "Unknown"
end
local slist = Atr_SList.create (shoppingListName, false, true)
local i;
for i = 1, #items do
if (i == 1 and (Atr_IsWeaponType (itemType) or Atr_IsArmorType (itemType))) then
slist:AddItem (items[i]) -- do substring search for first item if armor or weapon
else
slist:AddItem (zc.QuoteString(items[i]))
end
end
if (not Atr_IsTabSelected(SELL_TAB)) then
Atr_SelectPane (SELL_TAB);
end
Atr_SetSearchText ("{ "..shoppingListName.." }");
Atr_Search_Onclick ();
end
-----------------------------------------
local DBupdateCallbacks = {};
-----------------------------------------
function Atr_RegisterFor_DBupdated (cbFunc)
table.insert (DBupdateCallbacks, cbFunc);
end
-----------------------------------------
function Atr_Broadcast_DBupdated (num, kind, binfo)
local n;
for n = 1,#DBupdateCallbacks do
local cbFunc = DBupdateCallbacks[n]
if (type(cbFunc) == "function") then
cbFunc(num, kind, binfo)
end
end
end
-----------------------------------------
--[[
function Atr_TestListener (num, kind, binfo)
zz (num, "items found", kind)
if (type(binfo) == "table") then
local z;
for z = 1,#binfo do
zz (z, binfo[z].i, binfo[z].p)
end
end
end
Atr_RegisterFor_DBupdated (Atr_TestListener)
]]--