feat: add user icon library and in-game selection

This commit is contained in:
2026-08-01 03:40:36 +00:00
parent 395b60cdbe
commit a275e6a234
26 changed files with 1214 additions and 69 deletions
+9 -3
View File
@@ -39,14 +39,19 @@ export const loadAuthoritativeAccountIcon = async (
export const adjustAccountIconForUser = async (
ctx: GameApiContext,
userId: string
userId: string,
selected?: AccountIconProjection,
enforceCooldown = true,
requestKey?: string
): Promise<{
ok: true;
generalId: number | null;
updated: boolean;
}> => {
const projection = await loadAuthoritativeAccountIcon(ctx, userId);
const requestId = `general:adjustIcon:${userId}:${projection.revision}`;
const projection = selected ?? (await loadAuthoritativeAccountIcon(ctx, userId));
const requestId = selected
? `general:adjustIcon:${userId}:manual:${requestKey ?? `${projection.revision}:${encodeURIComponent(projection.picture)}`}`
: `general:adjustIcon:${userId}:${projection.revision}`;
try {
const result = await ctx.turnDaemon.requestCommand({
type: 'adjustGeneralIcon',
@@ -55,6 +60,7 @@ export const adjustAccountIconForUser = async (
picture: projection.picture,
imageServer: projection.imageServer,
iconRevision: projection.revision,
enforceCooldown,
});
if (!result) {
throw new TRPCError({