@drincs/nqtr 0.0.5 → 0.0.6

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/index.d.mts CHANGED
@@ -5,38 +5,46 @@ type GraphicItemType<TCanvasItem extends CanvasBase<any> = CanvasBase<any>> = st
5
5
  interface ActivityProps {
6
6
  /**
7
7
  * The name
8
+ * @default ""
8
9
  */
9
10
  name?: string;
10
11
  /**
11
12
  * The hour when the activity starts. If the activity is not started yet, it will be hidden.
12
13
  * If you set 3, the activity will be hidden into hours 1 and 2, and will be shown from hour 3.
14
+ * @default TimeManager.minDayHours
13
15
  */
14
16
  fromHour?: number;
15
17
  /**
16
18
  * The hour when the activity ends. If the activity is ended yet, it will be hidden.
17
19
  * If you set 3, the activity will be shown into hours 1 and 2 and will be hidden from hour 3.
20
+ * @default TimeManager.maxDayHours + 1
18
21
  */
19
22
  toHour?: number;
20
23
  /**
21
24
  * The day when the activity starts. If the activity is not started yet, it will be hidden.
22
25
  * If you set 3, the activity will be hidden into days 1 and 2, and will be shown from day 3.
26
+ * @default undefined
23
27
  */
24
28
  fromDay?: number;
25
29
  /**
26
30
  * The day when the activity ends. If the activity is ended yet, it will be deleted or hidden.
27
31
  * If you set 3, the activity will be shown into days 1 and 2 and will be deleted or hidden from day 3.
32
+ * @default undefined
28
33
  */
29
34
  toDay?: number;
30
35
  /**
31
36
  * Whether is disabled. You can also pass a Pixi'VN flag name.
37
+ * @default false
32
38
  */
33
39
  disabled?: boolean | string;
34
40
  /**
35
41
  * Whether is hidden. You can also pass a Pixi'VN flag name.
42
+ * @default false
36
43
  */
37
44
  hidden?: boolean | string;
38
45
  /**
39
46
  * The icon element. Can be a string or an Element or a Pixi'VN CanvasItem
47
+ * @default undefined
40
48
  */
41
49
  icon?: GraphicItemType;
42
50
  }
@@ -99,9 +107,15 @@ declare class ActivityModel {
99
107
  export(): ActivityProps;
100
108
  }
101
109
 
