mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2026-11-14 16:14:53 +09:00
The plugin is now exp_player_statistics (@expcluster/player-statistics), with the module, global, permission, route and database directory renamed to match. The exp-statistics locale section keeps its name. Every statistic is tracked unconditionally, so the enable flags are gone from config.lua. Playtime and JoinCount are no longer counted in game: clusterio already keeps online time and joins for each user, so the controller fills them in from the user when a player's totals are requested, and the web page does the same from the user list. They are not stored or adjusted by the plugin. The web table has a column picker, a multiple select with check boxes, Select all and Reset buttons, showing "N statistics selected". The choice is kept in local storage. The user page shows the statistics of the player in a grid like the core player stats. The readme statistics table drops its second title and uses the short time format. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
41 lines
1.3 KiB
TypeScript
41 lines
1.3 KiB
TypeScript
/** Same order and names as module/config.lua and module/locale/en.cfg */
|
|
export const statistics: [name: string, title: string][] = [
|
|
["Playtime", "Playtime"],
|
|
["AfkTime", "AFK Time"],
|
|
["MapsPlayed", "Maps Played"],
|
|
["JoinCount", "Join Count"],
|
|
["ChatMessages", "Messages"],
|
|
["CommandsUsed", "Commands"],
|
|
["RocketsLaunched", "Rockets Launched"],
|
|
["ResearchCompleted", "Research Completed"],
|
|
["MachinesBuilt", "Machines Built"],
|
|
["MachinesRemoved", "Machines Removed"],
|
|
["TilesBuilt", "Tiles Placed"],
|
|
["TilesRemoved", "Tiles Removed"],
|
|
["TreesDestroyed", "Trees Destroyed"],
|
|
["OreMined", "Ore Mined"],
|
|
["ItemsCrafted", "Items Crafted"],
|
|
["ItemsPickedUp", "Items Picked Up"],
|
|
["Kills", "Kills"],
|
|
["Deaths", "Deaths"],
|
|
["DamageDealt", "Damage Dealt"],
|
|
["DistanceTravelled", "Distance Travelled"],
|
|
["CapsulesUsed", "Capsules Used"],
|
|
["EntityRepaired", "Machines Repaired"],
|
|
["DeconstructionPlannerUsed", "Decon Planner Used"],
|
|
["MapTagsMade", "Map Tags Created"],
|
|
];
|
|
|
|
/** Measured in minutes */
|
|
const timeStatistics = new Set(["Playtime", "AfkTime"]);
|
|
|
|
export function formatValue(name: string, value: number) {
|
|
if (timeStatistics.has(name)) {
|
|
return `${Math.floor(value / 60)}h ${value % 60}m`;
|
|
}
|
|
if (name === "DistanceTravelled") {
|
|
return `${value.toLocaleString()} tiles`;
|
|
}
|
|
return value.toLocaleString();
|
|
}
|