@drincs/nqtr 0.2.2 → 0.2.4

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 (105) hide show
  1. package/dist/{Commitment-Eox2652k.d.mts → Commitment-BHB-jYOi.d.mts} +2 -2
  2. package/dist/{Commitment-D3LPSbFX.d.ts → Commitment-D-1lsnnU.d.ts} +2 -2
  3. package/dist/{StageProps-D002cyay.d.mts → StageProps-W85kcacG.d.mts} +11 -4
  4. package/dist/{StageProps-DleWO-vf.d.ts → StageProps-vR-NLl0n.d.ts} +11 -4
  5. package/dist/classes/Commitment.d.mts +1 -1
  6. package/dist/classes/Commitment.d.ts +1 -1
  7. package/dist/classes/index.d.mts +2 -2
  8. package/dist/classes/index.d.ts +2 -2
  9. package/dist/classes/index.js +386 -5
  10. package/dist/classes/index.js.map +1 -1
  11. package/dist/classes/index.mjs +385 -5
  12. package/dist/classes/index.mjs.map +1 -1
  13. package/dist/classes/navigation/ActivityRoom.d.mts +1 -1
  14. package/dist/classes/navigation/ActivityRoom.d.ts +1 -1
  15. package/dist/classes/navigation/ActivityRoom.js +3 -0
  16. package/dist/classes/navigation/ActivityRoom.js.map +1 -1
  17. package/dist/classes/navigation/ActivityRoom.mjs +3 -0
  18. package/dist/classes/navigation/ActivityRoom.mjs.map +1 -1
  19. package/dist/classes/navigation/Location.d.mts +1 -1
  20. package/dist/classes/navigation/Location.d.ts +1 -1
  21. package/dist/classes/navigation/Map.d.mts +1 -1
  22. package/dist/classes/navigation/Map.d.ts +1 -1
  23. package/dist/classes/navigation/Room.d.mts +1 -1
  24. package/dist/classes/navigation/Room.d.ts +1 -1
  25. package/dist/classes/navigation/Room.js +37 -34
  26. package/dist/classes/navigation/Room.js.map +1 -1
  27. package/dist/classes/navigation/Room.mjs +37 -34
  28. package/dist/classes/navigation/Room.mjs.map +1 -1
  29. package/dist/classes/quest/Quest.d.mts +1 -1
  30. package/dist/classes/quest/Quest.d.ts +1 -1
  31. package/dist/classes/quest/Quest.js +13 -3
  32. package/dist/classes/quest/Quest.js.map +1 -1
  33. package/dist/classes/quest/Quest.mjs +13 -3
  34. package/dist/classes/quest/Quest.mjs.map +1 -1
  35. package/dist/classes/quest/Stage.d.mts +1 -1
  36. package/dist/classes/quest/Stage.d.ts +1 -1
  37. package/dist/classes/quest/Stage.js +3 -3
  38. package/dist/classes/quest/Stage.js.map +1 -1
  39. package/dist/classes/quest/Stage.mjs +3 -3
  40. package/dist/classes/quest/Stage.mjs.map +1 -1
  41. package/dist/decorators/CommitmentDecorator.d.mts +1 -1
  42. package/dist/decorators/CommitmentDecorator.d.ts +1 -1
  43. package/dist/decorators/QuestDecorator.d.mts +7 -2
  44. package/dist/decorators/QuestDecorator.d.ts +7 -2
  45. package/dist/decorators/QuestDecorator.js +17 -3
  46. package/dist/decorators/QuestDecorator.js.map +1 -1
  47. package/dist/decorators/QuestDecorator.mjs +17 -4
  48. package/dist/decorators/QuestDecorator.mjs.map +1 -1
  49. package/dist/decorators/RoomDecorator.d.mts +1 -1
  50. package/dist/decorators/RoomDecorator.d.ts +1 -1
  51. package/dist/decorators/index.d.mts +3 -3
  52. package/dist/decorators/index.d.ts +3 -3
  53. package/dist/decorators/index.js +17 -3
  54. package/dist/decorators/index.js.map +1 -1
  55. package/dist/decorators/index.mjs +17 -4
  56. package/dist/decorators/index.mjs.map +1 -1
  57. package/dist/functions/ActivityFunctions.d.mts +8 -1
  58. package/dist/functions/ActivityFunctions.d.ts +8 -1
  59. package/dist/functions/ActivityFunctions.js.map +1 -1
  60. package/dist/functions/ActivityFunctions.mjs.map +1 -1
  61. package/dist/functions/NavigationFunctions.d.mts +20 -3
  62. package/dist/functions/NavigationFunctions.d.ts +20 -3
  63. package/dist/functions/NavigationFunctions.js +2 -2
  64. package/dist/functions/NavigationFunctions.js.map +1 -1
  65. package/dist/functions/NavigationFunctions.mjs +2 -2
  66. package/dist/functions/NavigationFunctions.mjs.map +1 -1
  67. package/dist/functions/QuestFunctions.js.map +1 -1
  68. package/dist/functions/QuestFunctions.mjs.map +1 -1
  69. package/dist/functions/RoutineFunctions.d.mts +7 -2
  70. package/dist/functions/RoutineFunctions.d.ts +7 -2
  71. package/dist/functions/RoutineFunctions.js +40 -0
  72. package/dist/functions/RoutineFunctions.js.map +1 -1
  73. package/dist/functions/RoutineFunctions.mjs +40 -1
  74. package/dist/functions/RoutineFunctions.mjs.map +1 -1
  75. package/dist/functions/index.d.mts +3 -3
  76. package/dist/functions/index.d.ts +3 -3
  77. package/dist/functions/index.js +10 -2
  78. package/dist/functions/index.js.map +1 -1
  79. package/dist/functions/index.mjs +9 -2
  80. package/dist/functions/index.mjs.map +1 -1
  81. package/dist/index.d.mts +5 -5
  82. package/dist/index.d.ts +5 -5
  83. package/dist/index.js +77 -51
  84. package/dist/index.js.map +1 -1
  85. package/dist/index.mjs +73 -50
  86. package/dist/index.mjs.map +1 -1
  87. package/dist/interface/CommitmentProps.d.mts +1 -1
  88. package/dist/interface/CommitmentProps.d.ts +1 -1
  89. package/dist/interface/RoomProps.d.mts +1 -1
  90. package/dist/interface/RoomProps.d.ts +1 -1
  91. package/dist/interface/index.d.mts +2 -2
  92. package/dist/interface/index.d.ts +2 -2
  93. package/dist/interface/navigation/LocationProps.d.mts +1 -1
  94. package/dist/interface/navigation/LocationProps.d.ts +1 -1
  95. package/dist/interface/navigation/MapProps.d.mts +1 -1
  96. package/dist/interface/navigation/MapProps.d.ts +1 -1
  97. package/dist/interface/quest/QuestProps.d.mts +1 -1
  98. package/dist/interface/quest/QuestProps.d.ts +1 -1
  99. package/dist/interface/quest/StageProps.d.mts +1 -1
  100. package/dist/interface/quest/StageProps.d.ts +1 -1
  101. package/dist/types/QuestsRequired.d.mts +1 -1
  102. package/dist/types/QuestsRequired.d.ts +1 -1
  103. package/dist/types/index.d.mts +1 -1
  104. package/dist/types/index.d.ts +1 -1
  105. package/package.json +5 -5
