@peacockproject/core
Version:
Type definitions for Peacock's core.
93 lines (92 loc) • 3.92 kB
TypeScript
import { ChallengeProgressionData, CompiledChallengeIngameData, CompiledChallengeRuntimeData, GameVersion, InclusionData, MissionManifest, MissionType, RegistryChallenge } from "../types/types";
import { SavedChallengeGroup } from "../types/challenges";
/**
* Change a registry challenge to the runtime format (for GetActiveChallenges).
* @param challenge The challenge.
* @returns The runtime challenge.
* @see {@link compileRuntimeChallenge} for the modern variant with progression data.
*/
export declare function compileRuntimeChallengeOnly(challenge: RegistryChallenge): CompiledChallengeIngameData;
/**
* Change a registry challenge to the runtime format (for GetActiveChallengesAndProgression).
* @param challenge The challenge.
* @param progression The progression data.
* @returns The runtime challenge (including progression data).
* @see {@link compileRuntimeChallengeOnly} for when you only need the challenge data.
*/
export declare function compileRuntimeChallenge(challenge: RegistryChallenge, progression: ChallengeProgressionData): CompiledChallengeRuntimeData;
/**
* How to handle filtering of challenges.
*/
export declare enum ChallengeFilterType {
/** Note that this option will include global elusive and escalations challenges. */
None = "None",
/** A single contract's challenges. */
Contract = "Contract",
/** Only used for the CAREER -> CHALLENGES page */
Contracts = "Contracts",
/** Only used for the location page, and when calculating location completion */
ParentLocation = "ParentLocation",
/** Challenges for a contract type. Only used for ContractTypeChallenges */
ContractType = "ContractType"
}
/**
* How to handle filtering of pro1 challenges.
* Works in conjunction with {@link ChallengeFilterType}, but only if the
* challenge is tagged as pro1 and the challenge filter is met.
*/
export declare enum Pro1FilterType {
/**
* Only include pro1 challenges.
*/
Only = "Only",
/**
* Include both pro1 and non-pro1 challenges.
*/
Ignore = "Ignore",
/**
* Exclude pro1 challenges.
*/
Exclude = "Exclude"
}
export type ChallengeFilterOptions = {
type: ChallengeFilterType.None;
} | {
type: ChallengeFilterType.Contract;
contractId: string;
locationId: string;
gameVersion: GameVersion;
isFeatured?: boolean;
difficulty: number;
pro1Filter: Pro1FilterType;
} | {
type: ChallengeFilterType.Contracts;
contractIds: string[];
gameVersion: GameVersion;
locationId: string;
pro1Filter: Pro1FilterType;
} | {
type: ChallengeFilterType.ContractType;
contractType: MissionType;
} | {
type: ChallengeFilterType.ParentLocation;
parent: string;
gameVersion: GameVersion;
pro1Filter: Pro1FilterType;
};
/**
* Checks if the metadata of a contract matches the definition in the InclusionData of a challenge.
* @param incData The inclusion data of the challenge in question. Will return true if this is null.
* @param contract The contract in question.
* @returns A boolean as the result.
*/
export declare function inclusionDataCheck(incData: InclusionData | undefined, contract: MissionManifest | undefined): boolean;
export declare function isChallengeForDifficulty(difficulty: number, challenge: RegistryChallenge): boolean;
export declare function filterChallenge(options: ChallengeFilterOptions, challenge: RegistryChallenge): boolean;
/**
* Merges the Challenge field two SavedChallengeGroup objects and returns a new object. Does not modify the original objects. For all the other fields, the values of g1 is used.
* @param g1 One of the SavedChallengeGroup objects.
* @param g2 The other SavedChallengeGroup object.
* @returns A new object with the Challenge arrays merged.
*/
export declare function mergeSavedChallengeGroups(g1: SavedChallengeGroup, g2?: SavedChallengeGroup): SavedChallengeGroup;