Added spell and spell list forms
This commit is contained in:
@@ -24,7 +24,6 @@ let SpellListSchema = schema({
|
||||
type: String,
|
||||
regEx: VARIABLE_NAME_REGEX,
|
||||
min: 3,
|
||||
defaultValue: 'newAttribute',
|
||||
},
|
||||
description: {
|
||||
type: String,
|
||||
@@ -72,3 +71,4 @@ const updateSpellList = new ValidatedMethod({
|
||||
});
|
||||
|
||||
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';
|
||||
|
||||
const magicSchools = [
|
||||
'Abjuration',
|
||||
'Conjuration',
|
||||
'Divination',
|
||||
'Enchantment',
|
||||
'Evocation',
|
||||
'Illusion',
|
||||
'Necromancy',
|
||||
'Transmutation',
|
||||
'abjuration',
|
||||
'conjuration',
|
||||
'divination',
|
||||
'enchantment',
|
||||
'evocation',
|
||||
'illusion',
|
||||
'necromancy',
|
||||
'transmutation',
|
||||
];
|
||||
|
||||
let Spells = new Mongo.Collection('spells');
|
||||
@@ -33,7 +33,7 @@ let SpellSchema = schema({
|
||||
// prepared in a spell list, and enabled should be true
|
||||
alwaysPrepared: {
|
||||
type: Boolean,
|
||||
defaultValue: false,
|
||||
optional: true,
|
||||
},
|
||||
// Spell lists that this spell appears on
|
||||
spellLists: {
|
||||
@@ -63,31 +63,33 @@ let SpellSchema = schema({
|
||||
},
|
||||
verbal: {
|
||||
type: Boolean,
|
||||
defaultValue: false
|
||||
optional: true,
|
||||
},
|
||||
somatic: {
|
||||
type: Boolean,
|
||||
defaultValue: false
|
||||
optional: true,
|
||||
},
|
||||
concentration: {
|
||||
type: Boolean,
|
||||
defaultValue: false
|
||||
optional: true,
|
||||
},
|
||||
material: {
|
||||
type: String,
|
||||
optional: true
|
||||
optional: true,
|
||||
},
|
||||
ritual: {
|
||||
type: Boolean,
|
||||
defaultValue: false,
|
||||
optional: true,
|
||||
},
|
||||
level: {
|
||||
type: SimpleSchema.Integer,
|
||||
defaultValue: 1,
|
||||
max: 9,
|
||||
min: 0,
|
||||
},
|
||||
school: {
|
||||
type: String,
|
||||
defaultValue: 'Abjuration',
|
||||
defaultValue: 'abjuration',
|
||||
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 RollForm from '/imports/ui/forms/RollForm.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 {
|
||||
action: ActionForm,
|
||||
@@ -26,4 +28,6 @@ export default {
|
||||
proficiency: ProficiencyForm,
|
||||
roll: RollForm,
|
||||
skill: SkillForm,
|
||||
spellList: SpellListForm,
|
||||
spell: SpellForm,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user