From 94bf65e208cfbcedc9beefaa621cb0403904a9b8 Mon Sep 17 00:00:00 2001 From: Fiereu Date: Sun, 9 Aug 2026 12:38:43 +0200 Subject: [PATCH] fix(game): run the story command on the suspending path (#141) --- .../de/fiereu/openmmo/server/game/script/ScriptContext.kt | 2 +- .../openmmo/server/game/services/command/StoryCommand.kt | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/server.game/src/main/kotlin/de/fiereu/openmmo/server/game/script/ScriptContext.kt b/server.game/src/main/kotlin/de/fiereu/openmmo/server/game/script/ScriptContext.kt index 833d767..ee8046a 100644 --- a/server.game/src/main/kotlin/de/fiereu/openmmo/server/game/script/ScriptContext.kt +++ b/server.game/src/main/kotlin/de/fiereu/openmmo/server/game/script/ScriptContext.kt @@ -139,7 +139,7 @@ internal constructor( checkNotNull(player) { STORY_PLAYER_UNAVAILABLE }.giveItem(session, state, itemId, quantity) /** Take an item back out of the bag, the decomp removeitem. False when the bag lacks it. */ - fun takeItem(itemId: Int, quantity: Int = 1): Boolean = giveItem(itemId, -quantity) + suspend fun takeItem(itemId: Int, quantity: Int = 1): Boolean = giveItem(itemId, -quantity) /** Run a non-catchable, non-escapable story battle and wait for its result. */ suspend fun battle(dexId: Int, level: Int, vararg moveIds: Int): BattleResult = diff --git a/server.game/src/main/kotlin/de/fiereu/openmmo/server/game/services/command/StoryCommand.kt b/server.game/src/main/kotlin/de/fiereu/openmmo/server/game/services/command/StoryCommand.kt index 2ffcd69..bfdf714 100644 --- a/server.game/src/main/kotlin/de/fiereu/openmmo/server/game/services/command/StoryCommand.kt +++ b/server.game/src/main/kotlin/de/fiereu/openmmo/server/game/services/command/StoryCommand.kt @@ -29,7 +29,7 @@ constructor( override val description = "jumps to a story scene, or lists the scenes with no argument" override val permission = CharacterPermissions.DEVELOPER - override fun run(ctx: CommandContext) { + override suspend fun run(ctx: CommandContext) { val wanted = ctx.args.firstOrNull() if (wanted == null) { KANTO_CHECKPOINTS.forEach { ctx.reply("${it.name} - ${it.description}") } @@ -98,7 +98,7 @@ constructor( ctx.reply("Reset to the ${region.displayName} start. Your party, PC and bag are empty.") } - private fun apply(ctx: CommandContext, checkpoint: StoryCheckpoint) { + private suspend fun apply(ctx: CommandContext, checkpoint: StoryCheckpoint) { val charId = ctx.characterId characterStore.replaceProgress( characterId = charId,