@vnejs/plugins.views.achievement 0.1.1 → 0.1.3

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/const/const.js CHANGED
@@ -1 +1,2 @@
1
1
  export const EXEC_ACTIONS = { UNLOCK: "unlock" };
2
+ export const LOGS_ACTIONS = { UNLOCKED: "unlocked" };
package/index.js CHANGED
@@ -7,6 +7,13 @@ import * as params from "./const/params";
7
7
  import { Achievement } from "./modules/achievement";
8
8
  import { AchievementController } from "./modules/controller";
9
9
  import { AchievementExec } from "./modules/exec";
10
+ import { AchievementLogs } from "./modules/logs";
10
11
  import { AchievementView } from "./modules/view";
11
12
 
12
- regPlugin("ACHIEVEMENT", { constants, events: SUBSCRIBE_EVENTS, params }, [Achievement, AchievementController, AchievementExec, AchievementView]);
13
+ regPlugin("ACHIEVEMENT", { constants, events: SUBSCRIBE_EVENTS, params }, [
14
+ Achievement,
15
+ AchievementController,
16
+ AchievementExec,
17
+ AchievementLogs,
18
+ AchievementView,
19
+ ]);
package/modules/exec.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { Module } from "@vnejs/module";
2
2
 
3
- import { tokenizeExecLine } from "@vnejs/helpers.tokenize-exec-line";
3
+ import { tokenizeExecLine } from "@vnejs/helpers";
4
4
 
5
5
  export class AchievementExec extends Module {
6
6
  name = "achievement.exec";
@@ -25,7 +25,7 @@ export class AchievementExec extends Module {
25
25
  };
26
26
 
27
27
  emitActionExec = (action = "", tokens = [], keywords = []) => {
28
- const isSkipIfPossible = keywords.includes("skip-if-possible");
28
+ const isSkipIfPossible = keywords.includes(this.CONST.SCENARIO.LINE_KEYWORDS.SKIP_IF_POSSIBLE);
29
29
 
30
30
  if (action === this.CONST.ACHIEVEMENT.EXEC_ACTIONS.UNLOCK) return this.emitUnlockExec(tokens, isSkipIfPossible);
31
31
  };
@@ -0,0 +1,12 @@
1
+ import { Module } from "@vnejs/module";
2
+
3
+ export class AchievementLogs extends Module {
4
+ name = "achievement.logs";
5
+
6
+ subscribe = () => {
7
+ this.on(this.EVENTS.ACHIEVEMENT.UNLOCKED, this.onAchievementUnlocked, this.CONST.LOGS.FILTER_FROM_RESULT_OPTIONS);
8
+ };
9
+
10
+ onAchievementUnlocked = ({ id = "" } = {}) =>
11
+ void this.emit(this.EVENTS.LOGS.EMIT, { module: this.name, value: { action: this.CONST.ACHIEVEMENT.LOGS_ACTIONS.UNLOCKED, id } });
12
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vnejs/plugins.views.achievement",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1",