vanilla-wow-addons – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | --[[ |
2 | Auctioneer Addon for World of Warcraft(tm). |
||
3 | Version: 3.9.0.1000 (Kangaroo) |
||
4 | Revision: $Id: AucCore.lua 997 2006-09-12 02:07:48Z mentalpower $ |
||
5 | |||
6 | Auctioneer core functions and variables. |
||
7 | Functions central to the major operation of Auctioneer. |
||
8 | |||
9 | License: |
||
10 | This program is free software; you can redistribute it and/or |
||
11 | modify it under the terms of the GNU General Public License |
||
12 | as published by the Free Software Foundation; either version 2 |
||
13 | of the License, or (at your option) any later version. |
||
14 | |||
15 | This program is distributed in the hope that it will be useful, |
||
16 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||
18 | GNU General Public License for more details. |
||
19 | |||
20 | You should have received a copy of the GNU General Public License |
||
21 | along with this program(see GPL.txt); if not, write to the Free Software |
||
22 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
||
23 | ]] |
||
24 | |||
25 | --Local function prototypes |
||
26 | local getItemData, getItemDataByID, storeMedianList, loadMedianList, getAuctionPriceItem, saveAuctionPriceItem, getAuctionBuyoutHistory, getAuctionPrices, getItemSignature, getItemCategory, isPlayerMade, getInfo, getSnapshot, getSnapshotFromData, getSnapshotInfo, getSnapshotInfoFromData, saveSnapshot, saveSnapshotInfo, addonLoaded, hookAuctionHouse, lockAndLoad; |
||
27 | |||
28 | --Local variables |
||
29 | |||
30 | -- Counter to count the total number of auctions scanned |
||
31 | local totalAuctionsScannedCount = 0; |
||
32 | local newAuctionsCount = 0; |
||
33 | local oldAuctionsCount = 0; |
||
34 | local defunctAuctionsCount = 0; |
||
35 | |||
36 | -- Auction scan start time counter |
||
37 | local auctionScanStart = 0; |
||
38 | |||
39 | -- Temp table that is copied into AHSnapshotItemPrices only when a scan fully completes |
||
40 | local snapshotItemPrices = {}; |
||
41 | |||
42 | --Local constants |
||
43 | local maxAllowedFormatInt = 2000000000; -- numbers much greater than this overflow when using format("%d") --MAX_ALLOWED_FORMAT_INT |
||
44 | |||
45 | -- Auction time constants |
||
46 | --Auctioneer.Core.Constants.TimeLeft. |
||
47 | local timeLeft = { |
||
48 | Short = 1; --TIME_LEFT_SHORT |
||
49 | Medium = 2; --TIME_LEFT_MEDIUM |
||
50 | Long = 3; --TIME_LEFT_LONG |
||
51 | VeryLong = 4; --TIME_LEFT_VERY_LONG |
||
52 | |||
53 | Seconds = { --TIME_LEFT_SECONDS |
||
54 | [0] = 0, -- Could expire any second... the current bid is relatively accurate. |
||
55 | [1] = 1800, -- If it disappears within 30 mins of last seing it, it was BO'd |
||
56 | [2] = 7200, -- Ditto but for 2 hours. |
||
57 | [3] = 28800, -- 8 hours. |
||
58 | [4] = 86400, -- 24 hours. |
||
59 | } |
||
60 | } |
||
61 | |||
62 | -- Item quality constants |
||
63 | --Auctioneer.Core.Constants.Quality |
||
64 | local quality = { |
||
65 | Legendary = 5; --QUALITY_LEGENDARY |
||
66 | Epic = 4; --QUALITY_EPIC |
||
67 | Rare = 3; --QUALITY_RARE |
||
68 | Uncommon = 2; --QUALITY_UNCOMMON |
||
69 | Common = 1; --QUALITY_COMMON |
||
70 | Poor = 0; --QUALITY_POOR |
||
71 | } |
||
72 | |||
73 | |||
74 | -- The maximum number of elements we store in our buyout prices history table |
||
75 | local maxBuyoutHistorySize = 35; |
||
76 | |||
77 | -- Min median buyout price for an item to show up in the list of items below median |
||
78 | local minProfitMargin = 5000; --MIN_PROFIT_MARGIN |
||
79 | |||
80 | -- Min median buyout price for an item to show up in the list of items below median |
||
81 | local defaultCompeteLess = 5; --DEFAULT_COMPETE_LESS |
||
82 | |||
83 | -- Min times an item must be seen before it can show up in the list of items below median |
||
84 | local minBuyoutSeenCount = 5; --MIN_BUYOUT_SEEN_COUNT |
||
85 | |||
86 | -- Max buyout price for an auction to display as a good deal item |
||
87 | local maxBuyoutPrice = 800000; --MAX_BUYOUT_PRICE |
||
88 | |||
89 | -- The default percent less, only find auctions that are at a minimum this percent less than the median |
||
90 | local minPercentLessThanHSP = 60; -- 60% default --MIN_PERCENT_LESS_THAN_HSP |
||
91 | |||
92 | -- The minimum profit/price percent that an auction needs to be displayed as a resellable auction |
||
93 | local minProfitPricePercent = 30; -- 30% default --MIN_PROFIT_PRICE_PERCENT |
||
94 | |||
95 | -- The minimum percent of bids placed on an item to be considered an "in-demand" enough item to be traded, this is only applied to Weapons and Armor and Recipies |
||
96 | local minBidPercent = 10; --MIN_BID_PERCENT |
||
97 | |||
98 | -- categories that the brokers and HSP look at the bid data for |
||
99 | -- 1 = weapon |
||
100 | -- 2 = armor |
||
101 | -- 3 = container |
||
102 | -- 4 = dissipatable |
||
103 | -- 5 = tradeskillitems |
||
104 | -- 6 = projectile |
||
105 | -- 7 = quiver |
||
106 | -- 8 = recipe |
||
107 | -- 9 = reagence |
||
108 | -- 10 = miscellaneous |
||
109 | local bidBasedCategories = {[1]=true, [2]=true, [8]=true, [10]=true} --BID_BASED_CATEGORIES |
||
110 | |||
111 | --[[ SavedVariables --]] |
||
112 | AuctionConfig = {}; --Table that stores config settings |
||
113 | Auction_DoneItems = {}; --Table to keep a record of auction items that have been scanned |
||
114 | AuctionBackup = {} --Table to backup old data which can't be converted at once |
||
115 | AuctionConfig.version = 30600; |
||
116 | |||
117 | -- Table to store our cached HSP values (since they're expensive to calculate) |
||
118 | Auctioneer_HSPCache = {}; |
||
119 | Auctioneer_Lowests = {}; |
||
120 | |||
121 | -- Default filter configuration |
||
122 | local filterDefaults = { --Auctioneer_FilterDefaults |
||
123 | ["all"] = "on", |
||
124 | ["autofill"] = "on", |
||
125 | ["embed"] = "off", |
||
126 | ["also"] = "off", |
||
127 | ["auction-click"] = "on", |
||
128 | ["show-link"] = "off", |
||
129 | ["show-embed-blankline"] = "off", |
||
130 | ["show-verbose"] = "on", |
||
131 | ["show-stats"] = "on", |
||
132 | ["show-average"] = "on", |
||
133 | ["show-median"] = "on", |
||
134 | ["show-suggest"] = "on", |
||
135 | ["show-warning"] = "on", |
||
136 | ["scan-class1"] = "on", |
||
137 | ["scan-class2"] = "on", |
||
138 | ["scan-class3"] = "on", |
||
139 | ["scan-class4"] = "on", |
||
140 | ["scan-class5"] = "on", |
||
141 | ["scan-class6"] = "on", |
||
142 | ["scan-class7"] = "on", |
||
143 | ["scan-class8"] = "on", |
||
144 | ["scan-class9"] = "on", |
||
145 | ["scan-class10"] = "on", |
||
146 | ["warn-color"] = "on", |
||
147 | ["finish-sound"] = "on", |
||
148 | ["printframe"] = 1, |
||
149 | ["last-auction-duration"] = 1440, |
||
150 | ["auction-duration"] = 3, |
||
151 | ["protect-window"] = 1, |
||
152 | ["finish"] = 0, |
||
153 | ["pct-bidmarkdown"] = 20, |
||
154 | ["pct-markup"] = 300, |
||
155 | ["pct-maxless"] = 30, |
||
156 | ["pct-nocomp"] = 2, |
||
157 | ["pct-underlow"] = 5, |
||
158 | ["pct-undermkt"] = 20, |
||
159 | ["locale"] = "default", |
||
160 | |||
161 | --AskPrice related commands |
||
162 | ["askprice"] = "on", |
||
163 | ["askprice-vendor"] = "off", |
||
164 | ["askprice-guild"] = "off", |
||
165 | ["askprice-party"] = "off", |
||
166 | ["askprice-smart"] = "off", |
||
167 | ["askprice-trigger"] = "?", |
||
168 | ["askprice-ad"] = "on", |
||
169 | ["askprice-whispers"] = "on", |
||
170 | ["askprice-word1"] = _AUCT('CmdAskPriceSmartWord1', "enUS"), --Initially set these two filters to match the stock english custom words |
||
171 | ["askprice-word2"] = _AUCT('CmdAskPriceSmartWord2', "enUS"), |
||
172 | |||
173 | -- Auction House tab UI |
||
174 | ["bid-limit"] = 1, |
||
175 | ["update-price"] = "off", |
||
176 | } |
||
177 | |||
178 | function getItemData(itemKey) |
||
179 | local itemID, itemRand, enchant = Auctioneer.Util.BreakItemKey(itemKey); |
||
180 | if (Informant) then |
||
181 | return Informant.GetItem(itemID); |
||
182 | end |
||
183 | return nil; |
||
184 | end |
||
185 | |||
186 | function getItemDataByID(itemID) |
||
187 | if (Informant) then |
||
188 | return Informant.GetItem(itemID); |
||
189 | end |
||
190 | return nil; |
||
191 | end |
||
192 | |||
193 | function storeMedianList(list) |
||
194 | local hist = ""; |
||
195 | local function GrowList(last, n) |
||
196 | if (n == 1) then |
||
197 | if (hist == "") then hist = last; |
||
198 | else hist = string.format("%s:%d", hist, last); end |
||
199 | elseif (n ~= 0) then |
||
200 | if (hist == "") then hist = string.format("%dx%d", last, n); |
||
201 | else hist = string.format("%s:%dx%d", hist, last, n); end |
||
202 | end |
||
203 | end |
||
204 | local n = 0; |
||
205 | local last = 0; |
||
206 | for pos, hPrice in pairs(list) do |
||
207 | if (pos == 1) then |
||
208 | last = hPrice; |
||
209 | elseif (hPrice ~= last) then |
||
210 | GrowList(last, n) |
||
211 | last = hPrice; |
||
212 | n = 0; |
||
213 | end |
||
214 | n = n + 1 |
||
215 | end |
||
216 | GrowList(last, n) |
||
217 | return hist; |
||
218 | end |
||
219 | |||
220 | function loadMedianList(str) |
||
221 | local splut = {}; |
||
222 | if (str) then |
||
223 | for x,c in string.gfind(str, '([^%:]*)(%:?)') do |
||
224 | local _,_,y,n = string.find(x, '(%d*)x(%d*)') |
||
225 | if (y == nil) then |
||
226 | table.insert(splut, tonumber(x)); |
||
227 | else |
||
228 | for i = 1,n do |
||
229 | table.insert(splut, tonumber(y)); |
||
230 | end |
||
231 | end |
||
232 | if (c == '') then break end |
||
233 | end |
||
234 | end |
||
235 | return splut; |
||
236 | end |
||
237 | |||
238 | -- Returns an AuctionConfig.data item from the table based on an item name |
||
239 | function getAuctionPriceItem(itemKey, from) |
||
240 | local serverFaction; |
||
241 | local auctionPriceItem, data,info; |
||
242 | |||
243 | if (from ~= nil) then serverFaction = from; |
||
244 | else serverFaction = Auctioneer.Util.GetAuctionKey(); end; |
||
245 | |||
246 | EnhTooltip.DebugPrint("Getting data from/for", serverFaction, itemKey); |
||
247 | if (AuctionConfig.data == nil) then AuctionConfig.data = {}; end |
||
248 | if (AuctionConfig.info == nil) then AuctionConfig.info = {}; end |
||
249 | if (AuctionConfig.data[serverFaction] == nil) then |
||
250 | EnhTooltip.DebugPrint("Data from serverfaction is nil"); |
||
251 | AuctionConfig.data[serverFaction] = {}; |
||
252 | else |
||
253 | data = AuctionConfig.data[serverFaction][itemKey]; |
||
254 | info = AuctionConfig.info[itemKey]; |
||
255 | end |
||
256 | |||
257 | auctionPriceItem = {}; |
||
258 | if (data) then |
||
259 | local dataItem = Auctioneer.Util.Split(data, "|"); |
||
260 | auctionPriceItem.data = dataItem[1]; |
||
261 | auctionPriceItem.buyoutPricesHistoryList = loadMedianList(dataItem[2]); |
||
262 | end |
||
263 | if (info) then |
||
264 | local infoItem = Auctioneer.Util.Split(info, "|"); |
||
265 | auctionPriceItem.category = infoItem[1]; |
||
266 | auctionPriceItem.name = infoItem[2]; |
||
267 | end |
||
268 | |||
269 | local playerMade, reqSkill, reqLevel = isPlayerMade(itemKey); |
||
270 | auctionPriceItem.playerMade = playerMade; |
||
271 | auctionPriceItem.reqSkill = reqSkill; |
||
272 | auctionPriceItem.reqLevel = reqLevel; |
||
273 | |||
274 | return auctionPriceItem; |
||
275 | end |
||
276 | |||
277 | function saveAuctionPriceItem(auctKey, itemKey, iData) |
||
278 | if (not auctKey) then return end |
||
279 | if (not itemKey) then return end |
||
280 | if (not iData) then return end |
||
281 | |||
282 | if (not AuctionConfig.info) then AuctionConfig.info = {}; end |
||
283 | if (not AuctionConfig.data) then AuctionConfig.data = {}; end |
||
284 | if (not AuctionConfig.data[auctKey]) then AuctionConfig.data[auctKey] = {}; end |
||
285 | |||
286 | local hist = storeMedianList(iData.buyoutPricesHistoryList); |
||
287 | |||
288 | AuctionConfig.data[auctKey][itemKey] = string.format("%s|%s", iData.data, hist); |
||
289 | AuctionConfig.info[itemKey] = string.format("%s|%s", iData.category, iData.name); |
||
290 | Auctioneer_Lowests = nil; |
||
291 | |||
292 | -- save median to the savedvariablesfile |
||
293 | Auctioneer.Storage.SetHistMed(auctKey, itemKey, Auctioneer.Statistic.GetMedian(iData.buyoutPricesHistoryList)) |
||
294 | end |
||
295 | |||
296 | -- Returns the auction buyout history for this item |
||
297 | function getAuctionBuyoutHistory(itemKey, auctKey) |
||
298 | local auctionItem = getAuctionPriceItem(itemKey, auctKey); |
||
299 | local buyoutHistory = {}; |
||
300 | if (auctionItem) then |
||
301 | buyoutHistory = auctionItem.buyoutPricesHistoryList; |
||
302 | end |
||
303 | return buyoutHistory; |
||
304 | end |
||
305 | |||
306 | -- Returns the parsed auction price data |
||
307 | function getAuctionPrices(priceData) |
||
308 | if (not priceData) then return 0,0,0,0,0,0,0 end |
||
309 | local i,j, count,minCount,minPrice,bidCount,bidPrice,buyCount,buyPrice = string.find(priceData, "^(%d+):(%d+):(%d+):(%d+):(%d+):(%d+):(%d+)"); |
||
310 | return Auctioneer.Util.NullSafe(count),Auctioneer.Util.NullSafe(minCount),Auctioneer.Util.NullSafe(minPrice),Auctioneer.Util.NullSafe(bidCount),Auctioneer.Util.NullSafe(bidPrice),Auctioneer.Util.NullSafe(buyCount),Auctioneer.Util.NullSafe(buyPrice); |
||
311 | end |
||
312 | |||
313 | -- Parse the data from the auction signature |
||
314 | function getItemSignature(sigData) |
||
315 | if (not sigData) then return nil end |
||
316 | for id,rprop,enchant,name,count,min,buyout,uniq in string.gfind(sigData, "(%d+):(%d+):(%d+):(.-):(%d+):(.-):(%d+):(.+)") do |
||
317 | if (name == nil) then name = ""; end |
||
318 | return tonumber(id),tonumber(rprop),tonumber(enchant),name,tonumber(count),tonumber(min),tonumber(buyout),tonumber(uniq); |
||
319 | end |
||
320 | return nil; |
||
321 | end |
||
322 | |||
323 | -- Returns the category i.e. 1, 2 for an item |
||
324 | function getItemCategory(itemKey) |
||
325 | local category; |
||
326 | local auctionItem = getAuctionPriceItem(itemKey); |
||
327 | if auctionItem then |
||
328 | category = auctionItem.category; |
||
329 | end |
||
330 | |||
331 | return category; |
||
332 | end |
||
333 | |||
334 | function isPlayerMade(itemKey, itemData) |
||
335 | if (not itemData) and (Informant) then |
||
336 | local itemID, itemRand, enchant = Auctioneer.Util.BreakItemKey(itemKey) |
||
337 | itemData = Informant.GetItem(itemID) |
||
338 | end |
||
339 | |||
340 | local reqSkill = 0 |
||
341 | local reqLevel = 0 |
||
342 | if (itemData) then |
||
343 | reqSkill = itemData.reqSkill |
||
344 | reqLevel = itemData.reqLevel |
||
345 | end |
||
346 | return (reqSkill ~= 0), reqSkill, reqLevel |
||
347 | end |
||
348 | |||
349 | function getInfo(itemKey) |
||
350 | if (not AuctionConfig.info[itemKey]) then return {}; end |
||
351 | local info = AuctionConfig.info[itemKey]; |
||
352 | local infosplit = Auctioneer.Util.Split(info, "|"); |
||
353 | local cat = tonumber(infosplit[1]); |
||
354 | local name = infosplit[2]; |
||
355 | return { |
||
356 | category = cat, |
||
357 | name = name, |
||
358 | }; |
||
359 | end |
||
360 | |||
361 | function getSnapshot(auctKey, catID, auctSig) |
||
362 | if (not catID) then catID = 0 end |
||
363 | |||
364 | if (not AuctionConfig.snap) then |
||
365 | AuctionConfig.snap = {}; |
||
366 | end |
||
367 | if (not AuctionConfig.snap[auctKey]) then |
||
368 | AuctionConfig.snap[auctKey] = {}; |
||
369 | end |
||
370 | if (not AuctionConfig.snap[auctKey][catID]) then |
||
371 | AuctionConfig.snap[auctKey][catID] = {}; |
||
372 | end |
||
373 | if (not AuctionConfig.snap[auctKey][catID][auctSig]) then |
||
374 | return nil; |
||
375 | end |
||
376 | |||
377 | local snap = AuctionConfig.snap[auctKey][catID][auctSig]; |
||
378 | return getSnapshotFromData(snap); |
||
379 | end |
||
380 | |||
381 | function getSnapshotFromData(snap) |
||
382 | if (not snap) then return nil end |
||
383 | |||
384 | for dirty,bid,level,quality,left,fseen,last,link,owner in string.gfind(snap, "(%d+);(%d+);(%d+);(%d+);(%d+);(%d+);(%d+);([^;]+);(.+)") do |
||
385 | return { |
||
386 | bidamount = tonumber(bid), |
||
387 | owner = owner, |
||
388 | dirty = dirty, |
||
389 | lastSeenTime = tonumber(last), |
||
390 | itemLink = link, |
||
391 | category = cat, |
||
392 | initialSeenTime = tonumber(fseen), |
||
393 | level = level, |
||
394 | timeLeft = tonumber(left), |
||
395 | quality = quality, |
||
396 | }; |
||
397 | end |
||
398 | return nil; |
||
399 | end |
||
400 | |||
401 | function getSnapshotInfo(auctKey, itemKey) |
||
402 | if (not AuctionConfig.sbuy) then AuctionConfig.sbuy = {}; end |
||
403 | if (not AuctionConfig.sbuy[auctKey]) then AuctionConfig.sbuy[auctKey] = {}; end |
||
404 | if (not AuctionConfig.sbuy[auctKey][itemKey]) then return nil; end |
||
405 | |||
406 | local buy = AuctionConfig.sbuy[auctKey][itemKey]; |
||
407 | return getSnapshotInfoFromData(buy); |
||
408 | end |
||
409 | |||
410 | function getSnapshotInfoFromData(buy) |
||
411 | local buysplit = loadMedianList(buy); |
||
412 | return { |
||
413 | buyoutPrices = buysplit, |
||
414 | }; |
||
415 | end |
||
416 | |||
417 | function saveSnapshot(auctKey, cat, sig, iData) |
||
418 | local bid = iData.bidamount; |
||
419 | local owner = iData.owner; |
||
420 | local dirty = iData.dirty; |
||
421 | local last = iData.lastSeenTime; |
||
422 | local link = iData.itemLink; |
||
423 | local fseen = iData.initialSeenTime; |
||
424 | local level = iData.level; |
||
425 | local left = iData.timeLeft; |
||
426 | local qual = iData.quality; |
||
427 | |||
428 | if (not cat) then cat = 0 end |
||
429 | |||
430 | if (not AuctionConfig.snap) then |
||
431 | AuctionConfig.snap = {}; |
||
432 | end |
||
433 | if (not AuctionConfig.snap[auctKey]) then |
||
434 | AuctionConfig.snap[auctKey] = {}; |
||
435 | end |
||
436 | if (not AuctionConfig.snap[auctKey][cat]) then |
||
437 | AuctionConfig.snap[auctKey][cat] = {}; |
||
438 | end |
||
439 | if (dirty~=nil and bid~=nil and level~=nil and qual~=nil and left~=nil and fseen~=nil and last~=nil and link~=nil and owner~=nil) then |
||
440 | local saveData = string.format("%d;%d;%d;%d;%d;%d;%d;%s;%s", dirty, bid, level, qual, left, fseen, last, link, owner); |
||
441 | EnhTooltip.DebugPrint("Saving", auctKey, cat, sig, "as", saveData); |
||
442 | AuctionConfig.snap[auctKey][cat][sig] = saveData; |
||
443 | local itemKey = Auctioneer.Util.GetKeyFromSig(sig); |
||
444 | Auctioneer_Lowests = nil; |
||
445 | Auctioneer.Storage.SetSnapMed(auctKey, itemKey, nil) |
||
446 | else |
||
447 | EnhTooltip.DebugPrint("Not saving", auctKey, cat, sig, "because", dirty, bid, level, qual, left, fseen, last, link, owner); |
||
448 | end |
||
449 | end |
||
450 | |||
451 | function saveSnapshotInfo(auctKey, itemKey, iData) |
||
452 | AuctionConfig.sbuy[auctKey][itemKey] = storeMedianList(iData.buyoutPrices); |
||
453 | Auctioneer_Lowests = nil; |
||
454 | |||
455 | Auctioneer.Storage.SetSnapMed(auctKey, itemKey, Auctioneer.Statistic.GetMedian(iData.buyoutPrices)) |
||
456 | end |
||
457 | |||
458 | |||
459 | function addonLoaded() |
||
460 | -- Load the category and subcategory id's |
||
461 | Auctioneer.Util.LoadCategories(); |
||
462 | |||
463 | Auctioneer.Util.SetFilterDefaults(); |
||
464 | |||
465 | if (not AuctionConfig.version) then AuctionConfig.version = 30000; end |
||
466 | if (AuctionConfig.version < 30600) then |
||
467 | StaticPopupDialogs["CONVERT_AUCTIONEER"] = { |
||
468 | text = _AUCT('MesgConvert'), |
||
469 | button1 = _AUCT('MesgConvertYes'), |
||
470 | button2 = _AUCT('MesgConvertNo'), |
||
471 | OnAccept = function() |
||
472 | Auctioneer.Convert.Convert(); |
||
473 | end, |
||
474 | OnCancel = function() |
||
475 | Auctioneer.Util.ChatPrint(_AUCT('MesgNotconverting')); |
||
476 | end, |
||
477 | timeout = 0, |
||
478 | whileDead = 1, |
||
479 | exclusive = 1 |
||
480 | }; |
||
481 | StaticPopup_Show("CONVERT_AUCTIONEER", "",""); |
||
482 | end |
||
483 | |||
484 | lockAndLoad(); |
||
485 | end |
||
486 | |||
487 | -- This is the old (local) hookAuctionHouse() function |
||
488 | function hookAuctionHouse() |
||
489 | Stubby.RegisterFunctionHook("AuctionFrame_Show", 200, Auctioneer.Scanner.AuctHouseShow); |
||
490 | Stubby.RegisterEventHook("NEW_AUCTION_UPDATE", "Auctioneer", Auctioneer.Scanner.NewAuction); |
||
491 | Stubby.RegisterEventHook("AUCTION_HOUSE_CLOSED", "Auctioneer", Auctioneer.Scanner.AuctHouseClose); |
||
492 | Stubby.RegisterEventHook("AUCTION_ITEM_LIST_UPDATE", "Auctioneer", Auctioneer.Scanner.AuctHouseUpdate); |
||
493 | |||
494 | Stubby.RegisterFunctionHook("Auctioneer.Event.ScanAuction", 200, Auctioneer.Scanner.AuctionEntryHook); |
||
495 | Stubby.RegisterFunctionHook("Auctioneer.Event.StartAuctionScan", 200, Auctioneer.Scanner.AuctionStartHook); |
||
496 | Stubby.RegisterFunctionHook("Auctioneer.Event.FinishedAuctionScan", 200, Auctioneer.Scanner.FinishedAuctionScanHook); |
||
497 | |||
498 | Stubby.RegisterFunctionHook("StartAuction", 200, Auctioneer.Scanner.StartAuction) |
||
499 | Stubby.RegisterFunctionHook("PlaceAuctionBid", 200, Auctioneer.Scanner.PlaceAuctionBid) |
||
500 | Stubby.RegisterFunctionHook("FilterButton_SetType", 200, Auctioneer.Scanner.FilterButtonSetType) |
||
501 | Stubby.RegisterFunctionHook("QueryAuctionItems", 200, Auctioneer.Scanning.QueryAuctionItemsHook) |
||
502 | Stubby.RegisterFunctionHook("AuctionsRadioButton_OnClick", 200, Auctioneer.Scanner.OnChangeAuctionDuration); |
||
503 | Stubby.RegisterFunctionHook("AuctionFrameFilters_UpdateClasses", 200, Auctioneer.Scanner.AuctionFrameFiltersUpdateClasses); |
||
504 | |||
505 | end |
||
506 | |||
507 | function lockAndLoad() |
||
508 | Stubby.RegisterFunctionHook("AuctionFrame_LoadUI", 200, Auctioneer.Scanner.ConfigureAH); |
||
509 | Stubby.RegisterFunctionHook("ContainerFrameItemButton_OnClick", -200, Auctioneer.Util.ContainerFrameItemButtonOnClick); |
||
510 | |||
511 | SLASH_AUCTIONEER1 = "/auctioneer"; |
||
512 | SLASH_AUCTIONEER2 = "/auction"; |
||
513 | SLASH_AUCTIONEER3 = "/auc"; |
||
514 | SlashCmdList["AUCTIONEER"] = Auctioneer.Command.MainHandler; |
||
515 | |||
516 | -- Rearranges elements in the AH window. |
||
517 | Auctioneer.Scanner.ConfigureAH(); |
||
518 | |||
519 | --GUI Registration code added by MentalPower |
||
520 | Auctioneer.Command.Register(); |
||
521 | |||
522 | --Init AskPrice |
||
523 | Auctioneer.AskPrice.Init(); |
||
524 | |||
525 | Auctioneer.Util.ChatPrint(string.format(_AUCT('FrmtWelcome'), Auctioneer.Version), 0.8, 0.8, 0.2); |
||
526 | |||
527 | collectgarbage() --Cleanup after that massive mem spike |
||
528 | end |
||
529 | |||
530 | Auctioneer.Core = { |
||
531 | Variables = {}, |
||
532 | Constants = {}, |
||
533 | GetItemData = getItemData, |
||
534 | GetItemDataByID = getItemDataByID, |
||
535 | StoreMedianList = storeMedianList, |
||
536 | LoadMedianList = loadMedianList, |
||
537 | GetAuctionPriceItem = getAuctionPriceItem, |
||
538 | SaveAuctionPriceItem = saveAuctionPriceItem, |
||
539 | GetAuctionBuyoutHistory = getAuctionBuyoutHistory, |
||
540 | GetAuctionPrices = getAuctionPrices, |
||
541 | GetItemSignature = getItemSignature, |
||
542 | GetItemCategory = getItemCategory, |
||
543 | IsPlayerMade = isPlayerMade, |
||
544 | GetInfo = getInfo, |
||
545 | GetSnapshot = getSnapshot, |
||
546 | GetSnapshotFromData = getSnapshotFromData, |
||
547 | GetSnapshotInfo = getSnapshotInfo, |
||
548 | GetSnapshotInfoFromData = getSnapshotInfoFromData, |
||
549 | SaveSnapshot = saveSnapshot, |
||
550 | SaveSnapshotInfo = saveSnapshotInfo, |
||
551 | AddonLoaded = addonLoaded, |
||
552 | HookAuctionHouse = hookAuctionHouse, |
||
553 | LockAndLoad = lockAndLoad, |
||
554 | } |
||
555 | |||
556 | Auctioneer.Core.Variables = { |
||
557 | TotalAuctionsScannedCount = totalAuctionsScannedCount, |
||
558 | NewAuctionsCount = newAuctionsCount, |
||
559 | OldAuctionsCount = oldAuctionsCount, |
||
560 | DefunctAuctionsCount = defunctAuctionsCount, |
||
561 | AuctionScanStart = auctionScanStart, |
||
562 | SnapshotItemPrices = snapshotItemPrices, |
||
563 | } |
||
564 | |||
565 | Auctioneer.Core.Constants = { |
||
566 | MaxAllowedFormatInt = maxAllowedFormatInt, |
||
567 | TimeLeft = timeLeft, |
||
568 | Quality = quality, |
||
569 | MaxBuyoutHistorySize = maxBuyoutHistorySize, |
||
570 | MinProfitMargin = minProfitMargin, |
||
571 | DefaultCompeteLess = defaultCompeteLess, |
||
572 | MinBuyoutSeenCount = minBuyoutSeenCount, |
||
573 | MaxBuyoutPrice = maxBuyoutPrice, |
||
574 | MinPercentLessThanHSP = minPercentLessThanHSP, |
||
575 | MinProfitPricePercent = minProfitPricePercent, |
||
576 | MinBidPercent = minBidPercent, |
||
577 | BidBasedCategories = bidBasedCategories, |
||
578 | FilterDefaults = filterDefaults, |
||
579 | } |