Skip to content

Commit

Permalink
resolving conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
MoreOutput committed Apr 30, 2017
2 parents da1a378 + eb498e7 commit 23181f8
Show file tree
Hide file tree
Showing 34 changed files with 299 additions and 225 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@ node_modules
npm-debug.log
notes.md
design.html
/databases/config.json
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
RockMUD
===============================

**RockMUD (0.3.0) is a WebSockets MUD server**
**RockMUD (0.3.5) is a WebSockets MUD server**

Try the latest on this Heroku hobby instance: http://rockmud.heroku.com. If you connect to the demo server type 'help commands' to get a full(ish) list of the current commands.
Try the latest on this Heroku hobby instance: https://rockmud.herokuapp.com/. If you connect to the demo server type 'help commands' to get a full(ish) list of the current commands.

###Goals:###
### Goals:
* Full featured MUD experience from within the browser.
* Enable quick development.
* Empower client side scripting for GUI.
* DB agnostic persistence.
* Cross-platform

###Dependencies:###
### Dependencies:
* Socket.io 1.0 or greater is required. This is the single outside dependency and is contained to the core message passing functions.
* Development keeps up with latest node release.
* Default terminal loads Bootstrap from CDN.

##10000 feet:##
## 10000 feet:
All design/data elements of RockMUD must be either valid JSON or .js files. Please look at the current code and make an effort to match the current style if you plan to submit a pull request. Documentation has started -- see the github wiki.

###RockMUD development chat through gitter:###

https://gitter.im/rockmud/Lobby?utm_source=share-link&utm_medium=link&utm_campaign=share-link

###Installation###
### Installation
* Install Node, npm, and Git
* Clone the repo
* cd RockMUD (to enter cloned repo)
Expand Down
1 change: 0 additions & 1 deletion ai/aggie.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ World = require('../src/world');
Setting revenge to true limits the mob to only being aggie against the thing that attacked it last.
*/

module.exports = {
attackOnVisit: true,
attackOnAlive: true,
Expand Down
6 changes: 3 additions & 3 deletions ai/wander.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ World = require('../src/world');

/*
Wander behavior. Mob will walk about selecting a random move direction from
mob.moveDirections.
mob.moveDirections.
If the mob.stayinArea property is set to false the mob can wander outside of its starting area.
If the mob.stayinArea property is set to false the mob can wander outside of its starting area.
Adding a mob.wanderCheck value provides a check against 1d10; movement only occurs if the roll
Adding a mob.wanderCheck value provides a check against 1d10; movement only occurs if the roll
beats the given wanderCheck value.
*/
module.exports = {
Expand Down
91 changes: 79 additions & 12 deletions areas/midgaard_academy.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

'use strict';
var Cmd = require('../src/commands'),
Room = require('../src/rooms'),
Expand All @@ -9,17 +10,17 @@ module.exports = {
id: 'midgaard_academy',
type: 'building',
levels: 'All',
description: 'Famous for preparing new adventuers for the world of RockMUD.',
description: 'Famous for preparing new adventuers for the world of ' + World.config.name + '.',
reloads: 0,
author: 'Rocky',
messages: [{
msg: '<span class=\'grey\'>The sounds of sparring apprentices can be heard throughout the halls.</span>'
msg: '<span class=\'grey\'>The sounds of sparring apprentices can be heard from somewhere in the Academy.</span>'
}],
quests: [{
id: 'mud_school',
title: 'Midgaard Training Academy',
entries: {
0: 'You have joined the Midgaardian Academy! Climb to the top of the tower and begin training to make it official.'
0: 'You have joined the Midgaardian Academy! Climb to the top of the tower and begin training and make it official.'
}
}],
rooms: [
Expand Down Expand Up @@ -58,8 +59,6 @@ module.exports = {
diceMod: 5,
str: 20,
dex: 18,
position: 'standing',
attackType: 'punch',
damRoll: 20,
hitRoll: 15,
ac: 20,
Expand All @@ -75,8 +74,8 @@ module.exports = {
learned: true,
prerequisites: {
'level': 1
}
}],
}
}],
behaviors: [{
module: 'radghar'
}]
Expand Down Expand Up @@ -109,8 +108,8 @@ module.exports = {
}

if (!climbSkill && entity.isPlayer && entity.level === 1) {
msg += 'You do not have the climb skill. Climbing further could result in death!';
}
msg += '1You do not have the climb skill. Climbing further could result in a fall!';
}

