@drincs/nqtr 0.0.3 → 0.0.5
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 +221 -29
- package/dist/index.d.ts +221 -29
- package/dist/index.js +222 -54
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +220 -54
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CanvasBase, StoredClassModel, CharacterBaseModel } from '@drincs/pixi-vn';
|
|
2
2
|
|
|
3
|
-
type GraphicItemType<TCanvasItem extends CanvasBase<any> = CanvasBase<any>> = string |
|
|
3
|
+
type GraphicItemType<TCanvasItem extends CanvasBase<any> = CanvasBase<any>> = string | Element | TCanvasItem;
|
|
4
4
|
|
|
5
5
|
interface ActivityProps {
|
|
6
6
|
/**
|
|
@@ -36,9 +36,9 @@ interface ActivityProps {
|
|
|
36
36
|
*/
|
|
37
37
|
hidden?: boolean | string;
|
|
38
38
|
/**
|
|
39
|
-
* The icon element. Can be a string or an
|
|
39
|
+
* The icon element. Can be a string or an Element or a Pixi'VN CanvasItem
|
|
40
40
|
*/
|
|
41
|
-
|
|
41
|
+
icon?: GraphicItemType;
|
|
42
42
|
}
|
|
43
43
|
declare abstract class ActivityStoredAbstract {
|
|
44
44
|
constructor(onRun: (activity: ActivityModel) => void, props: ActivityProps);
|
|
@@ -66,8 +66,8 @@ declare abstract class ActivityStoredAbstract {
|
|
|
66
66
|
private defaultHidden;
|
|
67
67
|
get hidden(): boolean;
|
|
68
68
|
set hidden(value: boolean | string);
|
|
69
|
-
private
|
|
70
|
-
get
|
|
69
|
+
private _icon?;
|
|
70
|
+
get icon(): GraphicItemType | undefined;
|
|
71
71
|
private _onRun;
|
|
72
72
|
get onRun(): (activity: ActivityModel) => void;
|
|
73
73
|
isExpired(): boolean;
|
|
@@ -91,8 +91,8 @@ declare class ActivityModel {
|
|
|
91
91
|
get disabled(): boolean | undefined;
|
|
92
92
|
private _hidden;
|
|
93
93
|
get hidden(): boolean;
|
|
94
|
-
private
|
|
95
|
-
get
|
|
94
|
+
private _icon?;
|
|
95
|
+
get icon(): GraphicItemType | undefined;
|
|
96
96
|
private _onRun;
|
|
97
97
|
get onRun(): (activity: ActivityModel) => void;
|
|
98
98
|
isDeadline(): boolean;
|
|
@@ -105,7 +105,7 @@ interface MapBaseModelProps<TMap extends MapBaseModel = MapBaseModel> {
|
|
|
105
105
|
*/
|
|
106
106
|
name?: string;
|
|
107
107
|
/**
|
|
108
|
-
* The image. It can be a string, an
|
|
108
|
+
* The image. It can be a string, an Element or a Pixi'VN Canvas Item.
|
|
109
109
|
* Or an object to manage multiple image types. For example to have a image based on time.
|
|
110
110
|
* @example
|
|
111
111
|
* ```ts
|
|
@@ -144,12 +144,40 @@ interface MapBaseModelProps<TMap extends MapBaseModel = MapBaseModel> {
|
|
|
144
144
|
*/
|
|
145
145
|
hidden?: boolean | string;
|
|
146
146
|
}
|
|
147
|
+
/**
|
|
148
|
+
* The base model of a map. I suggest you extend this class to create your own map model.
|
|
149
|
+
* @example
|
|
150
|
+
* ```typescript
|
|
151
|
+
* export const mainMap = new MapBaseModel('main_map', {
|
|
152
|
+
* name: 'Main Map',
|
|
153
|
+
* image: "https://image.jpg",
|
|
154
|
+
* neighboringMaps: {
|
|
155
|
+
* "north": northMap,
|
|
156
|
+
* "south": southMap,
|
|
157
|
+
* "east": eastMap,
|
|
158
|
+
* "west": westMap
|
|
159
|
+
* }
|
|
160
|
+
* });
|
|
161
|
+
* ```
|
|
162
|
+
*/
|
|
147
163
|
declare class MapBaseModel extends StoredClassModel {
|
|
148
|
-
|
|
164
|
+
/**
|
|
165
|
+
* @param id The id of the map, it must be unique.
|
|
166
|
+
* @param props The properties of the map.
|
|
167
|
+
*/
|
|
168
|
+
constructor(id: string, props?: MapBaseModelProps);
|
|
149
169
|
private defaultName;
|
|
170
|
+
/**
|
|
171
|
+
* The name of the map.
|
|
172
|
+
* If you set undefined, it will return the default name.
|
|
173
|
+
*/
|
|
150
174
|
get name(): string;
|
|
151
|
-
set name(value: string);
|
|
175
|
+
set name(value: string | undefined);
|
|
152
176
|
private defaultImage?;
|
|
177
|
+
/**
|
|
178
|
+
* 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.
|
|
180
|
+
*/
|
|
153
181
|
get image(): GraphicItemType | {
|
|
154
182
|
[key: string]: GraphicItemType;
|
|
155
183
|
} | undefined;
|
|
@@ -157,11 +185,22 @@ declare class MapBaseModel extends StoredClassModel {
|
|
|
157
185
|
[key: string]: GraphicItemType;
|
|
158
186
|
} | undefined);
|
|
159
187
|
private defaultDisabled;
|
|
188
|
+
/**
|
|
189
|
+
* Whether is disabled. If it is a string, it is a Pixi'VN flag name.
|
|
190
|
+
*/
|
|
160
191
|
get disabled(): boolean;
|
|
161
192
|
set disabled(value: boolean | string);
|
|
162
193
|
private defaultHidden;
|
|
194
|
+
/**
|
|
195
|
+
* Whether is hidden. If it is a string, it is a Pixi'VN flag name.
|
|
196
|
+
*/
|
|
163
197
|
get hidden(): boolean;
|
|
164
198
|
set hidden(value: boolean | string);
|
|
199
|
+
/**
|
|
200
|
+
* Get all locations in the map.
|
|
201
|
+
* @returns The locations in the map.
|
|
202
|
+
*/
|
|
203
|
+
getLocations<TLocation extends LocationBaseModel = LocationBaseModel>(): TLocation[];
|
|
165
204
|
}
|
|
166
205
|
|
|
167
206
|
declare enum ExecutionTypeEnum {
|
|
@@ -195,7 +234,7 @@ interface CommitmentBaseModelProps {
|
|
|
195
234
|
*/
|
|
196
235
|
toDay?: number;
|
|
197
236
|
/**
|
|
198
|
-
* The image. It can be a string, an
|
|
237
|
+
* The image. It can be a string, an Element or a Pixi'VN Canvas Item.
|
|
199
238
|
* Or an object to manage multiple image types. For example to have a image based on time.
|
|
200
239
|
* @example
|
|
201
240
|
* ```ts
|
|
@@ -284,7 +323,7 @@ interface RoomBaseModelProps {
|
|
|
284
323
|
*/
|
|
285
324
|
name?: string;
|
|
286
325
|
/**
|
|
287
|
-
* The image. It can be a string, an
|
|
326
|
+
* The image. It can be a string, an Element or a Pixi'VN Canvas Item.
|
|
288
327
|
* Or an object to manage multiple image types. For example to have a image based on time.
|
|
289
328
|
* @example
|
|
290
329
|
* ```ts
|
|
@@ -312,18 +351,57 @@ interface RoomBaseModelProps {
|
|
|
312
351
|
*/
|
|
313
352
|
hidden?: boolean | string;
|
|
314
353
|
/**
|
|
315
|
-
* The icon element. Can be a string or an
|
|
354
|
+
* The icon element. Can be a string or an Element or a Pixi'VN CanvasItem
|
|
355
|
+
*/
|
|
356
|
+
icon?: GraphicItemType;
|
|
357
|
+
/**
|
|
358
|
+
* Whether is an entrance room, so when the player enters in the location, it will be the first room to be shown.
|
|
316
359
|
*/
|
|
317
|
-
|
|
360
|
+
isEntrance?: boolean;
|
|
318
361
|
}
|
|
362
|
+
/**
|
|
363
|
+
* The base model of a room. I suggest you extend this class to create your own room model.
|
|
364
|
+
* You must use the saveRoom function to save the room in the registered rooms.
|
|
365
|
+
* @example
|
|
366
|
+
* ```ts
|
|
367
|
+
* export const mcRoom = new RoomBaseModel('mc_room', mcHome, {
|
|
368
|
+
* name: "MC Room",
|
|
369
|
+
* icon: "https://icon.jpg",
|
|
370
|
+
* image: "https://image.jpg",
|
|
371
|
+
* isEntrance: false,
|
|
372
|
+
* })
|
|
373
|
+
* saveRoom(mcRoom)
|
|
374
|
+
* ```
|
|
375
|
+
*/
|
|
319
376
|
declare class RoomBaseModel<TLocation extends LocationBaseModel = LocationBaseModel> extends StoredClassModel {
|
|
320
|
-
|
|
377
|
+
/**
|
|
378
|
+
* @param id The id of the room, it must be unique.
|
|
379
|
+
* @param location The location where the room is.
|
|
380
|
+
* @param props The properties of the room.
|
|
381
|
+
*/
|
|
382
|
+
constructor(id: string, location: TLocation, props?: RoomBaseModelProps);
|
|
321
383
|
private _location;
|
|
384
|
+
/**
|
|
385
|
+
* The location where the room is.
|
|
386
|
+
*/
|
|
322
387
|
get location(): TLocation;
|
|
388
|
+
private _isEntrance?;
|
|
389
|
+
/**
|
|
390
|
+
* Whether is an entrance room, so when the player enters in the location, it will be the first room to be shown.
|
|
391
|
+
*/
|
|
392
|
+
get isEntrance(): boolean;
|
|
323
393
|
private defaultName;
|
|
394
|
+
/**
|
|
395
|
+
* The name.
|
|
396
|
+
* If you set undefined, it will return the default name.
|
|
397
|
+
*/
|
|
324
398
|
get name(): string;
|
|
325
|
-
set name(value: string);
|
|
399
|
+
set name(value: string | undefined);
|
|
326
400
|
private defaultImage?;
|
|
401
|
+
/**
|
|
402
|
+
* 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.
|
|
404
|
+
*/
|
|
327
405
|
get image(): GraphicItemType | {
|
|
328
406
|
[key: string]: GraphicItemType;
|
|
329
407
|
} | undefined;
|
|
@@ -331,23 +409,68 @@ declare class RoomBaseModel<TLocation extends LocationBaseModel = LocationBaseMo
|
|
|
331
409
|
[key: string]: GraphicItemType;
|
|
332
410
|
} | undefined);
|
|
333
411
|
private defaultActivityIds;
|
|
412
|
+
/**
|
|
413
|
+
* The activities that are available in this room.
|
|
414
|
+
*/
|
|
334
415
|
get defaultActivities(): ActivityRoom<this>[];
|
|
335
|
-
get activityIds()
|
|
416
|
+
private get activityIds();
|
|
417
|
+
/**
|
|
418
|
+
* The activities that are available in this room.
|
|
419
|
+
*/
|
|
336
420
|
get activities(): ActivityRoom<this>[];
|
|
421
|
+
/**
|
|
422
|
+
* Get the memory of an activity. This function can be used into olther libraries to get the memory of the activity.
|
|
423
|
+
* @param id The id of the activity.
|
|
424
|
+
* @returns The memory of the activity.
|
|
425
|
+
*/
|
|
337
426
|
getActivityMemory(id: string): object | undefined;
|
|
427
|
+
/**
|
|
428
|
+
* Get the activity by id.
|
|
429
|
+
* @param id The id of the activity.
|
|
430
|
+
* @returns The room activity.
|
|
431
|
+
*/
|
|
338
432
|
getActivity(id: string): ActivityRoom<this> | undefined;
|
|
433
|
+
/**
|
|
434
|
+
* Set the memory of an activity. This function can be used into olther libraries to set the memory of the activity.
|
|
435
|
+
* @param id The id of the activity.
|
|
436
|
+
* @param memory The memory of the activity.
|
|
437
|
+
*/
|
|
339
438
|
setActivity(activity: ActivityRoom): void;
|
|
439
|
+
/**
|
|
440
|
+
* Add an activity to the room.
|
|
441
|
+
* @param activity The activity to add.
|
|
442
|
+
*/
|
|
340
443
|
addActivity(activity: ActivityModel): void;
|
|
444
|
+
/**
|
|
445
|
+
* Remove an activity from the room.
|
|
446
|
+
* @param activity The activity to remove.
|
|
447
|
+
*/
|
|
341
448
|
removeActivity(activity: ActivityModel | string): void;
|
|
449
|
+
/**
|
|
450
|
+
* Clear all expired activities.
|
|
451
|
+
*/
|
|
342
452
|
clearExpiredActivities(): void;
|
|
343
453
|
private defaultDisabled;
|
|
454
|
+
/**
|
|
455
|
+
* Whether is disabled. If it is a string, it is a Pixi'VN flag name.
|
|
456
|
+
*/
|
|
344
457
|
get disabled(): boolean;
|
|
345
458
|
set disabled(value: boolean | string);
|
|
346
459
|
private defaultHidden;
|
|
460
|
+
/**
|
|
461
|
+
* Whether is hidden. If it is a string, it is a Pixi'VN flag name.
|
|
462
|
+
*/
|
|
347
463
|
get hidden(): boolean;
|
|
348
464
|
set hidden(value: boolean | string);
|
|
349
|
-
|
|
350
|
-
|
|
465
|
+
/**
|
|
466
|
+
* The icon element. Can be a string or an Element or a Pixi'VN CanvasItem
|
|
467
|
+
*/
|
|
468
|
+
private _icon?;
|
|
469
|
+
get icon(): GraphicItemType | undefined;
|
|
470
|
+
/**
|
|
471
|
+
* Get the character commitments of the room.
|
|
472
|
+
* @returns The character commitments of the room.
|
|
473
|
+
*/
|
|
351
474
|
getRoutine<TCommitment extends CommitmentBaseModel = CommitmentBaseModel>(): TCommitment[];
|
|
352
475
|
}
|
|
353
476
|
|
|
@@ -365,27 +488,76 @@ interface LocationBaseModelProps {
|
|
|
365
488
|
*/
|
|
366
489
|
hidden?: boolean | string;
|
|
367
490
|
/**
|
|
368
|
-
* The icon element. Can be a string or an
|
|
491
|
+
* The icon element. Can be a string or an Element or a Pixi'VN CanvasItem
|
|
369
492
|
*/
|
|
370
|
-
|
|
493
|
+
icon?: GraphicItemType;
|
|
371
494
|
}
|
|
495
|
+
/**
|
|
496
|
+
* The base model of a location. I suggest you extend this class to create your own location model.
|
|
497
|
+
* @example
|
|
498
|
+
* ```typescript
|
|
499
|
+
* export const mcHome = new LocationBaseModel('mc_home', mainMap, {
|
|
500
|
+
* name: 'MC Home',
|
|
501
|
+
* icon: "https://icon.jpg",
|
|
502
|
+
* });
|
|
503
|
+
* ```
|
|
504
|
+
*/
|
|
372
505
|
declare class LocationBaseModel<TMap extends MapBaseModel = MapBaseModel> extends StoredClassModel {
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
506
|
+
/**
|
|
507
|
+
* @param id The id of the location, it must be unique.
|
|
508
|
+
* @param map The map where the location is.
|
|
509
|
+
* @param props The properties of the location.
|
|
510
|
+
*/
|
|
511
|
+
constructor(id: string, map: TMap, props?: LocationBaseModelProps);
|
|
376
512
|
private defaultName;
|
|
513
|
+
/**
|
|
514
|
+
* The name of the location.
|
|
515
|
+
* If you set undefined, it will return the default name.
|
|
516
|
+
*/
|
|
377
517
|
get name(): string;
|
|
378
|
-
set name(value: string);
|
|
518
|
+
set name(value: string | undefined);
|
|
379
519
|
private defaultDisabled;
|
|
520
|
+
/**
|
|
521
|
+
* Whether is disabled. If it is a string, it is a Pixi'VN flag name.
|
|
522
|
+
*/
|
|
380
523
|
get disabled(): boolean;
|
|
381
524
|
set disabled(value: boolean | string);
|
|
382
525
|
private defaultHidden;
|
|
526
|
+
/**
|
|
527
|
+
* Whether is hidden. If it is a string, it is a Pixi'VN flag name.
|
|
528
|
+
*/
|
|
383
529
|
get hidden(): boolean;
|
|
384
530
|
set hidden(value: boolean | string);
|
|
385
|
-
private
|
|
386
|
-
|
|
531
|
+
private _icon?;
|
|
532
|
+
/**
|
|
533
|
+
* The icon element. Can be a string or an Element or a Pixi'VN CanvasItem
|
|
534
|
+
*/
|
|
535
|
+
get icon(): GraphicItemType | undefined;
|
|
387
536
|
private _map;
|
|
537
|
+
/**
|
|
538
|
+
* The map where the location is.
|
|
539
|
+
*/
|
|
388
540
|
get map(): TMap;
|
|
541
|
+
/**
|
|
542
|
+
* Get the entrance room of the location.
|
|
543
|
+
* You can cast the room to a specific type that extends RoomBaseModel.
|
|
544
|
+
* @returns The entrance room or the first room if there is no entrance.
|
|
545
|
+
* @example
|
|
546
|
+
* ```typescript
|
|
547
|
+
* const entranceHome = new RoomBaseModel("entrance-home", home, { isEntrance: true })
|
|
548
|
+
* saveRoom(entranceHome)
|
|
549
|
+
* const home = new LocationBaseModel("home", map, { name: "Home" })
|
|
550
|
+
*
|
|
551
|
+
* const entrance = home.getEntrance() // entrance === entranceHome
|
|
552
|
+
* ```
|
|
553
|
+
*/
|
|
554
|
+
getEntrance<TRoom extends RoomBaseModel = RoomBaseModel>(): TRoom | undefined;
|
|
555
|
+
/**
|
|
556
|
+
* Get all rooms in the location.
|
|
557
|
+
* You can cast the rooms to a specific type that extends RoomBaseModel.
|
|
558
|
+
* @returns The rooms in the location.
|
|
559
|
+
*/
|
|
560
|
+
getRooms<TRoom extends RoomBaseModel = RoomBaseModel>(): TRoom[];
|
|
389
561
|
}
|
|
390
562
|
|
|
391
563
|
interface GoalProps {
|
|
@@ -492,13 +664,33 @@ declare function addTemporaryCommitment<TCommitment extends CommitmentBaseModel
|
|
|
492
664
|
declare function getFixedCommitments<TCommitment extends CommitmentBaseModel = CommitmentBaseModel>(): TCommitment[];
|
|
493
665
|
declare function getTemporaryCommitments<TCommitment extends CommitmentBaseModel = CommitmentBaseModel>(): TCommitment[];
|
|
494
666
|
|
|
667
|
+
/**
|
|
668
|
+
* Save a room in the registered rooms.
|
|
669
|
+
* @param room The room to save.
|
|
670
|
+
* @returns
|
|
671
|
+
*/
|
|
495
672
|
declare function saveRoom<TRoom extends RoomBaseModel = RoomBaseModel>(room: TRoom | TRoom[]): void;
|
|
673
|
+
/**
|
|
674
|
+
* Get a room by its id.
|
|
675
|
+
* @param id The id of the room.
|
|
676
|
+
* @returns The room or undefined if not found.
|
|
677
|
+
*/
|
|
496
678
|
declare function getRoomById<TRoom extends RoomBaseModel = RoomBaseModel>(id: string): TRoom | undefined;
|
|
679
|
+
/**
|
|
680
|
+
* Get all locations in the registered rooms.
|
|
681
|
+
* @returns All locations in the registered rooms.
|
|
682
|
+
*/
|
|
683
|
+
declare function getAllLocations<TLocation extends LocationBaseModel = LocationBaseModel>(): TLocation[];
|
|
684
|
+
/**
|
|
685
|
+
* Get all maps in the registered rooms.
|
|
686
|
+
* @returns All maps in the registered rooms.
|
|
687
|
+
*/
|
|
688
|
+
declare function getAllMaps<TMap extends MapBaseModel = MapBaseModel>(): TMap[];
|
|
497
689
|
|
|
498
690
|
declare function clearExpiredActivities(): void;
|
|
499
691
|
declare function currentActivities(): ActivityRoom[];
|
|
500
692
|
|
|
501
|
-
declare function setCurrentRoom<TRoom extends RoomBaseModel = RoomBaseModel>(room: TRoom): void;
|
|
693
|
+
declare function setCurrentRoom<TRoom extends RoomBaseModel = RoomBaseModel>(room: TRoom | LocationBaseModel): void;
|
|
502
694
|
declare function getCurrentRoom<TRoom extends RoomBaseModel = RoomBaseModel>(): TRoom | undefined;
|
|
503
695
|
declare function getCurrenrLocation<TLocation extends LocationBaseModel = LocationBaseModel>(): TLocation | undefined;
|
|
504
696
|
declare function getCueerntMap<TMap extends MapBaseModel = MapBaseModel>(): TMap | undefined;
|
|
@@ -635,4 +827,4 @@ declare class TimeManager {
|
|
|
635
827
|
static nowIsBetween(fromHour: number, toHour: number): boolean;
|
|
636
828
|
}
|
|
637
829
|
|
|
638
|
-
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, getCommitmentByCharacter, getCommitmentById, getCueerntMap, getCurrenrLocation, getCurrentCommitments, getCurrentRoom, getFixedCommitments, getRoomById, getTemporaryCommitments, saveActivity, saveCommitment, saveRoom, setCurrentRoom, setFixedCommitments };
|
|
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 };
|