@drincs/nqtr 0.8.1 → 1.0.0
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/README.md +8 -21
- package/dist/StageInterface-BN_O8nDA.d.mts +363 -0
- package/dist/StageInterface-BN_O8nDA.d.ts +363 -0
- package/dist/handlers.cjs +1 -1
- package/dist/handlers.d.mts +6 -613
- package/dist/handlers.d.ts +6 -613
- package/dist/handlers.mjs +1 -1
- package/dist/index-CtxMgD9N.d.ts +270 -0
- package/dist/index-D0T0L2IE.d.mts +270 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.mts +72 -657
- package/dist/index.d.ts +72 -657
- package/dist/index.mjs +1 -1
- package/dist/ink.cjs +66 -1
- package/dist/ink.d.mts +58 -10
- package/dist/ink.d.ts +58 -10
- package/dist/ink.mjs +66 -1
- package/dist/registries.cjs +1 -1
- package/dist/registries.d.mts +143 -362
- package/dist/registries.d.ts +143 -362
- package/dist/registries.mjs +1 -1
- package/dist/vite.cjs +2 -0
- package/dist/vite.d.mts +160 -0
- package/dist/vite.d.ts +160 -0
- package/dist/vite.mjs +2 -0
- package/package.json +33 -12
package/dist/registries.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';var pixiVn=require('@drincs/pixi-vn');var
|
|
1
|
+
'use strict';var pixiVn=require('@drincs/pixi-vn');var o;(i=>(i.log=(r,...t)=>console.log(`[NQTR] ${r}`,...t),i.warn=(r,...t)=>console.warn(`[NQTR] ${r}`,...t),i.error=(r,...t)=>console.error(`[NQTR] ${r}`,...t),i.info=(r,...t)=>console.info(`[NQTR] ${r}`,...t)))(o||={});var f=new pixiVn.CachedMap({cacheSize:20}),h;(r=>{function n(...t){for(let e of t){if(Array.isArray(e)){n(...e);continue}f.set(e.id,e);}}r.add=n;function a(t){try{let e=f.get(t);if(!e){console.warn(`[NQTR] Activity ${t} not found, you should register it first`);return}return e}catch(e){o.error(`Error while getting Activity ${t}`,e);return}}r.get=a;function c(){return Array.from(f.values())}r.values=c;function s(t){return f.has(t)}r.has=s;function i(){f.clear();}r.clear=i;})(h||={});var T=h;var m=new pixiVn.CachedMap({cacheSize:20}),A=new pixiVn.CachedMap({cacheSize:20}),R;(r=>{function n(...t){for(let e of t){if(Array.isArray(e)){n(...e);return}m.set(e.id,e);}}r.add=n;function a(t){try{let e=m.get(t);if(!e){console.warn(`[NQTR] Commitment ${t} not found, you should register it first`);return}return e}catch(e){o.error(`Error while getting Commitment ${t}`,e);return}}r.get=a;function c(){return Array.from(m.values())}r.values=c;function s(t){return m.has(t)}r.has=s;function i(){m.clear(),A.clear();}r.clear=i;})(R||={});var $=R;var u=new pixiVn.CachedMap({cacheSize:20}),Q;(r=>{function n(...t){for(let e of t){if(Array.isArray(e)){n(...e);return}u.set(e.id,e);}}r.add=n;function a(t){try{let e=u.get(t);if(!e){console.warn(`[NQTR] Location ${t} not found, you should register it first`);return}return e}catch(e){o.error(`Error while getting Location ${t}`,e);return}}r.get=a;function c(){return Array.from(u.values())}r.values=c;function s(t){return u.has(t)}r.has=s;function i(){u.clear();}r.clear=i;})(Q||={});var l=Q;var p=new pixiVn.CachedMap({cacheSize:20}),w;(r=>{function n(...t){for(let e of t){if(Array.isArray(e)){n(...e);return}p.set(e.id,e);}}r.add=n;function a(t){try{let e=p.get(t);if(!e){console.warn(`[NQTR] Map ${t} not found, you should register it first`);return}return e}catch(e){o.error(`Error while getting Map ${t}`,e);return}}r.get=a;function c(){return Array.from(p.values())}r.values=c;function s(t){return p.has(t)}r.has=s;function i(){p.clear();}r.clear=i;})(w||={});var y=w;var d=new pixiVn.CachedMap({cacheSize:5}),C;(r=>{function n(...t){for(let e of t){if(Array.isArray(e)){n(...e);return}d.set(e.id,e);}}r.add=n;function a(t){try{let e=d.get(t);if(!e){console.warn(`[NQTR] Quest ${t} not found, you should register it first`);return}return e}catch(e){o.error(`Error while getting Quest ${t}`,e);return}}r.get=a;function c(){return Array.from(d.values())}r.values=c;function s(t){return d.has(t)}r.has=s;function i(){d.clear();}r.clear=i;})(C||={});var S=C;var g=new pixiVn.CachedMap({cacheSize:20}),M;(r=>{function n(...t){for(let e of t){if(Array.isArray(e)){n(...e);return}g.set(e.id,e);let x=e.location;l.add(x);let I=x?.map;I&&y.add(I);}}r.add=n;function a(t){try{let e=g.get(t);if(!e){console.warn(`[NQTR] Room ${t} not found, you should register it first`);return}return e}catch(e){o.error(`Error while getting Room ${t}`,e);return}}r.get=a;function c(){return Array.from(g.values())}r.values=c;function s(t){return g.has(t)}r.has=s;function i(){g.clear();}r.clear=i;})(M||={});var E=M;exports.RegisteredActivities=T;exports.RegisteredCommitments=$;exports.RegisteredLocations=l;exports.RegisteredMaps=y;exports.RegisteredQuests=S;exports.RegisteredRooms=E;exports.fixedCommitments=A;exports.registeredActivities=f;exports.registeredCommitments=m;exports.registeredLocations=u;exports.registeredMaps=p;exports.registeredQuests=d;exports.registeredRooms=g;
|
package/dist/registries.d.mts
CHANGED
|
@@ -1,366 +1,97 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
1
|
+
import { A as ActivityInterface, C as CommitmentInterface, h as LocationInterface, M as MapInterface, Q as QuestInterface, R as RoomInterface } from './StageInterface-BN_O8nDA.mjs';
|
|
2
|
+
import { CachedMap } from '@drincs/pixi-vn';
|
|
3
|
+
import '@drincs/pixi-vn/storage';
|
|
4
|
+
import '@drincs/nqtr/registries';
|
|
4
5
|
|
|
5
|
-
interface
|
|
6
|
-
/**
|
|
7
|
-
* The start date. If the item hasn't started yet, it will be hidden.
|
|
8
|
-
* If you set it to 3, the item will be hidden on dates 1 and 2 and will be shown starting on date 3.
|
|
9
|
-
*/
|
|
10
|
-
from: number;
|
|
11
|
-
/**
|
|
12
|
-
* The date when the item ends. If the item is ended yet, it will be deleted or hidden.
|
|
13
|
-
* If you set { from: 0, to: 3 }, the item will be shown into dates 1 and 2 and will be deleted or hidden from date 3.
|
|
14
|
-
* @default undefined
|
|
15
|
-
*/
|
|
16
|
-
to?: number;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
interface TimeSchedulingInterface {
|
|
20
|
-
/**
|
|
21
|
-
* The time when the item starts. If the item is not started yet, it will be hidden.
|
|
22
|
-
* If you set 3, the item will be hidden into times 1 and 2, and will be shown from time 3.
|
|
23
|
-
*/
|
|
24
|
-
from: number;
|
|
25
|
-
/**
|
|
26
|
-
* The time when the item ends. If the item is ended yet, it will be hidden.
|
|
27
|
-
* If you set 3, the item will be shown into times 1 and 2 and will be hidden from time 3.
|
|
28
|
-
* @default timeTracker.dayEndTime + 1
|
|
29
|
-
*/
|
|
30
|
-
to?: number;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
interface ActiveScheduling {
|
|
34
|
-
/**
|
|
35
|
-
* Time slot in which activity/commitment will be active.
|
|
36
|
-
*/
|
|
37
|
-
readonly timeSlot?: TimeSchedulingInterface[] | TimeSchedulingInterface;
|
|
38
|
-
/**
|
|
39
|
-
* Used to schedule what date it will be added and removed.
|
|
40
|
-
*/
|
|
41
|
-
readonly dateScheduling?: DateSchedulingInterface;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
type ExecutionType = "automatic" | "interaction";
|
|
45
|
-
|
|
46
|
-
type OnRunProps = OnRunProps$1;
|
|
47
|
-
/**
|
|
48
|
-
* The function that is called when the class is runned.
|
|
49
|
-
*/
|
|
50
|
-
type OnRunEvent<T> = (item: T, props: OnRunProps) => any | Promise<any>;
|
|
51
|
-
type OnRunAsyncFunction = (props: OnRunProps) => Promise<any>;
|
|
52
|
-
|
|
53
|
-
type QuestsRequiredType = {
|
|
54
|
-
quest: QuestInterface;
|
|
55
|
-
stageNumber: number;
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
interface ActivityInterface extends ActivityBaseInternalInterface, ActivityInterface$1 {
|
|
59
|
-
}
|
|
60
|
-
interface ActivityBaseInternalInterface extends ActiveScheduling {
|
|
61
|
-
/**
|
|
62
|
-
* The id of the activity/commitment.
|
|
63
|
-
*/
|
|
64
|
-
readonly id: string;
|
|
65
|
-
/**
|
|
66
|
-
* The function that is called when the activity/commitment is runned.
|
|
67
|
-
*/
|
|
68
|
-
readonly run: OnRunAsyncFunction;
|
|
69
|
-
/**
|
|
70
|
-
* Whether the activity/commitment is a deadline, so it will then be removed or hidden.
|
|
71
|
-
*
|
|
72
|
-
* It **depends only on the date**, not the time. So if you set { dateScheduling: { from: 0, to: 3 }, timeSlot { from: 10, to: 20 } } the activity/commitment hidden or deleted on date 3 at 0.
|
|
73
|
-
*/
|
|
74
|
-
readonly expired: boolean;
|
|
75
|
-
/**
|
|
76
|
-
* Whether the activity/commitment is active, so it will be shown in the routine and can be runned.
|
|
77
|
-
* @param options The options to check if the activity/commitment is active.
|
|
78
|
-
*/
|
|
79
|
-
isActive(options?: ActiveScheduling): boolean;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
interface CommitmentInterface extends CommitmentBaseInternalInterface, CommitmentInterface$1 {
|
|
83
|
-
}
|
|
84
|
-
interface CommitmentBaseInternalInterface extends ActivityBaseInternalInterface {
|
|
85
|
-
/**
|
|
86
|
-
* The character or characters that are in the commitment and so in the room.
|
|
87
|
-
*/
|
|
88
|
-
readonly characters: CharacterInterface[];
|
|
89
|
-
/**
|
|
90
|
-
* 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.
|
|
91
|
-
* If you set "automatic" remember to remove the commitment when it is no longer needed, because otherwise it repeats itself every time.
|
|
92
|
-
*/
|
|
93
|
-
executionType: ExecutionType;
|
|
94
|
-
/**
|
|
95
|
-
* The priority. The higher the number, the higher the priority.
|
|
96
|
-
* 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.
|
|
97
|
-
*/
|
|
98
|
-
priority: number;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
interface NavigationAbstractInterface extends StoredClassModel {
|
|
102
|
-
/**
|
|
103
|
-
* Connects the activity to the class.
|
|
104
|
-
* @param activity The activity to connect to the class.
|
|
105
|
-
* @param options
|
|
106
|
-
* @returns
|
|
107
|
-
*/
|
|
108
|
-
addActivity(activity: ActivityInterface, options?: ActiveScheduling): void;
|
|
109
|
-
/**
|
|
110
|
-
* Disconnects the activity from the class.
|
|
111
|
-
* @param activity The activity to disconnect from the class.
|
|
112
|
-
* @param options
|
|
113
|
-
*/
|
|
114
|
-
removeActivity(activity: ActivityInterface | string): void;
|
|
115
|
-
/**
|
|
116
|
-
* Removes the useless activities.
|
|
117
|
-
*/
|
|
118
|
-
clearExpiredActivities(): void;
|
|
119
|
-
/**
|
|
120
|
-
* All the ids of the activities associated with this class. Compared to {@link activities}, they are not filtered based on their scheduling.
|
|
121
|
-
*/
|
|
122
|
-
readonly activitiesIds: string[];
|
|
123
|
-
/**
|
|
124
|
-
* The activities associated with this class, filtered based on their scheduling.
|
|
125
|
-
*/
|
|
126
|
-
activities: ActivityInterface[];
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
interface LocationInterface extends LocationInternalInterface, LocationInterface$1 {
|
|
130
|
-
}
|
|
131
|
-
interface LocationInternalInterface extends NavigationAbstractInterface {
|
|
132
|
-
/**
|
|
133
|
-
* The id of the location.
|
|
134
|
-
*/
|
|
135
|
-
readonly id: string;
|
|
136
|
-
/**
|
|
137
|
-
* The map where the location is.
|
|
138
|
-
*/
|
|
139
|
-
readonly map: MapInterface;
|
|
140
|
-
/**
|
|
141
|
-
* Get all rooms in the location.
|
|
142
|
-
* @returns The rooms in the location.
|
|
143
|
-
*/
|
|
144
|
-
readonly rooms: RoomInterface[];
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
interface MapInterface extends MapBaseInternalInterface, MapInterface$1 {
|
|
148
|
-
}
|
|
149
|
-
interface MapBaseInternalInterface extends NavigationAbstractInterface {
|
|
150
|
-
/**
|
|
151
|
-
* The id of the map.
|
|
152
|
-
*/
|
|
153
|
-
readonly id: string;
|
|
154
|
-
/**
|
|
155
|
-
* Get all locations in the map.
|
|
156
|
-
* @returns The locations in the map.
|
|
157
|
-
*/
|
|
158
|
-
readonly locations: LocationInterface[];
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
interface RoomInterface extends RoomBaseInternalInterface, RoomInterface$1 {
|
|
6
|
+
interface NqtrActivityIds {
|
|
162
7
|
}
|
|
163
|
-
interface
|
|
164
|
-
/**
|
|
165
|
-
* The id of the room.
|
|
166
|
-
*/
|
|
167
|
-
readonly id: string;
|
|
168
|
-
/**
|
|
169
|
-
* The location where the room is.
|
|
170
|
-
*/
|
|
171
|
-
readonly location: LocationInterface;
|
|
172
|
-
/**
|
|
173
|
-
* Connects the commitment to the class.
|
|
174
|
-
* @param commitment The commitment to connect to the class.
|
|
175
|
-
* @param options
|
|
176
|
-
* @returns
|
|
177
|
-
*/
|
|
178
|
-
addCommitment(commitment: CommitmentInterface, options?: ActiveScheduling): void;
|
|
179
|
-
/**
|
|
180
|
-
* Disconnects the commitment from the class.
|
|
181
|
-
* @param commitment The commitment to disconnect from the class.
|
|
182
|
-
* @param options
|
|
183
|
-
*/
|
|
184
|
-
removeCommitment(commitment: CommitmentInterface | string): void;
|
|
185
|
-
/**
|
|
186
|
-
* Get the character commitments of the room.
|
|
187
|
-
*/
|
|
188
|
-
readonly routine: CommitmentInterface[];
|
|
189
|
-
/**
|
|
190
|
-
* Get the characters in the room.
|
|
191
|
-
*/
|
|
192
|
-
readonly characters: CharacterInterface[];
|
|
193
|
-
/**
|
|
194
|
-
* Get the functions that will be executed when the room is visited.
|
|
195
|
-
*/
|
|
196
|
-
readonly automaticFunctions: OnRunAsyncFunction[];
|
|
8
|
+
interface NqtrCommitmentIds {
|
|
197
9
|
}
|
|
198
|
-
|
|
199
|
-
interface QuestInterface extends QuestBaseInternalInterface, QuestInterface$1 {
|
|
10
|
+
interface NqtrLocationIds {
|
|
200
11
|
}
|
|
201
|
-
interface
|
|
202
|
-
/**
|
|
203
|
-
* The id of the quest.
|
|
204
|
-
*/
|
|
205
|
-
readonly id: string;
|
|
206
|
-
/**
|
|
207
|
-
* The stages of the quest.
|
|
208
|
-
*/
|
|
209
|
-
readonly stages: StageInterface[];
|
|
210
|
-
/**
|
|
211
|
-
* The index of the current stage.
|
|
212
|
-
*/
|
|
213
|
-
currentStageIndex?: number;
|
|
214
|
-
/**
|
|
215
|
-
* The current stage.
|
|
216
|
-
*/
|
|
217
|
-
readonly currentStage?: StageInterface;
|
|
218
|
-
/**
|
|
219
|
-
* If the quest is started.
|
|
220
|
-
*/
|
|
221
|
-
readonly started: boolean;
|
|
222
|
-
/**
|
|
223
|
-
* If the quest is started and not completed and not failed.
|
|
224
|
-
*/
|
|
225
|
-
readonly inProgress: boolean;
|
|
226
|
-
/**
|
|
227
|
-
* If the quest is completed.
|
|
228
|
-
*/
|
|
229
|
-
readonly completed: boolean;
|
|
230
|
-
/**
|
|
231
|
-
* If the quest is failed.
|
|
232
|
-
*/
|
|
233
|
-
readonly failed: boolean;
|
|
234
|
-
/**
|
|
235
|
-
* The function that will be called when the quest starts.
|
|
236
|
-
*/
|
|
237
|
-
readonly onStart?: OnRunEvent<QuestInterface>;
|
|
238
|
-
/**
|
|
239
|
-
* The function that will be called when the quest goes to the next stage.
|
|
240
|
-
*/
|
|
241
|
-
readonly onNextStage?: OnRunEvent<QuestInterface>;
|
|
242
|
-
/**
|
|
243
|
-
* Start the quest.
|
|
244
|
-
* @param props The properties for the start stage. If you not want to pass any property, you can pass an {}.
|
|
245
|
-
* @returns
|
|
246
|
-
*/
|
|
247
|
-
start(props: OnRunProps$1): Promise<void>;
|
|
248
|
-
/**
|
|
249
|
-
* Go to the next stage if the current stage is completed.
|
|
250
|
-
* If you want to force the change of stage, use {@link advanceUnconditionally}.
|
|
251
|
-
* @param props The properties. If you not want to pass any property, you can pass an {}.
|
|
252
|
-
* @returns true if the stage was changed, false otherwise.
|
|
253
|
-
*/
|
|
254
|
-
advanceIfCompleted(props: OnRunProps$1): Promise<boolean>;
|
|
255
|
-
/**
|
|
256
|
-
* Complete the current stage and go to the next stage with {@link advanceUnconditionally}.
|
|
257
|
-
* If you want to go to the next stage only if the current stage is completed, use {@link advanceIfCompleted}.
|
|
258
|
-
* @param props The properties. If you not want to pass any property, you can pass an {}.
|
|
259
|
-
* @returns true if the stage was changed, false otherwise.
|
|
260
|
-
*/
|
|
261
|
-
continue(props: OnRunProps$1): Promise<boolean>;
|
|
262
|
-
/**
|
|
263
|
-
* Ignore the completed state of the current stage and go to the next stage without checking if the current stage is completed.
|
|
264
|
-
* If you want to go to the next stage only if the current stage is completed, use {@link advanceIfCompleted}.
|
|
265
|
-
* @param props The properties. If you not want to pass any property, you can pass an {}.
|
|
266
|
-
* @returns returns true if the stage was changed, false otherwise.
|
|
267
|
-
*/
|
|
268
|
-
advanceUnconditionally(props: OnRunProps$1): Promise<boolean>;
|
|
269
|
-
/**
|
|
270
|
-
* If the current stage must start. It is true if the current stage is not started, can start and not completed.
|
|
271
|
-
*/
|
|
272
|
-
readonly currentStageMustStart: boolean;
|
|
273
|
-
/**
|
|
274
|
-
* Start the current stage. This is a system function, do not use it directly.
|
|
275
|
-
* @param props The properties for the start stage. If you not want to pass any property, you can pass an {}.
|
|
276
|
-
*/
|
|
277
|
-
startCurrentStage(props: OnRunProps$1): Promise<void>;
|
|
12
|
+
interface NqtrMapIds {
|
|
278
13
|
}
|
|
279
|
-
|
|
280
|
-
interface StageInterface extends StageBaseInternalInterface, StageInterface$1 {
|
|
14
|
+
interface NqtrQuestIds {
|
|
281
15
|
}
|
|
282
|
-
interface
|
|
283
|
-
/**
|
|
284
|
-
* The id of the stage.
|
|
285
|
-
*/
|
|
286
|
-
readonly id: string;
|
|
287
|
-
/**
|
|
288
|
-
* The function that will be called when the stage starts.
|
|
289
|
-
*/
|
|
290
|
-
readonly onStart?: OnRunEvent<StageInterface>;
|
|
291
|
-
/**
|
|
292
|
-
* The function that will be called when the stage ends.
|
|
293
|
-
*/
|
|
294
|
-
readonly onEnd?: OnRunEvent<StageInterface>;
|
|
295
|
-
/**
|
|
296
|
-
* Check if the flag and goals are completed.
|
|
297
|
-
* You can force the completion of the stage by setting the completed property to true.
|
|
298
|
-
* @example
|
|
299
|
-
* ```ts
|
|
300
|
-
* export default class Stage extends StageStoredClass {
|
|
301
|
-
* override get completed(): boolean {
|
|
302
|
-
* if (super.completed) {
|
|
303
|
-
* return true;
|
|
304
|
-
* }
|
|
305
|
-
* if (this.flags.length > 0) {
|
|
306
|
-
* if (!this.flags.every((flag) => storage.getFlag(flag.flag))) {
|
|
307
|
-
* return false;
|
|
308
|
-
* }
|
|
309
|
-
* return true;
|
|
310
|
-
* }
|
|
311
|
-
* return false;
|
|
312
|
-
* }
|
|
313
|
-
* override set completed(value: boolean) {
|
|
314
|
-
* super.completed = value;
|
|
315
|
-
* }
|
|
316
|
-
* }
|
|
317
|
-
* ```
|
|
318
|
-
*/
|
|
319
|
-
completed: boolean;
|
|
320
|
-
/**
|
|
321
|
-
* If the stage is started.
|
|
322
|
-
*/
|
|
323
|
-
started: boolean;
|
|
324
|
-
/**
|
|
325
|
-
* The date when the stage starts.
|
|
326
|
-
*/
|
|
327
|
-
readonly startDate?: number;
|
|
328
|
-
/**
|
|
329
|
-
* Check if the stage can start.
|
|
330
|
-
* @example
|
|
331
|
-
* ```ts
|
|
332
|
-
* export default class Stage extends StageStoredClass {
|
|
333
|
-
* override get canStart(): boolean {
|
|
334
|
-
* if (this.flagsRequired.length > 0 && !this.flagsRequired.every((flag) => storage.getFlag(flag.flag))) {
|
|
335
|
-
* return false;
|
|
336
|
-
* }
|
|
337
|
-
* return super.canStart;
|
|
338
|
-
* }
|
|
339
|
-
* }
|
|
340
|
-
* ```
|
|
341
|
-
*/
|
|
342
|
-
readonly canStart: boolean;
|
|
343
|
-
/**
|
|
344
|
-
* The function that will be called when the stage starts.
|
|
345
|
-
*/
|
|
346
|
-
start(props: OnRunProps$1): Promise<void>;
|
|
347
|
-
/**
|
|
348
|
-
* The number of day/date required to start the stage.
|
|
349
|
-
*/
|
|
350
|
-
readonly deltaDateRequired: number;
|
|
351
|
-
/**
|
|
352
|
-
* The list of quests required to start the stage.
|
|
353
|
-
*/
|
|
354
|
-
readonly questsRequired: QuestsRequiredType[];
|
|
16
|
+
interface NqtrRoomIds {
|
|
355
17
|
}
|
|
18
|
+
/**
|
|
19
|
+
* The type used wherever an activity ID is expected.
|
|
20
|
+
*
|
|
21
|
+
* - **Default** — resolves to `string` so that existing code compiles without changes.
|
|
22
|
+
* - **Augmented** — when {@link NqtrActivityIds} has been extended via
|
|
23
|
+
* `declare module "@drincs/nqtr/registries"`, resolves to the union of known activity IDs.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```ts
|
|
27
|
+
* // nqtr.gen.d.ts (auto-generated by vitePluginNqtr)
|
|
28
|
+
* declare module "@drincs/nqtr/registries" {
|
|
29
|
+
* interface NqtrActivityIds { "study": never; "cook": never; }
|
|
30
|
+
* }
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
type ActivityIdType = [keyof NqtrActivityIds] extends [never] ? string : keyof NqtrActivityIds;
|
|
34
|
+
/**
|
|
35
|
+
* The type used wherever a commitment ID is expected.
|
|
36
|
+
*
|
|
37
|
+
* - **Default** — resolves to `string`.
|
|
38
|
+
* - **Augmented** — resolves to the union of known commitment IDs once
|
|
39
|
+
* {@link NqtrCommitmentIds} has been extended.
|
|
40
|
+
*/
|
|
41
|
+
type CommitmentIdType = [keyof NqtrCommitmentIds] extends [never] ? string : keyof NqtrCommitmentIds;
|
|
42
|
+
/**
|
|
43
|
+
* The type used wherever a location ID is expected.
|
|
44
|
+
*
|
|
45
|
+
* - **Default** — resolves to `string`.
|
|
46
|
+
* - **Augmented** — resolves to the union of known location IDs once
|
|
47
|
+
* {@link NqtrLocationIds} has been extended.
|
|
48
|
+
*/
|
|
49
|
+
type LocationIdType = [keyof NqtrLocationIds] extends [never] ? string : keyof NqtrLocationIds;
|
|
50
|
+
/**
|
|
51
|
+
* The type used wherever a map ID is expected.
|
|
52
|
+
*
|
|
53
|
+
* - **Default** — resolves to `string`.
|
|
54
|
+
* - **Augmented** — resolves to the union of known map IDs once
|
|
55
|
+
* {@link NqtrMapIds} has been extended.
|
|
56
|
+
*/
|
|
57
|
+
type MapIdType = [keyof NqtrMapIds] extends [never] ? string : keyof NqtrMapIds;
|
|
58
|
+
/**
|
|
59
|
+
* The type used wherever a quest ID is expected.
|
|
60
|
+
*
|
|
61
|
+
* - **Default** — resolves to `string`.
|
|
62
|
+
* - **Augmented** — resolves to the union of known quest IDs once
|
|
63
|
+
* {@link NqtrQuestIds} has been extended.
|
|
64
|
+
*/
|
|
65
|
+
type QuestIdType = [keyof NqtrQuestIds] extends [never] ? string : keyof NqtrQuestIds;
|
|
66
|
+
/**
|
|
67
|
+
* The type used wherever a room ID is expected.
|
|
68
|
+
*
|
|
69
|
+
* - **Default** — resolves to `string`.
|
|
70
|
+
* - **Augmented** — resolves to the union of known room IDs once
|
|
71
|
+
* {@link NqtrRoomIds} has been extended.
|
|
72
|
+
*
|
|
73
|
+
* @example
|
|
74
|
+
* ```ts
|
|
75
|
+
* import type { RoomIdType } from "@drincs/nqtr/registries";
|
|
76
|
+
*
|
|
77
|
+
* function navigateTo(roomId: RoomIdType) { ... }
|
|
78
|
+
* navigateTo("bedroom"); // ✅ compile error if "bedroom" is not a known room
|
|
79
|
+
* ```
|
|
80
|
+
*/
|
|
81
|
+
type RoomIdType = [keyof NqtrRoomIds] extends [never] ? string : keyof NqtrRoomIds;
|
|
356
82
|
|
|
83
|
+
/**
|
|
84
|
+
* A Map that contains all activities registered and available to be used.
|
|
85
|
+
* The key is the id of the activity and the value is the activity itself.
|
|
86
|
+
*/
|
|
87
|
+
declare const registeredActivities: CachedMap<string, ActivityInterface>;
|
|
357
88
|
declare namespace RegisteredActivities {
|
|
358
89
|
/**
|
|
359
90
|
* Save an activity in the registered activities. If the activity already exists, it will be overwritten.
|
|
360
|
-
* @param
|
|
91
|
+
* @param activities The activity to save.
|
|
361
92
|
* @returns
|
|
362
93
|
*/
|
|
363
|
-
function add(activities: ActivityInterface | ActivityInterface[]): void;
|
|
94
|
+
function add(...activities: (ActivityInterface | ActivityInterface[])[]): void;
|
|
364
95
|
/**
|
|
365
96
|
* Get an activity by its id.
|
|
366
97
|
* @param id The id of the activity.
|
|
@@ -378,6 +109,11 @@ declare namespace RegisteredActivities {
|
|
|
378
109
|
* @returns True if the activity is registered, false otherwise.
|
|
379
110
|
*/
|
|
380
111
|
function has(id: string): boolean;
|
|
112
|
+
/**
|
|
113
|
+
* Remove all registered activities.
|
|
114
|
+
* Primarily used by the Vite plugin to reset state between hot-module reloads.
|
|
115
|
+
*/
|
|
116
|
+
function clear(): void;
|
|
381
117
|
}
|
|
382
118
|
|
|
383
119
|
/**
|
|
@@ -385,14 +121,14 @@ declare namespace RegisteredActivities {
|
|
|
385
121
|
* The key is the id of the commitment and the value is the commitment itself.
|
|
386
122
|
*/
|
|
387
123
|
declare const registeredCommitments: CachedMap<string, CommitmentInterface>;
|
|
388
|
-
declare const fixedCommitments: CachedMap<string,
|
|
124
|
+
declare const fixedCommitments: CachedMap<string, string>;
|
|
389
125
|
declare namespace RegisteredCommitments {
|
|
390
126
|
/**
|
|
391
127
|
* Save a commitment in the registered commitments. If the commitment already exists, it will be overwritten.
|
|
392
|
-
* @param
|
|
128
|
+
* @param commitments The commitment to save.
|
|
393
129
|
* @returns
|
|
394
130
|
*/
|
|
395
|
-
function add(commitments: CommitmentInterface | CommitmentInterface[]): void;
|
|
131
|
+
function add(...commitments: (CommitmentInterface | CommitmentInterface[])[]): void;
|
|
396
132
|
/**
|
|
397
133
|
* Get a commitment by its id.
|
|
398
134
|
* @param id The id of the commitment.
|
|
@@ -410,15 +146,25 @@ declare namespace RegisteredCommitments {
|
|
|
410
146
|
* @returns True if the commitment is registered, false otherwise.
|
|
411
147
|
*/
|
|
412
148
|
function has(id: string): boolean;
|
|
149
|
+
/**
|
|
150
|
+
* Remove all registered commitments (both scheduled and fixed).
|
|
151
|
+
* Primarily used by the Vite plugin to reset state between hot-module reloads.
|
|
152
|
+
*/
|
|
153
|
+
function clear(): void;
|
|
413
154
|
}
|
|
414
155
|
|
|
156
|
+
/**
|
|
157
|
+
* A Map that contains all locations registered and available to be used.
|
|
158
|
+
* The key is the id of the location and the value is the location itself.
|
|
159
|
+
*/
|
|
160
|
+
declare const registeredLocations: CachedMap<string, LocationInterface>;
|
|
415
161
|
declare namespace RegisteredLocations {
|
|
416
162
|
/**
|
|
417
163
|
* Save a location in the registered locations. If the location already exists, it will be overwritten.
|
|
418
|
-
* @param
|
|
164
|
+
* @param locations The location to save.
|
|
419
165
|
* @returns
|
|
420
166
|
*/
|
|
421
|
-
function add(
|
|
167
|
+
function add(...locations: (LocationInterface | LocationInterface[])[]): void;
|
|
422
168
|
/**
|
|
423
169
|
* Get a location by its id.
|
|
424
170
|
* @param id The id of the location.
|
|
@@ -436,15 +182,25 @@ declare namespace RegisteredLocations {
|
|
|
436
182
|
* @returns True if the location is registered, false otherwise.
|
|
437
183
|
*/
|
|
438
184
|
function has(id: string): boolean;
|
|
185
|
+
/**
|
|
186
|
+
* Remove all registered locations.
|
|
187
|
+
* Primarily used by the Vite plugin to reset state between hot-module reloads.
|
|
188
|
+
*/
|
|
189
|
+
function clear(): void;
|
|
439
190
|
}
|
|
440
191
|
|
|
192
|
+
/**
|
|
193
|
+
* A Map that contains all maps registered and available to be used.
|
|
194
|
+
* The key is the id of the map and the value is the map itself.
|
|
195
|
+
*/
|
|
196
|
+
declare const registeredMaps: CachedMap<string, MapInterface>;
|
|
441
197
|
declare namespace RegisteredMaps {
|
|
442
198
|
/**
|
|
443
199
|
* Save a map in the registered maps. If the map already exists, it will be overwritten.
|
|
444
|
-
* @param
|
|
200
|
+
* @param maps The map to save.
|
|
445
201
|
* @returns
|
|
446
202
|
*/
|
|
447
|
-
function add(
|
|
203
|
+
function add(...maps: (MapInterface | MapInterface[])[]): void;
|
|
448
204
|
/**
|
|
449
205
|
* Get a map by its id.
|
|
450
206
|
* @param id The id of the map.
|
|
@@ -462,15 +218,25 @@ declare namespace RegisteredMaps {
|
|
|
462
218
|
* @returns True if the map is registered, false otherwise.
|
|
463
219
|
*/
|
|
464
220
|
function has(id: string): boolean;
|
|
221
|
+
/**
|
|
222
|
+
* Remove all registered maps.
|
|
223
|
+
* Primarily used by the Vite plugin to reset state between hot-module reloads.
|
|
224
|
+
*/
|
|
225
|
+
function clear(): void;
|
|
465
226
|
}
|
|
466
227
|
|
|
228
|
+
/**
|
|
229
|
+
* A Map that contains all quests registered and available to be used.
|
|
230
|
+
* The key is the id of the quest and the value is the quest itself.
|
|
231
|
+
*/
|
|
232
|
+
declare const registeredQuests: CachedMap<string, QuestInterface>;
|
|
467
233
|
declare namespace RegisteredQuest {
|
|
468
234
|
/**
|
|
469
235
|
* Save a quest in the registered quests. If the quest already exists, it will be overwritten.
|
|
470
|
-
* @param
|
|
236
|
+
* @param quests The quest to save.
|
|
471
237
|
* @returns
|
|
472
238
|
*/
|
|
473
|
-
function add(quests: QuestInterface | QuestInterface[]): void;
|
|
239
|
+
function add(...quests: (QuestInterface | QuestInterface[])[]): void;
|
|
474
240
|
/**
|
|
475
241
|
* Get a quest by its id.
|
|
476
242
|
* @param id The id of the quest.
|
|
@@ -488,16 +254,26 @@ declare namespace RegisteredQuest {
|
|
|
488
254
|
* @returns True if the quest is registered, false otherwise.
|
|
489
255
|
*/
|
|
490
256
|
function has(id: string): boolean;
|
|
257
|
+
/**
|
|
258
|
+
* Remove all registered quests.
|
|
259
|
+
* Primarily used by the Vite plugin to reset state between hot-module reloads.
|
|
260
|
+
*/
|
|
261
|
+
function clear(): void;
|
|
491
262
|
}
|
|
492
263
|
|
|
264
|
+
/**
|
|
265
|
+
* A Map that contains all rooms registered and available to be used.
|
|
266
|
+
* The key is the id of the room and the value is the room itself.
|
|
267
|
+
*/
|
|
268
|
+
declare const registeredRooms: CachedMap<string, RoomInterface>;
|
|
493
269
|
declare namespace RegisteredRooms {
|
|
494
270
|
/**
|
|
495
271
|
* Save a room in the registered rooms, and their location and map if they are not already registered.
|
|
496
272
|
* If the room already exists, it will be overwritten.
|
|
497
|
-
* @param
|
|
273
|
+
* @param rooms The room to save.
|
|
498
274
|
* @returns
|
|
499
275
|
*/
|
|
500
|
-
function add(
|
|
276
|
+
function add(...rooms: (RoomInterface | RoomInterface[])[]): void;
|
|
501
277
|
/**
|
|
502
278
|
* Get a room by its id.
|
|
503
279
|
* @param id The id of the room.
|
|
@@ -515,6 +291,11 @@ declare namespace RegisteredRooms {
|
|
|
515
291
|
* @returns True if the room is registered, false otherwise.
|
|
516
292
|
*/
|
|
517
293
|
function has(id: string): boolean;
|
|
294
|
+
/**
|
|
295
|
+
* Remove all registered rooms.
|
|
296
|
+
* Primarily used by the Vite plugin to reset state between hot-module reloads.
|
|
297
|
+
*/
|
|
298
|
+
function clear(): void;
|
|
518
299
|
}
|
|
519
300
|
|
|
520
|
-
export { RegisteredActivities, RegisteredCommitments, RegisteredLocations, RegisteredMaps, RegisteredQuest as RegisteredQuests, RegisteredRooms, fixedCommitments, registeredCommitments };
|
|
301
|
+
export { type ActivityIdType, type CommitmentIdType, type LocationIdType, type MapIdType, type NqtrActivityIds, type NqtrCommitmentIds, type NqtrLocationIds, type NqtrMapIds, type NqtrQuestIds, type NqtrRoomIds, type QuestIdType, RegisteredActivities, RegisteredCommitments, RegisteredLocations, RegisteredMaps, RegisteredQuest as RegisteredQuests, RegisteredRooms, type RoomIdType, fixedCommitments, registeredActivities, registeredCommitments, registeredLocations, registeredMaps, registeredQuests, registeredRooms };
|