38 lines
1.6 KiB
PHP
38 lines
1.6 KiB
PHP
<?php
|
||
// magic идентификацыя
|
||
if ($user['battle'] > 0) {
|
||
echo "Не в бою...";
|
||
} else {
|
||
if ($user['intel'] >= 4) {
|
||
$int = 81 + $user['intel'] - 4;
|
||
if ($int > 100) {
|
||
$int = 100;
|
||
}
|
||
} else {
|
||
$int = 0;
|
||
}
|
||
if (rand(1, 100) < $int) {
|
||
if (empty($_SESSION['uid'])) {
|
||
header("Location: index.php");
|
||
exit;
|
||
}
|
||
|
||
$dress = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE (`name` LIKE '%Топор%' OR `name` LIKE '%Ледокол%' OR `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` = 'Заточка на топоры +4' AND `owner` = '{$user['id']}' LIMIT 1;"));
|
||
|
||
if ($dress && $svitok) {
|
||
if (mysql_query("UPDATE `inventory` SET `sharped` = 1, `name` = CONCAT(`name`,'+4'), `minu` = `minu`+4, `maxu`=`maxu`+4, `cost` = `cost`+24, `ntopor` = `ntopor`+4, `nsila` = `nsila`+4 WHERE `id` = {$dress['id']} LIMIT 1;")) {
|
||
echo "<font color=red><b>Предмет \"{$_POST['target']}\" удачно заточен +4.<b></font> ";
|
||
$bet = 1;
|
||
} else {
|
||
echo "<font color=red><b>Произошла ошибка!<b></font>";
|
||
}
|
||
} else {
|
||
echo "<font color=red><b>Неправильное имя предмета или неправильный свиток<b></font>";
|
||
}
|
||
} else {
|
||
echo "<font color=red><b>Неудачно...<b></font>";
|
||
$bet = 1;
|
||
}
|
||
}
|