@drincs/nqtr
Version:
A complete system introducing the concepts of location, time and event, producing the framework of a not-quite-point-and-click adventure game.
1 lines • 24.3 kB
Source Map (JSON)
{"version":3,"sources":["../../src/constants.ts","../../src/managers/TimeManagerSettings.ts","../../src/managers/TimeManager.ts","../../src/managers/index.ts","../../src/classes/ActivityStoredClass.ts","../../src/classes/CommitmentStoredClass.ts","../../src/classes/CommitmentBaseModel.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","ACTIVITY_CATEGORY","ActivityStoredClass","StoredClassModel","id","_onRun","props","category","COMMITMENT_CATEGORY","CommitmentStoredClass","_characters","_room","onRun","CommitmentBaseModel","character","room","getFlag"],"mappings":"+DACO,IAAMA,CAAAA,CAAgB,+BCC7B,IAAqBC,CAAAA,CAArB,KAAiE,CAC7D,OAAO,YAAsB,CAC7B,CAAA,OAAO,YAAsB,EAC7B,CAAA,OAAO,gBAA2B,CAAA,CAAA,CAClC,OAAO,SAAA,CAA0B,EACjC,CAAA,OAAO,WAAqB,CAC5B,CAAA,OAAO,gBAA0B,IAAK,CAAA,UAAA,CAAa,EACnD,OAAO,aAAA,CAA0B,EACrC,CAAA,CCJA,IAAqBC,CAArB,CAAA,KAAiC,CAC7B,UAAWC,CAAAA,CAAAA,CAAwB,CAC/B,GAAM,CACF,WAAA,CAAAC,EAAc,CACd,CAAA,WAAA,CAAAC,EAAc,EACd,CAAA,gBAAA,CAAAC,EAAmB,CACnB,CAAA,SAAA,CAAAC,EAAY,EAAC,CACb,WAAAC,CAAa,CAAA,CAAA,CACb,gBAAAC,CAAkBD,CAAAA,CAAAA,CAAa,EAC/B,aAAAE,CAAAA,CAAAA,CAAgB,EACpB,CAAIP,CAAAA,CAAAA,CACJF,EAAoB,WAAcG,CAAAA,CAAAA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'___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 { StoredClassModel } from \"@drincs/pixi-vn\";\nimport { ActivityInterface } from \"../interface\";\nimport { ActivityBaseInternalInterface } from \"../interface/ActivityInterface\";\nimport { timeTracker } from \"../managers\";\nimport { OnRunEvent, OnRunProps } from \"../types/OnRunEvent\";\n\nconst ACTIVITY_CATEGORY = \"__nqtr-activity__\";\nexport default class ActivityStoredClass<OnRunEventType = ActivityInterface>\n extends StoredClassModel\n implements ActivityBaseInternalInterface\n{\n constructor(\n id: string,\n private readonly _onRun: OnRunEvent<OnRunEventType>,\n props: {\n fromHour?: number;\n toHour?: number;\n fromDay?: number;\n toDay?: number;\n },\n category: string = ACTIVITY_CATEGORY\n ) {\n super(category, id);\n this._fromHour = props.fromHour;\n this._toHour = props.toHour;\n this._fromDay = props.fromDay;\n this._toDay = props.toDay;\n }\n\n private _fromHour?: number;\n get fromHour(): number | undefined {\n return this._fromHour;\n }\n\n private _toHour?: number;\n get toHour(): number | undefined {\n return this._toHour;\n }\n\n private _fromDay?: number;\n get fromDay(): number | undefined {\n return this._fromDay;\n }\n\n private _toDay?: number;\n get toDay(): number | undefined {\n return this._toDay;\n }\n\n get run(): (props: OnRunProps) => void {\n return (props) => this._onRun(this as any, props);\n }\n\n get expired(): boolean {\n if (this.toDay && this.toDay <= timeTracker.currentDay) {\n return true;\n }\n return false;\n }\n\n get isActive(): boolean {\n if (this.fromDay && this.fromDay > timeTracker.currentDay) {\n return false;\n }\n if (this.toDay && this.toDay < timeTracker.currentDay) {\n return false;\n }\n if (!timeTracker.nowIsBetween(this.fromHour, this.toHour)) {\n return false;\n }\n return true;\n }\n}\n","import { CharacterInterface } from \"@drincs/pixi-vn\";\nimport { CommitmentInterface, RoomInterface } from \"../interface\";\nimport { CommitmentBaseInternalInterface } from \"../interface/CommitmentInterface\";\nimport { ExecutionType } from \"../types\";\nimport { OnRunEvent } from \"../types/OnRunEvent\";\nimport ActivityStoredClass from \"./ActivityStoredClass\";\n\nconst COMMITMENT_CATEGORY = \"__nqtr-commitment__\";\nexport default class CommitmentStoredClass\n extends ActivityStoredClass<CommitmentInterface>\n implements CommitmentBaseInternalInterface\n{\n constructor(\n id: string,\n private readonly _characters: CharacterInterface[],\n private readonly _room: RoomInterface,\n onRun: OnRunEvent<CommitmentInterface> | undefined,\n props: {\n executionType?: ExecutionType;\n priority?: number;\n fromHour?: number;\n toHour?: number;\n fromDay?: number;\n toDay?: number;\n }\n ) {\n onRun = onRun || (() => {});\n super(id, onRun, props, COMMITMENT_CATEGORY);\n this.defaultExecutionType = props.executionType || \"interaction\";\n this.defaultPriority = props.priority;\n }\n private readonly defaultExecutionType: ExecutionType;\n private readonly defaultPriority?: number;\n\n get characters(): CharacterInterface[] {\n return this._characters;\n }\n\n get room(): RoomInterface {\n return this._room;\n }\n\n get executionType(): ExecutionType {\n return this.getStorageProperty<ExecutionType>(\"executionType\") || this.defaultExecutionType;\n }\n set executionType(value: ExecutionType) {\n this.setStorageProperty(\"executionType\", value);\n }\n\n get priority(): number {\n return this.getStorageProperty<number>(\"priority\") || this.defaultPriority || 0;\n }\n set priority(value: number) {\n this.setStorageProperty(\"priority\", value);\n }\n}\n","import { CharacterInterface, getFlag } from \"@drincs/pixi-vn\";\nimport { CommitmentProps, RoomInterface } from \"../interface\";\nimport { timeTracker } from \"../managers\";\nimport CommitmentStoredClass from \"./CommitmentStoredClass\";\n\n/**\n * The base model of a commitment. I suggest you extend this class to create your own commitment model.\n * You must use the saveRoom function to save the commitment in the registered commitments.\n * @example\n * ```ts\n * export const mcRoom = new CommitmentBaseModel(\"test\", character, room, {\n * name: \"Test\",\n * image: \"https://image.jpg\",\n * executionType: ExecutionTypeEnum.INTERACTION,\n * onRun: (commitment) => {\n * // Do something\n * }\n * })\n * saveCommitment(mcRoom)\n * ```\n */\nexport default class CommitmentBaseModel extends CommitmentStoredClass {\n /**\n * @param id The id of the commitment, it must be unique.\n * @param character The character or characters that are in the commitment and so in the room.\n * @param room The room where the commitment is.\n * @param props The properties of the commitment.\n */\n constructor(\n id: string,\n character: CharacterInterface | CharacterInterface[] | undefined,\n room: RoomInterface,\n props: CommitmentProps\n ) {\n super(id, character ? (Array.isArray(character) ? character : [character]) : [], room, props.onRun, {\n executionType: props.executionType,\n priority: props.priority,\n fromHour: props.fromHour,\n toHour: props.toHour,\n fromDay: props.fromDay,\n toDay: props.toDay,\n });\n this._name = props.name || \"\";\n this._image = props.image;\n this.defaultDisabled = props.disabled || false;\n this.defaultHidden = props.hidden || false;\n this._icon = props.icon;\n }\n\n private _name: string;\n /**\n * The name of the commitment.\n */\n get name(): string {\n return this._name;\n }\n\n private _image?: string;\n /**\n * The image of the commitment.\n */\n get image(): string | undefined {\n return this._image;\n }\n\n private _icon?: string;\n /**\n * The icon of the commitment.\n */\n get icon(): string | undefined {\n return this._icon;\n }\n\n private defaultDisabled: boolean | string;\n /**\n * Whether is disabled. You can also pass a Pixi'VN flag name.\n */\n get disabled(): boolean {\n let value = this.getStorageProperty<boolean>(\"disabled\") || this.defaultDisabled;\n if (typeof value === \"string\") {\n return getFlag(value);\n }\n return value;\n }\n set disabled(value: boolean | string) {\n this.setStorageProperty(\"disabled\", value);\n }\n\n private defaultHidden: boolean | string;\n /**\n * Whether is hidden. You can also pass a Pixi'VN flag name.\n */\n get hidden(): boolean {\n if (this.fromDay && this.fromDay > timeTracker.currentDay) {\n return true;\n }\n if (!timeTracker.nowIsBetween(this.fromHour, this.toHour)) {\n return true;\n }\n if (!this.expired) {\n return true;\n }\n let value = this.getStorageProperty<boolean>(\"hidden\") || this.defaultHidden;\n if (typeof value === \"string\") {\n return getFlag(value);\n }\n return value;\n }\n set hidden(value: boolean | string) {\n this.setStorageProperty(\"hidden\", value);\n }\n}\n"]}