--- import { ObjectId } from 'mongodb'; import { getHighestWeightedLanguage, getLocales, getName } from '../lib/utils/langDriver'; import { getAllResources } from '../lib/db/resources'; import locationManager from '../lib/classes/managers/LocationManager'; import { Resource } from '../lib/classes/managers/abstract/ResourceManager'; const resourceTypes = await getAllResources(); const lang = await getLocales(Astro.cookies.get('language')?.value ?? await getHighestWeightedLanguage(Astro.request.headers.get('accept-language'))); const planetId = new ObjectId(Astro.cookies.get('currentPlanet')?.value ?? ''); const planet = locationManager.findId(planetId); if(!planet) return; await planet.resources.calculateCurrentAvailableResources(); const resourceArray: Resource[] = []; for(const key of planet.resources.resources) { resourceArray.push(key); } ---
{resourceArray.map(res =>
x.id === res.id)?.type ?? "solid"} data-res-id={res.id} data-res-amount={res.amount} data-res-mining-rate={res.perHourMiningRate} > x.id === res.id)?.icon ?? "#"} alt={res.id} class="icon" />
{getName(lang, 'resources', res.id)}
{getName(lang, 'general', 'avaliable')} - {Math.floor(res.amount).toString()}
{getName(lang, 'general', 'production')} - {res.perHourMiningRate?.toString() ?? "0"}
{getName(lang, 'general', 'capacity')} - {'21372137'}
)}