Quest Methods

retrieveQuests()

This method returns an array of quest objects for each of the game's quests that the user has started (as tracked by the submitQuest() call). This means that if a user is new to the game, you will receive an empty array as the user has no quest progress. You will need to join the user's quest progress (or implied lack of progress) with your game's global quest information depending on your usage and display of quests in your game.

Fields for each quest object:

  • percent_complete - An integer representing the percentage the user has completed toward the quest.
  • current_value - An integer representing the raw progress toward the quest.
  • state - A string of the quest's progress state. One of the following values:
    • Revoked
    • In Progress
    • Completed
  • completed_date - A string representing the date and time the user completed the quest. This string is formatted as Y-m-d H:i:s (as used by PHP's date() method) in UTC. For quests which have not been completed, a default value of 0000-00-00 00:00:00 is returned.
  • developer_id - A string for the quest ID.
ag.retrieveQuests().then(function(response) {
  // Response should be an array of objects
});

submitQuest(developer_id, progress)

Submit quest progress for the user. Progress is a value from 0.0 to 1.0, with 1.0 being 100% complete.

ag.submitQuest('quest-developer-id',0.1).then(function(response) {
  // response {state,current_value,percent_complete,developer_id,score_awarded,already_completed,completed_date}
});

resetQuest(developer_id)

Resets a quest's progress back to zero.

ag.resetQuest('test_quest').then(function(response) {
  // response = {state,current_value,percent_complete,developer_id,score_awarded,already_completed,completed_date}
});