import moment from 'moment'; import _ from 'lodash'; import Server from './server.js'; import Empire from './empire.js'; import { BUILDING_TYPES, DATE_FORMAT } from './../constants.js'; import { Route } from './../interfaces.js'; // // Support for the body/get_buildings_resources call. This is get_buildings with a per-building // `resources` block bolted on (production rates, storage capacity, and the food/ore sub-type // breakdown) so the Resources window has something to render without a `view` per building. Values // are random but assigned by building type (a wheat farm makes wheat, only storage buildings hold // capacity); every other building resolves to all zeros and is filtered out by the UI. // const FOOD_SUBTYPES = [ 'algae', 'apple', 'bean', 'beetle', 'burger', 'bread', 'cheese', 'chip', 'cider', 'corn', 'fungus', 'lapis', 'meal', 'milk', 'pancake', 'pie', 'potato', 'root', 'shake', 'soup', 'syrup', 'wheat', ]; const ORE_SUBTYPES = [ 'anthracite', 'bauxite', 'beryl', 'chromite', 'chalcopyrite', 'fluorite', 'galena', 'goethite', 'gold', 'gypsum', 'halite', 'kerogen', 'magnetite', 'methane', 'monazite', 'rutile', 'sulfur', 'trona', 'uraninite', 'zircon', ]; const FOOD_BUILDINGS = [ 'algae', 'apple', 'bean', 'bread', 'burger', 'cheese', 'chip', 'cider', 'corn', 'cornmeal', 'dairy', 'lapis', 'malcud', 'pancake', 'pie', 'potato', 'shake', 'soup', 'syrup', 'wheat', 'beeldeban', 'denton', 'amalgusmeadow', ]; const ORE_BUILDINGS = ['mine', 'orerefinery', 'miningministry']; const WATER_BUILDINGS = [ 'waterproduction', 'waterpurification', 'waterreclamation', 'atmosphericevaporator', 'lake', 'naturalspring', 'geothermalvent', ]; const ENERGY_BUILDINGS = [ 'fission', 'fusion', 'hydrocarbon', 'geo', 'singularity', 'wasteenergy', 'pantheonofhagness', ]; const WASTE_BUILDINGS = [ 'wastetreatment', 'wastedigester', 'wasterecycling', 'wastesequestration', 'wasteexchanger', ]; const HAPPINESS_BUILDINGS = [ 'park', 'entertainment', 'themepark', 'lagoon', 'beach', 'grove', 'luxuryhousing', ]; const FOOD_STORES = ['foodreserve', 'distributioncenter', 'stockpile', 'warehouse']; const ORE_STORES = ['orestorage', 'distributioncenter', 'stockpile', 'warehouse']; const WATER_STORES = ['waterstorage', 'distributioncenter', 'stockpile', 'warehouse']; const ENERGY_STORES = ['energyreserve', 'distributioncenter', 'stockpile', 'warehouse']; const WASTE_STORES = ['wastesequestration', 'distributioncenter', 'stockpile', 'warehouse']; const spread = (types: string[], min: number, max: number) => { const out: Record = {}; types.forEach((type) => { out[type] = _.random(min, max); }); return out; }; // // The canned get_buildings map is almost all decorations and space ports, so most resource tabs // would come up empty. These extra producers/consumers exist only in get_buildings_resources - just // enough to give every tab something to show. // const EXTRA_RESOURCE_BUILDINGS = [ { id: 910000001, name: 'Wheat Farm', url: '/wheat', image: 'wheat1', x: '4', y: '-4' }, { id: 910000002, name: 'Malcud Fungus Farm', url: '/malcud', image: 'malcud1', x: '5', y: '-4' }, { id: 910000003, name: 'Mine', url: '/mine', image: 'mine9', x: '4', y: '-5' }, { id: 910000004, name: 'Ore Refinery', url: '/orerefinery', image: 'orerefinery9', x: '5', y: '-5', }, { id: 910000005, name: 'Water Production Plant', url: '/waterproduction', image: 'water9', x: '3', y: '-4', }, { id: 910000006, name: 'Fusion Reactor', url: '/fusion', image: 'fusion9', x: '3', y: '-5' }, { id: 910000007, name: 'Waste Recycling Center', url: '/wasterecycling', image: 'recycling9', x: '2', y: '-4', }, { id: 910000008, name: 'Waste Digester', url: '/wastedigester', image: 'digester9', x: '2', y: '-5', }, { id: 910000009, name: 'Distribution Center', url: '/distributioncenter', image: 'distcenter9', x: '1', y: '-4', }, ].reduce>((acc, building) => { acc[building.id] = { efficiency: '100', level: '30', ...building }; return acc; }, {}); // // One building's `resources` block. `_hour` is production per hour (negative for consumption), // `_capacity` is how much of that resource the building can store, and the `food` / `ore` maps // break the headline food/ore figure down by sub-type. `ore_hour` / `ore_capacity` / `food` / `ore` // are optional and only appear on buildings that actually deal in that resource. // const resourceProfile = (rawUrl: string) => { const url = (rawUrl || '').replace(/^\//, ''); const has = (list: string[]) => list.some((key) => url === key || url.startsWith(key)); const resources: Record> = { food_hour: 0, food_capacity: 0, water_hour: 0, water_capacity: 0, waste_hour: 0, waste_capacity: 0, energy_hour: 0, energy_capacity: 0, happiness_hour: 0, }; if (has(FOOD_BUILDINGS)) { const signature = FOOD_SUBTYPES.includes(url) ? [url] : _.sampleSize(FOOD_SUBTYPES, _.random(1, 3)); const food = spread(signature, 200, 2500); resources.food = food; resources.food_hour = _.sum(Object.values(food)); resources.water_hour = -_.random(50, 400); resources.energy_hour = -_.random(50, 400); } if (has(ORE_BUILDINGS)) { const ore = spread(_.sampleSize(ORE_SUBTYPES, _.random(2, 5)), 200, 2500); resources.ore = ore; resources.ore_hour = _.sum(Object.values(ore)); resources.energy_hour = -_.random(100, 600); } if (has(WATER_BUILDINGS)) resources.water_hour = _.random(300, 3000); if (has(ENERGY_BUILDINGS)) resources.energy_hour = _.random(300, 3000); if (has(WASTE_BUILDINGS)) resources.waste_hour = -_.random(300, 3000); if (has(HAPPINESS_BUILDINGS)) resources.happiness_hour = _.random(50, 900); if (has(FOOD_STORES)) { const food = spread(FOOD_SUBTYPES, 500, 9000); resources.food = food; resources.food_capacity = _.sum(Object.values(food)); } if (has(ORE_STORES)) { const ore = spread(ORE_SUBTYPES, 500, 9000); resources.ore = ore; resources.ore_capacity = _.sum(Object.values(ore)); } if (has(WATER_STORES)) resources.water_capacity = _.random(20000, 120000); if (has(ENERGY_STORES)) resources.energy_capacity = _.random(20000, 120000); if (has(WASTE_STORES)) resources.waste_capacity = _.random(20000, 120000); return { resources }; }; const Body: Route = { get_buildings(req, res) { return { status: this.get_status(req, res), body: { surface_image: 'surface-p35', }, buildings: { 4965708: { efficiency: '100', name: 'Black Hole Generator', x: '1', image: 'blackholegenerator1', y: '4', level: '30', url: '/blackholegenerator', }, 4942253: { y: '4', efficiency: '100', level: '30', name: 'Water Storage Tank', url: '/waterstorage', x: '-3', image: 'waterstorage9', }, 49422539: { y: '4', efficiency: '100', level: '30', name: 'Ore Storage Tank', url: '/orestorage', x: '-4', image: 'orestorage9', }, 494225399: { y: '4', efficiency: '100', level: '30', name: 'Food Reserve', url: '/foodreserve', x: '-5', image: 'food-reserve9', }, 4965699: { y: '3', efficiency: '100', level: '30', name: 'Pyramid Junk Sculpture', url: '/pyramidjunksculpture', x: '-5', image: 'pyramidjunksculpture1', }, 49656991: { y: '3', efficiency: '100', level: '30', name: 'Space Junk Park', url: '/spacejunkpark', x: '-4', image: 'spacejunkpark1', }, 49656992: { y: '3', efficiency: '100', level: '30', name: 'Metal Junk Arches', url: '/metaljunkarches', x: '-3', image: 'metaljunkarches1', }, 49656993: { y: '3', efficiency: '100', level: '30', name: 'Junk Henge', url: '/junkhengesculpture', x: '-2', image: 'junkhengesculpture1', }, 49656994: { y: '3', efficiency: '100', level: '30', name: 'Great Ball of Junk', url: '/greatballofjunk', x: '-1', image: 'greatballofjunk1', }, 49656996: { y: '4', efficiency: '100', level: '30', name: 'Pantheon of Hagness', url: '/pantheonofhagness', x: '0', image: 'pantheonofhagness1', }, 49656997: { y: '4', efficiency: '100', level: '30', name: 'Temple Of The Drajilites', url: '/templeofthedrajilites', x: '3', image: 'templedrajilites1', }, 49656998: { y: '3', efficiency: '100', level: '30', name: 'Essentia Vein', url: '/essentiavein', x: '2', image: 'essentiavein1', }, 4943197: { y: '2', efficiency: '100', level: '30', name: 'Intelligence Ministry', url: '/intelligence', x: '1', image: 'intelligence9', }, 4979713: { y: '0', efficiency: '25', level: '30', name: 'Shield Against Weapons', url: '/saw', x: '3', image: 'saw9', }, 4944689: { y: '-1', efficiency: '100', level: '30', name: 'Space Port', url: '/spaceport', x: '-5', image: 'spaceport9', }, 4943183: { y: '-1', efficiency: '100', level: '30', name: 'Space Port', url: '/spaceport', x: '0', image: 'spaceport9', }, 4979712: { y: '0', efficiency: '50', level: '30', name: 'Shield Against Weapons', url: '/saw', x: '2', image: 'saw9', }, 4944680: { y: '5', efficiency: '100', level: '30', name: 'Interdimensional Rift', url: '/interdimensionalrift', x: '0', image: 'interdimensionalrift1', }, 4942254: { y: '4', efficiency: '100', level: '30', name: 'Energy Reserve', url: '/energyreserve', x: '-2', image: 'energy-reserve9', }, 4944683: { y: '4', efficiency: '100', level: '30', name: 'Crashed Ship Site', url: '/crashedshipsite', x: '-1', image: 'crashedshipsite1', }, 4948857: { efficiency: '100', name: 'Propulsion System Factory', x: '-2', image: 'propulsion9', y: '2', level: '30', url: '/propulsion', }, 4944213: { y: '5', efficiency: '100', level: '30', name: 'Archaeology Ministry', url: '/archaeology', x: '2', image: 'archaeology9', }, 4943640: { y: '5', efficiency: '100', level: '30', name: 'Geo Thermal Vent', url: '/geothermalvent', x: '-2', image: 'geothermalvent1', }, 4968807: { y: '3', efficiency: '100', level: '30', name: 'Entertainment District', url: '/entertainment', x: '0', image: 'entertainment9', }, 4975914: { y: '-2', efficiency: '100', level: '30', name: 'Space Port', url: '/spaceport', x: '-1', image: 'spaceport9', }, 4976222: { y: '-2', efficiency: '100', level: '30', name: 'Space Port', url: '/spaceport', x: '-3', image: 'spaceport9', }, 4948858: { efficiency: '100', name: 'Pilot Training Facility', x: '-3', image: 'pilottraining9', y: '2', level: '30', url: '/pilottraining', }, 4943281: { y: '3', efficiency: '100', level: '30', name: 'Observatory', url: '/observatory', x: '1', image: 'observatory9', }, 4942247: { y: '3', efficiency: '100', level: '30', name: 'University', url: '/university', x: '3', image: 'university9', }, 4944685: { y: '-1', efficiency: '100', level: '30', name: 'Space Port', url: '/spaceport', x: '-1', image: 'spaceport9', }, 4944198: { efficiency: '100', name: 'Trade Ministry', x: '0', image: 'trade9', y: '2', level: '30', url: '/trade', }, 4943639: { y: '5', efficiency: '100', level: '30', name: 'Natural Spring', url: '/naturalspring', x: '-3', image: 'naturalspring1', }, 4944677: { y: '5', efficiency: '100', level: '30', name: 'Development Ministry', url: '/development', x: '1', image: 'devel9', }, 4979716: { y: '0', efficiency: '50', level: '30', name: 'Shield Against Weapons', url: '/saw', x: '5', image: 'saw9', }, 4979714: { y: '0', efficiency: '75', level: '30', name: 'Shield Against Weapons', url: '/saw', x: '4', image: 'saw9', }, 4943633: { y: '5', efficiency: '100', level: '30', name: 'Volcano', url: '/volcano', x: '-4', image: 'volcano1', }, 4944687: { y: '-1', efficiency: '100', level: '30', name: 'Space Port', url: '/spaceport', x: '-3', image: 'spaceport9', }, 4976223: { y: '-2', efficiency: '100', level: '30', name: 'Space Port', url: '/spaceport', x: '-4', image: 'spaceport9', }, 4944678: { y: '5', efficiency: '100', level: '30', name: 'Oversight Ministry', url: '/oversight', x: '3', image: 'oversight9', }, 4944681: { y: '5', efficiency: '100', level: '30', name: 'Kalavian Ruins', url: '/kalavianruins', x: '-1', image: 'kalavianruins1', }, 4942219: { y: '0', efficiency: '100', level: '30', name: 'Planetary Command Center', url: '/planetarycommand', x: '0', image: 'command9', }, 4976350: { y: '-2', efficiency: '100', level: '30', name: 'Space Port', url: '/spaceport', x: '-5', image: 'spaceport9', }, 4970232: { efficiency: '100', name: 'Munitions Lab', x: '-4', image: 'munitionslab6', y: '2', level: '30', url: '/munitionslab', }, 4943631: { y: '5', efficiency: '100', level: '30', name: 'Malcud Field', url: '/malcudfield', x: '-5', image: 'malcudfield1', }, 4970063: { efficiency: '100', name: 'Espionage Ministry', x: '2', image: 'espionage9', y: '2', level: '30', url: '/espionage', }, 4968550: { efficiency: '100', name: 'Cloaking Lab', x: '-5', image: 'cloakinglab9', y: '2', level: '30', url: '/cloakinglab', }, 4944686: { y: '-1', efficiency: '100', level: '30', name: 'Space Port', url: '/spaceport', x: '-2', image: 'spaceport9', }, 4976221: { y: '-2', efficiency: '100', level: '30', name: 'Space Port', url: '/spaceport', x: '-2', image: 'spaceport9', }, 4975891: { y: '-2', efficiency: '100', level: '30', name: 'Space Port', url: '/spaceport', x: '0', image: 'spaceport9', }, 4979711: { y: '0', efficiency: '25', level: '30', name: 'Shield Against Weapons', url: '/saw', x: '1', image: 'saw9', }, 49797115: { y: '0', efficiency: '100', level: '30', name: 'Shield Against Weapons', url: '/saw', x: '-1', image: 'saw9', }, 49797116: { y: '0', efficiency: '100', level: '30', name: 'Shield Against Weapons', url: '/saw', x: '-2', image: 'saw9', }, 49797117: { y: '0', efficiency: '100', level: '30', name: 'Shield Against Weapons', url: '/saw', x: '-3', image: 'saw9', }, 49797118: { y: '0', efficiency: '100', level: '30', name: 'Shield Against Weapons', url: '/saw', x: '-4', image: 'saw9', }, 49797119: { y: '0', efficiency: '100', level: '30', name: 'Shield Against Weapons', url: '/saw', x: '-5', image: 'saw9', }, 4966153: { efficiency: '100', name: 'Security Ministry', x: '3', image: 'security9', y: '2', level: '30', url: '/security', }, 444392791: { efficiency: '100', name: 'Shipyard', x: '5', image: 'shipyard9', y: '1', level: '30', url: '/shipyard', }, 444392792: { efficiency: '100', name: 'Shipyard', x: '4', image: 'shipyard9', y: '1', level: '30', url: '/shipyard', }, 444392793: { efficiency: '100', name: 'Shipyard', x: '3', image: 'shipyard9', y: '1', level: '30', url: '/shipyard', }, 4443927914: { efficiency: '100', name: 'Shipyard', x: '2', image: 'shipyard9', y: '1', level: '30', url: '/shipyard', }, 4443927915: { efficiency: '100', name: 'Shipyard', x: '1', image: 'shipyard9', y: '1', level: '30', url: '/shipyard', }, 444392796: { efficiency: '100', name: 'Shipyard', x: '0', image: 'shipyard9', y: '1', level: '30', url: '/shipyard', }, 444392797: { efficiency: '100', name: 'Shipyard', x: '-1', image: 'shipyard9', y: '1', level: '30', url: '/shipyard', work: { seconds_remaining: 5 * 60 * 60, start: moment().subtract(1, 'hour').format(DATE_FORMAT), end: moment().add(5, 'hours').format(DATE_FORMAT), }, }, 444392798: { efficiency: '100', name: 'Shipyard', x: '-2', image: 'shipyard9', y: '1', level: '30', url: '/shipyard', work: { seconds_remaining: 5 * 60 * 60, start: moment().subtract(1, 'hour').format(DATE_FORMAT), end: moment().add(5, 'hours').format(DATE_FORMAT), }, }, 444392799: { efficiency: '100', name: 'Shipyard', x: '-3', image: 'shipyard9', y: '1', level: '30', url: '/shipyard', work: { seconds_remaining: 5 * 60 * 60, start: moment().subtract(1, 'hour').format(DATE_FORMAT), end: moment().add(5, 'hours').format(DATE_FORMAT), }, }, 444392710: { efficiency: '100', name: 'Shipyard', x: '-4', image: 'shipyard9', y: '1', level: '30', url: '/shipyard', work: { seconds_remaining: 5 * 60 * 60, start: moment().subtract(1, 'hour').format(DATE_FORMAT), end: moment().add(5, 'hours').format(DATE_FORMAT), }, }, 4443927961: { efficiency: '100', name: 'Shipyard', x: '-5', image: 'shipyard9', y: '1', level: '30', url: '/shipyard', work: { seconds_remaining: 5 * 60 * 60, start: moment().subtract(1, 'hour').format(DATE_FORMAT), end: moment().add(5, 'hours').format(DATE_FORMAT), }, }, 4944688: { y: '-1', efficiency: '100', level: '30', name: 'Space Port', url: '/spaceport', x: '-4', image: 'spaceport9', }, 4947856: { y: '4', efficiency: '100', level: '30', name: 'Oracle of Anid', url: '/oracleofanid', x: '2', image: 'oracleanid1', }, 494360499999999: { y: '2', efficiency: '100', level: '30', name: 'Subspace Transporter', url: '/transporter', x: '-1', image: 'transporter9', }, 997856499: { y: '-4', efficiency: '100', level: '30', name: 'Space Port', url: '/spaceport', x: '5', image: 'spaceport9', }, 99785649: { y: '-5', efficiency: '100', level: '30', name: 'Space Port', url: '/spaceport', x: '5', image: 'spaceport9', }, 99785648888888: { y: '-4', efficiency: '100', level: '30', name: 'Space Port', url: '/spaceport', x: '4', image: 'spaceport9', }, 9978564888888: { y: '-5', efficiency: '100', level: '30', name: 'Space Port', url: '/spaceport', x: '4', image: 'spaceport9', }, 99785648888: { y: '-4', efficiency: '100', level: '30', name: 'Space Port', url: '/spaceport', x: '3', image: 'spaceport9', }, 997856488888: { y: '-5', efficiency: '100', level: '30', name: 'Space Port', url: '/spaceport', x: '3', image: 'spaceport9', }, 997856488: { y: '-1', efficiency: '100', level: '30', name: 'Space Port', url: '/spaceport', x: '2', image: 'spaceport9', }, 99785648: { y: '-2', efficiency: '100', level: '30', name: 'Space Port', url: '/spaceport', x: '2', image: 'spaceport9', }, 99778756774: { y: '-3', efficiency: '100', level: '30', name: 'Space Port', url: '/spaceport', x: '2', image: 'spaceport9', }, 9797875674: { y: '-4', efficiency: '100', level: '30', name: 'Space Port', url: '/spaceport', x: '2', image: 'spaceport9', }, 99787775677: { y: '-5', efficiency: '100', level: '30', name: 'Space Port', url: '/spaceport', x: '2', image: 'spaceport9', }, 9978777564: { y: '-1', efficiency: '100', level: '30', name: 'Space Port', url: '/spaceport', x: '1', image: 'spaceport9', }, 9977778564: { y: '-2', efficiency: '100', level: '30', name: 'Space Port', url: '/spaceport', x: '1', image: 'spaceport9', }, 9978567774: { y: '-3', efficiency: '100', level: '30', name: 'Space Port', url: '/spaceport', x: '1', image: 'spaceport9', }, 99787775641: { y: '-4', efficiency: '100', level: '30', name: 'Space Port', url: '/spaceport', x: '1', image: 'spaceport9', }, 99785647777: { y: '-5', efficiency: '100', level: '30', name: 'Space Port', url: '/spaceport', x: '1', image: 'spaceport9', }, 997856477777: { y: '-3', efficiency: '100', level: '30', name: 'Space Port', url: '/spaceport', x: '-5', image: 'spaceport9', }, 997856477767: { y: '-3', efficiency: '100', level: '30', name: 'Space Port', url: '/spaceport', x: '-4', image: 'spaceport9', }, 997856477: { y: '-3', efficiency: '100', level: '30', name: 'Space Port', url: '/spaceport', x: '-3', image: 'spaceport9', }, 997856774: { y: '-3', efficiency: '100', level: '30', name: 'Space Port', url: '/spaceport', x: '-2', image: 'spaceport9', }, 99785647: { y: '-3', efficiency: '100', level: '30', name: 'Space Port', url: '/spaceport', x: '-1', image: 'spaceport9', }, 99785646666666: { y: '-3', efficiency: '100', level: '30', name: 'Space Port', url: '/spaceport', x: '0', image: 'spaceport9', }, 9978564666666: { y: '-4', efficiency: '100', level: '30', name: 'Space Port', url: '/spaceport', x: '-5', image: 'spaceport9', }, 99785646666: { y: '-4', efficiency: '100', level: '30', name: 'Space Port', url: '/spaceport', x: '-4', image: 'spaceport9', }, 997856466: { y: '-4', efficiency: '100', level: '30', name: 'Space Port', url: '/spaceport', x: '-3', image: 'spaceport9', }, 99785646: { y: '-4', efficiency: '100', level: '30', name: 'Space Port', url: '/spaceport', x: '-2', image: 'spaceport9', }, 99785645555555: { y: '-4', efficiency: '100', level: '30', name: 'Space Port', url: '/spaceport', x: '-1', image: 'spaceport9', }, 9978564555555: { y: '-4', efficiency: '100', level: '30', name: 'Space Port', url: '/spaceport', x: '0', image: 'spaceport9', }, 997856455555: { y: '-5', efficiency: '100', level: '30', name: 'Space Port', url: '/spaceport', x: '-5', image: 'spaceport9', }, 9978564555: { y: '-5', efficiency: '100', level: '30', name: 'Space Port', url: '/spaceport', x: '-4', image: 'spaceport9', }, 997856455: { y: '-5', efficiency: '100', level: '30', name: 'Space Port', url: '/spaceport', x: '-3', image: 'spaceport9', }, 99785645: { y: '-5', efficiency: '100', level: '30', name: 'Space Port', url: '/spaceport', x: '-2', image: 'spaceport9', }, 9978564444444: { y: '-5', efficiency: '100', level: '30', name: 'Space Port', url: '/spaceport', x: '-1', image: 'spaceport9', }, 997856444: { y: '-5', efficiency: '100', level: '30', name: 'Space Port', url: '/spaceport', x: '0', image: 'spaceport9', }, 99785644444: { y: '5', efficiency: '100', level: '30', name: 'Space Station Lab', url: '/ssla', x: '4', image: 'ssla9', }, 99785644: { y: '5', efficiency: '100', level: '30', name: 'Space Station Lab', url: '/sslb', x: '5', image: 'sslb9', }, 9978564333333: { y: '4', efficiency: '100', level: '30', name: 'Space Station Lab', url: '/sslc', x: '5', image: 'sslc9', }, 997856433333: { y: '4', efficiency: '100', level: '30', name: 'Space Station Lab', url: '/ssld', x: '4', image: 'ssld9', }, 99785643333: { y: '3', efficiency: '100', level: '30', name: 'Intel Training', url: '/inteltraining', x: '4', image: 'inteltraining9', }, 9978564333: { y: '3', efficiency: '100', level: '30', name: 'Mayhem Training', url: '/mayhemtraining', x: '5', image: 'mayhemtraining9', }, 997856433: { y: '2', efficiency: '100', level: '30', name: 'Politics Training', url: '/politicstraining', x: '4', image: 'politicstraining9', }, 99785643: { y: '2', efficiency: '100', level: '30', name: 'Theft Training', url: '/thefttraining', x: '5', image: 'thefttraining9', }, 997856422222: { x: 4, y: -2, efficiency: 100, level: 30, name: 'Lost City of Tyleon', url: '/lcota', image: 'lcota', }, 99785642222: { x: 3, y: -2, efficiency: 100, level: 30, name: 'Lost City of Tyleon', url: '/lcotb', image: 'lcotb', }, 9978564222: { x: 5, y: -3, efficiency: 100, level: 30, name: 'Lost City of Tyleon', url: '/lcotc', image: 'lcotc', }, 997856422: { x: 4, y: -3, efficiency: 100, level: 30, name: 'Lost City of Tyleon', url: '/lcotd', image: 'lcotd', }, 99785642: { x: 3, y: -3, efficiency: 100, level: 30, name: 'Lost City of Tyleon', url: '/lcote', image: 'lcote', }, 99785641111: { x: 5, y: -2, efficiency: 100, level: 30, name: 'Lost City of Tyleon', url: '/lcotf', image: 'lcotf', }, 9978564111: { x: 5, y: -1, efficiency: 100, level: 30, name: 'Lost City of Tyleon', url: '/lcotg', image: 'lcotg', }, 997856411: { x: 4, y: -1, efficiency: 100, level: 30, name: 'Lost City of Tyleon', url: '/lcoth', image: 'lcoth', }, 99785641: { x: 3, y: -1, efficiency: 100, level: 30, name: 'Lost City of Tyleon', url: '/lcoti', image: 'lcoti', }, }, }; }, get_buildings_resources(req, res) { const { buildings } = this.get_buildings(req, res); const withResources: Record = {}; const merged = { ...(buildings as Record), ...EXTRA_RESOURCE_BUILDINGS }; Object.entries(merged).forEach(([id, building]) => { withResources[id] = { ...building, ...resourceProfile(building.url), }; }); return { status: this.get_status(req, res), body: { surface_image: 'surface-p35', }, buildings: withResources, }; }, get_buildable(req, res) { const buildable: any = {}; _.each(BUILDING_TYPES, (name, type) => { buildable[name] = { url: `/${type}`, build: { can: 1, no_plot_use: 0, cost: { food: 500, water: 500, energy: 500, waste: 500, // is added to your storage, not spent like the other resources ore: 1000, time: 1200, }, tags: ['Now'], reason: '', }, image: type.startsWith('lcot') ? type : `${type}1`, production: { food_hour: 1500, energy_hour: -144, ore_hour: -1310, water_hour: -1100, waste_hour: 133, happiness_hour: 0, }, }; }); return { buildable, max_items_in_build_queue: 6, build_queue: { max: 4, current: 3, }, status: Empire.get_status(req, res), }; }, get_status(req, res) { return { server: Server.status_block(req, res), empire: Empire.status_block(req, res), body: Body.status_block(req, res), }; }, rearrange_buildings(req, res) { return { moved: [], body: { surface_image: 'surface-p35', }, status: Empire.get_status(req, res), }; }, status_block(req, res) { return { id: 'id-goes-here', x: -40, y: 29, zone: '0|0', star_id: 'id-goes-here', star_name: 'Sol', orbit: 1, type: 'habitable planet', name: 'Earth', image: 'p35', size: 67, water: 900, ore: { anthracite: 0, bauxite: 4000, beryl: 0, chalcopyrite: 0, chromite: 0, fluorite: 0, galena: 0, goethite: 0, gold: 3399, gypsum: 0, halite: 0, kerogen: 0, magnetite: 0, methane: 0, monazite: 0, rutile: 0, sulfur: 0, trona: 0, uraninite: 0, zircon: 0, }, empire: { id: 'id-goes-here', name: 'Earthlings', alignment: 'ally', is_isolationist: 1, }, station: { id: 'id-goes-here', x: 143, y: -27, name: 'The Death Star', }, needs_surface_refresh: 0, building_count: 7, build_queue_size: 15, build_queue_len: 10, plots_available: 60, happiness: 3939, happiness_hour: 25, unhappy_date: '01 13 2014 16:11:21 +0600', neutral_entry: '01 13 2014 16:11:21 +0600', propaganda_boost: 20, food_stored: 33329, food_capacity: 40000, food_hour: 229, energy_stored: 39931, energy_capacity: 43000, energy_hour: 391, ore_hour: 284, ore_capacity: 35000, ore_stored: 1901, waste_hour: 933, waste_stored: 9933, waste_capacity: 13000, water_stored: 9929, water_hour: 295, water_capacity: 51050, skip_incoming_ships: 1, num_incoming_enemy: 0, num_incoming_ally: 0, num_incoming_own: 0, incoming_enemy_ships: [], incoming_ally_ships: [], incoming_own_ships: [], }; }, }; export default Body;