60 lines
1.5 KiB
PHP
60 lines
1.5 KiB
PHP
<?php
|
|
|
|
namespace User;
|
|
|
|
use Helper\Conversion;
|
|
use Model\Constant\Stat;
|
|
|
|
class Item
|
|
{
|
|
public readonly int $id;
|
|
public readonly int $type;
|
|
public readonly string $name;
|
|
public readonly string $img;
|
|
public int $inslot;
|
|
public int $inodet;
|
|
public readonly string $data;
|
|
public int $durability;
|
|
|
|
public function __construct(array $item)
|
|
{
|
|
[
|
|
'id' => $this->id,
|
|
'type' => $this->type,
|
|
'name' => $this->name,
|
|
'img' => $this->img,
|
|
'inslot' => $this->inslot,
|
|
'inOdet' => $this->inodet,
|
|
'data' => $this->data,
|
|
'iznosNOW' => $iNow,
|
|
'iznosMAX' => $iMax,
|
|
] = $item;
|
|
$this->durability = $iMax - $iNow;
|
|
$stat = new Stat();
|
|
$stat->getBonus();
|
|
$dataArr = Conversion::dataStringToArray(strtolower($this->data));
|
|
foreach ($stat->sysBonusNames as $bonusName) {
|
|
if (!isset($dataArr["add_$bonusName"])) {
|
|
continue;
|
|
}
|
|
|
|
$this->{"add_$bonusName"} = $dataArr["add_$bonusName"];
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// type, data, inOdet,
|
|
// item_id, inslot, useInBattle, btl_zd, iznosNOW, iznosMAX, magic_inci, name, items_users.id, img, `2h`
|
|
|
|
/*
|
|
'data' => string 'add_za1=5|add_m4=40|add_s2=1|add_s3=2|sv_yron_min=5|sv_yron_max=15|add_m5=30|add_m1=30|add_m9=15|complect=106|tya1=75|tya3=25|fromshop=1' (length=136)
|
|
'item_id' => int 6473
|
|
|
|
'useInBattle' => int 0
|
|
'btl_zd' => int 0
|
|
'magic_inci' => string '' (length=0)
|
|
'2h' => int 0
|
|
*/
|