Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open tech popup when openTech key is present in querystring #522

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions app/Http/Controllers/Abstracts/AbstractBuildingsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand All @@ -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,
];
}

Expand Down
10 changes: 10 additions & 0 deletions app/Http/Controllers/Abstracts/AbstractUnitsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,13 +107,23 @@ 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(),
'units' => $units,
'build_active' => $build_active,
'build_queue' => $build_queue,
'build_queue_countdown' => $queue_time_countdown,
'open_tech_id' => $open_tech_id,
];
}

Expand Down
13 changes: 12 additions & 1 deletion app/Http/Controllers/ResearchController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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(),
Expand All @@ -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,
]);
}

Expand Down
2 changes: 2 additions & 0 deletions resources/views/ingame/defense/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,6 @@
technologyDetails.init()
</script>
</div>
{{-- openTech querystring parameter handling --}}
@include ('ingame.shared.technology.open-tech', ['open_tech_id' => $open_tech_id])
@endsection
2 changes: 2 additions & 0 deletions resources/views/ingame/facilities/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,4 +135,6 @@ class="upgrade tooltip hideOthers js_hideTipOnMobile"
technologyDetails.init()
</script>
</div>
{{-- openTech querystring parameter handling --}}
@include ('ingame.shared.technology.open-tech', ['open_tech_id' => $open_tech_id])
@endsection
3 changes: 2 additions & 1 deletion resources/views/ingame/research/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@
loca: loca
})
technologyDetails.init()

</script>
</div>
{{-- openTech querystring parameter handling --}}
@include ('ingame.shared.technology.open-tech', ['open_tech_id' => $open_tech_id])
@endsection
2 changes: 2 additions & 0 deletions resources/views/ingame/resources/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,4 +152,6 @@ class="productionboxshipyard injectedComponent parent supplies">
technologyDetails.init()
</script>
</div>
{{-- openTech querystring parameter handling --}}
@include ('ingame.shared.technology.open-tech', ['open_tech_id' => $open_tech_id])
@endsection
6 changes: 6 additions & 0 deletions resources/views/ingame/shared/technology/open-tech.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
@php /** @var int $open_tech_id */ @endphp
@if ($open_tech_id > 0)
<script type="text/javascript">
$('.technology.hasDetails:not(.showsDetails)[data-technology="{{ $open_tech_id }}"] .icon').click();
</script>
@endif
2 changes: 2 additions & 0 deletions resources/views/ingame/shipyard/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,4 +83,6 @@
technologyDetails.init()
</script>
</div>
{{-- openTech querystring parameter handling --}}
@include ('ingame.shared.technology.open-tech', ['open_tech_id' => $open_tech_id])
@endsection
Loading