This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var monsterAttributes = ['AC', 'XP', 'CR', 'Size', 'HP', 'HD', 'Fort', 'Ref', 'Will', | |
'Str', 'Dex', 'Con', 'Int', 'Wis', 'Cha']; | |
var monsterManual = [ | |
{ | |
"Name": "Janiven", | |
"CR": "2", | |
"XP": "600", | |
"Race": "human", | |
"Class": "ranger 3", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apicmd.on('apicmd', '[options] info', | |
[['-e', '--echo', 'echos the remaining arguments back to chat']], | |
function (msg, argv){ | |
if(argv.opts.echo){ | |
sendChat('API', '/desc ' + argv.args.join(' ')); | |
return; | |
}; | |
}); | |
on('chat:message', function(msg) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Stripped down version Optparse.js | |
// Optparse.js Copyright (c) 2009 Johan Dahlberg (MIT License) | |
var optparse = {}; | |
var apicmd = {}; | |
(function(self) { | |
var LONG_SWITCH_RE = /^--\w+/; | |
var SHORT_SWITCH_RE = /^-\w$/; | |
var NUMBER_RE = /^(0x[A-Fa-f0-9]+)|([0-9]+\.[0-9]+)|(\d+)$/; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var tables = { | |
critical_hits : [ | |
"stubbed a toe", //1 | |
"broke a finger", //2 | |
"lost a limb", //3 | |
"decapitated" //4 | |
], | |
flavor_text : [ | |
"in a turn of luck", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on("chat:message", function(msg) { | |
if(msg.type == "api" && msg.content.indexOf("!random_pc") !== -1) { | |
try { | |
options = JSON.parse(msg.content.substring(10)); | |
} catch( err ) { options = {} } | |
pc = BFRpg.PlayerCharacter.random(options); | |
/* | |
newChar = createObj('character', {name:pc.fullname()}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Function.prototype.inheritsFrom = function( parentClassOrObject ){ | |
if ( parentClassOrObject.constructor == Function ) | |
{ | |
//Normal Inheritance | |
this.prototype = new parentClassOrObject; | |
this.prototype.constructor = this; | |
this.prototype.parent = parentClassOrObject.prototype; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// establish ActiveObject namespace | |
var ActiveObjects = ActiveObjects || {} | |
// create namespace shortcut | |
AO = ActiveObjects; | |
/* | |
ActiveObjects.Object - adds persistent state storage to R20 objects | |
@param {id} ID of Roll20 object. | |
*/ | |
AO.Object = function (state){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
CommandDoors | |
Use CommandTokens to toggle open/closed states for doors, including wall modification for dynamic lighting. | |
Requires: CommandTokens.js | |
Once configured, doors are easy to use - simply move the associated CommandToken to toggle the door from open | |
to closed and back again. Configuring the doors takes a bit of work, but there is a helper function to | |
make the process pretty easy. | |
Before configuring a door, first look at the components of a CommandDoor. A CommandDoor consists of three tokens |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
CommandTokens | |
Associate tokens to API functions and trigger functions when the token is moved. | |
CommandTokens provide an easy way to trigger API functions without typing or complicated layer manipulation by the GM. | |
CommandTokens are powered through an ugly-but-effective naming convention: | |
__[function]_(:[variable_1]:[variable_2]...)__ | |
where [function] is the function to call and the [variable_x] elements are replaced by a colon delimited list | |
of parameters to pass to the function. Parameters are optional (as long as the underlying function is ok with that) | |
and do not require a trailing colon. |