feat(chat): custom chat bubbles

Players choose how their chat bubble looks, and everyone sees it.

- style: a gradient of 2 to 5 colour stops (linear at any 45° step,
  radial, or solid), its strength, text and border colours, outline
  thickness 0-4, opacity 25-100%, and an animation (still, pulse, shimmer,
  flow, rainbow) at 40-300% speed. lib/chatstyles.js keeps the one
  canonical form: forgiving for saved accounts, strict for requests.
- in the game: Settings > Chat Bubble > Customize opens an editor with
  presets (Ocean, Sunset, Forest, Midnight, Candy, Rainbow), a palette,
  Swap, Random, Reset and Save, and a live preview. "Custom bubbles: Off"
  draws everyone's bubbles normally on this computer only.
- on the web: the account page has a Chat bubble section with the same
  choices.
- wire: xcs with no fields asks for the saved style, with twelve (or an
  older client's 7, 10 or 11) saves it; the reply is the canonical twelve.
  A typed line ("uc") carries its sender's style after the stock extra
  field, only when it is not the default, so message and type stay where
  the game reads them and unpatched clients are unaffected.

ajclient.swf is built with this and the six client commits before it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
SnipzilandClaude Opus 5.5 committed 2026-10-21 22:42:11 -04:00
1 parent c1a85f9b5d
commit 83c2fc3b0b
14 files changed
+1697 -12

No files matched your search

+11
View File
@@ -158,6 +158,17 @@ const run = async () => {
assert.deepStrictEqual((await b.nextXt("uc")).slice(1), [roomId, String(bobId), "hi & bye", "0"]);
b.send(`<msg t='sys'><body action='pubMsg' r='${roomId}'><txt><![CDATA[7%2]]></txt></body></msg>`); // emote: not echoed
assert.deepStrictEqual((await a.nextXt("uc")).slice(3), ["7", "2"]);
// A saved bubble style is acknowledged with every customization field and
// travels with the next public line so every patched client renders it.
const chatStyle = ["112233", "445566", "ffffff", "abcdef", "85", "flow", "150", "radial", "225", "75", "2", "112233:0;ff0069:45;445566:100"];
b.xt("xcs", roomId, ...chatStyle);
assert.deepStrictEqual((await b.nextXt("xcs")).slice(2), chatStyle);
b.send(`<msg t='sys'><body action='pubMsg' r='${roomId}'><txt><![CDATA[styled%0]]></txt></body></msg>`);
const styledPacket = [roomId, String(bobId), "styled", "0", "", chatStyle.join(",")];
assert.deepStrictEqual((await a.nextXt("uc")).slice(1), styledPacket);
assert.deepStrictEqual((await b.nextXt("uc")).slice(1), styledPacket);
// Actions are sent to every other player in the room. The sender has
// already applied the action locally, so it is not echoed back to them.
b.send(`<msg t='sys'><body action='pubMsg' r='${roomId}'><txt><![CDATA[:sitS:%3%m1]]></txt></body></msg>`);