added simplistic resources view
This commit is contained in:
22
rpg-docs/client/views/character/resources/resources.html
Normal file
22
rpg-docs/client/views/character/resources/resources.html
Normal file
@@ -0,0 +1,22 @@
|
||||
<template name="resources">
|
||||
<div>
|
||||
{{#if hasSlots}}
|
||||
{{slotSummary}}
|
||||
{{/if}}
|
||||
</div>
|
||||
<div>
|
||||
{{#if hasKi}}
|
||||
{{attributeValue attributes.ki}}
|
||||
{{/if}}
|
||||
</div>
|
||||
<div>
|
||||
{{#if hasSorceryPoints}}
|
||||
{{attributeValue attributes.sorceryPoints}}
|
||||
{{/if}}
|
||||
</div>
|
||||
<div>
|
||||
{{#if hasRages}}
|
||||
{{attributeValue attributes.rages}}
|
||||
{{/if}}
|
||||
</div>
|
||||
</template>
|
||||
36
rpg-docs/client/views/character/resources/resources.js
Normal file
36
rpg-docs/client/views/character/resources/resources.js
Normal file
@@ -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;
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user