update
Build / build (push) Has been cancelled

This commit is contained in:
gpatruno
2026-06-08 23:35:37 +02:00
parent 836499d10d
commit 96144d809c
78 changed files with 5871 additions and 502 deletions
+15
View File
@@ -281,6 +281,21 @@ code {
color: #94a3b8;
}
.tag-alive {
background: rgba(74, 222, 128, 0.15);
color: var(--success);
}
.tag-dead {
background: rgba(248, 113, 113, 0.15);
color: var(--danger);
}
.death-date {
display: block;
margin-top: 0.2rem;
}
.link {
color: var(--accent);
text-decoration: none;
+6
View File
@@ -140,6 +140,8 @@ function enrichPlayer(player) {
);
const jobs = labels.parseJsonArray(player.jobs).map(labels.labelJob);
const powers = labels.parseJsonArray(player.powers).map(labels.labelPower);
const deathTime = player.death_time ?? null;
const isDead = deathTime != null && Number(deathTime) > 0;
return {
...player,
@@ -148,6 +150,10 @@ function enrichPlayer(player) {
jobs,
powers,
isOnline: player.is_connected === 1,
isDead,
lifeStatus: isDead ? "Mort" : "Vivant",
deathTimeFormatted: isDead ? fmt.formatTimestamp(deathTime) : null,
total_time_play: player.total_time_play ?? 0,
};
}
+9 -3
View File
@@ -108,7 +108,9 @@ function getCharactersByAccountUuid(accountUuid) {
money,
race_id,
date_creation,
updated_at
updated_at,
death_time,
total_time_play
FROM characters
WHERE account_uuid = ?
ORDER BY name COLLATE NOCASE ASC
@@ -225,7 +227,9 @@ function getAllPlayers() {
c.race_id,
c.money,
p.is_connected,
p.total_time_play,
c.total_time_play,
p.total_time_play AS account_total_time_play,
c.death_time,
p.last_date_connected,
c.date_creation
FROM characters c
@@ -266,7 +270,9 @@ function getPlayerByUuid(uuid) {
c.guild_id,
c.group_id,
p.is_connected,
p.total_time_play,
COALESCE(c.total_time_play, 0) AS total_time_play,
p.total_time_play AS account_total_time_play,
c.death_time,
p.last_date_connected,
COALESCE(c.date_creation, p.date_creation) AS date_creation,
COALESCE(c.money, 0) AS money,
+15
View File
@@ -20,6 +20,20 @@ function formatDuration(seconds) {
return `${hours} h ${minutes} min`;
}
/** Play time stored in milliseconds (characters.total_time_play). */
function formatPlayTime(millis) {
if (!millis || millis <= 0) {
return "0 min";
}
const totalSeconds = Math.floor(millis / 1000);
const hours = Math.floor(totalSeconds / 3600);
const minutes = Math.floor((totalSeconds % 3600) / 60);
if (hours === 0) {
return `${minutes} min`;
}
return `${hours} h ${minutes} min`;
}
function formatMoney(value) {
return new Intl.NumberFormat("fr-FR").format(value ?? 0);
}
@@ -31,6 +45,7 @@ function formatNumber(value) {
module.exports = {
formatTimestamp,
formatDuration,
formatPlayTime,
formatMoney,
formatNumber,
};
+5 -4
View File
@@ -32,13 +32,14 @@
<td><%= p.raceLabel %></td>
<td><%= fmt.formatMoney(p.money) %></td>
<td>
<% if (p.isOnline) { %>
<span class="tag tag-online">En ligne</span>
<% if (p.isDead) { %>
<span class="tag tag-dead">Mort</span>
<small class="muted death-date"><%= p.deathTimeFormatted %></small>
<% } else { %>
<span class="tag tag-offline">Hors ligne</span>
<span class="tag tag-alive">Vivant</span>
<% } %>
</td>
<td><%= fmt.formatDuration(p.total_time_play) %></td>
<td><%= fmt.formatPlayTime(p.total_time_play) %></td>
</tr>
<% }); %>
</tbody>