@drincs/nqtr 0.6.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/dist/handlers.cjs +1 -0
  2. package/dist/handlers.d.mts +606 -0
  3. package/dist/handlers.d.ts +606 -0
  4. package/dist/handlers.mjs +1 -0
  5. package/dist/index.cjs +1 -2
  6. package/dist/index.d.mts +1391 -23
  7. package/dist/index.d.ts +1391 -23
  8. package/dist/index.mjs +1 -2
  9. package/dist/ink.cjs +1 -0
  10. package/dist/ink.mjs +0 -0
  11. package/dist/registries.cjs +1 -0
  12. package/dist/registries.d.mts +516 -0
  13. package/dist/registries.d.ts +516 -0
  14. package/dist/registries.mjs +1 -0
  15. package/package.json +40 -8
  16. package/dist/RoomInterface-BhP3JgjH.d.ts +0 -182
  17. package/dist/RoomInterface-V1-hwph_.d.mts +0 -182
  18. package/dist/StageInterface-v96_K9Tg.d.mts +0 -188
  19. package/dist/StageInterface-v96_K9Tg.d.ts +0 -188
  20. package/dist/classes/index.cjs +0 -2
  21. package/dist/classes/index.cjs.map +0 -1
  22. package/dist/classes/index.d.mts +0 -515
  23. package/dist/classes/index.d.ts +0 -515
  24. package/dist/classes/index.mjs +0 -2
  25. package/dist/classes/index.mjs.map +0 -1
  26. package/dist/decorators/index.cjs +0 -2
  27. package/dist/decorators/index.cjs.map +0 -1
  28. package/dist/decorators/index.d.mts +0 -164
  29. package/dist/decorators/index.d.ts +0 -164
  30. package/dist/decorators/index.mjs +0 -2
  31. package/dist/decorators/index.mjs.map +0 -1
  32. package/dist/index-B8O3zxyP.d.ts +0 -269
  33. package/dist/index-BgY2U2li.d.mts +0 -199
  34. package/dist/index-CzOd-Rin.d.mts +0 -269
  35. package/dist/index-cbTx3r0P.d.ts +0 -199
  36. package/dist/index.cjs.map +0 -1
  37. package/dist/index.mjs.map +0 -1
  38. package/dist/interface/index.cjs +0 -2
  39. package/dist/interface/index.cjs.map +0 -1
  40. package/dist/interface/index.d.mts +0 -6
  41. package/dist/interface/index.d.ts +0 -6
  42. package/dist/interface/index.mjs +0 -2
  43. package/dist/interface/index.mjs.map +0 -1
  44. package/dist/managers/index.cjs +0 -2
  45. package/dist/managers/index.cjs.map +0 -1
  46. package/dist/managers/index.d.mts +0 -7
  47. package/dist/managers/index.d.ts +0 -7
  48. package/dist/managers/index.mjs +0 -2
  49. package/dist/managers/index.mjs.map +0 -1
  50. package/dist/types/index.cjs +0 -2
  51. package/dist/types/index.cjs.map +0 -1
  52. package/dist/types/index.d.mts +0 -65
  53. package/dist/types/index.d.ts +0 -65
  54. package/dist/types/index.mjs +0 -2
  55. package/dist/types/index.mjs.map +0 -1
