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:
jvanvik 2026-10-11 18:32:36 +02:00
parent b56b13880e
commit 249818a7aa
111 changed files with 17472 additions and 13 deletions

View file

@ -15,7 +15,7 @@ const schemas = {
Error: obj({ serverTime: int, error: obj({ code: str, message: str, details: { type: 'object', additionalProperties: true } }) }),
World: obj({ id: int, name: str, speed: num, mapRadius: int, seed: int, startAt: int, endAt: { type: ['integer', 'null'] }, status: str, preset: str }),
TownSummary: obj({ id: int, name: str, x: int, y: int, isCapital: bool }),
Operator: obj({ id: int, name: str, asNumber: int, allianceId: { type: ['integer', 'null'] }, protectionUntil: int, world: { $ref: 'World' }, towns: arr({ $ref: 'TownSummary' }) }),
Operator: obj({ id: int, name: str, asNumber: int, allianceId: { type: ['integer', 'null'] }, alliance: { type: ['object', 'null'], properties: { id: int, tag: str, name: str }, additionalProperties: true }, protectionUntil: int, world: { $ref: 'World' }, towns: arr({ $ref: 'TownSummary' }) }),
Me: obj({ serverTime: int, user: obj({ id: int, username: str, createdAt: int }), operators: arr({ $ref: 'Operator' }) }),
AuthResult: obj({ serverTime: int, token: str, tokenId: int, user: obj({ id: int, username: str }), operators: arr({ $ref: 'Operator' }) }),
Token: obj({ id: int, device: str, createdAt: int, lastUsedAt: int, current: bool }),
@ -31,13 +31,52 @@ const schemas = {
bonus: obj({ fiber: num, hardware: num, capital: num }),
}),
TownResponse: obj({ serverTime: int, town: { $ref: 'Town' } }),
MapTown: obj({ id: int, name: str, x: int, y: int, isCapital: bool, owner: obj({ id: int, name: str, asNumber: int, allianceId: { type: ['integer', 'null'] }, protected: bool }) }),
MapTown: obj({ id: int, name: str, x: int, y: int, isCapital: bool, owner: obj({ id: int, name: str, asNumber: int, allianceId: { type: ['integer', 'null'] }, alliance: { type: ['object', 'null'], properties: { id: int, tag: str, name: str }, additionalProperties: true }, protected: bool }) }),
MapSpecial: obj({ x: int, y: int, type: str, bonus: { type: ['string', 'null'] } }),
MapResponse: obj({ serverTime: int, world: { $ref: 'World' }, bounds: obj({ x0: int, x1: int, y0: int, y1: int }), specials: arr({ $ref: 'MapSpecial' }), towns: arr({ $ref: 'MapTown' }) }),
BuildResult: obj({ serverTime: int, eventId: int, key: str, type: str, toLevel: int, startedAt: int, dueAt: int, cost: { $ref: 'Cost' } }),
Notification: obj({ id: int, type: str, worldId: { type: ['integer', 'null'] }, payload: { type: 'object', additionalProperties: true }, createdAt: int, readAt: { type: ['integer', 'null'] } }),
NotificationList: obj({ serverTime: int, items: arr({ $ref: 'Notification' }), next: { type: ['integer', 'null'] } }),
// ---- stage 5: alliances, diplomacy, messages, rankings
AllianceBrief: obj({ id: int, tag: str, name: str }),
OperatorBrief: obj({ operatorId: int, name: str }),
AllianceInfo: obj({ id: int, worldId: int, name: str, tag: str, sizeCap: int, memberCount: int, leader: { type: ['object', 'null'], additionalProperties: true }, createdAt: int }),
AllianceDetail: obj({ serverTime: int, alliance: { $ref: 'AllianceInfo' } }),
AllianceMine: obj({ serverTime: int, operatorId: int, worldId: int, alliance: { type: ['object', 'null'], additionalProperties: true }, role: { type: ['string', 'null'] }, permissions: arr(str), peeringLevel: int }),
AllianceList: obj({ serverTime: int, items: arr({ $ref: 'AllianceInfo' }), next: { type: ['integer', 'null'] } }),
AllianceMember: obj({ operatorId: int, name: str, asNumber: int, role: str, joinedAt: int, towns: int, footprint: num, lastOnline: { type: ['integer', 'null'] } }),
AllianceMemberList: obj({ serverTime: int, items: arr({ $ref: 'AllianceMember' }), next: { type: ['integer', 'null'] } }),
AllianceCreated: obj({ serverTime: int, allianceId: int, name: str, tag: str, sizeCap: int, role: str }),
AllianceInvite: obj({ id: int, operator: { $ref: 'OperatorBrief' }, invitedBy: { $ref: 'OperatorBrief' }, createdAt: int, expiresAt: int }),
AllianceInviteList: obj({ serverTime: int, items: arr({ $ref: 'AllianceInvite' }), next: { type: ['integer', 'null'] } }),
ReceivedInvite: obj({ id: int, operatorId: int, alliance: { $ref: 'AllianceBrief' }, invitedBy: { $ref: 'OperatorBrief' }, createdAt: int, expiresAt: int }),
ReceivedInviteList: obj({ serverTime: int, items: arr({ $ref: 'ReceivedInvite' }), next: { type: ['integer', 'null'] } }),
InviteResult: obj({ serverTime: int, inviteId: int, operatorId: int, expiresAt: int, changed: bool }),
Changed: obj({ serverTime: int, changed: bool }),
AllianceNote: obj({ id: int, authorId: int, text: str, createdAt: int, updatedAt: int }),
AllianceNoteResponse: obj({ serverTime: int, note: { $ref: 'AllianceNote' } }),
AllianceNoteList: obj({ serverTime: int, items: arr({ $ref: 'AllianceNote' }), next: { type: ['integer', 'null'] } }),
Relation: obj({ other: { type: 'object', additionalProperties: true }, state: str, since: int, pending: { type: ['object', 'null'], additionalProperties: true } }),
Proposal: obj({ id: int, other: { type: 'object', additionalProperties: true }, state: str, createdAt: int, expiresAt: int }),
Diplomacy: obj({ serverTime: int, allianceId: int, relations: arr({ $ref: 'Relation' }), proposalsIn: arr({ $ref: 'Proposal' }), proposalsOut: arr({ $ref: 'Proposal' }) }),
DiplomacyResult: obj({ serverTime: int, result: str, from: str, state: str }, ['serverTime', 'result', 'from', 'state']),
Message: obj({
id: int, kind: str, direction: str, thread: str, from: { $ref: 'OperatorBrief' }, to: { type: ['object', 'null'], additionalProperties: true },
alliance: { type: ['object', 'null'], additionalProperties: true }, text: str, createdAt: int, readAt: { type: ['integer', 'null'] },
}),
MessageList: obj({ serverTime: int, items: arr({ $ref: 'Message' }), next: { type: ['integer', 'null'] }, unread: int }, ['serverTime', 'items', 'next']),
MessageResponse: obj({ serverTime: int, message: { $ref: 'Message' } }),
MessageSent: obj({ serverTime: int, messageId: int, kind: str, recipients: int, createdAt: int }),
BlockList: obj({ serverTime: int, items: arr(obj({ operatorId: int, name: str, createdAt: int })), next: { type: ['integer', 'null'] } }),
RankOperator: obj({ rank: int, operatorId: int, name: str, asNumber: int, allianceId: { type: ['integer', 'null'] }, allianceTag: { type: ['string', 'null'] }, towns: int, footprint: num }),
RankAlliance: obj({ rank: int, allianceId: int, name: str, tag: str, members: int, towns: int, footprint: num }),
RankBattle: obj({ rank: int, operatorId: int, name: str, allianceTag: { type: ['string', 'null'] }, attackPoints: num, defensePoints: num }),
RankOperators: obj({ serverTime: int, total: int, you: { type: ['object', 'null'], additionalProperties: true }, items: arr({ $ref: 'RankOperator' }), next: { type: ['integer', 'null'] } }),
RankAlliances: obj({ serverTime: int, total: int, you: { type: ['object', 'null'], additionalProperties: true }, items: arr({ $ref: 'RankAlliance' }), next: { type: ['integer', 'null'] } }),
RankBattles: obj({ serverTime: int, by: str, available: bool, total: int, you: { type: ['object', 'null'], additionalProperties: true }, items: arr({ $ref: 'RankBattle' }), next: { type: ['integer', 'null'] } }),
Ok: obj({ serverTime: int }),
};
require('./schemasMilitary')(schemas, { int, num, str, bool, obj, arr });
module.exports = { schemas, int, num, str, bool, obj, arr };