Add favorability system

Update version to v1.9.0
This commit is contained in:
2025-10-30 15:02:27 +08:00
parent 8ac0197fc4
commit 0f482407d4
8 changed files with 315 additions and 23 deletions

View File

@@ -1,14 +1,52 @@
package top.jie65535.mirai
import kotlinx.serialization.Serializable
import net.mamoe.mirai.console.data.AutoSavePluginData
import net.mamoe.mirai.console.data.value
/**
* 好感度信息数据类
* @param userId QQ
* @param value 好感度值 (-100 ~ 100)
* @param reasons 调整原因列表,用于溯源
* @param impression 对用户的印象/画像
*/
@Serializable
data class FavorabilityInfo(
val userId: Long,
val value: Int = 0,
val reasons: List<String> = emptyList(),
val impression: String = ""
) {
override fun toString(): String {
return buildString {
append("好感度:$value")
if (impression.isNotEmpty()) {
append("\t印象:$impression")
}
if (reasons.isNotEmpty()) {
appendLine("\t调整原因:")
reasons.forEach { reason ->
appendLine("* $reason")
}
}
}
}
}
object PluginData : AutoSavePluginData("data") {
/**
* 联系人记忆
*/
val contactMemory by value(mutableMapOf<Long, String>())
/**
* 用户好感度数据
* Key: 用户QQ号
* Value: 好感度信息
*/
val userFavorability by value(mutableMapOf<Long, FavorabilityInfo>())
/**
* 添加对话记忆
*/