diff --git a/app/Models/Champion.php b/app/Models/Champion.php index 0f5147e..4be1dfa 100644 --- a/app/Models/Champion.php +++ b/app/Models/Champion.php @@ -101,9 +101,12 @@ class Champion extends Model public function getChampionImageAttribute(bool $uncentered = false): string { - $baseUrl = 'https://raw.communitydragon.org/pbe/plugins/rcp-be-lol-game-data/global/default/v1/champion-splashes/'; - $imagePath = $uncentered ? 'uncentered/' : ''; - $imageUrl = $baseUrl.$imagePath.$this->champion_id.'/'.$this->champion_id.'000.jpg'; + $baseUrl = 'https://raw.communitydragon.org/pbe/plugins/rcp-be-lol-game-data/global/default/assets/characters/'; + $championName = strtolower(str_replace([' ', "'", '.'], ['', '', ''], $this->name)); + $imagePath = 'base/images/'; + $imageUrl = $baseUrl . $championName . '/skins/' . $imagePath . $championName . '_splash_'; + $imageUrl .= $uncentered ? 'uncentered' : 'centered'; + $imageUrl .= '_0.jpg'; return $imageUrl; } diff --git a/app/Models/ChampionSkin.php b/app/Models/ChampionSkin.php index 2f58b91..7e6eba1 100644 --- a/app/Models/ChampionSkin.php +++ b/app/Models/ChampionSkin.php @@ -74,9 +74,9 @@ class ChampionSkin extends Model public function getSkinImageAttribute(bool $uncentered = false): string { - $baseUrl = 'https://raw.communitydragon.org/pbe/plugins/rcp-be-lol-game-data/global/default/v1/champion-splashes/'; - $imagePath = $uncentered ? 'uncentered/' : ''; - $imageUrl = $baseUrl.$imagePath.$this->champion_id.'/'.$this->full_skin_id.'.jpg'; + $championName = strtolower(str_replace([' ', "'"], ['', ''], $this->champion->name)); + $imagePath = $uncentered ? 'uncentered_' : 'centered_'; + $imageUrl = 'https://raw.communitydragon.org/pbe/plugins/rcp-be-lol-game-data/global/default/assets/characters/' . $championName . '/skins/skin' . str_pad($this->skin_id, 2, '0', STR_PAD_LEFT) . '/images/' . $championName . '_splash_' . $imagePath . $this->skin_id . '.jpg'; return $imageUrl; }