@occultus/task-api 0.22.0-alpha.4 → 0.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@occultus/task-api",
|
|
3
|
-
"version": "0.22.0
|
|
3
|
+
"version": "0.22.0",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://codeberg.org/TeamOccultus/StarTenonAPI"
|
|
@@ -24,10 +24,10 @@
|
|
|
24
24
|
"author": "CTN Studios",
|
|
25
25
|
"type": "module",
|
|
26
26
|
"dependencies": {
|
|
27
|
+
"@occultus/toolkit": "0.23.2",
|
|
27
28
|
"@occultus/format-api": "0.21.0",
|
|
28
|
-
"@occultus/condition-api": "0.22.0
|
|
29
|
-
"@occultus/text-api": "0.
|
|
30
|
-
"@occultus/toolkit": "0.22.1"
|
|
29
|
+
"@occultus/condition-api": "0.22.0",
|
|
30
|
+
"@occultus/text-api": "0.23.0"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
33
|
"@minecraft/server": "^2.4.0",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"@occultus/core": "~0.18.4"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
|
-
"typedoc": "^0.28.
|
|
38
|
+
"typedoc": "^0.28.16"
|
|
39
39
|
},
|
|
40
40
|
"scripts": {
|
|
41
41
|
"test": "tsc"
|
package/src/api/TaskGroup.ts
CHANGED
|
@@ -33,11 +33,12 @@ export class TaskGroup {
|
|
|
33
33
|
player.onScreenDisplay.setActionBar({
|
|
34
34
|
translate: "ui.taskGroup.award.owned"
|
|
35
35
|
});
|
|
36
|
+
return;
|
|
36
37
|
}
|
|
37
38
|
if (this.getStatus(player) === TaskStatus.Done) {
|
|
38
39
|
this.giveAward(player);
|
|
39
40
|
}
|
|
40
|
-
return
|
|
41
|
+
return;
|
|
41
42
|
}
|
|
42
43
|
tasks[response.selection - 1].display(player, this);
|
|
43
44
|
});
|
|
@@ -88,5 +89,6 @@ export class TaskGroup {
|
|
|
88
89
|
}
|
|
89
90
|
protected giveAward(player: Player) {
|
|
90
91
|
this.options.awards.forEach((award) => award.give(player));
|
|
92
|
+
this.ownAward(player);
|
|
91
93
|
}
|
|
92
94
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ItemStack, Player } from "@minecraft/server";
|
|
2
2
|
import { TaskAwards } from "./TaskAwards";
|
|
3
3
|
import { giveItem } from "@occultus/toolkit";
|
|
4
|
+
import { toOneLine } from "@occultus/text-api";
|
|
4
5
|
|
|
5
6
|
export class ItemAwards extends TaskAwards {
|
|
6
7
|
constructor(
|
|
@@ -19,7 +20,7 @@ export class ItemAwards extends TaskAwards {
|
|
|
19
20
|
const item = this.getItem();
|
|
20
21
|
return {
|
|
21
22
|
rawtext: [
|
|
22
|
-
{ translate: item.localizationKey },
|
|
23
|
+
{ translate: toOneLine(item.localizationKey) },
|
|
23
24
|
{ text: " × " },
|
|
24
25
|
{ text: item.amount.toString() }
|
|
25
26
|
]
|
package/src/utils/TaskUtils.ts
CHANGED
|
@@ -15,7 +15,7 @@ import { TaskCenter } from "../api/TaskCenter";
|
|
|
15
15
|
|
|
16
16
|
export class TaskUtils {
|
|
17
17
|
static generateTaskBody(task: Task, player: Player): RawMessage {
|
|
18
|
-
|
|
18
|
+
const texts: RawMessage[] = [];
|
|
19
19
|
texts.push(parseToRaw(task.description, player));
|
|
20
20
|
texts.push({ text: Format.newLine }, { text: Format.newLine });
|
|
21
21
|
// 提示:
|
|
@@ -46,7 +46,7 @@ export class TaskUtils {
|
|
|
46
46
|
};
|
|
47
47
|
}
|
|
48
48
|
static generateFailMessage(task: Task, player: Player): RawMessage {
|
|
49
|
-
|
|
49
|
+
const texts: RawMessage[] = [];
|
|
50
50
|
// 你无法提交该任务,因为:
|
|
51
51
|
texts.push({ translate: "ui.task.failed_reason" });
|
|
52
52
|
task.options.conditions.forEach((condition) => {
|