Skip to content

Commit

Permalink
Remove font weight override on username list
Browse files Browse the repository at this point in the history
  • Loading branch information
Karthik99999 committed Aug 20, 2024
1 parent df28aff commit 22942f1
Showing 1 changed file with 21 additions and 13 deletions.
34 changes: 21 additions & 13 deletions server/chat-plugins/auction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,10 @@ export class Auction extends Rooms.SimpleRoomGame {
lastQueue: Team[] | null;
queue: Team[];
bidTimer: NodeJS.Timer;
/** How many seconds have passed since the start of the timer */
bidTimeElapsed: number;
/** Measured in seconds */
bidTimeLimit: number;
/** Measured in seconds */
bidTimeRemaining: number;
nominatingTeam: Team;
nominatedPlayer: Player;
highestBidder: Team;
Expand All @@ -118,8 +118,8 @@ export class Auction extends Rooms.SimpleRoomGame {
this.lastQueue = null;
this.queue = [];
this.bidTimer = null!;
this.bidTimeElapsed = 0;
this.bidTimeLimit = 10;
this.bidTimeRemaining = 10;
this.nominatingTeam = null!;
this.nominatedPlayer = null!;
this.highestBidder = null!;
Expand Down Expand Up @@ -162,9 +162,9 @@ export class Auction extends Rooms.SimpleRoomGame {
let buf = `<span style="font-size: 90%">`;
buf += players.slice(0, max).map(p => {
if (typeof p === 'object') {
return `<username title="Tiers: ${p.tiers?.length ? `${Utils.escapeHTML(p.tiers.join(', '))}` : 'N/A'}"${clickable ? ' class="username"' : ''} style="font-weight: normal">${Utils.escapeHTML(p.name)}</username>`;
return `<username title="Tiers: ${p.tiers?.length ? `${Utils.escapeHTML(p.tiers.join(', '))}` : 'N/A'}"${clickable ? ' class="username"' : ''}>${Utils.escapeHTML(p.name)}</username>`;
}
return `<username${clickable ? ' class="username"' : ''} style="font-weight: normal">${Utils.escapeHTML(p)}</username>`;
return `<username${clickable ? ' class="username"' : ''}>${Utils.escapeHTML(p)}</username>`;
}).join(', ');
if (players.length > max) {
buf += ` <span title="${players.slice(max).map(p => Utils.escapeHTML(typeof p === 'object' ? p.name : p)).join(', ')}">(+${players.length - max})</span>`;
Expand Down Expand Up @@ -257,7 +257,15 @@ export class Auction extends Rooms.SimpleRoomGame {
buf += Utils.html`Top bidder: <b>${this.highestBidder.name}</b> `;
buf += Utils.html`Tiers: <b>${this.nominatedPlayer.tiers?.length ? `${this.nominatedPlayer.tiers.join(', ')}` : 'N/A'}</b>`;
buf += `</div>`;
this.room.add(`|uhtml|bid|${buf}`).update();
this.room.add(`|uhtml|bid-${this.nominatedPlayer.id}|${buf}`).update();
this.sendBidTimer();
}

sendBidTimer(change = false) {
let buf = `<div class="infobox message-error">`;
buf += `<i class="fa fa-hourglass-start"></i> ${Chat.toDurationString(this.bidTimeRemaining * 1000, {hhmmss: true}).slice(1)}`;
buf += `</div>`;
this.room.add(`|uhtml${change ? 'change' : ''}|timer|${buf}`).update();
}

setMinBid(amount: number) {
Expand Down Expand Up @@ -551,9 +559,9 @@ export class Auction extends Rooms.SimpleRoomGame {
this.highestBid = bid;
this.highestBidder = team;
this.sendMessage(Utils.html`/html <username class="username">${user.name}</username>[${team.name}]: <b>${bid}</b>`);
this.sendBidInfo();
this.clearTimer();
this.bidTimer = setInterval(() => this.pokeBidTimer(), 1000);
this.sendBidInfo();
}
}

Expand Down Expand Up @@ -594,16 +602,16 @@ export class Auction extends Rooms.SimpleRoomGame {

clearTimer() {
clearInterval(this.bidTimer);
this.bidTimeElapsed = 0;
this.bidTimeRemaining = this.bidTimeLimit;
this.room.add('|uhtmlchange|timer|');
}

pokeBidTimer() {
this.bidTimeElapsed++;
const timeRemaining = this.bidTimeLimit - this.bidTimeElapsed;
if (timeRemaining === 0) {
this.bidTimeRemaining--;
if (!this.bidTimeRemaining) {
this.finishCurrentNom();
} else if (timeRemaining % 10 === 0 || timeRemaining === 5) {
this.sendMessage(`__${timeRemaining} seconds left!__`);
} else {
this.sendBidTimer(true);
}
}

Expand Down

0 comments on commit 22942f1

Please sign in to comment.