Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local list = [[
- @1929779
- @1930027
- @1975543
- @1995971
- @1995980
- @1017676
- ]]
- local maps
- do
- maps = { }
- local counter = 0
- string.gsub(list, "@(%d+)", function(code)
- counter = counter + 1
- maps[counter] = tonumber(code)
- end)
- local timer = 0
- local newGame = tfm.exec.newGame
- tfm.exec.newGame = function(...)
- if os.time() > timer then
- timer = os.time() + 3000
- return newGame(...)
- end
- end
- end
- local splitByChar = function(content, int)
- int = int or 5000
- local data = {}
- local current = 0
- while #content > current do
- current = current + (int + 1)
- data[#data + 1] = string.sub(content, current - int, current)
- end
- return data
- end
- local data = { }
- local currentRound = 1
- eventNewGame = function()
- currentRound = currentRound + 1
- local author = tfm.get.room.xmlMapInfo.author
- if not data[author] then
- data[author] = { quantity = 0, maps = { } }
- end
- data[author].quantity = data[author].quantity + 1
- data[author].maps[#data[author].maps + 1] = tfm.get.room.currentMap
- if currentRound > #maps then
- ui.setShamanName(#maps .. " / " .. #maps)
- currentRound = 0
- local copy, counter = { }, 0
- for k, v in next, data do
- counter = counter + 1
- copy[counter] = { k, v }
- end
- table.sort(copy, function(value1, value2)
- return value1[2].quantity > value2[2].quantity
- end)
- counter = 0
- local results = { }
- for info = 1, #copy do
- counter = counter + 1
- results[counter] = copy[info][1] .. " (" .. copy[info][2].quantity .. "): " .. table.concat(copy[info][2].maps, " ")
- end
- local lines = splitByChar(table.concat(results, "\n"))
- for line = 1, #lines do
- print(lines[line])
- end
- else
- ui.setShamanName(currentRound .. " / " .. #maps)
- end
- end
- tfm.exec.disableAutoNewGame()
- tfm.exec.disableAutoShaman()
- eventLoop = function()
- if currentRound > 0 then
- tfm.exec.newGame(maps[currentRound])
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment