Stage 3-5 server (military, expansion, social), web client for stages 1-2, ops/deploy
Built: units/research/training, movements (scan, raid, attack, takeover, reinforce, settle, transport), deterministic combat resolved in the event queue, reports, power/offline units, founding + conquest + incumbent sites; alliances, roles, diplomacy (24h pact cancel via events), messages, rankings; vanilla-JS phone-first client (auth, POP, map, alerts, settings, en/nb); systemd units, backup timer, DEPLOY.md, tools/admin.js. Tested: npm test 96/96 (fake clock, in-memory db, a few real-HTTP tests); client checked with headless Chromium screenshots only. NOT done: marketplace/transport trade, client screens for military/social, WebSocket push, bots/balance, e2e suite. All unit stats and costs are unbalanced first guesses. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Q2MJaQ5LXAHzGnTDgceT14
This commit is contained in:
parent
b56b13880e
commit
249818a7aa
111 changed files with 17472 additions and 13 deletions
42
server/routes/schemasMilitary.js
Normal file
42
server/routes/schemasMilitary.js
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
'use strict';
|
||||
/* Response schemas of the military stage (merged into routes/schemas.js). Documentation only, like the others. */
|
||||
module.exports = function addMilitarySchemas(schemas, { int, num, str, bool, obj, arr }) {
|
||||
const nint = { type: ['integer', 'null'] };
|
||||
const free = { type: 'object', additionalProperties: true };
|
||||
const Units = { type: 'object', additionalProperties: true, description: 'unit id -> count' };
|
||||
const Cost = { $ref: 'Cost' };
|
||||
Object.assign(schemas, {
|
||||
Units,
|
||||
TrainResult: obj({ serverTime: int, eventId: int, unit: str, count: int, building: str, startAt: int, dueAt: int, cost: Cost }),
|
||||
ResearchResult: obj({ serverTime: int, eventId: int, unit: str, stat: str, toLevel: int, startedAt: int, dueAt: int, cost: Cost }),
|
||||
MovementSent: obj({ serverTime: int, movementId: int, type: str, fromTownId: int, toTownId: nint, to: obj({ x: int, y: int }), units: Units, cargo: free, departAt: int, arriveAt: int, protectionEnded: bool }, ['serverTime', 'movementId', 'type', 'fromTownId', 'toTownId', 'departAt', 'arriveAt']),
|
||||
RecallResult: obj({ serverTime: int, recalled: int, returnMovementId: int, arriveAt: int }),
|
||||
WithdrawResult: obj({ serverTime: int, movementId: int, units: Units, arriveAt: int }),
|
||||
MovementEnd: obj({ townId: nint, x: int, y: int, name: { type: ['string', 'null'] }, owner: { type: ['object', 'null'], additionalProperties: true } }, ['townId', 'x', 'y']),
|
||||
Movement: obj({
|
||||
id: int, type: str, status: str, ownerId: int, from: { $ref: 'MovementEnd' }, to: { $ref: 'MovementEnd' }, units: Units, cargo: free,
|
||||
departAt: int, arriveAt: int, recallableUntil: nint, target: { type: ['string', 'null'] }, parentId: nint, incoming: bool,
|
||||
}, ['id', 'type', 'status', 'from', 'to', 'departAt', 'arriveAt']),
|
||||
MovementList: obj({ serverTime: int, outgoing: arr({ $ref: 'Movement' }), incoming: arr({ $ref: 'Movement' }) }),
|
||||
Marked: obj({ serverTime: int, marked: int }),
|
||||
ReportItem: obj({ id: int, type: str, createdAt: int, role: str, read: bool, summary: free }),
|
||||
ReportList: obj({ serverTime: int, items: arr({ $ref: 'ReportItem' }), next: nint, unread: int }),
|
||||
Report: obj({ id: int, type: str, createdAt: int, expiresAt: int, role: str, read: bool, summary: free, data: free }),
|
||||
ReportResponse: obj({ serverTime: int, report: { $ref: 'Report' } }),
|
||||
TileInfo: obj({
|
||||
serverTime: int, x: int, y: int, type: str, bonus: { type: ['string', 'null'] },
|
||||
distances: arr(obj({ townId: int, distance: num })), town: free, incumbent: free,
|
||||
settle: obj({ possible: bool, code: { type: ['string', 'null'] }, footprint: num, footprintNeeded: num, maxDistance: int }),
|
||||
}, ['serverTime', 'x', 'y', 'type', 'distances', 'settle']),
|
||||
TownMilitary: obj({
|
||||
units: obj({ home: Units, online: bool, offlineSince: nint, stationedHere: arr(free), stationedAway: arr(free) }),
|
||||
training: arr(obj({ id: int, unit: str, count: int, building: str, startAt: int, dueAt: int })),
|
||||
trainable: arr(obj({ unit: str, building: str, role: str, cost: Cost, timeMs: int, missing: arr(free), locked: bool })),
|
||||
research: obj({ levels: free, queue: { type: ['object', 'null'], additionalProperties: true }, speedBonus: num, maxLevel: int }),
|
||||
transport: obj({ links: int, active: int, capacityPerLink: int }),
|
||||
movements: obj({ outgoing: arr({ $ref: 'Movement' }), incoming: arr({ $ref: 'Movement' }) }),
|
||||
protectionUntil: int,
|
||||
}),
|
||||
});
|
||||
if (schemas.Town && schemas.Town.properties) schemas.Town.properties.military = { $ref: 'TownMilitary' }; // optional: not in `required`
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue