Hopefully fix bug
This commit is contained in:
parent
4713d23d3e
commit
24b9ed89aa
1 changed files with 11 additions and 7 deletions
|
@ -16,14 +16,17 @@ function ctf_stats.get_formspec_match_summary(stats)
|
||||||
end
|
end
|
||||||
|
|
||||||
function ctf_stats.get_formspec(title, players)
|
function ctf_stats.get_formspec(title, players)
|
||||||
for i, pstat in pairs(players) do
|
for i = 1 in #players do
|
||||||
pstat.score = pstat.captures + 0.2 * pstat.attempts + 7 * pstat.kills / (pstat.deaths + 1)
|
local pstat = players[i]
|
||||||
if i > 40 then
|
pstat.kills = pstat.kills or 0
|
||||||
break
|
pstat.deaths = pstat.deaths or 0
|
||||||
end
|
pstat.captures = pstat.captures or 0
|
||||||
|
pstat.attempts = pstat.attempts or 0
|
||||||
|
pstat.score = pstat.kills + 10 * pstat.captures +
|
||||||
|
5 * pstat.attempts + pstat.kills / (pstat.deaths + 1)
|
||||||
end
|
end
|
||||||
table.sort(players, function(one, two)
|
table.sort(players, function(one, two)
|
||||||
return (one.score > two.score)
|
return one.score > two.score
|
||||||
end)
|
end)
|
||||||
|
|
||||||
local ret = "size[9,6.5]"
|
local ret = "size[9,6.5]"
|
||||||
|
@ -33,7 +36,8 @@ function ctf_stats.get_formspec(title, players)
|
||||||
ret = ret .. "table[0.5,0;8.25,6;scores;"
|
ret = ret .. "table[0.5,0;8.25,6;scores;"
|
||||||
ret = ret .. "#ffffff,,username,kills,deaths,K/D ratio,captures,attempts,score"
|
ret = ret .. "#ffffff,,username,kills,deaths,K/D ratio,captures,attempts,score"
|
||||||
|
|
||||||
for i, pstat in pairs(players) do
|
for i = 1 in #players do
|
||||||
|
local pstat = players[i]
|
||||||
local color = pstat.color or "#ffffff"
|
local color = pstat.color or "#ffffff"
|
||||||
ret = ret ..
|
ret = ret ..
|
||||||
"," .. string.gsub(color, "0x", "#") ..
|
"," .. string.gsub(color, "0x", "#") ..
|
||||||
|
|
Loading…
Reference in a new issue