diff --git a/app/imports/api/creature/Creatures.js b/app/imports/api/creature/Creatures.js index 6aba8479..c8154b84 100644 --- a/app/imports/api/creature/Creatures.js +++ b/app/imports/api/creature/Creatures.js @@ -4,6 +4,7 @@ import SimpleSchema from 'simpl-schema'; import deathSaveSchema from '/imports/api/properties/subSchemas/DeathSavesSchema.js' import ColorSchema from '/imports/api/properties/subSchemas/ColorSchema.js'; import SharingSchema from '/imports/api/sharing/SharingSchema.js'; +import CreatureProperties from '/imports/api/creature/CreatureProperties.js'; import {assertEditPermission} from '/imports/api/sharing/sharingPermissions.js'; import { assertUserHasPaidBenefits } from '/imports/api/users/patreon/tiers.js'; @@ -160,11 +161,25 @@ const insertCreature = new ValidatedMethod({ assertUserHasPaidBenefits(this.userId); // Create the creature document - let charId = Creatures.insert({ + let creatureId = Creatures.insert({ owner: this.userId, }); + CreatureProperties.insert({ + slotTags: ['base'], + quantityExpected: 1, + type: 'propertySlot', + name: 'Base', + description: 'Choose a starting point for your character, this will define the basic setup of your character sheet. Without a base, your sheet will be empty.', + hideWhenFull: true, + parent: {collection: 'creatures', id: creatureId}, + ancestors: [{collection: 'creatures', id: creatureId}], + order: 0, + tags: [], + spaceLeft: 1, + totalFilled: 0, + }); this.unblock(); - return charId; + return creatureId; }, }); diff --git a/app/imports/ui/creature/character/CharacterSheet.vue b/app/imports/ui/creature/character/CharacterSheet.vue index b73f5e5e..a4d3ccae 100644 --- a/app/imports/ui/creature/character/CharacterSheet.vue +++ b/app/imports/ui/creature/character/CharacterSheet.vue @@ -35,7 +35,11 @@ class="fill-height" > @@ -87,10 +91,6 @@ creatureId: { type: String, required: true, - }, - tabs: { - type: Number, - required: true, }, }, reactiveProvide: { diff --git a/app/imports/ui/creature/character/CharacterSheetToolbar.vue b/app/imports/ui/creature/character/CharacterSheetToolbar.vue index b70ca7bc..b6930548 100644 --- a/app/imports/ui/creature/character/CharacterSheetToolbar.vue +++ b/app/imports/ui/creature/character/CharacterSheetToolbar.vue @@ -78,11 +78,14 @@ Stats @@ -118,12 +121,6 @@ import { updateUserSharePermissions } from '/imports/api/sharing/sharing.js'; import isDarkColor from '/imports/ui/utility/isDarkColor.js'; export default { - props: { - value: { - type: Number, - required: true, - }, - }, data(){return { theme, }}, diff --git a/app/imports/ui/creature/character/CharacterSheetToolbarExtension.vue b/app/imports/ui/creature/character/CharacterSheetToolbarExtension.vue deleted file mode 100644 index 497de341..00000000 --- a/app/imports/ui/creature/character/CharacterSheetToolbarExtension.vue +++ /dev/null @@ -1,55 +0,0 @@ - - - - - diff --git a/app/imports/ui/creature/character/CharacterSheetToolbarItems.vue b/app/imports/ui/creature/character/CharacterSheetToolbarItems.vue deleted file mode 100644 index 95e3ffc0..00000000 --- a/app/imports/ui/creature/character/CharacterSheetToolbarItems.vue +++ /dev/null @@ -1,159 +0,0 @@ - - - - - diff --git a/app/imports/ui/creature/character/characterSheetTabs/CharacterTab.vue b/app/imports/ui/creature/character/characterSheetTabs/CharacterTab.vue index 0bef673f..f45d8cb1 100644 --- a/app/imports/ui/creature/character/characterSheetTabs/CharacterTab.vue +++ b/app/imports/ui/creature/character/characterSheetTabs/CharacterTab.vue @@ -119,38 +119,18 @@ import Slots from '/imports/ui/creature/slots/Slots.vue'; import ToolbarCard from '/imports/ui/components/ToolbarCard.vue'; export default { - components: { - ColumnLayout, - NoteCard, + components: { + ColumnLayout, + NoteCard, Slots, ToolbarCard, - }, - props: { - creatureId: { + }, + props: { + creatureId: { type: String, required: true, }, - }, - meteor: { - notes(){ - return CreatureProperties.find({ - 'ancestors.id': this.creatureId, - type: 'note', - removed: {$ne: true}, - }, { - sort: {order: 1}, - }); - }, - creature(){ - return Creatures.findOne(this.creatureId); - }, - classLevels(){ - return getActiveProperties({ - ancestorId: this.creatureId, - filter: {type: 'classLevel'}, - }); - }, - }, + }, computed: { highestClassLevels(){ let highestLevels = {}; @@ -171,48 +151,74 @@ export default { return highestLevelsList; }, }, - methods: { - showCharacterForm(){ - this.$store.commit('pushDialogStack', { - component: 'creature-form-dialog', - elementId: 'creature-summary', - data: { - _id: this.creatureId, - }, - }); - }, + mounted(){ + if (this.$store.state.showBuildDialog){ + this.$store.commit('setShowBuildDialog', false); + this.showSlotDialog(); + } + }, + meteor: { + notes(){ + return CreatureProperties.find({ + 'ancestors.id': this.creatureId, + type: 'note', + removed: {$ne: true}, + }, { + sort: {order: 1}, + }); + }, + creature(){ + return Creatures.findOne(this.creatureId); + }, + classLevels(){ + return getActiveProperties({ + ancestorId: this.creatureId, + filter: {type: 'classLevel'}, + }); + }, + }, + methods: { + showCharacterForm(){ + this.$store.commit('pushDialogStack', { + component: 'creature-form-dialog', + elementId: 'creature-summary', + data: { + _id: this.creatureId, + }, + }); + }, addExperience(){ this.$store.commit('pushDialogStack', { - component: 'experience-insert-dialog', - elementId: 'experience-add-button', - data: { - creatureIds: [this.creatureId], + component: 'experience-insert-dialog', + elementId: 'experience-add-button', + data: { + creatureIds: [this.creatureId], startAsMilestone: this.creature.variables.milestoneLevels && !!this.creature.variables.milestoneLevels.value, - }, - }); + }, + }); }, showExperienceList(){ this.$store.commit('pushDialogStack', { - component: 'experience-list-dialog', - elementId: 'experience-info-button', - data: { - creatureId: this.creatureId, + component: 'experience-list-dialog', + elementId: 'experience-info-button', + data: { + creatureId: this.creatureId, startAsMilestone: this.creature.variables.milestoneLevels && !!this.creature.variables.milestoneLevels.value, - }, - }); + }, + }); }, showSlotDialog(){ this.$store.commit('pushDialogStack', { - component: 'slot-details-dialog', - elementId: 'slot-card', - data: { - creatureId: this.creatureId, - }, - }); + component: 'slot-details-dialog', + elementId: 'slot-card', + data: { + creatureId: this.creatureId, + }, + }); }, - }, + }, }; diff --git a/app/imports/ui/creature/slots/Slots.vue b/app/imports/ui/creature/slots/Slots.vue index bf3b98ed..49816719 100644 --- a/app/imports/ui/creature/slots/Slots.vue +++ b/app/imports/ui/creature/slots/Slots.vue @@ -41,6 +41,7 @@ v-if="!slot.quantityExpected || slot.spaceLeft" icon :data-id="`slot-add-button-${slot._id}`" + class="slot-add-button" style="background-color: inherit;" @click="fillSlot(slot)" > diff --git a/app/imports/ui/layouts/AppLayout.vue b/app/imports/ui/layouts/AppLayout.vue index 3bcf8676..7483d81e 100644 --- a/app/imports/ui/layouts/AppLayout.vue +++ b/app/imports/ui/layouts/AppLayout.vue @@ -10,7 +10,6 @@ @@ -60,7 +58,7 @@ - + @@ -12,21 +11,5 @@ export default { components: { CharacterSheet, }, - props: { - tabs: { - type: Number, - required: true, - }, - }, - computed: { - activeTab: { - get(){ - return this.tabs; - }, - set(newTab){ - this.$emit('update:tabs', newTab); - }, - }, - }, } diff --git a/app/imports/ui/vuexStore.js b/app/imports/ui/vuexStore.js index 605832fb..92f4a915 100644 --- a/app/imports/ui/vuexStore.js +++ b/app/imports/ui/vuexStore.js @@ -14,6 +14,8 @@ const store = new Vuex.Store({ drawer: undefined, rightDrawer: undefined, pageTitle: undefined, + characterSheetTabs: {}, + showBuildDialog: false, }, mutations: { toggleDrawer (state) { @@ -32,6 +34,12 @@ const store = new Vuex.Store({ state.pageTitle = value; document.title = value; }, + setTabForCharacterSheet(state, {tab, id}){ + Vue.set(state.characterSheetTabs, id, tab); + }, + setShowBuildDialog(state, value){ + state.showBuildDialog = value; + }, }, });