UNPKG

@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.

200 lines (193 loc) 8.16 kB
import { C as CommitmentInterface, R as RoomInterface, L as LocationInterface, M as MapInterface } from './RoomInterface-Dh89PtFM.js'; import { OnRunProps } from '@drincs/nqtr'; import { Q as QuestInterface } from './StageInterface-C1Zfcpk3.js'; import { CharacterInterface } from '@drincs/pixi-vn'; import { TimeSettings, ITimeStlot as TimeSlotInterface } from './types/index.js'; declare class TimeManager { 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 ( * <img src={`background-currentTimeSlot.currentTimeSlot.png`} /> * ) * } */ 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 class RoutineManager { get fixedRoutine(): CommitmentInterface[]; /** * Set a commitment as fixed, it will be always available. They cannot be deleted or edit during the game session. */ set fixedRoutine(commitments: CommitmentInterface[]); /** * Get the temporary commitments by its id. * @returns The temporary commitments. */ get temporaryRoutine(): CommitmentInterface[]; get allRoutine(): CommitmentInterface[]; /** * This feature adds the commitments during the game session. * @param commitment The commitment or commitments to add. */ add(commitment: CommitmentInterface[] | CommitmentInterface): 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 commitments to remove. */ remove(commitment: CommitmentInterface[] | CommitmentInterface): void; /** * Clear all the expired commitments. */ clearExpiredRoutine(): void; /** * 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 the character commitment. * @param character The character. * @returns The commitment or undefined if not found. */ getCommitmentByCharacter(character: CharacterInterface): CommitmentInterface | undefined; } declare class QuestManager { /** * 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): Promise<void>; } declare class NavigatorManager { 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 const timeTracker: TimeManager; declare const navigator: NavigatorManager; declare const routine: RoutineManager; declare const questsNotebook: QuestManager; export { NavigatorManager as N, QuestManager as Q, RoutineManager as R, TimeManager as T, navigator as n, questsNotebook as q, routine as r, timeTracker as t };