@drincs/nqtr 0.1.18 → 0.1.19
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/{Commitment-DNn_TEgV.d.mts → Commitment-C3Nc2RJH.d.mts} +17 -4
- package/dist/{Commitment-GIA4EK_q.d.ts → Commitment-Cc2kZEy0.d.ts} +17 -4
- package/dist/classes/Commitment.d.mts +2 -2
- package/dist/classes/Commitment.d.ts +2 -2
- package/dist/classes/Commitment.js +12 -1
- package/dist/classes/Commitment.js.map +1 -1
- package/dist/classes/Commitment.mjs +12 -1
- package/dist/classes/Commitment.mjs.map +1 -1
- package/dist/classes/index.d.mts +2 -2
- package/dist/classes/index.d.ts +2 -2
- package/dist/classes/index.js +27 -16
- package/dist/classes/index.js.map +1 -1
- package/dist/classes/index.mjs +27 -16
- 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/Location.d.mts +2 -2
- package/dist/classes/navigation/Location.d.ts +2 -2
- package/dist/classes/navigation/Location.js.map +1 -1
- package/dist/classes/navigation/Location.mjs.map +1 -1
- package/dist/classes/navigation/Map.d.mts +2 -2
- package/dist/classes/navigation/Map.d.ts +2 -2
- package/dist/classes/navigation/Map.js.map +1 -1
- package/dist/classes/navigation/Map.mjs.map +1 -1
- package/dist/classes/navigation/Room.d.mts +2 -2
- package/dist/classes/navigation/Room.d.ts +2 -2
- package/dist/classes/navigation/Room.js +15 -15
- package/dist/classes/navigation/Room.js.map +1 -1
- package/dist/classes/navigation/Room.mjs +15 -15
- package/dist/classes/navigation/Room.mjs.map +1 -1
- package/dist/classes/quest/Stage.d.mts +2 -2
- package/dist/classes/quest/Stage.d.ts +2 -2
- package/dist/decorators/ActivityDecorator.d.mts +1 -1
- package/dist/decorators/ActivityDecorator.d.ts +1 -1
- package/dist/decorators/ActivityDecorator.js.map +1 -1
- package/dist/decorators/ActivityDecorator.mjs.map +1 -1
- package/dist/decorators/CommitmentDecorator.d.mts +32 -6
- package/dist/decorators/CommitmentDecorator.d.ts +32 -6
- package/dist/decorators/CommitmentDecorator.js +7 -7
- package/dist/decorators/CommitmentDecorator.js.map +1 -1
- package/dist/decorators/CommitmentDecorator.mjs +5 -5
- package/dist/decorators/CommitmentDecorator.mjs.map +1 -1
- package/dist/decorators/RoomDecorator.d.mts +3 -3
- package/dist/decorators/RoomDecorator.d.ts +3 -3
- package/dist/decorators/RoomDecorator.js.map +1 -1
- package/dist/decorators/RoomDecorator.mjs.map +1 -1
- package/dist/decorators/index.d.mts +3 -3
- package/dist/decorators/index.d.ts +3 -3
- package/dist/decorators/index.js +5 -18
- package/dist/decorators/index.js.map +1 -1
- package/dist/decorators/index.mjs +4 -15
- 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 +21 -4
- package/dist/functions/RoutineFunctions.d.ts +21 -4
- package/dist/functions/RoutineFunctions.js +16 -16
- package/dist/functions/RoutineFunctions.js.map +1 -1
- package/dist/functions/RoutineFunctions.mjs +16 -16
- package/dist/functions/RoutineFunctions.mjs.map +1 -1
- package/dist/functions/index.d.mts +3 -3
- package/dist/functions/index.d.ts +3 -3
- package/dist/functions/index.js +16 -16
- package/dist/functions/index.js.map +1 -1
- package/dist/functions/index.mjs +16 -16
- package/dist/functions/index.mjs.map +1 -1
- package/dist/index.d.mts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +34 -35
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +32 -30
- package/dist/index.mjs.map +1 -1
- package/dist/interface/CommitmentProps.d.mts +2 -2
- package/dist/interface/CommitmentProps.d.ts +2 -2
- package/dist/interface/RoomProps.d.mts +2 -2
- package/dist/interface/RoomProps.d.ts +2 -2
- package/dist/interface/index.d.mts +2 -2
- package/dist/interface/index.d.ts +2 -2
- 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/types/ExecutionType.d.mts +3 -0
- package/dist/types/ExecutionType.d.ts +3 -0
- package/dist/types/ExecutionType.js +4 -0
- package/dist/types/ExecutionType.js.map +1 -0
- package/dist/types/ExecutionType.mjs +3 -0
- package/dist/types/ExecutionType.mjs.map +1 -0
- package/dist/types/index.d.mts +1 -0
- package/dist/types/index.d.ts +1 -0
- package/package.json +1 -1
- package/dist/enums/ExecutionTypeEnum.d.mts +0 -6
- package/dist/enums/ExecutionTypeEnum.d.ts +0 -6
- package/dist/enums/ExecutionTypeEnum.js +0 -12
- package/dist/enums/ExecutionTypeEnum.js.map +0 -1
- package/dist/enums/ExecutionTypeEnum.mjs +0 -10
- package/dist/enums/ExecutionTypeEnum.mjs.map +0 -1
- package/dist/enums/index.d.mts +0 -1
- package/dist/enums/index.d.ts +0 -1
- package/dist/enums/index.js +0 -12
- package/dist/enums/index.js.map +0 -1
- package/dist/enums/index.mjs +0 -10
- package/dist/enums/index.mjs.map +0 -1
package/dist/index.mjs
CHANGED
|
@@ -389,15 +389,6 @@ var ActivityModel = class {
|
|
|
389
389
|
};
|
|
390
390
|
}
|
|
391
391
|
};
|
|
392
|
-
|
|
393
|
-
// src/enums/ExecutionTypeEnum.ts
|
|
394
|
-
var ExecutionTypeEnum = /* @__PURE__ */ ((ExecutionTypeEnum2) => {
|
|
395
|
-
ExecutionTypeEnum2["AUTOMATIC"] = "automatic";
|
|
396
|
-
ExecutionTypeEnum2["INTERACTION"] = "interaction";
|
|
397
|
-
return ExecutionTypeEnum2;
|
|
398
|
-
})(ExecutionTypeEnum || {});
|
|
399
|
-
|
|
400
|
-
// src/classes/Commitment.ts
|
|
401
392
|
var COMMITMENT_CATEGORY = "__nqtr-commitment__";
|
|
402
393
|
var CommitmentBaseModel = class extends StoredClassModel {
|
|
403
394
|
/**
|
|
@@ -416,11 +407,12 @@ var CommitmentBaseModel = class extends StoredClassModel {
|
|
|
416
407
|
this.defaultFromDay = props.fromDay;
|
|
417
408
|
this.defaultToDay = props.toDay;
|
|
418
409
|
this._renderImage = props.renderImage;
|
|
419
|
-
this._executionType = props.executionType || "interaction"
|
|
410
|
+
this._executionType = props.executionType || "interaction";
|
|
420
411
|
this._onRun = props.onRun;
|
|
421
412
|
this.defaultDisabled = props.disabled || false;
|
|
422
413
|
this.defaultHidden = props.hidden || false;
|
|
423
414
|
this._renderIcon = props.renderIcon;
|
|
415
|
+
this.defaultPriority = props.priority || 0;
|
|
424
416
|
}
|
|
425
417
|
/**
|
|
426
418
|
* The character or characters that are in the commitment and so in the room.
|
|
@@ -562,6 +554,16 @@ var CommitmentBaseModel = class extends StoredClassModel {
|
|
|
562
554
|
set hidden(value) {
|
|
563
555
|
this.setStorageProperty("hidden", value);
|
|
564
556
|
}
|
|
557
|
+
/**
|
|
558
|
+
* The priority. The higher the number, the higher the priority.
|
|
559
|
+
* To ensure that a character is not in 2 places at the same time, if there are 2 or more valid commits at the same time and with the same character, the one with the highest priority will be chosen.
|
|
560
|
+
*/
|
|
561
|
+
get priority() {
|
|
562
|
+
return this.getStorageProperty("priority") || this.defaultPriority || 0;
|
|
563
|
+
}
|
|
564
|
+
set priority(value) {
|
|
565
|
+
this.setStorageProperty("priority", value);
|
|
566
|
+
}
|
|
565
567
|
/**
|
|
566
568
|
* Whether the commitment is expired.
|
|
567
569
|
* @returns Whether the commitment is expired.
|
|
@@ -865,9 +867,9 @@ function getCommitmentById(id) {
|
|
|
865
867
|
return;
|
|
866
868
|
}
|
|
867
869
|
}
|
|
868
|
-
function
|
|
870
|
+
function setFixedRoutine(commitments) {
|
|
869
871
|
if (Array.isArray(commitments)) {
|
|
870
|
-
commitments.forEach((c) =>
|
|
872
|
+
commitments.forEach((c) => setFixedRoutine(c));
|
|
871
873
|
return;
|
|
872
874
|
}
|
|
873
875
|
if (fixedCommitments[commitments.id]) {
|
|
@@ -875,7 +877,7 @@ function setFixedCommitments(commitments) {
|
|
|
875
877
|
}
|
|
876
878
|
fixedCommitments[commitments.id] = commitments;
|
|
877
879
|
}
|
|
878
|
-
function
|
|
880
|
+
function addCommitment(commitment) {
|
|
879
881
|
if (!Array.isArray(commitment)) {
|
|
880
882
|
commitment = [commitment];
|
|
881
883
|
}
|
|
@@ -889,7 +891,7 @@ function addTemporaryCommitment(commitment) {
|
|
|
889
891
|
}).filter((id) => id !== void 0);
|
|
890
892
|
GameStorageManager.setVariable(TEMPORARY_COMMITMENT_CATEGORY_MEMORY_KEY, [commitmentsIds]);
|
|
891
893
|
}
|
|
892
|
-
function
|
|
894
|
+
function getFixedRoutine() {
|
|
893
895
|
return Object.values(fixedCommitments);
|
|
894
896
|
}
|
|
895
897
|
function getTemporaryCommitments() {
|
|
@@ -909,40 +911,40 @@ function clearExpiredRoutine() {
|
|
|
909
911
|
}
|
|
910
912
|
});
|
|
911
913
|
}
|
|
912
|
-
function
|
|
914
|
+
function getCurrentRoutine() {
|
|
913
915
|
let character_commitments = {};
|
|
914
|
-
let oltherCommitments = [];
|
|
915
916
|
getTemporaryCommitments().reverse().forEach((c) => {
|
|
916
917
|
if (!c.hidden) {
|
|
917
|
-
if (c.characters.length >
|
|
918
|
-
let allAvailable = c.characters.every((ch) => !character_commitments[ch.id]);
|
|
918
|
+
if (c.characters.length > 0) {
|
|
919
|
+
let allAvailable = c.characters.every((ch) => !character_commitments[ch.id] || c.priority > character_commitments[ch.id].priority);
|
|
919
920
|
if (allAvailable) {
|
|
920
921
|
c.characters.forEach((ch) => {
|
|
921
922
|
character_commitments[ch.id] = c;
|
|
922
923
|
});
|
|
923
924
|
}
|
|
924
925
|
} else {
|
|
925
|
-
|
|
926
|
+
console.error(`[NQTR] The commitment ${c.id} has no characters assigned`);
|
|
926
927
|
}
|
|
927
928
|
}
|
|
928
929
|
});
|
|
929
|
-
|
|
930
|
+
getFixedRoutine().reverse().forEach((c) => {
|
|
930
931
|
if (!c.hidden) {
|
|
931
|
-
if (c.characters.length >
|
|
932
|
-
c.characters.
|
|
933
|
-
|
|
932
|
+
if (c.characters.length > 0) {
|
|
933
|
+
let allAvailable = c.characters.every((ch) => !character_commitments[ch.id] || c.priority > character_commitments[ch.id].priority);
|
|
934
|
+
if (allAvailable) {
|
|
935
|
+
c.characters.forEach((ch) => {
|
|
934
936
|
character_commitments[ch.id] = c;
|
|
935
|
-
}
|
|
936
|
-
}
|
|
937
|
+
});
|
|
938
|
+
}
|
|
937
939
|
} else {
|
|
938
|
-
|
|
940
|
+
console.error(`[NQTR] The commitment ${c.id} has no characters assigned`);
|
|
939
941
|
}
|
|
940
942
|
}
|
|
941
943
|
});
|
|
942
|
-
return Object.values(character_commitments)
|
|
944
|
+
return Object.values(character_commitments);
|
|
943
945
|
}
|
|
944
946
|
function getCommitmentByCharacter(character) {
|
|
945
|
-
|
|
947
|
+
getCurrentRoutine().forEach((c) => {
|
|
946
948
|
if (c.characters.map((ch) => ch.id).includes(character.id)) {
|
|
947
949
|
return c;
|
|
948
950
|
}
|
|
@@ -1375,7 +1377,7 @@ var RoomBaseModel = class extends StoredClassModel {
|
|
|
1375
1377
|
* @returns The character commitments of the room.
|
|
1376
1378
|
*/
|
|
1377
1379
|
getRoutine() {
|
|
1378
|
-
let commitments =
|
|
1380
|
+
let commitments = getCurrentRoutine();
|
|
1379
1381
|
return commitments.filter((c) => c.room.id === this.id);
|
|
1380
1382
|
}
|
|
1381
1383
|
};
|
|
@@ -1563,6 +1565,6 @@ function currentActivities() {
|
|
|
1563
1565
|
return currentRoom.activities.filter((activity) => !activity.hidden);
|
|
1564
1566
|
}
|
|
1565
1567
|
|
|
1566
|
-
export { ActivityModel, CommitmentBaseModel,
|
|
1568
|
+
export { ActivityModel, CommitmentBaseModel, Goal, LocationBaseModel, MapBaseModel, QuestBaseModel, RoomBaseModel, StageBaseModel, TimeManager, addCommitment, clearExpiredActivities, clearExpiredRoutine, currentActivities, getActivityById, getAllLocations, getAllMaps, getCommitmentByCharacter, getCommitmentById, getCueerntMap, getCurrenrLocation, getCurrentRoom, getCurrentRoutine, getRoomById, saveActivity, saveCommitment, saveRoom, setCurrentRoom, setFixedRoutine };
|
|
1567
1569
|
//# sourceMappingURL=out.js.map
|
|
1568
1570
|
//# sourceMappingURL=index.mjs.map
|