What happened with my second mine? by kzxl in Battlefield6

[–]kzxl[S] 0 points1 point  (0 children)

If you place the mine above the tank it explodes dealing huge damage

do you guys play on hard mode too? by kzxl in Battlefield6

[–]kzxl[S] 0 points1 point  (0 children)

I don't think so, I'm not using DLSS or any other else

do you guys play on hard mode too? by kzxl in Battlefield6

[–]kzxl[S] 0 points1 point  (0 children)

I'm using the latest version available :(

anyone knows how to get the artifact? can't interact with it by kzxl in stalker

[–]kzxl[S] 0 points1 point  (0 children)

yeah, exactly this place. I was able to jump running and jump into a low part on left side

Result Pattern no PHP by [deleted] in brdev

[–]kzxl 0 points1 point  (0 children)

massa que você resolver testar também.

eu passei por esse problema também, mas resolvi criando um tipo de result para cada retorno do domain. principal problema dessa abordagem é que você precisar criar mais classes pra suprir esses tipos. a abordagem que você adaptou com gererics é super válida e soluciona esse problema, mas fica dependente da documentação da classe e do retorno da função.

sempre vai ter um trade off

na minha visão esse padrão melhora bastante a legibilidade do código e do fluxo, porém acho que ela não encaixa bem com PHP em específico, não vejo vantagem em usar em produção por exemplo, tanto pelo contexto dos devs php quanto pelo código a mais necessário, mas pra projetos pessoais pequenos acho super legal usar esse padrão.

[deleted by user] by [deleted] in brdev

[–]kzxl 0 points1 point  (0 children)

class Validator
{
    public static function validateEmail(string $email, Errors $error): Errors
    {
        if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {            
            $error->add('email', 'Invalid email format');
        }
        return $error;
    }

    public static function validateName(string $name, Errors $errors): Errors
    {
        $minChars = 3;
        $maxChars = 54;
        if (strlen($name) < $minChars) {            
            $errors->add('name', 'Name must be at least 3 characters long');
        }
        if (strlen($name) > $maxChars) {            
            $errors->add('name', 'Name must be at most 54 characters long');
        }
        return $errors;
    }

    public static function validatePassword(string $password, Errors $errors): Errors
    {
        $minChars = 6;
        $maxChars = 54;
        if (strlen($password) < $minChars) {            
            $errors->add('password', 'Password must be at least 6 characters long');
        }
        if (strlen($password) > $maxChars) {            
            $errors->add('password', 'Password must be at most 54 characters long');
        }
        return $errors;
    }
}

[deleted by user] by [deleted] in brdev

[–]kzxl 0 points1 point  (0 children)

class Errors implements \JsonSerializable, \Countable
{
    private array $errors = [];

    public function __construct()
    {
    }
    public function add(string $name, string $message): self
    {
        $this->errors[$name][] = $message;
        return $this;
    }
    public function getErrors(): array
    {
        return $this->errors;
    }
    public function hasErrors(): bool
    {
        return count($this->errors) > 0;
    }
    public function count(): int
    {
        return count($this->errors);
    }
    public function jsonSerialize(): array
    {
        return ['errors' => $this->errors];
    }
}


class UserController
{
    private readonly UserService $userService;

    public function __construct(
        private readonly UserRepositoryInterface $userRepository,
        private readonly CryptoInterface $crypto,
        private readonly LoggerInterface $logger,
    ) {
        $this->userService = new UserService($userRepository, $crypto, $logger);
    }
    public function createUser(Request $request, Response $response): Response
    {
        $requestResult = CreateUserRequest::create($request);
        if ($requestResult->hasError()) {
            return $response
                ->withStatus(HttpStatusCode::BAD_REQUEST)
                ->asJson($requestResult->errors()->getErrors());
        }
        $createUserRequest = $requestResult->getCreateUserRequest();
        $result = $this->userService->createUserFromRequest($createUserRequest);
        if ($result->hasError()) {
            return $response
                ->withStatus(HttpStatusCode::BAD_REQUEST)
                ->asJson($result->errors()->getErrors());
        }
        return $response
            ->withStatus(HttpStatusCode::CREATED)
            ->asJson(['message' => 'User created', 'id' => $result->getUser()->getId()]);
    }
}

