Старт переноса showinf_pers(); в класс (наконец!_)
This commit is contained in:
parent
77e45e052b
commit
933fc3e9ff
@ -46,14 +46,23 @@ class User
|
||||
|
||||
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']);
|
||||
$itemSlot = $item['dressed_slot'] ?? 0;
|
||||
$itemName = $item['name'] ?? '';
|
||||
$itemImage = $item['image'] ?? '';
|
||||
if ($itemSlot) {
|
||||
echo <<<SLOT
|
||||
<img src="/i/sh/{$itemImage}" class="item-wrap-normal tip" alt="Слот [{$itemSlot}]">
|
||||
<span class="tiptext"><strong>{$itemName}</strong></span>
|
||||
SLOT;
|
||||
} else {
|
||||
echo "<img src='/i/sh/noitem.png' class='item-wrap-normal' title='Пустой слот'>";
|
||||
echo <<<EMPTY_SLOT
|
||||
<img src="/i/sh/noitem.png" class="item-wrap-normal" title="Пустой слот [{$itemSlot}]" alt="Пустой слот [{$itemSlot}]>
|
||||
EMPTY_SLOT;
|
||||
}
|
||||
}
|
||||
|
||||
public function showUserInfo() {
|
||||
public function showUserInfo()
|
||||
{
|
||||
$dressed_item = [];
|
||||
$dressed_items = db::c()->query('SELECT * FROM inventory WHERE owner_id = ?i AND dressed_slot > 0', $this->id);
|
||||
while ($row = $dressed_items->fetch_assoc()) {
|
||||
@ -61,6 +70,83 @@ class User
|
||||
}
|
||||
include_once 'views/user-info-doll.php';
|
||||
echo <<<USERINFO
|
||||
<div style="text-align: center">
|
||||
<?php if ($this->align): ?>
|
||||
<img src="/i/align_{$this->align}.png" alt="Склонность">
|
||||
<?php endif; ?>
|
||||
<?php if ($this->block): ?>
|
||||
<span class="private"><s>{$this->login}</s></span>
|
||||
<?php else: ?>
|
||||
<strong>{$this->login}</strong>
|
||||
<?php endif; ?>
|
||||
<?php if ($this->clan): ?>
|
||||
<img src="/i/clan/{$this->clan}.png" alt="{$this->clan}">
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<div style="width: 100%; height: 16px; background: #ffaaff; overflow: hidden; border-radius: 3px; font-size: 14px; text-align: center;">
|
||||
добавить здоровье 🤔
|
||||
</div>
|
||||
<table style="width: 100%; text-align: center;">
|
||||
<tr>
|
||||
<td width=62 valign=top>
|
||||
<table width=100%>
|
||||
<tr>
|
||||
<td>
|
||||
{$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>
|
||||
</td>
|
||||
<td valign=top>
|
||||
<img src="/i/shadow/{$this->shadow}" onerror=" this.src = '/i/shadow/0.gif';">
|
||||
</td>
|
||||
<td width="62" valign=top>
|
||||
<table width=100%>
|
||||
<tr>
|
||||
<td>
|
||||
{$this->showItem($dressed_item[5])}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
{$this->showItem($dressed_item[6])}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
{$this->showItem($dressed_item[7])}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
{$this->showItem($dressed_item[8])}
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<div style="text-align: center">
|
||||
{$this->showItem($dressed_item[9])}
|
||||
{$this->showItem($dressed_item[10])}
|
||||
{$this->showItem($dressed_item[11])}
|
||||
</div>
|
||||
|
||||
Имя {$this->login} <br>
|
||||
Сила {$this->strength} <br>
|
||||
Ловкость {$this->dexterity} <br>
|
||||
@ -69,7 +155,6 @@ class User
|
||||
Интеллект {$this->intelligence} <br>
|
||||
Мудрость {$this->wisdom} <br>
|
||||
Находится в {$this->getRoomName($this->room)}<br>
|
||||
Предметы на тушке: <br>
|
||||
USERINFO;
|
||||
|
||||
// if (isset($dressed_item[1])) {
|
||||
|
@ -1,3 +1,21 @@
|
||||
<?php
|
||||
function showItemInSlot($slot = 0)
|
||||
{
|
||||
global $dressed_item;
|
||||
if (isset($dressed_item[$slot])) {
|
||||
echo <<<SLOT
|
||||
<img src="/i/sh/{$dressed_item[$slot]['image']}" class="item-wrap-normal tip" alt="Слот [{$slot}]">
|
||||
<span class="tiptext"><strong>{$dressed_item[$slot]['name']}</strong></span>
|
||||
SLOT;
|
||||
} else {
|
||||
echo <<<EMPTY_SLOT
|
||||
<img src="/i/sh/noitem.png" class="item-wrap-normal" title="Пустой слот [{$slot}]" alt="Пустой слот [{$slot}]>
|
||||
EMPTY_SLOT;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
<div style="text-align: center">
|
||||
<?php if (!empty($user->align)): ?>
|
||||
<img src="/i/align_<?= $user->align ?>.png" alt="Склонность">
|
||||
@ -11,7 +29,7 @@
|
||||
<img src="/i/clan/<?= $user->clan ?>.png" alt="<?= $user->clan ?>">
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<div style="width: 100%; height: 16px; background: #ffaaff; overflow: hidden; border-radius: 3px; font-size: 14px; text-align: center;" >
|
||||
<div style="width: 100%; height: 16px; background: #ffaaff; overflow: hidden; border-radius: 3px; font-size: 14px; text-align: center;">
|
||||
добавить здоровье 🤔
|
||||
</div>
|
||||
<table style="width: 100%; text-align: center;">
|
||||
@ -20,50 +38,22 @@
|
||||
<table width=100%>
|
||||
<tr>
|
||||
<td>
|
||||
<?php if (isset($dressed_item[1])): ?>
|
||||
<img src="/i/sh/<?= $dressed_item[1]['image'] ?>" class="item-wrap-normal tip" alt="Слот [1]">
|
||||
<span class="tiptext">
|
||||
<strong><?= $dressed_item[1]['name'] ?></strong>
|
||||
</span>
|
||||
<?php else: ?>
|
||||
<img src="/i/sh/noitem.png" class="item-wrap-normal" title="Пустой слот [1]" alt="Пустой слот [1]>
|
||||
<?php endif; ?>
|
||||
<?= showItemInSlot(1) ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<?php if (isset($dressed_item[2])): ?>
|
||||
<img src="/i/sh/<?= $dressed_item[2]['image'] ?>" class="item-wrap-normal tip" alt="Слот [2]">
|
||||
<span class="tiptext">
|
||||
<strong><?= $dressed_item[2]['name'] ?></strong>
|
||||
</span>
|
||||
<?php else: ?>
|
||||
<img src="/i/sh/noitem.png" class="item-wrap-normal" title="Пустой слот [2]" alt="Пустой слот [2]">
|
||||
<?php endif; ?>
|
||||
<?= showItemInSlot(2) ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<?php if (isset($dressed_item[3])): ?>
|
||||
<img src="/i/sh/<?= $dressed_item[3]['image'] ?>" class="item-wrap-normal tip" alt="Слот [3]">
|
||||
<span class="tiptext">
|
||||
<strong><?= $dressed_item[3]['name'] ?></strong>
|
||||
</span>
|
||||
<?php else: ?>
|
||||
<img src="/i/sh/noitem.png" class="item-wrap-normal" title="Пустой слот [3]" alt="Пустой слот [3]">
|
||||
<?php endif; ?>
|
||||
<?= showItemInSlot(3) ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<?php if (isset($dressed_item[4])): ?>
|
||||
<img src="/i/sh/<?= $dressed_item[4]['image'] ?>" class="item-wrap-normal tip" alt="Слот [4]">
|
||||
<span class="tiptext">
|
||||
<strong><?= $dressed_item[4]['name'] ?></strong>
|
||||
</span>
|
||||
<?php else: ?>
|
||||
<img src="/i/sh/noitem.png" class="item-wrap-normal" title="Пустой слот [4]" alt="Пустой слот [4]">
|
||||
<?php endif; ?>
|
||||
<?= showItemInSlot(4) ?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
@ -75,50 +65,22 @@
|
||||
<table width=100%>
|
||||
<tr>
|
||||
<td>
|
||||
<?php if (isset($dressed_item[5])): ?>
|
||||
<img src="/i/sh/<?= $dressed_item[5]['image'] ?>" class="item-wrap-normal tip" alt="Слот [5]">
|
||||
<span class="tiptext">
|
||||
<strong><?= $dressed_item[5]['name'] ?></strong>
|
||||
</span>
|
||||
<?php else: ?>
|
||||
<img src="/i/sh/noitem.png" class="item-wrap-normal" title="Пустой слот [5]" alt="Пустой слот [5]>
|
||||
<?php endif; ?>
|
||||
<?= showItemInSlot(5) ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<?php if (isset($dressed_item[6])): ?>
|
||||
<img src="/i/sh/<?= $dressed_item[6]['image'] ?>" class="item-wrap-normal tip" alt="Слот [6]">
|
||||
<span class="tiptext">
|
||||
<strong><?= $dressed_item[6]['name'] ?></strong>
|
||||
</span>
|
||||
<?php else: ?>
|
||||
<img src="/i/sh/noitem.png" class="item-wrap-normal" title="Пустой слот [6]" alt="Пустой слот [6]">
|
||||
<?php endif; ?>
|
||||
<?= showItemInSlot(6) ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<?php if (isset($dressed_item[7])): ?>
|
||||
<img src="/i/sh/<?= $dressed_item[7]['image'] ?>" class="item-wrap-normal tip" alt="Слот [7]">
|
||||
<span class="tiptext">
|
||||
<strong><?= $dressed_item[7]['name'] ?></strong>
|
||||
</span>
|
||||
<?php else: ?>
|
||||
<img src="/i/sh/noitem.png" class="item-wrap-normal" title="Пустой слот [7]" alt="Пустой слот [7]">
|
||||
<?php endif; ?>
|
||||
<?= showItemInSlot(7) ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<?php if (isset($dressed_item[8])): ?>
|
||||
<img src="/i/sh/<?= $dressed_item[8]['image'] ?>" class="item-wrap-normal tip" alt="Слот [8]">
|
||||
<span class="tiptext">
|
||||
<strong><?= $dressed_item[8]['name'] ?></strong>
|
||||
</span>
|
||||
<?php else: ?>
|
||||
<img src="/i/sh/noitem.png" class="item-wrap-normal" title="Пустой слот [8]" alt="Пустой слот [8]">
|
||||
<?php endif; ?>
|
||||
<?= showItemInSlot(8) ?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
@ -126,28 +88,7 @@
|
||||
</tr>
|
||||
</table>
|
||||
<div style="text-align: center">
|
||||
<?php if (isset($dressed_item[9])): ?>
|
||||
<img src="/i/sh/<?= $dressed_item[9]['image'] ?>" class="item-wrap-normal tip" alt="Слот [9]">
|
||||
<span class="tiptext">
|
||||
<strong><?= $dressed_item[9]['name'] ?></strong>
|
||||
</span>
|
||||
<?php else: ?>
|
||||
<img src="/i/sh/noitem.png" class="item-wrap-normal" title="Пустой слот [9]" alt="Пустой слот [9]">
|
||||
<?php endif; ?>
|
||||
<?php if (isset($dressed_item[10])): ?>
|
||||
<img src="/i/sh/<?= $dressed_item[10]['image'] ?>" class="item-wrap-normal tip" alt="Слот [10]">
|
||||
<span class="tiptext">
|
||||
<strong><?= $dressed_item[10]['name'] ?></strong>
|
||||
</span>
|
||||
<?php else: ?>
|
||||
<img src="/i/sh/noitem.png" class="item-wrap-normal" title="Пустой слот [10]" alt="Пустой слот [10]">
|
||||
<?php endif; ?>
|
||||
<?php if (isset($dressed_item[11])): ?>
|
||||
<img src="/i/sh/<?= $dressed_item[11]['image'] ?>" class="item-wrap-normal tip" alt="Слот [11]">
|
||||
<span class="tiptext">
|
||||
<strong><?= $dressed_item[11]['name'] ?></strong>
|
||||
</span>
|
||||
<?php else: ?>
|
||||
<img src="/i/sh/noitem.png" class="item-wrap-normal" title="Пустой слот [11]" alt="Пустой слот [11]">
|
||||
<?php endif; ?>
|
||||
<?= showItemInSlot(9) ?>
|
||||
<?= showItemInSlot(10) ?>
|
||||
<?= showItemInSlot(11) ?>
|
||||
</div>
|
Loading…
Reference in New Issue
Block a user