38 lines
834 B
PHP
38 lines
834 B
PHP
|
<?php
|
|||
|
|
|||
|
namespace DTO;
|
|||
|
|
|||
|
use Core\ConversionHelper;
|
|||
|
use ItemModel;
|
|||
|
|
|||
|
class KnowledgeTempleItem
|
|||
|
{
|
|||
|
public int $id;
|
|||
|
public int $type;
|
|||
|
public string $name;
|
|||
|
public int $level;
|
|||
|
|
|||
|
private int $rowId;
|
|||
|
/**
|
|||
|
* @param array $item
|
|||
|
*/
|
|||
|
public function __construct(array $item)
|
|||
|
{
|
|||
|
$this->rowId = $item['id'];
|
|||
|
$this->id = intval($item['item_id']);
|
|||
|
$this->type = intval($item['type']);
|
|||
|
$this->name = $item['name'];
|
|||
|
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD> + <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.
|
|||
|
$itemData = array_merge(
|
|||
|
ConversionHelper::dataStringToArray(ItemModel::getItemData($this->id)),
|
|||
|
ConversionHelper::dataStringToArray($item['data']),
|
|||
|
);
|
|||
|
$this->level = intval($itemData['tr_lvl']);
|
|||
|
}
|
|||
|
|
|||
|
public function exists(): bool
|
|||
|
{
|
|||
|
return !empty($this->rowId);
|
|||
|
}
|
|||
|
}
|