mirror of
https://github.com/Deathgarden-Rebirth/Deathgarden_Rebirth-Rewrite.git
synced 2026-09-08 19:25:10 -05:00
- Moved initOrGetGroup and updateMetadataGroup into own MetadataController.php becauseits really big and cluttered the PlayerController.php - Added Challenges and pciked challenges for the characters - Added that when the game sends us an update for the Character metadata, it automatically creates unknown challenges in the database and sets the picked challenges for this characterData
41 lines
1.1 KiB
PHP
41 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Helper\Uuid;
|
|
|
|
use Illuminate\Support\Collection;
|
|
use Ramsey\Uuid\Type\Hexadecimal;
|
|
use Ramsey\Uuid\Uuid;
|
|
use Ramsey\Uuid\UuidInterface;
|
|
|
|
abstract class UuidHelper
|
|
{
|
|
public static function convertFromUuidToHexCollection(Collection|array $collection, bool $uppercase = true): Collection {
|
|
$new = [];
|
|
|
|
foreach ($collection as $id) {
|
|
if($uppercase)
|
|
$new[] = strtoupper(Uuid::fromString($id)->getHex()->toString());
|
|
else
|
|
$new[] = Uuid::fromString($id)->getHex()->toString();
|
|
}
|
|
|
|
return collect($new);
|
|
}
|
|
|
|
/**
|
|
* @param Collection|array $collection
|
|
* @return Collection|UuidInterface[]
|
|
*/
|
|
public static function convertFromHexToUuidCollecton(Collection|array $collection, bool $toString = false): Collection {
|
|
$new = [];
|
|
|
|
foreach ($collection as $id) {
|
|
if($toString)
|
|
$new[] = Uuid::fromHexadecimal(new Hexadecimal($id))->toString();
|
|
else
|
|
$new[] = Uuid::fromHexadecimal(new Hexadecimal($id));
|
|
}
|
|
|
|
return collect($new);
|
|
}
|
|
} |