122 lines
3.4 KiB
PHP
122 lines
3.4 KiB
PHP
<?php
|
|
|
|
use Core\Config;
|
|
use Core\Db;
|
|
use Helper\Conversion;
|
|
use Model\Constant\Stat;
|
|
|
|
if (!defined('GAME')) {
|
|
die();
|
|
}
|
|
|
|
/** @var User $u */
|
|
|
|
$shadows = Db::getRows(
|
|
"select * from obraz where
|
|
sex = ? and
|
|
level <= ? and
|
|
(login = '' or login = ?) and
|
|
(uid = 0 or uid = ?) and
|
|
(align = '0' or align = ?) and
|
|
(clan = 0 or clan = ?) order by level, img",
|
|
[$u->info['sex'], $u->info['level'], $u->info['login'], $u->info['id'], $u->info['align'], $u->info['clan']]
|
|
);
|
|
|
|
$statnames = new Stat();
|
|
$statnames->getRequirement();
|
|
$code = PassGen::intCode();
|
|
$imgsrc = Config::img();
|
|
$str2 = '';
|
|
foreach ($shadows as $shadow) {
|
|
$tr = true;
|
|
$str = '';
|
|
$data = Conversion::dataStringToArray($shadow['tr']);
|
|
|
|
if ($shadow['level'] > 0) {
|
|
$str .= "\r• Уровень персонажа: {$shadow['level']}";
|
|
}
|
|
|
|
if (!empty($shadow['itm'])) {
|
|
$needItems = [];
|
|
foreach (explode(',', $shadow['itm']) as $itemId) {
|
|
if ($itemId < 1) {
|
|
continue;
|
|
}
|
|
$item = Db::getRow('select item_id as id, name from items_users left join items_main on item_id = items_main.id where item_id = ? and inodet > 0 and inshop = 0 and uid = ?', [$itemId, $u->info['id']]);
|
|
if (!$item['id']) {
|
|
$tr = false;
|
|
}
|
|
$needItems[] = "«{$item['name']}»";
|
|
}
|
|
if (!empty($needItems)) {
|
|
$str .= "\r• Предметы: " . implode(', ', $needItems);
|
|
}
|
|
}
|
|
|
|
foreach ($statnames->sysRequirementNames as $srn) {
|
|
if (!isset($data['tr_' . $srn])) {
|
|
continue;
|
|
}
|
|
|
|
$str .= "\r• $statnames->requirementNames[$srn]: " . $data['tr_' . $srn];
|
|
|
|
if ($data['tr_' . $srn] <= $u->stats[$srn]) {
|
|
continue;
|
|
}
|
|
|
|
$tr = false;
|
|
}
|
|
|
|
if ((!empty($shadow['tr']) || !empty($shadow['itm'])) && !$tr) {
|
|
continue;
|
|
}
|
|
if (!empty($str)) {
|
|
$str = "Требуется минимальное:$str";
|
|
}
|
|
|
|
$str2 .= <<<HTML
|
|
<a href="/main.php?inv=1&obr_sel={$shadow['id']}&rnd=$code">
|
|
<img class="obrsl1" title="$str" src="$imgsrc/obraz/{$shadow['sex']}/{$shadow['img']}" width="120" height="220" alt="">
|
|
</a>
|
|
HTML;
|
|
}
|
|
|
|
?>
|
|
<script>
|
|
const elem = document.getElementById('se-pre-con');
|
|
elem.parentNode.removeChild(elem);
|
|
</script>
|
|
<style>
|
|
.obrsl1 {
|
|
border: 1px solid #888;
|
|
padding: 1px;
|
|
}
|
|
|
|
.obrsl1:hover {
|
|
background-color: #F00;
|
|
width: 118px;
|
|
height: 216px;
|
|
margin-bottom: 2px;
|
|
margin-left: 1px;
|
|
margin-right: 1px;
|
|
}
|
|
</style>
|
|
<table style="width: 100%; border-spacing: 0;">
|
|
<caption><?= User::getLogin($u->info['id']) ?></caption>
|
|
<tr>
|
|
<td style="vertical-align: top; width: 1px; height: 5px; padding: 0;"></td>
|
|
<td style="vertical-align: top; text-align: right; padding: 0;">
|
|
<form method="post" action="/main.php?inv">
|
|
<input type="button" onClick="location.href='/main.php?obraz';" class="btn" value="Обновить"/>
|
|
<input type="submit" class="btn" name="edit" value="Вернуться"/>
|
|
</form>
|
|
<br>
|
|
<hr>
|
|
<br>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td style="text-align:center; padding: 0;" colspan="2"><?= $str2 ?></td>
|
|
</tr>
|
|
</table>
|