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