@drincs/nqtr 0.1.20 → 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/{ActivityProps-_79x9-BX.d.ts → ActivityProps-BkHX8xkA.d.ts} +1 -1
- package/dist/{ActivityProps-BoJeWa2B.d.mts → ActivityProps-D45DQdcT.d.mts} +1 -1
- package/dist/{Commitment-Cc2kZEy0.d.ts → Commitment-BJTIpBQ5.d.ts} +4 -2
- package/dist/{Commitment-C3Nc2RJH.d.mts → Commitment-CtNWnNQX.d.mts} +4 -2
- package/dist/{Quest-BQ1pwvQ_.d.ts → StageProps-BFsiCaZT.d.ts} +160 -81
- package/dist/{Quest-DaNlPBHb.d.mts → StageProps-CkXejAbn.d.mts} +160 -81
- package/dist/classes/Activity.d.mts +2 -2
- package/dist/classes/Activity.d.ts +2 -2
- package/dist/classes/Activity.js +1 -1
- package/dist/classes/Activity.js.map +1 -1
- package/dist/classes/Activity.mjs +1 -1
- package/dist/classes/Activity.mjs.map +1 -1
- package/dist/classes/ActivityStoredAbstract.d.mts +1 -1
- package/dist/classes/ActivityStoredAbstract.d.ts +1 -1
- package/dist/classes/ActivityStoredAbstract.js +1 -1
- package/dist/classes/ActivityStoredAbstract.js.map +1 -1
- package/dist/classes/ActivityStoredAbstract.mjs +1 -1
- package/dist/classes/ActivityStoredAbstract.mjs.map +1 -1
- package/dist/classes/Commitment.d.mts +2 -2
- package/dist/classes/Commitment.d.ts +2 -2
- package/dist/classes/Commitment.js +2 -2
- package/dist/classes/Commitment.js.map +1 -1
- package/dist/classes/Commitment.mjs +2 -2
- package/dist/classes/Commitment.mjs.map +1 -1
- package/dist/classes/index.d.mts +3 -3
- package/dist/classes/index.d.ts +3 -3
- package/dist/classes/index.js +133 -318
- package/dist/classes/index.js.map +1 -1
- package/dist/classes/index.mjs +134 -318
- package/dist/classes/index.mjs.map +1 -1
- package/dist/classes/navigation/ActivityRoom.d.mts +2 -2
- package/dist/classes/navigation/ActivityRoom.d.ts +2 -2
- package/dist/classes/navigation/ActivityRoom.js +1 -1
- package/dist/classes/navigation/ActivityRoom.js.map +1 -1
- package/dist/classes/navigation/ActivityRoom.mjs +1 -1
- package/dist/classes/navigation/ActivityRoom.mjs.map +1 -1
- package/dist/classes/navigation/Location.d.mts +2 -2
- package/dist/classes/navigation/Location.d.ts +2 -2
- package/dist/classes/navigation/Map.d.mts +2 -2
- package/dist/classes/navigation/Map.d.ts +2 -2
- package/dist/classes/navigation/Room.d.mts +2 -2
- package/dist/classes/navigation/Room.d.ts +2 -2
- package/dist/classes/navigation/Room.js +34 -36
- package/dist/classes/navigation/Room.js.map +1 -1
- package/dist/classes/navigation/Room.mjs +34 -36
- 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 +107 -8
- package/dist/classes/quest/Quest.js.map +1 -1
- package/dist/classes/quest/Quest.mjs +107 -8
- 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/ActivityDecorator.d.mts +1 -1
- package/dist/decorators/ActivityDecorator.d.ts +1 -1
- package/dist/decorators/CommitmentDecorator.d.mts +9 -3
- package/dist/decorators/CommitmentDecorator.d.ts +9 -3
- package/dist/decorators/CommitmentDecorator.js +16 -1
- package/dist/decorators/CommitmentDecorator.js.map +1 -1
- package/dist/decorators/CommitmentDecorator.mjs +16 -2
- package/dist/decorators/CommitmentDecorator.mjs.map +1 -1
- package/dist/decorators/QuestDecorator.d.mts +8 -10
- package/dist/decorators/QuestDecorator.d.ts +8 -10
- package/dist/decorators/QuestDecorator.js +667 -9
- package/dist/decorators/QuestDecorator.js.map +1 -1
- package/dist/decorators/QuestDecorator.mjs +667 -9
- package/dist/decorators/QuestDecorator.mjs.map +1 -1
- package/dist/decorators/RoomDecorator.d.mts +2 -2
- package/dist/decorators/RoomDecorator.d.ts +2 -2
- package/dist/decorators/index.d.mts +5 -5
- package/dist/decorators/index.d.ts +5 -5
- package/dist/decorators/index.js +679 -10
- package/dist/decorators/index.js.map +1 -1
- package/dist/decorators/index.mjs +679 -11
- package/dist/decorators/index.mjs.map +1 -1
- package/dist/functions/ActivityFunctions.d.mts +2 -2
- package/dist/functions/ActivityFunctions.d.ts +2 -2
- package/dist/functions/ActivityFunctions.js.map +1 -1
- package/dist/functions/ActivityFunctions.mjs.map +1 -1
- package/dist/functions/NavigationFunctions.d.mts +2 -2
- package/dist/functions/NavigationFunctions.d.ts +2 -2
- package/dist/functions/NavigationFunctions.js.map +1 -1
- package/dist/functions/NavigationFunctions.mjs.map +1 -1
- package/dist/functions/RoutineFunctions.d.mts +2 -2
- package/dist/functions/RoutineFunctions.d.ts +2 -2
- package/dist/functions/RoutineFunctions.js.map +1 -1
- package/dist/functions/RoutineFunctions.mjs.map +1 -1
- package/dist/functions/index.d.mts +2 -2
- package/dist/functions/index.d.ts +2 -2
- package/dist/functions/index.js.map +1 -1
- package/dist/functions/index.mjs.map +1 -1
- package/dist/index.d.mts +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.js +505 -392
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +504 -391
- package/dist/index.mjs.map +1 -1
- package/dist/interface/ActivityProps.d.mts +1 -1
- package/dist/interface/ActivityProps.d.ts +1 -1
- package/dist/interface/CommitmentProps.d.mts +2 -2
- package/dist/interface/CommitmentProps.d.ts +2 -2
- package/dist/interface/RoomActivityMemory.d.mts +1 -1
- package/dist/interface/RoomActivityMemory.d.ts +1 -1
- package/dist/interface/RoomProps.d.mts +2 -2
- package/dist/interface/RoomProps.d.ts +2 -2
- package/dist/interface/index.d.mts +3 -3
- package/dist/interface/index.d.ts +3 -3
- package/dist/interface/navigation/LocationProps.d.mts +2 -2
- package/dist/interface/navigation/LocationProps.d.ts +2 -2
- package/dist/interface/navigation/MapProps.d.mts +2 -2
- package/dist/interface/navigation/MapProps.d.ts +2 -2
- 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/classes/index.js
CHANGED
|
@@ -361,7 +361,7 @@ var ActivityModel = class {
|
|
|
361
361
|
/**
|
|
362
362
|
* The function that is called when the activity is runned.
|
|
363
363
|
*/
|
|
364
|
-
get
|
|
364
|
+
get run() {
|
|
365
365
|
return (props) => this._onRun(this, props);
|
|
366
366
|
}
|
|
367
367
|
/**
|
|
@@ -491,6 +491,7 @@ var CommitmentBaseModel = class extends pixiVn.StoredClassModel {
|
|
|
491
491
|
}
|
|
492
492
|
/**
|
|
493
493
|
* Execution type. If is "automatic" the onRun() runned automatically when the palayer is in the room. If is "interaction" the player must interact with the character to run the onRun() function.
|
|
494
|
+
* If you set "automatic" remember to remove the commitment when it is no longer needed, because otherwise it repeats itself every time.
|
|
494
495
|
*/
|
|
495
496
|
get executionType() {
|
|
496
497
|
return this._executionType;
|
|
@@ -513,10 +514,9 @@ var CommitmentBaseModel = class extends pixiVn.StoredClassModel {
|
|
|
513
514
|
/**
|
|
514
515
|
* Is a function that is called when the player interacts with the character.
|
|
515
516
|
*/
|
|
516
|
-
get
|
|
517
|
+
get run() {
|
|
517
518
|
let onRun = this._onRun;
|
|
518
519
|
if (!onRun) {
|
|
519
|
-
console.warn("[NQTR] onRun() is not defined for commitmen, so it will not run.", this);
|
|
520
520
|
return;
|
|
521
521
|
}
|
|
522
522
|
return (props) => onRun(this, props);
|
|
@@ -691,7 +691,7 @@ var ActivityStoredAbstract = class {
|
|
|
691
691
|
/**
|
|
692
692
|
* The function that is called when the activity is runned.
|
|
693
693
|
*/
|
|
694
|
-
get
|
|
694
|
+
get run() {
|
|
695
695
|
return (props) => {
|
|
696
696
|
return this._onRun(this, props);
|
|
697
697
|
};
|
|
@@ -1023,6 +1023,135 @@ function getTemporaryCommitments() {
|
|
|
1023
1023
|
let commitments = commitmentsIds.map((id) => getCommitmentById(id)).filter((commitment) => commitment !== void 0);
|
|
1024
1024
|
return commitments;
|
|
1025
1025
|
}
|
|
1026
|
+
var GOAL_CATEGORY = "__nqtr-goal__";
|
|
1027
|
+
var Goal = class extends pixiVn.StoredClassModel {
|
|
1028
|
+
constructor(id, props) {
|
|
1029
|
+
super(GOAL_CATEGORY, id);
|
|
1030
|
+
this._description = props.description;
|
|
1031
|
+
this._need = props.need || 1;
|
|
1032
|
+
this._defaultHave = props.have || 0;
|
|
1033
|
+
}
|
|
1034
|
+
/**
|
|
1035
|
+
* The description of the goal.
|
|
1036
|
+
*/
|
|
1037
|
+
get description() {
|
|
1038
|
+
return this._description;
|
|
1039
|
+
}
|
|
1040
|
+
/**
|
|
1041
|
+
* The number of times the goal must be completed.
|
|
1042
|
+
*/
|
|
1043
|
+
get need() {
|
|
1044
|
+
return this._need;
|
|
1045
|
+
}
|
|
1046
|
+
/**
|
|
1047
|
+
* The default number of times the goal has been completed.
|
|
1048
|
+
*/
|
|
1049
|
+
get defaultHave() {
|
|
1050
|
+
return this._defaultHave;
|
|
1051
|
+
}
|
|
1052
|
+
};
|
|
1053
|
+
|
|
1054
|
+
// src/classes/quest/Stage.ts
|
|
1055
|
+
var STAGE_CATEGORY = "__nqtr-stage__";
|
|
1056
|
+
var Stage = class extends pixiVn.StoredClassModel {
|
|
1057
|
+
constructor(id, props) {
|
|
1058
|
+
super(STAGE_CATEGORY, id);
|
|
1059
|
+
this._name = props.name || "";
|
|
1060
|
+
this._defaultGoals = props.goals || [];
|
|
1061
|
+
this._flags = props.flags || [];
|
|
1062
|
+
this._description = props.description || "";
|
|
1063
|
+
this._adviceDescription = props.adviceDescription || "";
|
|
1064
|
+
this._renderImage = props.renderImage;
|
|
1065
|
+
this._daysRequiredToStart = props.daysRequiredToStart;
|
|
1066
|
+
this._flagsRequiredToStart = props.flagsRequired || [];
|
|
1067
|
+
this._questsRequiredToStart = props.questsRequired || [];
|
|
1068
|
+
this._requestDescriptionToStart = props.requestDescription || "";
|
|
1069
|
+
this._onStart = props.onStart;
|
|
1070
|
+
this._onEnd = props.onEnd;
|
|
1071
|
+
}
|
|
1072
|
+
/**
|
|
1073
|
+
* The name of the stage.
|
|
1074
|
+
*/
|
|
1075
|
+
get name() {
|
|
1076
|
+
return this._name;
|
|
1077
|
+
}
|
|
1078
|
+
/**
|
|
1079
|
+
* The description of the stage.
|
|
1080
|
+
*/
|
|
1081
|
+
get description() {
|
|
1082
|
+
return this._description;
|
|
1083
|
+
}
|
|
1084
|
+
/**
|
|
1085
|
+
* The advice description of the stage.
|
|
1086
|
+
*/
|
|
1087
|
+
get adviceDescription() {
|
|
1088
|
+
return this._adviceDescription;
|
|
1089
|
+
}
|
|
1090
|
+
/**
|
|
1091
|
+
* The function for rendering the image of the stage.
|
|
1092
|
+
*/
|
|
1093
|
+
get renderImage() {
|
|
1094
|
+
let render = this._renderImage;
|
|
1095
|
+
if (render === void 0) {
|
|
1096
|
+
return void 0;
|
|
1097
|
+
}
|
|
1098
|
+
if (typeof render === "function") {
|
|
1099
|
+
return (props) => {
|
|
1100
|
+
return render(this, props);
|
|
1101
|
+
};
|
|
1102
|
+
}
|
|
1103
|
+
return (props) => render;
|
|
1104
|
+
}
|
|
1105
|
+
/**
|
|
1106
|
+
* The list of goals that the player needs to complete to finish the stage.
|
|
1107
|
+
* This is the list set by the developer. if you want to get the current goals, use the goals property.
|
|
1108
|
+
*/
|
|
1109
|
+
get defaultGoals() {
|
|
1110
|
+
return this._defaultGoals;
|
|
1111
|
+
}
|
|
1112
|
+
/**
|
|
1113
|
+
* The list of flags that the player must complete to finish the stage.
|
|
1114
|
+
*/
|
|
1115
|
+
get flags() {
|
|
1116
|
+
return this._flags;
|
|
1117
|
+
}
|
|
1118
|
+
/**
|
|
1119
|
+
* The number of days required to start the stage.
|
|
1120
|
+
*/
|
|
1121
|
+
get daysRequiredToStart() {
|
|
1122
|
+
return this._daysRequiredToStart || 0;
|
|
1123
|
+
}
|
|
1124
|
+
/**
|
|
1125
|
+
* The list of flags required to start the stage.
|
|
1126
|
+
*/
|
|
1127
|
+
get flagsRequiredToStart() {
|
|
1128
|
+
return this._flagsRequiredToStart;
|
|
1129
|
+
}
|
|
1130
|
+
/**
|
|
1131
|
+
* The list of quests required to start the stage.
|
|
1132
|
+
*/
|
|
1133
|
+
get questsRequiredToStart() {
|
|
1134
|
+
return this._questsRequiredToStart || [];
|
|
1135
|
+
}
|
|
1136
|
+
/**
|
|
1137
|
+
* The description of the request to start the stage.
|
|
1138
|
+
*/
|
|
1139
|
+
get requestDescriptionToStart() {
|
|
1140
|
+
return this._requestDescriptionToStart;
|
|
1141
|
+
}
|
|
1142
|
+
/**
|
|
1143
|
+
* The function that will be called when the stage starts.
|
|
1144
|
+
*/
|
|
1145
|
+
get onStart() {
|
|
1146
|
+
return this._onStart;
|
|
1147
|
+
}
|
|
1148
|
+
/**
|
|
1149
|
+
* The function that will be called when the stage ends.
|
|
1150
|
+
*/
|
|
1151
|
+
get onEnd() {
|
|
1152
|
+
return this._onEnd;
|
|
1153
|
+
}
|
|
1154
|
+
};
|
|
1026
1155
|
|
|
1027
1156
|
// src/functions/RoutineFunctions.ts
|
|
1028
1157
|
function getCurrentRoutine() {
|
|
@@ -1294,319 +1423,6 @@ var RoomBaseModel = class extends pixiVn.StoredClassModel {
|
|
|
1294
1423
|
return commitments.filter((c) => c.room.id === this.id);
|
|
1295
1424
|
}
|
|
1296
1425
|
};
|
|
1297
|
-
var GOAL_CATEGORY = "__nqtr-goal__";
|
|
1298
|
-
var Goal = class extends pixiVn.StoredClassModel {
|
|
1299
|
-
constructor(id, props) {
|
|
1300
|
-
super(GOAL_CATEGORY, id);
|
|
1301
|
-
this._description = props.description;
|
|
1302
|
-
this._need = props.need || 1;
|
|
1303
|
-
this._defaultHave = props.have || 0;
|
|
1304
|
-
}
|
|
1305
|
-
/**
|
|
1306
|
-
* The description of the goal.
|
|
1307
|
-
*/
|
|
1308
|
-
get description() {
|
|
1309
|
-
return this._description;
|
|
1310
|
-
}
|
|
1311
|
-
get need() {
|
|
1312
|
-
return this._need;
|
|
1313
|
-
}
|
|
1314
|
-
get defaultHave() {
|
|
1315
|
-
return this._defaultHave;
|
|
1316
|
-
}
|
|
1317
|
-
};
|
|
1318
|
-
var GoalStage = class extends Goal {
|
|
1319
|
-
constructor(id, stageId, props) {
|
|
1320
|
-
super(id, props);
|
|
1321
|
-
this._stageId = stageId;
|
|
1322
|
-
}
|
|
1323
|
-
get stageId() {
|
|
1324
|
-
return this._stageId;
|
|
1325
|
-
}
|
|
1326
|
-
set stageId(value) {
|
|
1327
|
-
this._stageId = value;
|
|
1328
|
-
}
|
|
1329
|
-
get have() {
|
|
1330
|
-
return this.getStorageProperty("have-" + this._stageId) || this.defaultHave;
|
|
1331
|
-
}
|
|
1332
|
-
set have(value) {
|
|
1333
|
-
if (!this._stageId) {
|
|
1334
|
-
console.error(`[NQTR] The stage id is not set for the goal ${this.id}, so the have value can't be set.`);
|
|
1335
|
-
return;
|
|
1336
|
-
}
|
|
1337
|
-
this.setStorageProperty("have-" + this._stageId, value);
|
|
1338
|
-
}
|
|
1339
|
-
get completed() {
|
|
1340
|
-
return this.have >= this.need;
|
|
1341
|
-
}
|
|
1342
|
-
set completed(value) {
|
|
1343
|
-
if (value) {
|
|
1344
|
-
this.have = this.need;
|
|
1345
|
-
} else {
|
|
1346
|
-
console.warn(`[NQTR] The goal can't be set as not completed. You must edit the have value manually.`);
|
|
1347
|
-
}
|
|
1348
|
-
}
|
|
1349
|
-
find() {
|
|
1350
|
-
this.have++;
|
|
1351
|
-
}
|
|
1352
|
-
};
|
|
1353
|
-
var STAGE_CATEGORY = "__nqtr-stage__";
|
|
1354
|
-
var Stage = class extends pixiVn.StoredClassModel {
|
|
1355
|
-
constructor(id, props) {
|
|
1356
|
-
super(STAGE_CATEGORY, id);
|
|
1357
|
-
this._name = props.name || "";
|
|
1358
|
-
this._defaultGoals = props.goals || [];
|
|
1359
|
-
this._flags = props.flags || [];
|
|
1360
|
-
this._description = props.description || "";
|
|
1361
|
-
this._adviceDescription = props.adviceDescription || "";
|
|
1362
|
-
this._renderImage = props.renderImage;
|
|
1363
|
-
this._daysRequiredToStart = props.daysRequiredToStart;
|
|
1364
|
-
this._flagsRequiredToStart = props.flagsRequired || [];
|
|
1365
|
-
this._questsRequiredToStart = props.questsRequired || [];
|
|
1366
|
-
this._requestDescriptionToStart = props.requestDescription || "";
|
|
1367
|
-
this._onStart = props.onStart;
|
|
1368
|
-
this._onEnd = props.onEnd;
|
|
1369
|
-
}
|
|
1370
|
-
get name() {
|
|
1371
|
-
return this._name;
|
|
1372
|
-
}
|
|
1373
|
-
get description() {
|
|
1374
|
-
return this._description;
|
|
1375
|
-
}
|
|
1376
|
-
get adviceDescription() {
|
|
1377
|
-
return this._adviceDescription;
|
|
1378
|
-
}
|
|
1379
|
-
/**
|
|
1380
|
-
* The function for rendering the image of the stage.
|
|
1381
|
-
*/
|
|
1382
|
-
get renderImage() {
|
|
1383
|
-
let render = this._renderImage;
|
|
1384
|
-
if (render === void 0) {
|
|
1385
|
-
return void 0;
|
|
1386
|
-
}
|
|
1387
|
-
if (typeof render === "function") {
|
|
1388
|
-
return (props) => {
|
|
1389
|
-
return render(this, props);
|
|
1390
|
-
};
|
|
1391
|
-
}
|
|
1392
|
-
return (props) => render;
|
|
1393
|
-
}
|
|
1394
|
-
get defaultGoals() {
|
|
1395
|
-
return this._defaultGoals;
|
|
1396
|
-
}
|
|
1397
|
-
/**
|
|
1398
|
-
* The list of flags that the player must complete to finish the stage.
|
|
1399
|
-
*/
|
|
1400
|
-
get flags() {
|
|
1401
|
-
return this._flags;
|
|
1402
|
-
}
|
|
1403
|
-
get daysRequiredToStart() {
|
|
1404
|
-
return this._daysRequiredToStart || 0;
|
|
1405
|
-
}
|
|
1406
|
-
get flagsRequiredToStart() {
|
|
1407
|
-
return this._flagsRequiredToStart;
|
|
1408
|
-
}
|
|
1409
|
-
get questsRequiredToStart() {
|
|
1410
|
-
return this._questsRequiredToStart || [];
|
|
1411
|
-
}
|
|
1412
|
-
get requestDescriptionToStart() {
|
|
1413
|
-
return this._requestDescriptionToStart;
|
|
1414
|
-
}
|
|
1415
|
-
get onStart() {
|
|
1416
|
-
return this._onStart;
|
|
1417
|
-
}
|
|
1418
|
-
get onEnd() {
|
|
1419
|
-
return this._onEnd;
|
|
1420
|
-
}
|
|
1421
|
-
};
|
|
1422
|
-
var StageQuest = class extends Stage {
|
|
1423
|
-
constructor(id, props) {
|
|
1424
|
-
super(id, props);
|
|
1425
|
-
}
|
|
1426
|
-
get completed() {
|
|
1427
|
-
let storedCompleted = this.getStorageProperty("completed");
|
|
1428
|
-
if (storedCompleted) {
|
|
1429
|
-
return storedCompleted;
|
|
1430
|
-
}
|
|
1431
|
-
if (!this.flags.every((flag) => pixiVn.getFlag(flag.flag))) {
|
|
1432
|
-
return false;
|
|
1433
|
-
}
|
|
1434
|
-
if (!this.goals.every((goal) => goal.completed)) {
|
|
1435
|
-
return false;
|
|
1436
|
-
}
|
|
1437
|
-
return true;
|
|
1438
|
-
}
|
|
1439
|
-
set completed(value) {
|
|
1440
|
-
this.setStorageProperty("completed", value);
|
|
1441
|
-
}
|
|
1442
|
-
/**
|
|
1443
|
-
* The list of goals that the player needs to complete to finish the stage.
|
|
1444
|
-
*/
|
|
1445
|
-
get goals() {
|
|
1446
|
-
return this.defaultGoals.map((goal) => {
|
|
1447
|
-
return new GoalStage(goal.id, this.id, goal);
|
|
1448
|
-
});
|
|
1449
|
-
}
|
|
1450
|
-
get prevStageEndDay() {
|
|
1451
|
-
return this.getStorageProperty("prevStageEndDay");
|
|
1452
|
-
}
|
|
1453
|
-
set prevStageEndDay(value) {
|
|
1454
|
-
this.setStorageProperty("prevStageEndDay", value);
|
|
1455
|
-
}
|
|
1456
|
-
get startDay() {
|
|
1457
|
-
let prevStageEndDay = this.prevStageEndDay;
|
|
1458
|
-
if (prevStageEndDay === void 0) {
|
|
1459
|
-
return void 0;
|
|
1460
|
-
}
|
|
1461
|
-
return prevStageEndDay + this.daysRequiredToStart;
|
|
1462
|
-
}
|
|
1463
|
-
get canStart() {
|
|
1464
|
-
let daysRequired = this.daysRequiredToStart;
|
|
1465
|
-
if (daysRequired > 0) {
|
|
1466
|
-
let prevStageEndDay = this.prevStageEndDay;
|
|
1467
|
-
if (prevStageEndDay === void 0) {
|
|
1468
|
-
return false;
|
|
1469
|
-
}
|
|
1470
|
-
if (prevStageEndDay + daysRequired > TimeManager.currentDay) {
|
|
1471
|
-
return false;
|
|
1472
|
-
}
|
|
1473
|
-
}
|
|
1474
|
-
if (this.flagsRequiredToStart.length > 0 && !this.flagsRequiredToStart.every((flag) => pixiVn.getFlag(flag.flag))) {
|
|
1475
|
-
return false;
|
|
1476
|
-
}
|
|
1477
|
-
if (this.questsRequiredToStart.length > 0 && !this.questsRequiredToStart.every(
|
|
1478
|
-
(q) => q.quest.currentStageIndex && q.quest.currentStageIndex >= q.stageNumber
|
|
1479
|
-
)) {
|
|
1480
|
-
return false;
|
|
1481
|
-
}
|
|
1482
|
-
return true;
|
|
1483
|
-
}
|
|
1484
|
-
get onStart() {
|
|
1485
|
-
if (this.daysRequiredToStart > 0) {
|
|
1486
|
-
this.prevStageEndDay = TimeManager.currentDay;
|
|
1487
|
-
}
|
|
1488
|
-
return super.onStart;
|
|
1489
|
-
}
|
|
1490
|
-
};
|
|
1491
|
-
|
|
1492
|
-
// src/classes/quest/Quest.ts
|
|
1493
|
-
var QUEST_CATEGORY = "__nqtr-quest__";
|
|
1494
|
-
var Quest = class extends pixiVn.StoredClassModel {
|
|
1495
|
-
constructor(id, stages, props) {
|
|
1496
|
-
super(QUEST_CATEGORY, id);
|
|
1497
|
-
this._stages = stages;
|
|
1498
|
-
this._name = props.name || "";
|
|
1499
|
-
this._description = props.description || "";
|
|
1500
|
-
this._renderIcon = props.renderIcon;
|
|
1501
|
-
this._renderImage = props.renderImage;
|
|
1502
|
-
this._isInDevelopment = props.isInDevelopment || false;
|
|
1503
|
-
}
|
|
1504
|
-
get stages() {
|
|
1505
|
-
return this._stages.map((stage, index) => {
|
|
1506
|
-
return new StageQuest(stage.id, stage);
|
|
1507
|
-
});
|
|
1508
|
-
}
|
|
1509
|
-
get name() {
|
|
1510
|
-
return this._name;
|
|
1511
|
-
}
|
|
1512
|
-
get description() {
|
|
1513
|
-
return this._description;
|
|
1514
|
-
}
|
|
1515
|
-
/**
|
|
1516
|
-
* The function for rendering the icon of the quest.
|
|
1517
|
-
*/
|
|
1518
|
-
get renderIcon() {
|
|
1519
|
-
let render = this._renderIcon;
|
|
1520
|
-
if (render === void 0) {
|
|
1521
|
-
return void 0;
|
|
1522
|
-
}
|
|
1523
|
-
if (typeof render === "function") {
|
|
1524
|
-
return (props) => {
|
|
1525
|
-
return render(this, props);
|
|
1526
|
-
};
|
|
1527
|
-
}
|
|
1528
|
-
return (props) => render;
|
|
1529
|
-
}
|
|
1530
|
-
/**
|
|
1531
|
-
* The function for rendering the image of the quest.
|
|
1532
|
-
*/
|
|
1533
|
-
get renderImage() {
|
|
1534
|
-
let render = this._renderImage;
|
|
1535
|
-
if (render === void 0) {
|
|
1536
|
-
return void 0;
|
|
1537
|
-
}
|
|
1538
|
-
if (typeof render === "function") {
|
|
1539
|
-
return (props) => {
|
|
1540
|
-
return render(this, props);
|
|
1541
|
-
};
|
|
1542
|
-
}
|
|
1543
|
-
return (props) => render;
|
|
1544
|
-
}
|
|
1545
|
-
get isInDevelopment() {
|
|
1546
|
-
return this._isInDevelopment;
|
|
1547
|
-
}
|
|
1548
|
-
get currentStageIndex() {
|
|
1549
|
-
return this.getStorageProperty("currentStageIndex");
|
|
1550
|
-
}
|
|
1551
|
-
set currentStageIndex(value) {
|
|
1552
|
-
this.setStorageProperty("currentStageIndex", value);
|
|
1553
|
-
}
|
|
1554
|
-
get currentStage() {
|
|
1555
|
-
let index = this.currentStageIndex;
|
|
1556
|
-
if (index === void 0 || index >= this.stages.length) {
|
|
1557
|
-
return void 0;
|
|
1558
|
-
}
|
|
1559
|
-
return this.stages[index];
|
|
1560
|
-
}
|
|
1561
|
-
get started() {
|
|
1562
|
-
return this.currentStageIndex !== void 0;
|
|
1563
|
-
}
|
|
1564
|
-
get completed() {
|
|
1565
|
-
return this.currentStageIndex === this.stages.length;
|
|
1566
|
-
}
|
|
1567
|
-
start() {
|
|
1568
|
-
if (this.started) {
|
|
1569
|
-
console.warn(`[NQTR] Quest ${this.id} is already started`);
|
|
1570
|
-
return;
|
|
1571
|
-
}
|
|
1572
|
-
if (this.stages.length === 0) {
|
|
1573
|
-
console.error(`[NQTR] Quest ${this.id} has no stages`);
|
|
1574
|
-
return;
|
|
1575
|
-
}
|
|
1576
|
-
this.currentStageIndex = 0;
|
|
1577
|
-
let currentStage = this.currentStage;
|
|
1578
|
-
if (currentStage && currentStage.onStart) {
|
|
1579
|
-
return currentStage.onStart();
|
|
1580
|
-
} else {
|
|
1581
|
-
console.error(`[NQTR] Quest ${this.id} has no start stage`);
|
|
1582
|
-
}
|
|
1583
|
-
}
|
|
1584
|
-
tryToGoNextStage() {
|
|
1585
|
-
if (!this.started) {
|
|
1586
|
-
return;
|
|
1587
|
-
}
|
|
1588
|
-
if (this.completed) {
|
|
1589
|
-
return;
|
|
1590
|
-
}
|
|
1591
|
-
let currentStage = this.currentStage;
|
|
1592
|
-
let currentStageIndex = this.currentStageIndex;
|
|
1593
|
-
if (!currentStage || currentStageIndex === void 0) {
|
|
1594
|
-
console.error(`[NQTR] Quest ${this.id} has no current stage`);
|
|
1595
|
-
return;
|
|
1596
|
-
}
|
|
1597
|
-
if (currentStage.completed) {
|
|
1598
|
-
let nextStageIndex = currentStageIndex + 1;
|
|
1599
|
-
currentStageIndex = nextStageIndex;
|
|
1600
|
-
let nextStage = this.currentStage;
|
|
1601
|
-
if (currentStage && currentStage.onEnd) {
|
|
1602
|
-
currentStage.onEnd();
|
|
1603
|
-
}
|
|
1604
|
-
if (nextStage && nextStage.onStart) {
|
|
1605
|
-
return nextStage.onStart();
|
|
1606
|
-
}
|
|
1607
|
-
}
|
|
1608
|
-
}
|
|
1609
|
-
};
|
|
1610
1426
|
|
|
1611
1427
|
exports.ActivityModel = ActivityModel;
|
|
1612
1428
|
exports.ActivityRoom = ActivityRoom;
|
|
@@ -1614,7 +1430,6 @@ exports.CommitmentBaseModel = CommitmentBaseModel;
|
|
|
1614
1430
|
exports.Goal = Goal;
|
|
1615
1431
|
exports.LocationBaseModel = LocationBaseModel;
|
|
1616
1432
|
exports.MapBaseModel = MapBaseModel;
|
|
1617
|
-
exports.Quest = Quest;
|
|
1618
1433
|
exports.RoomBaseModel = RoomBaseModel;
|
|
1619
1434
|
exports.Stage = Stage;
|
|
1620
1435
|
//# sourceMappingURL=out.js.map
|