gov.ts 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504
  1. import {cachedFetchJSON} from './cache';
  2. const renderTarget = document.querySelector('#gov')!;
  3. const planetInput = document.querySelector('#planet') as HTMLInputElement;
  4. const popSelect = document.querySelector('#pop') as HTMLSelectElement;
  5. function serializeToHash(planet: string, pop: Pop): void {
  6. const params = new URLSearchParams({'planet': planet, 'pop': pop});
  7. document.location.hash = params.toString();
  8. }
  9. function deserializeFromHash(): {planet: string, pop: Pop} | null {
  10. const params = new URLSearchParams(document.location.hash.substring(1));
  11. const planet = params.get('planet');
  12. const pop = params.get('pop');
  13. if (planet && pop && ['pio', 'set', 'tec', 'eng', 'sci'].includes(pop)) {
  14. planetInput.value = planet;
  15. popSelect.value = pop;
  16. return {planet, pop: pop as Pop};
  17. } else
  18. return null;
  19. }
  20. document.querySelector('form')!.addEventListener('submit', async (event) => {
  21. event.preventDefault();
  22. const planet = planetInput.value;
  23. const pop = popSelect.value as Pop;
  24. if (planet && pop) {
  25. await render(planet, pop);
  26. serializeToHash(planet, pop);
  27. }
  28. });
  29. {
  30. const deserialized = deserializeFromHash();
  31. if (deserialized)
  32. void render(deserialized.planet, deserialized.pop);
  33. }
  34. async function render(planetName: string, pop: Pop) {
  35. const loader = document.querySelector('#loader') as HTMLElement;
  36. loader.style.display = 'block';
  37. renderTarget.innerHTML = '';
  38. try {
  39. await _render(planetName, pop);
  40. } catch (e) {
  41. console.error(e);
  42. renderTarget.textContent = (e as Error).message;
  43. }
  44. loader.style.display = 'none';
  45. }
  46. async function _render(planetName: string, pop: Pop) {
  47. const encodedPlanetName = encodeURIComponent(planetName);
  48. const [planet, siteCounts, infras, allPrices]: [Planet, SiteCount[], Infrastructure[], Price[]] = await Promise.all([
  49. cachedFetchJSON(`https://api.fnar.net/planet/${encodedPlanetName}?include_population_reports=true`),
  50. cachedFetchJSON(`https://api.fnar.net/planet/sitecount?planet=${encodedPlanetName}`),
  51. cachedFetchJSON(`https://api.fnar.net/infrastructure?infrastructure=${encodedPlanetName}&include_upkeeps=true`),
  52. cachedFetchJSON('https://api.prunplanner.org/data/exchanges'),
  53. ]);
  54. let lastPOPR = null;
  55. for (const report of planet.PopulationReports) {
  56. if (!lastPOPR || report.SimulationPeriod > lastPOPR.SimulationPeriod)
  57. lastPOPR = report;
  58. }
  59. if (lastPOPR === null) {
  60. renderTarget.textContent = `no POPR for ${planetName}`;
  61. return;
  62. }
  63. const lastPOPRts = Math.floor(new Date(lastPOPR.ReportTimestamp).getTime() / 1000);
  64. const nextPOPRts = lastPOPRts + 7 * 24 * 60 * 60;
  65. let currentPop = 0, lowerPop = 0;
  66. if (pop == 'pio')
  67. currentPop = lastPOPR.NextPopulationPioneer;
  68. else if (pop == 'set') {
  69. currentPop = lastPOPR.NextPopulationSettler;
  70. lowerPop = lastPOPR.NextPopulationPioneer;
  71. }
  72. else if (pop == 'tec') {
  73. currentPop = lastPOPR.NextPopulationTechnician;
  74. lowerPop = lastPOPR.NextPopulationSettler;
  75. }
  76. else if (pop == 'eng') {
  77. currentPop = lastPOPR.NextPopulationEngineer;
  78. lowerPop = lastPOPR.NextPopulationTechnician;
  79. }
  80. else if (pop == 'sci') {
  81. currentPop = lastPOPR.NextPopulationScientist;
  82. lowerPop = lastPOPR.NextPopulationEngineer;
  83. }
  84. const siteCount = siteCounts[0].Count;
  85. const totalNeeds: Record<Need, number> = {
  86. 'safety': calcTotalNeeds(lastPOPR, 'safety'),
  87. 'health': calcTotalNeeds(lastPOPR, 'health'),
  88. 'comfort': calcTotalNeeds(lastPOPR, 'comfort'),
  89. 'culture': calcTotalNeeds(lastPOPR, 'culture'),
  90. 'education': calcTotalNeeds(lastPOPR, 'education'),
  91. };
  92. const currentPOPIFilled: POPIFill = new Map();
  93. for (const infra of infras) {
  94. const filled = calcPOPIFilled(infra);
  95. if (filled !== null)
  96. currentPOPIFilled.set(infra.Type, {tier: infra.CurrentLevel, numMats: filled});
  97. }
  98. const prices: Map<string, number> = new Map();
  99. for (const price of allPrices)
  100. if (price.exchange_code === 'IC1')
  101. prices.set(price.ticker, price.vwap_30d || price.ask);
  102. else if (price.exchange_code === 'UNIVERSE' && prices.get(price.ticker) === 0) // UNIVERSE always comes after IC1
  103. prices.set(price.ticker, price.vwap_30d);
  104. renderTarget.innerHTML = `last POPR: ${lastPOPR.ReportTimestamp} (${lastPOPRts})
  105. <br>next POPR: ${new Date(nextPOPRts * 1000).toISOString()} (${nextPOPRts})
  106. <table>
  107. <tr>
  108. <th></th>
  109. <th>pio</th>
  110. <th>set</th>
  111. <th>tec</th>
  112. <th>eng</th>
  113. <th>sci</th>
  114. </tr>
  115. <tr>
  116. <th>population</th>
  117. <td>${lastPOPR.NextPopulationPioneer}<br>${formatDelta(lastPOPR.PopulationDifferencePioneer)}</td>
  118. <td>${lastPOPR.NextPopulationSettler}<br>${formatDelta(lastPOPR.PopulationDifferenceSettler)}</td>
  119. <td>${lastPOPR.NextPopulationTechnician}<br>${formatDelta(lastPOPR.PopulationDifferenceTechnician)}</td>
  120. <td>${lastPOPR.NextPopulationEngineer}<br>${formatDelta(lastPOPR.PopulationDifferenceEngineer)}</td>
  121. <td>${lastPOPR.NextPopulationScientist}<br>${formatDelta(lastPOPR.PopulationDifferenceScientist)}</td>
  122. </tr>
  123. <tr>
  124. <th>unemployed</th>
  125. <td>${unemployed(lastPOPR.NextPopulationPioneer, lastPOPR.PopulationDifferencePioneer, lastPOPR.OpenJobsPioneer, lastPOPR.UnemploymentRatePioneer)}</td>
  126. <td>${unemployed(lastPOPR.NextPopulationSettler, lastPOPR.PopulationDifferenceSettler, lastPOPR.OpenJobsSettler, lastPOPR.UnemploymentRateSettler)}</td>
  127. <td>${unemployed(lastPOPR.NextPopulationTechnician, lastPOPR.PopulationDifferenceTechnician, lastPOPR.OpenJobsTechnician, lastPOPR.UnemploymentRateTechnician)}</td>
  128. <td>${unemployed(lastPOPR.NextPopulationEngineer, lastPOPR.PopulationDifferenceEngineer, lastPOPR.OpenJobsEngineer, lastPOPR.UnemploymentRateEngineer)}</td>
  129. <td>${unemployed(lastPOPR.NextPopulationScientist, lastPOPR.PopulationDifferenceScientist, lastPOPR.OpenJobsScientist, lastPOPR.UnemploymentRateScientist)}</td>
  130. </tr>
  131. </table>
  132. <h2>needs</h2>
  133. ${siteCount} bases
  134. <table>
  135. <tr>
  136. <th></th>
  137. <th>safety</th>
  138. <th>health</th>
  139. <th>comfort</th>
  140. <th>culture</th>
  141. <th>education</th>
  142. </tr>
  143. <tr>
  144. <td>last POPR</td>
  145. <td>${formatPct(lastPOPR.NeedFulfillmentSafety)}</td>
  146. <td>${formatPct(lastPOPR.NeedFulfillmentHealth)}</td>
  147. <td>${formatPct(lastPOPR.NeedFulfillmentComfort)}</td>
  148. <td>${formatPct(lastPOPR.NeedFulfillmentCulture)}</td>
  149. <td>${formatPct(lastPOPR.NeedFulfillmentEducation)}</td>
  150. </tr>
  151. <tr>
  152. <td>total needed</td>
  153. <td>${formatNum(totalNeeds['safety'])}</td>
  154. <td>${formatNum(totalNeeds['health'])}</td>
  155. <td>${formatNum(totalNeeds['comfort'])}</td>
  156. <td>${formatNum(totalNeeds['culture'])}</td>
  157. <td>${formatNum(totalNeeds['education'])}</td>
  158. </tr>
  159. </table>
  160. <h2>current POPI</h2>
  161. <table>
  162. <tr>
  163. ${infras.map((infra) => {
  164. if (infra.CurrentLevel === 0)
  165. return '';
  166. const fill = currentPOPIFilled.get(infra.Type)!;
  167. return `<tr>
  168. <td>${infra.Type} T${infra.CurrentLevel}</td>
  169. <td>${fill.numMats}/${infra.Upkeeps.length}</td>
  170. </tr>`;
  171. }).join('')}
  172. </tr>
  173. </table>
  174. current projected ${pop.toUpperCase()} happiness:
  175. ${formatPct(projectedHappiness(pop, totalNeeds, siteCount, currentPOPIFilled))}
  176. <h2>options</h2>
  177. <table class="options">
  178. <tr>
  179. <th>config</th>
  180. <th>projected happiness</th>
  181. <th>projected migration</th>
  182. <th>cost/day</th>
  183. <th>unit cost</th>
  184. </tr>
  185. ${paretoFront(pop, totalNeeds, siteCount, currentPOPIFilled, currentPop, lowerPop, prices).map((result) => {
  186. let unitCost = '';
  187. if (result.cost > 0)
  188. unitCost = formatNum(result.cost / result.change);
  189. return `<tr>
  190. <td>${[...result.config.entries()].map(([building, fill]) => `${building}: ${fill.numMats}`).join('<br>')}</td>
  191. <td>${formatPct(result.happiness)}</td>
  192. <td>${formatDelta(result.change)}</td>
  193. <td>${formatNum(result.cost)}</td>
  194. <td>${unitCost}</td>
  195. </tr>`;
  196. }).join('')}
  197. </table>
  198. `;
  199. }
  200. const formatNum = new Intl.NumberFormat(undefined, {maximumFractionDigits: 2}).format;
  201. const formatPct = new Intl.NumberFormat(undefined, {style: 'percent', maximumFractionDigits: 2}).format;
  202. function formatDelta(n: number, withPlus: boolean = true): string {
  203. if (n > 0)
  204. return `<span class="positive">${withPlus ? '+' : ''}${formatNum(n)}</span>`;
  205. else if (n < 0)
  206. return `<span class="negative">${formatNum(n)}</span>`;
  207. else
  208. return n.toString();
  209. }
  210. function unemployed(people: number, change: number, openJobs: number, unemploymentRate: number): string {
  211. let nextUnemployed;
  212. if (openJobs <= people + change) {
  213. let prevUnemploymentRate = unemploymentRate;
  214. if (openJobs > 0)
  215. if (people - change > 0)
  216. prevUnemploymentRate = -openJobs / (people - change);
  217. else
  218. prevUnemploymentRate = -1
  219. const prevUnemployed = prevUnemploymentRate * (people - change);
  220. nextUnemployed = prevUnemployed + change;
  221. } else
  222. nextUnemployed = -openJobs + change;
  223. return formatDelta(Math.round(nextUnemployed), false);
  224. }
  225. function calcTotalNeeds(popReport: POPR, need: Need): number {
  226. return popReport.NextPopulationPioneer * NEEDS.pio[need]
  227. + popReport.NextPopulationSettler * NEEDS.set[need]
  228. + popReport.NextPopulationTechnician * NEEDS.tec[need]
  229. + popReport.NextPopulationEngineer * NEEDS.eng[need]
  230. + popReport.NextPopulationScientist * NEEDS.sci[need];
  231. }
  232. function calcPOPIFilled(infra: Infrastructure): number | null {
  233. if (infra.CurrentLevel === 0)
  234. return null;
  235. let filled = 0;
  236. for (const upkeep of infra.Upkeeps) {
  237. const nextConsumptionAmount = upkeep.StoreCapacity / 30 * upkeep.Duration; // # capacity is always 30 days
  238. if (upkeep.Stored >= nextConsumptionAmount)
  239. filled++;
  240. }
  241. return filled;
  242. }
  243. function paretoFront(pop: Pop, totalNeeds: Record<Need, number>, siteCount: number, currentPOPIFilled: POPIFill,
  244. currentPop: number, lowerPop: number, prices: Map<string, number>): {config: POPIFill, happiness: number, change: number, cost: number}[] {
  245. const results: {config: POPIFill, happiness: number, change: number, cost: number}[] = [];
  246. let education = 0;
  247. if (pop !== 'pio') {
  248. education = EDUCATION[pop];
  249. education += (currentPOPIFilled.get('PLANETARY_BROADCASTING_HUB')?.tier ?? 0) * 0.001;
  250. education += (currentPOPIFilled.get('LIBRARY')?.tier ?? 0) * 0.002;
  251. education += (currentPOPIFilled.get('UNIVERSITY')?.tier ?? 0) * 0.004;
  252. }
  253. for (const config of popiFillCombinations(currentPOPIFilled)) {
  254. const happiness = projectedHappiness(pop, totalNeeds, siteCount, config);
  255. let change = 0;
  256. if (happiness > 0.7 && ['pio', 'set', 'tec'].includes(pop))
  257. change = currentPop * (happiness - 0.7);
  258. else if (happiness < 0.5)
  259. change = 0.8 * currentPop * (happiness - 0.5);
  260. if (pop !== 'pio')
  261. change += lowerPop * education * happiness;
  262. // TODO: education out
  263. let cost = calcCost(config, prices);
  264. // is any result better than this one?
  265. if (results.some((result) => (result.change >= change && result.cost < cost) ||
  266. (result.change > change && result.cost <= cost)))
  267. continue;
  268. // are any results worse than this one?
  269. for (let i = results.length - 1; i >= 0; i--)
  270. if ((results[i].change <= change && results[i].cost > cost) ||
  271. (results[i].change < change && results[i].cost >= cost))
  272. results.splice(i, 1);
  273. results.push({config, happiness, change, cost});
  274. }
  275. return results;
  276. }
  277. function* popiFillCombinations(currentPOPIFilled: POPIFill): Generator<POPIFill> {
  278. const entries = [...currentPOPIFilled.keys()];
  279. function* helper(index: number, current: POPIFill): Generator<POPIFill> {
  280. if (index === entries.length) {
  281. yield new Map(current);
  282. return;
  283. }
  284. const building = entries[index];
  285. const tier = currentPOPIFilled.get(building)!.tier;
  286. const maxBuildingMats = Object.keys(POPI[building].mats).length;
  287. for (let i = 0; i <= maxBuildingMats; i++) {
  288. current.set(building, {tier, numMats: i});
  289. yield* helper(index + 1, current);
  290. }
  291. }
  292. yield* helper(0, new Map());
  293. }
  294. function projectedHappiness(pop: Pop, totalNeeds: Record<Need, number>, siteCount: number, popiFilled: POPIFill): number {
  295. let totalProvided: Record<Need, number> = {'safety': 50 * siteCount, 'health': 50 * siteCount,
  296. 'comfort': 0, 'culture': 0, 'education': 0};
  297. for (const [building, fill] of popiFilled.entries()) {
  298. const {needs} = POPI[building];
  299. const maxBuildingMats = Object.keys(POPI[building].mats).length;
  300. for (const {need, supplied} of needs) {
  301. const provided = fill.numMats / maxBuildingMats * fill.tier * supplied;
  302. totalProvided[need] += provided;
  303. }
  304. }
  305. const satisfaction: Map<Need, number> = new Map(); // percentage of needs fulfilled
  306. for (const _need in totalProvided) {
  307. const need = _need as Need;
  308. satisfaction.set(need, Math.min(totalProvided[need] / totalNeeds[need], 1));
  309. }
  310. const safetyHealthCap = Math.min(satisfaction.get('safety')!, satisfaction.get('health')!);
  311. if (satisfaction.get('comfort')! > safetyHealthCap)
  312. satisfaction.set('comfort', safetyHealthCap);
  313. if (satisfaction.get('culture')! > safetyHealthCap)
  314. satisfaction.set('culture', safetyHealthCap);
  315. const comfortCultureCap = Math.min(satisfaction.get('comfort')!, satisfaction.get('culture')!);
  316. if (satisfaction.get('education')! > comfortCultureCap)
  317. satisfaction.set('education', comfortCultureCap);
  318. const weights = NEEDS[pop];
  319. let happiness = 1 - Object.values(weights).reduce((sum, weight) => sum + weight, 0); // assume 100% life support
  320. for (const [need, s] of satisfaction.entries())
  321. happiness += weights[need] * s;
  322. return happiness;
  323. }
  324. function calcCost(config: POPIFill, prices: Map<string, number>): number {
  325. let cost = 0;
  326. for (const [building, fill] of config.entries()) {
  327. const {mats} = POPI[building];
  328. const matPrices: {ticker: string, costPerDay: number}[] = [];
  329. for (const [mat, amount] of Object.entries(mats)) {
  330. const matCost = prices.get(mat)!;
  331. if (!matCost)
  332. throw new Error('no price for ' + mat);
  333. matPrices.push({ticker: mat, costPerDay: matCost * amount});
  334. }
  335. matPrices.sort((a, b) => a.costPerDay - b.costPerDay);
  336. for (let i = 0; i < fill.numMats; i++)
  337. cost += matPrices[i].costPerDay * fill.tier;
  338. }
  339. return cost;
  340. }
  341. const NEEDS: Record<Pop, Record<Need, number>> = {
  342. 'pio': {'safety': 0.25, 'health': 0.15, 'comfort': 0.03, 'culture': 0.02, 'education': 0.01},
  343. 'set': {'safety': 0.30, 'health': 0.20, 'comfort': 0.03, 'culture': 0.03, 'education': 0.03},
  344. 'tec': {'safety': 0.20, 'health': 0.30, 'comfort': 0.20, 'culture': 0.10, 'education': 0.05},
  345. 'eng': {'safety': 0.10, 'health': 0.15, 'comfort': 0.35, 'culture': 0.20, 'education': 0.10},
  346. 'sci': {'safety': 0.10, 'health': 0.10, 'comfort': 0.20, 'culture': 0.25, 'education': 0.30},
  347. }
  348. const POPI: Record<POPIBuilding, {needs: {need: Need, supplied: number}[], mats: Record<string, number>}> = {
  349. 'SAFETY_STATION': {
  350. needs: [{need: 'safety', supplied: 2500}],
  351. mats: {'DW': 10, 'OFF': 10, 'SUN': 2},
  352. },
  353. 'SECURITY_DRONE_POST': {
  354. needs: [{need: 'safety', supplied: 5000}],
  355. mats: {'POW': 1, 'RAD': 0.47, 'CCD': 0.07, 'SUD': 0.07},
  356. },
  357. 'EMERGENCY_CENTER': {
  358. needs: [{need: 'safety', supplied: 1000}, {need: 'health', supplied: 1000}],
  359. mats: {'PK': 2, 'POW': 0.4, 'BND': 4, 'RED': 0.07, 'BSC': 0.07},
  360. },
  361. 'INFIRMARY': {
  362. needs: [{need: 'health', supplied: 2500}],
  363. mats: {'OFF': 10, 'TUB': 6.67, 'STR': 0.67},
  364. },
  365. 'HOSPITAL': {
  366. needs: [{need: 'health', supplied: 5000}],
  367. mats: {'PK': 2, 'SEQ': 0.4, 'BND': 4, 'SDR': 0.07, 'RED': 0.07, 'BSC': 0.13},
  368. },
  369. 'WELLNESS_CENTER': {
  370. needs: [{need: 'health', supplied: 1000}, {need: 'comfort', supplied: 1000}],
  371. mats: {'KOM': 4, 'OLF': 2, 'DW': 6, 'DEC': 0.67, 'PFE': 2.67, 'SOI': 6.67},
  372. },
  373. 'WILDLIFE_PARK': {
  374. needs: [{need: 'comfort', supplied: 2500}],
  375. mats: {'DW': 10, 'FOD': 6, 'PFE': 2, 'SOI': 3.33, 'DEC': 0.33},
  376. },
  377. 'ARCADES': {
  378. needs: [{need: 'comfort', supplied: 5000}],
  379. mats: {'POW': 2, 'MHP': 2, 'OLF': 4, 'BID': 0.2, 'HOG': 0.2, 'EDC': 0.2},
  380. },
  381. 'ART_CAFE': {
  382. needs: [{need: 'comfort', supplied: 1000}, {need: 'culture', supplied: 1000}],
  383. mats: {'MHP': 1, 'HOG': 1, 'UTS': 0.67, 'DEC': 0.67},
  384. },
  385. 'ART_GALLERY': {
  386. needs: [{need: 'culture', supplied: 2500}],
  387. mats: {'MHP': 1, 'HOG': 1, 'UTS': 0.67, 'DEC': 0.67},
  388. },
  389. 'THEATER': {
  390. needs: [{need: 'culture', supplied: 5000}],
  391. mats: {'POW': 1.4, 'MHP': 2, 'HOG': 1.4, 'OLF': 4, 'BID': 0.33, 'DEC': 0.67},
  392. },
  393. 'PLANETARY_BROADCASTING_HUB': {
  394. needs: [{need: 'culture', supplied: 1000}, {need: 'education', supplied: 1000}],
  395. mats: {'OFF': 10, 'MHP': 1, 'SP': 1.33, 'AAR': 0.67, 'EDC': 0.27, 'IDC': 0.13},
  396. },
  397. 'LIBRARY': {
  398. needs: [{need: 'education', supplied: 2500}],
  399. mats: {'MHP': 1, 'HOG': 1, 'CD': 0.33, 'DIS': 0.33, 'BID': 0.2},
  400. },
  401. 'UNIVERSITY': {
  402. needs: [{need: 'education', supplied: 5000}],
  403. mats: {'COF': 10, 'REA': 10, 'TUB': 10, 'BID': 0.33, 'HD': 0.67, 'IDC': 0.2},
  404. },
  405. };
  406. const EDUCATION: Record<Exclude<Pop, 'pio'>, number> = {
  407. 'set': 0.025,
  408. 'tec': 0.02,
  409. 'eng': 0.0125,
  410. 'sci': 0.0075,
  411. }
  412. type Pop = 'pio' | 'set' | 'tec' | 'eng' | 'sci';
  413. type Need = 'safety' | 'health' | 'comfort' | 'culture' | 'education';
  414. type POPIBuilding = 'SAFETY_STATION' | 'SECURITY_DRONE_POST' | 'EMERGENCY_CENTER' | 'INFIRMARY' | 'HOSPITAL' |
  415. 'WELLNESS_CENTER' | 'WILDLIFE_PARK' | 'ARCADES' | 'ART_CAFE' | 'ART_GALLERY' | 'THEATER' |
  416. 'PLANETARY_BROADCASTING_HUB' | 'LIBRARY' | 'UNIVERSITY';
  417. type POPIFill = Map<POPIBuilding, {tier: number, numMats: number}>;
  418. interface Planet {
  419. PopulationReports: POPR[]
  420. }
  421. interface POPR {
  422. SimulationPeriod: number;
  423. ReportTimestamp: string;
  424. NeedFulfillmentSafety: number;
  425. NeedFulfillmentHealth: number;
  426. NeedFulfillmentComfort: number;
  427. NeedFulfillmentCulture: number;
  428. NeedFulfillmentEducation: number;
  429. NextPopulationPioneer: number;
  430. NextPopulationSettler: number;
  431. NextPopulationTechnician: number;
  432. NextPopulationEngineer: number;
  433. NextPopulationScientist: number;
  434. PopulationDifferencePioneer: number;
  435. PopulationDifferenceSettler: number;
  436. PopulationDifferenceTechnician: number;
  437. PopulationDifferenceEngineer: number;
  438. PopulationDifferenceScientist: number;
  439. OpenJobsPioneer: number;
  440. OpenJobsSettler: number;
  441. OpenJobsTechnician: number;
  442. OpenJobsEngineer: number;
  443. OpenJobsScientist: number;
  444. UnemploymentRatePioneer: number;
  445. UnemploymentRateSettler: number;
  446. UnemploymentRateTechnician: number;
  447. UnemploymentRateEngineer: number;
  448. UnemploymentRateScientist: number;
  449. }
  450. interface SiteCount {
  451. Count: number;
  452. }
  453. interface Infrastructure {
  454. Type: POPIBuilding;
  455. CurrentLevel: number;
  456. Upkeeps: {Stored: number, StoreCapacity: number, 'Duration': number}[];
  457. }
  458. interface Price {
  459. ticker: string
  460. exchange_code: string
  461. vwap_30d: number
  462. ask: number
  463. }