1 import { Account } from "../repository/accounts";
2 import { CityWithLocation, CityRepository } from "../repository/city";
3 import * as _ from 'lodash';
6 foodUsagePerTick: number;
7 foodProductionPerTick: number;
8 energyUsagePerTick: number;
9 energyProductionPerTick: number;
12 const cityRepo = new CityRepository();
14 export function renderKingomOverview(city: CityWithLocation & Usage, account: Account): string {
15 const foodRateOfChange = city.foodProductionPerTick - city.foodUsagePerTick;
16 const energyRateOfChange = city.energyProductionPerTick - city.energyUsagePerTick;
18 <div hx-trigger="every 600s" hx-get="/poll/overview">
19 <h2 data-augmented-ui="tl-clip bl-clip none">Overview</h2>
23 <td>${account.username}</td>
25 <td>${city.population.toLocaleString()}/${cityRepo.maxPopulation(city)}</td>
29 <td>${city.totalSpace.toLocaleString()} (${Math.ceil(city.usedSpace/city.totalSpace * 100)}% used)</td>
31 <td>${city.soldiers.toLocaleString()}</td>
35 <td>Sector ${city.sector_id} - (${city.location_x},${city.location_y})</td>
37 <td>${city.attackers.toLocaleString()}</td>
41 <td>${city.credits.toLocaleString()}</td>
43 <td>${city.defenders.toLocaleString()}</td>
47 <td>${city.alloys.toLocaleString()}</td>
48 <th>Special Attackers</th>
49 <td>${city.sp_attackers.toLocaleString()}</td>
53 <td>${city.energy.toLocaleString()} (<span class="rate-of-change ${energyRateOfChange < 0 ? 'danger-text' : 'success-text'}">${energyRateOfChange.toLocaleString()}</span>)</td>
54 <th>Special Defenders</th>
55 <td>${city.sp_defenders.toLocaleString()}</td>
59 <td>${city.food.toLocaleString()} (<span class="rate-of-change ${foodRateOfChange < 0 ? 'danger-text' : 'success-text'}">${foodRateOfChange.toLocaleString()}</span>)</td>