From 7c636c0e3fe5f2737ef23b19070f2b4b4be3f664 Mon Sep 17 00:00:00 2001 From: "Igor Barkov [iwork]" Date: Wed, 12 Dec 2018 15:26:18 +0200 Subject: [PATCH] =?UTF-8?q?=D0=A7=D0=B0=D1=81=D1=82=D0=B8=D1=87=D0=BD?= =?UTF-8?q?=D1=8B=D0=B9=20=D1=80=D0=B5=D0=BC=D0=BE=D0=BD=D1=82=20=D1=8D?= =?UTF-8?q?=D1=82=D0=BE=20=D0=BD=D0=B5=D1=81=D0=B5=D1=80=D1=8C=D1=91=D0=B7?= =?UTF-8?q?=D0=BD=D0=BE.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- repair.php | 100 +++++++++++++---------------------------------------- 1 file changed, 24 insertions(+), 76 deletions(-) diff --git a/repair.php b/repair.php index 4a6de3b..6fb7643 100644 --- a/repair.php +++ b/repair.php @@ -18,80 +18,33 @@ if (input::post('set') && input::post('count') && ($user['money'] >= 30)) { db::c()->query('UPDATE `users` SET `money` = `money` - 30 WHERE `id` = ?i', $_SESSION['uid']); } +// Снять гравировку if ($_GET['rep'] && ($_GET['sid'] == 2)) { mysql_query("UPDATE `inventory` SET `text` = '' WHERE `owner` = '{$user['id']}' AND `dressed` = 0 AND `id` = '" . (int)$_GET['rep'] . "' LIMIT 1"); } +// Полный ремонт if ($_GET['sid'] && $_GET['rep']) { - switch ($_GET['sid']) { - case 1: - $row = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `type` < 12 AND `isrep` = 1 AND `owner` = '{$user['id']}' AND `dressed` = 0 AND `id` = '" . (int)$_GET['rep'] . "' LIMIT 1")); - if ($row['duration'] > 0) { - $onecost = 0.1; - if ($onecost <= $user['money']) { - if (mysql_query("UPDATE `inventory` SET `duration` = `duration`-1 WHERE `id` = '" . (int)$_GET['rep'] . "' LIMIT 1")) { - $err = "Произведен ремонт предмета \"{$row['name']}\" за " . round($onecost, 2) . " кр. "; - $user['money'] -= round($onecost, 2); - mysql_query("UPDATE `users` SET `money` = '" . $user['money'] . "' WHERE `id` = {$user['id']} LIMIT 1"); - $newduration = $row['duration'] - 1; - mysql_query("INSERT INTO `delo` (`author`, `pers`, `text`, `type`, `date`) VALUES ('0', '{$user['id']}', 'Отремонтирован предмет \"" . $row['name'] . "\" id:(cap" . $row['id'] . ") [" . $newduration . "/" . $row['maxdur'] . "] у \"" . $user['login'] . "\" за " . round($onecost, 2) . " кр. ',1,'" . time() . "')"); - if (rand(1, 10) == 1) { - $err .= "К сожалению максимальная долговечность предмета из-за ремонта уменьшилась."; - mysql_query("UPDATE `inventory` SET `maxdur` = `maxdur`-1 WHERE `id` = '" . (int)$_GET['rep'] . "' LIMIT 1"); - } - } - } else { - $err = "Недостаточно денег."; + $row = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `isrep` = 1 AND `owner` = '{$user['id']}' AND `dressed` = 0 AND `id` = '{$_GET['rep']}' AND `setsale`=0 LIMIT 1;")); + $full = $row['duration']; + if ($row['duration'] > 1) { + //$onecost=$row['cost']/($row['maxdur']*10); + //if($onecost < 0.1) {$onecost=0.1;} + $onecost = 0.1; + if (round($onecost * $full) <= $user['money']) { + if (mysql_query("UPDATE `inventory` SET `duration` = '0' WHERE `id` = {$_GET['rep']}")) { + $err = "Произведен ремонт предмета \"{$row['name']}\" за " . (round($onecost, 2) * $full) . " кр. "; + mysql_query("UPDATE `users` set `money` = `money`- '" . (round($onecost, 2) * $full) . "' WHERE id = {$user['id']}"); + mysql_query("INSERT INTO `delo` (`id` , `author` ,`pers`, `text`, `type`, `date`) VALUES ('','0','{$user['id']}','Отремонтирован предмет \"" . $row['name'] . "\" id:(cap" . $row['id'] . ") [0/" . $row['maxdur'] . "] у \"" . $user['login'] . "\" за " . (round($onecost, 2) * $full) . " кр. ',1,'" . time() . "');"); + $user['money'] = $user['money'] - (round($onecost, 2) * $full); + if (rand(1, 5) == 1) { + $err .= "К сожалению максимальная долговечность предмета из-за ремонта уменьшилась."; + mysql_query("UPDATE `inventory` SET `maxdur` = `maxdur`-1 WHERE `id` = {$_GET['rep']}"); } } - break; - case 10: - $row = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `isrep` = 1 AND `owner` = '{$user['id']}' AND `dressed` = 0 AND `id` = '{$_GET['rep']}' LIMIT 1;")); - if ($row['duration'] >= 10) { - //$onecost=$row['cost']/($row['maxdur']*10); - //if($onecost < 0.1) {$onecost=0.1;} - $onecost = 0.1; - if (($onecost * 10) <= $user['money']) { - - if (mysql_query("UPDATE `inventory` SET `duration` = `duration`-10 WHERE `id` = {$_GET['rep']}")) { - $err = "Произведен ремонт предмета \"{$row['name']}\" за " . (round($onecost, 2) * 10) . " кр. "; - mysql_query("UPDATE `users` set `money` = `money`- '" . (round($onecost, 2) * 10) . "' WHERE id = {$user['id']}"); - $newduration = $row['duration'] - 10; - mysql_query("INSERT INTO `delo` (`id` , `author` ,`pers`, `text`, `type`, `date`) VALUES ('','0','{$user['id']}','Отремонтирован предмет \"" . $row['name'] . "\" id:(cap" . $row['id'] . ") [" . $newduration . "/" . $row['maxdur'] . "] у \"" . $user['login'] . "\" за " . (round($onecost, 2) * 10) . " кр. ',1,'" . time() . "');"); - $user['money'] = $user['money'] - (round($onecost, 2) * 10); - if (rand(1, 7) == 1) { - $err .= "К сожалению максимальная долговечность предмета из-за ремонта уменьшилась."; - mysql_query("UPDATE `inventory` SET `maxdur` = `maxdur`-1 WHERE `id` = {$_GET['rep']}"); - } - } - } else { - $err = "Недостаточно денег."; - } - } - break; - case 'full': - $row = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `isrep` = 1 AND `owner` = '{$user['id']}' AND `dressed` = 0 AND `id` = '{$_GET['rep']}' AND `setsale`=0 LIMIT 1;")); - $full = $row['duration']; - if ($row['duration'] > 1) { - //$onecost=$row['cost']/($row['maxdur']*10); - //if($onecost < 0.1) {$onecost=0.1;} - $onecost = 0.1; - if (round($onecost * $full) <= $user['money']) { - if (mysql_query("UPDATE `inventory` SET `duration` = '0' WHERE `id` = {$_GET['rep']}")) { - $err = "Произведен ремонт предмета \"{$row['name']}\" за " . (round($onecost, 2) * $full) . " кр. "; - mysql_query("UPDATE `users` set `money` = `money`- '" . (round($onecost, 2) * $full) . "' WHERE id = {$user['id']}"); - mysql_query("INSERT INTO `delo` (`id` , `author` ,`pers`, `text`, `type`, `date`) VALUES ('','0','{$user['id']}','Отремонтирован предмет \"" . $row['name'] . "\" id:(cap" . $row['id'] . ") [0/" . $row['maxdur'] . "] у \"" . $user['login'] . "\" за " . (round($onecost, 2) * $full) . " кр. ',1,'" . time() . "');"); - $user['money'] = $user['money'] - (round($onecost, 2) * $full); - if (rand(1, 5) == 1) { - $err .= "К сожалению максимальная долговечность предмета из-за ремонта уменьшилась."; - mysql_query("UPDATE `inventory` SET `maxdur` = `maxdur`-1 WHERE `id` = {$_GET['rep']}"); - } - } - } else { - $err = "Недостаточно денег."; - } - } - break; + } else { + $err = "Недостаточно денег."; + } } } ?> @@ -109,7 +62,7 @@ if ($_GET['sid'] && $_GET['rep']) { Кредиты Масса вещей - + @@ -166,16 +119,11 @@ if ($_GET['sid'] && $_GET['rep']) {

- 0) { ?>Ремонт 1 ед. - за кр.
0) { ?> + Ремонт + за кр.
- = 10) { ?>Ремонт 10 - ед. за кр.
- 1) { ?>Полный - ремонт за кр.