showinf_pers() наконец удалена!

This commit is contained in:
Igor Barkov (iwork) 2020-07-06 15:31:33 +03:00
parent 0183cfed0e
commit f9a267639b

View File

@ -525,326 +525,6 @@ function timetoheals($user)
return $fulltime;
}
/**
* Функция отображения персонажа для других персонажей везде и для себя в бою.
*
* @param $id
* @param int $battle - в бою ли персонаж
* @param int $me - на себя ли я смотрю
*
* @return string
*/
function showinf_pers($id, $battle = 0, $me = 0) //FIXME 37 запросов! ТРИДЦАТЬ СЕМЬ! Чтобы отобразить предметы на персонаже.
{
global $rooms;
$r = '';
$user = db::c()->query('SELECT * FROM `users` WHERE `id` = ?i', $id)->fetch_assoc();
function item($image, $bg_color = '#AAA', $border_color = '#EEE')
{
return '<img src="' . $image . '" style="width: 48px; height: 48px; border-radius: 5px; border: 1px solid rgba(0, 0, 0, 0.25);
padding: 7px; display: inline-block; background-repeat: no-repeat;
background-color: ' . $bg_color . '; background-image: radial-gradient(circle, ' . $border_color . ', ' . $bg_color . ');">';
}
if ($id > _BOTSEPARATOR_) {
// Если ID большой, берём бота из базы ботов, подставляем имя и здоровье из прототипа в юзерах.
$bots = db::c()->query('SELECT `name`, `hp` FROM `bots` WHERE `id` = ?i', $id)->fetch_assoc();
$user = db::c()->query('SELECT * FROM `users` WHERE `id` = (SELECT `prototype` FROM `bots` WHERE `bots`.`id` = ?i)', $id)->fetch_assoc();
$user['login'] = $bots['name'];
$user['hp'] = $bots['hp'];
} else {
$invis = $user['invis'] ?? 0;
}
if ($invis && $user['id'] != $_SESSION['uid']) {
$r = <<<HTML
<div style="text-align: center;">
<b><i>невидимка</i></b><br><br><img src="i/shadow/0.gif">
</div>
<td style="width: 100%; vertical-align: top;">
HTML;
} else {
$r .= '<div style="text-align: center">';
if (!empty($user['align'])) {
$r .= "<img src='/i/align_{$user['align']}.gif' > ";
}
if ($user['block']) {
$r .= "<span class='private'><s>{$user['login']}</s></span>";
} else {
$r .= "<b>$user[login]</b> ";
}
if (!empty($user['klan'])) {
$r .= "<img src='/i/klan/" . ClanImage($user['klan']) . ".gif' > ";
}
$r .= '</div>';
$r .= showProgressBar($user['hp'], $user['maxhp']);
$r .= "<table style='width: 100%; text-align: center;'>";
$r .= '<tr><td width=62 valign=top><table width=100%><tr><td>';
if ($user['sergi'] > 0) {
$dress = db::c()->query('SELECT `name`, `img`, `duration`, `maxdur`, `ghp`, `text`, `includemagicdex` FROM `inventory` WHERE `id` = ?i', $user['sergi'])->fetch_assoc();
if ($dress['includemagicdex'] && ($battle && $me)) {
$r .= showhrefmagic($dress);
} else {
$r .= '<img class="tooltip" src="i/sh/' . $dress['img'] . '" width=60 height=20 title="<b>' . $dress['name'] . "</b>" . ((!empty($dress['text'])) ? "<br><i>{$dress['text']}</i>" : "") . '" />';
}
} else {
#$r .= '<img src="i/w1.gif" width="60" height="20" class="tooltip" title="Пустой слот Серьги" />';
$r .= item('i/1x1.gif');
}
$r .= '</td></tr><tr><td>';
if ($user['kulon'] > 0) {
$dress = db::c()->query('SELECT `name`, `img`, `duration`, `maxdur`, `ghp`, `text`, `includemagicdex` FROM `inventory` WHERE `id` = ?i', $user['kulon'])->fetch_assoc();
if ($dress['includemagicdex'] && ($battle && $me)) {
$r .= showhrefmagic($dress);
} else {
$r .= '<img class="tooltip" src="i/sh/' . $dress['img'] . '" width=60 height=20 title="<b>' . $dress['name'] . "</b>" . ((!empty($dress['text'])) ? "<br><i>{$dress['text']}</i>" : "") . '" />';
}
} else {
#$r .= '<img src="i/w2.gif" width=60 height=20 class="tooltip" title="Пустой слот Ожерелье" />';
$r .= item('i/1x1.gif');
}
$r .= '</td></tr><tr><td>';
if ($user['weap'] > 0) {
$dress = db::c()->query('SELECT `minu`, `maxu`, `name`, `img`, `duration`, `maxdur`, `ghp`, `text`, `includemagicdex` FROM `inventory` WHERE `id` = ?i', $user['weap'])->fetch_assoc();
if ($dress['includemagicdex'] && ($battle && $me)) {
$r .= showhrefmagic($dress);
} else {
$r .= '<img class="tooltip" src="i/sh/' . $dress['img'] . '" width=60 height=60 title="<b>' . $dress['name'] . "</b>" . ((!empty($dress['text'])) ? "<br><i>{$dress['text']}</i>" : "") . '" />';
}
} else {
#$r .= '<img class=\'tooltip\' src="i/w3.gif" width=60 height=60 title="Пустой слот Оружие" />';
$r .= item('i/1x1.gif');
}
$r .= '</td></tr><tr><td>';
if ($user['bron'] > 0 || $user['rybax'] > 0 || $user['plaw'] > 0) {
$d = '';
$title = '';
if ($user['plaw']) {
$d = $user['plaw'];
if ($user['bron']) {
$dress = db::c()->query('SELECT `name`, `img`, `duration`, `maxdur`, `ghp`, `text`, `includemagicdex` FROM `inventory` WHERE `id` = ?i', $user['bron'])->fetch_assoc();
$title .= '<br />--------------------<br /><b>' . $dress['name'] . '</b>' . ((!empty($dress['text'])) ? "<br><i>{$dress['text']}</i>" : "");
}
if ($user['rybax']) {
$dress = db::c()->query('SELECT `name`, `img`, `duration`, `maxdur`, `ghp`, `text`, `includemagicdex` FROM `inventory` WHERE `id` = ?i', $user['rybax'])->fetch_assoc();
$title .= '<br />--------------------<br /><b>' . $dress['name'] . '</b>' . ((!empty($dress['text'])) ? "<br><i>{$dress['text']}</i>" : "");
}
} elseif ($user['bron']) {
$d = $user['bron'];
if ($user['rybax']) {
$dress = db::c()->query('SELECT `name`, `img`, `duration`, `maxdur`, `ghp`, `text`, `includemagicdex` FROM `inventory` WHERE `id` = ?i', $user['rybax'])->fetch_assoc();
$title .= '<br />--------------------<br /><b>' . $dress['name'] . '</b>' . ((!empty($dress['text'])) ? "<br><i>{$dress['text']}</i>" : "");
}
} elseif ($user['rybax']) {
$d = $user['rybax'];
}
$dress = db::c()->query('SELECT `name`, `img`, `duration`, `maxdur`, `ghp`, `text`, `includemagicdex` FROM `inventory` WHERE `id` = ?i', $d)->fetch_assoc();
if ($dress['includemagicdex'] && $battle && $me) {
$r .= showhrefmagic($dress);
} else {
$r .= '<img class="tooltip" src="i/sh/' . $dress['img'] . '" width=60 height=80 title="<b>' . $dress['name'] . "</b>" . ((!empty($dress['text'])) ? "<br><i>{$dress['text']}</i>" : "") . '" />';
}
} else {
#$r .= '<img class=\'tooltip\' src="i/w4.gif" width=60 height=80 title="Пустой слот Броня" />';
$r .= item('i/1x1.gif');
}
$r .= '</td></tr>';
$r .= '</table></td>';
$r .= '<td valign=top><img src="i/shadow/' . $user['shadow'] . '" width="96" height="270" onerror=" this.src = \'i/shadow/0.gif\';"></td><td width="62" valign=top><table width=100%><tr><td>';
if ($user['helm'] > 0) {
$dress = db::c()->query('SELECT `name`, `img`, `duration`, `maxdur`, `ghp`, `text`, `includemagicdex` FROM `inventory` WHERE `id` = ?i', $user['helm'])->fetch_assoc();
if ($dress['includemagicdex'] && ($battle && $me)) {
$r .= showhrefmagic($dress);
} else {
$r .= '<img class="tooltip" src="i/sh/' . $dress['img'] . '" width=60 height=60 title="<b>' . $dress['name'] . "</b>" . ((!empty($dress['text'])) ? "<br><i>{$dress['text']}</i>" : "") . '" />';
}
} else {
#$r .= '<img class=\'tooltip\' src="i/w9.gif" width=60 height=60 title="Пустой слот Шлем" />';
$r .= item('i/1x1.gif');
}
$r .= '</td></tr><tr><td>';
if ($user['perchi'] > 0) {
$dress = db::c()->query('SELECT `name`, `img`, `duration`, `maxdur`, `ghp`, `text`, `includemagicdex` FROM `inventory` WHERE `id` = ?i', $user['perchi'])->fetch_assoc();
if ($dress['includemagicdex'] && ($battle && $me)) {
$r .= showhrefmagic($dress);
} else {
$r .= '<img class="tooltip" src="i/sh/' . $dress['img'] . '" width=60 height=40 title="<b>' . $dress['name'] . "</b>" . ((!empty($dress['text'])) ? "<br><i>{$dress['text']}</i>" : "") . '" />';
}
} else {
#$r .= '<img class=\'tooltip\' src="i/w11.gif" width=60 height=40 alt="Пустой слот Перчатки" />';
$r .= item('i/1x1.gif');
}
$r .= '</td></tr><tr><td>';
if ($user['shit'] > 0) {
$dress = db::c()->query('SELECT `name`, `img`, `duration`, `maxdur`, `ghp`, `text`, `includemagicdex` FROM `inventory` WHERE `id` = ?i', $user['shit'])->fetch_assoc();
if ($dress['includemagicdex'] && ($battle && $me)) {
$r .= showhrefmagic($dress);
} else {
$r .= '<img class="tooltip" src="i/sh/' . $dress['img'] . '" width=60 height=60 title="<b>' . $dress['name'] . "</b>" . ((!empty($dress['text'])) ? "<br><i>{$dress['text']}</i>" : "") . '" />';
}
} else {
#$r .= '<img class=\'tooltip\' src="i/w10.gif" width=60 height=60 title="Пустой слот Щит" />';
$r .= item('i/1x1.gif');
}
$r .= '</td></tr><tr><td>';
if ($user['boots'] > 0) {
$dress = db::c()->query('SELECT `name`, `img`, `duration`, `maxdur`, `ghp`, `text`, `includemagicdex` FROM `inventory` WHERE `id` = ?i', $user['boots'])->fetch_assoc();
if ($dress['includemagicdex'] && ($battle && $me)) {
$r .= showhrefmagic($dress);
} else {
$r .= '<img class="tooltip" src="i/sh/' . $dress['img'] . '" width=60 height=40 title="<b>' . $dress['name'] . "</b>" . ((!empty($dress['text'])) ? "<br><i>{$dress['text']}</i>" : "") . '" />';
}
} else {
#$r .= '<img class=\'tooltip\' src="i/w12.gif" width=60 height=40 title="Пустой слот Oбувь" />';
$r .= item('i/1x1.gif');
}
$data = db::c()->query('SELECT * FROM `online` WHERE `date` >= ?i AND `id` = ?i', time() - 60, $user['id'])->fetch_assoc();
$r .= '</td></tr></table></td></tr></table>';
$r .= '<div style="text-align: center">';
// TODO Не забыть включить отображение всплывашки с названием предмета!
if ($user['r1'] > 0) {
$dress = db::c()->query('SELECT `name`, `img`, `duration`, `maxdur`, `ghp`, `text`, `includemagicdex` FROM `inventory` WHERE `id` = ?i', $user['r1'])->fetch_assoc();
if ($dress['includemagicdex'] && ($battle && $me)) {
$r .= showhrefmagic($dress);
} else {
#$r .= '<img class="tooltip" src="i/sh/' . $dress['img'] . '" width=20 height=20 title="<b>' . $dress['name'] . "</b>" . ((!empty($dress['text'])) ? "<br><i>{$dress['text']}</i>" : "") . '" />';
$r .= item('i/sh/' . $dress['img']) . " ";
}
} else {
#$r .= '<img class=\'tooltip\' src="i/w6.gif" width=20 height=20 title="Пустой слот Кольцо" />';
$r .= item('i/1x1.gif') . " ";
}
if ($user['r2'] > 0) {
$dress = db::c()->query('SELECT `name`, `img`, `duration`, `maxdur`, `ghp`, `text`, `includemagicdex` FROM `inventory` WHERE `id` = ?i', $user['r2'])->fetch_assoc();
if ($dress['includemagicdex'] && ($battle && $me)) {
$r .= showhrefmagic($dress);
} else {
#$r .= '<img class="tooltip" src="i/sh/' . $dress['img'] . '" width=20 height=20 title="<b>' . $dress['name'] . "</b>" . ((!empty($dress['text'])) ? "<br><i>{$dress['text']}</i>" : "") . '" />';
$r .= item('i/sh/' . $dress['img']) . " ";
}
} else {
#$r .= '<img class=\'tooltip\' src="i/w6.gif" width=20 height=20 title="Пустой слот Кольцо" />';
$r .= item('i/1x1.gif') . " ";
}
if ($user['r3'] > 0) {
$dress = db::c()->query('SELECT `name`, `img`, `duration`, `maxdur`, `ghp`, `text`, `includemagicdex` FROM `inventory` WHERE `id` = ?i', $user['r3'])->fetch_assoc();
if ($dress['includemagicdex'] && ($battle && $me)) {
$r .= showhrefmagic($dress);
} else {
#$r .= '<img class="tooltip" src="i/sh/' . $dress['img'] . '" width=20 height=20 title="<b>' . $dress['name'] . "</b>" . ((!empty($dress['text'])) ? "<br><i>{$dress['text']}</i>" : "") . '" />';
$r .= item('i/sh/' . $dress['img']) . " ";
}
} else {
#$r .= '<img class=\'tooltip\' src="i/w6.gif" width=20 height=20 title="Пустой слот Кольцо" />';
$r .= item('i/1x1.gif') . " ";
}
$r .= '</div>';
$r .= '<center><table cellPadding=0 cellSpacing=0 width="100%"><tbody>';
if (!$battle) {
$r .= '<tr><td align=middle colSpan=2><b><small>' . GAMEDOMAIN . '</small></b></td></tr><tr><td colSpan=2>';
if ($data['id'] != null && $user['id'] != 326) {
if ($data['room'] > 500 && $data['room'] < 561) {
$rrm = 'Башня смерти, участвует в турнире';
} else {
$rrm = $rooms[$data['room']];
}
$r .= '<div style="text-align: center;">Персонаж сейчас находится в игре.<b>"' . $rrm . '"</b></div>';
} else {
$r .= '<div style="text-align: center;">Персонаж не в игре.</div>';
}
if ($user['battle'] > 0 && $user['invis'] == 0) {
$r .= '<br />Персонаж сейчас в <a target="_blank" href="logs.php?log=' . $user['battle'] . '">поединке</a>';
}
$r .= '</center>';
$r .= '<div class="effectList" style="padding-top: 15px;">';
$r .= show_eff_inf($user['id'], 1);
$r .= '</div></td></tr>';
$r .= '</tbody></table></center></td>';
$r .= '<td valign=top>';
$r .= 'Сила: ' . $user['sila'] . '<br>';
$r .= 'Ловкость: ' . $user['lovk'] . '<br>';
$r .= 'Интуиция: ' . $user['inta'] . '<br>';
$r .= 'Выносливость: ' . $user['vinos'] . '<br>';
$r .= 'Интеллект: ' . $user['intel'] . '<br>';
$r .= 'Мудрость: ' . $user['mudra'] . '<br>';
$r .= '<hr style=\'width: 50%; float: left;\' /><br />';
$r .= 'Уровень: ' . $user['level'] . '<br>';
$r .= 'Побед: <span>' . $user['win'] . '</span><br>';
$r .= 'Поражений: <span>' . $user['lose'] . '</span><br>';
$r .= 'Ничьих: <span>' . $user['nich'] . '</span><br>';
if ($user['klan']) {
$clann = db::c()->query('SELECT `name`, `glava` FROM `clans` WHERE `id` = ?i', $user['klan'])->fetch_assoc();
$r .= $clann['name'];
if ($clann['glava'] == $user['id']) {
$r .= " - <span style='color:teal;'>Глава клана</span><br>";
} elseif (!empty($user['status'])) {
$r .= " - " . $user['status'] . "<br>";
}
}
if ($user['borntime']) {
$date1 = explode(" ", $user['borntime']);
$date2 = explode("-", $date1[0]);
$date3 = "" . $date2[2] . "-" . $date2[1] . "-" . $date2[0] . "";
$r .= 'День рождения персонажа: ' . $date3 . '<br>';
}
if ($user['palcom']) {
$r .= "<br><span class=private>{$user['palcom']}</span>";
}
$r .= '<hr />';
} else {
$r .= '<tr><td colSpan=2 style="padding-left: 25px;">';
$r .= 'Сила: ' . $user['sila'] . '<br>';
$r .= 'Ловкость: ' . $user['lovk'] . '<br>';
$r .= 'Интуиция: ' . $user['inta'] . '<br>';
$r .= 'Выносливость: ' . $user['vinos'] . '<br>';
$r .= 'Интеллект: ' . $user['intel'] . '<br>';
$r .= 'Мудрость: ' . $user['mudra'] . '<br>';
$r .= '</td></tr></table>';
}
}
return $r;
}
/**
* Смотрим на себя в главном окне игры.
*