diff --git a/clan_create.php b/clan_create.php index bdc5cf5..425b454 100644 --- a/clan_create.php +++ b/clan_create.php @@ -1,17 +1,24 @@ - - + + @@ -20,6 +27,7 @@ $klanDescr = filter_input(INPUT_POST, 'klandescr'); top.frames['main'].location = 'city.php?strah' } + Регистратура кланов

Регистратура кланов

@@ -30,11 +38,21 @@ if ($klanName && $klanAbbr && $klanDescr) { $eff = db::c()->query('SELECT 1 FROM `effects` WHERE `owner` = ?i AND `type` = 20', $user['id']); $name_check = db::c()->query('SELECT 1 FROM `clans` WHERE `name` = "?s" OR `short` = "?s"', 111, 333); - if (!empty($user['align'])) $error .= 'Вы уже имеете направленность!.
'; - if (!empty($user['klan'])) $error .= 'Вы уже состоите в клане!.
'; - if (10000 >= $user['money']) $error .= 'Не хватает денег на регистрацию клана.
'; - if (!$eff) $error .= 'Нет проверки.
'; - if (!$name_check) $error .= 'Клан с такими данными уже существует.
'; + if (!empty($user['align'])) { + $error .= 'Вы уже имеете направленность!.
'; + } + if (!empty($user['klan'])) { + $error .= 'Вы уже состоите в клане!.
'; + } + if (10000 >= $user['money']) { + $error .= 'Не хватает денег на регистрацию клана.
'; + } + if (!$eff) { + $error .= 'Нет проверки.
'; + } + if (!$name_check) { + $error .= 'Клан с такими данными уже существует.
'; + } if (!$error) { /*TODO: Класс банковского перевода.*/ @@ -43,7 +61,9 @@ if ($klanName && $klanAbbr && $klanDescr) { // db::c()->query('UPDATE `users` SET `money` = `money` - 10000 WHERE `id` = ?i', $user['id']); // err('Вам прийдет извещение о результате регистрации клана.'); err('Проверки пройдены, но клан регистрировать пока нельзя!'); - } else err($error); + } else { + err($error); + } } if ($user['admin'] == '1') { diff --git a/enter.php b/enter.php index a40149e..d166879 100644 --- a/enter.php +++ b/enter.php @@ -7,8 +7,8 @@ foreach ($_POST as $key => $val) { //Проверка всех значений } $username = filter_input(INPUT_POST, 'username', FILTER_SANITIZE_SPECIAL_CHARS); -$password = filter_input(INPUT_POST, 'password'); -$battle = filter_input(INPUT_COOKIE, 'battle'); +$password = $_POST['password'] ?? ''; +$battle = $_COOKIE['battle'] ?? ''; $error = ""; if ($username && $password) { @@ -40,7 +40,6 @@ if ($username && $password) { } db::c()->query('UPDATE `users` SET `sid` = "?s", `enter_game` = ?i WHERE `id` = ?i', session_id(), 1, $data['id']); - $_SESSION['sid'] = session_id(); $sms = db::c()->query('SELECT * FROM `telegraph` WHERE `receiver` = ?i', $data['id']); while ($res = $sms->fetch_assoc()) { diff --git a/fight.php b/fight.php index 2c70e27..c767c58 100644 --- a/fight.php +++ b/fight.php @@ -1,10 +1,13 @@ query('UPDATE `users` SET `enter_game` = 0 WHERE `enter_game` = 1 AND `id` = ?i', $_SESSION['uid']); +$userLoginStatus = db::c()->query('SELECT enter_game FROM users WHERE id = ?i',$_SESSION['uid'])->getNumRows() ?? 0; +if (empty($userLoginStatus)) {header("Location: index.php");} +else {db::c()->query('UPDATE `users` SET `enter_game` = 0 WHERE `enter_game` = 1 AND `id` = ?i', $_SESSION['uid']);} ?> - + + Окно игры diff --git a/main.php b/main.php index c73c6bc..2f43b59 100644 --- a/main.php +++ b/main.php @@ -7,7 +7,9 @@ if ($get === 'exit') { session_destroy(); header("Location: fight.php"); } -if (!isset($_SESSION['uid'])) header("Location: index.php"); +if (!isset($_SESSION['uid'])) { + header("Location: index.php"); +} require_once 'functions.php'; $tmaz = time(); db::c()->query('UPDATE `online` SET `real_time` = ?i WHERE `id` = ?i', time(), $user['id']); @@ -185,22 +187,31 @@ if ($user['room'] == 666) { function sum_mf($u) { $sum = db::c()->query('SELECT SUM(`add_proc_mf`) AS `mf` FROM `inventory` WHERE `dressed` = 1 AND `add_proc_mf` > 0 AND `owner` = ?i', $u); - if ($sum->fetch_assoc() > 0) return $sum; - else return 0; + if ($sum->fetch_assoc() > 0) { + return $sum; + } else { + return 0; + } } function sum_dmg($u) { $sum = db::c()->query('SELECT SUM(`add_proc_uron`) AS `mf` FROM `inventory` WHERE `dressed` = 1 AND `add_proc_uron` > 0 AND `owner` = ?i', $u); - if ($sum->fetch_assoc() > 0) return $sum; - else return 0; + if ($sum->fetch_assoc() > 0) { + return $sum; + } else { + return 0; + } } function sum_bron($u) { $sum = db::c()->query('SELECT SUM(`add_proc_bron`) AS `mf` FROM `inventory` WHERE `dressed` = 1 AND `add_proc_bron` > 0 AND `owner` = ?i', $u); - if ($sum->fetch_assoc() > 0) return $sum; - else return 0; + if ($sum->fetch_assoc() > 0) { + return $sum; + } else { + return 0; + } } function bron_ads($a1, $a2, $a3, $a4, $col) @@ -257,26 +268,28 @@ function unstack($it_id, $it_count) } mysql_query("INSERT INTO `inventory` (`name`, `upgrade`, `modif`, `podgon`, `duration`, `maxdur`, `cost`, `bcost`, `point`, `nlevel`, `nsila`, `nlovk`, `ninta`, `nvinos`, `nintel`, `nmudra`, `nnoj`, `ntopor`, `ndubina`, `nmech`, `nalign`, `minu`, `maxu`, `gsila`, `glovk`, `ginta`, `gintel`, `ghp`, `mfkrit`, `mfakrit`, `mfuvorot`, `mfauvorot`, `gnoj`, `gtopor`, `gdubina`, `gmech`, `img`, `text`, `owner`, `dressed`, `bron1`, `bron2`, `bron3`, `bron4`, `dategoden`, `magic`, `type`, `present`, `sharped`, `massa`, `goden`, `needident`, `nfire`, `nwater`, `nair`, `nearth`, `nlight`, `ngray`, `ndark`, `gfire`, `gwater`, `gair`, `gearth`, `glight`, `ggray`, `gdark`, `free_bron`, `free_stat`, `free_mf`, `letter`, `isrep`, `update`, `setsale`, `prototype`, `otdel`, `bs`, `gmp`, `includemagic`, `includemagicdex`, `includemagicmax`, `includemagicname`, `includemagicuses`, `includemagiccost`, `gmeshok`, `tradesale`, `podzem`, `x_mis`, `artefact`, `destinyinv`, `encicl`, `foronetrip`, `koll`) VALUES ('" . $dress['name'] . "', '" . $dress['upgrade'] . "', '" . $dress['modif'] . "', '" . $dress['podgon'] . "', '" . $dress['duration'] . "', '" . $dress['maxdur'] . "', '" . ($dress['cost'] / $dress['koll'] * $it_count) . "', '" . ($dress['bcost'] / $dress['koll'] * $it_count) . "', '" . ($dress['point'] / $dress['koll'] * $it_count) . "', '" . $dress['nlevel'] . "', '" . $dress['nsila'] . "', '" . $dress['nlovk'] . "', '" . $dress['ninta'] . "', '" . $dress['nvinos'] . "', '" . $dress['nintel'] . "', '" . $dress['nmudra'] . "', '" . $dress['nnoj'] . "', '" . $dress['ntopor'] . "', '" . $dress['ndubina'] . "', '" . $dress['nmech'] . "', '" . $dress['nalign'] . "', '" . $dress['minu'] . "', '" . $dress['maxu'] . "', '" . $dress['gsila'] . "', '" . $dress['glovk'] . "', '" . $dress['ginta'] . "', '" . $dress['gintel'] . "', '" . $dress['ghp'] . "', '" . $dress['mfkrit'] . "', '" . $dress['mfakrit'] . "', '" . $dress['mfuvorot'] . "', '" . $dress['mfauvorot'] . "', '" . $dress['gnoj'] . "', '" . $dress['gtopor'] . "', '" . $dress['gdubina'] . "', '" . $dress['gmech'] . "', '" . $dress['img'] . "', '" . $dress['text'] . "', '" . $dress['owner'] . "', '" . $dress['dressed'] . "', '" . $dress['bron1'] . "', '" . $dress['bron2'] . "', '" . $dress['bron3'] . "', '" . $dress['bron4'] . "', '" . $dress['dategoden'] . "', '" . $dress['magic'] . "', '" . $dress['type'] . "', '" . $dress['present'] . "', '" . $dress['sharped'] . "', '" . ($dress['massa'] / $dress['koll'] * $it_count) . "', '" . $dress['goden'] . "', '" . $dress['needident'] . "', '" . $dress['nfire'] . "', '" . $dress['nwater'] . "', '" . $dress['nair'] . "', '" . $dress['nearth'] . "', '" . $dress['nlight'] . "', '" . $dress['ngray'] . "', '" . $dress['ndark'] . "', '" . $dress['gfire'] . "', '" . $dress['gwater'] . "', '" . $dress['gair'] . "', '" . $dress['gearth'] . "', '" . $dress['glight'] . "', '" . $dress['ggray'] . "', '" . $dress['gdark'] . "', '" . $dress['free_bron'] . "', '" . $dress['free_bron'] . "', '" . $dress['free_mf'] . "', '" . $dress['letter'] . "', '" . $dress['isrep'] . "', '" . $dress['update'] . "', '" . $dress['setsale'] . "', '" . $dress['prototype'] . "', '" . $dress['otdel'] . "', '" . $dress['bs'] . "', '" . $dress['gmp'] . "', '" . $dress['includemagic'] . "', '" . $dress['includemagicdex'] . "', '" . $dress['includemagicmax'] . "', '" . $dress['includemagicname'] . "', '" . $dress['ggrincludemagicusesay'] . "', '" . $dress['includemagiccost'] . "', '" . ($dress['gmeshok'] / $dress['koll'] * $it_count) . "', '" . $dress['tradesale'] . "', '" . $dress['podzem'] . "', '" . $dress['x_mis'] . "', '" . $dress['artefact'] . "', '" . $dress['destinyinv'] . "', '" . $dress['encicl'] . "', '" . $dress['foronetrip'] . "', '" . $it_count . "')"); return mysql_insert_id(); - } else return false; - } else return false; + } else { + return false; + } + } else { + return false; + } } function del_efs($uid, $id, $type) { global $user; $arr = [2, 3, 4, 5, 8, 10, 11, 12, 13, 14, 20]; - if ($uid == $user['id']) { - if ($id != null) { - if (!in_array($type, $arr)) { - db::c()->query('DELETE FROM `effects` WHERE `owner` = ?i AND `id` = ?i', $uid, $id); - if ($type == 1022) { - db::c()->query('UPDATE `users` SET `invis` = ?i WHERE `id` = ?i', 0, $uid); - $user['invis'] = 0; - } - err('Эффект удалён.'); - } else { - err('Данный эффект нельзя удалить.'); + if ($uid == $user['id'] && $id != null) { + if (!in_array($type, $arr)) { + db::c()->query('DELETE FROM `effects` WHERE `owner` = ?i AND `id` = ?i', $uid, $id); + if ($type == 1022) { + db::c()->query('UPDATE `users` SET `invis` = ?i WHERE `id` = ?i', 0, $uid); + $user['invis'] = 0; } + err('Эффект удалён.'); + } else { + err('Данный эффект нельзя удалить.'); } } } @@ -311,8 +324,12 @@ function countmf() $bmfud = $bmfbron = 0; - if (!empty($sokr)) $bmfud += 5; - if (!empty($zo)) $bmfbron += 25; + if (!empty($sokr)) { + $bmfud += 5; + } + if (!empty($zo)) { + $bmfbron += 25; + } $mf = []; @@ -353,6 +370,9 @@ function countmf() case "mech": $weap_b += $user['mec']; break; + default: + $weap_b = 0; + break; } return ['minu' => $mf['me']['udar'] + $bmfud + $weap_b, 'maxu' => $mf['me']['maxudar'] + $bmfud + $weap_b, 'fkrit' => round($mykrit, 0), 'fakrit' => round($myakrit, 0), 'fuvorot' => round($myuvorot, 0), 'fauvorot' => round($myauvorot, 0), 'bron1' => $user_dress[6], 'bron2' => $user_dress[7], 'bron3' => $user_dress[8], 'bron4' => $user_dress[9]]; @@ -412,35 +432,53 @@ function dressitem($id) } if ($item['type'] == 5) { - if (!$user['r1']) $slot1 = 'r1'; - elseif (!$user['r2']) $slot1 = 'r2'; - elseif (!$user['r3']) $slot1 = 'r3'; - else { + if (!$user['r1']) { + $slot1 = 'r1'; + } elseif (!$user['r2']) { + $slot1 = 'r2'; + } elseif (!$user['r3']) { + $slot1 = 'r3'; + } else { $slot1 = 'r1'; dropitem(5); } } elseif ($item['type'] == 12) { - if (!$user['m1']) $slot1 = 'm1'; - elseif (!$user['m2']) $slot1 = 'm2'; - elseif (!$user['m3']) $slot1 = 'm3'; - elseif (!$user['m4']) $slot1 = 'm4'; - elseif (!$user['m5']) $slot1 = 'm5'; - elseif (!$user['m6']) $slot1 = 'm6'; - elseif (!$user['m7']) $slot1 = 'm7'; - elseif (!$user['m8']) $slot1 = 'm8'; - elseif (!$user['m9']) $slot1 = 'm9'; - elseif (!$user['m10']) $slot1 = 'm10'; - else { + if (!$user['m1']) { + $slot1 = 'm1'; + } elseif (!$user['m2']) { + $slot1 = 'm2'; + } elseif (!$user['m3']) { + $slot1 = 'm3'; + } elseif (!$user['m4']) { + $slot1 = 'm4'; + } elseif (!$user['m5']) { + $slot1 = 'm5'; + } elseif (!$user['m6']) { + $slot1 = 'm6'; + } elseif (!$user['m7']) { + $slot1 = 'm7'; + } elseif (!$user['m8']) { + $slot1 = 'm8'; + } elseif (!$user['m9']) { + $slot1 = 'm9'; + } elseif (!$user['m10']) { + $slot1 = 'm10'; + } else { $slot1 = 'm1'; dropitem(12); } - } else dropitem($item['type']); + } else { + dropitem($item['type']); + } if (!($item['type'] == 12 && $user['level'] < 4)) { - if (db::c()->query('UPDATE `users` AS `u`, `inventory` AS `i` SET `u`.?f = ?i, `i`.`dressed` = 1, `u`.`sila` = `u`.`sila` + `i`.`gsila`, `u`.`lovk` = `u`.`lovk` + `i`.`glovk`, `u`.`inta` = `u`.`inta` + `i`.`ginta`, `u`.`intel` = `u`.`intel` + `i`.`gintel`, `u`.`maxhp` = `u`.`maxhp` + `i`.`ghp`, `u`.`noj` = `u`.`noj` + `i`.`gnoj`, `u`.`topor` = `u`.`topor` + `i`.`gtopor`, `u`.`dubina` = `u`.`dubina` + `i`.`gdubina`, `u`.`mec` = `u`.`mec` + `i`.`gmech`, `u`.`mfire` = `u`.`mfire` + `i`.`gfire`, `u`.`mwater` = `u`.`mwater` + `i`.`gwater`, `u`.`mair` = `u`.`mair` + `i`.`gair`, `u`.`mearth` = `u`.`mearth` + `i`.`gearth`, `u`.`mlight` = `u`.`mlight` + `i`.`glight`, `u`.`mgray` = `u`.`mgray` + `i`.`ggray`, `u`.`mdark` = `u`.`mdark` + `i`.`gdark`, `u`.`ubron1` = `u`.`ubron1` + `i`.`bron1`, `u`.`ubron2` = `u`.`ubron2` + `i`.`bron2`, `u`.`ubron3` = `u`.`ubron3` + `i`.`bron3`, `u`.`ubron4` = `u`.`ubron4` + `i`.`bron4`, `u`.`fkrit` = `u`.`fkrit` + `i`.`mfkrit`, `u`.`fakrit` = `u`.`fakrit` + `i`.`mfakrit`, `u`.`fuvorot` = `u`.`fuvorot` + `i`.`mfuvorot`, `u`.`fauvorot` = `u`.`fauvorot` + `i`.`mfauvorot`, `u`.`uminu` = `u`.`uminu` + `i`.`minu`, `u`.`umaxu` = `u`.`umaxu` + `i`.`maxu` WHERE `i`.`needident` = 0 AND `i`.`id` = ?i AND `i`.`dressed` = 0 AND `i`.owner = ?i AND (20 + `u`.`sila`) >= `i`.`nsila` AND (20 + `u`.`lovk`) >= `i`.`nlovk` AND (20 + `u`.`inta`) >= `i`.`ninta` AND `u`.`vinos` >= `i`.`nvinos` AND (20 + `u`.`intel`) >= `i`.`nintel` AND `u`.`mudra` >= `i`.`nmudra` AND `u`.`level` >= `i`.`nlevel` AND (("?s" OR (?i = `i`.`nalign`)) OR (`i`.`nalign` = 0)) AND `u`.`noj` >= `i`.`nnoj` AND `u`.`topor` >= `i`.`ntopor` AND `u`.`dubina` >= `i`.`ndubina` AND `u`.`mec` >= `i`.`nmech` AND `u`.`mfire` >= `i`.`nfire` AND `u`.`mwater` >= `i`.`nwater` AND `u`.`mair` >= `i`.`nair` AND `u`.`mearth` >= `i`.`nearth` AND `u`.`mlight` >= `i`.`nlight` AND `u`.`mgray` >= `i`.`ngray` AND `u`.`mdark` >= `i`.`ndark` AND `i`.`setsale` = 0 AND `u`.`id` = ?i', $slot1, $id, $id, $user['id'], $al, $user['align'], $user['id'])) + if (db::c()->query('UPDATE `users` AS `u`, `inventory` AS `i` SET `u`.?f = ?i, `i`.`dressed` = 1, `u`.`sila` = `u`.`sila` + `i`.`gsila`, `u`.`lovk` = `u`.`lovk` + `i`.`glovk`, `u`.`inta` = `u`.`inta` + `i`.`ginta`, `u`.`intel` = `u`.`intel` + `i`.`gintel`, `u`.`maxhp` = `u`.`maxhp` + `i`.`ghp`, `u`.`noj` = `u`.`noj` + `i`.`gnoj`, `u`.`topor` = `u`.`topor` + `i`.`gtopor`, `u`.`dubina` = `u`.`dubina` + `i`.`gdubina`, `u`.`mec` = `u`.`mec` + `i`.`gmech`, `u`.`mfire` = `u`.`mfire` + `i`.`gfire`, `u`.`mwater` = `u`.`mwater` + `i`.`gwater`, `u`.`mair` = `u`.`mair` + `i`.`gair`, `u`.`mearth` = `u`.`mearth` + `i`.`gearth`, `u`.`mlight` = `u`.`mlight` + `i`.`glight`, `u`.`mgray` = `u`.`mgray` + `i`.`ggray`, `u`.`mdark` = `u`.`mdark` + `i`.`gdark`, `u`.`ubron1` = `u`.`ubron1` + `i`.`bron1`, `u`.`ubron2` = `u`.`ubron2` + `i`.`bron2`, `u`.`ubron3` = `u`.`ubron3` + `i`.`bron3`, `u`.`ubron4` = `u`.`ubron4` + `i`.`bron4`, `u`.`fkrit` = `u`.`fkrit` + `i`.`mfkrit`, `u`.`fakrit` = `u`.`fakrit` + `i`.`mfakrit`, `u`.`fuvorot` = `u`.`fuvorot` + `i`.`mfuvorot`, `u`.`fauvorot` = `u`.`fauvorot` + `i`.`mfauvorot`, `u`.`uminu` = `u`.`uminu` + `i`.`minu`, `u`.`umaxu` = `u`.`umaxu` + `i`.`maxu` WHERE `i`.`needident` = 0 AND `i`.`id` = ?i AND `i`.`dressed` = 0 AND `i`.owner = ?i AND (20 + `u`.`sila`) >= `i`.`nsila` AND (20 + `u`.`lovk`) >= `i`.`nlovk` AND (20 + `u`.`inta`) >= `i`.`ninta` AND `u`.`vinos` >= `i`.`nvinos` AND (20 + `u`.`intel`) >= `i`.`nintel` AND `u`.`mudra` >= `i`.`nmudra` AND `u`.`level` >= `i`.`nlevel` AND (("?s" OR (?i = `i`.`nalign`)) OR (`i`.`nalign` = 0)) AND `u`.`noj` >= `i`.`nnoj` AND `u`.`topor` >= `i`.`ntopor` AND `u`.`dubina` >= `i`.`ndubina` AND `u`.`mec` >= `i`.`nmech` AND `u`.`mfire` >= `i`.`nfire` AND `u`.`mwater` >= `i`.`nwater` AND `u`.`mair` >= `i`.`nair` AND `u`.`mearth` >= `i`.`nearth` AND `u`.`mlight` >= `i`.`nlight` AND `u`.`mgray` >= `i`.`ngray` AND `u`.`mdark` >= `i`.`ndark` AND `i`.`setsale` = 0 AND `u`.`id` = ?i', $slot1, $id, $id, $user['id'], $al, $user['align'], $user['id'])) { $user[$slot1] = $item['id']; + } return true; - } else return false; + } else { + return false; + } } // Входим и выходим если можем. @@ -456,12 +494,14 @@ if (isset($_GET['goto'])) { err('У вас тяжелая травма, вы не можете передвигатся...'); $imove = false; } - if ($_GET['goto'] == 'plo' AND empty($user['zayavka']) AND $imove === true) { + if ($_GET['goto'] == 'plo' && empty($user['zayavka']) && $imove === true) { db::c()->query('UPDATE `users`,`online` SET `users`.`room` = 20,`online`.`room` = 20 WHERE `online`.`id` = `users`.`id` AND `online`.`id` = ?i', $_SESSION['uid']); header('Location: city.php'); die("Топ-топ-топ..."); - } else err('Подали заявку на бой и убегаете из клуба? Нехорошо...'); - if ($_GET['goto'] == 'arena' AND $user['room'] === 20 AND $imove === true) { + } else { + err('Подали заявку на бой и убегаете из клуба? Нехорошо...'); + } + if ($_GET['goto'] == 'arena' && $user['room'] === 20 && $imove === true) { db::c()->query('UPDATE `users`, `online` SET `users`.`room` = 1, `online`.`room` = 1 WHERE `online`.`id` = `users`.`id` AND `online`.`id` = ?i', $_SESSION['uid']); header('Location: main.php'); die("Топ-топ-топ..."); @@ -477,6 +517,7 @@ if (isset($_GET['use'])) { * Отображение персонажа в main.php * * @param $id + * * @throws \Krugozor\Database\Mysql\Exception */ function showpersinv($id) @@ -495,7 +536,7 @@ function showpersinv($id) $dressed[$rec['id']] = $rec; } ?> -
+
@@ -744,7 +785,7 @@ function showpersinv($id)
-
query('UPDATE `users` SET `shadow` = "?s" WHERE `id` = ?i', $i, $user['id']); - } else err('Ошибка!'); + } else { + err('Ошибка!'); + } } $obraz = filter_input(INPUT_GET, 'obraz'); @@ -794,16 +837,12 @@ if ($obraz && ($user['shadow'] == 'g0.gif' || $user['shadow'] == 'man0.gif')) { setShadow($obraz); } -if (isset($_GET['del'])) { - if ($_GET['del'] == 1) { - if ($_GET['efid'] > 0) { - $pl = db::c()->query('SELECT `id`, `type` FROM `effects` WHERE `owner` = ?i AND `id` = ?i', $user['id'], (int)$_GET['efid'])->fetch_assoc(); - if (isset($pl['id'])) { - del_efs($user['id'], $pl['id'], $pl['type']); - } else { - echo 'Эффект не найден ...'; - } - } +if (isset($_GET['del']) && $_GET['del'] == 1 && $_GET['efid'] > 0) { + $pl = db::c()->query('SELECT `id`, `type` FROM `effects` WHERE `owner` = ?i AND `id` = ?i', $user['id'], (int)$_GET['efid'])->fetch_assoc(); + if (isset($pl['id'])) { + del_efs($user['id'], $pl['id'], $pl['type']); + } else { + echo 'Эффект не найден ...'; } } @@ -812,11 +851,9 @@ if (isset($_GET['modif_bron'])) { $brons = $_GET['modif_bron']; $ids = $_GET['ids']; $cur = mysql_fetch_assoc(mysql_query("SELECT `id`, `free_bron`, `bron1`, `bron2`, `bron3`, `bron4` FROM `inventory` WHERE `owner` = '" . $user['id'] . "' AND `id` = '" . mysql_real_escape_string($ids) . "' LIMIT 1")); - if (isset($cur['id'])) { - if ($cur['free_bron'] > 0 && $cur[$brons] > 0) { - mysql_query("UPDATE `inventory` SET `free_bron` = (`free_bron`-1), `" . $brons . "` = (`" . $brons . "`+1) WHERE `owner` = '" . $user['id'] . "' AND `id` = '" . mysql_real_escape_string($ids) . "' LIMIT 1"); - echo "Параметр брони увеличен!"; - } + if (isset($cur['id']) && $cur['free_bron'] > 0 && $cur[$brons] > 0) { + mysql_query("UPDATE `inventory` SET `free_bron` = (`free_bron`-1), `" . $brons . "` = (`" . $brons . "`+1) WHERE `owner` = '" . $user['id'] . "' AND `id` = '" . mysql_real_escape_string($ids) . "' LIMIT 1"); + echo "Параметр брони увеличен!"; } } @@ -824,11 +861,9 @@ if (isset($_GET['modif_stat'])) { $stats = $_GET['modif_stat']; $ids = $_GET['ids']; $cur = mysql_fetch_assoc(mysql_query("SELECT `id`, `free_stat`, `gsila`, `glovk`, `ginta`, `gintel` FROM `inventory` WHERE `owner` = '" . $user['id'] . "' AND `id` = '" . mysql_real_escape_string($ids) . "' LIMIT 1")); - if (isset($cur['id'])) { - if ($cur['free_stat'] > 0 && $cur[$stats] > 0) { - mysql_query("UPDATE `inventory` SET `free_stat` = (`free_stat`-1), `" . $stats . "` = (`" . $stats . "`+1) WHERE `owner` = '" . $user['id'] . "' AND `id` = '" . mysql_real_escape_string($ids) . "' LIMIT 1"); - echo "Параметр увеличен!"; - } + if (isset($cur['id']) && $cur['free_stat'] > 0 && $cur[$stats] > 0) { + mysql_query("UPDATE `inventory` SET `free_stat` = (`free_stat`-1), `" . $stats . "` = (`" . $stats . "`+1) WHERE `owner` = '" . $user['id'] . "' AND `id` = '" . mysql_real_escape_string($ids) . "' LIMIT 1"); + echo "Параметр увеличен!"; } } @@ -836,16 +871,15 @@ if (isset($_GET['modif_mf'])) { $mfs = $_GET['modif_mf']; $ids = $_GET['ids']; $cur = mysql_fetch_assoc(mysql_query("SELECT `id`, `free_mf`, `mfkrit`, `mfakrit`, `mfuvorot`, `mfauvorot` FROM `inventory` WHERE `owner` = '" . $user['id'] . "' AND `id` = '" . mysql_real_escape_string($ids) . "' LIMIT 1")); - if (isset($cur['id'])) { - if ($cur['free_mf'] > 0 && $cur[$mfs] > 0) { - mysql_query("UPDATE `inventory` SET `free_mf` = (`free_mf`-1), `" . $mfs . "` = (`" . $mfs . "`+1) WHERE `owner` = '" . $user['id'] . "' AND `id` = '" . mysql_real_escape_string($ids) . "' LIMIT 1"); - echo "Параметр увеличен!"; - } + if (isset($cur['id']) && $cur['free_mf'] > 0 && $cur[$mfs] > 0) { + mysql_query("UPDATE `inventory` SET `free_mf` = (`free_mf`-1), `" . $mfs . "` = (`" . $mfs . "`+1) WHERE `owner` = '" . $user['id'] . "' AND `id` = '" . mysql_real_escape_string($ids) . "' LIMIT 1"); + echo "Параметр увеличен!"; } } if (input::post('setshadow')) { ?> + @@ -899,9 +933,13 @@ if (input::post('setshadow')) { header("Cache-Control: no-cache"); if (input::get('edit')) { - if (input::get('ups')) addOnePoint(input::get('ups'), 'stat'); + if (input::get('ups')) { + addOnePoint(input::get('ups'), 'stat'); + } - if (input::get('upm')) addOnePoint(input::get('upm'), 'mastery'); + if (input::get('upm')) { + addOnePoint(input::get('upm'), 'mastery'); + } if (input::get('drop')) { dropitem(input::get('drop')); @@ -919,7 +957,9 @@ if (input::get('edit')) { dressitem(input::get('dress')); } updstats(); - } else err('Ошибка: предмет не найден!'); + } else { + err('Ошибка: предмет не найден!'); + } } if (input::get('destruct')) { @@ -930,8 +970,12 @@ if (input::get('edit')) { destructitem($q['id']); addToDelo($user['login'] . " выбросил предмет " . $q['name'] . " id:(cap" . $q['id'] . ")"); err('Предмет ' . $q['name'] . ' выброшен.'); - } else err('Ошибка: нельзя выбросить одетый предмет!'); - } else err('Ошибка: предмет не найден!'); + } else { + err('Ошибка: нельзя выбросить одетый предмет!'); + } + } else { + err('Ошибка: предмет не найден!'); + } } if (input::get('use')) { @@ -944,7 +988,9 @@ if (input::get('edit')) { } else { usemagic($_GET['use'], $_POST['target']); } - } else err('Ошибка: предмет не найден!'); + } else { + err('Ошибка: предмет не найден!'); + } } if (input::get('undress')) { @@ -962,8 +1008,9 @@ if (input::get('edit')) { $q = db::c()->query('SELECT `items` FROM `komplekt` WHERE `name` = "?s" AND `owner` = ?i', input::get('complect'), $_SESSION['uid'])->fetch_assoc(); $items_in_set = []; $items_in_set = explode(';', $q['items']); - foreach ($items_in_set as $iis) + foreach ($items_in_set as $iis) { dressitem($iis); + } db::c()->query('UPDATE `users` SET `hp` = ?i WHERE `id` = ?i', $hp, $_SESSION['uid']); // Если здоровье становится выше максимума - выравниваем: db::c()->query('UPDATE `users` SET `hp` = `maxhp` WHERE `hp` > `maxhp` AND `id` = ?i', $_SESSION['uid']); @@ -983,16 +1030,23 @@ if (input::get('edit')) { $user['helm'], $user['shit'], $user['m1'], $user['m2'], $user['m3'], $user['m4'], $user['m5'], $user['m6'], $user['m7'], $user['m8'], $user['m9'], $user['m10'], $user['boots'], $user['plaw']); - while ($res = $q2->fetch_assoc()) $items[] = $res['id']; + while ($res = $q2->fetch_assoc()) { + $items[] = $res['id']; + } $t_items = implode(";", $items); db::c()->query('INSERT INTO `komplekt` (`name`, `owner`, `items`) VALUES ("?s",?i,"?s")', input::get('savecomplect'), $_SESSION['uid'], $t_items); err('Комплект ' . $name . ' сохранён.'); - } else err('Ошибка: такое название комплекта уже используется!'); - } else err('Ошибка: запрещённые символы!'); + } else { + err('Ошибка: такое название комплекта уже используется!'); + } + } else { + err('Ошибка: запрещённые символы!'); + } } if (!in_array(input::get('mZeAjax'), ['mZeInventory', 'mZeFilter'])): ?> - + + @@ -1064,13 +1118,13 @@ if (input::get('edit')) { switch (ajaxModule) { case'mZeInventory': - $('#mZeInventory').html('
Загрузка...
'); - $.ajax({ - url: $(this).attr('href') + '&mZeAjax=' + ajaxModule, - cache: false, - dataType: 'html', - success: function (html) { - $('#mZeInventory').html(html); + $('#mZeInventory').html('
Загрузка...
'); + $.ajax({ + url: $(this).attr('href') + '&mZeAjax=' + ajaxModule, + cache: false, + dataType: 'html', + success: function (html) { + $('#mZeInventory').html(html); } }); break; @@ -1288,10 +1342,10 @@ if (input::get('edit')) { $bonus['fauvorot'] += round($user['sila'] / 3); $bonus['fakrit'] += round($user['sila'] / 3); } -// if (($user['sila']) >=100) { -// $bonus['uminu'] += round($user['sila'] / 25); -// $bonus['umaxu'] += round($bonus['uminu'] + $user['sila'] / 100); -// } + // if (($user['sila']) >=100) { + // $bonus['uminu'] += round($user['sila'] / 25); + // $bonus['umaxu'] += round($bonus['uminu'] + $user['sila'] / 100); + // } if (($user['lovk']) >= 25) { $bonus['fuvorot'] += round($user['lovk'] / 2); $bonus['fauvorot'] += round($user['lovk'] / 3); @@ -1301,13 +1355,21 @@ if (input::get('edit')) { $bonus['fakrit'] += round($user['inta'] / 3); } - if (($user['sila'] >= 25 || $user['lovk'] >= 25 || $user['inta'] >= 25 || $user['vinos'] >= 25 )) { + if ($user['sila'] >= 25 || $user['lovk'] >= 25 || $user['inta'] >= 25 || $user['vinos'] >= 25) { echo 'Бонусы за статы:
'; - if (!empty($bonus['fkrit'])) echo "Шанс крита: +" . $bonus['fkrit'] . "
"; - if (!empty($bonus['fakrit'])) echo "Шанс антикрита: +" . $bonus['fakrit'] . "
"; - if (!empty($bonus['fuvorot'])) echo "Шанс уворота: +" . $bonus['fuvorot'] . "
"; - if (!empty($bonus['fauvorot'])) echo "Шанс антиуворота: +" . $bonus['fauvorot'] . "
"; - // if (!empty($bonus['uminu'])) echo "Бонус урона: +" . $bonus['uminu'] . "-" . $bonus['umaxu']; + if (!empty($bonus['fkrit'])) { + echo "Шанс крита: +" . $bonus['fkrit'] . "
"; + } + if (!empty($bonus['fakrit'])) { + echo "Шанс антикрита: +" . $bonus['fakrit'] . "
"; + } + if (!empty($bonus['fuvorot'])) { + echo "Шанс уворота: +" . $bonus['fuvorot'] . "
"; + } + if (!empty($bonus['fauvorot'])) { + echo "Шанс антиуворота: +" . $bonus['fauvorot'] . "
"; + } + // if (!empty($bonus['uminu'])) echo "Бонус урона: +" . $bonus['uminu'] . "-" . $bonus['umaxu']; } ?> @@ -1317,7 +1379,7 @@ if (input::get('edit')) {
- + @@ -1598,15 +1666,18 @@ if (input::get('edit')) {
- +
@@ -1472,7 +1536,9 @@ if (input::get('edit')) { $iteminfo = []; #while ($row = $data->fetch_assoc()) showitem($row, null, "edit=1&razdel=$_SESSION[razdel]"); #while ($row = $data->fetch_assoc()) showitem($row); - while ($row = $data->fetch_assoc()) $iteminfo[] = new InventoryItem($row); + while ($row = $data->fetch_assoc()) { + $iteminfo[] = new InventoryItem($row); + } foreach ($iteminfo as $ii) { echo ""; + if ($data->getNumRows() == 0) { + echo ""; + } ?>
">Амуниция
"; @@ -1494,7 +1560,9 @@ if (input::get('edit')) { } } - if ($data->getNumRows() == 0) echo "
Пусто
Пусто
  -
Сейчас в игре: getNumRows() ?> чел.
-
-
-
+
Сейчас в игре: getNumRows() ?> чел.
+ +
+ +
+ +


- +