* More WIP on door support. Proof of concept mostly functional-ish for at least Pimpwars :)

This commit is contained in:
Bryan Ashby
2015-08-02 18:27:05 -06:00
parent d16beca341
commit 144aa6b351
11 changed files with 352 additions and 93 deletions

109
mods/abracadabra.js Normal file
View File

@@ -0,0 +1,109 @@
/* jslint node: true */
'use strict';
var MenuModule = require('../core/menu_module.js').MenuModule;
var DropFile = require('../core/dropfile.js').DropFile;
var door = require('../core/door.js');
var async = require('async');
var assert = require('assert');
var mkdirp = require('mkdirp');
var paths = require('path');
// :TODO: This should really be a system module... needs a little work to allow for such
exports.getModule = AbracadabraModule;
exports.moduleInfo = {
name : 'Abracadabra',
desc : 'External BBS Door Module',
author : 'NuSkooler',
};
function AbracadabraModule(options) {
MenuModule.call(this, options);
var self = this;
this.config = options.menuConfig.config || {
dropFileType : 'DORINFO',
};
this.config.args = this.config.args || [];
/*
{
"config" : {
"name" : "LORD",
"cmd" : "...",
"args" : [ ... ],
"dropFileType" : "dorinfo",
"maxNodes" : 32, default=unlimited
"tooManyArt" : "..." (optional); default = "Too many active" message
...
"dropFilePath" : "/.../LORD/", || Config.paths.dropFiles
}
}
*/
this.initSequence = function() {
async.series(
[
function validateNodeCount(callback) {
// :TODO: Check that node count for this door has not been reached
callback(null);
},
function generateDropfile(callback) {
self.dropFile = new DropFile(self.client, self.config.dropFileType);
var fullPath = self.dropFile.fullPath;
mkdirp(paths.dirname(fullPath), function dirCreated(err) {
if(err) {
callback(err);
} else {
self.dropFile.createFile(function created(err) {
callback(err);
});
}
});
}
],
function complete(err) {
self.finishedLoading();
}
);
};
this.runDOSEmuDoor = function() {
};
}
require('util').inherits(AbracadabraModule, MenuModule);
AbracadabraModule.prototype.enter = function(client) {
AbracadabraModule.super_.prototype.enter.call(this, client);
};
AbracadabraModule.prototype.leave = function() {
Abracadabra.super_.prototype.leave.call(this);
};
AbracadabraModule.prototype.finishedLoading = function() {
var self = this;
var exeInfo = {
cmd : this.config.cmd,
args : this.config.args,
};
// :TODO: this system should probably be generic
for(var i = 0; i < exeInfo.args.length; ++i) {
exeInfo.args[i] = exeInfo.args[i].replace(/\{dropfile\}/g, self.dropFile.fileName);
exeInfo.args[i] = exeInfo.args[i].replace(/\{node\}/g, self.client.node.toString());
}
var doorInstance = new door.Door(this.client, exeInfo);
doorInstance.run();
};

View File

@@ -24,7 +24,7 @@ function FullScreenEditorModule(options) {
MenuModule.call(this, options);
var self = this;
this.menuConfig = options.menuConfig;
this.menuConfig = options.menuConfig; // :TODO: MenuModule does this...
//
// Editor Type ('editorType'):
@@ -208,7 +208,7 @@ function FullScreenEditorModule(options) {
assert(_.isString(art.body));
async.eachSeries( [ 'header', 'body' ], function dispArt(n, next) {
theme.displayThemedAsset1(
theme.displayThemedAsset(
art[n],
self.client,
{ font : self.menuConfig.font },

View File

@@ -235,6 +235,10 @@
"value" : { "1" : "g" },
"action" : "@menu:logoff"
},
{
"value" : { "1" : "d" },
"action" : "@menu:doorPimpWars"
},
{
"value" : 1,
"action" : "@menu:mainMenu"
@@ -245,6 +249,14 @@
}
}
},
"doorPimpWars" : {
"module" : "abracadabra",
"config" : {
"name" : "PimpWars",
"cmd" : "/usr/bin/dosemu",
"args" : [ "-quiet", "-f", "/home/nuskooler/DOS/X/LORD/dosemu.conf", "X:\\PW\\START.BAT {dropfile} {node}" ]//, "X:\\PW\\PIMPWARS.EXE", "X:\\DROP\\{dropfile}", "{node}" ]
}
},
////////////////////////////////////////////////////////////////////////
// Mods
////////////////////////////////////////////////////////////////////////