diff --git a/src/lib/classes/Building.ts b/src/lib/classes/Building.ts index 122158f..cd55c9e 100644 --- a/src/lib/classes/Building.ts +++ b/src/lib/classes/Building.ts @@ -52,7 +52,7 @@ export default class Building { const playerResearch = this.manager.planet.manager.owner.research; let playerResearchCanBuild = { canBuild: true, missing: "" }; for(const researchReq of this.data.requirements.research) { - if(playerResearch.research.find((research) => research.id === researchReq.id)?.level ?? 0 < researchReq.level) { + if((playerResearch.research.find((research) => research.id === researchReq.id)?.level ?? 0) < researchReq.level) { playerResearchCanBuild = { canBuild: false, missing: `${researchReq.id} level ${researchReq.level} required, found ${playerResearch.research.find((research) => research.id === researchReq.id)?.level ?? 0}` }; } }; diff --git a/src/pages/api/build/createBuilding.ts b/src/pages/api/build/createBuilding.ts index 6dacf05..c3fdf48 100644 --- a/src/pages/api/build/createBuilding.ts +++ b/src/pages/api/build/createBuilding.ts @@ -67,7 +67,7 @@ export const POST: APIRoute = async({ request }) => { JSON.stringify({ code: 400, message: "Bad Request", - error: requirements.error + " | " + resources ? "" : "Not enough resources" + error: `${requirements.error} | ${resources ? "" : "Not enough resources"}` }), { status: 400 } ) }