<?
//
//
$type = number($_GET['type']);
if($type >= 1 && $type <= 5){
//
//
$type_color = array('1' => '#32cd32', '2' => '#a335ee', '3' => '#ff8000', '4' => '#05CCFF', '5' => '#f5270d');
$dat = array('1' => 'Обычное', '2' => 'Редкое', '3' => 'Эпическое', '4' => 'Легендарное', '5' => 'Мифическое');
//
//
//
if(isset($_GET['view'])){
$id = abs(intval($_GET['view']));
$item = fch("SELECT * FROM `items` WHERE `id` = ? LIMIT 1", array($id));
if(!$item){
header('location:?r='.$r);
exit();
}
$inv = fch("SELECT * FROM `inv` WHERE `type` = ? AND `yes` = ? AND `id_user` = ? LIMIT 1", array($item['type'],1,$uid));
$param_1 = $inv['power']+$inv['block']+$inv['health'];
$param_2 = $item['power']+$item['block']+$item['health'];
if($param_1 >= $param_2){
$param = "Хуже: <font color='red'>-".($param_1-$param_2)."</font>";
}
elseif($param_1 < $param_2){
$param = "Лучше: <font color='lime'>+".($param_2-$param_1)."</font>";
}
$param_11 = $item['power']+$item['block']+$item['health'];
$param_21 = $inv['power']+$inv['block']+$inv['health'];
if($param_11 >= $param_21){
$param2 = "Хуже: <font color='red'>-".($param_11-$param_21)."</font>";
}
elseif($param_11 < $param_21){
$param2 = "Лучше: <font color='lime'>+".($param_21-$param_11)."</font>";
}
echo "
<div class='tophead'>
<div class='ohh'>
<img class = 'imgItem".$item['set']."' src = '/images/items/".$item['set']."/".$item['type'].".png' width='50' height='50'>
</div>
<font color = '".$type_color[$item['set']]."'>".$item['name']."</font> <small>(0/".$item['max_smitch'].")</small
<small>
<br>".$param."<br><br>
</small>
</div>
";
echo "
<div class = 'tophead'>
<img src='/images/type".$item['set'].".png' width='' height=''> <font color = '".$type_color[$item['set']]."'>".$dat[$item['set']]." качество</font> <br>
<img src='/images/shop.png' width='17' height='17'> Уровень заточки: <a href='/shop.php?loc=2'><span class='orange'>+0</span><br>
</div>
<div class = 'tophead'>
<img src='/images/power.png'> Сила: ".$item['power']."<br>
<img src='/images/block.png'> Защита: ".$item['block']."<br>
<img src='/images/health.png'> Здоровье: ".$item['health']."<br>
</div>
";
echo "
<a href = '/shop.php?loc=1&type=".$item['set']."' class='tophead'>Вернуться назад</a>
";
foot($uid);
exit();
}
//
//
//
if(isset($_GET['pay'])){
$id = abs(intval($_GET['pay']));
$item = fch("SELECT * FROM `items` WHERE `id` = ? LIMIT 1", array($id));
if(!$item){
header('location:?loc='.$loc.'&type='.$item['set']);
exit();
}
$count = $BaseConnect->query("SELECT (id) FROM `inv` WHERE `yes` = '0' AND `id_user` = '".$uid."'")->rowCount();
if($count >= $user['limit_inv']){
err2("Недостаточно места в рюкзаке!");
header('location:?loc='.$loc.'&type='.$item['set']);
exit();
}
//
//
if($user['premium_time'] > time()){
//
//
$gold1 = intval($item['gold']*15/100);
$gold = $item['gold']-$gold1;
//
//
$res1 = intval($item['res']*15/100);
$res = $item['res']-$res1;
//
//
}
else{
//
//
$gold = $item['gold'];
$res = $item['res'];
//
//
}
//
//
if($user['gold'] < $gold){
ruby(null);
header('location:?loc='.$loc.'&type='.$item['set']);
exit();
}
//
//
if($user['metal'] < $res){
err2("Недостаточно ресурсов!");
header('location:?loc='.$loc.'&type='.$item['set']);
exit();
}
if($user['tkan'] < $res){
err2("Недостаточно ресурсов!");
header('location:?loc='.$loc.'&type='.$item['set']);
exit();
}
qry("INSERT INTO `inv` SET `id_user` = ?, `set` = ?, `power` = ?, `block` = ?, `health` = ?, `smitch` = ?, `max_smitch` = ?, `yes` = ?, `type` = ?, `name` = ?, `level` = ?", array($uid,$item['set'],$item['power'],$item['block'],$item['health'],0,$item['max_smitch'],0,$item['type'],$item['name'],$item['level']));
if($item['set'] == 5){
qry("UPDATE `users` SET `gold` = `gold` - ? WHERE `id` = ? LIMIT 1", array($gold,$uid));
}else{
qry("UPDATE `users` SET `metal` = `metal` - ?, `tkan` = `tkan` - ? WHERE `id` = ? LIMIT 1", array($res,$res,$uid));
}
msg2("<div style='clear:both;'></div><div class='b-notice trsmgr'><div class='notify-inner'>Вещь приобретена и находиться в рюкзаке! </div></div> ");
header('location:?loc='.$loc.'&type='.$item['set']);
exit();
}
//
//
$text = array(
'',
'Обычное снаряжение не очень надежно, подходит только для неопытных воинов!',
'Редкое снаряжение прочное и легкое, поможет вам сохранить жизнь в бою!',
'Эпическое снаряжение куют в королевской кузнице, его носят гвардейцы и рыцари!',
'Легендарное снаряжение сложно сделать, способы его создания были утеряны, только избранные знают секрет изготовления!',
'Мифическое снаряжение нельзя создать, ходят легенды что его изготовили сами боги, у меня есть лишь один комплект!'
);
//
//
$inv_tav = $BaseConnect->query("SELECT (id) FROM `inv` WHERE `yes` = '0' AND `id_user` = '".$uid."'")->rowCount();
if($inv_tav >= 1 && $tavern['id_quest'] == 1){
qry("UPDATE `tavern` SET `id_quest` = ? WHERE `id_user` = ? LIMIT 1", array(2,$uid));
}
//
//
?>
<div class="tophead">
<div class = "ohh">
<img class='img4' src = '/images/shop1.png' widht='50px' height='50px'>
</div>
<span class="lime">
Лютер
</span>
<br>
<small>
<?=$text[$type];?>
</small>
</div>
<?
$item = fch("SELECT * FROM `items` WHERE `set` = ? LIMIT 1", array($type));
//
//
if(!$item){
header('location:?r='.$r);
exit();
}
//
//
?>
<div class="tophead2 cntr">
<?
if($type == 5){
echo "У вас: <img class = '' src = '/images/ruby.png' width='16' height='16'> ".$user['gold']." рубинов";
}else{
echo "У вас:
<img class = '' src = '/images/metal.png' width='16' height='16'> ".$user['metal']."
<img class = '' src = '/images/tkan.png' width='16' height='16'>
".$user['tkan']."
";
}
?>
</div>
<?
//
//
$msg_q = $BaseConnect->query("SELECT * FROM `items` WHERE `set` = '".$type."' ORDER BY `id`");
//
//
while($msg = $msg_q->fetch(PDO::FETCH_ASSOC)){
//
//
$inv = fch("SELECT * FROM `inv` WHERE `type` = ? AND `yes` = ? AND `id_user` = ? LIMIT 1", array($msg['type'],1,$uid));
//
//
$param_1 = $inv['power']+$inv['block']+$inv['health'];
$param_2 = $msg['power']+$msg['block']+$msg['health'];
//
//
if($param_1 >= $param_2){
$param = "Хуже: <font color='red'>-".($param_1-$param_2)."</font>";
}
elseif($param_1 < $param_2){
$param = "Лучше: <font color='lime'>+".($param_2-$param_1)."</font>";
}
//
//
if($user['premium_time'] > time()){
//
//
$gold1 = intval($msg['gold']*15/100);
$gold = $msg['gold']-$gold1;
//
//
$res1 = intval($msg['res']*15/100);
$res = $msg['res']-$res1;
//
//
}
else{
//
//
$gold = $msg['gold'];
$res = $msg['res'];
//
//
}
//
//
echo "
<div class = 'tophead'> ";
echo "
<a class = 'button'style='float: right;' href = '?loc=".$loc."&type=".$msg['set']."&pay=".$msg['id']."'>
";
if($type == 5){
echo "Купить <img class = '' src = '/images/ruby.png' width='16' height='16'> ".$gold." ";
}else{
echo "Создать";
}
echo "
</a>
";
echo"
<div class='ohh'>
<img class = 'imgItem".$type."' src = '/images/items/".$msg['set']."/".$msg['type'].".png' width='50' height='50'>
</div>
<a href = '?loc=".$loc."&type=".$msg['set']."&view=".$msg['id']."'> <font color='".$type_color[$type]."'><u>".$msg['name']."</u></font></a>
<small>
(0/".$msg['max_smitch'].")
<br>
".$param."
<br>
";
if($type != 5)echo "
Стоимость: <img class = '' src = '/images/metal.png' width='16' height='16'> ".$res."
<img class = '' src = '/images/tkan.png' width='16' height='16'>
".$res."
";
else
echo "
<br>
";
//
//
echo "</small>
</div> ";
}
//
//
?>
<a href="?loc=1" class="tophead">Вернуться назад</a>
<?
//
//
foot($uid);
exit();
}
//
?>
<div class="tophead">
<div class = "ohh">
<img class='img4' src = '/images/shop1.png' widht='50px' height='50px'>
</div>
<span class="lime">
Лютер
</span>
<br>
<script></script>
<small>
Эй ! <br> В моем арсенале ты найдешь самое лучшее снаряжение в королевстве!
</small>
</div> <br>
<a href="?loc=<?=$loc;?>&type=5" class="tophead">
<img class='img1' src = '/images/type5.png' widht='' height=''>
<font color="#f5270d">
Мифическое качество
</font>
<span style="float: right;">
<small>
<span class="yellow">
20 ур
</span>
</small>
</span>
</a>
<a href="?loc=<?=$loc;?>&type=4" class="tophead">
<img class='img1' src = '/images/type4.png' widht='' height=''>
<font color="#05CCFF">
Легендарное качество
</font>
<span style="float: right;">
<small>
<span class="yellow">
15 ур
</span>
</small>
</span>
</a>
<a href="?loc=<?=$loc;?>&type=3" class="tophead">
<img class='img1' src = '/images/type3.png' widht='' height=''>
<font color="#ff8000">
Эпическое качество
</font>
<span style="float: right;">
<small>
<span class="yellow">
10 ур
</span>
</small>
</span>
</a>
<a href="?loc=<?=$loc;?>&type=2" class="tophead">
<img class='img1' src = '/images/type2.png' widht='' height=''>
<font color="#a335ee">
Редкое качество
</font>
<span style="float: right;">
<small>
<span class="yellow">
5 ур
</span>
</small>
</span>
</a>
<a href="?loc=<?=$loc;?>&type=1" class="tophead">
<img class='img1' src = '/images/type1.png' widht='' height=''>
<font color="#32cd32">
Обычное качество
</font>
<span style="float: right;">
<small>
<span class="yellow">
1 ур
</span>
</small>
</span>
</a>
<a href="/shop.php" class="tophead">Вернуться назад</a>