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 { // встраиваем \Battles\InventoryItem::destroyItem($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; } } } } else { echo "Cвиток рассыпался в ваших руках..."; $bet = 1; $_SESSION['scroll'] = null; } }