Файл: zfarm.mobi/inc/farm/seat_all.php
Строк: 137
<?
$title="Выбор семян";
include_once '../system/config.php';
if(isset($_GET['seat_all']) && mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_ground` WHERE `id_user` = '$ku[id]' AND `id_plant` = '0' AND `cultivator` = '1'"),0)!=0 && $ku['seeder']>0)
{
echo"<div class='rzd2'></div><div class='menuin2'>";
echo '<div class="title">Магазин семян</h2></div>';
echo "<div class='content'>";
echo "<div class='div'>";
if($ku['last_plant']!=0)
{
$plant=mysql_fetch_array(mysql_query("SELECT * FROM `kolhoz_plant` WHERE `id` = '$ku[last_plant]'"));
$cg=mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_ground` WHERE `id_user` = '$ku[id]' AND `id_plant` = '0'"),0);
$mon=($plant['cena']/100)*$seeder_act_skid;
$money=floor($plant['cena']-$mon);
$sc=$money*$cg;
$rat=$plant['rating'];
$rat_sc_act=0;
$rat_drakon_act=0;
$rat_seeder_act=0;
$rat_school_act=0;
$rat_lib_act=0;
if(isset($sc_act))$rat_sc_act=$rat*2;
if(isset($drakon_act))$rat_drakon_act=(($plant['rating']/100)*300);
if(isset($seeder_act))$rat_seeder_act=(($rat/100)*$seeder_act);
if(isset($school_act))$rat_school_act=$rat*2;
if(isset($lib_act))$rat_lib_act=$rat*2;
if($mc['MedalRating']>0)$rat_medal=(($rat/100)*($mc['MedalRating']*0.5));
if(isset($shmel_act))$rat_seeder_act=$rat_seeder_act*2;
$ratt=$rat_drakon_act+$rat_medal+$rat_sc_act+$rat_seeder_act+$rat_school_act+$rat_lib_act;
if($ratt==0)$rat=$rat;
else $rat=$ratt;
if(isset($dexp))$rat=$rat*2;if(isset($exp3))$rat=$rat*3;
if($gos['id_plant']==$plant['id'] && $gos['type']=='rating' && isset($mc))$rat=$rat*2;
if($ku['money']>=$sc)
{
$q=mysql_query("SELECT * FROM `kolhoz_ground` WHERE `id_user` = '$ku[id]' AND `id_plant` = '0' AND `cultivator` = '1'");
$orat=0;
while($post=mysql_fetch_array($q))
{
$orat=$rat+$orat;
mysql_query("UPDATE `kolhoz_ground` SET `id_plant` = '$plant[id]', `time_soil` = '".($time+$plant['time_soil'])."', `time_water` = '".($time+120)."', `soil` = '0', `time` = '".($plant['time']+$time)."' WHERE `id` = '$post[id]' LIMIT 1");
}
mysql_query("UPDATE `kolhoz_user` SET `money` = '".($ku['money']-$sc)."' WHERE `id` = '$ku[id]'");
mysql_query("UPDATE `kolhoz_user` SET `rating` = '".($ku['rating']+$orat)."' WHERE `id` = '$ku[id]'");
update_mc($orat);
$_SESSION['rating']=$orat;
}
else
{
$_SESSION['no_money']=$sc-$ku['money'];
}
header("Location:/garden/");
exit;
}
else
{
$plant=mysql_fetch_array(mysql_query("SELECT * FROM `kolhoz_plant` WHERE `id` = '".intval($_GET['select'])."'"));
if(isset($_GET['select']) && intval($_GET['select'])!=NULL && $plant['dostup']<1 && mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_plant` WHERE `id` = '".intval($_GET['select'])."' AND (`level` = '$ku[level]' OR `level` < '$ku[level]')"),0)!=0)
{
$plant=mysql_fetch_array(mysql_query("SELECT * FROM `kolhoz_plant` WHERE `id` = '".intval($_GET['select'])."'"));
mysql_query("UPDATE `kolhoz_user` SET `last_plant` = '$plant[id]' WHERE `id` = '$ku[id]'");
header("Location:?myfarm&seat_all");
exit;
}
$k_post = mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_plant`"),0);
if ($k_post==0)
{
echo "Список пуст...";
}
$k_page=k_page($k_post,$set['p_str']);
$page=page($k_page);
$start=$set['p_str']*$page-$set['p_str'];
$q=mysql_query("SELECT * FROM `kolhoz_plant` ORDER BY `level` ASC LIMIT $start, $set[p_str]");
echo "<ul>";
while($post=mysql_fetch_array($q))
{
echo "<li style='padding-bottom:8px'>";
echo "<div class='small'>
";
echo " <img style='border-radius: 5px' width='48' height='48' src='/img/plants/$post[img].png' alt='o' class='portrait'>";
if($ku['level']>=$post['level'] && $post['dostup']<1)echo"<br><a href='/garden/seatall/select/$post[id]/'><span>".hsc($post['name'])."</a></span><span class='minor'>, цена: </span><span><img src='/img/icons/money.png' alt='o'><span class='n'>$post[cena]</span></span></span></div>";
if($ku['level']<$post['level'] && $post['dostup']<1)echo"<br><span>".hsc($post['name'])."</a></span><span class='minor'>, доступно c <span class='n'>$post[level]</span></span> уровня</span></div>";
if($post['dostup']>0)echo"<br><span>".hsc($post['name'])."</a></span><span class='minor'>, доступно в период <span class='n'>ивентов</span></span></span></div>";
echo"
<div class='small minor'> Время созревания: <span class='n'>".time_left($post['time'])."</span>, Время до удобрения: <span class='n'>".time_left($post['time_soil'])."</span><br>Доход: <img src='/img/icons/money.png' alt='o'> <span>$post[money]</span>,
Опыт: <img src='/img/icons/experience.png' alt='o'> <span>$post[rating]</span>,
Урожай: <span>$post[count]</span> <span>шт.</span></div></li>";
}
echo "</ul>";
if ($k_page>1)str("/garden/seatall/",$k_page,$page); // Вывод страниц
}
echo "</div>";
echo"</div></div><div class='rzd2'></div>";
include_once '../system/foot.php';
}
?>