feat(rust): chat titles rank twenty-three conditions, and admins name the categories (PLAN_REDESIGNS §5, D172-D175, D209)

- Schema: fourteen title columns on rust_player_wipe_stats (the two
  best_* distances move by GREATEST, the rest are sums), rust_weapon_kills
  (kills by weapon prefab name) and rust_title_categories (the admin's
  title per category). purge.sql drops the two tables.
- Ingest: player.tally's new fields, in one statement per frame, none
  for an older plugin's frame.
- Titles: 23 categories plus playtime, each naming where it is read
  from (a sum, a MAX, npc_kills - animal_kills in signed arithmetic, or
  a named list). The bow/melee/blade/revolver/wood/ore/plants lists are
  one file, applied when a title is read. "NPC kills" ranks human NPCs
  only (D209).
- A rule's text may be empty, meaning the category's title: the rule's
  own, then the admin's, then the default. Typed-only-markup is still
  refused. A rename forgets every server's cached answer.
- Admin API: GET /admin/rust/title-categories and
  PUT /admin/rust/title-categories/:stat (empty text resets); the server
  list returns them too. Swagger fragment and routes.manifest.json
  regenerated (63 routes, against the pinned core).
- Screen: every category in the rule form, the category's title as a
  placeholder, and a Category titles section with Save and Reset.

The weapon lists are unverified until the rig probe runs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01E14m6SuuY6i1vASFeGDBeY
This commit is contained in:
2026-09-28 23:32:59 -05:00
parent afb16112b0
commit aea94b5d7a
18 changed files with 1150 additions and 65 deletions

View File

@@ -19,6 +19,10 @@
// raw OpenAPI.** `{ type: 'object' }` comes back as a meta-description of itself.
// That is uniform across core's committed spec and is the house shape.
// The title categories' ids, so the enum below cannot drift from what the
// validator accepts. `titles.js` is pure and needs nothing from core.
const titles = require('../model/titles/titles')
module.exports = {
tags: [
{
@@ -180,12 +184,17 @@ module.exports = {
items: {
type: 'object',
properties: {
stat: { type: 'string', enum: ['kills', 'npckills', 'playtime'], example: 'kills' },
stat: {
type: 'string',
enum: Object.keys(titles.STATS),
description: 'The category the rule ranks (PLAN_REDESIGNS §5). `npckills` is human NPCs only (D209); `pvpdistance` and `pvedistance` rank the longest single kill; `playtime` has no default title.',
example: 'kills',
},
topN: { type: 'integer', minimum: 1, maximum: 10, example: 1 },
text: {
type: 'string',
maxLength: 24,
description: 'The title. `[`, `]`, `<`, `>`, `{` and `}` are taken out on save, so a title carries no markup of its own.',
description: 'The title. `[`, `]`, `<`, `>`, `{` and `}` are taken out on save, so a title carries no markup of its own. Empty means the category’s title (D175), except for `playtime`.',
example: 'Top Killer',
},
color: { type: 'string', example: '#ff8800' },
@@ -194,6 +203,18 @@ module.exports = {
},
},
},
RustTitleCategory: {
type: 'object',
description: 'One chat-title category (PLAN_REDESIGNS §5.5, D175) and the title a rule of it shows when the rule has none of its own.',
properties: {
stat: { type: 'string', example: 'animalkills' },
label: { type: 'string', example: 'Animal kills' },
default: { type: 'string', description: 'The module’s shipped title.', example: 'Beastbane' },
text: { type: 'string', nullable: true, description: 'The admin’s own title for the whole site, or null.', example: 'Hunter' },
current: { type: 'string', description: 'What shows: `text` when set, else `default`.', example: 'Hunter' },
updatedAt: { type: 'string', format: 'date-time', nullable: true },
},
},
RustIntegrations: {
type: 'object',
description: 'Which optional mods a server has loaded right now (GET /admin/rust/servers/{id}/integrations), read live from the game.',