From 3acd3b4ec4f003ae392f145951150635248fb90f Mon Sep 17 00:00:00 2001 From: Max Date: Fri, 6 Feb 2015 14:48:41 +0300 Subject: [PATCH] Created Trophies (markdown) --- Trophies.md | 54 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 Trophies.md diff --git a/Trophies.md b/Trophies.md new file mode 100644 index 0000000..aabd334 --- /dev/null +++ b/Trophies.md @@ -0,0 +1,54 @@ +# 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 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. + +```lua +local success = GJ.giveTrophy(trophyID) +``` + +# Fetching trophy's info +There's a plenty of variations. + +You can get info about specific trophy: + +```lua +local trophyInfo = GJ.fetchTrophy(trophyID) +``` + +Or fetch trophies with specific status (only ones that user already achieved or not). + +The result is array of tables. + +```lua +local trophies = GJ.fetchTrophiesByStatus(achieved) +``` + +Or you can get just all of the trophies: + +```lua +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: + +```lua +-- printing a difficulty of first trophy we've just got +local trophies = GJ.fetchAllTrophies() +print(trophies[1].difficulty) +``` \ No newline at end of file