feat(world): expand events, rewards, and den behavior

Add owner/developer room-effect controls and chat shortcuts, staff movement that bypasses full or locked destinations, in-game moderation entry points, theatre video synchronization, and shared room effects.

Restore game and trade popups, reliably award refreshments and game rewards, support pet play outside parties, correct den placement categories, improve den item persistence, and refresh custom-item and masterpiece behavior.

Harden room, party, pet, minigame, and item state handling with matching feature and restored-system regression coverage.
This commit is contained in:
Snipzil committed 2026-10-19 10:09:50 -04:00
1 parent 7dee29010a
commit 5c9b2e0066
11 files changed
+389 -29

No files matched your search

+15 -3
View File
@@ -1,6 +1,7 @@
"use strict";
const defpacks = require("./defpacks.js");
const wearRules = require("./wearrules.js");
// accessors over an account's animals, pets and items (shape: accounts.js).
// SbiConstants.CURRENCY_NAMES; an item's currencyType indexes into this.
@@ -32,13 +33,24 @@ const avatarById = (account, perUserAvId) =>
const activePet = account => account.pets.find(pet => pet.inv === activeAvatar(account).petInvId) || null;
const wornItems = (account, avatar) => account.items.filter(item => item.on.includes(avatar.avInvId));
// The persisted state is also filtered here, not only where a player tries
// to put an item on. That keeps an old/corrupt pairing from reaching player
// cards or other people in a room while a dashboard rule is being applied.
const wornItems = (account, avatar) => account.items.filter(item => item.on.includes(avatar.avInvId)
&& wearRules.mayWear(item.def, avatar.type));
// item.EquippedAvatars: comma-separated 32-bit words, one bit per avInvId of
// an animal wearing the item.
const equippedBits = item => {
// With an account, omit stale pairings that are no longer allowed. The full
// inventory protocol otherwise exposes those bits and a later avatar switch
// can appear to revive a prohibited item.
const equippedBits = (item, account = null) => {
const words = [0];
for (const avInvId of item.on) {
const wornBy = account ? item.on.filter(avInvId => {
const avatar = account.avatars.find(candidate => candidate.avInvId === avInvId);
return avatar && wearRules.mayWear(item.def, avatar.type);
}) : item.on;
for (const avInvId of wornBy) {
const word = avInvId >>> 5;
while (words.length <= word) {
words.push(0);