Asa@3
|
1 local addonName, addonTable = ...;
|
Asa@3
|
2 local addon = _G[addonName]
|
Asa@3
|
3
|
Asa@3
|
4 local function ShowTipWithPricing(tip, link, num)
|
Asa@3
|
5 if (link == nil) then
|
Asa@3
|
6 return;
|
Asa@3
|
7 end
|
Asa@3
|
8
|
Asa@8
|
9 -- local itemName, itemLink, itemRarity, itemLevel, itemMinLevel, itemType, _, _, _, _, itemVendorPrice = GetItemInfo (link);
|
Asa@3
|
10 -- 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
|
11
|
Asa@8
|
12 local investedTotal, investedPerItem, count = ItemAuditor:GetItemCost(link)
|
Asa@3
|
13
|
Asa@13
|
14 local keep = 1 - addon:GetAHCut()
|
Asa@12
|
15 local show = false
|
Asa@3
|
16
|
Asa@3
|
17 if investedTotal > 0 then
|
Asa@34
|
18 local suggestColor
|
Asa@34
|
19 local ap = addon:GetAuctionPrice(link)
|
Asa@34
|
20 if ap == nil then
|
Asa@34
|
21 suggestColor = nil
|
Asa@34
|
22 elseif ap > ceil(investedPerItem/keep) then
|
Asa@34
|
23 suggestColor = "|cFF00FF00" -- green
|
Asa@34
|
24 else
|
Asa@34
|
25 suggestColor = "|cFFFF0000" -- red
|
Asa@34
|
26 end
|
Asa@34
|
27
|
Asa@34
|
28
|
Asa@15
|
29 tip:AddDoubleLine("\124cffffffffIA: Total Invested", addon:FormatMoney(investedTotal));
|
Asa@17
|
30 tip:AddDoubleLine("\124cffffffffIA: Invested per Item (own: " .. count .. ")", addon:FormatMoney(ceil(investedPerItem)));
|
Asa@34
|
31 tip:AddDoubleLine("\124cffffffffIA: Minimum " .. addon:GetAHFaction() .. " AH Price: ", addon:FormatMoney(ceil(investedPerItem/keep), suggestColor))
|
Asa@12
|
32 show = true
|
Asa@12
|
33
|
Asa@12
|
34 end
|
Asa@13
|
35
|
Asa@13
|
36 if addon:IsQAEnabled() then
|
Asa@13
|
37 local groupName = QAAPI:GetItemGroup(link)
|
Asa@13
|
38 if groupName then
|
Asa@13
|
39 local threshold = QAAPI:GetGroupThreshold(groupName)
|
Asa@15
|
40 tip:AddDoubleLine("\124cffffffffIA: QA Threshold: ", addon:FormatMoney(threshold))
|
Asa@13
|
41 show = true
|
Asa@13
|
42 end
|
Asa@12
|
43 end
|
Asa@12
|
44
|
Asa@12
|
45 if show then
|
Asa@3
|
46 tip:Show()
|
Asa@3
|
47 end
|
Asa@3
|
48 end
|
Asa@3
|
49
|
Asa@3
|
50 hooksecurefunc (GameTooltip, "SetBagItem",
|
Asa@3
|
51 function(tip, bag, slot)
|
Asa@3
|
52 local _, num = GetContainerItemInfo(bag, slot);
|
Asa@3
|
53 ShowTipWithPricing (tip, GetContainerItemLink(bag, slot), num);
|
Asa@3
|
54 end
|
Asa@3
|
55 );
|
Asa@3
|
56
|
Asa@3
|
57 hooksecurefunc (GameTooltip, "SetAuctionItem",
|
Asa@3
|
58 function (tip, type, index)
|
Asa@3
|
59 ShowTipWithPricing (tip, GetAuctionItemLink(type, index));
|
Asa@3
|
60 end
|
Asa@3
|
61 );
|
Asa@3
|
62
|
Asa@3
|
63 hooksecurefunc (GameTooltip, "SetAuctionSellItem",
|
Asa@3
|
64 function (tip)
|
Asa@3
|
65 local name, _, count = GetAuctionSellItemInfo();
|
Asa@3
|
66 local __, link = GetItemInfo(name);
|
Asa@3
|
67 ShowTipWithPricing (tip, link, num);
|
Asa@3
|
68 end
|
Asa@3
|
69 );
|
Asa@3
|
70
|
Asa@3
|
71
|
Asa@3
|
72 hooksecurefunc (GameTooltip, "SetLootItem",
|
Asa@3
|
73 function (tip, slot)
|
Asa@3
|
74 if LootSlotIsItem(slot) then
|
Asa@3
|
75 local link, _, num = GetLootSlotLink(slot);
|
Asa@3
|
76 ShowTipWithPricing (tip, link, num);
|
Asa@3
|
77 end
|
Asa@3
|
78 end
|
Asa@3
|
79 );
|
Asa@3
|
80
|
Asa@3
|
81 hooksecurefunc (GameTooltip, "SetLootRollItem",
|
Asa@3
|
82 function (tip, slot)
|
Asa@3
|
83 local _, _, num = GetLootRollItemInfo(slot);
|
Asa@3
|
84 ShowTipWithPricing (tip, GetLootRollItemLink(slot), num);
|
Asa@3
|
85 end
|
Asa@3
|
86 );
|
Asa@3
|
87
|
Asa@3
|
88
|
Asa@3
|
89 hooksecurefunc (GameTooltip, "SetInventoryItem",
|
Asa@3
|
90 function (tip, unit, slot)
|
Asa@3
|
91 ShowTipWithPricing (tip, GetInventoryItemLink(unit, slot), GetInventoryItemCount(unit, slot));
|
Asa@3
|
92 end
|
Asa@3
|
93 );
|
Asa@3
|
94
|
Asa@3
|
95 hooksecurefunc (GameTooltip, "SetGuildBankItem",
|
Asa@3
|
96 function (tip, tab, slot)
|
Asa@3
|
97 local _, num = GetGuildBankItemInfo(tab, slot);
|
Asa@3
|
98 ShowTipWithPricing (tip, GetGuildBankItemLink(tab, slot), num);
|
Asa@3
|
99 end
|
Asa@3
|
100 );
|
Asa@3
|
101
|
Asa@3
|
102 hooksecurefunc (GameTooltip, "SetTradeSkillItem",
|
Asa@3
|
103 function (tip, skill, id)
|
Asa@3
|
104 local link = GetTradeSkillItemLink(skill);
|
Asa@3
|
105 local num = GetTradeSkillNumMade(skill);
|
Asa@3
|
106 if id then
|
Asa@3
|
107 link = GetTradeSkillReagentItemLink(skill, id);
|
Asa@3
|
108 num = select (3, GetTradeSkillReagentInfo(skill, id));
|
Asa@3
|
109 end
|
Asa@3
|
110
|
Asa@3
|
111 ShowTipWithPricing (tip, link, num);
|
Asa@3
|
112 end
|
Asa@3
|
113 );
|
Asa@3
|
114
|
Asa@3
|
115 hooksecurefunc (GameTooltip, "SetTradePlayerItem",
|
Asa@3
|
116 function (tip, id)
|
Asa@3
|
117 local _, _, num = GetTradePlayerItemInfo(id);
|
Asa@3
|
118 ShowTipWithPricing (tip, GetTradePlayerItemLink(id), num);
|
Asa@3
|
119 end
|
Asa@3
|
120 );
|
Asa@3
|
121
|
Asa@3
|
122 hooksecurefunc (GameTooltip, "SetTradeTargetItem",
|
Asa@3
|
123 function (tip, id)
|
Asa@3
|
124 local _, _, num = GetTradeTargetItemInfo(id);
|
Asa@3
|
125 ShowTipWithPricing (tip, GetTradeTargetItemLink(id), num);
|
Asa@3
|
126 end
|
Asa@3
|
127 );
|
Asa@3
|
128
|
Asa@3
|
129 hooksecurefunc (GameTooltip, "SetQuestItem",
|
Asa@3
|
130 function (tip, type, index)
|
Asa@3
|
131 local _, _, num = GetQuestItemInfo(type, index);
|
Asa@3
|
132 ShowTipWithPricing (tip, GetQuestItemLink(type, index), num);
|
Asa@3
|
133 end
|
Asa@3
|
134 );
|
Asa@3
|
135
|
Asa@3
|
136 hooksecurefunc (GameTooltip, "SetQuestLogItem",
|
Asa@3
|
137 function (tip, type, index)
|
Asa@3
|
138 local num, _;
|
Asa@3
|
139 if type == "choice" then
|
Asa@3
|
140 _, _, num = GetQuestLogChoiceInfo(index);
|
Asa@3
|
141 else
|
Asa@3
|
142 _, _, num = GetQuestLogRewardInfo(index)
|
Asa@3
|
143 end
|
Asa@3
|
144
|
Asa@3
|
145 ShowTipWithPricing (tip, GetQuestLogItemLink(type, index), num);
|
Asa@3
|
146 end
|
Asa@3
|
147 );
|
Asa@3
|
148
|
Asa@3
|
149 hooksecurefunc (GameTooltip, "SetInboxItem",
|
Asa@3
|
150 function (tip, index, attachIndex)
|
Asa@3
|
151 local _, _, num = GetInboxItem(index, attachIndex);
|
Asa@3
|
152 ShowTipWithPricing (tip, GetInboxItemLink(index, attachIndex), num);
|
Asa@3
|
153 end
|
Asa@3
|
154 );
|
Asa@3
|
155
|
Asa@3
|
156 hooksecurefunc (GameTooltip, "SetSendMailItem",
|
Asa@3
|
157 function (tip, id)
|
Asa@3
|
158 local name, _, num = GetSendMailItem(id)
|
Asa@3
|
159 local name, link = GetItemInfo(name);
|
Asa@3
|
160 ShowTipWithPricing (tip, link, num);
|
Asa@3
|
161 end
|
Asa@3
|
162 );
|
Asa@3
|
163
|
Asa@3
|
164 hooksecurefunc (GameTooltip, "SetHyperlink",
|
Asa@3
|
165 function (tip, itemstring, num)
|
Asa@3
|
166 local name, link = GetItemInfo (itemstring);
|
Asa@3
|
167 ShowTipWithPricing (tip, link, num);
|
Asa@3
|
168 end
|
Asa@3
|
169 );
|
Asa@3
|
170
|
Asa@3
|
171 hooksecurefunc (ItemRefTooltip, "SetHyperlink",
|
Asa@3
|
172 function (tip, itemstring)
|
Asa@3
|
173 local name, link = GetItemInfo (itemstring);
|
Asa@3
|
174 ShowTipWithPricing (tip, link);
|
Asa@3
|
175 end
|
Asa@3
|
176 ); |