From 6db3a04f1d9d80e6868debcb0ee4b135d58be3bd Mon Sep 17 00:00:00 2001 From: lopar Date: Tue, 11 Dec 2018 01:52:46 +0200 Subject: [PATCH] Define undefined variables in showitem() --- functions.php | 443 ++++++++++++++++++++++++-------------------------- 1 file changed, 208 insertions(+), 235 deletions(-) diff --git a/functions.php b/functions.php index 315f38f..450c823 100644 --- a/functions.php +++ b/functions.php @@ -19,7 +19,7 @@ if (isset($user['id']) && $user['block'] == 1) { define("HPADDICTIONEFFECT", 33); -$ip = filter_input(INPUT_SERVER,'REMOTE_ADDR', FILTER_VALIDATE_IP); +$ip = filter_input(INPUT_SERVER, 'REMOTE_ADDR', FILTER_VALIDATE_IP); if (isset($_GET['goto']) and isset($_GET['tStamp']) and isset($_GET['vcode'])) { if ($_GET['vcode'] == md5(sha1($_GET['goto'] . $_GET['tStamp']))) { @@ -56,7 +56,7 @@ $userslots = ['sergi', 'kulon', 'perchi', 'weap', 'bron', 'r1', 'r2', 'r3', 'hel function getuserdata($id = 0) { - if (!$id) $id = isset($_SESSION['uid'])?$_SESSION['uid']:NULL; // Хорошее решение проверок, кстати. + if (!$id) $id = isset($_SESSION['uid']) ? $_SESSION['uid'] : NULL; // Хорошее решение проверок, кстати. if (!$id) return array(); $rec = db::c()->query('SELECT `hp`, `maxhp`, `fullhptime`, `battle` FROM `users` WHERE `id` = "?s"', $id)->fetch_assoc(); if ($rec['hp'] < $rec['maxhp'] && time() > $rec['fullhptime'] && !$rec['battle'] && ($rec['hp'] > 0)) { @@ -618,6 +618,7 @@ function nick($user) $r .= ''; return $r; } + function nick4($id, $st) { $user = mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id` = '{$id}' LIMIT 1")); @@ -815,15 +816,15 @@ function timeOut($ttm) function show_eff_inf($u, $type) { $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", - 10 => "magic/chains.gif", 11 => "travma.gif", 12 => "travma.gif", 13 => "travma.gif", - 14 => "travma.gif", 20 => "check.gif", 21 => "magic/al_neut_power.gif", 22 => "magic/fist_def.gif", - 201 => "magic/defence.gif", 202 => "magic/devastate.gif", 203 => "magic/spell_luck.gif", 215 => "magic/wis_air_def1.gif", - 216 => "magic/wis_air_def2.gif", 217 => "magic/wis_air_def3.gif", 218 => "magic/wis_earth_def1.gif", 219 => "magic/wis_earth_def2.gif", - 220 => "magic/wis_earth_def3.gif", 221 => "magic/wis_fire_def1.gif", 222 => "magic/wis_fire_def2.gif", 223 => "magic/wis_fire_def3.gif", - 224 => "magic/wis_water_def1.gif", 225 => "magic/wis_water_def2.gif", 226 => "magic/wis_water_def3.gif", 227 => "magic/attack_defence.gif", - 1022 => "sh/hidden.gif" + 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", + 10 => "magic/chains.gif", 11 => "travma.gif", 12 => "travma.gif", 13 => "travma.gif", + 14 => "travma.gif", 20 => "check.gif", 21 => "magic/al_neut_power.gif", 22 => "magic/fist_def.gif", + 201 => "magic/defence.gif", 202 => "magic/devastate.gif", 203 => "magic/spell_luck.gif", 215 => "magic/wis_air_def1.gif", + 216 => "magic/wis_air_def2.gif", 217 => "magic/wis_air_def3.gif", 218 => "magic/wis_earth_def1.gif", 219 => "magic/wis_earth_def2.gif", + 220 => "magic/wis_earth_def3.gif", 221 => "magic/wis_fire_def1.gif", 222 => "magic/wis_fire_def2.gif", 223 => "magic/wis_fire_def3.gif", + 224 => "magic/wis_water_def1.gif", 225 => "magic/wis_water_def2.gif", 226 => "magic/wis_water_def3.gif", 227 => "magic/attack_defence.gif", + 1022 => "sh/hidden.gif" ]; $r = ''; $and = ''; @@ -831,7 +832,7 @@ function show_eff_inf($u, $type) if ($type == 1) { $and = " AND `type` != 1022"; } - $effs = db::c()->query('SELECT * FROM `effects` WHERE `owner` = ?i'.$and, $u)->fetch_assoc(); + $effs = db::c()->query('SELECT * FROM `effects` WHERE `owner` = ?i' . $and, $u)->fetch_assoc(); $etype = $effs['type']; if ($type == 1) { while ($effs) { @@ -1135,7 +1136,7 @@ function showinf_pers($id, $pas = 0, $battle = 0, $me = 0, $main = false) //FIXM if ($invis) { $data['id'] = null; } else { - $data = db::c()->query('SELECT * FROM `online` WHERE `date` >= ?i AND `id` = ?i', time()-60, $user['id'])->fetch_assoc(); + $data = db::c()->query('SELECT * FROM `online` WHERE `date` >= ?i AND `id` = ?i', time() - 60, $user['id'])->fetch_assoc(); } $r .= ''; @@ -1148,7 +1149,7 @@ function showinf_pers($id, $pas = 0, $battle = 0, $me = 0, $main = false) //FIXM if (!$battle) { if ($pas) { - $r .= ''.GAMEDOMAIN.''; + $r .= '' . GAMEDOMAIN . ''; $online = db::c()->query('SELECT `u`.*, `o`.`date`, `u`.*, `o`.`real_time` FROM `users` AS `u`, `online` AS `o` WHERE `u`.`id` = `o`.`id` AND `u`.`id` = ?i ', $user['id'])->fetch_assoc(); if ($invis) { $invis = db::c()->query('SELECT `time` FROM `effects` WHERE `owner` = ?i AND `type` = 1022', $user['id'])->fetch_assoc();//FIXME Тип содержит число, невозможное в базе. @@ -1252,7 +1253,7 @@ function showpersout($pas = 0) //FIXME Сделать по человеческ - - - - + + +
- +
@@ -1287,7 +1288,7 @@ function showpersout($pas = 0) //FIXME Сделать по человеческ
0) { - $dress = db::c()->query('SELECT * FROM `inventory` WHERE `id` = ?i',$user['sergi'])->fetch_assoc(); + $dress = db::c()->query('SELECT * FROM `inventory` WHERE `id` = ?i', $user['sergi'])->fetch_assoc(); if ($dress['includemagicdex'] && !$pas) { echo showhrefmagic($dress); } else { @@ -1301,7 +1302,7 @@ function showpersout($pas = 0) //FIXME Сделать по человеческ
0) { - $dress = db::c()->query('SELECT * FROM `inventory` WHERE `id` = ?i',$user['kulon'])->fetch_assoc(); + $dress = db::c()->query('SELECT * FROM `inventory` WHERE `id` = ?i', $user['kulon'])->fetch_assoc(); if ($dress['includemagicdex'] && !$pas) { echo showhrefmagic($dress); } else { @@ -1315,7 +1316,7 @@ function showpersout($pas = 0) //FIXME Сделать по человеческ
0) { - $dress = db::c()->query('SELECT * FROM `inventory` WHERE `id` = ?i',$user['weap'])->fetch_assoc(); + $dress = db::c()->query('SELECT * FROM `inventory` WHERE `id` = ?i', $user['weap'])->fetch_assoc(); if ($dress['includemagicdex'] && !$pas) { echo showhrefmagic($dress); } else { @@ -1334,23 +1335,23 @@ function showpersout($pas = 0) //FIXME Сделать по человеческ if ($user['plaw']) { $d = $user['plaw']; if ($user['bron']) { - $dress = db::c()->query('SELECT * FROM `inventory` WHERE `id` = ?i',$user['bron'])->fetch_assoc(); + $dress = db::c()->query('SELECT * FROM `inventory` WHERE `id` = ?i', $user['bron'])->fetch_assoc(); $title .= '
--------------------
' . $dress['name'] . '
Прочность ' . $dress['duration'] . '/' . $dress['maxdur'] . '' . (($dress['ghp'] > 0) ? '
Уровень жизни ' . plusorminus($dress['ghp']) : '') . (($dress['text'] != null) ? '
На одежде вышито ' . $dress['text'] . '' : '') . (($dress['gsila'] != 0) ? '
Сила ' . plusorminus($dress['gsila']) . '' : '') . (($dress['glovk'] != 0) ? '
Ловкость ' . plusorminus($dress['glovk']) . '' : '') . (($dress['ginta'] != 0) ? '
Интуиция ' . plusorminus($dress['ginta']) . '' : '') . (($dress['gintel'] != 0) ? '
Интеллект ' . plusorminus($dress['gintel']) . '' : '') . (($dress['bron1'] != 0) ? '
Броня головы: ' . plusorminus($dress['bron1']) . '' : '') . (($dress['bron2'] != 0) ? '
Броня корпуса: ' . plusorminus($dress['bron2']) . '' : '') . (($dress['bron3'] != 0) ? '
Броня пояса: ' . plusorminus($dress['bron3']) . '' : '') . (($dress['bron4'] != 0) ? '
Броня ног: ' . plusorminus($dress['bron4']) . '' : ''); } if ($user['rybax']) { - $dress = db::c()->query('SELECT * FROM `inventory` WHERE `id` = ?i',$user['rybax'])->fetch_assoc(); + $dress = db::c()->query('SELECT * FROM `inventory` WHERE `id` = ?i', $user['rybax'])->fetch_assoc(); $title .= '
--------------------
' . $dress['name'] . '
Прочность ' . $dress['duration'] . '/' . $dress['maxdur'] . '' . (($dress['ghp'] > 0) ? '
Уровень жизни ' . plusorminus($dress['ghp']) : '') . (($dress['text'] != null) ? '
На одежде вышито ' . $dress['text'] . '' : '') . (($dress['gsila'] != 0) ? '
Сила ' . plusorminus($dress['gsila']) . '' : '') . (($dress['glovk'] != 0) ? '
Ловкость ' . plusorminus($dress['glovk']) . '' : '') . (($dress['ginta'] != 0) ? '
Интуиция ' . plusorminus($dress['ginta']) . '' : '') . (($dress['gintel'] != 0) ? '
Интеллект ' . plusorminus($dress['gintel']) . '' : '') . (($dress['bron1'] != 0) ? '
Броня головы: ' . plusorminus($dress['bron1']) . '' : '') . (($dress['bron2'] != 0) ? '
Броня корпуса: ' . plusorminus($dress['bron2']) . '' : '') . (($dress['bron3'] != 0) ? '
Броня пояса: ' . plusorminus($dress['bron3']) . '' : '') . (($dress['bron4'] != 0) ? '
Броня ног: ' . plusorminus($dress['bron4']) . '' : ''); } } elseif ($user['bron']) { $d = $user['bron']; if ($user['rybax']) { - $dress = db::c()->query('SELECT * FROM `inventory` WHERE `id` = ?i',$user['rybax'])->fetch_assoc(); + $dress = db::c()->query('SELECT * FROM `inventory` WHERE `id` = ?i', $user['rybax'])->fetch_assoc(); $title .= "
--------------------
$dress[name]
Прочность $dress[duration]/$dress[maxdur]" . (($dress['ghp'] > 0) ? "
Уровень жизни " . plusorminus($dress['ghp']) : "") . (($dress['text'] != null) ? "
На одежде вышито '{$dress['text']}'" : "") . (($dress['gsila'] != 0) ? "
Сила " . plusorminus($dress['gsila']) : "") . (($dress['glovk'] != 0) ? "
Ловкость " . plusorminus($dress['glovk']) : "") . (($dress['ginta'] != 0) ? "
Интуиция " . plusorminus($dress['ginta']) : "") . (($dress['gintel'] != 0) ? "
Интеллект " . plusorminus($dress['gintel']) : "") . (($dress['bron1'] != 0) ? "
Броня головы: " . plusorminus($dress['bron1']) : "") . (($dress['bron2'] != 0) ? "
Броня корпуса: " . plusorminus($dress['bron2']) : "") . (($dress['bron3'] != 0) ? "
Броня пояса: " . plusorminus($dress['bron3']) : "") . (($dress['bron4'] != 0) ? "
Броня ног: " . plusorminus($dress['bron4']) : "") . '"'; } } elseif ($user['rybax']) { $d = $user['rybax']; } - $dress = db::c()->query('SELECT * FROM `inventory` WHERE `id` = ?i',$d)->fetch_assoc(); + $dress = db::c()->query('SELECT * FROM `inventory` WHERE `id` = ?i', $d)->fetch_assoc(); if ($dress['includemagicdex'] && !$pas) { echo showhrefmagic($dress); } else { @@ -1367,7 +1368,7 @@ function showpersout($pas = 0) //FIXME Сделать по человеческ
0) { - $dress = db::c()->query('SELECT * FROM `inventory` WHERE `id` = ?i',$user['r1'])->fetch_assoc(); + $dress = db::c()->query('SELECT * FROM `inventory` WHERE `id` = ?i', $user['r1'])->fetch_assoc(); if ($dress['includemagicdex'] && !$pas) { showhrefmagic($dress); } else { @@ -1379,7 +1380,7 @@ function showpersout($pas = 0) //FIXME Сделать по человеческ ?> 0) { - $dress = db::c()->query('SELECT * FROM `inventory` WHERE `id` = ?i',$user['r2'])->fetch_assoc(); + $dress = db::c()->query('SELECT * FROM `inventory` WHERE `id` = ?i', $user['r2'])->fetch_assoc(); if ($dress['includemagicdex'] && !$pas) { echo showhrefmagic($dress); } else { @@ -1391,7 +1392,7 @@ function showpersout($pas = 0) //FIXME Сделать по человеческ ?> 0) { - $dress = db::c()->query('SELECT * FROM `inventory` WHERE `id` = ?i',$user['r3'])->fetch_assoc(); + $dress = db::c()->query('SELECT * FROM `inventory` WHERE `id` = ?i', $user['r3'])->fetch_assoc(); if ($dress['includemagicdex'] && !$pas) { echo showhrefmagic($dress); } else { @@ -1415,7 +1416,7 @@ function showpersout($pas = 0) //FIXME Сделать по человеческ
0) { - $dress = db::c()->query('SELECT * FROM `inventory` WHERE `id` = ?i',$user['helm'])->fetch_assoc(); + $dress = db::c()->query('SELECT * FROM `inventory` WHERE `id` = ?i', $user['helm'])->fetch_assoc(); if ($dress['includemagicdex'] && !$pas) { echo showhrefmagic($dress); } else { @@ -1429,7 +1430,7 @@ function showpersout($pas = 0) //FIXME Сделать по человеческ
0) { - $dress = db::c()->query('SELECT * FROM `inventory` WHERE `id` = ?i',$user['perchi'])->fetch_assoc(); + $dress = db::c()->query('SELECT * FROM `inventory` WHERE `id` = ?i', $user['perchi'])->fetch_assoc(); if ($dress['includemagicdex'] && !$pas) { echo showhrefmagic($dress); } else { @@ -1443,7 +1444,7 @@ function showpersout($pas = 0) //FIXME Сделать по человеческ
0) { - $dress = db::c()->query('SELECT * FROM `inventory` WHERE `id` = ?i',$user['shit'])->fetch_assoc(); + $dress = db::c()->query('SELECT * FROM `inventory` WHERE `id` = ?i', $user['shit'])->fetch_assoc(); if ($dress['includemagicdex'] && !$pas) { echo showhrefmagic($dress); } else { @@ -1457,7 +1458,7 @@ function showpersout($pas = 0) //FIXME Сделать по человеческ
0) { - $dress = db::c()->query('SELECT * FROM `inventory` WHERE `id` = ?i',$user['boots'])->fetch_assoc(); + $dress = db::c()->query('SELECT * FROM `inventory` WHERE `id` = ?i', $user['boots'])->fetch_assoc(); if ($dress['includemagicdex'] && !$pas) { echo showhrefmagic($dress); } else { @@ -1478,9 +1479,9 @@ function showpersout($pas = 0) //FIXME Сделать по человеческ style="background: url('i/runes_slots.jpg') no-repeat center bottom;">
@@ -1516,34 +1517,38 @@ function showpersout($pas = 0) //FIXME Сделать по человеческ - Сила: - (+" . $param_bonus['sila'] . ")"; ?>
- Ловкость: - (+" . $param_bonus['lovk'] . ")"; ?>
- Интуиция: - (+" . $param_bonus['inta'] . ")"; ?>
- Выносливость: - (+" . $param_bonus['vinos'] . ")"; ?>
- Интеллект:
- Мудрость:
+ Сила: + (+" . $param_bonus['sila'] . ")"; ?> +
+ Ловкость: + (+" . $param_bonus['lovk'] . ")"; ?> +
+ Интуиция: + (+" . $param_bonus['inta'] . ")"; ?> +
+ Выносливость: + (+" . $param_bonus['vinos'] . ")"; ?> +
+ Интеллект:
+ Мудрость:
0 || $user['master'] > 0): ?> + Способности
- Опыт: ()
- Уровень:
- Побед:
- Поражений:
- Ничьих:
+ Опыт: ()
+ Уровень:
+ Побед:
+ Поражений:
+ Ничьих:
query('SELECT SUM(`ekr`) AS `bank_ekr`,SUM(`cr`) AS `bank_cr` FROM `bank` WHERE `id`= ?i', $user['id'])->fetch_assoc(); ?> - Деньги: кр.
- В банке: кр. / eкр.
+ Деньги: кр.
+ В банке: кр. / eкр.
- Сила:
- Ловкость:
- Интуиция:
- Выносливость:
- Интеллект:
- Мудрость:
+ Сила:
+ Ловкость:
+ Интуиция:
+ Выносливость:
+ Интеллект:
+ Мудрость:
= 2) return "++"; if ($n > 0) return "+"; if ($n < 0) return "-"; @@ -1600,15 +1605,37 @@ function plusorminus($n, $shownum = 1) } } +function showitem2() +{ + + /** + * Проверяем одевается ли предмет + */ + function isWereable() + { + if ( + (empty($row['nsila']) OR $user['sila'] >= $row['nsila']) AND + (empty($row['nlovk']) OR $user['lovk'] >= $row['nlovk']) AND + (empty($row['ninta']) OR $user['inta'] >= $row['ninta']) AND + (empty($row['nvinos']) OR $user['vinos'] >= $row['nvinos']) AND + (empty($row['nintel']) OR $user['intel'] >= $row['nintel']) AND + (empty($row['nmudra']) OR $user['mudra'] >= $row['nmudra']) AND + (empty($row['nlevel']) OR $user['level'] >= $row['nlevel']) AND + (empty($row['nalign']) OR $user['align'] >= $row['nalign']) + ) return true; else return false; + } +} + + /** * По ходу, главная функция отображения предметов. * -* @param array $row - массив значений, передаваймый из запроса к таблице inventory -* @param int $type - тип предмета. Где бы их всех взять? -* @param bool $returned -* @param bool $infOnly -* @return string -*/ + * @param array $row - массив значений, передаваймый из запроса к таблице inventory + * @param int $type - тип предмета. Где бы их всех взять? + * @param bool $returned + * @param bool $infOnly + * @return string + */ function showitem($row, $type, $returned = false, $infOnly = false) { @@ -1621,19 +1648,20 @@ function showitem($row, $type, $returned = false, $infOnly = false) destructitem($row['id']); } - if ($row['magic']) $magic = db::c()->query('SELECT * FROM `magic` WHERE `id` = ?i', $row['magic'])->fetch_assoc(); + if (!empty($row['magic'])) $magic = db::c()->query('SELECT * FROM `magic` WHERE `id` = ?i', $row['magic'])->fetch_assoc(); else { $magic['chanse'] = $incmagic['chanse']; $magic['time'] = $incmagic['time']; $magic['targeted'] = $incmagic['targeted']; } - if ($row['includemagic']) $incmagic = db::c()->query('SELECT * FROM `magic` WHERE `id` = ?i', $row['includemagic'])->fetch_assoc(); + if (!empty($row['includemagic'])) $incmagic = db::c()->query('SELECT * FROM `magic` WHERE `id` = ?i', $row['includemagic'])->fetch_assoc(); $incmagic['name'] = $row['includemagicname']; $incmagic['cur'] = $row['includemagicdex']; $incmagic['max'] = $row['includemagicmax']; $returnHTML .= ''; - if ((!$row['count'] || $type == 10) && $infOnly == false) { + + if ((empty($row['count']) || $type == 10) && $infOnly == false) { $up = ($row['upgrade'] > 0 ? " [" . $row['upgrade'] . "]" : ""); $returnHTML .= ''; if ($incmagic['max']) { @@ -1643,26 +1671,26 @@ function showitem($row, $type, $returned = false, $infOnly = false) } if (($user['sila'] >= $row['nsila']) && - ($user['lovk'] >= $row['nlovk']) && - ($user['inta'] >= $row['ninta']) && - ($user['vinos'] >= $row['nvinos']) && - ($user['intel'] >= $row['nintel']) && - ($user['mudra'] >= $row['nmudra']) && - ($user['level'] >= $row['nlevel']) && - (((int)$user['align'] == $row['nalign']) || ($row['nalign'] == 0)) && - ($user['noj'] >= $row['nnoj']) && - ($user['topor'] >= $row['ntopor']) && - ($user['dubina'] >= $row['ndubina']) && - ($user['mec'] >= $row['nmech']) && - ($user['mfire'] >= $row['nfire']) && - ($user['mwater'] >= $row['nwater']) && - ($user['mair'] >= $row['nair']) && - ($user['mearth'] >= $row['nearth']) && - ($user['mlight'] >= $row['nlight']) && - ($user['mgray'] >= $row['ngray']) && - ($user['mdark'] >= $row['ndark']) && - ($row['needident'] == 0) && - ($row['type'] < 13 || ($row['type'] == 22 || $row['type'] == 23 || $row['type'] == 24))) { + ($user['lovk'] >= $row['nlovk']) && + ($user['inta'] >= $row['ninta']) && + ($user['vinos'] >= $row['nvinos']) && + ($user['intel'] >= $row['nintel']) && + ($user['mudra'] >= $row['nmudra']) && + ($user['level'] >= $row['nlevel']) && + (((int)$user['align'] == $row['nalign']) || ($row['nalign'] == 0)) && + ($user['noj'] >= $row['nnoj']) && + ($user['topor'] >= $row['ntopor']) && + ($user['dubina'] >= $row['ndubina']) && + ($user['mec'] >= $row['nmech']) && + ($user['mfire'] >= $row['nfire']) && + ($user['mwater'] >= $row['nwater']) && + ($user['mair'] >= $row['nair']) && + ($user['mearth'] >= $row['nearth']) && + ($user['mlight'] >= $row['nlight']) && + ($user['mgray'] >= $row['ngray']) && + ($user['mdark'] >= $row['ndark']) && + ($row['needident'] == 0) && + ($row['type'] < 13 || ($row['type'] == 22 || $row['type'] == 23 || $row['type'] == 24))) { $returnHTML .= "надеть "; } @@ -1673,7 +1701,7 @@ function showitem($row, $type, $returned = false, $infOnly = false) elseif ($magic['targeted'] == 2) $returnHTML .= "findlogin('Введите имя персонажа', 'main.php?edit=1&use={$row['id']}', 'target')"; else $returnHTML .= "window.location='main.php?edit=1&use=" . $row['id'] . "';"; $returnHTML .= "\"href='#'>использовать
"; - } + } if ($type != 10) { $returnHTML .= '
ID: ' . $row['id'] . '
'; @@ -1685,203 +1713,148 @@ function showitem($row, $type, $returned = false, $infOnly = false) } $returnHTML .= ""; - if ($row['destinyinv'] > 0) { + + if (!empty($row['destinyinv'])) { $returnHTML .= "{$row['name']}{$up} (Масса: {$row['massa']})\"Этот" . (($row['present']) ? ' Этот предмет вам подарил ' . $row['present'] . '. Вы не сможете передать этот предмет кому-либо еще.' : "") . "
"; - } elseif ($row['destiny'] > 0) { + } elseif (!empty($row['destiny'])) { $returnHTML .= "{$row['name']}{$up} (Масса: {$row['massa']})\"Этот" . (($row['present']) ? ' Этот предмет вам подарил ' . $row['present'] . '. Вы не сможете передать этот предмет кому-либо еще.' : "") . "
"; - } else { + } else $returnHTML .= "{$row['name']}{$up} (Масса: {$row['massa']})" . (($row['present']) ? ' Этот предмет вам подарил ' . $row['present'] . '. Вы не сможете передать этот предмет кому-либо еще.' : "") . "
"; - } - if ($row['type'] == 24 && $type != 11) { - $returnHTML .= 'Уровень руны: ' . $row['rune_level'] . ' (' . $row['rune_exp'] . '/' . $runes_exp[$row['rune_level'] + 1] . ')
'; - } - if ($row['ecost'] > 0) { - $returnHTML .= "Предмет куплен за еврокредиты.    "; - } elseif ($row['point'] > 0) { - $returnHTML .= "Предмет куплен за очки репутации.    "; - } else { - $returnHTML .= "Цена: {$row['cost']} кр.    "; - } - if ($row['zeton'] > 0) { - $returnHTML .= "
Жетон: {$row['zeton']} 
"; - } - if ($row['count']) { - $returnHTML .= "(количество: {$row['count']})"; - } - if ($row['for_me'] > 0) { - $returnHTML .= '
После покупки вещь будет привязана к персонажу.'; - } - $returnHTML .= "
Долговечность: {$row['duration']}/{$row['maxdur']}"; - if ($row['podgon'] > 0) { + if ($row['type'] == 24 && $type != 11) + $returnHTML .= "
Уровень руны: " . $row['rune_level'] . " (" . $row['rune_exp'] . "/" . $runes_exp[$row['rune_level'] + 1] . ")"; + + if (!empty($row['ecost'])) { + $returnHTML .= "
Предмет куплен за еврокредиты."; + } elseif (!empty($row['point'])) { + $returnHTML .= "
Предмет куплен за очки репутации."; + } else $returnHTML .= "
Цена: {$row['cost']} кр."; + + if (!empty($row['zeton'])) + $returnHTML .= "
Жетон: {$row['zeton']} "; + + if (!empty($row['count'])) + $returnHTML .= "
(количество: {$row['count']})"; + + if (!empty($row['for_me'])) + $returnHTML .= "
После покупки вещь будет привязана к персонажу."; + + $returnHTML .= "
Долговечность: {$row['duration']}/{$row['maxdur']}"; + + if (!empty($row['podgon'])) $returnHTML .= " [Подогнано: " . $row['podgon'] . " раз]"; - } - $returnHTML .= "
"; + if (empty($row['needident'])) { + if (!empty($magic['chanse'])) $returnHTML .= "
Вероятность срабатывания: {$magic['chanse']}%"; + if (!empty($magic['time'])) $returnHTML .= "
Продолжительность действия магии: {$magic['time']} мин."; - if (!$row['needident']) { - if ($magic['chanse'] >= 98) $magic['chanse'] = 99; - $returnHTML .= (($magic['chanse']) ? "Вероятность срабатывания: " . $magic['chanse'] . "%
" : "") . " - " . (($magic['time']) ? "Продолжительность действия магии: " . $magic['time'] . " мин.
" : "") . " - " . (($row['goden']) ? "Срок годности: {$row['goden']} дн. " . ((!$row['count']) ? "(до " . date("Y.m.d H:i", $row['dategoden']) . ")" : "") . "
" : "") . " - " . (($row['nsila'] || $row['nlovk'] || $row['ninta'] || $row['nvinos'] OR $row['nlevel'] OR $row['nintel'] OR $row['nmudra'] OR $row['nnoj'] OR $row['ntopor'] OR $row['ndubina'] OR $row['nmech'] OR $row['nfire'] OR $row['nwater'] OR $row['nair'] OR $row['nearth'] OR $row['nearth'] OR $row['nlight'] OR $row['ngray'] OR $row['ndark']) ? "Требуется минимальное:
" : "") . " - " . (($row['nsila'] > 0) ? "• " . (($row['nsila'] > $user['sila']) ? "" : "") . "Сила: {$row['nsila']}
" : "") . " - " . (($row['nlovk'] > 0) ? "• " . (($row['nlovk'] > $user['lovk']) ? "" : "") . "Ловкость: {$row['nlovk']}
" : "") . " - " . (($row['ninta'] > 0) ? "• " . (($row['ninta'] > $user['inta']) ? "" : "") . "Интуиция: {$row['ninta']}
" : "") . " - " . (($row['nvinos'] > 0) ? "• " . (($row['nvinos'] > $user['vinos']) ? "" : "") . "Выносливость: {$row['nvinos']}
" : "") . " - " . (($row['nlevel'] > 0) ? "• " . (($row['nlevel'] > $user['level']) ? "" : "") . "Уровень: {$row['nlevel']}
" : "") . " - " . (($row['nintel'] > 0) ? "• " . (($row['nintel'] > $user['intel']) ? "" : "") . "Интеллект: {$row['nintel']}
" : "") . " - " . (($row['nnoj'] > 0) ? "• " . (($row['nnoj'] > $user['noj']) ? "" : "") . "Мастерство владения ножами и кастетами: {$row['nnoj']}
" : "") . " - " . (($row['ntopor'] > 0) ? "• " . (($row['ntopor'] > $user['topor']) ? "" : "") . "Мастерство владения топорами и секирами: {$row['ntopor']}
" : "") . " - " . (($row['ndubina'] > 0) ? "• " . (($row['ndubina'] > $user['dubina']) ? "" : "") . "Мастерство владения дубинами и булавами: {$row['ndubina']}
" : "") . " - " . (($row['nmech'] > 0) ? "• " . (($row['nmech'] > $user['mec']) ? "" : "") . "Мастерство владения мечами: {$row['nmech']}
" : "") . " - " . (($row['nfire'] > 0) ? "• " . (($row['nfire'] > $user['mfire']) ? "" : "") . "Мастерство владения стихией Огня: {$row['nfire']}
" : "") . " - " . (($row['nwater'] > 0) ? "• " . (($row['nwater'] > $user['mwater']) ? "" : "") . "Мастерство владения стихией Воды: {$row['nwater']}
" : "") . " - " . (($row['nair'] > 0) ? "• " . (($row['nair'] > $user['mair']) ? "" : "") . "Мастерство владения стихией Воздуха: {$row['nair']}
" : "") . " - " . (($row['nearth'] > 0) ? "• " . (($row['nearth'] > $user['mearth']) ? "" : "") . "Мастерство владения стихией Земли: {$row['nearth']}
" : "") . " - " . (($row['nlight'] > 0) ? "• " . (($row['nlight'] > $user['mlight']) ? "" : "") . "Мастерство владения магией Света: {$row['nlight']}
" : "") . " - " . (($row['ngray'] > 0) ? "• " . (($row['ngray'] > $user['mgray']) ? "" : "") . "Мастерство владения серой магией: {$row['ngray']}
" : "") . " - " . (($row['ndark'] > 0) ? "• " . (($row['ndark'] > $user['mdark']) ? "" : "") . "Мастерство владения магией Тьмы: {$row['ndark']}
" : "") . " + if (!empty($row['nlevel'])) $returnHTML .= "
Требуется Уровень: {$row['nlevel']}"; + if (!empty($row['nsila'])) $returnHTML .= "
Требуется Сила: {$row['nsila']}"; + if (!empty($row['nlovk'])) $returnHTML .= "
Требуется Ловкость: {$row['nlovk']}"; + if (!empty($row['ninta'])) $returnHTML .= "
Требуется Интуиция: {$row['ninta']}"; + if (!empty($row['nvinos'])) $returnHTML .= "
Требуется Выносливость: {$row['nvinos']}"; + if (!empty($row['nintel'])) $returnHTML .= "
Требуется Интеллект: {$row['nintel']}"; + if (!empty($row['nmudra'])) $returnHTML .= "
Требуется Мудрость: {$row['nmudra']}"; - " . (($row['gmeshok'] OR $row['gsila'] OR $row['mfkrit'] OR $row['mfakrit'] OR $row['mfuvorot'] OR $row['mfauvorot'] OR $row['glovk'] OR $row['ghp'] OR $row['ginta'] OR $row['gintel'] OR $row['gnoj'] OR $row['gtopor'] OR $row['gdubina'] OR $row['gmech'] OR $row['gfire'] OR $row['gwater'] OR $row['gair'] OR $row['gearth'] OR $row['gearth'] OR $row['glight'] OR $row['ggray'] OR $row['gdark'] OR $row['minu'] OR $row['maxu'] OR $row['bron1'] OR $row['bron2'] OR $row['bron3'] OR $row['bron4']) ? "Действует на:
" : "") . " - " . (($row['minu']) ? "• Минимальное наносимое повреждение: +{$row['minu']}
" : "") . " - " . (($row['maxu']) ? "• Максимальное наносимое повреждение: +{$row['maxu']}
" : ""); + if (!empty($row['minu'])) $returnHTML .= "
Минимальное наносимое повреждение: +{$row['minu']}"; + if (!empty($row['maxu'])) $returnHTML .= "
Максимальное наносимое повреждение: +{$row['maxu']}"; if ($row['gsila']) { - $returnHTML .= "• Сила: " . plusorminus($row['gsila']); - if ($row['free_stat'] > 0) { + $returnHTML .= "
Сила: " . plusorminus($row['gsila']); + if ($row['free_stat'] > 0) $returnHTML .= " 🔼"; - } - $returnHTML .= "
"; } if ($row['glovk']) { - $returnHTML .= "• Ловкость: " . plusorminus($row['glovk']); - if ($row['free_stat'] > 0) { + $returnHTML .= "
Ловкость: " . plusorminus($row['glovk']); + if ($row['free_stat'] > 0) $returnHTML .= " 🔼"; - } - $returnHTML .= "
"; } - if ($row['ginta']) { - $returnHTML .= "• Интуиция: " . plusorminus($row['ginta']); - if ($row['free_stat'] > 0) { + $returnHTML .= "
Интуиция: " . plusorminus($row['ginta']); + if ($row['free_stat'] > 0) $returnHTML .= " 🔼"; - } - $returnHTML .= "
"; } if ($row['gintel']) { - $returnHTML .= "• Интеллект: " . plusorminus($row['gintel']); - if ($row['free_stat'] > 0) { + $returnHTML .= "
Интеллект: " . plusorminus($row['gintel']); + if ($row['free_stat'] > 0) $returnHTML .= " 🔼"; - } - $returnHTML .= "
"; } - - $returnHTML .= (($row['ghp']) ? "• Уровень жизни: " . plusorminus($row['ghp']) . "
" : ""); - + if (!empty($row['ghp'])) $returnHTML .= "
Уровень жизни: " . plusorminus($row['ghp']); if ($row['mfkrit'] > 0) { - $returnHTML .= "• Мф. критических ударов: " . plusorminus($row['mfkrit']) . "%"; - if ($row['free_mf'] > 0) { + $returnHTML .= "
Мф. критических ударов: " . plusorminus($row['mfkrit']) . "%"; + if ($row['free_mf'] > 0) $returnHTML .= " 🔼"; - } - $returnHTML .= "
"; } if ($row['mfakrit'] > 0) { - $returnHTML .= "• Мф. против крит. ударов: " . plusorminus($row['mfakrit']) . "%"; - if ($row['free_mf'] > 0) { + $returnHTML .= "
Мф. против крит. ударов: " . plusorminus($row['mfakrit']) . "%"; + if ($row['free_mf'] > 0) $returnHTML .= " 🔼"; - } - $returnHTML .= "
"; } if ($row['mfuvorot'] > 0) { - $returnHTML .= "• Мф. увертливости: " . plusorminus($row['mfuvorot']) . "%"; - if ($row['free_mf'] > 0) { + $returnHTML .= "
Мф. увертливости: " . plusorminus($row['mfuvorot']) . "%"; + if ($row['free_mf'] > 0) $returnHTML .= " 🔼"; - } - $returnHTML .= "
"; } if ($row['mfauvorot'] > 0) { - $returnHTML .= "• Мф. против увертлив.: " . plusorminus($row['mfauvorot']) . "%"; - if ($row['free_mf'] > 0) { + $returnHTML .= "
Мф. против увертлив.: " . plusorminus($row['mfauvorot']) . "%"; + if ($row['free_mf'] > 0) $returnHTML .= " 🔼"; - } - $returnHTML .= "
"; } - $returnHTML .= (($row['gnoj']) ? "• Мастерство владения ножами и кастетами: +{$row['gnoj']}
" : "") . " - " . (($row['gtopor']) ? "• Мастерство владения топорами и секирами: +{$row['gtopor']}
" : "") . " - " . (($row['gdubina']) ? "• Мастерство владения дубинами и булавами: +{$row['gdubina']}
" : "") . " - " . (($row['gmech']) ? "• Мастерство владения мечами: +{$row['gmech']}
" : "") . " - " . (($row['gfire']) ? "• Мастерство владения стихией Огня: +{$row['gfire']}
" : "") . " - " . (($row['gwater']) ? "• Мастерство владения стихией Воды: +{$row['gwater']}
" : "") . " - " . (($row['gair']) ? "• Мастерство владения стихией Воздуха: +{$row['gair']}
" : "") . " - " . (($row['gearth']) ? "• Мастерство владения стихией Земли: +{$row['gearth']}
" : "") . " - " . (($row['glight']) ? "• Мастерство владения магией Света: +{$row['glight']}
" : "") . " - " . (($row['ggray']) ? "• Мастерство владения серой магией: +{$row['ggray']}
" : "") . " - " . (($row['gdark']) ? "• Мастерство владения магией Тьмы: +{$row['gdark']}
" : ""); - - if ($row['bron1'] > 0) { - $returnHTML .= "• Броня головы: " . $row['bron1']; - if ($row['free_bron'] > 0) { + $returnHTML .= "
Броня головы: " . $row['bron1']; + if ($row['free_bron'] > 0) $returnHTML .= " 🔼"; - } - $returnHTML .= "
"; } if ($row['bron2'] > 0) { - $returnHTML .= "• Броня корпуса: " . $row['bron2']; - if ($row['free_bron'] > 0) { + $returnHTML .= "
Броня корпуса: " . $row['bron2']; + if ($row['free_bron'] > 0) $returnHTML .= " 🔼"; - } - $returnHTML .= "
"; } if ($row['bron3'] > 0) { - $returnHTML .= "• Броня пояса: " . $row['bron3']; - if ($row['free_bron'] > 0) { + $returnHTML .= "
Броня пояса: " . $row['bron3']; + if ($row['free_bron'] > 0) $returnHTML .= " 🔼"; - } - $returnHTML .= "
"; } if ($row['bron4'] > 0) { - $returnHTML .= "• Броня ног: " . $row['bron4']; - if ($row['free_bron'] > 0) { + $returnHTML .= "
Броня ног: " . $row['bron4']; + if ($row['free_bron'] > 0) $returnHTML .= " 🔼"; - } - $returnHTML .= "
"; } - $returnHTML .= (($row['gmeshok']) ? "• Вместимость рюкзака: +{$row['gmeshok']}
" : "") . " - " . (($row['letter']) ? "Количество символов: " . strlen($row['letter']) . "" : "") . " - " . (($row['letter']) ? "На бумаге записан текст:
" . nl2br($row['letter']) . "
" : "") . " - " . (($row['opisan']) ? "• " . nl2br($row['opisan']) . "
" : "") . " - " . (($magic['name'] && $row['type'] != 50) ? "Наложены заклятия: " . $magic['name'] . "
" : "") . " + if (!empty($row['gmeshok'])) $returnHTML .= "
Вместимость рюкзака: +{$row['gmeshok']}"; + if (!empty($row['letter'])) $returnHTML .= "
На бумаге записан текст:
" . nl2br($row['letter']) . "
"; + if (!empty($row['opisan'])) $returnHTML .= "
" . nl2br($row['opisan']); + + //Хрен пойми что есть что. + $returnHTML .= (($magic['name'] && $row['type'] != 50) ? "Наложены заклятия: " . $magic['name'] . "
" : "") . " " . (($row['text']) ? " " . $row['text'] . "
" : "") . " - " . (($incmagic['max']) ? " Встроено заклятие " . $incmagic['cur'] . " шт.
" : "") . " - " . (($row['podzem']) ? "Предмет из подземелья
" : "") . " - " . (($row['laba'] == 1) ? "Пропадёт если не найти выход
" : "") . " - " . (($row['laba'] == 2) ? "Предмет пропадёт после выхода
" : "") . " - " . ((!$row['isrep']) ? "Предмет не подлежит ремонту
" : ""); + " . (($incmagic['max']) ? " Встроено заклятие " . $incmagic['cur'] . " шт.
" : ""); - if ($row['free_bron'] > 0) { + if (!empty($row['podzem'])) $returnHTML .= "
Предмет из подземелья"; + if ($row['podzem'] == 1) $returnHTML .= "
Пропадёт если не найти выход"; + if ($row['podzem'] == 2) $returnHTML .= "
Предмет пропадёт после выхода"; + if (empty($row['isrep'])) $returnHTML .= "
Предмет не подлежит ремонту"; + + if ($row['free_bron'] > 0) $returnHTML .= "Свободных улучшений брони: " . $row['free_bron'] . "
"; - } - if ($row['free_stat'] > 0) { + + if ($row['free_stat'] > 0) $returnHTML .= "Свободных улучшений параметров: " . $row['free_stat'] . "
"; - } - if ($row['free_mf'] > 0) { + + if ($row['free_mf'] > 0) $returnHTML .= "Свободных улучшений модификаторов: " . $row['free_mf'] . "%
"; - } if ($row['add_proc_mf'] > 0 || $row['add_proc_uron'] > 0 || $row['add_proc_bron'] > 0) { $returnHTML .= 'Усиление:
'; @@ -1895,9 +1868,8 @@ function showitem($row, $type, $returned = false, $infOnly = false) $returnHTML .= '• Брони:' . plusorminus($row['add_proc_bron']) . '%
'; } } - } else { - $returnHTML .= "Свойства предмета не идентифицированы
"; - } + } else $returnHTML .= "
Свойства предмета не идентифицированы!"; + $osob = array(22, 23); if (in_array($row['type'], $osob)) { $returnHTML .= 'Особенности:
'; @@ -2162,17 +2134,17 @@ function dropitem($slot) `u`.`fauvorot` = `u`.`fauvorot` - `i`.`mfauvorot`, `u`.`uminu` = `u`.`uminu` - `i`.`minu`, `u`.`umaxu` = `u`.`umaxu` - `i`.`maxu` - WHERE `i`.`id` = `u`.?f AND `i`.`dressed` = 1 AND `i`.`owner` = ?i AND u.id = ?i',$slot1,$slot1,$user['id'],$user['id'])) - db::c()->query('UPDATE `users` SET `hp` = `maxhp`, `fullhptime` = ?i WHERE `hp` > `maxhp` AND `id` = ?i',time(),$user['id']); + WHERE `i`.`id` = `u`.?f AND `i`.`dressed` = 1 AND `i`.`owner` = ?i AND u.id = ?i', $slot1, $slot1, $user['id'], $user['id'])) + db::c()->query('UPDATE `users` SET `hp` = `maxhp`, `fullhptime` = ?i WHERE `hp` > `maxhp` AND `id` = ?i', time(), $user['id']); - $wear_raw = db::c()->query('SELECT * FROM `inventory` where `owner` = ?i AND `dressed` = 1',$user['id']); + $wear_raw = db::c()->query('SELECT * FROM `inventory` where `owner` = ?i AND `dressed` = 1', $user['id']); while ($wear_list = $wear_raw->fetch_assoc()) { $wear_arr[] = $wear_list['prototype']; }; $item['id'] = $user[$slot1]; - $get_pro = db::c()->query('SELECT * FROM `inventory` where `id` = ?i',$item['id'])->fetch_assoc(); + $get_pro = db::c()->query('SELECT * FROM `inventory` where `id` = ?i', $item['id'])->fetch_assoc(); ///////////////////// $sets_items = db::c()->query('SELECT * FROM `item_sets`'); @@ -2229,7 +2201,7 @@ function dropitem($slot) `u`.`mlight = `u`.`mlight - `s`.`glight`, `u`.`mgray = `u`.`mgray - `s`.`ggray` WHERE - `u`.`id` = ?i AND `s`.`set_id`= ?i',$user['id'],$set_id); + `u`.`id` = ?i AND `s`.`set_id`= ?i', $user['id'], $set_id); } } return true; @@ -2250,8 +2222,8 @@ function ref_drop() function derj($id) { //global $user; - $user = db::c()->query('SELECT `id`, `align` FROM `users` WHERE `id` = ?i',$_SESSION['uid'])->fetch_assoc(); - $ts = db::c()->query('SELECT `id`, `nalign` FROM `inventory` WHERE `id` = ?i',$id)->fetch_assoc(); + $user = db::c()->query('SELECT `id`, `align` FROM `users` WHERE `id` = ?i', $_SESSION['uid'])->fetch_assoc(); + $ts = db::c()->query('SELECT `id`, `nalign` FROM `inventory` WHERE `id` = ?i', $id)->fetch_assoc(); $al = '(1 = 1)'; if ($ts['nalign'] == 1.1) $al = '(1 = 2)'; $dd = db::c()->query('SELECT `i`.`id` FROM `users` AS `u`, `inventory` AS `i` @@ -2280,7 +2252,7 @@ function ref_drop() `u`.`mgray` >= `i`.`ngray` AND `u`.`mdark` >= `i`.`ndark` AND `i`.`setsale` = 0 AND - `u`.`id` = ?i',$id,$user['id'],$al,$user['align'],$user['id']); + `u`.`id` = ?i', $id, $user['id'], $al, $user['align'], $user['id']); if ($dd->getNumRows() > 0) { return true; } else { @@ -2518,10 +2490,11 @@ function addchp($text, $who, $room = 0) } /** -* @param $msg -* @throws \Krugozor\Database\Mysql\Exception + * @param $msg + * @throws \Krugozor\Database\Mysql\Exception * Отправка системного сообщения в чат. -*/function AddChatSystem($msg) + */ +function AddChatSystem($msg) { if ($msg) db::c()->query('INSERT INTO `chat` (`cid`,`msg`,`type`) VALUES (?i,"?s","?s")', 1, $msg, 'sys'); }