Compare commits
45 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 |
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,6 +7,8 @@ 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"
|
||||
@@ -15,3 +19,38 @@ _.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});
|
||||
});
|
||||
|
||||
@@ -49,3 +49,4 @@ differential:vulcanize
|
||||
reactive-dict
|
||||
percolate:synced-cron
|
||||
ongoworks:speakingurl
|
||||
service-configuration
|
||||
|
||||
@@ -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");
|
||||
}
|
||||
});
|
||||
|
||||
@@ -4,7 +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},
|
||||
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},
|
||||
@@ -185,6 +185,7 @@ 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},
|
||||
@@ -543,10 +544,13 @@ if (Meteor.isServer){
|
||||
});
|
||||
Characters.after.update(function(userId, doc, fieldNames, modifier, options) {
|
||||
if (_.contains(fieldNames, "name")){
|
||||
var urlName = getSlug(doc.name, {maintainCase: true});
|
||||
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({
|
||||
|
||||
@@ -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,
|
||||
},
|
||||
|
||||
@@ -43,7 +43,7 @@ Router.map(function() {
|
||||
var _id = this.params._id
|
||||
var character = Characters.findOne(_id);
|
||||
var urlName = character && character.urlName;
|
||||
var path = `\/character\/${_id}\/${urlName}`;
|
||||
var path = `\/character\/${_id}\/${urlName || "-"}`;
|
||||
Router.go(path,{},{replaceState:true});
|
||||
},
|
||||
});
|
||||
|
||||
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 || "-"}`;
|
||||
});
|
||||
@@ -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();
|
||||
},
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
label="Value"
|
||||
floatinglabel
|
||||
value={{effectValue}}>
|
||||
{{> formulaSuffix}}
|
||||
</paper-input>
|
||||
{{else}}
|
||||
<div style="height: 62px;"></div>
|
||||
|
||||
@@ -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"},
|
||||
|
||||
@@ -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-->
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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}}
|
||||
|
||||
@@ -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";
|
||||
@@ -268,6 +275,7 @@ Template.spells.events({
|
||||
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);
|
||||
@@ -277,6 +285,31 @@ Template.spells.events({
|
||||
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),
|
||||
})
|
||||
|
||||
@@ -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;}
|
||||
},
|
||||
});
|
||||
|
||||
@@ -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="{{pathFor route="characterSheet" data=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>
|
||||
{{# 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,35 +1,60 @@
|
||||
Template.characterList.helpers({
|
||||
characters(){
|
||||
characters() {
|
||||
var userId = Meteor.userId();
|
||||
return Characters.find(
|
||||
{
|
||||
$or: [
|
||||
{readers: userId},
|
||||
{writers: userId},
|
||||
{owner: userId},
|
||||
]
|
||||
},
|
||||
{
|
||||
fields: {
|
||||
name: 1,
|
||||
urlName: 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,
|
||||
@@ -37,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, urlName: 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>
|
||||
|
||||
@@ -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({
|
||||
|
||||
@@ -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,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>
|
||||
@@ -49,6 +49,12 @@ evaluate = function(charId, string, opts){
|
||||
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;
|
||||
});
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -23,142 +23,12 @@ Meteor.methods({
|
||||
|
||||
Migrations.add({
|
||||
version: 1,
|
||||
name: "converts effect proficiencies to proficiency objects, removes types from assets",
|
||||
up: function() {
|
||||
//convert proficiency effects to proficiency objects
|
||||
Effects.find({operation: "proficiency"}).forEach(function(effect){
|
||||
var type = "skill";
|
||||
if (_.contains(SAVES, effect.stat)) type = "save";
|
||||
Proficiencies.insert({
|
||||
charId: effect.charId,
|
||||
name: effect.stat,
|
||||
value: effect.value,
|
||||
parent: _.clone(effect.parent),
|
||||
type: type,
|
||||
enabled: effect.enabled,
|
||||
}, function(err){
|
||||
if (!err) Effects.remove(effect._id);
|
||||
});
|
||||
});
|
||||
//store type as a parent group if it's needed
|
||||
Effects.find({"parent.collection": "Characters"}).forEach(function(e){
|
||||
Effects.update(e._id, {$set: {"parent.group": e.type}});
|
||||
});
|
||||
Attacks.find({"parent.collection": "Characters"}).forEach(function(a){
|
||||
Attacks.update(a._id, {$set: {"parent.group": a.type}});
|
||||
});
|
||||
//remove type
|
||||
Effects.update({}, {$unset: {type: ""}}, {validate: false, multi: true});
|
||||
Attacks.update({}, {$unset: {type: ""}}, {validate: false, multi: true});
|
||||
//remove languages and proficiencies
|
||||
Characters.update(
|
||||
{},
|
||||
{$unset: {languages: "", proficiencies: ""}},
|
||||
{validate: false, multi: true}
|
||||
);
|
||||
},
|
||||
});
|
||||
|
||||
Migrations.add({
|
||||
version: 2,
|
||||
name: "Converts attacks from damage dice and damage bonus to a string with curly bracket calculations, adds settings.showIncrement to items",
|
||||
up: function() {
|
||||
//update attacks
|
||||
Attacks.find({}).forEach(function(attack) {
|
||||
if (!attack.damage && attack.damageDice && attack.damageBonus){
|
||||
var newDamage = attack.damageDice +
|
||||
" + {" + attack.damageBonus + "}";
|
||||
Attacks.update(
|
||||
attack._id,
|
||||
{
|
||||
$unset: {
|
||||
damageBonus: "",
|
||||
damageDice: "",
|
||||
},
|
||||
$set: {
|
||||
damage: newDamage
|
||||
},
|
||||
},
|
||||
{validate: false});
|
||||
}
|
||||
});
|
||||
//update Items
|
||||
Items.update(
|
||||
{settings: undefined},
|
||||
{$set: {"settings.showIncrement" : false}},
|
||||
{validate: false, multi: true}
|
||||
);
|
||||
},
|
||||
});
|
||||
|
||||
Migrations.add({
|
||||
version: 3,
|
||||
name: "Converts attacks from damage dice and damage bonus to a string with curly bracket calculations, adds settings.showIncrement to items",
|
||||
up: function() {
|
||||
//update characters
|
||||
Characters.update(
|
||||
{"settings.useVariantEncumbrance": undefined},
|
||||
{$set: {"settings.useVariantEncumbrance" : false}},
|
||||
{validate: false, multi: true}
|
||||
);
|
||||
Characters.update(
|
||||
{"settings.useStandardEncumbrance": undefined},
|
||||
{$set: {"settings.useStandardEncumbrance" : true}},
|
||||
{validate: false, multi: true}
|
||||
);
|
||||
},
|
||||
});
|
||||
|
||||
Migrations.add({
|
||||
version: 4,
|
||||
name: "Adds an effect to give characters a base carry capacity",
|
||||
up: function() {
|
||||
//update characters
|
||||
|
||||
Characters.find({}).forEach(function(char){
|
||||
Characters.update(char._id, {
|
||||
$set: {
|
||||
carryMultiplier: {
|
||||
adjustment: 0,
|
||||
reset: "longRest",
|
||||
}
|
||||
}
|
||||
});
|
||||
var effect = Effects.findOne({
|
||||
charId: char._id, name: "Natural Carrying Capacity",
|
||||
});
|
||||
if (effect) return;
|
||||
Effects.insert({
|
||||
charId: char._id,
|
||||
name: "Natural Carrying Capacity",
|
||||
stat: "carryMultiplier",
|
||||
operation: "base",
|
||||
value: "1",
|
||||
parent: {
|
||||
id: char._id,
|
||||
collection: "Characters",
|
||||
group: "Inate",
|
||||
},
|
||||
});
|
||||
effect = Effects.findOne({
|
||||
charId: char._id, name: "Natural Carrying Capacity",
|
||||
});
|
||||
if (!effect) throw "Carry capacity effect should be set by now."
|
||||
});
|
||||
},
|
||||
down: function(){
|
||||
return;
|
||||
},
|
||||
});
|
||||
|
||||
Migrations.add({
|
||||
version: 5,
|
||||
name: "Gives all characters a URL name",
|
||||
up: function() {
|
||||
//update characters
|
||||
Characters.find({}).forEach(function(char){
|
||||
if (char.urlName) return;
|
||||
var urlName = getSlug(char.name, {maintainCase: true});
|
||||
var urlName = getSlug(char.name, {maintainCase: true}) || "-";
|
||||
Characters.update(char._id, {$set: {urlName}});
|
||||
});
|
||||
},
|
||||
|
||||
@@ -4,27 +4,24 @@ Meteor.publish("characterList", function(){
|
||||
this.ready();
|
||||
return;
|
||||
}
|
||||
return Characters.find(
|
||||
{
|
||||
$or: [
|
||||
{readers: userId},
|
||||
{writers: userId},
|
||||
{owner: userId},
|
||||
]
|
||||
},
|
||||
{
|
||||
fields: {
|
||||
name: 1,
|
||||
urlName: 1,
|
||||
race: 1,
|
||||
alignment: 1,
|
||||
gender: 1,
|
||||
readers: 1,
|
||||
writers:1,
|
||||
owner: 1,
|
||||
color: 1,
|
||||
picture: 1,
|
||||
return [
|
||||
Characters.find(
|
||||
{$or: [{readers: userId}, {writers: userId}, {owner: userId}]},
|
||||
{
|
||||
fields: {
|
||||
name: 1,
|
||||
urlName: 1,
|
||||
race: 1,
|
||||
alignment: 1,
|
||||
gender: 1,
|
||||
readers: 1,
|
||||
writers:1,
|
||||
owner: 1,
|
||||
color: 1,
|
||||
picture: 1,
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
),
|
||||
Parties.find({owner: userId}),
|
||||
];
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user