Fix naming conventions on challengeblock code

This commit is contained in:
Guangcong Luo 2013-01-21 05:57:47 -08:00
parent 630def7aec
commit a5f0e5f9b5
3 changed files with 14 additions and 14 deletions

View File

@ -1275,7 +1275,7 @@ function parseCommandLocal(user, cmd, target, room, socket, message) {
emit(socket, 'message', "The user '"+targets[2]+"' was not found.");
return false;
}
if (!targetUser.allowChallenges && !user.can('challengealways', targetUser)) {
if (targetUser.blockChallenges && !user.can('bypassblocks', targetUser)) {
emit(socket, 'message', "The user '"+targets[2]+"' is not accepting challenges right now.");
return false;
}
@ -1289,18 +1289,17 @@ function parseCommandLocal(user, cmd, target, room, socket, message) {
return false;
break;
case 'blockchallenges':
case 'away':
case 'idle':
case 'bc':
user.allowChallenges = false;
case 'blockchallenges':
user.blockChallenges = true;
emit(socket, 'console', 'You are now blocking all incoming challenge requests.');
return false;
break;
case 'allowchallenges':
case 'back':
case 'ac':
user.allowChallenges = true;
case 'allowchallenges':
user.blockChallenges = false;
emit(socket, 'console', 'You are available for challenges from now on.');
return false;
break;
@ -1697,13 +1696,13 @@ function parseCommandLocal(user, cmd, target, room, socket, message) {
emit(socket, 'console', '/calc - Provides a link to a damage calculator');
emit(socket, 'console', '!calc - Shows everyone a link to a damage calculator. Requires: + % @ & ~');
}
if (target === 'all' || target === 'blockchallenges' || target === 'bc' || target === 'idle') {
if (target === 'all' || target === 'blockchallenges' || target === 'away' || target === 'idle') {
matched = true;
emit(socket, 'console', '/blockchallenges OR /bc OR /idle - Blocks challenges so no one can challenge you.');
emit(socket, 'console', '/away - Blocks challenges so no one can challenge you.');
}
if (target === 'all' || target === 'allowchallenges' || target === 'ac' || target === 'back') {
if (target === 'all' || target === 'allowchallenges' || target === 'back') {
matched = true;
emit(socket, 'console', '/allowchallenges OR /ac OR /back - Unlocks challenges so you can be challenged again.');
emit(socket, 'console', '/back - Unlocks challenges so you can be challenged again.');
}
if (target === 'all' || target === 'faq') {
matched = true;

View File

@ -6,7 +6,7 @@ exports.port = 8000;
exports.setuid = '';
// protocol - WebSockets ("ws") or Socket.IO ("io").
// We recommend using WebSockets unless you have a really compelling reason not to.
// We recommend using WebSockets unless you have a really compelling reason not to.
exports.protocol = 'ws';
// The server ID - a unique ID describing this Showdown server
@ -157,7 +157,7 @@ exports.groups = {
forcerename: true,
timer: true,
alts: '%u',
challengealways: true,
bypassblocks: true,
rank: 2
},
'+': {

View File

@ -136,7 +136,6 @@ var User = (function () {
this.authenticated = false;
this.userid = toUserid(this.name);
this.group = config.groupsranking[0];
this.allowChallenges = true;
var trainersprites = [1, 2, 101, 102, 169, 170, 265, 266];
this.avatar = trainersprites[Math.floor(Math.random()*trainersprites.length)];
@ -166,6 +165,8 @@ var User = (function () {
}
}
User.prototype.blockChallenges = false;
User.prototype.emit = function(message, data) {
var roomid = false;
if (data && data.room) {