Custom items made while the server runs, and a Developer role

Staff with the new items.create permission (admins, and the new Developer
role) make clothing and den items from the game's own art: an existing
item under a new id (50000 on), name, price, members-only flag and choice
of its colours. No restart of the server or of anyone's game:

- lib/customitems.js keeps them (custom_items table) and puts them into
  the server's tables and the packs new games fetch (defpacks.setCustomItem)
- games already playing get the def rows in "xdi"; so does every game at
  login. The client adds them (ItemXtCommManager.addItemDefs,
  DenXtCommManager.addDenItemDefs, both now in swf-src; rebuild with
  tools/build-client.sh)
- they are sold first in the two shops of oddities and found by the item
  finder; an item can be renamed, repriced, recoloured and taken off sale,
  never deleted (players may own it)
- the moderator panel has an Items page; in game, "!item clothing|den ID
  NAME" and "!item list"
- the Developer role holds only staff.list and items.create. The panel's
  pages that show players (players, chat, reports, requests, bans,
  paintings) now need player.view, which helpers and up have

test/items.js covers it end to end, including a restart (withServer can
keep its database for that).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
SnipzilandClaude Opus 5.5 committed 2026-10-16 22:43:27 -04:00
1 parent 2fba9f1612
commit 6563d5de99
18 files changed
+3853 -23

No files matched your search

