3 Trophies
Max edited this page 2015-02-06 18:40:10 +03:00

General

Trophies come in four materials: Bronze, Silver, Gold and Platinum. This is to reflect how difficult it is to achieve a trophy. A bronze trophy should be easy to achieve whereas a platinum trophy should be very hard to achieve.

On Game Jolt, trophies are always listed in order from most easily achievable to most difficult.

You can also tag trophies on the site as "secret." This is where a trophy's image and description is not visible until a gamer has achieved it.

Setting trophies as achieved

Sets a trophy as achieved for a particular user.

local success = GJ.giveTrophy(trophyID)

Fetching trophy's info

There's a plenty of variations.

You can get info about specific trophy:

local trophyInfo = GJ.fetchTrophy(trophyID)

Or fetch trophies with specific status (false is for trophies that user hasn't achieved yet, true for those that user already got).

The result is array of tables.

local trophies = GJ.fetchTrophiesByStatus(achieved)

Or you can get just all of the trophies:

local trophies = GJ.fetchAllTrophies()

No matter which method did you choose, the resulting table is formatted like this:

  • id - The ID of the trophy.
  • title - The title of the trophy on the site.
  • description - The trophy description text.
  • difficulty - "Bronze", "Silver", "Gold" or "Platinum"
  • image_url - The URL to the trophy's thumbnail.
  • achieved - Returns when the trophy was achieved by the user, or "false" if they haven't achieved it yet.

Example:

-- printing a difficulty of first trophy in the list
local trophies = GJ.fetchAllTrophies()
print(trophies[1].difficulty)