@drincs/nqtr 0.2.12 → 0.2.14
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-BOE1uacE.d.mts +78 -0
- package/dist/RoomInterface-BswqipsF.d.ts +78 -0
- package/dist/StageInterface-DgeEtkqv.d.mts +162 -0
- package/dist/StageInterface-DgeEtkqv.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 -1700
- package/dist/classes/index.js.map +1 -1
- package/dist/classes/index.mjs +1 -1691
- 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/constants.d.mts +4 -0
- package/dist/constants.d.ts +4 -0
- package/dist/constants.js +2 -0
- package/dist/constants.js.map +1 -0
- package/dist/constants.mjs +2 -0
- package/dist/constants.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 -407
- package/dist/decorators/ActivityDecorator.js.map +1 -1
- package/dist/decorators/ActivityDecorator.mjs +1 -403
- package/dist/decorators/ActivityDecorator.mjs.map +1 -1
- package/dist/decorators/CommitmentDecorator.d.mts +9 -37
- package/dist/decorators/CommitmentDecorator.d.ts +9 -37
- package/dist/decorators/CommitmentDecorator.js +1 -91
- package/dist/decorators/CommitmentDecorator.js.map +1 -1
- package/dist/decorators/CommitmentDecorator.mjs +1 -81
- 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 -799
- package/dist/decorators/QuestDecorator.js.map +1 -1
- package/dist/decorators/QuestDecorator.mjs +1 -794
- package/dist/decorators/QuestDecorator.mjs.map +1 -1
- package/dist/decorators/RoomDecorator.d.mts +8 -32
- package/dist/decorators/RoomDecorator.d.ts +8 -32
- package/dist/decorators/RoomDecorator.js +1 -56
- package/dist/decorators/RoomDecorator.js.map +1 -1
- package/dist/decorators/RoomDecorator.mjs +1 -48
- 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 -1068
- package/dist/decorators/index.js.map +1 -1
- package/dist/decorators/index.mjs +1 -1053
- 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 -293
- package/dist/functions/index.js.map +1 -1
- package/dist/functions/index.mjs +1 -281
- package/dist/functions/index.mjs.map +1 -1
- package/dist/index.d.mts +62 -18
- package/dist/index.d.ts +62 -18
- package/dist/index.js +1 -2058
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -2023
- 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/ActivityProps.js +1 -3
- package/dist/interface/ActivityProps.js.map +1 -1
- package/dist/interface/ActivityProps.mjs +1 -2
- package/dist/interface/ActivityProps.mjs.map +1 -1
- 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 +78 -7
- package/dist/interface/CommitmentProps.d.ts +78 -7
- package/dist/interface/CommitmentProps.js +1 -3
- package/dist/interface/CommitmentProps.js.map +1 -1
- package/dist/interface/CommitmentProps.mjs +1 -2
- package/dist/interface/CommitmentProps.mjs.map +1 -1
- package/dist/interface/index.d.mts +12 -8
- package/dist/interface/index.d.ts +12 -8
- package/dist/interface/index.js +1 -3
- package/dist/interface/index.js.map +1 -1
- package/dist/interface/index.mjs +1 -2
- package/dist/interface/index.mjs.map +1 -1
- 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/LocationInterface.js.map +1 -0
- 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/QuestProps.js +1 -3
- package/dist/interface/quest/QuestProps.js.map +1 -1
- package/dist/interface/quest/QuestProps.mjs +1 -2
- package/dist/interface/quest/QuestProps.mjs.map +1 -1
- package/dist/interface/quest/StageFlags.js +1 -3
- package/dist/interface/quest/StageFlags.js.map +1 -1
- package/dist/interface/quest/StageFlags.mjs +1 -2
- package/dist/interface/quest/StageFlags.mjs.map +1 -1
- 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/interface/quest/StageProps.js +1 -3
- package/dist/interface/quest/StageProps.js.map +1 -1
- package/dist/interface/quest/StageProps.mjs +1 -2
- package/dist/interface/quest/StageProps.mjs.map +1 -1
- 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 +28 -38
- package/dist/managers/TimeManager.d.ts +28 -38
- package/dist/managers/TimeManager.js +1 -250
- package/dist/managers/TimeManager.js.map +1 -1
- package/dist/managers/TimeManager.mjs +1 -248
- 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 +18 -1
- package/dist/managers/index.d.ts +18 -1
- package/dist/managers/index.js +1 -250
- package/dist/managers/index.js.map +1 -1
- package/dist/managers/index.mjs +1 -248
- 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/GraphicItemInterface.js +1 -3
- package/dist/override/GraphicItemInterface.js.map +1 -1
- package/dist/override/GraphicItemInterface.mjs +1 -2
- package/dist/override/GraphicItemInterface.mjs.map +1 -1
- 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/override/LocationInterface.js.map +1 -0
- 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/OnRenderGraphicItemProps.js +1 -3
- package/dist/override/OnRenderGraphicItemProps.js.map +1 -1
- package/dist/override/OnRenderGraphicItemProps.mjs +1 -2
- package/dist/override/OnRenderGraphicItemProps.mjs.map +1 -1
- package/dist/override/OnRunProps.js +1 -3
- package/dist/override/OnRunProps.js.map +1 -1
- package/dist/override/OnRunProps.mjs +1 -2
- package/dist/override/OnRunProps.mjs.map +1 -1
- package/dist/override/OnStartEndStageQuest.js +1 -3
- package/dist/override/OnStartEndStageQuest.js.map +1 -1
- package/dist/override/OnStartEndStageQuest.mjs +1 -2
- package/dist/override/OnStartEndStageQuest.mjs.map +1 -1
- 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/override/index.js +1 -3
- package/dist/override/index.js.map +1 -1
- package/dist/override/index.mjs +1 -2
- package/dist/override/index.mjs.map +1 -1
- package/dist/types/ExecutionType.js +1 -3
- package/dist/types/ExecutionType.js.map +1 -1
- package/dist/types/ExecutionType.mjs +1 -2
- package/dist/types/ExecutionType.mjs.map +1 -1
- 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/OnRunEvent.js.map +1 -0
- package/dist/types/OnRunEvent.mjs +2 -0
- package/dist/types/OnRunEvent.mjs.map +1 -0
- package/dist/types/QuestsRequired.d.mts +1 -5
- package/dist/types/QuestsRequired.d.ts +1 -5
- package/dist/types/QuestsRequired.js +1 -3
- package/dist/types/QuestsRequired.js.map +1 -1
- package/dist/types/QuestsRequired.mjs +1 -2
- package/dist/types/QuestsRequired.mjs.map +1 -1
- package/dist/types/TimeDataType.d.mts +6 -0
- package/dist/types/TimeDataType.d.ts +6 -0
- package/dist/types/TimeDataType.js +2 -0
- package/dist/types/TimeDataType.js.map +1 -0
- package/dist/types/TimeDataType.mjs +2 -0
- package/dist/types/TimeDataType.mjs.map +1 -0
- package/dist/types/TimeSettings.d.mts +1 -1
- package/dist/types/TimeSettings.d.ts +1 -1
- package/dist/types/TimeSettings.js +1 -3
- package/dist/types/TimeSettings.js.map +1 -1
- package/dist/types/TimeSettings.mjs +1 -2
- package/dist/types/TimeSettings.mjs.map +1 -1
- package/dist/types/index.d.mts +1 -5
- package/dist/types/index.d.ts +1 -5
- package/dist/types/index.js +1 -3
- package/dist/types/index.js.map +1 -1
- package/dist/types/index.mjs +1 -2
- package/dist/types/index.mjs.map +1 -1
- package/package.json +7 -7
- package/dist/ActivityProps-BkHX8xkA.d.ts +0 -124
- package/dist/ActivityProps-D45DQdcT.d.mts +0 -124
- package/dist/Commitment-C_qBgeF9.d.ts +0 -586
- package/dist/Commitment-DJD0f8AH.d.mts +0 -586
- package/dist/StageProps-CCjGI625.d.ts +0 -326
- package/dist/StageProps-CuE_n1Wg.d.mts +0 -326
- package/dist/classes/Activity.d.mts +0 -112
- package/dist/classes/Activity.d.ts +0 -112
- package/dist/classes/Activity.js +0 -382
- package/dist/classes/Activity.js.map +0 -1
- package/dist/classes/Activity.mjs +0 -380
- 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 -399
- package/dist/classes/ActivityStoredAbstract.js.map +0 -1
- package/dist/classes/ActivityStoredAbstract.mjs +0 -397
- 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 -439
- package/dist/classes/Commitment.js.map +0 -1
- package/dist/classes/Commitment.mjs +0 -437
- 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 -449
- package/dist/classes/navigation/ActivityRoom.js.map +0 -1
- package/dist/classes/navigation/ActivityRoom.mjs +0 -447
- 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 -119
- package/dist/classes/navigation/Location.js.map +0 -1
- package/dist/classes/navigation/Location.mjs +0 -117
- 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 -115
- package/dist/classes/navigation/Map.js.map +0 -1
- package/dist/classes/navigation/Map.mjs +0 -113
- 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 -779
- package/dist/classes/navigation/Room.js.map +0 -1
- package/dist/classes/navigation/Room.mjs +0 -774
- 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 -86
- package/dist/classes/quest/Goal.js.map +0 -1
- package/dist/classes/quest/Goal.mjs +0 -81
- 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 -770
- package/dist/classes/quest/Quest.js.map +0 -1
- package/dist/classes/quest/Quest.mjs +0 -768
- 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 -537
- package/dist/classes/quest/Stage.js.map +0 -1
- package/dist/classes/quest/Stage.mjs +0 -532
- 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 -54
- package/dist/functions/ActivityFunctions.js.map +0 -1
- package/dist/functions/ActivityFunctions.mjs +0 -51
- 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 -182
- package/dist/functions/NavigationFunctions.js.map +0 -1
- package/dist/functions/NavigationFunctions.mjs +0 -177
- 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 -21
- package/dist/functions/QuestFunctions.js.map +0 -1
- package/dist/functions/QuestFunctions.mjs +0 -19
- 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 -127
- package/dist/functions/RoutineFunctions.js.map +0 -1
- package/dist/functions/RoutineFunctions.mjs +0 -122
- 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 -4
- package/dist/interface/RoomActivityMemory.js.map +0 -1
- package/dist/interface/RoomActivityMemory.mjs +0 -3
- 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 -4
- package/dist/interface/RoomProps.js.map +0 -1
- package/dist/interface/RoomProps.mjs +0 -3
- 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 -4
- package/dist/interface/navigation/LocationProps.js.map +0 -1
- package/dist/interface/navigation/LocationProps.mjs +0 -3
- package/dist/interface/navigation/LocationProps.mjs.map +0 -1
- 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 -4
- package/dist/interface/navigation/MapProps.js.map +0 -1
- package/dist/interface/navigation/MapProps.mjs +0 -3
- 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 -4
- package/dist/interface/quest/GoalProps.js.map +0 -1
- package/dist/interface/quest/GoalProps.mjs +0 -3
- 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 -4
- package/dist/override/GraphicItemType.js.map +0 -1
- package/dist/override/GraphicItemType.mjs +0 -3
- 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 -4
- package/dist/override/NeighboringMapsInterface.js.map +0 -1
- package/dist/override/NeighboringMapsInterface.mjs +0 -3
- 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 -4
- package/dist/types/OnRunActivityEvent.js.map +0 -1
- package/dist/types/OnRunActivityEvent.mjs +0 -3
- package/dist/types/OnRunActivityEvent.mjs.map +0 -1
- package/dist/types/OnRunCommitmentEvent.d.mts +0 -8
- package/dist/types/OnRunCommitmentEvent.d.ts +0 -8
- package/dist/types/OnRunCommitmentEvent.js +0 -4
- package/dist/types/OnRunCommitmentEvent.js.map +0 -1
- package/dist/types/OnRunCommitmentEvent.mjs +0 -3
- package/dist/types/OnRunCommitmentEvent.mjs.map +0 -1
package/dist/classes/index.js
CHANGED
|
@@ -1,1701 +1,2 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var pixiVn = require('@drincs/pixi-vn');
|
|
4
|
-
|
|
5
|
-
var __defProp = Object.defineProperty;
|
|
6
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
9
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
10
|
-
var __spreadValues = (a, b) => {
|
|
11
|
-
for (var prop in b || (b = {}))
|
|
12
|
-
if (__hasOwnProp.call(b, prop))
|
|
13
|
-
__defNormalProp(a, prop, b[prop]);
|
|
14
|
-
if (__getOwnPropSymbols)
|
|
15
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
16
|
-
if (__propIsEnum.call(b, prop))
|
|
17
|
-
__defNormalProp(a, prop, b[prop]);
|
|
18
|
-
}
|
|
19
|
-
return a;
|
|
20
|
-
};
|
|
21
|
-
var TIME_SETTINGS_KEY = "___nqtr-time_manager_settings___";
|
|
22
|
-
var TIME_DATA_KEY = "___nqtr-time_manager_data___";
|
|
23
|
-
var TimeManager = class _TimeManager {
|
|
24
|
-
constructor() {
|
|
25
|
-
}
|
|
26
|
-
static editSettings(settings) {
|
|
27
|
-
let data = {};
|
|
28
|
-
if (typeof settings.minDayHours === "number") {
|
|
29
|
-
data["minDayHours"] = settings.minDayHours;
|
|
30
|
-
}
|
|
31
|
-
if (typeof settings.maxDayHours === "number") {
|
|
32
|
-
data["maxDayHours"] = settings.maxDayHours;
|
|
33
|
-
}
|
|
34
|
-
if (typeof settings.minDayHours === "number") {
|
|
35
|
-
data["defaultTimeSpent"] = settings.defaultTimeSpent;
|
|
36
|
-
}
|
|
37
|
-
if (Array.isArray(settings.timeSlots)) {
|
|
38
|
-
data["timeSlots"] = settings.timeSlots;
|
|
39
|
-
}
|
|
40
|
-
if (typeof settings.weekLength === "number") {
|
|
41
|
-
data["weekLength"] = settings.weekLength;
|
|
42
|
-
}
|
|
43
|
-
if (typeof settings.weekendStartDay === "number") {
|
|
44
|
-
let weekLength = settings.weekLength || _TimeManager.weekLength;
|
|
45
|
-
if (settings.weekendStartDay >= weekLength) {
|
|
46
|
-
console.warn(`[NQTR] Weekend start day should be less than week length ${weekLength}`);
|
|
47
|
-
}
|
|
48
|
-
data["weekendStartDay"] = settings.weekendStartDay;
|
|
49
|
-
}
|
|
50
|
-
if (Array.isArray(settings.weekDaysNames)) {
|
|
51
|
-
let weekLength = settings.weekLength || _TimeManager.weekLength;
|
|
52
|
-
if (settings.weekDaysNames.length !== weekLength) {
|
|
53
|
-
console.warn(`[NQTR] Week days names should be equal to week length ${weekLength}`);
|
|
54
|
-
}
|
|
55
|
-
data["weekDaysNames"] = settings.weekDaysNames;
|
|
56
|
-
}
|
|
57
|
-
pixiVn.GameStorageManager.setVariable(TIME_SETTINGS_KEY, data);
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* Get time settings
|
|
61
|
-
* @default {}
|
|
62
|
-
*/
|
|
63
|
-
static get settings() {
|
|
64
|
-
let settings = pixiVn.GameStorageManager.getVariable(TIME_SETTINGS_KEY) || {};
|
|
65
|
-
return settings;
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* 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.
|
|
69
|
-
*/
|
|
70
|
-
static set settings(value) {
|
|
71
|
-
_TimeManager.editSettings(value);
|
|
72
|
-
}
|
|
73
|
-
static get minDayHours() {
|
|
74
|
-
let result = 0;
|
|
75
|
-
let settings = pixiVn.GameStorageManager.getVariable(TIME_SETTINGS_KEY);
|
|
76
|
-
if (settings && settings.hasOwnProperty("minDayHours")) {
|
|
77
|
-
result = settings.minDayHours || 0;
|
|
78
|
-
}
|
|
79
|
-
return result;
|
|
80
|
-
}
|
|
81
|
-
static get maxDayHours() {
|
|
82
|
-
let result = 24;
|
|
83
|
-
let settings = pixiVn.GameStorageManager.getVariable(TIME_SETTINGS_KEY);
|
|
84
|
-
if (settings && settings.hasOwnProperty("maxDayHours")) {
|
|
85
|
-
result = settings.maxDayHours || 24;
|
|
86
|
-
}
|
|
87
|
-
return result;
|
|
88
|
-
}
|
|
89
|
-
static get defaultTimeSpent() {
|
|
90
|
-
let result = 1;
|
|
91
|
-
let settings = pixiVn.GameStorageManager.getVariable(TIME_SETTINGS_KEY);
|
|
92
|
-
if (settings && settings.hasOwnProperty("defaultTimeSpent")) {
|
|
93
|
-
result = settings.defaultTimeSpent || 1;
|
|
94
|
-
}
|
|
95
|
-
return result;
|
|
96
|
-
}
|
|
97
|
-
static get timeSlots() {
|
|
98
|
-
let result = [];
|
|
99
|
-
let settings = pixiVn.GameStorageManager.getVariable(TIME_SETTINGS_KEY);
|
|
100
|
-
if (settings && settings.hasOwnProperty("timeSlots")) {
|
|
101
|
-
result = settings.timeSlots || [];
|
|
102
|
-
}
|
|
103
|
-
return result;
|
|
104
|
-
}
|
|
105
|
-
static get weekLength() {
|
|
106
|
-
let result = 7;
|
|
107
|
-
let settings = pixiVn.GameStorageManager.getVariable(TIME_SETTINGS_KEY);
|
|
108
|
-
if (settings && settings.hasOwnProperty("weekLength")) {
|
|
109
|
-
result = settings.weekLength || 7;
|
|
110
|
-
}
|
|
111
|
-
return result;
|
|
112
|
-
}
|
|
113
|
-
static get weekendStartDay() {
|
|
114
|
-
let result = _TimeManager.weekLength - 1;
|
|
115
|
-
let settings = pixiVn.GameStorageManager.getVariable(TIME_SETTINGS_KEY);
|
|
116
|
-
if (settings && settings.hasOwnProperty("weekendStartDay")) {
|
|
117
|
-
result = settings.weekendStartDay || _TimeManager.weekLength - 1;
|
|
118
|
-
}
|
|
119
|
-
return result;
|
|
120
|
-
}
|
|
121
|
-
static get weekDaysNames() {
|
|
122
|
-
let result = [];
|
|
123
|
-
let settings = pixiVn.GameStorageManager.getVariable(TIME_SETTINGS_KEY);
|
|
124
|
-
if (settings && settings.hasOwnProperty("weekDaysNames")) {
|
|
125
|
-
result = settings.weekDaysNames || result;
|
|
126
|
-
}
|
|
127
|
-
return result;
|
|
128
|
-
}
|
|
129
|
-
/**
|
|
130
|
-
* Get the current hour
|
|
131
|
-
*/
|
|
132
|
-
static get currentHour() {
|
|
133
|
-
let data = pixiVn.GameStorageManager.getVariable(TIME_DATA_KEY) || {};
|
|
134
|
-
if (data.hasOwnProperty("currentHour") && typeof data.currentHour === "number") {
|
|
135
|
-
return data.currentHour;
|
|
136
|
-
}
|
|
137
|
-
return _TimeManager.minDayHours;
|
|
138
|
-
}
|
|
139
|
-
static set currentHour(value) {
|
|
140
|
-
let data = pixiVn.GameStorageManager.getVariable(TIME_DATA_KEY) || {};
|
|
141
|
-
if (typeof value === "number") {
|
|
142
|
-
data.currentHour = value;
|
|
143
|
-
} else {
|
|
144
|
-
delete data.currentHour;
|
|
145
|
-
}
|
|
146
|
-
pixiVn.GameStorageManager.setVariable(TIME_DATA_KEY, data);
|
|
147
|
-
}
|
|
148
|
-
/**
|
|
149
|
-
* Get the current day
|
|
150
|
-
*/
|
|
151
|
-
static get currentDay() {
|
|
152
|
-
let data = pixiVn.GameStorageManager.getVariable(TIME_DATA_KEY) || {};
|
|
153
|
-
if (data.hasOwnProperty("currentDay") && typeof data.currentDay === "number") {
|
|
154
|
-
return data.currentDay;
|
|
155
|
-
}
|
|
156
|
-
return 0;
|
|
157
|
-
}
|
|
158
|
-
static set currentDay(value) {
|
|
159
|
-
let data = pixiVn.GameStorageManager.getVariable(TIME_DATA_KEY) || {};
|
|
160
|
-
if (typeof value === "number") {
|
|
161
|
-
data.currentDay = value;
|
|
162
|
-
} else {
|
|
163
|
-
delete data.currentDay;
|
|
164
|
-
}
|
|
165
|
-
pixiVn.GameStorageManager.setVariable(TIME_DATA_KEY, data);
|
|
166
|
-
}
|
|
167
|
-
/**
|
|
168
|
-
* If the current day is greater than or equal to the weekend start day, then it will return true.
|
|
169
|
-
*/
|
|
170
|
-
static get isWeekend() {
|
|
171
|
-
return _TimeManager.currentWeekDayNumber >= _TimeManager.weekendStartDay;
|
|
172
|
-
}
|
|
173
|
-
/**
|
|
174
|
-
* Get the current week day number (1-TimeManager.weekLength).
|
|
175
|
-
* For example, if the week length is 7 and the current day is 10, then the result will be 4.
|
|
176
|
-
*/
|
|
177
|
-
static get currentWeekDayNumber() {
|
|
178
|
-
let result = _TimeManager.currentDay % _TimeManager.weekLength;
|
|
179
|
-
return result + 1;
|
|
180
|
-
}
|
|
181
|
-
/**
|
|
182
|
-
* Get the current week day name. If the week days names are not defined, then it will return undefined.
|
|
183
|
-
* 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'.
|
|
184
|
-
* @default ""
|
|
185
|
-
*/
|
|
186
|
-
static get currentDayName() {
|
|
187
|
-
let weekDayNumber = _TimeManager.currentWeekDayNumber - 1;
|
|
188
|
-
if (weekDayNumber >= _TimeManager.weekDaysNames.length) {
|
|
189
|
-
console.warn(`[NQTR] Week day name is not defined for day ${weekDayNumber}`, _TimeManager.weekDaysNames);
|
|
190
|
-
return "";
|
|
191
|
-
}
|
|
192
|
-
return _TimeManager.weekDaysNames[weekDayNumber];
|
|
193
|
-
}
|
|
194
|
-
/**
|
|
195
|
-
* Get the current TimeManager.timeSlots index.
|
|
196
|
-
* You can use this property to create "Image that changes based on the time period":
|
|
197
|
-
* @example
|
|
198
|
-
* ```tsx
|
|
199
|
-
* import { TimeManager } from '@drincs/nqtr';
|
|
200
|
-
*
|
|
201
|
-
* function changeBackground() {
|
|
202
|
-
* return (
|
|
203
|
-
* <img src={`background-${TimeManager.currentTimeSlot}.png`} />
|
|
204
|
-
* )
|
|
205
|
-
* }
|
|
206
|
-
*/
|
|
207
|
-
static get currentTimeSlot() {
|
|
208
|
-
if (_TimeManager.timeSlots.length === 0) {
|
|
209
|
-
console.warn("[NQTR] Time slots are not defined");
|
|
210
|
-
return 0;
|
|
211
|
-
}
|
|
212
|
-
for (let index = 0; index < _TimeManager.timeSlots.length; index++) {
|
|
213
|
-
let slot = _TimeManager.timeSlots[index];
|
|
214
|
-
if (_TimeManager.timeSlots.length > index + 1) {
|
|
215
|
-
if (_TimeManager.nowIsBetween(slot.startHour, _TimeManager.timeSlots[index + 1].startHour)) {
|
|
216
|
-
return index;
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
return _TimeManager.timeSlots.length - 1;
|
|
221
|
-
}
|
|
222
|
-
/**
|
|
223
|
-
* This function will increase the current hour by the given time spent.
|
|
224
|
-
* 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.
|
|
225
|
-
* @param timeSpent is the time spent in hours (default: TimeManager.defaultTimeSpent)
|
|
226
|
-
* @returns TimeManager.currentHour
|
|
227
|
-
*/
|
|
228
|
-
static increaseHour(timeSpent = _TimeManager.defaultTimeSpent) {
|
|
229
|
-
let newHour = _TimeManager.currentHour + timeSpent;
|
|
230
|
-
if (newHour >= _TimeManager.maxDayHours) {
|
|
231
|
-
_TimeManager.increaseDay();
|
|
232
|
-
newHour = _TimeManager.minDayHours + (newHour - _TimeManager.maxDayHours);
|
|
233
|
-
}
|
|
234
|
-
_TimeManager.currentHour = newHour;
|
|
235
|
-
return _TimeManager.currentHour;
|
|
236
|
-
}
|
|
237
|
-
/**
|
|
238
|
-
* This function will increase the current day by the given days.
|
|
239
|
-
* @param newDayHour is the hour of the new day (default: TimeManager.minDayHours)
|
|
240
|
-
* @param days is the number of days to increase (default: 1)
|
|
241
|
-
* @returns TimeManager.currentDay
|
|
242
|
-
*/
|
|
243
|
-
static increaseDay(newDayHour = _TimeManager.minDayHours, days = 1) {
|
|
244
|
-
let newDay = _TimeManager.currentDay + days;
|
|
245
|
-
_TimeManager.currentDay = newDay;
|
|
246
|
-
_TimeManager.currentHour = newDayHour;
|
|
247
|
-
return _TimeManager.currentDay;
|
|
248
|
-
}
|
|
249
|
-
/**
|
|
250
|
-
* This function will check if the current hour is between the given hours.
|
|
251
|
-
* @param fromHour the starting hour. If the TimeManager.currentHour is equal to this hour, the function will return true.
|
|
252
|
-
* @param toHour the ending hour.
|
|
253
|
-
* @returns true if the current hour is between the given hours, otherwise false.
|
|
254
|
-
*/
|
|
255
|
-
static nowIsBetween(fromHour, toHour) {
|
|
256
|
-
let currentHour = _TimeManager.currentHour;
|
|
257
|
-
if (fromHour < toHour) {
|
|
258
|
-
return currentHour >= fromHour && currentHour < toHour;
|
|
259
|
-
}
|
|
260
|
-
return currentHour >= fromHour || currentHour < toHour;
|
|
261
|
-
}
|
|
262
|
-
};
|
|
263
|
-
|
|
264
|
-
// src/classes/Commitment.ts
|
|
265
|
-
var COMMITMENT_CATEGORY = "__nqtr-commitment__";
|
|
266
|
-
var CommitmentBaseModel = class extends pixiVn.StoredClassModel {
|
|
267
|
-
/**
|
|
268
|
-
* @param id The id of the commitment, it must be unique.
|
|
269
|
-
* @param character The character or characters that are in the commitment and so in the room.
|
|
270
|
-
* @param room The room where the commitment is.
|
|
271
|
-
* @param props The properties of the commitment.
|
|
272
|
-
*/
|
|
273
|
-
constructor(id, character, room, props) {
|
|
274
|
-
super(COMMITMENT_CATEGORY, id);
|
|
275
|
-
this._characters = character ? Array.isArray(character) ? character : [character] : [];
|
|
276
|
-
this._room = room;
|
|
277
|
-
this._name = props.name || "";
|
|
278
|
-
this.defaultFromHour = props.fromHour;
|
|
279
|
-
this.defaultToHour = props.toHour;
|
|
280
|
-
this.defaultFromDay = props.fromDay;
|
|
281
|
-
this.defaultToDay = props.toDay;
|
|
282
|
-
this._renderImage = props.renderImage;
|
|
283
|
-
this._executionType = props.executionType || "interaction";
|
|
284
|
-
this._onRun = props.onRun;
|
|
285
|
-
this.defaultDisabled = props.disabled || false;
|
|
286
|
-
this.defaultHidden = props.hidden || false;
|
|
287
|
-
this._renderIcon = props.renderIcon;
|
|
288
|
-
this.defaultPriority = props.priority || 0;
|
|
289
|
-
}
|
|
290
|
-
/**
|
|
291
|
-
* The character or characters that are in the commitment and so in the room.
|
|
292
|
-
*/
|
|
293
|
-
get characters() {
|
|
294
|
-
return this._characters;
|
|
295
|
-
}
|
|
296
|
-
/**
|
|
297
|
-
* The room where the commitment is.
|
|
298
|
-
*/
|
|
299
|
-
get room() {
|
|
300
|
-
return this._room;
|
|
301
|
-
}
|
|
302
|
-
/**
|
|
303
|
-
* The name
|
|
304
|
-
*/
|
|
305
|
-
get name() {
|
|
306
|
-
return this._name;
|
|
307
|
-
}
|
|
308
|
-
/**
|
|
309
|
-
* The hour when the commitment starts. If the commitment is not started yet, it will be hidden.
|
|
310
|
-
* If you set undefined, it will return the initial value of fromHour.
|
|
311
|
-
*/
|
|
312
|
-
get fromHour() {
|
|
313
|
-
return this.getStorageProperty("fromHour") || this.defaultFromHour || TimeManager.minDayHours;
|
|
314
|
-
}
|
|
315
|
-
set fromHour(value) {
|
|
316
|
-
this.setStorageProperty("fromHour", value);
|
|
317
|
-
}
|
|
318
|
-
/**
|
|
319
|
-
* The hour when the commitment ends. If the commitment is ended yet, it will be hidden.
|
|
320
|
-
* If you set undefined, it will return the initial value of toHour.
|
|
321
|
-
*/
|
|
322
|
-
get toHour() {
|
|
323
|
-
return this.getStorageProperty("toHour") || this.defaultToHour || TimeManager.maxDayHours + 1;
|
|
324
|
-
}
|
|
325
|
-
set toHour(value) {
|
|
326
|
-
this.setStorageProperty("toHour", value);
|
|
327
|
-
}
|
|
328
|
-
/**
|
|
329
|
-
* The day when the commitment starts. If the commitment is not started yet, it will be hidden.
|
|
330
|
-
* If you set undefined, it will return the initial value of fromDay.
|
|
331
|
-
*/
|
|
332
|
-
get fromDay() {
|
|
333
|
-
return this.getStorageProperty("fromDay") || this.defaultFromDay;
|
|
334
|
-
}
|
|
335
|
-
set fromDay(value) {
|
|
336
|
-
this.setStorageProperty("fromDay", value);
|
|
337
|
-
}
|
|
338
|
-
/**
|
|
339
|
-
* The day when the commitment ends. If the commitment is ended yet, it will be deleted or hidden.
|
|
340
|
-
* If you set undefined, it will return the initial value of toDay.
|
|
341
|
-
*/
|
|
342
|
-
get toDay() {
|
|
343
|
-
return this.getStorageProperty("toDay") || this.defaultToDay;
|
|
344
|
-
}
|
|
345
|
-
set toDay(value) {
|
|
346
|
-
this.setStorageProperty("toDay", value);
|
|
347
|
-
}
|
|
348
|
-
/**
|
|
349
|
-
* The function for rendering the image of the room.
|
|
350
|
-
*/
|
|
351
|
-
get renderImage() {
|
|
352
|
-
let render = this._renderImage;
|
|
353
|
-
if (render === void 0) {
|
|
354
|
-
return void 0;
|
|
355
|
-
}
|
|
356
|
-
if (typeof render === "function") {
|
|
357
|
-
return (props) => {
|
|
358
|
-
return render(this, props);
|
|
359
|
-
};
|
|
360
|
-
}
|
|
361
|
-
return (props) => render;
|
|
362
|
-
}
|
|
363
|
-
/**
|
|
364
|
-
* Execution type. If is "automatic" the onRun() runned automatically when the palayer is in the room. If is "interaction" the player must interact with the character to run the onRun() function.
|
|
365
|
-
* If you set "automatic" remember to remove the commitment when it is no longer needed, because otherwise it repeats itself every time.
|
|
366
|
-
*/
|
|
367
|
-
get executionType() {
|
|
368
|
-
return this._executionType;
|
|
369
|
-
}
|
|
370
|
-
/**
|
|
371
|
-
* The function for rendering the icon of the commitment.
|
|
372
|
-
*/
|
|
373
|
-
get renderIcon() {
|
|
374
|
-
let render = this._renderIcon;
|
|
375
|
-
if (render === void 0) {
|
|
376
|
-
return void 0;
|
|
377
|
-
}
|
|
378
|
-
if (typeof render === "function") {
|
|
379
|
-
return (props) => {
|
|
380
|
-
return render(this, props);
|
|
381
|
-
};
|
|
382
|
-
}
|
|
383
|
-
return (props) => render;
|
|
384
|
-
}
|
|
385
|
-
/**
|
|
386
|
-
* Is a function that is called when the player interacts with the character.
|
|
387
|
-
*/
|
|
388
|
-
get run() {
|
|
389
|
-
let onRun = this._onRun;
|
|
390
|
-
if (!onRun) {
|
|
391
|
-
return;
|
|
392
|
-
}
|
|
393
|
-
return (props) => onRun(this, props);
|
|
394
|
-
}
|
|
395
|
-
/**
|
|
396
|
-
* Whether is disabled. You can also pass a Pixi'VN flag name.
|
|
397
|
-
*/
|
|
398
|
-
get disabled() {
|
|
399
|
-
let value = this.getStorageProperty("disabled") || this.defaultDisabled;
|
|
400
|
-
if (typeof value === "string") {
|
|
401
|
-
return pixiVn.getFlag(value);
|
|
402
|
-
}
|
|
403
|
-
return value;
|
|
404
|
-
}
|
|
405
|
-
set disabled(value) {
|
|
406
|
-
this.setStorageProperty("disabled", value);
|
|
407
|
-
}
|
|
408
|
-
/**
|
|
409
|
-
* Whether is hidden. You can also pass a Pixi'VN flag name.
|
|
410
|
-
*/
|
|
411
|
-
get hidden() {
|
|
412
|
-
if (this.fromDay && this.fromDay > TimeManager.currentDay) {
|
|
413
|
-
return true;
|
|
414
|
-
}
|
|
415
|
-
if (!TimeManager.nowIsBetween(this.fromHour, this.toHour)) {
|
|
416
|
-
return true;
|
|
417
|
-
}
|
|
418
|
-
if (!this.isExpired) {
|
|
419
|
-
return true;
|
|
420
|
-
}
|
|
421
|
-
let value = this.getStorageProperty("hidden") || this.defaultHidden;
|
|
422
|
-
if (typeof value === "string") {
|
|
423
|
-
return pixiVn.getFlag(value);
|
|
424
|
-
}
|
|
425
|
-
return value;
|
|
426
|
-
}
|
|
427
|
-
set hidden(value) {
|
|
428
|
-
this.setStorageProperty("hidden", value);
|
|
429
|
-
}
|
|
430
|
-
/**
|
|
431
|
-
* The priority. The higher the number, the higher the priority.
|
|
432
|
-
* To ensure that a character is not in 2 places at the same time, if there are 2 or more valid commits at the same time and with the same character, the one with the highest priority will be chosen.
|
|
433
|
-
*/
|
|
434
|
-
get priority() {
|
|
435
|
-
return this.getStorageProperty("priority") || this.defaultPriority || 0;
|
|
436
|
-
}
|
|
437
|
-
set priority(value) {
|
|
438
|
-
this.setStorageProperty("priority", value);
|
|
439
|
-
}
|
|
440
|
-
/**
|
|
441
|
-
* Whether the commitment is expired.
|
|
442
|
-
* @returns Whether the commitment is expired.
|
|
443
|
-
*/
|
|
444
|
-
isExpired() {
|
|
445
|
-
if (this.toDay && this.toDay <= TimeManager.currentDay) {
|
|
446
|
-
return true;
|
|
447
|
-
}
|
|
448
|
-
return false;
|
|
449
|
-
}
|
|
450
|
-
};
|
|
451
|
-
var ActivityStoredAbstract = class {
|
|
452
|
-
/**
|
|
453
|
-
* @param onRun The function that is called when the activity is runned. Have 2 parameters: the runned activity and the yourParams object, that is an object with the parameters that you want to pass to the onRun function.
|
|
454
|
-
* @param props The activity properties.
|
|
455
|
-
*/
|
|
456
|
-
constructor(onRun, props) {
|
|
457
|
-
this.defaultName = props.name;
|
|
458
|
-
this.defaultFromHour = props.fromHour;
|
|
459
|
-
this.defaultToHour = props.toHour;
|
|
460
|
-
this.defaultFromDay = props.fromDay;
|
|
461
|
-
this.defaultToDay = props.toDay;
|
|
462
|
-
this.defaultDisabled = props.disabled || false;
|
|
463
|
-
this.defaultHidden = props.hidden || false;
|
|
464
|
-
this._renderIcon = props.renderIcon;
|
|
465
|
-
this._onRun = onRun;
|
|
466
|
-
}
|
|
467
|
-
/**
|
|
468
|
-
* The name
|
|
469
|
-
*/
|
|
470
|
-
get name() {
|
|
471
|
-
return this.getStorageProperty("name") || this.defaultName || "";
|
|
472
|
-
}
|
|
473
|
-
set name(value) {
|
|
474
|
-
this.setStorageProperty("name", value);
|
|
475
|
-
}
|
|
476
|
-
/**
|
|
477
|
-
* The hour when the activity starts. If the activity is not started yet, it will be hidden.
|
|
478
|
-
*/
|
|
479
|
-
get fromHour() {
|
|
480
|
-
return this.getStorageProperty("fromHour") || this.defaultFromHour || TimeManager.minDayHours;
|
|
481
|
-
}
|
|
482
|
-
set fromHour(value) {
|
|
483
|
-
this.setStorageProperty("fromHour", value);
|
|
484
|
-
}
|
|
485
|
-
/**
|
|
486
|
-
* The hour when the activity ends. If the activity is ended yet, it will be hidden.
|
|
487
|
-
*/
|
|
488
|
-
get toHour() {
|
|
489
|
-
return this.getStorageProperty("toHour") || this.defaultToHour || TimeManager.maxDayHours + 1;
|
|
490
|
-
}
|
|
491
|
-
set toHour(value) {
|
|
492
|
-
this.setStorageProperty("toHour", value);
|
|
493
|
-
}
|
|
494
|
-
/**
|
|
495
|
-
* The day when the activity starts. If the activity is not started yet, it will be hidden.
|
|
496
|
-
*/
|
|
497
|
-
get fromDay() {
|
|
498
|
-
return this.getStorageProperty("fromDay") || this.defaultFromDay;
|
|
499
|
-
}
|
|
500
|
-
set fromDay(value) {
|
|
501
|
-
this.setStorageProperty("fromDay", value);
|
|
502
|
-
}
|
|
503
|
-
/**
|
|
504
|
-
* The day when the activity ends. If the activity is ended yet, it will be deleted or hidden.
|
|
505
|
-
*/
|
|
506
|
-
get toDay() {
|
|
507
|
-
return this.getStorageProperty("toDay") || this.defaultToDay;
|
|
508
|
-
}
|
|
509
|
-
set toDay(value) {
|
|
510
|
-
this.setStorageProperty("toDay", value);
|
|
511
|
-
}
|
|
512
|
-
/**
|
|
513
|
-
* Whether is disabled.
|
|
514
|
-
*/
|
|
515
|
-
get disabled() {
|
|
516
|
-
let value = this.getStorageProperty("disabled") || this.defaultDisabled;
|
|
517
|
-
if (typeof value === "string") {
|
|
518
|
-
return pixiVn.getFlag(value);
|
|
519
|
-
}
|
|
520
|
-
return value;
|
|
521
|
-
}
|
|
522
|
-
set disabled(value) {
|
|
523
|
-
this.setStorageProperty("disabled", value);
|
|
524
|
-
}
|
|
525
|
-
/**
|
|
526
|
-
* Whether is hidden. If the activity is not started yet, it will be hidden.
|
|
527
|
-
*/
|
|
528
|
-
get hidden() {
|
|
529
|
-
if (this.fromDay && this.fromDay > TimeManager.currentDay) {
|
|
530
|
-
return true;
|
|
531
|
-
}
|
|
532
|
-
if (!TimeManager.nowIsBetween(this.fromHour, this.toHour)) {
|
|
533
|
-
return true;
|
|
534
|
-
}
|
|
535
|
-
if (!this.isExpired) {
|
|
536
|
-
return true;
|
|
537
|
-
}
|
|
538
|
-
let value = this.getStorageProperty("hidden") || this.defaultHidden;
|
|
539
|
-
if (typeof value === "string") {
|
|
540
|
-
return pixiVn.getFlag(value);
|
|
541
|
-
}
|
|
542
|
-
return value;
|
|
543
|
-
}
|
|
544
|
-
set hidden(value) {
|
|
545
|
-
this.setStorageProperty("hidden", value);
|
|
546
|
-
}
|
|
547
|
-
/**
|
|
548
|
-
* The function for rendering the icon of the activity.
|
|
549
|
-
*/
|
|
550
|
-
get renderIcon() {
|
|
551
|
-
let render = this._renderIcon;
|
|
552
|
-
if (render === void 0) {
|
|
553
|
-
return void 0;
|
|
554
|
-
}
|
|
555
|
-
if (typeof render === "function") {
|
|
556
|
-
return (props) => {
|
|
557
|
-
return render(this, props);
|
|
558
|
-
};
|
|
559
|
-
}
|
|
560
|
-
return (props) => render;
|
|
561
|
-
}
|
|
562
|
-
/**
|
|
563
|
-
* The function that is called when the activity is runned.
|
|
564
|
-
*/
|
|
565
|
-
get run() {
|
|
566
|
-
return (props) => {
|
|
567
|
-
return this._onRun(this, props);
|
|
568
|
-
};
|
|
569
|
-
}
|
|
570
|
-
/**
|
|
571
|
-
* Whether the activity is a deadline.
|
|
572
|
-
* @returns Whether the activity is a deadline.
|
|
573
|
-
*/
|
|
574
|
-
isExpired() {
|
|
575
|
-
if (this.toDay && this.toDay <= TimeManager.currentDay) {
|
|
576
|
-
return true;
|
|
577
|
-
}
|
|
578
|
-
return false;
|
|
579
|
-
}
|
|
580
|
-
/**
|
|
581
|
-
* Export the activity properties.
|
|
582
|
-
* @returns The activity properties.
|
|
583
|
-
*/
|
|
584
|
-
export() {
|
|
585
|
-
return {
|
|
586
|
-
name: this.getStorageProperty("name") || this.defaultName,
|
|
587
|
-
fromHour: this.getStorageProperty("fromHour") || this.defaultFromHour,
|
|
588
|
-
toHour: this.getStorageProperty("toHour") || this.defaultToHour,
|
|
589
|
-
fromDay: this.getStorageProperty("fromDay") || this.defaultFromDay,
|
|
590
|
-
toDay: this.getStorageProperty("toDay") || this.defaultToDay,
|
|
591
|
-
disabled: this.getStorageProperty("disabled") || this.defaultDisabled,
|
|
592
|
-
hidden: this.getStorageProperty("hidden") || this.defaultHidden,
|
|
593
|
-
renderIcon: this._renderIcon
|
|
594
|
-
};
|
|
595
|
-
}
|
|
596
|
-
};
|
|
597
|
-
|
|
598
|
-
// src/classes/navigation/ActivityRoom.ts
|
|
599
|
-
var ActivityRoom = class extends ActivityStoredAbstract {
|
|
600
|
-
constructor(id, room, onRun, props) {
|
|
601
|
-
super(onRun, props);
|
|
602
|
-
this._id = id;
|
|
603
|
-
this._room = room;
|
|
604
|
-
}
|
|
605
|
-
setStorageProperty(_, __) {
|
|
606
|
-
this._room.setActivity(this);
|
|
607
|
-
}
|
|
608
|
-
getStorageProperty(propertyName) {
|
|
609
|
-
let activity = this._room.getActivityMemory(this.id);
|
|
610
|
-
if (!activity || !activity.hasOwnProperty(propertyName)) {
|
|
611
|
-
return void 0;
|
|
612
|
-
}
|
|
613
|
-
return activity[propertyName];
|
|
614
|
-
}
|
|
615
|
-
get id() {
|
|
616
|
-
return this._id;
|
|
617
|
-
}
|
|
618
|
-
/**
|
|
619
|
-
* The room where the activity is.
|
|
620
|
-
*/
|
|
621
|
-
get room() {
|
|
622
|
-
return this._room;
|
|
623
|
-
}
|
|
624
|
-
export() {
|
|
625
|
-
let result = {};
|
|
626
|
-
if (this.name !== void 0) {
|
|
627
|
-
result["name"] = this.name;
|
|
628
|
-
}
|
|
629
|
-
if (this.fromHour !== void 0) {
|
|
630
|
-
result["fromHour"] = this.fromHour;
|
|
631
|
-
}
|
|
632
|
-
if (this.toHour !== void 0) {
|
|
633
|
-
result["toHour"] = this.toHour;
|
|
634
|
-
}
|
|
635
|
-
if (this.fromDay !== void 0) {
|
|
636
|
-
result["fromDay"] = this.fromDay;
|
|
637
|
-
}
|
|
638
|
-
if (this.toDay !== void 0) {
|
|
639
|
-
result["toDay"] = this.toDay;
|
|
640
|
-
}
|
|
641
|
-
if (this.disabled !== void 0) {
|
|
642
|
-
result["disabled"] = this.disabled;
|
|
643
|
-
}
|
|
644
|
-
return result;
|
|
645
|
-
}
|
|
646
|
-
};
|
|
647
|
-
|
|
648
|
-
// src/decorators/RoomDecorator.ts
|
|
649
|
-
var registeredRooms = {};
|
|
650
|
-
function getRoomsByLocation(location) {
|
|
651
|
-
return Object.values(registeredRooms).filter((room) => room.location.id === location.id);
|
|
652
|
-
}
|
|
653
|
-
function getAllLocations() {
|
|
654
|
-
let result = {};
|
|
655
|
-
Object.values(registeredRooms).forEach((room) => {
|
|
656
|
-
result[room.location.id] = room.location;
|
|
657
|
-
});
|
|
658
|
-
return Object.values(result);
|
|
659
|
-
}
|
|
660
|
-
function getLocationsByMap(map) {
|
|
661
|
-
return getAllLocations().filter((location) => location.map.id === map.id);
|
|
662
|
-
}
|
|
663
|
-
|
|
664
|
-
// src/classes/navigation/Location.ts
|
|
665
|
-
var LOCATION_CATEGORY = "__nqtr-location__";
|
|
666
|
-
var LocationBaseModel = class extends pixiVn.StoredClassModel {
|
|
667
|
-
/**
|
|
668
|
-
* @param id The id of the location, it must be unique.
|
|
669
|
-
* @param map The map where the location is.
|
|
670
|
-
* @param props The properties of the location.
|
|
671
|
-
*/
|
|
672
|
-
constructor(id, map, props = {}) {
|
|
673
|
-
super(LOCATION_CATEGORY, id);
|
|
674
|
-
this.defaultName = props.name || "";
|
|
675
|
-
this.defaultDisabled = props.disabled || false;
|
|
676
|
-
this.defaultHidden = props.hidden || false;
|
|
677
|
-
this._renderIcon = props.renderIcon;
|
|
678
|
-
this._map = map;
|
|
679
|
-
}
|
|
680
|
-
/**
|
|
681
|
-
* The name of the location.
|
|
682
|
-
* If you set undefined, it will return the initial value of name.
|
|
683
|
-
*/
|
|
684
|
-
get name() {
|
|
685
|
-
return this.getStorageProperty("name") || this.defaultName;
|
|
686
|
-
}
|
|
687
|
-
set name(value) {
|
|
688
|
-
this.setStorageProperty("name", value);
|
|
689
|
-
}
|
|
690
|
-
/**
|
|
691
|
-
* Whether is disabled. If it is a string, it is a Pixi'VN flag name.
|
|
692
|
-
*/
|
|
693
|
-
get disabled() {
|
|
694
|
-
let value = this.getStorageProperty("disabled") || this.defaultDisabled;
|
|
695
|
-
if (typeof value === "string") {
|
|
696
|
-
return pixiVn.getFlag(value);
|
|
697
|
-
}
|
|
698
|
-
return value;
|
|
699
|
-
}
|
|
700
|
-
set disabled(value) {
|
|
701
|
-
this.setStorageProperty("disabled", value);
|
|
702
|
-
}
|
|
703
|
-
/**
|
|
704
|
-
* Whether is hidden. If it is a string, it is a Pixi'VN flag name.
|
|
705
|
-
*/
|
|
706
|
-
get hidden() {
|
|
707
|
-
let value = this.getStorageProperty("hidden") || this.defaultHidden;
|
|
708
|
-
if (typeof value === "string") {
|
|
709
|
-
return pixiVn.getFlag(value);
|
|
710
|
-
}
|
|
711
|
-
return value;
|
|
712
|
-
}
|
|
713
|
-
set hidden(value) {
|
|
714
|
-
this.setStorageProperty("hidden", value);
|
|
715
|
-
}
|
|
716
|
-
/**
|
|
717
|
-
* The function for rendering the icon of the location.
|
|
718
|
-
*/
|
|
719
|
-
get renderIcon() {
|
|
720
|
-
let render = this._renderIcon;
|
|
721
|
-
if (render === void 0) {
|
|
722
|
-
return void 0;
|
|
723
|
-
}
|
|
724
|
-
if (typeof render === "function") {
|
|
725
|
-
return (props) => {
|
|
726
|
-
return render(this, props);
|
|
727
|
-
};
|
|
728
|
-
}
|
|
729
|
-
return (props) => render;
|
|
730
|
-
}
|
|
731
|
-
/**
|
|
732
|
-
* The map where the location is.
|
|
733
|
-
*/
|
|
734
|
-
get map() {
|
|
735
|
-
return this._map;
|
|
736
|
-
}
|
|
737
|
-
/**
|
|
738
|
-
* Get the entrance room of the location.
|
|
739
|
-
* You can cast the room to a specific type that extends RoomBaseModel.
|
|
740
|
-
* @returns The entrance room or the first room if there is no entrance.
|
|
741
|
-
* @example
|
|
742
|
-
* ```typescript
|
|
743
|
-
* const entranceHome = new RoomBaseModel("entrance-home", home, { isEntrance: true })
|
|
744
|
-
* saveRoom(entranceHome)
|
|
745
|
-
* const home = new LocationBaseModel("home", map, { name: "Home" })
|
|
746
|
-
*
|
|
747
|
-
* const entrance = home.getEntrance() // entrance === entranceHome
|
|
748
|
-
* ```
|
|
749
|
-
*/
|
|
750
|
-
getEntrance() {
|
|
751
|
-
let rooms = this.getRooms();
|
|
752
|
-
if (rooms.length === 0) {
|
|
753
|
-
console.error(`[NQTR] The location ${this.id} has no rooms`);
|
|
754
|
-
return;
|
|
755
|
-
}
|
|
756
|
-
return rooms.find((room) => room.isEntrance) || rooms[0];
|
|
757
|
-
}
|
|
758
|
-
/**
|
|
759
|
-
* Get all rooms in the location.
|
|
760
|
-
* You can cast the rooms to a specific type that extends RoomBaseModel.
|
|
761
|
-
* @returns The rooms in the location.
|
|
762
|
-
*/
|
|
763
|
-
getRooms() {
|
|
764
|
-
return getRoomsByLocation(this);
|
|
765
|
-
}
|
|
766
|
-
};
|
|
767
|
-
var MAP_CATEGORY = "__nqtr-map__";
|
|
768
|
-
var MapBaseModel = class extends pixiVn.StoredClassModel {
|
|
769
|
-
/**
|
|
770
|
-
* @param id The id of the map, it must be unique.
|
|
771
|
-
* @param props The properties of the map.
|
|
772
|
-
*/
|
|
773
|
-
constructor(id, props = {}) {
|
|
774
|
-
super(MAP_CATEGORY, id);
|
|
775
|
-
this.defaultName = props.name || "";
|
|
776
|
-
this._renderImage = props.renderImage;
|
|
777
|
-
this.defaultDisabled = props.disabled || false;
|
|
778
|
-
this.defaultHidden = props.hidden || false;
|
|
779
|
-
this._neighboringMaps = props.neighboringMaps;
|
|
780
|
-
}
|
|
781
|
-
/**
|
|
782
|
-
* The name of the map.
|
|
783
|
-
* If you set undefined, it will return the initial value of name.
|
|
784
|
-
*/
|
|
785
|
-
get name() {
|
|
786
|
-
return this.getStorageProperty("name") || this.defaultName;
|
|
787
|
-
}
|
|
788
|
-
set name(value) {
|
|
789
|
-
this.setStorageProperty("name", value);
|
|
790
|
-
}
|
|
791
|
-
/**
|
|
792
|
-
* The function for rendering the image of the map.
|
|
793
|
-
*/
|
|
794
|
-
get renderImage() {
|
|
795
|
-
let render = this._renderImage;
|
|
796
|
-
if (render === void 0) {
|
|
797
|
-
return void 0;
|
|
798
|
-
}
|
|
799
|
-
if (typeof render === "function") {
|
|
800
|
-
return (props) => {
|
|
801
|
-
return render(this, props);
|
|
802
|
-
};
|
|
803
|
-
}
|
|
804
|
-
return (props) => render;
|
|
805
|
-
}
|
|
806
|
-
/**
|
|
807
|
-
* Whether is disabled. If it is a string, it is a Pixi'VN flag name.
|
|
808
|
-
*/
|
|
809
|
-
get disabled() {
|
|
810
|
-
let value = this.getStorageProperty("disabled") || this.defaultDisabled;
|
|
811
|
-
if (typeof value === "string") {
|
|
812
|
-
return pixiVn.getFlag(value);
|
|
813
|
-
}
|
|
814
|
-
return value;
|
|
815
|
-
}
|
|
816
|
-
set disabled(value) {
|
|
817
|
-
this.setStorageProperty("disabled", value);
|
|
818
|
-
}
|
|
819
|
-
/**
|
|
820
|
-
* Whether is hidden. If it is a string, it is a Pixi'VN flag name.
|
|
821
|
-
*/
|
|
822
|
-
get hidden() {
|
|
823
|
-
let value = this.getStorageProperty("hidden") || this.defaultHidden;
|
|
824
|
-
if (typeof value === "string") {
|
|
825
|
-
return pixiVn.getFlag(value);
|
|
826
|
-
}
|
|
827
|
-
return value;
|
|
828
|
-
}
|
|
829
|
-
set hidden(value) {
|
|
830
|
-
this.setStorageProperty("hidden", value);
|
|
831
|
-
}
|
|
832
|
-
/**
|
|
833
|
-
* The neighboring maps that are available in this map.
|
|
834
|
-
* @example
|
|
835
|
-
* ```ts
|
|
836
|
-
* {
|
|
837
|
-
* "north": "atlanta_map_id",
|
|
838
|
-
* "south": "miami_map_id",
|
|
839
|
-
* "east": "new_york_map_id",
|
|
840
|
-
* "west": "los_angeles_map_id"
|
|
841
|
-
* }
|
|
842
|
-
* ```
|
|
843
|
-
*/
|
|
844
|
-
get neighboringMaps() {
|
|
845
|
-
return this._neighboringMaps || {};
|
|
846
|
-
}
|
|
847
|
-
set neighboringMaps(value) {
|
|
848
|
-
this._neighboringMaps = value;
|
|
849
|
-
}
|
|
850
|
-
/**
|
|
851
|
-
* Get all locations in the map.
|
|
852
|
-
* @returns The locations in the map.
|
|
853
|
-
*/
|
|
854
|
-
getLocations() {
|
|
855
|
-
return getLocationsByMap(this);
|
|
856
|
-
}
|
|
857
|
-
};
|
|
858
|
-
|
|
859
|
-
// src/decorators/ActivityDecorator.ts
|
|
860
|
-
var registeredActivities = {};
|
|
861
|
-
function getActivityById(id) {
|
|
862
|
-
try {
|
|
863
|
-
let activity = registeredActivities[id];
|
|
864
|
-
if (!activity) {
|
|
865
|
-
console.error(`[NQTR] Activity ${id} not found`);
|
|
866
|
-
return;
|
|
867
|
-
}
|
|
868
|
-
return activity;
|
|
869
|
-
} catch (e) {
|
|
870
|
-
console.error(`[NQTR] Error while getting Activity ${id}`, e);
|
|
871
|
-
return;
|
|
872
|
-
}
|
|
873
|
-
}
|
|
874
|
-
var TEMPORARY_COMMITMENT_CATEGORY_MEMORY_KEY = "___nqtr-temporary_commitment___";
|
|
875
|
-
var registeredCommitments = {};
|
|
876
|
-
var fixedCommitments = {};
|
|
877
|
-
function getCommitmentById(id) {
|
|
878
|
-
try {
|
|
879
|
-
let commitment = registeredCommitments[id];
|
|
880
|
-
if (!commitment) {
|
|
881
|
-
console.error(`[NQTR] Commitment ${id} not found`);
|
|
882
|
-
return;
|
|
883
|
-
}
|
|
884
|
-
return commitment;
|
|
885
|
-
} catch (e) {
|
|
886
|
-
console.error(`[NQTR] Error while getting Commitment ${id}`, e);
|
|
887
|
-
return;
|
|
888
|
-
}
|
|
889
|
-
}
|
|
890
|
-
function getFixedRoutine() {
|
|
891
|
-
return Object.values(fixedCommitments);
|
|
892
|
-
}
|
|
893
|
-
function getTemporaryCommitments() {
|
|
894
|
-
let commitmentsIds = pixiVn.GameStorageManager.getVariable(TEMPORARY_COMMITMENT_CATEGORY_MEMORY_KEY);
|
|
895
|
-
if (!commitmentsIds) {
|
|
896
|
-
return [];
|
|
897
|
-
}
|
|
898
|
-
let commitments = commitmentsIds.map((id) => getCommitmentById(id)).filter((commitment) => commitment !== void 0);
|
|
899
|
-
return commitments;
|
|
900
|
-
}
|
|
901
|
-
var GOAL_CATEGORY = "__nqtr-goal__";
|
|
902
|
-
var Goal = class extends pixiVn.StoredClassModel {
|
|
903
|
-
constructor(id, props) {
|
|
904
|
-
super(GOAL_CATEGORY, id);
|
|
905
|
-
this._description = props.description;
|
|
906
|
-
this._need = props.need || 1;
|
|
907
|
-
this._defaultHave = props.have || 0;
|
|
908
|
-
}
|
|
909
|
-
/**
|
|
910
|
-
* The description of the goal.
|
|
911
|
-
*/
|
|
912
|
-
get description() {
|
|
913
|
-
return this._description;
|
|
914
|
-
}
|
|
915
|
-
/**
|
|
916
|
-
* The number of times the goal must be completed.
|
|
917
|
-
*/
|
|
918
|
-
get need() {
|
|
919
|
-
return this._need;
|
|
920
|
-
}
|
|
921
|
-
/**
|
|
922
|
-
* The default number of times the goal has been completed.
|
|
923
|
-
*/
|
|
924
|
-
get defaultHave() {
|
|
925
|
-
return this._defaultHave;
|
|
926
|
-
}
|
|
927
|
-
};
|
|
928
|
-
var GoalStage = class extends Goal {
|
|
929
|
-
constructor(id, stageId, props) {
|
|
930
|
-
super(id, props);
|
|
931
|
-
this._stageId = stageId;
|
|
932
|
-
}
|
|
933
|
-
/**
|
|
934
|
-
* The id of the stage that the goal belongs to.
|
|
935
|
-
*/
|
|
936
|
-
get stageId() {
|
|
937
|
-
return this._stageId;
|
|
938
|
-
}
|
|
939
|
-
set stageId(value) {
|
|
940
|
-
this._stageId = value;
|
|
941
|
-
}
|
|
942
|
-
/**
|
|
943
|
-
* The number of times the goal has been completed.
|
|
944
|
-
*/
|
|
945
|
-
get have() {
|
|
946
|
-
return this.getStorageProperty("have-" + this._stageId) || this.defaultHave;
|
|
947
|
-
}
|
|
948
|
-
set have(value) {
|
|
949
|
-
if (!this._stageId) {
|
|
950
|
-
console.error(`[NQTR] The stage id is not set for the goal ${this.id}, so the have value can't be set.`);
|
|
951
|
-
return;
|
|
952
|
-
}
|
|
953
|
-
this.setStorageProperty("have-" + this._stageId, value);
|
|
954
|
-
}
|
|
955
|
-
/**
|
|
956
|
-
* If the goal is completed.
|
|
957
|
-
*/
|
|
958
|
-
get completed() {
|
|
959
|
-
return this.have >= this.need;
|
|
960
|
-
}
|
|
961
|
-
set completed(value) {
|
|
962
|
-
if (value) {
|
|
963
|
-
this.have = this.need;
|
|
964
|
-
} else {
|
|
965
|
-
console.warn(`[NQTR] The goal can't be set as not completed. You must edit the have value manually.`);
|
|
966
|
-
}
|
|
967
|
-
}
|
|
968
|
-
/**
|
|
969
|
-
* Find the goal. It will increment the have value.
|
|
970
|
-
*/
|
|
971
|
-
find() {
|
|
972
|
-
this.have++;
|
|
973
|
-
}
|
|
974
|
-
};
|
|
975
|
-
|
|
976
|
-
// src/classes/quest/Stage.ts
|
|
977
|
-
var STAGE_CATEGORY = "__nqtr-stage__";
|
|
978
|
-
var Stage = class extends pixiVn.StoredClassModel {
|
|
979
|
-
constructor(id, props) {
|
|
980
|
-
super(STAGE_CATEGORY, id);
|
|
981
|
-
this._name = props.name || "";
|
|
982
|
-
this._defaultGoals = props.goals || [];
|
|
983
|
-
this._flags = props.flags || [];
|
|
984
|
-
this._description = props.description || "";
|
|
985
|
-
this._adviceDescription = props.adviceDescription || "";
|
|
986
|
-
this._renderImage = props.renderImage;
|
|
987
|
-
this._daysRequiredToStart = props.daysRequiredToStart;
|
|
988
|
-
this._flagsRequiredToStart = props.flagsRequiredToStart || [];
|
|
989
|
-
this._questsRequiredToStart = props.questsRequiredToStart || [];
|
|
990
|
-
this._requestDescriptionToStart = props.requestDescriptionToStart || "";
|
|
991
|
-
this._onStart = props.onStart;
|
|
992
|
-
this._onEnd = props.onEnd;
|
|
993
|
-
}
|
|
994
|
-
/**
|
|
995
|
-
* The name of the stage.
|
|
996
|
-
*/
|
|
997
|
-
get name() {
|
|
998
|
-
return this._name;
|
|
999
|
-
}
|
|
1000
|
-
/**
|
|
1001
|
-
* The description of the stage.
|
|
1002
|
-
*/
|
|
1003
|
-
get description() {
|
|
1004
|
-
return this._description;
|
|
1005
|
-
}
|
|
1006
|
-
/**
|
|
1007
|
-
* The advice description of the stage.
|
|
1008
|
-
*/
|
|
1009
|
-
get adviceDescription() {
|
|
1010
|
-
return this._adviceDescription;
|
|
1011
|
-
}
|
|
1012
|
-
/**
|
|
1013
|
-
* The function for rendering the image of the stage.
|
|
1014
|
-
*/
|
|
1015
|
-
get renderImage() {
|
|
1016
|
-
let render = this._renderImage;
|
|
1017
|
-
if (render === void 0) {
|
|
1018
|
-
return void 0;
|
|
1019
|
-
}
|
|
1020
|
-
if (typeof render === "function") {
|
|
1021
|
-
return (props) => {
|
|
1022
|
-
return render(this, props);
|
|
1023
|
-
};
|
|
1024
|
-
}
|
|
1025
|
-
return (props) => render;
|
|
1026
|
-
}
|
|
1027
|
-
/**
|
|
1028
|
-
* The list of goals that the player needs to complete to finish the stage.
|
|
1029
|
-
* This is the list set by the developer. if you want to get the current goals, use the goals property.
|
|
1030
|
-
*/
|
|
1031
|
-
get defaultGoals() {
|
|
1032
|
-
return this._defaultGoals;
|
|
1033
|
-
}
|
|
1034
|
-
/**
|
|
1035
|
-
* The list of flags that the player must complete to finish the stage.
|
|
1036
|
-
*/
|
|
1037
|
-
get flags() {
|
|
1038
|
-
return this._flags;
|
|
1039
|
-
}
|
|
1040
|
-
/**
|
|
1041
|
-
* The number of days required to start the stage.
|
|
1042
|
-
*/
|
|
1043
|
-
get daysRequiredToStart() {
|
|
1044
|
-
return this._daysRequiredToStart || 0;
|
|
1045
|
-
}
|
|
1046
|
-
/**
|
|
1047
|
-
* The list of flags required to start the stage.
|
|
1048
|
-
*/
|
|
1049
|
-
get flagsRequiredToStart() {
|
|
1050
|
-
return this._flagsRequiredToStart;
|
|
1051
|
-
}
|
|
1052
|
-
/**
|
|
1053
|
-
* The list of quests required to start the stage.
|
|
1054
|
-
*/
|
|
1055
|
-
get questsRequiredToStart() {
|
|
1056
|
-
return this._questsRequiredToStart || [];
|
|
1057
|
-
}
|
|
1058
|
-
/**
|
|
1059
|
-
* The description of the request to start the stage.
|
|
1060
|
-
*/
|
|
1061
|
-
get requestDescriptionToStart() {
|
|
1062
|
-
return this._requestDescriptionToStart;
|
|
1063
|
-
}
|
|
1064
|
-
/**
|
|
1065
|
-
* The function that will be called when the stage starts.
|
|
1066
|
-
*/
|
|
1067
|
-
get onStart() {
|
|
1068
|
-
return this._onStart;
|
|
1069
|
-
}
|
|
1070
|
-
/**
|
|
1071
|
-
* The function that will be called when the stage ends.
|
|
1072
|
-
*/
|
|
1073
|
-
get onEnd() {
|
|
1074
|
-
return this._onEnd;
|
|
1075
|
-
}
|
|
1076
|
-
};
|
|
1077
|
-
var StageQuest = class extends Stage {
|
|
1078
|
-
constructor(id, props) {
|
|
1079
|
-
super(id, props);
|
|
1080
|
-
}
|
|
1081
|
-
/**
|
|
1082
|
-
* Check if the flag and goals are completed.
|
|
1083
|
-
* You can force the completion of the stage by setting the completed property to true.
|
|
1084
|
-
*/
|
|
1085
|
-
get completed() {
|
|
1086
|
-
let storedCompleted = this.getStorageProperty("completed");
|
|
1087
|
-
if (storedCompleted) {
|
|
1088
|
-
return storedCompleted;
|
|
1089
|
-
}
|
|
1090
|
-
if (this.flags.length > 0 && this.goals.length > 0) {
|
|
1091
|
-
if (!this.flags.every((flag) => pixiVn.getFlag(flag.flag))) {
|
|
1092
|
-
return false;
|
|
1093
|
-
}
|
|
1094
|
-
if (!this.goals.every((goal) => goal.completed)) {
|
|
1095
|
-
return false;
|
|
1096
|
-
}
|
|
1097
|
-
return true;
|
|
1098
|
-
}
|
|
1099
|
-
return false;
|
|
1100
|
-
}
|
|
1101
|
-
set completed(value) {
|
|
1102
|
-
this.setStorageProperty("completed", value);
|
|
1103
|
-
}
|
|
1104
|
-
/**
|
|
1105
|
-
* If the stage is started.
|
|
1106
|
-
*/
|
|
1107
|
-
get started() {
|
|
1108
|
-
return this.getStorageProperty("started") || false;
|
|
1109
|
-
}
|
|
1110
|
-
set started(value) {
|
|
1111
|
-
this.setStorageProperty("started", value);
|
|
1112
|
-
}
|
|
1113
|
-
/**
|
|
1114
|
-
* The list of goals that the player needs to complete to finish the stage.
|
|
1115
|
-
*/
|
|
1116
|
-
get goals() {
|
|
1117
|
-
return this.defaultGoals.map((goal) => {
|
|
1118
|
-
return new GoalStage(goal.id, this.id, goal);
|
|
1119
|
-
});
|
|
1120
|
-
}
|
|
1121
|
-
get prevStageEndDay() {
|
|
1122
|
-
return this.getStorageProperty("prevStageEndDay");
|
|
1123
|
-
}
|
|
1124
|
-
set prevStageEndDay(value) {
|
|
1125
|
-
this.setStorageProperty("prevStageEndDay", value);
|
|
1126
|
-
}
|
|
1127
|
-
/**
|
|
1128
|
-
* The day when the stage starts.
|
|
1129
|
-
*/
|
|
1130
|
-
get startDay() {
|
|
1131
|
-
let prevStageEndDay = this.prevStageEndDay;
|
|
1132
|
-
if (prevStageEndDay === void 0) {
|
|
1133
|
-
return void 0;
|
|
1134
|
-
}
|
|
1135
|
-
return prevStageEndDay + this.daysRequiredToStart;
|
|
1136
|
-
}
|
|
1137
|
-
/**
|
|
1138
|
-
* Check if the stage can start.
|
|
1139
|
-
*/
|
|
1140
|
-
get canStart() {
|
|
1141
|
-
let daysRequired = this.daysRequiredToStart;
|
|
1142
|
-
if (daysRequired > 0) {
|
|
1143
|
-
let prevStageEndDay = this.prevStageEndDay;
|
|
1144
|
-
if (prevStageEndDay === void 0) {
|
|
1145
|
-
return false;
|
|
1146
|
-
}
|
|
1147
|
-
if (prevStageEndDay + daysRequired > TimeManager.currentDay) {
|
|
1148
|
-
return false;
|
|
1149
|
-
}
|
|
1150
|
-
}
|
|
1151
|
-
if (this.flagsRequiredToStart.length > 0 && !this.flagsRequiredToStart.every((flag) => pixiVn.getFlag(flag.flag))) {
|
|
1152
|
-
return false;
|
|
1153
|
-
}
|
|
1154
|
-
if (this.questsRequiredToStart.length > 0 && !this.questsRequiredToStart.every(
|
|
1155
|
-
(q) => q.quest.currentStageIndex && q.quest.currentStageIndex >= q.stageNumber
|
|
1156
|
-
)) {
|
|
1157
|
-
return false;
|
|
1158
|
-
}
|
|
1159
|
-
return true;
|
|
1160
|
-
}
|
|
1161
|
-
/**
|
|
1162
|
-
* Inizialize the stage. **This function should be called only by the Quest class.**
|
|
1163
|
-
*/
|
|
1164
|
-
inizialize() {
|
|
1165
|
-
if (this.daysRequiredToStart > 0) {
|
|
1166
|
-
this.prevStageEndDay = TimeManager.currentDay;
|
|
1167
|
-
console.log(`[NQTR] Stage ${this.id} will start on day ${this.startDay}`);
|
|
1168
|
-
}
|
|
1169
|
-
}
|
|
1170
|
-
/**
|
|
1171
|
-
* The function that will be called when the stage starts.
|
|
1172
|
-
*/
|
|
1173
|
-
start(props) {
|
|
1174
|
-
if (this.canStart) {
|
|
1175
|
-
this.started = true;
|
|
1176
|
-
if (this.onStart) {
|
|
1177
|
-
this.onStart(this, props);
|
|
1178
|
-
}
|
|
1179
|
-
} else {
|
|
1180
|
-
console.warn(`[NQTR] Stage ${this.id} can't start`);
|
|
1181
|
-
}
|
|
1182
|
-
}
|
|
1183
|
-
};
|
|
1184
|
-
|
|
1185
|
-
// src/classes/quest/Quest.ts
|
|
1186
|
-
var QUEST_CATEGORY = "__nqtr-quest__";
|
|
1187
|
-
var Quest = class extends pixiVn.StoredClassModel {
|
|
1188
|
-
constructor(id, stages, props) {
|
|
1189
|
-
super(QUEST_CATEGORY, id);
|
|
1190
|
-
this._stages = stages;
|
|
1191
|
-
this._name = props.name || "";
|
|
1192
|
-
this._description = props.description || "";
|
|
1193
|
-
this._renderIcon = props.renderIcon;
|
|
1194
|
-
this._renderImage = props.renderImage;
|
|
1195
|
-
this._isInDevelopment = props.isInDevelopment || false;
|
|
1196
|
-
this._onStart = props.onStart;
|
|
1197
|
-
this._onNextStage = props.onNextStage;
|
|
1198
|
-
}
|
|
1199
|
-
/**
|
|
1200
|
-
* The stages of the quest.
|
|
1201
|
-
*/
|
|
1202
|
-
get stages() {
|
|
1203
|
-
return this._stages.map((stage, index) => {
|
|
1204
|
-
return new StageQuest(stage.id, stage);
|
|
1205
|
-
});
|
|
1206
|
-
}
|
|
1207
|
-
/**
|
|
1208
|
-
* The name of the quest.
|
|
1209
|
-
*/
|
|
1210
|
-
get name() {
|
|
1211
|
-
return this._name;
|
|
1212
|
-
}
|
|
1213
|
-
/**
|
|
1214
|
-
* The description of the quest.
|
|
1215
|
-
*/
|
|
1216
|
-
get description() {
|
|
1217
|
-
return this._description;
|
|
1218
|
-
}
|
|
1219
|
-
/**
|
|
1220
|
-
* The function for rendering the icon of the quest.
|
|
1221
|
-
*/
|
|
1222
|
-
get renderIcon() {
|
|
1223
|
-
let render = this._renderIcon;
|
|
1224
|
-
if (render === void 0) {
|
|
1225
|
-
return void 0;
|
|
1226
|
-
}
|
|
1227
|
-
if (typeof render === "function") {
|
|
1228
|
-
return (props) => {
|
|
1229
|
-
return render(this, props);
|
|
1230
|
-
};
|
|
1231
|
-
}
|
|
1232
|
-
return (props) => render;
|
|
1233
|
-
}
|
|
1234
|
-
/**
|
|
1235
|
-
* The function for rendering the image of the quest.
|
|
1236
|
-
*/
|
|
1237
|
-
get renderImage() {
|
|
1238
|
-
let render = this._renderImage;
|
|
1239
|
-
if (render === void 0) {
|
|
1240
|
-
return void 0;
|
|
1241
|
-
}
|
|
1242
|
-
if (typeof render === "function") {
|
|
1243
|
-
return (props) => {
|
|
1244
|
-
return render(this, props);
|
|
1245
|
-
};
|
|
1246
|
-
}
|
|
1247
|
-
return (props) => render;
|
|
1248
|
-
}
|
|
1249
|
-
/**
|
|
1250
|
-
* If the quest is in development.
|
|
1251
|
-
*/
|
|
1252
|
-
get isInDevelopment() {
|
|
1253
|
-
return this._isInDevelopment;
|
|
1254
|
-
}
|
|
1255
|
-
/**
|
|
1256
|
-
* The index of the current stage.
|
|
1257
|
-
*/
|
|
1258
|
-
get currentStageIndex() {
|
|
1259
|
-
return this.getStorageProperty("currentStageIndex");
|
|
1260
|
-
}
|
|
1261
|
-
set currentStageIndex(value) {
|
|
1262
|
-
this.setStorageProperty("currentStageIndex", value);
|
|
1263
|
-
}
|
|
1264
|
-
/**
|
|
1265
|
-
* The current stage.
|
|
1266
|
-
*/
|
|
1267
|
-
get currentStage() {
|
|
1268
|
-
let index = this.currentStageIndex;
|
|
1269
|
-
if (index === void 0 || index >= this.stages.length) {
|
|
1270
|
-
return void 0;
|
|
1271
|
-
}
|
|
1272
|
-
return this.stages[index];
|
|
1273
|
-
}
|
|
1274
|
-
/**
|
|
1275
|
-
* If the quest is started.
|
|
1276
|
-
*/
|
|
1277
|
-
get started() {
|
|
1278
|
-
return this.currentStageIndex !== void 0;
|
|
1279
|
-
}
|
|
1280
|
-
/**
|
|
1281
|
-
* If the quest is completed.
|
|
1282
|
-
*/
|
|
1283
|
-
get completed() {
|
|
1284
|
-
if (this.currentStageIndex === void 0) {
|
|
1285
|
-
return false;
|
|
1286
|
-
}
|
|
1287
|
-
return this.currentStageIndex > this.stages.length - 1;
|
|
1288
|
-
}
|
|
1289
|
-
/**
|
|
1290
|
-
* The function that will be called when the quest starts.
|
|
1291
|
-
*/
|
|
1292
|
-
get onStart() {
|
|
1293
|
-
return this._onStart;
|
|
1294
|
-
}
|
|
1295
|
-
/**
|
|
1296
|
-
* The function that will be called when the quest goes to the next stage.
|
|
1297
|
-
*/
|
|
1298
|
-
get onNextStage() {
|
|
1299
|
-
return this._onNextStage;
|
|
1300
|
-
}
|
|
1301
|
-
/**
|
|
1302
|
-
* Start the quest.
|
|
1303
|
-
* @param props The properties for the start stage. If you not want to pass any property, you can pass an {}.
|
|
1304
|
-
* @returns
|
|
1305
|
-
*/
|
|
1306
|
-
start(props) {
|
|
1307
|
-
if (this.started) {
|
|
1308
|
-
console.warn(`[NQTR] Quest ${this.id} is already started`);
|
|
1309
|
-
return;
|
|
1310
|
-
}
|
|
1311
|
-
if (this.stages.length === 0) {
|
|
1312
|
-
console.error(`[NQTR] Quest ${this.id} has no stages`);
|
|
1313
|
-
return;
|
|
1314
|
-
}
|
|
1315
|
-
this.currentStageIndex = 0;
|
|
1316
|
-
let currentStage = this.currentStage;
|
|
1317
|
-
if (currentStage && currentStage.start) {
|
|
1318
|
-
this.onStart && this.onStart(this, props);
|
|
1319
|
-
return currentStage.start(props);
|
|
1320
|
-
} else {
|
|
1321
|
-
console.error(`[NQTR] Quest ${this.id} has no start stage`);
|
|
1322
|
-
}
|
|
1323
|
-
}
|
|
1324
|
-
/**
|
|
1325
|
-
* Go to the next stage if the current stage is completed.
|
|
1326
|
-
* If you want to force the change of stage, use goNextStage.
|
|
1327
|
-
* @param props The properties. If you not want to pass any property, you can pass an {}.
|
|
1328
|
-
* @returns true if the stage was changed, false otherwise.
|
|
1329
|
-
*/
|
|
1330
|
-
tryToGoNextStage(props) {
|
|
1331
|
-
if (!this.started) {
|
|
1332
|
-
return false;
|
|
1333
|
-
}
|
|
1334
|
-
if (this.completed) {
|
|
1335
|
-
return false;
|
|
1336
|
-
}
|
|
1337
|
-
let currentStage = this.currentStage;
|
|
1338
|
-
if (!currentStage) {
|
|
1339
|
-
console.error(`[NQTR] Quest ${this.id} has no current stage`);
|
|
1340
|
-
return false;
|
|
1341
|
-
}
|
|
1342
|
-
if (currentStage.completed) {
|
|
1343
|
-
return this.goNextStage(props);
|
|
1344
|
-
}
|
|
1345
|
-
return false;
|
|
1346
|
-
}
|
|
1347
|
-
/**
|
|
1348
|
-
* Complete the current stage and go to the next stage.
|
|
1349
|
-
* If you want to go to the next stage only if the current stage is completed, use tryToGoNextStage.
|
|
1350
|
-
* @param props The properties. If you not want to pass any property, you can pass an {}.
|
|
1351
|
-
* @returns true if the stage was changed, false otherwise.
|
|
1352
|
-
*/
|
|
1353
|
-
completeCurrentStageAndGoNext(props) {
|
|
1354
|
-
let currentStage = this.currentStage;
|
|
1355
|
-
if (!currentStage) {
|
|
1356
|
-
console.error(`[NQTR] Quest ${this.id} has no current stage`);
|
|
1357
|
-
return false;
|
|
1358
|
-
}
|
|
1359
|
-
currentStage.completed = true;
|
|
1360
|
-
return this.goNextStage(props);
|
|
1361
|
-
}
|
|
1362
|
-
/**
|
|
1363
|
-
* Go to the next stage without checking if the current stage is completed.
|
|
1364
|
-
* If you want to go to the next stage only if the current stage is completed, use tryToGoNextStage.
|
|
1365
|
-
* @param props The properties. If you not want to pass any property, you can pass an {}.
|
|
1366
|
-
* @returns returns true if the stage was changed, false otherwise.
|
|
1367
|
-
*/
|
|
1368
|
-
goNextStage(props) {
|
|
1369
|
-
if (!this.started) {
|
|
1370
|
-
console.warn(`[NQTR] Quest ${this.id} is not started`);
|
|
1371
|
-
return false;
|
|
1372
|
-
}
|
|
1373
|
-
if (this.completed) {
|
|
1374
|
-
console.warn(`[NQTR] Quest ${this.id} is already completed`);
|
|
1375
|
-
return false;
|
|
1376
|
-
}
|
|
1377
|
-
let prevStage = this.currentStage;
|
|
1378
|
-
let currentStageIndex = this.currentStageIndex;
|
|
1379
|
-
if (!prevStage || currentStageIndex === void 0) {
|
|
1380
|
-
console.error(`[NQTR] Quest ${this.id} has no current stage`);
|
|
1381
|
-
return false;
|
|
1382
|
-
}
|
|
1383
|
-
this.currentStageIndex = currentStageIndex + 1;
|
|
1384
|
-
this.onNextStage && this.onNextStage(this, props);
|
|
1385
|
-
if (prevStage && prevStage.onEnd) {
|
|
1386
|
-
prevStage.onEnd(prevStage, props);
|
|
1387
|
-
}
|
|
1388
|
-
let nextCurrentStage = this.currentStage;
|
|
1389
|
-
if (nextCurrentStage) {
|
|
1390
|
-
nextCurrentStage.inizialize();
|
|
1391
|
-
if (this.currentStageMustStart) {
|
|
1392
|
-
this.startCurrentStage(props);
|
|
1393
|
-
}
|
|
1394
|
-
}
|
|
1395
|
-
return true;
|
|
1396
|
-
}
|
|
1397
|
-
/**
|
|
1398
|
-
* If the current stage must start. It is true if the current stage is not started, can start and not completed.
|
|
1399
|
-
*/
|
|
1400
|
-
get currentStageMustStart() {
|
|
1401
|
-
let currentStage = this.currentStage;
|
|
1402
|
-
if (!currentStage) {
|
|
1403
|
-
return false;
|
|
1404
|
-
}
|
|
1405
|
-
return !currentStage.started && currentStage.canStart && !currentStage.completed;
|
|
1406
|
-
}
|
|
1407
|
-
/**
|
|
1408
|
-
* Start the current stage.
|
|
1409
|
-
* @param props The properties for the start stage. If you not want to pass any property, you can pass an {}.
|
|
1410
|
-
*/
|
|
1411
|
-
startCurrentStage(props) {
|
|
1412
|
-
let newCurrentStage = this.currentStage;
|
|
1413
|
-
if (newCurrentStage && this.currentStageMustStart) {
|
|
1414
|
-
newCurrentStage.start(props);
|
|
1415
|
-
} else {
|
|
1416
|
-
console.warn(`[NQTR] Quest ${this.id} can't start the current stage`);
|
|
1417
|
-
}
|
|
1418
|
-
}
|
|
1419
|
-
};
|
|
1420
|
-
|
|
1421
|
-
// src/functions/RoutineFunctions.ts
|
|
1422
|
-
function getCurrentRoutine() {
|
|
1423
|
-
let character_commitments = {};
|
|
1424
|
-
getTemporaryCommitments().reverse().forEach((c) => {
|
|
1425
|
-
if (!c.hidden) {
|
|
1426
|
-
if (c.characters.length > 0) {
|
|
1427
|
-
let allAvailable = c.characters.every((ch) => !character_commitments[ch.id] || c.priority > character_commitments[ch.id].priority);
|
|
1428
|
-
if (allAvailable) {
|
|
1429
|
-
c.characters.forEach((ch) => {
|
|
1430
|
-
character_commitments[ch.id] = c;
|
|
1431
|
-
});
|
|
1432
|
-
}
|
|
1433
|
-
} else {
|
|
1434
|
-
console.error(`[NQTR] The commitment ${c.id} has no characters assigned`);
|
|
1435
|
-
}
|
|
1436
|
-
}
|
|
1437
|
-
});
|
|
1438
|
-
getFixedRoutine().reverse().forEach((c) => {
|
|
1439
|
-
if (!c.hidden) {
|
|
1440
|
-
if (c.characters.length > 0) {
|
|
1441
|
-
let allAvailable = c.characters.every((ch) => !character_commitments[ch.id] || c.priority > character_commitments[ch.id].priority);
|
|
1442
|
-
if (allAvailable) {
|
|
1443
|
-
c.characters.forEach((ch) => {
|
|
1444
|
-
character_commitments[ch.id] = c;
|
|
1445
|
-
});
|
|
1446
|
-
}
|
|
1447
|
-
} else {
|
|
1448
|
-
console.error(`[NQTR] The commitment ${c.id} has no characters assigned`);
|
|
1449
|
-
}
|
|
1450
|
-
}
|
|
1451
|
-
});
|
|
1452
|
-
return Object.values(character_commitments);
|
|
1453
|
-
}
|
|
1454
|
-
|
|
1455
|
-
// src/classes/navigation/Room.ts
|
|
1456
|
-
var ROOM_CATEGORY = "__nqtr-room__";
|
|
1457
|
-
var RoomBaseModel2 = class extends pixiVn.StoredClassModel {
|
|
1458
|
-
/**
|
|
1459
|
-
* @param id The id of the room, it must be unique.
|
|
1460
|
-
* @param location The location where the room is.
|
|
1461
|
-
* @param props The properties of the room.
|
|
1462
|
-
*/
|
|
1463
|
-
constructor(id, location, props = {}) {
|
|
1464
|
-
var _a;
|
|
1465
|
-
super(ROOM_CATEGORY, id);
|
|
1466
|
-
this._location = location;
|
|
1467
|
-
this.defaultName = props.name || "";
|
|
1468
|
-
this._renderImage = props.renderImage;
|
|
1469
|
-
this.defaultActivityIds = ((_a = props.defaultActivities) == null ? void 0 : _a.map((activity) => activity.id)) || [];
|
|
1470
|
-
this.defaultDisabled = props.disabled || false;
|
|
1471
|
-
this.defaultHidden = props.hidden || false;
|
|
1472
|
-
this._renderIcon = props.renderIcon;
|
|
1473
|
-
this._isEntrance = props.isEntrance;
|
|
1474
|
-
}
|
|
1475
|
-
/**
|
|
1476
|
-
* The location where the room is.
|
|
1477
|
-
*/
|
|
1478
|
-
get location() {
|
|
1479
|
-
return this._location;
|
|
1480
|
-
}
|
|
1481
|
-
/**
|
|
1482
|
-
* Whether is an entrance room, so when the player enters in the location, it will be the first room to be shown.
|
|
1483
|
-
*/
|
|
1484
|
-
get isEntrance() {
|
|
1485
|
-
return this._isEntrance || false;
|
|
1486
|
-
}
|
|
1487
|
-
/**
|
|
1488
|
-
* The name.
|
|
1489
|
-
* If you set undefined, it will return the initial value of name.
|
|
1490
|
-
*/
|
|
1491
|
-
get name() {
|
|
1492
|
-
return this.getStorageProperty("name") || this.defaultName;
|
|
1493
|
-
}
|
|
1494
|
-
set name(value) {
|
|
1495
|
-
this.setStorageProperty("name", value);
|
|
1496
|
-
}
|
|
1497
|
-
/**
|
|
1498
|
-
* The function for rendering the image of the room.
|
|
1499
|
-
*/
|
|
1500
|
-
get renderImage() {
|
|
1501
|
-
let render = this._renderImage;
|
|
1502
|
-
if (render === void 0) {
|
|
1503
|
-
return void 0;
|
|
1504
|
-
}
|
|
1505
|
-
if (typeof render === "function") {
|
|
1506
|
-
return (props) => {
|
|
1507
|
-
return render(this, props);
|
|
1508
|
-
};
|
|
1509
|
-
}
|
|
1510
|
-
return (props) => render;
|
|
1511
|
-
}
|
|
1512
|
-
/**
|
|
1513
|
-
* The activities that are available in this room.
|
|
1514
|
-
*/
|
|
1515
|
-
get defaultActivities() {
|
|
1516
|
-
let roomMemories = this.getStorageProperty("activities_memory") || {};
|
|
1517
|
-
let activities = this.defaultActivityIds.map((id) => {
|
|
1518
|
-
let activity = getActivityById(id);
|
|
1519
|
-
if (!activity) {
|
|
1520
|
-
console.warn(`[NQTR] Activity with id ${id} not found, so it will be ignored.`);
|
|
1521
|
-
return void 0;
|
|
1522
|
-
}
|
|
1523
|
-
let memory = activity.export();
|
|
1524
|
-
if (roomMemories && roomMemories[id]) {
|
|
1525
|
-
memory = __spreadValues(__spreadValues({}, memory), roomMemories[id]);
|
|
1526
|
-
}
|
|
1527
|
-
return new ActivityRoom(id, this, activity._initialOnRun, memory);
|
|
1528
|
-
}).filter((activity) => activity !== void 0);
|
|
1529
|
-
return activities;
|
|
1530
|
-
}
|
|
1531
|
-
get activityIds() {
|
|
1532
|
-
let addedActivityIds = this.getStorageProperty(`addedActivityIds`) || [];
|
|
1533
|
-
return this.defaultActivityIds.concat(addedActivityIds);
|
|
1534
|
-
}
|
|
1535
|
-
/**
|
|
1536
|
-
* The activities that are available in this room.
|
|
1537
|
-
*/
|
|
1538
|
-
get activities() {
|
|
1539
|
-
let activities = this.activityIds.map((id) => {
|
|
1540
|
-
return this.getActivity(id);
|
|
1541
|
-
}).filter((activity) => activity !== void 0 && !activity.hidden);
|
|
1542
|
-
return activities;
|
|
1543
|
-
}
|
|
1544
|
-
/**
|
|
1545
|
-
* Get the memory of an activity. This function can be used into olther libraries to get the memory of the activity.
|
|
1546
|
-
* @param id The id of the activity.
|
|
1547
|
-
* @returns The memory of the activity.
|
|
1548
|
-
*/
|
|
1549
|
-
getActivityMemory(id) {
|
|
1550
|
-
let roomMemories = this.getStorageProperty("activities_memory") || {};
|
|
1551
|
-
let roomMemory = roomMemories[id] || {};
|
|
1552
|
-
return roomMemory;
|
|
1553
|
-
}
|
|
1554
|
-
/**
|
|
1555
|
-
* Get the activity by id.
|
|
1556
|
-
* @param id The id of the activity.
|
|
1557
|
-
* @returns The room activity.
|
|
1558
|
-
*/
|
|
1559
|
-
getActivity(id) {
|
|
1560
|
-
if (!this.activityIds.includes(id)) {
|
|
1561
|
-
console.error(`[NQTR] Activity with id ${id} not found in room ${this.id}`);
|
|
1562
|
-
return void 0;
|
|
1563
|
-
}
|
|
1564
|
-
let activity = getActivityById(id);
|
|
1565
|
-
if (!activity) {
|
|
1566
|
-
console.error(`[NQTR] Activity with id ${id} not found`);
|
|
1567
|
-
return void 0;
|
|
1568
|
-
}
|
|
1569
|
-
let roomMemories = this.getStorageProperty("activities_memory") || {};
|
|
1570
|
-
let roomMemory = roomMemories[id] || {};
|
|
1571
|
-
roomMemory = __spreadValues(__spreadValues({}, activity.export()), roomMemory);
|
|
1572
|
-
return new ActivityRoom(id, this, activity._initialOnRun, roomMemory);
|
|
1573
|
-
}
|
|
1574
|
-
/**
|
|
1575
|
-
* Set the memory of an activity. This function can be used into olther libraries to set the memory of the activity.
|
|
1576
|
-
* @param id The id of the activity.
|
|
1577
|
-
* @param memory The memory of the activity.
|
|
1578
|
-
*/
|
|
1579
|
-
setActivity(activity) {
|
|
1580
|
-
let roomMemories = this.getStorageProperty("activities_memory") || {};
|
|
1581
|
-
roomMemories[activity.id] = activity.export();
|
|
1582
|
-
this.setStorageProperty("activities_memory", roomMemories);
|
|
1583
|
-
}
|
|
1584
|
-
/**
|
|
1585
|
-
* Add an activity to the room.
|
|
1586
|
-
* @param activity The activity to add.
|
|
1587
|
-
*/
|
|
1588
|
-
addActivity(activity) {
|
|
1589
|
-
if (this.activityIds.includes(activity.id)) {
|
|
1590
|
-
let currentActivity = this.getActivity(activity.id);
|
|
1591
|
-
if (currentActivity && currentActivity.isExpired()) {
|
|
1592
|
-
this.removeActivity(activity.id);
|
|
1593
|
-
return;
|
|
1594
|
-
} else {
|
|
1595
|
-
console.error(`[NQTR] Activity with id ${activity.id} already exists in room ${this.id}, so it will be ignored.`);
|
|
1596
|
-
return;
|
|
1597
|
-
}
|
|
1598
|
-
}
|
|
1599
|
-
let addedActivityIds = this.getStorageProperty(`addedActivityIds`) || [];
|
|
1600
|
-
addedActivityIds.push(activity.id);
|
|
1601
|
-
this.setStorageProperty("addedActivityIds", addedActivityIds);
|
|
1602
|
-
}
|
|
1603
|
-
/**
|
|
1604
|
-
* Remove an activity from the room.
|
|
1605
|
-
* @param activity The activity to remove.
|
|
1606
|
-
*/
|
|
1607
|
-
removeActivity(activity) {
|
|
1608
|
-
let activityId = typeof activity === "string" ? activity : activity.id;
|
|
1609
|
-
if (this.defaultActivityIds.includes(activityId)) {
|
|
1610
|
-
console.warn(`[NQTR] Activity with id ${activityId} is a default activity, so it can't be removed. It will be hidden instead.`);
|
|
1611
|
-
let activityToEdit = this.getActivity(activityId);
|
|
1612
|
-
if (!activityToEdit) {
|
|
1613
|
-
console.error(`[NQTR] Activity with id ${activityId} not found, so it can't be hidden.`);
|
|
1614
|
-
return;
|
|
1615
|
-
}
|
|
1616
|
-
activityToEdit.hidden = true;
|
|
1617
|
-
return;
|
|
1618
|
-
}
|
|
1619
|
-
let addedActivityIds = this.getStorageProperty(`addedActivityIds`) || [];
|
|
1620
|
-
let index = addedActivityIds.indexOf(activityId);
|
|
1621
|
-
if (index === -1) {
|
|
1622
|
-
console.error(`[NQTR] Activity with id ${activityId} not found, so it can't be removed.`);
|
|
1623
|
-
return;
|
|
1624
|
-
}
|
|
1625
|
-
addedActivityIds.splice(index, 1);
|
|
1626
|
-
this.setStorageProperty("addedActivityIds", addedActivityIds);
|
|
1627
|
-
let roomMemories = this.getStorageProperty("activities_memory") || {};
|
|
1628
|
-
delete roomMemories[activityId];
|
|
1629
|
-
this.setStorageProperty("activities_memory", roomMemories);
|
|
1630
|
-
}
|
|
1631
|
-
/**
|
|
1632
|
-
* Clear all expired activities.
|
|
1633
|
-
*/
|
|
1634
|
-
clearExpiredActivities() {
|
|
1635
|
-
this.activities.forEach((activity) => {
|
|
1636
|
-
if (activity.isExpired()) {
|
|
1637
|
-
this.removeActivity(activity.id);
|
|
1638
|
-
}
|
|
1639
|
-
});
|
|
1640
|
-
}
|
|
1641
|
-
/**
|
|
1642
|
-
* Whether is disabled. If it is a string, it is a Pixi'VN flag name.
|
|
1643
|
-
*/
|
|
1644
|
-
get disabled() {
|
|
1645
|
-
let value = this.getStorageProperty("disabled") || this.defaultDisabled;
|
|
1646
|
-
if (typeof value === "string") {
|
|
1647
|
-
return pixiVn.getFlag(value);
|
|
1648
|
-
}
|
|
1649
|
-
return value;
|
|
1650
|
-
}
|
|
1651
|
-
set disabled(value) {
|
|
1652
|
-
this.setStorageProperty("disabled", value);
|
|
1653
|
-
}
|
|
1654
|
-
/**
|
|
1655
|
-
* Whether is hidden. If it is a string, it is a Pixi'VN flag name.
|
|
1656
|
-
*/
|
|
1657
|
-
get hidden() {
|
|
1658
|
-
let value = this.getStorageProperty("hidden") || this.defaultHidden;
|
|
1659
|
-
if (typeof value === "string") {
|
|
1660
|
-
return pixiVn.getFlag(value);
|
|
1661
|
-
}
|
|
1662
|
-
return value;
|
|
1663
|
-
}
|
|
1664
|
-
set hidden(value) {
|
|
1665
|
-
this.setStorageProperty("hidden", value);
|
|
1666
|
-
}
|
|
1667
|
-
/**
|
|
1668
|
-
* The function for rendering the icon of the room.
|
|
1669
|
-
*/
|
|
1670
|
-
get renderIcon() {
|
|
1671
|
-
let render = this._renderIcon;
|
|
1672
|
-
if (render === void 0) {
|
|
1673
|
-
return void 0;
|
|
1674
|
-
}
|
|
1675
|
-
if (typeof render === "function") {
|
|
1676
|
-
return (props) => {
|
|
1677
|
-
return render(this, props);
|
|
1678
|
-
};
|
|
1679
|
-
}
|
|
1680
|
-
return (props) => render;
|
|
1681
|
-
}
|
|
1682
|
-
/**
|
|
1683
|
-
* Get the character commitments of the room.
|
|
1684
|
-
* @returns The character commitments of the room.
|
|
1685
|
-
*/
|
|
1686
|
-
getRoutine() {
|
|
1687
|
-
let commitments = getCurrentRoutine();
|
|
1688
|
-
return commitments.filter((c) => c.room.id === this.id);
|
|
1689
|
-
}
|
|
1690
|
-
};
|
|
1691
|
-
|
|
1692
|
-
exports.ActivityRoom = ActivityRoom;
|
|
1693
|
-
exports.CommitmentBaseModel = CommitmentBaseModel;
|
|
1694
|
-
exports.Goal = Goal;
|
|
1695
|
-
exports.LocationBaseModel = LocationBaseModel;
|
|
1696
|
-
exports.MapBaseModel = MapBaseModel;
|
|
1697
|
-
exports.Quest = Quest;
|
|
1698
|
-
exports.RoomBaseModel = RoomBaseModel2;
|
|
1699
|
-
exports.Stage = Stage;
|
|
1700
|
-
//# sourceMappingURL=out.js.map
|
|
1
|
+
'use strict';var pixiVn=require('@drincs/pixi-vn');var g={};function j(n){try{let e=g[n];if(!e){console.error(`[NQTR] Room ${n} not found`);return}return e}catch(e){console.error(`[NQTR] Error while getting Room ${n}`,e);return}}var G="___nqtr-current_room_memory___",b=class{get rooms(){return Object.values(g)}get locations(){let e={};return Object.values(g).forEach(t=>{e[t.location.id]=t.location;}),Object.values(e)}get maps(){let e={};return Object.values(g).forEach(t=>{e[t.location.map.id]=t.location.map;}),Object.values(e)}get currentRoom(){let e=pixiVn.storage.getVariable(G);if(!e){console.error("[NQTR] The current room has not yet been set");return}let t=j(e);if(!t){console.error(`[NQTR] Current room ${e} not found`);return}return t}set currentRoom(e){if(!j(e.id)){console.error(`[NQTR] The room ${e.id} is not registered, so it can't be set as current room`);return}pixiVn.storage.setVariable(G,e.id);}get currentLocation(){return this.currentRoom?.location}get currentMap(){return this.currentRoom?.location.map}clearExpiredActivities(){Object.entries(g).forEach(([e,t])=>{t.clearExpiredActivities();});}};var E={},Q={};function w(n){try{let e=E[n];if(!e){console.error(`[NQTR] Commitment ${n} not found`);return}return e}catch(e){console.error(`[NQTR] Error while getting Commitment ${n}`,e);return}}var C="___nqtr-temporary_commitment___",_=class{get fixedRoutine(){return Object.values(Q)}set fixedRoutine(e){e.forEach(t=>{Q[t.id]&&console.warn(`[NQTR] Commitment id ${t.id} already exists, it will be overwritten`),Q[t.id]=t;});}get temporaryRoutine(){let e=pixiVn.storage.getVariable(C);return e?e.map(r=>w(r)).filter(r=>r!==undefined):[]}get allRoutine(){return [...this.fixedRoutine,...this.temporaryRoutine]}add(e){Array.isArray(e)||(e=[e]);let t=e.map(r=>{if(!w(r.id)){console.warn(`[NQTR] Commitment ${r.id} not found, it will be ignored`);return}return r.id}).filter(r=>r!==undefined);pixiVn.storage.setVariable(C,t);}find(e){return w(e)}remove(e){Array.isArray(e)||(e=[e]);let t=e.map(i=>i.id),r=pixiVn.storage.getVariable(C);r&&(r=r.filter(i=>!t.includes(i)),pixiVn.storage.setVariable(C,r));}clearExpiredRoutine(){Object.values(E).forEach(e=>{e.expired&&delete E[e.id];});}get currentRoutine(){let e={};return [...this.temporaryRoutine,...this.fixedRoutine].reverse().forEach(t=>{t.isActive&&(t.characters.length>0?t.characters.every(i=>!e[i.id]||t.priority>e[i.id].priority)&&t.characters.forEach(i=>{e[i.id]=t;}):console.error(`[NQTR] The commitment ${t.id} has no characters assigned`));}),Object.values(e)}get currentRoomRoutine(){return h.currentRoom?.routine||[]}getCommitmentByCharacter(e){this.currentRoutine.forEach(t=>{if(t.characters.map(r=>r.id).includes(e.id))return t});}};var f="___nqtr-time_manager_data___";var u=class{static minDayHours=0;static maxDayHours=24;static defaultTimeSpent=1;static timeSlots=[];static weekLength=7;static weekendStartDay=this.weekLength-1;static weekDaysNames=[]};var x=class{initialize(e){let{minDayHours:t=0,maxDayHours:r=24,defaultTimeSpent:i=1,timeSlots:a=[],weekLength:o=7,weekendStartDay:s=o-1,weekDaysNames:c=[]}=e;u.minDayHours=t,u.maxDayHours=r,u.defaultTimeSpent=i,u.timeSlots=a,u.weekLength=o,s>=u.weekLength?console.warn(`[NQTR] Weekend start day should be less than week length ${o}, so will be ignored`):u.weekendStartDay=s,c.length!==o?console.warn(`[NQTR] Week days names should be equal to week length ${o}, so will be ignored`):u.weekDaysNames=c;}get minDayHours(){return u.minDayHours}get maxDayHours(){return u.maxDayHours}get defaultTimeSpent(){return u.defaultTimeSpent}get timeSlots(){return u.timeSlots}get weekLength(){return u.weekLength}get weekendStartDay(){return u.weekendStartDay}get weekDaysNames(){return u.weekDaysNames}get currentHour(){let e=pixiVn.storage.getVariable(f)||{};return e.hasOwnProperty("currentHour")&&typeof e.currentHour=="number"?e.currentHour:this.minDayHours}set currentHour(e){let t=pixiVn.storage.getVariable(f)||{};typeof e=="number"?t.currentHour=e:delete t.currentHour,pixiVn.storage.setVariable(f,t);}get currentDay(){let e=pixiVn.storage.getVariable(f)||{};return e.hasOwnProperty("currentDay")&&typeof e.currentDay=="number"?e.currentDay:0}set currentDay(e){let t=pixiVn.storage.getVariable(f)||{};typeof e=="number"?t.currentDay=e:delete t.currentDay,pixiVn.storage.setVariable(f,t);}get isWeekend(){return this.currentWeekDayNumber>=this.weekendStartDay}get currentWeekDayNumber(){return this.currentDay%this.weekLength+1}get currentDayName(){let e=this.currentWeekDayNumber-1;return e>=this.weekDaysNames.length?(console.warn(`[NQTR] Week day name is not defined for day ${e}`,this.weekDaysNames),""):this.weekDaysNames[e]}get currentTimeSlot(){if(this.timeSlots.length===0)return console.warn("[NQTR] Time slots are not defined"),0;for(let e=0;e<this.timeSlots.length;e++){let t=this.timeSlots[e];if(this.timeSlots.length>e+1&&this.nowIsBetween(t.startHour,this.timeSlots[e+1].startHour))return e}return this.timeSlots.length-1}increaseHour(e=this.defaultTimeSpent){let t=this.currentHour+e;return t>=this.maxDayHours&&(this.increaseDay(),t=this.minDayHours+(t-this.maxDayHours)),this.currentHour=t,this.currentHour}increaseDay(e=this.minDayHours,t=1){let r=this.currentDay+t;return this.currentDay=r,this.currentHour=e,this.currentDay}nowIsBetween(e,t){e===undefined&&(e=this.minDayHours),t===undefined&&(t=this.maxDayHours);let r=this.currentHour;return e<t?r>=e&&r<t:r>=e||r<t}};var d=new x,h=new b,H=new _;var Z="__nqtr-activity__",m=class extends pixiVn.StoredClassModel{constructor(t,r,i,a=Z){super(a,t);this._onRun=r;this._fromHour=i.fromHour,this._toHour=i.toHour,this._fromDay=i.fromDay,this._toDay=i.toDay;}_fromHour;get fromHour(){return this._fromHour}_toHour;get toHour(){return this._toHour}_fromDay;get fromDay(){return this._fromDay}_toDay;get toDay(){return this._toDay}get run(){return t=>this._onRun(this,t)}get expired(){return !!(this.toDay&&this.toDay<=d.currentDay)}get isActive(){return !(this.fromDay&&this.fromDay>d.currentDay||this.toDay&&this.toDay<d.currentDay||!d.nowIsBetween(this.fromHour,this.toHour))}};var P=class extends m{constructor(e,t,r){super(e,t,{fromHour:r.fromHour,toHour:r.toHour,fromDay:r.fromDay,toDay:r.toDay}),this.defaultName=r.name||"",this.defaultDisabled=r.disabled||false,this.defaultHidden=r.hidden||false,this._icon=r.renderIcon;}defaultName;get name(){return this.getStorageProperty("name")||this.defaultName}set name(e){this.setStorageProperty("name",e);}defaultDisabled;get disabled(){let e=this.getStorageProperty("disabled")||this.defaultDisabled;return typeof e=="string"?pixiVn.getFlag(e):e}set disabled(e){this.setStorageProperty("disabled",e);}defaultHidden;get hidden(){let e=this.getStorageProperty("hidden")||this.defaultHidden;return typeof e=="string"?pixiVn.getFlag(e):e}set hidden(e){this.setStorageProperty("hidden",e);}_icon;get icon(){return this._icon}};var ee="__nqtr-commitment__",T=class extends m{constructor(t,r,i,a,o,s,c){s=s||(()=>{});super(t,s,c,ee);this._characters=r;this._room=i;this.defaultExecutionType=a;this.defaultPriority=o;}get characters(){return this._characters}get room(){return this._room}get executionType(){return this.getStorageProperty("executionType")||this.defaultExecutionType}set executionType(t){this.setStorageProperty("executionType",t);}get priority(){return this.getStorageProperty("priority")||this.defaultPriority||0}set priority(t){this.setStorageProperty("priority",t);}};var O=class extends T{constructor(e,t,r,i){super(e,t?Array.isArray(t)?t:[t]:[],r,i.executionType||"interaction",i.priority||0,i.onRun,{fromHour:i.fromHour,toHour:i.toHour,fromDay:i.fromDay,toDay:i.toDay}),this._name=i.name||"",this._image=i.image,this.defaultDisabled=i.disabled||false,this.defaultHidden=i.hidden||false,this._icon=i.icon;}_name;get name(){return this._name}_image;get image(){return this._image}_icon;get icon(){return this._icon}defaultDisabled;get disabled(){let e=this.getStorageProperty("disabled")||this.defaultDisabled;return typeof e=="string"?pixiVn.getFlag(e):e}set disabled(e){this.setStorageProperty("disabled",e);}defaultHidden;get hidden(){if(this.fromDay&&this.fromDay>d.currentDay||!d.nowIsBetween(this.fromHour,this.toHour)||!this.expired)return true;let e=this.getStorageProperty("hidden")||this.defaultHidden;return typeof e=="string"?pixiVn.getFlag(e):e}set hidden(e){this.setStorageProperty("hidden",e);}};var te={};function q(n){try{let e=te[n];if(!e){console.error(`[NQTR] Activity ${n} not found`);return}return e}catch(e){console.error(`[NQTR] Error while getting Activity ${n}`,e);return}}var l=class extends pixiVn.StoredClassModel{constructor(t,r,i=[]){super(t,r);this.defaultActivities=i;}get defaultActivitiesIds(){return this.defaultActivities.map(t=>t.id)}get activeActivityScheduling(){return this.getStorageProperty("activeActivityScheduling")||{}}get excludedActivitiesScheduling(){return this.getStorageProperty("excludedActivitiesScheduling")||{}}removeActivityScheduling(t){let r=this.activeActivityScheduling;delete r[t],this.setStorageProperty("activeActivityScheduling",r);let i=this.excludedActivitiesScheduling;delete i[t],this.setStorageProperty("excludedActivitiesScheduling",i);}editActivityScheduling(t,r){this.removeActivityScheduling(t);let i=this.activeActivityScheduling;i[t]=r,this.setStorageProperty("activeActivityScheduling",i);}editExcludedActivityScheduling(t,r){this.removeActivityScheduling(t);let i=this.excludedActivitiesScheduling;i[t]=r,this.setStorageProperty("excludedActivitiesScheduling",i);}get additionalActivitiesIds(){return this.getStorageProperty("additionalActivitiesIds")||[]}get excludedActivitiesIds(){return this.getStorageProperty("excludedActivitiesIds")||[]}addActivity(t,r={}){let{hours:i,fromDay:a,toDay:o}=r,s={};if(i){if(i.from>=i.to)throw new Error("[NQTR] The from hour must be less than the to hour.");s.fromHour=i.from;}if(a===0&&console.warn("[NQTR] The from day must be greater than 0, so it will be ignored."),o===0&&console.warn("[NQTR] The to day must be greater than 0, so it will be ignored."),a&&o&&a>=o)throw new Error("[NQTR] The from day must be less than the to day.");if(a&&(s.fromDay=a),o&&(s.toDay=o),this.defaultActivitiesIds.includes(t.id)){console.warn(`[NQTR] Activity with id ${t.id} already exists, so it will be ignored.`);return}let c=this.additionalActivitiesIds;if(c.includes(t.id)){if(Object.keys(s).length){this.editActivityScheduling(t.id,s);return}else if(this.excludedActivitiesIds.includes(t.id)){this.removeActivityScheduling(t.id),console.log(`[NQTR] Activity with id ${t.id} was excluded, so it will be associated with this class again.`);return}console.warn(`[NQTR] Activity with id ${t.id} already exists, so it will be ignored.`);return}c.push(t.id),this.setStorageProperty("additionalActivitiesIds",c),Object.keys(s).length&&this.editActivityScheduling(t.id,s);}revoveActivity(t,r={}){let{toDay:i}=r,a={};i===0&&console.warn("[NQTR] The to day must be greater than 0, so it will be ignored."),i&&(a.toDay=i);let o=this.additionalActivitiesIds;if(o.includes(t.id)){if(Object.keys(a).length){this.editExcludedActivityScheduling(t.id,a);return}o=o.filter(s=>s!==t.id),this.setStorageProperty("additionalActivitiesIds",o);}else if(this.defaultActivitiesIds.includes(t.id)){if(Object.keys(a).length){this.editExcludedActivityScheduling(t.id,a);return}let s=this.excludedActivitiesIds;s.push(t.id),this.setStorageProperty("excludedActivitiesIds",s);}else console.warn(`[NQTR] Activity with id ${t.id} not found, so it will be ignored.`);}clearExpiredActivities(){let t=this.activeActivityScheduling,r=this.excludedActivitiesScheduling,i=this.additionalActivitiesIds,a=this.excludedActivitiesIds;i.forEach(o=>{if(o in t){let{toDay:s}=t[o];s&&s<d.currentDay&&(this.removeActivityScheduling(o),i=i.filter(c=>c!==o));}}),a.forEach(o=>{if(o in r){let{toDay:s}=r[o];s&&s<d.currentDay&&(this.removeActivityScheduling(o),a=a.filter(c=>c!==o));}});}get activities(){let t=[];return Object.entries(this.activeActivityScheduling).forEach(([r,i])=>{let a=q(r),{fromDay:o=a?.fromDay,fromHour:s=a?.fromHour,toDay:c=a?.toDay,toHour:Y=a?.toHour}=i;a&&!(s&&Y&&!d.nowIsBetween(s,Y))&&!(o&&o>d.currentDay)&&!(c&&c<d.currentDay)&&t.push(a);}),Object.entries(this.excludedActivitiesScheduling).forEach(([r,i])=>{let a=q(r);a&&a.isActive&&!(i.toDay&&i.toDay>=d.currentDay)&&t.push(a);}),t}};var ie="__nqtr-location__",y=class extends l{constructor(t,r,i=[]){super(ie,t,i);this._map=r;}get map(){return this._map}get rooms(){return h.rooms.filter(t=>t.location.id===this.id)}};var M=class extends y{constructor(e,t,r={}){super(e,t,r.activities||[]),this.defaultName=r.name||"",this.defaultDisabled=r.disabled||false,this.defaultHidden=r.hidden||false,this._icon=r.icon;}defaultName;get name(){return this.getStorageProperty("name")||this.defaultName}set name(e){this.setStorageProperty("name",e);}defaultDisabled;get disabled(){let e=this.getStorageProperty("disabled")||this.defaultDisabled;return typeof e=="string"?pixiVn.getFlag(e):e}set disabled(e){this.setStorageProperty("disabled",e);}defaultHidden;get hidden(){let e=this.getStorageProperty("hidden")||this.defaultHidden;return typeof e=="string"?pixiVn.getFlag(e):e}set hidden(e){this.setStorageProperty("hidden",e);}_icon;get icon(){return this._icon}};var ne="__nqtr-map__",S=class extends l{constructor(e,t=[]){super(ne,e,t);}get locations(){return h.locations.filter(e=>e.map.id===this.id)}};var k=class extends S{constructor(e,t={}){super(e,t.activities||[]),this.defaultName=t.name||"",this._image=t.image;}defaultName;get name(){return this.getStorageProperty("name")||this.defaultName}set name(e){this.setStorageProperty("name",e);}_image;get image(){return this._image}};var ae="__nqtr-room__",v=class extends l{constructor(t,r,i=[]){super(ae,t,i);this._location=r;}get routine(){return H.currentRoutine.filter(t=>t.room.id===this.id)}get location(){return this._location}};var $=class extends v{constructor(e,t,r={}){super(e,t,r.activities||[]),this.defaultName=r.name||"",this._image=r.image,this.defaultDisabled=r.disabled||false,this.defaultHidden=r.hidden||false,this._icon=r.icon;}defaultName;get name(){return this.getStorageProperty("name")||this.defaultName}set name(e){this.setStorageProperty("name",e);}_image;get image(){return this._image}defaultDisabled;get disabled(){let e=this.getStorageProperty("disabled")||this.defaultDisabled;return typeof e=="string"?pixiVn.getFlag(e):e}set disabled(e){this.setStorageProperty("disabled",e);}defaultHidden;get hidden(){let e=this.getStorageProperty("hidden")||this.defaultHidden;return typeof e=="string"?pixiVn.getFlag(e):e}set hidden(e){this.setStorageProperty("hidden",e);}_icon;get icon(){return this._icon}get routine(){return H.currentRoutine.filter(e=>e.room.id===this.id)}};var se="__nqtr-quest__",D=class extends pixiVn.StoredClassModel{constructor(t,r,i={}){super(se,t);this._stages=r;this._onStart=i.onStart,this._onNextStage=i.onNextStage;}get stages(){return this._stages}get currentStageIndex(){return this.getStorageProperty("currentStageIndex")}set currentStageIndex(t){this.setStorageProperty("currentStageIndex",t);}get currentStage(){let t=this.currentStageIndex;if(!(t===undefined||t>=this.stages.length))return this.stages[t]}get started(){return this.currentStageIndex!==undefined}get completed(){return this.currentStageIndex===undefined?false:this.currentStageIndex>this.stages.length-1}get failed(){return this.getStorageProperty("failed")||false}set failed(t){this.setStorageProperty("failed",t);}_onStart;get onStart(){return this._onStart}_onNextStage;get onNextStage(){return this._onNextStage}start(t){if(this.started){console.warn(`[NQTR] Quest ${this.id} is already started`);return}if(this.stages.length===0){console.error(`[NQTR] Quest ${this.id} has no stages`);return}this.currentStageIndex=0;let r=this.currentStage;if(r&&r.start)return this.onStart&&this.onStart(this,t),r.start(t);console.error(`[NQTR] Quest ${this.id} has no start stage`);}tryToGoNextStage(t){if(!this.started||this.completed)return false;let r=this.currentStage;return r?r.completed?this.goNextStage(t):false:(console.error(`[NQTR] Quest ${this.id} has no current stage`),false)}completeCurrentStageAndGoNext(t){let r=this.currentStage;return r?(r.completed=true,this.goNextStage(t)):(console.error(`[NQTR] Quest ${this.id} has no current stage`),false)}goNextStage(t){if(!this.started)return console.warn(`[NQTR] Quest ${this.id} is not started`),false;if(this.completed)return console.warn(`[NQTR] Quest ${this.id} is already completed`),false;let r=this.currentStage,i=this.currentStageIndex;if(!r||i===undefined)return console.error(`[NQTR] Quest ${this.id} has no current stage`),false;this.currentStageIndex=i+1,this.onNextStage&&this.onNextStage(this,t),r&&r.onEnd&&r.onEnd(r,t);let a=this.currentStage;return a&&(a.inizialize(),this.currentStageMustStart&&this.startCurrentStage(t)),true}get currentStageMustStart(){let t=this.currentStage;return t?!t.started&&t.canStart&&!t.completed:false}startCurrentStage(t){let r=this.currentStage;r&&this.currentStageMustStart?r.start(t):console.warn(`[NQTR] Quest ${this.id} can't start the current stage`);}};var B=class extends D{constructor(e,t,r){super(e,t,{onStart:r.onStart,onNextStage:r.onNextStage}),this._name=r.name||"",this._description=r.description||"",this._icon=r.icon,this._image=r.image,this._inDevelopment=r.inDevelopment||false;}_name;get name(){return this._name}_description;get description(){return this._description}_icon;get icon(){return this._icon}_image;get image(){return this._image}_inDevelopment;get inDevelopment(){return this._inDevelopment}};var de="__nqtr-stage__",R=class extends pixiVn.StoredClassModel{constructor(e,t={}){super(de,e),this._onStart=t.onStart,this._onEnd=t.onEnd,this._daysRequiredToStart=t.daysRequiredToStart,this._questsRequiredToStart=t.questsRequiredToStart||[];}_onStart;get onStart(){return this._onStart}_onEnd;get onEnd(){return this._onEnd}get completed(){return this.getStorageProperty("completed")||false}set completed(e){this.setStorageProperty("completed",e);}get started(){return this.getStorageProperty("started")||false}set started(e){this.setStorageProperty("started",e);}get prevStageEndDay(){return this.getStorageProperty("prevStageEndDay")}set prevStageEndDay(e){this.setStorageProperty("prevStageEndDay",e);}get startDay(){let e=this.prevStageEndDay;if(e!==undefined)return e+this.daysRequiredToStart}get canStart(){let e=this.daysRequiredToStart;if(e>0){let t=this.prevStageEndDay;if(t===undefined||t+e>d.currentDay)return false}return !(this.questsRequiredToStart.length>0&&!this.questsRequiredToStart.every(t=>t.quest.currentStageIndex&&t.quest.currentStageIndex>=t.stageNumber))}inizialize(){this.daysRequiredToStart>0&&(this.prevStageEndDay=d.currentDay,console.log(`[NQTR] Stage ${this.id} will start on day ${this.startDay}`));}start(e){this.canStart?(this.started=true,this.onStart&&this.onStart(this,e)):console.warn(`[NQTR] Stage ${this.id} can't start`);}_daysRequiredToStart;get daysRequiredToStart(){return this._daysRequiredToStart||0}_questsRequiredToStart;get questsRequiredToStart(){return this._questsRequiredToStart||[]}};var L=class extends R{constructor(e,t){super(e,{onStart:t.onStart,onEnd:t.onEnd,daysRequiredToStart:t.daysRequiredToStart,questsRequiredToStart:t.questsRequiredToStart}),this._name=t.name||"",this._flags=t.flags||[],this._description=t.description||"",this._adviceDescription=t.adviceDescription||"",this._image=t.image,this._flagsRequiredToStart=t.flagsRequiredToStart||[],this._requestDescriptionToStart=t.requestDescriptionToStart||"";}_name;get name(){return this._name}_description;get description(){return this._description}_adviceDescription;get adviceDescription(){return this._adviceDescription}_image;get image(){return this._image}_flags;get flags(){return this._flags}_flagsRequiredToStart;get flagsRequiredToStart(){return this._flagsRequiredToStart}_requestDescriptionToStart;get requestDescriptionToStart(){return this._requestDescriptionToStart}get completed(){return super.completed?true:this.flags.length>0?!!this.flags.every(e=>pixiVn.getFlag(e.flag)):false}set completed(e){super.completed=e;}get canStart(){return this.flagsRequiredToStart.length>0&&!this.flagsRequiredToStart.every(e=>pixiVn.getFlag(e.flag))?false:super.canStart}};exports.ActivityBaseModel=P;exports.ActivityStoredClass=m;exports.CommitmentBaseModel=O;exports.LocationBaseModel=M;exports.LocationStoredClass=y;exports.MapBaseModel=k;exports.MapStoredClass=S;exports.Quest=B;exports.RoomBaseModel=$;exports.RoomStoredClass=v;exports.Stage=L;//# sourceMappingURL=index.js.map
|
|
1701
2
|
//# sourceMappingURL=index.js.map
|