mirror of
https://github.com/jcreek/CosmicClash.git
synced 2026-09-13 21:32:03 +00:00
feat(multiplayer): wire ranked profile runtime policy
This commit is contained in:
@@ -25,6 +25,7 @@ var _finished := false
|
||||
var _ticket_id := ""
|
||||
var _assignment_match_id := ""
|
||||
var _steam_ticket := ""
|
||||
var _ranked_profile_smoke := false
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
@@ -36,6 +37,8 @@ func _ready() -> void:
|
||||
_assignment_match_id = arg.substr("--assignment-match-id=".length())
|
||||
elif arg.begins_with("--steam-ticket="):
|
||||
_steam_ticket = arg.substr("--steam-ticket=".length())
|
||||
elif arg == "--ranked-profile-smoke":
|
||||
_ranked_profile_smoke = true
|
||||
if control_plane_url.is_empty():
|
||||
_finish(false, "missing --control-plane-url")
|
||||
return
|
||||
@@ -77,6 +80,12 @@ func _on_request_succeeded(operation: String, payload: Dictionary) -> void:
|
||||
if err != OK:
|
||||
_finish(false, "fetch_assignment() failed to start: %s" % error_string(err))
|
||||
return
|
||||
if _ranked_profile_smoke:
|
||||
print("SMOKE: logged in as %s, fetching populated ranked profile..." % ControlPlaneClient.player_id)
|
||||
var ranked_err := ControlPlaneClient.fetch_ranked_profile()
|
||||
if ranked_err != OK:
|
||||
_finish(false, "fetch_ranked_profile() failed to start: %s" % error_string(ranked_err))
|
||||
return
|
||||
print("SMOKE: logged in as %s, fetching ranked profile (expect none yet)..." % ControlPlaneClient.player_id)
|
||||
var err := ControlPlaneClient.fetch_ranked_profile()
|
||||
if err != OK:
|
||||
@@ -87,7 +96,13 @@ func _on_request_succeeded(operation: String, payload: Dictionary) -> void:
|
||||
return
|
||||
_finish(true, "authenticated assignment fetch returned the player-scoped endpoint and join authorisation")
|
||||
"ranked_profile":
|
||||
_finish(false, "a brand-new testkit identity unexpectedly already has a ranked profile: %s" % payload)
|
||||
if not _ranked_profile_smoke:
|
||||
_finish(false, "a brand-new testkit identity unexpectedly already has a ranked profile: %s" % payload)
|
||||
return
|
||||
if int(payload.get("rating", -1)) != 1600 or int(payload.get("ranked_games", -1)) != 12 or payload.get("provisional", true) != false or String(payload.get("tier", "")) != "GOLD":
|
||||
_finish(false, "unexpected populated ranked profile: %s" % payload)
|
||||
return
|
||||
_finish(true, "authenticated ranked profile returned the durable rating, games, tier, and provisional state")
|
||||
"queue_create":
|
||||
if payload.get("ticket_id", "") != _ticket_id or payload.get("state", "") != "QUEUED":
|
||||
_finish(false, "unexpected queue_create payload: %s" % payload)
|
||||
|
||||
Reference in New Issue
Block a user