avatar to main merge

I have completed the character creation screen on the avatar branch and am preparing to merge it into main.
This commit is contained in:
pricewowen
2026-05-23 23:24:36 -06:00
parent 8957ecb81d
commit 61f98866e8
39 changed files with 2361 additions and 436 deletions

37
lib/avatar-display.ts Normal file
View File

@@ -0,0 +1,37 @@
import type { LayerVariantState } from "@/lib/character/types";
import { parseShopStyleItem, parseVariantId } from "@/lib/shop-catalog";
/** Apply equipped shop styles (variant ids like head-1) onto saved customization. */
export function applyEquippedItemsToVariants(
variants: LayerVariantState,
equippedItems: string[],
): LayerVariantState {
const next = { ...variants };
for (const itemId of equippedItems) {
const style = parseVariantId(itemId);
if (style) {
next[style.layerId] = style.variantId;
}
}
return next;
}
export function applyEquippedShopRecordsToVariants(
variants: LayerVariantState,
equippedItems: Array<{ id: string; type: string }>,
): LayerVariantState {
const next = { ...variants };
for (const item of equippedItems) {
const style = parseShopStyleItem(item.id, item.type);
if (style) {
next[style.layerId] = style.variantId;
}
}
return next;
}