@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.js CHANGED
@@ -615,6 +615,9 @@ var ActivityRoom = class extends ActivityStoredAbstract {
615
615
  get id() {
616
616
  return this._id;
617
617
  }
618
+ /**
619
+ * The room where the activity is.
620
+ */
618
621
  get room() {
619
622
  return this._room;
620
623
  }
@@ -1196,9 +1199,9 @@ var Stage = class extends pixiVn.StoredClassModel {
1196
1199
  this._adviceDescription = props.adviceDescription || "";
1197
1200
  this._renderImage = props.renderImage;
1198
1201
  this._daysRequiredToStart = props.daysRequiredToStart;
1199
- this._flagsRequiredToStart = props.flagsRequired || [];
1200
- this._questsRequiredToStart = props.questsRequired || [];
1201
- this._requestDescriptionToStart = props.requestDescription || "";
1202
+ this._flagsRequiredToStart = props.flagsRequiredToStart || [];
1203
+ this._questsRequiredToStart = props.questsRequiredToStart || [];
1204
+ this._requestDescriptionToStart = props.requestDescriptionToStart || "";
1202
1205
  this._onStart = props.onStart;
1203
1206
  this._onEnd = props.onEnd;
1204
1207
  }
@@ -1586,9 +1589,15 @@ var Quest = class extends pixiVn.StoredClassModel {
1586
1589
  let nextCurrentStage = this.currentStage;
1587
1590
  if (nextCurrentStage) {
1588
1591
  nextCurrentStage.inizialize();
1592
+ if (this.currentStageMustStart) {
1593
+ this.startCurrentStage(startProps);
1594
+ }
1589
1595
  }
1590
1596
  return true;
1591
1597
  }
1598
+ /**
1599
+ * If the current stage must start. It is true if the current stage is not started, can start and not completed.
1600
+ */
1592
1601
  get currentStageMustStart() {
1593
1602
  let currentStage = this.currentStage;
1594
1603
  if (!currentStage) {
@@ -1596,6 +1605,10 @@ var Quest = class extends pixiVn.StoredClassModel {
1596
1605
  }
1597
1606
  return !currentStage.started && currentStage.canStart && !currentStage.completed;
1598
1607
  }
1608
+ /**
1609
+ * Start the current stage.
1610
+ * @param props The properties for the start stage. If you not want to pass any property, you can pass an {}.
1611
+ */
1599
1612
  startCurrentStage(props) {
1600
1613
  let newCurrentStage = this.currentStage;
1601
1614
  if (newCurrentStage && this.currentStageMustStart) {
@@ -1629,6 +1642,54 @@ function getQuestById(id) {
1629
1642
  return;
1630
1643
  }
1631
1644
  }
1645
+ function getAllStartedQuests() {
1646
+ return Object.values(registeredQuests).filter((quest) => quest.started);
1647
+ }
1648
+ var CURRENT_ROOM_MEMORY_KEY = "___nqtr-current_room_memory___";
1649
+ function setCurrentRoom(room) {
1650
+ if (room instanceof LocationBaseModel) {
1651
+ let entrance = room.getEntrance();
1652
+ if (!entrance) {
1653
+ console.error(`[NQTR] The location ${room.id} has no entrance room`);
1654
+ return;
1655
+ }
1656
+ room = entrance;
1657
+ } else {
1658
+ let roomRegistrated = getRoomById(room.id);
1659
+ if (!roomRegistrated) {
1660
+ console.error(`[NQTR] The room ${room.id} is not registered, so it can't be set as current room`);
1661
+ return;
1662
+ }
1663
+ }
1664
+ pixiVn.GameStorageManager.setVariable(CURRENT_ROOM_MEMORY_KEY, room.id);
1665
+ }
1666
+ function getCurrentRoom() {
1667
+ let roomId = pixiVn.GameStorageManager.getVariable(CURRENT_ROOM_MEMORY_KEY);
1668
+ if (!roomId) {
1669
+ console.error(`[NQTR] The current room has not yet been set`);
1670
+ return;
1671
+ }
1672
+ let room = getRoomById(roomId);
1673
+ if (!room) {
1674
+ console.error(`[NQTR] Current room ${roomId} not found`);
1675
+ return;
1676
+ }
1677
+ return room;
1678
+ }
1679
+ function getCurrenrLocation() {
1680
+ let room = getCurrentRoom();
1681
+ if (!room) {
1682
+ return;
1683
+ }
1684
+ return room.location;
1685
+ }
1686
+ function getCurrentMap() {
1687
+ let location = getCurrenrLocation();
1688
+ if (!location) {
1689
+ return;
1690
+ }
1691
+ return location.map;
1692
+ }
1632
1693
 
1633
1694
  // src/functions/RoutineFunctions.ts
1634
1695
  function clearExpiredRoutine() {
@@ -1670,6 +1731,13 @@ function getCurrentRoutine() {
1670
1731
  });
1671
1732
  return Object.values(character_commitments);
1672
1733
  }
1734
+ function getCurrentRoomRoutine() {
1735
+ let room = getCurrentRoom();
1736
+ if (!room) {
1737
+ return [];
1738
+ }
1739
+ return room.getRoutine();
1740
+ }
1673
1741
  function getCommitmentByCharacter(character) {
1674
1742
  getCurrentRoutine().forEach((c) => {
1675
1743
  if (c.characters.map((ch) => ch.id).includes(character.id)) {
@@ -1681,7 +1749,7 @@ function getCommitmentByCharacter(character) {
1681
1749
 
1682
1750
  // src/classes/navigation/Room.ts
1683
1751
  var ROOM_CATEGORY = "__nqtr-room__";
1684
- var RoomBaseModel = class extends pixiVn.StoredClassModel {
1752
+ var RoomBaseModel2 = class extends pixiVn.StoredClassModel {
1685
1753
  /**
1686
1754
  * @param id The id of the room, it must be unique.
1687
1755
  * @param location The location where the room is.
@@ -1915,51 +1983,6 @@ var RoomBaseModel = class extends pixiVn.StoredClassModel {
1915
1983
  return commitments.filter((c) => c.room.id === this.id);
1916
1984
  }
1917
1985
  };
1918
- var CURRENT_ROOM_MEMORY_KEY = "___nqtr-current_room_memory___";
1919
- function setCurrentRoom(room) {
1920
- if (room instanceof LocationBaseModel) {
1921
- let entrance = room.getEntrance();
1922
- if (!entrance) {
1923
- console.error(`[NQTR] The location ${room.id} has no entrance room`);
1924
- return;
1925
- }
1926
- room = entrance;
1927
- } else {
1928
- let roomRegistrated = getRoomById(room.id);
1929
- if (!roomRegistrated) {
1930
- console.error(`[NQTR] The room ${room.id} is not registered, so it can't be set as current room`);
1931
- return;
1932
- }
1933
- }
1934
- pixiVn.GameStorageManager.setVariable(CURRENT_ROOM_MEMORY_KEY, room.id);
1935
- }
1936
- function getCurrentRoom() {
1937
- let roomId = pixiVn.GameStorageManager.getVariable(CURRENT_ROOM_MEMORY_KEY);
1938
- if (!roomId) {
1939
- console.error(`[NQTR] The current room has not yet been set`);
1940
- return;
1941
- }
1942
- let room = getRoomById(roomId);
1943
- if (!room) {
1944
- console.error(`[NQTR] Current room ${roomId} not found`);
1945
- return;
1946
- }
1947
- return room;
1948
- }
1949
- function getCurrenrLocation() {
1950
- let room = getCurrentRoom();
1951
- if (!room) {
1952
- return;
1953
- }
1954
- return room.location;
1955
- }
1956
- function getCueerntMap() {
1957
- let location = getCurrenrLocation();
1958
- if (!location) {
1959
- return;
1960
- }
1961
- return location.map;
1962
- }
1963
1986
 
1964
1987
  // src/functions/ActivityFunctions.ts
1965
1988
  function clearExpiredActivities() {
@@ -1989,7 +2012,8 @@ exports.CommitmentBaseModel = CommitmentBaseModel;
1989
2012
  exports.Goal = Goal;
1990
2013
  exports.LocationBaseModel = LocationBaseModel;
1991
2014
  exports.MapBaseModel = MapBaseModel;
1992
- exports.RoomBaseModel = RoomBaseModel;
2015
+ exports.Quest = Quest;
2016
+ exports.RoomBaseModel = RoomBaseModel2;
1993
2017
  exports.Stage = Stage;
1994
2018
  exports.TimeManager = TimeManager;
1995
2019
  exports.addCommitment = addCommitment;
@@ -1999,11 +2023,13 @@ exports.currentActivities = currentActivities;
1999
2023
  exports.getActivityById = getActivityById;
2000
2024
  exports.getAllLocations = getAllLocations;
2001
2025
  exports.getAllMaps = getAllMaps;
2026
+ exports.getAllStartedQuests = getAllStartedQuests;
2002
2027
  exports.getCommitmentByCharacter = getCommitmentByCharacter;
2003
2028
  exports.getCommitmentById = getCommitmentById;
2004
- exports.getCueerntMap = getCueerntMap;
2005
2029
  exports.getCurrenrLocation = getCurrenrLocation;
2030
+ exports.getCurrentMap = getCurrentMap;
2006
2031
  exports.getCurrentRoom = getCurrentRoom;
2032
+ exports.getCurrentRoomRoutine = getCurrentRoomRoutine;
2007
2033
  exports.getCurrentRoutine = getCurrentRoutine;
2008
2034
  exports.getQuestById = getQuestById;
2009
2035
  exports.getRoomById = getRoomById;