Файл: l2ps_v5/blessedscroll.php
Строк: 1150
<?php
include_once("files/zag.php");
include_once("files/ini.php");
$polz=mysql_query("SELECT * FROM `users` WHERE `udata0`='$log' AND `udata1`='$pas' LIMIT 1");
if(mysql_num_rows($polz)==0){
header ("Location: index.php?error");
echo'<div class="p">Ошибка! Пользователь с таким логином и паролем не зарегистрирован, или пароль/логин неверен! <a href="index.php">На главную</a><br>';exit;
}else{
include_once"files/up.php";
switch($go) {
default:
echo"Заточка вещи<br><br>
1 использование Блессед свитка равно 1 заточке.</br>
1 заточка = +2 атаки/защиты.</br>
Безопасная заточка до 4 включительно. </br>
При заточке более 4 раз вещь может потерять заточки.</br>
Затачивается одетая вещь.</br>";
echo "<br><a href="blessedscroll.php?go=default">Продолжить</a><br>";
break;
case 'gloves':
$namee=explode("*",$udata46);
$req1 = mysql_query("SELECT * FROM `armor` WHERE `name`='".$namee[0]."' LIMIT 1");
$re1 = mysql_num_rows($req1);
if($re1==0){echo"Ничего не происходит. Скорее всего ваша вещь уникальна и заточить её таким образом нельзя!"; include_once"files/down.php"; exit; }
if($udata46=="Пусто"){echo"<small>Ошибка!</small>"; include_once"files/down.php"; exit; }
$qi = mysql_query("SELECT * from `armor_item` WHERE `login`='".$log."' and `name`='".$udata46."' LIMIT 1 ");
while($row=mysql_fetch_array($qi)){
$elita=mysql_query("SELECT * from `item` WHERE `uda7`='".$log."' and `uda4`='Blessed Scroll: Armor' and `uda3`>='1' and `uda6`='$row[crystal_type]'");
if(mysql_num_rows($elita)==0){
echo'Нет свитка.<br/>';
echo"<a href="home.php?">Назад</a>";
include('files/down.php');exit;
}
$req = mysql_query("SELECT `uda3` FROM `item` WHERE `uda7`='".$log."' and `uda4`='Blessed Scroll: Armor' and `uda3`>='1' and `uda6`='$row[crystal_type]' LIMIT 1");
$re = mysql_fetch_array($req);
if(($re[uda3]-1)==0){
mysql_query("DELETE FROM `item` WHERE `uda7`='".$log."' and `uda4`='Blessed Scroll: Armor' and `uda6`='$row[crystal_type]' LIMIT 1");//чистим логи
}else{
$re[uda3]=$re[uda3]-1;
mysql_query("UPDATE `item` SET `uda3` = '$re[uda3]' WHERE `uda7`='".$log."' and `uda4`='Blessed Scroll: Armor' and `uda6`='$row[crystal_type]' LIMIT 1");
}
if($vid=="fiz"){
$namee=explode("*",$udata46);
if($namee[1]<=4){
if(empty($namee[1])){
$nam="$namee[0]*1";
}else{
$kol=$namee[1]+1;
$nam="$namee[0]*$kol";}
$udata3=$udata3+2;
$row[p_def]=$row[p_def]+2;
mysql_query("UPDATE `armor_item` SET `name`='$nam' WHERE `login`='$log' and `name`='$udata46' LIMIT 1 ");
mysql_query("UPDATE `armor_item` SET `p_def`='$row[p_def]' WHERE `login`='$log' and `name`='$nam' LIMIT 1 ");
mysql_query("UPDATE `users` SET `udata3`='$udata3' WHERE `udata0`='$log'");
mysql_query("UPDATE `users` SET `udata46`='$nam' WHERE `udata0`='$log'");
echo"Заточено";
}else
if($namee[1]>4){
$rand=rand(1,5);
if($rand!==5 and $rand!==3){
if(empty($namee[1])){
$nam="$namee[0]*1";
}else{
$kol=$namee[1]+1;
$nam="$namee[0]*$kol";}
$udata3=$udata3+2;
$row[p_def]=$row[p_def]+2;
mysql_query("UPDATE `armor_item` SET `name`='$nam' WHERE `login`='$log' and `name`='$udata46' LIMIT 1 ");
mysql_query("UPDATE `armor_item` SET `p_def`='$row[p_def]' WHERE `login`='$log' and `name`='$nam' LIMIT 1 ");
mysql_query("UPDATE `users` SET `udata3`='$udata3' WHERE `udata0`='$log'");
mysql_query("UPDATE `users` SET `udata46`='$nam' WHERE `udata0`='$log'");
echo"Заточено";
}else{
$namee=explode("*",$udata46);
$req1 = mysql_query("SELECT * FROM `armor` WHERE `name`='".$namee[0]."' LIMIT 1");
$re1 = mysql_num_rows($req1);
$re2 = mysql_fetch_array($req1);
$sila=$udata3-$row[p_def];
$udata3=$sila+$re2[p_def];
$sila1=$udata82-$row[m_def];
$udata82=$sila1+$re2[m_def];
mysql_query("UPDATE `users` SET `udata3`='$udata3', `udata82`='$udata82' WHERE `udata0`='$log'");
mysql_query("UPDATE `users` SET `udata46`='$namee[0]' WHERE `udata0`='$log'");
mysql_query("UPDATE `armor_item` SET `name`='$namee[0]', `p_def`='$re2[p_def]', `m_def`='$re2[m_def]' WHERE `login`='$log' and `name`='$udata46'");
echo"Неудача! Заточка потеряна.";
}
}
}else{
$namee=explode("*",$udata46);
if($namee[1]<=4){
if(empty($namee[1])){
$nam="$namee[0]*1";
}else{
$kol=$namee[1]+1;
$nam="$namee[0]*$kol";}
$udata82=$udata82+2;
$row[m_def]=$row[m_def]+2;
mysql_query("UPDATE `armor_item` SET `name`='$nam' WHERE `login`='$log' and `name`='$udata46' LIMIT 1 ");
mysql_query("UPDATE `armor_item` SET `m_def`='$row[m_def]' WHERE `login`='$log' and `name`='$nam' LIMIT 1 ");
mysql_query("UPDATE `users` SET `udata82`='$udata82' WHERE `udata0`='$log'");
mysql_query("UPDATE `users` SET `udata46`='$nam' WHERE `udata0`='$log'");
echo"Заточено";
}else
if($namee[1]>4){
$rand=rand(1,5);
if($rand!==5 and $rand!==3){
if(empty($namee[1])){
$nam="$namee[0]*1";
}else{
$kol=$namee[1]+1;
$nam="$namee[0]*$kol";}
$udata82=$udata82+2;
$row[m_def]=$row[m_def]+2;
mysql_query("UPDATE `armor_item` SET `name`='$nam' WHERE `login`='$log' and `name`='$udata46' LIMIT 1 ");
mysql_query("UPDATE `armor_item` SET `m_def`='$row[m_def]' WHERE `login`='$log' and `name`='$nam' LIMIT 1 ");
mysql_query("UPDATE `users` SET `udata82`='$udata82' WHERE `udata0`='$log'");
mysql_query("UPDATE `users` SET `udata46`='$nam' WHERE `udata0`='$log'");
echo"Заточено";
}else{
$namee=explode("*",$udata46);
$req1 = mysql_query("SELECT * FROM `armor` WHERE `name`='".$namee[0]."' LIMIT 1");
$re1 = mysql_num_rows($req1);
$re2 = mysql_fetch_array($req1);
$sila=$udata3-$row[p_def];
$udata3=$sila+$re2[p_def];
$sila1=$udata82-$row[m_def];
$udata82=$sila1+$re2[m_def];
mysql_query("UPDATE `users` SET `udata3`='$udata3', `udata82`='$udata82' WHERE `udata0`='$log'");
mysql_query("UPDATE `users` SET `udata46`='$namee[0]' WHERE `udata0`='$log'");
mysql_query("UPDATE `armor_item` SET `name`='$namee[0]', `p_def`='$re2[p_def]', `m_def`='$re2[m_def]' WHERE `login`='$log' and `name`='$udata46'");
echo"Неудача! Заточка потеряна.";
}
}
}}
break;
case 'shield':
$namee=explode("*",$udata45);
$req1 = mysql_query("SELECT * FROM `armor` WHERE `name`='".$namee[0]."' LIMIT 1");
$re1 = mysql_num_rows($req1);
if($re1==0){echo"Ничего не происходит. Скорее всего ваша вещь уникальна и заточить её таким образом нельзя!"; include_once"files/down.php"; exit; }
if($udata45=="Пусто"){echo"<small>Ошибка!</small>"; include_once"files/down.php"; exit; }
if($udata45==$udata12){echo"<small>Сначало оденьте щит!</small>"; include_once"files/down.php"; exit; }
$qi = mysql_query("SELECT * from `armor_item` WHERE `login`='".$log."' and `name`='".$udata45."' LIMIT 1 ");
while($row=mysql_fetch_array($qi)){
$elita=mysql_query("SELECT * from `item` WHERE `uda7`='".$log."' and `uda4`='Blessed Scroll: Armor' and `uda3`>='1' and `uda6`='$row[crystal_type]'");
if(mysql_num_rows($elita)==0){
echo'Нет свитка.<br/>';
echo"<a href="home.php?">Назад</a>";
include('files/down.php');exit;
}
$qi1 = mysql_query("SELECT * from `weapon_item` WHERE `login`='".$log."' and `name`='".$udata45."' LIMIT 1 ");
$rowi=mysql_num_rows($qi1);
if($rowi==1){echo"Снимите оружие и оденьте шит";include_once"files/down.php"; exit;}
$req = mysql_query("SELECT `uda3` FROM `item` WHERE `uda7`='".$log."' and `uda4`='Blessed Scroll: Armor' and `uda3`>='1' and `uda6`='$row[crystal_type]' LIMIT 1");
$re = mysql_fetch_array($req);
if(($re[uda3]-1)==0){
mysql_query("DELETE FROM `item` WHERE `uda7`='".$log."' and `uda4`='Blessed Scroll: Armor' and `uda6`='$row[crystal_type]' LIMIT 1");//чистим логи
}else{
$re[uda3]=$re[uda3]-1;
mysql_query("UPDATE `item` SET `uda3` = '$re[uda3]' WHERE `uda7`='".$log."' and `uda4`='Blessed Scroll: Armor' and `uda6`='$row[crystal_type]' LIMIT 1");
}
if($vid=="fiz"){
$namee=explode("*",$udata45);
if($namee[1]<=4){
if(empty($namee[1])){
$nam="$namee[0]*1";
}else{
$kol=$namee[1]+1;
$nam="$namee[0]*$kol";}
$udata3=$udata3+2;
$row[p_def]=$row[p_def]+2;
mysql_query("UPDATE `armor_item` SET `name`='$nam' WHERE `login`='$log' and `name`='$udata45' LIMIT 1 ");
mysql_query("UPDATE `armor_item` SET `p_def`='$row[p_def]' WHERE `login`='$log' and `name`='$nam' LIMIT 1 ");
mysql_query("UPDATE `users` SET `udata3`='$udata3' WHERE `udata0`='$log'");
mysql_query("UPDATE `users` SET `udata45`='$nam' WHERE `udata0`='$log'");
echo"Заточено";
}else
if($namee[1]>4){
$rand=rand(1,5);
if($rand!==5 and $rand!==3){
if(empty($namee[1])){
$nam="$namee[0]*1";
}else{
$kol=$namee[1]+1;
$nam="$namee[0]*$kol";}
$udata3=$udata3+2;
$row[p_def]=$row[p_def]+2;
mysql_query("UPDATE `armor_item` SET `name`='$nam' WHERE `login`='$log' and `name`='$udata45' LIMIT 1 ");
mysql_query("UPDATE `armor_item` SET `p_def`='$row[p_def]' WHERE `login`='$log' and `name`='$nam' LIMIT 1 ");
mysql_query("UPDATE `users` SET `udata3`='$udata3' WHERE `udata0`='$log'");
mysql_query("UPDATE `users` SET `udata45`='$nam' WHERE `udata0`='$log'");
echo"Заточено";
}else{
$namee=explode("*",$udata45);
$req1 = mysql_query("SELECT * FROM `armor` WHERE `name`='".$namee[0]."' LIMIT 1");
$re1 = mysql_num_rows($req1);
$re2 = mysql_fetch_array($req1);
$sila=$udata3-$row[p_def];
$udata3=$sila+$re2[p_def];
$sila1=$udata82-$row[m_def];
$udata82=$sila1+$re2[m_def];
mysql_query("UPDATE `users` SET `udata3`='$udata3', `udata82`='$udata82' WHERE `udata0`='$log'");
mysql_query("UPDATE `users` SET `udata45`='$namee[0]' WHERE `udata0`='$log'");
mysql_query("UPDATE `armor_item` SET `name`='$namee[0]', `p_def`='$re2[p_def]', `m_def`='$re2[m_def]' WHERE `login`='$log' and `name`='$udata45'");
echo"Неудача! Заточка потеряна.";
}
}
}else{
$namee=explode("*",$udata45);
if($namee[1]<=4){
if(empty($namee[1])){
$nam="$namee[0]*1";
}else{
$kol=$namee[1]+1;
$nam="$namee[0]*$kol";}
$udata82=$udata82+2;
$row[m_def]=$row[m_def]+2;
mysql_query("UPDATE `armor_item` SET `name`='$nam' WHERE `login`='$log' and `name`='$udata45' LIMIT 1 ");
mysql_query("UPDATE `armor_item` SET `m_def`='$row[m_def]' WHERE `login`='$log' and `name`='$nam' LIMIT 1 ");
mysql_query("UPDATE `users` SET `udata82`='$udata82' WHERE `udata0`='$log'");
mysql_query("UPDATE `users` SET `udata45`='$nam' WHERE `udata0`='$log'");
echo"Заточено";
}else
if($namee[1]>4){
$rand=rand(1,5);
if($rand!==5 and $rand!==3){
if(empty($namee[1])){
$nam="$namee[0]*1";
}else{
$kol=$namee[1]+1;
$nam="$namee[0]*$kol";}
$udata82=$udata82+2;
$row[m_def]=$row[m_def]+2;
mysql_query("UPDATE `armor_item` SET `name`='$nam' WHERE `login`='$log' and `name`='$udata45' LIMIT 1 ");
mysql_query("UPDATE `armor_item` SET `m_def`='$row[m_def]' WHERE `login`='$log' and `name`='$nam' LIMIT 1 ");
mysql_query("UPDATE `users` SET `udata82`='$udata82' WHERE `udata0`='$log'");
mysql_query("UPDATE `users` SET `udata45`='$nam' WHERE `udata0`='$log'");
echo"Заточено";
}else{
$namee=explode("*",$udata45);
$req1 = mysql_query("SELECT * FROM `armor` WHERE `name`='".$namee[0]."' LIMIT 1");
$re1 = mysql_num_rows($req1);
$re2 = mysql_fetch_array($req1);
$sila=$udata3-$row[p_def];
$udata3=$sila+$re2[p_def];
$sila1=$udata82-$row[m_def];
$udata82=$sila1+$re2[m_def];
mysql_query("UPDATE `users` SET `udata3`='$udata3', `udata82`='$udata82' WHERE `udata0`='$log'");
mysql_query("UPDATE `users` SET `udata45`='$namee[0]' WHERE `udata0`='$log'");
mysql_query("UPDATE `armor_item` SET `name`='$namee[0]', `p_def`='$re2[p_def]', `m_def`='$re2[m_def]' WHERE `login`='$log' and `name`='$udata45'");
echo"Неудача! Заточка потеряна.";
}
}
}}
break;
case 'nogi':
$namee=explode("*",$udata13);
$req1 = mysql_query("SELECT * FROM `armor` WHERE `name`='".$namee[0]."' LIMIT 1");
$re1 = mysql_num_rows($req1);
if($re1==0){echo"Ничего не происходит. Скорее всего ваша вещь уникальна и заточить её таким образом нельзя!"; include_once"files/down.php"; exit; }
if($udata13=="Пусто"){echo"<small>Ошибка!</small>"; include_once"files/down.php"; exit; }
$qi = mysql_query("SELECT * from `armor_item` WHERE `login`='".$log."' and `name`='".$udata13."' LIMIT 1 ");
while($row=mysql_fetch_array($qi)){
$elita=mysql_query("SELECT * from `item` WHERE `uda7`='".$log."' and `uda4`='Blessed Scroll: Armor' and `uda3`>='1' and `uda6`='$row[crystal_type]' ");
if(mysql_num_rows($elita)==0){
echo'Нет свитка.<br/>';
echo"<a href="home.php?">Назад</a>";
include('files/down.php');exit;
}
$req = mysql_query("SELECT `uda3` FROM `item` WHERE `uda7`='".$log."' and `uda4`='Blessed Scroll: Armor' and `uda3`>='1' and `uda6`='$row[crystal_type]' LIMIT 1");
$re = mysql_fetch_array($req);
if(($re[uda3]-1)==0){
mysql_query("DELETE FROM `item` WHERE `uda7`='".$log."' and `uda4`='Blessed Scroll: Armor' and `uda6`='$row[crystal_type]' LIMIT 1");//чистим логи
}else{
$re[uda3]=$re[uda3]-1;
mysql_query("UPDATE `item` SET `uda3` = '$re[uda3]' WHERE `uda7`='".$log."' and `uda4`='Blessed Scroll: Armor' and `uda6`='$row[crystal_type]' LIMIT 1");
}
if($vid=="fiz"){
$namee=explode("*",$udata13);
if($namee[1]<=4){
if(empty($namee[1])){
$nam="$namee[0]*1";
}else{
$kol=$namee[1]+1;
$nam="$namee[0]*$kol";}
$udata3=$udata3+2;
$row[p_def]=$row[p_def]+2;
mysql_query("UPDATE `armor_item` SET `name`='$nam' WHERE `login`='$log' and `name`='$udata13' LIMIT 1 ");
mysql_query("UPDATE `armor_item` SET `p_def`='$row[p_def]' WHERE `login`='$log' and `name`='$nam' LIMIT 1 ");
mysql_query("UPDATE `users` SET `udata3`='$udata3' WHERE `udata0`='$log'");
mysql_query("UPDATE `users` SET `udata13`='$nam' WHERE `udata0`='$log'");
echo"Заточено";
}else
if($namee[1]>4){
$rand=rand(1,5);
if($rand!==3 and $rand!==5){
if(empty($namee[1])){
$nam="$namee[0]*1";
}else{
$kol=$namee[1]+1;
$nam="$namee[0]*$kol";}
$udata3=$udata3+2;
$row[p_def]=$row[p_def]+2;
mysql_query("UPDATE `armor_item` SET `name`='$nam' WHERE `login`='$log' and `name`='$udata13' LIMIT 1 ");
mysql_query("UPDATE `armor_item` SET `p_def`='$row[p_def]' WHERE `login`='$log' and `name`='$nam' LIMIT 1 ");
mysql_query("UPDATE `users` SET `udata3`='$udata3' WHERE `udata0`='$log'");
mysql_query("UPDATE `users` SET `udata13`='$nam' WHERE `udata0`='$log'");
echo"Заточено";
}else{
$namee=explode("*",$udata13);
$req1 = mysql_query("SELECT * FROM `armor` WHERE `name`='".$namee[0]."' LIMIT 1");
$re1 = mysql_num_rows($req1);
$re2 = mysql_fetch_array($req1);
$sila=$udata3-$row[p_def];
$udata3=$sila+$re2[p_def];
$sila1=$udata82-$row[m_def];
$udata82=$sila1+$re2[m_def];
mysql_query("UPDATE `users` SET `udata3`='$udata3', `udata82`='$udata82' WHERE `udata0`='$log'");
mysql_query("UPDATE `users` SET `udata13`='$namee[0]' WHERE `udata0`='$log'");
mysql_query("UPDATE `armor_item` SET `name`='$namee[0]', `p_def`='$re2[p_def]', `m_def`='$re2[m_def]' WHERE `login`='$log' and `name`='$udata13'");
echo"Неудача! Заточка потеряна.";
}
}
}else{
$namee=explode("*",$udata13);
if($namee[1]<=4){
if(empty($namee[1])){
$nam="$namee[0]*1";
}else{
$kol=$namee[1]+1;
$nam="$namee[0]*$kol";}
$udata82=$udata82+2;
$row[m_def]=$row[m_def]+2;
mysql_query("UPDATE `armor_item` SET `name`='$nam' WHERE `login`='$log' and `name`='$udata13' LIMIT 1 ");
mysql_query("UPDATE `armor_item` SET `m_def`='$row[m_def]' WHERE `login`='$log' and `name`='$nam' LIMIT 1 ");
mysql_query("UPDATE `users` SET `udata82`='$udata82' WHERE `udata0`='$log'");
mysql_query("UPDATE `users` SET `udata13`='$nam' WHERE `udata0`='$log'");
echo"Заточено";
}else
if($namee[1]>4){
$rand=rand(1,5);
if($rand!==3 and $rand!==5){
if(empty($namee[1])){
$nam="$namee[0]*1";
}else{
$kol=$namee[1]+1;
$nam="$namee[0]*$kol";}
$udata82=$udata82+2;
$row[m_def]=$row[m_def]+2;
mysql_query("UPDATE `armor_item` SET `name`='$nam' WHERE `login`='$log' and `name`='$udata13' LIMIT 1 ");
mysql_query("UPDATE `armor_item` SET `m_def`='$row[m_def]' WHERE `login`='$log' and `name`='$nam' LIMIT 1 ");
mysql_query("UPDATE `users` SET `udata82`='$udata82' WHERE `udata0`='$log'");
mysql_query("UPDATE `users` SET `udata13`='$nam' WHERE `udata0`='$log'");
echo"Заточено";
}else{
$namee=explode("*",$udata13);
$req1 = mysql_query("SELECT * FROM `armor` WHERE `name`='".$namee[0]."' LIMIT 1");
$re1 = mysql_num_rows($req1);
$re2 = mysql_fetch_array($req1);
$sila=$udata3-$row[p_def];
$udata3=$sila+$re2[p_def];
$sila1=$udata82-$row[m_def];
$udata82=$sila1+$re2[m_def];
mysql_query("UPDATE `users` SET `udata3`='$udata3', `udata82`='$udata82' WHERE `udata0`='$log'");
mysql_query("UPDATE `users` SET `udata13`='$namee[0]' WHERE `udata0`='$log'");
mysql_query("UPDATE `armor_item` SET `name`='$namee[0]', `p_def`='$re2[p_def]', `m_def`='$re2[m_def]' WHERE `login`='$log' and `name`='$udata13'");
echo"Неудача! Заточка потеряна.";
}
}
}}
break;
case 'golova':
$namee=explode("*",$udata10);
$req1 = mysql_query("SELECT * FROM `armor` WHERE `name`='".$namee[0]."' LIMIT 1");
$re1 = mysql_num_rows($req1);
if($re1==0){echo"Ничего не происходит. Скорее всего ваша вещь уникальна и заточить её таким образом нельзя!"; include_once"files/down.php"; exit; }
if($udata10=="Пусто"){echo"<small>Ошибка!</small>"; include_once"files/down.php"; exit; }
$qi = mysql_query("SELECT * from `armor_item` WHERE `login`='".$log."' and `name`='".$udata10."' LIMIT 1 ");
while($row=mysql_fetch_array($qi)){
$elita=mysql_query("SELECT * from `item` WHERE `uda7`='".$log."' and `uda4`='Blessed Scroll: Armor' and `uda3`>='1' and `uda6`='$row[crystal_type]' ");
if(mysql_num_rows($elita)==0){
echo'Нет свитка.<br/>';
echo"<a href="home.php?">Назад</a>";
include('files/down.php');exit;
}
$req = mysql_query("SELECT `uda3` FROM `item` WHERE `uda7`='".$log."' and `uda4`='Blessed Scroll: Armor' and `uda3`>='1' and `uda6`='$row[crystal_type]' LIMIT 1");
$re = mysql_fetch_array($req);
if(($re[uda3]-1)==0){
mysql_query("DELETE FROM `item` WHERE `uda7`='".$log."' and `uda4`='Blessed Scroll: Armor' and `uda6`='$row[crystal_type]' LIMIT 1");//чистим логи
}else{
$re[uda3]=$re[uda3]-1;
mysql_query("UPDATE `item` SET `uda3` = '$re[uda3]' WHERE `uda7`='".$log."' and `uda4`='Blessed Scroll: Armor' and `uda6`='$row[crystal_type]' LIMIT 1");
}
if($vid=="fiz"){
$namee=explode("*",$udata10);
if($namee[1]<=4){
if(empty($namee[1])){
$nam="$namee[0]*1";
}else{
$kol=$namee[1]+1;
$nam="$namee[0]*$kol";}
$udata3=$udata3+2;
$row[p_def]=$row[p_def]+2;
mysql_query("UPDATE `armor_item` SET `name`='$nam' WHERE `login`='$log' and `name`='$udata10' LIMIT 1 ");
mysql_query("UPDATE `armor_item` SET `p_def`='$row[p_def]' WHERE `login`='$log' and `name`='$nam' LIMIT 1 ");
mysql_query("UPDATE `users` SET `udata3`='$udata3' WHERE `udata0`='$log'");
mysql_query("UPDATE `users` SET `udata10`='$nam' WHERE `udata0`='$log'");
echo"Заточено";
}else
if($namee[1]>4){
$rand=rand(1,5);
if($rand!==3 and $rand!==5){
if(empty($namee[1])){
$nam="$namee[0]*1";
}else{
$kol=$namee[1]+1;
$nam="$namee[0]*$kol";}
$udata3=$udata3+2;
$row[p_def]=$row[p_def]+2;
mysql_query("UPDATE `armor_item` SET `name`='$nam' WHERE `login`='$log' and `name`='$udata10' LIMIT 1 ");
mysql_query("UPDATE `armor_item` SET `p_def`='$row[p_def]' WHERE `login`='$log' and `name`='$nam' LIMIT 1 ");
mysql_query("UPDATE `users` SET `udata3`='$udata3' WHERE `udata0`='$log'");
mysql_query("UPDATE `users` SET `udata10`='$nam' WHERE `udata0`='$log'");
echo"Заточено";
}else{
$namee=explode("*",$udata10);
$req1 = mysql_query("SELECT * FROM `armor` WHERE `name`='".$namee[0]."' LIMIT 1");
$re1 = mysql_num_rows($req1);
$re2 = mysql_fetch_array($req1);
$sila=$udata3-$row[p_def];
$udata3=$sila+$re2[p_def];
$sila1=$udata82-$row[m_def];
$udata82=$sila1+$re2[m_def];
mysql_query("UPDATE `users` SET `udata3`='$udata3', `udata82`='$udata82' WHERE `udata0`='$log'");
mysql_query("UPDATE `users` SET `udata10`='$namee[0]' WHERE `udata0`='$log'");
mysql_query("UPDATE `armor_item` SET `name`='$namee[0]', `p_def`='$re2[p_def]', `m_def`='$re2[m_def]' WHERE `login`='$log' and `name`='$udata10'");
echo"Неудача! Заточка потеряна.";
}
}
}else{
$namee=explode("*",$udata10);
if($namee[1]<=4){
if(empty($namee[1])){
$nam="$namee[0]*1";
}else{
$kol=$namee[1]+1;
$nam="$namee[0]*$kol";}
$udata82=$udata82+2;
$row[m_def]=$row[m_def]+2;
mysql_query("UPDATE `armor_item` SET `name`='$nam' WHERE `login`='$log' and `name`='$udata10' LIMIT 1 ");
mysql_query("UPDATE `armor_item` SET `m_def`='$row[m_def]' WHERE `login`='$log' and `name`='$nam' LIMIT 1 ");
mysql_query("UPDATE `users` SET `udata82`='$udata82' WHERE `udata0`='$log'");
mysql_query("UPDATE `users` SET `udata10`='$nam' WHERE `udata0`='$log'");
echo"Заточено";
}else
if($namee[1]>4){
$rand=rand(1,5);
if($rand!==3 and $rand!==5){
if(empty($namee[1])){
$nam="$namee[0]*1";
}else{
$kol=$namee[1]+1;
$nam="$namee[0]*$kol";}
$udata82=$udata82+2;
$row[m_def]=$row[m_def]+2;
mysql_query("UPDATE `armor_item` SET `name`='$nam' WHERE `login`='$log' and `name`='$udata10' LIMIT 1 ");
mysql_query("UPDATE `armor_item` SET `m_def`='$row[m_def]' WHERE `login`='$log' and `name`='$nam' LIMIT 1 ");
mysql_query("UPDATE `users` SET `udata82`='$udata82' WHERE `udata0`='$log'");
mysql_query("UPDATE `users` SET `udata10`='$nam' WHERE `udata0`='$log'");
echo"Заточено";
}else{
$namee=explode("*",$udata10);
$req1 = mysql_query("SELECT * FROM `armor` WHERE `name`='".$namee[0]."' LIMIT 1");
$re1 = mysql_num_rows($req1);
$re2 = mysql_fetch_array($req1);
$sila=$udata3-$row[p_def];
$udata3=$sila+$re2[p_def];
$sila1=$udata82-$row[m_def];
$udata82=$sila1+$re2[m_def];
mysql_query("UPDATE `users` SET `udata3`='$udata3', `udata82`='$udata82' WHERE `udata0`='$log'");
mysql_query("UPDATE `users` SET `udata10`='$namee[0]' WHERE `udata0`='$log'");
mysql_query("UPDATE `armor_item` SET `name`='$namee[0]', `p_def`='$re2[p_def]', `m_def`='$re2[m_def]' WHERE `login`='$log' and `name`='$udata10'");
echo"Неудача! Заточка потеряна.";
}
}
}}
break;
case 'armor':
$namee=explode("*",$udata11);
$req1 = mysql_query("SELECT * FROM `armor` WHERE `name`='".$namee[0]."' LIMIT 1");
$re1 = mysql_num_rows($req1);
if($re1==0){echo"Ничего не происходит. Скорее всего ваша вещь уникальна и заточить её таким образом нельзя!"; include_once"files/down.php"; exit; }
if($udata11=="Пусто" or $udata84=="Пусто"){echo"<small>Роба не одета.</small>"; include_once"files/down.php"; exit; }
$qi = mysql_query("SELECT * from `armor_item` WHERE `login`='".$log."' and `name`='".$udata11."' LIMIT 1 ");
while($row=mysql_fetch_array($qi)){
$elita=mysql_query("SELECT * from `item` WHERE `uda7`='".$log."' and `uda4`='Blessed Scroll: Armor' and `uda3`>='1' and `uda6`='$row[crystal_type]' ");
if(mysql_num_rows($elita)==0){
echo'Нет свитка.<br/>';
echo"<a href="home.php?">Назад</a>";
include('files/down.php');exit;
}
if($udata11!=="$row[name]" or $udata84!=="$row[name]"){echo"Оденьте робу.";include_once"files/down.php"; exit;}
$req = mysql_query("SELECT `uda3` FROM `item` WHERE `uda7`='".$log."' and `uda4`='Blessed Scroll: Armor' and `uda3`>='1' and `uda6`='$row[crystal_type]' LIMIT 1") or die(mysql_error());
$re = mysql_fetch_array($req);
if(($re[uda3]-1)==0){
mysql_query("DELETE FROM `item` WHERE `uda7`='".$log."' and `uda4`='Blessed Scroll: Armor' and `uda6`='$row[crystal_type]' LIMIT 1") or die(mysql_error());//чистим логи
}else{
$re[uda3]=$re[uda3]-1;
mysql_query("UPDATE `item` SET `uda3` = '$re[uda3]' WHERE `uda7`='".$log."' and `uda4`='Blessed Scroll: Armor' and `uda6`='$row[crystal_type]' LIMIT 1") or die(mysql_error());
}
if($vid=="fiz"){
$namee=explode("*",$udata11);
if($namee[1]<=4){
if(empty($namee[1])){
$nam="$namee[0]*1";
}else{
$kol=$namee[1]+1;
$nam="$namee[0]*$kol";}
$udata3=$udata3+2;
$row[p_def]=$row[p_def]+2;
mysql_query("UPDATE `armor_item` SET `name`='$nam' WHERE `login`='$log' and `name`='$udata11' LIMIT 1 ") or die(mysql_error());
mysql_query("UPDATE `armor_item` SET `p_def`='$row[p_def]' WHERE `login`='$log' and `name`='$nam' LIMIT 1 ") or die(mysql_error());
mysql_query("UPDATE `users` SET `udata3`='$udata3' WHERE `udata0`='$log'") or die(mysql_error());
mysql_query("UPDATE `users` SET `udata11`='$nam',`udata84`='$nam' WHERE `udata0`='$log'") or die(mysql_error());
echo"Заточено";
}else
if($namee[1]>4){
$rand=rand(1,5);
if($rand!==3 and $rand!==5){
if(empty($namee[1])){
$nam="$namee[0]*1";
}else{
$kol=$namee[1]+1;
$nam="$namee[0]*$kol";}
$udata3=$udata3+2;
$row[p_def]=$row[p_def]+2;
mysql_query("UPDATE `armor_item` SET `name`='$nam' WHERE `login`='$log' and `name`='$udata11' LIMIT 1 ") or die(mysql_error());
mysql_query("UPDATE `armor_item` SET `p_def`='$row[p_def]' WHERE `login`='$log' and `name`='$nam' LIMIT 1 ") or die(mysql_error());
mysql_query("UPDATE `users` SET `udata3`='$udata3' WHERE `udata0`='$log'") or die(mysql_error());
mysql_query("UPDATE `users` SET `udata11`='$nam', `udata84`='$nam' WHERE `udata0`='$log'") or die(mysql_error());
echo"Заточено";
}else{
$namee=explode("*",$udata11);
$req1 = mysql_query("SELECT * FROM `armor` WHERE `name`='".$namee[0]."' LIMIT 1");
$re1 = mysql_num_rows($req1);
$re2 = mysql_fetch_array($req1);
$sila=$udata3-$row[p_def];
$udata3=$sila+$re2[p_def];
$sila1=$udata82-$row[m_def];
$udata82=$sila1+$re2[m_def];
mysql_query("UPDATE `users` SET `udata3`='$udata3', `udata82`='$udata82' WHERE `udata0`='$log'");
mysql_query("UPDATE `users` SET `udata11`='$namee[0]', `udata84`='$namee[0]' WHERE `udata0`='$log'");
mysql_query("UPDATE `armor_item` SET `name`='$namee[0]', `p_def`='$re2[p_def]', `m_def`='$re2[m_def]' WHERE `login`='$log' and `name`='$udata11'");
echo"Неудача! Заточка потеряна.";
}
}
}else{
$namee=explode("*",$udata11);
if($namee[1]<=4){
if(empty($namee[1])){
$nam="$namee[0]*1";
}else{
$kol=$namee[1]+1;
$nam="$namee[0]*$kol";}
$udata82=$udata82+2;
$row[m_def]=$row[m_def]+2;
mysql_query("UPDATE `armor_item` SET `name`='$nam' WHERE `login`='$log' and `name`='$udata11' LIMIT 1 ") or die(mysql_error());
mysql_query("UPDATE `armor_item` SET `m_def`='$row[m_def]' WHERE `login`='$log' and `name`='$nam' LIMIT 1 ") or die(mysql_error());
mysql_query("UPDATE `users` SET `udata82`='$udata82' WHERE `udata0`='$log'") or die(mysql_error());
mysql_query("UPDATE `users` SET `udata11`='$nam', `udata84`='$nam' WHERE `udata0`='$log'") or die(mysql_error());
echo"Заточено";
}else
if($namee[1]>4){
$rand=rand(1,5);
if($rand!==3 and $rand!==5){
if(empty($namee[1])){
$nam="$namee[0]*1";
}else{
$kol=$namee[1]+1;
$nam="$namee[0]*$kol";}
$udata82=$udata82+2;
$row[m_def]=$row[m_def]+2;
mysql_query("UPDATE `armor_item` SET `name`='$nam' WHERE `login`='$log' and `name`='$udata11' LIMIT 1 ") or die(mysql_error());
mysql_query("UPDATE `armor_item` SET `m_def`='$row[m_def]' WHERE `login`='$log' and `name`='$nam' LIMIT 1 ") or die(mysql_error());
mysql_query("UPDATE `users` SET `udata82`='$udata82' WHERE `udata0`='$log'") or die(mysql_error());
mysql_query("UPDATE `users` SET `udata11`='$nam', `udata84`='$nam' WHERE `udata0`='$log'") or die(mysql_error());
echo"Заточено";
}else{
$namee=explode("*",$udata11);
$req1 = mysql_query("SELECT * FROM `armor` WHERE `name`='".$namee[0]."' LIMIT 1");
$re1 = mysql_num_rows($req1);
$re2 = mysql_fetch_array($req1);
$sila=$udata3-$row[p_def];
$udata3=$sila+$re2[p_def];
$sila1=$udata82-$row[m_def];
$udata82=$sila1+$re2[m_def];
mysql_query("UPDATE `users` SET `udata3`='$udata3', `udata82`='$udata82' WHERE `udata0`='$log'");
mysql_query("UPDATE `users` SET `udata11`='$namee[0]', `udata84`='$namee[0]' WHERE `udata0`='$log'");
mysql_query("UPDATE `armor_item` SET `name`='$namee[0]', `p_def`='$re2[p_def]', `m_def`='$re2[m_def]' WHERE `login`='$log' and `name`='$udata11'");
echo"Неудача! Заточка потеряна.";
}
}
}}
break;
case 'up':
$namee=explode("*",$udata11);
$req1 = mysql_query("SELECT * FROM `armor` WHERE `name`='".$namee[0]."' LIMIT 1");
$re1 = mysql_num_rows($req1);
if($re1==0){echo"Ничего не происходит. Скорее всего ваша вещь уникальна и заточить её таким образом нельзя!"; include_once"files/down.php"; exit; }
if($udata11=="Пусто"){echo"<small>Верх не одет.</small>"; include_once"files/down.php"; exit; }
$qi = mysql_query("SELECT * from `armor_item` WHERE `login`='".$log."' and `name`='".$udata11."' LIMIT 1 ");
while($row=mysql_fetch_array($qi)){
$elita=mysql_query("SELECT * from `item` WHERE `uda7`='".$log."' and `uda4`='Blessed Scroll: Armor' and `uda3`>='1' and `uda6`='$row[crystal_type]' ");
if(mysql_num_rows($elita)==0){
echo'Нет свитка.<br/>';
echo"<a href="home.php?">Назад</a>";
include('files/down.php');exit;
}
if($udata11=="$row[name]" and $udata84=="$row[name]"){echo"Снимите робу и оденьте верх.";include_once"files/down.php"; exit;}
$req = mysql_query("SELECT `uda3` FROM `item` WHERE `uda7`='".$log."' and `uda4`='Blessed Scroll: Armor' and `uda3`>='1' and `uda6`='$row[crystal_type]' LIMIT 1");
$re = mysql_fetch_array($req);
if(($re[uda3]-1)==0){
mysql_query("DELETE FROM `item` WHERE `uda7`='".$log."' and `uda4`='Blessed Scroll: Armor' and `uda6`='$row[crystal_type]' LIMIT 1");//чистим логи
}else{
$re[uda3]=$re[uda3]-1;
mysql_query("UPDATE `item` SET `uda3` = '$re[uda3]' WHERE `uda7`='".$log."' and `uda4`='Blessed Scroll: Armor' and `uda6`='$row[crystal_type]' LIMIT 1");
}
if($vid=="fiz"){
$namee=explode("*",$udata11);
if($namee[1]<=4){
if(empty($namee[1])){
$nam="$namee[0]*1";
}else{
$kol=$namee[1]+1;
$nam="$namee[0]*$kol";}
$udata3=$udata3+2;
$row[p_def]=$row[p_def]+2;
mysql_query("UPDATE `armor_item` SET `name`='$nam' WHERE `login`='$log' and `name`='$udata11' LIMIT 1 ");
mysql_query("UPDATE `armor_item` SET `p_def`='$row[p_def]' WHERE `login`='$log' and `name`='$nam' LIMIT 1 ");
mysql_query("UPDATE `users` SET `udata3`='$udata3' WHERE `udata0`='$log'");
mysql_query("UPDATE `users` SET `udata11`='$nam' WHERE `udata0`='$log'");
echo"Заточено";
}else
if($namee[1]>4){
$rand=rand(1,5);
if($rand!==3 and $rand!==5){
if(empty($namee[1])){
$nam="$namee[0]*1";
}else{
$kol=$namee[1]+1;
$nam="$namee[0]*$kol";}
$udata3=$udata3+2;
$row[p_def]=$row[p_def]+2;
mysql_query("UPDATE `armor_item` SET `name`='$nam' WHERE `login`='$log' and `name`='$udata11' LIMIT 1 ");
mysql_query("UPDATE `armor_item` SET `p_def`='$row[p_def]' WHERE `login`='$log' and `name`='$nam' LIMIT 1 ");
mysql_query("UPDATE `users` SET `udata3`='$udata3' WHERE `udata0`='$log'");
mysql_query("UPDATE `users` SET `udata11`='$nam' WHERE `udata0`='$log'");
echo"Заточено";
}else{
$namee=explode("*",$udata11);
$req1 = mysql_query("SELECT * FROM `armor` WHERE `name`='".$namee[0]."' LIMIT 1");
$re1 = mysql_num_rows($req1);
$re2 = mysql_fetch_array($req1);
$sila=$udata3-$row[p_def];
$udata3=$sila+$re2[p_def];
$sila1=$udata82-$row[m_def];
$udata82=$sila1+$re2[m_def];
mysql_query("UPDATE `users` SET `udata3`='$udata3', `udata82`='$udata82' WHERE `udata0`='$log'");
mysql_query("UPDATE `users` SET `udata11`='$namee[0]' WHERE `udata0`='$log'");
mysql_query("UPDATE `armor_item` SET `name`='$namee[0]', `p_def`='$re2[p_def]', `m_def`='$re2[m_def]' WHERE `login`='$log' and `name`='$udata11'");
echo"Неудача! Заточка потеряна.";
}
}
}else{
$namee=explode("*",$udata11);
if($namee[1]<=4){
if(empty($namee[1])){
$nam="$namee[0]*1";
}else{
$kol=$namee[1]+1;
$nam="$namee[0]*$kol";}
$udata82=$udata82+2;
$row[m_def]=$row[m_def]+2;
mysql_query("UPDATE `armor_item` SET `name`='$nam' WHERE `login`='$log' and `name`='$udata11' LIMIT 1 ");
mysql_query("UPDATE `armor_item` SET `m_def`='$row[m_def]' WHERE `login`='$log' and `name`='$nam' LIMIT 1 ");
mysql_query("UPDATE `users` SET `udata82`='$udata82' WHERE `udata0`='$log'");
mysql_query("UPDATE `users` SET `udata11`='$nam' WHERE `udata0`='$log'");
echo"Заточено";
}else
if($namee[1]>4){
$rand=rand(1,5);
if($rand!==3 and $rand!==5){
if(empty($namee[1])){
$nam="$namee[0]*1";
}else{
$kol=$namee[1]+1;
$nam="$namee[0]*$kol";}
$udata82=$udata82+2;
$row[m_def]=$row[m_def]+2;
mysql_query("UPDATE `armor_item` SET `name`='$nam' WHERE `login`='$log' and `name`='$udata11' LIMIT 1 ");
mysql_query("UPDATE `armor_item` SET `m_def`='$row[m_def]' WHERE `login`='$log' and `name`='$nam' LIMIT 1 ");
mysql_query("UPDATE `users` SET `udata82`='$udata82' WHERE `udata0`='$log'");
mysql_query("UPDATE `users` SET `udata11`='$nam' WHERE `udata0`='$log'");
echo"Заточено";
}else{
$namee=explode("*",$udata11);
$req1 = mysql_query("SELECT * FROM `armor` WHERE `name`='".$namee[0]."' LIMIT 1");
$re1 = mysql_num_rows($req1);
$re2 = mysql_fetch_array($req1);
$sila=$udata3-$row[p_def];
$udata3=$sila+$re2[p_def];
$sila1=$udata82-$row[m_def];
$udata82=$sila1+$re2[m_def];
mysql_query("UPDATE `users` SET `udata3`='$udata3', `udata82`='$udata82' WHERE `udata0`='$log'");
mysql_query("UPDATE `users` SET `udata11`='$namee[0]' WHERE `udata0`='$log'");
mysql_query("UPDATE `armor_item` SET `name`='$namee[0]', `p_def`='$re2[p_def]', `m_def`='$re2[m_def]' WHERE `login`='$log' and `name`='$udata11'");
echo"Неудача! Заточка потеряна.";
}
}
}}
break;
case 'down':
$namee=explode("*",$udata84);
$req1 = mysql_query("SELECT * FROM `armor` WHERE `name`='".$namee[0]."' LIMIT 1");
$re1 = mysql_num_rows($req1);
if($re1==0){echo"Ничего не происходит. Скорее всего ваша вещь уникальна и заточить её таким образом нельзя!"; include_once"files/down.php"; exit; }
if($udata84=="Пусто"){echo"<small>Верх не одет.</small>"; include_once"files/down.php"; exit; }
$qi = mysql_query("SELECT * from `armor_item` WHERE `login`='".$log."' and `name`='".$udata84."' LIMIT 1 ");
while($row=mysql_fetch_array($qi)){
$elita=mysql_query("SELECT * from `item` WHERE `uda7`='".$log."' and `uda4`='Blessed Scroll: Armor' and `uda3`>='1' and `uda6`='$row[crystal_type]' ");
if(mysql_num_rows($elita)==0){
echo'Нет свитка.<br/>';
echo"<a href="home.php?">Назад</a>";
include('files/down.php');exit;
}
if($udata11=="$row[name]" and $udata84=="$row[name]"){echo"Снимите робу и оденьте низ.";include_once"files/down.php"; exit;}
$req = mysql_query("SELECT `uda3` FROM `item` WHERE `uda7`='".$log."' and `uda4`='Blessed Scroll: Armor' and `uda3`>='1' and `uda6`='$row[crystal_type]' LIMIT 1");
$re = mysql_fetch_array($req);
if(($re[uda3]-1)==0){
mysql_query("DELETE FROM `item` WHERE `uda7`='".$log."' and `uda4`='Blessed Scroll: Armor' and `uda6`='$row[crystal_type]' LIMIT 1");//чистим логи
}else{
$re[uda3]=$re[uda3]-1;
mysql_query("UPDATE `item` SET `uda3` = '$re[uda3]' WHERE `uda7`='".$log."' and `uda4`='Blessed Scroll: Armor' and `uda6`='$row[crystal_type]' LIMIT 1");
}
if($vid=="fiz"){
$namee=explode("*",$udata84);
if($namee[1]<=4){
if(empty($namee[1])){
$nam="$namee[0]*1";
}else{
$kol=$namee[1]+1;
$nam="$namee[0]*$kol";}
$udata3=$udata3+2;
$row[p_def]=$row[p_def]+2;
mysql_query("UPDATE `armor_item` SET `name`='$nam' WHERE `login`='$log' and `name`='$udata84' LIMIT 1 ");
mysql_query("UPDATE `armor_item` SET `p_def`='$row[p_def]' WHERE `login`='$log' and `name`='$nam' LIMIT 1 ");
mysql_query("UPDATE `users` SET `udata3`='$udata3' WHERE `udata0`='$log'");
mysql_query("UPDATE `users` SET `udata84`='$nam' WHERE `udata0`='$log'");
echo"Заточено";
}else
if($namee[1]>4){
$rand=rand(1,5);
if($rand!==3 and $rand!==5){
if(empty($namee[1])){
$nam="$namee[0]*1";
}else{
$kol=$namee[1]+1;
$nam="$namee[0]*$kol";}
$udata3=$udata3+2;
$row[p_def]=$row[p_def]+2;
mysql_query("UPDATE `armor_item` SET `name`='$nam' WHERE `login`='$log' and `name`='$udata84' LIMIT 1 ");
mysql_query("UPDATE `armor_item` SET `p_def`='$row[p_def]' WHERE `login`='$log' and `name`='$nam' LIMIT 1 ");
mysql_query("UPDATE `users` SET `udata3`='$udata3' WHERE `udata0`='$log'");
mysql_query("UPDATE `users` SET `udata84`='$nam' WHERE `udata0`='$log'");
echo"Заточено";
}else{
$namee=explode("*",$udata84);
$req1 = mysql_query("SELECT * FROM `armor` WHERE `name`='".$namee[0]."' LIMIT 1");
$re1 = mysql_num_rows($req1);
$re2 = mysql_fetch_array($req1);
$sila=$udata3-$row[p_def];
$udata3=$sila+$re2[p_def];
$sila1=$udata82-$row[m_def];
$udata82=$sila1+$re2[m_def];
mysql_query("UPDATE `users` SET `udata3`='$udata3', `udata82`='$udata82' WHERE `udata0`='$log'");
mysql_query("UPDATE `users` SET `udata84`='$namee[0]' WHERE `udata0`='$log'");
mysql_query("UPDATE `armor_item` SET `name`='$namee[0]', `p_def`='$re2[p_def]', `m_def`='$re2[m_def]' WHERE `login`='$log' and `name`='$udata84'");
echo"Неудача! Заточка потеряна.";
}
}
}else{
$namee=explode("*",$udata84);
if($namee[1]<=4){
if(empty($namee[1])){
$nam="$namee[0]*1";
}else{
$kol=$namee[1]+1;
$nam="$namee[0]*$kol";}
$udata82=$udata82+2;
$row[m_def]=$row[m_def]+2;
mysql_query("UPDATE `armor_item` SET `name`='$nam' WHERE `login`='$log' and `name`='$udata84' LIMIT 1 ");
mysql_query("UPDATE `armor_item` SET `m_def`='$row[m_def]' WHERE `login`='$log' and `name`='$nam' LIMIT 1 ");
mysql_query("UPDATE `users` SET `udata82`='$udata82' WHERE `udata0`='$log'");
mysql_query("UPDATE `users` SET `udata84`='$nam' WHERE `udata0`='$log'");
echo"Заточено";
}else
if($namee[1]>4){
$rand=rand(1,5);
if($rand!==3 and $rand!==5){
if(empty($namee[1])){
$nam="$namee[0]*1";
}else{
$kol=$namee[1]+1;
$nam="$namee[0]*$kol";}
$udata82=$udata82+2;
$row[m_def]=$row[m_def]+2;
mysql_query("UPDATE `armor_item` SET `name`='$nam' WHERE `login`='$log' and `name`='$udata84' LIMIT 1 ");
mysql_query("UPDATE `armor_item` SET `m_def`='$row[m_def]' WHERE `login`='$log' and `name`='$nam' LIMIT 1 ");
mysql_query("UPDATE `users` SET `udata82`='$udata82' WHERE `udata0`='$log'");
mysql_query("UPDATE `users` SET `udata84`='$nam' WHERE `udata0`='$log'");
echo"Заточено";
}else{
$namee=explode("*",$udata84);
$req1 = mysql_query("SELECT * FROM `armor` WHERE `name`='".$namee[0]."' LIMIT 1");
$re1 = mysql_num_rows($req1);
$re2 = mysql_fetch_array($req1);
$sila=$udata3-$row[p_def];
$udata3=$sila+$re2[p_def];
$sila1=$udata82-$row[m_def];
$udata82=$sila1+$re2[m_def];
mysql_query("UPDATE `users` SET `udata3`='$udata3', `udata82`='$udata82' WHERE `udata0`='$log'");
mysql_query("UPDATE `users` SET `udata84`='$namee[0]' WHERE `udata0`='$log'");
mysql_query("UPDATE `armor_item` SET `name`='$namee[0]', `p_def`='$re2[p_def]', `m_def`='$re2[m_def]' WHERE `login`='$log' and `name`='$udata84'");
echo"Неудача! Заточка потеряна.";
}
}
}}
break;
case 'weapon':
$namee=explode("*",$udata12);
$req1 = mysql_query("SELECT * FROM `weapon` WHERE `name`='".$namee[0]."' LIMIT 1");
$re1 = mysql_num_rows($req1);
if($re1==0){echo"Ничего не происходит. Скорее всего ваша вещь уникальна и заточить её таким образом нельзя!"; include_once"files/down.php"; exit; }
if($udata12=="Пусто"){echo"<small>Ошибка!</small>"; include_once"files/down.php"; exit; }
$qi1 = mysql_query("SELECT * from `weapon_item` WHERE `login`='".$log."' and `name`='".$udata12."' LIMIT 1 ");
$req=mysql_fetch_array($qi1);
$elita=mysql_query("SELECT * from `item` WHERE `uda7`='".$log."' and `uda4`='Blessed Scroll: Weapon' and `uda3`>='1' and `uda6`='$req[crystal_type]' ");
if(mysql_num_rows($elita)==0){
echo'Нет свитка.<br/>';
echo"<a href="home.php?">Назад</a>";
include('files/down.php');exit;
}
$req = mysql_query("SELECT `uda3` FROM `item` WHERE `uda7`='".$log."' and `uda4`='Blessed Scroll: Weapon' and `uda3`>='1' and `uda6`='$req[crystal_type]' LIMIT 1");
$re = mysql_fetch_array($req);
if(($re[uda3]-1)==0){
$qi1 = mysql_query("SELECT * from `weapon_item` WHERE `login`='".$log."' and `name`='".$udata12."' LIMIT 1 ");
$req=mysql_fetch_array($qi1);
mysql_query("DELETE FROM `item` WHERE `uda7`='".$log."' and `uda4`='Blessed Scroll: Weapon' and `uda6`='$req[crystal_type]' LIMIT 1");//чистим логи
}else{
$qi1 = mysql_query("SELECT * from `weapon_item` WHERE `login`='".$log."' and `name`='".$udata12."' LIMIT 1 ");
$req=mysql_fetch_array($qi1);
$re[uda3]=$re[uda3]-1;
mysql_query("UPDATE `item` SET `uda3` = '$re[uda3]' WHERE `uda7`='".$log."' and `uda4`='Blessed Scroll: Weapon' and `uda6`='$req[crystal_type]' LIMIT 1");
}
$qi = mysql_query("SELECT * from `weapon_item` WHERE `login`='".$log."' and `name`='".$udata12."' LIMIT 1 ");
while($row=mysql_fetch_array($qi)){
if($vid=="fiz"){
$namee=explode("*",$udata12);
if($namee[1]<=4){
if($row[weaponType]=="dual"){
if(empty($namee[2])){
$nam="$namee[0]*$namee[1]*1";}else{
$kol=$namee[2]+1;
$nam="$namee[0]*$namee[1]*$kol";}
}else{
if(empty($namee[1])){
$nam="$namee[0]*1";}else{
$kol=$namee[1]+1;
$nam="$namee[0]*$kol";}}
$udata4=$udata4+2;
$row[p_dam]=$row[p_dam]+2;
mysql_query("UPDATE `weapon_item` SET `name`='$nam' WHERE `login`='$log' and `name`='$udata12' LIMIT 1 ");
mysql_query("UPDATE `weapon_item` SET `p_dam`='$row[p_dam]' WHERE `login`='$log' and `name`='$nam' LIMIT 1 ");
mysql_query("UPDATE `users` SET `udata4`='$udata4' WHERE `udata0`='$log'");
if($row[bodypart]=="lrhand"){
mysql_query("UPDATE `users` SET `udata12`='$nam',`udata45`='$nam' WHERE `udata0`='$log'");}else{
mysql_query("UPDATE `users` SET `udata12`='$nam' WHERE `udata0`='$log'");}
echo"Заточено";
}else
if($namee[1]>4){
$rand=rand(1,5);
if($rand!==3 and $rand!==5){
if($row[weaponType]=="dual"){
if(empty($namee[2])){
$nam="$namee[0]*$namee[1]*1";}else{
$kol=$namee[2]+1;
$nam="$namee[0]*$namee[1]*$kol";}
}else{
if(empty($namee[1])){
$nam="$namee[0]*1";}else{
$kol=$namee[1]+1;
$nam="$namee[0]*$kol";}}
$udata4=$udata4+2;
$row[p_dam]=$row[p_dam]+2;
mysql_query("UPDATE `weapon_item` SET `name`='$nam' WHERE `login`='$log' and `name`='$udata12' LIMIT 1 ");
mysql_query("UPDATE `weapon_item` SET `p_dam`='$row[p_dam]' WHERE `login`='$log' and `name`='$nam' LIMIT 1 ");
mysql_query("UPDATE `users` SET `udata4`='$udata4' WHERE `udata0`='$log'");
if($row[bodypart]=="lrhand"){
mysql_query("UPDATE `users` SET `udata12`='$nam',`udata45`='$nam' WHERE `udata0`='$log'");}else{
mysql_query("UPDATE `users` SET `udata12`='$nam' WHERE `udata0`='$log'");}
echo"Заточено";
}else{
$namee=explode("*",$udata12);
$req1 = mysql_query("SELECT * FROM `weapon` WHERE `name`='".$namee[0]."' LIMIT 1");
$re1 = mysql_num_rows($req1);
$re2 = mysql_fetch_array($req1);
$sila=$udata4-$row[p_dam];
$udata3=$sila+$re2[p_dam];
$sila1=$udata83-$row[m_dam];
$udata82=$sila1+$re2[m_dam];
mysql_query("UPDATE `users` SET `udata4`='$udata4', `udata83`='$udata83' WHERE `udata0`='$log'");
if($row[bodypart]=="lrhand"){
mysql_query("UPDATE `users` SET `udata12`='$namee[0]',`udata45`='$namee[0]' WHERE `udata0`='$log'");}else{
mysql_query("UPDATE `users` SET `udata12`='$namee[0]' WHERE `udata0`='$log'");}
mysql_query("UPDATE `weapon_item` SET `name`='$namee[0]', `p_dam`='$re2[p_dam]', `m_dam`='$re2[m_dam]' WHERE `login`='$log' and `name`='$udata12'");
echo"$udata12 Неудача! Заточка потеряна.";
}
}
}else{
$namee=explode("*",$udata12);
if($namee[1]<=4){
if($row[weaponType]=="dual"){
if(empty($namee[2])){
$nam="$namee[0]*$namee[1]*1";}else{
$kol=$namee[2]+1;
$nam="$namee[0]*$namee[1]*$kol";}
}else{
if(empty($namee[1])){
$nam="$namee[0]*1";}else{
$kol=$namee[1]+1;
$nam="$namee[0]*$kol";}}
$udata83=$udata83+2;
$row[m_dam]=$row[m_dam]+2;
mysql_query("UPDATE `weapon_item` SET `name`='$nam' WHERE `login`='$log' and `name`='$udata12' LIMIT 1 ");
mysql_query("UPDATE `weapon_item` SET `m_dam`='$row[m_dam]' WHERE `login`='$log' and `name`='$nam' LIMIT 1 ");
mysql_query("UPDATE `users` SET `udata83`='$udata83' WHERE `udata0`='$log'");
if($row[bodypart]=="lrhand"){
mysql_query("UPDATE `users` SET `udata12`='$nam',`udata45`='$nam' WHERE `udata0`='$log'");}else{
mysql_query("UPDATE `users` SET `udata12`='$nam' WHERE `udata0`='$log'");}
echo"Заточено";
}else
if($namee[1]>4){
$rand=rand(1,5);
if($rand!==3 and $rand!==5){
if($row[weaponType]=="dual"){
if(empty($namee[2])){
$nam="$namee[0]*$namee[1]*1";}else{
$kol=$namee[2]+1;
$nam="$namee[0]*$namee[1]*$kol";}
}else{
if(empty($namee[1])){
$nam="$namee[0]*1";}else{
$kol=$namee[1]+1;
$nam="$namee[0]*$kol";}}
$udata83=$udata83+2;
$row[m_dam]=$row[m_dam]+2;
mysql_query("UPDATE `weapon_item` SET `name`='$nam' WHERE `login`='$log' and `name`='$udata12' LIMIT 1 ");
mysql_query("UPDATE `weapon_item` SET `m_dam`='$row[m_dam]' WHERE `login`='$log' and `name`='$nam' LIMIT 1 ");
mysql_query("UPDATE `users` SET `udata83`='$udata83' WHERE `udata0`='$log'");
if($row[bodypart]=="lrhand"){
mysql_query("UPDATE `users` SET `udata12`='$nam',`udata45`='$nam' WHERE `udata0`='$log'");}else{
mysql_query("UPDATE `users` SET `udata12`='$nam' WHERE `udata0`='$log'");}
echo"Заточено";
}else{
$namee=explode("*",$udata12);
$req1 = mysql_query("SELECT * FROM `weapon` WHERE `name`='".$namee[0]."' LIMIT 1");
$re1 = mysql_num_rows($req1);
$re2 = mysql_fetch_array($req1);
$sila=$udata4-$row[p_dam];
$udata3=$sila+$re2[p_dam];
$sila1=$udata83-$row[m_dam];
$udata82=$sila1+$re2[m_dam];
mysql_query("UPDATE `users` SET `udata4`='$udata4', `udata83`='$udata83' WHERE `udata0`='$log'");
if($row[bodypart]=="lrhand"){
mysql_query("UPDATE `users` SET `udata12`='$namee[0]',`udata45`='$namee[0]' WHERE `udata0`='$log'");}else{
mysql_query("UPDATE `users` SET `udata12`='$namee[0]' WHERE `udata0`='$log'");}
mysql_query("UPDATE `weapon_item` SET `name`='$namee[0]', `p_dam`='$re2[p_dam]', `m_dam`='$re2[m_dam]' WHERE `login`='$log' and `name`='$udata12'");
echo"$udata12 Неудача! Заточка потеряна.";
}
}
}}
break;
case 'default':
echo "<a href="blessedscroll.php?&go=vid&tip=golova">Заточить шлем</a></br/>";
echo "<a href="blessedscroll.php?&go=vid&tip=weapon">Заточить оружие </a></br/>";
echo "<a href="blessedscroll.php?&go=vid&tip=shield">Заточить щит</a></br/>";
echo "<a href="blessedscroll.php?&go=vid&tip=armor">Заточить доспехи</a></br/>";
echo "<a href="blessedscroll.php?&go=vid&tip=up">Заточить верх</a></br/>";
echo "<a href="blessedscroll.php?&go=vid&tip=down">Заточить низ</a></br/>";
echo "<a href="blessedscroll.php?&go=vid&tip=gloves">Заточить перчатки</a><br>";
echo "<a href="blessedscroll.php?&go=vid&tip=nogi">Заточить ботинки</a></br/>";
break;
case 'vid':
if($tip=="weapon"){
echo"<a href="blessedscroll.php?&go=weapon&vid=fiz">Физ.Атака</a></br/>";
echo"<a href="blessedscroll.php?&go=weapon&vid=mag">Маг.Атака</a></br/>";}else{
echo"<a href="blessedscroll.php?&go=".$tip."&vid=fiz">Физ.Защита</a></br/>";
echo"<a href="blessedscroll.php?&go=".$tip."&vid=mag">Маг.Защита</a></br/>";
}
break;
}
}
include_once"files/down.php";
?>