@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.js
CHANGED
|
@@ -195,7 +195,7 @@ var TimeManager = class _TimeManager {
|
|
|
195
195
|
* Get the current TimeManager.timeSlots index.
|
|
196
196
|
* You can use this property to create "Image that changes based on the time period":
|
|
197
197
|
* @example
|
|
198
|
-
* ```
|
|
198
|
+
* ```tsx
|
|
199
199
|
* import { TimeManager } from '@drincs/nqtr';
|
|
200
200
|
*
|
|
201
201
|
* function changeBackground() {
|
|
@@ -262,152 +262,6 @@ var TimeManager = class _TimeManager {
|
|
|
262
262
|
};
|
|
263
263
|
|
|
264
264
|
// src/classes/Activity.ts
|
|
265
|
-
var ActivityStoredAbstract = class {
|
|
266
|
-
/**
|
|
267
|
-
* @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.
|
|
268
|
-
* @param props The activity properties.
|
|
269
|
-
*/
|
|
270
|
-
constructor(onRun, props) {
|
|
271
|
-
this.defaultName = props.name;
|
|
272
|
-
this.defaultFromHour = props.fromHour;
|
|
273
|
-
this.defaultToHour = props.toHour;
|
|
274
|
-
this.defaultFromDay = props.fromDay;
|
|
275
|
-
this.defaultToDay = props.toDay;
|
|
276
|
-
this.defaultDisabled = props.disabled || false;
|
|
277
|
-
this.defaultHidden = props.hidden || false;
|
|
278
|
-
this._renderIcon = props.renderIcon;
|
|
279
|
-
this._onRun = onRun;
|
|
280
|
-
}
|
|
281
|
-
/**
|
|
282
|
-
* The name
|
|
283
|
-
*/
|
|
284
|
-
get name() {
|
|
285
|
-
return this.getStorageProperty("name") || this.defaultName || "";
|
|
286
|
-
}
|
|
287
|
-
set name(value) {
|
|
288
|
-
this.setStorageProperty("name", value);
|
|
289
|
-
}
|
|
290
|
-
/**
|
|
291
|
-
* The hour when the activity starts. If the activity is not started yet, it will be hidden.
|
|
292
|
-
*/
|
|
293
|
-
get fromHour() {
|
|
294
|
-
return this.getStorageProperty("fromHour") || this.defaultFromHour || TimeManager.minDayHours;
|
|
295
|
-
}
|
|
296
|
-
set fromHour(value) {
|
|
297
|
-
this.setStorageProperty("fromHour", value);
|
|
298
|
-
}
|
|
299
|
-
/**
|
|
300
|
-
* The hour when the activity ends. If the activity is ended yet, it will be hidden.
|
|
301
|
-
*/
|
|
302
|
-
get toHour() {
|
|
303
|
-
return this.getStorageProperty("toHour") || this.defaultToHour || TimeManager.maxDayHours + 1;
|
|
304
|
-
}
|
|
305
|
-
set toHour(value) {
|
|
306
|
-
this.setStorageProperty("toHour", value);
|
|
307
|
-
}
|
|
308
|
-
/**
|
|
309
|
-
* The day when the activity starts. If the activity is not started yet, it will be hidden.
|
|
310
|
-
*/
|
|
311
|
-
get fromDay() {
|
|
312
|
-
return this.getStorageProperty("fromDay") || this.defaultFromDay;
|
|
313
|
-
}
|
|
314
|
-
set fromDay(value) {
|
|
315
|
-
this.setStorageProperty("fromDay", value);
|
|
316
|
-
}
|
|
317
|
-
/**
|
|
318
|
-
* The day when the activity ends. If the activity is ended yet, it will be deleted or hidden.
|
|
319
|
-
*/
|
|
320
|
-
get toDay() {
|
|
321
|
-
return this.getStorageProperty("toDay") || this.defaultToDay;
|
|
322
|
-
}
|
|
323
|
-
set toDay(value) {
|
|
324
|
-
this.setStorageProperty("toDay", value);
|
|
325
|
-
}
|
|
326
|
-
/**
|
|
327
|
-
* Whether is disabled.
|
|
328
|
-
*/
|
|
329
|
-
get disabled() {
|
|
330
|
-
let value = this.getStorageProperty("disabled") || this.defaultDisabled;
|
|
331
|
-
if (typeof value === "string") {
|
|
332
|
-
return pixiVn.getFlag(value);
|
|
333
|
-
}
|
|
334
|
-
return value;
|
|
335
|
-
}
|
|
336
|
-
set disabled(value) {
|
|
337
|
-
this.setStorageProperty("disabled", value);
|
|
338
|
-
}
|
|
339
|
-
/**
|
|
340
|
-
* Whether is hidden. If the activity is not started yet, it will be hidden.
|
|
341
|
-
*/
|
|
342
|
-
get hidden() {
|
|
343
|
-
if (this.fromDay && this.fromDay > TimeManager.currentDay) {
|
|
344
|
-
return true;
|
|
345
|
-
}
|
|
346
|
-
if (!TimeManager.nowIsBetween(this.fromHour, this.toHour)) {
|
|
347
|
-
return true;
|
|
348
|
-
}
|
|
349
|
-
if (!this.isExpired) {
|
|
350
|
-
return true;
|
|
351
|
-
}
|
|
352
|
-
let value = this.getStorageProperty("hidden") || this.defaultHidden;
|
|
353
|
-
if (typeof value === "string") {
|
|
354
|
-
return pixiVn.getFlag(value);
|
|
355
|
-
}
|
|
356
|
-
return value;
|
|
357
|
-
}
|
|
358
|
-
set hidden(value) {
|
|
359
|
-
this.setStorageProperty("hidden", value);
|
|
360
|
-
}
|
|
361
|
-
/**
|
|
362
|
-
* The function for rendering the icon of the activity.
|
|
363
|
-
*/
|
|
364
|
-
get renderIcon() {
|
|
365
|
-
let render = this._renderIcon;
|
|
366
|
-
if (render === void 0) {
|
|
367
|
-
return void 0;
|
|
368
|
-
}
|
|
369
|
-
if (typeof render === "function") {
|
|
370
|
-
return (props) => {
|
|
371
|
-
return render(this, props);
|
|
372
|
-
};
|
|
373
|
-
}
|
|
374
|
-
return (props) => render;
|
|
375
|
-
}
|
|
376
|
-
/**
|
|
377
|
-
* The function that is called when the activity is runned.
|
|
378
|
-
*/
|
|
379
|
-
get onRun() {
|
|
380
|
-
return (props) => {
|
|
381
|
-
return this._onRun(this, props);
|
|
382
|
-
};
|
|
383
|
-
}
|
|
384
|
-
/**
|
|
385
|
-
* Whether the activity is a deadline.
|
|
386
|
-
* @returns Whether the activity is a deadline.
|
|
387
|
-
*/
|
|
388
|
-
isExpired() {
|
|
389
|
-
if (this.toDay && this.toDay <= TimeManager.currentDay) {
|
|
390
|
-
return true;
|
|
391
|
-
}
|
|
392
|
-
return false;
|
|
393
|
-
}
|
|
394
|
-
/**
|
|
395
|
-
* Export the activity properties.
|
|
396
|
-
* @returns The activity properties.
|
|
397
|
-
*/
|
|
398
|
-
export() {
|
|
399
|
-
return {
|
|
400
|
-
name: this.getStorageProperty("name") || this.defaultName,
|
|
401
|
-
fromHour: this.getStorageProperty("fromHour") || this.defaultFromHour,
|
|
402
|
-
toHour: this.getStorageProperty("toHour") || this.defaultToHour,
|
|
403
|
-
fromDay: this.getStorageProperty("fromDay") || this.defaultFromDay,
|
|
404
|
-
toDay: this.getStorageProperty("toDay") || this.defaultToDay,
|
|
405
|
-
disabled: this.getStorageProperty("disabled") || this.defaultDisabled,
|
|
406
|
-
hidden: this.getStorageProperty("hidden") || this.defaultHidden,
|
|
407
|
-
renderIcon: this._renderIcon
|
|
408
|
-
};
|
|
409
|
-
}
|
|
410
|
-
};
|
|
411
265
|
var ActivityModel = class {
|
|
412
266
|
/**
|
|
413
267
|
* @param id The activity id, that must be unique.
|
|
@@ -568,6 +422,7 @@ var CommitmentBaseModel = class extends pixiVn.StoredClassModel {
|
|
|
568
422
|
this._onRun = props.onRun;
|
|
569
423
|
this.defaultDisabled = props.disabled || false;
|
|
570
424
|
this.defaultHidden = props.hidden || false;
|
|
425
|
+
this._renderIcon = props.renderIcon;
|
|
571
426
|
}
|
|
572
427
|
/**
|
|
573
428
|
* The character or characters that are in the commitment and so in the room.
|
|
@@ -648,15 +503,31 @@ var CommitmentBaseModel = class extends pixiVn.StoredClassModel {
|
|
|
648
503
|
get executionType() {
|
|
649
504
|
return this._executionType;
|
|
650
505
|
}
|
|
506
|
+
/**
|
|
507
|
+
* The function for rendering the icon of the commitment.
|
|
508
|
+
*/
|
|
509
|
+
get renderIcon() {
|
|
510
|
+
let render = this._renderIcon;
|
|
511
|
+
if (render === void 0) {
|
|
512
|
+
return void 0;
|
|
513
|
+
}
|
|
514
|
+
if (typeof render === "function") {
|
|
515
|
+
return (props) => {
|
|
516
|
+
return render(this, props);
|
|
517
|
+
};
|
|
518
|
+
}
|
|
519
|
+
return (props) => render;
|
|
520
|
+
}
|
|
651
521
|
/**
|
|
652
522
|
* Is a function that is called when the player interacts with the character.
|
|
653
523
|
*/
|
|
654
524
|
onRun() {
|
|
655
|
-
|
|
525
|
+
let onRun = this._onRun;
|
|
526
|
+
if (!onRun) {
|
|
656
527
|
console.warn("[NQTR] onRun() is not defined for commitmen, so it will not run.", this);
|
|
657
|
-
|
|
658
|
-
this._onRun(this);
|
|
528
|
+
return;
|
|
659
529
|
}
|
|
530
|
+
return (props) => onRun(this, props);
|
|
660
531
|
}
|
|
661
532
|
/**
|
|
662
533
|
* Whether is disabled. You can also pass a Pixi'VN flag name.
|
|
@@ -998,13 +869,13 @@ function getCommitmentById(id) {
|
|
|
998
869
|
}
|
|
999
870
|
function setFixedCommitments(commitments) {
|
|
1000
871
|
if (Array.isArray(commitments)) {
|
|
1001
|
-
commitments.forEach((c) =>
|
|
872
|
+
commitments.forEach((c) => setFixedCommitments(c));
|
|
1002
873
|
return;
|
|
1003
874
|
}
|
|
1004
|
-
if (
|
|
875
|
+
if (fixedCommitments[commitments.id]) {
|
|
1005
876
|
console.warn(`[NQTR] Commitment id ${commitments.id} already exists, it will be overwritten`);
|
|
1006
877
|
}
|
|
1007
|
-
|
|
878
|
+
fixedCommitments[commitments.id] = commitments;
|
|
1008
879
|
}
|
|
1009
880
|
function addTemporaryCommitment(commitment) {
|
|
1010
881
|
if (!Array.isArray(commitment)) {
|
|
@@ -1080,6 +951,152 @@ function getCommitmentByCharacter(character) {
|
|
|
1080
951
|
});
|
|
1081
952
|
return void 0;
|
|
1082
953
|
}
|
|
954
|
+
var ActivityStoredAbstract = class {
|
|
955
|
+
/**
|
|
956
|
+
* @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.
|
|
957
|
+
* @param props The activity properties.
|
|
958
|
+
*/
|
|
959
|
+
constructor(onRun, props) {
|
|
960
|
+
this.defaultName = props.name;
|
|
961
|
+
this.defaultFromHour = props.fromHour;
|
|
962
|
+
this.defaultToHour = props.toHour;
|
|
963
|
+
this.defaultFromDay = props.fromDay;
|
|
964
|
+
this.defaultToDay = props.toDay;
|
|
965
|
+
this.defaultDisabled = props.disabled || false;
|
|
966
|
+
this.defaultHidden = props.hidden || false;
|
|
967
|
+
this._renderIcon = props.renderIcon;
|
|
968
|
+
this._onRun = onRun;
|
|
969
|
+
}
|
|
970
|
+
/**
|
|
971
|
+
* The name
|
|
972
|
+
*/
|
|
973
|
+
get name() {
|
|
974
|
+
return this.getStorageProperty("name") || this.defaultName || "";
|
|
975
|
+
}
|
|
976
|
+
set name(value) {
|
|
977
|
+
this.setStorageProperty("name", value);
|
|
978
|
+
}
|
|
979
|
+
/**
|
|
980
|
+
* The hour when the activity starts. If the activity is not started yet, it will be hidden.
|
|
981
|
+
*/
|
|
982
|
+
get fromHour() {
|
|
983
|
+
return this.getStorageProperty("fromHour") || this.defaultFromHour || TimeManager.minDayHours;
|
|
984
|
+
}
|
|
985
|
+
set fromHour(value) {
|
|
986
|
+
this.setStorageProperty("fromHour", value);
|
|
987
|
+
}
|
|
988
|
+
/**
|
|
989
|
+
* The hour when the activity ends. If the activity is ended yet, it will be hidden.
|
|
990
|
+
*/
|
|
991
|
+
get toHour() {
|
|
992
|
+
return this.getStorageProperty("toHour") || this.defaultToHour || TimeManager.maxDayHours + 1;
|
|
993
|
+
}
|
|
994
|
+
set toHour(value) {
|
|
995
|
+
this.setStorageProperty("toHour", value);
|
|
996
|
+
}
|
|
997
|
+
/**
|
|
998
|
+
* The day when the activity starts. If the activity is not started yet, it will be hidden.
|
|
999
|
+
*/
|
|
1000
|
+
get fromDay() {
|
|
1001
|
+
return this.getStorageProperty("fromDay") || this.defaultFromDay;
|
|
1002
|
+
}
|
|
1003
|
+
set fromDay(value) {
|
|
1004
|
+
this.setStorageProperty("fromDay", value);
|
|
1005
|
+
}
|
|
1006
|
+
/**
|
|
1007
|
+
* The day when the activity ends. If the activity is ended yet, it will be deleted or hidden.
|
|
1008
|
+
*/
|
|
1009
|
+
get toDay() {
|
|
1010
|
+
return this.getStorageProperty("toDay") || this.defaultToDay;
|
|
1011
|
+
}
|
|
1012
|
+
set toDay(value) {
|
|
1013
|
+
this.setStorageProperty("toDay", value);
|
|
1014
|
+
}
|
|
1015
|
+
/**
|
|
1016
|
+
* Whether is disabled.
|
|
1017
|
+
*/
|
|
1018
|
+
get disabled() {
|
|
1019
|
+
let value = this.getStorageProperty("disabled") || this.defaultDisabled;
|
|
1020
|
+
if (typeof value === "string") {
|
|
1021
|
+
return pixiVn.getFlag(value);
|
|
1022
|
+
}
|
|
1023
|
+
return value;
|
|
1024
|
+
}
|
|
1025
|
+
set disabled(value) {
|
|
1026
|
+
this.setStorageProperty("disabled", value);
|
|
1027
|
+
}
|
|
1028
|
+
/**
|
|
1029
|
+
* Whether is hidden. If the activity is not started yet, it will be hidden.
|
|
1030
|
+
*/
|
|
1031
|
+
get hidden() {
|
|
1032
|
+
if (this.fromDay && this.fromDay > TimeManager.currentDay) {
|
|
1033
|
+
return true;
|
|
1034
|
+
}
|
|
1035
|
+
if (!TimeManager.nowIsBetween(this.fromHour, this.toHour)) {
|
|
1036
|
+
return true;
|
|
1037
|
+
}
|
|
1038
|
+
if (!this.isExpired) {
|
|
1039
|
+
return true;
|
|
1040
|
+
}
|
|
1041
|
+
let value = this.getStorageProperty("hidden") || this.defaultHidden;
|
|
1042
|
+
if (typeof value === "string") {
|
|
1043
|
+
return pixiVn.getFlag(value);
|
|
1044
|
+
}
|
|
1045
|
+
return value;
|
|
1046
|
+
}
|
|
1047
|
+
set hidden(value) {
|
|
1048
|
+
this.setStorageProperty("hidden", value);
|
|
1049
|
+
}
|
|
1050
|
+
/**
|
|
1051
|
+
* The function for rendering the icon of the activity.
|
|
1052
|
+
*/
|
|
1053
|
+
get renderIcon() {
|
|
1054
|
+
let render = this._renderIcon;
|
|
1055
|
+
if (render === void 0) {
|
|
1056
|
+
return void 0;
|
|
1057
|
+
}
|
|
1058
|
+
if (typeof render === "function") {
|
|
1059
|
+
return (props) => {
|
|
1060
|
+
return render(this, props);
|
|
1061
|
+
};
|
|
1062
|
+
}
|
|
1063
|
+
return (props) => render;
|
|
1064
|
+
}
|
|
1065
|
+
/**
|
|
1066
|
+
* The function that is called when the activity is runned.
|
|
1067
|
+
*/
|
|
1068
|
+
get onRun() {
|
|
1069
|
+
return (props) => {
|
|
1070
|
+
return this._onRun(this, props);
|
|
1071
|
+
};
|
|
1072
|
+
}
|
|
1073
|
+
/**
|
|
1074
|
+
* Whether the activity is a deadline.
|
|
1075
|
+
* @returns Whether the activity is a deadline.
|
|
1076
|
+
*/
|
|
1077
|
+
isExpired() {
|
|
1078
|
+
if (this.toDay && this.toDay <= TimeManager.currentDay) {
|
|
1079
|
+
return true;
|
|
1080
|
+
}
|
|
1081
|
+
return false;
|
|
1082
|
+
}
|
|
1083
|
+
/**
|
|
1084
|
+
* Export the activity properties.
|
|
1085
|
+
* @returns The activity properties.
|
|
1086
|
+
*/
|
|
1087
|
+
export() {
|
|
1088
|
+
return {
|
|
1089
|
+
name: this.getStorageProperty("name") || this.defaultName,
|
|
1090
|
+
fromHour: this.getStorageProperty("fromHour") || this.defaultFromHour,
|
|
1091
|
+
toHour: this.getStorageProperty("toHour") || this.defaultToHour,
|
|
1092
|
+
fromDay: this.getStorageProperty("fromDay") || this.defaultFromDay,
|
|
1093
|
+
toDay: this.getStorageProperty("toDay") || this.defaultToDay,
|
|
1094
|
+
disabled: this.getStorageProperty("disabled") || this.defaultDisabled,
|
|
1095
|
+
hidden: this.getStorageProperty("hidden") || this.defaultHidden,
|
|
1096
|
+
renderIcon: this._renderIcon
|
|
1097
|
+
};
|
|
1098
|
+
}
|
|
1099
|
+
};
|
|
1083
1100
|
|
|
1084
1101
|
// src/classes/navigation/ActivityRoom.ts
|
|
1085
1102
|
var ActivityRoom = class extends ActivityStoredAbstract {
|
|
@@ -1214,7 +1231,7 @@ var RoomBaseModel = class extends pixiVn.StoredClassModel {
|
|
|
1214
1231
|
get activities() {
|
|
1215
1232
|
let activities = this.activityIds.map((id) => {
|
|
1216
1233
|
return this.getActivity(id);
|
|
1217
|
-
}).filter((activity) => activity !== void 0);
|
|
1234
|
+
}).filter((activity) => activity !== void 0 && !activity.hidden);
|
|
1218
1235
|
return activities;
|
|
1219
1236
|
}
|
|
1220
1237
|
/**
|