diff --git a/rpg-docs/Model/Character/Characters.js b/rpg-docs/Model/Character/Characters.js
index 65295462..3003dc16 100644
--- a/rpg-docs/Model/Character/Characters.js
+++ b/rpg-docs/Model/Character/Characters.js
@@ -7,6 +7,7 @@ Schemas.Character = new SimpleSchema({
alignment: {type: String, defaultValue: "", trim: false, optional: true},
gender: {type: String, defaultValue: "", trim: false, optional: true},
race: {type: String, defaultValue: "", trim: false, optional: true},
+ picture: {type: String, defaultValue: "", trim: true, optional: true},
description: {type: String, defaultValue: "", trim: false, optional: true},
personality: {type: String, defaultValue: "", trim: false, optional: true},
ideals: {type: String, defaultValue: "", trim: false, optional: true},
diff --git a/rpg-docs/Model/Character/TemporaryHitPoints.js b/rpg-docs/Model/Character/TemporaryHitPoints.js
index 96752d4c..02b6e45d 100644
--- a/rpg-docs/Model/Character/TemporaryHitPoints.js
+++ b/rpg-docs/Model/Character/TemporaryHitPoints.js
@@ -5,7 +5,7 @@ Schemas.TemporaryHitPoints = new SimpleSchema({
name: {type: String, optional: true},
maximum: {type: Number, defaultValue: 0},
used: {type: Number, defaultValue: 0},
- deleteOnZero:{type: Boolean, defaultValue: true},
+ deleteOnZero:{type: Boolean, defaultValue: false},
dateAdded: {
type: Date,
autoValue: function() {
diff --git a/rpg-docs/client/globalHelpers/canEditCharacter.js b/rpg-docs/client/globalHelpers/canEditCharacter.js
index 95ba2ec6..2de1b6d6 100644
--- a/rpg-docs/client/globalHelpers/canEditCharacter.js
+++ b/rpg-docs/client/globalHelpers/canEditCharacter.js
@@ -1,6 +1,10 @@
Template.registerHelper("canEditCharacter", function(charId) {
+ return canEditCharacter(charId);
+});
+
+canEditCharacter = function(charId) {
var char = Characters.findOne(charId)
var userId = Meteor.userId();
return char.owner === userId ||
_.contains(char.writers, userId);
-});
+};
diff --git a/rpg-docs/client/views/character/features/features.html b/rpg-docs/client/views/character/features/features.html
index e39dd965..5726c166 100644
--- a/rpg-docs/client/views/character/features/features.html
+++ b/rpg-docs/client/views/character/features/features.html
@@ -95,14 +95,15 @@
+ checked={{enabled}}
+ disabled={{#unless canEditCharacter charId}}true{{/unless}}>
{{/if}}
{{#if description}}
{{evaluateString charId description}}
+ >{{evaluateString charId shortDescription}}
{{/if}}
{{#if hasUses}}
diff --git a/rpg-docs/client/views/character/features/features.js b/rpg-docs/client/views/character/features/features.js
index 3f68a6af..a0b1f329 100644
--- a/rpg-docs/client/views/character/features/features.js
+++ b/rpg-docs/client/views/character/features/features.js
@@ -3,14 +3,19 @@ Template.features.helpers({
var features = Features.find({charId: this._id}, {sort: {color: 1, name: 1}});
return features;
},
+ shortDescription: function() {
+ if (_.isString(this.description)){
+ return this.description.split(/[\n\r]{3,}/)[0];
+ }
+ },
hasUses: function(){
return this.usesValue() > 0;
},
noUsesLeft: function(){
- return this.usesLeft() <= 0;
+ return this.usesLeft() <= 0 || !canEditCharacter(this.charId);
},
usesFull: function(){
- return this.usesLeft() >= this.usesValue();
+ return this.usesLeft() >= this.usesValue() || !canEditCharacter(this.charId);
},
colorClass: function(){
return getColorClass(this.color);
@@ -99,12 +104,12 @@ Template.resource.helpers({
var value = Characters.calculate.attributeValue(this.char._id, this.name);
var base = Characters.calculate.attributeBase(this.char._id, this.name);
var baseBigger = value < base;
- return !baseBigger;
+ return !baseBigger || !canEditCharacter(this.char._id);
},
cantDecrement: function(){
var value = Characters.calculate.attributeValue(this.char._id, this.name);
var valuePositive = value > 0;
- return !valuePositive;
+ return !valuePositive || !canEditCharacter(this.char._id);
},
getColor: function(){
var value = Characters.calculate.attributeValue(this.char._id, this.name);
diff --git a/rpg-docs/client/views/character/inventory/inventory.html b/rpg-docs/client/views/character/inventory/inventory.html
index fcab2eb0..ff90d82c 100644
--- a/rpg-docs/client/views/character/inventory/inventory.html
+++ b/rpg-docs/client/views/character/inventory/inventory.html
@@ -35,8 +35,7 @@
+ layout horizontal center>
@@ -114,6 +113,7 @@
@@ -152,11 +152,11 @@
+ draggable={{canEditCharacter charId}}>
{{#if ne1 quantity}}{{quantity}} {{/if}}{{pluralName}}
- {{#if settings.showIncrement}}
+ {{#if settings.showIncrement}}{{#if canEditCharacter charId}}
- {{/if}}
+ {{/if}}{{/if}}
diff --git a/rpg-docs/client/views/character/inventory/inventory.js b/rpg-docs/client/views/character/inventory/inventory.js
index 58e70ea2..aaca5e8f 100644
--- a/rpg-docs/client/views/character/inventory/inventory.js
+++ b/rpg-docs/client/views/character/inventory/inventory.js
@@ -44,6 +44,12 @@ Template.inventory.helpers({
).forEach(function(item){
worth += item.totalValue();
});
+ Containers.find(
+ {charId: this._id},
+ {fields: {value : 1}}
+ ).forEach(function(container) {
+ if (container.value) worth += container.value;
+ });
return worth;
},
weightCarried: function(){
diff --git a/rpg-docs/client/views/character/journal/journal.html b/rpg-docs/client/views/character/journal/journal.html
index 1ab6a6ab..6d2a048a 100644
--- a/rpg-docs/client/views/character/journal/journal.html
+++ b/rpg-docs/client/views/character/journal/journal.html
@@ -10,7 +10,8 @@
layout horizontal center>
Experience
{{characterCalculate "experience" _id}} XP
-
+
{{#each experiences}}
@@ -55,7 +56,8 @@
+ icon="add"
+ disabled={{#unless canEditCharacter _id}}true{{/unless}}>
diff --git a/rpg-docs/client/views/character/persona/backgroundDialog/backgroundDialog.html b/rpg-docs/client/views/character/persona/backgroundDialog/backgroundDialog.html
index 4d31f38e..8bbf52ff 100644
--- a/rpg-docs/client/views/character/persona/backgroundDialog/backgroundDialog.html
+++ b/rpg-docs/client/views/character/persona/backgroundDialog/backgroundDialog.html
@@ -1,5 +1,5 @@
- {{#baseDialog title=title class=colorClass hideColor="true" hideDelete="true" startEditing=startEditing}}
+ {{#baseDialog title=title class=colorClass hideColor="true" hideDelete="true"}}
{{evaluateString charId value}}
{{> proficiencyViewList charId=charId parentId=charId parentGroup="background"}}
{{else}}
diff --git a/rpg-docs/client/views/character/persona/peronaDetailsDialog/personaDetailsDialog.html b/rpg-docs/client/views/character/persona/peronaDetailsDialog/personaDetailsDialog.html
index 372528e8..93900df5 100644
--- a/rpg-docs/client/views/character/persona/peronaDetailsDialog/personaDetailsDialog.html
+++ b/rpg-docs/client/views/character/persona/peronaDetailsDialog/personaDetailsDialog.html
@@ -1,18 +1,36 @@
{{#baseDialog title=name class="deep-purple white-text" hideColor="true" hideDelete="true" startEditing=startEditing}}
- {{alignment}} {{gender}} {{race}}
+ {{#with char}}
+ {{alignment}} {{gender}} {{race}}
+
+ {{/with}}
{{else}}
- {{> personaDetailsEdit}}
+ {{#with char}}
+ {{> personaDetailsEdit}}
+ {{/with}}
{{/baseDialog}}
-
-
-
-
-
-
-
-
+
diff --git a/rpg-docs/client/views/character/persona/peronaDetailsDialog/personaDetailsDialog.js b/rpg-docs/client/views/character/persona/peronaDetailsDialog/personaDetailsDialog.js
index 11407540..063eaea6 100644
--- a/rpg-docs/client/views/character/persona/peronaDetailsDialog/personaDetailsDialog.js
+++ b/rpg-docs/client/views/character/persona/peronaDetailsDialog/personaDetailsDialog.js
@@ -2,21 +2,34 @@ Template.personaDetailsEdit.onRendered(function(){
updatePolymerInputs(this);
});
+Template.personaDetailsDialog.helpers({
+ char: function() {
+ return Characters.findOne(
+ this._id,
+ {fields: {name: 1, alignment: 1, gender: 1, race: 1, picture: 1}}
+ );
+ }
+});
+
Template.personaDetailsEdit.events({
"change #nameInput": function(event){
var input = event.currentTarget.value;
- Characters.update(this.charId, {$set: {name: input}});
+ Characters.update(this._id, {$set: {name: input}});
},
"change #alignmentInput": function(event){
var input = event.currentTarget.value;
- Characters.update(this.charId, {$set: {alignment: input}});
+ Characters.update(this._id, {$set: {alignment: input}});
},
"change #genderInput": function(event){
var input = event.currentTarget.value;
- Characters.update(this.charId, {$set: {gender: input}});
+ Characters.update(this._id, {$set: {gender: input}});
},
"change #raceInput": function(event){
var input = event.currentTarget.value;
- Characters.update(this.charId, {$set: {race: input}});
+ Characters.update(this._id, {$set: {race: input}});
+ },
+ "change #pictureInput": function(event){
+ var input = event.currentTarget.value;
+ Characters.update(this._id, {$set: {picture: input}});
},
});
diff --git a/rpg-docs/client/views/character/persona/persona.html b/rpg-docs/client/views/character/persona/persona.html
index e23e1bcc..b8a8cb52 100644
--- a/rpg-docs/client/views/character/persona/persona.html
+++ b/rpg-docs/client/views/character/persona/persona.html
@@ -3,7 +3,35 @@