Старт переноса showinf_pers(); в класс
This commit is contained in:
parent
52e130d5f7
commit
d1ae47bae2
@ -43,32 +43,22 @@ class User
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function showPresents()
|
|
||||||
{
|
|
||||||
//$presents = db::c()->query('SELECT img, sender FROM `users_presents` WHERE expiration_date >= "?s" AND owner = ?i', date('Y-m-d'), $user->id);
|
|
||||||
$presents_query = db::c()->query();
|
|
||||||
if ($presents_query->getNumRows()) {
|
|
||||||
echo <<<PRESENT_BEFORE
|
|
||||||
<div>
|
|
||||||
<legend>Подарки</legend>
|
|
||||||
PRESENT_BEFORE;
|
|
||||||
while ($row = $presents_query->fetch_assoc()) {
|
|
||||||
echo <<<PRESENT
|
|
||||||
<img src = "{$row['img']}" title = "{$row['sender']}" alt = "{$row['sender']}" >
|
|
||||||
PRESENT;
|
|
||||||
}
|
|
||||||
echo <<<PRESENT_AFTER
|
|
||||||
</div>
|
|
||||||
PRESENT_AFTER;
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public function showUserInfo() {
|
public function showUserInfo() {
|
||||||
$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);
|
||||||
foreach ($dressed_items->fetch_assoc() as $item) {
|
foreach ($dressed_items->fetch_assoc() as $item) {
|
||||||
|
echo 1;
|
||||||
}
|
}
|
||||||
|
echo <<<USERINFO
|
||||||
|
Имя {$this->login} <br>
|
||||||
|
Сила {$this->strength} <br>
|
||||||
|
Ловкость {$this->dexterity} <br>
|
||||||
|
Интуиция {$this->intuition} <br>
|
||||||
|
Выносливость {$this->endurance} <br>
|
||||||
|
Интеллект {$this->intelligence} <br>
|
||||||
|
Мудрость {$this->wisdom} <br>
|
||||||
|
Находится в {$this->getRoomName($this->room)}
|
||||||
|
USERINFO;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -555,7 +555,7 @@ function showinf_pers($id, $battle = 0, $me = 0) //FIXME 37 запросов! Т
|
|||||||
$user['login'] = $bots['name'];
|
$user['login'] = $bots['name'];
|
||||||
$user['hp'] = $bots['hp'];
|
$user['hp'] = $bots['hp'];
|
||||||
} else {
|
} else {
|
||||||
$invis = $user['invis'];
|
$invis = $user['invis'] ?? 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($invis && $user['id'] != $_SESSION['uid']) {
|
if ($invis && $user['id'] != $_SESSION['uid']) {
|
||||||
|
7
inf.php
7
inf.php
@ -33,7 +33,7 @@ if (empty($user->id)): ?>
|
|||||||
<title>Ошибка</title>
|
<title>Ошибка</title>
|
||||||
</head>
|
</head>
|
||||||
<body style="color: #666; background-color: #d5d5d5; text-align: center; font-family: Consolas,monospace;">
|
<body style="color: #666; background-color: #d5d5d5; text-align: center; font-family: Consolas,monospace;">
|
||||||
Ошибка: персонаж<?= ($login ? " <em>" . $login . "</em>" : ""); ?> не найден...
|
Ошибка: персонаж <em><?=$login?></em> не найден...
|
||||||
<p><a style="color: #99f" href="javascript:window.history.go(-1);">←назад</a></p>
|
<p><a style="color: #99f" href="javascript:window.history.go(-1);">←назад</a></p>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
@ -54,6 +54,7 @@ if (empty($user->id)): ?>
|
|||||||
<td style="width: 250px; vertical-align: top;">
|
<td style="width: 250px; vertical-align: top;">
|
||||||
<?php
|
<?php
|
||||||
try {echo showinf_pers($user->id);} catch (Exception $e) {echo "<div class='private'>Ошибка генератора персонажа showinf_pers(): {$e}</div>";}
|
try {echo showinf_pers($user->id);} catch (Exception $e) {echo "<div class='private'>Ошибка генератора персонажа showinf_pers(): {$e}</div>";}
|
||||||
|
try {$user->showUserInfo();} catch (Exception $e) {echo "<div class='private'>Ошибка генератора персонажа showinf_pers(): {$e}</div>";}
|
||||||
if (!empty($user->married)): ?>
|
if (!empty($user->married)): ?>
|
||||||
<a href="inf.php?<?= $user->married ?>" target=_blank>
|
<a href="inf.php?<?= $user->married ?>" target=_blank>
|
||||||
<img alt="В браке с <?= $user->married ?>" src="i/married.gif"
|
<img alt="В браке с <?= $user->married ?>" src="i/married.gif"
|
||||||
@ -74,9 +75,7 @@ try {
|
|||||||
if ($effect['time'] && !private_access($uid)) {
|
if ($effect['time'] && !private_access($uid)) {
|
||||||
die('<h3>Персонаж обезличен!</h3>');
|
die('<h3>Персонаж обезличен!</h3>');
|
||||||
}
|
}
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {echo "<div class='private'>Ошибка обезличивателя: {$e}</div>";}
|
||||||
echo "<span class='error'>Не подтянулась таблица с эффектами. Не работает обезличка!</span>";
|
|
||||||
}
|
|
||||||
if (!empty($user->realname)) {
|
if (!empty($user->realname)) {
|
||||||
echo "Имя: " . $user->realname . "<br>";
|
echo "Имя: " . $user->realname . "<br>";
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user