Replaced languages and proficiency strings with proper proficiencies
This commit is contained in:
@@ -13,7 +13,6 @@ Schemas.Character = new SimpleSchema({
|
||||
bonds: { type: String, defaultValue: "", trim: false},
|
||||
flaws: { type: String, defaultValue: "", trim: false},
|
||||
backstory: { type: String, defaultValue: "", trim: false},
|
||||
languages: { type: String, defaultValue: "", trim: false},
|
||||
|
||||
//attributes
|
||||
//ability scores
|
||||
@@ -269,7 +268,7 @@ Characters.helpers({
|
||||
var ability = this.attributeValue(skill.ability);
|
||||
|
||||
//base modifier
|
||||
var mod = +getMod(ability)
|
||||
var mod = +getMod(ability);
|
||||
|
||||
//multiply proficiency bonus by largest value in proficiency array
|
||||
var prof = this.proficiency(skillName);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
Template.registerHelper("colorClass", function(color){
|
||||
return color? getColorClass(color) : getColorClass(this.color);
|
||||
if(color) return getColorClass(color);
|
||||
else if(this.color) return getColorClass(this.color);
|
||||
});
|
||||
|
||||
Template.registerHelper("hexColor", function(color){
|
||||
|
||||
@@ -1,6 +1,14 @@
|
||||
Template.effectsEditList.helpers({
|
||||
effects: function(){
|
||||
var cursor = Effects.find({"parent.id": this.parentId, "parent.collection": this.parentCollection});
|
||||
var selector = {
|
||||
"parent.id": this.parentId,
|
||||
"parent.collection": this.parentCollection,
|
||||
"charId": this.charId
|
||||
};
|
||||
if(this.parentGroup){
|
||||
selector["parent.group"] = this.parentGroup;
|
||||
}
|
||||
var cursor = Effects.find(selector);
|
||||
return cursor;
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
Template.effectsViewList.helpers({
|
||||
effects: function(){
|
||||
return Effects.find({"parent.id": this.parentId, charId: this.charId}, {fields: {parent: 0}});
|
||||
var selector = {
|
||||
"parent.id": this.parentId,
|
||||
"charId": this.charId
|
||||
};
|
||||
if(this.parentGroup){
|
||||
selector["parent.group"] = this.parentGroup;
|
||||
}
|
||||
return Effects.find(selector, {fields: {parent: 0}});
|
||||
}
|
||||
});
|
||||
|
||||
@@ -48,19 +48,36 @@
|
||||
{{/each}}
|
||||
</div>
|
||||
</paper-shadow>
|
||||
|
||||
|
||||
<!--Proficiencies-->
|
||||
<paper-shadow class="card container" hero-id="main" {{detailHero "proficiencies"}}>
|
||||
<div id="proficiencies"
|
||||
class="whiteTop"
|
||||
hero-id="toolbar"
|
||||
layout horizontal center
|
||||
{{detailHero "proficiencies"}}>
|
||||
<div id="proficiencies"
|
||||
class="whiteTop"
|
||||
layout horizontal center>
|
||||
<div class="containerName subhead">Proficiencies</div>
|
||||
</div>
|
||||
<div flex class="containerMain padded preline">{{characterProficiencies}}</div>
|
||||
<div flex class="containerMain listPadded">
|
||||
{{#if weaponProfs.count}}
|
||||
<div class="list-subhead" layout horizontal center>Weapons</div>
|
||||
{{/if}}
|
||||
{{#each weaponProfs}}
|
||||
{{> proficiencyListItem}}
|
||||
{{/each}}
|
||||
{{#if armorProfs.count}}
|
||||
<div class="list-subhead" layout horizontal center>Armor</div>
|
||||
{{/if}}
|
||||
{{#each armorProfs}}
|
||||
{{> proficiencyListItem}}
|
||||
{{/each}}
|
||||
{{#if toolProfs.count}}
|
||||
<div class="list-subhead" layout horizontal center>Tools</div>
|
||||
{{/if}}
|
||||
{{#each toolProfs}}
|
||||
{{> proficiencyListItem}}
|
||||
{{/each}}
|
||||
</div>
|
||||
</paper-shadow>
|
||||
|
||||
|
||||
<!--features-->
|
||||
{{#each features}}
|
||||
<paper-shadow class="card container featureCard" hero-id="main" {{detailHero}}>
|
||||
|
||||
@@ -13,7 +13,7 @@ Template.features.helpers({
|
||||
return this.usesLeft() >= this.usesValue();
|
||||
},
|
||||
colorClass: function(){
|
||||
return getColorClass(this.color)
|
||||
return getColorClass(this.color);
|
||||
},
|
||||
featureOrder: function(){
|
||||
return _.indexOf(_.keys(colorOptions), this.color);
|
||||
@@ -21,13 +21,18 @@ Template.features.helpers({
|
||||
attacks: function(){
|
||||
return Attacks.find({charId: this._id, enabled: true}, {sort: {color: 1, name: 1}});
|
||||
},
|
||||
characterProficiencies: function(){
|
||||
var char = Characters.findOne(this._id);
|
||||
return char && char.proficiencies;
|
||||
},
|
||||
canEnable: function(){
|
||||
return !this.alwaysEnabled;
|
||||
}
|
||||
},
|
||||
weaponProfs: function(){
|
||||
return Proficiencies.find({charId: this._id, type: "weapon"});
|
||||
},
|
||||
armorProfs: function(){
|
||||
return Proficiencies.find({charId: this._id, type: "armor"});
|
||||
},
|
||||
toolProfs: function(){
|
||||
return Proficiencies.find({charId: this._id, type: "tool"});
|
||||
},
|
||||
});
|
||||
|
||||
Template.features.events({
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<paper-input id="levelValueInput" label="Level" floatinglabel value={{level}}></paper-input>
|
||||
<!--Effects-->
|
||||
{{> effectsEditList parentId=_id parentCollection="Classes" charId=charId}}
|
||||
{{> proficiencyEditList parentId=_id parentCollection="Characters" charId=charId}}
|
||||
{{> proficiencyEditList parentId=_id parentCollection="Classes" charId=charId}}
|
||||
{{/baseDialog}}
|
||||
{{/with}}
|
||||
</template>
|
||||
@@ -1,7 +1,7 @@
|
||||
<template name="raceDialog">
|
||||
{{#baseDialog title="Race" class=colorClass hideColor="true" hideDelete="true"}}
|
||||
<paper-input id="raceInput" label="Race" floatinglabel value={{race}}></paper-input>
|
||||
{{> effectsEditList parentId=charId parentCollection="Characters" charId=charId}}
|
||||
{{> proficiencyEditList parentId=charId parentCollection="Characters" charId=charId}}
|
||||
{{> effectsEditList parentId=charId parentCollection="Characters" charId=charId parentGroup="racial"}}
|
||||
{{> proficiencyEditList parentId=charId parentCollection="Characters" charId=charId parentGroup="racial"}}
|
||||
{{/baseDialog}}
|
||||
</template>
|
||||
@@ -1,3 +0,0 @@
|
||||
#persona .containerMain{
|
||||
white-space: pre-line;
|
||||
}
|
||||
@@ -11,7 +11,16 @@
|
||||
{{> containerCard characterField "bonds" "Bonds"}}
|
||||
{{> containerCard characterField "flaws" "Flaws"}}
|
||||
{{> containerCard characterField "backstory" "Background"}}
|
||||
{{> containerCard characterField "languages" "Languages"}}
|
||||
<paper-shadow class="card container">
|
||||
<div class="containerTop whiteTop" layout horizontal center>
|
||||
<div class="containerName subhead" flex>Languages</div>
|
||||
</div>
|
||||
<div flex class="containerMain">
|
||||
{{#each languages}}
|
||||
{{> proficiencyListItem}}
|
||||
{{/each}}
|
||||
</div>
|
||||
</paper-shadow>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -23,9 +32,9 @@
|
||||
|
||||
<template name="containerCardHelper">
|
||||
<paper-shadow class="card container {{class}}" hero-id="main" {{detailHero field ../_id}}>
|
||||
<div class="containerTop {{colorClass}}" hero-id="toolbar" layout horizontal center {{detailHero field ../_id}}>
|
||||
<div class="containerTop {{colorClass}} {{topClass}}" hero-id="toolbar" layout horizontal center {{detailHero field ../_id}}>
|
||||
<div class="containerName subhead" hero-id="title" flex {{detailHero field ../_id}}>{{title}}</div>
|
||||
</div>
|
||||
<div flex class="containerMain">{{> UI.contentBlock}}</div>
|
||||
<div flex class="containerMain prewrap">{{> UI.contentBlock}}</div>
|
||||
</paper-shadow>
|
||||
</template>
|
||||
@@ -4,13 +4,12 @@ var colorMap = {
|
||||
ideals: "g",
|
||||
bonds: "h",
|
||||
flaws: "i",
|
||||
backstory: "j",
|
||||
languages: "k"
|
||||
}
|
||||
backstory: "j"
|
||||
};
|
||||
|
||||
Template.persona.helpers({
|
||||
characterDetails: function(){
|
||||
var char = Characters.findOne(this._id, {fields: {name: 1, gender: 1, alignment: 1, race:1}})
|
||||
var char = Characters.findOne(this._id, {fields: {name: 1, gender: 1, alignment: 1, race:1}});
|
||||
char.field = "details";
|
||||
char.title = char.name;
|
||||
char.color = "d";
|
||||
@@ -21,12 +20,22 @@ Template.persona.helpers({
|
||||
fieldSelector.fields[field] = 1;
|
||||
var char = Characters.findOne(this._id, fieldSelector);
|
||||
var color = colorMap[field];
|
||||
return {_id: char._id, title: title, field: field, color: color, body: char[field]};
|
||||
}
|
||||
return {
|
||||
_id: char._id,
|
||||
title: title,
|
||||
field: field,
|
||||
color: color,
|
||||
body: char[field],
|
||||
topClass: "characterField"
|
||||
};
|
||||
},
|
||||
languages: function(){
|
||||
return Proficiencies.find({charId: this._id, type: "language"});
|
||||
},
|
||||
});
|
||||
|
||||
Template.persona.events({
|
||||
"tap .containerTop": function(event){
|
||||
"tap .characterField": function(event){
|
||||
if(this.field !== "details"){
|
||||
var charId = Template.parentData()._id;
|
||||
GlobalUI.setDetail({
|
||||
@@ -41,6 +50,6 @@ Template.persona.events({
|
||||
data: this,
|
||||
heroId: this._id + "details"
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -19,6 +19,9 @@
|
||||
</core-menu>
|
||||
</paper-dropdown>
|
||||
</paper-dropdown-menu>
|
||||
<paper-icon-button class="deleteProficiency"
|
||||
icon="delete">
|
||||
</paper-icon-button>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -34,8 +37,8 @@
|
||||
</paper-dropdown-menu>
|
||||
</template>
|
||||
|
||||
<template name="nameInput sideMargin">
|
||||
<paper-input class="nameInput"
|
||||
<template name="nameInput">
|
||||
<paper-input class="nameInput sideMargin"
|
||||
label="Name"
|
||||
floatinglabel
|
||||
value={{name}}
|
||||
|
||||
@@ -51,6 +51,10 @@ Template.proficiencyEdit.helpers({
|
||||
});
|
||||
|
||||
Template.proficiencyEdit.events({
|
||||
"tap .deleteProficiency": function(event){
|
||||
Proficiencies.softRemoveNode(this._id);
|
||||
GlobalUI.deletedToast(this._id, "Proficiencies", "Proficiency");
|
||||
},
|
||||
"core-select .typeDropDown": function(event){
|
||||
var detail = event.originalEvent.detail;
|
||||
if(!detail.isSelected) return;
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
<template name="proficiencyListItem">
|
||||
<div class="itemSlot">
|
||||
<paper-item noink class="white" hero-id="main" {{detailHero}}>
|
||||
<core-icon icon="{{profIcon}}"></core-icon>
|
||||
<div class="sideMargin">{{getName}}</div>
|
||||
</paper-item>
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,14 @@
|
||||
Template.proficiencyListItem.helpers({
|
||||
profIcon: function(){
|
||||
var prof = this.value;
|
||||
if(prof > 0 && prof < 1) return "image:brightness-2";
|
||||
if(prof === 1) return "image:brightness-1";
|
||||
if(prof > 1) return "av:album";
|
||||
return "radio-button-off";
|
||||
},
|
||||
getName: function(){
|
||||
if(this.type === "skill") return skills[this.name];
|
||||
if(this.type === "save") return saves[this.name];
|
||||
return this.name;
|
||||
}
|
||||
});
|
||||
@@ -2,6 +2,7 @@ var childSchema = new SimpleSchema({
|
||||
parent: { type: Object },
|
||||
'parent.collection': { type: String },
|
||||
'parent.id': { type: String, regEx: SimpleSchema.RegEx.Id },
|
||||
'parent.group': { type: String, optional: true},
|
||||
'removedWith': { optional: true, type: String, regEx: SimpleSchema.RegEx.Id },
|
||||
});
|
||||
|
||||
|
||||
@@ -1,31 +1,37 @@
|
||||
Migrations.add({
|
||||
version: 1,
|
||||
name: "converts effect proficiencies to proficiency objects, removes types from assets",
|
||||
up: function() {
|
||||
return;
|
||||
}
|
||||
});
|
||||
|
||||
Migrations.add({
|
||||
version: 2,
|
||||
name: "converts effect proficiencies to proficiency objects",
|
||||
up: function() {
|
||||
//convert proficiency effects to proficiency objects
|
||||
Effects.find({operation: "proficiency"}).forEach(function(effect){
|
||||
var type;
|
||||
if(_.contains(SKILLS, effect.stat)) type = "skill";
|
||||
var type = "skill";
|
||||
if(_.contains(SAVES, effect.stat)) type = "save";
|
||||
if(!type) throw "stat not a skill or a save";
|
||||
Proficiencies.insert({
|
||||
charId: effect.charId,
|
||||
name: effect.stat,
|
||||
value: effect.value,
|
||||
parent: effect.parent,
|
||||
parent: _.clone(effect.parent),
|
||||
type: type,
|
||||
enabled: effect.enabled
|
||||
}, function(err){
|
||||
if(!err) Effects.remove(effect._id);
|
||||
});
|
||||
Effects.remove(effect._id);
|
||||
});
|
||||
//store type as a parent group if it's needed
|
||||
Effects.find({"parent.collection": "Characters"}).forEach(function(e){
|
||||
Effects.update(e._id, {$set: {"parent.group": e.type}});
|
||||
});
|
||||
Attacks.find({"parent.collection": "Characters"}).forEach(function(a){
|
||||
Attacks.update(a._id, {$set: {"parent.group": a.type}});
|
||||
});
|
||||
//remove type
|
||||
Effects.update({}, {$unset: {type: ""}}, {validate: false, multi: true});
|
||||
Attacks.update({}, {$unset: {type: ""}}, {validate: false, multi: true});
|
||||
//remove languages and proficiencies
|
||||
Characters.update(
|
||||
{},
|
||||
{$unset: {languages: "", proficiencies: ""}},
|
||||
{validate: false, multi: true}
|
||||
);
|
||||
},
|
||||
down: function(){
|
||||
return;
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user