From b21316248572cb27ed1f504529ad6680a473022e Mon Sep 17 00:00:00 2001 From: Daniel Weipert Date: Tue, 2 Jan 2024 20:42:01 +0100 Subject: gemini --- src/Controller/Building.php | 47 --------------------------------------------- 1 file changed, 47 deletions(-) delete mode 100644 src/Controller/Building.php (limited to 'src/Controller/Building.php') diff --git a/src/Controller/Building.php b/src/Controller/Building.php deleted file mode 100644 index e141113..0000000 --- a/src/Controller/Building.php +++ /dev/null @@ -1,47 +0,0 @@ -get('x'), $request->get('y')); - $building = Model::getByVillage($village->id, $request->get('type')) ?? Model::getEmpty($village->id, $request->get('type')); - - // resources - foreach ($building->getResourceRequirements() as $resourceType => $resourceValue) { - $village->{$resourceType} -= $resourceValue; - } - $village->updateResources(); - - // event - $event = new Event(); - $event->time = (new \DateTime())->add(\DateInterval::createFromDateString( - $building->getBuildTimeForLevel($building->getEffectiveLevel() + 1) . ' seconds' - )); - $event->villageId = $building->villageId; - $upgradeBuildingEvent = new UpgradeBuilding(); - $upgradeBuildingEvent->event = $event; - $upgradeBuildingEvent->type = $building->type; - $upgradeBuildingEvent->dbInsert(); - - return new RedirectResponse( - Router::generate( - 'village.show', - ['x' => $request->get('x'), 'y' => $request->get('y')] - ) - ); - } -} -- cgit v1.2.3