Asa@3
|
1 local addonName, addonTable = ...;
|
Asa@3
|
2 local addon = _G[addonName]
|
Asa@3
|
3
|
Asa@3
|
4 local utils = addonTable.utils
|
Asa@3
|
5
|
Asa@3
|
6 local function ShowTipWithPricing(tip, link, num)
|
Asa@3
|
7 if (link == nil) then
|
Asa@3
|
8 return;
|
Asa@3
|
9 end
|
Asa@3
|
10
|
Asa@3
|
11 local itemName, itemLink, itemRarity, itemLevel, itemMinLevel, itemType, _, _, _, _, itemVendorPrice = GetItemInfo (link);
|
Asa@3
|
12 -- local _, _, Color, Ltype, Id, Enchant, Gem1, Gem2, Gem3, Gem4, Suffix, Unique, LinkLvl, Name = string.find(link, "|?c?f?f?(%x*)|?H?([^:]*):?(%d+):?(%d*):?(%d*):?(%d*):?(%d*):?(%d*):?(%-?%d*):?(%-?%d*):?(%d*)|?h?%[?([^%[%]]*)%]?|?h?|?r?")
|
Asa@3
|
13
|
Asa@3
|
14 local investedTotal, investedPerItem, count = ItemAuditor:GetItemCost(itemName)
|
Asa@3
|
15
|
Asa@3
|
16 local AHCut = 0.05
|
Asa@3
|
17 local keep = 1 - AHCut
|
Asa@3
|
18
|
Asa@3
|
19 if investedTotal > 0 then
|
Asa@3
|
20 tip:AddDoubleLine("\124cffffffffIA: Total Invested", utils:FormatMoney(investedTotal));
|
Asa@3
|
21 tip:AddDoubleLine("\124cffffffffIA: Invested/Item (" .. count .. ")", utils:FormatMoney(ceil(investedPerItem)));
|
Asa@3
|
22 tip:AddDoubleLine("\124cffffffffIA: Minimum faction AH Price: ", utils:FormatMoney(ceil(investedPerItem/keep)))
|
Asa@3
|
23 tip:Show()
|
Asa@3
|
24 end
|
Asa@3
|
25 end
|
Asa@3
|
26
|
Asa@3
|
27 hooksecurefunc (GameTooltip, "SetBagItem",
|
Asa@3
|
28 function(tip, bag, slot)
|
Asa@3
|
29 local _, num = GetContainerItemInfo(bag, slot);
|
Asa@3
|
30 ShowTipWithPricing (tip, GetContainerItemLink(bag, slot), num);
|
Asa@3
|
31 end
|
Asa@3
|
32 );
|
Asa@3
|
33
|
Asa@3
|
34 hooksecurefunc (GameTooltip, "SetAuctionItem",
|
Asa@3
|
35 function (tip, type, index)
|
Asa@3
|
36 ShowTipWithPricing (tip, GetAuctionItemLink(type, index));
|
Asa@3
|
37 end
|
Asa@3
|
38 );
|
Asa@3
|
39
|
Asa@3
|
40 hooksecurefunc (GameTooltip, "SetAuctionSellItem",
|
Asa@3
|
41 function (tip)
|
Asa@3
|
42 local name, _, count = GetAuctionSellItemInfo();
|
Asa@3
|
43 local __, link = GetItemInfo(name);
|
Asa@3
|
44 ShowTipWithPricing (tip, link, num);
|
Asa@3
|
45 end
|
Asa@3
|
46 );
|
Asa@3
|
47
|
Asa@3
|
48
|
Asa@3
|
49 hooksecurefunc (GameTooltip, "SetLootItem",
|
Asa@3
|
50 function (tip, slot)
|
Asa@3
|
51 if LootSlotIsItem(slot) then
|
Asa@3
|
52 local link, _, num = GetLootSlotLink(slot);
|
Asa@3
|
53 ShowTipWithPricing (tip, link, num);
|
Asa@3
|
54 end
|
Asa@3
|
55 end
|
Asa@3
|
56 );
|
Asa@3
|
57
|
Asa@3
|
58 hooksecurefunc (GameTooltip, "SetLootRollItem",
|
Asa@3
|
59 function (tip, slot)
|
Asa@3
|
60 local _, _, num = GetLootRollItemInfo(slot);
|
Asa@3
|
61 ShowTipWithPricing (tip, GetLootRollItemLink(slot), num);
|
Asa@3
|
62 end
|
Asa@3
|
63 );
|
Asa@3
|
64
|
Asa@3
|
65
|
Asa@3
|
66 hooksecurefunc (GameTooltip, "SetInventoryItem",
|
Asa@3
|
67 function (tip, unit, slot)
|
Asa@3
|
68 ShowTipWithPricing (tip, GetInventoryItemLink(unit, slot), GetInventoryItemCount(unit, slot));
|
Asa@3
|
69 end
|
Asa@3
|
70 );
|
Asa@3
|
71
|
Asa@3
|
72 hooksecurefunc (GameTooltip, "SetGuildBankItem",
|
Asa@3
|
73 function (tip, tab, slot)
|
Asa@3
|
74 local _, num = GetGuildBankItemInfo(tab, slot);
|
Asa@3
|
75 ShowTipWithPricing (tip, GetGuildBankItemLink(tab, slot), num);
|
Asa@3
|
76 end
|
Asa@3
|
77 );
|
Asa@3
|
78
|
Asa@3
|
79 hooksecurefunc (GameTooltip, "SetTradeSkillItem",
|
Asa@3
|
80 function (tip, skill, id)
|
Asa@3
|
81 local link = GetTradeSkillItemLink(skill);
|
Asa@3
|
82 local num = GetTradeSkillNumMade(skill);
|
Asa@3
|
83 if id then
|
Asa@3
|
84 link = GetTradeSkillReagentItemLink(skill, id);
|
Asa@3
|
85 num = select (3, GetTradeSkillReagentInfo(skill, id));
|
Asa@3
|
86 end
|
Asa@3
|
87
|
Asa@3
|
88 ShowTipWithPricing (tip, link, num);
|
Asa@3
|
89 end
|
Asa@3
|
90 );
|
Asa@3
|
91
|
Asa@3
|
92 hooksecurefunc (GameTooltip, "SetTradePlayerItem",
|
Asa@3
|
93 function (tip, id)
|
Asa@3
|
94 local _, _, num = GetTradePlayerItemInfo(id);
|
Asa@3
|
95 ShowTipWithPricing (tip, GetTradePlayerItemLink(id), num);
|
Asa@3
|
96 end
|
Asa@3
|
97 );
|
Asa@3
|
98
|
Asa@3
|
99 hooksecurefunc (GameTooltip, "SetTradeTargetItem",
|
Asa@3
|
100 function (tip, id)
|
Asa@3
|
101 local _, _, num = GetTradeTargetItemInfo(id);
|
Asa@3
|
102 ShowTipWithPricing (tip, GetTradeTargetItemLink(id), num);
|
Asa@3
|
103 end
|
Asa@3
|
104 );
|
Asa@3
|
105
|
Asa@3
|
106 hooksecurefunc (GameTooltip, "SetQuestItem",
|
Asa@3
|
107 function (tip, type, index)
|
Asa@3
|
108 local _, _, num = GetQuestItemInfo(type, index);
|
Asa@3
|
109 ShowTipWithPricing (tip, GetQuestItemLink(type, index), num);
|
Asa@3
|
110 end
|
Asa@3
|
111 );
|
Asa@3
|
112
|
Asa@3
|
113 hooksecurefunc (GameTooltip, "SetQuestLogItem",
|
Asa@3
|
114 function (tip, type, index)
|
Asa@3
|
115 local num, _;
|
Asa@3
|
116 if type == "choice" then
|
Asa@3
|
117 _, _, num = GetQuestLogChoiceInfo(index);
|
Asa@3
|
118 else
|
Asa@3
|
119 _, _, num = GetQuestLogRewardInfo(index)
|
Asa@3
|
120 end
|
Asa@3
|
121
|
Asa@3
|
122 ShowTipWithPricing (tip, GetQuestLogItemLink(type, index), num);
|
Asa@3
|
123 end
|
Asa@3
|
124 );
|
Asa@3
|
125
|
Asa@3
|
126 hooksecurefunc (GameTooltip, "SetInboxItem",
|
Asa@3
|
127 function (tip, index, attachIndex)
|
Asa@3
|
128 local _, _, num = GetInboxItem(index, attachIndex);
|
Asa@3
|
129 ShowTipWithPricing (tip, GetInboxItemLink(index, attachIndex), num);
|
Asa@3
|
130 end
|
Asa@3
|
131 );
|
Asa@3
|
132
|
Asa@3
|
133 hooksecurefunc (GameTooltip, "SetSendMailItem",
|
Asa@3
|
134 function (tip, id)
|
Asa@3
|
135 local name, _, num = GetSendMailItem(id)
|
Asa@3
|
136 local name, link = GetItemInfo(name);
|
Asa@3
|
137 ShowTipWithPricing (tip, link, num);
|
Asa@3
|
138 end
|
Asa@3
|
139 );
|
Asa@3
|
140
|
Asa@3
|
141 hooksecurefunc (GameTooltip, "SetHyperlink",
|
Asa@3
|
142 function (tip, itemstring, num)
|
Asa@3
|
143 local name, link = GetItemInfo (itemstring);
|
Asa@3
|
144 ShowTipWithPricing (tip, link, num);
|
Asa@3
|
145 end
|
Asa@3
|
146 );
|
Asa@3
|
147
|
Asa@3
|
148 hooksecurefunc (ItemRefTooltip, "SetHyperlink",
|
Asa@3
|
149 function (tip, itemstring)
|
Asa@3
|
150 local name, link = GetItemInfo (itemstring);
|
Asa@3
|
151 ShowTipWithPricing (tip, link);
|
Asa@3
|
152 end
|
Asa@3
|
153 ); |