From b4d92e799a91072f9893faf4b8c5e0db436d35b5 Mon Sep 17 00:00:00 2001 From: Thaum Date: Wed, 19 Nov 2014 09:51:37 +0000 Subject: [PATCH] added simplistic resources view --- .../views/character/resources/resources.html | 22 ++++++++++++ .../views/character/resources/resources.js | 36 +++++++++++++++++++ 2 files changed, 58 insertions(+) create mode 100644 rpg-docs/client/views/character/resources/resources.html create mode 100644 rpg-docs/client/views/character/resources/resources.js diff --git a/rpg-docs/client/views/character/resources/resources.html b/rpg-docs/client/views/character/resources/resources.html new file mode 100644 index 00000000..73af72b5 --- /dev/null +++ b/rpg-docs/client/views/character/resources/resources.html @@ -0,0 +1,22 @@ + \ No newline at end of file diff --git a/rpg-docs/client/views/character/resources/resources.js b/rpg-docs/client/views/character/resources/resources.js new file mode 100644 index 00000000..b6c5dd9e --- /dev/null +++ b/rpg-docs/client/views/character/resources/resources.js @@ -0,0 +1,36 @@ +Template.resources.helpers({ + hasSlots: function(){ + var slots = 0; + for(var i = 1; i < 9; i++){ + var attribute = this.attributes["level"+i+"SpellSlots"] + if(attribute.base != 0) return true; + if(attribute.add.length != 0) return true; + } + }, + hasKi: function(){ + var slots = 0; + var attribute = this.attributes.ki; + if(attribute.base != 0) return true; + if(attribute.add.length != 0) return true; + }, + hasSorceryPoints: function(){ + var slots = 0; + var attribute = this.attributes.sorceryPoints; + if(attribute.base != 0) return true; + if(attribute.add.length != 0) return true; + }, + hasRages: function(){ + var slots = 0; + var attribute = this.attributes.rages; + if(attribute.base != 0) return true; + if(attribute.add.length != 0) return true; + }, + slotSummary: function(){ + var slots = ""; + for(var i = 1; i < 9; i++){ + if (i > 0) slots += " " + slots += this.attributeValue(this.attributes["level"+i+"SpellSlots"]); + } + return slots; + } +}); \ No newline at end of file