@drincs/nqtr 0.3.5 → 0.3.7

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 (157) hide show
  1. package/dist/{RoomInterface-BglEhkQT.d.ts → RoomInterface-CdAM_q7P.d.ts} +4 -0
  2. package/dist/{RoomInterface-DsZAp6Pv.d.mts → RoomInterface-DURfkQ7u.d.mts} +4 -0
  3. package/dist/{StageInterface-DJ7l0ubG.d.mts → StageInterface-DX74DUxG.d.mts} +1 -1
  4. package/dist/{StageInterface-DJ7l0ubG.d.ts → StageInterface-DX74DUxG.d.ts} +1 -1
  5. package/dist/classes/ActivityBaseModel.js +1 -1
  6. package/dist/classes/ActivityBaseModel.js.map +1 -1
  7. package/dist/classes/ActivityBaseModel.mjs +1 -1
  8. package/dist/classes/ActivityBaseModel.mjs.map +1 -1
  9. package/dist/classes/ActivityStoredClass.js +1 -1
  10. package/dist/classes/ActivityStoredClass.js.map +1 -1
  11. package/dist/classes/ActivityStoredClass.mjs +1 -1
  12. package/dist/classes/ActivityStoredClass.mjs.map +1 -1
  13. package/dist/classes/CommitmentBaseModel.d.mts +1 -1
  14. package/dist/classes/CommitmentBaseModel.d.ts +1 -1
  15. package/dist/classes/CommitmentBaseModel.js +1 -1
  16. package/dist/classes/CommitmentBaseModel.js.map +1 -1
  17. package/dist/classes/CommitmentBaseModel.mjs +1 -1
  18. package/dist/classes/CommitmentBaseModel.mjs.map +1 -1
  19. package/dist/classes/CommitmentStoredClass.d.mts +1 -1
  20. package/dist/classes/CommitmentStoredClass.d.ts +1 -1
  21. package/dist/classes/CommitmentStoredClass.js +1 -1
  22. package/dist/classes/CommitmentStoredClass.js.map +1 -1
  23. package/dist/classes/CommitmentStoredClass.mjs +1 -1
  24. package/dist/classes/CommitmentStoredClass.mjs.map +1 -1
  25. package/dist/classes/index.d.mts +4 -4
  26. package/dist/classes/index.d.ts +4 -4
  27. package/dist/classes/index.js +1 -1
  28. package/dist/classes/index.js.map +1 -1
  29. package/dist/classes/index.mjs +1 -1
  30. package/dist/classes/index.mjs.map +1 -1
  31. package/dist/classes/navigation/LocationBaseModel.d.mts +1 -1
  32. package/dist/classes/navigation/LocationBaseModel.d.ts +1 -1
  33. package/dist/classes/navigation/LocationBaseModel.js +1 -1
  34. package/dist/classes/navigation/LocationBaseModel.js.map +1 -1
  35. package/dist/classes/navigation/LocationBaseModel.mjs +1 -1
  36. package/dist/classes/navigation/LocationBaseModel.mjs.map +1 -1
  37. package/dist/classes/navigation/LocationStoredClass.d.mts +1 -1
  38. package/dist/classes/navigation/LocationStoredClass.d.ts +1 -1
  39. package/dist/classes/navigation/LocationStoredClass.js +1 -1
  40. package/dist/classes/navigation/LocationStoredClass.js.map +1 -1
  41. package/dist/classes/navigation/LocationStoredClass.mjs +1 -1
  42. package/dist/classes/navigation/LocationStoredClass.mjs.map +1 -1
  43. package/dist/classes/navigation/MapBaseModel.d.mts +1 -1
  44. package/dist/classes/navigation/MapBaseModel.d.ts +1 -1
  45. package/dist/classes/navigation/MapBaseModel.js +1 -1
  46. package/dist/classes/navigation/MapBaseModel.js.map +1 -1
  47. package/dist/classes/navigation/MapBaseModel.mjs +1 -1
  48. package/dist/classes/navigation/MapBaseModel.mjs.map +1 -1
  49. package/dist/classes/navigation/MapStoredClass.d.mts +1 -1
  50. package/dist/classes/navigation/MapStoredClass.d.ts +1 -1
  51. package/dist/classes/navigation/MapStoredClass.js +1 -1
  52. package/dist/classes/navigation/MapStoredClass.js.map +1 -1
  53. package/dist/classes/navigation/MapStoredClass.mjs +1 -1
  54. package/dist/classes/navigation/MapStoredClass.mjs.map +1 -1
  55. package/dist/classes/navigation/NavigationAbstractClass.d.mts +1 -1
  56. package/dist/classes/navigation/NavigationAbstractClass.d.ts +1 -1
  57. package/dist/classes/navigation/NavigationAbstractClass.js +1 -1
  58. package/dist/classes/navigation/NavigationAbstractClass.js.map +1 -1
  59. package/dist/classes/navigation/NavigationAbstractClass.mjs +1 -1
  60. package/dist/classes/navigation/NavigationAbstractClass.mjs.map +1 -1
  61. package/dist/classes/navigation/RoomBaseModel.d.mts +1 -1
  62. package/dist/classes/navigation/RoomBaseModel.d.ts +1 -1
  63. package/dist/classes/navigation/RoomBaseModel.js +1 -1
  64. package/dist/classes/navigation/RoomBaseModel.js.map +1 -1
  65. package/dist/classes/navigation/RoomBaseModel.mjs +1 -1
  66. package/dist/classes/navigation/RoomBaseModel.mjs.map +1 -1
  67. package/dist/classes/navigation/RoomStoredClass.d.mts +3 -2
  68. package/dist/classes/navigation/RoomStoredClass.d.ts +3 -2
  69. package/dist/classes/navigation/RoomStoredClass.js +1 -1
  70. package/dist/classes/navigation/RoomStoredClass.js.map +1 -1
  71. package/dist/classes/navigation/RoomStoredClass.mjs +1 -1
  72. package/dist/classes/navigation/RoomStoredClass.mjs.map +1 -1
  73. package/dist/classes/quest/QuestBaseModel.d.mts +1 -1
  74. package/dist/classes/quest/QuestBaseModel.d.ts +1 -1
  75. package/dist/classes/quest/QuestStoredClass.d.mts +1 -1
  76. package/dist/classes/quest/QuestStoredClass.d.ts +1 -1
  77. package/dist/classes/quest/StageBaseModel.d.mts +1 -1
  78. package/dist/classes/quest/StageBaseModel.d.ts +1 -1
  79. package/dist/classes/quest/StageBaseModel.js +1 -1
  80. package/dist/classes/quest/StageBaseModel.js.map +1 -1
  81. package/dist/classes/quest/StageBaseModel.mjs +1 -1
  82. package/dist/classes/quest/StageBaseModel.mjs.map +1 -1
  83. package/dist/classes/quest/StageStoredClass.d.mts +1 -1
  84. package/dist/classes/quest/StageStoredClass.d.ts +1 -1
  85. package/dist/classes/quest/StageStoredClass.js +1 -1
  86. package/dist/classes/quest/StageStoredClass.js.map +1 -1
  87. package/dist/classes/quest/StageStoredClass.mjs +1 -1
  88. package/dist/classes/quest/StageStoredClass.mjs.map +1 -1
  89. package/dist/decorators/CommitmentDecorator.d.mts +1 -1
  90. package/dist/decorators/CommitmentDecorator.d.ts +1 -1
  91. package/dist/decorators/QuestDecorator.d.mts +1 -1
  92. package/dist/decorators/QuestDecorator.d.ts +1 -1
  93. package/dist/decorators/RoomDecorator.d.mts +1 -1
  94. package/dist/decorators/RoomDecorator.d.ts +1 -1
  95. package/dist/decorators/index.d.mts +3 -3
  96. package/dist/decorators/index.d.ts +3 -3
  97. package/dist/decorators/index.js +1 -1
  98. package/dist/decorators/index.mjs +1 -1
  99. package/dist/index.d.mts +6 -6
  100. package/dist/index.d.ts +6 -6
  101. package/dist/index.js +1 -1
  102. package/dist/index.js.map +1 -1
  103. package/dist/index.mjs +1 -1
  104. package/dist/index.mjs.map +1 -1
  105. package/dist/interface/ActivityInterface.d.mts +1 -1
  106. package/dist/interface/ActivityInterface.d.ts +1 -1
  107. package/dist/interface/CommitmentInterface.d.mts +1 -1
  108. package/dist/interface/CommitmentInterface.d.ts +1 -1
  109. package/dist/interface/CommitmentProps.d.mts +1 -1
  110. package/dist/interface/CommitmentProps.d.ts +1 -1
  111. package/dist/interface/index.d.mts +2 -2
  112. package/dist/interface/index.d.ts +2 -2
  113. package/dist/interface/navigation/LocationInterface.d.mts +1 -1
  114. package/dist/interface/navigation/LocationInterface.d.ts +1 -1
  115. package/dist/interface/navigation/MapInterface.d.mts +1 -1
  116. package/dist/interface/navigation/MapInterface.d.ts +1 -1
  117. package/dist/interface/navigation/NavigationAbstractClass.d.mts +1 -1
  118. package/dist/interface/navigation/NavigationAbstractClass.d.ts +1 -1
  119. package/dist/interface/navigation/RoomInterface.d.mts +2 -2
  120. package/dist/interface/navigation/RoomInterface.d.ts +2 -2
  121. package/dist/interface/quest/QuestInterface.d.mts +1 -1
  122. package/dist/interface/quest/QuestInterface.d.ts +1 -1
  123. package/dist/interface/quest/QuestProps.d.mts +1 -1
  124. package/dist/interface/quest/QuestProps.d.ts +1 -1
  125. package/dist/interface/quest/StageInterface.d.mts +1 -1
  126. package/dist/interface/quest/StageInterface.d.ts +1 -1
  127. package/dist/interface/quest/StageProps.d.mts +1 -1
  128. package/dist/interface/quest/StageProps.d.ts +1 -1
  129. package/dist/managers/NavigatorManager.d.mts +2 -2
  130. package/dist/managers/NavigatorManager.d.ts +2 -2
  131. package/dist/managers/NavigatorManager.js +1 -1
  132. package/dist/managers/NavigatorManager.js.map +1 -1
  133. package/dist/managers/NavigatorManager.mjs +1 -1
  134. package/dist/managers/NavigatorManager.mjs.map +1 -1
  135. package/dist/managers/QuestManager.d.mts +1 -1
  136. package/dist/managers/QuestManager.d.ts +1 -1
  137. package/dist/managers/RoutineManager.d.mts +1 -1
  138. package/dist/managers/RoutineManager.d.ts +1 -1
  139. package/dist/managers/RoutineManager.js +1 -1
  140. package/dist/managers/RoutineManager.js.map +1 -1
  141. package/dist/managers/RoutineManager.mjs +1 -1
  142. package/dist/managers/RoutineManager.mjs.map +1 -1
  143. package/dist/managers/TimeManager.js +1 -1
  144. package/dist/managers/TimeManager.js.map +1 -1
  145. package/dist/managers/TimeManager.mjs +1 -1
  146. package/dist/managers/TimeManager.mjs.map +1 -1
  147. package/dist/managers/index.d.mts +2 -2
  148. package/dist/managers/index.d.ts +2 -2
  149. package/dist/managers/index.js +1 -1
  150. package/dist/managers/index.js.map +1 -1
  151. package/dist/managers/index.mjs +1 -1
  152. package/dist/managers/index.mjs.map +1 -1
  153. package/dist/types/QuestsRequired.d.mts +1 -1
  154. package/dist/types/QuestsRequired.d.ts +1 -1
  155. package/dist/types/index.d.mts +1 -1
  156. package/dist/types/index.d.ts +1 -1
  157. package/package.json +1 -1
@@ -1,11 +1,11 @@
1
1
  export { default as ActivityInterface } from './ActivityInterface.mjs';
2
2
  export { default as ActivityProps } from './ActivityProps.mjs';
3
- export { C as CommitmentInterface, L as LocationInterface, M as MapInterface, R as RoomInterface } from '../RoomInterface-DsZAp6Pv.mjs';
3
+ export { C as CommitmentInterface, L as LocationInterface, M as MapInterface, R as RoomInterface } from '../RoomInterface-DURfkQ7u.mjs';
4
4
  export { default as CommitmentProps } from './CommitmentProps.mjs';
5
5
  export { default as LocationBaseModelProps } from './navigation/LocationBaseModelProps.mjs';
6
6
  export { default as MapBaseModelProps } from './navigation/MapBaseModelProps.mjs';
7
7
  export { default as RoomBaseModelProps } from './navigation/RoomBaseModelProps.mjs';
8
- export { Q as QuestInterface, S as StageInterface } from '../StageInterface-DJ7l0ubG.mjs';
8
+ export { Q as QuestInterface, S as StageInterface } from '../StageInterface-DX74DUxG.mjs';
9
9
  export { default as QuestProps } from './quest/QuestProps.mjs';
10
10
  export { default as StageProps } from './quest/StageProps.mjs';
11
11
  import '@drincs/nqtr';
@@ -1,11 +1,11 @@
1
1
  export { default as ActivityInterface } from './ActivityInterface.js';
2
2
  export { default as ActivityProps } from './ActivityProps.js';
3
- export { C as CommitmentInterface, L as LocationInterface, M as MapInterface, R as RoomInterface } from '../RoomInterface-BglEhkQT.js';
3
+ export { C as CommitmentInterface, L as LocationInterface, M as MapInterface, R as RoomInterface } from '../RoomInterface-CdAM_q7P.js';
4
4
  export { default as CommitmentProps } from './CommitmentProps.js';
5
5
  export { default as LocationBaseModelProps } from './navigation/LocationBaseModelProps.js';
6
6
  export { default as MapBaseModelProps } from './navigation/MapBaseModelProps.js';
7
7
  export { default as RoomBaseModelProps } from './navigation/RoomBaseModelProps.js';
8
- export { Q as QuestInterface, S as StageInterface } from '../StageInterface-DJ7l0ubG.js';
8
+ export { Q as QuestInterface, S as StageInterface } from '../StageInterface-DX74DUxG.js';
9
9
  export { default as QuestProps } from './quest/QuestProps.js';
10
10
  export { default as StageProps } from './quest/StageProps.js';
11
11
  import '@drincs/nqtr';
@@ -1,5 +1,5 @@
1
1
  import '@drincs/nqtr';
2
- export { b as LocationInternalInterface, L as default } from '../../RoomInterface-DsZAp6Pv.mjs';
2
+ export { b as LocationInternalInterface, L as default } from '../../RoomInterface-DURfkQ7u.mjs';
3
3
  import './NavigationAbstractClass.mjs';
4
4
  import '@drincs/pixi-vn';
5
5
  import '../ActivityInterface.mjs';
@@ -1,5 +1,5 @@
1
1
  import '@drincs/nqtr';
2
- export { b as LocationInternalInterface, L as default } from '../../RoomInterface-BglEhkQT.js';
2
+ export { b as LocationInternalInterface, L as default } from '../../RoomInterface-CdAM_q7P.js';
3
3
  import './NavigationAbstractClass.js';
4
4
  import '@drincs/pixi-vn';
5
5
  import '../ActivityInterface.js';
@@ -1,5 +1,5 @@
1
1
  import '@drincs/nqtr';
2
- export { c as MapBaseInternalInterface, M as default } from '../../RoomInterface-DsZAp6Pv.mjs';
2
+ export { c as MapBaseInternalInterface, M as default } from '../../RoomInterface-DURfkQ7u.mjs';
3
3
  import './NavigationAbstractClass.mjs';
4
4
  import '@drincs/pixi-vn';
5
5
  import '../ActivityInterface.mjs';
@@ -1,5 +1,5 @@
1
1
  import '@drincs/nqtr';
2
- export { c as MapBaseInternalInterface, M as default } from '../../RoomInterface-BglEhkQT.js';
2
+ export { c as MapBaseInternalInterface, M as default } from '../../RoomInterface-CdAM_q7P.js';
3
3
  import './NavigationAbstractClass.js';
4
4
  import '@drincs/pixi-vn';
5
5
  import '../ActivityInterface.js';
