Migrating character sheet to new data format
This commit is contained in:
@@ -27,22 +27,10 @@
|
||||
<v-content class="flex" v-if="$subReady.singleCharacter">
|
||||
<v-tabs-items v-model="tab">
|
||||
<v-tab-item>
|
||||
<!--<stats-tab/>-->
|
||||
<v-alert
|
||||
:value="true"
|
||||
type="info"
|
||||
>
|
||||
This tab is not available in this version of the alpha.
|
||||
</v-alert>
|
||||
<stats-tab/>
|
||||
</v-tab-item>
|
||||
<v-tab-item>
|
||||
<!--<features-tab/>-->
|
||||
<v-alert
|
||||
:value="true"
|
||||
type="info"
|
||||
>
|
||||
This tab is not available in this version of the alpha.
|
||||
</v-alert>
|
||||
<features-tab/>
|
||||
</v-tab-item>
|
||||
<v-tab-item>
|
||||
<tree-tab :creature-id="creatureId"/>
|
||||
@@ -60,9 +48,9 @@
|
||||
import isDarkColor from '/imports/ui/utility/isDarkColor.js';
|
||||
import { mapMutations } from "vuex";
|
||||
import { theme } from '/imports/ui/theme.js';
|
||||
import TreeTab from '/imports/ui/creature/character/TreeTab.vue';
|
||||
import StatsTab from '/imports/ui/creature/character/StatsTab.vue';
|
||||
import FeaturesTab from '/imports/ui/creature/character/FeaturesTab.vue';
|
||||
import TreeTab from '/imports/ui/creature/character/characterSheetTabs/TreeTab.vue';
|
||||
import StatsTab from '/imports/ui/creature/character/characterSheetTabs/StatsTab.vue';
|
||||
import FeaturesTab from '/imports/ui/creature/character/characterSheetTabs/FeaturesTab.vue';
|
||||
import { recomputeCreature } from '/imports/api/creature/creatureComputation.js'
|
||||
|
||||
export default {
|
||||
@@ -72,6 +60,8 @@
|
||||
},
|
||||
components: {
|
||||
TreeTab,
|
||||
StatsTab,
|
||||
FeaturesTab,
|
||||
},
|
||||
data(){return {
|
||||
theme,
|
||||
|
||||
@@ -138,8 +138,8 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Attributes from '/imports/api/properties/Attributes.js';
|
||||
import Skills from '/imports/api/properties/Skills.js';
|
||||
import CreatureProperties from '/imports/api/creature/CreatureProperties.js';
|
||||
|
||||
import AttributeCard from '/imports/ui/properties/attributes/AttributeCard.vue';
|
||||
import AbilityListTile from '/imports/ui/properties/attributes/AbilityListTile.vue';
|
||||
import ColumnLayout from '/imports/ui/components/ColumnLayout.vue';
|
||||
@@ -149,17 +149,24 @@
|
||||
import ResourceCard from '/imports/ui/properties/attributes/ResourceCard.vue';
|
||||
import SpellSlotListTile from '/imports/ui/properties/attributes/SpellSlotListTile.vue';
|
||||
|
||||
import { adjustAttribute, insertAttribute } from '/imports/api/properties/Attributes.js';
|
||||
let adjustAttribute = insertAttribute = () => console.error("this shit isn't defined");
|
||||
|
||||
const getAttributeOfType = function(charId, type){
|
||||
return Attributes.find({charId, type}, {sort: {order: 1}});
|
||||
return CreatureProperties.find({
|
||||
'ancestor.id': charId,
|
||||
type: 'attribute',
|
||||
attributeType: type,
|
||||
}, {
|
||||
sort: {order: 1}
|
||||
});
|
||||
};
|
||||
|
||||
const getNonZeroAttributeOfType = function(charId, type){
|
||||
return Attributes.find({
|
||||
charId,
|
||||
type,
|
||||
value: {$ne: 0},
|
||||
return CreatureProperties.find({
|
||||
'ancestor.id': charId,
|
||||
type: 'attribute',
|
||||
attributeType: type,
|
||||
value: {$ne: 0}
|
||||
}, {
|
||||
sort: {order: 1}
|
||||
});
|
||||
@@ -196,17 +203,19 @@
|
||||
return getNonZeroAttributeOfType(this.charId, 'spellSlot');
|
||||
},
|
||||
hitDice(){
|
||||
return Attributes.find({
|
||||
charId: this.charId,
|
||||
type: 'hitDice',
|
||||
return CreatureProperties.find({
|
||||
'ancestor.id': this.charId,
|
||||
type: 'attribute',
|
||||
attributeType: 'hitDice',
|
||||
value: {$ne: 0},
|
||||
}, {
|
||||
sort: {order: 1},
|
||||
}).map(hd => {
|
||||
let diceMatch = hd.variableName.match(/d(\d+)/);
|
||||
let dice = diceMatch && +diceMatch[1];
|
||||
let con = Attributes.findOne({
|
||||
charId: this.charId,
|
||||
let con = CreatureProperties.findOne({
|
||||
'ancestor.id': this.charId,
|
||||
type: 'attribute',
|
||||
variableName: 'constitution'
|
||||
});
|
||||
let conMod = con && con.mod;
|
||||
@@ -221,25 +230,28 @@
|
||||
});
|
||||
},
|
||||
checks(){
|
||||
return Skills.find({
|
||||
charId: this.charId,
|
||||
type: 'check',
|
||||
return CreatureProperties.find({
|
||||
'ancestor.id': this.charId,
|
||||
type: 'skill',
|
||||
skillType: 'check',
|
||||
}, {
|
||||
sort: {order: 1},
|
||||
});
|
||||
},
|
||||
savingThrows(){
|
||||
return Skills.find({
|
||||
charId: this.charId,
|
||||
type: 'save',
|
||||
return CreatureProperties.find({
|
||||
'ancestor.id': this.charId,
|
||||
type: 'skill',
|
||||
skillType: 'save',
|
||||
}, {
|
||||
sort: {order: 1},
|
||||
});
|
||||
},
|
||||
skills(){
|
||||
return Skills.find({
|
||||
charId: this.charId,
|
||||
return CreatureProperties.find({
|
||||
'ancestor.id': this.charId,
|
||||
type: 'skill',
|
||||
skillType: 'skill',
|
||||
}, {
|
||||
sort: {order: 1},
|
||||
});
|
||||
@@ -139,7 +139,7 @@
|
||||
editCreatureProperty(){
|
||||
let that = this;
|
||||
this.$store.commit('pushDialogStack', {
|
||||
component: 'library-node-edit-dialog',
|
||||
component: 'creature-property-dialog',
|
||||
elementId: 'selected-node-card',
|
||||
data: {_id: this.selected},
|
||||
});
|
||||
@@ -0,0 +1,11 @@
|
||||
<template lang="html">
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="css" scoped>
|
||||
</style>
|
||||
Reference in New Issue
Block a user