From 68153e17763d8b0ade369b0b6a42416945b17791 Mon Sep 17 00:00:00 2001 From: "Igor Barkov (iwork)" Date: Tue, 24 Sep 2019 16:27:46 +0300 Subject: [PATCH] =?UTF-8?q?addzayavka()=20=D1=80=D0=B0=D0=B1=D0=BE=D1=82?= =?UTF-8?q?=D0=B0=D0=BB=D0=B0=20=D1=81=20=D0=BD=D0=B5=D1=81=D1=83=D1=89?= =?UTF-8?q?=D0=B5=D1=81=D1=82=D0=B2=D1=83=D1=8E=D1=89=D0=B8=D0=BC=D0=B8=20?= =?UTF-8?q?=D0=BF=D0=B0=D1=80=D0=B0=D0=BC=D0=B5=D1=82=D1=80=D0=B0=D0=BC?= =?UTF-8?q?=D0=B8.=20=D0=A2=D0=B5=D0=BF=D0=B5=D1=80=D1=8C=20=D1=82=D1=80?= =?UTF-8?q?=D0=B0=D0=B2=D0=BC=D0=B8=D1=80=D0=BE=D0=B2=D0=B0=D0=BD=D0=BD?= =?UTF-8?q?=D1=8B=D0=BC=20=D0=BC=D0=BE=D0=B6=D0=BD=D0=BE=20=D0=B4=D1=80?= =?UTF-8?q?=D0=B0=D1=82=D1=8C=D1=81=D1=8F.=20=D0=94=D0=BE=D0=B1=D0=B0?= =?UTF-8?q?=D0=B2=D0=BB=D0=B5=D0=BD=D1=8B=20=D0=BC=D0=B8=D0=BD=D1=83=D1=82?= =?UTF-8?q?=D0=BD=D1=8B=D0=B5=20=D1=82=D0=B0=D0=B9=D0=BC=D0=B5=D1=80=D1=8B?= =?UTF-8?q?.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- zayavka.php | 72 +++++++++++++++++++---------------------------------- 1 file changed, 26 insertions(+), 46 deletions(-) diff --git a/zayavka.php b/zayavka.php index 81091cf..ccacb0c 100644 --- a/zayavka.php +++ b/zayavka.php @@ -159,38 +159,20 @@ class zayavka } else return 'delteam(): database error!'; } - function addzayavka($start, $timeout, $t1c, $t2c, $type, $t1min, $t2min, $t1max, $t2max, $coment, $creator, $level, $stavka, $blood = 0) + function addzayavka($start, $timeout, $t1c, $t2c, $type, $t1min, $t2min, $t1max, $t2max, $coment, $level, $blood = 0) { global $user; - if (!in_array($level, [2, 4, 5])) { - $level = 1; - } else return "Ошибка!"; + if (!in_array($level, [2, 4, 5])) $level = 4; /*2-физ, 4-группа, 5-хаос*/ - if ($level == 1 AND $type != 1 AND $type != 4) $type = 1; if ($level == 2 AND $type != 1 AND $type != 4 AND $type != 6) $type = 1; if ($level == 4 AND $type != 2 AND $type != 4) $type = 2; if ($level == 5 AND $type != 3 AND $type != 5) $type = 3; -// Level 3? Что это? Где это? - if (!in_array($start, [3, 5, 10, 15, 30, 45, 60])) $start = 10; - if (!in_array($timeout, [3, 4, 5, 7, 10])) $timeout = 3; + if (!in_array($start, [1, 3, 5, 10, 15, 30, 60])) $start = 1; + if (!in_array($timeout, [1, 3, 5, 10])) $timeout = 1; - if ($this->user_status($creator) != 0) { - exit(); - } - - $owntravma = db::c()->query('SELECT `type` FROM `effects` WHERE `owner` = ?i AND (`type` = 12 OR `type` = 13)', $creator)->fetch_assoc(); - if ($owntravma) { - switch ($owntravma['type']) { - case ($owntravma['type'] == 12 && ($type != 4 && $type != 5)): - return "У Вас средняя травма, поединки с оружием слишком тяжелы для Вас..."; - break; - case 13: - return "У Вас тяжелая травма, Вы не сможети драться..."; - break; - } - } + if ($this->user_status($user['id']) != 0) exit(); if (!$user['klan'] && $t1min == 99) { return "Вы не состоите в клане."; @@ -204,13 +186,12 @@ class zayavka } $start = time() + $start * 60; - $stavka = round($stavka, 2); db::c()->query('INSERT INTO `zayavka` - (`start`, `timeout`, `t1c`, `t2c`, `type`, `level`, `coment`, `team1`, `stavka`, `t1min`, `t2min`, `t1max`, `t2max`,`podan`,`blood`) + (`start`, `timeout`, `t1c`, `t2c`, `type`, `level`, `coment`, `team1`, `t1min`, `t2min`, `t1max`, `t2max`,`podan`,`blood`) VALUES (?i,?i,?i,?i,?i,?i,"?s","?s",?d,?i,?i,?i,?i,"?s",?i)', - $start, $timeout, $t1c, $t2c, $type, $level, $coment, $creator, $stavka, $t1min, $t2min, $t1max, $t2max, date('H:i'), $blood); - db::c()->query('UPDATE `users` SET `zayavka` = ?i WHERE `id` = ?i', db::c()->getLastInsertId(), $creator); + $start, $timeout, $t1c, $t2c, $type, $level, $coment, $user['id'], $t1min, $t2min, $t1max, $t2max, date('H:i'), $blood); + db::c()->query('UPDATE `users` SET `zayavka` = ?i WHERE `id` = ?i', db::c()->getLastInsertId(), $user['id']); return null; } @@ -660,7 +641,7 @@ if (!empty($_POST['open'])) { } else { $blood = 0; } - echo $zay->addzayavka(0, $_POST['timeout'], 1, 1, $_POST['k'], $user['level'], 1, $user['level'], 21, '', $user['id'], 2, 0, $blood); + echo $zay->addzayavka(0, $_POST['timeout'], 1, 1, $_POST['k'], $user['level'], 1, $user['level'], 21, '', 2, $blood); die(""); } if (!empty($_POST['back'])) { @@ -696,10 +677,9 @@ if (!empty($_POST['open'])) { Подать заявку на бой Таймаут Тип боя @@ -789,17 +769,15 @@ if (!empty($_POST['open'])) {

Подать заявку на групповой бой

Начало боя через     Таймаут @@ -896,15 +874,15 @@ if (!empty($_POST['open']) AND empty($user['zayavka'])) { //print_r($_REQUEST); switch ($_POST['levellogin1']) { case 0 : //любой - $min1 = 2; + $min1 = 0; $max1 = 21; break; case 1 : //только моего и ниже - $min1 = 2; + $min1 = 0; $max1 = $user['level']; break; case 2 : //только ниже моего уровня - $min1 = 2; + $min1 = 0; $max1 = $user['level'] - 1; break; case 3 : //только моего уровня @@ -930,15 +908,15 @@ if (!empty($_POST['open']) AND empty($user['zayavka'])) { } switch ($_POST['levellogin2']) { case 0 : //любой - $min1 = 2; + $min1 = 0; $max1 = 21; break; case 1 : //только моего и ниже - $min1 = 2; + $min1 = 0; $max1 = $user['level']; break; case 2 : //только ниже моего уровня - $min1 = 2; + $min1 = 0; $max1 = $user['level'] - 1; break; case 3 : //только моего уровня @@ -962,6 +940,8 @@ if (!empty($_POST['open']) AND empty($user['zayavka'])) { $max1 = 99; break; } + if ($min1 < 0) $min1 = 0; + if ($max1 < 0) $max1 = 0; if ($_POST['k']) { $_POST['k'] = 4; } else { @@ -975,7 +955,7 @@ if (!empty($_POST['open']) AND empty($user['zayavka'])) { if ($_POST['nlogin1'] == 1 && $_POST['nlogin2'] == 1) { echo "Не надо превращать групповой бой в физический поединок"; } else { - echo $zay->addzayavka($_POST['startime'] / 60, $_POST['timeout'], $_POST['nlogin1'], $_POST['nlogin2'], $_POST['k'], $min1, $min2, $max1, $max2, $_POST['cmt'], $user['id'], 4, 0, $blood); + echo $zay->addzayavka($_POST['startime'] / 60, $_POST['timeout'], $_POST['nlogin1'], $_POST['nlogin2'], $_POST['k'], $min1, $min2, $max1, $max2, $_POST['cmt'], 4, $blood); } } ///////////////////////////////// @@ -1022,7 +1002,7 @@ if ($get == 'haos') { if ($_POST['travma']) { $blood = 1; } - echo $zay->addzayavka($_POST['startime2'] / 60, $_POST['timeout'], 99, 99, $_POST['k'], $min1, $min1, $max1, $max1, $_POST['cmt'], $user['id'], 5, 0, $blood); + echo $zay->addzayavka($_POST['startime2'] / 60, $_POST['timeout'], 99, 99, $_POST['k'], $min1, $min1, $max1, $max1, $_POST['cmt'], 5, $blood); } if (!empty($_POST['confirm2'])) { echo "" . $zay->addteam(1, 5) . "";