feat(rust): Dangerous Treasures — feed, map, Treasure Hunter, Start a Dangerous Treasures event (PLAN_REDESIGNS §14.3.4)
Stage 5 of the §14.3 integration plan, on protocol 14 (docs rust-link/PROTOCOL.md §20.8). - dt.started and dt.won are public kinds, dt.ended a staff kind. The new dangerousTreasures.js reads each row per viewer: grid and invaderCount for everyone, the winner's name for the presence audience (D376), the position, the step's key, the winner's Steam id and the invaders for staff. - Feed lines in the World events filter: "A Dangerous Treasures event has started · K12", "Alice won the treasure · K12 · 3 players fought for it". - Triggers rust.dt.started (with byEvent) and rust.dt.won, public, cooldown subject the server, names only. - eventDangerousTreasures.js: rust.dt.start, "Start a Dangerous Treasures event" (risk change, reversible none, budget rust.dt.events), server and difficulty. Refused at verify where the server said DT is not loaded or console.plugins is false (Rust-Plugins#34). dt-not-ready answers "Dangerous Treasures is not ready yet" with retryAfterMs 600000 (D365, D371); dt-no-spot retries on core's delay; DT's own refusals are permanent. - Treasure Hunter (D375): treasuresWon -> treasures_won, the title category treasureswon, and a sortable Treasures column shown where the server reports DT or a row counts one. - The map draws a running chest on the world layer; the server settings' plugin line names DT and whether a step can start one, from the integrations read's new `console`. - coreApi ^1.15.0, ci/core-ref.json pinned to website main at #215's merge. ci/bundle.json ships the two new files; swagger fragment and engagement manifest regenerated; README lists DT. Server 627/627 (16 new in test/dangerousTreasures.test.js) and every check; client 92/92, build and externals. Booted against the pinned core: 45 triggers, 13 actions, 11 budgets, 21 option sources; 89 routes unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01E14m6SuuY6i1vASFeGDBeY
This commit is contained in:
@@ -41,6 +41,11 @@ const COLUMNS = [
|
||||
// so with `economics` on the answer — so the column is there exactly when the
|
||||
// rows carry it. Sorting by it ranks only balances above the starting balance
|
||||
// (D336), which is why a fresh wipe's sort shows nobody.
|
||||
// Treasure Hunter (PLAN_REDESIGNS §14.3.4, D375): Dangerous Treasures won. The
|
||||
// server says `dangerousTreasures` where the server reports the plugin, or the
|
||||
// rows already count a treasure, so the column is there exactly then.
|
||||
const TREASURES = { key: 'treasuresWon', label: 'Treasures', sort: 'treasuresWon', value: (r) => count(r.treasuresWon) }
|
||||
|
||||
const BALANCE = { key: 'balance', label: 'Coins', sort: 'balance', value: (r) => coins(r.balance) }
|
||||
|
||||
export default function Leaderboard({ serverId, wipeId, sort, onSort }) {
|
||||
@@ -96,7 +101,11 @@ function Overall({ serverId, wipeId, sort, onSort }) {
|
||||
)
|
||||
|
||||
const rows = data ? data.leaderboard : []
|
||||
const columns = data && data.economics ? [...COLUMNS, BALANCE] : COLUMNS
|
||||
const columns = [
|
||||
...COLUMNS,
|
||||
...(data && data.dangerousTreasures ? [TREASURES] : []),
|
||||
...(data && data.economics ? [BALANCE] : []),
|
||||
]
|
||||
// Present on every row or on none — the server decides per request.
|
||||
const showLastSeen = rows.some((row) => 'lastSeen' in row)
|
||||
|
||||
|
||||
@@ -46,6 +46,7 @@ const COLOURS = {
|
||||
bradley: '#a1887f',
|
||||
supply: '#66bb6a',
|
||||
crate: '#ffee58',
|
||||
treasure: '#ffab00',
|
||||
event: '#ce93d8',
|
||||
boss: '#d500f9',
|
||||
online: '#ffffff',
|
||||
@@ -64,6 +65,8 @@ const WORLD_NAMES = {
|
||||
bradley: 'Bradley APC',
|
||||
supply: 'Supply drop',
|
||||
crate: 'Locked crate',
|
||||
// Dangerous Treasures (§14.3.4): its running chests.
|
||||
treasure: 'Dangerous Treasures chest',
|
||||
boss: 'Boss',
|
||||
}
|
||||
|
||||
|
||||
@@ -50,6 +50,11 @@ export const FEED_KINDS = Object.freeze([
|
||||
// Dynamic PVP's zones opening (§14.3.3). A closing (`pvp.zone.deleted`) is
|
||||
// staff's and is not asked for here; the map shows a zone go.
|
||||
'pvp.zone.created',
|
||||
// Dangerous Treasures (§14.3.4): a chest opening, and one won. The server reads
|
||||
// each for the viewer, so the winner's name is here only where it may be; the
|
||||
// ending (`dt.ended`) is staff's, and the map shows the chest go.
|
||||
'dt.started',
|
||||
'dt.won',
|
||||
])
|
||||
|
||||
/** The filters the feed offers, and the kinds each one asks the API for. */
|
||||
@@ -64,7 +69,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'] },
|
||||
{ id: 'world', label: 'World events', kinds: ['world.event', 'pvp.zone.created', 'dt.started', 'dt.won'] },
|
||||
])
|
||||
|
||||
export function kindsFor(filterId) {
|
||||
@@ -158,6 +163,11 @@ export function describe(row) {
|
||||
case 'pvp.zone.deleted':
|
||||
return pvpLine(row.kind, frame)
|
||||
|
||||
case 'dt.started':
|
||||
case 'dt.won':
|
||||
case 'dt.ended':
|
||||
return treasureLine(row.kind, frame)
|
||||
|
||||
default:
|
||||
return { tone: 'other', actor: name, verb: String((row && row.kind) || 'unknown'), subject: null, detail: '' }
|
||||
}
|
||||
@@ -346,4 +356,25 @@ function pvpLine(kind, frame) {
|
||||
return { tone: 'kill', actor: null, verb: `A PvP zone opened${around}`, subject: null, detail }
|
||||
}
|
||||
|
||||
/**
|
||||
* Dangerous Treasures (protocol 14, PLAN_REDESIGNS §14.3.4). The server has read
|
||||
* the frame for this viewer: `grid`, `invaderCount`, and the winner's `name` only
|
||||
* for the presence audience (D376).
|
||||
*/
|
||||
function treasureLine(kind, frame) {
|
||||
const grid = frame.grid || ''
|
||||
if (kind === 'dt.started') {
|
||||
return { tone: 'server', actor: null, verb: 'A Dangerous Treasures event has started', subject: null, detail: grid }
|
||||
}
|
||||
if (kind === 'dt.ended') {
|
||||
return { tone: 'server', actor: null, verb: 'A Dangerous Treasures event has ended', subject: null, detail: grid }
|
||||
}
|
||||
const n = Number(frame.invaderCount)
|
||||
const fought = n > 1 ? `${n} players fought for it` : ''
|
||||
const detail = [grid || null, fought || null].filter(Boolean).join(' · ')
|
||||
return frame.name
|
||||
? { tone: 'kill', actor: frame.name, verb: 'won the treasure', subject: null, detail }
|
||||
: { tone: 'kill', actor: null, verb: 'The treasure was won', subject: null, detail }
|
||||
}
|
||||
|
||||
export default { describe, FEED_KINDS, FILTERS, kindsFor }
|
||||
|
||||
@@ -263,7 +263,22 @@ export function integrationsLine(r) {
|
||||
const withEconomics = r.integrations.economics ? `${line} ${economicsLine(r.integrations.economics)}` : line
|
||||
const withBackpacks = r.integrations.backpacks ? `${withEconomics} ${backpacksLine(r.integrations.backpacks)}` : withEconomics
|
||||
const withTruePve = r.integrations.truePve ? `${withBackpacks} ${truePveLine(r.integrations.truePve)}` : withBackpacks
|
||||
return r.integrations.dynamicPvp ? `${withTruePve} ${dynamicPvpLine(r.integrations.dynamicPvp)}` : withTruePve
|
||||
const withDynamicPvp = r.integrations.dynamicPvp ? `${withTruePve} ${dynamicPvpLine(r.integrations.dynamicPvp)}` : withTruePve
|
||||
return r.integrations.dangerousTreasures ? `${withDynamicPvp} ${dangerousTreasuresLine(r.integrations.dangerousTreasures, r.console)}` : withDynamicPvp
|
||||
}
|
||||
|
||||
/**
|
||||
* Dangerous Treasures (PLAN_REDESIGNS §14.3.4), from protocol 14: its events on the
|
||||
* feed and the map, and whether a step can start one, which needs the framework
|
||||
* to run its console command (hello's `console.plugins`, D363).
|
||||
*/
|
||||
export function dangerousTreasuresLine(dt, probe) {
|
||||
if (!dt.loaded) return 'Dangerous Treasures is not loaded — a step cannot start a treasure event.'
|
||||
const name = `Dangerous Treasures ${dt.version || ''}`.trim()
|
||||
if (probe && probe.plugins === false) {
|
||||
return `${name} is loaded — its events show on the feed and the map, but this framework cannot run its console command, so a step cannot start one (Rust-Plugins#34).`
|
||||
}
|
||||
return `${name} is loaded — its events show on the feed and the map, and a step may start one.`
|
||||
}
|
||||
|
||||
/** Dynamic PVP (PLAN_REDESIGNS §14.3.3), from protocol 14: its zones on the feed and the map. */
|
||||
|
||||
Reference in New Issue
Block a user