Skip to content

AchievementTracker beta ​

Class of @v12-engine/client

ts
export declare class AchievementTracker

A game's achievements followed for a player: each check (an objective changed, the game over) earns those whose condition holds and that were not earned before, kept in the profile at once, and tells whoever listens of each

Members ​

constructor ​

ts
constructor(
    game: string, 
    achievements: readonly AchievementDef[], store?: ProfileStore);

Constructs a new instance of the AchievementTracker class

achievements ​

ts
readonly achievements: readonly AchievementDef[];

The game's achievements that can be earned

check ​

ts
check(facts: AchievementFacts): AchievementDef[];

Earns what holds of what is so now: those newly earned

game ​

ts
readonly game: string;

The id of the game whose achievements are followed

gameOver ​

ts
gameOver(facts: AchievementFacts & {
        outcome: 'victory' | 'defeat';
    }): AchievementDef[];

The game is over for the player: counted among what they played (once a game), then checked

onEarned ​

ts
onEarned(listener: (earned: AchievementDef) => void): () => void;

Calls back with each achievement earned, until what this gives back is called

profile ​

ts
profile(): PlayerProfile;

The profile as it is kept now