import type { EntityId } from '../core/types'; import { EventBus } from '../core/EventBus'; import React from 'react'; /** Quest categories */ export type QuestType = 'main' | 'side' | 'daily' | 'weekly' | 'achievement' | 'tutorial' | 'hidden'; /** Quest status */ export type QuestStatus = 'locked' | 'available' | 'active' | 'completed' | 'failed' | 'expired'; /** Objective types */ export type ObjectiveType = 'collect' | 'kill' | 'interact' | 'reach' | 'escort' | 'defend' | 'survive' | 'craft' | 'talk' | 'discover' | 'score' | 'custom'; /** Reward types */ export type RewardType = 'experience' | 'currency' | 'item' | 'skill' | 'reputation' | 'unlock' | 'achievement' | 'custom'; /** Difficulty levels */ export type QuestDifficulty = 'trivial' | 'easy' | 'normal' | 'hard' | 'legendary'; export interface QuestObjective { id: string; type: ObjectiveType; description: string; /** Current progress */ current: number; /** Target value to complete */ target: number; /** Whether this objective is optional */ optional?: boolean; /** Whether this objective is hidden until progress is made */ hidden?: boolean; /** Order for sequential objectives */ order?: number; /** Custom data for objective tracking */ trackingData?: { itemId?: string; enemyType?: string; entityId?: EntityId; locationId?: string; npcId?: string; [key: string]: unknown; }; /** Completion status */ completed: boolean; } export interface QuestReward { id: string; type: RewardType; /** Display name */ name: string; /** Icon URL or icon key */ icon?: string; /** Reward amount (for currency, experience) */ amount?: number; /** Item ID (for item rewards) */ itemId?: string; /** Quantity of items */ quantity?: number; /** Skill ID (for skill unlocks) */ skillId?: string; /** Reputation faction and amount */ reputation?: { factionId: string; amount: number; }; /** What gets unlocked */ unlockId?: string; /** Custom reward data */ customData?: Record; } export interface QuestPrerequisite { type: 'quest' | 'level' | 'item' | 'reputation' | 'skill' | 'time' | 'custom'; /** Quest ID that must be completed */ questId?: string; /** Minimum level required */ level?: number; /** Item that must be possessed */ itemId?: string; /** Minimum reputation with faction */ reputation?: { factionId: string; amount: number; }; /** Skill that must be unlocked */ skillId?: string; /** Time window (for daily/weekly quests) */ timeWindow?: { start: number; end: number; }; /** Custom condition key */ customKey?: string; } export interface Quest { id: string; /** Display name */ name: string; /** Short description shown in quest list */ summary: string; /** Full description with story/context */ description: string; /** Quest category */ type: QuestType; /** Difficulty rating */ difficulty: QuestDifficulty; /** Quest icon */ icon?: string; /** Quest giver NPC ID */ giverNpcId?: string; /** Quest turn-in NPC ID */ turnInNpcId?: string; /** Location hint */ locationHint?: string; /** Level recommendation */ recommendedLevel?: number; /** Objectives to complete */ objectives: QuestObjective[]; /** Rewards on completion */ rewards: QuestReward[]; /** Bonus rewards for optional objectives */ bonusRewards?: QuestReward[]; /** Prerequisites to unlock */ prerequisites: QuestPrerequisite[]; /** Quests that follow this one */ followUpQuests?: string[]; /** Tags for filtering */ tags?: string[]; /** Time limit in seconds (0 = no limit) */ timeLimit?: number; /** Can quest be abandoned? */ canAbandon?: boolean; /** Can quest be repeated? */ repeatable?: boolean; /** Cooldown between repeats (ms) */ repeatCooldown?: number; /** Custom quest data */ metadata?: Record; } export interface QuestState { questId: string; status: QuestStatus; objectives: QuestObjective[]; /** When quest was accepted */ startedAt?: number; /** When quest was completed/failed */ endedAt?: number; /** Time remaining (for timed quests) */ timeRemaining?: number; /** Number of times completed (for repeatable) */ completionCount: number; /** Last completion timestamp */ lastCompletedAt?: number; } export interface QuestJournal { activeQuests: QuestState[]; completedQuests: QuestState[]; failedQuests: QuestState[]; trackedQuestId?: string; } export type QuestEventType = 'quest:unlocked' | 'quest:accepted' | 'quest:objective-progress' | 'quest:objective-completed' | 'quest:completed' | 'quest:failed' | 'quest:abandoned' | 'quest:reward-claimed' | 'quest:tracked'; export interface QuestEvent { type: QuestEventType; questId: string; objectiveId?: string; data?: unknown; timestamp: number; } export declare class QuestManager { private quests; private journal; private events; private playerLevel; private playerItems; private playerSkills; private reputation; private customConditions; constructor(events?: EventBus); registerQuest(quest: Quest): void; registerQuests(quests: Quest[]): void; unregisterQuest(questId: string): void; getQuest(questId: string): Quest | undefined; getAllQuests(): Quest[]; setPlayerLevel(level: number): void; addPlayerItem(itemId: string): void; removePlayerItem(itemId: string): void; addPlayerSkill(skillId: string): void; setReputation(factionId: string, amount: number): void; addReputation(factionId: string, amount: number): void; registerCustomCondition(key: string, condition: () => boolean): void; getQuestState(questId: string): QuestState | undefined; getQuestStatus(questId: string): QuestStatus; getActiveQuests(): QuestState[]; getCompletedQuests(): QuestState[]; getAvailableQuests(): Quest[]; getJournal(): QuestJournal; canUnlockQuest(questId: string): boolean; private checkPrerequisite; acceptQuest(questId: string): boolean; abandonQuest(questId: string): boolean; updateObjectiveProgress(questId: string, objectiveId: string, amount: number): boolean; setObjectiveProgress(questId: string, objectiveId: string, value: number): boolean; completeObjective(questId: string, objectiveId: string): boolean; private checkQuestCompletion; completeQuest(questId: string): boolean; failQuest(questId: string): boolean; private checkQuestUnlocks; private checkFollowUpQuests; getQuestRewards(questId: string): { main: QuestReward[]; bonus: QuestReward[]; } | null; claimRewards(questId: string): QuestReward[] | null; trackQuest(questId: string): void; untrackQuest(): void; getTrackedQuest(): QuestState | undefined; update(deltaMs: number): void; saveState(): QuestJournal; loadState(journal: QuestJournal): void; private emitEvent; subscribe(eventType: QuestEventType, handler: (event: QuestEvent) => void): () => void; } export declare class QuestBuilder { private quest; private objectiveCounter; private rewardCounter; constructor(id: string, name: string); summary(summary: string): this; description(description: string): this; type(type: QuestType): this; difficulty(difficulty: QuestDifficulty): this; icon(icon: string): this; giver(npcId: string): this; turnIn(npcId: string): this; location(hint: string): this; level(level: number): this; timeLimit(seconds: number): this; cannotAbandon(): this; repeatable(cooldownMs?: number): this; tags(tags: string[]): this; followUp(questIds: string[]): this; requireQuest(questId: string): this; requireLevel(level: number): this; requireItem(itemId: string): this; requireReputation(factionId: string, amount: number): this; requireSkill(skillId: string): this; requireCustom(customKey: string): this; private addObjective; collect(itemId: string, amount: number, description: string, optional?: boolean): this; kill(enemyType: string, amount: number, description: string, optional?: boolean): this; interact(entityId: EntityId, description: string, optional?: boolean): this; reach(locationId: string, description: string, optional?: boolean): this; escort(npcId: string, locationId: string, description: string, optional?: boolean): this; defend(seconds: number, description: string, optional?: boolean): this; survive(seconds: number, description: string, optional?: boolean): this; craft(itemId: string, amount: number, description: string, optional?: boolean): this; talk(npcId: string, description: string, optional?: boolean): this; discover(locationId: string, description: string, optional?: boolean): this; score(threshold: number, description: string, optional?: boolean): this; customObjective(type: string, target: number, description: string, data?: Record, optional?: boolean): this; private generateRewardId; rewardXP(amount: number, name?: string): this; rewardCurrency(amount: number, currencyName?: string): this; rewardItem(itemId: string, name: string, quantity?: number, icon?: string): this; rewardSkill(skillId: string, name: string, icon?: string): this; rewardReputation(factionId: string, amount: number, factionName: string): this; rewardUnlock(unlockId: string, name: string, icon?: string): this; rewardAchievement(achievementId: string, name: string, icon?: string): this; bonusXP(amount: number, name?: string): this; bonusItem(itemId: string, name: string, quantity?: number, icon?: string): this; build(): Quest; } export interface QuestListProps { quests: QuestState[]; questDefinitions: Map; trackedId?: string; onSelect?: (questId: string) => void; onTrack?: (questId: string) => void; filter?: QuestType[]; className?: string; style?: React.CSSProperties; } export declare const QuestList: React.FC; export interface QuestTrackerProps { state: QuestState; quest: Quest; showOptional?: boolean; className?: string; style?: React.CSSProperties; } export declare const QuestTracker: React.FC; export declare function createEmptyQuest(id: string, name: string): Quest; export declare const DIFFICULTY_COLORS: Record; export declare const DIFFICULTY_XP_MULTIPLIERS: Record;