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
|
|
@ -7,6 +7,7 @@ const R = require('../public/js/rules.js');
|
|||
const D = require('../public/js/data.js');
|
||||
const { GameError } = require('./errors');
|
||||
const { loadWorld, townFromRow, pendingBuilds } = require('./state');
|
||||
const { allianceBrief } = require('./alliances');
|
||||
|
||||
function createQueries({ db, clock, scheduler }) {
|
||||
const fresh = () => { scheduler.runDue(); return clock.now(); };
|
||||
|
|
@ -23,7 +24,7 @@ function createQueries({ db, clock, scheduler }) {
|
|||
const world = loadWorld(db, o.world_id);
|
||||
const towns = db.all('SELECT id, name, x, y, is_capital FROM towns WHERE owner_id = ? ORDER BY id', o.id)
|
||||
.map((t) => ({ id: t.id, name: t.name, x: t.x, y: t.y, isCapital: !!t.is_capital }));
|
||||
return { id: o.id, name: o.name, asNumber: o.as_number, allianceId: o.alliance_id, protectionUntil: o.protection_until, world: worldView(world), towns };
|
||||
return { id: o.id, name: o.name, asNumber: o.as_number, allianceId: o.alliance_id, alliance: allianceBrief(db, o.alliance_id), protectionUntil: o.protection_until, world: worldView(world), towns };
|
||||
});
|
||||
return { serverTime: now, user: { id: user.id, username: user.username, createdAt: user.created_at }, operators };
|
||||
}
|
||||
|
|
@ -68,6 +69,7 @@ function createQueries({ db, clock, scheduler }) {
|
|||
loyalty, footprint: R.footprintAt(t, now), footprintPerDay: R.footprintPerDay(t),
|
||||
resources, power, buildings, queue, queueSlots: R.queueSlots(t),
|
||||
bonus: t.bonus,
|
||||
military: require('./military/views').townMilitary(db, t, now, world),
|
||||
},
|
||||
};
|
||||
}
|
||||
|
|
@ -93,11 +95,11 @@ function createQueries({ db, clock, scheduler }) {
|
|||
if (t.type === 'rural' || t.type === 'incumbent') specials.push({ x: xx, y: yy, type: t.type, bonus: t.bonus || null });
|
||||
}
|
||||
}
|
||||
const towns = db.all(`SELECT t.id, t.name, t.x, t.y, t.is_capital, o.id AS oid, o.name AS oname, o.as_number AS asn, o.alliance_id AS ally, o.protection_until AS prot
|
||||
FROM towns t JOIN operators o ON o.id = t.owner_id WHERE t.world_id = ? AND t.x BETWEEN ? AND ? AND t.y BETWEEN ? AND ? ORDER BY t.id`,
|
||||
const towns = db.all(`SELECT t.id, t.name, t.x, t.y, t.is_capital, o.id AS oid, o.name AS oname, o.as_number AS asn, o.alliance_id AS ally, a.tag AS atag, a.name AS aname, o.protection_until AS prot
|
||||
FROM towns t JOIN operators o ON o.id = t.owner_id LEFT JOIN alliances a ON a.id = o.alliance_id WHERE t.world_id = ? AND t.x BETWEEN ? AND ? AND t.y BETWEEN ? AND ? ORDER BY t.id`,
|
||||
world.id, x0, x1, y0, y1).map((t) => ({
|
||||
id: t.id, name: t.name, x: t.x, y: t.y, isCapital: !!t.is_capital,
|
||||
owner: { id: t.oid, name: t.oname, asNumber: t.asn, allianceId: t.ally, protected: t.prot > now },
|
||||
owner: { id: t.oid, name: t.oname, asNumber: t.asn, allianceId: t.ally, alliance: t.ally ? { id: t.ally, tag: t.atag, name: t.aname } : null, protected: t.prot > now },
|
||||
}));
|
||||
return { serverTime: now, world: worldView(world), bounds: { x0, x1, y0, y1 }, specials, towns };
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue