mirror of
https://github.com/rico-vz/HeimerdingerLoL.git
synced 2025-12-06 10:10:48 +01:00
fix: champion cdn
This commit is contained in:
@@ -15,7 +15,10 @@ class ChampionSeeder extends Seeder
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
$championData = Http::get('https://static.heimerdinger.lol/champions.json')->json();
|
||||
if (!is_array($championData)) {
|
||||
$championData = Http::get('https://cdn.merakianalytics.com/riot/lol/resources/latest/en-US/champions.json')->json();
|
||||
}
|
||||
$changeCount = 0;
|
||||
|
||||
foreach ($championData as $champion) {
|
||||
|
||||
@@ -15,7 +15,10 @@ class ChampionSkinSeeder extends Seeder
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
$championData = Http::get('https://static.heimerdinger.lol/champions.json')->json();
|
||||
if (!is_array($championData)) {
|
||||
$championData = Http::get('https://cdn.merakianalytics.com/riot/lol/resources/latest/en-US/champions.json')->json();
|
||||
}
|
||||
$changeCount = 0;
|
||||
|
||||
foreach ($championData as $champion) {
|
||||
@@ -36,7 +39,7 @@ class ChampionSkinSeeder extends Seeder
|
||||
'champion_id' => $champion['id'],
|
||||
'full_skin_id' => $skin['id'],
|
||||
'skin_id' => substr($skin['id'], 3),
|
||||
'skin_name' => $skin['name'].' '.$champion['name'],
|
||||
'skin_name' => $skin['name'] . ' ' . $champion['name'],
|
||||
'lore' => $skin['lore'],
|
||||
'availability' => $skin['availability'],
|
||||
'loot_eligible' => $skin['lootEligible'],
|
||||
@@ -65,11 +68,11 @@ class ChampionSkinSeeder extends Seeder
|
||||
// Check if the skin already exists and if any attributes have changed, if so update the skin. If the skin doesn't exist, create it.
|
||||
// This is to prevent the skin data from being updated every time the seeder is run. As I'll probably run this on a cron job.
|
||||
if ($skinExists && $this->hasAttributesChanged($skinExists, $skinAttributes)) {
|
||||
Log::info('Skin '.$skin['name'].' '.$champion['name'].' has changed, updating...');
|
||||
Log::info('Skin ' . $skin['name'] . ' ' . $champion['name'] . ' has changed, updating...');
|
||||
$skinExists->update($skinAttributes);
|
||||
$changeCount++;
|
||||
} elseif (! $skinExists) {
|
||||
Log::info('New skin detected! Creating '.$skin['name'].' '.$champion['name'].'...');
|
||||
Log::info('New skin detected! Creating ' . $skin['name'] . ' ' . $champion['name'] . '...');
|
||||
ChampionSkin::create($skinAttributes);
|
||||
$changeCount++;
|
||||
}
|
||||
|
||||
@@ -15,7 +15,10 @@ class SkinChromaSeeder extends Seeder
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
$championData = Http::get('https://static.heimerdinger.lol/champions.json')->json();
|
||||
if (!is_array($championData)) {
|
||||
$championData = Http::get('https://cdn.merakianalytics.com/riot/lol/resources/latest/en-US/champions.json')->json();
|
||||
}
|
||||
$changeCount = 0;
|
||||
|
||||
foreach ($championData as $champion) {
|
||||
@@ -34,7 +37,7 @@ class SkinChromaSeeder extends Seeder
|
||||
$chromaAttributes = [
|
||||
'chroma_id' => $chromaId,
|
||||
'full_skin_id' => $skin['id'],
|
||||
'skin_name' => $skin['name'].' '.$champion['name'],
|
||||
'skin_name' => $skin['name'] . ' ' . $champion['name'],
|
||||
'chroma_name' => $chroma['name'],
|
||||
'chroma_colors' => $chroma['colors'],
|
||||
'chroma_image' => $chroma['chromaPath'],
|
||||
@@ -50,11 +53,11 @@ class SkinChromaSeeder extends Seeder
|
||||
}
|
||||
|
||||
if ($chromaExists && $this->hasAttributesChanged($chromaExists, $chromaAttributes)) {
|
||||
Log::info('Updating chroma: '.$chromaId);
|
||||
Log::info('Updating chroma: ' . $chromaId);
|
||||
$chromaExists->update($chromaAttributes);
|
||||
$changeCount++;
|
||||
} elseif (! $chromaExists) {
|
||||
Log::info('Creating chroma: '.$chromaId);
|
||||
Log::info('Creating chroma: ' . $chromaId);
|
||||
SkinChroma::create($chromaAttributes);
|
||||
$changeCount++;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user