типизация предмета
This commit is contained in:
parent
3178c5e3a6
commit
9137912c9f
@ -8,7 +8,7 @@ abstract class Item
|
|||||||
public $maxdur;
|
public $maxdur;
|
||||||
public $img;
|
public $img;
|
||||||
|
|
||||||
public $type;
|
public $type; # эти. что есть что нет...
|
||||||
private $typename;
|
private $typename;
|
||||||
|
|
||||||
public $nlevel;
|
public $nlevel;
|
||||||
@ -125,8 +125,21 @@ abstract class Item
|
|||||||
$this->mfauvorot = $row['mfauvorot'];
|
$this->mfauvorot = $row['mfauvorot'];
|
||||||
|
|
||||||
switch ($this->type) {
|
switch ($this->type) {
|
||||||
case 1: $this->typename = 'Шлем'; break;
|
case 1: $this->typename = 'Серьги'; break;
|
||||||
default: $this->typename = '<i style="color: maroon;">Нечто</i>';
|
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>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
4
test.php
4
test.php
@ -14,9 +14,9 @@ require_once 'config.php';
|
|||||||
//print_r($items);
|
//print_r($items);
|
||||||
# $items = []; foreach(фетч того ебучего массива as $value) {$items[$value['id']] = $value}
|
# $items = []; foreach(фетч того ебучего массива as $value) {$items[$value['id']] = $value}
|
||||||
|
|
||||||
|
$iteminfo =[];
|
||||||
$result = db::c()->query('SELECT * FROM `shop` WHERE count > 0');
|
$result = db::c()->query('SELECT * FROM `shop` WHERE count > 0');
|
||||||
$result2 = db::c()->query('SELECT * FROM `inventory` WHERE owner = 11263');
|
$result2 = db::c()->query('SELECT * FROM `inventory` WHERE owner = 11263');
|
||||||
|
|
||||||
while ($row = $result->fetch_assoc()) {
|
while ($row = $result->fetch_assoc()) {
|
||||||
$iteminfo[] = new ShopItem($row);
|
$iteminfo[] = new ShopItem($row);
|
||||||
}
|
}
|
||||||
@ -25,7 +25,7 @@ while ($row = $result2->fetch_assoc()) {
|
|||||||
$iteminfo[] = new InventoryItem($row);
|
$iteminfo[] = new InventoryItem($row);
|
||||||
}
|
}
|
||||||
|
|
||||||
echo "<table width='100%'><th colspan='2'>Товары магазина</th>";
|
echo "<table width='100%'>";
|
||||||
foreach ($iteminfo as $ii) {
|
foreach ($iteminfo as $ii) {
|
||||||
echo "<tr><td bgcolor='#d3d3d3'>";
|
echo "<tr><td bgcolor='#d3d3d3'>";
|
||||||
$ii->printImage();
|
$ii->printImage();
|
||||||
|
Loading…
Reference in New Issue
Block a user