Build world campaigns rewards and recaps

This commit is contained in:
2026-05-01 11:44:41 +02:00
parent 28e7e46e13
commit 257b0dbef6
100 changed files with 11300 additions and 367 deletions

View File

@@ -5,6 +5,7 @@ declare(strict_types=1);
namespace App\Services;
use App\Events\Achievements\UserXpUpdated;
use App\Enums\WorldRewardType;
use App\Models\User;
use App\Models\UserXpLog;
use Illuminate\Support\Arr;
@@ -123,6 +124,11 @@ class XPService
return $this->awardUnique($userId, 5, 'comment_created:' . $scope, $referenceId);
}
public function awardWorldReward(int $userId, WorldRewardType $rewardType, int $worldId): bool
{
return $this->awardUnique($userId, $rewardType->xpReward(), 'world_reward:' . $rewardType->value, $worldId);
}
public function awardArtworkViewReceived(int $userId, int $artworkId, ?int $viewerId = null, ?string $ipAddress = null): bool
{
$viewerKey = $viewerId !== null && $viewerId > 0