@drincs/nqtr 0.1.20 → 0.2.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/dist/{ActivityProps-_79x9-BX.d.ts → ActivityProps-BkHX8xkA.d.ts} +1 -1
- package/dist/{ActivityProps-BoJeWa2B.d.mts → ActivityProps-D45DQdcT.d.mts} +1 -1
- package/dist/{Commitment-Cc2kZEy0.d.ts → Commitment-BJTIpBQ5.d.ts} +4 -2
- package/dist/{Commitment-C3Nc2RJH.d.mts → Commitment-CtNWnNQX.d.mts} +4 -2
- package/dist/{Quest-BQ1pwvQ_.d.ts → StageProps-DCZkZHwZ.d.ts} +81 -81
- package/dist/{Quest-DaNlPBHb.d.mts → StageProps-xLLR0rjD.d.mts} +81 -81
- package/dist/classes/Activity.d.mts +2 -2
- package/dist/classes/Activity.d.ts +2 -2
- package/dist/classes/Activity.js +1 -1
- package/dist/classes/Activity.js.map +1 -1
- package/dist/classes/Activity.mjs +1 -1
- package/dist/classes/Activity.mjs.map +1 -1
- package/dist/classes/ActivityStoredAbstract.d.mts +1 -1
- package/dist/classes/ActivityStoredAbstract.d.ts +1 -1
- package/dist/classes/ActivityStoredAbstract.js +1 -1
- package/dist/classes/ActivityStoredAbstract.js.map +1 -1
- package/dist/classes/ActivityStoredAbstract.mjs +1 -1
- package/dist/classes/ActivityStoredAbstract.mjs.map +1 -1
- package/dist/classes/Commitment.d.mts +2 -2
- package/dist/classes/Commitment.d.ts +2 -2
- package/dist/classes/Commitment.js +2 -2
- package/dist/classes/Commitment.js.map +1 -1
- package/dist/classes/Commitment.mjs +2 -2
- package/dist/classes/Commitment.mjs.map +1 -1
- package/dist/classes/index.d.mts +3 -3
- package/dist/classes/index.d.ts +3 -3
- package/dist/classes/index.js +96 -318
- package/dist/classes/index.js.map +1 -1
- package/dist/classes/index.mjs +97 -318
- package/dist/classes/index.mjs.map +1 -1
- package/dist/classes/navigation/ActivityRoom.d.mts +2 -2
- package/dist/classes/navigation/ActivityRoom.d.ts +2 -2
- package/dist/classes/navigation/ActivityRoom.js +1 -1
- package/dist/classes/navigation/ActivityRoom.js.map +1 -1
- package/dist/classes/navigation/ActivityRoom.mjs +1 -1
- package/dist/classes/navigation/ActivityRoom.mjs.map +1 -1
- package/dist/classes/navigation/Location.d.mts +2 -2
- package/dist/classes/navigation/Location.d.ts +2 -2
- package/dist/classes/navigation/Map.d.mts +2 -2
- package/dist/classes/navigation/Map.d.ts +2 -2
- package/dist/classes/navigation/Room.d.mts +2 -2
- package/dist/classes/navigation/Room.d.ts +2 -2
- package/dist/classes/navigation/Room.js +34 -36
- package/dist/classes/navigation/Room.js.map +1 -1
- package/dist/classes/navigation/Room.mjs +34 -36
- package/dist/classes/navigation/Room.mjs.map +1 -1
- package/dist/classes/quest/Quest.d.mts +1 -1
- package/dist/classes/quest/Quest.d.ts +1 -1
- package/dist/classes/quest/Quest.js +5 -5
- package/dist/classes/quest/Quest.js.map +1 -1
- package/dist/classes/quest/Quest.mjs +5 -5
- package/dist/classes/quest/Quest.mjs.map +1 -1
- package/dist/classes/quest/Stage.d.mts +1 -1
- package/dist/classes/quest/Stage.d.ts +1 -1
- package/dist/classes/quest/Stage.js.map +1 -1
- package/dist/classes/quest/Stage.mjs.map +1 -1
- package/dist/decorators/ActivityDecorator.d.mts +1 -1
- package/dist/decorators/ActivityDecorator.d.ts +1 -1
- package/dist/decorators/CommitmentDecorator.d.mts +9 -3
- package/dist/decorators/CommitmentDecorator.d.ts +9 -3
- package/dist/decorators/CommitmentDecorator.js +15 -0
- package/dist/decorators/CommitmentDecorator.js.map +1 -1
- package/dist/decorators/CommitmentDecorator.mjs +15 -1
- package/dist/decorators/CommitmentDecorator.mjs.map +1 -1
- package/dist/decorators/QuestDecorator.d.mts +8 -10
- package/dist/decorators/QuestDecorator.d.ts +8 -10
- package/dist/decorators/QuestDecorator.js +568 -9
- package/dist/decorators/QuestDecorator.js.map +1 -1
- package/dist/decorators/QuestDecorator.mjs +568 -9
- package/dist/decorators/QuestDecorator.mjs.map +1 -1
- package/dist/decorators/RoomDecorator.d.mts +2 -2
- package/dist/decorators/RoomDecorator.d.ts +2 -2
- package/dist/decorators/index.d.mts +5 -5
- package/dist/decorators/index.d.ts +5 -5
- package/dist/decorators/index.js +579 -9
- package/dist/decorators/index.js.map +1 -1
- package/dist/decorators/index.mjs +579 -10
- package/dist/decorators/index.mjs.map +1 -1
- package/dist/functions/ActivityFunctions.d.mts +2 -2
- package/dist/functions/ActivityFunctions.d.ts +2 -2
- package/dist/functions/ActivityFunctions.js.map +1 -1
- package/dist/functions/ActivityFunctions.mjs.map +1 -1
- package/dist/functions/NavigationFunctions.d.mts +2 -2
- package/dist/functions/NavigationFunctions.d.ts +2 -2
- package/dist/functions/NavigationFunctions.js.map +1 -1
- package/dist/functions/NavigationFunctions.mjs.map +1 -1
- package/dist/functions/RoutineFunctions.d.mts +2 -2
- package/dist/functions/RoutineFunctions.d.ts +2 -2
- package/dist/functions/RoutineFunctions.js.map +1 -1
- package/dist/functions/RoutineFunctions.mjs.map +1 -1
- package/dist/functions/index.d.mts +2 -2
- package/dist/functions/index.d.ts +2 -2
- package/dist/functions/index.js.map +1 -1
- package/dist/functions/index.mjs.map +1 -1
- package/dist/index.d.mts +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.js +422 -408
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +421 -407
- package/dist/index.mjs.map +1 -1
- package/dist/interface/ActivityProps.d.mts +1 -1
- package/dist/interface/ActivityProps.d.ts +1 -1
- package/dist/interface/CommitmentProps.d.mts +2 -2
- package/dist/interface/CommitmentProps.d.ts +2 -2
- package/dist/interface/RoomActivityMemory.d.mts +1 -1
- package/dist/interface/RoomActivityMemory.d.ts +1 -1
- package/dist/interface/RoomProps.d.mts +2 -2
- package/dist/interface/RoomProps.d.ts +2 -2
- package/dist/interface/index.d.mts +3 -3
- package/dist/interface/index.d.ts +3 -3
- package/dist/interface/navigation/LocationProps.d.mts +2 -2
- package/dist/interface/navigation/LocationProps.d.ts +2 -2
- package/dist/interface/navigation/MapProps.d.mts +2 -2
- package/dist/interface/navigation/MapProps.d.ts +2 -2
- package/dist/interface/quest/QuestProps.d.mts +1 -1
- package/dist/interface/quest/QuestProps.d.ts +1 -1
- package/dist/interface/quest/StageProps.d.mts +1 -1
- package/dist/interface/quest/StageProps.d.ts +1 -1
- package/dist/types/QuestsRequired.d.mts +1 -1
- package/dist/types/QuestsRequired.d.ts +1 -1
- package/dist/types/index.d.mts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/package.json +2 -2
|
@@ -61,7 +61,7 @@ declare abstract class ActivityStoredAbstract {
|
|
|
61
61
|
/**
|
|
62
62
|
* The function that is called when the activity is runned.
|
|
63
63
|
*/
|
|
64
|
-
get
|
|
64
|
+
get run(): (props: OnRunProps) => void;
|
|
65
65
|
/**
|
|
66
66
|
* Whether the activity is a deadline.
|
|
67
67
|
* @returns Whether the activity is a deadline.
|
|
@@ -61,7 +61,7 @@ declare abstract class ActivityStoredAbstract {
|
|
|
61
61
|
/**
|
|
62
62
|
* The function that is called when the activity is runned.
|
|
63
63
|
*/
|
|
64
|
-
get
|
|
64
|
+
get run(): (props: OnRunProps) => void;
|
|
65
65
|
/**
|
|
66
66
|
* Whether the activity is a deadline.
|
|
67
67
|
* @returns Whether the activity is a deadline.
|
|
@@ -2,7 +2,7 @@ import { GraphicItemType, OnRenderGraphicItemProps, OnRunProps } from '@drincs/n
|
|
|
2
2
|
import { CharacterBaseModel, StoredClassModel } from '@drincs/pixi-vn';
|
|
3
3
|
import ExecutionType from './types/ExecutionType.js';
|
|
4
4
|
import ActivityModel from './classes/Activity.js';
|
|
5
|
-
import { a as ActivityStoredAbstract, A as ActivityProps } from './ActivityProps-
|
|
5
|
+
import { a as ActivityStoredAbstract, A as ActivityProps } from './ActivityProps-BkHX8xkA.js';
|
|
6
6
|
import { OnRunActivityEvent } from './types/OnRunActivityEvent.js';
|
|
7
7
|
import { OnRunCommitmentEvent } from './types/OnRunCommitmentEvent.js';
|
|
8
8
|
|
|
@@ -53,6 +53,7 @@ interface CommitmentProps<TCharacter extends CharacterBaseModel = CharacterBaseM
|
|
|
53
53
|
renderImage?: GraphicItemType | ((commitment: CommitmentBaseModel<TCharacter, TRoom>, props: OnRenderGraphicItemProps) => GraphicItemType);
|
|
54
54
|
/**
|
|
55
55
|
* 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.
|
|
56
|
+
* If you set "automatic" remember to remove the commitment when it is no longer needed, because otherwise it repeats itself every time.
|
|
56
57
|
* @default "interaction"
|
|
57
58
|
*/
|
|
58
59
|
executionType?: ExecutionType;
|
|
@@ -549,6 +550,7 @@ declare class CommitmentBaseModel<TCharacter extends CharacterBaseModel = Charac
|
|
|
549
550
|
private _executionType;
|
|
550
551
|
/**
|
|
551
552
|
* 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.
|
|
553
|
+
* If you set "automatic" remember to remove the commitment when it is no longer needed, because otherwise it repeats itself every time.
|
|
552
554
|
*/
|
|
553
555
|
get executionType(): ExecutionType;
|
|
554
556
|
private _renderIcon?;
|
|
@@ -560,7 +562,7 @@ declare class CommitmentBaseModel<TCharacter extends CharacterBaseModel = Charac
|
|
|
560
562
|
/**
|
|
561
563
|
* Is a function that is called when the player interacts with the character.
|
|
562
564
|
*/
|
|
563
|
-
get
|
|
565
|
+
get run(): undefined | ((props: OnRunProps) => void);
|
|
564
566
|
private defaultDisabled;
|
|
565
567
|
/**
|
|
566
568
|
* Whether is disabled. You can also pass a Pixi'VN flag name.
|
|
@@ -2,7 +2,7 @@ import { GraphicItemType, OnRenderGraphicItemProps, OnRunProps } from '@drincs/n
|
|
|
2
2
|
import { CharacterBaseModel, StoredClassModel } from '@drincs/pixi-vn';
|
|
3
3
|
import ExecutionType from './types/ExecutionType.mjs';
|
|
4
4
|
import ActivityModel from './classes/Activity.mjs';
|
|
5
|
-
import { a as ActivityStoredAbstract, A as ActivityProps } from './ActivityProps-
|
|
5
|
+
import { a as ActivityStoredAbstract, A as ActivityProps } from './ActivityProps-D45DQdcT.mjs';
|
|
6
6
|
import { OnRunActivityEvent } from './types/OnRunActivityEvent.mjs';
|
|
7
7
|
import { OnRunCommitmentEvent } from './types/OnRunCommitmentEvent.mjs';
|
|
8
8
|
|
|
@@ -53,6 +53,7 @@ interface CommitmentProps<TCharacter extends CharacterBaseModel = CharacterBaseM
|
|
|
53
53
|
renderImage?: GraphicItemType | ((commitment: CommitmentBaseModel<TCharacter, TRoom>, props: OnRenderGraphicItemProps) => GraphicItemType);
|
|
54
54
|
/**
|
|
55
55
|
* 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.
|
|
56
|
+
* If you set "automatic" remember to remove the commitment when it is no longer needed, because otherwise it repeats itself every time.
|
|
56
57
|
* @default "interaction"
|
|
57
58
|
*/
|
|
58
59
|
executionType?: ExecutionType;
|
|
@@ -549,6 +550,7 @@ declare class CommitmentBaseModel<TCharacter extends CharacterBaseModel = Charac
|
|
|
549
550
|
private _executionType;
|
|
550
551
|
/**
|
|
551
552
|
* 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.
|
|
553
|
+
* If you set "automatic" remember to remove the commitment when it is no longer needed, because otherwise it repeats itself every time.
|
|
552
554
|
*/
|
|
553
555
|
get executionType(): ExecutionType;
|
|
554
556
|
private _renderIcon?;
|
|
@@ -560,7 +562,7 @@ declare class CommitmentBaseModel<TCharacter extends CharacterBaseModel = Charac
|
|
|
560
562
|
/**
|
|
561
563
|
* Is a function that is called when the player interacts with the character.
|
|
562
564
|
*/
|
|
563
|
-
get
|
|
565
|
+
get run(): undefined | ((props: OnRunProps) => void);
|
|
564
566
|
private defaultDisabled;
|
|
565
567
|
/**
|
|
566
568
|
* Whether is disabled. You can also pass a Pixi'VN flag name.
|
|
@@ -1,8 +1,85 @@
|
|
|
1
|
-
import { GraphicItemType,
|
|
1
|
+
import { OnRenderGraphicItemProps, GraphicItemType, OnStartStage, OnEndStage } from '@drincs/nqtr/dist/override';
|
|
2
2
|
import { StoredClassModel } from '@drincs/pixi-vn';
|
|
3
3
|
import Goal, { GoalStage } from './classes/quest/Goal.js';
|
|
4
4
|
import StageFlags from './interface/quest/StageFlags.js';
|
|
5
5
|
|
|
6
|
+
declare class Stage extends StoredClassModel implements StageProps {
|
|
7
|
+
constructor(id: string, props: StageProps);
|
|
8
|
+
private _name;
|
|
9
|
+
get name(): string;
|
|
10
|
+
private _description;
|
|
11
|
+
get description(): string;
|
|
12
|
+
private _adviceDescription;
|
|
13
|
+
get adviceDescription(): string;
|
|
14
|
+
private _renderImage?;
|
|
15
|
+
/**
|
|
16
|
+
* The function for rendering the image of the stage.
|
|
17
|
+
*/
|
|
18
|
+
get renderImage(): ((props: OnRenderGraphicItemProps) => GraphicItemType) | undefined;
|
|
19
|
+
private _defaultGoals;
|
|
20
|
+
get defaultGoals(): Goal[];
|
|
21
|
+
private _flags;
|
|
22
|
+
/**
|
|
23
|
+
* The list of flags that the player must complete to finish the stage.
|
|
24
|
+
*/
|
|
25
|
+
get flags(): StageFlags[];
|
|
26
|
+
private _daysRequiredToStart?;
|
|
27
|
+
get daysRequiredToStart(): number;
|
|
28
|
+
private _flagsRequiredToStart;
|
|
29
|
+
get flagsRequiredToStart(): StageFlags[];
|
|
30
|
+
private _questsRequiredToStart;
|
|
31
|
+
get questsRequiredToStart(): QuestsRequiredType[];
|
|
32
|
+
private _requestDescriptionToStart;
|
|
33
|
+
get requestDescriptionToStart(): string;
|
|
34
|
+
private _onStart?;
|
|
35
|
+
get onStart(): undefined | ((props: OnStartStage) => void);
|
|
36
|
+
private _onEnd?;
|
|
37
|
+
get onEnd(): undefined | ((props: OnEndStage) => void);
|
|
38
|
+
}
|
|
39
|
+
declare class StageQuest extends Stage {
|
|
40
|
+
constructor(id: string, props: StageProps);
|
|
41
|
+
get completed(): boolean;
|
|
42
|
+
set completed(value: boolean);
|
|
43
|
+
/**
|
|
44
|
+
* The list of goals that the player needs to complete to finish the stage.
|
|
45
|
+
*/
|
|
46
|
+
get goals(): GoalStage[];
|
|
47
|
+
private get prevStageEndDay();
|
|
48
|
+
private set prevStageEndDay(value);
|
|
49
|
+
get startDay(): number | undefined;
|
|
50
|
+
get canStart(): boolean;
|
|
51
|
+
get onStart(): undefined | ((props: OnStartStage) => void);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
declare class Quest extends StoredClassModel {
|
|
55
|
+
constructor(id: string, stages: Stage[], props: QuestProps);
|
|
56
|
+
private _stages;
|
|
57
|
+
get stages(): StageQuest[];
|
|
58
|
+
private _name;
|
|
59
|
+
get name(): string;
|
|
60
|
+
private _description;
|
|
61
|
+
get description(): string;
|
|
62
|
+
private _renderIcon?;
|
|
63
|
+
/**
|
|
64
|
+
* The function for rendering the icon of the quest.
|
|
65
|
+
*/
|
|
66
|
+
get renderIcon(): ((props: OnRenderGraphicItemProps) => GraphicItemType) | undefined;
|
|
67
|
+
private _renderImage?;
|
|
68
|
+
/**
|
|
69
|
+
* The function for rendering the image of the quest.
|
|
70
|
+
*/
|
|
71
|
+
get renderImage(): ((props: OnRenderGraphicItemProps) => GraphicItemType) | undefined;
|
|
72
|
+
private _isInDevelopment;
|
|
73
|
+
get isInDevelopment(): boolean;
|
|
74
|
+
get currentStageIndex(): number | undefined;
|
|
75
|
+
private set currentStageIndex(value);
|
|
76
|
+
get currentStage(): StageQuest | undefined;
|
|
77
|
+
get started(): boolean;
|
|
78
|
+
get completed(): boolean;
|
|
79
|
+
start(props: OnStartStage): void;
|
|
80
|
+
tryToGoNextStage(startProps: OnStartStage, endProps: OnEndStage): void;
|
|
81
|
+
}
|
|
82
|
+
|
|
6
83
|
type QuestsRequiredType = {
|
|
7
84
|
quest: Quest;
|
|
8
85
|
stageNumber: number;
|
|
@@ -110,88 +187,11 @@ interface StageProps {
|
|
|
110
187
|
/**
|
|
111
188
|
* The function that will be executed when the stage starts.
|
|
112
189
|
*/
|
|
113
|
-
onStart?: () => void;
|
|
190
|
+
onStart?: (props: OnStartStage) => void;
|
|
114
191
|
/**
|
|
115
192
|
* The function that will be executed when the stage ends.
|
|
116
193
|
*/
|
|
117
|
-
onEnd?: () => void;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
declare class Stage extends StoredClassModel implements StageProps {
|
|
121
|
-
constructor(id: string, props: StageProps);
|
|
122
|
-
private _name;
|
|
123
|
-
get name(): string;
|
|
124
|
-
private _description;
|
|
125
|
-
get description(): string;
|
|
126
|
-
private _adviceDescription;
|
|
127
|
-
get adviceDescription(): string;
|
|
128
|
-
private _renderImage?;
|
|
129
|
-
/**
|
|
130
|
-
* The function for rendering the image of the stage.
|
|
131
|
-
*/
|
|
132
|
-
get renderImage(): ((props: OnRenderGraphicItemProps) => GraphicItemType) | undefined;
|
|
133
|
-
private _defaultGoals;
|
|
134
|
-
get defaultGoals(): Goal[];
|
|
135
|
-
private _flags;
|
|
136
|
-
/**
|
|
137
|
-
* The list of flags that the player must complete to finish the stage.
|
|
138
|
-
*/
|
|
139
|
-
get flags(): StageFlags[];
|
|
140
|
-
private _daysRequiredToStart?;
|
|
141
|
-
get daysRequiredToStart(): number;
|
|
142
|
-
private _flagsRequiredToStart;
|
|
143
|
-
get flagsRequiredToStart(): StageFlags[];
|
|
144
|
-
private _questsRequiredToStart;
|
|
145
|
-
get questsRequiredToStart(): QuestsRequiredType[];
|
|
146
|
-
private _requestDescriptionToStart;
|
|
147
|
-
get requestDescriptionToStart(): string;
|
|
148
|
-
private _onStart?;
|
|
149
|
-
get onStart(): undefined | (() => void);
|
|
150
|
-
private _onEnd?;
|
|
151
|
-
get onEnd(): undefined | (() => void);
|
|
152
|
-
}
|
|
153
|
-
declare class StageQuest extends Stage {
|
|
154
|
-
constructor(id: string, props: StageProps);
|
|
155
|
-
get completed(): boolean;
|
|
156
|
-
set completed(value: boolean);
|
|
157
|
-
/**
|
|
158
|
-
* The list of goals that the player needs to complete to finish the stage.
|
|
159
|
-
*/
|
|
160
|
-
get goals(): GoalStage[];
|
|
161
|
-
private get prevStageEndDay();
|
|
162
|
-
private set prevStageEndDay(value);
|
|
163
|
-
get startDay(): number | undefined;
|
|
164
|
-
get canStart(): boolean;
|
|
165
|
-
get onStart(): undefined | (() => void);
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
declare class Quest extends StoredClassModel {
|
|
169
|
-
constructor(id: string, stages: Stage[], props: QuestProps);
|
|
170
|
-
private _stages;
|
|
171
|
-
get stages(): StageQuest[];
|
|
172
|
-
private _name;
|
|
173
|
-
get name(): string;
|
|
174
|
-
private _description;
|
|
175
|
-
get description(): string;
|
|
176
|
-
private _renderIcon?;
|
|
177
|
-
/**
|
|
178
|
-
* The function for rendering the icon of the quest.
|
|
179
|
-
*/
|
|
180
|
-
get renderIcon(): ((props: OnRenderGraphicItemProps) => GraphicItemType) | undefined;
|
|
181
|
-
private _renderImage?;
|
|
182
|
-
/**
|
|
183
|
-
* The function for rendering the image of the quest.
|
|
184
|
-
*/
|
|
185
|
-
get renderImage(): ((props: OnRenderGraphicItemProps) => GraphicItemType) | undefined;
|
|
186
|
-
private _isInDevelopment;
|
|
187
|
-
get isInDevelopment(): boolean;
|
|
188
|
-
get currentStageIndex(): number | undefined;
|
|
189
|
-
private set currentStageIndex(value);
|
|
190
|
-
get currentStage(): StageQuest | undefined;
|
|
191
|
-
get started(): boolean;
|
|
192
|
-
get completed(): boolean;
|
|
193
|
-
start(): void;
|
|
194
|
-
tryToGoNextStage(): void;
|
|
194
|
+
onEnd?: (props: OnEndStage) => void;
|
|
195
195
|
}
|
|
196
196
|
|
|
197
|
-
export {
|
|
197
|
+
export { type QuestProps as Q, Stage as S, type StageProps as a, type QuestsRequiredType as b, Quest as c, StageQuest as d };
|
|
@@ -1,8 +1,85 @@
|
|
|
1
|
-
import { GraphicItemType,
|
|
1
|
+
import { OnRenderGraphicItemProps, GraphicItemType, OnStartStage, OnEndStage } from '@drincs/nqtr/dist/override';
|
|
2
2
|
import { StoredClassModel } from '@drincs/pixi-vn';
|
|
3
3
|
import Goal, { GoalStage } from './classes/quest/Goal.mjs';
|
|
4
4
|
import StageFlags from './interface/quest/StageFlags.mjs';
|
|
5
5
|
|
|
6
|
+
declare class Stage extends StoredClassModel implements StageProps {
|
|
7
|
+
constructor(id: string, props: StageProps);
|
|
8
|
+
private _name;
|
|
9
|
+
get name(): string;
|
|
10
|
+
private _description;
|
|
11
|
+
get description(): string;
|
|
12
|
+
private _adviceDescription;
|
|
13
|
+
get adviceDescription(): string;
|
|
14
|
+
private _renderImage?;
|
|
15
|
+
/**
|
|
16
|
+
* The function for rendering the image of the stage.
|
|
17
|
+
*/
|
|
18
|
+
get renderImage(): ((props: OnRenderGraphicItemProps) => GraphicItemType) | undefined;
|
|
19
|
+
private _defaultGoals;
|
|
20
|
+
get defaultGoals(): Goal[];
|
|
21
|
+
private _flags;
|
|
22
|
+
/**
|
|
23
|
+
* The list of flags that the player must complete to finish the stage.
|
|
24
|
+
*/
|
|
25
|
+
get flags(): StageFlags[];
|
|
26
|
+
private _daysRequiredToStart?;
|
|
27
|
+
get daysRequiredToStart(): number;
|
|
28
|
+
private _flagsRequiredToStart;
|
|
29
|
+
get flagsRequiredToStart(): StageFlags[];
|
|
30
|
+
private _questsRequiredToStart;
|
|
31
|
+
get questsRequiredToStart(): QuestsRequiredType[];
|
|
32
|
+
private _requestDescriptionToStart;
|
|
33
|
+
get requestDescriptionToStart(): string;
|
|
34
|
+
private _onStart?;
|
|
35
|
+
get onStart(): undefined | ((props: OnStartStage) => void);
|
|
36
|
+
private _onEnd?;
|
|
37
|
+
get onEnd(): undefined | ((props: OnEndStage) => void);
|
|
38
|
+
}
|
|
39
|
+
declare class StageQuest extends Stage {
|
|
40
|
+
constructor(id: string, props: StageProps);
|
|
41
|
+
get completed(): boolean;
|
|
42
|
+
set completed(value: boolean);
|
|
43
|
+
/**
|
|
44
|
+
* The list of goals that the player needs to complete to finish the stage.
|
|
45
|
+
*/
|
|
46
|
+
get goals(): GoalStage[];
|
|
47
|
+
private get prevStageEndDay();
|
|
48
|
+
private set prevStageEndDay(value);
|
|
49
|
+
get startDay(): number | undefined;
|
|
50
|
+
get canStart(): boolean;
|
|
51
|
+
get onStart(): undefined | ((props: OnStartStage) => void);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
declare class Quest extends StoredClassModel {
|
|
55
|
+
constructor(id: string, stages: Stage[], props: QuestProps);
|
|
56
|
+
private _stages;
|
|
57
|
+
get stages(): StageQuest[];
|
|
58
|
+
private _name;
|
|
59
|
+
get name(): string;
|
|
60
|
+
private _description;
|
|
61
|
+
get description(): string;
|
|
62
|
+
private _renderIcon?;
|
|
63
|
+
/**
|
|
64
|
+
* The function for rendering the icon of the quest.
|
|
65
|
+
*/
|
|
66
|
+
get renderIcon(): ((props: OnRenderGraphicItemProps) => GraphicItemType) | undefined;
|
|
67
|
+
private _renderImage?;
|
|
68
|
+
/**
|
|
69
|
+
* The function for rendering the image of the quest.
|
|
70
|
+
*/
|
|
71
|
+
get renderImage(): ((props: OnRenderGraphicItemProps) => GraphicItemType) | undefined;
|
|
72
|
+
private _isInDevelopment;
|
|
73
|
+
get isInDevelopment(): boolean;
|
|
74
|
+
get currentStageIndex(): number | undefined;
|
|
75
|
+
private set currentStageIndex(value);
|
|
76
|
+
get currentStage(): StageQuest | undefined;
|
|
77
|
+
get started(): boolean;
|
|
78
|
+
get completed(): boolean;
|
|
79
|
+
start(props: OnStartStage): void;
|
|
80
|
+
tryToGoNextStage(startProps: OnStartStage, endProps: OnEndStage): void;
|
|
81
|
+
}
|
|
82
|
+
|
|
6
83
|
type QuestsRequiredType = {
|
|
7
84
|
quest: Quest;
|
|
8
85
|
stageNumber: number;
|
|
@@ -110,88 +187,11 @@ interface StageProps {
|
|
|
110
187
|
/**
|
|
111
188
|
* The function that will be executed when the stage starts.
|
|
112
189
|
*/
|
|
113
|
-
onStart?: () => void;
|
|
190
|
+
onStart?: (props: OnStartStage) => void;
|
|
114
191
|
/**
|
|
115
192
|
* The function that will be executed when the stage ends.
|
|
116
193
|
*/
|
|
117
|
-
onEnd?: () => void;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
declare class Stage extends StoredClassModel implements StageProps {
|
|
121
|
-
constructor(id: string, props: StageProps);
|
|
122
|
-
private _name;
|
|
123
|
-
get name(): string;
|
|
124
|
-
private _description;
|
|
125
|
-
get description(): string;
|
|
126
|
-
private _adviceDescription;
|
|
127
|
-
get adviceDescription(): string;
|
|
128
|
-
private _renderImage?;
|
|
129
|
-
/**
|
|
130
|
-
* The function for rendering the image of the stage.
|
|
131
|
-
*/
|
|
132
|
-
get renderImage(): ((props: OnRenderGraphicItemProps) => GraphicItemType) | undefined;
|
|
133
|
-
private _defaultGoals;
|
|
134
|
-
get defaultGoals(): Goal[];
|
|
135
|
-
private _flags;
|
|
136
|
-
/**
|
|
137
|
-
* The list of flags that the player must complete to finish the stage.
|
|
138
|
-
*/
|
|
139
|
-
get flags(): StageFlags[];
|
|
140
|
-
private _daysRequiredToStart?;
|
|
141
|
-
get daysRequiredToStart(): number;
|
|
142
|
-
private _flagsRequiredToStart;
|
|
143
|
-
get flagsRequiredToStart(): StageFlags[];
|
|
144
|
-
private _questsRequiredToStart;
|
|
145
|
-
get questsRequiredToStart(): QuestsRequiredType[];
|
|
146
|
-
private _requestDescriptionToStart;
|
|
147
|
-
get requestDescriptionToStart(): string;
|
|
148
|
-
private _onStart?;
|
|
149
|
-
get onStart(): undefined | (() => void);
|
|
150
|
-
private _onEnd?;
|
|
151
|
-
get onEnd(): undefined | (() => void);
|
|
152
|
-
}
|
|
153
|
-
declare class StageQuest extends Stage {
|
|
154
|
-
constructor(id: string, props: StageProps);
|
|
155
|
-
get completed(): boolean;
|
|
156
|
-
set completed(value: boolean);
|
|
157
|
-
/**
|
|
158
|
-
* The list of goals that the player needs to complete to finish the stage.
|
|
159
|
-
*/
|
|
160
|
-
get goals(): GoalStage[];
|
|
161
|
-
private get prevStageEndDay();
|
|
162
|
-
private set prevStageEndDay(value);
|
|
163
|
-
get startDay(): number | undefined;
|
|
164
|
-
get canStart(): boolean;
|
|
165
|
-
get onStart(): undefined | (() => void);
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
declare class Quest extends StoredClassModel {
|
|
169
|
-
constructor(id: string, stages: Stage[], props: QuestProps);
|
|
170
|
-
private _stages;
|
|
171
|
-
get stages(): StageQuest[];
|
|
172
|
-
private _name;
|
|
173
|
-
get name(): string;
|
|
174
|
-
private _description;
|
|
175
|
-
get description(): string;
|
|
176
|
-
private _renderIcon?;
|
|
177
|
-
/**
|
|
178
|
-
* The function for rendering the icon of the quest.
|
|
179
|
-
*/
|
|
180
|
-
get renderIcon(): ((props: OnRenderGraphicItemProps) => GraphicItemType) | undefined;
|
|
181
|
-
private _renderImage?;
|
|
182
|
-
/**
|
|
183
|
-
* The function for rendering the image of the quest.
|
|
184
|
-
*/
|
|
185
|
-
get renderImage(): ((props: OnRenderGraphicItemProps) => GraphicItemType) | undefined;
|
|
186
|
-
private _isInDevelopment;
|
|
187
|
-
get isInDevelopment(): boolean;
|
|
188
|
-
get currentStageIndex(): number | undefined;
|
|
189
|
-
private set currentStageIndex(value);
|
|
190
|
-
get currentStage(): StageQuest | undefined;
|
|
191
|
-
get started(): boolean;
|
|
192
|
-
get completed(): boolean;
|
|
193
|
-
start(): void;
|
|
194
|
-
tryToGoNextStage(): void;
|
|
194
|
+
onEnd?: (props: OnEndStage) => void;
|
|
195
195
|
}
|
|
196
196
|
|
|
197
|
-
export {
|
|
197
|
+
export { type QuestProps as Q, Stage as S, type StageProps as a, type QuestsRequiredType as b, Quest as c, StageQuest as d };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { OnRenderGraphicItemProps, GraphicItemType, OnRunProps } from '@drincs/nqtr/dist/override';
|
|
2
|
-
import { A as ActivityProps, a as ActivityStoredAbstract } from '../ActivityProps-
|
|
2
|
+
import { A as ActivityProps, a as ActivityStoredAbstract } from '../ActivityProps-D45DQdcT.mjs';
|
|
3
3
|
import { OnRunActivityEvent } from '../types/OnRunActivityEvent.mjs';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -96,7 +96,7 @@ declare class ActivityModel {
|
|
|
96
96
|
/**
|
|
97
97
|
* The function that is called when the activity is runned.
|
|
98
98
|
*/
|
|
99
|
-
get
|
|
99
|
+
get run(): (props: OnRunProps) => void;
|
|
100
100
|
/**
|
|
101
101
|
* Whether the activity is a deadline.
|
|
102
102
|
* @returns Whether the activity is a deadline.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { OnRenderGraphicItemProps, GraphicItemType, OnRunProps } from '@drincs/nqtr/dist/override';
|
|
2
|
-
import { A as ActivityProps, a as ActivityStoredAbstract } from '../ActivityProps-
|
|
2
|
+
import { A as ActivityProps, a as ActivityStoredAbstract } from '../ActivityProps-BkHX8xkA.js';
|
|
3
3
|
import { OnRunActivityEvent } from '../types/OnRunActivityEvent.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -96,7 +96,7 @@ declare class ActivityModel {
|
|
|
96
96
|
/**
|
|
97
97
|
* The function that is called when the activity is runned.
|
|
98
98
|
*/
|
|
99
|
-
get
|
|
99
|
+
get run(): (props: OnRunProps) => void;
|
|
100
100
|
/**
|
|
101
101
|
* Whether the activity is a deadline.
|
|
102
102
|
* @returns Whether the activity is a deadline.
|
package/dist/classes/Activity.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/classes/Activity.ts","../../src/managers/TimeManager.ts"],"names":[],"mappings":";AACA,SAAS,eAAe;;;ACDxB,SAAS,0BAA0B;AAGnC,IAAM,oBAAoB;AAC1B,IAAM,gBAAgB;AAOtB,IAAqB,cAArB,MAAqB,aAAY;AAAA,EACrB,cAAc;AAAA,EAAE;AAAA,EACxB,OAAe,aAAa,UAAwB;AAChD,QAAI,OAAY,CAAC;AACjB,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A;AAAA;AAAA,EAMA,IAAI,aAAiF;AACjF,QAAI,SAAS,KAAK;AAClB,QAAI,WAAW,QAAW;AACtB,aAAO;AAAA,IACX;AACA,QAAI,OAAO,WAAW,YAAY;AAC9B,aAAO,CAAC,UAAoC;AACxC,eAAO,OAAO,MAAM,KAAK;AAAA,MAC7B;AAAA,IACJ;AACA,WAAO,CAAC,UAAoC;AAAA,EAChD;AAAA,EAGA,IAAI,gBAA4D;AAC5D,WAAO,KAAK;AAAA,EAChB;AAAA;AAAA;AAAA;AAAA,EAIA,IAAI,QAAqC;AACrC,WAAO,CAAC,UAAU,KAAK,OAAO,MAAM,KAAK;AAAA,EAC7C;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,aAAsB;AAClB,QAAI,KAAK,SAAS,KAAK,SAAS,YAAY,YAAY;AACpD,aAAO;AAAA,IACX;AACA,WAAO;AAAA,EACX;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,SAAwB;AACpB,WAAO;AAAA,MACH,MAAM,KAAK;AAAA,MACX,UAAU,KAAK;AAAA,MACf,QAAQ,KAAK;AAAA,MACb,SAAS,KAAK;AAAA,MACd,OAAO,KAAK;AAAA,MACZ,UAAU,KAAK;AAAA,MACf,QAAQ,KAAK;AAAA,MACb,YAAY,KAAK;AAAA,IACrB;AAAA,EACJ;AACJ","sourcesContent":["import { GraphicItemType, OnRenderGraphicItemProps, OnRunProps } from '@drincs/nqtr/dist/override';\nimport { getFlag } from \"@drincs/pixi-vn\";\nimport { ActivityProps } from '../interface';\nimport TimeManager from \"../managers/TimeManager\";\nimport { OnRunActivityEvent } from '../types/OnRunActivityEvent';\nimport { ActivityStoredAbstract } from './ActivityStoredAbstract';\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 * renderIcon: (activity, props) => {\n * return <Button\n * disabled={activity.disabled}\n * onClick={() => {\n * if (!props) {\n * console.error(\"Props is undefined\")\n * return\n * }\n * activity.onRun(props)\n * }}\n * ariaLabel={activity.name}\n * >\n * <BedIcon />\n * </Button>\n * },\n * }\n * )\n * ```\n */\nexport default class ActivityModel {\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: OnRunActivityEvent<ActivityModel>, props: ActivityProps) {\n this._id = id\n this._name = props.name\n this._fromHour = props.fromHour\n this._toHour = props.toHour\n this._fromDay = props.fromDay\n this._toDay = props.toDay\n this._disabled = props.disabled || false\n this._hidden = props.hidden || false\n this._renderIcon = props.renderIcon\n this._onRun = onRun\n }\n\n private _id: string\n /**\n * The activity id, that is unique.\n */\n get id(): string {\n return this._id\n }\n\n private _name?: string\n /**\n * The name\n */\n get name(): string | undefined {\n return this._name\n }\n\n private _fromHour?: number\n /**\n * The hour when the activity starts. If the activity is not started yet, it will be hidden.\n */\n get fromHour(): number | undefined {\n return this._fromHour\n }\n\n private _toHour?: number\n /**\n * The hour when the activity ends. If the activity is ended yet, it will be hidden.\n */\n get toHour(): number | undefined {\n return this._toHour\n }\n\n private _fromDay?: number\n /**\n * The day when the activity starts. If the activity is not started yet, it will be hidden.\n */\n get fromDay(): number | undefined {\n return this._fromDay\n }\n\n private _toDay?: number\n /**\n * The day when the activity ends. If the activity is ended yet, it will be deleted or hidden.\n */\n get toDay(): number | undefined {\n return this._toDay\n }\n\n private _disabled?: boolean | string\n /**\n * Whether is disabled.\n */\n get disabled(): boolean | undefined {\n if (typeof this._disabled === \"string\") {\n return getFlag(this._disabled)\n }\n return this._disabled\n }\n\n private _hidden: boolean | string\n /**\n * Whether is hidden. If the activity is not started yet, it will be hidden.\n */\n get hidden(): boolean {\n if (this.fromDay && this.fromDay > TimeManager.currentDay) {\n return true\n }\n if (!this.isDeadline) {\n return true\n }\n if (typeof this._hidden === \"string\") {\n return getFlag(this._hidden)\n }\n return this._hidden\n }\n\n private _renderIcon?: GraphicItemType | ((activity: ActivityModel, props: OnRenderGraphicItemProps) => GraphicItemType)\n /**\n * The function for rendering the icon of the activity.\n */\n get renderIcon(): ((props: OnRenderGraphicItemProps) => GraphicItemType) | undefined {\n let render = this._renderIcon\n if (render === undefined) {\n return undefined\n }\n if (typeof render === \"function\") {\n return (props: OnRenderGraphicItemProps) => {\n return render(this, props)\n }\n }\n return (props: OnRenderGraphicItemProps) => render\n }\n\n private _onRun: OnRunActivityEvent<ActivityModel>\n get _initialOnRun(): OnRunActivityEvent<ActivityStoredAbstract> {\n return this._onRun as any\n }\n /**\n * The function that is called when the activity is runned.\n */\n get onRun(): (props: OnRunProps) => void {\n return (props) => this._onRun(this, props)\n }\n\n /**\n * Whether the activity is a deadline.\n * @returns Whether the activity is a deadline.\n */\n isDeadline(): boolean {\n if (this.toDay && this.toDay <= TimeManager.currentDay) {\n return true\n }\n return false\n }\n\n /**\n * Export the activity properties.\n * @returns The activity properties.\n */\n export(): ActivityProps {\n return {\n name: this._name,\n fromHour: this._fromHour,\n toHour: this._toHour,\n fromDay: this._fromDay,\n toDay: this._toDay,\n disabled: this._disabled,\n hidden: this._hidden,\n renderIcon: this._renderIcon,\n }\n }\n}\n","import { GameStorageManager } from \"@drincs/pixi-vn\";\nimport { ITimeStlot, TimeSettings } from \"../types/TimeSettings\";\n\nconst TIME_SETTINGS_KEY = '___nqtr-time_manager_settings___';\nconst TIME_DATA_KEY = '___nqtr-time_manager_data___';\n\ntype ITimeData = {\n currentHour?: number\n currentDay?: number\n}\n\nexport default class TimeManager {\n private constructor() { }\n private static editSettings(settings: TimeSettings) {\n let data: any = {}\n if (typeof settings.minDayHours === 'number') {\n data['minDayHours'] = settings.minDayHours\n }\n if (typeof settings.maxDayHours === 'number') {\n data['maxDayHours'] = settings.maxDayHours\n }\n if (typeof settings.minDayHours === 'number') {\n data['defaultTimeSpent'] = settings.defaultTimeSpent\n }\n if (Array.isArray(settings.timeSlots)) {\n data['timeSlots'] = settings.timeSlots\n }\n if (typeof settings.weekLength === 'number') {\n data['weekLength'] = settings.weekLength\n }\n if (typeof settings.weekendStartDay === 'number') {\n let weekLength = settings.weekLength || TimeManager.weekLength\n if (settings.weekendStartDay >= weekLength) {\n console.warn(`[NQTR] Weekend start day should be less than week length ${weekLength}`)\n }\n data['weekendStartDay'] = settings.weekendStartDay\n }\n if (Array.isArray(settings.weekDaysNames)) {\n let weekLength = settings.weekLength || TimeManager.weekLength\n if (settings.weekDaysNames.length !== weekLength) {\n console.warn(`[NQTR] Week days names should be equal to week length ${weekLength}`)\n }\n data['weekDaysNames'] = settings.weekDaysNames\n }\n GameStorageManager.setVariable(TIME_SETTINGS_KEY, data)\n }\n /**\n * Get time settings\n * @default {}\n */\n static get settings(): TimeSettings {\n let settings = GameStorageManager.getVariable<TimeSettings>(TIME_SETTINGS_KEY) || {}\n return settings\n }\n /**\n * Set time settings, Is very important to set the settings before using the nqtr library, bacause more of the features are based on the time settings.\n */\n static set settings(value: TimeSettings) {\n TimeManager.editSettings(value)\n }\n static get minDayHours(): number {\n let result = 0\n let settings = GameStorageManager.getVariable<TimeSettings>(TIME_SETTINGS_KEY)\n if (settings && settings.hasOwnProperty('minDayHours')) {\n result = settings.minDayHours || 0\n }\n return result\n }\n static get maxDayHours(): number {\n let result = 24\n let settings = GameStorageManager.getVariable<TimeSettings>(TIME_SETTINGS_KEY)\n if (settings && settings.hasOwnProperty('maxDayHours')) {\n result = settings.maxDayHours || 24\n }\n return result\n }\n static get defaultTimeSpent(): number {\n let result = 1\n let settings = GameStorageManager.getVariable<TimeSettings>(TIME_SETTINGS_KEY)\n if (settings && settings.hasOwnProperty('defaultTimeSpent')) {\n result = settings.defaultTimeSpent || 1\n }\n return result\n }\n static get timeSlots(): ITimeStlot[] {\n let result: ITimeStlot[] = []\n let settings = GameStorageManager.getVariable<TimeSettings>(TIME_SETTINGS_KEY)\n if (settings && settings.hasOwnProperty('timeSlots')) {\n result = settings.timeSlots || []\n }\n return result\n }\n static get weekLength(): number {\n let result = 7\n let settings = GameStorageManager.getVariable<TimeSettings>(TIME_SETTINGS_KEY)\n if (settings && settings.hasOwnProperty('weekLength')) {\n result = settings.weekLength || 7\n }\n return result\n }\n static get weekendStartDay(): number {\n let result = TimeManager.weekLength - 1\n let settings = GameStorageManager.getVariable<TimeSettings>(TIME_SETTINGS_KEY)\n if (settings && settings.hasOwnProperty('weekendStartDay')) {\n result = settings.weekendStartDay || TimeManager.weekLength - 1\n }\n return result\n }\n static get weekDaysNames(): string[] {\n let result: string[] = []\n let settings = GameStorageManager.getVariable<TimeSettings>(TIME_SETTINGS_KEY)\n if (settings && settings.hasOwnProperty('weekDaysNames')) {\n result = settings.weekDaysNames || result\n }\n return result\n }\n\n /**\n * Get the current hour\n */\n static get currentHour(): number {\n let data = GameStorageManager.getVariable<ITimeData>(TIME_DATA_KEY) || {}\n if (data.hasOwnProperty('currentHour') && typeof data.currentHour === 'number') {\n return data.currentHour\n }\n return TimeManager.minDayHours\n }\n static set currentHour(value: number | undefined) {\n let data = GameStorageManager.getVariable<ITimeData>(TIME_DATA_KEY) || {}\n if (typeof value === 'number') {\n data.currentHour = value\n } else {\n delete data.currentHour\n }\n GameStorageManager.setVariable(TIME_DATA_KEY, data)\n }\n /**\n * Get the current day\n */\n static get currentDay(): number {\n let data = GameStorageManager.getVariable<ITimeData>(TIME_DATA_KEY) || {}\n if (data.hasOwnProperty('currentDay') && typeof data.currentDay === 'number') {\n return data.currentDay\n }\n return 0\n }\n static set currentDay(value: number | undefined) {\n let data = GameStorageManager.getVariable<ITimeData>(TIME_DATA_KEY) || {}\n if (typeof value === 'number') {\n data.currentDay = value\n }\n else {\n delete data.currentDay\n }\n GameStorageManager.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 static get isWeekend(): boolean {\n return TimeManager.currentWeekDayNumber >= TimeManager.weekendStartDay\n }\n /**\n * Get the current week day number (1-TimeManager.weekLength).\n * For example, if the week length is 7 and the current day is 10, then the result will be 4.\n */\n static get currentWeekDayNumber(): number {\n let result = TimeManager.currentDay % TimeManager.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 static get currentDayName(): string {\n let weekDayNumber = TimeManager.currentWeekDayNumber - 1\n if (weekDayNumber >= TimeManager.weekDaysNames.length) {\n console.warn(`[NQTR] Week day name is not defined for day ${weekDayNumber}`, TimeManager.weekDaysNames)\n return \"\"\n }\n return TimeManager.weekDaysNames[weekDayNumber]\n }\n /**\n * Get the current TimeManager.timeSlots index.\n * You can use this property to create \"Image that changes based on the time period\":\n * @example\n * ```tsx\n * import { TimeManager } from '@drincs/nqtr';\n * \n * function changeBackground() {\n * return (\n * <img src={`background-${TimeManager.currentTimeSlot}.png`} />\n * )\n * }\n */\n static get currentTimeSlot(): number {\n if (TimeManager.timeSlots.length === 0) {\n console.warn('[NQTR] Time slots are not defined')\n return 0\n }\n for (let index = 0; index < TimeManager.timeSlots.length; index++) {\n let slot = TimeManager.timeSlots[index]\n if (TimeManager.timeSlots.length > index + 1) {\n if (TimeManager.nowIsBetween(slot.startHour, TimeManager.timeSlots[index + 1].startHour)) {\n return index\n }\n }\n }\n return TimeManager.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: TimeManager.defaultTimeSpent)\n * @returns TimeManager.currentHour\n */\n static increaseHour(timeSpent: number = TimeManager.defaultTimeSpent): number {\n let newHour = TimeManager.currentHour + timeSpent\n if (newHour >= TimeManager.maxDayHours) {\n TimeManager.increaseDay()\n newHour = TimeManager.minDayHours + (newHour - TimeManager.maxDayHours)\n }\n TimeManager.currentHour = newHour\n return TimeManager.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: TimeManager.minDayHours)\n * @param days is the number of days to increase (default: 1)\n * @returns TimeManager.currentDay\n */\n static increaseDay(newDayHour: number = TimeManager.minDayHours, days: number = 1): number {\n let newDay = TimeManager.currentDay + days\n TimeManager.currentDay = newDay\n TimeManager.currentHour = newDayHour\n return TimeManager.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 TimeManager.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 static nowIsBetween(fromHour: number, toHour: number): boolean {\n let currentHour = TimeManager.currentHour\n if (fromHour < toHour) {\n return currentHour >= fromHour && currentHour < toHour\n }\n return currentHour >= fromHour || currentHour < toHour\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../../src/classes/Activity.ts","../../src/managers/TimeManager.ts"],"names":[],"mappings":";AACA,SAAS,eAAe;;;ACDxB,SAAS,0BAA0B;AAGnC,IAAM,oBAAoB;AAC1B,IAAM,gBAAgB;AAOtB,IAAqB,cAArB,MAAqB,aAAY;AAAA,EACrB,cAAc;AAAA,EAAE;AAAA,EACxB,OAAe,aAAa,UAAwB;AAChD,QAAI,OAAY,CAAC;AACjB,QAAI,OAAO,SAAS,gBAAgB,UAAU;AAC1C,WAAK,aAAa,IAAI,SAAS;AAAA,IACnC;AACA,QAAI,OAAO,SAAS,gBAAgB,UAAU;AAC1C,WAAK,aAAa,IAAI,SAAS;AAAA,IACnC;AACA,QAAI,OAAO,SAAS,gBAAgB,UAAU;AAC1C,WAAK,kBAAkB,IAAI,SAAS;AAAA,IACxC;AACA,QAAI,MAAM,QAAQ,SAAS,SAAS,GAAG;AACnC,WAAK,WAAW,IAAI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AChB;AAAA;AAAA;AAAA;AAAA,EAIA,IAAI,MAAmC;AACnC,WAAO,CAAC,UAAU,KAAK,OAAO,MAAM,KAAK;AAAA,EAC7C;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,aAAsB;AAClB,QAAI,KAAK,SAAS,KAAK,SAAS,YAAY,YAAY;AACpD,aAAO;AAAA,IACX;AACA,WAAO;AAAA,EACX;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,SAAwB;AACpB,WAAO;AAAA,MACH,MAAM,KAAK;AAAA,MACX,UAAU,KAAK;AAAA,MACf,QAAQ,KAAK;AAAA,MACb,SAAS,KAAK;AAAA,MACd,OAAO,KAAK;AAAA,MACZ,UAAU,KAAK;AAAA,MACf,QAAQ,KAAK;AAAA,MACb,YAAY,KAAK;AAAA,IACrB;AAAA,EACJ;AACJ","sourcesContent":["import { GraphicItemType, OnRenderGraphicItemProps, OnRunProps } from '@drincs/nqtr/dist/override';\nimport { getFlag } from \"@drincs/pixi-vn\";\nimport { ActivityProps } from '../interface';\nimport TimeManager from \"../managers/TimeManager\";\nimport { OnRunActivityEvent } from '../types/OnRunActivityEvent';\nimport { ActivityStoredAbstract } from './ActivityStoredAbstract';\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 * renderIcon: (activity, props) => {\n * return <Button\n * disabled={activity.disabled}\n * onClick={() => {\n * if (!props) {\n * console.error(\"Props is undefined\")\n * return\n * }\n * activity.onRun(props)\n * }}\n * ariaLabel={activity.name}\n * >\n * <BedIcon />\n * </Button>\n * },\n * }\n * )\n * ```\n */\nexport default class ActivityModel {\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: OnRunActivityEvent<ActivityModel>, props: ActivityProps) {\n this._id = id\n this._name = props.name\n this._fromHour = props.fromHour\n this._toHour = props.toHour\n this._fromDay = props.fromDay\n this._toDay = props.toDay\n this._disabled = props.disabled || false\n this._hidden = props.hidden || false\n this._renderIcon = props.renderIcon\n this._onRun = onRun\n }\n\n private _id: string\n /**\n * The activity id, that is unique.\n */\n get id(): string {\n return this._id\n }\n\n private _name?: string\n /**\n * The name\n */\n get name(): string | undefined {\n return this._name\n }\n\n private _fromHour?: number\n /**\n * The hour when the activity starts. If the activity is not started yet, it will be hidden.\n */\n get fromHour(): number | undefined {\n return this._fromHour\n }\n\n private _toHour?: number\n /**\n * The hour when the activity ends. If the activity is ended yet, it will be hidden.\n */\n get toHour(): number | undefined {\n return this._toHour\n }\n\n private _fromDay?: number\n /**\n * The day when the activity starts. If the activity is not started yet, it will be hidden.\n */\n get fromDay(): number | undefined {\n return this._fromDay\n }\n\n private _toDay?: number\n /**\n * The day when the activity ends. If the activity is ended yet, it will be deleted or hidden.\n */\n get toDay(): number | undefined {\n return this._toDay\n }\n\n private _disabled?: boolean | string\n /**\n * Whether is disabled.\n */\n get disabled(): boolean | undefined {\n if (typeof this._disabled === \"string\") {\n return getFlag(this._disabled)\n }\n return this._disabled\n }\n\n private _hidden: boolean | string\n /**\n * Whether is hidden. If the activity is not started yet, it will be hidden.\n */\n get hidden(): boolean {\n if (this.fromDay && this.fromDay > TimeManager.currentDay) {\n return true\n }\n if (!this.isDeadline) {\n return true\n }\n if (typeof this._hidden === \"string\") {\n return getFlag(this._hidden)\n }\n return this._hidden\n }\n\n private _renderIcon?: GraphicItemType | ((activity: ActivityModel, props: OnRenderGraphicItemProps) => GraphicItemType)\n /**\n * The function for rendering the icon of the activity.\n */\n get renderIcon(): ((props: OnRenderGraphicItemProps) => GraphicItemType) | undefined {\n let render = this._renderIcon\n if (render === undefined) {\n return undefined\n }\n if (typeof render === \"function\") {\n return (props: OnRenderGraphicItemProps) => {\n return render(this, props)\n }\n }\n return (props: OnRenderGraphicItemProps) => render\n }\n\n private _onRun: OnRunActivityEvent<ActivityModel>\n get _initialOnRun(): OnRunActivityEvent<ActivityStoredAbstract> {\n return this._onRun as any\n }\n /**\n * The function that is called when the activity is runned.\n */\n get run(): (props: OnRunProps) => void {\n return (props) => this._onRun(this, props)\n }\n\n /**\n * Whether the activity is a deadline.\n * @returns Whether the activity is a deadline.\n */\n isDeadline(): boolean {\n if (this.toDay && this.toDay <= TimeManager.currentDay) {\n return true\n }\n return false\n }\n\n /**\n * Export the activity properties.\n * @returns The activity properties.\n */\n export(): ActivityProps {\n return {\n name: this._name,\n fromHour: this._fromHour,\n toHour: this._toHour,\n fromDay: this._fromDay,\n toDay: this._toDay,\n disabled: this._disabled,\n hidden: this._hidden,\n renderIcon: this._renderIcon,\n }\n }\n}\n","import { GameStorageManager } from \"@drincs/pixi-vn\";\nimport { ITimeStlot, TimeSettings } from \"../types/TimeSettings\";\n\nconst TIME_SETTINGS_KEY = '___nqtr-time_manager_settings___';\nconst TIME_DATA_KEY = '___nqtr-time_manager_data___';\n\ntype ITimeData = {\n currentHour?: number\n currentDay?: number\n}\n\nexport default class TimeManager {\n private constructor() { }\n private static editSettings(settings: TimeSettings) {\n let data: any = {}\n if (typeof settings.minDayHours === 'number') {\n data['minDayHours'] = settings.minDayHours\n }\n if (typeof settings.maxDayHours === 'number') {\n data['maxDayHours'] = settings.maxDayHours\n }\n if (typeof settings.minDayHours === 'number') {\n data['defaultTimeSpent'] = settings.defaultTimeSpent\n }\n if (Array.isArray(settings.timeSlots)) {\n data['timeSlots'] = settings.timeSlots\n }\n if (typeof settings.weekLength === 'number') {\n data['weekLength'] = settings.weekLength\n }\n if (typeof settings.weekendStartDay === 'number') {\n let weekLength = settings.weekLength || TimeManager.weekLength\n if (settings.weekendStartDay >= weekLength) {\n console.warn(`[NQTR] Weekend start day should be less than week length ${weekLength}`)\n }\n data['weekendStartDay'] = settings.weekendStartDay\n }\n if (Array.isArray(settings.weekDaysNames)) {\n let weekLength = settings.weekLength || TimeManager.weekLength\n if (settings.weekDaysNames.length !== weekLength) {\n console.warn(`[NQTR] Week days names should be equal to week length ${weekLength}`)\n }\n data['weekDaysNames'] = settings.weekDaysNames\n }\n GameStorageManager.setVariable(TIME_SETTINGS_KEY, data)\n }\n /**\n * Get time settings\n * @default {}\n */\n static get settings(): TimeSettings {\n let settings = GameStorageManager.getVariable<TimeSettings>(TIME_SETTINGS_KEY) || {}\n return settings\n }\n /**\n * Set time settings, Is very important to set the settings before using the nqtr library, bacause more of the features are based on the time settings.\n */\n static set settings(value: TimeSettings) {\n TimeManager.editSettings(value)\n }\n static get minDayHours(): number {\n let result = 0\n let settings = GameStorageManager.getVariable<TimeSettings>(TIME_SETTINGS_KEY)\n if (settings && settings.hasOwnProperty('minDayHours')) {\n result = settings.minDayHours || 0\n }\n return result\n }\n static get maxDayHours(): number {\n let result = 24\n let settings = GameStorageManager.getVariable<TimeSettings>(TIME_SETTINGS_KEY)\n if (settings && settings.hasOwnProperty('maxDayHours')) {\n result = settings.maxDayHours || 24\n }\n return result\n }\n static get defaultTimeSpent(): number {\n let result = 1\n let settings = GameStorageManager.getVariable<TimeSettings>(TIME_SETTINGS_KEY)\n if (settings && settings.hasOwnProperty('defaultTimeSpent')) {\n result = settings.defaultTimeSpent || 1\n }\n return result\n }\n static get timeSlots(): ITimeStlot[] {\n let result: ITimeStlot[] = []\n let settings = GameStorageManager.getVariable<TimeSettings>(TIME_SETTINGS_KEY)\n if (settings && settings.hasOwnProperty('timeSlots')) {\n result = settings.timeSlots || []\n }\n return result\n }\n static get weekLength(): number {\n let result = 7\n let settings = GameStorageManager.getVariable<TimeSettings>(TIME_SETTINGS_KEY)\n if (settings && settings.hasOwnProperty('weekLength')) {\n result = settings.weekLength || 7\n }\n return result\n }\n static get weekendStartDay(): number {\n let result = TimeManager.weekLength - 1\n let settings = GameStorageManager.getVariable<TimeSettings>(TIME_SETTINGS_KEY)\n if (settings && settings.hasOwnProperty('weekendStartDay')) {\n result = settings.weekendStartDay || TimeManager.weekLength - 1\n }\n return result\n }\n static get weekDaysNames(): string[] {\n let result: string[] = []\n let settings = GameStorageManager.getVariable<TimeSettings>(TIME_SETTINGS_KEY)\n if (settings && settings.hasOwnProperty('weekDaysNames')) {\n result = settings.weekDaysNames || result\n }\n return result\n }\n\n /**\n * Get the current hour\n */\n static get currentHour(): number {\n let data = GameStorageManager.getVariable<ITimeData>(TIME_DATA_KEY) || {}\n if (data.hasOwnProperty('currentHour') && typeof data.currentHour === 'number') {\n return data.currentHour\n }\n return TimeManager.minDayHours\n }\n static set currentHour(value: number | undefined) {\n let data = GameStorageManager.getVariable<ITimeData>(TIME_DATA_KEY) || {}\n if (typeof value === 'number') {\n data.currentHour = value\n } else {\n delete data.currentHour\n }\n GameStorageManager.setVariable(TIME_DATA_KEY, data)\n }\n /**\n * Get the current day\n */\n static get currentDay(): number {\n let data = GameStorageManager.getVariable<ITimeData>(TIME_DATA_KEY) || {}\n if (data.hasOwnProperty('currentDay') && typeof data.currentDay === 'number') {\n return data.currentDay\n }\n return 0\n }\n static set currentDay(value: number | undefined) {\n let data = GameStorageManager.getVariable<ITimeData>(TIME_DATA_KEY) || {}\n if (typeof value === 'number') {\n data.currentDay = value\n }\n else {\n delete data.currentDay\n }\n GameStorageManager.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 static get isWeekend(): boolean {\n return TimeManager.currentWeekDayNumber >= TimeManager.weekendStartDay\n }\n /**\n * Get the current week day number (1-TimeManager.weekLength).\n * For example, if the week length is 7 and the current day is 10, then the result will be 4.\n */\n static get currentWeekDayNumber(): number {\n let result = TimeManager.currentDay % TimeManager.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 static get currentDayName(): string {\n let weekDayNumber = TimeManager.currentWeekDayNumber - 1\n if (weekDayNumber >= TimeManager.weekDaysNames.length) {\n console.warn(`[NQTR] Week day name is not defined for day ${weekDayNumber}`, TimeManager.weekDaysNames)\n return \"\"\n }\n return TimeManager.weekDaysNames[weekDayNumber]\n }\n /**\n * Get the current TimeManager.timeSlots index.\n * You can use this property to create \"Image that changes based on the time period\":\n * @example\n * ```tsx\n * import { TimeManager } from '@drincs/nqtr';\n * \n * function changeBackground() {\n * return (\n * <img src={`background-${TimeManager.currentTimeSlot}.png`} />\n * )\n * }\n */\n static get currentTimeSlot(): number {\n if (TimeManager.timeSlots.length === 0) {\n console.warn('[NQTR] Time slots are not defined')\n return 0\n }\n for (let index = 0; index < TimeManager.timeSlots.length; index++) {\n let slot = TimeManager.timeSlots[index]\n if (TimeManager.timeSlots.length > index + 1) {\n if (TimeManager.nowIsBetween(slot.startHour, TimeManager.timeSlots[index + 1].startHour)) {\n return index\n }\n }\n }\n return TimeManager.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: TimeManager.defaultTimeSpent)\n * @returns TimeManager.currentHour\n */\n static increaseHour(timeSpent: number = TimeManager.defaultTimeSpent): number {\n let newHour = TimeManager.currentHour + timeSpent\n if (newHour >= TimeManager.maxDayHours) {\n TimeManager.increaseDay()\n newHour = TimeManager.minDayHours + (newHour - TimeManager.maxDayHours)\n }\n TimeManager.currentHour = newHour\n return TimeManager.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: TimeManager.minDayHours)\n * @param days is the number of days to increase (default: 1)\n * @returns TimeManager.currentDay\n */\n static increaseDay(newDayHour: number = TimeManager.minDayHours, days: number = 1): number {\n let newDay = TimeManager.currentDay + days\n TimeManager.currentDay = newDay\n TimeManager.currentHour = newDayHour\n return TimeManager.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 TimeManager.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 static nowIsBetween(fromHour: number, toHour: number): boolean {\n let currentHour = TimeManager.currentHour\n if (fromHour < toHour) {\n return currentHour >= fromHour && currentHour < toHour\n }\n return currentHour >= fromHour || currentHour < toHour\n }\n}\n"]}
|