@drincs/nqtr 0.2.0 → 0.2.1

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 (69) hide show
  1. package/dist/{StageProps-DCZkZHwZ.d.ts → StageProps-BFsiCaZT.d.ts} +80 -1
  2. package/dist/{StageProps-xLLR0rjD.d.mts → StageProps-CkXejAbn.d.mts} +80 -1
  3. package/dist/classes/index.d.mts +1 -1
  4. package/dist/classes/index.d.ts +1 -1
  5. package/dist/classes/index.js +37 -0
  6. package/dist/classes/index.js.map +1 -1
  7. package/dist/classes/index.mjs +37 -0
  8. package/dist/classes/index.mjs.map +1 -1
  9. package/dist/classes/navigation/Room.js.map +1 -1
  10. package/dist/classes/navigation/Room.mjs.map +1 -1
  11. package/dist/classes/quest/Goal.d.mts +18 -0
  12. package/dist/classes/quest/Goal.d.ts +18 -0
  13. package/dist/classes/quest/Goal.js +18 -0
  14. package/dist/classes/quest/Goal.js.map +1 -1
  15. package/dist/classes/quest/Goal.mjs +18 -0
  16. package/dist/classes/quest/Goal.mjs.map +1 -1
  17. package/dist/classes/quest/Quest.d.mts +1 -1
  18. package/dist/classes/quest/Quest.d.ts +1 -1
  19. package/dist/classes/quest/Quest.js +103 -4
  20. package/dist/classes/quest/Quest.js.map +1 -1
  21. package/dist/classes/quest/Quest.mjs +103 -4
  22. package/dist/classes/quest/Quest.mjs.map +1 -1
  23. package/dist/classes/quest/Stage.d.mts +1 -1
  24. package/dist/classes/quest/Stage.d.ts +1 -1
  25. package/dist/classes/quest/Stage.js +62 -0
  26. package/dist/classes/quest/Stage.js.map +1 -1
  27. package/dist/classes/quest/Stage.mjs +62 -0
  28. package/dist/classes/quest/Stage.mjs.map +1 -1
  29. package/dist/decorators/CommitmentDecorator.js +1 -1
  30. package/dist/decorators/CommitmentDecorator.js.map +1 -1
  31. package/dist/decorators/CommitmentDecorator.mjs +1 -1
  32. package/dist/decorators/CommitmentDecorator.mjs.map +1 -1
  33. package/dist/decorators/QuestDecorator.d.mts +1 -1
  34. package/dist/decorators/QuestDecorator.d.ts +1 -1
  35. package/dist/decorators/QuestDecorator.js +103 -4
  36. package/dist/decorators/QuestDecorator.js.map +1 -1
  37. package/dist/decorators/QuestDecorator.mjs +103 -4
  38. package/dist/decorators/QuestDecorator.mjs.map +1 -1
  39. package/dist/decorators/index.d.mts +1 -1
  40. package/dist/decorators/index.d.ts +1 -1
  41. package/dist/decorators/index.js +104 -5
  42. package/dist/decorators/index.js.map +1 -1
  43. package/dist/decorators/index.mjs +104 -5
  44. package/dist/decorators/index.mjs.map +1 -1
  45. package/dist/functions/ActivityFunctions.js.map +1 -1
  46. package/dist/functions/ActivityFunctions.mjs.map +1 -1
  47. package/dist/functions/NavigationFunctions.js.map +1 -1
  48. package/dist/functions/NavigationFunctions.mjs.map +1 -1
  49. package/dist/functions/RoutineFunctions.js.map +1 -1
  50. package/dist/functions/RoutineFunctions.mjs.map +1 -1
  51. package/dist/functions/index.js.map +1 -1
  52. package/dist/functions/index.mjs.map +1 -1
  53. package/dist/index.d.mts +1 -1
  54. package/dist/index.d.ts +1 -1
  55. package/dist/index.js +104 -5
  56. package/dist/index.js.map +1 -1
  57. package/dist/index.mjs +104 -5
  58. package/dist/index.mjs.map +1 -1
  59. package/dist/interface/index.d.mts +1 -1
  60. package/dist/interface/index.d.ts +1 -1
  61. package/dist/interface/quest/QuestProps.d.mts +1 -1
  62. package/dist/interface/quest/QuestProps.d.ts +1 -1
  63. package/dist/interface/quest/StageProps.d.mts +1 -1
  64. package/dist/interface/quest/StageProps.d.ts +1 -1
  65. package/dist/types/QuestsRequired.d.mts +1 -1
  66. package/dist/types/QuestsRequired.d.ts +1 -1
  67. package/dist/types/index.d.mts +1 -1
  68. package/dist/types/index.d.ts +1 -1
  69. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -1082,7 +1082,7 @@ function addCommitment(commitment) {
1082
1082
  }
