@drincs/nqtr 0.2.14 → 0.3.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 (103) hide show
  1. package/dist/{RoomInterface-BOE1uacE.d.mts → RoomInterface-C7Sg80EF.d.mts} +7 -6
  2. package/dist/{RoomInterface-BswqipsF.d.ts → RoomInterface-D7qXKwBI.d.ts} +7 -6
  3. package/dist/{StageInterface-DgeEtkqv.d.mts → StageInterface-DmLgfrk4.d.mts} +3 -3
  4. package/dist/{StageInterface-DgeEtkqv.d.ts → StageInterface-DmLgfrk4.d.ts} +3 -3
  5. package/dist/classes/CommitmentBaseModel.d.mts +1 -1
  6. package/dist/classes/CommitmentBaseModel.d.ts +1 -1
  7. package/dist/classes/CommitmentStoredClass.d.mts +2 -2
  8. package/dist/classes/CommitmentStoredClass.d.ts +2 -2
  9. package/dist/classes/index.d.mts +2 -2
  10. package/dist/classes/index.d.ts +2 -2
  11. package/dist/classes/index.js +1 -1
  12. package/dist/classes/index.js.map +1 -1
  13. package/dist/classes/index.mjs +1 -1
  14. package/dist/classes/index.mjs.map +1 -1
  15. package/dist/classes/navigation/LocationBaseModel.d.mts +2 -2
  16. package/dist/classes/navigation/LocationBaseModel.d.ts +2 -2
  17. package/dist/classes/navigation/LocationBaseModel.js +1 -1
  18. package/dist/classes/navigation/LocationBaseModel.js.map +1 -1
  19. package/dist/classes/navigation/LocationBaseModel.mjs +1 -1
  20. package/dist/classes/navigation/LocationBaseModel.mjs.map +1 -1
  21. package/dist/classes/navigation/LocationStoredClass.d.mts +2 -2
  22. package/dist/classes/navigation/LocationStoredClass.d.ts +2 -2
  23. package/dist/classes/navigation/LocationStoredClass.js +1 -1
  24. package/dist/classes/navigation/LocationStoredClass.js.map +1 -1
  25. package/dist/classes/navigation/LocationStoredClass.mjs +1 -1
  26. package/dist/classes/navigation/LocationStoredClass.mjs.map +1 -1
  27. package/dist/classes/navigation/MapBaseModel.d.mts +1 -1
  28. package/dist/classes/navigation/MapBaseModel.d.ts +1 -1
  29. package/dist/classes/navigation/MapStoredClass.d.mts +1 -1
  30. package/dist/classes/navigation/MapStoredClass.d.ts +1 -1
  31. package/dist/classes/navigation/RoomBaseModel.d.mts +2 -2
  32. package/dist/classes/navigation/RoomBaseModel.d.ts +2 -2
  33. package/dist/classes/navigation/RoomBaseModel.js.map +1 -1
  34. package/dist/classes/navigation/RoomBaseModel.mjs.map +1 -1
  35. package/dist/classes/navigation/RoomStoredClass.d.mts +2 -2
  36. package/dist/classes/navigation/RoomStoredClass.d.ts +2 -2
  37. package/dist/classes/navigation/RoomStoredClass.js.map +1 -1
  38. package/dist/classes/navigation/RoomStoredClass.mjs.map +1 -1
  39. package/dist/classes/quest/QuestBaseModel.d.mts +1 -1
  40. package/dist/classes/quest/QuestBaseModel.d.ts +1 -1
  41. package/dist/classes/quest/QuestBaseModel.js.map +1 -1
  42. package/dist/classes/quest/QuestBaseModel.mjs.map +1 -1
  43. package/dist/classes/quest/QuestStoredClass.d.mts +1 -1
  44. package/dist/classes/quest/QuestStoredClass.d.ts +1 -1
  45. package/dist/classes/quest/QuestStoredClass.js.map +1 -1
  46. package/dist/classes/quest/QuestStoredClass.mjs.map +1 -1
  47. package/dist/classes/quest/StageBaseModel.d.mts +1 -1
  48. package/dist/classes/quest/StageBaseModel.d.ts +1 -1
  49. package/dist/classes/quest/StageBaseModel.js +1 -1
  50. package/dist/classes/quest/StageBaseModel.js.map +1 -1
  51. package/dist/classes/quest/StageBaseModel.mjs +1 -1
  52. package/dist/classes/quest/StageBaseModel.mjs.map +1 -1
  53. package/dist/classes/quest/StageStoredClass.d.mts +1 -1
  54. package/dist/classes/quest/StageStoredClass.d.ts +1 -1
  55. package/dist/classes/quest/StageStoredClass.js.map +1 -1
  56. package/dist/classes/quest/StageStoredClass.mjs.map +1 -1
  57. package/dist/decorators/CommitmentDecorator.d.mts +2 -2
  58. package/dist/decorators/CommitmentDecorator.d.ts +2 -2
  59. package/dist/decorators/QuestDecorator.d.mts +1 -1
  60. package/dist/decorators/QuestDecorator.d.ts +1 -1
  61. package/dist/decorators/RoomDecorator.d.mts +2 -2
  62. package/dist/decorators/RoomDecorator.d.ts +2 -2
  63. package/dist/decorators/index.d.mts +2 -2
  64. package/dist/decorators/index.d.ts +2 -2
  65. package/dist/index.d.mts +2 -2
  66. package/dist/index.d.ts +2 -2
  67. package/dist/index.js.map +1 -1
  68. package/dist/index.mjs.map +1 -1
  69. package/dist/interface/ActivityInterface.d.mts +2 -2
  70. package/dist/interface/ActivityInterface.d.ts +2 -2
  71. package/dist/interface/CommitmentInterface.d.mts +2 -2
  72. package/dist/interface/CommitmentInterface.d.ts +2 -2
  73. package/dist/interface/CommitmentProps.d.mts +2 -2
  74. package/dist/interface/CommitmentProps.d.ts +2 -2
  75. package/dist/interface/index.d.mts +2 -2
  76. package/dist/interface/index.d.ts +2 -2
  77. package/dist/interface/navigation/LocationInterface.d.mts +2 -2
  78. package/dist/interface/navigation/LocationInterface.d.ts +2 -2
  79. package/dist/interface/navigation/MapInterface.d.mts +2 -2
  80. package/dist/interface/navigation/MapInterface.d.ts +2 -2
  81. package/dist/interface/navigation/RoomInterface.d.mts +2 -2
  82. package/dist/interface/navigation/RoomInterface.d.ts +2 -2
  83. package/dist/interface/quest/QuestInterface.d.mts +1 -1
  84. package/dist/interface/quest/QuestInterface.d.ts +1 -1
  85. package/dist/interface/quest/QuestProps.d.mts +1 -1
  86. package/dist/interface/quest/QuestProps.d.ts +1 -1
  87. package/dist/interface/quest/StageInterface.d.mts +1 -1
  88. package/dist/interface/quest/StageInterface.d.ts +1 -1
  89. package/dist/interface/quest/StageProps.d.mts +1 -1
  90. package/dist/interface/quest/StageProps.d.ts +1 -1
  91. package/dist/managers/NavigatorManager.d.mts +2 -2
  92. package/dist/managers/NavigatorManager.d.ts +2 -2
  93. package/dist/managers/QuestManager.d.mts +1 -1
  94. package/dist/managers/QuestManager.d.ts +1 -1
  95. package/dist/managers/RoutineManager.d.mts +2 -2
  96. package/dist/managers/RoutineManager.d.ts +2 -2
  97. package/dist/managers/index.d.mts +3 -3
  98. package/dist/managers/index.d.ts +3 -3
  99. package/dist/types/QuestsRequired.d.mts +1 -1
  100. package/dist/types/QuestsRequired.d.ts +1 -1
  101. package/dist/types/index.d.mts +1 -1
  102. package/dist/types/index.d.ts +1 -1
  103. package/package.json +2 -2
@@ -1,9 +1,10 @@
1
+ import { CommitmentInterface, LocationInterface, MapInterface } from '@drincs/nqtr/dist/override';
1
2
  import { CharacterInterface } from '@drincs/pixi-vn';
2
3
  import { ActivityBaseInternalInterface } from './interface/ActivityInterface.mjs';
3
4
  import ExecutionType from './types/ExecutionType.mjs';
