forked from TheMouseNest/Auctionator
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAuctionatorHints.lua
More file actions
executable file
·663 lines (497 loc) · 19.9 KB
/
AuctionatorHints.lua
File metadata and controls
executable file
·663 lines (497 loc) · 19.9 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
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
local addonName, addonTable = ...;
local ZT = addonTable.ztt.ZT;
local zc = addonTable.zc;
local zz = zc.md;
local _
local ItemUpgradeInfo = LibStub( 'LibItemUpgradeInfo-1.0' )
-----------------------------------------
local auctionator_orig_GameTooltip_OnTooltipAddMoney;
-----------------------------------------
function auctionator_GameTooltip_OnTooltipAddMoney (self, cost, maxcost)
if (AUCTIONATOR_V_TIPS == 1) then
return;
end
auctionator_orig_GameTooltip_OnTooltipAddMoney (self, cost, maxcost);
end
-----------------------------------------
function Atr_Hook_OnTooltipAddMoney()
auctionator_orig_GameTooltip_OnTooltipAddMoney = GameTooltip_OnTooltipAddMoney;
GameTooltip_OnTooltipAddMoney = auctionator_GameTooltip_OnTooltipAddMoney;
end
------------------------------------------------
local function Atr_AppendHint (results, price, text, volume)
if (price and price > 0) then
local e = {};
e.price = price;
e.text = text;
e.volume = volume;
table.insert (results, e);
end
end
------------------------------------------------
function Atr_BuildHints (itemName, itemLink)
local results = {};
if (itemLink == nil and itemName == nil) then
return results;
end
-- The Undermine Journal
if (TUJMarketInfo) then
local id = zc.RawItemIDfromLink (itemLink);
local tujData = {}
TUJMarketInfo (tonumber(id), tujData)
local rawStdDevServer = tujData['stddev']
local rawStdDevGlobal = tujData['globalStdDev']
local stdDevServer = "???"
if (rawStdDevServer) then
stdDevServer = zc.priceToString (rawStdDevServer)
end
local stdDevGlobal = "???"
if (rawStdDevGlobal) then
stdDevGlobal = zc.priceToString (rawStdDevGlobal)
end
Atr_AppendHint (results, tujData['globalMean'], ZT("Undermine global avg (deviation: "..stdDevGlobal.." )"));
Atr_AppendHint (results, tujData['recent'], ZT("Undermine 3-day server avg"));
Atr_AppendHint (results, tujData['market'], ZT("Undermine 14-day server avg (deviation: "..stdDevServer.." )"));
Atr_AppendHint (results, tujData['globalMedian'], ZT("Undermine global median"));
end
-- Wowecon
if (Wowecon and Wowecon.API) then
local priceG, volG, priceS, volS;
if (itemLink) then
priceG, volG = Wowecon.API.GetAuctionPrice_ByLink (itemLink, Wowecon.API.GLOBAL_PRICE)
priceS, volS = Wowecon.API.GetAuctionPrice_ByLink (itemLink, Wowecon.API.SERVER_PRICE)
else
priceG, volG = Wowecon.API.GetAuctionPrice_ByName (itemName, Wowecon.API.GLOBAL_PRICE)
priceS, volS = Wowecon.API.GetAuctionPrice_ByName (itemName, Wowecon.API.SERVER_PRICE)
end
Atr_AppendHint (results, priceG, ZT("Wowecon global price"), volG);
Atr_AppendHint (results, priceS, ZT("Wowecon server price"), volS);
end
if (itemLink) then
-- GoingPrice Wowhead
local id = zc.RawItemIDfromLink (itemLink);
id = tonumber(id);
if (GoingPrice_Wowhead_Data and GoingPrice_Wowhead_Data[id] and GoingPrice_Wowhead_SV._index) then
local index = GoingPrice_Wowhead_SV._index["Buyout price"];
if (index ~= nil) then
local price = GoingPrice_Wowhead_Data[id][index];
Atr_AppendHint (results, price, "GoingPrice - Wowhead");
end
end
-- GoingPrice Allakhazam
if (GoingPrice_Allakhazam_Data and GoingPrice_Allakhazam_Data[id] and GoingPrice_Allakhazam_SV._index) then
local index = GoingPrice_Allakhazam_SV._index["Median"];
if (index ~= nil) then
local price = GoingPrice_Allakhazam_Data[id][index];
Atr_AppendHint (results, price, "GoingPrice - Allakhazam");
end
end
end
return results;
end
-----------------------------------------
function Atr_SetMFcolor (frameName, blue)
local goldButton = _G[frameName.."GoldButton"];
local silverButton = _G[frameName.."SilverButton"];
local copperButton = _G[frameName.."CopperButton"];
if (blue) then
goldButton:SetNormalFontObject(NumberFontNormalRightATRblue);
silverButton:SetNormalFontObject(NumberFontNormalRightATRblue);
copperButton:SetNormalFontObject(NumberFontNormalRightATRblue);
else
goldButton:SetNormalFontObject(NumberFontNormalRight);
silverButton:SetNormalFontObject(NumberFontNormalRight);
copperButton:SetNormalFontObject(NumberFontNormalRight);
end
end
-----------------------------------------
function Atr_GetAuctionPrice (item) -- itemName or itemID
local itemName;
if (type (item) == "number") then
itemName = GetItemInfo (item);
else
itemName = item;
end
if (itemName == nil) then
return nil;
end
if (gAtr_ScanDB and type (gAtr_ScanDB) ~= "table") then
zc.msg_badErr ("Scanning history database appears to be corrupt")
zc.msg_badErr ("gAtr_ScanDB:", gAtr_ScanDB)
return nil
end
if ((type(gAtr_ScanDB) == "table") and gAtr_ScanDB[itemName] and gAtr_ScanDB[itemName].mr) then
return gAtr_ScanDB[itemName].mr;
end
return nil;
end
-----------------------------------------
local function Atr_CalcTextWid (price)
local wid = 15;
if (price > 9) then wid = wid + 12; end;
if (price > 99) then wid = wid + 44; end;
if (price > 999) then wid = wid + 12; end;
if (price > 9999) then wid = wid + 44; end;
if (price > 99999) then wid = wid + 12; end;
if (price > 999999) then wid = wid + 12; end;
if (price > 9999999) then wid = wid + 12; end;
if (price > 99999999) then wid = wid + 12; end;
return wid;
end
-----------------------------------------
local function Atr_GetDEitemName( itemID )
local itemName = GetItemInfo( itemID )
return itemName or Auctionator.Constants.DisenchantingItemName[ itemID ]
end
-----------------------------------------
-- same as Atr_GetAuctionPrice but understands that some "lesser" essences are
-- convertible with "greater"
function Atr_GetAuctionPriceDE( itemID )
local mapping = Auctionator.Constants.DisenchantingMatMapping[ itemID ]
if mapping then
local lesserPrice = Atr_GetAuctionPrice( Atr_GetDEitemName( itemID ))
local greaterPrice = Atr_GetAuctionPrice( Atr_GetDEitemName( mapping ))
if lesserPrice and greaterPrice and lesserPrice * 3 > greaterPrice then
return math.floor( greaterPrice / 3 )
else
return lesserPrice
end
else
return Atr_GetAuctionPrice( Atr_GetDEitemName( itemID ))
end
end
-----------------------------------------
function Auctionator.ItemLevelMatches( entry, itemLevel )
return itemLevel >= entry[ Auctionator.Constants.DisenchantingProbabilityKeys.LOW ] and
itemLevel <= entry[ Auctionator.Constants.DisenchantingProbabilityKeys.HIGH ]
end
local function Atr_FindDEentry (classID, itemRarity, itemLevel)
local itemClassTable = Auctionator.Constants.DisenchantingProbability[ classID ]
local entries = ( itemClassTable and itemClassTable[ itemRarity ] ) or {}
for index, entry in pairs( entries ) do
if Auctionator.ItemLevelMatches( entry, itemLevel ) then
return entry
end
end
end
-----------------------------------------
function Atr_AddDEDetailsToTip( tip, classID, itemRarity, itemLevel )
local entry = Atr_FindDEentry( classID, itemRarity, itemLevel )
if entry then
for x = 3, #entry, 3 do
local percent = math.floor( entry[ x ] * 100 ) / 100
local deitem = Atr_GetDEitemName( entry[ x + 2 ] )
if (percent > 0) then
tip:AddLine (" |cFFFFFFFF" .. percent .. "%|r " .. entry[ x + 1 ] .. " " .. ( deitem or '???' ))
end
end
end
end
-----------------------------------------
function Auctionator.IsNotCommon( itemRarity )
return itemRarity == Auctionator.Constants.Rarity.UNCOMMON or
itemRarity == Auctionator.Constants.Rarity.RARE or
itemRarity == Auctionator.Constants.Rarity.EPIC
end
function Auctionator.IsDisenchantable( classID )
return Atr_IsWeaponType( classID ) or Atr_IsArmorType( classID )
end
function Atr_CalcDisenchantPrice( classID, itemRarity, itemLevel)
if Auctionator.IsDisenchantable( classID ) and Auctionator.IsNotCommon( itemRarity ) then
local dePrice = 0
local ta = Atr_FindDEentry( classID, itemRarity, itemLevel )
if ta then
for x = 3, #ta, 3 do
local price = Atr_GetAuctionPriceDE( ta[ x + 2 ] )
if price then
dePrice = dePrice + ( ta[ x ] * ta[ x + 1 ] * price )
end
end
end
return math.floor( dePrice / 100 )
end
return nil
end
-----------------------------------------
function Atr_STWP_AddVendorInfo (tip, xstring, vendorPrice, auctionPrice)
if (AUCTIONATOR_V_TIPS == 1 and vendorPrice > 0) then
tip:AddDoubleLine (ZT("Vendor")..xstring, "|cFFFFFFFF"..zc.priceToMoneyString (vendorPrice))
end
end
-----------------------------------------
function Atr_STWP_AddAuctionInfo (tip, xstring, link, auctionPrice)
if AUCTIONATOR_A_TIPS == 1 then
local itemID = zc.RawItemIDfromLink (link);
itemID = tonumber(itemID);
local bondtype = Atr_GetBondType (itemID);
if (bondtype == ATR_BIND_ON_PICKUP) then
tip:AddDoubleLine (ZT("Auction")..xstring, "|cFFFFFFFF"..ZT("BOP").." ");
elseif (bondtype == ATR_BINDS_TO_ACCOUNT) then
tip:AddDoubleLine (ZT("Auction")..xstring, "|cFFFFFFFF"..ZT("BOA").." ");
elseif (bondtype == ATR_QUEST_ITEM) then
tip:AddDoubleLine (ZT("Auction")..xstring, "|cFFFFFFFF"..ZT("Quest Item").." ");
elseif (auctionPrice ~= nil) then
tip:AddDoubleLine (ZT("Auction")..xstring, "|cFFFFFFFF"..zc.priceToMoneyString (auctionPrice));
else
tip:AddDoubleLine (ZT("Auction")..xstring, "|cFFFFFFFF"..ZT("unknown").." ");
end
end
end
-----------------------------------------
function Atr_STWP_AddBasicDEInfo (tip, xstring, dePrice)
if (AUCTIONATOR_D_TIPS == 1 and dePrice ~= nil) then
if (dePrice > 0) then
tip:AddDoubleLine (ZT("Disenchant")..xstring, "|cFFFFFFFF"..zc.priceToMoneyString(dePrice));
else
tip:AddDoubleLine (ZT("Disenchant")..xstring, "|cFFFFFFFF"..ZT("unknown").." ");
end
end
end
-----------------------------------------
function Atr_STWP_GetPrices (link, num, showStackPrices, itemVendorPrice, itemName, classID, itemRarity, itemLevel)
local vendorPrice = 0;
local auctionPrice = 0;
local dePrice = nil;
if (AUCTIONATOR_V_TIPS == 1) then vendorPrice = itemVendorPrice; end;
if (AUCTIONATOR_A_TIPS == 1) then auctionPrice = Atr_GetAuctionPrice (itemName); end;
if (AUCTIONATOR_D_TIPS == 1) then dePrice = Atr_CalcDisenchantPrice (classID, itemRarity, itemLevel); end;
if (num and showStackPrices) then
if (auctionPrice) then auctionPrice = auctionPrice * num; end;
if (vendorPrice) then vendorPrice = vendorPrice * num; end;
if (dePrice) then dePrice = dePrice * num; end;
end;
if (vendorPrice == nil) then
vendorPrice = 0;
end
return vendorPrice, auctionPrice, dePrice;
end
-----------------------------------------
local item_links = {}
local pet_links = {}
function Atr_ShowTipWithPricing (tip, link, num)
if link == nil or zc.IsBattlePetLink( link ) then
if link and not pet_links[ link ] then
pet_links[ link ] = Auctionator.ItemLink:new({ item_link = link })
end
-- TODO: Once search functionality is updated to include battle pet levels,
-- add tooltip here
return
end
if Auctionator.Debug.IsOn() then
if not item_links[ link ] then
item_links[ link ] = Auctionator.ItemLink:new({ item_link = link })
end
tip:AddDoubleLine( "Auctionator ID", item_links[ link ]:IdString() )
tip:AddDoubleLine( '-', item_links[ link ].item_string )
tip:AddDoubleLine( 'ID', item_links[ link ]:GetField( Auctionator.Constants.ItemLink.ID ))
tip:AddDoubleLine( 'ENCHANT', item_links[ link ]:GetField( Auctionator.Constants.ItemLink.ENCHANT ))
tip:AddDoubleLine( 'GEM_1', item_links[ link ]:GetField( Auctionator.Constants.ItemLink.GEM_1 ))
tip:AddDoubleLine( 'GEM_2', item_links[ link ]:GetField( Auctionator.Constants.ItemLink.GEM_2 ))
tip:AddDoubleLine( 'GEM_3', item_links[ link ]:GetField( Auctionator.Constants.ItemLink.GEM_3 ))
tip:AddDoubleLine( 'GEM_4', item_links[ link ]:GetField( Auctionator.Constants.ItemLink.GEM_4 ))
tip:AddDoubleLine( 'SUFFIX_ID', item_links[ link ]:GetField( Auctionator.Constants.ItemLink.SUFFIX_ID ))
tip:AddDoubleLine( 'UNIQUE_ID', item_links[ link ]:GetField( Auctionator.Constants.ItemLink.UNIQUE_ID ))
tip:AddDoubleLine( 'LEVEL', item_links[ link ]:GetField( Auctionator.Constants.ItemLink.LEVEL ))
tip:AddDoubleLine( 'UPGRADE_ID', item_links[ link ]:GetField( Auctionator.Constants.ItemLink.UPGRADE_ID ))
tip:AddDoubleLine( 'INSTANCE_DIFFICULTY_ID', item_links[ link ]:GetField( Auctionator.Constants.ItemLink.INSTANCE_DIFFICULTY_ID ))
tip:AddDoubleLine( 'BONUS_ID_COUNT', item_links[ link ]:GetField( Auctionator.Constants.ItemLink.BONUS_ID_COUNT ))
tip:AddDoubleLine( 'BONUS_ID_1', item_links[ link ]:GetField( Auctionator.Constants.ItemLink.BONUS_ID_1 ))
tip:AddDoubleLine( 'BONUS_ID_2', item_links[ link ]:GetField( Auctionator.Constants.ItemLink.BONUS_ID_2 ))
tip:AddDoubleLine( 'BONUS_ID_3', item_links[ link ]:GetField( Auctionator.Constants.ItemLink.BONUS_ID_3 ))
tip:AddDoubleLine( 'BONUS_ID_4', item_links[ link ]:GetField( Auctionator.Constants.ItemLink.BONUS_ID_4 ))
end
-- TODO: Capture this knowledge somewhere
-- 1: name
-- 2: itemLink
-- 3: quality
-- 4: iLevel
-- 5: required Level
-- 6: itemClass String
-- 7: subClass String
-- 8: ? (int)
-- 9: WTF String
-- 10: big int
-- 11: itemVendorPrice? (big int)
-- 12: itemClass int
-- 13: subClass int
local itemName, itemLink, itemRarity, _, itemMinLevel, itemType, _, _, _, _, itemVendorPrice, classID = GetItemInfo (link);
local itemLevel = ItemUpgradeInfo:GetUpgradedItemLevel( itemLink )
local showStackPrices = IsShiftKeyDown();
if (AUCTIONATOR_SHIFT_TIPS == 2) then
showStackPrices = not IsShiftKeyDown();
end
local xstring = "";
if num and showStackPrices then
xstring = "|cFFAAAAFF x" .. num .. "|r"
end
local vendorPrice, auctionPrice, dePrice = Atr_STWP_GetPrices (link, num, showStackPrices, itemVendorPrice, itemName, classID, itemRarity, itemLevel);
-- vendor info
Atr_STWP_AddVendorInfo (tip, xstring, vendorPrice, auctionPrice)
-- auction info
Atr_STWP_AddAuctionInfo (tip, xstring, link, auctionPrice)
-- disenchanting info
Atr_STWP_AddBasicDEInfo (tip, xstring, dePrice)
local showDetails = true;
if (AUCTIONATOR_DE_DETAILS_TIPS == 1) then showDetails = IsShiftKeyDown(); end;
if (AUCTIONATOR_DE_DETAILS_TIPS == 2) then showDetails = IsControlKeyDown(); end;
if (AUCTIONATOR_DE_DETAILS_TIPS == 3) then showDetails = IsAltKeyDown(); end;
if (AUCTIONATOR_DE_DETAILS_TIPS == 4) then showDetails = false; end;
if (AUCTIONATOR_DE_DETAILS_TIPS == 5) then showDetails = true; end;
if (showDetails and dePrice ~= nil) then
Atr_AddDEDetailsToTip (tip, classID, itemRarity, itemLevel)
end
tip:Show()
end
-----------------------------------------
function Atr_InitToolTips ()
end
-----------------------------------------
hooksecurefunc (GameTooltip, "SetMerchantItem",
function(tip, index)
local _, _, _, num = GetMerchantItemInfo(index);
Atr_ShowTipWithPricing (tip, GetMerchantItemLink(index), num);
end
);
hooksecurefunc (GameTooltip, "SetBuybackItem",
function(tip, index)
local _, _, _, num = GetBuybackItemInfo(index);
Atr_ShowTipWithPricing (tip, GetBuybackItemLink(index), num);
end
);
hooksecurefunc (GameTooltip, "SetBagItem",
function(tip, bag, slot)
local _, num = GetContainerItemInfo(bag, slot);
Atr_ShowTipWithPricing (tip, GetContainerItemLink(bag, slot), num);
end
);
hooksecurefunc (GameTooltip, "SetAuctionItem",
function (tip, type, index)
local _, _, num = GetAuctionItemInfo(type, index);
Atr_ShowTipWithPricing (tip, GetAuctionItemLink(type, index), num);
end
);
hooksecurefunc (GameTooltip, "SetAuctionSellItem",
function (tip)
local name, _, count = GetAuctionSellItemInfo();
local __, link = GetItemInfo(name);
Atr_ShowTipWithPricing (tip, link, num);
end
);
hooksecurefunc (GameTooltip, "SetLootItem",
function (tip, slot)
if LootSlotHasItem(slot) then
local link, _, num = GetLootSlotLink(slot);
Atr_ShowTipWithPricing (tip, link, num);
end
end
);
hooksecurefunc (GameTooltip, "SetLootRollItem",
function (tip, slot)
local _, _, num = GetLootRollItemInfo(slot);
Atr_ShowTipWithPricing (tip, GetLootRollItemLink(slot), num);
end
);
hooksecurefunc (GameTooltip, "SetInventoryItem",
function (tip, unit, slot)
Atr_ShowTipWithPricing (tip, GetInventoryItemLink(unit, slot), GetInventoryItemCount(unit, slot));
end
);
hooksecurefunc (GameTooltip, "SetGuildBankItem",
function (tip, tab, slot)
local _, num = GetGuildBankItemInfo(tab, slot);
Atr_ShowTipWithPricing (tip, GetGuildBankItemLink(tab, slot), num);
end
);
hooksecurefunc( GameTooltip, 'SetRecipeResultItem',
function( tip, itemId )
local link = C_TradeSkillUI.GetRecipeItemLink( itemId )
local count = C_TradeSkillUI.GetRecipeNumItemsProduced( itemId )
Atr_ShowTipWithPricing( tip, link, count )
end
);
hooksecurefunc( GameTooltip, 'SetRecipeReagentItem',
function( tip, itemId, index )
local link = C_TradeSkillUI.GetRecipeReagentItemLink( itemId, index )
local count = select( 3, C_TradeSkillUI.GetRecipeReagentInfo( itemId, index ) )
Atr_ShowTipWithPricing( tip, link, count )
end
);
hooksecurefunc (GameTooltip, "SetTradePlayerItem",
function (tip, id)
local _, _, num = GetTradePlayerItemInfo(id);
Atr_ShowTipWithPricing (tip, GetTradePlayerItemLink(id), num);
end
);
hooksecurefunc (GameTooltip, "SetTradeTargetItem",
function (tip, id)
local _, _, num = GetTradeTargetItemInfo(id);
Atr_ShowTipWithPricing (tip, GetTradeTargetItemLink(id), num);
end
);
hooksecurefunc (GameTooltip, "SetQuestItem",
function (tip, type, index)
local _, _, num = GetQuestItemInfo(type, index);
Atr_ShowTipWithPricing (tip, GetQuestItemLink(type, index), num);
end
);
hooksecurefunc (GameTooltip, "SetQuestLogItem",
function (tip, type, index)
local num, _;
if type == "choice" then
_, _, num = GetQuestLogChoiceInfo(index);
else
_, _, num = GetQuestLogRewardInfo(index)
end
Atr_ShowTipWithPricing (tip, GetQuestLogItemLink(type, index), num);
end
);
hooksecurefunc (GameTooltip, "SetInboxItem",
function (tip, index, attachIndex)
if AUCTIONATOR_SHOW_MAILBOX_TIPS == 1 then
local attachmentIndex = attachIndex or 1
local _, _, _, num = GetInboxItem(index, attachmentIndex);
Atr_ShowTipWithPricing (tip, GetInboxItemLink(index, attachmentIndex), num);
end
end
);
hooksecurefunc ( "InboxFrameItem_OnEnter",
function ( self )
local itemCount = select( 8, GetInboxHeaderInfo( self.index ) )
local tooltipEnabled = AUCTIONATOR_SHOW_MAILBOX_TIPS == 1 and (
AUCTIONATOR_V_TIPS == 1 or AUCTIONATOR_A_TIPS == 1 or AUCTIONATOR_D_TIPS == 1
)
if tooltipEnabled and itemCount and itemCount > 1 then
for numIndex = 1, ATTACHMENTS_MAX_RECEIVE do
local name, _, _, num = GetInboxItem( self.index, numIndex )
if name then
local attachLink = GetInboxItemLink( self.index, numIndex ) or name
GameTooltip:AddLine( attachLink )
if num > 1 then
Atr_ShowTipWithPricing( GameTooltip, attachLink, num )
else
Atr_ShowTipWithPricing( GameTooltip, attachLink )
end
end
end
end
end
);
hooksecurefunc (GameTooltip, "SetSendMailItem",
function (tip, id)
local name, _, _, num = GetSendMailItem(id)
local name, link = GetItemInfo(name);
Atr_ShowTipWithPricing (tip, link, num);
end
);
hooksecurefunc (GameTooltip, "SetHyperlink",
function (tip, itemstring, num)
local name, link = GetItemInfo (itemstring);
Atr_ShowTipWithPricing (tip, link, num);
end
);
hooksecurefunc (ItemRefTooltip, "SetHyperlink",
function (tip, itemstring)
local name, link = GetItemInfo (itemstring);
Atr_ShowTipWithPricing (tip, link);
end
);