@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.
Files changed (155) hide show
  1. package/dist/{ActivityProps-_79x9-BX.d.ts → ActivityProps-BkHX8xkA.d.ts} +1 -1
  2. package/dist/{ActivityProps-BoJeWa2B.d.mts → ActivityProps-D45DQdcT.d.mts} +1 -1
  3. package/dist/{Commitment-Cc2kZEy0.d.ts → Commitment-BJTIpBQ5.d.ts} +4 -2
  4. package/dist/{Commitment-C3Nc2RJH.d.mts → Commitment-CtNWnNQX.d.mts} +4 -2
  5. package/dist/StageProps-DCZkZHwZ.d.ts +197 -0
  6. package/dist/StageProps-xLLR0rjD.d.mts +197 -0
  7. package/dist/classes/Activity.d.mts +2 -2
  8. package/dist/classes/Activity.d.ts +2 -2
  9. package/dist/classes/Activity.js +1 -1
  10. package/dist/classes/Activity.js.map +1 -1
  11. package/dist/classes/Activity.mjs +1 -1
  12. package/dist/classes/Activity.mjs.map +1 -1
  13. package/dist/classes/ActivityStoredAbstract.d.mts +1 -1
  14. package/dist/classes/ActivityStoredAbstract.d.ts +1 -1
  15. package/dist/classes/ActivityStoredAbstract.js +1 -1
  16. package/dist/classes/ActivityStoredAbstract.js.map +1 -1
  17. package/dist/classes/ActivityStoredAbstract.mjs +1 -1
  18. package/dist/classes/ActivityStoredAbstract.mjs.map +1 -1
  19. package/dist/classes/Commitment.d.mts +2 -2
  20. package/dist/classes/Commitment.d.ts +2 -2
  21. package/dist/classes/Commitment.js +2 -2
  22. package/dist/classes/Commitment.js.map +1 -1
  23. package/dist/classes/Commitment.mjs +2 -2
  24. package/dist/classes/Commitment.mjs.map +1 -1
  25. package/dist/classes/index.d.mts +4 -4
  26. package/dist/classes/index.d.ts +4 -4
  27. package/dist/classes/index.js +290 -322
  28. package/dist/classes/index.js.map +1 -1
  29. package/dist/classes/index.mjs +289 -321
  30. package/dist/classes/index.mjs.map +1 -1
  31. package/dist/classes/navigation/ActivityRoom.d.mts +2 -2
  32. package/dist/classes/navigation/ActivityRoom.d.ts +2 -2
  33. package/dist/classes/navigation/ActivityRoom.js +2 -2
  34. package/dist/classes/navigation/ActivityRoom.js.map +1 -1
  35. package/dist/classes/navigation/ActivityRoom.mjs +2 -2
  36. package/dist/classes/navigation/ActivityRoom.mjs.map +1 -1
  37. package/dist/classes/navigation/Location.d.mts +2 -2
  38. package/dist/classes/navigation/Location.d.ts +2 -2
  39. package/dist/classes/navigation/Map.d.mts +2 -2
  40. package/dist/classes/navigation/Map.d.ts +2 -2
  41. package/dist/classes/navigation/Room.d.mts +2 -2
  42. package/dist/classes/navigation/Room.d.ts +2 -2
  43. package/dist/classes/navigation/Room.js +34 -36
  44. package/dist/classes/navigation/Room.js.map +1 -1
  45. package/dist/classes/navigation/Room.mjs +34 -36
  46. package/dist/classes/navigation/Room.mjs.map +1 -1
  47. package/dist/classes/quest/Goal.d.mts +21 -13
  48. package/dist/classes/quest/Goal.d.ts +21 -13
  49. package/dist/classes/quest/Goal.js +50 -15
  50. package/dist/classes/quest/Goal.js.map +1 -1
  51. package/dist/classes/quest/Goal.mjs +47 -15
  52. package/dist/classes/quest/Goal.mjs.map +1 -1
  53. package/dist/classes/quest/Quest.d.mts +3 -2
  54. package/dist/classes/quest/Quest.d.ts +3 -2
  55. package/dist/classes/quest/Quest.js +536 -9
  56. package/dist/classes/quest/Quest.js.map +1 -1
  57. package/dist/classes/quest/Quest.mjs +537 -10
  58. package/dist/classes/quest/Quest.mjs.map +1 -1
  59. package/dist/classes/quest/Stage.d.mts +3 -2
  60. package/dist/classes/quest/Stage.d.ts +3 -2
  61. package/dist/classes/quest/Stage.js +396 -51
  62. package/dist/classes/quest/Stage.js.map +1 -1
  63. package/dist/classes/quest/Stage.mjs +394 -52
  64. package/dist/classes/quest/Stage.mjs.map +1 -1
  65. package/dist/decorators/ActivityDecorator.d.mts +1 -1
  66. package/dist/decorators/ActivityDecorator.d.ts +1 -1
  67. package/dist/decorators/CommitmentDecorator.d.mts +9 -3
  68. package/dist/decorators/CommitmentDecorator.d.ts +9 -3
  69. package/dist/decorators/CommitmentDecorator.js +15 -0
  70. package/dist/decorators/CommitmentDecorator.js.map +1 -1
  71. package/dist/decorators/CommitmentDecorator.mjs +15 -1
  72. package/dist/decorators/CommitmentDecorator.mjs.map +1 -1
  73. package/dist/decorators/QuestDecorator.d.mts +26 -0
  74. package/dist/decorators/QuestDecorator.d.ts +26 -0
  75. package/dist/decorators/QuestDecorator.js +592 -0
  76. package/dist/decorators/QuestDecorator.js.map +1 -0
  77. package/dist/decorators/QuestDecorator.mjs +588 -0
  78. package/dist/decorators/QuestDecorator.mjs.map +1 -0
  79. package/dist/decorators/RoomDecorator.d.mts +2 -2
  80. package/dist/decorators/RoomDecorator.d.ts +2 -2
  81. package/dist/decorators/index.d.mts +8 -3
  82. package/dist/decorators/index.d.ts +8 -3
  83. package/dist/decorators/index.js +598 -0
  84. package/dist/decorators/index.js.map +1 -1
  85. package/dist/decorators/index.mjs +597 -2
  86. package/dist/decorators/index.mjs.map +1 -1
  87. package/dist/functions/ActivityFunctions.d.mts +2 -2
  88. package/dist/functions/ActivityFunctions.d.ts +2 -2
  89. package/dist/functions/ActivityFunctions.js.map +1 -1
  90. package/dist/functions/ActivityFunctions.mjs.map +1 -1
  91. package/dist/functions/NavigationFunctions.d.mts +2 -2
  92. package/dist/functions/NavigationFunctions.d.ts +2 -2
  93. package/dist/functions/NavigationFunctions.js.map +1 -1
  94. package/dist/functions/NavigationFunctions.mjs.map +1 -1
  95. package/dist/functions/RoutineFunctions.d.mts +2 -2
  96. package/dist/functions/RoutineFunctions.d.ts +2 -2
  97. package/dist/functions/RoutineFunctions.js.map +1 -1
  98. package/dist/functions/RoutineFunctions.mjs.map +1 -1
  99. package/dist/functions/index.d.mts +2 -2
  100. package/dist/functions/index.d.ts +2 -2
  101. package/dist/functions/index.js.map +1 -1
  102. package/dist/functions/index.mjs.map +1 -1
  103. package/dist/index.d.mts +6 -5
  104. package/dist/index.d.ts +6 -5
  105. package/dist/index.js +540 -308
  106. package/dist/index.js.map +1 -1
  107. package/dist/index.mjs +536 -307
  108. package/dist/index.mjs.map +1 -1
  109. package/dist/interface/ActivityProps.d.mts +1 -1
  110. package/dist/interface/ActivityProps.d.ts +1 -1
  111. package/dist/interface/CommitmentProps.d.mts +2 -2
  112. package/dist/interface/CommitmentProps.d.ts +2 -2
  113. package/dist/interface/RoomActivityMemory.d.mts +1 -1
  114. package/dist/interface/RoomActivityMemory.d.ts +1 -1
  115. package/dist/interface/RoomProps.d.mts +2 -2
  116. package/dist/interface/RoomProps.d.ts +2 -2
  117. package/dist/interface/index.d.mts +4 -4
  118. package/dist/interface/index.d.ts +4 -4
  119. package/dist/interface/navigation/LocationProps.d.mts +2 -2
  120. package/dist/interface/navigation/LocationProps.d.ts +2 -2
  121. package/dist/interface/navigation/MapProps.d.mts +2 -2
  122. package/dist/interface/navigation/MapProps.d.ts +2 -2
  123. package/dist/interface/quest/GoalProps.d.mts +12 -0
  124. package/dist/interface/quest/GoalProps.d.ts +12 -0
  125. package/dist/interface/quest/QuestProps.d.mts +6 -9
  126. package/dist/interface/quest/QuestProps.d.ts +6 -9
  127. package/dist/interface/quest/StageFlags.d.mts +12 -0
  128. package/dist/interface/quest/StageFlags.d.ts +12 -0
  129. package/dist/interface/quest/StageFlags.js +4 -0
  130. package/dist/interface/quest/StageFlags.js.map +1 -0
  131. package/dist/interface/quest/StageFlags.mjs +3 -0
  132. package/dist/interface/quest/StageFlags.mjs.map +1 -0
  133. package/dist/interface/quest/StageProps.d.mts +3 -2
  134. package/dist/interface/quest/StageProps.d.ts +3 -2
  135. package/dist/override/OnEndStage.d.mts +19 -0
  136. package/dist/override/OnEndStage.d.ts +19 -0
  137. package/dist/override/OnEndStage.js +4 -0
  138. package/dist/override/OnEndStage.js.map +1 -0
  139. package/dist/override/OnEndStage.mjs +3 -0
  140. package/dist/override/OnEndStage.mjs.map +1 -0
  141. package/dist/override/OnStartStage.d.mts +19 -0
  142. package/dist/override/OnStartStage.d.ts +19 -0
  143. package/dist/override/OnStartStage.js +4 -0
  144. package/dist/override/OnStartStage.js.map +1 -0
  145. package/dist/override/OnStartStage.mjs +3 -0
  146. package/dist/override/OnStartStage.mjs.map +1 -0
  147. package/dist/override/index.d.mts +2 -0
  148. package/dist/override/index.d.ts +2 -0
  149. package/dist/types/QuestsRequired.d.mts +3 -2
  150. package/dist/types/QuestsRequired.d.ts +3 -2
  151. package/dist/types/index.d.mts +3 -2
  152. package/dist/types/index.d.ts +3 -2
  153. package/package.json +2 -2
  154. package/dist/Quest-Bdm0R9LA.d.mts +0 -71
  155. package/dist/Quest-CxJcXETG.d.ts +0 -71
