2018-04-04 18:23:46 +02:00
|
|
|
function awards.player(name)
|
|
|
|
local data = awards.players[name] or {}
|
|
|
|
awards.players[name] = data
|
|
|
|
data.name = data.name or name
|
|
|
|
data.unlocked = data.unlocked or {}
|
|
|
|
return data
|
2015-06-10 18:45:18 +02:00
|
|
|
end
|
|
|
|
|
2018-04-04 18:23:46 +02:00
|
|
|
function awards.player_or_nil(name)
|
2015-06-10 18:45:18 +02:00
|
|
|
return awards.players[name]
|
|
|
|
end
|
|
|
|
|
|
|
|
function awards._order_awards(name)
|
|
|
|
local done = {}
|
|
|
|
local retval = {}
|
|
|
|
local player = awards.player(name)
|
|
|
|
if player and player.unlocked then
|
|
|
|
for _,got in pairs(player.unlocked) do
|
|
|
|
if awards.def[got] then
|
|
|
|
done[got] = true
|
|
|
|
table.insert(retval,{name=got,got=true})
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
for _,def in pairs(awards.def) do
|
|
|
|
if not done[def.name] then
|
|
|
|
table.insert(retval,{name=def.name,got=false})
|
|
|
|
end
|
|
|
|
end
|
|
|
|
return retval
|
|
|
|
end
|