@drincs/nqtr 0.6.0 → 0.7.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.
Files changed (55) hide show
  1. package/dist/handlers.cjs +1 -0
  2. package/dist/handlers.d.mts +606 -0
  3. package/dist/handlers.d.ts +606 -0
  4. package/dist/handlers.mjs +1 -0
  5. package/dist/index.cjs +1 -2
  6. package/dist/index.d.mts +1391 -23
  7. package/dist/index.d.ts +1391 -23
  8. package/dist/index.mjs +1 -2
  9. package/dist/ink.cjs +1 -0
  10. package/dist/ink.mjs +0 -0
  11. package/dist/registries.cjs +1 -0
  12. package/dist/registries.d.mts +516 -0
  13. package/dist/registries.d.ts +516 -0
  14. package/dist/registries.mjs +1 -0
  15. package/package.json +40 -8
  16. package/dist/RoomInterface-BhP3JgjH.d.ts +0 -182
  17. package/dist/RoomInterface-V1-hwph_.d.mts +0 -182
  18. package/dist/StageInterface-v96_K9Tg.d.mts +0 -188
  19. package/dist/StageInterface-v96_K9Tg.d.ts +0 -188
  20. package/dist/classes/index.cjs +0 -2
  21. package/dist/classes/index.cjs.map +0 -1
  22. package/dist/classes/index.d.mts +0 -515
  23. package/dist/classes/index.d.ts +0 -515
  24. package/dist/classes/index.mjs +0 -2
  25. package/dist/classes/index.mjs.map +0 -1
  26. package/dist/decorators/index.cjs +0 -2
  27. package/dist/decorators/index.cjs.map +0 -1
  28. package/dist/decorators/index.d.mts +0 -164
  29. package/dist/decorators/index.d.ts +0 -164
  30. package/dist/decorators/index.mjs +0 -2
  31. package/dist/decorators/index.mjs.map +0 -1
  32. package/dist/index-B8O3zxyP.d.ts +0 -269
  33. package/dist/index-BgY2U2li.d.mts +0 -199
  34. package/dist/index-CzOd-Rin.d.mts +0 -269
  35. package/dist/index-cbTx3r0P.d.ts +0 -199
  36. package/dist/index.cjs.map +0 -1
  37. package/dist/index.mjs.map +0 -1
  38. package/dist/interface/index.cjs +0 -2
  39. package/dist/interface/index.cjs.map +0 -1
  40. package/dist/interface/index.d.mts +0 -6
  41. package/dist/interface/index.d.ts +0 -6
  42. package/dist/interface/index.mjs +0 -2
  43. package/dist/interface/index.mjs.map +0 -1
  44. package/dist/managers/index.cjs +0 -2
  45. package/dist/managers/index.cjs.map +0 -1
  46. package/dist/managers/index.d.mts +0 -7
  47. package/dist/managers/index.d.ts +0 -7
  48. package/dist/managers/index.mjs +0 -2
  49. package/dist/managers/index.mjs.map +0 -1
  50. package/dist/types/index.cjs +0 -2
  51. package/dist/types/index.cjs.map +0 -1
  52. package/dist/types/index.d.mts +0 -65
  53. package/dist/types/index.d.ts +0 -65
  54. package/dist/types/index.mjs +0 -2
  55. package/dist/types/index.mjs.map +0 -1
