feat: add user icon library and in-game selection
This commit is contained in:
@@ -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({
|
||||
|
||||
Reference in New Issue
Block a user