Пример #1
0
 function gender(context) {
     if (!UTIL.has(['male', 'female'], context.command)) {
         context.log("<p>For the purpose of the narrative, &#147;male&#148; and &#147;female&#148; are the gender options, not &#147;" + HTML.escape(context.command) + "&#148;.</p>");
     } else {
         context.log("<p>Okay, people will recognize your gender now.</p>");
         player.gender = context.command;
     }
 }
Пример #2
0
 var handler = function (context) {
     var parsed = readCommand(context.command);
     if (UTIL.has(commands, parsed.command)) {
         context.path = (context.path || '') + parsed.command + " ";
         context.command = parsed.arg;
         return commands[parsed.command](context);
     } else {
         return nextHandler(context);
     }
 };
Пример #3
0
 function goCommand(context) {
     if (!UTIL.has(room.allExits, context.command)) {
         context.log(
             "<p>There is no way to go &#147;" +
             HTML.escape(context.command) +
             "&#148; from here.</p>"
         );
     } else {
         go(room.allExits[context.command].href);
     }
 }
Пример #4
0
 }, function (context) {
     if (context.command) {
         var exitName = context.command.toLowerCase();
         if (UTIL.has(room.allExits, exitName)) {
             go(room.allExits[exitName].href);
             context.log("<p>You go " + HTML.escape(exitName) + ".</p>");
         } else {
             return commonHandler(context);
         }
     } else {
         context.log("<p><b>[command mode]</b></p>");
         channel.send(JSON.stringify({
             "to": "mode",
             "content": "command"
         }));
         modeHandler = commandHandler;
     }
 });