1083
1083
  return commitment2.id;
1084
1084
  }).filter((id) => id !== void 0);
1085
- GameStorageManager.setVariable(TEMPORARY_COMMITMENT_CATEGORY_MEMORY_KEY, [commitmentsIds]);
1085
+ GameStorageManager.setVariable(TEMPORARY_COMMITMENT_CATEGORY_MEMORY_KEY, commitmentsIds);
1086
1086
  }
1087
1087
  function removeCommitment(commitment) {
1088
1088
  if (!Array.isArray(commitment)) {
@@ -1123,9 +1123,15 @@ var Goal = class extends StoredClassModel {
1123
1123
  get description() {
1124
1124
  return this._description;
1125
1125
  }
1126
+ /**
1127
+ * The number of times the goal must be completed.
1128
+ */
1126
1129
  get need() {
1127
1130
  return this._need;
1128
1131
  }
1132
+ /**
1133
+ * The default number of times the goal has been completed.
1134
+ */
1129
1135
  get defaultHave() {
1130
1136
  return this._defaultHave;
1131
1137
  }
@@ -1135,12 +1141,18 @@ var GoalStage = class extends Goal {
1135
1141
  super(id, props);
1136
1142
  this._stageId = stageId;
1137
1143
  }
1144
+ /**
1145
+ * The id of the stage that the goal belongs to.
1146
+ */
1138
1147
  get stageId() {
1139
1148
  return this._stageId;
1140
1149
  }
1141
1150
  set stageId(value) {
1142
1151
  this._stageId = value;
1143
1152
  }
1153
+ /**
1154
+ * The number of times the goal has been completed.
1155
+ */
1144
1156
  get have() {
1145
1157
  return this.getStorageProperty("have-" + this._stageId) || this.defaultHave;
1146
1158
  }
@@ -1151,6 +1163,9 @@ var GoalStage = class extends Goal {
1151
1163
  }
1152
1164
  this.setStorageProperty("have-" + this._stageId, value);
1153
1165
  }
1166
+ /**
1167
+ * If the goal is completed.
1168
+ */
1154
1169
  get completed() {
1155
1170
  return this.have >= this.need;
1156
1171
  }
@@ -1161,6 +1176,9 @@ var GoalStage = class extends Goal {
1161
1176
  console.warn(`[NQTR] The goal can't be set as not completed. You must edit the have value manually.`);
1162
1177
  }
1163
1178
  }
1179
+ /**
1180
+ * Find the goal. It will increment the have value.
1181
+ */
1164
1182
  find() {
1165
1183
  this.have++;
1166
1184
  }
@@ -1184,12 +1202,21 @@ var Stage = class extends StoredClassModel {
1184
1202
  this._onStart = props.onStart;
1185
1203
  this._onEnd = props.onEnd;
1186
1204
  }
1205
+ /**
1206
+ * The name of the stage.
1207
+ */
1187
1208
  get name() {
1188
1209
  return this._name;
1189
1210
  }
1211
+ /**
1212
+ * The description of the stage.
1213
+ */
1190
1214
  get description() {
1191
1215
  return this._description;
1192
1216
  }
1217
+ /**
1218
+ * The advice description of the stage.
1219
+ */
1193
1220
  get adviceDescription() {
1194
1221
  return this._adviceDescription;
1195
1222
  }
@@ -1208,6 +1235,10 @@ var Stage = class extends StoredClassModel {
1208
1235
  }
1209
1236
  return (props) => render;
1210
1237
  }
