/** @module Achievements */ import type HTTPChannel from "../channel"; type onAchievementHandler = (arg0: Achievement) => any; /** * The Achievements service. This class is used to update the progress of an achievement for the * current user, and loading achievements of other users. All achievements have to be defined in the * admin panel first. */ export default class Achievements { protected channel: HTTPChannel; private _list; onCompleteHandlers: onAchievementHandler[]; /** * If null, the achievements has not been refreshed. */ currentVersion: string | null; constructor(channel: HTTPChannel); /** * The list of achievements for the current user. You must call refresh() first to initialize this list. */ get myAchievements(): Achievement[]; addOnComplete(onCompleteHandler: onAchievementHandler): void; /** * Get an achievement by id * @param {string} achievementId Id of the achievement to get. */ get(achievementId: string): Achievement | null; /** * Refresh the list of achievements. */ refresh(): Promise; /** * Load the achivements for multiple users by their connectUserId * @param {string[]} userIds The list of users to load achievements for. */ load(userIds: string[]): Promise<{ [userId: string]: Achievement[]; }>; /** * Sets the progress of the specified achievement * @param {string} achievementId The id of the achievement to set the progress for. * @param {number} progress The value to set the progress to */ progressSet(achievementId: string, progress: number): Promise; /** * Adds the delta to the progress of the specified achievement * @param {string} achievementId The id of the achievement to add to the progress for. * @param {number} progressDelta The value to add to the progress. */ progressAdd(achievementId: string, progressDelta: number): Promise; /** * Sets the progress of the specified achievement to the bigger value of the current value and the given value. * @param {string} achievementId The id of the achievement to set the progress for. * @param {number} progress The value to set the progress to, if it's bigger than the current value. */ progressMax(achievementId: string, progress: number): Promise; /** * Completes the specified achievement by setting the progress to the progress goal. * @param {string} achievementId The id of the achievement to complete. */ progressComplete(achievementId: string): Promise; /** * THIS IS FOR INTERNAL USE! * @returns {Achievement} */ protected update(achievement: any, completednow: boolean): Achievement; } export declare class Achievement { /** * The id of this achievement. */ id: string; /** * The title of this achievement. */ title: string; /** * The description of this achievement. */ description: string; /** * The image url of this achievement. */ imageUrl: string; /** * The progress of this achievement. */ progress: number; /** * The progress goal of this achievement. */ progressGoal: number; /** * When this achievement was last updated. */ lastUpdated: Date; /** * The progress ratio of this achievement. */ progressRatio: number; /** * If this achievement is completed. */ completed: boolean; constructor(id: string, title: string, description: string, imageUrl: string, progress: number, progressGoal: number, lastUpdated: number); } export {};