Файл: pesn_voini/peseni_vojni/instalscript/engine/public/shop/smitch.php
Строк: 70
<?php
//
require_once($_SERVER['DOCUMENT_ROOT']."/instalscript/engine/_inc/sys.php");
head("Кузница",$uid); # Голова
echo logs();
//
//
$smitch_level = array(
'0' => '5',
'1' => '1000',
'2' => '5000',
'3' => '10',
'4' => '10000',
'5' => '25000',
'6' => '50',
'7' => '50000',
'8' => '75000',
'9' => '100',
'10' => '100000',
'11' => '125000',
'12' => '250',
'13' => '150000',
'14' => '175000',
'15' => '500',
'16' => '200000',
'17' => '225000',
'18' => '750',
'19' => '250000',
'20' => '1000',
'21' => '275000',
'22' => '300000',
'23' => '1250',
'24' => '350000',
'25' => '400000',
'26' => '1500',
'27' => '450000',
'28' => '500000',
'29' => '2000',
'30' => '750000'
);
//
//
$case_level = array(
'0' => 'gold',
'1' => 'silver',
'2' => 'silver',
'3' => 'gold',
'4' => 'silver',
'5' => 'silver',
'6' => 'gold',
'7' => 'silver',
'8' => 'silver',
'9' => 'gold',
'10' => 'silver',
'11' => 'silver',
'12' => 'gold',
'13' => 'silver',
'14' => 'silver',
'15' => 'gold',
'16' => 'silver',
'17' => 'silver',
'18' => 'gold',
'19' => 'silver',
'20' => 'gold',
'21' => 'silver',
'22' => 'silver',
'23' => 'gold',
'24' => 'silver',
'25' => 'silver',
'26' => 'gold',
'27' => 'silver',
'28' => 'silver',
'29' => 'gold',
'30' => 'silver'
);
//
//
$id = number($_GET['id']);
if($id >= 1){
//
$sm = fch("SELECT * FROM `inv` WHERE `yes` = ? AND `id` = ? AND `id_user` = ? LIMIT 1", array(1,$id,$uid));
//
if(!$sm){
header('location:?');
exit();
}
//
//
if($sm['smitch'] >= $sm['max_smitch']){
header('location:?');
exit();
}
//
//
$action = fch("SELECT * FROM `action` WHERE `time` > ? ORDER BY `id` DESC LIMIT 1", array(time()));
if($action['tipe'] == 4){
$gold1 = intval($smitch_level[$sm['smitch']]*$action['bonus']/100);
$gold = $smitch_level[$sm['smitch']]-$gold1;
//
$silver1 = intval($smitch_level[$sm['smitch']]*$action['bonus']/100);
$silver = $smitch_level[$sm['smitch']]-$silver1;
}
else{
$gold = $smitch_level[$sm['smitch']];
$silver = $smitch_level[$sm['smitch']];
}
//
//
if($case_level[$sm['smitch']] == 'gold'){
if($user['gold'] < $gold){
err("<small>Недостаточно золота - <a href='/paywk/'>[Купить золото]</a></small>");
header('location:?');
exit();
}
//
qry("UPDATE `inv` SET `power` = `power` + ?, `block` = `block` + ?, `health` = `health` + ?, `smitch` = `smitch` + ? WHERE `id` = ? LIMIT 1", array(3,3,3,1,$sm['id']));
//
qry("UPDATE `users` SET `power` = `power` + ?, `block` = `block` + ?, `health` = `health` + ?, `gold` = `gold` - ? WHERE `id` = ? LIMIT 1", array(3,3,3,$gold,$uid));
//
}elseif($case_level[$sm['smitch']] == 'silver'){
if($user['silver'] < $silver){
err("<small>Недостаточно серебра - <a href='/resource/'>[Обменять]</a></small>");
header('location:?');
exit();
}
//
qry("UPDATE `inv` SET `power` = `power` + ?, `block` = `block` + ?, `health` = `health` + ?, `smitch` = `smitch` + ? WHERE `id` = ? LIMIT 1", array(3,3,3,1,$sm['id']));
//
qry("UPDATE `users` SET `power` = `power` + ?, `block` = `block` + ?, `health` = `health` + ?, `silver` = `silver` - ? WHERE `id` = ? LIMIT 1", array(3,3,3,$silver,$uid));
//
}
msg("<small>Заточка прошла успешно</small>");
header('location:?');
exit();
}
$dat = 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' => 'Сапоги');
?>
<div class="message cntr">Каждая заточка вещи, дает + 3 параметрам</div>
<?
for($i=1;$i<=8;$i++) {
$item = fch("SELECT * FROM `inv` WHERE `type` = ? AND `yes` = ? AND `id_user` = ? LIMIT 1", array($i,1,$uid));
//
//
$action = fch("SELECT * FROM `action` WHERE `time` > ? ORDER BY `id` DESC LIMIT 1", array(time()));
if($action['tipe'] == 4){
$gold1 = intval($smitch_level[$item['smitch']]*$action['bonus']/100);
$gold = $smitch_level[$item['smitch']]-$gold1;
//
$silver1 = intval($smitch_level[$item['smitch']]*$action['bonus']/100);
$silver = $smitch_level[$item['smitch']]-$silver1;
}
else{
$gold = $smitch_level[$item['smitch']];
$silver = $smitch_level[$item['smitch']];
}
//
if($case_level[$item['smitch']] == 'gold'){
$info = "<img class = 'money' src = '/instalscript/images/user/stat/money-gold.gif'> ".$gold."";
}elseif($case_level[$item['smitch']] == 'silver'){
$info = "<img class = 'money' src = '/instalscript/images/user/stat/money-silver.gif'> ".$silver."";
}
//
if($item){
echo "
<div class = 'message'>
<table>
<td class = 'w1px'>
<a href = '/item/?id=".$uid."&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>
<a href = '/item/?id=".$uid."&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($item['smitch'] < $item['max_smitch'])echo "
<a class = 'lnk ma cntr' href = '?id=".$item['id']."'>Заточить за ".$info."</a>
";
}
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>
";
echo "<a href = '/shop/item/'>Купить снаряжение</a><br>";
echo "
</div>
";
}
}
echo " <br>
<div class = 'hr'></div>
<div class = 'message'>
<a href = '/shop/'>Вернуться назад</a>
</div>
";
foot($uid);
?>