Brought up to date with the private repository (15f0c27)

This commit is contained in:
S committed 2026-10-15 10:18:44 +03:00
1 parent 1b1df1ae48
commit 9d50e0a6fd
2 files changed
+12 -8

No files matched your search

+1 -1
View File
@@ -321,7 +321,7 @@ module.exports = ({findOnline, players, watchers, sendItemList, blocks, setHideB
// lib/disguises.js
become(session, [choice]) {
if (!choice || choice === "list") {
tell(session, `You can become: ${disguises.names().join(", ")}, or any character by its number. !become off to be yourself.`);
tell(session, `You can become: ${disguises.names().join(", ")}. !become off to be yourself.`);
return;
}
if (choice === "off") {
+11 -7
View File
@@ -30,23 +30,27 @@ const NPC_PHANTOM = 2; // what the client draws when no id is given
const TYPE_CLIP = "0";
const TYPE_ANIMAL = "1"; // an ordinary animal in an outfit: the villagers of the adventures
// the names "!become" takes, with the NPC each is.
// the names "!become" takes, with the NPC each is: the alphas and the
// phantom, nothing else. numbers are not taken: most of the NPC table is
// the adventures' set pieces and bosses, drawn at a size that fills the
// screen.
const NAMED = new Map([
["peck", 20], ["liza", 21], ["greely", 22], ["graham", 23], ["gilbert", 24], ["cosmo", 25], ["tavie", 219],
["phantom", NPC_PHANTOM],
]);
const ALLOWED = new Set(NAMED.values());
// is this NPC one a player can be drawn as? clips with no artwork (two
// rows have none) would leave them invisible.
// is this NPC one a player can be drawn as? only those named above, and
// only with artwork. a disguise saved before the list was this short is
// ignored, so it falls away by itself.
const usable = id => {
const def = defpacks.npcDef(id);
const def = ALLOWED.has(id) && defpacks.npcDef(id);
return Boolean(def) && (def.type === TYPE_ANIMAL || (def.type === TYPE_CLIP && Number(def.mediaRefId) > 0));
};
// the NPC id for what a player typed (a name above or a number), or null.
// the NPC id for what a player typed (a name above), or null.
const find = text => {
const word = String(text).toLowerCase();
const id = NAMED.has(word) ? NAMED.get(word) : /^\d{1,4}$/.test(word) ? Number(word) : NaN;
const id = NAMED.get(String(text).toLowerCase());
return usable(id) ? id : null;
};