@drincs/nqtr 0.3.6 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (341) hide show
  1. package/dist/RoomInterface-BRA386zn.d.mts +171 -0
  2. package/dist/RoomInterface-Cwm08AzD.d.ts +171 -0
  3. package/dist/{StageInterface-DJ7l0ubG.d.mts → StageInterface-LDgQToad.d.mts} +28 -14
  4. package/dist/{StageInterface-DJ7l0ubG.d.ts → StageInterface-LDgQToad.d.ts} +28 -14
  5. package/dist/classes/index.cjs +2 -0
  6. package/dist/classes/index.cjs.map +1 -0
  7. package/dist/classes/index.d.mts +508 -31
  8. package/dist/classes/index.d.ts +508 -31
  9. package/dist/classes/index.mjs +1 -1
  10. package/dist/classes/index.mjs.map +1 -1
  11. package/dist/decorators/index.cjs +2 -0
  12. package/dist/decorators/index.cjs.map +1 -0
  13. package/dist/decorators/index.d.mts +108 -9
  14. package/dist/decorators/index.d.ts +108 -9
  15. package/dist/decorators/index.mjs +1 -1
  16. package/dist/decorators/index.mjs.map +1 -1
  17. package/dist/index-B8-yQhYT.d.ts +188 -0
  18. package/dist/index-CJubtUni.d.mts +301 -0
  19. package/dist/index-Cq_kqDbo.d.ts +301 -0
  20. package/dist/index-knrOEAIO.d.mts +188 -0
  21. package/dist/index.cjs +2 -0
  22. package/dist/index.cjs.map +1 -0
  23. package/dist/index.d.mts +14 -46
  24. package/dist/index.d.ts +14 -46
  25. package/dist/index.mjs +1 -1
  26. package/dist/index.mjs.map +1 -1
  27. package/dist/interface/index.cjs +2 -0
  28. package/dist/{functions/index.js.map → interface/index.cjs.map} +1 -1
  29. package/dist/interface/index.d.mts +3 -14
  30. package/dist/interface/index.d.ts +3 -14
  31. package/dist/managers/index.cjs +2 -0
  32. package/dist/managers/index.cjs.map +1 -0
  33. package/dist/managers/index.d.mts +4 -17
  34. package/dist/managers/index.d.ts +4 -17
  35. package/dist/managers/index.mjs +1 -1
  36. package/dist/managers/index.mjs.map +1 -1
  37. package/dist/types/index.cjs +2 -0
  38. package/dist/{functions/index.mjs.map → types/index.cjs.map} +1 -1
  39. package/dist/types/index.d.mts +60 -4
  40. package/dist/types/index.d.ts +60 -4
  41. package/package.json +13 -5
  42. package/dist/RoomInterface-BglEhkQT.d.ts +0 -79
  43. package/dist/RoomInterface-DsZAp6Pv.d.mts +0 -79
  44. package/dist/classes/ActivityBaseModel.d.mts +0 -63
  45. package/dist/classes/ActivityBaseModel.d.ts +0 -63
  46. package/dist/classes/ActivityBaseModel.js +0 -2
  47. package/dist/classes/ActivityBaseModel.js.map +0 -1
  48. package/dist/classes/ActivityBaseModel.mjs +0 -2
  49. package/dist/classes/ActivityBaseModel.mjs.map +0 -1
  50. package/dist/classes/ActivityStoredClass.d.mts +0 -27
  51. package/dist/classes/ActivityStoredClass.d.ts +0 -27
  52. package/dist/classes/ActivityStoredClass.js +0 -2
  53. package/dist/classes/ActivityStoredClass.js.map +0 -1
  54. package/dist/classes/ActivityStoredClass.mjs +0 -2
  55. package/dist/classes/ActivityStoredClass.mjs.map +0 -1
  56. package/dist/classes/CommitmentBaseModel.d.mts +0 -65
  57. package/dist/classes/CommitmentBaseModel.d.ts +0 -65
  58. package/dist/classes/CommitmentBaseModel.js +0 -2
  59. package/dist/classes/CommitmentBaseModel.js.map +0 -1
  60. package/dist/classes/CommitmentBaseModel.mjs +0 -2
  61. package/dist/classes/CommitmentBaseModel.mjs.map +0 -1
  62. package/dist/classes/CommitmentStoredClass.d.mts +0 -31
  63. package/dist/classes/CommitmentStoredClass.d.ts +0 -31
  64. package/dist/classes/CommitmentStoredClass.js +0 -2
  65. package/dist/classes/CommitmentStoredClass.js.map +0 -1
  66. package/dist/classes/CommitmentStoredClass.mjs +0 -2
  67. package/dist/classes/CommitmentStoredClass.mjs.map +0 -1
  68. package/dist/classes/index.js +0 -2
  69. package/dist/classes/index.js.map +0 -1
  70. package/dist/classes/navigation/LocationBaseModel.d.mts +0 -54
  71. package/dist/classes/navigation/LocationBaseModel.d.ts +0 -54
  72. package/dist/classes/navigation/LocationBaseModel.js +0 -2
  73. package/dist/classes/navigation/LocationBaseModel.js.map +0 -1
  74. package/dist/classes/navigation/LocationBaseModel.mjs +0 -2
  75. package/dist/classes/navigation/LocationBaseModel.mjs.map +0 -1
  76. package/dist/classes/navigation/LocationStoredClass.d.mts +0 -23
  77. package/dist/classes/navigation/LocationStoredClass.d.ts +0 -23
  78. package/dist/classes/navigation/LocationStoredClass.js +0 -2
  79. package/dist/classes/navigation/LocationStoredClass.js.map +0 -1
  80. package/dist/classes/navigation/LocationStoredClass.mjs +0 -2
  81. package/dist/classes/navigation/LocationStoredClass.mjs.map +0 -1
  82. package/dist/classes/navigation/MapBaseModel.d.mts +0 -41
  83. package/dist/classes/navigation/MapBaseModel.d.ts +0 -41
  84. package/dist/classes/navigation/MapBaseModel.js +0 -2
  85. package/dist/classes/navigation/MapBaseModel.js.map +0 -1
  86. package/dist/classes/navigation/MapBaseModel.mjs +0 -2
  87. package/dist/classes/navigation/MapBaseModel.mjs.map +0 -1
  88. package/dist/classes/navigation/MapStoredClass.d.mts +0 -14
  89. package/dist/classes/navigation/MapStoredClass.d.ts +0 -14
  90. package/dist/classes/navigation/MapStoredClass.js +0 -2
  91. package/dist/classes/navigation/MapStoredClass.js.map +0 -1
  92. package/dist/classes/navigation/MapStoredClass.mjs +0 -2
  93. package/dist/classes/navigation/MapStoredClass.mjs.map +0 -1
  94. package/dist/classes/navigation/NavigationAbstractClass.d.mts +0 -48
  95. package/dist/classes/navigation/NavigationAbstractClass.d.ts +0 -48
  96. package/dist/classes/navigation/NavigationAbstractClass.js +0 -2
  97. package/dist/classes/navigation/NavigationAbstractClass.js.map +0 -1
  98. package/dist/classes/navigation/NavigationAbstractClass.mjs +0 -2
  99. package/dist/classes/navigation/NavigationAbstractClass.mjs.map +0 -1
  100. package/dist/classes/navigation/RoomBaseModel.d.mts +0 -67
  101. package/dist/classes/navigation/RoomBaseModel.d.ts +0 -67
  102. package/dist/classes/navigation/RoomBaseModel.js +0 -2
  103. package/dist/classes/navigation/RoomBaseModel.js.map +0 -1
  104. package/dist/classes/navigation/RoomBaseModel.mjs +0 -2
  105. package/dist/classes/navigation/RoomBaseModel.mjs.map +0 -1
  106. package/dist/classes/navigation/RoomStoredClass.d.mts +0 -23
  107. package/dist/classes/navigation/RoomStoredClass.d.ts +0 -23
  108. package/dist/classes/navigation/RoomStoredClass.js +0 -2
  109. package/dist/classes/navigation/RoomStoredClass.js.map +0 -1
  110. package/dist/classes/navigation/RoomStoredClass.mjs +0 -2
  111. package/dist/classes/navigation/RoomStoredClass.mjs.map +0 -1
  112. package/dist/classes/quest/QuestBaseModel.d.mts +0 -36
  113. package/dist/classes/quest/QuestBaseModel.d.ts +0 -36
  114. package/dist/classes/quest/QuestBaseModel.js +0 -2
  115. package/dist/classes/quest/QuestBaseModel.js.map +0 -1
  116. package/dist/classes/quest/QuestBaseModel.mjs +0 -2
  117. package/dist/classes/quest/QuestBaseModel.mjs.map +0 -1
  118. package/dist/classes/quest/QuestStoredClass.d.mts +0 -37
  119. package/dist/classes/quest/QuestStoredClass.d.ts +0 -37
  120. package/dist/classes/quest/QuestStoredClass.js +0 -2
  121. package/dist/classes/quest/QuestStoredClass.js.map +0 -1
  122. package/dist/classes/quest/QuestStoredClass.mjs +0 -2
  123. package/dist/classes/quest/QuestStoredClass.mjs.map +0 -1
  124. package/dist/classes/quest/StageBaseModel.d.mts +0 -50
  125. package/dist/classes/quest/StageBaseModel.d.ts +0 -50
  126. package/dist/classes/quest/StageBaseModel.js +0 -2
  127. package/dist/classes/quest/StageBaseModel.js.map +0 -1
  128. package/dist/classes/quest/StageBaseModel.mjs +0 -2
  129. package/dist/classes/quest/StageBaseModel.mjs.map +0 -1
  130. package/dist/classes/quest/StageStoredClass.d.mts +0 -46
  131. package/dist/classes/quest/StageStoredClass.d.ts +0 -46
  132. package/dist/classes/quest/StageStoredClass.js +0 -2
  133. package/dist/classes/quest/StageStoredClass.js.map +0 -1
  134. package/dist/classes/quest/StageStoredClass.mjs +0 -2
  135. package/dist/classes/quest/StageStoredClass.mjs.map +0 -1
  136. package/dist/constants.d.mts +0 -4
  137. package/dist/constants.d.ts +0 -4
  138. package/dist/constants.js +0 -2
  139. package/dist/constants.js.map +0 -1
  140. package/dist/constants.mjs +0 -2
  141. package/dist/constants.mjs.map +0 -1
  142. package/dist/decorators/ActivityDecorator.d.mts +0 -15
  143. package/dist/decorators/ActivityDecorator.d.ts +0 -15
  144. package/dist/decorators/ActivityDecorator.js +0 -2
  145. package/dist/decorators/ActivityDecorator.js.map +0 -1
  146. package/dist/decorators/ActivityDecorator.mjs +0 -2
  147. package/dist/decorators/ActivityDecorator.mjs.map +0 -1
  148. package/dist/decorators/CommitmentDecorator.d.mts +0 -27
  149. package/dist/decorators/CommitmentDecorator.d.ts +0 -27
  150. package/dist/decorators/CommitmentDecorator.js +0 -2
  151. package/dist/decorators/CommitmentDecorator.js.map +0 -1
  152. package/dist/decorators/CommitmentDecorator.mjs +0 -2
  153. package/dist/decorators/CommitmentDecorator.mjs.map +0 -1
  154. package/dist/decorators/QuestDecorator.d.mts +0 -22
  155. package/dist/decorators/QuestDecorator.d.ts +0 -22
  156. package/dist/decorators/QuestDecorator.js +0 -2
  157. package/dist/decorators/QuestDecorator.js.map +0 -1
  158. package/dist/decorators/QuestDecorator.mjs +0 -2
  159. package/dist/decorators/QuestDecorator.mjs.map +0 -1
  160. package/dist/decorators/RoomDecorator.d.mts +0 -28
  161. package/dist/decorators/RoomDecorator.d.ts +0 -28
  162. package/dist/decorators/RoomDecorator.js +0 -2
  163. package/dist/decorators/RoomDecorator.js.map +0 -1
  164. package/dist/decorators/RoomDecorator.mjs +0 -2
  165. package/dist/decorators/RoomDecorator.mjs.map +0 -1
  166. package/dist/decorators/index.js +0 -2
  167. package/dist/decorators/index.js.map +0 -1
  168. package/dist/functions/index.d.mts +0 -2
  169. package/dist/functions/index.d.ts +0 -2
  170. package/dist/functions/index.js +0 -2
  171. package/dist/functions/index.mjs +0 -2
  172. package/dist/index.js +0 -2
  173. package/dist/index.js.map +0 -1
  174. package/dist/interface/ActivityInterface.d.mts +0 -40
  175. package/dist/interface/ActivityInterface.d.ts +0 -40
  176. package/dist/interface/ActivityInterface.js +0 -2
  177. package/dist/interface/ActivityInterface.js.map +0 -1
  178. package/dist/interface/ActivityInterface.mjs +0 -2
  179. package/dist/interface/ActivityInterface.mjs.map +0 -1
  180. package/dist/interface/ActivityProps.d.mts +0 -48
  181. package/dist/interface/ActivityProps.d.ts +0 -48
  182. package/dist/interface/ActivityProps.js +0 -2
  183. package/dist/interface/ActivityProps.js.map +0 -1
  184. package/dist/interface/ActivityProps.mjs +0 -2
  185. package/dist/interface/ActivityProps.mjs.map +0 -1
  186. package/dist/interface/CommitmentInterface.d.mts +0 -6
  187. package/dist/interface/CommitmentInterface.d.ts +0 -6
  188. package/dist/interface/CommitmentInterface.js +0 -2
  189. package/dist/interface/CommitmentInterface.js.map +0 -1
  190. package/dist/interface/CommitmentInterface.mjs +0 -2
  191. package/dist/interface/CommitmentInterface.mjs.map +0 -1
  192. package/dist/interface/CommitmentProps.d.mts +0 -79
  193. package/dist/interface/CommitmentProps.d.ts +0 -79
  194. package/dist/interface/CommitmentProps.js +0 -2
  195. package/dist/interface/CommitmentProps.js.map +0 -1
  196. package/dist/interface/CommitmentProps.mjs +0 -2
  197. package/dist/interface/CommitmentProps.mjs.map +0 -1
  198. package/dist/interface/index.js +0 -2
  199. package/dist/interface/index.js.map +0 -1
  200. package/dist/interface/navigation/LocationBaseModelProps.d.mts +0 -32
  201. package/dist/interface/navigation/LocationBaseModelProps.d.ts +0 -32
  202. package/dist/interface/navigation/LocationBaseModelProps.js +0 -2
  203. package/dist/interface/navigation/LocationBaseModelProps.js.map +0 -1
  204. package/dist/interface/navigation/LocationBaseModelProps.mjs +0 -2
  205. package/dist/interface/navigation/LocationBaseModelProps.mjs.map +0 -1
  206. package/dist/interface/navigation/LocationInterface.d.mts +0 -6
  207. package/dist/interface/navigation/LocationInterface.d.ts +0 -6
  208. package/dist/interface/navigation/LocationInterface.js +0 -2
  209. package/dist/interface/navigation/LocationInterface.js.map +0 -1
  210. package/dist/interface/navigation/LocationInterface.mjs +0 -2
  211. package/dist/interface/navigation/LocationInterface.mjs.map +0 -1
  212. package/dist/interface/navigation/MapBaseModelProps.d.mts +0 -22
  213. package/dist/interface/navigation/MapBaseModelProps.d.ts +0 -22
  214. package/dist/interface/navigation/MapBaseModelProps.js +0 -2
  215. package/dist/interface/navigation/MapBaseModelProps.js.map +0 -1
  216. package/dist/interface/navigation/MapBaseModelProps.mjs +0 -2
  217. package/dist/interface/navigation/MapBaseModelProps.mjs.map +0 -1
  218. package/dist/interface/navigation/MapInterface.d.mts +0 -6
  219. package/dist/interface/navigation/MapInterface.d.ts +0 -6
  220. package/dist/interface/navigation/MapInterface.js +0 -2
  221. package/dist/interface/navigation/MapInterface.js.map +0 -1
  222. package/dist/interface/navigation/MapInterface.mjs +0 -2
  223. package/dist/interface/navigation/MapInterface.mjs.map +0 -1
  224. package/dist/interface/navigation/NavigationAbstractClass.d.mts +0 -54
  225. package/dist/interface/navigation/NavigationAbstractClass.d.ts +0 -54
  226. package/dist/interface/navigation/NavigationAbstractClass.js +0 -2
  227. package/dist/interface/navigation/NavigationAbstractClass.js.map +0 -1
  228. package/dist/interface/navigation/NavigationAbstractClass.mjs +0 -2
  229. package/dist/interface/navigation/NavigationAbstractClass.mjs.map +0 -1
  230. package/dist/interface/navigation/RoomBaseModelProps.d.mts +0 -37
  231. package/dist/interface/navigation/RoomBaseModelProps.d.ts +0 -37
  232. package/dist/interface/navigation/RoomBaseModelProps.js +0 -2
  233. package/dist/interface/navigation/RoomBaseModelProps.js.map +0 -1
  234. package/dist/interface/navigation/RoomBaseModelProps.mjs +0 -2
  235. package/dist/interface/navigation/RoomBaseModelProps.mjs.map +0 -1
  236. package/dist/interface/navigation/RoomInterface.d.mts +0 -6
  237. package/dist/interface/navigation/RoomInterface.d.ts +0 -6
  238. package/dist/interface/navigation/RoomInterface.js +0 -2
  239. package/dist/interface/navigation/RoomInterface.js.map +0 -1
  240. package/dist/interface/navigation/RoomInterface.mjs +0 -2
  241. package/dist/interface/navigation/RoomInterface.mjs.map +0 -1
  242. package/dist/interface/quest/QuestInterface.d.mts +0 -2
  243. package/dist/interface/quest/QuestInterface.d.ts +0 -2
  244. package/dist/interface/quest/QuestInterface.js +0 -2
  245. package/dist/interface/quest/QuestInterface.js.map +0 -1
  246. package/dist/interface/quest/QuestInterface.mjs +0 -2
  247. package/dist/interface/quest/QuestInterface.mjs.map +0 -1
  248. package/dist/interface/quest/QuestProps.d.mts +0 -39
  249. package/dist/interface/quest/QuestProps.d.ts +0 -39
  250. package/dist/interface/quest/QuestProps.js +0 -2
  251. package/dist/interface/quest/QuestProps.js.map +0 -1
  252. package/dist/interface/quest/QuestProps.mjs +0 -2
  253. package/dist/interface/quest/QuestProps.mjs.map +0 -1
  254. package/dist/interface/quest/StageFlags.d.mts +0 -12
  255. package/dist/interface/quest/StageFlags.d.ts +0 -12
  256. package/dist/interface/quest/StageFlags.js +0 -2
  257. package/dist/interface/quest/StageFlags.js.map +0 -1
  258. package/dist/interface/quest/StageFlags.mjs +0 -2
  259. package/dist/interface/quest/StageFlags.mjs.map +0 -1
  260. package/dist/interface/quest/StageInterface.d.mts +0 -2
  261. package/dist/interface/quest/StageInterface.d.ts +0 -2
  262. package/dist/interface/quest/StageInterface.js +0 -2
  263. package/dist/interface/quest/StageInterface.js.map +0 -1
  264. package/dist/interface/quest/StageInterface.mjs +0 -2
  265. package/dist/interface/quest/StageInterface.mjs.map +0 -1
  266. package/dist/interface/quest/StageProps.d.mts +0 -60
  267. package/dist/interface/quest/StageProps.d.ts +0 -60
  268. package/dist/interface/quest/StageProps.js +0 -2
  269. package/dist/interface/quest/StageProps.js.map +0 -1
  270. package/dist/interface/quest/StageProps.mjs +0 -2
  271. package/dist/interface/quest/StageProps.mjs.map +0 -1
  272. package/dist/managers/NavigatorManager.d.mts +0 -22
  273. package/dist/managers/NavigatorManager.d.ts +0 -22
  274. package/dist/managers/NavigatorManager.js +0 -2
  275. package/dist/managers/NavigatorManager.js.map +0 -1
  276. package/dist/managers/NavigatorManager.mjs +0 -2
  277. package/dist/managers/NavigatorManager.mjs.map +0 -1
  278. package/dist/managers/QuestManager.d.mts +0 -17
  279. package/dist/managers/QuestManager.d.ts +0 -17
  280. package/dist/managers/QuestManager.js +0 -2
  281. package/dist/managers/QuestManager.js.map +0 -1
  282. package/dist/managers/QuestManager.mjs +0 -2
  283. package/dist/managers/QuestManager.mjs.map +0 -1
  284. package/dist/managers/RoutineManager.d.mts +0 -59
  285. package/dist/managers/RoutineManager.d.ts +0 -59
  286. package/dist/managers/RoutineManager.js +0 -2
  287. package/dist/managers/RoutineManager.js.map +0 -1
  288. package/dist/managers/RoutineManager.mjs +0 -2
  289. package/dist/managers/RoutineManager.mjs.map +0 -1
  290. package/dist/managers/TimeManager.d.mts +0 -74
  291. package/dist/managers/TimeManager.d.ts +0 -74
  292. package/dist/managers/TimeManager.js +0 -2
  293. package/dist/managers/TimeManager.js.map +0 -1
  294. package/dist/managers/TimeManager.mjs +0 -2
  295. package/dist/managers/TimeManager.mjs.map +0 -1
  296. package/dist/managers/TimeManagerSettings.d.mts +0 -13
  297. package/dist/managers/TimeManagerSettings.d.ts +0 -13
  298. package/dist/managers/TimeManagerSettings.js +0 -2
  299. package/dist/managers/TimeManagerSettings.js.map +0 -1
  300. package/dist/managers/TimeManagerSettings.mjs +0 -2
  301. package/dist/managers/TimeManagerSettings.mjs.map +0 -1
  302. package/dist/managers/index.js +0 -2
  303. package/dist/managers/index.js.map +0 -1
  304. package/dist/nqtr.d.d.mts +0 -195
  305. package/dist/nqtr.d.d.ts +0 -195
  306. package/dist/nqtr.d.js +0 -2
  307. package/dist/nqtr.d.js.map +0 -1
  308. package/dist/nqtr.d.mjs +0 -2
  309. package/dist/nqtr.d.mjs.map +0 -1
  310. package/dist/types/ExecutionType.d.mts +0 -3
  311. package/dist/types/ExecutionType.d.ts +0 -3
  312. package/dist/types/ExecutionType.js +0 -2
  313. package/dist/types/ExecutionType.js.map +0 -1
  314. package/dist/types/ExecutionType.mjs +0 -2
  315. package/dist/types/ExecutionType.mjs.map +0 -1
  316. package/dist/types/OnRunEvent.d.mts +0 -9
  317. package/dist/types/OnRunEvent.d.ts +0 -9
  318. package/dist/types/OnRunEvent.js +0 -2
  319. package/dist/types/OnRunEvent.js.map +0 -1
  320. package/dist/types/OnRunEvent.mjs +0 -2
  321. package/dist/types/OnRunEvent.mjs.map +0 -1
  322. package/dist/types/QuestsRequired.d.mts +0 -2
  323. package/dist/types/QuestsRequired.d.ts +0 -2
  324. package/dist/types/QuestsRequired.js +0 -2
  325. package/dist/types/QuestsRequired.js.map +0 -1
  326. package/dist/types/QuestsRequired.mjs +0 -2
  327. package/dist/types/QuestsRequired.mjs.map +0 -1
  328. package/dist/types/TimeDataType.d.mts +0 -6
  329. package/dist/types/TimeDataType.d.ts +0 -6
  330. package/dist/types/TimeDataType.js +0 -2
  331. package/dist/types/TimeDataType.js.map +0 -1
  332. package/dist/types/TimeDataType.mjs +0 -2
  333. package/dist/types/TimeDataType.mjs.map +0 -1
  334. package/dist/types/TimeSettings.d.mts +0 -58
  335. package/dist/types/TimeSettings.d.ts +0 -58
  336. package/dist/types/TimeSettings.js +0 -2
  337. package/dist/types/TimeSettings.js.map +0 -1
  338. package/dist/types/TimeSettings.mjs +0 -2
  339. package/dist/types/TimeSettings.mjs.map +0 -1
  340. package/dist/types/index.js +0 -2
  341. package/dist/types/index.js.map +0 -1
