diff --git a/README.md b/README.md index d8167276..e99c9c06 100644 --- a/README.md +++ b/README.md @@ -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` diff --git a/rpg-docs/client/views/character/effects/effectEdit/effectEdit.css b/rpg-docs/client/views/character/effects/effectEdit/effectEdit.css index d9170586..30e73411 100644 --- a/rpg-docs/client/views/character/effects/effectEdit/effectEdit.css +++ b/rpg-docs/client/views/character/effects/effectEdit/effectEdit.css @@ -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; +} diff --git a/rpg-docs/client/views/character/effects/effectEdit/effectEdit.html b/rpg-docs/client/views/character/effects/effectEdit/effectEdit.html index ccfc868a..3ae51b94 100644 --- a/rpg-docs/client/views/character/effects/effectEdit/effectEdit.html +++ b/rpg-docs/client/views/character/effects/effectEdit/effectEdit.html @@ -1,45 +1,53 @@ - - diff --git a/rpg-docs/client/views/character/effects/effectEdit/effectEdit.js b/rpg-docs/client/views/character/effects/effectEdit/effectEdit.js index 4a33c503..d18538fa 100644 --- a/rpg-docs/client/views/character/effects/effectEdit/effectEdit.js +++ b/rpg-docs/client/views/character/effects/effectEdit/effectEdit.js @@ -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,77 @@ 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; - } + }, }); 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){ + "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}}); + var setter = {stat: statName}; + var group = Blaze.getData(detail.item).group; + var effect = Effects.findOne(this._id); + 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(this._id, {$set: setter}); }, - "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 +207,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), }); diff --git a/rpg-docs/client/views/character/effects/effectView/effectView.html b/rpg-docs/client/views/character/effects/effectView/effectView.html index f47687f1..9fb1db03 100644 --- a/rpg-docs/client/views/character/effects/effectView/effectView.html +++ b/rpg-docs/client/views/character/effects/effectView/effectView.html @@ -1,6 +1,4 @@ diff --git a/rpg-docs/client/views/character/effects/effectView/effectView.js b/rpg-docs/client/views/character/effects/effectView/effectView.js index bc56e078..cd86df70 100644 --- a/rpg-docs/client/views/character/effects/effectView/effectView.js +++ b/rpg-docs/client/views/character/effects/effectView/effectView.js @@ -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"){ diff --git a/rpg-docs/client/views/character/effects/effectsEditList/effectsEditList.css b/rpg-docs/client/views/character/effects/effectsEditList/effectsEditList.css new file mode 100644 index 00000000..7c92fe71 --- /dev/null +++ b/rpg-docs/client/views/character/effects/effectsEditList/effectsEditList.css @@ -0,0 +1,3 @@ +.effectsEditList .effect { + background: white; +} diff --git a/rpg-docs/client/views/character/effects/effectsEditList/effectsEditList.html b/rpg-docs/client/views/character/effects/effectsEditList/effectsEditList.html index cf6a6182..f6216b3d 100644 --- a/rpg-docs/client/views/character/effects/effectsEditList/effectsEditList.html +++ b/rpg-docs/client/views/character/effects/effectsEditList/effectsEditList.html @@ -1,11 +1,19 @@