Файл: pesn_voini/peseni_vojni/instalscript/engine/public/item/index.php
Строк: 162
<?
require_once($_SERVER['DOCUMENT_ROOT']."/instalscript/engine/_inc/sys.php");
head("Снаряжение",$uid); # Голова
echo logs();
$id = number($_GET['id']);
$us = fch("SELECT * FROM `users` WHERE `id` = ? LIMIT 1", array($id));
if(!$us){
header('location:?id='.$uid);
exit();
}
$dat = array('1' => 'Обычное', '2' => 'Редкое', '3' => 'Эпическое', '4' => 'Легендарное', '5' => 'Мифическое', '6' => 'Эксклюзивное');
$dat2 = array('1' => 'Обычная', '2' => 'Редкая', '3' => 'Эпическая', '4' => 'Легендарная', '5' => 'Мифическая', '6' => 'Эксклюзивная');
$color = array('1' => '', '2' => '#0070dd', '3' => '#a335ee', '4' => '#ff8000', '5' => '#05CCFF', '6' => '#f5270d');
$type = array('1' => 'Шлем', '2' => 'Наплечники', '3' => 'Броня', '4' => 'Перчатки', '5' => 'Оружие 1', '6' => 'Оружие 2', '7' => 'Штаны', '8' => 'Сапоги');
$view = abs(intval($_GET['view']));
if($view >= 1){
$item = fch("SELECT * FROM `inv` WHERE `id_user` = ? AND `yes` = ? AND `id` = ? LIMIT 1", array($id,1,$view));
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 = 'message'>
<table>
<td class = 'w1px'>
<span class = 'items-list'>
<span class = 'items-icons'>
<span class = 'items-icons-view' style = 'background-image:url(/instalscript/images/items/class/icons/".$us['class']."/".$item['set']."/".$item['type'].".jpg)'>
</span>
</span>
</span>
</td>
<td>
".$item['name']."
";
if($user['level'] < $item['level']){
echo "- <font color = '#f5270d'><small><b>".$item['level']."</b> ур</small></font>";
}
echo "
<br>
<font color = '".$color[$item['set']]."'>".$dat[$item['set']]." <small>[".$item['smitch']."/".$item['max_smitch']."]</small></font>
<br>".$param."<br>
</td>
</table>
</div>";
echo "<div class='message'>";
if($item['rune'] >= 1)echo "<img src = '/instalscript/images/icons/city/runs.png' width='18' height='18'> <font color = '".$color[$item['rune']]."'> ".$dat2[$item['rune']]." руна</font>, <font color = 'lime'>+".($item['rune_param']*3)."</font>"; else echo "<img src = '/instalscript/images/icons/city/runs.png' width='16' height='16'> Руна не установлена";
echo"</div>";
echo "<div class = 'message'>
Атака: ".$item['power']."<br>
Защита: ".$item['block']."<br>
Здоровье: ".$item['health']."<br>
</div>
";
if($item['id_user'] != $uid){
echo "<center>На вас надето:</center>";
if(!$inv){
echo "<div class = 'message cntr'>Нечего не надето - <a href = '/shop/item/'>[Купить снаряжение]</a><br></div>";
}
else{
echo "
<div class = 'message'>
<table>
<td class = 'w1px'>
<a href = '?view=".$item['id']."'>
<span class = 'items-list'>
<span class = 'items-icons'>
<span class = 'items-icons-view' style = 'background-image:url(/instalscript/images/items/class/icons/".$user['class']."/".$inv['set']."/".$inv['type'].".jpg)'>
</span>
</span>
</span>
</td>
<td>
".$item['name']."
<br>
<font color = '".$color[$inv['set']]."'>".$dat[$inv['set']]." <small>[".$inv['smitch']."/".$inv['max_smitch']."]</small></font>
<br>".$param2."<br>
</td>
</table>
</div>
";
echo "<div class='message'>";
if($inv['rune'] >= 1)echo "<img src = '/instalscript/images/icons/city/runs.png' width='18' height='18'> <font color = '".$color[$inv['rune']]."'> ".$dat2[$inv['rune']]." руна</font>, <font color = 'lime'>+".($inv['rune_param']*3)."</font>"; else echo "<img src = '/instalscript/images/icons/city/runs.png' width='16' height='16'> Руна не установлена";
echo"</div>";
echo "
<div class = 'message'>
Атака: ".$inv['power']."<br>
Защита: ".$inv['block']."<br>
Здоровье: ".$inv['health']."
</div>
";
}
}
echo "<div class = 'message'><a href = '/item/?id=".$id."'>Вернуться назад</a><br></div>";
foot($uid);
exit();
}
$count = $BaseConnect->query("SELECT (id) FROM `inv` WHERE `yes` = '0' AND `id_user` = '".$uid."'")->rowCount();
if(isset($_GET['open'])){
$id2 = abs(intval($_GET['open']));
$item2 = fch("SELECT * FROM `inv` WHERE `id_user` = ? AND `yes` = ? AND `id` = ? LIMIT 1", array($uid,1,$id2));
if(!$item2){
header('location:?r='.$r);
exit();
}
if($count == $user['limit_inv']){
err("У вас недостаточно места в рюкзаке, для того чтобы снять вещь - <a href='/rack/?buy=1'>[Расширить рюкзак]</a>");
header('location:?');
exit();
}
qry("UPDATE `users` SET `energy_max` = `energy_max` - ?,`power` = `power` - ?, `block` = `block` - ?, `health` = `health` - ? WHERE `id` = ? LIMIT 1", array($item2['energy'],$item2['power'],$item2['block'],$item2['health'],$uid));
qry("UPDATE `inv` SET `yes` = ? WHERE `id` = ? LIMIT 1", array(0,$item2['id']));
msg("Вещь успешно снята и находится в - <a href='/rack/'>[Рюкзаке]</a>");
header('location:?');
exit();
}
for($i=1;$i<=8;$i++) {
$item = fch("SELECT * FROM `inv` WHERE `type` = ? AND `yes` = ? AND `id_user` = ? LIMIT 1", array($i,1,$id));
$msg = fch("SELECT * FROM `inv` WHERE `type` = ? AND `yes` = ? AND `id_user` = ? LIMIT 1", array($i,1,$uid));
$param_2 = $item['power']+$item['block']+$item['health'];
$param_1 = $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($item){
echo "
<div class = 'message'>
<table>
<td class = 'w1px'>
<a href = '?id=".$id."&view=".$item['id']."'>
<span class = 'items-list'>
<span class = 'items-icons'>
<span class = 'items-icons-view' style = 'background-image:url(/instalscript/images/items/class/icons/".$us['class']."/".$item['set']."/".$item['type'].".jpg)'>
</span>
</span>
</span>
</td>
<td>
<a href = '?id=".$id."&view=".$item['id']."'>".$item['name']."</a> <br>
<font color = '".$color[$item['set']]."'>".$dat[$item['set']]." <small>[".$item['smitch']."/".$item['max_smitch']."]</small></font>
<br>".$param."<br>
</td>
</table>
</div>";
if($uid == $us['id']){
echo "
<center>
<form action = '?id=".$uid."&open=".$item['id']."' method = 'post'>
<input type = 'submit' name = '' class = 'btn btn-blue w50' value = 'Снять'></form>
</center>
";
}
}
else{
echo "
<div class = 'message'>
<table>
<td class = 'w1px'>
<span class = 'items-list'>
<span class = 'items-icons'>
<span class = 'items-icons-view' style = 'background-image:url(/instalscript/images/items/empty/".$i.".jpg)'>
</span>
</span>
</span>
</td>
<td>
<b>".$type[$i]."</b>
<br>
Ничего не надето
</td>
</table>
";
if($id == $uid){
echo "<a href = '/shop/item/'>Купить снаряжение</a><br>";
}
echo "
</div>
";
}
}
echo "
<div class = 'hr'></div>
<div class = 'message'>
<a href = '/profile/".$id."/'>Вернуться назад</a>
</div>
";
foot($uid);
?>