if (msg) {
World.msgPlayer(entity, {
Expand All @@ -120,7 +119,7 @@ module.exports = {
}
}, {
id: '3',
title: 'Further up the side of the Academy Tower',
title: 'Climbing up the south side of the Academy Tower',
area: 'midgaard_academy',
moveMod: 2,
content: '',
Expand All @@ -130,6 +129,38 @@ module.exports = {
cmd: 'down',
id: '2',
area: 'midgaard_academy'
}, {
cmd: 'up',
id: '4'
}
],
onEnter: function(roomObj, entity, incomingRoomObj, command) {
var climbSkill = Character.getSkill(entity, 'climb'),
displayAfter = 1200,
msg = '';

if (!climbSkill && entity.isPlayer && entity.level === 1) {
msg += 'You do not have the climb skill. Be careful!!';
}

if (msg) {
World.msgPlayer(entity, {
msg: '<p>' + msg + '</p>'
});
}
}
}, {
id: '4',
title: 'Further up the side of Midgaard Academy Tower',
area: 'midgaard_academy',
moveMod: 2,
content: '',
light: true,
exits: [
{
cmd: 'down',
id: '3',
area: 'midgaard_academy'
}
],
beforeEnter: function(roomObj, entity, incomingRoomObj, command) {
Expand All @@ -143,8 +174,10 @@ module.exports = {
climbSkill = Character.getSkill(entity, 'climb');

if (!climbSkill) {
climbRoll = World.dice.roll(1, 3, strMod);

//climbRoll = World.dice.roll(1, 3, strMod);
climbRoll = 1;
console.log('climbRoll: ' + climbRoll);

if (climbRoll < climbCheck) {
msg += '<strong>You fail to climb up and slip downward!</strong>';

Expand Down Expand Up @@ -173,6 +206,40 @@ module.exports = {
return true;
}
}
}, {
id: '5',
title: 'Room at the top of the Academy Tower',
area: 'midgaard_academy',
content: '',
light: true,
monsters: [{
name: 'Thomas',
displayName: 'Thomas',
charClass: 'fighter',
level: 25,
short: 'Squire Thomas',
long: '<span class="yellow">Thomas a tall thin squire of Captain Radghar</span> is here standing next to the twower window',
description: '',
inName: 'Thomas',
race: 'human',
id: 3,
area: 'midgaard_academy',
weight: 155,
diceNum: 2,
diceSides: 10,
diceMod: 5,
str: 20,
dex: 18,
position: 'standing',
attackType: 'punch',
damRoll: 20,
hitRoll: 15,
ac: 20,
items: [],
trainer: true,
runOnAliveWhenEmpty: false
}],
exits: []
}
]
};
2 changes: 1 addition & 1 deletion areas/the_great_valley.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ module.exports = {
j = 0;

for (j; j < y; j += 1) {
roomObj = World.extend({}, JSON.parse(JSON.stringify(World.roomTemplate)));
roomObj = JSON.parse(JSON.stringify(World.roomTemplate)),
roomObj.id = i + '-' + j;
roomObj.content = 'A room';
roomObj.title = 'Empty room ' + i + '-' + j;
Expand Down
2 changes: 1 addition & 1 deletion classes/thief.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"type": "passive",
"prerequisites": {
"level": 1,
"skill": {"id": "backstab", "prop": "train", "value": "78"}
"skill": {"id": "backstab", "prop": "train", "value": 78}
}
}
]
Expand Down
12 changes: 5 additions & 7 deletions config.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
exports.server = {
game: {
port: 3000,
port: 3001,
name: 'RockMUD',
version: '0.3.0',
version: '0.3.5',
website: 'https://github.com/MoreOutput/RockMUD',
description: 'Websockets MUD Engine Demo',
// Name of world currency -- referenced in game
Expand All @@ -16,13 +16,11 @@ exports.server = {
},
// Persistence drivers for data. Server information and players can use differing drivers.
persistenceDriverDir: '../databases/',
persistence: false
/*
persistence: false,
persistence: {
data: {driver: 'flat'},
player: {driver: 'couchdb'}
data: false, // {driver: 'flat'}
player: false // {driver: 'couchdb'}
}
*/
},
admins: []
};
43 changes: 21 additions & 22 deletions databases/couchdb.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,40 +2,39 @@
CouchDB Driver for RockMUD. Example REST driver.
Basically we just make rest calls to an outlined database and grab JSON blobs.
Objects have the same form as the default flat-file system.
Databases should already be seetup within couch.
Database and players/byName should already be setup within couch.
*/
'use strict';
var http = require('http');
var http = require('https'),
dbConfig = require('./config.json');

module.exports = function(config) {
// Setup driver wide properties
var Driver = function() {
var driver = this;

driver.dataDbName = 'rockmud';
driver.playerDbName = 'rockmud_players';
driver.dbHost = '127.0.0.1';
driver.dbPort = 5984;
driver.username = '';
driver.password = '';
driver.dataView = 'areasByName',
driver.playerView = '_design/players/_view/byName?key=';
driver.playerDbName = dbConfig.db;
driver.dbHost = dbConfig.host;
driver.dbPort = dbConfig.port;
driver.username = dbConfig.username;
driver.password = dbConfig.password;
driver.playerView = dbConfig.players; // _design/players/_view/byName?key=
driver.authHeader = 'Basic ' + new Buffer(driver.username + ':' + driver.password).toString('base64');
driver.createGenericOpt = function(method, db, data) {
var path = '/' + driver.playerDbName;
var path = '/' + driver.playerDbName;

return {
hostname: driver.dbHost,
method: method,
method: method,
port: driver.dbPort,
path: path,
headers: {
'Content-Type': 'application/json',
headers: {
'Content-Type': 'application/json',
'Authorization': driver.authHeader
}
}
};
};

Expand All @@ -50,12 +49,12 @@ module.exports = function(config) {
});

res.on('end', function() {
fn(false, obj);
});
fn(false, obj);
});
});