@@ -1 +0,0 @@
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,EAAmD,EAAC,CA2B1D,SAASC,CAAAA,CAAYC,CAAuC,CAAA,CAClE,GAA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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,17 +0,0 @@
1
- import { OnRunProps } from '@drincs/nqtr';
2
- import { Q as QuestInterface } from '../StageInterface-DJ7l0ubG.mjs';
3
-
4
- declare class QuestManager {
5
- get quests(): QuestInterface[];
6
- get startedQuests(): QuestInterface[];
7
- get completedQuests(): QuestInterface[];
8
- get failedQuests(): QuestInterface[];
9
- get notStartedQuests(): QuestInterface[];
10
- find(id: string): QuestInterface | undefined;
11
- /**
12
- * Start the quests that must start on the current stage.
13
- */
14
- startsStageMustBeStarted(props: OnRunProps): void;
15
- }
16
-
17
- export { QuestManager as default };
@@ -1,17 +0,0 @@
1
- import { OnRunProps } from '@drincs/nqtr';
2
- import { Q as QuestInterface } from '../StageInterface-DJ7l0ubG.js';
3
-
4
- declare class QuestManager {
5
- get quests(): QuestInterface[];
6
- get startedQuests(): QuestInterface[];
7
- get completedQuests(): QuestInterface[];
8
- get failedQuests(): QuestInterface[];
9
- get notStartedQuests(): QuestInterface[];
10
- find(id: string): QuestInterface | undefined;
11
- /**
12
- * Start the quests that must start on the current stage.
13
- */
14
- startsStageMustBeStarted(props: OnRunProps): void;
15
- }
16
-
17
- export { QuestManager as default };
@@ -1,2 +0,0 @@
1
- 'use strict';var r={};function u(t){try{let e=r[t];if(!e){console.error(`[NQTR] Quest ${t} not found`);return}return e}catch(e){console.error(`[NQTR] Error while getting Quest ${t}`,e);return}}var s=class{get quests(){return Object.values(r)}get startedQuests(){return this.quests.filter(e=>e.started)}get completedQuests(){return this.quests.filter(e=>e.completed)}get failedQuests(){return this.quests.filter(e=>e.failed)}get notStartedQuests(){return this.quests.filter(e=>!e.started)}find(e){return u(e)}startsStageMustBeStarted(e){Object.values(r).forEach(n=>{n.currentStageMustStart&&n.startCurrentStage(e);});}};module.exports=s;//# sourceMappingURL=QuestManager.js.map
2
- //# sourceMappingURL=QuestManager.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/decorators/QuestDecorator.ts","../../src/managers/QuestManager.ts"],"names":["registeredQuests","getQuestById","id","quest","QuestManager","props"],"mappings":"aAEO,IAAMA,CAAqD,CAAA,EAyB3D,CAAA,SAASC,CAAaC,CAAAA,CAAAA,CAAwC,CACpE,GAAI,CACH,IAAIC,CAAQH,CAAAA,CAAAA,CAAiBE,CAAE,CAAA,CAC/B,GAAI,CAACC,CAAO,CAAA,CACX,OAAQ,CAAA,KAAA,CAAM,CAAgBD,aAAAA,EAAAA,CAAE,CAAY,UAAA,CAAA,CAAA,CAC5C,MACD,CACA,OAAOC,CACR,OAAS,CAAG,CAAA,CACX,OAAQ,CAAA,KAAA,CAAM,CAAoCD,iCAAAA,EAAAA,CAAE,CAAI,CAAA,CAAA,CAAC,CACzD,CAAA,MACD,CACD,CCnCqBE,IAAAA,CAAAA,CAArB,KAAkC,CAC9B,IAAI,MAAA,EAA2B,CAC3B,OAAO,MAAO,CAAA,MAAA,CAAOJ,CAAgB,CACzC,CACA,IAAI,aAAkC,EAAA,CAClC,OAAO,IAAA,CAAK,MAAO,CAAA,MAAA,CAAQG,GAAUA,CAAM,CAAA,OAAO,CACtD,CACA,IAAI,eAAA,EAAoC,CACpC,OAAO,IAAK,CAAA,MAAA,CAAO,MAAQA,CAAAA,CAAAA,EAAUA,CAAM,CAAA,SAAS,CACxD,CACA,IAAI,YAAA,EAAiC,CACjC,OAAO,IAAK,CAAA,MAAA,CAAO,MAAQA,CAAAA,CAAAA,EAAUA,CAAM,CAAA,MAAM,CACrD,CACA,IAAI,gBAAA,EAAqC,CACrC,OAAO,KAAK,MAAO,CAAA,MAAA,CAAQA,CAAU,EAAA,CAACA,CAAM,CAAA,OAAO,CACvD,CAEA,IAAKD,CAAAA,CAAAA,CAAwC,CACzC,OAAOD,CAAaC,CAAAA,CAAE,CAC1B,CAKA,yBAAyBG,CAAmB,CAAA,CACxC,MAAO,CAAA,MAAA,CAAOL,CAAgB,CAAA,CAAE,OAASG,CAAAA,CAAAA,EAAU,CAC3CA,CAAAA,CAAM,qBACNA,EAAAA,CAAAA,CAAM,iBAAkBE,CAAAA,CAAK,EAErC,CAAC,EACL,CACJ","file":"QuestManager.js","sourcesContent":["import { QuestInterface } from \"../interface\";\n\nexport const registeredQuests: { [id: string]: QuestInterface } = {};\n\n/**\n * Save a quest in the registered quests. If the quest already exists, it will be overwritten.\n * @param id The id of the quest, it must be unique\n * @param stages The stages of the quest\n * @param props The quest properties\n * @returns The created quest\n */\nexport function saveQuest(quest: QuestInterface | QuestInterface[]) {\n\tif (Array.isArray(quest)) {\n\t\tquest.forEach((c) => saveQuest(c));\n\t\treturn;\n\t}\n\tif (registeredQuests[quest.id]) {\n\t\tconsole.warn(`[NQTR] Quest id ${quest.id} already exists, it will be overwritten`);\n\t}\n\tregisteredQuests[quest.id] = quest;\n}\n\n/**\n * Get a quest by its id.\n * @param id The id of the quest.\n * @returns The quest or undefined if not found.\n */\nexport function getQuestById(id: string): QuestInterface | undefined {\n\ttry {\n\t\tlet quest = registeredQuests[id];\n\t\tif (!quest) {\n\t\t\tconsole.error(`[NQTR] Quest ${id} not found`);\n\t\t\treturn;\n\t\t}\n\t\treturn quest;\n\t} catch (e) {\n\t\tconsole.error(`[NQTR] Error while getting Quest ${id}`, e);\n\t\treturn;\n\t}\n}\n","import { OnRunProps } from \"@drincs/nqtr\";\nimport { getQuestById, registeredQuests } from \"../decorators/QuestDecorator\";\nimport { QuestInterface } from \"../interface\";\n\nexport default class QuestManager {\n get quests(): QuestInterface[] {\n return Object.values(registeredQuests);\n }\n get startedQuests(): QuestInterface[] {\n return this.quests.filter((quest) => quest.started);\n }\n get completedQuests(): QuestInterface[] {\n return this.quests.filter((quest) => quest.completed);\n }\n get failedQuests(): QuestInterface[] {\n return this.quests.filter((quest) => quest.failed);\n }\n get notStartedQuests(): QuestInterface[] {\n return this.quests.filter((quest) => !quest.started);\n }\n\n find(id: string): QuestInterface | undefined {\n return getQuestById(id);\n }\n\n /**\n * Start the quests that must start on the current stage.\n */\n startsStageMustBeStarted(props: OnRunProps) {\n Object.values(registeredQuests).forEach((quest) => {\n if (quest.currentStageMustStart) {\n quest.startCurrentStage(props);\n }\n });\n }\n}\n"]}
@@ -1,2 +0,0 @@
1
- var r={};function u(t){try{let e=r[t];if(!e){console.error(`[NQTR] Quest ${t} not found`);return}return e}catch(e){console.error(`[NQTR] Error while getting Quest ${t}`,e);return}}var s=class{get quests(){return Object.values(r)}get startedQuests(){return this.quests.filter(e=>e.started)}get completedQuests(){return this.quests.filter(e=>e.completed)}get failedQuests(){return this.quests.filter(e=>e.failed)}get notStartedQuests(){return this.quests.filter(e=>!e.started)}find(e){return u(e)}startsStageMustBeStarted(e){Object.values(r).forEach(n=>{n.currentStageMustStart&&n.startCurrentStage(e);});}};export{s as default};//# sourceMappingURL=QuestManager.mjs.map
2
- //# sourceMappingURL=QuestManager.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/decorators/QuestDecorator.ts","../../src/managers/QuestManager.ts"],"names":["registeredQuests","getQuestById","id","quest","QuestManager","props"],"mappings":"AAEO,IAAMA,CAAqD,CAAA,EAyB3D,CAAA,SAASC,CAAaC,CAAAA,CAAAA,CAAwC,CACpE,GAAI,CACH,IAAIC,CAAQH,CAAAA,CAAAA,CAAiBE,CAAE,CAAA,CAC/B,GAAI,CAACC,CAAO,CAAA,CACX,OAAQ,CAAA,KAAA,CAAM,CAAgBD,aAAAA,EAAAA,CAAE,CAAY,UAAA,CAAA,CAAA,CAC5C,MACD,CACA,OAAOC,CACR,OAAS,CAAG,CAAA,CACX,OAAQ,CAAA,KAAA,CAAM,CAAoCD,iCAAAA,EAAAA,CAAE,CAAI,CAAA,CAAA,CAAC,CACzD,CAAA,MACD,CACD,CCnCqBE,IAAAA,CAAAA,CAArB,KAAkC,CAC9B,IAAI,MAAA,EAA2B,CAC3B,OAAO,MAAO,CAAA,MAAA,CAAOJ,CAAgB,CACzC,CACA,IAAI,aAAkC,EAAA,CAClC,OAAO,IAAA,CAAK,MAAO,CAAA,MAAA,CAAQG,GAAUA,CAAM,CAAA,OAAO,CACtD,CACA,IAAI,eAAA,EAAoC,CACpC,OAAO,IAAK,CAAA,MAAA,CAAO,MAAQA,CAAAA,CAAAA,EAAUA,CAAM,CAAA,SAAS,CACxD,CACA,IAAI,YAAA,EAAiC,CACjC,OAAO,IAAK,CAAA,MAAA,CAAO,MAAQA,CAAAA,CAAAA,EAAUA,CAAM,CAAA,MAAM,CACrD,CACA,IAAI,gBAAA,EAAqC,CACrC,OAAO,KAAK,MAAO,CAAA,MAAA,CAAQA,CAAU,EAAA,CAACA,CAAM,CAAA,OAAO,CACvD,CAEA,IAAKD,CAAAA,CAAAA,CAAwC,CACzC,OAAOD,CAAaC,CAAAA,CAAE,CAC1B,CAKA,yBAAyBG,CAAmB,CAAA,CACxC,MAAO,CAAA,MAAA,CAAOL,CAAgB,CAAA,CAAE,OAASG,CAAAA,CAAAA,EAAU,CAC3CA,CAAAA,CAAM,qBACNA,EAAAA,CAAAA,CAAM,iBAAkBE,CAAAA,CAAK,EAErC,CAAC,EACL,CACJ","file":"QuestManager.mjs","sourcesContent":["import { QuestInterface } from \"../interface\";\n\nexport const registeredQuests: { [id: string]: QuestInterface } = {};\n\n/**\n * Save a quest in the registered quests. If the quest already exists, it will be overwritten.\n * @param id The id of the quest, it must be unique\n * @param stages The stages of the quest\n * @param props The quest properties\n * @returns The created quest\n */\nexport function saveQuest(quest: QuestInterface | QuestInterface[]) {\n\tif (Array.isArray(quest)) {\n\t\tquest.forEach((c) => saveQuest(c));\n\t\treturn;\n\t}\n\tif (registeredQuests[quest.id]) {\n\t\tconsole.warn(`[NQTR] Quest id ${quest.id} already exists, it will be overwritten`);\n\t}\n\tregisteredQuests[quest.id] = quest;\n}\n\n/**\n * Get a quest by its id.\n * @param id The id of the quest.\n * @returns The quest or undefined if not found.\n */\nexport function getQuestById(id: string): QuestInterface | undefined {\n\ttry {\n\t\tlet quest = registeredQuests[id];\n\t\tif (!quest) {\n\t\t\tconsole.error(`[NQTR] Quest ${id} not found`);\n\t\t\treturn;\n\t\t}\n\t\treturn quest;\n\t} catch (e) {\n\t\tconsole.error(`[NQTR] Error while getting Quest ${id}`, e);\n\t\treturn;\n\t}\n}\n","import { OnRunProps } from \"@drincs/nqtr\";\nimport { getQuestById, registeredQuests } from \"../decorators/QuestDecorator\";\nimport { QuestInterface } from \"../interface\";\n\nexport default class QuestManager {\n get quests(): QuestInterface[] {\n return Object.values(registeredQuests);\n }\n get startedQuests(): QuestInterface[] {\n return this.quests.filter((quest) => quest.started);\n }\n get completedQuests(): QuestInterface[] {\n return this.quests.filter((quest) => quest.completed);\n }\n get failedQuests(): QuestInterface[] {\n return this.quests.filter((quest) => quest.failed);\n }\n get notStartedQuests(): QuestInterface[] {\n return this.quests.filter((quest) => !quest.started);\n }\n\n find(id: string): QuestInterface | undefined {\n return getQuestById(id);\n }\n\n /**\n * Start the quests that must start on the current stage.\n */\n startsStageMustBeStarted(props: OnRunProps) {\n Object.values(registeredQuests).forEach((quest) => {\n if (quest.currentStageMustStart) {\n quest.startCurrentStage(props);\n }\n });\n }\n}\n"]}
@@ -1,59 +0,0 @@
1
- import { CharacterInterface } from '@drincs/pixi-vn';
2
- import { C as CommitmentInterface } from '../RoomInterface-DsZAp6Pv.mjs';
3
- import '@drincs/nqtr';
4
- import '../interface/ActivityInterface.mjs';
5
- import '../types/ExecutionType.mjs';
6
- import '../interface/navigation/NavigationAbstractClass.mjs';
7
-
8
- declare class RoutineManager {
9
- get fixedRoutine(): CommitmentInterface[];
10
- /**
11
- * Set a commitment as fixed, it will be always available. They cannot be deleted or edit during the game session.
12
- */
13
- set fixedRoutine(commitments: CommitmentInterface[]);
14
- /**
15
- * Get the temporary commitments by its id.
16
- * @returns The temporary commitments.
17
- */
18
- get temporaryRoutine(): CommitmentInterface[];
19
- get allRoutine(): CommitmentInterface[];
20
- /**
21
- * This feature adds the commitments during the game session.
22
- * @param commitment The commitment or commitments to add.
23
- */
24
- add(commitment: CommitmentInterface[] | CommitmentInterface): void;
25
- /**
26
- * Get the commitments added during the game session.
27
- * @param id The id of the commitment.
28
- * @returns The commitment or undefined if not found.
29
- */
30
- find(id: string): CommitmentInterface | undefined;
31
- /**
32
- * Remove the commitments added during the game session.
33
- * @param commitment The commitment or commitments to remove.
34
- */
35
- remove(commitment: CommitmentInterface[] | CommitmentInterface): void;
36
- /**
37
- * Clear all the expired commitments.
38
- */
39
- clearExpiredRoutine(): void;
40
- /**
41
- * Get the current commitments. The hidden commitments are not included.
42
- * 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.
43
- * Higher priority commitments are calculated using the following steps:
44
- * 1. The commitments that have Commitments BaseModel.priority set to a higher value will be selected first.
45
- * 2. If there are commitments with the same priority, the commitments that are not fixed will be selected first.
46
- * 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.
47
- * @returns The current commitments.
48
- */
49
- get currentRoutine(): CommitmentInterface[];
50
- get currentRoomRoutine(): CommitmentInterface[];
51
- /**
52
- * Get the character commitment.
53
- * @param character The character.
54
- * @returns The commitment or undefined if not found.
55
- */
56
- getCommitmentByCharacter(character: CharacterInterface): CommitmentInterface | undefined;
57
- }
58
-
59
- export { RoutineManager as default };
@@ -1,59 +0,0 @@
1
- import { CharacterInterface } from '@drincs/pixi-vn';
2
- import { C as CommitmentInterface } from '../RoomInterface-BglEhkQT.js';
3
- import '@drincs/nqtr';
4
- import '../interface/ActivityInterface.js';
5
- import '../types/ExecutionType.js';
6
- import '../interface/navigation/NavigationAbstractClass.js';
7
-
8
- declare class RoutineManager {
9
- get fixedRoutine(): CommitmentInterface[];
10
- /**
11
- * Set a commitment as fixed, it will be always available. They cannot be deleted or edit during the game session.
12
- */
13
- set fixedRoutine(commitments: CommitmentInterface[]);
14
- /**
15
- * Get the temporary commitments by its id.
16
- * @returns The temporary commitments.
17
- */
18
- get temporaryRoutine(): CommitmentInterface[];
19
- get allRoutine(): CommitmentInterface[];
20
- /**
21
- * This feature adds the commitments during the game session.
22
- * @param commitment The commitment or commitments to add.
23
- */
24
- add(commitment: CommitmentInterface[] | CommitmentInterface): void;
25
- /**
26
- * Get the commitments added during the game session.
27
- * @param id The id of the commitment.
28
- * @returns The commitment or undefined if not found.
29
- */
30
- find(id: string): CommitmentInterface | undefined;
31
- /**
32
- * Remove the commitments added during the game session.
33
- * @param commitment The commitment or commitments to remove.
34
- */
35
- remove(commitment: CommitmentInterface[] | CommitmentInterface): void;
36
- /**
37
- * Clear all the expired commitments.
38
- */
39
- clearExpiredRoutine(): void;
40
- /**
41
- * Get the current commitments. The hidden commitments are not included.
42
- * 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.
43
- * Higher priority commitments are calculated using the following steps:
44
- * 1. The commitments that have Commitments BaseModel.priority set to a higher value will be selected first.
45
- * 2. If there are commitments with the same priority, the commitments that are not fixed will be selected first.
46
- * 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.
47
- * @returns The current commitments.
48
- */
49
- get currentRoutine(): CommitmentInterface[];
50
- get currentRoomRoutine(): CommitmentInterface[];
51
- /**
52
- * Get the character commitment.
53
- * @param character The character.
54
- * @returns The commitment or undefined if not found.
55
- */
56
- getCommitmentByCharacter(character: CharacterInterface): CommitmentInterface | undefined;
57
- }
58
-
59
- export { RoutineManager as default };
@@ -1,2 +0,0 @@
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
2
- //# sourceMappingURL=RoutineManager.js.map
@@ -1 +0,0 @@
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,CA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Manager.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,2 +0,0 @@
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
2
- //# sourceMappingURL=RoutineManager.mjs.map
@@ -1 +0,0 @@
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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,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\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,74 +0,0 @@
1
- import { TimeSettings, ITimeStlot } from '../types/TimeSettings.mjs';
2
-
3
- declare class TimeManager {
4
- initialize(settings: TimeSettings): void;
5
- get minDayHours(): number;
6
- get maxDayHours(): number;
7
- get defaultTimeSpent(): number;
8
- get timeSlots(): ITimeStlot[];
9
- get weekLength(): number;
10
- get weekendStartDay(): number;
11
- get weekDaysNames(): string[];
12
- /**
13
- * Get the current hour
14
- */
15
- get currentHour(): number;
16
- set currentHour(value: number | undefined);
17
- /**
18
- * Get the current day
19
- */
20
- get currentDay(): number;
21
- set currentDay(value: number | undefined);
22
- /**
23
- * If the current day is greater than or equal to the weekend start day, then it will return true.
24
- */
25
- get isWeekend(): boolean;
26
- /**
27
- * Get the current week day number (1 - {@link weekLength}).
28
- * For example, if the week length is 7 and the current day is 10, then the result will be 4.
29
- */
30
- get currentWeekDayNumber(): number;
31
- /**
32
- * Get the current week day name. If the week days names are not defined, then it will return undefined.
33
- * For example, if the week days names are ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'] and the current day is 10, then the result will be 'Thursday'.
34
- * @default ""
35
- */
36
- get currentDayName(): string;
37
- /**
38
- * Get the current {@link timeSlots} index.
39
- * You can use this property to create "Image that changes based on the time period":
40
- * @example
41
- * ```tsx
42
- * import { weekLength } from '@drincs/nqtr';
43
- *
44
- * function changeBackground() {
45
- * return (
46
- * <img src={`background-currentTimeSlot.currentTimeSlot.png`} />
47
- * )
48
- * }
49
- */
50
- get currentTimeSlot(): number;
51
- /**
52
- * This function will increase the current hour by the given time spent.
53
- * If the new hour is greater than or equal to the max day hours, then it will increase the day and set the new hour.
54
- * @param timeSpent is the time spent in hours (default: {@link defaultTimeSpent})
55
- * @returns currentTimeSlot.currentHour
56
- */
57
- increaseHour(timeSpent?: number): number;
58
- /**
59
- * This function will increase the current day by the given days.
60
- * @param newDayHour is the hour of the new day (default: {@link minDayHours})
61
- * @param days is the number of days to increase (default: 1)
62
- * @returns timeTracker.currentDay
63
- */
64
- increaseDay(newDayHour?: number, days?: number): number;
65
- /**
66
- * This function will check if the current hour is between the given hours.
67
- * @param fromHour the starting hour. If the {@link currentHour} is equal to this hour, the function will return true.
68
- * @param toHour the ending hour.
69
- * @returns true if the current hour is between the given hours, otherwise false.
70
- */
71
- nowIsBetween(fromHour: number | undefined, toHour: number | undefined): boolean;
72
- }
73
-
74
- export { TimeManager as default };
@@ -1,74 +0,0 @@
1
- import { TimeSettings, ITimeStlot } from '../types/TimeSettings.js';
2
-
3
- declare class TimeManager {
4
- initialize(settings: TimeSettings): void;
5
- get minDayHours(): number;
6
- get maxDayHours(): number;
7
- get defaultTimeSpent(): number;
8
- get timeSlots(): ITimeStlot[];
9
- get weekLength(): number;
10
- get weekendStartDay(): number;
11
- get weekDaysNames(): string[];
12
- /**
13
- * Get the current hour
14
- */
15
- get currentHour(): number;
16
- set currentHour(value: number | undefined);
17
- /**
18
- * Get the current day
19
- */
20
- get currentDay(): number;
21
- set currentDay(value: number | undefined);
22
- /**
23
- * If the current day is greater than or equal to the weekend start day, then it will return true.
24
- */
25
- get isWeekend(): boolean;
26
- /**
27
- * Get the current week day number (1 - {@link weekLength}).
28
- * For example, if the week length is 7 and the current day is 10, then the result will be 4.
29
- */
30
- get currentWeekDayNumber(): number;
31
- /**
32
- * Get the current week day name. If the week days names are not defined, then it will return undefined.
33
- * For example, if the week days names are ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'] and the current day is 10, then the result will be 'Thursday'.
34
- * @default ""
35
- */
36
- get currentDayName(): string;
37
- /**
38
- * Get the current {@link timeSlots} index.
39
- * You can use this property to create "Image that changes based on the time period":
40
- * @example
41
- * ```tsx
42
- * import { weekLength } from '@drincs/nqtr';
43
- *
44
- * function changeBackground() {
45
- * return (
46
- * <img src={`background-currentTimeSlot.currentTimeSlot.png`} />
47
- * )
48
- * }
49
- */
50
- get currentTimeSlot(): number;
51
- /**
52
- * This function will increase the current hour by the given time spent.
53
- * If the new hour is greater than or equal to the max day hours, then it will increase the day and set the new hour.
54
- * @param timeSpent is the time spent in hours (default: {@link defaultTimeSpent})
55
- * @returns currentTimeSlot.currentHour
56
- */
57
- increaseHour(timeSpent?: number): number;
58
- /**
59
- * This function will increase the current day by the given days.
60
- * @param newDayHour is the hour of the new day (default: {@link minDayHours})
61
- * @param days is the number of days to increase (default: 1)
62
- * @returns timeTracker.currentDay
63
- */
64
- increaseDay(newDayHour?: number, days?: number): number;
65
- /**
66
- * This function will check if the current hour is between the given hours.
67
- * @param fromHour the starting hour. If the {@link currentHour} is equal to this hour, the function will return true.
68
- * @param toHour the ending hour.
69
- * @returns true if the current hour is between the given hours, otherwise false.
70
- */
71
- nowIsBetween(fromHour: number | undefined, toHour: number | undefined): boolean;
72
- }
73
-
74
- export { TimeManager as default };
@@ -1,2 +0,0 @@
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
2
- //# sourceMappingURL=TimeManager.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/constants.ts","../../src/managers/TimeManagerSettings.ts","../../src/managers/TimeManager.ts"],"names":["TIME_DATA_KEY","TimeManagerSettings","TimeManager","settings","minDayHours","maxDayHours","defaultTimeSpent","timeSlots","weekLength","weekendStartDay","weekDaysNames","data","storage","value","weekDayNumber","index","slot","timeSpent","newHour","newDayHour","days","newDay","fromHour","toHour","currentHour"],"mappings":"mDACO,IAAMA,EAAgB,8BCC7B,CAAA,IAAqBC,CAArB,CAAA,KAAiE,CAC7D,OAAO,YAAsB,CAC7B,CAAA,OAAO,WAAsB,CAAA,EAAA,CAC7B,OAAO,gBAAA,CAA2B,EAClC,OAAO,SAAA,CAA0B,EAAC,CAClC,OAAO,UAAA,CAAqB,EAC5B,OAAO,eAAA,CAA0B,IAAK,CAAA,UAAA,CAAa,CACnD,CAAA,OAAO,cAA0B,EACrC,CCJA,CAAA,IAAqBC,CAArB,CAAA,KAAiC,CAC7B,UAAWC,CAAAA,CAAAA,CAAwB,CAC/B,GAAM,CACF,WAAA,CAAAC,EAAc,CACd,CAAA,WAAA,CAAAC,CAAc,CAAA,EAAA,CACd,gBAAAC,CAAAA,CAAAA,CAAmB,EACnB,SAAAC,CAAAA,CAAAA,CAAY,EAAC,CACb,UAAAC,CAAAA,CAAAA,CAAa,EACb,eAAAC,CAAAA,CAAAA,CAAkBD,CAAa,CAAA,CAAA,CAC/B,aAAAE,CAAAA,CAAAA,CAAgB,EACpB,CAAA,CAAIP,CACJF,CAAAA,CAAAA,CAAoB,WAAcG,CAAAA,CAAAA,CAClCH,EAAoB,WAAcI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C,CACJC,CAAAA,CAAAA,EAAeF,CAAYE,EAAAA,CAAAA,CAAcD,EAE7CC,CAAeF,EAAAA,CAAAA,EAAYE,CAAcD,CAAAA,CACpD,CACJ","file":"TimeManager.js","sourcesContent":["export const TIME_SETTINGS_KEY = '___nqtr-time_manager_settings___';\nexport const TIME_DATA_KEY = '___nqtr-time_manager_data___';\n\n","import { ITimeStlot, TimeSettings } from \"../types/TimeSettings\";\n\nexport default class TimeManagerSettings implements TimeSettings {\n static minDayHours: number = 0\n static maxDayHours: number = 24\n static defaultTimeSpent: number = 1\n static timeSlots: ITimeStlot[] = []\n static weekLength: number = 7\n static weekendStartDay: number = this.weekLength - 1\n static weekDaysNames: string[] = []\n}\n","import { storage } from \"@drincs/pixi-vn\";\nimport { TIME_DATA_KEY } from \"../constants\";\nimport TimeDataType from \"../types/TimeDataType\";\nimport { ITimeStlot, TimeSettings } from \"../types/TimeSettings\";\nimport TimeManagerSettings from \"./TimeManagerSettings\";\n\nexport default class TimeManager {\n initialize(settings: TimeSettings) {\n const {\n minDayHours = 0,\n maxDayHours = 24,\n defaultTimeSpent = 1,\n timeSlots = [],\n weekLength = 7,\n weekendStartDay = weekLength - 1,\n weekDaysNames = [],\n } = settings\n TimeManagerSettings.minDayHours = minDayHours\n TimeManagerSettings.maxDayHours = maxDayHours\n TimeManagerSettings.defaultTimeSpent = defaultTimeSpent\n TimeManagerSettings.timeSlots = timeSlots\n TimeManagerSettings.weekLength = weekLength\n if (weekendStartDay >= TimeManagerSettings.weekLength) {\n console.warn(`[NQTR] Weekend start day should be less than week length ${weekLength}, so will be ignored`)\n }\n else {\n TimeManagerSettings.weekendStartDay = weekendStartDay\n }\n if (weekDaysNames.length !== weekLength) {\n console.warn(`[NQTR] Week days names should be equal to week length ${weekLength}, so will be ignored`)\n }\n else {\n TimeManagerSettings.weekDaysNames = weekDaysNames\n }\n }\n get minDayHours(): number {\n return TimeManagerSettings.minDayHours\n }\n get maxDayHours(): number {\n return TimeManagerSettings.maxDayHours\n }\n get defaultTimeSpent(): number {\n return TimeManagerSettings.defaultTimeSpent\n }\n get timeSlots(): ITimeStlot[] {\n return TimeManagerSettings.timeSlots\n }\n get weekLength(): number {\n return TimeManagerSettings.weekLength\n }\n get weekendStartDay(): number {\n return TimeManagerSettings.weekendStartDay\n }\n get weekDaysNames(): string[] {\n return TimeManagerSettings.weekDaysNames\n }\n\n /**\n * Get the current hour\n */\n get currentHour(): number {\n let data = storage.getVariable<TimeDataType>(TIME_DATA_KEY) || {}\n if (data.hasOwnProperty('currentHour') && typeof data.currentHour === 'number') {\n return data.currentHour\n }\n return this.minDayHours\n }\n set currentHour(value: number | undefined) {\n let data = storage.getVariable<TimeDataType>(TIME_DATA_KEY) || {}\n if (typeof value === 'number') {\n data.currentHour = value\n } else {\n delete data.currentHour\n }\n storage.setVariable(TIME_DATA_KEY, data)\n }\n /**\n * Get the current day\n */\n get currentDay(): number {\n let data = storage.getVariable<TimeDataType>(TIME_DATA_KEY) || {}\n if (data.hasOwnProperty('currentDay') && typeof data.currentDay === 'number') {\n return data.currentDay\n }\n return 0\n }\n set currentDay(value: number | undefined) {\n let data = storage.getVariable<TimeDataType>(TIME_DATA_KEY) || {}\n if (typeof value === 'number') {\n data.currentDay = value\n }\n else {\n delete data.currentDay\n }\n storage.setVariable(TIME_DATA_KEY, data)\n }\n /**\n * If the current day is greater than or equal to the weekend start day, then it will return true.\n */\n get isWeekend(): boolean {\n return this.currentWeekDayNumber >= this.weekendStartDay\n }\n /**\n * Get the current week day number (1 - {@link weekLength}).\n * For example, if the week length is 7 and the current day is 10, then the result will be 4.\n */\n get currentWeekDayNumber(): number {\n let result = this.currentDay % this.weekLength\n return result + 1\n }\n /**\n * Get the current week day name. If the week days names are not defined, then it will return undefined.\n * For example, if the week days names are ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'] and the current day is 10, then the result will be 'Thursday'.\n * @default \"\"\n */\n get currentDayName(): string {\n let weekDayNumber = this.currentWeekDayNumber - 1\n if (weekDayNumber >= this.weekDaysNames.length) {\n console.warn(`[NQTR] Week day name is not defined for day ${weekDayNumber}`, this.weekDaysNames)\n return \"\"\n }\n return this.weekDaysNames[weekDayNumber]\n }\n /**\n * Get the current {@link timeSlots} index.\n * You can use this property to create \"Image that changes based on the time period\":\n * @example\n * ```tsx\n * import { weekLength } from '@drincs/nqtr';\n * \n * function changeBackground() {\n * return (\n * <img src={`background-currentTimeSlot.currentTimeSlot.png`} />\n * )\n * }\n */\n get currentTimeSlot(): number {\n if (this.timeSlots.length === 0) {\n console.warn('[NQTR] Time slots are not defined')\n return 0\n }\n for (let index = 0; index < this.timeSlots.length; index++) {\n let slot = this.timeSlots[index]\n if (this.timeSlots.length > index + 1) {\n if (this.nowIsBetween(slot.startHour, this.timeSlots[index + 1].startHour)) {\n return index\n }\n }\n }\n return this.timeSlots.length - 1\n }\n\n /**\n * This function will increase the current hour by the given time spent.\n * If the new hour is greater than or equal to the max day hours, then it will increase the day and set the new hour.\n * @param timeSpent is the time spent in hours (default: {@link defaultTimeSpent})\n * @returns currentTimeSlot.currentHour\n */\n increaseHour(timeSpent: number = this.defaultTimeSpent): number {\n let newHour = this.currentHour + timeSpent\n if (newHour >= this.maxDayHours) {\n this.increaseDay()\n newHour = this.minDayHours + (newHour - this.maxDayHours)\n }\n this.currentHour = newHour\n return this.currentHour\n }\n\n /**\n * This function will increase the current day by the given days.\n * @param newDayHour is the hour of the new day (default: {@link minDayHours})\n * @param days is the number of days to increase (default: 1)\n * @returns timeTracker.currentDay\n */\n increaseDay(newDayHour: number = this.minDayHours, days: number = 1): number {\n let newDay = this.currentDay + days\n this.currentDay = newDay\n this.currentHour = newDayHour\n return this.currentDay\n }\n\n /**\n * This function will check if the current hour is between the given hours.\n * @param fromHour the starting hour. If the {@link currentHour} is equal to this hour, the function will return true.\n * @param toHour the ending hour.\n * @returns true if the current hour is between the given hours, otherwise false.\n */\n nowIsBetween(fromHour: number | undefined, toHour: number | undefined): boolean {\n if (fromHour === undefined) {\n fromHour = this.minDayHours\n }\n if (toHour === undefined) {\n toHour = this.maxDayHours\n }\n let currentHour = this.currentHour\n if (fromHour < toHour) {\n return currentHour >= fromHour && currentHour < toHour\n }\n return currentHour >= fromHour || currentHour < toHour\n }\n}\n"]}
@@ -1,2 +0,0 @@
1
- import {storage}from'@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=storage.getVariable(a)||{};return e.hasOwnProperty("currentHour")&&typeof e.currentHour=="number"?e.currentHour:this.minDayHours}set currentHour(e){let t=storage.getVariable(a)||{};typeof e=="number"?t.currentHour=e:delete t.currentHour,storage.setVariable(a,t);}get currentDay(){let e=storage.getVariable(a)||{};return e.hasOwnProperty("currentDay")&&typeof e.currentDay=="number"?e.currentDay:0}set currentDay(e){let t=storage.getVariable(a)||{};typeof e=="number"?t.currentDay=e:delete t.currentDay,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}};export{u as default};//# sourceMappingURL=TimeManager.mjs.map
2
- //# sourceMappingURL=TimeManager.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/constants.ts","../../src/managers/TimeManagerSettings.ts","../../src/managers/TimeManager.ts"],"names":["TIME_DATA_KEY","TimeManagerSettings","TimeManager","settings","minDayHours","maxDayHours","defaultTimeSpent","timeSlots","weekLength","weekendStartDay","weekDaysNames","data","storage","value","weekDayNumber","index","slot","timeSpent","newHour","newDayHour","days","newDay","fromHour","toHour","currentHour"],"mappings":"sCACO,IAAMA,EAAgB,8BCC7B,CAAA,IAAqBC,CAArB,CAAA,KAAiE,CAC7D,OAAO,YAAsB,CAC7B,CAAA,OAAO,WAAsB,CAAA,EAAA,CAC7B,OAAO,gBAAA,CAA2B,EAClC,OAAO,SAAA,CAA0B,EAAC,CAClC,OAAO,UAAA,CAAqB,EAC5B,OAAO,eAAA,CAA0B,IAAK,CAAA,UAAA,CAAa,CACnD,CAAA,OAAO,cAA0B,EACrC,CCJA,CAAA,IAAqBC,CAArB,CAAA,KAAiC,CA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,CACzE,IAAIC,CAAS,CAAA,IAAA,CAAK,WAAaD,CAC/B,CAAA,OAAA,IAAA,CAAK,UAAaC,CAAAA,CAAAA,CAClB,IAAK,CAAA,WAAA,CAAcF,EACZ,IAAK,CAAA,UAChB,CAQA,YAAA,CAAaG,CAA8BC,CAAAA,CAAAA,CAAqC,CACxED,CAAa,GAAA,SAAA,GACbA,CAAW,CAAA,IAAA,CAAK,WAEhBC,CAAAA,CAAAA,CAAAA,GAAW,YACXA,CAAS,CAAA,IAAA,CAAK,WAElB,CAAA,CAAA,IAAIC,CAAc,CAAA,IAAA,CAAK,YACvB,OAAIF,CAAAA,CAAWC,CACJC,CAAAA,CAAAA,EAAeF,CAAYE,EAAAA,CAAAA,CAAcD,EAE7CC,CAAeF,EAAAA,CAAAA,EAAYE,CAAcD,CAAAA,CACpD,CACJ","file":"TimeManager.mjs","sourcesContent":["export const TIME_SETTINGS_KEY = '___nqtr-time_manager_settings___';\nexport const TIME_DATA_KEY = '___nqtr-time_manager_data___';\n\n","import { ITimeStlot, TimeSettings } from \"../types/TimeSettings\";\n\nexport default class TimeManagerSettings implements TimeSettings {\n static minDayHours: number = 0\n static maxDayHours: number = 24\n static defaultTimeSpent: number = 1\n static timeSlots: ITimeStlot[] = []\n static weekLength: number = 7\n static weekendStartDay: number = this.weekLength - 1\n static weekDaysNames: string[] = []\n}\n","import { storage } from \"@drincs/pixi-vn\";\nimport { TIME_DATA_KEY } from \"../constants\";\nimport TimeDataType from \"../types/TimeDataType\";\nimport { ITimeStlot, TimeSettings } from \"../types/TimeSettings\";\nimport TimeManagerSettings from \"./TimeManagerSettings\";\n\nexport default class TimeManager {\n initialize(settings: TimeSettings) {\n const {\n minDayHours = 0,\n maxDayHours = 24,\n defaultTimeSpent = 1,\n timeSlots = [],\n weekLength = 7,\n weekendStartDay = weekLength - 1,\n weekDaysNames = [],\n } = settings\n TimeManagerSettings.minDayHours = minDayHours\n TimeManagerSettings.maxDayHours = maxDayHours\n TimeManagerSettings.defaultTimeSpent = defaultTimeSpent\n TimeManagerSettings.timeSlots = timeSlots\n TimeManagerSettings.weekLength = weekLength\n if (weekendStartDay >= TimeManagerSettings.weekLength) {\n console.warn(`[NQTR] Weekend start day should be less than week length ${weekLength}, so will be ignored`)\n }\n else {\n TimeManagerSettings.weekendStartDay = weekendStartDay\n }\n if (weekDaysNames.length !== weekLength) {\n console.warn(`[NQTR] Week days names should be equal to week length ${weekLength}, so will be ignored`)\n }\n else {\n TimeManagerSettings.weekDaysNames = weekDaysNames\n }\n }\n get minDayHours(): number {\n return TimeManagerSettings.minDayHours\n }\n get maxDayHours(): number {\n return TimeManagerSettings.maxDayHours\n }\n get defaultTimeSpent(): number {\n return TimeManagerSettings.defaultTimeSpent\n }\n get timeSlots(): ITimeStlot[] {\n return TimeManagerSettings.timeSlots\n }\n get weekLength(): number {\n return TimeManagerSettings.weekLength\n }\n get weekendStartDay(): number {\n return TimeManagerSettings.weekendStartDay\n }\n get weekDaysNames(): string[] {\n return TimeManagerSettings.weekDaysNames\n }\n\n /**\n * Get the current hour\n */\n get currentHour(): number {\n let data = storage.getVariable<TimeDataType>(TIME_DATA_KEY) || {}\n if (data.hasOwnProperty('currentHour') && typeof data.currentHour === 'number') {\n return data.currentHour\n }\n return this.minDayHours\n }\n set currentHour(value: number | undefined) {\n let data = storage.getVariable<TimeDataType>(TIME_DATA_KEY) || {}\n if (typeof value === 'number') {\n data.currentHour = value\n } else {\n delete data.currentHour\n }\n storage.setVariable(TIME_DATA_KEY, data)\n }\n /**\n * Get the current day\n */\n get currentDay(): number {\n let data = storage.getVariable<TimeDataType>(TIME_DATA_KEY) || {}\n if (data.hasOwnProperty('currentDay') && typeof data.currentDay === 'number') {\n return data.currentDay\n }\n return 0\n }\n set currentDay(value: number | undefined) {\n let data = storage.getVariable<TimeDataType>(TIME_DATA_KEY) || {}\n if (typeof value === 'number') {\n data.currentDay = value\n }\n else {\n delete data.currentDay\n }\n storage.setVariable(TIME_DATA_KEY, data)\n }\n /**\n * If the current day is greater than or equal to the weekend start day, then it will return true.\n */\n get isWeekend(): boolean {\n return this.currentWeekDayNumber >= this.weekendStartDay\n }\n /**\n * Get the current week day number (1 - {@link weekLength}).\n * For example, if the week length is 7 and the current day is 10, then the result will be 4.\n */\n get currentWeekDayNumber(): number {\n let result = this.currentDay % this.weekLength\n return result + 1\n }\n /**\n * Get the current week day name. If the week days names are not defined, then it will return undefined.\n * For example, if the week days names are ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'] and the current day is 10, then the result will be 'Thursday'.\n * @default \"\"\n */\n get currentDayName(): string {\n let weekDayNumber = this.currentWeekDayNumber - 1\n if (weekDayNumber >= this.weekDaysNames.length) {\n console.warn(`[NQTR] Week day name is not defined for day ${weekDayNumber}`, this.weekDaysNames)\n return \"\"\n }\n return this.weekDaysNames[weekDayNumber]\n }\n /**\n * Get the current {@link timeSlots} index.\n * You can use this property to create \"Image that changes based on the time period\":\n * @example\n * ```tsx\n * import { weekLength } from '@drincs/nqtr';\n * \n * function changeBackground() {\n * return (\n * <img src={`background-currentTimeSlot.currentTimeSlot.png`} />\n * )\n * }\n */\n get currentTimeSlot(): number {\n if (this.timeSlots.length === 0) {\n console.warn('[NQTR] Time slots are not defined')\n return 0\n }\n for (let index = 0; index < this.timeSlots.length; index++) {\n let slot = this.timeSlots[index]\n if (this.timeSlots.length > index + 1) {\n if (this.nowIsBetween(slot.startHour, this.timeSlots[index + 1].startHour)) {\n return index\n }\n }\n }\n return this.timeSlots.length - 1\n }\n\n /**\n * This function will increase the current hour by the given time spent.\n * If the new hour is greater than or equal to the max day hours, then it will increase the day and set the new hour.\n * @param timeSpent is the time spent in hours (default: {@link defaultTimeSpent})\n * @returns currentTimeSlot.currentHour\n */\n increaseHour(timeSpent: number = this.defaultTimeSpent): number {\n let newHour = this.currentHour + timeSpent\n if (newHour >= this.maxDayHours) {\n this.increaseDay()\n newHour = this.minDayHours + (newHour - this.maxDayHours)\n }\n this.currentHour = newHour\n return this.currentHour\n }\n\n /**\n * This function will increase the current day by the given days.\n * @param newDayHour is the hour of the new day (default: {@link minDayHours})\n * @param days is the number of days to increase (default: 1)\n * @returns timeTracker.currentDay\n */\n increaseDay(newDayHour: number = this.minDayHours, days: number = 1): number {\n let newDay = this.currentDay + days\n this.currentDay = newDay\n this.currentHour = newDayHour\n return this.currentDay\n }\n\n /**\n * This function will check if the current hour is between the given hours.\n * @param fromHour the starting hour. If the {@link currentHour} is equal to this hour, the function will return true.\n * @param toHour the ending hour.\n * @returns true if the current hour is between the given hours, otherwise false.\n */\n nowIsBetween(fromHour: number | undefined, toHour: number | undefined): boolean {\n if (fromHour === undefined) {\n fromHour = this.minDayHours\n }\n if (toHour === undefined) {\n toHour = this.maxDayHours\n }\n let currentHour = this.currentHour\n if (fromHour < toHour) {\n return currentHour >= fromHour && currentHour < toHour\n }\n return currentHour >= fromHour || currentHour < toHour\n }\n}\n"]}
@@ -1,13 +0,0 @@
1
- import { TimeSettings, ITimeStlot } from '../types/TimeSettings.mjs';
2
-
3
- declare class TimeManagerSettings implements TimeSettings {
4
- static minDayHours: number;
5
- static maxDayHours: number;
6
- static defaultTimeSpent: number;
7
- static timeSlots: ITimeStlot[];
8
- static weekLength: number;
9
- static weekendStartDay: number;
10
- static weekDaysNames: string[];
11
- }
12
-
13
- export { TimeManagerSettings as default };
@@ -1,13 +0,0 @@
1
- import { TimeSettings, ITimeStlot } from '../types/TimeSettings.js';
2
-
3
- declare class TimeManagerSettings implements TimeSettings {
4
- static minDayHours: number;
5
- static maxDayHours: number;
6
- static defaultTimeSpent: number;
7
- static timeSlots: ITimeStlot[];
8
- static weekLength: number;
9
- static weekendStartDay: number;
10
- static weekDaysNames: string[];
11
- }
12
-
13
- export { TimeManagerSettings as default };
@@ -1,2 +0,0 @@
1
- 'use strict';var t=class{static minDayHours=0;static maxDayHours=24;static defaultTimeSpent=1;static timeSlots=[];static weekLength=7;static weekendStartDay=this.weekLength-1;static weekDaysNames=[]};module.exports=t;//# sourceMappingURL=TimeManagerSettings.js.map
2
- //# sourceMappingURL=TimeManagerSettings.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/managers/TimeManagerSettings.ts"],"names":["TimeManagerSettings"],"mappings":"aAEqBA,IAAAA,CAAAA,CAArB,KAAiE,CAC7D,OAAO,WAAA,CAAsB,CAC7B,CAAA,OAAO,WAAsB,CAAA,EAAA,CAC7B,OAAO,gBAAA,CAA2B,CAClC,CAAA,OAAO,SAA0B,CAAA,EACjC,CAAA,OAAO,UAAqB,CAAA,CAAA,CAC5B,OAAO,eAAA,CAA0B,IAAK,CAAA,UAAA,CAAa,CACnD,CAAA,OAAO,aAA0B,CAAA,EACrC","file":"TimeManagerSettings.js","sourcesContent":["import { ITimeStlot, TimeSettings } from \"../types/TimeSettings\";\n\nexport default class TimeManagerSettings implements TimeSettings {\n static minDayHours: number = 0\n static maxDayHours: number = 24\n static defaultTimeSpent: number = 1\n static timeSlots: ITimeStlot[] = []\n static weekLength: number = 7\n static weekendStartDay: number = this.weekLength - 1\n static weekDaysNames: string[] = []\n}\n"]}
@@ -1,2 +0,0 @@
1
- var t=class{static minDayHours=0;static maxDayHours=24;static defaultTimeSpent=1;static timeSlots=[];static weekLength=7;static weekendStartDay=this.weekLength-1;static weekDaysNames=[]};export{t as default};//# sourceMappingURL=TimeManagerSettings.mjs.map
2
- //# sourceMappingURL=TimeManagerSettings.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/managers/TimeManagerSettings.ts"],"names":["TimeManagerSettings"],"mappings":"AAEqBA,IAAAA,CAAAA,CAArB,KAAiE,CAC7D,OAAO,WAAA,CAAsB,CAC7B,CAAA,OAAO,WAAsB,CAAA,EAAA,CAC7B,OAAO,gBAAA,CAA2B,CAClC,CAAA,OAAO,SAA0B,CAAA,EACjC,CAAA,OAAO,UAAqB,CAAA,CAAA,CAC5B,OAAO,eAAA,CAA0B,IAAK,CAAA,UAAA,CAAa,CACnD,CAAA,OAAO,aAA0B,CAAA,EACrC","file":"TimeManagerSettings.mjs","sourcesContent":["import { ITimeStlot, TimeSettings } from \"../types/TimeSettings\";\n\nexport default class TimeManagerSettings implements TimeSettings {\n static minDayHours: number = 0\n static maxDayHours: number = 24\n static defaultTimeSpent: number = 1\n static timeSlots: ITimeStlot[] = []\n static weekLength: number = 7\n static weekendStartDay: number = this.weekLength - 1\n static weekDaysNames: string[] = []\n}\n"]}
@@ -1,2 +0,0 @@
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 g={};function Q(i){try{let e=g[i];if(!e){console.error(`[NQTR] Quest ${i} not found`);return}return e}catch(e){console.error(`[NQTR] Error while getting Quest ${i}`,e);return}}var f=class{get quests(){return Object.values(g)}get startedQuests(){return this.quests.filter(e=>e.started)}get completedQuests(){return this.quests.filter(e=>e.completed)}get failedQuests(){return this.quests.filter(e=>e.failed)}get notStartedQuests(){return this.quests.filter(e=>!e.started)}find(e){return Q(e)}startsStageMustBeStarted(e){Object.values(g).forEach(t=>{t.currentStageMustStart&&t.startCurrentStage(e);});}};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___",l=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});}};var a="___nqtr-time_manager_data___";var n=class{static minDayHours=0;static maxDayHours=24;static defaultTimeSpent=1;static timeSlots=[];static weekLength=7;static weekendStartDay=this.weekLength-1;static weekDaysNames=[]};var d=class{initialize(e){let{minDayHours:t=0,maxDayHours:r=24,defaultTimeSpent:o=1,timeSlots:x=[],weekLength:u=7,weekendStartDay:T=u-1,weekDaysNames:w=[]}=e;n.minDayHours=t,n.maxDayHours=r,n.defaultTimeSpent=o,n.timeSlots=x,n.weekLength=u,T>=n.weekLength?console.warn(`[NQTR] Weekend start day should be less than week length ${u}, so will be ignored`):n.weekendStartDay=T,w.length!==u?console.warn(`[NQTR] Week days names should be equal to week length ${u}, so will be ignored`):n.weekDaysNames=w;}get minDayHours(){return n.minDayHours}get maxDayHours(){return n.maxDayHours}get defaultTimeSpent(){return n.defaultTimeSpent}get timeSlots(){return n.timeSlots}get weekLength(){return n.weekLength}get weekendStartDay(){return n.weekendStartDay}get weekDaysNames(){return n.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 r=this.currentDay+t;return this.currentDay=r,this.currentHour=e,this.currentDay}nowIsBetween(e,t){e===undefined&&(e=this.minDayHours),t===undefined&&(t=this.maxDayHours);let r=this.currentHour;return e<t?r>=e&&r<t:r>=e||r<t}};var J=new d,C=new c,X=new l,Z=new f;exports.navigator=C;exports.questsNotebook=Z;exports.routine=X;exports.timeTracker=J;//# sourceMappingURL=index.js.map
2
- //# sourceMappingURL=index.js.map