@drincs/nqtr 0.1.15 → 0.1.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ActivityProps-BoJeWa2B.d.mts +124 -0
- package/dist/ActivityProps-_79x9-BX.d.ts +124 -0
- package/dist/{index-Cu8ZAiqF.d.ts → Commitment-BObBFSTM.d.ts} +237 -220
- package/dist/{index-DhsRZJ3g.d.mts → Commitment-BrnOOgEN.d.mts} +237 -220
- package/dist/{index-gJ26gdgL.d.mts → Quest-Bdm0R9LA.d.mts} +7 -12
- package/dist/{index-BjOzVDyw.d.ts → Quest-CxJcXETG.d.ts} +7 -12
- package/dist/classes/Activity.d.mts +41 -127
- package/dist/classes/Activity.d.ts +41 -127
- package/dist/classes/Activity.js +2 -151
- package/dist/classes/Activity.js.map +1 -1
- package/dist/classes/Activity.mjs +2 -148
- package/dist/classes/Activity.mjs.map +1 -1
- package/dist/classes/ActivityStoredAbstract.d.mts +3 -0
- package/dist/classes/ActivityStoredAbstract.d.ts +3 -0
- package/dist/classes/ActivityStoredAbstract.js +399 -0
- package/dist/classes/ActivityStoredAbstract.js.map +1 -0
- package/dist/classes/ActivityStoredAbstract.mjs +397 -0
- package/dist/classes/ActivityStoredAbstract.mjs.map +1 -0
- package/dist/classes/Commitment.d.mts +4 -1
- package/dist/classes/Commitment.d.ts +4 -1
- package/dist/classes/Commitment.js +21 -4
- package/dist/classes/Commitment.js.map +1 -1
- package/dist/classes/Commitment.mjs +21 -4
- package/dist/classes/Commitment.mjs.map +1 -1
- package/dist/classes/index.d.mts +9 -2
- package/dist/classes/index.d.ts +9 -2
- package/dist/classes/index.js +884 -5
- package/dist/classes/index.js.map +1 -1
- package/dist/classes/index.mjs +879 -6
- package/dist/classes/index.mjs.map +1 -1
- package/dist/classes/navigation/ActivityRoom.d.mts +5 -2
- package/dist/classes/navigation/ActivityRoom.d.ts +5 -2
- package/dist/classes/navigation/ActivityRoom.js +3 -3
- package/dist/classes/navigation/ActivityRoom.js.map +1 -1
- package/dist/classes/navigation/ActivityRoom.mjs +3 -3
- package/dist/classes/navigation/ActivityRoom.mjs.map +1 -1
- package/dist/classes/navigation/Location.d.mts +5 -2
- package/dist/classes/navigation/Location.d.ts +5 -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 +5 -2
- package/dist/classes/navigation/Map.d.ts +5 -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 +4 -1
- package/dist/classes/navigation/Room.d.ts +4 -1
- package/dist/classes/navigation/Room.js +3 -3
- package/dist/classes/navigation/Room.js.map +1 -1
- package/dist/classes/navigation/Room.mjs +3 -3
- package/dist/classes/navigation/Room.mjs.map +1 -1
- package/dist/classes/quest/Goal.d.mts +3 -6
- package/dist/classes/quest/Goal.d.ts +3 -6
- package/dist/classes/quest/Goal.js.map +1 -1
- package/dist/classes/quest/Goal.mjs.map +1 -1
- package/dist/classes/quest/Quest.d.mts +3 -1
- package/dist/classes/quest/Quest.d.ts +3 -1
- package/dist/classes/quest/Quest.js.map +1 -1
- package/dist/classes/quest/Quest.mjs.map +1 -1
- package/dist/classes/quest/Stage.d.mts +3 -1
- package/dist/classes/quest/Stage.d.ts +3 -1
- package/dist/classes/quest/Stage.js.map +1 -1
- package/dist/classes/quest/Stage.mjs.map +1 -1
- package/dist/decorators/ActivityDecorator.d.mts +16 -0
- package/dist/decorators/ActivityDecorator.d.ts +16 -0
- package/dist/decorators/ActivityDecorator.js.map +1 -1
- package/dist/decorators/ActivityDecorator.mjs.map +1 -1
- package/dist/decorators/CommitmentDecorator.d.mts +5 -2
- package/dist/decorators/CommitmentDecorator.d.ts +5 -2
- package/dist/decorators/CommitmentDecorator.js +3 -3
- package/dist/decorators/CommitmentDecorator.js.map +1 -1
- package/dist/decorators/CommitmentDecorator.mjs +3 -3
- package/dist/decorators/CommitmentDecorator.mjs.map +1 -1
- package/dist/decorators/RoomDecorator.d.mts +9 -2
- package/dist/decorators/RoomDecorator.d.ts +9 -2
- package/dist/decorators/RoomDecorator.js.map +1 -1
- package/dist/decorators/RoomDecorator.mjs.map +1 -1
- package/dist/decorators/index.d.mts +4 -1
- package/dist/decorators/index.d.ts +4 -1
- package/dist/decorators/index.js +3 -3
- package/dist/decorators/index.js.map +1 -1
- package/dist/decorators/index.mjs +3 -3
- package/dist/decorators/index.mjs.map +1 -1
- package/dist/functions/ActivityFunctions.d.mts +5 -2
- package/dist/functions/ActivityFunctions.d.ts +5 -2
- package/dist/functions/ActivityFunctions.js.map +1 -1
- package/dist/functions/ActivityFunctions.mjs.map +1 -1
- package/dist/functions/NavigationFunctions.d.mts +5 -2
- package/dist/functions/NavigationFunctions.d.ts +5 -2
- package/dist/functions/NavigationFunctions.js.map +1 -1
- package/dist/functions/NavigationFunctions.mjs.map +1 -1
- package/dist/functions/RoutineFunctions.d.mts +5 -2
- package/dist/functions/RoutineFunctions.d.ts +5 -2
- package/dist/functions/RoutineFunctions.js.map +1 -1
- package/dist/functions/RoutineFunctions.mjs.map +1 -1
- package/dist/functions/index.d.mts +5 -2
- package/dist/functions/index.d.ts +5 -2
- package/dist/functions/index.js.map +1 -1
- package/dist/functions/index.mjs.map +1 -1
- package/dist/index.d.mts +9 -4
- package/dist/index.d.ts +9 -4
- package/dist/index.js +171 -154
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +171 -154
- package/dist/index.mjs.map +1 -1
- package/dist/interface/ActivityProps.d.mts +3 -0
- package/dist/interface/ActivityProps.d.ts +3 -0
- package/dist/{override/OnRunActivityProps.js → interface/ActivityProps.js} +1 -1
- package/dist/interface/ActivityProps.mjs +3 -0
- package/dist/interface/CommitmentProps.d.mts +8 -0
- package/dist/interface/CommitmentProps.d.ts +8 -0
- package/dist/interface/CommitmentProps.js +4 -0
- package/dist/interface/CommitmentProps.js.map +1 -0
- package/dist/interface/CommitmentProps.mjs +3 -0
- package/dist/interface/CommitmentProps.mjs.map +1 -0
- package/dist/interface/RoomActivityMemory.d.mts +9 -0
- package/dist/interface/RoomActivityMemory.d.ts +9 -0
- package/dist/interface/RoomActivityMemory.js +4 -0
- package/dist/interface/RoomActivityMemory.js.map +1 -0
- package/dist/interface/RoomActivityMemory.mjs +3 -0
- package/dist/interface/RoomActivityMemory.mjs.map +1 -0
- package/dist/interface/RoomProps.d.mts +8 -0
- package/dist/interface/RoomProps.d.ts +8 -0
- package/dist/interface/RoomProps.js +4 -0
- package/dist/interface/RoomProps.js.map +1 -0
- package/dist/interface/RoomProps.mjs +3 -0
- package/dist/interface/RoomProps.mjs.map +1 -0
- package/dist/interface/index.d.mts +12 -0
- package/dist/interface/index.d.ts +12 -0
- package/dist/interface/index.js +4 -0
- package/dist/interface/index.js.map +1 -0
- package/dist/interface/index.mjs +3 -0
- package/dist/interface/index.mjs.map +1 -0
- package/dist/interface/navigation/LocationProps.d.mts +8 -0
- package/dist/interface/navigation/LocationProps.d.ts +8 -0
- package/dist/interface/navigation/LocationProps.js +4 -0
- package/dist/interface/navigation/LocationProps.js.map +1 -0
- package/dist/interface/navigation/LocationProps.mjs +3 -0
- package/dist/interface/navigation/LocationProps.mjs.map +1 -0
- package/dist/interface/navigation/MapProps.d.mts +8 -0
- package/dist/interface/navigation/MapProps.d.ts +8 -0
- package/dist/interface/navigation/MapProps.js +4 -0
- package/dist/interface/navigation/MapProps.js.map +1 -0
- package/dist/interface/navigation/MapProps.mjs +3 -0
- package/dist/interface/navigation/MapProps.mjs.map +1 -0
- package/dist/interface/quest/GoalProps.d.mts +7 -0
- package/dist/interface/quest/GoalProps.d.ts +7 -0
- package/dist/interface/quest/GoalProps.js +4 -0
- package/dist/interface/quest/GoalProps.js.map +1 -0
- package/dist/interface/quest/GoalProps.mjs +3 -0
- package/dist/interface/quest/GoalProps.mjs.map +1 -0
- package/dist/interface/quest/QuestProps.d.mts +9 -0
- package/dist/interface/quest/QuestProps.d.ts +9 -0
- package/dist/interface/quest/QuestProps.js +4 -0
- package/dist/interface/quest/QuestProps.js.map +1 -0
- package/dist/interface/quest/QuestProps.mjs +3 -0
- package/dist/interface/quest/QuestProps.mjs.map +1 -0
- package/dist/interface/quest/StageProps.d.mts +5 -0
- package/dist/interface/quest/StageProps.d.ts +5 -0
- package/dist/interface/quest/StageProps.js +4 -0
- package/dist/interface/quest/StageProps.js.map +1 -0
- package/dist/interface/quest/StageProps.mjs +3 -0
- package/dist/interface/quest/StageProps.mjs.map +1 -0
- package/dist/managers/TimeManager.d.mts +1 -1
- package/dist/managers/TimeManager.d.ts +1 -1
- package/dist/managers/TimeManager.js +1 -1
- package/dist/managers/TimeManager.js.map +1 -1
- package/dist/managers/TimeManager.mjs +1 -1
- package/dist/managers/TimeManager.mjs.map +1 -1
- package/dist/managers/index.js +1 -1
- package/dist/managers/index.js.map +1 -1
- package/dist/managers/index.mjs +1 -1
- package/dist/managers/index.mjs.map +1 -1
- package/dist/override/{OnRunActivityProps.d.mts → OnRunProps.d.mts} +3 -3
- package/dist/override/{OnRunActivityProps.d.ts → OnRunProps.d.ts} +3 -3
- package/dist/override/OnRunProps.js +4 -0
- package/dist/override/OnRunProps.js.map +1 -0
- package/dist/override/OnRunProps.mjs +3 -0
- package/dist/override/OnRunProps.mjs.map +1 -0
- package/dist/override/index.d.mts +1 -1
- package/dist/override/index.d.ts +1 -1
- package/dist/types/OnRunActivityEvent.d.mts +8 -0
- package/dist/types/OnRunActivityEvent.d.ts +8 -0
- package/dist/types/OnRunActivityEvent.js +4 -0
- package/dist/types/OnRunActivityEvent.js.map +1 -0
- package/dist/types/OnRunActivityEvent.mjs +3 -0
- package/dist/types/OnRunActivityEvent.mjs.map +1 -0
- package/dist/types/OnRunCommitmentEvent.d.mts +8 -0
- package/dist/types/OnRunCommitmentEvent.d.ts +8 -0
- package/dist/types/OnRunCommitmentEvent.js +4 -0
- package/dist/types/OnRunCommitmentEvent.js.map +1 -0
- package/dist/types/OnRunCommitmentEvent.mjs +3 -0
- package/dist/types/OnRunCommitmentEvent.mjs.map +1 -0
- package/dist/types/QuestsRequired.d.mts +4 -2
- package/dist/types/QuestsRequired.d.ts +4 -2
- package/dist/types/index.d.mts +4 -2
- package/dist/types/index.d.ts +4 -2
- package/package.json +2 -2
- package/dist/classes/navigation/index.d.mts +0 -5
- package/dist/classes/navigation/index.d.ts +0 -5
- package/dist/classes/navigation/index.js +0 -987
- package/dist/classes/navigation/index.js.map +0 -1
- package/dist/classes/navigation/index.mjs +0 -983
- package/dist/classes/navigation/index.mjs.map +0 -1
- package/dist/classes/quest/index.d.mts +0 -3
- package/dist/classes/quest/index.d.ts +0 -3
- package/dist/classes/quest/index.js +0 -133
- package/dist/classes/quest/index.js.map +0 -1
- package/dist/classes/quest/index.mjs +0 -129
- package/dist/classes/quest/index.mjs.map +0 -1
- package/dist/override/OnRunActivityProps.mjs +0 -3
- /package/dist/{override/OnRunActivityProps.js.map → interface/ActivityProps.js.map} +0 -0
- /package/dist/{override/OnRunActivityProps.mjs.map → interface/ActivityProps.mjs.map} +0 -0
package/dist/index.mjs
CHANGED
|
@@ -193,7 +193,7 @@ var TimeManager = class _TimeManager {
|
|
|
193
193
|
* Get the current TimeManager.timeSlots index.
|
|
194
194
|
* You can use this property to create "Image that changes based on the time period":
|
|
195
195
|
* @example
|
|
196
|
-
* ```
|
|
196
|
+
* ```tsx
|
|
197
197
|
* import { TimeManager } from '@drincs/nqtr';
|
|
198
198
|
*
|
|
199
199
|
* function changeBackground() {
|
|
@@ -260,152 +260,6 @@ var TimeManager = class _TimeManager {
|
|
|
260
260
|
};
|
|
261
261
|
|
|
262
262
|
// src/classes/Activity.ts
|
|
263
|
-
var ActivityStoredAbstract = class {
|
|
264
|
-
/**
|
|
265
|
-
* @param onRun The function that is called when the activity is runned. Have 2 parameters: the runned activity and the yourParams object, that is an object with the parameters that you want to pass to the onRun function.
|
|
266
|
-
* @param props The activity properties.
|
|
267
|
-
*/
|
|
268
|
-
constructor(onRun, props) {
|
|
269
|
-
this.defaultName = props.name;
|
|
270
|
-
this.defaultFromHour = props.fromHour;
|
|
271
|
-
this.defaultToHour = props.toHour;
|
|
272
|
-
this.defaultFromDay = props.fromDay;
|
|
273
|
-
this.defaultToDay = props.toDay;
|
|
274
|
-
this.defaultDisabled = props.disabled || false;
|
|
275
|
-
this.defaultHidden = props.hidden || false;
|
|
276
|
-
this._renderIcon = props.renderIcon;
|
|
277
|
-
this._onRun = onRun;
|
|
278
|
-
}
|
|
279
|
-
/**
|
|
280
|
-
* The name
|
|
281
|
-
*/
|
|
282
|
-
get name() {
|
|
283
|
-
return this.getStorageProperty("name") || this.defaultName || "";
|
|
284
|
-
}
|
|
285
|
-
set name(value) {
|
|
286
|
-
this.setStorageProperty("name", value);
|
|
287
|
-
}
|
|
288
|
-
/**
|
|
289
|
-
* The hour when the activity starts. If the activity is not started yet, it will be hidden.
|
|
290
|
-
*/
|
|
291
|
-
get fromHour() {
|
|
292
|
-
return this.getStorageProperty("fromHour") || this.defaultFromHour || TimeManager.minDayHours;
|
|
293
|
-
}
|
|
294
|
-
set fromHour(value) {
|
|
295
|
-
this.setStorageProperty("fromHour", value);
|
|
296
|
-
}
|
|
297
|
-
/**
|
|
298
|
-
* The hour when the activity ends. If the activity is ended yet, it will be hidden.
|
|
299
|
-
*/
|
|
300
|
-
get toHour() {
|
|
301
|
-
return this.getStorageProperty("toHour") || this.defaultToHour || TimeManager.maxDayHours + 1;
|
|
302
|
-
}
|
|
303
|
-
set toHour(value) {
|
|
304
|
-
this.setStorageProperty("toHour", value);
|
|
305
|
-
}
|
|
306
|
-
/**
|
|
307
|
-
* The day when the activity starts. If the activity is not started yet, it will be hidden.
|
|
308
|
-
*/
|
|
309
|
-
get fromDay() {
|
|
310
|
-
return this.getStorageProperty("fromDay") || this.defaultFromDay;
|
|
311
|
-
}
|
|
312
|
-
set fromDay(value) {
|
|
313
|
-
this.setStorageProperty("fromDay", value);
|
|
314
|
-
}
|
|
315
|
-
/**
|
|
316
|
-
* The day when the activity ends. If the activity is ended yet, it will be deleted or hidden.
|
|
317
|
-
*/
|
|
318
|
-
get toDay() {
|
|
319
|
-
return this.getStorageProperty("toDay") || this.defaultToDay;
|
|
320
|
-
}
|
|
321
|
-
set toDay(value) {
|
|
322
|
-
this.setStorageProperty("toDay", value);
|
|
323
|
-
}
|
|
324
|
-
/**
|
|
325
|
-
* Whether is disabled.
|
|
326
|
-
*/
|
|
327
|
-
get disabled() {
|
|
328
|
-
let value = this.getStorageProperty("disabled") || this.defaultDisabled;
|
|
329
|
-
if (typeof value === "string") {
|
|
330
|
-
return getFlag(value);
|
|
331
|
-
}
|
|
332
|
-
return value;
|
|
333
|
-
}
|
|
334
|
-
set disabled(value) {
|
|
335
|
-
this.setStorageProperty("disabled", value);
|
|
336
|
-
}
|
|
337
|
-
/**
|
|
338
|
-
* Whether is hidden. If the activity is not started yet, it will be hidden.
|
|
339
|
-
*/
|
|
340
|
-
get hidden() {
|
|
341
|
-
if (this.fromDay && this.fromDay > TimeManager.currentDay) {
|
|
342
|
-
return true;
|
|
343
|
-
}
|
|
344
|
-
if (!TimeManager.nowIsBetween(this.fromHour, this.toHour)) {
|
|
345
|
-
return true;
|
|
346
|
-
}
|
|
347
|
-
if (!this.isExpired) {
|
|
348
|
-
return true;
|
|
349
|
-
}
|
|
350
|
-
let value = this.getStorageProperty("hidden") || this.defaultHidden;
|
|
351
|
-
if (typeof value === "string") {
|
|
352
|
-
return getFlag(value);
|
|
353
|
-
}
|
|
354
|
-
return value;
|
|
355
|
-
}
|
|
356
|
-
set hidden(value) {
|
|
357
|
-
this.setStorageProperty("hidden", value);
|
|
358
|
-
}
|
|
359
|
-
/**
|
|
360
|
-
* The function for rendering the icon of the activity.
|
|
361
|
-
*/
|
|
362
|
-
get renderIcon() {
|
|
363
|
-
let render = this._renderIcon;
|
|
364
|
-
if (render === void 0) {
|
|
365
|
-
return void 0;
|
|
366
|
-
}
|
|
367
|
-
if (typeof render === "function") {
|
|
368
|
-
return (props) => {
|
|
369
|
-
return render(this, props);
|
|
370
|
-
};
|
|
371
|
-
}
|
|
372
|
-
return (props) => render;
|
|
373
|
-
}
|
|
374
|
-
/**
|
|
375
|
-
* The function that is called when the activity is runned.
|
|
376
|
-
*/
|
|
377
|
-
get onRun() {
|
|
378
|
-
return (props) => {
|
|
379
|
-
return this._onRun(this, props);
|
|
380
|
-
};
|
|
381
|
-
}
|
|
382
|
-
/**
|
|
383
|
-
* Whether the activity is a deadline.
|
|
384
|
-
* @returns Whether the activity is a deadline.
|
|
385
|
-
*/
|
|
386
|
-
isExpired() {
|
|
387
|
-
if (this.toDay && this.toDay <= TimeManager.currentDay) {
|
|
388
|
-
return true;
|
|
389
|
-
}
|
|
390
|
-
return false;
|
|
391
|
-
}
|
|
392
|
-
/**
|
|
393
|
-
* Export the activity properties.
|
|
394
|
-
* @returns The activity properties.
|
|
395
|
-
*/
|
|
396
|
-
export() {
|
|
397
|
-
return {
|
|
398
|
-
name: this.getStorageProperty("name") || this.defaultName,
|
|
399
|
-
fromHour: this.getStorageProperty("fromHour") || this.defaultFromHour,
|
|
400
|
-
toHour: this.getStorageProperty("toHour") || this.defaultToHour,
|
|
401
|
-
fromDay: this.getStorageProperty("fromDay") || this.defaultFromDay,
|
|
402
|
-
toDay: this.getStorageProperty("toDay") || this.defaultToDay,
|
|
403
|
-
disabled: this.getStorageProperty("disabled") || this.defaultDisabled,
|
|
404
|
-
hidden: this.getStorageProperty("hidden") || this.defaultHidden,
|
|
405
|
-
renderIcon: this._renderIcon
|
|
406
|
-
};
|
|
407
|
-
}
|
|
408
|
-
};
|
|
409
263
|
var ActivityModel = class {
|
|
410
264
|
/**
|
|
411
265
|
* @param id The activity id, that must be unique.
|
|
@@ -566,6 +420,7 @@ var CommitmentBaseModel = class extends StoredClassModel {
|
|
|
566
420
|
this._onRun = props.onRun;
|
|
567
421
|
this.defaultDisabled = props.disabled || false;
|
|
568
422
|
this.defaultHidden = props.hidden || false;
|
|
423
|
+
this._renderIcon = props.renderIcon;
|
|
569
424
|
}
|
|
570
425
|
/**
|
|
571
426
|
* The character or characters that are in the commitment and so in the room.
|
|
@@ -646,15 +501,31 @@ var CommitmentBaseModel = class extends StoredClassModel {
|
|
|
646
501
|
get executionType() {
|
|
647
502
|
return this._executionType;
|
|
648
503
|
}
|
|
504
|
+
/**
|
|
505
|
+
* The function for rendering the icon of the commitment.
|
|
506
|
+
*/
|
|
507
|
+
get renderIcon() {
|
|
508
|
+
let render = this._renderIcon;
|
|
509
|
+
if (render === void 0) {
|
|
510
|
+
return void 0;
|
|
511
|
+
}
|
|
512
|
+
if (typeof render === "function") {
|
|
513
|
+
return (props) => {
|
|
514
|
+
return render(this, props);
|
|
515
|
+
};
|
|
516
|
+
}
|
|
517
|
+
return (props) => render;
|
|
518
|
+
}
|
|
649
519
|
/**
|
|
650
520
|
* Is a function that is called when the player interacts with the character.
|
|
651
521
|
*/
|
|
652
522
|
onRun() {
|
|
653
|
-
|
|
523
|
+
let onRun = this._onRun;
|
|
524
|
+
if (!onRun) {
|
|
654
525
|
console.warn("[NQTR] onRun() is not defined for commitmen, so it will not run.", this);
|
|
655
|
-
|
|
656
|
-
this._onRun(this);
|
|
526
|
+
return;
|
|
657
527
|
}
|
|
528
|
+
return (props) => onRun(this, props);
|
|
658
529
|
}
|
|
659
530
|
/**
|
|
660
531
|
* Whether is disabled. You can also pass a Pixi'VN flag name.
|
|
@@ -996,13 +867,13 @@ function getCommitmentById(id) {
|
|
|
996
867
|
}
|
|
997
868
|
function setFixedCommitments(commitments) {
|
|
998
869
|
if (Array.isArray(commitments)) {
|
|
999
|
-
commitments.forEach((c) =>
|
|
870
|
+
commitments.forEach((c) => setFixedCommitments(c));
|
|
1000
871
|
return;
|
|
1001
872
|
}
|
|
1002
|
-
if (
|
|
873
|
+
if (fixedCommitments[commitments.id]) {
|
|
1003
874
|
console.warn(`[NQTR] Commitment id ${commitments.id} already exists, it will be overwritten`);
|
|
1004
875
|
}
|
|
1005
|
-
|
|
876
|
+
fixedCommitments[commitments.id] = commitments;
|
|
1006
877
|
}
|
|
1007
878
|
function addTemporaryCommitment(commitment) {
|
|
1008
879
|
if (!Array.isArray(commitment)) {
|
|
@@ -1078,6 +949,152 @@ function getCommitmentByCharacter(character) {
|
|
|
1078
949
|
});
|
|
1079
950
|
return void 0;
|
|
1080
951
|
}
|
|
952
|
+
var ActivityStoredAbstract = class {
|
|
953
|
+
/**
|
|
954
|
+
* @param onRun The function that is called when the activity is runned. Have 2 parameters: the runned activity and the yourParams object, that is an object with the parameters that you want to pass to the onRun function.
|
|
955
|
+
* @param props The activity properties.
|
|
956
|
+
*/
|
|
957
|
+
constructor(onRun, props) {
|
|
958
|
+
this.defaultName = props.name;
|
|
959
|
+
this.defaultFromHour = props.fromHour;
|
|
960
|
+
this.defaultToHour = props.toHour;
|
|
961
|
+
this.defaultFromDay = props.fromDay;
|
|
962
|
+
this.defaultToDay = props.toDay;
|
|
963
|
+
this.defaultDisabled = props.disabled || false;
|
|
964
|
+
this.defaultHidden = props.hidden || false;
|
|
965
|
+
this._renderIcon = props.renderIcon;
|
|
966
|
+
this._onRun = onRun;
|
|
967
|
+
}
|
|
968
|
+
/**
|
|
969
|
+
* The name
|
|
970
|
+
*/
|
|
971
|
+
get name() {
|
|
972
|
+
return this.getStorageProperty("name") || this.defaultName || "";
|
|
973
|
+
}
|
|
974
|
+
set name(value) {
|
|
975
|
+
this.setStorageProperty("name", value);
|
|
976
|
+
}
|
|
977
|
+
/**
|
|
978
|
+
* The hour when the activity starts. If the activity is not started yet, it will be hidden.
|
|
979
|
+
*/
|
|
980
|
+
get fromHour() {
|
|
981
|
+
return this.getStorageProperty("fromHour") || this.defaultFromHour || TimeManager.minDayHours;
|
|
982
|
+
}
|
|
983
|
+
set fromHour(value) {
|
|
984
|
+
this.setStorageProperty("fromHour", value);
|
|
985
|
+
}
|
|
986
|
+
/**
|
|
987
|
+
* The hour when the activity ends. If the activity is ended yet, it will be hidden.
|
|
988
|
+
*/
|
|
989
|
+
get toHour() {
|
|
990
|
+
return this.getStorageProperty("toHour") || this.defaultToHour || TimeManager.maxDayHours + 1;
|
|
991
|
+
}
|
|
992
|
+
set toHour(value) {
|
|
993
|
+
this.setStorageProperty("toHour", value);
|
|
994
|
+
}
|
|
995
|
+
/**
|
|
996
|
+
* The day when the activity starts. If the activity is not started yet, it will be hidden.
|
|
997
|
+
*/
|
|
998
|
+
get fromDay() {
|
|
999
|
+
return this.getStorageProperty("fromDay") || this.defaultFromDay;
|
|
1000
|
+
}
|
|
1001
|
+
set fromDay(value) {
|
|
1002
|
+
this.setStorageProperty("fromDay", value);
|
|
1003
|
+
}
|
|
1004
|
+
/**
|
|
1005
|
+
* The day when the activity ends. If the activity is ended yet, it will be deleted or hidden.
|
|
1006
|
+
*/
|
|
1007
|
+
get toDay() {
|
|
1008
|
+
return this.getStorageProperty("toDay") || this.defaultToDay;
|
|
1009
|
+
}
|
|
1010
|
+
set toDay(value) {
|
|
1011
|
+
this.setStorageProperty("toDay", value);
|
|
1012
|
+
}
|
|
1013
|
+
/**
|
|
1014
|
+
* Whether is disabled.
|
|
1015
|
+
*/
|
|
1016
|
+
get disabled() {
|
|
1017
|
+
let value = this.getStorageProperty("disabled") || this.defaultDisabled;
|
|
1018
|
+
if (typeof value === "string") {
|
|
1019
|
+
return getFlag(value);
|
|
1020
|
+
}
|
|
1021
|
+
return value;
|
|
1022
|
+
}
|
|
1023
|
+
set disabled(value) {
|
|
1024
|
+
this.setStorageProperty("disabled", value);
|
|
1025
|
+
}
|
|
1026
|
+
/**
|
|
1027
|
+
* Whether is hidden. If the activity is not started yet, it will be hidden.
|
|
1028
|
+
*/
|
|
1029
|
+
get hidden() {
|
|
1030
|
+
if (this.fromDay && this.fromDay > TimeManager.currentDay) {
|
|
1031
|
+
return true;
|
|
1032
|
+
}
|
|
1033
|
+
if (!TimeManager.nowIsBetween(this.fromHour, this.toHour)) {
|
|
1034
|
+
return true;
|
|
1035
|
+
}
|
|
1036
|
+
if (!this.isExpired) {
|
|
1037
|
+
return true;
|
|
1038
|
+
}
|
|
1039
|
+
let value = this.getStorageProperty("hidden") || this.defaultHidden;
|
|
1040
|
+
if (typeof value === "string") {
|
|
1041
|
+
return getFlag(value);
|
|
1042
|
+
}
|
|
1043
|
+
return value;
|
|
1044
|
+
}
|
|
1045
|
+
set hidden(value) {
|
|
1046
|
+
this.setStorageProperty("hidden", value);
|
|
1047
|
+
}
|
|
1048
|
+
/**
|
|
1049
|
+
* The function for rendering the icon of the activity.
|
|
1050
|
+
*/
|
|
1051
|
+
get renderIcon() {
|
|
1052
|
+
let render = this._renderIcon;
|
|
1053
|
+
if (render === void 0) {
|
|
1054
|
+
return void 0;
|
|
1055
|
+
}
|
|
1056
|
+
if (typeof render === "function") {
|
|
1057
|
+
return (props) => {
|
|
1058
|
+
return render(this, props);
|
|
1059
|
+
};
|
|
1060
|
+
}
|
|
1061
|
+
return (props) => render;
|
|
1062
|
+
}
|
|
1063
|
+
/**
|
|
1064
|
+
* The function that is called when the activity is runned.
|
|
1065
|
+
*/
|
|
1066
|
+
get onRun() {
|
|
1067
|
+
return (props) => {
|
|
1068
|
+
return this._onRun(this, props);
|
|
1069
|
+
};
|
|
1070
|
+
}
|
|
1071
|
+
/**
|
|
1072
|
+
* Whether the activity is a deadline.
|
|
1073
|
+
* @returns Whether the activity is a deadline.
|
|
1074
|
+
*/
|
|
1075
|
+
isExpired() {
|
|
1076
|
+
if (this.toDay && this.toDay <= TimeManager.currentDay) {
|
|
1077
|
+
return true;
|
|
1078
|
+
}
|
|
1079
|
+
return false;
|
|
1080
|
+
}
|
|
1081
|
+
/**
|
|
1082
|
+
* Export the activity properties.
|
|
1083
|
+
* @returns The activity properties.
|
|
1084
|
+
*/
|
|
1085
|
+
export() {
|
|
1086
|
+
return {
|
|
1087
|
+
name: this.getStorageProperty("name") || this.defaultName,
|
|
1088
|
+
fromHour: this.getStorageProperty("fromHour") || this.defaultFromHour,
|
|
1089
|
+
toHour: this.getStorageProperty("toHour") || this.defaultToHour,
|
|
1090
|
+
fromDay: this.getStorageProperty("fromDay") || this.defaultFromDay,
|
|
1091
|
+
toDay: this.getStorageProperty("toDay") || this.defaultToDay,
|
|
1092
|
+
disabled: this.getStorageProperty("disabled") || this.defaultDisabled,
|
|
1093
|
+
hidden: this.getStorageProperty("hidden") || this.defaultHidden,
|
|
1094
|
+
renderIcon: this._renderIcon
|
|
1095
|
+
};
|
|
1096
|
+
}
|
|
1097
|
+
};
|
|
1081
1098
|
|
|
1082
1099
|
// src/classes/navigation/ActivityRoom.ts
|
|
1083
1100
|
var ActivityRoom = class extends ActivityStoredAbstract {
|
|
@@ -1212,7 +1229,7 @@ var RoomBaseModel = class extends StoredClassModel {
|
|
|
1212
1229
|
get activities() {
|
|
1213
1230
|
let activities = this.activityIds.map((id) => {
|
|
1214
1231
|
return this.getActivity(id);
|
|
1215
|
-
}).filter((activity) => activity !== void 0);
|
|
1232
|
+
}).filter((activity) => activity !== void 0 && !activity.hidden);
|
|
1216
1233
|
return activities;
|
|
1217
1234
|
}
|
|
1218
1235
|
/**
|