Skip to content

Commit ce925a0

Browse files
committed
Just an additional thing
1 parent 51f5d13 commit ce925a0

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

src/gamejolt/GJClient.hx

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ class GJClient {
9393
public function dataSet(key:String, value:String, forUser:Bool):Bool {
9494
var success:Bool = false;
9595
var keySet = new GJRequest().urlFromType(DATA_SET(key, value, forUser));
96-
keySet.onComplete = res -> success = true;
96+
keySet.onSuccess = res -> success = true;
9797
keySet.onError = e -> trace(e);
9898
keySet.execute();
9999
return success;
@@ -226,6 +226,21 @@ class GJClient {
226226
return promise.future;
227227
}
228228

229+
/**
230+
* Returns a list of the trophies registered in your game.
231+
* @param achieved You can set this to true or false whether if you want to fetch only the achieved ones or only the unachieved ones.
232+
* @param trophy_id Set this parameter if you just wanna fetch a single trophy.
233+
* @return A `Future` instance of the Trophies list load.
234+
*/
235+
public function getTrophyList(?achieved:Bool, ?trophy_id:Int):Future<Array<Trophy>> {
236+
var promise = new Promise<Array<Trophy>>();
237+
var trophiesReq = new GJRequest().urlFromType(TROPHIES_FETCH(achieved, trophy_id));
238+
trophiesReq.onSuccess = req -> promise.complete(req.trophies);
239+
trophiesReq.onError = e -> promise.error(e);
240+
trophiesReq.executeAsync();
241+
return promise.future;
242+
}
243+
229244
/**
230245
* Adds a new Score to a certain Score Table in your game, and returns the final Score data. \
231246
* You can also set callbacks for whatever you need using `onSuccess` and/or `onError`.

src/gamejolt/GJRequest.hx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ class GJRequest {
372372
return onError = value;
373373
}
374374

375-
function set_useMd5(value:Bool):Bool {
375+
static function set_useMd5(value:Bool):Bool {
376376
if (isProcessing)
377377
return useMd5;
378378
return useMd5 = value;

0 commit comments

Comments
 (0)