Update scavengers.js (#3519)

This commit is contained in:
Charlie Kobayashi
2017-05-10 21:23:03 -04:00
committed by Guangcong Luo
parent 925b40361d
commit eec8d69920

View File

@@ -617,6 +617,7 @@ let commands = {
* Leaderboard Point Distribution Editing
*/
setblitz: function (target, room, user) {
if (room.id !== 'scavengers') return this.errorReply("This command can only be used in the scavenger room.");
if (!this.can("mute", null, room)) return false; // perms for viewing only
if (!target) return this.sendReply(`The points rewarded for winning official hunts is: ${(room.blitzPoints || DEFAULT_BLITZ_POINTS)}`);
@@ -635,6 +636,7 @@ let commands = {
},
setpoints: function (target, room, user) {
if (room.id !== 'scavengers') return this.errorReply("This command can only be used in the scavenger room.");
if (!this.can("mute", null, room)) return false; // perms for viewing only
if (!target) return this.sendReply(`The points rewarded for winning official hunts is: ${(room.winPoints || DEFAULT_POINTS).map((p, i) => `(${(i + 1)}) ${p}`).join(', ')}`);
@@ -658,6 +660,7 @@ let commands = {
*/
huntcount: 'huntlogs',
huntlogs: function (target, room, user) {
if (room.id !== 'scavengers') return this.errorReply("This command can only be used in the scavenger room.");
if (!this.can('mute', null, room)) return false;
if (target === 'reset') {
@@ -669,7 +672,14 @@ let commands = {
}
HostLeaderboard.visualize().then(ladder => {
this.sendReply(`|raw|<div class="ladder" style="overflow-y: scroll; max-height: 300px;"><table style="width: 100%"><tr><th>Rank</th><th>Name</th><th>Points</th></tr>${ladder.map(entry => `<tr><td>${entry.rank}</td><td>${Chat.escapeHTML(entry.name)}</td><td>${entry.points}</td></tr>`).join('')}</table></div>`);
this.sendReply(`|raw|<div class="ladder" style="overflow-y: scroll; max-height: 300px;"><table style="width: 100%"><tr><th>Rank</th><th>Name</th><th>Points</th></tr>${ladder.map(entry => {
let userid = toId(entry.name);
let auth = room.auth && room.auth[userid] ? room.auth[userid] : Users.usergroups[userid] ? Users.usergroups[userid].charAt(0) : "&nbsp;";
let color = room.auth && userid in room.auth ? 'inherit' : 'gray';
return `<tr><td>${entry.rank}</td><td><span style="color: ${color}">${auth}</span>${Chat.escapeHTML(entry.name)}</td><td>${entry.points}</td></tr>`;
}).join('')}</table></div>`);
});
},
};