--- 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); } ---