@drincs/nqtr 0.0.4 → 0.0.6
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/index.d.mts +422 -125
- package/dist/index.d.ts +422 -125
- package/dist/index.js +382 -58
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +374 -53
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,44 +1,52 @@
|
|
|
1
1
|
import { CanvasBase, StoredClassModel, CharacterBaseModel } from '@drincs/pixi-vn';
|
|
2
2
|
|
|
3
|
-
type GraphicItemType<TCanvasItem extends CanvasBase<any> = CanvasBase<any>> = string |
|
|
3
|
+
type GraphicItemType<TCanvasItem extends CanvasBase<any> = CanvasBase<any>> = string | Element | TCanvasItem;
|
|
4
4
|
|
|
5
5
|
interface ActivityProps {
|
|
6
6
|
/**
|
|
7
7
|
* The name
|
|
8
|
+
* @default ""
|
|
8
9
|
*/
|
|
9
10
|
name?: string;
|
|
10
11
|
/**
|
|
11
12
|
* The hour when the activity starts. If the activity is not started yet, it will be hidden.
|
|
12
13
|
* If you set 3, the activity will be hidden into hours 1 and 2, and will be shown from hour 3.
|
|
14
|
+
* @default TimeManager.minDayHours
|
|
13
15
|
*/
|
|
14
16
|
fromHour?: number;
|
|
15
17
|
/**
|
|
16
18
|
* The hour when the activity ends. If the activity is ended yet, it will be hidden.
|
|
17
19
|
* If you set 3, the activity will be shown into hours 1 and 2 and will be hidden from hour 3.
|
|
20
|
+
* @default TimeManager.maxDayHours + 1
|
|
18
21
|
*/
|
|
19
22
|
toHour?: number;
|
|
20
23
|
/**
|
|
21
24
|
* The day when the activity starts. If the activity is not started yet, it will be hidden.
|
|
22
25
|
* If you set 3, the activity will be hidden into days 1 and 2, and will be shown from day 3.
|
|
26
|
+
* @default undefined
|
|
23
27
|
*/
|
|
24
28
|
fromDay?: number;
|
|
25
29
|
/**
|
|
26
30
|
* The day when the activity ends. If the activity is ended yet, it will be deleted or hidden.
|
|
27
31
|
* If you set 3, the activity will be shown into days 1 and 2 and will be deleted or hidden from day 3.
|
|
32
|
+
* @default undefined
|
|
28
33
|
*/
|
|
29
34
|
toDay?: number;
|
|
30
35
|
/**
|
|
31
36
|
* Whether is disabled. You can also pass a Pixi'VN flag name.
|
|
37
|
+
* @default false
|
|
32
38
|
*/
|
|
33
39
|
disabled?: boolean | string;
|
|
34
40
|
/**
|
|
35
41
|
* Whether is hidden. You can also pass a Pixi'VN flag name.
|
|
42
|
+
* @default false
|
|
36
43
|
*/
|
|
37
44
|
hidden?: boolean | string;
|
|
38
45
|
/**
|
|
39
|
-
* The icon element. Can be a string or an
|
|
46
|
+
* The icon element. Can be a string or an Element or a Pixi'VN CanvasItem
|
|
47
|
+
* @default undefined
|
|
40
48
|
*/
|
|
41
|
-
|
|
49
|
+
icon?: GraphicItemType;
|
|
42
50
|
}
|
|
43
51
|
declare abstract class ActivityStoredAbstract {
|
|
44
52
|
constructor(onRun: (activity: ActivityModel) => void, props: ActivityProps);
|
|
@@ -66,8 +74,8 @@ declare abstract class ActivityStoredAbstract {
|
|
|
66
74
|
private defaultHidden;
|
|
67
75
|
get hidden(): boolean;
|
|
68
76
|
set hidden(value: boolean | string);
|
|
69
|
-
private
|
|
70
|
-
get
|
|
77
|
+
private _icon?;
|
|
78
|
+
get icon(): GraphicItemType | undefined;
|
|
71
79
|
private _onRun;
|
|
72
80
|
get onRun(): (activity: ActivityModel) => void;
|
|
73
81
|
isExpired(): boolean;
|
|
@@ -91,21 +99,27 @@ declare class ActivityModel {
|
|
|
91
99
|
get disabled(): boolean | undefined;
|
|
92
100
|
private _hidden;
|
|
93
101
|
get hidden(): boolean;
|
|
94
|
-
private
|
|
95
|
-
get
|
|
102
|
+
private _icon?;
|
|
103
|
+
get icon(): GraphicItemType | undefined;
|
|
96
104
|
private _onRun;
|
|
97
105
|
get onRun(): (activity: ActivityModel) => void;
|
|
98
106
|
isDeadline(): boolean;
|
|
99
107
|
export(): ActivityProps;
|
|
100
108
|
}
|
|
101
109
|
|
|
110
|
+
declare enum ExecutionTypeEnum {
|
|
111
|
+
AUTOMATIC = "automatic",
|
|
112
|
+
INTERACTION = "interaction"
|
|
113
|
+
}
|
|
114
|
+
|
|
102
115
|
interface MapBaseModelProps<TMap extends MapBaseModel = MapBaseModel> {
|
|
103
116
|
/**
|
|
104
117
|
* The name
|
|
118
|
+
* @default ""
|
|
105
119
|
*/
|
|
106
120
|
name?: string;
|
|
107
121
|
/**
|
|
108
|
-
* The image. It can be a string, an
|
|
122
|
+
* The image. It can be a string, an Element or a Pixi'VN Canvas Item.
|
|
109
123
|
* Or an object to manage multiple image types. For example to have a image based on time.
|
|
110
124
|
* @example
|
|
111
125
|
* ```ts
|
|
@@ -116,6 +130,7 @@ interface MapBaseModelProps<TMap extends MapBaseModel = MapBaseModel> {
|
|
|
116
130
|
* "night": "night-background.jpg"
|
|
117
131
|
* }
|
|
118
132
|
* ```
|
|
133
|
+
* @default undefined
|
|
119
134
|
*/
|
|
120
135
|
image?: GraphicItemType | {
|
|
121
136
|
[key: string]: GraphicItemType;
|
|
@@ -131,25 +146,56 @@ interface MapBaseModelProps<TMap extends MapBaseModel = MapBaseModel> {
|
|
|
131
146
|
* "west": birminghamMap
|
|
132
147
|
* }
|
|
133
148
|
* ```
|
|
149
|
+
* @default {}
|
|
134
150
|
*/
|
|
135
151
|
neighboringMaps?: {
|
|
136
152
|
[key: string]: TMap;
|
|
137
153
|
};
|
|
138
154
|
/**
|
|
139
155
|
* Whether is disabled. You can also pass a Pixi'VN flag name.
|
|
156
|
+
* @default false
|
|
140
157
|
*/
|
|
141
158
|
disabled?: boolean | string;
|
|
142
159
|
/**
|
|
143
160
|
* Whether is hidden. You can also pass a Pixi'VN flag name.
|
|
161
|
+
* @default false
|
|
144
162
|
*/
|
|
145
163
|
hidden?: boolean | string;
|
|
146
164
|
}
|
|
165
|
+
/**
|
|
166
|
+
* The base model of a map. I suggest you extend this class to create your own map model.
|
|
167
|
+
* @example
|
|
168
|
+
* ```typescript
|
|
169
|
+
* export const mainMap = new MapBaseModel('main_map', {
|
|
170
|
+
* name: 'Main Map',
|
|
171
|
+
* image: "https://image.jpg",
|
|
172
|
+
* neighboringMaps: {
|
|
173
|
+
* "north": northMap,
|
|
174
|
+
* "south": southMap,
|
|
175
|
+
* "east": eastMap,
|
|
176
|
+
* "west": westMap
|
|
177
|
+
* }
|
|
178
|
+
* });
|
|
179
|
+
* ```
|
|
180
|
+
*/
|
|
147
181
|
declare class MapBaseModel extends StoredClassModel {
|
|
148
|
-
|
|
182
|
+
/**
|
|
183
|
+
* @param id The id of the map, it must be unique.
|
|
184
|
+
* @param props The properties of the map.
|
|
185
|
+
*/
|
|
186
|
+
constructor(id: string, props?: MapBaseModelProps);
|
|
149
187
|
private defaultName;
|
|
188
|
+
/**
|
|
189
|
+
* The name of the map.
|
|
190
|
+
* If you set undefined, it will return the initial value of name.
|
|
191
|
+
*/
|
|
150
192
|
get name(): string;
|
|
151
|
-
set name(value: string);
|
|
193
|
+
set name(value: string | undefined);
|
|
152
194
|
private defaultImage?;
|
|
195
|
+
/**
|
|
196
|
+
* The image of the map. It can be a string, an Element or a Pixi'VN Canvas Item.
|
|
197
|
+
* If you set undefined, it will return the initial value of image.
|
|
198
|
+
*/
|
|
153
199
|
get image(): GraphicItemType | {
|
|
154
200
|
[key: string]: GraphicItemType;
|
|
155
201
|
} | undefined;
|
|
@@ -157,114 +203,32 @@ declare class MapBaseModel extends StoredClassModel {
|
|
|
157
203
|
[key: string]: GraphicItemType;
|
|
158
204
|
} | undefined);
|
|
159
205
|
private defaultDisabled;
|
|
206
|
+
/**
|
|
207
|
+
* Whether is disabled. If it is a string, it is a Pixi'VN flag name.
|
|
208
|
+
*/
|
|
160
209
|
get disabled(): boolean;
|
|
161
210
|
set disabled(value: boolean | string);
|
|
162
211
|
private defaultHidden;
|
|
163
|
-
get hidden(): boolean;
|
|
164
|
-
set hidden(value: boolean | string);
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
declare enum ExecutionTypeEnum {
|
|
168
|
-
AUTOMATIC = "automatic",
|
|
169
|
-
INTERACTION = "interaction"
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
interface CommitmentBaseModelProps {
|
|
173
|
-
/**
|
|
174
|
-
* The name
|
|
175
|
-
*/
|
|
176
|
-
name?: string;
|
|
177
|
-
/**
|
|
178
|
-
* The hour when the commitment starts. If the commitment is not started yet, it will be hidden.
|
|
179
|
-
* If you set 3, the commitment will be hidden into hours 1 and 2, and will be shown from hour 3.
|
|
180
|
-
*/
|
|
181
|
-
fromHour?: number;
|
|
182
|
-
/**
|
|
183
|
-
* The hour when the commitment ends. If the commitment is ended yet, it will be hidden.
|
|
184
|
-
* If you set 3, the commitment will be shown into hours 1 and 2 and will be hidden from hour 3.
|
|
185
|
-
*/
|
|
186
|
-
toHour?: number;
|
|
187
|
-
/**
|
|
188
|
-
* The day when the commitment starts. If the commitment is not started yet, it will be hidden.
|
|
189
|
-
* If you set 3, the commitment will be hidden into days 1 and 2, and will be shown from day 3.
|
|
190
|
-
*/
|
|
191
|
-
fromDay?: number;
|
|
192
212
|
/**
|
|
193
|
-
*
|
|
194
|
-
* If you set 3, the commitment will be shown into days 1 and 2 and will be deleted or hidden from day 3.
|
|
213
|
+
* Whether is hidden. If it is a string, it is a Pixi'VN flag name.
|
|
195
214
|
*/
|
|
196
|
-
|
|
215
|
+
get hidden(): boolean;
|
|
216
|
+
set hidden(value: boolean | string);
|
|
217
|
+
private _neighboringMaps?;
|
|
197
218
|
/**
|
|
198
|
-
* The
|
|
199
|
-
* Or an object to manage multiple image types. For example to have a image based on time.
|
|
200
|
-
* @example
|
|
201
|
-
* ```ts
|
|
202
|
-
* {
|
|
203
|
-
* "morning": "morning-background.jpg",
|
|
204
|
-
* "afternoon": "afternoon-background.jpg",
|
|
205
|
-
* "evening": "evening-background.jpg",
|
|
206
|
-
* "night": "night-background.jpg"
|
|
207
|
-
* }
|
|
208
|
-
* ```
|
|
219
|
+
* The neighboring maps that are available in this map.
|
|
209
220
|
*/
|
|
210
|
-
|
|
211
|
-
[key: string]:
|
|
221
|
+
get neighboringMaps(): {
|
|
222
|
+
[key: string]: MapBaseModel;
|
|
212
223
|
};
|
|
224
|
+
set neighboringMaps(value: {
|
|
225
|
+
[key: string]: MapBaseModel;
|
|
226
|
+
} | undefined);
|
|
213
227
|
/**
|
|
214
|
-
*
|
|
215
|
-
|
|
216
|
-
executionType?: ExecutionTypeEnum;
|
|
217
|
-
/**
|
|
218
|
-
* Is a function that is called when the player interacts with the character.
|
|
219
|
-
* @param commitment
|
|
220
|
-
* @returns
|
|
221
|
-
*/
|
|
222
|
-
onRun?: (commitment: CommitmentBaseModel) => void;
|
|
223
|
-
/**
|
|
224
|
-
* Whether is disabled. You can also pass a Pixi'VN flag name.
|
|
225
|
-
* If it is disabled this commitment will not be taken into consideration. So the characters will not be in the room, but will be busy with other commitments.
|
|
226
|
-
*/
|
|
227
|
-
disabled?: boolean | string;
|
|
228
|
-
/**
|
|
229
|
-
* Whether is hidden. You can also pass a Pixi'VN flag name.
|
|
228
|
+
* Get all locations in the map.
|
|
229
|
+
* @returns The locations in the map.
|
|
230
230
|
*/
|
|
231
|
-
|
|
232
|
-
}
|
|
233
|
-
declare class CommitmentBaseModel<TCharacter extends CharacterBaseModel = CharacterBaseModel, TRoom extends RoomBaseModel = RoomBaseModel> extends StoredClassModel {
|
|
234
|
-
constructor(id: string, character: TCharacter | TCharacter[] | undefined, room: TRoom, props: CommitmentBaseModelProps);
|
|
235
|
-
private _characters;
|
|
236
|
-
get characters(): TCharacter[];
|
|
237
|
-
private _room;
|
|
238
|
-
get room(): TRoom;
|
|
239
|
-
private _name;
|
|
240
|
-
get name(): GraphicItemType;
|
|
241
|
-
private defaultFromHour?;
|
|
242
|
-
get fromHour(): number;
|
|
243
|
-
set fromHour(value: number | undefined);
|
|
244
|
-
private defaultToHour?;
|
|
245
|
-
get toHour(): number;
|
|
246
|
-
set toHour(value: number | undefined);
|
|
247
|
-
private defaultFromDay?;
|
|
248
|
-
get fromDay(): number | undefined;
|
|
249
|
-
set fromDay(value: number | undefined);
|
|
250
|
-
private defaultToDay?;
|
|
251
|
-
get toDay(): number | undefined;
|
|
252
|
-
set toDay(value: number | undefined);
|
|
253
|
-
private _image?;
|
|
254
|
-
get image(): GraphicItemType | {
|
|
255
|
-
[key: string]: GraphicItemType;
|
|
256
|
-
} | undefined;
|
|
257
|
-
private _executionType;
|
|
258
|
-
get executionType(): ExecutionTypeEnum;
|
|
259
|
-
private _onRun?;
|
|
260
|
-
onRun(): void;
|
|
261
|
-
private defaultDisabled;
|
|
262
|
-
get disabled(): boolean;
|
|
263
|
-
set disabled(value: boolean | string);
|
|
264
|
-
private defaultHidden;
|
|
265
|
-
get hidden(): boolean;
|
|
266
|
-
set hidden(value: boolean | string);
|
|
267
|
-
isExpired(): boolean;
|
|
231
|
+
getLocations<TLocation extends LocationBaseModel = LocationBaseModel>(): TLocation[];
|
|
268
232
|
}
|
|
269
233
|
|
|
270
234
|
declare class ActivityRoom<TRoom extends RoomBaseModel = RoomBaseModel> extends ActivityStoredAbstract {
|
|
@@ -281,10 +245,11 @@ declare class ActivityRoom<TRoom extends RoomBaseModel = RoomBaseModel> extends
|
|
|
281
245
|
interface RoomBaseModelProps {
|
|
282
246
|
/**
|
|
283
247
|
* The name
|
|
248
|
+
* @default ""
|
|
284
249
|
*/
|
|
285
250
|
name?: string;
|
|
286
251
|
/**
|
|
287
|
-
* The image. It can be a string, an
|
|
252
|
+
* The image. It can be a string, an Element or a Pixi'VN Canvas Item.
|
|
288
253
|
* Or an object to manage multiple image types. For example to have a image based on time.
|
|
289
254
|
* @example
|
|
290
255
|
* ```ts
|
|
@@ -295,41 +260,80 @@ interface RoomBaseModelProps {
|
|
|
295
260
|
* "night": "night-background.jpg"
|
|
296
261
|
* }
|
|
297
262
|
* ```
|
|
263
|
+
* @default undefined
|
|
298
264
|
*/
|
|
299
265
|
image?: GraphicItemType | {
|
|
300
266
|
[key: string]: GraphicItemType;
|
|
301
267
|
};
|
|
302
268
|
/**
|
|
303
269
|
* The activities that are available in this room.
|
|
270
|
+
* @default []
|
|
304
271
|
*/
|
|
305
272
|
defaultActivities?: ActivityModel[];
|
|
306
273
|
/**
|
|
307
274
|
* Whether is disabled. You can also pass a Pixi'VN flag name.
|
|
275
|
+
* @default false
|
|
308
276
|
*/
|
|
309
277
|
disabled?: boolean | string;
|
|
310
278
|
/**
|
|
311
279
|
* Whether is hidden. You can also pass a Pixi'VN flag name.
|
|
280
|
+
* @default false
|
|
312
281
|
*/
|
|
313
282
|
hidden?: boolean | string;
|
|
314
283
|
/**
|
|
315
|
-
* The icon element. Can be a string or an
|
|
284
|
+
* The icon element. Can be a string or an Element or a Pixi'VN CanvasItem
|
|
285
|
+
* @default undefined
|
|
316
286
|
*/
|
|
317
|
-
|
|
287
|
+
icon?: GraphicItemType;
|
|
318
288
|
/**
|
|
319
289
|
* Whether is an entrance room, so when the player enters in the location, it will be the first room to be shown.
|
|
290
|
+
* @default false
|
|
320
291
|
*/
|
|
321
292
|
isEntrance?: boolean;
|
|
322
293
|
}
|
|
294
|
+
/**
|
|
295
|
+
* The base model of a room. I suggest you extend this class to create your own room model.
|
|
296
|
+
* You must use the saveRoom function to save the room in the registered rooms.
|
|
297
|
+
* @example
|
|
298
|
+
* ```ts
|
|
299
|
+
* export const mcRoom = new RoomBaseModel('mc_room', mcHome, {
|
|
300
|
+
* name: "MC Room",
|
|
301
|
+
* icon: "https://icon.jpg",
|
|
302
|
+
* image: "https://image.jpg",
|
|
303
|
+
* isEntrance: false,
|
|
304
|
+
* })
|
|
305
|
+
* saveRoom(mcRoom)
|
|
306
|
+
* ```
|
|
307
|
+
*/
|
|
323
308
|
declare class RoomBaseModel<TLocation extends LocationBaseModel = LocationBaseModel> extends StoredClassModel {
|
|
324
|
-
|
|
309
|
+
/**
|
|
310
|
+
* @param id The id of the room, it must be unique.
|
|
311
|
+
* @param location The location where the room is.
|
|
312
|
+
* @param props The properties of the room.
|
|
313
|
+
*/
|
|
314
|
+
constructor(id: string, location: TLocation, props?: RoomBaseModelProps);
|
|
325
315
|
private _location;
|
|
316
|
+
/**
|
|
317
|
+
* The location where the room is.
|
|
318
|
+
*/
|
|
326
319
|
get location(): TLocation;
|
|
327
320
|
private _isEntrance?;
|
|
321
|
+
/**
|
|
322
|
+
* Whether is an entrance room, so when the player enters in the location, it will be the first room to be shown.
|
|
323
|
+
*/
|
|
328
324
|
get isEntrance(): boolean;
|
|
329
325
|
private defaultName;
|
|
326
|
+
/**
|
|
327
|
+
* The name.
|
|
328
|
+
* If you set undefined, it will return the initial value of name.
|
|
329
|
+
*/
|
|
330
330
|
get name(): string;
|
|
331
|
-
set name(value: string);
|
|
331
|
+
set name(value: string | undefined);
|
|
332
332
|
private defaultImage?;
|
|
333
|
+
/**
|
|
334
|
+
* The image. It can be a string, an Element or a Pixi'VN Canvas Item.
|
|
335
|
+
* If you set undefined, it will return the initial value of image.
|
|
336
|
+
*/
|
|
333
337
|
get image(): GraphicItemType | {
|
|
334
338
|
[key: string]: GraphicItemType;
|
|
335
339
|
} | undefined;
|
|
@@ -337,60 +341,333 @@ declare class RoomBaseModel<TLocation extends LocationBaseModel = LocationBaseMo
|
|
|
337
341
|
[key: string]: GraphicItemType;
|
|
338
342
|
} | undefined);
|
|
339
343
|
private defaultActivityIds;
|
|
344
|
+
/**
|
|
345
|
+
* The activities that are available in this room.
|
|
346
|
+
*/
|
|
340
347
|
get defaultActivities(): ActivityRoom<this>[];
|
|
341
|
-
get activityIds()
|
|
348
|
+
private get activityIds();
|
|
349
|
+
/**
|
|
350
|
+
* The activities that are available in this room.
|
|
351
|
+
*/
|
|
342
352
|
get activities(): ActivityRoom<this>[];
|
|
353
|
+
/**
|
|
354
|
+
* Get the memory of an activity. This function can be used into olther libraries to get the memory of the activity.
|
|
355
|
+
* @param id The id of the activity.
|
|
356
|
+
* @returns The memory of the activity.
|
|
357
|
+
*/
|
|
343
358
|
getActivityMemory(id: string): object | undefined;
|
|
359
|
+
/**
|
|
360
|
+
* Get the activity by id.
|
|
361
|
+
* @param id The id of the activity.
|
|
362
|
+
* @returns The room activity.
|
|
363
|
+
*/
|
|
344
364
|
getActivity(id: string): ActivityRoom<this> | undefined;
|
|
365
|
+
/**
|
|
366
|
+
* Set the memory of an activity. This function can be used into olther libraries to set the memory of the activity.
|
|
367
|
+
* @param id The id of the activity.
|
|
368
|
+
* @param memory The memory of the activity.
|
|
369
|
+
*/
|
|
345
370
|
setActivity(activity: ActivityRoom): void;
|
|
371
|
+
/**
|
|
372
|
+
* Add an activity to the room.
|
|
373
|
+
* @param activity The activity to add.
|
|
374
|
+
*/
|
|
346
375
|
addActivity(activity: ActivityModel): void;
|
|
376
|
+
/**
|
|
377
|
+
* Remove an activity from the room.
|
|
378
|
+
* @param activity The activity to remove.
|
|
379
|
+
*/
|
|
347
380
|
removeActivity(activity: ActivityModel | string): void;
|
|
381
|
+
/**
|
|
382
|
+
* Clear all expired activities.
|
|
383
|
+
*/
|
|
348
384
|
clearExpiredActivities(): void;
|
|
349
385
|
private defaultDisabled;
|
|
386
|
+
/**
|
|
387
|
+
* Whether is disabled. If it is a string, it is a Pixi'VN flag name.
|
|
388
|
+
*/
|
|
350
389
|
get disabled(): boolean;
|
|
351
390
|
set disabled(value: boolean | string);
|
|
352
391
|
private defaultHidden;
|
|
392
|
+
/**
|
|
393
|
+
* Whether is hidden. If it is a string, it is a Pixi'VN flag name.
|
|
394
|
+
*/
|
|
353
395
|
get hidden(): boolean;
|
|
354
396
|
set hidden(value: boolean | string);
|
|
355
|
-
|
|
356
|
-
|
|
397
|
+
/**
|
|
398
|
+
* The icon element. Can be a string or an Element or a Pixi'VN CanvasItem
|
|
399
|
+
*/
|
|
400
|
+
private _icon?;
|
|
401
|
+
get icon(): GraphicItemType | undefined;
|
|
402
|
+
/**
|
|
403
|
+
* Get the character commitments of the room.
|
|
404
|
+
* @returns The character commitments of the room.
|
|
405
|
+
*/
|
|
357
406
|
getRoutine<TCommitment extends CommitmentBaseModel = CommitmentBaseModel>(): TCommitment[];
|
|
358
407
|
}
|
|
359
408
|
|
|
360
409
|
interface LocationBaseModelProps {
|
|
361
410
|
/**
|
|
362
411
|
* The name
|
|
412
|
+
* @default ""
|
|
363
413
|
*/
|
|
364
414
|
name?: string;
|
|
365
415
|
/**
|
|
366
416
|
* Whether is disabled. You can also pass a Pixi'VN flag name.
|
|
417
|
+
* @default false
|
|
367
418
|
*/
|
|
368
419
|
disabled?: boolean | string;
|
|
369
420
|
/**
|
|
370
421
|
* Whether is hidden. You can also pass a Pixi'VN flag name.
|
|
422
|
+
* @default false
|
|
371
423
|
*/
|
|
372
424
|
hidden?: boolean | string;
|
|
373
425
|
/**
|
|
374
|
-
* The icon element. Can be a string or an
|
|
426
|
+
* The icon element. Can be a string or an Element or a Pixi'VN CanvasItem
|
|
427
|
+
* @default undefined
|
|
375
428
|
*/
|
|
376
|
-
|
|
429
|
+
icon?: GraphicItemType;
|
|
377
430
|
}
|
|
431
|
+
/**
|
|
432
|
+
* The base model of a location. I suggest you extend this class to create your own location model.
|
|
433
|
+
* @example
|
|
434
|
+
* ```typescript
|
|
435
|
+
* export const mcHome = new LocationBaseModel('mc_home', mainMap, {
|
|
436
|
+
* name: 'MC Home',
|
|
437
|
+
* icon: "https://icon.jpg",
|
|
438
|
+
* });
|
|
439
|
+
* ```
|
|
440
|
+
*/
|
|
378
441
|
declare class LocationBaseModel<TMap extends MapBaseModel = MapBaseModel> extends StoredClassModel {
|
|
379
|
-
|
|
380
|
-
|
|
442
|
+
/**
|
|
443
|
+
* @param id The id of the location, it must be unique.
|
|
444
|
+
* @param map The map where the location is.
|
|
445
|
+
* @param props The properties of the location.
|
|
446
|
+
*/
|
|
447
|
+
constructor(id: string, map: TMap, props?: LocationBaseModelProps);
|
|
381
448
|
private defaultName;
|
|
449
|
+
/**
|
|
450
|
+
* The name of the location.
|
|
451
|
+
* If you set undefined, it will return the initial value of name.
|
|
452
|
+
*/
|
|
382
453
|
get name(): string;
|
|
383
|
-
set name(value: string);
|
|
454
|
+
set name(value: string | undefined);
|
|
384
455
|
private defaultDisabled;
|
|
456
|
+
/**
|
|
457
|
+
* Whether is disabled. If it is a string, it is a Pixi'VN flag name.
|
|
458
|
+
*/
|
|
385
459
|
get disabled(): boolean;
|
|
386
460
|
set disabled(value: boolean | string);
|
|
387
461
|
private defaultHidden;
|
|
462
|
+
/**
|
|
463
|
+
* Whether is hidden. If it is a string, it is a Pixi'VN flag name.
|
|
464
|
+
*/
|
|
388
465
|
get hidden(): boolean;
|
|
389
466
|
set hidden(value: boolean | string);
|
|
390
|
-
private
|
|
391
|
-
|
|
467
|
+
private _icon?;
|
|
468
|
+
/**
|
|
469
|
+
* The icon element. Can be a string or an Element or a Pixi'VN CanvasItem
|
|
470
|
+
*/
|
|
471
|
+
get icon(): GraphicItemType | undefined;
|
|
392
472
|
private _map;
|
|
473
|
+
/**
|
|
474
|
+
* The map where the location is.
|
|
475
|
+
*/
|
|
393
476
|
get map(): TMap;
|
|
477
|
+
/**
|
|
478
|
+
* Get the entrance room of the location.
|
|
479
|
+
* You can cast the room to a specific type that extends RoomBaseModel.
|
|
480
|
+
* @returns The entrance room or the first room if there is no entrance.
|
|
481
|
+
* @example
|
|
482
|
+
* ```typescript
|
|
483
|
+
* const entranceHome = new RoomBaseModel("entrance-home", home, { isEntrance: true })
|
|
484
|
+
* saveRoom(entranceHome)
|
|
485
|
+
* const home = new LocationBaseModel("home", map, { name: "Home" })
|
|
486
|
+
*
|
|
487
|
+
* const entrance = home.getEntrance() // entrance === entranceHome
|
|
488
|
+
* ```
|
|
489
|
+
*/
|
|
490
|
+
getEntrance<TRoom extends RoomBaseModel = RoomBaseModel>(): TRoom | undefined;
|
|
491
|
+
/**
|
|
492
|
+
* Get all rooms in the location.
|
|
493
|
+
* You can cast the rooms to a specific type that extends RoomBaseModel.
|
|
494
|
+
* @returns The rooms in the location.
|
|
495
|
+
*/
|
|
496
|
+
getRooms<TRoom extends RoomBaseModel = RoomBaseModel>(): TRoom[];
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
interface CommitmentBaseModelProps {
|
|
500
|
+
/**
|
|
501
|
+
* The name
|
|
502
|
+
* @default ""
|
|
503
|
+
*/
|
|
504
|
+
name?: string;
|
|
505
|
+
/**
|
|
506
|
+
* The hour when the commitment starts. If the commitment is not started yet, it will be hidden.
|
|
507
|
+
* If you set 3, the commitment will be hidden into hours 1 and 2, and will be shown from hour 3.
|
|
508
|
+
* @default TimeManager.minDayHours
|
|
509
|
+
*/
|
|
510
|
+
fromHour?: number;
|
|
511
|
+
/**
|
|
512
|
+
* The hour when the commitment ends. If the commitment is ended yet, it will be hidden.
|
|
513
|
+
* If you set 3, the commitment will be shown into hours 1 and 2 and will be hidden from hour 3.
|
|
514
|
+
* @default TimeManager.maxDayHours + 1
|
|
515
|
+
*/
|
|
516
|
+
toHour?: number;
|
|
517
|
+
/**
|
|
518
|
+
* The day when the commitment starts. If the commitment is not started yet, it will be hidden.
|
|
519
|
+
* If you set 3, the commitment will be hidden into days 1 and 2, and will be shown from day 3.
|
|
520
|
+
* @default undefined
|
|
521
|
+
*/
|
|
522
|
+
fromDay?: number;
|
|
523
|
+
/**
|
|
524
|
+
* The day when the commitment ends. If the commitment is ended yet, it will be deleted or hidden.
|
|
525
|
+
* If you set 3, the commitment will be shown into days 1 and 2 and will be deleted or hidden from day 3.
|
|
526
|
+
* @default undefined
|
|
527
|
+
*/
|
|
528
|
+
toDay?: number;
|
|
529
|
+
/**
|
|
530
|
+
* The image. It can be a string, an Element or a Pixi'VN Canvas Item.
|
|
531
|
+
* Or an object to manage multiple image types. For example to have a image based on time.
|
|
532
|
+
* @example
|
|
533
|
+
* ```ts
|
|
534
|
+
* {
|
|
535
|
+
* "morning": "morning-background.jpg",
|
|
536
|
+
* "afternoon": "afternoon-background.jpg",
|
|
537
|
+
* "evening": "evening-background.jpg",
|
|
538
|
+
* "night": "night-background.jpg"
|
|
539
|
+
* }
|
|
540
|
+
* ```
|
|
541
|
+
* @default undefined
|
|
542
|
+
*/
|
|
543
|
+
image?: GraphicItemType | {
|
|
544
|
+
[key: string]: GraphicItemType;
|
|
545
|
+
};
|
|
546
|
+
/**
|
|
547
|
+
* 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.
|
|
548
|
+
* @default ExecutionTypeEnum.INTERACTION
|
|
549
|
+
*/
|
|
550
|
+
executionType?: ExecutionTypeEnum;
|
|
551
|
+
/**
|
|
552
|
+
* Is a function that is called when the player interacts with the character.
|
|
553
|
+
* @param commitment
|
|
554
|
+
* @returns
|
|
555
|
+
* @default undefined
|
|
556
|
+
*/
|
|
557
|
+
onRun?: (commitment: CommitmentBaseModel) => void;
|
|
558
|
+
/**
|
|
559
|
+
* Whether is disabled. You can also pass a Pixi'VN flag name.
|
|
560
|
+
* If it is disabled this commitment will not be taken into consideration. So the characters will not be in the room, but will be busy with other commitments.
|
|
561
|
+
* @default false
|
|
562
|
+
*/
|
|
563
|
+
disabled?: boolean | string;
|
|
564
|
+
/**
|
|
565
|
+
* Whether is hidden. You can also pass a Pixi'VN flag name.
|
|
566
|
+
* @default false
|
|
567
|
+
*/
|
|
568
|
+
hidden?: boolean | string;
|
|
569
|
+
}
|
|
570
|
+
/**
|
|
571
|
+
* The base model of a commitment. I suggest you extend this class to create your own commitment model.
|
|
572
|
+
* You must use the saveRoom function to save the commitment in the registered commitments.
|
|
573
|
+
* @example
|
|
574
|
+
* ```ts
|
|
575
|
+
* export const mcRoom = new CommitmentBaseModel("test", character, room, {
|
|
576
|
+
* name: "Test",
|
|
577
|
+
* image: "https://image.jpg",
|
|
578
|
+
* executionType: ExecutionTypeEnum.INTERACTION,
|
|
579
|
+
* onRun: (commitment) => {
|
|
580
|
+
* // Do something
|
|
581
|
+
* }
|
|
582
|
+
})
|
|
583
|
+
* saveCommitment(mcRoom)
|
|
584
|
+
* ```
|
|
585
|
+
*/
|
|
586
|
+
declare class CommitmentBaseModel<TCharacter extends CharacterBaseModel = CharacterBaseModel, TRoom extends RoomBaseModel = RoomBaseModel> extends StoredClassModel {
|
|
587
|
+
/**
|
|
588
|
+
* @param id The id of the commitment, it must be unique.
|
|
589
|
+
* @param character The character or characters that are in the commitment and so in the room.
|
|
590
|
+
* @param room The room where the commitment is.
|
|
591
|
+
* @param props The properties of the commitment.
|
|
592
|
+
*/
|
|
593
|
+
constructor(id: string, character: TCharacter | TCharacter[] | undefined, room: TRoom, props: CommitmentBaseModelProps);
|
|
594
|
+
private _characters;
|
|
595
|
+
/**
|
|
596
|
+
* The character or characters that are in the commitment and so in the room.
|
|
597
|
+
*/
|
|
598
|
+
get characters(): TCharacter[];
|
|
599
|
+
private _room;
|
|
600
|
+
/**
|
|
601
|
+
* The room where the commitment is.
|
|
602
|
+
*/
|
|
603
|
+
get room(): TRoom;
|
|
604
|
+
private _name;
|
|
605
|
+
/**
|
|
606
|
+
* The name
|
|
607
|
+
*/
|
|
608
|
+
get name(): GraphicItemType;
|
|
609
|
+
private defaultFromHour?;
|
|
610
|
+
/**
|
|
611
|
+
* The hour when the commitment starts. If the commitment is not started yet, it will be hidden.
|
|
612
|
+
* If you set undefined, it will return the initial value of fromHour.
|
|
613
|
+
*/
|
|
614
|
+
get fromHour(): number;
|
|
615
|
+
set fromHour(value: number | undefined);
|
|
616
|
+
private defaultToHour?;
|
|
617
|
+
/**
|
|
618
|
+
* The hour when the commitment ends. If the commitment is ended yet, it will be hidden.
|
|
619
|
+
* If you set undefined, it will return the initial value of toHour.
|
|
620
|
+
*/
|
|
621
|
+
get toHour(): number;
|
|
622
|
+
set toHour(value: number | undefined);
|
|
623
|
+
private defaultFromDay?;
|
|
624
|
+
/**
|
|
625
|
+
* The day when the commitment starts. If the commitment is not started yet, it will be hidden.
|
|
626
|
+
* If you set undefined, it will return the initial value of fromDay.
|
|
627
|
+
*/
|
|
628
|
+
get fromDay(): number | undefined;
|
|
629
|
+
set fromDay(value: number | undefined);
|
|
630
|
+
private defaultToDay?;
|
|
631
|
+
/**
|
|
632
|
+
* The day when the commitment ends. If the commitment is ended yet, it will be deleted or hidden.
|
|
633
|
+
* If you set undefined, it will return the initial value of toDay.
|
|
634
|
+
*/
|
|
635
|
+
get toDay(): number | undefined;
|
|
636
|
+
set toDay(value: number | undefined);
|
|
637
|
+
private _image?;
|
|
638
|
+
/**
|
|
639
|
+
* The image. It can be a string, an Element or a Pixi'VN Canvas Item.
|
|
640
|
+
*/
|
|
641
|
+
get image(): GraphicItemType | {
|
|
642
|
+
[key: string]: GraphicItemType;
|
|
643
|
+
} | undefined;
|
|
644
|
+
private _executionType;
|
|
645
|
+
/**
|
|
646
|
+
* 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.
|
|
647
|
+
*/
|
|
648
|
+
get executionType(): ExecutionTypeEnum;
|
|
649
|
+
private _onRun?;
|
|
650
|
+
/**
|
|
651
|
+
* Is a function that is called when the player interacts with the character.
|
|
652
|
+
*/
|
|
653
|
+
onRun(): void;
|
|
654
|
+
private defaultDisabled;
|
|
655
|
+
/**
|
|
656
|
+
* Whether is disabled. You can also pass a Pixi'VN flag name.
|
|
657
|
+
*/
|
|
658
|
+
get disabled(): boolean;
|
|
659
|
+
set disabled(value: boolean | string);
|
|
660
|
+
private defaultHidden;
|
|
661
|
+
/**
|
|
662
|
+
* Whether is hidden. You can also pass a Pixi'VN flag name.
|
|
663
|
+
*/
|
|
664
|
+
get hidden(): boolean;
|
|
665
|
+
set hidden(value: boolean | string);
|
|
666
|
+
/**
|
|
667
|
+
* Whether the commitment is expired.
|
|
668
|
+
* @returns Whether the commitment is expired.
|
|
669
|
+
*/
|
|
670
|
+
isExpired(): boolean;
|
|
394
671
|
}
|
|
395
672
|
|
|
396
673
|
interface GoalProps {
|
|
@@ -497,13 +774,33 @@ declare function addTemporaryCommitment<TCommitment extends CommitmentBaseModel
|
|
|
497
774
|
declare function getFixedCommitments<TCommitment extends CommitmentBaseModel = CommitmentBaseModel>(): TCommitment[];
|
|
498
775
|
declare function getTemporaryCommitments<TCommitment extends CommitmentBaseModel = CommitmentBaseModel>(): TCommitment[];
|
|
499
776
|
|
|
777
|
+
/**
|
|
778
|
+
* Save a room in the registered rooms.
|
|
779
|
+
* @param room The room to save.
|
|
780
|
+
* @returns
|
|
781
|
+
*/
|
|
500
782
|
declare function saveRoom<TRoom extends RoomBaseModel = RoomBaseModel>(room: TRoom | TRoom[]): void;
|
|
783
|
+
/**
|
|
784
|
+
* Get a room by its id.
|
|
785
|
+
* @param id The id of the room.
|
|
786
|
+
* @returns The room or undefined if not found.
|
|
787
|
+
*/
|
|
501
788
|
declare function getRoomById<TRoom extends RoomBaseModel = RoomBaseModel>(id: string): TRoom | undefined;
|
|
789
|
+
/**
|
|
790
|
+
* Get all locations in the registered rooms.
|
|
791
|
+
* @returns All locations in the registered rooms.
|
|
792
|
+
*/
|
|
793
|
+
declare function getAllLocations<TLocation extends LocationBaseModel = LocationBaseModel>(): TLocation[];
|
|
794
|
+
/**
|
|
795
|
+
* Get all maps in the registered rooms.
|
|
796
|
+
* @returns All maps in the registered rooms.
|
|
797
|
+
*/
|
|
798
|
+
declare function getAllMaps<TMap extends MapBaseModel = MapBaseModel>(): TMap[];
|
|
502
799
|
|
|
503
800
|
declare function clearExpiredActivities(): void;
|
|
504
801
|
declare function currentActivities(): ActivityRoom[];
|
|
505
802
|
|
|
506
|
-
declare function setCurrentRoom<TRoom extends RoomBaseModel = RoomBaseModel>(room: TRoom): void;
|
|
803
|
+
declare function setCurrentRoom<TRoom extends RoomBaseModel = RoomBaseModel>(room: TRoom | LocationBaseModel): void;
|
|
507
804
|
declare function getCurrentRoom<TRoom extends RoomBaseModel = RoomBaseModel>(): TRoom | undefined;
|
|
508
805
|
declare function getCurrenrLocation<TLocation extends LocationBaseModel = LocationBaseModel>(): TLocation | undefined;
|
|
509
806
|
declare function getCueerntMap<TMap extends MapBaseModel = MapBaseModel>(): TMap | undefined;
|
|
@@ -640,4 +937,4 @@ declare class TimeManager {
|
|
|
640
937
|
static nowIsBetween(fromHour: number, toHour: number): boolean;
|
|
641
938
|
}
|
|
642
939
|
|
|
643
|
-
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 };
|
|
940
|
+
export { ActivityModel, type ActivityProps, CommitmentBaseModel, type CommitmentBaseModelProps, 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, getAllLocations, getAllMaps, getCommitmentByCharacter, getCommitmentById, getCueerntMap, getCurrenrLocation, getCurrentCommitments, getCurrentRoom, getFixedCommitments, getRoomById, getTemporaryCommitments, saveActivity, saveCommitment, saveRoom, setCurrentRoom, setFixedCommitments };
|