mirror of
https://github.com/burrow-dev/burrow-server.git
synced 2026-11-18 17:27:50 -05:00
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:
1 parent
7dee29010a
commit
5c9b2e0066
11 files changed
+389
-29
No files matched your search
+104
-1
@@ -4,6 +4,7 @@ const accounts = require("./accounts.js");
|
||||
const chatlog = require("./chatlog.js");
|
||||
const customItems = require("./customitems.js");
|
||||
const itemControl = require("./itemcontrol.js");
|
||||
const wearRules = require("./wearrules.js");
|
||||
const modNotes = require("./modnotes.js");
|
||||
const defpacks = require("./defpacks.js");
|
||||
const disguises = require("./disguises.js");
|
||||
@@ -73,7 +74,10 @@ module.exports = ({findOnline, players, watchers, sendItemList, blocks, setHideB
|
||||
const {account} = session;
|
||||
const avatar = activeAvatar(account);
|
||||
const before = wornItems(account, avatar);
|
||||
const wanted = account.items.filter(item => invs.includes(item.inv)).slice(0, MAX_WORN);
|
||||
// Saved outfits are a second equip route, so they obey the same rule as
|
||||
// the item editor. A saved id remains in the outfit in case staff later
|
||||
// remove the rule; it simply cannot be put on while blocked.
|
||||
const wanted = account.items.filter(item => invs.includes(item.inv) && wearRules.mayWear(item.def, avatar.type)).slice(0, MAX_WORN);
|
||||
const takenOff = before.filter(item => !wanted.includes(item));
|
||||
account.outfitUndo = {avInvId: avatar.avInvId, items: before.map(item => item.inv)};
|
||||
for (const item of takenOff) {
|
||||
@@ -596,6 +600,59 @@ module.exports = ({findOnline, players, watchers, sendItemList, blocks, setHideB
|
||||
};
|
||||
|
||||
const staffCommands = {
|
||||
// A short-lived room control for owners, admins and developers. It uses
|
||||
// the avatar protocol rather than persisting any player appearance.
|
||||
roomfx: {
|
||||
permission: "room.effects",
|
||||
run(session, words) {
|
||||
const room = session.room;
|
||||
const effect = (words[0] || "").toLowerCase();
|
||||
if (!room || !["small", "normal", "big", "rainbow", "clear"].includes(effect)) {
|
||||
tell(session, "Use: !roomfx small, !roomfx normal, !roomfx big, !roomfx rainbow, or !roomfx clear");
|
||||
return;
|
||||
}
|
||||
const send = (type, value) => {
|
||||
for (const target of room.sessions) {
|
||||
for (const viewer of room.sessions) {
|
||||
viewer.sendXt("uc", room.id, target.id, String(value), type);
|
||||
}
|
||||
}
|
||||
};
|
||||
const stopRainbow = () => {
|
||||
if (room.roomEffectTimer) {
|
||||
clearInterval(room.roomEffectTimer);
|
||||
delete room.roomEffectTimer;
|
||||
}
|
||||
};
|
||||
if (effect === "rainbow") {
|
||||
stopRainbow();
|
||||
let hue = 0;
|
||||
room.roomEffectTimer = setInterval(() => {
|
||||
if (room.sessions.size === 0) {
|
||||
stopRainbow();
|
||||
return;
|
||||
}
|
||||
const colour = [0xFF4040, 0xFFB340, 0xF8FF40, 0x50E860, 0x40CFFF, 0x7560FF, 0xDC55FF][hue++ % 7];
|
||||
send(8, colour);
|
||||
}, 350);
|
||||
room.roomEffectTimer.unref();
|
||||
tell(session, "Rainbow effect started for everyone in this room. !roomfx clear stops it.");
|
||||
}
|
||||
else {
|
||||
stopRainbow();
|
||||
if (effect === "small" || effect === "big" || effect === "normal") {
|
||||
send(14, effect === "small" ? 0.7 : effect === "big" ? 1.35 : 1);
|
||||
tell(session, `Everyone in this room is now ${effect === "normal" ? "normal size" : effect}.`);
|
||||
}
|
||||
else {
|
||||
send(8, 0);
|
||||
send(14, 1);
|
||||
tell(session, "Room effects cleared.");
|
||||
}
|
||||
}
|
||||
modlog.record(session.account.username, "room effect (in game)", "", `${effect}: ${roomTitle(room)}`);
|
||||
},
|
||||
},
|
||||
// "!item clothing|den ID NAME": a new item made from the game's item ID
|
||||
// (lib/customitems.js), free, every colour of the one it is made from;
|
||||
// everyone has it at once. the moderator panel's Items page does more.
|
||||
@@ -633,6 +690,38 @@ module.exports = ({findOnline, players, watchers, sendItemList, blocks, setHideB
|
||||
tell(session, on.length ? `Staff online: ${on.join(", ")}` : "No staff online.");
|
||||
},
|
||||
},
|
||||
// Opens the same in-game moderation window as a player's card. This is
|
||||
// useful when a moderator already knows the name and does not need to
|
||||
// hunt through search results first.
|
||||
mod: {
|
||||
permission: "player.view",
|
||||
run(session, words) {
|
||||
const target = words.length ? findOnline(words.join(" ")) : null;
|
||||
if (!target) {
|
||||
tell(session, words.length ? `${words.join(" ")} is not online.` : "Use: !mod PLAYER");
|
||||
return;
|
||||
}
|
||||
if (target.account !== session.account && roles.roleOf(target.account) && !roles.outranks(session.account, target.account)) {
|
||||
tell(session, "Staff of your rank or above are for someone higher up to deal with.");
|
||||
return;
|
||||
}
|
||||
session.sendXt("xui", -1, "moderate", target.account.username);
|
||||
},
|
||||
},
|
||||
// Owners, admins and developers get the room-effects panel from chat.
|
||||
// `host` is an intuitive alias for event hosts.
|
||||
event: {
|
||||
permission: "room.effects",
|
||||
run(session) {
|
||||
session.sendXt("xui", -1, "event");
|
||||
},
|
||||
},
|
||||
host: {
|
||||
permission: "room.effects",
|
||||
run(session) {
|
||||
session.sendXt("xui", -1, "event");
|
||||
},
|
||||
},
|
||||
// "!note PLAYER text": a note for the other staff (lib/modnotes.js),
|
||||
// never shown to the player. "!notes PLAYER": the latest few.
|
||||
note: {
|
||||
@@ -681,6 +770,20 @@ module.exports = ({findOnline, players, watchers, sendItemList, blocks, setHideB
|
||||
setInvisible(session, !session.invisible);
|
||||
},
|
||||
},
|
||||
reject: {
|
||||
permission: "player.names",
|
||||
run(session, words) {
|
||||
withTarget(session, words, "Use: !reject PLAYER", true, target => {
|
||||
if (target.account.nameRejected) {
|
||||
tell(session, `${target.account.username}'s name is already rejected.`);
|
||||
return;
|
||||
}
|
||||
staffModeration().actions.rejectName(target.account, session.account.username);
|
||||
tell(session, `${target.account.username} was signed out and must choose a new name.`);
|
||||
logged(session, "rejected username", target);
|
||||
});
|
||||
},
|
||||
},
|
||||
// "!lock clothing|den ID", "!unlock clothing|den ID", "!locked": items
|
||||
// kept out of the item finder for players (lib/itemcontrol.js).
|
||||
lock: {
|
||||
|
||||
Reference in new issue
Block a user