+5 -1
View File
@@ -21,6 +21,7 @@ const MAX_FAVOURITES = 200; // finder items remembered per account
const STARTER_ANIMALS = [1, 4, 5, 6, 7, 8, 13, 18, 24];
let catalog = null;
let catalogVersion = -1; // defpacks.customVersion() it was built at: staff add items as the server runs
const buildCatalog = () => [
...defpacks.clothingIds().map(id => {
@@ -37,7 +38,10 @@ const buildCatalog = () => [
// items that account took most often come first, the latest first among
// equals. (The in-game finder says whose search it is.)
const search = (params, favourites = null) => {
catalog = catalog || buildCatalog();
if (!catalog || catalogVersion !== defpacks.customVersion()) {
catalog = buildCatalog();
catalogVersion = defpacks.customVersion();
}
const kind = params.get("kind") || "all";
const words = (params.get("q") || "").toLowerCase().split(/\s+/).filter(Boolean);
const matches = catalog.filter(entry => (kind === "all" || entry.kind === kind)
+31
View File
@@ -2,6 +2,7 @@
const accounts = require("./accounts.js");
const chatlog = require("./chatlog.js");
const customItems = require("./customitems.js");
const defpacks = require("./defpacks.js");
const disguises = require("./disguises.js");
const dens = require("./dens.js");
@@ -509,6 +510,7 @@ module.exports = ({findOnline, players, watchers, sendItemList, blocks, setHideB
const MAX_STAFF_HOURS = 24 * 365 * 10;
const MAX_WARNING = 200;
const MAX_WARNINGS_SHOWN = 5;
const MAX_ITEMS_LISTED = 8;
const staffMay = (session, permission) => {
const moderation = staffModeration();
@@ -563,6 +565,35 @@ module.exports = ({findOnline, players, watchers, sendItemList, blocks, setHideB
modlog.record(session.account.username, `${action} (in game)`, target.account.username, detail);
const staffCommands = {
// "!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.
// "!item list": the latest made.
item: {
permission: "items.create",
run(session, words) {
const usage = "Use: !item clothing|den ID NAME, or !item list";
if ((words[0] || "").toLowerCase() === "list") {
const latest = customItems.list().slice(0, MAX_ITEMS_LISTED)
.map(entry => `${entry.id} ${entry.name} (${entry.kind === "den" ? "den" : "clothing"}${entry.inShop ? "" : ", off sale"})`);
tell(session, latest.length ? `Latest items made: ${latest.join("; ")}` : "No items made yet.");
return;
}
const kind = (words[0] || "").toLowerCase();
if (!customItems.KINDS.includes(kind) || !/^\d+$/.test(words[1] || "") || words.length < 3) {
tell(session, usage);
return;
}
const result = customItems.create(kind, {base: words[1], name: words.slice(2).join(" ")}, session.account.username);
if (result.error) {
tell(session, result.error);
return;
}
const {item} = result;
tell(session, `Made ${item.name}, ${kind === "den" ? "den item" : "clothing"} ${item.id}. It is in the item finder now.`);
modlog.record(session.account.username, "item made (in game)", "", `${kind} ${item.id} ${item.name}`);
},
},
staff: {
permission: "staff.list",
run(session) {
+229
View File
@@ -0,0 +1,229 @@
"use strict";
const accounts = require("./accounts.js");
const defpacks = require("./defpacks.js");
// items the staff make while the server runs, with no restart of the server
// or of anybody's game. each is an existing item's art (the clothing piece
// or den item it is made from) under an id, name, price and colours of its
// own. the server's tables and the packs new games fetch have it at once
// (defpacks.setCustomItem); games already playing are sent its def row
// ("xdi", which the patched client adds to its tables), and so is every game
// at login, in case it was started before the item was made.
//
// an item is never removed, since players may have it: it can be taken out
// of the shop, renamed and repriced.
// ids far above the game's own (clothing to about 4,600, den items to about
// 6,000), one range per pack; names go under localization ids above the
// server's other added strings (lib/defpacks.js ADDED_STRINGS, 9000001 on).
const FIRST_ID = 50000;
const STRING_BASE = {clothing: 9100000, den: 9200000};
const KINDS = ["clothing", "den"];
const MAX_NAME = 40;
const MAX_COST = 1000000;
const MAX_COLOURS = 16;
const MAX_ITEMS = 5000; // per kind
const CHUNK = 40; // def rows per "xdi" message
const TYPE_CLOTHING = "1";
const OFFERED_SPECIAL_TYPES = ["0", "4"]; // den items that can be copied: plain, mannequin
const CURRENCY_GEMS = "0";
const SCHEMA = `CREATE TABLE IF NOT EXISTS custom_items (
kind TEXT NOT NULL, id INTEGER NOT NULL, base INTEGER NOT NULL, name TEXT NOT NULL,
cost INTEGER NOT NULL, members INTEGER NOT NULL, colors TEXT NOT NULL, in_shop INTEGER NOT NULL,
created_by TEXT NOT NULL, created_at INTEGER NOT NULL, PRIMARY KEY (kind, id))`;
const items = new Map(KINDS.map(kind => [kind, new Map()])); // kind -> id -> entry
let made = 0; // entries in the order they were made (`seq`), for lists
let broadcast = () => {}; // (cmd, ...params) to every game playing; set by lib/world.js
const db = () => accounts.database();
const now = () => Math.floor(Date.now() / 1000);
const baseDef = (kind, id) => (kind === "den" ? defpacks.denItemDef(id) : defpacks.itemDef(id));
// the def row of an entry: its base's row with its own id, name, price and
// colours, always on sale and marked new.
const rowOf = entry => {
const base = baseDef(entry.kind, entry.base);
const own = {
id: String(entry.id),
membersOnly: entry.members ? "1" : "0",
itemStatus: "1",
availabilityStartTime: "0",
availabilityEndTime: "0",
currencyType: CURRENCY_GEMS,
recycleValue: "0",
combinedCost: "",
};
if (entry.kind === "den") {
return {...base, ...own, nameStrId: String(STRING_BASE.den + entry.id - FIRST_ID), cost: String(entry.cost)};
}
return {...base, ...own, titleStrId: String(STRING_BASE.clothing + entry.id - FIRST_ID), value: String(entry.cost), colors: entry.colors.join(","), isGiftable: "1"};
};
const apply = entry => defpacks.setCustomItem(entry.kind, rowOf(entry), entry.name, entry.inShop);
// "xdi" [.., .., kind, json]: def rows with their names, as JSON. a field
// may not hold "%" (lib/sfs.js drops it), so a "%" in a name is written as
// JSON's %.
const messages = entries => {
const out = [];
for (const kind of KINDS) {
const rows = entries.filter(entry => entry.kind === kind).map(entry => ({...rowOf(entry), name: entry.name}));
for (let at = 0; at < rows.length; at += CHUNK) {
out.push([kind, JSON.stringify(rows.slice(at, at + CHUNK)).replace(/%/g, "\\u0025")]);
}
}
return out;
};
const announce = entry => {
for (const params of messages([entry])) {
broadcast("xdi", ...params);
}
};
const fromRow = row => ({
kind: row.kind, id: row.id, base: row.base, name: row.name, cost: row.cost, members: row.members === 1,
colors: row.colors ? row.colors.split(",").map(Number) : [], inShop: row.in_shop === 1, createdBy: row.created_by, createdAt: row.created_at,
});
const load = () => {
db().exec(SCHEMA);
for (const row of db().prepare("SELECT * FROM custom_items ORDER BY rowid").all()) {
const entry = {...fromRow(row), seq: made++};
if (!baseDef(entry.kind, entry.base)) {
console.log(`[custom items] ${entry.kind} ${entry.id} is made from ${entry.base}, which is not in the packs; left out`);
continue;
}
items.get(entry.kind).set(entry.id, entry);
apply(entry);
}
console.log(`[custom items] ${items.get("clothing").size} clothing, ${items.get("den").size} den items`);
};
// checks what staff typed. returns {error} or the cleaned values.
const NAME_PATTERN = /^[\p{L}\p{N} '&!?.,:()#+\-]+$/u;
const clean = (kind, fields, current = null) => {
const out = {};
if (fields.name !== undefined || !current) {
const name = String(fields.name || "").trim().replace(/\s+/g, " ");
if (!name || name.length > MAX_NAME || !NAME_PATTERN.test(name)) {
return {error: `A name of 1 to ${MAX_NAME} letters, numbers, spaces and simple punctuation, please.`};
}
out.name = name;
}
if (fields.cost !== undefined || !current) {
const cost = Number(fields.cost === undefined || fields.cost === "" ? 0 : fields.cost);
if (!Number.isInteger(cost) || cost < 0 || cost > MAX_COST) {
return {error: `A price from 0 to ${MAX_COST} gems, please.`};
}
out.cost = cost;
}
if (fields.members !== undefined || !current) {
out.members = fields.members === true || fields.members === "1" || fields.members === 1;
}
if (fields.inShop !== undefined || !current) {
out.inShop = fields.inShop === undefined ? true : fields.inShop === true || fields.inShop === "1" || fields.inShop === 1;
}
if (kind === "clothing" && (fields.colors !== undefined || !current)) {
const base = baseDef(kind, current ? current.base : fields.base);
const baseColours = String(base.colors).split(",").map(Number);
let colors = fields.colors;
if (colors === undefined || colors === null || colors === "") {
colors = baseColours;
}
else {
colors = (Array.isArray(colors) ? colors : String(colors).split(",")).map(value => Number(String(value).trim()));
}
// a colour is a packed palette number, as in the packs (or a custom colour
// id, lib/colours.js).
if (colors.length === 0 || colors.length > MAX_COLOURS || !colors.every(value => Number.isInteger(value) && value >= 0 && value <= 0xFFFFFFFF)) {
return {error: `1 to ${MAX_COLOURS} colours, each a number as the packs have them.`};
}
out.colors = colors;
}
return out;
};
// makes an item from `base`, an existing clothing piece or den item.
// returns {item} or {error}.
const create = (kind, fields, by) => {
if (!KINDS.includes(kind)) {
return {error: "The kind is clothing or den."};
}
const baseId = Number(fields.base);
const base = Number.isInteger(baseId) ? baseDef(kind, baseId) : null;
if (!base || baseId >= FIRST_ID) {
return {error: `No ${kind === "den" ? "den item" : "clothing"} with the id ${fields.base} to make it from (it must be one of the game's own).`};
}
if (kind === "clothing" && base.type !== TYPE_CLOTHING) {
return {error: `${baseId} is a body part, not clothing.`};
}
if (kind === "den" && !OFFERED_SPECIAL_TYPES.includes(base.specialType)) {
return {error: `Den item ${baseId} does something of its own (a portal, a game, ...) and cannot be copied.`};
}
if (items.get(kind).size >= MAX_ITEMS) {
return {error: "There are as many custom items of that kind as there can be."};
}
const values = clean(kind, {...fields, base: baseId});
if (values.error) {
return values;
}
const id = Math.max(FIRST_ID - 1, ...items.get(kind).keys()) + 1;
const entry = {kind, id, base: baseId, colors: [], ...values, createdBy: String(by), createdAt: now(), seq: made++};
db().prepare("INSERT INTO custom_items (kind, id, base, name, cost, members, colors, in_shop, created_by, created_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)")
.run(kind, id, baseId, entry.name, entry.cost, entry.members ? 1 : 0, entry.colors.join(","), entry.inShop ? 1 : 0, entry.createdBy, entry.createdAt);
items.get(kind).set(id, entry);
apply(entry);
announce(entry);
return {item: entry};
};
// changes the name, price, members-only, colours or whether it is on sale.
const update = (kind, id, fields) => {
const entry = items.has(kind) && items.get(kind).get(Number(id));
if (!entry) {
return {error: "No such custom item."};
}
const values = clean(kind, fields, entry);
if (values.error) {
return values;
}
Object.assign(entry, values);
db().prepare("UPDATE custom_items SET name = ?, cost = ?, members = ?, colors = ?, in_shop = ? WHERE kind = ? AND id = ?")
.run(entry.name, entry.cost, entry.members ? 1 : 0, entry.colors.join(","), entry.inShop ? 1 : 0, kind, entry.id);
apply(entry);
announce(entry);
return {item: entry};
};
const list = () => KINDS.flatMap(kind => [...items.get(kind).values()])
.sort((one, other) => other.seq - one.seq);
module.exports = {
KINDS,
FIRST_ID,
load,
create,
update,
list,
get: (kind, id) => (items.has(kind) && items.get(kind).get(Number(id))) || null,
// the base an item's art is from, for a list showing what each is.
baseName: entry => {
const def = baseDef(entry.kind, entry.base);
return def ? defpacks.string(entry.kind === "den" ? def.nameStrId : def.titleStrId) || String(def.abbrName || entry.base) : String(entry.base);
},
// every custom item, for a game logging in.
sendAll(session) {
for (const params of messages(list().reverse())) {
session.sendXt("xdi", -1, ...params);
}
},
// lib/world.js says how to reach every game playing.
connect(broadcastXt) {
broadcast = broadcastXt;
},
};
+56 -3
View File
@@ -188,7 +188,26 @@ const withLineBreaks = pack => {
return pack;
};
const withAddedStrings = pack => withLineBreaks(withOurName(Object.assign(pack, ADDED_STRINGS, extraMusic.strings())));
// items the staff make while the server runs (lib/customitems.js): an
// existing item's art under a new id, name and price. their rows and names
// are kept here, and go into the packs like the rows above, after the
// renaming (a name staff chose is left as they wrote it).
const customRows = new Map([[DEF_ITEM, new Map()], [DEF_DEN_ITEM, new Map()]]); // pack -> id -> row
const customStrings = {}; // localization id -> name
const customInShop = {clothing: new Set(), den: new Set()}; // ids on sale
let customVersion = 0; // goes up with every change, for anything that keeps a list of items
const withCustomRows = id => pack => {
const at = new Map(Object.entries(pack).map(([key, def]) => [String(def.id), key]));
let next = Math.max(-1, ...Object.keys(pack).map(Number).filter(Number.isInteger)) + 1;
for (const row of customRows.get(id).values()) {
// a changed row replaces the one the pack was made with.
pack[at.has(row.id) ? at.get(row.id) : next++] = {...row};
}
return pack;
};
const withAddedStrings = pack => Object.assign(withLineBreaks(withOurName(Object.assign(pack, ADDED_STRINGS, extraMusic.strings()))), customStrings);
// the extra music tracks (lib/extramusic.js), as den items like the
// official tracks.
@@ -249,8 +268,8 @@ const SHARED_CHANGES = new Map([
[DEF_ROOM, withRestoredRooms],
[DEF_PARTY, withRestoredParties],
[DEF_DEN_ROOM, withoutPrices(DEF_DEN_ROOM, withAddedDens)],
[DEF_DEN_ITEM, withoutPrices(DEF_DEN_ITEM, withExtraMusic)],
[DEF_ITEM, withoutPrices(DEF_ITEM)],
[DEF_DEN_ITEM, withoutPrices(DEF_DEN_ITEM, pack => withCustomRows(DEF_DEN_ITEM)(withExtraMusic(pack)))],
[DEF_ITEM, withoutPrices(DEF_ITEM, withCustomRows(DEF_ITEM))],
[DEF_DIAMOND, withoutPrices(DEF_DIAMOND)],
[DEF_PET, withoutPrices(DEF_PET)],
[DEF_LOCALIZATION_EN, withAddedStrings],
@@ -455,8 +474,42 @@ const init = async () => {
console.log(`[defs] ${avatarDefs.size} avatars, ${roomDefsByPath.size} rooms, ${clothingIds.length} clothing items, ${denItemIds.length} den items, ${petIds.length} pets`);
};
// puts a custom item (lib/customitems.js) in, or changes one already in:
// `kind` "clothing" or "den", `row` its full def row (strings, as in the
// packs), `name` its English name under the row's string id. the server's
// tables have it at once, and the packs clients fetch are made again.
// `inShop` false takes it out of the shop (the ones players have still draw).
const setCustomItem = (kind, row, name, inShop = true) => {
const pack = kind === "den" ? DEF_DEN_ITEM : DEF_ITEM;
const id = Number(row.id);
const stringId = kind === "den" ? row.nameStrId : row.titleStrId;
customRows.get(pack).set(id, row);
customStrings[stringId] = name;
strings[stringId] = name;
stringIds = null;
if (packs.has(pack)) {
packs.set(pack, [...packs.get(pack).filter(def => Number(def.id) !== id), row]);
}
if (kind === "den") {
denItemDefs.set(id, row);
denItemIds = denItemIds.includes(id) ? denItemIds : [...denItemIds, id];
}
else {
itemDefs.set(id, row);
clothingIds = clothingIds.includes(id) ? clothingIds : [...clothingIds, id];
}
customInShop[kind][inShop ? "add" : "delete"](id);
clientPackBodies.delete(pack);
clientPackBodies.delete(DEF_LOCALIZATION_EN);
customVersion++;
};
module.exports = {
init,
setCustomItem,
// the custom items on sale, the newest first.
customShopIds: kind => [...customInShop[kind]].reverse(),
customVersion: () => customVersion,
load,
itemDef: id => itemDefs.get(Number(id)),
clothingIds: () => clothingIds,
+62
View File
@@ -8,6 +8,8 @@ const bans = require("./bans.js");
const captcha = require("./captcha.js");
const chatlog = require("./chatlog.js");
const config = require("../config.js");
const customItems = require("./customitems.js");
const defpacks = require("./defpacks.js");
const limits = require("./limits.js");
const manage = require("./manage.js");
const masterpieces = require("./masterpieces.js");
@@ -376,7 +378,25 @@ const handle = async (req, res, url, from, web) => {
case "GET /mod/api/me":
reply(200, {username: mod.username, role: roles.roleOf(mod), permissions: roles.permissionsOf(mod)});
return;
}
// custom items (lib/customitems.js), for whoever may make them.
if (url.pathname.startsWith("/mod/api/items")) {
if (!roles.can(mod, "items.create")) {
reply(403, {error: "Your role does not allow that."});
return;
}
itemRoutes(route, url, body, reply, done, mod);
return;
}
// everything else shows players and what they did: not for a role that
// only makes things.
if (!roles.can(mod, "player.view")) {
reply(403, {error: "Your role does not allow that."});
return;
}
switch (route) {
case "GET /mod/api/overview":
reply(200, {online: world.players().length, reports: reports.openCount(), requests: support.nameRequests(false).length + bans.openAppeals(),
paintings: masterpieces.list(masterpieces.PENDING).length});
@@ -511,6 +531,48 @@ const handle = async (req, res, url, from, web) => {
}
};
// GET /mod/api/items: the custom items, the newest first.
// GET /mod/api/items/base?kind=clothing|den&id=N: an item of the game's to
// make one from (its name and colours), to check before making it.
// POST /mod/api/items {action: "create", kind, base, name, cost, members, colors}
// or {action: "update", kind, id, and any of name, cost, members, colors, inShop}.
const itemRoutes = (route, url, body, reply, done, mod) => {
switch (route) {
case "GET /mod/api/items":
reply(200, {items: customItems.list().map(entry => ({...entry, baseName: customItems.baseName(entry)})), firstId: customItems.FIRST_ID});
return;
case "GET /mod/api/items/base": {
const kind = url.searchParams.get("kind") === "den" ? "den" : "clothing";
const id = Number(url.searchParams.get("id"));
const def = kind === "den" ? defpacks.denItemDef(id) : defpacks.itemDef(id);
if (!def || id >= customItems.FIRST_ID || (kind === "clothing" && def.type !== "1")) {
reply(404, {error: `No ${kind === "den" ? "den item" : "clothing"} with that id.`});
return;
}
reply(200, kind === "den"
? {kind, id, name: defpacks.string(def.nameStrId) || def.abbrName, art: def.abbrName, cost: Number(def.cost)}
: {kind, id, name: defpacks.string(def.titleStrId), art: Number(def.layerDefId), cost: Number(def.value), colors: String(def.colors).split(",").map(Number)});
return;
}
case "POST /mod/api/items": {
const kind = String(body.kind || "");
const result = body.action === "update"
? customItems.update(kind, body.id, body)
: body.action === "create" ? customItems.create(kind, body, mod.username) : {error: "Unknown action."};
if (result.error) {
done(result);
return;
}
const {item} = result;
done({ok: `${item.name} (${item.kind === "den" ? "den item" : "clothing"} ${item.id}) ${body.action === "update" ? "changed" : "made"}.`},
body.action === "update" ? "item changed" : "item made", "", `${item.kind} ${item.id} ${item.name}`);
return;
}
default:
reply(404, {error: "not_found"});
}
};
const moderators = () => accounts.all().filter(account => roles.roleOf(account))
.map(account => ({username: account.username, role: roles.roleOf(account), twoStep: totp.isOn(account), lastSeen: account.lastSeen || null}))
.sort((a, b) => a.username.localeCompare(b.username));
+7 -2
View File
@@ -14,6 +14,7 @@ const totp = require("./totp.js");
// higher up, and for the admin in the end.
const PERMISSIONS = {
"player.view": "see players, chat, reports, requests, bans and paintings in the moderator panel",
"staff.list": "see which staff are online (!staff)",
"player.warn": "warn a player and send them a message (!warn, !warnings, !message)",
"player.goto": "go to the room a player is in (!goto)",
@@ -23,13 +24,17 @@ const PERMISSIONS = {
"player.ban": "ban, unban and change a ban's reason",
"player.names": "reject or accept a name, clear a bio",
"address.ban": "ban the address a player last signed in from",
"items.create": "make new items from the game's art, and change them (!item)",
};
const HELPER = ["staff.list", "player.warn", "player.goto", "chat.silence"];
const HELPER = ["player.view", "staff.list", "player.warn", "player.goto", "chat.silence"];
const MODERATOR = [...HELPER, "player.kick", "player.summon", "player.ban", "player.names", "address.ban"];
const ADMIN = [...MODERATOR];
const ADMIN = [...MODERATOR, "items.create"];
// a developer makes things, and moderates nobody.
const DEVELOPER = ["staff.list", "items.create"];
const ROLES = {
developer: {rank: 1, label: "Developer", permissions: DEVELOPER},
helper: {rank: 1, label: "Helper", permissions: HELPER},
moderator: {rank: 2, label: "Moderator", permissions: MODERATOR},
admin: {rank: 3, label: "Admin", permissions: ADMIN},
+14 -1
View File
@@ -5,6 +5,7 @@ const achievements = require("./achievements.js");
const adopt = require("./adopt.js");
const config = require("../config.js");
const colours = require("./colours.js");
const customItems = require("./customitems.js");
const roles = require("./roles.js");
const commandModule = require("./commands.js");
const limits = require("./limits.js");
@@ -314,6 +315,9 @@ const login = (session, msg) => {
for (const chunk of colours.chunks()) {
session.sendXt("xcc", -1, chunk.length, ...chunk.flat());
}
// and the items staff have made (lib/customitems.js), for a game started
// before they were.
customItems.sendAll(session);
sendFilter(session);
buddies.announce(account);
};
@@ -423,6 +427,8 @@ const sortStock = () => {
// has the den items, the one in the Zios archives the clothing. see
// oddDenItemIds in lib/defpacks.js.
const ODDITY_SHOPS = new Map([[396, () => defpacks.oddDenItemIds()], [666, () => defpacks.oddClothingIds()]]);
// the items staff have made (lib/customitems.js) are sold there too, first.
const CUSTOM_ITEM_SHOPS = new Map([[396, "den"], [666, "clothing"]]);
const ticketStock = kind => sortStock()[kind];
// the den shops of the lands (Coral Canyons, Deep Blue) and the one inside
// a den: lists that mix kinds, selling den rooms.
@@ -475,6 +481,13 @@ const makeColour = (account, rgbs, asker = null) => {
return entry;
};
// a message for every game playing (custom items, lib/customitems.js).
customItems.connect((cmd, ...params) => {
for (const session of online.values()) {
session.sendXt(cmd, -1, ...params);
}
});
// the account's chat filter, for its game to apply: [chosen, level, mode, own words].
const sendFilter = session => {
const {filter} = session.account;
@@ -688,7 +701,7 @@ const handlers = {
else if (ODDITY_SHOPS.has(Number(listId))) {
// what the shop really sold comes first.
const real = shopStock.list(listId, type);
entries = [...new Set([...(real ? real.entries : []), ...ODDITY_SHOPS.get(Number(listId))()])];
entries = [...new Set([...defpacks.customShopIds(CUSTOM_ITEM_SHOPS.get(Number(listId))), ...(real ? real.entries : []), ...ODDITY_SHOPS.get(Number(listId))()])];
}
else if (Number(listId) === DIAMOND_DEN_LIST) {
entries = defpacks.diamondIds().filter(id => {