1 import { Account } from "../repository/accounts";
2 import { CityWithLocation } from "../repository/city";
3 import * as _ from 'lodash';
6 foodUsagePerTick: number;
7 foodProductionPerTick: number;
8 energyUsagePerTick: number;
9 energyProductionPerTick: number;
12 export function renderKingomOverview(city: CityWithLocation & Usage, account: Account): string {
13 const foodRateOfChange = city.foodProductionPerTick - city.foodUsagePerTick;
14 const energyRateOfChange = city.energyProductionPerTick - city.energyUsagePerTick;
16 <div hx-trigger="every 600s" hx-get="/poll/overview">
17 <h2 data-augmented-ui="tl-clip bl-clip none">Overview</h2>
21 <td>${account.username}</td>
23 <td>${city.population.toLocaleString()}/${_.max([city.farms * 70, city.population])}</td>
27 <td>${city.totalSpace.toLocaleString()} (${Math.ceil(city.usedSpace/city.totalSpace * 100)}% used)</td>
29 <td>${city.soldiers.toLocaleString()}</td>
33 <td>Sector ${city.sector_id} - (${city.location_x},${city.location_y})</td>
35 <td>${city.attackers.toLocaleString()}</td>
39 <td>${city.credits.toLocaleString()}</td>
41 <td>${city.defenders.toLocaleString()}</td>
45 <td>${city.alloys.toLocaleString()}</td>
46 <th>Special Attackers</th>
47 <td>${city.sp_attackers.toLocaleString()}</td>
51 <td>${city.energy.toLocaleString()} (<span class="rate-of-change ${energyRateOfChange < 0 ? 'danger-text' : 'success-text'}">${energyRateOfChange.toLocaleString()}</span>)</td>
52 <th>Special Defenders</th>
53 <td>${city.sp_defenders.toLocaleString()}</td>
57 <td>${city.food.toLocaleString()} (<span class="rate-of-change ${foodRateOfChange < 0 ? 'danger-text' : 'success-text'}">${foodRateOfChange.toLocaleString()}</span>)</td>