Compare commits
No commits in common. "68e44e534b6d61dea343eab97eef0501a80b38a2" and "34da7e292915f202a17954365aecbf3e960f3b71" have entirely different histories.
68e44e534b
...
34da7e2929
12
lb_store.lua
12
lb_store.lua
@ -17,8 +17,6 @@ local ColdStore = {}
|
|||||||
-- Livestore are new records nad records loaded from leaderboard.txt file
|
-- Livestore are new records nad records loaded from leaderboard.txt file
|
||||||
local LiveStore = {}
|
local LiveStore = {}
|
||||||
|
|
||||||
-- parse score function
|
|
||||||
local parseScore
|
|
||||||
|
|
||||||
-- GLOBAL
|
-- GLOBAL
|
||||||
-- Returns a list of all maps with records
|
-- Returns a list of all maps with records
|
||||||
@ -42,19 +40,13 @@ end
|
|||||||
rawset(_G, "lb_map_list", MapList)
|
rawset(_G, "lb_map_list", MapList)
|
||||||
|
|
||||||
-- GLOBAL
|
-- GLOBAL
|
||||||
-- Function for adding a single record from lua
|
-- Function for adding records from lua
|
||||||
local function AddColdStore(record)
|
local function AddColdStore(record)
|
||||||
ColdStore[record.map] = $ or {}
|
ColdStore[record.map] = $ or {}
|
||||||
table.insert(ColdStore[record.map], record)
|
table.insert(ColdStore[record.map], record)
|
||||||
end
|
end
|
||||||
rawset(_G, "lb_add_coldstore_record", AddColdStore)
|
rawset(_G, "lb_add_coldstore_record", AddColdStore)
|
||||||
|
|
||||||
-- GLOBAL
|
|
||||||
-- Function for adding a single record in string form from lua
|
|
||||||
local function AddColdStoreString(record)
|
|
||||||
AddColdStore(parseScore(record))
|
|
||||||
end
|
|
||||||
rawset(_G, "lb_add_coldstore_record_string", AddColdStoreString)
|
|
||||||
|
|
||||||
-- Insert mode separated records from the flat sourceTable into dest
|
-- Insert mode separated records from the flat sourceTable into dest
|
||||||
local function insertRecords(dest, sourceTable, modeSep)
|
local function insertRecords(dest, sourceTable, modeSep)
|
||||||
@ -212,7 +204,7 @@ local function score_t(map, name, skin, color, time, splits, flags, stat, checks
|
|||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
function parseScore(str)
|
local function parseScore(str)
|
||||||
-- Leaderboard is stored in the following tab separated format
|
-- Leaderboard is stored in the following tab separated format
|
||||||
-- mapnum, name, skin, color, time, splits, flags, stat
|
-- mapnum, name, skin, color, time, splits, flags, stat
|
||||||
local t = {}
|
local t = {}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env python3
|
#!/bin/python
|
||||||
import sys
|
import sys
|
||||||
from os import linesep
|
from os import linesep
|
||||||
|
|
||||||
@ -86,23 +86,20 @@ with open(coldstore_txt, "w") as f:
|
|||||||
for score in recordsList:
|
for score in recordsList:
|
||||||
f.write(score + linesep)
|
f.write(score + linesep)
|
||||||
|
|
||||||
luaA = """do
|
luaA = """local ParseScore = lb_parse_score
|
||||||
local AddColdStore = lb_add_coldstore_record_string
|
local AddColdStore = lb_add_coldstore_record
|
||||||
local records = {
|
local records = {
|
||||||
"""
|
"""
|
||||||
luaB = """ }
|
luaB = """}
|
||||||
for _, str in ipairs(records) do
|
for _, str in ipairs(records) do
|
||||||
AddColdStore(str)
|
AddColdStore(ParseScore(str))
|
||||||
end
|
|
||||||
end
|
end
|
||||||
"""
|
"""
|
||||||
# pack the records.lua file
|
# pack the records.lua file
|
||||||
with open(records_lua, "w") as f:
|
with open(records_lua, "w") as f:
|
||||||
f.write(luaA)
|
f.write(luaA)
|
||||||
for score in recordsList:
|
for score in recordsList:
|
||||||
score = score.replace("\\", "\\\\")
|
f.write("\"{}\",{}".format(score, linesep))
|
||||||
score = score.replace("\"", "\\\"")
|
|
||||||
f.write("\t\t\"{}\",{}".format(score, linesep))
|
|
||||||
f.write(luaB)
|
f.write(luaB)
|
||||||
|
|
||||||
# truncate and rewrite rejected scores to leaderboard.txt
|
# truncate and rewrite rejected scores to leaderboard.txt
|
||||||
|
Loading…
x
Reference in New Issue
Block a user