@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.
- package/dist/{StageProps-Bok_NwL7.d.ts → StageProps-CCjGI625.d.ts} +18 -21
- package/dist/{StageProps-CFQizpZF.d.mts → StageProps-CuE_n1Wg.d.mts} +18 -21
- package/dist/classes/index.d.mts +1 -1
- package/dist/classes/index.d.ts +1 -1
- package/dist/classes/index.js +17 -36
- package/dist/classes/index.js.map +1 -1
- package/dist/classes/index.mjs +17 -36
- package/dist/classes/index.mjs.map +1 -1
- package/dist/classes/navigation/Room.js.map +1 -1
- package/dist/classes/navigation/Room.mjs.map +1 -1
- package/dist/classes/quest/Quest.d.mts +1 -1
- package/dist/classes/quest/Quest.d.ts +1 -1
- package/dist/classes/quest/Quest.js +17 -36
- package/dist/classes/quest/Quest.js.map +1 -1
- package/dist/classes/quest/Quest.mjs +17 -36
- package/dist/classes/quest/Quest.mjs.map +1 -1
- package/dist/classes/quest/Stage.d.mts +1 -1
- package/dist/classes/quest/Stage.d.ts +1 -1
- package/dist/classes/quest/Stage.js +3 -11
- package/dist/classes/quest/Stage.js.map +1 -1
- package/dist/classes/quest/Stage.mjs +3 -11
- package/dist/classes/quest/Stage.mjs.map +1 -1
- package/dist/decorators/QuestDecorator.d.mts +1 -1
- package/dist/decorators/QuestDecorator.d.ts +1 -1
- package/dist/decorators/QuestDecorator.js +17 -36
- package/dist/decorators/QuestDecorator.js.map +1 -1
- package/dist/decorators/QuestDecorator.mjs +17 -36
- package/dist/decorators/QuestDecorator.mjs.map +1 -1
- package/dist/decorators/index.d.mts +1 -1
- package/dist/decorators/index.d.ts +1 -1
- package/dist/decorators/index.js +17 -36
- package/dist/decorators/index.js.map +1 -1
- package/dist/decorators/index.mjs +17 -36
- package/dist/decorators/index.mjs.map +1 -1
- package/dist/functions/ActivityFunctions.js.map +1 -1
- package/dist/functions/ActivityFunctions.mjs.map +1 -1
- package/dist/functions/NavigationFunctions.js.map +1 -1
- package/dist/functions/NavigationFunctions.mjs.map +1 -1
- package/dist/functions/QuestFunctions.d.mts +2 -2
- package/dist/functions/QuestFunctions.d.ts +2 -2
- package/dist/functions/QuestFunctions.js.map +1 -1
- package/dist/functions/QuestFunctions.mjs.map +1 -1
- package/dist/functions/RoutineFunctions.js.map +1 -1
- package/dist/functions/RoutineFunctions.mjs.map +1 -1
- package/dist/functions/index.js.map +1 -1
- package/dist/functions/index.mjs.map +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +17 -36
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +17 -36
- package/dist/index.mjs.map +1 -1
- package/dist/interface/index.d.mts +1 -1
- package/dist/interface/index.d.ts +1 -1
- package/dist/interface/quest/QuestProps.d.mts +1 -1
- package/dist/interface/quest/QuestProps.d.ts +1 -1
- package/dist/interface/quest/StageProps.d.mts +1 -1
- package/dist/interface/quest/StageProps.d.ts +1 -1
- package/dist/types/QuestsRequired.d.mts +1 -1
- package/dist/types/QuestsRequired.d.ts +1 -1
- package/dist/types/index.d.mts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -1277,21 +1277,13 @@ var Stage = class extends StoredClassModel {
|
|
|
1277
1277
|
* The function that will be called when the stage starts.
|
|
1278
1278
|
*/
|
|
1279
1279
|
get onStart() {
|
|
1280
|
-
|
|
1281
|
-
if (onStart === void 0) {
|
|
1282
|
-
return void 0;
|
|
1283
|
-
}
|
|
1284
|
-
return (props) => onStart(this, props);
|
|
1280
|
+
return this._onStart;
|
|
1285
1281
|
}
|
|
1286
1282
|
/**
|
|
1287
1283
|
* The function that will be called when the stage ends.
|
|
1288
1284
|
*/
|
|
1289
1285
|
get onEnd() {
|
|
1290
|
-
|
|
1291
|
-
if (onEnd === void 0) {
|
|
1292
|
-
return void 0;
|
|
1293
|
-
}
|
|
1294
|
-
return (props) => onEnd(this, props);
|
|
1286
|
+
return this._onEnd;
|
|
1295
1287
|
}
|
|
1296
1288
|
};
|
|
1297
1289
|
var StageQuest = class extends Stage {
|
|
@@ -1394,7 +1386,7 @@ var StageQuest = class extends Stage {
|
|
|
1394
1386
|
if (this.canStart) {
|
|
1395
1387
|
this.started = true;
|
|
1396
1388
|
if (this.onStart) {
|
|
1397
|
-
this.onStart(props);
|
|
1389
|
+
this.onStart(this, props);
|
|
1398
1390
|
}
|
|
1399
1391
|
} else {
|
|
1400
1392
|
console.warn(`[NQTR] Stage ${this.id} can't start`);
|
|
@@ -1510,21 +1502,13 @@ var Quest = class extends StoredClassModel {
|
|
|
1510
1502
|
* The function that will be called when the quest starts.
|
|
1511
1503
|
*/
|
|
1512
1504
|
get onStart() {
|
|
1513
|
-
|
|
1514
|
-
if (onStart === void 0) {
|
|
1515
|
-
return void 0;
|
|
1516
|
-
}
|
|
1517
|
-
return (props) => onStart(this, props);
|
|
1505
|
+
return this._onStart;
|
|
1518
1506
|
}
|
|
1519
1507
|
/**
|
|
1520
1508
|
* The function that will be called when the quest goes to the next stage.
|
|
1521
1509
|
*/
|
|
1522
1510
|
get onNextStage() {
|
|
1523
|
-
|
|
1524
|
-
if (onNext === void 0) {
|
|
1525
|
-
return void 0;
|
|
1526
|
-
}
|
|
1527
|
-
return (props) => onNext(this, props);
|
|
1511
|
+
return this._onNextStage;
|
|
1528
1512
|
}
|
|
1529
1513
|
/**
|
|
1530
1514
|
* Start the quest.
|
|
@@ -1543,7 +1527,7 @@ var Quest = class extends StoredClassModel {
|
|
|
1543
1527
|
this.currentStageIndex = 0;
|
|
1544
1528
|
let currentStage = this.currentStage;
|
|
1545
1529
|
if (currentStage && currentStage.start) {
|
|
1546
|
-
this.onStart && this.onStart(props);
|
|
1530
|
+
this.onStart && this.onStart(this, props);
|
|
1547
1531
|
return currentStage.start(props);
|
|
1548
1532
|
} else {
|
|
1549
1533
|
console.error(`[NQTR] Quest ${this.id} has no start stage`);
|
|
@@ -1552,11 +1536,10 @@ var Quest = class extends StoredClassModel {
|
|
|
1552
1536
|
/**
|
|
1553
1537
|
* Go to the next stage if the current stage is completed.
|
|
1554
1538
|
* If you want to force the change of stage, use goNextStage.
|
|
1555
|
-
* @param
|
|
1556
|
-
* @param endProps The properties for the end stage. If you not want to pass any property, you can pass an {}.
|
|
1539
|
+
* @param props The properties. If you not want to pass any property, you can pass an {}.
|
|
1557
1540
|
* @returns true if the stage was changed, false otherwise.
|
|
1558
1541
|
*/
|
|
1559
|
-
tryToGoNextStage(
|
|
1542
|
+
tryToGoNextStage(props) {
|
|
1560
1543
|
if (!this.started) {
|
|
1561
1544
|
return false;
|
|
1562
1545
|
}
|
|
@@ -1569,34 +1552,32 @@ var Quest = class extends StoredClassModel {
|
|
|
1569
1552
|
return false;
|
|
1570
1553
|
}
|
|
1571
1554
|
if (currentStage.completed) {
|
|
1572
|
-
return this.goNextStage(
|
|
1555
|
+
return this.goNextStage(props);
|
|
1573
1556
|
}
|
|
1574
1557
|
return false;
|
|
1575
1558
|
}
|
|
1576
1559
|
/**
|
|
1577
1560
|
* Complete the current stage and go to the next stage.
|
|
1578
1561
|
* If you want to go to the next stage only if the current stage is completed, use tryToGoNextStage.
|
|
1579
|
-
* @param
|
|
1580
|
-
* @param endProps The properties for the end stage. If you not want to pass any property, you can pass an {}.
|
|
1562
|
+
* @param props The properties. If you not want to pass any property, you can pass an {}.
|
|
1581
1563
|
* @returns true if the stage was changed, false otherwise.
|
|
1582
1564
|
*/
|
|
1583
|
-
completeCurrentStageAndGoNext(
|
|
1565
|
+
completeCurrentStageAndGoNext(props) {
|
|
1584
1566
|
let currentStage = this.currentStage;
|
|
1585
1567
|
if (!currentStage) {
|
|
1586
1568
|
console.error(`[NQTR] Quest ${this.id} has no current stage`);
|
|
1587
1569
|
return false;
|
|
1588
1570
|
}
|
|
1589
1571
|
currentStage.completed = true;
|
|
1590
|
-
return this.goNextStage(
|
|
1572
|
+
return this.goNextStage(props);
|
|
1591
1573
|
}
|
|
1592
1574
|
/**
|
|
1593
1575
|
* Go to the next stage without checking if the current stage is completed.
|
|
1594
1576
|
* If you want to go to the next stage only if the current stage is completed, use tryToGoNextStage.
|
|
1595
|
-
* @param
|
|
1596
|
-
* @param endProps
|
|
1577
|
+
* @param props The properties. If you not want to pass any property, you can pass an {}.
|
|
1597
1578
|
* @returns returns true if the stage was changed, false otherwise.
|
|
1598
1579
|
*/
|
|
1599
|
-
goNextStage(
|
|
1580
|
+
goNextStage(props) {
|
|
1600
1581
|
if (!this.started) {
|
|
1601
1582
|
console.warn(`[NQTR] Quest ${this.id} is not started`);
|
|
1602
1583
|
return false;
|
|
@@ -1612,15 +1593,15 @@ var Quest = class extends StoredClassModel {
|
|
|
1612
1593
|
return false;
|
|
1613
1594
|
}
|
|
1614
1595
|
this.currentStageIndex = currentStageIndex + 1;
|
|
1615
|
-
this.onNextStage && this.onNextStage(
|
|
1596
|
+
this.onNextStage && this.onNextStage(this, props);
|
|
1616
1597
|
if (prevStage && prevStage.onEnd) {
|
|
1617
|
-
prevStage.onEnd(
|
|
1598
|
+
prevStage.onEnd(prevStage, props);
|
|
1618
1599
|
}
|
|
1619
1600
|
let nextCurrentStage = this.currentStage;
|
|
1620
1601
|
if (nextCurrentStage) {
|
|
1621
1602
|
nextCurrentStage.inizialize();
|
|
1622
1603
|
if (this.currentStageMustStart) {
|
|
1623
|
-
this.startCurrentStage(
|
|
1604
|
+
this.startCurrentStage(props);
|
|
1624
1605
|
}
|
|
1625
1606
|
}
|
|
1626
1607
|
return true;
|