Skip to content

Commit

Permalink
Fix CreateBattleEvent task.
Browse files Browse the repository at this point in the history
  • Loading branch information
Damnae committed Oct 9, 2023
1 parent 5a9856c commit 973836a
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions src/gamecore/tasks/CreateBattleEvent.vue
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<script setup lang="ts">
import { ref, inject } from 'vue';
import { ref, inject, computed } from 'vue';
import { getHash } from '@/common/translate';
import useHashStore from '@/common/hashstore';
import { GamecoreTask, GamecoreTargetType, DynamicExpression, } from '@/sources/gamecore';
import { BattleEvent, getBattleEvent } from '@/sources/battleevent';
import { getBattleEvent } from '@/sources/battleevent';
import BlockLayout from '@/components/BlockLayout.vue';
import EvaluateTargetType from '../EvaluateTargetType.vue';
import EvaluateExpression from '../EvaluateExpression.vue';
Expand All @@ -13,7 +13,7 @@
const node = props.node as unknown as
{
PropertyFromTarget?:GamecoreTargetType
EventID:number
EventID:number|DynamicExpression
DynamicValues?:
{
[key:string]:DynamicExpression
Expand All @@ -22,7 +22,15 @@
TotalDamageTeam:string
}
const battleEvent = ref<BattleEvent>(await getBattleEvent(commitId, node.EventID))
const battleEventId = computed(() =>
{
if (typeof(node.EventID) == 'number')
return node.EventID
if (!node.EventID.IsDynamic)
return node.EventID.FixedValue?.Value
})
const battleEvent = ref(battleEventId.value ? await getBattleEvent(commitId, battleEventId.value) : undefined)
if (node.DynamicValues)
{
Expand All @@ -37,9 +45,12 @@
<BlockLayout :source="node">

Create battle event
<RouterLink :to="{ name:'battleEvent', params:{ commitId: commitId, objectId: node.EventID }}">
<em :title="node.EventID.toString()">{{ battleEvent.BattleEventName }}</em>
<RouterLink v-if="battleEvent" :to="{ name:'battleEvent', params:{ commitId: commitId, objectId: battleEventId }}">
<em :title="battleEventId?.toString()">{{ battleEvent.BattleEventName }}</em>
</RouterLink>
<em v-else-if="typeof(node.EventID) != 'number'">
<EvaluateExpression :expression="node.EventID" />
</em>

for team <em>{{ node.Team }}</em>
<template v-if="node.PropertyFromTarget">
Expand Down

0 comments on commit 973836a

Please sign in to comment.