Файл: pesn_voini/peseni_vojni/instalscript/engine/public/rack/index.php
Строк: 301
<?
require_once($_SERVER['DOCUMENT_ROOT']."/instalscript/engine/_inc/sys.php");
head("Рюкзак",$uid); # Голова
echo logs();
$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');
$case = array('1' => '100', '2' => '500', '3' => '1000', '4' => '5000', '5' => '10000', '6' => '25000');
$count_set = $BaseConnect->query("SELECT (id) FROM `inv` WHERE `yes` = '0' AND `id_user` = '".$uid."' AND `set` = '1'")->rowCount();
$count_set2 = $BaseConnect->query("SELECT (id) FROM `inv` WHERE `yes` = '0' AND `id_user` = '".$uid."' AND `set` = '2'")->rowCount();
$count_set3 = $BaseConnect->query("SELECT (id) FROM `inv` WHERE `yes` = '0' AND `id_user` = '".$uid."' AND `set` = '3'")->rowCount();
//
//
$count3 = $BaseConnect->query("SELECT (id) FROM `inv` WHERE `yes` = '1' AND `id_user` = '".$uid."'")->rowCount();
if($user['start'] == 3 && $count_set == 0 && $count3 >= 5){
qry("UPDATE `users` SET `start` = ? WHERE `id` = ? LIMIT 1", array(4,$uid));
header('location:?r='.$r);
exit();
}
//
//
$case_one1 = $case[1];
$case_one2 = $case[2];
$case_one3 = $case[3];
$silver1 = $case_one1*$count_set;
$silver2 = $case_one2*$count_set2;
$silver3 = $case_one3*$count_set3;
$silver = $silver1+$silver2+$silver3;
$buy = abs(intval($_GET['buy']));
if($buy == 1){
echo "
<div class = 'message cntr'>
Вы уверены что хотите <b>расширить рюкзак</b>?<br>+10 свободного места, за <b>1000 золота</b>.<br>
<form action = '?buy=2' method = 'post'>
<input type = 'submit' name = '' class = 'btn btn-blue w50' value = 'Расширить'>
</form>
</div>
<div class = 'message'>
<a href = '/rack/'>Вернуться назад</a><br>
</div>
";
foot($uid);
exit();
}
if($buy == 2){
if($user['gold'] <= 999){
err('Недостаточно золота - <a href="/paywk/">[Купить золото]</a>');
header('location:?buy=1&r='.$r);
exit();
}
qry("UPDATE `users` SET `gold` = `gold` - ?, `limit_inv` = `limit_inv` + ? WHERE `id` = ? LIMIT 1", array(1000,10,$uid));
msg('Рюкзак успешно расширен!');
header('location:?r='.$r);
exit();
}
if(isset($_GET['del'])){
$id = abs(intval($_GET['del']));
$inv2 = fch("SELECT * FROM `inv` WHERE `yes` = ? AND `id_user` = ? AND `id` = ? LIMIT 1", array(0,$uid,$id));
if(!$inv2){
header('location:?r='.$r);
exit();
}
$silver = $case[$inv2['set']];
qry("UPDATE `users` SET `silver` = `silver` + ? WHERE `id` = ? LIMIT 1", array($silver,$uid));
qry("DELETE FROM `inv` WHERE `id_user` = ? AND `yes` = ? AND `id` = ?", array($uid,0,$inv2['id']));
msg("Вещь успешно продана");
header('location:?');
exit();
}
$del_item = abs(intval($_GET['del_item']));
if($del_item >= 1){
$invs = fch("SELECT * FROM `inv` WHERE `yes` = ? AND `id_user` = ? AND `id` = ? LIMIT 1", array(0,$uid,$del_item));
if(!$invs){
header('location:?r='.$r);
exit();
}
$silver = $case[$invs['set']];
echo "
<div class = 'message cntr'>
Вы уверены что хотите продать <b>".$invs['name']."</b>?
<br>
<a href = '?del=".$del_item."'>Да, продать</a> - <a href = '?view=".$del_item."'>Нет, передумал</a>
</div>";
}
if(isset($_GET['del_set'])){
if($count_set+$count_set2+$count_set3 <= 0){
err("У вас нет вещей этого качества - <a href='/shop/item/'>[Купить]</a>");
header('location:?');
exit();
}
qry("UPDATE `users` SET `silver` = `silver` + ? WHERE `id` = ? LIMIT 1", array($silver,$uid));
qry("DELETE FROM `inv` WHERE `id_user` = ? AND `yes` = ? AND `set` < ?", array($uid,0,4));
msg("Вещи успешно проданы");
header('location:?');
exit();
}
if(isset($_GET['view'])){
$id = abs(intval($_GET['view']));
$item = fch("SELECT * FROM `inv` WHERE `id_user` = ? AND `yes` = ? AND `id` = ? LIMIT 1", array($uid,0,$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']+$inv['energy'];
$param_2 = $item['power']+$item['block']+$item['health']+$item['energy'];
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'] + $item['energy'];
$param_21 = $inv['power']+$inv['block']+$inv['health'] + $inv['energy'];
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'>
<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']."/".$item['set']."/".$item['type'].".jpg)'>
</span>
</span>
</span>
</td>
<td>
".$item['name']."
<span style = 'float: right;'>
<a href = '?view=".$item['id']."&del_item=".$item['id']."'>Продать за <img class = 'money' src = '/instalscript/images/user/stat/money-silver.gif'>".$case[$item['set']]."
</a>
</span>
";
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>
Мана: ".$item['energy']."<br>
</div>
";
if($user['level'] >= $item['level']){
echo "
<center>
<form action = '?open=".$item['id']."' method = 'post'>
<input type = 'submit' name = '' class = 'btn btn-blue w50' value = 'Надеть'>
</form>
</center>
";
}
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']."<br>
Мана: ".$inv['energy']."
</div>
";
}
echo "
<div class = 'message'>
<a href = '/rack/'>Вернуться назад</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'])){
$id = abs(intval($_GET['open']));
$item2 = fch("SELECT * FROM `inv` WHERE `id_user` = ? AND `yes` = ? AND `id` = ? LIMIT 1", array($uid,0,$id));
if(!$item2){
header('location:?r='.$r);
exit();
}
if($user['level'] < $item2['level']){
err("Вещь можно надеть с <b>".$item2['level']."</b> уровня</a>");
header('location:?');
exit();
}
if($count == $user['limit_inv']){
err("У вас недостаточно места в рюкзаке, для того чтобы надеть вещь - <a href='?buy=1'>[Расширить рюкзак]</a>");
header('location:?');
exit();
}
$inv = fch("SELECT * FROM `inv` WHERE `type` = ? AND `yes` = ? AND `id_user` = ? LIMIT 1", array($item2['type'],1,$uid));
//
//
if($inv){
//
$param = (($user['power']-$inv['power'])+$item2['power']);
$en = (($user['energy_max']-$inv['energy'])+$item2['energy']);
//
qry("UPDATE `users` SET `power` = ?, `block` = ?, `health` = ?,`energy_max` = ? WHERE `id` = ? LIMIT 1", array($param,$param,$param,$en,$uid));
//
if($item2['smitch'] == 0 && $inv['smitch'] >= 1 && $item2['set'] >= $inv['set']){
$stat = ($inv['smitch']*3);
//
qry("UPDATE `inv` SET `power` = `power` + ?, `block` = `block` + ?, `health` = `health` + ?, `smitch` = ? WHERE `id` = ? LIMIT 1", array($stat,$stat,$stat,$inv['smitch'],$item2['id']));
//
qry("UPDATE `inv` SET `power` = `power` - ?, `block` = `block` - ?, `health` = `health` - ?, `smitch` = ? WHERE `id` = ? LIMIT 1", array($stat,$stat,$stat,0,$inv['id']));
//
qry("UPDATE `users` SET `power` = `power` + ?, `block` = `block` + ?, `health` = `health` + ? WHERE `id` = ? LIMIT 1", array($stat,$stat,$stat,$uid));
//
//
}
//
//
if($item2['rune'] == 0 && $inv['rune'] >= 1 && $item2['set'] >= $inv['set']){
$stat2 = $inv['rune_param'];
//
qry("UPDATE `inv` SET `power` = `power` + ?, `block` = `block` + ?, `health` = `health` + ?, `rune` = ?, `rune_param` = ? WHERE `id` = ? LIMIT 1", array($stat2,$stat2,$stat2,$inv['rune'],$inv['rune_param'],$item2['id']));
//
qry("UPDATE `inv` SET `power` = `power` - ?, `block` = `block` - ?, `health` = `health` - ?, `rune` = ?, `rune_param` = ? WHERE `id` = ? LIMIT 1", array($stat2,$stat2,$stat2,0,0,$inv['id']));
//
qry("UPDATE `users` SET `power` = `power` + ?, `block` = `block` + ?, `health` = `health` + ? WHERE `id` = ? LIMIT 1", array($stat2,$stat2,$stat2,$uid));
//
//
}
//
//
qry("UPDATE `inv` SET `yes` = ? WHERE `id` = ? LIMIT 1", array(0,$inv['id']));
qry("UPDATE `inv` SET `yes` = ? WHERE `id` = ? LIMIT 1", array(1,$item2['id']));
//
//
}else{
//
//
qry("UPDATE `users` SET `power` = `power` + ?, `block` = `block` + ?, `health` = `health` + ?, `energy_max` = `energy_max`+ ? WHERE `id` = ? LIMIT 1", array($item2['power'],$item2['block'],$item2['health'],$item2['energy'],$uid));
//
qry("UPDATE `inv` SET `yes` = ? WHERE `id` = ? LIMIT 1", array(1,$item2['id']));
//
//
}
//
//
//
//
msg("Вещь успешно надета");
header('location:?');
exit();
}
if($user['start'] == '3')echo '<div class="message cntr">Наденьте все снаряжение!</div>';
if($user['start'] == '4')echo '<div class="message cntr">Отлично!<br>Теперь вы стали гораздо сильнее, возвращайтесь в город!</div>';
if($user['start'] == '5')echo '<div class="message cntr">В этом мире без ресурсов не выжить, самое время грабежей!<br>Задача: Возвращайтесь в город</div>';
if($count <= 0)echo '<div class="message cntr">Рюкзак пуст - <a href="/shop/item/">[Купить снаряжение]</a></div>';
$msg_q = $BaseConnect->query("SELECT * FROM `inv` WHERE `id_user` = '".$uid."' AND `yes` = '0' ORDER BY `set` DESC");
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']+$inv['energy'];
$param_2 = $msg['power']+$msg['block']+$msg['health']+$msg['energy'];
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>";
}
echo "
<div class = 'message'>
<table>
<td class = 'w1px'>
<a href = '?view=".$msg['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']."/".$msg['set']."/".$msg['type'].".jpg)'>
</span>
</span>
</span>
</td>
<td>
<a href = '?view=".$msg['id']."'>".$msg['name']."</a>
";
if($user['level'] < $msg['level']){
echo " - <font color= '#f5270d'><small><b>".$msg['level']."</b> ур</small></font>";
}
echo "
<br>
<font color = '".$color[$msg['set']]."'>".$dat[$msg['set']]." <small>[".$msg['smitch']."/".$msg['max_smitch']."]</small></font>
<br>".$param."<br>
</td>
</table>
</div>
";
if($user['level'] >= $msg['level']){
echo "
<center>
<form action = '?open=".$msg['id']."' method = 'post'>
<input type = 'submit' name = '' class = 'btn btn-blue w50' value = 'Надеть'>
</form>
</center>
";
}
}
if($count_set+$count_set2+$count_set3 >= 1){
echo "
<div class = 'hr'></div>
<div class = 'message cntr'>
<a href = '?del_set'>Продать ненужные вещи за <img class = 'money' src = '/instalscript/images/user/stat/money-silver.gif'>".$silver." серебра</a>
<br>Обычное, Редкое и Эпическое качество</div>
";
}
foot($uid);
?>