Skip to content

Commit

Permalink
Scavengers: Fix time trial sorting (#10356)
Browse files Browse the repository at this point in the history
  • Loading branch information
Vinayak-Shukla authored Oct 3, 2024
1 parent 86ae7da commit b8eeebc
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions server/chat-plugins/scavenger-games.ts
Original file line number Diff line number Diff line change
Expand Up @@ -355,15 +355,21 @@ const TWISTS: {[k: string]: Twist} = {

onComplete(player, time, blitz) {
const now = Date.now();
const takenTime = Chat.toDurationString(now - this.startTimes[player.id], {hhmmss: true});
const result = {name: player.name, id: player.id, time: takenTime, blitz};
const takenTime = now - this.startTimes[player.id];
const result = {
name: player.name,
id: player.id,
time: Chat.toDurationString(takenTime, {hhmmss: true}),
duration: takenTime,
blitz,
};
this.completed.push(result);
const place = Utils.formatOrder(this.completed.length);

this.announce(
Utils.html`<em>${result.name}</em> is the ${place} player to finish the hunt! (${takenTime}${(blitz ? " - BLITZ" : "")})`
);
Utils.sortBy(this.completed, entry => entry.time);
Utils.sortBy(this.completed, entry => entry.duration);

player.destroy(); // remove from user.games;
return true;
Expand Down

0 comments on commit b8eeebc

Please sign in to comment.