diff --git a/rpg-docs/Model/Character/Characters.js b/rpg-docs/Model/Character/Characters.js index e36d345c..f1ae372f 100644 --- a/rpg-docs/Model/Character/Characters.js +++ b/rpg-docs/Model/Character/Characters.js @@ -164,7 +164,7 @@ Schemas.Character = new SimpleSchema({ deathSave: { type: Schemas.DeathSave }, //permissions - owner: { type: String, regEx: SimpleSchema.RegEx.Id, optional: true }, + owner: { type: String, regEx: SimpleSchema.RegEx.Id }, readers: { type: [String], regEx: SimpleSchema.RegEx.Id, defaultValue: [] }, writers: { type: [String], regEx: SimpleSchema.RegEx.Id, defaultValue: [] }, color: {type: String, allowedValues: _.pluck(colorOptions, "key"), defaultValue: "q"}, diff --git a/rpg-docs/Model/Character/TemporaryHitPoints.js b/rpg-docs/Model/Character/TemporaryHitPoints.js new file mode 100644 index 00000000..0ba2b566 --- /dev/null +++ b/rpg-docs/Model/Character/TemporaryHitPoints.js @@ -0,0 +1,35 @@ +TemporaryHitPoints = new Meteor.Collection("temporaryHitPoints"); + +Schemas.TemporaryHitPoints = new SimpleSchema({ + charId: {type: String, regEx: SimpleSchema.RegEx.Id}, + maximum: {type: Number, defaultValue: 0}, + used: {type: Number, defaultValue: 0}, + deleteOnZero:{type: Boolean, defaultValue: true}, + dateAdded: { + type: Date, + autoValue: function() { + if (this.isInsert) { + return new Date; + } else if (this.isUpsert) { + return {$setOnInsert: new Date}; + } else { + this.unset(); + } + } + }, +}); + +TemporaryHitPoints.attachSchema(Schemas.TemporaryHitPoints); + +TemporaryHitPoints.helpers({ + left: function(){ + return this.maximum - this.used; + } +}); + +//remove the temporary hit points when they hit zero +TemporaryHitPoints.after.update(function (userId, thp, fieldNames, modifier, options) { + if(thp.used >= thp.maximum && thp.deleteOnZero){ + TemporaryHitPoints.remove(thp._id); + } +}, {fetchPrevious: false}); diff --git a/rpg-docs/Routes/Routes.js b/rpg-docs/Routes/Routes.js index bb27691d..8a4eb705 100644 --- a/rpg-docs/Routes/Routes.js +++ b/rpg-docs/Routes/Routes.js @@ -4,6 +4,7 @@ Router.configure({ }); Router.map( function () { + /* this.route('home', { path: '/', @@ -15,6 +16,19 @@ Router.map( function () { return Characters.find({}, {fields: {_id: 1}}); } } + });*/ //add a home route and change characterList route + + this.route('characterList', + { + path: '/', + waitOn: function(){ + return Meteor.subscribe("characterList", Meteor.userId()); + }, + data: { + characters: function(){ + return Characters.find({}, {fields: {_id: 1}}); + } + } }); this.route('characterSheet', { @@ -22,7 +36,7 @@ Router.map( function () { waitOn: function(){ return [ Meteor.subscribe("singleCharacter", this.params._id, Meteor.userId()), - ]; + ]; }, data: function() { var data = Characters.findOne({_id: this.params._id}, {fields: {_id: 1, name: 1, color: 1}}); @@ -48,7 +62,7 @@ Router.map( function () { return data; } }); - + this.route('loading', { path: '/loading' }); diff --git a/rpg-docs/client/views/GeneralCSS/typography.css b/rpg-docs/client/views/GeneralCSS/typography.css index d4c1c273..b3bf6daf 100644 --- a/rpg-docs/client/views/GeneralCSS/typography.css +++ b/rpg-docs/client/views/GeneralCSS/typography.css @@ -106,3 +106,9 @@ html /deep/ .white-text{ color: #444; color: rgba(0,0,0,0.54); } + +.white54 { + color: #eee; + color: rgba(255,255,255,0.54) + +} diff --git a/rpg-docs/client/views/character/stats/healthCard/healthCard.html b/rpg-docs/client/views/character/stats/healthCard/healthCard.html index ccaf35e4..90943fc0 100644 --- a/rpg-docs/client/views/character/stats/healthCard/healthCard.html +++ b/rpg-docs/client/views/character/stats/healthCard/healthCard.html @@ -1,7 +1,8 @@