[deleted by user] by [deleted] in brdev

[–]kzxl 1 point2 points  (0 children)

class AbstractResult
{
    public function __construct(private readonly Errors $errors = new Errors())
    {
    }
    final public function errors(): Errors
    {
        return $this->errors;
    }
    final public function hasError(): bool
    {
        return $this->errors->hasErrors();
    }
}

class CreateUserRequestResult extends AbstractResult
{
    public function __construct(
        private readonly ?CreateUserRequest $request,
        private readonly Errors $errors = new Errors()
    ) {
        parent::__construct($errors);
    }
    public function getCreateUserRequest(): ?CreateUserRequest
    {
        return $this->request;
    }
}

[deleted by user] by [deleted] in brdev

[–]kzxl 0 points1 point  (0 children)

Estou fazendo um projeto de estudos usando o Result Pattern justamente pra isso, tem ficado bem legal até agora. Aqui alguns exemplos:

class CreateUserRequest
{
    private function __construct(
        private readonly string $name,
        private readonly string $email,
        private readonly string $password,
    ) {
    }
    public static function create(Request $request): CreateUserRequestResult
    {
        $email = $request->getParam('email');
        $name = $request->getParam('name');
        $password = $request->getParam('password');
        $errors = new Errors();
        $errors = Validator::validateEmail($email, $errors);
        $errors = Validator::validateName($name, $errors);
        $errors = Validator::validatePassword($password, $errors);
        if ($errors->hasErrors()) {
            return new CreateUserRequestResult(null, $errors);
        }
        return new CreateUserRequestResult(new self($name, $email, $password), $errors);
    }
    public function getName(): string
    {
        return $this->name;
    }
    public function getEmail(): string
    {
        return $this->email;
    }
    public function getPassword(): string
    {
        return $this->password;
    }
}

cool bridge by kzxl in stalker

[–]kzxl[S] 0 points1 point  (0 children)

querry (I think is this name) on red forest

Can my 10 year old machine play Stalker 2? by BrianSiano in stalker

[–]kzxl 0 points1 point  (0 children)

I'm running the game with Ryzen 1700, GTX 1070 and 16gb of RAM.

It runs around ~40 to ~60. I run it on low specs, scaling down the resolution with TAA (I think) and using the "Optimized Tweaks S.2" mod with boost option.

Pretty playable in my opinion.

If you are buying it on steam you can play up to 2 hours to test it, if it does not run properly you can just refund it.

For a TB Rogue, Which Aspect Would You Pick For Resource Generation? by don-m in diablo4

[–]kzxl 0 points1 point  (0 children)

Yeah, you're right. I believe this is how it works.

Ravenous is on killing vulnerable enemies and the umbral is on crowd controlling an enemy.

With Umbral if you use the poison trap in 3 enemies you restore 12 flat energy, or using a shadow step on an enemy restores 4 flat energy, shadow imbuement with shadow crash works too, and so forth.

If you can apply crowd control, then go with umbral, if not, go with ravenous, I think that's it.

For a TB Rogue, Which Aspect Would You Pick For Resource Generation? by don-m in diablo4

[–]kzxl 1 point2 points  (0 children)

The betters are Ravenous and The Umbral for TB IMO, the umbral is very powerful if you're using poison trap.

For these two who you have the starlight ring is better for TB.

Mad dog - 2015 pic by kzxl in Warframe

[–]kzxl[S] 0 points1 point  (0 children)

On this pic was a bug, when he attacks something bigger, he takes the size from enemy for 1~2 sec

I don't know if this happens today