diff --git a/rpg-docs/Model/Character/Characters.js b/rpg-docs/Model/Character/Characters.js index 740d7cea..7ba2ac97 100644 --- a/rpg-docs/Model/Character/Characters.js +++ b/rpg-docs/Model/Character/Characters.js @@ -191,6 +191,7 @@ Schemas.Character = new SimpleSchema({ "settings.exportFeatures": {type: Boolean, defaultValue: true}, "settings.exportAttacks": {type: Boolean, defaultValue: true}, "settings.exportDescription": {type: Boolean, defaultValue: true}, + "settings.newUserExperience": {type: Boolean, optional: true}, }); Characters.attachSchema(Schemas.Character); @@ -298,6 +299,7 @@ Characters.calculate = { var fieldSelector = {}; fieldSelector[fieldName] = 1; var char = Characters.findOne(charId, {fields: fieldSelector}); + if (!char) return; var field = char[fieldName]; if (field === undefined){ throw new Meteor.Error( @@ -331,6 +333,7 @@ Characters.calculate = { }, attributeValue: memoize(function(charId, attributeName){ var attribute = Characters.calculate.getField(charId, attributeName); + if (!attribute) return; //base value var value = Characters.calculate.attributeBase(charId, attributeName); //plus adjustment @@ -342,6 +345,7 @@ Characters.calculate = { }), skillMod: memoize(preventLoop(function(charId, skillName){ var skill = Characters.calculate.getField(charId, skillName); + if (!skill) return; //get the final value of the ability score var ability = Characters.calculate.attributeValue(charId, skill.ability); @@ -393,7 +397,6 @@ Characters.calculate = { return prof && prof.value || 0; }), passiveSkill: memoize(function(charId, skillName){ - var skill = Characters.calculate.getField(charId, skillName); var mod = +Characters.calculate.skillMod(charId, skillName); var value = 10 + mod; Effects.find( @@ -554,6 +557,10 @@ if (Meteor.isServer){ }); Characters.before.insert(function(userId, doc) { doc.urlName = getSlug(doc.name, {maintainCase: true}) || "-"; + // The first character a user creates should have the new user experience + if (!Characters.find({owner: userId}).count()){ + doc.settings.newUserExperience = true; + } }); } diff --git a/rpg-docs/client/globalHelpers/canEditCharacter.js b/rpg-docs/client/globalHelpers/canEditCharacter.js index 2de1b6d6..57d0ce6f 100644 --- a/rpg-docs/client/globalHelpers/canEditCharacter.js +++ b/rpg-docs/client/globalHelpers/canEditCharacter.js @@ -3,7 +3,8 @@ Template.registerHelper("canEditCharacter", function(charId) { }); canEditCharacter = function(charId) { - var char = Characters.findOne(charId) + var char = Characters.findOne(charId); + if (!char) return false; var userId = Meteor.userId(); return char.owner === userId || _.contains(char.writers, userId); diff --git a/rpg-docs/client/style/bounce.css b/rpg-docs/client/style/bounce.css new file mode 100644 index 00000000..481754d5 --- /dev/null +++ b/rpg-docs/client/style/bounce.css @@ -0,0 +1,17 @@ +@keyframes bounce { + from { + transform: translate(0px,0px); + } + to { + transform: translate(0px,-16px); + } +} + +.bounce{ + animation-name: bounce; + animation-duration: 0.3s; + animation-direction: alternate; + animation-timing-function: cubic-bezier(0.25, 0.46, 0.45, 0.94); + animation-delay: 0s; + animation-iteration-count: infinite; +} diff --git a/rpg-docs/client/views/character/characterSettings/deleteCharacterConfirmation.js b/rpg-docs/client/views/character/characterSettings/deleteCharacterConfirmation.js index af8a64c2..fda5ba5c 100644 --- a/rpg-docs/client/views/character/characterSettings/deleteCharacterConfirmation.js +++ b/rpg-docs/client/views/character/characterSettings/deleteCharacterConfirmation.js @@ -10,7 +10,7 @@ Template.deleteCharacterConfirmation.helpers({ if (Template.instance().canDelete.get()) { return "background: #d23f31; color: white;"; } - } + }, }); Template.deleteCharacterConfirmation.events({ @@ -20,9 +20,7 @@ Template.deleteCharacterConfirmation.events({ }, "click #deleteButton": function(event, instance) { if (instance.find("#nameInput").value === this.name) { - popDialogStack(); - Router.go("/characterList"); - Characters.remove(this._id); + popDialogStack(true); } }, "click .cancelButton": function(event, instance){ diff --git a/rpg-docs/client/views/character/characterSheet.html b/rpg-docs/client/views/character/characterSheet.html index 9fd7a65f..cc4c4d6d 100644 --- a/rpg-docs/client/views/character/characterSheet.html +++ b/rpg-docs/client/views/character/characterSheet.html @@ -1,7 +1,7 @@ diff --git a/rpg-docs/client/views/character/features/features.js b/rpg-docs/client/views/character/features/features.js index ad08dec6..17873a2f 100644 --- a/rpg-docs/client/views/character/features/features.js +++ b/rpg-docs/client/views/character/features/features.js @@ -59,6 +59,10 @@ Template.features.helpers({ hasCharacters: function(string){ return string && string.match(/\S/); }, + shouldFloatyButtonBounce: function(){ + const step = Session.get("newUserExperienceStep"); + return step === 0 && Features.find({charId: this._id}).count() <= 1; + }, }); Template.features.events({ diff --git a/rpg-docs/client/views/character/inventory/inventory.html b/rpg-docs/client/views/character/inventory/inventory.html index cf823d5f..c135c6ec 100644 --- a/rpg-docs/client/views/character/inventory/inventory.html +++ b/rpg-docs/client/views/character/inventory/inventory.html @@ -110,12 +110,12 @@
{{round totalWeight}} lbs
-
+
- Container carried + {{#simpleTooltip}} Container carried{{/simpleTooltip}}
@@ -136,21 +136,21 @@ class="addContainer" mini> - New container + {{#simpleTooltip class="always"}} Container {{/simpleTooltip}}
- Library item + {{#simpleTooltip class="always"}} Item from library {{/simpleTooltip}}
- New item + {{#simpleTooltip class="always"}} Item {{/simpleTooltip}}
{{/fabMenu}} {{/if}} diff --git a/rpg-docs/client/views/character/journal/journal.html b/rpg-docs/client/views/character/journal/journal.html index ca5c1c14..8632954c 100644 --- a/rpg-docs/client/views/character/journal/journal.html +++ b/rpg-docs/client/views/character/journal/journal.html @@ -53,7 +53,7 @@
-
+
{{race}}
@@ -83,9 +83,12 @@
{{#if canEditCharacter _id}} - +
+ + + {{#simpleTooltip}}Add Note{{/simpleTooltip}} +
{{/if}} diff --git a/rpg-docs/client/views/character/journal/journal.js b/rpg-docs/client/views/character/journal/journal.js index 959b0d15..a1cbef98 100644 --- a/rpg-docs/client/views/character/journal/journal.js +++ b/rpg-docs/client/views/character/journal/journal.js @@ -50,6 +50,9 @@ Template.journal.helpers({ var char = Characters.findOne(this._id, {fields: {race: 1}}); return char && char.race; }, + shouldRaceBounce: function(){ + return Session.get("newUserExperienceStep") === 1; + }, }); Template.journal.events({ diff --git a/rpg-docs/client/views/character/journal/raceDialog/raceDialog.html b/rpg-docs/client/views/character/journal/raceDialog/raceDialog.html index ab4c73c5..190e539c 100644 --- a/rpg-docs/client/views/character/journal/raceDialog/raceDialog.html +++ b/rpg-docs/client/views/character/journal/raceDialog/raceDialog.html @@ -1,11 +1,34 @@