-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAH_Overrides.lua
461 lines (380 loc) · 16 KB
/
AH_Overrides.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
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
local _, addonTable = ...
local math_ceil = math.ceil
-- MoneyFrame.lua 277
local function MoneyFrame_SetMaxDisplayWidth_(moneyFrame, width)
moneyFrame.maxDisplayWidth = nil
end
MoneyFrame_SetMaxDisplayWidth = MoneyFrame_SetMaxDisplayWidth_
-- Blizzard_AuctionUI.lua 211
local function AuctionFrameTab_OnClick_(self, button, down, index)
local index = self:GetID()
PanelTemplates_SetTab(AuctionFrame, index)
AuctionFrameAuctions:Hide()
AuctionFrameBrowse:Hide()
AuctionFrameBid:Hide()
AuctionHere_Container:Hide()
PlaySound(SOUNDKIT.IG_CHARACTER_INFO_TAB)
if index == 1 then
AuctionFrameBrowse:RegisterEvent("AUCTION_ITEM_LIST_UPDATE")
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)
elseif index == 2 then
AuctionFrameBrowse:RegisterEvent("AUCTION_ITEM_LIST_UPDATE")
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")
AuctionFrameBid:Show()
AuctionFrame.type = "bidder"
SetAuctionsTabShowing(false)
elseif index == 3 then
AuctionFrameBrowse:RegisterEvent("AUCTION_ITEM_LIST_UPDATE")
AuctionFrameTopLeft:SetTexture("Interface\\AuctionFrame\\UI-AuctionFrame-Auction-TopLeft")
AuctionFrameTop:SetTexture("Interface\\AuctionFrame\\UI-AuctionFrame-Auction-Top")
AuctionFrameTopRight:SetTexture("Interface\\AuctionFrame\\UI-AuctionFrame-Auction-TopRight")
AuctionFrameBotLeft:SetTexture("Interface\\AuctionFrame\\UI-AuctionFrame-Auction-BotLeft")
AuctionFrameBot:SetTexture("Interface\\AuctionFrame\\UI-AuctionFrame-Auction-Bot")
AuctionFrameBotRight:SetTexture("Interface\\AuctionFrame\\UI-AuctionFrame-Auction-BotRight")
AuctionFrameAuctions:Show()
SetAuctionsTabShowing(true)
elseif index == 4 then
AuctionFrameBrowse:UnregisterEvent("AUCTION_ITEM_LIST_UPDATE")
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")
AuctionHere_Container:Show()
AuctionFrame.type = "list"
SetAuctionsTabShowing(false)
end
end
addonTable.AuctionFrameTab_OnClick = AuctionFrameTab_OnClick_
-- Blizzard_AuctionUI.lua 267
local function AuctionFrameBrowse_UpdateArrows_()
SortButton_UpdateArrow(AuctionHere_Count, "list", "quantity")
SortButton_UpdateArrow(BrowseQualitySort, "list", "quality")
SortButton_UpdateArrow(BrowseLevelSort, "list", "level")
SortButton_UpdateArrow(BrowseDurationSort, "list", "duration")
SortButton_UpdateArrow(BrowseHighBidderSort, "list", "seller")
SortButton_UpdateArrow(BrowseCurrentBidSort, "list", "unitprice")
end
addonTable.AuctionFrameBrowse_UpdateArrows = AuctionFrameBrowse_UpdateArrows_
-- Blizzard_AuctionUI.lua 324
local function AuctionFrameBrowse_Reset_(self)
BrowseName:SetText("")
BrowseMinLevel:SetText("")
BrowseMaxLevel:SetText("")
UIDropDownMenu_SetSelectedValue(BrowseDropDown, -1)
IsUsableCheckButton:SetChecked(false)
if ShowOnPlayerCheckButton:GetChecked() then
ShowOnPlayerCheckButton:Click()
end
AuctionHere_ExactMatch:SetChecked(false)
OPEN_FILTER_LIST = {}
AuctionFrameBrowse.selectedCategoryIndex = nil
AuctionFrameBrowse.selectedSubCategoryIndex = nil
AuctionFrameBrowse.selectedSubSubCategoryIndex = nil
BrowseLevelSort:SetText(AuctionFrame_GetDetailColumnString(AuctionFrameBrowse.selectedCategoryIndex, AuctionFrameBrowse.selectedSubCategoryIndex))
AuctionFrameFilters_Update()
self:Disable()
end
addonTable.AuctionFrameBrowse_Reset = AuctionFrameBrowse_Reset_
-- Blizzard_AuctionUI.lua 350
local function BrowseResetButton_OnUpdate_(self, elapsed)
if (BrowseName:GetText() == "")
and (BrowseMinLevel:GetText() == "")
and (BrowseMaxLevel:GetText() == "")
and (UIDropDownMenu_GetSelectedValue(BrowseDropDown) == -1)
and (not IsUsableCheckButton:GetChecked())
and (not ShowOnPlayerCheckButton:GetChecked())
and (not AuctionHere_ExactMatch:GetChecked())
and (not AuctionFrameBrowse.selectedCategoryIndex)
and (not AuctionFrameBrowse.selectedSubCategoryIndex)
and (not AuctionFrameBrowse.selectedSubSubCategoryIndex)
then
self:Disable()
else
self:Enable()
end
end
addonTable.BrowseResetButton_OnUpdate = BrowseResetButton_OnUpdate_
-- Blizzard_AuctionUI.lua 375
local function AuctionFrame_OnClickSortColumn_(sortTable, sortColumn)
local existingSortColumn, existingSortReverse = GetAuctionSort(sortTable, 1)
local oppositeOrder = false
if existingSortColumn and (existingSortColumn == sortColumn) then
oppositeOrder = not existingSortReverse
elseif sortColumn == "quantity" or sortColumn == "level" then
oppositeOrder = true
end
AuctionFrame_SetSort(sortTable, sortColumn, oppositeOrder)
if sortTable == "list" then
AuctionFrameBrowse_Search()
else
SortAuctionApplySort(sortTable)
end
end
addonTable.AuctionFrame_OnClickSortColumn = AuctionFrame_OnClickSortColumn_
local prevPage
-- Blizzard_AuctionUI.lua 397
local function AuctionFrameBrowse_Search_()
BrowseScrollFrameScrollBar:SetValue(0)
local page = AuctionFrameBrowse.page
if not page then
AuctionFrameBrowse.page = 0
else
if page == prevPage then
AuctionFrameBrowse.page = 0
end
end
page = AuctionFrameBrowse.page
local filter
local category = AuctionFrameBrowse.selectedCategoryIndex
local subCategory = AuctionFrameBrowse.selectedSubCategoryIndex
local subSubCategory = AuctionFrameBrowse.selectedSubSubCategoryIndex
if category and subCategory and subSubCategory then
filter = AuctionCategories[category].subCategories[subCategory].subCategories[subSubCategory].filters
elseif category and subCategory then
filter = AuctionCategories[category].subCategories[subCategory].filters
elseif category then
filter = AuctionCategories[category].filters
end
QueryAuctionItems(
BrowseName:GetText(),
BrowseMinLevel:GetNumber(),
BrowseMaxLevel:GetNumber(),
page,
IsUsableCheckButton:GetChecked(),
UIDropDownMenu_GetSelectedValue(BrowseDropDown),
false,
AuctionHere_ExactMatch:GetChecked(),
filter
)
prevPage = page
AuctionFrameBrowse.isSearching = 1
end
addonTable.AuctionFrameBrowse_Search = AuctionFrameBrowse_Search_
-- Blizzard_AuctionUI.lua 455
local function BrowseSearchButton_OnUpdate_(self, elapsed)
if CanSendAuctionQuery("list") then
self:Enable()
if BrowsePrevPageButton.isEnabled then
BrowsePrevPageButton:Enable()
else
BrowsePrevPageButton:Disable()
end
if BrowseNextPageButton.isEnabled then
BrowseNextPageButton:Enable()
else
BrowseNextPageButton:Disable()
end
AuctionHere_Count:Enable()
BrowseQualitySort:Enable()
BrowseLevelSort:Enable()
BrowseDurationSort:Enable()
BrowseHighBidderSort:Enable()
BrowseCurrentBidSort:Enable()
AuctionFrameBrowse_UpdateArrows()
else
self:Disable()
BrowsePrevPageButton:Disable()
BrowseNextPageButton:Disable()
AuctionHere_Count:Disable()
BrowseQualitySort:Disable()
BrowseLevelSort:Disable()
BrowseDurationSort:Disable()
BrowseHighBidderSort:Disable()
BrowseCurrentBidSort:Disable()
end
end
addonTable.BrowseSearchButton_OnUpdate = BrowseSearchButton_OnUpdate_
-- Blizzard_AuctionUI.lua 686
local function AuctionFrameBrowse_Update_()
if not AuctionFrame_DoesCategoryHaveFlag("WOW_TOKEN_FLAG", AuctionFrameBrowse.selectedCategoryIndex) then
local numBatchAuctions, totalAuctions = GetNumAuctionItems("list")
local button, buttonName, buttonHighlight, iconTexture, itemName, color, itemCount, moneyFrame, yourBidText, buyoutFrame, buyoutMoney
local offset = FauxScrollFrame_GetOffset(BrowseScrollFrame)
local index
local name, texture, count, quality, canUse, level, levelColHeader, minBid, minIncrement, buyoutPrice, duration, bidAmount, highBidder, bidderFullName, owner, ownerFullName, saleStatus, itemId, hasAllInfo
local displayedPrice, requiredBid
BrowseBidButton:Show()
BrowseBuyoutButton:Show()
BrowseBidButton:Disable()
BrowseBuyoutButton:Disable()
-- Update sort arrows
AuctionFrameBrowse_UpdateArrows()
-- Show the no results text if no items found
if numBatchAuctions == 0 then
BrowseNoResultsText:Show()
BrowseSearchCountText:Hide()
AuctionHere_PageText:Hide()
BrowseCurrentBidSort:SetWidth(209)
else
BrowseNoResultsText:Hide()
AuctionHere_PageText:SetText(AuctionFrameBrowse.page + 1 .. " / " .. math_ceil(totalAuctions / NUM_AUCTION_ITEMS_PER_PAGE))
AuctionHere_PageText:Show()
local itemsMin = AuctionFrameBrowse.page * NUM_AUCTION_ITEMS_PER_PAGE + 1
local itemsMax = itemsMin + numBatchAuctions - 1
BrowseSearchCountText:SetText("Items " .. itemsMin .. " - " .. itemsMax .. " (" .. totalAuctions .. " total)")
BrowseSearchCountText:Show()
end
for i = 1, NUM_BROWSE_TO_DISPLAY do
index = offset + i + (NUM_AUCTION_ITEMS_PER_PAGE * AuctionFrameBrowse.page)
button = _G["BrowseButton" .. i]
local shouldHide = index > (numBatchAuctions + (NUM_AUCTION_ITEMS_PER_PAGE * AuctionFrameBrowse.page))
if not shouldHide then
name, texture, count, quality, canUse, level, levelColHeader, minBid, minIncrement, buyoutPrice, bidAmount, highBidder, bidderFullName, owner, ownerFullName, saleStatus, itemId, hasAllInfo = GetAuctionItemInfo("list", offset + i)
-- Bug 145328
if not hasAllInfo then
shouldHide = true
end
end
-- Show or hide auction buttons
if shouldHide then
button:Hide()
else
button:Show()
buttonName = "BrowseButton" .. i
duration = GetAuctionItemTimeLeft("list", offset + i)
-- Resize button if there isn't a scrollbar
buttonHighlight = _G["BrowseButton" .. i .. "Highlight"]
if (numBatchAuctions < NUM_BROWSE_TO_DISPLAY) or ((numBatchAuctions == NUM_BROWSE_TO_DISPLAY) and (totalAuctions <= NUM_BROWSE_TO_DISPLAY)) then
button:SetWidth(635)
buttonHighlight:SetWidth(602)
BrowseCurrentBidSort:SetWidth(209)
else
button:SetWidth(610)
buttonHighlight:SetWidth(577)
BrowseCurrentBidSort:SetWidth(184)
end
-- Set name and quality color
color = ITEM_QUALITY_COLORS[quality]
itemName = _G[buttonName .. "Name"]
itemName:SetText(name)
itemName:SetVertexColor(color.r, color.g, color.b)
local itemButton = _G[buttonName .. "Item"]
SetItemButtonQuality(itemButton, quality, itemId)
-- Set level
if (levelColHeader == "REQ_LEVEL_ABBR") and (level > UnitLevel("player")) then
_G[buttonName .. "Level"]:SetText(RED_FONT_COLOR_CODE .. level .. FONT_COLOR_CODE_CLOSE)
else
_G[buttonName .. "Level"]:SetText(level)
end
-- Set closing time
_G[buttonName .. "ClosingTimeText"]:SetText(AuctionFrame_GetTimeLeftText(duration))
_G[buttonName .. "ClosingTime"].tooltip = AuctionFrame_GetTimeLeftTooltipText(duration)
-- Set item texture, count, and usability
iconTexture = _G[buttonName .. "ItemIconTexture"]
iconTexture:SetTexture(texture)
if not canUse then
iconTexture:SetVertexColor(1.0, 0.1, 0.1)
else
iconTexture:SetVertexColor(1.0, 1.0, 1.0)
end
itemCount = _G[buttonName .. "ItemCount"]
if count > 1 then
itemCount:SetText(count)
itemCount:Show()
else
itemCount:Hide()
end
-- Set high bid
moneyFrame = _G[buttonName .. "MoneyFrame"]
-- If not bidAmount set the bid amount to the min bid
if bidAmount == 0 then
displayedPrice = minBid
requiredBid = minBid
else
displayedPrice = bidAmount
requiredBid = bidAmount + minIncrement
end
MoneyFrame_Update(moneyFrame:GetName(), displayedPrice)
yourBidText = _G[buttonName .. "YourBidText"]
if highBidder then
yourBidText:Show()
else
yourBidText:Hide()
end
if requiredBid >= MAXIMUM_BID_PRICE then
-- Lie about our buyout price
buyoutPrice = requiredBid
end
buyoutFrame = _G[buttonName .. "BuyoutFrame"]
if buyoutPrice > 0 then
moneyFrame:SetPoint("RIGHT", button, "RIGHT", 10, 8)
buyoutMoney = _G[buyoutFrame:GetName() .. "Money"]
MoneyFrame_Update(buyoutMoney, buyoutPrice)
buyoutFrame:Show()
else
moneyFrame:SetPoint("RIGHT", button, "RIGHT", 10, 0)
buyoutFrame:Hide()
end
-- Set high bidder
-- if not highBidder then
-- highBidder = RED_FONT_COLOR_CODE .. NO_BIDS .. FONT_COLOR_CODE_CLOSE
-- end
local highBidderFrame = _G[buttonName .. "HighBidder"]
highBidderFrame.fullName = ownerFullName
highBidderFrame.Name:SetText(owner)
-- this is for comparing to the player name to see if they are the owner of this auction
local ownerName
if not ownerFullName then
ownerName = owner
else
ownerName = ownerFullName
end
button.bidAmount = displayedPrice
button.buyoutPrice = buyoutPrice
button.itemCount = count
button.itemIndex = index
-- Set highlight
if GetSelectedAuctionItem("list") and ((offset + i) == GetSelectedAuctionItem("list")) then
button:LockHighlight()
if (buyoutPrice > 0) and (buyoutPrice >= minBid) then
local canBuyout = 1
if GetMoney() < buyoutPrice then
if not highBidder or GetMoney() + bidAmount < buyoutPrice then
canBuyout = nil
end
end
if canBuyout and (ownerName ~= UnitName("player")) then
BrowseBuyoutButton:Enable()
AuctionFrame.buyoutPrice = buyoutPrice
end
else
AuctionFrame.buyoutPrice = nil
end
-- Set bid
MoneyInputFrame_SetCopper(BrowseBidPrice, requiredBid)
if not highBidder and ownerName ~= UnitName("player") and GetMoney() >= MoneyInputFrame_GetCopper(BrowseBidPrice) and MoneyInputFrame_GetCopper(BrowseBidPrice) <= MAXIMUM_BID_PRICE then
BrowseBidButton:Enable()
end
else
button:UnlockHighlight()
end
end
end
-- Update scrollFrame
-- If more than one page of auctions show the next and prev arrows when the scrollframe is scrolled all the way down
if totalAuctions > NUM_AUCTION_ITEMS_PER_PAGE then
BrowsePrevPageButton.isEnabled = (AuctionFrameBrowse.page ~= 0)
BrowseNextPageButton.isEnabled = (AuctionFrameBrowse.page ~= (math_ceil(totalAuctions / NUM_AUCTION_ITEMS_PER_PAGE) - 1))
else
BrowsePrevPageButton.isEnabled = false
BrowseNextPageButton.isEnabled = false
end
FauxScrollFrame_Update(BrowseScrollFrame, numBatchAuctions, NUM_BROWSE_TO_DISPLAY, AUCTIONS_BUTTON_HEIGHT)
end
end
addonTable.AuctionFrameBrowse_Update = AuctionFrameBrowse_Update_