This commit is contained in:
lopar 2020-07-05 02:25:14 +03:00
parent fc0f9ed606
commit 9419924bfa

View File

@ -32,6 +32,10 @@ class User
public $stats; public $stats;
public $shadow; public $shadow;
const EMPTY_SLOT = <<<EMPTY_SLOT
<img src="/i/sh/noitem.png" class="item-wrap-normal" title="Пустой слот" alt="Пустой слот>
EMPTY_SLOT;
use Rooms; use Rooms;
public function __construct($user) public function __construct($user)
@ -56,7 +60,7 @@ class User
SLOT; SLOT;
} else { } else {
echo <<<EMPTY_SLOT echo <<<EMPTY_SLOT
<img src="/i/sh/noitem.png" class="item-wrap-normal" title="Пустой слот [{$itemSlot}]" alt="Пустой слот [{$itemSlot}]> <img src="/i/sh/noitem.png" class="item-wrap-normal" title="Пустой слот [{$item}]" alt="Пустой слот [{$item}]>
EMPTY_SLOT; EMPTY_SLOT;
} }
} }
@ -65,13 +69,9 @@ EMPTY_SLOT;
{ {
$dressed_item = []; $dressed_item = [];
$dressed_items = db::c()->query('SELECT * FROM inventory WHERE owner_id = ?i AND dressed_slot > 0', $this->id); $dressed_items = db::c()->query('SELECT * FROM inventory WHERE owner_id = ?i AND dressed_slot > 0', $this->id);
$dressed_items_row = $dressed_items->fetch_assoc(); while ($row = $dressed_items->fetch_assoc()) {
for ($i = 1; $i <= 11; $i++) { $dressed_item[$row['dressed_slot']] = $row;
$dressed_item[$i] = $dressed_items_row[$i] ?? null; }
}
// while ($row = $dressed_items->fetch_assoc()) {
// $dressed_item[$row['dressed_slot']] = $row;
// }
echo '<div style="text-align: center">'; echo '<div style="text-align: center">';
if ($this->align) { if ($this->align) {
echo sprintf('<img src="/i/align_%s.png" alt="Склонность">', $this->align); echo sprintf('<img src="/i/align_%s.png" alt="Склонность">', $this->align);
@ -94,28 +94,31 @@ EMPTY_SLOT;
<table width=100%> <table width=100%>
<tr> <tr>
<td>'; <td>';
if (isset($dressed_item[1])) {
$this->showItem($dressed_item[1]);
} else {
$this->showItem(1);
}
echo '</td></tr><tr><td>';
if (isset($dressed_item[2])) {
$this->showItem($dressed_item[2]);
} else {
$this->showItem(2);
}
echo '</td></tr><tr><td>';
if (isset($dressed_item[3])) {
$this->showItem($dressed_item[3]);
} else {
$this->showItem(3);
}
echo '</td></tr><tr><td>';
if (isset($dressed_item[4])) {
$this->showItem($dressed_item[4]);
} else {
$this->showItem(4);
}
echo '</td></tr>';
echo <<<USERINFO echo <<<USERINFO
{$this->showItem($dressed_item[1])}
</td>
</tr>
<tr>
<td>
{$this->showItem($dressed_item[2])}
</td>
</tr>
<tr>
<td>
{$this->showItem($dressed_item[3])}
</td>
</tr>
<tr>
<td>
{$this->showItem($dressed_item[4])}
</td>
</tr>
</table> </table>
</td> </td>
<td valign=top> <td valign=top>
@ -125,32 +128,52 @@ EMPTY_SLOT;
<table width=100%> <table width=100%>
<tr> <tr>
<td> <td>
{$this->showItem($dressed_item[5])} USERINFO;
</td> if (isset($dressed_item[5])) {
</tr> $this->showItem($dressed_item[5]);
<tr> } else {
<td> $this->showItem(5);
{$this->showItem($dressed_item[6])} }
</td> echo '</td></tr><tr><td>';
</tr> if (isset($dressed_item[6])) {
<tr> $this->showItem($dressed_item[6]);
<td> } else {
{$this->showItem($dressed_item[7])} $this->showItem(6);
</td> }
</tr> echo '</td></tr><tr><td>';
<tr> if (isset($dressed_item[7])) {
<td> $this->showItem($dressed_item[7]);
{$this->showItem($dressed_item[8])} } else {
</td> $this->showItem(7);
</tr> }
echo '</td></tr><tr><td>';
if (isset($dressed_item[8])) {
$this->showItem($dressed_item[8]);
} else {
$this->showItem(8);
}
echo '</td></tr>
</table> </table>
</td> </td>
</tr> </tr>
</table> </table>
<div style="text-align: center"> <div style="text-align: center">';
{$this->showItem($dressed_item[9])} if (isset($dressed_item[9])) {
{$this->showItem($dressed_item[10])} $this->showItem($dressed_item[9]);
{$this->showItem($dressed_item[11])} } else {
$this->showItem(9);
}
if (isset($dressed_item[10])) {
$this->showItem($dressed_item[10]);
} else {
$this->showItem(10);
}
if (isset($dressed_item[11])) {
$this->showItem($dressed_item[11]);
} else {
$this->showItem(11);
}
echo <<<USERINFO
</div> </div>
Имя {$this->login} <br> Имя {$this->login} <br>
@ -163,9 +186,9 @@ EMPTY_SLOT;
Находится в {$this->getRoomName($this->room)}<br> Находится в {$this->getRoomName($this->room)}<br>
USERINFO; USERINFO;
if (isset($dressed_item[1])) { // if (isset($dressed_item[1])) {
$this->showItem($dressed_item[1]); // $this->showItem($dressed_item[1]);
} // }
// if (isset($dressed_item[2])) { // if (isset($dressed_item[2])) {
// $this->showItem($dressed_item[2]); // $this->showItem($dressed_item[2]);
// } // }