Slot quantity is now a computed value, added property viewer for slots
This commit is contained in:
@@ -23,6 +23,7 @@ export default function computeEndStepProperty(prop, memo){
|
|||||||
computePropertyField(prop, memo, 'maxPrepared');
|
computePropertyField(prop, memo, 'maxPrepared');
|
||||||
break;
|
break;
|
||||||
case 'propertySlot':
|
case 'propertySlot':
|
||||||
|
computePropertyField(prop, memo, 'quantityExpected');
|
||||||
computePropertyField(prop, memo, 'slotCondition');
|
computePropertyField(prop, memo, 'slotCondition');
|
||||||
break;
|
break;
|
||||||
case 'roll':
|
case 'roll':
|
||||||
|
|||||||
@@ -21,6 +21,9 @@ export default function evaluateCalculation({
|
|||||||
context,
|
context,
|
||||||
dependencies,
|
dependencies,
|
||||||
};
|
};
|
||||||
|
if (typeof string !== 'string'){
|
||||||
|
string = string.toString();
|
||||||
|
}
|
||||||
// Parse the string
|
// Parse the string
|
||||||
let calc;
|
let calc;
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -23,10 +23,14 @@ export default function recomputeSlotFullness(ancestorId){
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
let spaceLeft;
|
let spaceLeft;
|
||||||
if (slot.quantityExpected === 0){
|
let expected = slot.quantityExpectedResult;
|
||||||
|
if (typeof expected !== 'number'){
|
||||||
|
expected = 1;
|
||||||
|
}
|
||||||
|
if (expected === 0){
|
||||||
spaceLeft = null;
|
spaceLeft = null;
|
||||||
} else {
|
} else {
|
||||||
spaceLeft = slot.quantityExpected - totalFilled;
|
spaceLeft = expected - totalFilled;
|
||||||
}
|
}
|
||||||
if (slot.totalFilled !== totalFilled || slot.spaceLeft !== spaceLeft){
|
if (slot.totalFilled !== totalFilled || slot.spaceLeft !== spaceLeft){
|
||||||
CreatureProperties.update(slot._id, {
|
CreatureProperties.update(slot._id, {
|
||||||
|
|||||||
@@ -22,9 +22,9 @@ let SlotSchema = new SimpleSchema({
|
|||||||
type: String,
|
type: String,
|
||||||
},
|
},
|
||||||
quantityExpected: {
|
quantityExpected: {
|
||||||
type: SimpleSchema.Integer,
|
type: String,
|
||||||
defaultValue: 1,
|
optional: true,
|
||||||
min: 0,
|
defaultValue: '1',
|
||||||
},
|
},
|
||||||
ignored: {
|
ignored: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
|
|||||||
@@ -8,8 +8,8 @@
|
|||||||
<h3 class="layout row align-center">
|
<h3 class="layout row align-center">
|
||||||
{{ slot.name }}
|
{{ slot.name }}
|
||||||
<v-spacer />
|
<v-spacer />
|
||||||
<span v-if="slot.quantityExpected > 1">
|
<span v-if="slot.quantityExpectedResult > 1">
|
||||||
{{ slot.totalFilled }} / {{ slot.quantityExpected }}
|
{{ slot.totalFilled }} / {{ slot.quantityExpectedResult }}
|
||||||
</span>
|
</span>
|
||||||
</h3>
|
</h3>
|
||||||
<v-list v-if="slot.children.length">
|
<v-list v-if="slot.children.length">
|
||||||
@@ -38,7 +38,7 @@
|
|||||||
</v-list-tile>
|
</v-list-tile>
|
||||||
</v-list>
|
</v-list>
|
||||||
<v-btn
|
<v-btn
|
||||||
v-if="!slot.quantityExpected || slot.spaceLeft"
|
v-if="!slot.quantityExpectedResult || slot.spaceLeft"
|
||||||
icon
|
icon
|
||||||
:data-id="`slot-add-button-${slot._id}`"
|
:data-id="`slot-add-button-${slot._id}`"
|
||||||
class="slot-add-button"
|
class="slot-add-button"
|
||||||
|
|||||||
@@ -28,8 +28,6 @@
|
|||||||
/>
|
/>
|
||||||
<text-field
|
<text-field
|
||||||
label="Quantity"
|
label="Quantity"
|
||||||
type="number"
|
|
||||||
min="0"
|
|
||||||
hint="How many matching properties must be used to fill this slot, 0 is unlimited"
|
hint="How many matching properties must be used to fill this slot, 0 is unlimited"
|
||||||
:value="model.quantityExpected"
|
:value="model.quantityExpected"
|
||||||
:error-messages="errors.quantityExpected"
|
:error-messages="errors.quantityExpected"
|
||||||
|
|||||||
36
app/imports/ui/properties/viewers/SlotViewer.vue
Normal file
36
app/imports/ui/properties/viewers/SlotViewer.vue
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
<template lang="html">
|
||||||
|
<div class="buff-viewer">
|
||||||
|
<property-name :value="model.name" />
|
||||||
|
<property-field
|
||||||
|
name="Type"
|
||||||
|
:value="model.slotType"
|
||||||
|
/>
|
||||||
|
<property-field
|
||||||
|
name="Quantity"
|
||||||
|
:value="'quantityExpectedResult' in model ? model.quantityExpectedResult : model.quantityExpected"
|
||||||
|
/>
|
||||||
|
<property-field
|
||||||
|
name="Condition"
|
||||||
|
:value="'slotConditionResult' in model ? model.slotConditionResult : model.slotCondition"
|
||||||
|
/>
|
||||||
|
<template v-if="model.tags.length">
|
||||||
|
<div class="caption">
|
||||||
|
Tags
|
||||||
|
</div>
|
||||||
|
<property-tags :tags="model.tags" />
|
||||||
|
</template>
|
||||||
|
<property-description
|
||||||
|
:string="model.description"
|
||||||
|
:calculations="model.descriptionCalculations"
|
||||||
|
:inactive="model.inactive"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import propertyViewerMixin from '/imports/ui/properties/viewers/shared/propertyViewerMixin.js'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
mixins: [propertyViewerMixin],
|
||||||
|
}
|
||||||
|
</script>
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
<template lang="html">
|
<template lang="html">
|
||||||
<div v-if="value !== undefined || $slots.default">
|
<div v-if="value !== undefined || $slots.default">
|
||||||
<div class="caption">
|
<div class="caption">
|
||||||
{{name}}
|
{{ name }}
|
||||||
</div>
|
</div>
|
||||||
<p class="ml-2 subheading">
|
<p class="ml-2 subheading">
|
||||||
<slot>
|
<slot>
|
||||||
{{value}}
|
{{ value }}
|
||||||
</slot>
|
</slot>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
export default {
|
export default {
|
||||||
props: {
|
props: {
|
||||||
name: String,
|
name: String,
|
||||||
value: [String, Number],
|
value: [String, Number, Boolean],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ import ProficiencyViewer from '/imports/ui/properties/viewers/ProficiencyViewer.
|
|||||||
import RollViewer from '/imports/ui/properties/viewers/RollViewer.vue';
|
import RollViewer from '/imports/ui/properties/viewers/RollViewer.vue';
|
||||||
import SkillViewer from '/imports/ui/properties/viewers/SkillViewer.vue';
|
import SkillViewer from '/imports/ui/properties/viewers/SkillViewer.vue';
|
||||||
import SavingThrowViewer from '/imports/ui/properties/viewers/SavingThrowViewer.vue';
|
import SavingThrowViewer from '/imports/ui/properties/viewers/SavingThrowViewer.vue';
|
||||||
|
import SlotViewer from '/imports/ui/properties/viewers/SlotViewer.vue';
|
||||||
import SpellListViewer from '/imports/ui/properties/viewers/SpellListViewer.vue';
|
import SpellListViewer from '/imports/ui/properties/viewers/SpellListViewer.vue';
|
||||||
import SpellViewer from '/imports/ui/properties/viewers/SpellViewer.vue';
|
import SpellViewer from '/imports/ui/properties/viewers/SpellViewer.vue';
|
||||||
|
|
||||||
@@ -39,6 +40,7 @@ export default {
|
|||||||
proficiency: ProficiencyViewer,
|
proficiency: ProficiencyViewer,
|
||||||
roll: RollViewer,
|
roll: RollViewer,
|
||||||
savingThrow: SavingThrowViewer,
|
savingThrow: SavingThrowViewer,
|
||||||
|
propertySlot: SlotViewer,
|
||||||
skill: SkillViewer,
|
skill: SkillViewer,
|
||||||
spellList: SpellListViewer,
|
spellList: SpellListViewer,
|
||||||
spell: SpellViewer,
|
spell: SpellViewer,
|
||||||
|
|||||||
Reference in New Issue
Block a user