@@ -0,0 +1 @@
1
+ 'use strict';var registries=require('@drincs/nqtr/registries'),storage=require('@drincs/pixi-vn/storage');var C=Object.defineProperty;var N=(a,e,t)=>e in a?C(a,e,{enumerable:true,configurable:true,writable:true,value:t}):a[e]=t;var u=(a,e,t)=>N(a,typeof e!="symbol"?e+"":e,t);var f="___nqtr-time_manager_data___",T="___nqtr-current_room_memory___",D="___nqtr-last_event_memory___";function l(a){storage.storage.set(D,a);}var c;(i=>(i.log=(m,...s)=>console.log(`[NQTR] ${m}`,...s),i.warn=(m,...s)=>console.warn(`[NQTR] ${m}`,...s),i.error=(m,...s)=>console.error(`[NQTR] ${m}`,...s),i.info=(m,...s)=>console.info(`[NQTR] ${m}`,...s)))(c||(c={}));var p=class{get rooms(){return registries.RegisteredRooms.values()}get locations(){return registries.RegisteredLocations.values()}get maps(){return registries.RegisteredMaps.values()}get currentRoomId(){return storage.storage.get(T)}get currentRoom(){let e=this.currentRoomId;if(!e){c.error("The current room has not yet been set");return}let t=registries.RegisteredRooms.get(e);if(!t){c.error(`Current room ${e} not found`);return}return t}set currentRoom(e){if(typeof e!="string"&&(e=e.id),!registries.RegisteredRooms.get(e)){c.error(`The room ${e} is not registered, so it can't be set as current room`);return}let r=storage.storage.get(T);r!==e&&(l({type:"editroom",prev:r,value:e}),storage.storage.set(T,e));}get currentLocation(){return this.currentRoom?.location}get currentMap(){return this.currentRoom?.location.map}clearExpiredActivities(){registries.RegisteredRooms.values().forEach(e=>{e.clearExpiredActivities();});}};var g=class{get quests(){return registries.RegisteredQuests.values()}get startedQuests(){return this.quests.filter(e=>e.started)}get inProgressQuests(){return this.quests.filter(e=>e.inProgress)}get completedQuests(){return this.quests.filter(e=>e.completed)}get failedQuests(){return this.quests.filter(e=>e.failed)}get notStartedQuests(){return this.quests.filter(e=>!e.started)}find(e){return registries.RegisteredQuests.get(e)}async startsStageMustBeStarted(e){let t=this.quests.map(r=>r.currentStageMustStart?r.startCurrentStage(e):Promise.resolve());await Promise.all(t);}};var I="___nqtr-temporary_commitment___",y=class{get fixedRoutine(){return [...registries.fixedCommitments.values()]}set fixedRoutine(e){e.forEach(t=>{registries.fixedCommitments.has(t.id)&&console.warn(`[NQTR] Commitment id ${t.id} already exists, it will be overwritten`),registries.fixedCommitments.set(t.id,t);});}get temporaryRoutine(){let e=storage.storage.get(I);return e?e.map(r=>registries.RegisteredCommitments.get(r)).filter(r=>r!==void 0):[]}get allRoutine(){return [...this.fixedRoutine,...this.temporaryRoutine]}add(e){Array.isArray(e)||(e=[e]);let t=e.map(r=>{if(!registries.RegisteredCommitments.get(r.id)){console.warn(`[NQTR] Commitment ${r.id} not found, it will be ignored`);return}return r.id}).filter(r=>r!==void 0);storage.storage.set(I,t);}find(e){return registries.RegisteredCommitments.get(e)}remove(e){Array.isArray(e)||(e=[e]);let t=e.map(i=>i.id),r=storage.storage.get(I);r&&(r=r.filter(i=>!t.includes(i)),storage.storage.set(I,r));}clearExpiredRoutine(){registries.RegisteredCommitments.values().forEach(e=>{e.expired&&registries.registeredCommitments.delete(e.id);});}get currentRoutine(){let e={};return [...this.fixedRoutine,...this.temporaryRoutine].forEach(t=>{t.isActive&&(t.characters.length>0?t.characters.every(i=>!e[i.id]||t.priority>e[i.id].priority)&&t.characters.forEach(i=>{e[i.id]=t;}):c.error(`The commitment ${t.id} has no characters assigned`));}),Object.values(e)}getCommitmentByCharacter(e){this.currentRoutine.forEach(t=>{if(t.characters.map(r=>r.id).includes(e.id))return t});}};var o=class o{};u(o,"dayStartTime",0),u(o,"dayEndTime",24),u(o,"defaultTimeSpent",1),u(o,"timeSlots",[]),u(o,"weekLength",7),u(o,"weekendStartDay",o.weekLength-1),u(o,"getDayName");var n=o;var h=class{initialize(e){let{dayStartTime:t=0,dayEndTime:r=24,defaultTimeSpent:i=1,timeSlots:m=[],weekLength:s=7,weekendStartDay:w=s-1,getDayName:x}=e;n.dayStartTime=t,n.dayEndTime=r,n.defaultTimeSpent=i,n.timeSlots=m,n.weekLength=s,w>=n.weekLength?console.warn(`[NQTR] Weekend start day should be less than week length ${s}, so will be ignored`):n.weekendStartDay=w,n.getDayName=x;}get dayStartTime(){return n.dayStartTime}get dayEndTime(){return n.dayEndTime}get defaultTimeSpent(){return n.defaultTimeSpent}get timeSlots(){return n.timeSlots}get weekLength(){return n.weekLength}get weekendStartDay(){return n.weekendStartDay}get getDayName(){return n.getDayName}get currentTime(){let e=storage.storage.get(f)||{};return e.hasOwnProperty("currentTime")&&typeof e.currentTime=="number"?e.currentTime:this.dayStartTime}set currentTime(e){let t=storage.storage.get(f)||{},r={...t};typeof e=="number"?r.currentTime=e:delete r.currentTime,l({type:"edittime",prev:t,value:r}),storage.storage.set(f,r);}get currentDate(){let e=storage.storage.get(f)||{};return e.hasOwnProperty("currentDate")&&typeof e.currentDate=="number"?e.currentDate:0}set currentDate(e){let t=storage.storage.get(f)||{},r={...t};typeof e=="number"?r.currentDate=e:delete r.currentDate,l({type:"edittime",prev:t,value:r}),storage.storage.set(f,r);}get isWeekend(){return this.currentWeekDayNumber>=this.weekendStartDay}get currentWeekDayNumber(){return this.currentDate%this.weekLength+1}get currentDayName(){return this.getDayName?this.getDayName(this.currentWeekDayNumber-1):(console.warn("[NQTR] Week days names are not defined, so currentDayName will be empty"),"")}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.startTime,this.timeSlots[e+1].startTime))return e}return this.timeSlots.length-1}increaseTime(e=this.defaultTimeSpent){let t=this.currentTime+e;return t>=this.dayEndTime&&(this.increaseDate(),t=this.dayStartTime+(t-this.dayEndTime)),this.currentTime=t,this.currentTime}increaseDate(e=1,t=this.dayStartTime){let r=this.currentDate+e;return this.currentDate=r,this.currentTime=t,this.currentDate}nowIsBetween(e,t){e===void 0&&(e=this.dayStartTime-1),t===void 0&&(t=this.dayEndTime+1);let r=this.currentTime;return e<t?r>=e&&r<t:r>=e||r<t}};var ce=new h,fe=new p,de=new y,le=new g;exports.navigator=fe;exports.questsNotebook=le;exports.routine=de;exports.timeTracker=ce;
@@ -0,0 +1,606 @@
1
+ import { OnRunProps as OnRunProps$1, ActivityInterface as ActivityInterface$1, CommitmentInterface as CommitmentInterface$1, LocationInterface as LocationInterface$1, MapInterface as MapInterface$1, RoomInterface as RoomInterface$1, QuestInterface as QuestInterface$1, StageInterface as StageInterface$1 } from '@drincs/nqtr';
2
+ import { StoredClassModel } from '@drincs/pixi-vn/storage';
3
+ import { CharacterInterface } from '@drincs/pixi-vn';
4
+
5
+ type ExecutionType = "automatic" | "interaction";
6
+
7
+ type OnRunProps = OnRunProps$1;
8
+ /**
9
+ * The function that is called when the class is runned.
10
+ */
11
+ type OnRunEvent<T> = (item: T, props: OnRunProps) => any | Promise<any>;
12
+ type OnRunAsyncFunction = (props: OnRunProps) => Promise<any>;
13
+
14
+ type QuestsRequiredType = {
15
+ quest: QuestInterface;
16
+ stageNumber: number;
17
+ };
18
+
19
+ type TimeSlotInterface = {
20
+ name: string;
21
+ startTime: number;
22
+ };
23
+ /**
24
+ * Time Settings, which can be set using {@link timeTracker.editSettings}
25
+ */
26
+ type TimeSettings = {
27
+ /**
28
+ * Minimum time of the day
29
+ * @default 0
30
+ */
31
+ dayStartTime?: number;
32
+ /**
33
+ * Maximum time of the day
34
+ * @default 24
35
+ */
36
+ dayEndTime?: number;
37
+ /**
38
+ * Default time spent
39
+ * @default 1
40
+ */
41
+ defaultTimeSpent?: number;
42
+ /**
43
+ * Time slots
44
+ * @default []
45
+ * @example
46
+ * ```ts
47
+ * [
48
+ * { name: 'Morning', startTime: 5 },
49
+ * { name: 'Afternoon', startTime: 12 },
50
+ * { name: 'Evening', startTime: 18 },
51
+ * { name: 'Night', startTime: 22 }
52
+ * ]
53
+ */
54
+ timeSlots?: TimeSlotInterface[];
55
+ /**
56
+ * Week length
57
+ * @default 7
58
+ */
59
+ weekLength?: number;
60
+ /**
61
+ * Weekend start day. For example, if the real life weekend starts on Saturday, then the value should be 6
62
+ * @default weekLength - 1
63
+ */
64
+ weekendStartDay?: number;
65
+ /**
66
+ * Week days name
67
+ * @param weekDayNumber The current week day number (from: 0 - to: {@link weekLength} - 1).
68
+ * @returns The name of the week day.
69
+ * @example
70
+ * ```ts
71
+ * (weekDayNumber: number) => {
72
+ * const weekDaysNames = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'];
73
+ * return weekDaysNames[weekDayNumber];
74
+ * }
75
+ * ```
76
+ */
77
+ getDayName?: (weekDayNumber: number) => string;
78
+ };
79
+
80
+ interface DateSchedulingInterface {
81
+ /**
82
+ * The start date. If the item hasn't started yet, it will be hidden.
83
+ * If you set it to 3, the item will be hidden on dates 1 and 2 and will be shown starting on date 3.
84
+ */
85
+ from: number;
86
+ /**
87
+ * The date when the item ends. If the item is ended yet, it will be deleted or hidden.
88
+ * If you set { from: 0, to: 3 }, the item will be shown into dates 1 and 2 and will be deleted or hidden from date 3.
89
+ * @default undefined
90
+ */
91
+ to?: number;
92
+ }
93
+
94
+ interface TimeSchedulingInterface {
95
+ /**
96
+ * The time when the item starts. If the item is not started yet, it will be hidden.
97
+ * If you set 3, the item will be hidden into times 1 and 2, and will be shown from time 3.
98
+ */
99
+ from: number;
100
+ /**
101
+ * The time when the item ends. If the item is ended yet, it will be hidden.
102
+ * If you set 3, the item will be shown into times 1 and 2 and will be hidden from time 3.
103
+ * @default timeTracker.dayEndTime + 1
104
+ */
105
+ to?: number;
106
+ }
107
+
108
+ interface ActivityInterface extends ActivityBaseInternalInterface, ActivityInterface$1 {
109
+ }
110
+ interface ActivityBaseInternalInterface {
111
+ /**
112
+ * The id of the activity/commitment.
113
+ */
114
+ readonly id: string;
115
+ /**
116
+ * Time slot in which activity/commitment will be active.
117
+ */
118
+ readonly timeSlot: TimeSchedulingInterface | undefined;
119
+ /**
120
+ * Used to schedule what date it will be added and removed.
121
+ */
122
+ readonly dateScheduling: DateSchedulingInterface | undefined;
123
+ /**
124
+ * The function that is called when the activity/commitment is runned.
125
+ */
126
+ readonly run: OnRunAsyncFunction;
127
+ /**
128
+ * Whether the activity/commitment is a deadline, so it will then be removed or hidden.
129
+ *
130
+ * It **depends only on the date**, not the time. So if you set { dateScheduling: { from: 0, to: 3 }, timeSlot { from: 10, to: 20 } } the activity/commitment hidden or deleted on date 3 at 0.
131
+ */
132
+ readonly expired: boolean;
133
+ /**
134
+ * Whether the activity/commitment is active.
135
+ */
136
+ readonly isActive: boolean;
137
+ }
138
+
139
+ interface CommitmentInterface extends CommitmentBaseInternalInterface, CommitmentInterface$1 {
140
+ }
141
+ interface CommitmentBaseInternalInterface extends ActivityBaseInternalInterface {
142
+ /**
143
+ * The character or characters that are in the commitment and so in the room.
144
+ */
145
+ readonly characters: CharacterInterface[];
146
+ /**
147
+ * The room where the commitment is.
148
+ */
149
+ readonly room: RoomInterface;
150
+ /**
151
+ * 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.
152
+ * If you set "automatic" remember to remove the commitment when it is no longer needed, because otherwise it repeats itself every time.
153
+ */
154
+ executionType: ExecutionType;
155
+ /**
156
+ * The priority. The higher the number, the higher the priority.
157
+ * To ensure that a character is not in 2 places at the same time, if there are 2 or more valid commits at the same time and with the same character, the one with the highest priority will be chosen.
158
+ */
159
+ priority: number;
160
+ }
161
+
162
+ interface NavigationAbstractInterface extends StoredClassModel {
163
+ /**
164
+ * Connects the activity to the class.
165
+ * @param activity The activity to connect to the class.
166
+ * @param options
167
+ * @returns
168
+ */
169
+ addActivity(activity: ActivityInterface, options?: {
170
+ /**
171
+ * Time slot in which activity will be active.
172
+ */
173
+ timeSlot?: TimeSchedulingInterface;
174
+ /**
175
+ * Used to schedule what date it will be added and removed.
176
+ */
177
+ dateScheduling?: DateSchedulingInterface;
178
+ }): void;
179
+ /**
180
+ * Disconnects the activity from the class.
181
+ * @param activity The activity to disconnect from the class.
182
+ * @param options
183
+ */
184
+ removeActivity(activity: ActivityInterface | string, options?: Pick<DateSchedulingInterface, "to">): void;
185
+ /**
186
+ * Removes the useless activities.
187
+ */
188
+ clearExpiredActivities(): void;
189
+ /**
190
+ * All the ids of the activities associated with this class. Compared to {@link activities}, they are not filtered based on their scheduling.
191
+ */
192
+ readonly activitiesIds: string[];
193
+ /**
194
+ * The activities associated with this class, filtered based on their scheduling.
195
+ */
196
+ activities: ActivityInterface[];
197
+ }
198
+
199
+ interface LocationInterface extends LocationInternalInterface, LocationInterface$1 {
200
+ }
201
+ interface LocationInternalInterface extends NavigationAbstractInterface {
202
+ /**
203
+ * The id of the location.
204
+ */
205
+ readonly id: string;
206
+ /**
207
+ * The map where the location is.
208
+ */
209
+ readonly map: MapInterface;
210
+ /**
211
+ * Get all rooms in the location.
212
+ * @returns The rooms in the location.
213
+ */
214
+ readonly rooms: RoomInterface[];
215
+ }
216
+
217
+ interface MapInterface extends MapBaseInternalInterface, MapInterface$1 {
218
+ }
219
+ interface MapBaseInternalInterface extends NavigationAbstractInterface {
220
+ /**
221
+ * The id of the map.
222
+ */
223
+ readonly id: string;
224
+ /**
225
+ * Get all locations in the map.
226
+ * @returns The locations in the map.
227
+ */
228
+ readonly locations: LocationInterface[];
229
+ }
230
+
231
+ interface RoomInterface extends RoomBaseInternalInterface, RoomInterface$1 {
232
+ }
233
+ interface RoomBaseInternalInterface extends NavigationAbstractInterface {
234
+ /**
235
+ * The id of the room.
236
+ */
237
+ readonly id: string;
238
+ /**
239
+ * The location where the room is.
240
+ */
241
+ readonly location: LocationInterface;
242
+ /**
243
+ * Get the character commitments of the room.
244
+ */
245
+ readonly routine: CommitmentInterface[];
246
+ /**
247
+ * Get the characters in the room.
248
+ */
249
+ readonly characters: CharacterInterface[];
250
+ /**
251
+ * Get the functions that will be executed when the room is visited.
252
+ */
253
+ readonly automaticFunctions: OnRunAsyncFunction[];
254
+ }
255
+
256
+ interface QuestInterface extends QuestBaseInternalInterface, QuestInterface$1 {
257
+ }
258
+ interface QuestBaseInternalInterface {
259
+ /**
260
+ * The id of the quest.
261
+ */
262
+ readonly id: string;
263
+ /**
264
+ * The stages of the quest.
265
+ */
266
+ readonly stages: StageInterface[];
267
+ /**
268
+ * The index of the current stage.
269
+ */
270
+ currentStageIndex?: number;
271
+ /**
272
+ * The current stage.
273
+ */
274
+ readonly currentStage?: StageInterface;
275
+ /**
276
+ * If the quest is started.
277
+ */
278
+ readonly started: boolean;
279
+ /**
280
+ * If the quest is started and not completed and not failed.
281
+ */
282
+ readonly inProgress: boolean;
283
+ /**
284
+ * If the quest is completed.
285
+ */
286
+ readonly completed: boolean;
287
+ /**
288
+ * If the quest is failed.
289
+ */
290
+ readonly failed: boolean;
291
+ /**
292
+ * The function that will be called when the quest starts.
293
+ */
294
+ readonly onStart?: OnRunEvent<QuestInterface>;
295
+ /**
296
+ * The function that will be called when the quest goes to the next stage.
297
+ */
298
+ readonly onNextStage?: OnRunEvent<QuestInterface>;
299
+ /**
300
+ * Start the quest.
301
+ * @param props The properties for the start stage. If you not want to pass any property, you can pass an {}.
302
+ * @returns
303
+ */
304
+ start(props: OnRunProps$1): Promise<void>;
305
+ /**
306
+ * Go to the next stage if the current stage is completed.
307
+ * If you want to force the change of stage, use {@link advanceUnconditionally}.
308
+ * @param props The properties. If you not want to pass any property, you can pass an {}.
309
+ * @returns true if the stage was changed, false otherwise.
310
+ */
311
+ advanceIfCompleted(props: OnRunProps$1): Promise<boolean>;
312
+ /**
313
+ * Complete the current stage and go to the next stage with {@link advanceUnconditionally}.
314
+ * If you want to go to the next stage only if the current stage is completed, use {@link advanceIfCompleted}.
315
+ * @param props The properties. If you not want to pass any property, you can pass an {}.
316
+ * @returns true if the stage was changed, false otherwise.
317
+ */
318
+ continue(props: OnRunProps$1): Promise<boolean>;
319
+ /**
320
+ * Ignore the completed state of the current stage and go to the next stage without checking if the current stage is completed.
321
+ * If you want to go to the next stage only if the current stage is completed, use {@link advanceIfCompleted}.
322
+ * @param props The properties. If you not want to pass any property, you can pass an {}.
323
+ * @returns returns true if the stage was changed, false otherwise.
324
+ */
325
+ advanceUnconditionally(props: OnRunProps$1): Promise<boolean>;
326
+ /**
327
+ * If the current stage must start. It is true if the current stage is not started, can start and not completed.
328
+ */
329
+ readonly currentStageMustStart: boolean;
330
+ /**
331
+ * Start the current stage. This is a system function, do not use it directly.
332
+ * @param props The properties for the start stage. If you not want to pass any property, you can pass an {}.
333
+ */
334
+ startCurrentStage(props: OnRunProps$1): Promise<void>;
335
+ }
336
+
337
+ interface StageInterface extends StageBaseInternalInterface, StageInterface$1 {
338
+ }
339
+ interface StageBaseInternalInterface {
340
+ /**
341
+ * The id of the stage.
342
+ */
343
+ readonly id: string;
344
+ /**
345
+ * The function that will be called when the stage starts.
346
+ */
347
+ readonly onStart?: OnRunEvent<StageInterface>;
348
+ /**
349
+ * The function that will be called when the stage ends.
350
+ */
351
+ readonly onEnd?: OnRunEvent<StageInterface>;
352
+ /**
353
+ * Check if the flag and goals are completed.
354
+ * You can force the completion of the stage by setting the completed property to true.
355
+ * @example
356
+ * ```ts
357
+ * export default class Stage extends StageStoredClass {
358
+ * override get completed(): boolean {
359
+ * if (super.completed) {
360
+ * return true;
361
+ * }
362
+ * if (this.flags.length > 0) {
363
+ * if (!this.flags.every((flag) => storage.getFlag(flag.flag))) {
364
+ * return false;
365
+ * }
366
+ * return true;
367
+ * }
368
+ * return false;
369
+ * }
370
+ * override set completed(value: boolean) {
371
+ * super.completed = value;
372
+ * }
373
+ * }
374
+ * ```
375
+ */
376
+ completed: boolean;
377
+ /**
378
+ * If the stage is started.
379
+ */
380
+ started: boolean;
381
+ /**
382
+ * The date when the stage starts.
383
+ */
384
+ readonly startDate?: number;
385
+ /**
386
+ * Check if the stage can start.
387
+ * @example
388
+ * ```ts
389
+ * export default class Stage extends StageStoredClass {
390
+ * override get canStart(): boolean {
391
+ * if (this.flagsRequired.length > 0 && !this.flagsRequired.every((flag) => storage.getFlag(flag.flag))) {
392
+ * return false;
393
+ * }
394
+ * return super.canStart;
395
+ * }
396
+ * }
397
+ * ```
398
+ */
399
+ readonly canStart: boolean;
400
+ /**
401
+ * The function that will be called when the stage starts.
402
+ */
403
+ start(props: OnRunProps$1): Promise<void>;
404
+ /**
405
+ * The number of day/date required to start the stage.
406
+ */
407
+ readonly deltaDateRequired: number;
408
+ /**
409
+ * The list of quests required to start the stage.
410
+ */
411
+ readonly questsRequired: QuestsRequiredType[];
412
+ }
413
+
414
+ declare class NavigatorHandler {
415
+ get rooms(): RoomInterface[];
416
+ get locations(): LocationInterface[];
417
+ get maps(): MapInterface[];
418
+ get currentRoomId(): string | undefined;
419
+ get currentRoom(): RoomInterface | undefined;
420
+ set currentRoom(room: RoomInterface | string);
421
+ get currentLocation(): LocationInterface | undefined;
422
+ get currentMap(): MapInterface | undefined;
423
+ /**
424
+ * Clear all the expired activities.
425
+ */
426
+ clearExpiredActivities(): void;
427
+ }
428
+
429
+ declare class QuestHandler {
430
+ /**
431
+ * The quests registered in the game.
432
+ */
433
+ get quests(): QuestInterface[];
434
+ /**
435
+ * The quests that are started, so they are in progress or completed or failed.
436
+ */
437
+ get startedQuests(): QuestInterface[];
438
+ /**
439
+ * The quests that are in progress.
440
+ */
441
+ get inProgressQuests(): QuestInterface[];
442
+ /**
443
+ * The quests that are completed.
444
+ */
445
+ get completedQuests(): QuestInterface[];
446
+ /**
447
+ * The quests that are failed.
448
+ */
449
+ get failedQuests(): QuestInterface[];
450
+ /**
451
+ * The quests that are not started.
452
+ */
453
+ get notStartedQuests(): QuestInterface[];
454
+ /**
455
+ * Get the quest by the id.
456
+ * @param id The id of the quest.
457
+ * @returns The quest with the id.
458
+ */
459
+ find(id: string): QuestInterface | undefined;
460
+ /**
461
+ * Start the quests that must start on the current stage.
462
+ */
463
+ startsStageMustBeStarted(props: OnRunProps$1): Promise<void>;
464
+ }
465
+
466
+ declare class RoutineHandler {
467
+ get fixedRoutine(): CommitmentInterface[];
468
+ /**
469
+ * Set a commitment as fixed, it will be always available. They cannot be deleted or edit during the game session.
470
+ */
471
+ set fixedRoutine(commitments: CommitmentInterface[]);
472
+ /**
473
+ * Get the temporary commitments by its id.
474
+ * @returns The temporary commitments.
475
+ */
476
+ get temporaryRoutine(): CommitmentInterface[];
477
+ get allRoutine(): CommitmentInterface[];
478
+ /**
479
+ * This feature adds the commitments during the game session.
480
+ * @param commitment The commitment or commitments to add.
481
+ */
482
+ add(commitment: CommitmentInterface[] | CommitmentInterface): void;
483
+ /**
484
+ * Get the commitments added during the game session.
485
+ * @param id The id of the commitment.
486
+ * @returns The commitment or undefined if not found.
487
+ */
488
+ find(id: string): CommitmentInterface | undefined;
489
+ /**
490
+ * Remove the commitments added during the game session.
491
+ * @param commitment The commitment or commitments to remove.
492
+ */
493
+ remove(commitment: CommitmentInterface[] | CommitmentInterface): void;
494
+ /**
495
+ * Clear all the expired commitments.
496
+ */
497
+ clearExpiredRoutine(): void;
498
+ /**
499
+ * Get the current commitments. The hidden commitments are not included.
500
+ * In case there is a character who has two or more commitments at the same time, will be selected the commitment with the highest priority.
501
+ * Higher priority commitments are calculated using the following steps:
502
+ * 1. The commitments that have Commitments BaseModel.priority set to a higher value will be selected first.
503
+ * 2. If there are commitments with the same priority, the commitments that are not fixed will be selected first.
504
+ * 3. If there are commitments with the same priority and the same fixed status, priority will be given to the commitment with a lower index.
505
+ * @returns The current commitments.
506
+ */
507
+ get currentRoutine(): CommitmentInterface[];
508
+ /**
509
+ * Get the character commitment.
510
+ * @param character The character.
511
+ * @returns The commitment or undefined if not found.
512
+ */
513
+ getCommitmentByCharacter(character: CharacterInterface): CommitmentInterface | undefined;
514
+ }
515
+
516
+ declare class TimeHandler {
517
+ initialize(settings: TimeSettings): void;
518
+ get dayStartTime(): number;
519
+ get dayEndTime(): number;
520
+ get defaultTimeSpent(): number;
521
+ get timeSlots(): TimeSlotInterface[];
522
+ get weekLength(): number;
523
+ get weekendStartDay(): number;
524
+ /**
525
+ * Week days name
526
+ * @param weekDayNumber The current week day number (from: 0 - to: {@link weekLength} - 1).
527
+ * @returns The name of the week day.
528
+ * @example
529
+ * ```ts
530
+ * (weekDayNumber: number) => {
531
+ * const weekDaysNames = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'];
532
+ * return weekDaysNames[weekDayNumber];
533
+ * }
534
+ * ```
535
+ */
536
+ get getDayName(): ((weekDayNumber: number) => string) | undefined;
537
+ /**
538
+ * Get the current time. Time is a numeric variable used to determine and manage time during a day/date.
539
+ * It's recommended to use currentTime as if it were the current time. If you also want to manage minutes, you can use a float value.
540
+ */
541
+ get currentTime(): number;
542
+ set currentTime(value: number | undefined);
543
+ /**
544
+ * Get the current date. Date is a numeric variable used to determine and manage the number of days passed.
545
+ * It's recommended to use currentDate as if it were the current day.
546
+ */
547
+ get currentDate(): number;
548
+ set currentDate(value: number | undefined);
549
+ /**
550
+ * If the current day is greater than or equal to the weekend start day, then it will return true.
551
+ */
552
+ get isWeekend(): boolean;
553
+ /**
554
+ * Get the current week day number (from: 1 - to: {@link weekLength}).
555
+ * For example, if the week length is 7 and the current day is 10, then the result will be 4.
556
+ */
557
+ get currentWeekDayNumber(): number;
558
+ /**
559
+ * Get the current week day name. If the week days names are not defined, then it will return undefined.
560
+ * 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'.
561
+ * @default ""
562
+ */
563
+ get currentDayName(): string;
564
+ /**
565
+ * Get the current {@link timeSlots} index.
566
+ * You can use this property to create "Image that changes based on the time period":
567
+ * @example
568
+ * ```tsx
569
+ * import { weekLength } from '@drincs/nqtr';
570
+ *
571
+ * function changeBackground() {
572
+ * return (
573
+ * <img src={`background-currentTimeSlot.currentTimeSlot.png`} />
574
+ * )
575
+ * }
576
+ */
577
+ get currentTimeSlot(): number;
578
+ /**
579
+ * This function will increase the current time by the given time spent.
580
+ * If the new time is greater than or equal to the max day times, then it will increase the day and set the new time.
581
+ * @param delta is the time spent in times (default: {@link defaultTimeSpent})
582
+ * @returns currentTimeSlot.currentTime
583
+ */
584
+ increaseTime(delta?: number): number;
585
+ /**
586
+ * This function will increase the current date by the given delta.
587
+ * @param delta is the number of days to increase (default: 1)
588
+ * @param time is the time of the new day (default: {@link dayStartTime})
589
+ * @returns timeTracker.currentDate
590
+ */
591
+ increaseDate(delta?: number, time?: number): number;
592
+ /**
593
+ * This function will check if the current time is between the given times.
594
+ * @param fromTime the starting time. If the {@link currentTime} is equal to this time, the function will return true.
595
+ * @param toTime the ending time.
596
+ * @returns true if the current time is between the given times, otherwise false.
597
+ */
598
+ nowIsBetween(fromTime: number | undefined, toTime: number | undefined): boolean;
599
+ }
600
+
601
+ declare const timeTracker: TimeHandler;
602
+ declare const navigator: NavigatorHandler;
603
+ declare const routine: RoutineHandler;
604
+ declare const questsNotebook: QuestHandler;
605
+
606
+ export { navigator, questsNotebook, routine, timeTracker };