типизация предмета

This commit is contained in:
lopar 2019-01-12 11:34:24 +02:00
parent 3178c5e3a6
commit 9137912c9f
2 changed files with 18 additions and 5 deletions

View File

@ -8,7 +8,7 @@ abstract class Item
public $maxdur;
public $img;
public $type;
public $type; # эти. что есть что нет...
private $typename;
public $nlevel;
@ -125,8 +125,21 @@ abstract class Item
$this->mfauvorot = $row['mfauvorot'];
switch ($this->type) {
case 1: $this->typename = 'Шлем'; break;
default: $this->typename = '<i style="color: maroon;">Нечто</i>';
case 1: $this->typename = 'Серьги'; break;
case 2: $this->typename = 'Ожерелье'; break;
case 3: $this->typename = 'Оружие'; break;
case 4: $this->typename = 'Серьги'; break;
case 5: $this->typename = 'Кольцо'; break;
case 8: $this->typename = 'Шлем'; break;
case 9: $this->typename = 'Перчатки'; break;
case 10: $this->typename = 'Щит'; break;
case 11: $this->typename = 'Обувь'; break;
case 12: $this->typename = 'Магический свиток'; break;
case 22: $this->typename = 'Рубашка'; break;
case 50: $this->typename = 'Волшебное зелье'; break;
case 200: $this->typename = 'Сувенир'; break;
default: $this->typename = '<i style="color: maroon;">Хлам</i>';
}
}

View File

@ -14,9 +14,9 @@ require_once 'config.php';
//print_r($items);
# $items = []; foreach(фетч того ебучего массива as $value) {$items[$value['id']] = $value}
$iteminfo =[];
$result = db::c()->query('SELECT * FROM `shop` WHERE count > 0');
$result2 = db::c()->query('SELECT * FROM `inventory` WHERE owner = 11263');
while ($row = $result->fetch_assoc()) {
$iteminfo[] = new ShopItem($row);
}
@ -25,7 +25,7 @@ while ($row = $result2->fetch_assoc()) {
$iteminfo[] = new InventoryItem($row);
}
echo "<table width='100%'><th colspan='2'>Товары магазина</th>";
echo "<table width='100%'>";
foreach ($iteminfo as $ii) {
echo "<tr><td bgcolor='#d3d3d3'>";
$ii->printImage();