Skip to content

Commit a8a8261

Browse files
committed
docs(leaderboard): add upload and download features documentation
1 parent 314653c commit a8a8261

File tree

4 files changed

+32
-32
lines changed

4 files changed

+32
-32
lines changed

README.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,16 @@ The main files you may want to look at would be instance.js
135135
| Set rich presence | Set the rich presence of the local player. | Key *(string)* <br>Value *(string)* <br> |
136136
| Set activity (synchronous) | Set the discord activity (aka Rich presence). (synchronous) | Details *(string)* <br>State *(string)* <br>Start Timestamp *(string)* <br>Large image key *(string)* <br>Large image text *(string)* <br>Small image key *(string)* <br>Small image text *(string)* <br>Tag *(string)* <br> |
137137
| Set activity | Set the discord activity (aka Rich presence). | Details *(string)* <br>State *(string)* <br>Start Timestamp *(string)* <br>Large image key *(string)* <br>Large image text *(string)* <br>Small image key *(string)* <br>Small image text *(string)* <br> |
138+
| Upload score (synchronous) | Upload a score to a leaderboard (synchronous) | Leaderboard *(string)* <br>Score *(number)* <br>Upload type *(combo)* <br>Tag *(string)* <br> |
139+
| Upload score | Upload a score to a leaderboard | Leaderboard *(string)* <br>Score *(number)* <br>Upload type *(combo)* <br> |
140+
| Upload score with metadata (synchronous) | Upload a score to a leaderboard with metadata (synchronous) | Leaderboard *(string)* <br>Score *(number)* <br>Metadata *(object)* <br>Upload type *(combo)* <br>Tag *(string)* <br> |
141+
| Upload score with metadata | Upload a score to a leaderboard with metadata | Leaderboard *(string)* <br>Score *(number)* <br>Metadata *(object)* <br>Upload type *(combo)* <br> |
142+
| Download scores (synchronous) | Download scores from a leaderboard
143+
When Download type is Regular, offset are absolute.
144+
When Download type is Around the user, the offsets are the amount of entries around the user to fetch. (synchronous) | Leaderboard *(string)* <br>Download type *(combo)* <br>Start *(number)* <br>End *(number)* <br>Output *(object)* <br>Tag *(string)* <br> |
145+
| Download scores | Download scores from a leaderboard
146+
When Download type is Regular, offset are absolute.
147+
When Download type is Around the user, the offsets are the amount of entries around the user to fetch. | Leaderboard *(string)* <br>Download type *(combo)* <br>Start *(number)* <br>End *(number)* <br>Output *(object)* <br> |
138148

139149

