File size: 8.36Kb
<?
require_once'../core/system.php';
echo only_reg();
echo ban();
echo blok();
$header='Выбор руны';
require_once'../core/head.php';
if($user['level']<10){
header('location: /');
$_SESSION['err'] = 'Доступно только с 10 уровня';}
$kompls = mysql_query("SELECT * from `kompl_us` where `id` = '".intval($_GET['id'])."' and `id_us`='$user[id]'");
$avto=mysql_num_rows($kompls);
if($avto==0){header("location: /smith");
$_SESSION['err'] = 'Ошибка';}
$komp2 = mysql_fetch_array($kompls);
$komp = mysql_fetch_array(mysql_query("SELECT * FROM `kompl` where `id` = '".$komp2['id_komp']."' limit 1"));
if(isset($_GET['yes'])){
$impose = intval($_GET['impose']);
if($impose==100 or $impose==300 or $impose==900 or $impose==2000 or $impose==5000 or $impose==12000){echo"";}else{header('Location: /smith/'); $err='Ошибка';}
if($komp2['fleece']==0){$cena = $impose;}
if($komp2['fleece']==50){$cena = $impose - 100;}
if($komp2['fleece']==100){$cena = $impose - 300;}
if($komp2['fleece']==300){$cena = $impose - 900;}
if($komp2['fleece']==600){$cena = $impose - 2000;}
if($komp2['fleece']==1200){$cena = $impose - 5000;}
if($impose=='100'){$next = 50;}
if($impose=='300'){$next = 100;}
if($impose=='900'){$next = 300;}
if($impose=='2000'){$next = 600;}
if($impose=='5000'){$next = 1200;}
if($impose=='12000'){$next = 2500;}
if($komp2['fleece']==0){
if($impose=='100'){$par=50;}
if($impose=='300'){$par=100;}
if($impose=='900'){$par=300;}
if($impose=='2000'){$par=600;}
if($impose=='5000'){$par=1200;}
if($impose=='12000'){$par=2500;}
} else {
if($impose=='100'){$par=50-$komp2['fleece'];}
if($impose=='300'){$par=100-$komp2['fleece'];}
if($impose=='900'){$par=300-$komp2['fleece'];}
if($impose=='2000'){$par=600-$komp2['fleece'];}
if($impose=='5000'){$par=1200-$komp2['fleece'];}
if($impose=='12000'){$par=2500-$komp2['fleece'];}
}
$infor['cena']=$cena*100;
if(empty($infor['cena'])){header('location: ?');
header('location: /');
}elseif($user['gold']<$infor['cena']){header("location: ?id=".abs(intval($_GET['id']))."");
$_SESSION['err'] = 'Недостаточно золота';
}elseif($komp2['fleece']>=$next){header("location: ?id=".abs(intval($_GET['id']))."");
$_SESSION['err'] = 'Ошибка';}else{
if($impose=='12000'){header("location: /smith");} else{header("location: ?id=".abs(intval($_GET['id']))."");}
$av = mysql_num_rows(mysql_query("SELECT * FROM `task` WHERE `usr`='$user[id]' and `status`='2' and `task`='8'"));
if($av>0){mysql_query("UPDATE `task` SET `min` = `min`+'1' WHERE `usr`='$user[id]' and `status`='2' and `task`='8'");}
$_SESSION['message'] = 'Руна успешно вставлена';
$time=time();
if($komp2['act']==1){mysql_query("UPDATE `user` set `gold` = `gold` - '".$infor['cena']."', `sila`=`sila`+$par, `zashit`=`zashit`+$par, `max_health`=`max_health`+('$par'*'10') where `id` = '".$user['id']."' limit 1");}else{
mysql_query("UPDATE `user` set `gold` = `gold` - '".$infor['cena']."' where `id` = '".$user['id']."' limit 1");}
mysql_query("UPDATE `kompl_us` set `fleece`='$next' where `id` = '".abs(intval($_GET['id']))."'");
mysql_query("INSERT INTO `logi` set `user_id` = '".$user['id']."', `text` = 'Руна', `time` = '".$time."', `kol`='".$infor['cena']."', `kto`='-'");
}}
if(isset($_GET['impose'])){
$impose = intval($_GET['impose']);
if($impose==100 or $impose==300 or $impose==900 or $impose==2000 or $impose==5000 or $impose==12000){echo"";}else{header('Location: /smith/'); $err='Ошибка';}
if($komp2['fleece']==0){$cena="$impose";}
if($komp2['fleece']==50){$cena="$impose"-100;}
if($komp2['fleece']==100){$cena="$impose"-300;}
if($komp2['fleece']==300){$cena="$impose"-900;}
if($komp2['fleece']==600){$cena="$impose"-2000;}
if($komp2['fleece']==1200){$cena="$impose"-5000;}
if($impose=='100'){$next=50;}
if($impose=='300'){$next=100;}
if($impose=='900'){$next=300;}
if($impose=='2000'){$next=600;}
if($impose=='5000'){$next=1200;}
if($impose=='12000'){$next=2500;}
if($komp2['fleece']==0){
if($impose=='100'){$par=50;}
if($impose=='300'){$par=100;}
if($impose=='900'){$par=300;}
if($impose=='2000'){$par=600;}
if($impose=='5000'){$par=1200;}
if($impose=='12000'){$par=2500;}
}else{
if($impose=='100'){$par=50-$komp2['fleece'];}
if($impose=='300'){$par=100-$komp2['fleece'];}
if($impose=='900'){$par=300-$komp2['fleece'];}
if($impose=='2000'){$par=600-$komp2['fleece'];}
if($impose=='5000'){$par=1200-$komp2['fleece'];}
if($impose=='12000'){$par=2500-$komp2['fleece'];}}
if($komp2['fleece']>=$next){header("location: ?id=".abs(intval($_GET['id']))."");
$_SESSION['err'] = 'Ошибка';}
echo "<div class='player menuList'>";
echo "</div><div class='foot center'><table class='d-grey' width='100%' border='0' cellpadding='0' cellspacing='0' style='padding-top: 5px;'>
<tbody><tr>";
echo '<div class="inpc-ar"><div class="empty2"></div>Наложить руну за <img src=/images/icon/gold.png>'.$cena.' ?<div class="empty2"></div>
<td width="40%"><a class="big-but" href="?id='.abs(intval($_GET['id'])).'&impose='.abs(intval($_GET['impose'])).'&yes"><div class="imgwrap"><img src="/images/icon/ok.png"></div>Наложить</a></td>';
echo '<td width="40%"><a class="big-but" href="?id='.abs(intval($_GET['id'])).'"><div class="imgwrap"><img src="/images/icon/error.png"></div>Отмена</a></td></tbody></table></div></div>';
echo "</div>";
echo"<div class='line'></div><div class='mli center'><div class='empty2'></div>Вещь получит дополнительно <font color='#D1D439'>+$par</font> к <img src='/images/icon/stat/hp.png'><img src='/images/icon/stat/sila.png'><img src='/images/icon/stat/prot.png'><div class='empty2'></div></div>";
include_once '../core/foot.php';exit;
}
echo"
<div class='but-list'>";
if($komp2['fleece']==0)echo"<a href='/smith/fleece?id=$komp2[id]&impose=100'><img src='/images/icon/fleece.png' > <font color='F5D188'> Простая руна</font> <span class='float-right'><font color='#D1D439'>+50</font> к <img src='/images/icon/stat/hp.png'><img src='/images/icon/stat/sila.png'><img src='/images/icon/stat/prot.png'></span></a>";
if($komp2['fleece']!=100 and $komp2['fleece']!=300 and $komp2['fleece']!=600 and $komp2['fleece']!=1200 and $komp2['fleece']!=2500)echo"<a href='/smith/fleece?id=$komp2[id]&impose=300'><img src='/images/icon/fleece2.png' > <font color='67EE70'>Обычная руна</font><span class='float-right'><font color='#D1D439'>+100</font> к <img src='/images/icon/stat/hp.png'><img src='/images/icon/stat/sila.png'><img src='/images/icon/stat/prot.png'></span></a>";
if($komp2['fleece']!=300 and $komp2['fleece']!=600 and $komp2['fleece']!=1200 and $komp2['fleece']!=2500)echo"<a href='/smith/fleece?id=$komp2[id]&impose=900'><img src='/images/icon/fleece3.png' > <font color='4385F0'>Редкая руна</font> <span class='float-right'><font color='#D1D439'>+300</font> к <img src='/images/icon/stat/hp.png'><img src='/images/icon/stat/sila.png'><img src='/images/icon/stat/prot.png'></span></a>";
if($komp2['fleece']!=600 and $komp2['fleece']!=1200 and $komp2['fleece']!=2500)echo"<a href='/smith/fleece?id=$komp2[id]&impose=2000'><img src='/images/icon/fleece4.png' > <font color='9A52E8'>Эпическая руна</font><span class='float-right'><font color='#D1D439'>+600</font> к <img src='/images/icon/stat/hp.png'><img src='/images/icon/stat/sila.png'><img src='/images/icon/stat/prot.png'></span></a> ";
if($komp2['fleece']!=1200 and $komp2['fleece']!=2500)echo"<a href='/smith/fleece?id=$komp2[id]&impose=5000'><img src='/images/icon/fleece5.png' > <font color='FF3042'>Легендарная руна</font><span class='float-right'><font color='#D1D439'>+1200</font> к <img src='/images/icon/stat/hp.png'><img src='/images/icon/stat/sila.png'><img src='/images/icon/stat/prot.png'></span></a>";
if($komp2['fleece']!=2500)echo"<a href='/smith/fleece?id=$komp2[id]&impose=12000'><img src='/images/icon/fleece6.png' > <font color='D1D439'>Божественная руна</font><span class='float-right'><font color='#D1D439'>+2500</font> к <img src='/images/icon/stat/hp.png'><img src='/images/icon/stat/sila.png'><img src='/images/icon/stat/prot.png'></span></a></div>";
echo'<div class="line"></div>
<div class="grey center mli">
<div class="empty2"></div>
Шанс 5% наложить руну лучшего качества за те же деньги.
<div class="empty2"></div>
</div>';
if($komp2['fleece']==2500){header("location: /smith");
$_SESSION['err'] = 'Ошибка!';}
require_once'../core/foot.php';
?>