diff --git a/config.js b/config.js index 4c1d7c1..b3b69dd 100644 --- a/config.js +++ b/config.js @@ -173,7 +173,8 @@ module.exports = { // 61: the Owner, Moderator, Developer and Verified name tag badges seen by everyone. // 62: "Custom pictures" in the settings menu, to hide players' item pictures. // 83: den items tinted (the tint in their version, DenItemHelper.applyTint). - buildVersion: env.AJ_BUILD_VERSION || "83", + // 84: fixes from the owner's list of bugs (bugs.txt, 2026-10-23). + buildVersion: env.AJ_BUILD_VERSION || "84", // what the official CDN is asked for; not ours to change. upstreamBuildVersion: "3", @@ -381,6 +382,8 @@ module.exports = { chatLogDays: env.AJ_CHAT_LOG_DAYS === undefined ? 30 : Math.max(0, Number(env.AJ_CHAT_LOG_DAYS) || 0), chatLinesPerWindow: 5, // typed chat lines one player may send ... chatWindowMs: 3000, // ... in this long + roomActionsPerWindow: 6, // emotes, actions and the like one player may send a room ... + roomActionWindowMs: 3000, // ... in this long (the rest reach nobody) maxBytesPerTenSeconds: 512 * 1024, // per game socket; saving a full den is about 40 KB // custom colours (lib/colours.js). every one ever made is sent to every // player at every login and is never taken out again, so there is an end diff --git a/lib/defpacks.js b/lib/defpacks.js index 0de025f..1f7af3d 100644 --- a/lib/defpacks.js +++ b/lib/defpacks.js @@ -181,6 +181,13 @@ const ADDED_STRINGS = { 9000004: "Crystal Palace (concept)", // the buddy game the client's files call "fourGem"; no string says so. 9000005: "Four Gems", + // a shop's title when its room gives it none (lib/world.js SHOP_KIND_TITLES) + 9000010: "Clothing Shop", + 9000011: "Den Shop", + 9000012: "Den Rooms", + 9000013: "Shop", + 9000014: "Exchange", + 9000015: "Diamond Shop", }; // the game under this server's name. its text says "Animal Jam", "Animal diff --git a/lib/ecards.js b/lib/ecards.js index a91c1d2..ddf9288 100644 --- a/lib/ecards.js +++ b/lib/ecards.js @@ -51,10 +51,15 @@ const INBOX_FULL = -1; const NOT_ACCEPTING = -2; const FAILED = 0; -// who may send to a player (ECardInbox's settings popup). +// who may send to a player, as kept (account.ecardPrivacy). const FROM_EVERYONE = 0; const FROM_BUDDIES = 1; const FROM_NOBODY = 2; +// ECardInbox's settings popup sends the place of the option picked, and its +// artwork has Nobody first and Everyone last: the other way round from the +// above. turned over both ways between the two (buddies is in the middle). +const SETTING_COUNT = 3; +const turnedOver = value => SETTING_COUNT - 1 - value; const LIST_CARDS = 10; const LIST_STAMPS = 44; @@ -345,7 +350,7 @@ module.exports = ({findOnline, blocks}) => { // [setting] -> eCardIsolationHandler: [success] ei(session, roomId, [setting]) { - const value = Number(setting); + const value = turnedOver(Number(setting)); const valid = [FROM_EVERYONE, FROM_BUDDIES, FROM_NOBODY].includes(value); if (valid) { session.account.ecardPrivacy = value; @@ -374,5 +379,7 @@ module.exports = ({findOnline, blocks}) => { return card ? senderOf(card) : null; }; - return {handlers, list, unread, redemptions, sendFromHq, noteFromHq, secretSender, SECRET_NAME: "Secret Valentine"}; + // the setting as the inbox's settings popup shows it (above) + const privacyShown = account => turnedOver(account.ecardPrivacy || FROM_EVERYONE); + return {handlers, list, unread, redemptions, privacyShown, sendFromHq, noteFromHq, secretSender, SECRET_NAME: "Secret Valentine"}; }; diff --git a/lib/roominfo.js b/lib/roominfo.js index 0f124ed..b80362c 100644 --- a/lib/roominfo.js +++ b/lib/roominfo.js @@ -14,8 +14,9 @@ const defpacks = require("./defpacks.js"); // then AMF3), so reading it here costs no extra download once anyone has // been in the room. -// what the room editor left in files nobody named. -const UNNAMED = "Display Name"; +// what the room editor left in files nobody named ("default": the museum's +// theatre). +const UNNAMED = ["display name", "default"]; // rooms whose file has no name and whose path does not spell it either. const NAMES = new Map([ ["jamaa_township.room_diamonds", "Diamond Shop"], @@ -24,6 +25,9 @@ const NAMES = new Map([ ["aussie.room_main", "Kimbara Outback"], ["aussie.room_aushop", "Outback Imports"], ["aussie.room_hos", "Medical Center"], + ["appondale.room_museumtheater", "Museum Theater"], + ["crystal_sands.room_tiertheater", "Tierney's Theater"], + ["lost_temple_of_zios.bb_theater", "Temple Theater"], ]); const VOLUME_SHOP = 12; // ActorVolume.type: clicking it opens generic list `typeDefId` @@ -37,7 +41,7 @@ const parse = body => { const settings = (room.actors.ActorSettings || [])[0] || {}; const volumes = room.actors.ActorVolume || []; return { - name: typeof settings.name === "string" && settings.name.trim() !== UNNAMED ? settings.name.trim() : "", + name: typeof settings.name === "string" && !UNNAMED.includes(settings.name.trim().toLowerCase()) ? settings.name.trim() : "", shops: new Set(volumes.filter(volume => Number(volume.type) === VOLUME_SHOP).map(volume => Number(volume.typeDefId))), }; }; diff --git a/lib/world.js b/lib/world.js index ea34210..45f6cec 100644 --- a/lib/world.js +++ b/lib/world.js @@ -129,6 +129,11 @@ const DEF_DEN_ROOM = 1040; const DEF_CURRENCY_EXCHANGE = 1051; const DEF_DIAMOND = 1054; const SHOP_LIST_TYPES = [DEF_ITEM, DEF_DEN_ITEM, DEF_DEN_ROOM, DEF_COMBINED_LIST, DEF_CURRENCY_EXCHANGE, DEF_DIAMOND]; +// a shop's title when its room gives it none (a shop in a land's main room, +// or one opened from elsewhere): what it sells (strings in lib/defpacks.js). +// with no title the shop window's banner was blank. +const SHOP_KIND_TITLES = new Map([[DEF_ITEM, 9000010], [DEF_DEN_ITEM, 9000011], [DEF_DEN_ROOM, 9000012], + [DEF_COMBINED_LIST, 9000013], [DEF_CURRENCY_EXCHANGE, 9000014], [DEF_DIAMOND, 9000015]]); // diamond lists the client reads at login to learn which animals and pets // cost diamonds. they stay empty: animals and pets are free here. const DIAMOND_ANIMAL_AND_PET_LISTS = [166, 214, 293]; @@ -150,6 +155,9 @@ const TYPED_NAME = /^[A-Za-z0-9][A-Za-z0-9 '.-]{0,19}$/; // an animal's or pet's const nameFiltered = name => !String(name).includes("|") && Boolean(chatFilter.broken(String(name))); const MAX_BLOCKED = 1000; // from the account page; the game's own button has no limit const TYPED_CHAT_TYPES = ["0", "9"]; +// UserCommXtCommManager's safe chat phrase (1), emote (2), action (3), +// attachment (4), slide (6) and pet action (7) +const MOMENTARY_TYPES = ["1", "2", "3", "4", "6", "7"]; const MAX_CHAT_EXTRA = 100; // the field after a chat line's type const MAX_USER_VARS = 2000; const MAX_FILTER_WORDS = 100; // a player's own words for their chat filter @@ -163,6 +171,9 @@ const LOGIN_OUTDATED = -12; const THEME_PATH_PREFIX = "theme_"; // lib/http.js looks for this const chatLines = limits.limiter(config.chatLinesPerWindow, config.chatWindowMs); +// emotes, actions, attachments: each goes to everyone in the room, so a +// player pressing one over and over slowed a busy room for all of them. +const roomActions = limits.limiter(config.roomActionsPerWindow, config.roomActionWindowMs); const online = new Map(); // lowercased username -> session const rooms = new Map(); // "path.name#shard" -> room const gameActivityListeners = new Set(); @@ -290,7 +301,7 @@ const loginParams = session => { playerWallSettings: account.wall.privacy, // not 0: PlayerWallManager only opens walls for accounts with them on. webWallStatus: 1, - eCardPrivacySettings: account.ecardPrivacy, + eCardPrivacySettings: ecards.privacyShown(account), // not empty: with neither address set, every fifth login opens a // "parent's email" window (GuiManager.showAjEmailBtn). accounts here // have no email. @@ -924,7 +935,7 @@ const handlers = { } // for shops the first unused field is the title's string id; left empty // it keeps the shop window's own title (Shop.gotItemListCallback). - const title = SHOP_LIST_TYPES.includes(type) ? (session.room ? roomInfo.shopTitle(session.room.base, listId) : "") : 0; + const title = SHOP_LIST_TYPES.includes(type) ? (session.room && roomInfo.shopTitle(session.room.base, listId)) || SHOP_KIND_TITLES.get(type) : 0; session.sendXt("gl", -1, listId, type, title, 0, 0, 0, count === undefined ? entries.length : count, ...entries); }, @@ -1888,6 +1899,10 @@ module.exports = { // local client deliberately does not draw it optimistically, unlike // typed chat and normal emotes. const attachmentEcho = fields[1] === "4"; + // A phrase from the phrase menus is drawn from the echo too (the + // patched UserCommXtCommManager.sendAvatarSafeChat), so that it + // comes in the sender's chat bubble style, as typed chat does. + const phrase = fields[1] === "1"; // silenced, or chat switched off on the account page: the line // goes nowhere. if (echo && (moderation.isSilenced(session.account) || !accounts.featureOn(session.account, "chat"))) { @@ -1900,6 +1915,14 @@ module.exports = { session.sendXt("uc", session.room.id, session.id, -1, 5); return; } + // the momentary ones (a phrase, an emote, an action, an attachment, + // a slide, a pet's trick), past a few in a few seconds, reach + // nobody: the sender has shown their own already. what sets a + // state (a colour, see-through, a lasting emote) always goes, or + // others would be left seeing the wrong one. + if (MOMENTARY_TYPES.includes(fields[1]) && !limits.isTrustedLocal(session.address) && !roomActions.allow(session.account.id)) { + return; + } if (echo) { // "!help" and the like (lib/commands.js). A command's line is // still echoed to its sender, whose chat bubble waits for it. @@ -1945,14 +1968,14 @@ module.exports = { // its style. Keeping message and type at their original indexes is // what clears the local "..." bubble; carrying the style on the // same packet prevents it being lost or applied to a later line. - const style = echo ? chatStyles.packet(session.account.chatStyle) : ""; - for (const recipient of (echo || attachmentEcho) ? session.room.sessions : others(session)) { + const style = echo || phrase ? chatStyles.packet(session.account.chatStyle) : ""; + for (const recipient of (echo || attachmentEcho || phrase) ? session.room.sessions : others(session)) { if (session.invisible && recipient !== session && !roles.isActiveStaff(recipient.account)) { continue; } if (recipient === session || (!blocks.has(recipient.account, session.account) && (!echo || accounts.featureOn(recipient.account, "chat")))) { recipient.sendXt("uc", session.room.id, session.id, - ...(echo && style ? [fields[0], fields[1], fields[2] || "", style] : fields)); + ...((echo || phrase) && style ? [fields[0], fields[1], fields[2] || "", style] : fields)); } } } diff --git a/public/game.html b/public/game.html index 3970464..4e15433 100644 --- a/public/game.html +++ b/public/game.html @@ -249,6 +249,41 @@ .aj-box-close:hover { background: radial-gradient(circle at 50% 35%, #ff8f74, #d93d22 70%); } + /* a video spot's box (ajVideoSpot): a screen of the theatre's size with + a link box under it, over the middle of the stage */ + #spot { + --s: 1; + --px: calc(var(--s) * 1px); + position: fixed; + inset: 0; + z-index: 3; + pointer-events: none; + font-family: "DigitalDelivery", Arial, Helvetica, sans-serif; + } + #spot[hidden], #spot [hidden] { + display: none !important; + } + #spot-box { + left: 50%; + top: 50%; + transform: translate(-50%, -50%); + width: calc(548 * var(--px)); + } + #spot-screen { + width: calc(512 * var(--px)); + height: calc(288 * var(--px)); + background: #000; + border: calc(2 * var(--px)) solid #7f6744; + border-radius: calc(6 * var(--px)); + overflow: hidden; + margin-bottom: calc(10 * var(--px)); + } + #spot-screen > * { + width: 100%; + height: 100%; + border: 0; + display: block; + } .aj-box-said { min-height: calc(15 * var(--px)); margin: calc(8 * var(--px)) 0 0; @@ -286,6 +321,19 @@
+