110
+ declare enum ExecutionTypeEnum {
111
+ AUTOMATIC = "automatic",
112
+ INTERACTION = "interaction"
113
+ }
114
+
102
115
  interface MapBaseModelProps<TMap extends MapBaseModel = MapBaseModel> {
103
116
  /**
104
117
  * The name
118
+ * @default ""
105
119
  */
106
120
  name?: string;
107
121
  /**
@@ -116,6 +130,7 @@ interface MapBaseModelProps<TMap extends MapBaseModel = MapBaseModel> {
116
130
  * "night": "night-background.jpg"
117
131
  * }
118
132
  * ```
133
+ * @default undefined
119
134
  */
120
135
  image?: GraphicItemType | {
121
136
  [key: string]: GraphicItemType;
@@ -131,16 +146,19 @@ interface MapBaseModelProps<TMap extends MapBaseModel = MapBaseModel> {
131
146
  * "west": birminghamMap
132
147
  * }
133
148
  * ```
149
+ * @default {}
134
150
  */
135
151
  neighboringMaps?: {
136
152
  [key: string]: TMap;
137
153
  };
138
154
  /**
139
155
  * Whether is disabled. You can also pass a Pixi'VN flag name.
156
+ * @default false
140
157
  */
141
158
  disabled?: boolean | string;
142
159
  /**
143
160
  * Whether is hidden. You can also pass a Pixi'VN flag name.
161
+ * @default false
144
162
  */
145
163
  hidden?: boolean | string;
146
164
  }
@@ -169,14 +187,14 @@ declare class MapBaseModel extends StoredClassModel {
169
187
  private defaultName;
170
188
  /**
171
189
  * The name of the map.
172
- * If you set undefined, it will return the default name.
190
+ * If you set undefined, it will return the initial value of name.
173
191
  */
174
192
  get name(): string;
175
193
  set name(value: string | undefined);
176
194
  private defaultImage?;
177
195
  /**
178
196
  * The image of the map. It can be a string, an Element or a Pixi'VN Canvas Item.
179
- * If you set undefined, it will return the default image.
197
+ * If you set undefined, it will return the initial value of image.
180
198
  */
181
199
  get image(): GraphicItemType | {
182
200
  [key: string]: GraphicItemType;
@@ -196,114 +214,21 @@ declare class MapBaseModel extends StoredClassModel {
196
214
  */
197
215
  get hidden(): boolean;
198
216
  set hidden(value: boolean | string);
217
+ private _neighboringMaps?;
199
218
  /**
200
- * Get all locations in the map.
201
- * @returns The locations in the map.
202
- */
203
- getLocations<TLocation extends LocationBaseModel = LocationBaseModel>(): TLocation[];
204
- }
205
-
206
- declare enum ExecutionTypeEnum {
207
- AUTOMATIC = "automatic",
208
- INTERACTION = "interaction"
209
- }
210
-
211
- interface CommitmentBaseModelProps {
212
- /**
213
- * The name
214
- */
215
- name?: string;
216
- /**
217
- * The hour when the commitment starts. If the commitment is not started yet, it will be hidden.
218
- * If you set 3, the commitment will be hidden into hours 1 and 2, and will be shown from hour 3.
219
- */
220
- fromHour?: number;
221
- /**
222
- * The hour when the commitment ends. If the commitment is ended yet, it will be hidden.
223
- * If you set 3, the commitment will be shown into hours 1 and 2 and will be hidden from hour 3.
224
- */
225
- toHour?: number;
226
- /**
227
- * The day when the commitment starts. If the commitment is not started yet, it will be hidden.
228
- * If you set 3, the commitment will be hidden into days 1 and 2, and will be shown from day 3.
229
- */
230
- fromDay?: number;
231
- /**
232
- * The day when the commitment ends. If the commitment is ended yet, it will be deleted or hidden.
233
- * If you set 3, the commitment will be shown into days 1 and 2 and will be deleted or hidden from day 3.
234
- */
235
- toDay?: number;
236
- /**
237
- * The image. It can be a string, an Element or a Pixi'VN Canvas Item.
238
- * Or an object to manage multiple image types. For example to have a image based on time.
239
- * @example
240
- * ```ts
241
- * {
242
- * "morning": "morning-background.jpg",
243
- * "afternoon": "afternoon-background.jpg",
244
- * "evening": "evening-background.jpg",
245
- * "night": "night-background.jpg"
246
- * }
247
- * ```
219
+ * The neighboring maps that are available in this map.
248
220
  */
249
- image?: GraphicItemType | {
250
- [key: string]: GraphicItemType;
221
+ get neighboringMaps(): {
222
+ [key: string]: MapBaseModel;
251
223
  };
224
+ set neighboringMaps(value: {
225
+ [key: string]: MapBaseModel;
226
+ } | undefined);
252
227
  /**
253
- * 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.
254
- */
255
- executionType?: ExecutionTypeEnum;
256
- /**
257
- * Is a function that is called when the player interacts with the character.
258
- * @param commitment
259
- * @returns
260
- */
261
- onRun?: (commitment: CommitmentBaseModel) => void;
262
- /**
263
- * Whether is disabled. You can also pass a Pixi'VN flag name.
264
- * If it is disabled this commitment will not be taken into consideration. So the characters will not be in the room, but will be busy with other commitments.
265
- */
266
- disabled?: boolean | string;
267
- /**
268
- * Whether is hidden. You can also pass a Pixi'VN flag name.
228
+ * Get all locations in the map.
229
+ * @returns The locations in the map.
269
230
  */
270
- hidden?: boolean | string;
271
- }
272
- declare class CommitmentBaseModel<TCharacter extends CharacterBaseModel = CharacterBaseModel, TRoom extends RoomBaseModel = RoomBaseModel> extends StoredClassModel {
273
- constructor(id: string, character: TCharacter | TCharacter[] | undefined, room: TRoom, props: CommitmentBaseModelProps);
274
- private _characters;
275
- get characters(): TCharacter[];
276
- private _room;
277
- get room(): TRoom;
278
- private _name;
279
- get name(): GraphicItemType;
280
- private defaultFromHour?;
281
- get fromHour(): number;
282
- set fromHour(value: number | undefined);
283
- private defaultToHour?;
284
- get toHour(): number;
285
- set toHour(value: number | undefined);
286
- private defaultFromDay?;
287
- get fromDay(): number | undefined;
288
- set fromDay(value: number | undefined);
289
- private defaultToDay?;
290
- get toDay(): number | undefined;
291
- set toDay(value: number | undefined);
292
- private _image?;
293
- get image(): GraphicItemType | {
294
- [key: string]: GraphicItemType;
295
- } | undefined;
296
- private _executionType;
297
- get executionType(): ExecutionTypeEnum;
298
- private _onRun?;
299
- onRun(): void;
300
- private defaultDisabled;
301
- get disabled(): boolean;
302
- set disabled(value: boolean | string);
303
- private defaultHidden;
304
- get hidden(): boolean;
305
- set hidden(value: boolean | string);
306
- isExpired(): boolean;
231
+ getLocations<TLocation extends LocationBaseModel = LocationBaseModel>(): TLocation[];
307
232
  }
308
233
 
309
234
  declare class ActivityRoom<TRoom extends RoomBaseModel = RoomBaseModel> extends ActivityStoredAbstract {
@@ -320,6 +245,7 @@ declare class ActivityRoom<TRoom extends RoomBaseModel = RoomBaseModel> extends
320
245
  interface RoomBaseModelProps {
321
246
  /**
322
247
  * The name
248
+ * @default ""
323
249
  */
324
250
  name?: string;
325
251
  /**
@@ -334,28 +260,34 @@ interface RoomBaseModelProps {
334
260
  * "night": "night-background.jpg"
335
261
  * }
336
262
  * ```
263
+ * @default undefined
337
264
  */
338
265
  image?: GraphicItemType | {
339
266
  [key: string]: GraphicItemType;
340
267
  };
341
268
  /**
342
269
  * The activities that are available in this room.
270
+ * @default []
343
271
  */
344
272
  defaultActivities?: ActivityModel[];
345
273
  /**
346
274
  * Whether is disabled. You can also pass a Pixi'VN flag name.
275
+ * @default false
347
276
  */
348
277
  disabled?: boolean | string;
349
278
  /**
350
279
  * Whether is hidden. You can also pass a Pixi'VN flag name.
280
+ * @default false
351
281
  */
352
282
  hidden?: boolean | string;
353
283
  /**
354
284
  * The icon element. Can be a string or an Element or a Pixi'VN CanvasItem
285
+ * @default undefined
355
286
  */
356
287
  icon?: GraphicItemType;
357
288
  /**
358
289
  * Whether is an entrance room, so when the player enters in the location, it will be the first room to be shown.
290
+ * @default false
359
291
  */
360
292
  isEntrance?: boolean;
361
293
  }
@@ -393,14 +325,14 @@ declare class RoomBaseModel<TLocation extends LocationBaseModel = LocationBaseMo
393
325
  private defaultName;
394
326
  /**
395
327
  * The name.
396
- * If you set undefined, it will return the default name.
328
+ * If you set undefined, it will return the initial value of name.
397
329
  */
398
330
  get name(): string;
399
331
  set name(value: string | undefined);
400
332
  private defaultImage?;
401
333
  /**
402
334
  * The image. It can be a string, an Element or a Pixi'VN Canvas Item.
403
- * If you set undefined, it will return the default image.
335
+ * If you set undefined, it will return the initial value of image.
404
336
  */
405
337
  get image(): GraphicItemType | {
406
338
  [key: string]: GraphicItemType;
@@ -477,18 +409,22 @@ declare class RoomBaseModel<TLocation extends LocationBaseModel = LocationBaseMo
477
409
  interface LocationBaseModelProps {
478
410
  /**
479
411
  * The name
412
+ * @default ""
480
413
  */
481
414
  name?: string;
482
415
  /**
483
416
  * Whether is disabled. You can also pass a Pixi'VN flag name.
417
+ * @default false
484
418
  */
485
419
  disabled?: boolean | string;
486
420
  /**
487
421
  * Whether is hidden. You can also pass a Pixi'VN flag name.
422
+ * @default false
488
423
  */
489
424
  hidden?: boolean | string;
490
425
  /**
491
426
  * The icon element. Can be a string or an Element or a Pixi'VN CanvasItem
427
+ * @default undefined
492
428
  */
493
429
  icon?: GraphicItemType;
494
430
  }
@@ -512,7 +448,7 @@ declare class LocationBaseModel<TMap extends MapBaseModel = MapBaseModel> extend
512
448
  private defaultName;
513
449
  /**
514
450
  * The name of the location.
515
- * If you set undefined, it will return the default name.
451
+ * If you set undefined, it will return the initial value of name.
516
452
  */
517
453
  get name(): string;
518
454
  set name(value: string | undefined);
@@ -560,6 +496,180 @@ declare class LocationBaseModel<TMap extends MapBaseModel = MapBaseModel> extend
560
496
  getRooms<TRoom extends RoomBaseModel = RoomBaseModel>(): TRoom[];
561
497
  }
562
498
 
499
+ interface CommitmentBaseModelProps {
500
+ /**
501
+ * The name
502
+ * @default ""
503
+ */
504
+ name?: string;
505
+ /**
506
+ * The hour when the commitment starts. If the commitment is not started yet, it will be hidden.
507
+ * If you set 3, the commitment will be hidden into hours 1 and 2, and will be shown from hour 3.
508
+ * @default TimeManager.minDayHours
509
+ */
510
+ fromHour?: number;
511
+ /**
512
+ * The hour when the commitment ends. If the commitment is ended yet, it will be hidden.
513
+ * If you set 3, the commitment will be shown into hours 1 and 2 and will be hidden from hour 3.
514
+ * @default TimeManager.maxDayHours + 1
515
+ */
516
+ toHour?: number;
517
+ /**
518
+ * The day when the commitment starts. If the commitment is not started yet, it will be hidden.
519
+ * If you set 3, the commitment will be hidden into days 1 and 2, and will be shown from day 3.
520
+ * @default undefined
521
+ */
522
+ fromDay?: number;
523
+ /**
524
+ * The day when the commitment ends. If the commitment is ended yet, it will be deleted or hidden.
525
+ * If you set 3, the commitment will be shown into days 1 and 2 and will be deleted or hidden from day 3.
526
+ * @default undefined
527
+ */
528
+ toDay?: number;
529
+ /**
530
+ * The image. It can be a string, an Element or a Pixi'VN Canvas Item.
531
+ * Or an object to manage multiple image types. For example to have a image based on time.
532
+ * @example
533
+ * ```ts
534
+ * {
535
+ * "morning": "morning-background.jpg",
536
+ * "afternoon": "afternoon-background.jpg",
537
+ * "evening": "evening-background.jpg",
538
+ * "night": "night-background.jpg"
539
+ * }
540
+ * ```
541
+ * @default undefined
542
+ */
543
+ image?: GraphicItemType | {
544
+ [key: string]: GraphicItemType;
545
+ };
546
+ /**
547
+ * 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.
548
+ * @default ExecutionTypeEnum.INTERACTION
549
+ */
550
+ executionType?: ExecutionTypeEnum;
551
+ /**
552
+ * Is a function that is called when the player interacts with the character.
553
+ * @param commitment
554
+ * @returns
555
+ * @default undefined
556
+ */
557
+ onRun?: (commitment: CommitmentBaseModel) => void;
558
+ /**
559
+ * Whether is disabled. You can also pass a Pixi'VN flag name.
560
+ * If it is disabled this commitment will not be taken into consideration. So the characters will not be in the room, but will be busy with other commitments.
561
+ * @default false
562
+ */
563
+ disabled?: boolean | string;
564
+ /**
565
+ * Whether is hidden. You can also pass a Pixi'VN flag name.
566
+ * @default false
567
+ */
568
+ hidden?: boolean | string;
569
+ }
570
+ /**
571
+ * The base model of a commitment. I suggest you extend this class to create your own commitment model.
572
+ * You must use the saveRoom function to save the commitment in the registered commitments.
573
+ * @example
574
+ * ```ts
575
+ * export const mcRoom = new CommitmentBaseModel("test", character, room, {
576
+ * name: "Test",
577
+ * image: "https://image.jpg",
578
+ * executionType: ExecutionTypeEnum.INTERACTION,
579
+ * onRun: (commitment) => {
580
+ * // Do something
581
+ * }
582
+ })
583
+ * saveCommitment(mcRoom)
584
+ * ```
585
+ */
586
+ declare class CommitmentBaseModel<TCharacter extends CharacterBaseModel = CharacterBaseModel, TRoom extends RoomBaseModel = RoomBaseModel> extends StoredClassModel {
587
+ /**
588
+ * @param id The id of the commitment, it must be unique.
589
+ * @param character The character or characters that are in the commitment and so in the room.
590
+ * @param room The room where the commitment is.
591
+ * @param props The properties of the commitment.
592
+ */
593
+ constructor(id: string, character: TCharacter | TCharacter[] | undefined, room: TRoom, props: CommitmentBaseModelProps);
594
+ private _characters;
595
+ /**
596
+ * The character or characters that are in the commitment and so in the room.
597
+ */
598
+ get characters(): TCharacter[];
599
+ private _room;
600
+ /**
601
+ * The room where the commitment is.
602
+ */
603
+ get room(): TRoom;
604
+ private _name;
605
+ /**
606
+ * The name
607
+ */
608
+ get name(): GraphicItemType;
609
+ private defaultFromHour?;
610
+ /**
611
+ * The hour when the commitment starts. If the commitment is not started yet, it will be hidden.
612
+ * If you set undefined, it will return the initial value of fromHour.
613
+ */
614
+ get fromHour(): number;
615
+ set fromHour(value: number | undefined);
616
+ private defaultToHour?;
617
+ /**
618
+ * The hour when the commitment ends. If the commitment is ended yet, it will be hidden.
619
+ * If you set undefined, it will return the initial value of toHour.
620
+ */
621
+ get toHour(): number;
622
+ set toHour(value: number | undefined);
623
+ private defaultFromDay?;
624
+ /**
625
+ * The day when the commitment starts. If the commitment is not started yet, it will be hidden.
626
+ * If you set undefined, it will return the initial value of fromDay.
627
+ */
628
+ get fromDay(): number | undefined;
629
+ set fromDay(value: number | undefined);
630
+ private defaultToDay?;
631
+ /**
632
+ * The day when the commitment ends. If the commitment is ended yet, it will be deleted or hidden.
633
+ * If you set undefined, it will return the initial value of toDay.
634
+ */
635
+ get toDay(): number | undefined;
636
+ set toDay(value: number | undefined);
637
+ private _image?;
638
+ /**
639
+ * The image. It can be a string, an Element or a Pixi'VN Canvas Item.
640
+ */
641
+ get image(): GraphicItemType | {
642
+ [key: string]: GraphicItemType;
643
+ } | undefined;
644
+ private _executionType;
645
+ /**
646
+ * 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.
647
+ */
648
+ get executionType(): ExecutionTypeEnum;
649
+ private _onRun?;
650
+ /**
651
+ * Is a function that is called when the player interacts with the character.
652
+ */
653
+ onRun(): void;
654
+ private defaultDisabled;
655
+ /**
656
+ * Whether is disabled. You can also pass a Pixi'VN flag name.
657
+ */
658
+ get disabled(): boolean;
659
+ set disabled(value: boolean | string);
660
+ private defaultHidden;
661
+ /**
662
+ * Whether is hidden. You can also pass a Pixi'VN flag name.
663
+ */
664
+ get hidden(): boolean;
665
+ set hidden(value: boolean | string);
666
+ /**
667
+ * Whether the commitment is expired.
668
+ * @returns Whether the commitment is expired.
669
+ */
670
+ isExpired(): boolean;
671
+ }
672
+
563
673
  interface GoalProps {
564
674
  description: string;
565
675
  need?: number;
@@ -827,4 +937,4 @@ declare class TimeManager {
827
937
  static nowIsBetween(fromHour: number, toHour: number): boolean;
828
938
  }
829
939
 
830
- export { ActivityModel, type ActivityProps, ExecutionTypeEnum, Goal, type GoalProps, LocationBaseModel, type LocationBaseModelProps, MapBaseModel, type MapBaseModelProps, QuestBaseModel, type QuestBaseModelProps, type QuestsRequiredType, RoomBaseModel, type RoomBaseModelProps, StageBaseModel, type StageBaseModelProps, TimeManager, type TimeSettings, addTemporaryCommitment, clearExpiredActivities, clearExpiredRoutine, currentActivities, getActivityById, getAllLocations, getAllMaps, getCommitmentByCharacter, getCommitmentById, getCueerntMap, getCurrenrLocation, getCurrentCommitments, getCurrentRoom, getFixedCommitments, getRoomById, getTemporaryCommitments, saveActivity, saveCommitment, saveRoom, setCurrentRoom, setFixedCommitments };
940
+ export { ActivityModel, type ActivityProps, CommitmentBaseModel, type CommitmentBaseModelProps, ExecutionTypeEnum, Goal, type GoalProps, LocationBaseModel, type LocationBaseModelProps, MapBaseModel, type MapBaseModelProps, QuestBaseModel, type QuestBaseModelProps, type QuestsRequiredType, RoomBaseModel, type RoomBaseModelProps, StageBaseModel, type StageBaseModelProps, TimeManager, type TimeSettings, addTemporaryCommitment, clearExpiredActivities, clearExpiredRoutine, currentActivities, getActivityById, getAllLocations, getAllMaps, getCommitmentByCharacter, getCommitmentById, getCueerntMap, getCurrenrLocation, getCurrentCommitments, getCurrentRoom, getFixedCommitments, getRoomById, getTemporaryCommitments, saveActivity, saveCommitment, saveRoom, setCurrentRoom, setFixedCommitments };