mirror of
https://github.com/Deathgarden-Rebirth/Deathgarden_Rebirth-Rewrite.git
synced 2026-09-08 19:25:10 -05:00
Added handling of the "playerId" parameter to InitOrGetGroups.
This commit is contained in:
@@ -14,6 +14,7 @@
|
||||
use App\Http\Responses\Api\Player\InitOrGetGroupsResponse;
|
||||
use App\Http\Responses\Api\Player\UpdateMetadataResponse;
|
||||
use App\Models\Game\PickedChallenge;
|
||||
use App\Models\User\User;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Ramsey\Uuid\Type\Hexadecimal;
|
||||
use Ramsey\Uuid\Uuid;
|
||||
@@ -23,7 +24,15 @@ class MetadataController extends Controller
|
||||
public function initOrGetGroups(InitOrGetGroupsRequest $request)
|
||||
{
|
||||
$response = new InitOrGetGroupsResponse();
|
||||
$user = Auth::user();
|
||||
|
||||
// If the request has set a player Id, use it.
|
||||
// if not use the current authenticated user from this session.
|
||||
// This is important because the hosts requests the progression and metadata groups for the other players
|
||||
// for tracking challenges and so on.
|
||||
if($request->playerId !== null)
|
||||
$user = User::find($request->playerId);
|
||||
else
|
||||
$user = Auth::user();
|
||||
|
||||
foreach (ItemGroupType::cases() as $group) {
|
||||
if ($group == ItemGroupType::None)
|
||||
|
||||
Reference in New Issue
Block a user