4
5
  import NavigationAbstractInterface from './interface/navigation/NavigationAbstractClass.mjs';
5
6
 
6
- interface CommitmentBaseInterface extends CommitmentBaseInternalInterface {
7
+ interface CommitmentBaseInterface extends CommitmentBaseInternalInterface, CommitmentInterface {
7
8
  }
8
9
  interface CommitmentBaseInternalInterface extends ActivityBaseInternalInterface {
9
10
  /**
@@ -26,9 +27,9 @@ interface CommitmentBaseInternalInterface extends ActivityBaseInternalInterface
26
27
  priority: number;
27
28
  }
28
29
 
29
- interface LocationBaseInterface extends LocationBaseInternalInterface {
30
+ interface LocationBaseInterface extends LocationInternalInterface, LocationInterface {
30
31
  }
31
- interface LocationBaseInternalInterface extends NavigationAbstractInterface {
32
+ interface LocationInternalInterface extends NavigationAbstractInterface {
32
33
  /**
33
34
  * The id of the location.
34
35
  */
@@ -44,7 +45,7 @@ interface LocationBaseInternalInterface extends NavigationAbstractInterface {
44
45
  readonly rooms: RoomBaseInterface[];
45
46
  }
46
47
 
47
- interface MapBaseInterface extends MapBaseInternalInterface {
48
+ interface MapBaseInterface extends MapBaseInternalInterface, MapInterface {
48
49
  }
49
50
  interface MapBaseInternalInterface extends NavigationAbstractInterface {
50
51
  /**
@@ -58,7 +59,7 @@ interface MapBaseInternalInterface extends NavigationAbstractInterface {
58
59
  readonly locations: LocationBaseInterface[];
59
60
  }
60
61
 
61
- interface RoomBaseInterface extends RoomBaseInternalInterface {
62
+ interface RoomBaseInterface extends RoomBaseInternalInterface, LocationInterface {
62
63
  }
63
64
  interface RoomBaseInternalInterface extends NavigationAbstractInterface {
64
65
  /**
@@ -75,4 +76,4 @@ interface RoomBaseInternalInterface extends NavigationAbstractInterface {
75
76
  readonly routine: CommitmentBaseInterface[];
76
77
  }
77
78
 
78
- export type { CommitmentBaseInterface as C, LocationBaseInterface as L, MapBaseInterface as M, RoomBaseInterface as R, CommitmentBaseInternalInterface as a, MapBaseInternalInterface as b, LocationBaseInternalInterface as c, RoomBaseInternalInterface as d };
79
+ export type { CommitmentBaseInterface as C, LocationBaseInterface as L, MapBaseInterface as M, RoomBaseInterface as R, CommitmentBaseInternalInterface as a, LocationInternalInterface as b, MapBaseInternalInterface as c, RoomBaseInternalInterface as d };
@@ -1,9 +1,10 @@
1
+ import { CommitmentInterface, LocationInterface, MapInterface } from '@drincs/nqtr/dist/override';
1
2
  import { CharacterInterface } from '@drincs/pixi-vn';
2
3
  import { ActivityBaseInternalInterface } from './interface/ActivityInterface.js';
3
4
  import ExecutionType from './types/ExecutionType.js';
4
5
  import NavigationAbstractInterface from './interface/navigation/NavigationAbstractClass.js';
5
6
 
6
- interface CommitmentBaseInterface extends CommitmentBaseInternalInterface {
7
+ interface CommitmentBaseInterface extends CommitmentBaseInternalInterface, CommitmentInterface {
7
8
  }
8
9
  interface CommitmentBaseInternalInterface extends ActivityBaseInternalInterface {
9
10
  /**
@@ -26,9 +27,9 @@ interface CommitmentBaseInternalInterface extends ActivityBaseInternalInterface
26
27
  priority: number;
27
28
  }
28
29
 
29
- interface LocationBaseInterface extends LocationBaseInternalInterface {
30
+ interface LocationBaseInterface extends LocationInternalInterface, LocationInterface {
30
31
  }
31
- interface LocationBaseInternalInterface extends NavigationAbstractInterface {
32
+ interface LocationInternalInterface extends NavigationAbstractInterface {
32
33
  /**
33
34
  * The id of the location.
34
35
  */
@@ -44,7 +45,7 @@ interface LocationBaseInternalInterface extends NavigationAbstractInterface {
44
45
  readonly rooms: RoomBaseInterface[];
45
46
  }
46
47
 
47
- interface MapBaseInterface extends MapBaseInternalInterface {
48
+ interface MapBaseInterface extends MapBaseInternalInterface, MapInterface {
48
49
  }
49
50
  interface MapBaseInternalInterface extends NavigationAbstractInterface {
50
51
  /**
@@ -58,7 +59,7 @@ interface MapBaseInternalInterface extends NavigationAbstractInterface {
58
59
  readonly locations: LocationBaseInterface[];
59
60
  }
60
61
 
61
- interface RoomBaseInterface extends RoomBaseInternalInterface {
62
+ interface RoomBaseInterface extends RoomBaseInternalInterface, LocationInterface {
62
63
  }
63
64
  interface RoomBaseInternalInterface extends NavigationAbstractInterface {
64
65
  /**
@@ -75,4 +76,4 @@ interface RoomBaseInternalInterface extends NavigationAbstractInterface {
75
76
  readonly routine: CommitmentBaseInterface[];
76
77
  }
77
78
 
78
- export type { CommitmentBaseInterface as C, LocationBaseInterface as L, MapBaseInterface as M, RoomBaseInterface as R, CommitmentBaseInternalInterface as a, MapBaseInternalInterface as b, LocationBaseInternalInterface as c, RoomBaseInternalInterface as d };
79
+ export type { CommitmentBaseInterface as C, LocationBaseInterface as L, MapBaseInterface as M, RoomBaseInterface as R, CommitmentBaseInternalInterface as a, LocationInternalInterface as b, MapBaseInternalInterface as c, RoomBaseInternalInterface as d };
@@ -1,11 +1,11 @@
1
- import { OnStartEndStageQuest } from '@drincs/nqtr/dist/override';
1
+ import { QuestInterface, OnStartEndStageQuest, StageInterface } from '@drincs/nqtr/dist/override';
2
2
 
3
3
  type QuestsRequiredType = {
4
4
  quest: QuestBaseInterface;
5
5
  stageNumber: number;
6
6
  };
7
7
 
8
- interface QuestBaseInterface extends QuestBaseInternalInterface {
8
+ interface QuestBaseInterface extends QuestBaseInternalInterface, QuestInterface {
9
9
  }
10
10
  interface QuestBaseInternalInterface {
11
11
  /**
@@ -82,7 +82,7 @@ interface QuestBaseInternalInterface {
82
82
  startCurrentStage(props: OnStartEndStageQuest): void;
83
83
  }
84
84
 
85
- interface StageBaseInterface extends StageBaseInternalInterface {
85
+ interface StageBaseInterface extends StageBaseInternalInterface, StageInterface {
86
86
  }
87
87
  interface StageBaseInternalInterface {
88
88
  /**
@@ -1,11 +1,11 @@
1
- import { OnStartEndStageQuest } from '@drincs/nqtr/dist/override';
1
+ import { QuestInterface, OnStartEndStageQuest, StageInterface } from '@drincs/nqtr/dist/override';
2
2
 
3
3
  type QuestsRequiredType = {
4
4
  quest: QuestBaseInterface;
5
5
  stageNumber: number;
6
6
  };
7
7
 
8
- interface QuestBaseInterface extends QuestBaseInternalInterface {
8
+ interface QuestBaseInterface extends QuestBaseInternalInterface, QuestInterface {
9
9
  }
10
10
  interface QuestBaseInternalInterface {
11
11
  /**
@@ -82,7 +82,7 @@ interface QuestBaseInternalInterface {
82
82
  startCurrentStage(props: OnStartEndStageQuest): void;
83
83
  }
84
84
 
85
- interface StageBaseInterface extends StageBaseInternalInterface {
85
+ interface StageBaseInterface extends StageBaseInternalInterface, StageInterface {
86
86
  }
87
87
  interface StageBaseInternalInterface {
88
88
  /**
@@ -1,6 +1,6 @@
1
1
  import { CharacterInterface } from '@drincs/pixi-vn';
2
2
  import CommitmentProps from '../interface/CommitmentProps.mjs';
3
- import { R as RoomBaseInterface } from '../RoomInterface-BOE1uacE.mjs';
3
+ import { R as RoomBaseInterface } from '../RoomInterface-C7Sg80EF.mjs';
4
4
  import CommitmentStoredClass from './CommitmentStoredClass.mjs';
5
5
  import '../types/ExecutionType.mjs';
6
6
  import '../types/OnRunEvent.mjs';
@@ -1,6 +1,6 @@
1
1
  import { CharacterInterface } from '@drincs/pixi-vn';
2
2
  import CommitmentProps from '../interface/CommitmentProps.js';
3
- import { R as RoomBaseInterface } from '../RoomInterface-BswqipsF.js';
3
+ import { R as RoomBaseInterface } from '../RoomInterface-D7qXKwBI.js';
4
4
  import CommitmentStoredClass from './CommitmentStoredClass.js';
5
5
  import '../types/ExecutionType.js';
6
6
  import '../types/OnRunEvent.js';
@@ -1,10 +1,10 @@
1
1
  import { CharacterInterface } from '@drincs/pixi-vn';
2
- import { C as CommitmentBaseInterface, a as CommitmentBaseInternalInterface, R as RoomBaseInterface } from '../RoomInterface-BOE1uacE.mjs';
2
+ import { C as CommitmentBaseInterface, a as CommitmentBaseInternalInterface, R as RoomBaseInterface } from '../RoomInterface-C7Sg80EF.mjs';
3
3
  import ExecutionType from '../types/ExecutionType.mjs';
4
4
  import { OnRunEvent } from '../types/OnRunEvent.mjs';
5
5
  import ActivityStoredClass from './ActivityStoredClass.mjs';
6
- import '../interface/ActivityInterface.mjs';
7
6
  import '@drincs/nqtr/dist/override';
7
+ import '../interface/ActivityInterface.mjs';
8
8
  import '../interface/navigation/NavigationAbstractClass.mjs';
9
9
 
10
10
  declare class CommitmentStoredClass extends ActivityStoredClass<CommitmentBaseInterface> implements CommitmentBaseInternalInterface {
@@ -1,10 +1,10 @@
1
1
  import { CharacterInterface } from '@drincs/pixi-vn';
2
- import { C as CommitmentBaseInterface, a as CommitmentBaseInternalInterface, R as RoomBaseInterface } from '../RoomInterface-BswqipsF.js';
2
+ import { C as CommitmentBaseInterface, a as CommitmentBaseInternalInterface, R as RoomBaseInterface } from '../RoomInterface-D7qXKwBI.js';
3
3
  import ExecutionType from '../types/ExecutionType.js';
4
4
  import { OnRunEvent } from '../types/OnRunEvent.js';
5
5
  import ActivityStoredClass from './ActivityStoredClass.js';
6
- import '../interface/ActivityInterface.js';
7
6
  import '@drincs/nqtr/dist/override';
7
+ import '../interface/ActivityInterface.js';
8
8
  import '../interface/navigation/NavigationAbstractClass.js';
9
9
 
10
10
  declare class CommitmentStoredClass extends ActivityStoredClass<CommitmentBaseInterface> implements CommitmentBaseInternalInterface {
@@ -15,7 +15,7 @@ import '../interface/ActivityProps.mjs';
15
15
  import '../types/OnRunEvent.mjs';
16
16
  import '@drincs/pixi-vn';
17
17
  import '../interface/CommitmentProps.mjs';
18
- import '../RoomInterface-BOE1uacE.mjs';
18
+ import '../RoomInterface-C7Sg80EF.mjs';
19
19
  import '../types/ExecutionType.mjs';
20
20
  import '../interface/navigation/NavigationAbstractClass.mjs';
21
21
  import './CommitmentStoredClass.mjs';
@@ -24,7 +24,7 @@ import './navigation/NavigationAbstractClass.mjs';
24
24
  import '../interface/navigation/MapBaseModelProps.mjs';
25
25
  import '../interface/navigation/RoomBaseModelProps.mjs';
26
26
  import '../interface/quest/QuestProps.mjs';
27
- import '../StageInterface-DgeEtkqv.mjs';
27
+ import '../StageInterface-DmLgfrk4.mjs';
28
28
  import './quest/QuestStoredClass.mjs';
29
29
  import '../interface/quest/StageProps.mjs';
30
30
  import '../interface/quest/StageFlags.mjs';
@@ -15,7 +15,7 @@ import '../interface/ActivityProps.js';
15
15
  import '../types/OnRunEvent.js';
16
16
  import '@drincs/pixi-vn';
17
17
  import '../interface/CommitmentProps.js';
18
- import '../RoomInterface-BswqipsF.js';
18
+ import '../RoomInterface-D7qXKwBI.js';
19
19
  import '../types/ExecutionType.js';
20
20
  import '../interface/navigation/NavigationAbstractClass.js';
21
21
  import './CommitmentStoredClass.js';
@@ -24,7 +24,7 @@ import './navigation/NavigationAbstractClass.js';
24
24
  import '../interface/navigation/MapBaseModelProps.js';
25
25
  import '../interface/navigation/RoomBaseModelProps.js';
26
26
  import '../interface/quest/QuestProps.js';
27
- import '../StageInterface-DgeEtkqv.js';
27
+ import '../StageInterface-DmLgfrk4.js';
28
28
  import './quest/QuestStoredClass.js';
29
29
  import '../interface/quest/StageProps.js';
30
30
  import '../interface/quest/StageFlags.js';
@@ -1,2 +1,2 @@
1
- 'use strict';var pixiVn=require('@drincs/pixi-vn');var g={};function j(n){try{let e=g[n];if(!e){console.error(`[NQTR] Room ${n} not found`);return}return e}catch(e){console.error(`[NQTR] Error while getting Room ${n}`,e);return}}var G="___nqtr-current_room_memory___",b=class{get rooms(){return Object.values(g)}get locations(){let e={};return Object.values(g).forEach(t=>{e[t.location.id]=t.location;}),Object.values(e)}get maps(){let e={};return Object.values(g).forEach(t=>{e[t.location.map.id]=t.location.map;}),Object.values(e)}get currentRoom(){let e=pixiVn.storage.getVariable(G);if(!e){console.error("[NQTR] The current room has not yet been set");return}let t=j(e);if(!t){console.error(`[NQTR] Current room ${e} not found`);return}return t}set currentRoom(e){if(!j(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(G,e.id);}get currentLocation(){return this.currentRoom?.location}get currentMap(){return this.currentRoom?.location.map}clearExpiredActivities(){Object.entries(g).forEach(([e,t])=>{t.clearExpiredActivities();});}};var E={},Q={};function w(n){try{let e=E[n];if(!e){console.error(`[NQTR] Commitment ${n} not found`);return}return e}catch(e){console.error(`[NQTR] Error while getting Commitment ${n}`,e);return}}var C="___nqtr-temporary_commitment___",_=class{get fixedRoutine(){return Object.values(Q)}set fixedRoutine(e){e.forEach(t=>{Q[t.id]&&console.warn(`[NQTR] Commitment id ${t.id} already exists, it will be overwritten`),Q[t.id]=t;});}get temporaryRoutine(){let e=pixiVn.storage.getVariable(C);return e?e.map(r=>w(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(!w(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(C,t);}find(e){return w(e)}remove(e){Array.isArray(e)||(e=[e]);let t=e.map(i=>i.id),r=pixiVn.storage.getVariable(C);r&&(r=r.filter(i=>!t.includes(i)),pixiVn.storage.setVariable(C,r));}clearExpiredRoutine(){Object.values(E).forEach(e=>{e.expired&&delete E[e.id];});}get currentRoutine(){let e={};return [...this.temporaryRoutine,...this.fixedRoutine].reverse().forEach(t=>{t.isActive&&(t.characters.length>0?t.characters.every(i=>!e[i.id]||t.priority>e[i.id].priority)&&t.characters.forEach(i=>{e[i.id]=t;}):console.error(`[NQTR] The commitment ${t.id} has no characters assigned`));}),Object.values(e)}get currentRoomRoutine(){return h.currentRoom?.routine||[]}getCommitmentByCharacter(e){this.currentRoutine.forEach(t=>{if(t.characters.map(r=>r.id).includes(e.id))return t});}};var f="___nqtr-time_manager_data___";var u=class{static minDayHours=0;static maxDayHours=24;static defaultTimeSpent=1;static timeSlots=[];static weekLength=7;static weekendStartDay=this.weekLength-1;static weekDaysNames=[]};var x=class{initialize(e){let{minDayHours:t=0,maxDayHours:r=24,defaultTimeSpent:i=1,timeSlots:a=[],weekLength:o=7,weekendStartDay:s=o-1,weekDaysNames:c=[]}=e;u.minDayHours=t,u.maxDayHours=r,u.defaultTimeSpent=i,u.timeSlots=a,u.weekLength=o,s>=u.weekLength?console.warn(`[NQTR] Weekend start day should be less than week length ${o}, so will be ignored`):u.weekendStartDay=s,c.length!==o?console.warn(`[NQTR] Week days names should be equal to week length ${o}, so will be ignored`):u.weekDaysNames=c;}get minDayHours(){return u.minDayHours}get maxDayHours(){return u.maxDayHours}get defaultTimeSpent(){return u.defaultTimeSpent}get timeSlots(){return u.timeSlots}get weekLength(){return u.weekLength}get weekendStartDay(){return u.weekendStartDay}get weekDaysNames(){return u.weekDaysNames}get currentHour(){let e=pixiVn.storage.getVariable(f)||{};return e.hasOwnProperty("currentHour")&&typeof e.currentHour=="number"?e.currentHour:this.minDayHours}set currentHour(e){let t=pixiVn.storage.getVariable(f)||{};typeof e=="number"?t.currentHour=e:delete t.currentHour,pixiVn.storage.setVariable(f,t);}get currentDay(){let e=pixiVn.storage.getVariable(f)||{};return e.hasOwnProperty("currentDay")&&typeof e.currentDay=="number"?e.currentDay:0}set currentDay(e){let t=pixiVn.storage.getVariable(f)||{};typeof e=="number"?t.currentDay=e:delete t.currentDay,pixiVn.storage.setVariable(f,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 d=new x,h=new b,H=new _;var Z="__nqtr-activity__",m=class extends pixiVn.StoredClassModel{constructor(t,r,i,a=Z){super(a,t);this._onRun=r;this._fromHour=i.fromHour,this._toHour=i.toHour,this._fromDay=i.fromDay,this._toDay=i.toDay;}_fromHour;get fromHour(){return this._fromHour}_toHour;get toHour(){return this._toHour}_fromDay;get fromDay(){return this._fromDay}_toDay;get toDay(){return this._toDay}get run(){return t=>this._onRun(this,t)}get expired(){return !!(this.toDay&&this.toDay<=d.currentDay)}get isActive(){return !(this.fromDay&&this.fromDay>d.currentDay||this.toDay&&this.toDay<d.currentDay||!d.nowIsBetween(this.fromHour,this.toHour))}};var P=class extends m{constructor(e,t,r){super(e,t,{fromHour:r.fromHour,toHour:r.toHour,fromDay:r.fromDay,toDay:r.toDay}),this.defaultName=r.name||"",this.defaultDisabled=r.disabled||false,this.defaultHidden=r.hidden||false,this._icon=r.renderIcon;}defaultName;get name(){return this.getStorageProperty("name")||this.defaultName}set name(e){this.setStorageProperty("name",e);}defaultDisabled;get disabled(){let e=this.getStorageProperty("disabled")||this.defaultDisabled;return typeof e=="string"?pixiVn.getFlag(e):e}set disabled(e){this.setStorageProperty("disabled",e);}defaultHidden;get hidden(){let e=this.getStorageProperty("hidden")||this.defaultHidden;return typeof e=="string"?pixiVn.getFlag(e):e}set hidden(e){this.setStorageProperty("hidden",e);}_icon;get icon(){return this._icon}};var ee="__nqtr-commitment__",T=class extends m{constructor(t,r,i,a,o,s,c){s=s||(()=>{});super(t,s,c,ee);this._characters=r;this._room=i;this.defaultExecutionType=a;this.defaultPriority=o;}get characters(){return this._characters}get room(){return this._room}get executionType(){return this.getStorageProperty("executionType")||this.defaultExecutionType}set executionType(t){this.setStorageProperty("executionType",t);}get priority(){return this.getStorageProperty("priority")||this.defaultPriority||0}set priority(t){this.setStorageProperty("priority",t);}};var O=class extends T{constructor(e,t,r,i){super(e,t?Array.isArray(t)?t:[t]:[],r,i.executionType||"interaction",i.priority||0,i.onRun,{fromHour:i.fromHour,toHour:i.toHour,fromDay:i.fromDay,toDay:i.toDay}),this._name=i.name||"",this._image=i.image,this.defaultDisabled=i.disabled||false,this.defaultHidden=i.hidden||false,this._icon=i.icon;}_name;get name(){return this._name}_image;get image(){return this._image}_icon;get icon(){return this._icon}defaultDisabled;get disabled(){let e=this.getStorageProperty("disabled")||this.defaultDisabled;return typeof e=="string"?pixiVn.getFlag(e):e}set disabled(e){this.setStorageProperty("disabled",e);}defaultHidden;get hidden(){if(this.fromDay&&this.fromDay>d.currentDay||!d.nowIsBetween(this.fromHour,this.toHour)||!this.expired)return true;let e=this.getStorageProperty("hidden")||this.defaultHidden;return typeof e=="string"?pixiVn.getFlag(e):e}set hidden(e){this.setStorageProperty("hidden",e);}};var te={};function q(n){try{let e=te[n];if(!e){console.error(`[NQTR] Activity ${n} not found`);return}return e}catch(e){console.error(`[NQTR] Error while getting Activity ${n}`,e);return}}var l=class extends pixiVn.StoredClassModel{constructor(t,r,i=[]){super(t,r);this.defaultActivities=i;}get defaultActivitiesIds(){return this.defaultActivities.map(t=>t.id)}get activeActivityScheduling(){return this.getStorageProperty("activeActivityScheduling")||{}}get excludedActivitiesScheduling(){return this.getStorageProperty("excludedActivitiesScheduling")||{}}removeActivityScheduling(t){let r=this.activeActivityScheduling;delete r[t],this.setStorageProperty("activeActivityScheduling",r);let i=this.excludedActivitiesScheduling;delete i[t],this.setStorageProperty("excludedActivitiesScheduling",i);}editActivityScheduling(t,r){this.removeActivityScheduling(t);let i=this.activeActivityScheduling;i[t]=r,this.setStorageProperty("activeActivityScheduling",i);}editExcludedActivityScheduling(t,r){this.removeActivityScheduling(t);let i=this.excludedActivitiesScheduling;i[t]=r,this.setStorageProperty("excludedActivitiesScheduling",i);}get additionalActivitiesIds(){return this.getStorageProperty("additionalActivitiesIds")||[]}get excludedActivitiesIds(){return this.getStorageProperty("excludedActivitiesIds")||[]}addActivity(t,r={}){let{hours:i,fromDay:a,toDay:o}=r,s={};if(i){if(i.from>=i.to)throw new Error("[NQTR] The from hour must be less than the to hour.");s.fromHour=i.from;}if(a===0&&console.warn("[NQTR] The from day must be greater than 0, so it will be ignored."),o===0&&console.warn("[NQTR] The to day must be greater than 0, so it will be ignored."),a&&o&&a>=o)throw new Error("[NQTR] The from day must be less than the to day.");if(a&&(s.fromDay=a),o&&(s.toDay=o),this.defaultActivitiesIds.includes(t.id)){console.warn(`[NQTR] Activity with id ${t.id} already exists, so it will be ignored.`);return}let c=this.additionalActivitiesIds;if(c.includes(t.id)){if(Object.keys(s).length){this.editActivityScheduling(t.id,s);return}else if(this.excludedActivitiesIds.includes(t.id)){this.removeActivityScheduling(t.id),console.log(`[NQTR] Activity with id ${t.id} was excluded, so it will be associated with this class again.`);return}console.warn(`[NQTR] Activity with id ${t.id} already exists, so it will be ignored.`);return}c.push(t.id),this.setStorageProperty("additionalActivitiesIds",c),Object.keys(s).length&&this.editActivityScheduling(t.id,s);}revoveActivity(t,r={}){let{toDay:i}=r,a={};i===0&&console.warn("[NQTR] The to day must be greater than 0, so it will be ignored."),i&&(a.toDay=i);let o=this.additionalActivitiesIds;if(o.includes(t.id)){if(Object.keys(a).length){this.editExcludedActivityScheduling(t.id,a);return}o=o.filter(s=>s!==t.id),this.setStorageProperty("additionalActivitiesIds",o);}else if(this.defaultActivitiesIds.includes(t.id)){if(Object.keys(a).length){this.editExcludedActivityScheduling(t.id,a);return}let s=this.excludedActivitiesIds;s.push(t.id),this.setStorageProperty("excludedActivitiesIds",s);}else console.warn(`[NQTR] Activity with id ${t.id} not found, so it will be ignored.`);}clearExpiredActivities(){let t=this.activeActivityScheduling,r=this.excludedActivitiesScheduling,i=this.additionalActivitiesIds,a=this.excludedActivitiesIds;i.forEach(o=>{if(o in t){let{toDay:s}=t[o];s&&s<d.currentDay&&(this.removeActivityScheduling(o),i=i.filter(c=>c!==o));}}),a.forEach(o=>{if(o in r){let{toDay:s}=r[o];s&&s<d.currentDay&&(this.removeActivityScheduling(o),a=a.filter(c=>c!==o));}});}get activities(){let t=[];return Object.entries(this.activeActivityScheduling).forEach(([r,i])=>{let a=q(r),{fromDay:o=a?.fromDay,fromHour:s=a?.fromHour,toDay:c=a?.toDay,toHour:Y=a?.toHour}=i;a&&!(s&&Y&&!d.nowIsBetween(s,Y))&&!(o&&o>d.currentDay)&&!(c&&c<d.currentDay)&&t.push(a);}),Object.entries(this.excludedActivitiesScheduling).forEach(([r,i])=>{let a=q(r);a&&a.isActive&&!(i.toDay&&i.toDay>=d.currentDay)&&t.push(a);}),t}};var ie="__nqtr-location__",y=class extends l{constructor(t,r,i=[]){super(ie,t,i);this._map=r;}get map(){return this._map}get rooms(){return h.rooms.filter(t=>t.location.id===this.id)}};var M=class extends y{constructor(e,t,r={}){super(e,t,r.activities||[]),this.defaultName=r.name||"",this.defaultDisabled=r.disabled||false,this.defaultHidden=r.hidden||false,this._icon=r.icon;}defaultName;get name(){return this.getStorageProperty("name")||this.defaultName}set name(e){this.setStorageProperty("name",e);}defaultDisabled;get disabled(){let e=this.getStorageProperty("disabled")||this.defaultDisabled;return typeof e=="string"?pixiVn.getFlag(e):e}set disabled(e){this.setStorageProperty("disabled",e);}defaultHidden;get hidden(){let e=this.getStorageProperty("hidden")||this.defaultHidden;return typeof e=="string"?pixiVn.getFlag(e):e}set hidden(e){this.setStorageProperty("hidden",e);}_icon;get icon(){return this._icon}};var ne="__nqtr-map__",S=class extends l{constructor(e,t=[]){super(ne,e,t);}get locations(){return h.locations.filter(e=>e.map.id===this.id)}};var k=class extends S{constructor(e,t={}){super(e,t.activities||[]),this.defaultName=t.name||"",this._image=t.image;}defaultName;get name(){return this.getStorageProperty("name")||this.defaultName}set name(e){this.setStorageProperty("name",e);}_image;get image(){return this._image}};var ae="__nqtr-room__",v=class extends l{constructor(t,r,i=[]){super(ae,t,i);this._location=r;}get routine(){return H.currentRoutine.filter(t=>t.room.id===this.id)}get location(){return this._location}};var $=class extends v{constructor(e,t,r={}){super(e,t,r.activities||[]),this.defaultName=r.name||"",this._image=r.image,this.defaultDisabled=r.disabled||false,this.defaultHidden=r.hidden||false,this._icon=r.icon;}defaultName;get name(){return this.getStorageProperty("name")||this.defaultName}set name(e){this.setStorageProperty("name",e);}_image;get image(){return this._image}defaultDisabled;get disabled(){let e=this.getStorageProperty("disabled")||this.defaultDisabled;return typeof e=="string"?pixiVn.getFlag(e):e}set disabled(e){this.setStorageProperty("disabled",e);}defaultHidden;get hidden(){let e=this.getStorageProperty("hidden")||this.defaultHidden;return typeof e=="string"?pixiVn.getFlag(e):e}set hidden(e){this.setStorageProperty("hidden",e);}_icon;get icon(){return this._icon}get routine(){return H.currentRoutine.filter(e=>e.room.id===this.id)}};var se="__nqtr-quest__",D=class extends pixiVn.StoredClassModel{constructor(t,r,i={}){super(se,t);this._stages=r;this._onStart=i.onStart,this._onNextStage=i.onNextStage;}get stages(){return this._stages}get currentStageIndex(){return this.getStorageProperty("currentStageIndex")}set currentStageIndex(t){this.setStorageProperty("currentStageIndex",t);}get currentStage(){let t=this.currentStageIndex;if(!(t===undefined||t>=this.stages.length))return this.stages[t]}get started(){return this.currentStageIndex!==undefined}get completed(){return this.currentStageIndex===undefined?false:this.currentStageIndex>this.stages.length-1}get failed(){return this.getStorageProperty("failed")||false}set failed(t){this.setStorageProperty("failed",t);}_onStart;get onStart(){return this._onStart}_onNextStage;get onNextStage(){return this._onNextStage}start(t){if(this.started){console.warn(`[NQTR] Quest ${this.id} is already started`);return}if(this.stages.length===0){console.error(`[NQTR] Quest ${this.id} has no stages`);return}this.currentStageIndex=0;let r=this.currentStage;if(r&&r.start)return this.onStart&&this.onStart(this,t),r.start(t);console.error(`[NQTR] Quest ${this.id} has no start stage`);}tryToGoNextStage(t){if(!this.started||this.completed)return false;let r=this.currentStage;return r?r.completed?this.goNextStage(t):false:(console.error(`[NQTR] Quest ${this.id} has no current stage`),false)}completeCurrentStageAndGoNext(t){let r=this.currentStage;return r?(r.completed=true,this.goNextStage(t)):(console.error(`[NQTR] Quest ${this.id} has no current stage`),false)}goNextStage(t){if(!this.started)return console.warn(`[NQTR] Quest ${this.id} is not started`),false;if(this.completed)return console.warn(`[NQTR] Quest ${this.id} is already completed`),false;let r=this.currentStage,i=this.currentStageIndex;if(!r||i===undefined)return console.error(`[NQTR] Quest ${this.id} has no current stage`),false;this.currentStageIndex=i+1,this.onNextStage&&this.onNextStage(this,t),r&&r.onEnd&&r.onEnd(r,t);let a=this.currentStage;return a&&(a.inizialize(),this.currentStageMustStart&&this.startCurrentStage(t)),true}get currentStageMustStart(){let t=this.currentStage;return t?!t.started&&t.canStart&&!t.completed:false}startCurrentStage(t){let r=this.currentStage;r&&this.currentStageMustStart?r.start(t):console.warn(`[NQTR] Quest ${this.id} can't start the current stage`);}};var B=class extends D{constructor(e,t,r){super(e,t,{onStart:r.onStart,onNextStage:r.onNextStage}),this._name=r.name||"",this._description=r.description||"",this._icon=r.icon,this._image=r.image,this._inDevelopment=r.inDevelopment||false;}_name;get name(){return this._name}_description;get description(){return this._description}_icon;get icon(){return this._icon}_image;get image(){return this._image}_inDevelopment;get inDevelopment(){return this._inDevelopment}};var de="__nqtr-stage__",R=class extends pixiVn.StoredClassModel{constructor(e,t={}){super(de,e),this._onStart=t.onStart,this._onEnd=t.onEnd,this._daysRequiredToStart=t.daysRequiredToStart,this._questsRequiredToStart=t.questsRequiredToStart||[];}_onStart;get onStart(){return this._onStart}_onEnd;get onEnd(){return this._onEnd}get completed(){return this.getStorageProperty("completed")||false}set completed(e){this.setStorageProperty("completed",e);}get started(){return this.getStorageProperty("started")||false}set started(e){this.setStorageProperty("started",e);}get prevStageEndDay(){return this.getStorageProperty("prevStageEndDay")}set prevStageEndDay(e){this.setStorageProperty("prevStageEndDay",e);}get startDay(){let e=this.prevStageEndDay;if(e!==undefined)return e+this.daysRequiredToStart}get canStart(){let e=this.daysRequiredToStart;if(e>0){let t=this.prevStageEndDay;if(t===undefined||t+e>d.currentDay)return false}return !(this.questsRequiredToStart.length>0&&!this.questsRequiredToStart.every(t=>t.quest.currentStageIndex&&t.quest.currentStageIndex>=t.stageNumber))}inizialize(){this.daysRequiredToStart>0&&(this.prevStageEndDay=d.currentDay,console.log(`[NQTR] Stage ${this.id} will start on day ${this.startDay}`));}start(e){this.canStart?(this.started=true,this.onStart&&this.onStart(this,e)):console.warn(`[NQTR] Stage ${this.id} can't start`);}_daysRequiredToStart;get daysRequiredToStart(){return this._daysRequiredToStart||0}_questsRequiredToStart;get questsRequiredToStart(){return this._questsRequiredToStart||[]}};var L=class extends R{constructor(e,t){super(e,{onStart:t.onStart,onEnd:t.onEnd,daysRequiredToStart:t.daysRequiredToStart,questsRequiredToStart:t.questsRequiredToStart}),this._name=t.name||"",this._flags=t.flags||[],this._description=t.description||"",this._adviceDescription=t.adviceDescription||"",this._image=t.image,this._flagsRequiredToStart=t.flagsRequiredToStart||[],this._requestDescriptionToStart=t.requestDescriptionToStart||"";}_name;get name(){return this._name}_description;get description(){return this._description}_adviceDescription;get adviceDescription(){return this._adviceDescription}_image;get image(){return this._image}_flags;get flags(){return this._flags}_flagsRequiredToStart;get flagsRequiredToStart(){return this._flagsRequiredToStart}_requestDescriptionToStart;get requestDescriptionToStart(){return this._requestDescriptionToStart}get completed(){return super.completed?true:this.flags.length>0?!!this.flags.every(e=>pixiVn.getFlag(e.flag)):false}set completed(e){super.completed=e;}get canStart(){return this.flagsRequiredToStart.length>0&&!this.flagsRequiredToStart.every(e=>pixiVn.getFlag(e.flag))?false:super.canStart}};exports.ActivityBaseModel=P;exports.ActivityStoredClass=m;exports.CommitmentBaseModel=O;exports.LocationBaseModel=M;exports.LocationStoredClass=y;exports.MapBaseModel=k;exports.MapStoredClass=S;exports.Quest=B;exports.RoomBaseModel=$;exports.RoomStoredClass=v;exports.Stage=L;//# sourceMappingURL=index.js.map
1
+ 'use strict';var pixiVn=require('@drincs/pixi-vn');var g={};function j(n){try{let e=g[n];if(!e){console.error(`[NQTR] Room ${n} not found`);return}return e}catch(e){console.error(`[NQTR] Error while getting Room ${n}`,e);return}}var G="___nqtr-current_room_memory___",I=class{get rooms(){return Object.values(g)}get locations(){let e={};return Object.values(g).forEach(t=>{e[t.location.id]=t.location;}),Object.values(e)}get maps(){let e={};return Object.values(g).forEach(t=>{e[t.location.map.id]=t.location.map;}),Object.values(e)}get currentRoom(){let e=pixiVn.storage.getVariable(G);if(!e){console.error("[NQTR] The current room has not yet been set");return}let t=j(e);if(!t){console.error(`[NQTR] Current room ${e} not found`);return}return t}set currentRoom(e){if(!j(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(G,e.id);}get currentLocation(){return this.currentRoom?.location}get currentMap(){return this.currentRoom?.location.map}clearExpiredActivities(){Object.entries(g).forEach(([e,t])=>{t.clearExpiredActivities();});}};var E={},Q={};function w(n){try{let e=E[n];if(!e){console.error(`[NQTR] Commitment ${n} not found`);return}return e}catch(e){console.error(`[NQTR] Error while getting Commitment ${n}`,e);return}}var C="___nqtr-temporary_commitment___",_=class{get fixedRoutine(){return Object.values(Q)}set fixedRoutine(e){e.forEach(t=>{Q[t.id]&&console.warn(`[NQTR] Commitment id ${t.id} already exists, it will be overwritten`),Q[t.id]=t;});}get temporaryRoutine(){let e=pixiVn.storage.getVariable(C);return e?e.map(r=>w(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(!w(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(C,t);}find(e){return w(e)}remove(e){Array.isArray(e)||(e=[e]);let t=e.map(i=>i.id),r=pixiVn.storage.getVariable(C);r&&(r=r.filter(i=>!t.includes(i)),pixiVn.storage.setVariable(C,r));}clearExpiredRoutine(){Object.values(E).forEach(e=>{e.expired&&delete E[e.id];});}get currentRoutine(){let e={};return [...this.temporaryRoutine,...this.fixedRoutine].reverse().forEach(t=>{t.isActive&&(t.characters.length>0?t.characters.every(i=>!e[i.id]||t.priority>e[i.id].priority)&&t.characters.forEach(i=>{e[i.id]=t;}):console.error(`[NQTR] The commitment ${t.id} has no characters assigned`));}),Object.values(e)}get currentRoomRoutine(){return h.currentRoom?.routine||[]}getCommitmentByCharacter(e){this.currentRoutine.forEach(t=>{if(t.characters.map(r=>r.id).includes(e.id))return t});}};var f="___nqtr-time_manager_data___";var u=class{static minDayHours=0;static maxDayHours=24;static defaultTimeSpent=1;static timeSlots=[];static weekLength=7;static weekendStartDay=this.weekLength-1;static weekDaysNames=[]};var x=class{initialize(e){let{minDayHours:t=0,maxDayHours:r=24,defaultTimeSpent:i=1,timeSlots:a=[],weekLength:o=7,weekendStartDay:s=o-1,weekDaysNames:c=[]}=e;u.minDayHours=t,u.maxDayHours=r,u.defaultTimeSpent=i,u.timeSlots=a,u.weekLength=o,s>=u.weekLength?console.warn(`[NQTR] Weekend start day should be less than week length ${o}, so will be ignored`):u.weekendStartDay=s,c.length!==o?console.warn(`[NQTR] Week days names should be equal to week length ${o}, so will be ignored`):u.weekDaysNames=c;}get minDayHours(){return u.minDayHours}get maxDayHours(){return u.maxDayHours}get defaultTimeSpent(){return u.defaultTimeSpent}get timeSlots(){return u.timeSlots}get weekLength(){return u.weekLength}get weekendStartDay(){return u.weekendStartDay}get weekDaysNames(){return u.weekDaysNames}get currentHour(){let e=pixiVn.storage.getVariable(f)||{};return e.hasOwnProperty("currentHour")&&typeof e.currentHour=="number"?e.currentHour:this.minDayHours}set currentHour(e){let t=pixiVn.storage.getVariable(f)||{};typeof e=="number"?t.currentHour=e:delete t.currentHour,pixiVn.storage.setVariable(f,t);}get currentDay(){let e=pixiVn.storage.getVariable(f)||{};return e.hasOwnProperty("currentDay")&&typeof e.currentDay=="number"?e.currentDay:0}set currentDay(e){let t=pixiVn.storage.getVariable(f)||{};typeof e=="number"?t.currentDay=e:delete t.currentDay,pixiVn.storage.setVariable(f,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 d=new x,h=new I,H=new _;var Z="__nqtr-activity__",m=class extends pixiVn.StoredClassModel{constructor(t,r,i,a=Z){super(a,t);this._onRun=r;this._fromHour=i.fromHour,this._toHour=i.toHour,this._fromDay=i.fromDay,this._toDay=i.toDay;}_fromHour;get fromHour(){return this._fromHour}_toHour;get toHour(){return this._toHour}_fromDay;get fromDay(){return this._fromDay}_toDay;get toDay(){return this._toDay}get run(){return t=>this._onRun(this,t)}get expired(){return !!(this.toDay&&this.toDay<=d.currentDay)}get isActive(){return !(this.fromDay&&this.fromDay>d.currentDay||this.toDay&&this.toDay<d.currentDay||!d.nowIsBetween(this.fromHour,this.toHour))}};var P=class extends m{constructor(e,t,r){super(e,t,{fromHour:r.fromHour,toHour:r.toHour,fromDay:r.fromDay,toDay:r.toDay}),this.defaultName=r.name||"",this.defaultDisabled=r.disabled||false,this.defaultHidden=r.hidden||false,this._icon=r.renderIcon;}defaultName;get name(){return this.getStorageProperty("name")||this.defaultName}set name(e){this.setStorageProperty("name",e);}defaultDisabled;get disabled(){let e=this.getStorageProperty("disabled")||this.defaultDisabled;return typeof e=="string"?pixiVn.getFlag(e):e}set disabled(e){this.setStorageProperty("disabled",e);}defaultHidden;get hidden(){let e=this.getStorageProperty("hidden")||this.defaultHidden;return typeof e=="string"?pixiVn.getFlag(e):e}set hidden(e){this.setStorageProperty("hidden",e);}_icon;get icon(){return this._icon}};var ee="__nqtr-commitment__",T=class extends m{constructor(t,r,i,a,o,s,c){s=s||(()=>{});super(t,s,c,ee);this._characters=r;this._room=i;this.defaultExecutionType=a;this.defaultPriority=o;}get characters(){return this._characters}get room(){return this._room}get executionType(){return this.getStorageProperty("executionType")||this.defaultExecutionType}set executionType(t){this.setStorageProperty("executionType",t);}get priority(){return this.getStorageProperty("priority")||this.defaultPriority||0}set priority(t){this.setStorageProperty("priority",t);}};var O=class extends T{constructor(e,t,r,i){super(e,t?Array.isArray(t)?t:[t]:[],r,i.executionType||"interaction",i.priority||0,i.onRun,{fromHour:i.fromHour,toHour:i.toHour,fromDay:i.fromDay,toDay:i.toDay}),this._name=i.name||"",this._image=i.image,this.defaultDisabled=i.disabled||false,this.defaultHidden=i.hidden||false,this._icon=i.icon;}_name;get name(){return this._name}_image;get image(){return this._image}_icon;get icon(){return this._icon}defaultDisabled;get disabled(){let e=this.getStorageProperty("disabled")||this.defaultDisabled;return typeof e=="string"?pixiVn.getFlag(e):e}set disabled(e){this.setStorageProperty("disabled",e);}defaultHidden;get hidden(){if(this.fromDay&&this.fromDay>d.currentDay||!d.nowIsBetween(this.fromHour,this.toHour)||!this.expired)return true;let e=this.getStorageProperty("hidden")||this.defaultHidden;return typeof e=="string"?pixiVn.getFlag(e):e}set hidden(e){this.setStorageProperty("hidden",e);}};var te={};function q(n){try{let e=te[n];if(!e){console.error(`[NQTR] Activity ${n} not found`);return}return e}catch(e){console.error(`[NQTR] Error while getting Activity ${n}`,e);return}}var l=class extends pixiVn.StoredClassModel{constructor(t,r,i=[]){super(t,r);this.defaultActivities=i;}get defaultActivitiesIds(){return this.defaultActivities.map(t=>t.id)}get activeActivityScheduling(){return this.getStorageProperty("activeActivityScheduling")||{}}get excludedActivitiesScheduling(){return this.getStorageProperty("excludedActivitiesScheduling")||{}}removeActivityScheduling(t){let r=this.activeActivityScheduling;delete r[t],this.setStorageProperty("activeActivityScheduling",r);let i=this.excludedActivitiesScheduling;delete i[t],this.setStorageProperty("excludedActivitiesScheduling",i);}editActivityScheduling(t,r){this.removeActivityScheduling(t);let i=this.activeActivityScheduling;i[t]=r,this.setStorageProperty("activeActivityScheduling",i);}editExcludedActivityScheduling(t,r){this.removeActivityScheduling(t);let i=this.excludedActivitiesScheduling;i[t]=r,this.setStorageProperty("excludedActivitiesScheduling",i);}get additionalActivitiesIds(){return this.getStorageProperty("additionalActivitiesIds")||[]}get excludedActivitiesIds(){return this.getStorageProperty("excludedActivitiesIds")||[]}addActivity(t,r={}){let{hours:i,fromDay:a,toDay:o}=r,s={};if(i){if(i.from>=i.to)throw new Error("[NQTR] The from hour must be less than the to hour.");s.fromHour=i.from;}if(a===0&&console.warn("[NQTR] The from day must be greater than 0, so it will be ignored."),o===0&&console.warn("[NQTR] The to day must be greater than 0, so it will be ignored."),a&&o&&a>=o)throw new Error("[NQTR] The from day must be less than the to day.");if(a&&(s.fromDay=a),o&&(s.toDay=o),this.defaultActivitiesIds.includes(t.id)){console.warn(`[NQTR] Activity with id ${t.id} already exists, so it will be ignored.`);return}let c=this.additionalActivitiesIds;if(c.includes(t.id)){if(Object.keys(s).length){this.editActivityScheduling(t.id,s);return}else if(this.excludedActivitiesIds.includes(t.id)){this.removeActivityScheduling(t.id),console.log(`[NQTR] Activity with id ${t.id} was excluded, so it will be associated with this class again.`);return}console.warn(`[NQTR] Activity with id ${t.id} already exists, so it will be ignored.`);return}c.push(t.id),this.setStorageProperty("additionalActivitiesIds",c),Object.keys(s).length&&this.editActivityScheduling(t.id,s);}revoveActivity(t,r={}){let{toDay:i}=r,a={};i===0&&console.warn("[NQTR] The to day must be greater than 0, so it will be ignored."),i&&(a.toDay=i);let o=this.additionalActivitiesIds;if(o.includes(t.id)){if(Object.keys(a).length){this.editExcludedActivityScheduling(t.id,a);return}o=o.filter(s=>s!==t.id),this.setStorageProperty("additionalActivitiesIds",o);}else if(this.defaultActivitiesIds.includes(t.id)){if(Object.keys(a).length){this.editExcludedActivityScheduling(t.id,a);return}let s=this.excludedActivitiesIds;s.push(t.id),this.setStorageProperty("excludedActivitiesIds",s);}else console.warn(`[NQTR] Activity with id ${t.id} not found, so it will be ignored.`);}clearExpiredActivities(){let t=this.activeActivityScheduling,r=this.excludedActivitiesScheduling,i=this.additionalActivitiesIds,a=this.excludedActivitiesIds;i.forEach(o=>{if(o in t){let{toDay:s}=t[o];s&&s<d.currentDay&&(this.removeActivityScheduling(o),i=i.filter(c=>c!==o));}}),a.forEach(o=>{if(o in r){let{toDay:s}=r[o];s&&s<d.currentDay&&(this.removeActivityScheduling(o),a=a.filter(c=>c!==o));}});}get activities(){let t=[];return Object.entries(this.activeActivityScheduling).forEach(([r,i])=>{let a=q(r),{fromDay:o=a?.fromDay,fromHour:s=a?.fromHour,toDay:c=a?.toDay,toHour:Y=a?.toHour}=i;a&&!(s&&Y&&!d.nowIsBetween(s,Y))&&!(o&&o>d.currentDay)&&!(c&&c<d.currentDay)&&t.push(a);}),Object.entries(this.excludedActivitiesScheduling).forEach(([r,i])=>{let a=q(r);a&&a.isActive&&!(i.toDay&&i.toDay>=d.currentDay)&&t.push(a);}),t}};var ie="__nqtr-location__",y=class extends l{constructor(t,r,i=[]){super(ie,t,i);this._map=r;}get map(){return this._map}get rooms(){return h.rooms.filter(t=>t.location.id===this.id)}};var M=class extends y{constructor(e,t,r={}){super(e,t,r.activities||[]),this.defaultName=r.name||"",this.defaultDisabled=r.disabled||false,this.defaultHidden=r.hidden||false,this._icon=r.icon;}defaultName;get name(){return this.getStorageProperty("name")||this.defaultName}set name(e){this.setStorageProperty("name",e);}defaultDisabled;get disabled(){let e=this.getStorageProperty("disabled")||this.defaultDisabled;return typeof e=="string"?pixiVn.getFlag(e):e}set disabled(e){this.setStorageProperty("disabled",e);}defaultHidden;get hidden(){let e=this.getStorageProperty("hidden")||this.defaultHidden;return typeof e=="string"?pixiVn.getFlag(e):e}set hidden(e){this.setStorageProperty("hidden",e);}_icon;get icon(){return this._icon}};var ne="__nqtr-map__",S=class extends l{constructor(e,t=[]){super(ne,e,t);}get locations(){return h.locations.filter(e=>e.map.id===this.id)}};var k=class extends S{constructor(e,t={}){super(e,t.activities||[]),this.defaultName=t.name||"",this._image=t.image;}defaultName;get name(){return this.getStorageProperty("name")||this.defaultName}set name(e){this.setStorageProperty("name",e);}_image;get image(){return this._image}};var ae="__nqtr-room__",v=class extends l{constructor(t,r,i=[]){super(ae,t,i);this._location=r;}get routine(){return H.currentRoutine.filter(t=>t.room.id===this.id)}get location(){return this._location}};var $=class extends v{constructor(e,t,r={}){super(e,t,r.activities||[]),this.defaultName=r.name||"",this._image=r.image,this.defaultDisabled=r.disabled||false,this.defaultHidden=r.hidden||false,this._icon=r.icon;}defaultName;get name(){return this.getStorageProperty("name")||this.defaultName}set name(e){this.setStorageProperty("name",e);}_image;get image(){return this._image}defaultDisabled;get disabled(){let e=this.getStorageProperty("disabled")||this.defaultDisabled;return typeof e=="string"?pixiVn.getFlag(e):e}set disabled(e){this.setStorageProperty("disabled",e);}defaultHidden;get hidden(){let e=this.getStorageProperty("hidden")||this.defaultHidden;return typeof e=="string"?pixiVn.getFlag(e):e}set hidden(e){this.setStorageProperty("hidden",e);}_icon;get icon(){return this._icon}get routine(){return H.currentRoutine.filter(e=>e.room.id===this.id)}};var se="__nqtr-quest__",D=class extends pixiVn.StoredClassModel{constructor(t,r,i={}){super(se,t);this._stages=r;this._onStart=i.onStart,this._onNextStage=i.onNextStage;}get stages(){return this._stages}get currentStageIndex(){return this.getStorageProperty("currentStageIndex")}set currentStageIndex(t){this.setStorageProperty("currentStageIndex",t);}get currentStage(){let t=this.currentStageIndex;if(!(t===undefined||t>=this.stages.length))return this.stages[t]}get started(){return this.currentStageIndex!==undefined}get completed(){return this.currentStageIndex===undefined?false:this.currentStageIndex>this.stages.length-1}get failed(){return this.getStorageProperty("failed")||false}set failed(t){this.setStorageProperty("failed",t);}_onStart;get onStart(){return this._onStart}_onNextStage;get onNextStage(){return this._onNextStage}start(t){if(this.started){console.warn(`[NQTR] Quest ${this.id} is already started`);return}if(this.stages.length===0){console.error(`[NQTR] Quest ${this.id} has no stages`);return}this.currentStageIndex=0;let r=this.currentStage;if(r&&r.start)return this.onStart&&this.onStart(this,t),r.start(t);console.error(`[NQTR] Quest ${this.id} has no start stage`);}tryToGoNextStage(t){if(!this.started||this.completed)return false;let r=this.currentStage;return r?r.completed?this.goNextStage(t):false:(console.error(`[NQTR] Quest ${this.id} has no current stage`),false)}completeCurrentStageAndGoNext(t){let r=this.currentStage;return r?(r.completed=true,this.goNextStage(t)):(console.error(`[NQTR] Quest ${this.id} has no current stage`),false)}goNextStage(t){if(!this.started)return console.warn(`[NQTR] Quest ${this.id} is not started`),false;if(this.completed)return console.warn(`[NQTR] Quest ${this.id} is already completed`),false;let r=this.currentStage,i=this.currentStageIndex;if(!r||i===undefined)return console.error(`[NQTR] Quest ${this.id} has no current stage`),false;this.currentStageIndex=i+1,this.onNextStage&&this.onNextStage(this,t),r&&r.onEnd&&r.onEnd(r,t);let a=this.currentStage;return a&&(a.inizialize(),this.currentStageMustStart&&this.startCurrentStage(t)),true}get currentStageMustStart(){let t=this.currentStage;return t?!t.started&&t.canStart&&!t.completed:false}startCurrentStage(t){let r=this.currentStage;r&&this.currentStageMustStart?r.start(t):console.warn(`[NQTR] Quest ${this.id} can't start the current stage`);}};var B=class extends D{constructor(e,t,r){super(e,t,{onStart:r.onStart,onNextStage:r.onNextStage}),this._name=r.name||"",this._description=r.description||"",this._icon=r.icon,this._image=r.image,this._inDevelopment=r.inDevelopment||false;}_name;get name(){return this._name}_description;get description(){return this._description}_icon;get icon(){return this._icon}_image;get image(){return this._image}_inDevelopment;get inDevelopment(){return this._inDevelopment}};var de="__nqtr-stage__",R=class extends pixiVn.StoredClassModel{constructor(e,t={}){super(de,e),this._onStart=t.onStart,this._onEnd=t.onEnd,this._daysRequiredToStart=t.daysRequiredToStart,this._questsRequiredToStart=t.questsRequiredToStart||[];}_onStart;get onStart(){return this._onStart}_onEnd;get onEnd(){return this._onEnd}get completed(){return this.getStorageProperty("completed")||false}set completed(e){this.setStorageProperty("completed",e);}get started(){return this.getStorageProperty("started")||false}set started(e){this.setStorageProperty("started",e);}get prevStageEndDay(){return this.getStorageProperty("prevStageEndDay")}set prevStageEndDay(e){this.setStorageProperty("prevStageEndDay",e);}get startDay(){let e=this.prevStageEndDay;if(e!==undefined)return e+this.daysRequiredToStart}get canStart(){let e=this.daysRequiredToStart;if(e>0){let t=this.prevStageEndDay;if(t===undefined||t+e>d.currentDay)return false}return !(this.questsRequiredToStart.length>0&&!this.questsRequiredToStart.every(t=>t.quest.currentStageIndex&&t.quest.currentStageIndex>=t.stageNumber))}inizialize(){this.daysRequiredToStart>0&&(this.prevStageEndDay=d.currentDay,console.log(`[NQTR] Stage ${this.id} will start on day ${this.startDay}`));}start(e){this.canStart?(this.started=true,this.onStart&&this.onStart(this,e)):console.warn(`[NQTR] Stage ${this.id} can't start`);}_daysRequiredToStart;get daysRequiredToStart(){return this._daysRequiredToStart||0}_questsRequiredToStart;get questsRequiredToStart(){return this._questsRequiredToStart||[]}};var L=class extends R{constructor(e,t){super(e,{onStart:t.onStart,onEnd:t.onEnd,daysRequiredToStart:t.daysRequiredToStart,questsRequiredToStart:t.questsRequiredToStart}),this._name=t.name||"",this._flags=t.flags||[],this._description=t.description||"",this._adviceDescription=t.adviceDescription||"",this._image=t.image,this._flagsRequiredToStart=t.flagsRequiredToStart||[],this._requestDescriptionToStart=t.requestDescriptionToStart||"";}_name;get name(){return this._name}_description;get description(){return this._description}_adviceDescription;get adviceDescription(){return this._adviceDescription}_image;get image(){return this._image}_flags;get flags(){return this._flags}_flagsRequiredToStart;get flagsRequiredToStart(){return this._flagsRequiredToStart}_requestDescriptionToStart;get requestDescriptionToStart(){return this._requestDescriptionToStart}get completed(){return super.completed?true:this.flags.length>0?!!this.flags.every(e=>pixiVn.getFlag(e.flag)):false}set completed(e){super.completed=e;}get canStart(){return this.flagsRequiredToStart.length>0&&!this.flagsRequiredToStart.every(e=>pixiVn.getFlag(e.flag))?false:super.canStart}};exports.ActivityBaseModel=P;exports.ActivityStoredClass=m;exports.CommitmentBaseModel=O;exports.LocationBaseModel=M;exports.LocationStoredClass=y;exports.MapBaseModel=k;exports.MapStoredClass=S;exports.Quest=B;exports.RoomBaseModel=$;exports.RoomStoredClass=v;exports.Stage=L;//# sourceMappingURL=index.js.map
2
2
  //# sourceMappingURL=index.js.map