diff --git a/app/Http/Controllers/Abstracts/AbstractBuildingsController.php b/app/Http/Controllers/Abstracts/AbstractBuildingsController.php index 08cc0c0e..6df7e880 100644 --- a/app/Http/Controllers/Abstracts/AbstractBuildingsController.php +++ b/app/Http/Controllers/Abstracts/AbstractBuildingsController.php @@ -146,6 +146,15 @@ public function indexPageParams(Request $request, PlayerService $player): array $build_queue_max = true; } + // If openTech is in querystring, add client JS to open the technology tab. + $open_tech_id = 0; + if ($request->query->has('openTech')) { + $open_tech_id = $request->query('openTech'); + if (!is_numeric($open_tech_id)) { + $open_tech_id = 0; + } + } + return [ 'planet_id' => $this->planet->getPlanetId(), 'planet_name' => $this->planet->getPlanetName(), @@ -155,6 +164,7 @@ public function indexPageParams(Request $request, PlayerService $player): array 'build_active' => $build_active, 'build_queue' => $build_queue, 'build_queue_max' => $build_queue_max, + 'open_tech_id' => $open_tech_id, ]; } diff --git a/app/Http/Controllers/Abstracts/AbstractUnitsController.php b/app/Http/Controllers/Abstracts/AbstractUnitsController.php index 31ad9e79..367e888e 100644 --- a/app/Http/Controllers/Abstracts/AbstractUnitsController.php +++ b/app/Http/Controllers/Abstracts/AbstractUnitsController.php @@ -107,6 +107,15 @@ public function indexPage(Request $request, PlayerService $player): array } } + // If openTech is in querystring, add client JS to open the technology tab. + $open_tech_id = 0; + if ($request->query->has('openTech')) { + $open_tech_id = $request->query('openTech'); + if (!is_numeric($open_tech_id)) { + $open_tech_id = 0; + } + } + return [ 'planet_id' => $planet->getPlanetId(), 'planet_name' => $planet->getPlanetName(), @@ -114,6 +123,7 @@ public function indexPage(Request $request, PlayerService $player): array 'build_active' => $build_active, 'build_queue' => $build_queue, 'build_queue_countdown' => $queue_time_countdown, + 'open_tech_id' => $open_tech_id, ]; } diff --git a/app/Http/Controllers/ResearchController.php b/app/Http/Controllers/ResearchController.php index 10c36591..f622aa69 100644 --- a/app/Http/Controllers/ResearchController.php +++ b/app/Http/Controllers/ResearchController.php @@ -45,11 +45,12 @@ public function __construct(ResearchQueueService $queue) /** * Shows the research index page * + * @param Request $request * @param PlayerService $player * @return View * @throws Exception */ - public function index(PlayerService $player): View + public function index(Request $request, PlayerService $player): View { $this->setBodyId('research'); $planet = $player->planets->current(); @@ -108,6 +109,15 @@ public function index(PlayerService $player): View $build_queue_max = true; } + // If openTech is in querystring, add client JS to open the technology tab. + $open_tech_id = 0; + if ($request->query->has('openTech')) { + $open_tech_id = $request->query('openTech'); + if (!is_numeric($open_tech_id)) { + $open_tech_id = 0; + } + } + return view('ingame.research.index')->with([ 'planet_id' => $planet->getPlanetId(), 'planet_name' => $planet->getPlanetName(), @@ -116,6 +126,7 @@ public function index(PlayerService $player): View 'build_queue' => $research_queue, 'build_queue_max' => $build_queue_max, 'research_lab_upgrading' => $research_lab_upgrading, + 'open_tech_id' => $open_tech_id, ]); } diff --git a/resources/views/ingame/defense/index.blade.php b/resources/views/ingame/defense/index.blade.php index 8c1dfb77..c5466220 100644 --- a/resources/views/ingame/defense/index.blade.php +++ b/resources/views/ingame/defense/index.blade.php @@ -72,4 +72,6 @@ technologyDetails.init() + {{-- openTech querystring parameter handling --}} + @include ('ingame.shared.technology.open-tech', ['open_tech_id' => $open_tech_id]) @endsection diff --git a/resources/views/ingame/facilities/index.blade.php b/resources/views/ingame/facilities/index.blade.php index bbdb8abd..94e33a9c 100644 --- a/resources/views/ingame/facilities/index.blade.php +++ b/resources/views/ingame/facilities/index.blade.php @@ -135,4 +135,6 @@ class="upgrade tooltip hideOthers js_hideTipOnMobile" technologyDetails.init() + {{-- openTech querystring parameter handling --}} + @include ('ingame.shared.technology.open-tech', ['open_tech_id' => $open_tech_id]) @endsection diff --git a/resources/views/ingame/research/index.blade.php b/resources/views/ingame/research/index.blade.php index 1c2fd739..ba359e94 100644 --- a/resources/views/ingame/research/index.blade.php +++ b/resources/views/ingame/research/index.blade.php @@ -106,7 +106,8 @@ loca: loca }) technologyDetails.init() - + {{-- openTech querystring parameter handling --}} + @include ('ingame.shared.technology.open-tech', ['open_tech_id' => $open_tech_id]) @endsection diff --git a/resources/views/ingame/resources/index.blade.php b/resources/views/ingame/resources/index.blade.php index e727a9f8..e2cfa837 100644 --- a/resources/views/ingame/resources/index.blade.php +++ b/resources/views/ingame/resources/index.blade.php @@ -152,4 +152,6 @@ class="productionboxshipyard injectedComponent parent supplies"> technologyDetails.init() + {{-- openTech querystring parameter handling --}} + @include ('ingame.shared.technology.open-tech', ['open_tech_id' => $open_tech_id]) @endsection diff --git a/resources/views/ingame/shared/technology/open-tech.blade.php b/resources/views/ingame/shared/technology/open-tech.blade.php new file mode 100644 index 00000000..c55530f6 --- /dev/null +++ b/resources/views/ingame/shared/technology/open-tech.blade.php @@ -0,0 +1,6 @@ +@php /** @var int $open_tech_id */ @endphp +@if ($open_tech_id > 0) + +@endif diff --git a/resources/views/ingame/shipyard/index.blade.php b/resources/views/ingame/shipyard/index.blade.php index ff55386e..00c5bb55 100644 --- a/resources/views/ingame/shipyard/index.blade.php +++ b/resources/views/ingame/shipyard/index.blade.php @@ -83,4 +83,6 @@ technologyDetails.init() + {{-- openTech querystring parameter handling --}} + @include ('ingame.shared.technology.open-tech', ['open_tech_id' => $open_tech_id]) @endsection