26 lines
652 B
PHP
26 lines
652 B
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace App\Websocket\Controllers;
|
||
|
|
|
||
|
|
use App\Actions\ShowMap;
|
||
|
|
use App\Websocket\GameController;
|
||
|
|
|
||
|
|
/** map.view {world_id, x?, y?, w, h}: villages around (x, y), or around the player's village. */
|
||
|
|
class MapController extends GameController
|
||
|
|
{
|
||
|
|
public function view()
|
||
|
|
{
|
||
|
|
$x = request('x');
|
||
|
|
$y = request('y');
|
||
|
|
|
||
|
|
return $this->play(fn () => app(ShowMap::class)(
|
||
|
|
auth()->user(),
|
||
|
|
(int) request('world_id'),
|
||
|
|
is_numeric($x) ? (int) $x : null,
|
||
|
|
is_numeric($y) ? (int) $y : null,
|
||
|
|
(int) (request('w') ?: 15),
|
||
|
|
(int) (request('h') ?: 15),
|
||
|
|
));
|
||
|
|
}
|
||
|
|
}
|