fix(game): run the story command on the suspending path (#141)
This commit is contained in:
1 parent
d69a0806ab
commit
94bf65e208
2 files changed
+3
-3
No files matched your search
@@ -139,7 +139,7 @@ internal constructor(
|
|||||||
checkNotNull(player) { STORY_PLAYER_UNAVAILABLE }.giveItem(session, state, itemId, quantity)
|
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. */
|
/** 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. */
|
/** Run a non-catchable, non-escapable story battle and wait for its result. */
|
||||||
suspend fun battle(dexId: Int, level: Int, vararg moveIds: Int): BattleResult =
|
suspend fun battle(dexId: Int, level: Int, vararg moveIds: Int): BattleResult =
|
||||||
|
|||||||
+2
-2
@@ -29,7 +29,7 @@ constructor(
|
|||||||
override val description = "jumps to a story scene, or lists the scenes with no argument"
|
override val description = "jumps to a story scene, or lists the scenes with no argument"
|
||||||
override val permission = CharacterPermissions.DEVELOPER
|
override val permission = CharacterPermissions.DEVELOPER
|
||||||
|
|
||||||
override fun run(ctx: CommandContext) {
|
override suspend fun run(ctx: CommandContext) {
|
||||||
val wanted = ctx.args.firstOrNull()
|
val wanted = ctx.args.firstOrNull()
|
||||||
if (wanted == null) {
|
if (wanted == null) {
|
||||||
KANTO_CHECKPOINTS.forEach { ctx.reply("${it.name} - ${it.description}") }
|
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.")
|
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
|
val charId = ctx.characterId
|
||||||
characterStore.replaceProgress(
|
characterStore.replaceProgress(
|
||||||
characterId = charId,
|
characterId = charId,
|
||||||
|
|||||||
Reference in new issue
Block a user