<?php
include 'core/system.php';
head('Артефакты');
reg();
$sql = $dbc->query("SELECT * FROM `artefact` WHERE `user_id`='".$user['id']."' AND `status` = 2 ORDER by `art_id` ");
$total = $dbc->query("SELECT `id` FROM `artefact` where `user_id` ='".$user['id']."' AND `status` = 2 "); $total = $total->num_rows;
if($total==0){
echo '<div class="main"><div class="block_zero center">Ничего не Одето!</div></div>';
foot();
exit;
}
while($row = $sql->fetch_assoc()){
if($row['mag']==1){ $mag =' style="box-shadow: 0px 0px 20px blue; margin: 2px;">';}
elseif($row['mag']==2){ $mag =' style="box-shadow: 0px 0px 20px violet; margin: 2px;">';}
elseif($row['mag']==3){ $mag =' style="box-shadow: 0px 0px 20px gold; margin: 2px;">';}
elseif($row['mag']==4){ $mag =' style="box-shadow: 0px 0px 20px #780A00; margin: 2px;">';}
elseif($row['mag']==0){ $mag ='>';}
if($row['craft']>0){ $fla = '<span class="info">+'.$row['craft'].''; }else{ $fla = '';}
if($row['up']>0){ $flas = '<span class="info">*'.$row['up'].''; }else{ $flas = '';}
?><div class="sblue-panel"><div class="panel-inner-3"><table width="100%" border="0" cellpadding="0" cellspacing="0"><tr><td width="37" style="vertical-align: top;"><img width="32"height="32" src="img/items/<?=$row['img']?>.png" alt="."border="0" <?=$mag?></td><td><div><a href="/info_art.php?ids=<?=$row['id']?>" class="<?=$row['lite']?>"><center><?=$row['nik']?></a><?=$fla?><?=$flas?></center></div><span class="nowrap"></span> <span class="nowrap"></span><span class="clearer"></span></td><td width="60"><a href="/my_art?id=<?=$row['id']?><??>&off" class="gr-btn center"><span>Снять</span></a></td></tr></table></div></div><?
echo' </div>';
if(isset($_GET['off']) and !empty($_GET['id'])){
$pet_id = int($_GET['id']);
$pet = $dbc->query("SELECT * FROM `artefact` WHERE `id`='".$pet_id."' AND `user_id`='".$user['id']."' LIMIT 1")->fetch_assoc();
if(!$pet){
header("Location: my_art");
exit;
}
if($pet['status']==1){
header("Location: my_art");
exit;
}
if($pet['tip']==1){ $dbc->query("UPDATE `users` SET `strength`=`strength`-'".$pet['strong']."',`max_health`=`max_health`-'".$pet['hp']."',`defense`=`defense`-'".$pet['prot']."',`regen`=`regen`-'".$pet['regen']."',`crit`=`crit`-'".$pet['crit']."',`helmet`=0 ,`vampir`=`vampir`-'".$pet['vamp']."',`sokru`=`sokru`-'".$pet['sok']."' WHERE `id`='".$user['id']."'");}
if($pet['tip']==2){ $dbc->query("UPDATE `users` SET `strength`=`strength`-'".$pet['strong']."',`max_health`=`max_health`-'".$pet['hp']."',`defense`=`defense`-'".$pet['prot']."',`regen`=`regen`-'".$pet['regen']."',`crit`=`crit`-'".$pet['crit']."',`plesh`=0 ,`vampir`=`vampir`-'".$pet['vamp']."',`sokru`=`sokru`-'".$pet['sok']."' WHERE `id`='".$user['id']."'");}
if($pet['tip']==3){ $dbc->query("UPDATE `users` SET `strength`=`strength`-'".$pet['strong']."',`max_health`=`max_health`-'".$pet['hp']."',`defense`=`defense`-'".$pet['prot']."',`regen`=`regen`-'".$pet['regen']."',`crit`=`crit`-'".$pet['crit']."',`armor`=0 ,`vampir`=`vampir`-'".$pet['vamp']."',`sokru`=`sokru`-'".$pet['sok']."' WHERE `id`='".$user['id']."'");}
if($pet['tip']==4){ $dbc->query("UPDATE `users` SET `strength`=`strength`-'".$pet['strong']."',`max_health`=`max_health`-'".$pet['hp']."',`defense`=`defense`-'".$pet['prot']."',`regen`=`regen`-'".$pet['regen']."',`crit`=`crit`-'".$pet['crit']."',`weapon`=0 ,`vampir`=`vampir`-'".$pet['vamp']."',`sokru`=`sokru`-'".$pet['sok']."' WHERE `id`='".$user['id']."'");}
if($pet['tip']==5){ $dbc->query("UPDATE `users` SET `strength`=`strength`-'".$pet['strong']."',`max_health`=`max_health`-'".$pet['hp']."',`defense`=`defense`-'".$pet['prot']."',`regen`=`regen`-'".$pet['regen']."',`crit`=`crit`-'".$pet['crit']."',`zashita`=0 ,`vampir`=`vampir`-'".$pet['vamp']."',`sokru`=`sokru`-'".$pet['sok']."' WHERE `id`='".$user['id']."'");}
if($pet['tip']==6){ $dbc->query("UPDATE `users` SET `strength`=`strength`-'".$pet['strong']."',`max_health`=`max_health`-'".$pet['hp']."',`defense`=`defense`-'".$pet['prot']."',`regen`=`regen`-'".$pet['regen']."',`crit`=`crit`-'".$pet['crit']."',`kolco`=0 ,`vampir`=`vampir`-'".$pet['vamp']."',`sokru`=`sokru`-'".$pet['sok']."' WHERE `id`='".$user['id']."'");}
if($pet['tip']==7){ $dbc->query("UPDATE `users` SET `strength`=`strength`-'".$pet['strong']."',`max_health`=`max_health`-'".$pet['hp']."',`defense`=`defense`-'".$pet['prot']."',`regen`=`regen`-'".$pet['regen']."',`crit`=`crit`-'".$pet['crit']."',`pos`=0 ,`vampir`=`vampir`-'".$pet['vamp']."',`sokru`=`sokru`-'".$pet['sok']."' WHERE `id`='".$user['id']."'");}
if($pet['tip']==8){ $dbc->query("UPDATE `users` SET `strength`=`strength`-'".$pet['strong']."',`max_health`=`max_health`-'".$pet['hp']."',`defense`=`defense`-'".$pet['prot']."',`regen`=`regen`-'".$pet['regen']."',`crit`=`crit`-'".$pet['crit']."',`she`=0 ,`vampir`=`vampir`-'".$pet['vamp']."',`sokru`=`sokru`-'".$pet['sok']."' WHERE `id`='".$user['id']."'");}
if($pet['tip']==9){ $dbc->query("UPDATE `users` SET `strength`=`strength`-'".$pet['strong']."',`max_health`=`max_health`-'".$pet['hp']."',`defense`=`defense`-'".$pet['prot']."',`regen`=`regen`-'".$pet['regen']."',`crit`=`crit`-'".$pet['crit']."',`art`=0 ,`vampir`=`vampir`-'".$pet['vamp']."',`sokru`=`sokru`-'".$pet['sok']."' WHERE `id`='".$user['id']."'");}
$dbc->query("UPDATE `artefact` SET `status`=1 WHERE `id`='".$pet_id."'");
$_SESSION['message'] = 'Вы сняли '.$pet[nik].'';
header('Location: my_art?');exit();
foot();
}
}
foot();
?>