mirror of
https://github.com/Deathgarden-Rebirth/Deathgarden_Rebirth-Rewrite.git
synced 2026-09-09 03:35:14 -05:00
update UpdateMetadta to set the metadata of the player iven with 'playerId'.
This commit is contained in:
@@ -29,10 +29,10 @@ public function initOrGetGroups(InitOrGetGroupsRequest $request)
|
||||
// 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
|
||||
if($request->playerId === null)
|
||||
$user = Auth::user();
|
||||
else
|
||||
$user = User::find($request->playerId);
|
||||
|
||||
foreach (ItemGroupType::cases() as $group) {
|
||||
if ($group == ItemGroupType::None)
|
||||
@@ -75,7 +75,16 @@ public function updateMetadataGroup(UpdateMetadataGroupRequest $request)
|
||||
|
||||
private function handleUpdateCharacterMetadata(UpdateMetadataGroupRequest &$request): string|bool
|
||||
{
|
||||
$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 = Auth::user();
|
||||
else
|
||||
$user = User::find($request->playerId);
|
||||
|
||||
|
||||
$characterData = $user->playerData()->characterDataForCharacter($request->group->getCharacter());
|
||||
|
||||
$convertedIds = UuidHelper::convertFromHexToUuidCollecton($request->metadata['equipment'], true);
|
||||
@@ -127,7 +136,14 @@ private function handleUpdateCharacterMetadata(UpdateMetadataGroupRequest &$requ
|
||||
|
||||
private function handleUpdatePlayerMetadata(UpdateMetadataGroupRequest &$request): string|bool
|
||||
{
|
||||
$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 = Auth::user();
|
||||
else
|
||||
$user = User::find($request->playerId);
|
||||
|
||||
$playerData = $user->playerData();
|
||||
$playerData->last_faction = Faction::tryFrom($request->metadata['lastPlayedFaction']);
|
||||
|
||||
Reference in New Issue
Block a user