Lines
100.00%
12 / 12
Functions and Methods
100.00%
1 / 1
Classes and Traits
100.00%
1 / 1
| Name | Lines | Functions and Methods | CRAP | Classes and Traits | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| EnhancementShops | 100.00% | 12 / 12 | 100.00% | 1 / 1 | 11 | 100.00% | 1 / 1 | |||
| selling | 100.00% | 12 / 12 | 100.00% | 1 / 1 | 11 | |||||
| 1 | <?php | |
| 2 | ||
| 3 | declare(strict_types=1); | |
| 4 | ||
| 5 | namespace Lorekeeper\Bot\Abilities\Gear; | |
| 6 | ||
| 7 | use Lorekeeper\Core\Item\Misc\Enhancement\EnhancementType; | |
| 8 | use Lorekeeper\Core\Player\PlayerLevel; | |
| 9 | use Lorekeeper\Core\World\Shop\ShopId; | |
| 10 | ||
| 11 | final readonly class EnhancementShops | |
| 12 | { | |
| 13 | private const int HIGHER_SHOPS_FROM_LEVEL = 50; | |
| 14 | ||
| 15 | public static function selling(EnhancementType $type, PlayerLevel $level): ?ShopId | |
| 16 | { | |
| 17 | $shops = match ($type) { | |
| 18 | EnhancementType::Fighter => [141, 768], | |
| 19 | EnhancementType::Thief => [142, 767], | |
| 20 | EnhancementType::Hybrid => [143, 766], | |
| 21 | EnhancementType::Wizard => [144, 765], | |
| 22 | EnhancementType::Healer => [145, 762], | |
| 23 | EnhancementType::SpellBreaker => [146, 764], | |
| 24 | EnhancementType::Lucky => [147, 763], | |
| 25 | EnhancementType::Adventurer, EnhancementType::Unhandled => null, | |
| 26 | }; | |
| 27 | if ($shops === null) { | |
| 28 | return null; | |
| 29 | } | |
| 30 | ||
| 31 | return new ShopId($level->value >= self::HIGHER_SHOPS_FROM_LEVEL ? $shops[1] : $shops[0]); | |
| 32 | } | |
| 33 | } |