@drincs/nqtr 0.0.4 → 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 +215 -28
- package/dist/index.d.ts +215 -28
- package/dist/index.js +189 -30
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +187 -30
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
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,24 +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
|
|
316
355
|
*/
|
|
317
|
-
|
|
356
|
+
icon?: GraphicItemType;
|
|
318
357
|
/**
|
|
319
358
|
* Whether is an entrance room, so when the player enters in the location, it will be the first room to be shown.
|
|
320
359
|
*/
|
|
321
360
|
isEntrance?: boolean;
|
|
322
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
|
+
*/
|
|
323
376
|
declare class RoomBaseModel<TLocation extends LocationBaseModel = LocationBaseModel> extends StoredClassModel {
|
|
324
|
-
|
|
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);
|
|
325
383
|
private _location;
|
|
384
|
+
/**
|
|
385
|
+
* The location where the room is.
|
|
386
|
+
*/
|
|
326
387
|
get location(): TLocation;
|
|
327
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
|
+
*/
|
|
328
392
|
get isEntrance(): boolean;
|
|
329
393
|
private defaultName;
|
|
394
|
+
/**
|
|
395
|
+
* The name.
|
|
396
|
+
* If you set undefined, it will return the default name.
|
|
397
|
+
*/
|
|
330
398
|
get name(): string;
|
|
331
|
-
set name(value: string);
|
|
399
|
+
set name(value: string | undefined);
|
|
332
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
|
+
*/
|
|
333
405
|
get image(): GraphicItemType | {
|
|
334
406
|
[key: string]: GraphicItemType;
|
|
335
407
|
} | undefined;
|
|
@@ -337,23 +409,68 @@ declare class RoomBaseModel<TLocation extends LocationBaseModel = LocationBaseMo
|
|
|
337
409
|
[key: string]: GraphicItemType;
|
|
338
410
|
} | undefined);
|
|
339
411
|
private defaultActivityIds;
|
|
412
|
+
/**
|
|
413
|
+
* The activities that are available in this room.
|
|
414
|
+
*/
|
|
340
415
|
get defaultActivities(): ActivityRoom<this>[];
|
|
341
|
-
get activityIds()
|
|
416
|
+
private get activityIds();
|
|
417
|
+
/**
|
|
418
|
+
* The activities that are available in this room.
|
|
419
|
+
*/
|
|
342
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
|
+
*/
|
|
343
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
|
+
*/
|
|
344
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
|
+
*/
|
|
345
438
|
setActivity(activity: ActivityRoom): void;
|
|
439
|
+
/**
|
|
440
|
+
* Add an activity to the room.
|
|
441
|
+
* @param activity The activity to add.
|
|
442
|
+
*/
|
|
346
443
|
addActivity(activity: ActivityModel): void;
|
|
444
|
+
/**
|
|
445
|
+
* Remove an activity from the room.
|
|
446
|
+
* @param activity The activity to remove.
|
|
447
|
+
*/
|
|
347
448
|
removeActivity(activity: ActivityModel | string): void;
|
|
449
|
+
/**
|
|
450
|
+
* Clear all expired activities.
|
|
451
|
+
*/
|
|
348
452
|
clearExpiredActivities(): void;
|
|
349
453
|
private defaultDisabled;
|
|
454
|
+
/**
|
|
455
|
+
* Whether is disabled. If it is a string, it is a Pixi'VN flag name.
|
|
456
|
+
*/
|
|
350
457
|
get disabled(): boolean;
|
|
351
458
|
set disabled(value: boolean | string);
|
|
352
459
|
private defaultHidden;
|
|
460
|
+
/**
|
|
461
|
+
* Whether is hidden. If it is a string, it is a Pixi'VN flag name.
|
|
462
|
+
*/
|
|
353
463
|
get hidden(): boolean;
|
|
354
464
|
set hidden(value: boolean | string);
|
|
355
|
-
|
|
356
|
-
|
|
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
|
+
*/
|
|
357
474
|
getRoutine<TCommitment extends CommitmentBaseModel = CommitmentBaseModel>(): TCommitment[];
|
|
358
475
|
}
|
|
359
476
|
|
|
@@ -371,26 +488,76 @@ interface LocationBaseModelProps {
|
|
|
371
488
|
*/
|
|
372
489
|
hidden?: boolean | string;
|
|
373
490
|
/**
|
|
374
|
-
* 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
|
|
375
492
|
*/
|
|
376
|
-
|
|
493
|
+
icon?: GraphicItemType;
|
|
377
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
|
+
*/
|
|
378
505
|
declare class LocationBaseModel<TMap extends MapBaseModel = MapBaseModel> extends StoredClassModel {
|
|
379
|
-
|
|
380
|
-
|
|
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);
|
|
381
512
|
private defaultName;
|
|
513
|
+
/**
|
|
514
|
+
* The name of the location.
|
|
515
|
+
* If you set undefined, it will return the default name.
|
|
516
|
+
*/
|
|
382
517
|
get name(): string;
|
|
383
|
-
set name(value: string);
|
|
518
|
+
set name(value: string | undefined);
|
|
384
519
|
private defaultDisabled;
|
|
520
|
+
/**
|
|
521
|
+
* Whether is disabled. If it is a string, it is a Pixi'VN flag name.
|
|
522
|
+
*/
|
|
385
523
|
get disabled(): boolean;
|
|
386
524
|
set disabled(value: boolean | string);
|
|
387
525
|
private defaultHidden;
|
|
526
|
+
/**
|
|
527
|
+
* Whether is hidden. If it is a string, it is a Pixi'VN flag name.
|
|
528
|
+
*/
|
|
388
529
|
get hidden(): boolean;
|
|
389
530
|
set hidden(value: boolean | string);
|
|
390
|
-
private
|
|
391
|
-
|
|
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;
|
|
392
536
|
private _map;
|
|
537
|
+
/**
|
|
538
|
+
* The map where the location is.
|
|
539
|
+
*/
|
|
393
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[];
|
|
394
561
|
}
|
|
395
562
|
|
|
396
563
|
interface GoalProps {
|
|
@@ -497,13 +664,33 @@ declare function addTemporaryCommitment<TCommitment extends CommitmentBaseModel
|
|
|
497
664
|
declare function getFixedCommitments<TCommitment extends CommitmentBaseModel = CommitmentBaseModel>(): TCommitment[];
|
|
498
665
|
declare function getTemporaryCommitments<TCommitment extends CommitmentBaseModel = CommitmentBaseModel>(): TCommitment[];
|
|
499
666
|
|
|
667
|
+
/**
|
|
668
|
+
* Save a room in the registered rooms.
|
|
669
|
+
* @param room The room to save.
|
|
670
|
+
* @returns
|
|
671
|
+
*/
|
|
500
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
|
+
*/
|
|
501
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[];
|
|
502
689
|
|
|
503
690
|
declare function clearExpiredActivities(): void;
|
|
504
691
|
declare function currentActivities(): ActivityRoom[];
|
|
505
692
|
|
|
506
|
-
declare function setCurrentRoom<TRoom extends RoomBaseModel = RoomBaseModel>(room: TRoom): void;
|
|
693
|
+
declare function setCurrentRoom<TRoom extends RoomBaseModel = RoomBaseModel>(room: TRoom | LocationBaseModel): void;
|
|
507
694
|
declare function getCurrentRoom<TRoom extends RoomBaseModel = RoomBaseModel>(): TRoom | undefined;
|
|
508
695
|
declare function getCurrenrLocation<TLocation extends LocationBaseModel = LocationBaseModel>(): TLocation | undefined;
|
|
509
696
|
declare function getCueerntMap<TMap extends MapBaseModel = MapBaseModel>(): TMap | undefined;
|
|
@@ -640,4 +827,4 @@ declare class TimeManager {
|
|
|
640
827
|
static nowIsBetween(fromHour: number, toHour: number): boolean;
|
|
641
828
|
}
|
|
642
829
|
|
|
643
|
-
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 };
|