Godot 4 · GDScript
Rewards
Claimable rewards (daily, weekly, per event). You define them in your panel and the player claims them from the game.
Check Status
Check which rewards exist and which can be claimed right now:
Gamdato.rewards_status_loaded.connect(_on_rewards)
Gamdato.get_rewards_status()
func _on_rewards(rewards: Array, _server_now: String) -> void:
for r in rewards:
if r.claimable_now:
Gamdato.claim_reward(r.key)# rewards: Array, each reward you defined in the panel:
{
"key": String, # pass this to claim_reward()
"display_name": String,
"cadence_type": String, # e.g. "daily", "weekly"
"claimable_now": bool,
"next_claimable_at": String, # ISO date, or null
"payload_keys": Array
}Claiming
Claim by key and listen to reward_claimed. Safe against double-clicks: it never grants twice.
Gamdato.reward_claimed.connect(_on_claim)
func _on_claim(ok: bool, key: String, _data: Dictionary, error: String) -> void:
if ok: print("Reward %s claimed!" % key)
else: print("Not available: %s" % error)# reward_claimed(success: bool, reward_key: String, payload: Dictionary, error: String)
# payload = the reward content you defined in the panel, e.g.:
{ "coins": 100, "skin": "gold" }
# on failure, error explains why: "cooldown", "already_claimed_period", ...