From 9b652fc133f5afa0e31a41cfa3fdb4843988175f Mon Sep 17 00:00:00 2001 From: Stefan Zermatten Date: Wed, 17 Aug 2022 13:42:47 +0200 Subject: [PATCH 01/39] Added point buy form --- app/imports/api/properties/PointBuys.js | 49 ++++++- .../computedOnlyPropertySchemasIndex.js | 2 + .../computedPropertySchemasIndex.js | 2 + .../api/properties/propertySchemasIndex.js | 2 + app/imports/constants/PROPERTIES.js | 8 +- app/imports/constants/STORAGE_LIMITS.js | 1 + .../ui/properties/forms/PointBuyForm.vue | 129 ++++++++++++++++++ .../forms/shared/propertyFormIndex.js | 2 + 8 files changed, 192 insertions(+), 3 deletions(-) create mode 100644 app/imports/ui/properties/forms/PointBuyForm.vue diff --git a/app/imports/api/properties/PointBuys.js b/app/imports/api/properties/PointBuys.js index 95cc1634..3be53ae2 100644 --- a/app/imports/api/properties/PointBuys.js +++ b/app/imports/api/properties/PointBuys.js @@ -27,10 +27,18 @@ let PointBuySchema = createPropertySchema({ 'values': { type: Array, defaultValue: [], + maxCount: STORAGE_LIMITS.pointBuyRowsCount, }, 'values.$': { type: Object, }, + 'values.$._id': { + type: String, + regEx: SimpleSchema.RegEx.Id, + autoValue(){ + if (!this.isSet) return Random.id(); + } + }, 'values.$.name': { type: String, optional: true, @@ -47,6 +55,18 @@ let PointBuySchema = createPropertySchema({ type: Number, optional: true, }, + 'values.$.min': { + type: 'fieldToCompute', + optional: true, + }, + 'values.$.max': { + type: 'fieldToCompute', + optional: true, + }, + 'values.$.cost': { + type: 'fieldToCompute', + optional: true, + }, min: { type: 'fieldToCompute', optional: true, @@ -74,11 +94,31 @@ const ComputedOnlyPointBuySchema = createPropertySchema({ type: 'computedOnlyField', optional: true, }, - total: { + cost: { type: 'computedOnlyField', optional: true, }, - cost: { + 'values': { + type: Array, + defaultValue: [], + maxCount: STORAGE_LIMITS.pointBuyRowsCount, + }, + 'values.$': { + type: Object, + }, + 'values.$.min': { + type: 'computedOnlyField', + optional: true, + }, + 'values.$.max': { + type: 'computedOnlyField', + optional: true, + }, + 'values.$.cost': { + type: 'computedOnlyField', + optional: true, + }, + total: { type: 'computedOnlyField', optional: true, }, @@ -87,6 +127,11 @@ const ComputedOnlyPointBuySchema = createPropertySchema({ optional: true, removeBeforeCompute: true, }, + error: { + type: String, + optional: true, + removeBeforeCompute: true, + }, }); const ComputedPointBuySchema = new SimpleSchema() diff --git a/app/imports/api/properties/computedOnlyPropertySchemasIndex.js b/app/imports/api/properties/computedOnlyPropertySchemasIndex.js index d490e4e3..489f5b19 100644 --- a/app/imports/api/properties/computedOnlyPropertySchemasIndex.js +++ b/app/imports/api/properties/computedOnlyPropertySchemasIndex.js @@ -15,6 +15,7 @@ import { ComputedOnlyFeatureSchema } from '/imports/api/properties/Features.js'; import { ComputedOnlyFolderSchema } from '/imports/api/properties/Folders.js'; import { ComputedOnlyItemSchema } from '/imports/api/properties/Items.js'; import { ComputedOnlyNoteSchema } from '/imports/api/properties/Notes.js'; +import { ComputedOnlyPointBuySchema } from '/imports/api/properties/PointBuys.js'; import { ComputedOnlyProficiencySchema } from '/imports/api/properties/Proficiencies.js'; import { ComputedOnlyReferenceSchema } from '/imports/api/properties/References.js'; import { ComputedOnlyRollSchema } from '/imports/api/properties/Rolls.js'; @@ -44,6 +45,7 @@ const propertySchemasIndex = { folder: ComputedOnlyFolderSchema, item: ComputedOnlyItemSchema, note: ComputedOnlyNoteSchema, + pointBuy: ComputedOnlyPointBuySchema, proficiency: ComputedOnlyProficiencySchema, propertySlot: ComputedOnlySlotSchema, reference: ComputedOnlyReferenceSchema, diff --git a/app/imports/api/properties/computedPropertySchemasIndex.js b/app/imports/api/properties/computedPropertySchemasIndex.js index 9084e3b7..01741b49 100644 --- a/app/imports/api/properties/computedPropertySchemasIndex.js +++ b/app/imports/api/properties/computedPropertySchemasIndex.js @@ -15,6 +15,7 @@ import { ComputedFeatureSchema } from '/imports/api/properties/Features.js'; import { FolderSchema } from '/imports/api/properties/Folders.js'; import { ComputedItemSchema } from '/imports/api/properties/Items.js'; import { ComputedNoteSchema } from '/imports/api/properties/Notes.js'; +import { ComputedPointBuySchema } from '/imports/api/properties/PointBuys.js'; import { ProficiencySchema } from '/imports/api/properties/Proficiencies.js'; import { ReferenceSchema } from '/imports/api/properties/References.js'; import { ComputedRollSchema } from '/imports/api/properties/Rolls.js'; @@ -42,6 +43,7 @@ const propertySchemasIndex = { feature: ComputedFeatureSchema, folder: FolderSchema, note: ComputedNoteSchema, + pointBuy: ComputedPointBuySchema, proficiency: ProficiencySchema, propertySlot: ComputedSlotSchema, reference: ReferenceSchema, diff --git a/app/imports/api/properties/propertySchemasIndex.js b/app/imports/api/properties/propertySchemasIndex.js index cc4b77ee..0f2f8cb0 100644 --- a/app/imports/api/properties/propertySchemasIndex.js +++ b/app/imports/api/properties/propertySchemasIndex.js @@ -13,6 +13,7 @@ import { EffectSchema } from '/imports/api/properties/Effects.js'; import { FeatureSchema } from '/imports/api/properties/Features.js'; import { FolderSchema } from '/imports/api/properties/Folders.js'; import { NoteSchema } from '/imports/api/properties/Notes.js'; +import { PointBuySchema } from '/imports/api/properties/PointBuys.js'; import { ProficiencySchema } from '/imports/api/properties/Proficiencies.js'; import { ReferenceSchema } from '/imports/api/properties/References.js'; import { RollSchema } from '/imports/api/properties/Rolls.js'; @@ -42,6 +43,7 @@ const propertySchemasIndex = { feature: FeatureSchema, folder: FolderSchema, note: NoteSchema, + pointBuy: PointBuySchema, proficiency: ProficiencySchema, propertySlot: SlotSchema, reference: ReferenceSchema, diff --git a/app/imports/constants/PROPERTIES.js b/app/imports/constants/PROPERTIES.js index c2aa3be1..3d75bd06 100644 --- a/app/imports/constants/PROPERTIES.js +++ b/app/imports/constants/PROPERTIES.js @@ -96,7 +96,13 @@ const PROPERTIES = Object.freeze({ icon: 'mdi-note-outline', name: 'Note', helpText: 'Notes about your character and their adventures', - suggestedParents: ['folder'], + suggestedParents: ['note', 'folder'], + }, + pointBuy: { + icon: 'mdi-table', + name: 'Point Buy', + helpText: 'A point buy table that allows the user to select an array of values that match a given cost', + suggestedParents: [], }, proficiency: { icon: 'mdi-brightness-1', diff --git a/app/imports/constants/STORAGE_LIMITS.js b/app/imports/constants/STORAGE_LIMITS.js index 6e116b07..cbc647e6 100644 --- a/app/imports/constants/STORAGE_LIMITS.js +++ b/app/imports/constants/STORAGE_LIMITS.js @@ -32,6 +32,7 @@ const STORAGE_LIMITS = Object.freeze({ tagCount: 64, writersCount: 20, libraryCollectionCount: 32, + pointBuyRowsCount: 32, }); export default STORAGE_LIMITS; diff --git a/app/imports/ui/properties/forms/PointBuyForm.vue b/app/imports/ui/properties/forms/PointBuyForm.vue new file mode 100644 index 00000000..b50d1a36 --- /dev/null +++ b/app/imports/ui/properties/forms/PointBuyForm.vue @@ -0,0 +1,129 @@ + + + diff --git a/app/imports/ui/properties/forms/shared/propertyFormIndex.js b/app/imports/ui/properties/forms/shared/propertyFormIndex.js index 1aa8f42e..63c4fe45 100644 --- a/app/imports/ui/properties/forms/shared/propertyFormIndex.js +++ b/app/imports/ui/properties/forms/shared/propertyFormIndex.js @@ -14,6 +14,7 @@ const FeatureForm = () => import('/imports/ui/properties/forms/FeatureForm.vue') const FolderForm = () => import('/imports/ui/properties/forms/FolderForm.vue'); const ItemForm = () => import('/imports/ui/properties/forms/ItemForm.vue'); const NoteForm = () => import('/imports/ui/properties/forms/NoteForm.vue'); +const PointBuyForm = () => import('/imports/ui/properties/forms/PointBuyForm.vue'); const ProficiencyForm = () => import('/imports/ui/properties/forms/ProficiencyForm.vue'); const ReferenceForm = () => import('/imports/ui/properties/forms/ReferenceForm.vue'); const RollForm = () => import('/imports/ui/properties/forms/RollForm.vue'); @@ -43,6 +44,7 @@ export default { folder: FolderForm, item: ItemForm, note: NoteForm, + pointBuy: PointBuyForm, proficiency: ProficiencyForm, propertySlot: SlotForm, reference: ReferenceForm, From 28307e26c32ac39e43390229826bd16bdcb8efc3 Mon Sep 17 00:00:00 2001 From: Stefan Zermatten Date: Fri, 19 Aug 2022 14:03:03 +0200 Subject: [PATCH 02/39] Fixed some issues with skill display --- .../computeByType/computeSkill.js | 2 +- .../computeVariable/computeVariableAsSkill.js | 5 ++- app/imports/api/properties/Skills.js | 1 + .../components/skills/SkillListTile.vue | 4 +- .../ui/properties/viewers/SkillViewer.vue | 44 ++++--------------- 5 files changed, 16 insertions(+), 40 deletions(-) diff --git a/app/imports/api/engine/computation/computeComputation/computeByType/computeSkill.js b/app/imports/api/engine/computation/computeComputation/computeByType/computeSkill.js index 2e79d18a..9243adb4 100644 --- a/app/imports/api/engine/computation/computeComputation/computeByType/computeSkill.js +++ b/app/imports/api/engine/computation/computeComputation/computeByType/computeSkill.js @@ -4,7 +4,7 @@ // by computeVariableAsSkill export default function computeSkill(computation, node){ const prop = node.data; - prop.proficiency = prop.baseProficiency; + prop.proficiency = prop.baseProficiency || 0; let profBonus = computation.scope['proficiencyBonus']?.value || 0; // Multiply the proficiency bonus by the actual proficiency if(prop.proficiency === 0.49){ diff --git a/app/imports/api/engine/computation/computeComputation/computeByType/computeVariable/computeVariableAsSkill.js b/app/imports/api/engine/computation/computeComputation/computeByType/computeVariable/computeVariableAsSkill.js index 37b6afdd..01d34101 100644 --- a/app/imports/api/engine/computation/computeComputation/computeByType/computeVariable/computeVariableAsSkill.js +++ b/app/imports/api/engine/computation/computeComputation/computeByType/computeVariable/computeVariableAsSkill.js @@ -33,6 +33,9 @@ export default function computeVariableAsSkill(computation, node, prop){ const aggregator = node.data.effectAggregator; const aggregatorBase = aggregator?.base || 0; + // Store effects + prop.effects = node.data.effects; + // If there is no aggregator, determine if the prop can hide, then exit if (!aggregator){ prop.hide = statBase === undefined && @@ -71,8 +74,6 @@ export default function computeVariableAsSkill(computation, node, prop){ prop.fail = aggregator.fail; // Rollbonus prop.rollBonuses = aggregator.rollBonus; - // Store effects - prop.effects = node.data.effects; } function aggregateAbilityEffects({computation, skillNode, abilityNode}){ diff --git a/app/imports/api/properties/Skills.js b/app/imports/api/properties/Skills.js index 47ba2a76..d9f04791 100644 --- a/app/imports/api/properties/Skills.js +++ b/app/imports/api/properties/Skills.js @@ -135,6 +135,7 @@ let ComputedOnlySkillSchema = createPropertySchema({ effects: { type: Array, optional: true, + removeBeforeCompute: true, }, 'effects.$': { type: Object, diff --git a/app/imports/ui/properties/components/skills/SkillListTile.vue b/app/imports/ui/properties/components/skills/SkillListTile.vue index 45f8b138..e24ece45 100644 --- a/app/imports/ui/properties/components/skills/SkillListTile.vue +++ b/app/imports/ui/properties/components/skills/SkillListTile.vue @@ -8,7 +8,7 @@ -
+
{{ model.name }} diff --git a/app/imports/ui/components/MarkdownText.vue b/app/imports/ui/components/MarkdownText.vue index b3576203..bb133d27 100644 --- a/app/imports/ui/components/MarkdownText.vue +++ b/app/imports/ui/components/MarkdownText.vue @@ -8,20 +8,20 @@ diff --git a/app/imports/ui/components/ToolbarCard.vue b/app/imports/ui/components/ToolbarCard.vue index 099a674a..9187bdf9 100644 --- a/app/imports/ui/components/ToolbarCard.vue +++ b/app/imports/ui/components/ToolbarCard.vue @@ -27,54 +27,58 @@ diff --git a/app/imports/ui/components/global/IconPicker.vue b/app/imports/ui/components/global/IconPicker.vue index 9d7dbc2b..13ef7954 100644 --- a/app/imports/ui/components/global/IconPicker.vue +++ b/app/imports/ui/components/global/IconPicker.vue @@ -87,7 +87,7 @@ export default { SvgIcon, }, mixins: [SmartInput], - props: { + props: { label: { type: String, default: 'Icon', @@ -96,39 +96,42 @@ export default { type: String, default: undefined, }, - }, - data(){return { - menu: false, - searchString: '', - icons: [], - };}, + }, + data() { + return { + menu: false, + searchString: '', + icons: [], + }; + }, watch: { - menu(value){ - if (value){ + menu(value) { + if (value) { setTimeout(() => { - if (this.$refs.iconSearchField){ + if (this.$refs.iconSearchField) { this.$refs.iconSearchField.$children[0].focus(); } }, 100); } }, }, - methods: { - search(value, ack){ + methods: { + search(value, ack) { this.searchString = value; this.icons = []; - findIcons.call({search: value}, (error, result) => { + findIcons.call({ search: value }, (error, result) => { ack(error); this.icons = result; }); }, - select(icon){ + select(icon) { this.menu = false; this.change(icon); }, - }, + }, } diff --git a/app/imports/ui/components/global/SmartCombobox.vue b/app/imports/ui/components/global/SmartCombobox.vue index 07931531..d5c985c0 100644 --- a/app/imports/ui/components/global/SmartCombobox.vue +++ b/app/imports/ui/components/global/SmartCombobox.vue @@ -21,34 +21,36 @@ diff --git a/app/imports/ui/components/global/SmartInputMixin.js b/app/imports/ui/components/global/SmartInputMixin.js index 9cf02830..245656b6 100644 --- a/app/imports/ui/components/global/SmartInputMixin.js +++ b/app/imports/ui/components/global/SmartInputMixin.js @@ -13,16 +13,18 @@ export default { context: { default: {} } }, inheritAttrs: false, - data(){ return { - error: false, - ackErrors: null, - rulesErrors: null, - focused: false, - loading: false, - dirty: false, - safeValue: this.value, - inputValue: this.value, - };}, + data() { + return { + error: false, + ackErrors: null, + rulesErrors: null, + focused: false, + loading: false, + dirty: false, + safeValue: this.value, + inputValue: this.value, + }; + }, props: { value: [String, Number, Date, Array, Object, Boolean], errorMessages: [String, Array], @@ -34,11 +36,11 @@ export default { rules: Array, }, watch: { - focused(newFocus){ + focused(newFocus) { // If the value updated while we were focused, show it now on defocus // but not if we are waiting for our own writes to get persisted // and not if there is an error in our input - if (!newFocus && !this.dirty && !this.error){ + if (!newFocus && !this.dirty && !this.error) { this.forceSafeValueUpdate(); } // Start the loading bar on defocus if the input is dirty @@ -48,118 +50,118 @@ export default { !newFocus && this.dirty && !(this.rulesErrors && this.rulesErrors.length) - ){ + ) { if (this.hasChangeListener) this.loading = true; } }, - dirty(newDirty){ + dirty(newDirty) { // Our changes were acknowledged, weren't in error, and we aren't focused, // make sure the internal value matches the database value - if (!newDirty && !this.focused && !this.error){ + if (!newDirty && !this.focused && !this.error) { this.forceSafeValueUpdate(); } }, - value(newValue){ + value(newValue) { if ( !this.focused && !(this.rulesErrors && this.rulesErrors.length) - ){ + ) { this.safeValue = newValue; } }, - safeValue(){ + safeValue() { // The safe value only gets updated from the parent, so it must be valid this.error = false; this.ackErrors = null; }, }, methods: { - input(val){ + input(val) { this.$emit('input', val); this.inputValue = val; this.dirty = true; // Apply the rules if there are any this.rulesErrors = null; - if (this.rules && this.rules.length){ + if (this.rules && this.rules.length) { this.rules.forEach(rule => { const result = rule(val); - if (typeof result === 'string'){ + if (typeof result === 'string') { if (!this.rulesErrors) this.rulesErrors = []; this.rulesErrors.push(result); } }); } - if (this.rulesErrors){ + if (this.rulesErrors) { return; } this.debouncedChange(val); }, - acknowledgeChange(error){ + acknowledgeChange(error) { this.loading = false; this.dirty = false; this.error = !!error; - if (!error){ - this.ackErrors = null; - } else if (typeof error === 'string'){ - this.ackErrors = error; - } else if (error.reason){ + if (!error) { + this.ackErrors = null; + } else if (typeof error === 'string') { + this.ackErrors = error; + } else if (error.reason) { this.ackErrors = error.reason; - } else if (error.message){ + } else if (error.message) { this.ackErrors = error.message; } else { - this.ackErrors = 'Something went wrong' - console.error(error); - } + this.ackErrors = 'Something went wrong' + console.error(error); + } }, - change(val){ + change(val) { this.dirty = true; if (this.hasChangeListener()) this.loading = true; this.$emit('change', val, this.acknowledgeChange); }, - hasChangeListener(){ + hasChangeListener() { return this.$listeners && this.$listeners.change; }, - forceSafeValueUpdate(){ + forceSafeValueUpdate() { // hack to force the value to update on the child component this.safeValue = null; this.$nextTick(() => this.safeValue = this.value); }, - focus(){ + focus() { this.$refs.input.focus(); } }, computed: { - errors(){ + errors() { let errors = this.ackErrors ? [this.ackErrors] : []; - if (Array.isArray(this.rulesErrors)){ + if (Array.isArray(this.rulesErrors)) { errors.push(...this.rulesErrors) } - if (Array.isArray(this.errorMessages)){ + if (Array.isArray(this.errorMessages)) { errors.push(...this.errorMessages); - } else if (typeof this.errorMessages === 'string' && this.errorMessages){ + } else if (typeof this.errorMessages === 'string' && this.errorMessages) { errors.push(this.errorMessages); } return errors; }, - isDisabled(){ + isDisabled() { return this.context.editPermission === false || this.disabled; }, debounceTime() { - if (Number.isFinite(this.debounce)){ + if (Number.isFinite(this.debounce)) { return this.debounce; - } else if (Number.isFinite(this.context.debounceTime)){ + } else if (Number.isFinite(this.context.debounceTime)) { return this.context.debounceTime; } else { return 750; } }, }, - created(){ + created() { this.debouncedChange = debounce(this.change, this.debounceTime); }, - beforeDestroy(){ + beforeDestroy() { this.debouncedChange.flush(); }, }; diff --git a/app/imports/ui/components/global/SmartSelect.vue b/app/imports/ui/components/global/SmartSelect.vue index 439f735b..005ea2ae 100644 --- a/app/imports/ui/components/global/SmartSelect.vue +++ b/app/imports/ui/components/global/SmartSelect.vue @@ -23,9 +23,9 @@ diff --git a/app/imports/ui/components/global/TextArea.vue b/app/imports/ui/components/global/TextArea.vue index 40722679..2fe4f8c8 100644 --- a/app/imports/ui/components/global/TextArea.vue +++ b/app/imports/ui/components/global/TextArea.vue @@ -14,15 +14,15 @@ diff --git a/app/imports/ui/components/tree/TreeNode.vue b/app/imports/ui/components/tree/TreeNode.vue index 4579c441..913a8954 100644 --- a/app/imports/ui/components/tree/TreeNode.vue +++ b/app/imports/ui/components/tree/TreeNode.vue @@ -77,134 +77,149 @@ diff --git a/app/imports/ui/components/tree/TreeNodeList.vue b/app/imports/ui/components/tree/TreeNodeList.vue index f5915ca2..1ea59678 100644 --- a/app/imports/ui/components/tree/TreeNodeList.vue +++ b/app/imports/ui/components/tree/TreeNodeList.vue @@ -33,102 +33,112 @@ diff --git a/app/imports/ui/creature/CreatureForm.vue b/app/imports/ui/creature/CreatureForm.vue index 1a0f82e0..d2ea8eeb 100644 --- a/app/imports/ui/creature/CreatureForm.vue +++ b/app/imports/ui/creature/CreatureForm.vue @@ -67,25 +67,25 @@ :value="model.settings.discordWebhook" @change="(value, ack) => $emit('change', {path: ['settings','discordWebhook'], value, ack})" /> - @@ -121,41 +121,42 @@ diff --git a/app/imports/ui/creature/CreatureFormDialog.vue b/app/imports/ui/creature/CreatureFormDialog.vue index 9a80adce..04fa4d19 100644 --- a/app/imports/ui/creature/CreatureFormDialog.vue +++ b/app/imports/ui/creature/CreatureFormDialog.vue @@ -1,5 +1,8 @@ diff --git a/app/imports/ui/creature/character/CharacterSheetToolbar.vue b/app/imports/ui/creature/character/CharacterSheetToolbar.vue index 0cafc021..0fb36161 100644 --- a/app/imports/ui/creature/character/CharacterSheetToolbar.vue +++ b/app/imports/ui/creature/character/CharacterSheetToolbar.vue @@ -11,17 +11,13 @@ dense > - + {{ $store.state.pageTitle }} - + { - if (error) { - console.error(error); - } else { - that.$router.push('/characterList'); - } - }); - } - }); - }, - unshareWithMe(){ + showCharacterForm() { + this.$store.commit('pushDialogStack', { + component: 'creature-form-dialog', + elementId: 'creature-menu', + data: { + _id: this.creatureId, + }, + }); + }, + showShareDialog() { + this.$store.commit('pushDialogStack', { + component: 'share-dialog', + elementId: 'creature-menu', + data: { + docRef: { + id: this.creatureId, + collection: 'creatures', + } + }, + }); + }, + deleteCharacter() { + let that = this; + this.$store.commit('pushDialogStack', { + component: 'delete-confirmation-dialog', + elementId: 'creature-menu', + data: { + name: this.creature.name, + typeName: 'Character' + }, + callback(confirmation) { + if (!confirmation) return; + removeCreature.call({ charId: that.creatureId }, (error) => { + if (error) { + console.error(error); + } else { + that.$router.push('/characterList'); + } + }); + } + }); + }, + unshareWithMe() { updateUserSharePermissions.call({ docRef: { collection: 'creatures', @@ -230,10 +226,10 @@ export default { }, }, meteor: { - creature(){ + creature() { return Creatures.findOne(this.creatureId); }, - editPermission(){ + editPermission() { try { assertEditPermission(this.creature, Meteor.userId()); return true; @@ -249,9 +245,11 @@ export default { .character-sheet-toolbar .v-tabs__container--grow .v-tabs__div { max-width: 120px !important; } + .character-sheet-toolbar .v-tabs__bar { background: none !important; } + .character-sheet-fab { bottom: -24px; right: 8px; diff --git a/app/imports/ui/creature/character/characterSheetTabs/FeaturesTab.vue b/app/imports/ui/creature/character/characterSheetTabs/FeaturesTab.vue index b6a2bb19..c1bfc215 100644 --- a/app/imports/ui/creature/character/characterSheetTabs/FeaturesTab.vue +++ b/app/imports/ui/creature/character/characterSheetTabs/FeaturesTab.vue @@ -16,44 +16,45 @@ diff --git a/app/imports/ui/creature/character/characterSheetTabs/InventoryTab.vue b/app/imports/ui/creature/character/characterSheetTabs/InventoryTab.vue index ad8ef5d7..ea77fddd 100644 --- a/app/imports/ui/creature/character/characterSheetTabs/InventoryTab.vue +++ b/app/imports/ui/creature/character/characterSheetTabs/InventoryTab.vue @@ -30,9 +30,7 @@ - + @@ -85,9 +83,7 @@ v-for="container in containersWithoutAncestorContainers" :key="container._id" > - +
@@ -107,83 +103,87 @@ import stripFloatingPointOddities from '/imports/api/engine/computation/utility/ import CreatureVariables from '../../../../api/creature/creatures/CreatureVariables'; export default { - components: { - ColumnLayout, - ContainerCard, + components: { + ColumnLayout, + ContainerCard, ToolbarCard, ItemList, CoinValue, - }, - props: { - creatureId: { + }, + props: { + creatureId: { type: String, required: true, }, - }, - data(){ return { - organize: false, - }}, - meteor: { - containers(){ - return CreatureProperties.find({ - 'ancestors.id': this.creatureId, - type: 'container', - removed: {$ne: true}, - inactive: {$ne: true}, - }, { - sort: {order: 1}, - }); - }, - creature(){ - return Creatures.findOne(this.creatureId, {fields: { - color: 1, - variables: 1, - }}); + }, + data() { + return { + organize: false, + } + }, + meteor: { + containers() { + return CreatureProperties.find({ + 'ancestors.id': this.creatureId, + type: 'container', + removed: { $ne: true }, + inactive: { $ne: true }, + }, { + sort: { order: 1 }, + }); + }, + creature() { + return Creatures.findOne(this.creatureId, { + fields: { + color: 1, + variables: 1, + } + }); }, variables() { return CreatureVariables.findOne({ _creatureId: this.creatureId }) || {}; }, - containersWithoutAncestorContainers(){ - return CreatureProperties.find({ - 'ancestors.id': { - $eq: this.creatureId, - $nin: this.containerIds - }, - type: 'container', - removed: {$ne: true}, - inactive: {$ne: true}, - }, { - sort: {order: 1}, - }); - }, - carriedItems(){ + containersWithoutAncestorContainers() { return CreatureProperties.find({ 'ancestors.id': { - $eq: this.creatureId, - $nin: this.containerIds - }, - type: 'item', - equipped: {$ne: true}, - removed: {$ne: true}, - deactivatedByAncestor: {$ne: true}, - }, { - sort: {order: 1}, - }); + $eq: this.creatureId, + $nin: this.containerIds + }, + type: 'container', + removed: { $ne: true }, + inactive: { $ne: true }, + }, { + sort: { order: 1 }, + }); }, - equippedItems(){ + carriedItems() { return CreatureProperties.find({ 'ancestors.id': { - $eq: this.creatureId, - }, - type: 'item', + $eq: this.creatureId, + $nin: this.containerIds + }, + type: 'item', + equipped: { $ne: true }, + removed: { $ne: true }, + deactivatedByAncestor: { $ne: true }, + }, { + sort: { order: 1 }, + }); + }, + equippedItems() { + return CreatureProperties.find({ + 'ancestors.id': { + $eq: this.creatureId, + }, + type: 'item', equipped: true, - removed: {$ne: true}, - inactive: {$ne: true}, - }, { - sort: {order: 1}, - }); + removed: { $ne: true }, + inactive: { $ne: true }, + }, { + sort: { order: 1 }, + }); }, - equipmentParentRef(){ + equipmentParentRef() { return getParentRefByTag( this.creatureId, BUILT_IN_TAGS.equipment ) || getParentRefByTag( @@ -193,7 +193,7 @@ export default { collection: 'creatures' }; }, - carriedParentRef(){ + carriedParentRef() { return getParentRefByTag( this.creatureId, BUILT_IN_TAGS.carried ) || getParentRefByTag( @@ -203,30 +203,31 @@ export default { collection: 'creatures' }; }, - }, - computed: { - containerIds(){ - return this.containers.map(container => container._id); - }, - weightCarried(){ + }, + computed: { + containerIds() { + return this.containers.map(container => container._id); + }, + weightCarried() { return stripFloatingPointOddities( this.variables && this.variables.weightCarried && this.variables.weightCarried.value || 0 ); }, - }, - methods: { - clickProperty(_id){ - this.$store.commit('pushDialogStack', { - component: 'creature-property-dialog', - elementId: `tree-node-${_id}`, - data: {_id}, - }); - }, - }, + }, + methods: { + clickProperty(_id) { + this.$store.commit('pushDialogStack', { + component: 'creature-property-dialog', + elementId: `tree-node-${_id}`, + data: { _id }, + }); + }, + }, } diff --git a/app/imports/ui/creature/character/characterSheetTabs/SpellsTab.vue b/app/imports/ui/creature/character/characterSheetTabs/SpellsTab.vue index ad87c9f5..a5e307cc 100644 --- a/app/imports/ui/creature/character/characterSheetTabs/SpellsTab.vue +++ b/app/imports/ui/creature/character/characterSheetTabs/SpellsTab.vue @@ -29,41 +29,43 @@ import SpellListCard from '/imports/ui/properties/components/spells/SpellListCar import SpellList from '/imports/ui/properties/components/spells/SpellList.vue'; export default { - components: { - ColumnLayout, + components: { + ColumnLayout, SpellList, - SpellListCard, - }, - props: { - creatureId: { + SpellListCard, + }, + props: { + creatureId: { type: String, required: true, } - }, - data(){ return { - organize: false, - }}, - meteor: { - spellLists(){ + }, + data() { + return { + organize: false, + } + }, + meteor: { + spellLists() { return CreatureProperties.find({ 'ancestors.id': this.creatureId, type: 'spellList', - removed: {$ne: true}, - inactive: {$ne: true}, + removed: { $ne: true }, + inactive: { $ne: true }, }, { - sort: {order: 1} + sort: { order: 1 } }); - }, - spellsWithoutList(){ + }, + spellsWithoutList() { return CreatureProperties.find({ 'ancestors.id': { $eq: this.creatureId, $nin: this.spellListIds, }, type: 'spell', - removed: {$ne: true}, - deactivatedByAncestor: {$ne: true}, - deactivatedByToggle: {$ne: true}, + removed: { $ne: true }, + deactivatedByAncestor: { $ne: true }, + deactivatedByToggle: { $ne: true }, }, { sort: { level: 1, @@ -71,36 +73,37 @@ export default { } }); }, - spellListsWithoutAncestorSpellLists(){ + spellListsWithoutAncestorSpellLists() { return CreatureProperties.find({ 'ancestors.id': { $eq: this.creatureId, $nin: this.spellListIds, }, type: 'spellList', - removed: {$ne: true}, - inactive: {$ne: true}, + removed: { $ne: true }, + inactive: { $ne: true }, }, { - sort: {order: 1} + sort: { order: 1 } }); - }, - }, - computed: { - spellListIds(){ - return this.spellLists.map(spellList => spellList._id); - }, - }, - methods: { - clickProperty(_id){ - this.$store.commit('pushDialogStack', { - component: 'creature-property-dialog', - elementId: `spell-list-tile-${_id}`, - data: {_id}, - }); - }, - }, + }, + }, + computed: { + spellListIds() { + return this.spellLists.map(spellList => spellList._id); + }, + }, + methods: { + clickProperty(_id) { + this.$store.commit('pushDialogStack', { + component: 'creature-property-dialog', + elementId: `spell-list-tile-${_id}`, + data: { _id }, + }); + }, + }, } diff --git a/app/imports/ui/creature/character/characterSheetTabs/StatsTab.vue b/app/imports/ui/creature/character/characterSheetTabs/StatsTab.vue index ab4aa6fc..582a8642 100644 --- a/app/imports/ui/creature/character/characterSheetTabs/StatsTab.vue +++ b/app/imports/ui/creature/character/characterSheetTabs/StatsTab.vue @@ -1,7 +1,5 @@ diff --git a/app/imports/ui/creature/creatureProperties/CreaturePropertyCreationDialog.vue b/app/imports/ui/creature/creatureProperties/CreaturePropertyCreationDialog.vue index e24407fe..db6ceb72 100644 --- a/app/imports/ui/creature/creatureProperties/CreaturePropertyCreationDialog.vue +++ b/app/imports/ui/creature/creatureProperties/CreaturePropertyCreationDialog.vue @@ -20,7 +20,7 @@ import { getPropertyName } from '/imports/constants/PROPERTIES.js'; export default { components: { SelectablePropertyDialog, - CreaturePropertyInsertForm, + CreaturePropertyInsertForm, }, props: { forcedType: { @@ -28,21 +28,24 @@ export default { default: undefined, }, }, - data() { return { - type: undefined, - };}, - methods: { - getPropertyName, - back(){ - if (this.forcedType){ + data() { + return { + type: undefined, + }; + }, + methods: { + getPropertyName, + back() { + if (this.forcedType) { this.$store.dispatch('popDialogStack'); } else { this.type = undefined; } }, - }, + }, }; diff --git a/app/imports/ui/creature/creatureProperties/CreaturePropertyFromLibraryDialog.vue b/app/imports/ui/creature/creatureProperties/CreaturePropertyFromLibraryDialog.vue index 1910b5ee..72d0e8da 100644 --- a/app/imports/ui/creature/creatureProperties/CreaturePropertyFromLibraryDialog.vue +++ b/app/imports/ui/creature/creatureProperties/CreaturePropertyFromLibraryDialog.vue @@ -23,18 +23,21 @@ diff --git a/app/imports/ui/creature/experiences/ExperienceInsertDialog.vue b/app/imports/ui/creature/experiences/ExperienceInsertDialog.vue index 28756d1f..9b9ecc72 100644 --- a/app/imports/ui/creature/experiences/ExperienceInsertDialog.vue +++ b/app/imports/ui/creature/experiences/ExperienceInsertDialog.vue @@ -34,9 +34,9 @@ import schemaFormMixin from '/imports/ui/properties/forms/shared/schemaFormMixin export default { components: { - DialogBase, + DialogBase, ExperienceForm, - }, + }, mixins: [schemaFormMixin], provide: { context: { @@ -52,10 +52,10 @@ export default { type: Boolean, }, }, - data(){ + data() { let schema = ExperienceSchema.omit('creatureId'); let startingModel = {}; - if (this.startAsMilestone){ + if (this.startAsMilestone) { startingModel.levels = 1; } return { @@ -65,14 +65,14 @@ export default { debounceTime: 0, }; }, - methods:{ - insertExperience(){ + methods: { + insertExperience() { let experience = this.schema.clean(this.model); let id = insertExperience.call({ experience, creatureIds: this.creatureIds, - }, (error) => { - if (error){ + }, (error) => { + if (error) { console.error(error); } }); @@ -83,4 +83,5 @@ export default { diff --git a/app/imports/ui/creature/slots/LevelUpDialog.vue b/app/imports/ui/creature/slots/LevelUpDialog.vue index 7a09eb1b..4503a96e 100644 --- a/app/imports/ui/creature/slots/LevelUpDialog.vue +++ b/app/imports/ui/creature/slots/LevelUpDialog.vue @@ -192,18 +192,17 @@ import getSlotFillFilter from '/imports/api/creature/creatureProperties/methods/ import Libraries from '/imports/api/library/Libraries.js'; import LibraryNodeExpansionContent from '/imports/ui/library/LibraryNodeExpansionContent.vue'; import PropertyTags from '/imports/ui/properties/viewers/shared/PropertyTags.vue'; -import { getPropertyName } from '/imports/constants/PROPERTIES.js'; import { clone } from 'lodash'; export default { components: { - DialogBase, + DialogBase, TreeNodeView, PropertyDescription, LibraryNodeExpansionContent, PropertyTags, - }, - props:{ + }, + props: { classId: { type: String, default: undefined, @@ -217,42 +216,44 @@ export default { default: undefined, }, }, - data(){return { - selectedNodeIds: [], - searchInput: undefined, - searchValue: undefined, - showDisabled: false, - disabledNodeCount: undefined, - }}, + data() { + return { + selectedNodeIds: [], + searchInput: undefined, + searchValue: undefined, + showDisabled: false, + disabledNodeCount: undefined, + } + }, reactiveProvide: { name: 'context', include: ['creatureId'], }, computed: { - tagsSearched(){ + tagsSearched() { let or = []; let not = []; - if (this.model.slotTags && this.model.slotTags.length){ + if (this.model.slotTags && this.model.slotTags.length) { or.push(this.model.slotTags); } this.model.extraTags?.forEach(extras => { - if (extras.tags?.length){ - if(extras.operation === 'OR'){ + if (extras.tags?.length) { + if (extras.operation === 'OR') { or.push(extras.tags); - } else if (extras.operation === 'NOT'){ + } else if (extras.operation === 'NOT') { not.push(extras.tags); } } }); - return {or, not}; + return { or, not }; }, }, methods: { - loadMore(){ + loadMore() { if (this.currentLimit >= this.countAll) return; this._subs['classFillers'].setData('limit', this.currentLimit + 50); }, - openPropertyDetails(id){ + openPropertyDetails(id) { this.$store.commit('pushDialogStack', { component: 'library-node-dialog', elementId: id, @@ -261,26 +262,26 @@ export default { }, }); }, - isDisabled(node){ + isDisabled(node) { return node._disabledBySlotFillerCondition || node._disabledByAlreadyAdded || - ( - node._disabledByQuantityFilled && - !this.selectedNodeIds.includes(node._id) - ) + ( + node._disabledByQuantityFilled && + !this.selectedNodeIds.includes(node._id) + ) }, }, meteor: { $subscribe: { - 'classFillers'(){ + 'classFillers'() { return [this.classId, this.searchValue || undefined] }, }, - searchLoading(){ + searchLoading() { return !!this.searchValue && !this.$subReady.classFillers; }, - model(){ - if (this.classId){ + model() { + if (this.classId) { return CreatureProperties.findOne(this.classId); } else if (this.dummySlot) { let model = clone(this.dummySlot) @@ -294,40 +295,40 @@ export default { if (!this.creatureId) return {}; return CreatureVariables.findOne({ _creatureId: this.creatureId }) || {}; }, - currentLimit(){ + currentLimit() { return this._subs['classFillers'].data('limit') || 50; }, - countAll(){ + countAll() { return this._subs['classFillers'].data('countAll'); }, - alreadyAdded(){ + alreadyAdded() { let added = new Set(); if (!this.model.unique) return added; let ancestorId; - if (this.model.unique === 'uniqueInSlot'){ + if (this.model.unique === 'uniqueInSlot') { ancestorId = this.model._id; - } else if (this.model.unique === 'uniqueInCreature'){ + } else if (this.model.unique === 'uniqueInCreature') { ancestorId = this.creatureId; } CreatureProperties.find({ 'ancestors.id': ancestorId, - libraryNodeId: {$exists: true}, - removed: {$ne: true}, + libraryNodeId: { $exists: true }, + removed: { $ne: true }, }, { - fields: {libraryNodeId: 1}, + fields: { libraryNodeId: 1 }, }).forEach(prop => { added.add(prop.libraryNodeId); }); return added; }, - totalQuantitySelected(){ + totalQuantitySelected() { let quantitySelected = 0; LibraryNodes.find({ - _id: {$in: this.selectedNodeIds} + _id: { $in: this.selectedNodeIds } }, { - fields: {slotQuantityFilled: 1}, + fields: { slotQuantityFilled: 1 }, }).forEach(node => { - if (Number.isFinite(node.slotQuantityFilled)){ + if (Number.isFinite(node.slotQuantityFilled)) { quantitySelected += node.slotQuantityFilled; } else { quantitySelected += 1; @@ -335,30 +336,30 @@ export default { }); return quantitySelected; }, - spaceLeft(){ + spaceLeft() { if (!this.model.quantityExpected || this.model.quantityExpected.value === 0) return undefined; return this.model.spaceLeft - this.totalQuantitySelected; }, - libraryNames(){ + libraryNames() { let names = {}; Libraries.find().forEach(lib => names[lib._id] = lib.name) return names; }, - libraryNodes(){ + libraryNodes() { let filter = getSlotFillFilter({ slot: this.model }); let nodes = LibraryNodes.find(filter, { - sort: {name: 1, order: 1} + sort: { name: 1, order: 1 } }).fetch(); let disabledNodeCount = 0; // Mark classFillers whose condition isn't met or are too big to fit // the quantity to fill nodes.forEach(node => { - if (node.slotFillerCondition){ + if (node.slotFillerCondition) { try { let parseNode = parse(node.slotFillerCondition); - const {result: resultNode} = resolve('reduce', parseNode, this.variables); - if (resultNode?.parseType === 'constant'){ - if (!resultNode.value){ + const { result: resultNode } = resolve('reduce', parseNode, this.variables); + if (resultNode?.parseType === 'constant') { + if (!resultNode.value) { node._disabledBySlotFillerCondition = true; disabledNodeCount += 1; } @@ -367,7 +368,7 @@ export default { node._conditionError = toString(resultNode); disabledNodeCount += 1; } - } catch (e){ + } catch (e) { console.warn(e); let error = prettifyParseError(e); node._disabledBySlotFillerCondition = true; @@ -378,10 +379,10 @@ export default { let quantityToFill = node.type === 'slotFiller' ? node.slotQuantityFilled : 1; if ( quantityToFill > this.spaceLeft - ){ + ) { node._disabledByQuantityFilled = true; } - if (this.alreadyAdded.has(node._id)){ + if (this.alreadyAdded.has(node._id)) { node._disabledByAlreadyAdded = true; } }); @@ -393,7 +394,7 @@ export default { diff --git a/app/imports/ui/creature/slots/SlotFillDialog.vue b/app/imports/ui/creature/slots/SlotFillDialog.vue index caee497e..cbad8fb9 100644 --- a/app/imports/ui/creature/slots/SlotFillDialog.vue +++ b/app/imports/ui/creature/slots/SlotFillDialog.vue @@ -198,13 +198,13 @@ import { clone } from 'lodash'; export default { components: { - DialogBase, + DialogBase, TreeNodeView, PropertyDescription, LibraryNodeExpansionContent, PropertyTags, - }, - props:{ + }, + props: { slotId: { type: String, default: undefined, @@ -218,36 +218,38 @@ export default { default: undefined, }, }, - data(){return { - selectedNodeIds: [], - searchInput: undefined, - searchValue: undefined, - showDisabled: false, - disabledNodeCount: undefined, - }}, + data() { + return { + selectedNodeIds: [], + searchInput: undefined, + searchValue: undefined, + showDisabled: false, + disabledNodeCount: undefined, + } + }, reactiveProvide: { name: 'context', include: ['creatureId'], }, computed: { - tagsSearched(){ + tagsSearched() { let or = []; let not = []; - if (this.model.slotTags && this.model.slotTags.length){ + if (this.model.slotTags && this.model.slotTags.length) { or.push(this.model.slotTags); } this.model.extraTags?.forEach(extras => { - if (extras.tags?.length){ - if(extras.operation === 'OR'){ + if (extras.tags?.length) { + if (extras.operation === 'OR') { or.push(extras.tags); - } else if (extras.operation === 'NOT'){ + } else if (extras.operation === 'NOT') { not.push(extras.tags); } } }); - return {or, not}; + return { or, not }; }, - slotPropertyTypeName(){ + slotPropertyTypeName() { if (!this.model) return; if (!this.model.slotType) return 'Property'; let propName = getPropertyName(this.model.slotType); @@ -255,11 +257,11 @@ export default { }, }, methods: { - loadMore(){ + loadMore() { if (this.currentLimit >= this.countAll) return; this._subs['slotFillers'].setData('limit', this.currentLimit + 50); }, - openPropertyDetails(id){ + openPropertyDetails(id) { this.$store.commit('pushDialogStack', { component: 'library-node-dialog', elementId: id, @@ -268,26 +270,26 @@ export default { }, }); }, - isDisabled(node){ + isDisabled(node) { return node._disabledBySlotFillerCondition || node._disabledByAlreadyAdded || - ( - node._disabledByQuantityFilled && - !this.selectedNodeIds.includes(node._id) - ) + ( + node._disabledByQuantityFilled && + !this.selectedNodeIds.includes(node._id) + ) }, }, meteor: { $subscribe: { - 'slotFillers'(){ + 'slotFillers'() { return [this.slotId, this.searchValue || undefined] }, }, - searchLoading(){ + searchLoading() { return !!this.searchValue && !this.$subReady.slotFillers; }, - model(){ - if (this.slotId){ + model() { + if (this.slotId) { return CreatureProperties.findOne(this.slotId); } else if (this.dummySlot) { let model = clone(this.dummySlot) @@ -301,40 +303,40 @@ export default { if (!this.creatureId) return {}; return CreatureVariables.findOne({ _creatureId: this.creatureId }) || {}; }, - currentLimit(){ + currentLimit() { return this._subs['slotFillers'].data('limit') || 50; }, - countAll(){ + countAll() { return this._subs['slotFillers'].data('countAll'); }, - alreadyAdded(){ + alreadyAdded() { let added = new Set(); if (!this.model.unique) return added; let ancestorId; - if (this.model.unique === 'uniqueInSlot'){ + if (this.model.unique === 'uniqueInSlot') { ancestorId = this.model._id; - } else if (this.model.unique === 'uniqueInCreature'){ + } else if (this.model.unique === 'uniqueInCreature') { ancestorId = this.creatureId; } CreatureProperties.find({ 'ancestors.id': ancestorId, - libraryNodeId: {$exists: true}, - removed: {$ne: true}, + libraryNodeId: { $exists: true }, + removed: { $ne: true }, }, { - fields: {libraryNodeId: 1}, + fields: { libraryNodeId: 1 }, }).forEach(prop => { added.add(prop.libraryNodeId); }); return added; }, - totalQuantitySelected(){ + totalQuantitySelected() { let quantitySelected = 0; LibraryNodes.find({ - _id: {$in: this.selectedNodeIds} + _id: { $in: this.selectedNodeIds } }, { - fields: {slotQuantityFilled: 1}, + fields: { slotQuantityFilled: 1 }, }).forEach(node => { - if (Number.isFinite(node.slotQuantityFilled)){ + if (Number.isFinite(node.slotQuantityFilled)) { quantitySelected += node.slotQuantityFilled; } else { quantitySelected += 1; @@ -342,30 +344,30 @@ export default { }); return quantitySelected; }, - spaceLeft(){ + spaceLeft() { if (!this.model.quantityExpected || this.model.quantityExpected.value === 0) return undefined; return this.model.spaceLeft - this.totalQuantitySelected; }, - libraryNames(){ + libraryNames() { let names = {}; Libraries.find().forEach(lib => names[lib._id] = lib.name) return names; }, - libraryNodes(){ - let filter = getSlotFillFilter({slot: this.model}); + libraryNodes() { + let filter = getSlotFillFilter({ slot: this.model }); let nodes = LibraryNodes.find(filter, { - sort: {name: 1, order: 1} + sort: { name: 1, order: 1 } }).fetch(); let disabledNodeCount = 0; // Mark slotFillers whose condition isn't met or are too big to fit // the quantity to fill nodes.forEach(node => { - if (node.slotFillerCondition){ + if (node.slotFillerCondition) { try { let parseNode = parse(node.slotFillerCondition); - const {result: resultNode} = resolve('reduce', parseNode, this.variables); - if (resultNode?.parseType === 'constant'){ - if (!resultNode.value){ + const { result: resultNode } = resolve('reduce', parseNode, this.variables); + if (resultNode?.parseType === 'constant') { + if (!resultNode.value) { node._disabledBySlotFillerCondition = true; disabledNodeCount += 1; } @@ -374,7 +376,7 @@ export default { node._conditionError = toString(resultNode); disabledNodeCount += 1; } - } catch (e){ + } catch (e) { console.warn(e); let error = prettifyParseError(e); node._disabledBySlotFillerCondition = true; @@ -385,10 +387,10 @@ export default { let quantityToFill = node.type === 'slotFiller' ? node.slotQuantityFilled : 1; if ( quantityToFill > this.spaceLeft - ){ + ) { node._disabledByQuantityFilled = true; } - if (this.alreadyAdded.has(node._id)){ + if (this.alreadyAdded.has(node._id)) { node._disabledByAlreadyAdded = true; } }); @@ -400,7 +402,7 @@ export default { diff --git a/app/imports/ui/dialogStack/DeleteConfirmationDialog.vue b/app/imports/ui/dialogStack/DeleteConfirmationDialog.vue index d7f90460..c8b76735 100644 --- a/app/imports/ui/dialogStack/DeleteConfirmationDialog.vue +++ b/app/imports/ui/dialogStack/DeleteConfirmationDialog.vue @@ -4,7 +4,10 @@ Delete {{ typeName }}
- + This can't be undone

@@ -12,9 +15,9 @@

diff --git a/app/imports/ui/dialogStack/DialogBase.vue b/app/imports/ui/dialogStack/DialogBase.vue index 14a1f1cf..4fcdd912 100644 --- a/app/imports/ui/dialogStack/DialogBase.vue +++ b/app/imports/ui/dialogStack/DialogBase.vue @@ -50,63 +50,69 @@ diff --git a/app/imports/ui/dialogStack/HelpDialog.vue b/app/imports/ui/dialogStack/HelpDialog.vue index 158bc71e..9fe700b2 100644 --- a/app/imports/ui/dialogStack/HelpDialog.vue +++ b/app/imports/ui/dialogStack/HelpDialog.vue @@ -43,16 +43,16 @@ import MarkdownText from '/imports/ui/components/MarkdownText.vue'; import Docs from '/imports/api/docs/Docs.js'; export default { - components: { + components: { DialogBase, MarkdownText, - }, - props: { + }, + props: { path: { type: String, required: true, } - }, + }, computed: { prop() { return propsByDocsPath.get(this.path); @@ -63,7 +63,7 @@ export default { } else { const titleCase = this.path.replace( /(\w*)(\W+)/g, - function(txt, word) { + function (txt, word) { return word.charAt(0).toUpperCase() + word.substr(1).toLowerCase() + ' '; } ); @@ -73,7 +73,7 @@ export default { }, meteor: { $subscribe: { - 'docs'(){ + 'docs'() { return [this.path]; }, }, @@ -104,4 +104,5 @@ export default { diff --git a/app/imports/ui/dialogStack/mockElement.js b/app/imports/ui/dialogStack/mockElement.js index de843514..e3f19654 100644 --- a/app/imports/ui/dialogStack/mockElement.js +++ b/app/imports/ui/dialogStack/mockElement.js @@ -2,7 +2,7 @@ import { parse, stringify } from 'css-box-shadow'; // Only supports border radius defined like "20px" or "100%" const transformedRadius = (radiusString, deltaWidth, deltaHeight) => { - if (/^\d+\.?\d*px$/.test(radiusString)){ + if (/^\d+\.?\d*px$/.test(radiusString)) { //The radius is defined in pixel units, so get the radius as a number const rad = +radiusString.match(/\d+\.?\d*/)[0]; // Set the x and y radius of the "to" element, compensating for scale @@ -15,7 +15,7 @@ const transformedRadius = (radiusString, deltaWidth, deltaHeight) => { const transformedBoxShadow = (shadowString, deltaWidth, deltaHeight) => { if (shadowString === 'none') return shadowString; - if (shadowString[0] === 'r'){ + if (shadowString[0] === 'r') { let strings = shadowString.match(/rgba\([^)]+\)[^,]+/g); strings = strings.map(string => { // Move color to end @@ -35,24 +35,24 @@ const transformedBoxShadow = (shadowString, deltaWidth, deltaHeight) => { return stringify(shadows); } -export default function mockElement({source, target, offset = {x: 0, y: 0}}){ - if (!source || !target) throw `Can't mock without ${source ? 'target' : 'source'}` ; +export default function mockElement({ source, target, offset = { x: 0, y: 0 } }) { + if (!source || !target) throw `Can't mock without ${source ? 'target' : 'source'}`; let sourceRect = source.getBoundingClientRect(); - let targetRect = target.getBoundingClientRect(); + let targetRect = target.getBoundingClientRect(); - // Get how must the target change to become the source - const deltaWidth = sourceRect.width / targetRect.width; - const deltaHeight = sourceRect.height / targetRect.height; - const deltaLeft = sourceRect.left - targetRect.left + offset.x; - const deltaTop = sourceRect.top - targetRect.top + offset.y; - // Mock the source - target.style.transform = `translate(${deltaLeft}px, ${deltaTop}px) ` + + // Get how must the target change to become the source + const deltaWidth = sourceRect.width / targetRect.width; + const deltaHeight = sourceRect.height / targetRect.height; + const deltaLeft = sourceRect.left - targetRect.left + offset.x; + const deltaTop = sourceRect.top - targetRect.top + offset.y; + // Mock the source + target.style.transform = `translate(${deltaLeft}px, ${deltaTop}px) ` + `scale(${deltaWidth}, ${deltaHeight})`; - // Mock the background color unless it's completely transparent - let backgroundColor = getComputedStyle(source).backgroundColor - if (backgroundColor !== 'rgba(0, 0, 0, 0)'){ - target.style.backgroundColor = backgroundColor; - } + // Mock the background color unless it's completely transparent + let backgroundColor = getComputedStyle(source).backgroundColor + if (backgroundColor !== 'rgba(0, 0, 0, 0)') { + target.style.backgroundColor = backgroundColor; + } // Edge might not combine all border radii into a single value, // So we just sample the top left one if we need to let oldRadius = getComputedStyle(source).borderRadius || diff --git a/app/imports/ui/files/ArchiveFileCard.vue b/app/imports/ui/files/ArchiveFileCard.vue index cab9edde..d8ec1f25 100644 --- a/app/imports/ui/files/ArchiveFileCard.vue +++ b/app/imports/ui/files/ArchiveFileCard.vue @@ -44,17 +44,19 @@ export default { required: true, }, }, - data(){return { - restoreLoading: false, - removeLoading: false, - }}, - meteor: { - characterSlots(){ + data() { + return { + restoreLoading: false, + removeLoading: false, + } + }, + meteor: { + characterSlots() { return characterSlotsRemaining(Meteor.userId()); }, - }, + }, methods: { - restore(){ + restore() { this.restoreLoading = true; restoreCreatureFromFile.call({ fileId: this.model._id, @@ -62,26 +64,26 @@ export default { this.restoreLoading = false; if (!error) return; console.error(error); - snackbar({text: error.reason}); + snackbar({ text: error.reason }); + }); + }, + removeArchiveCharacter() { + let that = this; + this.$store.commit('pushDialogStack', { + component: 'delete-confirmation-dialog', + elementId: `${that.model._id}-archive-card`, + data: { + name: this.model.meta.creatureName, + typeName: 'Character Archive' + }, + callback(confirmation) { + if (!confirmation) return; + removeArchiveCreature.call({ fileId: that.model._id }, (error) => { + if (error) console.error(error); + }); + } }); }, - removeArchiveCharacter(){ - let that = this; - this.$store.commit('pushDialogStack', { - component: 'delete-confirmation-dialog', - elementId: `${that.model._id}-archive-card`, - data: { - name: this.model.meta.creatureName, - typeName: 'Character Archive' - }, - callback(confirmation){ - if(!confirmation) return; - removeArchiveCreature.call({fileId: that.model._id}, (error) => { - if (error) console.error(error); - }); - } - }); - }, }, } diff --git a/app/imports/ui/files/UserImageCard.vue b/app/imports/ui/files/UserImageCard.vue index e70141a6..85c5d155 100644 --- a/app/imports/ui/files/UserImageCard.vue +++ b/app/imports/ui/files/UserImageCard.vue @@ -34,7 +34,6 @@ diff --git a/app/imports/ui/layouts/AppLayout.vue b/app/imports/ui/layouts/AppLayout.vue index 8d958e86..99469969 100644 --- a/app/imports/ui/layouts/AppLayout.vue +++ b/app/imports/ui/layouts/AppLayout.vue @@ -6,9 +6,7 @@ > - + - +
{{ $store.state.pageTitle }}
- +
- +
- +
- + - + diff --git a/app/imports/ui/library/LibraryCollectionEditDialog.vue b/app/imports/ui/library/LibraryCollectionEditDialog.vue index 8cf2e70c..cccce61a 100644 --- a/app/imports/ui/library/LibraryCollectionEditDialog.vue +++ b/app/imports/ui/library/LibraryCollectionEditDialog.vue @@ -63,62 +63,62 @@ import { snackbar } from '/imports/ui/components/snackbars/SnackbarQueue.js'; import Libraries from '/imports/api/library/Libraries.js'; export default { - components: { - DialogBase, - }, - props: { - _id: String, - }, - methods: { - updateLibraryCollection(update, ack){ - updateLibraryCollection.call({_id: this._id, update}, (error) =>{ - ack(error && error.reason || error); - }); + components: { + DialogBase, + }, + props: { + _id: String, + }, + methods: { + updateLibraryCollection(update, ack) { + updateLibraryCollection.call({ _id: this._id, update }, (error) => { + ack(error && error.reason || error); + }); }, - remove(){ - let that = this; - this.$store.commit('pushDialogStack', { - component: 'delete-confirmation-dialog', - elementId: 'delete-library-button', - data: { - name: this.model.name, - typeName: 'Collection' - }, - callback(confirmation){ - if(!confirmation) return; - removeLibraryCollection.call({_id: that._id}, (error) => { + remove() { + let that = this; + this.$store.commit('pushDialogStack', { + component: 'delete-confirmation-dialog', + elementId: 'delete-library-button', + data: { + name: this.model.name, + typeName: 'Collection' + }, + callback(confirmation) { + if (!confirmation) return; + removeLibraryCollection.call({ _id: that._id }, (error) => { if (error) { console.error(error); snackbar({ text: error.reason, }); - } else { + } else { that.$router.push({ name: 'library', replace: true }); that.$store.dispatch('popDialogStack'); - } - }); - } - }); - }, - share(){ - this.$store.commit('pushDialogStack', { - component: 'share-dialog', - elementId: 'share-library-button', - data: { - docRef: { + } + }); + } + }); + }, + share() { + this.$store.commit('pushDialogStack', { + component: 'share-dialog', + elementId: 'share-library-button', + data: { + docRef: { id: this._id, collection: 'libraryCollections', } - }, - }); - }, - }, - meteor: { - '$subscribe':{ + }, + }); + }, + }, + meteor: { + '$subscribe': { libraries: [], }, - model(){ - return LibraryCollections.findOne(this._id); + model() { + return LibraryCollections.findOne(this._id); }, libraryOptions() { const userId = Meteor.userId(); @@ -131,7 +131,7 @@ export default { { public: true }, ] }, - {sort: {name: 1}} + { sort: { name: 1 } } ).map(library => { return { text: library.name, @@ -139,9 +139,10 @@ export default { }; }); }, - } + } } diff --git a/app/imports/ui/library/LibraryCollectionToolbar.vue b/app/imports/ui/library/LibraryCollectionToolbar.vue index 4147836e..0a128b90 100644 --- a/app/imports/ui/library/LibraryCollectionToolbar.vue +++ b/app/imports/ui/library/LibraryCollectionToolbar.vue @@ -43,24 +43,26 @@ import { assertDocEditPermission } from '/imports/api/sharing/sharingPermissions import { mapMutations } from 'vuex'; export default { - data(){ return { - loading: false, - }}, + data() { + return { + loading: false, + } + }, meteor: { - libraryCollection(){ + libraryCollection() { return LibraryCollections.findOne(this.$route.params.id); }, - subscribed(){ + subscribed() { const libraryCollectionId = this.$route.params.id; const user = Meteor.user(); return user?.subscribedLibraryCollections?.includes(libraryCollectionId); }, - showSubscribeButton(){ + showSubscribeButton() { let user = Meteor.user(); let libraryCollection = this.libraryCollection; if (!user || !libraryCollection) return; let userId = user._id; - if (user.subscribedLibraryCollections?.includes(libraryCollection._id)){ + if (user.subscribedLibraryCollections?.includes(libraryCollection._id)) { return true } else if ( libraryCollection.readers.includes(userId) || @@ -72,7 +74,7 @@ export default { return true; } }, - canEdit(){ + canEdit() { try { assertDocEditPermission(this.libraryCollection, Meteor.userId()); return true @@ -85,7 +87,7 @@ export default { ...mapMutations([ 'toggleDrawer', ]), - subscribe(value){ + subscribe(value) { this.loading = true; Meteor.users.subscribeToLibraryCollection.call({ libraryCollectionId: this.$route.params.id, @@ -94,16 +96,17 @@ export default { this.loading = false; }); }, - editLibraryCollection(){ - this.$store.commit('pushDialogStack', { - component: 'library-collection-edit-dialog', - elementId: 'library-collection-edit-button', - data: {_id: this.$route.params.id}, - }); - }, + editLibraryCollection() { + this.$store.commit('pushDialogStack', { + component: 'library-collection-edit-dialog', + elementId: 'library-collection-edit-button', + data: { _id: this.$route.params.id }, + }); + }, }, } diff --git a/app/imports/ui/library/LibraryContentsContainer.vue b/app/imports/ui/library/LibraryContentsContainer.vue index f30e30fb..1e70fa07 100644 --- a/app/imports/ui/library/LibraryContentsContainer.vue +++ b/app/imports/ui/library/LibraryContentsContainer.vue @@ -1,7 +1,5 @@ - + + diff --git a/app/imports/ui/library/SingleLibraryToolbar.vue b/app/imports/ui/library/SingleLibraryToolbar.vue index fc953903..c3404d8f 100644 --- a/app/imports/ui/library/SingleLibraryToolbar.vue +++ b/app/imports/ui/library/SingleLibraryToolbar.vue @@ -43,24 +43,26 @@ import { assertDocEditPermission } from '/imports/api/sharing/sharingPermissions import { mapMutations } from 'vuex'; export default { - data(){ return { - loading: false, - }}, + data() { + return { + loading: false, + } + }, meteor: { - library(){ + library() { return Libraries.findOne(this.$route.params.id); }, - subscribed(){ + subscribed() { let libraryId = this.$route.params.id; let user = Meteor.user(); return user?.subscribedLibraries?.includes(libraryId); }, - showSubscribeButton(){ + showSubscribeButton() { let user = Meteor.user(); let library = this.library; if (!user || !library) return; let userId = user._id; - if (user.subscribedLibraries.includes(library._id)){ + if (user.subscribedLibraries.includes(library._id)) { return true } else if ( library.readers.includes(userId) || @@ -72,7 +74,7 @@ export default { return true; } }, - canEdit(){ + canEdit() { try { assertDocEditPermission(this.library, Meteor.userId()); return true @@ -85,7 +87,7 @@ export default { ...mapMutations([ 'toggleDrawer', ]), - subscribe(value){ + subscribe(value) { this.loading = true; Meteor.users.subscribeToLibrary.call({ libraryId: this.$route.params.id, @@ -94,16 +96,17 @@ export default { this.loading = false; }); }, - editLibrary(){ - this.$store.commit('pushDialogStack', { - component: 'library-edit-dialog', - elementId: 'library-edit-button', - data: {_id: this.$route.params.id}, - }); - }, + editLibrary() { + this.$store.commit('pushDialogStack', { + component: 'library-edit-dialog', + elementId: 'library-edit-button', + data: { _id: this.$route.params.id }, + }); + }, }, } diff --git a/app/imports/ui/pages/CharacterSheetPage.vue b/app/imports/ui/pages/CharacterSheetPage.vue index c21908db..a2346e36 100644 --- a/app/imports/ui/pages/CharacterSheetPage.vue +++ b/app/imports/ui/pages/CharacterSheetPage.vue @@ -8,8 +8,8 @@ diff --git a/app/imports/ui/pages/Documentation.vue b/app/imports/ui/pages/Documentation.vue index 8a0acb10..c94fe41f 100644 --- a/app/imports/ui/pages/Documentation.vue +++ b/app/imports/ui/pages/Documentation.vue @@ -37,9 +37,9 @@ import Docs from '/imports/api/docs/Docs.js'; import { propsByDocsPath } from '/imports/constants/PROPERTIES.js'; export default { - components: { + components: { MarkdownText, - }, + }, data() { return { action: undefined, @@ -54,21 +54,21 @@ export default { }, title() { if (this.prop) { - return this.prop.name + ' Docs'; - } else { - const titleCase = this.path.replace( - /(\w*)(\W+)/g, - function(txt, word) { - return word.charAt(0).toUpperCase() + word.substr(1).toLowerCase() + ' '; - } - ); - return titleCase || 'DiceCloud Docs'; - } + return this.prop.name + ' Docs'; + } else { + const titleCase = this.path.replace( + /(\w*)(\W+)/g, + function (txt, word) { + return word.charAt(0).toUpperCase() + word.substr(1).toLowerCase() + ' '; + } + ); + return titleCase || 'DiceCloud Docs'; + } } }, meteor: { $subscribe: { - 'docs'(){ + 'docs'() { return [this.path]; }, }, diff --git a/app/imports/ui/pages/Home.vue b/app/imports/ui/pages/Home.vue index 171ade01..72642172 100644 --- a/app/imports/ui/pages/Home.vue +++ b/app/imports/ui/pages/Home.vue @@ -132,17 +132,17 @@ diff --git a/app/imports/ui/pages/SignIn.vue b/app/imports/ui/pages/SignIn.vue index 87f83356..a1a0ba2e 100644 --- a/app/imports/ui/pages/SignIn.vue +++ b/app/imports/ui/pages/SignIn.vue @@ -91,53 +91,53 @@ diff --git a/app/imports/ui/properties/components/actions/ActionCard.vue b/app/imports/ui/properties/components/actions/ActionCard.vue index 50f22c18..cf204d71 100644 --- a/app/imports/ui/properties/components/actions/ActionCard.vue +++ b/app/imports/ui/properties/components/actions/ActionCard.vue @@ -38,9 +38,7 @@ :disabled="model.insufficientResources || !context.editPermission" @click.stop="doAction" > - +
-
+
{{ model.name || propertyName }}
@@ -89,9 +85,7 @@ /> 3; }, - propertyName(){ + propertyName() { return getPropertyName(this.model.type); }, cardClasses() { @@ -173,12 +169,12 @@ export default { actionTypeIcon() { return `$vuetify.icons.${this.model.actionType}`; }, - }, + }, methods: { - click(e){ - this.$emit('click', e); - }, - doAction({advantage}){ + click(e) { + this.$emit('click', e); + }, + doAction({ advantage }) { this.doActionLoading = true; this.shwing(); doAction.call({ @@ -188,13 +184,13 @@ export default { } }, error => { this.doActionLoading = false; - if (error){ + if (error) { console.error(error); - snackbar({text: error.reason}); + snackbar({ text: error.reason }); } }); }, - shwing(){ + shwing() { this.activated = true; setTimeout(() => { this.activated = undefined; @@ -209,9 +205,11 @@ export default { transition: box-shadow .4s cubic-bezier(0.25, 0.8, 0.25, 1), transform 0.075s ease; } + .action-card.active { transform: scale(0.92); } + .action-title { font-size: 16px; font-weight: 400; @@ -222,9 +220,10 @@ export default { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; - transition: .3s cubic-bezier(.25,.8,.5,1); + transition: .3s cubic-bezier(.25, .8, .5, 1); width: 100%; } + .action-sub-title { color: #9e9e9e; flex-grow: 0; @@ -236,15 +235,19 @@ export default { text-overflow: ellipsis; width: 100%; } + .action-child { height: 32px; } + .theme--light.muted-text { - color: rgba(0,0,0,.3) !important; + color: rgba(0, 0, 0, .3) !important; } + .theme--dark.muted-text { - color: hsla(0,0%,100%,.3) !important; + color: hsla(0, 0%, 100%, .3) !important; } + .action-card { transition: transform 0.15s cubic; } @@ -252,12 +255,14 @@ export default { diff --git a/app/imports/ui/properties/components/attributes/AbilityListTile.vue b/app/imports/ui/properties/components/attributes/AbilityListTile.vue index c4d748da..46d36bb8 100644 --- a/app/imports/ui/properties/components/attributes/AbilityListTile.vue +++ b/app/imports/ui/properties/components/attributes/AbilityListTile.vue @@ -55,7 +55,7 @@ import numberToSignedString from '/imports/ui/utility/numberToSignedString.js'; import RollPopup from '/imports/ui/components/RollPopup.vue'; import doCheck from '/imports/api/engine/actions/doCheck.js'; -import {snackbar} from '/imports/ui/components/snackbars/SnackbarQueue.js'; +import { snackbar } from '/imports/ui/components/snackbars/SnackbarQueue.js'; export default { components: { @@ -66,23 +66,25 @@ export default { default: {}, }, }, - props: { - model: {type: Object, required: true}, - }, - data(){return { - checkLoading: false, - }}, - computed: { - hasClickListener(){ + props: { + model: { type: Object, required: true }, + }, + data() { + return { + checkLoading: false, + } + }, + computed: { + hasClickListener() { return this.$listeners && this.$listeners.click - }, - }, - methods: { - numberToSignedString, - click(e){ - this.$emit('click', e); - }, - check({advantage}){ + }, + }, + methods: { + numberToSignedString, + click(e) { + this.$emit('click', e); + }, + check({ advantage }) { this.checkLoading = true; doCheck.call({ propId: this.model._id, @@ -91,15 +93,15 @@ export default { }, }, error => { this.checkLoading = false; - if (error){ + if (error) { console.error(error); - snackbar({text: error.reason}); + snackbar({ text: error.reason }); } }); }, - }, + }, meteor: { - swapScoresAndMods(){ + swapScoresAndMods() { let user = Meteor.user(); return user && user.preferences && @@ -110,26 +112,32 @@ export default { diff --git a/app/imports/ui/properties/components/attributes/HealthBar.vue b/app/imports/ui/properties/components/attributes/HealthBar.vue index ae9b3bce..da4bbb7d 100644 --- a/app/imports/ui/properties/components/attributes/HealthBar.vue +++ b/app/imports/ui/properties/components/attributes/HealthBar.vue @@ -104,9 +104,18 @@ export default { }, }, props: { - value: Number, - maxValue: Number, - name: String, + value: { + type: Number, + default: undefined, + }, + maxValue: { + type: Number, + default: undefined, + }, + name: { + type: String, + default: undefined, + }, color: { type: String, default() { @@ -139,22 +148,22 @@ export default { barColor() { const fraction = this.value / this.maxValue; if (!Number.isFinite(fraction)) return this.color; - if (fraction > 0.5){ + if (fraction > 0.5) { return this.color; } else if (this.midColor && this.lowColor) { return chroma.mix(this.lowColor, this.midColor, fraction * 2).hex(); - } else if (this.midColor){ + } else if (this.midColor) { return this.midColor; } return this.color; }, - barBackgroundColor(){ + barBackgroundColor() { return chroma(this.barColor) - .darken(1.5) - .desaturate(1.5) - .hex(); + .darken(1.5) + .desaturate(1.5) + .hex(); }, - isTextLight(){ + isTextLight() { return isDarkColor(this.barBackgroundColor); /* Change color at the halfway mark const fraction = this.value / this.maxValue; @@ -173,7 +182,7 @@ export default { cancelEdit() { this.editing = false; }, - changeIncrementMenu(e){ + changeIncrementMenu(e) { this.$emit('change', e); this.editing = false; } @@ -193,70 +202,85 @@ export default { diff --git a/app/imports/ui/properties/components/attributes/HealthBarCard.vue b/app/imports/ui/properties/components/attributes/HealthBarCard.vue index f05c7978..c3409ee0 100644 --- a/app/imports/ui/properties/components/attributes/HealthBarCard.vue +++ b/app/imports/ui/properties/components/attributes/HealthBarCard.vue @@ -17,17 +17,17 @@ diff --git a/app/imports/ui/properties/components/attributes/HealthBarCardContainer.vue b/app/imports/ui/properties/components/attributes/HealthBarCardContainer.vue index 9b8440e7..639beee0 100644 --- a/app/imports/ui/properties/components/attributes/HealthBarCardContainer.vue +++ b/app/imports/ui/properties/components/attributes/HealthBarCardContainer.vue @@ -12,60 +12,60 @@ diff --git a/app/imports/ui/properties/components/attributes/HitDiceListTile.vue b/app/imports/ui/properties/components/attributes/HitDiceListTile.vue index e26f1abd..7cfff667 100644 --- a/app/imports/ui/properties/components/attributes/HitDiceListTile.vue +++ b/app/imports/ui/properties/components/attributes/HitDiceListTile.vue @@ -31,9 +31,7 @@ - +
{{ model.value }}
@@ -63,60 +61,71 @@ export default { inject: { context: { default: {} } }, - props: { + props: { model: { type: Object, required: true, } - }, - data(){ return{ - hover: false, - }}, + }, + data() { + return { + hover: false, + } + }, computed: { - signedConMod(){ + signedConMod() { return numberToSignedString(this.model.constitutionMod); }, }, - methods: { - click(e){ - this.$emit('click', e); - }, - increment(value){ - this.$emit('change', {type: 'increment', value}) - }, - }, + methods: { + click(e) { + this.$emit('click', e); + }, + increment(value) { + this.$emit('change', { type: 'increment', value }) + }, + }, }; diff --git a/app/imports/ui/properties/components/attributes/ResourceCard.vue b/app/imports/ui/properties/components/attributes/ResourceCard.vue index 44390756..c5759892 100644 --- a/app/imports/ui/properties/components/attributes/ResourceCard.vue +++ b/app/imports/ui/properties/components/attributes/ResourceCard.vue @@ -22,9 +22,7 @@ mdi-chevron-down
-
+
{{ model.value }}
@@ -53,55 +51,64 @@ diff --git a/app/imports/ui/properties/components/attributes/SpellSlotListTile.vue b/app/imports/ui/properties/components/attributes/SpellSlotListTile.vue index 02afc030..584fc765 100644 --- a/app/imports/ui/properties/components/attributes/SpellSlotListTile.vue +++ b/app/imports/ui/properties/components/attributes/SpellSlotListTile.vue @@ -7,9 +7,7 @@ v-on="hasClickListener ? {click} : {}" > - +
import numberToSignedString from '/imports/ui/utility/numberToSignedString.js'; export default { - props: { - model: { + props: { + model: { type: Object, required: true, }, dark: Boolean, hideCastButton: Boolean, disabled: Boolean, - }, - computed: { - hasClickListener(){ + }, + computed: { + hasClickListener() { return this.$listeners && !!this.$listeners.click; }, - }, - methods: { - signed: numberToSignedString, - click(e){ - this.$emit('click', e); - }, - }, + }, + methods: { + signed: numberToSignedString, + click(e) { + this.$emit('click', e); + }, + }, }; diff --git a/app/imports/ui/properties/components/inventory/ContainerCard.vue b/app/imports/ui/properties/components/inventory/ContainerCard.vue index 6d862b60..0843dcfd 100644 --- a/app/imports/ui/properties/components/inventory/ContainerCard.vue +++ b/app/imports/ui/properties/components/inventory/ContainerCard.vue @@ -30,9 +30,7 @@ > $vuetify.icons.two_coins - + @@ -52,57 +50,57 @@ import CoinValue from '/imports/ui/components/CoinValue.vue'; import stripFloatingPointOddities from '/imports/api/engine/computation/utility/stripFloatingPointOddities.js'; export default { - components: { - ToolbarCard, + components: { + ToolbarCard, ItemList, CoinValue, - }, - props: { - model: { + }, + props: { + model: { type: Object, required: true, }, - }, + }, computed: { - weight(){ + weight() { const contentWeight = this.model.contentsWeightless ? 0 : this.model.contentsWeight || 0; const ownWeight = this.model.weight || 0; return stripFloatingPointOddities(contentWeight + ownWeight); }, - value(){ + value() { const contentValue = this.model.contentsValue || 0; const ownValue = this.model.value || 0; return contentValue + ownValue; } }, - methods: { - clickContainer(_id){ - this.$store.commit('pushDialogStack', { - component: 'creature-property-dialog', - elementId: `${_id}`, - data: {_id}, - }); - }, - clickProperty(_id){ - this.$store.commit('pushDialogStack', { - component: 'creature-property-dialog', - elementId: `tree-node-${_id}`, - data: {_id}, - }); - }, - }, + methods: { + clickContainer(_id) { + this.$store.commit('pushDialogStack', { + component: 'creature-property-dialog', + elementId: `${_id}`, + data: { _id }, + }); + }, + clickProperty(_id) { + this.$store.commit('pushDialogStack', { + component: 'creature-property-dialog', + elementId: `tree-node-${_id}`, + data: { _id }, + }); + }, + }, meteor: { - items(){ + items() { return CreatureProperties.find({ 'parent.id': this.model._id, - type: {$in: ['item', 'container']}, - removed: {$ne: true}, - equipped: {$ne: true}, - deactivatedByAncestor: {$ne: true}, + type: { $in: ['item', 'container'] }, + removed: { $ne: true }, + equipped: { $ne: true }, + deactivatedByAncestor: { $ne: true }, }, { - sort: {order: 1}, + sort: { order: 1 }, }); }, } @@ -110,4 +108,5 @@ export default { diff --git a/app/imports/ui/properties/components/inventory/ItemList.vue b/app/imports/ui/properties/components/inventory/ItemList.vue index 6696ee12..28a07995 100644 --- a/app/imports/ui/properties/components/inventory/ItemList.vue +++ b/app/imports/ui/properties/components/inventory/ItemList.vue @@ -52,40 +52,42 @@ export default { preparingSpells: Boolean, equipment: Boolean, }, - data(){ return { - dataItems: [], - }}, + data() { + return { + dataItems: [], + } + }, computed: { - levels(){ + levels() { let levels = new Set(); this.items.forEach(item => levels.add(item.level)); return levels; }, }, watch: { - items(value){ + items(value) { this.dataItems = value; } }, - mounted(){ + mounted() { this.dataItems = this.items; }, methods: { - clickProperty(_id){ - this.$store.commit('pushDialogStack', { - component: 'creature-property-dialog', - elementId: _id, - data: {_id}, - }); - }, - change({added, moved}){ + clickProperty(_id) { + this.$store.commit('pushDialogStack', { + component: 'creature-property-dialog', + elementId: _id, + data: { _id }, + }); + }, + change({ added, moved }) { let event = added || moved; - if (event){ + if (event) { // If this item is now adjacent to another, set the order accordingly let order; let before = this.dataItems[event.newIndex - 1]; let after = this.dataItems[event.newIndex + 1]; - if (before && before._id){ + if (before && before._id) { order = before.order + 0.5; } else if (after && after._id) { order = after.order - 0.5; @@ -101,7 +103,7 @@ export default { parentRef: this.parentRef, order, }); - if (doc.type === 'item' && doc.equipped != this.equipment){ + if (doc.type === 'item' && doc.equipped != this.equipment) { updateCreatureProperty.call({ _id: doc._id, path: ['equipped'], @@ -111,6 +113,6 @@ export default { } setTimeout(() => this.dataItems = this.items, 0); }, - } + } } diff --git a/app/imports/ui/properties/components/inventory/ItemListTile.vue b/app/imports/ui/properties/components/inventory/ItemListTile.vue index d6e64249..5dfa1b8e 100644 --- a/app/imports/ui/properties/components/inventory/ItemListTile.vue +++ b/app/imports/ui/properties/components/inventory/ItemListTile.vue @@ -49,10 +49,10 @@ import treeNodeViewMixin from '/imports/ui/properties/treeNodeViews/treeNodeView import PROPERTIES from '/imports/constants/PROPERTIES.js'; import adjustQuantity from '/imports/api/creature/creatureProperties/methods/adjustQuantity.js'; import IncrementButton from '/imports/ui/components/IncrementButton.vue'; -import {snackbar} from '/imports/ui/components/snackbars/SnackbarQueue.js'; +import { snackbar } from '/imports/ui/components/snackbars/SnackbarQueue.js'; export default { - components:{ + components: { IncrementButton, }, mixins: [treeNodeViewMixin], @@ -62,20 +62,22 @@ export default { props: { preparingSpells: Boolean, }, - data(){return { - incrementLoading: false, - }}, + data() { + return { + incrementLoading: false, + } + }, computed: { - hasClickListener(){ + hasClickListener() { return this.$listeners && !!this.$listeners.click; }, - title(){ + title() { let model = this.model; if (!model) return; - if (model.quantity !== 1){ - if (model.plural){ + if (model.quantity !== 1) { + if (model.plural) { return `${model.quantity} ${model.plural}`; - } else if (model.name){ + } else if (model.name) { return `${model.quantity} ${model.name}`; } } else if (model.name) { @@ -86,10 +88,10 @@ export default { } }, methods: { - click(e){ - this.$emit('click', e); - }, - changeQuantity({type, value}) { + click(e) { + this.$emit('click', e); + }, + changeQuantity({ type, value }) { this.incrementLoading = true; adjustQuantity.call({ _id: this.model._id, @@ -97,8 +99,8 @@ export default { value: value }, error => { this.incrementLoading = false; - if (error){ - snackbar({text: error.reason}); + if (error) { + snackbar({ text: error.reason }); console.error(error); } }); @@ -111,6 +113,7 @@ export default { .item-avatar { min-width: 32px; } + .item { background-color: inherit; } diff --git a/app/imports/ui/properties/components/persona/NoteCard.vue b/app/imports/ui/properties/components/persona/NoteCard.vue index f3be2a0e..d07afa1e 100644 --- a/app/imports/ui/properties/components/persona/NoteCard.vue +++ b/app/imports/ui/properties/components/persona/NoteCard.vue @@ -31,10 +31,10 @@ import isDarkColor from '/imports/ui/utility/isDarkColor.js'; import CardHighlight from '/imports/ui/components/CardHighlight.vue'; export default { - components: { - PropertyDescription, + components: { + PropertyDescription, CardHighlight, - }, + }, inject: { theme: { default: { @@ -42,31 +42,34 @@ export default { }, }, }, - props: { - model: { + props: { + model: { type: Object, required: true, }, - }, - data(){ return{ - hover: false, - }}, + }, + data() { + return { + hover: false, + } + }, computed: { - isDark(){ + isDark() { return isDarkColor(this.model.color); }, }, - methods: { - clickProperty(_id){ - this.$store.commit('pushDialogStack', { - component: 'creature-property-dialog', - elementId: `${_id}`, - data: {_id}, - }); - }, - }, + methods: { + clickProperty(_id) { + this.$store.commit('pushDialogStack', { + component: 'creature-property-dialog', + elementId: `${_id}`, + data: { _id }, + }); + }, + }, }; diff --git a/app/imports/ui/properties/components/skills/SkillListTile.vue b/app/imports/ui/properties/components/skills/SkillListTile.vue index e24ece45..bbcb773e 100644 --- a/app/imports/ui/properties/components/skills/SkillListTile.vue +++ b/app/imports/ui/properties/components/skills/SkillListTile.vue @@ -62,7 +62,7 @@ import numberToSignedString from '/imports/ui/utility/numberToSignedString.js'; import ProficiencyIcon from '/imports/ui/properties/shared/ProficiencyIcon.vue'; import RollPopup from '/imports/ui/components/RollPopup.vue'; import doCheck from '/imports/api/engine/actions/doCheck.js'; -import {snackbar} from '/imports/ui/components/snackbars/SnackbarQueue.js'; +import { snackbar } from '/imports/ui/components/snackbars/SnackbarQueue.js'; export default { components: { @@ -74,37 +74,39 @@ export default { default: {}, }, }, - props: { + props: { model: { type: Object, required: true, }, hideModifier: Boolean, - }, - data(){return { - checkLoading: false, - }}, - computed: { - displayedModifier(){ - let mod = this.model.value; - if (this.model.fail){ - return 'fail'; - } else { - return numberToSignedString(mod); - } - }, - hasClickListener(){ + }, + data() { + return { + checkLoading: false, + } + }, + computed: { + displayedModifier() { + let mod = this.model.value; + if (this.model.fail) { + return 'fail'; + } else { + return numberToSignedString(mod); + } + }, + hasClickListener() { return this.$listeners && this.$listeners.click - }, - passiveScore(){ + }, + passiveScore() { return 10 + this.model.value + this.model.passiveBonus; } - }, - methods: { - click(e){ - this.$emit('click', e); - }, - check({advantage}){ + }, + methods: { + click(e) { + this.$emit('click', e); + }, + check({ advantage }) { this.checkLoading = true; doCheck.call({ propId: this.model._id, @@ -113,24 +115,26 @@ export default { }, }, error => { this.checkLoading = false; - if (error){ + if (error) { console.error(error); - snackbar({text: error.reason}); + snackbar({ text: error.reason }); } }); }, - } + } } diff --git a/app/imports/ui/properties/components/spells/CastSpellWithSlotDialog.vue b/app/imports/ui/properties/components/spells/CastSpellWithSlotDialog.vue index c3ec9a92..cf9cf288 100644 --- a/app/imports/ui/properties/components/spells/CastSpellWithSlotDialog.vue +++ b/app/imports/ui/properties/components/spells/CastSpellWithSlotDialog.vue @@ -184,10 +184,10 @@ import { find } from 'lodash'; const slotFilter = { type: 'attribute', attributeType: 'spellSlot', - removed: {$ne: true}, - inactive: {$ne: true}, - overridden: {$ne: true}, - 'spellSlotLevel.value': {$gte: 1}, + removed: { $ne: true }, + inactive: { $ne: true }, + overridden: { $ne: true }, + 'spellSlotLevel.value': { $gte: 1 }, }; export default { @@ -212,36 +212,38 @@ export default { default: undefined, }, }, - data(){ return { - searchString: undefined, - selectedSlotId: this.slotId, - selectedSpellId: this.spellId, - selectedSlot: undefined, - selectedSpell: undefined, - searchValue: undefined, - searchError: undefined, - filterMenuOpen: false, - booleanFilters: { - verbal: {name: 'Verbal', enabled: false, value: false}, - somatic: {name: 'Somatic', enabled: false, value: false}, - material: {name: 'Material', enabled: false, value: false}, - concentration: {name: 'Concentration', enabled: false, value: false}, - ritual: {name: 'Ritual', enabled: false, value: false}, - }, - }}, + data() { + return { + searchString: undefined, + selectedSlotId: this.slotId, + selectedSpellId: this.spellId, + selectedSlot: undefined, + selectedSpell: undefined, + searchValue: undefined, + searchError: undefined, + filterMenuOpen: false, + booleanFilters: { + verbal: { name: 'Verbal', enabled: false, value: false }, + somatic: { name: 'Somatic', enabled: false, value: false }, + material: { name: 'Material', enabled: false, value: false }, + concentration: { name: 'Concentration', enabled: false, value: false }, + ritual: { name: 'Ritual', enabled: false, value: false }, + }, + } + }, computed: { - computedSpells(){ + computedSpells() { return spellsWithSubheaders(this.spells); }, - canCast(){ + canCast() { if (!this.selectedSpell || !this.selectedSlotId) return false; return this.canCastSpellWithSlot( this.selectedSpell, this.selectedSlotId, this.selectedSlot ); }, - filtersApplied(){ - for (let key in this.booleanFilters){ - if (this.booleanFilters[key].enabled){ + filtersApplied() { + for (let key in this.booleanFilters) { + if (this.booleanFilters[key].enabled) { return true; } } @@ -250,15 +252,15 @@ export default { }, watch: { selectedSpellId: { - handler(spellId){ + handler(spellId) { this.selectedSpell = CreatureProperties.findOne(spellId) }, immediate: true }, selectedSpell: { - handler(spell){ + handler(spell) { if (!spell) return; - if(spell.level === 0 || spell.castWithoutSpellSlots){ + if (spell.level === 0 || spell.castWithoutSpellSlots) { this.selectedSlotId = 'no-slot'; } else if ( !this.selectedSlotId || @@ -270,13 +272,13 @@ export default { 'ancestors.id': this.creatureId, ...slotFilter }, { - sort: {'spellSlotLevel.value': 1, order: 1}, + sort: { 'spellSlotLevel.value': 1, order: 1 }, }).fetch(), slot => { return this.canCastSpellWithSlot(spell, slot._id, slot) } ); - if (newSlot){ + if (newSlot) { this.selectedSlotId = newSlot._id; } } @@ -284,45 +286,45 @@ export default { immediate: true, }, selectedSlotId: { - handler(slotId){ + handler(slotId) { this.selectedSlot = CreatureProperties.findOne(slotId); }, immediate: true }, - selectedSlot:{ - handler(slot){ + selectedSlot: { + handler(slot) { if (!slot) return; if (!this.selectedSpell) return; - if(this.selectedSpell.level > slot.spellSlotLevel.value){ + if (this.selectedSpell.level > slot.spellSlotLevel.value) { this.selectedSpellId = undefined; } }, immediate: true, }, }, - mounted(){ - if (this.selectedSpellId){ - this.$vuetify.goTo('.spell.v-list-item--active', {container: '.right'}); + mounted() { + if (this.selectedSpellId) { + this.$vuetify.goTo('.spell.v-list-item--active', { container: '.right' }); } }, methods: { - clearBooleanFilters(){ - for (let key in this.booleanFilters){ + clearBooleanFilters() { + for (let key in this.booleanFilters) { this.booleanFilters[key].enabled = false; } }, - spellDialog(_id){ + spellDialog(_id) { this.$store.commit('pushDialogStack', { - component: 'creature-property-dialog', - elementId: `spell-info-btn-${_id}`, - data: {_id}, - }); + component: 'creature-property-dialog', + elementId: `spell-info-btn-${_id}`, + data: { _id }, + }); }, - searchChanged(val, ack){ + searchChanged(val, ack) { this.searchValue = val; setTimeout(ack, 200); }, - canCastSpellWithSlot(spell, slotId, slot){ + canCastSpellWithSlot(spell, slotId, slot) { if (slot && !slot.value) return false; if (!spell) return true; if (!slotId) return true; @@ -341,7 +343,7 @@ export default { ) ) }, - cast({advantage}){ + cast({ advantage }) { let selectedSlotId = this.selectedSlotId; if (selectedSlotId === 'no-slot') selectedSlotId = undefined; this.$store.dispatch('popDialogStack', { @@ -352,45 +354,45 @@ export default { } }, meteor: { - spells(){ + spells() { let filter = { 'ancestors.id': this.creatureId, - removed: {$ne: true}, - inactive: {$ne: true}, + removed: { $ne: true }, + inactive: { $ne: true }, $or: [ - {prepared: true}, - {alwaysPrepared: true}, + { prepared: true }, + { alwaysPrepared: true }, ], }; // Apply the filters from the filter menu - for (let key in this.booleanFilters){ - if (this.booleanFilters[key].enabled){ + for (let key in this.booleanFilters) { + if (this.booleanFilters[key].enabled) { let value = this.booleanFilters[key].value; - if (key === 'material'){ - filter[key] = {$exists: this.booleanFilters[key].value}; + if (key === 'material') { + filter[key] = { $exists: this.booleanFilters[key].value }; } else { - filter[key] = value ? true: {$ne: true}; + filter[key] = value ? true : { $ne: true }; } } } // Apply the search string to the name field - if (this.searchValue){ + if (this.searchValue) { filter.name = { $regex: this.searchValue.replace(/[-/\\^$*+?.()|[\]{}]/g, '\\$&'), $options: 'i' }; } return CreatureProperties.find(filter, { - sort: {order: 1} + sort: { order: 1 } }); }, - spellSlots(){ + spellSlots() { return CreatureProperties.find({ 'ancestors.id': this.creatureId, ...slotFilter }, { - sort: {'spellSlotLevel.value': 1, order: 1}, + sort: { 'spellSlotLevel.value': 1, order: 1 }, }); }, }, @@ -398,10 +400,11 @@ export default { diff --git a/app/imports/ui/properties/components/spells/SpellList.vue b/app/imports/ui/properties/components/spells/SpellList.vue index 3d1d6333..50f70bfc 100644 --- a/app/imports/ui/properties/components/spells/SpellList.vue +++ b/app/imports/ui/properties/components/spells/SpellList.vue @@ -62,48 +62,50 @@ export default { }, preparingSpells: Boolean, }, - data(){ return { - dataSpells: [], - }}, + data() { + return { + dataSpells: [], + } + }, computed: { - levels(){ + levels() { let levels = new Set(); this.spells.forEach(spell => levels.add(spell.level)); return levels; }, computedSpells: { - get(){ + get() { return spellsWithSubheaders(this.dataSpells); }, - set(value){ + set(value) { this.dataSpells = value; }, } }, watch: { - spells(value){ + spells(value) { this.dataSpells = spellsWithSubheaders(value); } }, - mounted(){ + mounted() { this.dataSpells = spellsWithSubheaders(this.spells); }, methods: { - clickProperty(_id){ - this.$store.commit('pushDialogStack', { - component: 'creature-property-dialog', - elementId: `spell-list-tile-${_id}`, - data: {_id}, - }); - }, - change({added, moved}){ + clickProperty(_id) { + this.$store.commit('pushDialogStack', { + component: 'creature-property-dialog', + elementId: `spell-list-tile-${_id}`, + data: { _id }, + }); + }, + change({ added, moved }) { let event = added || moved; - if (event){ + if (event) { // If this spell is now adjacent to another, set the order accordingly let order; let before = this.dataSpells[event.newIndex - 1]; let after = this.dataSpells[event.newIndex + 1]; - if (before && before._id){ + if (before && before._id) { order = before.order + 0.5; } else if (after && after._id) { order = after.order - 0.5; @@ -121,9 +123,10 @@ export default { }); } }, - } + } } diff --git a/app/imports/ui/properties/components/spells/SpellListCard.vue b/app/imports/ui/properties/components/spells/SpellListCard.vue index c45c7cc3..4dd5edc4 100644 --- a/app/imports/ui/properties/components/spells/SpellListCard.vue +++ b/app/imports/ui/properties/components/spells/SpellListCard.vue @@ -63,32 +63,34 @@ import SpellList from '/imports/ui/properties/components/spells/SpellList.vue'; import CreatureProperties from '/imports/api/creature/creatureProperties/CreatureProperties.js'; export default { - components: { - ToolbarCard, + components: { + ToolbarCard, SpellList, - }, - props: { - model: { + }, + props: { + model: { type: Object, required: true, }, - organize: Boolean, - }, - data(){ return { - preparingSpells: false, - }}, + organize: Boolean, + }, + data() { + return { + preparingSpells: false, + } + }, meteor: { - spells(){ + spells() { let filter = { 'ancestors.id': this.model._id, type: 'spell', - removed: {$ne: true}, + removed: { $ne: true }, }; - if (this.preparingSpells){ - filter.deactivatedByAncestor = {$ne: true}; - filter.deactivatedByToggle = {$ne: true}; + if (this.preparingSpells) { + filter.deactivatedByAncestor = { $ne: true }; + filter.deactivatedByToggle = { $ne: true }; } else { - filter.inactive = {$ne: true}; + filter.inactive = { $ne: true }; } return CreatureProperties.find(filter, { sort: { @@ -97,35 +99,36 @@ export default { } }); }, - numPrepared(){ + numPrepared() { return CreatureProperties.find({ 'ancestors.id': this.model._id, type: 'spell', - removed: {$ne: true}, + removed: { $ne: true }, prepared: true, - alwaysPrepared: {$ne: true}, - deactivatedByAncestor: {$ne: true}, - deactivatedByToggle: {$ne: true}, + alwaysPrepared: { $ne: true }, + deactivatedByAncestor: { $ne: true }, + deactivatedByToggle: { $ne: true }, }).count(); }, - preparedError(){ + preparedError() { if (!this.model.maxPrepared) return; let numPrepared = this.numPrepared; let maxPrepared = this.model.maxPrepared.value || 0; return numPrepared !== maxPrepared }, }, - methods: { - clickSpellList(_id){ - this.$store.commit('pushDialogStack', { - component: 'creature-property-dialog', - elementId: `${_id}`, - data: {_id}, - }); - }, - } + methods: { + clickSpellList(_id) { + this.$store.commit('pushDialogStack', { + component: 'creature-property-dialog', + elementId: `${_id}`, + data: { _id }, + }); + }, + } }; diff --git a/app/imports/ui/properties/components/spells/SpellListTile.vue b/app/imports/ui/properties/components/spells/SpellListTile.vue index 1e6af252..20122630 100644 --- a/app/imports/ui/properties/components/spells/SpellListTile.vue +++ b/app/imports/ui/properties/components/spells/SpellListTile.vue @@ -67,10 +67,10 @@ export default { disabled: Boolean, }, computed: { - hasClickListener(){ + hasClickListener() { return this.$listeners && !!this.$listeners.click; }, - spellComponents(){ + spellComponents() { let components = []; if (this.model.ritual) components.push('R'); if (this.model.concentration) components.push('C'); @@ -81,10 +81,10 @@ export default { }, }, methods: { - click(e){ - this.$emit('click', e); - }, - setPrepared(val, ack){ + click(e) { + this.$emit('click', e); + }, + setPrepared(val, ack) { updateCreatureProperty.call({ _id: this.model._id, path: ['prepared'], @@ -99,13 +99,17 @@ export default { .spell-avatar { min-width: 32px; } + .spell { background-color: inherit; } -.primary--text .v-icon, .primary--text .v-list__tile__sub-title { + +.primary--text .v-icon, +.primary--text .v-list__tile__sub-title { color: #b71c1c } -.theme--light.info-icon{ - color: rgba(0,0,0,.54) !important; + +.theme--light.info-icon { + color: rgba(0, 0, 0, .54) !important; } diff --git a/app/imports/ui/properties/forms/AdjustmentForm.vue b/app/imports/ui/properties/forms/AdjustmentForm.vue index 94d419c4..31712722 100644 --- a/app/imports/ui/properties/forms/AdjustmentForm.vue +++ b/app/imports/ui/properties/forms/AdjustmentForm.vue @@ -81,60 +81,63 @@ import propertyFormMixin from '/imports/ui/properties/forms/shared/propertyFormM export default { mixins: [propertyFormMixin, attributeListMixin], - props: { - parentTarget: { - type: String, + props: { + parentTarget: { + type: String, default: undefined, - }, - }, - data(){return { - adjustmentOps: [ - {text: 'Damage', value: 'increment'}, - {text: 'Set', value: 'set'}, - ], - damageHint: 'The amount of damage to apply to the selected stat, can be a calculation or roll. Negative values will restore the selected from previous damage. If the operation is set, this is the final value of the stat instead.', - setHint: 'The value of the stat after applying this adjustment. The stat\'s value can\'t exceed its total', - }}, - computed: { - targetOptions(){ - if (this.parentTarget === 'singleTarget') { - return [ - { - text: 'Self', - value: 'self', - }, { - text: 'Target', - value: 'every', - }, - ]; - } else { - return [ - { - text: 'Self', - value: 'self', - }, { - text: 'Target', - value: 'target', - }, - ]; - } - }, - targetOptionHint(){ - let hints = { - self: 'The damage will be applied to the character\'s own attribute when taking the action', - target: 'The damage will be applied to the target of the action', - each: 'The damage will be rolled separately for each of the targets of the action', - every: 'The damage will be rolled once and applied to each of the targets of the action', - }; - if (this.parentTarget === 'singleTarget'){ - hints.each = hints.target; - hints.every = hints.target; - } - return hints[this.model.target]; - } - }, + }, + }, + data() { + return { + adjustmentOps: [ + { text: 'Damage', value: 'increment' }, + { text: 'Set', value: 'set' }, + ], + damageHint: 'The amount of damage to apply to the selected stat, can be a calculation or roll. Negative values will restore the selected from previous damage. If the operation is set, this is the final value of the stat instead.', + setHint: 'The value of the stat after applying this adjustment. The stat\'s value can\'t exceed its total', + } + }, + computed: { + targetOptions() { + if (this.parentTarget === 'singleTarget') { + return [ + { + text: 'Self', + value: 'self', + }, { + text: 'Target', + value: 'every', + }, + ]; + } else { + return [ + { + text: 'Self', + value: 'self', + }, { + text: 'Target', + value: 'target', + }, + ]; + } + }, + targetOptionHint() { + let hints = { + self: 'The damage will be applied to the character\'s own attribute when taking the action', + target: 'The damage will be applied to the target of the action', + each: 'The damage will be rolled separately for each of the targets of the action', + every: 'The damage will be rolled once and applied to each of the targets of the action', + }; + if (this.parentTarget === 'singleTarget') { + hints.each = hints.target; + hints.every = hints.target; + } + return hints[this.model.target]; + } + }, } diff --git a/app/imports/ui/properties/forms/AttributeForm.vue b/app/imports/ui/properties/forms/AttributeForm.vue index 0b23d1df..42814d86 100644 --- a/app/imports/ui/properties/forms/AttributeForm.vue +++ b/app/imports/ui/properties/forms/AttributeForm.vue @@ -140,9 +140,7 @@ - + diff --git a/app/imports/ui/properties/forms/AttributesConsumedListForm.vue b/app/imports/ui/properties/forms/AttributesConsumedListForm.vue index b0a847de..97ff2d81 100644 --- a/app/imports/ui/properties/forms/AttributesConsumedListForm.vue +++ b/app/imports/ui/properties/forms/AttributesConsumedListForm.vue @@ -29,13 +29,13 @@ diff --git a/app/imports/ui/properties/forms/BranchForm.vue b/app/imports/ui/properties/forms/BranchForm.vue index d1aa6ec9..1ad49fb4 100644 --- a/app/imports/ui/properties/forms/BranchForm.vue +++ b/app/imports/ui/properties/forms/BranchForm.vue @@ -54,45 +54,48 @@ diff --git a/app/imports/ui/properties/forms/BuffForm.vue b/app/imports/ui/properties/forms/BuffForm.vue index a7c3b0dd..ade759e4 100644 --- a/app/imports/ui/properties/forms/BuffForm.vue +++ b/app/imports/ui/properties/forms/BuffForm.vue @@ -44,9 +44,7 @@ > - + diff --git a/app/imports/ui/properties/forms/ClassForm.vue b/app/imports/ui/properties/forms/ClassForm.vue index d301b750..f4bd101e 100644 --- a/app/imports/ui/properties/forms/ClassForm.vue +++ b/app/imports/ui/properties/forms/ClassForm.vue @@ -1,8 +1,6 @@ diff --git a/app/imports/ui/properties/forms/ContainerForm.vue b/app/imports/ui/properties/forms/ContainerForm.vue index 78990b4d..58f127e0 100644 --- a/app/imports/ui/properties/forms/ContainerForm.vue +++ b/app/imports/ui/properties/forms/ContainerForm.vue @@ -63,9 +63,7 @@ - + diff --git a/app/imports/ui/properties/forms/DamageForm.vue b/app/imports/ui/properties/forms/DamageForm.vue index 98d92e3d..1faa66f3 100644 --- a/app/imports/ui/properties/forms/DamageForm.vue +++ b/app/imports/ui/properties/forms/DamageForm.vue @@ -76,45 +76,48 @@ import VARIABLE_NAME_REGEX from '/imports/constants/VARIABLE_NAME_REGEX.js'; export default { mixins: [propertyFormMixin], - props: { - parentTarget: { - type: String, + props: { + parentTarget: { + type: String, default: undefined, - }, - }, - data(){return{ - DAMAGE_TYPES, - damageTypeRules: [ - value => { - if (!value) return 'Damage type is required'; - if (!VARIABLE_NAME_REGEX.test(value)){ - return `${value} is not a valid damage name` + }, + }, + data() { + return { + DAMAGE_TYPES, + damageTypeRules: [ + value => { + if (!value) return 'Damage type is required'; + if (!VARIABLE_NAME_REGEX.test(value)) { + return `${value} is not a valid damage name` + } } - } - ], - }}, - computed: { - targetOptions(){ - return [ - { - text: 'Self', - value: 'self', - }, { - text: 'Target', - value: 'target', - }, - ]; - }, - targetOptionHint(){ - let hints = { - self: 'The damage will be applied to the character taking the action', - target: 'The damage will be applied to the target of the action', - }; - return hints[this.model.target]; - } - }, + ], + } + }, + computed: { + targetOptions() { + return [ + { + text: 'Self', + value: 'self', + }, { + text: 'Target', + value: 'target', + }, + ]; + }, + targetOptionHint() { + let hints = { + self: 'The damage will be applied to the character taking the action', + target: 'The damage will be applied to the target of the action', + }; + return hints[this.model.target]; + } + }, } diff --git a/app/imports/ui/properties/forms/DamageMultiplierForm.vue b/app/imports/ui/properties/forms/DamageMultiplierForm.vue index 7705196b..551f1514 100644 --- a/app/imports/ui/properties/forms/DamageMultiplierForm.vue +++ b/app/imports/ui/properties/forms/DamageMultiplierForm.vue @@ -52,9 +52,7 @@ > - + diff --git a/app/imports/ui/properties/forms/EffectForm.vue b/app/imports/ui/properties/forms/EffectForm.vue index 9ef23c9a..694db21d 100644 --- a/app/imports/ui/properties/forms/EffectForm.vue +++ b/app/imports/ui/properties/forms/EffectForm.vue @@ -29,9 +29,7 @@ slot="item" slot-scope="item" > - + {{ getEffectIcon(item.item.value, 1) }} {{ item.item.text }} @@ -157,9 +155,7 @@ - + diff --git a/app/imports/ui/properties/forms/FeatureForm.vue b/app/imports/ui/properties/forms/FeatureForm.vue index cb900962..c3f85735 100644 --- a/app/imports/ui/properties/forms/FeatureForm.vue +++ b/app/imports/ui/properties/forms/FeatureForm.vue @@ -46,49 +46,52 @@ diff --git a/app/imports/ui/properties/forms/FolderForm.vue b/app/imports/ui/properties/forms/FolderForm.vue index 84f29b84..77c96aec 100644 --- a/app/imports/ui/properties/forms/FolderForm.vue +++ b/app/imports/ui/properties/forms/FolderForm.vue @@ -17,9 +17,7 @@ - + diff --git a/app/imports/ui/properties/forms/ItemForm.vue b/app/imports/ui/properties/forms/ItemForm.vue index ced109d9..d8097daa 100644 --- a/app/imports/ui/properties/forms/ItemForm.vue +++ b/app/imports/ui/properties/forms/ItemForm.vue @@ -158,9 +158,9 @@ import FormSection from '/imports/ui/properties/forms/shared/FormSection.vue'; import propertyFormMixin from '/imports/ui/properties/forms/shared/propertyFormMixin.js'; export default { - components: { - FormSection, - }, + components: { + FormSection, + }, mixins: [propertyFormMixin], - } +} diff --git a/app/imports/ui/properties/forms/ItemsConsumedListForm.vue b/app/imports/ui/properties/forms/ItemsConsumedListForm.vue index 80069155..97531ec6 100644 --- a/app/imports/ui/properties/forms/ItemsConsumedListForm.vue +++ b/app/imports/ui/properties/forms/ItemsConsumedListForm.vue @@ -29,13 +29,13 @@ diff --git a/app/imports/ui/properties/forms/ProficiencyForm.vue b/app/imports/ui/properties/forms/ProficiencyForm.vue index 87b35b4a..4fcf2825 100644 --- a/app/imports/ui/properties/forms/ProficiencyForm.vue +++ b/app/imports/ui/properties/forms/ProficiencyForm.vue @@ -48,17 +48,18 @@ diff --git a/app/imports/ui/properties/forms/ResourcesForm.vue b/app/imports/ui/properties/forms/ResourcesForm.vue index 5c3e92d9..e3fc0dcb 100644 --- a/app/imports/ui/properties/forms/ResourcesForm.vue +++ b/app/imports/ui/properties/forms/ResourcesForm.vue @@ -55,54 +55,57 @@ diff --git a/app/imports/ui/properties/forms/RollForm.vue b/app/imports/ui/properties/forms/RollForm.vue index 26432790..c06ceaa6 100644 --- a/app/imports/ui/properties/forms/RollForm.vue +++ b/app/imports/ui/properties/forms/RollForm.vue @@ -41,7 +41,7 @@ > - + diff --git a/app/imports/ui/properties/forms/SavingThrowForm.vue b/app/imports/ui/properties/forms/SavingThrowForm.vue index 1fc03b68..8e0c5540 100644 --- a/app/imports/ui/properties/forms/SavingThrowForm.vue +++ b/app/imports/ui/properties/forms/SavingThrowForm.vue @@ -88,24 +88,24 @@ import propertyFormMixin from '/imports/ui/properties/forms/shared/propertyFormM export default { mixins: [saveListMixin, propertyFormMixin], computed: { - targetOptions(){ - return [ - { - text: 'Self', - value: 'self', - }, { - text: 'Target', - value: 'target', - }, - ]; - }, - targetOptionHint(){ - let hints = { - self: 'The save will be applied to the character taking the action', - target: 'The save will be applied to the targets of the action', - }; - return hints[this.model.target]; - } - }, + targetOptions() { + return [ + { + text: 'Self', + value: 'self', + }, { + text: 'Target', + value: 'target', + }, + ]; + }, + targetOptionHint() { + let hints = { + self: 'The save will be applied to the character taking the action', + target: 'The save will be applied to the targets of the action', + }; + return hints[this.model.target]; + } + }, }; diff --git a/app/imports/ui/properties/forms/SkillForm.vue b/app/imports/ui/properties/forms/SkillForm.vue index 2854013e..91d30970 100644 --- a/app/imports/ui/properties/forms/SkillForm.vue +++ b/app/imports/ui/properties/forms/SkillForm.vue @@ -53,9 +53,7 @@ - + diff --git a/app/imports/ui/properties/forms/SlotFillerForm.vue b/app/imports/ui/properties/forms/SlotFillerForm.vue index 64ce1c51..28890a30 100644 --- a/app/imports/ui/properties/forms/SlotFillerForm.vue +++ b/app/imports/ui/properties/forms/SlotFillerForm.vue @@ -95,20 +95,20 @@ diff --git a/app/imports/ui/properties/forms/SlotForm.vue b/app/imports/ui/properties/forms/SlotForm.vue index 6c001c2c..f2dc7c9b 100644 --- a/app/imports/ui/properties/forms/SlotForm.vue +++ b/app/imports/ui/properties/forms/SlotForm.vue @@ -72,13 +72,11 @@ @change="change('slotTags', ...arguments)" /> - +
- +
diff --git a/app/imports/ui/properties/forms/SpellForm.vue b/app/imports/ui/properties/forms/SpellForm.vue index db36d5b0..4544857c 100644 --- a/app/imports/ui/properties/forms/SpellForm.vue +++ b/app/imports/ui/properties/forms/SpellForm.vue @@ -247,9 +247,7 @@ /> - + diff --git a/app/imports/ui/properties/forms/ToggleForm.vue b/app/imports/ui/properties/forms/ToggleForm.vue index f3d01b0f..5f98729c 100644 --- a/app/imports/ui/properties/forms/ToggleForm.vue +++ b/app/imports/ui/properties/forms/ToggleForm.vue @@ -41,9 +41,7 @@ cols="12" md="6" > - + - + diff --git a/app/imports/ui/properties/forms/shared/FormSection.vue b/app/imports/ui/properties/forms/shared/FormSection.vue index 96946f77..88c8c279 100644 --- a/app/imports/ui/properties/forms/shared/FormSection.vue +++ b/app/imports/ui/properties/forms/shared/FormSection.vue @@ -22,16 +22,16 @@ diff --git a/app/imports/ui/properties/forms/shared/FormSections.vue b/app/imports/ui/properties/forms/shared/FormSections.vue index e7e8a738..70701ed4 100644 --- a/app/imports/ui/properties/forms/shared/FormSections.vue +++ b/app/imports/ui/properties/forms/shared/FormSections.vue @@ -8,5 +8,5 @@ diff --git a/app/imports/ui/properties/forms/shared/ProficiencySelect.vue b/app/imports/ui/properties/forms/shared/ProficiencySelect.vue index 51e1dc4c..1af7095a 100644 --- a/app/imports/ui/properties/forms/shared/ProficiencySelect.vue +++ b/app/imports/ui/properties/forms/shared/ProficiencySelect.vue @@ -22,11 +22,11 @@ diff --git a/app/imports/ui/properties/forms/shared/schemaFormMixin.js b/app/imports/ui/properties/forms/shared/schemaFormMixin.js index e1d3a349..5db234da 100644 --- a/app/imports/ui/properties/forms/shared/schemaFormMixin.js +++ b/app/imports/ui/properties/forms/shared/schemaFormMixin.js @@ -4,9 +4,9 @@ */ import { get, toPath } from 'lodash'; -function resolvePath(model, path, set){ +function resolvePath(model, path, set) { let arrayPath = toPath(path); - if (arrayPath.length === 1){ + if (arrayPath.length === 1) { return { object: model, key: arrayPath[0] }; } let key = arrayPath.slice(-1); @@ -15,67 +15,69 @@ function resolvePath(model, path, set){ // Ensure that nested objects exist before navigating them objectPath.forEach(pathKey => { let newObject = object[pathKey]; - if (!newObject){ + if (!newObject) { newObject = {}; set(object, pathKey, newObject); } object = newObject; }); - return {object, key}; + return { object, key }; } const schemaFormMixin = { - data(){ return { - valid: true, - };}, - computed: { - errors(){ - this.valid = true; - if (!this.model){ - throw new Error('this.model must be set'); - } - if (!this.validationContext) return {}; - let cleanModel = this.validationContext.clean(this.model, { - getAutoValues: false, - }); - this.validationContext.validate(cleanModel); - let errors = {}; - this.validationContext.validationErrors().forEach(error => { - if (this.valid) this.valid = false; - errors[error.name] = this.schema.messageForError(error); - }); - return errors; - }, - }, - methods: { + data() { + return { + valid: true, + }; + }, + computed: { + errors() { + this.valid = true; + if (!this.model) { + throw new Error('this.model must be set'); + } + if (!this.validationContext) return {}; + let cleanModel = this.validationContext.clean(this.model, { + getAutoValues: false, + }); + this.validationContext.validate(cleanModel); + let errors = {}; + this.validationContext.validationErrors().forEach(error => { + if (this.valid) this.valid = false; + errors[error.name] = this.schema.messageForError(error); + }); + return errors; + }, + }, + methods: { // Sets the value at the given path - change({path, value, ack}){ - let {object, key} = resolvePath(this.model, path, this.$set); + change({ path, value, ack }) { + let { object, key } = resolvePath(this.model, path, this.$set); - this.$set(object, key, value); - if (ack) ack(); - }, - push({path, value, ack}){ + this.$set(object, key, value); + if (ack) ack(); + }, + push({ path, value, ack }) { let array = get(this.model, path); - if (array === undefined){ - let {object, key} = resolvePath(this.model, path, this.$set); + if (array === undefined) { + let { object, key } = resolvePath(this.model, path, this.$set); this.$set(object, key, [value]); - } else if (!array.push){ + } else if (!array.push) { throw `${path.join('.')} is ${array}, doesn't have "push"` } else { array.push(value); } - if (ack) ack(); + if (ack) ack(); }, - pull({path, ack}){ - let {object, key} = resolvePath(this.model, path, this.$set); - if (!object || !object.splice){ + pull({ path, ack }) { + let { object, key } = resolvePath(this.model, path, this.$set); + if (!object || !object.splice) { throw `${path.join('.')} is ${object}, doesnt have "splice"` } object.splice(key, 1); if (ack) ack(); }, - }, + }, }; export default schemaFormMixin; diff --git a/app/imports/ui/properties/shared/ProficiencyIcon.vue b/app/imports/ui/properties/shared/ProficiencyIcon.vue index 91249fc3..223ef725 100644 --- a/app/imports/ui/properties/shared/ProficiencyIcon.vue +++ b/app/imports/ui/properties/shared/ProficiencyIcon.vue @@ -8,16 +8,16 @@ import getProficiencyIcon from '/imports/ui/utility/getProficiencyIcon.js'; export default { - props: { - value: { + props: { + value: { type: Number, default: undefined, }, - }, - computed: { - displayedIcon(){ + }, + computed: { + displayedIcon(){ return getProficiencyIcon(this.value); - } - } + } + } } diff --git a/app/imports/ui/properties/shared/PropertyIcon.vue b/app/imports/ui/properties/shared/PropertyIcon.vue index bf173aef..73a241db 100644 --- a/app/imports/ui/properties/shared/PropertyIcon.vue +++ b/app/imports/ui/properties/shared/PropertyIcon.vue @@ -18,8 +18,8 @@ import { getPropertyIcon } from '/imports/constants/PROPERTIES.js'; export default { - props: { - model: { + props: { + model: { type: Object, default: () => ({}), }, @@ -28,17 +28,18 @@ export default { default: undefined, }, disabled: Boolean, - }, - computed: { - icon(){ - return getPropertyIcon(this.model && this.model.type); - }, - }, + }, + computed: { + icon() { + return getPropertyIcon(this.model && this.model.type); + }, + }, } diff --git a/app/imports/ui/properties/shared/PropertySelector.vue b/app/imports/ui/properties/shared/PropertySelector.vue index 36670fe7..8fc32b7e 100644 --- a/app/imports/ui/properties/shared/PropertySelector.vue +++ b/app/imports/ui/properties/shared/PropertySelector.vue @@ -1,8 +1,6 @@ diff --git a/app/imports/ui/properties/viewers/EffectViewer.vue b/app/imports/ui/properties/viewers/EffectViewer.vue index ef72d816..5880fc10 100644 --- a/app/imports/ui/properties/viewers/EffectViewer.vue +++ b/app/imports/ui/properties/viewers/EffectViewer.vue @@ -6,9 +6,7 @@ class="layout" style="overflow: hidden;" > - + {{ effectIcon }} {{ operation }} @@ -77,71 +75,75 @@ diff --git a/app/imports/ui/properties/viewers/FeatureViewer.vue b/app/imports/ui/properties/viewers/FeatureViewer.vue index 4727df07..ae5c405b 100644 --- a/app/imports/ui/properties/viewers/FeatureViewer.vue +++ b/app/imports/ui/properties/viewers/FeatureViewer.vue @@ -16,9 +16,10 @@ diff --git a/app/imports/ui/properties/viewers/FolderViewer.vue b/app/imports/ui/properties/viewers/FolderViewer.vue index 352db109..51a51a76 100644 --- a/app/imports/ui/properties/viewers/FolderViewer.vue +++ b/app/imports/ui/properties/viewers/FolderViewer.vue @@ -5,9 +5,10 @@ diff --git a/app/imports/ui/properties/viewers/ItemViewer.vue b/app/imports/ui/properties/viewers/ItemViewer.vue index d5f07aab..0db65ce7 100644 --- a/app/imports/ui/properties/viewers/ItemViewer.vue +++ b/app/imports/ui/properties/viewers/ItemViewer.vue @@ -24,9 +24,7 @@ v-if="model.value !== undefined" name="value" > -
+
- + -
+
- + Equipped - + diff --git a/app/imports/ui/properties/viewers/RollViewer.vue b/app/imports/ui/properties/viewers/RollViewer.vue index d00aeed1..31e87bbf 100644 --- a/app/imports/ui/properties/viewers/RollViewer.vue +++ b/app/imports/ui/properties/viewers/RollViewer.vue @@ -17,9 +17,9 @@ diff --git a/app/imports/ui/properties/viewers/SavingThrowViewer.vue b/app/imports/ui/properties/viewers/SavingThrowViewer.vue index 02b4fbcb..59feea7a 100644 --- a/app/imports/ui/properties/viewers/SavingThrowViewer.vue +++ b/app/imports/ui/properties/viewers/SavingThrowViewer.vue @@ -22,9 +22,9 @@ diff --git a/app/imports/ui/properties/viewers/SkillViewer.vue b/app/imports/ui/properties/viewers/SkillViewer.vue index 651fd9c5..db6609c5 100644 --- a/app/imports/ui/properties/viewers/SkillViewer.vue +++ b/app/imports/ui/properties/viewers/SkillViewer.vue @@ -133,42 +133,44 @@ export default { AttributeEffect, SkillProficiency, }, - mixins: [propertyViewerMixin], + mixins: [propertyViewerMixin], inject: { context: { default: {} } }, - data(){return { - proficiencyText: { - 0: 'Not proficient', - 1: 'Proficient', - 0.49: 'Half proficiency bonus rounded down', - 0.5: 'Half proficiency bonus rounded up', - 2: 'Double proficiency bonus', - }, - skillTypes: { - skill: 'Skill', - save: 'Save', - check: 'Check', - tool: 'Tool', - weapon: 'Weapon', - armor: 'Armor', - language: 'Language', - utility: 'Utility', - }, - }}, + data() { + return { + proficiencyText: { + 0: 'Not proficient', + 1: 'Proficient', + 0.49: 'Half proficiency bonus rounded down', + 0.5: 'Half proficiency bonus rounded up', + 2: 'Double proficiency bonus', + }, + skillTypes: { + skill: 'Skill', + save: 'Save', + check: 'Check', + tool: 'Tool', + weapon: 'Weapon', + armor: 'Armor', + language: 'Language', + utility: 'Utility', + }, + } + }, computed: { - displayedModifier(){ - let mod = this.model.value; - if (this.model.fail){ - return 'fail'; - } else { - return numberToSignedString(mod); - } - }, - icon(){ + displayedModifier() { + let mod = this.model.value; + if (this.model.fail) { + return 'fail'; + } else { + return numberToSignedString(mod); + } + }, + icon() { return getProficiencyIcon(this.model.proficiency); - }, - passiveScore(){ + }, + passiveScore() { return 10 + this.model.value + this.model.passiveBonus; }, effects() { @@ -178,53 +180,53 @@ export default { methods: { numberToSignedString, isFinite: Number.isFinite, - clickEffect(id){ + clickEffect(id) { this.$store.commit('pushDialogStack', { component: 'creature-property-dialog', elementId: `${id}`, - data: {_id: id}, + data: { _id: id }, }); }, }, meteor: { - variables(){ - return CreatureVariables.findOne({_creatureId: this.context.creatureId}) || {}; + variables() { + return CreatureVariables.findOne({ _creatureId: this.context.creatureId }) || {}; }, - baseProficiencies(){ - if (this.context.creatureId){ + baseProficiencies() { + if (this.context.creatureId) { let creatureId = this.context.creatureId; return CreatureProperties.find({ 'ancestors.id': creatureId, type: 'skill', variableName: this.model.variableName, - removed: {$ne: true}, - inactive: {$ne: true}, - }).map( prop => ({ + removed: { $ne: true }, + inactive: { $ne: true }, + }).map(prop => ({ _id: prop._id, name: 'Skill base proficiency', value: prop.baseProficiency, stats: [prop.variableName], ancestors: prop.ancestors, - }) ).filter(prof => prof.value); + })).filter(prof => prof.value); } else { return []; } }, - proficiencies(){ + proficiencies() { let creatureId = this.context.creatureId; - if (creatureId){ + if (creatureId) { return CreatureProperties.find({ 'ancestors.id': creatureId, stats: this.model.variableName, type: 'proficiency', - removed: {$ne: true}, - inactive: {$ne: true}, + removed: { $ne: true }, + inactive: { $ne: true }, }).fetch(); } else { return []; } }, - ability(){ + ability() { let creatureId = this.context.creatureId; let ability = this.model.ability; if (!creatureId || !ability) return; @@ -232,21 +234,21 @@ export default { 'ancestors.id': creatureId, variableName: ability, type: 'attribute', - removed: {$ne: true}, - inactive: {$ne: true}, - overridden: {$ne: true}, + removed: { $ne: true }, + inactive: { $ne: true }, + overridden: { $ne: true }, }); if (!abilityProp) return; return { _id: abilityProp._id, name: abilityProp.name, operation: 'add', - amount: {value: abilityProp.modifier}, + amount: { value: abilityProp.modifier }, stats: [this.model.variableName], ancestors: abilityProp.ancestors, } }, - proficiencyBonus(){ + proficiencyBonus() { let creatureId = this.context.creatureId; if (!creatureId) return; return this.variables.proficiencyBonus && @@ -257,4 +259,5 @@ export default { diff --git a/app/imports/ui/properties/viewers/SlotFillerViewer.vue b/app/imports/ui/properties/viewers/SlotFillerViewer.vue index 6ebf8a36..d3cb60c5 100644 --- a/app/imports/ui/properties/viewers/SlotFillerViewer.vue +++ b/app/imports/ui/properties/viewers/SlotFillerViewer.vue @@ -32,32 +32,30 @@ name="Description" :cols="{cols: 12}" > - +
diff --git a/app/imports/ui/properties/viewers/SlotViewer.vue b/app/imports/ui/properties/viewers/SlotViewer.vue index 36e432f1..55ceeb8d 100644 --- a/app/imports/ui/properties/viewers/SlotViewer.vue +++ b/app/imports/ui/properties/viewers/SlotViewer.vue @@ -60,34 +60,34 @@ diff --git a/app/imports/ui/properties/viewers/SpellListViewer.vue b/app/imports/ui/properties/viewers/SpellListViewer.vue index 9b4c9d49..f7c35b57 100644 --- a/app/imports/ui/properties/viewers/SpellListViewer.vue +++ b/app/imports/ui/properties/viewers/SpellListViewer.vue @@ -37,6 +37,6 @@ diff --git a/app/imports/ui/properties/viewers/SpellViewer.vue b/app/imports/ui/properties/viewers/SpellViewer.vue index 35b31e7b..ee8085b2 100644 --- a/app/imports/ui/properties/viewers/SpellViewer.vue +++ b/app/imports/ui/properties/viewers/SpellViewer.vue @@ -43,12 +43,12 @@ export default { components: { ActionViewer, }, - mixins: [propertyViewerMixin], - computed:{ - levelText(){ + mixins: [propertyViewerMixin], + computed: { + levelText() { return levelText[this.model.level] }, - spellComponents(){ + spellComponents() { let components = []; if (this.model.ritual) components.push('Ritual'); if (this.model.concentration) components.push('Concentration'); @@ -62,4 +62,5 @@ export default { diff --git a/app/imports/ui/properties/viewers/ToggleViewer.vue b/app/imports/ui/properties/viewers/ToggleViewer.vue index 666c184f..f2b9037a 100644 --- a/app/imports/ui/properties/viewers/ToggleViewer.vue +++ b/app/imports/ui/properties/viewers/ToggleViewer.vue @@ -11,9 +11,7 @@ name="Status" :value="model.enabled ? 'Enabled' : 'Disabled'" /> -