This commit is contained in:
lopar 2021-01-31 16:59:13 +02:00
parent 3d8803d67d
commit c2c0317f00

View File

@ -398,8 +398,9 @@ function timeOut($ttm)
return $out;
}
function show_eff_inf($u, $type)
function show_eff_inf($u)
{
global $db;
$img = [
1 => "travma.gif", 2 => "magic/sleep.gif", 3 => "magic/sleepf.gif", 4 => "magic/haos.gif",
5 => "magic/obezl.gif", 6 => "expx15.gif", 7 => "euphoria.png", 8 => "sleep_obj.gif",
@ -412,56 +413,22 @@ function show_eff_inf($u, $type)
1022 => "sh/hidden.gif",
];
$r = '';
$and = '';
$adds = '';
if ($type == 1) {
$and = " AND `type` != 1022";
}
$effs = db::c()->query('SELECT * FROM `users_effects` WHERE `type` <> 20 AND `owner_id` = ?i' . $and, $u)->fetch_assoc();
/* Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 132644820 bytes) in /home/combats/web/combats.loc/public_html/functions.php on line 873
* Если на человеке стоит type=20
* #26
*/
$etype = $effs['type'];
if ($type == 1) {
while ($effs) {
if ($etype == 11 || $etype == 12 || $etype == 13 || $etype == 14) {
if ($etype == 11) {
$adds = 'Легкая ';
} elseif ($etype == 12) {
$adds = 'Средняя ';
} elseif ($etype == 13) {
$adds = 'Тяжелая ';
} elseif ($etype == 14) {
$adds = 'Неизлечимая ';
} else {
$adds = '';
}
} else {
$adds = '';
}
$r .= '<div>';
$r .= '<img class="image" src="i/{$img[$etype]}">';
$r .= '<span class="title">' . $adds . $effs['name'] . '</span>';
if ($effs['sleep'] != 0) {
$r .= '<div class="timeleft">Эффект заморожен</div>';
} else {
$r .= '<div class="timeleft">' . timeOut($effs['time'] - time()) . '</div>';
}
$r .= '</div>';
}
} else {
while ($effs) {
$r .= '<div>';
$r .= '<img class="image" src="/i/' . $img[$etype] . '" /> <a href=\'main.php?edit=1&del=1&efid=' . $effs['id'] . '\' onclick=\'return confirm("Удалить ' . $adds . $effs['name'] . '?")\'><img src=\'i/clear.gif\' style=\'float: right;\' /></a>';
$r .= '<span class="title">' . $adds . $effs['name'] . '</span>';
if ($effs['sleep'] != 0) {
$r .= '<div class="timeleft">Эффект заморожен</div>';
} else {
$r .= '<div class="timeleft">' . timeOut($effs['time'] - time()) . '</div>';
}
$r .= '</div>';
$effs = $db->ofetchAll('SELECT * FROM users_effects WHERE type != 20 AND owner_id = ?', $u);
$i = 0;
while ($i < count($effs)) {
$r .= '<div>';
$r .= '<img class="image" src="/i/' . $img[$effs->type] . '" /> <a href=\'main.php?edit=1&del=1&efid=' . $effs->effect_id . '\' onclick=\'return confirm("Удалить ' . $effs->name . '?")\'><img src=\'i/clear.gif\' style=\'float: right;\' /></a>';
$r .= '<span class="title">' . $effs->name . '</span>';
if ($effs['sleep'] != 0) {
$r .= '<div class="timeleft">Эффект заморожен</div>';
} else {
$r .= '<div class="timeleft">' . timeOut($effs->remaining_time - time()) . '</div>';
}
$r .= '</div>';
$i++;
}
return $r;
}