@drincs/nqtr 0.2.7 → 0.2.9

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 (63) hide show
  1. package/dist/{StageProps-Bok_NwL7.d.ts → StageProps-CCjGI625.d.ts} +18 -21
  2. package/dist/{StageProps-CFQizpZF.d.mts → StageProps-CuE_n1Wg.d.mts} +18 -21
  3. package/dist/classes/index.d.mts +1 -1
  4. package/dist/classes/index.d.ts +1 -1
  5. package/dist/classes/index.js +17 -36
  6. package/dist/classes/index.js.map +1 -1
  7. package/dist/classes/index.mjs +17 -36
  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/Quest.d.mts +1 -1
  12. package/dist/classes/quest/Quest.d.ts +1 -1
  13. package/dist/classes/quest/Quest.js +17 -36
  14. package/dist/classes/quest/Quest.js.map +1 -1
  15. package/dist/classes/quest/Quest.mjs +17 -36
  16. package/dist/classes/quest/Quest.mjs.map +1 -1
  17. package/dist/classes/quest/Stage.d.mts +1 -1
  18. package/dist/classes/quest/Stage.d.ts +1 -1
  19. package/dist/classes/quest/Stage.js +3 -11
  20. package/dist/classes/quest/Stage.js.map +1 -1
  21. package/dist/classes/quest/Stage.mjs +3 -11
  22. package/dist/classes/quest/Stage.mjs.map +1 -1
  23. package/dist/decorators/QuestDecorator.d.mts +1 -1
  24. package/dist/decorators/QuestDecorator.d.ts +1 -1
  25. package/dist/decorators/QuestDecorator.js +17 -36
  26. package/dist/decorators/QuestDecorator.js.map +1 -1
  27. package/dist/decorators/QuestDecorator.mjs +17 -36
  28. package/dist/decorators/QuestDecorator.mjs.map +1 -1
  29. package/dist/decorators/index.d.mts +1 -1
  30. package/dist/decorators/index.d.ts +1 -1
  31. package/dist/decorators/index.js +17 -36
  32. package/dist/decorators/index.js.map +1 -1
  33. package/dist/decorators/index.mjs +17 -36
  34. package/dist/decorators/index.mjs.map +1 -1
  35. package/dist/functions/ActivityFunctions.js.map +1 -1
  36. package/dist/functions/ActivityFunctions.mjs.map +1 -1
  37. package/dist/functions/NavigationFunctions.js.map +1 -1
  38. package/dist/functions/NavigationFunctions.mjs.map +1 -1
  39. package/dist/functions/QuestFunctions.d.mts +2 -2
  40. package/dist/functions/QuestFunctions.d.ts +2 -2
  41. package/dist/functions/QuestFunctions.js.map +1 -1
  42. package/dist/functions/QuestFunctions.mjs.map +1 -1
  43. package/dist/functions/RoutineFunctions.js.map +1 -1
  44. package/dist/functions/RoutineFunctions.mjs.map +1 -1
  45. package/dist/functions/index.js.map +1 -1
  46. package/dist/functions/index.mjs.map +1 -1
  47. package/dist/index.d.mts +1 -1
  48. package/dist/index.d.ts +1 -1
  49. package/dist/index.js +17 -36
  50. package/dist/index.js.map +1 -1
  51. package/dist/index.mjs +17 -36
  52. package/dist/index.mjs.map +1 -1
  53. package/dist/interface/index.d.mts +1 -1
  54. package/dist/interface/index.d.ts +1 -1
  55. package/dist/interface/quest/QuestProps.d.mts +1 -1
  56. package/dist/interface/quest/QuestProps.d.ts +1 -1
  57. package/dist/interface/quest/StageProps.d.mts +1 -1
  58. package/dist/interface/quest/StageProps.d.ts +1 -1
  59. package/dist/types/QuestsRequired.d.mts +1 -1
  60. package/dist/types/QuestsRequired.d.ts +1 -1
  61. package/dist/types/index.d.mts +1 -1
  62. package/dist/types/index.d.ts +1 -1
  63. package/package.json +2 -2
@@ -1062,21 +1062,13 @@ var Stage = class extends StoredClassModel {
1062
1062
  * The function that will be called when the stage starts.
1063
1063
  */
1064
1064
  get onStart() {
1065
- let onStart = this._onStart;
1066
- if (onStart === void 0) {
1067
- return void 0;
1068
- }
1069
- return (props) => onStart(this, props);
1065
+ return this._onStart;
1070
1066
  }
1071
1067
  /**
1072
1068
  * The function that will be called when the stage ends.
1073
1069
  */
1074
1070
  get onEnd() {
1075
- let onEnd = this._onEnd;
1076
- if (onEnd === void 0) {
1077
- return void 0;
1078
- }
1079
- return (props) => onEnd(this, props);
1071
+ return this._onEnd;
1080
1072
  }
1081
1073
  };
