@drincs/nqtr 0.2.5 → 0.2.7

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 (85) hide show
  1. package/dist/{StageProps-vR-NLl0n.d.ts → StageProps-Bok_NwL7.d.ts} +29 -11
  2. package/dist/{StageProps-W85kcacG.d.mts → StageProps-CFQizpZF.d.mts} +29 -11
  3. package/dist/classes/index.d.mts +1 -1
  4. package/dist/classes/index.d.ts +1 -1
  5. package/dist/classes/index.js +34 -2
  6. package/dist/classes/index.js.map +1 -1
  7. package/dist/classes/index.mjs +34 -2
  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 +34 -2
  14. package/dist/classes/quest/Quest.js.map +1 -1
  15. package/dist/classes/quest/Quest.mjs +34 -2
  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 +10 -2
  20. package/dist/classes/quest/Stage.js.map +1 -1
  21. package/dist/classes/quest/Stage.mjs +10 -2
  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 +34 -2
  26. package/dist/decorators/QuestDecorator.js.map +1 -1
  27. package/dist/decorators/QuestDecorator.mjs +34 -2
  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 +34 -2
  32. package/dist/decorators/index.js.map +1 -1
  33. package/dist/decorators/index.mjs +34 -2
  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 +34 -2
  50. package/dist/index.js.map +1 -1
  51. package/dist/index.mjs +34 -2
  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/override/{OnStartStageQuest.d.mts → OnStartEndStageQuest.d.mts} +3 -3
  60. package/dist/override/{OnStartStageQuest.d.ts → OnStartEndStageQuest.d.ts} +3 -3
  61. package/dist/override/OnStartEndStageQuest.js +4 -0
  62. package/dist/override/OnStartEndStageQuest.mjs +3 -0
  63. package/dist/override/index.d.mts +1 -3
  64. package/dist/override/index.d.ts +1 -3
  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 +2 -2
  70. package/dist/override/OnEndStageQuest.d.mts +0 -19
  71. package/dist/override/OnEndStageQuest.d.ts +0 -19
  72. package/dist/override/OnEndStageQuest.js +0 -4
  73. package/dist/override/OnEndStageQuest.mjs +0 -3
  74. package/dist/override/OnNextStageQuest.d.mts +0 -19
  75. package/dist/override/OnNextStageQuest.d.ts +0 -19
  76. package/dist/override/OnNextStageQuest.js +0 -4
  77. package/dist/override/OnNextStageQuest.js.map +0 -1
  78. package/dist/override/OnNextStageQuest.mjs +0 -3
  79. package/dist/override/OnNextStageQuest.mjs.map +0 -1
  80. package/dist/override/OnStartStageQuest.js +0 -4
  81. package/dist/override/OnStartStageQuest.js.map +0 -1
  82. package/dist/override/OnStartStageQuest.mjs +0 -3
  83. package/dist/override/OnStartStageQuest.mjs.map +0 -1
  84. /package/dist/override/{OnEndStageQuest.js.map → OnStartEndStageQuest.js.map} +0 -0
  85. /package/dist/override/{OnEndStageQuest.mjs.map → OnStartEndStageQuest.mjs.map} +0 -0
@@ -1,4 +1,4 @@
1
- import { OnRenderGraphicItemProps, GraphicItemType, OnStartStage, OnEndStage } from '@drincs/nqtr/dist/override';
1
+ import { OnRenderGraphicItemProps, GraphicItemType, OnStartStageQuest, OnEndStageQuest } from '@drincs/nqtr/dist/override';
2
2
  import { StoredClassModel } from '@drincs/pixi-vn';
3
3
  import Goal, { GoalStage } from './classes/quest/Goal.js';
4
4
  import StageFlags from './interface/quest/StageFlags.js';
@@ -60,12 +60,12 @@ declare class Stage extends StoredClassModel implements StageProps {
60
60
  /**
61
61
  * The function that will be called when the stage starts.
62
62
  */
63
- get onStart(): undefined | ((props: OnStartStage) => void);
63
+ get onStart(): undefined | ((props: OnStartStageQuest) => void);
64
64
  private _onEnd?;
65
65
  /**
66
66
  * The function that will be called when the stage ends.
67
67
  */
68
- get onEnd(): undefined | ((props: OnEndStage) => void);
68
+ get onEnd(): undefined | ((props: OnEndStageQuest) => void);
69
69
  }
