Compare commits
87 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
73d1419ee9 | ||
|
|
681ef614c7 | ||
|
|
2bdbcb2e79 | ||
|
|
c119fcfbb8 | ||
|
|
deb5db8657 | ||
|
|
49522580e3 | ||
|
|
5b50f20128 | ||
|
|
52fa97c952 | ||
|
|
e7a5ce8241 | ||
|
|
d1b9043e1f | ||
|
|
9ffc5649f7 | ||
|
|
15e6c12c03 | ||
|
|
e89b877326 | ||
|
|
aff2f1f438 | ||
|
|
71d1e9e9e8 | ||
|
|
0696fd8447 | ||
|
|
b2db33e0f3 | ||
|
|
0c2842b84a | ||
|
|
789658cfe7 | ||
|
|
3be3da777f | ||
|
|
0e53f157d2 | ||
|
|
24cc4fd2b1 | ||
|
|
1f0ea689dc | ||
|
|
11adf9da04 | ||
|
|
5ca81056f9 | ||
|
|
6fc469f934 | ||
|
|
0c7948afdd | ||
|
|
42ffc79499 | ||
|
|
0240209410 | ||
|
|
c4c1afa669 | ||
|
|
47ac090e9d | ||
|
|
aadc83391f | ||
|
|
54fb398056 | ||
|
|
073094f6dd | ||
|
|
832ed0c1ff | ||
|
|
e65a2db0d2 | ||
|
|
6729bcad64 | ||
|
|
7af07e7ba3 | ||
|
|
f44914ab84 | ||
|
|
59c7eff46a | ||
|
|
2a332a2965 | ||
|
|
44a1daf6f8 | ||
|
|
ac23afac5d | ||
|
|
a411fb2b43 | ||
|
|
35b6fe20ae | ||
|
|
54f055d3ef | ||
|
|
2bacb296ba | ||
|
|
8b061f7aa9 | ||
|
|
6a84c83644 | ||
|
|
3227cd0934 | ||
|
|
089feae26f | ||
|
|
99c72d1e10 | ||
|
|
1e67afbe6f | ||
|
|
1cfec1ca45 | ||
|
|
09d1ac9ba3 | ||
|
|
834b9cf384 | ||
|
|
37291b347a | ||
|
|
efdfbeb59e | ||
|
|
a165f9b253 | ||
|
|
4a6fca98bc | ||
|
|
35464128a0 | ||
|
|
398f8a8a2a | ||
|
|
812a1784b2 | ||
|
|
8fa9cd0148 | ||
|
|
0e0662cc9a | ||
|
|
ad4e3f5b20 | ||
|
|
4cd058e1fe | ||
|
|
8f30cee4d3 | ||
|
|
d7f7eb2e6a | ||
|
|
a59cf1162f | ||
|
|
7bc80da99e | ||
|
|
2ddc520bb6 | ||
|
|
d92bb0f4d4 | ||
|
|
abcfe57add | ||
|
|
cdae75beef | ||
|
|
e7bcc2224c | ||
|
|
b591c66dd5 | ||
|
|
402bc0e5ed | ||
|
|
ac772531ee | ||
|
|
9a3edb07e4 | ||
|
|
fea45d2398 | ||
|
|
18aa1b2040 | ||
|
|
9afe38d043 | ||
|
|
5ddbecf97e | ||
|
|
7b573ca86e | ||
|
|
a9256fed05 | ||
|
|
8ec10e7a6a |
@@ -1,13 +1,13 @@
|
||||
RPG Docs
|
||||
========
|
||||
|
||||
This is the repo for [DiceCloud](dicecloud.com). The currently deployed version should always be the latest release of the master branch.
|
||||
This is the repo for [DiceCloud](dicecloud.com).
|
||||
|
||||
Getting started
|
||||
---------------
|
||||
|
||||
`git clone https://github.com/ThaumRystra/RPG-Docs RPG-Docs`
|
||||
`cd RPG-Docs`
|
||||
`git clone https://github.com/ThaumRystra/DiceCloud1 dicecloud`
|
||||
`cd dicecloud`
|
||||
`cd rpg-docs`
|
||||
`bower install`
|
||||
`meteor`
|
||||
|
||||
4798
dataSources/srd/spells.json
Normal file
4798
dataSources/srd/spells.json
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,3 +1,5 @@
|
||||
// This all gets run in the console by an admin.
|
||||
// Probably a good idea to reset the server after running big updates
|
||||
// Only do if the library doesn't exist yet
|
||||
id = Libraries.insert({
|
||||
_id: "SRDLibraryGA3XWsd",
|
||||
@@ -5,8 +7,50 @@ id = Libraries.insert({
|
||||
name: "SRD Library",
|
||||
});
|
||||
|
||||
// First copy-paste the JSON into your console like `items = <pasted JSON>`
|
||||
// First import, don't do this if the library is already populated
|
||||
_.each(items, (item) => {
|
||||
item.settings = {category: }; // "adventuringGear", "armor", "weapons", "tools"
|
||||
item.library = "SRDLibraryGA3XWsd"
|
||||
LibraryItems.insert(item)
|
||||
});
|
||||
|
||||
_.each(spells, (spell) => {
|
||||
spell.library = "SRDLibraryGA3XWsd"
|
||||
LibrarySpells.insert(spell)
|
||||
});
|
||||
|
||||
// Update the library using names as keys
|
||||
// Make sure you're subscribed to all item categories
|
||||
handles = _.map(["weapons", "armor", "adventuringGear", "tools"],
|
||||
category => Meteor.subscribe("standardLibraryItems", category)
|
||||
);
|
||||
// Wait until all the handles are ready
|
||||
handles.map(h => h.ready()); // must reaturn [...true]
|
||||
|
||||
_.each(items, (item) => {
|
||||
var existingItem = LibraryItems.findOne({
|
||||
library: "SRDLibraryGA3XWsd",
|
||||
name: item.name,
|
||||
});
|
||||
if (!existingItem) return;
|
||||
_.each(item.attacks, attack => Schemas.LibraryAttacks.clean(attack));
|
||||
LibraryItems.update(existingItem._id, {$set: item});
|
||||
});
|
||||
|
||||
// Make sure you're subscribed to all spell categories
|
||||
handles = _.map([0, 1, 2, 3, 4, 5, 6, 7, 8, 9],
|
||||
category => Meteor.subscribe("standardLibrarySpells", category)
|
||||
);
|
||||
// Wait until all the handles are ready
|
||||
handles.map(h => h.ready()); // must reaturn [...true]
|
||||
|
||||
_.each(spells, (spell) => {
|
||||
var existingSpell = LibrarySpells.findOne({
|
||||
library: "SRDLibraryGA3XWsd",
|
||||
name: spell.name,
|
||||
});
|
||||
if (!existingSpell) return;
|
||||
_.each(spell.attacks, attack => Schemas.LibraryAttacks.clean(attack));
|
||||
LibrarySpells.update(existingSpell._id, {$set: spell});
|
||||
});
|
||||
|
||||
@@ -47,3 +47,6 @@ ecmascript@0.6.1
|
||||
es5-shim@4.6.15
|
||||
differential:vulcanize
|
||||
reactive-dict
|
||||
percolate:synced-cron
|
||||
ongoworks:speakingurl
|
||||
service-configuration
|
||||
|
||||
@@ -85,8 +85,10 @@ npm-mongo@2.2.16_1
|
||||
oauth@1.1.12
|
||||
oauth2@1.1.11
|
||||
observe-sequence@1.0.14
|
||||
ongoworks:speakingurl@9.0.0
|
||||
ordered-dict@1.0.9
|
||||
percolate:migrations@0.9.8
|
||||
percolate:synced-cron@1.3.2
|
||||
promise@0.8.8
|
||||
raix:eventemitter@0.1.3
|
||||
random@1.0.10
|
||||
|
||||
@@ -1,8 +1,42 @@
|
||||
Parties = new Mongo.Collection("parties");
|
||||
|
||||
Schemas.Party = new SimpleSchema({
|
||||
//each character/monster can only be in one party at a time
|
||||
//each party can only be in a single instance at a time
|
||||
name: {
|
||||
type: String,
|
||||
defaultValue: "New Party",
|
||||
trim: false,
|
||||
optional: true,
|
||||
},
|
||||
characters: {
|
||||
type: [String],
|
||||
regEx: SimpleSchema.RegEx.Id,
|
||||
index: 1,
|
||||
defaultValue: [],
|
||||
},
|
||||
owner: {
|
||||
type: String,
|
||||
regEx: SimpleSchema.RegEx.Id,
|
||||
},
|
||||
});
|
||||
|
||||
Parties.attachSchema(Schemas.Party);
|
||||
|
||||
Parties.allow({
|
||||
insert: function(userId, doc) {
|
||||
return userId && doc.owner === userId;
|
||||
},
|
||||
update: function(userId, doc, fields, modifier) {
|
||||
return userId && doc.owner === userId;
|
||||
},
|
||||
remove: function(userId, doc) {
|
||||
return userId && doc.owner === userId;
|
||||
},
|
||||
fetch: ["owner"],
|
||||
});
|
||||
|
||||
Parties.deny({
|
||||
update: function(userId, docs, fields, modifier) {
|
||||
// can't change owners
|
||||
return _.contains(fields, "owner");
|
||||
}
|
||||
});
|
||||
|
||||
@@ -11,10 +11,12 @@ Schemas.Action = new SimpleSchema({
|
||||
},
|
||||
name: {
|
||||
type: String,
|
||||
optional: true,
|
||||
trim: false,
|
||||
},
|
||||
description: {
|
||||
type: String,
|
||||
optional: true,
|
||||
trim: false,
|
||||
},
|
||||
type: {
|
||||
|
||||
@@ -12,6 +12,7 @@ Schemas.Attack = new SimpleSchema({
|
||||
name: {
|
||||
type: String,
|
||||
defaultValue: "New Attack",
|
||||
optional: true,
|
||||
trim: false,
|
||||
},
|
||||
details: {
|
||||
|
||||
@@ -8,6 +8,7 @@ Schemas.Buff = new SimpleSchema({
|
||||
},
|
||||
name: {
|
||||
type: String,
|
||||
optional: true,
|
||||
trim: false,
|
||||
},
|
||||
description: {
|
||||
|
||||
@@ -4,6 +4,7 @@ Characters = new Mongo.Collection("characters");
|
||||
Schemas.Character = new SimpleSchema({
|
||||
//strings
|
||||
name: {type: String, defaultValue: "", trim: false, optional: true},
|
||||
urlName: {type: String, defaultValue: "-", trim: false, optional: true},
|
||||
alignment: {type: String, defaultValue: "", trim: false, optional: true},
|
||||
gender: {type: String, defaultValue: "", trim: false, optional: true},
|
||||
race: {type: String, defaultValue: "", trim: false, optional: true},
|
||||
@@ -184,6 +185,10 @@ Schemas.Character = new SimpleSchema({
|
||||
defaultValue: "whitelist",
|
||||
allowedValues: ["whitelist", "public"],
|
||||
},
|
||||
"settings.swapStatAndModifier": {type: Boolean, defaultValue: false},
|
||||
"settings.exportFeatures": {type: Boolean, defaultValue: true},
|
||||
"settings.exportAttacks": {type: Boolean, defaultValue: true},
|
||||
"settings.exportDescription": {type: Boolean, defaultValue: true},
|
||||
});
|
||||
|
||||
Characters.attachSchema(Schemas.Character);
|
||||
@@ -254,7 +259,10 @@ var attributeBase = preventLoop(function(charId, statName){
|
||||
var result = (base + add) * mul;
|
||||
if (result < min) result = min;
|
||||
if (result > max) result = max;
|
||||
|
||||
// Don't round carry multiplier
|
||||
if (statName === "carryMultiplier"){
|
||||
return result;
|
||||
}
|
||||
return Math.floor(result);
|
||||
});
|
||||
|
||||
@@ -534,6 +542,15 @@ if (Meteor.isServer){
|
||||
Items .remove({charId: character._id});
|
||||
Containers .remove({charId: character._id});
|
||||
});
|
||||
Characters.after.update(function(userId, doc, fieldNames, modifier, options) {
|
||||
if (_.contains(fieldNames, "name")){
|
||||
var urlName = getSlug(doc.name, {maintainCase: true}) || "-";
|
||||
Characters.update(doc._id, {$set: {urlName}});
|
||||
}
|
||||
});
|
||||
Characters.before.insert(function(userId, doc) {
|
||||
doc.urlName = getSlug(doc.name, {maintainCase: true}) || "-";
|
||||
});
|
||||
}
|
||||
|
||||
Characters.allow({
|
||||
|
||||
@@ -2,7 +2,7 @@ Classes = new Mongo.Collection("classes");
|
||||
|
||||
Schemas.Class = new SimpleSchema({
|
||||
charId: {type: String, regEx: SimpleSchema.RegEx.Id, index: 1},
|
||||
name: {type: String, trim: false},
|
||||
name: {type: String, optional: true, trim: false},
|
||||
level: {type: Number},
|
||||
createdAt: {
|
||||
type: Date,
|
||||
|
||||
@@ -2,7 +2,7 @@ Experiences = new Mongo.Collection("experience");
|
||||
|
||||
Schemas.Experience = new SimpleSchema({
|
||||
charId: {type: String, regEx: SimpleSchema.RegEx.Id, index: 1},
|
||||
name: {type: String, defaultValue: "New Experience", trim: false},
|
||||
name: {type: String, optional: true, trim: false, defaultValue: "New Experience"},
|
||||
description: {type: String, optional: true, trim: false},
|
||||
value: {type: Number, defaultValue: 0},
|
||||
dateAdded: {
|
||||
|
||||
@@ -2,7 +2,7 @@ Features = new Mongo.Collection("features");
|
||||
|
||||
Schemas.Feature = new SimpleSchema({
|
||||
charId: {type: String, regEx: SimpleSchema.RegEx.Id, index: 1},
|
||||
name: {type: String, trim: false},
|
||||
name: {type: String, optional: true, trim: false},
|
||||
description: {type: String, optional: true, trim: false},
|
||||
uses: {type: String, optional: true, trim: false},
|
||||
used: {type: Number, defaultValue: 0},
|
||||
|
||||
@@ -2,7 +2,7 @@ Notes = new Mongo.Collection("notes");
|
||||
|
||||
Schemas.Note = new SimpleSchema({
|
||||
charId: {type: String, regEx: SimpleSchema.RegEx.Id, index: 1},
|
||||
name: {type: String, trim: false},
|
||||
name: {type: String, optional: true, trim: false},
|
||||
description: {type: String, optional: true, trim: false},
|
||||
color: {
|
||||
type: String,
|
||||
|
||||
@@ -2,7 +2,7 @@ SpellLists = new Mongo.Collection("spellLists");
|
||||
|
||||
Schemas.SpellLists = new SimpleSchema({
|
||||
charId: {type: String, regEx: SimpleSchema.RegEx.Id, index: 1},
|
||||
name: {type: String, trim: false},
|
||||
name: {type: String, optional: true, trim: false},
|
||||
description: {type: String, optional: true, trim: false},
|
||||
saveDC: {type: String, optional: true, trim: false},
|
||||
attackBonus: {type: String, optional: true, trim: false},
|
||||
|
||||
@@ -9,6 +9,7 @@ Schemas.Spell = new SimpleSchema({
|
||||
},
|
||||
name: {
|
||||
type: String,
|
||||
optional: true,
|
||||
trim: false,
|
||||
defaultValue: "New Spell",
|
||||
},
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
Containers = new Mongo.Collection("containers");
|
||||
|
||||
Schemas.Container = new SimpleSchema({
|
||||
name: {type: String, trim: false},
|
||||
name: {type: String, optional: true, trim: false},
|
||||
charId: {type: String, regEx: SimpleSchema.RegEx.Id, index: 1},
|
||||
isCarried: {type: Boolean},
|
||||
weight: {type: Number, min: 0, defaultValue: 0, decimal: true},
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
Items = new Mongo.Collection("items");
|
||||
|
||||
Schemas.Item = new SimpleSchema({
|
||||
name: {type: String, defaultValue: "New Item", trim: false},
|
||||
name: {type: String, optional: true, trim: false, defaultValue: "New Item"},
|
||||
plural: {type: String, optional: true, trim: false},
|
||||
description:{type: String, optional: true, trim: false},
|
||||
charId: {type: String, regEx: SimpleSchema.RegEx.Id, index: 1}, //id of owner
|
||||
|
||||
@@ -11,13 +11,11 @@ Schemas.LibraryAttacks = new SimpleSchema({
|
||||
},
|
||||
attackBonus: {
|
||||
type: String,
|
||||
defaultValue: "strengthMod + proficiencyBonus",
|
||||
optional: true,
|
||||
trim: false,
|
||||
},
|
||||
damage: {
|
||||
type: String,
|
||||
defaultValue: "1d8 + {strengthMod}",
|
||||
optional: true,
|
||||
trim: false,
|
||||
},
|
||||
|
||||
66
rpg-docs/Model/Library/LibrarySpells.js
Normal file
66
rpg-docs/Model/Library/LibrarySpells.js
Normal file
@@ -0,0 +1,66 @@
|
||||
LibrarySpells = new Mongo.Collection("librarySpells");
|
||||
|
||||
Schemas.LibrarySpells = new SimpleSchema({
|
||||
name: {
|
||||
type: String,
|
||||
trim: false,
|
||||
defaultValue: "New Spell",
|
||||
},
|
||||
description: {
|
||||
type: String,
|
||||
optional: true,
|
||||
trim: false,
|
||||
},
|
||||
castingTime: {
|
||||
type: String,
|
||||
optional: true,
|
||||
defaultValue: "action",
|
||||
trim: false,
|
||||
},
|
||||
range: {
|
||||
type: String,
|
||||
optional: true,
|
||||
trim: false,
|
||||
},
|
||||
duration: {
|
||||
type: String,
|
||||
optional: true,
|
||||
trim: false,
|
||||
defaultValue: "Instantaneous",
|
||||
},
|
||||
"components.verbal": {type: Boolean, defaultValue: false},
|
||||
"components.somatic": {type: Boolean, defaultValue: false},
|
||||
"components.concentration": {type: Boolean, defaultValue: false},
|
||||
"components.material": {type: String, optional: true},
|
||||
ritual: {
|
||||
type: Boolean,
|
||||
defaultValue: false,
|
||||
},
|
||||
level: {
|
||||
type: Number,
|
||||
defaultValue: 1,
|
||||
},
|
||||
school: {
|
||||
type: String,
|
||||
defaultValue: "Abjuration",
|
||||
allowedValues: magicSchools,
|
||||
},
|
||||
library: {type: String, regEx: SimpleSchema.RegEx.Id, index: 1},
|
||||
effects: {type: [Schemas.LibraryEffects], defaultValue: []},
|
||||
attacks: {type: [Schemas.LibraryAttacks], defaultValue: []},
|
||||
});
|
||||
|
||||
LibrarySpells.attachSchema(Schemas.LibrarySpells);
|
||||
|
||||
LibrarySpells.allow({
|
||||
insert(userId, doc) {
|
||||
return Libraries.canEdit(userId, doc.library);
|
||||
},
|
||||
update(userId, doc, fields, modifier) {
|
||||
return Libraries.canEdit(userId, doc.library);
|
||||
},
|
||||
remove(userId, doc) {
|
||||
return Libraries.canEdit(userId, doc.library);
|
||||
},
|
||||
fetch: ["library"],
|
||||
});
|
||||
@@ -24,7 +24,7 @@ Router.map(function() {
|
||||
this.route("characterList", {
|
||||
path: "/characterList",
|
||||
waitOn: function(){
|
||||
return subsManager.subscribe("characterList", Meteor.userId());
|
||||
return subsManager.subscribe("characterList");
|
||||
},
|
||||
onAfterAction: function() {
|
||||
document.title = appName + " - Characters";
|
||||
@@ -32,11 +32,27 @@ Router.map(function() {
|
||||
fastRender: true,
|
||||
});
|
||||
|
||||
this.route("characterSheet", {
|
||||
path: "/character/:_id",
|
||||
this.route("characterSheetNaked", {
|
||||
path: "/character/:_id/",
|
||||
waitOn: function(){
|
||||
return [
|
||||
subsManager.subscribe("singleCharacter", this.params._id, Meteor.userId()),
|
||||
subsManager.subscribe("singleCharacter", this.params._id),
|
||||
];
|
||||
},
|
||||
action: function(){
|
||||
var _id = this.params._id
|
||||
var character = Characters.findOne(_id);
|
||||
var urlName = character && character.urlName;
|
||||
var path = `\/character\/${_id}\/${urlName || "-"}`;
|
||||
Router.go(path,{},{replaceState:true});
|
||||
},
|
||||
});
|
||||
|
||||
this.route("characterSheet", {
|
||||
path: "/character/:_id/:urlName",
|
||||
waitOn: function(){
|
||||
return [
|
||||
subsManager.subscribe("singleCharacter", this.params._id),
|
||||
];
|
||||
},
|
||||
data: function() {
|
||||
|
||||
3
rpg-docs/client/globalHelpers/characterPath.js
Normal file
3
rpg-docs/client/globalHelpers/characterPath.js
Normal file
@@ -0,0 +1,3 @@
|
||||
Template.registerHelper("characterPath", function(char) {
|
||||
return `\/character\/${char._id}\/${char.urlName || "-"}`;
|
||||
});
|
||||
@@ -24,6 +24,10 @@ Template.registerHelper("evaluateString", function(charId, string) {
|
||||
return evaluateString(charId, string);
|
||||
});
|
||||
|
||||
Template.registerHelper("evaluateSpellString", function(charId, spellListId, string) {
|
||||
return evaluateSpellString(charId, spellListId, string);
|
||||
});
|
||||
|
||||
Template.registerHelper("evaluateShortString", function(charId, string) {
|
||||
if (_.isString(string)){
|
||||
return evaluateString(
|
||||
|
||||
195
rpg-docs/client/lib/improvedInitiativeJson.js
Normal file
195
rpg-docs/client/lib/improvedInitiativeJson.js
Normal file
@@ -0,0 +1,195 @@
|
||||
improvedInitiativeJson = function(charId, options){
|
||||
options = options || {
|
||||
features: true,
|
||||
attacks: true,
|
||||
description: true,
|
||||
};
|
||||
var char = Characters.findOne(charId);
|
||||
if (!char) return;
|
||||
var baseValue = function(attributeName){
|
||||
return Characters.calculate.attributeBase(charId, attributeName);
|
||||
};
|
||||
var skillMod = function(skillName){
|
||||
return Characters.calculate.skillMod(charId, skillName);
|
||||
};
|
||||
var damageMods = getDamageMods(charId);
|
||||
return JSON.stringify({
|
||||
"Id": char._id,
|
||||
"Name": char.name,
|
||||
"Source": "DiceCloud",
|
||||
"Type": char.race,
|
||||
"HP": {
|
||||
"Value": baseValue("hitPoints"),
|
||||
"Notes": getHitDiceString(charId) || "",
|
||||
},
|
||||
"AC": {
|
||||
"Value": baseValue("armor"),
|
||||
"Notes": getArmorString(charId) || "",
|
||||
},
|
||||
"InitiativeModifier": skillMod("initiative"),
|
||||
"Speed": ["" + baseValue("speed")],
|
||||
"Abilities": {
|
||||
"Str": baseValue("strength"),
|
||||
"Dex": baseValue("dexterity"),
|
||||
"Con": baseValue("constitution"),
|
||||
"Cha": baseValue("charisma"),
|
||||
"Int": baseValue("intelligence"),
|
||||
"Wis": baseValue("wisdom"),
|
||||
},
|
||||
"DamageVulnerabilities": damageMods.vulnerabilities,
|
||||
"DamageResistances": damageMods.resistances,
|
||||
"DamageImmunities": damageMods.immunities,
|
||||
"ConditionImmunities": [],
|
||||
"Saves": [
|
||||
{"Name": "Str", "Modifier": skillMod("strengthSave")},
|
||||
{"Name": "Dex", "Modifier": skillMod("dexteritySave")},
|
||||
{"Name": "Con", "Modifier": skillMod("constitutionSave")},
|
||||
{"Name": "Int", "Modifier": skillMod("intelligenceSave")},
|
||||
{"Name": "Wis", "Modifier": skillMod("wisdomSave")},
|
||||
{"Name": "Cha", "Modifier": skillMod("charismaSave")},
|
||||
],
|
||||
"Skills": getSkills(charId),
|
||||
"Senses": [
|
||||
"passive Perception " +
|
||||
Characters.calculate.passiveSkill(charId, "perception")
|
||||
],
|
||||
"Languages": getLanguages(charId),
|
||||
"Challenge": "",
|
||||
"Traits": options.features ? getTraits(charId) : [],
|
||||
"Actions": options.attacks ? getActions(charId) : [],
|
||||
"Reactions": [],
|
||||
"LegendaryActions": [],
|
||||
"Description": options.description ? char.description : "",
|
||||
"Player": Meteor.user().username,
|
||||
}, null, 2);
|
||||
}
|
||||
|
||||
var getHitDiceString = function(charId){
|
||||
var d6 = Characters.calculate.attributeBase(charId, "d6HitDice");
|
||||
var d8 = Characters.calculate.attributeBase(charId, "d8HitDice");
|
||||
var d10 = Characters.calculate.attributeBase(charId, "d10HitDice");
|
||||
var d12 = Characters.calculate.attributeBase(charId, "d12HitDice");
|
||||
var con = Characters.calculate.abilityMod(charId,"constitution");
|
||||
var string = "" +
|
||||
(d6 ? `${d6}d6 + ` : "") +
|
||||
(d8 ? `${d8}d8 + ` : "") +
|
||||
(d10 ? `${d10}d10 + ` : "") +
|
||||
(d12 ? `${d12}d12 + ` : "") +
|
||||
con;
|
||||
}
|
||||
|
||||
var getArmorString = function(charId){
|
||||
var bases = Effects.find({
|
||||
charId: charId,
|
||||
stat: "armor",
|
||||
operation: "base",
|
||||
enabled: true,
|
||||
}).map(e => ({
|
||||
ame: e.name,
|
||||
value: evaluateEffect(charId, e),
|
||||
}));
|
||||
var base = bases.length && _.max(bases, b => b.value).name || "";
|
||||
var effects = Effects.find({
|
||||
charId: charId,
|
||||
stat: "armor",
|
||||
operation: {$ne: "base"},
|
||||
enabled: true,
|
||||
}).map(e => e.name);
|
||||
var strings = base ? [base] : [];
|
||||
strings = strings.concat(effects);
|
||||
return strings.join(", ");
|
||||
}
|
||||
|
||||
var getDamageMods = function(charId){
|
||||
// jscs:disable maximumLineLength
|
||||
var multipliers = [
|
||||
{name: "Acid", value: Characters.calculate.attributeValue(charId, "acidMultiplier")},
|
||||
{name: "Bludgeoning", value: Characters.calculate.attributeValue(charId, "bludgeoningMultiplier")},
|
||||
{name: "Cold", value: Characters.calculate.attributeValue(charId, "coldMultiplier")},
|
||||
{name: "Fire", value: Characters.calculate.attributeValue(charId, "fireMultiplier")},
|
||||
{name: "Force", value: Characters.calculate.attributeValue(charId, "forceMultiplier")},
|
||||
{name: "Lightning", value: Characters.calculate.attributeValue(charId, "lightningMultiplier")},
|
||||
{name: "Necrotic", value: Characters.calculate.attributeValue(charId, "necroticMultiplier")},
|
||||
{name: "Piercing", value: Characters.calculate.attributeValue(charId, "piercingMultiplier")},
|
||||
{name: "Poison", value: Characters.calculate.attributeValue(charId, "poisonMultiplier")},
|
||||
{name: "Psychic", value: Characters.calculate.attributeValue(charId, "psychicMultiplier")},
|
||||
{name: "Radiant", value: Characters.calculate.attributeValue(charId, "radiantMultiplier")},
|
||||
{name: "Slashing", value: Characters.calculate.attributeValue(charId, "slashingMultiplier")},
|
||||
{name: "Thunder", value: Characters.calculate.attributeValue(charId, "thunderMultiplier")},
|
||||
];
|
||||
// jscs:enable maximumLineLength
|
||||
multipliers = _.groupBy(multipliers, "value");
|
||||
var names = o => o.name;
|
||||
return {
|
||||
"immunities": _.map(multipliers["0"], names),
|
||||
"resistances": _.map(multipliers["0.5"], names),
|
||||
"vulnerabilities": _.map(multipliers["2"], names),
|
||||
};
|
||||
}
|
||||
|
||||
var getSkills = function(charId){
|
||||
var allSkills = [
|
||||
{name: "acrobatics", attribute: "dexterity"},
|
||||
{name: "animalHandling", attribute: "wisdom"},
|
||||
{name: "arcana", attribute: "intelligence"},
|
||||
{name: "athletics", attribute: "strength"},
|
||||
{name: "deception", attribute: "charisma"},
|
||||
{name: "history", attribute: "intelligence"},
|
||||
{name: "insight", attribute: "wisdom"},
|
||||
{name: "intimidation", attribute: "charisma"},
|
||||
{name: "investigation", attribute: "intelligence"},
|
||||
{name: "medicine", attribute: "wisdom"},
|
||||
{name: "nature", attribute: "intelligence"},
|
||||
{name: "perception", attribute: "wisdom"},
|
||||
{name: "performance", attribute: "charisma"},
|
||||
{name: "persuasion", attribute: "charisma"},
|
||||
{name: "religion", attribute: "intelligence"},
|
||||
{name: "sleightOfHand", attribute: "dexterity"},
|
||||
{name: "stealth", attribute: "dexterity"},
|
||||
{name: "survival", attribute: "wisdom"},
|
||||
];
|
||||
var skills = [];
|
||||
_.each(allSkills, skill => {
|
||||
var value = Characters.calculate.skillMod(charId, skill.name);
|
||||
var mod = Characters.calculate.abilityMod(charId, skill.attribute);
|
||||
if (value !== mod){
|
||||
skills.push({Name: skill.name, Modifier: value});
|
||||
}
|
||||
});
|
||||
return skills;
|
||||
};
|
||||
|
||||
var getLanguages = function(charId){
|
||||
return Proficiencies.find({
|
||||
charId,
|
||||
enabled: true,
|
||||
type: "language",
|
||||
}).map(l => l.name);
|
||||
};
|
||||
|
||||
var getTraits = function(charId){
|
||||
return Features.find(
|
||||
{charId: charId},
|
||||
{sort: {color: 1, name: 1}}
|
||||
).map(f => ({
|
||||
Name: f.name,
|
||||
// evaluateShortString helper
|
||||
Content: evaluateString(
|
||||
charId, f.description && f.description.split(/^( *[-*_]){3,} *(?:\n+|$)/m)[0]
|
||||
) || "",
|
||||
Usage: "",
|
||||
}));
|
||||
}
|
||||
|
||||
var getActions = function(charId){
|
||||
return Attacks.find(
|
||||
{charId, enabled: true},
|
||||
{sort: {color: 1, name: 1}}
|
||||
).map(a => ({
|
||||
Name: a.name,
|
||||
Content: `+${evaluate(charId, a.attackBonus)} to hit, ` +
|
||||
`${evaluateString(charId, a.damage)} ${a.damageType} damage, ` +
|
||||
`${a.details}`,
|
||||
Usage: "",
|
||||
}));
|
||||
}
|
||||
28
rpg-docs/client/lib/requestAnimationFramePolyfill.js
Normal file
28
rpg-docs/client/lib/requestAnimationFramePolyfill.js
Normal file
@@ -0,0 +1,28 @@
|
||||
// http://paulirish.com/2011/requestanimationframe-for-smart-animating/
|
||||
// http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating
|
||||
|
||||
// requestAnimationFrame polyfill by Erik Möller. fixes from Paul Irish and Tino Zijdel
|
||||
|
||||
// MIT license
|
||||
var lastTime = 0;
|
||||
var vendors = ["ms", "moz", "webkit", "o"];
|
||||
for (var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) {
|
||||
window.requestAnimationFrame = window[vendors[x] + "RequestAnimationFrame"];
|
||||
window.cancelAnimationFrame = window[vendors[x] + "CancelAnimationFrame"] ||
|
||||
window[vendors[x] + "CancelRequestAnimationFrame"];
|
||||
}
|
||||
|
||||
if (!window.requestAnimationFrame)
|
||||
window.requestAnimationFrame = function(callback, element) {
|
||||
var currTime = new Date().getTime();
|
||||
var timeToCall = Math.max(0, 16 - (currTime - lastTime));
|
||||
var id = window.setTimeout(function() { callback(currTime + timeToCall); },
|
||||
timeToCall);
|
||||
lastTime = currTime + timeToCall;
|
||||
return id;
|
||||
};
|
||||
|
||||
if (!window.cancelAnimationFrame)
|
||||
window.cancelAnimationFrame = function(id) {
|
||||
clearTimeout(id);
|
||||
};
|
||||
@@ -4,6 +4,7 @@
|
||||
column-gap: 0px;
|
||||
column-width: 304px;
|
||||
padding: 4px;
|
||||
transform: translateZ(0);
|
||||
}
|
||||
|
||||
.column-container.thin-columns {
|
||||
@@ -22,6 +23,7 @@
|
||||
.card {
|
||||
background: white;
|
||||
border-radius: 2px;
|
||||
position: initial;
|
||||
}
|
||||
|
||||
.card .top {
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
body .paper-font-display4, body .paper-font-display3, body .paper-font-title, body .paper-font-caption{
|
||||
white-space: normal;
|
||||
}
|
||||
|
||||
.white-text {
|
||||
color: #dedede;
|
||||
color: rgba(255,255,255,0.87);
|
||||
|
||||
@@ -7,12 +7,32 @@ Template.attackEditList.helpers({
|
||||
|
||||
Template.attackEditList.events({
|
||||
"tap #addAttackButton": function() {
|
||||
if (typeof this.isSpell !== 'undefined' && this.isSpell) {
|
||||
var parentSpell = Spells.findOne({"_id": this.parentId})
|
||||
if (parentSpell && parentSpell.parent.collection == "SpellLists") {
|
||||
var spellList = SpellLists.findOne({"_id":parentSpell.parent.id});
|
||||
if (spellList && spellList.attackBonus) {
|
||||
Attacks.insert({
|
||||
charId: this.charId,
|
||||
parent: {
|
||||
id: this.parentId,
|
||||
collection: this.parentCollection
|
||||
},
|
||||
attackBonus: "attackBonus",
|
||||
damage: "1d10",
|
||||
damageType: "fire",
|
||||
});
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Attacks.insert({
|
||||
charId: this.charId,
|
||||
parent: {
|
||||
id: this.parentId,
|
||||
collection: this.parentCollection
|
||||
}
|
||||
},
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
<template name="attackView">
|
||||
<div class="attackView layout horizontal">
|
||||
<div class="paper-font-headline layout horizontal center" style="margin-right: 16px;">
|
||||
{{evaluateSigned charId attackBonus}}
|
||||
{{evaluateAttackBonus charId attack}}
|
||||
</div>
|
||||
<div class="layout vertical">
|
||||
<div>
|
||||
{{evaluateString charId damage}} {{damageType}}
|
||||
{{evaluateDamage charId attack}} {{damageType}}
|
||||
</div>
|
||||
{{#if details}}
|
||||
{{#if attack.details}}
|
||||
<div class="paper-font-caption">
|
||||
{{details}}
|
||||
{{attack.details}}
|
||||
</div>
|
||||
{{/if}}
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
Template.attackView.helpers ({
|
||||
evaluateAttackBonus: function(charId, attack) {
|
||||
if (attack.parent.collection == "Spells") {
|
||||
var spell = Spells.findOne(attack.parent.id);
|
||||
if (spell) {
|
||||
bonus = evaluate(charId, attack.attackBonus, {"spellListId": spell.parent.id});
|
||||
}
|
||||
} else {
|
||||
var bonus = evaluate(charId, attack.attackBonus);
|
||||
}
|
||||
|
||||
if (_.isFinite(bonus)) {
|
||||
return bonus > 0 ? "+" + bonus : "" + bonus;
|
||||
} else {
|
||||
return bonus;
|
||||
}
|
||||
},
|
||||
evaluateDamage: function(charId, attack) {
|
||||
if (attack.parent.collection == "Spells") {
|
||||
var spell = Spells.findOne(attack.parent.id);
|
||||
if (spell) {
|
||||
return evaluateSpellString(charId, spell.parent.id, attack.damage);
|
||||
}
|
||||
} else {
|
||||
return evaluateString(charId, attack.damage);
|
||||
}
|
||||
},
|
||||
})
|
||||
@@ -3,8 +3,8 @@
|
||||
<hr style="margin: 16px 0 16px 0;">
|
||||
<div class="attacks">
|
||||
<div class="spaceAfter paper-font-title">Attacks</div>
|
||||
{{#each attacks}}
|
||||
{{> attackView}}
|
||||
{{#each attack in attacks}}
|
||||
{{> attackView attack=attack charId=charId}}
|
||||
{{/each}}
|
||||
</div>
|
||||
{{/if}}
|
||||
|
||||
@@ -14,6 +14,9 @@
|
||||
<paper-toggle-button id="variantEncumbrance" checked={{settings.useVariantEncumbrance}}>
|
||||
Use variant encumbrance
|
||||
</paper-toggle-button>
|
||||
<paper-toggle-button id="swapStatAndModifier" checked={{settings.swapStatAndModifier}}>
|
||||
Swap stats and modifiers on Stats page
|
||||
</paper-toggle-button>
|
||||
</div>
|
||||
</app-header-layout>
|
||||
<div class="buttons layout horizontal end-justified">
|
||||
|
||||
@@ -23,6 +23,15 @@ Template.characterSettings.events({
|
||||
);
|
||||
}
|
||||
},
|
||||
"change #swapStatAndModifier": function(event, instance){
|
||||
var value = instance.find("#swapStatAndModifier").checked;
|
||||
if (this.settings.swapStatAndModifier !== value){
|
||||
Characters.update(
|
||||
this._id,
|
||||
{$set: {"settings.swapStatAndModifier": value}}
|
||||
);
|
||||
}
|
||||
},
|
||||
"click .doneButton": function(event, instance){
|
||||
popDialogStack();
|
||||
},
|
||||
|
||||
@@ -24,6 +24,10 @@
|
||||
<iron-icon icon="settings" item-icon></iron-icon>
|
||||
Settings
|
||||
</paper-icon-item>
|
||||
<paper-icon-item id="characterExport">
|
||||
<iron-icon icon="content-copy" item-icon></iron-icon>
|
||||
Export to Improved Initiative
|
||||
</paper-icon-item>
|
||||
</paper-menu>
|
||||
</paper-menu-button>
|
||||
{{/if}}
|
||||
|
||||
@@ -203,4 +203,11 @@ Template.characterSheet.events({
|
||||
element: event.currentTarget.parentElement.parentElement,
|
||||
});
|
||||
},
|
||||
"click #characterExport": function(event, instance){
|
||||
pushDialogStack({
|
||||
data: this,
|
||||
template: "exportDialog",
|
||||
element: event.currentTarget.parentElement.parentElement,
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
@@ -13,3 +13,13 @@
|
||||
.effectEdit .deleteEffect {
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.effectEdit .effect-table-view {
|
||||
align-self: center;
|
||||
color: #757575;
|
||||
color: rgba(0,0,0,0.54);
|
||||
}
|
||||
|
||||
.effectEdit .iron-selected {
|
||||
color: #ad2a1f;
|
||||
}
|
||||
|
||||
@@ -1,45 +1,56 @@
|
||||
<template name="effectEdit">
|
||||
<div class="effectEdit layout horizontal center">
|
||||
<paper-dropdown-menu label="Stat" class="statDropDown" dynamic-align>
|
||||
<dicecloud-selector class="statMenu dropdown-content" selected={{stat}} selectable="paper-item">
|
||||
{{#each statGroups}}
|
||||
<div style="font-weight: bold; margin-top: 16px; padding-left: 8px;">
|
||||
{{this}}
|
||||
</div>
|
||||
{{#each stats}}
|
||||
<paper-item name={{stat}}>{{name}}</paper-item>
|
||||
{{/each}}
|
||||
{{/each}}
|
||||
</dicecloud-selector>
|
||||
</paper-dropdown-menu>
|
||||
{{#if operations}}
|
||||
<paper-dropdown-menu class="operationDropDown" label="Operation" dynamic-align>
|
||||
<dicecloud-selector class="dropdown-content operationMenu" selected={{operation}}>
|
||||
{{#each operations}}
|
||||
<paper-item name={{operation}}>{{name}}</paper-item>
|
||||
{{#with effect}}
|
||||
{{#baseEditDialog hideColor=true title="Effect"}}
|
||||
<div class="fit layout vertical effectEdit" style="padding: 24px;">
|
||||
<table class="paper-font-display1 effect-table-view">
|
||||
<tr>
|
||||
{{> effectView}}
|
||||
</tr>
|
||||
</table>
|
||||
<hr class="vertMargin" style="width: 100%;">
|
||||
{{#if showEffectValueInput}}
|
||||
<paper-input class="effectValueInput"
|
||||
label="Value"
|
||||
floatinglabel
|
||||
value={{effectValue}}>
|
||||
{{> formulaSuffix}}
|
||||
</paper-input>
|
||||
{{else}}
|
||||
<div style="height: 62px;"></div>
|
||||
{{/if}}
|
||||
<div class="effectEdit layout horizontal flex">
|
||||
<dicecloud-selector class="statMenu flex" selected={{stat}} selectable="paper-item" style="height: 100%; overflow-y: auto;">
|
||||
{{#each statGroups}}
|
||||
<div class="statGroupTitle clickable" style="font-weight: bold; margin-top: 16px; padding-left: 8px;">
|
||||
{{this}}
|
||||
</div>
|
||||
<iron-collapse opened={{isGroupSelected this ../stat}}>
|
||||
{{#each stats}}
|
||||
<paper-item name={{stat}} class="clickable">{{name}}</paper-item>
|
||||
{{/each}}
|
||||
</iron-collapse>
|
||||
{{/each}}
|
||||
</dicecloud-selector>
|
||||
</paper-dropdown-menu>
|
||||
{{/if}}
|
||||
{{#if effectValueTemplate}}
|
||||
{{> Template.dynamic template=effectValueTemplate}}
|
||||
{{else}}
|
||||
<div class="flex"></div>
|
||||
{{/if}}
|
||||
<paper-icon-button class="deleteEffect"
|
||||
icon="delete">
|
||||
</paper-icon-button>
|
||||
<br>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<template name="regularEffectValue">
|
||||
<paper-input class="effectValueInput flex"
|
||||
label="Value"
|
||||
floatinglabel
|
||||
value={{effectValue}}
|
||||
style="flex-basis: 100px;">
|
||||
</paper-input>
|
||||
{{#if operations}}
|
||||
<dicecloud-selector class="operationMenu flex" selected={{operation}} style="height: 100%; overflow-y: auto;">
|
||||
{{#each operations}}
|
||||
<paper-item name={{operation}} class="clickable">{{name}}</paper-item>
|
||||
{{/each}}
|
||||
</dicecloud-selector>
|
||||
{{else}} {{#if showMultiplierOperations}}
|
||||
<dicecloud-selector class="multiplierMenu flex"
|
||||
selected={{value}}>
|
||||
<paper-item name="0.5" class="clickable">Resistance</paper-item>
|
||||
<paper-item name="2" class="clickable">Vulnerability</paper-item>
|
||||
<paper-item name="0" class="clickable">Immunity</paper-item>
|
||||
</dicecloud-selector>
|
||||
{{else}}
|
||||
<div class="flex" style="height: 100%;"></div>
|
||||
{{/if}} {{/if}}
|
||||
</div>
|
||||
</div>
|
||||
{{/baseEditDialog}}
|
||||
{{/with}}
|
||||
</template>
|
||||
|
||||
<template name="multiplierEffectValue">
|
||||
@@ -51,5 +62,4 @@
|
||||
<paper-item name="0">Immunity</paper-item>
|
||||
</dicecloud-selector>
|
||||
</paper-dropdown-menu>
|
||||
<div class="flex"></div>
|
||||
</template>
|
||||
|
||||
@@ -53,10 +53,10 @@ var stats = [
|
||||
{stat: "level7SpellSlots", name: "level 7", group: "Spell Slots"},
|
||||
{stat: "level8SpellSlots", name: "level 8", group: "Spell Slots"},
|
||||
{stat: "level9SpellSlots", name: "level 9", group: "Spell Slots"},
|
||||
{stat: "d6HitDice", name: "d6", group: "Hit Dice"},
|
||||
{stat: "d8HitDice", name: "d8", group: "Hit Dice"},
|
||||
{stat: "d10HitDice", name: "d10", group: "Hit Dice"},
|
||||
{stat: "d12HitDice", name: "d12", group: "Hit Dice"},
|
||||
{stat: "d6HitDice", name: "d6 Hit Dice", group: "Hit Dice"},
|
||||
{stat: "d8HitDice", name: "d8 Hit Dice", group: "Hit Dice"},
|
||||
{stat: "d10HitDice", name: "d10 Hit Dice", group: "Hit Dice"},
|
||||
{stat: "d12HitDice", name: "d12 Hit Dice", group: "Hit Dice"},
|
||||
{stat: "acidMultiplier", name: "Acid", group: "Weakness/Resistance"},
|
||||
{stat: "bludgeoningMultiplier", name: "Bludgeoning", group: "Weakness/Resistance"},
|
||||
{stat: "coldMultiplier", name: "Cold", group: "Weakness/Resistance"},
|
||||
@@ -97,7 +97,19 @@ var skillOperations = [
|
||||
{name: "Conditional Benefit", operation: "conditional"},
|
||||
];
|
||||
|
||||
Template.effectEdit.onRendered(function(){
|
||||
_.defer(() => {
|
||||
const statElement = this.find(".statMenu .iron-selected");
|
||||
statElement && statElement.scrollIntoView();
|
||||
const opElement = this.find(".operationMenu .iron-selected");
|
||||
opElement && opElement.scrollIntoView();
|
||||
});
|
||||
});
|
||||
|
||||
Template.effectEdit.helpers({
|
||||
effect: function(){
|
||||
return Effects.findOne(this.id);
|
||||
},
|
||||
statGroups: function(){
|
||||
return statGroupNames;
|
||||
},
|
||||
@@ -115,46 +127,101 @@ Template.effectEdit.helpers({
|
||||
return attributeOperations;
|
||||
}
|
||||
},
|
||||
effectValueTemplate: function(){
|
||||
//resistance/vulnerability template
|
||||
showMultiplierOperations: function(){
|
||||
var stat = statsDict[this.stat];
|
||||
return stat && stat.group === "Weakness/Resistance"
|
||||
},
|
||||
showEffectValueInput: function(){
|
||||
var stat = statsDict[this.stat];
|
||||
var group = stat && stat.group;
|
||||
if (group === "Weakness/Resistance") return "multiplierEffectValue";
|
||||
|
||||
if (
|
||||
group === "Weakness/Resistance"
|
||||
) return false;
|
||||
var op = this.operation;
|
||||
if (!op) return null;
|
||||
//operations that don't need templates
|
||||
if (op === "advantage" || op === "disadvantage" || op === "fail") return null;
|
||||
|
||||
//default template
|
||||
return "regularEffectValue";
|
||||
if (
|
||||
!op ||
|
||||
op === "advantage" ||
|
||||
op === "disadvantage" ||
|
||||
op === "fail"
|
||||
) return false;
|
||||
return true;
|
||||
},
|
||||
});
|
||||
|
||||
Template.regularEffectValue.helpers({
|
||||
effectValue: function(){
|
||||
return this.calculation || this.value;
|
||||
}
|
||||
},
|
||||
isGroupSelected: function(groupName, statName){
|
||||
var stat = statsDict[statName]
|
||||
return stat && (stat.group === groupName);
|
||||
},
|
||||
});
|
||||
|
||||
var setStat = function(statName, effectId){
|
||||
var setter = {stat: statName};
|
||||
var effect = Effects.findOne(this._id);
|
||||
var group = statsDict[statName].group;
|
||||
if (group === "Saving Throws" || group === "Skills"){
|
||||
// Skills must have a valid skill operation
|
||||
if (!_.contains(
|
||||
_.map(skillOperations, ao => ao.operation),
|
||||
effect.operation
|
||||
)){
|
||||
setter.operation = "add";
|
||||
}
|
||||
} else if (group !== "Weakness/Resistance"){
|
||||
// Attributes must have a valid attribute operation
|
||||
if (!_.contains(
|
||||
_.map(attributeOperations, ao => ao.operation),
|
||||
effect.operation
|
||||
)){
|
||||
setter.operation = "base";
|
||||
}
|
||||
} else {
|
||||
// Weakness/Resistance must have a mul operation and value
|
||||
if (effect.operation !== "mul"){
|
||||
setter.operation = "mul";
|
||||
}
|
||||
if (!_.contains([0, 0.5, 2], effect.value)){
|
||||
setter.value = 0.5;
|
||||
}
|
||||
}
|
||||
Effects.update(effectId, {$set: setter});
|
||||
};
|
||||
|
||||
var scrollAnimationId;
|
||||
var scrollElementToView = element => {
|
||||
var scrollFunction = function(){
|
||||
element.scrollIntoView();
|
||||
scrollAnimationId = requestAnimationFrame(scrollFunction);
|
||||
};
|
||||
return scrollFunction;
|
||||
}
|
||||
|
||||
Template.effectEdit.events({
|
||||
"click .deleteEffect": function(event){
|
||||
Effects.softRemoveNode(this._id);
|
||||
GlobalUI.deletedToast(this._id, "Effects", "Effect");
|
||||
"click #deleteButton": function(event, instance){
|
||||
Effects.softRemoveNode(instance.data.id);
|
||||
GlobalUI.deletedToast(instance.data.id, "Effects", "Effect");
|
||||
popDialogStack();
|
||||
},
|
||||
"iron-select .statDropDown": function(event){
|
||||
"click .statGroupTitle": function(event, instance){
|
||||
var groupName = this.toString();
|
||||
var firstStat = statGroups[groupName][0].stat;
|
||||
setStat(firstStat, instance.data.id);
|
||||
scrollAnimationId = requestAnimationFrame(scrollElementToView(event.target));
|
||||
_.delay(() => cancelAnimationFrame(scrollAnimationId), 300);
|
||||
},
|
||||
"iron-select .statMenu": function(event){
|
||||
var detail = event.originalEvent.detail;
|
||||
var statName = detail.item.getAttribute("name");
|
||||
if (statName == this.stat) return;
|
||||
Effects.update(this._id, {$set: {stat: statName}});
|
||||
setStat(statName, this._id);
|
||||
},
|
||||
"iron-select .operationDropDown": function(event){
|
||||
"iron-select .operationMenu": function(event){
|
||||
var detail = event.originalEvent.detail;
|
||||
var opName = detail.item.getAttribute("name");
|
||||
if (opName == this.operation) return;
|
||||
Effects.update(this._id, {$set: {operation: opName}});
|
||||
},
|
||||
"iron-select .damageMultiplierDropDown": function(event){
|
||||
"iron-select .multiplierMenu": function(event){
|
||||
var detail = event.originalEvent.detail;
|
||||
var value = +detail.item.getAttribute("name");
|
||||
if (value == this.value) return;
|
||||
@@ -164,15 +231,25 @@ Template.effectEdit.events({
|
||||
operation: "mul",
|
||||
}});
|
||||
},
|
||||
"change .effectValueInput": function(event){
|
||||
"change .effectValueInput, input .effectValueInput":
|
||||
_.debounce(function(event){
|
||||
var value = event.currentTarget.value;
|
||||
var numValue = +value;
|
||||
var numValue = value === "" ? NaN : +value;
|
||||
if (_.isFinite(numValue)){
|
||||
if (this.value === numValue) return;
|
||||
Effects.update(this._id, {$set: {value: numValue, calculation: ""}});
|
||||
Effects.update(this._id, {
|
||||
$set: {value: numValue},
|
||||
$unset: {calculation: ""},
|
||||
});
|
||||
} else if (_.isString(value)){
|
||||
if (this.calculation === value) return;
|
||||
Effects.update(this._id, {$set: {value: "", calculation: value}});
|
||||
Effects.update(this._id, {
|
||||
$set: {calculation: value},
|
||||
$unset: {value: ""},
|
||||
}, {
|
||||
removeEmptyStrings: false,
|
||||
trimStrings: false,
|
||||
});
|
||||
}
|
||||
},
|
||||
}, 400),
|
||||
});
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
<template name="effectView">
|
||||
<tr>
|
||||
<td>{{statName}}</td>
|
||||
<td>{{operationName}}{{statValue}}</td>
|
||||
</tr>
|
||||
<td>{{statName}}</td>
|
||||
<td>{{operationName}}{{statValue}}</td>
|
||||
</template>
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
//TODO add dexterity armor
|
||||
var stats = {
|
||||
"strength":{"name":"Strength"},
|
||||
"dexterity":{"name":"Dexterity"},
|
||||
@@ -131,8 +130,10 @@ Template.effectView.helpers({
|
||||
return stats[this.stat] && stats[this.stat].name || "No Stat";
|
||||
},
|
||||
operationName: function(){
|
||||
if (this.operation === "proficiency" ||
|
||||
this.operation === "conditional") return null;
|
||||
if (
|
||||
this.operation === "proficiency" ||
|
||||
this.operation === "conditional"
|
||||
) return null;
|
||||
if (stats[this.stat] && stats[this.stat].group === "Weakness/Resistance")
|
||||
return null;
|
||||
if (this.operation === "add" && evaluateEffect(this.charId, this) < 0)
|
||||
@@ -141,9 +142,11 @@ Template.effectView.helpers({
|
||||
operations[this.operation].name || "No Operation";
|
||||
},
|
||||
statValue: function(){
|
||||
if (this.operation === "advantage" ||
|
||||
this.operation === "disadvantage" ||
|
||||
this.operation === "fail"){
|
||||
if (
|
||||
this.operation === "advantage" ||
|
||||
this.operation === "disadvantage" ||
|
||||
this.operation === "fail"
|
||||
){
|
||||
return null;
|
||||
}
|
||||
if (this.operation === "proficiency"){
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
.effectsEditList .effect {
|
||||
background: white;
|
||||
}
|
||||
@@ -1,11 +1,19 @@
|
||||
<!--needs to be given charId, parentId and parentCollection-->
|
||||
<template name="effectsEditList">
|
||||
{{#if effects.count}}
|
||||
<div id="effects">
|
||||
{{#if effects.length}}
|
||||
<div class="effectsEditList">
|
||||
<div class="paper-font-title">Effects</div>
|
||||
{{#each effects}}
|
||||
{{>effectEdit}}
|
||||
{{/each}}
|
||||
<table class="wideTable" style="width: 100%;">
|
||||
{{#each effects}}
|
||||
<tr class="effect" data-id={{_id}}>
|
||||
{{>effectView}}
|
||||
<td>
|
||||
<paper-icon-button class="edit-effect" icon="create">
|
||||
</paper-icon-button>
|
||||
</td>
|
||||
</tr>
|
||||
{{/each}}
|
||||
</table>
|
||||
</div>
|
||||
{{/if}}
|
||||
<paper-button id="addEffectButton" class="red-button" raised>Add Effect</paper-button>
|
||||
|
||||
@@ -8,17 +8,17 @@ Template.effectsEditList.helpers({
|
||||
if (this.parentGroup){
|
||||
selector["parent.group"] = this.parentGroup;
|
||||
}
|
||||
var cursor = Effects.find(selector);
|
||||
return cursor;
|
||||
var effects = Effects.find(selector).fetch();
|
||||
return _.sortBy(effects, effect => statOrder[effect.stat] || 999);
|
||||
}
|
||||
});
|
||||
|
||||
Template.effectsEditList.events({
|
||||
"tap #addEffectButton": function(){
|
||||
"tap #addEffectButton": function(event, instance){
|
||||
if (!_.isBoolean(this.enabled)) {
|
||||
this.enabled = true;
|
||||
}
|
||||
Effects.insert({
|
||||
const effectId = Effects.insert({
|
||||
name: this.name,
|
||||
charId: this.charId,
|
||||
parent: {
|
||||
@@ -29,5 +29,18 @@ Template.effectsEditList.events({
|
||||
operation: "add",
|
||||
enabled: this.enabled,
|
||||
});
|
||||
pushDialogStack({
|
||||
template: "effectEdit",
|
||||
data: {id: effectId},
|
||||
element: event.currentTarget,
|
||||
returnElement: () => instance.find(`tr.effect[data-id='${effectId}']`),
|
||||
});
|
||||
},
|
||||
"tap .edit-effect": function(event, template){
|
||||
pushDialogStack({
|
||||
template: "effectEdit",
|
||||
data: {id: this._id},
|
||||
element: event.currentTarget.parentElement.parentElement,
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
<!--needs to be given charId, (parentId or stat) and type-->
|
||||
<template name="effectsViewList">
|
||||
{{#if effects.count}}
|
||||
{{#if effects.length}}
|
||||
<div class="effects">
|
||||
<div class="spaceAfter paper-font-title">Effects</div>
|
||||
<table class="wideTable">
|
||||
{{#each effects}}
|
||||
{{>effectView}}
|
||||
<tr>{{>effectView}}</tr>
|
||||
{{/each}}
|
||||
</table>
|
||||
</div>
|
||||
|
||||
@@ -2,11 +2,14 @@ Template.effectsViewList.helpers({
|
||||
effects: function(){
|
||||
var selector = {
|
||||
"parent.id": this.parentId,
|
||||
"charId": this.charId
|
||||
"charId": this.charId,
|
||||
};
|
||||
if (this.parentGroup){
|
||||
selector["parent.group"] = this.parentGroup;
|
||||
}
|
||||
return Effects.find(selector, {fields: {parent: 0}});
|
||||
let effects = Effects.find(selector, {
|
||||
fields: {parent: 0},
|
||||
}).fetch();
|
||||
return _.sortBy(effects, effect => statOrder[effect.stat] || 999);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
.exportDialog .iiexport {
|
||||
overflow-y: auto;
|
||||
width: 100% !important;
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
<template name="exportDialog">
|
||||
<div class="exportDialog fit layout vertical">
|
||||
{{#with character}}
|
||||
<app-header fixed effects="waterfall">
|
||||
<app-toolbar>
|
||||
<div main-title>Export Character to Improved Initiative</div>
|
||||
</app-toolbar>
|
||||
</app-header>
|
||||
<div class="form flex layout vertical">
|
||||
<paper-toggle-button id="exportFeatures" checked={{settings.exportFeatures}}>
|
||||
Features
|
||||
</paper-toggle-button>
|
||||
<paper-toggle-button id="exportAttacks" checked={{settings.exportAttacks}}>
|
||||
Attacks
|
||||
</paper-toggle-button>
|
||||
<paper-toggle-button id="exportDescription" checked={{settings.exportDescription}}>
|
||||
Description
|
||||
</paper-toggle-button>
|
||||
<div class="paper-font-title padded">JSON</div>
|
||||
<textarea class="flex iiexport">{{improvedInitiativeJson}}</textarea>
|
||||
<paper-button id="copyExportButton" class="red-button" raised>
|
||||
<iron-icon icon="content-copy"></iron-icon>
|
||||
Copy to Clipboard
|
||||
</paper-button>
|
||||
</div>
|
||||
<div class="buttons layout horizontal end-justified">
|
||||
<paper-button class="doneButton"> Done </paper-button>
|
||||
</div>
|
||||
{{/with}}
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,60 @@
|
||||
Template.exportDialog.helpers({
|
||||
character: function(){
|
||||
return Characters.findOne(this._id);
|
||||
},
|
||||
improvedInitiativeJson: function(){
|
||||
var options = {
|
||||
features: this.settings.exportFeatures,
|
||||
attacks: this.settings.exportAttacks,
|
||||
description: this.settings.exportDescription,
|
||||
}
|
||||
return improvedInitiativeJson(this._id, options);
|
||||
},
|
||||
});
|
||||
|
||||
Template.exportDialog.events({
|
||||
"change #exportFeatures": function(event, template){
|
||||
Characters.update(this._id, {$set: {
|
||||
"settings.exportFeatures": event.target.checked,
|
||||
}});
|
||||
},
|
||||
"change #exportAttacks": function(event, template){
|
||||
Characters.update(this._id, {$set: {
|
||||
"settings.exportAttacks": event.target.checked,
|
||||
}});
|
||||
},
|
||||
"change #exportDescription": function(event, template){
|
||||
Characters.update(this._id, {$set: {
|
||||
"settings.exportDescription": event.target.checked,
|
||||
}});
|
||||
},
|
||||
"click #copyExportButton": function(event, template){
|
||||
var copyTextarea = template.find(".iiexport");
|
||||
copyTextarea.select();
|
||||
var msg;
|
||||
try {
|
||||
var successful = document.execCommand("copy");
|
||||
var msg = successful ? "JSON copied to clipboard" : "Unable to copy JSON";
|
||||
} catch (err) {
|
||||
msg = "Unable to copy JSON";
|
||||
} finally {
|
||||
clearSelection();
|
||||
GlobalUI.toast(msg);
|
||||
}
|
||||
},
|
||||
"click .doneButton": function(event, instance){
|
||||
popDialogStack();
|
||||
},
|
||||
});
|
||||
|
||||
var clearSelection = function(){
|
||||
if (window.getSelection) {
|
||||
if (window.getSelection().empty) { // Chrome
|
||||
window.getSelection().empty();
|
||||
} else if (window.getSelection().removeAllRanges) { // Firefox
|
||||
window.getSelection().removeAllRanges();
|
||||
}
|
||||
} else if (document.selection) { // IE?
|
||||
document.selection.empty();
|
||||
}
|
||||
};
|
||||
@@ -68,8 +68,11 @@
|
||||
{{/if}}
|
||||
</div>
|
||||
|
||||
<!--description-->
|
||||
<paper-textarea label="Description" id="featureDescriptionInput" value={{description}}></paper-textarea>
|
||||
<!--Description-->
|
||||
<div class="description-input layout horizontal end">
|
||||
<paper-textarea id="featureDescriptionInput" label="Description" value={{description}}></paper-textarea>
|
||||
{{> textareaBracketSuffix}}
|
||||
</div>
|
||||
|
||||
{{> effectsEditList parentId=_id parentCollection="Features" charId=charId name=name enabled=enabled}}
|
||||
{{> proficiencyEditList parentId=_id parentCollection="Features" charId=charId enabled=enabled}}
|
||||
|
||||
@@ -19,30 +19,8 @@
|
||||
Attacks
|
||||
</div>
|
||||
<div class="bottom list">
|
||||
{{#each attacks}}
|
||||
<div class="item-slot">
|
||||
<div class="flexible attack item">
|
||||
<div class="layout horizontal">
|
||||
<div class="paper-font-headline layout horizontal center"
|
||||
style="margin-right: 16px;">
|
||||
{{evaluateSigned ../_id attackBonus}}
|
||||
</div>
|
||||
<div class="flex layout vertical">
|
||||
<div class="paper-font-body2">
|
||||
{{name}}
|
||||
</div>
|
||||
<div>
|
||||
{{evaluateString ../_id damage}} {{damageType}}
|
||||
</div>
|
||||
{{#if details}}
|
||||
<div>
|
||||
{{details}}
|
||||
</div>
|
||||
{{/if}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{#each attack in attacks}}
|
||||
{{>attackListItem attack=attack charId=_id}}
|
||||
{{/each}}
|
||||
</div>
|
||||
</paper-material>
|
||||
@@ -55,19 +33,19 @@
|
||||
Proficiencies
|
||||
</div>
|
||||
<div flex class="bottom list">
|
||||
{{#if weaponProfs.count}}
|
||||
{{#if weaponProfs.length}}
|
||||
<div class="paper-font-subhead">Weapons</div>
|
||||
{{/if}}
|
||||
{{#each weaponProfs}}
|
||||
{{> proficiencyListItem}}
|
||||
{{/each}}
|
||||
{{#if armorProfs.count}}
|
||||
{{#if armorProfs.length}}
|
||||
<div class="paper-font-subhead">Armor</div>
|
||||
{{/if}}
|
||||
{{#each armorProfs}}
|
||||
{{> proficiencyListItem}}
|
||||
{{/each}}
|
||||
{{#if toolProfs.count}}
|
||||
{{#if toolProfs.length}}
|
||||
<div class="paper-font-subhead">Tools</div>
|
||||
{{/if}}
|
||||
{{#each toolProfs}}
|
||||
@@ -156,3 +134,29 @@
|
||||
</div>
|
||||
{{/if}}
|
||||
</template>
|
||||
|
||||
<template name="attackListItem">
|
||||
<div class="item-slot">
|
||||
<div class="flexible attack item">
|
||||
<div class="layout horizontal">
|
||||
<div class="paper-font-headline layout horizontal center"
|
||||
style="margin-right: 16px;">
|
||||
{{evaluateAttackBonus charId attack}}
|
||||
</div>
|
||||
<div class="flex layout vertical">
|
||||
<div class="paper-font-body2">
|
||||
{{attack.name}}
|
||||
</div>
|
||||
<div>
|
||||
{{evaluateDamage charId attack}} {{attack.damageType}}
|
||||
</div>
|
||||
{{#if attack.details}}
|
||||
<div>
|
||||
{{attack.details}}
|
||||
</div>
|
||||
{{/if}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -1,3 +1,21 @@
|
||||
var removeDuplicateProficiencies = function(proficiencies) {
|
||||
dict = {};
|
||||
proficiencies.forEach(function(prof) {
|
||||
if (prof.name in dict) { //if we have already gone over another proficiency for the same thing
|
||||
if (dict[prof.name].value < prof.value) {
|
||||
dict[prof.name] = prof; //then take the new one if it's higher, otherwise leave it
|
||||
}
|
||||
} else {
|
||||
dict[prof.name] = prof; //if it wasn't already there, store it
|
||||
}
|
||||
});
|
||||
profs = []
|
||||
_.forEach(dict, function(prof) {
|
||||
profs.push(prof);
|
||||
})
|
||||
return profs;
|
||||
};
|
||||
|
||||
Template.features.helpers({
|
||||
features: function(){
|
||||
var features = Features.find({charId: this._id}, {sort: {color: 1, name: 1}});
|
||||
@@ -27,13 +45,16 @@ Template.features.helpers({
|
||||
return !this.alwaysEnabled;
|
||||
},
|
||||
weaponProfs: function(){
|
||||
return Proficiencies.find({charId: this._id, type: "weapon"});
|
||||
var profs = Proficiencies.find({charId: this._id, type: "weapon"});
|
||||
return removeDuplicateProficiencies(profs);
|
||||
},
|
||||
armorProfs: function(){
|
||||
return Proficiencies.find({charId: this._id, type: "armor"});
|
||||
var profs = Proficiencies.find({charId: this._id, type: "armor"});
|
||||
return removeDuplicateProficiencies(profs);
|
||||
},
|
||||
toolProfs: function(){
|
||||
return Proficiencies.find({charId: this._id, type: "tool"});
|
||||
var profs = Proficiencies.find({charId: this._id, type: "tool"});
|
||||
return removeDuplicateProficiencies(profs);
|
||||
},
|
||||
});
|
||||
|
||||
@@ -61,13 +82,6 @@ Template.features.events({
|
||||
element: event.currentTarget.parentElement,
|
||||
});
|
||||
},
|
||||
"click .attack": function(event){
|
||||
openParentDialog({
|
||||
parent: this.parent,
|
||||
charId: this.charId,
|
||||
element: event.currentTarget,
|
||||
});
|
||||
},
|
||||
"click .useFeature": function(event){
|
||||
var featureId = this._id;
|
||||
Features.update(featureId, {$inc: {used: 1}});
|
||||
@@ -133,3 +147,42 @@ Template.resource.events({
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
Template.attackListItem.helpers({
|
||||
evaluateAttackBonus: function(charId, attack) {
|
||||
if (attack.parent.collection == "Spells") {
|
||||
var spell = Spells.findOne(attack.parent.id);
|
||||
if (spell) {
|
||||
bonus = evaluate(charId, attack.attackBonus, {"spellListId": spell.parent.id});
|
||||
}
|
||||
} else {
|
||||
var bonus = evaluate(charId, attack.attackBonus);
|
||||
}
|
||||
|
||||
if (_.isFinite(bonus)) {
|
||||
return bonus > 0 ? "+" + bonus : "" + bonus;
|
||||
} else {
|
||||
return bonus;
|
||||
}
|
||||
},
|
||||
evaluateDamage: function(charId, attack) {
|
||||
if (attack.parent.collection == "Spells") {
|
||||
var spell = Spells.findOne(attack.parent.id);
|
||||
if (spell) {
|
||||
return evaluateSpellString(charId, spell.parent.id, attack.damage);
|
||||
}
|
||||
} else {
|
||||
return evaluateString(charId, attack.damage);
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
Template.attackListItem.events({
|
||||
"click .attack": function(event, instance){
|
||||
openParentDialog({
|
||||
parent: instance.data.attack.parent,
|
||||
charId: instance.data.charId,
|
||||
element: event.currentTarget,
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
@@ -20,9 +20,11 @@
|
||||
</div>
|
||||
|
||||
<hr class="vertMargin">
|
||||
|
||||
<paper-textarea label="Description" id="containerDescriptionInput" value={{description}}>
|
||||
</paper-textarea>
|
||||
<div class="description-input layout horizontal end">
|
||||
<paper-textarea label="Description" id="containerDescriptionInput" value={{description}}>
|
||||
</paper-textarea>
|
||||
{{> textareaBracketSuffix}}
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<template name="containerView">
|
||||
|
||||
@@ -61,12 +61,10 @@
|
||||
</div>
|
||||
|
||||
<!--Description-->
|
||||
<paper-textarea id="itemDescriptionInput" label="Description" value={{description}}>
|
||||
<div suffix>
|
||||
<paper-tooltip position="left" animation-delay="0">This field accepts formulae in {curly brackets}</paper-tooltip>
|
||||
<iron-icon icon="dicecloud:code-braces"></iron-icon>
|
||||
</div>
|
||||
</paper-textarea>
|
||||
<div class="description-input layout horizontal end">
|
||||
<paper-textarea id="itemDescriptionInput" label="Description" value={{description}}></paper-textarea>
|
||||
{{> textareaBracketSuffix}}
|
||||
</div>
|
||||
<!--Effects-->
|
||||
{{> effectsEditList parentId=_id parentCollection="Items" charId=charId enabled=equipped name=name}}
|
||||
<!--Attacks-->
|
||||
|
||||
@@ -29,7 +29,6 @@ Template.newCharacterDialog.helpers({
|
||||
|
||||
changeFunction = function(field){
|
||||
return _.debounce(function(event, instance){
|
||||
console.log({field, event})
|
||||
instance.character[field] = event.currentTarget.value;
|
||||
instance.schema.clean(instance.character);
|
||||
instance.context.validate(instance.character);
|
||||
|
||||
@@ -7,6 +7,24 @@ var colorMap = {
|
||||
backstory: "j",
|
||||
};
|
||||
|
||||
var removeDuplicateProficiencies = function(proficiencies) {
|
||||
dict = {};
|
||||
proficiencies.forEach(function(prof) {
|
||||
if (prof.name in dict) { //if we have already gone over another proficiency for the same thing
|
||||
if (dict[prof.name].value < prof.value) {
|
||||
dict[prof.name] = prof; //then take the new one if it's higher, otherwise leave it
|
||||
}
|
||||
} else {
|
||||
dict[prof.name] = prof; //if it wasn't already there, store it
|
||||
}
|
||||
});
|
||||
profs = []
|
||||
_.forEach(dict, function(prof) {
|
||||
profs.push(prof);
|
||||
})
|
||||
return profs;
|
||||
};
|
||||
|
||||
Template.persona.helpers({
|
||||
characterDetails: function(){
|
||||
var char = Characters.findOne(
|
||||
@@ -33,7 +51,8 @@ Template.persona.helpers({
|
||||
};
|
||||
},
|
||||
languages: function(){
|
||||
return Proficiencies.find({charId: this._id, type: "language"});
|
||||
var profs = Proficiencies.find({charId: this._id, type: "language"});
|
||||
return removeDuplicateProficiencies(profs);
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
@@ -15,6 +15,22 @@ Template.proficiencyListItem.helpers({
|
||||
|
||||
Template.proficiencyListItem.events({
|
||||
"click .proficiency": function(event, instance){
|
||||
if (this.parent.collection == "Characters") {
|
||||
if (this.parent.group == "background") {
|
||||
pushDialogStack({
|
||||
template: "backgroundDialog",
|
||||
data: {
|
||||
"charId": this.charId,
|
||||
"field":"background",
|
||||
"title":"Background",
|
||||
"color":"j",
|
||||
},
|
||||
element: event.currentTarget,
|
||||
})
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
openParentDialog({
|
||||
parent: this.parent,
|
||||
charId: this.charId,
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
</div>
|
||||
{{/if}}
|
||||
</div>
|
||||
<div>{{#markdown}}{{evaluateString charId description}}{{/markdown}}</div>
|
||||
<div>{{#markdown}}{{evaluateSpellString charId parent.id description}}{{/markdown}}</div>
|
||||
{{> attacksViewList charId=charId parentId=_id}}
|
||||
</template>
|
||||
|
||||
@@ -111,8 +111,10 @@
|
||||
</paper-checkbox>
|
||||
</div>
|
||||
|
||||
<!--Description-->
|
||||
<paper-textarea id="descriptionInput" label="Description" value="{{description}}">
|
||||
</paper-textarea>
|
||||
{{> attackEditList parentId=_id parentCollection="Spells" charId=charId enabled=true name=name}}
|
||||
<div class="description-input layout horizontal end">
|
||||
<paper-textarea id="descriptionInput" label="Description" style="width: calc(100% - 24px)" value={{description}}></paper-textarea>
|
||||
{{> textareaBracketSuffix}}
|
||||
</div>
|
||||
|
||||
{{> attackEditList parentId=_id parentCollection="Spells" charId=charId enabled=true name=name isSpell=true}}
|
||||
</template>
|
||||
|
||||
@@ -40,8 +40,11 @@
|
||||
{{> formulaSuffix}}
|
||||
</paper-input>
|
||||
<!--Description-->
|
||||
<paper-textarea id="spellListDescriptionInput" label="Description" value={{description}}>
|
||||
</paper-textarea>
|
||||
<div class="description-input layout horizontal end">
|
||||
<paper-textarea id="spellListDescriptionInput" label="Description" value={{description}}>
|
||||
</paper-textarea>
|
||||
{{> textareaBracketSuffix}}
|
||||
</div>
|
||||
</div>
|
||||
{{/baseDialog}}
|
||||
{{/with}}
|
||||
|
||||
@@ -78,6 +78,20 @@
|
||||
margin-left: 16px;
|
||||
}
|
||||
|
||||
.spell.item > div > div {
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.spell.item > div {
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.spell.item iron-icon {
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.spellLevel {
|
||||
-webkit-backface-visibility: hidden;
|
||||
-webkit-transform: translateX(0);
|
||||
|
||||
@@ -131,6 +131,15 @@
|
||||
</paper-fab>
|
||||
|
||||
</div>
|
||||
<div>
|
||||
<paper-tooltip position="left">
|
||||
Spell library
|
||||
</paper-tooltip>
|
||||
<paper-fab icon="av:library-books"
|
||||
class="librarySpell"
|
||||
mini>
|
||||
</paper-fab>
|
||||
</div>
|
||||
<div>
|
||||
<paper-tooltip position="left">
|
||||
New spell
|
||||
|
||||
@@ -11,6 +11,12 @@ var spellLevels = [
|
||||
{name: "Level 9", level: 9},
|
||||
];
|
||||
|
||||
var materialNeedsGp = function(string) {
|
||||
if (!string) return false;
|
||||
gpRegExp = /\b[0-9]+ ?(cp|sp|gp)\b/i;
|
||||
return gpRegExp.test(string);
|
||||
}
|
||||
|
||||
const showUnprepared = (listId) => {
|
||||
return Session.get(`showUnprepared.${listId}`);
|
||||
}
|
||||
@@ -70,6 +76,7 @@ Template.spells.helpers({
|
||||
}
|
||||
if (this.components.material){
|
||||
components += components ? ", M" : "M";
|
||||
if (materialNeedsGp(this.components.material)) {components += "gp";}
|
||||
}
|
||||
if (this.components.concentration){
|
||||
components += components ? ", C" : "C";
|
||||
@@ -211,8 +218,17 @@ Template.spells.events({
|
||||
});
|
||||
},
|
||||
"click .addSpell": function(event, instance){
|
||||
var charId = this.charId;
|
||||
var listId = SpellLists.findOne({charId: this._id})._id;
|
||||
var charId = this._id;
|
||||
var list = SpellLists.findOne({charId});
|
||||
var listId = list && list._id
|
||||
if (!listId){
|
||||
listId = SpellLists.insert({
|
||||
name: "New SpellList",
|
||||
charId: charId,
|
||||
saveDC: "8 + intelligenceMod + proficiencyBonus",
|
||||
attackBonus: "intelligenceMod + proficiencyBonus",
|
||||
});
|
||||
}
|
||||
var id = Spells.insert({
|
||||
name: "New Spell",
|
||||
charId: this._id,
|
||||
@@ -229,6 +245,75 @@ Template.spells.events({
|
||||
returnElement: () => instance.find(`.spell[data-id='${id}']`),
|
||||
});
|
||||
},
|
||||
"click .librarySpell": function(event, instance){
|
||||
var charId = this._id;
|
||||
var spellId = Random.id();
|
||||
var list = SpellLists.findOne({charId});
|
||||
var listId = list && list._id
|
||||
pushDialogStack({
|
||||
template: "spellLibraryDialog",
|
||||
element: event.currentTarget,
|
||||
callback: (result) => {
|
||||
if (!result) return;
|
||||
if (!listId){
|
||||
listId = SpellLists.insert({
|
||||
name: "New SpellList",
|
||||
charId: charId,
|
||||
saveDC: "8 + intelligenceMod + proficiencyBonus",
|
||||
attackBonus: "intelligenceMod + proficiencyBonus",
|
||||
});
|
||||
}
|
||||
// Make the library spell into a regular spell
|
||||
let spell = _.omit(result, "library", "attacks", "effects");
|
||||
spell._id = spellId;
|
||||
spell.charId = charId;
|
||||
spell.parent = {
|
||||
id: listId,
|
||||
collection: "SpellLists",
|
||||
};
|
||||
spell.prepared = "prepared";
|
||||
Spells.insert(spell);
|
||||
// Copy over attacks and effects
|
||||
_.each(result.attacks, (attack) => {
|
||||
if (!("attackBonus" in attack)) {attack.attackBonus = "attackBonus"} //if no attack bonus provided, use spell list's
|
||||
attack.charId = charId;
|
||||
attack.parent = {id: spellId, collection: "Spells"};
|
||||
Attacks.insert(attack);
|
||||
});
|
||||
_.each(result.effects, (effect) => {
|
||||
effect.charId = charId;
|
||||
effect.parent = {id: spellId, collection: "Spells"};
|
||||
Effects.insert(effect);
|
||||
});
|
||||
|
||||
/******[UNCOMMENT ONCE BUFFS ARE ADDED]*******
|
||||
_.each(result.buffs, (buff) => {
|
||||
buff.charId = charId;
|
||||
buff.parent = {id: spellId, collection: "Spells"};
|
||||
buffId = Buffs.insert(buff);
|
||||
|
||||
_.each(buff.attacks, (attack) => {
|
||||
if (!(attackBonus in attack)) {attack.attackBonus = "attackBonus"} //if no attack bonus provided, use spell list's
|
||||
attack.charId = charId;
|
||||
attack.parent = {id: buffId, collection: "Buffs"};
|
||||
Attacks.insert(attack);
|
||||
});
|
||||
_.each(buff.effects, (effect) => {
|
||||
effect.charId = charId;
|
||||
effect.parent = {id: buffId, collection: "Buffs"};
|
||||
Effects.insert(effect);
|
||||
});
|
||||
_.each(buff.proficiencies, (prof) => {
|
||||
prof.charId = charId;
|
||||
prof.parent = {id: buffId, collection: "Buffs"};
|
||||
Proficiencies.insert(prof);
|
||||
});
|
||||
});
|
||||
*******[UNCOMMENT ONCE BUFFS ARE ADDED]******/
|
||||
},
|
||||
returnElement: () => $(`[data-id='${spellId}']`).get(0),
|
||||
})
|
||||
},
|
||||
"click .preparedCheckbox": function(event){
|
||||
event.stopPropagation();
|
||||
},
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
.spell-library-dialog .spell.selected {
|
||||
background-color: #e4e4e4;
|
||||
}
|
||||
|
||||
.spell-library-dialog .category-header {
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.spell-library-dialog .category-header iron-icon {
|
||||
transition: transform 0.3s ease;
|
||||
}
|
||||
|
||||
.spell-library-dialog .category-header iron-icon.open {
|
||||
transform: rotate(90deg);
|
||||
}
|
||||
|
||||
.spell-library-dialog table {
|
||||
border-collapse: collapse;
|
||||
}
|
||||
|
||||
.spell-library-dialog .library-spell td {
|
||||
position: relative;
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
<template name="spellLibraryDialog">
|
||||
<div class="fit spell-library-dialog layout vertical">
|
||||
<app-toolbar class="app-grey white-text">
|
||||
<paper-icon-button id="backButton"
|
||||
icon="arrow-back">
|
||||
</paper-icon-button>
|
||||
<div main-title>Spells</div>
|
||||
<paper-input label="Search" class="search-input">
|
||||
<iron-icon icon="search" prefix></iron-icon>
|
||||
</paper-input>
|
||||
</app-toolbar>
|
||||
<div class="flex scroll-y">
|
||||
<div class="spells" style="padding:8px">
|
||||
{{#if searchTerm}}
|
||||
{{#if searchSpells.count}}
|
||||
<table style="width: 100%">
|
||||
<tbody>
|
||||
{{#each spell in searchSpells}}
|
||||
{{>librarySpell spell=spell selected=(isSelected spell)}}
|
||||
{{/each}}
|
||||
</tbody>
|
||||
</table>
|
||||
{{else}}{{#if searchReady}}
|
||||
No spells match "{{searchTerm}}"
|
||||
{{/if}}{{/if}}
|
||||
{{#unless searchReady}}
|
||||
<div class="layout vertical center" style="width: 100%; padding: 16px;">
|
||||
<paper-spinner active></paper-spinner>
|
||||
</div>
|
||||
{{/unless}}
|
||||
{{else}}
|
||||
{{#each categories}}
|
||||
<div class="paper-font-body2 category-header clickable">
|
||||
<iron-icon icon="chevron-right" class="{{#if isOpen key}}open{{/if}}">
|
||||
</iron-icon>
|
||||
{{name}}
|
||||
</div>
|
||||
<iron-collapse opened={{isOpen key}}>
|
||||
<table style="width: 100%">
|
||||
<tbody>
|
||||
{{#each spell in (spellsInCategory key)}}
|
||||
{{>librarySpell spell=spell selected=(isSelected spell)}}
|
||||
{{/each}}
|
||||
</tbody>
|
||||
</table>
|
||||
{{#unless ready key}}
|
||||
<paper-spinner active></paper-spinner>
|
||||
{{/unless}}
|
||||
</iron-collapse>
|
||||
{{/each}}
|
||||
{{/if}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="layout horizontal end-justified">
|
||||
<paper-button class="cancelButton">Cancel</paper-button>
|
||||
<paper-button class="okButton">OK</paper-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<template name="librarySpell">
|
||||
<tr class="spell library-spell {{#if selected}}selected{{/if}}">
|
||||
<td class="spellName">
|
||||
{{spell.name}}
|
||||
<paper-ripple></paper-ripple>
|
||||
</td>
|
||||
</tr>
|
||||
</template>
|
||||
@@ -0,0 +1,115 @@
|
||||
const librarySubs = new SubsManager();
|
||||
|
||||
const categories = [
|
||||
{name: "Cantrips", key: 0},
|
||||
{name: "Level 1", key: 1},
|
||||
{name: "Level 2", key: 2},
|
||||
{name: "Level 3", key: 3},
|
||||
{name: "Level 4", key: 4},
|
||||
{name: "Level 5", key: 5},
|
||||
{name: "Level 6", key: 6},
|
||||
{name: "Level 7", key: 7},
|
||||
{name: "Level 8", key: 8},
|
||||
{name: "Level 9", key: 9},
|
||||
];
|
||||
|
||||
Template.spellLibraryDialog.onCreated(function(){
|
||||
this.selectedSpell = new ReactiveVar();
|
||||
this.searchTerm = new ReactiveVar();
|
||||
this.categoriesOpen = new ReactiveVar([]);
|
||||
this.readyDict = new ReactiveDict();
|
||||
this.searchReady = new ReactiveVar();
|
||||
librarySubs.subscribe("standardLibraries");
|
||||
this.autorun(() => {
|
||||
// Subscribe to all open categories
|
||||
_.each(this.categoriesOpen.get(), (key) => {
|
||||
var handle = librarySubs.subscribe("standardLibrarySpells", key);
|
||||
this.autorun(() => {
|
||||
this.readyDict.set(key, handle.ready());
|
||||
});
|
||||
});
|
||||
});
|
||||
this.autorun(() => {
|
||||
// If we are searching, subscibe to all categories
|
||||
if (this.searchTerm.get()){
|
||||
let handles = _.map(categories, category =>
|
||||
librarySubs.subscribe("standardLibrarySpells", category.key)
|
||||
);
|
||||
// Ready when all handles are ready
|
||||
this.autorun(() => {
|
||||
this.searchReady.set(_.every(handles, h => h.ready()));
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
Template.spellLibraryDialog.helpers({
|
||||
ready(key){
|
||||
return Template.instance().readyDict.get(key);
|
||||
},
|
||||
categories(){
|
||||
return categories;
|
||||
},
|
||||
spellsInCategory(categoryKey){
|
||||
return LibrarySpells.find({
|
||||
library: "SRDLibraryGA3XWsd",
|
||||
level: categoryKey,
|
||||
}, {
|
||||
sort: {name: 1},
|
||||
});
|
||||
},
|
||||
isSelected(spell){
|
||||
const selected = Template.instance().selectedSpell.get();
|
||||
return selected && selected._id === spell._id;
|
||||
},
|
||||
isOpen(key){
|
||||
const cats = Template.instance().categoriesOpen.get();
|
||||
return _.contains(cats, key);
|
||||
},
|
||||
searchTerm(){
|
||||
return Template.instance().searchTerm.get();
|
||||
},
|
||||
searchReady(){
|
||||
return Template.instance().searchReady.get();
|
||||
},
|
||||
searchSpells(){
|
||||
const searchTerm = Template.instance().searchTerm.get();
|
||||
if (!searchTerm) return;
|
||||
return LibrarySpells.find({
|
||||
library: "SRDLibraryGA3XWsd",
|
||||
name: {
|
||||
$regex: new RegExp(".*" + searchTerm + ".*", "gi")
|
||||
},
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
Template.spellLibraryDialog.events({
|
||||
"click .cancelButton": function(event, template){
|
||||
popDialogStack();
|
||||
},
|
||||
"click .okButton": function(event, template){
|
||||
popDialogStack(template.selectedSpell.get());
|
||||
},
|
||||
"click .library-spell": function(event, template){
|
||||
template.selectedSpell.set(this.spell);
|
||||
},
|
||||
"click #backButton": function(event, template){
|
||||
popDialogStack();
|
||||
},
|
||||
"click .category-header": function(event, template){
|
||||
let cats = template.categoriesOpen.get();
|
||||
const key = this.key;
|
||||
// Toggle whether this key is in the array or not
|
||||
if (_.contains(cats, key)){
|
||||
cats = _.without(cats, key);
|
||||
} else {
|
||||
cats.push(key);
|
||||
}
|
||||
template.categoriesOpen.set(cats);
|
||||
},
|
||||
"input .search-input, change .search-input": function(event, template){
|
||||
const value = event.currentTarget.value;
|
||||
template.searchTerm.set(value);
|
||||
},
|
||||
});
|
||||
@@ -2,12 +2,21 @@
|
||||
<div>
|
||||
<paper-material class="ability-mini-card layout horizontal">
|
||||
<div class="numbers">
|
||||
{{#if swap}}
|
||||
<div class="paper-font-display1 stat">
|
||||
{{abilityMod}}
|
||||
</div>
|
||||
<div class="paper-font-subhead modifier">
|
||||
{{characterCalculate "attributeValue" ../_id ability}}
|
||||
</div>
|
||||
{{else}}
|
||||
<div class="paper-font-display1 stat">
|
||||
{{characterCalculate "attributeValue" ../_id ability}}
|
||||
</div>
|
||||
<div class="paper-font-subhead modifier">
|
||||
{{abilityMod}}
|
||||
</div>
|
||||
{{/if}}
|
||||
</div>
|
||||
<div class="paper-font-subhead title flex layout horizontal center">
|
||||
{{title}}
|
||||
|
||||
@@ -5,5 +5,10 @@ Template.abilityMiniCard.helpers({
|
||||
Template.parentData()._id, this.ability
|
||||
)
|
||||
);
|
||||
}
|
||||
},
|
||||
swap: function() {
|
||||
var character = Characters.findOne({"_id": Template.parentData()._id})
|
||||
if (character) {return character.settings.swapStatAndModifier;}
|
||||
else {return false;}
|
||||
},
|
||||
});
|
||||
|
||||
@@ -28,8 +28,8 @@
|
||||
{{/unless}}
|
||||
</div>
|
||||
<paper-diff-slider class="tempHitPointSlider flex"
|
||||
value={{left}}
|
||||
max={{maximum}}
|
||||
value={{left}}
|
||||
editable pin
|
||||
></paper-diff-slider>
|
||||
</div>
|
||||
|
||||
@@ -61,6 +61,18 @@
|
||||
<td>Total</td>
|
||||
<td>{{characterCalculate "skillMod" charId skillName}}</td>
|
||||
</tr>
|
||||
{{#each passiveEffects}}
|
||||
<tr>
|
||||
<td>{{sourceName}}</td>
|
||||
<td>Passive Bonus: {{statValue}}</td>
|
||||
</tr>
|
||||
{{/each}}
|
||||
{{#if showPassiveTotal}}
|
||||
<tr class="paper-font-body2">
|
||||
<td>Passive Score</td>
|
||||
<td>{{characterCalculate "passiveSkill" charId skillName}}</td>
|
||||
</tr>
|
||||
{{/if}}
|
||||
</table>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -122,7 +122,7 @@ Template.skillDialogView.helpers({
|
||||
var char = Characters.findOne(this.charId);
|
||||
if (!char) return;
|
||||
var prof = Characters.calculate.proficiency(this.charId, this.skillName);
|
||||
var proficiencyBonus =
|
||||
var proficiencyBonus =
|
||||
Characters.calculate.attributeValue(this.charId, "proficiencyBonus");
|
||||
return prof * proficiencyBonus;
|
||||
},
|
||||
@@ -189,6 +189,23 @@ Template.skillDialogView.helpers({
|
||||
enabled: true,
|
||||
});
|
||||
},
|
||||
passiveEffects: function(){
|
||||
return Effects.find({
|
||||
charId: this.charId,
|
||||
stat: this.skillName,
|
||||
operation: "passiveAdd",
|
||||
enabled: true,
|
||||
});
|
||||
},
|
||||
showPassiveTotal: function(){
|
||||
if (this.skillName === "perception") return true;
|
||||
return Effects.find({
|
||||
charId: this.charId,
|
||||
stat: this.skillName,
|
||||
operation: "passiveAdd",
|
||||
enabled: true,
|
||||
}).count();
|
||||
},
|
||||
ability: function(){
|
||||
var opts = {fields: {}};
|
||||
opts.fields[this.skillName] = 1;
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
{{#if conditionalCount}}
|
||||
*
|
||||
{{/if}}
|
||||
{{#if showPassive}}
|
||||
{{#if isPassiveShown}}
|
||||
({{characterCalculate "passiveSkill" ../_id skill}})
|
||||
{{/if}}
|
||||
</div>
|
||||
|
||||
@@ -38,4 +38,16 @@ Template.skillRow.helpers({
|
||||
operation: "conditional",
|
||||
}).count();
|
||||
},
|
||||
isPassiveShown: function(){
|
||||
if (this.showPassive === "forced") return true;
|
||||
if (this.showPassive === "ifNeeded"){
|
||||
var charId = Template.parentData()._id;
|
||||
return Effects.find({
|
||||
charId,
|
||||
stat: this.skill,
|
||||
operation: "passiveAdd",
|
||||
enabled: true,
|
||||
}).count();
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
@@ -49,24 +49,24 @@
|
||||
Skills
|
||||
</div>
|
||||
<div flex class="bottom list">
|
||||
{{> skillRow name="Acrobatics" skill="acrobatics"}}
|
||||
{{> skillRow name="Animal Handling" skill="animalHandling"}}
|
||||
{{> skillRow name="Arcana" skill="arcana"}}
|
||||
{{> skillRow name="Athletics" skill="athletics"}}
|
||||
{{> skillRow name="Deception" skill="deception"}}
|
||||
{{> skillRow name="History" skill="history"}}
|
||||
{{> skillRow name="Insight" skill="insight"}}
|
||||
{{> skillRow name="Intimidation" skill="intimidation"}}
|
||||
{{> skillRow name="Investigation" skill="investigation"}}
|
||||
{{> skillRow name="Medicine" skill="medicine"}}
|
||||
{{> skillRow name="Nature" skill="nature"}}
|
||||
{{> skillRow name="Perception" skill="perception" showPassive="true"}}
|
||||
{{> skillRow name="Performance" skill="performance"}}
|
||||
{{> skillRow name="Persuasion" skill="persuasion"}}
|
||||
{{> skillRow name="Religion" skill="religion"}}
|
||||
{{> skillRow name="Sleight of Hand" skill="sleightOfHand"}}
|
||||
{{> skillRow name="Stealth" skill="stealth"}}
|
||||
{{> skillRow name="Survival" skill="survival"}}
|
||||
{{> skillRow name="Acrobatics" skill="acrobatics" showPassive="ifNeeded"}}
|
||||
{{> skillRow name="Animal Handling" skill="animalHandling" showPassive="ifNeeded"}}
|
||||
{{> skillRow name="Arcana" skill="arcana" showPassive="ifNeeded"}}
|
||||
{{> skillRow name="Athletics" skill="athletics" showPassive="ifNeeded"}}
|
||||
{{> skillRow name="Deception" skill="deception" showPassive="ifNeeded"}}
|
||||
{{> skillRow name="History" skill="history" showPassive="ifNeeded"}}
|
||||
{{> skillRow name="Insight" skill="insight" showPassive="ifNeeded"}}
|
||||
{{> skillRow name="Intimidation" skill="intimidation" showPassive="ifNeeded"}}
|
||||
{{> skillRow name="Investigation" skill="investigation" showPassive="ifNeeded"}}
|
||||
{{> skillRow name="Medicine" skill="medicine" showPassive="ifNeeded"}}
|
||||
{{> skillRow name="Nature" skill="nature" showPassive="ifNeeded"}}
|
||||
{{> skillRow name="Perception" skill="perception" showPassive="forced"}}
|
||||
{{> skillRow name="Performance" skill="performance" showPassive="ifNeeded"}}
|
||||
{{> skillRow name="Persuasion" skill="persuasion" showPassive="ifNeeded"}}
|
||||
{{> skillRow name="Religion" skill="religion" showPassive="ifNeeded"}}
|
||||
{{> skillRow name="Sleight of Hand" skill="sleightOfHand" showPassive="ifNeeded"}}
|
||||
{{> skillRow name="Stealth" skill="stealth" showPassive="ifNeeded"}}
|
||||
{{> skillRow name="Survival" skill="survival" showPassive="ifNeeded"}}
|
||||
</div>
|
||||
</paper-material>
|
||||
</div>
|
||||
|
||||
@@ -8,8 +8,16 @@
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.character-card .image {
|
||||
.partyHeader {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.partyHeader iron-icon {
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
.partyHeader:hover iron-icon{
|
||||
visibility: initial;
|
||||
}
|
||||
|
||||
.character-card .initials {
|
||||
|
||||
@@ -10,31 +10,27 @@
|
||||
{{#if currentUser}}
|
||||
{{#if characters.count}}
|
||||
<div class="character-list layout horizontal wrap">
|
||||
{{# each characters}}
|
||||
<a class="character-card flex layout vertical end-justified" href="/character/{{_id}}">
|
||||
<iron-image class="fit {{colorClass}}"
|
||||
sizing="cover" preload fade src={{picture}}>
|
||||
</iron-image>
|
||||
{{#unless picture}}
|
||||
<div class="fit initials layout vertical center center-justified">
|
||||
{{initials name}}
|
||||
</div>
|
||||
{{/unless}}
|
||||
<paper-item>
|
||||
<paper-item-body two-lines>
|
||||
<div class="name white87">
|
||||
{{name}}
|
||||
</div>
|
||||
<div secondary style="color: #8a8a8a; color: rgba(255,255,255,0.87);">
|
||||
{{alignment}} {{gender}} {{race}}
|
||||
</div>
|
||||
</paper-item-body>
|
||||
</paper-item>
|
||||
<paper-ripple></paper-ripple>
|
||||
</a>
|
||||
{{# each charactersWithNoParty}}
|
||||
{{> characterCard}}
|
||||
{{/each}}
|
||||
{{> gridPadding class="character-card flex layout vertical" num=12}}
|
||||
</div>
|
||||
{{# each party in parties}}
|
||||
<div class="party" data-id={{party._id}}>
|
||||
{{#with party}}
|
||||
<div class="partyHeader clickable paper-font-title padded">
|
||||
{{name}}
|
||||
<iron-icon icon="create"></iron-icon>
|
||||
</div>
|
||||
{{/with}}
|
||||
<div class="character-list layout horizontal wrap">
|
||||
{{# each charactersInParty party._id}}
|
||||
{{> characterCard}}
|
||||
{{/each}}
|
||||
{{> gridPadding class="character-card flex layout vertical" num=12}}
|
||||
</div>
|
||||
</div>
|
||||
{{/each}}
|
||||
{{else}}
|
||||
<div layout vertical center center-justified class="padded">
|
||||
<div>You don't seem to have any characters yet</div>
|
||||
@@ -47,9 +43,46 @@
|
||||
</div>
|
||||
{{/if}}
|
||||
<div class="fab-buffer"></div>
|
||||
<paper-fab class="floatyButton addCharacter"
|
||||
icon="add"
|
||||
title="Add"></paper-fab>
|
||||
{{#fabMenu}}
|
||||
<div>
|
||||
<paper-fab icon="social:group"
|
||||
class="addParty"
|
||||
mini>
|
||||
</paper-fab>
|
||||
<paper-tooltip position="left"> New Party </paper-tooltip>
|
||||
</div>
|
||||
<div>
|
||||
<paper-fab icon="face"
|
||||
class="addCharacter"
|
||||
mini>
|
||||
</paper-fab>
|
||||
<paper-tooltip position="left"> New Character </paper-tooltip>
|
||||
</div>
|
||||
{{/fabMenu}}
|
||||
</div>
|
||||
</app-header-layout>
|
||||
</template>
|
||||
|
||||
<template name="characterCard">
|
||||
<a class="character-card flex layout vertical end-justified" href="{{characterPath this}}">
|
||||
<iron-image class="fit {{colorClass}}"
|
||||
sizing="cover" preload fade src={{picture}}>
|
||||
</iron-image>
|
||||
{{#unless picture}}
|
||||
<div class="fit initials layout vertical center center-justified">
|
||||
{{initials name}}
|
||||
</div>
|
||||
{{/unless}}
|
||||
<paper-item>
|
||||
<paper-item-body two-lines>
|
||||
<div class="name white87">
|
||||
{{name}}
|
||||
</div>
|
||||
<div secondary style="color: #8a8a8a; color: rgba(255,255,255,0.87);">
|
||||
{{alignment}} {{gender}} {{race}}
|
||||
</div>
|
||||
</paper-item-body>
|
||||
</paper-item>
|
||||
<paper-ripple></paper-ripple>
|
||||
</a>
|
||||
</template>
|
||||
|
||||
@@ -1,27 +1,60 @@
|
||||
Template.characterList.helpers({
|
||||
characters(){
|
||||
characters() {
|
||||
var userId = Meteor.userId();
|
||||
return Characters.find(
|
||||
{
|
||||
$or: [
|
||||
{readers: userId},
|
||||
{writers: userId},
|
||||
{owner: userId},
|
||||
]
|
||||
},
|
||||
{
|
||||
fields: {name: 1, picture: 1, color: 1, race: 1, alignment: 1, gender: 1},
|
||||
sort: {name: 1},
|
||||
}
|
||||
{$or: [{readers: userId}, {writers: userId}, {owner: userId}]},
|
||||
{sort: {name: 1}}
|
||||
);
|
||||
},
|
||||
parties() {
|
||||
return Parties.find(
|
||||
{owner: Meteor.userId()},
|
||||
{sort: {name: 1}},
|
||||
);
|
||||
},
|
||||
charactersInParty(partyId) {
|
||||
var userId = Meteor.userId();
|
||||
var party = Parties.findOne(partyId);
|
||||
return Characters.find(
|
||||
{
|
||||
_id: {$in: party.characters},
|
||||
$or: [{readers: userId}, {writers: userId}, {owner: userId}],
|
||||
},
|
||||
{sort: {name: 1}}
|
||||
);
|
||||
},
|
||||
charactersWithNoParty() {
|
||||
var userId = Meteor.userId();
|
||||
var charArrays = Parties.find({owner: userId}).map(p => p.characters);
|
||||
var partyChars = _.uniq(_.flatten(charArrays));
|
||||
return Characters.find(
|
||||
{
|
||||
_id: {$nin: partyChars},
|
||||
$or: [{readers: userId}, {writers: userId}, {owner: userId}],
|
||||
},
|
||||
{sort: {name: 1}}
|
||||
);
|
||||
},
|
||||
});
|
||||
|
||||
Template.characterCard.helpers({
|
||||
initials(name){
|
||||
return name.replace(/[^A-Z]/g, "");
|
||||
},
|
||||
})
|
||||
});
|
||||
|
||||
Template.characterList.events({
|
||||
"tap .addCharacter": function(event, template) {
|
||||
"click .partyHeader": function(event, instance){
|
||||
pushDialogStack({
|
||||
template: "partyDialog",
|
||||
data: {
|
||||
_id: this._id,
|
||||
startEditing: true,
|
||||
},
|
||||
element: event.currentTarget.parentElement,
|
||||
});
|
||||
},
|
||||
"click .addCharacter": function(event, instance) {
|
||||
pushDialogStack({
|
||||
template: "newCharacterDialog",
|
||||
element: event.currentTarget,
|
||||
@@ -29,8 +62,23 @@ Template.characterList.events({
|
||||
if (!character) return;
|
||||
character.owner = Meteor.userId();
|
||||
let _id = Characters.insert(character);
|
||||
Router.go("characterSheet", {_id});
|
||||
let urlName = getSlug(character.name, {maintainCase: true}) || "-"
|
||||
Router.go("characterSheet", {_id, urlName});
|
||||
},
|
||||
})
|
||||
},
|
||||
"click .addParty": function(event, instance) {
|
||||
var partyId = Parties.insert({
|
||||
owner: Meteor.userId(),
|
||||
});
|
||||
pushDialogStack({
|
||||
template: "partyDialog",
|
||||
data: {
|
||||
_id: partyId,
|
||||
startEditing: true,
|
||||
},
|
||||
element: event.currentTarget,
|
||||
returnElement: instance.find(`.party[data-id='${partyId}']`),
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
@@ -2,8 +2,21 @@
|
||||
prevent character names from wrapping
|
||||
*/
|
||||
|
||||
.character-name {
|
||||
.side-list .character-name {
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.side-list .partyHead {
|
||||
font-weight: 500;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.side-list .partyHead iron-icon {
|
||||
transition: transform 0.3s ease;
|
||||
}
|
||||
|
||||
.side-list .partyHead iron-icon.open {
|
||||
transform: rotate(90deg);
|
||||
}
|
||||
|
||||
@@ -1,15 +1,31 @@
|
||||
<template name="characterSideList">
|
||||
{{#if characters.count}}
|
||||
<div class="side-list">
|
||||
{{#each characters}}
|
||||
<a href={{pathFor route="characterSheet" data=this}} tabindex="-1" class="side-list-character characterRepresentative">
|
||||
<paper-item class="short">
|
||||
<div class="character-name">
|
||||
{{name}}
|
||||
</div>
|
||||
</paper-item>
|
||||
</a>
|
||||
{{/each}}
|
||||
</div>
|
||||
{{/if}}
|
||||
<div class="side-list">
|
||||
{{#each charactersWithNoParty}}
|
||||
<a href={{characterPath this}} tabindex="-1" class="side-list-character characterRepresentative">
|
||||
<paper-item class="short">
|
||||
<div class="character-name">
|
||||
{{name}}
|
||||
</div>
|
||||
</paper-item>
|
||||
</a>
|
||||
{{/each}}
|
||||
{{#each parties}}
|
||||
<div class="paper-font-subhead partyHead">
|
||||
<iron-icon icon="chevron-right" class="{{#if isOpen _id}}open{{/if}}">
|
||||
</iron-icon>
|
||||
{{name}}
|
||||
</div>
|
||||
<iron-collapse opened={{isOpen _id}}>
|
||||
{{#each charactersInParty}}
|
||||
<a href={{characterPath this}} tabindex="-1" class="side-list-character characterRepresentative">
|
||||
<paper-item class="short">
|
||||
<div class="character-name">
|
||||
{{name}}
|
||||
</div>
|
||||
</paper-item>
|
||||
</a>
|
||||
{{/each}}
|
||||
</iron-collapse>
|
||||
{{/each}}
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -1,33 +1,52 @@
|
||||
Template.characterSideList.onCreated(function() {
|
||||
this.subscribe("characterList");
|
||||
this.openedParties = new ReactiveVar(new Set());
|
||||
});
|
||||
|
||||
Template.characterSideList.helpers({
|
||||
characters: function() {
|
||||
parties() {
|
||||
return Parties.find(
|
||||
{owner: Meteor.userId()},
|
||||
{sort: {name: 1}},
|
||||
);
|
||||
},
|
||||
charactersInParty() {
|
||||
var userId = Meteor.userId();
|
||||
return Characters.find(
|
||||
{
|
||||
$or: [
|
||||
{readers: userId},
|
||||
{writers: userId},
|
||||
{owner: userId},
|
||||
]
|
||||
_id: {$in: this.characters},
|
||||
$or: [{readers: userId}, {writers: userId}, {owner: userId}],
|
||||
},
|
||||
{
|
||||
fields: {name: 1},
|
||||
sort: {name: 1},
|
||||
}
|
||||
{sort: {name: 1}}
|
||||
);
|
||||
},
|
||||
charactersWithNoParty() {
|
||||
var userId = Meteor.userId();
|
||||
var charArrays = Parties.find({owner: userId}).map(p => p.characters);
|
||||
var partyChars = _.uniq(_.flatten(charArrays));
|
||||
return Characters.find(
|
||||
{
|
||||
_id: {$nin: partyChars},
|
||||
$or: [{readers: userId}, {writers: userId}, {owner: userId}],
|
||||
},
|
||||
{sort: {name: 1}}
|
||||
);
|
||||
},
|
||||
isOpen(id) {
|
||||
var openedParties = Template.instance().openedParties.get();
|
||||
console.log(openedParties);
|
||||
return openedParties.has(id);
|
||||
},
|
||||
});
|
||||
|
||||
Template.characterSideList.events({
|
||||
"tap .singleLineItem": function(event, instance) {
|
||||
//Router.go("characterSheet", {_id: this._id});
|
||||
$("core-drawer-panel").get(0).closeDrawer();
|
||||
},
|
||||
"tap core-item": function() {
|
||||
Router.go("characterList");
|
||||
$("core-drawer-panel").get(0).closeDrawer();
|
||||
"click .partyHead": function(event, instance){
|
||||
var openedParties = instance.openedParties.get();
|
||||
if (openedParties.has(this._id)){
|
||||
openedParties.delete(this._id);
|
||||
} else {
|
||||
openedParties.add(this._id);
|
||||
}
|
||||
instance.openedParties.set(openedParties);
|
||||
},
|
||||
});
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
.partyEdit .inPartyCheckbox {
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<template name="partyDialog">
|
||||
{{#with party}}
|
||||
{{#baseDialog title=name hideColor=true startEditing=true}}
|
||||
{{> partyDetails}}
|
||||
{{else}}
|
||||
{{> partyEdit}}
|
||||
{{/baseDialog}}
|
||||
{{/with}}
|
||||
</template>
|
||||
|
||||
<template name="partyDetails">
|
||||
<div class="fit layout vertical partyDetails" style="padding: 24px;">
|
||||
<div>
|
||||
{{#each character in getCharacters}}
|
||||
<div>{{character.name}}</div>
|
||||
{{/each}}
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<template name="partyEdit">
|
||||
<div class="layout vertical partyEdit" style="padding: 24px;">
|
||||
<paper-input class="partyNameInput" value={{name}} label="Party name">
|
||||
</paper-input>
|
||||
{{#each allCharacters}}
|
||||
<paper-checkbox checked={{charInParty _id}}
|
||||
class="inPartyCheckbox">
|
||||
{{name}}
|
||||
</paper-checkbox>
|
||||
{{/each}}
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,62 @@
|
||||
Template.partyDialog.helpers({
|
||||
party(){
|
||||
return Parties.findOne(this._id);
|
||||
}
|
||||
});
|
||||
|
||||
Template.partyDetails.helpers({
|
||||
getCharacters (){
|
||||
var userId = Meteor.userId();
|
||||
return Characters.find(
|
||||
{
|
||||
_id: {$in: this.characters},
|
||||
$or: [{readers: userId}, {writers: userId}, {owner: userId}],
|
||||
},
|
||||
{sort: {name: 1}}
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
Template.partyEdit.helpers({
|
||||
allCharacters() {
|
||||
var userId = Meteor.userId();
|
||||
return Characters.find(
|
||||
{$or: [{readers: userId}, {writers: userId}, {owner: userId}]},
|
||||
{sort: {name: 1}}
|
||||
);
|
||||
},
|
||||
charInParty(charId) {
|
||||
return _.contains(Template.parentData().characters, charId);
|
||||
},
|
||||
});
|
||||
|
||||
Template.partyDialog.events({
|
||||
"click #deleteButton": function(event, instance){
|
||||
Parties.remove(instance.data._id);
|
||||
popDialogStack();
|
||||
},
|
||||
"click #doneEditingButton": function(event, instance){
|
||||
popDialogStack();
|
||||
},
|
||||
});
|
||||
|
||||
Template.partyEdit.events({
|
||||
"change .inPartyCheckbox": function(event, instance){
|
||||
var currentCharacters = this.characters;
|
||||
var checked = event.currentTarget.checked;
|
||||
var charId = this._id;
|
||||
var partyId = instance.data._id;
|
||||
if (checked){
|
||||
Parties.update(partyId, {$addToSet: {characters: charId}});
|
||||
} else {
|
||||
Parties.update(partyId, {$pull: {characters: charId}});
|
||||
}
|
||||
},
|
||||
"input .partyNameInput": function(event, instance){
|
||||
var name = event.currentTarget.value;
|
||||
Parties.update(this._id, {$set: {name}}, {
|
||||
removeEmptyStrings: false,
|
||||
trimStrings: false,
|
||||
});
|
||||
},
|
||||
});
|
||||
@@ -4,4 +4,8 @@
|
||||
|
||||
.wallOfText p{
|
||||
margin-top: 8px;
|
||||
}
|
||||
|
||||
.wallOfText a{
|
||||
color: #d13b2e;
|
||||
}
|
||||
@@ -7,92 +7,127 @@
|
||||
</app-toolbar>
|
||||
</app-header>
|
||||
<div class="layout vertical center">
|
||||
<paper-material class="wallOfText card" style="padding: 32px; max-width: 800px;">
|
||||
<h2>Character Sheet Philosophy</h2>
|
||||
<p>Setting up your character on DiceCloud is going to take you a little longer than just filling it in on a paper character sheet would have. The goal of using an online sheet is to make actually playing the game more streamlined, and ultimately more fun. So putting a little extra effort into setting up your character now will pay off over and over again once you're playing.</p>
|
||||
<p>The idea is to track where each number comes from, and allow you to easily make changes on the fly.</p>
|
||||
<p>Lets look at a hypothetical example.</p>
|
||||
<p>You need to swim through a sunken section of dungeon to fetch the quest's Thing.<br>You'll need to take off your magical Plate Armor of +1 Constitution to swim without sinking, of course. Taking it off will change your armor class, your speed and your constitution, which in turn changes your hitpoints and your constitution saving throw. Working out all those changes in the middle of a game will drag the game to a hault. <br> Fortunately you have a digital character sheet, so it's a matter of dragging your Plate Armor +1 Con from your "equipment" box to your "backpack" box and you're done. Your hitpoints change correctly, your saving throws are up to date, your armor class goes back to reflecting the fact that you have natural armor from being a dragonborn. Your character sheet keeps up and you ultimately get more time to play the game. Huzzah!</p>
|
||||
<h2>Creating a Character</h2>
|
||||
<ul>
|
||||
<li>In the <a href={{pathFor route="characterList"}}>character list</a>, click the plus button, floating in the bottom right corner.</li>
|
||||
<li>Give your character a name, gender and race, these can be changed later if you change your mind. Then click the Add button</li>
|
||||
<li>Your new character should open, with most of its attributes and abilities at zero.</li>
|
||||
</ul>
|
||||
<paper-material class="wallOfText card" style="padding: 32px; max-width: 800px;"> {{#markdown}}
|
||||
|
||||
<h2>Adding Racial Effects</h2>
|
||||
<p>You have already given your character a race, but you haven't yet specified what that race does for your character, so lets do that.</p>
|
||||
<ul>
|
||||
<li>Click the Journal tab</li>
|
||||
<li>In the card that displays your level, click on your race to open the racial dialog box</li>
|
||||
<li>Click the edit button in the top corner of the racial dialog</li>
|
||||
</ul>
|
||||
<p>In the edit mode of the racial dialog you can change your race's name and add effects and proficiencies your race gives you. We will only be adding the base traits our race gives us, specific features can go in the features tab so we can more easily reference them later.</p>
|
||||
<p>Lets add some of the effects all races will give.</p>
|
||||
<ul>
|
||||
<li>Click the Add Effect button, a new effect should appear</li>
|
||||
<li>In the Stat Group dropdown box, choose "Stats"</li>
|
||||
<li>The second dropdown lets us choose which stat to effect, choose "Speed"</li>
|
||||
<li>The third dropdown lets us choose how to effect that stat, choose "Base Value", since our character's base speed comes from their race</li>
|
||||
<li>Finally, input the value for our characters speed, it'll probably be 30 unless you chose a slower race, such as a dwarf</li>
|
||||
<li>Close the Race dialog and navigate to the Stats tab</li>
|
||||
<li>The speed card should now correctly display the character's speed</li>
|
||||
<li>Click the speed card to see how that value was calculated</li>
|
||||
<li>Currently there is only one number effecting the total, the speed from our race, but as more effects from different sources start impacting our character's speed, they will show up here.</li>
|
||||
</ul>
|
||||
## Character Sheet Philosophy
|
||||
|
||||
<h2>Adding your ability scores</h2>
|
||||
<p>Your character currently doesn't have any ability scores, so lets fix that. Whether you roll your abilities or point-buy them, lets add a feature to represent where they came from</p>
|
||||
<ul>
|
||||
<li>Navigate to the <emd>Features</emd> tab</li>
|
||||
<li>Click the plus button in the bottom right to add a new feature</li>
|
||||
<li>Give the Feature a name, like <em>Point Buy</em></li>
|
||||
<li>Leave the feature as always enabled, don't limit its uses, and leave the description blank</li>
|
||||
<li>Click the <em>Add Effect</em> button</li>
|
||||
<li>For <em>Stat Group</em> choose <em>Ability Scores</em></li>
|
||||
<li>For <em>Stat</em> choose <em>Strength</em></li>
|
||||
<li>For the operation choose <em>Base Value</em></li>
|
||||
<li>Input your character's rolled or point-bought strength, without the racial modfier</li>
|
||||
<li>Repeat for the rest of your ability scores</li>
|
||||
</ul>
|
||||
<p>You can now check that your ability scores appear on your <em>Stats</em> page and that your skills that use them have their values calculated accordingly.</p>
|
||||
<p>We didn't include your character's racial ability modifiers in the feature, so you should go back to your character's racial dialog and add them in there as effects. Remember to use the add operation, rather than base value, since your race adds to your ability scores.</p>
|
||||
<p>By separating the source of your character's stats you can easily check how your character got their ability scores and stats, even after 20 levels, without getting confused or making mistakes.</p>
|
||||
Setting up your character on DiceCloud is going to take you a little longer than just filling it in on a paper character sheet would have. The goal of using an online sheet is to make actually playing the game more streamlined, and ultimately more fun. So putting a little extra effort into setting up your character now will pay off over and over again once you're playing.
|
||||
|
||||
<h2>Adding a Class</h2>
|
||||
<p>Currently your character is at level 0, because they don't have any class levels. Let's fix that.</p>
|
||||
<ul>
|
||||
<li>Click the plus button in the card that currently says "Level 0"</li>
|
||||
<li>A new class has now been added, name the class in the Class Name input and leave the level as 1</li>
|
||||
</ul>
|
||||
<p>We now have a class, lets add the saving throw proficiencies it gives us.</p>
|
||||
<ul>
|
||||
<li>Click the Add Proficiency button</li>
|
||||
<li>Click the dropdown box that currently has "Skill" selected, and choose "Saving Throw" instead</li>
|
||||
<li>In the second dropdown choose the first saving throw your class gives you</li>
|
||||
<li>The third dropdown lets us specify if we have half or double our proficiency bonus for this proficiency, leave it at the default "proficient" for now</li>
|
||||
</ul>
|
||||
<p>If you navigate back to the stat page, you will see that you now have a proficiency bonus, based on your class level, and the saving throw you are proficienct in will take your proficiency bonus into account.</p>
|
||||
<p>One of the most important things your class gives you is your hitpoints, so lets go add those now.</p>
|
||||
<ul>
|
||||
<li>Navigate to the class dialog box by clicking on your class name in the journal tab and hitting the edit button</li>
|
||||
<li>Click the Add Effect button</li>
|
||||
<li>Choose the <em>Stats</em> stat group, and choose the <em>Hitpoints</em> stat</li>
|
||||
<li>Choose the <em>Base Value</em> operation</li>
|
||||
</ul>
|
||||
<p>Now we need to decide how many hitpoints our class gives us. We will assume that we take the constant hitpoints per level, since it's both the rule used for league play and it's statistically advantageous over rolling for hitpoints every level.</p>
|
||||
<p>We could work out our hit points every level and change the effect each time, but we can do one better, we can input the calculation directly into the value field and have the character sheet figure it out for us</p>
|
||||
<p>Let's assume we are rolling a fighter, so in the class name you typed in "Fighter" (with the capital F, but without the quote marks). A fighter gets 10 hp at first level and 6 hitpoints every level after that.</p>
|
||||
<p>Lets rather split that into 4 bonus hitpoints at first level, and 6 hitpoints for every fighter level your character has. We can the write this as <em>4 + 6*FighterLevel</em> where the * represents multiplication.</p>
|
||||
<p><em>Note, we don't add the constitution modifier here, that's already taken care of by default, since all characters add their constitution modifier to their hit points</em></p>
|
||||
<ul>
|
||||
<li>In the value field input <em>4 + 6 * FighterLevel</em>, the spaces aren't needed, but you must spell your class name exactly as it is spelt in the class name input box, capital letters and all, in our case "Fighter"</li>
|
||||
<li>Create a new effect that effects the base value of <em>d10 Hit Dice</em> with the value of <em>FighterLevel</em>, since we also get our fighters level worth of hit dice</li>
|
||||
<li>Check how your changes are reflected in the <em>Stats</em> tab</li>
|
||||
<li>Change your level and check that the <em>Stats</em> tab gets updated accordingly</li>
|
||||
</ul>
|
||||
<p>You can try all sorts of calculations in your effects and in certain other places too. For example if you had some feature that is used a number of times equal to your wisdom modifier or 1, whichever is lower, you could limit its uses to <em>min(1, wisdomMod)</em> and the character sheet will figure it out for you, and update itself if you wisdom modifier happens to change later.</p>
|
||||
</paper-material>
|
||||
The idea is to track where each number comes from, and allow you to easily make changes on the fly.
|
||||
Let's look at a hypothetical example.
|
||||
|
||||
You need to swim through a sunken section of dungeon to fetch the quest's Thing.
|
||||
You'll need to take off your magical Plate Armor of +1 Constitution to swim without sinking, of course. Taking it off will change your armor class, your speed and your constitution, which in turn changes your hit points and your constitution saving throw. Working out all those changes in the middle of a game will drag the game to a halt.
|
||||
Fortunately you have a digital character sheet, so it's a matter of dragging your Plate Armor +1 Con from your "equipment" box to your "backpack" box and you're done. Your hitpoints change correctly, your saving throws are up to date, your armor class goes back to reflecting the fact that you have natural armor from being a dragonborn. Your character sheet keeps up and you ultimately get more time to play the game. Huzzah!
|
||||
|
||||
---
|
||||
|
||||
## Creating a Character
|
||||
|
||||
- In the [character list]({{pathFor route="characterList"}}), click the plus button, floating in the bottom right corner.
|
||||
- Give your character a name, gender and race - these can all be changed later if you change your mind. Then click the Add button.
|
||||
- Your new character should open, with your ability scores at a default of 10, but most other attributes at zero.
|
||||
|
||||
|
||||
## Adding Racial Effects
|
||||
You have already given your character a race, but you haven't yet specified what that race does for your character, so let's do that.
|
||||
|
||||
- Click the Journal tab.
|
||||
- In the card that displays your level, click on your race to open the racial dialog box.
|
||||
- Click the edit button (the pencil icon) in the top corner of the racial dialog.
|
||||
|
||||
In the edit mode of the racial dialog you can change your race's name and add effects and proficiencies your race gives you. We will only be adding the base traits our race gives us, specific features can go in the features tab so we can more easily reference them later.
|
||||
|
||||
Let's add some of the effects all races will give.
|
||||
|
||||
- Click the Add Effect button; a new window will open - this is the effect edit dialog.
|
||||
- In the left menu, scroll down to "Stats" and choose "Speed".
|
||||
- The right menu let's us choose how to effect that stat. Choose "Base Value", since our character's base speed comes from their race.
|
||||
- Finally, input the value for our characters speed, it'll probably be 30 unless you chose a slower race, such as a dwarf.
|
||||
- Close the Race dialog and navigate to the Stats tab.
|
||||
- The speed card should now correctly display the character's speed.
|
||||
- Click the speed card to see how that value was calculated.
|
||||
- Currently there is only one number effecting the total, the speed from our race, but as more effects from different sources start impacting our character's speed, they will show up here.
|
||||
|
||||
You can now also add any other *stat changes* given yo you by your race, for example a human's +1 to each ability score, or an elf's +2 Dexterity.
|
||||
|
||||
## Adding your ability scores
|
||||
|
||||
Your character's ability scores are currently all 10 by default - which means that they're no better than your average commoner! Whether you roll your abilities, point-buy them, or just use the standard set of values, you'll need to update them.
|
||||
|
||||
- Navigate to the *Features* tab.
|
||||
- Select the *Base Ability Scores* feature, which was added automatically.
|
||||
- Click the edit button (the pencil icon) in the top right corner.
|
||||
- Click the pencil icon to the right of your character's Strength to open the effect edit dialog.
|
||||
- Input your character's rolled or point-bought strength, *without* the racial modifier.
|
||||
- Notice that the operation is *Base Value* by default - this is what we want, as it is the character's *base* Strength score.
|
||||
- Repeat for the rest of your ability scores.
|
||||
|
||||
You can now check that your ability scores appear on your *Stats* page and that your skills that use them have their values calculated accordingly.
|
||||
|
||||
We didn't include your character's racial ability modifiers in the feature, so you should go back to your character's racial dialog and add them in there as effects. Remember to use the add operation, rather than base value, since your race adds to your ability scores.
|
||||
|
||||
By separating the source of your character's stats you can easily check how your character got their ability scores and stats, even after 20 levels, without getting confused or making mistakes.</p>
|
||||
|
||||
## Adding a Class
|
||||
|
||||
Currently your character is at level 0, because they don't have any class levels. Let's fix that.
|
||||
|
||||
- Click the plus button in the card that currently says "Level 0"
|
||||
- A new class has now been added, name the class in the Class Name input and leave the level as 1.
|
||||
|
||||
We now have a class, let's add the saving throw proficiencies it gives us.
|
||||
|
||||
- Click the Add Proficiency button
|
||||
- Click the dropdown box that currently has "Skill" selected, and choose "Saving Throw" instead
|
||||
- In the second dropdown choose the first saving throw your class gives you
|
||||
- The third dropdown let's us specify if we have half or double our proficiency bonus for this proficiency, leave it at the default "proficient" for now
|
||||
|
||||
If you navigate back to the stat page, you will see that you now have a proficiency bonus, based on your class level, and the saving throw you are proficienct in will take your proficiency bonus into account.
|
||||
|
||||
One of the most important things your class gives you is your hit points, so let's go add those now.
|
||||
|
||||
- Navigate to the class dialog box by clicking on your class name in the journal tab and hitting the edit button
|
||||
- Click the Add Effect button
|
||||
- Scroll down to *Stats* on the left, and choose the *Hit Points* stat.
|
||||
- Choose the *Base Value* operation.
|
||||
|
||||
Now we need to decide how many hit points our class gives us. We will assume that we take the constant hit points per level, since it's both the rule used for league play and it's statistically advantageous over rolling for hit points every level.
|
||||
|
||||
We could work out our hit points every level and change the effect each time, but we can do one better: we can input the calculation directly into the value field and have the character sheet figure it out for us.
|
||||
|
||||
Let's assume we are creating a fighter, so in the class name you typed in "Fighter" (with the capital F, but without the quote marks). A fighter gets 10 hp at first level and 6 hitpoints every level after that.
|
||||
|
||||
Let's rather split that into 4 bonus hit points at first level, and 6 hit points for every fighter level your character has. We can the write this as `4 + 6*FighterLevel` where the `*` represents multiplication.
|
||||
|
||||
*Note that we __don't add the constitution modifier here__; that's already taken care of by default, since all characters add their constitution modifier to their hit points automatically.*
|
||||
|
||||
- In the value field input `4 + 6*FighterLevel` - the spaces aren't needed, but you must spell your class name exactly as it is spelt in the class name input box, capital letters and all, in our case "Fighter"
|
||||
- Create a new effect that sets the base value of *d10 Hit Dice* to *FighterLevel*, since we also get a number of hit dice equal to our fighter's level.
|
||||
- Check how your changes are reflected in the *Stats* tab.
|
||||
- Change your level and check that the *Stats* tab gets updated accordingly.
|
||||
|
||||
This method of including calculations in other stats allows you to take full advantage of having a digital character sheet, as it means that you can change any one thing in your character sheet and everthing else will update automatically.
|
||||
|
||||
---
|
||||
|
||||
## Additional Tips
|
||||
|
||||
Any input field with a <iron-icon icon="lightbulb-outline"></iron-icon> light bulb icon is a *formula field*: it will compute any and all variables and functions within it. For example, the "Value" field in the effect edit dialog is a formula field, so you could set the value to `3`, or `FighterLevel*2`, or any formula you can think of.
|
||||
|
||||
Any input field with a <iron-icon icon="dicecloud:code-braces"></iron-icon> curly brackets icon is a *smart input field*: you can also use formulas here, but they must be enclosed within {curly brackets}. For example, the "Damage" field of a spell or weapon is a smart input field, so you could type `1d8 + {strengthMod}` for the damage, and if your strength modifier was +3, it would display as "1d8 + 3".
|
||||
|
||||
The full list of functions and variables can be found on the GitHub wiki, [here](https://github.com/ThaumRystra/DiceCloud1/wiki/Function-and-Variable-List).
|
||||
|
||||
Any description field, as well as some others like your background or description, can be formatted with Markdown.
|
||||
For example, having \*asterisks\* around something makes it *italic*, and a \*\*pair\*\* makes it **bold**.
|
||||
If you need to display an actual asterisk, you can escape it with a backslash, like this: \\\*.
|
||||
You can read more about Markdown [here](https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet "Markdown Cheatsheet") and [here](https://daringfireball.net/projects/markdown/syntax "Markdown's origianal specification").
|
||||
|
||||
In addition, using three or more hyphens on their own line (like this: " --- "; this is the Markdown for a horizontal rule) will cut off the description of a feature card or any of the cards on the Persona page, so that the full description is only displayed - this is useful when having the full feature text would be annoyingly long, so you can simply display a summary on the card and have it expand into the full text.
|
||||
|
||||
|
||||
{{/markdown}}</paper-material>
|
||||
</div>
|
||||
</app-header-layout>
|
||||
</template>
|
||||
|
||||
@@ -21,10 +21,15 @@
|
||||
max-width: 300px;
|
||||
padding: 16px;
|
||||
text-align: center;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.intro .section .columns {
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
.intro paper-button {
|
||||
min-width: 200px;
|
||||
flex-basis: 200px;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@
|
||||
</div>
|
||||
<div class="section white-text" style="background: #282828">
|
||||
<div class="columns layout horizontal around-justified wrap">
|
||||
<div>
|
||||
<div class="layout vertical center">
|
||||
<div class="paper-font-headline">
|
||||
Guide
|
||||
</div>
|
||||
@@ -78,7 +78,7 @@
|
||||
</paper-button>
|
||||
</a>
|
||||
</div>
|
||||
<div>
|
||||
<div class="layout vertical center">
|
||||
<div class="paper-font-headline">
|
||||
Discuss
|
||||
</div>
|
||||
@@ -91,7 +91,7 @@
|
||||
</paper-button>
|
||||
</a>
|
||||
</div>
|
||||
<div>
|
||||
<div class="layout vertical center">
|
||||
<div class="paper-font-headline">
|
||||
Get involved
|
||||
</div>
|
||||
|
||||
@@ -1,7 +1,13 @@
|
||||
var hints = [
|
||||
"Drag and drop items to move them between containers",
|
||||
"Hold Ctrl while dragging items around to only move some of them",
|
||||
"Magic items are considered priceless, don't give them a gold value",
|
||||
"Drag and drop items to move them between containers.",
|
||||
"Hold Ctrl while dragging items around to only move some of them.",
|
||||
"Magic items are considered priceless, don't give them a gold value.",
|
||||
"You can use formulae in {curly brackets} in any field with a {} icon.",
|
||||
"You can disable the 'Spells' tab from the charecter menu in the top right.",
|
||||
"You can share your character with others from the menu in the top right.",
|
||||
"Your spells, features, and items are ordered by their colour, which you can set with the paint bucket.",
|
||||
"You can only have three magic items attuned to you at once. Choose carefully!",
|
||||
"Click the '+' underneath 'Hit Points' to add additional health bars for temporary HP, wild shapes, familiars and more.",
|
||||
];
|
||||
|
||||
Template.loading.helpers({
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
</app-toolbar>
|
||||
<div class="form flex scroll-y">
|
||||
<div class="form flex scroll-y" style="position: relative;">
|
||||
{{#unless editing}}
|
||||
{{> UI.contentBlock}}
|
||||
{{else}}
|
||||
|
||||
@@ -4,11 +4,13 @@ Template.baseDialog.onCreated(function(){
|
||||
|
||||
Template.baseDialog.helpers({
|
||||
editing: function(){
|
||||
if (!Template.parentData() || !Template.parentData().charId) return true;
|
||||
return Template.instance().editing.get() &&
|
||||
canEditCharacter(Template.parentData().charId);
|
||||
},
|
||||
showEdit: function() {
|
||||
if (this.hideEdit) return false;
|
||||
if (!Template.parentData() || !Template.parentData().charId) return true;
|
||||
return canEditCharacter(Template.parentData().charId);
|
||||
},
|
||||
});
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
<template name="baseEditDialog">
|
||||
<div class="fit base-dialog layout vertical">
|
||||
<app-toolbar class={{class}}>
|
||||
<paper-icon-button id="backButton"
|
||||
icon="arrow-back">
|
||||
</paper-icon-button>
|
||||
<div main-title>{{title}}</div>
|
||||
{{#unless hideDelete}}
|
||||
<paper-icon-button id="deleteButton"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
icon="delete">
|
||||
</paper-icon-button>
|
||||
{{/unless}}
|
||||
{{#unless hideColor}}
|
||||
{{> colorDropdown}}
|
||||
{{/unless}}
|
||||
</app-toolbar>
|
||||
<div class="form flex scroll-y" style="position: relative;">
|
||||
{{> UI.contentBlock}}
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,5 @@
|
||||
Template.baseEditDialog.events({
|
||||
"tap #backButton": function(){
|
||||
popDialogStack();
|
||||
},
|
||||
});
|
||||
@@ -13,14 +13,80 @@ pushDialogStack = function({template, data, element, returnElement, callback}){
|
||||
returnElement,
|
||||
callback,
|
||||
});
|
||||
|
||||
updateHistory();
|
||||
};
|
||||
|
||||
var currentResult;
|
||||
|
||||
popDialogStack = function(result){
|
||||
if (history && history.state && history.state.openDialogs){
|
||||
currentResult = result;
|
||||
history.back();
|
||||
} else {
|
||||
popDialogStackAction(result);
|
||||
}
|
||||
}
|
||||
|
||||
window.onpopstate = function(event){
|
||||
let state = event.state;
|
||||
let numDialogs = dialogs._array.length;
|
||||
if (_.isFinite(state.openDialogs) && numDialogs > state.openDialogs){
|
||||
popDialogStackAction(currentResult);
|
||||
currentResult = undefined;
|
||||
}
|
||||
}
|
||||
|
||||
popDialogStackAction = function(result){
|
||||
const dialog = dialogs.pop();
|
||||
updateHistory();
|
||||
if (!dialog) return;
|
||||
dialog.callback && dialog.callback(result);
|
||||
};
|
||||
|
||||
let updateHistory = function(){
|
||||
// history should looks like: [{openDialogs: 0}, {openDialogs: n}] where
|
||||
// n is the number of open dialogs
|
||||
|
||||
// If we can't access the history object, give up
|
||||
if (!history) return;
|
||||
// Make sure that there is a state tracking open dialogs
|
||||
// replace the state without bashing it in the process
|
||||
if (!history.state || !_.isFinite(history.state.openDialogs)){
|
||||
let newState = _.clone(history.state) || {};
|
||||
newState.openDialogs = 0;
|
||||
history.replaceState(newState, "");
|
||||
}
|
||||
|
||||
const numDialogs = dialogs._array.length;
|
||||
const stateDialogs = history.state.openDialogs;
|
||||
|
||||
// If the number of dialogs and state dialogs are equal, we don't need to do
|
||||
// anything
|
||||
if (numDialogs === stateDialogs) return;
|
||||
|
||||
if (stateDialogs > 0){
|
||||
// On a dialog count
|
||||
if (numDialogs === 0){
|
||||
// but shouldn't be
|
||||
history.back();
|
||||
} else {
|
||||
// but should replace with correct count
|
||||
let newState = _.clone(history.state) || {};
|
||||
newState.openDialogs = dialogs._array.length;
|
||||
history.replaceState(newState, "");
|
||||
}
|
||||
} else if (numDialogs > 0 && stateDialogs === 0){
|
||||
// On the zero state, push a dialog count
|
||||
history.pushState({openDialogs: numDialogs}, "");
|
||||
} else {
|
||||
console.warn(
|
||||
"History could not be updated correctly, unexpected case",
|
||||
{stateDialogs, numDialogs},
|
||||
)
|
||||
}
|
||||
};
|
||||
|
||||
Template.dialogStack.helpers({
|
||||
dialogStackClass(){
|
||||
if (!dialogs.get().length) return "hide";
|
||||
@@ -174,7 +240,7 @@ const dialogCloseAnimation = ({element, returnElement, dialog, callback}) => {
|
||||
const stackCompensation = dialogs._array.length ? 16 : 0;
|
||||
|
||||
// Insert clone before its progenitor so it can inherit css correctly
|
||||
element.parentNode.insertBefore(clone, element);
|
||||
element.parentNode && element.parentNode.insertBefore(clone, element);
|
||||
|
||||
// Polymer messes up fixed positioning, measure and compensate
|
||||
startingRect = clone.getBoundingClientRect();
|
||||
|
||||
@@ -25,10 +25,10 @@ Template.fabMenu.helpers({
|
||||
});
|
||||
|
||||
Template.fabMenu.events({
|
||||
"tap .expand-menu": function(event, instance) {
|
||||
"click .expand-menu": function(event, instance) {
|
||||
instance.active.set(!instance.active.get());
|
||||
},
|
||||
"tap .mini-holder paper-fab": function(event, instance) {
|
||||
"click .mini-holder paper-fab": function(event, instance) {
|
||||
instance.active.set(false);
|
||||
},
|
||||
});
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
.textarea-bracket-suffix {
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
.description-input > paper-textarea {
|
||||
width: 100%;
|
||||
width: 100% - 24px;
|
||||
}
|
||||
@@ -1,13 +1,35 @@
|
||||
<template name="formulaSuffix">
|
||||
<div suffix>
|
||||
<paper-tooltip position="left" animation-delay="0">This is a formula field</paper-tooltip>
|
||||
<div suffix style="position: relative">
|
||||
<iron-icon icon="lightbulb-outline"></iron-icon>
|
||||
{{# simpleTooltip}}
|
||||
This is a formula field
|
||||
{{/ simpleTooltip}}
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<template name="bracketSuffix">
|
||||
<div suffix>
|
||||
<paper-tooltip position="left" animation-delay="0">This field accepts formulae in {curly brackets}</paper-tooltip>
|
||||
<div suffix style="position: relative">
|
||||
<iron-icon icon="dicecloud:code-braces"></iron-icon>
|
||||
{{# simpleTooltip}}
|
||||
This field accepts formulae in {curly brackets}
|
||||
{{/ simpleTooltip}}
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<template name="textareaBracketSuffix">
|
||||
<div class="textarea-bracket-suffix">
|
||||
<div class="markdown" style="position: relative">
|
||||
<iron-icon icon="dicecloud:markdown"></iron-icon>
|
||||
{{# simpleTooltip}}
|
||||
This field accepts markdown formatting
|
||||
{{/ simpleTooltip}}
|
||||
</div>
|
||||
<div class="brackets" style="position: relative">
|
||||
<!--<paper-tooltip position="left" animation-delay="0">This field accepts formulae in {curly brackets}</paper-tooltip>-->
|
||||
<iron-icon icon="dicecloud:code-braces"></iron-icon>
|
||||
{{# simpleTooltip}}
|
||||
This field accepts formulae in {curly brackets}
|
||||
{{/ simpleTooltip}}
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
.simple-tooltip:hover .tooltip {
|
||||
opacity: 0.9;
|
||||
}
|
||||
|
||||
.tooltip {
|
||||
opacity: 0;
|
||||
transition: opacity 200ms ease-in;
|
||||
font-size: 12px;
|
||||
line-height: 1;
|
||||
background-color: #616161;
|
||||
color: white;
|
||||
padding: 8px;
|
||||
border-radius: 2px;
|
||||
position: absolute;
|
||||
right: calc(100% + 8px);
|
||||
pointer-events: none;
|
||||
white-space: nowrap;
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
<template name="simpleTooltip">
|
||||
<div class="simple-tooltip fit">
|
||||
<div class="tooltip">
|
||||
{{> Template.contentBlock}}
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
71
rpg-docs/lib/constants/statOrder.js
Normal file
71
rpg-docs/lib/constants/statOrder.js
Normal file
@@ -0,0 +1,71 @@
|
||||
statOrder = {
|
||||
"strength": 1,
|
||||
"dexterity": 2,
|
||||
"constitution": 3,
|
||||
"intelligence": 4,
|
||||
"wisdom": 5,
|
||||
"charisma": 6,
|
||||
"strengthSave": 7,
|
||||
"dexteritySave": 8,
|
||||
"constitutionSave": 9,
|
||||
"intelligenceSave": 10,
|
||||
"wisdomSave": 11,
|
||||
"charismaSave": 12,
|
||||
"acrobatics": 13,
|
||||
"animalHandling": 14,
|
||||
"arcana": 15,
|
||||
"athletics": 16,
|
||||
"deception": 17,
|
||||
"history": 18,
|
||||
"insight": 19,
|
||||
"intimidation": 20,
|
||||
"investigation": 21,
|
||||
"medicine": 22,
|
||||
"nature": 23,
|
||||
"perception": 24,
|
||||
"performance": 25,
|
||||
"persuasion": 26,
|
||||
"religion": 27,
|
||||
"sleightOfHand": 28,
|
||||
"stealth": 29,
|
||||
"survival": 30,
|
||||
"initiative": 31,
|
||||
"hitPoints": 32,
|
||||
"armor": 33,
|
||||
"dexterityArmor": 34,
|
||||
"speed": 35,
|
||||
"proficiencyBonus": 36,
|
||||
"ki": 37,
|
||||
"sorceryPoints": 38,
|
||||
"rages": 39,
|
||||
"rageDamage": 40,
|
||||
"expertiseDice": 41,
|
||||
"superiorityDice": 42,
|
||||
"carryMultiplier": 43,
|
||||
"level1SpellSlots": 44,
|
||||
"level2SpellSlots": 45,
|
||||
"level3SpellSlots": 46,
|
||||
"level4SpellSlots": 47,
|
||||
"level5SpellSlots": 48,
|
||||
"level6SpellSlots": 49,
|
||||
"level7SpellSlots": 50,
|
||||
"level8SpellSlots": 51,
|
||||
"level9SpellSlots": 52,
|
||||
"d6HitDice": 53,
|
||||
"d8HitDice": 54,
|
||||
"d10HitDice": 55,
|
||||
"d12HitDice": 56,
|
||||
"acidMultiplier": 57,
|
||||
"bludgeoningMultiplier": 58,
|
||||
"coldMultiplier": 59,
|
||||
"fireMultiplier": 60,
|
||||
"forceMultiplier": 61,
|
||||
"lightningMultiplier": 62,
|
||||
"necroticMultiplier": 63,
|
||||
"piercingMultiplier": 64,
|
||||
"poisonMultiplier": 65,
|
||||
"psychicMultiplier": 66,
|
||||
"radiantMultiplier": 67,
|
||||
"slashingMultiplier": 68,
|
||||
"thunderMultiplier": 69,
|
||||
};
|
||||
@@ -8,9 +8,10 @@
|
||||
})();
|
||||
|
||||
//evaluates a calculation string
|
||||
evaluate = function(charId, string){
|
||||
evaluate = function(charId, string, opts){
|
||||
var spellListId = opts && opts.spellListId;
|
||||
if (!string) return string;
|
||||
string = string.replace(/\b[a-z]+\b/gi, function(sub){
|
||||
string = string.replace(/\b[a-z,1-9]+\b/gi, function(sub){
|
||||
//fields
|
||||
if (Schemas.Character.schema(sub)){
|
||||
return Characters.calculate.fieldValue(charId, sub);
|
||||
@@ -43,6 +44,18 @@ evaluate = function(charId, string){
|
||||
if (sub.toUpperCase() === "LEVEL"){
|
||||
return Characters.calculate.level(charId);
|
||||
}
|
||||
if (spellListId && sub.toUpperCase() === "DC") {
|
||||
var list = SpellLists.findOne(spellListId);
|
||||
if (list && list.saveDC){
|
||||
return evaluate(charId, list.saveDC);
|
||||
}
|
||||
}
|
||||
if (spellListId && sub.toUpperCase() === "ATTACKBONUS") {
|
||||
var list = SpellLists.findOne(spellListId);
|
||||
if (list && list.attackBonus){
|
||||
return evaluate(charId, list.attackBonus);
|
||||
}
|
||||
}
|
||||
return sub;
|
||||
});
|
||||
try {
|
||||
@@ -66,6 +79,17 @@ evaluateString = function(charId, string){
|
||||
return result;
|
||||
};
|
||||
|
||||
evaluateSpellString = function (charId, spellListId, string) {
|
||||
//define brackets as curly brackets around anything that isn't a curly bracket
|
||||
if (!string) return string;
|
||||
var brackets = /\{[^\{\}]*\}/g;
|
||||
var result = string.replace(brackets, function(exp){
|
||||
exp = exp.replace(/(\{|\})/g, ""); //remove curly brackets
|
||||
return evaluate(charId, exp, {spellListId});
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
//returns the value of the effect if it exists,
|
||||
//otherwise returns the result of the calculation if it exists,
|
||||
//otherwise returns 0
|
||||
|
||||
@@ -11,5 +11,8 @@
|
||||
<g id="patreon">
|
||||
<path d="M 0,11.704583 C 0,6.129988 4.5275823,0.90539433 10.497051,0.15752807 c 4.277795,-0.49807892 7.513064,1.14423533 9.752176,3.28462863 2.088042,1.9893242 3.332492,4.529078 3.631638,7.5160563 0.248292,2.991465 -0.397865,5.579082 -2.138897,8.017126 C 20.000935,21.368511 16.566733,24.001 12.288938,24.001 H 6.4675474 V 12.512279 c 0.050855,-2.5382585 0.8974395,-4.7295066 3.9786486,-5.7735279 2.687831,-0.7972254 5.822887,0.6955156 6.768189,3.5329199 0.987184,3.036337 -0.448719,5.076516 -2.138897,6.320966 -1.705135,1.244449 -4.337624,1.244449 -6.072674,0.04936 v 3.933777 c 1.136757,0.553421 2.587617,0.702994 3.63463,0.643165 3.769246,-0.538464 6.715839,-2.677362 7.957297,-5.923101 1.28633,-3.425228 0.38889,-7.4188334 -2.288471,-9.9017494 C 15.075488,2.746641 11.530602,2.1034761 7.761356,3.9432271 5.1139094,5.2893863 3.2741585,8.0265768 2.8254387,11.018042 V 23.999504 H 0.04487198 L 0,11.704583 z" style="fill-rule:nonzero"/>
|
||||
</g>
|
||||
<g id="markdown">
|
||||
<path d="M2,16V8H4L7,11L10,8H12V16H10V10.83L7,13.83L4,10.83V16H2M16,8H19V12H21.5L17.5,16.5L13.5,12H16V8Z" />
|
||||
</g>
|
||||
</defs></svg>
|
||||
</iron-iconset-svg>
|
||||
|
||||
@@ -249,7 +249,9 @@
|
||||
},
|
||||
|
||||
_updateItems: function() {
|
||||
var nodes = Polymer.dom(this).queryDistributedElements(this.selectable || '*');
|
||||
var nodes = this.selectable
|
||||
? Polymer.dom(this).querySelectorAll(this.selectable)
|
||||
: Polymer.dom(this).queryDistributedElements('*');
|
||||
nodes = Array.prototype.filter.call(nodes, this._bindFilterItem);
|
||||
this._setItems(nodes);
|
||||
},
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user