@drincs/nqtr 0.0.1 → 0.0.2
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/LICENSE +674 -0
- package/README.md +11 -1
- package/dist/index.d.mts +51 -9
- package/dist/index.d.ts +51 -9
- package/dist/index.js +48 -46
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +47 -45
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1 +1,11 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Navigation Quest Time Routine for Pixi'VN
|
|
2
|
+
|
|
3
|
+
The Navigation Quest Time Routine (NQTR) is a library that introduces a navigation, quest, and time system to the Pixi'VN visual novel engine.
|
|
4
|
+
|
|
5
|
+
## Get Started
|
|
6
|
+
|
|
7
|
+
### Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install @drincs/nqtr
|
|
11
|
+
```
|
package/dist/index.d.mts
CHANGED
|
@@ -507,14 +507,49 @@ declare function clearExpiredRoutine(): void;
|
|
|
507
507
|
declare function getCurrentCommitments<TCommitment extends CommitmentBaseModel = CommitmentBaseModel>(): TCommitment[];
|
|
508
508
|
declare function getCommitmentByCharacter<TCommitment extends CommitmentBaseModel = CommitmentBaseModel, TCharacter extends CharacterBaseModel = CharacterBaseModel>(character: TCharacter): TCommitment | undefined;
|
|
509
509
|
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
510
|
+
/**
|
|
511
|
+
* Time Settings, which can be set using `TimeManager.editSettings`
|
|
512
|
+
*/
|
|
513
|
+
interface TimeSettings {
|
|
514
|
+
/**
|
|
515
|
+
* Minimum hour of the day (default: 0)
|
|
516
|
+
*/
|
|
517
|
+
minDayHours?: number;
|
|
518
|
+
/**
|
|
519
|
+
* Maximum hour of the day (default: 24)
|
|
520
|
+
*/
|
|
521
|
+
maxDayHours?: number;
|
|
522
|
+
/**
|
|
523
|
+
* Default time spent (default: 1)
|
|
524
|
+
*/
|
|
513
525
|
defaultTimeSpent?: number;
|
|
526
|
+
/**
|
|
527
|
+
* Time slots (default: [])
|
|
528
|
+
* @example
|
|
529
|
+
* ```ts
|
|
530
|
+
* [
|
|
531
|
+
* { name: 'Morning', startHour: 5 },
|
|
532
|
+
* { name: 'Afternoon', startHour: 12 },
|
|
533
|
+
* { name: 'Evening', startHour: 18 },
|
|
534
|
+
* { name: 'Night', startHour: 22 }
|
|
535
|
+
* ]
|
|
536
|
+
*/
|
|
514
537
|
timeSlots?: ITimeStlot[];
|
|
538
|
+
/**
|
|
539
|
+
* Week length (default: 7)
|
|
540
|
+
*/
|
|
515
541
|
weekLength?: number;
|
|
516
|
-
|
|
542
|
+
/**
|
|
543
|
+
* Weekend start day. For example, if the real life weekend starts on Saturday, then the value should be 6 (default: weekLength - 1)
|
|
544
|
+
*/
|
|
517
545
|
weekendStartDay?: number;
|
|
546
|
+
/**
|
|
547
|
+
* Week days names (default: [])
|
|
548
|
+
* @example
|
|
549
|
+
* ```ts
|
|
550
|
+
* ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']
|
|
551
|
+
* ```
|
|
552
|
+
*/
|
|
518
553
|
weekDaysNames?: string[];
|
|
519
554
|
}
|
|
520
555
|
interface ITimeStlot {
|
|
@@ -523,11 +558,18 @@ interface ITimeStlot {
|
|
|
523
558
|
}
|
|
524
559
|
declare class TimeManager {
|
|
525
560
|
private constructor();
|
|
526
|
-
static
|
|
527
|
-
|
|
528
|
-
|
|
561
|
+
private static editSettings;
|
|
562
|
+
/**
|
|
563
|
+
* Get time settings
|
|
564
|
+
*/
|
|
565
|
+
static get settings(): TimeSettings;
|
|
566
|
+
/**
|
|
567
|
+
* Set time settings, Is very important to set the settings before using the nqtr library, bacause more of the features are based on the time settings.
|
|
568
|
+
*/
|
|
569
|
+
static set settings(value: TimeSettings);
|
|
570
|
+
static get minDayHours(): number;
|
|
571
|
+
static get maxDayHours(): number;
|
|
529
572
|
static get defaultTimeSpent(): number;
|
|
530
|
-
static get newDayHour(): number;
|
|
531
573
|
static get timeSlots(): ITimeStlot[];
|
|
532
574
|
static get weekLength(): number;
|
|
533
575
|
static get weekendStartDay(): number;
|
|
@@ -544,4 +586,4 @@ declare class TimeManager {
|
|
|
544
586
|
static nowIsBetween(fromHour: number, toHour: number): boolean;
|
|
545
587
|
}
|
|
546
588
|
|
|
547
|
-
export { ActivityModel, type ActivityProps, ExecutionTypeEnum,
|
|
589
|
+
export { ActivityModel, type ActivityProps, ExecutionTypeEnum, Goal, type GoalProps, LocationBaseModel, type LocationBaseModelProps, MapBaseModel, type MapBaseModelProps, QuestBaseModel, type QuestBaseModelProps, type QuestsRequiredType, RoomBaseModel, type RoomBaseModelProps, StageBaseModel, type StageBaseModelProps, TimeManager, type TimeSettings, addTemporaryCommitment, clearExpiredActivities, clearExpiredRoutine, currentActivities, getActivityById, getCommitmentByCharacter, getCommitmentById, getCueerntMap, getCurrenrLocation, getCurrentCommitments, getCurrentRoom, getFixedCommitments, getRoomById, getTemporaryCommitments, saveActivity, saveCommitment, saveRoom, setCurrentRoom, setFixedCommitments };
|
package/dist/index.d.ts
CHANGED
|
@@ -507,14 +507,49 @@ declare function clearExpiredRoutine(): void;
|
|
|
507
507
|
declare function getCurrentCommitments<TCommitment extends CommitmentBaseModel = CommitmentBaseModel>(): TCommitment[];
|
|
508
508
|
declare function getCommitmentByCharacter<TCommitment extends CommitmentBaseModel = CommitmentBaseModel, TCharacter extends CharacterBaseModel = CharacterBaseModel>(character: TCharacter): TCommitment | undefined;
|
|
509
509
|
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
510
|
+
/**
|
|
511
|
+
* Time Settings, which can be set using `TimeManager.editSettings`
|
|
512
|
+
*/
|
|
513
|
+
interface TimeSettings {
|
|
514
|
+
/**
|
|
515
|
+
* Minimum hour of the day (default: 0)
|
|
516
|
+
*/
|
|
517
|
+
minDayHours?: number;
|
|
518
|
+
/**
|
|
519
|
+
* Maximum hour of the day (default: 24)
|
|
520
|
+
*/
|
|
521
|
+
maxDayHours?: number;
|
|
522
|
+
/**
|
|
523
|
+
* Default time spent (default: 1)
|
|
524
|
+
*/
|
|
513
525
|
defaultTimeSpent?: number;
|
|
526
|
+
/**
|
|
527
|
+
* Time slots (default: [])
|
|
528
|
+
* @example
|
|
529
|
+
* ```ts
|
|
530
|
+
* [
|
|
531
|
+
* { name: 'Morning', startHour: 5 },
|
|
532
|
+
* { name: 'Afternoon', startHour: 12 },
|
|
533
|
+
* { name: 'Evening', startHour: 18 },
|
|
534
|
+
* { name: 'Night', startHour: 22 }
|
|
535
|
+
* ]
|
|
536
|
+
*/
|
|
514
537
|
timeSlots?: ITimeStlot[];
|
|
538
|
+
/**
|
|
539
|
+
* Week length (default: 7)
|
|
540
|
+
*/
|
|
515
541
|
weekLength?: number;
|
|
516
|
-
|
|
542
|
+
/**
|
|
543
|
+
* Weekend start day. For example, if the real life weekend starts on Saturday, then the value should be 6 (default: weekLength - 1)
|
|
544
|
+
*/
|
|
517
545
|
weekendStartDay?: number;
|
|
546
|
+
/**
|
|
547
|
+
* Week days names (default: [])
|
|
548
|
+
* @example
|
|
549
|
+
* ```ts
|
|
550
|
+
* ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']
|
|
551
|
+
* ```
|
|
552
|
+
*/
|
|
518
553
|
weekDaysNames?: string[];
|
|
519
554
|
}
|
|
520
555
|
interface ITimeStlot {
|
|
@@ -523,11 +558,18 @@ interface ITimeStlot {
|
|
|
523
558
|
}
|
|
524
559
|
declare class TimeManager {
|
|
525
560
|
private constructor();
|
|
526
|
-
static
|
|
527
|
-
|
|
528
|
-
|
|
561
|
+
private static editSettings;
|
|
562
|
+
/**
|
|
563
|
+
* Get time settings
|
|
564
|
+
*/
|
|
565
|
+
static get settings(): TimeSettings;
|
|
566
|
+
/**
|
|
567
|
+
* Set time settings, Is very important to set the settings before using the nqtr library, bacause more of the features are based on the time settings.
|
|
568
|
+
*/
|
|
569
|
+
static set settings(value: TimeSettings);
|
|
570
|
+
static get minDayHours(): number;
|
|
571
|
+
static get maxDayHours(): number;
|
|
529
572
|
static get defaultTimeSpent(): number;
|
|
530
|
-
static get newDayHour(): number;
|
|
531
573
|
static get timeSlots(): ITimeStlot[];
|
|
532
574
|
static get weekLength(): number;
|
|
533
575
|
static get weekendStartDay(): number;
|
|
@@ -544,4 +586,4 @@ declare class TimeManager {
|
|
|
544
586
|
static nowIsBetween(fromHour: number, toHour: number): boolean;
|
|
545
587
|
}
|
|
546
588
|
|
|
547
|
-
export { ActivityModel, type ActivityProps, ExecutionTypeEnum,
|
|
589
|
+
export { ActivityModel, type ActivityProps, ExecutionTypeEnum, Goal, type GoalProps, LocationBaseModel, type LocationBaseModelProps, MapBaseModel, type MapBaseModelProps, QuestBaseModel, type QuestBaseModelProps, type QuestsRequiredType, RoomBaseModel, type RoomBaseModelProps, StageBaseModel, type StageBaseModelProps, TimeManager, type TimeSettings, addTemporaryCommitment, clearExpiredActivities, clearExpiredRoutine, currentActivities, getActivityById, getCommitmentByCharacter, getCommitmentById, getCueerntMap, getCurrenrLocation, getCurrentCommitments, getCurrentRoom, getFixedCommitments, getRoomById, getTemporaryCommitments, saveActivity, saveCommitment, saveRoom, setCurrentRoom, setFixedCommitments };
|
package/dist/index.js
CHANGED
|
@@ -36,13 +36,13 @@ var src_exports = {};
|
|
|
36
36
|
__export(src_exports, {
|
|
37
37
|
ActivityModel: () => ActivityModel,
|
|
38
38
|
ExecutionTypeEnum: () => ExecutionTypeEnum,
|
|
39
|
-
GameStepManager: () => TimeManager,
|
|
40
39
|
Goal: () => Goal,
|
|
41
40
|
LocationBaseModel: () => LocationBaseModel,
|
|
42
41
|
MapBaseModel: () => MapBaseModel,
|
|
43
42
|
QuestBaseModel: () => QuestBaseModel,
|
|
44
43
|
RoomBaseModel: () => RoomBaseModel,
|
|
45
44
|
StageBaseModel: () => StageBaseModel,
|
|
45
|
+
TimeManager: () => TimeManager,
|
|
46
46
|
addTemporaryCommitment: () => addTemporaryCommitment,
|
|
47
47
|
clearExpiredActivities: () => clearExpiredActivities,
|
|
48
48
|
clearExpiredRoutine: () => clearExpiredRoutine,
|
|
@@ -75,55 +75,65 @@ var TIME_DATA_KEY = "___nqtr-time_manager_data___";
|
|
|
75
75
|
var TimeManager = class _TimeManager {
|
|
76
76
|
constructor() {
|
|
77
77
|
}
|
|
78
|
-
static
|
|
79
|
-
let
|
|
80
|
-
if (typeof
|
|
81
|
-
|
|
78
|
+
static editSettings(settings) {
|
|
79
|
+
let data = {};
|
|
80
|
+
if (typeof settings.minDayHours === "number") {
|
|
81
|
+
data["minDayHours"] = settings.minDayHours;
|
|
82
82
|
}
|
|
83
|
-
if (typeof
|
|
84
|
-
|
|
83
|
+
if (typeof settings.maxDayHours === "number") {
|
|
84
|
+
data["maxDayHours"] = settings.maxDayHours;
|
|
85
85
|
}
|
|
86
|
-
if (typeof
|
|
87
|
-
|
|
86
|
+
if (typeof settings.minDayHours === "number") {
|
|
87
|
+
data["defaultTimeSpent"] = settings.defaultTimeSpent;
|
|
88
88
|
}
|
|
89
|
-
if (Array.isArray(
|
|
90
|
-
|
|
89
|
+
if (Array.isArray(settings.timeSlots)) {
|
|
90
|
+
data["timeSlots"] = settings.timeSlots;
|
|
91
91
|
}
|
|
92
|
-
if (typeof
|
|
93
|
-
|
|
92
|
+
if (typeof settings.weekLength === "number") {
|
|
93
|
+
data["weekLength"] = settings.weekLength;
|
|
94
94
|
}
|
|
95
|
-
if (typeof
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
if (typeof value.weekendStartDay === "number") {
|
|
99
|
-
let weekLength = value.weekLength || _TimeManager.weekLength;
|
|
100
|
-
if (value.weekendStartDay >= weekLength) {
|
|
95
|
+
if (typeof settings.weekendStartDay === "number") {
|
|
96
|
+
let weekLength = settings.weekLength || _TimeManager.weekLength;
|
|
97
|
+
if (settings.weekendStartDay >= weekLength) {
|
|
101
98
|
console.warn(`[NQTR] Weekend start day should be less than week length ${weekLength}`);
|
|
102
99
|
}
|
|
103
|
-
|
|
100
|
+
data["weekendStartDay"] = settings.weekendStartDay;
|
|
104
101
|
}
|
|
105
|
-
if (Array.isArray(
|
|
106
|
-
let weekLength =
|
|
107
|
-
if (
|
|
102
|
+
if (Array.isArray(settings.weekDaysNames)) {
|
|
103
|
+
let weekLength = settings.weekLength || _TimeManager.weekLength;
|
|
104
|
+
if (settings.weekDaysNames.length !== weekLength) {
|
|
108
105
|
console.warn(`[NQTR] Week days names should be equal to week length ${weekLength}`);
|
|
109
106
|
}
|
|
110
|
-
|
|
107
|
+
data["weekDaysNames"] = settings.weekDaysNames;
|
|
111
108
|
}
|
|
112
|
-
import_pixi_vn.GameStorageManager.setVariable(TIME_SETTINGS_KEY,
|
|
113
|
-
}
|
|
114
|
-
|
|
109
|
+
import_pixi_vn.GameStorageManager.setVariable(TIME_SETTINGS_KEY, data);
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Get time settings
|
|
113
|
+
*/
|
|
114
|
+
static get settings() {
|
|
115
|
+
let settings = import_pixi_vn.GameStorageManager.getVariable(TIME_SETTINGS_KEY) || {};
|
|
116
|
+
return settings;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Set time settings, Is very important to set the settings before using the nqtr library, bacause more of the features are based on the time settings.
|
|
120
|
+
*/
|
|
121
|
+
static set settings(value) {
|
|
122
|
+
_TimeManager.editSettings(value);
|
|
123
|
+
}
|
|
124
|
+
static get minDayHours() {
|
|
115
125
|
let result = 0;
|
|
116
126
|
let settings = import_pixi_vn.GameStorageManager.getVariable(TIME_SETTINGS_KEY);
|
|
117
|
-
if (settings && settings.hasOwnProperty("
|
|
118
|
-
result = settings.
|
|
127
|
+
if (settings && settings.hasOwnProperty("minDayHours")) {
|
|
128
|
+
result = settings.minDayHours || 0;
|
|
119
129
|
}
|
|
120
130
|
return result;
|
|
121
131
|
}
|
|
122
|
-
static get
|
|
132
|
+
static get maxDayHours() {
|
|
123
133
|
let result = 24;
|
|
124
134
|
let settings = import_pixi_vn.GameStorageManager.getVariable(TIME_SETTINGS_KEY);
|
|
125
|
-
if (settings && settings.hasOwnProperty("
|
|
126
|
-
result = settings.
|
|
135
|
+
if (settings && settings.hasOwnProperty("maxDayHours")) {
|
|
136
|
+
result = settings.maxDayHours || 24;
|
|
127
137
|
}
|
|
128
138
|
return result;
|
|
129
139
|
}
|
|
@@ -135,14 +145,6 @@ var TimeManager = class _TimeManager {
|
|
|
135
145
|
}
|
|
136
146
|
return result;
|
|
137
147
|
}
|
|
138
|
-
static get newDayHour() {
|
|
139
|
-
let result = 0;
|
|
140
|
-
let settings = import_pixi_vn.GameStorageManager.getVariable(TIME_SETTINGS_KEY);
|
|
141
|
-
if (settings && settings.hasOwnProperty("newDayHour")) {
|
|
142
|
-
result = settings.newDayHour || 0;
|
|
143
|
-
}
|
|
144
|
-
return result;
|
|
145
|
-
}
|
|
146
148
|
static get timeSlots() {
|
|
147
149
|
let result = [];
|
|
148
150
|
let settings = import_pixi_vn.GameStorageManager.getVariable(TIME_SETTINGS_KEY);
|
|
@@ -180,7 +182,7 @@ var TimeManager = class _TimeManager {
|
|
|
180
182
|
if (data.hasOwnProperty("currentHour") && typeof data.currentHour === "number") {
|
|
181
183
|
return data.currentHour;
|
|
182
184
|
}
|
|
183
|
-
return _TimeManager.
|
|
185
|
+
return _TimeManager.minDayHours;
|
|
184
186
|
}
|
|
185
187
|
static set currentHour(value) {
|
|
186
188
|
let data = import_pixi_vn.GameStorageManager.getVariable(TIME_DATA_KEY) || {};
|
|
@@ -224,9 +226,9 @@ var TimeManager = class _TimeManager {
|
|
|
224
226
|
}
|
|
225
227
|
static newHour(timeSpent = _TimeManager.defaultTimeSpent) {
|
|
226
228
|
let newHour = _TimeManager.currentHour + timeSpent;
|
|
227
|
-
if (newHour >= _TimeManager.
|
|
229
|
+
if (newHour >= _TimeManager.maxDayHours) {
|
|
228
230
|
_TimeManager.newDay();
|
|
229
|
-
newHour = _TimeManager.
|
|
231
|
+
newHour = _TimeManager.minDayHours + (newHour - _TimeManager.maxDayHours);
|
|
230
232
|
}
|
|
231
233
|
_TimeManager.currentHour = newHour;
|
|
232
234
|
return newHour;
|
|
@@ -265,13 +267,13 @@ var ActivityStoredAbstract = class {
|
|
|
265
267
|
this.setStorageProperty("name", value);
|
|
266
268
|
}
|
|
267
269
|
get fromHour() {
|
|
268
|
-
return this.getStorageProperty("fromHour") || this.defaultFromHour || TimeManager.
|
|
270
|
+
return this.getStorageProperty("fromHour") || this.defaultFromHour || TimeManager.minDayHours;
|
|
269
271
|
}
|
|
270
272
|
set fromHour(value) {
|
|
271
273
|
this.setStorageProperty("fromHour", value);
|
|
272
274
|
}
|
|
273
275
|
get toHour() {
|
|
274
|
-
return this.getStorageProperty("toHour") || this.defaultToHour || TimeManager.
|
|
276
|
+
return this.getStorageProperty("toHour") || this.defaultToHour || TimeManager.maxDayHours + 1;
|
|
275
277
|
}
|
|
276
278
|
set toHour(value) {
|
|
277
279
|
this.setStorageProperty("toHour", value);
|
|
@@ -1078,13 +1080,13 @@ function currentActivities() {
|
|
|
1078
1080
|
0 && (module.exports = {
|
|
1079
1081
|
ActivityModel,
|
|
1080
1082
|
ExecutionTypeEnum,
|
|
1081
|
-
GameStepManager,
|
|
1082
1083
|
Goal,
|
|
1083
1084
|
LocationBaseModel,
|
|
1084
1085
|
MapBaseModel,
|
|
1085
1086
|
QuestBaseModel,
|
|
1086
1087
|
RoomBaseModel,
|
|
1087
1088
|
StageBaseModel,
|
|
1089
|
+
TimeManager,
|
|
1088
1090
|
addTemporaryCommitment,
|
|
1089
1091
|
clearExpiredActivities,
|
|
1090
1092
|
clearExpiredRoutine,
|