find($villageId); if (! $village || $village->player?->user_id !== $user->id) { throw new GameRuleViolation('not_found', 'Village not found.'); } $target = Village::with('player')->where('world_id', $village->world_id)->where('x', $x)->where('y', $y)->first() ?? throw new GameRuleViolation('not_found', 'No village there.'); $market = Market::of($village); $market->checkTarget($target); $plan = $market->plan($target, now()->toImmutable()); return [ 'target' => Rally::summary($target), 'distance' => round($plan['distance'], 2), 'seconds' => $plan['seconds'], 'arrives_at' => MarketPresenter::iso($plan['arrives_at']), ]; } }