@@ -34,7 +34,7 @@ interface NavigationAbstractInterface extends StoredClassModel {
34
34
  * @param activity The activity to disconnect from the class.
35
35
  * @param options
36
36
  */
37
- revoveActivity(activity: ActivityInterface, options?: {
37
+ removeActivity(activity: ActivityInterface, options?: {
38
38
  /**
39
39
  * The activity will be excluded from this class only for the specified days.
40
40
  * If to 3, the activity will be excluded from this class only for days 1, 2 and 3. So at day 4 it will be associated with this class.
@@ -34,7 +34,7 @@ interface NavigationAbstractInterface extends StoredClassModel {
34
34
  * @param activity The activity to disconnect from the class.
35
35
  * @param options
36
36
  */
37
- revoveActivity(activity: ActivityInterface, options?: {
37
+ removeActivity(activity: ActivityInterface, options?: {
38
38
  /**
39
39
  * The activity will be excluded from this class only for the specified days.
40
40
  * If to 3, the activity will be excluded from this class only for days 1, 2 and 3. So at day 4 it will be associated with this class.
@@ -1,6 +1,6 @@
1
1
  import '@drincs/nqtr';
2
- export { d as RoomBaseInternalInterface, R as default } from '../../RoomInterface-DsZAp6Pv.mjs';
3
- import './NavigationAbstractClass.mjs';
4
2
  import '@drincs/pixi-vn';
3
+ export { d as RoomBaseInternalInterface, R as default } from '../../RoomInterface-DURfkQ7u.mjs';
4
+ import './NavigationAbstractClass.mjs';
5
5
  import '../ActivityInterface.mjs';
6
6
  import '../../types/ExecutionType.mjs';
@@ -1,6 +1,6 @@
1
1
  import '@drincs/nqtr';
2
- export { d as RoomBaseInternalInterface, R as default } from '../../RoomInterface-BglEhkQT.js';
3
- import './NavigationAbstractClass.js';
4
2
  import '@drincs/pixi-vn';
3
+ export { d as RoomBaseInternalInterface, R as default } from '../../RoomInterface-CdAM_q7P.js';
4
+ import './NavigationAbstractClass.js';
5
5
  import '../ActivityInterface.js';
6
6
  import '../../types/ExecutionType.js';
@@ -1,2 +1,2 @@
1
1
  import '@drincs/nqtr';
2
- export { b as QuestBaseInternalInterface, Q as default } from '../../StageInterface-DJ7l0ubG.mjs';
2
+ export { b as QuestBaseInternalInterface, Q as default } from '../../StageInterface-DX74DUxG.mjs';
@@ -1,2 +1,2 @@
1
1
  import '@drincs/nqtr';
2
- export { b as QuestBaseInternalInterface, Q as default } from '../../StageInterface-DJ7l0ubG.js';
2
+ export { b as QuestBaseInternalInterface, Q as default } from '../../StageInterface-DX74DUxG.js';
@@ -1,5 +1,5 @@
1
1
  import { OnRunProps } from '@drincs/nqtr';
2
- import { Q as QuestInterface } from '../../StageInterface-DJ7l0ubG.mjs';
2
+ import { Q as QuestInterface } from '../../StageInterface-DX74DUxG.mjs';
3
3
 
4
4
  interface QuestProps {
5
5
  /**
@@ -1,5 +1,5 @@
1
1
  import { OnRunProps } from '@drincs/nqtr';
2
- import { Q as QuestInterface } from '../../StageInterface-DJ7l0ubG.js';
2
+ import { Q as QuestInterface } from '../../StageInterface-DX74DUxG.js';
3
3
 
4
4
  interface QuestProps {
5
5
  /**
@@ -1,2 +1,2 @@
1
1
  import '@drincs/nqtr';
2
- export { c as StageBaseInternalInterface, S as default } from '../../StageInterface-DJ7l0ubG.mjs';
2
+ export { c as StageBaseInternalInterface, S as default } from '../../StageInterface-DX74DUxG.mjs';
@@ -1,2 +1,2 @@
1
1
  import '@drincs/nqtr';
2
- export { c as StageBaseInternalInterface, S as default } from '../../StageInterface-DJ7l0ubG.js';
2
+ export { c as StageBaseInternalInterface, S as default } from '../../StageInterface-DX74DUxG.js';
@@ -1,5 +1,5 @@
1
1
  import { OnRunProps } from '@drincs/nqtr';
2
- import { a as QuestsRequiredType, S as StageInterface } from '../../StageInterface-DJ7l0ubG.mjs';
2
+ import { a as QuestsRequiredType, S as StageInterface } from '../../StageInterface-DX74DUxG.mjs';
3
3
  import StageFlags from './StageFlags.mjs';
4
4
 
5
5
  interface StageProps {
@@ -1,5 +1,5 @@
1
1
  import { OnRunProps } from '@drincs/nqtr';
2
- import { a as QuestsRequiredType, S as StageInterface } from '../../StageInterface-DJ7l0ubG.js';
2
+ import { a as QuestsRequiredType, S as StageInterface } from '../../StageInterface-DX74DUxG.js';
3
3
  import StageFlags from './StageFlags.js';
4
4
 
5
5
  interface StageProps {
@@ -1,4 +1,4 @@
1
- import { R as RoomInterface, L as LocationInterface, M as MapInterface } from '../RoomInterface-DsZAp6Pv.mjs';
1
+ import { R as RoomInterface, L as LocationInterface, M as MapInterface } from '../RoomInterface-DURfkQ7u.mjs';
2
2
  import '@drincs/nqtr';
3
3
  import '@drincs/pixi-vn';
4
4
  import '../interface/ActivityInterface.mjs';
@@ -10,7 +10,7 @@ declare class NavigatorManager {
10
10
  get locations(): LocationInterface[];
11
11
  get maps(): MapInterface[];
12
12
  get currentRoom(): RoomInterface | undefined;
13
- set currentRoom(room: RoomInterface);
13
+ set currentRoom(room: RoomInterface | string);
14
14
  get currentLocation(): LocationInterface | undefined;
15
15
  get currentMap(): MapInterface | undefined;
16
16
  /**
@@ -1,4 +1,4 @@
1
- import { R as RoomInterface, L as LocationInterface, M as MapInterface } from '../RoomInterface-BglEhkQT.js';
1
+ import { R as RoomInterface, L as LocationInterface, M as MapInterface } from '../RoomInterface-CdAM_q7P.js';
2
2
  import '@drincs/nqtr';
3
3
  import '@drincs/pixi-vn';
4
4
  import '../interface/ActivityInterface.js';
@@ -10,7 +10,7 @@ declare class NavigatorManager {
10
10
  get locations(): LocationInterface[];
11
11
  get maps(): MapInterface[];
12
12
  get currentRoom(): RoomInterface | undefined;
13
- set currentRoom(room: RoomInterface);
13
+ set currentRoom(room: RoomInterface | string);
14
14
  get currentLocation(): LocationInterface | undefined;
15
15
  get currentMap(): MapInterface | undefined;
16
16
  /**
@@ -1,2 +1,2 @@
1
- 'use strict';var pixiVn=require('@drincs/pixi-vn');var t={};function n(o){try{let e=t[o];if(!e){console.error(`[NQTR] Room ${o} not found`);return}return e}catch(e){console.error(`[NQTR] Error while getting Room ${o}`,e);return}}var a="___nqtr-current_room_memory___",i=class{get rooms(){return Object.values(t)}get locations(){let e={};return Object.values(t).forEach(r=>{e[r.location.id]=r.location;}),Object.values(e)}get maps(){let e={};return Object.values(t).forEach(r=>{e[r.location.map.id]=r.location.map;}),Object.values(e)}get currentRoom(){let e=pixiVn.storage.getVariable(a);if(!e){console.error("[NQTR] The current room has not yet been set");return}let r=n(e);if(!r){console.error(`[NQTR] Current room ${e} not found`);return}return r}set currentRoom(e){if(!n(e.id)){console.error(`[NQTR] The room ${e.id} is not registered, so it can't be set as current room`);return}pixiVn.storage.setVariable(a,e.id);}get currentLocation(){return this.currentRoom?.location}get currentMap(){return this.currentRoom?.location.map}clearExpiredActivities(){Object.entries(t).forEach(([e,r])=>{r.clearExpiredActivities();});}};module.exports=i;//# sourceMappingURL=NavigatorManager.js.map
1
+ 'use strict';var pixiVn=require('@drincs/pixi-vn');var t={};function n(o){try{let e=t[o];if(!e){console.error(`[NQTR] Room ${o} not found`);return}return e}catch(e){console.error(`[NQTR] Error while getting Room ${o}`,e);return}}var a="___nqtr-current_room_memory___",i=class{get rooms(){return Object.values(t)}get locations(){let e={};return Object.values(t).forEach(r=>{e[r.location.id]=r.location;}),Object.values(e)}get maps(){let e={};return Object.values(t).forEach(r=>{e[r.location.map.id]=r.location.map;}),Object.values(e)}get currentRoom(){let e=pixiVn.storage.getVariable(a);if(!e){console.error("[NQTR] The current room has not yet been set");return}let r=n(e);if(!r){console.error(`[NQTR] Current room ${e} not found`);return}return r}set currentRoom(e){if(typeof e!="string"&&(e=e.id),!n(e)){console.error(`[NQTR] The room ${e} is not registered, so it can't be set as current room`);return}pixiVn.storage.setVariable(a,e);}get currentLocation(){return this.currentRoom?.location}get currentMap(){return this.currentRoom?.location.map}clearExpiredActivities(){Object.entries(t).forEach(([e,r])=>{r.clearExpiredActivities();});}};module.exports=i;//# sourceMappingURL=NavigatorManager.js.map
2
2
  //# sourceMappingURL=NavigatorManager.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/decorators/RoomDecorator.ts","../../src/managers/NavigatorManager.ts"],"names":["registeredRooms","getRoomById","id","room","CURRENT_ROOM_MEMORY_KEY","NavigatorManager","result","roomId","storage","_"],"mappings":"mDAEO,IAAMA,EAAmD,EAAC,CA2B1D,SAASC,CAAAA,CAAYC,CAAuC,CAAA,CAClE,GAAI,CACH,IAAIC,CAAOH,CAAAA,CAAAA,CAAgBE,CAAE,CAAA,CAC7B,GAAI,CAACC,CAAAA,CAAM,CACV,OAAA,CAAQ,KAAM,CAAA,CAAA,YAAA,EAAeD,CAAE,CAAY,UAAA,CAAA,CAAA,CAC3C,MACD,CACA,OAAOC,CACR,OAAS,CAAG,CAAA,CACX,OAAQ,CAAA,KAAA,CAAM,CAAmCD,gCAAAA,EAAAA,CAAE,GAAI,CAAC,CAAA,CACxD,MACD,CACD,CCrCA,IAAME,EAA0B,gCACXC,CAAAA,CAAAA,CAArB,KAAsC,CACrC,IAAI,KAAA,EAAQ,CACX,OAAO,MAAA,CAAO,MAAOL,CAAAA,CAAe,CACrC,CACA,IAAI,SAAY,EAAA,CACf,IAAIM,CAAAA,CAA8C,EAAC,CACnD,cAAO,MAAON,CAAAA,CAAe,CAAE,CAAA,OAAA,CAASG,CAAS,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AA,OAAA,CAAQH,CAAe,CAAA,CAAE,QAAQ,CAAC,CAACS,CAAGN,CAAAA,CAAI,CAAM,GAAA,CACtDA,EAAK,sBAAuB,GAC7B,CAAC,EACF,CACD","file":"NavigatorManager.js","sourcesContent":["import { RoomInterface } from \"../interface\";\n\nexport const registeredRooms: { [id: string]: RoomInterface } = {};\n\n/**\n * Save a room in the registered rooms. If the room already exists, it will be overwritten.\n * @param room The room to save.\n * @returns\n * @example\n * ```ts\n * saveRoom([mcRoom, aliceRoom, annRoom, bathroom, lounge, terrace, gymRoom]);\n * ```\n */\nexport function saveRoom(room: RoomInterface | RoomInterface[]) {\n\tif (Array.isArray(room)) {\n\t\troom.forEach((c) => saveRoom(c));\n\t\treturn;\n\t}\n\tif (registeredRooms[room.id]) {\n\t\tconsole.warn(`[NQTR] Room id ${room.id} already exists, it will be overwritten`);\n\t}\n\tregisteredRooms[room.id] = room;\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 */\nexport function getRoomById(id: string): RoomInterface | undefined {\n\ttry {\n\t\tlet room = registeredRooms[id];\n\t\tif (!room) {\n\t\t\tconsole.error(`[NQTR] Room ${id} not found`);\n\t\t\treturn;\n\t\t}\n\t\treturn room;\n\t} catch (e) {\n\t\tconsole.error(`[NQTR] Error while getting Room ${id}`, e);\n\t\treturn;\n\t}\n}\n","import { storage } from \"@drincs/pixi-vn\";\nimport { getRoomById, registeredRooms } from \"../decorators/RoomDecorator\";\nimport { LocationInterface, MapInterface, RoomInterface } from \"../interface\";\n\nconst CURRENT_ROOM_MEMORY_KEY = \"___nqtr-current_room_memory___\";\nexport default class NavigatorManager {\n\tget rooms() {\n\t\treturn Object.values(registeredRooms);\n\t}\n\tget locations() {\n\t\tlet result: { [id: string]: LocationInterface } = {};\n\t\tObject.values(registeredRooms).forEach((room) => {\n\t\t\tresult[room.location.id] = room.location;\n\t\t});\n\t\treturn Object.values(result);\n\t}\n\tget maps() {\n\t\tlet result: { [id: string]: MapInterface } = {};\n\t\tObject.values(registeredRooms).forEach((room) => {\n\t\t\tresult[room.location.map.id] = room.location.map;\n\t\t});\n\t\treturn Object.values(result);\n\t}\n\tget currentRoom(): RoomInterface | undefined {\n\t\tlet roomId = storage.getVariable<string>(CURRENT_ROOM_MEMORY_KEY);\n\t\tif (!roomId) {\n\t\t\tconsole.error(`[NQTR] The current room has not yet been set`);\n\t\t\treturn;\n\t\t}\n\t\tlet room = getRoomById(roomId);\n\t\tif (!room) {\n\t\t\tconsole.error(`[NQTR] Current room ${roomId} not found`);\n\t\t\treturn;\n\t\t}\n\t\treturn room;\n\t}\n\tset currentRoom(room: RoomInterface) {\n\t\tlet roomRegistrated = getRoomById(room.id);\n\t\tif (!roomRegistrated) {\n\t\t\tconsole.error(`[NQTR] The room ${room.id} is not registered, so it can't be set as current room`);\n\t\t\treturn;\n\t\t}\n\t\tstorage.setVariable(CURRENT_ROOM_MEMORY_KEY, room.id);\n\t}\n\tget currentLocation(): LocationInterface | undefined {\n\t\treturn this.currentRoom?.location;\n\t}\n\tget currentMap(): MapInterface | undefined {\n\t\treturn this.currentRoom?.location.map;\n\t}\n\t/**\n\t * Clear all the expired activities.\n\t */\n\tclearExpiredActivities() {\n\t\tObject.entries(registeredRooms).forEach(([_, room]) => {\n\t\t\troom.clearExpiredActivities();\n\t\t});\n\t}\n}\n"]}
1
+ {"version":3,"sources":["../../src/decorators/RoomDecorator.ts","../../src/managers/NavigatorManager.ts"],"names":["registeredRooms","getRoomById","id","room","CURRENT_ROOM_MEMORY_KEY","NavigatorManager","result","roomId","storage","_"],"mappings":"mDAEO,IAAMA,CAAAA,CAAmD,EA2BzD,CAAA,SAASC,CAAYC,CAAAA,CAAAA,CAAuC,CAClE,GAAI,CACH,IAAIC,CAAAA,CAAOH,CAAgBE,CAAAA,CAAE,CAC7B,CAAA,GAAI,CAACC,CAAM,CAAA,CACV,OAAQ,CAAA,KAAA,CAAM,CAAeD,YAAAA,EAAAA,CAAE,YAAY,CAC3C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,GAJI,OAAOA,CAAS,EAAA,QAAA,GAChBA,CAAOA,CAAAA,CAAAA,CAAK,IAGZ,CADkBF,CAAAA,CAAYE,CAAI,CAAA,CAChB,CAClB,OAAA,CAAQ,MAAM,CAAmBA,gBAAAA,EAAAA,CAAI,CAAwD,sDAAA,CAAA,CAAA,CAC7F,MACJ,CACAK,eAAQ,WAAYJ,CAAAA,CAAAA,CAAyBD,CAAI,EACrD,CACA,IAAI,iBAAiD,CACjD,OAAO,IAAK,CAAA,WAAA,EAAa,QAC7B,CACA,IAAI,UAAuC,EAAA,CACvC,OAAO,IAAA,CAAK,WAAa,EAAA,QAAA,CAAS,GACtC,CAIA,sBAAA,EAAyB,CACrB,MAAA,CAAO,OAAQH,CAAAA,CAAe,EAAE,OAAQ,CAAA,CAAC,CAACS,CAAAA,CAAGN,CAAI,CAAA,GAAM,CACnDA,CAAAA,CAAK,sBAAuB,GAChC,CAAC,EACL,CACJ","file":"NavigatorManager.js","sourcesContent":["import { RoomInterface } from \"../interface\";\n\nexport const registeredRooms: { [id: string]: RoomInterface } = {};\n\n/**\n * Save a room in the registered rooms. If the room already exists, it will be overwritten.\n * @param room The room to save.\n * @returns\n * @example\n * ```ts\n * saveRoom([mcRoom, aliceRoom, annRoom, bathroom, lounge, terrace, gymRoom]);\n * ```\n */\nexport function saveRoom(room: RoomInterface | RoomInterface[]) {\n\tif (Array.isArray(room)) {\n\t\troom.forEach((c) => saveRoom(c));\n\t\treturn;\n\t}\n\tif (registeredRooms[room.id]) {\n\t\tconsole.warn(`[NQTR] Room id ${room.id} already exists, it will be overwritten`);\n\t}\n\tregisteredRooms[room.id] = room;\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 */\nexport function getRoomById(id: string): RoomInterface | undefined {\n\ttry {\n\t\tlet room = registeredRooms[id];\n\t\tif (!room) {\n\t\t\tconsole.error(`[NQTR] Room ${id} not found`);\n\t\t\treturn;\n\t\t}\n\t\treturn room;\n\t} catch (e) {\n\t\tconsole.error(`[NQTR] Error while getting Room ${id}`, e);\n\t\treturn;\n\t}\n}\n","import { storage } from \"@drincs/pixi-vn\";\nimport { getRoomById, registeredRooms } from \"../decorators/RoomDecorator\";\nimport { LocationInterface, MapInterface, RoomInterface } from \"../interface\";\n\nconst CURRENT_ROOM_MEMORY_KEY = \"___nqtr-current_room_memory___\";\nexport default class NavigatorManager {\n get rooms() {\n return Object.values(registeredRooms);\n }\n get locations() {\n let result: { [id: string]: LocationInterface } = {};\n Object.values(registeredRooms).forEach((room) => {\n result[room.location.id] = room.location;\n });\n return Object.values(result);\n }\n get maps() {\n let result: { [id: string]: MapInterface } = {};\n Object.values(registeredRooms).forEach((room) => {\n result[room.location.map.id] = room.location.map;\n });\n return Object.values(result);\n }\n get currentRoom(): RoomInterface | undefined {\n let roomId = storage.getVariable<string>(CURRENT_ROOM_MEMORY_KEY);\n if (!roomId) {\n console.error(`[NQTR] The current room has not yet been set`);\n return;\n }\n let room = getRoomById(roomId);\n if (!room) {\n console.error(`[NQTR] 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 = getRoomById(room);\n if (!roomRegistrated) {\n console.error(`[NQTR] The room ${room} is not registered, so it can't be set as current room`);\n return;\n }\n storage.setVariable(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 Object.entries(registeredRooms).forEach(([_, room]) => {\n room.clearExpiredActivities();\n });\n }\n}\n"]}
@@ -1,2 +1,2 @@
1
- import {storage}from'@drincs/pixi-vn';var t={};function n(o){try{let e=t[o];if(!e){console.error(`[NQTR] Room ${o} not found`);return}return e}catch(e){console.error(`[NQTR] Error while getting Room ${o}`,e);return}}var a="___nqtr-current_room_memory___",i=class{get rooms(){return Object.values(t)}get locations(){let e={};return Object.values(t).forEach(r=>{e[r.location.id]=r.location;}),Object.values(e)}get maps(){let e={};return Object.values(t).forEach(r=>{e[r.location.map.id]=r.location.map;}),Object.values(e)}get currentRoom(){let e=storage.getVariable(a);if(!e){console.error("[NQTR] The current room has not yet been set");return}let r=n(e);if(!r){console.error(`[NQTR] Current room ${e} not found`);return}return r}set currentRoom(e){if(!n(e.id)){console.error(`[NQTR] The room ${e.id} is not registered, so it can't be set as current room`);return}storage.setVariable(a,e.id);}get currentLocation(){return this.currentRoom?.location}get currentMap(){return this.currentRoom?.location.map}clearExpiredActivities(){Object.entries(t).forEach(([e,r])=>{r.clearExpiredActivities();});}};export{i as default};//# sourceMappingURL=NavigatorManager.mjs.map
1
+ import {storage}from'@drincs/pixi-vn';var t={};function n(o){try{let e=t[o];if(!e){console.error(`[NQTR] Room ${o} not found`);return}return e}catch(e){console.error(`[NQTR] Error while getting Room ${o}`,e);return}}var a="___nqtr-current_room_memory___",i=class{get rooms(){return Object.values(t)}get locations(){let e={};return Object.values(t).forEach(r=>{e[r.location.id]=r.location;}),Object.values(e)}get maps(){let e={};return Object.values(t).forEach(r=>{e[r.location.map.id]=r.location.map;}),Object.values(e)}get currentRoom(){let e=storage.getVariable(a);if(!e){console.error("[NQTR] The current room has not yet been set");return}let r=n(e);if(!r){console.error(`[NQTR] Current room ${e} not found`);return}return r}set currentRoom(e){if(typeof e!="string"&&(e=e.id),!n(e)){console.error(`[NQTR] The room ${e} is not registered, so it can't be set as current room`);return}storage.setVariable(a,e);}get currentLocation(){return this.currentRoom?.location}get currentMap(){return this.currentRoom?.location.map}clearExpiredActivities(){Object.entries(t).forEach(([e,r])=>{r.clearExpiredActivities();});}};export{i as default};//# sourceMappingURL=NavigatorManager.mjs.map
2
2
  //# sourceMappingURL=NavigatorManager.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/decorators/RoomDecorator.ts","../../src/managers/NavigatorManager.ts"],"names":["registered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CAAAA,CAAQ,CACZ,OAAQ,CAAA,KAAA,CAAM,8CAA8C,CAAA,CAC5D,MACD,CACA,IAAIJ,CAAOF,CAAAA,CAAAA,CAAYM,CAAM,CAAA,CAC7B,GAAI,CAACJ,EAAM,CACV,OAAA,CAAQ,KAAM,CAAA,CAAA,oBAAA,EAAuBI,CAAM,CAAA,UAAA,CAAY,EACvD,MACD,CACA,OAAOJ,CACR,CACA,IAAI,YAAYA,CAAqB,CAAA,CAEpC,GAAI,CADkBF,CAAYE,CAAAA,CAAAA,CAAK,EAAE,CACnB,CAAA,CACrB,OAAQ,CAAA,KAAA,CAAM,CAAmBA,gBAAAA,EAAAA,CAAAA,CAAK,EAAE,CAAwD,sDAAA,CAAA,CAAA,CAChG,MACD,CACAK,OAAQ,CAAA,WAAA,CAAYJ,EAAyBD,CAAK,CAAA,EAAE,EACrD,CACA,IAAI,eAAA,EAAiD,CACpD,OAAO,IAAA,CAAK,WAAa,EAAA,QAC1B,CACA,IAAI,YAAuC,CAC1C,OAAO,IAAK,CAAA,WAAA,EAAa,QAAS,CAAA,GACnC,CAIA,sBAAyB,EAAA,CACxB,MAAO,CAAA,OAAA,CAAQH,CAAe,CAAA,CAAE,QAAQ,CAAC,CAACS,CAAGN,CAAAA,CAAI,CAAM,GAAA,CACtDA,EAAK,sBAAuB,GAC7B,CAAC,EACF,CACD","file":"NavigatorManager.mjs","sourcesContent":["import { RoomInterface } from \"../interface\";\n\nexport const registeredRooms: { [id: string]: RoomInterface } = {};\n\n/**\n * Save a room in the registered rooms. If the room already exists, it will be overwritten.\n * @param room The room to save.\n * @returns\n * @example\n * ```ts\n * saveRoom([mcRoom, aliceRoom, annRoom, bathroom, lounge, terrace, gymRoom]);\n * ```\n */\nexport function saveRoom(room: RoomInterface | RoomInterface[]) {\n\tif (Array.isArray(room)) {\n\t\troom.forEach((c) => saveRoom(c));\n\t\treturn;\n\t}\n\tif (registeredRooms[room.id]) {\n\t\tconsole.warn(`[NQTR] Room id ${room.id} already exists, it will be overwritten`);\n\t}\n\tregisteredRooms[room.id] = room;\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 */\nexport function getRoomById(id: string): RoomInterface | undefined {\n\ttry {\n\t\tlet room = registeredRooms[id];\n\t\tif (!room) {\n\t\t\tconsole.error(`[NQTR] Room ${id} not found`);\n\t\t\treturn;\n\t\t}\n\t\treturn room;\n\t} catch (e) {\n\t\tconsole.error(`[NQTR] Error while getting Room ${id}`, e);\n\t\treturn;\n\t}\n}\n","import { storage } from \"@drincs/pixi-vn\";\nimport { getRoomById, registeredRooms } from \"../decorators/RoomDecorator\";\nimport { LocationInterface, MapInterface, RoomInterface } from \"../interface\";\n\nconst CURRENT_ROOM_MEMORY_KEY = \"___nqtr-current_room_memory___\";\nexport default class NavigatorManager {\n\tget rooms() {\n\t\treturn Object.values(registeredRooms);\n\t}\n\tget locations() {\n\t\tlet result: { [id: string]: LocationInterface } = {};\n\t\tObject.values(registeredRooms).forEach((room) => {\n\t\t\tresult[room.location.id] = room.location;\n\t\t});\n\t\treturn Object.values(result);\n\t}\n\tget maps() {\n\t\tlet result: { [id: string]: MapInterface } = {};\n\t\tObject.values(registeredRooms).forEach((room) => {\n\t\t\tresult[room.location.map.id] = room.location.map;\n\t\t});\n\t\treturn Object.values(result);\n\t}\n\tget currentRoom(): RoomInterface | undefined {\n\t\tlet roomId = storage.getVariable<string>(CURRENT_ROOM_MEMORY_KEY);\n\t\tif (!roomId) {\n\t\t\tconsole.error(`[NQTR] The current room has not yet been set`);\n\t\t\treturn;\n\t\t}\n\t\tlet room = getRoomById(roomId);\n\t\tif (!room) {\n\t\t\tconsole.error(`[NQTR] Current room ${roomId} not found`);\n\t\t\treturn;\n\t\t}\n\t\treturn room;\n\t}\n\tset currentRoom(room: RoomInterface) {\n\t\tlet roomRegistrated = getRoomById(room.id);\n\t\tif (!roomRegistrated) {\n\t\t\tconsole.error(`[NQTR] The room ${room.id} is not registered, so it can't be set as current room`);\n\t\t\treturn;\n\t\t}\n\t\tstorage.setVariable(CURRENT_ROOM_MEMORY_KEY, room.id);\n\t}\n\tget currentLocation(): LocationInterface | undefined {\n\t\treturn this.currentRoom?.location;\n\t}\n\tget currentMap(): MapInterface | undefined {\n\t\treturn this.currentRoom?.location.map;\n\t}\n\t/**\n\t * Clear all the expired activities.\n\t */\n\tclearExpiredActivities() {\n\t\tObject.entries(registeredRooms).forEach(([_, room]) => {\n\t\t\troom.clearExpiredActivities();\n\t\t});\n\t}\n}\n"]}
1
+ {"version":3,"sources":["../../src/decorators/RoomDecorator.ts","../../src/managers/NavigatorManager.ts"],"names":["registeredRooms","getRoomById","id","room","CURRENT_ROOM_MEMORY_KEY","NavigatorManager","result","roomId","storage","_"],"mappings":"sCAEO,IAAMA,CAAAA,CAAmD,EA2BzD,CAAA,SAASC,CAAYC,CAAAA,CAAAA,CAAuC,CAClE,GAAI,CACH,IAAIC,CAAAA,CAAOH,CAAgBE,CAAAA,CAAE,CAC7B,CAAA,GAAI,CAACC,CAAM,CAAA,CACV,OAAQ,CAAA,KAAA,CAAM,CAAeD,YAAAA,EAAAA,CAAE,YAAY,CAC3C,CAAA,MACD,CACA,OAAOC,CACR,CAAA,MAAS,EAAG,CACX,OAAA,CAAQ,KAAM,CAAA,CAAA,gCAAA,EAAmCD,CAAE,CAAA,CAAA,CAAI,CAAC,CACxD,CAAA,MACD,CACD,CCrCME,IAAAA,CAAAA,CAA0B,iCACXC,CAArB,CAAA,KAAsC,CAClC,IAAI,KAAQ,EAAA,CACR,OAAO,MAAO,CAAA,MAAA,CAAOL,CAAe,CACxC,CACA,IAAI,WAAY,CACZ,IAAIM,CAA8C,CAAA,EAClD,CAAA,OAAA,MAAA,CAAO,OAAON,CAAe,CAAA,CAAE,OAASG,CAAAA,CAAAA,EAAS,CAC7CG,CAAAA,CAAOH,EAAK,QAAS,CAAA,EAAE,CAAIA,CAAAA,CAAAA,CAAK,SACpC,CAAC,EACM,MAAO,CAAA,MAAA,CAAOG,C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A,GAAM,CACnDA,CAAAA,CAAK,sBAAuB,GAChC,CAAC,EACL,CACJ","file":"NavigatorManager.mjs","sourcesContent":["import { RoomInterface } from \"../interface\";\n\nexport const registeredRooms: { [id: string]: RoomInterface } = {};\n\n/**\n * Save a room in the registered rooms. If the room already exists, it will be overwritten.\n * @param room The room to save.\n * @returns\n * @example\n * ```ts\n * saveRoom([mcRoom, aliceRoom, annRoom, bathroom, lounge, terrace, gymRoom]);\n * ```\n */\nexport function saveRoom(room: RoomInterface | RoomInterface[]) {\n\tif (Array.isArray(room)) {\n\t\troom.forEach((c) => saveRoom(c));\n\t\treturn;\n\t}\n\tif (registeredRooms[room.id]) {\n\t\tconsole.warn(`[NQTR] Room id ${room.id} already exists, it will be overwritten`);\n\t}\n\tregisteredRooms[room.id] = room;\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 */\nexport function getRoomById(id: string): RoomInterface | undefined {\n\ttry {\n\t\tlet room = registeredRooms[id];\n\t\tif (!room) {\n\t\t\tconsole.error(`[NQTR] Room ${id} not found`);\n\t\t\treturn;\n\t\t}\n\t\treturn room;\n\t} catch (e) {\n\t\tconsole.error(`[NQTR] Error while getting Room ${id}`, e);\n\t\treturn;\n\t}\n}\n","import { storage } from \"@drincs/pixi-vn\";\nimport { getRoomById, registeredRooms } from \"../decorators/RoomDecorator\";\nimport { LocationInterface, MapInterface, RoomInterface } from \"../interface\";\n\nconst CURRENT_ROOM_MEMORY_KEY = \"___nqtr-current_room_memory___\";\nexport default class NavigatorManager {\n get rooms() {\n return Object.values(registeredRooms);\n }\n get locations() {\n let result: { [id: string]: LocationInterface } = {};\n Object.values(registeredRooms).forEach((room) => {\n result[room.location.id] = room.location;\n });\n return Object.values(result);\n }\n get maps() {\n let result: { [id: string]: MapInterface } = {};\n Object.values(registeredRooms).forEach((room) => {\n result[room.location.map.id] = room.location.map;\n });\n return Object.values(result);\n }\n get currentRoom(): RoomInterface | undefined {\n let roomId = storage.getVariable<string>(CURRENT_ROOM_MEMORY_KEY);\n if (!roomId) {\n console.error(`[NQTR] The current room has not yet been set`);\n return;\n }\n let room = getRoomById(roomId);\n if (!room) {\n console.error(`[NQTR] 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 = getRoomById(room);\n if (!roomRegistrated) {\n console.error(`[NQTR] The room ${room} is not registered, so it can't be set as current room`);\n return;\n }\n storage.setVariable(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 Object.entries(registeredRooms).forEach(([_, room]) => {\n room.clearExpiredActivities();\n });\n }\n}\n"]}
@@ -1,5 +1,5 @@
1
1
  import { OnRunProps } from '@drincs/nqtr';
2
- import { Q as QuestInterface } from '../StageInterface-DJ7l0ubG.mjs';
2
+ import { Q as QuestInterface } from '../StageInterface-DX74DUxG.mjs';
3
3
 
4
4
  declare class QuestManager {
5
5
  get quests(): QuestInterface[];
@@ -1,5 +1,5 @@
1
1
  import { OnRunProps } from '@drincs/nqtr';
2
- import { Q as QuestInterface } from '../StageInterface-DJ7l0ubG.js';
2
+ import { Q as QuestInterface } from '../StageInterface-DX74DUxG.js';
3
3
 
4
4
  declare class QuestManager {
5
5
  get quests(): QuestInterface[];
@@ -1,5 +1,5 @@
1
1
  import { CharacterInterface } from '@drincs/pixi-vn';
2
- import { C as CommitmentInterface } from '../RoomInterface-DsZAp6Pv.mjs';
2
+ import { C as CommitmentInterface } from '../RoomInterface-DURfkQ7u.mjs';
3
3
  import '@drincs/nqtr';
4
4
  import '../interface/ActivityInterface.mjs';
5
5
  import '../types/ExecutionType.mjs';
@@ -1,5 +1,5 @@
1
1
  import { CharacterInterface } from '@drincs/pixi-vn';
2
- import { C as CommitmentInterface } from '../RoomInterface-BglEhkQT.js';
2
+ import { C as CommitmentInterface } from '../RoomInterface-CdAM_q7P.js';
3
3
  import '@drincs/nqtr';
4
4
  import '../interface/ActivityInterface.js';
5
5
  import '../types/ExecutionType.js';
@@ -1,2 +1,2 @@
1
- 'use strict';var pixiVn=require('@drincs/pixi-vn');var s={};function R(i){try{let e=s[i];if(!e){console.error(`[NQTR] Room ${i} not found`);return}return e}catch(e){console.error(`[NQTR] Error while getting Room ${i}`,e);return}}var _="___nqtr-current_room_memory___",c=class{get rooms(){return Object.values(s)}get locations(){let e={};return Object.values(s).forEach(t=>{e[t.location.id]=t.location;}),Object.values(e)}get maps(){let e={};return Object.values(s).forEach(t=>{e[t.location.map.id]=t.location.map;}),Object.values(e)}get currentRoom(){let e=pixiVn.storage.getVariable(_);if(!e){console.error("[NQTR] The current room has not yet been set");return}let t=R(e);if(!t){console.error(`[NQTR] Current room ${e} not found`);return}return t}set currentRoom(e){if(!R(e.id)){console.error(`[NQTR] The room ${e.id} is not registered, so it can't be set as current room`);return}pixiVn.storage.setVariable(_,e.id);}get currentLocation(){return this.currentRoom?.location}get currentMap(){return this.currentRoom?.location.map}clearExpiredActivities(){Object.entries(s).forEach(([e,t])=>{t.clearExpiredActivities();});}};var C=new c;new d;var h={},y={};function p(i){try{let e=h[i];if(!e){console.error(`[NQTR] Commitment ${i} not found`);return}return e}catch(e){console.error(`[NQTR] Error while getting Commitment ${i}`,e);return}}var I="___nqtr-temporary_commitment___",d=class{get fixedRoutine(){return Object.values(y)}set fixedRoutine(e){e.forEach(t=>{y[t.id]&&console.warn(`[NQTR] Commitment id ${t.id} already exists, it will be overwritten`),y[t.id]=t;});}get temporaryRoutine(){let e=pixiVn.storage.getVariable(I);return e?e.map(r=>p(r)).filter(r=>r!==undefined):[]}get allRoutine(){return [...this.fixedRoutine,...this.temporaryRoutine]}add(e){Array.isArray(e)||(e=[e]);let t=e.map(r=>{if(!p(r.id)){console.warn(`[NQTR] Commitment ${r.id} not found, it will be ignored`);return}return r.id}).filter(r=>r!==undefined);pixiVn.storage.setVariable(I,t);}find(e){return p(e)}remove(e){Array.isArray(e)||(e=[e]);let t=e.map(o=>o.id),r=pixiVn.storage.getVariable(I);r&&(r=r.filter(o=>!t.includes(o)),pixiVn.storage.setVariable(I,r));}clearExpiredRoutine(){Object.values(h).forEach(e=>{e.expired&&delete h[e.id];});}get currentRoutine(){let e={};return [...this.temporaryRoutine,...this.fixedRoutine].reverse().forEach(t=>{t.isActive&&(t.characters.length>0?t.characters.every(o=>!e[o.id]||t.priority>e[o.id].priority)&&t.characters.forEach(o=>{e[o.id]=t;}):console.error(`[NQTR] The commitment ${t.id} has no characters assigned`));}),Object.values(e)}get currentRoomRoutine(){return C.currentRoom?.routine||[]}getCommitmentByCharacter(e){this.currentRoutine.forEach(t=>{if(t.characters.map(r=>r.id).includes(e.id))return t});}};module.exports=d;//# sourceMappingURL=RoutineManager.js.map
1
+ 'use strict';var pixiVn=require('@drincs/pixi-vn');var s={};function R(i){try{let e=s[i];if(!e){console.error(`[NQTR] Room ${i} not found`);return}return e}catch(e){console.error(`[NQTR] Error while getting Room ${i}`,e);return}}var _="___nqtr-current_room_memory___",c=class{get rooms(){return Object.values(s)}get locations(){let e={};return Object.values(s).forEach(t=>{e[t.location.id]=t.location;}),Object.values(e)}get maps(){let e={};return Object.values(s).forEach(t=>{e[t.location.map.id]=t.location.map;}),Object.values(e)}get currentRoom(){let e=pixiVn.storage.getVariable(_);if(!e){console.error("[NQTR] The current room has not yet been set");return}let t=R(e);if(!t){console.error(`[NQTR] Current room ${e} not found`);return}return t}set currentRoom(e){if(typeof e!="string"&&(e=e.id),!R(e)){console.error(`[NQTR] The room ${e} is not registered, so it can't be set as current room`);return}pixiVn.storage.setVariable(_,e);}get currentLocation(){return this.currentRoom?.location}get currentMap(){return this.currentRoom?.location.map}clearExpiredActivities(){Object.entries(s).forEach(([e,t])=>{t.clearExpiredActivities();});}};var C=new c;new d;var y={},h={};function p(i){try{let e=y[i];if(!e){console.error(`[NQTR] Commitment ${i} not found`);return}return e}catch(e){console.error(`[NQTR] Error while getting Commitment ${i}`,e);return}}var I="___nqtr-temporary_commitment___",d=class{get fixedRoutine(){return Object.values(h)}set fixedRoutine(e){e.forEach(t=>{h[t.id]&&console.warn(`[NQTR] Commitment id ${t.id} already exists, it will be overwritten`),h[t.id]=t;});}get temporaryRoutine(){let e=pixiVn.storage.getVariable(I);return e?e.map(r=>p(r)).filter(r=>r!==undefined):[]}get allRoutine(){return [...this.fixedRoutine,...this.temporaryRoutine]}add(e){Array.isArray(e)||(e=[e]);let t=e.map(r=>{if(!p(r.id)){console.warn(`[NQTR] Commitment ${r.id} not found, it will be ignored`);return}return r.id}).filter(r=>r!==undefined);pixiVn.storage.setVariable(I,t);}find(e){return p(e)}remove(e){Array.isArray(e)||(e=[e]);let t=e.map(o=>o.id),r=pixiVn.storage.getVariable(I);r&&(r=r.filter(o=>!t.includes(o)),pixiVn.storage.setVariable(I,r));}clearExpiredRoutine(){Object.values(y).forEach(e=>{e.expired&&delete y[e.id];});}get currentRoutine(){let e={};return [...this.temporaryRoutine,...this.fixedRoutine].reverse().forEach(t=>{t.isActive&&(t.characters.length>0?t.characters.every(o=>!e[o.id]||t.priority>e[o.id].priority)&&t.characters.forEach(o=>{e[o.id]=t;}):console.error(`[NQTR] The commitment ${t.id} has no characters assigned`));}),Object.values(e)}get currentRoomRoutine(){return C.currentRoom?.routine||[]}getCommitmentByCharacter(e){this.currentRoutine.forEach(t=>{if(t.characters.map(r=>r.id).includes(e.id))return t});}};module.exports=d;//# sourceMappingURL=RoutineManager.js.map
2
2
  //# sourceMappingURL=RoutineManager.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/decorators/RoomDecorator.ts","../../src/managers/NavigatorManager.ts","../../src/managers/index.ts","../../src/decorators/CommitmentDecorator.ts","../../src/managers/RoutineManager.ts"],"names":["registeredRooms","getRoomById","id","room","CURRENT_ROOM_MEMORY_KEY","NavigatorManager","result","roomId","storage","_","timeTracker","navigator","RoutineManager","questsNotebook","registeredCommitments","fixedCommitments","getCommitmentById","commitment","TEMPORARY_COMMITMENT_CATEGORY_MEMORY_KEY","commitments","c","commitmentsIds","currentCommitments","character_commitments","ch","character"],"mappings":"mDAEO,IAAMA,CAAAA,CAAmD,EAAC,CA2B1D,SAASC,CAAAA,CAAYC,EAAuC,CAClE,GAAI,CACH,IAAIC,CAAOH,CAAAA,CAAAA,CAAgBE,CAAE,CAAA,CAC7B,GAAI,CAACC,CAAAA,CAAM,CACV,OAAA,CAAQ,KAAM,CAAA,CAAA,YAAA,EAAeD,CAAE,CAAA,UAAA,CAAY,EAC3C,MACD,CACA,OAAOC,CACR,CAAS,MAAA,CAAA,CAAG,CACX,OAAA,CAAQ,MAAM,CAAmCD,gCAAAA,EAAAA,CAAE,CAAI,CAAA,CAAA,CAAC,CACxD,CAAA,MACD,CACD,CCrCA,IAAME,CAA0B,CAAA,gCAAA,CACXC,CAArB,CAAA,KAAsC,CACrC,IAAI,KAAQ,EAAA,CACX,OAAO,MAAO,CAAA,MAAA,CAAOL,CAAe,CACrC,CACA,IAAI,SAAY,EAAA,CACf,IAAIM,CAA8C,CAAA,EAClD,CAAA,OAAA,MAAA,CAAO,MAAON,CAAAA,CAAe,CAAE,CAAA,OAAA,CAASG,GAAS,CAChDG,CAAAA,CAAOH,CAAK,CAAA,QAAA,CAAS,EAAE,CAAA,CAAIA,CAAK,CAAA,SACjC,CAAC,CACM,CAAA,MAAA,CAAO,MAAOG,CAAAA,CAAM,CAC5B,CACA,IAAI,IAAA,EAAO,CACV,IAAIA,CAAAA,CAAyC,EAAC,CAC9C,OAAO,MAAA,CAAA,MAAA,CAAON,CAAe,CAAA,CAAE,QAASG,CAAS,EAAA,CAChDG,CAAOH,CAAAA,CAAAA,CAAK,QAAS,CAAA,GAAA,CAAI,EAAE,CAAA,CAAIA,EAAK,QAAS,CAAA,IAC9C,CAAC,CAAA,CACM,MAAO,CAAA,MAAA,CAAOG,CAAM,CAC5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ACrEA,CAAE,CAAA,QAAA,GACDA,CAAE,CAAA,UAAA,CAAW,OAAS,CAENA,CAAAA,CAAAA,CAAE,UAAW,CAAA,KAAA,CAC9BI,GAAO,CAACD,CAAAA,CAAsBC,CAAG,CAAA,EAAE,CAAKJ,EAAAA,CAAAA,CAAE,QAAWG,CAAAA,CAAAA,CAAsBC,EAAG,EAAE,CAAA,CAAE,QACpF,CAAA,EAECJ,CAAE,CAAA,UAAA,CAAW,OAASI,CAAAA,CAAAA,EAAO,CAC5BD,CAAsBC,CAAAA,CAAAA,CAAG,EAAE,CAAA,CAAIJ,EAChC,CAAC,CAGF,CAAA,OAAA,CAAQ,MAAM,CAAyBA,sBAAAA,EAAAA,CAAAA,CAAE,EAAE,CAAA,2BAAA,CAA6B,CAG3E,EAAA,CAAC,CACM,CAAA,MAAA,CAAO,OAAOG,CAAqB,CAC3C,CAEA,IAAI,kBAA4C,EAAA,CAC/C,OAAOZ,CAAAA,CAAU,aAAa,OAAW,EAAA,EAC1C,CAOA,wBAAyBc,CAAAA,CAAAA,CAAgE,CACxF,IAAA,CAAK,eAAe,OAASL,CAAAA,CAAAA,EAAM,CAClC,GAAIA,CAAE,CAAA,UAAA,CAAW,GAAKI,CAAAA,CAAAA,EAAOA,EAAG,EAAE,CAAA,CAAE,QAASC,CAAAA,CAAAA,CAAU,EAAE,CACxD,CAAA,OAAOL,CAET,CAAC,EAEF,CACD","file":"RoutineManager.js","sourcesContent":["import { RoomInterface } from \"../interface\";\n\nexport const registeredRooms: { [id: string]: RoomInterface } = {};\n\n/**\n * Save a room in the registered rooms. If the room already exists, it will be overwritten.\n * @param room The room to save.\n * @returns\n * @example\n * ```ts\n * saveRoom([mcRoom, aliceRoom, annRoom, bathroom, lounge, terrace, gymRoom]);\n * ```\n */\nexport function saveRoom(room: RoomInterface | RoomInterface[]) {\n\tif (Array.isArray(room)) {\n\t\troom.forEach((c) => saveRoom(c));\n\t\treturn;\n\t}\n\tif (registeredRooms[room.id]) {\n\t\tconsole.warn(`[NQTR] Room id ${room.id} already exists, it will be overwritten`);\n\t}\n\tregisteredRooms[room.id] = room;\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 */\nexport function getRoomById(id: string): RoomInterface | undefined {\n\ttry {\n\t\tlet room = registeredRooms[id];\n\t\tif (!room) {\n\t\t\tconsole.error(`[NQTR] Room ${id} not found`);\n\t\t\treturn;\n\t\t}\n\t\treturn room;\n\t} catch (e) {\n\t\tconsole.error(`[NQTR] Error while getting Room ${id}`, e);\n\t\treturn;\n\t}\n}\n","import { storage } from \"@drincs/pixi-vn\";\nimport { getRoomById, registeredRooms } from \"../decorators/RoomDecorator\";\nimport { LocationInterface, MapInterface, RoomInterface } from \"../interface\";\n\nconst CURRENT_ROOM_MEMORY_KEY = \"___nqtr-current_room_memory___\";\nexport default class NavigatorManager {\n\tget rooms() {\n\t\treturn Object.values(registeredRooms);\n\t}\n\tget locations() {\n\t\tlet result: { [id: string]: LocationInterface } = {};\n\t\tObject.values(registeredRooms).forEach((room) => {\n\t\t\tresult[room.location.id] = room.location;\n\t\t});\n\t\treturn Object.values(result);\n\t}\n\tget maps() {\n\t\tlet result: { [id: string]: MapInterface } = {};\n\t\tObject.values(registeredRooms).forEach((room) => {\n\t\t\tresult[room.location.map.id] = room.location.map;\n\t\t});\n\t\treturn Object.values(result);\n\t}\n\tget currentRoom(): RoomInterface | undefined {\n\t\tlet roomId = storage.getVariable<string>(CURRENT_ROOM_MEMORY_KEY);\n\t\tif (!roomId) {\n\t\t\tconsole.error(`[NQTR] The current room has not yet been set`);\n\t\t\treturn;\n\t\t}\n\t\tlet room = getRoomById(roomId);\n\t\tif (!room) {\n\t\t\tconsole.error(`[NQTR] Current room ${roomId} not found`);\n\t\t\treturn;\n\t\t}\n\t\treturn room;\n\t}\n\tset currentRoom(room: RoomInterface) {\n\t\tlet roomRegistrated = getRoomById(room.id);\n\t\tif (!roomRegistrated) {\n\t\t\tconsole.error(`[NQTR] The room ${room.id} is not registered, so it can't be set as current room`);\n\t\t\treturn;\n\t\t}\n\t\tstorage.setVariable(CURRENT_ROOM_MEMORY_KEY, room.id);\n\t}\n\tget currentLocation(): LocationInterface | undefined {\n\t\treturn this.currentRoom?.location;\n\t}\n\tget currentMap(): MapInterface | undefined {\n\t\treturn this.currentRoom?.location.map;\n\t}\n\t/**\n\t * Clear all the expired activities.\n\t */\n\tclearExpiredActivities() {\n\t\tObject.entries(registeredRooms).forEach(([_, room]) => {\n\t\t\troom.clearExpiredActivities();\n\t\t});\n\t}\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 { CommitmentInterface } from \"../interface\";\n\nexport const registeredCommitments: { [id: string]: CommitmentInterface } = {};\nexport const fixedCommitments: { [id: string]: CommitmentInterface } = {};\n\n/**\n * Save a commitment in the registered commitments. If the commitment already exists, it will be overwritten.\n * @param commitment The commitment or commitments to save.\n * @returns\n */\nexport function saveCommitment(commitment: CommitmentInterface | CommitmentInterface[]) {\n\tif (Array.isArray(commitment)) {\n\t\tcommitment.forEach((c) => saveCommitment(c));\n\t\treturn;\n\t}\n\tif (registeredCommitments[commitment.id]) {\n\t\tconsole.warn(`[NQTR] Commitment id ${commitment.id} already exists, it will be overwritten`);\n\t}\n\tregisteredCommitments[commitment.id] = commitment;\n}\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 */\nexport function getCommitmentById(id: string): CommitmentInterface | undefined {\n\ttry {\n\t\tlet commitment = registeredCommitments[id];\n\t\tif (!commitment) {\n\t\t\tconsole.error(`[NQTR] Commitment ${id} not found`);\n\t\t\treturn;\n\t\t}\n\t\treturn commitment;\n\t} catch (e) {\n\t\tconsole.error(`[NQTR] Error while getting Commitment ${id}`, e);\n\t\treturn;\n\t}\n}\n","import { CharacterInterface, storage } from \"@drincs/pixi-vn\";\nimport { navigator } from \".\";\nimport { fixedCommitments, getCommitmentById, registeredCommitments } from \"../decorators/CommitmentDecorator\";\nimport { CommitmentInterface } from \"../interface\";\n\nconst TEMPORARY_COMMITMENT_CATEGORY_MEMORY_KEY = \"___nqtr-temporary_commitment___\";\nexport default class RoutineManager {\n\tget fixedRoutine(): CommitmentInterface[] {\n\t\treturn Object.values(fixedCommitments);\n\t}\n\t/**\n\t * Set a commitment as fixed, it will be always available. They cannot be deleted or edit during the game session.\n\t */\n\tset fixedRoutine(commitments: CommitmentInterface[]) {\n\t\tcommitments.forEach((c) => {\n\t\t\tif (fixedCommitments[c.id]) {\n\t\t\t\tconsole.warn(`[NQTR] Commitment id ${c.id} already exists, it will be overwritten`);\n\t\t\t}\n\t\t\tfixedCommitments[c.id] = c;\n\t\t});\n\t}\n\n\t/**\n\t * Get the temporary commitments by its id.\n\t * @returns The temporary commitments.\n\t */\n\tget temporaryRoutine(): CommitmentInterface[] {\n\t\tlet commitmentsIds = storage.getVariable<string[]>(TEMPORARY_COMMITMENT_CATEGORY_MEMORY_KEY);\n\t\tif (!commitmentsIds) {\n\t\t\treturn [];\n\t\t}\n\t\tlet commitments = commitmentsIds\n\t\t\t.map((id) => getCommitmentById(id))\n\t\t\t.filter((commitment) => commitment !== undefined);\n\t\treturn commitments;\n\t}\n\n\tget allRoutine(): CommitmentInterface[] {\n\t\treturn [...this.fixedRoutine, ...this.temporaryRoutine];\n\t}\n\n\t/**\n\t * This feature adds the commitments during the game session.\n\t * @param commitment The commitment or commitments to add.\n\t */\n\tadd(commitment: CommitmentInterface[] | CommitmentInterface) {\n\t\tif (!Array.isArray(commitment)) {\n\t\t\tcommitment = [commitment];\n\t\t}\n\t\tlet commitmentsIds = commitment\n\t\t\t.map((commitment) => {\n\t\t\t\tlet commitmentTest = getCommitmentById(commitment.id);\n\t\t\t\tif (!commitmentTest) {\n\t\t\t\t\tconsole.warn(`[NQTR] Commitment ${commitment.id} not found, it will be ignored`);\n\t\t\t\t\treturn undefined;\n\t\t\t\t}\n\t\t\t\treturn commitment.id;\n\t\t\t})\n\t\t\t.filter((id) => id !== undefined);\n\n\t\tstorage.setVariable(TEMPORARY_COMMITMENT_CATEGORY_MEMORY_KEY, commitmentsIds);\n\t}\n\n\t/**\n\t * Get the commitments added during the game session.\n\t * @param id The id of the commitment.\n\t * @returns The commitment or undefined if not found.\n\t */\n\tfind(id: string): CommitmentInterface | undefined {\n\t\treturn getCommitmentById(id);\n\t}\n\n\t/**\n\t * Remove the commitments added during the game session.\n\t * @param commitment The commitment or commitments to remove.\n\t */\n\tremove(commitment: CommitmentInterface[] | CommitmentInterface) {\n\t\tif (!Array.isArray(commitment)) {\n\t\t\tcommitment = [commitment];\n\t\t}\n\t\tlet commitmentsIds = commitment.map((commitment) => {\n\t\t\treturn commitment.id;\n\t\t});\n\n\t\tlet currentCommitments = storage.getVariable<string[]>(TEMPORARY_COMMITMENT_CATEGORY_MEMORY_KEY);\n\t\tif (!currentCommitments) {\n\t\t\treturn;\n\t\t}\n\t\tcurrentCommitments = currentCommitments.filter((id) => !commitmentsIds.includes(id));\n\t\tstorage.setVariable(TEMPORARY_COMMITMENT_CATEGORY_MEMORY_KEY, currentCommitments);\n\t}\n\n\t/**\n\t * Clear all the expired commitments.\n\t */\n\tclearExpiredRoutine() {\n\t\tObject.values(registeredCommitments).forEach((commitment) => {\n\t\t\tif (commitment.expired) {\n\t\t\t\tdelete registeredCommitments[commitment.id];\n\t\t\t}\n\t\t});\n\t}\n\n\t/**\n\t * Get the current commitments. The hidden commitments are not included.\n\t * 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\t * Higher priority commitments are calculated using the following steps:\n\t * 1. The commitments that have Commitments BaseModel.priority set to a higher value will be selected first.\n\t * 2. If there are commitments with the same priority, the commitments that are not fixed will be selected first.\n\t * 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\t * @returns The current commitments.\n\t */\n\tget currentRoutine(): CommitmentInterface[] {\n\t\tlet character_commitments: { [character: string]: CommitmentInterface } = {};\n\t\t[...this.temporaryRoutine, ...this.fixedRoutine].reverse().forEach((c) => {\n\t\t\tif (c.isActive) {\n\t\t\t\tif (c.characters.length > 0) {\n\t\t\t\t\t// all the characters don't already have commitments or the commitment has a higher priority\n\t\t\t\t\tlet allAvailable = c.characters.every(\n\t\t\t\t\t\t(ch) => !character_commitments[ch.id] || c.priority > character_commitments[ch.id].priority\n\t\t\t\t\t);\n\t\t\t\t\tif (allAvailable) {\n\t\t\t\t\t\tc.characters.forEach((ch) => {\n\t\t\t\t\t\t\tcharacter_commitments[ch.id] = c;\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tconsole.error(`[NQTR] The commitment ${c.id} has no characters assigned`);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t\treturn Object.values(character_commitments);\n\t}\n\n\tget currentRoomRoutine(): CommitmentInterface[] {\n\t\treturn navigator.currentRoom?.routine || [];\n\t}\n\n\t/**\n\t * Get the character commitment.\n\t * @param character The character.\n\t * @returns The commitment or undefined if not found.\n\t */\n\tgetCommitmentByCharacter(character: CharacterInterface): CommitmentInterface | undefined {\n\t\tthis.currentRoutine.forEach((c) => {\n\t\t\tif (c.characters.map((ch) => ch.id).includes(character.id)) {\n\t\t\t\treturn c;\n\t\t\t}\n\t\t});\n\t\treturn undefined;\n\t}\n}\n"]}
1
+ {"version":3,"sources":["../../src/decorators/RoomDecorator.ts","../../src/managers/NavigatorManager.ts","../../src/managers/index.ts","../../src/decorators/CommitmentDecorator.ts","../../src/managers/RoutineManager.ts"],"names":["registeredRooms","getRoomById","id","room","CURRENT_ROOM_MEMORY_KEY","NavigatorManager","result","roomId","storage","_","navigator","routine","RoutineManager","registeredCommitments","fixedCommitments","getCommitmentById","commitment","TEMPORARY_COMMITMENT_CATEGORY_MEMORY_KEY","commitments","c","commitmentsIds","currentCommitments","character_commitments","ch","character"],"mappings":"mDAEO,IAAMA,CAAAA,CAAmD,EAAC,CA2B1D,SAASC,CAAAA,CAAYC,EAAuC,CAClE,GAAI,CACH,IAAIC,CAAOH,CAAAA,CAAAA,CAAgBE,CAAE,CAAA,CAC7B,GAAI,CAACC,CAAAA,CAAM,CACV,OAAA,CAAQ,KAAM,CAAA,CAAA,YAAA,EAAeD,CAAE,CAAA,UAAA,CAAY,EAC3C,MACD,CACA,OAAOC,CACR,CAAS,MAAA,CAAA,CAAG,CACX,OAAA,CAAQ,MAAM,CAAmCD,gCAAAA,EAAAA,CAAE,CAAI,CAAA,CAAA,CAAC,CACxD,CAAA,MACD,CACD,CCrCA,IAAME,CAA0B,CAAA,gCAAA,CACXC,CAArB,CAAA,KAAsC,CAClC,IAAI,KAAQ,EAAA,CACR,OAAO,MAAO,CAAA,MAAA,CAAOL,CAAe,CACxC,CACA,IAAI,SAAA,EAAY,CACZ,IAAIM,EAA8C,EAAC,CACnD,OAAO,MAAA,CAAA,MAAA,CAAON,CAAe,CAAA,CAAE,OAASG,CAAAA,CAAAA,EAAS,CAC7CG,CAAOH,CAAAA,CAAAA,CAAK,QAAS,CAAA,EAAE,CAAIA,CAAAA,CAAAA,CAAK,SACpC,CAAC,EACM,MAAO,CAAA,MAAA,CAAOG,CAAM,CAC/B,CACA,IAAI,IAAO,EAAA,CACP,IAAIA,CAAyC,CAAA,EAC7C,CAAA,OAAA,MAAA,CAAO,MAAON,CAAAA,CAAe,CAAE,CAAA,OAAA,CAASG,GAAS,CAC7CG,CAAAA,CAAOH,CAAK,CAAA,QAAA,CAAS,GAAI,CAAA,EAAE,CAAIA,CAAAA,CAAAA,CAAK,SAAS,IACjD,CAAC,CACM,CAAA,MAAA,CAAO,MAAOG,CAAAA,CAAM,CAC/B,CACA,IAAI,WAAyC,EAAA,CACzC,IAAIC,CAAAA,CAASC,cAAQ,CAAA,WAAA,CAA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AA,CAACD,CAAsBC,CAAAA,CAAAA,CAAG,EAAE,CAAA,EAAKJ,CAAE,CAAA,QAAA,CAAWG,EAAsBC,CAAG,CAAA,EAAE,CAAE,CAAA,QACpF,CAECJ,EAAAA,CAAAA,CAAE,UAAW,CAAA,OAAA,CAASI,GAAO,CAC5BD,CAAAA,CAAsBC,CAAG,CAAA,EAAE,CAAIJ,CAAAA,EAChC,CAAC,CAAA,CAGF,QAAQ,KAAM,CAAA,CAAA,sBAAA,EAAyBA,CAAE,CAAA,EAAE,6BAA6B,CAG3E,EAAA,CAAC,CACM,CAAA,MAAA,CAAO,OAAOG,CAAqB,CAC3C,CAEA,IAAI,kBAA4C,EAAA,CAC/C,OAAOZ,CAAAA,CAAU,aAAa,OAAW,EAAA,EAC1C,CAOA,wBAAyBc,CAAAA,CAAAA,CAAgE,CACxF,IAAA,CAAK,eAAe,OAASL,CAAAA,CAAAA,EAAM,CAClC,GAAIA,CAAE,CAAA,UAAA,CAAW,GAAKI,CAAAA,CAAAA,EAAOA,EAAG,EAAE,CAAA,CAAE,QAASC,CAAAA,CAAAA,CAAU,EAAE,CACxD,CAAA,OAAOL,CAET,CAAC,EAEF,CACD","file":"RoutineManager.js","sourcesContent":["import { RoomInterface } from \"../interface\";\n\nexport const registeredRooms: { [id: string]: RoomInterface } = {};\n\n/**\n * Save a room in the registered rooms. If the room already exists, it will be overwritten.\n * @param room The room to save.\n * @returns\n * @example\n * ```ts\n * saveRoom([mcRoom, aliceRoom, annRoom, bathroom, lounge, terrace, gymRoom]);\n * ```\n */\nexport function saveRoom(room: RoomInterface | RoomInterface[]) {\n\tif (Array.isArray(room)) {\n\t\troom.forEach((c) => saveRoom(c));\n\t\treturn;\n\t}\n\tif (registeredRooms[room.id]) {\n\t\tconsole.warn(`[NQTR] Room id ${room.id} already exists, it will be overwritten`);\n\t}\n\tregisteredRooms[room.id] = room;\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 */\nexport function getRoomById(id: string): RoomInterface | undefined {\n\ttry {\n\t\tlet room = registeredRooms[id];\n\t\tif (!room) {\n\t\t\tconsole.error(`[NQTR] Room ${id} not found`);\n\t\t\treturn;\n\t\t}\n\t\treturn room;\n\t} catch (e) {\n\t\tconsole.error(`[NQTR] Error while getting Room ${id}`, e);\n\t\treturn;\n\t}\n}\n","import { storage } from \"@drincs/pixi-vn\";\nimport { getRoomById, registeredRooms } from \"../decorators/RoomDecorator\";\nimport { LocationInterface, MapInterface, RoomInterface } from \"../interface\";\n\nconst CURRENT_ROOM_MEMORY_KEY = \"___nqtr-current_room_memory___\";\nexport default class NavigatorManager {\n get rooms() {\n return Object.values(registeredRooms);\n }\n get locations() {\n let result: { [id: string]: LocationInterface } = {};\n Object.values(registeredRooms).forEach((room) => {\n result[room.location.id] = room.location;\n });\n return Object.values(result);\n }\n get maps() {\n let result: { [id: string]: MapInterface } = {};\n Object.values(registeredRooms).forEach((room) => {\n result[room.location.map.id] = room.location.map;\n });\n return Object.values(result);\n }\n get currentRoom(): RoomInterface | undefined {\n let roomId = storage.getVariable<string>(CURRENT_ROOM_MEMORY_KEY);\n if (!roomId) {\n console.error(`[NQTR] The current room has not yet been set`);\n return;\n }\n let room = getRoomById(roomId);\n if (!room) {\n console.error(`[NQTR] 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 = getRoomById(room);\n if (!roomRegistrated) {\n console.error(`[NQTR] The room ${room} is not registered, so it can't be set as current room`);\n return;\n }\n storage.setVariable(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 Object.entries(registeredRooms).forEach(([_, room]) => {\n room.clearExpiredActivities();\n });\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 { CommitmentInterface } from \"../interface\";\n\nexport const registeredCommitments: { [id: string]: CommitmentInterface } = {};\nexport const fixedCommitments: { [id: string]: CommitmentInterface } = {};\n\n/**\n * Save a commitment in the registered commitments. If the commitment already exists, it will be overwritten.\n * @param commitment The commitment or commitments to save.\n * @returns\n */\nexport function saveCommitment(commitment: CommitmentInterface | CommitmentInterface[]) {\n\tif (Array.isArray(commitment)) {\n\t\tcommitment.forEach((c) => saveCommitment(c));\n\t\treturn;\n\t}\n\tif (registeredCommitments[commitment.id]) {\n\t\tconsole.warn(`[NQTR] Commitment id ${commitment.id} already exists, it will be overwritten`);\n\t}\n\tregisteredCommitments[commitment.id] = commitment;\n}\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 */\nexport function getCommitmentById(id: string): CommitmentInterface | undefined {\n\ttry {\n\t\tlet commitment = registeredCommitments[id];\n\t\tif (!commitment) {\n\t\t\tconsole.error(`[NQTR] Commitment ${id} not found`);\n\t\t\treturn;\n\t\t}\n\t\treturn commitment;\n\t} catch (e) {\n\t\tconsole.error(`[NQTR] Error while getting Commitment ${id}`, e);\n\t\treturn;\n\t}\n}\n","import { CharacterInterface, storage } from \"@drincs/pixi-vn\";\nimport { navigator } from \".\";\nimport { fixedCommitments, getCommitmentById, registeredCommitments } from \"../decorators/CommitmentDecorator\";\nimport { CommitmentInterface } from \"../interface\";\n\nconst TEMPORARY_COMMITMENT_CATEGORY_MEMORY_KEY = \"___nqtr-temporary_commitment___\";\nexport default class RoutineManager {\n\tget fixedRoutine(): CommitmentInterface[] {\n\t\treturn Object.values(fixedCommitments);\n\t}\n\t/**\n\t * Set a commitment as fixed, it will be always available. They cannot be deleted or edit during the game session.\n\t */\n\tset fixedRoutine(commitments: CommitmentInterface[]) {\n\t\tcommitments.forEach((c) => {\n\t\t\tif (fixedCommitments[c.id]) {\n\t\t\t\tconsole.warn(`[NQTR] Commitment id ${c.id} already exists, it will be overwritten`);\n\t\t\t}\n\t\t\tfixedCommitments[c.id] = c;\n\t\t});\n\t}\n\n\t/**\n\t * Get the temporary commitments by its id.\n\t * @returns The temporary commitments.\n\t */\n\tget temporaryRoutine(): CommitmentInterface[] {\n\t\tlet commitmentsIds = storage.getVariable<string[]>(TEMPORARY_COMMITMENT_CATEGORY_MEMORY_KEY);\n\t\tif (!commitmentsIds) {\n\t\t\treturn [];\n\t\t}\n\t\tlet commitments = commitmentsIds\n\t\t\t.map((id) => getCommitmentById(id))\n\t\t\t.filter((commitment) => commitment !== undefined);\n\t\treturn commitments;\n\t}\n\n\tget allRoutine(): CommitmentInterface[] {\n\t\treturn [...this.fixedRoutine, ...this.temporaryRoutine];\n\t}\n\n\t/**\n\t * This feature adds the commitments during the game session.\n\t * @param commitment The commitment or commitments to add.\n\t */\n\tadd(commitment: CommitmentInterface[] | CommitmentInterface) {\n\t\tif (!Array.isArray(commitment)) {\n\t\t\tcommitment = [commitment];\n\t\t}\n\t\tlet commitmentsIds = commitment\n\t\t\t.map((commitment) => {\n\t\t\t\tlet commitmentTest = getCommitmentById(commitment.id);\n\t\t\t\tif (!commitmentTest) {\n\t\t\t\t\tconsole.warn(`[NQTR] Commitment ${commitment.id} not found, it will be ignored`);\n\t\t\t\t\treturn undefined;\n\t\t\t\t}\n\t\t\t\treturn commitment.id;\n\t\t\t})\n\t\t\t.filter((id) => id !== undefined);\n\n\t\tstorage.setVariable(TEMPORARY_COMMITMENT_CATEGORY_MEMORY_KEY, commitmentsIds);\n\t}\n\n\t/**\n\t * Get the commitments added during the game session.\n\t * @param id The id of the commitment.\n\t * @returns The commitment or undefined if not found.\n\t */\n\tfind(id: string): CommitmentInterface | undefined {\n\t\treturn getCommitmentById(id);\n\t}\n\n\t/**\n\t * Remove the commitments added during the game session.\n\t * @param commitment The commitment or commitments to remove.\n\t */\n\tremove(commitment: CommitmentInterface[] | CommitmentInterface) {\n\t\tif (!Array.isArray(commitment)) {\n\t\t\tcommitment = [commitment];\n\t\t}\n\t\tlet commitmentsIds = commitment.map((commitment) => {\n\t\t\treturn commitment.id;\n\t\t});\n\n\t\tlet currentCommitments = storage.getVariable<string[]>(TEMPORARY_COMMITMENT_CATEGORY_MEMORY_KEY);\n\t\tif (!currentCommitments) {\n\t\t\treturn;\n\t\t}\n\t\tcurrentCommitments = currentCommitments.filter((id) => !commitmentsIds.includes(id));\n\t\tstorage.setVariable(TEMPORARY_COMMITMENT_CATEGORY_MEMORY_KEY, currentCommitments);\n\t}\n\n\t/**\n\t * Clear all the expired commitments.\n\t */\n\tclearExpiredRoutine() {\n\t\tObject.values(registeredCommitments).forEach((commitment) => {\n\t\t\tif (commitment.expired) {\n\t\t\t\tdelete registeredCommitments[commitment.id];\n\t\t\t}\n\t\t});\n\t}\n\n\t/**\n\t * Get the current commitments. The hidden commitments are not included.\n\t * 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\t * Higher priority commitments are calculated using the following steps:\n\t * 1. The commitments that have Commitments BaseModel.priority set to a higher value will be selected first.\n\t * 2. If there are commitments with the same priority, the commitments that are not fixed will be selected first.\n\t * 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\t * @returns The current commitments.\n\t */\n\tget currentRoutine(): CommitmentInterface[] {\n\t\tlet character_commitments: { [character: string]: CommitmentInterface } = {};\n\t\t[...this.temporaryRoutine, ...this.fixedRoutine].reverse().forEach((c) => {\n\t\t\tif (c.isActive) {\n\t\t\t\tif (c.characters.length > 0) {\n\t\t\t\t\t// all the characters don't already have commitments or the commitment has a higher priority\n\t\t\t\t\tlet allAvailable = c.characters.every(\n\t\t\t\t\t\t(ch) => !character_commitments[ch.id] || c.priority > character_commitments[ch.id].priority\n\t\t\t\t\t);\n\t\t\t\t\tif (allAvailable) {\n\t\t\t\t\t\tc.characters.forEach((ch) => {\n\t\t\t\t\t\t\tcharacter_commitments[ch.id] = c;\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tconsole.error(`[NQTR] The commitment ${c.id} has no characters assigned`);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t\treturn Object.values(character_commitments);\n\t}\n\n\tget currentRoomRoutine(): CommitmentInterface[] {\n\t\treturn navigator.currentRoom?.routine || [];\n\t}\n\n\t/**\n\t * Get the character commitment.\n\t * @param character The character.\n\t * @returns The commitment or undefined if not found.\n\t */\n\tgetCommitmentByCharacter(character: CharacterInterface): CommitmentInterface | undefined {\n\t\tthis.currentRoutine.forEach((c) => {\n\t\t\tif (c.characters.map((ch) => ch.id).includes(character.id)) {\n\t\t\t\treturn c;\n\t\t\t}\n\t\t});\n\t\treturn undefined;\n\t}\n}\n"]}
@@ -1,2 +1,2 @@
1
- import {storage}from'@drincs/pixi-vn';var s={};function R(i){try{let e=s[i];if(!e){console.error(`[NQTR] Room ${i} not found`);return}return e}catch(e){console.error(`[NQTR] Error while getting Room ${i}`,e);return}}var _="___nqtr-current_room_memory___",c=class{get rooms(){return Object.values(s)}get locations(){let e={};return Object.values(s).forEach(t=>{e[t.location.id]=t.location;}),Object.values(e)}get maps(){let e={};return Object.values(s).forEach(t=>{e[t.location.map.id]=t.location.map;}),Object.values(e)}get currentRoom(){let e=storage.getVariable(_);if(!e){console.error("[NQTR] The current room has not yet been set");return}let t=R(e);if(!t){console.error(`[NQTR] Current room ${e} not found`);return}return t}set currentRoom(e){if(!R(e.id)){console.error(`[NQTR] The room ${e.id} is not registered, so it can't be set as current room`);return}storage.setVariable(_,e.id);}get currentLocation(){return this.currentRoom?.location}get currentMap(){return this.currentRoom?.location.map}clearExpiredActivities(){Object.entries(s).forEach(([e,t])=>{t.clearExpiredActivities();});}};var C=new c;new d;var h={},y={};function p(i){try{let e=h[i];if(!e){console.error(`[NQTR] Commitment ${i} not found`);return}return e}catch(e){console.error(`[NQTR] Error while getting Commitment ${i}`,e);return}}var I="___nqtr-temporary_commitment___",d=class{get fixedRoutine(){return Object.values(y)}set fixedRoutine(e){e.forEach(t=>{y[t.id]&&console.warn(`[NQTR] Commitment id ${t.id} already exists, it will be overwritten`),y[t.id]=t;});}get temporaryRoutine(){let e=storage.getVariable(I);return e?e.map(r=>p(r)).filter(r=>r!==undefined):[]}get allRoutine(){return [...this.fixedRoutine,...this.temporaryRoutine]}add(e){Array.isArray(e)||(e=[e]);let t=e.map(r=>{if(!p(r.id)){console.warn(`[NQTR] Commitment ${r.id} not found, it will be ignored`);return}return r.id}).filter(r=>r!==undefined);storage.setVariable(I,t);}find(e){return p(e)}remove(e){Array.isArray(e)||(e=[e]);let t=e.map(o=>o.id),r=storage.getVariable(I);r&&(r=r.filter(o=>!t.includes(o)),storage.setVariable(I,r));}clearExpiredRoutine(){Object.values(h).forEach(e=>{e.expired&&delete h[e.id];});}get currentRoutine(){let e={};return [...this.temporaryRoutine,...this.fixedRoutine].reverse().forEach(t=>{t.isActive&&(t.characters.length>0?t.characters.every(o=>!e[o.id]||t.priority>e[o.id].priority)&&t.characters.forEach(o=>{e[o.id]=t;}):console.error(`[NQTR] The commitment ${t.id} has no characters assigned`));}),Object.values(e)}get currentRoomRoutine(){return C.currentRoom?.routine||[]}getCommitmentByCharacter(e){this.currentRoutine.forEach(t=>{if(t.characters.map(r=>r.id).includes(e.id))return t});}};export{d as default};//# sourceMappingURL=RoutineManager.mjs.map
1
+ import {storage}from'@drincs/pixi-vn';var s={};function R(i){try{let e=s[i];if(!e){console.error(`[NQTR] Room ${i} not found`);return}return e}catch(e){console.error(`[NQTR] Error while getting Room ${i}`,e);return}}var _="___nqtr-current_room_memory___",c=class{get rooms(){return Object.values(s)}get locations(){let e={};return Object.values(s).forEach(t=>{e[t.location.id]=t.location;}),Object.values(e)}get maps(){let e={};return Object.values(s).forEach(t=>{e[t.location.map.id]=t.location.map;}),Object.values(e)}get currentRoom(){let e=storage.getVariable(_);if(!e){console.error("[NQTR] The current room has not yet been set");return}let t=R(e);if(!t){console.error(`[NQTR] Current room ${e} not found`);return}return t}set currentRoom(e){if(typeof e!="string"&&(e=e.id),!R(e)){console.error(`[NQTR] The room ${e} is not registered, so it can't be set as current room`);return}storage.setVariable(_,e);}get currentLocation(){return this.currentRoom?.location}get currentMap(){return this.currentRoom?.location.map}clearExpiredActivities(){Object.entries(s).forEach(([e,t])=>{t.clearExpiredActivities();});}};var C=new c;new d;var y={},h={};function p(i){try{let e=y[i];if(!e){console.error(`[NQTR] Commitment ${i} not found`);return}return e}catch(e){console.error(`[NQTR] Error while getting Commitment ${i}`,e);return}}var I="___nqtr-temporary_commitment___",d=class{get fixedRoutine(){return Object.values(h)}set fixedRoutine(e){e.forEach(t=>{h[t.id]&&console.warn(`[NQTR] Commitment id ${t.id} already exists, it will be overwritten`),h[t.id]=t;});}get temporaryRoutine(){let e=storage.getVariable(I);return e?e.map(r=>p(r)).filter(r=>r!==undefined):[]}get allRoutine(){return [...this.fixedRoutine,...this.temporaryRoutine]}add(e){Array.isArray(e)||(e=[e]);let t=e.map(r=>{if(!p(r.id)){console.warn(`[NQTR] Commitment ${r.id} not found, it will be ignored`);return}return r.id}).filter(r=>r!==undefined);storage.setVariable(I,t);}find(e){return p(e)}remove(e){Array.isArray(e)||(e=[e]);let t=e.map(o=>o.id),r=storage.getVariable(I);r&&(r=r.filter(o=>!t.includes(o)),storage.setVariable(I,r));}clearExpiredRoutine(){Object.values(y).forEach(e=>{e.expired&&delete y[e.id];});}get currentRoutine(){let e={};return [...this.temporaryRoutine,...this.fixedRoutine].reverse().forEach(t=>{t.isActive&&(t.characters.length>0?t.characters.every(o=>!e[o.id]||t.priority>e[o.id].priority)&&t.characters.forEach(o=>{e[o.id]=t;}):console.error(`[NQTR] The commitment ${t.id} has no characters assigned`));}),Object.values(e)}get currentRoomRoutine(){return C.currentRoom?.routine||[]}getCommitmentByCharacter(e){this.currentRoutine.forEach(t=>{if(t.characters.map(r=>r.id).includes(e.id))return t});}};export{d as default};//# sourceMappingURL=RoutineManager.mjs.map
2
2
  //# sourceMappingURL=RoutineManager.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/decorators/RoomDecorator.ts","../../src/managers/NavigatorManager.ts","../../src/managers/index.ts","../../src/decorators/CommitmentDecorator.ts","../../src/managers/RoutineManager.ts"],"names":["registeredRooms","getRoomById","id","room","CURRENT_ROOM_MEMORY_KEY","NavigatorManager","result","roomId","storage","_","timeTracker","navigator","RoutineManager","questsNotebook","registeredCommitments","fixedCommitments","getCommitmentById","commitment","TEMPORARY_COMMITMENT_CATEGORY_MEMORY_KEY","commitments","c","commitmentsIds","currentCommitments","character_commitments","ch","character"],"mappings":"sCAEO,IAAMA,CAAAA,CAAmD,EAAC,CA2B1D,SAASC,CAAAA,CAAYC,EAAuC,CAClE,GAAI,CACH,IAAIC,CAAOH,CAAAA,CAAAA,CAAgBE,CAAE,CAAA,CAC7B,GAAI,CAACC,CAAAA,CAAM,CACV,OAAA,CAAQ,KAAM,CAAA,CAAA,YAAA,EAAeD,CAAE,CAAA,UAAA,CAAY,EAC3C,MACD,CACA,OAAOC,CACR,CAAS,MAAA,CAAA,CAAG,CACX,OAAA,CAAQ,MAAM,CAAmCD,gCAAAA,EAAAA,CAAE,CAAI,CAAA,CAAA,CAAC,CACxD,CAAA,MACD,CACD,CCrCA,IAAME,CAA0B,CAAA,gCAAA,CACXC,CAArB,CAAA,KAAsC,CACrC,IAAI,KAAQ,EAAA,CACX,OAAO,MAAO,CAAA,MAAA,CAAOL,CAAe,CACrC,CACA,IAAI,SAAY,EAAA,CACf,IAAIM,CAA8C,CAAA,EAClD,CAAA,OAAA,MAAA,CAAO,MAAON,CAAAA,CAAe,CAAE,CAAA,OAAA,CAASG,GAAS,CAChDG,CAAAA,CAAOH,CAAK,CAAA,QAAA,CAAS,EAAE,CAAA,CAAIA,C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":"RoutineManager.mjs","sourcesContent":["import { RoomInterface } from \"../interface\";\n\nexport const registeredRooms: { [id: string]: RoomInterface } = {};\n\n/**\n * Save a room in the registered rooms. If the room already exists, it will be overwritten.\n * @param room The room to save.\n * @returns\n * @example\n * ```ts\n * saveRoom([mcRoom, aliceRoom, annRoom, bathroom, lounge, terrace, gymRoom]);\n * ```\n */\nexport function saveRoom(room: RoomInterface | RoomInterface[]) {\n\tif (Array.isArray(room)) {\n\t\troom.forEach((c) => saveRoom(c));\n\t\treturn;\n\t}\n\tif (registeredRooms[room.id]) {\n\t\tconsole.warn(`[NQTR] Room id ${room.id} already exists, it will be overwritten`);\n\t}\n\tregisteredRooms[room.id] = room;\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 */\nexport function getRoomById(id: string): RoomInterface | undefined {\n\ttry {\n\t\tlet room = registeredRooms[id];\n\t\tif (!room) {\n\t\t\tconsole.error(`[NQTR] Room ${id} not found`);\n\t\t\treturn;\n\t\t}\n\t\treturn room;\n\t} catch (e) {\n\t\tconsole.error(`[NQTR] Error while getting Room ${id}`, e);\n\t\treturn;\n\t}\n}\n","import { storage } from \"@drincs/pixi-vn\";\nimport { getRoomById, registeredRooms } from \"../decorators/RoomDecorator\";\nimport { LocationInterface, MapInterface, RoomInterface } from \"../interface\";\n\nconst CURRENT_ROOM_MEMORY_KEY = \"___nqtr-current_room_memory___\";\nexport default class NavigatorManager {\n\tget rooms() {\n\t\treturn Object.values(registeredRooms);\n\t}\n\tget locations() {\n\t\tlet result: { [id: string]: LocationInterface } = {};\n\t\tObject.values(registeredRooms).forEach((room) => {\n\t\t\tresult[room.location.id] = room.location;\n\t\t});\n\t\treturn Object.values(result);\n\t}\n\tget maps() {\n\t\tlet result: { [id: string]: MapInterface } = {};\n\t\tObject.values(registeredRooms).forEach((room) => {\n\t\t\tresult[room.location.map.id] = room.location.map;\n\t\t});\n\t\treturn Object.values(result);\n\t}\n\tget currentRoom(): RoomInterface | undefined {\n\t\tlet roomId = storage.getVariable<string>(CURRENT_ROOM_MEMORY_KEY);\n\t\tif (!roomId) {\n\t\t\tconsole.error(`[NQTR] The current room has not yet been set`);\n\t\t\treturn;\n\t\t}\n\t\tlet room = getRoomById(roomId);\n\t\tif (!room) {\n\t\t\tconsole.error(`[NQTR] Current room ${roomId} not found`);\n\t\t\treturn;\n\t\t}\n\t\treturn room;\n\t}\n\tset currentRoom(room: RoomInterface) {\n\t\tlet roomRegistrated = getRoomById(room.id);\n\t\tif (!roomRegistrated) {\n\t\t\tconsole.error(`[NQTR] The room ${room.id} is not registered, so it can't be set as current room`);\n\t\t\treturn;\n\t\t}\n\t\tstorage.setVariable(CURRENT_ROOM_MEMORY_KEY, room.id);\n\t}\n\tget currentLocation(): LocationInterface | undefined {\n\t\treturn this.currentRoom?.location;\n\t}\n\tget currentMap(): MapInterface | undefined {\n\t\treturn this.currentRoom?.location.map;\n\t}\n\t/**\n\t * Clear all the expired activities.\n\t */\n\tclearExpiredActivities() {\n\t\tObject.entries(registeredRooms).forEach(([_, room]) => {\n\t\t\troom.clearExpiredActivities();\n\t\t});\n\t}\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 { CommitmentInterface } from \"../interface\";\n\nexport const registeredCommitments: { [id: string]: CommitmentInterface } = {};\nexport const fixedCommitments: { [id: string]: CommitmentInterface } = {};\n\n/**\n * Save a commitment in the registered commitments. If the commitment already exists, it will be overwritten.\n * @param commitment The commitment or commitments to save.\n * @returns\n */\nexport function saveCommitment(commitment: CommitmentInterface | CommitmentInterface[]) {\n\tif (Array.isArray(commitment)) {\n\t\tcommitment.forEach((c) => saveCommitment(c));\n\t\treturn;\n\t}\n\tif (registeredCommitments[commitment.id]) {\n\t\tconsole.warn(`[NQTR] Commitment id ${commitment.id} already exists, it will be overwritten`);\n\t}\n\tregisteredCommitments[commitment.id] = commitment;\n}\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 */\nexport function getCommitmentById(id: string): CommitmentInterface | undefined {\n\ttry {\n\t\tlet commitment = registeredCommitments[id];\n\t\tif (!commitment) {\n\t\t\tconsole.error(`[NQTR] Commitment ${id} not found`);\n\t\t\treturn;\n\t\t}\n\t\treturn commitment;\n\t} catch (e) {\n\t\tconsole.error(`[NQTR] Error while getting Commitment ${id}`, e);\n\t\treturn;\n\t}\n}\n","import { CharacterInterface, storage } from \"@drincs/pixi-vn\";\nimport { navigator } from \".\";\nimport { fixedCommitments, getCommitmentById, registeredCommitments } from \"../decorators/CommitmentDecorator\";\nimport { CommitmentInterface } from \"../interface\";\n\nconst TEMPORARY_COMMITMENT_CATEGORY_MEMORY_KEY = \"___nqtr-temporary_commitment___\";\nexport default class RoutineManager {\n\tget fixedRoutine(): CommitmentInterface[] {\n\t\treturn Object.values(fixedCommitments);\n\t}\n\t/**\n\t * Set a commitment as fixed, it will be always available. They cannot be deleted or edit during the game session.\n\t */\n\tset fixedRoutine(commitments: CommitmentInterface[]) {\n\t\tcommitments.forEach((c) => {\n\t\t\tif (fixedCommitments[c.id]) {\n\t\t\t\tconsole.warn(`[NQTR] Commitment id ${c.id} already exists, it will be overwritten`);\n\t\t\t}\n\t\t\tfixedCommitments[c.id] = c;\n\t\t});\n\t}\n\n\t/**\n\t * Get the temporary commitments by its id.\n\t * @returns The temporary commitments.\n\t */\n\tget temporaryRoutine(): CommitmentInterface[] {\n\t\tlet commitmentsIds = storage.getVariable<string[]>(TEMPORARY_COMMITMENT_CATEGORY_MEMORY_KEY);\n\t\tif (!commitmentsIds) {\n\t\t\treturn [];\n\t\t}\n\t\tlet commitments = commitmentsIds\n\t\t\t.map((id) => getCommitmentById(id))\n\t\t\t.filter((commitment) => commitment !== undefined);\n\t\treturn commitments;\n\t}\n\n\tget allRoutine(): CommitmentInterface[] {\n\t\treturn [...this.fixedRoutine, ...this.temporaryRoutine];\n\t}\n\n\t/**\n\t * This feature adds the commitments during the game session.\n\t * @param commitment The commitment or commitments to add.\n\t */\n\tadd(commitment: CommitmentInterface[] | CommitmentInterface) {\n\t\tif (!Array.isArray(commitment)) {\n\t\t\tcommitment = [commitment];\n\t\t}\n\t\tlet commitmentsIds = commitment\n\t\t\t.map((commitment) => {\n\t\t\t\tlet commitmentTest = getCommitmentById(commitment.id);\n\t\t\t\tif (!commitmentTest) {\n\t\t\t\t\tconsole.warn(`[NQTR] Commitment ${commitment.id} not found, it will be ignored`);\n\t\t\t\t\treturn undefined;\n\t\t\t\t}\n\t\t\t\treturn commitment.id;\n\t\t\t})\n\t\t\t.filter((id) => id !== undefined);\n\n\t\tstorage.setVariable(TEMPORARY_COMMITMENT_CATEGORY_MEMORY_KEY, commitmentsIds);\n\t}\n\n\t/**\n\t * Get the commitments added during the game session.\n\t * @param id The id of the commitment.\n\t * @returns The commitment or undefined if not found.\n\t */\n\tfind(id: string): CommitmentInterface | undefined {\n\t\treturn getCommitmentById(id);\n\t}\n\n\t/**\n\t * Remove the commitments added during the game session.\n\t * @param commitment The commitment or commitments to remove.\n\t */\n\tremove(commitment: CommitmentInterface[] | CommitmentInterface) {\n\t\tif (!Array.isArray(commitment)) {\n\t\t\tcommitment = [commitment];\n\t\t}\n\t\tlet commitmentsIds = commitment.map((commitment) => {\n\t\t\treturn commitment.id;\n\t\t});\n\n\t\tlet currentCommitments = storage.getVariable<string[]>(TEMPORARY_COMMITMENT_CATEGORY_MEMORY_KEY);\n\t\tif (!currentCommitments) {\n\t\t\treturn;\n\t\t}\n\t\tcurrentCommitments = currentCommitments.filter((id) => !commitmentsIds.includes(id));\n\t\tstorage.setVariable(TEMPORARY_COMMITMENT_CATEGORY_MEMORY_KEY, currentCommitments);\n\t}\n\n\t/**\n\t * Clear all the expired commitments.\n\t */\n\tclearExpiredRoutine() {\n\t\tObject.values(registeredCommitments).forEach((commitment) => {\n\t\t\tif (commitment.expired) {\n\t\t\t\tdelete registeredCommitments[commitment.id];\n\t\t\t}\n\t\t});\n\t}\n\n\t/**\n\t * Get the current commitments. The hidden commitments are not included.\n\t * 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\t * Higher priority commitments are calculated using the following steps:\n\t * 1. The commitments that have Commitments BaseModel.priority set to a higher value will be selected first.\n\t * 2. If there are commitments with the same priority, the commitments that are not fixed will be selected first.\n\t * 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\t * @returns The current commitments.\n\t */\n\tget currentRoutine(): CommitmentInterface[] {\n\t\tlet character_commitments: { [character: string]: CommitmentInterface } = {};\n\t\t[...this.temporaryRoutine, ...this.fixedRoutine].reverse().forEach((c) => {\n\t\t\tif (c.isActive) {\n\t\t\t\tif (c.characters.length > 0) {\n\t\t\t\t\t// all the characters don't already have commitments or the commitment has a higher priority\n\t\t\t\t\tlet allAvailable = c.characters.every(\n\t\t\t\t\t\t(ch) => !character_commitments[ch.id] || c.priority > character_commitments[ch.id].priority\n\t\t\t\t\t);\n\t\t\t\t\tif (allAvailable) {\n\t\t\t\t\t\tc.characters.forEach((ch) => {\n\t\t\t\t\t\t\tcharacter_commitments[ch.id] = c;\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tconsole.error(`[NQTR] The commitment ${c.id} has no characters assigned`);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t\treturn Object.values(character_commitments);\n\t}\n\n\tget currentRoomRoutine(): CommitmentInterface[] {\n\t\treturn navigator.currentRoom?.routine || [];\n\t}\n\n\t/**\n\t * Get the character commitment.\n\t * @param character The character.\n\t * @returns The commitment or undefined if not found.\n\t */\n\tgetCommitmentByCharacter(character: CharacterInterface): CommitmentInterface | undefined {\n\t\tthis.currentRoutine.forEach((c) => {\n\t\t\tif (c.characters.map((ch) => ch.id).includes(character.id)) {\n\t\t\t\treturn c;\n\t\t\t}\n\t\t});\n\t\treturn undefined;\n\t}\n}\n"]}
1
+ {"version":3,"sources":["../../src/decorators/RoomDecorator.ts","../../src/managers/NavigatorManager.ts","../../src/managers/index.ts","../../src/decorators/CommitmentDecorator.ts","../../src/managers/RoutineManager.ts"],"names":["registeredRooms","getRoomById","id","room","CURRENT_ROOM_MEMORY_KEY","NavigatorManager","result","roomId","storage","_","navigator","routine","RoutineManager","registeredCommitments","fixedCommitments","getCommitmentById","commitment","TEMPORARY_COMMITMENT_CATEGORY_MEMORY_KEY","commitments","c","commitmentsIds","currentCommitments","character_commitments","ch","character"],"mappings":"sCAEO,IAAMA,CAAAA,CAAmD,EAAC,CA2B1D,SAASC,CAAAA,CAAYC,EAAuC,CAClE,GAAI,CACH,IAAIC,CAAOH,CAAAA,CAAAA,CAAgBE,CAAE,CAAA,CAC7B,GAAI,CAACC,CAAAA,CAAM,CACV,OAAA,CAAQ,KAAM,CAAA,CAAA,YAAA,EAAeD,CAAE,CAAA,UAAA,CAAY,EAC3C,MACD,CACA,OAAOC,CACR,CAAS,MAAA,CAAA,CAAG,CACX,OAAA,CAAQ,MAAM,CAAmCD,gCAAAA,EAAAA,CAAE,CAAI,CAAA,CAAA,CAAC,CACxD,CAAA,MACD,CACD,CCrCA,IAAME,CAA0B,CAAA,gCAAA,CACXC,CAArB,CAAA,KAAsC,CAClC,IAAI,KAAQ,EAAA,CACR,OAAO,MAAO,CAAA,MAAA,CAAOL,CAAe,CACxC,CACA,IAAI,SAAA,EAAY,CACZ,IAAIM,EAA8C,EAAC,CACnD,OAAO,MAAA,CAAA,MAAA,CAAON,CAAe,CAAA,CAAE,OAASG,CAAAA,CAAAA,EAAS,CAC7CG,CAAOH,CAAAA,CAAAA,CAAK,QAAS,CAAA,EAAE,CAAIA,CAAAA,CAAAA,CAAK,SACpC,CAAC,EACM,MAAO,CAAA,MAAA,CAAOG,CAAM,CAC/B,CAC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,SACd,OAAOH,CAAAA,CAAsBG,CAAW,CAAA,EAAE,EAE5C,CAAC,EACF,CAWA,IAAI,cAAwC,EAAA,CAC3C,IAAIM,CAAAA,CAAsE,EAAC,CAC3E,OAAC,CAAA,GAAG,KAAK,gBAAkB,CAAA,GAAG,IAAK,CAAA,YAAY,CAAE,CAAA,OAAA,EAAU,CAAA,OAAA,CAASH,GAAM,CACrEA,CAAAA,CAAE,QACDA,GAAAA,CAAAA,CAAE,WAAW,MAAS,CAAA,CAAA,CAENA,CAAE,CAAA,UAAA,CAAW,MAC9BI,CAAO,EAAA,CAACD,CAAsBC,CAAAA,CAAAA,CAAG,EAAE,CAAA,EAAKJ,CAAE,CAAA,QAAA,CAAWG,EAAsBC,CAAG,CAAA,EAAE,CAAE,CAAA,QACpF,CAECJ,EAAAA,CAAAA,CAAE,UAAW,CAAA,OAAA,CAASI,GAAO,CAC5BD,CAAAA,CAAsBC,CAAG,CAAA,EAAE,CAAIJ,CAAAA,EAChC,CAAC,CAAA,CAGF,QAAQ,KAAM,CAAA,CAAA,sBAAA,EAAyBA,CAAE,CAAA,EAAE,6BAA6B,CAG3E,EAAA,CAAC,CACM,CAAA,MAAA,CAAO,OAAOG,CAAqB,CAC3C,CAEA,IAAI,kBAA4C,EAAA,CAC/C,OAAOZ,CAAAA,CAAU,aAAa,OAAW,EAAA,EAC1C,CAOA,wBAAyBc,CAAAA,CAAAA,CAAgE,CACxF,IAAA,CAAK,eAAe,OAASL,CAAAA,CAAAA,EAAM,CAClC,GAAIA,CAAE,CAAA,UAAA,CAAW,GAAKI,CAAAA,CAAAA,EAAOA,EAAG,EAAE,CAAA,CAAE,QAASC,CAAAA,CAAAA,CAAU,EAAE,CACxD,CAAA,OAAOL,CAET,CAAC,EAEF,CACD","file":"RoutineManager.mjs","sourcesContent":["import { RoomInterface } from \"../interface\";\n\nexport const registeredRooms: { [id: string]: RoomInterface } = {};\n\n/**\n * Save a room in the registered rooms. If the room already exists, it will be overwritten.\n * @param room The room to save.\n * @returns\n * @example\n * ```ts\n * saveRoom([mcRoom, aliceRoom, annRoom, bathroom, lounge, terrace, gymRoom]);\n * ```\n */\nexport function saveRoom(room: RoomInterface | RoomInterface[]) {\n\tif (Array.isArray(room)) {\n\t\troom.forEach((c) => saveRoom(c));\n\t\treturn;\n\t}\n\tif (registeredRooms[room.id]) {\n\t\tconsole.warn(`[NQTR] Room id ${room.id} already exists, it will be overwritten`);\n\t}\n\tregisteredRooms[room.id] = room;\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 */\nexport function getRoomById(id: string): RoomInterface | undefined {\n\ttry {\n\t\tlet room = registeredRooms[id];\n\t\tif (!room) {\n\t\t\tconsole.error(`[NQTR] Room ${id} not found`);\n\t\t\treturn;\n\t\t}\n\t\treturn room;\n\t} catch (e) {\n\t\tconsole.error(`[NQTR] Error while getting Room ${id}`, e);\n\t\treturn;\n\t}\n}\n","import { storage } from \"@drincs/pixi-vn\";\nimport { getRoomById, registeredRooms } from \"../decorators/RoomDecorator\";\nimport { LocationInterface, MapInterface, RoomInterface } from \"../interface\";\n\nconst CURRENT_ROOM_MEMORY_KEY = \"___nqtr-current_room_memory___\";\nexport default class NavigatorManager {\n get rooms() {\n return Object.values(registeredRooms);\n }\n get locations() {\n let result: { [id: string]: LocationInterface } = {};\n Object.values(registeredRooms).forEach((room) => {\n result[room.location.id] = room.location;\n });\n return Object.values(result);\n }\n get maps() {\n let result: { [id: string]: MapInterface } = {};\n Object.values(registeredRooms).forEach((room) => {\n result[room.location.map.id] = room.location.map;\n });\n return Object.values(result);\n }\n get currentRoom(): RoomInterface | undefined {\n let roomId = storage.getVariable<string>(CURRENT_ROOM_MEMORY_KEY);\n if (!roomId) {\n console.error(`[NQTR] The current room has not yet been set`);\n return;\n }\n let room = getRoomById(roomId);\n if (!room) {\n console.error(`[NQTR] 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 = getRoomById(room);\n if (!roomRegistrated) {\n console.error(`[NQTR] The room ${room} is not registered, so it can't be set as current room`);\n return;\n }\n storage.setVariable(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 Object.entries(registeredRooms).forEach(([_, room]) => {\n room.clearExpiredActivities();\n });\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 { CommitmentInterface } from \"../interface\";\n\nexport const registeredCommitments: { [id: string]: CommitmentInterface } = {};\nexport const fixedCommitments: { [id: string]: CommitmentInterface } = {};\n\n/**\n * Save a commitment in the registered commitments. If the commitment already exists, it will be overwritten.\n * @param commitment The commitment or commitments to save.\n * @returns\n */\nexport function saveCommitment(commitment: CommitmentInterface | CommitmentInterface[]) {\n\tif (Array.isArray(commitment)) {\n\t\tcommitment.forEach((c) => saveCommitment(c));\n\t\treturn;\n\t}\n\tif (registeredCommitments[commitment.id]) {\n\t\tconsole.warn(`[NQTR] Commitment id ${commitment.id} already exists, it will be overwritten`);\n\t}\n\tregisteredCommitments[commitment.id] = commitment;\n}\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 */\nexport function getCommitmentById(id: string): CommitmentInterface | undefined {\n\ttry {\n\t\tlet commitment = registeredCommitments[id];\n\t\tif (!commitment) {\n\t\t\tconsole.error(`[NQTR] Commitment ${id} not found`);\n\t\t\treturn;\n\t\t}\n\t\treturn commitment;\n\t} catch (e) {\n\t\tconsole.error(`[NQTR] Error while getting Commitment ${id}`, e);\n\t\treturn;\n\t}\n}\n","import { CharacterInterface, storage } from \"@drincs/pixi-vn\";\nimport { navigator } from \".\";\nimport { fixedCommitments, getCommitmentById, registeredCommitments } from \"../decorators/CommitmentDecorator\";\nimport { CommitmentInterface } from \"../interface\";\n\nconst TEMPORARY_COMMITMENT_CATEGORY_MEMORY_KEY = \"___nqtr-temporary_commitment___\";\nexport default class RoutineManager {\n\tget fixedRoutine(): CommitmentInterface[] {\n\t\treturn Object.values(fixedCommitments);\n\t}\n\t/**\n\t * Set a commitment as fixed, it will be always available. They cannot be deleted or edit during the game session.\n\t */\n\tset fixedRoutine(commitments: CommitmentInterface[]) {\n\t\tcommitments.forEach((c) => {\n\t\t\tif (fixedCommitments[c.id]) {\n\t\t\t\tconsole.warn(`[NQTR] Commitment id ${c.id} already exists, it will be overwritten`);\n\t\t\t}\n\t\t\tfixedCommitments[c.id] = c;\n\t\t});\n\t}\n\n\t/**\n\t * Get the temporary commitments by its id.\n\t * @returns The temporary commitments.\n\t */\n\tget temporaryRoutine(): CommitmentInterface[] {\n\t\tlet commitmentsIds = storage.getVariable<string[]>(TEMPORARY_COMMITMENT_CATEGORY_MEMORY_KEY);\n\t\tif (!commitmentsIds) {\n\t\t\treturn [];\n\t\t}\n\t\tlet commitments = commitmentsIds\n\t\t\t.map((id) => getCommitmentById(id))\n\t\t\t.filter((commitment) => commitment !== undefined);\n\t\treturn commitments;\n\t}\n\n\tget allRoutine(): CommitmentInterface[] {\n\t\treturn [...this.fixedRoutine, ...this.temporaryRoutine];\n\t}\n\n\t/**\n\t * This feature adds the commitments during the game session.\n\t * @param commitment The commitment or commitments to add.\n\t */\n\tadd(commitment: CommitmentInterface[] | CommitmentInterface) {\n\t\tif (!Array.isArray(commitment)) {\n\t\t\tcommitment = [commitment];\n\t\t}\n\t\tlet commitmentsIds = commitment\n\t\t\t.map((commitment) => {\n\t\t\t\tlet commitmentTest = getCommitmentById(commitment.id);\n\t\t\t\tif (!commitmentTest) {\n\t\t\t\t\tconsole.warn(`[NQTR] Commitment ${commitment.id} not found, it will be ignored`);\n\t\t\t\t\treturn undefined;\n\t\t\t\t}\n\t\t\t\treturn commitment.id;\n\t\t\t})\n\t\t\t.filter((id) => id !== undefined);\n\n\t\tstorage.setVariable(TEMPORARY_COMMITMENT_CATEGORY_MEMORY_KEY, commitmentsIds);\n\t}\n\n\t/**\n\t * Get the commitments added during the game session.\n\t * @param id The id of the commitment.\n\t * @returns The commitment or undefined if not found.\n\t */\n\tfind(id: string): CommitmentInterface | undefined {\n\t\treturn getCommitmentById(id);\n\t}\n\n\t/**\n\t * Remove the commitments added during the game session.\n\t * @param commitment The commitment or commitments to remove.\n\t */\n\tremove(commitment: CommitmentInterface[] | CommitmentInterface) {\n\t\tif (!Array.isArray(commitment)) {\n\t\t\tcommitment = [commitment];\n\t\t}\n\t\tlet commitmentsIds = commitment.map((commitment) => {\n\t\t\treturn commitment.id;\n\t\t});\n\n\t\tlet currentCommitments = storage.getVariable<string[]>(TEMPORARY_COMMITMENT_CATEGORY_MEMORY_KEY);\n\t\tif (!currentCommitments) {\n\t\t\treturn;\n\t\t}\n\t\tcurrentCommitments = currentCommitments.filter((id) => !commitmentsIds.includes(id));\n\t\tstorage.setVariable(TEMPORARY_COMMITMENT_CATEGORY_MEMORY_KEY, currentCommitments);\n\t}\n\n\t/**\n\t * Clear all the expired commitments.\n\t */\n\tclearExpiredRoutine() {\n\t\tObject.values(registeredCommitments).forEach((commitment) => {\n\t\t\tif (commitment.expired) {\n\t\t\t\tdelete registeredCommitments[commitment.id];\n\t\t\t}\n\t\t});\n\t}\n\n\t/**\n\t * Get the current commitments. The hidden commitments are not included.\n\t * 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\t * Higher priority commitments are calculated using the following steps:\n\t * 1. The commitments that have Commitments BaseModel.priority set to a higher value will be selected first.\n\t * 2. If there are commitments with the same priority, the commitments that are not fixed will be selected first.\n\t * 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\t * @returns The current commitments.\n\t */\n\tget currentRoutine(): CommitmentInterface[] {\n\t\tlet character_commitments: { [character: string]: CommitmentInterface } = {};\n\t\t[...this.temporaryRoutine, ...this.fixedRoutine].reverse().forEach((c) => {\n\t\t\tif (c.isActive) {\n\t\t\t\tif (c.characters.length > 0) {\n\t\t\t\t\t// all the characters don't already have commitments or the commitment has a higher priority\n\t\t\t\t\tlet allAvailable = c.characters.every(\n\t\t\t\t\t\t(ch) => !character_commitments[ch.id] || c.priority > character_commitments[ch.id].priority\n\t\t\t\t\t);\n\t\t\t\t\tif (allAvailable) {\n\t\t\t\t\t\tc.characters.forEach((ch) => {\n\t\t\t\t\t\t\tcharacter_commitments[ch.id] = c;\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tconsole.error(`[NQTR] The commitment ${c.id} has no characters assigned`);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t\treturn Object.values(character_commitments);\n\t}\n\n\tget currentRoomRoutine(): CommitmentInterface[] {\n\t\treturn navigator.currentRoom?.routine || [];\n\t}\n\n\t/**\n\t * Get the character commitment.\n\t * @param character The character.\n\t * @returns The commitment or undefined if not found.\n\t */\n\tgetCommitmentByCharacter(character: CharacterInterface): CommitmentInterface | undefined {\n\t\tthis.currentRoutine.forEach((c) => {\n\t\t\tif (c.characters.map((ch) => ch.id).includes(character.id)) {\n\t\t\t\treturn c;\n\t\t\t}\n\t\t});\n\t\treturn undefined;\n\t}\n}\n"]}
@@ -1,2 +1,2 @@
1
- 'use strict';var pixiVn=require('@drincs/pixi-vn');var a="___nqtr-time_manager_data___";var r=class{static minDayHours=0;static maxDayHours=24;static defaultTimeSpent=1;static timeSlots=[];static weekLength=7;static weekendStartDay=this.weekLength-1;static weekDaysNames=[]};var u=class{initialize(e){let{minDayHours:t=0,maxDayHours:n=24,defaultTimeSpent:y=1,timeSlots:D=[],weekLength:s=7,weekendStartDay:m=s-1,weekDaysNames:o=[]}=e;r.minDayHours=t,r.maxDayHours=n,r.defaultTimeSpent=y,r.timeSlots=D,r.weekLength=s,m>=r.weekLength?console.warn(`[NQTR] Weekend start day should be less than week length ${s}, so will be ignored`):r.weekendStartDay=m,o.length!==s?console.warn(`[NQTR] Week days names should be equal to week length ${s}, so will be ignored`):r.weekDaysNames=o;}get minDayHours(){return r.minDayHours}get maxDayHours(){return r.maxDayHours}get defaultTimeSpent(){return r.defaultTimeSpent}get timeSlots(){return r.timeSlots}get weekLength(){return r.weekLength}get weekendStartDay(){return r.weekendStartDay}get weekDaysNames(){return r.weekDaysNames}get currentHour(){let e=pixiVn.storage.getVariable(a)||{};return e.hasOwnProperty("currentHour")&&typeof e.currentHour=="number"?e.currentHour:this.minDayHours}set currentHour(e){let t=pixiVn.storage.getVariable(a)||{};typeof e=="number"?t.currentHour=e:delete t.currentHour,pixiVn.storage.setVariable(a,t);}get currentDay(){let e=pixiVn.storage.getVariable(a)||{};return e.hasOwnProperty("currentDay")&&typeof e.currentDay=="number"?e.currentDay:0}set currentDay(e){let t=pixiVn.storage.getVariable(a)||{};typeof e=="number"?t.currentDay=e:delete t.currentDay,pixiVn.storage.setVariable(a,t);}get isWeekend(){return this.currentWeekDayNumber>=this.weekendStartDay}get currentWeekDayNumber(){return this.currentDay%this.weekLength+1}get currentDayName(){let e=this.currentWeekDayNumber-1;return e>=this.weekDaysNames.length?(console.warn(`[NQTR] Week day name is not defined for day ${e}`,this.weekDaysNames),""):this.weekDaysNames[e]}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.startHour,this.timeSlots[e+1].startHour))return e}return this.timeSlots.length-1}increaseHour(e=this.defaultTimeSpent){let t=this.currentHour+e;return t>=this.maxDayHours&&(this.increaseDay(),t=this.minDayHours+(t-this.maxDayHours)),this.currentHour=t,this.currentHour}increaseDay(e=this.minDayHours,t=1){let n=this.currentDay+t;return this.currentDay=n,this.currentHour=e,this.currentDay}nowIsBetween(e,t){e===undefined&&(e=this.minDayHours),t===undefined&&(t=this.maxDayHours);let n=this.currentHour;return e<t?n>=e&&n<t:n>=e||n<t}};module.exports=u;//# sourceMappingURL=TimeManager.js.map
1
+ 'use strict';var pixiVn=require('@drincs/pixi-vn');var a="___nqtr-time_manager_data___";var r=class{static minDayHours=0;static maxDayHours=24;static defaultTimeSpent=1;static timeSlots=[];static weekLength=7;static weekendStartDay=this.weekLength-1;static weekDaysNames=[]};var u=class{initialize(e){let{minDayHours:t=0,maxDayHours:n=24,defaultTimeSpent:y=1,timeSlots:D=[],weekLength:s=7,weekendStartDay:m=s-1,weekDaysNames:o=[]}=e;r.minDayHours=t,r.maxDayHours=n,r.defaultTimeSpent=y,r.timeSlots=D,r.weekLength=s,m>=r.weekLength?console.warn(`[NQTR] Weekend start day should be less than week length ${s}, so will be ignored`):r.weekendStartDay=m,o.length!==s?console.warn(`[NQTR] Week days names should be equal to week length ${s}, so will be ignored`):r.weekDaysNames=o;}get minDayHours(){return r.minDayHours}get maxDayHours(){return r.maxDayHours}get defaultTimeSpent(){return r.defaultTimeSpent}get timeSlots(){return r.timeSlots}get weekLength(){return r.weekLength}get weekendStartDay(){return r.weekendStartDay}get weekDaysNames(){return r.weekDaysNames}get currentHour(){let e=pixiVn.storage.getVariable(a)||{};return e.hasOwnProperty("currentHour")&&typeof e.currentHour=="number"?e.currentHour:this.minDayHours}set currentHour(e){let t=pixiVn.storage.getVariable(a)||{};typeof e=="number"?t.currentHour=e:delete t.currentHour,pixiVn.storage.setVariable(a,t);}get currentDay(){let e=pixiVn.storage.getVariable(a)||{};return e.hasOwnProperty("currentDay")&&typeof e.currentDay=="number"?e.currentDay:0}set currentDay(e){let t=pixiVn.storage.getVariable(a)||{};typeof e=="number"?t.currentDay=e:delete t.currentDay,pixiVn.storage.setVariable(a,t);}get isWeekend(){return this.currentWeekDayNumber>=this.weekendStartDay}get currentWeekDayNumber(){return this.currentDay%this.weekLength+1}get currentDayName(){let e=this.currentWeekDayNumber-1;return e>=this.weekDaysNames.length?(console.warn(`[NQTR] Week day name is not defined for day ${e}`,this.weekDaysNames),""):this.weekDaysNames[e]}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.startHour,this.timeSlots[e+1].startHour))return e}return this.timeSlots.length-1}increaseHour(e=this.defaultTimeSpent){let t=this.currentHour+e;return t>=this.maxDayHours&&(this.increaseDay(),t=this.minDayHours+(t-this.maxDayHours)),this.currentHour=t,this.currentHour}increaseDay(e=this.minDayHours,t=1){let n=this.currentDay+t;return this.currentDay=n,this.currentHour=e,this.currentDay}nowIsBetween(e,t){e===undefined&&(e=this.minDayHours-1),t===undefined&&(t=this.maxDayHours+1);let n=this.currentHour;return e<t?n>=e&&n<t:n>=e||n<t}};module.exports=u;//# sourceMappingURL=TimeManager.js.map
2
2
  //# sourceMappingURL=TimeManager.js.map