1082
1074
  var StageQuest = class extends Stage {
@@ -1179,7 +1171,7 @@ var StageQuest = class extends Stage {
1179
1171
  if (this.canStart) {
1180
1172
  this.started = true;
1181
1173
  if (this.onStart) {
1182
- this.onStart(props);
1174
+ this.onStart(this, props);
1183
1175
  }
1184
1176
  } else {
1185
1177
  console.warn(`[NQTR] Stage ${this.id} can't start`);
@@ -1295,21 +1287,13 @@ var Quest = class extends StoredClassModel {
1295
1287
  * The function that will be called when the quest starts.
1296
1288
  */
1297
1289
  get onStart() {
1298
- let onStart = this._onStart;
1299
- if (onStart === void 0) {
1300
- return void 0;
1301
- }
1302
- return (props) => onStart(this, props);
1290
+ return this._onStart;
1303
1291
  }
1304
1292
  /**
1305
1293
  * The function that will be called when the quest goes to the next stage.
1306
1294
  */
1307
1295
  get onNextStage() {
1308
- let onNext = this._onNextStage;
1309
- if (onNext === void 0) {
1310
- return void 0;
1311
- }
1312
- return (props) => onNext(this, props);
1296
+ return this._onNextStage;
1313
1297
  }
1314
1298
  /**
1315
1299
  * Start the quest.
@@ -1328,7 +1312,7 @@ var Quest = class extends StoredClassModel {
1328
1312
  this.currentStageIndex = 0;
1329
1313
  let currentStage = this.currentStage;
1330
1314
  if (currentStage && currentStage.start) {
1331
- this.onStart && this.onStart(props);
1315
+ this.onStart && this.onStart(this, props);
1332
1316
  return currentStage.start(props);
1333
1317
  } else {
1334
1318
  console.error(`[NQTR] Quest ${this.id} has no start stage`);
@@ -1337,11 +1321,10 @@ var Quest = class extends StoredClassModel {
1337
1321
  /**
1338
1322
  * Go to the next stage if the current stage is completed.
1339
1323
  * If you want to force the change of stage, use goNextStage.
1340
- * @param startProps The properties for the start stage. If you not want to pass any property, you can pass an {}.
1341
- * @param endProps The properties for the end stage. If you not want to pass any property, you can pass an {}.
1324
+ * @param props The properties. If you not want to pass any property, you can pass an {}.
1342
1325
  * @returns true if the stage was changed, false otherwise.
1343
1326
  */
1344
- tryToGoNextStage(startProps, endProps) {
1327
+ tryToGoNextStage(props) {
1345
1328
  if (!this.started) {
1346
1329
  return false;
1347
1330
  }
@@ -1354,34 +1337,32 @@ var Quest = class extends StoredClassModel {
1354
1337
  return false;
1355
1338
  }
1356
1339
  if (currentStage.completed) {
1357
- return this.goNextStage(startProps, endProps);
1340
+ return this.goNextStage(props);
1358
1341
  }
1359
1342
  return false;
1360
1343
  }
1361
1344
  /**
1362
1345
  * Complete the current stage and go to the next stage.
1363
1346
  * If you want to go to the next stage only if the current stage is completed, use tryToGoNextStage.
1364
- * @param startProps The properties for the start stage. If you not want to pass any property, you can pass an {}.
1365
- * @param endProps The properties for the end stage. If you not want to pass any property, you can pass an {}.
1347
+ * @param props The properties. If you not want to pass any property, you can pass an {}.
1366
1348
  * @returns true if the stage was changed, false otherwise.
1367
1349
  */
1368
- completeCurrentStageAndGoNext(startProps, endProps) {
1350
+ completeCurrentStageAndGoNext(props) {
1369
1351
  let currentStage = this.currentStage;
1370
1352
  if (!currentStage) {
1371
1353
  console.error(`[NQTR] Quest ${this.id} has no current stage`);
1372
1354
  return false;
1373
1355
  }
1374
1356
  currentStage.completed = true;
1375
- return this.goNextStage(startProps, endProps);
1357
+ return this.goNextStage(props);
1376
1358
  }
1377
1359
  /**
1378
1360
  * Go to the next stage without checking if the current stage is completed.
1379
1361
  * If you want to go to the next stage only if the current stage is completed, use tryToGoNextStage.
1380
- * @param startProps
1381
- * @param endProps
1362
+ * @param props The properties. If you not want to pass any property, you can pass an {}.
1382
1363
  * @returns returns true if the stage was changed, false otherwise.
1383
1364
  */
1384
- goNextStage(startProps, endProps) {
1365
+ goNextStage(props) {
1385
1366
  if (!this.started) {
1386
1367
  console.warn(`[NQTR] Quest ${this.id} is not started`);
1387
1368
  return false;
@@ -1397,15 +1378,15 @@ var Quest = class extends StoredClassModel {
1397
1378
  return false;
1398
1379
  }
1399
1380
  this.currentStageIndex = currentStageIndex + 1;
1400
- this.onNextStage && this.onNextStage(endProps);
1381
+ this.onNextStage && this.onNextStage(this, props);
1401
1382
  if (prevStage && prevStage.onEnd) {
1402
- prevStage.onEnd(endProps);
1383
+ prevStage.onEnd(prevStage, props);
1403
1384
  }
1404
1385
  let nextCurrentStage = this.currentStage;
1405
1386
  if (nextCurrentStage) {
1406
1387
  nextCurrentStage.inizialize();
1407
1388
  if (this.currentStageMustStart) {
1408
- this.startCurrentStage(startProps);
1389
+ this.startCurrentStage(props);
1409
1390
  }
1410
1391
  }
1411
1392
  return true;