From bd14bbffc679d92710ba2dcb2d54946ce955dd86 Mon Sep 17 00:00:00 2001 From: lopar Date: Wed, 12 Dec 2018 01:20:11 +0200 Subject: [PATCH] =?UTF-8?q?=D0=9E=D0=B1=D0=BD=D0=BE=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20=D1=83=D1=81=D1=82=D0=B0=D1=80=D0=B5=D0=B2?= =?UTF-8?q?=D1=88=D0=B5=D0=B3=D0=BE=20=D0=BA=D0=BE=D0=B4=D0=B0=202.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- repair.php | 1007 ++++++++++++++++++++++++++++------------------------ 1 file changed, 540 insertions(+), 467 deletions(-) diff --git a/repair.php b/repair.php index 1313d5d..3e34763 100644 --- a/repair.php +++ b/repair.php @@ -1,509 +1,582 @@ query('SELECT SUM(`massa`) FROM `inventory` WHERE `dressed` = 0 AND `owner` = ?i',$_SESSION['uid'])->fetch_assoc(); -if($user['room'] != 23) { header("Location: main.php"); die(); } -if($user['battle'] != 0) { header('location: fbattle.php'); die(); } +$d = db::c()->query('SELECT SUM(`massa`) FROM `inventory` WHERE `dressed` = 0 AND `owner` = ?i', $_SESSION['uid'])->fetch_assoc(); +if ($user['room'] != 23) { + header("Location: main.php"); + die(); +} +if ($user['battle'] != 0) { + header('location: fbattle.php'); + die(); +} // Гравировка -if(input::post('set') && input::post('count') && ($user['money'] >= 30)) { - if(db::c()->query('UPDATE `inventory` SET `text` = "?s" WHERE `dressed` = 0 AND `setsale` = 0 AND `owner` = ?i AND `id` = ?i',input::post('count'),$_SESSION['uid'],input::post('set'))) - db::c()->query('UPDATE `users` SET `money` = `money` - 30 WHERE `id` = ?i',$_SESSION['uid']); +if (input::post('set') && input::post('count') && ($user['money'] >= 30)) { + if (db::c()->query('UPDATE `inventory` SET `text` = "?s" WHERE `dressed` = 0 AND `setsale` = 0 AND `owner` = ?i AND `id` = ?i', input::post('count'), $_SESSION['uid'], input::post('set'))) + 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['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 = "Недостаточно денег."; - } - } - 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; - } - } +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 = "Недостаточно денег."; + } + } + 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; + } +} ?> - - - - - - + + - - - - - -

Ремонтная мастерская

- -
- - - - - - - - - - - + + +
+ +

Ремонтная мастерская

+ ← выйти из мастерской - - -
- - - - - - - - - - -
Залы:">Ремонт">Гравировка">Перезарядка магии">Модифицирование
-

Если в предмет встроена магия, мы поможем ее перезарядить за умеренную плату. Учтите, ничто не вечно под луной, в том числе и магия, рано или поздно встроенный свиток исчерпает все свои ресурсы, и мы уже не сможем его перезарядить."; break; - case 3: echo "Модификация предметов

