diff options
Diffstat (limited to 'src/gemini/Gemini.php')
-rw-r--r-- | src/gemini/Gemini.php | 26 |
1 files changed, 26 insertions, 0 deletions
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]) |