普特莫斯维基 (Purtmars Wikipedia 📖)

Chemdah 开发者文档:任务控制

来自Purtmars Wikipedia —— 普特莫斯维基
Bkm016讨论 | 贡献2021年6月12日 (六) 19:57的版本

目录

任务控制

任务模板注册在 ChemdahAPI 中,任务则储存在 PlayerProfile 中。通过以下方法获取任务模板。

1 ChemdahAPI.getQuestTemplate("foo")

通过以下方法获取玩家本人(禁用协作任务)正在进行中的任务。

1 player.chemdahProfile.getQuestById("foo", openAPI = false)

任务模板在接受后转换为任务,只有任务模板可以接受,而任务只能完成或放弃。如果你能理解这其中的关系。

任务模板

任务模板下包含数个可以完成的任务条目,任务模板与任务条目同属于 QuestContainer 类型,即任务容器。
它们有共同的特征可以储存元数据、组件和脚本代理,以及专属序号。

模板结构如下:

├── tremplate_01 ·························· 模板1
|   ├── task_01 ··························· 条目1
|   ├── task_02 ··························· 条目2
|   └── task_03 ··························· 条目3

任务结构如下:

├── quest_01 ······························ 任务1
|   ├── tremplate_01 ······················ 模板1
|   |    ├── task_01 ······················ 条目1
|   |    ├── task_02 ······················ 条目2
|   |    └── task_03 ······················ 条目3
|   ├── persistentDataContainer ··········· 任务持久化数据

以下是 ink.ptms.chemdah.core.quest.QuestContainer 中提供的所有开放属性和方法。

 1 /**
 2  * 序号
 3  */
 4 val id: String
 5 
 6 /**
 7  * 配置文件
 8  */
 9 val config: ConfigurationSection
10 
11 /**
12  * 所有启用的组件名称
13  */
14 val addons: Set<String>
15 
16 /**
17  * 所有启用的脚本代理名称
18  */
19 val agents: List<String>
20 
21 /**
22  * 当前节点
23  * 任务则返回任务序号,条目则返回条目序号
24  */
25 val node: String
26 
27 /**
28  * 任务路径
29  * 作为持久化储存的唯一标识符
30  */
31 val path: String
32 
33 /**
34  * 获取元数据
35  */
36 fun <<T : Meta<<*>> meta(metaId: String): T?
37 
38 /**
39  * 获取组件
40  */
41 fun <<T : Addon> addon(addonId: String): T?
42 
43 /**
44  * 获取正在进行中的所属任务
45  */
46 fun getQuest(profile: PlayerProfile, openAPI: Boolean = false): Quest?
47 
48 /**
49  * 获取有效的脚本代理列表
50  */
51 fun getAgentList(agentType: AgentType, restrict: String = "self"): List<Agent>
52 
53 /**
54  * 指定脚本代理
55  * 当高优先级的脚本代理取消行为时后续脚本代理将不再运行
56  *
57  * @param profile 玩家数据
58  * @param agentType 脚本代理类型
59  */
60 fun agent(profile: PlayerProfile, agentType: AgentType, restrict: String = "self"): CompletableFuture<Boolean>

以下是 ink.ptms.chemdah.core.quest.Template 中提供的所有开放属性和方法。

 1 /**
 2  * 所有任务条目
 3  */
 4 val task: Map<String, Task>
 5 
 6 /**
 7  * 获取包含模板导入 (import) 的所有任务元数据
 8  * 已配置的元数据会覆盖导入源
 9  */
10 val metaAll(): Map<String, Meta<*>>
11 
12 /**
13  * 使玩家接受任务
14  * 会执行 checkAccept 方法
15  */
16 fun acceptTo(profile: PlayerProfile): CompletableFuture<AcceptResult>
17 
18 /**
19  * 检测玩家是否可以接受该任务
20  */
21 fun checkAccept(profile: PlayerProfile): CompletableFuture<AcceptResult>

以下是 ink.ptms.chemdah.core.quest.Task 中提供的所有开放属性和方法。

 1 /**
 2  * 条目目标(任务目标)
 3  */
 4 val objective: Objective<*>
 5 
 6 /**
 7  * 进行条件
 8  */
 9 val condition: DataContainer()
10 
11 /**
12  * 完成条件
13  */
14 val goal: DataContainer()
15 
16 /**
17  * 是否完成该条目
18  */
19 fun isCompleted(profile: PlayerProfile): Boolean