mirror of
https://github.com/burrow-dev/burrow-server.git
synced 2026-11-18 17:27:50 -05:00
feat: two worlds, rooms of 40, random spawn with space
- rooms hold 40 players. a player not starting in their den arrives in a random room of config.spawnRooms that has space (AJ_SPAWN_ROOMS overrides); with every one full, the emptiest, over the cap. - two worlds, Aldan and Congo (AJ_WORLDS sets how many): each its own copy of every land, dens and parties shared. a player arrives in a random world with space and keeps it through dens and parties. - the settings menu's World row is back: the server sends the worlds' names (generic list 16) and the world list (rm), and the client asks for the names once at login. a buddy's "go to" leads into their world, whose name the buddy card shows. "Find Open World" (on by default) joins a full room in a world with space. - the panels show the world with the room. the test harness pins one world and the township. buildVersion 60.
This commit is contained in:
1 parent
b813d89cfa
commit
31cbd87ff8
7 files changed
+161
-25
No files matched your search
@@ -120,7 +120,7 @@ module.exports = {
|
|||||||
// 41: the game's text says "Burrow" where it said Animal Jam.
|
// 41: the game's text says "Burrow" where it said Animal Jam.
|
||||||
// 48: the item giver (the item finder renamed) with previews and hex colours;
|
// 48: the item giver (the item finder renamed) with previews and hex colours;
|
||||||
// 49 and 50: its link to a colour picker.
|
// 49 and 50: its link to a colour picker.
|
||||||
buildVersion: env.AJ_BUILD_VERSION || "57",
|
buildVersion: env.AJ_BUILD_VERSION || "60",
|
||||||
// what the official CDN is asked for; not ours to change.
|
// what the official CDN is asked for; not ours to change.
|
||||||
upstreamBuildVersion: "3",
|
upstreamBuildVersion: "3",
|
||||||
|
|
||||||
@@ -250,8 +250,21 @@ module.exports = {
|
|||||||
{room: "appondale.room_museum", shown: "appondale.room_museum_ant", months: [2, 4, 6, 8, 10, 12]},
|
{room: "appondale.room_museum", shown: "appondale.room_museum_ant", months: [2, 4, 6, 8, 10, 12]},
|
||||||
],
|
],
|
||||||
startupRoom: "jamaa_township.room_main",
|
startupRoom: "jamaa_township.room_main",
|
||||||
shards: [{id: 1, name: "Aldan"}],
|
// where a player who does not start in their den arrives: one of these at
|
||||||
maxUsersPerRoom: 80,
|
// random, of those that are not full (lib/world.js). AJ_SPAWN_ROOMS: a
|
||||||
|
// list of its own, comma-separated (the tests' is the township alone).
|
||||||
|
spawnRooms: env.AJ_SPAWN_ROOMS ? env.AJ_SPAWN_ROOMS.split(",").map(room => room.trim()).filter(Boolean)
|
||||||
|
: ["jamaa_township.room_main", "sarepia.room_main", "crystal_sands.room_main", "coral_canyons.room_main",
|
||||||
|
"mountains_of_shivveer.room_main", "appondale.room_main", "lost_temple_of_zios.room_main", "aussie.room_main", "balloosh.room_main"],
|
||||||
|
// the worlds, each its own copy of every land (rooms are "path#world";
|
||||||
|
// dens and parties are everyone's). a player arrives in one at random and
|
||||||
|
// can switch in the settings menu (gui.ServerSelector). the game names
|
||||||
|
// world N after the Nth name of its own list (551 Aldan, 552 Congo...,
|
||||||
|
// generic list 16), so the names here are only for the panels and logs.
|
||||||
|
// AJ_WORLDS: how many (the tests' is one).
|
||||||
|
shards: ["Aldan", "Congo", "Draa", "Grande", "Kama", "Nile", "Pecos", "Ramu", "Tigris", "Zambezi"]
|
||||||
|
.slice(0, Math.min(10, Math.max(1, Number(env.AJ_WORLDS) || 2))).map((name, i) => ({id: i + 1, name})),
|
||||||
|
maxUsersPerRoom: 40,
|
||||||
// everything in every shop for nothing (AJ_FREE_SHOPS=1). off unless
|
// everything in every shop for nothing (AJ_FREE_SHOPS=1). off unless
|
||||||
// asked for: what the game's shops make of a price of 0 has not been seen.
|
// asked for: what the game's shops make of a price of 0 has not been seen.
|
||||||
freeShops: env.AJ_FREE_SHOPS === "1",
|
freeShops: env.AJ_FREE_SHOPS === "1",
|
||||||
|
|||||||
+8
-3
@@ -40,7 +40,7 @@ const requestsPerTenMinutes = limits.limiter(20, 600000);
|
|||||||
// and reads a hosted party's name as three string ids.
|
// and reads a hosted party's name as three string ids.
|
||||||
const roomTitle = room => room.displayName;
|
const roomTitle = room => room.displayName;
|
||||||
|
|
||||||
module.exports = ({findOnline, onBlocked, onUnblocked, partyTimeLeft}) => {
|
module.exports = ({findOnline, onBlocked, onUnblocked, partyTimeLeft, worldOf, worldName}) => {
|
||||||
// BuddyXtCommManager.buddyStatusResponse: [1, username, uuid, moderatedFlag,
|
// BuddyXtCommManager.buddyStatusResponse: [1, username, uuid, moderatedFlag,
|
||||||
// online, accountType, buddyFlag, avatarName, perUserAvId, partyTimeLeft]
|
// online, accountType, buddyFlag, avatarName, perUserAvId, partyTimeLeft]
|
||||||
const sendStatus = (to, account, buddyFlag) => {
|
const sendStatus = (to, account, buddyFlag) => {
|
||||||
@@ -195,11 +195,16 @@ module.exports = ({findOnline, onBlocked, onUnblocked, partyTimeLeft}) => {
|
|||||||
// gets [roomName, displayName, displayNameStringId, cannotGoThere]; an
|
// gets [roomName, displayName, displayNameStringId, cannotGoThere]; an
|
||||||
// empty room means offline. the last field greys out the card's "go to"
|
// empty room means offline. the last field greys out the card's "go to"
|
||||||
// button (BuddyCard.checkBuddyRoomAgainstMine), so it is 0: every room
|
// button (BuddyCard.checkBuddyRoomAgainstMine), so it is 0: every room
|
||||||
// here can be walked into. someone who blocked the asker looks offline.
|
// here can be walked into. the room's name carries its world, and "go
|
||||||
|
// to" joins it by that name, so it leads into the buddy's world, which
|
||||||
|
// is named after the room when it is not the asker's. someone who
|
||||||
|
// blocked the asker looks offline.
|
||||||
br(session, roomId, [username]) {
|
br(session, roomId, [username]) {
|
||||||
const target = findOnline(username);
|
const target = findOnline(username);
|
||||||
if (target && target.room && !target.account.blocked.includes(key(session.account))) {
|
if (target && target.room && !target.account.blocked.includes(key(session.account))) {
|
||||||
session.sendXt("br", -1, target.room.name, roomTitle(target.room), 0, 0);
|
const world = worldOf(target.room.name);
|
||||||
|
const elsewhere = world !== 0 && world !== session.worldId;
|
||||||
|
session.sendXt("br", -1, target.room.name, `${roomTitle(target.room)}${elsewhere ? ` (${worldName(world)})` : ""}`, 0, 0);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
session.sendXt("br", -1, "", "", 0, 0);
|
session.sendXt("br", -1, "", "", 0, 0);
|
||||||
|
|||||||
+116
-14
@@ -42,6 +42,14 @@ const {CURRENCIES, DIAMOND_TYPES, activeAvatar, avatarById, activePet, equippedB
|
|||||||
|
|
||||||
const GENERIC_LIST_AVATARS = 64;
|
const GENERIC_LIST_AVATARS = 64;
|
||||||
const GENERIC_LIST_NEWSPAPER = 627;
|
const GENERIC_LIST_NEWSPAPER = 627;
|
||||||
|
// the worlds' names (ServerSelector.getShardName): localization ids, the
|
||||||
|
// game's own river names, world N being the Nth.
|
||||||
|
const GENERIC_LIST_WORLD_NAMES = 16;
|
||||||
|
const WORLD_NAME_IDS = Array.from({length: 29}, (_, i) => 551 + i);
|
||||||
|
// the settings menu's "Find Open World" switch (gui.MySettings
|
||||||
|
// SETTINGS_AUTO_SERVER_TRAVEL): a set bit is off. on, a room that is full in
|
||||||
|
// the player's world is joined in another world that has space.
|
||||||
|
const SETTING_FIND_OPEN_WORLD = 3;
|
||||||
const USER_VAR_NEWSPAPER_READ = 455;
|
const USER_VAR_NEWSPAPER_READ = 455;
|
||||||
const USER_VAR_GEM_BONUS = 214;
|
const USER_VAR_GEM_BONUS = 214;
|
||||||
// not one of the game's: the patched client's "hide blocked players" setting
|
// not one of the game's: the patched client's "hide blocked players" setting
|
||||||
@@ -137,6 +145,19 @@ const THEME_PATH_PREFIX = "theme_"; // lib/http.js looks for this
|
|||||||
const chatLines = limits.limiter(config.chatLinesPerWindow, config.chatWindowMs);
|
const chatLines = limits.limiter(config.chatLinesPerWindow, config.chatWindowMs);
|
||||||
const online = new Map(); // lowercased username -> session
|
const online = new Map(); // lowercased username -> session
|
||||||
const rooms = new Map(); // "path.name#shard" -> room
|
const rooms = new Map(); // "path.name#shard" -> room
|
||||||
|
|
||||||
|
// worlds (config.shards): a land room's name ends in "#<world>"; dens,
|
||||||
|
// parties and adventures have none and belong to no world. each player has
|
||||||
|
// a world (session.worldId), picked when they arrive and changed by walking
|
||||||
|
// into a room of another.
|
||||||
|
const worldOf = name => {
|
||||||
|
const found = /#(\d+)$/.exec(name || "");
|
||||||
|
return found && config.shards.some(shard => shard.id === Number(found[1])) ? Number(found[1]) : 0;
|
||||||
|
};
|
||||||
|
const worldName = id => (config.shards.find(shard => shard.id === id) || {name: `World ${id}`}).name;
|
||||||
|
const inWorld = id => [...online.values()].filter(session => session.worldId === id);
|
||||||
|
const findOpenWorld = account => !((Number((account.userVars || {})[USER_VAR_SETTINGS]) >> SETTING_FIND_OPEN_WORLD) & 1)
|
||||||
|
|| Number((account.userVars || {})[USER_VAR_SETTINGS]) < 0;
|
||||||
let nextRoomId = 100;
|
let nextRoomId = 100;
|
||||||
|
|
||||||
const others = session => session.room ? [...session.room.sessions].filter(s => s !== session) : [];
|
const others = session => session.room ? [...session.room.sessions].filter(s => s !== session) : [];
|
||||||
@@ -618,6 +639,23 @@ const handlers = {
|
|||||||
// defPack. list contents live on the official servers, so apart from the two
|
// defPack. list contents live on the official servers, so apart from the two
|
||||||
// kinds that can be rebuilt from defPacks every list is answered empty; that
|
// kinds that can be rebuilt from defPacks every list is answered empty; that
|
||||||
// still releases whatever the client had waiting on it.
|
// still releases whatever the client had waiting on it.
|
||||||
|
// the settings menu's world list (ServerSelector, GamePlay.showServerSelectorMore):
|
||||||
|
// a node's name, then each world as id, language, how full (0 to 4, 4
|
||||||
|
// being full) and how many of the player's buddies are in it. the game
|
||||||
|
// leaves out the world the player is in.
|
||||||
|
rm(session) {
|
||||||
|
const fields = [];
|
||||||
|
const capacity = config.spawnRooms.length * config.maxUsersPerRoom;
|
||||||
|
for (const shard of config.shards) {
|
||||||
|
const here = inWorld(shard.id);
|
||||||
|
const full = config.spawnRooms.every(base => roomFull(`${base}#${shard.id}`));
|
||||||
|
const bars = full ? 4 : Math.min(3, Math.ceil(4 * here.length / capacity));
|
||||||
|
const buddyCount = here.filter(other => session.account.buddies.includes(other.account.username.toLowerCase())).length;
|
||||||
|
fields.push(shard.id, LANG_ENG, bars, buddyCount);
|
||||||
|
}
|
||||||
|
session.sendXt("rm", -1, "burrow", ...fields);
|
||||||
|
},
|
||||||
|
|
||||||
gl(session, roomId, [listId]) {
|
gl(session, roomId, [listId]) {
|
||||||
if (Number(listId) === GENERIC_LIST_NEWSPAPER) {
|
if (Number(listId) === GENERIC_LIST_NEWSPAPER) {
|
||||||
// the client decides whether to pop the newspaper open when this list
|
// the client decides whether to pop the newspaper open when this list
|
||||||
@@ -635,6 +673,9 @@ const handlers = {
|
|||||||
if (Number(listId) === GENERIC_LIST_AVATARS) {
|
if (Number(listId) === GENERIC_LIST_AVATARS) {
|
||||||
entries = defpacks.avatarTypes();
|
entries = defpacks.avatarTypes();
|
||||||
}
|
}
|
||||||
|
else if (Number(listId) === GENERIC_LIST_WORLD_NAMES) {
|
||||||
|
entries = WORLD_NAME_IDS;
|
||||||
|
}
|
||||||
else if (defpacks.patternList(listId)) {
|
else if (defpacks.patternList(listId)) {
|
||||||
entries = defpacks.patternList(listId);
|
entries = defpacks.patternList(listId);
|
||||||
}
|
}
|
||||||
@@ -929,7 +970,9 @@ const context = {
|
|||||||
tell: (...args) => tell(...args),
|
tell: (...args) => tell(...args),
|
||||||
leaveRoom: (...args) => leaveRoom(...args),
|
leaveRoom: (...args) => leaveRoom(...args),
|
||||||
ask: (...args) => ask(...args),
|
ask: (...args) => ask(...args),
|
||||||
travel: (session, base) => joinRoom(session, `${base}#${config.shards[0].id}`),
|
travel: (session, base) => joinRoom(session, `${base}#${session.worldId || config.shards[0].id}`),
|
||||||
|
worldOf,
|
||||||
|
worldName,
|
||||||
joinRoom: (...args) => joinRoom(...args),
|
joinRoom: (...args) => joinRoom(...args),
|
||||||
reloadRoom: session => reloadRoom(session),
|
reloadRoom: session => reloadRoom(session),
|
||||||
buyAgain: session => handlers[session.lastPurchase.cmd](session, session.lastPurchase.roomId, session.lastPurchase.params),
|
buyAgain: session => handlers[session.lastPurchase.cmd](session, session.lastPurchase.roomId, session.lastPurchase.params),
|
||||||
@@ -1106,8 +1149,11 @@ const enterRoom = (session, name, base, displayName, shardId, props = {}) => {
|
|||||||
if (room && room === session.room) {
|
if (room && room === session.room) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// moderators (marked so in the admin panel) are let into a full room.
|
// moderators (marked so in the admin panel) are let into a full room, and
|
||||||
if (room && room.sessions.size >= config.maxUsersPerRoom && !session.account.moderator) {
|
// so is a player arriving when every spawn room is full (spawnRoom).
|
||||||
|
const overflow = session.spawnOverflow;
|
||||||
|
session.spawnOverflow = false;
|
||||||
|
if (room && room.sessions.size >= config.maxUsersPerRoom && !session.account.moderator && !overflow) {
|
||||||
joinFailed(session, "This room is currently full");
|
joinFailed(session, "This room is currently full");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -1120,6 +1166,13 @@ const enterRoom = (session, name, base, displayName, shardId, props = {}) => {
|
|||||||
}
|
}
|
||||||
room.sessions.add(session);
|
room.sessions.add(session);
|
||||||
session.room = room;
|
session.room = room;
|
||||||
|
// a land room is in a world, which is the player's now; a den or a party
|
||||||
|
// is in none, and the game is told the world the player was in, which it
|
||||||
|
// goes back to when they walk out (RoomManagerWorld.shardId).
|
||||||
|
if (worldOf(name)) {
|
||||||
|
session.worldId = worldOf(name);
|
||||||
|
}
|
||||||
|
const worldId = session.worldId || shardId;
|
||||||
if (props.denOwner && props.denOwner !== session.account) {
|
if (props.denOwner && props.denOwner !== session.account) {
|
||||||
noteDenVisit(props.denOwner, session.account);
|
noteDenVisit(props.denOwner, session.account);
|
||||||
}
|
}
|
||||||
@@ -1141,7 +1194,7 @@ const enterRoom = (session, name, base, displayName, shardId, props = {}) => {
|
|||||||
avatar.petInvId,
|
avatar.petInvId,
|
||||||
LANG_ENG,
|
LANG_ENG,
|
||||||
room.customMusicDef,
|
room.customMusicDef,
|
||||||
shardId);
|
worldId);
|
||||||
dens.sendRoomProperties(session, roomAsSeenBy(session, room));
|
dens.sendRoomProperties(session, roomAsSeenBy(session, room));
|
||||||
|
|
||||||
for (const other of others(session)) {
|
for (const other of others(session)) {
|
||||||
@@ -1153,8 +1206,8 @@ const enterRoom = (session, name, base, displayName, shardId, props = {}) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const sendHome = session => {
|
const sendHome = session => {
|
||||||
const shard = config.shards[0];
|
const shard = session.worldId || config.shards[0].id;
|
||||||
enterRoom(session, `${config.startupRoom}#${shard.id}`, config.startupRoom, roomInfo.name(config.startupRoom), shard.id);
|
enterRoom(session, `${config.startupRoom}#${shard}`, config.startupRoom, roomInfo.name(config.startupRoom), shard);
|
||||||
};
|
};
|
||||||
|
|
||||||
const emptyRoom = name => {
|
const emptyRoom = name => {
|
||||||
@@ -1216,6 +1269,37 @@ const onUnblocked = (session, target) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// a world for a player arriving: one at random of those whose spawn rooms
|
||||||
|
// are not all full; with every one full, the emptiest.
|
||||||
|
const pickWorld = () => {
|
||||||
|
const open = config.shards.filter(shard => config.spawnRooms.some(base => !roomFull(`${base}#${shard.id}`)));
|
||||||
|
if (open.length > 0) {
|
||||||
|
return open[Math.floor(Math.random() * open.length)].id;
|
||||||
|
}
|
||||||
|
return config.shards.reduce((emptiest, shard) => (inWorld(shard.id).length < inWorld(emptiest.id).length ? shard : emptiest)).id;
|
||||||
|
};
|
||||||
|
|
||||||
|
const roomFull = name => {
|
||||||
|
const room = rooms.get(name);
|
||||||
|
return Boolean(room) && room.sessions.size >= config.maxUsersPerRoom;
|
||||||
|
};
|
||||||
|
|
||||||
|
// a spawn room (config.spawnRooms) at random, of those with space; with
|
||||||
|
// all of them full, the emptiest, which lets this player in over the cap.
|
||||||
|
const spawnRoom = (session, shardId) => {
|
||||||
|
const known = config.spawnRooms.filter(base => defpacks.roomDef(base));
|
||||||
|
if (known.length === 0) {
|
||||||
|
return config.startupRoom;
|
||||||
|
}
|
||||||
|
const open = known.filter(base => !roomFull(`${base}#${shardId}`));
|
||||||
|
if (open.length > 0) {
|
||||||
|
return open[Math.floor(Math.random() * open.length)];
|
||||||
|
}
|
||||||
|
const size = base => (rooms.get(`${base}#${shardId}`) || {sessions: new Set()}).sessions.size;
|
||||||
|
session.spawnOverflow = true;
|
||||||
|
return known.reduce((emptiest, base) => (size(base) < size(emptiest) ? base : emptiest));
|
||||||
|
};
|
||||||
|
|
||||||
const joinRoom = (session, requested) => {
|
const joinRoom = (session, requested) => {
|
||||||
// "jamaa_township.room_main#-1": path, then shard (-1 = pick one for me).
|
// "jamaa_township.room_main#-1": path, then shard (-1 = pick one for me).
|
||||||
let [base, shardText] = requested.split("@")[0].split("#");
|
let [base, shardText] = requested.split("@")[0].split("#");
|
||||||
@@ -1240,23 +1324,41 @@ const joinRoom = (session, requested) => {
|
|||||||
// non-buddy's until then: it is sent ahead of the first room, as the
|
// non-buddy's until then: it is sent ahead of the first room, as the
|
||||||
// client takes it unasked (BuddyManager.buddyListResponseHandler).
|
// client takes it unasked (BuddyManager.buddyListResponseHandler).
|
||||||
handlers.bl(session);
|
handlers.bl(session);
|
||||||
|
// the game asks for world -1 ("pick one for me") unless it is going back
|
||||||
|
// to one (after a reconnect, say).
|
||||||
|
session.worldId = worldOf(`#${shardText}`) || pickWorld();
|
||||||
const {startInDen, startRoom, username} = session.account;
|
const {startInDen, startRoom, username} = session.account;
|
||||||
const den = startInDen ? username : /^den/i.test(startRoom || "") ? startRoom.slice(3) : null;
|
const den = startInDen ? username : /^den/i.test(startRoom || "") ? startRoom.slice(3) : null;
|
||||||
if (den !== null && accounts.byName(den)) {
|
if (den !== null && accounts.byName(den)) {
|
||||||
joinDen(session, `den${den}`);
|
joinDen(session, `den${den}`);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// any other name asked for that is a room here; else the usual one.
|
// any other name asked for that is a room here and has space; else one
|
||||||
|
// of the spawn rooms that has, so nobody's login ends at "room is full".
|
||||||
const asked = (startRoom || "").split("#")[0].toLowerCase();
|
const asked = (startRoom || "").split("#")[0].toLowerCase();
|
||||||
if (!startInDen && defpacks.roomDef(asked) && !asked.startsWith("den")) {
|
const shardId = session.worldId;
|
||||||
base = asked;
|
base = !startInDen && defpacks.roomDef(asked) && !asked.startsWith("den") && !roomFull(`${asked}#${shardId}`)
|
||||||
}
|
? asked : spawnRoom(session, shardId);
|
||||||
|
shardText = String(shardId);
|
||||||
|
}
|
||||||
|
// switching worlds (the settings menu's world list asks for the township of
|
||||||
|
// the one picked): a full room there is swapped for one with space.
|
||||||
|
else if (worldOf(`#${shardText}`) && session.worldId && worldOf(`#${shardText}`) !== session.worldId
|
||||||
|
&& roomFull(`${base}#${shardText}`) && config.spawnRooms.includes(base)) {
|
||||||
|
base = spawnRoom(session, Number(shardText));
|
||||||
}
|
}
|
||||||
if (!defpacks.roomDef(base) || base.startsWith("den")) {
|
if (!defpacks.roomDef(base) || base.startsWith("den")) {
|
||||||
joinFailed(session, `Room "${requested}" is not supported by this server`);
|
joinFailed(session, `Room "${requested}" is not supported by this server`);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const shard = config.shards.find(s => s.id === Number(shardText)) || config.shards[0];
|
// a world that is not one here (-1, or one the game made up because every
|
||||||
|
// world was full) is the player's own.
|
||||||
|
let shard = config.shards.find(s => s.id === Number(shardText)) || config.shards.find(s => s.id === session.worldId) || config.shards[0];
|
||||||
|
// full there: with "Find Open World" on, the same room in a world that
|
||||||
|
// has space (moderators get into a full room anyway).
|
||||||
|
if (roomFull(`${base}#${shard.id}`) && !session.account.moderator && findOpenWorld(session.account)) {
|
||||||
|
shard = config.shards.find(other => !roomFull(`${base}#${other.id}`)) || shard;
|
||||||
|
}
|
||||||
enterRoom(session, `${base}#${shard.id}`, base, roomInfo.name(base), shard.id);
|
enterRoom(session, `${base}#${shard.id}`, base, roomInfo.name(base), shard.id);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1268,7 +1370,7 @@ const joinDen = (session, requested) => {
|
|||||||
// room like any other (lib/epicdens.js). A player of that name comes first.
|
// room like any other (lib/epicdens.js). A player of that name comes first.
|
||||||
const showcase = owner ? null : epicDens.byName(requested.slice(3));
|
const showcase = owner ? null : epicDens.byName(requested.slice(3));
|
||||||
if (showcase) {
|
if (showcase) {
|
||||||
const shard = config.shards[0].id;
|
const shard = session.worldId || config.shards[0].id;
|
||||||
enterRoom(session, `${showcase.base}#${shard}`, showcase.base, showcase.name, shard);
|
enterRoom(session, `${showcase.base}#${shard}`, showcase.base, showcase.name, shard);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -1587,7 +1689,7 @@ module.exports = {
|
|||||||
return "There is no such room";
|
return "There is no such room";
|
||||||
}
|
}
|
||||||
minigames.leave(session);
|
minigames.leave(session);
|
||||||
const shard = config.shards[0].id;
|
const shard = session.worldId || config.shards[0].id;
|
||||||
enterRoom(session, `${base}#${shard}`, base, roomInfo.name(base), shard);
|
enterRoom(session, `${base}#${shard}`, base, roomInfo.name(base), shard);
|
||||||
return null;
|
return null;
|
||||||
},
|
},
|
||||||
@@ -1627,7 +1729,7 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
players: () => [...online.values()].map(session => ({
|
players: () => [...online.values()].map(session => ({
|
||||||
username: session.account.username,
|
username: session.account.username,
|
||||||
room: session.room ? session.room.name : null,
|
room: session.room ? session.room.name.replace(/#(\d+)$/, (whole, id) => (worldOf(whole) ? ` (${worldName(Number(id))})` : whole)) : null,
|
||||||
address: session.address,
|
address: session.address,
|
||||||
})),
|
})),
|
||||||
};
|
};
|
||||||
@@ -218,15 +218,13 @@ package gui
|
|||||||
"frame":"redeemCode",
|
"frame":"redeemCode",
|
||||||
"labelTxt":24819,
|
"labelTxt":24819,
|
||||||
"btnTxt":24820
|
"btnTxt":24820
|
||||||
/* the game's "World" row (choose a server) is out: there is one
|
|
||||||
world, this server does not answer the list it asks for (rm),
|
|
||||||
and the picker then waited behind its spinner for ever.
|
|
||||||
},{
|
},{
|
||||||
|
// the world picker (gui.ServerSelector): the server's worlds,
|
||||||
|
// config.shards, listed by the server's answer to "rm"
|
||||||
"type":TOGGLE_TYPE_JOIN,
|
"type":TOGGLE_TYPE_JOIN,
|
||||||
"frame":"world",
|
"frame":"world",
|
||||||
"labelTxt":6395,
|
"labelTxt":6395,
|
||||||
"btnTxt":6366
|
"btnTxt":6366
|
||||||
*/
|
|
||||||
},{
|
},{
|
||||||
"type":TOGGLE_TYPE_TOGGLE_BTN,
|
"type":TOGGLE_TYPE_TOGGLE_BTN,
|
||||||
"frame":"nameBadge",
|
"frame":"nameBadge",
|
||||||
|
|||||||
@@ -145,6 +145,9 @@ package room
|
|||||||
|
|
||||||
private var _shardId:int;
|
private var _shardId:int;
|
||||||
|
|
||||||
|
// whether the worlds' names were asked for (chosenLoginFinished)
|
||||||
|
private static var _askedWorldNames:Boolean;
|
||||||
|
|
||||||
public var _gotNewShardId:Boolean;
|
public var _gotNewShardId:Boolean;
|
||||||
|
|
||||||
private var _forceInvisMode:Boolean;
|
private var _forceInvisMode:Boolean;
|
||||||
@@ -2603,6 +2606,17 @@ package room
|
|||||||
{
|
{
|
||||||
if(_mainBackObj == null)
|
if(_mainBackObj == null)
|
||||||
{
|
{
|
||||||
|
// the worlds' names (generic list 16), which the game asked for on
|
||||||
|
// its world screen at login: this server has none, and without
|
||||||
|
// them the settings menu's World row and the world picker
|
||||||
|
// (ServerSelector) have no names, and the picker never opens.
|
||||||
|
// asked once: with the names in, fillNamesArray asks for the
|
||||||
|
// world list instead, whose answer needs the picker open.
|
||||||
|
if(!_askedWorldNames)
|
||||||
|
{
|
||||||
|
_askedWorldNames = true;
|
||||||
|
ServerSelector.fillNamesArray();
|
||||||
|
}
|
||||||
if(!gMainFrame.userInfo.avtDefsCached)
|
if(!gMainFrame.userInfo.avtDefsCached)
|
||||||
{
|
{
|
||||||
if(ItemXtCommManager.itemDefsHaveLoaded)
|
if(ItemXtCommManager.itemDefsHaveLoaded)
|
||||||
|
|||||||
Binary file not shown.
+5
-1
@@ -151,7 +151,11 @@ const postJson = (url, body) => fetch(url, {
|
|||||||
const withServer = async (name, httpPort, gamePort, run) => {
|
const withServer = async (name, httpPort, gamePort, run) => {
|
||||||
const dataDir = fs.mkdtempSync(path.join(os.tmpdir(), "aj-test-"));
|
const dataDir = fs.mkdtempSync(path.join(os.tmpdir(), "aj-test-"));
|
||||||
const server = spawn(process.execPath, [path.join(__dirname, "..", "server.js")], {
|
const server = spawn(process.execPath, [path.join(__dirname, "..", "server.js")], {
|
||||||
env: {...process.env, AJ_HTTP_PORT: httpPort, AJ_GAME_PORT: gamePort, AJ_DATA_DIR: dataDir, AJ_QUIET: "1"},
|
env: {...process.env, AJ_HTTP_PORT: httpPort, AJ_GAME_PORT: gamePort, AJ_DATA_DIR: dataDir, AJ_QUIET: "1",
|
||||||
|
// everyone arrives in the township, as the tests expect
|
||||||
|
AJ_SPAWN_ROOMS: process.env.AJ_SPAWN_ROOMS || "jamaa_township.room_main",
|
||||||
|
// and in the one world
|
||||||
|
AJ_WORLDS: process.env.AJ_WORLDS || "1"},
|
||||||
stdio: ["ignore", "pipe", "inherit"],
|
stdio: ["ignore", "pipe", "inherit"],
|
||||||
});
|
});
|
||||||
let output = "";
|
let output = "";
|
||||||
|
|||||||
Reference in new issue
Block a user