@@ -361,7 +361,7 @@ var ActivityModel = class {
361
361
  /**
362
362
  * The function that is called when the activity is runned.
363
363
  */
364
- get onRun() {
364
+ get run() {
365
365
  return (props) => this._onRun(this, props);
366
366
  }
367
367
  /**
@@ -491,6 +491,7 @@ var CommitmentBaseModel = class extends pixiVn.StoredClassModel {
491
491
  }
492
492
  /**
493
493
  * 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.
494
+ * If you set "automatic" remember to remove the commitment when it is no longer needed, because otherwise it repeats itself every time.
494
495
  */
495
496
  get executionType() {
496
497
  return this._executionType;
@@ -513,10 +514,9 @@ var CommitmentBaseModel = class extends pixiVn.StoredClassModel {
513
514
  /**
514
515
  * Is a function that is called when the player interacts with the character.
515
516
  */
516
- get onRun() {
517
+ get run() {
517
518
  let onRun = this._onRun;
518
519
  if (!onRun) {
519
- console.warn("[NQTR] onRun() is not defined for commitmen, so it will not run.", this);
520
520
  return;
521
521
  }
522
522
  return (props) => onRun(this, props);
@@ -577,6 +577,199 @@ var CommitmentBaseModel = class extends pixiVn.StoredClassModel {
577
577
  return false;
578
578
  }
579
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 run() {
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
+ };
580
773
 
581
774
  // src/decorators/RoomDecorator.ts
582
775
  var registeredRooms = {};
@@ -830,141 +1023,60 @@ function getTemporaryCommitments() {
830
1023
  let commitments = commitmentsIds.map((id) => getCommitmentById(id)).filter((commitment) => commitment !== void 0);
831
1024
  return commitments;
832
1025
  }
833
-
834
- // src/functions/RoutineFunctions.ts
835
- function getCurrentRoutine() {
836
- let character_commitments = {};
837
- getTemporaryCommitments().reverse().forEach((c) => {
838
- if (!c.hidden) {
839
- if (c.characters.length > 0) {
840
- let allAvailable = c.characters.every((ch) => !character_commitments[ch.id] || c.priority > character_commitments[ch.id].priority);
841
- if (allAvailable) {
842
- c.characters.forEach((ch) => {
843
- character_commitments[ch.id] = c;
844
- });
845
- }
846
- } else {
847
- console.error(`[NQTR] The commitment ${c.id} has no characters assigned`);
848
- }
849
- }
850
- });
851
- getFixedRoutine().reverse().forEach((c) => {
852
- if (!c.hidden) {
853
- if (c.characters.length > 0) {
854
- let allAvailable = c.characters.every((ch) => !character_commitments[ch.id] || c.priority > character_commitments[ch.id].priority);
855
- if (allAvailable) {
856
- c.characters.forEach((ch) => {
857
- character_commitments[ch.id] = c;
858
- });
859
- }
860
- } else {
861
- console.error(`[NQTR] The commitment ${c.id} has no characters assigned`);
862
- }
863
- }
864
- });
865
- return Object.values(character_commitments);
866
- }
867
- var ActivityStoredAbstract = class {
868
- /**
869
- * @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.
870
- * @param props The activity properties.
871
- */
872
- constructor(onRun, props) {
873
- this.defaultName = props.name;
874
- this.defaultFromHour = props.fromHour;
875
- this.defaultToHour = props.toHour;
876
- this.defaultFromDay = props.fromDay;
877
- this.defaultToDay = props.toDay;
878
- this.defaultDisabled = props.disabled || false;
879
- this.defaultHidden = props.hidden || false;
880
- this._renderIcon = props.renderIcon;
881
- this._onRun = onRun;
882
- }
883
- /**
884
- * The name
885
- */
886
- get name() {
887
- return this.getStorageProperty("name") || this.defaultName || "";
888
- }
889
- set name(value) {
890
- this.setStorageProperty("name", value);
891
- }
892
- /**
893
- * The hour when the activity starts. If the activity is not started yet, it will be hidden.
894
- */
895
- get fromHour() {
896
- return this.getStorageProperty("fromHour") || this.defaultFromHour || TimeManager.minDayHours;
897
- }
898
- set fromHour(value) {
899
- this.setStorageProperty("fromHour", value);
900
- }
901
- /**
902
- * The hour when the activity ends. If the activity is ended yet, it will be hidden.
903
- */
904
- get toHour() {
905
- return this.getStorageProperty("toHour") || this.defaultToHour || TimeManager.maxDayHours + 1;
906
- }
907
- set toHour(value) {
908
- this.setStorageProperty("toHour", value);
1026
+ var GOAL_CATEGORY = "__nqtr-goal__";
1027
+ var Goal = class extends pixiVn.StoredClassModel {
1028
+ constructor(id, props) {
1029
+ super(GOAL_CATEGORY, id);
1030
+ this._description = props.description;
1031
+ this._need = props.need || 1;
1032
+ this._defaultHave = props.have || 0;
909
1033
  }
910
1034
  /**
911
- * The day when the activity starts. If the activity is not started yet, it will be hidden.
1035
+ * The description of the goal.
912
1036
  */
913
- get fromDay() {
914
- return this.getStorageProperty("fromDay") || this.defaultFromDay;
915
- }
916
- set fromDay(value) {
917
- this.setStorageProperty("fromDay", value);
1037
+ get description() {
1038
+ return this._description;
918
1039
  }
919
- /**
920
- * The day when the activity ends. If the activity is ended yet, it will be deleted or hidden.
921
- */
922
- get toDay() {
923
- return this.getStorageProperty("toDay") || this.defaultToDay;
1040
+ get need() {
1041
+ return this._need;
924
1042
  }
925
- set toDay(value) {
926
- this.setStorageProperty("toDay", value);
1043
+ get defaultHave() {
1044
+ return this._defaultHave;
927
1045
  }
928
- /**
929
- * Whether is disabled.
930
- */
931
- get disabled() {
932
- let value = this.getStorageProperty("disabled") || this.defaultDisabled;
933
- if (typeof value === "string") {
934
- return pixiVn.getFlag(value);
935
- }
936
- return value;
1046
+ };
1047
+
1048
+ // src/classes/quest/Stage.ts
1049
+ var STAGE_CATEGORY = "__nqtr-stage__";
1050
+ var Stage = class extends pixiVn.StoredClassModel {
1051
+ constructor(id, props) {
1052
+ super(STAGE_CATEGORY, id);
1053
+ this._name = props.name || "";
1054
+ this._defaultGoals = props.goals || [];
1055
+ this._flags = props.flags || [];
1056
+ this._description = props.description || "";
1057
+ this._adviceDescription = props.adviceDescription || "";
1058
+ this._renderImage = props.renderImage;
1059
+ this._daysRequiredToStart = props.daysRequiredToStart;
1060
+ this._flagsRequiredToStart = props.flagsRequired || [];
1061
+ this._questsRequiredToStart = props.questsRequired || [];
1062
+ this._requestDescriptionToStart = props.requestDescription || "";
1063
+ this._onStart = props.onStart;
1064
+ this._onEnd = props.onEnd;
937
1065
  }
938
- set disabled(value) {
939
- this.setStorageProperty("disabled", value);
1066
+ get name() {
1067
+ return this._name;
940
1068
  }
941
- /**
942
- * Whether is hidden. If the activity is not started yet, it will be hidden.
943
- */
944
- get hidden() {
945
- if (this.fromDay && this.fromDay > TimeManager.currentDay) {
946
- return true;
947
- }
948
- if (!TimeManager.nowIsBetween(this.fromHour, this.toHour)) {
949
- return true;
950
- }
951
- if (!this.isExpired) {
952
- return true;
953
- }
954
- let value = this.getStorageProperty("hidden") || this.defaultHidden;
955
- if (typeof value === "string") {
956
- return pixiVn.getFlag(value);
957
- }
958
- return value;
1069
+ get description() {
1070
+ return this._description;
959
1071
  }
960
- set hidden(value) {
961
- this.setStorageProperty("hidden", value);
1072
+ get adviceDescription() {
1073
+ return this._adviceDescription;
962
1074
  }
963
1075
  /**
964
- * The function for rendering the icon of the activity.
1076
+ * The function for rendering the image of the stage.
965
1077
  */
966
- get renderIcon() {
967
- let render = this._renderIcon;
1078
+ get renderImage() {
1079
+ let render = this._renderImage;
968
1080
  if (render === void 0) {
969
1081
  return void 0;
970
1082
  }
@@ -975,88 +1087,68 @@ var ActivityStoredAbstract = class {
975
1087
  }
976
1088
  return (props) => render;
977
1089
  }
978
- /**
979
- * The function that is called when the activity is runned.
980
- */
981
- get onRun() {
982
- return (props) => {
983
- return this._onRun(this, props);
984
- };
1090
+ get defaultGoals() {
1091
+ return this._defaultGoals;
985
1092
  }
986
1093
  /**
987
- * Whether the activity is a deadline.
988
- * @returns Whether the activity is a deadline.
1094
+ * The list of flags that the player must complete to finish the stage.
989
1095
  */
990
- isExpired() {
991
- if (this.toDay && this.toDay <= TimeManager.currentDay) {
992
- return true;
993
- }
994
- return false;
1096
+ get flags() {
1097
+ return this._flags;
995
1098
  }
996
- /**
997
- * Export the activity properties.
998
- * @returns The activity properties.
999
- */
1000
- export() {
1001
- return {
1002
- name: this.getStorageProperty("name") || this.defaultName,
1003
- fromHour: this.getStorageProperty("fromHour") || this.defaultFromHour,
1004
- toHour: this.getStorageProperty("toHour") || this.defaultToHour,
1005
- fromDay: this.getStorageProperty("fromDay") || this.defaultFromDay,
1006
- toDay: this.getStorageProperty("toDay") || this.defaultToDay,
1007
- disabled: this.getStorageProperty("disabled") || this.defaultDisabled,
1008
- hidden: this.getStorageProperty("hidden") || this.defaultHidden,
1009
- renderIcon: this._renderIcon
1010
- };
1099
+ get daysRequiredToStart() {
1100
+ return this._daysRequiredToStart || 0;
1011
1101
  }
1012
- };
1013
-
1014
- // src/classes/navigation/ActivityRoom.ts
1015
- var ActivityRoom = class extends ActivityStoredAbstract {
1016
- constructor(id, room, onRun, props) {
1017
- super(onRun, props);
1018
- this._id = id;
1019
- this._room = room;
1102
+ get flagsRequiredToStart() {
1103
+ return this._flagsRequiredToStart;
1020
1104
  }
1021
- setStorageProperty(_, __) {
1022
- this._room.setActivity(this);
1105
+ get questsRequiredToStart() {
1106
+ return this._questsRequiredToStart || [];
1023
1107
  }
1024
- getStorageProperty(propertyName) {
1025
- let activity = this._room.getActivityMemory(this.id);
1026
- if (!activity || !activity.hasOwnProperty(propertyName)) {
1027
- return void 0;
1028
- }
1029
- return activity[propertyName];
1108
+ get requestDescriptionToStart() {
1109
+ return this._requestDescriptionToStart;
1030
1110
  }
1031
- get id() {
1032
- return this._id;
1111
+ get onStart() {
1112
+ return this._onStart;
1033
1113
  }
1034
- get room() {
1035
- return this._room;
1114
+ get onEnd() {
1115
+ return this._onEnd;
1036
1116
  }
1037
- export() {
1038
- let result = {};
1039
- if (this.name !== void 0) {
1040
- result["name"] = this.name;
1041
- }
1042
- if (this.fromHour !== void 0) {
1043
- result["fromHour"] = this.fromHour;
1044
- }
1045
- if (this.toHour !== void 0) {
1046
- result["toHour"] = this.toHour;
1047
- }
1048
- if (this.fromDay !== void 0) {
1049
- result["fromDay"] = this.fromDay;
1050
- }
1051
- if (this.toDay !== void 0) {
1052
- result["toDay"] = this.toDay;
1117
+ };
1118
+
1119
+ // src/functions/RoutineFunctions.ts
1120
+ function getCurrentRoutine() {
1121
+ let character_commitments = {};
1122
+ getTemporaryCommitments().reverse().forEach((c) => {
1123
+ if (!c.hidden) {
1124
+ if (c.characters.length > 0) {
1125
+ let allAvailable = c.characters.every((ch) => !character_commitments[ch.id] || c.priority > character_commitments[ch.id].priority);
1126
+ if (allAvailable) {
1127
+ c.characters.forEach((ch) => {
1128
+ character_commitments[ch.id] = c;
1129
+ });
1130
+ }
1131
+ } else {
1132
+ console.error(`[NQTR] The commitment ${c.id} has no characters assigned`);
1133
+ }
1053
1134
  }
1054
- if (this.disabled !== void 0) {
1055
- result["disabled"] = this.disabled;
1135
+ });
1136
+ getFixedRoutine().reverse().forEach((c) => {
1137
+ if (!c.hidden) {
1138
+ if (c.characters.length > 0) {
1139
+ let allAvailable = c.characters.every((ch) => !character_commitments[ch.id] || c.priority > character_commitments[ch.id].priority);
1140
+ if (allAvailable) {
1141
+ c.characters.forEach((ch) => {
1142
+ character_commitments[ch.id] = c;
1143
+ });
1144
+ }
1145
+ } else {
1146
+ console.error(`[NQTR] The commitment ${c.id} has no characters assigned`);
1147
+ }
1056
1148
  }
1057
- return result;
1058
- }
1059
- };
1149
+ });
1150
+ return Object.values(character_commitments);
1151
+ }
1060
1152
 
1061
1153
  // src/classes/navigation/Room.ts
1062
1154
  var ROOM_CATEGORY = "__nqtr-room__";
@@ -1295,137 +1387,13 @@ var RoomBaseModel = class extends pixiVn.StoredClassModel {
1295
1387
  }
1296
1388
  };
1297
1389
 
1298
- // src/classes/quest/Goal.ts
1299
- var Goal = class {
1300
- constructor(props) {
1301
- this._description = props.description;
1302
- this.need = props.need || 1;
1303
- this.have = props.have || 0;
1304
- }
1305
- get description() {
1306
- return this._description;
1307
- }
1308
- get isComplete() {
1309
- return this.have >= this.need;
1310
- }
1311
- setComplete() {
1312
- this.have = this.need;
1313
- }
1314
- find() {
1315
- this.have++;
1316
- }
1317
- get export() {
1318
- return {
1319
- description: this.description,
1320
- need: this.need,
1321
- have: this.have
1322
- };
1323
- }
1324
- };
1325
- var QUEST_CATEGORY = "__nqtr-quest__";
1326
- var QuestBaseModel = class extends pixiVn.StoredClassModel {
1327
- constructor(id, stages, props) {
1328
- super(QUEST_CATEGORY, id);
1329
- this._stages = stages;
1330
- this._name = props.name || "";
1331
- this._description = props.description || "";
1332
- this._icon = props.icon || "";
1333
- this._image = props.image || "";
1334
- this._isInDevelopment = props.isInDevelopment || false;
1335
- }
1336
- get stages() {
1337
- return this._stages;
1338
- }
1339
- get name() {
1340
- return this._name;
1341
- }
1342
- get description() {
1343
- return this._description;
1344
- }
1345
- get icon() {
1346
- return this._icon;
1347
- }
1348
- get image() {
1349
- return this._image;
1350
- }
1351
- get isInDevelopment() {
1352
- return this._isInDevelopment;
1353
- }
1354
- };
1355
- var STAGE_CATEGORY = "__nqtr-stage__";
1356
- var StageBaseModel = class extends pixiVn.StoredClassModel {
1357
- constructor(id, props) {
1358
- super(STAGE_CATEGORY, id);
1359
- this._completed = false;
1360
- this._active = false;
1361
- this.defaultGoals = [];
1362
- this._name = props.name || "";
1363
- this._description = props.description || "";
1364
- this._adviceDescription = props.adviceDescription || "";
1365
- this._image = props.image || "";
1366
- this._daysRequiredToStart = props.daysRequiredToStart;
1367
- this._flagsRequired = props.flagsRequired;
1368
- this._questsRequired = props.questsRequired;
1369
- this._requestDescription = props.requestDescription || "";
1370
- this._onStart = props.onStart;
1371
- this._onEnd = props.onEnd;
1372
- }
1373
- get completed() {
1374
- return this._completed;
1375
- }
1376
- get active() {
1377
- return this._active;
1378
- }
1379
- get goals() {
1380
- let list = this.getStorageProperty("goals");
1381
- if (!list) {
1382
- return this.defaultGoals;
1383
- }
1384
- return list.map((goal) => new Goal(goal));
1385
- }
1386
- set goals(value) {
1387
- let list = value.map((goal) => goal.export);
1388
- this.setStorageProperty("goals", list);
1389
- }
1390
- get name() {
1391
- return this._name;
1392
- }
1393
- get description() {
1394
- return this._description;
1395
- }
1396
- get adviceDescription() {
1397
- return this._adviceDescription;
1398
- }
1399
- get image() {
1400
- return this._image;
1401
- }
1402
- get daysRequiredToStart() {
1403
- return this._daysRequiredToStart;
1404
- }
1405
- get flagsRequired() {
1406
- return this._flagsRequired;
1407
- }
1408
- get questsRequired() {
1409
- return this._questsRequired;
1410
- }
1411
- get requestDescription() {
1412
- return this._requestDescription;
1413
- }
1414
- get onStart() {
1415
- return this._onStart;
1416
- }
1417
- get onEnd() {
1418
- return this._onEnd;
1419
- }
1420
- };
1421
-
1422
1390
  exports.ActivityModel = ActivityModel;
1391
+ exports.ActivityRoom = ActivityRoom;
1423
1392
  exports.CommitmentBaseModel = CommitmentBaseModel;
1424
1393
  exports.Goal = Goal;
1425
1394
  exports.LocationBaseModel = LocationBaseModel;
1426
1395
  exports.MapBaseModel = MapBaseModel;
1427
- exports.QuestBaseModel = QuestBaseModel;
1428
1396
  exports.RoomBaseModel = RoomBaseModel;
1429
- exports.StageBaseModel = StageBaseModel;
1397
+ exports.Stage = Stage;
1430
1398
  //# sourceMappingURL=out.js.map
1431
1399
  //# sourceMappingURL=index.js.map