Fixed various action calling issues

This commit is contained in:
ThaumRystra
2025-07-25 19:15:40 +02:00
parent 41e9fb4069
commit 899dcf42b1
12 changed files with 27 additions and 17 deletions

View File

@@ -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],

View File

@@ -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(() => {

View File

@@ -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);

View File

@@ -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,

View File

@@ -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,

View File

@@ -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),

View File

@@ -101,7 +101,6 @@ export default {
elementId: this.dataId,
task: {
subtaskFn: 'damageProp',
prop: model,
targetIds: [model.root.id],
params: {
title: getPropertyTitle(model),

View File

@@ -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,

View File

@@ -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,

View File

@@ -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() });

View File

@@ -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);

View File

@@ -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() });