2020-07-03 13:23:08 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
|
|
class User
|
|
|
|
{
|
|
|
|
public $id;
|
|
|
|
public $login;
|
|
|
|
public $email;
|
|
|
|
public $realname;
|
|
|
|
public $borndate;
|
|
|
|
public $info;
|
|
|
|
public $level;
|
|
|
|
public $align;
|
|
|
|
public $clan;
|
|
|
|
public $money;
|
|
|
|
public $strength;
|
|
|
|
public $dexterity;
|
|
|
|
public $intuition;
|
|
|
|
public $endurance;
|
|
|
|
public $intelligence;
|
|
|
|
public $wisdom;
|
|
|
|
public $ip;
|
|
|
|
public $session_id;
|
|
|
|
public $admin;
|
|
|
|
public $enter_game;
|
|
|
|
public $room;
|
|
|
|
public $block;
|
|
|
|
|
2020-07-03 13:49:39 +00:00
|
|
|
// Пока несуществующие, для совместимости.
|
|
|
|
public $married;
|
|
|
|
public $exp;
|
|
|
|
public $stats;
|
2020-07-04 20:37:47 +00:00
|
|
|
public $shadow;
|
2020-07-03 13:49:39 +00:00
|
|
|
|
2020-07-04 10:49:43 +00:00
|
|
|
use Rooms;
|
|
|
|
|
2020-07-03 13:33:34 +00:00
|
|
|
public function __construct($user)
|
2020-07-03 13:23:08 +00:00
|
|
|
{
|
2020-07-03 16:21:57 +00:00
|
|
|
$user_query = db::c()->query('SELECT * FROM users WHERE id = "?s" OR login = "?s"', $user, $user)->fetch_assoc();
|
2020-07-03 13:23:08 +00:00
|
|
|
foreach ($this as $key => $value) {
|
|
|
|
if (isset($user_query[$key])) {
|
|
|
|
$this->$key = $user_query[$key];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-07-03 16:37:24 +00:00
|
|
|
|
2020-07-04 22:14:14 +00:00
|
|
|
protected function showItem($item = 0)
|
2020-07-04 20:00:47 +00:00
|
|
|
{
|
2020-07-04 22:05:37 +00:00
|
|
|
$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;
|
2020-07-04 20:00:47 +00:00
|
|
|
} else {
|
2020-07-04 22:05:37 +00:00
|
|
|
echo <<<EMPTY_SLOT
|
|
|
|
<img src="/i/sh/noitem.png" class="item-wrap-normal" title="Пустой слот [{$itemSlot}]" alt="Пустой слот [{$itemSlot}]>
|
|
|
|
EMPTY_SLOT;
|
2020-07-04 20:00:47 +00:00
|
|
|
}
|
2020-07-04 18:37:01 +00:00
|
|
|
}
|
|
|
|
|
2020-07-04 22:05:37 +00:00
|
|
|
public function showUserInfo()
|
|
|
|
{
|
2020-07-04 17:23:02 +00:00
|
|
|
$dressed_item = [];
|
|
|
|
$dressed_items = db::c()->query('SELECT * FROM inventory WHERE owner_id = ?i AND dressed_slot > 0', $this->id);
|
2020-07-04 22:48:48 +00:00
|
|
|
$dressed_items_row = $dressed_items->fetch_assoc();
|
|
|
|
for ($dressed_items_row['dressed_slot'] = 1; $dressed_items_row['dressed_slot'] <= $dressed_items->getNumRows(); $dressed_items_row['dressed_slot']++) {
|
|
|
|
$dressed_item[$dressed_items_row['dressed_slot']] = $dressed_items_row ?? 0;
|
2020-07-04 11:50:53 +00:00
|
|
|
}
|
2020-07-04 22:48:48 +00:00
|
|
|
// while ($row = $dressed_items->fetch_assoc()) {
|
|
|
|
// $dressed_item[$row['dressed_slot']] = $row;
|
|
|
|
// }
|
|
|
|
echo '<div style="text-align: center">';
|
|
|
|
if ($this->align) {
|
|
|
|
echo sprintf('<img src="/i/align_%s.png" alt="Склонность">', $this->align);
|
|
|
|
}
|
|
|
|
if ($this->block) {
|
|
|
|
echo sprintf('<span class="private"><s>%s</s></span>', $this->login);
|
|
|
|
} else {
|
|
|
|
echo sprintf('<strong>%s</strong>', $this->login);
|
|
|
|
}
|
|
|
|
if ($this->clan) {
|
|
|
|
echo sprintf('<img src="/i/clan/%s.png" alt="%s">', $this->clan, $this->clan);
|
|
|
|
}
|
|
|
|
echo '</div>
|
2020-07-04 22:05:37 +00:00
|
|
|
<div style="width: 100%; height: 16px; background: #ffaaff; overflow: hidden; border-radius: 3px; font-size: 14px; text-align: center;">
|
2020-07-04 22:48:48 +00:00
|
|
|
добавить здоровье
|
2020-07-04 22:05:37 +00:00
|
|
|
</div>
|
|
|
|
<table style="width: 100%; text-align: center;">
|
|
|
|
<tr>
|
|
|
|
<td width=62 valign=top>
|
|
|
|
<table width=100%>
|
|
|
|
<tr>
|
2020-07-04 22:48:48 +00:00
|
|
|
<td>';
|
|
|
|
|
|
|
|
echo <<<USERINFO
|
|
|
|
|
|
|
|
|
2020-07-04 22:05:37 +00:00
|
|
|
{$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>
|
|
|
|
|
2020-07-04 11:18:28 +00:00
|
|
|
Имя {$this->login} <br>
|
|
|
|
Сила {$this->strength} <br>
|
|
|
|
Ловкость {$this->dexterity} <br>
|
|
|
|
Интуиция {$this->intuition} <br>
|
|
|
|
Выносливость {$this->endurance} <br>
|
|
|
|
Интеллект {$this->intelligence} <br>
|
|
|
|
Мудрость {$this->wisdom} <br>
|
2020-07-04 11:37:36 +00:00
|
|
|
Находится в {$this->getRoomName($this->room)}<br>
|
2020-07-04 11:18:28 +00:00
|
|
|
USERINFO;
|
2020-07-04 20:47:46 +00:00
|
|
|
|
2020-07-04 22:48:48 +00:00
|
|
|
if (isset($dressed_item[1])) {
|
|
|
|
$this->showItem($dressed_item[1]);
|
|
|
|
}
|
2020-07-04 20:00:47 +00:00
|
|
|
// if (isset($dressed_item[2])) {
|
|
|
|
// $this->showItem($dressed_item[2]);
|
|
|
|
// }
|
|
|
|
// if (isset($dressed_item[4])) {
|
|
|
|
// $this->showItem($dressed_item[4]);
|
|
|
|
// }
|
2020-07-04 10:49:43 +00:00
|
|
|
}
|
|
|
|
|
2020-07-03 13:23:08 +00:00
|
|
|
}
|