Asa@0
|
1 local addon = LibStub("AceAddon-3.0"):NewAddon("ItemAuditor", "AceConsole-3.0", "AceEvent-3.0", "AceBucket-3.0")
|
Asa@0
|
2
|
Asa@0
|
3 ItemAuditor = addon
|
Asa@0
|
4
|
Asa@0
|
5 local WHITE = "|cFFFFFFFF"
|
Asa@0
|
6 local RED = "|cFFFF0000"
|
Asa@0
|
7 local GREEN = "|cFF00FF00"
|
Asa@0
|
8 local YELLOW = "|cFFFFFF00"
|
Asa@0
|
9 local ORANGE = "|cFFFF7F00"
|
Asa@0
|
10 local TEAL = "|cFF00FF9A"
|
Asa@0
|
11 local GOLD = "|cFFFFD700"
|
Asa@0
|
12
|
Asa@0
|
13 function addon:OnInitialize()
|
Asa@0
|
14 -- declare defaults to be used in the DB
|
Asa@0
|
15 local DB_defaults = {
|
Asa@0
|
16 char = {
|
Asa@0
|
17 debug = false
|
Asa@0
|
18 },
|
Asa@0
|
19 factionrealm = {
|
Asa@0
|
20 item_account = {}
|
Asa@0
|
21 },
|
Asa@0
|
22 }
|
Asa@0
|
23 self.db = LibStub("AceDB-3.0"):New("ItemAuditorDB", DB_defaults, true)
|
Asa@0
|
24 self.db.factionrealm.backup = self.db.factionrealm.item_account
|
Asa@0
|
25
|
Asa@0
|
26 self.db.char.debug = true
|
Asa@0
|
27
|
Asa@0
|
28 --[[
|
Asa@0
|
29 Fine Thread = 510
|
Asa@0
|
30 Greater Magic Essence = 120000
|
Asa@0
|
31 Simple Kilt = 5913
|
Asa@0
|
32 Bolt of Linen Cloth = 5672
|
Asa@0
|
33 ]]
|
Asa@0
|
34
|
Asa@0
|
35 self:RegisterOptions()
|
Asa@0
|
36
|
Asa@0
|
37 self:Debug("Hello, world! OnInitialize")
|
Asa@0
|
38
|
Asa@0
|
39 self:RegisterEvent("MAIL_SHOW")
|
Asa@0
|
40 self:WatchBags()
|
Asa@0
|
41 end
|
Asa@0
|
42
|
Asa@0
|
43 function IA_tcount(tab)
|
Asa@0
|
44 local n = #tab
|
Asa@0
|
45 if (n == 0) then
|
Asa@0
|
46 for _ in pairs(tab) do
|
Asa@0
|
47 n = n + 1
|
Asa@0
|
48 end
|
Asa@0
|
49 end
|
Asa@0
|
50 return n
|
Asa@0
|
51 end
|
Asa@0
|
52
|
Asa@0
|
53
|
Asa@0
|
54 local options = {
|
Asa@0
|
55 name = "ItemAuditor",
|
Asa@0
|
56 handler = ItemAuditor,
|
Asa@0
|
57 type = 'group',
|
Asa@0
|
58 args = {
|
Asa@0
|
59 debug = {
|
Asa@0
|
60 type = "toggle",
|
Asa@0
|
61 name = "Debug",
|
Asa@0
|
62 desc = "Toggles debug messages in chat",
|
Asa@0
|
63 get = "GetDebug",
|
Asa@0
|
64 set = "SetDebug"
|
Asa@0
|
65 },
|
Asa@0
|
66 dump = {
|
Asa@0
|
67 type = "execute",
|
Asa@0
|
68 name = "dump",
|
Asa@0
|
69 desc = "dumps IA database",
|
Asa@0
|
70 func = "DumpInfo",
|
Asa@0
|
71 },
|
Asa@0
|
72 options = {
|
Asa@0
|
73 type = "execute",
|
Asa@0
|
74 name = "options",
|
Asa@0
|
75 desc = "Show Blizzard's options GUI",
|
Asa@0
|
76 func = "ShowOptionsGUI",
|
Asa@0
|
77 guiHidden = true,
|
Asa@0
|
78 },
|
Asa@0
|
79 },
|
Asa@0
|
80 }
|
Asa@0
|
81
|
Asa@0
|
82
|
Asa@0
|
83 function addon:DumpInfo()
|
Asa@0
|
84 self:Print("self.db.char")
|
Asa@0
|
85 DevTools_Dump(self.db.char)
|
Asa@0
|
86 self:Print("self.db.factionrealm")
|
Asa@0
|
87 DevTools_Dump(self.db.factionrealm)
|
Asa@0
|
88 end
|
Asa@0
|
89
|
Asa@0
|
90 function addon:RegisterOptions()
|
Asa@0
|
91 self.optionsFrame = LibStub("AceConfigDialog-3.0"):AddToBlizOptions("ItemAuditor", "ItemAuditor")
|
Asa@0
|
92
|
Asa@0
|
93 LibStub("AceConfig-3.0"):RegisterOptionsTable("ItemAuditor", options, {"ia"})
|
Asa@0
|
94
|
Asa@0
|
95 self:RegisterChatCommand("fuck", "ChatCommand")
|
Asa@0
|
96 end
|
Asa@0
|
97
|
Asa@0
|
98 function addon:GetMessage(info)
|
Asa@0
|
99 return self.message
|
Asa@0
|
100 end
|
Asa@0
|
101
|
Asa@0
|
102 function addon:SetMessage(info, newValue)
|
Asa@0
|
103 self.message = newValue
|
Asa@0
|
104 end
|
Asa@0
|
105
|
Asa@0
|
106
|
Asa@0
|
107 function addon:ShowOptionsGUI()
|
Asa@0
|
108 InterfaceOptionsFrame_OpenToCategory(self.optionsFrame)
|
Asa@0
|
109 end
|
Asa@0
|
110
|
Asa@0
|
111 function addon:GetDebug(info)
|
Asa@0
|
112 return self.db.char.debug
|
Asa@0
|
113 end
|
Asa@0
|
114
|
Asa@0
|
115 function addon:SetDebug(info, input)
|
Asa@0
|
116 self.db.char.debug = input
|
Asa@0
|
117 local value = "off"
|
Asa@0
|
118 if input then
|
Asa@0
|
119 value = "on"
|
Asa@0
|
120 end
|
Asa@0
|
121 self:Print("Debugging is now: " .. value)
|
Asa@0
|
122 end
|
Asa@0
|
123
|
Asa@0
|
124
|
Asa@0
|
125 -- ================ DEBUG ================
|
Asa@0
|
126 addon.OriginalRegisterEvent = addon.RegisterEvent
|
Asa@0
|
127 addon.OriginalUnregisterEvent = addon.UnregisterEvent
|
Asa@0
|
128
|
Asa@0
|
129 function addon:RegisterEvent(event, callback, arg)
|
Asa@0
|
130 self:Debug("RegisterEvent " .. event )
|
Asa@0
|
131 if arg ~= nil then
|
Asa@0
|
132 addon:OriginalRegisterEvent(event, callback, arg)
|
Asa@0
|
133 elseif callback ~= nil then
|
Asa@0
|
134 addon:OriginalRegisterEvent(event, callback)
|
Asa@0
|
135 else
|
Asa@0
|
136 addon:OriginalRegisterEvent(event)
|
Asa@0
|
137 end
|
Asa@0
|
138 end
|
Asa@0
|
139
|
Asa@0
|
140 function addon:UnregisterEvent(event)
|
Asa@0
|
141 self:Debug("UnregisterEvent " .. event )
|
Asa@0
|
142 addon:OriginalUnregisterEvent (event)
|
Asa@0
|
143 end
|
Asa@0
|
144
|
Asa@0
|
145 -- ================ DEBUG ================
|
Asa@0
|
146
|
Asa@0
|
147 function addon:FormatMoney(money)
|
Asa@0
|
148 return Altoholic:GetMoneyString(money, WHITE, false)
|
Asa@0
|
149 end
|
Asa@0
|
150
|
Asa@0
|
151 function addon:GetCurrentInventory()
|
Asa@0
|
152 local i = {}
|
Asa@0
|
153 local link
|
Asa@0
|
154
|
Asa@0
|
155 for bagID = 0, NUM_BAG_SLOTS do
|
Asa@0
|
156 bagSize=GetContainerNumSlots(bagID)
|
Asa@0
|
157 for slotID = 0, bagSize do
|
Asa@0
|
158 itemID = GetContainerItemID(bagID, slotID);
|
Asa@0
|
159
|
Asa@0
|
160 if itemID ~= nil then
|
Asa@0
|
161 _, itemCount, _, _, _= GetContainerItemInfo(bagID, slotID);
|
Asa@0
|
162 name = GetItemInfo(itemID)
|
Asa@0
|
163 if i[name] == nil then
|
Asa@0
|
164 i[name] = 0
|
Asa@0
|
165 end
|
Asa@0
|
166 i[name] = i[name] + (itemCount or 0)
|
Asa@0
|
167 end
|
Asa@0
|
168
|
Asa@0
|
169 end
|
Asa@0
|
170
|
Asa@0
|
171 end
|
Asa@0
|
172 return {items = i, money = GetMoney()}
|
Asa@0
|
173 end
|
Asa@0
|
174
|
Asa@0
|
175 function addon:GetInventoryDiff(pastInventory, current)
|
Asa@0
|
176 if current == nil then
|
Asa@0
|
177 current = self:GetCurrentInventory()
|
Asa@0
|
178 end
|
Asa@0
|
179 local diff = {}
|
Asa@0
|
180
|
Asa@0
|
181 for name, count in pairs(current.items) do
|
Asa@0
|
182 if pastInventory.items[name] == nil then
|
Asa@0
|
183 diff[name] = count
|
Asa@0
|
184 self:Debug("1 diff[" .. name .. "]=" .. diff[name])
|
Asa@0
|
185 elseif count - pastInventory.items[name] ~= 0 then
|
Asa@0
|
186 diff[name] = count - pastInventory.items[name]
|
Asa@0
|
187 self:Debug("2 diff[" .. name .. "]=" .. diff[name])
|
Asa@0
|
188 end
|
Asa@0
|
189 end
|
Asa@0
|
190
|
Asa@0
|
191 for name, count in pairs(pastInventory.items) do
|
Asa@0
|
192 if current.items[name] == nil then
|
Asa@0
|
193 diff[name] = -count
|
Asa@0
|
194 self:Debug("3 diff[" .. name .. "]=" .. diff[name])
|
Asa@0
|
195 elseif current.items[name] - count ~= 0 then
|
Asa@0
|
196 diff[name] = current.items[name] - pastInventory.items[name]
|
Asa@0
|
197 self:Debug("4 diff[" .. name .. "]=" .. diff[name])
|
Asa@0
|
198 end
|
Asa@0
|
199 end
|
Asa@0
|
200
|
Asa@0
|
201 local moneyDiff = current.money - pastInventory.money
|
Asa@0
|
202
|
Asa@0
|
203 return {items = diff, money = moneyDiff}
|
Asa@0
|
204 end
|
Asa@0
|
205
|
Asa@0
|
206
|
Asa@0
|
207 function addon:ScanMail()
|
Asa@0
|
208 local results = {}
|
Asa@0
|
209 for mailIndex = 1, GetInboxNumItems() or 0 do
|
Asa@0
|
210 local sender, msgSubject, msgMoney, msgCOD, _, msgItem, _, _, msgText, _, isGM = select(3, GetInboxHeaderInfo(mailIndex))
|
Asa@0
|
211 local mailType = Postal:GetMailType(msgSubject)
|
Asa@0
|
212
|
Asa@0
|
213 if mailType == "NonAHMail" then
|
Asa@0
|
214 -- Don't know how to handle these yet
|
Asa@0
|
215 elseif mailType == "AHSuccess" then
|
Asa@0
|
216 local invoiceType, itemName, playerName, bid, buyout, deposit, consignment = GetInboxInvoiceInfo(mailIndex);
|
Asa@0
|
217 if results[itemName] == nil then
|
Asa@0
|
218 results[itemName] = 0
|
Asa@0
|
219 end
|
Asa@0
|
220 results[itemName] = results[itemName] + deposit + buyout - consignment
|
Asa@0
|
221
|
Asa@0
|
222 elseif mailType == "AHWon" then
|
Asa@0
|
223 local invoiceType, itemName, playerName, bid, buyout, deposit, consignment = GetInboxInvoiceInfo(mailIndex);
|
Asa@0
|
224 if results[itemName] == nil then
|
Asa@0
|
225 results[itemName] = 0
|
Asa@0
|
226 end
|
Asa@0
|
227 results[itemName] = results[itemName] - bid
|
Asa@0
|
228 elseif mailType == "AHExpired" or mailType == "AHCancelled" then
|
Asa@0
|
229 -- These should be handled when you pay the deposit at the AH
|
Asa@0
|
230 else
|
Asa@0
|
231 self:Debug("Unhandled mail type: " .. mailType)
|
Asa@0
|
232 self:Debug(msgSubject)
|
Asa@0
|
233 end
|
Asa@0
|
234
|
Asa@0
|
235 end
|
Asa@0
|
236 return results
|
Asa@0
|
237 end
|
Asa@0
|
238
|
Asa@0
|
239 function addon:MAIL_SHOW()
|
Asa@0
|
240 self:Debug("MAIL_SHOW")
|
Asa@0
|
241 self.lastMailScan = self:ScanMail()
|
Asa@0
|
242 self:UnregisterEvent("MAIL_SHOW")
|
Asa@0
|
243 self:RegisterEvent("MAIL_CLOSED")
|
Asa@0
|
244 self:RegisterEvent("MAIL_INBOX_UPDATE")
|
Asa@0
|
245 self:Debug("MAIL_SHOW complete")
|
Asa@0
|
246 -- the mail scanner will handle everything
|
Asa@0
|
247 -- self:UnwatchBags()
|
Asa@0
|
248 end
|
Asa@0
|
249
|
Asa@0
|
250 function addon:MAIL_CLOSED()
|
Asa@0
|
251 addon:UnregisterEvent("MAIL_CLOSED")
|
Asa@0
|
252 self:UnregisterEvent("MAIL_INBOX_UPDATE")
|
Asa@0
|
253 self:RegisterEvent("MAIL_SHOW")
|
Asa@0
|
254 -- self:WatchBags()
|
Asa@0
|
255 end
|
Asa@0
|
256
|
Asa@0
|
257 function addon:MAIL_INBOX_UPDATE()
|
Asa@0
|
258 local newScan = addon:ScanMail()
|
Asa@0
|
259 local diff
|
Asa@0
|
260 for item, total in pairs(self.lastMailScan) do
|
Asa@0
|
261
|
Asa@0
|
262 if newScan[item] == nil then
|
Asa@0
|
263 newScan[item] = 0
|
Asa@0
|
264 end
|
Asa@0
|
265 diff = total - newScan[item]
|
Asa@0
|
266 if diff ~= 0 then
|
Asa@0
|
267 self:SaveValue(item, diff)
|
Asa@0
|
268 end
|
Asa@0
|
269
|
Asa@0
|
270 end
|
Asa@0
|
271
|
Asa@0
|
272 self.lastMailScan = newScan
|
Asa@0
|
273 end
|
Asa@0
|
274
|
Asa@0
|
275 function addon:SaveValue(item, value)
|
Asa@0
|
276 local item_account = self.db.factionrealm.item_account
|
Asa@0
|
277 if item_account[item] == nil then
|
Asa@0
|
278 item_account[item] = 0
|
Asa@0
|
279 end
|
Asa@0
|
280 item_account[item] = item_account[item] + value
|
Asa@0
|
281
|
Asa@0
|
282 if item_account[item] >= 0 then
|
Asa@0
|
283 item_account[item] = nil
|
Asa@0
|
284 end
|
Asa@0
|
285 end
|
Asa@0
|
286
|
Asa@0
|
287 function addon:OnEnable()
|
Asa@0
|
288 self:Debug("Hello, world! OnEnable")
|
Asa@0
|
289 end
|
Asa@0
|
290
|
Asa@0
|
291 function addon:Debug(msg)
|
Asa@0
|
292 if self.db.char.debug then
|
Asa@0
|
293 self:Print(msg)
|
Asa@0
|
294 end
|
Asa@0
|
295 end
|
Asa@0
|
296
|
Asa@0
|
297 function addon:WatchBags()
|
Asa@0
|
298 if self.watch_handle == nil then
|
Asa@0
|
299 self.lastInventory = self:GetCurrentInventory()
|
Asa@0
|
300 self.watch_handle = self:RegisterBucketEvent({"BAG_UPDATE", "PLAYER_MONEY"}, 0.2, "UpdateAudit")
|
Asa@0
|
301 end
|
Asa@0
|
302 end
|
Asa@0
|
303
|
Asa@0
|
304 function addon:UnwatchBags()
|
Asa@0
|
305 if self.watch_handle ~= nil then
|
Asa@0
|
306 self:UnregisterBucket(self.watch_handle)
|
Asa@0
|
307 self.watch_handle = nil
|
Asa@0
|
308 end
|
Asa@0
|
309 end
|
Asa@0
|
310
|
Asa@0
|
311 function addon:UpdateAudit()
|
Asa@0
|
312 self:Debug("UpdateAudit")
|
Asa@0
|
313 local currentInventory = self:GetCurrentInventory()
|
Asa@0
|
314 local diff = addon:GetInventoryDiff(self.lastInventory, currentInventory)
|
Asa@0
|
315 -- this is only here for debugging
|
Asa@0
|
316 self.lastdiff = diff
|
Asa@0
|
317
|
Asa@0
|
318 if abs(diff.money) > 0 and IA_tcount(diff.items) == 1 then
|
Asa@0
|
319 self:Debug("purchase or sale")
|
Asa@0
|
320
|
Asa@0
|
321 for itemName, count in pairs(diff.items) do
|
Asa@0
|
322 self:SaveValue(itemName, diff.money)
|
Asa@0
|
323 end
|
Asa@0
|
324 elseif IA_tcount(diff.items) > 1 then
|
Asa@0
|
325 local positive, negative = {}, {}
|
Asa@0
|
326 local positiveCount, negativeCount = 0, 0
|
Asa@0
|
327 for item, count in pairs(diff.items) do
|
Asa@0
|
328 if count > 0 then
|
Asa@0
|
329 positive[item] = count
|
Asa@0
|
330 positiveCount = positiveCount + count
|
Asa@0
|
331 elseif count < 0 then
|
Asa@0
|
332 negative[item] = count
|
Asa@0
|
333 negativeCount = negativeCount + abs(count)
|
Asa@0
|
334 end
|
Asa@0
|
335 end
|
Asa@0
|
336
|
Asa@0
|
337 if IA_tcount(positive) > 0 and IA_tcount(negative) > 0 then
|
Asa@0
|
338 -- we must have created/converted something
|
Asa@0
|
339 self:Debug("conversion")
|
Asa@0
|
340 local totalChange = 0
|
Asa@0
|
341 for itemName, change in pairs(negative) do
|
Asa@0
|
342 local _, itemCost, count = self:GetItemCost(itemName, change)
|
Asa@0
|
343 self:SaveValue(itemName, abs(itemCost * change))
|
Asa@0
|
344
|
Asa@0
|
345 totalChange = totalChange + abs(itemCost * change)
|
Asa@0
|
346 end
|
Asa@0
|
347
|
Asa@0
|
348 self:Debug("totalChange")
|
Asa@0
|
349 self:Debug(totalChange)
|
Asa@0
|
350
|
Asa@0
|
351 local valuePerItem = totalChange / positiveCount
|
Asa@0
|
352 self:Debug(valuePerItem )
|
Asa@0
|
353 for itemName, change in pairs(positive) do
|
Asa@0
|
354 self:Debug(itemName)
|
Asa@0
|
355 self:Debug(0-abs(valuePerItem * change))
|
Asa@0
|
356 self:SaveValue(itemName, 0-abs(valuePerItem * change))
|
Asa@0
|
357 end
|
Asa@0
|
358 end
|
Asa@0
|
359 end
|
Asa@0
|
360
|
Asa@0
|
361 self.lastInventory = currentInventory
|
Asa@0
|
362 end
|
Asa@0
|
363 -- /run ItemAuditor.db.factionrealm.item_account["Tiger Lily"] = -586625
|
Asa@0
|
364 -- /run ItemAuditor.db.factionrealm.item_account["Icy Pigment"] = -12303
|
Asa@0
|
365 -- /run ItemAuditor.db.factionrealm.item_account["Azure Pigment"] = -258357
|
Asa@0
|
366
|
Asa@0
|
367 function addon:GetItemCost(itemName, countModifier)
|
Asa@0
|
368 local invested = abs(self.db.factionrealm.item_account[itemName] or 0)
|
Asa@0
|
369
|
Asa@0
|
370 if invested > 0 then
|
Asa@0
|
371 local _, itemLink = GetItemInfo (itemName);
|
Asa@0
|
372 local _, _, _, _, Id = string.find(itemLink, "|?c?f?f?(%x*)|?H?([^:]*):?(%d+):?(%d*):?(%d*):?(%d*):?(%d*):?(%d*):?(%-?%d*):?(%-?%d*):?(%d*)|?h?%[?([^%[%]]*)%]?|?h?|?r?")
|
Asa@0
|
373 local count = Altoholic:GetItemCount(tonumber(Id))
|
Asa@0
|
374 if countModifier ~= nil then
|
Asa@0
|
375 count = count - countModifier
|
Asa@0
|
376 end
|
Asa@0
|
377 if count == 0 then
|
Asa@0
|
378 self.db.factionrealm.item_account[itemName] = nil
|
Asa@0
|
379 self:Print("You ran out of " .. itemName .. "and never recovered " .. self:FormatMoney(invested))
|
Asa@0
|
380 return 0, 0, 0
|
Asa@0
|
381 end
|
Asa@0
|
382 return ceil(invested), ceil(invested/count), count
|
Asa@0
|
383 end
|
Asa@0
|
384 return 0, 0, 0
|
Asa@0
|
385 end
|
Asa@0
|
386
|
Asa@0
|
387 function addon:ShowTooltip(tip, link, num)
|
Asa@0
|
388 if (link == nil) then
|
Asa@0
|
389 return;
|
Asa@0
|
390 end
|
Asa@0
|
391
|
Asa@0
|
392 local itemName, itemLink, itemRarity, itemLevel, itemMinLevel, itemType, _, _, _, _, itemVendorPrice = GetItemInfo (link);
|
Asa@0
|
393 -- 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@0
|
394
|
Asa@0
|
395 local investedTotal, investedPerItem, count = self:GetItemCost(itemName)
|
Asa@0
|
396
|
Asa@0
|
397 local AHCut = 0.05
|
Asa@0
|
398 local keep = 1 - AHCut
|
Asa@0
|
399
|
Asa@0
|
400 if investedTotal > 0 then
|
Asa@0
|
401 tip:AddDoubleLine("\124cffffffffIA: Total Invested", self:FormatMoney(investedTotal));
|
Asa@0
|
402 tip:AddDoubleLine("\124cffffffffIA: Invested/Item (" .. count .. ")", self:FormatMoney(ceil(investedPerItem)));
|
Asa@0
|
403 tip:AddDoubleLine("\124cffffffffIA: Minimum faction AH Price: ", self:FormatMoney(ceil(investedPerItem/keep)))
|
Asa@0
|
404 tip:Show()
|
Asa@0
|
405 end
|
Asa@0
|
406 end
|
Asa@0
|
407
|
Asa@0
|
408 local function ShowTipWithPricing(tip, link, num)
|
Asa@0
|
409 addon:ShowTooltip(tip, link, num)
|
Asa@0
|
410 end
|
Asa@0
|
411
|
Asa@0
|
412 hooksecurefunc (GameTooltip, "SetBagItem",
|
Asa@0
|
413 function(tip, bag, slot)
|
Asa@0
|
414 local _, num = GetContainerItemInfo(bag, slot);
|
Asa@0
|
415 ShowTipWithPricing (tip, GetContainerItemLink(bag, slot), num);
|
Asa@0
|
416 end
|
Asa@0
|
417 );
|
Asa@0
|
418
|
Asa@0
|
419
|
Asa@0
|
420 hooksecurefunc (GameTooltip, "SetAuctionItem",
|
Asa@0
|
421 function (tip, type, index)
|
Asa@0
|
422 ShowTipWithPricing (tip, GetAuctionItemLink(type, index));
|
Asa@0
|
423 end
|
Asa@0
|
424 );
|
Asa@0
|
425
|
Asa@0
|
426 hooksecurefunc (GameTooltip, "SetAuctionSellItem",
|
Asa@0
|
427 function (tip)
|
Asa@0
|
428 local name, _, count = GetAuctionSellItemInfo();
|
Asa@0
|
429 local __, link = GetItemInfo(name);
|
Asa@0
|
430 ShowTipWithPricing (tip, link, num);
|
Asa@0
|
431 end
|
Asa@0
|
432 );
|
Asa@0
|
433
|
Asa@0
|
434
|
Asa@0
|
435 hooksecurefunc (GameTooltip, "SetLootItem",
|
Asa@0
|
436 function (tip, slot)
|
Asa@0
|
437 if LootSlotIsItem(slot) then
|
Asa@0
|
438 local link, _, num = GetLootSlotLink(slot);
|
Asa@0
|
439 ShowTipWithPricing (tip, link, num);
|
Asa@0
|
440 end
|
Asa@0
|
441 end
|
Asa@0
|
442 );
|
Asa@0
|
443
|
Asa@0
|
444 hooksecurefunc (GameTooltip, "SetLootRollItem",
|
Asa@0
|
445 function (tip, slot)
|
Asa@0
|
446 local _, _, num = GetLootRollItemInfo(slot);
|
Asa@0
|
447 ShowTipWithPricing (tip, GetLootRollItemLink(slot), num);
|
Asa@0
|
448 end
|
Asa@0
|
449 );
|
Asa@0
|
450
|
Asa@0
|
451
|
Asa@0
|
452 hooksecurefunc (GameTooltip, "SetInventoryItem",
|
Asa@0
|
453 function (tip, unit, slot)
|
Asa@0
|
454 ShowTipWithPricing (tip, GetInventoryItemLink(unit, slot), GetInventoryItemCount(unit, slot));
|
Asa@0
|
455 end
|
Asa@0
|
456 );
|
Asa@0
|
457
|
Asa@0
|
458 hooksecurefunc (GameTooltip, "SetGuildBankItem",
|
Asa@0
|
459 function (tip, tab, slot)
|
Asa@0
|
460 local _, num = GetGuildBankItemInfo(tab, slot);
|
Asa@0
|
461 ShowTipWithPricing (tip, GetGuildBankItemLink(tab, slot), num);
|
Asa@0
|
462 end
|
Asa@0
|
463 );
|
Asa@0
|
464
|
Asa@0
|
465 hooksecurefunc (GameTooltip, "SetTradeSkillItem",
|
Asa@0
|
466 function (tip, skill, id)
|
Asa@0
|
467 local link = GetTradeSkillItemLink(skill);
|
Asa@0
|
468 local num = GetTradeSkillNumMade(skill);
|
Asa@0
|
469 if id then
|
Asa@0
|
470 link = GetTradeSkillReagentItemLink(skill, id);
|
Asa@0
|
471 num = select (3, GetTradeSkillReagentInfo(skill, id));
|
Asa@0
|
472 end
|
Asa@0
|
473
|
Asa@0
|
474 ShowTipWithPricing (tip, link, num);
|
Asa@0
|
475 end
|
Asa@0
|
476 );
|
Asa@0
|
477
|
Asa@0
|
478 hooksecurefunc (GameTooltip, "SetTradePlayerItem",
|
Asa@0
|
479 function (tip, id)
|
Asa@0
|
480 local _, _, num = GetTradePlayerItemInfo(id);
|
Asa@0
|
481 ShowTipWithPricing (tip, GetTradePlayerItemLink(id), num);
|
Asa@0
|
482 end
|
Asa@0
|
483 );
|
Asa@0
|
484
|
Asa@0
|
485 hooksecurefunc (GameTooltip, "SetTradeTargetItem",
|
Asa@0
|
486 function (tip, id)
|
Asa@0
|
487 local _, _, num = GetTradeTargetItemInfo(id);
|
Asa@0
|
488 ShowTipWithPricing (tip, GetTradeTargetItemLink(id), num);
|
Asa@0
|
489 end
|
Asa@0
|
490 );
|
Asa@0
|
491
|
Asa@0
|
492 hooksecurefunc (GameTooltip, "SetQuestItem",
|
Asa@0
|
493 function (tip, type, index)
|
Asa@0
|
494 local _, _, num = GetQuestItemInfo(type, index);
|
Asa@0
|
495 ShowTipWithPricing (tip, GetQuestItemLink(type, index), num);
|
Asa@0
|
496 end
|
Asa@0
|
497 );
|
Asa@0
|
498
|
Asa@0
|
499 hooksecurefunc (GameTooltip, "SetQuestLogItem",
|
Asa@0
|
500 function (tip, type, index)
|
Asa@0
|
501 local num, _;
|
Asa@0
|
502 if type == "choice" then
|
Asa@0
|
503 _, _, num = GetQuestLogChoiceInfo(index);
|
Asa@0
|
504 else
|
Asa@0
|
505 _, _, num = GetQuestLogRewardInfo(index)
|
Asa@0
|
506 end
|
Asa@0
|
507
|
Asa@0
|
508 ShowTipWithPricing (tip, GetQuestLogItemLink(type, index), num);
|
Asa@0
|
509 end
|
Asa@0
|
510 );
|
Asa@0
|
511
|
Asa@0
|
512 hooksecurefunc (GameTooltip, "SetInboxItem",
|
Asa@0
|
513 function (tip, index, attachIndex)
|
Asa@0
|
514 local _, _, num = GetInboxItem(index, attachIndex);
|
Asa@0
|
515 ShowTipWithPricing (tip, GetInboxItemLink(index, attachIndex), num);
|
Asa@0
|
516 end
|
Asa@0
|
517 );
|
Asa@0
|
518
|
Asa@0
|
519 hooksecurefunc (GameTooltip, "SetSendMailItem",
|
Asa@0
|
520 function (tip, id)
|
Asa@0
|
521 local name, _, num = GetSendMailItem(id)
|
Asa@0
|
522 local name, link = GetItemInfo(name);
|
Asa@0
|
523 ShowTipWithPricing (tip, link, num);
|
Asa@0
|
524 end
|
Asa@0
|
525 );
|
Asa@0
|
526
|
Asa@0
|
527 hooksecurefunc (GameTooltip, "SetHyperlink",
|
Asa@0
|
528 function (tip, itemstring, num)
|
Asa@0
|
529 local name, link = GetItemInfo (itemstring);
|
Asa@0
|
530 ShowTipWithPricing (tip, link, num);
|
Asa@0
|
531 end
|
Asa@0
|
532 );
|
Asa@0
|
533
|
Asa@0
|
534 hooksecurefunc (ItemRefTooltip, "SetHyperlink",
|
Asa@0
|
535 function (tip, itemstring)
|
Asa@0
|
536 local name, link = GetItemInfo (itemstring);
|
Asa@0
|
537 ShowTipWithPricing (tip, link);
|
Asa@0
|
538 end
|
Asa@0
|
539 );
|