Added spell and spell list forms
This commit is contained in:
@@ -24,7 +24,6 @@ let SpellListSchema = schema({
|
|||||||
type: String,
|
type: String,
|
||||||
regEx: VARIABLE_NAME_REGEX,
|
regEx: VARIABLE_NAME_REGEX,
|
||||||
min: 3,
|
min: 3,
|
||||||
defaultValue: 'newAttribute',
|
|
||||||
},
|
},
|
||||||
description: {
|
description: {
|
||||||
type: String,
|
type: String,
|
||||||
@@ -72,3 +71,4 @@ const updateSpellList = new ValidatedMethod({
|
|||||||
});
|
});
|
||||||
|
|
||||||
export default SpellLists;
|
export default SpellLists;
|
||||||
|
export { SpellListSchema }
|
||||||
|
|||||||
@@ -12,14 +12,14 @@ import propagateInheritanceUpdateMixin from '/imports/api/creature/mixins/propag
|
|||||||
import updateSchemaMixin from '/imports/api/creature/mixins/updateSchemaMixin.js';
|
import updateSchemaMixin from '/imports/api/creature/mixins/updateSchemaMixin.js';
|
||||||
|
|
||||||
const magicSchools = [
|
const magicSchools = [
|
||||||
'Abjuration',
|
'abjuration',
|
||||||
'Conjuration',
|
'conjuration',
|
||||||
'Divination',
|
'divination',
|
||||||
'Enchantment',
|
'enchantment',
|
||||||
'Evocation',
|
'evocation',
|
||||||
'Illusion',
|
'illusion',
|
||||||
'Necromancy',
|
'necromancy',
|
||||||
'Transmutation',
|
'transmutation',
|
||||||
];
|
];
|
||||||
|
|
||||||
let Spells = new Mongo.Collection('spells');
|
let Spells = new Mongo.Collection('spells');
|
||||||
@@ -33,7 +33,7 @@ let SpellSchema = schema({
|
|||||||
// prepared in a spell list, and enabled should be true
|
// prepared in a spell list, and enabled should be true
|
||||||
alwaysPrepared: {
|
alwaysPrepared: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
defaultValue: false,
|
optional: true,
|
||||||
},
|
},
|
||||||
// Spell lists that this spell appears on
|
// Spell lists that this spell appears on
|
||||||
spellLists: {
|
spellLists: {
|
||||||
@@ -63,31 +63,33 @@ let SpellSchema = schema({
|
|||||||
},
|
},
|
||||||
verbal: {
|
verbal: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
defaultValue: false
|
optional: true,
|
||||||
},
|
},
|
||||||
somatic: {
|
somatic: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
defaultValue: false
|
optional: true,
|
||||||
},
|
},
|
||||||
concentration: {
|
concentration: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
defaultValue: false
|
optional: true,
|
||||||
},
|
},
|
||||||
material: {
|
material: {
|
||||||
type: String,
|
type: String,
|
||||||
optional: true
|
optional: true,
|
||||||
},
|
},
|
||||||
ritual: {
|
ritual: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
defaultValue: false,
|
optional: true,
|
||||||
},
|
},
|
||||||
level: {
|
level: {
|
||||||
type: SimpleSchema.Integer,
|
type: SimpleSchema.Integer,
|
||||||
defaultValue: 1,
|
defaultValue: 1,
|
||||||
|
max: 9,
|
||||||
|
min: 0,
|
||||||
},
|
},
|
||||||
school: {
|
school: {
|
||||||
type: String,
|
type: String,
|
||||||
defaultValue: 'Abjuration',
|
defaultValue: 'abjuration',
|
||||||
allowedValues: magicSchools,
|
allowedValues: magicSchools,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
199
app/imports/ui/forms/SpellForm.vue
Normal file
199
app/imports/ui/forms/SpellForm.vue
Normal file
@@ -0,0 +1,199 @@
|
|||||||
|
<template lang="html">
|
||||||
|
<div class="attribute-form">
|
||||||
|
<text-field
|
||||||
|
label="Name"
|
||||||
|
:value="model.name"
|
||||||
|
@change="(value, ack) => $emit('change', {path: ['name'], value, ack})"
|
||||||
|
:error-messages="errors.name"
|
||||||
|
:debounce-time="debounceTime"
|
||||||
|
/>
|
||||||
|
<div class="layout row wrap">
|
||||||
|
<smart-select
|
||||||
|
label="Level"
|
||||||
|
class="mx-1"
|
||||||
|
style="flex-basis: 300px;"
|
||||||
|
:items="spellLevels"
|
||||||
|
:value="model.level"
|
||||||
|
:error-messages="errors.level"
|
||||||
|
@change="(value, ack) => $emit('change', {path: ['level'], value, ack})"
|
||||||
|
:debounce-time="debounceTime"
|
||||||
|
/>
|
||||||
|
<smart-select
|
||||||
|
label="School"
|
||||||
|
class="mx-1"
|
||||||
|
style="flex-basis: 300px;"
|
||||||
|
:items="magicSchools"
|
||||||
|
:value="model.school"
|
||||||
|
:error-messages="errors.school"
|
||||||
|
@change="(value, ack) => $emit('change', {path: ['school'], value, ack})"
|
||||||
|
:debounce-time="debounceTime"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div class="layout row wrap">
|
||||||
|
<v-combobox
|
||||||
|
label="Spell lists"
|
||||||
|
multiple
|
||||||
|
chips
|
||||||
|
deletable-chips
|
||||||
|
box
|
||||||
|
:value="model.spellLists"
|
||||||
|
@change="(value) => $emit('change', {path: ['spellLists'], value})"
|
||||||
|
:error-messages="errors.spellLists"
|
||||||
|
/>
|
||||||
|
<v-switch
|
||||||
|
label="Always prepared"
|
||||||
|
style="width: 200px; flex-grow: 0;"
|
||||||
|
class="ml-2"
|
||||||
|
:value="model.alwaysPrepared"
|
||||||
|
:error-messages="errors.alwaysPrepared"
|
||||||
|
@change="e => $emit('change', {path: ['alwaysPrepared'], value: !!e})"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<text-field
|
||||||
|
label="Casting Time"
|
||||||
|
:value="model.castingTime"
|
||||||
|
@change="(value, ack) => $emit('change', {path: ['castingTime'], value, ack})"
|
||||||
|
:error-messages="errors.castingTime"
|
||||||
|
:debounce-time="debounceTime"
|
||||||
|
/>
|
||||||
|
<text-field
|
||||||
|
label="Range"
|
||||||
|
:value="model.range"
|
||||||
|
@change="(value, ack) => $emit('change', {path: ['range'], value, ack})"
|
||||||
|
:error-messages="errors.range"
|
||||||
|
:debounce-time="debounceTime"
|
||||||
|
/>
|
||||||
|
<div class="layout row wrap justify-space-between">
|
||||||
|
<v-checkbox
|
||||||
|
label="Verbal"
|
||||||
|
:value="model.verbal"
|
||||||
|
:error-messages="errors.verbal"
|
||||||
|
@change="(value) => $emit('change', {path: ['verbal'], value})"
|
||||||
|
/>
|
||||||
|
<v-checkbox
|
||||||
|
label="Somatic"
|
||||||
|
:value="model.somatic"
|
||||||
|
:error-messages="errors.somatic"
|
||||||
|
@change="(value) => $emit('change', {path: ['somatic'], value})"
|
||||||
|
/>
|
||||||
|
<v-checkbox
|
||||||
|
label="Concentration"
|
||||||
|
:value="model.concentration"
|
||||||
|
:error-messages="errors.concentration"
|
||||||
|
@change="(value) => $emit('change', {path: ['concentration'], value})"
|
||||||
|
/>
|
||||||
|
<v-checkbox
|
||||||
|
label="Ritual"
|
||||||
|
:value="model.ritual"
|
||||||
|
:error-messages="errors.ritual"
|
||||||
|
@change="(value) => $emit('change', {path: ['ritual'], value})"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<text-field
|
||||||
|
label="Material"
|
||||||
|
:value="model.material"
|
||||||
|
@change="(value, ack) => $emit('change', {path: ['material'], value, ack})"
|
||||||
|
:error-messages="errors.material"
|
||||||
|
:debounce-time="debounceTime"
|
||||||
|
/>
|
||||||
|
<text-field
|
||||||
|
label="Duration"
|
||||||
|
:value="model.duration"
|
||||||
|
@change="(value, ack) => $emit('change', {path: ['duration'], value, ack})"
|
||||||
|
:error-messages="errors.duration"
|
||||||
|
:debounce-time="debounceTime"
|
||||||
|
/>
|
||||||
|
<text-area
|
||||||
|
label="Description"
|
||||||
|
:value="model.description"
|
||||||
|
:error-messages="errors.description"
|
||||||
|
@change="(value, ack) => $emit('change', {path: ['description'], value, ack})"
|
||||||
|
:debounce-time="debounceTime"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
props: {
|
||||||
|
model: {
|
||||||
|
type: Object,
|
||||||
|
default: () => ({}),
|
||||||
|
},
|
||||||
|
errors: {
|
||||||
|
type: Object,
|
||||||
|
default: () => ({}),
|
||||||
|
},
|
||||||
|
debounceTime: Number,
|
||||||
|
},
|
||||||
|
data(){return {
|
||||||
|
magicSchools: [
|
||||||
|
{
|
||||||
|
text: 'Abjuration',
|
||||||
|
value: 'abjuration',
|
||||||
|
}, {
|
||||||
|
text: 'Conjuration',
|
||||||
|
value: 'conjuration',
|
||||||
|
}, {
|
||||||
|
text: 'Divination',
|
||||||
|
value: 'divination',
|
||||||
|
}, {
|
||||||
|
text: 'Enchantment',
|
||||||
|
value: 'enchantment',
|
||||||
|
}, {
|
||||||
|
text: 'Evocation',
|
||||||
|
value: 'evocation',
|
||||||
|
}, {
|
||||||
|
text: 'Illusion',
|
||||||
|
value: 'illusion',
|
||||||
|
}, {
|
||||||
|
text: 'Necromancy',
|
||||||
|
value: 'necromancy',
|
||||||
|
}, {
|
||||||
|
text: 'Transmutation',
|
||||||
|
value: 'transmutation',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
spellLevels: [
|
||||||
|
{
|
||||||
|
text: 'Cantrip',
|
||||||
|
value: 0,
|
||||||
|
}, {
|
||||||
|
text: 'Level 1',
|
||||||
|
value: 1,
|
||||||
|
}, {
|
||||||
|
text: 'Level 2',
|
||||||
|
value: 2,
|
||||||
|
}, {
|
||||||
|
text: 'Level 3',
|
||||||
|
value: 3,
|
||||||
|
}, {
|
||||||
|
text: 'Level 4',
|
||||||
|
value: 4,
|
||||||
|
}, {
|
||||||
|
text: 'Level 5',
|
||||||
|
value: 5,
|
||||||
|
}, {
|
||||||
|
text: 'Level 6',
|
||||||
|
value: 6,
|
||||||
|
}, {
|
||||||
|
text: 'Level 7',
|
||||||
|
value: 7,
|
||||||
|
}, {
|
||||||
|
text: 'Level 8',
|
||||||
|
value: 8,
|
||||||
|
}, {
|
||||||
|
text: 'Level 9',
|
||||||
|
value: 9,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="css" scoped>
|
||||||
|
.v-input--checkbox {
|
||||||
|
flex-grow: 0;
|
||||||
|
width: 200px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
56
app/imports/ui/forms/SpellListForm.vue
Normal file
56
app/imports/ui/forms/SpellListForm.vue
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
<template lang="html">
|
||||||
|
<div class="attribute-form">
|
||||||
|
<div class="layout row wrap">
|
||||||
|
<text-field
|
||||||
|
label="Name"
|
||||||
|
:value="model.name"
|
||||||
|
@change="(value, ack) => $emit('change', {path: ['name'], value, ack})"
|
||||||
|
:error-messages="errors.name"
|
||||||
|
:debounce-time="debounceTime"
|
||||||
|
/>
|
||||||
|
<text-field
|
||||||
|
label="Variable name"
|
||||||
|
:value="model.variableName"
|
||||||
|
style="flex-basis: 300px;"
|
||||||
|
@change="(value, ack) => $emit('change', {path: ['variableName'], value, ack})"
|
||||||
|
hint="Use this name in formulae to reference this attribute"
|
||||||
|
:error-messages="errors.variableName"
|
||||||
|
:debounce-time="debounceTime"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<text-area
|
||||||
|
label="Description"
|
||||||
|
:value="model.description"
|
||||||
|
:error-messages="errors.description"
|
||||||
|
@change="(value, ack) => $emit('change', {path: ['description'], value, ack})"
|
||||||
|
:debounce-time="debounceTime"
|
||||||
|
/>
|
||||||
|
<text-field
|
||||||
|
label="Maximum prepared spells"
|
||||||
|
:value="model.maxPrepared"
|
||||||
|
@change="(value, ack) => $emit('change', {path: ['maxPrepared'], value, ack})"
|
||||||
|
hint="How many spells can be prepared"
|
||||||
|
:error-messages="errors.maxPrepared"
|
||||||
|
:debounce-time="debounceTime"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
props: {
|
||||||
|
model: {
|
||||||
|
type: Object,
|
||||||
|
default: () => ({}),
|
||||||
|
},
|
||||||
|
errors: {
|
||||||
|
type: Object,
|
||||||
|
default: () => ({}),
|
||||||
|
},
|
||||||
|
debounceTime: Number,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="css" scoped>
|
||||||
|
</style>
|
||||||
@@ -11,6 +11,8 @@ import NoteForm from '/imports/ui/forms/NoteForm.vue';
|
|||||||
import ProficiencyForm from '/imports/ui/forms/ProficiencyForm.vue';
|
import ProficiencyForm from '/imports/ui/forms/ProficiencyForm.vue';
|
||||||
import RollForm from '/imports/ui/forms/RollForm.vue';
|
import RollForm from '/imports/ui/forms/RollForm.vue';
|
||||||
import SkillForm from '/imports/ui/forms/SkillForm.vue';
|
import SkillForm from '/imports/ui/forms/SkillForm.vue';
|
||||||
|
import SpellListForm from '/imports/ui/forms/SpellListForm.vue';
|
||||||
|
import SpellForm from '/imports/ui/forms/SpellForm.vue';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
action: ActionForm,
|
action: ActionForm,
|
||||||
@@ -26,4 +28,6 @@ export default {
|
|||||||
proficiency: ProficiencyForm,
|
proficiency: ProficiencyForm,
|
||||||
roll: RollForm,
|
roll: RollForm,
|
||||||
skill: SkillForm,
|
skill: SkillForm,
|
||||||
|
spellList: SpellListForm,
|
||||||
|
spell: SpellForm,
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user