From a7e35ae2897843c731eb53f72ca6745abc3ed716 Mon Sep 17 00:00:00 2001 From: cssxsh Date: Fri, 6 Aug 2021 18:48:20 +0800 Subject: [PATCH] fix: role --- .../kotlin/xyz/cssxsh/mirai/plugin/ArknightsTools.kt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/kotlin/xyz/cssxsh/mirai/plugin/ArknightsTools.kt b/src/main/kotlin/xyz/cssxsh/mirai/plugin/ArknightsTools.kt index 794483b..387dd56 100644 --- a/src/main/kotlin/xyz/cssxsh/mirai/plugin/ArknightsTools.kt +++ b/src/main/kotlin/xyz/cssxsh/mirai/plugin/ArknightsTools.kt @@ -104,11 +104,11 @@ internal fun tag(words: List, tags: Set = ExcelData.gacha.tags() internal fun recruit(words: List) = ExcelData.characters.recruit(tag(words), ExcelData.gacha.recruit()) -internal fun role(name: String, roles: Set = ExcelData.gacha.recruit()): String { - return when (name) { - in roles -> name.trim() - in RoleAlias -> RoleAlias.getValue(name.trim()) - else -> throw IllegalArgumentException("未知干员: ${name.trim()}") +internal fun role(name: String, roles: Set = ExcelData.gacha.recruit()) = name.trim().let { + when (it) { + in roles -> it + in RoleAlias -> RoleAlias.getValue(it) + else -> throw IllegalArgumentException("未知干员: ${it}") } }