UNPKG

@peacockproject/core

Version:

Type definitions for Peacock's core.

94 lines (93 loc) 3.31 kB
import type { ChallengeCompletion, CompiledChallengeTreeCategory, CompletionData, GameLocationsData, GameVersion, Hit, OpportunityStatistics, Unlockable, UserCentricContract } from "../types/types"; import type { MasteryData } from "../types/mastery"; import { GetDestinationQuery } from "../types/gameSchemas"; type LegacyData = { [difficulty: string]: { ChallengeCompletion: { ChallengesCount: number; CompletedChallengesCount: number; }; CompletionData: CompletionData; }; }; type GameFacingDestination = { ChallengeCompletion: { ChallengesCount: number; CompletedChallengesCount: number; }; CompletionData: CompletionData; OpportunityStatistics: OpportunityStatistics; LocationCompletionPercent: number; Location: Unlockable; Data?: LegacyData; }; type LocationMissionData = { Location: Unlockable; SubLocation: Unlockable; Missions: Hit[]; SarajevoSixMissions: Hit[]; ElusiveMissions: Hit[]; EscalationMissions: Hit[]; SniperMissions: Hit[]; PlaceholderMissions: Hit[]; CampaignMissions: Hit[]; CompletionData: CompletionData; }; type GameDestination = { ChallengeData: { Children: CompiledChallengeTreeCategory[]; }; DifficultyData: { AvailableDifficultyModes: { Name: string; Available: boolean; }[]; Difficulty: string | undefined; LocationId: string; }; Location: Unlockable; MasteryData: MasteryData | MasteryData[] | Record<string, never>; MissionData: DestinationBaseCompletionData & { SubLocationMissionsData: LocationMissionData[]; }; VRTutorial: { UserCentricContract: UserCentricContract; }; }; type DestinationBaseCompletionData = { ChallengeCompletion: ChallengeCompletion; Location: Unlockable; LocationCompletionPercent: number; OpportunityStatistics: { Completed: number; Count: number; }; }; export declare function getDestinationCompletion(parent: Unlockable, child: Unlockable | undefined, gameVersion: GameVersion, userId: string): DestinationBaseCompletionData; export declare function getCompletionPercent(challengeDone: number, challengeTotal: number, opportunityDone: number, opportunityTotal: number): number; /** * Get the list of destinations used by the `/profiles/page/Destinations` endpoint. * * @param gameVersion * @param userId The user ID. */ export declare function getAllGameDestinations(gameVersion: GameVersion, userId: string): GameFacingDestination[]; /** * Creates the game's LocationsData object, and optionally removes locations * that don't provide a contract creation ID. * * @param gameVersion The game version. * @param excludeIfNoContracts If true, locations that don't support contract * creation will not be returned. * @returns The locations that can be played. */ export declare function createLocationsData(gameVersion: GameVersion, excludeIfNoContracts?: boolean): GameLocationsData; /** * This gets the game-facing data for a destination. * * @param query * @param gameVersion * @param userId */ export declare function getDestination(query: GetDestinationQuery, gameVersion: GameVersion, userId: string): GameDestination; export {};