Files
Vari 223f94a07b Fixed Catalog item Prestige reard and reward item tables and import using only the catalog item id as id, so we could not differentiate between the prestige levels.
Implemented tracking the progress of Signature challenges.

Also implemented both challenges Endpoints "getChallenges" ans "getChallengeProgressionBatch".

For "getChallenges", we just return an empty array since we dont need weekly and dailies yet.
2024-02-28 13:06:56 +01:00

47 lines
1.1 KiB
PHP

<?php
namespace App\Http\Responses\Api\Player\Challenges;
class ChallengeProgressionEntry implements \JsonSerializable
{
public string $challengeId;
public bool $completed;
public int $value;
public array $rewardsClaimed = [];
protected int $schemaVersion = 1;
protected string $className = 'ChallengeProgressionCounter';
public function __construct(string $challengeId, bool $completed, int $progress)
{
$this->challengeId = $challengeId;
$this->completed = $completed;
$this->value = $progress;
}
public function jsonSerialize(): mixed
{
$result = [
'challengeId' => $this->challengeId,
'completed' => $this->completed,
];
if($this->value === 0)
return $result;
else
$result['value'] = $this->value;
if(!$this->completed)
return $result;
$result['className'] = $this->className;
$result['schemaVersion'] = $this->schemaVersion;
$result['rewardsClaimed'] = $this->rewardsClaimed;
return $result;
}
}