greekbuilding names ,live synch button ,market capacity

This commit is contained in:
2026-04-22 20:48:34 +03:00
parent ec2b0c631e
commit c1cc8ceb7a
7 changed files with 92 additions and 5 deletions

View File

@@ -157,6 +157,21 @@
log(`storage capacity lookup failed: ${e}`);
}
// ---- Market / Trade capacity -----------------------------------------
let marketCapacity = 0;
try {
const marketLevel = buildings.market ?? 0;
const gd = uw.GameData?.buildingData?.market;
marketCapacity = gd?.capacity_per_level?.[marketLevel] || 0;
// Add Trade Office bonus if present
if (buildings.trade_office && buildings.trade_office > 0) {
marketCapacity += (uw.GameData?.buildingData?.trade_office?.capacity_extra_per_level || 500) * marketLevel;
}
} catch (e) {
log(`market capacity lookup failed: ${e}`);
}
// ---- Coordinates & sea zone -----------------------------------------
let x = null, y = null, sea = null;
try {
@@ -234,6 +249,7 @@
stone: res.stone,
iron: res.iron,
storage: storageCapacity,
market_capacity: marketCapacity,
population: res.population,
points: town.getPoints?.() ?? 0,
god: town.god?.() ?? null,
@@ -466,6 +482,11 @@
const recruitCmd = cmdData.recruit;
const marketCmd = cmdData.market;
if (cmdData.sync_requested) {
log('Sync requested by server — pushing state immediately');
pushState();
}
const execute = async (cmd) => {
if (!cmd) return;
log(`Executing command #${cmd.id} — type:${cmd.type} town:${cmd.town_id}`);