Reference des fonctions
Godot 4 · GDScript · Currency & store
get_currency_leaderboard
Fetches the balance leaderboard for a currency (top balances ranked).
Asynchronous (result via signal)
Signature
get_currency_leaderboard(code: String, limit: int = 20) -> voidWhat it does
GETs /currency/leaderboard/<code>?limit (session-auth). entries is an Array of { rank, player_id, player_name, balance } ordered by balance descending; code echoes the requested currency. If the currency's balance leaderboard is not enabled in the panel the server returns 403 and this emits an empty list. Emits currency_leaderboard_loaded(code, []) immediately on no session or an empty code.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| code | String | required | The currency code from the panel (e.g. "gems"). The leaderboard must be enabled for this currency. |
| limit | int | 20 | How many ranked entries to return; clamped to 1..100. |
How to call it
Connect currency_leaderboard_loaded first, then call get_currency_leaderboard().
Result signal: currency_leaderboard_loaded(code: String, entries: Array)
Example
Gamdato.currency_leaderboard_loaded.connect(_on_currency_lb)
Gamdato.get_currency_leaderboard("gems")
func _on_currency_lb(code: String, entries: Array) -> void:
for row in entries:
print("#%d %s %d" % [row.rank, row.player_name, row.balance])Use cases
- Show a 'richest players' ranking by currency balance.
- Add a wealth-based competitive screen alongside score leaderboards.