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 { CharacterInterface, CachedMap } from '@drincs/pixi-vn'; import { StoredClassModel } from '@drincs/pixi-vn/storage'; 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; }; 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 namespace RegisteredActivities { /** * Save an activity in the registered activities. If the activity already exists, it will be overwritten. * @param activity The activity to save. * @returns */ function add(activities: ActivityInterface | ActivityInterface[]): void; /** * Get an activity by its id. * @param id The id of the activity. * @returns The activity or undefined if not found. */ function get(id: string): ActivityInterface | undefined; /** * Get a list of all activities registered. * @returns An array of activities. */ function values(): ActivityInterface[]; /** * Check if an activity is registered. * @param id The id of the activity. * @returns True if the activity is registered, false otherwise. */ function has(id: string): boolean; } /** * A Map that contains all commitments registered and available to be used. * The key is the id of the commitment and the value is the commitment itself. */ declare const registeredCommitments: CachedMap; declare const fixedCommitments: CachedMap; declare namespace RegisteredCommitments { /** * Save a commitment in the registered commitments. If the commitment already exists, it will be overwritten. * @param commitment The commitment to save. * @returns */ function add(commitments: CommitmentInterface | CommitmentInterface[]): void; /** * Get a commitment by its id. * @param id The id of the commitment. * @returns The commitment or undefined if not found. */ function get(id: string): CommitmentInterface | undefined; /** * Get a list of all commitments registered. * @returns An array of commitments. */ function values(): CommitmentInterface[]; /** * Check if a commitment is registered. * @param id The id of the commitment. * @returns True if the commitment is registered, false otherwise. */ function has(id: string): boolean; } declare namespace RegisteredLocations { /** * Save a location in the registered locations. If the location already exists, it will be overwritten. * @param location The location to save. * @returns */ function add(location: LocationInterface | LocationInterface[]): void; /** * Get a location by its id. * @param id The id of the location. * @returns The location or undefined if not found. */ function get(id: string): LocationInterface | undefined; /** * Get a list of all locations registered. * @returns An array of locations. */ function values(): LocationInterface[]; /** * Check if a location is registered. * @param id The id of the location. * @returns True if the location is registered, false otherwise. */ function has(id: string): boolean; } declare namespace RegisteredMaps { /** * Save a map in the registered maps. If the map already exists, it will be overwritten. * @param map The map to save. * @returns */ function add(map: MapInterface | MapInterface[]): void; /** * Get a map by its id. * @param id The id of the map. * @returns The map or undefined if not found. */ function get(id: string): MapInterface | undefined; /** * Get a list of all maps registered. * @returns An array of maps. */ function values(): MapInterface[]; /** * Check if a map is registered. * @param id The id of the map. * @returns True if the map is registered, false otherwise. */ function has(id: string): boolean; } declare namespace RegisteredQuest { /** * Save a quest in the registered quests. If the quest already exists, it will be overwritten. * @param quest The quest to save. * @returns */ function add(quests: QuestInterface | QuestInterface[]): void; /** * Get a quest by its id. * @param id The id of the quest. * @returns The quest or undefined if not found. */ function get(id: string): QuestInterface | undefined; /** * Get a list of all quests registered. * @returns An array of quests. */ function values(): QuestInterface[]; /** * Check if a quest is registered. * @param id The id of the quest. * @returns True if the quest is registered, false otherwise. */ function has(id: string): boolean; } declare namespace RegisteredRooms { /** * Save a room in the registered rooms, and their location and map if they are not already registered. * If the room already exists, it will be overwritten. * @param room The room to save. * @returns */ function add(room: RoomInterface | RoomInterface[]): void; /** * Get a room by its id. * @param id The id of the room. * @returns The room or undefined if not found. */ function get(id: string): RoomInterface | undefined; /** * Get a list of all rooms registered. * @returns An array of rooms. */ function values(): RoomInterface[]; /** * Check if a room is registered. * @param id The id of the room. * @returns True if the room is registered, false otherwise. */ function has(id: string): boolean; } export { RegisteredActivities, RegisteredCommitments, RegisteredLocations, RegisteredMaps, RegisteredQuest as RegisteredQuests, RegisteredRooms, fixedCommitments, registeredCommitments };