@@ -1,188 +0,0 @@
1
- import { OnRunProps as OnRunProps$1, QuestInterface as QuestInterface$1, StageInterface as StageInterface$1 } from '@drincs/nqtr';
2
-
3
- type ExecutionType = "automatic" | "interaction";
4
-
5
- type OnRunProps = OnRunProps$1;
6
- /**
7
- * The function that is called when the class is runned.
8
- */
9
- type OnRunEvent<T> = (item: T, props: OnRunProps) => any | Promise<any>;
10
- type OnRunFunction = (props: OnRunProps) => any | Promise<any>;
11
- type OnRunAsyncFunction = (props: OnRunProps) => Promise<any>;
12
-
13
- type QuestsRequiredType = {
14
- quest: QuestInterface;
15
- stageNumber: number;
16
- };
17
-
18
- interface QuestInterface extends QuestBaseInternalInterface, QuestInterface$1 {
19
- }
20
- interface QuestBaseInternalInterface {
21
- /**
22
- * The id of the quest.
23
- */
24
- readonly id: string;
25
- /**
26
- * The stages of the quest.
27
- */
28
- readonly stages: StageInterface[];
29
- /**
30
- * The index of the current stage.
31
- */
32
- currentStageIndex?: number;
33
- /**
34
- * The current stage.
35
- */
36
- readonly currentStage?: StageInterface;
37
- /**
38
- * If the quest is started.
39
- */
40
- readonly started: boolean;
41
- /**
42
- * If the quest is started and not completed and not failed.
43
- */
44
- readonly inProgress: boolean;
45
- /**
46
- * If the quest is completed.
47
- */
48
- readonly completed: boolean;
49
- /**
50
- * If the quest is failed.
51
- */
52
- readonly failed: boolean;
53
- /**
54
- * The function that will be called when the quest starts.
55
- */
56
- readonly onStart?: OnRunEvent<QuestInterface>;
57
- /**
58
- * The function that will be called when the quest goes to the next stage.
59
- */
60
- readonly onNextStage?: OnRunEvent<QuestInterface>;
61
- /**
62
- * Start the quest.
63
- * @param props The properties for the start stage. If you not want to pass any property, you can pass an {}.
64
- * @returns
65
- */
66
- start(props: OnRunProps$1): Promise<void>;
67
- /**
68
- * @deprecated Use {@link goNextIfCompleted} instead.
69
- */
70
- tryToGoNextStage(props: OnRunProps$1): Promise<boolean>;
71
- /**
72
- * Go to the next stage if the current stage is completed.
73
- * If you want to force the change of stage, use {@link forceGoNext}.
74
- * @param props The properties. If you not want to pass any property, you can pass an {}.
75
- * @returns true if the stage was changed, false otherwise.
76
- */
77
- goNextIfCompleted(props: OnRunProps$1): Promise<boolean>;
78
- /**
79
- * @deprecated Use {@link goNext} instead.
80
- */
81
- completeCurrentStageAndGoNext(props: OnRunProps$1): Promise<boolean>;
82
- /**
83
- * Complete the current stage and go to the next stage with {@link forceGoNext}.
84
- * If you want to go to the next stage only if the current stage is completed, use {@link goNextIfCompleted}.
85
- * @param props The properties. If you not want to pass any property, you can pass an {}.
86
- * @returns true if the stage was changed, false otherwise.
87
- */
88
- goNext(props: OnRunProps$1): Promise<boolean>;
89
- /**
90
- * @deprecated Use {@link forceGoNext} instead.
91
- */
92
- goNextStage(props: OnRunProps$1): Promise<boolean>;
93
- /**
94
- * Ignore the completed state of the current stage and go to the next stage without checking if the current stage is completed.
95
- * If you want to go to the next stage only if the current stage is completed, use {@link goNextIfCompleted}.
96
- * @param props The properties. If you not want to pass any property, you can pass an {}.
97
- * @returns returns true if the stage was changed, false otherwise.
98
- */
99
- forceGoNext(props: OnRunProps$1): Promise<boolean>;
100
- /**
101
- * If the current stage must start. It is true if the current stage is not started, can start and not completed.
102
- */
103
- readonly currentStageMustStart: boolean;
104
- /**
105
- * Start the current stage. This is a system function, do not use it directly.
106
- * @param props The properties for the start stage. If you not want to pass any property, you can pass an {}.
107
- */
108
- startCurrentStage(props: OnRunProps$1): Promise<void>;
109
- }
110
-
111
- interface StageInterface extends StageBaseInternalInterface, StageInterface$1 {
112
- }
113
- interface StageBaseInternalInterface {
114
- /**
115
- * The id of the stage.
116
- */
117
- readonly id: string;
118
- /**
119
- * The function that will be called when the stage starts.
120
- */
121
- readonly onStart?: OnRunEvent<StageInterface>;
122
- /**
123
- * The function that will be called when the stage ends.
124
- */
125
- readonly onEnd?: OnRunEvent<StageInterface>;
126
- /**
127
- * Check if the flag and goals are completed.
128
- * You can force the completion of the stage by setting the completed property to true.
129
- * @example
130
- * ```ts
131
- * export default class Stage extends StageStoredClass {
132
- * override get completed(): boolean {
133
- * if (super.completed) {
134
- * return true;
135
- * }
136
- * if (this.flags.length > 0) {
137
- * if (!this.flags.every((flag) => storage.getFlag(flag.flag))) {
138
- * return false;
139
- * }
140
- * return true;
141
- * }
142
- * return false;
143
- * }
144
- * override set completed(value: boolean) {
145
- * super.completed = value;
146
- * }
147
- * }
148
- * ```
149
- */
150
- completed: boolean;
151
- /**
152
- * If the stage is started.
153
- */
154
- started: boolean;
155
- /**
156
- * The date when the stage starts.
157
- */
158
- readonly startDate?: number;
159
- /**
160
- * Check if the stage can start.
161
- * @example
162
- * ```ts
163
- * export default class Stage extends StageStoredClass {
164
- * override get canStart(): boolean {
165
- * if (this.flagsRequired.length > 0 && !this.flagsRequired.every((flag) => storage.getFlag(flag.flag))) {
166
- * return false;
167
- * }
168
- * return super.canStart;
169
- * }
170
- * }
171
- * ```
172
- */
173
- readonly canStart: boolean;
174
- /**
175
- * The function that will be called when the stage starts.
176
- */
177
- start(props: OnRunProps$1): Promise<void>;
178
- /**
179
- * The number of day/date required to start the stage.
180
- */
181
- readonly deltaDateRequired: number;
182
- /**
183
- * The list of quests required to start the stage.
184
- */
185
- readonly questsRequired: QuestsRequiredType[];
186
- }
187
-
188
- export type { ExecutionType as E, OnRunAsyncFunction as O, QuestInterface as Q, StageInterface as S, OnRunEvent as a, OnRunFunction as b, OnRunProps as c, QuestsRequiredType as d, QuestBaseInternalInterface as e, StageBaseInternalInterface as f };
@@ -1,2 +0,0 @@
1
- 'use strict';var storage=require('@drincs/pixi-vn/storage'),narration=require('@drincs/pixi-vn/narration'),pixiVn=require('@drincs/pixi-vn');var l="___nqtr-time_manager_data___",h="___nqtr-current_room_memory___",X="___nqtr-last_event_memory___";var s;(n=>(n.log=(i,...a)=>console.log(`[NQTR] ${i}`,...a),n.warn=(i,...a)=>console.warn(`[NQTR] ${i}`,...a),n.error=(i,...a)=>console.error(`[NQTR] ${i}`,...a),n.info=(i,...a)=>console.info(`[NQTR] ${i}`,...a)))(s||={});var O=new pixiVn.CachedMap({cacheSize:20}),te;(n=>{function o(i){if(Array.isArray(i)){i.forEach(a=>n.add(a));return}O.set(i.id,i);}n.add=o;function e(i){try{let a=O.get(i);if(!a){console.warn(`[NQTR] Activity ${i} not found, you should register it first`);return}return a}catch(a){s.error(`Error while getting Activity ${i}`,a);return}}n.get=e;function t(){return Array.from(O.values())}n.values=t;function r(i){return O.has(i)}n.has=r;})(te||={});var q=te;var p=new pixiVn.CachedMap({cacheSize:20}),L=new pixiVn.CachedMap({cacheSize:20}),ie;(n=>{function o(i){if(Array.isArray(i)){i.forEach(a=>n.add(a));return}p.set(i.id,i);}n.add=o;function e(i){try{let a=p.get(i);if(!a){console.warn(`[NQTR] Commitment ${i} not found, you should register it first`);return}return a}catch(a){s.error(`Error while getting Commitment ${i}`,a);return}}n.get=e;function t(){return Array.from(p.values())}n.values=t;function r(i){return p.has(i)}n.has=r;})(ie||={});var S=ie;var $=new pixiVn.CachedMap({cacheSize:20}),ne;(n=>{function o(i){if(Array.isArray(i)){i.forEach(a=>o(a));return}$.set(i.id,i);}n.add=o;function e(i){try{let a=$.get(i);if(!a){console.warn(`[NQTR] Location ${i} not found, you should register it first`);return}return a}catch(a){s.error(`Error while getting Location ${i}`,a);return}}n.get=e;function t(){return Array.from($.values())}n.values=t;function r(i){return $.has(i)}n.has=r;})(ne||={});var E=ne;var k=new pixiVn.CachedMap({cacheSize:20}),ae;(n=>{function o(i){if(Array.isArray(i)){i.forEach(a=>o(a));return}k.set(i.id,i);}n.add=o;function e(i){try{let a=k.get(i);if(!a){console.warn(`[NQTR] Map ${i} not found, you should register it first`);return}return a}catch(a){s.error(`Error while getting Map ${i}`,a);return}}n.get=e;function t(){return Array.from(k.values())}n.values=t;function r(i){return k.has(i)}n.has=r;})(ae||={});var D=ae;var z=new pixiVn.CachedMap({cacheSize:5}),oe;(n=>{function o(i){if(Array.isArray(i)){i.forEach(a=>n.add(a));return}z.set(i.id,i);}n.add=o;function e(i){try{let a=z.get(i);if(!a){console.warn(`[NQTR] Quest ${i} not found, you should register it first`);return}return a}catch(a){s.error(`Error while getting Quest ${i}`,a);return}}n.get=e;function t(){return Array.from(z.values())}n.values=t;function r(i){return z.has(i)}n.has=r;})(oe||={});var Y=new pixiVn.CachedMap({cacheSize:20}),se;(n=>{function o(i){if(Array.isArray(i)){i.forEach(m=>o(m));return}Y.set(i.id,i);let a=i.location;E.add(a);let d=a?.map;d&&D.add(d);}n.add=o;function e(i){try{let a=Y.get(i);if(!a){console.warn(`[NQTR] Room ${i} not found, you should register it first`);return}return a}catch(a){s.error(`Error while getting Room ${i}`,a);return}}n.get=e;function t(){return Array.from(Y.values())}n.values=t;function r(i){return Y.has(i)}n.has=r;})(se||={});var y=se;function C(o){storage.storage.set(X,o);}function ue(){return storage.storage.get(X)}var P=class{get rooms(){return y.values()}get locations(){return E.values()}get maps(){return D.values()}get currentRoomId(){return storage.storage.get(h)}get currentRoom(){let e=this.currentRoomId;if(!e){s.error("The current room has not yet been set");return}let t=y.get(e);if(!t){s.error(`Current room ${e} not found`);return}return t}set currentRoom(e){if(typeof e!="string"&&(e=e.id),!y.get(e)){s.error(`The room ${e} is not registered, so it can't be set as current room`);return}let r=storage.storage.get(h);r!==e&&(C({type:"editroom",prev:r,value:e}),storage.storage.set(h,e));}get currentLocation(){return this.currentRoom?.location}get currentMap(){return this.currentRoom?.location.map}clearExpiredActivities(){y.values().forEach(e=>{e.clearExpiredActivities();});}};var H="___nqtr-temporary_commitment___",N=class{get fixedRoutine(){return [...L.values()]}set fixedRoutine(e){e.forEach(t=>{L.has(t.id)&&console.warn(`[NQTR] Commitment id ${t.id} already exists, it will be overwritten`),L.set(t.id,t);});}get temporaryRoutine(){let e=storage.storage.get(H);return e?e.map(r=>S.get(r)).filter(r=>r!==void 0):[]}get allRoutine(){return [...this.fixedRoutine,...this.temporaryRoutine]}add(e){Array.isArray(e)||(e=[e]);let t=e.map(r=>{if(!S.get(r.id)){console.warn(`[NQTR] Commitment ${r.id} not found, it will be ignored`);return}return r.id}).filter(r=>r!==void 0);storage.storage.set(H,t);}find(e){return S.get(e)}remove(e){Array.isArray(e)||(e=[e]);let t=e.map(n=>n.id),r=storage.storage.get(H);r&&(r=r.filter(n=>!t.includes(n)),storage.storage.set(H,r));}clearExpiredRoutine(){S.values().forEach(e=>{e.expired&&p.delete(e.id);});}get currentRoutine(){let e={};return [...this.fixedRoutine,...this.temporaryRoutine].forEach(t=>{t.isActive&&(t.characters.length>0?t.characters.every(n=>!e[n.id]||t.priority>e[n.id].priority)&&t.characters.forEach(n=>{e[n.id]=t;}):s.error(`The commitment ${t.id} has no characters assigned`));}),Object.values(e)}getCommitmentByCharacter(e){this.currentRoutine.forEach(t=>{if(t.characters.map(r=>r.id).includes(e.id))return t});}};var u=class{static dayStartTime=0;static dayEndTime=24;static defaultTimeSpent=1;static timeSlots=[];static weekLength=7;static weekendStartDay=this.weekLength-1;static getDayName};var Q=class{initialize(e){let{dayStartTime:t=0,dayEndTime:r=24,defaultTimeSpent:n=1,timeSlots:i=[],weekLength:a=7,weekendStartDay:d=a-1,getDayName:m}=e;u.dayStartTime=t,u.dayEndTime=r,u.defaultTimeSpent=n,u.timeSlots=i,u.weekLength=a,d>=u.weekLength?console.warn(`[NQTR] Weekend start day should be less than week length ${a}, so will be ignored`):u.weekendStartDay=d,u.getDayName=m;}get dayStartTime(){return u.dayStartTime}get dayEndTime(){return u.dayEndTime}get defaultTimeSpent(){return u.defaultTimeSpent}get timeSlots(){return u.timeSlots}get weekLength(){return u.weekLength}get weekendStartDay(){return u.weekendStartDay}get getDayName(){return u.getDayName}get currentTime(){let e=storage.storage.get(l)||{};return e.hasOwnProperty("currentTime")&&typeof e.currentTime=="number"?e.currentTime:this.dayStartTime}set currentTime(e){let t=storage.storage.get(l)||{},r={...t};typeof e=="number"?r.currentTime=e:delete r.currentTime,C({type:"edittime",prev:t,value:r}),storage.storage.set(l,r);}get currentDate(){let e=storage.storage.get(l)||{};return e.hasOwnProperty("currentDate")&&typeof e.currentDate=="number"?e.currentDate:0}set currentDate(e){let t=storage.storage.get(l)||{},r={...t};typeof e=="number"?r.currentDate=e:delete r.currentDate,C({type:"edittime",prev:t,value:r}),storage.storage.set(l,r);}get isWeekend(){return this.currentWeekDayNumber>=this.weekendStartDay}get currentWeekDayNumber(){return this.currentDate%this.weekLength+1}get currentDayName(){return this.getDayName?this.getDayName(this.currentWeekDayNumber-1):(console.warn("[NQTR] Week days names are not defined, so currentDayName will be empty"),"")}get currentTimeSlot(){if(this.timeSlots.length===0)return console.warn("[NQTR] Time slots are not defined"),0;for(let e=0;e<this.timeSlots.length;e++){let t=this.timeSlots[e];if(this.timeSlots.length>e+1&&this.nowIsBetween(t.startTime,this.timeSlots[e+1].startTime))return e}return this.timeSlots.length-1}increaseTime(e=this.defaultTimeSpent){let t=this.currentTime+e;return t>=this.dayEndTime&&(this.increaseDate(),t=this.dayStartTime+(t-this.dayEndTime)),this.currentTime=t,this.currentTime}increaseDate(e=1,t=this.dayStartTime){let r=this.currentDate+e;return this.currentDate=r,this.currentTime=t,this.currentDate}nowIsBetween(e,t){e===void 0&&(e=this.dayStartTime-1),t===void 0&&(t=this.dayEndTime+1);let r=this.currentTime;return e<t?r>=e&&r<t:r>=e||r<t}};var c=new Q,I=new P,ce=new N;var Ae="__nqtr-activity__",g=class extends storage.StoredClassModel{constructor(t,r,n,i=Ae){super(i,t);this._onRun=r;this._timeSlot=n.timeSlot,this._dateScheduling=n.dateScheduling;}_timeSlot;get timeSlot(){return this._timeSlot}_dateScheduling;get dateScheduling(){return this._dateScheduling}addTempHistoryItem(){narration.narration.addCurrentStepToHistory();}get run(){return async t=>(this.addTempHistoryItem(),await this._onRun(this,t))}get expired(){return !!(this.dateScheduling?.to&&this.dateScheduling.to<=c.currentDate)}get isActive(){return !(this.dateScheduling?.from&&this.dateScheduling.from>c.currentDate||this.dateScheduling?.to&&this.dateScheduling.to<c.currentDate||!c.nowIsBetween(this.timeSlot?.from,this.timeSlot?.to))}};var G=class extends g{constructor(e,t,r){super(e,t,{dateScheduling:r.dateScheduling,timeSlot:r.timeSlot}),this.defaultName=r.name||"",this.defaultDisabled=r.disabled||false,this.defaultHidden=r.hidden||false,this._icon=r.renderIcon;}defaultName;get name(){return this.getStorageProperty("name")||this.defaultName}set name(e){this.setStorageProperty("name",e);}defaultDisabled;get disabled(){let e=this.getStorageProperty("disabled")||this.defaultDisabled;return typeof e=="string"?storage.storage.getFlag(e):e}set disabled(e){this.setStorageProperty("disabled",e);}defaultHidden;get hidden(){let e=this.getStorageProperty("hidden")||this.defaultHidden;return typeof e=="string"?storage.storage.getFlag(e):e}set hidden(e){this.setStorageProperty("hidden",e);}_icon;get icon(){return this._icon}};var be="__nqtr-commitment__",x=class extends g{constructor(t,r,n,i,a){i=i||(()=>{});super(t,i,a,be);this._characters=r;this._room=n;this.defaultExecutionType=a.executionType||"interaction",this.defaultPriority=a.priority;}defaultExecutionType;defaultPriority;get characters(){return this._characters}get room(){return this._room}get executionType(){return this.getStorageProperty("executionType")||this.defaultExecutionType}set executionType(t){this.setStorageProperty("executionType",t);}get priority(){return this.getStorageProperty("priority")||this.defaultPriority||0}set priority(t){this.setStorageProperty("priority",t);}addTempHistoryItem(){let t=I.currentRoom;if(!t||this.executionType!=="automatic")return super.addTempHistoryItem();let r=ue();switch(r?.type){case "editroom":storage.storage.set(h,r.prev),super.addTempHistoryItem(),storage.storage.set(h,t.id);break;case "edittime":let n=storage.storage.get(l)||{};storage.storage.set(l,r.prev),super.addTempHistoryItem(),storage.storage.set(l,n);break}}};var K=class extends x{constructor(e,t,r,n){super(e,t?Array.isArray(t)?t:[t]:[],r,n.onRun,{executionType:n.executionType,priority:n.priority,timeSlot:n.timeSlot,dateScheduling:n.dateScheduling}),this._name=n.name||"",this._image=n.image,this.defaultDisabled=n.disabled||false,this.defaultHidden=n.hidden||false,this._icon=n.icon;}_name;get name(){return this._name}_image;get image(){return this._image}_icon;get icon(){return this._icon}defaultDisabled;get disabled(){let e=this.getStorageProperty("disabled")||this.defaultDisabled;return typeof e=="string"?storage.storage.getFlag(e):e}set disabled(e){this.setStorageProperty("disabled",e);}defaultHidden;get hidden(){if(this.dateScheduling?.from&&this.dateScheduling.from>c.currentDate||!c.nowIsBetween(this.timeSlot?.from,this.timeSlot?.to)||!this.expired)return true;let e=this.getStorageProperty("hidden")||this.defaultHidden;return typeof e=="string"?storage.storage.getFlag(e):e}set hidden(e){this.setStorageProperty("hidden",e);}};var f=class extends storage.StoredClassModel{constructor(t,r,n=[]){super(t,r);this.defaultActivities=n;}get defaultActivitiesIds(){return this.defaultActivities.map(t=>t.id)}get activeActivityScheduling(){return this.getStorageProperty("activeActivityScheduling")||{}}get excludedActivitiesScheduling(){return this.getStorageProperty("excludedActivitiesScheduling")||{}}removeActivityScheduling(t){let r=this.activeActivityScheduling;delete r[t],this.setStorageProperty("activeActivityScheduling",r);let n=this.excludedActivitiesScheduling;delete n[t],this.setStorageProperty("excludedActivitiesScheduling",n);}editActivityScheduling(t,r){this.removeActivityScheduling(t);let n=this.activeActivityScheduling;n[t]=r,this.setStorageProperty("activeActivityScheduling",n);}editExcludedActivityScheduling(t,r){this.removeActivityScheduling(t);let n=this.excludedActivitiesScheduling;n[t]=r,this.setStorageProperty("excludedActivitiesScheduling",n);}get additionalActivitiesIds(){return this.getStorageProperty("additionalActivitiesIds")||[]}get excludedActivitiesIds(){return this.getStorageProperty("excludedActivitiesIds")||[]}get activitiesIds(){return this.additionalActivitiesIds.concat(this.defaultActivitiesIds)}addActivity(t,r={}){let{timeSlot:n,dateScheduling:i}=r,{to:a=c.dayEndTime+1}=n||{};if(n&&n.from>=a)throw new Error("[NQTR] The from time must be less than the to time.");if(i?.from!==void 0&&i?.to!==void 0&&i?.from>=i?.to)throw new Error("[NQTR] The from day/date must be less than the to day/date.");if(this.defaultActivitiesIds.includes(t.id)){console.warn(`[NQTR] Activity with id ${t.id} already exists, so it will be ignored.`);return}let d=this.additionalActivitiesIds;d.includes(t.id)?console.warn(`[NQTR] Activity with id ${t.id} already exists, so it will be ignored.`):(d.push(t.id),this.setStorageProperty("additionalActivitiesIds",d)),this.excludedActivitiesIds.includes(t.id)&&(this.removeActivityScheduling(t.id),console.log(`[NQTR] Activity with id ${t.id} was excluded, so it will be associated with this class again.`)),(n||i)&&this.editActivityScheduling(t.id,{timeSlot:n,dateScheduling:i});}removeActivity(t,r={}){let{to:n}=r,i=typeof t=="string"?t:t.id,a=this.additionalActivitiesIds;if(a.includes(i)){if(n!==void 0){this.editExcludedActivityScheduling(i,{dateScheduling:{to:n}});return}a=a.filter(d=>d!==i),this.setStorageProperty("additionalActivitiesIds",a),this.removeActivityScheduling(i);}else if(this.defaultActivitiesIds.includes(i)){if(n!==void 0){this.editExcludedActivityScheduling(i,{dateScheduling:{to:n}});return}let d=this.excludedActivitiesIds;d.push(i),this.setStorageProperty("excludedActivitiesIds",d);}else console.warn(`[NQTR] Activity with id ${i} not found, so it will be ignored.`);}clearExpiredActivities(){let t=this.activeActivityScheduling,r=this.excludedActivitiesScheduling,n=this.additionalActivitiesIds,i=this.excludedActivitiesIds;n.forEach(a=>{if(a in t){let{to:d}=t[a].dateScheduling||{};d&&d<c.currentDate&&(this.removeActivityScheduling(a),n=n.filter(m=>m!==a));}}),i.forEach(a=>{if(a in r){let{to:d}=r[a].dateScheduling||{};d&&d<c.currentDate&&(this.removeActivityScheduling(a),i=i.filter(m=>m!==a));}});}get activities(){let t=[],r=this.activeActivityScheduling;return this.additionalActivitiesIds.concat(this.defaultActivitiesIds).forEach(n=>{let i=q.get(n),{dateScheduling:a,timeSlot:d}=r[n]||{},{from:m=i?.dateScheduling?.from,to:ee=i?.dateScheduling?.to}=a||{},{from:pe=i?.timeSlot?.from,to:Se=i?.timeSlot?.to}=d||{};i&&c.nowIsBetween(pe,Se)&&!(m&&m>c.currentDate)&&!(ee&&ee<c.currentDate)&&t.push(i);}),Object.entries(this.excludedActivitiesScheduling).forEach(([n,i])=>{let a=q.get(n);a&&a.isActive&&!(i.dateScheduling&&i.dateScheduling.to!==void 0&&i.dateScheduling.to>=c.currentDate)&&t.push(a);}),this.defaultActivities.forEach(n=>{n.isActive&&!t.find(i=>i.id===n.id)&&t.push(n);}),t}};var De="__nqtr-location__",_=class extends f{constructor(t,r,n=[]){super(De,t,n);this._map=r;}get map(){return this._map}get rooms(){return I.rooms.filter(t=>t.location.id===this.id)}};var W=class extends _{constructor(e,t,r={}){super(e,t,r.activities||[]),this.defaultName=r.name||"",this.defaultDisabled=r.disabled||false,this.defaultHidden=r.hidden||false,this._icon=r.icon;}defaultName;get name(){return this.getStorageProperty("name")||this.defaultName}set name(e){this.setStorageProperty("name",e);}defaultDisabled;get disabled(){let e=this.getStorageProperty("disabled")||this.defaultDisabled;return typeof e=="string"?storage.storage.getFlag(e):e}set disabled(e){this.setStorageProperty("disabled",e);}defaultHidden;get hidden(){let e=this.getStorageProperty("hidden")||this.defaultHidden;return typeof e=="string"?storage.storage.getFlag(e):e}set hidden(e){this.setStorageProperty("hidden",e);}_icon;get icon(){return this._icon}};var Ce="__nqtr-map__",R=class extends f{constructor(e,t=[]){super(Ce,e,t);}get locations(){return I.locations.filter(e=>e.map.id===this.id)}};var U=class extends R{constructor(e,t={}){super(e,t.activities||[]),this.defaultName=t.name||"",this._image=t.image;}defaultName;get name(){return this.getStorageProperty("name")||this.defaultName}set name(e){this.setStorageProperty("name",e);}_image;get image(){return this._image}};var Pe="__nqtr-room__",T=class extends f{constructor(t,r,n=[]){super(Pe,t,n);this._location=r;}get routine(){return ce.currentRoutine.filter(t=>t.room.id===this.id)}get location(){return this._location}get characters(){let t=[];return this.routine.forEach(r=>{t.push(...r.characters);}),t}get automaticFunctions(){return this.routine.filter(t=>t.executionType==="automatic"&&t.run).map(t=>async n=>{await t.run(n);})}};var V=class extends T{constructor(e,t,r={}){super(e,t,r.activities||[]),this.defaultName=r.name||"",this._image=r.image,this.defaultDisabled=r.disabled||false,this.defaultHidden=r.hidden||false,this._icon=r.icon;}defaultName;get name(){return this.getStorageProperty("name")||this.defaultName}set name(e){this.setStorageProperty("name",e);}_image;get image(){return this._image}defaultDisabled;get disabled(){let e=this.getStorageProperty("disabled")||this.defaultDisabled;return typeof e=="string"?storage.storage.getFlag(e):e}set disabled(e){this.setStorageProperty("disabled",e);}defaultHidden;get hidden(){let e=this.getStorageProperty("hidden")||this.defaultHidden;return typeof e=="string"?storage.storage.getFlag(e):e}set hidden(e){this.setStorageProperty("hidden",e);}_icon;get icon(){return this._icon}};var Ne="__nqtr-quest__",A=class extends storage.StoredClassModel{constructor(t,r,n={}){super(Ne,t);this._stages=r;this._onStart=n.onStart,this._onNextStage=n.onNextStage;}get stages(){return this._stages}get currentStageIndex(){return this.getStorageProperty("currentStageIndex")}set currentStageIndex(t){this.setStorageProperty("currentStageIndex",t);}get currentStage(){let t=this.currentStageIndex;if(!(t===void 0||t>=this.stages.length))return this.stages[t]}get started(){return this.currentStageIndex!==void 0}get completed(){return this.currentStageIndex===void 0?false:this.currentStageIndex>this.stages.length-1}get inProgress(){return this.completed||this.failed?false:this.started}get failed(){return this.getStorageProperty("failed")||false}set failed(t){this.setStorageProperty("failed",t);}_onStart;get onStart(){return this._onStart}_onNextStage;get onNextStage(){return this._onNextStage}async start(t){if(this.started){console.warn(`[NQTR] Quest ${this.id} is already started`);return}if(this.stages.length===0){s.error(`Quest ${this.id} has no stages`);return}this.currentStageIndex=0;let r=this.currentStage;if(r&&r.start)return this.onStart&&await this.onStart(this,t),await r.start(t);s.error(`Quest ${this.id} has no start stage`);}tryToGoNextStage(t){return this.goNextIfCompleted(t)}async goNextIfCompleted(t){if(!this.inProgress)return false;let r=this.currentStage;return r?r.completed?await this.forceGoNext(t):false:(s.error(`Quest ${this.id} has no current stage`),false)}completeCurrentStageAndGoNext(t){return this.goNext(t)}async goNext(t){let r=this.currentStage;return r?(r.completed=true,await this.forceGoNext(t)):(s.error(`Quest ${this.id} has no current stage`),false)}goNextStage(t){return this.forceGoNext(t)}async forceGoNext(t){if(!this.inProgress)return console.warn(`[NQTR] Quest ${this.id} is not in progress`),false;let r=this.currentStage,n=this.currentStageIndex;if(!r||n===void 0)return s.error(`Quest ${this.id} has no current stage`),false;this.currentStageIndex=n+1,this.onNextStage&&await this.onNextStage(this,t),r&&r.onEnd&&await r.onEnd(r,t);let i=this.currentStage;return i&&(i.inizialize(),this.currentStageMustStart&&await this.startCurrentStage(t)),true}get currentStageMustStart(){let t=this.currentStage;return t?!t.started&&t.canStart&&!t.completed:false}async startCurrentStage(t){let r=this.currentStage;r&&this.currentStageMustStart?await r.start(t):console.warn(`[NQTR] Quest ${this.id} can't start the current stage`);}};var j=class extends A{constructor(e,t,r){super(e,t,{onStart:r.onStart,onNextStage:r.onNextStage}),this._name=r.name||"",this._description=r.description||"",this._icon=r.icon,this._image=r.image,this._inDevelopment=r.inDevelopment||false;}_name;get name(){return this._name}_description;get description(){return this._description}_icon;get icon(){return this._icon}_image;get image(){return this._image}_inDevelopment;get inDevelopment(){return this._inDevelopment}};var Me="__nqtr-stage__",b=class extends storage.StoredClassModel{constructor(e,t={}){super(Me,e),this._onStart=t.onStart,this._onEnd=t.onEnd,this._deltaDateRequired=t.deltaDateRequired,this._questsRequired=t.questsRequired||[];}_onStart;get onStart(){return this._onStart}_onEnd;get onEnd(){return this._onEnd}get completed(){return this.getStorageProperty("completed")||false}set completed(e){this.setStorageProperty("completed",e);}get started(){return this.getStorageProperty("started")||false}set started(e){this.setStorageProperty("started",e);}get inizializeDate(){return this.getStorageProperty("inizializeDate")}set inizializeDate(e){this.setStorageProperty("inizializeDate",e);}get startDate(){let e=this.inizializeDate;if(e!==void 0)return e+this.deltaDateRequired}get canStart(){let e=this.deltaDateRequired;if(e>0){let t=this.inizializeDate;if(t===void 0||t+e>c.currentDate)return false}return !(this.questsRequired.length>0&&!this.questsRequired.every(t=>t.quest.currentStageIndex&&t.quest.currentStageIndex>=t.stageNumber))}inizialize(){this.deltaDateRequired>0&&(this.inizializeDate=c.currentDate,console.log(`[NQTR] Stage ${this.id} will start on date ${this.startDate}`));}async start(e){this.canStart?(this.started=true,this.onStart&&await this.onStart(this,e)):console.warn(`[NQTR] Stage ${this.id} can't start`);}_deltaDateRequired;get deltaDateRequired(){return this._deltaDateRequired||0}_questsRequired;get questsRequired(){return this._questsRequired||[]}};var J=class extends b{constructor(e,t){super(e,{onStart:t.onStart,onEnd:t.onEnd,deltaDateRequired:t.deltaDateRequired,questsRequired:t.questsRequired}),this._name=t.name||"",this._flags=t.flags||[],this._description=t.description||"",this._adviceDescription=t.adviceDescription||"",this._image=t.image,this._flagsRequired=t.flagsRequired||[],this._requestDescriptionToStart=t.requestDescriptionToStart||"";}_name;get name(){return this._name}_description;get description(){return this._description}_adviceDescription;get adviceDescription(){return this._adviceDescription}_image;get image(){return this._image}_flags;get flags(){return this._flags}_flagsRequired;get flagsRequired(){return this._flagsRequired}_requestDescriptionToStart;get requestDescriptionToStart(){return this._requestDescriptionToStart}get completed(){return super.completed?true:this.flags.length>0?!!this.flags.every(e=>storage.storage.getFlag(e.flag)):false}set completed(e){super.completed=e;}get canStart(){return this.flagsRequired.length>0&&!this.flagsRequired.every(e=>storage.storage.getFlag(e.flag))?false:super.canStart}};exports.ActivityBaseModel=G;exports.ActivityStoredClass=g;exports.CommitmentBaseModel=K;exports.CommitmentStoredClass=x;exports.LocationBaseModel=W;exports.LocationStoredClass=_;exports.MapBaseModel=U;exports.MapStoredClass=R;exports.QuestBaseModel=j;exports.QuestStoredClass=A;exports.RoomBaseModel=V;exports.RoomStoredClass=T;exports.StageBaseModel=J;exports.StageStoredClass=b;//# sourceMappingURL=index.cjs.map
2
- //# sourceMappingURL=index.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/constants.ts","../../src/utils/log-utility.ts","../../src/decorators/RegisteredActivities.ts","../../src/decorators/RegisteredCommitments.ts","../../src/decorators/RegisteredLocations.ts","../../src/decorators/RegisteredMaps.ts","../../src/decorators/RegisteredQuests.ts","../../src/decorators/RegisteredRooms.ts","../../src/functions/tracking-changes.ts","../../src/managers/NavigatorManager.ts","../../src/managers/RoutineManager.ts","../../src/managers/TimeManagerSettings.ts","../../src/managers/TimeManager.ts","../../src/managers/index.ts","../../src/classes/ActivityStoredClass.ts","../../src/classes/ActivityBaseModel.ts","../../src/classes/CommitmentStoredClass.ts","../../src/classes/CommitmentBaseModel.ts","../../src/classes/navigation/NavigationAbstractClass.ts","../../src/classes/navigation/LocationStoredClass.ts","../../src/classes/navigation/LocationBaseModel.ts","../../src/classes/navigation/MapStoredClass.ts","../../src/classes/navigation/MapBaseModel.ts","../../src/classes/navigation/RoomStoredClass.ts","../../src/classes/navigation/RoomBaseModel.ts","../../src/classes/quest/QuestStoredClass.ts","../../src/classes/quest/QuestBaseModel.ts","../../src/classes/quest/StageStoredClass.ts","../../src/classes/quest/StageBaseModel.ts"],"names":["TIME_DATA_KEY","CURRENT_ROOM_MEMORY_KEY","LATEST_EVENT_MEMORY_KEY","logger","message","optionalParams","registeredActivities","CachedMap","RegisteredActivities","add","activities","activity","get","id","e","values","has","RegisteredActivities_default","registeredCommitments","fixedCommitments","RegisteredCommitments","commitments","commitment","RegisteredCommitments_default","registeredLocations","RegisteredLocations","location","c","RegisteredLocations_default","registeredMaps","RegisteredMaps","map","RegisteredMaps_default","registeredQuests","RegisteredQuest","quests","quest","registeredRooms","RegisteredRooms","room","RegisteredRooms_default","setLastEvent","event","storage","getLastEvent","NavigatorManager","roomId","prevRoom","TEMPORARY_COMMITMENT_CATEGORY_MEMORY_KEY","RoutineManager","commitmentsIds","currentCommitments","character_commitments","ch","character","TimeManagerSettings","TimeManager","settings","dayStartTime","dayEndTime","defaultTimeSpent","timeSlots","weekLength","weekendStartDay","getDayName","data","value","prev","index","slot","delta","newTime","time","newDate","fromTime","toTime","currentTime","timeTracker","navigator","routine","ACTIVITY_CATEGORY","ActivityStoredClass","StoredClassModel","_onRun","props","category","narration","ActivityBaseModel","onRun","COMMITMENT_CATEGORY","CommitmentStoredClass","_characters","_room","currentRoom","lastEvent","CommitmentBaseModel","NavigationAbstractClass","categoryId","defaultActivities","activityId","activeActivityScheduling","excludedActivitiesScheduling","scheduling","options","timeSlot","dateScheduling","additionalActivitiesIds","to","excludedActivitiesIds","toDate","res","fromDate","a","LOCATION_CATEGORY","LocationStoredClass","_map","LocationBaseModel","MAP_CATEGORY","MapStoredClass","MapBaseModel","ROOM_CATEGORY","RoomStoredClass","_location","characters","RoomBaseModel","QUEST_CATEGORY","QuestStoredClass","_stages","currentStage","prevStage","currentStageIndex","nextCurrentStage","newCurrentStage","QuestBaseModel","stages","STAGE_CATEGORY","StageStoredClass","inizializeDate","deltaDateRequired","q","StageBaseModel","flag"],"mappings":"6IACO,IAAMA,CAAAA,CAAgB,8BAAA,CAEhBC,CAAAA,CAA0B,gCAAA,CAC1BC,CAAAA,CAA0B,+BCJhC,IAAUC,CAAAA,CAAAA,CAAAA,CAAAA,GACAA,CAAAA,CAAA,GAAA,CAAM,CAACC,CAAAA,CAAAA,GAAkBC,CAAAA,GAA0B,OAAA,CAAQ,GAAA,CAAI,CAAA,OAAA,EAAUD,CAAO,CAAA,CAAA,CAAI,GAAGC,CAAc,CAAA,CACrGF,CAAAA,CAAA,IAAA,CAAO,CAACC,CAAAA,CAAAA,GAAkBC,CAAAA,GACnC,OAAA,CAAQ,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tB,CACA,IAAa,QAAA,EAAoB,CAC7B,OAAI,IAAA,CAAK,aAAA,CAAc,MAAA,CAAS,CAAA,EAAK,CAAC,IAAA,CAAK,aAAA,CAAc,KAAA,CAAO2E,GAASlG,eAAAA,CAAQ,OAAA,CAAQkG,CAAAA,CAAK,IAAI,CAAC,CAAA,CACxF,KAAA,CAEJ,KAAA,CAAM,QACjB,CACJ","file":"index.cjs","sourcesContent":["export const TIME_SETTINGS_KEY = \"___nqtr-time_manager_settings___\";\nexport const TIME_DATA_KEY = \"___nqtr-time_manager_data___\";\n\nexport const CURRENT_ROOM_MEMORY_KEY = \"___nqtr-current_room_memory___\";\nexport const LATEST_EVENT_MEMORY_KEY = \"___nqtr-last_event_memory___\";\n","export namespace logger {\n export const log = (message?: any, ...optionalParams: any[]) => console.log(`[NQTR] ${message}`, ...optionalParams);\n export const warn = (message?: any, ...optionalParams: any[]) =>\n console.warn(`[NQTR] ${message}`, ...optionalParams);\n export const error = (message?: any, ...optionalParams: any[]) =>\n console.error(`[NQTR] ${message}`, ...optionalParams);\n export const info = (message?: any, ...optionalParams: any[]) =>\n console.info(`[NQTR] ${message}`, ...optionalParams);\n}\n","import { CachedMap } from \"@drincs/pixi-vn\";\nimport { ActivityInterface } from \"../interface\";\nimport { logger } from \"../utils/log-utility\";\n\n/**\n * A Map that contains all activities registered and available to be used.\n * The key is the id of the activity and the value is the activity itself.\n */\nconst registeredActivities = new CachedMap<string, ActivityInterface>({ cacheSize: 20 });\n\nnamespace RegisteredActivities {\n /**\n * Save an activity in the registered activities. If the activity already exists, it will be overwritten.\n * @param activity The activity to save.\n * @returns\n */\n export function add(activities: ActivityInterface | ActivityInterface[]) {\n if (Array.isArray(activities)) {\n activities.forEach((activity) => RegisteredActivities.add(activity));\n return;\n }\n registeredActivities.set(activities.id, activities);\n }\n\n /**\n * Get an activity by its id.\n * @param id The id of the activity.\n * @returns The activity or undefined if not found.\n */\n export function get(id: string): ActivityInterface | undefined {\n try {\n let activity = registeredActivities.get(id);\n if (!activity) {\n console.warn(`[NQTR] Activity ${id} not found, you should register it first`);\n return;\n }\n return activity;\n } catch (e) {\n logger.error(`Error while getting Activity ${id}`, e);\n return;\n }\n }\n\n /**\n * Get a list of all activities registered.\n * @returns An array of activities.\n */\n export function values(): ActivityInterface[] {\n return Array.from(registeredActivities.values());\n }\n\n /**\n * Check if an activity is registered.\n * @param id The id of the activity.\n * @returns True if the activity is registered, false otherwise.\n */\n export function has(id: string): boolean {\n return registeredActivities.has(id);\n }\n}\nexport default RegisteredActivities;\n","import { CachedMap } from \"@drincs/pixi-vn\";\nimport { CommitmentInterface } from \"../interface\";\nimport { logger } from \"../utils/log-utility\";\n\n/**\n * A Map that contains all commitments registered and available to be used.\n * The key is the id of the commitment and the value is the commitment itself.\n */\nexport const registeredCommitments = new CachedMap<string, CommitmentInterface>({ cacheSize: 20 });\nexport const fixedCommitments = new CachedMap<string, CommitmentInterface>({ cacheSize: 20 });\n\nnamespace RegisteredCommitments {\n /**\n * Save a commitment in the registered commitments. If the commitment already exists, it will be overwritten.\n * @param commitment The commitment to save.\n * @returns\n */\n export function add(commitments: CommitmentInterface | CommitmentInterface[]) {\n if (Array.isArray(commitments)) {\n commitments.forEach((commitment) => RegisteredCommitments.add(commitment));\n return;\n }\n registeredCommitments.set(commitments.id, commitments);\n }\n /**\n * Get a commitment by its id.\n * @param id The id of the commitment.\n * @returns The commitment or undefined if not found.\n */\n export function get(id: string): CommitmentInterface | undefined {\n try {\n let commitment = registeredCommitments.get(id);\n if (!commitment) {\n console.warn(`[NQTR] Commitment ${id} not found, you should register it first`);\n return;\n }\n return commitment;\n } catch (e) {\n logger.error(`Error while getting Commitment ${id}`, e);\n return;\n }\n }\n /**\n * Get a list of all commitments registered.\n * @returns An array of commitments.\n */\n export function values(): CommitmentInterface[] {\n return Array.from(registeredCommitments.values());\n }\n /**\n * Check if a commitment is registered.\n * @param id The id of the commitment.\n * @returns True if the commitment is registered, false otherwise.\n */\n export function has(id: string): boolean {\n return registeredCommitments.has(id);\n }\n}\nexport default RegisteredCommitments;\n","import { CachedMap } from \"@drincs/pixi-vn\";\nimport { LocationInterface } from \"../interface\";\nimport { logger } from \"../utils/log-utility\";\n\n/**\n * A Map that contains all locations registered and available to be used.\n * The key is the id of the location and the value is the location itself.\n */\nconst registeredLocations = new CachedMap<string, LocationInterface>({ cacheSize: 20 });\n\nnamespace RegisteredLocations {\n /**\n * Save a location in the registered locations. If the location already exists, it will be overwritten.\n * @param location The location to save.\n * @returns\n */\n export function add(location: LocationInterface | LocationInterface[]) {\n if (Array.isArray(location)) {\n location.forEach((c) => add(c));\n return;\n }\n // if (registeredLocations.has(location.id)) {\n // console.warn(`[NQTR] Location id ${location.id} already exists, it will be overwritten`);\n // }\n registeredLocations.set(location.id, location);\n }\n\n /**\n * Get a location by its id.\n * @param id The id of the location.\n * @returns The location or undefined if not found.\n */\n export function get(id: string): LocationInterface | undefined {\n try {\n let location = registeredLocations.get(id);\n if (!location) {\n console.warn(`[NQTR] Location ${id} not found, you should register it first`);\n return;\n }\n return location;\n } catch (e) {\n logger.error(`Error while getting Location ${id}`, e);\n return;\n }\n }\n\n /**\n * Get a list of all locations registered.\n * @returns An array of locations.\n */\n export function values(): LocationInterface[] {\n return Array.from(registeredLocations.values());\n }\n\n /**\n * Check if a location is registered.\n * @param id The id of the location.\n * @returns True if the location is registered, false otherwise.\n */\n export function has(id: string): boolean {\n return registeredLocations.has(id);\n }\n}\nexport default RegisteredLocations;\n","import { CachedMap } from \"@drincs/pixi-vn\";\nimport { MapInterface } from \"../interface\";\nimport { logger } from \"../utils/log-utility\";\n\n/**\n * A Map that contains all maps registered and available to be used.\n * The key is the id of the map and the value is the map itself.\n */\nconst registeredMaps = new CachedMap<string, MapInterface>({ cacheSize: 20 });\n\nnamespace RegisteredMaps {\n /**\n * Save a map in the registered maps. If the map already exists, it will be overwritten.\n * @param map The map to save.\n * @returns\n */\n export function add(map: MapInterface | MapInterface[]) {\n if (Array.isArray(map)) {\n map.forEach((c) => add(c));\n return;\n }\n // if (registeredMaps.has(map.id)) {\n // console.warn(`[NQTR] Map id ${map.id} already exists, it will be overwritten`);\n // }\n registeredMaps.set(map.id, map);\n }\n\n /**\n * Get a map by its id.\n * @param id The id of the map.\n * @returns The map or undefined if not found.\n */\n export function get(id: string): MapInterface | undefined {\n try {\n let map = registeredMaps.get(id);\n if (!map) {\n console.warn(`[NQTR] Map ${id} not found, you should register it first`);\n return;\n }\n return map;\n } catch (e) {\n logger.error(`Error while getting Map ${id}`, e);\n return;\n }\n }\n\n /**\n * Get a list of all maps registered.\n * @returns An array of maps.\n */\n export function values(): MapInterface[] {\n return Array.from(registeredMaps.values());\n }\n\n /**\n * Check if a map is registered.\n * @param id The id of the map.\n * @returns True if the map is registered, false otherwise.\n */\n export function has(id: string): boolean {\n return registeredMaps.has(id);\n }\n}\nexport default RegisteredMaps;\n","import { CachedMap } from \"@drincs/pixi-vn\";\nimport { QuestInterface } from \"../interface\";\nimport { logger } from \"../utils/log-utility\";\n\n/**\n * A Map that contains all quests registered and available to be used.\n * The key is the id of the quest and the value is the quest itself.\n */\nconst registeredQuests = new CachedMap<string, QuestInterface>({ cacheSize: 5 });\n\nnamespace RegisteredQuest {\n /**\n * Save a quest in the registered quests. If the quest already exists, it will be overwritten.\n * @param quest The quest to save.\n * @returns\n */\n export function add(quests: QuestInterface | QuestInterface[]) {\n if (Array.isArray(quests)) {\n quests.forEach((quest) => RegisteredQuest.add(quest));\n return;\n }\n registeredQuests.set(quests.id, quests);\n }\n /**\n * Get a quest by its id.\n * @param id The id of the quest.\n * @returns The quest or undefined if not found.\n */\n export function get(id: string): QuestInterface | undefined {\n try {\n let quest = registeredQuests.get(id);\n if (!quest) {\n console.warn(`[NQTR] Quest ${id} not found, you should register it first`);\n return;\n }\n return quest;\n } catch (e) {\n logger.error(`Error while getting Quest ${id}`, e);\n return;\n }\n }\n /**\n * Get a list of all quests registered.\n * @returns An array of quests.\n */\n export function values(): QuestInterface[] {\n return Array.from(registeredQuests.values());\n }\n /**\n * Check if a quest is registered.\n * @param id The id of the quest.\n * @returns True if the quest is registered, false otherwise.\n */\n export function has(id: string): boolean {\n return registeredQuests.has(id);\n }\n}\nexport default RegisteredQuest;\n","import { CachedMap } from \"@drincs/pixi-vn\";\nimport { RoomInterface } from \"../interface\";\nimport { logger } from \"../utils/log-utility\";\nimport RegisteredLocations from \"./RegisteredLocations\";\nimport RegisteredMaps from \"./RegisteredMaps\";\n\n/**\n * A Map that contains all rooms registered and available to be used.\n * The key is the id of the room and the value is the room itself.\n */\nconst registeredRooms = new CachedMap<string, RoomInterface>({ cacheSize: 20 });\n\nnamespace RegisteredRooms {\n /**\n * Save a room in the registered rooms, and their location and map if they are not already registered.\n * If the room already exists, it will be overwritten.\n * @param room The room to save.\n * @returns\n */\n export function add(room: RoomInterface | RoomInterface[]) {\n if (Array.isArray(room)) {\n room.forEach((c) => add(c));\n return;\n }\n registeredRooms.set(room.id, room);\n let location = room.location;\n RegisteredLocations.add(location);\n let map = location?.map;\n if (map) {\n RegisteredMaps.add(map);\n }\n }\n\n /**\n * Get a room by its id.\n * @param id The id of the room.\n * @returns The room or undefined if not found.\n */\n export function get(id: string): RoomInterface | undefined {\n try {\n let room = registeredRooms.get(id);\n if (!room) {\n console.warn(`[NQTR] Room ${id} not found, you should register it first`);\n return;\n }\n return room;\n } catch (e) {\n logger.error(`Error while getting Room ${id}`, e);\n return;\n }\n }\n\n /**\n * Get a list of all rooms registered.\n * @returns An array of rooms.\n */\n export function values(): RoomInterface[] {\n return Array.from(registeredRooms.values());\n }\n\n /**\n * Check if a room is registered.\n * @param id The id of the room.\n * @returns True if the room is registered, false otherwise.\n */\n export function has(id: string): boolean {\n return registeredRooms.has(id);\n }\n}\nexport default RegisteredRooms;\n","import { storage } from \"@drincs/pixi-vn/storage\";\nimport { LATEST_EVENT_MEMORY_KEY } from \"../constants\";\nimport LastEventType from \"../types/LastEventType\";\n\nexport function setLastEvent(event: LastEventType) {\n storage.set(LATEST_EVENT_MEMORY_KEY, event);\n}\nexport function getLastEvent() {\n return storage.get<LastEventType>(LATEST_EVENT_MEMORY_KEY);\n}\n","import { storage } from \"@drincs/pixi-vn/storage\";\nimport { CURRENT_ROOM_MEMORY_KEY } from \"../constants\";\nimport { RegisteredLocations, RegisteredMaps, RegisteredRooms } from \"../decorators\";\nimport { setLastEvent } from \"../functions/tracking-changes\";\nimport { LocationInterface, MapInterface, RoomInterface } from \"../interface\";\nimport { logger } from \"../utils/log-utility\";\n\nexport default class NavigatorManager {\n get rooms() {\n return RegisteredRooms.values();\n }\n get locations() {\n return RegisteredLocations.values();\n }\n get maps() {\n return RegisteredMaps.values();\n }\n get currentRoomId(): string | undefined {\n return storage.get<string>(CURRENT_ROOM_MEMORY_KEY);\n }\n get currentRoom(): RoomInterface | undefined {\n let roomId = this.currentRoomId;\n if (!roomId) {\n logger.error(`The current room has not yet been set`);\n return;\n }\n let room = RegisteredRooms.get(roomId);\n if (!room) {\n logger.error(`Current room ${roomId} not found`);\n return;\n }\n return room;\n }\n set currentRoom(room: RoomInterface | string) {\n if (typeof room !== \"string\") {\n room = room.id;\n }\n let roomRegistrated = RegisteredRooms.get(room);\n if (!roomRegistrated) {\n logger.error(`The room ${room} is not registered, so it can't be set as current room`);\n return;\n }\n let prevRoom = storage.get<string>(CURRENT_ROOM_MEMORY_KEY);\n if (prevRoom === room) {\n return;\n }\n\n setLastEvent({\n type: \"editroom\",\n prev: prevRoom,\n value: room,\n });\n storage.set(CURRENT_ROOM_MEMORY_KEY, room);\n }\n get currentLocation(): LocationInterface | undefined {\n return this.currentRoom?.location;\n }\n get currentMap(): MapInterface | undefined {\n return this.currentRoom?.location.map;\n }\n /**\n * Clear all the expired activities.\n */\n clearExpiredActivities() {\n RegisteredRooms.values().forEach((room) => {\n room.clearExpiredActivities();\n });\n }\n}\n","import type { CharacterInterface } from \"@drincs/pixi-vn\";\nimport { storage } from \"@drincs/pixi-vn/storage\";\nimport RegisteredCommitments, { fixedCommitments, registeredCommitments } from \"../decorators/RegisteredCommitments\";\nimport { CommitmentInterface } from \"../interface\";\nimport { logger } from \"../utils/log-utility\";\n\nconst TEMPORARY_COMMITMENT_CATEGORY_MEMORY_KEY = \"___nqtr-temporary_commitment___\";\nexport default class RoutineManager {\n get fixedRoutine(): CommitmentInterface[] {\n return [...fixedCommitments.values()];\n }\n /**\n * Set a commitment as fixed, it will be always available. They cannot be deleted or edit during the game session.\n */\n set fixedRoutine(commitments: CommitmentInterface[]) {\n commitments.forEach((c) => {\n if (fixedCommitments.has(c.id)) {\n console.warn(`[NQTR] Commitment id ${c.id} already exists, it will be overwritten`);\n }\n fixedCommitments.set(c.id, c);\n });\n }\n\n /**\n * Get the temporary commitments by its id.\n * @returns The temporary commitments.\n */\n get temporaryRoutine(): CommitmentInterface[] {\n let commitmentsIds = storage.get<string[]>(TEMPORARY_COMMITMENT_CATEGORY_MEMORY_KEY);\n if (!commitmentsIds) {\n return [];\n }\n let commitments = commitmentsIds\n .map((id) => RegisteredCommitments.get(id))\n .filter((commitment) => commitment !== undefined);\n return commitments;\n }\n\n get allRoutine(): CommitmentInterface[] {\n return [...this.fixedRoutine, ...this.temporaryRoutine];\n }\n\n /**\n * This feature adds the commitments during the game session.\n * @param commitment The commitment or commitments to add.\n */\n add(commitment: CommitmentInterface[] | CommitmentInterface) {\n if (!Array.isArray(commitment)) {\n commitment = [commitment];\n }\n let commitmentsIds = commitment\n .map((commitment) => {\n let commitmentTest = RegisteredCommitments.get(commitment.id);\n if (!commitmentTest) {\n console.warn(`[NQTR] Commitment ${commitment.id} not found, it will be ignored`);\n return undefined;\n }\n return commitment.id;\n })\n .filter((id) => id !== undefined);\n\n storage.set(TEMPORARY_COMMITMENT_CATEGORY_MEMORY_KEY, commitmentsIds);\n }\n\n /**\n * Get the commitments added during the game session.\n * @param id The id of the commitment.\n * @returns The commitment or undefined if not found.\n */\n find(id: string): CommitmentInterface | undefined {\n return RegisteredCommitments.get(id);\n }\n\n /**\n * Remove the commitments added during the game session.\n * @param commitment The commitment or commitments to remove.\n */\n remove(commitment: CommitmentInterface[] | CommitmentInterface) {\n if (!Array.isArray(commitment)) {\n commitment = [commitment];\n }\n let commitmentsIds = commitment.map((commitment) => {\n return commitment.id;\n });\n\n let currentCommitments = storage.get<string[]>(TEMPORARY_COMMITMENT_CATEGORY_MEMORY_KEY);\n if (!currentCommitments) {\n return;\n }\n currentCommitments = currentCommitments.filter((id) => !commitmentsIds.includes(id));\n storage.set(TEMPORARY_COMMITMENT_CATEGORY_MEMORY_KEY, currentCommitments);\n }\n\n /**\n * Clear all the expired commitments.\n */\n clearExpiredRoutine() {\n RegisteredCommitments.values().forEach((commitment) => {\n if (commitment.expired) {\n registeredCommitments.delete(commitment.id);\n }\n });\n }\n\n /**\n * Get the current commitments. The hidden commitments are not included.\n * In case there is a character who has two or more commitments at the same time, will be selected the commitment with the highest priority.\n * Higher priority commitments are calculated using the following steps:\n * 1. The commitments that have Commitments BaseModel.priority set to a higher value will be selected first.\n * 2. If there are commitments with the same priority, the commitments that are not fixed will be selected first.\n * 3. If there are commitments with the same priority and the same fixed status, priority will be given to the commitment with a lower index.\n * @returns The current commitments.\n */\n get currentRoutine(): CommitmentInterface[] {\n let character_commitments: { [character: string]: CommitmentInterface } = {};\n [...this.fixedRoutine, ...this.temporaryRoutine].forEach((c) => {\n if (c.isActive) {\n if (c.characters.length > 0) {\n // all the characters don't already have commitments or the commitment has a higher priority\n let allAvailable = c.characters.every(\n (ch) => !character_commitments[ch.id] || c.priority > character_commitments[ch.id].priority\n );\n if (allAvailable) {\n c.characters.forEach((ch) => {\n character_commitments[ch.id] = c;\n });\n }\n } else {\n logger.error(`The commitment ${c.id} has no characters assigned`);\n }\n }\n });\n return Object.values(character_commitments);\n }\n\n /**\n * Get the character commitment.\n * @param character The character.\n * @returns The commitment or undefined if not found.\n */\n getCommitmentByCharacter(character: CharacterInterface): CommitmentInterface | undefined {\n this.currentRoutine.forEach((c) => {\n if (c.characters.map((ch) => ch.id).includes(character.id)) {\n return c;\n }\n });\n return undefined;\n }\n}\n","import { TimeSettings, TimeSlotInterface } from \"../types/TimeSettings\";\n\nexport default class TimeManagerSettings implements TimeSettings {\n static dayStartTime: number = 0;\n static dayEndTime: number = 24;\n static defaultTimeSpent: number = 1;\n static timeSlots: TimeSlotInterface[] = [];\n static weekLength: number = 7;\n static weekendStartDay: number = this.weekLength - 1;\n static getDayName?: (weekDayNumber: number) => string;\n}\n","import { storage } from \"@drincs/pixi-vn/storage\";\nimport { TIME_DATA_KEY } from \"../constants\";\nimport { setLastEvent } from \"../functions/tracking-changes\";\nimport TimeDataType from \"../types/TimeDataType\";\nimport { TimeSettings, TimeSlotInterface } from \"../types/TimeSettings\";\nimport TimeManagerSettings from \"./TimeManagerSettings\";\n\nexport default class TimeManager {\n initialize(settings: TimeSettings) {\n const {\n dayStartTime = 0,\n dayEndTime = 24,\n defaultTimeSpent = 1,\n timeSlots = [],\n weekLength = 7,\n weekendStartDay = weekLength - 1,\n getDayName,\n } = settings;\n TimeManagerSettings.dayStartTime = dayStartTime;\n TimeManagerSettings.dayEndTime = dayEndTime;\n TimeManagerSettings.defaultTimeSpent = defaultTimeSpent;\n TimeManagerSettings.timeSlots = timeSlots;\n TimeManagerSettings.weekLength = weekLength;\n if (weekendStartDay >= TimeManagerSettings.weekLength) {\n console.warn(`[NQTR] Weekend start day should be less than week length ${weekLength}, so will be ignored`);\n } else {\n TimeManagerSettings.weekendStartDay = weekendStartDay;\n }\n TimeManagerSettings.getDayName = getDayName;\n }\n get dayStartTime(): number {\n return TimeManagerSettings.dayStartTime;\n }\n get dayEndTime(): number {\n return TimeManagerSettings.dayEndTime;\n }\n get defaultTimeSpent(): number {\n return TimeManagerSettings.defaultTimeSpent;\n }\n get timeSlots(): TimeSlotInterface[] {\n return TimeManagerSettings.timeSlots;\n }\n get weekLength(): number {\n return TimeManagerSettings.weekLength;\n }\n get weekendStartDay(): number {\n return TimeManagerSettings.weekendStartDay;\n }\n /**\n * Week days name\n * @param weekDayNumber The current week day number (from: 0 - to: {@link weekLength} - 1).\n * @returns The name of the week day.\n * @example\n * ```ts\n * (weekDayNumber: number) => {\n * const weekDaysNames = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'];\n * return weekDaysNames[weekDayNumber];\n * }\n * ```\n */\n get getDayName() {\n return TimeManagerSettings.getDayName;\n }\n\n /**\n * Get the current time. Time is a numeric variable used to determine and manage time during a day/date.\n * It's recommended to use currentTime as if it were the current time. If you also want to manage minutes, you can use a float value.\n */\n get currentTime(): number {\n let data = storage.get<TimeDataType>(TIME_DATA_KEY) || {};\n if (data.hasOwnProperty(\"currentTime\") && typeof data.currentTime === \"number\") {\n return data.currentTime;\n }\n return this.dayStartTime;\n }\n set currentTime(value: number | undefined) {\n let prev = storage.get<TimeDataType>(TIME_DATA_KEY) || {};\n let data = { ...prev };\n if (typeof value === \"number\") {\n data.currentTime = value;\n } else {\n delete data.currentTime;\n }\n setLastEvent({\n type: \"edittime\",\n prev: prev,\n value: data,\n });\n storage.set(TIME_DATA_KEY, data);\n }\n /**\n * Get the current date. Date is a numeric variable used to determine and manage the number of days passed.\n * It's recommended to use currentDate as if it were the current day.\n */\n get currentDate(): number {\n let data = storage.get<TimeDataType>(TIME_DATA_KEY) || {};\n if (data.hasOwnProperty(\"currentDate\") && typeof data.currentDate === \"number\") {\n return data.currentDate;\n }\n return 0;\n }\n set currentDate(value: number | undefined) {\n let prev = storage.get<TimeDataType>(TIME_DATA_KEY) || {};\n let data = { ...prev };\n if (typeof value === \"number\") {\n data.currentDate = value;\n } else {\n delete data.currentDate;\n }\n setLastEvent({\n type: \"edittime\",\n prev: prev,\n value: data,\n });\n storage.set(TIME_DATA_KEY, data);\n }\n /**\n * If the current day is greater than or equal to the weekend start day, then it will return true.\n */\n get isWeekend(): boolean {\n return this.currentWeekDayNumber >= this.weekendStartDay;\n }\n /**\n * Get the current week day number (from: 1 - to: {@link weekLength}).\n * For example, if the week length is 7 and the current day is 10, then the result will be 4.\n */\n get currentWeekDayNumber(): number {\n let result = this.currentDate % this.weekLength;\n return result + 1;\n }\n /**\n * Get the current week day name. If the week days names are not defined, then it will return undefined.\n * For example, if the week days names are ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'] and the current day is 10, then the result will be 'Thursday'.\n * @default \"\"\n */\n get currentDayName(): string {\n if (!this.getDayName) {\n console.warn(`[NQTR] Week days names are not defined, so currentDayName will be empty`);\n return \"\";\n }\n return this.getDayName(this.currentWeekDayNumber - 1);\n }\n /**\n * Get the current {@link timeSlots} index.\n * You can use this property to create \"Image that changes based on the time period\":\n * @example\n * ```tsx\n * import { weekLength } from '@drincs/nqtr';\n *\n * function changeBackground() {\n * return (\n * <img src={`background-currentTimeSlot.currentTimeSlot.png`} />\n * )\n * }\n */\n get currentTimeSlot(): number {\n if (this.timeSlots.length === 0) {\n console.warn(\"[NQTR] Time slots are not defined\");\n return 0;\n }\n for (let index = 0; index < this.timeSlots.length; index++) {\n let slot = this.timeSlots[index];\n if (this.timeSlots.length > index + 1) {\n if (this.nowIsBetween(slot.startTime, this.timeSlots[index + 1].startTime)) {\n return index;\n }\n }\n }\n return this.timeSlots.length - 1;\n }\n\n /**\n * This function will increase the current time by the given time spent.\n * If the new time is greater than or equal to the max day times, then it will increase the day and set the new time.\n * @param delta is the time spent in times (default: {@link defaultTimeSpent})\n * @returns currentTimeSlot.currentTime\n */\n increaseTime(delta: number = this.defaultTimeSpent): number {\n let newTime = this.currentTime + delta;\n if (newTime >= this.dayEndTime) {\n this.increaseDate();\n newTime = this.dayStartTime + (newTime - this.dayEndTime);\n }\n this.currentTime = newTime;\n return this.currentTime;\n }\n\n /**\n * This function will increase the current date by the given delta.\n * @param delta is the number of days to increase (default: 1)\n * @param time is the time of the new day (default: {@link dayStartTime})\n * @returns timeTracker.currentDate\n */\n increaseDate(delta: number = 1, time: number = this.dayStartTime): number {\n let newDate = this.currentDate + delta;\n this.currentDate = newDate;\n this.currentTime = time;\n return this.currentDate;\n }\n\n /**\n * This function will check if the current time is between the given times.\n * @param fromTime the starting time. If the {@link currentTime} is equal to this time, the function will return true.\n * @param toTime the ending time.\n * @returns true if the current time is between the given times, otherwise false.\n */\n nowIsBetween(fromTime: number | undefined, toTime: number | undefined): boolean {\n if (fromTime === undefined) {\n fromTime = this.dayStartTime - 1;\n }\n if (toTime === undefined) {\n toTime = this.dayEndTime + 1;\n }\n let currentTime = this.currentTime;\n if (fromTime < toTime) {\n return currentTime >= fromTime && currentTime < toTime;\n }\n return currentTime >= fromTime || currentTime < toTime;\n }\n}\n","import NavigatorManager from \"./NavigatorManager\";\nimport QuestManager from \"./QuestManager\";\nimport RoutineManager from \"./RoutineManager\";\nimport { default as TimeManager } from \"./TimeManager\";\n\nconst timeTracker = new TimeManager();\nconst navigator = new NavigatorManager();\nconst routine = new RoutineManager();\nconst questsNotebook = new QuestManager();\n\nexport { navigator, questsNotebook, routine, timeTracker };\n","import { narration } from \"@drincs/pixi-vn/narration\";\nimport { StoredClassModel } from \"@drincs/pixi-vn/storage\";\nimport { ActivityInterface } from \"../interface\";\nimport { ActivityBaseInternalInterface } from \"../interface/ActivityInterface\";\nimport DateSchedulingInterface from \"../interface/DateSchedulingInterface\";\nimport TimeSchedulingInterface from \"../interface/TimeSchedulingInterface\";\nimport { timeTracker } from \"../managers\";\nimport { OnRunAsyncFunction, OnRunEvent } from \"../types\";\n\nexport interface ActivityStoredClassProps {\n /**\n * Time slot in which activity/commitment will be active.\n */\n timeSlot?: TimeSchedulingInterface;\n /**\n * Used to schedule what date it will be added and removed.\n */\n dateScheduling?: DateSchedulingInterface;\n}\n\nconst ACTIVITY_CATEGORY = \"__nqtr-activity__\";\nexport default class ActivityStoredClass<OnRunEventType = ActivityInterface>\n extends StoredClassModel\n implements ActivityBaseInternalInterface\n{\n constructor(\n id: string,\n private readonly _onRun: OnRunEvent<OnRunEventType>,\n props: ActivityStoredClassProps,\n category: string = ACTIVITY_CATEGORY\n ) {\n super(category, id);\n this._timeSlot = props.timeSlot;\n this._dateScheduling = props.dateScheduling;\n }\n\n private _timeSlot?: TimeSchedulingInterface;\n get timeSlot(): TimeSchedulingInterface | undefined {\n return this._timeSlot;\n }\n\n private _dateScheduling?: DateSchedulingInterface;\n get dateScheduling(): DateSchedulingInterface | undefined {\n return this._dateScheduling;\n }\n\n protected addTempHistoryItem() {\n narration.addCurrentStepToHistory();\n }\n get run(): OnRunAsyncFunction {\n return async (props) => {\n this.addTempHistoryItem();\n return await this._onRun(this as any, props);\n };\n }\n\n get expired(): boolean {\n if (this.dateScheduling?.to && this.dateScheduling.to <= timeTracker.currentDate) {\n return true;\n }\n return false;\n }\n\n get isActive(): boolean {\n if (this.dateScheduling?.from && this.dateScheduling.from > timeTracker.currentDate) {\n return false;\n }\n if (this.dateScheduling?.to && this.dateScheduling.to < timeTracker.currentDate) {\n return false;\n }\n if (!timeTracker.nowIsBetween(this.timeSlot?.from, this.timeSlot?.to)) {\n return false;\n }\n return true;\n }\n}\n","import { storage } from \"@drincs/pixi-vn/storage\";\nimport { ActivityInterface, ActivityProps } from \"../interface\";\nimport { OnRunEvent } from \"../types/OnRunEvent\";\nimport ActivityStoredClass from \"./ActivityStoredClass\";\n\n/**\n * The activity model. It is used to create an activity.\n * @example\n * ```tsx\n * export const nap = new ActivityModel(\"nap\",\n * (_, event) => {\n * if (event) {\n * event.navigate(\"/game\")\n * callLabelWithGoNavigationCallBack(napLabel, event)\n * }\n * else {\n * console.error(\"Event is undefined\")\n * }\n * },\n * {\n * name: \"Nap\",\n * timeSlot: {\n * from: 5,\n * to: 23,\n * },\n * icon: \"https://icon.jpg\",\n * }\n * )\n * ```\n */\nexport default class ActivityBaseModel extends ActivityStoredClass<ActivityInterface> {\n /**\n * @param id The activity id, that must be unique.\n * @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.\n * @param props The activity properties.\n */\n constructor(id: string, onRun: OnRunEvent<ActivityInterface>, props: ActivityProps) {\n super(id, onRun, {\n dateScheduling: props.dateScheduling,\n timeSlot: props.timeSlot,\n });\n this.defaultName = props.name || \"\";\n this.defaultDisabled = props.disabled || false;\n this.defaultHidden = props.hidden || false;\n this._icon = props.renderIcon;\n }\n\n private defaultName: string;\n /**\n * The name of the activity.\n */\n get name(): string {\n return this.getStorageProperty<string>(\"name\") || this.defaultName;\n }\n set name(value: string | undefined) {\n this.setStorageProperty(\"name\", value);\n }\n\n private defaultDisabled: boolean | string;\n /**\n * Whether is disabled. If it is a string, it is a Pixi'VN flag name.\n */\n get disabled(): boolean {\n let value = this.getStorageProperty<boolean>(\"disabled\") || this.defaultDisabled;\n if (typeof value === \"string\") {\n return storage.getFlag(value);\n }\n return value;\n }\n set disabled(value: boolean | string) {\n this.setStorageProperty(\"disabled\", value);\n }\n\n private defaultHidden: boolean | string;\n /**\n * Whether is hidden. If it is a string, it is a Pixi'VN flag name.\n */\n get hidden(): boolean {\n let value = this.getStorageProperty<boolean>(\"hidden\") || this.defaultHidden;\n if (typeof value === \"string\") {\n return storage.getFlag(value);\n }\n return value;\n }\n set hidden(value: boolean | string) {\n this.setStorageProperty(\"hidden\", value);\n }\n\n private _icon?: string;\n /**\n * The icon of the activity.\n */\n get icon(): string | undefined {\n return this._icon;\n }\n}\n","import type { CharacterInterface } from \"@drincs/pixi-vn\";\nimport { storage } from \"@drincs/pixi-vn/storage\";\nimport { CURRENT_ROOM_MEMORY_KEY, TIME_DATA_KEY } from \"../constants\";\nimport { getLastEvent } from \"../functions/tracking-changes\";\nimport { CommitmentInterface, RoomInterface } from \"../interface\";\nimport { CommitmentBaseInternalInterface } from \"../interface/CommitmentInterface\";\nimport DateSchedulingInterface from \"../interface/DateSchedulingInterface\";\nimport TimeSchedulingInterface from \"../interface/TimeSchedulingInterface\";\nimport { navigator } from \"../managers\";\nimport { ExecutionType } from \"../types\";\nimport { OnRunEvent } from \"../types/OnRunEvent\";\nimport TimeDataType from \"../types/TimeDataType\";\nimport ActivityStoredClass from \"./ActivityStoredClass\";\n\nexport interface CommitmentStoredClassProps {\n /**\n * Execution type. If is \"automatic\" the onRun() runned automatically when the palayer is in the room. If is \"interaction\" the player must interact with the character to run the onRun() function.\n * If you set \"automatic\" remember to remove the commitment when it is no longer needed, because otherwise it repeats itself every time.\n */\n executionType?: ExecutionType;\n /**\n * The priority. The higher the number, the higher the priority.\n * To ensure that a character is not in 2 places at the same time, if there are 2 or more valid commits at the same time and with the same character, the one with the highest priority will be chosen.\n */\n priority?: number;\n /**\n * Time slot in which activity/commitment will be active.\n */\n timeSlot?: TimeSchedulingInterface;\n /**\n * Used to schedule what date it will be added and removed.\n */\n dateScheduling?: DateSchedulingInterface;\n}\n\nconst COMMITMENT_CATEGORY = \"__nqtr-commitment__\";\nexport default class CommitmentStoredClass\n extends ActivityStoredClass<CommitmentInterface>\n implements CommitmentBaseInternalInterface\n{\n constructor(\n id: string,\n private readonly _characters: CharacterInterface[],\n private readonly _room: RoomInterface,\n onRun: OnRunEvent<CommitmentInterface> | undefined,\n props: CommitmentStoredClassProps\n ) {\n onRun = onRun || (() => {});\n super(id, onRun, props, COMMITMENT_CATEGORY);\n this.defaultExecutionType = props.executionType || \"interaction\";\n this.defaultPriority = props.priority;\n }\n private readonly defaultExecutionType: ExecutionType;\n private readonly defaultPriority?: number;\n\n get characters(): CharacterInterface[] {\n return this._characters;\n }\n\n get room(): RoomInterface {\n return this._room;\n }\n\n get executionType(): ExecutionType {\n return this.getStorageProperty<ExecutionType>(\"executionType\") || this.defaultExecutionType;\n }\n set executionType(value: ExecutionType) {\n this.setStorageProperty(\"executionType\", value);\n }\n\n get priority(): number {\n return this.getStorageProperty<number>(\"priority\") || this.defaultPriority || 0;\n }\n set priority(value: number) {\n this.setStorageProperty(\"priority\", value);\n }\n protected override addTempHistoryItem(): void {\n let currentRoom = navigator.currentRoom;\n if (!currentRoom || this.executionType !== \"automatic\") {\n return super.addTempHistoryItem();\n }\n let lastEvent = getLastEvent();\n switch (lastEvent?.type) {\n case \"editroom\":\n storage.set(CURRENT_ROOM_MEMORY_KEY, lastEvent.prev);\n super.addTempHistoryItem();\n storage.set(CURRENT_ROOM_MEMORY_KEY, currentRoom.id);\n break;\n case \"edittime\":\n let currentTime = storage.get<TimeDataType>(TIME_DATA_KEY) || {};\n storage.set(TIME_DATA_KEY, lastEvent.prev);\n super.addTempHistoryItem();\n storage.set(TIME_DATA_KEY, currentTime);\n break;\n }\n }\n}\n","import type { CharacterInterface } from \"@drincs/pixi-vn\";\nimport { storage } from \"@drincs/pixi-vn/storage\";\nimport { CommitmentProps, RoomInterface } from \"../interface\";\nimport { timeTracker } from \"../managers\";\nimport CommitmentStoredClass from \"./CommitmentStoredClass\";\n\n/**\n * The base model of a commitment. I suggest you extend this class to create your own commitment model.\n * You must use the saveRoom function to save the commitment in the registered commitments.\n * @example\n * ```ts\n * export const mcRoom = new CommitmentBaseModel(\"test\", character, room, {\n * name: \"Test\",\n * image: \"https://image.jpg\",\n * executionType: ExecutionTypeEnum.INTERACTION,\n * onRun: (commitment) => {\n * // Do something\n * }\n * })\n * saveCommitment(mcRoom)\n * ```\n */\nexport default class CommitmentBaseModel extends CommitmentStoredClass {\n /**\n * @param id The id of the commitment, it must be unique.\n * @param character The character or characters that are in the commitment and so in the room.\n * @param room The room where the commitment is.\n * @param props The properties of the commitment.\n */\n constructor(\n id: string,\n character: CharacterInterface | CharacterInterface[] | undefined,\n room: RoomInterface,\n props: CommitmentProps\n ) {\n super(id, character ? (Array.isArray(character) ? character : [character]) : [], room, props.onRun, {\n executionType: props.executionType,\n priority: props.priority,\n timeSlot: props.timeSlot,\n dateScheduling: props.dateScheduling,\n });\n this._name = props.name || \"\";\n this._image = props.image;\n this.defaultDisabled = props.disabled || false;\n this.defaultHidden = props.hidden || false;\n this._icon = props.icon;\n }\n\n private _name: string;\n /**\n * The name of the commitment.\n */\n get name(): string {\n return this._name;\n }\n\n private _image?: string;\n /**\n * The image of the commitment.\n */\n get image(): string | undefined {\n return this._image;\n }\n\n private _icon?: string;\n /**\n * The icon of the commitment.\n */\n get icon(): string | undefined {\n return this._icon;\n }\n\n private defaultDisabled: boolean | string;\n /**\n * Whether is disabled. You can also pass a Pixi'VN flag name.\n */\n get disabled(): boolean {\n let value = this.getStorageProperty<boolean>(\"disabled\") || this.defaultDisabled;\n if (typeof value === \"string\") {\n return storage.getFlag(value);\n }\n return value;\n }\n set disabled(value: boolean | string) {\n this.setStorageProperty(\"disabled\", value);\n }\n\n private defaultHidden: boolean | string;\n /**\n * Whether is hidden. You can also pass a Pixi'VN flag name.\n */\n get hidden(): boolean {\n if (this.dateScheduling?.from && this.dateScheduling.from > timeTracker.currentDate) {\n return true;\n }\n if (!timeTracker.nowIsBetween(this.timeSlot?.from, this.timeSlot?.to)) {\n return true;\n }\n if (!this.expired) {\n return true;\n }\n let value = this.getStorageProperty<boolean>(\"hidden\") || this.defaultHidden;\n if (typeof value === \"string\") {\n return storage.getFlag(value);\n }\n return value;\n }\n set hidden(value: boolean | string) {\n this.setStorageProperty(\"hidden\", value);\n }\n}\n","import { StoredClassModel } from \"@drincs/pixi-vn/storage\";\nimport { RegisteredActivities } from \"../../decorators\";\nimport { ActivityInterface } from \"../../interface\";\nimport DateSchedulingInterface from \"../../interface/DateSchedulingInterface\";\nimport NavigationAbstractInterface from \"../../interface/navigation/NavigationAbstractClass\";\nimport TimeSchedulingInterface from \"../../interface/TimeSchedulingInterface\";\nimport { timeTracker } from \"../../managers\";\n\ntype ActiveScheduling = {\n timeSlot?: Partial<TimeSchedulingInterface>;\n dateScheduling?: Partial<DateSchedulingInterface>;\n};\ntype ExcludedScheduling = {\n dateScheduling?: Pick<DateSchedulingInterface, \"to\">;\n};\n\nexport default abstract class NavigationAbstractClass extends StoredClassModel implements NavigationAbstractInterface {\n constructor(categoryId: string, id: string, private defaultActivities: ActivityInterface[] = []) {\n super(categoryId, id);\n }\n private get defaultActivitiesIds(): string[] {\n return this.defaultActivities.map((activity) => activity.id);\n }\n private get activeActivityScheduling(): { [activityId: string]: ActiveScheduling } {\n return this.getStorageProperty<{ [activityId: string]: ActiveScheduling }>(`activeActivityScheduling`) || {};\n }\n private get excludedActivitiesScheduling(): { [activityId: string]: ExcludedScheduling } {\n return (\n this.getStorageProperty<{ [activityId: string]: ExcludedScheduling }>(`excludedActivitiesScheduling`) || {}\n );\n }\n private removeActivityScheduling(activityId: string) {\n let activeActivityScheduling = this.activeActivityScheduling;\n delete activeActivityScheduling[activityId];\n this.setStorageProperty(`activeActivityScheduling`, activeActivityScheduling);\n let excludedActivitiesScheduling = this.excludedActivitiesScheduling;\n delete excludedActivitiesScheduling[activityId];\n this.setStorageProperty(`excludedActivitiesScheduling`, excludedActivitiesScheduling);\n }\n private editActivityScheduling(activityId: string, scheduling: ActiveScheduling) {\n this.removeActivityScheduling(activityId);\n let activeActivityScheduling = this.activeActivityScheduling;\n activeActivityScheduling[activityId] = scheduling;\n this.setStorageProperty(`activeActivityScheduling`, activeActivityScheduling);\n }\n private editExcludedActivityScheduling(activityId: string, scheduling: ExcludedScheduling) {\n this.removeActivityScheduling(activityId);\n let excludedActivitiesScheduling = this.excludedActivitiesScheduling;\n excludedActivitiesScheduling[activityId] = scheduling;\n this.setStorageProperty(`excludedActivitiesScheduling`, excludedActivitiesScheduling);\n }\n private get additionalActivitiesIds(): string[] {\n return this.getStorageProperty<string[]>(`additionalActivitiesIds`) || [];\n }\n private get excludedActivitiesIds(): string[] {\n return this.getStorageProperty<string[]>(`excludedActivitiesIds`) || [];\n }\n get activitiesIds(): string[] {\n return this.additionalActivitiesIds.concat(this.defaultActivitiesIds);\n }\n addActivity(\n activity: ActivityInterface,\n options: {\n timeSlot?: TimeSchedulingInterface;\n dateScheduling?: DateSchedulingInterface;\n } = {}\n ) {\n const { timeSlot, dateScheduling } = options;\n const { to: toTime = timeTracker.dayEndTime + 1 } = timeSlot || {};\n if (timeSlot) {\n if (timeSlot.from >= toTime) {\n throw new Error(`[NQTR] The from time must be less than the to time.`);\n }\n }\n if (\n dateScheduling?.from !== undefined &&\n dateScheduling?.to !== undefined &&\n dateScheduling?.from >= dateScheduling?.to\n ) {\n throw new Error(`[NQTR] The from day/date must be less than the to day/date.`);\n }\n\n if (this.defaultActivitiesIds.includes(activity.id)) {\n console.warn(`[NQTR] Activity with id ${activity.id} already exists, so it will be ignored.`);\n return;\n }\n let additionalActivitiesIds = this.additionalActivitiesIds;\n if (additionalActivitiesIds.includes(activity.id)) {\n console.warn(`[NQTR] Activity with id ${activity.id} already exists, so it will be ignored.`);\n } else {\n additionalActivitiesIds.push(activity.id);\n this.setStorageProperty(`additionalActivitiesIds`, additionalActivitiesIds);\n }\n\n if (this.excludedActivitiesIds.includes(activity.id)) {\n this.removeActivityScheduling(activity.id);\n console.log(\n `[NQTR] Activity with id ${activity.id} was excluded, so it will be associated with this class again.`\n );\n }\n\n if (timeSlot || dateScheduling) {\n this.editActivityScheduling(activity.id, {\n timeSlot: timeSlot,\n dateScheduling: dateScheduling,\n });\n }\n }\n removeActivity(activity: ActivityInterface | string, options: Pick<DateSchedulingInterface, \"to\"> = {}) {\n const { to } = options;\n const activityId = typeof activity === \"string\" ? activity : activity.id;\n\n let additionalActivitiesIds = this.additionalActivitiesIds;\n if (additionalActivitiesIds.includes(activityId)) {\n if (to !== undefined) {\n this.editExcludedActivityScheduling(activityId, {\n dateScheduling: { to },\n });\n return;\n }\n additionalActivitiesIds = additionalActivitiesIds.filter((id) => id !== activityId);\n this.setStorageProperty(`additionalActivitiesIds`, additionalActivitiesIds);\n this.removeActivityScheduling(activityId);\n } else if (this.defaultActivitiesIds.includes(activityId)) {\n if (to !== undefined) {\n this.editExcludedActivityScheduling(activityId, {\n dateScheduling: { to },\n });\n return;\n }\n let excludedActivitiesIds = this.excludedActivitiesIds;\n excludedActivitiesIds.push(activityId);\n this.setStorageProperty(`excludedActivitiesIds`, excludedActivitiesIds);\n } else {\n console.warn(`[NQTR] Activity with id ${activityId} not found, so it will be ignored.`);\n }\n }\n clearExpiredActivities() {\n let activeActivityScheduling = this.activeActivityScheduling;\n let excludedActivitiesScheduling = this.excludedActivitiesScheduling;\n let additionalActivitiesIds = this.additionalActivitiesIds;\n let excludedActivitiesIds = this.excludedActivitiesIds;\n\n additionalActivitiesIds.forEach((activityId) => {\n if (activityId in activeActivityScheduling) {\n let { to: toDate } = activeActivityScheduling[activityId].dateScheduling || {};\n if (toDate && toDate < timeTracker.currentDate) {\n this.removeActivityScheduling(activityId);\n additionalActivitiesIds = additionalActivitiesIds.filter((id) => id !== activityId);\n }\n }\n });\n excludedActivitiesIds.forEach((activityId) => {\n if (activityId in excludedActivitiesScheduling) {\n let { to: toDate } = excludedActivitiesScheduling[activityId].dateScheduling || {};\n if (toDate && toDate < timeTracker.currentDate) {\n this.removeActivityScheduling(activityId);\n excludedActivitiesIds = excludedActivitiesIds.filter((id) => id !== activityId);\n }\n }\n });\n }\n\n get activities(): ActivityInterface[] {\n let res: ActivityInterface[] = [];\n let activeActivityScheduling = this.activeActivityScheduling;\n this.additionalActivitiesIds.concat(this.defaultActivitiesIds).forEach((activityId) => {\n let activity = RegisteredActivities.get(activityId);\n const { dateScheduling, timeSlot } = activeActivityScheduling[activityId] || {};\n const { from: fromDate = activity?.dateScheduling?.from, to: toDate = activity?.dateScheduling?.to } =\n dateScheduling || {};\n const { from: fromTime = activity?.timeSlot?.from, to: toTime = activity?.timeSlot?.to } = timeSlot || {};\n if (\n activity &&\n timeTracker.nowIsBetween(fromTime, toTime) &&\n !(fromDate && fromDate > timeTracker.currentDate) &&\n !(toDate && toDate < timeTracker.currentDate)\n ) {\n res.push(activity);\n }\n });\n Object.entries(this.excludedActivitiesScheduling).forEach(([activityId, scheduling]) => {\n let activity = RegisteredActivities.get(activityId);\n if (\n activity &&\n activity.isActive &&\n !(\n scheduling.dateScheduling &&\n scheduling.dateScheduling.to !== undefined &&\n scheduling.dateScheduling.to >= timeTracker.currentDate\n )\n ) {\n res.push(activity);\n }\n });\n this.defaultActivities.forEach((activity) => {\n if (activity.isActive && !res.find((a) => a.id === activity.id)) {\n res.push(activity);\n }\n });\n return res;\n }\n}\n","import { ActivityInterface, MapInterface, RoomInterface } from \"../../interface\";\nimport { LocationInternalInterface } from \"../../interface/navigation/LocationInterface\";\nimport { navigator } from \"../../managers\";\nimport NavigationAbstractClass from \"./NavigationAbstractClass\";\n\nconst LOCATION_CATEGORY = \"__nqtr-location__\";\nexport default class LocationStoredClass extends NavigationAbstractClass implements LocationInternalInterface {\n\tconstructor(\n\t\tid: string,\n\t\t/**\n\t\t * The map where the location is.\n\t\t */\n\t\tprivate readonly _map: MapInterface,\n\t\tactivities: ActivityInterface[] = []\n\t) {\n\t\tsuper(LOCATION_CATEGORY, id, activities);\n\t}\n\n\tget map(): MapInterface {\n\t\treturn this._map;\n\t}\n\n\tget rooms(): RoomInterface[] {\n\t\treturn navigator.rooms.filter((room) => room.location.id === this.id);\n\t}\n}\n","import { storage } from \"@drincs/pixi-vn/storage\";\nimport { LocationBaseModelProps, MapInterface } from \"../../interface\";\nimport { LocationInternalInterface } from \"../../interface/navigation/LocationInterface\";\nimport LocationStoredClass from \"./LocationStoredClass\";\n\n/**\n * The base model of a location. I suggest you extend this class to create your own location model.\n * @example\n * ```typescript\n * export const mcHome = new LocationBaseModel('mc_home', mainMap, {\n * name: 'MC Home',\n * icon: \"https://icon.jpg\",\n * });\n * ```\n */\nexport default class LocationBaseModel extends LocationStoredClass implements LocationInternalInterface {\n /**\n * @param id The id of the location, it must be unique.\n * @param map The map where the location is.\n * @param props The properties of the location.\n */\n constructor(id: string, map: MapInterface, props: LocationBaseModelProps = {}) {\n super(id, map, props.activities || []);\n this.defaultName = props.name || \"\";\n this.defaultDisabled = props.disabled || false;\n this.defaultHidden = props.hidden || false;\n this._icon = props.icon;\n }\n\n private defaultName: string;\n /**\n * The name of the location.\n * If you set undefined, it will return the initial value of name.\n */\n get name(): string {\n return this.getStorageProperty<string>(\"name\") || this.defaultName;\n }\n set name(value: string | undefined) {\n this.setStorageProperty(\"name\", value);\n }\n\n private defaultDisabled: boolean | string;\n /**\n * Whether is disabled. If it is a string, it is a Pixi'VN flag name.\n */\n get disabled(): boolean {\n let value = this.getStorageProperty<boolean>(\"disabled\") || this.defaultDisabled;\n if (typeof value === \"string\") {\n return storage.getFlag(value);\n }\n return value;\n }\n set disabled(value: boolean | string) {\n this.setStorageProperty(\"disabled\", value);\n }\n\n private defaultHidden: boolean | string;\n /**\n * Whether is hidden. If it is a string, it is a Pixi'VN flag name.\n */\n get hidden(): boolean {\n let value = this.getStorageProperty<boolean>(\"hidden\") || this.defaultHidden;\n if (typeof value === \"string\") {\n return storage.getFlag(value);\n }\n return value;\n }\n set hidden(value: boolean | string) {\n this.setStorageProperty(\"hidden\", value);\n }\n\n private _icon?: string;\n /**\n * The icon of the location.\n */\n get icon(): string | undefined {\n return this._icon;\n }\n}\n","import { ActivityInterface, LocationInterface } from \"../../interface\";\nimport { MapBaseInternalInterface } from \"../../interface/navigation/MapInterface\";\nimport { navigator } from \"../../managers\";\nimport NavigationAbstractClass from \"./NavigationAbstractClass\";\n\nconst MAP_CATEGORY = \"__nqtr-map__\";\nexport default class MapStoredClass extends NavigationAbstractClass implements MapBaseInternalInterface {\n\tconstructor(id: string, activities: ActivityInterface[] = []) {\n\t\tsuper(MAP_CATEGORY, id, activities);\n\t}\n\n\tget locations(): LocationInterface[] {\n\t\treturn navigator.locations.filter((location) => location.map.id === this.id);\n\t}\n}\n","import { MapBaseModelProps } from \"../../interface\"\nimport { MapBaseInternalInterface } from \"../../interface/navigation/MapInterface\"\nimport MapStoredClass from \"./MapStoredClass\"\n\n/**\n * The base model of a map. I suggest you extend this class to create your own map model.\n * @example\n * ```typescript\n * export const mainMap = new MapBaseModel('main_map', {\n * name: 'Main Map',\n * image: \"https://image.jpg\",\n * });\n * ```\n */\nexport default class MapBaseModel extends MapStoredClass implements MapBaseInternalInterface {\n /**\n * @param id The id of the map, it must be unique.\n * @param props The properties of the map. \n */\n constructor(id: string, props: MapBaseModelProps = {}) {\n super(id, props.activities || [])\n this.defaultName = props.name || \"\"\n this._image = props.image\n }\n\n private defaultName: string\n /**\n * The name of the map.\n * If you set undefined, it will return the initial value of name.\n */\n get name(): string {\n return this.getStorageProperty<string>(\"name\") || this.defaultName\n }\n set name(value: string | undefined) {\n this.setStorageProperty(\"name\", value)\n }\n\n private _image?: string\n /**\n * The image of the map.\n */\n get image(): string | undefined {\n return this._image\n }\n}\n","import type { CharacterInterface } from \"@drincs/pixi-vn\";\nimport { ActivityInterface, CommitmentInterface, LocationInterface } from \"../../interface\";\nimport { RoomBaseInternalInterface } from \"../../interface/navigation/RoomInterface\";\nimport { routine } from \"../../managers\";\nimport { OnRunAsyncFunction } from \"../../types\";\nimport NavigationAbstractClass from \"./NavigationAbstractClass\";\n\nconst ROOM_CATEGORY = \"__nqtr-room__\";\nexport default class RoomStoredClass extends NavigationAbstractClass implements RoomBaseInternalInterface {\n constructor(\n id: string,\n /**\n * The location where the room is.\n */\n private readonly _location: LocationInterface,\n activities: ActivityInterface[] = []\n ) {\n super(ROOM_CATEGORY, id, activities);\n }\n get routine(): CommitmentInterface[] {\n return routine.currentRoutine.filter((c) => c.room.id === this.id);\n }\n\n get location(): LocationInterface {\n return this._location;\n }\n\n get characters(): CharacterInterface[] {\n let characters: CharacterInterface[] = [];\n this.routine.forEach((commitment) => {\n characters.push(...commitment.characters);\n });\n return characters;\n }\n\n get automaticFunctions(): OnRunAsyncFunction[] {\n return this.routine\n .filter((commitment) => commitment.executionType === \"automatic\" && commitment.run)\n .map((commitment) => {\n let res: OnRunAsyncFunction = async (props) => {\n await commitment.run(props);\n };\n return res;\n });\n }\n}\n","import { storage } from \"@drincs/pixi-vn/storage\";\nimport { RegisteredRooms } from \"../../decorators\";\nimport { LocationInterface, RoomBaseModelProps } from \"../../interface\";\nimport RoomStoredClass from \"./RoomStoredClass\";\n\n/**\n * The base model of a room. I suggest you extend this class to create your own room model.\n * **You must use the {@link RegisteredRooms.add} function to save the room in the registered rooms.**\n * @example\n * ```ts\n * export const mcRoom = new RoomBaseModel('mc_room', mcHome, {\n * name: \"MC Room\",\n * icon: \"https://icon.jpg\",\n * image: \"https://image.jpg\",\n * })\n * RegisteredRooms.add(mcRoom)\n * ```\n */\nexport default class RoomBaseModel extends RoomStoredClass {\n /**\n * @param id The id of the room, it must be unique.\n * @param location The location where the room is.\n * @param props The properties of the room.\n */\n constructor(id: string, location: LocationInterface, props: RoomBaseModelProps = {}) {\n super(id, location, props.activities || []);\n this.defaultName = props.name || \"\";\n this._image = props.image;\n this.defaultDisabled = props.disabled || false;\n this.defaultHidden = props.hidden || false;\n this._icon = props.icon;\n }\n\n private defaultName: string;\n /**\n * The name.\n * If you set undefined, it will return the initial value of name.\n */\n get name(): string {\n return this.getStorageProperty<string>(\"name\") || this.defaultName;\n }\n set name(value: string | undefined) {\n this.setStorageProperty(\"name\", value);\n }\n\n private _image?: string;\n /**\n * The image of the room.\n */\n get image(): string | undefined {\n return this._image;\n }\n\n private defaultDisabled: boolean | string;\n /**\n * Whether is disabled. If it is a string, it is a Pixi'VN flag name.\n */\n get disabled(): boolean {\n let value = this.getStorageProperty<boolean>(\"disabled\") || this.defaultDisabled;\n if (typeof value === \"string\") {\n return storage.getFlag(value);\n }\n return value;\n }\n set disabled(value: boolean | string) {\n this.setStorageProperty(\"disabled\", value);\n }\n\n private defaultHidden: boolean | string;\n /**\n * Whether is hidden. If it is a string, it is a Pixi'VN flag name.\n */\n get hidden(): boolean {\n let value = this.getStorageProperty<boolean>(\"hidden\") || this.defaultHidden;\n if (typeof value === \"string\") {\n return storage.getFlag(value);\n }\n return value;\n }\n set hidden(value: boolean | string) {\n this.setStorageProperty(\"hidden\", value);\n }\n\n private _icon?: string;\n /**\n * The function for rendering the icon of the room.\n */\n get icon(): string | undefined {\n return this._icon;\n }\n}\n","import { OnRunProps } from \"@drincs/nqtr\";\nimport { StoredClassModel } from \"@drincs/pixi-vn/storage\";\nimport { QuestInterface, StageInterface } from \"../../interface\";\nimport { QuestBaseInternalInterface } from \"../../interface/quest/QuestInterface\";\nimport { OnRunEvent } from \"../../types\";\nimport { logger } from \"../../utils/log-utility\";\nimport StageStoredClass from \"./StageStoredClass\";\n\nexport interface QuestStoredClassProps {\n /**\n * The function that will be executed when the quest starts.\n */\n onStart?: OnRunEvent<QuestInterface>;\n /**\n * The function that will be executed when a stage end in the quest.\n */\n onNextStage?: OnRunEvent<QuestInterface>;\n}\n\nconst QUEST_CATEGORY = \"__nqtr-quest__\";\nexport default class QuestStoredClass extends StoredClassModel implements QuestBaseInternalInterface {\n constructor(id: string, private readonly _stages: StageInterface[], props: QuestStoredClassProps = {}) {\n super(QUEST_CATEGORY, id);\n this._onStart = props.onStart;\n this._onNextStage = props.onNextStage;\n }\n\n get stages(): StageInterface[] {\n return this._stages;\n }\n\n get currentStageIndex(): number | undefined {\n return this.getStorageProperty<number>(\"currentStageIndex\");\n }\n private set currentStageIndex(value: number | undefined) {\n this.setStorageProperty(\"currentStageIndex\", value);\n }\n\n get currentStage(): StageInterface | undefined {\n let index = this.currentStageIndex;\n if (index === undefined || index >= this.stages.length) {\n return undefined;\n }\n return this.stages[index];\n }\n\n get started(): boolean {\n return this.currentStageIndex !== undefined;\n }\n\n get completed(): boolean {\n if (this.currentStageIndex === undefined) {\n return false;\n }\n return this.currentStageIndex > this.stages.length - 1;\n }\n\n get inProgress() {\n if (this.completed) {\n return false;\n }\n if (this.failed) {\n return false;\n }\n return this.started;\n }\n\n get failed(): boolean {\n return this.getStorageProperty<boolean>(\"failed\") || false;\n }\n set failed(value: boolean) {\n this.setStorageProperty(\"failed\", value);\n }\n\n private _onStart?: OnRunEvent<QuestInterface>;\n get onStart(): undefined | OnRunEvent<QuestInterface> {\n return this._onStart;\n }\n\n private _onNextStage?: OnRunEvent<QuestInterface>;\n get onNextStage(): undefined | OnRunEvent<QuestInterface> {\n return this._onNextStage;\n }\n\n async start(props: OnRunProps): Promise<void> {\n if (this.started) {\n console.warn(`[NQTR] Quest ${this.id} is already started`);\n return;\n }\n if (this.stages.length === 0) {\n logger.error(`Quest ${this.id} has no stages`);\n return;\n }\n this.currentStageIndex = 0;\n let currentStage = this.currentStage;\n if (currentStage && currentStage.start) {\n this.onStart && (await this.onStart(this as any as QuestInterface, props));\n return await currentStage.start(props);\n } else {\n logger.error(`Quest ${this.id} has no start stage`);\n }\n }\n\n /**\n * @deprecated Use {@link goNextIfCompleted} instead.\n */\n tryToGoNextStage(props: OnRunProps): Promise<boolean> {\n return this.goNextIfCompleted(props);\n }\n async goNextIfCompleted(props: OnRunProps): Promise<boolean> {\n if (!this.inProgress) {\n return false;\n }\n let currentStage = this.currentStage;\n if (!currentStage) {\n logger.error(`Quest ${this.id} has no current stage`);\n return false;\n }\n if (currentStage.completed) {\n return await this.forceGoNext(props);\n }\n return false;\n }\n\n /**\n * @deprecated Use {@link goNext} instead.\n */\n completeCurrentStageAndGoNext(props: OnRunProps): Promise<boolean> {\n return this.goNext(props);\n }\n async goNext(props: OnRunProps): Promise<boolean> {\n let currentStage = this.currentStage;\n if (!currentStage) {\n logger.error(`Quest ${this.id} has no current stage`);\n return false;\n }\n currentStage.completed = true;\n return await this.forceGoNext(props);\n }\n\n /**\n * @deprecated Use {@link forceGoNext} instead.\n */\n goNextStage(props: OnRunProps): Promise<boolean> {\n return this.forceGoNext(props);\n }\n async forceGoNext(props: OnRunProps): Promise<boolean> {\n if (!this.inProgress) {\n console.warn(`[NQTR] Quest ${this.id} is not in progress`);\n return false;\n }\n let prevStage = this.currentStage;\n let currentStageIndex = this.currentStageIndex;\n if (!prevStage || currentStageIndex === undefined) {\n logger.error(`Quest ${this.id} has no current stage`);\n return false;\n }\n this.currentStageIndex = currentStageIndex + 1;\n this.onNextStage && (await this.onNextStage(this as any as QuestInterface, props));\n if (prevStage && prevStage.onEnd) {\n await prevStage.onEnd(prevStage, props);\n }\n let nextCurrentStage = this.currentStage;\n if (nextCurrentStage) {\n (nextCurrentStage as any as StageStoredClass).inizialize();\n if (this.currentStageMustStart) {\n await this.startCurrentStage(props);\n }\n }\n\n return true;\n }\n\n get currentStageMustStart(): boolean {\n let currentStage = this.currentStage;\n if (!currentStage) {\n return false;\n }\n return !currentStage.started && currentStage.canStart && !currentStage.completed;\n }\n\n async startCurrentStage(props: OnRunProps): Promise<void> {\n let newCurrentStage = this.currentStage;\n if (newCurrentStage && this.currentStageMustStart) {\n await newCurrentStage.start(props);\n } else {\n console.warn(`[NQTR] Quest ${this.id} can't start the current stage`);\n }\n }\n}\n","import { QuestProps, StageInterface } from \"../../interface\";\r\nimport QuestStoredClass from \"./QuestStoredClass\";\r\n\r\nexport default class QuestBaseModel extends QuestStoredClass {\r\n\tconstructor(id: string, stages: StageInterface[], props: QuestProps) {\r\n\t\tsuper(id, stages, { onStart: props.onStart, onNextStage: props.onNextStage });\r\n\t\tthis._name = props.name || \"\";\r\n\t\tthis._description = props.description || \"\";\r\n\t\tthis._icon = props.icon;\r\n\t\tthis._image = props.image;\r\n\t\tthis._inDevelopment = props.inDevelopment || false;\r\n\t}\r\n\r\n\tprivate _name: string;\r\n\t/**\r\n\t * The name of the quest.\r\n\t */\r\n\tget name(): string {\r\n\t\treturn this._name;\r\n\t}\r\n\r\n\tprivate _description: string;\r\n\t/**\r\n\t * The description of the quest.\r\n\t */\r\n\tget description(): string {\r\n\t\treturn this._description;\r\n\t}\r\n\r\n\tprivate _icon?: string;\r\n\t/**\r\n\t * Icon of the quest.\r\n\t */\r\n\tget icon(): string | undefined {\r\n\t\treturn this._icon;\r\n\t}\r\n\r\n\tprivate _image?: string;\r\n\t/**\r\n\t * Image of the quest.\r\n\t */\r\n\tget image(): string | undefined {\r\n\t\treturn this._image;\r\n\t}\r\n\r\n\tprivate _inDevelopment: boolean;\r\n\t/**\r\n\t * If the quest is in development.\r\n\t */\r\n\tget inDevelopment(): boolean {\r\n\t\treturn this._inDevelopment;\r\n\t}\r\n}\r\n","import { OnRunProps } from \"@drincs/nqtr\";\nimport { StoredClassModel } from \"@drincs/pixi-vn/storage\";\nimport { StageInterface } from \"../../interface\";\nimport { StageBaseInternalInterface } from \"../../interface/quest/StageInterface\";\nimport { timeTracker } from \"../../managers\";\nimport { OnRunEvent, QuestsRequiredType } from \"../../types\";\n\nexport interface StageStoredClassProps {\n /**\n * The function that will be executed when the stage starts.\n */\n onStart?: OnRunEvent<StageInterface>;\n /**\n * The function that will be executed when the stage ends.\n */\n onEnd?: OnRunEvent<StageInterface>;\n /**\n * The number of day/date required to start the stage.\n * @example If the value is 3, and the previous stage ends on day 1, the stage will start on day 4.\n */\n deltaDateRequired?: number;\n /**\n * The quests required to start the stage.\n * @default []\n */\n questsRequired?: QuestsRequiredType[];\n}\n\nconst STAGE_CATEGORY = \"__nqtr-stage__\";\nexport default class StageStoredClass extends StoredClassModel implements StageBaseInternalInterface {\n constructor(id: string, props: StageStoredClassProps = {}) {\n super(STAGE_CATEGORY, id);\n this._onStart = props.onStart;\n this._onEnd = props.onEnd;\n this._deltaDateRequired = props.deltaDateRequired;\n this._questsRequired = props.questsRequired || [];\n }\n\n private _onStart?: OnRunEvent<StageInterface>;\n get onStart(): undefined | OnRunEvent<StageInterface> {\n return this._onStart;\n }\n\n private _onEnd?: OnRunEvent<StageInterface>;\n get onEnd(): undefined | OnRunEvent<StageInterface> {\n return this._onEnd;\n }\n\n get completed(): boolean {\n return this.getStorageProperty<boolean>(\"completed\") || false;\n }\n set completed(value: boolean) {\n this.setStorageProperty(\"completed\", value);\n }\n\n get started(): boolean {\n return this.getStorageProperty<boolean>(\"started\") || false;\n }\n set started(value: boolean) {\n this.setStorageProperty(\"started\", value);\n }\n\n private get inizializeDate(): number | undefined {\n return this.getStorageProperty<number>(\"inizializeDate\");\n }\n private set inizializeDate(value: number | undefined) {\n this.setStorageProperty(\"inizializeDate\", value);\n }\n\n get startDate(): number | undefined {\n let inizializeDate = this.inizializeDate;\n if (inizializeDate === undefined) {\n return undefined;\n }\n return inizializeDate + this.deltaDateRequired;\n }\n\n get canStart(): boolean {\n let deltaDateRequired = this.deltaDateRequired;\n if (deltaDateRequired > 0) {\n let inizializeDate = this.inizializeDate;\n if (inizializeDate === undefined) {\n return false;\n }\n if (inizializeDate + deltaDateRequired > timeTracker.currentDate) {\n return false;\n }\n }\n if (\n this.questsRequired.length > 0 &&\n !this.questsRequired.every((q) => q.quest.currentStageIndex && q.quest.currentStageIndex >= q.stageNumber)\n ) {\n return false;\n }\n return true;\n }\n\n inizialize() {\n if (this.deltaDateRequired > 0) {\n this.inizializeDate = timeTracker.currentDate;\n console.log(`[NQTR] Stage ${this.id} will start on date ${this.startDate}`);\n }\n }\n\n async start(props: OnRunProps) {\n if (this.canStart) {\n this.started = true;\n if (this.onStart) {\n await this.onStart(this as any as StageInterface, props);\n }\n } else {\n console.warn(`[NQTR] Stage ${this.id} can't start`);\n }\n }\n\n private _deltaDateRequired?: number;\n get deltaDateRequired(): number {\n return this._deltaDateRequired || 0;\n }\n\n private _questsRequired: QuestsRequiredType[];\n get questsRequired(): QuestsRequiredType[] {\n return this._questsRequired || [];\n }\n}\n","import { storage } from \"@drincs/pixi-vn/storage\";\nimport { StageProps } from \"../../interface\";\nimport StageFlags from \"../../interface/quest/StageFlags\";\nimport StageStoredClass from \"./StageStoredClass\";\n\nexport default class StageBaseModel extends StageStoredClass {\n constructor(id: string, props: StageProps) {\n super(id, {\n onStart: props.onStart,\n onEnd: props.onEnd,\n deltaDateRequired: props.deltaDateRequired,\n questsRequired: props.questsRequired,\n });\n this._name = props.name || \"\";\n this._flags = props.flags || [];\n this._description = props.description || \"\";\n this._adviceDescription = props.adviceDescription || \"\";\n this._image = props.image;\n this._flagsRequired = props.flagsRequired || [];\n this._requestDescriptionToStart = props.requestDescriptionToStart || \"\";\n }\n\n private _name: string;\n /**\n * The name of the stage.\n */\n get name(): string {\n return this._name;\n }\n\n private _description: string;\n /**\n * The description of the stage.\n */\n get description(): string {\n return this._description;\n }\n\n private _adviceDescription: string;\n /**\n * The advice description of the stage.\n */\n get adviceDescription(): string {\n return this._adviceDescription;\n }\n\n private _image?: string;\n /**\n * The image of the stage.\n */\n get image(): string | undefined {\n return this._image;\n }\n\n private _flags: StageFlags[];\n /**\n * The list of flags that the player must complete to finish the stage.\n */\n get flags(): StageFlags[] {\n return this._flags;\n }\n\n private _flagsRequired: StageFlags[];\n /**\n * The list of flags required to start the stage.\n */\n get flagsRequired(): StageFlags[] {\n return this._flagsRequired;\n }\n\n private _requestDescriptionToStart: string;\n /**\n * The description of the request to start the stage.\n */\n get requestDescriptionToStart(): string {\n return this._requestDescriptionToStart;\n }\n\n override get completed(): boolean {\n if (super.completed) {\n return true;\n }\n if (this.flags.length > 0) {\n if (!this.flags.every((flag) => storage.getFlag(flag.flag))) {\n return false;\n }\n return true;\n }\n return false;\n }\n override set completed(value: boolean) {\n super.completed = value;\n }\n override get canStart(): boolean {\n if (this.flagsRequired.length > 0 && !this.flagsRequired.every((flag) => storage.getFlag(flag.flag))) {\n return false;\n }\n return super.canStart;\n }\n}\n"]}