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

This commit is contained in:
lopar 2020-07-04 14:37:36 +03:00
parent a2835046a4
commit 51522165c8
2 changed files with 10 additions and 7 deletions

View File

@ -45,10 +45,10 @@ class User
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 1;
} // }
return <<<USERINFO echo <<<USERINFO
Имя {$this->login} <br> Имя {$this->login} <br>
Сила {$this->strength} <br> Сила {$this->strength} <br>
Ловкость {$this->dexterity} <br> Ловкость {$this->dexterity} <br>
@ -56,9 +56,12 @@ class User
Выносливость {$this->endurance} <br> Выносливость {$this->endurance} <br>
Интеллект {$this->intelligence} <br> Интеллект {$this->intelligence} <br>
Мудрость {$this->wisdom} <br> Мудрость {$this->wisdom} <br>
Находится в {$this->getRoomName($this->room)} Находится в {$this->getRoomName($this->room)}<br>
Предметы на тушке: <br>
USERINFO; USERINFO;
while (($items = $dressed_items->fetch_assoc()) !== null) {
print_r($items);
}
} }
} }

View File

@ -54,7 +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 {echo $user->showUserInfo();} catch (Exception $e) {echo "<div class='private'>Ошибка классового генератора персонажа showUserInfo(): {$e}</div>";} try {$user->showUserInfo();} catch (Exception $e) {echo "<div class='private'>Ошибка классового генератора персонажа showUserInfo(): {$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"