48 lines
998 B
PHP
48 lines
998 B
PHP
<?php
|
|
|
|
namespace Game\Modules\Bag;
|
|
|
|
use Game\Core\Colors;
|
|
|
|
/**
|
|
* Simple representation of an equipment/consumable item.
|
|
*/
|
|
class Consume extends Item
|
|
{
|
|
|
|
public static function createItem(int $dungeonId, int $level = 1): array
|
|
{
|
|
|
|
$data = file_get_contents(__DIR__.'/../../Data/consume.json');
|
|
$data = json_decode($data,true);
|
|
$name = $data[$dungeonId]['recovery']['name'];
|
|
$heal = $level * 10 * 3;
|
|
return [
|
|
'id' => uniqid('consume_'),
|
|
'type' => 'consume',
|
|
'rate' => 30,
|
|
'heal' => $heal,
|
|
'name' => $name,
|
|
];
|
|
}
|
|
|
|
public function toArray(): array
|
|
{
|
|
return [];
|
|
}
|
|
|
|
public static function calculateSellPrice(array $item): int{
|
|
return 10;
|
|
}
|
|
|
|
public static function getLineShow($item): string
|
|
{
|
|
return $item['name'] . '+' .$item['heal'];
|
|
}
|
|
|
|
public static function getDetailShow($item): array
|
|
{
|
|
return [];
|
|
}
|
|
}
|