@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 +219 -109
- package/dist/index.d.ts +219 -109
- package/dist/index.js +198 -33
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +192 -28
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -35,6 +35,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
35
35
|
var src_exports = {};
|
|
36
36
|
__export(src_exports, {
|
|
37
37
|
ActivityModel: () => ActivityModel,
|
|
38
|
+
CommitmentBaseModel: () => CommitmentBaseModel,
|
|
38
39
|
ExecutionTypeEnum: () => ExecutionTypeEnum,
|
|
39
40
|
Goal: () => Goal,
|
|
40
41
|
LocationBaseModel: () => LocationBaseModel,
|
|
@@ -484,9 +485,170 @@ var ActivityModel = class {
|
|
|
484
485
|
}
|
|
485
486
|
};
|
|
486
487
|
|
|
487
|
-
// src/classes/
|
|
488
|
+
// src/classes/Commitment.ts
|
|
488
489
|
var import_pixi_vn3 = require("@drincs/pixi-vn");
|
|
489
490
|
|
|
491
|
+
// src/enums/ExecutionTypeEnum.ts
|
|
492
|
+
var ExecutionTypeEnum = /* @__PURE__ */ ((ExecutionTypeEnum2) => {
|
|
493
|
+
ExecutionTypeEnum2["AUTOMATIC"] = "automatic";
|
|
494
|
+
ExecutionTypeEnum2["INTERACTION"] = "interaction";
|
|
495
|
+
return ExecutionTypeEnum2;
|
|
496
|
+
})(ExecutionTypeEnum || {});
|
|
497
|
+
|
|
498
|
+
// src/classes/Commitment.ts
|
|
499
|
+
var COMMITMENT_CATEGORY = "__nqtr-commitment__";
|
|
500
|
+
var CommitmentBaseModel = class extends import_pixi_vn3.StoredClassModel {
|
|
501
|
+
/**
|
|
502
|
+
* @param id The id of the commitment, it must be unique.
|
|
503
|
+
* @param character The character or characters that are in the commitment and so in the room.
|
|
504
|
+
* @param room The room where the commitment is.
|
|
505
|
+
* @param props The properties of the commitment.
|
|
506
|
+
*/
|
|
507
|
+
constructor(id, character, room, props) {
|
|
508
|
+
super(COMMITMENT_CATEGORY, id);
|
|
509
|
+
this._characters = character ? Array.isArray(character) ? character : [character] : [];
|
|
510
|
+
this._room = room;
|
|
511
|
+
this._name = props.name || "";
|
|
512
|
+
this.defaultFromHour = props.fromHour;
|
|
513
|
+
this.defaultToHour = props.toHour;
|
|
514
|
+
this.defaultFromDay = props.fromDay;
|
|
515
|
+
this.defaultToDay = props.toDay;
|
|
516
|
+
this._image = props.image;
|
|
517
|
+
this._executionType = props.executionType || "interaction" /* INTERACTION */;
|
|
518
|
+
this._onRun = props.onRun;
|
|
519
|
+
this.defaultDisabled = props.disabled || false;
|
|
520
|
+
this.defaultHidden = props.hidden || false;
|
|
521
|
+
}
|
|
522
|
+
/**
|
|
523
|
+
* The character or characters that are in the commitment and so in the room.
|
|
524
|
+
*/
|
|
525
|
+
get characters() {
|
|
526
|
+
return this._characters;
|
|
527
|
+
}
|
|
528
|
+
/**
|
|
529
|
+
* The room where the commitment is.
|
|
530
|
+
*/
|
|
531
|
+
get room() {
|
|
532
|
+
return this._room;
|
|
533
|
+
}
|
|
534
|
+
/**
|
|
535
|
+
* The name
|
|
536
|
+
*/
|
|
537
|
+
get name() {
|
|
538
|
+
return this._name;
|
|
539
|
+
}
|
|
540
|
+
/**
|
|
541
|
+
* The hour when the commitment starts. If the commitment is not started yet, it will be hidden.
|
|
542
|
+
* If you set undefined, it will return the initial value of fromHour.
|
|
543
|
+
*/
|
|
544
|
+
get fromHour() {
|
|
545
|
+
return this.getStorageProperty("fromHour") || this.defaultFromHour || TimeManager.minDayHours;
|
|
546
|
+
}
|
|
547
|
+
set fromHour(value) {
|
|
548
|
+
this.setStorageProperty("fromHour", value);
|
|
549
|
+
}
|
|
550
|
+
/**
|
|
551
|
+
* The hour when the commitment ends. If the commitment is ended yet, it will be hidden.
|
|
552
|
+
* If you set undefined, it will return the initial value of toHour.
|
|
553
|
+
*/
|
|
554
|
+
get toHour() {
|
|
555
|
+
return this.getStorageProperty("toHour") || this.defaultToHour || TimeManager.maxDayHours + 1;
|
|
556
|
+
}
|
|
557
|
+
set toHour(value) {
|
|
558
|
+
this.setStorageProperty("toHour", value);
|
|
559
|
+
}
|
|
560
|
+
/**
|
|
561
|
+
* The day when the commitment starts. If the commitment is not started yet, it will be hidden.
|
|
562
|
+
* If you set undefined, it will return the initial value of fromDay.
|
|
563
|
+
*/
|
|
564
|
+
get fromDay() {
|
|
565
|
+
return this.getStorageProperty("fromDay") || this.defaultFromDay;
|
|
566
|
+
}
|
|
567
|
+
set fromDay(value) {
|
|
568
|
+
this.setStorageProperty("fromDay", value);
|
|
569
|
+
}
|
|
570
|
+
/**
|
|
571
|
+
* The day when the commitment ends. If the commitment is ended yet, it will be deleted or hidden.
|
|
572
|
+
* If you set undefined, it will return the initial value of toDay.
|
|
573
|
+
*/
|
|
574
|
+
get toDay() {
|
|
575
|
+
return this.getStorageProperty("toDay") || this.defaultToDay;
|
|
576
|
+
}
|
|
577
|
+
set toDay(value) {
|
|
578
|
+
this.setStorageProperty("toDay", value);
|
|
579
|
+
}
|
|
580
|
+
/**
|
|
581
|
+
* The image. It can be a string, an Element or a Pixi'VN Canvas Item.
|
|
582
|
+
*/
|
|
583
|
+
get image() {
|
|
584
|
+
return this._image;
|
|
585
|
+
}
|
|
586
|
+
/**
|
|
587
|
+
* 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.
|
|
588
|
+
*/
|
|
589
|
+
get executionType() {
|
|
590
|
+
return this._executionType;
|
|
591
|
+
}
|
|
592
|
+
/**
|
|
593
|
+
* Is a function that is called when the player interacts with the character.
|
|
594
|
+
*/
|
|
595
|
+
onRun() {
|
|
596
|
+
if (!this._onRun) {
|
|
597
|
+
console.warn("[NQTR] onRun() is not defined for commitmen, so it will not run.", this);
|
|
598
|
+
} else {
|
|
599
|
+
this._onRun(this);
|
|
600
|
+
}
|
|
601
|
+
}
|
|
602
|
+
/**
|
|
603
|
+
* Whether is disabled. You can also pass a Pixi'VN flag name.
|
|
604
|
+
*/
|
|
605
|
+
get disabled() {
|
|
606
|
+
let value = this.getStorageProperty("disabled") || this.defaultDisabled;
|
|
607
|
+
if (typeof value === "string") {
|
|
608
|
+
return (0, import_pixi_vn3.getFlag)(value);
|
|
609
|
+
}
|
|
610
|
+
return value;
|
|
611
|
+
}
|
|
612
|
+
set disabled(value) {
|
|
613
|
+
this.setStorageProperty("disabled", value);
|
|
614
|
+
}
|
|
615
|
+
/**
|
|
616
|
+
* Whether is hidden. You can also pass a Pixi'VN flag name.
|
|
617
|
+
*/
|
|
618
|
+
get hidden() {
|
|
619
|
+
if (this.fromDay && this.fromDay > TimeManager.currentDay) {
|
|
620
|
+
return true;
|
|
621
|
+
}
|
|
622
|
+
if (!TimeManager.nowIsBetween(this.fromHour, this.toHour)) {
|
|
623
|
+
return true;
|
|
624
|
+
}
|
|
625
|
+
if (!this.isExpired) {
|
|
626
|
+
return true;
|
|
627
|
+
}
|
|
628
|
+
let value = this.getStorageProperty("hidden") || this.defaultHidden;
|
|
629
|
+
if (typeof value === "string") {
|
|
630
|
+
return (0, import_pixi_vn3.getFlag)(value);
|
|
631
|
+
}
|
|
632
|
+
return value;
|
|
633
|
+
}
|
|
634
|
+
set hidden(value) {
|
|
635
|
+
this.setStorageProperty("hidden", value);
|
|
636
|
+
}
|
|
637
|
+
/**
|
|
638
|
+
* Whether the commitment is expired.
|
|
639
|
+
* @returns Whether the commitment is expired.
|
|
640
|
+
*/
|
|
641
|
+
isExpired() {
|
|
642
|
+
if (this.toDay && this.toDay <= TimeManager.currentDay) {
|
|
643
|
+
return true;
|
|
644
|
+
}
|
|
645
|
+
return false;
|
|
646
|
+
}
|
|
647
|
+
};
|
|
648
|
+
|
|
649
|
+
// src/classes/navigation/Location.ts
|
|
650
|
+
var import_pixi_vn4 = require("@drincs/pixi-vn");
|
|
651
|
+
|
|
490
652
|
// src/decorators/RoomDecorator.ts
|
|
491
653
|
var registeredRooms = {};
|
|
492
654
|
function saveRoom(room) {
|
|
@@ -535,7 +697,7 @@ function getAllMaps() {
|
|
|
535
697
|
|
|
536
698
|
// src/classes/navigation/Location.ts
|
|
537
699
|
var LOCATION_CATEGORY = "__nqtr-location__";
|
|
538
|
-
var LocationBaseModel = class extends
|
|
700
|
+
var LocationBaseModel = class extends import_pixi_vn4.StoredClassModel {
|
|
539
701
|
/**
|
|
540
702
|
* @param id The id of the location, it must be unique.
|
|
541
703
|
* @param map The map where the location is.
|
|
@@ -551,7 +713,7 @@ var LocationBaseModel = class extends import_pixi_vn3.StoredClassModel {
|
|
|
551
713
|
}
|
|
552
714
|
/**
|
|
553
715
|
* The name of the location.
|
|
554
|
-
* If you set undefined, it will return the
|
|
716
|
+
* If you set undefined, it will return the initial value of name.
|
|
555
717
|
*/
|
|
556
718
|
get name() {
|
|
557
719
|
return this.getStorageProperty("name") || this.defaultName;
|
|
@@ -565,7 +727,7 @@ var LocationBaseModel = class extends import_pixi_vn3.StoredClassModel {
|
|
|
565
727
|
get disabled() {
|
|
566
728
|
let value = this.getStorageProperty("disabled") || this.defaultDisabled;
|
|
567
729
|
if (typeof value === "string") {
|
|
568
|
-
return (0,
|
|
730
|
+
return (0, import_pixi_vn4.getFlag)(value);
|
|
569
731
|
}
|
|
570
732
|
return value;
|
|
571
733
|
}
|
|
@@ -578,7 +740,7 @@ var LocationBaseModel = class extends import_pixi_vn3.StoredClassModel {
|
|
|
578
740
|
get hidden() {
|
|
579
741
|
let value = this.getStorageProperty("hidden") || this.defaultHidden;
|
|
580
742
|
if (typeof value === "string") {
|
|
581
|
-
return (0,
|
|
743
|
+
return (0, import_pixi_vn4.getFlag)(value);
|
|
582
744
|
}
|
|
583
745
|
return value;
|
|
584
746
|
}
|
|
@@ -629,9 +791,9 @@ var LocationBaseModel = class extends import_pixi_vn3.StoredClassModel {
|
|
|
629
791
|
};
|
|
630
792
|
|
|
631
793
|
// src/classes/navigation/Map.ts
|
|
632
|
-
var
|
|
794
|
+
var import_pixi_vn5 = require("@drincs/pixi-vn");
|
|
633
795
|
var MAP_CATEGORY = "__nqtr-map__";
|
|
634
|
-
var MapBaseModel = class extends
|
|
796
|
+
var MapBaseModel = class extends import_pixi_vn5.StoredClassModel {
|
|
635
797
|
/**
|
|
636
798
|
* @param id The id of the map, it must be unique.
|
|
637
799
|
* @param props The properties of the map.
|
|
@@ -645,7 +807,7 @@ var MapBaseModel = class extends import_pixi_vn4.StoredClassModel {
|
|
|
645
807
|
}
|
|
646
808
|
/**
|
|
647
809
|
* The name of the map.
|
|
648
|
-
* If you set undefined, it will return the
|
|
810
|
+
* If you set undefined, it will return the initial value of name.
|
|
649
811
|
*/
|
|
650
812
|
get name() {
|
|
651
813
|
return this.getStorageProperty("name") || this.defaultName;
|
|
@@ -655,7 +817,7 @@ var MapBaseModel = class extends import_pixi_vn4.StoredClassModel {
|
|
|
655
817
|
}
|
|
656
818
|
/**
|
|
657
819
|
* The image of the map. It can be a string, an Element or a Pixi'VN Canvas Item.
|
|
658
|
-
* If you set undefined, it will return the
|
|
820
|
+
* If you set undefined, it will return the initial value of image.
|
|
659
821
|
*/
|
|
660
822
|
get image() {
|
|
661
823
|
return this.getStorageProperty("image") || this.defaultImage;
|
|
@@ -669,7 +831,7 @@ var MapBaseModel = class extends import_pixi_vn4.StoredClassModel {
|
|
|
669
831
|
get disabled() {
|
|
670
832
|
let value = this.getStorageProperty("disabled") || this.defaultDisabled;
|
|
671
833
|
if (typeof value === "string") {
|
|
672
|
-
return (0,
|
|
834
|
+
return (0, import_pixi_vn5.getFlag)(value);
|
|
673
835
|
}
|
|
674
836
|
return value;
|
|
675
837
|
}
|
|
@@ -682,13 +844,22 @@ var MapBaseModel = class extends import_pixi_vn4.StoredClassModel {
|
|
|
682
844
|
get hidden() {
|
|
683
845
|
let value = this.getStorageProperty("hidden") || this.defaultHidden;
|
|
684
846
|
if (typeof value === "string") {
|
|
685
|
-
return (0,
|
|
847
|
+
return (0, import_pixi_vn5.getFlag)(value);
|
|
686
848
|
}
|
|
687
849
|
return value;
|
|
688
850
|
}
|
|
689
851
|
set hidden(value) {
|
|
690
852
|
this.setStorageProperty("hidden", value);
|
|
691
853
|
}
|
|
854
|
+
/**
|
|
855
|
+
* The neighboring maps that are available in this map.
|
|
856
|
+
*/
|
|
857
|
+
get neighboringMaps() {
|
|
858
|
+
return this._neighboringMaps || {};
|
|
859
|
+
}
|
|
860
|
+
set neighboringMaps(value) {
|
|
861
|
+
this._neighboringMaps = value;
|
|
862
|
+
}
|
|
692
863
|
/**
|
|
693
864
|
* Get all locations in the map.
|
|
694
865
|
* @returns The locations in the map.
|
|
@@ -699,7 +870,7 @@ var MapBaseModel = class extends import_pixi_vn4.StoredClassModel {
|
|
|
699
870
|
};
|
|
700
871
|
|
|
701
872
|
// src/classes/navigation/Room.ts
|
|
702
|
-
var
|
|
873
|
+
var import_pixi_vn7 = require("@drincs/pixi-vn");
|
|
703
874
|
|
|
704
875
|
// src/decorators/ActivityDecorator.ts
|
|
705
876
|
var registeredActivities = {};
|
|
@@ -728,7 +899,7 @@ function getActivityById(id) {
|
|
|
728
899
|
}
|
|
729
900
|
|
|
730
901
|
// src/decorators/CommitmentDecorator.ts
|
|
731
|
-
var
|
|
902
|
+
var import_pixi_vn6 = require("@drincs/pixi-vn");
|
|
732
903
|
var TEMPORARY_COMMITMENT_CATEGORY_MEMORY_KEY = "___nqtr-temporary_commitment___";
|
|
733
904
|
var registeredCommitments = {};
|
|
734
905
|
var fixedCommitments = {};
|
|
@@ -777,13 +948,13 @@ function addTemporaryCommitment(commitment) {
|
|
|
777
948
|
}
|
|
778
949
|
return commitment2.id;
|
|
779
950
|
}).filter((id) => id !== void 0);
|
|
780
|
-
|
|
951
|
+
import_pixi_vn6.GameStorageManager.setVariable(TEMPORARY_COMMITMENT_CATEGORY_MEMORY_KEY, [commitmentsIds]);
|
|
781
952
|
}
|
|
782
953
|
function getFixedCommitments() {
|
|
783
954
|
return Object.values(fixedCommitments);
|
|
784
955
|
}
|
|
785
956
|
function getTemporaryCommitments() {
|
|
786
|
-
let commitmentsIds =
|
|
957
|
+
let commitmentsIds = import_pixi_vn6.GameStorageManager.getVariable(TEMPORARY_COMMITMENT_CATEGORY_MEMORY_KEY);
|
|
787
958
|
if (!commitmentsIds) {
|
|
788
959
|
return [];
|
|
789
960
|
}
|
|
@@ -889,7 +1060,7 @@ var ActivityRoom = class extends ActivityStoredAbstract {
|
|
|
889
1060
|
|
|
890
1061
|
// src/classes/navigation/Room.ts
|
|
891
1062
|
var ROOM_CATEGORY = "__nqtr-room__";
|
|
892
|
-
var RoomBaseModel = class extends
|
|
1063
|
+
var RoomBaseModel = class extends import_pixi_vn7.StoredClassModel {
|
|
893
1064
|
/**
|
|
894
1065
|
* @param id The id of the room, it must be unique.
|
|
895
1066
|
* @param location The location where the room is.
|
|
@@ -921,7 +1092,7 @@ var RoomBaseModel = class extends import_pixi_vn6.StoredClassModel {
|
|
|
921
1092
|
}
|
|
922
1093
|
/**
|
|
923
1094
|
* The name.
|
|
924
|
-
* If you set undefined, it will return the
|
|
1095
|
+
* If you set undefined, it will return the initial value of name.
|
|
925
1096
|
*/
|
|
926
1097
|
get name() {
|
|
927
1098
|
return this.getStorageProperty("name") || this.defaultName;
|
|
@@ -931,7 +1102,7 @@ var RoomBaseModel = class extends import_pixi_vn6.StoredClassModel {
|
|
|
931
1102
|
}
|
|
932
1103
|
/**
|
|
933
1104
|
* The image. It can be a string, an Element or a Pixi'VN Canvas Item.
|
|
934
|
-
* If you set undefined, it will return the
|
|
1105
|
+
* If you set undefined, it will return the initial value of image.
|
|
935
1106
|
*/
|
|
936
1107
|
get image() {
|
|
937
1108
|
return this.getStorageProperty("image") || this.defaultImage;
|
|
@@ -1074,7 +1245,7 @@ var RoomBaseModel = class extends import_pixi_vn6.StoredClassModel {
|
|
|
1074
1245
|
get disabled() {
|
|
1075
1246
|
let value = this.getStorageProperty("disabled") || this.defaultDisabled;
|
|
1076
1247
|
if (typeof value === "string") {
|
|
1077
|
-
return (0,
|
|
1248
|
+
return (0, import_pixi_vn7.getFlag)(value);
|
|
1078
1249
|
}
|
|
1079
1250
|
return value;
|
|
1080
1251
|
}
|
|
@@ -1087,7 +1258,7 @@ var RoomBaseModel = class extends import_pixi_vn6.StoredClassModel {
|
|
|
1087
1258
|
get hidden() {
|
|
1088
1259
|
let value = this.getStorageProperty("hidden") || this.defaultHidden;
|
|
1089
1260
|
if (typeof value === "string") {
|
|
1090
|
-
return (0,
|
|
1261
|
+
return (0, import_pixi_vn7.getFlag)(value);
|
|
1091
1262
|
}
|
|
1092
1263
|
return value;
|
|
1093
1264
|
}
|
|
@@ -1136,9 +1307,9 @@ var Goal = class {
|
|
|
1136
1307
|
};
|
|
1137
1308
|
|
|
1138
1309
|
// src/classes/quest/Quest.ts
|
|
1139
|
-
var
|
|
1310
|
+
var import_pixi_vn8 = require("@drincs/pixi-vn");
|
|
1140
1311
|
var QUEST_CATEGORY = "__nqtr-quest__";
|
|
1141
|
-
var QuestBaseModel = class extends
|
|
1312
|
+
var QuestBaseModel = class extends import_pixi_vn8.StoredClassModel {
|
|
1142
1313
|
constructor(id, stages, props) {
|
|
1143
1314
|
super(QUEST_CATEGORY, id);
|
|
1144
1315
|
this._stages = stages;
|
|
@@ -1169,9 +1340,9 @@ var QuestBaseModel = class extends import_pixi_vn7.StoredClassModel {
|
|
|
1169
1340
|
};
|
|
1170
1341
|
|
|
1171
1342
|
// src/classes/quest/Stage.ts
|
|
1172
|
-
var
|
|
1343
|
+
var import_pixi_vn9 = require("@drincs/pixi-vn");
|
|
1173
1344
|
var STAGE_CATEGORY = "__nqtr-stage__";
|
|
1174
|
-
var StageBaseModel = class extends
|
|
1345
|
+
var StageBaseModel = class extends import_pixi_vn9.StoredClassModel {
|
|
1175
1346
|
constructor(id, props) {
|
|
1176
1347
|
super(STAGE_CATEGORY, id);
|
|
1177
1348
|
this._completed = false;
|
|
@@ -1237,15 +1408,8 @@ var StageBaseModel = class extends import_pixi_vn8.StoredClassModel {
|
|
|
1237
1408
|
}
|
|
1238
1409
|
};
|
|
1239
1410
|
|
|
1240
|
-
// src/enums/ExecutionTypeEnum.ts
|
|
1241
|
-
var ExecutionTypeEnum = /* @__PURE__ */ ((ExecutionTypeEnum2) => {
|
|
1242
|
-
ExecutionTypeEnum2["AUTOMATIC"] = "automatic";
|
|
1243
|
-
ExecutionTypeEnum2["INTERACTION"] = "interaction";
|
|
1244
|
-
return ExecutionTypeEnum2;
|
|
1245
|
-
})(ExecutionTypeEnum || {});
|
|
1246
|
-
|
|
1247
1411
|
// src/functions/NavigationFunctions.ts
|
|
1248
|
-
var
|
|
1412
|
+
var import_pixi_vn10 = require("@drincs/pixi-vn");
|
|
1249
1413
|
var CURRENT_ROOM_MEMORY_KEY = "___nqtr-current_room_memory___";
|
|
1250
1414
|
function setCurrentRoom(room) {
|
|
1251
1415
|
if (room instanceof LocationBaseModel) {
|
|
@@ -1265,7 +1429,7 @@ function setCurrentRoom(room) {
|
|
|
1265
1429
|
localStorage.setItem(CURRENT_ROOM_MEMORY_KEY, room.id);
|
|
1266
1430
|
}
|
|
1267
1431
|
function getCurrentRoom() {
|
|
1268
|
-
let roomId =
|
|
1432
|
+
let roomId = import_pixi_vn10.GameStorageManager.getVariable(CURRENT_ROOM_MEMORY_KEY);
|
|
1269
1433
|
if (!roomId) {
|
|
1270
1434
|
console.error(`[NQTR] The current room has not yet been set`);
|
|
1271
1435
|
return;
|
|
@@ -1308,6 +1472,7 @@ function currentActivities() {
|
|
|
1308
1472
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1309
1473
|
0 && (module.exports = {
|
|
1310
1474
|
ActivityModel,
|
|
1475
|
+
CommitmentBaseModel,
|
|
1311
1476
|
ExecutionTypeEnum,
|
|
1312
1477
|
Goal,
|
|
1313
1478
|
LocationBaseModel,
|