-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPetMarket.lua
More file actions
553 lines (482 loc) · 19.2 KB
/
PetMarket.lua
File metadata and controls
553 lines (482 loc) · 19.2 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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
--[[--------------------------------------------------------------------
PetMarket
Scans auction house for unowned pets.
https://mods.curse.com/addons/wow/petmarket
https://wow.curseforge.com/addons/petmarket/
Copyright (C) 2014 Timothy Johnson (RedHatter21)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
-----
Forked version with fixes and updates by Phanx:
https://github.com/Phanx/PetMarket
----------------------------------------------------------------------]]
PetMarket = LibStub("AceAddon-3.0"):NewAddon("PetMarket", "AceEvent-3.0", "AceTimer-3.0")
local PetMarket = PetMarket
-- Pet lists
PetMarket.KnownPets = {}
PetMarket.PetItems = select(2, ...).PetItemToSpecies
local pets = {}
-- State variables
local tab_index
local active_auction
local active_button
local lastPage = 0
local queryType = "NONE" -- NONE, SCAN, BID, BUYOUT
-- Initialization
-------------------------------------------------------------------------------
function PetMarket:OnInitialize()
self:RegisterEvent("AUCTION_HOUSE_SHOW")
self:RegisterEvent("AUCTION_HOUSE_CLOSED")
end
function PetMarket:UpdatePets()
for _, petID in LibStub("LibPetJournal-2.0"):IteratePetIDs() do
table.insert(PetMarket.KnownPets, C_PetJournal.GetPetInfoByPetID(petID), true);
end
end
function PetMarket:AUCTION_HOUSE_CLOSED()
PetMarket:HideUi()
end
-- Auction House tab
-------------------------------------------------------------------------------
function PetMarket:AUCTION_HOUSE_SHOW()
self:UpdatePets()
LibStub("LibPetJournal-2.0").RegisterCallback(self, "PetListUpdated", "UpdatePets")
tab_index = AuctionFrame.numTabs + 1
local frame = CreateFrame("Button", "AuctionFrameTab"..tab_index, AuctionFrame, "AuctionTabTemplate")
frame:SetID(tab_index)
frame:SetText("PetMarket")
-- frame:SetNormalFontObject(_G["AtrFontOrange"])
frame:SetPoint("LEFT", _G["AuctionFrameTab"..tab_index - 1], "RIGHT", -8, 0)
PanelTemplates_SetNumTabs(AuctionFrame, tab_index)
PanelTemplates_EnableTab(AuctionFrame, tab_index)
frame:GetScript("OnShow")(frame) -- force it to resize to fit its text
self.orig_AuctionFrameTab_OnClick = AuctionFrameTab_OnClick
AuctionFrameTab_OnClick = self.AuctionFrameTab_OnClick
self:UnregisterEvent("AUCTION_HOUSE_SHOW")
end
function PetMarket.AuctionFrameTab_OnClick(self, button, down, index)
if self:GetID() == tab_index then
AuctionFrameAuctions:Hide()
AuctionFrameBrowse:Hide()
AuctionFrameBid:Hide()
PlaySound(SOUNDKIT.IG_CHARACTER_INFO_TAB)
PanelTemplates_SetTab(AuctionFrame, tab_index)
AuctionFrameTopLeft:SetTexture("Interface\\AuctionFrame\\UI-AuctionFrame-Bid-TopLeft")
AuctionFrameTop:SetTexture("Interface\\AuctionFrame\\UI-AuctionFrame-Auction-Top")
AuctionFrameTopRight:SetTexture("Interface\\AuctionFrame\\UI-AuctionFrame-Auction-TopRight")
AuctionFrameBotLeft:SetTexture("Interface\\AuctionFrame\\UI-AuctionFrame-Bid-BotLeft")
AuctionFrameBot:SetTexture("Interface\\AuctionFrame\\UI-AuctionFrame-Auction-Bot")
AuctionFrameBotRight:SetTexture("Interface\\AuctionFrame\\UI-AuctionFrame-Bid-BotRight")
PetMarket:ShowUi()
else
PetMarket:HideUi()
PetMarket.orig_AuctionFrameTab_OnClick(self, button, down, index)
end
end
-- GUI management
-------------------------------------------------------------------------------
function PetMarket:CreateEntries(pets)
for _, child in pairs({PetMarketScrollChild:GetChildren()}) do child:Hide() end
for i, value in ipairs(pets) do
if _G["PetMarketEntry"..i] == nil then
local entry = CreateFrame("CheckButton", "PetMarketEntry"..i, PetMarketScrollChild)
entry:SetPoint("LEFT", 0, 0)
entry:SetPoint("RIGHT", 0, 0)
if i > 1 then
entry:SetPoint("TOP", "PetMarketEntry"..(i - 1), "BOTTOM", 0, -2)
else
entry:SetPoint("TOP", 0, 0)
end
entry:SetHeight(35)
local click = function(self)
entry:SetChecked(true)
active_auction = value
if active_button ~= nil then
active_button:SetChecked(false)
end
active_button = entry
PetMarketBuyout:Enable()
PetMarketBid:Enable()
PetMarketShow:Enable()
end
entry:SetScript("OnClick", click)
local highlight = entry:CreateTexture()
highlight:SetTexture("Interface\\HelpFrame\\HelpFrameButton-Highlight")
highlight:SetTexCoord(0.035, 0.04, 0.2, 0.25)
highlight:SetAllPoints()
entry:SetHighlightTexture(highlight)
local pushed = entry:CreateTexture()
pushed:SetTexture("Interface\\HelpFrame\\HelpFrameButton-Highlight")
pushed:SetTexCoord(0, 1, 0.0, 0.55)
pushed:SetAllPoints()
entry:SetCheckedTexture(pushed)
local link = CreateFrame("Button", "PetMarketEntry"..i.."Link", entry)
link:SetScript("OnClick", click)
local icon = link:CreateTexture("PetMarketEntry"..i.."Icon")
icon:SetPoint("TOPLEFT", 0, 0)
icon:SetPoint("BOTTOM", 0, 0)
icon:SetWidth(entry:GetHeight())
local text = link:CreateFontString("PetMarketEntry"..i.."Text", "ARTWORK", "ChatFontNormal")
text:SetPoint("LEFT", icon, "RIGHT", 10, 0)
link:SetPoint("TOPLEFT", 0, 0)
link:SetPoint("BOTTOM", 0, 0)
link:SetScript("OnLeave", function()
entry:UnlockHighlight()
GameTooltip:Hide()
BattlePetTooltip:Hide()
end)
local bid = CreateFrame("Frame", "PetMarketEntry"..i.."Bid", entry, "SmallMoneyFrameTemplate")
MoneyFrame_SetType(bid, "AUCTION")
bid:SetPoint("TOPRIGHT", 0, -5)
local buyout = CreateFrame("Frame", "PetMarketEntry"..i.."Buyout", entry, "SmallMoneyFrameTemplate")
MoneyFrame_SetType(buyout, "AUCTION")
buyout:SetPoint("TOP", bid, "BOTTOM", 0, -2)
local label = entry:CreateFontString(nil, "OVERLAY", "GameFontNormal")
label:SetText("Buyout")
label:SetPoint("BOTTOMRIGHT", -150, 5)
end
_G["PetMarketEntry"..i.."Icon"]:SetTexture(value["texture"])
_G["PetMarketEntry"..i.."Text"]:SetText(value["link"]:gsub("[%[%]]", ""))
_G["PetMarketEntry"..i.."Link"]:SetWidth(_G["PetMarketEntry"..i.."Text"]:GetWidth() + _G["PetMarketEntry"..i.."Icon"]:GetWidth())
_G["PetMarketEntry"..i.."Link"]:SetScript("OnEnter", function()
_G["PetMarketEntry"..i]:LockHighlight()
GameTooltip:Show()
GameTooltip:SetOwner(_G["PetMarketEntry"..i.."Link"])
if string.match(value["link"], "|Hbattlepet:") then
local _, speciesID, level, breedQuality, maxHealth, power, speed, battlePetID = strsplit(":", value["link"])
BattlePetToolTip_Show(tonumber(speciesID), tonumber(level), tonumber(breedQuality), tonumber(maxHealth), tonumber(power), tonumber(speed), nil)
else
GameTooltip:SetHyperlink(value["link"])
end
end)
MoneyFrame_Update(_G["PetMarketEntry"..i.."Bid"], value["bid"])
MoneyFrame_Update(_G["PetMarketEntry"..i.."Buyout"], value["buyout"])
_G["PetMarketEntry"..i]:Show()
end
PetMarketScrollChild:SetHeight(#pets * 37)
PetMarketStatus:SetText(#pets.." items found")
end
function PetMarket:ShowUi()
for _, child in pairs({AuctionFrame:GetChildren()}) do
local name = child:GetName()
if not name or not name:find("AuctionFrameTab") then
child:Hide()
end
end
AuctionFrameCloseButton:Show()
AuctionFrameMoneyFrame:Show()
if PetMarketScan == nil then
CreateFrame("Button", "PetMarketScan", AuctionFrame, "UIPanelButtonTemplate")
PetMarketScan:SetPoint("TOPLEFT", 100, -45)
PetMarketScan:SetWidth(150)
PetMarketScan:SetText("Scan Action House")
PetMarketScan:SetScript("OnClick", function()
self:RegisterEvent("AUCTION_ITEM_LIST_UPDATE")
lastPage = 0
self:AHQuery()
end)
end
if PetMarketStatus == nil then
AuctionFrame:CreateFontString("PetMarketStatus", "ARTWORK", "ChatFontNormal")
PetMarketStatus:SetPoint("TOP", 0, -47)
end
if PetMarketScroll == nil then
CreateFrame("ScrollFrame", "PetMarketScroll", AuctionFrame, "UIPanelScrollFrameTemplate")
CreateFrame("Frame", "PetMarketScrollChild")
PetMarketScroll:SetScrollChild(PetMarketScrollChild)
PetMarketScroll:SetPoint("TOPLEFT", 20, -80)
PetMarketScroll:SetPoint("BOTTOMRIGHT", -38, 45)
PetMarketScrollChild:SetWidth(PetMarketScroll:GetWidth())
end
if PetMarketBid == nil then
CreateFrame("Button", "PetMarketBid", AuctionFrame, "UIPanelButtonTemplate")
PetMarketBid:SetPoint("BOTTOMRIGHT", -168, 14)
PetMarketBid:SetSize(80, 22)
PetMarketBid:SetText("Bid")
PetMarketBid:SetScript("OnClick", function()
self:ShowConfirmDialog("BID")
end)
PetMarketBid:Disable()
end
if PetMarketBuyout == nil then
CreateFrame("Button", "PetMarketBuyout", AuctionFrame, "UIPanelButtonTemplate")
PetMarketBuyout:SetPoint("BOTTOMRIGHT", -88, 14)
PetMarketBuyout:SetSize(80, 22)
PetMarketBuyout:SetText("Buyout")
PetMarketBuyout:SetScript("OnClick", function()
self:ShowConfirmDialog("BUYOUT")
end)
PetMarketBuyout:Disable()
end
if PetMarketShow == nil then
CreateFrame("Button", "PetMarketShow", AuctionFrame, "UIPanelButtonTemplate")
PetMarketShow:SetPoint("BOTTOMRIGHT", -8, 14)
PetMarketShow:SetSize(80, 22)
PetMarketShow:SetText("Show")
PetMarketShow:SetScript("OnClick", function()
SortAuctionClearSort("list")
SortAuctionSetSort("list", "buyout")
SortAuctionApplySort("list")
QueryAuctionItems(active_auction["name"])
self:HideUi()
PlaySound(SOUNDKIT.IG_CHARACTER_INFO_TAB)
PanelTemplates_SetTab(AuctionFrame, 1)
AuctionFrameTopLeft:SetTexture("Interface\\AuctionFrame\\UI-AuctionFrame-Browse-TopLeft");
AuctionFrameTop:SetTexture("Interface\\AuctionFrame\\UI-AuctionFrame-Browse-Top");
AuctionFrameTopRight:SetTexture("Interface\\AuctionFrame\\UI-AuctionFrame-Browse-TopRight");
AuctionFrameBotLeft:SetTexture("Interface\\AuctionFrame\\UI-AuctionFrame-Browse-BotLeft");
AuctionFrameBot:SetTexture("Interface\\AuctionFrame\\UI-AuctionFrame-Auction-Bot");
AuctionFrameBotRight:SetTexture("Interface\\AuctionFrame\\UI-AuctionFrame-Bid-BotRight");
AuctionFrameBrowse:Show();
AuctionFrame.type = "list";
SetAuctionsTabShowing(false);
end)
PetMarketShow:Disable()
end
PetMarketScroll:Show()
PetMarketStatus:Show()
PetMarketScan:Show()
PetMarketBid:Show()
PetMarketBuyout:Show()
PetMarketShow:Show()
end
function PetMarket:HideUi()
if PetMarketScan == nil then return end
PetMarketScroll:Hide()
PetMarketStatus:Hide()
PetMarketScan:Hide()
PetMarketBid:Hide()
PetMarketBuyout:Hide()
PetMarketShow:Hide()
if PetMarketConfirm ~= nil then
PetMarketConfirm:Hide()
end
end
function PetMarket:ShowConfirmDialog(type)
PetMarketScroll:Hide()
if PetMarketConfirm == nil then
CreateFrame("Frame", "PetMarketConfirm", AuctionFrame)
PetMarketConfirm:SetSize(300, 200)
PetMarketConfirm:SetPoint("CENTER", 0, 0)
local backdrop = {
bgFile = "Interface\\CharacterFrame\\UI-Party-Background",
edgeFile = "Interface\\DialogFrame\\UI-DialogBox-Border",
tile = true,
tileSize = 32,
edgeSize = 32,
insets = {
left = 11,
right = 12,
top = 12,
bottom = 11
}
}
PetMarketConfirm:SetBackdrop(backdrop)
PetMarketConfirm:CreateFontString("PetMarketConfirmError", "ARTWORK", "GameFontNormal")
PetMarketConfirmError:SetText("Unable to find item.")
PetMarketConfirmError:SetPoint("CENTER", 0, 0)
PetMarketConfirmError:Hide()
local link = CreateFrame("Frame", "PetMarketConfirmLink", PetMarketConfirm)
link:SetHeight(50)
local icon = link:CreateTexture("PetMarketConfirmLinkIcon")
icon:SetPoint("TOPLEFT", 0, 0)
icon:SetPoint("BOTTOM", 0, 0)
icon:SetWidth(link:GetHeight())
local text = link:CreateFontString("PetMarketConfirmLinkText", "ARTWORK", "ChatFontNormal")
text:SetPoint("LEFT", icon, "RIGHT", 10, 0)
link:SetWidth(text:GetWidth() + icon:GetWidth())
link:SetPoint("TOP", 0, -25)
link:SetScript("OnLeave", function()
GameTooltip:Hide()
BattlePetTooltip:Hide()
end)
local cancel = CreateFrame("Button", nil, PetMarketConfirm, "UIPanelButtonTemplate")
cancel:SetPoint("BOTTOM", 50, 30)
cancel:SetSize(80, 22)
cancel:SetText("Cancel")
cancel:SetScript("OnClick", function()
PetMarketConfirm:Hide()
PetMarketScroll:Show()
end)
local confirm = CreateFrame("Button", "PetMarketConfirmButton", PetMarketConfirm, "UIPanelButtonTemplate")
confirm:SetPoint("BOTTOM", -50, 30)
confirm:SetSize(80, 22)
confirm:SetText("Confirm")
confirm:SetScript("OnClick", function()
PetMarketConfirm:Hide()
PetMarketScroll:Show()
end)
PetMarketConfirm:CreateFontString("PetMarketConfirmBuyoutText", "ARTWORK", "GameFontNormal")
PetMarketConfirmBuyoutText:SetText("Buy this item for ")
CreateFrame("Frame", "PetMarketConfirmBuyoutMoney", PetMarketConfirm, "SmallMoneyFrameTemplate")
MoneyFrame_SetType(PetMarketConfirmBuyoutMoney, "AUCTION")
PetMarketConfirmBuyoutMoney:SetPoint("LEFT", PetMarketConfirmBuyoutText, "RIGHT", 0, 0)
PetMarketConfirm:CreateFontString("PetMarketConfirmBuyoutQ", "ARTWORK", "GameFontNormal")
PetMarketConfirmBuyoutQ:SetText("?")
PetMarketConfirmBuyoutQ:SetPoint("LEFT", PetMarketConfirmBuyoutMoney, "RIGHT", -12, 0)
PetMarketConfirm:CreateFontString("PetMarketConfirmBidText1", "ARTWORK", "GameFontNormal")
PetMarketConfirmBidText1:SetText("Bid the minimum of")
CreateFrame("Frame", "PetMarketConfirmBidMoney", PetMarketConfirm, "SmallMoneyFrameTemplate")
MoneyFrame_SetType(PetMarketConfirmBidMoney, "AUCTION")
PetMarketConfirmBidMoney:SetPoint("LEFT", PetMarketConfirmBidText1, "RIGHT", 0, 0)
PetMarketConfirm:CreateFontString("PetMarketConfirmBidText2", "ARTWORK", "GameFontNormal")
PetMarketConfirmBidText2:SetText("on this item?")
PetMarketConfirmBidText2:SetPoint("TOPLEFT", PetMarketConfirmBidText1, "BOTTOMLEFT", 0, 2) end
SortAuctionClearSort("list")
if type == "BUYOUT" then
PetMarketConfirmBidText1:Hide()
PetMarketConfirmBidText2:Hide()
PetMarketConfirmBidMoney:Hide()
PetMarketConfirmBuyoutText:Show()
PetMarketConfirmBuyoutMoney:Show()
PetMarketConfirmBuyoutQ:Show()
SortAuctionSetSort("list", "buyout")
elseif type == "BID" then
PetMarketConfirmBuyoutText:Hide()
PetMarketConfirmBuyoutMoney:Hide()
PetMarketConfirmBuyoutQ:Hide()
PetMarketConfirmBidText1:Show()
PetMarketConfirmBidText2:Show()
PetMarketConfirmBidMoney:Show()
SortAuctionSetSort("list", "bid")
end
SortAuctionApplySort("list")
self:RegisterEvent("AUCTION_ITEM_LIST_UPDATE")
queryType = type
QueryAuctionItems(active_auction["name"])
PetMarketConfirm:Show()
end
-- Auction House queries
-------------------------------------------------------------------------------
local function sortEntryStrings(a, b)
local av = a.buyout < 1 and a.bid or a.buyout
local bv = b.buyout < 1 and b.bid or b.buyout
return av < bv
end
function PetMarket:AUCTION_ITEM_LIST_UPDATE()
if queryType == "NONE" then return end
if queryType == "SCAN" then
queryType = "NONE"
-- Much of the following code taken from MiniPetQ
local cnt, total = GetNumAuctionItems("list")
for i=1, cnt do
local itemLink = GetAuctionItemLink("list", i)
local speciesID
local name, texture, _, _, _, _, _, minBid, _, buyoutPrice, _, _, _, _, _, _, itemID = GetAuctionItemInfo("list", i)
if itemLink and string.find(itemLink, "|Hbattlepet:") then
_, speciesID = strsplit(":", itemLink)
speciesID = tonumber(speciesID)
else
speciesID = self.PetItems[itemID]
if not speciesID then
print("PetMarket: Unknown pet item: "..itemID.." "..name)
end
end
if speciesID and not self.KnownPets[speciesID] then
local v1 = buyoutPrice < 1 and minBid or buyoutPrice
local v2 = pets[name] == nil and 0 or(pets[name]["buyout"] < 1 and pets[name]["bid"] or pets[name]["buyout"])
if pets[name] == nil or v1 < v2 then
pets[name] = {
name = name,
texture = texture,
buyout = buyoutPrice,
bid = minBid,
link = itemLink,
id = itemID
}
end
end
end
PetMarketStatus:SetText(string.format("Scanning battle pets, page %d of %d", lastPage, math.ceil(total / 50)))
if 50 * lastPage > total then
lastPage = 0
local strings = {}
for key, value in pairs(pets) do
table.insert(strings, value)
end
table.sort(strings, sortEntryStrings)
self:CreateEntries(strings)
self:UnregisterEvent("AUCTION_ITEM_LIST_UPDATE")
else
lastPage = lastPage + 1
self:ScheduleTimer("AHQuery", .1)
end
else
self:UnregisterEvent("AUCTION_ITEM_LIST_UPDATE")
local link = GetAuctionItemLink("list", 1)
local name, texture, _, _, _, _, _, minBid, _, buyoutPrice, _, _, _, _, _, _, itemID = GetAuctionItemInfo("list", 1)
if name ~= active_auction["name"] or itemID ~= active_auction["id"] then
PetMarketConfirmBidText:Hide()
PetMarketConfirmBidMoney:Hide()
PetMarketConfirmBuyoutText:Hide()
PetMarketConfirmBuyoutMoney:Hide()
PetMarketConfirmBuyoutQ:Hide()
PetMarketConfirmLink:Hide()
PetMarketConfirmError:Show()
queryType = "NONE"
return
end
PetMarketConfirmLinkIcon:SetTexture(texture)
PetMarketConfirmLinkText:SetText(link)
PetMarketConfirmLink:SetWidth(PetMarketConfirmLinkText:GetWidth() + PetMarketConfirmLinkIcon:GetWidth())
PetMarketConfirmLink:SetScript("OnEnter", function()
GameTooltip:Show()
GameTooltip:SetOwner(PetMarketConfirmLink)
if string.match(link, "|Hbattlepet:") then
local _, speciesID, level, breedQuality, maxHealth, power, speed, battlePetID = strsplit(":", link)
BattlePetToolTip_Show(tonumber(speciesID), tonumber(level), tonumber(breedQuality), tonumber(maxHealth), tonumber(power), tonumber(speed), nil)
else
GameTooltip:SetHyperlink(link)
end
end)
if queryType == "BUYOUT" then
MoneyFrame_Update(PetMarketConfirmBuyoutMoney, buyoutPrice)
PetMarketConfirmBuyoutText:SetPoint("TOP", PetMarketConfirmLink, "BOTTOM", -PetMarketConfirmBuyoutMoney:GetWidth() / 2, -20)
PetMarketConfirmButton:SetScript("OnClick", function()
local name, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, itemID = GetAuctionItemInfo("list", 1)
if name == active_auction["name"] and itemID == active_auction["id"] then
PlaceAuctionBid("list", 1, buyoutPrice)
end
PetMarketConfirm:Hide()
PetMarketScroll:Show()
end)
elseif queryType == "BID" then
MoneyFrame_Update(PetMarketConfirmBidMoney, minBid)
PetMarketConfirmBidText1:SetPoint("TOP", PetMarketConfirmLink, "BOTTOM", -PetMarketConfirmBidMoney:GetWidth() / 2, -20)
PetMarketConfirmButton:SetScript("OnClick", function()
local name, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, itemID = GetAuctionItemInfo("list", 1)
if name == active_auction["name"] and itemID == active_auction["id"] then
PlaceAuctionBid("list", 1, minBid)
end
PetMarketConfirm:Hide()
PetMarketScroll:Show()
end)
end
queryType = "NONE"
return
end
end
function PetMarket:AHQuery()
if AuctionFrame:IsVisible() ~= true then
print("PetMarket: Auction House is closed, can not scan.")
self:UnregisterEvent("AUCTION_ITEM_LIST_UPDATE")
queryType = "NONE"
return
end
local canQuery, canQueryAll = CanSendAuctionQuery()
if not canQuery then
PetMarket:ScheduleTimer("AHQuery", .1)
return
end
queryType = "SCAN"
local filterData = AuctionCategories[10].filters
QueryAuctionItems("", 0, 0, lastPage, false, -1, false, false, filterData)
end