diff --git a/rpg-docs/client/views/character/inventory/carryCapacityBar/carryCapacityBar.html b/rpg-docs/client/views/character/inventory/carryCapacityBar/carryCapacityBar.html new file mode 100644 index 00000000..39f05f01 --- /dev/null +++ b/rpg-docs/client/views/character/inventory/carryCapacityBar/carryCapacityBar.html @@ -0,0 +1,14 @@ + diff --git a/rpg-docs/client/views/character/inventory/carryCapacityBar/carryCapacityBar.js b/rpg-docs/client/views/character/inventory/carryCapacityBar/carryCapacityBar.js new file mode 100644 index 00000000..6e95ebbe --- /dev/null +++ b/rpg-docs/client/views/character/inventory/carryCapacityBar/carryCapacityBar.js @@ -0,0 +1,38 @@ +var getFractionCarried = function(char) { + //find out the weight + var weight = 0; + Containers.find( + {charId: char._id, isCarried: true} + ).forEach(function(container){ + weight += container.totalWeight(); + }); + Items.find( + {charId: char._id, "parent.id": char._id}, + {fields: {weight : 1, quantity: 1}} + ).forEach(function(item){ + weight += item.totalWeight(); + }); + //get strength + var strength = char.attributeValue("strength"); + var capacity = strength * 15; + return weight / capacity; +}; + +Template.carryCapacityBar.helpers({ + carriedPercent: function() { + var percent = 100 * getFractionCarried(this); + return percent > 100 ? 100 : percent; + }, + carriedColor: function() { + var frac = getFractionCarried(this); + if (frac < 1 / 3){ + return "#2196F3"; + } else if (frac < 2 / 3){ + return "#CDDC39"; + } else if (frac < 1) { + return "#FFC107"; + } else { + return "#F44336"; + } + }, +}); diff --git a/rpg-docs/client/views/character/inventory/carryCapacityBar/carryCapacityBar.scss b/rpg-docs/client/views/character/inventory/carryCapacityBar/carryCapacityBar.scss new file mode 100644 index 00000000..2e06fa43 --- /dev/null +++ b/rpg-docs/client/views/character/inventory/carryCapacityBar/carryCapacityBar.scss @@ -0,0 +1,14 @@ +.carryCapacityBar { + background-color: #7DC580; + background-color: rgba(255,255,255,0.27); + position: relative; + height: 4px; + div{ + height: 100%; + position: absolute; + } + .tick { + border-right: solid 2px #E5E5E5; + border-right-color: rgba(255,255,255,0.54); + } +} \ No newline at end of file diff --git a/rpg-docs/client/views/character/inventory/carryDialog/carryDialog.html b/rpg-docs/client/views/character/inventory/carryDialog/carryDialog.html new file mode 100644 index 00000000..5c319499 --- /dev/null +++ b/rpg-docs/client/views/character/inventory/carryDialog/carryDialog.html @@ -0,0 +1,17 @@ + \ No newline at end of file diff --git a/rpg-docs/client/views/character/inventory/carryDialog/carryDialog.js b/rpg-docs/client/views/character/inventory/carryDialog/carryDialog.js new file mode 100644 index 00000000..c4d4fd7a --- /dev/null +++ b/rpg-docs/client/views/character/inventory/carryDialog/carryDialog.js @@ -0,0 +1,20 @@ +Template.carryDialog.helpers({ + carriedWeight: function() { + var weight = 0; + Containers.find( + {charId: this.charId, isCarried: true} + ).forEach(function(container){ + weight += container.totalWeight(); + }); + Items.find( + {charId: this.charId, "parent.id": this.charId}, + {fields: {weight : 1, quantity: 1}} + ).forEach(function(item){ + weight += item.totalWeight(); + }); + return weight; + }, + color: function() { + if (this.color) return this.color + " white-text"; + }, +}); diff --git a/rpg-docs/client/views/character/inventory/inventory.html b/rpg-docs/client/views/character/inventory/inventory.html index f0edb021..f00f8ee2 100644 --- a/rpg-docs/client/views/character/inventory/inventory.html +++ b/rpg-docs/client/views/character/inventory/inventory.html @@ -3,21 +3,31 @@
- -
- Net Worth -
-
- {{valueString netWorth}} + +
+
+ Net Worth +
+
+ {{valueString netWorth}} +
- -
- Weight Carried + +
+
+ Weight Carried +
+
+ {{round weightCarried}}lbs +
-
- {{round weightCarried}}lbs +
+ {{> carryCapacityBar}}
@@ -51,7 +61,7 @@
-
+
Carried
diff --git a/rpg-docs/client/views/character/inventory/inventory.js b/rpg-docs/client/views/character/inventory/inventory.js index cda5df98..3bf21f30 100644 --- a/rpg-docs/client/views/character/inventory/inventory.js +++ b/rpg-docs/client/views/character/inventory/inventory.js @@ -136,6 +136,14 @@ Template.inventory.events({ heroId: containerId, }); }, + "tap .weightCarried": function(event) { + var charId = this._id; + GlobalUI.setDetail({ + template: "carryDialog", + data: {charId: charId, color: "green"}, + heroId: charId + "weightCarried", + }); + }, "tap .inventoryItem": function(event){ var itemId = this._id; var charId = Template.parentData()._id; diff --git a/rpg-docs/client/views/character/stats/attributeDialog/strengthDialog/strengthDialog.html b/rpg-docs/client/views/character/stats/attributeDialog/strengthDialog/strengthDialog.html index af9c6d3e..5e22564f 100644 --- a/rpg-docs/client/views/character/stats/attributeDialog/strengthDialog/strengthDialog.html +++ b/rpg-docs/client/views/character/stats/attributeDialog/strengthDialog/strengthDialog.html @@ -4,32 +4,7 @@
Carrying
- - - - - - - - - - - - - - - - - - - - - -
Encumbered{{evaluate charId "strength * 5"}}lbsSpeed drops by 10 feet
Heavily encumbered{{evaluate charId "strength * 10"}}lbs - Speed drops by 20 feet, disadvantage on strength, - dexterity and constitution ability checks, attack - rolls and saving throws -
Maximum carrying capacity{{evaluate charId "strength * 15"}}lbsSpeed drops to 5 feet
Push, drag or lift maximum{{evaluate charId "strength * 30"}}lbsYou can't move more than this weight
+ {{> carryCapacityTable}}
Jumping
diff --git a/rpg-docs/client/views/character/stats/carryCapacityTable/carryCapacityTable.html b/rpg-docs/client/views/character/stats/carryCapacityTable/carryCapacityTable.html new file mode 100644 index 00000000..5e6313ca --- /dev/null +++ b/rpg-docs/client/views/character/stats/carryCapacityTable/carryCapacityTable.html @@ -0,0 +1,28 @@ + \ No newline at end of file