game/_incl_data/class/User/Item.php

107 lines
3.0 KiB
PHP
Raw Normal View History

<?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;
2024-02-08 12:55:44 +00:00
public readonly int $add_a1;
public readonly int $add_a2;
public readonly int $add_a3;
public readonly int $add_a4;
public readonly int $add_a5;
public readonly int $add_aall;
public readonly int $add_hpall;
public readonly int $add_m1;
public readonly int $add_m10;
public readonly int $add_m11;
public readonly int $add_m14;
public readonly int $add_m15;
public readonly int $add_m18;
public readonly int $add_m19;
public readonly int $add_m2;
public readonly int $add_m3;
public readonly int $add_m4;
public readonly int $add_m5;
public readonly int $add_m6;
public readonly int $add_m7;
public readonly int $add_m8;
public readonly int $add_m9;
public readonly int $add_mall;
public readonly int $add_mg1;
public readonly int $add_mg2;
public readonly int $add_mg3;
public readonly int $add_mg4;
public readonly int $add_mg7;
public readonly int $add_mpall;
public readonly int $add_pa1;
public readonly int $add_pa2;
public readonly int $add_pa3;
public readonly int $add_pa4;
public readonly int $add_pm1;
public readonly int $add_pm2;
public readonly int $add_pm3;
public readonly int $add_pm4;
public readonly int $add_pm7;
public readonly int $add_s1;
public readonly int $add_s2;
public readonly int $add_s3;
public readonly int $add_s4;
public readonly int $add_s5;
public readonly int $add_s6;
public readonly int $add_s7;
public readonly int $add_za;
public readonly int $add_za1;
public readonly int $add_za2;
public readonly int $add_za3;
public readonly int $add_za4;
public readonly int $add_zm;
public readonly int $add_zm1;
public readonly int $add_zm2;
public readonly int $add_zm3;
public readonly int $add_zm4;
public readonly int $add_zona;
public readonly int $add_zonb;
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();
2024-01-16 07:13:15 +00:00
$stat->getBonus();
$dataArr = Conversion::dataStringToArray(strtolower($this->data));
2024-01-16 07:13:15 +00:00
foreach ($stat->sysBonusNames as $bonusName) {
if (!isset($dataArr["add_$bonusName"])) {
2024-02-08 12:55:44 +00:00
$this->{"add_$bonusName"} = 0;
continue;
}
$this->{"add_$bonusName"} = $dataArr["add_$bonusName"];
}
}
}