Наши мастера помогут вам модифицировать ваши доспехи. К сожалению, технология не позволяет повторно модифицировать вещи. Чем выше у вас интеллект, тем яснее вы сможете объяснить мастерам желаемый результат. Результат может быть непредсказуем!"; break; - } - ?>
-
-
- - "; - showitem ($row); - echo ""; - } -} +
"; - $onecost=0.1; - ?> -
- 0){?>Ремонт 1 ед. за кр.
- =10){?>Ремонт 10 ед. за кр.
- 1){?>Полный ремонт за кр. -
-
+ + + + + - - - - - -$user = mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id` = '{$_SESSION['uid']}' LIMIT 1;")); -?> -
+ + + +
+ + + + + + + + + + + +
Залы:">Ремонт">Гравировка">Перезарядка магии">Модифицирование
+
Если в предмет встроена магия, мы поможем ее перезарядить за умеренную плату. Учтите, ничто не вечно под луной, в том числе и магия, рано или поздно встроенный свиток исчерпает все свои ресурсы, и мы уже не сможем его перезарядить."; + break; + case 3: + echo "Модификация предметов
Наши мастера помогут вам модифицировать ваши доспехи. К сожалению, технология не позволяет повторно модифицировать вещи. Чем выше у вас интеллект, тем яснее вы сможете объяснить мастерам желаемый результат. Результат может быть непредсказуем!"; + break; + } + ?> +
+
+ + "; + showitem($row); + echo ""; + } + } + + if ($_GET['razdel'] == 1) { + $data = mysql_query("SELECT * FROM `inventory` WHERE `owner` = '{$user['id']}' AND `dressed` = 0 AND `type` = 3 AND `name` NOT LIKE '%Букет%' AND `setsale`=0 ORDER by `update` DESC; "); + while ($row = mysql_fetch_array($data)) { + $row['count'] = 1; + if ($i == 0) { + $i = 1; + $color = '#C7C7C7'; + } else { + $i = 0; + $color = '#D5D5D5'; + } + echo " + "; + showitem($row); + echo ""; + } + } + + if ($_GET['razdel'] == 2) { + if ($_GET['it']) { + $row = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `owner` = '{$user['id']}' AND `dressed` = 0 AND `includemagicmax` > 0 AND `id` = '{$_GET['it']}' LIMIT 1;")); + if ($user['money'] < $row['includemagiccost'] && $row['includemagicdex'] == 0) { + $err = "У вас не хватает денег на перезарядку."; + } else { + if ($row['includemagicuses'] <= 1) { + $onecost = $row['includemagiccost']; + $err = "Мы сожалеем, свиток исчерпал все свои ресурсы, и мы уже не можем его перезарядить."; + mysql_query("UPDATE `users` set `money` = `money`- '" . ($row['includemagiccost']) . "' 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'] . ") [" . $newduration . "/" . $row['maxdur'] . "] у \"" . $user['login'] . "\" за " . round($onecost, 2) . " кр. ',1,'" . time() . "');"); + mysql_query("UPDATE `inventory` SET `includemagic` = '', `includemagicdex` = '', `includemagicmax` = '', `includemagicname` = '', `includemagicuses` = '', `includemagiccost` = '' WHERE `id` = '{$_GET['it']}' LIMIT 1;"); + } else { + $onecost = $row['includemagiccost']; + $err = "Магия успешно перезаряжена."; + mysql_query("UPDATE `users` set `money` = `money`- '" . ($row['includemagiccost']) . "' 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'] . ") [" . $newduration . "/" . $row['maxdur'] . "] у \"" . $user['login'] . "\" за " . round($onecost, 2) . " кр. ',1,'" . time() . "');"); + mysql_query("UPDATE `inventory` SET `includemagicdex` = `includemagicmax`, `includemagicuses` = `includemagicuses`-1 WHERE `id` = '{$_GET['it']}' LIMIT 1;"); + } + } + } + + $data = mysql_query("SELECT * FROM `inventory` WHERE `owner` = '{$user['id']}' AND `dressed` = 0 AND `includemagicmax` > 0 AND `setsale`=0 ORDER by `update` DESC; "); + while ($row = mysql_fetch_array($data)) { + $row['count'] = 1; + if ($i == 0) { + $i = 1; + $color = '#C7C7C7'; + } else { + $i = 0; + $color = '#D5D5D5'; + } + echo " + "; + showitem($row); + echo ""; + } + } + + if ($_GET['razdel'] == 3) { + + if ($_GET['mf']) { + $row = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `type` < 12 AND `type` != 3 AND `owner` = '{$_SESSION['uid']}' AND `dressed` = 0 AND `id` = '{$_GET['mf']}' AND `name` NOT LIKE '% (мф)%' LIMIT 1;")); + if ($user['money'] < $row['cost'] OR !$row) { + $err = "У вас не хватает денег на модификацию."; + } else { + srand(make_seed()); + $type = rand(1, 4); + $mfintel = round($user['intel'] / 5 - 10); + if ($mfintel > -1) { + $mfintel = -1; + } + $statintel = round($user['intel'] / 25 - 2); + if ($statintel > -1) { + $statintel = -1; + } + $nstatintel = round(2 - $user['intel'] / 25); + if ($nstatintel < 1) { + $statintel = 1; + } + srand(make_seed()); + $mf1 = rand($mfintel, 10); + srand(make_seed()); + $mf2 = rand($mfintel, 10); + srand(make_seed()); + $st1 = rand($statintel, 2); + srand(make_seed()); + $st2 = rand(-2, $nstatintel); + srand(make_seed()); + $min = rand($statintel, 2); + srand(make_seed()); + $max = rand($statintel, 4); -if ($_GET['razdel']==1) { - $data = mysql_query("SELECT * FROM `inventory` WHERE `owner` = '{$user['id']}' AND `dressed` = 0 AND `type` = 3 AND `name` NOT LIKE '%Букет%' AND `setsale`=0 ORDER by `update` DESC; "); - while($row = mysql_fetch_array($data)) { - $row['count'] = 1; - if ($i==0) { $i = 1; $color = '#C7C7C7';} else { $i = 0; $color = '#D5D5D5'; } - echo " - "; - showitem ($row); - echo ""; - } -} - -if ($_GET['razdel']==2) { - if($_GET['it']) { - $row = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `owner` = '{$user['id']}' AND `dressed` = 0 AND `includemagicmax` > 0 AND `id` = '{$_GET['it']}' LIMIT 1;")); - if($user['money'] < $row['includemagiccost'] && $row['includemagicdex'] ==0) - { - $err= "У вас не хватает денег на перезарядку."; - } - else { - if($row['includemagicuses'] <=1) { - $onecost=$row['includemagiccost']; - $err= "Мы сожалеем, свиток исчерпал все свои ресурсы, и мы уже не можем его перезарядить."; - mysql_query("UPDATE `users` set `money` = `money`- '".($row['includemagiccost'])."' 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'].") [".$newduration."/".$row['maxdur']."] у \"".$user['login']."\" за ".round($onecost,2)." кр. ',1,'".time()."');"); - mysql_query("UPDATE `inventory` SET `includemagic` = '', `includemagicdex` = '', `includemagicmax` = '', `includemagicname` = '', `includemagicuses` = '', `includemagiccost` = '' WHERE `id` = '{$_GET['it']}' LIMIT 1;"); - } else { - $onecost=$row['includemagiccost']; - $err= "Магия успешно перезаряжена."; - mysql_query("UPDATE `users` set `money` = `money`- '".($row['includemagiccost'])."' 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'].") [".$newduration."/".$row['maxdur']."] у \"".$user['login']."\" за ".round($onecost,2)." кр. ',1,'".time()."');"); - mysql_query("UPDATE `inventory` SET `includemagicdex` = `includemagicmax`, `includemagicuses` = `includemagicuses`-1 WHERE `id` = '{$_GET['it']}' LIMIT 1;"); - } - } - } + switch ($type) { + case 1: + // крит + $mfkrit = $mf1; + $mfantiuvorot = $mf2; + $inta = $st1; + $hp = rand(0, 15); + $ninta = $st2; + break; + case 2: + // ловкость + $mfuvorot = $mf1; + $mfantikrit = $mf2; + $lovk = $st1; + $hp = rand(1, 15); + $nlovk = $st2; + break; + case 3: + // сила + $mfminu = $min; + $mfmaxu = $max; + $sila = $st1; + $hp = rand(6, 20); + $nsila = $st2; + $mfantikrit = $mf2; + break; + case 4: + // вынос + $nvinos = $st2; + $mfantikrit = $mf1; + $bron1 = rand(0, 3); + $bron2 = rand(0, 3); + $bron3 = rand(0, 3); + $bron4 = rand(0, 3); + $hp = rand(0, 15); + break; + } - $data = mysql_query("SELECT * FROM `inventory` WHERE `owner` = '{$user['id']}' AND `dressed` = 0 AND `includemagicmax` > 0 AND `setsale`=0 ORDER by `update` DESC; "); - while($row = mysql_fetch_array($data)) { - $row['count'] = 1; - if ($i==0) { $i = 1; $color = '#C7C7C7';} else { $i = 0; $color = '#D5D5D5'; } - echo " - "; - showitem ($row); - echo ""; - } -} -if ($_GET['razdel']==3) { - - if($_GET['mf']) { - $row = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `type` < 12 AND `type` != 3 AND `owner` = '{$_SESSION['uid']}' AND `dressed` = 0 AND `id` = '{$_GET['mf']}' AND `name` NOT LIKE '% (мф)%' LIMIT 1;")); - if($user['money'] < $row['cost'] OR !$row) { - $err= "У вас не хватает денег на модификацию."; - } - else { - srand(make_seed()); - $type = rand(1,4); - $mfintel=round($user['intel']/5-10); - if ($mfintel > -1) {$mfintel = -1;} - $statintel=round($user['intel']/25-2); - if ($statintel > -1) {$statintel = -1;} - $nstatintel=round(2-$user['intel']/25); - if ($nstatintel < 1) {$statintel = 1;} - srand(make_seed()); - $mf1=rand($mfintel,10); - srand(make_seed()); - $mf2=rand($mfintel,10); - srand(make_seed()); - $st1=rand($statintel,2); - srand(make_seed()); - $st2=rand(-2,$nstatintel); - srand(make_seed()); - $min=rand($statintel,2); - srand(make_seed()); - $max=rand($statintel,4); - - - switch ($type) { - case 1: - // крит - $mfkrit = $mf1; - $mfantiuvorot = $mf2; - $inta = $st1; - $hp = rand(0,15); - $ninta = $st2; - break; - case 2: - // ловкость - $mfuvorot = $mf1; - $mfantikrit = $mf2; - $lovk = $st1; - $hp = rand(1,15); - $nlovk = $st2; - break; - case 3: - // сила - $mfminu = $min; - $mfmaxu = $max; - $sila = $st1; - $hp = rand(6,20); - $nsila = $st2; - $mfantikrit = $mf2; - break; - case 4: - // вынос - $nvinos = $st2; - $mfantikrit = $mf1; - $bron1 = rand(0,3); - $bron2 = rand(0,3); - $bron3 = rand(0,3); - $bron4 = rand(0,3); - $hp = rand(0,15); - break; - } - - - if(mysql_query("UPDATE `inventory` SET - `ghp` = `ghp`+'".(int)$hp."', - `bron1` = `bron1`+'".(int)$bron1."', - `bron2` = `bron2`+'".(int)$bron2."', - `bron3` = `bron3`+'".(int)$bron3."', - `bron4` = `bron4`+'".(int)$bron4."', - `mfkrit` = `mfkrit`+'".(int)$mfkrit."', - `mfakrit` = `mfakrit`+'".(int)$mfantikrit."', - `mfuvorot` = `mfuvorot`+'".(int)$mfuvorot."', - `mfauvorot` = `mfauvorot`+'".(int)$mfantiuvorot."', - `gsila` = `gsila`+'".(int)$sila."', - `glovk` = `glovk`+'".(int)$lovk."', - `ginta` = `ginta`+'".(int)$inta."', - `nsila` = `nsila`+'".(int)$nsila."', - `nlovk` = `nlovk`+'".(int)$nlovk."', - `ninta` = `ninta`+'".(int)$ninta."', - `nvinos` = `nvinos`+'".(int)$nvinos."', - `cost` = `cost` + '".round($row['cost']/2)."', + if (mysql_query("UPDATE `inventory` SET + `ghp` = `ghp`+'" . (int)$hp . "', + `bron1` = `bron1`+'" . (int)$bron1 . "', + `bron2` = `bron2`+'" . (int)$bron2 . "', + `bron3` = `bron3`+'" . (int)$bron3 . "', + `bron4` = `bron4`+'" . (int)$bron4 . "', + `mfkrit` = `mfkrit`+'" . (int)$mfkrit . "', + `mfakrit` = `mfakrit`+'" . (int)$mfantikrit . "', + `mfuvorot` = `mfuvorot`+'" . (int)$mfuvorot . "', + `mfauvorot` = `mfauvorot`+'" . (int)$mfantiuvorot . "', + `gsila` = `gsila`+'" . (int)$sila . "', + `glovk` = `glovk`+'" . (int)$lovk . "', + `ginta` = `ginta`+'" . (int)$inta . "', + `nsila` = `nsila`+'" . (int)$nsila . "', + `nlovk` = `nlovk`+'" . (int)$nlovk . "', + `ninta` = `ninta`+'" . (int)$ninta . "', + `nvinos` = `nvinos`+'" . (int)$nvinos . "', + `cost` = `cost` + '" . round($row['cost'] / 2) . "', `name` = CONCAT(`name`, ' (мф)') WHERE `id` = '{$_GET['mf']}' LIMIT 1;")) { - //echo $row['cost']; - mysql_query("UPDATE `users` set `money` = `money`- '".($row['cost'])."' WHERE id = {$_SESSION['uid']}"); - mysql_query("INSERT INTO `delo` (`id` , `author` ,`pers`, `text`, `type`, `date`) VALUES ('','0','{$_SESSION['uid']}','Моцифицирована вещь \"".$row['name']."\" id:(cap".$row['id'].") [".$newduration."/".$row['maxdur']."] у \"".$user['login']."\" за ".round($onecost,2)." кр. ',1,'".time()."');"); - $err= "Вещь модифицирована."; - } + //echo $row['cost']; + mysql_query("UPDATE `users` set `money` = `money`- '" . ($row['cost']) . "' WHERE id = {$_SESSION['uid']}"); + mysql_query("INSERT INTO `delo` (`id` , `author` ,`pers`, `text`, `type`, `date`) VALUES ('','0','{$_SESSION['uid']}','Моцифицирована вещь \"" . $row['name'] . "\" id:(cap" . $row['id'] . ") [" . $newduration . "/" . $row['maxdur'] . "] у \"" . $user['login'] . "\" за " . round($onecost, 2) . " кр. ',1,'" . time() . "');"); + $err = "Вещь модифицирована."; + } + } + } - } - } + $data = mysql_query("SELECT * FROM `inventory` WHERE `type` < 12 AND `type` != 3 AND `owner` = '{$_SESSION['uid']}' AND `dressed` = 0 AND `name` NOT LIKE '% (мф)%' AND `name` NOT LIKE '%Букет%' AND `setsale`=0 ORDER by `update` DESC; "); + while ($row = mysql_fetch_array($data)) { + $row['count'] = 1; + if ($i == 0) { + $i = 1; + $color = '#C7C7C7'; + } else { + $i = 0; + $color = '#D5D5D5'; + } + echo " + "; + showitem($row); + echo ""; + } + } + if ($_GET['razdel'] == 4) { - $data = mysql_query("SELECT * FROM `inventory` WHERE `type` < 12 AND `type` != 3 AND `owner` = '{$_SESSION['uid']}' AND `dressed` = 0 AND `name` NOT LIKE '% (мф)%' AND `name` NOT LIKE '%Букет%' AND `setsale`=0 ORDER by `update` DESC; "); - while($row = mysql_fetch_array($data)) { - $row['count'] = 1; - if ($i==0) { $i = 1; $color = '#C7C7C7';} else { $i = 0; $color = '#D5D5D5'; } - echo " - "; - showitem ($row); - echo ""; - } -} + if ($_GET['podgon']) { + $row = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `type` < 12 AND `type` != 3 AND `owner` = '{$user['id']}' AND `dressed` = 0 AND `id` = '{$_GET['podgon']}' AND `modif`='1' AND `podgon`<'5' LIMIT 1;")); + if ($row['point'] > 0) { + $cost = round(($row['point'] / 2), 0); + } else { + $cost = round(($row['cost'] / 2), 0); + } + if ($user['money'] < $cost || !$row) { + $err = "У вас не хватает денег на подгонку."; + } else { -if ($_GET['razdel']==4) { + $kol_mf = round($row['mfkrit'] + $row['mfakrit'] + $row['mfuvorot'] + $row['mfauvorot'], 0); - if($_GET['podgon']) { - $row = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `type` < 12 AND `type` != 3 AND `owner` = '{$user['id']}' AND `dressed` = 0 AND `id` = '{$_GET['podgon']}' AND `modif`='1' AND `podgon`<'5' LIMIT 1;")); - if($row['point'] > 0) { - $cost = round(($row['point'] / 2),0); - } else { - $cost = round(($row['cost'] / 2),0); - } - - if($user['money'] < $cost || !$row) { - $err= "У вас не хватает денег на подгонку."; - } - else { - - $kol_mf = round($row['mfkrit'] + $row['mfakrit'] + $row['mfuvorot'] + $row['mfauvorot'],0); - - if($row['podgon'] == 0){ - if($row['point'] > 0) { - $new_cena = round(($row['point'] * 20)/100,0); $sql = '`point` = `point`+'.$new_cena; - $user['doblest'] -= $cost; $usql = '`doblest` = "'.$user['doblest'].'"'; $cost_t = 'реп'; - } else { - $new_cena = round(($row['cost'] * 20)/100,0); $sql = '`cost` = `cost`+'.$new_cena; - $user['money'] -= $cost; $usql = '`money` = "'.$user['money'].'"'; $cost_t = 'кр'; - } - $gmf = 2; - }elseif($row['podgon'] == 1){ - if($row['point'] > 0) { - $new_cena = round(($row['point'] * 20)/100,0); $sql = '`point` = `point`+'.$new_cena; - $user['doblest'] -= $cost; $usql = '`doblest` = "'.$user['doblest'].'"'; $cost_t = 'реп'; - } else { - $new_cena = round(($row['cost'] * 20)/100,0); $sql = '`cost` = `cost`+'.$new_cena; - $user['money'] -= $cost; $usql = '`money` = "'.$user['money'].'"'; $cost_t = 'кр'; - } - $gmf = 3; - }elseif($row['podgon'] == 2){ - if($row['point'] > 0) { - $new_cena = round(($row['point'] * 40)/100,0); $sql = '`point` = `point`+'.$new_cena; - $user['doblest'] -= $cost; $usql = '`doblest` = "'.$user['doblest'].'"'; $cost_t = 'реп'; - } else { - $new_cena = round(($row['cost'] * 40)/100,0); $sql = '`cost` = `cost`+'.$new_cena; - $user['money'] -= $cost; $usql = '`money` = "'.$user['money'].'"'; $cost_t = 'кр'; - } - $gmf = 4; - }elseif($row['podgon'] == 3){ - if($row['point'] > 0) { - $new_cena = round(($row['point'] * 70)/100,0); $sql = '`point` = `point`+'.$new_cena; - $user['doblest'] -= $cost; $usql = '`doblest` = "'.$user['doblest'].'"'; $cost_t = 'реп'; - } else { - $new_cena = round(($row['cost'] * 70)/100,0); $sql = '`cost` = `cost`+'.$new_cena; - $user['money'] -= $cost; $usql = '`money` = "'.$user['money'].'"'; $cost_t = 'кр'; - } - $gmf = 6; - }elseif($row['podgon'] == 4){ - if($row['point'] > 0) { - $new_cena = round(($row['point'] * 100)/100,0); $sql = '`point` = `point`+'.$new_cena; - $user['doblest'] -= $cost; $usql = '`doblest` = "'.$user['doblest'].'"'; $cost_t = 'реп'; - } else { - $new_cena = round(($row['cost'] * 100)/100,0); $sql = '`cost` = `cost`+'.$new_cena; - $user['money'] -= $cost; $usql = '`money` = "'.$user['money'].'"'; $cost_t = 'кр'; - } - $gmf = 10; - } - - - - - if($row['mfkrit'] == 0 && $row['mfakrit'] == 0 && $row['mfuvorot'] == 0 && $row['mfauvorot'] == 0){ - $gmf = 0; - } + if ($row['podgon'] == 0) { + if ($row['point'] > 0) { + $new_cena = round(($row['point'] * 20) / 100, 0); + $sql = '`point` = `point`+' . $new_cena; + $user['doblest'] -= $cost; + $usql = '`doblest` = "' . $user['doblest'] . '"'; + $cost_t = 'реп'; + } else { + $new_cena = round(($row['cost'] * 20) / 100, 0); + $sql = '`cost` = `cost`+' . $new_cena; + $user['money'] -= $cost; + $usql = '`money` = "' . $user['money'] . '"'; + $cost_t = 'кр'; + } + $gmf = 2; + } elseif ($row['podgon'] == 1) { + if ($row['point'] > 0) { + $new_cena = round(($row['point'] * 20) / 100, 0); + $sql = '`point` = `point`+' . $new_cena; + $user['doblest'] -= $cost; + $usql = '`doblest` = "' . $user['doblest'] . '"'; + $cost_t = 'реп'; + } else { + $new_cena = round(($row['cost'] * 20) / 100, 0); + $sql = '`cost` = `cost`+' . $new_cena; + $user['money'] -= $cost; + $usql = '`money` = "' . $user['money'] . '"'; + $cost_t = 'кр'; + } + $gmf = 3; + } elseif ($row['podgon'] == 2) { + if ($row['point'] > 0) { + $new_cena = round(($row['point'] * 40) / 100, 0); + $sql = '`point` = `point`+' . $new_cena; + $user['doblest'] -= $cost; + $usql = '`doblest` = "' . $user['doblest'] . '"'; + $cost_t = 'реп'; + } else { + $new_cena = round(($row['cost'] * 40) / 100, 0); + $sql = '`cost` = `cost`+' . $new_cena; + $user['money'] -= $cost; + $usql = '`money` = "' . $user['money'] . '"'; + $cost_t = 'кр'; + } + $gmf = 4; + } elseif ($row['podgon'] == 3) { + if ($row['point'] > 0) { + $new_cena = round(($row['point'] * 70) / 100, 0); + $sql = '`point` = `point`+' . $new_cena; + $user['doblest'] -= $cost; + $usql = '`doblest` = "' . $user['doblest'] . '"'; + $cost_t = 'реп'; + } else { + $new_cena = round(($row['cost'] * 70) / 100, 0); + $sql = '`cost` = `cost`+' . $new_cena; + $user['money'] -= $cost; + $usql = '`money` = "' . $user['money'] . '"'; + $cost_t = 'кр'; + } + $gmf = 6; + } elseif ($row['podgon'] == 4) { + if ($row['point'] > 0) { + $new_cena = round(($row['point'] * 100) / 100, 0); + $sql = '`point` = `point`+' . $new_cena; + $user['doblest'] -= $cost; + $usql = '`doblest` = "' . $user['doblest'] . '"'; + $cost_t = 'реп'; + } else { + $new_cena = round(($row['cost'] * 100) / 100, 0); + $sql = '`cost` = `cost`+' . $new_cena; + $user['money'] -= $cost; + $usql = '`money` = "' . $user['money'] . '"'; + $cost_t = 'кр'; + } + $gmf = 10; + } - if(mysql_query("UPDATE `inventory` SET - `free_mf` = `free_mf`+'".(int)$gmf."', + if ($row['mfkrit'] == 0 && $row['mfakrit'] == 0 && $row['mfuvorot'] == 0 && $row['mfauvorot'] == 0) { + $gmf = 0; + } + + if (mysql_query("UPDATE `inventory` SET + `free_mf` = `free_mf`+'" . (int)$gmf . "', $sql, `podgon`=`podgon`+'1' WHERE `id` = '{$_GET['podgon']}' LIMIT 1")) { - mysql_query("UPDATE `users` set $usql WHERE id = {$user['id']}"); - - 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($cost, 2)." ".$cost_t.". ',1,'".time()."');"); - $err= "Вещь подогнана."; - } + mysql_query("UPDATE `users` set $usql WHERE id = {$user['id']}"); - } - } + 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($cost, 2) . " " . $cost_t . ". ',1,'" . time() . "');"); + $err = "Вещь подогнана."; + } + } + } + $data = mysql_query("SELECT * FROM `inventory` WHERE `type` < 12 AND `type` != 3 AND `owner` = '{$user['id']}' AND `dressed` = 0 AND `modif`='1' AND `podgon`<'5' AND `name` NOT LIKE '%Букет%' AND `setsale`=0 ORDER by `update` DESC; "); + while ($row = mysql_fetch_array($data)) { + $row['count'] = 1; + if ($i == 0) { + $i = 1; + $color = '#C7C7C7'; + } else { + $i = 0; + $color = '#D5D5D5'; + } + echo " + "; + showitem($row); + echo ""; + } + } - $data = mysql_query("SELECT * FROM `inventory` WHERE `type` < 12 AND `type` != 3 AND `owner` = '{$user['id']}' AND `dressed` = 0 AND `modif`='1' AND `podgon`<'5' AND `name` NOT LIKE '%Букет%' AND `setsale`=0 ORDER by `update` DESC; "); - while($row = mysql_fetch_array($data)) { - $row['count'] = 1; - if ($i==0) { $i = 1; $color = '#C7C7C7';} else { $i = 0; $color = '#D5D5D5'; } - echo " - "; - showitem ($row); - echo ""; - } -} + ?> +
"; + $onecost = 0.1; + ?> +
+ + 0) { ?>Ремонт 1 ед. + за кр.
+ = 10) { ?>Ремонт 10 + ед. за кр.
+ 1) { ?>Полный + ремонт за кр. +
+
"; + ?> +
+ + + Нанести надпись за 30 кр.
Стереть надпись
+
+
"; + ?> +
+ + Перезарядить + за кр.
+
+
"; - ?> -
- Нанести надпись за 30 кр.
Стереть надпись
-
-
"; - ?> -
- - Перезарядить за кр.
-
-
"; + ?> +
+ + Модифицировать + за кр.
+
+
"; - ?> -
- Модифицировать за кр.
-
-
"; + ?> +
+ + 0) { + $babki = round(($row['point'] / 2), 0); + $cost_t = 'Реп'; + } else { + $babki = round(($row['cost'] / 2), 0); + $cost_t = 'Кр'; + } + ?> + Подогнать + за .
+
+
"; - ?> -
- 0) { - $babki = round(($row['point'] / 2),0); $cost_t = 'Реп'; - } else { - $babki = round(($row['cost'] / 2),0); $cost_t = 'Кр'; - } - ?> - Подогнать за .
-
-
+
- -
-
-
Масса всех ваших вещей: - - /
- У вас в наличии: кр.
-
- -
+
Масса всех ваших вещей: / +
У вас в наличии: кр. +
+
-
+ + \ No newline at end of file