@drincs/nqtr 0.2.13 → 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.
- package/dist/RoomInterface-C7Sg80EF.d.mts +79 -0
- package/dist/RoomInterface-D7qXKwBI.d.ts +79 -0
- package/dist/StageInterface-DmLgfrk4.d.mts +162 -0
- package/dist/StageInterface-DmLgfrk4.d.ts +162 -0
- package/dist/classes/ActivityBaseModel.d.mts +63 -0
- package/dist/classes/ActivityBaseModel.d.ts +63 -0
- package/dist/classes/ActivityBaseModel.js +2 -0
- package/dist/classes/ActivityBaseModel.js.map +1 -0
- package/dist/classes/ActivityBaseModel.mjs +2 -0
- package/dist/classes/ActivityBaseModel.mjs.map +1 -0
- package/dist/classes/ActivityStoredClass.d.mts +27 -0
- package/dist/classes/ActivityStoredClass.d.ts +27 -0
- package/dist/classes/ActivityStoredClass.js +2 -0
- package/dist/classes/ActivityStoredClass.js.map +1 -0
- package/dist/classes/ActivityStoredClass.mjs +2 -0
- package/dist/classes/ActivityStoredClass.mjs.map +1 -0
- package/dist/classes/CommitmentBaseModel.d.mts +65 -0
- package/dist/classes/CommitmentBaseModel.d.ts +65 -0
- package/dist/classes/CommitmentBaseModel.js +2 -0
- package/dist/classes/CommitmentBaseModel.js.map +1 -0
- package/dist/classes/CommitmentBaseModel.mjs +2 -0
- package/dist/classes/CommitmentBaseModel.mjs.map +1 -0
- package/dist/classes/CommitmentStoredClass.d.mts +29 -0
- package/dist/classes/CommitmentStoredClass.d.ts +29 -0
- package/dist/classes/CommitmentStoredClass.js +2 -0
- package/dist/classes/CommitmentStoredClass.js.map +1 -0
- package/dist/classes/CommitmentStoredClass.mjs +2 -0
- package/dist/classes/CommitmentStoredClass.mjs.map +1 -0
- package/dist/classes/index.d.mts +27 -8
- package/dist/classes/index.d.ts +27 -8
- package/dist/classes/index.js +1 -1
- package/dist/classes/index.js.map +1 -1
- package/dist/classes/index.mjs +1 -1
- package/dist/classes/index.mjs.map +1 -1
- package/dist/classes/navigation/LocationBaseModel.d.mts +54 -0
- package/dist/classes/navigation/LocationBaseModel.d.ts +54 -0
- package/dist/classes/navigation/LocationBaseModel.js +2 -0
- package/dist/classes/navigation/LocationBaseModel.js.map +1 -0
- package/dist/classes/navigation/LocationBaseModel.mjs +2 -0
- package/dist/classes/navigation/LocationBaseModel.mjs.map +1 -0
- package/dist/classes/navigation/LocationStoredClass.d.mts +23 -0
- package/dist/classes/navigation/LocationStoredClass.d.ts +23 -0
- package/dist/classes/navigation/LocationStoredClass.js +2 -0
- package/dist/classes/navigation/LocationStoredClass.js.map +1 -0
- package/dist/classes/navigation/LocationStoredClass.mjs +2 -0
- package/dist/classes/navigation/LocationStoredClass.mjs.map +1 -0
- package/dist/classes/navigation/MapBaseModel.d.mts +41 -0
- package/dist/classes/navigation/MapBaseModel.d.ts +41 -0
- package/dist/classes/navigation/MapBaseModel.js +2 -0
- package/dist/classes/navigation/MapBaseModel.js.map +1 -0
- package/dist/classes/navigation/MapBaseModel.mjs +2 -0
- package/dist/classes/navigation/MapBaseModel.mjs.map +1 -0
- package/dist/classes/navigation/MapStoredClass.d.mts +14 -0
- package/dist/classes/navigation/MapStoredClass.d.ts +14 -0
- package/dist/classes/navigation/MapStoredClass.js +2 -0
- package/dist/classes/navigation/MapStoredClass.js.map +1 -0
- package/dist/classes/navigation/MapStoredClass.mjs +2 -0
- package/dist/classes/navigation/MapStoredClass.mjs.map +1 -0
- package/dist/classes/navigation/NavigationAbstractClass.d.mts +48 -0
- package/dist/classes/navigation/NavigationAbstractClass.d.ts +48 -0
- package/dist/classes/navigation/NavigationAbstractClass.js +2 -0
- package/dist/classes/navigation/NavigationAbstractClass.js.map +1 -0
- package/dist/classes/navigation/NavigationAbstractClass.mjs +2 -0
- package/dist/classes/navigation/NavigationAbstractClass.mjs.map +1 -0
- package/dist/classes/navigation/RoomBaseModel.d.mts +67 -0
- package/dist/classes/navigation/RoomBaseModel.d.ts +67 -0
- package/dist/classes/navigation/RoomBaseModel.js +2 -0
- package/dist/classes/navigation/RoomBaseModel.js.map +1 -0
- package/dist/classes/navigation/RoomBaseModel.mjs +2 -0
- package/dist/classes/navigation/RoomBaseModel.mjs.map +1 -0
- package/dist/classes/navigation/RoomStoredClass.d.mts +23 -0
- package/dist/classes/navigation/RoomStoredClass.d.ts +23 -0
- package/dist/classes/navigation/RoomStoredClass.js +2 -0
- package/dist/classes/navigation/RoomStoredClass.js.map +1 -0
- package/dist/classes/navigation/RoomStoredClass.mjs +2 -0
- package/dist/classes/navigation/RoomStoredClass.mjs.map +1 -0
- package/dist/classes/quest/QuestBaseModel.d.mts +36 -0
- package/dist/classes/quest/QuestBaseModel.d.ts +36 -0
- package/dist/classes/quest/QuestBaseModel.js +2 -0
- package/dist/classes/quest/QuestBaseModel.js.map +1 -0
- package/dist/classes/quest/QuestBaseModel.mjs +2 -0
- package/dist/classes/quest/QuestBaseModel.mjs.map +1 -0
- package/dist/classes/quest/QuestStoredClass.d.mts +37 -0
- package/dist/classes/quest/QuestStoredClass.d.ts +37 -0
- package/dist/classes/quest/QuestStoredClass.js +2 -0
- package/dist/classes/quest/QuestStoredClass.js.map +1 -0
- package/dist/classes/quest/QuestStoredClass.mjs +2 -0
- package/dist/classes/quest/QuestStoredClass.mjs.map +1 -0
- package/dist/classes/quest/StageBaseModel.d.mts +50 -0
- package/dist/classes/quest/StageBaseModel.d.ts +50 -0
- package/dist/classes/quest/StageBaseModel.js +2 -0
- package/dist/classes/quest/StageBaseModel.js.map +1 -0
- package/dist/classes/quest/StageBaseModel.mjs +2 -0
- package/dist/classes/quest/StageBaseModel.mjs.map +1 -0
- package/dist/classes/quest/StageStoredClass.d.mts +46 -0
- package/dist/classes/quest/StageStoredClass.d.ts +46 -0
- package/dist/classes/quest/StageStoredClass.js +2 -0
- package/dist/classes/quest/StageStoredClass.js.map +1 -0
- package/dist/classes/quest/StageStoredClass.mjs +2 -0
- package/dist/classes/quest/StageStoredClass.mjs.map +1 -0
- package/dist/decorators/ActivityDecorator.d.mts +5 -15
- package/dist/decorators/ActivityDecorator.d.ts +5 -15
- package/dist/decorators/ActivityDecorator.js +1 -1
- package/dist/decorators/ActivityDecorator.js.map +1 -1
- package/dist/decorators/ActivityDecorator.mjs +1 -1
- package/dist/decorators/ActivityDecorator.mjs.map +1 -1
- package/dist/decorators/CommitmentDecorator.d.mts +8 -36
- package/dist/decorators/CommitmentDecorator.d.ts +8 -36
- package/dist/decorators/CommitmentDecorator.js +1 -1
- package/dist/decorators/CommitmentDecorator.js.map +1 -1
- package/dist/decorators/CommitmentDecorator.mjs +1 -1
- package/dist/decorators/CommitmentDecorator.mjs.map +1 -1
- package/dist/decorators/QuestDecorator.d.mts +6 -16
- package/dist/decorators/QuestDecorator.d.ts +6 -16
- package/dist/decorators/QuestDecorator.js +1 -1
- package/dist/decorators/QuestDecorator.js.map +1 -1
- package/dist/decorators/QuestDecorator.mjs +1 -1
- package/dist/decorators/QuestDecorator.mjs.map +1 -1
- package/dist/decorators/RoomDecorator.d.mts +7 -31
- package/dist/decorators/RoomDecorator.d.ts +7 -31
- package/dist/decorators/RoomDecorator.js +1 -1
- package/dist/decorators/RoomDecorator.js.map +1 -1
- package/dist/decorators/RoomDecorator.mjs +1 -1
- package/dist/decorators/RoomDecorator.mjs.map +1 -1
- package/dist/decorators/index.d.mts +8 -13
- package/dist/decorators/index.d.ts +8 -13
- package/dist/decorators/index.js +1 -1
- package/dist/decorators/index.js.map +1 -1
- package/dist/decorators/index.mjs +1 -1
- package/dist/decorators/index.mjs.map +1 -1
- package/dist/functions/index.d.mts +2 -12
- package/dist/functions/index.d.ts +2 -12
- package/dist/functions/index.js +1 -1
- package/dist/functions/index.js.map +1 -1
- package/dist/functions/index.mjs +1 -1
- package/dist/functions/index.mjs.map +1 -1
- package/dist/index.d.mts +49 -47
- package/dist/index.d.ts +49 -47
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/interface/ActivityInterface.d.mts +40 -0
- package/dist/interface/ActivityInterface.d.ts +40 -0
- package/dist/interface/ActivityInterface.js +2 -0
- package/dist/interface/ActivityInterface.js.map +1 -0
- package/dist/interface/ActivityInterface.mjs +2 -0
- package/dist/interface/ActivityInterface.mjs.map +1 -0
- package/dist/interface/ActivityProps.d.mts +48 -3
- package/dist/interface/ActivityProps.d.ts +48 -3
- package/dist/interface/CommitmentInterface.d.mts +6 -0
- package/dist/interface/CommitmentInterface.d.ts +6 -0
- package/dist/interface/CommitmentInterface.js +2 -0
- package/dist/interface/CommitmentInterface.js.map +1 -0
- package/dist/interface/CommitmentInterface.mjs +2 -0
- package/dist/interface/CommitmentInterface.mjs.map +1 -0
- package/dist/interface/CommitmentProps.d.mts +77 -6
- package/dist/interface/CommitmentProps.d.ts +77 -6
- package/dist/interface/index.d.mts +12 -8
- package/dist/interface/index.d.ts +12 -8
- package/dist/interface/navigation/LocationBaseModelProps.d.mts +32 -0
- package/dist/interface/navigation/LocationBaseModelProps.d.ts +32 -0
- package/dist/interface/navigation/LocationBaseModelProps.js +2 -0
- package/dist/interface/navigation/LocationBaseModelProps.js.map +1 -0
- package/dist/interface/navigation/LocationBaseModelProps.mjs +2 -0
- package/dist/interface/navigation/LocationBaseModelProps.mjs.map +1 -0
- package/dist/interface/navigation/LocationInterface.d.mts +6 -0
- package/dist/interface/navigation/LocationInterface.d.ts +6 -0
- package/dist/interface/navigation/LocationInterface.js +2 -0
- package/dist/interface/navigation/{LocationProps.js.map → LocationInterface.js.map} +1 -1
- package/dist/interface/navigation/LocationInterface.mjs +2 -0
- package/dist/interface/navigation/LocationInterface.mjs.map +1 -0
- package/dist/interface/navigation/MapBaseModelProps.d.mts +22 -0
- package/dist/interface/navigation/MapBaseModelProps.d.ts +22 -0
- package/dist/interface/navigation/MapBaseModelProps.js +2 -0
- package/dist/interface/navigation/MapBaseModelProps.js.map +1 -0
- package/dist/interface/navigation/MapBaseModelProps.mjs +2 -0
- package/dist/interface/navigation/MapBaseModelProps.mjs.map +1 -0
- package/dist/interface/navigation/MapInterface.d.mts +6 -0
- package/dist/interface/navigation/MapInterface.d.ts +6 -0
- package/dist/interface/navigation/MapInterface.js +2 -0
- package/dist/interface/navigation/MapInterface.js.map +1 -0
- package/dist/interface/navigation/MapInterface.mjs +2 -0
- package/dist/interface/navigation/MapInterface.mjs.map +1 -0
- package/dist/interface/navigation/NavigationAbstractClass.d.mts +54 -0
- package/dist/interface/navigation/NavigationAbstractClass.d.ts +54 -0
- package/dist/interface/navigation/NavigationAbstractClass.js +2 -0
- package/dist/interface/navigation/NavigationAbstractClass.js.map +1 -0
- package/dist/interface/navigation/NavigationAbstractClass.mjs +2 -0
- package/dist/interface/navigation/NavigationAbstractClass.mjs.map +1 -0
- package/dist/interface/navigation/RoomBaseModelProps.d.mts +37 -0
- package/dist/interface/navigation/RoomBaseModelProps.d.ts +37 -0
- package/dist/interface/navigation/RoomBaseModelProps.js +2 -0
- package/dist/interface/navigation/RoomBaseModelProps.js.map +1 -0
- package/dist/interface/navigation/RoomBaseModelProps.mjs +2 -0
- package/dist/interface/navigation/RoomBaseModelProps.mjs.map +1 -0
- package/dist/interface/navigation/RoomInterface.d.mts +6 -0
- package/dist/interface/navigation/RoomInterface.d.ts +6 -0
- package/dist/interface/navigation/RoomInterface.js +2 -0
- package/dist/interface/navigation/RoomInterface.js.map +1 -0
- package/dist/interface/navigation/RoomInterface.mjs +2 -0
- package/dist/interface/navigation/RoomInterface.mjs.map +1 -0
- package/dist/interface/quest/QuestInterface.d.mts +2 -0
- package/dist/interface/quest/QuestInterface.d.ts +2 -0
- package/dist/interface/quest/QuestInterface.js +2 -0
- package/dist/interface/quest/QuestInterface.js.map +1 -0
- package/dist/interface/quest/QuestInterface.mjs +2 -0
- package/dist/interface/quest/QuestInterface.mjs.map +1 -0
- package/dist/interface/quest/QuestProps.d.mts +39 -6
- package/dist/interface/quest/QuestProps.d.ts +39 -6
- package/dist/interface/quest/StageInterface.d.mts +2 -0
- package/dist/interface/quest/StageInterface.d.ts +2 -0
- package/dist/interface/quest/StageInterface.js +2 -0
- package/dist/interface/quest/StageInterface.js.map +1 -0
- package/dist/interface/quest/StageInterface.mjs +2 -0
- package/dist/interface/quest/StageInterface.mjs.map +1 -0
- package/dist/interface/quest/StageProps.d.mts +60 -6
- package/dist/interface/quest/StageProps.d.ts +60 -6
- package/dist/managers/NavigatorManager.d.mts +22 -0
- package/dist/managers/NavigatorManager.d.ts +22 -0
- package/dist/managers/NavigatorManager.js +2 -0
- package/dist/managers/NavigatorManager.js.map +1 -0
- package/dist/managers/NavigatorManager.mjs +2 -0
- package/dist/managers/NavigatorManager.mjs.map +1 -0
- package/dist/managers/QuestManager.d.mts +17 -0
- package/dist/managers/QuestManager.d.ts +17 -0
- package/dist/managers/QuestManager.js +2 -0
- package/dist/managers/QuestManager.js.map +1 -0
- package/dist/managers/QuestManager.mjs +2 -0
- package/dist/managers/QuestManager.mjs.map +1 -0
- package/dist/managers/RoutineManager.d.mts +59 -0
- package/dist/managers/RoutineManager.d.ts +59 -0
- package/dist/managers/RoutineManager.js +2 -0
- package/dist/managers/RoutineManager.js.map +1 -0
- package/dist/managers/RoutineManager.mjs +2 -0
- package/dist/managers/RoutineManager.mjs.map +1 -0
- package/dist/managers/TimeManager.d.mts +2 -11
- package/dist/managers/TimeManager.d.ts +2 -11
- package/dist/managers/TimeManager.js +1 -1
- package/dist/managers/TimeManager.js.map +1 -1
- package/dist/managers/TimeManager.mjs +1 -1
- package/dist/managers/TimeManager.mjs.map +1 -1
- package/dist/managers/TimeManagerSettings.d.mts +13 -0
- package/dist/managers/TimeManagerSettings.d.ts +13 -0
- package/dist/managers/TimeManagerSettings.js +2 -0
- package/dist/managers/TimeManagerSettings.js.map +1 -0
- package/dist/managers/TimeManagerSettings.mjs +2 -0
- package/dist/managers/TimeManagerSettings.mjs.map +1 -0
- package/dist/managers/index.d.mts +14 -1
- package/dist/managers/index.d.ts +14 -1
- package/dist/managers/index.js +1 -1
- package/dist/managers/index.js.map +1 -1
- package/dist/managers/index.mjs +1 -1
- package/dist/managers/index.mjs.map +1 -1
- package/dist/override/ActivityInterface.d.mts +28 -0
- package/dist/override/ActivityInterface.d.ts +28 -0
- package/dist/override/ActivityInterface.js +2 -0
- package/dist/override/ActivityInterface.js.map +1 -0
- package/dist/override/ActivityInterface.mjs +2 -0
- package/dist/override/ActivityInterface.mjs.map +1 -0
- package/dist/override/CommitmentInterface.d.mts +24 -0
- package/dist/override/CommitmentInterface.d.ts +24 -0
- package/dist/override/CommitmentInterface.js +2 -0
- package/dist/override/CommitmentInterface.js.map +1 -0
- package/dist/override/CommitmentInterface.mjs +2 -0
- package/dist/override/CommitmentInterface.mjs.map +1 -0
- package/dist/override/LocationInterface.d.mts +29 -0
- package/dist/override/LocationInterface.d.ts +29 -0
- package/dist/override/LocationInterface.js +2 -0
- package/dist/{interface/navigation/LocationProps.mjs.map → override/LocationInterface.js.map} +1 -1
- package/dist/override/LocationInterface.mjs +2 -0
- package/dist/override/LocationInterface.mjs.map +1 -0
- package/dist/override/MapInterface.d.mts +12 -0
- package/dist/override/MapInterface.d.ts +12 -0
- package/dist/override/MapInterface.js +2 -0
- package/dist/override/MapInterface.js.map +1 -0
- package/dist/override/MapInterface.mjs +2 -0
- package/dist/override/MapInterface.mjs.map +1 -0
- package/dist/override/QuestInterface.d.mts +24 -0
- package/dist/override/QuestInterface.d.ts +24 -0
- package/dist/override/QuestInterface.js +2 -0
- package/dist/override/QuestInterface.js.map +1 -0
- package/dist/override/QuestInterface.mjs +2 -0
- package/dist/override/QuestInterface.mjs.map +1 -0
- package/dist/override/RoomInterface.d.mts +33 -0
- package/dist/override/RoomInterface.d.ts +33 -0
- package/dist/override/RoomInterface.js +2 -0
- package/dist/override/RoomInterface.js.map +1 -0
- package/dist/override/RoomInterface.mjs +2 -0
- package/dist/override/RoomInterface.mjs.map +1 -0
- package/dist/override/StageInterface.d.mts +34 -0
- package/dist/override/StageInterface.d.ts +34 -0
- package/dist/override/StageInterface.js +2 -0
- package/dist/override/StageInterface.js.map +1 -0
- package/dist/override/StageInterface.mjs +2 -0
- package/dist/override/StageInterface.mjs.map +1 -0
- package/dist/override/index.d.mts +8 -4
- package/dist/override/index.d.ts +8 -4
- package/dist/types/OnRunEvent.d.mts +8 -0
- package/dist/types/OnRunEvent.d.ts +8 -0
- package/dist/types/OnRunEvent.js +2 -0
- package/dist/types/{OnRunActivityEvent.js.map → OnRunEvent.js.map} +1 -1
- package/dist/types/OnRunEvent.mjs +2 -0
- package/dist/types/{OnRunActivityEvent.mjs.map → OnRunEvent.mjs.map} +1 -1
- package/dist/types/QuestsRequired.d.mts +1 -5
- package/dist/types/QuestsRequired.d.ts +1 -5
- package/dist/types/index.d.mts +1 -5
- package/dist/types/index.d.ts +1 -5
- package/package.json +3 -4
- package/dist/ActivityProps-LWY7Zucl.d.ts +0 -124
- package/dist/ActivityProps-WgXDAYbc.d.mts +0 -124
- package/dist/Commitment-BujJuTv8.d.mts +0 -586
- package/dist/Commitment-DFYAApxl.d.ts +0 -586
- package/dist/StageProps-CqgBUi3e.d.mts +0 -326
- package/dist/StageProps-DghO7WaT.d.ts +0 -326
- package/dist/classes/Activity.d.mts +0 -112
- package/dist/classes/Activity.d.ts +0 -112
- package/dist/classes/Activity.js +0 -2
- package/dist/classes/Activity.js.map +0 -1
- package/dist/classes/Activity.mjs +0 -2
- package/dist/classes/Activity.mjs.map +0 -1
- package/dist/classes/ActivityStoredAbstract.d.mts +0 -3
- package/dist/classes/ActivityStoredAbstract.d.ts +0 -3
- package/dist/classes/ActivityStoredAbstract.js +0 -2
- package/dist/classes/ActivityStoredAbstract.js.map +0 -1
- package/dist/classes/ActivityStoredAbstract.mjs +0 -2
- package/dist/classes/ActivityStoredAbstract.mjs.map +0 -1
- package/dist/classes/Commitment.d.mts +0 -8
- package/dist/classes/Commitment.d.ts +0 -8
- package/dist/classes/Commitment.js +0 -2
- package/dist/classes/Commitment.js.map +0 -1
- package/dist/classes/Commitment.mjs +0 -2
- package/dist/classes/Commitment.mjs.map +0 -1
- package/dist/classes/navigation/ActivityRoom.d.mts +0 -8
- package/dist/classes/navigation/ActivityRoom.d.ts +0 -8
- package/dist/classes/navigation/ActivityRoom.js +0 -2
- package/dist/classes/navigation/ActivityRoom.js.map +0 -1
- package/dist/classes/navigation/ActivityRoom.mjs +0 -2
- package/dist/classes/navigation/ActivityRoom.mjs.map +0 -1
- package/dist/classes/navigation/Location.d.mts +0 -8
- package/dist/classes/navigation/Location.d.ts +0 -8
- package/dist/classes/navigation/Location.js +0 -2
- package/dist/classes/navigation/Location.js.map +0 -1
- package/dist/classes/navigation/Location.mjs +0 -2
- package/dist/classes/navigation/Location.mjs.map +0 -1
- package/dist/classes/navigation/Map.d.mts +0 -8
- package/dist/classes/navigation/Map.d.ts +0 -8
- package/dist/classes/navigation/Map.js +0 -2
- package/dist/classes/navigation/Map.js.map +0 -1
- package/dist/classes/navigation/Map.mjs +0 -2
- package/dist/classes/navigation/Map.mjs.map +0 -1
- package/dist/classes/navigation/Room.d.mts +0 -8
- package/dist/classes/navigation/Room.d.ts +0 -8
- package/dist/classes/navigation/Room.js +0 -2
- package/dist/classes/navigation/Room.js.map +0 -1
- package/dist/classes/navigation/Room.mjs +0 -2
- package/dist/classes/navigation/Room.mjs.map +0 -1
- package/dist/classes/quest/Goal.d.mts +0 -46
- package/dist/classes/quest/Goal.d.ts +0 -46
- package/dist/classes/quest/Goal.js +0 -2
- package/dist/classes/quest/Goal.js.map +0 -1
- package/dist/classes/quest/Goal.mjs +0 -2
- package/dist/classes/quest/Goal.mjs.map +0 -1
- package/dist/classes/quest/Quest.d.mts +0 -6
- package/dist/classes/quest/Quest.d.ts +0 -6
- package/dist/classes/quest/Quest.js +0 -2
- package/dist/classes/quest/Quest.js.map +0 -1
- package/dist/classes/quest/Quest.mjs +0 -2
- package/dist/classes/quest/Quest.mjs.map +0 -1
- package/dist/classes/quest/Stage.d.mts +0 -6
- package/dist/classes/quest/Stage.d.ts +0 -6
- package/dist/classes/quest/Stage.js +0 -2
- package/dist/classes/quest/Stage.js.map +0 -1
- package/dist/classes/quest/Stage.mjs +0 -2
- package/dist/classes/quest/Stage.mjs.map +0 -1
- package/dist/functions/ActivityFunctions.d.mts +0 -20
- package/dist/functions/ActivityFunctions.d.ts +0 -20
- package/dist/functions/ActivityFunctions.js +0 -2
- package/dist/functions/ActivityFunctions.js.map +0 -1
- package/dist/functions/ActivityFunctions.mjs +0 -2
- package/dist/functions/ActivityFunctions.mjs.map +0 -1
- package/dist/functions/NavigationFunctions.d.mts +0 -32
- package/dist/functions/NavigationFunctions.d.ts +0 -32
- package/dist/functions/NavigationFunctions.js +0 -2
- package/dist/functions/NavigationFunctions.js.map +0 -1
- package/dist/functions/NavigationFunctions.mjs +0 -2
- package/dist/functions/NavigationFunctions.mjs.map +0 -1
- package/dist/functions/QuestFunctions.d.mts +0 -8
- package/dist/functions/QuestFunctions.d.ts +0 -8
- package/dist/functions/QuestFunctions.js +0 -2
- package/dist/functions/QuestFunctions.js.map +0 -1
- package/dist/functions/QuestFunctions.mjs +0 -2
- package/dist/functions/QuestFunctions.mjs.map +0 -1
- package/dist/functions/RoutineFunctions.d.mts +0 -36
- package/dist/functions/RoutineFunctions.d.ts +0 -36
- package/dist/functions/RoutineFunctions.js +0 -2
- package/dist/functions/RoutineFunctions.js.map +0 -1
- package/dist/functions/RoutineFunctions.mjs +0 -2
- package/dist/functions/RoutineFunctions.mjs.map +0 -1
- package/dist/interface/RoomActivityMemory.d.mts +0 -9
- package/dist/interface/RoomActivityMemory.d.ts +0 -9
- package/dist/interface/RoomActivityMemory.js +0 -2
- package/dist/interface/RoomActivityMemory.js.map +0 -1
- package/dist/interface/RoomActivityMemory.mjs +0 -2
- package/dist/interface/RoomActivityMemory.mjs.map +0 -1
- package/dist/interface/RoomProps.d.mts +0 -8
- package/dist/interface/RoomProps.d.ts +0 -8
- package/dist/interface/RoomProps.js +0 -2
- package/dist/interface/RoomProps.js.map +0 -1
- package/dist/interface/RoomProps.mjs +0 -2
- package/dist/interface/RoomProps.mjs.map +0 -1
- package/dist/interface/navigation/LocationProps.d.mts +0 -8
- package/dist/interface/navigation/LocationProps.d.ts +0 -8
- package/dist/interface/navigation/LocationProps.js +0 -2
- package/dist/interface/navigation/LocationProps.mjs +0 -2
- package/dist/interface/navigation/MapProps.d.mts +0 -8
- package/dist/interface/navigation/MapProps.d.ts +0 -8
- package/dist/interface/navigation/MapProps.js +0 -2
- package/dist/interface/navigation/MapProps.js.map +0 -1
- package/dist/interface/navigation/MapProps.mjs +0 -2
- package/dist/interface/navigation/MapProps.mjs.map +0 -1
- package/dist/interface/quest/GoalProps.d.mts +0 -19
- package/dist/interface/quest/GoalProps.d.ts +0 -19
- package/dist/interface/quest/GoalProps.js +0 -2
- package/dist/interface/quest/GoalProps.js.map +0 -1
- package/dist/interface/quest/GoalProps.mjs +0 -2
- package/dist/interface/quest/GoalProps.mjs.map +0 -1
- package/dist/override/GraphicItemType.d.mts +0 -17
- package/dist/override/GraphicItemType.d.ts +0 -17
- package/dist/override/GraphicItemType.js +0 -2
- package/dist/override/GraphicItemType.js.map +0 -1
- package/dist/override/GraphicItemType.mjs +0 -2
- package/dist/override/GraphicItemType.mjs.map +0 -1
- package/dist/override/NeighboringMapsInterface.d.mts +0 -21
- package/dist/override/NeighboringMapsInterface.d.ts +0 -21
- package/dist/override/NeighboringMapsInterface.js +0 -2
- package/dist/override/NeighboringMapsInterface.js.map +0 -1
- package/dist/override/NeighboringMapsInterface.mjs +0 -2
- package/dist/override/NeighboringMapsInterface.mjs.map +0 -1
- package/dist/types/OnRunActivityEvent.d.mts +0 -8
- package/dist/types/OnRunActivityEvent.d.ts +0 -8
- package/dist/types/OnRunActivityEvent.js +0 -2
- package/dist/types/OnRunActivityEvent.mjs +0 -2
- package/dist/types/OnRunCommitmentEvent.d.mts +0 -8
- package/dist/types/OnRunCommitmentEvent.d.ts +0 -8
- package/dist/types/OnRunCommitmentEvent.js +0 -2
- package/dist/types/OnRunCommitmentEvent.js.map +0 -1
- package/dist/types/OnRunCommitmentEvent.mjs +0 -2
- package/dist/types/OnRunCommitmentEvent.mjs.map +0 -1
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { OnStartEndStageQuest } from '@drincs/nqtr/dist/override';
|
|
2
|
+
import { Q as QuestBaseInterface } from '../StageInterface-DmLgfrk4.js';
|
|
3
|
+
|
|
4
|
+
declare class QuestManager {
|
|
5
|
+
get quests(): QuestBaseInterface[];
|
|
6
|
+
get startedQuests(): QuestBaseInterface[];
|
|
7
|
+
get completedQuests(): QuestBaseInterface[];
|
|
8
|
+
get failedQuests(): QuestBaseInterface[];
|
|
9
|
+
get notStartedQuests(): QuestBaseInterface[];
|
|
10
|
+
find(id: string): QuestBaseInterface | undefined;
|
|
11
|
+
/**
|
|
12
|
+
* Start the quests that must start on the current stage.
|
|
13
|
+
*/
|
|
14
|
+
startsStageMustBeStarted(props: OnStartEndStageQuest): void;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export { QuestManager as default };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
'use strict';var r={};function u(e){try{let t=r[e];if(!t){console.error(`[NQTR] Quest ${e} not found`);return}return t}catch(t){console.error(`[NQTR] Error while getting Quest ${e}`,t);return}}var s=class{get quests(){return Object.values(r)}get startedQuests(){return this.quests.filter(t=>t.started)}get completedQuests(){return this.quests.filter(t=>t.completed)}get failedQuests(){return this.quests.filter(t=>t.failed)}get notStartedQuests(){return this.quests.filter(t=>!t.started)}find(t){return u(t)}startsStageMustBeStarted(t){Object.values(r).forEach(n=>{n.currentStageMustStart&&n.startCurrentStage(t);});}};module.exports=s;//# sourceMappingURL=QuestManager.js.map
|
|
2
|
+
//# sourceMappingURL=QuestManager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/decorators/QuestDecorator.ts","../../src/managers/QuestManager.ts"],"names":["registeredQuests","getQuestById","id","quest","e","QuestManager","props"],"mappings":"aAEO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F,CACD","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 { OnStartEndStageQuest } from \"@drincs/nqtr/dist/override\";\nimport { getQuestById, registeredQuests } from \"../decorators/QuestDecorator\";\nimport { QuestInterface } from \"../interface\";\n\nexport default class QuestManager {\n\tget quests(): QuestInterface[] {\n\t\treturn Object.values(registeredQuests);\n\t}\n\tget startedQuests(): QuestInterface[] {\n\t\treturn this.quests.filter((quest) => quest.started);\n\t}\n\tget completedQuests(): QuestInterface[] {\n\t\treturn this.quests.filter((quest) => quest.completed);\n\t}\n\tget failedQuests(): QuestInterface[] {\n\t\treturn this.quests.filter((quest) => quest.failed);\n\t}\n\tget notStartedQuests(): QuestInterface[] {\n\t\treturn this.quests.filter((quest) => !quest.started);\n\t}\n\n\tfind(id: string): QuestInterface | undefined {\n\t\treturn getQuestById(id);\n\t}\n\n\t/**\n\t * Start the quests that must start on the current stage.\n\t */\n\tstartsStageMustBeStarted(props: OnStartEndStageQuest) {\n\t\tObject.values(registeredQuests).forEach((quest) => {\n\t\t\tif (quest.currentStageMustStart) {\n\t\t\t\tquest.startCurrentStage(props);\n\t\t\t}\n\t\t});\n\t}\n}\n"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var r={};function u(e){try{let t=r[e];if(!t){console.error(`[NQTR] Quest ${e} not found`);return}return t}catch(t){console.error(`[NQTR] Error while getting Quest ${e}`,t);return}}var s=class{get quests(){return Object.values(r)}get startedQuests(){return this.quests.filter(t=>t.started)}get completedQuests(){return this.quests.filter(t=>t.completed)}get failedQuests(){return this.quests.filter(t=>t.failed)}get notStartedQuests(){return this.quests.filter(t=>!t.started)}find(t){return u(t)}startsStageMustBeStarted(t){Object.values(r).forEach(n=>{n.currentStageMustStart&&n.startCurrentStage(t);});}};export{s as default};//# sourceMappingURL=QuestManager.mjs.map
|
|
2
|
+
//# sourceMappingURL=QuestManager.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/decorators/QuestDecorator.ts","../../src/managers/QuestManager.ts"],"names":["registeredQuests","getQuestById","id","quest","e","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,OAASC,CAAG,CAAA,CACX,OAAQ,CAAA,KAAA,CAAM,CAAoCF,iCAAAA,EAAAA,CAAE,CAAIE,CAAAA,CAAAA,CAAC,CACzD,CAAA,MACD,CACD,CCnCqBC,IAAAA,CAAAA,CAArB,KAAkC,CACjC,IAAI,MAAA,EAA2B,CAC9B,OAAO,MAAO,CAAA,MAAA,CAAOL,CAAgB,CACtC,CACA,IAAI,aAAkC,EAAA,CACrC,OAAO,IAAA,CAAK,MAAO,CAAA,MAAA,CAAQG,GAAUA,CAAM,CAAA,OAAO,CACnD,CACA,IAAI,eAAA,EAAoC,CACvC,OAAO,IAAK,CAAA,MAAA,CAAO,MAAQA,CAAAA,CAAAA,EAAUA,CAAM,CAAA,SAAS,CACrD,CACA,IAAI,YAAA,EAAiC,CACpC,OAAO,IAAK,CAAA,MAAA,CAAO,MAAQA,CAAAA,CAAAA,EAAUA,CAAM,CAAA,MAAM,CAClD,CACA,IAAI,gBAAA,EAAqC,CACxC,OAAO,KAAK,MAAO,CAAA,MAAA,CAAQA,CAAU,EAAA,CAACA,CAAM,CAAA,OAAO,CACpD,CAEA,IAAKD,CAAAA,CAAAA,CAAwC,CAC5C,OAAOD,CAAaC,CAAAA,CAAE,CACvB,CAKA,yBAAyBI,CAA6B,CAAA,CACrD,MAAO,CAAA,MAAA,CAAON,CAAgB,CAAA,CAAE,OAASG,CAAAA,CAAAA,EAAU,CAC9CA,CAAAA,CAAM,qBACTA,EAAAA,CAAAA,CAAM,iBAAkBG,CAAAA,CAAK,EAE/B,CAAC,EACF,CACD","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 { OnStartEndStageQuest } from \"@drincs/nqtr/dist/override\";\nimport { getQuestById, registeredQuests } from \"../decorators/QuestDecorator\";\nimport { QuestInterface } from \"../interface\";\n\nexport default class QuestManager {\n\tget quests(): QuestInterface[] {\n\t\treturn Object.values(registeredQuests);\n\t}\n\tget startedQuests(): QuestInterface[] {\n\t\treturn this.quests.filter((quest) => quest.started);\n\t}\n\tget completedQuests(): QuestInterface[] {\n\t\treturn this.quests.filter((quest) => quest.completed);\n\t}\n\tget failedQuests(): QuestInterface[] {\n\t\treturn this.quests.filter((quest) => quest.failed);\n\t}\n\tget notStartedQuests(): QuestInterface[] {\n\t\treturn this.quests.filter((quest) => !quest.started);\n\t}\n\n\tfind(id: string): QuestInterface | undefined {\n\t\treturn getQuestById(id);\n\t}\n\n\t/**\n\t * Start the quests that must start on the current stage.\n\t */\n\tstartsStageMustBeStarted(props: OnStartEndStageQuest) {\n\t\tObject.values(registeredQuests).forEach((quest) => {\n\t\t\tif (quest.currentStageMustStart) {\n\t\t\t\tquest.startCurrentStage(props);\n\t\t\t}\n\t\t});\n\t}\n}\n"]}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { CharacterInterface } from '@drincs/pixi-vn';
|
|
2
|
+
import { C as CommitmentBaseInterface } from '../RoomInterface-C7Sg80EF.mjs';
|
|
3
|
+
import '@drincs/nqtr/dist/override';
|
|
4
|
+
import '../interface/ActivityInterface.mjs';
|
|
5
|
+
import '../types/ExecutionType.mjs';
|
|
6
|
+
import '../interface/navigation/NavigationAbstractClass.mjs';
|
|
7
|
+
|
|
8
|
+
declare class RoutineManager {
|
|
9
|
+
get fixedRoutine(): CommitmentBaseInterface[];
|
|
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: CommitmentBaseInterface[]);
|
|
14
|
+
/**
|
|
15
|
+
* Get the temporary commitments by its id.
|
|
16
|
+
* @returns The temporary commitments.
|
|
17
|
+
*/
|
|
18
|
+
get temporaryRoutine(): CommitmentBaseInterface[];
|
|
19
|
+
get allRoutine(): CommitmentBaseInterface[];
|
|
20
|
+
/**
|
|
21
|
+
* This feature adds the commitments during the game session.
|
|
22
|
+
* @param commitment The commitment or commitments to add.
|
|
23
|
+
*/
|
|
24
|
+
add(commitment: CommitmentBaseInterface[] | CommitmentBaseInterface): 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): CommitmentBaseInterface | undefined;
|
|
31
|
+
/**
|
|
32
|
+
* Remove the commitments added during the game session.
|
|
33
|
+
* @param commitment The commitment or commitments to remove.
|
|
34
|
+
*/
|
|
35
|
+
remove(commitment: CommitmentBaseInterface[] | CommitmentBaseInterface): 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(): CommitmentBaseInterface[];
|
|
50
|
+
get currentRoomRoutine(): CommitmentBaseInterface[];
|
|
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): CommitmentBaseInterface | undefined;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export { RoutineManager as default };
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { CharacterInterface } from '@drincs/pixi-vn';
|
|
2
|
+
import { C as CommitmentBaseInterface } from '../RoomInterface-D7qXKwBI.js';
|
|
3
|
+
import '@drincs/nqtr/dist/override';
|
|
4
|
+
import '../interface/ActivityInterface.js';
|
|
5
|
+
import '../types/ExecutionType.js';
|
|
6
|
+
import '../interface/navigation/NavigationAbstractClass.js';
|
|
7
|
+
|
|
8
|
+
declare class RoutineManager {
|
|
9
|
+
get fixedRoutine(): CommitmentBaseInterface[];
|
|
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: CommitmentBaseInterface[]);
|
|
14
|
+
/**
|
|
15
|
+
* Get the temporary commitments by its id.
|
|
16
|
+
* @returns The temporary commitments.
|
|
17
|
+
*/
|
|
18
|
+
get temporaryRoutine(): CommitmentBaseInterface[];
|
|
19
|
+
get allRoutine(): CommitmentBaseInterface[];
|
|
20
|
+
/**
|
|
21
|
+
* This feature adds the commitments during the game session.
|
|
22
|
+
* @param commitment The commitment or commitments to add.
|
|
23
|
+
*/
|
|
24
|
+
add(commitment: CommitmentBaseInterface[] | CommitmentBaseInterface): 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): CommitmentBaseInterface | undefined;
|
|
31
|
+
/**
|
|
32
|
+
* Remove the commitments added during the game session.
|
|
33
|
+
* @param commitment The commitment or commitments to remove.
|
|
34
|
+
*/
|
|
35
|
+
remove(commitment: CommitmentBaseInterface[] | CommitmentBaseInterface): 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(): CommitmentBaseInterface[];
|
|
50
|
+
get currentRoomRoutine(): CommitmentBaseInterface[];
|
|
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): CommitmentBaseInterface | undefined;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export { RoutineManager as default };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
'use strict';var pixiVn=require('@drincs/pixi-vn');var s={};function R(i){try{let e=s[i];if(!e){console.error(`[NQTR] Room ${i} not found`);return}return e}catch(e){console.error(`[NQTR] Error while getting Room ${i}`,e);return}}var _="___nqtr-current_room_memory___",c=class{get rooms(){return Object.values(s)}get locations(){let e={};return Object.values(s).forEach(t=>{e[t.location.id]=t.location;}),Object.values(e)}get maps(){let e={};return Object.values(s).forEach(t=>{e[t.location.map.id]=t.location.map;}),Object.values(e)}get currentRoom(){let e=pixiVn.storage.getVariable(_);if(!e){console.error("[NQTR] The current room has not yet been set");return}let t=R(e);if(!t){console.error(`[NQTR] Current room ${e} not found`);return}return t}set currentRoom(e){if(!R(e.id)){console.error(`[NQTR] The room ${e.id} is not registered, so it can't be set as current room`);return}pixiVn.storage.setVariable(_,e.id);}get currentLocation(){return this.currentRoom?.location}get currentMap(){return this.currentRoom?.location.map}clearExpiredActivities(){Object.entries(s).forEach(([e,t])=>{t.clearExpiredActivities();});}};var S=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 S.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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/decorators/RoomDecorator.ts","../../src/managers/NavigatorManager.ts","../../src/managers/index.ts","../../src/decorators/CommitmentDecorator.ts","../../src/managers/RoutineManager.ts"],"names":["registeredRooms","getRoomById","id","room","CURRENT_ROOM_MEMORY_KEY","NavigatorManager","result","roomId","storage","_","timeTracker","navigator","RoutineManager","questsNotebook","registeredCommitments","fixedCommitments","getCommitmentById","commitment","TEMPORARY_COMMITMENT_CATEGORY_MEMORY_KEY","commitments","c","commitmentsIds","currentCommitments","character_commitments","ch","character"],"mappings":"mDAEO,IAAMA,CAAAA,CAAmD,EAAC,CA2B1D,SAASC,CAAAA,CAAYC,EAAuC,CAClE,GAAI,CACH,IAAIC,CAAOH,CAAAA,CAAAA,CAAgBE,CAAE,CAAA,CAC7B,GAAI,CAACC,CAAAA,CAAM,CACV,OAAA,CAAQ,KAAM,CAAA,CAAA,YAAA,EAAeD,CAAE,CAAA,UAAA,CAAY,EAC3C,MACD,CACA,OAAOC,CACR,CAAS,MAAA,CAAA,CAAG,CACX,OAAA,CAAQ,MAAM,CAAmCD,gCAAAA,EAAAA,CAAE,CAAI,CAAA,CAAA,CAAC,CACxD,CAAA,MACD,CACD,CCrCA,IAAME,CAA0B,CAAA,gCAAA,CACXC,CAArB,CAAA,KAAsC,CACrC,IAAI,KAAQ,EAAA,CACX,OAAO,MAAO,CAAA,MAAA,CAAOL,CAAe,CACrC,CACA,IAAI,SAAY,EAAA,CACf,IAAIM,CAA8C,CAAA,EAClD,CAAA,OAAA,MAAA,CAAO,MAAON,CAAAA,CAAe,CAAE,CAAA,OAAA,CAASG,GAAS,CAChDG,CAAAA,CAAOH,CAAK,CAA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AAA,OAAOL,CAET,CAAC,EAEF,CACD","file":"RoutineManager.js","sourcesContent":["import { RoomInterface } from \"../interface\";\n\nexport const registeredRooms: { [id: string]: RoomInterface } = {};\n\n/**\n * Save a room in the registered rooms. If the room already exists, it will be overwritten.\n * @param room The room to save.\n * @returns\n * @example\n * ```ts\n * saveRoom([mcRoom, aliceRoom, annRoom, bathroom, lounge, terrace, gymRoom]);\n * ```\n */\nexport function saveRoom(room: RoomInterface | RoomInterface[]) {\n\tif (Array.isArray(room)) {\n\t\troom.forEach((c) => saveRoom(c));\n\t\treturn;\n\t}\n\tif (registeredRooms[room.id]) {\n\t\tconsole.warn(`[NQTR] Room id ${room.id} already exists, it will be overwritten`);\n\t}\n\tregisteredRooms[room.id] = room;\n}\n\n/**\n * Get a room by its id.\n * @param id The id of the room.\n * @returns The room or undefined if not found.\n */\nexport function getRoomById(id: string): RoomInterface | undefined {\n\ttry {\n\t\tlet room = registeredRooms[id];\n\t\tif (!room) {\n\t\t\tconsole.error(`[NQTR] Room ${id} not found`);\n\t\t\treturn;\n\t\t}\n\t\treturn room;\n\t} catch (e) {\n\t\tconsole.error(`[NQTR] Error while getting Room ${id}`, e);\n\t\treturn;\n\t}\n}\n","import { storage } from \"@drincs/pixi-vn\";\nimport { getRoomById, registeredRooms } from \"../decorators/RoomDecorator\";\nimport { LocationInterface, MapInterface, RoomInterface } from \"../interface\";\n\nconst CURRENT_ROOM_MEMORY_KEY = \"___nqtr-current_room_memory___\";\nexport default class NavigatorManager {\n\tget rooms() {\n\t\treturn Object.values(registeredRooms);\n\t}\n\tget locations() {\n\t\tlet result: { [id: string]: LocationInterface } = {};\n\t\tObject.values(registeredRooms).forEach((room) => {\n\t\t\tresult[room.location.id] = room.location;\n\t\t});\n\t\treturn Object.values(result);\n\t}\n\tget maps() {\n\t\tlet result: { [id: string]: MapInterface } = {};\n\t\tObject.values(registeredRooms).forEach((room) => {\n\t\t\tresult[room.location.map.id] = room.location.map;\n\t\t});\n\t\treturn Object.values(result);\n\t}\n\tget currentRoom(): RoomInterface | undefined {\n\t\tlet roomId = storage.getVariable<string>(CURRENT_ROOM_MEMORY_KEY);\n\t\tif (!roomId) {\n\t\t\tconsole.error(`[NQTR] The current room has not yet been set`);\n\t\t\treturn;\n\t\t}\n\t\tlet room = getRoomById(roomId);\n\t\tif (!room) {\n\t\t\tconsole.error(`[NQTR] Current room ${roomId} not found`);\n\t\t\treturn;\n\t\t}\n\t\treturn room;\n\t}\n\tset currentRoom(room: RoomInterface) {\n\t\tlet roomRegistrated = getRoomById(room.id);\n\t\tif (!roomRegistrated) {\n\t\t\tconsole.error(`[NQTR] The room ${room.id} is not registered, so it can't be set as current room`);\n\t\t\treturn;\n\t\t}\n\t\tstorage.setVariable(CURRENT_ROOM_MEMORY_KEY, room.id);\n\t}\n\tget currentLocation(): LocationInterface | undefined {\n\t\treturn this.currentRoom?.location;\n\t}\n\tget currentMap(): MapInterface | undefined {\n\t\treturn this.currentRoom?.location.map;\n\t}\n\t/**\n\t * Clear all the expired activities.\n\t */\n\tclearExpiredActivities() {\n\t\tObject.entries(registeredRooms).forEach(([_, room]) => {\n\t\t\troom.clearExpiredActivities();\n\t\t});\n\t}\n}\n","import NavigatorManager from \"./NavigatorManager\";\nimport QuestManager from \"./QuestManager\";\nimport RoutineManager from \"./RoutineManager\";\nimport { default as TimeManager } from \"./TimeManager\";\n\nconst timeTracker = new TimeManager();\nconst navigator = new NavigatorManager();\nconst routine = new RoutineManager();\nconst questsNotebook = new QuestManager();\n\nexport { navigator, questsNotebook, routine, timeTracker };\n","import { CommitmentInterface } from \"../interface\";\n\nexport const registeredCommitments: { [id: string]: CommitmentInterface } = {};\nexport const fixedCommitments: { [id: string]: CommitmentInterface } = {};\n\n/**\n * Save a commitment in the registered commitments. If the commitment already exists, it will be overwritten.\n * @param commitment The commitment or commitments to save.\n * @returns\n */\nexport function saveCommitment(commitment: CommitmentInterface | CommitmentInterface[]) {\n\tif (Array.isArray(commitment)) {\n\t\tcommitment.forEach((c) => saveCommitment(c));\n\t\treturn;\n\t}\n\tif (registeredCommitments[commitment.id]) {\n\t\tconsole.warn(`[NQTR] Commitment id ${commitment.id} already exists, it will be overwritten`);\n\t}\n\tregisteredCommitments[commitment.id] = commitment;\n}\n\n/**\n * Get a commitment by its id.\n * @param id The id of the commitment.\n * @returns The commitment or undefined if not found.\n */\nexport function getCommitmentById(id: string): CommitmentInterface | undefined {\n\ttry {\n\t\tlet commitment = registeredCommitments[id];\n\t\tif (!commitment) {\n\t\t\tconsole.error(`[NQTR] Commitment ${id} not found`);\n\t\t\treturn;\n\t\t}\n\t\treturn commitment;\n\t} catch (e) {\n\t\tconsole.error(`[NQTR] Error while getting Commitment ${id}`, e);\n\t\treturn;\n\t}\n}\n","import { CharacterInterface, storage } from \"@drincs/pixi-vn\";\nimport { navigator } from \".\";\nimport { fixedCommitments, getCommitmentById, registeredCommitments } from \"../decorators/CommitmentDecorator\";\nimport { CommitmentInterface } from \"../interface\";\n\nconst TEMPORARY_COMMITMENT_CATEGORY_MEMORY_KEY = \"___nqtr-temporary_commitment___\";\nexport default class RoutineManager {\n\tget fixedRoutine(): CommitmentInterface[] {\n\t\treturn Object.values(fixedCommitments);\n\t}\n\t/**\n\t * Set a commitment as fixed, it will be always available. They cannot be deleted or edit during the game session.\n\t */\n\tset fixedRoutine(commitments: CommitmentInterface[]) {\n\t\tcommitments.forEach((c) => {\n\t\t\tif (fixedCommitments[c.id]) {\n\t\t\t\tconsole.warn(`[NQTR] Commitment id ${c.id} already exists, it will be overwritten`);\n\t\t\t}\n\t\t\tfixedCommitments[c.id] = c;\n\t\t});\n\t}\n\n\t/**\n\t * Get the temporary commitments by its id.\n\t * @returns The temporary commitments.\n\t */\n\tget temporaryRoutine(): CommitmentInterface[] {\n\t\tlet commitmentsIds = storage.getVariable<string[]>(TEMPORARY_COMMITMENT_CATEGORY_MEMORY_KEY);\n\t\tif (!commitmentsIds) {\n\t\t\treturn [];\n\t\t}\n\t\tlet commitments = commitmentsIds\n\t\t\t.map((id) => getCommitmentById(id))\n\t\t\t.filter((commitment) => commitment !== undefined);\n\t\treturn commitments;\n\t}\n\n\tget allRoutine(): CommitmentInterface[] {\n\t\treturn [...this.fixedRoutine, ...this.temporaryRoutine];\n\t}\n\n\t/**\n\t * This feature adds the commitments during the game session.\n\t * @param commitment The commitment or commitments to add.\n\t */\n\tadd(commitment: CommitmentInterface[] | CommitmentInterface) {\n\t\tif (!Array.isArray(commitment)) {\n\t\t\tcommitment = [commitment];\n\t\t}\n\t\tlet commitmentsIds = commitment\n\t\t\t.map((commitment) => {\n\t\t\t\tlet commitmentTest = getCommitmentById(commitment.id);\n\t\t\t\tif (!commitmentTest) {\n\t\t\t\t\tconsole.warn(`[NQTR] Commitment ${commitment.id} not found, it will be ignored`);\n\t\t\t\t\treturn undefined;\n\t\t\t\t}\n\t\t\t\treturn commitment.id;\n\t\t\t})\n\t\t\t.filter((id) => id !== undefined);\n\n\t\tstorage.setVariable(TEMPORARY_COMMITMENT_CATEGORY_MEMORY_KEY, commitmentsIds);\n\t}\n\n\t/**\n\t * Get the commitments added during the game session.\n\t * @param id The id of the commitment.\n\t * @returns The commitment or undefined if not found.\n\t */\n\tfind(id: string): CommitmentInterface | undefined {\n\t\treturn getCommitmentById(id);\n\t}\n\n\t/**\n\t * Remove the commitments added during the game session.\n\t * @param commitment The commitment or commitments to remove.\n\t */\n\tremove(commitment: CommitmentInterface[] | CommitmentInterface) {\n\t\tif (!Array.isArray(commitment)) {\n\t\t\tcommitment = [commitment];\n\t\t}\n\t\tlet commitmentsIds = commitment.map((commitment) => {\n\t\t\treturn commitment.id;\n\t\t});\n\n\t\tlet currentCommitments = storage.getVariable<string[]>(TEMPORARY_COMMITMENT_CATEGORY_MEMORY_KEY);\n\t\tif (!currentCommitments) {\n\t\t\treturn;\n\t\t}\n\t\tcurrentCommitments = currentCommitments.filter((id) => !commitmentsIds.includes(id));\n\t\tstorage.setVariable(TEMPORARY_COMMITMENT_CATEGORY_MEMORY_KEY, currentCommitments);\n\t}\n\n\t/**\n\t * Clear all the expired commitments.\n\t */\n\tclearExpiredRoutine() {\n\t\tObject.values(registeredCommitments).forEach((commitment) => {\n\t\t\tif (commitment.expired) {\n\t\t\t\tdelete registeredCommitments[commitment.id];\n\t\t\t}\n\t\t});\n\t}\n\n\t/**\n\t * Get the current commitments. The hidden commitments are not included.\n\t * In case there is a character who has two or more commitments at the same time, will be selected the commitment with the highest priority.\n\t * Higher priority commitments are calculated using the following steps:\n\t * 1. The commitments that have Commitments BaseModel.priority set to a higher value will be selected first.\n\t * 2. If there are commitments with the same priority, the commitments that are not fixed will be selected first.\n\t * 3. If there are commitments with the same priority and the same fixed status, priority will be given to the commitment with a lower index.\n\t * @returns The current commitments.\n\t */\n\tget currentRoutine(): CommitmentInterface[] {\n\t\tlet character_commitments: { [character: string]: CommitmentInterface } = {};\n\t\t[...this.temporaryRoutine, ...this.fixedRoutine].reverse().forEach((c) => {\n\t\t\tif (c.isActive) {\n\t\t\t\tif (c.characters.length > 0) {\n\t\t\t\t\t// all the characters don't already have commitments or the commitment has a higher priority\n\t\t\t\t\tlet allAvailable = c.characters.every(\n\t\t\t\t\t\t(ch) => !character_commitments[ch.id] || c.priority > character_commitments[ch.id].priority\n\t\t\t\t\t);\n\t\t\t\t\tif (allAvailable) {\n\t\t\t\t\t\tc.characters.forEach((ch) => {\n\t\t\t\t\t\t\tcharacter_commitments[ch.id] = c;\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tconsole.error(`[NQTR] The commitment ${c.id} has no characters assigned`);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t\treturn Object.values(character_commitments);\n\t}\n\n\tget currentRoomRoutine(): CommitmentInterface[] {\n\t\treturn navigator.currentRoom?.routine || [];\n\t}\n\n\t/**\n\t * Get the character commitment.\n\t * @param character The character.\n\t * @returns The commitment or undefined if not found.\n\t */\n\tgetCommitmentByCharacter(character: CharacterInterface): CommitmentInterface | undefined {\n\t\tthis.currentRoutine.forEach((c) => {\n\t\t\tif (c.characters.map((ch) => ch.id).includes(character.id)) {\n\t\t\t\treturn c;\n\t\t\t}\n\t\t});\n\t\treturn undefined;\n\t}\n}\n"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import {storage}from'@drincs/pixi-vn';var s={};function R(i){try{let e=s[i];if(!e){console.error(`[NQTR] Room ${i} not found`);return}return e}catch(e){console.error(`[NQTR] Error while getting Room ${i}`,e);return}}var _="___nqtr-current_room_memory___",c=class{get rooms(){return Object.values(s)}get locations(){let e={};return Object.values(s).forEach(t=>{e[t.location.id]=t.location;}),Object.values(e)}get maps(){let e={};return Object.values(s).forEach(t=>{e[t.location.map.id]=t.location.map;}),Object.values(e)}get currentRoom(){let e=storage.getVariable(_);if(!e){console.error("[NQTR] The current room has not yet been set");return}let t=R(e);if(!t){console.error(`[NQTR] Current room ${e} not found`);return}return t}set currentRoom(e){if(!R(e.id)){console.error(`[NQTR] The room ${e.id} is not registered, so it can't be set as current room`);return}storage.setVariable(_,e.id);}get currentLocation(){return this.currentRoom?.location}get currentMap(){return this.currentRoom?.location.map}clearExpiredActivities(){Object.entries(s).forEach(([e,t])=>{t.clearExpiredActivities();});}};var S=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 S.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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/decorators/RoomDecorator.ts","../../src/managers/NavigatorManager.ts","../../src/managers/index.ts","../../src/decorators/CommitmentDecorator.ts","../../src/managers/RoutineManager.ts"],"names":["registeredRooms","getRoomById","id","room","CURRENT_ROOM_MEMORY_KEY","NavigatorManager","result","roomId","storage","_","timeTracker","navigator","RoutineManager","questsNotebook","registeredCommitments","fixedCommitments","getCommitmentById","commitment","TEMPORARY_COMMITMENT_CATEGORY_MEMORY_KEY","commitments","c","commitmentsIds","currentCommitments","character_commitments","ch","character"],"mappings":"sCAEO,IAAMA,CAAAA,CAAmD,EAAC,CA2B1D,SAASC,CAAAA,CAAYC,EAAuC,CAClE,GAAI,CACH,IAAIC,CAAOH,CAAAA,CAAAA,CAAgBE,CAAE,CAAA,CAC7B,GAAI,CAACC,CAAAA,CAAM,CACV,OAAA,CAAQ,KAAM,CAAA,CAAA,YAAA,EAAeD,CAAE,CAAA,UAAA,CAAY,EAC3C,MACD,CACA,OAAOC,CACR,CAAS,MAAA,CAAA,C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,CAAE,EAAE,CAAA,2BAAA,CAA6B,CAG3E,EAAA,CAAC,CACM,CAAA,MAAA,CAAO,OAAOG,CAAqB,CAC3C,CAEA,IAAI,kBAA4C,EAAA,CAC/C,OAAOZ,CAAAA,CAAU,aAAa,OAAW,EAAA,EAC1C,CAOA,wBAAyBc,CAAAA,CAAAA,CAAgE,CACxF,IAAA,CAAK,eAAe,OAASL,CAAAA,CAAAA,EAAM,CAClC,GAAIA,CAAE,CAAA,UAAA,CAAW,GAAKI,CAAAA,CAAAA,EAAOA,EAAG,EAAE,CAAA,CAAE,QAASC,CAAAA,CAAAA,CAAU,EAAE,CACxD,CAAA,OAAOL,CAET,CAAC,EAEF,CACD","file":"RoutineManager.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,16 +1,7 @@
|
|
|
1
1
|
import { TimeSettings, ITimeStlot } from '../types/TimeSettings.mjs';
|
|
2
2
|
|
|
3
3
|
declare class TimeManager {
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Get time settings
|
|
7
|
-
* @default {}
|
|
8
|
-
*/
|
|
9
|
-
get settings(): TimeSettings;
|
|
10
|
-
/**
|
|
11
|
-
* Set time settings, Is very important to set the settings before using the nqtr library, bacause more of the features are based on the time settings.
|
|
12
|
-
*/
|
|
13
|
-
set settings(value: TimeSettings);
|
|
4
|
+
initialize(settings: TimeSettings): void;
|
|
14
5
|
get minDayHours(): number;
|
|
15
6
|
get maxDayHours(): number;
|
|
16
7
|
get defaultTimeSpent(): number;
|
|
@@ -77,7 +68,7 @@ declare class TimeManager {
|
|
|
77
68
|
* @param toHour the ending hour.
|
|
78
69
|
* @returns true if the current hour is between the given hours, otherwise false.
|
|
79
70
|
*/
|
|
80
|
-
nowIsBetween(fromHour: number, toHour: number): boolean;
|
|
71
|
+
nowIsBetween(fromHour: number | undefined, toHour: number | undefined): boolean;
|
|
81
72
|
}
|
|
82
73
|
|
|
83
74
|
export { TimeManager as default };
|
|
@@ -1,16 +1,7 @@
|
|
|
1
1
|
import { TimeSettings, ITimeStlot } from '../types/TimeSettings.js';
|
|
2
2
|
|
|
3
3
|
declare class TimeManager {
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Get time settings
|
|
7
|
-
* @default {}
|
|
8
|
-
*/
|
|
9
|
-
get settings(): TimeSettings;
|
|
10
|
-
/**
|
|
11
|
-
* Set time settings, Is very important to set the settings before using the nqtr library, bacause more of the features are based on the time settings.
|
|
12
|
-
*/
|
|
13
|
-
set settings(value: TimeSettings);
|
|
4
|
+
initialize(settings: TimeSettings): void;
|
|
14
5
|
get minDayHours(): number;
|
|
15
6
|
get maxDayHours(): number;
|
|
16
7
|
get defaultTimeSpent(): number;
|
|
@@ -77,7 +68,7 @@ declare class TimeManager {
|
|
|
77
68
|
* @param toHour the ending hour.
|
|
78
69
|
* @returns true if the current hour is between the given hours, otherwise false.
|
|
79
70
|
*/
|
|
80
|
-
nowIsBetween(fromHour: number, toHour: number): boolean;
|
|
71
|
+
nowIsBetween(fromHour: number | undefined, toHour: number | undefined): boolean;
|
|
81
72
|
}
|
|
82
73
|
|
|
83
74
|
export { TimeManager as default };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
'use strict';var pixiVn=require('@drincs/pixi-vn');var a="___nqtr-
|
|
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
2
|
//# sourceMappingURL=TimeManager.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/constants.ts","../../src/managers/TimeManager.ts"],"names":["TIME_SETTINGS_KEY","TIME_DATA_KEY","TimeManager","settings","data","weekLength","storage","value","result","weekDayNumber","index","slot","timeSpent","newHour","newDayHour","days","newDay","fromHour","toHour","currentHour"],"mappings":"mDAAO,IAAMA,EAAoB,kCACpBC,CAAAA,CAAAA,CAAgB,8BCI7B,CAAA,IAAqBC,CAArB,CAAA,KAAiC,CACrB,YAAA,CAAaC,EAAwB,CACzC,IAAIC,CAAY,CAAA,EAgBhB,CAAA,GAfI,OAAOD,CAAAA,CAAS,aAAgB,QAChCC,GAAAA,CAAAA,CAAK,WAAiBD,CAAAA,CAAAA,CAAS,WAE/B,CAAA,CAAA,OAAOA,CAAS,CAAA,WAAA,EAAgB,WAChCC,CAAK,CAAA,WAAA,CAAiBD,CAAS,CAAA,WAAA,CAAA,CAE/B,OAAOA,CAAAA,CAAS,WAAgB,EAAA,QAAA,GAChCC,EAAK,gBAAsBD,CAAAA,CAAAA,CAAS,gBAEpC,CAAA,CAAA,KAAA,CAAM,OAAQA,CAAAA,CAAAA,CAAS,SAAS,CAAA,GAChCC,EAAK,SAAeD,CAAAA,CAAAA,CAAS,SAE7B,CAAA,CAAA,OAAOA,CAAS,CAAA,UAAA,EAAe,QAC/BC,GAAAA,CAAAA,CAAK,WAAgBD,CAAS,CAAA,UAAA,CAAA,CAE9B,OAAOA,CAAAA,CAAS,iBAAoB,QAAU,CAAA,CAC9C,IAAIE,CAAAA,CAAaF,EAAS,UAAc,EAAA,IAAA,CAAK,UACzCA,CAAAA,CAAAA,CAAS,eAAmBE,EAAAA,CAAAA,EAC5B,OAAQ,CAAA,IAAA,CAAK,4DAA4DA,CAAU,CAAA,CAAE,CAEzFD,CAAA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UAAA,CAAaC,CAClB,CAAA,IAAA,CAAK,WAAcF,CAAAA,CAAAA,CACZ,IAAK,CAAA,UAChB,CAQA,YAAaG,CAAAA,CAAAA,CAAkBC,CAAyB,CAAA,CACpD,IAAIC,CAAAA,CAAc,IAAK,CAAA,WAAA,CACvB,OAAIF,CAAWC,CAAAA,CAAAA,CACJC,CAAeF,EAAAA,CAAAA,EAAYE,EAAcD,CAE7CC,CAAAA,CAAAA,EAAeF,CAAYE,EAAAA,CAAAA,CAAcD,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 { storage } from \"@drincs/pixi-vn\";\nimport { TIME_DATA_KEY, TIME_SETTINGS_KEY } from \"../constants\";\nimport TimeDataType from \"../types/TimeDataType\";\nimport { ITimeStlot, TimeSettings } from \"../types/TimeSettings\";\n\nexport default class TimeManager {\n private editSettings(settings: TimeSettings) {\n let data: any = {}\n if (typeof settings.minDayHours === 'number') {\n data['minDayHours'] = settings.minDayHours\n }\n if (typeof settings.maxDayHours === 'number') {\n data['maxDayHours'] = settings.maxDayHours\n }\n if (typeof settings.minDayHours === 'number') {\n data['defaultTimeSpent'] = settings.defaultTimeSpent\n }\n if (Array.isArray(settings.timeSlots)) {\n data['timeSlots'] = settings.timeSlots\n }\n if (typeof settings.weekLength === 'number') {\n data['weekLength'] = settings.weekLength\n }\n if (typeof settings.weekendStartDay === 'number') {\n let weekLength = settings.weekLength || this.weekLength\n if (settings.weekendStartDay >= weekLength) {\n console.warn(`[NQTR] Weekend start day should be less than week length ${weekLength}`)\n }\n data['weekendStartDay'] = settings.weekendStartDay\n }\n if (Array.isArray(settings.weekDaysNames)) {\n let weekLength = settings.weekLength || this.weekLength\n if (settings.weekDaysNames.length !== weekLength) {\n console.warn(`[NQTR] Week days names should be equal to week length ${weekLength}`)\n }\n data['weekDaysNames'] = settings.weekDaysNames\n }\n storage.setVariable(TIME_SETTINGS_KEY, data)\n }\n /**\n * Get time settings\n * @default {}\n */\n get settings(): TimeSettings {\n let settings = storage.getVariable<TimeSettings>(TIME_SETTINGS_KEY) || {}\n return settings\n }\n /**\n * Set time settings, Is very important to set the settings before using the nqtr library, bacause more of the features are based on the time settings.\n */\n set settings(value: TimeSettings) {\n this.editSettings(value)\n }\n get minDayHours(): number {\n let result = 0\n let settings = storage.getVariable<TimeSettings>(TIME_SETTINGS_KEY)\n if (settings && settings.hasOwnProperty('minDayHours')) {\n result = settings.minDayHours || 0\n }\n return result\n }\n get maxDayHours(): number {\n let result = 24\n let settings = storage.getVariable<TimeSettings>(TIME_SETTINGS_KEY)\n if (settings && settings.hasOwnProperty('maxDayHours')) {\n result = settings.maxDayHours || 24\n }\n return result\n }\n get defaultTimeSpent(): number {\n let result = 1\n let settings = storage.getVariable<TimeSettings>(TIME_SETTINGS_KEY)\n if (settings && settings.hasOwnProperty('defaultTimeSpent')) {\n result = settings.defaultTimeSpent || 1\n }\n return result\n }\n get timeSlots(): ITimeStlot[] {\n let result: ITimeStlot[] = []\n let settings = storage.getVariable<TimeSettings>(TIME_SETTINGS_KEY)\n if (settings && settings.hasOwnProperty('timeSlots')) {\n result = settings.timeSlots || []\n }\n return result\n }\n get weekLength(): number {\n let result = 7\n let settings = storage.getVariable<TimeSettings>(TIME_SETTINGS_KEY)\n if (settings && settings.hasOwnProperty('weekLength')) {\n result = settings.weekLength || 7\n }\n return result\n }\n get weekendStartDay(): number {\n let result = this.weekLength - 1\n let settings = storage.getVariable<TimeSettings>(TIME_SETTINGS_KEY)\n if (settings && settings.hasOwnProperty('weekendStartDay')) {\n result = settings.weekendStartDay || this.weekLength - 1\n }\n return result\n }\n get weekDaysNames(): string[] {\n let result: string[] = []\n let settings = storage.getVariable<TimeSettings>(TIME_SETTINGS_KEY)\n if (settings && settings.hasOwnProperty('weekDaysNames')) {\n result = settings.weekDaysNames || result\n }\n return result\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, toHour: number): boolean {\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
|
+
{"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,CAAAA,CAAAA,CAClCJ,CAAoB,CAAA,gBAAA,CAAmBK,CACvCL,CAAAA,CAAAA,CAAoB,UAAYM,CAChCN,CAAAA,CAAAA,CAAoB,UAAaO,CAAAA,CAAAA,CAC7BC,CAAmBR,EAAAA,CAAAA,CAAoB,WACvC,OAAQ,CAAA,IAAA,CAAK,CAA4DO,yDAAAA,EAAAA,CAAU,CAAsB,oBAAA,CAAA,CAAA,CAGzGP,EAAoB,eAAkBQ,CAAAA,CAAAA,CAEtCC,CAAc,CAAA,MAAA,GAAWF,CACzB,CAAA,OAAA,CAAQ,KAAK,CAAyDA,sDAAAA,EAAAA,CAAU,CAAsB,oBAAA,C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U,OAAS,CACnC,CAQA,YAAaE,CAAAA,CAAAA,CAAoB,IAAK,CAAA,gBAAA,CAA0B,CAC5D,IAAIC,CAAAA,CAAU,IAAK,CAAA,WAAA,CAAcD,CACjC,CAAA,OAAIC,GAAW,IAAK,CAAA,WAAA,GAChB,IAAK,CAAA,WAAA,EACLA,CAAAA,CAAAA,CAAU,KAAK,WAAeA,EAAAA,CAAAA,CAAU,IAAK,CAAA,WAAA,CAAA,CAAA,CAEjD,IAAK,CAAA,WAAA,CAAcA,EACZ,IAAK,CAAA,WAChB,CAQA,WAAA,CAAYC,CAAqB,CAAA,IAAA,CAAK,YAAaC,CAAe,CAAA,CAAA,CAAW,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.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 +1,2 @@
|
|
|
1
|
-
import {storage}from'@drincs/pixi-vn';var a="___nqtr-
|
|
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
2
|
//# sourceMappingURL=TimeManager.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/constants.ts","../../src/managers/TimeManager.ts"],"names":["TIME_SETTINGS_KEY","TIME_DATA_KEY","TimeManager","settings","data","weekLength","storage","value","result","weekDayNumber","index","slot","timeSpent","newHour","newDayHour","days","newDay","fromHour","toHour","currentHour"],"mappings":"sCAAO,IAAMA,EAAoB,kCACpBC,CAAAA,CAAAA,CAAgB,8BCI7B,CAAA,IAAqBC,CAArB,CAAA,KAAiC,CACrB,YAAA,CAAaC,EAAwB,CACzC,IAAIC,CAAY,CAAA,EAgBhB,CAAA,GAfI,OAAOD,CAAAA,CAAS,aAAgB,QAChCC,GAAAA,CAAAA,CAAK,WAAiBD,CAAAA,CAAAA,CAAS,WAE/B,CAAA,CAAA,OAAOA,CAAS,CAAA,WAAA,EAAgB,WAChCC,CAAK,CAAA,WAAA,CAAiBD,CAAS,CAAA,WAAA,CAAA,CAE/B,OAAOA,CAAAA,CAAS,WAAgB,EAAA,QAAA,GAChCC,EAAK,gBAAsBD,CAAAA,CAAAA,CAAS,gBAEpC,CAAA,CAAA,KAAA,CAAM,OAAQA,CAAAA,CAAAA,CAAS,SAAS,CAAA,GAChCC,EAAK,SAAeD,CAAAA,CAAAA,CAAS,SAE7B,CAAA,CAAA,OAAOA,CAAS,CAAA,UAAA,EAAe,QAC/BC,GAAAA,CAAAA,CAAK,WAAgBD,CAAS,CAAA,UAAA,CAAA,CAE9B,OAAOA,CAAAA,CAAS,iBAAoB,QAAU,CAAA,CAC9C,I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AAA,CAAK,WAChB,CAQA,WAAYC,CAAAA,CAAAA,CAAqB,KAAK,WAAaC,CAAAA,CAAAA,CAAe,CAAW,CAAA,CACzE,IAAIC,CAAAA,CAAS,IAAK,CAAA,UAAA,CAAaD,EAC/B,OAAK,IAAA,CAAA,UAAA,CAAaC,CAClB,CAAA,IAAA,CAAK,WAAcF,CAAAA,CAAAA,CACZ,IAAK,CAAA,UAChB,CAQA,YAAaG,CAAAA,CAAAA,CAAkBC,CAAyB,CAAA,CACpD,IAAIC,CAAAA,CAAc,IAAK,CAAA,WAAA,CACvB,OAAIF,CAAWC,CAAAA,CAAAA,CACJC,CAAeF,EAAAA,CAAAA,EAAYE,EAAcD,CAE7CC,CAAAA,CAAAA,EAAeF,CAAYE,EAAAA,CAAAA,CAAcD,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 { storage } from \"@drincs/pixi-vn\";\nimport { TIME_DATA_KEY, TIME_SETTINGS_KEY } from \"../constants\";\nimport TimeDataType from \"../types/TimeDataType\";\nimport { ITimeStlot, TimeSettings } from \"../types/TimeSettings\";\n\nexport default class TimeManager {\n private editSettings(settings: TimeSettings) {\n let data: any = {}\n if (typeof settings.minDayHours === 'number') {\n data['minDayHours'] = settings.minDayHours\n }\n if (typeof settings.maxDayHours === 'number') {\n data['maxDayHours'] = settings.maxDayHours\n }\n if (typeof settings.minDayHours === 'number') {\n data['defaultTimeSpent'] = settings.defaultTimeSpent\n }\n if (Array.isArray(settings.timeSlots)) {\n data['timeSlots'] = settings.timeSlots\n }\n if (typeof settings.weekLength === 'number') {\n data['weekLength'] = settings.weekLength\n }\n if (typeof settings.weekendStartDay === 'number') {\n let weekLength = settings.weekLength || this.weekLength\n if (settings.weekendStartDay >= weekLength) {\n console.warn(`[NQTR] Weekend start day should be less than week length ${weekLength}`)\n }\n data['weekendStartDay'] = settings.weekendStartDay\n }\n if (Array.isArray(settings.weekDaysNames)) {\n let weekLength = settings.weekLength || this.weekLength\n if (settings.weekDaysNames.length !== weekLength) {\n console.warn(`[NQTR] Week days names should be equal to week length ${weekLength}`)\n }\n data['weekDaysNames'] = settings.weekDaysNames\n }\n storage.setVariable(TIME_SETTINGS_KEY, data)\n }\n /**\n * Get time settings\n * @default {}\n */\n get settings(): TimeSettings {\n let settings = storage.getVariable<TimeSettings>(TIME_SETTINGS_KEY) || {}\n return settings\n }\n /**\n * Set time settings, Is very important to set the settings before using the nqtr library, bacause more of the features are based on the time settings.\n */\n set settings(value: TimeSettings) {\n this.editSettings(value)\n }\n get minDayHours(): number {\n let result = 0\n let settings = storage.getVariable<TimeSettings>(TIME_SETTINGS_KEY)\n if (settings && settings.hasOwnProperty('minDayHours')) {\n result = settings.minDayHours || 0\n }\n return result\n }\n get maxDayHours(): number {\n let result = 24\n let settings = storage.getVariable<TimeSettings>(TIME_SETTINGS_KEY)\n if (settings && settings.hasOwnProperty('maxDayHours')) {\n result = settings.maxDayHours || 24\n }\n return result\n }\n get defaultTimeSpent(): number {\n let result = 1\n let settings = storage.getVariable<TimeSettings>(TIME_SETTINGS_KEY)\n if (settings && settings.hasOwnProperty('defaultTimeSpent')) {\n result = settings.defaultTimeSpent || 1\n }\n return result\n }\n get timeSlots(): ITimeStlot[] {\n let result: ITimeStlot[] = []\n let settings = storage.getVariable<TimeSettings>(TIME_SETTINGS_KEY)\n if (settings && settings.hasOwnProperty('timeSlots')) {\n result = settings.timeSlots || []\n }\n return result\n }\n get weekLength(): number {\n let result = 7\n let settings = storage.getVariable<TimeSettings>(TIME_SETTINGS_KEY)\n if (settings && settings.hasOwnProperty('weekLength')) {\n result = settings.weekLength || 7\n }\n return result\n }\n get weekendStartDay(): number {\n let result = this.weekLength - 1\n let settings = storage.getVariable<TimeSettings>(TIME_SETTINGS_KEY)\n if (settings && settings.hasOwnProperty('weekendStartDay')) {\n result = settings.weekendStartDay || this.weekLength - 1\n }\n return result\n }\n get weekDaysNames(): string[] {\n let result: string[] = []\n let settings = storage.getVariable<TimeSettings>(TIME_SETTINGS_KEY)\n if (settings && settings.hasOwnProperty('weekDaysNames')) {\n result = settings.weekDaysNames || result\n }\n return result\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, toHour: number): boolean {\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
|
+
{"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,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,CAAAA,CAAAA,CAClCJ,CAAoB,CAAA,gBAAA,CAAmBK,CACvCL,CAAAA,CAAAA,CAAoB,UAAYM,CAChCN,CAAAA,CAAAA,CAAoB,UAAaO,CAAAA,CAAAA,CAC7BC,CAAmBR,EAAAA,CAAAA,CAAoB,WACvC,OAAQ,CAAA,IAAA,CAAK,CAA4DO,yDAAAA,EAAAA,CAAU,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,CAC5B,EAAA,IAAA,CAAK,YAAaC,CAAAA,CAAAA,CAAK,UAAW,IAAK,CAAA,SAAA,CAAUD,CAAQ,CAAA,CAAC,CAAE,CAAA,SAAS,EACrE,OAAOA,CAGnB,CACA,OAAO,IAAK,CAAA,SAAA,CAAU,OAAS,CACnC,CAQA,YAAaE,CAAAA,CAAAA,CAAoB,IAAK,CAAA,gBAAA,CAA0B,CAC5D,IAAIC,CAAAA,CAAU,IAAK,CAAA,WAAA,CAAcD,CACjC,CAAA,OAAIC,GAAW,IAAK,CAAA,WAAA,GAChB,IAAK,CAAA,WAAA,EACLA,CAAAA,CAAAA,CAAU,KAAK,WAAeA,EAAAA,CAAAA,CAAU,IAAK,CAAA,WAAA,CAAA,CAAA,CAEjD,IAAK,CAAA,WAAA,CAAcA,EACZ,IAAK,CAAA,WAChB,CAQA,WAAA,CAAYC,CAAqB,CAAA,IAAA,CAAK,YAAaC,CAAe,CAAA,CAAA,CAAW,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"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
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 };
|
|
@@ -0,0 +1,13 @@
|
|
|
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 };
|
|
@@ -0,0 +1,2 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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,6 +1,19 @@
|
|
|
1
|
+
import NavigatorManager from './NavigatorManager.mjs';
|
|
2
|
+
import QuestManager from './QuestManager.mjs';
|
|
3
|
+
import RoutineManager from './RoutineManager.mjs';
|
|
1
4
|
import TimeManager from './TimeManager.mjs';
|
|
5
|
+
import '../RoomInterface-C7Sg80EF.mjs';
|
|
6
|
+
import '@drincs/nqtr/dist/override';
|
|
7
|
+
import '@drincs/pixi-vn';
|
|
8
|
+
import '../interface/ActivityInterface.mjs';
|
|
9
|
+
import '../types/ExecutionType.mjs';
|
|
10
|
+
import '../interface/navigation/NavigationAbstractClass.mjs';
|
|
11
|
+
import '../StageInterface-DmLgfrk4.mjs';
|
|
2
12
|
import '../types/TimeSettings.mjs';
|
|
3
13
|
|
|
4
14
|
declare const timeTracker: TimeManager;
|
|
15
|
+
declare const navigator: NavigatorManager;
|
|
16
|
+
declare const routine: RoutineManager;
|
|
17
|
+
declare const questsNotebook: QuestManager;
|
|
5
18
|
|
|
6
|
-
export { timeTracker };
|
|
19
|
+
export { navigator, questsNotebook, routine, timeTracker };
|