40 lines
886 B
PHP
40 lines
886 B
PHP
|
<?php
|
||
|
|
||
|
namespace Model\Constant;
|
||
|
|
||
|
|
||
|
use Enum\StatFilterCellName;
|
||
|
|
||
|
class Stat extends Constant
|
||
|
{
|
||
|
public function __construct()
|
||
|
{
|
||
|
self::$tableName = 'const_stats';
|
||
|
parent::__construct();
|
||
|
}
|
||
|
|
||
|
public function getBonusNames(): array
|
||
|
{
|
||
|
return $this->filterByCell(StatFilterCellName::Bonus);
|
||
|
}
|
||
|
|
||
|
private function filterByCell(StatFilterCellName $cellName): array
|
||
|
{
|
||
|
$result = [];
|
||
|
foreach ($this->rows as $row) {
|
||
|
if (!$row[$cellName->value]) {
|
||
|
continue;
|
||
|
}
|
||
|
if ($row['sys_name'] === 'level') {
|
||
|
$row['sys_name'] = 'lvl';
|
||
|
}
|
||
|
$result[$row['sys_name']] = $row['name'];
|
||
|
}
|
||
|
return $result;
|
||
|
}
|
||
|
|
||
|
public function getRequirementNames(): array
|
||
|
{
|
||
|
return $this->filterByCell(StatFilterCellName::Requirement);
|
||
|
}
|
||
|
}
|