diff --git a/stats.html b/stats.html index d5e8fb8..91b9dd3 100644 --- a/stats.html +++ b/stats.html @@ -337,6 +337,17 @@
加载中...
+ + +
+
+
+
屠夫
+
+
+
加载中...
+
+
@@ -385,6 +396,10 @@ 死亡次数 0 +
+ 击杀数量 + 0 +
游玩时间 0 秒 diff --git a/stats_script.js b/stats_script.js index 8204f98..63a01d4 100644 --- a/stats_script.js +++ b/stats_script.js @@ -144,6 +144,10 @@ function renderLeaderboards() { // 5. Play Time (stats.play_time_raw) const topPlayTime = getTop('play_time_fmt'); // uses play_time_raw internally renderCard('lb-playtime', topPlayTime, p => p.stats.play_time_fmt); + + // 6. Kills (stats.kills) + const topKills = getTop('kills'); + renderCard('lb-kills', topKills, p => p.stats.kills); } function renderPlayerGrid(reset = false) { @@ -228,6 +232,7 @@ function openModal(player) { document.getElementById('modal-placed').innerText = player.stats.placed.toLocaleString(); document.getElementById('modal-mined').innerText = player.stats.mined.toLocaleString(); document.getElementById('modal-deaths').innerText = player.stats.deaths; + document.getElementById('modal-kills').innerText = player.stats.kills; document.getElementById('modal-playtime').innerText = player.stats.play_time_fmt; modal.style.display = "flex"; diff --git a/statsprocess.py b/statsprocess.py index 9171cc4..e77f133 100644 --- a/statsprocess.py +++ b/statsprocess.py @@ -142,6 +142,10 @@ def process_player(filename): killed_by = stats.get('minecraft:killed_by', {}) total_deaths = sum(killed_by.values()) + # Kills (Killed) + killed = stats.get('minecraft:killed', {}) + total_kills = sum(killed.values()) + # Inject into JSON data['extra'] = { 'player_name': player_name, @@ -150,6 +154,7 @@ def process_player(filename): 'total_mined': total_mined, 'total_placed': total_placed, 'total_deaths': total_deaths, + 'total_kills': total_kills, 'play_time_fmt': play_time_fmt, 'play_time_ticks': play_time_ticks } @@ -168,19 +173,19 @@ def process_player(filename): 'mined': total_mined, 'placed': total_placed, 'deaths': total_deaths, + 'kills': total_kills, 'play_time_fmt': play_time_fmt, 'play_time_raw': play_time_ticks } } -# Process in parallel with progress bar +# Process sequentially with progress bar results = [] if files: - with ThreadPoolExecutor(max_workers=4) as executor: - # Use tqdm to show progress - results = list(tqdm(executor.map(process_player, files), total=len(files), desc="Processing players")) - -results = [r for r in results if r is not None] + for filename in tqdm(files, desc="Processing players"): + result = process_player(filename) + if result is not None: + results.append(result) # Sort by name perhaps? Or just raw list. results.sort(key=lambda x: x['name'])