@drincs/nqtr 0.1.19 → 0.2.0
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/{ActivityProps-_79x9-BX.d.ts → ActivityProps-BkHX8xkA.d.ts} +1 -1
- package/dist/{ActivityProps-BoJeWa2B.d.mts → ActivityProps-D45DQdcT.d.mts} +1 -1
- package/dist/{Commitment-Cc2kZEy0.d.ts → Commitment-BJTIpBQ5.d.ts} +4 -2
- package/dist/{Commitment-C3Nc2RJH.d.mts → Commitment-CtNWnNQX.d.mts} +4 -2
- package/dist/StageProps-DCZkZHwZ.d.ts +197 -0
- package/dist/StageProps-xLLR0rjD.d.mts +197 -0
- package/dist/classes/Activity.d.mts +2 -2
- package/dist/classes/Activity.d.ts +2 -2
- package/dist/classes/Activity.js +1 -1
- package/dist/classes/Activity.js.map +1 -1
- package/dist/classes/Activity.mjs +1 -1
- package/dist/classes/Activity.mjs.map +1 -1
- package/dist/classes/ActivityStoredAbstract.d.mts +1 -1
- package/dist/classes/ActivityStoredAbstract.d.ts +1 -1
- package/dist/classes/ActivityStoredAbstract.js +1 -1
- package/dist/classes/ActivityStoredAbstract.js.map +1 -1
- package/dist/classes/ActivityStoredAbstract.mjs +1 -1
- package/dist/classes/ActivityStoredAbstract.mjs.map +1 -1
- package/dist/classes/Commitment.d.mts +2 -2
- package/dist/classes/Commitment.d.ts +2 -2
- package/dist/classes/Commitment.js +2 -2
- package/dist/classes/Commitment.js.map +1 -1
- package/dist/classes/Commitment.mjs +2 -2
- 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 +290 -322
- package/dist/classes/index.js.map +1 -1
- package/dist/classes/index.mjs +289 -321
- 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 +2 -2
- package/dist/classes/navigation/ActivityRoom.js.map +1 -1
- package/dist/classes/navigation/ActivityRoom.mjs +2 -2
- 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/Map.d.mts +2 -2
- package/dist/classes/navigation/Map.d.ts +2 -2
- package/dist/classes/navigation/Room.d.mts +2 -2
- package/dist/classes/navigation/Room.d.ts +2 -2
- package/dist/classes/navigation/Room.js +34 -36
- package/dist/classes/navigation/Room.js.map +1 -1
- package/dist/classes/navigation/Room.mjs +34 -36
- 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/CommitmentDecorator.d.mts +9 -3
- package/dist/decorators/CommitmentDecorator.d.ts +9 -3
- package/dist/decorators/CommitmentDecorator.js +15 -0
- package/dist/decorators/CommitmentDecorator.js.map +1 -1
- package/dist/decorators/CommitmentDecorator.mjs +15 -1
- package/dist/decorators/CommitmentDecorator.mjs.map +1 -1
- package/dist/decorators/QuestDecorator.d.mts +26 -0
- package/dist/decorators/QuestDecorator.d.ts +26 -0
- package/dist/decorators/QuestDecorator.js +592 -0
- package/dist/decorators/QuestDecorator.js.map +1 -0
- package/dist/decorators/QuestDecorator.mjs +588 -0
- package/dist/decorators/QuestDecorator.mjs.map +1 -0
- package/dist/decorators/RoomDecorator.d.mts +2 -2
- package/dist/decorators/RoomDecorator.d.ts +2 -2
- package/dist/decorators/index.d.mts +8 -3
- package/dist/decorators/index.d.ts +8 -3
- package/dist/decorators/index.js +598 -0
- package/dist/decorators/index.js.map +1 -1
- package/dist/decorators/index.mjs +597 -2
- 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 +2 -2
- package/dist/functions/RoutineFunctions.d.ts +2 -2
- package/dist/functions/RoutineFunctions.js.map +1 -1
- package/dist/functions/RoutineFunctions.mjs.map +1 -1
- package/dist/functions/index.d.mts +2 -2
- package/dist/functions/index.d.ts +2 -2
- package/dist/functions/index.js.map +1 -1
- package/dist/functions/index.mjs.map +1 -1
- package/dist/index.d.mts +6 -5
- package/dist/index.d.ts +6 -5
- package/dist/index.js +540 -308
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +536 -307
- package/dist/index.mjs.map +1 -1
- package/dist/interface/ActivityProps.d.mts +1 -1
- package/dist/interface/ActivityProps.d.ts +1 -1
- package/dist/interface/CommitmentProps.d.mts +2 -2
- package/dist/interface/CommitmentProps.d.ts +2 -2
- package/dist/interface/RoomActivityMemory.d.mts +1 -1
- package/dist/interface/RoomActivityMemory.d.ts +1 -1
- 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/QuestsRequired.d.mts +3 -2
- package/dist/types/QuestsRequired.d.ts +3 -2
- package/dist/types/index.d.mts +3 -2
- package/dist/types/index.d.ts +3 -2
- package/package.json +2 -2
- package/dist/Quest-Bdm0R9LA.d.mts +0 -71
- package/dist/Quest-CxJcXETG.d.ts +0 -71
package/dist/index.mjs
CHANGED
|
@@ -359,7 +359,7 @@ var ActivityModel = class {
|
|
|
359
359
|
/**
|
|
360
360
|
* The function that is called when the activity is runned.
|
|
361
361
|
*/
|
|
362
|
-
get
|
|
362
|
+
get run() {
|
|
363
363
|
return (props) => this._onRun(this, props);
|
|
364
364
|
}
|
|
365
365
|
/**
|
|
@@ -489,6 +489,7 @@ var CommitmentBaseModel = class extends StoredClassModel {
|
|
|
489
489
|
}
|
|
490
490
|
/**
|
|
491
491
|
* 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.
|
|
492
|
+
* If you set "automatic" remember to remove the commitment when it is no longer needed, because otherwise it repeats itself every time.
|
|
492
493
|
*/
|
|
493
494
|
get executionType() {
|
|
494
495
|
return this._executionType;
|
|
@@ -511,10 +512,9 @@ var CommitmentBaseModel = class extends StoredClassModel {
|
|
|
511
512
|
/**
|
|
512
513
|
* Is a function that is called when the player interacts with the character.
|
|
513
514
|
*/
|
|
514
|
-
get
|
|
515
|
+
get run() {
|
|
515
516
|
let onRun = this._onRun;
|
|
516
517
|
if (!onRun) {
|
|
517
|
-
console.warn("[NQTR] onRun() is not defined for commitmen, so it will not run.", this);
|
|
518
518
|
return;
|
|
519
519
|
}
|
|
520
520
|
return (props) => onRun(this, props);
|
|
@@ -575,6 +575,199 @@ var CommitmentBaseModel = class extends StoredClassModel {
|
|
|
575
575
|
return false;
|
|
576
576
|
}
|
|
577
577
|
};
|
|
578
|
+
var ActivityStoredAbstract = class {
|
|
579
|
+
/**
|
|
580
|
+
* @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.
|
|
581
|
+
* @param props The activity properties.
|
|
582
|
+
*/
|
|
583
|
+
constructor(onRun, props) {
|
|
584
|
+
this.defaultName = props.name;
|
|
585
|
+
this.defaultFromHour = props.fromHour;
|
|
586
|
+
this.defaultToHour = props.toHour;
|
|
587
|
+
this.defaultFromDay = props.fromDay;
|
|
588
|
+
this.defaultToDay = props.toDay;
|
|
589
|
+
this.defaultDisabled = props.disabled || false;
|
|
590
|
+
this.defaultHidden = props.hidden || false;
|
|
591
|
+
this._renderIcon = props.renderIcon;
|
|
592
|
+
this._onRun = onRun;
|
|
593
|
+
}
|
|
594
|
+
/**
|
|
595
|
+
* The name
|
|
596
|
+
*/
|
|
597
|
+
get name() {
|
|
598
|
+
return this.getStorageProperty("name") || this.defaultName || "";
|
|
599
|
+
}
|
|
600
|
+
set name(value) {
|
|
601
|
+
this.setStorageProperty("name", value);
|
|
602
|
+
}
|
|
603
|
+
/**
|
|
604
|
+
* The hour when the activity starts. If the activity is not started yet, it will be hidden.
|
|
605
|
+
*/
|
|
606
|
+
get fromHour() {
|
|
607
|
+
return this.getStorageProperty("fromHour") || this.defaultFromHour || TimeManager.minDayHours;
|
|
608
|
+
}
|
|
609
|
+
set fromHour(value) {
|
|
610
|
+
this.setStorageProperty("fromHour", value);
|
|
611
|
+
}
|
|
612
|
+
/**
|
|
613
|
+
* The hour when the activity ends. If the activity is ended yet, it will be hidden.
|
|
614
|
+
*/
|
|
615
|
+
get toHour() {
|
|
616
|
+
return this.getStorageProperty("toHour") || this.defaultToHour || TimeManager.maxDayHours + 1;
|
|
617
|
+
}
|
|
618
|
+
set toHour(value) {
|
|
619
|
+
this.setStorageProperty("toHour", value);
|
|
620
|
+
}
|
|
621
|
+
/**
|
|
622
|
+
* The day when the activity starts. If the activity is not started yet, it will be hidden.
|
|
623
|
+
*/
|
|
624
|
+
get fromDay() {
|
|
625
|
+
return this.getStorageProperty("fromDay") || this.defaultFromDay;
|
|
626
|
+
}
|
|
627
|
+
set fromDay(value) {
|
|
628
|
+
this.setStorageProperty("fromDay", value);
|
|
629
|
+
}
|
|
630
|
+
/**
|
|
631
|
+
* The day when the activity ends. If the activity is ended yet, it will be deleted or hidden.
|
|
632
|
+
*/
|
|
633
|
+
get toDay() {
|
|
634
|
+
return this.getStorageProperty("toDay") || this.defaultToDay;
|
|
635
|
+
}
|
|
636
|
+
set toDay(value) {
|
|
637
|
+
this.setStorageProperty("toDay", value);
|
|
638
|
+
}
|
|
639
|
+
/**
|
|
640
|
+
* Whether is disabled.
|
|
641
|
+
*/
|
|
642
|
+
get disabled() {
|
|
643
|
+
let value = this.getStorageProperty("disabled") || this.defaultDisabled;
|
|
644
|
+
if (typeof value === "string") {
|
|
645
|
+
return getFlag(value);
|
|
646
|
+
}
|
|
647
|
+
return value;
|
|
648
|
+
}
|
|
649
|
+
set disabled(value) {
|
|
650
|
+
this.setStorageProperty("disabled", value);
|
|
651
|
+
}
|
|
652
|
+
/**
|
|
653
|
+
* Whether is hidden. If the activity is not started yet, it will be hidden.
|
|
654
|
+
*/
|
|
655
|
+
get hidden() {
|
|
656
|
+
if (this.fromDay && this.fromDay > TimeManager.currentDay) {
|
|
657
|
+
return true;
|
|
658
|
+
}
|
|
659
|
+
if (!TimeManager.nowIsBetween(this.fromHour, this.toHour)) {
|
|
660
|
+
return true;
|
|
661
|
+
}
|
|
662
|
+
if (!this.isExpired) {
|
|
663
|
+
return true;
|
|
664
|
+
}
|
|
665
|
+
let value = this.getStorageProperty("hidden") || this.defaultHidden;
|
|
666
|
+
if (typeof value === "string") {
|
|
667
|
+
return getFlag(value);
|
|
668
|
+
}
|
|
669
|
+
return value;
|
|
670
|
+
}
|
|
671
|
+
set hidden(value) {
|
|
672
|
+
this.setStorageProperty("hidden", value);
|
|
673
|
+
}
|
|
674
|
+
/**
|
|
675
|
+
* The function for rendering the icon of the activity.
|
|
676
|
+
*/
|
|
677
|
+
get renderIcon() {
|
|
678
|
+
let render = this._renderIcon;
|
|
679
|
+
if (render === void 0) {
|
|
680
|
+
return void 0;
|
|
681
|
+
}
|
|
682
|
+
if (typeof render === "function") {
|
|
683
|
+
return (props) => {
|
|
684
|
+
return render(this, props);
|
|
685
|
+
};
|
|
686
|
+
}
|
|
687
|
+
return (props) => render;
|
|
688
|
+
}
|
|
689
|
+
/**
|
|
690
|
+
* The function that is called when the activity is runned.
|
|
691
|
+
*/
|
|
692
|
+
get run() {
|
|
693
|
+
return (props) => {
|
|
694
|
+
return this._onRun(this, props);
|
|
695
|
+
};
|
|
696
|
+
}
|
|
697
|
+
/**
|
|
698
|
+
* Whether the activity is a deadline.
|
|
699
|
+
* @returns Whether the activity is a deadline.
|
|
700
|
+
*/
|
|
701
|
+
isExpired() {
|
|
702
|
+
if (this.toDay && this.toDay <= TimeManager.currentDay) {
|
|
703
|
+
return true;
|
|
704
|
+
}
|
|
705
|
+
return false;
|
|
706
|
+
}
|
|
707
|
+
/**
|
|
708
|
+
* Export the activity properties.
|
|
709
|
+
* @returns The activity properties.
|
|
710
|
+
*/
|
|
711
|
+
export() {
|
|
712
|
+
return {
|
|
713
|
+
name: this.getStorageProperty("name") || this.defaultName,
|
|
714
|
+
fromHour: this.getStorageProperty("fromHour") || this.defaultFromHour,
|
|
715
|
+
toHour: this.getStorageProperty("toHour") || this.defaultToHour,
|
|
716
|
+
fromDay: this.getStorageProperty("fromDay") || this.defaultFromDay,
|
|
717
|
+
toDay: this.getStorageProperty("toDay") || this.defaultToDay,
|
|
718
|
+
disabled: this.getStorageProperty("disabled") || this.defaultDisabled,
|
|
719
|
+
hidden: this.getStorageProperty("hidden") || this.defaultHidden,
|
|
720
|
+
renderIcon: this._renderIcon
|
|
721
|
+
};
|
|
722
|
+
}
|
|
723
|
+
};
|
|
724
|
+
|
|
725
|
+
// src/classes/navigation/ActivityRoom.ts
|
|
726
|
+
var ActivityRoom = class extends ActivityStoredAbstract {
|
|
727
|
+
constructor(id, room, onRun, props) {
|
|
728
|
+
super(onRun, props);
|
|
729
|
+
this._id = id;
|
|
730
|
+
this._room = room;
|
|
731
|
+
}
|
|
732
|
+
setStorageProperty(_, __) {
|
|
733
|
+
this._room.setActivity(this);
|
|
734
|
+
}
|
|
735
|
+
getStorageProperty(propertyName) {
|
|
736
|
+
let activity = this._room.getActivityMemory(this.id);
|
|
737
|
+
if (!activity || !activity.hasOwnProperty(propertyName)) {
|
|
738
|
+
return void 0;
|
|
739
|
+
}
|
|
740
|
+
return activity[propertyName];
|
|
741
|
+
}
|
|
742
|
+
get id() {
|
|
743
|
+
return this._id;
|
|
744
|
+
}
|
|
745
|
+
get room() {
|
|
746
|
+
return this._room;
|
|
747
|
+
}
|
|
748
|
+
export() {
|
|
749
|
+
let result = {};
|
|
750
|
+
if (this.name !== void 0) {
|
|
751
|
+
result["name"] = this.name;
|
|
752
|
+
}
|
|
753
|
+
if (this.fromHour !== void 0) {
|
|
754
|
+
result["fromHour"] = this.fromHour;
|
|
755
|
+
}
|
|
756
|
+
if (this.toHour !== void 0) {
|
|
757
|
+
result["toHour"] = this.toHour;
|
|
758
|
+
}
|
|
759
|
+
if (this.fromDay !== void 0) {
|
|
760
|
+
result["fromDay"] = this.fromDay;
|
|
761
|
+
}
|
|
762
|
+
if (this.toDay !== void 0) {
|
|
763
|
+
result["toDay"] = this.toDay;
|
|
764
|
+
}
|
|
765
|
+
if (this.disabled !== void 0) {
|
|
766
|
+
result["disabled"] = this.disabled;
|
|
767
|
+
}
|
|
768
|
+
return result;
|
|
769
|
+
}
|
|
770
|
+
};
|
|
578
771
|
|
|
579
772
|
// src/decorators/RoomDecorator.ts
|
|
580
773
|
var registeredRooms = {};
|
|
@@ -891,6 +1084,20 @@ function addCommitment(commitment) {
|
|
|
891
1084
|
}).filter((id) => id !== void 0);
|
|
892
1085
|
GameStorageManager.setVariable(TEMPORARY_COMMITMENT_CATEGORY_MEMORY_KEY, [commitmentsIds]);
|
|
893
1086
|
}
|
|
1087
|
+
function removeCommitment(commitment) {
|
|
1088
|
+
if (!Array.isArray(commitment)) {
|
|
1089
|
+
commitment = [commitment];
|
|
1090
|
+
}
|
|
1091
|
+
let commitmentsIds = commitment.map((commitment2) => {
|
|
1092
|
+
return commitment2.id;
|
|
1093
|
+
});
|
|
1094
|
+
let currentCommitments = GameStorageManager.getVariable(TEMPORARY_COMMITMENT_CATEGORY_MEMORY_KEY);
|
|
1095
|
+
if (!currentCommitments) {
|
|
1096
|
+
return;
|
|
1097
|
+
}
|
|
1098
|
+
currentCommitments = currentCommitments.filter((id) => !commitmentsIds.includes(id));
|
|
1099
|
+
GameStorageManager.setVariable(TEMPORARY_COMMITMENT_CATEGORY_MEMORY_KEY, currentCommitments);
|
|
1100
|
+
}
|
|
894
1101
|
function getFixedRoutine() {
|
|
895
1102
|
return Object.values(fixedCommitments);
|
|
896
1103
|
}
|
|
@@ -902,153 +1109,228 @@ function getTemporaryCommitments() {
|
|
|
902
1109
|
let commitments = commitmentsIds.map((id) => getCommitmentById(id)).filter((commitment) => commitment !== void 0);
|
|
903
1110
|
return commitments;
|
|
904
1111
|
}
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
}
|
|
913
|
-
}
|
|
914
|
-
function getCurrentRoutine() {
|
|
915
|
-
let character_commitments = {};
|
|
916
|
-
getTemporaryCommitments().reverse().forEach((c) => {
|
|
917
|
-
if (!c.hidden) {
|
|
918
|
-
if (c.characters.length > 0) {
|
|
919
|
-
let allAvailable = c.characters.every((ch) => !character_commitments[ch.id] || c.priority > character_commitments[ch.id].priority);
|
|
920
|
-
if (allAvailable) {
|
|
921
|
-
c.characters.forEach((ch) => {
|
|
922
|
-
character_commitments[ch.id] = c;
|
|
923
|
-
});
|
|
924
|
-
}
|
|
925
|
-
} else {
|
|
926
|
-
console.error(`[NQTR] The commitment ${c.id} has no characters assigned`);
|
|
927
|
-
}
|
|
928
|
-
}
|
|
929
|
-
});
|
|
930
|
-
getFixedRoutine().reverse().forEach((c) => {
|
|
931
|
-
if (!c.hidden) {
|
|
932
|
-
if (c.characters.length > 0) {
|
|
933
|
-
let allAvailable = c.characters.every((ch) => !character_commitments[ch.id] || c.priority > character_commitments[ch.id].priority);
|
|
934
|
-
if (allAvailable) {
|
|
935
|
-
c.characters.forEach((ch) => {
|
|
936
|
-
character_commitments[ch.id] = c;
|
|
937
|
-
});
|
|
938
|
-
}
|
|
939
|
-
} else {
|
|
940
|
-
console.error(`[NQTR] The commitment ${c.id} has no characters assigned`);
|
|
941
|
-
}
|
|
942
|
-
}
|
|
943
|
-
});
|
|
944
|
-
return Object.values(character_commitments);
|
|
945
|
-
}
|
|
946
|
-
function getCommitmentByCharacter(character) {
|
|
947
|
-
getCurrentRoutine().forEach((c) => {
|
|
948
|
-
if (c.characters.map((ch) => ch.id).includes(character.id)) {
|
|
949
|
-
return c;
|
|
950
|
-
}
|
|
951
|
-
});
|
|
952
|
-
return void 0;
|
|
953
|
-
}
|
|
954
|
-
var ActivityStoredAbstract = class {
|
|
1112
|
+
var GOAL_CATEGORY = "__nqtr-goal__";
|
|
1113
|
+
var Goal = class extends StoredClassModel {
|
|
1114
|
+
constructor(id, props) {
|
|
1115
|
+
super(GOAL_CATEGORY, id);
|
|
1116
|
+
this._description = props.description;
|
|
1117
|
+
this._need = props.need || 1;
|
|
1118
|
+
this._defaultHave = props.have || 0;
|
|
1119
|
+
}
|
|
955
1120
|
/**
|
|
956
|
-
*
|
|
957
|
-
* @param props The activity properties.
|
|
1121
|
+
* The description of the goal.
|
|
958
1122
|
*/
|
|
959
|
-
|
|
960
|
-
this.
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
this.
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
this.
|
|
967
|
-
|
|
968
|
-
|
|
1123
|
+
get description() {
|
|
1124
|
+
return this._description;
|
|
1125
|
+
}
|
|
1126
|
+
get need() {
|
|
1127
|
+
return this._need;
|
|
1128
|
+
}
|
|
1129
|
+
get defaultHave() {
|
|
1130
|
+
return this._defaultHave;
|
|
1131
|
+
}
|
|
1132
|
+
};
|
|
1133
|
+
var GoalStage = class extends Goal {
|
|
1134
|
+
constructor(id, stageId, props) {
|
|
1135
|
+
super(id, props);
|
|
1136
|
+
this._stageId = stageId;
|
|
1137
|
+
}
|
|
1138
|
+
get stageId() {
|
|
1139
|
+
return this._stageId;
|
|
1140
|
+
}
|
|
1141
|
+
set stageId(value) {
|
|
1142
|
+
this._stageId = value;
|
|
1143
|
+
}
|
|
1144
|
+
get have() {
|
|
1145
|
+
return this.getStorageProperty("have-" + this._stageId) || this.defaultHave;
|
|
1146
|
+
}
|
|
1147
|
+
set have(value) {
|
|
1148
|
+
if (!this._stageId) {
|
|
1149
|
+
console.error(`[NQTR] The stage id is not set for the goal ${this.id}, so the have value can't be set.`);
|
|
1150
|
+
return;
|
|
1151
|
+
}
|
|
1152
|
+
this.setStorageProperty("have-" + this._stageId, value);
|
|
1153
|
+
}
|
|
1154
|
+
get completed() {
|
|
1155
|
+
return this.have >= this.need;
|
|
1156
|
+
}
|
|
1157
|
+
set completed(value) {
|
|
1158
|
+
if (value) {
|
|
1159
|
+
this.have = this.need;
|
|
1160
|
+
} else {
|
|
1161
|
+
console.warn(`[NQTR] The goal can't be set as not completed. You must edit the have value manually.`);
|
|
1162
|
+
}
|
|
1163
|
+
}
|
|
1164
|
+
find() {
|
|
1165
|
+
this.have++;
|
|
1166
|
+
}
|
|
1167
|
+
};
|
|
1168
|
+
|
|
1169
|
+
// src/classes/quest/Stage.ts
|
|
1170
|
+
var STAGE_CATEGORY = "__nqtr-stage__";
|
|
1171
|
+
var Stage = class extends StoredClassModel {
|
|
1172
|
+
constructor(id, props) {
|
|
1173
|
+
super(STAGE_CATEGORY, id);
|
|
1174
|
+
this._name = props.name || "";
|
|
1175
|
+
this._defaultGoals = props.goals || [];
|
|
1176
|
+
this._flags = props.flags || [];
|
|
1177
|
+
this._description = props.description || "";
|
|
1178
|
+
this._adviceDescription = props.adviceDescription || "";
|
|
1179
|
+
this._renderImage = props.renderImage;
|
|
1180
|
+
this._daysRequiredToStart = props.daysRequiredToStart;
|
|
1181
|
+
this._flagsRequiredToStart = props.flagsRequired || [];
|
|
1182
|
+
this._questsRequiredToStart = props.questsRequired || [];
|
|
1183
|
+
this._requestDescriptionToStart = props.requestDescription || "";
|
|
1184
|
+
this._onStart = props.onStart;
|
|
1185
|
+
this._onEnd = props.onEnd;
|
|
969
1186
|
}
|
|
970
|
-
/**
|
|
971
|
-
* The name
|
|
972
|
-
*/
|
|
973
1187
|
get name() {
|
|
974
|
-
return this.
|
|
1188
|
+
return this._name;
|
|
975
1189
|
}
|
|
976
|
-
|
|
977
|
-
this.
|
|
1190
|
+
get description() {
|
|
1191
|
+
return this._description;
|
|
1192
|
+
}
|
|
1193
|
+
get adviceDescription() {
|
|
1194
|
+
return this._adviceDescription;
|
|
978
1195
|
}
|
|
979
1196
|
/**
|
|
980
|
-
* The
|
|
1197
|
+
* The function for rendering the image of the stage.
|
|
981
1198
|
*/
|
|
982
|
-
get
|
|
983
|
-
|
|
1199
|
+
get renderImage() {
|
|
1200
|
+
let render = this._renderImage;
|
|
1201
|
+
if (render === void 0) {
|
|
1202
|
+
return void 0;
|
|
1203
|
+
}
|
|
1204
|
+
if (typeof render === "function") {
|
|
1205
|
+
return (props) => {
|
|
1206
|
+
return render(this, props);
|
|
1207
|
+
};
|
|
1208
|
+
}
|
|
1209
|
+
return (props) => render;
|
|
984
1210
|
}
|
|
985
|
-
|
|
986
|
-
this.
|
|
1211
|
+
get defaultGoals() {
|
|
1212
|
+
return this._defaultGoals;
|
|
987
1213
|
}
|
|
988
1214
|
/**
|
|
989
|
-
* The
|
|
1215
|
+
* The list of flags that the player must complete to finish the stage.
|
|
990
1216
|
*/
|
|
991
|
-
get
|
|
992
|
-
return this.
|
|
1217
|
+
get flags() {
|
|
1218
|
+
return this._flags;
|
|
993
1219
|
}
|
|
994
|
-
|
|
995
|
-
this.
|
|
1220
|
+
get daysRequiredToStart() {
|
|
1221
|
+
return this._daysRequiredToStart || 0;
|
|
996
1222
|
}
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
*/
|
|
1000
|
-
get fromDay() {
|
|
1001
|
-
return this.getStorageProperty("fromDay") || this.defaultFromDay;
|
|
1223
|
+
get flagsRequiredToStart() {
|
|
1224
|
+
return this._flagsRequiredToStart;
|
|
1002
1225
|
}
|
|
1003
|
-
|
|
1004
|
-
this.
|
|
1226
|
+
get questsRequiredToStart() {
|
|
1227
|
+
return this._questsRequiredToStart || [];
|
|
1005
1228
|
}
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
*/
|
|
1009
|
-
get toDay() {
|
|
1010
|
-
return this.getStorageProperty("toDay") || this.defaultToDay;
|
|
1229
|
+
get requestDescriptionToStart() {
|
|
1230
|
+
return this._requestDescriptionToStart;
|
|
1011
1231
|
}
|
|
1012
|
-
|
|
1013
|
-
this.
|
|
1232
|
+
get onStart() {
|
|
1233
|
+
return this._onStart;
|
|
1014
1234
|
}
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1235
|
+
get onEnd() {
|
|
1236
|
+
return this._onEnd;
|
|
1237
|
+
}
|
|
1238
|
+
};
|
|
1239
|
+
var StageQuest = class extends Stage {
|
|
1240
|
+
constructor(id, props) {
|
|
1241
|
+
super(id, props);
|
|
1242
|
+
}
|
|
1243
|
+
get completed() {
|
|
1244
|
+
let storedCompleted = this.getStorageProperty("completed");
|
|
1245
|
+
if (storedCompleted) {
|
|
1246
|
+
return storedCompleted;
|
|
1022
1247
|
}
|
|
1023
|
-
|
|
1248
|
+
if (!this.flags.every((flag) => getFlag(flag.flag))) {
|
|
1249
|
+
return false;
|
|
1250
|
+
}
|
|
1251
|
+
if (!this.goals.every((goal) => goal.completed)) {
|
|
1252
|
+
return false;
|
|
1253
|
+
}
|
|
1254
|
+
return true;
|
|
1024
1255
|
}
|
|
1025
|
-
set
|
|
1026
|
-
this.setStorageProperty("
|
|
1256
|
+
set completed(value) {
|
|
1257
|
+
this.setStorageProperty("completed", value);
|
|
1027
1258
|
}
|
|
1028
1259
|
/**
|
|
1029
|
-
*
|
|
1260
|
+
* The list of goals that the player needs to complete to finish the stage.
|
|
1030
1261
|
*/
|
|
1031
|
-
get
|
|
1032
|
-
|
|
1033
|
-
return
|
|
1262
|
+
get goals() {
|
|
1263
|
+
return this.defaultGoals.map((goal) => {
|
|
1264
|
+
return new GoalStage(goal.id, this.id, goal);
|
|
1265
|
+
});
|
|
1266
|
+
}
|
|
1267
|
+
get prevStageEndDay() {
|
|
1268
|
+
return this.getStorageProperty("prevStageEndDay");
|
|
1269
|
+
}
|
|
1270
|
+
set prevStageEndDay(value) {
|
|
1271
|
+
this.setStorageProperty("prevStageEndDay", value);
|
|
1272
|
+
}
|
|
1273
|
+
get startDay() {
|
|
1274
|
+
let prevStageEndDay = this.prevStageEndDay;
|
|
1275
|
+
if (prevStageEndDay === void 0) {
|
|
1276
|
+
return void 0;
|
|
1034
1277
|
}
|
|
1035
|
-
|
|
1036
|
-
|
|
1278
|
+
return prevStageEndDay + this.daysRequiredToStart;
|
|
1279
|
+
}
|
|
1280
|
+
get canStart() {
|
|
1281
|
+
let daysRequired = this.daysRequiredToStart;
|
|
1282
|
+
if (daysRequired > 0) {
|
|
1283
|
+
let prevStageEndDay = this.prevStageEndDay;
|
|
1284
|
+
if (prevStageEndDay === void 0) {
|
|
1285
|
+
return false;
|
|
1286
|
+
}
|
|
1287
|
+
if (prevStageEndDay + daysRequired > TimeManager.currentDay) {
|
|
1288
|
+
return false;
|
|
1289
|
+
}
|
|
1037
1290
|
}
|
|
1038
|
-
if (!this.
|
|
1039
|
-
return
|
|
1291
|
+
if (this.flagsRequiredToStart.length > 0 && !this.flagsRequiredToStart.every((flag) => getFlag(flag.flag))) {
|
|
1292
|
+
return false;
|
|
1040
1293
|
}
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1294
|
+
if (this.questsRequiredToStart.length > 0 && !this.questsRequiredToStart.every(
|
|
1295
|
+
(q) => q.quest.currentStageIndex && q.quest.currentStageIndex >= q.stageNumber
|
|
1296
|
+
)) {
|
|
1297
|
+
return false;
|
|
1044
1298
|
}
|
|
1045
|
-
return
|
|
1299
|
+
return true;
|
|
1046
1300
|
}
|
|
1047
|
-
|
|
1048
|
-
this.
|
|
1301
|
+
get onStart() {
|
|
1302
|
+
if (this.daysRequiredToStart > 0) {
|
|
1303
|
+
this.prevStageEndDay = TimeManager.currentDay;
|
|
1304
|
+
}
|
|
1305
|
+
return super.onStart;
|
|
1306
|
+
}
|
|
1307
|
+
};
|
|
1308
|
+
|
|
1309
|
+
// src/classes/quest/Quest.ts
|
|
1310
|
+
var QUEST_CATEGORY = "__nqtr-quest__";
|
|
1311
|
+
var Quest = class extends StoredClassModel {
|
|
1312
|
+
constructor(id, stages, props) {
|
|
1313
|
+
super(QUEST_CATEGORY, id);
|
|
1314
|
+
this._stages = stages;
|
|
1315
|
+
this._name = props.name || "";
|
|
1316
|
+
this._description = props.description || "";
|
|
1317
|
+
this._renderIcon = props.renderIcon;
|
|
1318
|
+
this._renderImage = props.renderImage;
|
|
1319
|
+
this._isInDevelopment = props.isInDevelopment || false;
|
|
1320
|
+
}
|
|
1321
|
+
get stages() {
|
|
1322
|
+
return this._stages.map((stage, index) => {
|
|
1323
|
+
return new StageQuest(stage.id, stage);
|
|
1324
|
+
});
|
|
1325
|
+
}
|
|
1326
|
+
get name() {
|
|
1327
|
+
return this._name;
|
|
1328
|
+
}
|
|
1329
|
+
get description() {
|
|
1330
|
+
return this._description;
|
|
1049
1331
|
}
|
|
1050
1332
|
/**
|
|
1051
|
-
* The function for rendering the icon of the
|
|
1333
|
+
* The function for rendering the icon of the quest.
|
|
1052
1334
|
*/
|
|
1053
1335
|
get renderIcon() {
|
|
1054
1336
|
let render = this._renderIcon;
|
|
@@ -1063,88 +1345,159 @@ var ActivityStoredAbstract = class {
|
|
|
1063
1345
|
return (props) => render;
|
|
1064
1346
|
}
|
|
1065
1347
|
/**
|
|
1066
|
-
* The function
|
|
1348
|
+
* The function for rendering the image of the quest.
|
|
1067
1349
|
*/
|
|
1068
|
-
get
|
|
1069
|
-
|
|
1070
|
-
|
|
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;
|
|
1350
|
+
get renderImage() {
|
|
1351
|
+
let render = this._renderImage;
|
|
1352
|
+
if (render === void 0) {
|
|
1353
|
+
return void 0;
|
|
1080
1354
|
}
|
|
1081
|
-
|
|
1355
|
+
if (typeof render === "function") {
|
|
1356
|
+
return (props) => {
|
|
1357
|
+
return render(this, props);
|
|
1358
|
+
};
|
|
1359
|
+
}
|
|
1360
|
+
return (props) => render;
|
|
1082
1361
|
}
|
|
1083
|
-
|
|
1084
|
-
|
|
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
|
-
};
|
|
1362
|
+
get isInDevelopment() {
|
|
1363
|
+
return this._isInDevelopment;
|
|
1098
1364
|
}
|
|
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;
|
|
1365
|
+
get currentStageIndex() {
|
|
1366
|
+
return this.getStorageProperty("currentStageIndex");
|
|
1107
1367
|
}
|
|
1108
|
-
|
|
1109
|
-
this.
|
|
1368
|
+
set currentStageIndex(value) {
|
|
1369
|
+
this.setStorageProperty("currentStageIndex", value);
|
|
1110
1370
|
}
|
|
1111
|
-
|
|
1112
|
-
let
|
|
1113
|
-
if (
|
|
1371
|
+
get currentStage() {
|
|
1372
|
+
let index = this.currentStageIndex;
|
|
1373
|
+
if (index === void 0 || index >= this.stages.length) {
|
|
1114
1374
|
return void 0;
|
|
1115
1375
|
}
|
|
1116
|
-
return
|
|
1376
|
+
return this.stages[index];
|
|
1117
1377
|
}
|
|
1118
|
-
get
|
|
1119
|
-
return this.
|
|
1378
|
+
get started() {
|
|
1379
|
+
return this.currentStageIndex !== void 0;
|
|
1120
1380
|
}
|
|
1121
|
-
get
|
|
1122
|
-
return this.
|
|
1381
|
+
get completed() {
|
|
1382
|
+
return this.currentStageIndex === this.stages.length;
|
|
1123
1383
|
}
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1384
|
+
start(props) {
|
|
1385
|
+
if (this.started) {
|
|
1386
|
+
console.warn(`[NQTR] Quest ${this.id} is already started`);
|
|
1387
|
+
return;
|
|
1128
1388
|
}
|
|
1129
|
-
if (this.
|
|
1130
|
-
|
|
1389
|
+
if (this.stages.length === 0) {
|
|
1390
|
+
console.error(`[NQTR] Quest ${this.id} has no stages`);
|
|
1391
|
+
return;
|
|
1131
1392
|
}
|
|
1132
|
-
|
|
1133
|
-
|
|
1393
|
+
this.currentStageIndex = 0;
|
|
1394
|
+
let currentStage = this.currentStage;
|
|
1395
|
+
if (currentStage && currentStage.onStart) {
|
|
1396
|
+
return currentStage.onStart(props);
|
|
1397
|
+
} else {
|
|
1398
|
+
console.error(`[NQTR] Quest ${this.id} has no start stage`);
|
|
1134
1399
|
}
|
|
1135
|
-
|
|
1136
|
-
|
|
1400
|
+
}
|
|
1401
|
+
tryToGoNextStage(startProps, endProps) {
|
|
1402
|
+
if (!this.started) {
|
|
1403
|
+
return;
|
|
1137
1404
|
}
|
|
1138
|
-
if (this.
|
|
1139
|
-
|
|
1405
|
+
if (this.completed) {
|
|
1406
|
+
return;
|
|
1140
1407
|
}
|
|
1141
|
-
|
|
1142
|
-
|
|
1408
|
+
let currentStage = this.currentStage;
|
|
1409
|
+
let currentStageIndex = this.currentStageIndex;
|
|
1410
|
+
if (!currentStage || currentStageIndex === void 0) {
|
|
1411
|
+
console.error(`[NQTR] Quest ${this.id} has no current stage`);
|
|
1412
|
+
return;
|
|
1413
|
+
}
|
|
1414
|
+
if (currentStage.completed) {
|
|
1415
|
+
let nextStageIndex = currentStageIndex + 1;
|
|
1416
|
+
currentStageIndex = nextStageIndex;
|
|
1417
|
+
let nextStage = this.currentStage;
|
|
1418
|
+
if (currentStage && currentStage.onEnd) {
|
|
1419
|
+
currentStage.onEnd(endProps);
|
|
1420
|
+
}
|
|
1421
|
+
if (nextStage && nextStage.onStart) {
|
|
1422
|
+
return nextStage.onStart(startProps);
|
|
1423
|
+
}
|
|
1143
1424
|
}
|
|
1144
|
-
return result;
|
|
1145
1425
|
}
|
|
1146
1426
|
};
|
|
1147
1427
|
|
|
1428
|
+
// src/decorators/QuestDecorator.ts
|
|
1429
|
+
var registeredQuests = {};
|
|
1430
|
+
function newQuest(id, stages, props) {
|
|
1431
|
+
if (registeredQuests[id]) {
|
|
1432
|
+
console.warn(`[NQTR] Quest ${id} already exists, it will be overwritten`);
|
|
1433
|
+
}
|
|
1434
|
+
let quest = new Quest(id, stages, props);
|
|
1435
|
+
registeredQuests[id] = quest;
|
|
1436
|
+
return quest;
|
|
1437
|
+
}
|
|
1438
|
+
function getQuestById(id) {
|
|
1439
|
+
try {
|
|
1440
|
+
let quest = registeredQuests[id];
|
|
1441
|
+
if (!quest) {
|
|
1442
|
+
console.error(`[NQTR] Quest ${id} not found`);
|
|
1443
|
+
return;
|
|
1444
|
+
}
|
|
1445
|
+
return quest;
|
|
1446
|
+
} catch (e) {
|
|
1447
|
+
console.error(`[NQTR] Error while getting Quest ${id}`, e);
|
|
1448
|
+
return;
|
|
1449
|
+
}
|
|
1450
|
+
}
|
|
1451
|
+
|
|
1452
|
+
// src/functions/RoutineFunctions.ts
|
|
1453
|
+
function clearExpiredRoutine() {
|
|
1454
|
+
Object.entries(registeredCommitments).forEach(([_, commitment]) => {
|
|
1455
|
+
if (commitment.isExpired()) {
|
|
1456
|
+
delete registeredCommitments[commitment.id];
|
|
1457
|
+
}
|
|
1458
|
+
});
|
|
1459
|
+
}
|
|
1460
|
+
function getCurrentRoutine() {
|
|
1461
|
+
let character_commitments = {};
|
|
1462
|
+
getTemporaryCommitments().reverse().forEach((c) => {
|
|
1463
|
+
if (!c.hidden) {
|
|
1464
|
+
if (c.characters.length > 0) {
|
|
1465
|
+
let allAvailable = c.characters.every((ch) => !character_commitments[ch.id] || c.priority > character_commitments[ch.id].priority);
|
|
1466
|
+
if (allAvailable) {
|
|
1467
|
+
c.characters.forEach((ch) => {
|
|
1468
|
+
character_commitments[ch.id] = c;
|
|
1469
|
+
});
|
|
1470
|
+
}
|
|
1471
|
+
} else {
|
|
1472
|
+
console.error(`[NQTR] The commitment ${c.id} has no characters assigned`);
|
|
1473
|
+
}
|
|
1474
|
+
}
|
|
1475
|
+
});
|
|
1476
|
+
getFixedRoutine().reverse().forEach((c) => {
|
|
1477
|
+
if (!c.hidden) {
|
|
1478
|
+
if (c.characters.length > 0) {
|
|
1479
|
+
let allAvailable = c.characters.every((ch) => !character_commitments[ch.id] || c.priority > character_commitments[ch.id].priority);
|
|
1480
|
+
if (allAvailable) {
|
|
1481
|
+
c.characters.forEach((ch) => {
|
|
1482
|
+
character_commitments[ch.id] = c;
|
|
1483
|
+
});
|
|
1484
|
+
}
|
|
1485
|
+
} else {
|
|
1486
|
+
console.error(`[NQTR] The commitment ${c.id} has no characters assigned`);
|
|
1487
|
+
}
|
|
1488
|
+
}
|
|
1489
|
+
});
|
|
1490
|
+
return Object.values(character_commitments);
|
|
1491
|
+
}
|
|
1492
|
+
function getCommitmentByCharacter(character) {
|
|
1493
|
+
getCurrentRoutine().forEach((c) => {
|
|
1494
|
+
if (c.characters.map((ch) => ch.id).includes(character.id)) {
|
|
1495
|
+
return c;
|
|
1496
|
+
}
|
|
1497
|
+
});
|
|
1498
|
+
return void 0;
|
|
1499
|
+
}
|
|
1500
|
+
|
|
1148
1501
|
// src/classes/navigation/Room.ts
|
|
1149
1502
|
var ROOM_CATEGORY = "__nqtr-room__";
|
|
1150
1503
|
var RoomBaseModel = class extends StoredClassModel {
|
|
@@ -1381,130 +1734,6 @@ var RoomBaseModel = class extends StoredClassModel {
|
|
|
1381
1734
|
return commitments.filter((c) => c.room.id === this.id);
|
|
1382
1735
|
}
|
|
1383
1736
|
};
|
|
1384
|
-
|
|
1385
|
-
// src/classes/quest/Goal.ts
|
|
1386
|
-
var Goal = class {
|
|
1387
|
-
constructor(props) {
|
|
1388
|
-
this._description = props.description;
|
|
1389
|
-
this.need = props.need || 1;
|
|
1390
|
-
this.have = props.have || 0;
|
|
1391
|
-
}
|
|
1392
|
-
get description() {
|
|
1393
|
-
return this._description;
|
|
1394
|
-
}
|
|
1395
|
-
get isComplete() {
|
|
1396
|
-
return this.have >= this.need;
|
|
1397
|
-
}
|
|
1398
|
-
setComplete() {
|
|
1399
|
-
this.have = this.need;
|
|
1400
|
-
}
|
|
1401
|
-
find() {
|
|
1402
|
-
this.have++;
|
|
1403
|
-
}
|
|
1404
|
-
get export() {
|
|
1405
|
-
return {
|
|
1406
|
-
description: this.description,
|
|
1407
|
-
need: this.need,
|
|
1408
|
-
have: this.have
|
|
1409
|
-
};
|
|
1410
|
-
}
|
|
1411
|
-
};
|
|
1412
|
-
var QUEST_CATEGORY = "__nqtr-quest__";
|
|
1413
|
-
var QuestBaseModel = class extends StoredClassModel {
|
|
1414
|
-
constructor(id, stages, props) {
|
|
1415
|
-
super(QUEST_CATEGORY, id);
|
|
1416
|
-
this._stages = stages;
|
|
1417
|
-
this._name = props.name || "";
|
|
1418
|
-
this._description = props.description || "";
|
|
1419
|
-
this._icon = props.icon || "";
|
|
1420
|
-
this._image = props.image || "";
|
|
1421
|
-
this._isInDevelopment = props.isInDevelopment || false;
|
|
1422
|
-
}
|
|
1423
|
-
get stages() {
|
|
1424
|
-
return this._stages;
|
|
1425
|
-
}
|
|
1426
|
-
get name() {
|
|
1427
|
-
return this._name;
|
|
1428
|
-
}
|
|
1429
|
-
get description() {
|
|
1430
|
-
return this._description;
|
|
1431
|
-
}
|
|
1432
|
-
get icon() {
|
|
1433
|
-
return this._icon;
|
|
1434
|
-
}
|
|
1435
|
-
get image() {
|
|
1436
|
-
return this._image;
|
|
1437
|
-
}
|
|
1438
|
-
get isInDevelopment() {
|
|
1439
|
-
return this._isInDevelopment;
|
|
1440
|
-
}
|
|
1441
|
-
};
|
|
1442
|
-
var STAGE_CATEGORY = "__nqtr-stage__";
|
|
1443
|
-
var StageBaseModel = class extends StoredClassModel {
|
|
1444
|
-
constructor(id, props) {
|
|
1445
|
-
super(STAGE_CATEGORY, id);
|
|
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;
|
|
1459
|
-
}
|
|
1460
|
-
get completed() {
|
|
1461
|
-
return this._completed;
|
|
1462
|
-
}
|
|
1463
|
-
get active() {
|
|
1464
|
-
return this._active;
|
|
1465
|
-
}
|
|
1466
|
-
get goals() {
|
|
1467
|
-
let list = this.getStorageProperty("goals");
|
|
1468
|
-
if (!list) {
|
|
1469
|
-
return this.defaultGoals;
|
|
1470
|
-
}
|
|
1471
|
-
return list.map((goal) => new Goal(goal));
|
|
1472
|
-
}
|
|
1473
|
-
set goals(value) {
|
|
1474
|
-
let list = value.map((goal) => goal.export);
|
|
1475
|
-
this.setStorageProperty("goals", list);
|
|
1476
|
-
}
|
|
1477
|
-
get name() {
|
|
1478
|
-
return this._name;
|
|
1479
|
-
}
|
|
1480
|
-
get description() {
|
|
1481
|
-
return this._description;
|
|
1482
|
-
}
|
|
1483
|
-
get adviceDescription() {
|
|
1484
|
-
return this._adviceDescription;
|
|
1485
|
-
}
|
|
1486
|
-
get image() {
|
|
1487
|
-
return this._image;
|
|
1488
|
-
}
|
|
1489
|
-
get daysRequiredToStart() {
|
|
1490
|
-
return this._daysRequiredToStart;
|
|
1491
|
-
}
|
|
1492
|
-
get flagsRequired() {
|
|
1493
|
-
return this._flagsRequired;
|
|
1494
|
-
}
|
|
1495
|
-
get questsRequired() {
|
|
1496
|
-
return this._questsRequired;
|
|
1497
|
-
}
|
|
1498
|
-
get requestDescription() {
|
|
1499
|
-
return this._requestDescription;
|
|
1500
|
-
}
|
|
1501
|
-
get onStart() {
|
|
1502
|
-
return this._onStart;
|
|
1503
|
-
}
|
|
1504
|
-
get onEnd() {
|
|
1505
|
-
return this._onEnd;
|
|
1506
|
-
}
|
|
1507
|
-
};
|
|
1508
1737
|
var CURRENT_ROOM_MEMORY_KEY = "___nqtr-current_room_memory___";
|
|
1509
1738
|
function setCurrentRoom(room) {
|
|
1510
1739
|
if (room instanceof LocationBaseModel) {
|
|
@@ -1565,6 +1794,6 @@ function currentActivities() {
|
|
|
1565
1794
|
return currentRoom.activities.filter((activity) => !activity.hidden);
|
|
1566
1795
|
}
|
|
1567
1796
|
|
|
1568
|
-
export { ActivityModel, CommitmentBaseModel, Goal, LocationBaseModel, MapBaseModel,
|
|
1797
|
+
export { ActivityModel, ActivityRoom, CommitmentBaseModel, Goal, LocationBaseModel, MapBaseModel, RoomBaseModel, Stage, TimeManager, addCommitment, clearExpiredActivities, clearExpiredRoutine, currentActivities, getActivityById, getAllLocations, getAllMaps, getCommitmentByCharacter, getCommitmentById, getCueerntMap, getCurrenrLocation, getCurrentRoom, getCurrentRoutine, getQuestById, getRoomById, newQuest, removeCommitment, saveActivity, saveCommitment, saveRoom, setCurrentRoom, setFixedRoutine };
|
|
1569
1798
|
//# sourceMappingURL=out.js.map
|
|
1570
1799
|
//# sourceMappingURL=index.mjs.map
|