@drincs/nqtr 0.1.15 → 0.1.16
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-B1IaFbGD.d.ts +124 -0
- package/dist/ActivityProps-BmIzqtXr.d.mts +124 -0
- package/dist/{index-Cu8ZAiqF.d.ts → Commitment-BjkhJtTx.d.ts} +227 -220
- package/dist/{index-DhsRZJ3g.d.mts → Commitment-BxUQoZST.d.mts} +227 -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 +5 -4
- package/dist/classes/Commitment.js.map +1 -1
- package/dist/classes/Commitment.mjs +5 -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 +868 -5
- package/dist/classes/index.js.map +1 -1
- package/dist/classes/index.mjs +863 -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 +155 -154
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +155 -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 +1 -1
- 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/classes/index.js
CHANGED
|
@@ -2,7 +2,22 @@
|
|
|
2
2
|
|
|
3
3
|
var pixiVn = require('@drincs/pixi-vn');
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
var __defProp = Object.defineProperty;
|
|
6
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
9
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
10
|
+
var __spreadValues = (a, b) => {
|
|
11
|
+
for (var prop in b || (b = {}))
|
|
12
|
+
if (__hasOwnProp.call(b, prop))
|
|
13
|
+
__defNormalProp(a, prop, b[prop]);
|
|
14
|
+
if (__getOwnPropSymbols)
|
|
15
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
16
|
+
if (__propIsEnum.call(b, prop))
|
|
17
|
+
__defNormalProp(a, prop, b[prop]);
|
|
18
|
+
}
|
|
19
|
+
return a;
|
|
20
|
+
};
|
|
6
21
|
var TIME_SETTINGS_KEY = "___nqtr-time_manager_settings___";
|
|
7
22
|
var TIME_DATA_KEY = "___nqtr-time_manager_data___";
|
|
8
23
|
var TimeManager = class _TimeManager {
|
|
@@ -180,7 +195,7 @@ var TimeManager = class _TimeManager {
|
|
|
180
195
|
* Get the current TimeManager.timeSlots index.
|
|
181
196
|
* You can use this property to create "Image that changes based on the time period":
|
|
182
197
|
* @example
|
|
183
|
-
* ```
|
|
198
|
+
* ```tsx
|
|
184
199
|
* import { TimeManager } from '@drincs/nqtr';
|
|
185
200
|
*
|
|
186
201
|
* function changeBackground() {
|
|
@@ -482,11 +497,12 @@ var CommitmentBaseModel = class extends pixiVn.StoredClassModel {
|
|
|
482
497
|
* Is a function that is called when the player interacts with the character.
|
|
483
498
|
*/
|
|
484
499
|
onRun() {
|
|
485
|
-
|
|
500
|
+
let onRun = this._onRun;
|
|
501
|
+
if (!onRun) {
|
|
486
502
|
console.warn("[NQTR] onRun() is not defined for commitmen, so it will not run.", this);
|
|
487
|
-
|
|
488
|
-
this._onRun(this);
|
|
503
|
+
return;
|
|
489
504
|
}
|
|
505
|
+
return (props) => onRun(this, props);
|
|
490
506
|
}
|
|
491
507
|
/**
|
|
492
508
|
* Whether is disabled. You can also pass a Pixi'VN flag name.
|
|
@@ -535,7 +551,854 @@ var CommitmentBaseModel = class extends pixiVn.StoredClassModel {
|
|
|
535
551
|
}
|
|
536
552
|
};
|
|
537
553
|
|
|
554
|
+
// src/decorators/RoomDecorator.ts
|
|
555
|
+
var registeredRooms = {};
|
|
556
|
+
function getRoomsByLocation(location) {
|
|
557
|
+
return Object.values(registeredRooms).filter((room) => room.location.id === location.id);
|
|
558
|
+
}
|
|
559
|
+
function getAllLocations() {
|
|
560
|
+
let result = {};
|
|
561
|
+
Object.values(registeredRooms).forEach((room) => {
|
|
562
|
+
result[room.location.id] = room.location;
|
|
563
|
+
});
|
|
564
|
+
return Object.values(result);
|
|
565
|
+
}
|
|
566
|
+
function getLocationsByMap(map) {
|
|
567
|
+
return getAllLocations().filter((location) => location.map.id === map.id);
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
// src/classes/navigation/Location.ts
|
|
571
|
+
var LOCATION_CATEGORY = "__nqtr-location__";
|
|
572
|
+
var LocationBaseModel = class extends pixiVn.StoredClassModel {
|
|
573
|
+
/**
|
|
574
|
+
* @param id The id of the location, it must be unique.
|
|
575
|
+
* @param map The map where the location is.
|
|
576
|
+
* @param props The properties of the location.
|
|
577
|
+
*/
|
|
578
|
+
constructor(id, map, props = {}) {
|
|
579
|
+
super(LOCATION_CATEGORY, id);
|
|
580
|
+
this.defaultName = props.name || "";
|
|
581
|
+
this.defaultDisabled = props.disabled || false;
|
|
582
|
+
this.defaultHidden = props.hidden || false;
|
|
583
|
+
this._renderIcon = props.renderIcon;
|
|
584
|
+
this._map = map;
|
|
585
|
+
}
|
|
586
|
+
/**
|
|
587
|
+
* The name of the location.
|
|
588
|
+
* If you set undefined, it will return the initial value of name.
|
|
589
|
+
*/
|
|
590
|
+
get name() {
|
|
591
|
+
return this.getStorageProperty("name") || this.defaultName;
|
|
592
|
+
}
|
|
593
|
+
set name(value) {
|
|
594
|
+
this.setStorageProperty("name", value);
|
|
595
|
+
}
|
|
596
|
+
/**
|
|
597
|
+
* Whether is disabled. If it is a string, it is a Pixi'VN flag name.
|
|
598
|
+
*/
|
|
599
|
+
get disabled() {
|
|
600
|
+
let value = this.getStorageProperty("disabled") || this.defaultDisabled;
|
|
601
|
+
if (typeof value === "string") {
|
|
602
|
+
return pixiVn.getFlag(value);
|
|
603
|
+
}
|
|
604
|
+
return value;
|
|
605
|
+
}
|
|
606
|
+
set disabled(value) {
|
|
607
|
+
this.setStorageProperty("disabled", value);
|
|
608
|
+
}
|
|
609
|
+
/**
|
|
610
|
+
* Whether is hidden. If it is a string, it is a Pixi'VN flag name.
|
|
611
|
+
*/
|
|
612
|
+
get hidden() {
|
|
613
|
+
let value = this.getStorageProperty("hidden") || this.defaultHidden;
|
|
614
|
+
if (typeof value === "string") {
|
|
615
|
+
return pixiVn.getFlag(value);
|
|
616
|
+
}
|
|
617
|
+
return value;
|
|
618
|
+
}
|
|
619
|
+
set hidden(value) {
|
|
620
|
+
this.setStorageProperty("hidden", value);
|
|
621
|
+
}
|
|
622
|
+
/**
|
|
623
|
+
* The function for rendering the icon of the location.
|
|
624
|
+
*/
|
|
625
|
+
get renderIcon() {
|
|
626
|
+
let render = this._renderIcon;
|
|
627
|
+
if (render === void 0) {
|
|
628
|
+
return void 0;
|
|
629
|
+
}
|
|
630
|
+
if (typeof render === "function") {
|
|
631
|
+
return (props) => {
|
|
632
|
+
return render(this, props);
|
|
633
|
+
};
|
|
634
|
+
}
|
|
635
|
+
return (props) => render;
|
|
636
|
+
}
|
|
637
|
+
/**
|
|
638
|
+
* The map where the location is.
|
|
639
|
+
*/
|
|
640
|
+
get map() {
|
|
641
|
+
return this._map;
|
|
642
|
+
}
|
|
643
|
+
/**
|
|
644
|
+
* Get the entrance room of the location.
|
|
645
|
+
* You can cast the room to a specific type that extends RoomBaseModel.
|
|
646
|
+
* @returns The entrance room or the first room if there is no entrance.
|
|
647
|
+
* @example
|
|
648
|
+
* ```typescript
|
|
649
|
+
* const entranceHome = new RoomBaseModel("entrance-home", home, { isEntrance: true })
|
|
650
|
+
* saveRoom(entranceHome)
|
|
651
|
+
* const home = new LocationBaseModel("home", map, { name: "Home" })
|
|
652
|
+
*
|
|
653
|
+
* const entrance = home.getEntrance() // entrance === entranceHome
|
|
654
|
+
* ```
|
|
655
|
+
*/
|
|
656
|
+
getEntrance() {
|
|
657
|
+
let rooms = this.getRooms();
|
|
658
|
+
if (rooms.length === 0) {
|
|
659
|
+
console.error(`[NQTR] The location ${this.id} has no rooms`);
|
|
660
|
+
return;
|
|
661
|
+
}
|
|
662
|
+
return rooms.find((room) => room.isEntrance) || rooms[0];
|
|
663
|
+
}
|
|
664
|
+
/**
|
|
665
|
+
* Get all rooms in the location.
|
|
666
|
+
* You can cast the rooms to a specific type that extends RoomBaseModel.
|
|
667
|
+
* @returns The rooms in the location.
|
|
668
|
+
*/
|
|
669
|
+
getRooms() {
|
|
670
|
+
return getRoomsByLocation(this);
|
|
671
|
+
}
|
|
672
|
+
};
|
|
673
|
+
var MAP_CATEGORY = "__nqtr-map__";
|
|
674
|
+
var MapBaseModel = class extends pixiVn.StoredClassModel {
|
|
675
|
+
/**
|
|
676
|
+
* @param id The id of the map, it must be unique.
|
|
677
|
+
* @param props The properties of the map.
|
|
678
|
+
*/
|
|
679
|
+
constructor(id, props = {}) {
|
|
680
|
+
super(MAP_CATEGORY, id);
|
|
681
|
+
this.defaultName = props.name || "";
|
|
682
|
+
this._renderImage = props.renderImage;
|
|
683
|
+
this.defaultDisabled = props.disabled || false;
|
|
684
|
+
this.defaultHidden = props.hidden || false;
|
|
685
|
+
}
|
|
686
|
+
/**
|
|
687
|
+
* The name of the map.
|
|
688
|
+
* If you set undefined, it will return the initial value of name.
|
|
689
|
+
*/
|
|
690
|
+
get name() {
|
|
691
|
+
return this.getStorageProperty("name") || this.defaultName;
|
|
692
|
+
}
|
|
693
|
+
set name(value) {
|
|
694
|
+
this.setStorageProperty("name", value);
|
|
695
|
+
}
|
|
696
|
+
/**
|
|
697
|
+
* The function for rendering the image of the map.
|
|
698
|
+
*/
|
|
699
|
+
get renderImage() {
|
|
700
|
+
let render = this._renderImage;
|
|
701
|
+
if (render === void 0) {
|
|
702
|
+
return void 0;
|
|
703
|
+
}
|
|
704
|
+
if (typeof render === "function") {
|
|
705
|
+
return (props) => {
|
|
706
|
+
return render(this, props);
|
|
707
|
+
};
|
|
708
|
+
}
|
|
709
|
+
return (props) => render;
|
|
710
|
+
}
|
|
711
|
+
/**
|
|
712
|
+
* Whether is disabled. If it is a string, it is a Pixi'VN flag name.
|
|
713
|
+
*/
|
|
714
|
+
get disabled() {
|
|
715
|
+
let value = this.getStorageProperty("disabled") || this.defaultDisabled;
|
|
716
|
+
if (typeof value === "string") {
|
|
717
|
+
return pixiVn.getFlag(value);
|
|
718
|
+
}
|
|
719
|
+
return value;
|
|
720
|
+
}
|
|
721
|
+
set disabled(value) {
|
|
722
|
+
this.setStorageProperty("disabled", value);
|
|
723
|
+
}
|
|
724
|
+
/**
|
|
725
|
+
* Whether is hidden. If it is a string, it is a Pixi'VN flag name.
|
|
726
|
+
*/
|
|
727
|
+
get hidden() {
|
|
728
|
+
let value = this.getStorageProperty("hidden") || this.defaultHidden;
|
|
729
|
+
if (typeof value === "string") {
|
|
730
|
+
return pixiVn.getFlag(value);
|
|
731
|
+
}
|
|
732
|
+
return value;
|
|
733
|
+
}
|
|
734
|
+
set hidden(value) {
|
|
735
|
+
this.setStorageProperty("hidden", value);
|
|
736
|
+
}
|
|
737
|
+
/**
|
|
738
|
+
* The neighboring maps that are available in this map.
|
|
739
|
+
* @example
|
|
740
|
+
* ```ts
|
|
741
|
+
* {
|
|
742
|
+
* "north": "atlanta_map_id",
|
|
743
|
+
* "south": "miami_map_id",
|
|
744
|
+
* "east": "new_york_map_id",
|
|
745
|
+
* "west": "los_angeles_map_id"
|
|
746
|
+
* }
|
|
747
|
+
* ```
|
|
748
|
+
*/
|
|
749
|
+
get neighboringMaps() {
|
|
750
|
+
return this._neighboringMaps || {};
|
|
751
|
+
}
|
|
752
|
+
set neighboringMaps(value) {
|
|
753
|
+
this._neighboringMaps = value;
|
|
754
|
+
}
|
|
755
|
+
/**
|
|
756
|
+
* Get all locations in the map.
|
|
757
|
+
* @returns The locations in the map.
|
|
758
|
+
*/
|
|
759
|
+
getLocations() {
|
|
760
|
+
return getLocationsByMap(this);
|
|
761
|
+
}
|
|
762
|
+
};
|
|
763
|
+
|
|
764
|
+
// src/decorators/ActivityDecorator.ts
|
|
765
|
+
var registeredActivities = {};
|
|
766
|
+
function getActivityById(id) {
|
|
767
|
+
try {
|
|
768
|
+
let activity = registeredActivities[id];
|
|
769
|
+
if (!activity) {
|
|
770
|
+
console.error(`[NQTR] Activity ${id} not found`);
|
|
771
|
+
return;
|
|
772
|
+
}
|
|
773
|
+
return activity;
|
|
774
|
+
} catch (e) {
|
|
775
|
+
console.error(`[NQTR] Error while getting Activity ${id}`, e);
|
|
776
|
+
return;
|
|
777
|
+
}
|
|
778
|
+
}
|
|
779
|
+
var TEMPORARY_COMMITMENT_CATEGORY_MEMORY_KEY = "___nqtr-temporary_commitment___";
|
|
780
|
+
var registeredCommitments = {};
|
|
781
|
+
var fixedCommitments = {};
|
|
782
|
+
function getCommitmentById(id) {
|
|
783
|
+
try {
|
|
784
|
+
let commitment = registeredCommitments[id];
|
|
785
|
+
if (!commitment) {
|
|
786
|
+
console.error(`[NQTR] Commitment ${id} not found`);
|
|
787
|
+
return;
|
|
788
|
+
}
|
|
789
|
+
return commitment;
|
|
790
|
+
} catch (e) {
|
|
791
|
+
console.error(`[NQTR] Error while getting Commitment ${id}`, e);
|
|
792
|
+
return;
|
|
793
|
+
}
|
|
794
|
+
}
|
|
795
|
+
function getFixedCommitments() {
|
|
796
|
+
return Object.values(fixedCommitments);
|
|
797
|
+
}
|
|
798
|
+
function getTemporaryCommitments() {
|
|
799
|
+
let commitmentsIds = pixiVn.GameStorageManager.getVariable(TEMPORARY_COMMITMENT_CATEGORY_MEMORY_KEY);
|
|
800
|
+
if (!commitmentsIds) {
|
|
801
|
+
return [];
|
|
802
|
+
}
|
|
803
|
+
let commitments = commitmentsIds.map((id) => getCommitmentById(id)).filter((commitment) => commitment !== void 0);
|
|
804
|
+
return commitments;
|
|
805
|
+
}
|
|
806
|
+
|
|
807
|
+
// src/functions/RoutineFunctions.ts
|
|
808
|
+
function getCurrentCommitments() {
|
|
809
|
+
let character_commitments = {};
|
|
810
|
+
let oltherCommitments = [];
|
|
811
|
+
getTemporaryCommitments().reverse().forEach((c) => {
|
|
812
|
+
if (!c.hidden) {
|
|
813
|
+
if (c.characters.length > 1) {
|
|
814
|
+
let allAvailable = c.characters.every((ch) => !character_commitments[ch.id]);
|
|
815
|
+
if (allAvailable) {
|
|
816
|
+
c.characters.forEach((ch) => {
|
|
817
|
+
character_commitments[ch.id] = c;
|
|
818
|
+
});
|
|
819
|
+
}
|
|
820
|
+
} else {
|
|
821
|
+
oltherCommitments.push(c);
|
|
822
|
+
}
|
|
823
|
+
}
|
|
824
|
+
});
|
|
825
|
+
getFixedCommitments().reverse().forEach((c) => {
|
|
826
|
+
if (!c.hidden) {
|
|
827
|
+
if (c.characters.length > 1) {
|
|
828
|
+
c.characters.forEach((ch) => {
|
|
829
|
+
if (!character_commitments[ch.id]) {
|
|
830
|
+
character_commitments[ch.id] = c;
|
|
831
|
+
}
|
|
832
|
+
});
|
|
833
|
+
} else {
|
|
834
|
+
oltherCommitments.push(c);
|
|
835
|
+
}
|
|
836
|
+
}
|
|
837
|
+
});
|
|
838
|
+
return Object.values(character_commitments).concat(oltherCommitments);
|
|
839
|
+
}
|
|
840
|
+
var ActivityStoredAbstract = class {
|
|
841
|
+
/**
|
|
842
|
+
* @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.
|
|
843
|
+
* @param props The activity properties.
|
|
844
|
+
*/
|
|
845
|
+
constructor(onRun, props) {
|
|
846
|
+
this.defaultName = props.name;
|
|
847
|
+
this.defaultFromHour = props.fromHour;
|
|
848
|
+
this.defaultToHour = props.toHour;
|
|
849
|
+
this.defaultFromDay = props.fromDay;
|
|
850
|
+
this.defaultToDay = props.toDay;
|
|
851
|
+
this.defaultDisabled = props.disabled || false;
|
|
852
|
+
this.defaultHidden = props.hidden || false;
|
|
853
|
+
this._renderIcon = props.renderIcon;
|
|
854
|
+
this._onRun = onRun;
|
|
855
|
+
}
|
|
856
|
+
/**
|
|
857
|
+
* The name
|
|
858
|
+
*/
|
|
859
|
+
get name() {
|
|
860
|
+
return this.getStorageProperty("name") || this.defaultName || "";
|
|
861
|
+
}
|
|
862
|
+
set name(value) {
|
|
863
|
+
this.setStorageProperty("name", value);
|
|
864
|
+
}
|
|
865
|
+
/**
|
|
866
|
+
* The hour when the activity starts. If the activity is not started yet, it will be hidden.
|
|
867
|
+
*/
|
|
868
|
+
get fromHour() {
|
|
869
|
+
return this.getStorageProperty("fromHour") || this.defaultFromHour || TimeManager.minDayHours;
|
|
870
|
+
}
|
|
871
|
+
set fromHour(value) {
|
|
872
|
+
this.setStorageProperty("fromHour", value);
|
|
873
|
+
}
|
|
874
|
+
/**
|
|
875
|
+
* The hour when the activity ends. If the activity is ended yet, it will be hidden.
|
|
876
|
+
*/
|
|
877
|
+
get toHour() {
|
|
878
|
+
return this.getStorageProperty("toHour") || this.defaultToHour || TimeManager.maxDayHours + 1;
|
|
879
|
+
}
|
|
880
|
+
set toHour(value) {
|
|
881
|
+
this.setStorageProperty("toHour", value);
|
|
882
|
+
}
|
|
883
|
+
/**
|
|
884
|
+
* The day when the activity starts. If the activity is not started yet, it will be hidden.
|
|
885
|
+
*/
|
|
886
|
+
get fromDay() {
|
|
887
|
+
return this.getStorageProperty("fromDay") || this.defaultFromDay;
|
|
888
|
+
}
|
|
889
|
+
set fromDay(value) {
|
|
890
|
+
this.setStorageProperty("fromDay", value);
|
|
891
|
+
}
|
|
892
|
+
/**
|
|
893
|
+
* The day when the activity ends. If the activity is ended yet, it will be deleted or hidden.
|
|
894
|
+
*/
|
|
895
|
+
get toDay() {
|
|
896
|
+
return this.getStorageProperty("toDay") || this.defaultToDay;
|
|
897
|
+
}
|
|
898
|
+
set toDay(value) {
|
|
899
|
+
this.setStorageProperty("toDay", value);
|
|
900
|
+
}
|
|
901
|
+
/**
|
|
902
|
+
* Whether is disabled.
|
|
903
|
+
*/
|
|
904
|
+
get disabled() {
|
|
905
|
+
let value = this.getStorageProperty("disabled") || this.defaultDisabled;
|
|
906
|
+
if (typeof value === "string") {
|
|
907
|
+
return pixiVn.getFlag(value);
|
|
908
|
+
}
|
|
909
|
+
return value;
|
|
910
|
+
}
|
|
911
|
+
set disabled(value) {
|
|
912
|
+
this.setStorageProperty("disabled", value);
|
|
913
|
+
}
|
|
914
|
+
/**
|
|
915
|
+
* Whether is hidden. If the activity is not started yet, it will be hidden.
|
|
916
|
+
*/
|
|
917
|
+
get hidden() {
|
|
918
|
+
if (this.fromDay && this.fromDay > TimeManager.currentDay) {
|
|
919
|
+
return true;
|
|
920
|
+
}
|
|
921
|
+
if (!TimeManager.nowIsBetween(this.fromHour, this.toHour)) {
|
|
922
|
+
return true;
|
|
923
|
+
}
|
|
924
|
+
if (!this.isExpired) {
|
|
925
|
+
return true;
|
|
926
|
+
}
|
|
927
|
+
let value = this.getStorageProperty("hidden") || this.defaultHidden;
|
|
928
|
+
if (typeof value === "string") {
|
|
929
|
+
return pixiVn.getFlag(value);
|
|
930
|
+
}
|
|
931
|
+
return value;
|
|
932
|
+
}
|
|
933
|
+
set hidden(value) {
|
|
934
|
+
this.setStorageProperty("hidden", value);
|
|
935
|
+
}
|
|
936
|
+
/**
|
|
937
|
+
* The function for rendering the icon of the activity.
|
|
938
|
+
*/
|
|
939
|
+
get renderIcon() {
|
|
940
|
+
let render = this._renderIcon;
|
|
941
|
+
if (render === void 0) {
|
|
942
|
+
return void 0;
|
|
943
|
+
}
|
|
944
|
+
if (typeof render === "function") {
|
|
945
|
+
return (props) => {
|
|
946
|
+
return render(this, props);
|
|
947
|
+
};
|
|
948
|
+
}
|
|
949
|
+
return (props) => render;
|
|
950
|
+
}
|
|
951
|
+
/**
|
|
952
|
+
* The function that is called when the activity is runned.
|
|
953
|
+
*/
|
|
954
|
+
get onRun() {
|
|
955
|
+
return (props) => {
|
|
956
|
+
return this._onRun(this, props);
|
|
957
|
+
};
|
|
958
|
+
}
|
|
959
|
+
/**
|
|
960
|
+
* Whether the activity is a deadline.
|
|
961
|
+
* @returns Whether the activity is a deadline.
|
|
962
|
+
*/
|
|
963
|
+
isExpired() {
|
|
964
|
+
if (this.toDay && this.toDay <= TimeManager.currentDay) {
|
|
965
|
+
return true;
|
|
966
|
+
}
|
|
967
|
+
return false;
|
|
968
|
+
}
|
|
969
|
+
/**
|
|
970
|
+
* Export the activity properties.
|
|
971
|
+
* @returns The activity properties.
|
|
972
|
+
*/
|
|
973
|
+
export() {
|
|
974
|
+
return {
|
|
975
|
+
name: this.getStorageProperty("name") || this.defaultName,
|
|
976
|
+
fromHour: this.getStorageProperty("fromHour") || this.defaultFromHour,
|
|
977
|
+
toHour: this.getStorageProperty("toHour") || this.defaultToHour,
|
|
978
|
+
fromDay: this.getStorageProperty("fromDay") || this.defaultFromDay,
|
|
979
|
+
toDay: this.getStorageProperty("toDay") || this.defaultToDay,
|
|
980
|
+
disabled: this.getStorageProperty("disabled") || this.defaultDisabled,
|
|
981
|
+
hidden: this.getStorageProperty("hidden") || this.defaultHidden,
|
|
982
|
+
renderIcon: this._renderIcon
|
|
983
|
+
};
|
|
984
|
+
}
|
|
985
|
+
};
|
|
986
|
+
|
|
987
|
+
// src/classes/navigation/ActivityRoom.ts
|
|
988
|
+
var ActivityRoom = class extends ActivityStoredAbstract {
|
|
989
|
+
constructor(id, room, onRun, props) {
|
|
990
|
+
super(onRun, props);
|
|
991
|
+
this._id = id;
|
|
992
|
+
this._room = room;
|
|
993
|
+
}
|
|
994
|
+
setStorageProperty(_, __) {
|
|
995
|
+
this._room.setActivity(this);
|
|
996
|
+
}
|
|
997
|
+
getStorageProperty(propertyName) {
|
|
998
|
+
let activity = this._room.getActivityMemory(this.id);
|
|
999
|
+
if (!activity || !activity.hasOwnProperty(propertyName)) {
|
|
1000
|
+
return void 0;
|
|
1001
|
+
}
|
|
1002
|
+
return activity[propertyName];
|
|
1003
|
+
}
|
|
1004
|
+
get id() {
|
|
1005
|
+
return this._id;
|
|
1006
|
+
}
|
|
1007
|
+
get room() {
|
|
1008
|
+
return this._room;
|
|
1009
|
+
}
|
|
1010
|
+
export() {
|
|
1011
|
+
let result = {};
|
|
1012
|
+
if (this.name !== void 0) {
|
|
1013
|
+
result["name"] = this.name;
|
|
1014
|
+
}
|
|
1015
|
+
if (this.fromHour !== void 0) {
|
|
1016
|
+
result["fromHour"] = this.fromHour;
|
|
1017
|
+
}
|
|
1018
|
+
if (this.toHour !== void 0) {
|
|
1019
|
+
result["toHour"] = this.toHour;
|
|
1020
|
+
}
|
|
1021
|
+
if (this.fromDay !== void 0) {
|
|
1022
|
+
result["fromDay"] = this.fromDay;
|
|
1023
|
+
}
|
|
1024
|
+
if (this.toDay !== void 0) {
|
|
1025
|
+
result["toDay"] = this.toDay;
|
|
1026
|
+
}
|
|
1027
|
+
if (this.disabled !== void 0) {
|
|
1028
|
+
result["disabled"] = this.disabled;
|
|
1029
|
+
}
|
|
1030
|
+
return result;
|
|
1031
|
+
}
|
|
1032
|
+
};
|
|
1033
|
+
|
|
1034
|
+
// src/classes/navigation/Room.ts
|
|
1035
|
+
var ROOM_CATEGORY = "__nqtr-room__";
|
|
1036
|
+
var RoomBaseModel = class extends pixiVn.StoredClassModel {
|
|
1037
|
+
/**
|
|
1038
|
+
* @param id The id of the room, it must be unique.
|
|
1039
|
+
* @param location The location where the room is.
|
|
1040
|
+
* @param props The properties of the room.
|
|
1041
|
+
*/
|
|
1042
|
+
constructor(id, location, props = {}) {
|
|
1043
|
+
var _a;
|
|
1044
|
+
super(ROOM_CATEGORY, id);
|
|
1045
|
+
this._location = location;
|
|
1046
|
+
this.defaultName = props.name || "";
|
|
1047
|
+
this._renderImage = props.renderImage;
|
|
1048
|
+
this.defaultActivityIds = ((_a = props.defaultActivities) == null ? void 0 : _a.map((activity) => activity.id)) || [];
|
|
1049
|
+
this.defaultDisabled = props.disabled || false;
|
|
1050
|
+
this.defaultHidden = props.hidden || false;
|
|
1051
|
+
this._renderIcon = props.renderIcon;
|
|
1052
|
+
this._isEntrance = props.isEntrance;
|
|
1053
|
+
}
|
|
1054
|
+
/**
|
|
1055
|
+
* The location where the room is.
|
|
1056
|
+
*/
|
|
1057
|
+
get location() {
|
|
1058
|
+
return this._location;
|
|
1059
|
+
}
|
|
1060
|
+
/**
|
|
1061
|
+
* Whether is an entrance room, so when the player enters in the location, it will be the first room to be shown.
|
|
1062
|
+
*/
|
|
1063
|
+
get isEntrance() {
|
|
1064
|
+
return this._isEntrance || false;
|
|
1065
|
+
}
|
|
1066
|
+
/**
|
|
1067
|
+
* The name.
|
|
1068
|
+
* If you set undefined, it will return the initial value of name.
|
|
1069
|
+
*/
|
|
1070
|
+
get name() {
|
|
1071
|
+
return this.getStorageProperty("name") || this.defaultName;
|
|
1072
|
+
}
|
|
1073
|
+
set name(value) {
|
|
1074
|
+
this.setStorageProperty("name", value);
|
|
1075
|
+
}
|
|
1076
|
+
/**
|
|
1077
|
+
* The function for rendering the image of the room.
|
|
1078
|
+
*/
|
|
1079
|
+
get renderImage() {
|
|
1080
|
+
let render = this._renderImage;
|
|
1081
|
+
if (render === void 0) {
|
|
1082
|
+
return void 0;
|
|
1083
|
+
}
|
|
1084
|
+
if (typeof render === "function") {
|
|
1085
|
+
return (props) => {
|
|
1086
|
+
return render(this, props);
|
|
1087
|
+
};
|
|
1088
|
+
}
|
|
1089
|
+
return (props) => render;
|
|
1090
|
+
}
|
|
1091
|
+
/**
|
|
1092
|
+
* The activities that are available in this room.
|
|
1093
|
+
*/
|
|
1094
|
+
get defaultActivities() {
|
|
1095
|
+
let roomMemories = this.getStorageProperty("activities_memory") || {};
|
|
1096
|
+
let activities = this.defaultActivityIds.map((id) => {
|
|
1097
|
+
let activity = getActivityById(id);
|
|
1098
|
+
if (!activity) {
|
|
1099
|
+
console.warn(`[NQTR] Activity with id ${id} not found, so it will be ignored.`);
|
|
1100
|
+
return void 0;
|
|
1101
|
+
}
|
|
1102
|
+
let memory = activity.export();
|
|
1103
|
+
if (roomMemories && roomMemories[id]) {
|
|
1104
|
+
memory = __spreadValues(__spreadValues({}, memory), roomMemories[id]);
|
|
1105
|
+
}
|
|
1106
|
+
return new ActivityRoom(id, this, activity._initialOnRun, memory);
|
|
1107
|
+
}).filter((activity) => activity !== void 0);
|
|
1108
|
+
return activities;
|
|
1109
|
+
}
|
|
1110
|
+
get activityIds() {
|
|
1111
|
+
let addedActivityIds = this.getStorageProperty(`addedActivityIds`) || [];
|
|
1112
|
+
return this.defaultActivityIds.concat(addedActivityIds);
|
|
1113
|
+
}
|
|
1114
|
+
/**
|
|
1115
|
+
* The activities that are available in this room.
|
|
1116
|
+
*/
|
|
1117
|
+
get activities() {
|
|
1118
|
+
let activities = this.activityIds.map((id) => {
|
|
1119
|
+
return this.getActivity(id);
|
|
1120
|
+
}).filter((activity) => activity !== void 0 && !activity.hidden);
|
|
1121
|
+
return activities;
|
|
1122
|
+
}
|
|
1123
|
+
/**
|
|
1124
|
+
* Get the memory of an activity. This function can be used into olther libraries to get the memory of the activity.
|
|
1125
|
+
* @param id The id of the activity.
|
|
1126
|
+
* @returns The memory of the activity.
|
|
1127
|
+
*/
|
|
1128
|
+
getActivityMemory(id) {
|
|
1129
|
+
let roomMemories = this.getStorageProperty("activities_memory") || {};
|
|
1130
|
+
let roomMemory = roomMemories[id] || {};
|
|
1131
|
+
return roomMemory;
|
|
1132
|
+
}
|
|
1133
|
+
/**
|
|
1134
|
+
* Get the activity by id.
|
|
1135
|
+
* @param id The id of the activity.
|
|
1136
|
+
* @returns The room activity.
|
|
1137
|
+
*/
|
|
1138
|
+
getActivity(id) {
|
|
1139
|
+
if (!this.activityIds.includes(id)) {
|
|
1140
|
+
console.error(`[NQTR] Activity with id ${id} not found in room ${this.id}`);
|
|
1141
|
+
return void 0;
|
|
1142
|
+
}
|
|
1143
|
+
let activity = getActivityById(id);
|
|
1144
|
+
if (!activity) {
|
|
1145
|
+
console.error(`[NQTR] Activity with id ${id} not found`);
|
|
1146
|
+
return void 0;
|
|
1147
|
+
}
|
|
1148
|
+
let roomMemories = this.getStorageProperty("activities_memory") || {};
|
|
1149
|
+
let roomMemory = roomMemories[id] || {};
|
|
1150
|
+
roomMemory = __spreadValues(__spreadValues({}, activity.export()), roomMemory);
|
|
1151
|
+
return new ActivityRoom(id, this, activity._initialOnRun, roomMemory);
|
|
1152
|
+
}
|
|
1153
|
+
/**
|
|
1154
|
+
* Set the memory of an activity. This function can be used into olther libraries to set the memory of the activity.
|
|
1155
|
+
* @param id The id of the activity.
|
|
1156
|
+
* @param memory The memory of the activity.
|
|
1157
|
+
*/
|
|
1158
|
+
setActivity(activity) {
|
|
1159
|
+
let roomMemories = this.getStorageProperty("activities_memory") || {};
|
|
1160
|
+
roomMemories[activity.id] = activity.export();
|
|
1161
|
+
this.setStorageProperty("activities_memory", roomMemories);
|
|
1162
|
+
}
|
|
1163
|
+
/**
|
|
1164
|
+
* Add an activity to the room.
|
|
1165
|
+
* @param activity The activity to add.
|
|
1166
|
+
*/
|
|
1167
|
+
addActivity(activity) {
|
|
1168
|
+
if (this.activityIds.includes(activity.id)) {
|
|
1169
|
+
let currentActivity = this.getActivity(activity.id);
|
|
1170
|
+
if (currentActivity && currentActivity.isExpired()) {
|
|
1171
|
+
this.removeActivity(activity.id);
|
|
1172
|
+
return;
|
|
1173
|
+
} else {
|
|
1174
|
+
console.error(`[NQTR] Activity with id ${activity.id} already exists in room ${this.id}, so it will be ignored.`);
|
|
1175
|
+
return;
|
|
1176
|
+
}
|
|
1177
|
+
}
|
|
1178
|
+
let addedActivityIds = this.getStorageProperty(`addedActivityIds`) || [];
|
|
1179
|
+
addedActivityIds.push(activity.id);
|
|
1180
|
+
this.setStorageProperty("addedActivityIds", addedActivityIds);
|
|
1181
|
+
}
|
|
1182
|
+
/**
|
|
1183
|
+
* Remove an activity from the room.
|
|
1184
|
+
* @param activity The activity to remove.
|
|
1185
|
+
*/
|
|
1186
|
+
removeActivity(activity) {
|
|
1187
|
+
let activityId = typeof activity === "string" ? activity : activity.id;
|
|
1188
|
+
if (this.defaultActivityIds.includes(activityId)) {
|
|
1189
|
+
console.warn(`[NQTR] Activity with id ${activityId} is a default activity, so it can't be removed. It will be hidden instead.`);
|
|
1190
|
+
let activityToEdit = this.getActivity(activityId);
|
|
1191
|
+
if (!activityToEdit) {
|
|
1192
|
+
console.error(`[NQTR] Activity with id ${activityId} not found, so it can't be hidden.`);
|
|
1193
|
+
return;
|
|
1194
|
+
}
|
|
1195
|
+
activityToEdit.hidden = true;
|
|
1196
|
+
return;
|
|
1197
|
+
}
|
|
1198
|
+
let addedActivityIds = this.getStorageProperty(`addedActivityIds`) || [];
|
|
1199
|
+
let index = addedActivityIds.indexOf(activityId);
|
|
1200
|
+
if (index === -1) {
|
|
1201
|
+
console.error(`[NQTR] Activity with id ${activityId} not found, so it can't be removed.`);
|
|
1202
|
+
return;
|
|
1203
|
+
}
|
|
1204
|
+
addedActivityIds.splice(index, 1);
|
|
1205
|
+
this.setStorageProperty("addedActivityIds", addedActivityIds);
|
|
1206
|
+
let roomMemories = this.getStorageProperty("activities_memory") || {};
|
|
1207
|
+
delete roomMemories[activityId];
|
|
1208
|
+
this.setStorageProperty("activities_memory", roomMemories);
|
|
1209
|
+
}
|
|
1210
|
+
/**
|
|
1211
|
+
* Clear all expired activities.
|
|
1212
|
+
*/
|
|
1213
|
+
clearExpiredActivities() {
|
|
1214
|
+
this.activities.forEach((activity) => {
|
|
1215
|
+
if (activity.isExpired()) {
|
|
1216
|
+
this.removeActivity(activity.id);
|
|
1217
|
+
}
|
|
1218
|
+
});
|
|
1219
|
+
}
|
|
1220
|
+
/**
|
|
1221
|
+
* Whether is disabled. If it is a string, it is a Pixi'VN flag name.
|
|
1222
|
+
*/
|
|
1223
|
+
get disabled() {
|
|
1224
|
+
let value = this.getStorageProperty("disabled") || this.defaultDisabled;
|
|
1225
|
+
if (typeof value === "string") {
|
|
1226
|
+
return pixiVn.getFlag(value);
|
|
1227
|
+
}
|
|
1228
|
+
return value;
|
|
1229
|
+
}
|
|
1230
|
+
set disabled(value) {
|
|
1231
|
+
this.setStorageProperty("disabled", value);
|
|
1232
|
+
}
|
|
1233
|
+
/**
|
|
1234
|
+
* Whether is hidden. If it is a string, it is a Pixi'VN flag name.
|
|
1235
|
+
*/
|
|
1236
|
+
get hidden() {
|
|
1237
|
+
let value = this.getStorageProperty("hidden") || this.defaultHidden;
|
|
1238
|
+
if (typeof value === "string") {
|
|
1239
|
+
return pixiVn.getFlag(value);
|
|
1240
|
+
}
|
|
1241
|
+
return value;
|
|
1242
|
+
}
|
|
1243
|
+
set hidden(value) {
|
|
1244
|
+
this.setStorageProperty("hidden", value);
|
|
1245
|
+
}
|
|
1246
|
+
/**
|
|
1247
|
+
* The function for rendering the icon of the room.
|
|
1248
|
+
*/
|
|
1249
|
+
get renderIcon() {
|
|
1250
|
+
let render = this._renderIcon;
|
|
1251
|
+
if (render === void 0) {
|
|
1252
|
+
return void 0;
|
|
1253
|
+
}
|
|
1254
|
+
if (typeof render === "function") {
|
|
1255
|
+
return (props) => {
|
|
1256
|
+
return render(this, props);
|
|
1257
|
+
};
|
|
1258
|
+
}
|
|
1259
|
+
return (props) => render;
|
|
1260
|
+
}
|
|
1261
|
+
/**
|
|
1262
|
+
* Get the character commitments of the room.
|
|
1263
|
+
* @returns The character commitments of the room.
|
|
1264
|
+
*/
|
|
1265
|
+
getRoutine() {
|
|
1266
|
+
let commitments = getCurrentCommitments();
|
|
1267
|
+
return commitments.filter((c) => c.room.id === this.id);
|
|
1268
|
+
}
|
|
1269
|
+
};
|
|
1270
|
+
|
|
1271
|
+
// src/classes/quest/Goal.ts
|
|
1272
|
+
var Goal = class {
|
|
1273
|
+
constructor(props) {
|
|
1274
|
+
this._description = props.description;
|
|
1275
|
+
this.need = props.need || 1;
|
|
1276
|
+
this.have = props.have || 0;
|
|
1277
|
+
}
|
|
1278
|
+
get description() {
|
|
1279
|
+
return this._description;
|
|
1280
|
+
}
|
|
1281
|
+
get isComplete() {
|
|
1282
|
+
return this.have >= this.need;
|
|
1283
|
+
}
|
|
1284
|
+
setComplete() {
|
|
1285
|
+
this.have = this.need;
|
|
1286
|
+
}
|
|
1287
|
+
find() {
|
|
1288
|
+
this.have++;
|
|
1289
|
+
}
|
|
1290
|
+
get export() {
|
|
1291
|
+
return {
|
|
1292
|
+
description: this.description,
|
|
1293
|
+
need: this.need,
|
|
1294
|
+
have: this.have
|
|
1295
|
+
};
|
|
1296
|
+
}
|
|
1297
|
+
};
|
|
1298
|
+
var QUEST_CATEGORY = "__nqtr-quest__";
|
|
1299
|
+
var QuestBaseModel = class extends pixiVn.StoredClassModel {
|
|
1300
|
+
constructor(id, stages, props) {
|
|
1301
|
+
super(QUEST_CATEGORY, id);
|
|
1302
|
+
this._stages = stages;
|
|
1303
|
+
this._name = props.name || "";
|
|
1304
|
+
this._description = props.description || "";
|
|
1305
|
+
this._icon = props.icon || "";
|
|
1306
|
+
this._image = props.image || "";
|
|
1307
|
+
this._isInDevelopment = props.isInDevelopment || false;
|
|
1308
|
+
}
|
|
1309
|
+
get stages() {
|
|
1310
|
+
return this._stages;
|
|
1311
|
+
}
|
|
1312
|
+
get name() {
|
|
1313
|
+
return this._name;
|
|
1314
|
+
}
|
|
1315
|
+
get description() {
|
|
1316
|
+
return this._description;
|
|
1317
|
+
}
|
|
1318
|
+
get icon() {
|
|
1319
|
+
return this._icon;
|
|
1320
|
+
}
|
|
1321
|
+
get image() {
|
|
1322
|
+
return this._image;
|
|
1323
|
+
}
|
|
1324
|
+
get isInDevelopment() {
|
|
1325
|
+
return this._isInDevelopment;
|
|
1326
|
+
}
|
|
1327
|
+
};
|
|
1328
|
+
var STAGE_CATEGORY = "__nqtr-stage__";
|
|
1329
|
+
var StageBaseModel = class extends pixiVn.StoredClassModel {
|
|
1330
|
+
constructor(id, props) {
|
|
1331
|
+
super(STAGE_CATEGORY, id);
|
|
1332
|
+
this._completed = false;
|
|
1333
|
+
this._active = false;
|
|
1334
|
+
this.defaultGoals = [];
|
|
1335
|
+
this._name = props.name || "";
|
|
1336
|
+
this._description = props.description || "";
|
|
1337
|
+
this._adviceDescription = props.adviceDescription || "";
|
|
1338
|
+
this._image = props.image || "";
|
|
1339
|
+
this._daysRequiredToStart = props.daysRequiredToStart;
|
|
1340
|
+
this._flagsRequired = props.flagsRequired;
|
|
1341
|
+
this._questsRequired = props.questsRequired;
|
|
1342
|
+
this._requestDescription = props.requestDescription || "";
|
|
1343
|
+
this._onStart = props.onStart;
|
|
1344
|
+
this._onEnd = props.onEnd;
|
|
1345
|
+
}
|
|
1346
|
+
get completed() {
|
|
1347
|
+
return this._completed;
|
|
1348
|
+
}
|
|
1349
|
+
get active() {
|
|
1350
|
+
return this._active;
|
|
1351
|
+
}
|
|
1352
|
+
get goals() {
|
|
1353
|
+
let list = this.getStorageProperty("goals");
|
|
1354
|
+
if (!list) {
|
|
1355
|
+
return this.defaultGoals;
|
|
1356
|
+
}
|
|
1357
|
+
return list.map((goal) => new Goal(goal));
|
|
1358
|
+
}
|
|
1359
|
+
set goals(value) {
|
|
1360
|
+
let list = value.map((goal) => goal.export);
|
|
1361
|
+
this.setStorageProperty("goals", list);
|
|
1362
|
+
}
|
|
1363
|
+
get name() {
|
|
1364
|
+
return this._name;
|
|
1365
|
+
}
|
|
1366
|
+
get description() {
|
|
1367
|
+
return this._description;
|
|
1368
|
+
}
|
|
1369
|
+
get adviceDescription() {
|
|
1370
|
+
return this._adviceDescription;
|
|
1371
|
+
}
|
|
1372
|
+
get image() {
|
|
1373
|
+
return this._image;
|
|
1374
|
+
}
|
|
1375
|
+
get daysRequiredToStart() {
|
|
1376
|
+
return this._daysRequiredToStart;
|
|
1377
|
+
}
|
|
1378
|
+
get flagsRequired() {
|
|
1379
|
+
return this._flagsRequired;
|
|
1380
|
+
}
|
|
1381
|
+
get questsRequired() {
|
|
1382
|
+
return this._questsRequired;
|
|
1383
|
+
}
|
|
1384
|
+
get requestDescription() {
|
|
1385
|
+
return this._requestDescription;
|
|
1386
|
+
}
|
|
1387
|
+
get onStart() {
|
|
1388
|
+
return this._onStart;
|
|
1389
|
+
}
|
|
1390
|
+
get onEnd() {
|
|
1391
|
+
return this._onEnd;
|
|
1392
|
+
}
|
|
1393
|
+
};
|
|
1394
|
+
|
|
538
1395
|
exports.ActivityModel = ActivityModel;
|
|
539
1396
|
exports.CommitmentBaseModel = CommitmentBaseModel;
|
|
1397
|
+
exports.Goal = Goal;
|
|
1398
|
+
exports.LocationBaseModel = LocationBaseModel;
|
|
1399
|
+
exports.MapBaseModel = MapBaseModel;
|
|
1400
|
+
exports.QuestBaseModel = QuestBaseModel;
|
|
1401
|
+
exports.RoomBaseModel = RoomBaseModel;
|
|
1402
|
+
exports.StageBaseModel = StageBaseModel;
|
|
540
1403
|
//# sourceMappingURL=out.js.map
|
|
541
1404
|
//# sourceMappingURL=index.js.map
|