package/dist/index.mjs CHANGED
@@ -613,6 +613,9 @@ var ActivityRoom = class extends ActivityStoredAbstract {
613
613
  get id() {
614
614
  return this._id;
615
615
  }
616
+ /**
617
+ * The room where the activity is.
618
+ */
616
619
  get room() {
617
620
  return this._room;
618
621
  }
@@ -1194,9 +1197,9 @@ var Stage = class extends StoredClassModel {
1194
1197
  this._adviceDescription = props.adviceDescription || "";
1195
1198
  this._renderImage = props.renderImage;
1196
1199
  this._daysRequiredToStart = props.daysRequiredToStart;
1197
- this._flagsRequiredToStart = props.flagsRequired || [];
1198
- this._questsRequiredToStart = props.questsRequired || [];
1199
- this._requestDescriptionToStart = props.requestDescription || "";
1200
+ this._flagsRequiredToStart = props.flagsRequiredToStart || [];
1201
+ this._questsRequiredToStart = props.questsRequiredToStart || [];
1202
+ this._requestDescriptionToStart = props.requestDescriptionToStart || "";
1200
1203
  this._onStart = props.onStart;
1201
1204
  this._onEnd = props.onEnd;
1202
1205
  }
@@ -1584,9 +1587,15 @@ var Quest = class extends StoredClassModel {
1584
1587
  let nextCurrentStage = this.currentStage;
1585
1588
  if (nextCurrentStage) {
1586
1589
  nextCurrentStage.inizialize();
1590
+ if (this.currentStageMustStart) {
1591
+ this.startCurrentStage(startProps);
1592
+ }
1587
1593
  }
1588
1594
  return true;
1589
1595
  }
1596
+ /**
1597
+ * If the current stage must start. It is true if the current stage is not started, can start and not completed.
1598
+ */
1590
1599
  get currentStageMustStart() {
1591
1600
  let currentStage = this.currentStage;
1592
1601
  if (!currentStage) {
@@ -1594,6 +1603,10 @@ var Quest = class extends StoredClassModel {
1594
1603
  }
1595
1604
  return !currentStage.started && currentStage.canStart && !currentStage.completed;
1596
1605
  }
1606
+ /**
1607
+ * Start the current stage.
1608
+ * @param props The properties for the start stage. If you not want to pass any property, you can pass an {}.
1609
+ */
1597
1610
  startCurrentStage(props) {
1598
1611
  let newCurrentStage = this.currentStage;
1599
1612
  if (newCurrentStage && this.currentStageMustStart) {
@@ -1627,6 +1640,54 @@ function getQuestById(id) {
1627
1640
  return;
1628
1641
  }
1629
1642
  }
1643
+ function getAllStartedQuests() {
1644
+ return Object.values(registeredQuests).filter((quest) => quest.started);
1645
+ }
1646
+ var CURRENT_ROOM_MEMORY_KEY = "___nqtr-current_room_memory___";
1647
+ function setCurrentRoom(room) {
1648
+ if (room instanceof LocationBaseModel) {
1649
+ let entrance = room.getEntrance();
1650
+ if (!entrance) {
1651
+ console.error(`[NQTR] The location ${room.id} has no entrance room`);
1652
+ return;
1653
+ }
1654
+ room = entrance;
1655
+ } else {
1656
+ let roomRegistrated = getRoomById(room.id);
1657
+ if (!roomRegistrated) {
1658
+ console.error(`[NQTR] The room ${room.id} is not registered, so it can't be set as current room`);
1659
+ return;
1660
+ }
1661
+ }
1662
+ GameStorageManager.setVariable(CURRENT_ROOM_MEMORY_KEY, room.id);
1663
+ }
1664
+ function getCurrentRoom() {
1665
+ let roomId = GameStorageManager.getVariable(CURRENT_ROOM_MEMORY_KEY);
1666
+ if (!roomId) {
1667
+ console.error(`[NQTR] The current room has not yet been set`);
1668
+ return;
1669
+ }
1670
+ let room = getRoomById(roomId);
1671
+ if (!room) {
1672
+ console.error(`[NQTR] Current room ${roomId} not found`);
1673
+ return;
1674
+ }
1675
+ return room;
1676
+ }
1677
+ function getCurrenrLocation() {
1678
+ let room = getCurrentRoom();
1679
+ if (!room) {
1680
+ return;
1681
+ }
1682
+ return room.location;
1683
+ }
1684
+ function getCurrentMap() {
1685
+ let location = getCurrenrLocation();
1686
+ if (!location) {
1687
+ return;
1688
+ }
1689
+ return location.map;
1690
+ }
1630
1691
 
1631
1692
  // src/functions/RoutineFunctions.ts
1632
1693
  function clearExpiredRoutine() {
@@ -1668,6 +1729,13 @@ function getCurrentRoutine() {
1668
1729
  });
1669
1730
  return Object.values(character_commitments);
1670
1731
  }
1732
+ function getCurrentRoomRoutine() {
1733
+ let room = getCurrentRoom();
1734
+ if (!room) {
1735
+ return [];
1736
+ }
1737
+ return room.getRoutine();
1738
+ }
1671
1739
  function getCommitmentByCharacter(character) {
1672
1740
  getCurrentRoutine().forEach((c) => {
1673
1741
  if (c.characters.map((ch) => ch.id).includes(character.id)) {
@@ -1679,7 +1747,7 @@ function getCommitmentByCharacter(character) {
1679
1747
 
1680
1748
  // src/classes/navigation/Room.ts
1681
1749
  var ROOM_CATEGORY = "__nqtr-room__";
1682
- var RoomBaseModel = class extends StoredClassModel {
1750
+ var RoomBaseModel2 = class extends StoredClassModel {
1683
1751
  /**
1684
1752
  * @param id The id of the room, it must be unique.
1685
1753
  * @param location The location where the room is.
@@ -1913,51 +1981,6 @@ var RoomBaseModel = class extends StoredClassModel {
1913
1981
  return commitments.filter((c) => c.room.id === this.id);
1914
1982
  }
1915
1983
  };
1916
- var CURRENT_ROOM_MEMORY_KEY = "___nqtr-current_room_memory___";
1917
- function setCurrentRoom(room) {
1918
- if (room instanceof LocationBaseModel) {
1919
- let entrance = room.getEntrance();
1920
- if (!entrance) {
1921
- console.error(`[NQTR] The location ${room.id} has no entrance room`);
1922
- return;
1923
- }
1924
- room = entrance;
1925
- } else {
1926
- let roomRegistrated = getRoomById(room.id);
1927
- if (!roomRegistrated) {
1928
- console.error(`[NQTR] The room ${room.id} is not registered, so it can't be set as current room`);
1929
- return;
1930
- }
1931
- }
1932
- GameStorageManager.setVariable(CURRENT_ROOM_MEMORY_KEY, room.id);
1933
- }
1934
- function getCurrentRoom() {
1935
- let roomId = GameStorageManager.getVariable(CURRENT_ROOM_MEMORY_KEY);
1936
- if (!roomId) {
1937
- console.error(`[NQTR] The current room has not yet been set`);
1938
- return;
1939
- }
1940
- let room = getRoomById(roomId);
1941
- if (!room) {
1942
- console.error(`[NQTR] Current room ${roomId} not found`);
1943
- return;
1944
- }
1945
- return room;
1946
- }
1947
- function getCurrenrLocation() {
1948
- let room = getCurrentRoom();
1949
- if (!room) {
1950
- return;
1951
- }
1952
- return room.location;
1953
- }
1954
- function getCueerntMap() {
1955
- let location = getCurrenrLocation();
1956
- if (!location) {
1957
- return;
1958
- }
1959
- return location.map;
1960
- }
1961
1984
 
1962
1985
  // src/functions/ActivityFunctions.ts
1963
1986
  function clearExpiredActivities() {
@@ -1982,6 +2005,6 @@ function startMustStartStageQuests(props) {
1982
2005
  });
1983
2006
  }
1984
2007
 
1985
- export { ActivityRoom, CommitmentBaseModel, Goal, LocationBaseModel, MapBaseModel, RoomBaseModel, Stage, TimeManager, addCommitment, clearExpiredActivities, clearExpiredRoutine, currentActivities, getActivityById, getAllLocations, getAllMaps, getCommitmentByCharacter, getCommitmentById, getCueerntMap, getCurrenrLocation, getCurrentRoom, getCurrentRoutine, getQuestById, getRoomById, newActivity, newQuest, removeCommitment, saveCommitment, saveRoom, setCurrentRoom, setFixedRoutine, startMustStartStageQuests };
2008
+ export { ActivityRoom, CommitmentBaseModel, Goal, LocationBaseModel, MapBaseModel, Quest, RoomBaseModel2 as RoomBaseModel, Stage, TimeManager, addCommitment, clearExpiredActivities, clearExpiredRoutine, currentActivities, getActivityById, getAllLocations, getAllMaps, getAllStartedQuests, getCommitmentByCharacter, getCommitmentById, getCurrenrLocation, getCurrentMap, getCurrentRoom, getCurrentRoomRoutine, getCurrentRoutine, getQuestById, getRoomById, newActivity, newQuest, removeCommitment, saveCommitment, saveRoom, setCurrentRoom, setFixedRoutine, startMustStartStageQuests };
1986
2009
  //# sourceMappingURL=out.js.map
1987
2010
  //# sourceMappingURL=index.mjs.map