@drincs/nqtr 0.0.5 → 0.0.7
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 +229 -134
- package/dist/index.d.ts +229 -134
- package/dist/index.js +200 -35
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +194 -30
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -204,7 +204,7 @@ var TimeManager = class _TimeManager {
|
|
|
204
204
|
* )
|
|
205
205
|
* }
|
|
206
206
|
*/
|
|
207
|
-
static get
|
|
207
|
+
static get currentTimeSlot() {
|
|
208
208
|
if (_TimeManager.timeSlots.length === 0) {
|
|
209
209
|
console.warn("[NQTR] Time slots are not defined");
|
|
210
210
|
return 0;
|
|
@@ -432,9 +432,170 @@ var ActivityModel = class {
|
|
|
432
432
|
}
|
|
433
433
|
};
|
|
434
434
|
|
|
435
|
-
// src/classes/
|
|
435
|
+
// src/classes/Commitment.ts
|
|
436
436
|
import { getFlag as getFlag2, StoredClassModel } from "@drincs/pixi-vn";
|
|
437
437
|
|
|
438
|
+
// src/enums/ExecutionTypeEnum.ts
|
|
439
|
+
var ExecutionTypeEnum = /* @__PURE__ */ ((ExecutionTypeEnum2) => {
|
|
440
|
+
ExecutionTypeEnum2["AUTOMATIC"] = "automatic";
|
|
441
|
+
ExecutionTypeEnum2["INTERACTION"] = "interaction";
|
|
442
|
+
return ExecutionTypeEnum2;
|
|
443
|
+
})(ExecutionTypeEnum || {});
|
|
444
|
+
|
|
445
|
+
// src/classes/Commitment.ts
|
|
446
|
+
var COMMITMENT_CATEGORY = "__nqtr-commitment__";
|
|
447
|
+
var CommitmentBaseModel = class extends StoredClassModel {
|
|
448
|
+
/**
|
|
449
|
+
* @param id The id of the commitment, it must be unique.
|
|
450
|
+
* @param character The character or characters that are in the commitment and so in the room.
|
|
451
|
+
* @param room The room where the commitment is.
|
|
452
|
+
* @param props The properties of the commitment.
|
|
453
|
+
*/
|
|
454
|
+
constructor(id, character, room, props) {
|
|
455
|
+
super(COMMITMENT_CATEGORY, id);
|
|
456
|
+
this._characters = character ? Array.isArray(character) ? character : [character] : [];
|
|
457
|
+
this._room = room;
|
|
458
|
+
this._name = props.name || "";
|
|
459
|
+
this.defaultFromHour = props.fromHour;
|
|
460
|
+
this.defaultToHour = props.toHour;
|
|
461
|
+
this.defaultFromDay = props.fromDay;
|
|
462
|
+
this.defaultToDay = props.toDay;
|
|
463
|
+
this._image = props.image;
|
|
464
|
+
this._executionType = props.executionType || "interaction" /* INTERACTION */;
|
|
465
|
+
this._onRun = props.onRun;
|
|
466
|
+
this.defaultDisabled = props.disabled || false;
|
|
467
|
+
this.defaultHidden = props.hidden || false;
|
|
468
|
+
}
|
|
469
|
+
/**
|
|
470
|
+
* The character or characters that are in the commitment and so in the room.
|
|
471
|
+
*/
|
|
472
|
+
get characters() {
|
|
473
|
+
return this._characters;
|
|
474
|
+
}
|
|
475
|
+
/**
|
|
476
|
+
* The room where the commitment is.
|
|
477
|
+
*/
|
|
478
|
+
get room() {
|
|
479
|
+
return this._room;
|
|
480
|
+
}
|
|
481
|
+
/**
|
|
482
|
+
* The name
|
|
483
|
+
*/
|
|
484
|
+
get name() {
|
|
485
|
+
return this._name;
|
|
486
|
+
}
|
|
487
|
+
/**
|
|
488
|
+
* The hour when the commitment starts. If the commitment is not started yet, it will be hidden.
|
|
489
|
+
* If you set undefined, it will return the initial value of fromHour.
|
|
490
|
+
*/
|
|
491
|
+
get fromHour() {
|
|
492
|
+
return this.getStorageProperty("fromHour") || this.defaultFromHour || TimeManager.minDayHours;
|
|
493
|
+
}
|
|
494
|
+
set fromHour(value) {
|
|
495
|
+
this.setStorageProperty("fromHour", value);
|
|
496
|
+
}
|
|
497
|
+
/**
|
|
498
|
+
* The hour when the commitment ends. If the commitment is ended yet, it will be hidden.
|
|
499
|
+
* If you set undefined, it will return the initial value of toHour.
|
|
500
|
+
*/
|
|
501
|
+
get toHour() {
|
|
502
|
+
return this.getStorageProperty("toHour") || this.defaultToHour || TimeManager.maxDayHours + 1;
|
|
503
|
+
}
|
|
504
|
+
set toHour(value) {
|
|
505
|
+
this.setStorageProperty("toHour", value);
|
|
506
|
+
}
|
|
507
|
+
/**
|
|
508
|
+
* The day when the commitment starts. If the commitment is not started yet, it will be hidden.
|
|
509
|
+
* If you set undefined, it will return the initial value of fromDay.
|
|
510
|
+
*/
|
|
511
|
+
get fromDay() {
|
|
512
|
+
return this.getStorageProperty("fromDay") || this.defaultFromDay;
|
|
513
|
+
}
|
|
514
|
+
set fromDay(value) {
|
|
515
|
+
this.setStorageProperty("fromDay", value);
|
|
516
|
+
}
|
|
517
|
+
/**
|
|
518
|
+
* The day when the commitment ends. If the commitment is ended yet, it will be deleted or hidden.
|
|
519
|
+
* If you set undefined, it will return the initial value of toDay.
|
|
520
|
+
*/
|
|
521
|
+
get toDay() {
|
|
522
|
+
return this.getStorageProperty("toDay") || this.defaultToDay;
|
|
523
|
+
}
|
|
524
|
+
set toDay(value) {
|
|
525
|
+
this.setStorageProperty("toDay", value);
|
|
526
|
+
}
|
|
527
|
+
/**
|
|
528
|
+
* The image. It can be a string, an Element or a Pixi'VN Canvas Item.
|
|
529
|
+
*/
|
|
530
|
+
get image() {
|
|
531
|
+
return this._image;
|
|
532
|
+
}
|
|
533
|
+
/**
|
|
534
|
+
* 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.
|
|
535
|
+
*/
|
|
536
|
+
get executionType() {
|
|
537
|
+
return this._executionType;
|
|
538
|
+
}
|
|
539
|
+
/**
|
|
540
|
+
* Is a function that is called when the player interacts with the character.
|
|
541
|
+
*/
|
|
542
|
+
onRun() {
|
|
543
|
+
if (!this._onRun) {
|
|
544
|
+
console.warn("[NQTR] onRun() is not defined for commitmen, so it will not run.", this);
|
|
545
|
+
} else {
|
|
546
|
+
this._onRun(this);
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
/**
|
|
550
|
+
* Whether is disabled. You can also pass a Pixi'VN flag name.
|
|
551
|
+
*/
|
|
552
|
+
get disabled() {
|
|
553
|
+
let value = this.getStorageProperty("disabled") || this.defaultDisabled;
|
|
554
|
+
if (typeof value === "string") {
|
|
555
|
+
return getFlag2(value);
|
|
556
|
+
}
|
|
557
|
+
return value;
|
|
558
|
+
}
|
|
559
|
+
set disabled(value) {
|
|
560
|
+
this.setStorageProperty("disabled", value);
|
|
561
|
+
}
|
|
562
|
+
/**
|
|
563
|
+
* Whether is hidden. You can also pass a Pixi'VN flag name.
|
|
564
|
+
*/
|
|
565
|
+
get hidden() {
|
|
566
|
+
if (this.fromDay && this.fromDay > TimeManager.currentDay) {
|
|
567
|
+
return true;
|
|
568
|
+
}
|
|
569
|
+
if (!TimeManager.nowIsBetween(this.fromHour, this.toHour)) {
|
|
570
|
+
return true;
|
|
571
|
+
}
|
|
572
|
+
if (!this.isExpired) {
|
|
573
|
+
return true;
|
|
574
|
+
}
|
|
575
|
+
let value = this.getStorageProperty("hidden") || this.defaultHidden;
|
|
576
|
+
if (typeof value === "string") {
|
|
577
|
+
return getFlag2(value);
|
|
578
|
+
}
|
|
579
|
+
return value;
|
|
580
|
+
}
|
|
581
|
+
set hidden(value) {
|
|
582
|
+
this.setStorageProperty("hidden", value);
|
|
583
|
+
}
|
|
584
|
+
/**
|
|
585
|
+
* Whether the commitment is expired.
|
|
586
|
+
* @returns Whether the commitment is expired.
|
|
587
|
+
*/
|
|
588
|
+
isExpired() {
|
|
589
|
+
if (this.toDay && this.toDay <= TimeManager.currentDay) {
|
|
590
|
+
return true;
|
|
591
|
+
}
|
|
592
|
+
return false;
|
|
593
|
+
}
|
|
594
|
+
};
|
|
595
|
+
|
|
596
|
+
// src/classes/navigation/Location.ts
|
|
597
|
+
import { getFlag as getFlag3, StoredClassModel as StoredClassModel2 } from "@drincs/pixi-vn";
|
|
598
|
+
|
|
438
599
|
// src/decorators/RoomDecorator.ts
|
|
439
600
|
var registeredRooms = {};
|
|
440
601
|
function saveRoom(room) {
|
|
@@ -483,7 +644,7 @@ function getAllMaps() {
|
|
|
483
644
|
|
|
484
645
|
// src/classes/navigation/Location.ts
|
|
485
646
|
var LOCATION_CATEGORY = "__nqtr-location__";
|
|
486
|
-
var LocationBaseModel = class extends
|
|
647
|
+
var LocationBaseModel = class extends StoredClassModel2 {
|
|
487
648
|
/**
|
|
488
649
|
* @param id The id of the location, it must be unique.
|
|
489
650
|
* @param map The map where the location is.
|
|
@@ -499,7 +660,7 @@ var LocationBaseModel = class extends StoredClassModel {
|
|
|
499
660
|
}
|
|
500
661
|
/**
|
|
501
662
|
* The name of the location.
|
|
502
|
-
* If you set undefined, it will return the
|
|
663
|
+
* If you set undefined, it will return the initial value of name.
|
|
503
664
|
*/
|
|
504
665
|
get name() {
|
|
505
666
|
return this.getStorageProperty("name") || this.defaultName;
|
|
@@ -513,7 +674,7 @@ var LocationBaseModel = class extends StoredClassModel {
|
|
|
513
674
|
get disabled() {
|
|
514
675
|
let value = this.getStorageProperty("disabled") || this.defaultDisabled;
|
|
515
676
|
if (typeof value === "string") {
|
|
516
|
-
return
|
|
677
|
+
return getFlag3(value);
|
|
517
678
|
}
|
|
518
679
|
return value;
|
|
519
680
|
}
|
|
@@ -526,7 +687,7 @@ var LocationBaseModel = class extends StoredClassModel {
|
|
|
526
687
|
get hidden() {
|
|
527
688
|
let value = this.getStorageProperty("hidden") || this.defaultHidden;
|
|
528
689
|
if (typeof value === "string") {
|
|
529
|
-
return
|
|
690
|
+
return getFlag3(value);
|
|
530
691
|
}
|
|
531
692
|
return value;
|
|
532
693
|
}
|
|
@@ -577,9 +738,9 @@ var LocationBaseModel = class extends StoredClassModel {
|
|
|
577
738
|
};
|
|
578
739
|
|
|
579
740
|
// src/classes/navigation/Map.ts
|
|
580
|
-
import { getFlag as
|
|
741
|
+
import { getFlag as getFlag4, StoredClassModel as StoredClassModel3 } from "@drincs/pixi-vn";
|
|
581
742
|
var MAP_CATEGORY = "__nqtr-map__";
|
|
582
|
-
var MapBaseModel = class extends
|
|
743
|
+
var MapBaseModel = class extends StoredClassModel3 {
|
|
583
744
|
/**
|
|
584
745
|
* @param id The id of the map, it must be unique.
|
|
585
746
|
* @param props The properties of the map.
|
|
@@ -593,7 +754,7 @@ var MapBaseModel = class extends StoredClassModel2 {
|
|
|
593
754
|
}
|
|
594
755
|
/**
|
|
595
756
|
* The name of the map.
|
|
596
|
-
* If you set undefined, it will return the
|
|
757
|
+
* If you set undefined, it will return the initial value of name.
|
|
597
758
|
*/
|
|
598
759
|
get name() {
|
|
599
760
|
return this.getStorageProperty("name") || this.defaultName;
|
|
@@ -603,7 +764,7 @@ var MapBaseModel = class extends StoredClassModel2 {
|
|
|
603
764
|
}
|
|
604
765
|
/**
|
|
605
766
|
* The image of the map. It can be a string, an Element or a Pixi'VN Canvas Item.
|
|
606
|
-
* If you set undefined, it will return the
|
|
767
|
+
* If you set undefined, it will return the initial value of image.
|
|
607
768
|
*/
|
|
608
769
|
get image() {
|
|
609
770
|
return this.getStorageProperty("image") || this.defaultImage;
|
|
@@ -617,7 +778,7 @@ var MapBaseModel = class extends StoredClassModel2 {
|
|
|
617
778
|
get disabled() {
|
|
618
779
|
let value = this.getStorageProperty("disabled") || this.defaultDisabled;
|
|
619
780
|
if (typeof value === "string") {
|
|
620
|
-
return
|
|
781
|
+
return getFlag4(value);
|
|
621
782
|
}
|
|
622
783
|
return value;
|
|
623
784
|
}
|
|
@@ -630,13 +791,22 @@ var MapBaseModel = class extends StoredClassModel2 {
|
|
|
630
791
|
get hidden() {
|
|
631
792
|
let value = this.getStorageProperty("hidden") || this.defaultHidden;
|
|
632
793
|
if (typeof value === "string") {
|
|
633
|
-
return
|
|
794
|
+
return getFlag4(value);
|
|
634
795
|
}
|
|
635
796
|
return value;
|
|
636
797
|
}
|
|
637
798
|
set hidden(value) {
|
|
638
799
|
this.setStorageProperty("hidden", value);
|
|
639
800
|
}
|
|
801
|
+
/**
|
|
802
|
+
* The neighboring maps that are available in this map.
|
|
803
|
+
*/
|
|
804
|
+
get neighboringMaps() {
|
|
805
|
+
return this._neighboringMaps || {};
|
|
806
|
+
}
|
|
807
|
+
set neighboringMaps(value) {
|
|
808
|
+
this._neighboringMaps = value;
|
|
809
|
+
}
|
|
640
810
|
/**
|
|
641
811
|
* Get all locations in the map.
|
|
642
812
|
* @returns The locations in the map.
|
|
@@ -647,7 +817,7 @@ var MapBaseModel = class extends StoredClassModel2 {
|
|
|
647
817
|
};
|
|
648
818
|
|
|
649
819
|
// src/classes/navigation/Room.ts
|
|
650
|
-
import { getFlag as
|
|
820
|
+
import { getFlag as getFlag5, StoredClassModel as StoredClassModel4 } from "@drincs/pixi-vn";
|
|
651
821
|
|
|
652
822
|
// src/decorators/ActivityDecorator.ts
|
|
653
823
|
var registeredActivities = {};
|
|
@@ -837,7 +1007,7 @@ var ActivityRoom = class extends ActivityStoredAbstract {
|
|
|
837
1007
|
|
|
838
1008
|
// src/classes/navigation/Room.ts
|
|
839
1009
|
var ROOM_CATEGORY = "__nqtr-room__";
|
|
840
|
-
var RoomBaseModel = class extends
|
|
1010
|
+
var RoomBaseModel = class extends StoredClassModel4 {
|
|
841
1011
|
/**
|
|
842
1012
|
* @param id The id of the room, it must be unique.
|
|
843
1013
|
* @param location The location where the room is.
|
|
@@ -869,7 +1039,7 @@ var RoomBaseModel = class extends StoredClassModel3 {
|
|
|
869
1039
|
}
|
|
870
1040
|
/**
|
|
871
1041
|
* The name.
|
|
872
|
-
* If you set undefined, it will return the
|
|
1042
|
+
* If you set undefined, it will return the initial value of name.
|
|
873
1043
|
*/
|
|
874
1044
|
get name() {
|
|
875
1045
|
return this.getStorageProperty("name") || this.defaultName;
|
|
@@ -879,7 +1049,7 @@ var RoomBaseModel = class extends StoredClassModel3 {
|
|
|
879
1049
|
}
|
|
880
1050
|
/**
|
|
881
1051
|
* The image. It can be a string, an Element or a Pixi'VN Canvas Item.
|
|
882
|
-
* If you set undefined, it will return the
|
|
1052
|
+
* If you set undefined, it will return the initial value of image.
|
|
883
1053
|
*/
|
|
884
1054
|
get image() {
|
|
885
1055
|
return this.getStorageProperty("image") || this.defaultImage;
|
|
@@ -1022,7 +1192,7 @@ var RoomBaseModel = class extends StoredClassModel3 {
|
|
|
1022
1192
|
get disabled() {
|
|
1023
1193
|
let value = this.getStorageProperty("disabled") || this.defaultDisabled;
|
|
1024
1194
|
if (typeof value === "string") {
|
|
1025
|
-
return
|
|
1195
|
+
return getFlag5(value);
|
|
1026
1196
|
}
|
|
1027
1197
|
return value;
|
|
1028
1198
|
}
|
|
@@ -1035,7 +1205,7 @@ var RoomBaseModel = class extends StoredClassModel3 {
|
|
|
1035
1205
|
get hidden() {
|
|
1036
1206
|
let value = this.getStorageProperty("hidden") || this.defaultHidden;
|
|
1037
1207
|
if (typeof value === "string") {
|
|
1038
|
-
return
|
|
1208
|
+
return getFlag5(value);
|
|
1039
1209
|
}
|
|
1040
1210
|
return value;
|
|
1041
1211
|
}
|
|
@@ -1084,9 +1254,9 @@ var Goal = class {
|
|
|
1084
1254
|
};
|
|
1085
1255
|
|
|
1086
1256
|
// src/classes/quest/Quest.ts
|
|
1087
|
-
import { StoredClassModel as
|
|
1257
|
+
import { StoredClassModel as StoredClassModel5 } from "@drincs/pixi-vn";
|
|
1088
1258
|
var QUEST_CATEGORY = "__nqtr-quest__";
|
|
1089
|
-
var QuestBaseModel = class extends
|
|
1259
|
+
var QuestBaseModel = class extends StoredClassModel5 {
|
|
1090
1260
|
constructor(id, stages, props) {
|
|
1091
1261
|
super(QUEST_CATEGORY, id);
|
|
1092
1262
|
this._stages = stages;
|
|
@@ -1117,9 +1287,9 @@ var QuestBaseModel = class extends StoredClassModel4 {
|
|
|
1117
1287
|
};
|
|
1118
1288
|
|
|
1119
1289
|
// src/classes/quest/Stage.ts
|
|
1120
|
-
import { StoredClassModel as
|
|
1290
|
+
import { StoredClassModel as StoredClassModel6 } from "@drincs/pixi-vn";
|
|
1121
1291
|
var STAGE_CATEGORY = "__nqtr-stage__";
|
|
1122
|
-
var StageBaseModel = class extends
|
|
1292
|
+
var StageBaseModel = class extends StoredClassModel6 {
|
|
1123
1293
|
constructor(id, props) {
|
|
1124
1294
|
super(STAGE_CATEGORY, id);
|
|
1125
1295
|
this._completed = false;
|
|
@@ -1185,13 +1355,6 @@ var StageBaseModel = class extends StoredClassModel5 {
|
|
|
1185
1355
|
}
|
|
1186
1356
|
};
|
|
1187
1357
|
|
|
1188
|
-
// src/enums/ExecutionTypeEnum.ts
|
|
1189
|
-
var ExecutionTypeEnum = /* @__PURE__ */ ((ExecutionTypeEnum2) => {
|
|
1190
|
-
ExecutionTypeEnum2["AUTOMATIC"] = "automatic";
|
|
1191
|
-
ExecutionTypeEnum2["INTERACTION"] = "interaction";
|
|
1192
|
-
return ExecutionTypeEnum2;
|
|
1193
|
-
})(ExecutionTypeEnum || {});
|
|
1194
|
-
|
|
1195
1358
|
// src/functions/NavigationFunctions.ts
|
|
1196
1359
|
import { GameStorageManager as GameStorageManager3 } from "@drincs/pixi-vn";
|
|
1197
1360
|
var CURRENT_ROOM_MEMORY_KEY = "___nqtr-current_room_memory___";
|
|
@@ -1210,7 +1373,7 @@ function setCurrentRoom(room) {
|
|
|
1210
1373
|
return;
|
|
1211
1374
|
}
|
|
1212
1375
|
}
|
|
1213
|
-
|
|
1376
|
+
GameStorageManager3.setVariable(CURRENT_ROOM_MEMORY_KEY, room.id);
|
|
1214
1377
|
}
|
|
1215
1378
|
function getCurrentRoom() {
|
|
1216
1379
|
let roomId = GameStorageManager3.getVariable(CURRENT_ROOM_MEMORY_KEY);
|
|
@@ -1255,6 +1418,7 @@ function currentActivities() {
|
|
|
1255
1418
|
}
|
|
1256
1419
|
export {
|
|
1257
1420
|
ActivityModel,
|
|
1421
|
+
CommitmentBaseModel,
|
|
1258
1422
|
ExecutionTypeEnum,
|
|
1259
1423
|
Goal,
|
|
1260
1424
|
LocationBaseModel,
|