feat: rare values + fortune wheel protocol + prize editor

Composers/parsers/events for rare values + wheel (open/spin/buy/data/result/
recent-wins) + admin (get/save prizes), headers 9300-9305 / 9400-9404.
fix: figure map uses split-aware loadGamedata (raw fetch broke on tier-manifest
gamedata, silently empty avatars).
This commit is contained in:
medievalshell
2026-05-28 02:39:01 +02:00
parent 4a74fb948d
commit 87eec0563d
29 changed files with 431 additions and 17 deletions
@@ -1,7 +1,7 @@
import { IAssetManager, IAvatarFigureContainer, IAvatarImageListener } from '@nitrots/api';
import { GetConfiguration } from '@nitrots/configuration';
import { AvatarRenderLibraryEvent, GetEventDispatcher, NitroEvent, NitroEventType } from '@nitrots/events';
import { parseConfigJsonFromResponse } from '@nitrots/utils';
import { loadGamedata } from '@nitrots/utils';
import { AvatarAssetDownloadLibrary } from './AvatarAssetDownloadLibrary';
import { AvatarStructure } from './AvatarStructure';
@@ -41,28 +41,19 @@ export class AvatarAssetDownloadManager
if(!url || !url.length) throw new Error('Missing "avatar.figuremap.url" in config — add the figure map URL to your renderer-config.json');
let response: Response;
try
{
response = await fetch(url);
}
catch(fetchErr)
{
throw new Error(`Could not fetch figure map from "${ url }" — check "avatar.figuremap.url" in renderer-config.json (${ fetchErr.message })`);
}
if(response.status !== 200) throw new Error(`Failed to load figure map from "${ url }" — server returned HTTP ${ response.status }. Check "avatar.figuremap.url" in renderer-config.json`);
let responseData: any;
try
{
responseData = await parseConfigJsonFromResponse(response, url);
// Split-aware loader (tier manifest -> per-tier files -> merged).
// The figuremap URL is a directory manifest, not a single JSON, so a
// raw fetch yields { tiers: [...] } with no `libraries` and avatars
// silently render empty. loadGamedata handles both split + single.
responseData = await loadGamedata(url);
}
catch(parseErr)
catch(fetchErr)
{
throw new Error(`Invalid figure map "${ url }" — JSON/JSON5 parse failed. Check "avatar.figuremap.url" in renderer-config.json (${ parseErr.message })`);
throw new Error(`Could not load figure map from "${ url }" — check "avatar.figuremap.url" in renderer-config.json (${ fetchErr.message })`);
}
this.processFigureMap(responseData.libraries);