Fixed various action calling issues
This commit is contained in:
@@ -611,11 +611,12 @@ export default {
|
||||
},
|
||||
incrementChange(_id, { type, value, ack }) {
|
||||
const model = CreatureProperties.findOne(_id);
|
||||
if (!model) return;
|
||||
if (type === 'increment') value = -value;
|
||||
doAction({
|
||||
creatureId: model.root.id,
|
||||
$store: this.$store,
|
||||
elementId: `${model._id}-${type}`,
|
||||
elementId: `${model._id}`,
|
||||
task: {
|
||||
subtaskFn: 'damageProp',
|
||||
targetIds: [model.root.id],
|
||||
|
||||
@@ -229,6 +229,7 @@ export default {
|
||||
creatureId: this.model.root.id,
|
||||
$store: this.$store,
|
||||
elementId: `${this.model._id}-do-action-button`,
|
||||
targetIds: [],
|
||||
}).catch((e) => {
|
||||
console.error(e);
|
||||
}).finally(() => {
|
||||
|
||||
@@ -50,6 +50,7 @@ export default {
|
||||
creatureId: this.model.root.id,
|
||||
$store: this.$store,
|
||||
elementId: `event-btn-${this.model._id}`,
|
||||
targetIds: [],
|
||||
}).catch(error => {
|
||||
snackbar({ text: error.reason || error.message || error.toString() });
|
||||
console.error(error);
|
||||
|
||||
@@ -98,7 +98,6 @@ export default {
|
||||
elementId: `check-btn-${this.model._id}`,
|
||||
task: {
|
||||
subtaskFn: 'check',
|
||||
prop: this.model,
|
||||
targetIds: [this.model.root.id],
|
||||
advantage: this.model.advantage,
|
||||
skillVariableName: undefined,
|
||||
|
||||
@@ -83,7 +83,6 @@ export default {
|
||||
elementId: `check-btn-${this.model._id}`,
|
||||
task: {
|
||||
subtaskFn: 'check',
|
||||
prop: this.model,
|
||||
targetIds: [this.model.root.id],
|
||||
advantage: this.model.advantage,
|
||||
skillVariableName: this.model.variableName,
|
||||
|
||||
@@ -121,7 +121,6 @@ export default {
|
||||
elementId: `spell-slot-list-tile-${model._id}`,
|
||||
task: {
|
||||
subtaskFn: 'damageProp',
|
||||
prop: model,
|
||||
targetIds: [model.root.id],
|
||||
params: {
|
||||
title: getPropertyTitle(model),
|
||||
|
||||
@@ -101,7 +101,6 @@ export default {
|
||||
elementId: this.dataId,
|
||||
task: {
|
||||
subtaskFn: 'damageProp',
|
||||
prop: model,
|
||||
targetIds: [model.root.id],
|
||||
params: {
|
||||
title: getPropertyTitle(model),
|
||||
|
||||
@@ -110,7 +110,6 @@ export default {
|
||||
elementId: `check-btn-${this.model._id}`,
|
||||
task: {
|
||||
subtaskFn: 'check',
|
||||
prop: this.model,
|
||||
targetIds: [this.model.root.id],
|
||||
advantage: this.model.advantage,
|
||||
skillVariableName: this.model.variableName,
|
||||
|
||||
@@ -360,12 +360,17 @@ export default {
|
||||
const withoutSpellSlot = slotId === 'no-slot';
|
||||
if (ritual || withoutSpellSlot) slotId = undefined;
|
||||
const $store = this.$store;
|
||||
const spell = CreatureProperties.findOne(spellId);
|
||||
if (!spell || spell.type !== 'spell') {
|
||||
return;
|
||||
}
|
||||
doAction({
|
||||
creatureId: this.creatureId,
|
||||
$store,
|
||||
task: {
|
||||
subtaskFn: 'castSpell',
|
||||
prop: CreatureProperties.findOne(spellId),
|
||||
prop: spell,
|
||||
targetIds: [],
|
||||
params: {
|
||||
slotId,
|
||||
ritual,
|
||||
|
||||
@@ -203,6 +203,7 @@ export default {
|
||||
$store: this.$store,
|
||||
propId: this.model._id,
|
||||
elementId: 'do-action-button',
|
||||
targetIds: [],
|
||||
}).catch((e) => {
|
||||
console.error(e);
|
||||
snackbar({ text: e.message || e.reason || e.toString() });
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
icon
|
||||
tile
|
||||
color="primary"
|
||||
:data-id="`${model._id}-increment`"
|
||||
:value="model.value"
|
||||
:loading="damagePropertyLoading"
|
||||
@change="damageProperty"
|
||||
@@ -212,16 +213,20 @@ import getPropertyTitle from '/imports/client/ui/properties/shared/getPropertyTi
|
||||
damageProperty({ type, value }) {
|
||||
const model = this.model;
|
||||
this.damagePropertyLoading = true;
|
||||
doAction(model, this.$store, model._id, {
|
||||
subtaskFn: 'damageProp',
|
||||
prop: model,
|
||||
targetIds: [model.root.id],
|
||||
params: {
|
||||
title: getPropertyTitle(model),
|
||||
operation: type,
|
||||
value,
|
||||
targetProp: model,
|
||||
}
|
||||
doAction({
|
||||
creatureId: model.root.id,
|
||||
$store: this.$store,
|
||||
elementId: `${model._id}-increment`,
|
||||
task: {
|
||||
subtaskFn: 'damageProp',
|
||||
targetIds: [model.root.id],
|
||||
params: {
|
||||
title: getPropertyTitle(model),
|
||||
operation: type,
|
||||
value,
|
||||
targetProp: model,
|
||||
},
|
||||
},
|
||||
}).catch((error) => {
|
||||
snackbar({ text: error.reason || error.message || error.toString() });
|
||||
console.error(error);
|
||||
|
||||
@@ -168,6 +168,7 @@ export default {
|
||||
creatureId: this.model.root.id,
|
||||
$store: this.$store,
|
||||
elementId: 'do-action-button',
|
||||
targetIds: [],
|
||||
}).catch((e) => {
|
||||
console.error(e);
|
||||
snackbar({ text: e.message || e.reason || e.toString() });
|
||||
|
||||
Reference in New Issue
Block a user