1238
+ /**
1239
+ * The list of goals that the player needs to complete to finish the stage.
1240
+ * This is the list set by the developer. if you want to get the current goals, use the goals property.
1241
+ */
1211
1242
  get defaultGoals() {
1212
1243
  return this._defaultGoals;
1213
1244
  }
@@ -1217,21 +1248,39 @@ var Stage = class extends StoredClassModel {
1217
1248
  get flags() {
1218
1249
  return this._flags;
1219
1250
  }
1251
+ /**
1252
+ * The number of days required to start the stage.
1253
+ */
1220
1254
  get daysRequiredToStart() {
1221
1255
  return this._daysRequiredToStart || 0;
1222
1256
  }
1257
+ /**
1258
+ * The list of flags required to start the stage.
1259
+ */
1223
1260
  get flagsRequiredToStart() {
1224
1261
  return this._flagsRequiredToStart;
1225
1262
  }
1263
+ /**
1264
+ * The list of quests required to start the stage.
1265
+ */
1226
1266
  get questsRequiredToStart() {
1227
1267
  return this._questsRequiredToStart || [];
1228
1268
  }
1269
+ /**
1270
+ * The description of the request to start the stage.
1271
+ */
1229
1272
  get requestDescriptionToStart() {
1230
1273
  return this._requestDescriptionToStart;
1231
1274
  }
1275
+ /**
1276
+ * The function that will be called when the stage starts.
1277
+ */
1232
1278
  get onStart() {
1233
1279
  return this._onStart;
1234
1280
  }
1281
+ /**
1282
+ * The function that will be called when the stage ends.
1283
+ */
1235
1284
  get onEnd() {
1236
1285
  return this._onEnd;
1237
1286
  }
@@ -1240,6 +1289,10 @@ var StageQuest = class extends Stage {
1240
1289
  constructor(id, props) {
1241
1290
  super(id, props);
1242
1291
  }
1292
+ /**
1293
+ * Check if the flag and goals are completed.
1294
+ * You can force the completion of the stage by setting the completed property to true.
1295
+ */
1243
1296
  get completed() {
1244
1297
  let storedCompleted = this.getStorageProperty("completed");
1245
1298
  if (storedCompleted) {
@@ -1270,6 +1323,9 @@ var StageQuest = class extends Stage {
1270
1323
  set prevStageEndDay(value) {
1271
1324
  this.setStorageProperty("prevStageEndDay", value);
1272
1325
  }
1326
+ /**
1327
+ * The day when the stage starts.
1328
+ */
1273
1329
  get startDay() {
1274
1330
  let prevStageEndDay = this.prevStageEndDay;
1275
1331
  if (prevStageEndDay === void 0) {
@@ -1277,6 +1333,9 @@ var StageQuest = class extends Stage {
1277
1333
  }
1278
1334
  return prevStageEndDay + this.daysRequiredToStart;
1279
1335
  }
1336
+ /**
1337
+ * Check if the stage can start.
1338
+ */
1280
1339
  get canStart() {
1281
1340
  let daysRequired = this.daysRequiredToStart;
1282
1341
  if (daysRequired > 0) {
@@ -1298,6 +1357,9 @@ var StageQuest = class extends Stage {
1298
1357
  }
1299
1358
  return true;
1300
1359
  }
1360
+ /**
1361
+ * The function that will be called when the stage starts.
1362
+ */
1301
1363
  get onStart() {
1302
1364
  if (this.daysRequiredToStart > 0) {
1303
1365
  this.prevStageEndDay = TimeManager.currentDay;
@@ -1318,14 +1380,23 @@ var Quest = class extends StoredClassModel {
1318
1380
  this._renderImage = props.renderImage;
1319
1381
  this._isInDevelopment = props.isInDevelopment || false;
1320
1382
  }
1383
+ /**
1384
+ * The stages of the quest.
1385
+ */
1321
1386
  get stages() {
1322
1387
  return this._stages.map((stage, index) => {
1323
1388
  return new StageQuest(stage.id, stage);
1324
1389
  });
1325
1390
  }
1391
+ /**
1392
+ * The name of the quest.
1393
+ */
1326
1394
  get name() {
1327
1395
  return this._name;
1328
1396
  }
1397
+ /**
1398
+ * The description of the quest.
1399
+ */
1329
1400
  get description() {
1330
1401
  return this._description;
1331
1402
  }
@@ -1359,15 +1430,24 @@ var Quest = class extends StoredClassModel {
1359
1430
  }
1360
1431
  return (props) => render;
1361
1432
  }
1433
+ /**
1434
+ * If the quest is in development.
1435
+ */
1362
1436
  get isInDevelopment() {
1363
1437
  return this._isInDevelopment;
1364
1438
  }
1439
+ /**
1440
+ * The index of the current stage.
1441
+ */
1365
1442
  get currentStageIndex() {
1366
1443
  return this.getStorageProperty("currentStageIndex");
1367
1444
  }
1368
1445
  set currentStageIndex(value) {
1369
1446
  this.setStorageProperty("currentStageIndex", value);
1370
1447
  }
1448
+ /**
1449
+ * The current stage.
1450
+ */
1371
1451
  get currentStage() {
1372
1452
  let index = this.currentStageIndex;
1373
1453
  if (index === void 0 || index >= this.stages.length) {
@@ -1375,12 +1455,23 @@ var Quest = class extends StoredClassModel {
1375
1455
  }
1376
1456
  return this.stages[index];
1377
1457
  }
1458
+ /**
1459
+ * If the quest is started.
1460
+ */
1378
1461
  get started() {
1379
1462
  return this.currentStageIndex !== void 0;
1380
1463
  }
1464
+ /**
1465
+ * If the quest is completed.
1466
+ */
1381
1467
  get completed() {
1382
1468
  return this.currentStageIndex === this.stages.length;
1383
1469
  }
1470
+ /**
1471
+ * Start the quest.
1472
+ * @param props The properties for the start stage. If you not want to pass any property, you can pass an {}.
1473
+ * @returns
1474
+ */
1384
1475
  start(props) {
1385
1476
  if (this.started) {
1386
1477
  console.warn(`[NQTR] Quest ${this.id} is already started`);
@@ -1398,18 +1489,24 @@ var Quest = class extends StoredClassModel {
1398
1489
  console.error(`[NQTR] Quest ${this.id} has no start stage`);
1399
1490
  }
1400
1491
  }
1492
+ /**
1493
+ * Try to go to the next stage.
1494
+ * @param startProps The properties for the start stage. If you not want to pass any property, you can pass an {}.
1495
+ * @param endProps The properties for the end stage. If you not want to pass any property, you can pass an {}.
1496
+ * @returns true if the stage was changed, false otherwise.
1497
+ */
1401
1498
  tryToGoNextStage(startProps, endProps) {
1402
1499
  if (!this.started) {
1403
- return;
1500
+ return false;
1404
1501
  }
1405
1502
  if (this.completed) {
1406
- return;
1503
+ return false;
1407
1504
  }
1408
1505
  let currentStage = this.currentStage;
1409
1506
  let currentStageIndex = this.currentStageIndex;
1410
1507
  if (!currentStage || currentStageIndex === void 0) {
1411
1508
  console.error(`[NQTR] Quest ${this.id} has no current stage`);
1412
- return;
1509
+ return false;
1413
1510
  }
1414
1511
  if (currentStage.completed) {
1415
1512
  let nextStageIndex = currentStageIndex + 1;
@@ -1419,9 +1516,11 @@ var Quest = class extends StoredClassModel {
1419
1516
  currentStage.onEnd(endProps);
1420
1517
  }
1421
1518
  if (nextStage && nextStage.onStart) {
1422
- return nextStage.onStart(startProps);
1519
+ nextStage.onStart(startProps);
1423
1520
  }
1521
+ return true;
1424
1522
  }
1523
+ return false;
1425
1524
  }
1426
1525
  };
1427
1526