feat(daily): add daily rooms, streaks, and profile frames

A deterministic daily room rotates through the 30-level pool and tracks current and best streaks in save version 3. Daily wins are separate from campaign progress. The new Profile screen shows framed Crumb, stats, and selectable frames unlocked by rooms or best streak.
This commit is contained in:
Ratdoku Builder committed 2026-12-02 22:29:32 -06:00
1 parent 77ff5b48de
commit 7e6a338240
11 files changed
+680 -44

No files matched your search

+37
View File
@@ -0,0 +1,37 @@
class_name Daily
extends RefCounted
## Date helpers for the daily room. Everything is keyed by the player's
## local calendar date so the same key is used on save and on display.
static func today_key() -> String:
var d := Time.get_date_dict_from_system()
return "%04d-%02d-%02d" % [int(d.get("year", 0)), int(d.get("month", 0)), int(d.get("day", 0))]
static func day_number(key: String) -> int:
var parts := key.split("-")
if parts.size() != 3:
return 0
var stamp := Time.get_unix_time_from_datetime_dict({
"year": int(parts[0]),
"month": int(parts[1]),
"day": int(parts[2]),
"hour": 0,
"minute": 0,
"second": 0,
})
return int(floor(float(stamp) / 86400.0))
static func key_from_day_number(day: int) -> String:
var d := Time.get_datetime_dict_from_unix_time(day * 86400)
return "%04d-%02d-%02d" % [int(d.get("year", 0)), int(d.get("month", 0)), int(d.get("day", 0))]
## Stable per-date room choice. With 30 rooms the pool repeats monthly.
static func level_index(level_count: int, key: String = "") -> int:
if level_count <= 0:
return -1
var date_key := key if key != "" else today_key()
return absi(("ratdoku-daily-" + date_key).hash()) % level_count