0) { echo "Не в бою..."; } else { if ($user['intel'] >= 17) { $int=80 + $user['intel'] - 17; if ($int>100){$int=100;} } else {$int=0;} if (rand(1,100) <= $int OR !$_SESSION['scroll']) { if(!$_SESSION['scroll']) { $_SESSION['scroll'] = $_POST['target']; ?>
} else { $svitok = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `name` = '".$_SESSION['scroll']."' AND `owner` = '{$user['id']}' AND `dressed`=0 LIMIT 1;")); $dress = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `owner` = '{$user['id']}' AND `name` LIKE '{$_POST['target']}' AND `includemagic` = 0 AND `dressed`=0 LIMIT 1;")); //echo "SELECT * FROM `inventory` WHERE `owner` = '{$user['id']}' AND `name` LIKE '{$_REQUEST['target']}' AND `includemagic` = 0 LIMIT 1;"; $_SESSION['scroll'] = null; if(!$svitok){ echo "У вас нет такого свитка!"; }elseif(!$dress OR $dress['type'] >= 12){ echo "У вас нет такого предмета!"; }else { $incmagic = mysql_fetch_array(mysql_query("SELECT * FROM `magic` WHERE `id` = '{$svitok['magic']}' LIMIT 1;")); if((!$incmagic['img'])||in_array($svitok['magic'],$forbidden)) { echo "Этот свиток нельзя встраивать в предметы!"; } else { // встраиваем destructitem($svitok['id']); echo "Свиток \"".$svitok['name']."\" удачно встроен в \"".$dress['name']."\""; mysql_query("UPDATE `inventory` SET ".($dress['nintel']<$svitok['nintel']?"`nintel`='".$svitok['nintel']."',":"")." ".($dress['nlevel']<$svitok['nlevel']?"`nlevel`='".$svitok['nlevel']."',":"")." ".($dress['nmudra']<$svitok['nmudra']?"`nmudra`='".$svitok['nmudra']."',":"")." ".($dress['ngray']<$svitok['ngray']?"`ngray`='".$svitok['ngray']."',":"")." ".($dress['ndark']<$svitok['ndark']?"`ndark`='".$svitok['ndark']."',":"")." ".($dress['nlight']<$svitok['nlight']?"`nlevel`='".$svitok['nlight']."',":"")." `massa`=`massa`+1,`cost`=`cost`+'".$svitok['cost']."', `includemagic` = '".$svitok['magic']."', `includemagicdex` = '".$svitok['maxdur']."', `includemagicmax` = '".$svitok['maxdur']."', `includemagicname` = '".$svitok['name']."', `includemagicuses` = '100+".$user['intel']."', `includemagiccost` = '".($svitok['cost']/2)."' WHERE `id` = '{$dress['id']}' LIMIT 1;"); $bet=1; } } } //$dress = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `name` LIKE '%Топор%' AND `owner` = '{$user['id']}' AND `name` = '{$_POST['target']}' AND `sharped` = 0 LIMIT 1;")); //$svitok = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `name` = 'Заточка на топоры +1' AND `owner` = '{$user['id']}' LIMIT 1;")); /*if ($dress && $svitok) { if (mysql_query("UPDATE `inventory` SET `sharped` = 1, `name` = CONCAT(`name`,'+1'), `minu` = `minu`+1, `maxu`=`maxu`+1, `cost` = `cost`+6, `ntopor` = `ntopor`+1, `nsila` = `nsila`+1 WHERE `id` = {$dress['id']} LIMIT 1;")) { echo "Предмет \"{$_POST['target']}\" удачно заточен +1. "; $bet=1; } else { echo "Произошла ошибка!"; } } else { echo "Неправильное имя предмета или неправильный свиток"; }*/ } else { echo "Cвиток рассыпался в ваших руках..."; $bet=1; $_SESSION['scroll'] = null; } } ?>