feat(rust): RaidableBases — feed, raids map layer, Warlord, Spawn a raid base, profiles (PLAN_REDESIGNS §11.4)
All checks were successful
PR Checks / server-tests (pull_request) Successful in 37s
PR Checks / client-build (pull_request) Successful in 24s
PR Checks / frozen-manifest (pull_request) Successful in 49s

PLAN_REDESIGNS §11.4 (D202-D208, D386-D391), protocol 14. Spec: docs
rust-link/PROTOCOL.md §20.12.

- raid.started, raid.completed, raid.purchased and raid.locked public,
  raid.ended staff's; raidableBases.js reads each row per viewer (raiders'
  and a buyer's names only for the presence audience, D376/D390; Steam ids,
  position and a run's key only for staff). Feed lines in the World filter.
- The step rust.raidbase.spawn, "Spawn a raid base" (ledgered, budget
  rust.raids): difficulty, profile and base from option sources listing each
  server's own names (D386), a spot as a world call's location with a height
  adjustment or an exact height, and PvP/NPCs/lock as on/off/blank. A base
  the raids helper made is a world resource, so eventWorld's revert and
  reconcile serve it and world.expired marks it expired; one it did not make
  records nothing and the run log says it despawns on its own timer. Refused
  at verify for a server that said it cannot; a dry run with a spot returns
  the spot check as detail.warnings (MODULE_API 1.16.0, D391). rb-not-ready
  retries in ten minutes.
- Warlord: raids_completed, title category raidscompleted, the leaderboard's
  Raid bases column (sort=raidsCompleted).
- The map's raids layer (D114), public by default with its own audience; the
  run's key is dropped before any viewer gets it.
- Server settings' line for RaidableBases; its profiles in Mod configuration
  under a virtual path (D205).
- Swagger fragment, bundle and README.

Tests: server 684/684 (raidableBases.test.js new, every name in it invented);
client 99/99, build and externals.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01E14m6SuuY6i1vASFeGDBeY
This commit is contained in:
2026-10-16 15:18:52 -05:00
parent 49d9e42a23
commit 481837e937
34 changed files with 1996 additions and 38 deletions

View File

@@ -59,6 +59,12 @@ export const FEED_KINDS = Object.freeze([
// like a treasure. A timeout (`gc.failed`) is staff's; the map shows it go.
'gc.started',
'gc.ended',
// RaidableBases (§11.4): a base appearing, raided, bought or locked to a
// player, read per viewer; its despawn (`raid.ended`) is staff's, and the map shows it go.
'raid.started',
'raid.completed',
'raid.purchased',
'raid.locked',
])
/** The filters the feed offers, and the kinds each one asks the API for. */
@@ -73,7 +79,7 @@ export const FILTERS = Object.freeze([
},
{ id: 'server', label: 'Server', kinds: ['server.wipe', 'server.initialized', 'server.shutdown'] },
{ id: 'bosses', label: 'Bosses', kinds: ['npc.boss.spawned', 'npc.boss.died'] },
{ id: 'world', label: 'World events', kinds: ['world.event', 'pvp.zone.created', 'dt.started', 'dt.won', 'gc.started', 'gc.ended'] },
{ id: 'world', label: 'World events', kinds: ['world.event', 'pvp.zone.created', 'dt.started', 'dt.won', 'gc.started', 'gc.ended', 'raid.started', 'raid.completed', 'raid.purchased', 'raid.locked'] },
])
export function kindsFor(filterId) {
@@ -177,6 +183,13 @@ export function describe(row) {
case 'gc.failed':
return guardedLine(row.kind, frame)
case 'raid.started':
case 'raid.completed':
case 'raid.ended':
case 'raid.purchased':
case 'raid.locked':
return raidLine(row.kind, frame)
default:
return { tone: 'other', actor: name, verb: String((row && row.kind) || 'unknown'), subject: null, detail: '' }
}
@@ -407,4 +420,46 @@ function guardedLine(kind, frame) {
: { tone: 'kill', actor: null, verb: 'The guarded crate was cleared', subject: null, detail }
}
/** "Alice", "Alice and Bob", "Alice, Bob and 3 others". */
export function raiderNames(names, count) {
const shown = (names || []).slice(0, 2)
const rest = Math.max(0, (Number(count) || shown.length) - shown.length)
if (shown.length === 0) return null
if (rest === 0) return shown.length === 2 ? `${shown[0]} and ${shown[1]}` : shown[0]
return `${shown.join(', ')} and ${rest} other${rest === 1 ? '' : 's'}`
}
/**
* RaidableBases (protocol 14, PLAN_REDESIGNS §11.4). The server has read the
* frame for this viewer: `grid`, the plugin's own `difficulty` name (D386), `pvp`,
* and the raiders' `names` or a buyer's `name` only for the presence audience
* (D376, D390); `raiderCount` for everyone.
*/
function raidLine(kind, frame) {
const base = frame.difficulty ? `${frame.difficulty} raid base` : 'raid base'
const a = /^[aeiou]/i.test(base) ? 'An' : 'A'
const detail = [frame.grid || null, frame.pvp === true ? 'PvP' : null].filter(Boolean).join(' · ')
if (kind === 'raid.started') return { tone: 'server', actor: null, verb: `${a} ${base} appeared`, subject: null, detail }
if (kind === 'raid.ended') return { tone: 'server', actor: null, verb: `${a} ${base} despawned`, subject: null, detail }
if (kind === 'raid.completed') {
const who = raiderNames(frame.names, frame.raiderCount)
if (who) return { tone: 'kill', actor: who, verb: `raided ${a.toLowerCase()} ${base}`, subject: null, detail }
const count = Number(frame.raiderCount) || 0
const by = count > 0 ? `by ${count} player${count === 1 ? '' : 's'}` : null
return { tone: 'kill', actor: null, verb: `${a} ${base} was raided`, subject: null, detail: [detail, by].filter(Boolean).join(' · ') }
}
if (kind === 'raid.purchased') {
return frame.name
? { tone: 'server', actor: frame.name, verb: `bought ${a.toLowerCase()} ${base}`, subject: null, detail }
: { tone: 'server', actor: null, verb: `${a} ${base} was bought`, subject: null, detail }
}
return frame.name
? { tone: 'server', actor: null, verb: `${a} ${base} was locked to ${frame.name}`, subject: null, detail }
: { tone: 'server', actor: null, verb: `${a} ${base} was locked to a player`, subject: null, detail }
}
export default { describe, FEED_KINDS, FILTERS, kindsFor }