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.

66 lines (64 loc) 3.01 kB
interface WaitOptions { hours?: number; days?: number; } interface NqtrHandlerOptions { /** * Custom time converter function to convert time strings to numbers. The default implementation converts "HH:MM" format to hours as a number (e.g. "01:30" => 1.5). * @default (time: string) => Number(time.replace(":", ".")) * @param time Time string in the format "HH:MM" * @returns Time in hours as a number (e.g. "01:30" => 1.5) */ timeConverter?: (time: string) => number; /** * Custom date converter function to convert date strings to numbers. The default implementation converts a string to a number using `Number()`. * @default (date: string) => Number(date) * @param date Date string * @returns Date as a number */ dateConverter?: (date: string) => number; /** * Custom wait function to replace the default time and date increasing logic. The default implementation increases time and date based on the provided delta or default values. * @default waitInternal * @param delta An object containing hours and/or days to increase, or a number representing hours to increase. */ wait?: (delta?: WaitOptions | number) => void; /** * Known activity IDs — e.g. `nqtrActivityIds` from the file generated by the Vite plugin. * When provided, the Ink hashtag validation does a runtime membership check instead of accepting any string. */ activityIds?: readonly string[]; /** * Known commitment IDs — e.g. `nqtrCommitmentIds` from the file generated by the Vite plugin. * When provided, the Ink hashtag validation does a runtime membership check instead of accepting any string. */ commitmentIds?: readonly string[]; /** * Known quest IDs — e.g. `nqtrQuestIds` from the file generated by the Vite plugin. * When provided, the Ink hashtag validation does a runtime membership check instead of accepting any string. */ questIds?: readonly string[]; /** * Known room IDs — e.g. `nqtrRoomIds` from the file generated by the Vite plugin. * When provided, the Ink hashtag validation does a runtime membership check instead of accepting any string. */ roomIds?: readonly string[]; } /** * Registers all NQTR-specific Ink hashtag command handlers for managing rooms, time, date, * activities, routines, and quests. Supports commands like `enter room`, `set time`, `set date`, * `add/remove activity`, `add/remove routine`, `start/continue quest`, and `wait`. * @example * ```ts * import { createNqtrHandler } from '@drincs/nqtr/ink'; * * createNqtrHandler(); * ``` * @param options Optional configuration for time/date conversion, wait logic, and known entity IDs. */ declare function createNqtrHandler(options?: NqtrHandlerOptions): void; /** * @deprecated Use {@link createNqtrHandler} instead. */ declare function nqtrHandler(options?: NqtrHandlerOptions): void; export { createNqtrHandler, nqtrHandler };