* Work on Renegade style pipe codes

* Change age -> birthday
* Minor tweaks and tests
This commit is contained in:
Bryan Ashby 2015-07-20 22:56:48 -06:00
parent 31ff67f32b
commit 81e684cdcc
11 changed files with 58 additions and 28 deletions

View File

@ -111,7 +111,7 @@ var SGRValues = {
greenBG : 42, greenBG : 42,
yellowBG : 43, yellowBG : 43,
blueBG : 44, blueBG : 44,
magentaBG : 45,
cyanBG : 46, cyanBG : 46,
whiteBG : 47, whiteBG : 47,
}; };

View File

@ -457,7 +457,7 @@ function display(options, cb) {
var nextPauseTermHeight = options.client.term.termHeight; var nextPauseTermHeight = options.client.term.termHeight;
var continous = false; var continous = false;
/*
parser.on('row update', function rowUpdate(row) { parser.on('row update', function rowUpdate(row) {
if(row >= nextPauseTermHeight) { if(row >= nextPauseTermHeight) {
if(!continous && 'termHeight' === options.pause) { if(!continous && 'termHeight' === options.pause) {
@ -474,6 +474,7 @@ function display(options, cb) {
nextPauseTermHeight += options.client.term.termHeight; nextPauseTermHeight += options.client.term.termHeight;
} }
}); });
*/
parser.on('mci', function mciEncountered(mciInfo) { parser.on('mci', function mciEncountered(mciInfo) {

View File

@ -7,6 +7,7 @@ var assert = require('assert');
exports.pipeToAnsi = exports.enigmaToAnsi = enigmaToAnsi; exports.pipeToAnsi = exports.enigmaToAnsi = enigmaToAnsi;
exports.stripPipeCodes = exports.stripEnigmaCodes = stripEnigmaCodes; exports.stripPipeCodes = exports.stripEnigmaCodes = stripEnigmaCodes;
exports.renegadeToAnsi = renegadeToAnsi;
// :TODO: Not really happy with the module name of "color_codes". Would like something better // :TODO: Not really happy with the module name of "color_codes". Would like something better
@ -62,7 +63,6 @@ function enigmaToAnsi(s) {
return result; return result;
} }
// :TODO: NYI
function renegadeToAnsi(s) { function renegadeToAnsi(s) {
if(-1 == s.indexOf('|')) { if(-1 == s.indexOf('|')) {
return s; // no pipe codes present return s; // no pipe codes present
@ -85,17 +85,36 @@ if(-1 == s.indexOf('|')) {
if(isNaN(val)) { if(isNaN(val)) {
val = 0; val = 0;
} }
assert(val >= 0 && val <= 23); assert(val >= 0 && val <= 23);
var attr = ''; var attr = ansi.sgr({
if(7 == val) { 0 : [ 'reset', 'black' ],
attr = ansi.sgr('normal'); 1 : [ 'reset', 'blue' ],
} else if (val < 7 || val >= 16) { 2 : [ 'reset', 'green' ],
attr = ansi.sgr(['normal', val]); 3 : [ 'reset', 'cyan' ],
} else if (val <= 15) { 4 : [ 'reset', 'red' ],
attr = ansi.sgr(['normal', val - 8, 'bold']); 5 : [ 'reset', 'magenta' ],
} 6 : [ 'reset', 'yellow' ],
7 : [ 'reset', 'white' ],
8 : [ 'bold', 'black' ],
9 : [ 'bold', 'blue' ],
10 : [ 'bold', 'green' ],
11 : [ 'bold', 'cyan' ],
12 : [ 'bold', 'red' ],
13 : [ 'bold', 'magenta' ],
14 : [ 'bold', 'yellow' ],
15 : [ 'bold', 'white' ],
16 : [ 'blackBG' ],
17 : [ 'blueBG' ],
18 : [ 'greenBG' ],
19 : [ 'cyanBG' ],
20 : [ 'redBG' ],
21 : [ 'magentaBG' ],
22 : [ 'yellowBG' ],
23 : [ 'whiteBG' ],
}[val] || 'normal');
result += s.substr(lastIndex, m.index - lastIndex) + attr; result += s.substr(lastIndex, m.index - lastIndex) + attr;
lastIndex = re.lastIndex; lastIndex = re.lastIndex;

View File

@ -137,5 +137,9 @@ function getDefaultConfig() {
} }
*/ */
}, },
logging : {
level : 'debug'
}
}; };
} }

View File

@ -124,11 +124,14 @@ function connectEntry(client) {
// //
displayBanner(term); displayBanner(term);
/* /* var art1 = require('fs').readFileSync('/home/nuskooler/dev/enigma-bbs/mods/themes/NU-MAYA/APPLY1.ANS');
theme.displayThemeArt({client : client, name : 'DM-ENIG2.ANS'}, function onArt() { term.rawWrite(art1);
});*/ term.write(ansi.resetScreen());
theme.displayThemeArt({client : client, name : 'APPLY1.ANS'}, function onArt() {
});
*/
setTimeout(function onTimeout() { setTimeout(function onTimeout() {
client.gotoMenuModule( { name : Config.firstMenu }); client.gotoMenuModule( { name : Config.firstMenu });
}, 500); }, 500);

View File

@ -50,7 +50,6 @@ function JSONCache() {
JSONCache.prototype.getJSON = function(fileName, cb) { JSONCache.prototype.getJSON = function(fileName, cb) {
var self = this; var self = this;
var filePath = paths.join(Config.paths.mods, fileName); var filePath = paths.join(Config.paths.mods, fileName);
console.log(filePath)
if(filePath in this.cache) { if(filePath in this.cache) {
cb(null, this.cache[filePath]); cb(null, this.cache[filePath]);

View File

@ -47,9 +47,9 @@ module.exports = {
{ {
type : 'rotating-file', type : 'rotating-file',
path : logFile, path : logFile,
period : '1d', period : Config.logging.period || '1d',
count : 3, count : 3,
level : 'trace' level : Config.logging.level || 'debug',
} }
/*, /*,
{ {

View File

@ -74,14 +74,14 @@ function submitApplication(callingMenu, formData, extraArgs) {
menuViewController.switchFocus(viewIds[0]); menuViewController.switchFocus(viewIds[0]);
} else { } else {
// Seems legit! // Seems legit!
// :TODO: All of this should be a system API, not a mod // :TODO: All of this should be a system API, not a mod, e.g. createNewUser(...)
var newUser = new user.User(); var newUser = new user.User();
newUser.username = formData.value.username; newUser.username = formData.value.username;
newUser.properties = { newUser.properties = {
real_name : formData.value.realName, real_name : formData.value.realName,
age : formData.value.age, birthday : formData.value.birthday,
sex : formData.value.sex, sex : formData.value.sex,
location : formData.value.location, location : formData.value.location,
affiliation : formData.value.affils, affiliation : formData.value.affils,

View File

@ -110,7 +110,7 @@
"next" : "newUserActive", "next" : "newUserActive",
"form" : { "form" : {
"0" : { "0" : {
"BT12BT13ET1ET10ET2ET3ET4ET5ET6ET7ET8ET9TL11" : { "BT12BT13ET1ET10ET2ET4ET5ET6ET7ET8ET9ME3TL11" : {
"mci" : { "mci" : {
"ET1" : { "ET1" : {
"focus" : true, "focus" : true,
@ -121,14 +121,14 @@
"argName" : "realName", "argName" : "realName",
"maxLength" : 32 "maxLength" : 32
}, },
"ET3" : { "ME3" : {
"argName" : "age", "argName" : "birthday",
"width" : 3, //"width" : 8,
"maxLength" : 3 "maskPattern" : "####/##/##"
}, },
"ET4" : { "ET4" : {
"argName" : "sex", "argName" : "sex",
"width" : 1, //"width" : 1,
"maxLength" : 1 "maxLength" : 1
}, },
"ET5" : { "ET5" : {

Binary file not shown.

View File

@ -26,8 +26,12 @@
"apply" : { "apply" : {
"ET1" : { "width" : 21 }, "ET1" : { "width" : 21 },
"ET2" : { "width" : 21 }, "ET2" : { "width" : 21 },
"ET3" : { "width" : 21 }, //"ET3" : { "width" : 21 },
"ET4" : { "width" : 21 }, "ME3" : {
"styleSGR1" : "|00|30|01",
"styleSGR2" : "|00|37"
},
"ET4" : { "width" : 1 },
"ET5" : { "width" : 21 }, "ET5" : { "width" : 21 },
"ET6" : { "width" : 21 }, "ET6" : { "width" : 21 },
"ET7" : { "width" : 21 }, "ET7" : { "width" : 21 },