req.on('error', function(e) {

console.log('couchDB Driver error in savePlayer()', e);
});

req.write(obj);
Expand Down Expand Up @@ -97,14 +96,14 @@ module.exports = function(config) {
}

if (result) {
return fn(false, result);
return fn(false, result);
} else {
return fn(true, false);
}
});
});
}).end();
};

return new Driver();
}

12 changes: 6 additions & 6 deletions databases/flat.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
var fs = require('fs');

module.exports = function(config) {
// Setup driver wide properties
// Setup driver-wide properties
var Driver = function() {
var defaultPath = './areas';
var persistenceFolder = '/persistence';
Expand All @@ -22,7 +22,7 @@ module.exports = function(config) {
} else {
this.path = config.path;
}

if (!config.persistenceFolder) {
this.persistenceFolder= persistenceFolder;
} else {
Expand All @@ -31,13 +31,12 @@ module.exports = function(config) {

this.config = config;
}

return this;
};

// Get all areas. First driver function called.
// Must be given a function with is called with a creared areas array.
// Arrays array must be a set of JSON areas.
// Get all areas. This is the first driver callback executed.
// Must be given a function which is passed an array of created areas.
Driver.prototype.loadAreas = function(fn) {
var driver = this,
areas = [];
Expand Down Expand Up @@ -109,3 +108,4 @@ module.exports = function(config) {

return new Driver();
}

Loading

0 comments on commit 23181f8

Please sign in to comment.