|
5 | 5 | use Azuriom\Extensions\Plugin\PluginManager; |
6 | 6 | use Azuriom\Extensions\UpdateManager; |
7 | 7 | use Azuriom\Games\FiveMGame; |
| 8 | +use Azuriom\Games\HytaleGame; |
8 | 9 | use Azuriom\Games\Minecraft\MinecraftBedrockGame; |
9 | 10 | use Azuriom\Games\Minecraft\MinecraftOnlineGame; |
10 | 11 | use Azuriom\Games\Steam\SteamGame; |
@@ -63,6 +64,10 @@ class InstallController extends Controller |
63 | 64 | 'name' => 'Minecraft: Bedrock Edition', |
64 | 65 | 'logo' => 'assets/img/games/minecraft.svg', |
65 | 66 | ], |
| 67 | + 'hytale' => [ |
| 68 | + 'name' => 'Hytale (Early Access)', |
| 69 | + 'logo' => 'assets/img/games/hytale.png', |
| 70 | + ], |
66 | 71 | 'gmod' => [ |
67 | 72 | 'name' => 'Garry\'s mod', |
68 | 73 | 'logo' => 'assets/img/games/gmod.svg', |
@@ -228,18 +233,10 @@ public function showGame(string $game) |
228 | 233 | { |
229 | 234 | abort_if(! array_key_exists($game, $this->games), 404); |
230 | 235 |
|
231 | | - if ($game === 'minecraft') { |
| 236 | + if ($game === 'minecraft' || $game === 'mc-bedrock' || $game === 'hytale') { |
232 | 237 | return view('install.games.minecraft', [ |
233 | 238 | 'game' => $game, |
234 | | - 'gameName' => 'Minecraft', |
235 | | - 'locales' => self::getAvailableLocales(), |
236 | | - ]); |
237 | | - } |
238 | | - |
239 | | - if ($game === 'mc-bedrock') { |
240 | | - return view('install.games.minecraft', [ |
241 | | - 'game' => $game, |
242 | | - 'gameName' => 'Minecraft: Bedrock Edition', |
| 239 | + 'gameName' => Arr::get($this->games, $game.'.name', $game), |
243 | 240 | 'locales' => self::getAvailableLocales(), |
244 | 241 | ]); |
245 | 242 | } |
@@ -273,8 +270,8 @@ public function setupGame(Request $request, string $game) |
273 | 270 | return $this->setupSteamGame($request, $game); |
274 | 271 | } |
275 | 272 |
|
276 | | - if ($game === 'minecraft' || $game === 'mc-bedrock') { |
277 | | - return $this->setupMinecraftGame($request, $game); |
| 273 | + if ($game === 'minecraft' || $game === 'mc-bedrock' || $game === 'hytale') { |
| 274 | + return $this->setupMinecraftOrHytale($request, $game); |
278 | 275 | } |
279 | 276 |
|
280 | 277 | if ($game === 'fivem-cfx') { |
@@ -334,13 +331,13 @@ protected function setupSteamGame(Request $request, string $game) |
334 | 331 | } |
335 | 332 |
|
336 | 333 | /** |
337 | | - * Install Azuriom for Minecraft (with register or Microsoft OAuth). |
| 334 | + * Install Azuriom for Minecraft (with register or Microsoft OAuth) or Hytale. |
338 | 335 | * |
339 | 336 | * @throws \Illuminate\Validation\ValidationException |
340 | 337 | */ |
341 | | - protected function setupMinecraftGame(Request $request, string $game) |
| 338 | + protected function setupMinecraftOrHytale(Request $request, string $game) |
342 | 339 | { |
343 | | - if ($game !== 'mc-bedrock') { |
| 340 | + if ($game !== 'mc-bedrock' && $game !== 'hytale') { |
344 | 341 | $game = $request->input('oauth') ? 'mc-online' : 'mc-offline'; |
345 | 342 | } |
346 | 343 |
|
@@ -368,6 +365,12 @@ protected function setupMinecraftGame(Request $request, string $game) |
368 | 365 | if ($name === null) { |
369 | 366 | throw ValidationException::withMessages(['xuid' => 'Invalid Xbox XUID.']); |
370 | 367 | } |
| 368 | + } elseif ($game === 'hytale') { |
| 369 | + $response = Http::get(HytaleGame::PLAYER_LOOKUP.$request->input('name')); |
| 370 | + |
| 371 | + if (! $response->successful() || ! ($gameId = $response->json('data.player.id'))) { |
| 372 | + throw ValidationException::withMessages(['name' => 'You must enter a valid Hytale username.']); |
| 373 | + } |
371 | 374 | } |
372 | 375 |
|
373 | 376 | return $this->setupAzuriom($request, $game, $name, $gameId ?? null); |
@@ -479,7 +482,7 @@ protected function setupAzuriom(Request $request, string $game, ?string $name, ? |
479 | 482 |
|
480 | 483 | $user->markEmailAsVerified(); |
481 | 484 |
|
482 | | - if ($game !== 'mc-offline') { |
| 485 | + if ($game !== 'mc-offline' && $game !== 'hytale') { |
483 | 486 | Setting::updateSettings('register', false); |
484 | 487 | } |
485 | 488 |
|
|
0 commit comments