@drincs/nqtr 0.3.5 → 0.3.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{RoomInterface-BglEhkQT.d.ts → RoomInterface-CdAM_q7P.d.ts} +4 -0
- package/dist/{RoomInterface-DsZAp6Pv.d.mts → RoomInterface-DURfkQ7u.d.mts} +4 -0
- package/dist/{StageInterface-DJ7l0ubG.d.mts → StageInterface-DX74DUxG.d.mts} +1 -1
- package/dist/{StageInterface-DJ7l0ubG.d.ts → StageInterface-DX74DUxG.d.ts} +1 -1
- package/dist/classes/ActivityBaseModel.js +1 -1
- package/dist/classes/ActivityBaseModel.js.map +1 -1
- package/dist/classes/ActivityBaseModel.mjs +1 -1
- package/dist/classes/ActivityBaseModel.mjs.map +1 -1
- package/dist/classes/ActivityStoredClass.js +1 -1
- package/dist/classes/ActivityStoredClass.js.map +1 -1
- package/dist/classes/ActivityStoredClass.mjs +1 -1
- package/dist/classes/ActivityStoredClass.mjs.map +1 -1
- package/dist/classes/CommitmentBaseModel.d.mts +1 -1
- package/dist/classes/CommitmentBaseModel.d.ts +1 -1
- package/dist/classes/CommitmentBaseModel.js +1 -1
- package/dist/classes/CommitmentBaseModel.js.map +1 -1
- package/dist/classes/CommitmentBaseModel.mjs +1 -1
- package/dist/classes/CommitmentBaseModel.mjs.map +1 -1
- package/dist/classes/CommitmentStoredClass.d.mts +1 -1
- package/dist/classes/CommitmentStoredClass.d.ts +1 -1
- package/dist/classes/CommitmentStoredClass.js +1 -1
- package/dist/classes/CommitmentStoredClass.js.map +1 -1
- package/dist/classes/CommitmentStoredClass.mjs +1 -1
- package/dist/classes/CommitmentStoredClass.mjs.map +1 -1
- package/dist/classes/index.d.mts +4 -4
- package/dist/classes/index.d.ts +4 -4
- package/dist/classes/index.js +1 -1
- package/dist/classes/index.js.map +1 -1
- package/dist/classes/index.mjs +1 -1
- package/dist/classes/index.mjs.map +1 -1
- package/dist/classes/navigation/LocationBaseModel.d.mts +1 -1
- package/dist/classes/navigation/LocationBaseModel.d.ts +1 -1
- package/dist/classes/navigation/LocationBaseModel.js +1 -1
- package/dist/classes/navigation/LocationBaseModel.js.map +1 -1
- package/dist/classes/navigation/LocationBaseModel.mjs +1 -1
- package/dist/classes/navigation/LocationBaseModel.mjs.map +1 -1
- package/dist/classes/navigation/LocationStoredClass.d.mts +1 -1
- package/dist/classes/navigation/LocationStoredClass.d.ts +1 -1
- package/dist/classes/navigation/LocationStoredClass.js +1 -1
- package/dist/classes/navigation/LocationStoredClass.js.map +1 -1
- package/dist/classes/navigation/LocationStoredClass.mjs +1 -1
- package/dist/classes/navigation/LocationStoredClass.mjs.map +1 -1
- package/dist/classes/navigation/MapBaseModel.d.mts +1 -1
- package/dist/classes/navigation/MapBaseModel.d.ts +1 -1
- package/dist/classes/navigation/MapBaseModel.js +1 -1
- package/dist/classes/navigation/MapBaseModel.js.map +1 -1
- package/dist/classes/navigation/MapBaseModel.mjs +1 -1
- package/dist/classes/navigation/MapBaseModel.mjs.map +1 -1
- package/dist/classes/navigation/MapStoredClass.d.mts +1 -1
- package/dist/classes/navigation/MapStoredClass.d.ts +1 -1
- package/dist/classes/navigation/MapStoredClass.js +1 -1
- package/dist/classes/navigation/MapStoredClass.js.map +1 -1
- package/dist/classes/navigation/MapStoredClass.mjs +1 -1
- package/dist/classes/navigation/MapStoredClass.mjs.map +1 -1
- package/dist/classes/navigation/NavigationAbstractClass.d.mts +1 -1
- package/dist/classes/navigation/NavigationAbstractClass.d.ts +1 -1
- package/dist/classes/navigation/NavigationAbstractClass.js +1 -1
- package/dist/classes/navigation/NavigationAbstractClass.js.map +1 -1
- package/dist/classes/navigation/NavigationAbstractClass.mjs +1 -1
- package/dist/classes/navigation/NavigationAbstractClass.mjs.map +1 -1
- package/dist/classes/navigation/RoomBaseModel.d.mts +1 -1
- package/dist/classes/navigation/RoomBaseModel.d.ts +1 -1
- package/dist/classes/navigation/RoomBaseModel.js +1 -1
- package/dist/classes/navigation/RoomBaseModel.js.map +1 -1
- package/dist/classes/navigation/RoomBaseModel.mjs +1 -1
- package/dist/classes/navigation/RoomBaseModel.mjs.map +1 -1
- package/dist/classes/navigation/RoomStoredClass.d.mts +3 -2
- package/dist/classes/navigation/RoomStoredClass.d.ts +3 -2
- package/dist/classes/navigation/RoomStoredClass.js +1 -1
- package/dist/classes/navigation/RoomStoredClass.js.map +1 -1
- package/dist/classes/navigation/RoomStoredClass.mjs +1 -1
- package/dist/classes/navigation/RoomStoredClass.mjs.map +1 -1
- package/dist/classes/quest/QuestBaseModel.d.mts +1 -1
- package/dist/classes/quest/QuestBaseModel.d.ts +1 -1
- package/dist/classes/quest/QuestStoredClass.d.mts +1 -1
- package/dist/classes/quest/QuestStoredClass.d.ts +1 -1
- package/dist/classes/quest/StageBaseModel.d.mts +1 -1
- package/dist/classes/quest/StageBaseModel.d.ts +1 -1
- package/dist/classes/quest/StageBaseModel.js +1 -1
- package/dist/classes/quest/StageBaseModel.js.map +1 -1
- package/dist/classes/quest/StageBaseModel.mjs +1 -1
- package/dist/classes/quest/StageBaseModel.mjs.map +1 -1
- package/dist/classes/quest/StageStoredClass.d.mts +1 -1
- package/dist/classes/quest/StageStoredClass.d.ts +1 -1
- package/dist/classes/quest/StageStoredClass.js +1 -1
- package/dist/classes/quest/StageStoredClass.js.map +1 -1
- package/dist/classes/quest/StageStoredClass.mjs +1 -1
- package/dist/classes/quest/StageStoredClass.mjs.map +1 -1
- package/dist/decorators/CommitmentDecorator.d.mts +1 -1
- package/dist/decorators/CommitmentDecorator.d.ts +1 -1
- package/dist/decorators/QuestDecorator.d.mts +1 -1
- package/dist/decorators/QuestDecorator.d.ts +1 -1
- package/dist/decorators/RoomDecorator.d.mts +1 -1
- package/dist/decorators/RoomDecorator.d.ts +1 -1
- package/dist/decorators/index.d.mts +3 -3
- package/dist/decorators/index.d.ts +3 -3
- package/dist/decorators/index.js +1 -1
- package/dist/decorators/index.mjs +1 -1
- package/dist/index.d.mts +6 -6
- package/dist/index.d.ts +6 -6
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/interface/ActivityInterface.d.mts +1 -1
- package/dist/interface/ActivityInterface.d.ts +1 -1
- package/dist/interface/CommitmentInterface.d.mts +1 -1
- package/dist/interface/CommitmentInterface.d.ts +1 -1
- package/dist/interface/CommitmentProps.d.mts +1 -1
- package/dist/interface/CommitmentProps.d.ts +1 -1
- package/dist/interface/index.d.mts +2 -2
- package/dist/interface/index.d.ts +2 -2
- package/dist/interface/navigation/LocationInterface.d.mts +1 -1
- package/dist/interface/navigation/LocationInterface.d.ts +1 -1
- package/dist/interface/navigation/MapInterface.d.mts +1 -1
- package/dist/interface/navigation/MapInterface.d.ts +1 -1
- package/dist/interface/navigation/NavigationAbstractClass.d.mts +1 -1
- package/dist/interface/navigation/NavigationAbstractClass.d.ts +1 -1
- package/dist/interface/navigation/RoomInterface.d.mts +2 -2
- package/dist/interface/navigation/RoomInterface.d.ts +2 -2
- package/dist/interface/quest/QuestInterface.d.mts +1 -1
- package/dist/interface/quest/QuestInterface.d.ts +1 -1
- package/dist/interface/quest/QuestProps.d.mts +1 -1
- package/dist/interface/quest/QuestProps.d.ts +1 -1
- package/dist/interface/quest/StageInterface.d.mts +1 -1
- package/dist/interface/quest/StageInterface.d.ts +1 -1
- package/dist/interface/quest/StageProps.d.mts +1 -1
- package/dist/interface/quest/StageProps.d.ts +1 -1
- package/dist/managers/NavigatorManager.d.mts +2 -2
- package/dist/managers/NavigatorManager.d.ts +2 -2
- package/dist/managers/NavigatorManager.js +1 -1
- package/dist/managers/NavigatorManager.js.map +1 -1
- package/dist/managers/NavigatorManager.mjs +1 -1
- package/dist/managers/NavigatorManager.mjs.map +1 -1
- package/dist/managers/QuestManager.d.mts +1 -1
- package/dist/managers/QuestManager.d.ts +1 -1
- package/dist/managers/RoutineManager.d.mts +1 -1
- package/dist/managers/RoutineManager.d.ts +1 -1
- package/dist/managers/RoutineManager.js +1 -1
- package/dist/managers/RoutineManager.js.map +1 -1
- package/dist/managers/RoutineManager.mjs +1 -1
- package/dist/managers/RoutineManager.mjs.map +1 -1
- package/dist/managers/TimeManager.js +1 -1
- package/dist/managers/TimeManager.js.map +1 -1
- package/dist/managers/TimeManager.mjs +1 -1
- package/dist/managers/TimeManager.mjs.map +1 -1
- package/dist/managers/index.d.mts +2 -2
- package/dist/managers/index.d.ts +2 -2
- package/dist/managers/index.js +1 -1
- package/dist/managers/index.js.map +1 -1
- package/dist/managers/index.mjs +1 -1
- package/dist/managers/index.mjs.map +1 -1
- package/dist/types/QuestsRequired.d.mts +1 -1
- package/dist/types/QuestsRequired.d.ts +1 -1
- package/dist/types/index.d.mts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/constants.ts","../../../src/managers/TimeManagerSettings.ts","../../../src/managers/TimeManager.ts","../../../src/managers/index.ts","../../../src/classes/quest/StageStoredClass.ts","../../../src/classes/quest/StageBaseModel.ts"],"names":["TIME_DATA_KEY","TimeManagerSettings","TimeManager","settings","minDayHours","maxDayHours","defaultTimeSpent","timeSlots","weekLength","weekendStartDay","weekDaysNames","data","storage","value","weekDayNumber","index","slot","timeSpent","newHour","newDayHour","days","newDay","fromHour","toHour","currentHour","timeTracker","navigator","STAGE_CATEGORY","StageStoredClass","StoredClassModel","id","options","prevStageEndDay","daysRequired","q","props","StageBaseModel","flag","getFlag"],"mappings":"+DACO,IAAMA,EAAgB,8BCC7B,CAAA,IAAqBC,EAArB,KAAiE,CAC7D,OAAO,WAAsB,CAAA,CAAA,CAC7B,OAAO,WAAsB,CAAA,EAAA,CAC7B,OAAO,gBAA2B,CAAA,CAAA,CAClC,OAAO,SAAA,CAA0B,EAAC,CAClC,OAAO,UAAqB,CAAA,CAAA,CAC5B,OAAO,eAA0B,CAAA,IAAA,CAAK,WAAa,CACnD,CAAA,OAAO,c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AAA,CAAAA,EAASC,QAAQD,CAAK,CAAA,IAAI,CAAC,CAK5C,CAAA,KACR,CACA,IAAa,SAAA,CAAUxB,CAAgB,CAAA,CACtC,KAAM,CAAA,SAAA,CAAYA,EACnB,CACA,IAAa,UAAoB,CAChC,OAAI,KAAK,oBAAqB,CAAA,MAAA,CAAS,GAAK,CAAC,IAAA,CAAK,qBAAqB,KAAOwB,CAAAA,CAAAA,EAASC,QAAQD,CAAK,CAAA,IAAI,CAAC,CACjG,CAAA,KAAA,CAED,KAAM,CAAA,QACd,CACD","file":"StageBaseModel.mjs","sourcesContent":["export const TIME_SETTINGS_KEY = '___nqtr-time_manager_settings___';\nexport const TIME_DATA_KEY = '___nqtr-time_manager_data___';\n\n","import { ITimeStlot, TimeSettings } from \"../types/TimeSettings\";\n\nexport default class TimeManagerSettings implements TimeSettings {\n static minDayHours: number = 0\n static maxDayHours: number = 24\n static defaultTimeSpent: number = 1\n static timeSlots: ITimeStlot[] = []\n static weekLength: number = 7\n static weekendStartDay: number = this.weekLength - 1\n static weekDaysNames: string[] = []\n}\n","import { storage } from \"@drincs/pixi-vn\";\nimport { TIME_DATA_KEY } from \"../constants\";\nimport TimeDataType from \"../types/TimeDataType\";\nimport { ITimeStlot, TimeSettings } from \"../types/TimeSettings\";\nimport TimeManagerSettings from \"./TimeManagerSettings\";\n\nexport default class TimeManager {\n initialize(settings: TimeSettings) {\n const {\n minDayHours = 0,\n maxDayHours = 24,\n defaultTimeSpent = 1,\n timeSlots = [],\n weekLength = 7,\n weekendStartDay = weekLength - 1,\n weekDaysNames = [],\n } = settings\n TimeManagerSettings.minDayHours = minDayHours\n TimeManagerSettings.maxDayHours = maxDayHours\n TimeManagerSettings.defaultTimeSpent = defaultTimeSpent\n TimeManagerSettings.timeSlots = timeSlots\n TimeManagerSettings.weekLength = weekLength\n if (weekendStartDay >= TimeManagerSettings.weekLength) {\n console.warn(`[NQTR] Weekend start day should be less than week length ${weekLength}, so will be ignored`)\n }\n else {\n TimeManagerSettings.weekendStartDay = weekendStartDay\n }\n if (weekDaysNames.length !== weekLength) {\n console.warn(`[NQTR] Week days names should be equal to week length ${weekLength}, so will be ignored`)\n }\n else {\n TimeManagerSettings.weekDaysNames = weekDaysNames\n }\n }\n get minDayHours(): number {\n return TimeManagerSettings.minDayHours\n }\n get maxDayHours(): number {\n return TimeManagerSettings.maxDayHours\n }\n get defaultTimeSpent(): number {\n return TimeManagerSettings.defaultTimeSpent\n }\n get timeSlots(): ITimeStlot[] {\n return TimeManagerSettings.timeSlots\n }\n get weekLength(): number {\n return TimeManagerSettings.weekLength\n }\n get weekendStartDay(): number {\n return TimeManagerSettings.weekendStartDay\n }\n get weekDaysNames(): string[] {\n return TimeManagerSettings.weekDaysNames\n }\n\n /**\n * Get the current hour\n */\n get currentHour(): number {\n let data = storage.getVariable<TimeDataType>(TIME_DATA_KEY) || {}\n if (data.hasOwnProperty('currentHour') && typeof data.currentHour === 'number') {\n return data.currentHour\n }\n return this.minDayHours\n }\n set currentHour(value: number | undefined) {\n let data = storage.getVariable<TimeDataType>(TIME_DATA_KEY) || {}\n if (typeof value === 'number') {\n data.currentHour = value\n } else {\n delete data.currentHour\n }\n storage.setVariable(TIME_DATA_KEY, data)\n }\n /**\n * Get the current day\n */\n get currentDay(): number {\n let data = storage.getVariable<TimeDataType>(TIME_DATA_KEY) || {}\n if (data.hasOwnProperty('currentDay') && typeof data.currentDay === 'number') {\n return data.currentDay\n }\n return 0\n }\n set currentDay(value: number | undefined) {\n let data = storage.getVariable<TimeDataType>(TIME_DATA_KEY) || {}\n if (typeof value === 'number') {\n data.currentDay = value\n }\n else {\n delete data.currentDay\n }\n storage.setVariable(TIME_DATA_KEY, data)\n }\n /**\n * If the current day is greater than or equal to the weekend start day, then it will return true.\n */\n get isWeekend(): boolean {\n return this.currentWeekDayNumber >= this.weekendStartDay\n }\n /**\n * Get the current week day number (1 - {@link weekLength}).\n * For example, if the week length is 7 and the current day is 10, then the result will be 4.\n */\n get currentWeekDayNumber(): number {\n let result = this.currentDay % this.weekLength\n return result + 1\n }\n /**\n * Get the current week day name. If the week days names are not defined, then it will return undefined.\n * For example, if the week days names are ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'] and the current day is 10, then the result will be 'Thursday'.\n * @default \"\"\n */\n get currentDayName(): string {\n let weekDayNumber = this.currentWeekDayNumber - 1\n if (weekDayNumber >= this.weekDaysNames.length) {\n console.warn(`[NQTR] Week day name is not defined for day ${weekDayNumber}`, this.weekDaysNames)\n return \"\"\n }\n return this.weekDaysNames[weekDayNumber]\n }\n /**\n * Get the current {@link timeSlots} index.\n * You can use this property to create \"Image that changes based on the time period\":\n * @example\n * ```tsx\n * import { weekLength } from '@drincs/nqtr';\n * \n * function changeBackground() {\n * return (\n * <img src={`background-currentTimeSlot.currentTimeSlot.png`} />\n * )\n * }\n */\n get currentTimeSlot(): number {\n if (this.timeSlots.length === 0) {\n console.warn('[NQTR] Time slots are not defined')\n return 0\n }\n for (let index = 0; index < this.timeSlots.length; index++) {\n let slot = this.timeSlots[index]\n if (this.timeSlots.length > index + 1) {\n if (this.nowIsBetween(slot.startHour, this.timeSlots[index + 1].startHour)) {\n return index\n }\n }\n }\n return this.timeSlots.length - 1\n }\n\n /**\n * This function will increase the current hour by the given time spent.\n * If the new hour is greater than or equal to the max day hours, then it will increase the day and set the new hour.\n * @param timeSpent is the time spent in hours (default: {@link defaultTimeSpent})\n * @returns currentTimeSlot.currentHour\n */\n increaseHour(timeSpent: number = this.defaultTimeSpent): number {\n let newHour = this.currentHour + timeSpent\n if (newHour >= this.maxDayHours) {\n this.increaseDay()\n newHour = this.minDayHours + (newHour - this.maxDayHours)\n }\n this.currentHour = newHour\n return this.currentHour\n }\n\n /**\n * This function will increase the current day by the given days.\n * @param newDayHour is the hour of the new day (default: {@link minDayHours})\n * @param days is the number of days to increase (default: 1)\n * @returns timeTracker.currentDay\n */\n increaseDay(newDayHour: number = this.minDayHours, days: number = 1): number {\n let newDay = this.currentDay + days\n this.currentDay = newDay\n this.currentHour = newDayHour\n return this.currentDay\n }\n\n /**\n * This function will check if the current hour is between the given hours.\n * @param fromHour the starting hour. If the {@link currentHour} is equal to this hour, the function will return true.\n * @param toHour the ending hour.\n * @returns true if the current hour is between the given hours, otherwise false.\n */\n nowIsBetween(fromHour: number | undefined, toHour: number | undefined): boolean {\n if (fromHour === undefined) {\n fromHour = this.minDayHours\n }\n if (toHour === undefined) {\n toHour = this.maxDayHours\n }\n let currentHour = this.currentHour\n if (fromHour < toHour) {\n return currentHour >= fromHour && currentHour < toHour\n }\n return currentHour >= fromHour || currentHour < toHour\n }\n}\n","import NavigatorManager from \"./NavigatorManager\";\nimport QuestManager from \"./QuestManager\";\nimport RoutineManager from \"./RoutineManager\";\nimport { default as TimeManager } from \"./TimeManager\";\n\nconst timeTracker = new TimeManager();\nconst navigator = new NavigatorManager();\nconst routine = new RoutineManager();\nconst questsNotebook = new QuestManager();\n\nexport { navigator, questsNotebook, routine, timeTracker };\n","import { OnRunProps } from \"@drincs/nqtr\";\nimport { StoredClassModel } from \"@drincs/pixi-vn\";\nimport { StageInterface } from \"../../interface\";\nimport { StageBaseInternalInterface } from \"../../interface/quest/StageInterface\";\nimport { timeTracker } from \"../../managers\";\nimport { QuestsRequiredType } from \"../../types\";\n\nconst STAGE_CATEGORY = \"__nqtr-stage__\";\nexport default class StageStoredClass extends StoredClassModel implements StageBaseInternalInterface {\n constructor(\n id: string,\n options: {\n /**\n * The function that will be executed when the stage starts.\n */\n onStart?: (stage: StageInterface, props: OnRunProps) => void;\n /**\n * The function that will be executed when the stage ends.\n */\n onEnd?: (stage: StageInterface, props: OnRunProps) => void;\n /**\n * The day required to start the stage.\n * @example If the value is 3, and the previous stage ends on day 1, the stage will start on day 4.\n */\n daysRequiredToStart?: number;\n /**\n * The quests required to start the stage.\n * @default []\n */\n questsRequiredToStart?: QuestsRequiredType[];\n } = {}\n ) {\n super(STAGE_CATEGORY, id);\n this._onStart = options.onStart;\n this._onEnd = options.onEnd;\n this._daysRequiredToStart = options.daysRequiredToStart;\n this._questsRequiredToStart = options.questsRequiredToStart || [];\n }\n\n private _onStart?: (stage: StageInterface, props: OnRunProps) => void;\n get onStart(): undefined | ((stage: StageInterface, props: OnRunProps) => void) {\n return this._onStart;\n }\n\n private _onEnd?: (stage: StageInterface, props: OnRunProps) => void;\n get onEnd(): undefined | ((stage: StageInterface, props: OnRunProps) => void) {\n return this._onEnd;\n }\n\n get completed(): boolean {\n return this.getStorageProperty<boolean>(\"completed\") || false;\n }\n set completed(value: boolean) {\n this.setStorageProperty(\"completed\", value);\n }\n\n get started(): boolean {\n return this.getStorageProperty<boolean>(\"started\") || false;\n }\n set started(value: boolean) {\n this.setStorageProperty(\"started\", value);\n }\n\n private get prevStageEndDay(): number | undefined {\n return this.getStorageProperty<number>(\"prevStageEndDay\");\n }\n private set prevStageEndDay(value: number | undefined) {\n this.setStorageProperty(\"prevStageEndDay\", value);\n }\n\n get startDay(): number | undefined {\n let prevStageEndDay = this.prevStageEndDay;\n if (prevStageEndDay === undefined) {\n return undefined;\n }\n return prevStageEndDay + this.daysRequiredToStart;\n }\n\n get canStart(): boolean {\n let daysRequired = this.daysRequiredToStart;\n if (daysRequired > 0) {\n let prevStageEndDay = this.prevStageEndDay;\n if (prevStageEndDay === undefined) {\n return false;\n }\n if (prevStageEndDay + daysRequired > timeTracker.currentDay) {\n return false;\n }\n }\n if (\n this.questsRequiredToStart.length > 0 &&\n !this.questsRequiredToStart.every(\n (q) => q.quest.currentStageIndex && q.quest.currentStageIndex >= q.stageNumber\n )\n ) {\n return false;\n }\n return true;\n }\n\n inizialize() {\n if (this.daysRequiredToStart > 0) {\n this.prevStageEndDay = timeTracker.currentDay;\n console.log(`[NQTR] Stage ${this.id} will start on day ${this.startDay}`);\n }\n }\n\n start(props: OnRunProps) {\n if (this.canStart) {\n this.started = true;\n if (this.onStart) {\n this.onStart(this as any as StageInterface, props);\n }\n } else {\n console.warn(`[NQTR] Stage ${this.id} can't start`);\n }\n }\n\n private _daysRequiredToStart?: number;\n get daysRequiredToStart(): number {\n return this._daysRequiredToStart || 0;\n }\n\n private _questsRequiredToStart: QuestsRequiredType[];\n get questsRequiredToStart(): QuestsRequiredType[] {\n return this._questsRequiredToStart || [];\n }\n}\n","import { getFlag } from \"@drincs/pixi-vn\";\nimport { StageProps } from \"../../interface\";\nimport StageFlags from \"../../interface/quest/StageFlags\";\nimport StageStoredClass from \"./StageStoredClass\";\n\nexport default class StageBaseModel extends StageStoredClass {\n\tconstructor(id: string, props: StageProps) {\n\t\tsuper(id, {\n\t\t\tonStart: props.onStart,\n\t\t\tonEnd: props.onEnd,\n\t\t\tdaysRequiredToStart: props.daysRequiredToStart,\n\t\t\tquestsRequiredToStart: props.questsRequiredToStart,\n\t\t});\n\t\tthis._name = props.name || \"\";\n\t\tthis._flags = props.flags || [];\n\t\tthis._description = props.description || \"\";\n\t\tthis._adviceDescription = props.adviceDescription || \"\";\n\t\tthis._image = props.image;\n\t\tthis._flagsRequiredToStart = props.flagsRequiredToStart || [];\n\t\tthis._requestDescriptionToStart = props.requestDescriptionToStart || \"\";\n\t}\n\n\tprivate _name: string;\n\t/**\n\t * The name of the stage.\n\t */\n\tget name(): string {\n\t\treturn this._name;\n\t}\n\n\tprivate _description: string;\n\t/**\n\t * The description of the stage.\n\t */\n\tget description(): string {\n\t\treturn this._description;\n\t}\n\n\tprivate _adviceDescription: string;\n\t/**\n\t * The advice description of the stage.\n\t */\n\tget adviceDescription(): string {\n\t\treturn this._adviceDescription;\n\t}\n\n\tprivate _image?: string;\n\t/**\n\t * The image of the stage.\n\t */\n\tget image(): string | undefined {\n\t\treturn this._image;\n\t}\n\n\tprivate _flags: StageFlags[];\n\t/**\n\t * The list of flags that the player must complete to finish the stage.\n\t */\n\tget flags(): StageFlags[] {\n\t\treturn this._flags;\n\t}\n\n\tprivate _flagsRequiredToStart: StageFlags[];\n\t/**\n\t * The list of flags required to start the stage.\n\t */\n\tget flagsRequiredToStart(): StageFlags[] {\n\t\treturn this._flagsRequiredToStart;\n\t}\n\n\tprivate _requestDescriptionToStart: string;\n\t/**\n\t * The description of the request to start the stage.\n\t */\n\tget requestDescriptionToStart(): string {\n\t\treturn this._requestDescriptionToStart;\n\t}\n\n\toverride get completed(): boolean {\n\t\tif (super.completed) {\n\t\t\treturn true;\n\t\t}\n\t\tif (this.flags.length > 0) {\n\t\t\tif (!this.flags.every((flag) => getFlag(flag.flag))) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\toverride set completed(value: boolean) {\n\t\tsuper.completed = value;\n\t}\n\toverride get canStart(): boolean {\n\t\tif (this.flagsRequiredToStart.length > 0 && !this.flagsRequiredToStart.every((flag) => getFlag(flag.flag))) {\n\t\t\treturn false;\n\t\t}\n\t\treturn super.canStart;\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../../../src/constants.ts","../../../src/managers/TimeManagerSettings.ts","../../../src/managers/TimeManager.ts","../../../src/managers/index.ts","../../../src/classes/quest/StageStoredClass.ts","../../../src/classes/quest/StageBaseModel.ts"],"names":["TIME_DATA_KEY","TimeManagerSettings","TimeManager","settings","minDayHours","maxDayHours","defaultTimeSpent","timeSlots","weekLength","weekendStartDay","weekDaysNames","data","storage","value","weekDayNumber","index","slot","timeSpent","newHour","newDayHour","days","newDay","fromHour","toHour","currentHour","timeTracker","STAGE_CATEGORY","StageStoredClass","StoredClassModel","id","options","prevStageEndDay","daysRequired","q","props","StageBaseModel","flag","getFlag"],"mappings":"+DACO,IAAMA,EAAgB,8BCC7B,CAAA,IAAqBC,EAArB,KAAiE,CAC7D,OAAO,WAAsB,CAAA,CAAA,CAC7B,OAAO,WAAsB,CAAA,EAAA,CAC7B,OAAO,gBAA2B,CAAA,CAAA,CAClC,OAAO,SAAA,CAA0B,EAAC,CAClC,OAAO,UAAqB,CAAA,CAAA,CAC5B,OAAO,eAA0B,CAAA,IAAA,CAAK,WAAa,CACnD,CA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ASC,QAAQD,CAAK,CAAA,IAAI,CAAC,CAK5C,CAAA,KACR,CACA,IAAa,SAAA,CAAUvB,CAAgB,CAAA,CACtC,KAAM,CAAA,SAAA,CAAYA,EACnB,CACA,IAAa,UAAoB,CAChC,OAAI,KAAK,oBAAqB,CAAA,MAAA,CAAS,GAAK,CAAC,IAAA,CAAK,qBAAqB,KAAOuB,CAAAA,CAAAA,EAASC,QAAQD,CAAK,CAAA,IAAI,CAAC,CACjG,CAAA,KAAA,CAED,KAAM,CAAA,QACd,CACD","file":"StageBaseModel.mjs","sourcesContent":["export const TIME_SETTINGS_KEY = '___nqtr-time_manager_settings___';\nexport const TIME_DATA_KEY = '___nqtr-time_manager_data___';\n\n","import { ITimeStlot, TimeSettings } from \"../types/TimeSettings\";\n\nexport default class TimeManagerSettings implements TimeSettings {\n static minDayHours: number = 0\n static maxDayHours: number = 24\n static defaultTimeSpent: number = 1\n static timeSlots: ITimeStlot[] = []\n static weekLength: number = 7\n static weekendStartDay: number = this.weekLength - 1\n static weekDaysNames: string[] = []\n}\n","import { storage } from \"@drincs/pixi-vn\";\nimport { TIME_DATA_KEY } from \"../constants\";\nimport TimeDataType from \"../types/TimeDataType\";\nimport { ITimeStlot, TimeSettings } from \"../types/TimeSettings\";\nimport TimeManagerSettings from \"./TimeManagerSettings\";\n\nexport default class TimeManager {\n initialize(settings: TimeSettings) {\n const {\n minDayHours = 0,\n maxDayHours = 24,\n defaultTimeSpent = 1,\n timeSlots = [],\n weekLength = 7,\n weekendStartDay = weekLength - 1,\n weekDaysNames = [],\n } = settings;\n TimeManagerSettings.minDayHours = minDayHours;\n TimeManagerSettings.maxDayHours = maxDayHours;\n TimeManagerSettings.defaultTimeSpent = defaultTimeSpent;\n TimeManagerSettings.timeSlots = timeSlots;\n TimeManagerSettings.weekLength = weekLength;\n if (weekendStartDay >= TimeManagerSettings.weekLength) {\n console.warn(`[NQTR] Weekend start day should be less than week length ${weekLength}, so will be ignored`);\n } else {\n TimeManagerSettings.weekendStartDay = weekendStartDay;\n }\n if (weekDaysNames.length !== weekLength) {\n console.warn(`[NQTR] Week days names should be equal to week length ${weekLength}, so will be ignored`);\n } else {\n TimeManagerSettings.weekDaysNames = weekDaysNames;\n }\n }\n get minDayHours(): number {\n return TimeManagerSettings.minDayHours;\n }\n get maxDayHours(): number {\n return TimeManagerSettings.maxDayHours;\n }\n get defaultTimeSpent(): number {\n return TimeManagerSettings.defaultTimeSpent;\n }\n get timeSlots(): ITimeStlot[] {\n return TimeManagerSettings.timeSlots;\n }\n get weekLength(): number {\n return TimeManagerSettings.weekLength;\n }\n get weekendStartDay(): number {\n return TimeManagerSettings.weekendStartDay;\n }\n get weekDaysNames(): string[] {\n return TimeManagerSettings.weekDaysNames;\n }\n\n /**\n * Get the current hour\n */\n get currentHour(): number {\n let data = storage.getVariable<TimeDataType>(TIME_DATA_KEY) || {};\n if (data.hasOwnProperty(\"currentHour\") && typeof data.currentHour === \"number\") {\n return data.currentHour;\n }\n return this.minDayHours;\n }\n set currentHour(value: number | undefined) {\n let data = storage.getVariable<TimeDataType>(TIME_DATA_KEY) || {};\n if (typeof value === \"number\") {\n data.currentHour = value;\n } else {\n delete data.currentHour;\n }\n storage.setVariable(TIME_DATA_KEY, data);\n }\n /**\n * Get the current day\n */\n get currentDay(): number {\n let data = storage.getVariable<TimeDataType>(TIME_DATA_KEY) || {};\n if (data.hasOwnProperty(\"currentDay\") && typeof data.currentDay === \"number\") {\n return data.currentDay;\n }\n return 0;\n }\n set currentDay(value: number | undefined) {\n let data = storage.getVariable<TimeDataType>(TIME_DATA_KEY) || {};\n if (typeof value === \"number\") {\n data.currentDay = value;\n } else {\n delete data.currentDay;\n }\n storage.setVariable(TIME_DATA_KEY, data);\n }\n /**\n * If the current day is greater than or equal to the weekend start day, then it will return true.\n */\n get isWeekend(): boolean {\n return this.currentWeekDayNumber >= this.weekendStartDay;\n }\n /**\n * Get the current week day number (1 - {@link weekLength}).\n * For example, if the week length is 7 and the current day is 10, then the result will be 4.\n */\n get currentWeekDayNumber(): number {\n let result = this.currentDay % this.weekLength;\n return result + 1;\n }\n /**\n * Get the current week day name. If the week days names are not defined, then it will return undefined.\n * For example, if the week days names are ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'] and the current day is 10, then the result will be 'Thursday'.\n * @default \"\"\n */\n get currentDayName(): string {\n let weekDayNumber = this.currentWeekDayNumber - 1;\n if (weekDayNumber >= this.weekDaysNames.length) {\n console.warn(`[NQTR] Week day name is not defined for day ${weekDayNumber}`, this.weekDaysNames);\n return \"\";\n }\n return this.weekDaysNames[weekDayNumber];\n }\n /**\n * Get the current {@link timeSlots} index.\n * You can use this property to create \"Image that changes based on the time period\":\n * @example\n * ```tsx\n * import { weekLength } from '@drincs/nqtr';\n *\n * function changeBackground() {\n * return (\n * <img src={`background-currentTimeSlot.currentTimeSlot.png`} />\n * )\n * }\n */\n get currentTimeSlot(): number {\n if (this.timeSlots.length === 0) {\n console.warn(\"[NQTR] Time slots are not defined\");\n return 0;\n }\n for (let index = 0; index < this.timeSlots.length; index++) {\n let slot = this.timeSlots[index];\n if (this.timeSlots.length > index + 1) {\n if (this.nowIsBetween(slot.startHour, this.timeSlots[index + 1].startHour)) {\n return index;\n }\n }\n }\n return this.timeSlots.length - 1;\n }\n\n /**\n * This function will increase the current hour by the given time spent.\n * If the new hour is greater than or equal to the max day hours, then it will increase the day and set the new hour.\n * @param timeSpent is the time spent in hours (default: {@link defaultTimeSpent})\n * @returns currentTimeSlot.currentHour\n */\n increaseHour(timeSpent: number = this.defaultTimeSpent): number {\n let newHour = this.currentHour + timeSpent;\n if (newHour >= this.maxDayHours) {\n this.increaseDay();\n newHour = this.minDayHours + (newHour - this.maxDayHours);\n }\n this.currentHour = newHour;\n return this.currentHour;\n }\n\n /**\n * This function will increase the current day by the given days.\n * @param newDayHour is the hour of the new day (default: {@link minDayHours})\n * @param days is the number of days to increase (default: 1)\n * @returns timeTracker.currentDay\n */\n increaseDay(newDayHour: number = this.minDayHours, days: number = 1): number {\n let newDay = this.currentDay + days;\n this.currentDay = newDay;\n this.currentHour = newDayHour;\n return this.currentDay;\n }\n\n /**\n * This function will check if the current hour is between the given hours.\n * @param fromHour the starting hour. If the {@link currentHour} is equal to this hour, the function will return true.\n * @param toHour the ending hour.\n * @returns true if the current hour is between the given hours, otherwise false.\n */\n nowIsBetween(fromHour: number | undefined, toHour: number | undefined): boolean {\n if (fromHour === undefined) {\n fromHour = this.minDayHours - 1;\n }\n if (toHour === undefined) {\n toHour = this.maxDayHours + 1;\n }\n let currentHour = this.currentHour;\n if (fromHour < toHour) {\n return currentHour >= fromHour && currentHour < toHour;\n }\n return currentHour >= fromHour || currentHour < toHour;\n }\n}\n","import NavigatorManager from \"./NavigatorManager\";\nimport QuestManager from \"./QuestManager\";\nimport RoutineManager from \"./RoutineManager\";\nimport { default as TimeManager } from \"./TimeManager\";\n\nconst timeTracker = new TimeManager();\nconst navigator = new NavigatorManager();\nconst routine = new RoutineManager();\nconst questsNotebook = new QuestManager();\n\nexport { navigator, questsNotebook, routine, timeTracker };\n","import { OnRunProps } from \"@drincs/nqtr\";\nimport { StoredClassModel } from \"@drincs/pixi-vn\";\nimport { StageInterface } from \"../../interface\";\nimport { StageBaseInternalInterface } from \"../../interface/quest/StageInterface\";\nimport { timeTracker } from \"../../managers\";\nimport { QuestsRequiredType } from \"../../types\";\n\nconst STAGE_CATEGORY = \"__nqtr-stage__\";\nexport default class StageStoredClass extends StoredClassModel implements StageBaseInternalInterface {\n constructor(\n id: string,\n options: {\n /**\n * The function that will be executed when the stage starts.\n */\n onStart?: (stage: StageInterface, props: OnRunProps) => void;\n /**\n * The function that will be executed when the stage ends.\n */\n onEnd?: (stage: StageInterface, props: OnRunProps) => void;\n /**\n * The day required to start the stage.\n * @example If the value is 3, and the previous stage ends on day 1, the stage will start on day 4.\n */\n daysRequiredToStart?: number;\n /**\n * The quests required to start the stage.\n * @default []\n */\n questsRequiredToStart?: QuestsRequiredType[];\n } = {}\n ) {\n super(STAGE_CATEGORY, id);\n this._onStart = options.onStart;\n this._onEnd = options.onEnd;\n this._daysRequiredToStart = options.daysRequiredToStart;\n this._questsRequiredToStart = options.questsRequiredToStart || [];\n }\n\n private _onStart?: (stage: StageInterface, props: OnRunProps) => void;\n get onStart(): undefined | ((stage: StageInterface, props: OnRunProps) => void) {\n return this._onStart;\n }\n\n private _onEnd?: (stage: StageInterface, props: OnRunProps) => void;\n get onEnd(): undefined | ((stage: StageInterface, props: OnRunProps) => void) {\n return this._onEnd;\n }\n\n get completed(): boolean {\n return this.getStorageProperty<boolean>(\"completed\") || false;\n }\n set completed(value: boolean) {\n this.setStorageProperty(\"completed\", value);\n }\n\n get started(): boolean {\n return this.getStorageProperty<boolean>(\"started\") || false;\n }\n set started(value: boolean) {\n this.setStorageProperty(\"started\", value);\n }\n\n private get prevStageEndDay(): number | undefined {\n return this.getStorageProperty<number>(\"prevStageEndDay\");\n }\n private set prevStageEndDay(value: number | undefined) {\n this.setStorageProperty(\"prevStageEndDay\", value);\n }\n\n get startDay(): number | undefined {\n let prevStageEndDay = this.prevStageEndDay;\n if (prevStageEndDay === undefined) {\n return undefined;\n }\n return prevStageEndDay + this.daysRequiredToStart;\n }\n\n get canStart(): boolean {\n let daysRequired = this.daysRequiredToStart;\n if (daysRequired > 0) {\n let prevStageEndDay = this.prevStageEndDay;\n if (prevStageEndDay === undefined) {\n return false;\n }\n if (prevStageEndDay + daysRequired > timeTracker.currentDay) {\n return false;\n }\n }\n if (\n this.questsRequiredToStart.length > 0 &&\n !this.questsRequiredToStart.every(\n (q) => q.quest.currentStageIndex && q.quest.currentStageIndex >= q.stageNumber\n )\n ) {\n return false;\n }\n return true;\n }\n\n inizialize() {\n if (this.daysRequiredToStart > 0) {\n this.prevStageEndDay = timeTracker.currentDay;\n console.log(`[NQTR] Stage ${this.id} will start on day ${this.startDay}`);\n }\n }\n\n start(props: OnRunProps) {\n if (this.canStart) {\n this.started = true;\n if (this.onStart) {\n this.onStart(this as any as StageInterface, props);\n }\n } else {\n console.warn(`[NQTR] Stage ${this.id} can't start`);\n }\n }\n\n private _daysRequiredToStart?: number;\n get daysRequiredToStart(): number {\n return this._daysRequiredToStart || 0;\n }\n\n private _questsRequiredToStart: QuestsRequiredType[];\n get questsRequiredToStart(): QuestsRequiredType[] {\n return this._questsRequiredToStart || [];\n }\n}\n","import { getFlag } from \"@drincs/pixi-vn\";\nimport { StageProps } from \"../../interface\";\nimport StageFlags from \"../../interface/quest/StageFlags\";\nimport StageStoredClass from \"./StageStoredClass\";\n\nexport default class StageBaseModel extends StageStoredClass {\n\tconstructor(id: string, props: StageProps) {\n\t\tsuper(id, {\n\t\t\tonStart: props.onStart,\n\t\t\tonEnd: props.onEnd,\n\t\t\tdaysRequiredToStart: props.daysRequiredToStart,\n\t\t\tquestsRequiredToStart: props.questsRequiredToStart,\n\t\t});\n\t\tthis._name = props.name || \"\";\n\t\tthis._flags = props.flags || [];\n\t\tthis._description = props.description || \"\";\n\t\tthis._adviceDescription = props.adviceDescription || \"\";\n\t\tthis._image = props.image;\n\t\tthis._flagsRequiredToStart = props.flagsRequiredToStart || [];\n\t\tthis._requestDescriptionToStart = props.requestDescriptionToStart || \"\";\n\t}\n\n\tprivate _name: string;\n\t/**\n\t * The name of the stage.\n\t */\n\tget name(): string {\n\t\treturn this._name;\n\t}\n\n\tprivate _description: string;\n\t/**\n\t * The description of the stage.\n\t */\n\tget description(): string {\n\t\treturn this._description;\n\t}\n\n\tprivate _adviceDescription: string;\n\t/**\n\t * The advice description of the stage.\n\t */\n\tget adviceDescription(): string {\n\t\treturn this._adviceDescription;\n\t}\n\n\tprivate _image?: string;\n\t/**\n\t * The image of the stage.\n\t */\n\tget image(): string | undefined {\n\t\treturn this._image;\n\t}\n\n\tprivate _flags: StageFlags[];\n\t/**\n\t * The list of flags that the player must complete to finish the stage.\n\t */\n\tget flags(): StageFlags[] {\n\t\treturn this._flags;\n\t}\n\n\tprivate _flagsRequiredToStart: StageFlags[];\n\t/**\n\t * The list of flags required to start the stage.\n\t */\n\tget flagsRequiredToStart(): StageFlags[] {\n\t\treturn this._flagsRequiredToStart;\n\t}\n\n\tprivate _requestDescriptionToStart: string;\n\t/**\n\t * The description of the request to start the stage.\n\t */\n\tget requestDescriptionToStart(): string {\n\t\treturn this._requestDescriptionToStart;\n\t}\n\n\toverride get completed(): boolean {\n\t\tif (super.completed) {\n\t\t\treturn true;\n\t\t}\n\t\tif (this.flags.length > 0) {\n\t\t\tif (!this.flags.every((flag) => getFlag(flag.flag))) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\toverride set completed(value: boolean) {\n\t\tsuper.completed = value;\n\t}\n\toverride get canStart(): boolean {\n\t\tif (this.flagsRequiredToStart.length > 0 && !this.flagsRequiredToStart.every((flag) => getFlag(flag.flag))) {\n\t\t\treturn false;\n\t\t}\n\t\treturn super.canStart;\n\t}\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { OnRunProps } from '@drincs/nqtr';
|
|
2
2
|
import { StoredClassModel } from '@drincs/pixi-vn';
|
|
3
|
-
import { c as StageBaseInternalInterface, S as StageInterface, a as QuestsRequiredType } from '../../StageInterface-
|
|
3
|
+
import { c as StageBaseInternalInterface, S as StageInterface, a as QuestsRequiredType } from '../../StageInterface-DX74DUxG.mjs';
|
|
4
4
|
|
|
5
5
|
declare class StageStoredClass extends StoredClassModel implements StageBaseInternalInterface {
|
|
6
6
|
constructor(id: string, options?: {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { OnRunProps } from '@drincs/nqtr';
|
|
2
2
|
import { StoredClassModel } from '@drincs/pixi-vn';
|
|
3
|
-
import { c as StageBaseInternalInterface, S as StageInterface, a as QuestsRequiredType } from '../../StageInterface-
|
|
3
|
+
import { c as StageBaseInternalInterface, S as StageInterface, a as QuestsRequiredType } from '../../StageInterface-DX74DUxG.js';
|
|
4
4
|
|
|
5
5
|
declare class StageStoredClass extends StoredClassModel implements StageBaseInternalInterface {
|
|
6
6
|
constructor(id: string, options?: {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
'use strict';var pixiVn=require('@drincs/pixi-vn');var
|
|
1
|
+
'use strict';var pixiVn=require('@drincs/pixi-vn');var s="___nqtr-time_manager_data___";var n=class{static minDayHours=0;static maxDayHours=24;static defaultTimeSpent=1;static timeSlots=[];static weekLength=7;static weekendStartDay=this.weekLength-1;static weekDaysNames=[]};var l=class{initialize(e){let{minDayHours:t=0,maxDayHours:r=24,defaultTimeSpent:a=1,timeSlots:x=[],weekLength:m=7,weekendStartDay:D=m-1,weekDaysNames:_=[]}=e;n.minDayHours=t,n.maxDayHours=r,n.defaultTimeSpent=a,n.timeSlots=x,n.weekLength=m,D>=n.weekLength?console.warn(`[NQTR] Weekend start day should be less than week length ${m}, so will be ignored`):n.weekendStartDay=D,_.length!==m?console.warn(`[NQTR] Week days names should be equal to week length ${m}, so will be ignored`):n.weekDaysNames=_;}get minDayHours(){return n.minDayHours}get maxDayHours(){return n.maxDayHours}get defaultTimeSpent(){return n.defaultTimeSpent}get timeSlots(){return n.timeSlots}get weekLength(){return n.weekLength}get weekendStartDay(){return n.weekendStartDay}get weekDaysNames(){return n.weekDaysNames}get currentHour(){let e=pixiVn.storage.getVariable(s)||{};return e.hasOwnProperty("currentHour")&&typeof e.currentHour=="number"?e.currentHour:this.minDayHours}set currentHour(e){let t=pixiVn.storage.getVariable(s)||{};typeof e=="number"?t.currentHour=e:delete t.currentHour,pixiVn.storage.setVariable(s,t);}get currentDay(){let e=pixiVn.storage.getVariable(s)||{};return e.hasOwnProperty("currentDay")&&typeof e.currentDay=="number"?e.currentDay:0}set currentDay(e){let t=pixiVn.storage.getVariable(s)||{};typeof e=="number"?t.currentDay=e:delete t.currentDay,pixiVn.storage.setVariable(s,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-1),t===undefined&&(t=this.maxDayHours+1);let r=this.currentHour;return e<t?r>=e&&r<t:r>=e||r<t}};var b=new l;var N="__nqtr-stage__",I=class extends pixiVn.StoredClassModel{constructor(e,t={}){super(N,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>b.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=b.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||[]}};module.exports=I;//# sourceMappingURL=StageStoredClass.js.map
|
|
2
2
|
//# sourceMappingURL=StageStoredClass.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/constants.ts","../../../src/managers/TimeManagerSettings.ts","../../../src/managers/TimeManager.ts","../../../src/managers/index.ts","../../../src/classes/quest/StageStoredClass.ts"],"names":["TIME_DATA_KEY","TimeManagerSettings","TimeManager","settings","minDayHours","maxDayHours","defaultTimeSpent","timeSlots","weekLength","weekendStartDay","weekDaysNames","data","storage","value","weekDayNumber","index","slot","timeSpent","newHour","newDayHour","days","newDay","fromHour","toHour","currentHour","timeTracker","navigator","STAGE_CATEGORY","StageStoredClass","StoredClassModel","id","options","prevStageEndDay","daysRequired","q","props"],"mappings":"mDACO,IAAMA,EAAgB,8BCC7B,CAAA,IAAqBC,EAArB,KAAiE,CAC7D,OAAO,WAAA,CAAsB,EAC7B,OAAO,WAAA,CAAsB,GAC7B,OAAO,gBAAA,CAA2B,EAClC,OAAO,SAAA,CAA0B,EAAC,CAClC,OAAO,UAAqB,CAAA,CAAA,CAC5B,OAAO,eAA0B,CAAA,IAAA,CAAK,WAAa,CACnD,CAAA,OAAO,aAA0B,CAAA,EACrC,CCJA,CAAA,IAAqBC,EAArB,KAAiC,CAC7B,WAAWC,CAAwB,CAAA,CAC/B,GAAM,CACF,YAAAC,CAAc,CAAA,CAAA,CACd,YAAAC,CAAc,CAAA,EAAA,CACd,iBAAAC,CAAmB,CAAA,CAAA,CACnB,SAAAC,CAAAA,CAAAA,CAAY,EACZ,CAAA,UAAA,CAAAC,EAAa,CACb,CAAA,eAAA,CAAAC,EAAkBD,CAAa,CA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AAA,IAAA,CAAK,oBACxB,GAAIA,CAAAA,CAAe,CAAG,CAAA,CAClB,IAAID,CAAkB,CAAA,IAAA,CAAK,gBAI3B,GAHIA,CAAAA,GAAoB,WAGpBA,CAAkBC,CAAAA,CAAAA,CAAeR,CAAY,CAAA,UAAA,CAC7C,OAAO,MAEf,CACA,OACI,EAAK,IAAA,CAAA,qBAAA,CAAsB,OAAS,CACpC,EAAA,CAAC,IAAK,CAAA,qBAAA,CAAsB,MACvBS,CAAMA,EAAAA,CAAAA,CAAE,MAAM,iBAAqBA,EAAAA,CAAAA,CAAE,MAAM,iBAAqBA,EAAAA,CAAAA,CAAE,WACvE,CAAA,CAKR,CAEA,UAAa,EAAA,CACL,KAAK,mBAAsB,CAAA,CAAA,GAC3B,KAAK,eAAkBT,CAAAA,CAAAA,CAAY,UACnC,CAAA,OAAA,CAAQ,IAAI,CAAgB,aAAA,EAAA,IAAA,CAAK,EAAE,CAAsB,mBAAA,EAAA,IAAA,CAAK,QAAQ,CAAE,CAAA,CAAA,EAEhF,CAEA,KAAA,CAAMU,EAAmB,CACjB,IAAA,CAAK,UACL,IAAK,CAAA,OAAA,CAAU,KACX,IAAK,CAAA,OAAA,EACL,IAAK,CAAA,OAAA,CAAQ,KAA+BA,CAAK,CAAA,EAGrD,QAAQ,IAAK,CAAA,CAAA,aAAA,EAAgB,KAAK,EAAE,CAAA,YAAA,CAAc,EAE1D,CAEQ,qBACR,IAAI,mBAAA,EAA8B,CAC9B,OAAO,IAAA,CAAK,sBAAwB,CACxC,CAEQ,sBACR,CAAA,IAAI,uBAA8C,CAC9C,OAAO,KAAK,sBAA0B,EAAA,EAC1C,CACJ","file":"StageStoredClass.js","sourcesContent":["export const TIME_SETTINGS_KEY = '___nqtr-time_manager_settings___';\nexport const TIME_DATA_KEY = '___nqtr-time_manager_data___';\n\n","import { ITimeStlot, TimeSettings } from \"../types/TimeSettings\";\n\nexport default class TimeManagerSettings implements TimeSettings {\n static minDayHours: number = 0\n static maxDayHours: number = 24\n static defaultTimeSpent: number = 1\n static timeSlots: ITimeStlot[] = []\n static weekLength: number = 7\n static weekendStartDay: number = this.weekLength - 1\n static weekDaysNames: string[] = []\n}\n","import { storage } from \"@drincs/pixi-vn\";\nimport { TIME_DATA_KEY } from \"../constants\";\nimport TimeDataType from \"../types/TimeDataType\";\nimport { ITimeStlot, TimeSettings } from \"../types/TimeSettings\";\nimport TimeManagerSettings from \"./TimeManagerSettings\";\n\nexport default class TimeManager {\n initialize(settings: TimeSettings) {\n const {\n minDayHours = 0,\n maxDayHours = 24,\n defaultTimeSpent = 1,\n timeSlots = [],\n weekLength = 7,\n weekendStartDay = weekLength - 1,\n weekDaysNames = [],\n } = settings\n TimeManagerSettings.minDayHours = minDayHours\n TimeManagerSettings.maxDayHours = maxDayHours\n TimeManagerSettings.defaultTimeSpent = defaultTimeSpent\n TimeManagerSettings.timeSlots = timeSlots\n TimeManagerSettings.weekLength = weekLength\n if (weekendStartDay >= TimeManagerSettings.weekLength) {\n console.warn(`[NQTR] Weekend start day should be less than week length ${weekLength}, so will be ignored`)\n }\n else {\n TimeManagerSettings.weekendStartDay = weekendStartDay\n }\n if (weekDaysNames.length !== weekLength) {\n console.warn(`[NQTR] Week days names should be equal to week length ${weekLength}, so will be ignored`)\n }\n else {\n TimeManagerSettings.weekDaysNames = weekDaysNames\n }\n }\n get minDayHours(): number {\n return TimeManagerSettings.minDayHours\n }\n get maxDayHours(): number {\n return TimeManagerSettings.maxDayHours\n }\n get defaultTimeSpent(): number {\n return TimeManagerSettings.defaultTimeSpent\n }\n get timeSlots(): ITimeStlot[] {\n return TimeManagerSettings.timeSlots\n }\n get weekLength(): number {\n return TimeManagerSettings.weekLength\n }\n get weekendStartDay(): number {\n return TimeManagerSettings.weekendStartDay\n }\n get weekDaysNames(): string[] {\n return TimeManagerSettings.weekDaysNames\n }\n\n /**\n * Get the current hour\n */\n get currentHour(): number {\n let data = storage.getVariable<TimeDataType>(TIME_DATA_KEY) || {}\n if (data.hasOwnProperty('currentHour') && typeof data.currentHour === 'number') {\n return data.currentHour\n }\n return this.minDayHours\n }\n set currentHour(value: number | undefined) {\n let data = storage.getVariable<TimeDataType>(TIME_DATA_KEY) || {}\n if (typeof value === 'number') {\n data.currentHour = value\n } else {\n delete data.currentHour\n }\n storage.setVariable(TIME_DATA_KEY, data)\n }\n /**\n * Get the current day\n */\n get currentDay(): number {\n let data = storage.getVariable<TimeDataType>(TIME_DATA_KEY) || {}\n if (data.hasOwnProperty('currentDay') && typeof data.currentDay === 'number') {\n return data.currentDay\n }\n return 0\n }\n set currentDay(value: number | undefined) {\n let data = storage.getVariable<TimeDataType>(TIME_DATA_KEY) || {}\n if (typeof value === 'number') {\n data.currentDay = value\n }\n else {\n delete data.currentDay\n }\n storage.setVariable(TIME_DATA_KEY, data)\n }\n /**\n * If the current day is greater than or equal to the weekend start day, then it will return true.\n */\n get isWeekend(): boolean {\n return this.currentWeekDayNumber >= this.weekendStartDay\n }\n /**\n * Get the current week day number (1 - {@link weekLength}).\n * For example, if the week length is 7 and the current day is 10, then the result will be 4.\n */\n get currentWeekDayNumber(): number {\n let result = this.currentDay % this.weekLength\n return result + 1\n }\n /**\n * Get the current week day name. If the week days names are not defined, then it will return undefined.\n * For example, if the week days names are ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'] and the current day is 10, then the result will be 'Thursday'.\n * @default \"\"\n */\n get currentDayName(): string {\n let weekDayNumber = this.currentWeekDayNumber - 1\n if (weekDayNumber >= this.weekDaysNames.length) {\n console.warn(`[NQTR] Week day name is not defined for day ${weekDayNumber}`, this.weekDaysNames)\n return \"\"\n }\n return this.weekDaysNames[weekDayNumber]\n }\n /**\n * Get the current {@link timeSlots} index.\n * You can use this property to create \"Image that changes based on the time period\":\n * @example\n * ```tsx\n * import { weekLength } from '@drincs/nqtr';\n * \n * function changeBackground() {\n * return (\n * <img src={`background-currentTimeSlot.currentTimeSlot.png`} />\n * )\n * }\n */\n get currentTimeSlot(): number {\n if (this.timeSlots.length === 0) {\n console.warn('[NQTR] Time slots are not defined')\n return 0\n }\n for (let index = 0; index < this.timeSlots.length; index++) {\n let slot = this.timeSlots[index]\n if (this.timeSlots.length > index + 1) {\n if (this.nowIsBetween(slot.startHour, this.timeSlots[index + 1].startHour)) {\n return index\n }\n }\n }\n return this.timeSlots.length - 1\n }\n\n /**\n * This function will increase the current hour by the given time spent.\n * If the new hour is greater than or equal to the max day hours, then it will increase the day and set the new hour.\n * @param timeSpent is the time spent in hours (default: {@link defaultTimeSpent})\n * @returns currentTimeSlot.currentHour\n */\n increaseHour(timeSpent: number = this.defaultTimeSpent): number {\n let newHour = this.currentHour + timeSpent\n if (newHour >= this.maxDayHours) {\n this.increaseDay()\n newHour = this.minDayHours + (newHour - this.maxDayHours)\n }\n this.currentHour = newHour\n return this.currentHour\n }\n\n /**\n * This function will increase the current day by the given days.\n * @param newDayHour is the hour of the new day (default: {@link minDayHours})\n * @param days is the number of days to increase (default: 1)\n * @returns timeTracker.currentDay\n */\n increaseDay(newDayHour: number = this.minDayHours, days: number = 1): number {\n let newDay = this.currentDay + days\n this.currentDay = newDay\n this.currentHour = newDayHour\n return this.currentDay\n }\n\n /**\n * This function will check if the current hour is between the given hours.\n * @param fromHour the starting hour. If the {@link currentHour} is equal to this hour, the function will return true.\n * @param toHour the ending hour.\n * @returns true if the current hour is between the given hours, otherwise false.\n */\n nowIsBetween(fromHour: number | undefined, toHour: number | undefined): boolean {\n if (fromHour === undefined) {\n fromHour = this.minDayHours\n }\n if (toHour === undefined) {\n toHour = this.maxDayHours\n }\n let currentHour = this.currentHour\n if (fromHour < toHour) {\n return currentHour >= fromHour && currentHour < toHour\n }\n return currentHour >= fromHour || currentHour < toHour\n }\n}\n","import NavigatorManager from \"./NavigatorManager\";\nimport QuestManager from \"./QuestManager\";\nimport RoutineManager from \"./RoutineManager\";\nimport { default as TimeManager } from \"./TimeManager\";\n\nconst timeTracker = new TimeManager();\nconst navigator = new NavigatorManager();\nconst routine = new RoutineManager();\nconst questsNotebook = new QuestManager();\n\nexport { navigator, questsNotebook, routine, timeTracker };\n","import { OnRunProps } from \"@drincs/nqtr\";\nimport { StoredClassModel } from \"@drincs/pixi-vn\";\nimport { StageInterface } from \"../../interface\";\nimport { StageBaseInternalInterface } from \"../../interface/quest/StageInterface\";\nimport { timeTracker } from \"../../managers\";\nimport { QuestsRequiredType } from \"../../types\";\n\nconst STAGE_CATEGORY = \"__nqtr-stage__\";\nexport default class StageStoredClass extends StoredClassModel implements StageBaseInternalInterface {\n constructor(\n id: string,\n options: {\n /**\n * The function that will be executed when the stage starts.\n */\n onStart?: (stage: StageInterface, props: OnRunProps) => void;\n /**\n * The function that will be executed when the stage ends.\n */\n onEnd?: (stage: StageInterface, props: OnRunProps) => void;\n /**\n * The day required to start the stage.\n * @example If the value is 3, and the previous stage ends on day 1, the stage will start on day 4.\n */\n daysRequiredToStart?: number;\n /**\n * The quests required to start the stage.\n * @default []\n */\n questsRequiredToStart?: QuestsRequiredType[];\n } = {}\n ) {\n super(STAGE_CATEGORY, id);\n this._onStart = options.onStart;\n this._onEnd = options.onEnd;\n this._daysRequiredToStart = options.daysRequiredToStart;\n this._questsRequiredToStart = options.questsRequiredToStart || [];\n }\n\n private _onStart?: (stage: StageInterface, props: OnRunProps) => void;\n get onStart(): undefined | ((stage: StageInterface, props: OnRunProps) => void) {\n return this._onStart;\n }\n\n private _onEnd?: (stage: StageInterface, props: OnRunProps) => void;\n get onEnd(): undefined | ((stage: StageInterface, props: OnRunProps) => void) {\n return this._onEnd;\n }\n\n get completed(): boolean {\n return this.getStorageProperty<boolean>(\"completed\") || false;\n }\n set completed(value: boolean) {\n this.setStorageProperty(\"completed\", value);\n }\n\n get started(): boolean {\n return this.getStorageProperty<boolean>(\"started\") || false;\n }\n set started(value: boolean) {\n this.setStorageProperty(\"started\", value);\n }\n\n private get prevStageEndDay(): number | undefined {\n return this.getStorageProperty<number>(\"prevStageEndDay\");\n }\n private set prevStageEndDay(value: number | undefined) {\n this.setStorageProperty(\"prevStageEndDay\", value);\n }\n\n get startDay(): number | undefined {\n let prevStageEndDay = this.prevStageEndDay;\n if (prevStageEndDay === undefined) {\n return undefined;\n }\n return prevStageEndDay + this.daysRequiredToStart;\n }\n\n get canStart(): boolean {\n let daysRequired = this.daysRequiredToStart;\n if (daysRequired > 0) {\n let prevStageEndDay = this.prevStageEndDay;\n if (prevStageEndDay === undefined) {\n return false;\n }\n if (prevStageEndDay + daysRequired > timeTracker.currentDay) {\n return false;\n }\n }\n if (\n this.questsRequiredToStart.length > 0 &&\n !this.questsRequiredToStart.every(\n (q) => q.quest.currentStageIndex && q.quest.currentStageIndex >= q.stageNumber\n )\n ) {\n return false;\n }\n return true;\n }\n\n inizialize() {\n if (this.daysRequiredToStart > 0) {\n this.prevStageEndDay = timeTracker.currentDay;\n console.log(`[NQTR] Stage ${this.id} will start on day ${this.startDay}`);\n }\n }\n\n start(props: OnRunProps) {\n if (this.canStart) {\n this.started = true;\n if (this.onStart) {\n this.onStart(this as any as StageInterface, props);\n }\n } else {\n console.warn(`[NQTR] Stage ${this.id} can't start`);\n }\n }\n\n private _daysRequiredToStart?: number;\n get daysRequiredToStart(): number {\n return this._daysRequiredToStart || 0;\n }\n\n private _questsRequiredToStart: QuestsRequiredType[];\n get questsRequiredToStart(): QuestsRequiredType[] {\n return this._questsRequiredToStart || [];\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../../../src/constants.ts","../../../src/managers/TimeManagerSettings.ts","../../../src/managers/TimeManager.ts","../../../src/managers/index.ts","../../../src/classes/quest/StageStoredClass.ts"],"names":["TIME_DATA_KEY","TimeManagerSettings","TimeManager","settings","minDayHours","maxDayHours","defaultTimeSpent","timeSlots","weekLength","weekendStartDay","weekDaysNames","data","storage","value","weekDayNumber","index","slot","timeSpent","newHour","newDayHour","days","newDay","fromHour","toHour","currentHour","timeTracker","navigator","STAGE_CATEGORY","StageStoredClass","StoredClassModel","id","options","prevStageEndDay","daysRequired","q","props"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AAQ,CAAE,CAAA,CAAA,EAEhF,CAEA,KAAA,CAAMU,EAAmB,CACjB,IAAA,CAAK,UACL,IAAK,CAAA,OAAA,CAAU,KACX,IAAK,CAAA,OAAA,EACL,IAAK,CAAA,OAAA,CAAQ,KAA+BA,CAAK,CAAA,EAGrD,QAAQ,IAAK,CAAA,CAAA,aAAA,EAAgB,KAAK,EAAE,CAAA,YAAA,CAAc,EAE1D,CAEQ,qBACR,IAAI,mBAAA,EAA8B,CAC9B,OAAO,IAAA,CAAK,sBAAwB,CACxC,CAEQ,sBACR,CAAA,IAAI,uBAA8C,CAC9C,OAAO,KAAK,sBAA0B,EAAA,EAC1C,CACJ","file":"StageStoredClass.js","sourcesContent":["export const TIME_SETTINGS_KEY = '___nqtr-time_manager_settings___';\nexport const TIME_DATA_KEY = '___nqtr-time_manager_data___';\n\n","import { ITimeStlot, TimeSettings } from \"../types/TimeSettings\";\n\nexport default class TimeManagerSettings implements TimeSettings {\n static minDayHours: number = 0\n static maxDayHours: number = 24\n static defaultTimeSpent: number = 1\n static timeSlots: ITimeStlot[] = []\n static weekLength: number = 7\n static weekendStartDay: number = this.weekLength - 1\n static weekDaysNames: string[] = []\n}\n","import { storage } from \"@drincs/pixi-vn\";\nimport { TIME_DATA_KEY } from \"../constants\";\nimport TimeDataType from \"../types/TimeDataType\";\nimport { ITimeStlot, TimeSettings } from \"../types/TimeSettings\";\nimport TimeManagerSettings from \"./TimeManagerSettings\";\n\nexport default class TimeManager {\n initialize(settings: TimeSettings) {\n const {\n minDayHours = 0,\n maxDayHours = 24,\n defaultTimeSpent = 1,\n timeSlots = [],\n weekLength = 7,\n weekendStartDay = weekLength - 1,\n weekDaysNames = [],\n } = settings;\n TimeManagerSettings.minDayHours = minDayHours;\n TimeManagerSettings.maxDayHours = maxDayHours;\n TimeManagerSettings.defaultTimeSpent = defaultTimeSpent;\n TimeManagerSettings.timeSlots = timeSlots;\n TimeManagerSettings.weekLength = weekLength;\n if (weekendStartDay >= TimeManagerSettings.weekLength) {\n console.warn(`[NQTR] Weekend start day should be less than week length ${weekLength}, so will be ignored`);\n } else {\n TimeManagerSettings.weekendStartDay = weekendStartDay;\n }\n if (weekDaysNames.length !== weekLength) {\n console.warn(`[NQTR] Week days names should be equal to week length ${weekLength}, so will be ignored`);\n } else {\n TimeManagerSettings.weekDaysNames = weekDaysNames;\n }\n }\n get minDayHours(): number {\n return TimeManagerSettings.minDayHours;\n }\n get maxDayHours(): number {\n return TimeManagerSettings.maxDayHours;\n }\n get defaultTimeSpent(): number {\n return TimeManagerSettings.defaultTimeSpent;\n }\n get timeSlots(): ITimeStlot[] {\n return TimeManagerSettings.timeSlots;\n }\n get weekLength(): number {\n return TimeManagerSettings.weekLength;\n }\n get weekendStartDay(): number {\n return TimeManagerSettings.weekendStartDay;\n }\n get weekDaysNames(): string[] {\n return TimeManagerSettings.weekDaysNames;\n }\n\n /**\n * Get the current hour\n */\n get currentHour(): number {\n let data = storage.getVariable<TimeDataType>(TIME_DATA_KEY) || {};\n if (data.hasOwnProperty(\"currentHour\") && typeof data.currentHour === \"number\") {\n return data.currentHour;\n }\n return this.minDayHours;\n }\n set currentHour(value: number | undefined) {\n let data = storage.getVariable<TimeDataType>(TIME_DATA_KEY) || {};\n if (typeof value === \"number\") {\n data.currentHour = value;\n } else {\n delete data.currentHour;\n }\n storage.setVariable(TIME_DATA_KEY, data);\n }\n /**\n * Get the current day\n */\n get currentDay(): number {\n let data = storage.getVariable<TimeDataType>(TIME_DATA_KEY) || {};\n if (data.hasOwnProperty(\"currentDay\") && typeof data.currentDay === \"number\") {\n return data.currentDay;\n }\n return 0;\n }\n set currentDay(value: number | undefined) {\n let data = storage.getVariable<TimeDataType>(TIME_DATA_KEY) || {};\n if (typeof value === \"number\") {\n data.currentDay = value;\n } else {\n delete data.currentDay;\n }\n storage.setVariable(TIME_DATA_KEY, data);\n }\n /**\n * If the current day is greater than or equal to the weekend start day, then it will return true.\n */\n get isWeekend(): boolean {\n return this.currentWeekDayNumber >= this.weekendStartDay;\n }\n /**\n * Get the current week day number (1 - {@link weekLength}).\n * For example, if the week length is 7 and the current day is 10, then the result will be 4.\n */\n get currentWeekDayNumber(): number {\n let result = this.currentDay % this.weekLength;\n return result + 1;\n }\n /**\n * Get the current week day name. If the week days names are not defined, then it will return undefined.\n * For example, if the week days names are ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'] and the current day is 10, then the result will be 'Thursday'.\n * @default \"\"\n */\n get currentDayName(): string {\n let weekDayNumber = this.currentWeekDayNumber - 1;\n if (weekDayNumber >= this.weekDaysNames.length) {\n console.warn(`[NQTR] Week day name is not defined for day ${weekDayNumber}`, this.weekDaysNames);\n return \"\";\n }\n return this.weekDaysNames[weekDayNumber];\n }\n /**\n * Get the current {@link timeSlots} index.\n * You can use this property to create \"Image that changes based on the time period\":\n * @example\n * ```tsx\n * import { weekLength } from '@drincs/nqtr';\n *\n * function changeBackground() {\n * return (\n * <img src={`background-currentTimeSlot.currentTimeSlot.png`} />\n * )\n * }\n */\n get currentTimeSlot(): number {\n if (this.timeSlots.length === 0) {\n console.warn(\"[NQTR] Time slots are not defined\");\n return 0;\n }\n for (let index = 0; index < this.timeSlots.length; index++) {\n let slot = this.timeSlots[index];\n if (this.timeSlots.length > index + 1) {\n if (this.nowIsBetween(slot.startHour, this.timeSlots[index + 1].startHour)) {\n return index;\n }\n }\n }\n return this.timeSlots.length - 1;\n }\n\n /**\n * This function will increase the current hour by the given time spent.\n * If the new hour is greater than or equal to the max day hours, then it will increase the day and set the new hour.\n * @param timeSpent is the time spent in hours (default: {@link defaultTimeSpent})\n * @returns currentTimeSlot.currentHour\n */\n increaseHour(timeSpent: number = this.defaultTimeSpent): number {\n let newHour = this.currentHour + timeSpent;\n if (newHour >= this.maxDayHours) {\n this.increaseDay();\n newHour = this.minDayHours + (newHour - this.maxDayHours);\n }\n this.currentHour = newHour;\n return this.currentHour;\n }\n\n /**\n * This function will increase the current day by the given days.\n * @param newDayHour is the hour of the new day (default: {@link minDayHours})\n * @param days is the number of days to increase (default: 1)\n * @returns timeTracker.currentDay\n */\n increaseDay(newDayHour: number = this.minDayHours, days: number = 1): number {\n let newDay = this.currentDay + days;\n this.currentDay = newDay;\n this.currentHour = newDayHour;\n return this.currentDay;\n }\n\n /**\n * This function will check if the current hour is between the given hours.\n * @param fromHour the starting hour. If the {@link currentHour} is equal to this hour, the function will return true.\n * @param toHour the ending hour.\n * @returns true if the current hour is between the given hours, otherwise false.\n */\n nowIsBetween(fromHour: number | undefined, toHour: number | undefined): boolean {\n if (fromHour === undefined) {\n fromHour = this.minDayHours - 1;\n }\n if (toHour === undefined) {\n toHour = this.maxDayHours + 1;\n }\n let currentHour = this.currentHour;\n if (fromHour < toHour) {\n return currentHour >= fromHour && currentHour < toHour;\n }\n return currentHour >= fromHour || currentHour < toHour;\n }\n}\n","import NavigatorManager from \"./NavigatorManager\";\nimport QuestManager from \"./QuestManager\";\nimport RoutineManager from \"./RoutineManager\";\nimport { default as TimeManager } from \"./TimeManager\";\n\nconst timeTracker = new TimeManager();\nconst navigator = new NavigatorManager();\nconst routine = new RoutineManager();\nconst questsNotebook = new QuestManager();\n\nexport { navigator, questsNotebook, routine, timeTracker };\n","import { OnRunProps } from \"@drincs/nqtr\";\nimport { StoredClassModel } from \"@drincs/pixi-vn\";\nimport { StageInterface } from \"../../interface\";\nimport { StageBaseInternalInterface } from \"../../interface/quest/StageInterface\";\nimport { timeTracker } from \"../../managers\";\nimport { QuestsRequiredType } from \"../../types\";\n\nconst STAGE_CATEGORY = \"__nqtr-stage__\";\nexport default class StageStoredClass extends StoredClassModel implements StageBaseInternalInterface {\n constructor(\n id: string,\n options: {\n /**\n * The function that will be executed when the stage starts.\n */\n onStart?: (stage: StageInterface, props: OnRunProps) => void;\n /**\n * The function that will be executed when the stage ends.\n */\n onEnd?: (stage: StageInterface, props: OnRunProps) => void;\n /**\n * The day required to start the stage.\n * @example If the value is 3, and the previous stage ends on day 1, the stage will start on day 4.\n */\n daysRequiredToStart?: number;\n /**\n * The quests required to start the stage.\n * @default []\n */\n questsRequiredToStart?: QuestsRequiredType[];\n } = {}\n ) {\n super(STAGE_CATEGORY, id);\n this._onStart = options.onStart;\n this._onEnd = options.onEnd;\n this._daysRequiredToStart = options.daysRequiredToStart;\n this._questsRequiredToStart = options.questsRequiredToStart || [];\n }\n\n private _onStart?: (stage: StageInterface, props: OnRunProps) => void;\n get onStart(): undefined | ((stage: StageInterface, props: OnRunProps) => void) {\n return this._onStart;\n }\n\n private _onEnd?: (stage: StageInterface, props: OnRunProps) => void;\n get onEnd(): undefined | ((stage: StageInterface, props: OnRunProps) => void) {\n return this._onEnd;\n }\n\n get completed(): boolean {\n return this.getStorageProperty<boolean>(\"completed\") || false;\n }\n set completed(value: boolean) {\n this.setStorageProperty(\"completed\", value);\n }\n\n get started(): boolean {\n return this.getStorageProperty<boolean>(\"started\") || false;\n }\n set started(value: boolean) {\n this.setStorageProperty(\"started\", value);\n }\n\n private get prevStageEndDay(): number | undefined {\n return this.getStorageProperty<number>(\"prevStageEndDay\");\n }\n private set prevStageEndDay(value: number | undefined) {\n this.setStorageProperty(\"prevStageEndDay\", value);\n }\n\n get startDay(): number | undefined {\n let prevStageEndDay = this.prevStageEndDay;\n if (prevStageEndDay === undefined) {\n return undefined;\n }\n return prevStageEndDay + this.daysRequiredToStart;\n }\n\n get canStart(): boolean {\n let daysRequired = this.daysRequiredToStart;\n if (daysRequired > 0) {\n let prevStageEndDay = this.prevStageEndDay;\n if (prevStageEndDay === undefined) {\n return false;\n }\n if (prevStageEndDay + daysRequired > timeTracker.currentDay) {\n return false;\n }\n }\n if (\n this.questsRequiredToStart.length > 0 &&\n !this.questsRequiredToStart.every(\n (q) => q.quest.currentStageIndex && q.quest.currentStageIndex >= q.stageNumber\n )\n ) {\n return false;\n }\n return true;\n }\n\n inizialize() {\n if (this.daysRequiredToStart > 0) {\n this.prevStageEndDay = timeTracker.currentDay;\n console.log(`[NQTR] Stage ${this.id} will start on day ${this.startDay}`);\n }\n }\n\n start(props: OnRunProps) {\n if (this.canStart) {\n this.started = true;\n if (this.onStart) {\n this.onStart(this as any as StageInterface, props);\n }\n } else {\n console.warn(`[NQTR] Stage ${this.id} can't start`);\n }\n }\n\n private _daysRequiredToStart?: number;\n get daysRequiredToStart(): number {\n return this._daysRequiredToStart || 0;\n }\n\n private _questsRequiredToStart: QuestsRequiredType[];\n get questsRequiredToStart(): QuestsRequiredType[] {\n return this._questsRequiredToStart || [];\n }\n}\n"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {StoredClassModel,storage}from'@drincs/pixi-vn';var
|
|
1
|
+
import {StoredClassModel,storage}from'@drincs/pixi-vn';var s="___nqtr-time_manager_data___";var n=class{static minDayHours=0;static maxDayHours=24;static defaultTimeSpent=1;static timeSlots=[];static weekLength=7;static weekendStartDay=this.weekLength-1;static weekDaysNames=[]};var l=class{initialize(e){let{minDayHours:t=0,maxDayHours:r=24,defaultTimeSpent:a=1,timeSlots:x=[],weekLength:m=7,weekendStartDay:D=m-1,weekDaysNames:_=[]}=e;n.minDayHours=t,n.maxDayHours=r,n.defaultTimeSpent=a,n.timeSlots=x,n.weekLength=m,D>=n.weekLength?console.warn(`[NQTR] Weekend start day should be less than week length ${m}, so will be ignored`):n.weekendStartDay=D,_.length!==m?console.warn(`[NQTR] Week days names should be equal to week length ${m}, so will be ignored`):n.weekDaysNames=_;}get minDayHours(){return n.minDayHours}get maxDayHours(){return n.maxDayHours}get defaultTimeSpent(){return n.defaultTimeSpent}get timeSlots(){return n.timeSlots}get weekLength(){return n.weekLength}get weekendStartDay(){return n.weekendStartDay}get weekDaysNames(){return n.weekDaysNames}get currentHour(){let e=storage.getVariable(s)||{};return e.hasOwnProperty("currentHour")&&typeof e.currentHour=="number"?e.currentHour:this.minDayHours}set currentHour(e){let t=storage.getVariable(s)||{};typeof e=="number"?t.currentHour=e:delete t.currentHour,storage.setVariable(s,t);}get currentDay(){let e=storage.getVariable(s)||{};return e.hasOwnProperty("currentDay")&&typeof e.currentDay=="number"?e.currentDay:0}set currentDay(e){let t=storage.getVariable(s)||{};typeof e=="number"?t.currentDay=e:delete t.currentDay,storage.setVariable(s,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-1),t===undefined&&(t=this.maxDayHours+1);let r=this.currentHour;return e<t?r>=e&&r<t:r>=e||r<t}};var b=new l;var N="__nqtr-stage__",I=class extends StoredClassModel{constructor(e,t={}){super(N,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>b.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=b.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||[]}};export{I as default};//# sourceMappingURL=StageStoredClass.mjs.map
|
|
2
2
|
//# sourceMappingURL=StageStoredClass.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/constants.ts","../../../src/managers/TimeManagerSettings.ts","../../../src/managers/TimeManager.ts","../../../src/managers/index.ts","../../../src/classes/quest/StageStoredClass.ts"],"names":["TIME_DATA_KEY","TimeManagerSettings","TimeManager","settings","minDayHours","maxDayHours","defaultTimeSpent","timeSlots","weekLength","weekendStartDay","weekDaysNames","data","storage","value","weekDayNumber","index","slot","timeSpent","newHour","newDayHour","days","newDay","fromHour","toHour","currentHour","timeTracker","navigator","STAGE_CATEGORY","StageStoredClass","StoredClassModel","id","options","prevStageEndDay","daysRequired","q","props"],"mappings":"uDACO,IAAMA,EAAgB,8BCC7B,CAAA,IAAqBC,EAArB,KAAiE,CAC7D,OAAO,WAAA,CAAsB,EAC7B,OAAO,WAAA,CAAsB,GAC7B,OAAO,gBAAA,CAA2B,EAClC,OAAO,SAAA,CAA0B,EAAC,CAClC,OAAO,UAAqB,CAAA,CAAA,CAC5B,OAAO,eAA0B,CAAA,IAAA,CAAK,WAAa,CACnD,CAAA,OAAO,aAA0B,CAAA,EACrC,CCJA,CAAA,IAAqBC,EAArB,KAAiC,CAC7B,WAAWC,CAAwB,CAAA,C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ACJ","file":"StageStoredClass.mjs","sourcesContent":["export const TIME_SETTINGS_KEY = '___nqtr-time_manager_settings___';\nexport const TIME_DATA_KEY = '___nqtr-time_manager_data___';\n\n","import { ITimeStlot, TimeSettings } from \"../types/TimeSettings\";\n\nexport default class TimeManagerSettings implements TimeSettings {\n static minDayHours: number = 0\n static maxDayHours: number = 24\n static defaultTimeSpent: number = 1\n static timeSlots: ITimeStlot[] = []\n static weekLength: number = 7\n static weekendStartDay: number = this.weekLength - 1\n static weekDaysNames: string[] = []\n}\n","import { storage } from \"@drincs/pixi-vn\";\nimport { TIME_DATA_KEY } from \"../constants\";\nimport TimeDataType from \"../types/TimeDataType\";\nimport { ITimeStlot, TimeSettings } from \"../types/TimeSettings\";\nimport TimeManagerSettings from \"./TimeManagerSettings\";\n\nexport default class TimeManager {\n initialize(settings: TimeSettings) {\n const {\n minDayHours = 0,\n maxDayHours = 24,\n defaultTimeSpent = 1,\n timeSlots = [],\n weekLength = 7,\n weekendStartDay = weekLength - 1,\n weekDaysNames = [],\n } = settings\n TimeManagerSettings.minDayHours = minDayHours\n TimeManagerSettings.maxDayHours = maxDayHours\n TimeManagerSettings.defaultTimeSpent = defaultTimeSpent\n TimeManagerSettings.timeSlots = timeSlots\n TimeManagerSettings.weekLength = weekLength\n if (weekendStartDay >= TimeManagerSettings.weekLength) {\n console.warn(`[NQTR] Weekend start day should be less than week length ${weekLength}, so will be ignored`)\n }\n else {\n TimeManagerSettings.weekendStartDay = weekendStartDay\n }\n if (weekDaysNames.length !== weekLength) {\n console.warn(`[NQTR] Week days names should be equal to week length ${weekLength}, so will be ignored`)\n }\n else {\n TimeManagerSettings.weekDaysNames = weekDaysNames\n }\n }\n get minDayHours(): number {\n return TimeManagerSettings.minDayHours\n }\n get maxDayHours(): number {\n return TimeManagerSettings.maxDayHours\n }\n get defaultTimeSpent(): number {\n return TimeManagerSettings.defaultTimeSpent\n }\n get timeSlots(): ITimeStlot[] {\n return TimeManagerSettings.timeSlots\n }\n get weekLength(): number {\n return TimeManagerSettings.weekLength\n }\n get weekendStartDay(): number {\n return TimeManagerSettings.weekendStartDay\n }\n get weekDaysNames(): string[] {\n return TimeManagerSettings.weekDaysNames\n }\n\n /**\n * Get the current hour\n */\n get currentHour(): number {\n let data = storage.getVariable<TimeDataType>(TIME_DATA_KEY) || {}\n if (data.hasOwnProperty('currentHour') && typeof data.currentHour === 'number') {\n return data.currentHour\n }\n return this.minDayHours\n }\n set currentHour(value: number | undefined) {\n let data = storage.getVariable<TimeDataType>(TIME_DATA_KEY) || {}\n if (typeof value === 'number') {\n data.currentHour = value\n } else {\n delete data.currentHour\n }\n storage.setVariable(TIME_DATA_KEY, data)\n }\n /**\n * Get the current day\n */\n get currentDay(): number {\n let data = storage.getVariable<TimeDataType>(TIME_DATA_KEY) || {}\n if (data.hasOwnProperty('currentDay') && typeof data.currentDay === 'number') {\n return data.currentDay\n }\n return 0\n }\n set currentDay(value: number | undefined) {\n let data = storage.getVariable<TimeDataType>(TIME_DATA_KEY) || {}\n if (typeof value === 'number') {\n data.currentDay = value\n }\n else {\n delete data.currentDay\n }\n storage.setVariable(TIME_DATA_KEY, data)\n }\n /**\n * If the current day is greater than or equal to the weekend start day, then it will return true.\n */\n get isWeekend(): boolean {\n return this.currentWeekDayNumber >= this.weekendStartDay\n }\n /**\n * Get the current week day number (1 - {@link weekLength}).\n * For example, if the week length is 7 and the current day is 10, then the result will be 4.\n */\n get currentWeekDayNumber(): number {\n let result = this.currentDay % this.weekLength\n return result + 1\n }\n /**\n * Get the current week day name. If the week days names are not defined, then it will return undefined.\n * For example, if the week days names are ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'] and the current day is 10, then the result will be 'Thursday'.\n * @default \"\"\n */\n get currentDayName(): string {\n let weekDayNumber = this.currentWeekDayNumber - 1\n if (weekDayNumber >= this.weekDaysNames.length) {\n console.warn(`[NQTR] Week day name is not defined for day ${weekDayNumber}`, this.weekDaysNames)\n return \"\"\n }\n return this.weekDaysNames[weekDayNumber]\n }\n /**\n * Get the current {@link timeSlots} index.\n * You can use this property to create \"Image that changes based on the time period\":\n * @example\n * ```tsx\n * import { weekLength } from '@drincs/nqtr';\n * \n * function changeBackground() {\n * return (\n * <img src={`background-currentTimeSlot.currentTimeSlot.png`} />\n * )\n * }\n */\n get currentTimeSlot(): number {\n if (this.timeSlots.length === 0) {\n console.warn('[NQTR] Time slots are not defined')\n return 0\n }\n for (let index = 0; index < this.timeSlots.length; index++) {\n let slot = this.timeSlots[index]\n if (this.timeSlots.length > index + 1) {\n if (this.nowIsBetween(slot.startHour, this.timeSlots[index + 1].startHour)) {\n return index\n }\n }\n }\n return this.timeSlots.length - 1\n }\n\n /**\n * This function will increase the current hour by the given time spent.\n * If the new hour is greater than or equal to the max day hours, then it will increase the day and set the new hour.\n * @param timeSpent is the time spent in hours (default: {@link defaultTimeSpent})\n * @returns currentTimeSlot.currentHour\n */\n increaseHour(timeSpent: number = this.defaultTimeSpent): number {\n let newHour = this.currentHour + timeSpent\n if (newHour >= this.maxDayHours) {\n this.increaseDay()\n newHour = this.minDayHours + (newHour - this.maxDayHours)\n }\n this.currentHour = newHour\n return this.currentHour\n }\n\n /**\n * This function will increase the current day by the given days.\n * @param newDayHour is the hour of the new day (default: {@link minDayHours})\n * @param days is the number of days to increase (default: 1)\n * @returns timeTracker.currentDay\n */\n increaseDay(newDayHour: number = this.minDayHours, days: number = 1): number {\n let newDay = this.currentDay + days\n this.currentDay = newDay\n this.currentHour = newDayHour\n return this.currentDay\n }\n\n /**\n * This function will check if the current hour is between the given hours.\n * @param fromHour the starting hour. If the {@link currentHour} is equal to this hour, the function will return true.\n * @param toHour the ending hour.\n * @returns true if the current hour is between the given hours, otherwise false.\n */\n nowIsBetween(fromHour: number | undefined, toHour: number | undefined): boolean {\n if (fromHour === undefined) {\n fromHour = this.minDayHours\n }\n if (toHour === undefined) {\n toHour = this.maxDayHours\n }\n let currentHour = this.currentHour\n if (fromHour < toHour) {\n return currentHour >= fromHour && currentHour < toHour\n }\n return currentHour >= fromHour || currentHour < toHour\n }\n}\n","import NavigatorManager from \"./NavigatorManager\";\nimport QuestManager from \"./QuestManager\";\nimport RoutineManager from \"./RoutineManager\";\nimport { default as TimeManager } from \"./TimeManager\";\n\nconst timeTracker = new TimeManager();\nconst navigator = new NavigatorManager();\nconst routine = new RoutineManager();\nconst questsNotebook = new QuestManager();\n\nexport { navigator, questsNotebook, routine, timeTracker };\n","import { OnRunProps } from \"@drincs/nqtr\";\nimport { StoredClassModel } from \"@drincs/pixi-vn\";\nimport { StageInterface } from \"../../interface\";\nimport { StageBaseInternalInterface } from \"../../interface/quest/StageInterface\";\nimport { timeTracker } from \"../../managers\";\nimport { QuestsRequiredType } from \"../../types\";\n\nconst STAGE_CATEGORY = \"__nqtr-stage__\";\nexport default class StageStoredClass extends StoredClassModel implements StageBaseInternalInterface {\n constructor(\n id: string,\n options: {\n /**\n * The function that will be executed when the stage starts.\n */\n onStart?: (stage: StageInterface, props: OnRunProps) => void;\n /**\n * The function that will be executed when the stage ends.\n */\n onEnd?: (stage: StageInterface, props: OnRunProps) => void;\n /**\n * The day required to start the stage.\n * @example If the value is 3, and the previous stage ends on day 1, the stage will start on day 4.\n */\n daysRequiredToStart?: number;\n /**\n * The quests required to start the stage.\n * @default []\n */\n questsRequiredToStart?: QuestsRequiredType[];\n } = {}\n ) {\n super(STAGE_CATEGORY, id);\n this._onStart = options.onStart;\n this._onEnd = options.onEnd;\n this._daysRequiredToStart = options.daysRequiredToStart;\n this._questsRequiredToStart = options.questsRequiredToStart || [];\n }\n\n private _onStart?: (stage: StageInterface, props: OnRunProps) => void;\n get onStart(): undefined | ((stage: StageInterface, props: OnRunProps) => void) {\n return this._onStart;\n }\n\n private _onEnd?: (stage: StageInterface, props: OnRunProps) => void;\n get onEnd(): undefined | ((stage: StageInterface, props: OnRunProps) => void) {\n return this._onEnd;\n }\n\n get completed(): boolean {\n return this.getStorageProperty<boolean>(\"completed\") || false;\n }\n set completed(value: boolean) {\n this.setStorageProperty(\"completed\", value);\n }\n\n get started(): boolean {\n return this.getStorageProperty<boolean>(\"started\") || false;\n }\n set started(value: boolean) {\n this.setStorageProperty(\"started\", value);\n }\n\n private get prevStageEndDay(): number | undefined {\n return this.getStorageProperty<number>(\"prevStageEndDay\");\n }\n private set prevStageEndDay(value: number | undefined) {\n this.setStorageProperty(\"prevStageEndDay\", value);\n }\n\n get startDay(): number | undefined {\n let prevStageEndDay = this.prevStageEndDay;\n if (prevStageEndDay === undefined) {\n return undefined;\n }\n return prevStageEndDay + this.daysRequiredToStart;\n }\n\n get canStart(): boolean {\n let daysRequired = this.daysRequiredToStart;\n if (daysRequired > 0) {\n let prevStageEndDay = this.prevStageEndDay;\n if (prevStageEndDay === undefined) {\n return false;\n }\n if (prevStageEndDay + daysRequired > timeTracker.currentDay) {\n return false;\n }\n }\n if (\n this.questsRequiredToStart.length > 0 &&\n !this.questsRequiredToStart.every(\n (q) => q.quest.currentStageIndex && q.quest.currentStageIndex >= q.stageNumber\n )\n ) {\n return false;\n }\n return true;\n }\n\n inizialize() {\n if (this.daysRequiredToStart > 0) {\n this.prevStageEndDay = timeTracker.currentDay;\n console.log(`[NQTR] Stage ${this.id} will start on day ${this.startDay}`);\n }\n }\n\n start(props: OnRunProps) {\n if (this.canStart) {\n this.started = true;\n if (this.onStart) {\n this.onStart(this as any as StageInterface, props);\n }\n } else {\n console.warn(`[NQTR] Stage ${this.id} can't start`);\n }\n }\n\n private _daysRequiredToStart?: number;\n get daysRequiredToStart(): number {\n return this._daysRequiredToStart || 0;\n }\n\n private _questsRequiredToStart: QuestsRequiredType[];\n get questsRequiredToStart(): QuestsRequiredType[] {\n return this._questsRequiredToStart || [];\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../../../src/constants.ts","../../../src/managers/TimeManagerSettings.ts","../../../src/managers/TimeManager.ts","../../../src/managers/index.ts","../../../src/classes/quest/StageStoredClass.ts"],"names":["TIME_DATA_KEY","TimeManagerSettings","TimeManager","settings","minDayHours","maxDayHours","defaultTimeSpent","timeSlots","weekLength","weekendStartDay","weekDaysNames","data","storage","value","weekDayNumber","index","slot","timeSpent","newHour","newDayHour","days","newDay","fromHour","toHour","currentHour","timeTracker","navigator","STAGE_CATEGORY","StageStoredClass","StoredClassModel","id","options","prevStageEndDay","daysRequired","q","props"],"mappings":"uDACO,IAAMA,CAAAA,CAAgB,+BCC7B,IAAqBC,CAAAA,CAArB,KAAiE,CAC7D,OAAO,WAAsB,CAAA,CAAA,CAC7B,OAAO,WAAsB,CAAA,EAAA,CAC7B,OAAO,gBAA2B,CAAA,CAAA,CAClC,OAAO,SAA0B,CAAA,EACjC,CAAA,OAAO,WAAqB,CAC5B,CAAA,OAAO,gBAA0B,IAAK,CAAA,UAAA,CAAa,EACnD,OAAO,aAAA,CAA0B,EACrC,ECJA,IAAqBC,CAAAA,CAArB,KAAiC,CAC7B,UAAA,CAAWC,EAAwB,CAC/B,GAAM,CACF,WAAA,CAAAC,EAAc,CACd,CAAA,WAAA,CAAAC,EAAc,EACd,CAAA,gBAAA,CAAAC,EAAmB,CACnB,CAAA,SAAA,CAAAC,CAAY,CAAA,GACZ,UAAAC,CAAAA,CAAAA,CAAa,EACb,eAAAC,CAAAA,CAAAA,CAAkBD,EAAa,CAC/B,CAAA,aAAA,CAAAE,CAAgB,CAAA,EACpB,CAAIP,CAAAA,CAAAA,CACJF,EAAoB,WAAcG,CAAAA,CAAAA,CAClCH,EAAoB,WAAcI,CAAAA,CAAAA,CAClCJ,CAAoB,CAAA,gBAAA,CAAmBK,EACvCL,CAAoB,CAAA,SAAA,CAAYM,EAChCN,CAAoB,CAAA,UAAA,CAAaO,EAC7BC,CAAmBR,EAAAA,CAAAA,CAAoB,UACvC,CAAA,OAAA,CAAQ,KAAK,CAA4DO,yDAAAA,EAAAA,CAAU,sBAAsB,CAEzGP,CAAAA,CAAAA,CAAoB,gBAAkBQ,CAEtCC,CAAAA,CAAAA,CAAc,MAAWF,GAAAA,CAA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,WACvE,CAAA,CAKR,CAEA,UAAa,EAAA,CACL,KAAK,mBAAsB,CAAA,CAAA,GAC3B,KAAK,eAAkBT,CAAAA,CAAAA,CAAY,UACnC,CAAA,OAAA,CAAQ,IAAI,CAAgB,aAAA,EAAA,IAAA,CAAK,EAAE,CAAsB,mBAAA,EAAA,IAAA,CAAK,QAAQ,CAAE,CAAA,CAAA,EAEhF,CAEA,KAAA,CAAMU,EAAmB,CACjB,IAAA,CAAK,UACL,IAAK,CAAA,OAAA,CAAU,KACX,IAAK,CAAA,OAAA,EACL,IAAK,CAAA,OAAA,CAAQ,KAA+BA,CAAK,CAAA,EAGrD,QAAQ,IAAK,CAAA,CAAA,aAAA,EAAgB,KAAK,EAAE,CAAA,YAAA,CAAc,EAE1D,CAEQ,qBACR,IAAI,mBAAA,EAA8B,CAC9B,OAAO,IAAA,CAAK,sBAAwB,CACxC,CAEQ,sBACR,CAAA,IAAI,uBAA8C,CAC9C,OAAO,KAAK,sBAA0B,EAAA,EAC1C,CACJ","file":"StageStoredClass.mjs","sourcesContent":["export const TIME_SETTINGS_KEY = '___nqtr-time_manager_settings___';\nexport const TIME_DATA_KEY = '___nqtr-time_manager_data___';\n\n","import { ITimeStlot, TimeSettings } from \"../types/TimeSettings\";\n\nexport default class TimeManagerSettings implements TimeSettings {\n static minDayHours: number = 0\n static maxDayHours: number = 24\n static defaultTimeSpent: number = 1\n static timeSlots: ITimeStlot[] = []\n static weekLength: number = 7\n static weekendStartDay: number = this.weekLength - 1\n static weekDaysNames: string[] = []\n}\n","import { storage } from \"@drincs/pixi-vn\";\nimport { TIME_DATA_KEY } from \"../constants\";\nimport TimeDataType from \"../types/TimeDataType\";\nimport { ITimeStlot, TimeSettings } from \"../types/TimeSettings\";\nimport TimeManagerSettings from \"./TimeManagerSettings\";\n\nexport default class TimeManager {\n initialize(settings: TimeSettings) {\n const {\n minDayHours = 0,\n maxDayHours = 24,\n defaultTimeSpent = 1,\n timeSlots = [],\n weekLength = 7,\n weekendStartDay = weekLength - 1,\n weekDaysNames = [],\n } = settings;\n TimeManagerSettings.minDayHours = minDayHours;\n TimeManagerSettings.maxDayHours = maxDayHours;\n TimeManagerSettings.defaultTimeSpent = defaultTimeSpent;\n TimeManagerSettings.timeSlots = timeSlots;\n TimeManagerSettings.weekLength = weekLength;\n if (weekendStartDay >= TimeManagerSettings.weekLength) {\n console.warn(`[NQTR] Weekend start day should be less than week length ${weekLength}, so will be ignored`);\n } else {\n TimeManagerSettings.weekendStartDay = weekendStartDay;\n }\n if (weekDaysNames.length !== weekLength) {\n console.warn(`[NQTR] Week days names should be equal to week length ${weekLength}, so will be ignored`);\n } else {\n TimeManagerSettings.weekDaysNames = weekDaysNames;\n }\n }\n get minDayHours(): number {\n return TimeManagerSettings.minDayHours;\n }\n get maxDayHours(): number {\n return TimeManagerSettings.maxDayHours;\n }\n get defaultTimeSpent(): number {\n return TimeManagerSettings.defaultTimeSpent;\n }\n get timeSlots(): ITimeStlot[] {\n return TimeManagerSettings.timeSlots;\n }\n get weekLength(): number {\n return TimeManagerSettings.weekLength;\n }\n get weekendStartDay(): number {\n return TimeManagerSettings.weekendStartDay;\n }\n get weekDaysNames(): string[] {\n return TimeManagerSettings.weekDaysNames;\n }\n\n /**\n * Get the current hour\n */\n get currentHour(): number {\n let data = storage.getVariable<TimeDataType>(TIME_DATA_KEY) || {};\n if (data.hasOwnProperty(\"currentHour\") && typeof data.currentHour === \"number\") {\n return data.currentHour;\n }\n return this.minDayHours;\n }\n set currentHour(value: number | undefined) {\n let data = storage.getVariable<TimeDataType>(TIME_DATA_KEY) || {};\n if (typeof value === \"number\") {\n data.currentHour = value;\n } else {\n delete data.currentHour;\n }\n storage.setVariable(TIME_DATA_KEY, data);\n }\n /**\n * Get the current day\n */\n get currentDay(): number {\n let data = storage.getVariable<TimeDataType>(TIME_DATA_KEY) || {};\n if (data.hasOwnProperty(\"currentDay\") && typeof data.currentDay === \"number\") {\n return data.currentDay;\n }\n return 0;\n }\n set currentDay(value: number | undefined) {\n let data = storage.getVariable<TimeDataType>(TIME_DATA_KEY) || {};\n if (typeof value === \"number\") {\n data.currentDay = value;\n } else {\n delete data.currentDay;\n }\n storage.setVariable(TIME_DATA_KEY, data);\n }\n /**\n * If the current day is greater than or equal to the weekend start day, then it will return true.\n */\n get isWeekend(): boolean {\n return this.currentWeekDayNumber >= this.weekendStartDay;\n }\n /**\n * Get the current week day number (1 - {@link weekLength}).\n * For example, if the week length is 7 and the current day is 10, then the result will be 4.\n */\n get currentWeekDayNumber(): number {\n let result = this.currentDay % this.weekLength;\n return result + 1;\n }\n /**\n * Get the current week day name. If the week days names are not defined, then it will return undefined.\n * For example, if the week days names are ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'] and the current day is 10, then the result will be 'Thursday'.\n * @default \"\"\n */\n get currentDayName(): string {\n let weekDayNumber = this.currentWeekDayNumber - 1;\n if (weekDayNumber >= this.weekDaysNames.length) {\n console.warn(`[NQTR] Week day name is not defined for day ${weekDayNumber}`, this.weekDaysNames);\n return \"\";\n }\n return this.weekDaysNames[weekDayNumber];\n }\n /**\n * Get the current {@link timeSlots} index.\n * You can use this property to create \"Image that changes based on the time period\":\n * @example\n * ```tsx\n * import { weekLength } from '@drincs/nqtr';\n *\n * function changeBackground() {\n * return (\n * <img src={`background-currentTimeSlot.currentTimeSlot.png`} />\n * )\n * }\n */\n get currentTimeSlot(): number {\n if (this.timeSlots.length === 0) {\n console.warn(\"[NQTR] Time slots are not defined\");\n return 0;\n }\n for (let index = 0; index < this.timeSlots.length; index++) {\n let slot = this.timeSlots[index];\n if (this.timeSlots.length > index + 1) {\n if (this.nowIsBetween(slot.startHour, this.timeSlots[index + 1].startHour)) {\n return index;\n }\n }\n }\n return this.timeSlots.length - 1;\n }\n\n /**\n * This function will increase the current hour by the given time spent.\n * If the new hour is greater than or equal to the max day hours, then it will increase the day and set the new hour.\n * @param timeSpent is the time spent in hours (default: {@link defaultTimeSpent})\n * @returns currentTimeSlot.currentHour\n */\n increaseHour(timeSpent: number = this.defaultTimeSpent): number {\n let newHour = this.currentHour + timeSpent;\n if (newHour >= this.maxDayHours) {\n this.increaseDay();\n newHour = this.minDayHours + (newHour - this.maxDayHours);\n }\n this.currentHour = newHour;\n return this.currentHour;\n }\n\n /**\n * This function will increase the current day by the given days.\n * @param newDayHour is the hour of the new day (default: {@link minDayHours})\n * @param days is the number of days to increase (default: 1)\n * @returns timeTracker.currentDay\n */\n increaseDay(newDayHour: number = this.minDayHours, days: number = 1): number {\n let newDay = this.currentDay + days;\n this.currentDay = newDay;\n this.currentHour = newDayHour;\n return this.currentDay;\n }\n\n /**\n * This function will check if the current hour is between the given hours.\n * @param fromHour the starting hour. If the {@link currentHour} is equal to this hour, the function will return true.\n * @param toHour the ending hour.\n * @returns true if the current hour is between the given hours, otherwise false.\n */\n nowIsBetween(fromHour: number | undefined, toHour: number | undefined): boolean {\n if (fromHour === undefined) {\n fromHour = this.minDayHours - 1;\n }\n if (toHour === undefined) {\n toHour = this.maxDayHours + 1;\n }\n let currentHour = this.currentHour;\n if (fromHour < toHour) {\n return currentHour >= fromHour && currentHour < toHour;\n }\n return currentHour >= fromHour || currentHour < toHour;\n }\n}\n","import NavigatorManager from \"./NavigatorManager\";\nimport QuestManager from \"./QuestManager\";\nimport RoutineManager from \"./RoutineManager\";\nimport { default as TimeManager } from \"./TimeManager\";\n\nconst timeTracker = new TimeManager();\nconst navigator = new NavigatorManager();\nconst routine = new RoutineManager();\nconst questsNotebook = new QuestManager();\n\nexport { navigator, questsNotebook, routine, timeTracker };\n","import { OnRunProps } from \"@drincs/nqtr\";\nimport { StoredClassModel } from \"@drincs/pixi-vn\";\nimport { StageInterface } from \"../../interface\";\nimport { StageBaseInternalInterface } from \"../../interface/quest/StageInterface\";\nimport { timeTracker } from \"../../managers\";\nimport { QuestsRequiredType } from \"../../types\";\n\nconst STAGE_CATEGORY = \"__nqtr-stage__\";\nexport default class StageStoredClass extends StoredClassModel implements StageBaseInternalInterface {\n constructor(\n id: string,\n options: {\n /**\n * The function that will be executed when the stage starts.\n */\n onStart?: (stage: StageInterface, props: OnRunProps) => void;\n /**\n * The function that will be executed when the stage ends.\n */\n onEnd?: (stage: StageInterface, props: OnRunProps) => void;\n /**\n * The day required to start the stage.\n * @example If the value is 3, and the previous stage ends on day 1, the stage will start on day 4.\n */\n daysRequiredToStart?: number;\n /**\n * The quests required to start the stage.\n * @default []\n */\n questsRequiredToStart?: QuestsRequiredType[];\n } = {}\n ) {\n super(STAGE_CATEGORY, id);\n this._onStart = options.onStart;\n this._onEnd = options.onEnd;\n this._daysRequiredToStart = options.daysRequiredToStart;\n this._questsRequiredToStart = options.questsRequiredToStart || [];\n }\n\n private _onStart?: (stage: StageInterface, props: OnRunProps) => void;\n get onStart(): undefined | ((stage: StageInterface, props: OnRunProps) => void) {\n return this._onStart;\n }\n\n private _onEnd?: (stage: StageInterface, props: OnRunProps) => void;\n get onEnd(): undefined | ((stage: StageInterface, props: OnRunProps) => void) {\n return this._onEnd;\n }\n\n get completed(): boolean {\n return this.getStorageProperty<boolean>(\"completed\") || false;\n }\n set completed(value: boolean) {\n this.setStorageProperty(\"completed\", value);\n }\n\n get started(): boolean {\n return this.getStorageProperty<boolean>(\"started\") || false;\n }\n set started(value: boolean) {\n this.setStorageProperty(\"started\", value);\n }\n\n private get prevStageEndDay(): number | undefined {\n return this.getStorageProperty<number>(\"prevStageEndDay\");\n }\n private set prevStageEndDay(value: number | undefined) {\n this.setStorageProperty(\"prevStageEndDay\", value);\n }\n\n get startDay(): number | undefined {\n let prevStageEndDay = this.prevStageEndDay;\n if (prevStageEndDay === undefined) {\n return undefined;\n }\n return prevStageEndDay + this.daysRequiredToStart;\n }\n\n get canStart(): boolean {\n let daysRequired = this.daysRequiredToStart;\n if (daysRequired > 0) {\n let prevStageEndDay = this.prevStageEndDay;\n if (prevStageEndDay === undefined) {\n return false;\n }\n if (prevStageEndDay + daysRequired > timeTracker.currentDay) {\n return false;\n }\n }\n if (\n this.questsRequiredToStart.length > 0 &&\n !this.questsRequiredToStart.every(\n (q) => q.quest.currentStageIndex && q.quest.currentStageIndex >= q.stageNumber\n )\n ) {\n return false;\n }\n return true;\n }\n\n inizialize() {\n if (this.daysRequiredToStart > 0) {\n this.prevStageEndDay = timeTracker.currentDay;\n console.log(`[NQTR] Stage ${this.id} will start on day ${this.startDay}`);\n }\n }\n\n start(props: OnRunProps) {\n if (this.canStart) {\n this.started = true;\n if (this.onStart) {\n this.onStart(this as any as StageInterface, props);\n }\n } else {\n console.warn(`[NQTR] Stage ${this.id} can't start`);\n }\n }\n\n private _daysRequiredToStart?: number;\n get daysRequiredToStart(): number {\n return this._daysRequiredToStart || 0;\n }\n\n private _questsRequiredToStart: QuestsRequiredType[];\n get questsRequiredToStart(): QuestsRequiredType[] {\n return this._questsRequiredToStart || [];\n }\n}\n"]}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
export { getActivityById, saveActivity } from './ActivityDecorator.mjs';
|
|
2
2
|
export { saveCommitment } from './CommitmentDecorator.mjs';
|
|
3
|
-
export { saveQuest
|
|
3
|
+
export { saveQuest } from './QuestDecorator.mjs';
|
|
4
4
|
export { saveRoom } from './RoomDecorator.mjs';
|
|
5
5
|
import '../interface/ActivityInterface.mjs';
|
|
6
6
|
import '@drincs/nqtr';
|
|
7
|
-
import '../RoomInterface-
|
|
7
|
+
import '../RoomInterface-DURfkQ7u.mjs';
|
|
8
8
|
import '@drincs/pixi-vn';
|
|
9
9
|
import '../types/ExecutionType.mjs';
|
|
10
10
|
import '../interface/navigation/NavigationAbstractClass.mjs';
|
|
11
|
-
import '../StageInterface-
|
|
11
|
+
import '../StageInterface-DX74DUxG.mjs';
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
export { getActivityById, saveActivity } from './ActivityDecorator.js';
|
|
2
2
|
export { saveCommitment } from './CommitmentDecorator.js';
|
|
3
|
-
export { saveQuest
|
|
3
|
+
export { saveQuest } from './QuestDecorator.js';
|
|
4
4
|
export { saveRoom } from './RoomDecorator.js';
|
|
5
5
|
import '../interface/ActivityInterface.js';
|
|
6
6
|
import '@drincs/nqtr';
|
|
7
|
-
import '../RoomInterface-
|
|
7
|
+
import '../RoomInterface-CdAM_q7P.js';
|
|
8
8
|
import '@drincs/pixi-vn';
|
|
9
9
|
import '../types/ExecutionType.js';
|
|
10
10
|
import '../interface/navigation/NavigationAbstractClass.js';
|
|
11
|
-
import '../StageInterface-
|
|
11
|
+
import '../StageInterface-DX74DUxG.js';
|
package/dist/decorators/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
'use strict';var r={};function a(e){if(Array.isArray(e)){e.forEach(t=>{r[t.id]=t;});return}r[e.id]=e;}function m(e){try{let t=r[e];if(!t){console.error(`[NQTR] Activity ${e} not found`);return}return t}catch(t){console.error(`[NQTR] Error while getting Activity ${e}`,t);return}}var o={};function n(e){if(Array.isArray(e)){e.forEach(t=>n(t));return}o[e.id]&&console.warn(`[NQTR] Commitment id ${e.id} already exists, it will be overwritten`),o[e.id]=e;}var i={};function c(e){if(Array.isArray(e)){e.forEach(t=>c(t));return}i[e.id]&&console.warn(`[NQTR] Quest id ${e.id} already exists, it will be overwritten`),i[e.id]=e;}var f={};function s(e){if(Array.isArray(e)){e.forEach(t=>s(t));return}f[e.id]&&console.warn(`[NQTR] Room id ${e.id} already exists, it will be overwritten`),f[e.id]=e;}exports.getActivityById=m;exports.
|
|
1
|
+
'use strict';var r={};function a(e){if(Array.isArray(e)){e.forEach(t=>{r[t.id]=t;});return}r[e.id]=e;}function m(e){try{let t=r[e];if(!t){console.error(`[NQTR] Activity ${e} not found`);return}return t}catch(t){console.error(`[NQTR] Error while getting Activity ${e}`,t);return}}var o={};function n(e){if(Array.isArray(e)){e.forEach(t=>n(t));return}o[e.id]&&console.warn(`[NQTR] Commitment id ${e.id} already exists, it will be overwritten`),o[e.id]=e;}var i={};function c(e){if(Array.isArray(e)){e.forEach(t=>c(t));return}i[e.id]&&console.warn(`[NQTR] Quest id ${e.id} already exists, it will be overwritten`),i[e.id]=e;}var f={};function s(e){if(Array.isArray(e)){e.forEach(t=>s(t));return}f[e.id]&&console.warn(`[NQTR] Room id ${e.id} already exists, it will be overwritten`),f[e.id]=e;}exports.getActivityById=m;exports.saveActivity=a;exports.saveCommitment=n;exports.saveQuest=c;exports.saveRoom=s;//# sourceMappingURL=index.js.map
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var r={};function a(e){if(Array.isArray(e)){e.forEach(t=>{r[t.id]=t;});return}r[e.id]=e;}function m(e){try{let t=r[e];if(!t){console.error(`[NQTR] Activity ${e} not found`);return}return t}catch(t){console.error(`[NQTR] Error while getting Activity ${e}`,t);return}}var o={};function n(e){if(Array.isArray(e)){e.forEach(t=>n(t));return}o[e.id]&&console.warn(`[NQTR] Commitment id ${e.id} already exists, it will be overwritten`),o[e.id]=e;}var i={};function c(e){if(Array.isArray(e)){e.forEach(t=>c(t));return}i[e.id]&&console.warn(`[NQTR] Quest id ${e.id} already exists, it will be overwritten`),i[e.id]=e;}var f={};function s(e){if(Array.isArray(e)){e.forEach(t=>s(t));return}f[e.id]&&console.warn(`[NQTR] Room id ${e.id} already exists, it will be overwritten`),f[e.id]=e;}export{m as getActivityById,
|
|
1
|
+
var r={};function a(e){if(Array.isArray(e)){e.forEach(t=>{r[t.id]=t;});return}r[e.id]=e;}function m(e){try{let t=r[e];if(!t){console.error(`[NQTR] Activity ${e} not found`);return}return t}catch(t){console.error(`[NQTR] Error while getting Activity ${e}`,t);return}}var o={};function n(e){if(Array.isArray(e)){e.forEach(t=>n(t));return}o[e.id]&&console.warn(`[NQTR] Commitment id ${e.id} already exists, it will be overwritten`),o[e.id]=e;}var i={};function c(e){if(Array.isArray(e)){e.forEach(t=>c(t));return}i[e.id]&&console.warn(`[NQTR] Quest id ${e.id} already exists, it will be overwritten`),i[e.id]=e;}var f={};function s(e){if(Array.isArray(e)){e.forEach(t=>s(t));return}f[e.id]&&console.warn(`[NQTR] Room id ${e.id} already exists, it will be overwritten`),f[e.id]=e;}export{m as getActivityById,a as saveActivity,n as saveCommitment,c as saveQuest,s as saveRoom};//# sourceMappingURL=index.mjs.map
|
|
2
2
|
//# sourceMappingURL=index.mjs.map
|
package/dist/index.d.mts
CHANGED
|
@@ -22,12 +22,12 @@ import { saveQuest } from './decorators/QuestDecorator.mjs';
|
|
|
22
22
|
import { saveRoom } from './decorators/RoomDecorator.mjs';
|
|
23
23
|
export { default as ActivityInterface } from './interface/ActivityInterface.mjs';
|
|
24
24
|
export { default as ActivityProps } from './interface/ActivityProps.mjs';
|
|
25
|
-
export { C as CommitmentInterface, L as LocationInterface, M as MapInterface, R as RoomInterface } from './RoomInterface-
|
|
25
|
+
export { C as CommitmentInterface, L as LocationInterface, M as MapInterface, R as RoomInterface } from './RoomInterface-DURfkQ7u.mjs';
|
|
26
26
|
export { default as CommitmentProps } from './interface/CommitmentProps.mjs';
|
|
27
27
|
export { default as LocationBaseModelProps } from './interface/navigation/LocationBaseModelProps.mjs';
|
|
28
28
|
export { default as MapBaseModelProps } from './interface/navigation/MapBaseModelProps.mjs';
|
|
29
29
|
export { default as RoomBaseModelProps } from './interface/navigation/RoomBaseModelProps.mjs';
|
|
30
|
-
export { Q as QuestInterface, a as QuestsRequiredType, S as StageInterface } from './StageInterface-
|
|
30
|
+
export { Q as QuestInterface, a as QuestsRequiredType, S as StageInterface } from './StageInterface-DX74DUxG.mjs';
|
|
31
31
|
export { default as QuestProps } from './interface/quest/QuestProps.mjs';
|
|
32
32
|
export { default as StageProps } from './interface/quest/StageProps.mjs';
|
|
33
33
|
export { navigator, questsNotebook, routine, timeTracker } from './managers/index.mjs';
|
|
@@ -48,7 +48,7 @@ declare const nqtr: {
|
|
|
48
48
|
getActivityById: typeof getActivityById;
|
|
49
49
|
saveActivity: typeof saveActivity;
|
|
50
50
|
saveCommitment: typeof saveCommitment;
|
|
51
|
-
|
|
51
|
+
saveQuest: typeof saveQuest;
|
|
52
52
|
saveRoom: typeof saveRoom;
|
|
53
53
|
ActivityBaseModel: typeof ActivityBaseModel;
|
|
54
54
|
ActivityStoredClass: typeof ActivityStoredClass;
|
|
@@ -60,10 +60,10 @@ declare const nqtr: {
|
|
|
60
60
|
MapStoredClass: typeof MapStoredClass;
|
|
61
61
|
RoomBaseModel: typeof RoomBaseModel;
|
|
62
62
|
RoomStoredClass: typeof RoomStoredClass;
|
|
63
|
-
|
|
63
|
+
QuestBaseModel: typeof QuestBaseModel;
|
|
64
64
|
QuestStoredClass: typeof QuestStoredClass;
|
|
65
|
-
|
|
65
|
+
StageBaseModel: typeof StageBaseModel;
|
|
66
66
|
StageStoredClass: typeof StageStoredClass;
|
|
67
67
|
};
|
|
68
68
|
|
|
69
|
-
export { ActivityBaseModel, ActivityStoredClass, CommitmentBaseModel, CommitmentStoredClass, LocationBaseModel, LocationStoredClass, MapBaseModel, MapStoredClass, QuestBaseModel
|
|
69
|
+
export { ActivityBaseModel, ActivityStoredClass, CommitmentBaseModel, CommitmentStoredClass, LocationBaseModel, LocationStoredClass, MapBaseModel, MapStoredClass, QuestBaseModel, QuestStoredClass, RoomBaseModel, RoomStoredClass, StageBaseModel, StageStoredClass, nqtr as default, getActivityById, saveActivity, saveCommitment, saveQuest, saveRoom };
|
package/dist/index.d.ts
CHANGED
|
@@ -22,12 +22,12 @@ import { saveQuest } from './decorators/QuestDecorator.js';
|
|
|
22
22
|
import { saveRoom } from './decorators/RoomDecorator.js';
|
|
23
23
|
export { default as ActivityInterface } from './interface/ActivityInterface.js';
|
|
24
24
|
export { default as ActivityProps } from './interface/ActivityProps.js';
|
|
25
|
-
export { C as CommitmentInterface, L as LocationInterface, M as MapInterface, R as RoomInterface } from './RoomInterface-
|
|
25
|
+
export { C as CommitmentInterface, L as LocationInterface, M as MapInterface, R as RoomInterface } from './RoomInterface-CdAM_q7P.js';
|
|
26
26
|
export { default as CommitmentProps } from './interface/CommitmentProps.js';
|
|
27
27
|
export { default as LocationBaseModelProps } from './interface/navigation/LocationBaseModelProps.js';
|
|
28
28
|
export { default as MapBaseModelProps } from './interface/navigation/MapBaseModelProps.js';
|
|
29
29
|
export { default as RoomBaseModelProps } from './interface/navigation/RoomBaseModelProps.js';
|
|
30
|
-
export { Q as QuestInterface, a as QuestsRequiredType, S as StageInterface } from './StageInterface-
|
|
30
|
+
export { Q as QuestInterface, a as QuestsRequiredType, S as StageInterface } from './StageInterface-DX74DUxG.js';
|
|
31
31
|
export { default as QuestProps } from './interface/quest/QuestProps.js';
|
|
32
32
|
export { default as StageProps } from './interface/quest/StageProps.js';
|
|
33
33
|
export { navigator, questsNotebook, routine, timeTracker } from './managers/index.js';
|
|
@@ -48,7 +48,7 @@ declare const nqtr: {
|
|
|
48
48
|
getActivityById: typeof getActivityById;
|
|
49
49
|
saveActivity: typeof saveActivity;
|
|
50
50
|
saveCommitment: typeof saveCommitment;
|
|
51
|
-
|
|
51
|
+
saveQuest: typeof saveQuest;
|
|
52
52
|
saveRoom: typeof saveRoom;
|
|
53
53
|
ActivityBaseModel: typeof ActivityBaseModel;
|
|
54
54
|
ActivityStoredClass: typeof ActivityStoredClass;
|
|
@@ -60,10 +60,10 @@ declare const nqtr: {
|
|
|
60
60
|
MapStoredClass: typeof MapStoredClass;
|
|
61
61
|
RoomBaseModel: typeof RoomBaseModel;
|
|
62
62
|
RoomStoredClass: typeof RoomStoredClass;
|
|
63
|
-
|
|
63
|
+
QuestBaseModel: typeof QuestBaseModel;
|
|
64
64
|
QuestStoredClass: typeof QuestStoredClass;
|
|
65
|
-
|
|
65
|
+
StageBaseModel: typeof StageBaseModel;
|
|
66
66
|
StageStoredClass: typeof StageStoredClass;
|
|
67
67
|
};
|
|
68
68
|
|
|
69
|
-
export { ActivityBaseModel, ActivityStoredClass, CommitmentBaseModel, CommitmentStoredClass, LocationBaseModel, LocationStoredClass, MapBaseModel, MapStoredClass, QuestBaseModel
|
|
69
|
+
export { ActivityBaseModel, ActivityStoredClass, CommitmentBaseModel, CommitmentStoredClass, LocationBaseModel, LocationStoredClass, MapBaseModel, MapStoredClass, QuestBaseModel, QuestStoredClass, RoomBaseModel, RoomStoredClass, StageBaseModel, StageStoredClass, nqtr as default, getActivityById, saveActivity, saveCommitment, saveQuest, saveRoom };
|