fix(profile): prevent saved showcases from crashing the parser

Store local showcase selections separately from the client's top-level
showcase block.
This commit is contained in:
N0VAN0M4LY committed 2026-11-25 22:46:35 +08:00
1 parent 3144adc487
commit feda31d12a
1 file changed
+6 -3
@@ -2,17 +2,20 @@
* The player's profile showcase, kept in the profile in the form the
* client reads it back from cln_get_showcases and cln_get_users_terse_info:
*
* showcase{
* wtoShowcase{
* current:t="favorite_unit"
* favorite_unit{ unit:t="us_m22_locust" difficulty:t="arcade" }
* medalist{ medals:t="..." medals:t="..." }
* }
*
* This block is the local service's own record: the client's profile reader does not know it.
* Stored under `wtoShowcase` rather than `showcase`: the client's native profile serializer
* (aces.exe 2.61.0.37 0x917e30 -> 0x9492c0) reads a top-level `showcase` block with a different
* flat schema and fatal-aborts if `favoriteUnitDifficulty:t` is absent (0x949b49), while the UI
* scripts read showcase data exclusively through cln_get_showcases and cln_get_users_terse_info.
*/
import { ensureBlock, findBlock, findParam, setParam, type BlkBlock, type BlkParam } from '@wto/blk';
const SHOWCASE = 'showcase';
const SHOWCASE = 'wtoShowcase';
const CURRENT = 'current';
export function currentShowcase(profile: BlkBlock): string {