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