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

+4
View File
@@ -61,6 +61,7 @@ const USER_VAR_SETTINGS = 363; // the settings menu's switches, a bit each (gui.
// the chat filter an account starts with: level 1 slurs and threats, mode 1
// the whole message left out (see account.filter below).
const DEFAULT_FILTER = {level: 1, mode: 1, words: ""};
const chatStyles = require("./chatstyles.js");
const MAX_PASSWORD_LENGTH = 100;
const EMAIL_PATTERN = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
// parts of the game a player can switch off for their own account, each
@@ -250,6 +251,9 @@ const normalize = account => {
// the name tag: colour in the low byte, badge above it, bit 16 hides the
// adventure level shape (avatar.NameBar.setColorAndBadge).
account.nameBarData = Number.isInteger(account.nameBarData) ? account.nameBarData : 0;
// Personal chat appearance. The renderer receives it with each spoken line
// (lib/world.js), never as a client-controlled packet field.
account.chatStyle = chatStyles.normalize(account.chatStyle);
account.disguise = Number.isInteger(account.disguise) ? account.disguise : 0; // NPC id, see lib/disguises.js
// shown on the player's card: lib/badges.js.
account.discord = typeof account.discord === "string" ? account.discord : ""; // their Discord username, as Discord gave it (lib/discord.js)