mirror of
https://github.com/Deathgarden-Rebirth/Deathgarden_Rebirth-Rewrite.git
synced 2026-09-09 03:35:14 -05:00
Added check that automatically sets the picked challenges of the new lvl 10 default items to completed so that they don't show up in game.
This commit is contained in:
@@ -140,6 +140,17 @@ private function handleUpdateCharacterMetadata(UpdateMetadataGroupRequest &$requ
|
||||
$convertedIds = UuidHelper::convertFromHexToUuidCollecton($request->metadata['equippedWeapons'], true);
|
||||
$characterData->equippedWeapons()->sync($convertedIds);
|
||||
|
||||
$characterConfig = $characterData->character->getCharacter()->getItemConfigClass();
|
||||
$defaultCompletedIds = [
|
||||
...$characterConfig::getDefaultEquippedBonuses(),
|
||||
...$characterConfig::getDefaultEquippedWeapons(),
|
||||
...$characterConfig::getDefaultEquipment(),
|
||||
...$characterConfig::getDefaultPowers(),
|
||||
...$characterConfig::getDefaultEquippedPerks(),
|
||||
];
|
||||
|
||||
$defaultCompletedIds = UuidHelper::convertFromHexToUuidCollecton($defaultCompletedIds, true);
|
||||
|
||||
foreach ($request->metadata['pickedChallenges'] as $picked) {
|
||||
$itemId = Uuid::fromHexadecimal(new Hexadecimal($picked['itemId']));
|
||||
$pickedChallenge = $characterData->getPicketChallengeForItem($itemId);
|
||||
@@ -153,11 +164,16 @@ private function handleUpdateCharacterMetadata(UpdateMetadataGroupRequest &$requ
|
||||
$assetPath = $challenge['challengeAsset'];
|
||||
$completionValue = static::reducePickedChallengeCompletionValue($assetPath, $challenge['challengeCompletionValue']);
|
||||
|
||||
$newPicked = new PickedChallenge([
|
||||
$attributes = [
|
||||
'id' => $challengeId->toString(),
|
||||
'completion_value' => $completionValue,
|
||||
'asset_path' => $assetPath,
|
||||
]);
|
||||
];
|
||||
|
||||
if($defaultCompletedIds->has($itemId->toString()))
|
||||
$attributes['progress'] = $completionValue;
|
||||
|
||||
$newPicked = new PickedChallenge($attributes);
|
||||
|
||||
$newPicked->characterData()->associate($characterData);
|
||||
$newPicked->catalogItem()->associate($itemId->toString());
|
||||
|
||||
Reference in New Issue
Block a user