Skip to the content.

API functions

Access functions via game["fvtt-player-achievements"].api.

All functions return the following object:

  {
    errorMessage: 'Error message',
    payload: object
  }

Current API Functions:

getAchievements - Returns the achievements array

     Returns:

     - "PlayerAchievementReturn.<Array.<Achievement>>": Achievements List


doesAchievementExist - Does the achievement exist?

     Parameters:

     - achievementId (string): The achievement id

     Returns:

     - "PlayerAchievementReturn.<boolean>": Does the achievement exist?


doesCharacterHaveAchievement - Does the character have the achievement?

     Parameters:

     - characterUUID (string): The character uuid

     - achievementId (string): The achievement id

     Returns:

     - "PlayerAchievementReturn.<boolean>": Does the character have the achievement?


awardAchievementToCharacter - Award the achievement to the character

     Parameters:

     - achievementId (string): The achievement id

     - characterUUID (string): The character uuid

     Returns:

     - "PlayerAchievementReturn.<boolean>": Was the achievement awarded?


getAchievementsByCharacter - Get the achievements for the character

     Parameters:

     - characterUUID (string): The character uuid

     Returns:

     - "PlayerAchievementReturn.<Array.<Achievement>>": achievements for the character


createAchievement - Create an achievement

     Parameters:

     - id (string): The achievement id

     - title (string): The achievement title

     - description (string): The achievement description

     - showTitleCloaked (boolean): Show the title cloaked?

     - image (string): The achievement image

     - cloakedImage (string): The achievement cloaked image

     - sound (string): The achievement sound effect

     - tags (Array.<string>): The achievement tags

     Returns:

     - "PlayerAchievementReturn.<string>": The ID of the achievement


editAchievement - Edit an achievement

     Parameters:

     - id (string): The achievement id

     - title (string): The achievement title

     - description (string): The achievement description

     - showTitleCloaked (boolean): Show the title cloaked?

     - image (string): The achievement image

     - cloakedImage (string): The achievement cloaked image

     - sound (string): The achievement sound effect

     - tags (Array.<string>): The achievement tags

     Returns:

     - "PlayerAchievementReturn.<boolean>": Was the achievement edited?


removeAchievementFromCharacter - Remove an achievement from the character

     Parameters:

     - achievementId (string): The achievement id

     - characterUUID (string): The character uuid

     Returns:

     - "PlayerAchievementReturn.<boolean>": Was the achievement removed?


deleteAchievement - Delete an achievement

     Parameters:

     - id (string): The achievement id

     Returns:

     - "PlayerAchievementReturn.<boolean>": Was the achievement deleted?