140150
---
@@ -313,6 +323,18 @@ The main files you may want to look at would be instance.js
313323
| On any "DiscordSetActivity" success | Trigger when any of the "DiscordSetActivity" are executed with success. | |
314324
| On "DiscordSetActivity" error | Trigger when the "DiscordSetActivity" failed to execute. | Tag *(string)* <br> |
315325
| On any "DiscordSetActivity" error | Trigger when any of the "DiscordSetActivity" failed to execute. | |
326+
| On "LeaderboardUploadScore" success | Trigger when the "LeaderboardUploadScore" is executed with success. | Tag *(string)* <br> |
327+
| On any "LeaderboardUploadScore" success | Trigger when any of the "LeaderboardUploadScore" are executed with success. | |
328+
| On "LeaderboardUploadScore" error | Trigger when the "LeaderboardUploadScore" failed to execute. | Tag *(string)* <br> |
329+
| On any "LeaderboardUploadScore" error | Trigger when any of the "LeaderboardUploadScore" failed to execute. | |
330+
| On "LeaderboardUploadScoreWithMetadata" success | Trigger when the "LeaderboardUploadScoreWithMetadata" is executed with success. | Tag *(string)* <br> |
331+
| On any "LeaderboardUploadScoreWithMetadata" success | Trigger when any of the "LeaderboardUploadScoreWithMetadata" are executed with success. | |
332+
| On "LeaderboardUploadScoreWithMetadata" error | Trigger when the "LeaderboardUploadScoreWithMetadata" failed to execute. | Tag *(string)* <br> |
333+
| On any "LeaderboardUploadScoreWithMetadata" error | Trigger when any of the "LeaderboardUploadScoreWithMetadata" failed to execute. | |
334+
| On "LeaderboardDownloadScore" success | Trigger when the "LeaderboardDownloadScore" is executed with success. | Tag *(string)* <br> |
335+
| On any "LeaderboardDownloadScore" success | Trigger when any of the "LeaderboardDownloadScore" are executed with success. | |
336+
| On "LeaderboardDownloadScore" error | Trigger when the "LeaderboardDownloadScore" failed to execute. | Tag *(string)* <br> |
337+
| On any "LeaderboardDownloadScore" error | Trigger when any of the "LeaderboardDownloadScore" failed to execute. | |
316338
| Is engine | Return true if the engine running the app is the one selected | Engine *(combo)* <br> |
317339
| Is full screen | Returns true if the window is in full screen mode. | State *(combo)* <br> |
318340
| Last checked path exists | Returns true if the last checked path exists. | |
@@ -408,6 +430,12 @@ The main files you may want to look at would be instance.js
408430
| SetRichPresenceResult | The result of the "SetRichPresence last call" | string | |
409431
| DiscordSetActivityError | The error of the "DiscordSetActivity last call" | string | |
410432
| DiscordSetActivityResult | The result of the "DiscordSetActivity last call" | string | |
433+
| LeaderboardUploadScoreError | The error of the "LeaderboardUploadScore last call" | string | |
434+
| LeaderboardUploadScoreResult | The result of the "LeaderboardUploadScore last call" | string | |
435+
| LeaderboardUploadScoreWithMetadataError | The error of the "LeaderboardUploadScoreWithMetadata last call" | string | |
436+
| LeaderboardUploadScoreWithMetadataResult | The result of the "LeaderboardUploadScoreWithMetadata last call" | string | |
437+
| LeaderboardDownloadScoreError | The error of the "LeaderboardDownloadScore last call" | string | |
438+
| LeaderboardDownloadScoreResult | The result of the "LeaderboardDownloadScore last call" | string | |
411439
| ArgumentAt | Get the argument at the given index. | string | Index *(number)* <br> |
412440
| ArgumentCount | Get the number of arguments. | number | |
413441
| AppFolderURL | Return the URL of the folder of the current app. | string | |

examples/example.c3p

68 Bytes
Binary file not shown.

mise.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@ _.file = ".env"
66

77
[tasks.build]
88
run = "pnpm run build"
9-
depends = ["validate"]
9+
depends = ["validate", "doc"]
1010

1111
[tasks.validate]
1212
run = "pnpm run validate"
13+
14+
[tasks.doc]
15+
run = "pnpm run doc"

