mirror of
https://github.com/Deathgarden-Rebirth/Deathgarden_Rebirth-Rewrite.git
synced 2026-04-29 11:37:17 -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\Enums\Game\Characters;
|
||||||
use App\Helper\Uuid\UuidHelper;
|
use App\Helper\Uuid\UuidHelper;
|
||||||
use App\Models\User\PlayerData;
|
use App\Models\User\PlayerData;
|
||||||
|
use App\Models\User\User;
|
||||||
use Illuminate\Console\Command;
|
use Illuminate\Console\Command;
|
||||||
use Illuminate\Database\QueryException;
|
use Illuminate\Database\QueryException;
|
||||||
use Illuminate\Support\Facades\Log;
|
use Illuminate\Support\Facades\Log;
|
||||||
|
|
@ -17,7 +18,7 @@ class GiveAllUsersDefaultItems extends Command
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
protected $signature = 'app:give-all-users-default-items';
|
protected $signature = 'app:give-all-users-default-items {userId?}';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The console command description.
|
* The console command description.
|
||||||
|
|
@ -31,7 +32,11 @@ class GiveAllUsersDefaultItems extends Command
|
||||||
*/
|
*/
|
||||||
public function handle()
|
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 ($playerDatas as $playerData) {
|
||||||
foreach (Characters::cases() as $case) {
|
foreach (Characters::cases() as $case) {
|
||||||
|
|
|
||||||
|
|
@ -177,10 +177,13 @@ protected function addProgressToChallenge(string $challengeId, int $newProgress,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @var PickedChallenge $foundChallenge */
|
||||||
$foundChallenge = PickedChallenge::find($challengeId);
|
$foundChallenge = PickedChallenge::find($challengeId);
|
||||||
if($foundChallenge === null)
|
if($foundChallenge === null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
$newProgress = $newProgress >= MetadataController::reducePickedChallengeCompletionValue($foundChallenge->asset_path, $foundChallenge->completion_value) ? $foundChallenge->completion_value : $newProgress;
|
||||||
|
|
||||||
$foundChallenge->progress = $newProgress;
|
$foundChallenge->progress = $newProgress;
|
||||||
$foundChallenge->save();
|
$foundChallenge->save();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -163,7 +163,7 @@ private function handleUpdateCharacterMetadata(UpdateMetadataGroupRequest &$requ
|
||||||
foreach ($picked['list'] as $challenge) {
|
foreach ($picked['list'] as $challenge) {
|
||||||
$challengeId = Uuid::fromHexadecimal(new Hexadecimal($challenge['challengeId']));
|
$challengeId = Uuid::fromHexadecimal(new Hexadecimal($challenge['challengeId']));
|
||||||
$assetPath = $challenge['challengeAsset'];
|
$assetPath = $challenge['challengeAsset'];
|
||||||
$completionValue = static::reducePickedChallengeCompletionValue($assetPath, $challenge['challengeCompletionValue']);
|
$completionValue = $challenge['challengeCompletionValue'];
|
||||||
|
|
||||||
$attributes = [
|
$attributes = [
|
||||||
'id' => $challengeId->toString(),
|
'id' => $challengeId->toString(),
|
||||||
|
|
@ -231,6 +231,13 @@ private function handleFactionMetadata(UpdateMetadataGroupRequest &$request): st
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reduces the Completion value of the given challenge.
|
||||||
|
*
|
||||||
|
* @param string $challengeBlueprint
|
||||||
|
* @param string $originalAmount
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
public static function reducePickedChallengeCompletionValue(
|
public static function reducePickedChallengeCompletionValue(
|
||||||
string $challengeBlueprint,
|
string $challengeBlueprint,
|
||||||
string $originalAmount,
|
string $originalAmount,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user