Created Trophies (markdown)

Max 2015-02-06 14:48:41 +03:00
parent 328c79efbb
commit 3acd3b4ec4

54
Trophies.md Normal file

@ -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)
```