import { OnRunProps as OnRunProps$1, ActivityInterface as ActivityInterface$1, CommitmentInterface as CommitmentInterface$1, LocationInterface as LocationInterface$1, MapInterface as MapInterface$1, RoomInterface as RoomInterface$1, QuestInterface as QuestInterface$1, StageInterface as StageInterface$1 } from '@drincs/nqtr'; import { StoredClassModel } from '@drincs/pixi-vn/storage'; import { CharacterInterface } from '@drincs/pixi-vn'; interface DateSchedulingInterface { /** * The start date. If the item hasn't started yet, it will be hidden. * If you set it to 3, the item will be hidden on dates 1 and 2 and will be shown starting on date 3. */ from: number; /** * The date when the item ends. If the item is ended yet, it will be deleted or hidden. * If you set { from: 0, to: 3 }, the item will be shown into dates 1 and 2 and will be deleted or hidden from date 3. * @default undefined */ to?: number; } interface TimeSchedulingInterface { /** * The time when the item starts. If the item is not started yet, it will be hidden. * If you set 3, the item will be hidden into times 1 and 2, and will be shown from time 3. */ from: number; /** * The time when the item ends. If the item is ended yet, it will be hidden. * If you set 3, the item will be shown into times 1 and 2 and will be hidden from time 3. * @default timeTracker.dayEndTime + 1 */ to?: number; } interface ActiveScheduling { /** * Time slot in which activity/commitment will be active. */ readonly timeSlot?: TimeSchedulingInterface[] | TimeSchedulingInterface; /** * Used to schedule what date it will be added and removed. */ readonly dateScheduling?: DateSchedulingInterface; } type ExecutionType = "automatic" | "interaction"; type OnRunProps = OnRunProps$1; /** * The function that is called when the class is runned. */ type OnRunEvent = (item: T, props: OnRunProps) => any | Promise; type OnRunAsyncFunction = (props: OnRunProps) => Promise; type QuestsRequiredType = { quest: QuestInterface; stageNumber: number; }; type TimeSlotInterface = { name: string; startTime: number; }; /** * Time Settings, which can be set using {@link timeTracker.editSettings} */ type TimeSettings = { /** * Minimum time of the day * @default 0 */ dayStartTime?: number; /** * Maximum time of the day * @default 24 */ dayEndTime?: number; /** * Default time spent * @default 1 */ defaultTimeSpent?: number; /** * Time slots * @default [] * @example * ```ts * [ * { name: 'Morning', startTime: 5 }, * { name: 'Afternoon', startTime: 12 }, * { name: 'Evening', startTime: 18 }, * { name: 'Night', startTime: 22 } * ] */ timeSlots?: TimeSlotInterface[]; /** * Week length * @default 7 */ weekLength?: number; /** * Weekend start day. For example, if the real life weekend starts on Saturday, then the value should be 6 * @default weekLength - 1 */ weekendStartDay?: number; /** * Week days name * @param weekDayNumber The current week day number (from: 0 - to: {@link weekLength} - 1). * @returns The name of the week day. * @example * ```ts * (weekDayNumber: number) => { * const weekDaysNames = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']; * return weekDaysNames[weekDayNumber]; * } * ``` */ getDayName?: (weekDayNumber: number) => string; }; interface ActivityInterface extends ActivityBaseInternalInterface, ActivityInterface$1 { } interface ActivityBaseInternalInterface extends ActiveScheduling { /** * The id of the activity/commitment. */ readonly id: string; /** * The function that is called when the activity/commitment is runned. */ readonly run: OnRunAsyncFunction; /** * Whether the activity/commitment is a deadline, so it will then be removed or hidden. * * It **depends only on the date**, not the time. So if you set { dateScheduling: { from: 0, to: 3 }, timeSlot { from: 10, to: 20 } } the activity/commitment hidden or deleted on date 3 at 0. */ readonly expired: boolean; /** * Whether the activity/commitment is active, so it will be shown in the routine and can be runned. * @param options The options to check if the activity/commitment is active. */ isActive(options?: ActiveScheduling): boolean; } interface CommitmentInterface extends CommitmentBaseInternalInterface, CommitmentInterface$1 { } interface CommitmentBaseInternalInterface extends ActivityBaseInternalInterface { /** * The character or characters that are in the commitment and so in the room. */ readonly characters: CharacterInterface[]; /** * Execution type. If is "automatic" the onRun() runned automatically when the palayer is in the room. If is "interaction" the player must interact with the character to run the onRun() function. * If you set "automatic" remember to remove the commitment when it is no longer needed, because otherwise it repeats itself every time. */ executionType: ExecutionType; /** * The priority. The higher the number, the higher the priority. * To ensure that a character is not in 2 places at the same time, if there are 2 or more valid commits at the same time and with the same character, the one with the highest priority will be chosen. */ priority: number; } interface NavigationAbstractInterface extends StoredClassModel { /** * Connects the activity to the class. * @param activity The activity to connect to the class. * @param options * @returns */ addActivity(activity: ActivityInterface, options?: ActiveScheduling): void; /** * Disconnects the activity from the class. * @param activity The activity to disconnect from the class. * @param options */ removeActivity(activity: ActivityInterface | string): void; /** * Removes the useless activities. */ clearExpiredActivities(): void; /** * All the ids of the activities associated with this class. Compared to {@link activities}, they are not filtered based on their scheduling. */ readonly activitiesIds: string[]; /** * The activities associated with this class, filtered based on their scheduling. */ activities: ActivityInterface[]; } interface LocationInterface extends LocationInternalInterface, LocationInterface$1 { } interface LocationInternalInterface extends NavigationAbstractInterface { /** * The id of the location. */ readonly id: string; /** * The map where the location is. */ readonly map: MapInterface; /** * Get all rooms in the location. * @returns The rooms in the location. */ readonly rooms: RoomInterface[]; } interface MapInterface extends MapBaseInternalInterface, MapInterface$1 { } interface MapBaseInternalInterface extends NavigationAbstractInterface { /** * The id of the map. */ readonly id: string; /** * Get all locations in the map. * @returns The locations in the map. */ readonly locations: LocationInterface[]; } interface RoomInterface extends RoomBaseInternalInterface, RoomInterface$1 { } interface RoomBaseInternalInterface extends NavigationAbstractInterface { /** * The id of the room. */ readonly id: string; /** * The location where the room is. */ readonly location: LocationInterface; /** * Connects the commitment to the class. * @param commitment The commitment to connect to the class. * @param options * @returns */ addCommitment(commitment: CommitmentInterface, options?: ActiveScheduling): void; /** * Disconnects the commitment from the class. * @param commitment The commitment to disconnect from the class. * @param options */ removeCommitment(commitment: CommitmentInterface | string): void; /** * Get the character commitments of the room. */ readonly routine: CommitmentInterface[]; /** * Get the characters in the room. */ readonly characters: CharacterInterface[]; /** * Get the functions that will be executed when the room is visited. */ readonly automaticFunctions: OnRunAsyncFunction[]; } interface QuestInterface extends QuestBaseInternalInterface, QuestInterface$1 { } interface QuestBaseInternalInterface { /** * The id of the quest. */ readonly id: string; /** * The stages of the quest. */ readonly stages: StageInterface[]; /** * The index of the current stage. */ currentStageIndex?: number; /** * The current stage. */ readonly currentStage?: StageInterface; /** * If the quest is started. */ readonly started: boolean; /** * If the quest is started and not completed and not failed. */ readonly inProgress: boolean; /** * If the quest is completed. */ readonly completed: boolean; /** * If the quest is failed. */ readonly failed: boolean; /** * The function that will be called when the quest starts. */ readonly onStart?: OnRunEvent; /** * @deprecated Use {@link onContinue} instead. The function that will be called when the quest goes to the next stage. */ readonly onNextStage?: OnRunEvent; /** * The function that will be called when the quest goes to the next stage. */ readonly onContinue?: OnRunEvent; /** * Start the quest. * @param props The properties for the start stage. If you not want to pass any property, you can pass an {}. * @returns */ start(props: OnRunProps$1): Promise; /** * Go to the next stage if the current stage is completed. * If you want to force the change of stage, use {@link advanceUnconditionally}. * @param props The properties. If you not want to pass any property, you can pass an {}. * @returns true if the stage was changed, false otherwise. */ advanceIfCompleted(props: OnRunProps$1): Promise; /** * Complete the current stage and go to the next stage with {@link advanceUnconditionally}. * If you want to go to the next stage only if the current stage is completed, use {@link advanceIfCompleted}. * @param props The properties. If you not want to pass any property, you can pass an {}. * @returns true if the stage was changed, false otherwise. */ continue(props: OnRunProps$1): Promise; /** * Ignore the completed state of the current stage and go to the next stage without checking if the current stage is completed. * If you want to go to the next stage only if the current stage is completed, use {@link advanceIfCompleted}. * @param props The properties. If you not want to pass any property, you can pass an {}. * @returns returns true if the stage was changed, false otherwise. */ advanceUnconditionally(props: OnRunProps$1): Promise; /** * If the current stage must start. It is true if the current stage is not started, can start and not completed. */ readonly currentStageMustStart: boolean; /** * Start the current stage. This is a system function, do not use it directly. * @param props The properties for the start stage. If you not want to pass any property, you can pass an {}. */ startCurrentStage(props: OnRunProps$1): Promise; } interface StageInterface extends StageBaseInternalInterface, StageInterface$1 { } interface StageBaseInternalInterface { /** * The id of the stage. */ readonly id: string; /** * The function that will be called when the stage starts. */ readonly onStart?: OnRunEvent; /** * The function that will be called when the stage ends. */ readonly onEnd?: OnRunEvent; /** * Check if the flag and goals are completed. * You can force the completion of the stage by setting the completed property to true. * @example * ```ts * export default class Stage extends StageStoredClass { * override get completed(): boolean { * if (super.completed) { * return true; * } * if (this.flags.length > 0) { * if (!this.flags.every((flag) => storage.getFlag(flag.flag))) { * return false; * } * return true; * } * return false; * } * override set completed(value: boolean) { * super.completed = value; * } * } * ``` */ completed: boolean; /** * If the stage is started. */ started: boolean; /** * The date when the stage starts. */ readonly startDate?: number; /** * Check if the stage can start. * @example * ```ts * export default class Stage extends StageStoredClass { * override get canStart(): boolean { * if (this.flagsRequired.length > 0 && !this.flagsRequired.every((flag) => storage.getFlag(flag.flag))) { * return false; * } * return super.canStart; * } * } * ``` */ readonly canStart: boolean; /** * The function that will be called when the stage starts. */ start(props: OnRunProps$1): Promise; /** * The number of day/date required to start the stage. */ readonly deltaDateRequired: number; /** * The list of quests required to start the stage. */ readonly questsRequired: QuestsRequiredType[]; } declare class NavigatorHandler { get rooms(): RoomInterface[]; get locations(): LocationInterface[]; get maps(): MapInterface[]; get currentRoomId(): string | undefined; get currentRoom(): RoomInterface | undefined; set currentRoom(room: RoomInterface | string); get currentLocation(): LocationInterface | undefined; get currentMap(): MapInterface | undefined; /** * Clear all the expired activities. */ clearExpiredActivities(): void; } declare class QuestHandler { /** * The quests registered in the game. */ get quests(): QuestInterface[]; /** * The quests that are started, so they are in progress or completed or failed. */ get startedQuests(): QuestInterface[]; /** * The quests that are in progress. */ get inProgressQuests(): QuestInterface[]; /** * The quests that are completed. */ get completedQuests(): QuestInterface[]; /** * The quests that are failed. */ get failedQuests(): QuestInterface[]; /** * The quests that are not started. */ get notStartedQuests(): QuestInterface[]; /** * Get the quest by the id. * @param id The id of the quest. * @returns The quest with the id. */ find(id: string): QuestInterface | undefined; /** * Start the quests that must start on the current stage. */ startsStageMustBeStarted(props: OnRunProps$1): Promise; } declare class RoutineHandler { /** * Get the temporary commitments by its id. * @returns The temporary commitments. */ private get temporaryRoutine(); get commitmentsIds(): string[]; /** * This feature adds the commitments during the game session. * @param commitment The commitment or commitments to add. * @param roomId The id of the room where the commitment is. */ add(commitment: CommitmentInterface[] | CommitmentInterface, roomId: string, options?: ActiveScheduling): void; /** * Get the commitments added during the game session. * @param id The id of the commitment. * @returns The commitment or undefined if not found. */ find(id: string): CommitmentInterface | undefined; /** * Remove the commitments added during the game session. * @param commitment The commitment or commitment id to remove. * @param roomId The id of the room where the commitment is. */ remove(commitment: CommitmentInterface | string, roomId?: string): void; /** * Clear all the expired commitments. */ clearExpiredRoutine(): void; get characterCommitments(): { [character: string]: [CommitmentInterface, string]; }; /** * Get the current commitments. The hidden commitments are not included. * In case there is a character who has two or more commitments at the same time, will be selected the commitment with the highest priority. * Higher priority commitments are calculated using the following steps: * 1. The commitments that have Commitments BaseModel.priority set to a higher value will be selected first. * 2. If there are commitments with the same priority, the commitments that are not fixed will be selected first. * 3. If there are commitments with the same priority and the same fixed status, priority will be given to the commitment with a lower index. * @returns The current commitments. */ get currentRoutine(): CommitmentInterface[]; get roomCommitments(): { [roomId: string]: CommitmentInterface[]; }; /** * Get the character commitment. * @param character The character. * @returns The commitment or undefined if not found. */ getCommitmentByCharacter(character: CharacterInterface): CommitmentInterface | undefined; } declare class TimeHandler { initialize(settings: TimeSettings): void; get dayStartTime(): number; get dayEndTime(): number; get defaultTimeSpent(): number; get timeSlots(): TimeSlotInterface[]; get weekLength(): number; get weekendStartDay(): number; /** * Week days name * @param weekDayNumber The current week day number (from: 0 - to: {@link weekLength} - 1). * @returns The name of the week day. * @example * ```ts * (weekDayNumber: number) => { * const weekDaysNames = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']; * return weekDaysNames[weekDayNumber]; * } * ``` */ get getDayName(): ((weekDayNumber: number) => string) | undefined; /** * Get the current time. Time is a numeric variable used to determine and manage time during a day/date. * It's recommended to use currentTime as if it were the current time. If you also want to manage minutes, you can use a float value. */ get currentTime(): number; set currentTime(value: number | undefined); /** * Get the current date. Date is a numeric variable used to determine and manage the number of days passed. * It's recommended to use currentDate as if it were the current day. */ get currentDate(): number; set currentDate(value: number | undefined); /** * If the current day is greater than or equal to the weekend start day, then it will return true. */ get isWeekend(): boolean; /** * Get the current week day number (from: 1 - to: {@link weekLength}). * For example, if the week length is 7 and the current day is 10, then the result will be 4. */ get currentWeekDayNumber(): number; /** * Get the current week day name. If the week days names are not defined, then it will return undefined. * 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'. * @default "" */ get currentDayName(): string; /** * Get the current {@link timeSlots} index. * You can use this property to create "Image that changes based on the time period": * @example * ```tsx * import { weekLength } from '@drincs/nqtr'; * * function changeBackground() { * return ( * * ) * } */ get currentTimeSlot(): number; /** * This function will increase the current time by the given time spent. * If the new time is greater than or equal to the max day times, then it will increase the day and set the new time. * @param delta is the time spent in times (default: {@link defaultTimeSpent}) * @returns currentTimeSlot.currentTime */ increaseTime(delta?: number): number; /** * This function will increase the current date by the given delta. * @param delta is the number of days to increase (default: 1) * @param time is the time of the new day (default: {@link dayStartTime}) * @returns timeTracker.currentDate */ increaseDate(delta?: number, time?: number): number; /** * This function will check if the current time is between the given times. * @param fromTime the starting time. If the {@link currentTime} is equal to this time, the function will return true. * @param toTime the ending time. * @returns true if the current time is between the given times, otherwise false. */ nowIsBetween(fromTime: number | undefined, toTime: number | undefined): boolean; } declare const timeTracker: TimeHandler; declare const navigator: NavigatorHandler; declare const routine: RoutineHandler; declare const questsNotebook: QuestHandler; export { navigator, questsNotebook, routine, timeTracker };