diff --git a/mods/ctf_stats/gui.lua b/mods/ctf_stats/gui.lua index d4d1dc9..2656250 100644 --- a/mods/ctf_stats/gui.lua +++ b/mods/ctf_stats/gui.lua @@ -15,7 +15,7 @@ function ctf_stats.get_formspec_match_summary(stats) return ret end -function ctf_stats.get_formspec(title, players) +local function calc_scores(players) for i = 1, #players do local pstat = players[i] pstat.kills = pstat.kills or 0 @@ -28,6 +28,10 @@ function ctf_stats.get_formspec(title, players) table.sort(players, function(one, two) return one.score > two.score end) +end + +function ctf_stats.get_formspec(title, players) + calc_scores(players) local ret = "size[12,6.5]" ret = ret .. "vertlabel[0,0;" .. title .. "]" @@ -59,6 +63,60 @@ function ctf_stats.get_formspec(title, players) return ret end +function ctf_stats.get_html(title, players) + calc_scores(players) + + local ret = "
" .. + " | username | " .. + "kills | " .. + "deaths | " .. + "K/D ratio | " .. + "captures | " .. + "attempts | " .. + "score |
---|---|---|---|---|---|---|---|
" .. i .. + " | " .. pstat.name .. + " | " .. pstat.kills .. + " | " .. pstat.deaths .. + " | " .. math.floor(pstat.kills / (pstat.deaths + 1)*10)/10 .. + " | " .. pstat.captures .. + " | " .. pstat.attempts .. + " | " .. math.floor(pstat.score*10)/10 .. " |