Старт переноса showinf_pers(); в класс (наконец!_)

This commit is contained in:
lopar 2020-07-04 23:00:47 +03:00
parent 73042e214e
commit 42905cb9ac

View File

@ -43,8 +43,13 @@ class User
}
}
protected function showItem(array $item) {
echo sprintf('<img src="/i/sh/%s" class="item-wrap-normal tip"><span class="tiptext"><strong>%s</strong></span>', $item['image'], $item['name']);
protected function showItem(array $item)
{
if ($item) {
echo sprintf('<img src="/i/sh/%s" class="item-wrap-normal tip"><span class="tiptext"><strong>%s</strong></span>', $item['image'], $item['name']);
} else {
echo "<img src='/i/sh/noitem.png' class='item-wrap-normal' title='Пустой слот'>";
}
}
public function showUserInfo() {
@ -65,15 +70,19 @@ class User
Находится в {$this->getRoomName($this->room)}<br>
Предметы на тушке: <br>
USERINFO;
if (isset($dressed_item[1])) {
$this->showItem($dressed_item[1]);
}
if (isset($dressed_item[2])) {
$this->showItem($dressed_item[2]);
}
if (isset($dressed_item[4])) {
$this->showItem($dressed_item[4]);
}
$this->showItem($dressed_item[1]);
$this->showItem($dressed_item[2]);
$this->showItem($dressed_item[3]);
$this->showItem($dressed_item[4]);
// if (isset($dressed_item[1])) {
// $this->showItem($dressed_item[1]);
// }
// if (isset($dressed_item[2])) {
// $this->showItem($dressed_item[2]);
// }
// if (isset($dressed_item[4])) {
// $this->showItem($dressed_item[4]);
// }
}
}