70
70
  declare class StageQuest extends Stage {
71
71
  constructor(id: string, props: StageProps);
@@ -101,7 +101,7 @@ declare class StageQuest extends Stage {
101
101
  /**
102
102
  * The function that will be called when the stage starts.
103
103
  */
104
- start(props: OnStartStage): void;
104
+ start(props: OnStartStageQuest): void;
105
105
  }
106
106
 
107
107
  declare class Quest extends StoredClassModel {
@@ -153,12 +153,22 @@ declare class Quest extends StoredClassModel {
153
153
  * If the quest is completed.
154
154
  */
155
155
  get completed(): boolean;
156
+ private _onStart?;
157
+ /**
158
+ * The function that will be called when the quest starts.
159
+ */
160
+ get onStart(): undefined | ((props: OnStartStageQuest) => void);
161
+ private _onNextStage?;
162
+ /**
163
+ * The function that will be called when the quest goes to the next stage.
164
+ */
165
+ get onNextStage(): undefined | ((props: OnEndStageQuest) => void);
156
166
  /**
157
167
  * Start the quest.
158
168
  * @param props The properties for the start stage. If you not want to pass any property, you can pass an {}.
159
169
  * @returns
160
170
  */
161
- start(props: OnStartStage): void;
171
+ start(props: OnStartStageQuest): void;
162
172
  /**
163
173
  * Go to the next stage if the current stage is completed.
164
174
  * If you want to force the change of stage, use goNextStage.
@@ -166,7 +176,7 @@ declare class Quest extends StoredClassModel {
166
176
  * @param endProps The properties for the end stage. If you not want to pass any property, you can pass an {}.
167
177
  * @returns true if the stage was changed, false otherwise.
168
178
  */
169
- tryToGoNextStage(startProps: OnStartStage, endProps: OnEndStage): boolean;
179
+ tryToGoNextStage(startProps: OnStartStageQuest, endProps: OnEndStageQuest): boolean;
170
180
  /**
171
181
  * Complete the current stage and go to the next stage.
172
182
  * If you want to go to the next stage only if the current stage is completed, use tryToGoNextStage.
@@ -174,7 +184,7 @@ declare class Quest extends StoredClassModel {
174
184
  * @param endProps The properties for the end stage. If you not want to pass any property, you can pass an {}.
175
185
  * @returns true if the stage was changed, false otherwise.
176
186
  */
177
- completeCurrentStageAndGoNext(startProps: OnStartStage, endProps: OnEndStage): boolean;
187
+ completeCurrentStageAndGoNext(startProps: OnStartStageQuest, endProps: OnEndStageQuest): boolean;
178
188
  /**
179
189
  * Go to the next stage without checking if the current stage is completed.
180
190
  * If you want to go to the next stage only if the current stage is completed, use tryToGoNextStage.
@@ -182,7 +192,7 @@ declare class Quest extends StoredClassModel {
182
192
  * @param endProps
183
193
  * @returns returns true if the stage was changed, false otherwise.
184
194
  */
185
- goNextStage(startProps: OnStartStage, endProps: OnEndStage): boolean;
195
+ goNextStage(startProps: OnStartStageQuest, endProps: OnEndStageQuest): boolean;
186
196
  /**
187
197
  * If the current stage must start. It is true if the current stage is not started, can start and not completed.
188
198
  */
@@ -191,7 +201,7 @@ declare class Quest extends StoredClassModel {
191
201
  * Start the current stage.
192
202
  * @param props The properties for the start stage. If you not want to pass any property, you can pass an {}.
193
203
  */
194
- startCurrentStage(props: OnStartStage): void;
204
+ startCurrentStage(props: OnStartStageQuest): void;
195
205
  }
196
206
 
197
207
  type QuestsRequiredType = {
@@ -235,6 +245,14 @@ interface QuestProps {
235
245
  * @default false
236
246
  */
237
247
  isInDevelopment?: boolean;
248
+ /**
249
+ * The function that will be executed when the quest starts.
250
+ */
251
+ onStart?: (quest: Quest, props: OnStartStageQuest) => void;
252
+ /**
253
+ * The function that will be executed when a stage end in the quest.
254
+ */
255
+ onNextStage?: (quest: Quest, props: OnEndStageQuest) => void;
238
256
  }
239
257
 
240
258
  interface StageProps {
@@ -301,11 +319,11 @@ interface StageProps {
301
319
  /**
302
320
  * The function that will be executed when the stage starts.
303
321
  */
304
- onStart?: (props: OnStartStage) => void;
322
+ onStart?: (stage: Stage, props: OnStartStageQuest) => void;
305
323
  /**
306
324
  * The function that will be executed when the stage ends.
307
325
  */
308
- onEnd?: (props: OnEndStage) => void;
326
+ onEnd?: (stage: Stage, props: OnEndStageQuest) => void;
309
327
  }
310
328
 
311
329
  export { Quest as Q, Stage as S, type QuestProps as a, type StageProps as b, type QuestsRequiredType as c, StageQuest as d };
@@ -1,4 +1,4 @@
1
- import { OnRenderGraphicItemProps, GraphicItemType, OnStartStage, OnEndStage } from '@drincs/nqtr/dist/override';
1
+ import { OnRenderGraphicItemProps, GraphicItemType, OnStartStageQuest, OnEndStageQuest } from '@drincs/nqtr/dist/override';
2
2
  import { StoredClassModel } from '@drincs/pixi-vn';
3
3
  import Goal, { GoalStage } from './classes/quest/Goal.mjs';
4
4
  import StageFlags from './interface/quest/StageFlags.mjs';
@@ -60,12 +60,12 @@ declare class Stage extends StoredClassModel implements StageProps {
60
60
  /**
61
61
  * The function that will be called when the stage starts.
62
62
  */
63
- get onStart(): undefined | ((props: OnStartStage) => void);
63
+ get onStart(): undefined | ((props: OnStartStageQuest) => void);
64
64
  private _onEnd?;
65
65
  /**
66
66
  * The function that will be called when the stage ends.
67
67
  */
68
- get onEnd(): undefined | ((props: OnEndStage) => void);
68
+ get onEnd(): undefined | ((props: OnEndStageQuest) => void);
69
69
  }
70
70
  declare class StageQuest extends Stage {
71
71
  constructor(id: string, props: StageProps);
@@ -101,7 +101,7 @@ declare class StageQuest extends Stage {
101
101
  /**
102
102
  * The function that will be called when the stage starts.
103
103
  */
104
- start(props: OnStartStage): void;
104
+ start(props: OnStartStageQuest): void;
105
105
  }
106
106
 
107
107
  declare class Quest extends StoredClassModel {
@@ -153,12 +153,22 @@ declare class Quest extends StoredClassModel {
153
153
  * If the quest is completed.
154
154
  */
155
155
  get completed(): boolean;
156
+ private _onStart?;
157
+ /**
158
+ * The function that will be called when the quest starts.
159
+ */
160
+ get onStart(): undefined | ((props: OnStartStageQuest) => void);
161
+ private _onNextStage?;
162
+ /**
163
+ * The function that will be called when the quest goes to the next stage.
164
+ */
165
+ get onNextStage(): undefined | ((props: OnEndStageQuest) => void);
156
166
  /**
157
167
  * Start the quest.
158
168
  * @param props The properties for the start stage. If you not want to pass any property, you can pass an {}.
159
169
  * @returns
160
170
  */
161
- start(props: OnStartStage): void;
171
+ start(props: OnStartStageQuest): void;
162
172
  /**
163
173
  * Go to the next stage if the current stage is completed.
164
174
  * If you want to force the change of stage, use goNextStage.
@@ -166,7 +176,7 @@ declare class Quest extends StoredClassModel {
166
176
  * @param endProps The properties for the end stage. If you not want to pass any property, you can pass an {}.
167
177
  * @returns true if the stage was changed, false otherwise.
168
178
  */
169
- tryToGoNextStage(startProps: OnStartStage, endProps: OnEndStage): boolean;
179
+ tryToGoNextStage(startProps: OnStartStageQuest, endProps: OnEndStageQuest): boolean;
170
180
  /**
171
181
  * Complete the current stage and go to the next stage.
172
182
  * If you want to go to the next stage only if the current stage is completed, use tryToGoNextStage.
@@ -174,7 +184,7 @@ declare class Quest extends StoredClassModel {
174
184
  * @param endProps The properties for the end stage. If you not want to pass any property, you can pass an {}.
175
185
  * @returns true if the stage was changed, false otherwise.
176
186
  */
177
- completeCurrentStageAndGoNext(startProps: OnStartStage, endProps: OnEndStage): boolean;
187
+ completeCurrentStageAndGoNext(startProps: OnStartStageQuest, endProps: OnEndStageQuest): boolean;
178
188
  /**
179
189
  * Go to the next stage without checking if the current stage is completed.
180
190
  * If you want to go to the next stage only if the current stage is completed, use tryToGoNextStage.
@@ -182,7 +192,7 @@ declare class Quest extends StoredClassModel {
182
192
  * @param endProps
183
193
  * @returns returns true if the stage was changed, false otherwise.
184
194
  */
185
- goNextStage(startProps: OnStartStage, endProps: OnEndStage): boolean;
195
+ goNextStage(startProps: OnStartStageQuest, endProps: OnEndStageQuest): boolean;
186
196
  /**
187
197
  * If the current stage must start. It is true if the current stage is not started, can start and not completed.
188
198
  */
@@ -191,7 +201,7 @@ declare class Quest extends StoredClassModel {
191
201
  * Start the current stage.
192
202
  * @param props The properties for the start stage. If you not want to pass any property, you can pass an {}.
193
203
  */
194
- startCurrentStage(props: OnStartStage): void;
204
+ startCurrentStage(props: OnStartStageQuest): void;
195
205
  }
196
206
 
197
207
  type QuestsRequiredType = {
@@ -235,6 +245,14 @@ interface QuestProps {
235
245
  * @default false
236
246
  */
237
247
  isInDevelopment?: boolean;
248
+ /**
249
+ * The function that will be executed when the quest starts.
250
+ */
251
+ onStart?: (quest: Quest, props: OnStartStageQuest) => void;
252
+ /**
253
+ * The function that will be executed when a stage end in the quest.
254
+ */
255
+ onNextStage?: (quest: Quest, props: OnEndStageQuest) => void;
238
256
  }
239
257
 
240
258
  interface StageProps {
@@ -301,11 +319,11 @@ interface StageProps {
301
319
  /**
302
320
  * The function that will be executed when the stage starts.
303
321
  */
304
- onStart?: (props: OnStartStage) => void;
322
+ onStart?: (stage: Stage, props: OnStartStageQuest) => void;
305
323
  /**
306
324
  * The function that will be executed when the stage ends.
307
325
  */
308
- onEnd?: (props: OnEndStage) => void;
326
+ onEnd?: (stage: Stage, props: OnEndStageQuest) => void;
309
327
  }
310
328
 
311
329
  export { Quest as Q, Stage as S, type QuestProps as a, type StageProps as b, type QuestsRequiredType as c, StageQuest as d };
@@ -1,6 +1,6 @@
1
1
  export { A as ActivityRoom, C as CommitmentBaseModel, L as LocationBaseModel, M as MapBaseModel, R as RoomBaseModel } from '../Commitment-BHB-jYOi.mjs';
2
2
  export { default as Goal } from './quest/Goal.mjs';
3
- export { Q as Quest, S as Stage } from '../StageProps-W85kcacG.mjs';
3
+ export { Q as Quest, S as Stage } from '../StageProps-CFQizpZF.mjs';
4
4
  import '@drincs/nqtr/dist/override';
5
5
  import '@drincs/pixi-vn';
6
6
  import '../ActivityProps-D45DQdcT.mjs';
@@ -1,6 +1,6 @@
1
1
  export { A as ActivityRoom, C as CommitmentBaseModel, L as LocationBaseModel, M as MapBaseModel, R as RoomBaseModel } from '../Commitment-D-1lsnnU.js';
2
2
  export { default as Goal } from './quest/Goal.js';
3
- export { Q as Quest, S as Stage } from '../StageProps-vR-NLl0n.js';
3
+ export { Q as Quest, S as Stage } from '../StageProps-Bok_NwL7.js';
4
4
  import '@drincs/nqtr/dist/override';
5
5
  import '@drincs/pixi-vn';
6
6
  import '../ActivityProps-BkHX8xkA.js';
@@ -1064,13 +1064,21 @@ var Stage = class extends pixiVn.StoredClassModel {
1064
1064
  * The function that will be called when the stage starts.
1065
1065
  */
1066
1066
  get onStart() {
1067
- return this._onStart;
1067
+ let onStart = this._onStart;
1068
+ if (onStart === void 0) {
1069
+ return void 0;
1070
+ }
1071
+ return (props) => onStart(this, props);
1068
1072
  }
1069
1073
  /**
1070
1074
  * The function that will be called when the stage ends.
1071
1075
  */
1072
1076
  get onEnd() {
1073
- return this._onEnd;
1077
+ let onEnd = this._onEnd;
1078
+ if (onEnd === void 0) {
1079
+ return void 0;
1080
+ }
1081
+ return (props) => onEnd(this, props);
1074
1082
  }
1075
1083
  };
1076
1084
  var StageQuest = class extends Stage {
@@ -1192,6 +1200,8 @@ var Quest = class extends pixiVn.StoredClassModel {
1192
1200
  this._renderIcon = props.renderIcon;
1193
1201
  this._renderImage = props.renderImage;
1194
1202
  this._isInDevelopment = props.isInDevelopment || false;
1203
+ this._onStart = props.onStart;
1204
+ this._onNextStage = props.onNextStage;
1195
1205
  }
1196
1206
  /**
1197
1207
  * The stages of the quest.
@@ -1283,6 +1293,26 @@ var Quest = class extends pixiVn.StoredClassModel {
1283
1293
  }
1284
1294
  return this.currentStageIndex > this.stages.length - 1;
1285
1295
  }
1296
+ /**
1297
+ * The function that will be called when the quest starts.
1298
+ */
1299
+ get onStart() {
1300
+ let onStart = this._onStart;
1301
+ if (onStart === void 0) {
1302
+ return void 0;
1303
+ }
1304
+ return (props) => onStart(this, props);
1305
+ }
1306
+ /**
1307
+ * The function that will be called when the quest goes to the next stage.
1308
+ */
1309
+ get onNextStage() {
1310
+ let onNext = this._onNextStage;
1311
+ if (onNext === void 0) {
1312
+ return void 0;
1313
+ }
1314
+ return (props) => onNext(this, props);
1315
+ }
1286
1316
  /**
1287
1317
  * Start the quest.
1288
1318
  * @param props The properties for the start stage. If you not want to pass any property, you can pass an {}.
@@ -1300,6 +1330,7 @@ var Quest = class extends pixiVn.StoredClassModel {
1300
1330
  this.currentStageIndex = 0;
1301
1331
  let currentStage = this.currentStage;
1302
1332
  if (currentStage && currentStage.start) {
1333
+ this.onStart && this.onStart(props);
1303
1334
  return currentStage.start(props);
1304
1335
  } else {
1305
1336
  console.error(`[NQTR] Quest ${this.id} has no start stage`);
@@ -1368,6 +1399,7 @@ var Quest = class extends pixiVn.StoredClassModel {
1368
1399
  return false;
1369
1400
  }
1370
1401
  this.currentStageIndex = currentStageIndex + 1;
1402
+ this.onNextStage && this.onNextStage(endProps);
1371
1403
  if (prevStage && prevStage.onEnd) {
1372
1404
  prevStage.onEnd(endProps);
1373
1405
  }