<?php

require_once 'core/system.php';












$vevo = $dbc->query("SELECT * FROM `artefact` WHERE `tip`=9 AND `status`=2 AND `user_id`='".$user['id']."' LIMIT 1")->fetch_assoc(); 


head(''.$vevo['nik'].'');
reg();
if(!$vevo){


header("location:index.php");
        


exit;}




$sila = $vevo['strong'] * 5 / 100;



$silas = $sila +$vevo['strong'];




$hp = $vevo['hp'] * 5 / 100;



$hps = $hp +$vevo['hp'];



$brony = $vevo['prot'] * 5 / 100;



$bronys = $brony +$vevo['prot'];


$sila  = floor($sila);
$silas  = floor($silas);

$hp  = floor($hp);
$hps  = floor($hps);
$brony  = floor($brony);
$bronys  = floor($bronys);


$kes = 50*$vevo['up'];
$kes2 = 100*$vevo['up'];

$leg  = 100;
 $leg = $leg+$kes;

$gold  = 100;
 $gold = $gold+$kes2;


if(isset($_GET['up'])){  


if($user['gold']<$gold){ $_SESSION['message']='недостаточно ресурсов'; header('location:craft_art.php');exit;}



if($user['leg']<$leg){ $_SESSION['message']='недостаточно ресурсов'; header('location:craft_art.php');exit;}



$dbc->query("UPDATE `users` SET `strength`=`strength`+'".$sila."',`max_health`=`max_health`+'".$hp."',`defense`=`defense`+'".$brony."',`gold`=`gold`-'".$gold."' ,`leg` =`leg`-'".$leg."' WHERE `id`='".$user['id']."'");


        
$dbc->query("UPDATE `artefact` SET `strong`=`strong`+'".$sila."',`hp`=`hp`+'".$hp."',`prot`=`prot`+'".$brony."', `up`=`up`+1 WHERE `id`='".$vevo['id']."'");







$_SESSION['message']='Артефакт Улучшен'; header('location:craft_art.php');exit;


}






?>
<div class="b-panel-new dblue-panel bordered mt2"><div class="panel-inner-2"><div class="font-small text-italic c-verygray"><center> У вас <img src="img/new/leg.png"><?=$user['leg']?></center></div></div></div>




<div class="b-panel-new dblue-panel bordered mt2">





<div class="gr-panel panel-inner-2 mb2">

        <div class="t">

                <img src="img/items/<?=$vevo['img']?>.png" width="46px">



                    <i></i>
                </span>
            </a>
<p>
                <span class="<?=$vevo['lite']?>"><?=$vevo['nik']?></span><br>




                <img src="/img/stat/AKulak.png">Сила: <span class="high"><?=$vevo['strong']?></span><br />





                <img src="img/stat/hp.png">Здоровье: <span class="high"><?=$vevo['hp']?></span><br />



            <img src="images/icons/armor.png">Броня: <span class="high"><?=$vevo['prot']?></span><br />


        </div>
        <div class="wrapper-btn">

</p>
        </div>
    </div><?

?><center><span class="info">После Улучшения </span></center><?

?>
<div class="gr-panel panel-inner-2 mb2">

        <div class="t">

                <img src="img/items/<?=$vevo['img']?>.png" width="46px">



                    <i></i>
                </span>
            </a>
<p>
                <span class="<?=$vevo['lite']?>"><?=$vevo['nik']?></span><br>




                <img src="/img/stat/AKulak.png">Сила: <span class="high"><?=$silas?><span class="info">(+<?=$sila?>)</span></span><br />









                <img src="img/stat/hp.png">Здоровье: <span class="high"><?=$hps?><span class="info">(+<?=$hp?>)</span></span></span><br />





            <img src="images/icons/armor.png">Броня: <span class="high"><?=$bronys?><span class="info">(+<?=$brony?>)</span></span></span><br />




        </div>
        <div class="wrapper-btn">

</p>
        </div>
    </div><?


?><center><span class="info">Цена улучшения</span><img src="img/money/money.png"><?=$gold?><img src="img/new/leg.png"><?=$leg?></center><?


?><center><a class="btn" href="craft_art.php?up">Улучшить</a></center><?





foot();
