-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathMasterMerchant_Guild.lua
433 lines (372 loc) · 18.1 KB
/
MasterMerchant_Guild.lua
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
-- MasterMerchant Utility Functions File
-- Last Updated September 15, 2014
-- Written February 2015 by Chris Lasswell (@Philgo68) - [email protected]
-- Released under terms in license accompanying this file.
-- Distribution without license is prohibited!
local internal = _G["LibGuildStore_Internal"]
function MasterMerchant:CalculateCut(amount)
local listingFee, tradingHouseCut, expectedProfit = GetTradingHousePostPriceInfo(amount)
local cutAmount = zo_floor(tradingHouseCut / 2)
return cutAmount
end
local MMSeller = {
guild = {},
sellerName = '',
sales = {},
tax = {},
count = {},
stack = {},
rank = {},
outsideBuyer = false,
searchText = nil
}
function MMSeller:new(_guild, _name, _outsideBuyer, _searchText)
local o = {} -- create object if user does not provide one
setmetatable(o, self)
self.__index = self
o.guild = _guild
o.sellerName = _name
o.sales = {}
o.tax = {}
o.count = {}
o.stack = {}
o.rank = {}
o.outsideBuyer = _outsideBuyer
o.searchText = zo_strlower(_searchText or '')
return o
end
function MMSeller:addSale(rankIndex, amount, stack, sort, tax)
if sort == nil then sort = not internal.isDatabaseBusy end
if not self.sales[rankIndex] then
self.sales[rankIndex] = 0
self.tax[rankIndex] = 0
self.count[rankIndex] = 0
self.stack[rankIndex] = 0
end
self.sales[rankIndex] = self.sales[rankIndex] + amount
self.tax[rankIndex] = self.tax[rankIndex] + MasterMerchant:CalculateCut(amount)
self.count[rankIndex] = self.count[rankIndex] + 1
self.stack[rankIndex] = self.stack[rankIndex] + stack
local guildRanks = self.guild.ranks[rankIndex]
if (not self.rank[rankIndex]) then
-- add myself to the guild ranking list, then note my current place
table.insert(guildRanks, self)
self.rank[rankIndex] = #guildRanks
end
if sort then
self:SortByIndexAndRanks(rankIndex, guildRanks)
end
end
function MMSeller:SortByIndexAndRanks(rankIndex, guildRanks)
while ((self.rank[rankIndex] or 0) > 1) and (guildRanks[self.rank[rankIndex] - 1]) and ((self.sales[rankIndex] or 0) > (guildRanks[self.rank[rankIndex] - 1].sales[rankIndex] or 0)) do
local swapSeller = guildRanks[self.rank[rankIndex] - 1]
local tempRank = swapSeller.rank[rankIndex]
swapSeller.rank[rankIndex] = self.rank[rankIndex]
self.rank[rankIndex] = tempRank
-- Make sure guild lists point to the right sellers
guildRanks[self.rank[rankIndex]] = self
guildRanks[swapSeller.rank[rankIndex]] = swapSeller
end
end
function MMSeller:removeSale(rankIndex, amount, stack)
self.sales[rankIndex] = (self.sales[rankIndex] or 0) - amount
self.tax[rankIndex] = (self.tax[rankIndex] or 0) - MasterMerchant:CalculateCut(amount)
self.count[rankIndex] = (self.count[rankIndex] or 0) - 1
self.stack[rankIndex] = (self.stack[rankIndex] or 0) - stack
end
function MMSeller:removeRankIndex(rankIndex)
if (self.sales[rankIndex]) then self.sales[rankIndex] = nil end
if (self.tax[rankIndex]) then self.tax[rankIndex] = nil end
if (self.count[rankIndex]) then self.count[rankIndex] = nil end
if (self.rank[rankIndex]) then self.rank[rankIndex] = nil end
end
MMGuild = {
guildName = '',
sellers = {},
ranks = {},
sales = {},
tax = {},
count = {},
stack = {},
rankIsDirty = {},
initDateTime = GetTimeStamp(),
}
local function guild_system_offline()
local weekCutoff = 1595962800 -- Tuesday, 28-Jul-20 19:00:00 UTC
if GetWorldName() == 'EU Megaserver' then
weekCutoff = 1595941200 -- Tuesday, 28-Jul-20 13:00:00 UTC
end
while weekCutoff + (7 * ZO_ONE_DAY_IN_SECONDS) < GetTimeStamp() do
weekCutoff = weekCutoff + (7 * ZO_ONE_DAY_IN_SECONDS)
end
return weekCutoff
end
function MasterMerchant:BuildDateRangeTable()
local _, weekCutoff = GetGuildKioskCycleTimes()
local cycleTimes = {}
if weekCutoff == 0 then
-- guild system is down, do something about it
weekCutoff = guild_system_offline() -- do not subtract time because of while loop
cycleTimes.week_start = weekCutoff -- this is 7 day back already
cycleTimes.kiosk_cycle = weekCutoff + (7 * ZO_ONE_DAY_IN_SECONDS) -- add 7 days for when week would end
end
-- Calc Day Cutoff in Local Time
local dayCutoff = GetTimeStamp() - GetSecondsSinceMidnight()
cycleTimes.oneStart = dayCutoff -- Today
cycleTimes.twoStart = dayCutoff - ZO_ONE_DAY_IN_SECONDS -- Yesterday
cycleTimes.twoEnd = dayCutoff
-- This Week
cycleTimes.threeStart = weekCutoff - (7 * ZO_ONE_DAY_IN_SECONDS) -- GetGuildKioskCycleTimes() minus 7 days
cycleTimes.threeEnd = weekCutoff -- GetGuildKioskCycleTimes()
-- Last Week
cycleTimes.fourStart = cycleTimes.threeStart - (7 * ZO_ONE_DAY_IN_SECONDS) -- last week Tuesday flip
cycleTimes.fourEnd = cycleTimes.threeStart -- last week end
-- Previous Week
cycleTimes.fiveStart = cycleTimes.fourStart - (7 * ZO_ONE_DAY_IN_SECONDS)
cycleTimes.fiveEnd = cycleTimes.fourStart -- prior week end
cycleTimes.sixStart = dayCutoff - (7 * ZO_ONE_DAY_IN_SECONDS) -- last 7 days
cycleTimes.sevenStart = dayCutoff - (10 * ZO_ONE_DAY_IN_SECONDS) -- last 10 days
cycleTimes.eightStart = dayCutoff - (30 * ZO_ONE_DAY_IN_SECONDS) -- last 30 days
if MasterMerchant.systemSavedVariables.customTimeframeType == GetString(MM_CUSTOM_TIMEFRAME_HOURS) then
cycleTimes.nineStart = dayCutoff - (MasterMerchant.systemSavedVariables.customTimeframe * ZO_ONE_HOUR_IN_SECONDS) -- last x hours
cycleTimes.nineEnd = dayCutoff + (7 * ZO_ONE_DAY_IN_SECONDS)
end
if MasterMerchant.systemSavedVariables.customTimeframeType == GetString(MM_CUSTOM_TIMEFRAME_DAYS) then
cycleTimes.nineStart = dayCutoff - (MasterMerchant.systemSavedVariables.customTimeframe * ZO_ONE_DAY_IN_SECONDS) -- last x days
cycleTimes.nineEnd = dayCutoff + (7 * ZO_ONE_DAY_IN_SECONDS)
end
if MasterMerchant.systemSavedVariables.customTimeframeType == GetString(MM_CUSTOM_TIMEFRAME_WEEKS) then
cycleTimes.nineStart = dayCutoff - ((MasterMerchant.systemSavedVariables.customTimeframe * ZO_ONE_DAY_IN_SECONDS) * 7) -- last x weeks
cycleTimes.nineEnd = dayCutoff + (7 * ZO_ONE_DAY_IN_SECONDS)
end
if MasterMerchant.systemSavedVariables.customTimeframeType == GetString(MM_CUSTOM_TIMEFRAME_GUILD_WEEKS) then
cycleTimes.nineStart = weekCutoff - ((MasterMerchant.systemSavedVariables.customTimeframe * ZO_ONE_DAY_IN_SECONDS) * 7) -- last x full guild weeks
cycleTimes.nineEnd = weekCutoff
end
if cycleTimes.nineStart == nil then
-- Default custom timeframe to Last 3 days if it's undefined
MasterMerchant.systemSavedVariables.customTimeframeType = GetString(MM_CUSTOM_TIMEFRAME_DAYS)
MasterMerchant.systemSavedVariables.customTimeframe = 3
cycleTimes.nineStart = dayCutoff - (MasterMerchant.systemSavedVariables.customTimeframe * ZO_ONE_DAY_IN_SECONDS) -- last x days
cycleTimes.nineEnd = dayCutoff + (7 * ZO_ONE_DAY_IN_SECONDS)
end
MasterMerchant.dateRanges = { }
MasterMerchant.dateRanges[MM_DATERANGE_TODAY] = { }
MasterMerchant.dateRanges[MM_DATERANGE_TODAY].startTimestamp = cycleTimes.oneStart
MasterMerchant.dateRanges[MM_DATERANGE_YESTERDAY] = { }
MasterMerchant.dateRanges[MM_DATERANGE_YESTERDAY].startTimestamp = cycleTimes.twoStart
MasterMerchant.dateRanges[MM_DATERANGE_YESTERDAY].endTimestamp = cycleTimes.twoEnd
MasterMerchant.dateRanges[MM_DATERANGE_THISWEEK] = { }
MasterMerchant.dateRanges[MM_DATERANGE_THISWEEK].startTimestamp = cycleTimes.threeStart
MasterMerchant.dateRanges[MM_DATERANGE_THISWEEK].endTimestamp = cycleTimes.threeEnd
MasterMerchant.dateRanges[MM_DATERANGE_LASTWEEK] = { }
MasterMerchant.dateRanges[MM_DATERANGE_LASTWEEK].startTimestamp = cycleTimes.fourStart
MasterMerchant.dateRanges[MM_DATERANGE_LASTWEEK].endTimestamp = cycleTimes.fourEnd
MasterMerchant.dateRanges[MM_DATERANGE_PRIORWEEK] = { }
MasterMerchant.dateRanges[MM_DATERANGE_PRIORWEEK].startTimestamp = cycleTimes.fiveStart
MasterMerchant.dateRanges[MM_DATERANGE_PRIORWEEK].endTimestamp = cycleTimes.fiveEnd
MasterMerchant.dateRanges[MM_DATERANGE_7DAY] = { }
MasterMerchant.dateRanges[MM_DATERANGE_7DAY].startTimestamp = cycleTimes.sixStart
MasterMerchant.dateRanges[MM_DATERANGE_10DAY] = { }
MasterMerchant.dateRanges[MM_DATERANGE_10DAY].startTimestamp = cycleTimes.sevenStart
MasterMerchant.dateRanges[MM_DATERANGE_30DAY] = { }
MasterMerchant.dateRanges[MM_DATERANGE_30DAY].startTimestamp = cycleTimes.eightStart
MasterMerchant.dateRanges[MM_DATERANGE_CUSTOM] = { }
MasterMerchant.dateRanges[MM_DATERANGE_CUSTOM].startTimestamp = cycleTimes.nineStart
MasterMerchant.dateRanges[MM_DATERANGE_CUSTOM].endTimestamp = cycleTimes.nineEnd
end
function MMGuild:new(_name)
local o = {} -- create object if user does not provide one
setmetatable(o, self)
self.__index = self
o.guildName = _name
o.sellers = {}
o.ranks = {}
o.count = {}
o.stack = {}
o.sales = {}
o.tax = {}
o.kiosk_cycle = 0
o.week_start = 0
-- /script MasterMerchant:dm("Info", { GetGuildKioskCycleTimes() } )
-- Calc Guild Week Cutoff
local _, weekCutoff = GetGuildKioskCycleTimes()
if weekCutoff == 0 then
-- guild system is down, do something about it
weekCutoff = guild_system_offline() -- do not subtract time because of while loop
o.week_start = weekCutoff -- this is 7 day back already
o.kiosk_cycle = weekCutoff + (7 * ZO_ONE_DAY_IN_SECONDS) -- add 7 days for when week would end
end
-- Calc Day Cutoff in Local Time
local dayCutoff = GetTimeStamp() - GetSecondsSinceMidnight()
o.oneStart = dayCutoff -- Today
o.twoStart = dayCutoff - ZO_ONE_DAY_IN_SECONDS -- Yesterday
o.twoEnd = dayCutoff
-- This Week
o.threeStart = weekCutoff - (7 * ZO_ONE_DAY_IN_SECONDS) -- GetGuildKioskCycleTimes() minus 7 days
o.threeEnd = weekCutoff -- GetGuildKioskCycleTimes()
-- Last Week
o.fourStart = o.threeStart - (7 * ZO_ONE_DAY_IN_SECONDS) -- last week Tuesday flip
o.fourEnd = o.threeStart -- last week end
-- Previous Week
o.fiveStart = o.fourStart - (7 * ZO_ONE_DAY_IN_SECONDS)
o.fiveEnd = o.fourStart -- prior week end
o.sixStart = dayCutoff - (7 * ZO_ONE_DAY_IN_SECONDS) -- last 7 days
o.sevenStart = dayCutoff - (10 * ZO_ONE_DAY_IN_SECONDS) -- last 10 days
o.eightStart = dayCutoff - (30 * ZO_ONE_DAY_IN_SECONDS) -- last 30 days
if MasterMerchant.systemSavedVariables.customTimeframeType == GetString(MM_CUSTOM_TIMEFRAME_HOURS) then
o.nineStart = dayCutoff - (MasterMerchant.systemSavedVariables.customTimeframe * ZO_ONE_HOUR_IN_SECONDS) -- last x hours
o.nineEnd = dayCutoff + (7 * ZO_ONE_DAY_IN_SECONDS)
end
if MasterMerchant.systemSavedVariables.customTimeframeType == GetString(MM_CUSTOM_TIMEFRAME_DAYS) then
o.nineStart = dayCutoff - (MasterMerchant.systemSavedVariables.customTimeframe * ZO_ONE_DAY_IN_SECONDS) -- last x days
o.nineEnd = dayCutoff + (7 * ZO_ONE_DAY_IN_SECONDS)
end
if MasterMerchant.systemSavedVariables.customTimeframeType == GetString(MM_CUSTOM_TIMEFRAME_WEEKS) then
o.nineStart = dayCutoff - ((MasterMerchant.systemSavedVariables.customTimeframe * ZO_ONE_DAY_IN_SECONDS) * 7) -- last x weeks
o.nineEnd = dayCutoff + (7 * ZO_ONE_DAY_IN_SECONDS)
end
if MasterMerchant.systemSavedVariables.customTimeframeType == GetString(MM_CUSTOM_TIMEFRAME_GUILD_WEEKS) then
o.nineStart = weekCutoff - ((MasterMerchant.systemSavedVariables.customTimeframe * ZO_ONE_DAY_IN_SECONDS) * 7) -- last x full guild weeks
o.nineEnd = weekCutoff
end
if o.nineStart == nil then
-- Default custom timeframe to Last 3 days if it's undefined
MasterMerchant.systemSavedVariables.customTimeframeType = GetString(MM_CUSTOM_TIMEFRAME_DAYS)
MasterMerchant.systemSavedVariables.customTimeframe = 3
o.nineStart = dayCutoff - (MasterMerchant.systemSavedVariables.customTimeframe * ZO_ONE_DAY_IN_SECONDS) -- last x days
o.nineEnd = dayCutoff + (7 * ZO_ONE_DAY_IN_SECONDS)
end
return o
end
function MMGuild:CreateGuildDataMap(map, key)
if map[key] == nil then
map[key] = MMGuild:new(key)
end
return map[key]
end
function MMGuild:addSale(sellerName, rankIndex, amount, stack, wasKiosk, sort, searchText)
if sort == nil then sort = not internal.isDatabaseBusy end
amount = tonumber(amount)
if type(stack) ~= 'number' then stack = 1 end
if not self.ranks[rankIndex] then
self.ranks[rankIndex] = {}
self.sales[rankIndex] = 0
self.tax[rankIndex] = 0
self.count[rankIndex] = 0
self.stack[rankIndex] = 0
end
self.sales[rankIndex] = self.sales[rankIndex] + amount
self.tax[rankIndex] = self.tax[rankIndex] + MasterMerchant:CalculateCut(amount)
self.count[rankIndex] = self.count[rankIndex] + 1
self.stack[rankIndex] = self.stack[rankIndex] + stack
self.sellers[sellerName] = self.sellers[sellerName] or MMSeller:new(self, sellerName, wasKiosk, searchText)
self.sellers[sellerName]:addSale(rankIndex, amount, stack, sort, tax)
end
function MMGuild:removeSale(sellerName, rankIndex, amount, stack)
if (self.sellers[sellerName]) then self.sellers[sellerName]:removeSale(rankIndex, amount, stack) end
self.sales[rankIndex] = (self.sales[rankIndex] or 0) - amount
self.tax[rankIndex] = (self.tax[rankIndex] or 0) - MasterMerchant:CalculateCut(amount)
self.count[rankIndex] = (self.count[rankIndex] or 0) - 1
self.stack[rankIndex] = (self.stack[rankIndex] or 0) - stack
end
function MMGuild:removeRankIndex(rankIndex)
--if (self.sellers[sellersName]) then self.sellers[sellersName]:removeRankIndex(rankIndex) end
if (self.sales[rankIndex]) then self.sales[rankIndex] = nil end
if (self.tax[rankIndex]) then self.tax[rankIndex] = nil end
if (self.count[rankIndex]) then self.count[rankIndex] = nil end
if (self.rank[rankIndex]) then self.rank[rankIndex] = nil end
end
function MMGuild:MarkDirty(rankIndex)
self.rankIsDirty[rankIndex] = true
end
function MMGuild:MarkClean(rankIndex)
self.rankIsDirty[rankIndex] = false
end
function MMGuild:IsDirty(rankIndex)
return self.rankIsDirty[rankIndex]
end
function MMGuild:addSaleByDate(sellerName, timestamp, amount, stack, wasKiosk, sort, searchText, salesId)
if sellerName == nil then return end
if timestamp == nil then return end
if type(timestamp) ~= 'number' then return end
if salesId ~= nil and not MasterMerchant:ShouldUseSale(salesId) then return end
if (timestamp >= self.oneStart) then
self:MarkDirty(MM_DATERANGE_TODAY)
self:addSale(sellerName, MM_DATERANGE_TODAY, amount, stack, wasKiosk, sort, searchText)
end
if (timestamp >= self.twoStart and timestamp < self.twoEnd) then
self:MarkDirty(MM_DATERANGE_YESTERDAY)
self:addSale(sellerName, MM_DATERANGE_YESTERDAY, amount, stack, wasKiosk, sort, searchText)
end
if (timestamp >= self.threeStart and timestamp < self.threeEnd) then
self:MarkDirty(MM_DATERANGE_THISWEEK)
self:addSale(sellerName, MM_DATERANGE_THISWEEK, amount, stack, wasKiosk, sort, searchText)
end
if (timestamp >= self.fourStart and timestamp < self.fourEnd) then
self:MarkDirty(MM_DATERANGE_LASTWEEK)
self:addSale(sellerName, MM_DATERANGE_LASTWEEK, amount, stack, wasKiosk, sort, searchText)
end
if (timestamp >= self.fiveStart and timestamp < self.fiveEnd) then
self:MarkDirty(MM_DATERANGE_PRIORWEEK)
self:addSale(sellerName, MM_DATERANGE_PRIORWEEK, amount, stack, wasKiosk, sort, searchText)
end
if (timestamp >= self.sixStart) then
self:MarkDirty(MM_DATERANGE_7DAY)
self:addSale(sellerName, MM_DATERANGE_7DAY, amount, stack, wasKiosk, sort, searchText)
end
if (timestamp >= self.sevenStart) then
self:MarkDirty(MM_DATERANGE_10DAY)
self:addSale(sellerName, MM_DATERANGE_10DAY, amount, stack, wasKiosk, sort, searchText)
end
if (timestamp >= self.eightStart) then
self:MarkDirty(MM_DATERANGE_30DAY)
self:addSale(sellerName, MM_DATERANGE_30DAY, amount, stack, wasKiosk, sort, searchText)
end
if (timestamp >= self.nineStart and timestamp < self.nineEnd) then
self:MarkDirty(MM_DATERANGE_CUSTOM)
self:addSale(sellerName, MM_DATERANGE_CUSTOM, amount, stack, wasKiosk, sort, searchText)
end
end
function MMGuild:removeSaleByDate(sellerName, timestamp, amount, stack)
if sellerName == nil then return end
if (timestamp >= self.oneStart) then self:removeSale(sellerName, MM_DATERANGE_TODAY, amount) end
if (timestamp >= self.twoStart and timestamp < self.twoEnd) then self:removeSale(sellerName, MM_DATERANGE_YESTERDAY, amount, stack) end
if (timestamp >= self.threeStart and timestamp < self.threeEnd) then self:removeSale(sellerName, MM_DATERANGE_THISWEEK, amount, stack) end
if (timestamp >= self.fourStart and timestamp < self.fourEnd) then self:removeSale(sellerName, MM_DATERANGE_LASTWEEK, amount, stack) end
if (timestamp >= self.fiveStart and timestamp < self.fiveEnd) then self:removeSale(sellerName, MM_DATERANGE_PRIORWEEK, amount, stack) end
if (timestamp >= self.sixStart) then self:removeSale(sellerName, MM_DATERANGE_7DAY, amount, stack) end
if (timestamp >= self.sevenStart) then self:removeSale(sellerName, MM_DATERANGE_10DAY, amount, stack) end
if (timestamp >= self.eightStart) then self:removeSale(sellerName, MM_DATERANGE_30DAY, amount, stack) end
if (timestamp >= self.nineStart and timestamp < self.nineEnd) then self:removeSale(sellerName, MM_DATERANGE_CUSTOM, amount, stack) end
end
function MMGuild:SortByRankIndex(rankIndex)
--if self:IsDirty(rankIndex) then
MasterMerchant.shellSort(self.ranks[rankIndex] or {}, function(sortA, sortB)
return (sortA.sales[rankIndex] or 0) > (sortB.sales[rankIndex] or 0)
end)
local i = 1
while self.ranks[rankIndex] and self.ranks[rankIndex][i] do
self.ranks[rankIndex][i].rank[rankIndex] = i
i = i + 1
end
self:MarkClean(rankIndex)
--end
end
function MMGuild:SortAllRanks()
self:SortByRankIndex(MM_DATERANGE_TODAY)
self:SortByRankIndex(MM_DATERANGE_YESTERDAY)
self:SortByRankIndex(MM_DATERANGE_THISWEEK)
self:SortByRankIndex(MM_DATERANGE_LASTWEEK)
self:SortByRankIndex(MM_DATERANGE_PRIORWEEK)
self:SortByRankIndex(MM_DATERANGE_7DAY)
self:SortByRankIndex(MM_DATERANGE_10DAY)
self:SortByRankIndex(MM_DATERANGE_30DAY)
self:SortByRankIndex(MM_DATERANGE_CUSTOM)
end
function MMGuild:addPurchaseByDate(sellerName, timestamp, amount, stack, wasKiosk, sort, searchText)
if sellerName == nil then return end
if timestamp == nil then return end
if type(timestamp) ~= 'number' then return end
self:addSale(sellerName, MM_DATERANGE_TODAY, amount, stack, wasKiosk, sort, searchText)
end