@drincs/nqtr 0.1.18 → 0.1.20
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/{Commitment-DNn_TEgV.d.mts → Commitment-C3Nc2RJH.d.mts} +17 -4
- package/dist/{Commitment-GIA4EK_q.d.ts → Commitment-Cc2kZEy0.d.ts} +17 -4
- package/dist/Quest-BQ1pwvQ_.d.ts +197 -0
- package/dist/Quest-DaNlPBHb.d.mts +197 -0
- package/dist/classes/Commitment.d.mts +2 -2
- package/dist/classes/Commitment.d.ts +2 -2
- package/dist/classes/Commitment.js +12 -1
- package/dist/classes/Commitment.js.map +1 -1
- package/dist/classes/Commitment.mjs +12 -1
- package/dist/classes/Commitment.mjs.map +1 -1
- package/dist/classes/index.d.mts +4 -4
- package/dist/classes/index.d.ts +4 -4
- package/dist/classes/index.js +514 -313
- package/dist/classes/index.js.map +1 -1
- package/dist/classes/index.mjs +512 -312
- package/dist/classes/index.mjs.map +1 -1
- package/dist/classes/navigation/ActivityRoom.d.mts +2 -2
- package/dist/classes/navigation/ActivityRoom.d.ts +2 -2
- package/dist/classes/navigation/ActivityRoom.js +1 -1
- package/dist/classes/navigation/ActivityRoom.js.map +1 -1
- package/dist/classes/navigation/ActivityRoom.mjs +1 -1
- package/dist/classes/navigation/ActivityRoom.mjs.map +1 -1
- package/dist/classes/navigation/Location.d.mts +2 -2
- package/dist/classes/navigation/Location.d.ts +2 -2
- package/dist/classes/navigation/Location.js.map +1 -1
- package/dist/classes/navigation/Location.mjs.map +1 -1
- package/dist/classes/navigation/Map.d.mts +2 -2
- package/dist/classes/navigation/Map.d.ts +2 -2
- package/dist/classes/navigation/Map.js.map +1 -1
- package/dist/classes/navigation/Map.mjs.map +1 -1
- package/dist/classes/navigation/Room.d.mts +2 -2
- package/dist/classes/navigation/Room.d.ts +2 -2
- package/dist/classes/navigation/Room.js +15 -15
- package/dist/classes/navigation/Room.js.map +1 -1
- package/dist/classes/navigation/Room.mjs +15 -15
- package/dist/classes/navigation/Room.mjs.map +1 -1
- package/dist/classes/quest/Goal.d.mts +21 -13
- package/dist/classes/quest/Goal.d.ts +21 -13
- package/dist/classes/quest/Goal.js +50 -15
- package/dist/classes/quest/Goal.js.map +1 -1
- package/dist/classes/quest/Goal.mjs +47 -15
- package/dist/classes/quest/Goal.mjs.map +1 -1
- package/dist/classes/quest/Quest.d.mts +3 -2
- package/dist/classes/quest/Quest.d.ts +3 -2
- package/dist/classes/quest/Quest.js +536 -9
- package/dist/classes/quest/Quest.js.map +1 -1
- package/dist/classes/quest/Quest.mjs +537 -10
- package/dist/classes/quest/Quest.mjs.map +1 -1
- package/dist/classes/quest/Stage.d.mts +3 -2
- package/dist/classes/quest/Stage.d.ts +3 -2
- package/dist/classes/quest/Stage.js +396 -51
- package/dist/classes/quest/Stage.js.map +1 -1
- package/dist/classes/quest/Stage.mjs +394 -52
- package/dist/classes/quest/Stage.mjs.map +1 -1
- package/dist/decorators/ActivityDecorator.d.mts +1 -1
- package/dist/decorators/ActivityDecorator.d.ts +1 -1
- package/dist/decorators/ActivityDecorator.js.map +1 -1
- package/dist/decorators/ActivityDecorator.mjs.map +1 -1
- package/dist/decorators/CommitmentDecorator.d.mts +32 -6
- package/dist/decorators/CommitmentDecorator.d.ts +32 -6
- package/dist/decorators/CommitmentDecorator.js +7 -7
- package/dist/decorators/CommitmentDecorator.js.map +1 -1
- package/dist/decorators/CommitmentDecorator.mjs +5 -5
- package/dist/decorators/CommitmentDecorator.mjs.map +1 -1
- package/dist/decorators/QuestDecorator.d.mts +28 -0
- package/dist/decorators/QuestDecorator.d.ts +28 -0
- package/dist/decorators/QuestDecorator.js +33 -0
- package/dist/decorators/QuestDecorator.js.map +1 -0
- package/dist/decorators/QuestDecorator.mjs +29 -0
- package/dist/decorators/QuestDecorator.mjs.map +1 -0
- package/dist/decorators/RoomDecorator.d.mts +3 -3
- package/dist/decorators/RoomDecorator.d.ts +3 -3
- package/dist/decorators/RoomDecorator.js.map +1 -1
- package/dist/decorators/RoomDecorator.mjs.map +1 -1
- package/dist/decorators/index.d.mts +8 -3
- package/dist/decorators/index.d.ts +8 -3
- package/dist/decorators/index.js +30 -15
- package/dist/decorators/index.js.map +1 -1
- package/dist/decorators/index.mjs +27 -12
- package/dist/decorators/index.mjs.map +1 -1
- package/dist/functions/ActivityFunctions.d.mts +2 -2
- package/dist/functions/ActivityFunctions.d.ts +2 -2
- package/dist/functions/ActivityFunctions.js.map +1 -1
- package/dist/functions/ActivityFunctions.mjs.map +1 -1
- package/dist/functions/NavigationFunctions.d.mts +2 -2
- package/dist/functions/NavigationFunctions.d.ts +2 -2
- package/dist/functions/NavigationFunctions.js.map +1 -1
- package/dist/functions/NavigationFunctions.mjs.map +1 -1
- package/dist/functions/RoutineFunctions.d.mts +21 -4
- package/dist/functions/RoutineFunctions.d.ts +21 -4
- package/dist/functions/RoutineFunctions.js +16 -16
- package/dist/functions/RoutineFunctions.js.map +1 -1
- package/dist/functions/RoutineFunctions.mjs +16 -16
- package/dist/functions/RoutineFunctions.mjs.map +1 -1
- package/dist/functions/index.d.mts +3 -3
- package/dist/functions/index.d.ts +3 -3
- package/dist/functions/index.js +16 -16
- package/dist/functions/index.js.map +1 -1
- package/dist/functions/index.mjs +16 -16
- package/dist/functions/index.mjs.map +1 -1
- package/dist/index.d.mts +7 -6
- package/dist/index.d.ts +7 -6
- package/dist/index.js +543 -326
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +536 -319
- package/dist/index.mjs.map +1 -1
- package/dist/interface/CommitmentProps.d.mts +2 -2
- package/dist/interface/CommitmentProps.d.ts +2 -2
- package/dist/interface/RoomProps.d.mts +2 -2
- package/dist/interface/RoomProps.d.ts +2 -2
- package/dist/interface/index.d.mts +4 -4
- package/dist/interface/index.d.ts +4 -4
- package/dist/interface/navigation/LocationProps.d.mts +2 -2
- package/dist/interface/navigation/LocationProps.d.ts +2 -2
- package/dist/interface/navigation/MapProps.d.mts +2 -2
- package/dist/interface/navigation/MapProps.d.ts +2 -2
- package/dist/interface/quest/GoalProps.d.mts +12 -0
- package/dist/interface/quest/GoalProps.d.ts +12 -0
- package/dist/interface/quest/QuestProps.d.mts +6 -9
- package/dist/interface/quest/QuestProps.d.ts +6 -9
- package/dist/interface/quest/StageFlags.d.mts +12 -0
- package/dist/interface/quest/StageFlags.d.ts +12 -0
- package/dist/interface/quest/StageFlags.js +4 -0
- package/dist/interface/quest/StageFlags.js.map +1 -0
- package/dist/interface/quest/StageFlags.mjs +3 -0
- package/dist/interface/quest/StageFlags.mjs.map +1 -0
- package/dist/interface/quest/StageProps.d.mts +3 -2
- package/dist/interface/quest/StageProps.d.ts +3 -2
- package/dist/override/OnEndStage.d.mts +19 -0
- package/dist/override/OnEndStage.d.ts +19 -0
- package/dist/override/OnEndStage.js +4 -0
- package/dist/override/OnEndStage.js.map +1 -0
- package/dist/override/OnEndStage.mjs +3 -0
- package/dist/override/OnEndStage.mjs.map +1 -0
- package/dist/override/OnStartStage.d.mts +19 -0
- package/dist/override/OnStartStage.d.ts +19 -0
- package/dist/override/OnStartStage.js +4 -0
- package/dist/override/OnStartStage.js.map +1 -0
- package/dist/override/OnStartStage.mjs +3 -0
- package/dist/override/OnStartStage.mjs.map +1 -0
- package/dist/override/index.d.mts +2 -0
- package/dist/override/index.d.ts +2 -0
- package/dist/types/ExecutionType.d.mts +3 -0
- package/dist/types/ExecutionType.d.ts +3 -0
- package/dist/types/ExecutionType.js +4 -0
- package/dist/types/ExecutionType.js.map +1 -0
- package/dist/types/ExecutionType.mjs +3 -0
- package/dist/types/ExecutionType.mjs.map +1 -0
- package/dist/types/QuestsRequired.d.mts +3 -2
- package/dist/types/QuestsRequired.d.ts +3 -2
- package/dist/types/index.d.mts +4 -2
- package/dist/types/index.d.ts +4 -2
- package/package.json +1 -1
- package/dist/Quest-Bdm0R9LA.d.mts +0 -71
- package/dist/Quest-CxJcXETG.d.ts +0 -71
- package/dist/enums/ExecutionTypeEnum.d.mts +0 -6
- package/dist/enums/ExecutionTypeEnum.d.ts +0 -6
- package/dist/enums/ExecutionTypeEnum.js +0 -12
- package/dist/enums/ExecutionTypeEnum.js.map +0 -1
- package/dist/enums/ExecutionTypeEnum.mjs +0 -10
- package/dist/enums/ExecutionTypeEnum.mjs.map +0 -1
- package/dist/enums/index.d.mts +0 -1
- package/dist/enums/index.d.ts +0 -1
- package/dist/enums/index.js +0 -12
- package/dist/enums/index.js.map +0 -1
- package/dist/enums/index.mjs +0 -10
- package/dist/enums/index.mjs.map +0 -1
package/dist/index.js
CHANGED
|
@@ -391,15 +391,6 @@ var ActivityModel = class {
|
|
|
391
391
|
};
|
|
392
392
|
}
|
|
393
393
|
};
|
|
394
|
-
|
|
395
|
-
// src/enums/ExecutionTypeEnum.ts
|
|
396
|
-
var ExecutionTypeEnum = /* @__PURE__ */ ((ExecutionTypeEnum2) => {
|
|
397
|
-
ExecutionTypeEnum2["AUTOMATIC"] = "automatic";
|
|
398
|
-
ExecutionTypeEnum2["INTERACTION"] = "interaction";
|
|
399
|
-
return ExecutionTypeEnum2;
|
|
400
|
-
})(ExecutionTypeEnum || {});
|
|
401
|
-
|
|
402
|
-
// src/classes/Commitment.ts
|
|
403
394
|
var COMMITMENT_CATEGORY = "__nqtr-commitment__";
|
|
404
395
|
var CommitmentBaseModel = class extends pixiVn.StoredClassModel {
|
|
405
396
|
/**
|
|
@@ -418,11 +409,12 @@ var CommitmentBaseModel = class extends pixiVn.StoredClassModel {
|
|
|
418
409
|
this.defaultFromDay = props.fromDay;
|
|
419
410
|
this.defaultToDay = props.toDay;
|
|
420
411
|
this._renderImage = props.renderImage;
|
|
421
|
-
this._executionType = props.executionType || "interaction"
|
|
412
|
+
this._executionType = props.executionType || "interaction";
|
|
422
413
|
this._onRun = props.onRun;
|
|
423
414
|
this.defaultDisabled = props.disabled || false;
|
|
424
415
|
this.defaultHidden = props.hidden || false;
|
|
425
416
|
this._renderIcon = props.renderIcon;
|
|
417
|
+
this.defaultPriority = props.priority || 0;
|
|
426
418
|
}
|
|
427
419
|
/**
|
|
428
420
|
* The character or characters that are in the commitment and so in the room.
|
|
@@ -564,6 +556,16 @@ var CommitmentBaseModel = class extends pixiVn.StoredClassModel {
|
|
|
564
556
|
set hidden(value) {
|
|
565
557
|
this.setStorageProperty("hidden", value);
|
|
566
558
|
}
|
|
559
|
+
/**
|
|
560
|
+
* The priority. The higher the number, the higher the priority.
|
|
561
|
+
* To ensure that a character is not in 2 places at the same time, if there are 2 or more valid commits at the same time and with the same character, the one with the highest priority will be chosen.
|
|
562
|
+
*/
|
|
563
|
+
get priority() {
|
|
564
|
+
return this.getStorageProperty("priority") || this.defaultPriority || 0;
|
|
565
|
+
}
|
|
566
|
+
set priority(value) {
|
|
567
|
+
this.setStorageProperty("priority", value);
|
|
568
|
+
}
|
|
567
569
|
/**
|
|
568
570
|
* Whether the commitment is expired.
|
|
569
571
|
* @returns Whether the commitment is expired.
|
|
@@ -575,6 +577,199 @@ var CommitmentBaseModel = class extends pixiVn.StoredClassModel {
|
|
|
575
577
|
return false;
|
|
576
578
|
}
|
|
577
579
|
};
|
|
580
|
+
var ActivityStoredAbstract = class {
|
|
581
|
+
/**
|
|
582
|
+
* @param onRun The function that is called when the activity is runned. Have 2 parameters: the runned activity and the yourParams object, that is an object with the parameters that you want to pass to the onRun function.
|
|
583
|
+
* @param props The activity properties.
|
|
584
|
+
*/
|
|
585
|
+
constructor(onRun, props) {
|
|
586
|
+
this.defaultName = props.name;
|
|
587
|
+
this.defaultFromHour = props.fromHour;
|
|
588
|
+
this.defaultToHour = props.toHour;
|
|
589
|
+
this.defaultFromDay = props.fromDay;
|
|
590
|
+
this.defaultToDay = props.toDay;
|
|
591
|
+
this.defaultDisabled = props.disabled || false;
|
|
592
|
+
this.defaultHidden = props.hidden || false;
|
|
593
|
+
this._renderIcon = props.renderIcon;
|
|
594
|
+
this._onRun = onRun;
|
|
595
|
+
}
|
|
596
|
+
/**
|
|
597
|
+
* The name
|
|
598
|
+
*/
|
|
599
|
+
get name() {
|
|
600
|
+
return this.getStorageProperty("name") || this.defaultName || "";
|
|
601
|
+
}
|
|
602
|
+
set name(value) {
|
|
603
|
+
this.setStorageProperty("name", value);
|
|
604
|
+
}
|
|
605
|
+
/**
|
|
606
|
+
* The hour when the activity starts. If the activity is not started yet, it will be hidden.
|
|
607
|
+
*/
|
|
608
|
+
get fromHour() {
|
|
609
|
+
return this.getStorageProperty("fromHour") || this.defaultFromHour || TimeManager.minDayHours;
|
|
610
|
+
}
|
|
611
|
+
set fromHour(value) {
|
|
612
|
+
this.setStorageProperty("fromHour", value);
|
|
613
|
+
}
|
|
614
|
+
/**
|
|
615
|
+
* The hour when the activity ends. If the activity is ended yet, it will be hidden.
|
|
616
|
+
*/
|
|
617
|
+
get toHour() {
|
|
618
|
+
return this.getStorageProperty("toHour") || this.defaultToHour || TimeManager.maxDayHours + 1;
|
|
619
|
+
}
|
|
620
|
+
set toHour(value) {
|
|
621
|
+
this.setStorageProperty("toHour", value);
|
|
622
|
+
}
|
|
623
|
+
/**
|
|
624
|
+
* The day when the activity starts. If the activity is not started yet, it will be hidden.
|
|
625
|
+
*/
|
|
626
|
+
get fromDay() {
|
|
627
|
+
return this.getStorageProperty("fromDay") || this.defaultFromDay;
|
|
628
|
+
}
|
|
629
|
+
set fromDay(value) {
|
|
630
|
+
this.setStorageProperty("fromDay", value);
|
|
631
|
+
}
|
|
632
|
+
/**
|
|
633
|
+
* The day when the activity ends. If the activity is ended yet, it will be deleted or hidden.
|
|
634
|
+
*/
|
|
635
|
+
get toDay() {
|
|
636
|
+
return this.getStorageProperty("toDay") || this.defaultToDay;
|
|
637
|
+
}
|
|
638
|
+
set toDay(value) {
|
|
639
|
+
this.setStorageProperty("toDay", value);
|
|
640
|
+
}
|
|
641
|
+
/**
|
|
642
|
+
* Whether is disabled.
|
|
643
|
+
*/
|
|
644
|
+
get disabled() {
|
|
645
|
+
let value = this.getStorageProperty("disabled") || this.defaultDisabled;
|
|
646
|
+
if (typeof value === "string") {
|
|
647
|
+
return pixiVn.getFlag(value);
|
|
648
|
+
}
|
|
649
|
+
return value;
|
|
650
|
+
}
|
|
651
|
+
set disabled(value) {
|
|
652
|
+
this.setStorageProperty("disabled", value);
|
|
653
|
+
}
|
|
654
|
+
/**
|
|
655
|
+
* Whether is hidden. If the activity is not started yet, it will be hidden.
|
|
656
|
+
*/
|
|
657
|
+
get hidden() {
|
|
658
|
+
if (this.fromDay && this.fromDay > TimeManager.currentDay) {
|
|
659
|
+
return true;
|
|
660
|
+
}
|
|
661
|
+
if (!TimeManager.nowIsBetween(this.fromHour, this.toHour)) {
|
|
662
|
+
return true;
|
|
663
|
+
}
|
|
664
|
+
if (!this.isExpired) {
|
|
665
|
+
return true;
|
|
666
|
+
}
|
|
667
|
+
let value = this.getStorageProperty("hidden") || this.defaultHidden;
|
|
668
|
+
if (typeof value === "string") {
|
|
669
|
+
return pixiVn.getFlag(value);
|
|
670
|
+
}
|
|
671
|
+
return value;
|
|
672
|
+
}
|
|
673
|
+
set hidden(value) {
|
|
674
|
+
this.setStorageProperty("hidden", value);
|
|
675
|
+
}
|
|
676
|
+
/**
|
|
677
|
+
* The function for rendering the icon of the activity.
|
|
678
|
+
*/
|
|
679
|
+
get renderIcon() {
|
|
680
|
+
let render = this._renderIcon;
|
|
681
|
+
if (render === void 0) {
|
|
682
|
+
return void 0;
|
|
683
|
+
}
|
|
684
|
+
if (typeof render === "function") {
|
|
685
|
+
return (props) => {
|
|
686
|
+
return render(this, props);
|
|
687
|
+
};
|
|
688
|
+
}
|
|
689
|
+
return (props) => render;
|
|
690
|
+
}
|
|
691
|
+
/**
|
|
692
|
+
* The function that is called when the activity is runned.
|
|
693
|
+
*/
|
|
694
|
+
get onRun() {
|
|
695
|
+
return (props) => {
|
|
696
|
+
return this._onRun(this, props);
|
|
697
|
+
};
|
|
698
|
+
}
|
|
699
|
+
/**
|
|
700
|
+
* Whether the activity is a deadline.
|
|
701
|
+
* @returns Whether the activity is a deadline.
|
|
702
|
+
*/
|
|
703
|
+
isExpired() {
|
|
704
|
+
if (this.toDay && this.toDay <= TimeManager.currentDay) {
|
|
705
|
+
return true;
|
|
706
|
+
}
|
|
707
|
+
return false;
|
|
708
|
+
}
|
|
709
|
+
/**
|
|
710
|
+
* Export the activity properties.
|
|
711
|
+
* @returns The activity properties.
|
|
712
|
+
*/
|
|
713
|
+
export() {
|
|
714
|
+
return {
|
|
715
|
+
name: this.getStorageProperty("name") || this.defaultName,
|
|
716
|
+
fromHour: this.getStorageProperty("fromHour") || this.defaultFromHour,
|
|
717
|
+
toHour: this.getStorageProperty("toHour") || this.defaultToHour,
|
|
718
|
+
fromDay: this.getStorageProperty("fromDay") || this.defaultFromDay,
|
|
719
|
+
toDay: this.getStorageProperty("toDay") || this.defaultToDay,
|
|
720
|
+
disabled: this.getStorageProperty("disabled") || this.defaultDisabled,
|
|
721
|
+
hidden: this.getStorageProperty("hidden") || this.defaultHidden,
|
|
722
|
+
renderIcon: this._renderIcon
|
|
723
|
+
};
|
|
724
|
+
}
|
|
725
|
+
};
|
|
726
|
+
|
|
727
|
+
// src/classes/navigation/ActivityRoom.ts
|
|
728
|
+
var ActivityRoom = class extends ActivityStoredAbstract {
|
|
729
|
+
constructor(id, room, onRun, props) {
|
|
730
|
+
super(onRun, props);
|
|
731
|
+
this._id = id;
|
|
732
|
+
this._room = room;
|
|
733
|
+
}
|
|
734
|
+
setStorageProperty(_, __) {
|
|
735
|
+
this._room.setActivity(this);
|
|
736
|
+
}
|
|
737
|
+
getStorageProperty(propertyName) {
|
|
738
|
+
let activity = this._room.getActivityMemory(this.id);
|
|
739
|
+
if (!activity || !activity.hasOwnProperty(propertyName)) {
|
|
740
|
+
return void 0;
|
|
741
|
+
}
|
|
742
|
+
return activity[propertyName];
|
|
743
|
+
}
|
|
744
|
+
get id() {
|
|
745
|
+
return this._id;
|
|
746
|
+
}
|
|
747
|
+
get room() {
|
|
748
|
+
return this._room;
|
|
749
|
+
}
|
|
750
|
+
export() {
|
|
751
|
+
let result = {};
|
|
752
|
+
if (this.name !== void 0) {
|
|
753
|
+
result["name"] = this.name;
|
|
754
|
+
}
|
|
755
|
+
if (this.fromHour !== void 0) {
|
|
756
|
+
result["fromHour"] = this.fromHour;
|
|
757
|
+
}
|
|
758
|
+
if (this.toHour !== void 0) {
|
|
759
|
+
result["toHour"] = this.toHour;
|
|
760
|
+
}
|
|
761
|
+
if (this.fromDay !== void 0) {
|
|
762
|
+
result["fromDay"] = this.fromDay;
|
|
763
|
+
}
|
|
764
|
+
if (this.toDay !== void 0) {
|
|
765
|
+
result["toDay"] = this.toDay;
|
|
766
|
+
}
|
|
767
|
+
if (this.disabled !== void 0) {
|
|
768
|
+
result["disabled"] = this.disabled;
|
|
769
|
+
}
|
|
770
|
+
return result;
|
|
771
|
+
}
|
|
772
|
+
};
|
|
578
773
|
|
|
579
774
|
// src/decorators/RoomDecorator.ts
|
|
580
775
|
var registeredRooms = {};
|
|
@@ -867,9 +1062,9 @@ function getCommitmentById(id) {
|
|
|
867
1062
|
return;
|
|
868
1063
|
}
|
|
869
1064
|
}
|
|
870
|
-
function
|
|
1065
|
+
function setFixedRoutine(commitments) {
|
|
871
1066
|
if (Array.isArray(commitments)) {
|
|
872
|
-
commitments.forEach((c) =>
|
|
1067
|
+
commitments.forEach((c) => setFixedRoutine(c));
|
|
873
1068
|
return;
|
|
874
1069
|
}
|
|
875
1070
|
if (fixedCommitments[commitments.id]) {
|
|
@@ -877,7 +1072,7 @@ function setFixedCommitments(commitments) {
|
|
|
877
1072
|
}
|
|
878
1073
|
fixedCommitments[commitments.id] = commitments;
|
|
879
1074
|
}
|
|
880
|
-
function
|
|
1075
|
+
function addCommitment(commitment) {
|
|
881
1076
|
if (!Array.isArray(commitment)) {
|
|
882
1077
|
commitment = [commitment];
|
|
883
1078
|
}
|
|
@@ -891,7 +1086,7 @@ function addTemporaryCommitment(commitment) {
|
|
|
891
1086
|
}).filter((id) => id !== void 0);
|
|
892
1087
|
pixiVn.GameStorageManager.setVariable(TEMPORARY_COMMITMENT_CATEGORY_MEMORY_KEY, [commitmentsIds]);
|
|
893
1088
|
}
|
|
894
|
-
function
|
|
1089
|
+
function getFixedRoutine() {
|
|
895
1090
|
return Object.values(fixedCommitments);
|
|
896
1091
|
}
|
|
897
1092
|
function getTemporaryCommitments() {
|
|
@@ -903,6 +1098,32 @@ function getTemporaryCommitments() {
|
|
|
903
1098
|
return commitments;
|
|
904
1099
|
}
|
|
905
1100
|
|
|
1101
|
+
// src/decorators/QuestDecorator.ts
|
|
1102
|
+
var registeredQuests = {};
|
|
1103
|
+
function saveQuest(quest) {
|
|
1104
|
+
if (Array.isArray(quest)) {
|
|
1105
|
+
quest.forEach((c) => saveQuest(c));
|
|
1106
|
+
return;
|
|
1107
|
+
}
|
|
1108
|
+
if (registeredQuests[quest.id]) {
|
|
1109
|
+
console.warn(`[NQTR] Quest id ${quest.id} already exists, it will be overwritten`);
|
|
1110
|
+
}
|
|
1111
|
+
registeredQuests[quest.id] = quest;
|
|
1112
|
+
}
|
|
1113
|
+
function getQuestById(id) {
|
|
1114
|
+
try {
|
|
1115
|
+
let quest = registeredQuests[id];
|
|
1116
|
+
if (!quest) {
|
|
1117
|
+
console.error(`[NQTR] Quest ${id} not found`);
|
|
1118
|
+
return;
|
|
1119
|
+
}
|
|
1120
|
+
return quest;
|
|
1121
|
+
} catch (e) {
|
|
1122
|
+
console.error(`[NQTR] Error while getting Quest ${id}`, e);
|
|
1123
|
+
return;
|
|
1124
|
+
}
|
|
1125
|
+
}
|
|
1126
|
+
|
|
906
1127
|
// src/functions/RoutineFunctions.ts
|
|
907
1128
|
function clearExpiredRoutine() {
|
|
908
1129
|
Object.entries(registeredCommitments).forEach(([_, commitment]) => {
|
|
@@ -911,271 +1132,78 @@ function clearExpiredRoutine() {
|
|
|
911
1132
|
}
|
|
912
1133
|
});
|
|
913
1134
|
}
|
|
914
|
-
function
|
|
1135
|
+
function getCurrentRoutine() {
|
|
915
1136
|
let character_commitments = {};
|
|
916
|
-
let oltherCommitments = [];
|
|
917
1137
|
getTemporaryCommitments().reverse().forEach((c) => {
|
|
918
1138
|
if (!c.hidden) {
|
|
919
|
-
if (c.characters.length >
|
|
920
|
-
let allAvailable = c.characters.every((ch) => !character_commitments[ch.id]);
|
|
1139
|
+
if (c.characters.length > 0) {
|
|
1140
|
+
let allAvailable = c.characters.every((ch) => !character_commitments[ch.id] || c.priority > character_commitments[ch.id].priority);
|
|
921
1141
|
if (allAvailable) {
|
|
922
1142
|
c.characters.forEach((ch) => {
|
|
923
1143
|
character_commitments[ch.id] = c;
|
|
924
1144
|
});
|
|
925
1145
|
}
|
|
926
1146
|
} else {
|
|
927
|
-
|
|
1147
|
+
console.error(`[NQTR] The commitment ${c.id} has no characters assigned`);
|
|
928
1148
|
}
|
|
929
1149
|
}
|
|
930
1150
|
});
|
|
931
|
-
|
|
1151
|
+
getFixedRoutine().reverse().forEach((c) => {
|
|
932
1152
|
if (!c.hidden) {
|
|
933
|
-
if (c.characters.length >
|
|
934
|
-
c.characters.
|
|
935
|
-
|
|
1153
|
+
if (c.characters.length > 0) {
|
|
1154
|
+
let allAvailable = c.characters.every((ch) => !character_commitments[ch.id] || c.priority > character_commitments[ch.id].priority);
|
|
1155
|
+
if (allAvailable) {
|
|
1156
|
+
c.characters.forEach((ch) => {
|
|
936
1157
|
character_commitments[ch.id] = c;
|
|
937
|
-
}
|
|
938
|
-
}
|
|
1158
|
+
});
|
|
1159
|
+
}
|
|
939
1160
|
} else {
|
|
940
|
-
|
|
1161
|
+
console.error(`[NQTR] The commitment ${c.id} has no characters assigned`);
|
|
941
1162
|
}
|
|
942
1163
|
}
|
|
943
1164
|
});
|
|
944
|
-
return Object.values(character_commitments)
|
|
1165
|
+
return Object.values(character_commitments);
|
|
945
1166
|
}
|
|
946
1167
|
function getCommitmentByCharacter(character) {
|
|
947
|
-
|
|
1168
|
+
getCurrentRoutine().forEach((c) => {
|
|
948
1169
|
if (c.characters.map((ch) => ch.id).includes(character.id)) {
|
|
949
1170
|
return c;
|
|
950
1171
|
}
|
|
951
1172
|
});
|
|
952
1173
|
return void 0;
|
|
953
1174
|
}
|
|
954
|
-
|
|
1175
|
+
|
|
1176
|
+
// src/classes/navigation/Room.ts
|
|
1177
|
+
var ROOM_CATEGORY = "__nqtr-room__";
|
|
1178
|
+
var RoomBaseModel = class extends pixiVn.StoredClassModel {
|
|
955
1179
|
/**
|
|
956
|
-
* @param
|
|
957
|
-
* @param
|
|
1180
|
+
* @param id The id of the room, it must be unique.
|
|
1181
|
+
* @param location The location where the room is.
|
|
1182
|
+
* @param props The properties of the room.
|
|
958
1183
|
*/
|
|
959
|
-
constructor(
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
this.
|
|
963
|
-
this.
|
|
964
|
-
this.
|
|
1184
|
+
constructor(id, location, props = {}) {
|
|
1185
|
+
var _a;
|
|
1186
|
+
super(ROOM_CATEGORY, id);
|
|
1187
|
+
this._location = location;
|
|
1188
|
+
this.defaultName = props.name || "";
|
|
1189
|
+
this._renderImage = props.renderImage;
|
|
1190
|
+
this.defaultActivityIds = ((_a = props.defaultActivities) == null ? void 0 : _a.map((activity) => activity.id)) || [];
|
|
965
1191
|
this.defaultDisabled = props.disabled || false;
|
|
966
1192
|
this.defaultHidden = props.hidden || false;
|
|
967
1193
|
this._renderIcon = props.renderIcon;
|
|
968
|
-
this.
|
|
1194
|
+
this._isEntrance = props.isEntrance;
|
|
969
1195
|
}
|
|
970
1196
|
/**
|
|
971
|
-
* The
|
|
1197
|
+
* The location where the room is.
|
|
972
1198
|
*/
|
|
973
|
-
get
|
|
974
|
-
return this.
|
|
975
|
-
}
|
|
976
|
-
set name(value) {
|
|
977
|
-
this.setStorageProperty("name", value);
|
|
1199
|
+
get location() {
|
|
1200
|
+
return this._location;
|
|
978
1201
|
}
|
|
979
1202
|
/**
|
|
980
|
-
*
|
|
1203
|
+
* Whether is an entrance room, so when the player enters in the location, it will be the first room to be shown.
|
|
981
1204
|
*/
|
|
982
|
-
get
|
|
983
|
-
return this.
|
|
984
|
-
}
|
|
985
|
-
set fromHour(value) {
|
|
986
|
-
this.setStorageProperty("fromHour", value);
|
|
987
|
-
}
|
|
988
|
-
/**
|
|
989
|
-
* The hour when the activity ends. If the activity is ended yet, it will be hidden.
|
|
990
|
-
*/
|
|
991
|
-
get toHour() {
|
|
992
|
-
return this.getStorageProperty("toHour") || this.defaultToHour || TimeManager.maxDayHours + 1;
|
|
993
|
-
}
|
|
994
|
-
set toHour(value) {
|
|
995
|
-
this.setStorageProperty("toHour", value);
|
|
996
|
-
}
|
|
997
|
-
/**
|
|
998
|
-
* The day when the activity starts. If the activity is not started yet, it will be hidden.
|
|
999
|
-
*/
|
|
1000
|
-
get fromDay() {
|
|
1001
|
-
return this.getStorageProperty("fromDay") || this.defaultFromDay;
|
|
1002
|
-
}
|
|
1003
|
-
set fromDay(value) {
|
|
1004
|
-
this.setStorageProperty("fromDay", value);
|
|
1005
|
-
}
|
|
1006
|
-
/**
|
|
1007
|
-
* The day when the activity ends. If the activity is ended yet, it will be deleted or hidden.
|
|
1008
|
-
*/
|
|
1009
|
-
get toDay() {
|
|
1010
|
-
return this.getStorageProperty("toDay") || this.defaultToDay;
|
|
1011
|
-
}
|
|
1012
|
-
set toDay(value) {
|
|
1013
|
-
this.setStorageProperty("toDay", value);
|
|
1014
|
-
}
|
|
1015
|
-
/**
|
|
1016
|
-
* Whether is disabled.
|
|
1017
|
-
*/
|
|
1018
|
-
get disabled() {
|
|
1019
|
-
let value = this.getStorageProperty("disabled") || this.defaultDisabled;
|
|
1020
|
-
if (typeof value === "string") {
|
|
1021
|
-
return pixiVn.getFlag(value);
|
|
1022
|
-
}
|
|
1023
|
-
return value;
|
|
1024
|
-
}
|
|
1025
|
-
set disabled(value) {
|
|
1026
|
-
this.setStorageProperty("disabled", value);
|
|
1027
|
-
}
|
|
1028
|
-
/**
|
|
1029
|
-
* Whether is hidden. If the activity is not started yet, it will be hidden.
|
|
1030
|
-
*/
|
|
1031
|
-
get hidden() {
|
|
1032
|
-
if (this.fromDay && this.fromDay > TimeManager.currentDay) {
|
|
1033
|
-
return true;
|
|
1034
|
-
}
|
|
1035
|
-
if (!TimeManager.nowIsBetween(this.fromHour, this.toHour)) {
|
|
1036
|
-
return true;
|
|
1037
|
-
}
|
|
1038
|
-
if (!this.isExpired) {
|
|
1039
|
-
return true;
|
|
1040
|
-
}
|
|
1041
|
-
let value = this.getStorageProperty("hidden") || this.defaultHidden;
|
|
1042
|
-
if (typeof value === "string") {
|
|
1043
|
-
return pixiVn.getFlag(value);
|
|
1044
|
-
}
|
|
1045
|
-
return value;
|
|
1046
|
-
}
|
|
1047
|
-
set hidden(value) {
|
|
1048
|
-
this.setStorageProperty("hidden", value);
|
|
1049
|
-
}
|
|
1050
|
-
/**
|
|
1051
|
-
* The function for rendering the icon of the activity.
|
|
1052
|
-
*/
|
|
1053
|
-
get renderIcon() {
|
|
1054
|
-
let render = this._renderIcon;
|
|
1055
|
-
if (render === void 0) {
|
|
1056
|
-
return void 0;
|
|
1057
|
-
}
|
|
1058
|
-
if (typeof render === "function") {
|
|
1059
|
-
return (props) => {
|
|
1060
|
-
return render(this, props);
|
|
1061
|
-
};
|
|
1062
|
-
}
|
|
1063
|
-
return (props) => render;
|
|
1064
|
-
}
|
|
1065
|
-
/**
|
|
1066
|
-
* The function that is called when the activity is runned.
|
|
1067
|
-
*/
|
|
1068
|
-
get onRun() {
|
|
1069
|
-
return (props) => {
|
|
1070
|
-
return this._onRun(this, props);
|
|
1071
|
-
};
|
|
1072
|
-
}
|
|
1073
|
-
/**
|
|
1074
|
-
* Whether the activity is a deadline.
|
|
1075
|
-
* @returns Whether the activity is a deadline.
|
|
1076
|
-
*/
|
|
1077
|
-
isExpired() {
|
|
1078
|
-
if (this.toDay && this.toDay <= TimeManager.currentDay) {
|
|
1079
|
-
return true;
|
|
1080
|
-
}
|
|
1081
|
-
return false;
|
|
1082
|
-
}
|
|
1083
|
-
/**
|
|
1084
|
-
* Export the activity properties.
|
|
1085
|
-
* @returns The activity properties.
|
|
1086
|
-
*/
|
|
1087
|
-
export() {
|
|
1088
|
-
return {
|
|
1089
|
-
name: this.getStorageProperty("name") || this.defaultName,
|
|
1090
|
-
fromHour: this.getStorageProperty("fromHour") || this.defaultFromHour,
|
|
1091
|
-
toHour: this.getStorageProperty("toHour") || this.defaultToHour,
|
|
1092
|
-
fromDay: this.getStorageProperty("fromDay") || this.defaultFromDay,
|
|
1093
|
-
toDay: this.getStorageProperty("toDay") || this.defaultToDay,
|
|
1094
|
-
disabled: this.getStorageProperty("disabled") || this.defaultDisabled,
|
|
1095
|
-
hidden: this.getStorageProperty("hidden") || this.defaultHidden,
|
|
1096
|
-
renderIcon: this._renderIcon
|
|
1097
|
-
};
|
|
1098
|
-
}
|
|
1099
|
-
};
|
|
1100
|
-
|
|
1101
|
-
// src/classes/navigation/ActivityRoom.ts
|
|
1102
|
-
var ActivityRoom = class extends ActivityStoredAbstract {
|
|
1103
|
-
constructor(id, room, onRun, props) {
|
|
1104
|
-
super(onRun, props);
|
|
1105
|
-
this._id = id;
|
|
1106
|
-
this._room = room;
|
|
1107
|
-
}
|
|
1108
|
-
setStorageProperty(_, __) {
|
|
1109
|
-
this._room.setActivity(this);
|
|
1110
|
-
}
|
|
1111
|
-
getStorageProperty(propertyName) {
|
|
1112
|
-
let activity = this._room.getActivityMemory(this.id);
|
|
1113
|
-
if (!activity || !activity.hasOwnProperty(propertyName)) {
|
|
1114
|
-
return void 0;
|
|
1115
|
-
}
|
|
1116
|
-
return activity[propertyName];
|
|
1117
|
-
}
|
|
1118
|
-
get id() {
|
|
1119
|
-
return this._id;
|
|
1120
|
-
}
|
|
1121
|
-
get room() {
|
|
1122
|
-
return this._room;
|
|
1123
|
-
}
|
|
1124
|
-
export() {
|
|
1125
|
-
let result = {};
|
|
1126
|
-
if (this.name !== void 0) {
|
|
1127
|
-
result["name"] = this.name;
|
|
1128
|
-
}
|
|
1129
|
-
if (this.fromHour !== void 0) {
|
|
1130
|
-
result["fromHour"] = this.fromHour;
|
|
1131
|
-
}
|
|
1132
|
-
if (this.toHour !== void 0) {
|
|
1133
|
-
result["toHour"] = this.toHour;
|
|
1134
|
-
}
|
|
1135
|
-
if (this.fromDay !== void 0) {
|
|
1136
|
-
result["fromDay"] = this.fromDay;
|
|
1137
|
-
}
|
|
1138
|
-
if (this.toDay !== void 0) {
|
|
1139
|
-
result["toDay"] = this.toDay;
|
|
1140
|
-
}
|
|
1141
|
-
if (this.disabled !== void 0) {
|
|
1142
|
-
result["disabled"] = this.disabled;
|
|
1143
|
-
}
|
|
1144
|
-
return result;
|
|
1145
|
-
}
|
|
1146
|
-
};
|
|
1147
|
-
|
|
1148
|
-
// src/classes/navigation/Room.ts
|
|
1149
|
-
var ROOM_CATEGORY = "__nqtr-room__";
|
|
1150
|
-
var RoomBaseModel = class extends pixiVn.StoredClassModel {
|
|
1151
|
-
/**
|
|
1152
|
-
* @param id The id of the room, it must be unique.
|
|
1153
|
-
* @param location The location where the room is.
|
|
1154
|
-
* @param props The properties of the room.
|
|
1155
|
-
*/
|
|
1156
|
-
constructor(id, location, props = {}) {
|
|
1157
|
-
var _a;
|
|
1158
|
-
super(ROOM_CATEGORY, id);
|
|
1159
|
-
this._location = location;
|
|
1160
|
-
this.defaultName = props.name || "";
|
|
1161
|
-
this._renderImage = props.renderImage;
|
|
1162
|
-
this.defaultActivityIds = ((_a = props.defaultActivities) == null ? void 0 : _a.map((activity) => activity.id)) || [];
|
|
1163
|
-
this.defaultDisabled = props.disabled || false;
|
|
1164
|
-
this.defaultHidden = props.hidden || false;
|
|
1165
|
-
this._renderIcon = props.renderIcon;
|
|
1166
|
-
this._isEntrance = props.isEntrance;
|
|
1167
|
-
}
|
|
1168
|
-
/**
|
|
1169
|
-
* The location where the room is.
|
|
1170
|
-
*/
|
|
1171
|
-
get location() {
|
|
1172
|
-
return this._location;
|
|
1173
|
-
}
|
|
1174
|
-
/**
|
|
1175
|
-
* Whether is an entrance room, so when the player enters in the location, it will be the first room to be shown.
|
|
1176
|
-
*/
|
|
1177
|
-
get isEntrance() {
|
|
1178
|
-
return this._isEntrance || false;
|
|
1205
|
+
get isEntrance() {
|
|
1206
|
+
return this._isEntrance || false;
|
|
1179
1207
|
}
|
|
1180
1208
|
/**
|
|
1181
1209
|
* The name.
|
|
@@ -1377,51 +1405,82 @@ var RoomBaseModel = class extends pixiVn.StoredClassModel {
|
|
|
1377
1405
|
* @returns The character commitments of the room.
|
|
1378
1406
|
*/
|
|
1379
1407
|
getRoutine() {
|
|
1380
|
-
let commitments =
|
|
1408
|
+
let commitments = getCurrentRoutine();
|
|
1381
1409
|
return commitments.filter((c) => c.room.id === this.id);
|
|
1382
1410
|
}
|
|
1383
1411
|
};
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1412
|
+
var GOAL_CATEGORY = "__nqtr-goal__";
|
|
1413
|
+
var Goal = class extends pixiVn.StoredClassModel {
|
|
1414
|
+
constructor(id, props) {
|
|
1415
|
+
super(GOAL_CATEGORY, id);
|
|
1388
1416
|
this._description = props.description;
|
|
1389
|
-
this.
|
|
1390
|
-
this.
|
|
1417
|
+
this._need = props.need || 1;
|
|
1418
|
+
this._defaultHave = props.have || 0;
|
|
1391
1419
|
}
|
|
1420
|
+
/**
|
|
1421
|
+
* The description of the goal.
|
|
1422
|
+
*/
|
|
1392
1423
|
get description() {
|
|
1393
1424
|
return this._description;
|
|
1394
1425
|
}
|
|
1395
|
-
get
|
|
1426
|
+
get need() {
|
|
1427
|
+
return this._need;
|
|
1428
|
+
}
|
|
1429
|
+
get defaultHave() {
|
|
1430
|
+
return this._defaultHave;
|
|
1431
|
+
}
|
|
1432
|
+
};
|
|
1433
|
+
var GoalStage = class extends Goal {
|
|
1434
|
+
constructor(id, stageId, props) {
|
|
1435
|
+
super(id, props);
|
|
1436
|
+
this._stageId = stageId;
|
|
1437
|
+
}
|
|
1438
|
+
get stageId() {
|
|
1439
|
+
return this._stageId;
|
|
1440
|
+
}
|
|
1441
|
+
set stageId(value) {
|
|
1442
|
+
this._stageId = value;
|
|
1443
|
+
}
|
|
1444
|
+
get have() {
|
|
1445
|
+
return this.getStorageProperty("have-" + this._stageId) || this.defaultHave;
|
|
1446
|
+
}
|
|
1447
|
+
set have(value) {
|
|
1448
|
+
if (!this._stageId) {
|
|
1449
|
+
console.error(`[NQTR] The stage id is not set for the goal ${this.id}, so the have value can't be set.`);
|
|
1450
|
+
return;
|
|
1451
|
+
}
|
|
1452
|
+
this.setStorageProperty("have-" + this._stageId, value);
|
|
1453
|
+
}
|
|
1454
|
+
get completed() {
|
|
1396
1455
|
return this.have >= this.need;
|
|
1397
1456
|
}
|
|
1398
|
-
|
|
1399
|
-
|
|
1457
|
+
set completed(value) {
|
|
1458
|
+
if (value) {
|
|
1459
|
+
this.have = this.need;
|
|
1460
|
+
} else {
|
|
1461
|
+
console.warn(`[NQTR] The goal can't be set as not completed. You must edit the have value manually.`);
|
|
1462
|
+
}
|
|
1400
1463
|
}
|
|
1401
1464
|
find() {
|
|
1402
1465
|
this.have++;
|
|
1403
1466
|
}
|
|
1404
|
-
get export() {
|
|
1405
|
-
return {
|
|
1406
|
-
description: this.description,
|
|
1407
|
-
need: this.need,
|
|
1408
|
-
have: this.have
|
|
1409
|
-
};
|
|
1410
|
-
}
|
|
1411
1467
|
};
|
|
1412
|
-
var
|
|
1413
|
-
var
|
|
1414
|
-
constructor(id,
|
|
1415
|
-
super(
|
|
1416
|
-
this._stages = stages;
|
|
1468
|
+
var STAGE_CATEGORY = "__nqtr-stage__";
|
|
1469
|
+
var Stage = class extends pixiVn.StoredClassModel {
|
|
1470
|
+
constructor(id, props) {
|
|
1471
|
+
super(STAGE_CATEGORY, id);
|
|
1417
1472
|
this._name = props.name || "";
|
|
1473
|
+
this._defaultGoals = props.goals || [];
|
|
1474
|
+
this._flags = props.flags || [];
|
|
1418
1475
|
this._description = props.description || "";
|
|
1419
|
-
this.
|
|
1420
|
-
this.
|
|
1421
|
-
this.
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1476
|
+
this._adviceDescription = props.adviceDescription || "";
|
|
1477
|
+
this._renderImage = props.renderImage;
|
|
1478
|
+
this._daysRequiredToStart = props.daysRequiredToStart;
|
|
1479
|
+
this._flagsRequiredToStart = props.flagsRequired || [];
|
|
1480
|
+
this._questsRequiredToStart = props.questsRequired || [];
|
|
1481
|
+
this._requestDescriptionToStart = props.requestDescription || "";
|
|
1482
|
+
this._onStart = props.onStart;
|
|
1483
|
+
this._onEnd = props.onEnd;
|
|
1425
1484
|
}
|
|
1426
1485
|
get name() {
|
|
1427
1486
|
return this._name;
|
|
@@ -1429,50 +1488,138 @@ var QuestBaseModel = class extends pixiVn.StoredClassModel {
|
|
|
1429
1488
|
get description() {
|
|
1430
1489
|
return this._description;
|
|
1431
1490
|
}
|
|
1432
|
-
get
|
|
1433
|
-
return this.
|
|
1491
|
+
get adviceDescription() {
|
|
1492
|
+
return this._adviceDescription;
|
|
1434
1493
|
}
|
|
1435
|
-
|
|
1436
|
-
|
|
1494
|
+
/**
|
|
1495
|
+
* The function for rendering the image of the stage.
|
|
1496
|
+
*/
|
|
1497
|
+
get renderImage() {
|
|
1498
|
+
let render = this._renderImage;
|
|
1499
|
+
if (render === void 0) {
|
|
1500
|
+
return void 0;
|
|
1501
|
+
}
|
|
1502
|
+
if (typeof render === "function") {
|
|
1503
|
+
return (props) => {
|
|
1504
|
+
return render(this, props);
|
|
1505
|
+
};
|
|
1506
|
+
}
|
|
1507
|
+
return (props) => render;
|
|
1437
1508
|
}
|
|
1438
|
-
get
|
|
1439
|
-
return this.
|
|
1509
|
+
get defaultGoals() {
|
|
1510
|
+
return this._defaultGoals;
|
|
1511
|
+
}
|
|
1512
|
+
/**
|
|
1513
|
+
* The list of flags that the player must complete to finish the stage.
|
|
1514
|
+
*/
|
|
1515
|
+
get flags() {
|
|
1516
|
+
return this._flags;
|
|
1517
|
+
}
|
|
1518
|
+
get daysRequiredToStart() {
|
|
1519
|
+
return this._daysRequiredToStart || 0;
|
|
1520
|
+
}
|
|
1521
|
+
get flagsRequiredToStart() {
|
|
1522
|
+
return this._flagsRequiredToStart;
|
|
1523
|
+
}
|
|
1524
|
+
get questsRequiredToStart() {
|
|
1525
|
+
return this._questsRequiredToStart || [];
|
|
1526
|
+
}
|
|
1527
|
+
get requestDescriptionToStart() {
|
|
1528
|
+
return this._requestDescriptionToStart;
|
|
1529
|
+
}
|
|
1530
|
+
get onStart() {
|
|
1531
|
+
return this._onStart;
|
|
1532
|
+
}
|
|
1533
|
+
get onEnd() {
|
|
1534
|
+
return this._onEnd;
|
|
1440
1535
|
}
|
|
1441
1536
|
};
|
|
1442
|
-
var
|
|
1443
|
-
var StageBaseModel = class extends pixiVn.StoredClassModel {
|
|
1537
|
+
var StageQuest = class extends Stage {
|
|
1444
1538
|
constructor(id, props) {
|
|
1445
|
-
super(
|
|
1446
|
-
this._completed = false;
|
|
1447
|
-
this._active = false;
|
|
1448
|
-
this.defaultGoals = [];
|
|
1449
|
-
this._name = props.name || "";
|
|
1450
|
-
this._description = props.description || "";
|
|
1451
|
-
this._adviceDescription = props.adviceDescription || "";
|
|
1452
|
-
this._image = props.image || "";
|
|
1453
|
-
this._daysRequiredToStart = props.daysRequiredToStart;
|
|
1454
|
-
this._flagsRequired = props.flagsRequired;
|
|
1455
|
-
this._questsRequired = props.questsRequired;
|
|
1456
|
-
this._requestDescription = props.requestDescription || "";
|
|
1457
|
-
this._onStart = props.onStart;
|
|
1458
|
-
this._onEnd = props.onEnd;
|
|
1539
|
+
super(id, props);
|
|
1459
1540
|
}
|
|
1460
1541
|
get completed() {
|
|
1461
|
-
|
|
1542
|
+
let storedCompleted = this.getStorageProperty("completed");
|
|
1543
|
+
if (storedCompleted) {
|
|
1544
|
+
return storedCompleted;
|
|
1545
|
+
}
|
|
1546
|
+
if (!this.flags.every((flag) => pixiVn.getFlag(flag.flag))) {
|
|
1547
|
+
return false;
|
|
1548
|
+
}
|
|
1549
|
+
if (!this.goals.every((goal) => goal.completed)) {
|
|
1550
|
+
return false;
|
|
1551
|
+
}
|
|
1552
|
+
return true;
|
|
1462
1553
|
}
|
|
1463
|
-
|
|
1464
|
-
|
|
1554
|
+
set completed(value) {
|
|
1555
|
+
this.setStorageProperty("completed", value);
|
|
1465
1556
|
}
|
|
1557
|
+
/**
|
|
1558
|
+
* The list of goals that the player needs to complete to finish the stage.
|
|
1559
|
+
*/
|
|
1466
1560
|
get goals() {
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1561
|
+
return this.defaultGoals.map((goal) => {
|
|
1562
|
+
return new GoalStage(goal.id, this.id, goal);
|
|
1563
|
+
});
|
|
1564
|
+
}
|
|
1565
|
+
get prevStageEndDay() {
|
|
1566
|
+
return this.getStorageProperty("prevStageEndDay");
|
|
1567
|
+
}
|
|
1568
|
+
set prevStageEndDay(value) {
|
|
1569
|
+
this.setStorageProperty("prevStageEndDay", value);
|
|
1570
|
+
}
|
|
1571
|
+
get startDay() {
|
|
1572
|
+
let prevStageEndDay = this.prevStageEndDay;
|
|
1573
|
+
if (prevStageEndDay === void 0) {
|
|
1574
|
+
return void 0;
|
|
1470
1575
|
}
|
|
1471
|
-
return
|
|
1576
|
+
return prevStageEndDay + this.daysRequiredToStart;
|
|
1472
1577
|
}
|
|
1473
|
-
|
|
1474
|
-
let
|
|
1475
|
-
|
|
1578
|
+
get canStart() {
|
|
1579
|
+
let daysRequired = this.daysRequiredToStart;
|
|
1580
|
+
if (daysRequired > 0) {
|
|
1581
|
+
let prevStageEndDay = this.prevStageEndDay;
|
|
1582
|
+
if (prevStageEndDay === void 0) {
|
|
1583
|
+
return false;
|
|
1584
|
+
}
|
|
1585
|
+
if (prevStageEndDay + daysRequired > TimeManager.currentDay) {
|
|
1586
|
+
return false;
|
|
1587
|
+
}
|
|
1588
|
+
}
|
|
1589
|
+
if (this.flagsRequiredToStart.length > 0 && !this.flagsRequiredToStart.every((flag) => pixiVn.getFlag(flag.flag))) {
|
|
1590
|
+
return false;
|
|
1591
|
+
}
|
|
1592
|
+
if (this.questsRequiredToStart.length > 0 && !this.questsRequiredToStart.every(
|
|
1593
|
+
(q) => q.quest.currentStageIndex && q.quest.currentStageIndex >= q.stageNumber
|
|
1594
|
+
)) {
|
|
1595
|
+
return false;
|
|
1596
|
+
}
|
|
1597
|
+
return true;
|
|
1598
|
+
}
|
|
1599
|
+
get onStart() {
|
|
1600
|
+
if (this.daysRequiredToStart > 0) {
|
|
1601
|
+
this.prevStageEndDay = TimeManager.currentDay;
|
|
1602
|
+
}
|
|
1603
|
+
return super.onStart;
|
|
1604
|
+
}
|
|
1605
|
+
};
|
|
1606
|
+
|
|
1607
|
+
// src/classes/quest/Quest.ts
|
|
1608
|
+
var QUEST_CATEGORY = "__nqtr-quest__";
|
|
1609
|
+
var Quest = class extends pixiVn.StoredClassModel {
|
|
1610
|
+
constructor(id, stages, props) {
|
|
1611
|
+
super(QUEST_CATEGORY, id);
|
|
1612
|
+
this._stages = stages;
|
|
1613
|
+
this._name = props.name || "";
|
|
1614
|
+
this._description = props.description || "";
|
|
1615
|
+
this._renderIcon = props.renderIcon;
|
|
1616
|
+
this._renderImage = props.renderImage;
|
|
1617
|
+
this._isInDevelopment = props.isInDevelopment || false;
|
|
1618
|
+
}
|
|
1619
|
+
get stages() {
|
|
1620
|
+
return this._stages.map((stage, index) => {
|
|
1621
|
+
return new StageQuest(stage.id, stage);
|
|
1622
|
+
});
|
|
1476
1623
|
}
|
|
1477
1624
|
get name() {
|
|
1478
1625
|
return this._name;
|
|
@@ -1480,29 +1627,99 @@ var StageBaseModel = class extends pixiVn.StoredClassModel {
|
|
|
1480
1627
|
get description() {
|
|
1481
1628
|
return this._description;
|
|
1482
1629
|
}
|
|
1483
|
-
|
|
1484
|
-
|
|
1630
|
+
/**
|
|
1631
|
+
* The function for rendering the icon of the quest.
|
|
1632
|
+
*/
|
|
1633
|
+
get renderIcon() {
|
|
1634
|
+
let render = this._renderIcon;
|
|
1635
|
+
if (render === void 0) {
|
|
1636
|
+
return void 0;
|
|
1637
|
+
}
|
|
1638
|
+
if (typeof render === "function") {
|
|
1639
|
+
return (props) => {
|
|
1640
|
+
return render(this, props);
|
|
1641
|
+
};
|
|
1642
|
+
}
|
|
1643
|
+
return (props) => render;
|
|
1644
|
+
}
|
|
1645
|
+
/**
|
|
1646
|
+
* The function for rendering the image of the quest.
|
|
1647
|
+
*/
|
|
1648
|
+
get renderImage() {
|
|
1649
|
+
let render = this._renderImage;
|
|
1650
|
+
if (render === void 0) {
|
|
1651
|
+
return void 0;
|
|
1652
|
+
}
|
|
1653
|
+
if (typeof render === "function") {
|
|
1654
|
+
return (props) => {
|
|
1655
|
+
return render(this, props);
|
|
1656
|
+
};
|
|
1657
|
+
}
|
|
1658
|
+
return (props) => render;
|
|
1485
1659
|
}
|
|
1486
|
-
get
|
|
1487
|
-
return this.
|
|
1660
|
+
get isInDevelopment() {
|
|
1661
|
+
return this._isInDevelopment;
|
|
1488
1662
|
}
|
|
1489
|
-
get
|
|
1490
|
-
return this.
|
|
1663
|
+
get currentStageIndex() {
|
|
1664
|
+
return this.getStorageProperty("currentStageIndex");
|
|
1665
|
+
}
|
|
1666
|
+
set currentStageIndex(value) {
|
|
1667
|
+
this.setStorageProperty("currentStageIndex", value);
|
|
1491
1668
|
}
|
|
1492
|
-
get
|
|
1493
|
-
|
|
1669
|
+
get currentStage() {
|
|
1670
|
+
let index = this.currentStageIndex;
|
|
1671
|
+
if (index === void 0 || index >= this.stages.length) {
|
|
1672
|
+
return void 0;
|
|
1673
|
+
}
|
|
1674
|
+
return this.stages[index];
|
|
1494
1675
|
}
|
|
1495
|
-
get
|
|
1496
|
-
return this.
|
|
1676
|
+
get started() {
|
|
1677
|
+
return this.currentStageIndex !== void 0;
|
|
1497
1678
|
}
|
|
1498
|
-
get
|
|
1499
|
-
return this.
|
|
1679
|
+
get completed() {
|
|
1680
|
+
return this.currentStageIndex === this.stages.length;
|
|
1500
1681
|
}
|
|
1501
|
-
|
|
1502
|
-
|
|
1682
|
+
start() {
|
|
1683
|
+
if (this.started) {
|
|
1684
|
+
console.warn(`[NQTR] Quest ${this.id} is already started`);
|
|
1685
|
+
return;
|
|
1686
|
+
}
|
|
1687
|
+
if (this.stages.length === 0) {
|
|
1688
|
+
console.error(`[NQTR] Quest ${this.id} has no stages`);
|
|
1689
|
+
return;
|
|
1690
|
+
}
|
|
1691
|
+
this.currentStageIndex = 0;
|
|
1692
|
+
let currentStage = this.currentStage;
|
|
1693
|
+
if (currentStage && currentStage.onStart) {
|
|
1694
|
+
return currentStage.onStart();
|
|
1695
|
+
} else {
|
|
1696
|
+
console.error(`[NQTR] Quest ${this.id} has no start stage`);
|
|
1697
|
+
}
|
|
1503
1698
|
}
|
|
1504
|
-
|
|
1505
|
-
|
|
1699
|
+
tryToGoNextStage() {
|
|
1700
|
+
if (!this.started) {
|
|
1701
|
+
return;
|
|
1702
|
+
}
|
|
1703
|
+
if (this.completed) {
|
|
1704
|
+
return;
|
|
1705
|
+
}
|
|
1706
|
+
let currentStage = this.currentStage;
|
|
1707
|
+
let currentStageIndex = this.currentStageIndex;
|
|
1708
|
+
if (!currentStage || currentStageIndex === void 0) {
|
|
1709
|
+
console.error(`[NQTR] Quest ${this.id} has no current stage`);
|
|
1710
|
+
return;
|
|
1711
|
+
}
|
|
1712
|
+
if (currentStage.completed) {
|
|
1713
|
+
let nextStageIndex = currentStageIndex + 1;
|
|
1714
|
+
currentStageIndex = nextStageIndex;
|
|
1715
|
+
let nextStage = this.currentStage;
|
|
1716
|
+
if (currentStage && currentStage.onEnd) {
|
|
1717
|
+
currentStage.onEnd();
|
|
1718
|
+
}
|
|
1719
|
+
if (nextStage && nextStage.onStart) {
|
|
1720
|
+
return nextStage.onStart();
|
|
1721
|
+
}
|
|
1722
|
+
}
|
|
1506
1723
|
}
|
|
1507
1724
|
};
|
|
1508
1725
|
var CURRENT_ROOM_MEMORY_KEY = "___nqtr-current_room_memory___";
|
|
@@ -1566,16 +1783,16 @@ function currentActivities() {
|
|
|
1566
1783
|
}
|
|
1567
1784
|
|
|
1568
1785
|
exports.ActivityModel = ActivityModel;
|
|
1786
|
+
exports.ActivityRoom = ActivityRoom;
|
|
1569
1787
|
exports.CommitmentBaseModel = CommitmentBaseModel;
|
|
1570
|
-
exports.ExecutionTypeEnum = ExecutionTypeEnum;
|
|
1571
1788
|
exports.Goal = Goal;
|
|
1572
1789
|
exports.LocationBaseModel = LocationBaseModel;
|
|
1573
1790
|
exports.MapBaseModel = MapBaseModel;
|
|
1574
|
-
exports.
|
|
1791
|
+
exports.Quest = Quest;
|
|
1575
1792
|
exports.RoomBaseModel = RoomBaseModel;
|
|
1576
|
-
exports.
|
|
1793
|
+
exports.Stage = Stage;
|
|
1577
1794
|
exports.TimeManager = TimeManager;
|
|
1578
|
-
exports.
|
|
1795
|
+
exports.addCommitment = addCommitment;
|
|
1579
1796
|
exports.clearExpiredActivities = clearExpiredActivities;
|
|
1580
1797
|
exports.clearExpiredRoutine = clearExpiredRoutine;
|
|
1581
1798
|
exports.currentActivities = currentActivities;
|
|
@@ -1586,15 +1803,15 @@ exports.getCommitmentByCharacter = getCommitmentByCharacter;
|
|
|
1586
1803
|
exports.getCommitmentById = getCommitmentById;
|
|
1587
1804
|
exports.getCueerntMap = getCueerntMap;
|
|
1588
1805
|
exports.getCurrenrLocation = getCurrenrLocation;
|
|
1589
|
-
exports.getCurrentCommitments = getCurrentCommitments;
|
|
1590
1806
|
exports.getCurrentRoom = getCurrentRoom;
|
|
1591
|
-
exports.
|
|
1807
|
+
exports.getCurrentRoutine = getCurrentRoutine;
|
|
1808
|
+
exports.getQuestById = getQuestById;
|
|
1592
1809
|
exports.getRoomById = getRoomById;
|
|
1593
|
-
exports.getTemporaryCommitments = getTemporaryCommitments;
|
|
1594
1810
|
exports.saveActivity = saveActivity;
|
|
1595
1811
|
exports.saveCommitment = saveCommitment;
|
|
1812
|
+
exports.saveQuest = saveQuest;
|
|
1596
1813
|
exports.saveRoom = saveRoom;
|
|
1597
1814
|
exports.setCurrentRoom = setCurrentRoom;
|
|
1598
|
-
exports.
|
|
1815
|
+
exports.setFixedRoutine = setFixedRoutine;
|
|
1599
1816
|
//# sourceMappingURL=out.js.map
|
|
1600
1817
|
//# sourceMappingURL=index.js.map
|