UNPKG

@peacockproject/core

Version:

Type definitions for Peacock's core.

67 lines (66 loc) 3.54 kB
import { LocationMasteryData, MasteryData, MasteryPackage, UnlockableMasteryData } from "../types/mastery"; import { CompletionData, GameVersion, Unlockable } from "../types/types"; export declare class MasteryService { /** * @Key1 Game version. * @Key2 The parent location Id. * @Value A `MasteryPackage` object. */ protected masteryPackages: Record<GameVersion, Map<string, MasteryPackage>>; /** * @Key1 Game version. * @Key2 Unlockable Id. * @Value A `UnlockableMasteryData` object. */ private unlockableMasteryData; registerMasteryData(masteryPackage: MasteryPackage): void; /** * Generates mastery data in a reverse order. It uses already registered * mastery packages, so MUST be rerun when changing mastery data. * This could be considered redundant, but this allows for faster access to * location and level based on unlockable ID, avoiding big-O operation for `getMasteryForUnlockable`. * @param gameVersions Game version(s) to process. */ rebuildDropIndexes(...gameVersions: GameVersion[]): void; /** * Returns mastery data for unlockable, if there's any * @param unlockable * @param gameVersion */ getMasteryForUnlockable(unlockable: Unlockable, gameVersion: GameVersion): UnlockableMasteryData | undefined; getMasteryDataForSubPackage(locationParentId: string, subPackageId: string, gameVersion: GameVersion, userId: string): MasteryData; /** * Returns mastery data for a location (either a parent or sub-location). For mastery data of a destination, use {@link getMasteryDataForDestination}. * @param locationId The location's ID. * @param gameVersion The game version. * @param userId The user's ID. * @returns The mastery data. */ getMasteryDataForLocation(locationId: string, gameVersion: GameVersion, userId: string): LocationMasteryData; /** * Get generic completion data stored in a user's profile. * @param userId The id of the user. * @param gameVersion The game version. * @param locationParentId The location's parent ID, used for progression storage @since v7.0.0 * @param maxLevel The max level for this progression. * @param levelToXpRequired A function to get the XP required for a level. * @param subPackageId The subpackage id you want. * @param xpPerLevel The amount of XP required to level up, passed to `levelToXpRequired` function. * @returns The completion data, minus any location-specific fields. */ private getGenericCompletionData; /** * Get the completion data for a location. * @param locationParentId The parent Id of the location. * @param subLocationId The id of the sublocation. * @param gameVersion The game version. * @param userId The id of the user. * @param contractType The type of the contract, only used to distinguish evergreen from other types (default). * @param subPackageId The id of the subpackage you want. * @returns The CompletionData object. */ getLocationCompletion(locationParentId: string, subLocationId: string, gameVersion: GameVersion, userId: string, contractType?: string, subPackageId?: string): CompletionData | undefined; getMasteryPackage(locationParentId: string, gameVersion: GameVersion): MasteryPackage | undefined; private processDrops; getMasteryDataForDestination(locationParentId: string, gameVersion: GameVersion, userId: string, subPackageId?: string): MasteryData[]; }