mirror of
https://github.com/Deathgarden-Rebirth/Deathgarden_Rebirth-Rewrite.git
synced 2026-03-21 18:04:46 -05:00
Removed Challenge reduction in picked challenges because it caused the game to reset character loadout's.
Also updated the addDefaultItems commadn to accept a user ID.
This commit is contained in:
parent
a3ca76c7f7
commit
76df564f44
|
|
@ -6,6 +6,7 @@
|
|||
use App\Enums\Game\Characters;
|
||||
use App\Helper\Uuid\UuidHelper;
|
||||
use App\Models\User\PlayerData;
|
||||
use App\Models\User\User;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Database\QueryException;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
|
@ -17,7 +18,7 @@ class GiveAllUsersDefaultItems extends Command
|
|||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'app:give-all-users-default-items';
|
||||
protected $signature = 'app:give-all-users-default-items {userId?}';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
|
|
@ -31,7 +32,11 @@ class GiveAllUsersDefaultItems extends Command
|
|||
*/
|
||||
public function handle()
|
||||
{
|
||||
$playerDatas = PlayerData::all();
|
||||
$userId = $this->argument('userId');
|
||||
if($userId === null)
|
||||
$playerDatas = PlayerData::all();
|
||||
else
|
||||
$playerDatas = [User::findOrFail($userId)->playerData()];
|
||||
|
||||
foreach ($playerDatas as $playerData) {
|
||||
foreach (Characters::cases() as $case) {
|
||||
|
|
|
|||
|
|
@ -177,10 +177,13 @@ protected function addProgressToChallenge(string $challengeId, int $newProgress,
|
|||
return;
|
||||
}
|
||||
|
||||
/** @var PickedChallenge $foundChallenge */
|
||||
$foundChallenge = PickedChallenge::find($challengeId);
|
||||
if($foundChallenge === null)
|
||||
return;
|
||||
|
||||
$newProgress = $newProgress >= MetadataController::reducePickedChallengeCompletionValue($foundChallenge->asset_path, $foundChallenge->completion_value) ? $foundChallenge->completion_value : $newProgress;
|
||||
|
||||
$foundChallenge->progress = $newProgress;
|
||||
$foundChallenge->save();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -163,7 +163,7 @@ private function handleUpdateCharacterMetadata(UpdateMetadataGroupRequest &$requ
|
|||
foreach ($picked['list'] as $challenge) {
|
||||
$challengeId = Uuid::fromHexadecimal(new Hexadecimal($challenge['challengeId']));
|
||||
$assetPath = $challenge['challengeAsset'];
|
||||
$completionValue = static::reducePickedChallengeCompletionValue($assetPath, $challenge['challengeCompletionValue']);
|
||||
$completionValue = $challenge['challengeCompletionValue'];
|
||||
|
||||
$attributes = [
|
||||
'id' => $challengeId->toString(),
|
||||
|
|
@ -231,6 +231,13 @@ private function handleFactionMetadata(UpdateMetadataGroupRequest &$request): st
|
|||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reduces the Completion value of the given challenge.
|
||||
*
|
||||
* @param string $challengeBlueprint
|
||||
* @param string $originalAmount
|
||||
* @return int
|
||||
*/
|
||||
public static function reducePickedChallengeCompletionValue(
|
||||
string $challengeBlueprint,
|
||||
string $originalAmount,
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user