Moved views out of private folder
This commit is contained in:
35
rpg-docs/client/views/character/stats/hitDice/hitDice.html
Normal file
35
rpg-docs/client/views/character/stats/hitDice/hitDice.html
Normal file
@@ -0,0 +1,35 @@
|
||||
<template name="hitDice">
|
||||
{{#if characterCalculate "attributeBase" ../_id name}}
|
||||
<div>
|
||||
<paper-material class="card hit-dice" hero-id="main"
|
||||
{{detailHero name ../_id}}
|
||||
layout horizontal>
|
||||
<div class="left green display1 white-text"
|
||||
hero-id="toolbar" {{detailHero name ../_id}}
|
||||
layout horizontal>
|
||||
<div>
|
||||
<paper-icon-button class="resourceUp"
|
||||
icon="arrow-drop-up"
|
||||
disabled={{cantIncrement}}>
|
||||
</paper-icon-button>
|
||||
<paper-icon-button class="resourceDown"
|
||||
icon="arrow-drop-down"
|
||||
disabled={{cantDecrement}}>
|
||||
</paper-icon-button>
|
||||
</div>
|
||||
<div class="resourceValue" layout vertical center>
|
||||
<div>
|
||||
{{characterCalculate "attributeValue" ../_id name}}
|
||||
</div>
|
||||
<div class="title white-text">
|
||||
d{{diceNum}} {{conMod}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="right clickable" flex relative horizontal layout center>
|
||||
Hit Dice
|
||||
</div>
|
||||
</paper-material>
|
||||
</div>
|
||||
{{/if}}
|
||||
</template>
|
||||
50
rpg-docs/client/views/character/stats/hitDice/hitDice.js
Normal file
50
rpg-docs/client/views/character/stats/hitDice/hitDice.js
Normal file
@@ -0,0 +1,50 @@
|
||||
Template.hitDice.helpers({
|
||||
cantIncrement: function(){
|
||||
var value = Characters.calculate.attributeValue(this.char._id, this.name);
|
||||
var base = Characters.calculate.attributeBase(this.char._id, this.name);
|
||||
return value >= base || !canEditCharacter(this.char._id);
|
||||
},
|
||||
cantDecrement: function(){
|
||||
var value = Characters.calculate.attributeValue(this.char._id, this.name);
|
||||
return value <= 0 || !canEditCharacter(this.char._id);
|
||||
},
|
||||
conMod: function(){
|
||||
return signedString(
|
||||
Characters.calculate.abilityMod(this.char._id, "constitution")
|
||||
);
|
||||
},
|
||||
});
|
||||
|
||||
Template.hitDice.events({
|
||||
"tap .resourceUp": function(event){
|
||||
var value = Characters.calculate.attributeValue(this.char._id, this.name);
|
||||
var base = Characters.calculate.attributeBase(this.char._id, this.name);
|
||||
if (value < base){
|
||||
var modifier = {$inc: {}};
|
||||
modifier.$inc[this.name + ".adjustment"] = 1;
|
||||
Characters.update(this.char._id, modifier, {validate: false});
|
||||
}
|
||||
},
|
||||
"tap .resourceDown": function(event){
|
||||
var value = Characters.calculate.attributeValue(this.char._id, this.name);
|
||||
if (value > 0){
|
||||
var modifier = {$inc: {}};
|
||||
modifier.$inc[this.name + ".adjustment"] = -1;
|
||||
Characters.update(this.char._id, modifier, {validate: false});
|
||||
}
|
||||
},
|
||||
"tap .right": function() {
|
||||
var charId = Template.parentData()._id;
|
||||
var title = "d" + this.diceNum + " Hit Dice";
|
||||
GlobalUI.setDetail({
|
||||
template: "attributeDialog",
|
||||
data: {
|
||||
name: title,
|
||||
statName: this.name,
|
||||
charId: charId,
|
||||
color: "green",
|
||||
},
|
||||
heroId: charId + this.name,
|
||||
});
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user