自定义对话主题 (Chemdah 开发者文档)
来自Purtmars Wikipedia —— 普特莫斯维基
目录
- Chemdah
- 开始
- 基本
- 事件
- ink.ptms.chemdah.api.event.collect.ConversationEvents
- ink.ptms.chemdah.api.event.collect.ObjectiveEvents
- ink.ptms.chemdah.api.event.collect.PlayerEvents
- ink.ptms.chemdah.api.event.collect.QuestEvents
- ink.ptms.chemdah.api.event.collect.TemplateEvents
- ink.ptms.chemdah.api.event.InferEntityHookEvent
- ink.ptms.chemdah.api.event.InferItemHookEvent
- ink.ptms.chemdah.api.event.PartyHookEvent
- 对话相关
- 数据相关
- 任务相关
对话主题
注册自定义对话主题需要分别实现 Theme 与 ThemeSettings 类,在本章文档中我们会从零开始注册一个简单的聊天框对话主题。
ink.ptms.chemdah.core.conversation.theme.Theme
/**
* 注册到 ChemdahAPI 中
*/
fun register(name)
/**
* 当配置文件被重载
*/
open fun reloadConfig()
/**
* 是否支持告别
* 即结束对话时使用 talk 语句创建没有回复的对话信息
* 在原版 chat 对话模式中支持告别,而 chest 不支持(会被转换为 Holographic 信息)
*/
open fun allowFarewell()
/**
* 重置会话时(即 begin 之前)
* 在原版 chat 对话模式中用于归位玩家所选择的回复序号,而 chest 中没有使用
*/
open fun reset(session: Session): CompletableFuture
/**
* 会话开始之前,在原版 chat 对话模式中用于播放音效特效等
* 使用时必须返回 super.begin(session)
*/
open fun begin(session: Session): CompletableFuture
/**
* 会话结束时,目前未被使用
*/
open fun end(session: Session): CompletableFuture
/**
* 会话渲染时
* @param canReply 是否可以回复
*/
abstract fun npcTalk(session: Session, message: List, canReply: Boolean = true): CompletableFuture
实现
class ThemeDemo : Theme() {
override fun npcTalk(session: Session, message: List, canReply: Boolean): CompletableFuture {
TODO("Not yet implemented")
}
}
class ThemeDemoSettings(root: ConfigurationSection) : ThemeSettings(root) {
}