src/instance.js

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,6 @@ function getInstanceJs(parentClass, addonTriggers, C3) {
395395
/** @type {import("./sdk.js").StaticMethodsParentClass['_trigger']} */
396396
// @ts-expect-error Trigger is only available in v1
397397
this._trigger = (...args) => {
398-
console.log('triggering sdk v1', args)
399398
return this.Trigger(...args);
400399
};
401400
}
@@ -462,16 +461,10 @@ function getInstanceJs(parentClass, addonTriggers, C3) {
462461
// fns[1] = without tag
463462
if (tag) {
464463
this._currentTag = tag
465-
console.log('this._currentTag', this._currentTag)
466-
console.log('this._trigger', this._trigger)
467-
console.log('fns', fns)
468-
console.log('this._trigger(fns[0])', this._trigger(fns[0]))
469464
this._trigger(fns[0])
470465
this._trigger(fns[1])
471-
console.log('trigger done')
472466
// reset tag
473467
this._currentTag = ""
474-
console.log('this._currentTag', this._currentTag)
475468
} else {
476469
await this._triggerAsync(fns[1])
477470
}
@@ -709,8 +702,6 @@ function getInstanceJs(parentClass, addonTriggers, C3) {
709702

710703
this._isInitialized = true
711704

712-
console.log('C3', C3)
713-
714705
await this.trigger(tag, [
715706
C3.Plugins.pipelabv2.Cnds.OnInitializeSuccess,
716707
C3.Plugins.pipelabv2.Cnds.OnAnyInitializeSuccess
@@ -1914,11 +1905,6 @@ function getInstanceJs(parentClass, addonTriggers, C3) {
19141905
/** @type {string} */ type,
19151906
/** @type {Tag} */ tag
19161907
) => {
1917-
console.log('name', name)
1918-
console.log('score', score)
1919-
console.log('type', type)
1920-
console.log('tag', tag)
1921-
19221908
try {
19231909
/** @type {import('@pipelab/core').MakeInputOutput<import('@pipelab/core').SteamRaw<'leaderboards', 'uploadScore'>, 'input'>} */
19241910
const order = {
@@ -1962,12 +1948,6 @@ function getInstanceJs(parentClass, addonTriggers, C3) {
19621948
/** @type {string} */ type,
19631949
/** @type {Tag} */ tag
19641950
) => {
1965-
console.log('name', name)
1966-
console.log('score', score)
1967-
console.log('metadata', metadata)
1968-
console.log('type', type)
1969-
console.log('tag', tag)
1970-
19711951
const target = metadata.getFirstPickedInstance();
19721952
let result = []
19731953
if (target) {
@@ -1983,8 +1963,6 @@ function getInstanceJs(parentClass, addonTriggers, C3) {
19831963
}
19841964
}
19851965

1986-
console.log('result', result)
1987-
19881966
try {
19891967
/** @type {import('@pipelab/core').MakeInputOutput<import('@pipelab/core').SteamRaw<'leaderboards', 'uploadScore'>, 'input'>} */
19901968
const order = {
@@ -2029,11 +2007,6 @@ function getInstanceJs(parentClass, addonTriggers, C3) {
20292007
/** @type {IObjectType<IJSONInstance>} */ jsonObject,
20302008
/** @type {Tag} */ tag
20312009
) => {
2032-
console.log('leaderboard', leaderboard)
2033-
console.log('downloadType', downloadType)
2034-
console.log('start', start)
2035-
console.log('end', end)
2036-
console.log('tag', tag)
20372010

20382011
try {
20392012
/** @type {import('@pipelab/core').MakeInputOutput<import('@pipelab/core').SteamRaw<'leaderboards', 'downloadScore'>, 'input'>} */
@@ -2053,8 +2026,6 @@ function getInstanceJs(parentClass, addonTriggers, C3) {
20532026
this._LeaderboardDownloadScoreResultValue = answer?.body.success
20542027
this._LeaderboardDownloadScoreErrorValue = ''
20552028

2056-
console.log('answer?.body', answer?.body.data)
2057-
20582029
const jsonInstance = jsonObject.getFirstInstance()
20592030
jsonInstance?.setJsonDataCopy(answer?.body.data)
20602031

@@ -2167,8 +2138,6 @@ function getInstanceJs(parentClass, addonTriggers, C3) {
21672138

21682139
// #region Cnds
21692140
_OnInitializeSuccess = this.wrap(super._OnInitializeSuccess, (/** @type {Tag} */ tag) => {
2170-
console.log('tag', tag)
2171-
console.log('this._currentTag', this._currentTag)
21722141
return this._currentTag === tag;
21732142
})
21742143
_OnAnyInitializeSuccess = this.wrap(super._OnAnyInitializeSuccess, () => {

0 commit comments

Comments
 (0)