diff --git a/CHANGELOG.md b/CHANGELOG.md index 66ca663878..3660b89b70 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ Pixel Avatars can be an elf, dwarf, orc or talking flower with beards, medieval - The part editor gains line and rectangle (hold Shift for straight angles and squares), a tone gradient with 4×4 or 2×2 dithering, noise with an amount and **Re-roll**, an eyedropper (or Alt-click / long-press), and a **Shade** pencil that makes cells lighter or darker once per stroke. Every tool mirrors and is one undo step. Results stay appearance colors at a tone, so the part still recolors. On touch, a two-finger tap undoes, a three-finger tap redoes, and an **Offset cursor** with a **Hold to draw** button keeps your finger off the pixel ([#1216](https://github.com/BotHarness/DeepSeekBot/issues/1216)). - Every hair piece can have its own color: bangs, back hair and a new single strand (ahoge, curl or double) join the side hair colors, and each follows the hair color until you pick one. **Headpiece** now offers built-in cat, bunny and horse ears, little horns, a halo and new little wings, worn together with any accessory; the base tucks behind the hair and the far side hides when the head turns. Saved Avatars that wear these as accessories look the same until you edit them, when they move into the headpiece slot ([#1217](https://github.com/BotHarness/DeepSeekBot/issues/1217)). - Pixel art from other tools can become a part: **Import part files** also takes a plain PNG of a part's size (32×32, 32×16, or a whole-number scale). You see its size and color count first, choose how many colors to keep (at most 32, nearest color, no dithering), and its pixels arrive as fixed colors that **Replace color** turns into appearance colors and tones. A built-in headpiece opens as a flattened starting canvas, and a part saved from someone else's part records its parent and keeps the original author's name. The library filter adds **Based on another part** and **From an imported image** ([#1219](https://github.com/BotHarness/DeepSeekBot/issues/1219)). +- Pixel Avatars can be animals: cat, dog, fox, rabbit and bear each get a muzzle, an animal nose and their own ears, with suggested fur colors (skin color is the fur color, and any color still works). **Fur pattern** adds tabby, spots, patches or colorpoint in fur tones that follow recoloring, and you can draw your own pattern. Ear headpieces and ear accessories are kept but hidden on an animal, with a note ([#1218](https://github.com/BotHarness/DeepSeekBot/issues/1218)). - Hair pieces can be drawn too: open bangs, left or right side hair or back hair and start from the style you wear, flattened to pixels. Reshape it with the same tools, save it to the Part Library and wear it in that slot. The drawn hair is shaded and recolored like built-in hair, turns with the head and hides under helmets, hoods and on flowers. **Back to the built-in style** restores your original choice ([#1238](https://github.com/BotHarness/DeepSeekBot/issues/1238)). - You can draw your own headpiece for a pixel Avatar: pencil, eraser, fill, mirroring across the face, a front layer over the hair and a back layer behind it, undo and redo, and a 1× preview on the real Avatar. Colors can follow the Avatar's hair, skin, eye or outfit color in five tones, or be fixed. Saved parts go into a Part Library in your Profile and can be worn by any PersonaBot. The worn copy turns and speaks with the Window Companion and travels with an exported Bot, and editing a library part saves a new part without changing Avatars that already wear the old one ([#1211](https://github.com/BotHarness/DeepSeekBot/issues/1211)). - Pixel Avatars can be an elf, dwarf, orc or talking flower. Beards always leave the speaking mouth visible. Armor, robe, tunic and cloak outfits are available, and a helmet or hood hides the hair underneath. Flowers have bead eyes, five petal styles and a stem or pot. Choices a species or headwear doesn't show stay saved, with a note, and return when switched back ([#1212](https://github.com/BotHarness/DeepSeekBot/issues/1212), [#1213](https://github.com/BotHarness/DeepSeekBot/issues/1213)). diff --git a/CHANGELOG.zh.md b/CHANGELOG.zh.md index a66f1eb0f4..22e368451c 100644 --- a/CHANGELOG.zh.md +++ b/CHANGELOG.zh.md @@ -18,6 +18,7 @@ - 部件编辑器新增直线和矩形(按住 Shift 锁定直角和正方形)、带 4×4 或 2×2 抖动的明暗渐变、可调强度并可 **重新随机** 的杂色、吸管(也可按住 Alt 点击或长按),以及每笔只变亮或变暗一次的 **明暗笔**。所有工具都支持镜像,每次操作是一步撤销;结果仍是外形颜色加明暗,部件照样跟着变色。触屏上双指轻点撤销、三指轻点重做,**偏移光标** 配合 **按住绘制** 按钮,手指不会挡住要画的像素([#1216](https://github.com/BotHarness/DeepSeekBot/issues/1216))。 - 每片头发都能单独设颜色:前发、后发和新的单根呆毛(呆毛、卷翘或双呆毛)加入左右侧发颜色的行列,没选颜色时跟随发色。**头饰** 现在提供内置的猫耳、兔耳、马耳、小角、光环和新的小翅膀,可以和任意配饰一起戴;根部藏在头发后面,转头时远侧会隐藏。已保存的头像如果把这些当作配饰戴着,在你编辑前外观不变,编辑时会移到头饰位([#1217](https://github.com/BotHarness/DeepSeekBot/issues/1217))。 - 其他工具画的像素画也能变成部件:**导入部件文件** 现在也接受部件尺寸的普通 PNG(32×32、32×16 或其整数倍放大)。会先显示尺寸和颜色数,再选择保留几种颜色(最多 32 种,取最接近的颜色,不抖动);导入的像素是固定颜色,可以用 **替换颜色** 换成外形颜色和明暗。内置头饰可以作为压平的起点打开;基于别人部件保存的新部件会记录父部件并保留原作者名字。部件库筛选新增 **基于其他部件修改** 和 **来自导入的图片**([#1219](https://github.com/BotHarness/DeepSeekBot/issues/1219))。 +- 像素头像可以是动物了:猫、狗、狐狸、兔子和熊各有口鼻、动物鼻子和自己的耳朵,并有建议毛色(肤色就是毛色,也可以选任意颜色)。**毛色花纹** 提供虎斑、斑点、奶牛斑和重点色,用毛色明暗绘制,换色后仍保留;也可以自己画花纹。动物戴耳朵类头饰或配饰时会保留但隐藏,并显示说明([#1218](https://github.com/BotHarness/DeepSeekBot/issues/1218))。 - 头发也能自己画了:在前发、左右侧发或后发里,从当前戴的样式开始(压平成像素),用同样的工具改形状,存进部件库并戴在这个位置。自绘头发会像内置头发一样上阴影、跟着发色变色、随头部转动,戴头盔/兜帽或变成花朵时会隐藏。点 **换回内置样式** 可恢复原来的选择([#1238](https://github.com/BotHarness/DeepSeekBot/issues/1238))。 - 可以为像素头像自己画头饰:铅笔、橡皮、填充、沿脸部中线镜像,前层盖在头发上、后层在头发后面,支持撤销重做,并在真实头像上显示 1× 预览。颜色可以跟随头像的发色、肤色、眼睛或衣服颜色(五档明暗),也可以是固定色。保存的部件进入 Profile 里的部件库,任何 PersonaBot 都能戴上;戴上的副本会在窗口伙伴里随头部转动和说话,并随导出的 Bot 一起带走;修改库里的部件会另存为新部件,不会改变已经戴着旧部件的头像([#1211](https://github.com/BotHarness/DeepSeekBot/issues/1211))。 - 像素头像新增精灵、矮人、兽人和会说话的花。胡子始终露出说话的嘴,新增盔甲、法袍、束腰外衣和斗篷,戴上头盔或兜帽会遮住下面的头发。花有豆豆眼、五种花瓣样式,以及茎叶或花盆。当前物种或头饰不显示的选择会保留并给出提示,换回后恢复([#1212](https://github.com/BotHarness/DeepSeekBot/issues/1212)、[#1213](https://github.com/BotHarness/DeepSeekBot/issues/1213))。 diff --git a/docs/architecture/botharness-architecture.en.md b/docs/architecture/botharness-architecture.en.md index 1efa7dff55..09640f3994 100644 --- a/docs/architecture/botharness-architecture.en.md +++ b/docs/architecture/botharness-architecture.en.md @@ -416,7 +416,7 @@ Custom Parts are bounded pixel grids whose cells reference appearance colors or New PersonaBots record a full-domain name-seed version; PersonaBots without it keep the human-only seed. Recipes using species, new slots or Custom Parts raise the asset/schema version and fall back to the saved snapshot on older Clients; existing recipes render unchanged. The first slice proves goblin, split side hair and one drawn headpiece from editor to Part Library to a Window Companion and through export/import. -Implemented so far: goblin, elf, dwarf, orc and flower species, split side hair, beards, medieval outfits and headwear, the full-domain seed (#1210, #1212–#1214), the first Custom Part path (#1211), drawn hair pieces (#1238), every other drawn part (#1240), part files (#1215), the full drawing tool set (#1216), per-piece hair colors with built-in headpieces (#1217), and plain PNG import with derived editing (#1219). Asset version 4 adds bangs, back hair and strand colors, a single strand, and a headpiece slot that holds a built-in headpiece or a Custom Part beside the accessory; the editor raises a recipe to version 4 only when the Human edits these, moving a headpiece accessory into the slot. A drawn bangs, side or back piece replaces the built-in piece while that choice stays saved; its live `hairColor` cells are shaded like built-in hair, so editing starts from the worn style flattened to cells. A drawn headpiece is an asset version 3 recipe. The Part Library is the `avatar-part-library` module's `avatar_part_library` table (schema generation 73), keyed by the part's content hash and holding name, origins and parent. The `partLibraryList`, `partLibraryAdd`, `partLibraryExport` and `partLibraryImport` bridge methods expose it to the Client editor (pencil with a lighter/darker shade modifier, eraser, 4-connected fill, line and rectangle with Shift snapping, a region-bounded tone gradient with 4×4 or 2×2 Bayer dithering, seeded ±1 tone noise with re-roll, an eyedropper by Alt-click or long-press, centerline mirror for every tool, front and back layers, one undo step per action with two- and three-finger tap undo and redo, an offset touch cursor, and a 1× preview; BotPixel computes every tool's cells, which stay appearance colors at a tone). The appearance embeds a copy of the part, so it travels in `.botharness/bot.json` and Bot Zips. `part-file` encodes one part as a ×8 preview PNG with the part data in a `botharness-part` tEXt chunk, and the library as a zip of such PNGs; import checks every chunk CRC and deduplicates by content. Importing a Bot adds the parts its appearance wears to the library with the `imported-bot` origin and the Bot's display name as author. `part-image` decodes a plain PNG of a slot's size (or a whole-number scale), reports its color count through `partLibraryImport`, and `partLibraryImportImage` keeps the most frequent colors (nearest color, no dithering) as fixed-color cells with the `imported-image` origin. A part saved with a library parent gets the `derived` origin and the parent's author as `parentAuthor`. Animal species are still to come. +Implemented so far: goblin, elf, dwarf, orc and flower species, split side hair, beards, medieval outfits and headwear, the full-domain seed (#1210, #1212–#1214), the first Custom Part path (#1211), drawn hair pieces (#1238), every other drawn part (#1240), part files (#1215), the full drawing tool set (#1216), per-piece hair colors with built-in headpieces (#1217), plain PNG import with derived editing (#1219), and animal species with fur patterns (#1218). Asset version 4 adds bangs, back hair and strand colors, a single strand, and a headpiece slot that holds a built-in headpiece or a Custom Part beside the accessory; the editor raises a recipe to version 4 only when the Human edits these, moving a headpiece accessory into the slot. A drawn bangs, side or back piece replaces the built-in piece while that choice stays saved; its live `hairColor` cells are shaded like built-in hair, so editing starts from the worn style flattened to cells. A drawn headpiece is an asset version 3 recipe. The Part Library is the `avatar-part-library` module's `avatar_part_library` table (schema generation 73), keyed by the part's content hash and holding name, origins and parent. The `partLibraryList`, `partLibraryAdd`, `partLibraryExport` and `partLibraryImport` bridge methods expose it to the Client editor (pencil with a lighter/darker shade modifier, eraser, 4-connected fill, line and rectangle with Shift snapping, a region-bounded tone gradient with 4×4 or 2×2 Bayer dithering, seeded ±1 tone noise with re-roll, an eyedropper by Alt-click or long-press, centerline mirror for every tool, front and back layers, one undo step per action with two- and three-finger tap undo and redo, an offset touch cursor, and a 1× preview; BotPixel computes every tool's cells, which stay appearance colors at a tone). The appearance embeds a copy of the part, so it travels in `.botharness/bot.json` and Bot Zips. `part-file` encodes one part as a ×8 preview PNG with the part data in a `botharness-part` tEXt chunk, and the library as a zip of such PNGs; import checks every chunk CRC and deduplicates by content. Importing a Bot adds the parts its appearance wears to the library with the `imported-bot` origin and the Bot's display name as author. `part-image` decodes a plain PNG of a slot's size (or a whole-number scale), reports its color count through `partLibraryImport`, and `partLibraryImportImage` keeps the most frequent colors (nearest color, no dithering) as fixed-color cells with the `imported-image` origin. A part saved with a library parent gets the `derived` origin and the parent's author as `parentAuthor`. ## 6 · Persistence, export, and restore boundaries diff --git a/docs/architecture/botharness-architecture.md b/docs/architecture/botharness-architecture.md index d8cb6c91fa..beb8a1ad59 100644 --- a/docs/architecture/botharness-architecture.md +++ b/docs/architecture/botharness-architecture.md @@ -522,7 +522,7 @@ Custom Part 是有界像素网格,每格引用外形颜色或固定色并带 新 PersonaBot 记录全域名字种子版本;没有该记录的 PersonaBot 保持仅人类的种子。使用物种、新槽位或 Custom Part 的 recipe 提升 asset/schema 版本,旧 Client 显示保存的快照;既有 recipe 渲染不变。首个切片验证哥布林、左右侧发分片与一个自绘头饰,从编辑器到 Part Library、再到 Window Companion,并经过导出/导入。 -目前已实现:哥布林、精灵、矮人、兽人和花物种,左右侧发分片,胡子,中世纪服装与头饰,全域种子(#1210、#1212–#1214),第一条 Custom Part 路径(#1211),自绘头发(#1238),自绘其他部件(#1240)、部件文件分享(#1215),完整绘制工具(#1216),每片头发单独配色与内置头饰(#1217),以及普通 PNG 导入和派生编辑(#1219)。asset version 4 新增前发、后发和呆毛颜色、单根呆毛,以及与配饰并存、可放内置头饰或 Custom Part 的头饰位;只有 Human 编辑这些项时编辑器才把 recipe 升到 version 4,并把作为配饰戴着的头饰移入头饰位。自绘的前发、侧发或后发会替换对应的内置部件,原来的选择仍会保留;其中发色的像素会像内置头发一样上阴影,所以编辑时从当前样式压平成的格子开始。自绘头饰的 recipe 是 asset version 3。Part Library 是 `avatar-part-library` 模块的 `avatar_part_library` 表(schema generation 73),以部件内容哈希为键,并保存名称、来源和父部件。Client 编辑器通过 `partLibraryList`、`partLibraryAdd`、`partLibraryExport` 和 `partLibraryImport` 四个桥接方法使用它;`part-file` 把单个部件编码为 ×8 预览 PNG,部件数据放在 `botharness-part` tEXt 块中,整个部件库导出为这种 PNG 的 zip,导入时校验每个块的 CRC 并按内容去重;导入 Bot 时其外形穿戴的部件以 `imported-bot` 来源加入部件库,作者为该 Bot 的显示名;编辑器提供带变亮/变暗明暗笔的铅笔、橡皮、四连通填充、按 Shift 锁定角度和正方形的直线与矩形、限定在区域内并带 4×4 或 2×2 Bayer 抖动的明暗渐变、可重新随机的 ±1 明暗杂色、Alt 点击或长按吸管、所有工具的中线镜像、前后两层、每次操作一步撤销(触屏双指撤销、三指重做)、触屏偏移光标和 1× 预览;每个工具的格子都由 BotPixel 计算,结果仍是外形颜色加明暗档位。外形嵌入部件副本,因此部件会随 `.botharness/bot.json` 和 Bot Zip 一起带走。`part-image` 解码部件尺寸(或整数倍放大)的普通 PNG,经 `partLibraryImport` 报告颜色数,`partLibraryImportImage` 保留最常见的颜色(最近色、不抖动),以 `imported-image` 来源存为固定颜色的格子;带部件库父部件保存的部件来源为 `derived`,并以 `parentAuthor` 记录父部件作者。动物物种尚未实现。 +目前已实现:哥布林、精灵、矮人、兽人和花物种,左右侧发分片,胡子,中世纪服装与头饰,全域种子(#1210、#1212–#1214),第一条 Custom Part 路径(#1211),自绘头发(#1238),自绘其他部件(#1240)、部件文件分享(#1215),完整绘制工具(#1216),每片头发单独配色与内置头饰(#1217),普通 PNG 导入和派生编辑(#1219),以及带毛色花纹的动物物种(#1218)。asset version 4 新增前发、后发和呆毛颜色、单根呆毛,以及与配饰并存、可放内置头饰或 Custom Part 的头饰位;只有 Human 编辑这些项时编辑器才把 recipe 升到 version 4,并把作为配饰戴着的头饰移入头饰位。自绘的前发、侧发或后发会替换对应的内置部件,原来的选择仍会保留;其中发色的像素会像内置头发一样上阴影,所以编辑时从当前样式压平成的格子开始。自绘头饰的 recipe 是 asset version 3。Part Library 是 `avatar-part-library` 模块的 `avatar_part_library` 表(schema generation 73),以部件内容哈希为键,并保存名称、来源和父部件。Client 编辑器通过 `partLibraryList`、`partLibraryAdd`、`partLibraryExport` 和 `partLibraryImport` 四个桥接方法使用它;`part-file` 把单个部件编码为 ×8 预览 PNG,部件数据放在 `botharness-part` tEXt 块中,整个部件库导出为这种 PNG 的 zip,导入时校验每个块的 CRC 并按内容去重;导入 Bot 时其外形穿戴的部件以 `imported-bot` 来源加入部件库,作者为该 Bot 的显示名;编辑器提供带变亮/变暗明暗笔的铅笔、橡皮、四连通填充、按 Shift 锁定角度和正方形的直线与矩形、限定在区域内并带 4×4 或 2×2 Bayer 抖动的明暗渐变、可重新随机的 ±1 明暗杂色、Alt 点击或长按吸管、所有工具的中线镜像、前后两层、每次操作一步撤销(触屏双指撤销、三指重做)、触屏偏移光标和 1× 预览;每个工具的格子都由 BotPixel 计算,结果仍是外形颜色加明暗档位。外形嵌入部件副本,因此部件会随 `.botharness/bot.json` 和 Bot Zip 一起带走。`part-image` 解码部件尺寸(或整数倍放大)的普通 PNG,经 `partLibraryImport` 报告颜色数,`partLibraryImportImage` 保留最常见的颜色(最近色、不抖动),以 `imported-image` 来源存为固定颜色的格子;带部件库父部件保存的部件来源为 `derived`,并以 `parentAuthor` 记录父部件作者。 ## 6 · 持久化、导出与恢复边界 diff --git a/docs/assets/pr/1218-animal-species/README.md b/docs/assets/pr/1218-animal-species/README.md new file mode 100644 index 0000000000..545f5b48cf --- /dev/null +++ b/docs/assets/pr/1218-animal-species/README.md @@ -0,0 +1,25 @@ +# #1218 Animal species with fur patterns + +Captured on an isolated DSH instance built from this branch with `@botharness/pixel-avatar` 0.10.0 (BotHarness/BotPixel#18). + +| Species: cat, dog, fox, rabbit, bear | Fur patterns in fur tones | +| ------------------------------------ | ----------------------------------- | +| ![species](species-en-light.webp) | ![patterns](patterns-en-light.webp) | + +| Gray fur recolors the colorpoint pattern | Bunny ears kept but hidden on a cat, with a note | +| ---------------------------------------- | ------------------------------------------------ | +| ![fur](fur-en-light.webp) | ![ears hidden](ears-hidden-en-light.webp) | + +## Window Companion + +The speech is simulated. A test script drives the companion's own mouth layers; no model reply was involved. + +| Speaking as a colorpoint cat with a halo | Close-up (×3, cropped from the screenshot) | +| ---------------------------------------- | -------------------------------------------- | +| ![speaking](speaking-en-light.webp) | ![close-up](companion-closeup-en-light.webp) | + +## Full flow + +![full flow](animal-species-flow.gif) + +The same recording as video: [animal-species-flow.mp4](animal-species-flow.mp4) diff --git a/docs/assets/pr/1218-animal-species/animal-species-flow.gif b/docs/assets/pr/1218-animal-species/animal-species-flow.gif new file mode 100644 index 0000000000..0f1e31053a Binary files /dev/null and b/docs/assets/pr/1218-animal-species/animal-species-flow.gif differ diff --git a/docs/assets/pr/1218-animal-species/animal-species-flow.mp4 b/docs/assets/pr/1218-animal-species/animal-species-flow.mp4 new file mode 100644 index 0000000000..7c48538804 Binary files /dev/null and b/docs/assets/pr/1218-animal-species/animal-species-flow.mp4 differ diff --git a/docs/assets/pr/1218-animal-species/companion-closeup-en-light.webp b/docs/assets/pr/1218-animal-species/companion-closeup-en-light.webp new file mode 100644 index 0000000000..93ef1bf07b Binary files /dev/null and b/docs/assets/pr/1218-animal-species/companion-closeup-en-light.webp differ diff --git a/docs/assets/pr/1218-animal-species/ears-hidden-en-light.webp b/docs/assets/pr/1218-animal-species/ears-hidden-en-light.webp new file mode 100644 index 0000000000..6be2057230 Binary files /dev/null and b/docs/assets/pr/1218-animal-species/ears-hidden-en-light.webp differ diff --git a/docs/assets/pr/1218-animal-species/fur-en-light.webp b/docs/assets/pr/1218-animal-species/fur-en-light.webp new file mode 100644 index 0000000000..74b443371e Binary files /dev/null and b/docs/assets/pr/1218-animal-species/fur-en-light.webp differ diff --git a/docs/assets/pr/1218-animal-species/patterns-en-light.webp b/docs/assets/pr/1218-animal-species/patterns-en-light.webp new file mode 100644 index 0000000000..b0d9f9618c Binary files /dev/null and b/docs/assets/pr/1218-animal-species/patterns-en-light.webp differ diff --git a/docs/assets/pr/1218-animal-species/speaking-en-light.webp b/docs/assets/pr/1218-animal-species/speaking-en-light.webp new file mode 100644 index 0000000000..5c0066f2ae Binary files /dev/null and b/docs/assets/pr/1218-animal-species/speaking-en-light.webp differ diff --git a/docs/assets/pr/1218-animal-species/species-en-light.webp b/docs/assets/pr/1218-animal-species/species-en-light.webp new file mode 100644 index 0000000000..80ed200910 Binary files /dev/null and b/docs/assets/pr/1218-animal-species/species-en-light.webp differ diff --git a/packages/client/src/client/avatar-appearance-editor.tsx b/packages/client/src/client/avatar-appearance-editor.tsx index 36b7c77d7e..ac4a6bcb20 100644 --- a/packages/client/src/client/avatar-appearance-editor.tsx +++ b/packages/client/src/client/avatar-appearance-editor.tsx @@ -9,6 +9,9 @@ import { AVATAR_PIECE_COLORS, AVATAR_PIECE_COLORS_V4, AVATAR_HEADPIECES, + AVATAR_ANIMAL_SPECIES, + AVATAR_PATTERNS, + isAnimalSpecies, AVATAR_STRANDS, withAvatarPieces, withAvatarBuiltInHeadpiece, @@ -73,13 +76,14 @@ const PIECE_COLORS = [ 'backHairColor', 'strandColor', ] as const satisfies readonly string[]; -const V4_KEYS = new Set(['strand', ...AVATAR_PIECE_COLORS_V4]); +const V4_KEYS = new Set(['strand', 'pattern', ...AVATAR_PIECE_COLORS_V4]); const MOVED = new Set(AVATAR_HEADPIECES); const FAMILIES: Record = { illustrated: { parts: { - species: AVATAR_SPECIES, + species: [...AVATAR_SPECIES, ...AVATAR_ANIMAL_SPECIES], + pattern: AVATAR_PATTERNS, ...AVATAR_PARTS_V2, ...AVATAR_HAIR_PARTS, rightSideHair: AVATAR_HAIR_PARTS.sideHair, @@ -98,6 +102,7 @@ const FAMILIES: Record = { categories: [ 'presets', 'species', + 'pattern', 'hair', 'bangs', 'sideHair', @@ -146,6 +151,7 @@ const SPLIT = new Set([ ]); const PART_CATEGORY: Partial> = { headpiece: 'headpiece', + pattern: 'pattern', bangs: 'bangs', sideHair: 'leftSideHair', rightSideHair: 'rightSideHair', @@ -167,7 +173,7 @@ function withPart(recipe: AvatarRecipe, key: string, value: string | number): Av if (recipe.family !== 'illustrated') return { ...(recipe as unknown as Fields), [key]: value } as unknown as AvatarRecipe; if (key === 'species') - return withAvatarSpecies(recipe, value as IllustratedAvatarRecipe['species'] & string); + return withAvatarSpecies(recipe, value as Parameters[1]); if (V4_KEYS.has(key)) { const { [key]: _removed, ...rest } = withAvatarPieces(recipe) as unknown as Fields; return (value === 'none' ? rest : { ...rest, [key]: value }) as unknown as AvatarRecipe; @@ -248,7 +254,9 @@ function categoriesFor( ? !flower : key === 'strand' ? !flower - : true, + : key === 'pattern' + ? isAnimalSpecies(recipe.species) + : true, ); } @@ -1031,6 +1039,11 @@ export function AvatarAppearanceEditor({ id="bh-avatar-panel" aria-labelledby="bh-avatar-tab-headpiece" > + {hiddenFor(draft, 'headpiece') ? ( +

+ {t('profile.avatar.hiddenNote')} +

+ ) : null} {drawing?.slot === 'headpiece' ? ( partEditor() ) : ( diff --git a/packages/client/src/client/locale.ts b/packages/client/src/client/locale.ts index 7327e16711..41f02d3d42 100644 --- a/packages/client/src/client/locale.ts +++ b/packages/client/src/client/locale.ts @@ -1737,6 +1737,17 @@ export const zh = { 'profile.avatar.option.species.dwarf': '矮人', 'profile.avatar.option.species.orc': '兽人', 'profile.avatar.option.species.flower': '花', + 'profile.avatar.option.species.cat': '猫', + 'profile.avatar.option.species.dog': '狗', + 'profile.avatar.option.species.fox': '狐狸', + 'profile.avatar.option.species.rabbit': '兔子', + 'profile.avatar.option.species.bear': '熊', + 'profile.avatar.pattern': '毛色花纹', + 'profile.avatar.option.pattern.solid': '纯色', + 'profile.avatar.option.pattern.tabby': '虎斑', + 'profile.avatar.option.pattern.spots': '斑点', + 'profile.avatar.option.pattern.patches': '奶牛斑', + 'profile.avatar.option.pattern.colorpoint': '重点色', 'profile.avatar.beard': '胡子', 'profile.avatar.option.beard.none': '无', 'profile.avatar.option.beard.short': '短须', @@ -4392,6 +4403,17 @@ My relationship with you, established lore and topics to avoid: [fill in]. 'profile.avatar.option.species.dwarf': 'Dwarf', 'profile.avatar.option.species.orc': 'Orc', 'profile.avatar.option.species.flower': 'Flower', + 'profile.avatar.option.species.cat': 'Cat', + 'profile.avatar.option.species.dog': 'Dog', + 'profile.avatar.option.species.fox': 'Fox', + 'profile.avatar.option.species.rabbit': 'Rabbit', + 'profile.avatar.option.species.bear': 'Bear', + 'profile.avatar.pattern': 'Fur pattern', + 'profile.avatar.option.pattern.solid': 'Solid', + 'profile.avatar.option.pattern.tabby': 'Tabby', + 'profile.avatar.option.pattern.spots': 'Spots', + 'profile.avatar.option.pattern.patches': 'Patches', + 'profile.avatar.option.pattern.colorpoint': 'Colorpoint', 'profile.avatar.beard': 'Beard', 'profile.avatar.option.beard.none': 'None', 'profile.avatar.option.beard.short': 'Short', diff --git a/packages/client/test/avatar-appearance-editor.test.ts b/packages/client/test/avatar-appearance-editor.test.ts index ea7a74a9d0..9ca57030fc 100644 --- a/packages/client/test/avatar-appearance-editor.test.ts +++ b/packages/client/test/avatar-appearance-editor.test.ts @@ -15,6 +15,7 @@ import { AVATAR_PARTS, AVATAR_PRESETS, AVATAR_SPECIES, + AVATAR_ANIMAL_SPECIES, AVATAR_SPECIES_SWATCHES, isIllustratedAvatarRecipe, seededAvatarRecipe, @@ -255,7 +256,7 @@ describe('Profile Avatar Appearance editing', () => { await click('[data-avatar-edit]'); await click('[data-avatar-category="species"]'); expect(container.querySelectorAll('[data-avatar-option^="species:"]')).toHaveLength( - AVATAR_SPECIES.length, + AVATAR_SPECIES.length + AVATAR_ANIMAL_SPECIES.length, ); await click('[data-avatar-option="species:goblin"]'); expect( @@ -1134,6 +1135,61 @@ describe('Profile Avatar Appearance editing', () => { container.remove(); } }); + it('makes an animal with a fur pattern and keeps an ear headpiece hidden with a note', async () => { + Object.assign(globalThis, { IS_REACT_ACT_ENVIRONMENT: true }); + const save = vi.fn(async (_channel: string, _recipe: unknown) => true); + const container = document.createElement('div'); + document.body.append(container); + const root = createRoot(container); + const $ = (selector: string) => container.querySelector(selector); + const click = async (selector: string) => act(() => $(selector)!.click()); + const bot = { + slug: 'ada', + displayName: 'Ada', + roles: [], + aggregateState: 'idle', + workspaces: [], + createdAt: '', + }; + try { + await act(() => + root.render( + createElement(AvatarAppearanceEditor, { + bot, + channelId: 'dm-ada', + onSave: save, + t: zhTranslate, + }), + ), + ); + await click('[data-avatar-edit]'); + expect($('[data-avatar-category="pattern"]')).toBeNull(); + await click('[data-avatar-category="headpiece"]'); + await click('[data-avatar-option="headpiece:bunnyears"]'); + await click('[data-avatar-category="species"]'); + await click('[data-avatar-option="species:cat"]'); + await click('[data-avatar-category="pattern"]'); + await click('[data-avatar-option="pattern:tabby"]'); + await click('[data-avatar-category="nose"]'); + expect($('[data-avatar-hidden-note="nose"]')).not.toBeNull(); + await click('[data-avatar-category="headpiece"]'); + expect($('[data-avatar-hidden-note="headpiece"]')).not.toBeNull(); + await click('[data-avatar-category="colors"]'); + expect($('[data-avatar-option="skinColor:#9aa3ad"]')).not.toBeNull(); + await click('[data-avatar-option="skinColor:#9aa3ad"]'); + await click('[data-avatar-save]'); + expect(save.mock.calls[0]![1]).toMatchObject({ + assetVersion: 4, + species: 'cat', + pattern: 'tabby', + headpiece: 'bunnyears', + skinColor: '#9aa3ad', + }); + } finally { + await act(() => root.unmount()); + container.remove(); + } + }); }); describe('unsupported saved appearance', () => { diff --git a/packages/core/package.json b/packages/core/package.json index e5c6a3b805..7ffed21957 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -14,7 +14,7 @@ "./package.json": "./package.json" }, "dependencies": { - "@botharness/pixel-avatar": "0.9.0", + "@botharness/pixel-avatar": "0.10.0", "@botharness/pixel-banner": "0.1.0", "@resvg/resvg-js": "2.6.2", "silk-wasm": "3.7.1" diff --git a/packages/core/src/bots/avatar-appearance.ts b/packages/core/src/bots/avatar-appearance.ts index 1bff20adc6..d7017d110c 100644 --- a/packages/core/src/bots/avatar-appearance.ts +++ b/packages/core/src/bots/avatar-appearance.ts @@ -49,6 +49,12 @@ export { AVATAR_PIECE_COLORS_V4, AVATAR_STRANDS, AVATAR_HEADPIECES, + AVATAR_ANIMAL_SPECIES, + AVATAR_PATTERNS, + isAnimalSpecies, + type AvatarAnimalSpecies, + type AvatarSpeciesV4, + type AvatarPattern, type AvatarHeadpiece, type AvatarStrand, type AvatarPieceColorV4, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 60977c964a..731f1d11e0 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -568,8 +568,8 @@ importers: packages/core: dependencies: '@botharness/pixel-avatar': - specifier: 0.9.0 - version: 0.9.0 + specifier: 0.10.0 + version: 0.10.0 '@botharness/pixel-banner': specifier: 0.1.0 version: 0.1.0 @@ -1173,8 +1173,8 @@ packages: '@botharness/botui-core@0.3.0': resolution: {integrity: sha512-ZfuyXyAtxIijqxPb7zWKu3/aO3GKT8kTzQpCBYD08t9vOp858r/xL8BsQvwjswTTH2bTZ8saXBnUgjYBRnY8xQ==} - '@botharness/pixel-avatar@0.9.0': - resolution: {integrity: sha512-of+riOr0UhhMfdlqWZLic7sZOTUwzNt9uBTBafw9jMNy9MSc3NgsQ0fbO8Iw5HZM1z/H7nDctxc6+r/dCz8cAA==} + '@botharness/pixel-avatar@0.10.0': + resolution: {integrity: sha512-U3RLvVmrQwROvch7y7kaq/r4tHZTHt6hocf3PReVSRKj7gsZiAupU2nhOUeT7o3GrRtkyGHic0ZboZ8uIpTGoA==} '@botharness/pixel-banner@0.1.0': resolution: {integrity: sha512-2qzZK8O73u9m97sCeQh9s/4QaRsMwCTM42n2HLxCHQNiQp7dYYhulYiYNviasr/9eAGR4ARZr3B06yOCD/Ge1A==} @@ -10790,7 +10790,7 @@ snapshots: '@botharness/botui-core@0.3.0': {} - '@botharness/pixel-avatar@0.9.0': + '@botharness/pixel-avatar@0.10.0': dependencies: '@botharness/pixel-morph': 0.2.0 diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index 1e8c69e40b..4b2b58b0ba 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -308,7 +308,7 @@ minimumReleaseAgeExclude: - '@deepseek-ai/dsh-experimental-schedule-bundle@0.2.0-rc.1' - '@deepseek-ai/dsh-host-product-telemetry-otel@0.2.0-rc.1' - '@deepseek-ai/dsh-otel@0.2.0-rc.1' - - '@botharness/pixel-avatar@0.1.0 || 0.2.0 || 0.3.0 || 0.4.0 || 0.5.0 || 0.6.0 || 0.7.0 || 0.8.0 || 0.9.0' + - '@botharness/pixel-avatar@0.1.0 || 0.2.0 || 0.3.0 || 0.4.0 || 0.5.0 || 0.6.0 || 0.7.0 || 0.8.0 || 0.9.0 || 0.10.0' - '@botharness/pixel-banner@0.1.0' - '@botharness/pixel-morph@0.1.0 || 0.2.0'