@drincs/nqtr 0.3.0 → 0.3.2
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/dist/{RoomInterface-D7qXKwBI.d.ts → RoomInterface-BglEhkQT.d.ts} +12 -12
- package/dist/{RoomInterface-C7Sg80EF.d.mts → RoomInterface-DsZAp6Pv.d.mts} +12 -12
- package/dist/{StageInterface-DmLgfrk4.d.mts → StageInterface-DJ7l0ubG.d.mts} +17 -17
- package/dist/{StageInterface-DmLgfrk4.d.ts → StageInterface-DJ7l0ubG.d.ts} +17 -17
- package/dist/classes/ActivityBaseModel.d.mts +4 -4
- package/dist/classes/ActivityBaseModel.d.ts +4 -4
- package/dist/classes/ActivityBaseModel.js +1 -1
- package/dist/classes/ActivityBaseModel.js.map +1 -1
- package/dist/classes/ActivityBaseModel.mjs +1 -1
- package/dist/classes/ActivityBaseModel.mjs.map +1 -1
- package/dist/classes/ActivityStoredClass.d.mts +4 -4
- package/dist/classes/ActivityStoredClass.d.ts +4 -4
- package/dist/classes/ActivityStoredClass.js +1 -1
- package/dist/classes/ActivityStoredClass.js.map +1 -1
- package/dist/classes/ActivityStoredClass.mjs +1 -1
- package/dist/classes/ActivityStoredClass.mjs.map +1 -1
- package/dist/classes/CommitmentBaseModel.d.mts +3 -3
- package/dist/classes/CommitmentBaseModel.d.ts +3 -3
- package/dist/classes/CommitmentBaseModel.js +1 -1
- package/dist/classes/CommitmentBaseModel.js.map +1 -1
- package/dist/classes/CommitmentBaseModel.mjs +1 -1
- package/dist/classes/CommitmentBaseModel.mjs.map +1 -1
- package/dist/classes/CommitmentStoredClass.d.mts +5 -5
- package/dist/classes/CommitmentStoredClass.d.ts +5 -5
- package/dist/classes/CommitmentStoredClass.js +1 -1
- package/dist/classes/CommitmentStoredClass.js.map +1 -1
- package/dist/classes/CommitmentStoredClass.mjs +1 -1
- package/dist/classes/CommitmentStoredClass.mjs.map +1 -1
- package/dist/classes/index.d.mts +6 -6
- package/dist/classes/index.d.ts +6 -6
- package/dist/classes/index.js +1 -1
- package/dist/classes/index.js.map +1 -1
- package/dist/classes/index.mjs +1 -1
- package/dist/classes/index.mjs.map +1 -1
- package/dist/classes/navigation/LocationBaseModel.d.mts +3 -3
- package/dist/classes/navigation/LocationBaseModel.d.ts +3 -3
- package/dist/classes/navigation/LocationBaseModel.js +1 -1
- package/dist/classes/navigation/LocationBaseModel.mjs +1 -1
- package/dist/classes/navigation/LocationStoredClass.d.mts +6 -6
- package/dist/classes/navigation/LocationStoredClass.d.ts +6 -6
- package/dist/classes/navigation/LocationStoredClass.js +1 -1
- package/dist/classes/navigation/LocationStoredClass.mjs +1 -1
- package/dist/classes/navigation/MapBaseModel.d.mts +2 -2
- package/dist/classes/navigation/MapBaseModel.d.ts +2 -2
- package/dist/classes/navigation/MapBaseModel.js +1 -1
- package/dist/classes/navigation/MapBaseModel.mjs +1 -1
- package/dist/classes/navigation/MapStoredClass.d.mts +5 -5
- package/dist/classes/navigation/MapStoredClass.d.ts +5 -5
- package/dist/classes/navigation/NavigationAbstractClass.d.mts +6 -6
- package/dist/classes/navigation/NavigationAbstractClass.d.ts +6 -6
- package/dist/classes/navigation/NavigationAbstractClass.js +1 -1
- package/dist/classes/navigation/NavigationAbstractClass.mjs +1 -1
- package/dist/classes/navigation/RoomBaseModel.d.mts +4 -4
- package/dist/classes/navigation/RoomBaseModel.d.ts +4 -4
- package/dist/classes/navigation/RoomBaseModel.js +1 -1
- package/dist/classes/navigation/RoomBaseModel.mjs +1 -1
- package/dist/classes/navigation/RoomStoredClass.d.mts +6 -6
- package/dist/classes/navigation/RoomStoredClass.d.ts +6 -6
- package/dist/classes/navigation/RoomStoredClass.js +1 -1
- package/dist/classes/navigation/RoomStoredClass.mjs +1 -1
- package/dist/classes/quest/QuestBaseModel.d.mts +3 -3
- package/dist/classes/quest/QuestBaseModel.d.ts +3 -3
- package/dist/classes/quest/QuestBaseModel.js +1 -1
- package/dist/classes/quest/QuestBaseModel.js.map +1 -1
- package/dist/classes/quest/QuestBaseModel.mjs +1 -1
- package/dist/classes/quest/QuestBaseModel.mjs.map +1 -1
- package/dist/classes/quest/QuestStoredClass.d.mts +14 -14
- package/dist/classes/quest/QuestStoredClass.d.ts +14 -14
- package/dist/classes/quest/QuestStoredClass.js +1 -1
- package/dist/classes/quest/QuestStoredClass.js.map +1 -1
- package/dist/classes/quest/QuestStoredClass.mjs +1 -1
- package/dist/classes/quest/QuestStoredClass.mjs.map +1 -1
- package/dist/classes/quest/StageBaseModel.d.mts +2 -2
- package/dist/classes/quest/StageBaseModel.d.ts +2 -2
- package/dist/classes/quest/StageBaseModel.js +1 -1
- package/dist/classes/quest/StageBaseModel.js.map +1 -1
- package/dist/classes/quest/StageBaseModel.mjs +1 -1
- package/dist/classes/quest/StageBaseModel.mjs.map +1 -1
- package/dist/classes/quest/StageStoredClass.d.mts +7 -7
- package/dist/classes/quest/StageStoredClass.d.ts +7 -7
- package/dist/classes/quest/StageStoredClass.js +1 -1
- package/dist/classes/quest/StageStoredClass.js.map +1 -1
- package/dist/classes/quest/StageStoredClass.mjs +1 -1
- package/dist/classes/quest/StageStoredClass.mjs.map +1 -1
- package/dist/decorators/ActivityDecorator.d.mts +5 -5
- package/dist/decorators/ActivityDecorator.d.ts +5 -5
- package/dist/decorators/CommitmentDecorator.d.mts +6 -6
- package/dist/decorators/CommitmentDecorator.d.ts +6 -6
- package/dist/decorators/QuestDecorator.d.mts +5 -5
- package/dist/decorators/QuestDecorator.d.ts +5 -5
- package/dist/decorators/RoomDecorator.d.mts +5 -5
- package/dist/decorators/RoomDecorator.d.ts +5 -5
- package/dist/decorators/index.d.mts +3 -3
- package/dist/decorators/index.d.ts +3 -3
- package/dist/index.d.mts +11 -8
- package/dist/index.d.ts +11 -8
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/interface/ActivityInterface.d.mts +3 -3
- package/dist/interface/ActivityInterface.d.ts +3 -3
- package/dist/interface/CommitmentInterface.d.mts +2 -2
- package/dist/interface/CommitmentInterface.d.ts +2 -2
- package/dist/interface/CommitmentProps.d.mts +3 -3
- package/dist/interface/CommitmentProps.d.ts +3 -3
- package/dist/interface/index.d.mts +3 -3
- package/dist/interface/index.d.ts +3 -3
- package/dist/interface/navigation/LocationBaseModelProps.d.mts +3 -3
- package/dist/interface/navigation/LocationBaseModelProps.d.ts +3 -3
- package/dist/interface/navigation/LocationInterface.d.mts +2 -2
- package/dist/interface/navigation/LocationInterface.d.ts +2 -2
- package/dist/interface/navigation/MapBaseModelProps.d.mts +3 -3
- package/dist/interface/navigation/MapBaseModelProps.d.ts +3 -3
- package/dist/interface/navigation/MapInterface.d.mts +2 -2
- package/dist/interface/navigation/MapInterface.d.ts +2 -2
- package/dist/interface/navigation/NavigationAbstractClass.d.mts +5 -5
- package/dist/interface/navigation/NavigationAbstractClass.d.ts +5 -5
- package/dist/interface/navigation/RoomBaseModelProps.d.mts +3 -3
- package/dist/interface/navigation/RoomBaseModelProps.d.ts +3 -3
- package/dist/interface/navigation/RoomInterface.d.mts +2 -2
- package/dist/interface/navigation/RoomInterface.d.ts +2 -2
- package/dist/interface/quest/QuestInterface.d.mts +2 -2
- package/dist/interface/quest/QuestInterface.d.ts +2 -2
- package/dist/interface/quest/QuestProps.d.mts +4 -4
- package/dist/interface/quest/QuestProps.d.ts +4 -4
- package/dist/interface/quest/StageInterface.d.mts +2 -2
- package/dist/interface/quest/StageInterface.d.ts +2 -2
- package/dist/interface/quest/StageProps.d.mts +4 -4
- package/dist/interface/quest/StageProps.d.ts +4 -4
- package/dist/managers/NavigatorManager.d.mts +9 -9
- package/dist/managers/NavigatorManager.d.ts +9 -9
- package/dist/managers/QuestManager.d.mts +9 -9
- package/dist/managers/QuestManager.d.ts +9 -9
- package/dist/managers/QuestManager.js +1 -1
- package/dist/managers/QuestManager.js.map +1 -1
- package/dist/managers/QuestManager.mjs +1 -1
- package/dist/managers/QuestManager.mjs.map +1 -1
- package/dist/managers/RoutineManager.d.mts +12 -12
- package/dist/managers/RoutineManager.d.ts +12 -12
- package/dist/managers/RoutineManager.js +1 -1
- package/dist/managers/RoutineManager.mjs +1 -1
- package/dist/managers/index.d.mts +3 -3
- package/dist/managers/index.d.ts +3 -3
- package/dist/managers/index.js +1 -1
- package/dist/managers/index.js.map +1 -1
- package/dist/managers/index.mjs +1 -1
- package/dist/managers/index.mjs.map +1 -1
- package/dist/nqtr.d.d.mts +195 -0
- package/dist/nqtr.d.d.ts +195 -0
- package/dist/nqtr.d.js +2 -0
- package/dist/nqtr.d.js.map +1 -0
- package/dist/nqtr.d.mjs +2 -0
- package/dist/nqtr.d.mjs.map +1 -0
- package/dist/types/OnRunEvent.d.mts +3 -2
- package/dist/types/OnRunEvent.d.ts +3 -2
- package/dist/types/QuestsRequired.d.mts +2 -2
- package/dist/types/QuestsRequired.d.ts +2 -2
- package/dist/types/index.d.mts +3 -2
- package/dist/types/index.d.ts +3 -2
- package/package.json +1 -2
- package/dist/override/ActivityInterface.d.mts +0 -28
- package/dist/override/ActivityInterface.d.ts +0 -28
- package/dist/override/ActivityInterface.js +0 -2
- package/dist/override/ActivityInterface.js.map +0 -1
- package/dist/override/ActivityInterface.mjs +0 -2
- package/dist/override/ActivityInterface.mjs.map +0 -1
- package/dist/override/CommitmentInterface.d.mts +0 -24
- package/dist/override/CommitmentInterface.d.ts +0 -24
- package/dist/override/CommitmentInterface.js +0 -2
- package/dist/override/CommitmentInterface.js.map +0 -1
- package/dist/override/CommitmentInterface.mjs +0 -2
- package/dist/override/CommitmentInterface.mjs.map +0 -1
- package/dist/override/GraphicItemInterface.d.mts +0 -19
- package/dist/override/GraphicItemInterface.d.ts +0 -19
- package/dist/override/GraphicItemInterface.js +0 -2
- package/dist/override/GraphicItemInterface.js.map +0 -1
- package/dist/override/GraphicItemInterface.mjs +0 -2
- package/dist/override/GraphicItemInterface.mjs.map +0 -1
- package/dist/override/LocationInterface.d.mts +0 -29
- package/dist/override/LocationInterface.d.ts +0 -29
- package/dist/override/LocationInterface.js +0 -2
- package/dist/override/LocationInterface.js.map +0 -1
- package/dist/override/LocationInterface.mjs +0 -2
- package/dist/override/LocationInterface.mjs.map +0 -1
- package/dist/override/MapInterface.d.mts +0 -12
- package/dist/override/MapInterface.d.ts +0 -12
- package/dist/override/MapInterface.js +0 -2
- package/dist/override/MapInterface.js.map +0 -1
- package/dist/override/MapInterface.mjs +0 -2
- package/dist/override/MapInterface.mjs.map +0 -1
- package/dist/override/OnRenderGraphicItemProps.d.mts +0 -19
- package/dist/override/OnRenderGraphicItemProps.d.ts +0 -19
- package/dist/override/OnRenderGraphicItemProps.js +0 -2
- package/dist/override/OnRenderGraphicItemProps.js.map +0 -1
- package/dist/override/OnRenderGraphicItemProps.mjs +0 -2
- package/dist/override/OnRenderGraphicItemProps.mjs.map +0 -1
- package/dist/override/OnRunProps.d.mts +0 -19
- package/dist/override/OnRunProps.d.ts +0 -19
- package/dist/override/OnRunProps.js +0 -2
- package/dist/override/OnRunProps.js.map +0 -1
- package/dist/override/OnRunProps.mjs +0 -2
- package/dist/override/OnRunProps.mjs.map +0 -1
- package/dist/override/OnStartEndStageQuest.d.mts +0 -19
- package/dist/override/OnStartEndStageQuest.d.ts +0 -19
- package/dist/override/OnStartEndStageQuest.js +0 -2
- package/dist/override/OnStartEndStageQuest.js.map +0 -1
- package/dist/override/OnStartEndStageQuest.mjs +0 -2
- package/dist/override/OnStartEndStageQuest.mjs.map +0 -1
- package/dist/override/QuestInterface.d.mts +0 -24
- package/dist/override/QuestInterface.d.ts +0 -24
- package/dist/override/QuestInterface.js +0 -2
- package/dist/override/QuestInterface.js.map +0 -1
- package/dist/override/QuestInterface.mjs +0 -2
- package/dist/override/QuestInterface.mjs.map +0 -1
- package/dist/override/RoomInterface.d.mts +0 -33
- package/dist/override/RoomInterface.d.ts +0 -33
- package/dist/override/RoomInterface.js +0 -2
- package/dist/override/RoomInterface.js.map +0 -1
- package/dist/override/RoomInterface.mjs +0 -2
- package/dist/override/RoomInterface.mjs.map +0 -1
- package/dist/override/StageInterface.d.mts +0 -34
- package/dist/override/StageInterface.d.ts +0 -34
- package/dist/override/StageInterface.js +0 -2
- package/dist/override/StageInterface.js.map +0 -1
- package/dist/override/StageInterface.mjs +0 -2
- package/dist/override/StageInterface.mjs.map +0 -1
- package/dist/override/index.d.mts +0 -12
- package/dist/override/index.d.ts +0 -12
- package/dist/override/index.js +0 -2
- package/dist/override/index.js.map +0 -1
- package/dist/override/index.mjs +0 -2
- package/dist/override/index.mjs.map +0 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { CommitmentInterface, LocationInterface, MapInterface } from '@drincs/nqtr
|
|
1
|
+
import { CommitmentInterface as CommitmentInterface$1, LocationInterface as LocationInterface$1, MapInterface as MapInterface$1, RoomInterface as RoomInterface$1 } from '@drincs/nqtr';
|
|
2
2
|
import { CharacterInterface } from '@drincs/pixi-vn';
|
|
3
3
|
import { ActivityBaseInternalInterface } from './interface/ActivityInterface.js';
|
|
4
4
|
import ExecutionType from './types/ExecutionType.js';
|
|
5
5
|
import NavigationAbstractInterface from './interface/navigation/NavigationAbstractClass.js';
|
|
6
6
|
|
|
7
|
-
interface
|
|
7
|
+
interface CommitmentInterface extends CommitmentBaseInternalInterface, CommitmentInterface$1 {
|
|
8
8
|
}
|
|
9
9
|
interface CommitmentBaseInternalInterface extends ActivityBaseInternalInterface {
|
|
10
10
|
/**
|
|
@@ -14,7 +14,7 @@ interface CommitmentBaseInternalInterface extends ActivityBaseInternalInterface
|
|
|
14
14
|
/**
|
|
15
15
|
* The room where the commitment is.
|
|
16
16
|
*/
|
|
17
|
-
readonly room:
|
|
17
|
+
readonly room: RoomInterface;
|
|
18
18
|
/**
|
|
19
19
|
* Execution type. If is "automatic" the onRun() runned automatically when the palayer is in the room. If is "interaction" the player must interact with the character to run the onRun() function.
|
|
20
20
|
* If you set "automatic" remember to remove the commitment when it is no longer needed, because otherwise it repeats itself every time.
|
|
@@ -27,7 +27,7 @@ interface CommitmentBaseInternalInterface extends ActivityBaseInternalInterface
|
|
|
27
27
|
priority: number;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
interface
|
|
30
|
+
interface LocationInterface extends LocationInternalInterface, LocationInterface$1 {
|
|
31
31
|
}
|
|
32
32
|
interface LocationInternalInterface extends NavigationAbstractInterface {
|
|
33
33
|
/**
|
|
@@ -37,15 +37,15 @@ interface LocationInternalInterface extends NavigationAbstractInterface {
|
|
|
37
37
|
/**
|
|
38
38
|
* The map where the location is.
|
|
39
39
|
*/
|
|
40
|
-
readonly map:
|
|
40
|
+
readonly map: MapInterface;
|
|
41
41
|
/**
|
|
42
42
|
* Get all rooms in the location.
|
|
43
43
|
* @returns The rooms in the location.
|
|
44
44
|
*/
|
|
45
|
-
readonly rooms:
|
|
45
|
+
readonly rooms: RoomInterface[];
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
interface
|
|
48
|
+
interface MapInterface extends MapBaseInternalInterface, MapInterface$1 {
|
|
49
49
|
}
|
|
50
50
|
interface MapBaseInternalInterface extends NavigationAbstractInterface {
|
|
51
51
|
/**
|
|
@@ -56,10 +56,10 @@ interface MapBaseInternalInterface extends NavigationAbstractInterface {
|
|
|
56
56
|
* Get all locations in the map.
|
|
57
57
|
* @returns The locations in the map.
|
|
58
58
|
*/
|
|
59
|
-
readonly locations:
|
|
59
|
+
readonly locations: LocationInterface[];
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
-
interface
|
|
62
|
+
interface RoomInterface extends RoomBaseInternalInterface, RoomInterface$1 {
|
|
63
63
|
}
|
|
64
64
|
interface RoomBaseInternalInterface extends NavigationAbstractInterface {
|
|
65
65
|
/**
|
|
@@ -69,11 +69,11 @@ interface RoomBaseInternalInterface extends NavigationAbstractInterface {
|
|
|
69
69
|
/**
|
|
70
70
|
* The location where the room is.
|
|
71
71
|
*/
|
|
72
|
-
readonly location:
|
|
72
|
+
readonly location: LocationInterface;
|
|
73
73
|
/**
|
|
74
74
|
* Get the character commitments of the room.
|
|
75
75
|
*/
|
|
76
|
-
readonly routine:
|
|
76
|
+
readonly routine: CommitmentInterface[];
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
-
export type {
|
|
79
|
+
export type { CommitmentInterface as C, LocationInterface as L, MapInterface as M, RoomInterface as R, CommitmentBaseInternalInterface as a, LocationInternalInterface as b, MapBaseInternalInterface as c, RoomBaseInternalInterface as d };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { CommitmentInterface, LocationInterface, MapInterface } from '@drincs/nqtr
|
|
1
|
+
import { CommitmentInterface as CommitmentInterface$1, LocationInterface as LocationInterface$1, MapInterface as MapInterface$1, RoomInterface as RoomInterface$1 } from '@drincs/nqtr';
|
|
2
2
|
import { CharacterInterface } from '@drincs/pixi-vn';
|
|
3
3
|
import { ActivityBaseInternalInterface } from './interface/ActivityInterface.mjs';
|
|
4
4
|
import ExecutionType from './types/ExecutionType.mjs';
|
|
5
5
|
import NavigationAbstractInterface from './interface/navigation/NavigationAbstractClass.mjs';
|
|
6
6
|
|
|
7
|
-
interface
|
|
7
|
+
interface CommitmentInterface extends CommitmentBaseInternalInterface, CommitmentInterface$1 {
|
|
8
8
|
}
|
|
9
9
|
interface CommitmentBaseInternalInterface extends ActivityBaseInternalInterface {
|
|
10
10
|
/**
|
|
@@ -14,7 +14,7 @@ interface CommitmentBaseInternalInterface extends ActivityBaseInternalInterface
|
|
|
14
14
|
/**
|
|
15
15
|
* The room where the commitment is.
|
|
16
16
|
*/
|
|
17
|
-
readonly room:
|
|
17
|
+
readonly room: RoomInterface;
|
|
18
18
|
/**
|
|
19
19
|
* Execution type. If is "automatic" the onRun() runned automatically when the palayer is in the room. If is "interaction" the player must interact with the character to run the onRun() function.
|
|
20
20
|
* If you set "automatic" remember to remove the commitment when it is no longer needed, because otherwise it repeats itself every time.
|
|
@@ -27,7 +27,7 @@ interface CommitmentBaseInternalInterface extends ActivityBaseInternalInterface
|
|
|
27
27
|
priority: number;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
interface
|
|
30
|
+
interface LocationInterface extends LocationInternalInterface, LocationInterface$1 {
|
|
31
31
|
}
|
|
32
32
|
interface LocationInternalInterface extends NavigationAbstractInterface {
|
|
33
33
|
/**
|
|
@@ -37,15 +37,15 @@ interface LocationInternalInterface extends NavigationAbstractInterface {
|
|
|
37
37
|
/**
|
|
38
38
|
* The map where the location is.
|
|
39
39
|
*/
|
|
40
|
-
readonly map:
|
|
40
|
+
readonly map: MapInterface;
|
|
41
41
|
/**
|
|
42
42
|
* Get all rooms in the location.
|
|
43
43
|
* @returns The rooms in the location.
|
|
44
44
|
*/
|
|
45
|
-
readonly rooms:
|
|
45
|
+
readonly rooms: RoomInterface[];
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
interface
|
|
48
|
+
interface MapInterface extends MapBaseInternalInterface, MapInterface$1 {
|
|
49
49
|
}
|
|
50
50
|
interface MapBaseInternalInterface extends NavigationAbstractInterface {
|
|
51
51
|
/**
|
|
@@ -56,10 +56,10 @@ interface MapBaseInternalInterface extends NavigationAbstractInterface {
|
|
|
56
56
|
* Get all locations in the map.
|
|
57
57
|
* @returns The locations in the map.
|
|
58
58
|
*/
|
|
59
|
-
readonly locations:
|
|
59
|
+
readonly locations: LocationInterface[];
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
-
interface
|
|
62
|
+
interface RoomInterface extends RoomBaseInternalInterface, RoomInterface$1 {
|
|
63
63
|
}
|
|
64
64
|
interface RoomBaseInternalInterface extends NavigationAbstractInterface {
|
|
65
65
|
/**
|
|
@@ -69,11 +69,11 @@ interface RoomBaseInternalInterface extends NavigationAbstractInterface {
|
|
|
69
69
|
/**
|
|
70
70
|
* The location where the room is.
|
|
71
71
|
*/
|
|
72
|
-
readonly location:
|
|
72
|
+
readonly location: LocationInterface;
|
|
73
73
|
/**
|
|
74
74
|
* Get the character commitments of the room.
|
|
75
75
|
*/
|
|
76
|
-
readonly routine:
|
|
76
|
+
readonly routine: CommitmentInterface[];
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
-
export type {
|
|
79
|
+
export type { CommitmentInterface as C, LocationInterface as L, MapInterface as M, RoomInterface as R, CommitmentBaseInternalInterface as a, LocationInternalInterface as b, MapBaseInternalInterface as c, RoomBaseInternalInterface as d };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { QuestInterface,
|
|
1
|
+
import { QuestInterface as QuestInterface$1, OnRunProps, StageInterface as StageInterface$1 } from '@drincs/nqtr';
|
|
2
2
|
|
|
3
3
|
type QuestsRequiredType = {
|
|
4
|
-
quest:
|
|
4
|
+
quest: QuestInterface;
|
|
5
5
|
stageNumber: number;
|
|
6
6
|
};
|
|
7
7
|
|
|
8
|
-
interface
|
|
8
|
+
interface QuestInterface extends QuestBaseInternalInterface, QuestInterface$1 {
|
|
9
9
|
}
|
|
10
10
|
interface QuestBaseInternalInterface {
|
|
11
11
|
/**
|
|
@@ -15,7 +15,7 @@ interface QuestBaseInternalInterface {
|
|
|
15
15
|
/**
|
|
16
16
|
* The stages of the quest.
|
|
17
17
|
*/
|
|
18
|
-
readonly stages:
|
|
18
|
+
readonly stages: StageInterface[];
|
|
19
19
|
/**
|
|
20
20
|
* The index of the current stage.
|
|
21
21
|
*/
|
|
@@ -23,7 +23,7 @@ interface QuestBaseInternalInterface {
|
|
|
23
23
|
/**
|
|
24
24
|
* The current stage.
|
|
25
25
|
*/
|
|
26
|
-
readonly currentStage?:
|
|
26
|
+
readonly currentStage?: StageInterface;
|
|
27
27
|
/**
|
|
28
28
|
* If the quest is started.
|
|
29
29
|
*/
|
|
@@ -39,38 +39,38 @@ interface QuestBaseInternalInterface {
|
|
|
39
39
|
/**
|
|
40
40
|
* The function that will be called when the quest starts.
|
|
41
41
|
*/
|
|
42
|
-
readonly onStart?: (stage:
|
|
42
|
+
readonly onStart?: (stage: QuestInterface, props: OnRunProps) => void;
|
|
43
43
|
/**
|
|
44
44
|
* The function that will be called when the quest goes to the next stage.
|
|
45
45
|
*/
|
|
46
|
-
readonly onNextStage?: (stage:
|
|
46
|
+
readonly onNextStage?: (stage: QuestInterface, props: OnRunProps) => void;
|
|
47
47
|
/**
|
|
48
48
|
* Start the quest.
|
|
49
49
|
* @param props The properties for the start stage. If you not want to pass any property, you can pass an {}.
|
|
50
50
|
* @returns
|
|
51
51
|
*/
|
|
52
|
-
start(props:
|
|
52
|
+
start(props: OnRunProps): void;
|
|
53
53
|
/**
|
|
54
54
|
* Go to the next stage if the current stage is completed.
|
|
55
55
|
* If you want to force the change of stage, use goNextStage.
|
|
56
56
|
* @param props The properties. If you not want to pass any property, you can pass an {}.
|
|
57
57
|
* @returns true if the stage was changed, false otherwise.
|
|
58
58
|
*/
|
|
59
|
-
tryToGoNextStage(props:
|
|
59
|
+
tryToGoNextStage(props: OnRunProps): boolean;
|
|
60
60
|
/**
|
|
61
61
|
* Complete the current stage and go to the next stage.
|
|
62
62
|
* If you want to go to the next stage only if the current stage is completed, use tryToGoNextStage.
|
|
63
63
|
* @param props The properties. If you not want to pass any property, you can pass an {}.
|
|
64
64
|
* @returns true if the stage was changed, false otherwise.
|
|
65
65
|
*/
|
|
66
|
-
completeCurrentStageAndGoNext(props:
|
|
66
|
+
completeCurrentStageAndGoNext(props: OnRunProps): boolean;
|
|
67
67
|
/**
|
|
68
68
|
* Go to the next stage without checking if the current stage is completed.
|
|
69
69
|
* If you want to go to the next stage only if the current stage is completed, use tryToGoNextStage.
|
|
70
70
|
* @param props The properties. If you not want to pass any property, you can pass an {}.
|
|
71
71
|
* @returns returns true if the stage was changed, false otherwise.
|
|
72
72
|
*/
|
|
73
|
-
goNextStage(props:
|
|
73
|
+
goNextStage(props: OnRunProps): boolean;
|
|
74
74
|
/**
|
|
75
75
|
* If the current stage must start. It is true if the current stage is not started, can start and not completed.
|
|
76
76
|
*/
|
|
@@ -79,10 +79,10 @@ interface QuestBaseInternalInterface {
|
|
|
79
79
|
* Start the current stage.
|
|
80
80
|
* @param props The properties for the start stage. If you not want to pass any property, you can pass an {}.
|
|
81
81
|
*/
|
|
82
|
-
startCurrentStage(props:
|
|
82
|
+
startCurrentStage(props: OnRunProps): void;
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
-
interface
|
|
85
|
+
interface StageInterface extends StageBaseInternalInterface, StageInterface$1 {
|
|
86
86
|
}
|
|
87
87
|
interface StageBaseInternalInterface {
|
|
88
88
|
/**
|
|
@@ -92,11 +92,11 @@ interface StageBaseInternalInterface {
|
|
|
92
92
|
/**
|
|
93
93
|
* The function that will be called when the stage starts.
|
|
94
94
|
*/
|
|
95
|
-
readonly onStart?: (stage:
|
|
95
|
+
readonly onStart?: (stage: StageInterface, props: OnRunProps) => void;
|
|
96
96
|
/**
|
|
97
97
|
* The function that will be called when the stage ends.
|
|
98
98
|
*/
|
|
99
|
-
readonly onEnd?: (stage:
|
|
99
|
+
readonly onEnd?: (stage: StageInterface, props: OnRunProps) => void;
|
|
100
100
|
/**
|
|
101
101
|
* Check if the flag and goals are completed.
|
|
102
102
|
* You can force the completion of the stage by setting the completed property to true.
|
|
@@ -148,7 +148,7 @@ interface StageBaseInternalInterface {
|
|
|
148
148
|
/**
|
|
149
149
|
* The function that will be called when the stage starts.
|
|
150
150
|
*/
|
|
151
|
-
start(props:
|
|
151
|
+
start(props: OnRunProps): void;
|
|
152
152
|
/**
|
|
153
153
|
* The number of days required to start the stage.
|
|
154
154
|
*/
|
|
@@ -159,4 +159,4 @@ interface StageBaseInternalInterface {
|
|
|
159
159
|
readonly questsRequiredToStart: QuestsRequiredType[];
|
|
160
160
|
}
|
|
161
161
|
|
|
162
|
-
export type {
|
|
162
|
+
export type { QuestInterface as Q, StageInterface as S, QuestsRequiredType as a, QuestBaseInternalInterface as b, StageBaseInternalInterface as c };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { QuestInterface,
|
|
1
|
+
import { QuestInterface as QuestInterface$1, OnRunProps, StageInterface as StageInterface$1 } from '@drincs/nqtr';
|
|
2
2
|
|
|
3
3
|
type QuestsRequiredType = {
|
|
4
|
-
quest:
|
|
4
|
+
quest: QuestInterface;
|
|
5
5
|
stageNumber: number;
|
|
6
6
|
};
|
|
7
7
|
|
|
8
|
-
interface
|
|
8
|
+
interface QuestInterface extends QuestBaseInternalInterface, QuestInterface$1 {
|
|
9
9
|
}
|
|
10
10
|
interface QuestBaseInternalInterface {
|
|
11
11
|
/**
|
|
@@ -15,7 +15,7 @@ interface QuestBaseInternalInterface {
|
|
|
15
15
|
/**
|
|
16
16
|
* The stages of the quest.
|
|
17
17
|
*/
|
|
18
|
-
readonly stages:
|
|
18
|
+
readonly stages: StageInterface[];
|
|
19
19
|
/**
|
|
20
20
|
* The index of the current stage.
|
|
21
21
|
*/
|
|
@@ -23,7 +23,7 @@ interface QuestBaseInternalInterface {
|
|
|
23
23
|
/**
|
|
24
24
|
* The current stage.
|
|
25
25
|
*/
|
|
26
|
-
readonly currentStage?:
|
|
26
|
+
readonly currentStage?: StageInterface;
|
|
27
27
|
/**
|
|
28
28
|
* If the quest is started.
|
|
29
29
|
*/
|
|
@@ -39,38 +39,38 @@ interface QuestBaseInternalInterface {
|
|
|
39
39
|
/**
|
|
40
40
|
* The function that will be called when the quest starts.
|
|
41
41
|
*/
|
|
42
|
-
readonly onStart?: (stage:
|
|
42
|
+
readonly onStart?: (stage: QuestInterface, props: OnRunProps) => void;
|
|
43
43
|
/**
|
|
44
44
|
* The function that will be called when the quest goes to the next stage.
|
|
45
45
|
*/
|
|
46
|
-
readonly onNextStage?: (stage:
|
|
46
|
+
readonly onNextStage?: (stage: QuestInterface, props: OnRunProps) => void;
|
|
47
47
|
/**
|
|
48
48
|
* Start the quest.
|
|
49
49
|
* @param props The properties for the start stage. If you not want to pass any property, you can pass an {}.
|
|
50
50
|
* @returns
|
|
51
51
|
*/
|
|
52
|
-
start(props:
|
|
52
|
+
start(props: OnRunProps): void;
|
|
53
53
|
/**
|
|
54
54
|
* Go to the next stage if the current stage is completed.
|
|
55
55
|
* If you want to force the change of stage, use goNextStage.
|
|
56
56
|
* @param props The properties. If you not want to pass any property, you can pass an {}.
|
|
57
57
|
* @returns true if the stage was changed, false otherwise.
|
|
58
58
|
*/
|
|
59
|
-
tryToGoNextStage(props:
|
|
59
|
+
tryToGoNextStage(props: OnRunProps): boolean;
|
|
60
60
|
/**
|
|
61
61
|
* Complete the current stage and go to the next stage.
|
|
62
62
|
* If you want to go to the next stage only if the current stage is completed, use tryToGoNextStage.
|
|
63
63
|
* @param props The properties. If you not want to pass any property, you can pass an {}.
|
|
64
64
|
* @returns true if the stage was changed, false otherwise.
|
|
65
65
|
*/
|
|
66
|
-
completeCurrentStageAndGoNext(props:
|
|
66
|
+
completeCurrentStageAndGoNext(props: OnRunProps): boolean;
|
|
67
67
|
/**
|
|
68
68
|
* Go to the next stage without checking if the current stage is completed.
|
|
69
69
|
* If you want to go to the next stage only if the current stage is completed, use tryToGoNextStage.
|
|
70
70
|
* @param props The properties. If you not want to pass any property, you can pass an {}.
|
|
71
71
|
* @returns returns true if the stage was changed, false otherwise.
|
|
72
72
|
*/
|
|
73
|
-
goNextStage(props:
|
|
73
|
+
goNextStage(props: OnRunProps): boolean;
|
|
74
74
|
/**
|
|
75
75
|
* If the current stage must start. It is true if the current stage is not started, can start and not completed.
|
|
76
76
|
*/
|
|
@@ -79,10 +79,10 @@ interface QuestBaseInternalInterface {
|
|
|
79
79
|
* Start the current stage.
|
|
80
80
|
* @param props The properties for the start stage. If you not want to pass any property, you can pass an {}.
|
|
81
81
|
*/
|
|
82
|
-
startCurrentStage(props:
|
|
82
|
+
startCurrentStage(props: OnRunProps): void;
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
-
interface
|
|
85
|
+
interface StageInterface extends StageBaseInternalInterface, StageInterface$1 {
|
|
86
86
|
}
|
|
87
87
|
interface StageBaseInternalInterface {
|
|
88
88
|
/**
|
|
@@ -92,11 +92,11 @@ interface StageBaseInternalInterface {
|
|
|
92
92
|
/**
|
|
93
93
|
* The function that will be called when the stage starts.
|
|
94
94
|
*/
|
|
95
|
-
readonly onStart?: (stage:
|
|
95
|
+
readonly onStart?: (stage: StageInterface, props: OnRunProps) => void;
|
|
96
96
|
/**
|
|
97
97
|
* The function that will be called when the stage ends.
|
|
98
98
|
*/
|
|
99
|
-
readonly onEnd?: (stage:
|
|
99
|
+
readonly onEnd?: (stage: StageInterface, props: OnRunProps) => void;
|
|
100
100
|
/**
|
|
101
101
|
* Check if the flag and goals are completed.
|
|
102
102
|
* You can force the completion of the stage by setting the completed property to true.
|
|
@@ -148,7 +148,7 @@ interface StageBaseInternalInterface {
|
|
|
148
148
|
/**
|
|
149
149
|
* The function that will be called when the stage starts.
|
|
150
150
|
*/
|
|
151
|
-
start(props:
|
|
151
|
+
start(props: OnRunProps): void;
|
|
152
152
|
/**
|
|
153
153
|
* The number of days required to start the stage.
|
|
154
154
|
*/
|
|
@@ -159,4 +159,4 @@ interface StageBaseInternalInterface {
|
|
|
159
159
|
readonly questsRequiredToStart: QuestsRequiredType[];
|
|
160
160
|
}
|
|
161
161
|
|
|
162
|
-
export type {
|
|
162
|
+
export type { QuestInterface as Q, StageInterface as S, QuestsRequiredType as a, QuestBaseInternalInterface as b, StageBaseInternalInterface as c };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import ActivityInterface from '../interface/ActivityInterface.mjs';
|
|
2
2
|
import ActivityProps from '../interface/ActivityProps.mjs';
|
|
3
3
|
import { OnRunEvent } from '../types/OnRunEvent.mjs';
|
|
4
4
|
import ActivityStoredClass from './ActivityStoredClass.mjs';
|
|
5
|
-
import '@drincs/nqtr
|
|
5
|
+
import '@drincs/nqtr';
|
|
6
6
|
import '@drincs/pixi-vn';
|
|
7
7
|
|
|
8
8
|
/**
|
|
@@ -28,13 +28,13 @@ import '@drincs/pixi-vn';
|
|
|
28
28
|
* )
|
|
29
29
|
* ```
|
|
30
30
|
*/
|
|
31
|
-
declare class ActivityBaseModel extends ActivityStoredClass<
|
|
31
|
+
declare class ActivityBaseModel extends ActivityStoredClass<ActivityInterface> {
|
|
32
32
|
/**
|
|
33
33
|
* @param id The activity id, that must be unique.
|
|
34
34
|
* @param onRun The function that is called when the activity is runned. Have 2 parameters: the runned activity and the yourParams object, that is an object with the parameters that you want to pass to the onRun function.
|
|
35
35
|
* @param props The activity properties.
|
|
36
36
|
*/
|
|
37
|
-
constructor(id: string, onRun: OnRunEvent<
|
|
37
|
+
constructor(id: string, onRun: OnRunEvent<ActivityInterface>, props: ActivityProps);
|
|
38
38
|
private defaultName;
|
|
39
39
|
/**
|
|
40
40
|
* The name of the activity.
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import ActivityInterface from '../interface/ActivityInterface.js';
|
|
2
2
|
import ActivityProps from '../interface/ActivityProps.js';
|
|
3
3
|
import { OnRunEvent } from '../types/OnRunEvent.js';
|
|
4
4
|
import ActivityStoredClass from './ActivityStoredClass.js';
|
|
5
|
-
import '@drincs/nqtr
|
|
5
|
+
import '@drincs/nqtr';
|
|
6
6
|
import '@drincs/pixi-vn';
|
|
7
7
|
|
|
8
8
|
/**
|
|
@@ -28,13 +28,13 @@ import '@drincs/pixi-vn';
|
|
|
28
28
|
* )
|
|
29
29
|
* ```
|
|
30
30
|
*/
|
|
31
|
-
declare class ActivityBaseModel extends ActivityStoredClass<
|
|
31
|
+
declare class ActivityBaseModel extends ActivityStoredClass<ActivityInterface> {
|
|
32
32
|
/**
|
|
33
33
|
* @param id The activity id, that must be unique.
|
|
34
34
|
* @param onRun The function that is called when the activity is runned. Have 2 parameters: the runned activity and the yourParams object, that is an object with the parameters that you want to pass to the onRun function.
|
|
35
35
|
* @param props The activity properties.
|
|
36
36
|
*/
|
|
37
|
-
constructor(id: string, onRun: OnRunEvent<
|
|
37
|
+
constructor(id: string, onRun: OnRunEvent<ActivityInterface>, props: ActivityProps);
|
|
38
38
|
private defaultName;
|
|
39
39
|
/**
|
|
40
40
|
* The name of the activity.
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
'use strict';var pixiVn=require('@drincs/pixi-vn');var a="___nqtr-time_manager_data___";var n=class{static minDayHours=0;static maxDayHours=24;static defaultTimeSpent=1;static timeSlots=[];static weekLength=7;static weekendStartDay=this.weekLength-1;static weekDaysNames=[]};var d=class{initialize(e){let{minDayHours:t=0,maxDayHours:r=24,defaultTimeSpent:o=1,timeSlots:T=[],weekLength:m=7,weekendStartDay:v=m-1,weekDaysNames:
|
|
1
|
+
'use strict';var pixiVn=require('@drincs/pixi-vn');var a="___nqtr-time_manager_data___";var n=class{static minDayHours=0;static maxDayHours=24;static defaultTimeSpent=1;static timeSlots=[];static weekLength=7;static weekendStartDay=this.weekLength-1;static weekDaysNames=[]};var d=class{initialize(e){let{minDayHours:t=0,maxDayHours:r=24,defaultTimeSpent:o=1,timeSlots:T=[],weekLength:m=7,weekendStartDay:v=m-1,weekDaysNames:H=[]}=e;n.minDayHours=t,n.maxDayHours=r,n.defaultTimeSpent=o,n.timeSlots=T,n.weekLength=m,v>=n.weekLength?console.warn(`[NQTR] Weekend start day should be less than week length ${m}, so will be ignored`):n.weekendStartDay=v,H.length!==m?console.warn(`[NQTR] Week days names should be equal to week length ${m}, so will be ignored`):n.weekDaysNames=H;}get minDayHours(){return n.minDayHours}get maxDayHours(){return n.maxDayHours}get defaultTimeSpent(){return n.defaultTimeSpent}get timeSlots(){return n.timeSlots}get weekLength(){return n.weekLength}get weekendStartDay(){return n.weekendStartDay}get weekDaysNames(){return n.weekDaysNames}get currentHour(){let e=pixiVn.storage.getVariable(a)||{};return e.hasOwnProperty("currentHour")&&typeof e.currentHour=="number"?e.currentHour:this.minDayHours}set currentHour(e){let t=pixiVn.storage.getVariable(a)||{};typeof e=="number"?t.currentHour=e:delete t.currentHour,pixiVn.storage.setVariable(a,t);}get currentDay(){let e=pixiVn.storage.getVariable(a)||{};return e.hasOwnProperty("currentDay")&&typeof e.currentDay=="number"?e.currentDay:0}set currentDay(e){let t=pixiVn.storage.getVariable(a)||{};typeof e=="number"?t.currentDay=e:delete t.currentDay,pixiVn.storage.setVariable(a,t);}get isWeekend(){return this.currentWeekDayNumber>=this.weekendStartDay}get currentWeekDayNumber(){return this.currentDay%this.weekLength+1}get currentDayName(){let e=this.currentWeekDayNumber-1;return e>=this.weekDaysNames.length?(console.warn(`[NQTR] Week day name is not defined for day ${e}`,this.weekDaysNames),""):this.weekDaysNames[e]}get currentTimeSlot(){if(this.timeSlots.length===0)return console.warn("[NQTR] Time slots are not defined"),0;for(let e=0;e<this.timeSlots.length;e++){let t=this.timeSlots[e];if(this.timeSlots.length>e+1&&this.nowIsBetween(t.startHour,this.timeSlots[e+1].startHour))return e}return this.timeSlots.length-1}increaseHour(e=this.defaultTimeSpent){let t=this.currentHour+e;return t>=this.maxDayHours&&(this.increaseDay(),t=this.minDayHours+(t-this.maxDayHours)),this.currentHour=t,this.currentHour}increaseDay(e=this.minDayHours,t=1){let r=this.currentDay+t;return this.currentDay=r,this.currentHour=e,this.currentDay}nowIsBetween(e,t){e===undefined&&(e=this.minDayHours),t===undefined&&(t=this.maxDayHours);let r=this.currentHour;return e<t?r>=e&&r<t:r>=e||r<t}};var g=new d;var k="__nqtr-activity__",y=class extends pixiVn.StoredClassModel{constructor(t,r,o,T=k){super(T,t);this._onRun=r;this._fromHour=o.fromHour,this._toHour=o.toHour,this._fromDay=o.fromDay,this._toDay=o.toDay;}_fromHour;get fromHour(){return this._fromHour}_toHour;get toHour(){return this._toHour}_fromDay;get fromDay(){return this._fromDay}_toDay;get toDay(){return this._toDay}get run(){return t=>this._onRun(this,t)}get expired(){return !!(this.toDay&&this.toDay<=g.currentDay)}get isActive(){return !(this.fromDay&&this.fromDay>g.currentDay||this.toDay&&this.toDay<g.currentDay||!g.nowIsBetween(this.fromHour,this.toHour))}};var w=class extends y{constructor(e,t,r){super(e,t,{fromHour:r.fromHour,toHour:r.toHour,fromDay:r.fromDay,toDay:r.toDay}),this.defaultName=r.name||"",this.defaultDisabled=r.disabled||false,this.defaultHidden=r.hidden||false,this._icon=r.renderIcon;}defaultName;get name(){return this.getStorageProperty("name")||this.defaultName}set name(e){this.setStorageProperty("name",e);}defaultDisabled;get disabled(){let e=this.getStorageProperty("disabled")||this.defaultDisabled;return typeof e=="string"?pixiVn.getFlag(e):e}set disabled(e){this.setStorageProperty("disabled",e);}defaultHidden;get hidden(){let e=this.getStorageProperty("hidden")||this.defaultHidden;return typeof e=="string"?pixiVn.getFlag(e):e}set hidden(e){this.setStorageProperty("hidden",e);}_icon;get icon(){return this._icon}};module.exports=w;//# sourceMappingURL=ActivityBaseModel.js.map
|
|
2
2
|
//# sourceMappingURL=ActivityBaseModel.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/constants.ts","../../src/managers/TimeManagerSettings.ts","../../src/managers/TimeManager.ts","../../src/managers/index.ts","../../src/classes/ActivityStoredClass.ts","../../src/classes/ActivityBaseModel.ts"],"names":["TIME_DATA_KEY","TimeManagerSettings","TimeManager","settings","minDayHours","maxDayHours","defaultTimeSpent","timeSlots","weekLength","weekendStartDay","weekDaysNames","data","storage","value","weekDayNumber","index","slot","timeSpent","newHour","newDayHour","days","newDay","fromHour","toHour","currentHour","timeTracker","ACTIVITY_CATEGORY","ActivityStoredClass","StoredClassModel","id","_onRun","props","category","ActivityBaseModel","onRun","getFlag"],"mappings":"mDACO,IAAMA,EAAgB,8BCC7B,CAAA,IAAqBC,EAArB,KAAiE,CAC7D,OAAO,WAAA,CAAsB,EAC7B,OAAO,WAAA,CAAsB,GAC7B,OAAO,gBAAA,CAA2B,EAClC,OAAO,SAAA,CAA0B,EAAC,CAClC,OAAO,UAAqB,CAAA,CAAA,CAC5B,OAAO,eAA0B,CAAA,IAAA,CAAK,WAAa,CACnD,CAAA,OAAO,aAA0B,CAAA,EACrC,CCJA,CAAA,IAAqBC,EAArB,KAAiC,CAC7B,WAAWC,CAAwB,CAAA,CAC/B,GAAM,CACF,YAAAC,CAAc,CAAA,CAAA,CACd,YAAAC,CA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IR,IAAI,IAAA,EAA2B,CAC3B,OAAO,IAAA,CAAK,KAChB,CACJ","file":"ActivityBaseModel.js","sourcesContent":["export const TIME_SETTINGS_KEY = '___nqtr-time_manager_settings___';\nexport const TIME_DATA_KEY = '___nqtr-time_manager_data___';\n\n","import { ITimeStlot, TimeSettings } from \"../types/TimeSettings\";\n\nexport default class TimeManagerSettings implements TimeSettings {\n static minDayHours: number = 0\n static maxDayHours: number = 24\n static defaultTimeSpent: number = 1\n static timeSlots: ITimeStlot[] = []\n static weekLength: number = 7\n static weekendStartDay: number = this.weekLength - 1\n static weekDaysNames: string[] = []\n}\n","import { storage } from \"@drincs/pixi-vn\";\nimport { TIME_DATA_KEY } from \"../constants\";\nimport TimeDataType from \"../types/TimeDataType\";\nimport { ITimeStlot, TimeSettings } from \"../types/TimeSettings\";\nimport TimeManagerSettings from \"./TimeManagerSettings\";\n\nexport default class TimeManager {\n initialize(settings: TimeSettings) {\n const {\n minDayHours = 0,\n maxDayHours = 24,\n defaultTimeSpent = 1,\n timeSlots = [],\n weekLength = 7,\n weekendStartDay = weekLength - 1,\n weekDaysNames = [],\n } = settings\n TimeManagerSettings.minDayHours = minDayHours\n TimeManagerSettings.maxDayHours = maxDayHours\n TimeManagerSettings.defaultTimeSpent = defaultTimeSpent\n TimeManagerSettings.timeSlots = timeSlots\n TimeManagerSettings.weekLength = weekLength\n if (weekendStartDay >= TimeManagerSettings.weekLength) {\n console.warn(`[NQTR] Weekend start day should be less than week length ${weekLength}, so will be ignored`)\n }\n else {\n TimeManagerSettings.weekendStartDay = weekendStartDay\n }\n if (weekDaysNames.length !== weekLength) {\n console.warn(`[NQTR] Week days names should be equal to week length ${weekLength}, so will be ignored`)\n }\n else {\n TimeManagerSettings.weekDaysNames = weekDaysNames\n }\n }\n get minDayHours(): number {\n return TimeManagerSettings.minDayHours\n }\n get maxDayHours(): number {\n return TimeManagerSettings.maxDayHours\n }\n get defaultTimeSpent(): number {\n return TimeManagerSettings.defaultTimeSpent\n }\n get timeSlots(): ITimeStlot[] {\n return TimeManagerSettings.timeSlots\n }\n get weekLength(): number {\n return TimeManagerSettings.weekLength\n }\n get weekendStartDay(): number {\n return TimeManagerSettings.weekendStartDay\n }\n get weekDaysNames(): string[] {\n return TimeManagerSettings.weekDaysNames\n }\n\n /**\n * Get the current hour\n */\n get currentHour(): number {\n let data = storage.getVariable<TimeDataType>(TIME_DATA_KEY) || {}\n if (data.hasOwnProperty('currentHour') && typeof data.currentHour === 'number') {\n return data.currentHour\n }\n return this.minDayHours\n }\n set currentHour(value: number | undefined) {\n let data = storage.getVariable<TimeDataType>(TIME_DATA_KEY) || {}\n if (typeof value === 'number') {\n data.currentHour = value\n } else {\n delete data.currentHour\n }\n storage.setVariable(TIME_DATA_KEY, data)\n }\n /**\n * Get the current day\n */\n get currentDay(): number {\n let data = storage.getVariable<TimeDataType>(TIME_DATA_KEY) || {}\n if (data.hasOwnProperty('currentDay') && typeof data.currentDay === 'number') {\n return data.currentDay\n }\n return 0\n }\n set currentDay(value: number | undefined) {\n let data = storage.getVariable<TimeDataType>(TIME_DATA_KEY) || {}\n if (typeof value === 'number') {\n data.currentDay = value\n }\n else {\n delete data.currentDay\n }\n storage.setVariable(TIME_DATA_KEY, data)\n }\n /**\n * If the current day is greater than or equal to the weekend start day, then it will return true.\n */\n get isWeekend(): boolean {\n return this.currentWeekDayNumber >= this.weekendStartDay\n }\n /**\n * Get the current week day number (1 - {@link weekLength}).\n * For example, if the week length is 7 and the current day is 10, then the result will be 4.\n */\n get currentWeekDayNumber(): number {\n let result = this.currentDay % this.weekLength\n return result + 1\n }\n /**\n * Get the current week day name. If the week days names are not defined, then it will return undefined.\n * For example, if the week days names are ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'] and the current day is 10, then the result will be 'Thursday'.\n * @default \"\"\n */\n get currentDayName(): string {\n let weekDayNumber = this.currentWeekDayNumber - 1\n if (weekDayNumber >= this.weekDaysNames.length) {\n console.warn(`[NQTR] Week day name is not defined for day ${weekDayNumber}`, this.weekDaysNames)\n return \"\"\n }\n return this.weekDaysNames[weekDayNumber]\n }\n /**\n * Get the current {@link timeSlots} index.\n * You can use this property to create \"Image that changes based on the time period\":\n * @example\n * ```tsx\n * import { weekLength } from '@drincs/nqtr';\n * \n * function changeBackground() {\n * return (\n * <img src={`background-currentTimeSlot.currentTimeSlot.png`} />\n * )\n * }\n */\n get currentTimeSlot(): number {\n if (this.timeSlots.length === 0) {\n console.warn('[NQTR] Time slots are not defined')\n return 0\n }\n for (let index = 0; index < this.timeSlots.length; index++) {\n let slot = this.timeSlots[index]\n if (this.timeSlots.length > index + 1) {\n if (this.nowIsBetween(slot.startHour, this.timeSlots[index + 1].startHour)) {\n return index\n }\n }\n }\n return this.timeSlots.length - 1\n }\n\n /**\n * This function will increase the current hour by the given time spent.\n * If the new hour is greater than or equal to the max day hours, then it will increase the day and set the new hour.\n * @param timeSpent is the time spent in hours (default: {@link defaultTimeSpent})\n * @returns currentTimeSlot.currentHour\n */\n increaseHour(timeSpent: number = this.defaultTimeSpent): number {\n let newHour = this.currentHour + timeSpent\n if (newHour >= this.maxDayHours) {\n this.increaseDay()\n newHour = this.minDayHours + (newHour - this.maxDayHours)\n }\n this.currentHour = newHour\n return this.currentHour\n }\n\n /**\n * This function will increase the current day by the given days.\n * @param newDayHour is the hour of the new day (default: {@link minDayHours})\n * @param days is the number of days to increase (default: 1)\n * @returns timeTracker.currentDay\n */\n increaseDay(newDayHour: number = this.minDayHours, days: number = 1): number {\n let newDay = this.currentDay + days\n this.currentDay = newDay\n this.currentHour = newDayHour\n return this.currentDay\n }\n\n /**\n * This function will check if the current hour is between the given hours.\n * @param fromHour the starting hour. If the {@link currentHour} is equal to this hour, the function will return true.\n * @param toHour the ending hour.\n * @returns true if the current hour is between the given hours, otherwise false.\n */\n nowIsBetween(fromHour: number | undefined, toHour: number | undefined): boolean {\n if (fromHour === undefined) {\n fromHour = this.minDayHours\n }\n if (toHour === undefined) {\n toHour = this.maxDayHours\n }\n let currentHour = this.currentHour\n if (fromHour < toHour) {\n return currentHour >= fromHour && currentHour < toHour\n }\n return currentHour >= fromHour || currentHour < toHour\n }\n}\n","import NavigatorManager from \"./NavigatorManager\";\nimport QuestManager from \"./QuestManager\";\nimport RoutineManager from \"./RoutineManager\";\nimport { default as TimeManager } from \"./TimeManager\";\n\nconst timeTracker = new TimeManager();\nconst navigator = new NavigatorManager();\nconst routine = new RoutineManager();\nconst questsNotebook = new QuestManager();\n\nexport { navigator, questsNotebook, routine, timeTracker };\n","import { OnRunProps } from \"@drincs/nqtr/dist/override\";\nimport { StoredClassModel } from \"@drincs/pixi-vn\";\nimport { ActivityBaseInternalInterface } from \"../interface/ActivityInterface\";\nimport { timeTracker } from \"../managers\";\nimport { OnRunEvent } from \"../types/OnRunEvent\";\n\nconst ACTIVITY_CATEGORY = \"__nqtr-activity__\";\nexport default class ActivityStoredClass<OnRunEventType>\n\textends StoredClassModel\n\timplements ActivityBaseInternalInterface\n{\n\tconstructor(\n\t\tid: string,\n\t\tprivate readonly _onRun: OnRunEvent<OnRunEventType>,\n\t\tprops: {\n\t\t\tfromHour?: number;\n\t\t\ttoHour?: number;\n\t\t\tfromDay?: number;\n\t\t\ttoDay?: number;\n\t\t},\n\t\tcategory: string = ACTIVITY_CATEGORY\n\t) {\n\t\tsuper(category, id);\n\t\tthis._fromHour = props.fromHour;\n\t\tthis._toHour = props.toHour;\n\t\tthis._fromDay = props.fromDay;\n\t\tthis._toDay = props.toDay;\n\t}\n\n\tprivate _fromHour?: number;\n\tget fromHour(): number | undefined {\n\t\treturn this._fromHour;\n\t}\n\n\tprivate _toHour?: number;\n\tget toHour(): number | undefined {\n\t\treturn this._toHour;\n\t}\n\n\tprivate _fromDay?: number;\n\tget fromDay(): number | undefined {\n\t\treturn this._fromDay;\n\t}\n\n\tprivate _toDay?: number;\n\tget toDay(): number | undefined {\n\t\treturn this._toDay;\n\t}\n\n\tget run(): (props: OnRunProps) => void {\n\t\treturn (props) => this._onRun(this as any, props);\n\t}\n\n\tget expired(): boolean {\n\t\tif (this.toDay && this.toDay <= timeTracker.currentDay) {\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\tget isActive(): boolean {\n\t\tif (this.fromDay && this.fromDay > timeTracker.currentDay) {\n\t\t\treturn false;\n\t\t}\n\t\tif (this.toDay && this.toDay < timeTracker.currentDay) {\n\t\t\treturn false;\n\t\t}\n\t\tif (!timeTracker.nowIsBetween(this.fromHour, this.toHour)) {\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t}\n}\n","import { getFlag } from \"@drincs/pixi-vn\";\nimport { ActivityInterface, ActivityProps } from '../interface';\nimport { OnRunEvent } from '../types/OnRunEvent';\nimport ActivityStoredClass from './ActivityStoredClass';\n\n/**\n * The activity model. It is used to create an activity.\n * @example\n * ```tsx\n * export const nap = new ActivityModel(\"nap\",\n * (_, event) => {\n * if (event) {\n * event.navigate(\"/game\")\n * callLabelWithGoNavigationCallBack(napLabel, event)\n * }\n * else {\n * console.error(\"Event is undefined\")\n * }\n * },\n * {\n * name: \"Nap\",\n * fromHour: 5,\n * toHour: 23,\n * icon: \"https://icon.jpg\",\n * }\n * )\n * ```\n */\nexport default class ActivityBaseModel extends ActivityStoredClass<ActivityInterface> {\n /**\n * @param id The activity id, that must be unique.\n * @param onRun The function that is called when the activity is runned. Have 2 parameters: the runned activity and the yourParams object, that is an object with the parameters that you want to pass to the onRun function.\n * @param props The activity properties.\n */\n constructor(id: string, onRun: OnRunEvent<ActivityInterface>, props: ActivityProps) {\n super(id, onRun, {\n fromHour: props.fromHour,\n toHour: props.toHour,\n fromDay: props.fromDay,\n toDay: props.toDay,\n })\n this.defaultName = props.name || \"\"\n this.defaultDisabled = props.disabled || false\n this.defaultHidden = props.hidden || false\n this._icon = props.renderIcon\n }\n\n private defaultName: string\n /**\n * The name of the activity.\n */\n get name(): string {\n return this.getStorageProperty<string>(\"name\") || this.defaultName\n }\n set name(value: string | undefined) {\n this.setStorageProperty(\"name\", value)\n }\n\n private defaultDisabled: boolean | string\n /**\n * Whether is disabled. If it is a string, it is a Pixi'VN flag name.\n */\n get disabled(): boolean {\n let value = this.getStorageProperty<boolean>(\"disabled\") || this.defaultDisabled\n if (typeof value === \"string\") {\n return getFlag(value)\n }\n return value\n }\n set disabled(value: boolean | string) {\n this.setStorageProperty(\"disabled\", value)\n }\n\n private defaultHidden: boolean | string\n /**\n * Whether is hidden. If it is a string, it is a Pixi'VN flag name.\n */\n get hidden(): boolean {\n let value = this.getStorageProperty<boolean>(\"hidden\") || this.defaultHidden\n if (typeof value === \"string\") {\n return getFlag(value)\n }\n return value\n }\n set hidden(value: boolean | string) {\n this.setStorageProperty(\"hidden\", value)\n }\n\n private _icon?: string\n /**\n * The icon of the activity.\n */\n get icon(): string | undefined {\n return this._icon\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../../src/constants.ts","../../src/managers/TimeManagerSettings.ts","../../src/managers/TimeManager.ts","../../src/managers/index.ts","../../src/classes/ActivityStoredClass.ts","../../src/classes/ActivityBaseModel.ts"],"names":["TIME_DATA_KEY","TimeManagerSettings","TimeManager","settings","minDayHours","maxDayHours","defaultTimeSpent","timeSlots","weekLength","weekendStartDay","weekDaysNames","data","storage","value","weekDayNumber","index","slot","timeSpent","newHour","newDayHour","days","newDay","fromHour","toHour","currentHour","timeTracker","ACTIVITY_CATEGORY","ActivityStoredClass","StoredClassModel","id","_onRun","props","category","ActivityBaseModel","onRun","getFlag"],"mappings":"mDACO,IAAMA,EAAgB,8BCC7B,CAAA,IAAqBC,EAArB,KAAiE,CAC7D,OAAO,WAAA,CAAsB,EAC7B,OAAO,WAAA,CAAsB,GAC7B,OAAO,gBAAA,CAA2B,EAClC,OAAO,SAAA,CAA0B,EAAC,CAClC,OAAO,UAAqB,CAAA,CAAA,CAC5B,OAAO,eAA0B,CAAA,IAAA,CAAK,WAAa,CACnD,CAAA,OAAO,aAA0B,CAAA,EACrC,CCJA,CAAA,IAAqBC,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AA,CAEjBA,CACX,CACA,IAAI,OAAOA,CAAyB,CAAA,CAChC,KAAK,kBAAmB,CAAA,QAAA,CAAUA,CAAK,EAC3C,CAEQ,MAIR,IAAI,IAAA,EAA2B,CAC3B,OAAO,IAAA,CAAK,KAChB,CACJ","file":"ActivityBaseModel.js","sourcesContent":["export const TIME_SETTINGS_KEY = '___nqtr-time_manager_settings___';\nexport const TIME_DATA_KEY = '___nqtr-time_manager_data___';\n\n","import { ITimeStlot, TimeSettings } from \"../types/TimeSettings\";\n\nexport default class TimeManagerSettings implements TimeSettings {\n static minDayHours: number = 0\n static maxDayHours: number = 24\n static defaultTimeSpent: number = 1\n static timeSlots: ITimeStlot[] = []\n static weekLength: number = 7\n static weekendStartDay: number = this.weekLength - 1\n static weekDaysNames: string[] = []\n}\n","import { storage } from \"@drincs/pixi-vn\";\nimport { TIME_DATA_KEY } from \"../constants\";\nimport TimeDataType from \"../types/TimeDataType\";\nimport { ITimeStlot, TimeSettings } from \"../types/TimeSettings\";\nimport TimeManagerSettings from \"./TimeManagerSettings\";\n\nexport default class TimeManager {\n initialize(settings: TimeSettings) {\n const {\n minDayHours = 0,\n maxDayHours = 24,\n defaultTimeSpent = 1,\n timeSlots = [],\n weekLength = 7,\n weekendStartDay = weekLength - 1,\n weekDaysNames = [],\n } = settings\n TimeManagerSettings.minDayHours = minDayHours\n TimeManagerSettings.maxDayHours = maxDayHours\n TimeManagerSettings.defaultTimeSpent = defaultTimeSpent\n TimeManagerSettings.timeSlots = timeSlots\n TimeManagerSettings.weekLength = weekLength\n if (weekendStartDay >= TimeManagerSettings.weekLength) {\n console.warn(`[NQTR] Weekend start day should be less than week length ${weekLength}, so will be ignored`)\n }\n else {\n TimeManagerSettings.weekendStartDay = weekendStartDay\n }\n if (weekDaysNames.length !== weekLength) {\n console.warn(`[NQTR] Week days names should be equal to week length ${weekLength}, so will be ignored`)\n }\n else {\n TimeManagerSettings.weekDaysNames = weekDaysNames\n }\n }\n get minDayHours(): number {\n return TimeManagerSettings.minDayHours\n }\n get maxDayHours(): number {\n return TimeManagerSettings.maxDayHours\n }\n get defaultTimeSpent(): number {\n return TimeManagerSettings.defaultTimeSpent\n }\n get timeSlots(): ITimeStlot[] {\n return TimeManagerSettings.timeSlots\n }\n get weekLength(): number {\n return TimeManagerSettings.weekLength\n }\n get weekendStartDay(): number {\n return TimeManagerSettings.weekendStartDay\n }\n get weekDaysNames(): string[] {\n return TimeManagerSettings.weekDaysNames\n }\n\n /**\n * Get the current hour\n */\n get currentHour(): number {\n let data = storage.getVariable<TimeDataType>(TIME_DATA_KEY) || {}\n if (data.hasOwnProperty('currentHour') && typeof data.currentHour === 'number') {\n return data.currentHour\n }\n return this.minDayHours\n }\n set currentHour(value: number | undefined) {\n let data = storage.getVariable<TimeDataType>(TIME_DATA_KEY) || {}\n if (typeof value === 'number') {\n data.currentHour = value\n } else {\n delete data.currentHour\n }\n storage.setVariable(TIME_DATA_KEY, data)\n }\n /**\n * Get the current day\n */\n get currentDay(): number {\n let data = storage.getVariable<TimeDataType>(TIME_DATA_KEY) || {}\n if (data.hasOwnProperty('currentDay') && typeof data.currentDay === 'number') {\n return data.currentDay\n }\n return 0\n }\n set currentDay(value: number | undefined) {\n let data = storage.getVariable<TimeDataType>(TIME_DATA_KEY) || {}\n if (typeof value === 'number') {\n data.currentDay = value\n }\n else {\n delete data.currentDay\n }\n storage.setVariable(TIME_DATA_KEY, data)\n }\n /**\n * If the current day is greater than or equal to the weekend start day, then it will return true.\n */\n get isWeekend(): boolean {\n return this.currentWeekDayNumber >= this.weekendStartDay\n }\n /**\n * Get the current week day number (1 - {@link weekLength}).\n * For example, if the week length is 7 and the current day is 10, then the result will be 4.\n */\n get currentWeekDayNumber(): number {\n let result = this.currentDay % this.weekLength\n return result + 1\n }\n /**\n * Get the current week day name. If the week days names are not defined, then it will return undefined.\n * For example, if the week days names are ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'] and the current day is 10, then the result will be 'Thursday'.\n * @default \"\"\n */\n get currentDayName(): string {\n let weekDayNumber = this.currentWeekDayNumber - 1\n if (weekDayNumber >= this.weekDaysNames.length) {\n console.warn(`[NQTR] Week day name is not defined for day ${weekDayNumber}`, this.weekDaysNames)\n return \"\"\n }\n return this.weekDaysNames[weekDayNumber]\n }\n /**\n * Get the current {@link timeSlots} index.\n * You can use this property to create \"Image that changes based on the time period\":\n * @example\n * ```tsx\n * import { weekLength } from '@drincs/nqtr';\n * \n * function changeBackground() {\n * return (\n * <img src={`background-currentTimeSlot.currentTimeSlot.png`} />\n * )\n * }\n */\n get currentTimeSlot(): number {\n if (this.timeSlots.length === 0) {\n console.warn('[NQTR] Time slots are not defined')\n return 0\n }\n for (let index = 0; index < this.timeSlots.length; index++) {\n let slot = this.timeSlots[index]\n if (this.timeSlots.length > index + 1) {\n if (this.nowIsBetween(slot.startHour, this.timeSlots[index + 1].startHour)) {\n return index\n }\n }\n }\n return this.timeSlots.length - 1\n }\n\n /**\n * This function will increase the current hour by the given time spent.\n * If the new hour is greater than or equal to the max day hours, then it will increase the day and set the new hour.\n * @param timeSpent is the time spent in hours (default: {@link defaultTimeSpent})\n * @returns currentTimeSlot.currentHour\n */\n increaseHour(timeSpent: number = this.defaultTimeSpent): number {\n let newHour = this.currentHour + timeSpent\n if (newHour >= this.maxDayHours) {\n this.increaseDay()\n newHour = this.minDayHours + (newHour - this.maxDayHours)\n }\n this.currentHour = newHour\n return this.currentHour\n }\n\n /**\n * This function will increase the current day by the given days.\n * @param newDayHour is the hour of the new day (default: {@link minDayHours})\n * @param days is the number of days to increase (default: 1)\n * @returns timeTracker.currentDay\n */\n increaseDay(newDayHour: number = this.minDayHours, days: number = 1): number {\n let newDay = this.currentDay + days\n this.currentDay = newDay\n this.currentHour = newDayHour\n return this.currentDay\n }\n\n /**\n * This function will check if the current hour is between the given hours.\n * @param fromHour the starting hour. If the {@link currentHour} is equal to this hour, the function will return true.\n * @param toHour the ending hour.\n * @returns true if the current hour is between the given hours, otherwise false.\n */\n nowIsBetween(fromHour: number | undefined, toHour: number | undefined): boolean {\n if (fromHour === undefined) {\n fromHour = this.minDayHours\n }\n if (toHour === undefined) {\n toHour = this.maxDayHours\n }\n let currentHour = this.currentHour\n if (fromHour < toHour) {\n return currentHour >= fromHour && currentHour < toHour\n }\n return currentHour >= fromHour || currentHour < toHour\n }\n}\n","import NavigatorManager from \"./NavigatorManager\";\nimport QuestManager from \"./QuestManager\";\nimport RoutineManager from \"./RoutineManager\";\nimport { default as TimeManager } from \"./TimeManager\";\n\nconst timeTracker = new TimeManager();\nconst navigator = new NavigatorManager();\nconst routine = new RoutineManager();\nconst questsNotebook = new QuestManager();\n\nexport { navigator, questsNotebook, routine, timeTracker };\n","import { StoredClassModel } from \"@drincs/pixi-vn\";\nimport { ActivityInterface } from \"../interface\";\nimport { ActivityBaseInternalInterface } from \"../interface/ActivityInterface\";\nimport { timeTracker } from \"../managers\";\nimport { OnRunEvent, OnRunProps } from \"../types/OnRunEvent\";\n\nconst ACTIVITY_CATEGORY = \"__nqtr-activity__\";\nexport default class ActivityStoredClass<OnRunEventType = ActivityInterface>\n extends StoredClassModel\n implements ActivityBaseInternalInterface\n{\n constructor(\n id: string,\n private readonly _onRun: OnRunEvent<OnRunEventType>,\n props: {\n fromHour?: number;\n toHour?: number;\n fromDay?: number;\n toDay?: number;\n },\n category: string = ACTIVITY_CATEGORY\n ) {\n super(category, id);\n this._fromHour = props.fromHour;\n this._toHour = props.toHour;\n this._fromDay = props.fromDay;\n this._toDay = props.toDay;\n }\n\n private _fromHour?: number;\n get fromHour(): number | undefined {\n return this._fromHour;\n }\n\n private _toHour?: number;\n get toHour(): number | undefined {\n return this._toHour;\n }\n\n private _fromDay?: number;\n get fromDay(): number | undefined {\n return this._fromDay;\n }\n\n private _toDay?: number;\n get toDay(): number | undefined {\n return this._toDay;\n }\n\n get run(): (props: OnRunProps) => void {\n return (props) => this._onRun(this as any, props);\n }\n\n get expired(): boolean {\n if (this.toDay && this.toDay <= timeTracker.currentDay) {\n return true;\n }\n return false;\n }\n\n get isActive(): boolean {\n if (this.fromDay && this.fromDay > timeTracker.currentDay) {\n return false;\n }\n if (this.toDay && this.toDay < timeTracker.currentDay) {\n return false;\n }\n if (!timeTracker.nowIsBetween(this.fromHour, this.toHour)) {\n return false;\n }\n return true;\n }\n}\n","import { getFlag } from \"@drincs/pixi-vn\";\nimport { ActivityInterface, ActivityProps } from '../interface';\nimport { OnRunEvent } from '../types/OnRunEvent';\nimport ActivityStoredClass from './ActivityStoredClass';\n\n/**\n * The activity model. It is used to create an activity.\n * @example\n * ```tsx\n * export const nap = new ActivityModel(\"nap\",\n * (_, event) => {\n * if (event) {\n * event.navigate(\"/game\")\n * callLabelWithGoNavigationCallBack(napLabel, event)\n * }\n * else {\n * console.error(\"Event is undefined\")\n * }\n * },\n * {\n * name: \"Nap\",\n * fromHour: 5,\n * toHour: 23,\n * icon: \"https://icon.jpg\",\n * }\n * )\n * ```\n */\nexport default class ActivityBaseModel extends ActivityStoredClass<ActivityInterface> {\n /**\n * @param id The activity id, that must be unique.\n * @param onRun The function that is called when the activity is runned. Have 2 parameters: the runned activity and the yourParams object, that is an object with the parameters that you want to pass to the onRun function.\n * @param props The activity properties.\n */\n constructor(id: string, onRun: OnRunEvent<ActivityInterface>, props: ActivityProps) {\n super(id, onRun, {\n fromHour: props.fromHour,\n toHour: props.toHour,\n fromDay: props.fromDay,\n toDay: props.toDay,\n })\n this.defaultName = props.name || \"\"\n this.defaultDisabled = props.disabled || false\n this.defaultHidden = props.hidden || false\n this._icon = props.renderIcon\n }\n\n private defaultName: string\n /**\n * The name of the activity.\n */\n get name(): string {\n return this.getStorageProperty<string>(\"name\") || this.defaultName\n }\n set name(value: string | undefined) {\n this.setStorageProperty(\"name\", value)\n }\n\n private defaultDisabled: boolean | string\n /**\n * Whether is disabled. If it is a string, it is a Pixi'VN flag name.\n */\n get disabled(): boolean {\n let value = this.getStorageProperty<boolean>(\"disabled\") || this.defaultDisabled\n if (typeof value === \"string\") {\n return getFlag(value)\n }\n return value\n }\n set disabled(value: boolean | string) {\n this.setStorageProperty(\"disabled\", value)\n }\n\n private defaultHidden: boolean | string\n /**\n * Whether is hidden. If it is a string, it is a Pixi'VN flag name.\n */\n get hidden(): boolean {\n let value = this.getStorageProperty<boolean>(\"hidden\") || this.defaultHidden\n if (typeof value === \"string\") {\n return getFlag(value)\n }\n return value\n }\n set hidden(value: boolean | string) {\n this.setStorageProperty(\"hidden\", value)\n }\n\n private _icon?: string\n /**\n * The icon of the activity.\n */\n get icon(): string | undefined {\n return this._icon\n }\n}\n"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {getFlag,StoredClassModel,storage}from'@drincs/pixi-vn';var a="___nqtr-time_manager_data___";var n=class{static minDayHours=0;static maxDayHours=24;static defaultTimeSpent=1;static timeSlots=[];static weekLength=7;static weekendStartDay=this.weekLength-1;static weekDaysNames=[]};var d=class{initialize(e){let{minDayHours:t=0,maxDayHours:r=24,defaultTimeSpent:o=1,timeSlots:T=[],weekLength:m=7,weekendStartDay:v=m-1,weekDaysNames:
|
|
1
|
+
import {getFlag,StoredClassModel,storage}from'@drincs/pixi-vn';var a="___nqtr-time_manager_data___";var n=class{static minDayHours=0;static maxDayHours=24;static defaultTimeSpent=1;static timeSlots=[];static weekLength=7;static weekendStartDay=this.weekLength-1;static weekDaysNames=[]};var d=class{initialize(e){let{minDayHours:t=0,maxDayHours:r=24,defaultTimeSpent:o=1,timeSlots:T=[],weekLength:m=7,weekendStartDay:v=m-1,weekDaysNames:H=[]}=e;n.minDayHours=t,n.maxDayHours=r,n.defaultTimeSpent=o,n.timeSlots=T,n.weekLength=m,v>=n.weekLength?console.warn(`[NQTR] Weekend start day should be less than week length ${m}, so will be ignored`):n.weekendStartDay=v,H.length!==m?console.warn(`[NQTR] Week days names should be equal to week length ${m}, so will be ignored`):n.weekDaysNames=H;}get minDayHours(){return n.minDayHours}get maxDayHours(){return n.maxDayHours}get defaultTimeSpent(){return n.defaultTimeSpent}get timeSlots(){return n.timeSlots}get weekLength(){return n.weekLength}get weekendStartDay(){return n.weekendStartDay}get weekDaysNames(){return n.weekDaysNames}get currentHour(){let e=storage.getVariable(a)||{};return e.hasOwnProperty("currentHour")&&typeof e.currentHour=="number"?e.currentHour:this.minDayHours}set currentHour(e){let t=storage.getVariable(a)||{};typeof e=="number"?t.currentHour=e:delete t.currentHour,storage.setVariable(a,t);}get currentDay(){let e=storage.getVariable(a)||{};return e.hasOwnProperty("currentDay")&&typeof e.currentDay=="number"?e.currentDay:0}set currentDay(e){let t=storage.getVariable(a)||{};typeof e=="number"?t.currentDay=e:delete t.currentDay,storage.setVariable(a,t);}get isWeekend(){return this.currentWeekDayNumber>=this.weekendStartDay}get currentWeekDayNumber(){return this.currentDay%this.weekLength+1}get currentDayName(){let e=this.currentWeekDayNumber-1;return e>=this.weekDaysNames.length?(console.warn(`[NQTR] Week day name is not defined for day ${e}`,this.weekDaysNames),""):this.weekDaysNames[e]}get currentTimeSlot(){if(this.timeSlots.length===0)return console.warn("[NQTR] Time slots are not defined"),0;for(let e=0;e<this.timeSlots.length;e++){let t=this.timeSlots[e];if(this.timeSlots.length>e+1&&this.nowIsBetween(t.startHour,this.timeSlots[e+1].startHour))return e}return this.timeSlots.length-1}increaseHour(e=this.defaultTimeSpent){let t=this.currentHour+e;return t>=this.maxDayHours&&(this.increaseDay(),t=this.minDayHours+(t-this.maxDayHours)),this.currentHour=t,this.currentHour}increaseDay(e=this.minDayHours,t=1){let r=this.currentDay+t;return this.currentDay=r,this.currentHour=e,this.currentDay}nowIsBetween(e,t){e===undefined&&(e=this.minDayHours),t===undefined&&(t=this.maxDayHours);let r=this.currentHour;return e<t?r>=e&&r<t:r>=e||r<t}};var g=new d;var k="__nqtr-activity__",y=class extends StoredClassModel{constructor(t,r,o,T=k){super(T,t);this._onRun=r;this._fromHour=o.fromHour,this._toHour=o.toHour,this._fromDay=o.fromDay,this._toDay=o.toDay;}_fromHour;get fromHour(){return this._fromHour}_toHour;get toHour(){return this._toHour}_fromDay;get fromDay(){return this._fromDay}_toDay;get toDay(){return this._toDay}get run(){return t=>this._onRun(this,t)}get expired(){return !!(this.toDay&&this.toDay<=g.currentDay)}get isActive(){return !(this.fromDay&&this.fromDay>g.currentDay||this.toDay&&this.toDay<g.currentDay||!g.nowIsBetween(this.fromHour,this.toHour))}};var w=class extends y{constructor(e,t,r){super(e,t,{fromHour:r.fromHour,toHour:r.toHour,fromDay:r.fromDay,toDay:r.toDay}),this.defaultName=r.name||"",this.defaultDisabled=r.disabled||false,this.defaultHidden=r.hidden||false,this._icon=r.renderIcon;}defaultName;get name(){return this.getStorageProperty("name")||this.defaultName}set name(e){this.setStorageProperty("name",e);}defaultDisabled;get disabled(){let e=this.getStorageProperty("disabled")||this.defaultDisabled;return typeof e=="string"?getFlag(e):e}set disabled(e){this.setStorageProperty("disabled",e);}defaultHidden;get hidden(){let e=this.getStorageProperty("hidden")||this.defaultHidden;return typeof e=="string"?getFlag(e):e}set hidden(e){this.setStorageProperty("hidden",e);}_icon;get icon(){return this._icon}};export{w as default};//# sourceMappingURL=ActivityBaseModel.mjs.map
|
|
2
2
|
//# sourceMappingURL=ActivityBaseModel.mjs.map
|