From 82875448c485d26375ed6dea4e64e940f6e10f74 Mon Sep 17 00:00:00 2001 From: Daniel Weipert Date: Mon, 8 Jan 2024 15:10:10 +0100 Subject: gemini --- src/gemini/Gemini.php | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'src/gemini/Gemini.php') diff --git a/src/gemini/Gemini.php b/src/gemini/Gemini.php index 41b8716..507b962 100644 --- a/src/gemini/Gemini.php +++ b/src/gemini/Gemini.php @@ -103,6 +103,32 @@ class Gemini $response = $unitController->train($request); } + else if (preg_match('@village/(\d+)/(\d+)/send-units@', $request->getPath(), $routeMatch)) { + $request + ->set('x', $routeMatch[1]) + ->set('y', $routeMatch[2]); + + if (preg_match('@village/(\d+)/(\d+)/send-units/type/(\w+)$@', $request->getPath(), $routeMatch)) { + $request->set('selectedUnit', $routeMatch[3]); + } + else if (preg_match('@village/(\d+)/(\d+)/send-units/type/(\w+)/village/(\d+)/(\d+)$@', $request->getPath(), $routeMatch)) { + $request + ->set('selectedUnit', $routeMatch[3]) + ->set('selectedVillageX', $routeMatch[4]) + ->set('selectedVillageY', $routeMatch[5]); + } + else if (preg_match('@village/(\d+)/(\d+)/send-units/type/(\w+)/village/(\d+)/(\d+)/action/(\w+)$@', $request->getPath(), $routeMatch)) { + $request + ->set('selectedUnit', $routeMatch[3]) + ->set('selectedVillageX', $routeMatch[4]) + ->set('selectedVillageY', $routeMatch[5]) + ->set('selectedAction', $routeMatch[6]); + } + + $unitController = new Unit(); + $response = $unitController->sendUnits($request); + } + else if (preg_match('@village/(\d+)/(\d+)@', $request->getPath(), $routeMatch)) { $request ->set('x', $routeMatch[1]) -- cgit v1.2.3